Skip to content

Commit

Permalink
feat: nps
Browse files Browse the repository at this point in the history
  • Loading branch information
scarqin committed Feb 23, 2023
1 parent 33b4141 commit 426a08f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
position: absolute;
z-index: 1000000000;
background-color: #fff;
height: 53px;
height: 20px;
line-height: 53px;
text-align: center;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { NpsPositionDirective } from '../nps-mask-postion.directive';
@Component({
selector: 'pc-nps-mask',
template: `<ng-container pcNpsPosition>
<div i18n class="title">How would you rate your experience with the Postcat</div>
<!-- <div i18n class="title">How would you rate your experience with the Postcat</div> -->
<div class="tips text-tips"></div>
</ng-container> `,
styleUrls: ['./nps-mask.component.scss'],
Expand All @@ -16,6 +16,11 @@ export class npsMaskComponent implements OnInit {
constructor(private store: StoreService) {}
ngOnInit(): void {
this.bindUserID();

//* Trigger NPS after wondering 20 seconds
setTimeout(() => {
this.showNps();
}, 20 * 1000);
}
bindUserID() {
const userProfile = this.store.getUserProfile;
Expand All @@ -25,4 +30,9 @@ export class npsMaskComponent implements OnInit {
email: userProfile?.email
});
}
private showNps() {
console.log('showNps');
//@ts-ignore
_howxm('event', 'show_nps', {});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class NpsPositionDirective {
step = 2;
this.showTitle = false;
const tipsDom = this.el.nativeElement.querySelector('.tips');
tipsDom.innerText = $localize`Thank you for your feedback`;
// tipsDom.innerText = $localize`Thank you for your feedback`;
return;
}

Expand All @@ -123,6 +123,7 @@ export class NpsPositionDirective {
observer.observe(targetNode, config);
}
batchSetPropery(dom, propsObj) {
if (!dom) return;
Object.keys(propsObj).forEach(keyName => {
dom.style.setProperty(keyName, propsObj[keyName]);
});
Expand Down

0 comments on commit 426a08f

Please sign in to comment.