@microsoft/applicationinsights-analytics-js 2.7.5-nightly.2204-03 → 2.7.5-nightly.2204-23

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 (42) hide show
  1. package/browser/applicationinsights-analytics-js.integrity.json +9 -9
  2. package/browser/applicationinsights-analytics-js.js +668 -1624
  3. package/browser/applicationinsights-analytics-js.js.map +1 -1
  4. package/browser/applicationinsights-analytics-js.min.js +2 -2
  5. package/browser/applicationinsights-analytics-js.min.js.map +1 -1
  6. package/dist/applicationinsights-analytics-js.api.json +278 -97
  7. package/dist/applicationinsights-analytics-js.api.md +18 -8
  8. package/dist/applicationinsights-analytics-js.d.ts +104 -9
  9. package/dist/applicationinsights-analytics-js.js +668 -1624
  10. package/dist/applicationinsights-analytics-js.js.map +1 -1
  11. package/dist/applicationinsights-analytics-js.min.js +2 -2
  12. package/dist/applicationinsights-analytics-js.min.js.map +1 -1
  13. package/dist/applicationinsights-analytics-js.rollup.d.ts +104 -9
  14. package/dist-esm/JavaScriptSDK/ApplicationInsights.js +606 -0
  15. package/dist-esm/JavaScriptSDK/ApplicationInsights.js.map +1 -0
  16. package/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js +8 -21
  17. package/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js.map +1 -1
  18. package/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js +10 -10
  19. package/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js.map +1 -1
  20. package/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js +5 -5
  21. package/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js.map +1 -1
  22. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryConfig.js +1 -1
  23. package/dist-esm/applicationinsights-analytics-js.js +2 -2
  24. package/dist-esm/applicationinsights-analytics-js.js.map +1 -1
  25. package/package.json +7 -7
  26. package/src/JavaScriptSDK/{AnalyticsPlugin.ts → ApplicationInsights.ts} +325 -403
  27. package/src/JavaScriptSDK/Telemetry/PageViewManager.ts +13 -32
  28. package/src/JavaScriptSDK/Telemetry/PageViewPerformanceManager.ts +6 -6
  29. package/src/JavaScriptSDK/Telemetry/PageVisitTimeManager.ts +1 -1
  30. package/src/applicationinsights-analytics-js.ts +1 -1
  31. package/types/JavaScriptSDK/{AnalyticsPlugin.d.ts → ApplicationInsights.d.ts} +16 -12
  32. package/types/JavaScriptSDK/Telemetry/PageViewManager.d.ts +1 -2
  33. package/types/JavaScriptSDK/Telemetry/PageViewPerformanceManager.d.ts +9 -9
  34. package/types/JavaScriptSDK/Telemetry/PageVisitTimeManager.d.ts +4 -4
  35. package/types/applicationinsights-analytics-js.d.ts +1 -1
  36. package/types/tsdoc-metadata.json +1 -1
  37. package/dist-esm/JavaScriptSDK/AnalyticsPlugin.js +0 -674
  38. package/dist-esm/JavaScriptSDK/AnalyticsPlugin.js.map +0 -1
  39. package/dist-esm/JavaScriptSDK/Timing.js +0 -39
  40. package/dist-esm/JavaScriptSDK/Timing.js.map +0 -1
  41. package/src/JavaScriptSDK/Timing.ts +0 -46
  42. package/types/JavaScriptSDK/Timing.d.ts +0 -18
@@ -6,7 +6,7 @@ import {
6
6
  } from "@microsoft/applicationinsights-common";
7
7
  import {
8
8
  IAppInsightsCore, IDiagnosticLogger, LoggingSeverity,
9
- _InternalMessageId, getDocument, getLocation, arrForEach, isNullOrUndefined, getExceptionName, dumpObj, IProcessTelemetryUnloadContext, ITelemetryUnloadState
9
+ _InternalMessageId, getDocument, getLocation, arrForEach, isNullOrUndefined, getExceptionName, dumpObj
10
10
  } from "@microsoft/applicationinsights-core-js";
11
11
  import { PageViewPerformanceManager } from "./PageViewPerformanceManager";
12
12
  import dynamicProto from "@microsoft/dynamicproto-js";
