@microsoft/applicationinsights-analytics-js 2.8.0-beta.2203-03 → 2.8.0-beta.2203-06
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 +754 -251
- 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 +48 -183
- package/dist/applicationinsights-analytics-js.api.md +8 -18
- package/dist/applicationinsights-analytics-js.d.ts +9 -104
- package/dist/applicationinsights-analytics-js.js +754 -251
- 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 +9 -104
- package/dist-esm/JavaScriptSDK/AnalyticsPlugin.js +673 -0
- package/dist-esm/JavaScriptSDK/AnalyticsPlugin.js.map +1 -0
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js +1 -1
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js +1 -1
- package/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js +1 -1
- package/dist-esm/JavaScriptSDK/Timing.js +39 -0
- package/dist-esm/JavaScriptSDK/Timing.js.map +1 -0
- 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 +5 -5
- package/src/JavaScriptSDK/{ApplicationInsights.ts → AnalyticsPlugin.ts} +401 -324
- package/src/JavaScriptSDK/Timing.ts +46 -0
- package/src/applicationinsights-analytics-js.ts +1 -1
- package/types/JavaScriptSDK/{ApplicationInsights.d.ts → AnalyticsPlugin.d.ts} +7 -11
- package/types/JavaScriptSDK/Timing.d.ts +18 -0
- package/types/applicationinsights-analytics-js.d.ts +1 -1
- package/dist-esm/JavaScriptSDK/ApplicationInsights.js +0 -606
- package/dist-esm/JavaScriptSDK/ApplicationInsights.js.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import { dateTimeUtilsDuration } from "@microsoft/applicationinsights-common";
|
|
5
|
+
import { IDiagnosticLogger, LoggingSeverity, _InternalMessageId, _throwInternal } from "@microsoft/applicationinsights-core-js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Used to record timed events and page views.
|
|
9
|
+
*/
|
|
10
|
+
export class Timing {
|
|
11
|
+
|
|
12
|
+
public action: (name?: string, url?: string, duration?: number, properties?: { [key: string]: string }, measurements?: { [key: string]: number }) => void;
|
|
13
|
+
public start: (name: string) => void;
|
|
14
|
+
public stop: (name: string, url: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number }) => void;
|
|
15
|
+
|
|
16
|
+
constructor(logger: IDiagnosticLogger, name: string) {
|
|
17
|
+
let _self = this;
|
|
18
|
+
let _events: { [key: string]: number; } = {}
|
|
19
|
+
|
|
20
|
+
_self.start = (name: string) => {
|
|
21
|
+
if (typeof _events[name] !== "undefined") {
|
|
22
|
+
_throwInternal(logger,
|
|
23
|
+
LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.",
|
|
24
|
+
{ name, key: name }, true);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_events[name] = +new Date;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
_self.stop = (name: string, url: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number }) => {
|
|
31
|
+
const start = _events[name];
|
|
32
|
+
if (isNaN(start)) {
|
|
33
|
+
_throwInternal(logger,
|
|
34
|
+
LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.",
|
|
35
|
+
{ name, key: name }, true);
|
|
36
|
+
} else {
|
|
37
|
+
const end = +new Date;
|
|
38
|
+
const duration = dateTimeUtilsDuration(start, end);
|
|
39
|
+
_self.action(name, url, duration, properties, measurements);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
delete _events[name];
|
|
43
|
+
_events[name] = undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
export { ApplicationInsights } from "./JavaScriptSDK/
|
|
4
|
+
export { AnalyticsPlugin, AnalyticsPlugin as ApplicationInsights } from "./JavaScriptSDK/AnalyticsPlugin";
|
|
5
5
|
export { IAppInsightsInternal } from "./JavaScriptSDK/Telemetry/PageViewManager";
|
|
@@ -3,22 +3,17 @@
|
|
|
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 } from "@microsoft/applicationinsights-core-js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare class ApplicationInsights extends BaseTelemetryPlugin implements IAppInsights, IAppInsightsInternal {
|
|
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 {
|
|
11
10
|
static Version: string;
|
|
12
|
-
static getDefaultConfig
|
|
11
|
+
static getDefaultConfig: typeof _getDefaultConfig;
|
|
13
12
|
identifier: string;
|
|
14
13
|
priority: number;
|
|
15
14
|
config: IConfig;
|
|
16
15
|
queue: Array<() => void>;
|
|
17
16
|
autoRoutePVDelay: number;
|
|
18
|
-
protected _telemetryInitializers: Array<(envelope: ITelemetryItem) => boolean | void>;
|
|
19
|
-
protected _pageViewManager: PageViewManager;
|
|
20
|
-
protected _pageViewPerformanceManager: PageViewPerformanceManager;
|
|
21
|
-
protected _pageVisitTimeManager: PageVisitTimeManager;
|
|
22
17
|
constructor();
|
|
23
18
|
/**
|
|
24
19
|
* Get the current cookie manager for this instance
|
|
@@ -142,6 +137,7 @@ export declare class ApplicationInsights extends BaseTelemetryPlugin implements
|
|
|
142
137
|
* @memberof ApplicationInsights
|
|
143
138
|
*/
|
|
144
139
|
_onerror(exception: IAutoExceptionTelemetry): void;
|
|
145
|
-
addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void): void;
|
|
140
|
+
addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void): ITelemetryInitializerHandler | void;
|
|
146
141
|
initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
147
142
|
}
|
|
143
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
|
|
2
|
+
/**
|
|
3
|
+
* Used to record timed events and page views.
|
|
4
|
+
*/
|
|
5
|
+
export declare class Timing {
|
|
6
|
+
action: (name?: string, url?: string, duration?: number, properties?: {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
}, measurements?: {
|
|
9
|
+
[key: string]: number;
|
|
10
|
+
}) => void;
|
|
11
|
+
start: (name: string) => void;
|
|
12
|
+
stop: (name: string, url: string, properties?: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
}, measurements?: {
|
|
15
|
+
[key: string]: number;
|
|
16
|
+
}) => void;
|
|
17
|
+
constructor(logger: IDiagnosticLogger, name: string);
|
|
18
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ApplicationInsights } from "./JavaScriptSDK/
|
|
1
|
+
export { AnalyticsPlugin, AnalyticsPlugin as ApplicationInsights } from "./JavaScriptSDK/AnalyticsPlugin";
|
|
2
2
|
export { IAppInsightsInternal } from "./JavaScriptSDK/Telemetry/PageViewManager";
|