@microsoft/applicationinsights-angularplugin-js 2.7.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/{esm2015/lib/IErrorService.js → esm2020/lib/IErrorService.mjs} +0 -0
  2. package/esm2020/lib/applicationinsights-angularplugin-error.service.mjs +49 -0
  3. package/esm2020/lib/applicationinsights-angularplugin-js.component.mjs +110 -0
  4. package/esm2020/lib/applicationinsights-angularplugin-js.module.mjs +23 -0
  5. package/{esm2015/microsoft-applicationinsights-angularplugin-js.js → esm2020/microsoft-applicationinsights-angularplugin-js.mjs} +0 -0
  6. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  7. package/fesm2015/microsoft-applicationinsights-angularplugin-js.mjs +186 -0
  8. package/fesm2015/microsoft-applicationinsights-angularplugin-js.mjs.map +1 -0
  9. package/fesm2020/microsoft-applicationinsights-angularplugin-js.mjs +185 -0
  10. package/fesm2020/microsoft-applicationinsights-angularplugin-js.mjs.map +1 -0
  11. package/lib/applicationinsights-angularplugin-error.service.d.ts +5 -1
  12. package/lib/applicationinsights-angularplugin-js.component.d.ts +7 -0
  13. package/lib/applicationinsights-angularplugin-js.module.d.ts +5 -0
  14. package/microsoft-applicationinsights-angularplugin-js-2.9.0.tgz +0 -0
  15. package/microsoft-applicationinsights-angularplugin-js.d.ts +1 -0
  16. package/package.json +24 -12
  17. package/bundles/microsoft-applicationinsights-angularplugin-js.umd.js +0 -501
  18. package/bundles/microsoft-applicationinsights-angularplugin-js.umd.js.map +0 -1
  19. package/bundles/microsoft-applicationinsights-angularplugin-js.umd.min.js +0 -16
  20. package/bundles/microsoft-applicationinsights-angularplugin-js.umd.min.js.map +0 -1
  21. package/esm2015/lib/applicationinsights-angularplugin-error.service.js +0 -38
  22. package/esm2015/lib/applicationinsights-angularplugin-js.component.js +0 -87
  23. package/esm2015/lib/applicationinsights-angularplugin-js.module.js +0 -16
  24. package/fesm2015/microsoft-applicationinsights-angularplugin-js.js +0 -146
  25. package/fesm2015/microsoft-applicationinsights-angularplugin-js.js.map +0 -1
  26. package/microsoft-applicationinsights-angularplugin-js-2.7.0.tgz +0 -0
  27. package/microsoft-applicationinsights-angularplugin-js.metadata.json +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microsoft-applicationinsights-angularplugin-js.mjs","sources":["../../../projects/applicationinsights-angularplugin-js/src/lib/applicationinsights-angularplugin-error.service.ts","../../../projects/applicationinsights-angularplugin-js/src/lib/applicationinsights-angularplugin-js.component.ts","../../../projects/applicationinsights-angularplugin-js/src/lib/applicationinsights-angularplugin-js.module.ts","../../../projects/applicationinsights-angularplugin-js/src/public-api.ts","../../../projects/applicationinsights-angularplugin-js/src/microsoft-applicationinsights-angularplugin-js.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\r\nimport { IAppInsights } from '@microsoft/applicationinsights-common';\r\nimport { arrForEach, isFunction } from '@microsoft/applicationinsights-core-js';\r\nimport { IErrorService } from './IErrorService';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ApplicationinsightsAngularpluginErrorService implements IErrorService {\r\n public static instance: ApplicationinsightsAngularpluginErrorService = null;\r\n private analyticsPlugin: IAppInsights;\r\n private errorServices: IErrorService[] = [];\r\n\r\n constructor() {\r\n if (ApplicationinsightsAngularpluginErrorService.instance === null) {\r\n ApplicationinsightsAngularpluginErrorService.instance = this;\r\n }\r\n }\r\n\r\n public set plugin(analyticsPlugin: IAppInsights) {\r\n this.analyticsPlugin = analyticsPlugin;\r\n }\r\n\r\n public addErrorHandler(errorService: IErrorService): void {\r\n if (errorService && isFunction(errorService.handleError)) {\r\n this.errorServices.push(errorService);\r\n }\r\n }\r\n\r\n public removeErrorHandler(errorService: IErrorService): void {\r\n if (errorService && isFunction(errorService.handleError)) {\r\n const idx = this.errorServices.indexOf(errorService);\r\n if (idx !== -1) {\r\n this.errorServices.splice(idx, 1);\r\n }\r\n }\r\n }\r\n\r\n handleError(error: any): void {\r\n if (this.analyticsPlugin) {\r\n this.analyticsPlugin.trackException({ exception: error });\r\n }\r\n\r\n if (this.errorServices && this.errorServices.length > 0) {\r\n arrForEach(this.errorServices, errorService => {\r\n if (isFunction(errorService.handleError)) {\r\n errorService.handleError(error);\r\n }\r\n });\r\n }\r\n }\r\n}\r\n\r\n","import { Component } from '@angular/core';\r\nimport {\r\n IConfig, IPageViewTelemetry, IAppInsights, PropertiesPluginIdentifier, Util, AnalyticsPluginIdentifier\r\n} from '@microsoft/applicationinsights-common';\r\nimport {\r\n IPlugin, IConfiguration, IAppInsightsCore,\r\n BaseTelemetryPlugin, arrForEach, ITelemetryItem, ITelemetryPluginChain,\r\n IProcessTelemetryContext, getLocation, _throwInternal, eLoggingSeverity, _eInternalMessageId, IProcessTelemetryUnloadContext, ITelemetryUnloadState\r\n} from '@microsoft/applicationinsights-core-js';\r\nimport { NavigationEnd, Router } from '@angular/router';\r\n// For types only\r\nimport * as properties from '@microsoft/applicationinsights-properties-js';\r\nimport { ApplicationinsightsAngularpluginErrorService } from './applicationinsights-angularplugin-error.service';\r\nimport { IErrorService } from './IErrorService';\r\nimport { Subscription } from 'rxjs';\r\nimport { AnalyticsPlugin } from '@microsoft/applicationinsights-analytics-js';\r\n\r\ninterface IAngularExtensionConfig {\r\n /**\r\n * Angular router for enabling Application Insights PageView tracking.\r\n */\r\n router?: Router;\r\n\r\n /**\r\n * Custom error service for global error handling.\r\n */\r\n errorServices?: IErrorService[];\r\n}\r\n\r\n@Component({\r\n selector: 'lib-applicationinsights-angularplugin-js',\r\n template: ``,\r\n styles: []\r\n})\r\n// eslint-disable-next-line @angular-eslint/component-class-suffix\r\nexport class AngularPlugin extends BaseTelemetryPlugin {\r\n public priority = 186;\r\n public identifier = 'AngularPlugin';\r\n\r\n private analyticsPlugin: AnalyticsPlugin;\r\n private propertiesPlugin: properties.PropertiesPlugin;\r\n private _angularCfg: IAngularExtensionConfig = null;\r\n private _eventSubscription: Subscription = null;\r\n\r\n\r\n constructor() {\r\n super();\r\n let self = this;\r\n\r\n self._doTeardown = (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void): void | boolean => {\r\n if (this.analyticsPlugin && ApplicationinsightsAngularpluginErrorService.instance !== null) {\r\n ApplicationinsightsAngularpluginErrorService.instance.plugin = null;\r\n if (self._angularCfg) {\r\n if (self._angularCfg.errorServices && Array.isArray(self._angularCfg.errorServices)) {\r\n arrForEach(self._angularCfg.errorServices, (errorService: IErrorService) => {\r\n ApplicationinsightsAngularpluginErrorService.instance.removeErrorHandler(errorService);\r\n });\r\n }\r\n }\r\n }\r\n\r\n if (self._eventSubscription) {\r\n self._eventSubscription.unsubscribe();\r\n self._eventSubscription = null;\r\n }\r\n\r\n self.analyticsPlugin = null;\r\n self.propertiesPlugin = null;\r\n self._angularCfg = null;\r\n }\r\n }\r\n\r\n initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain) {\r\n super.initialize(config, core, extensions, pluginChain);\r\n const self = this;\r\n const ctx = self._getTelCtx();\r\n const extConfig = ctx.getExtCfg<IAngularExtensionConfig>(self.identifier, { router: null, errorServices: null });\r\n\r\n self.propertiesPlugin = core.getPlugin<properties.PropertiesPlugin>(PropertiesPluginIdentifier)?.plugin;\r\n self.analyticsPlugin = core.getPlugin<AnalyticsPlugin>(AnalyticsPluginIdentifier)?.plugin;\r\n if (self.analyticsPlugin) {\r\n if (ApplicationinsightsAngularpluginErrorService.instance !== null) {\r\n ApplicationinsightsAngularpluginErrorService.instance.plugin = self.analyticsPlugin;\r\n if (extConfig.errorServices && Array.isArray(extConfig.errorServices)) {\r\n arrForEach(extConfig.errorServices, (errorService: IErrorService) => {\r\n ApplicationinsightsAngularpluginErrorService.instance.addErrorHandler(errorService);\r\n });\r\n }\r\n }\r\n }\r\n\r\n if (extConfig.router) {\r\n let isPageInitialLoad = true;\r\n const pageViewTelemetry: IPageViewTelemetry = {\r\n uri: extConfig.router.url\r\n };\r\n self.trackPageView(pageViewTelemetry);\r\n self._eventSubscription = extConfig.router.events.subscribe(event => {\r\n if (self.isInitialized()) {\r\n if (event instanceof NavigationEnd) {\r\n // for page initial load, do not call trackPageView twice\r\n if (isPageInitialLoad) {\r\n isPageInitialLoad = false;\r\n return;\r\n }\r\n const pvt: IPageViewTelemetry = {\r\n uri: extConfig.router.url,\r\n properties: { duration: 0 } // SPA route change loading durations are undefined, so send 0\r\n };\r\n self.trackPageView(pvt);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Add Part A fields to the event\r\n *\r\n * @param event The event that needs to be processed\r\n */\r\n processTelemetry(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext) {\r\n this.processNext(event, itemCtx);\r\n }\r\n\r\n trackPageView(pageView: IPageViewTelemetry) {\r\n const self = this;\r\n\r\n if (self.analyticsPlugin) {\r\n const location = getLocation();\r\n if (self.propertiesPlugin && self.propertiesPlugin.context && self.propertiesPlugin.context.telemetryTrace) {\r\n self.propertiesPlugin.context.telemetryTrace.traceID = Util.generateW3CId();\r\n self.propertiesPlugin.context.telemetryTrace.name = location && location.pathname || '_unknown_';\r\n }\r\n self.analyticsPlugin.trackPageView(pageView);\r\n } else {\r\n _throwInternal(self.diagLog(),\r\n // eslint-disable-next-line max-len\r\n eLoggingSeverity.CRITICAL, _eInternalMessageId.TelemetryInitializerFailed, 'Analytics plugin is not available, Angular plugin telemetry will not be sent: ');\r\n }\r\n }\r\n\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { AngularPlugin } from './applicationinsights-angularplugin-js.component';\r\nimport { ApplicationinsightsAngularpluginErrorService } from './applicationinsights-angularplugin-error.service';\r\n\r\n@NgModule({\r\n declarations: [AngularPlugin],\r\n imports: [\r\n ],\r\n exports: [AngularPlugin],\r\n providers: [\r\n ApplicationinsightsAngularpluginErrorService\r\n ]\r\n})\r\nexport class ApplicationinsightsAngularpluginJsModule { }\r\n","/*\r\n * Public API Surface of applicationinsights-angularplugin-js\r\n */\r\n\r\nexport * from './lib/applicationinsights-angularplugin-js.component';\r\nexport * from './lib/applicationinsights-angularplugin-js.module';\r\nexport * from './lib/applicationinsights-angularplugin-error.service';\r\nexport * from './lib/IErrorService';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAQa,4CAA4C;IAKrD;QAFQ,kBAAa,GAAoB,EAAE,CAAC;QAGxC,IAAI,4CAA4C,CAAC,QAAQ,KAAK,IAAI,EAAE;YAChE,4CAA4C,CAAC,QAAQ,GAAG,IAAI,CAAC;SAChE;KACJ;IAED,IAAW,MAAM,CAAC,eAA6B;QAC3C,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;KAC1C;IAEM,eAAe,CAAC,YAA2B;QAC9C,IAAI,YAAY,IAAI,UAAU,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE;YACtD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SACzC;KACJ;IAEM,kBAAkB,CAAC,YAA2B;QACjD,IAAI,YAAY,IAAI,UAAU,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE;YACtD,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YACrD,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE;gBACZ,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;aACrC;SACJ;KACJ;IAED,WAAW,CAAC,KAAU;QAClB,IAAI,IAAI,CAAC,eAAe,EAAE;YACtB,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;SAC7D;QAED,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;YACrD,UAAU,CAAC,IAAI,CAAC,aAAa,E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AAC;SAChD;aAAM;YACH,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,yDAEkD,gFAAgF,CAAC,CAAC;SACpK;KACJ;;0GAzGQ,aAAa;8FAAb,aAAa,uGAJZ,EAAE;2FAIH,aAAa;kBANzB,SAAS;mBAAC;oBACP,QAAQ,EAAE,0CAA0C;oBACpD,QAAQ,EAAE,EAAE;oBACZ,MAAM,EAAE,EAAE;iBACb;;;MCpBY,wCAAwC;;qIAAxC,wCAAwC;sIAAxC,wCAAwC,iBARlC,aAAa,aAGlB,aAAa;sIAKd,wCAAwC,aAJtC;QACP,4CAA4C;KAC/C,YALQ,EACR;2FAMQ,wCAAwC;kBATpD,QAAQ;mBAAC;oBACN,YAAY,EAAE,CAAC,aAAa,CAAC;oBAC7B,OAAO,EAAE,EACR;oBACD,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,SAAS,EAAE;wBACP,4CAA4C;qBAC/C;iBACJ;;;ACZD;;;;ACAA;;;;;;"}
