Created
April 24, 2017 14:18
-
-
Save diegodfsd/0038d80cf653187eb30dce503285d5b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script data-cfasync="false"> | |
window.civchat = { | |
apiKey: "RnPwwO6i9FjR2jfUUZ25ojfvXBWZiYDdC0dzy2XNrj1MQIk8gjTRozQiXlRHcm30", | |
name: "", | |
email: "" | |
}; | |
</script> | |
<script data-cfasync="false" src="https://widget.userengage.io/widget.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { SessionService } from '../shared/session.service'; | |
@Component({ | |
selector: 'user-engage', | |
templateUrl: './user-engage.component.html', | |
styleUrls: ['./user-engage.component.scss'] | |
}) | |
export class UserEngageComponent implements OnInit { | |
private apiKey: string = 'user-engage-key'; | |
constructor(private userSession: SessionService) { } | |
ngOnInit() { | |
this.userSession.currentUser.subscribe(profile => { | |
const w: any = window; | |
w.UE.resetAuth(this.getAuth(profile)); | |
}); | |
} | |
private getAuth(profile: any): any { | |
if (!profile) { | |
return { | |
apiKey: this.apiKey, | |
name: "", | |
email: "" | |
}; | |
} | |
return { | |
apiKey: this.apiKey, | |
name: profile.fullname, | |
email: profile.email | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment