@microsoft/applicationinsights-analytics-js 2.7.5-nightly.2203-03 → 2.7.5
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/browser/applicationinsights-analytics-js.integrity.json +9 -9
- package/browser/applicationinsights-analytics-js.js +668 -1624
- package/browser/applicationinsights-analytics-js.js.map +1 -1
- package/browser/applicationinsights-analytics-js.min.js +2 -2
- package/browser/applicationinsights-analytics-js.min.js.map +1 -1
- package/dist/applicationinsights-analytics-js.api.json +278 -97
- package/dist/applicationinsights-analytics-js.api.md +18 -8
- package/dist/applicationinsights-analytics-js.d.ts +104 -9
- package/dist/applicationinsights-analytics-js.js +668 -1624
- package/dist/applicationinsights-analytics-js.js.map +1 -1
- package/dist/applicationinsights-analytics-js.min.js +2 -2
- package/dist/applicationinsights-analytics-js.min.js.map +1 -1
- package/dist/applicationinsights-analytics-js.rollup.d.ts +104 -9
- package/dist-esm/JavaScriptSDK/ApplicationInsights.js +606 -0
- package/dist-esm/JavaScriptSDK/ApplicationInsights.js.map +1 -0
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js +8 -21
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js +10 -10
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js +5 -5
- package/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryConfig.js +1 -1
- package/dist-esm/applicationinsights-analytics-js.js +2 -2
- package/dist-esm/applicationinsights-analytics-js.js.map +1 -1
- package/package.json +60 -63
- package/src/JavaScriptSDK/{AnalyticsPlugin.ts → ApplicationInsights.ts} +325 -403
- package/src/JavaScriptSDK/Telemetry/PageViewManager.ts +13 -32
- package/src/JavaScriptSDK/Telemetry/PageViewPerformanceManager.ts +6 -6
- package/src/JavaScriptSDK/Telemetry/PageVisitTimeManager.ts +1 -1
- package/src/applicationinsights-analytics-js.ts +1 -1
- package/types/JavaScriptSDK/{AnalyticsPlugin.d.ts → ApplicationInsights.d.ts} +16 -12
- package/types/JavaScriptSDK/Telemetry/PageViewManager.d.ts +1 -2
- package/types/JavaScriptSDK/Telemetry/PageViewPerformanceManager.d.ts +9 -9
- package/types/JavaScriptSDK/Telemetry/PageVisitTimeManager.d.ts +4 -4
- package/types/applicationinsights-analytics-js.d.ts +1 -1
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/JavaScriptSDK/AnalyticsPlugin.js +0 -674
- package/dist-esm/JavaScriptSDK/AnalyticsPlugin.js.map +0 -1
- package/dist-esm/JavaScriptSDK/Timing.js +0 -39
- package/dist-esm/JavaScriptSDK/Timing.js.map +0 -1
- package/src/JavaScriptSDK/Timing.ts +0 -46
- package/types/JavaScriptSDK/Timing.d.ts +0 -18
|
@@ -12,6 +12,7 @@ import { IConfig } from '@microsoft/applicationinsights-common';
|
|
|
12
12
|
import { IConfiguration } from '@microsoft/applicationinsights-core-js';
|
|
13
13
|
import { ICookieMgr } from '@microsoft/applicationinsights-core-js';
|
|
14
14
|
import { ICustomProperties } from '@microsoft/applicationinsights-core-js';
|
|
15
|
+
import { IDiagnosticLogger } from '@microsoft/applicationinsights-core-js';
|
|
15
16
|
import { IEventTelemetry } from '@microsoft/applicationinsights-common';
|
|
16
17
|
import { IExceptionTelemetry } from '@microsoft/applicationinsights-common';
|
|
17
18
|
import { IMetricTelemetry } from '@microsoft/applicationinsights-common';
|
|
@@ -21,30 +22,39 @@ import { IPageViewTelemetry } from '@microsoft/applicationinsights-common';
|
|
|
21
22
|
import { IPageViewTelemetryInternal } from '@microsoft/applicationinsights-common';
|
|
22
23
|
import { IPlugin } from '@microsoft/applicationinsights-core-js';
|
|
23
24
|
import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
|
|
24
|
-
import { ITelemetryInitializerHandler } from '@microsoft/applicationinsights-core-js';
|
|
25
25
|
import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
|
|
26
26
|
import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js';
|
|
27
27
|
import { ITraceTelemetry } from '@microsoft/applicationinsights-common';
|
|
28
28
|
|
|
29
29
|
// @public (undocumented)
|
|
30
|
-
class
|
|
30
|
+
export class ApplicationInsights extends BaseTelemetryPlugin implements IAppInsights, IAppInsightsInternal {
|
|
31
31
|
constructor();
|
|
32
32
|
// (undocumented)
|
|
33
|
-
addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void):
|
|
33
|
+
addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void): void;
|
|
34
34
|
// (undocumented)
|
|
35
35
|
autoRoutePVDelay: number;
|
|
36
36
|
// (undocumented)
|
|
37
37
|
config: IConfig;
|
|
38
38
|
getCookieMgr(): ICookieMgr;
|
|
39
|
-
// Warning: (ae-forgotten-export) The symbol "_getDefaultConfig" needs to be exported by the entry point applicationinsights-analytics-js.d.ts
|
|
40
|
-
//
|
|
41
39
|
// (undocumented)
|
|
42
|
-
static getDefaultConfig:
|
|
40
|
+
static getDefaultConfig(config?: IConfig): IConfig;
|
|
43
41
|
// (undocumented)
|
|
44
42
|
identifier: string;
|
|
45
43
|
// (undocumented)
|
|
46
44
|
initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
47
45
|
_onerror(exception: IAutoExceptionTelemetry): void;
|
|
46
|
+
// Warning: (ae-forgotten-export) The symbol "PageViewManager" needs to be exported by the entry point applicationinsights-analytics-js.d.ts
|
|
47
|
+
//
|
|
48
|
+
// (undocumented)
|
|
49
|
+
protected _pageViewManager: PageViewManager;
|
|
50
|
+
// Warning: (ae-forgotten-export) The symbol "PageViewPerformanceManager" needs to be exported by the entry point applicationinsights-analytics-js.d.ts
|
|
51
|
+
//
|
|
52
|
+
// (undocumented)
|
|
53
|
+
protected _pageViewPerformanceManager: PageViewPerformanceManager;
|
|
54
|
+
// Warning: (ae-forgotten-export) The symbol "PageVisitTimeManager" needs to be exported by the entry point applicationinsights-analytics-js.d.ts
|
|
55
|
+
//
|
|
56
|
+
// (undocumented)
|
|
57
|
+
protected _pageVisitTimeManager: PageVisitTimeManager;
|
|
48
58
|
// (undocumented)
|
|
49
59
|
priority: number;
|
|
50
60
|
// (undocumented)
|
|
@@ -79,6 +89,8 @@ class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights, IAppI
|
|
|
79
89
|
[key: string]: number;
|
|
80
90
|
}): void;
|
|
81
91
|
// (undocumented)
|
|
92
|
+
protected _telemetryInitializers: Array<(envelope: ITelemetryItem) => boolean | void>;
|
|
93
|
+
// (undocumented)
|
|
82
94
|
trackEvent(event: IEventTelemetry, customProperties?: ICustomProperties): void;
|
|
83
95
|
trackException(exception: IExceptionTelemetry, customProperties?: ICustomProperties): void;
|
|
84
96
|
trackMetric(metric: IMetricTelemetry, customProperties?: ICustomProperties): void;
|
|
@@ -88,8 +100,6 @@ class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights, IAppI
|
|
|
88
100
|
// (undocumented)
|
|
89
101
|
static Version: string;
|
|
90
102
|
}
|
|
91
|
-
export { AnalyticsPlugin }
|
|
92
|
-
export { AnalyticsPlugin as ApplicationInsights }
|
|
93
103
|
|
|
94
104
|
// @public
|
|
95
105
|
export interface IAppInsightsInternal {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Microsoft Application Insights JavaScript SDK - Web Analytics, 2.7.5
|
|
2
|
+
* Microsoft Application Insights JavaScript SDK - Web Analytics, 2.7.5
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -15,6 +15,7 @@ declare namespace ApplicationInsights {
|
|
|
15
15
|
import { IConfiguration } from '@microsoft/applicationinsights-core-js';
|
|
16
16
|
import { ICookieMgr } from '@microsoft/applicationinsights-core-js';
|
|
17
17
|
import { ICustomProperties } from '@microsoft/applicationinsights-core-js';
|
|
18
|
+
import { IDiagnosticLogger } from '@microsoft/applicationinsights-core-js';
|
|
18
19
|
import { IEventTelemetry } from '@microsoft/applicationinsights-common';
|
|
19
20
|
import { IExceptionTelemetry } from '@microsoft/applicationinsights-common';
|
|
20
21
|
import { IMetricTelemetry } from '@microsoft/applicationinsights-common';
|
|
@@ -24,19 +25,22 @@ declare namespace ApplicationInsights {
|
|
|
24
25
|
import { IPageViewTelemetryInternal } from '@microsoft/applicationinsights-common';
|
|
25
26
|
import { IPlugin } from '@microsoft/applicationinsights-core-js';
|
|
26
27
|
import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
|
|
27
|
-
import { ITelemetryInitializerHandler } from '@microsoft/applicationinsights-core-js';
|
|
28
28
|
import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
|
|
29
29
|
import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js';
|
|
30
30
|
import { ITraceTelemetry } from '@microsoft/applicationinsights-common';
|
|
31
31
|
|
|
32
|
-
class
|
|
32
|
+
class ApplicationInsights extends BaseTelemetryPlugin implements IAppInsights, IAppInsightsInternal {
|
|
33
33
|
static Version: string;
|
|
34
|
-
static getDefaultConfig:
|
|
34
|
+
static getDefaultConfig(config?: IConfig): IConfig;
|
|
35
35
|
identifier: string;
|
|
36
36
|
priority: number;
|
|
37
37
|
config: IConfig;
|
|
38
38
|
queue: Array<() => void>;
|
|
39
39
|
autoRoutePVDelay: number;
|
|
40
|
+
protected _telemetryInitializers: Array<(envelope: ITelemetryItem) => boolean | void>;
|
|
41
|
+
protected _pageViewManager: PageViewManager;
|
|
42
|
+
protected _pageViewPerformanceManager: PageViewPerformanceManager;
|
|
43
|
+
protected _pageVisitTimeManager: PageVisitTimeManager;
|
|
40
44
|
constructor();
|
|
41
45
|
/**
|
|
42
46
|
* Get the current cookie manager for this instance
|
|
@@ -160,13 +164,9 @@ declare namespace ApplicationInsights {
|
|
|
160
164
|
* @memberof ApplicationInsights
|
|
161
165
|
*/
|
|
162
166
|
_onerror(exception: IAutoExceptionTelemetry): void;
|
|
163
|
-
addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void):
|
|
167
|
+
addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void): void;
|
|
164
168
|
initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
165
169
|
}
|
|
166
|
-
export { AnalyticsPlugin }
|
|
167
|
-
export { AnalyticsPlugin as ApplicationInsights }
|
|
168
|
-
|
|
169
|
-
function _getDefaultConfig(config?: IConfig): IConfig;
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
172
|
* Internal interface to pass appInsights object to subcomponents without coupling
|
|
@@ -176,5 +176,100 @@ declare namespace ApplicationInsights {
|
|
|
176
176
|
sendPageViewPerformanceInternal(pageViewPerformance: IPageViewPerformanceTelemetryInternal, properties?: Object, systemProperties?: Object): void;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
+
/**
|
|
180
|
+
* Class encapsulates sending page views and page view performance telemetry.
|
|
181
|
+
*/
|
|
182
|
+
class PageViewManager {
|
|
183
|
+
constructor(appInsights: IAppInsightsInternal, overridePageViewDuration: boolean, core: IAppInsightsCore, pageViewPerformanceManager: PageViewPerformanceManager);
|
|
184
|
+
/**
|
|
185
|
+
* Currently supported cases:
|
|
186
|
+
* 1) (default case) track page view called with default parameters, overridePageViewDuration = false. Page view is sent with page view performance when navigation timing data is available.
|
|
187
|
+
* a. If navigation timing is not supported then page view is sent right away with undefined duration. Page view performance is not sent.
|
|
188
|
+
* 2) overridePageViewDuration = true, custom duration provided. Custom duration is used, page view sends right away.
|
|
189
|
+
* 3) overridePageViewDuration = true, custom duration NOT provided. Page view is sent right away, duration is time spent from page load till now (or undefined if navigation timing is not supported).
|
|
190
|
+
* 4) overridePageViewDuration = false, custom duration is provided. Page view is sent right away with custom duration.
|
|
191
|
+
*
|
|
192
|
+
* In all cases page view performance is sent once (only for the 1st call of trackPageView), or not sent if navigation timing is not supported.
|
|
193
|
+
*/
|
|
194
|
+
trackPageView(pageView: IPageViewTelemetry, customProperties?: {
|
|
195
|
+
[key: string]: any;
|
|
196
|
+
}): void;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Class encapsulates sending page view performance telemetry.
|
|
201
|
+
*/
|
|
202
|
+
class PageViewPerformanceManager {
|
|
203
|
+
private _logger;
|
|
204
|
+
private MAX_DURATION_ALLOWED;
|
|
205
|
+
constructor(core: IAppInsightsCore);
|
|
206
|
+
populatePageViewPerformanceEvent(pageViewPerformance: IPageViewPerformanceTelemetryInternal): void;
|
|
207
|
+
getPerformanceTiming(): PerformanceTiming | null;
|
|
208
|
+
getPerformanceNavigationTiming(): PerformanceNavigationTiming | null;
|
|
209
|
+
/**
|
|
210
|
+
* Returns true is window PerformanceNavigationTiming API is supported, false otherwise.
|
|
211
|
+
*/
|
|
212
|
+
isPerformanceNavigationTimingSupported(): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Returns true is window performance timing API is supported, false otherwise.
|
|
215
|
+
*/
|
|
216
|
+
isPerformanceTimingSupported(): PerformanceTiming;
|
|
217
|
+
/**
|
|
218
|
+
* As page loads different parts of performance timing numbers get set. When all of them are set we can report it.
|
|
219
|
+
* Returns true if ready, false otherwise.
|
|
220
|
+
*/
|
|
221
|
+
isPerformanceTimingDataReady(): boolean;
|
|
222
|
+
/**
|
|
223
|
+
* This method tells if given durations should be excluded from collection.
|
|
224
|
+
*/
|
|
225
|
+
shouldCollectDuration(...durations: number[]): boolean;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
class PageVisitData {
|
|
229
|
+
pageName: string;
|
|
230
|
+
pageUrl: string;
|
|
231
|
+
pageVisitStartTime: number;
|
|
232
|
+
pageVisitTime: number;
|
|
233
|
+
constructor(pageName: string, pageUrl: string);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Used to track page visit durations
|
|
238
|
+
*/
|
|
239
|
+
class PageVisitTimeManager {
|
|
240
|
+
private prevPageVisitDataKeyName;
|
|
241
|
+
private pageVisitTimeTrackingHandler;
|
|
242
|
+
private _logger;
|
|
243
|
+
/**
|
|
244
|
+
* Creates a new instance of PageVisitTimeManager
|
|
245
|
+
* @param pageVisitTimeTrackingHandler Delegate that will be called to send telemetry data to AI (when trackPreviousPageVisit is called)
|
|
246
|
+
* @returns {}
|
|
247
|
+
*/
|
|
248
|
+
constructor(logger: IDiagnosticLogger, pageVisitTimeTrackingHandler: (pageName: string, pageUrl: string, pageVisitTime: number) => void);
|
|
249
|
+
/**
|
|
250
|
+
* Tracks the previous page visit time telemetry (if exists) and starts timing of new page visit time
|
|
251
|
+
* @param currentPageName Name of page to begin timing for visit duration
|
|
252
|
+
* @param currentPageUrl Url of page to begin timing for visit duration
|
|
253
|
+
*/
|
|
254
|
+
trackPreviousPageVisit(currentPageName: string, currentPageUrl: string): void;
|
|
255
|
+
/**
|
|
256
|
+
* Stops timing of current page (if exists) and starts timing for duration of visit to pageName
|
|
257
|
+
* @param pageName Name of page to begin timing visit duration
|
|
258
|
+
* @returns {PageVisitData} Page visit data (including duration) of pageName from last call to start or restart, if exists. Null if not.
|
|
259
|
+
*/
|
|
260
|
+
restartPageVisitTimer(pageName: string, pageUrl: string): PageVisitData;
|
|
261
|
+
/**
|
|
262
|
+
* Starts timing visit duration of pageName
|
|
263
|
+
* @param pageName
|
|
264
|
+
* @returns {}
|
|
265
|
+
*/
|
|
266
|
+
startPageVisitTimer(pageName: string, pageUrl: string): void;
|
|
267
|
+
/**
|
|
268
|
+
* Stops timing of current page, if exists.
|
|
269
|
+
* @returns {PageVisitData} Page visit data (including duration) of pageName from call to start, if exists. Null if not.
|
|
270
|
+
*/
|
|
271
|
+
stopPageVisitTimer(): PageVisitData;
|
|
272
|
+
}
|
|
273
|
+
|
|
179
274
|
|
|
180
275
|
}
|