{"version":3,"file":"angulartics2-amplitude.js","sources":["ng://angulartics2/amplitude/amplitude.ts","ng://angulartics2/amplitude/angulartics2-amplitude.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { Angulartics2 } from 'angulartics2';\n\ndeclare var amplitude: {\n getInstance: () => {\n logEvent(action: string, properties: any);\n setUserId(userId: string);\n setUserProperties(properties: any);\n }\n};\n\n@Injectable({ providedIn: 'root' })\nexport class Angulartics2Amplitude {\n\n constructor(private angulartics2: Angulartics2) {\n this.angulartics2.setUsername\n .subscribe((x: any) => this.setUsername(x));\n this.angulartics2.setUserProperties\n .subscribe((x: any) => this.setUserProperties(x));\n this.angulartics2.setUserPropertiesOnce\n .subscribe((x: any) => this.setUserProperties(x));\n }\n\n startTracking(): void {\n this.angulartics2.pageTrack\n .pipe(this.angulartics2.filterDeveloperMode())\n .subscribe((x: any) => this.pageTrack(x.path));\n this.angulartics2.eventTrack\n .pipe(this.angulartics2.filterDeveloperMode())\n .subscribe((x: any) => this.eventTrack(x.action, x.properties));\n }\n\n pageTrack(path: string) {\n try {\n this.eventTrack('Pageview', {\n url: path\n });\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n eventTrack(action: string, properties: any) {\n try {\n amplitude.getInstance().logEvent(action, properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n setUsername(userId: string) {\n try {\n amplitude.getInstance().setUserId(userId);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n\n setUserProperties(properties: any) {\n try {\n amplitude.getInstance().setUserProperties(properties);\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 './amplitude';\n"],"names":[],"mappings":";;;;;IAeE,+BAAoB,YAA0B;QAA9C,iBAOC;QAPmB,iBAAY,GAAZ,YAAY,CAAc;QAC5C,IAAI,CAAC,YAAY,CAA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