@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.
- package/{esm2015/lib/IErrorService.js → esm2020/lib/IErrorService.mjs} +0 -0
- package/esm2020/lib/applicationinsights-angularplugin-error.service.mjs +49 -0
- package/esm2020/lib/applicationinsights-angularplugin-js.component.mjs +110 -0
- package/esm2020/lib/applicationinsights-angularplugin-js.module.mjs +23 -0
- package/{esm2015/microsoft-applicationinsights-angularplugin-js.js → esm2020/microsoft-applicationinsights-angularplugin-js.mjs} +0 -0
- package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
- package/fesm2015/microsoft-applicationinsights-angularplugin-js.mjs +186 -0
- package/fesm2015/microsoft-applicationinsights-angularplugin-js.mjs.map +1 -0
- package/fesm2020/microsoft-applicationinsights-angularplugin-js.mjs +185 -0
- package/fesm2020/microsoft-applicationinsights-angularplugin-js.mjs.map +1 -0
- package/lib/applicationinsights-angularplugin-error.service.d.ts +5 -1
- package/lib/applicationinsights-angularplugin-js.component.d.ts +7 -0
- package/lib/applicationinsights-angularplugin-js.module.d.ts +5 -0
- package/microsoft-applicationinsights-angularplugin-js-2.9.0.tgz +0 -0
- package/microsoft-applicationinsights-angularplugin-js.d.ts +1 -0
- package/package.json +24 -12
- package/bundles/microsoft-applicationinsights-angularplugin-js.umd.js +0 -501
- package/bundles/microsoft-applicationinsights-angularplugin-js.umd.js.map +0 -1
- package/bundles/microsoft-applicationinsights-angularplugin-js.umd.min.js +0 -16
- package/bundles/microsoft-applicationinsights-angularplugin-js.umd.min.js.map +0 -1
- package/esm2015/lib/applicationinsights-angularplugin-error.service.js +0 -38
- package/esm2015/lib/applicationinsights-angularplugin-js.component.js +0 -87
- package/esm2015/lib/applicationinsights-angularplugin-js.module.js +0 -16
- package/fesm2015/microsoft-applicationinsights-angularplugin-js.js +0 -146
- package/fesm2015/microsoft-applicationinsights-angularplugin-js.js.map +0 -1
- package/microsoft-applicationinsights-angularplugin-js-2.7.0.tgz +0 -0
- package/microsoft-applicationinsights-angularplugin-js.metadata.json +0 -1
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { arrForEach, isFunction } from '@microsoft/applicationinsights-core-js';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export class ApplicationinsightsAngularpluginErrorService {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.errorServices = [];
|
|
7
|
+
if (ApplicationinsightsAngularpluginErrorService.instance === null) {
|
|
8
|
+
ApplicationinsightsAngularpluginErrorService.instance = this;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
set plugin(analyticsPlugin) {
|
|
12
|
+
this.analyticsPlugin = analyticsPlugin;
|
|
13
|
+
}
|
|
14
|
+
addErrorHandler(errorService) {
|
|
15
|
+
if (errorService && isFunction(errorService.handleError)) {
|
|
16
|
+
this.errorServices.push(errorService);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
removeErrorHandler(errorService) {
|
|
20
|
+
if (errorService && isFunction(errorService.handleError)) {
|
|
21
|
+
const idx = this.errorServices.indexOf(errorService);
|
|
22
|
+
if (idx !== -1) {
|
|
23
|
+
this.errorServices.splice(idx, 1);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
handleError(error) {
|
|
28
|
+
if (this.analyticsPlugin) {
|
|
29
|
+
this.analyticsPlugin.trackException({ exception: error });
|
|
30
|
+
}
|
|
31
|
+
if (this.errorServices && this.errorServices.length > 0) {
|
|
32
|
+
arrForEach(this.errorServices, errorService => {
|
|
33
|
+
if (isFunction(errorService.handleError)) {
|
|
34
|
+
errorService.handleError(error);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
ApplicationinsightsAngularpluginErrorService.instance = null;
|
|
41
|
+
ApplicationinsightsAngularpluginErrorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginErrorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
42
|
+
ApplicationinsightsAngularpluginErrorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginErrorService, providedIn: 'root' });
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginErrorService, decorators: [{
|
|
44
|
+
type: Injectable,
|
|
45
|
+
args: [{
|
|
46
|
+
providedIn: 'root'
|
|
47
|
+
}]
|
|
48
|
+
}], ctorParameters: function () { return []; } });
|
|
49
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwbGljYXRpb25pbnNpZ2h0cy1hbmd1bGFycGx1Z2luLWVycm9yLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9hcHBsaWNhdGlvbmluc2lnaHRzLWFuZ3VsYXJwbHVnaW4tanMvc3JjL2xpYi9hcHBsaWNhdGlvbmluc2lnaHRzLWFuZ3VsYXJwbHVnaW4tZXJyb3Iuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRTNDLE9BQU8sRUFBRSxVQUFVLEVBQUUsVUFBVSxFQUFFLE1BQU0sd0NBQXdDLENBQUM7O0FBTWhGLE1BQU0sT0FBTyw0Q0FBNEM7SUFLckQ7UUFGUSxrQkFBYSxHQUFvQixFQUFFLENBQUM7UUFHeEMsSUFBSSw0Q0FBNEMsQ0FBQyxRQUFRLEtBQUssSUFBSSxFQUFFO1lBQ2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gICBpZiAoaWR4ICE9PSAtMSkge1xyXG4gICAgICAgICAgICAgICAgdGhpcy5lcnJvclNlcnZpY2VzLnNwbGljZShpZHgsIDEpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG5cclxuICAgIGhhbmRsZUVycm9yKGVycm9yOiBhbnkpOiB2b2lkIHtcclxuICAgICAgICBpZiAodGhpcy5hbmFseXRpY3NQbHVnaW4pIHtcclxuICAgICAgICAgICAgdGhpcy5hbmFseXRpY3NQbHVnaW4udHJhY2tFeGNlcHRpb24oeyBleGNlcHRpb246IGVycm9yIH0pO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgaWYgKHRoaXMuZXJyb3JTZXJ2aWNlcyAmJiB0aGlzLmVycm9yU2VydmljZXMubGVuZ3RoID4gMCkge1xyXG4gICAgICAgICAgICBhcnJGb3JFYWNoKHRoaXMuZXJyb3JTZXJ2aWNlcywgZXJyb3JTZXJ2aWNlID0+IHtcclxuICAgICAgICAgICAgICAgIGlmIChpc0Z1bmN0aW9uKGVycm9yU2VydmljZS5oYW5kbGVFcnJvcikpIHtcclxuICAgICAgICAgICAgICAgICAgICBlcnJvclNlcnZpY2UuaGFuZGxlRXJyb3IoZXJyb3IpO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9XHJcbiAgICB9XHJcbn1cclxuXHJcbiJdfQ==
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { PropertiesPluginIdentifier, Util, AnalyticsPluginIdentifier } from '@microsoft/applicationinsights-common';
|
|
3
|
+
import { BaseTelemetryPlugin, arrForEach, getLocation, _throwInternal } from '@microsoft/applicationinsights-core-js';
|
|
4
|
+
import { NavigationEnd } from '@angular/router';
|
|
5
|
+
import { ApplicationinsightsAngularpluginErrorService } from './applicationinsights-angularplugin-error.service';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
// eslint-disable-next-line @angular-eslint/component-class-suffix
|
|
8
|
+
export class AngularPlugin extends BaseTelemetryPlugin {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.priority = 186;
|
|
12
|
+
this.identifier = 'AngularPlugin';
|
|
13
|
+
this._angularCfg = null;
|
|
14
|
+
this._eventSubscription = null;
|
|
15
|
+
let self = this;
|
|
16
|
+
self._doTeardown = (unloadCtx, unloadState, asyncCallback) => {
|
|
17
|
+
if (this.analyticsPlugin && ApplicationinsightsAngularpluginErrorService.instance !== null) {
|
|
18
|
+
ApplicationinsightsAngularpluginErrorService.instance.plugin = null;
|
|
19
|
+
if (self._angularCfg) {
|
|
20
|
+
if (self._angularCfg.errorServices && Array.isArray(self._angularCfg.errorServices)) {
|
|
21
|
+
arrForEach(self._angularCfg.errorServices, (errorService) => {
|
|
22
|
+
ApplicationinsightsAngularpluginErrorService.instance.removeErrorHandler(errorService);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (self._eventSubscription) {
|
|
28
|
+
self._eventSubscription.unsubscribe();
|
|
29
|
+
self._eventSubscription = null;
|
|
30
|
+
}
|
|
31
|
+
self.analyticsPlugin = null;
|
|
32
|
+
self.propertiesPlugin = null;
|
|
33
|
+
self._angularCfg = null;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
initialize(config, core, extensions, pluginChain) {
|
|
37
|
+
super.initialize(config, core, extensions, pluginChain);
|
|
38
|
+
const self = this;
|
|
39
|
+
const ctx = self._getTelCtx();
|
|
40
|
+
const extConfig = ctx.getExtCfg(self.identifier, { router: null, errorServices: null });
|
|
41
|
+
self.propertiesPlugin = core.getPlugin(PropertiesPluginIdentifier)?.plugin;
|
|
42
|
+
self.analyticsPlugin = core.getPlugin(AnalyticsPluginIdentifier)?.plugin;
|
|
43
|
+
if (self.analyticsPlugin) {
|
|
44
|
+
if (ApplicationinsightsAngularpluginErrorService.instance !== null) {
|
|
45
|
+
ApplicationinsightsAngularpluginErrorService.instance.plugin = self.analyticsPlugin;
|
|
46
|
+
if (extConfig.errorServices && Array.isArray(extConfig.errorServices)) {
|
|
47
|
+
arrForEach(extConfig.errorServices, (errorService) => {
|
|
48
|
+
ApplicationinsightsAngularpluginErrorService.instance.addErrorHandler(errorService);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (extConfig.router) {
|
|
54
|
+
let isPageInitialLoad = true;
|
|
55
|
+
const pageViewTelemetry = {
|
|
56
|
+
uri: extConfig.router.url
|
|
57
|
+
};
|
|
58
|
+
self.trackPageView(pageViewTelemetry);
|
|
59
|
+
self._eventSubscription = extConfig.router.events.subscribe(event => {
|
|
60
|
+
if (self.isInitialized()) {
|
|
61
|
+
if (event instanceof NavigationEnd) {
|
|
62
|
+
// for page initial load, do not call trackPageView twice
|
|
63
|
+
if (isPageInitialLoad) {
|
|
64
|
+
isPageInitialLoad = false;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const pvt = {
|
|
68
|
+
uri: extConfig.router.url,
|
|
69
|
+
properties: { duration: 0 } // SPA route change loading durations are undefined, so send 0
|
|
70
|
+
};
|
|
71
|
+
self.trackPageView(pvt);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Add Part A fields to the event
|
|
79
|
+
*
|
|
80
|
+
* @param event The event that needs to be processed
|
|
81
|
+
*/
|
|
82
|
+
processTelemetry(event, itemCtx) {
|
|
83
|
+
this.processNext(event, itemCtx);
|
|
84
|
+
}
|
|
85
|
+
trackPageView(pageView) {
|
|
86
|
+
const self = this;
|
|
87
|
+
if (self.analyticsPlugin) {
|
|
88
|
+
const location = getLocation();
|
|
89
|
+
if (self.propertiesPlugin && self.propertiesPlugin.context && self.propertiesPlugin.context.telemetryTrace) {
|
|
90
|
+
self.propertiesPlugin.context.telemetryTrace.traceID = Util.generateW3CId();
|
|
91
|
+
self.propertiesPlugin.context.telemetryTrace.name = location && location.pathname || '_unknown_';
|
|
92
|
+
}
|
|
93
|
+
self.analyticsPlugin.trackPageView(pageView);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
_throwInternal(self.diagLog(), 1 /* CRITICAL */, 64 /* TelemetryInitializerFailed */, 'Analytics plugin is not available, Angular plugin telemetry will not be sent: ');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
AngularPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: AngularPlugin, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
101
|
+
AngularPlugin.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: AngularPlugin, selector: "lib-applicationinsights-angularplugin-js", usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
|
102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: AngularPlugin, decorators: [{
|
|
103
|
+
type: Component,
|
|
104
|
+
args: [{
|
|
105
|
+
selector: 'lib-applicationinsights-angularplugin-js',
|
|
106
|
+
template: ``,
|
|
107
|
+
styles: []
|
|
108
|
+
}]
|
|
109
|
+
}], ctorParameters: function () { return []; } });
|
|
110
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwbGljYXRpb25pbnNpZ2h0cy1hbmd1bGFycGx1Z2luLWpzLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL2FwcGxpY2F0aW9uaW5zaWdodHMtYW5ndWxhcnBsdWdpbi1qcy9zcmMvbGliL2FwcGxpY2F0aW9uaW5zaWdodHMtYW5ndWxhcnBsdWdpbi1qcy5jb21wb25lbnQudHMiXS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HVnaW4+KEFuYWx5dGljc1BsdWdpbklkZW50aWZpZXIpPy5wbHVnaW47XHJcbiAgICAgICAgaWYgKHNlbGYuYW5hbHl0aWNzUGx1Z2luKSB7XHJcbiAgICAgICAgICAgIGlmIChBcHBsaWNhdGlvbmluc2lnaHRzQW5ndWxhcnBsdWdpbkVycm9yU2VydmljZS5pbnN0YW5jZSAhPT0gbnVsbCkge1xyXG4gICAgICAgICAgICAgICAgQXBwbGljYXRpb25pbnNpZ2h0c0FuZ3VsYXJwbHVnaW5FcnJvclNlcnZpY2UuaW5zdGFuY2UucGx1Z2luID0gc2VsZi5hbmFseXRpY3NQbHVnaW47XHJcbiAgICAgICAgICAgICAgICBpZiAoZXh0Q29uZmlnLmVycm9yU2VydmljZXMgJiYgQXJyYXkuaXNBcnJheShleHRDb25maWcuZXJyb3JTZXJ2aWNlcykpIHtcclxuICAgICAgICAgICAgICAgICAgICBhcnJGb3JFYWNoKGV4dENvbmZpZy5lcnJvclNlcnZpY2VzLCAoZXJyb3JTZXJ2aWNlOiBJRXJyb3JTZXJ2aWNlKSA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIEFwcGxpY2F0aW9uaW5zaWdodHNBbmd1bGFycGx1Z2luRXJyb3JTZXJ2aWNlLmluc3RhbmNlLmFkZEVycm9ySGFuZGxlcihlcnJvclNlcnZpY2UpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBpZiAoZXh0Q29uZmlnLnJvdXRlcikge1xyXG4gICAgICAgICAgICBsZXQgaXNQYWdlSW5pdGlhbExvYWQgPSB0cnVlO1xyXG4gICAgICAgICAgICBjb25zdCBwYWdlVmlld1RlbGVtZXRyeTogSVBhZ2VWaWV3VGVsZW1ldHJ5ID0ge1xyXG4gICAgICAgICAgICAgICAgdXJpOiBleHRDb25maWcucm91dGVyLnVybFxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBzZWxmLnRyYWNrUGFnZVZpZXcocGFnZVZpZXdUZWxlbWV0cnkpO1xyXG4gICAgICAgICAgICBzZWxmLl9ldmVudFN1YnNjcmlwdGlvbiA9IGV4dENvbmZpZy5yb3V0ZXIuZXZlbnRzLnN1YnNjcmliZShldmVudCA9PiB7XHJcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5pc0luaXRpYWxpemVkKCkpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAoZXZlbnQgaW5zdGFuY2VvZiBOYXZpZ2F0aW9uRW5kKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGZvciBwYWdlIGluaXRpYWwgbG9hZCwgZG8gbm90IGNhbGwgdHJhY2tQYWdlVmlldyB0d2ljZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNQYWdlSW5pdGlhbExvYWQpIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzUGFnZUluaXRpYWxMb2FkID0gZmFsc2U7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgcHZ0OiBJUGFnZVZpZXdUZWxlbWV0cnkgPSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmk6IGV4dENvbmZpZy5yb3V0ZXIudXJsLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcGVydGllczogeyBkdXJhdGlvbjogMCB9IC8vIFNQQSByb3V0ZSBjaGFuZ2UgbG9hZGluZyBkdXJhdGlvbnMgYXJlIHVuZGVmaW5lZCwgc28gc2VuZCAwXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudHJhY2tQYWdlVmlldyhwdnQpO1xyXG4gICAgICAgICAgICAgICAgICAgIH1cclx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WUgfHwgJ191bmtub3duXyc7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgc2VsZi5hbmFseXRpY3NQbHVnaW4udHJhY2tQYWdlVmlldyhwYWdlVmlldyk7XHJcbiAgICAgICAgfSBlbHNlIHtcclxuICAgICAgICAgICAgX3Rocm93SW50ZXJuYWwoc2VsZi5kaWFnTG9nKCksXHJcbiAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbWF4LWxlblxyXG4gICAgICAgICAgICAgICAgZUxvZ2dpbmdTZXZlcml0eS5DUklUSUNBTCwgX2VJbnRlcm5hbE1lc3NhZ2VJZC5UZWxlbWV0cnlJbml0aWFsaXplckZhaWxlZCwgJ0FuYWx5dGljcyBwbHVnaW4gaXMgbm90IGF2YWlsYWJsZSwgQW5ndWxhciBwbHVnaW4gdGVsZW1ldHJ5IHdpbGwgbm90IGJlIHNlbnQ6ICcpO1xyXG4gICAgICAgIH1cclxuICAgIH1cclxuXHJcbn1cclxuIl19
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { AngularPlugin } from './applicationinsights-angularplugin-js.component';
|
|
3
|
+
import { ApplicationinsightsAngularpluginErrorService } from './applicationinsights-angularplugin-error.service';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export class ApplicationinsightsAngularpluginJsModule {
|
|
6
|
+
}
|
|
7
|
+
ApplicationinsightsAngularpluginJsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginJsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
8
|
+
ApplicationinsightsAngularpluginJsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginJsModule, declarations: [AngularPlugin], exports: [AngularPlugin] });
|
|
9
|
+
ApplicationinsightsAngularpluginJsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginJsModule, providers: [
|
|
10
|
+
ApplicationinsightsAngularpluginErrorService
|
|
11
|
+
], imports: [[]] });
|
|
12
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginJsModule, decorators: [{
|
|
13
|
+
type: NgModule,
|
|
14
|
+
args: [{
|
|
15
|
+
declarations: [AngularPlugin],
|
|
16
|
+
imports: [],
|
|
17
|
+
exports: [AngularPlugin],
|
|
18
|
+
providers: [
|
|
19
|
+
ApplicationinsightsAngularpluginErrorService
|
|
20
|
+
]
|
|
21
|
+
}]
|
|
22
|
+
}] });
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwbGljYXRpb25pbnNpZ2h0cy1hbmd1bGFycGx1Z2luLWpzLm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL2FwcGxpY2F0aW9uaW5zaWdodHMtYW5ndWxhcnBsdWdpbi1qcy9zcmMvbGliL2FwcGxpY2F0aW9uaW5zaWdodHMtYW5ndWxhcnBsdWdpbi1qcy5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN6QyxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sa0RBQWtELENBQUM7QUFDakYsT0FBTyxFQUFFLDRDQUE0QyxFQUFFLE1BQU0sbURBQW1ELENBQUM7O0FBV2pILE1BQU0sT0FBTyx3Q0FBd0M7O3FJQUF4Qyx3Q0FBd0M7c0lBQXhDLHdDQUF3QyxpQkFSbEMsYUFBYSxhQUdsQixhQUFhO3NJQUtkLHdDQUF3QyxhQUp0QztRQUNQLDRDQUE0QztLQUMvQyxZQUxRLEVBQ1I7MkZBTVEsd0NBQXdDO2tCQVRwRCxRQUFRO21CQUFDO29CQUNOLFlBQVksRUFBRSxDQUFDLGFBQWEsQ0FBQztvQkFDN0IsT0FBTyxFQUFFLEVBQ1I7b0JBQ0QsT0FBTyxFQUFFLENBQUMsYUFBYSxDQUFDO29CQUN4QixTQUFTLEVBQUU7d0JBQ1AsNENBQTRDO3FCQUMvQztpQkFDSiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IE5nTW9kdWxlIH0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XHJcbmltcG9ydCB7IEFuZ3VsYXJQbHVnaW4gfSBmcm9tICcuL2FwcGxpY2F0aW9uaW5zaWdodHMtYW5ndWxhcnBsdWdpbi1qcy5jb21wb25lbnQnO1xyXG5pbXBvcnQgeyBBcHBsaWNhdGlvbmluc2lnaHRzQW5ndWxhcnBsdWdpbkVycm9yU2VydmljZSB9IGZyb20gJy4vYXBwbGljYXRpb25pbnNpZ2h0cy1hbmd1bGFycGx1Z2luLWVycm9yLnNlcnZpY2UnO1xyXG5cclxuQE5nTW9kdWxlKHtcclxuICAgIGRlY2xhcmF0aW9uczogW0FuZ3VsYXJQbHVnaW5dLFxyXG4gICAgaW1wb3J0czogW1xyXG4gICAgXSxcclxuICAgIGV4cG9ydHM6IFtBbmd1bGFyUGx1Z2luXSxcclxuICAgIHByb3ZpZGVyczogW1xyXG4gICAgICAgIEFwcGxpY2F0aW9uaW5zaWdodHNBbmd1bGFycGx1Z2luRXJyb3JTZXJ2aWNlXHJcbiAgICBdXHJcbn0pXHJcbmV4cG9ydCBjbGFzcyBBcHBsaWNhdGlvbmluc2lnaHRzQW5ndWxhcnBsdWdpbkpzTW9kdWxlIHsgfVxyXG4iXX0=
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, NgModule } from '@angular/core';
|
|
3
|
+
import { PropertiesPluginIdentifier, AnalyticsPluginIdentifier, Util } from '@microsoft/applicationinsights-common';
|
|
4
|
+
import { isFunction, arrForEach, BaseTelemetryPlugin, getLocation, _throwInternal } from '@microsoft/applicationinsights-core-js';
|
|
5
|
+
import { NavigationEnd } from '@angular/router';
|
|
6
|
+
|
|
7
|
+
class ApplicationinsightsAngularpluginErrorService {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.errorServices = [];
|
|
10
|
+
if (ApplicationinsightsAngularpluginErrorService.instance === null) {
|
|
11
|
+
ApplicationinsightsAngularpluginErrorService.instance = this;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
set plugin(analyticsPlugin) {
|
|
15
|
+
this.analyticsPlugin = analyticsPlugin;
|
|
16
|
+
}
|
|
17
|
+
addErrorHandler(errorService) {
|
|
18
|
+
if (errorService && isFunction(errorService.handleError)) {
|
|
19
|
+
this.errorServices.push(errorService);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
removeErrorHandler(errorService) {
|
|
23
|
+
if (errorService && isFunction(errorService.handleError)) {
|
|
24
|
+
const idx = this.errorServices.indexOf(errorService);
|
|
25
|
+
if (idx !== -1) {
|
|
26
|
+
this.errorServices.splice(idx, 1);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
handleError(error) {
|
|
31
|
+
if (this.analyticsPlugin) {
|
|
32
|
+
this.analyticsPlugin.trackException({ exception: error });
|
|
33
|
+
}
|
|
34
|
+
if (this.errorServices && this.errorServices.length > 0) {
|
|
35
|
+
arrForEach(this.errorServices, errorService => {
|
|
36
|
+
if (isFunction(errorService.handleError)) {
|
|
37
|
+
errorService.handleError(error);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
ApplicationinsightsAngularpluginErrorService.instance = null;
|
|
44
|
+
ApplicationinsightsAngularpluginErrorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginErrorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
45
|
+
ApplicationinsightsAngularpluginErrorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginErrorService, providedIn: 'root' });
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginErrorService, decorators: [{
|
|
47
|
+
type: Injectable,
|
|
48
|
+
args: [{
|
|
49
|
+
providedIn: 'root'
|
|
50
|
+
}]
|
|
51
|
+
}], ctorParameters: function () { return []; } });
|
|
52
|
+
|
|
53
|
+
// eslint-disable-next-line @angular-eslint/component-class-suffix
|
|
54
|
+
class AngularPlugin extends BaseTelemetryPlugin {
|
|
55
|
+
constructor() {
|
|
56
|
+
super();
|
|
57
|
+
this.priority = 186;
|
|
58
|
+
this.identifier = 'AngularPlugin';
|
|
59
|
+
this._angularCfg = null;
|
|
60
|
+
this._eventSubscription = null;
|
|
61
|
+
let self = this;
|
|
62
|
+
self._doTeardown = (unloadCtx, unloadState, asyncCallback) => {
|
|
63
|
+
if (this.analyticsPlugin && ApplicationinsightsAngularpluginErrorService.instance !== null) {
|
|
64
|
+
ApplicationinsightsAngularpluginErrorService.instance.plugin = null;
|
|
65
|
+
if (self._angularCfg) {
|
|
66
|
+
if (self._angularCfg.errorServices && Array.isArray(self._angularCfg.errorServices)) {
|
|
67
|
+
arrForEach(self._angularCfg.errorServices, (errorService) => {
|
|
68
|
+
ApplicationinsightsAngularpluginErrorService.instance.removeErrorHandler(errorService);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (self._eventSubscription) {
|
|
74
|
+
self._eventSubscription.unsubscribe();
|
|
75
|
+
self._eventSubscription = null;
|
|
76
|
+
}
|
|
77
|
+
self.analyticsPlugin = null;
|
|
78
|
+
self.propertiesPlugin = null;
|
|
79
|
+
self._angularCfg = null;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
initialize(config, core, extensions, pluginChain) {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
super.initialize(config, core, extensions, pluginChain);
|
|
85
|
+
const self = this;
|
|
86
|
+
const ctx = self._getTelCtx();
|
|
87
|
+
const extConfig = ctx.getExtCfg(self.identifier, { router: null, errorServices: null });
|
|
88
|
+
self.propertiesPlugin = (_a = core.getPlugin(PropertiesPluginIdentifier)) === null || _a === void 0 ? void 0 : _a.plugin;
|
|
89
|
+
self.analyticsPlugin = (_b = core.getPlugin(AnalyticsPluginIdentifier)) === null || _b === void 0 ? void 0 : _b.plugin;
|
|
90
|
+
if (self.analyticsPlugin) {
|
|
91
|
+
if (ApplicationinsightsAngularpluginErrorService.instance !== null) {
|
|
92
|
+
ApplicationinsightsAngularpluginErrorService.instance.plugin = self.analyticsPlugin;
|
|
93
|
+
if (extConfig.errorServices && Array.isArray(extConfig.errorServices)) {
|
|
94
|
+
arrForEach(extConfig.errorServices, (errorService) => {
|
|
95
|
+
ApplicationinsightsAngularpluginErrorService.instance.addErrorHandler(errorService);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (extConfig.router) {
|
|
101
|
+
let isPageInitialLoad = true;
|
|
102
|
+
const pageViewTelemetry = {
|
|
103
|
+
uri: extConfig.router.url
|
|
104
|
+
};
|
|
105
|
+
self.trackPageView(pageViewTelemetry);
|
|
106
|
+
self._eventSubscription = extConfig.router.events.subscribe(event => {
|
|
107
|
+
if (self.isInitialized()) {
|
|
108
|
+
if (event instanceof NavigationEnd) {
|
|
109
|
+
// for page initial load, do not call trackPageView twice
|
|
110
|
+
if (isPageInitialLoad) {
|
|
111
|
+
isPageInitialLoad = false;
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const pvt = {
|
|
115
|
+
uri: extConfig.router.url,
|
|
116
|
+
properties: { duration: 0 } // SPA route change loading durations are undefined, so send 0
|
|
117
|
+
};
|
|
118
|
+
self.trackPageView(pvt);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Add Part A fields to the event
|
|
126
|
+
*
|
|
127
|
+
* @param event The event that needs to be processed
|
|
128
|
+
*/
|
|
129
|
+
processTelemetry(event, itemCtx) {
|
|
130
|
+
this.processNext(event, itemCtx);
|
|
131
|
+
}
|
|
132
|
+
trackPageView(pageView) {
|
|
133
|
+
const self = this;
|
|
134
|
+
if (self.analyticsPlugin) {
|
|
135
|
+
const location = getLocation();
|
|
136
|
+
if (self.propertiesPlugin && self.propertiesPlugin.context && self.propertiesPlugin.context.telemetryTrace) {
|
|
137
|
+
self.propertiesPlugin.context.telemetryTrace.traceID = Util.generateW3CId();
|
|
138
|
+
self.propertiesPlugin.context.telemetryTrace.name = location && location.pathname || '_unknown_';
|
|
139
|
+
}
|
|
140
|
+
self.analyticsPlugin.trackPageView(pageView);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
_throwInternal(self.diagLog(), 1 /* CRITICAL */, 64 /* TelemetryInitializerFailed */, 'Analytics plugin is not available, Angular plugin telemetry will not be sent: ');
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
AngularPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: AngularPlugin, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
148
|
+
AngularPlugin.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: AngularPlugin, selector: "lib-applicationinsights-angularplugin-js", usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
|
149
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: AngularPlugin, decorators: [{
|
|
150
|
+
type: Component,
|
|
151
|
+
args: [{
|
|
152
|
+
selector: 'lib-applicationinsights-angularplugin-js',
|
|
153
|
+
template: ``,
|
|
154
|
+
styles: []
|
|
155
|
+
}]
|
|
156
|
+
}], ctorParameters: function () { return []; } });
|
|
157
|
+
|
|
158
|
+
class ApplicationinsightsAngularpluginJsModule {
|
|
159
|
+
}
|
|
160
|
+
ApplicationinsightsAngularpluginJsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginJsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
161
|
+
ApplicationinsightsAngularpluginJsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginJsModule, declarations: [AngularPlugin], exports: [AngularPlugin] });
|
|
162
|
+
ApplicationinsightsAngularpluginJsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginJsModule, providers: [
|
|
163
|
+
ApplicationinsightsAngularpluginErrorService
|
|
164
|
+
], imports: [[]] });
|
|
165
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginJsModule, decorators: [{
|
|
166
|
+
type: NgModule,
|
|
167
|
+
args: [{
|
|
168
|
+
declarations: [AngularPlugin],
|
|
169
|
+
imports: [],
|
|
170
|
+
exports: [AngularPlugin],
|
|
171
|
+
providers: [
|
|
172
|
+
ApplicationinsightsAngularpluginErrorService
|
|
173
|
+
]
|
|
174
|
+
}]
|
|
175
|
+
}] });
|
|
176
|
+
|
|
177
|
+
/*
|
|
178
|
+
* Public API Surface of applicationinsights-angularplugin-js
|
|
179
|
+
*/
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Generated bundle index. Do not edit.
|
|
183
|
+
*/
|
|
184
|
+
|
|
185
|
+
export { AngularPlugin, ApplicationinsightsAngularpluginErrorService, ApplicationinsightsAngularpluginJsModule };
|
|
186
|
+
//# sourceMappingURL=microsoft-applicationinsights-angularplugin-js.mjs.map
|
|
@@ -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,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AC,aAAa,CAAC,QAAQ,CAAC,CAAC;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;;;;;;"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, NgModule } from '@angular/core';
|
|
3
|
+
import { PropertiesPluginIdentifier, AnalyticsPluginIdentifier, Util } from '@microsoft/applicationinsights-common';
|
|
4
|
+
import { isFunction, arrForEach, BaseTelemetryPlugin, getLocation, _throwInternal } from '@microsoft/applicationinsights-core-js';
|
|
5
|
+
import { NavigationEnd } from '@angular/router';
|
|
6
|
+
|
|
7
|
+
class ApplicationinsightsAngularpluginErrorService {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.errorServices = [];
|
|
10
|
+
if (ApplicationinsightsAngularpluginErrorService.instance === null) {
|
|
11
|
+
ApplicationinsightsAngularpluginErrorService.instance = this;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
set plugin(analyticsPlugin) {
|
|
15
|
+
this.analyticsPlugin = analyticsPlugin;
|
|
16
|
+
}
|
|
17
|
+
addErrorHandler(errorService) {
|
|
18
|
+
if (errorService && isFunction(errorService.handleError)) {
|
|
19
|
+
this.errorServices.push(errorService);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
removeErrorHandler(errorService) {
|
|
23
|
+
if (errorService && isFunction(errorService.handleError)) {
|
|
24
|
+
const idx = this.errorServices.indexOf(errorService);
|
|
25
|
+
if (idx !== -1) {
|
|
26
|
+
this.errorServices.splice(idx, 1);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
handleError(error) {
|
|
31
|
+
if (this.analyticsPlugin) {
|
|
32
|
+
this.analyticsPlugin.trackException({ exception: error });
|
|
33
|
+
}
|
|
34
|
+
if (this.errorServices && this.errorServices.length > 0) {
|
|
35
|
+
arrForEach(this.errorServices, errorService => {
|
|
36
|
+
if (isFunction(errorService.handleError)) {
|
|
37
|
+
errorService.handleError(error);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
ApplicationinsightsAngularpluginErrorService.instance = null;
|
|
44
|
+
ApplicationinsightsAngularpluginErrorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginErrorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
45
|
+
ApplicationinsightsAngularpluginErrorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginErrorService, providedIn: 'root' });
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginErrorService, decorators: [{
|
|
47
|
+
type: Injectable,
|
|
48
|
+
args: [{
|
|
49
|
+
providedIn: 'root'
|
|
50
|
+
}]
|
|
51
|
+
}], ctorParameters: function () { return []; } });
|
|
52
|
+
|
|
53
|
+
// eslint-disable-next-line @angular-eslint/component-class-suffix
|
|
54
|
+
class AngularPlugin extends BaseTelemetryPlugin {
|
|
55
|
+
constructor() {
|
|
56
|
+
super();
|
|
57
|
+
this.priority = 186;
|
|
58
|
+
this.identifier = 'AngularPlugin';
|
|
59
|
+
this._angularCfg = null;
|
|
60
|
+
this._eventSubscription = null;
|
|
61
|
+
let self = this;
|
|
62
|
+
self._doTeardown = (unloadCtx, unloadState, asyncCallback) => {
|
|
63
|
+
if (this.analyticsPlugin && ApplicationinsightsAngularpluginErrorService.instance !== null) {
|
|
64
|
+
ApplicationinsightsAngularpluginErrorService.instance.plugin = null;
|
|
65
|
+
if (self._angularCfg) {
|
|
66
|
+
if (self._angularCfg.errorServices && Array.isArray(self._angularCfg.errorServices)) {
|
|
67
|
+
arrForEach(self._angularCfg.errorServices, (errorService) => {
|
|
68
|
+
ApplicationinsightsAngularpluginErrorService.instance.removeErrorHandler(errorService);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (self._eventSubscription) {
|
|
74
|
+
self._eventSubscription.unsubscribe();
|
|
75
|
+
self._eventSubscription = null;
|
|
76
|
+
}
|
|
77
|
+
self.analyticsPlugin = null;
|
|
78
|
+
self.propertiesPlugin = null;
|
|
79
|
+
self._angularCfg = null;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
initialize(config, core, extensions, pluginChain) {
|
|
83
|
+
super.initialize(config, core, extensions, pluginChain);
|
|
84
|
+
const self = this;
|
|
85
|
+
const ctx = self._getTelCtx();
|
|
86
|
+
const extConfig = ctx.getExtCfg(self.identifier, { router: null, errorServices: null });
|
|
87
|
+
self.propertiesPlugin = core.getPlugin(PropertiesPluginIdentifier)?.plugin;
|
|
88
|
+
self.analyticsPlugin = core.getPlugin(AnalyticsPluginIdentifier)?.plugin;
|
|
89
|
+
if (self.analyticsPlugin) {
|
|
90
|
+
if (ApplicationinsightsAngularpluginErrorService.instance !== null) {
|
|
91
|
+
ApplicationinsightsAngularpluginErrorService.instance.plugin = self.analyticsPlugin;
|
|
92
|
+
if (extConfig.errorServices && Array.isArray(extConfig.errorServices)) {
|
|
93
|
+
arrForEach(extConfig.errorServices, (errorService) => {
|
|
94
|
+
ApplicationinsightsAngularpluginErrorService.instance.addErrorHandler(errorService);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (extConfig.router) {
|
|
100
|
+
let isPageInitialLoad = true;
|
|
101
|
+
const pageViewTelemetry = {
|
|
102
|
+
uri: extConfig.router.url
|
|
103
|
+
};
|
|
104
|
+
self.trackPageView(pageViewTelemetry);
|
|
105
|
+
self._eventSubscription = extConfig.router.events.subscribe(event => {
|
|
106
|
+
if (self.isInitialized()) {
|
|
107
|
+
if (event instanceof NavigationEnd) {
|
|
108
|
+
// for page initial load, do not call trackPageView twice
|
|
109
|
+
if (isPageInitialLoad) {
|
|
110
|
+
isPageInitialLoad = false;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const pvt = {
|
|
114
|
+
uri: extConfig.router.url,
|
|
115
|
+
properties: { duration: 0 } // SPA route change loading durations are undefined, so send 0
|
|
116
|
+
};
|
|
117
|
+
self.trackPageView(pvt);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Add Part A fields to the event
|
|
125
|
+
*
|
|
126
|
+
* @param event The event that needs to be processed
|
|
127
|
+
*/
|
|
128
|
+
processTelemetry(event, itemCtx) {
|
|
129
|
+
this.processNext(event, itemCtx);
|
|
130
|
+
}
|
|
131
|
+
trackPageView(pageView) {
|
|
132
|
+
const self = this;
|
|
133
|
+
if (self.analyticsPlugin) {
|
|
134
|
+
const location = getLocation();
|
|
135
|
+
if (self.propertiesPlugin && self.propertiesPlugin.context && self.propertiesPlugin.context.telemetryTrace) {
|
|
136
|
+
self.propertiesPlugin.context.telemetryTrace.traceID = Util.generateW3CId();
|
|
137
|
+
self.propertiesPlugin.context.telemetryTrace.name = location && location.pathname || '_unknown_';
|
|
138
|
+
}
|
|
139
|
+
self.analyticsPlugin.trackPageView(pageView);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
_throwInternal(self.diagLog(), 1 /* CRITICAL */, 64 /* TelemetryInitializerFailed */, 'Analytics plugin is not available, Angular plugin telemetry will not be sent: ');
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
AngularPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: AngularPlugin, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
147
|
+
AngularPlugin.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: AngularPlugin, selector: "lib-applicationinsights-angularplugin-js", usesInheritance: true, ngImport: i0, template: ``, isInline: true });
|
|
148
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: AngularPlugin, decorators: [{
|
|
149
|
+
type: Component,
|
|
150
|
+
args: [{
|
|
151
|
+
selector: 'lib-applicationinsights-angularplugin-js',
|
|
152
|
+
template: ``,
|
|
153
|
+
styles: []
|
|
154
|
+
}]
|
|
155
|
+
}], ctorParameters: function () { return []; } });
|
|
156
|
+
|
|
157
|
+
class ApplicationinsightsAngularpluginJsModule {
|
|
158
|
+
}
|
|
159
|
+
ApplicationinsightsAngularpluginJsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginJsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
160
|
+
ApplicationinsightsAngularpluginJsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginJsModule, declarations: [AngularPlugin], exports: [AngularPlugin] });
|
|
161
|
+
ApplicationinsightsAngularpluginJsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginJsModule, providers: [
|
|
162
|
+
ApplicationinsightsAngularpluginErrorService
|
|
163
|
+
], imports: [[]] });
|
|
164
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: ApplicationinsightsAngularpluginJsModule, decorators: [{
|
|
165
|
+
type: NgModule,
|
|
166
|
+
args: [{
|
|
167
|
+
declarations: [AngularPlugin],
|
|
168
|
+
imports: [],
|
|
169
|
+
exports: [AngularPlugin],
|
|
170
|
+
providers: [
|
|
171
|
+
ApplicationinsightsAngularpluginErrorService
|
|
172
|
+
]
|
|
173
|
+
}]
|
|
174
|
+
}] });
|
|
175
|
+
|
|
176
|
+
/*
|
|
177
|
+
* Public API Surface of applicationinsights-angularplugin-js
|
|
178
|
+
*/
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Generated bundle index. Do not edit.
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
export { AngularPlugin, ApplicationinsightsAngularpluginErrorService, ApplicationinsightsAngularpluginJsModule };
|
|
185
|
+
//# sourceMappingURL=microsoft-applicationinsights-angularplugin-js.mjs.map
|