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
};
}
}