@@ -25,10 +25,10 @@ export interface IAppInsightsInternal {
25
25
  export class PageViewManager {
26
26
 
27
27
  constructor(
28
- appInsights: IAppInsightsInternal,
29
- overridePageViewDuration: boolean,
30
- core: IAppInsightsCore,
31
- pageViewPerformanceManager: PageViewPerformanceManager) {
28
+ appInsights: IAppInsightsInternal,
29
+ overridePageViewDuration: boolean,
30
+ core: IAppInsightsCore,
31
+ pageViewPerformanceManager: PageViewPerformanceManager) {
32
32
 
33
33
  dynamicProto(PageViewManager, this, (_self) => {
34
34
  let intervalHandle: any = null;
@@ -40,9 +40,11 @@ export class PageViewManager {
40
40
  _logger = core.logger;
41
41
  }
42
42
 
43
- function _flushChannels(isAsync: boolean) {
43
+ function _flushChannels() {
44
44
  if (core) {
45
- core.flush(isAsync);
45
+ arrForEach(core.getTransmissionControls(), queues => {
46
+ arrForEach(queues, q => q.flush(true))
47
+ });
46
48
  }
47
49
  }
48
50
 
@@ -70,7 +72,7 @@ export class PageViewManager {
70
72
 
71
73
  if (doFlush) {
72
74
  // We process at least one item so flush the queue
73
- _flushChannels(true);
75
+ _flushChannels();
74
76
  }
75
77
  }), 100);
76
78
  }
@@ -97,7 +99,7 @@ export class PageViewManager {
97
99
  pageView,
98
100
  customProperties
99
101
  );
100
- _flushChannels(true);
102
+ _flushChannels();
101
103
 
102
104
  // no navigation timing (IE 8, iOS Safari 8.4, Opera Mini 8 - see http://caniuse.com/#feat=nav-timing)
103
105
  _logger.throwInternal(
@@ -141,7 +143,7 @@ export class PageViewManager {
141
143
  pageView,
142
144
  customProperties
143
145
  );
144
- _flushChannels(true);
146
+ _flushChannels();
145
147
  pageViewSent = true;
146
148
  }
147
149
 
@@ -205,24 +207,7 @@ export class PageViewManager {
205
207
 
206
208
  return processed;
207
209
  });
208
- };
209
-
210
- _self.teardown = (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => {
211
- if (intervalHandle) {
212
- clearInterval(intervalHandle);
213
- intervalHandle = null;
214
-
215
- let allItems = itemQueue.slice(0);
216
- let doFlush = false;
217
- itemQueue = [];
218
- arrForEach(allItems, (item) => {
219
- if (item()) {
220
- doFlush = true;
221
- }
222
- });
223
- }
224
- };
225
-
210
+ }
226
211
  });
227
212
  }
228
213
 
@@ -239,8 +224,4 @@ export class PageViewManager {
239
224
  public trackPageView(pageView: IPageViewTelemetry, customProperties?: { [key: string]: any }) {
240
225
  // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
241
226
  }
242
-
243
- public teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) {
244
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
245
- }
246
227
  }
@@ -125,15 +125,15 @@ export class PageViewPerformanceManager {
125
125
  return null;
126
126
  }
127
127
 
128
- /**
128
+ /**
129
129
  * Returns true is window PerformanceNavigationTiming API is supported, false otherwise.
130
130
  */
131
- public isPerformanceNavigationTimingSupported() {
131
+ public isPerformanceNavigationTimingSupported() {
132
132
  let perf = getPerformance();
133
133
  return perf && perf.getEntriesByType && perf.getEntriesByType("navigation").length > 0;
134
- }
134
+ }
135
135
 
136
- /**
136
+ /**
137
137
  * Returns true is window performance timing API is supported, false otherwise.
138
138
  */
