From fc97be478202ed7fca8307e9002202e3f944c7ba Mon Sep 17 00:00:00 2001 From: Lyubov Voloshko Date: Wed, 4 Jun 2025 14:36:07 +0300 Subject: [PATCH] hotjar: send param if demo mode --- frontend/src/app/app.component.ts | 6 ++++++ frontend/src/app/auth.guard.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index f86f592cf..02a7f9834 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -120,6 +120,7 @@ export class AppComponent { this.page = this.router.routerState.snapshot.url; if (this.router.routerState.snapshot.root.queryParams.mode === 'demo') { + console.log('App component, demo mode search params found'); this._auth.loginToDemoAccount().subscribe( () => { this.angulartics2.eventTrack.next({ action: 'Demo account is logged in', @@ -241,6 +242,11 @@ export class AppComponent { user_id: res.id, email: res.email }); + + //@ts-ignore + if (this.isDemo) window.hj?.('identify', this.currentUser.id, { + 'mode': 'demo' + }); this._company.getWhiteLabelProperties(res.company.id).subscribe( whiteLabelSettings => { this.whiteLabelSettings.logo = whiteLabelSettings.logo; this.whiteLabelSettingsLoaded = true; diff --git a/frontend/src/app/auth.guard.ts b/frontend/src/app/auth.guard.ts index 594c4a760..e7849a734 100644 --- a/frontend/src/app/auth.guard.ts +++ b/frontend/src/app/auth.guard.ts @@ -26,6 +26,7 @@ export class AuthGuard implements CanActivate { const expirationInterval = differenceInMilliseconds(expirationTime, currantTime); if (expirationInterval > 0) return true; } else { + console.log('auth guard, expirationInterval <= 0'); this.router.navigate(['/login']); } return false;