Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/back-office/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { TranslateService } from '@ngx-translate/core';
import { environment } from '../environments/environment';
import { CldrIntlService, IntlService } from '@progress/kendo-angular-intl';

/**
* Root component of back-office.
*/
Expand Down
1 change: 1 addition & 0 deletions apps/back-office/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ export const environment: Environment = {
'summaryCard',
'tabs',
],
mixpanelToken: 'a90bc11bbb9f338701eaa1422a98e35e',
};
1 change: 1 addition & 0 deletions apps/back-office/src/environments/environment.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ export interface Environment {
sentry?: any;
maxFileSize?: number;
user?: UserConfiguration;
mixpanelToken?: string;
}
1 change: 1 addition & 0 deletions libs/shared/src/lib/models/form.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export interface Form {
aggregations?: Connection<Aggregation>;
metadata?: Metadata[];
allowUploadRecords?: boolean;
logEvents?: boolean;
}

/** Model for form graphql graphql query response */
Expand Down
10 changes: 10 additions & 0 deletions libs/shared/src/lib/services/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
} from '@casl/ability';
import { get } from 'lodash';
import { Application } from '../../models/application.model';
import * as Mixpanel from 'mixpanel-browser';

/** Defining the interface for the account object. */
export interface Account {
Expand Down Expand Up @@ -252,6 +253,15 @@ export class AuthService {
* Cleans user profile, and logout.
*/
logout(): void {
// Register logout events.
Mixpanel.init(this.environment.mixpanelToken, {
debug: true,
// track_pageview: true,
persistence: 'localStorage',
});
Mixpanel.track('User logout', {
$user: this.userValue,
});
this.account = null;
this.user.next(null);
localStorage.removeItem('idtoken');
Expand Down
9 changes: 9 additions & 0 deletions libs/shared/src/lib/survey/global-properties/others.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,15 @@ export const init = (environment: any): void => {
visibleIndex: 2,
});

// Adds property to log the form events
serializer.addProperty('survey', {
name: 'logEvents',
category: 'general',
type: 'boolean',
default: false,
visibleIndex: 2,
});

// Add ability to conditionally allow dynamic panel add new panel
serializer.addProperty('paneldynamic', {
name: 'AllowNewPanelsExpression:expression',
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"leaflet.timeline": "^1.6.0",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
"mixpanel-browser": "^2.49.0",
"monaco-editor": "^0.34.1",
"ng2-charts": "^4.1.1",
"ngx-monaco-editor-v2": "^15.0.1",
Expand Down Expand Up @@ -155,6 +156,7 @@
"@types/leaflet-fullscreen": "^1.0.6",
"@types/leaflet.heat": "^0.2.1",
"@types/leaflet.markercluster": "^1.5.1",
"@types/mixpanel-browser": "^2.49.0",
"@types/node": "18.7.1",
"@types/proj4": "^2.5.2",
"@types/to-json-schema": "^0.2.4",
Expand Down