139
139
  public isPerformanceTimingSupported() {
@@ -141,7 +141,7 @@ export class PageViewPerformanceManager {
141
141
  return perf && perf.timing;
142
142
  }
143
143
 
144
- /**
144
+ /**
145
145
  * As page loads different parts of performance timing numbers get set. When all of them are set we can report it.
146
146
  * Returns true if ready, false otherwise.
147
147
  */
@@ -160,7 +160,7 @@ export class PageViewPerformanceManager {
160
160
  && timing.domLoading > 0;
161
161
  }
162
162
 
163
- /**
163
+ /**
164
164
  * This method tells if given durations should be excluded from collection.
165
165
  */
166
166
  public shouldCollectDuration(...durations: number[]): boolean {
@@ -23,7 +23,7 @@ export class PageVisitTimeManager {
23
23
  this._logger = logger;
24
24
  }
25
25
 
26
- /**
26
+ /**
27
27
  * Tracks the previous page visit time telemetry (if exists) and starts timing of new page visit time
28
28
  * @param currentPageName Name of page to begin timing for visit duration
29
29
  * @param currentPageUrl Url of page to begin timing for visit duration
@@ -1,5 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation. All rights reserved.
2
2
  // Licensed under the MIT License.
3
3
 
4
- export { AnalyticsPlugin, AnalyticsPlugin as ApplicationInsights } from "./JavaScriptSDK/AnalyticsPlugin";
4
+ export { ApplicationInsights } from "./JavaScriptSDK/ApplicationInsights";
5
5
  export { IAppInsightsInternal } from "./JavaScriptSDK/Telemetry/PageViewManager";
@@ -3,17 +3,22 @@
3
3
  * @copyright Microsoft 2018
4
4
  */
5
5
  import { IConfig, IAppInsights, IEventTelemetry, IExceptionTelemetry, ITraceTelemetry, IMetricTelemetry, IAutoExceptionTelemetry, IPageViewTelemetryInternal, IPageViewTelemetry, IPageViewPerformanceTelemetry, IPageViewPerformanceTelemetryInternal } from "@microsoft/applicationinsights-common";
6
- import { IPlugin, IConfiguration, IAppInsightsCore, BaseTelemetryPlugin, ITelemetryItem, IProcessTelemetryContext, ITelemetryPluginChain, ICustomProperties, ICookieMgr, ITelemetryInitializerHandler } from "@microsoft/applicationinsights-core-js";
7
- import { IAppInsightsInternal } from "./Telemetry/PageViewManager";
8
- declare function _getDefaultConfig(config?: IConfig): IConfig;
9
- export declare class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights, IAppInsightsInternal {
6
+ import { IPlugin, IConfiguration, IAppInsightsCore, BaseTelemetryPlugin, ITelemetryItem, IProcessTelemetryContext, ITelemetryPluginChain, ICustomProperties, ICookieMgr } from "@microsoft/applicationinsights-core-js";
7
+ import { PageViewManager, IAppInsightsInternal } from "./Telemetry/PageViewManager";
8
+ import { PageVisitTimeManager } from "./Telemetry/PageVisitTimeManager";
9
+ import { PageViewPerformanceManager } from "./Telemetry/PageViewPerformanceManager";
10
+ export declare class ApplicationInsights extends BaseTelemetryPlugin implements IAppInsights, IAppInsightsInternal {
10
11
  static Version: string;
11
- static getDefaultConfig: typeof _getDefaultConfig;
12
+ static getDefaultConfig(config?: IConfig): IConfig;
12
13
  identifier: string;
13
14
  priority: number;
14
15
  config: IConfig;
15
16
  queue: Array<() => void>;
16
17
  autoRoutePVDelay: number;
18
+ protected _telemetryInitializers: Array<(envelope: ITelemetryItem) => boolean | void>;
19
+ protected _pageViewManager: PageViewManager;
20
+ protected _pageViewPerformanceManager: PageViewPerformanceManager;
21
+ protected _pageVisitTimeManager: PageVisitTimeManager;
17
22
  constructor();
18
23
  /**
19
24
  * Get the current cookie manager for this instance
@@ -111,11 +116,11 @@ export declare class AnalyticsPlugin extends BaseTelemetryPlugin implements IApp
111
116
  [key: string]: number;
112
117
  }): void;
113
118
  /**
114
- * @ignore INTERNAL ONLY
115
- * @param exception
116
- * @param properties
117
- * @param systemProperties
118
- */
119
+ * @ignore INTERNAL ONLY
120
+ * @param exception
121
+ * @param properties
122
+ * @param systemProperties
123
+ */
119
124
  sendExceptionInternal(exception: IExceptionTelemetry, customProperties?: {
120
125
  [key: string]: any;
121
126
  }, systemProperties?: {
@@ -137,7 +142,6 @@ export declare class AnalyticsPlugin extends BaseTelemetryPlugin implements IApp
137
142
  * @memberof ApplicationInsights
138
143
  */
139
144
  _onerror(exception: IAutoExceptionTelemetry): void;
140
- addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void): ITelemetryInitializerHandler | void;
145
+ addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void): void;
141
146
  initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
142
147
  }
143
- export {};
@@ -1,5 +1,5 @@
1
1
  import { IPageViewTelemetry, IPageViewTelemetryInternal, IPageViewPerformanceTelemetryInternal } from "@microsoft/applicationinsights-common";
2
- import { IAppInsightsCore, IProcessTelemetryUnloadContext, ITelemetryUnloadState } from "@microsoft/applicationinsights-core-js";
2
+ import { IAppInsightsCore } from "@microsoft/applicationinsights-core-js";
3
3
  import { PageViewPerformanceManager } from "./PageViewPerformanceManager";
4
4
  /**
5
5
  * Internal interface to pass appInsights object to subcomponents without coupling
@@ -26,5 +26,4 @@ export declare class PageViewManager {
26
26
  trackPageView(pageView: IPageViewTelemetry, customProperties?: {
27
27
  [key: string]: any;
28
28
  }): void;
29
- teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void;
30
29
  }
@@ -11,20 +11,20 @@ export declare class PageViewPerformanceManager {
11
11
  getPerformanceTiming(): PerformanceTiming | null;
12
12
  getPerformanceNavigationTiming(): PerformanceNavigationTiming | null;
13
13
  /**
14
- * Returns true is window PerformanceNavigationTiming API is supported, false otherwise.
15
- */
14
+ * Returns true is window PerformanceNavigationTiming API is supported, false otherwise.
15
+ */
16
16
  isPerformanceNavigationTimingSupported(): boolean;
17
17
  /**
18
- * Returns true is window performance timing API is supported, false otherwise.
19
- */
18
+ * Returns true is window performance timing API is supported, false otherwise.
19
+ */
20
20
  isPerformanceTimingSupported(): PerformanceTiming;
21
21
  /**
22
- * As page loads different parts of performance timing numbers get set. When all of them are set we can report it.
23
- * Returns true if ready, false otherwise.
24
- */
22
+ * As page loads different parts of performance timing numbers get set. When all of them are set we can report it.
23
+ * Returns true if ready, false otherwise.
24
+ */
25
25
  isPerformanceTimingDataReady(): boolean;
26
26
  /**
27
- * This method tells if given durations should be excluded from collection.
28
- */
27
+ * This method tells if given durations should be excluded from collection.
28
+ */
29
29
  shouldCollectDuration(...durations: number[]): boolean;
30
30
  }
@@ -13,10 +13,10 @@ export declare class PageVisitTimeManager {
13
13
  */
14
14
  constructor(logger: IDiagnosticLogger, pageVisitTimeTrackingHandler: (pageName: string, pageUrl: string, pageVisitTime: number) => void);
15
15
  /**
16
- * Tracks the previous page visit time telemetry (if exists) and starts timing of new page visit time
17
- * @param currentPageName Name of page to begin timing for visit duration
18
- * @param currentPageUrl Url of page to begin timing for visit duration
19
- */
16
+ * Tracks the previous page visit time telemetry (if exists) and starts timing of new page visit time
17
+ * @param currentPageName Name of page to begin timing for visit duration
18
+ * @param currentPageUrl Url of page to begin timing for visit duration
19
+ */
20
20
  trackPreviousPageVisit(currentPageName: string, currentPageUrl: string): void;
21
21
  /**
22
22
  * Stops timing of current page (if exists) and starts timing for duration of visit to pageName
@@ -1,2 +1,2 @@
1
- export { AnalyticsPlugin, AnalyticsPlugin as ApplicationInsights } from "./JavaScriptSDK/AnalyticsPlugin";
1
+ export { ApplicationInsights } from "./JavaScriptSDK/ApplicationInsights";
2
2
  export { IAppInsightsInternal } from "./JavaScriptSDK/Telemetry/PageViewManager";
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.19.5"
8
+ "packageVersion": "7.23.0"
9
9
  }
10
10
  ]
11
11
  }