@@ -1,11 +1,15 @@
1
1
  import { IAppInsights } from '@microsoft/applicationinsights-common';
2
2
  import { IErrorService } from './IErrorService';
3
+ import * as i0 from "@angular/core";
3
4
  export declare class ApplicationinsightsAngularpluginErrorService implements IErrorService {
4
5
  static instance: ApplicationinsightsAngularpluginErrorService;
5
6
  private analyticsPlugin;
6
7
  private errorServices;
8
+ constructor();
7
9
  set plugin(analyticsPlugin: IAppInsights);
8
10
  addErrorHandler(errorService: IErrorService): void;
9
- constructor();
11
+ removeErrorHandler(errorService: IErrorService): void;
10
12
  handleError(error: any): void;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApplicationinsightsAngularpluginErrorService, never>;
14
+ static ɵprov: i0.ɵɵInjectableDeclaration<ApplicationinsightsAngularpluginErrorService>;
11
15
  }
@@ -1,15 +1,22 @@
1
1
  import { IConfig, IPageViewTelemetry } from '@microsoft/applicationinsights-common';
2
2
  import { IPlugin, IConfiguration, IAppInsightsCore, BaseTelemetryPlugin, ITelemetryItem, ITelemetryPluginChain, IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
3
+ import * as i0 from "@angular/core";
3
4
  export declare class AngularPlugin extends BaseTelemetryPlugin {
4
5
  priority: number;
5
6
  identifier: string;
6
7
  private analyticsPlugin;
7
8
  private propertiesPlugin;
9
+ private _angularCfg;
10
+ private _eventSubscription;
11
+ constructor();
8
12
  initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
9
13
  /**
10
14
  * Add Part A fields to the event
15
+ *
11
16
  * @param event The event that needs to be processed
12
17
  */
13
18
  processTelemetry(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
14
19
  trackPageView(pageView: IPageViewTelemetry): void;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<AngularPlugin, never>;
21
+ static ɵcmp: i0.ɵɵComponentDeclaration<AngularPlugin, "lib-applicationinsights-angularplugin-js", never, {}, {}, never, never>;
15
22
  }
@@ -1,2 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./applicationinsights-angularplugin-js.component";
1
3
  export declare class ApplicationinsightsAngularpluginJsModule {
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApplicationinsightsAngularpluginJsModule, never>;
5
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ApplicationinsightsAngularpluginJsModule, [typeof i1.AngularPlugin], never, [typeof i1.AngularPlugin]>;
6
+ static ɵinj: i0.ɵɵInjectorDeclaration<ApplicationinsightsAngularpluginJsModule>;
2
7
  }
@@ -1,4 +1,5 @@
1
1
  /**
2
2
  * Generated bundle index. Do not edit.
3
3
  */
4
+ /// <amd-module name="@microsoft/applicationinsights-angularplugin-js" />
4
5
  export * from './public-api';
package/package.json CHANGED
@@ -1,24 +1,36 @@
1
1
  {
2
2
  "name": "@microsoft/applicationinsights-angularplugin-js",
3
- "version": "2.7.0",
3
+ "version": "2.9.0",
4
4
  "peerDependencies": {
5
- "@angular/common": "^11.0.6",
6
- "@angular/core": "^11.0.6"
5
+ "@angular/common": "^13.0.3",
6
+ "@angular/core": "^13.0.3"
7
7
  },
8
8
  "dependencies": {
9
- "@microsoft/applicationinsights-common": "^2.7.1",
10
- "@microsoft/applicationinsights-core-js": "^2.7.1",
11
- "@microsoft/applicationinsights-properties-js": "^2.7.1",
9
+ "@microsoft/applicationinsights-common": "~2.8.1",
10
+ "@microsoft/applicationinsights-core-js": "~2.8.1",
11
+ "@microsoft/applicationinsights-properties-js": "~2.8.1",
12
12
  "@microsoft/applicationinsights-rollup-es3": "^1.1.3",
13
13
  "@microsoft/applicationinsights-shims": "^1.0.3",
14
14
  "tslib": "^2.0.0"
15
15
  },
16
- "main": "bundles/microsoft-applicationinsights-angularplugin-js.umd.js",
17
- "module": "fesm2015/microsoft-applicationinsights-angularplugin-js.js",
18
- "es2015": "fesm2015/microsoft-applicationinsights-angularplugin-js.js",
19
- "esm2015": "esm2015/microsoft-applicationinsights-angularplugin-js.js",
20
- "fesm2015": "fesm2015/microsoft-applicationinsights-angularplugin-js.js",
16
+ "module": "fesm2015/microsoft-applicationinsights-angularplugin-js.mjs",
17
+ "es2020": "fesm2020/microsoft-applicationinsights-angularplugin-js.mjs",
18
+ "esm2020": "esm2020/microsoft-applicationinsights-angularplugin-js.mjs",
19
+ "fesm2020": "fesm2020/microsoft-applicationinsights-angularplugin-js.mjs",
20
+ "fesm2015": "fesm2015/microsoft-applicationinsights-angularplugin-js.mjs",
21
21
  "typings": "microsoft-applicationinsights-angularplugin-js.d.ts",
22
- "metadata": "microsoft-applicationinsights-angularplugin-js.metadata.json",
22
+ "exports": {
23
+ "./package.json": {
24
+ "default": "./package.json"
25
+ },
26
+ ".": {
27
+ "types": "./microsoft-applicationinsights-angularplugin-js.d.ts",
28
+ "esm2020": "./esm2020/microsoft-applicationinsights-angularplugin-js.mjs",
29
+ "es2020": "./fesm2020/microsoft-applicationinsights-angularplugin-js.mjs",
30
+ "es2015": "./fesm2015/microsoft-applicationinsights-angularplugin-js.mjs",
31
+ "node": "./fesm2015/microsoft-applicationinsights-angularplugin-js.mjs",
32
+ "default": "./fesm2020/microsoft-applicationinsights-angularplugin-js.mjs"
33
+ }
34
+ },
23
35
  "sideEffects": false
24
36
  }
@@ -1,501 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@microsoft/applicationinsights-common'), require('@microsoft/applicationinsights-core-js'), require('@angular/router')) :
3
- typeof define === 'function' && define.amd ? define('@microsoft/applicationinsights-angularplugin-js', ['exports', '@angular/core', '@microsoft/applicationinsights-common', '@microsoft/applicationinsights-core-js', '@angular/router'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.microsoft = global.microsoft || {}, global.microsoft["applicationinsights-angularplugin-js"] = {}), global.ng.core, global.applicationinsightsCommon, global.applicationinsightsCoreJs, global.ng.router));
5
- })(this, (function (exports, i0, applicationinsightsCommon, applicationinsightsCoreJs, router) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n["default"] = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
-
27
- /*! *****************************************************************************
28
- Copyright (c) Microsoft Corporation.
29
-
30
- Permission to use, copy, modify, and/or distribute this software for any
31
- purpose with or without fee is hereby granted.
32
-
33
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
34
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
35
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
36
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
37
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
38
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39
- PERFORMANCE OF THIS SOFTWARE.
40
- ***************************************************************************** */
41
- /* global Reflect, Promise */
42
- var extendStatics = function (d, b) {
43
- extendStatics = Object.setPrototypeOf ||
44
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
45
- function (d, b) { for (var p in b)
46
- if (Object.prototype.hasOwnProperty.call(b, p))
47
- d[p] = b[p]; };
48
- return extendStatics(d, b);
49
- };
50
- function __extends(d, b) {
51
- if (typeof b !== "function" && b !== null)
52
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
53
- extendStatics(d, b);
54
- function __() { this.constructor = d; }
55
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
56
- }
57
- var __assign = function () {
58
- __assign = Object.assign || function __assign(t) {
59
- for (var s, i = 1, n = arguments.length; i < n; i++) {
60
- s = arguments[i];
61
- for (var p in s)
62
- if (Object.prototype.hasOwnProperty.call(s, p))
63
- t[p] = s[p];
64
- }
65
- return t;
66
- };
67
- return __assign.apply(this, arguments);
68
- };
69
- function __rest(s, e) {
70
- var t = {};
71
- for (var p in s)
72
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
73
- t[p] = s[p];
74
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
75
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
76
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
77
- t[p[i]] = s[p[i]];
78
- }
79
- return t;
80
- }
81
- function __decorate(decorators, target, key, desc) {
82
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
83
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
84
- r = Reflect.decorate(decorators, target, key, desc);
85
- else
86
- for (var i = decorators.length - 1; i >= 0; i--)
87
- if (d = decorators[i])
88
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
89
- return c > 3 && r && Object.defineProperty(target, key, r), r;
90
- }
91
- function __param(paramIndex, decorator) {
92
- return function (target, key) { decorator(target, key, paramIndex); };
93
- }
94
- function __metadata(metadataKey, metadataValue) {
95
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
96
- return Reflect.metadata(metadataKey, metadataValue);
97
- }
98
- function __awaiter(thisArg, _arguments, P, generator) {
99
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
100
- return new (P || (P = Promise))(function (resolve, reject) {
101
- function fulfilled(value) { try {
102
- step(generator.next(value));
103
- }
104
- catch (e) {
105
- reject(e);
106
- } }
107
- function rejected(value) { try {
108
- step(generator["throw"](value));
109
- }
110
- catch (e) {
111
- reject(e);
112
- } }
113
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
114
- step((generator = generator.apply(thisArg, _arguments || [])).next());
115
- });
116
- }
117
- function __generator(thisArg, body) {
118
- var _ = { label: 0, sent: function () { if (t[0] & 1)
119
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
120
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
121
- function verb(n) { return function (v) { return step([n, v]); }; }
122
- function step(op) {
123
- if (f)
124
- throw new TypeError("Generator is already executing.");
125
- while (_)
126
- try {
127
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
128
- return t;
129
- if (y = 0, t)
130
- op = [op[0] & 2, t.value];
131
- switch (op[0]) {
132
- case 0:
133
- case 1:
134
- t = op;
135
- break;
136
- case 4:
137
- _.label++;
138
- return { value: op[1], done: false };
139
- case 5:
140
- _.label++;
141
- y = op[1];
142
- op = [0];
143
- continue;
144
- case 7:
145
- op = _.ops.pop();
146
- _.trys.pop();
147
- continue;
148
- default:
149
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
150
- _ = 0;
151
- continue;
152
- }
153
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
154
- _.label = op[1];
155
- break;
156
- }
157
- if (op[0] === 6 && _.label < t[1]) {
158
- _.label = t[1];
159
- t = op;
160
- break;
161
- }
162
- if (t && _.label < t[2]) {
163
- _.label = t[2];
164
- _.ops.push(op);
165
- break;
166
- }
167
- if (t[2])
168
- _.ops.pop();
169
- _.trys.pop();
170
- continue;
171
- }
172
- op = body.call(thisArg, _);
173
- }
174
- catch (e) {
175
- op = [6, e];
176
- y = 0;
177
- }
178
- finally {
179
- f = t = 0;
180
- }
181
- if (op[0] & 5)
182
- throw op[1];
183
- return { value: op[0] ? op[1] : void 0, done: true };
184
- }
185
- }
186
- var __createBinding = Object.create ? (function (o, m, k, k2) {
187
- if (k2 === undefined)
188
- k2 = k;
189
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
190
- }) : (function (o, m, k, k2) {
191
- if (k2 === undefined)
192
- k2 = k;
193
- o[k2] = m[k];
194
- });
195
- function __exportStar(m, o) {
196
- for (var p in m)
197
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
198
- __createBinding(o, m, p);
199
- }
200
- function __values(o) {
201
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
202
- if (m)
203
- return m.call(o);
204
- if (o && typeof o.length === "number")
205
- return {
206
- next: function () {
207
- if (o && i >= o.length)
208
- o = void 0;
209
- return { value: o && o[i++], done: !o };
210
- }
211
- };
212
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
213
- }
214
- function __read(o, n) {
215
- var m = typeof Symbol === "function" && o[Symbol.iterator];
216
- if (!m)
217
- return o;
218
- var i = m.call(o), r, ar = [], e;
219
- try {
220
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
221
- ar.push(r.value);
222
- }
223
- catch (error) {
224
- e = { error: error };
225
- }
226
- finally {
227
- try {
228
- if (r && !r.done && (m = i["return"]))
229
- m.call(i);
230
- }
231
- finally {
232
- if (e)
233
- throw e.error;
234
- }
235
- }
236
- return ar;
237
- }
238
- /** @deprecated */
239
- function __spread() {
240
- for (var ar = [], i = 0; i < arguments.length; i++)
241
- ar = ar.concat(__read(arguments[i]));
242
- return ar;
243
- }
244
- /** @deprecated */
245
- function __spreadArrays() {
246
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
247
- s += arguments[i].length;
248
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
249
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
250
- r[k] = a[j];
251
- return r;
252
- }
253
- function __spreadArray(to, from, pack) {
254
- if (pack || arguments.length === 2)
255
- for (var i = 0, l = from.length, ar; i < l; i++) {
256
- if (ar || !(i in from)) {
257
- if (!ar)
258
- ar = Array.prototype.slice.call(from, 0, i);
259
- ar[i] = from[i];
260
- }
261
- }
262
- return to.concat(ar || Array.prototype.slice.call(from));
263
- }
264
- function __await(v) {
265
- return this instanceof __await ? (this.v = v, this) : new __await(v);
266
- }
267
- function __asyncGenerator(thisArg, _arguments, generator) {
268
- if (!Symbol.asyncIterator)
269
- throw new TypeError("Symbol.asyncIterator is not defined.");
270
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
271
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
272
- function verb(n) { if (g[n])
273
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
274
- function resume(n, v) { try {
275
- step(g[n](v));
276
- }
277
- catch (e) {
278
- settle(q[0][3], e);
279
- } }
280
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
281
- function fulfill(value) { resume("next", value); }
282
- function reject(value) { resume("throw", value); }
283
- function settle(f, v) { if (f(v), q.shift(), q.length)
284
- resume(q[0][0], q[0][1]); }
285
- }
286
- function __asyncDelegator(o) {
287
- var i, p;
288
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
289
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
290
- }
291
- function __asyncValues(o) {
292
- if (!Symbol.asyncIterator)
293
- throw new TypeError("Symbol.asyncIterator is not defined.");
294
- var m = o[Symbol.asyncIterator], i;
295
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
296
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
297
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
298
- }
299
- function __makeTemplateObject(cooked, raw) {
300
- if (Object.defineProperty) {
301
- Object.defineProperty(cooked, "raw", { value: raw });
302
- }
303
- else {
304
- cooked.raw = raw;
305
- }
306
- return cooked;
307
- }
308
- ;
309
- var __setModuleDefault = Object.create ? (function (o, v) {
310
- Object.defineProperty(o, "default", { enumerable: true, value: v });
311
- }) : function (o, v) {
312
- o["default"] = v;
313
- };
314
- function __importStar(mod) {
315
- if (mod && mod.__esModule)
316
- return mod;
317
- var result = {};
318
- if (mod != null)
319
- for (var k in mod)
320
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
321
- __createBinding(result, mod, k);
322
- __setModuleDefault(result, mod);
323
- return result;
324
- }
325
- function __importDefault(mod) {
326
- return (mod && mod.__esModule) ? mod : { default: mod };
327
- }
328
- function __classPrivateFieldGet(receiver, state, kind, f) {
329
- if (kind === "a" && !f)
330
- throw new TypeError("Private accessor was defined without a getter");
331
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
332
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
333
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
334
- }
335
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
336
- if (kind === "m")
337
- throw new TypeError("Private method is not writable");
338
- if (kind === "a" && !f)
339
- throw new TypeError("Private accessor was defined without a setter");
340
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
341
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
342
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
343
- }
344
-
345
- var ApplicationinsightsAngularpluginErrorService = /** @class */ (function () {
346
- function ApplicationinsightsAngularpluginErrorService() {
347
- this.errorServices = [];
348
- if (ApplicationinsightsAngularpluginErrorService.instance === null) {
349
- ApplicationinsightsAngularpluginErrorService.instance = this;
350
- }
351
- }
352
- Object.defineProperty(ApplicationinsightsAngularpluginErrorService.prototype, "plugin", {
353
- set: function (analyticsPlugin) {
354
- this.analyticsPlugin = analyticsPlugin;
355
- },
356
- enumerable: false,
357
- configurable: true
358
- });
359
- ApplicationinsightsAngularpluginErrorService.prototype.addErrorHandler = function (errorService) {
360
- this.errorServices.push(errorService);
361
- };
362
- ApplicationinsightsAngularpluginErrorService.prototype.handleError = function (error) {
363
- if (this.analyticsPlugin) {
364
- this.analyticsPlugin.trackException({ exception: error });
365
- }
366
- if (this.errorServices && this.errorServices.length > 0) {
367
- applicationinsightsCoreJs.arrForEach(this.errorServices, function (errorService) {
368
- if (errorService.handleError && typeof errorService.handleError === 'function') {
369
- errorService.handleError(error);
370
- }
371
- });
372
- }
373
- };
374
- return ApplicationinsightsAngularpluginErrorService;
375
- }());
376
- ApplicationinsightsAngularpluginErrorService.instance = null;
377
- ApplicationinsightsAngularpluginErrorService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ApplicationinsightsAngularpluginErrorService_Factory() { return new ApplicationinsightsAngularpluginErrorService(); }, token: ApplicationinsightsAngularpluginErrorService, providedIn: "root" });
378
- ApplicationinsightsAngularpluginErrorService.decorators = [
379
- { type: i0.Injectable, args: [{
380
- providedIn: 'root'
381
- },] }
382
- ];
383
- ApplicationinsightsAngularpluginErrorService.ctorParameters = function () { return []; };
384
-
385
- // tslint:disable-next-line:component-class-suffix
386
- var AngularPlugin = /** @class */ (function (_super) {
387
- __extends(AngularPlugin, _super);
388
- function AngularPlugin() {
389
- var _this = _super.apply(this, __spread(arguments)) || this;
390
- _this.priority = 186;
391
- _this.identifier = 'AngularPlugin';
392
- return _this;
393
- }
394
- AngularPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
395
- _super.prototype.initialize.call(this, config, core, extensions, pluginChain);
396
- var self = this;
397
- var ctx = self._getTelCtx();
398
- var extConfig = ctx.getExtCfg(self.identifier, { router: null, errorServices: null });
399
- applicationinsightsCoreJs.arrForEach(extensions, function (ext) {
400
- var identifier = ext.identifier;
401
- if (identifier === 'ApplicationInsightsAnalytics') {
402
- self.analyticsPlugin = ext;
403
- if (ApplicationinsightsAngularpluginErrorService.instance !== null) {
404
- ApplicationinsightsAngularpluginErrorService.instance.plugin = self.analyticsPlugin;
405
- if (extConfig.errorServices && Array.isArray(extConfig.errorServices)) {
406
- applicationinsightsCoreJs.arrForEach(extConfig.errorServices, function (errorService) {
407
- ApplicationinsightsAngularpluginErrorService.instance.addErrorHandler(errorService);
408
- });
409
- }
410
- }
411
- }
412
- if (identifier === applicationinsightsCommon.PropertiesPluginIdentifier) {
413
- self.propertiesPlugin = ext;
414
- }
415
- });
416
- if (extConfig.router) {
417
- var isPageInitialLoad_1 = true;
418
- var pageViewTelemetry = {
419
- uri: extConfig.router.url
420
- };
421
- self.trackPageView(pageViewTelemetry);
422
- extConfig.router.events.subscribe(function (event) {
423
- if (event instanceof router.NavigationEnd) {
424
- // for page initial load, do not call trackPageView twice
425
- if (isPageInitialLoad_1) {
426
- isPageInitialLoad_1 = false;
427
- return;
428
- }
429
- var pageViewTelemetry_1 = {
430
- uri: extConfig.router.url,
431
- properties: { duration: 0 } // SPA route change loading durations are undefined, so send 0
432
- };
433
- self.trackPageView(pageViewTelemetry_1);
434
- }
435
- });
436
- }
437
- };
438
- /**
439
- * Add Part A fields to the event
440
- * @param event The event that needs to be processed
441
- */
442
- AngularPlugin.prototype.processTelemetry = function (event, itemCtx) {
443
- this.processNext(event, itemCtx);
444
- };
445
- AngularPlugin.prototype.trackPageView = function (pageView) {
446
- var self = this;
447
- if (self.analyticsPlugin) {
448
- var location = applicationinsightsCoreJs.getLocation();
449
- if (self.propertiesPlugin && self.propertiesPlugin.context && self.propertiesPlugin.context.telemetryTrace) {
450
- self.propertiesPlugin.context.telemetryTrace.traceID = applicationinsightsCommon.Util.generateW3CId();
451
- self.propertiesPlugin.context.telemetryTrace.name = location && location.pathname || '_unknown_';
452
- }
453
- self.analyticsPlugin.trackPageView(pageView);
454
- }
455
- else {
456
- self.diagLog().throwInternal(
457
- // tslint:disable-next-line:max-line-length
458
- applicationinsightsCoreJs.LoggingSeverity.CRITICAL, applicationinsightsCoreJs._InternalMessageId.TelemetryInitializerFailed, 'Analytics plugin is not available, Angular plugin telemetry will not be sent: ');
459
- }
460
- };
461
- return AngularPlugin;
462
- }(applicationinsightsCoreJs.BaseTelemetryPlugin));
463
- AngularPlugin.decorators = [
464
- { type: i0.Component, args: [{
465
- selector: 'lib-applicationinsights-angularplugin-js',
466
- template: ""
467
- },] }
468
- ];
469
-
470
- var ApplicationinsightsAngularpluginJsModule = /** @class */ (function () {
471
- function ApplicationinsightsAngularpluginJsModule() {
472
- }
473
- return ApplicationinsightsAngularpluginJsModule;
474
- }());
475
- ApplicationinsightsAngularpluginJsModule.decorators = [
476
- { type: i0.NgModule, args: [{
477
- declarations: [AngularPlugin],
478
- imports: [],
479
- exports: [AngularPlugin],
480
- providers: [
481
- ApplicationinsightsAngularpluginErrorService
482
- ]
483
- },] }
484
- ];
485
-
486
- /*
487
- * Public API Surface of applicationinsights-angularplugin-js
488
- */
489
-
490
- /**
491
- * Generated bundle index. Do not edit.
492
- */
493
-
494
- exports.AngularPlugin = AngularPlugin;
495
- exports.ApplicationinsightsAngularpluginErrorService = ApplicationinsightsAngularpluginErrorService;
496
- exports.ApplicationinsightsAngularpluginJsModule = ApplicationinsightsAngularpluginJsModule;
497
-
498
- Object.defineProperty(exports, '__esModule', { value: true });
499
-
500
- }));
501
- //# sourceMappingURL=microsoft-applicationinsights-angularplugin-js.umd.js.map