{"version":3,"file":"angulartics2-mixpanel.js","sources":["ng://angulartics2/mixpanel/mixpanel.ts","ng://angulartics2/mixpanel/angulartics2-mixpanel.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { Angulartics2 } from 'angulartics2';\n\ndeclare var mixpanel: any;\n\n@Injectable({ providedIn: 'root' })\nexport class Angulartics2Mixpanel {\n\n constructor(\n private angulartics2: Angulartics2\n ) {\n this.angulartics2.setUsername\n .subscribe((x: string) => this.setUsername(x));\n this.angulartics2.setUserProperties\n .subscribe((x) => this.setUserProperties(x));\n this.angulartics2.setUserPropertiesOnce\n .subscribe((x) => this.setUserPropertiesOnce(x));\n this.angulartics2.setSuperProperties\n .subscribe((x) => this.setSuperProperties(x));\n this.angulartics2.setSuperPropertiesOnce\n .subscribe((x) => this.setSuperPropertiesOnce(x));\n this.angulartics2.setAlias\n .subscribe((x) => this.setAlias(x));\n }\n\n startTracking(): void {\n this.angulartics2.pageTrack\n .pipe(this.angulartics2.filterDeveloperMode())\n .subscribe((x) => this.pageTrack(x.path));\n this.angulartics2.eventTrack\n .pipe(this.angulartics2.filterDeveloperMode())\n .subscribe((x) => this.eventTrack(x.action, x.properties));\n }\n\n pageTrack(path: string) {\n try {\n mixpanel.track('Page Viewed', { page: path });\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n eventTrack(action: string, properties: any) {\n try {\n mixpanel.track(action, properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n setUsername(userId: string) {\n try {\n mixpanel.identify(userId);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n setUserProperties(properties: any) {\n try {\n mixpanel.people.set(properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n setUserPropertiesOnce(properties: any) {\n try {\n mixpanel.people.set_once(properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n setSuperProperties(properties: any) {\n try {\n mixpanel.register(properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n setSuperPropertiesOnce(properties: any) {\n try {\n mixpanel.register_once(properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n setAlias(alias: any) {\n try {\n mixpanel.alias(alias);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './mixpanel';\n"],"names":[],"mappings":";;;;;IASE,8BACU,YAA0B;QADpC,iBAeC;QAdS,iBAAY,GAAZ,YAAY,CAAc;QAElC,IAAI,CAAC,YAAY,CAAC,WAAW;aAC1B,SAAS,CAAC,UAAC,CAAS,IAAK,OAAA,KAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;QACjD,IAAI,CAAC,YAAY,CAAC,iBAAiB;aAChC,SAAS,CAAC,UAAC,CAAC,IAAK,OAAA,KAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;QAC/C,IAAI,CAAC,YAAY,CAAC,qBAAqB;aACpC,SAAS,CAAC,UAAC,CAAC,IAAK,OAAA,KAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;QACnD,IAAI,CAAC,YAAY,CAAC,kBAAkB;aACjC,SAAS,CAAC,UAAC,CAAC,IAAK,OAAA,KAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;QAChD,IAAI,CAAC,YAAY,CAAC,sBAAsB;aACrC,SAAS,CAAC,UAAC,CAAC,IAAK,OAAA,KAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;QACpD,IAAI,CAAC,YAAY,CAAC,QAAQ;aACvB,SAAS,CAAC,UAAC,CAAC,IAAK,OAAA,KAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAA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