@microsoft/applicationinsights-react-js 19.3.7-nightly.2507-04 → 19.3.7-nightly.2507-07
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-react-js.js +3863 -0
- package/browser/applicationinsights-react-js.js.map +1 -0
- package/browser/applicationinsights-react-js.min.js +6 -0
- package/browser/applicationinsights-react-js.min.js.map +1 -0
- package/dist/applicationinsights-react-js.api.json +1982 -0
- package/dist/applicationinsights-react-js.api.md +129 -0
- package/dist/applicationinsights-react-js.d.ts +137 -0
- package/dist/applicationinsights-react-js.js +3863 -0
- package/dist/applicationinsights-react-js.js.map +1 -0
- package/dist/applicationinsights-react-js.min.js +6 -0
- package/dist/applicationinsights-react-js.min.js.map +1 -0
- package/dist/applicationinsights-react-js.rollup.d.ts +142 -0
- package/dist-esm/AppInsightsContext.js +4 -0
- package/dist-esm/AppInsightsContext.js.map +1 -1
- package/dist-esm/AppInsightsErrorBoundary.js +7 -3
- package/dist-esm/AppInsightsErrorBoundary.js.map +1 -1
- package/dist-esm/Interfaces/IReactExtensionConfig.js +6 -2
- package/dist-esm/Interfaces/IReactExtensionConfig.js.map +1 -1
- package/dist-esm/ReactPlugin.js +19 -40
- package/dist-esm/ReactPlugin.js.map +1 -1
- package/dist-esm/applicationinsights-react-js.js +6 -2
- package/dist-esm/applicationinsights-react-js.js.map +1 -1
- package/dist-esm/useTrackEvent.js +4 -0
- package/dist-esm/useTrackEvent.js.map +1 -1
- package/dist-esm/useTrackMetric.js +5 -1
- package/dist-esm/useTrackMetric.js.map +1 -1
- package/dist-esm/withAITracking.js +7 -3
- package/dist-esm/withAITracking.js.map +1 -1
- package/package.json +1 -1
- package/types/tsdoc-metadata.json +11 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Microsoft Application Insights react plugin, 19.3.7-nightly.2507-07
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Microsoft Application Insights Team
|
|
6
|
+
* https://github.com/microsoft/applicationinsights-react-js#readme
|
|
7
|
+
*
|
|
8
|
+
* ---------------------------------------------------------------------------
|
|
9
|
+
* This is a single combined (rollup) declaration file for the package,
|
|
10
|
+
* use this version if your build environment doesn't support the using the
|
|
11
|
+
* individual *.d.ts files or default namespace wrapped version.
|
|
12
|
+
* - Namespaced version: applicationinsights-react-js.d.ts
|
|
13
|
+
* ---------------------------------------------------------------------------
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { BaseTelemetryPlugin } from '@microsoft/applicationinsights-core-js';
|
|
17
|
+
import { Context } from 'react';
|
|
18
|
+
import { Dispatch } from 'react';
|
|
19
|
+
import { History as History_2 } from 'history';
|
|
20
|
+
import { IAppInsights } from '@microsoft/applicationinsights-common';
|
|
21
|
+
import { IAppInsightsCore } from '@microsoft/applicationinsights-core-js';
|
|
22
|
+
import { IConfig } from '@microsoft/applicationinsights-common';
|
|
23
|
+
import { IConfiguration } from '@microsoft/applicationinsights-core-js';
|
|
24
|
+
import { ICookieMgr } from '@microsoft/applicationinsights-core-js';
|
|
25
|
+
import { ICustomProperties } from '@microsoft/applicationinsights-core-js';
|
|
26
|
+
import { IEventTelemetry } from '@microsoft/applicationinsights-common';
|
|
27
|
+
import { IExceptionTelemetry } from '@microsoft/applicationinsights-common';
|
|
28
|
+
import { IMetricTelemetry } from '@microsoft/applicationinsights-common';
|
|
29
|
+
import { IPageViewTelemetry } from '@microsoft/applicationinsights-common';
|
|
30
|
+
import { IPlugin } from '@microsoft/applicationinsights-core-js';
|
|
31
|
+
import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
|
|
32
|
+
import { ITelemetryContext } from '@microsoft/applicationinsights-common';
|
|
33
|
+
import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
|
|
34
|
+
import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js';
|
|
35
|
+
import { ITraceTelemetry } from '@microsoft/applicationinsights-common';
|
|
36
|
+
import * as React_2 from 'react';
|
|
37
|
+
import { default as React_3 } from 'react';
|
|
38
|
+
import { SetStateAction } from 'react';
|
|
39
|
+
|
|
40
|
+
declare type AIReactCustomEvent<T> = Dispatch<SetStateAction<T>>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Higher-order component base class to hook Application Insights tracking
|
|
44
|
+
* in a React component's lifecycle.
|
|
45
|
+
*/
|
|
46
|
+
export declare abstract class AITrackedComponentBase<P> extends React_2.Component<P> {
|
|
47
|
+
protected _mountTimestamp: number;
|
|
48
|
+
protected _firstActiveTimestamp: number;
|
|
49
|
+
protected _idleStartTimestamp: number;
|
|
50
|
+
protected _lastActiveTimestamp: number;
|
|
51
|
+
protected _totalIdleTime: number;
|
|
52
|
+
protected _idleCount: number;
|
|
53
|
+
protected _idleTimeout: number;
|
|
54
|
+
protected _intervalId?: any;
|
|
55
|
+
protected _componentName: string;
|
|
56
|
+
protected _reactPlugin: ReactPlugin;
|
|
57
|
+
constructor(props: P, reactPlugin: ReactPlugin, componentName: string);
|
|
58
|
+
componentDidMount(): void;
|
|
59
|
+
componentWillUnmount(): void;
|
|
60
|
+
protected trackActivity: (e: React_2.SyntheticEvent<any>) => void;
|
|
61
|
+
private getEngagementTimeSeconds;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export declare const AppInsightsContext: AppInsightsReactContext;
|
|
65
|
+
|
|
66
|
+
export declare class AppInsightsErrorBoundary extends React_3.Component<IAppInsightsErrorBoundaryProps, IAppInsightsErrorBoundaryState> {
|
|
67
|
+
state: {
|
|
68
|
+
hasError: boolean;
|
|
69
|
+
};
|
|
70
|
+
componentDidCatch(error: Error, errorInfo: React_3.ErrorInfo): void;
|
|
71
|
+
render(): React_3.ReactElement<unknown, string | React_3.JSXElementConstructor<any>>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare type AppInsightsReactContext = Context<ReactPlugin>;
|
|
75
|
+
|
|
76
|
+
declare interface IAppInsightsErrorBoundaryProps {
|
|
77
|
+
appInsights: ReactPlugin;
|
|
78
|
+
onError: React_3.ComponentType<any>;
|
|
79
|
+
children: React_3.ReactElement;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
declare interface IAppInsightsErrorBoundaryState {
|
|
83
|
+
hasError: boolean;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Settings to initialize a ReactAI instance.
|
|
88
|
+
*/
|
|
89
|
+
export declare interface IReactExtensionConfig {
|
|
90
|
+
/**
|
|
91
|
+
* React router history for enabling Application Insights PageView tracking.
|
|
92
|
+
*
|
|
93
|
+
* @type {History}
|
|
94
|
+
* @memberof IReactAISettings
|
|
95
|
+
*/
|
|
96
|
+
readonly history?: History_2;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export declare class ReactPlugin extends BaseTelemetryPlugin {
|
|
100
|
+
priority: number;
|
|
101
|
+
identifier: string;
|
|
102
|
+
readonly context: ITelemetryContext;
|
|
103
|
+
constructor();
|
|
104
|
+
initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
105
|
+
/**
|
|
106
|
+
* Get the current cookie manager for this instance
|
|
107
|
+
*/
|
|
108
|
+
getCookieMgr(): ICookieMgr;
|
|
109
|
+
/**
|
|
110
|
+
* Get application insights instance.
|
|
111
|
+
*/
|
|
112
|
+
getAppInsights(): IAppInsights;
|
|
113
|
+
/**
|
|
114
|
+
* Add Part A fields to the event
|
|
115
|
+
* @param event The event that needs to be processed
|
|
116
|
+
*/
|
|
117
|
+
processTelemetry(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
118
|
+
trackMetric(metric: IMetricTelemetry, customProperties: ICustomProperties): void;
|
|
119
|
+
trackPageView(pageView: IPageViewTelemetry): void;
|
|
120
|
+
trackEvent(event: IEventTelemetry, customProperties?: ICustomProperties): void;
|
|
121
|
+
trackException(exception: IExceptionTelemetry, customProperties?: ICustomProperties): void;
|
|
122
|
+
trackTrace(trace: ITraceTelemetry, customProperties?: ICustomProperties): void;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export declare const useAppInsightsContext: () => ReactPlugin;
|
|
126
|
+
|
|
127
|
+
export declare function useTrackEvent<T>(reactPlugin: ReactPlugin, eventName: string, eventData: T, skipFirstRun?: boolean): AIReactCustomEvent<T>;
|
|
128
|
+
|
|
129
|
+
export declare const useTrackMetric: (reactPlugin: ReactPlugin, componentName: string, customProperties?: ICustomProperties) => () => void;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Higher-order component function to hook Application Insights tracking
|
|
133
|
+
* in a React component's lifecycle.
|
|
134
|
+
*
|
|
135
|
+
* @param reactPlugin ReactPlugin instance
|
|
136
|
+
* @param Component the React component to be instrumented
|
|
137
|
+
* @param componentName (optional) component name
|
|
138
|
+
* @param className (optional) className of the HOC div
|
|
139
|
+
*/
|
|
140
|
+
export declare function withAITracking<P>(reactPlugin: ReactPlugin, Component: React_2.ComponentType<P>, componentName?: string, className?: string): React_2.ComponentClass<P>;
|
|
141
|
+
|
|
142
|
+
export { }
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 19.3.7-nightly.2507-07
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
1
5
|
import { createContext, useContext } from "react";
|
|
2
6
|
var AppInsightsContext = createContext(undefined);
|
|
3
7
|
var useAppInsightsContext = function () { return useContext(AppInsightsContext); };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppInsightsContext.js","
|
|
1
|
+
{"version":3,"file":"AppInsightsContext.js.map","sources":["AppInsightsContext.js"],"sourcesContent":["import { createContext, useContext } from \"react\";\r\nvar AppInsightsContext = createContext(undefined);\r\nvar useAppInsightsContext = function () { return useContext(AppInsightsContext); };\r\nexport { AppInsightsContext, useAppInsightsContext };\r\n//# sourceMappingURL=AppInsightsContext.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 19.3.7-nightly.2507-07
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
|
|
4
8
|
import React from "react";
|
|
5
9
|
import { SeverityLevel } from "@microsoft/applicationinsights-common";
|
|
6
10
|
var AppInsightsErrorBoundary = /** @class */ (function (_super) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppInsightsErrorBoundary.js","
|
|
1
|
+
{"version":3,"file":"AppInsightsErrorBoundary.js.map","sources":["AppInsightsErrorBoundary.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\nimport React from \"react\";\r\nimport { SeverityLevel } from \"@microsoft/applicationinsights-common\";\r\nvar AppInsightsErrorBoundary = /** @class */ (function (_super) {\r\n __extends(AppInsightsErrorBoundary, _super);\r\n function AppInsightsErrorBoundary() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this.state = { hasError: false };\r\n return _this;\r\n }\r\n AppInsightsErrorBoundary.prototype.componentDidCatch = function (error, errorInfo) {\r\n this.setState({ hasError: true });\r\n this.props.appInsights.trackException({\r\n error: error,\r\n exception: error,\r\n severityLevel: SeverityLevel.Error,\r\n properties: errorInfo\r\n });\r\n };\r\n AppInsightsErrorBoundary.prototype.render = function () {\r\n if (this.state.hasError) {\r\n var onError = this.props.onError;\r\n return React.createElement(onError);\r\n }\r\n return this.props.children;\r\n };\r\n return AppInsightsErrorBoundary;\r\n}(React.Component));\r\nexport default AppInsightsErrorBoundary;\r\n//# sourceMappingURL=AppInsightsErrorBoundary.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC,gFAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 19.3.7-nightly.2507-07
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
export {};
|
|
4
8
|
//# sourceMappingURL=IReactExtensionConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IReactExtensionConfig.js","
|
|
1
|
+
{"version":3,"file":"IReactExtensionConfig.js.map","sources":["IReactExtensionConfig.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport {};\r\n//# sourceMappingURL=IReactExtensionConfig.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA"}
|
package/dist-esm/ReactPlugin.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 19.3.7-nightly.2507-07
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
1
5
|
/**
|
|
2
6
|
* ReactPlugin.ts
|
|
3
7
|
* @copyright Microsoft 2019
|
|
4
8
|
*/
|
|
5
|
-
import { __extends } from "
|
|
9
|
+
import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
|
|
6
10
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
7
11
|
import { AnalyticsPluginIdentifier, PropertiesPluginIdentifier } from "@microsoft/applicationinsights-common";
|
|
8
12
|
import { BaseTelemetryPlugin, _throwInternal, isFunction, proxyFunctions, safeGetCookieMgr, onConfigChange, objDefineAccessors } from "@microsoft/applicationinsights-core-js";
|
|
@@ -116,45 +120,20 @@ var ReactPlugin = /** @class */ (function (_super) {
|
|
|
116
120
|
});
|
|
117
121
|
return _this;
|
|
118
122
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
134
|
-
return null;
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* Add Part A fields to the event
|
|
138
|
-
* @param event The event that needs to be processed
|
|
139
|
-
*/
|
|
140
|
-
ReactPlugin.prototype.processTelemetry = function (event, itemCtx) {
|
|
141
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
142
|
-
};
|
|
143
|
-
ReactPlugin.prototype.trackMetric = function (metric, customProperties) {
|
|
144
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
145
|
-
};
|
|
146
|
-
ReactPlugin.prototype.trackPageView = function (pageView) {
|
|
147
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
148
|
-
};
|
|
149
|
-
ReactPlugin.prototype.trackEvent = function (event, customProperties) {
|
|
150
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
151
|
-
};
|
|
152
|
-
ReactPlugin.prototype.trackException = function (exception, customProperties) {
|
|
153
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
154
|
-
};
|
|
155
|
-
ReactPlugin.prototype.trackTrace = function (trace, customProperties) {
|
|
156
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
157
|
-
};
|
|
123
|
+
// Removed Stub for ReactPlugin.prototype.initialize.
|
|
124
|
+
// Removed Stub for ReactPlugin.prototype.getCookieMgr.
|
|
125
|
+
// Removed Stub for ReactPlugin.prototype.getAppInsights.
|
|
126
|
+
// Removed Stub for ReactPlugin.prototype.processTelemetry.
|
|
127
|
+
// Removed Stub for ReactPlugin.prototype.trackMetric.
|
|
128
|
+
// Removed Stub for ReactPlugin.prototype.trackPageView.
|
|
129
|
+
// Removed Stub for ReactPlugin.prototype.trackEvent.
|
|
130
|
+
// Removed Stub for ReactPlugin.prototype.trackException.
|
|
131
|
+
// Removed Stub for ReactPlugin.prototype.trackTrace.
|
|
132
|
+
// This is a workaround for an IE8 bug when using dynamicProto() with classes that don't have any
|
|
133
|
+
// non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
|
|
134
|
+
// this will be removed when ES3 support is dropped.
|
|
135
|
+
ReactPlugin.__ieDyn=1;
|
|
136
|
+
|
|
158
137
|
return ReactPlugin;
|
|
159
138
|
}(BaseTelemetryPlugin));
|
|
160
139
|
export default ReactPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactPlugin.js","sourceRoot":"","sources":["../src/ReactPlugin.ts"],"names":[],"mappings":"AAAA;;;EAGE;;AAEF,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,EACH,yBAAyB,EAC0I,0BAA0B,EAChM,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,mBAAmB,EAEnB,cAAc,EAAgC,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAmB,cAAc,EAAE,kBAAkB,EAClJ,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAK7D,IAAM,2BAA2B,GAA2C,aAAa,CAAC;IACtF,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE;CAC1C,CAAC,CAAC;AAGH;IAAyC,+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,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;OAGG;IACH,sCAAgB,GAAhB,UAAiB,KAAqB,EAAE,OAAkC;QACtE,oFAAoF;IACxF,CAAC;IAED,iCAAW,GAAX,UAAY,MAAwB,EAAE,gBAAmC;QACrE,oFAAoF;IACxF,CAAC;IAED,mCAAa,GAAb,UAAc,QAA4B;QACtC,oFAAoF;IACxF,CAAC;IAED,gCAAU,GAAV,UAAW,KAAsB,EAAE,gBAAoC;QACnE,oFAAoF;IACxF,CAAC;IAED,oCAAc,GAAd,UAAe,SAA8B,EAAE,gBAAoC;QAC/E,oFAAoF;IACxF,CAAC;IAED,gCAAU,GAAV,UAAW,KAAsB,EAAE,gBAAoC;QACnE,oFAAoF;IACxF,CAAC;IACL,kBAAC;AAAD,CAAC,AA9KD,CAAyC,mBAAmB,GA8K3D","sourcesContent":["/**\r\n* ReactPlugin.ts\r\n* @copyright Microsoft 2019\r\n*/\r\n\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport {\r\n AnalyticsPluginIdentifier,\r\n IAppInsights, IConfig, IEventTelemetry, IExceptionTelemetry, IMetricTelemetry, IPageViewTelemetry, ITraceTelemetry, ITelemetryContext as Common_ITelemetryContext, PropertiesPluginIdentifier\r\n} from \"@microsoft/applicationinsights-common\";\r\nimport {\r\n BaseTelemetryPlugin, IAppInsightsCore, IConfiguration, ICookieMgr, ICustomProperties, IPlugin, IProcessTelemetryContext,\r\n IProcessTelemetryUnloadContext, ITelemetryItem, ITelemetryPlugin, ITelemetryPluginChain, ITelemetryUnloadState, _eInternalMessageId,\r\n _throwInternal, arrForEach, eLoggingSeverity, isFunction, proxyFunctions, safeGetCookieMgr, IConfigDefaults, onConfigChange, objDefineAccessors\r\n} from \"@microsoft/applicationinsights-core-js\";\r\nimport {objDeepFreeze, objDefine} from \"@nevware21/ts-utils\";\r\n\r\nimport { History, Location, Update } from \"history\";\r\n\r\nimport { IReactExtensionConfig } from './Interfaces/IReactExtensionConfig';\r\nconst defaultReactExtensionConfig: IConfigDefaults<IReactExtensionConfig> = objDeepFreeze({\r\n history: { blkVal: true, v: undefined }\r\n});\r\nimport { PropertiesPlugin } from \"@microsoft/applicationinsights-properties-js\";\r\n\r\nexport default class ReactPlugin extends BaseTelemetryPlugin {\r\n public priority = 185;\r\n public identifier = 'ReactPlugin';\r\n public readonly context: Common_ITelemetryContext;\r\n\r\n\r\n constructor() {\r\n super();\r\n let _analyticsPlugin: IAppInsights;\r\n let _extensionConfig: IReactExtensionConfig;\r\n let _unlisten: any;\r\n let _pageViewTimer: any;\r\n let _pageViewTracked:boolean;\r\n let properties: PropertiesPlugin;\r\n\r\n\r\n dynamicProto(ReactPlugin, this, (_self, _base) => {\r\n _initDefaults();\r\n\r\n _self.initialize = (config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?:ITelemetryPluginChain) => {\r\n super.initialize(config, core, extensions, pluginChain);\r\n \r\n let thePlugin = core.getPlugin<PropertiesPlugin>(PropertiesPluginIdentifier);\r\n if (thePlugin) {\r\n properties = thePlugin.plugin;\r\n }\r\n objDefine(_self, \"context\", {\r\n g: () => properties ? properties.context : null\r\n });\r\n\r\n _self._addHook(onConfigChange(config, (details) => {\r\n let ctx = _self._getTelCtx();\r\n _extensionConfig = ctx.getExtCfg<IReactExtensionConfig>(this.identifier, defaultReactExtensionConfig);\r\n _analyticsPlugin = core.getPlugin<any>(AnalyticsPluginIdentifier)?.plugin as IAppInsights;\r\n \r\n if (isFunction(_unlisten)) {\r\n _unlisten();\r\n _unlisten = null;\r\n }\r\n if (_extensionConfig.history) {\r\n _addHistoryListener(_extensionConfig.history);\r\n if (!_pageViewTracked){\r\n const pageViewTelemetry: IPageViewTelemetry = {\r\n uri: _extensionConfig.history.location.pathname\r\n };\r\n _self.trackPageView(pageViewTelemetry);\r\n _pageViewTracked = true;\r\n }\r\n }\r\n }));\r\n };\r\n\r\n _self.getCookieMgr = (): ICookieMgr => {\r\n return safeGetCookieMgr(_self.core);\r\n };\r\n \r\n _self.getAppInsights = _getAnalytics;\r\n \r\n _self.processTelemetry = (event: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => {\r\n _self.processNext(event, itemCtx);\r\n };\r\n \r\n _self._doTeardown = (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void): void | boolean => {\r\n if (isFunction(_unlisten)) {\r\n _unlisten();\r\n }\r\n\r\n if (_pageViewTimer) {\r\n clearTimeout(_pageViewTimer);\r\n }\r\n\r\n _initDefaults();\r\n };\r\n\r\n // Proxy the analytics functions\r\n proxyFunctions(_self, _getAnalytics, [\r\n \"trackMetric\",\r\n \"trackPageView\",\r\n \"trackEvent\",\r\n \"trackException\",\r\n \"trackTrace\",\r\n ]);\r\n \r\n function _initDefaults() {\r\n _analyticsPlugin = null;\r\n _extensionConfig = null;\r\n _unlisten = null;\r\n _pageViewTimer = null;\r\n _pageViewTracked = false;\r\n properties = null;\r\n }\r\n\r\n function _getAnalytics() {\r\n if (!_analyticsPlugin) {\r\n _throwInternal(_self.diagLog(),\r\n eLoggingSeverity.CRITICAL, _eInternalMessageId.TelemetryInitializerFailed, \"Analytics plugin is not available, React plugin telemetry will not be sent: \");\r\n }\r\n\r\n return _analyticsPlugin;\r\n }\r\n\r\n function _addHistoryListener(history: History): void {\r\n const locationListener = (arg: Location | Update): void => {\r\n // v4 of the history API passes \"location\" as the first argument, while v5 passes an object that contains location and action \r\n let locn: Location = null;\r\n if (\"location\" in arg) {\r\n // Looks like v5\r\n locn = arg[\"location\"];\r\n } else {\r\n locn = arg as Location;\r\n }\r\n \r\n // Timeout to ensure any changes to the DOM made by route changes get included in pageView telemetry\r\n _pageViewTimer = setTimeout(() => {\r\n _pageViewTimer = null;\r\n const pageViewTelemetry: IPageViewTelemetry = { uri: locn.pathname };\r\n _self.trackPageView(pageViewTelemetry);\r\n }, 500);\r\n };\r\n\r\n _unlisten = history.listen(locationListener);\r\n }\r\n \r\n objDefineAccessors(_self, \"_extensionConfig\", () => _extensionConfig);\r\n });\r\n }\r\n\r\n initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?:ITelemetryPluginChain) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n }\r\n\r\n /**\r\n * Get the current cookie manager for this instance\r\n */\r\n getCookieMgr(): ICookieMgr {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n }\r\n\r\n /**\r\n * Get application insights instance.\r\n */\r\n getAppInsights(): IAppInsights {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n }\r\n\r\n /**\r\n * Add Part A fields to the event\r\n * @param event The event that needs to be processed\r\n */\r\n processTelemetry(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n }\r\n\r\n trackMetric(metric: IMetricTelemetry, customProperties: ICustomProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n }\r\n\r\n trackPageView(pageView: IPageViewTelemetry) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n }\r\n\r\n trackEvent(event: IEventTelemetry, customProperties?: ICustomProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n }\r\n\r\n trackException(exception: IExceptionTelemetry, customProperties?: ICustomProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n }\r\n\r\n trackTrace(trace: ITraceTelemetry, customProperties?: ICustomProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ReactPlugin.js.map","sources":["ReactPlugin.js"],"sourcesContent":["/**\r\n* ReactPlugin.ts\r\n* @copyright Microsoft 2019\r\n*/\r\nimport { __extends } from \"tslib\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { AnalyticsPluginIdentifier, PropertiesPluginIdentifier } from \"@microsoft/applicationinsights-common\";\r\nimport { BaseTelemetryPlugin, _throwInternal, isFunction, proxyFunctions, safeGetCookieMgr, onConfigChange, objDefineAccessors } from \"@microsoft/applicationinsights-core-js\";\r\nimport { objDeepFreeze, objDefine } from \"@nevware21/ts-utils\";\r\nvar defaultReactExtensionConfig = objDeepFreeze({\r\n history: { blkVal: true, v: undefined }\r\n});\r\nvar ReactPlugin = /** @class */ (function (_super) {\r\n __extends(ReactPlugin, _super);\r\n function ReactPlugin() {\r\n var _this = _super.call(this) || this;\r\n _this.priority = 185;\r\n _this.identifier = 'ReactPlugin';\r\n var _analyticsPlugin;\r\n var _extensionConfig;\r\n var _unlisten;\r\n var _pageViewTimer;\r\n var _pageViewTracked;\r\n var properties;\r\n dynamicProto(ReactPlugin, _this, function (_self, _base) {\r\n _initDefaults();\r\n _self.initialize = function (config, core, extensions, pluginChain) {\r\n _super.prototype.initialize.call(_this, config, core, extensions, pluginChain);\r\n var thePlugin = core.getPlugin(PropertiesPluginIdentifier);\r\n if (thePlugin) {\r\n properties = thePlugin.plugin;\r\n }\r\n objDefine(_self, \"context\", {\r\n g: function () { return properties ? properties.context : null; }\r\n });\r\n _self._addHook(onConfigChange(config, function (details) {\r\n var _a;\r\n var ctx = _self._getTelCtx();\r\n _extensionConfig = ctx.getExtCfg(_this.identifier, defaultReactExtensionConfig);\r\n _analyticsPlugin = (_a = core.getPlugin(AnalyticsPluginIdentifier)) === null || _a === void 0 ? void 0 : _a.plugin;\r\n if (isFunction(_unlisten)) {\r\n _unlisten();\r\n _unlisten = null;\r\n }\r\n if (_extensionConfig.history) {\r\n _addHistoryListener(_extensionConfig.history);\r\n if (!_pageViewTracked) {\r\n var pageViewTelemetry = {\r\n uri: _extensionConfig.history.location.pathname\r\n };\r\n _self.trackPageView(pageViewTelemetry);\r\n _pageViewTracked = true;\r\n }\r\n }\r\n }));\r\n };\r\n _self.getCookieMgr = function () {\r\n return safeGetCookieMgr(_self.core);\r\n };\r\n _self.getAppInsights = _getAnalytics;\r\n _self.processTelemetry = function (event, itemCtx) {\r\n _self.processNext(event, itemCtx);\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState, asyncCallback) {\r\n if (isFunction(_unlisten)) {\r\n _unlisten();\r\n }\r\n if (_pageViewTimer) {\r\n clearTimeout(_pageViewTimer);\r\n }\r\n _initDefaults();\r\n };\r\n // Proxy the analytics functions\r\n proxyFunctions(_self, _getAnalytics, [\r\n \"trackMetric\",\r\n \"trackPageView\",\r\n \"trackEvent\",\r\n \"trackException\",\r\n \"trackTrace\",\r\n ]);\r\n function _initDefaults() {\r\n _analyticsPlugin = null;\r\n _extensionConfig = null;\r\n _unlisten = null;\r\n _pageViewTimer = null;\r\n _pageViewTracked = false;\r\n properties = null;\r\n }\r\n function _getAnalytics() {\r\n if (!_analyticsPlugin) {\r\n _throwInternal(_self.diagLog(), 1 /* eLoggingSeverity.CRITICAL */, 64 /* _eInternalMessageId.TelemetryInitializerFailed */, \"Analytics plugin is not available, React plugin telemetry will not be sent: \");\r\n }\r\n return _analyticsPlugin;\r\n }\r\n function _addHistoryListener(history) {\r\n var locationListener = function (arg) {\r\n // v4 of the history API passes \"location\" as the first argument, while v5 passes an object that contains location and action \r\n var locn = null;\r\n if (\"location\" in arg) {\r\n // Looks like v5\r\n locn = arg[\"location\"];\r\n }\r\n else {\r\n locn = arg;\r\n }\r\n // Timeout to ensure any changes to the DOM made by route changes get included in pageView telemetry\r\n _pageViewTimer = setTimeout(function () {\r\n _pageViewTimer = null;\r\n var pageViewTelemetry = { uri: locn.pathname };\r\n _self.trackPageView(pageViewTelemetry);\r\n }, 500);\r\n };\r\n _unlisten = history.listen(locationListener);\r\n }\r\n objDefineAccessors(_self, \"_extensionConfig\", function () { return _extensionConfig; });\r\n });\r\n return _this;\r\n }\r\n ReactPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Get the current cookie manager for this instance\r\n */\r\n ReactPlugin.prototype.getCookieMgr = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Get application insights instance.\r\n */\r\n ReactPlugin.prototype.getAppInsights = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Add Part A fields to the event\r\n * @param event The event that needs to be processed\r\n */\r\n ReactPlugin.prototype.processTelemetry = function (event, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ReactPlugin.prototype.trackMetric = function (metric, customProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ReactPlugin.prototype.trackPageView = function (pageView) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ReactPlugin.prototype.trackEvent = function (event, customProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ReactPlugin.prototype.trackException = function (exception, customProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ReactPlugin.prototype.trackTrace = function (trace, customProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return ReactPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport default ReactPlugin;\r\n//# sourceMappingURL=ReactPlugin.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA,gFAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;qDAsCM,CAAC;;;;;;uBACgB;AACvB;AACA;AACA"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 19.3.7-nightly.2507-07
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
import ReactPlugin from "./ReactPlugin";
|
|
4
8
|
import withAITracking, { AITrackedComponentBase } from "./withAITracking";
|
|
5
9
|
import AppInsightsErrorBoundary from "./AppInsightsErrorBoundary";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicationinsights-react-js.js","
|
|
1
|
+
{"version":3,"file":"applicationinsights-react-js.js.map","sources":["applicationinsights-react-js.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport ReactPlugin from \"./ReactPlugin\";\r\nimport withAITracking, { AITrackedComponentBase } from \"./withAITracking\";\r\nimport AppInsightsErrorBoundary from \"./AppInsightsErrorBoundary\";\r\nimport { AppInsightsContext, useAppInsightsContext } from \"./AppInsightsContext\";\r\nimport useTrackEvent from \"./useTrackEvent\";\r\nimport useTrackMetric from \"./useTrackMetric\";\r\nexport { ReactPlugin, withAITracking, AppInsightsErrorBoundary, AppInsightsContext, useAppInsightsContext, useTrackEvent, useTrackMetric, AITrackedComponentBase };\r\n//# sourceMappingURL=applicationinsights-react-js.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 19.3.7-nightly.2507-07
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
1
5
|
import { useEffect, useRef, useState } from "react";
|
|
2
6
|
export default function useCustomEvent(reactPlugin, eventName, eventData, skipFirstRun) {
|
|
3
7
|
if (skipFirstRun === void 0) { skipFirstRun = true; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTrackEvent.js","
|
|
1
|
+
{"version":3,"file":"useTrackEvent.js.map","sources":["useTrackEvent.js"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\r\nexport default function useCustomEvent(reactPlugin, eventName, eventData, skipFirstRun) {\r\n if (skipFirstRun === void 0) { skipFirstRun = true; }\r\n var _a = useState(eventData), data = _a[0], setData = _a[1];\r\n var firstRun = useRef(skipFirstRun);\r\n var savedSkipFirstRun = useRef(skipFirstRun);\r\n useEffect(function () {\r\n if (firstRun.current) {\r\n firstRun.current = false;\r\n return;\r\n }\r\n reactPlugin.trackEvent({ name: eventName }, data);\r\n }, [reactPlugin, data, eventName]);\r\n useEffect(function () {\r\n return function () {\r\n firstRun.current = savedSkipFirstRun.current;\r\n };\r\n }, []);\r\n return setData;\r\n}\r\n//# sourceMappingURL=useTrackEvent.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 19.3.7-nightly.2507-07
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
import { __assignFn as __assign } from "@microsoft/applicationinsights-shims";
|
|
2
6
|
import { dateNow } from "@microsoft/applicationinsights-core-js";
|
|
3
7
|
import { useEffect, useRef } from "react";
|
|
4
8
|
function getEngagementTimeSeconds(trackedData) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTrackMetric.js","
|
|
1
|
+
{"version":3,"file":"useTrackMetric.js.map","sources":["useTrackMetric.js"],"sourcesContent":["import { __assign } from \"tslib\";\r\nimport { dateNow } from \"@microsoft/applicationinsights-core-js\";\r\nimport { useEffect, useRef } from \"react\";\r\nfunction getEngagementTimeSeconds(trackedData) {\r\n return ((dateNow() -\r\n trackedData.firstActiveTimestamp -\r\n trackedData.totalIdleTime -\r\n trackedData.idleCount * trackedData.idleTimeout) /\r\n 1000);\r\n}\r\nvar useComponentTracking = function (reactPlugin, componentName, customProperties) {\r\n var tracking = useRef({\r\n hookTimestamp: dateNow(),\r\n firstActiveTimestamp: 0,\r\n totalIdleTime: 0,\r\n lastActiveTimestamp: 0,\r\n idleStartTimestamp: 0,\r\n idleCount: 0,\r\n idleTimeout: 5000\r\n });\r\n var savedCallback = useRef(null);\r\n var callback = function () {\r\n var trackedData = tracking.current;\r\n if (trackedData.lastActiveTimestamp > 0 &&\r\n trackedData.idleStartTimestamp === 0 &&\r\n dateNow() - trackedData.lastActiveTimestamp >= trackedData.idleTimeout) {\r\n trackedData.idleStartTimestamp = dateNow();\r\n trackedData.idleCount++;\r\n }\r\n };\r\n var delay = 100;\r\n savedCallback.current = callback;\r\n // Set up the interval.\r\n useEffect(function () {\r\n var id = setInterval(savedCallback.current, delay);\r\n return function () {\r\n clearInterval(id);\r\n var trackedData = tracking.current;\r\n if (trackedData.hookTimestamp === 0) {\r\n throw new Error(\"useAppInsights:unload hook: hookTimestamp is not initialized.\");\r\n }\r\n if (trackedData.firstActiveTimestamp === 0) {\r\n return;\r\n }\r\n var engagementTime = getEngagementTimeSeconds(trackedData);\r\n var metricData = {\r\n average: engagementTime,\r\n name: \"React Component Engaged Time (seconds)\",\r\n sampleCount: 1\r\n };\r\n var additionalProperties = __assign({ \"Component Name\": componentName }, customProperties);\r\n reactPlugin.trackMetric(metricData, additionalProperties);\r\n };\r\n }, []);\r\n var trackActivity = function () {\r\n var trackedData = tracking.current;\r\n if (trackedData.firstActiveTimestamp === 0) {\r\n trackedData.firstActiveTimestamp = dateNow();\r\n trackedData.lastActiveTimestamp = trackedData.firstActiveTimestamp;\r\n }\r\n else {\r\n trackedData.lastActiveTimestamp = dateNow();\r\n }\r\n if (trackedData.idleStartTimestamp > 0) {\r\n var lastIdleTime = trackedData.lastActiveTimestamp - trackedData.idleStartTimestamp;\r\n trackedData.totalIdleTime += lastIdleTime;\r\n trackedData.idleStartTimestamp = 0;\r\n }\r\n };\r\n return trackActivity;\r\n};\r\nexport default useComponentTracking;\r\n//# sourceMappingURL=useTrackMetric.js.map"],"names":[],"mappings":";;;;AAAA,8EAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 19.3.7-nightly.2507-07
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import { __assignFn as __assign, __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
|
|
4
8
|
import { dateNow } from '@microsoft/applicationinsights-core-js';
|
|
5
9
|
import * as React from 'react';
|
|
6
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAITracking.js","
|
|
1
|
+
{"version":3,"file":"withAITracking.js.map","sources":["withAITracking.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __assign, __extends } from \"tslib\";\r\nimport { dateNow } from '@microsoft/applicationinsights-core-js';\r\nimport * as React from 'react';\r\n/**\r\n * Higher-order component base class to hook Application Insights tracking\r\n * in a React component's lifecycle.\r\n */\r\nvar AITrackedComponentBase = /** @class */ (function (_super) {\r\n __extends(AITrackedComponentBase, _super);\r\n function AITrackedComponentBase(props, reactPlugin, componentName) {\r\n var _this = _super.call(this, props) || this;\r\n _this._mountTimestamp = 0;\r\n _this._firstActiveTimestamp = 0;\r\n _this._idleStartTimestamp = 0;\r\n _this._lastActiveTimestamp = 0;\r\n _this._totalIdleTime = 0;\r\n _this._idleCount = 0;\r\n _this._idleTimeout = 5000;\r\n _this.trackActivity = function (e) {\r\n if (_this._firstActiveTimestamp === 0) {\r\n _this._firstActiveTimestamp = dateNow();\r\n _this._lastActiveTimestamp = _this._firstActiveTimestamp;\r\n }\r\n else {\r\n _this._lastActiveTimestamp = dateNow();\r\n }\r\n if (_this._idleStartTimestamp > 0) {\r\n var lastIdleTime = _this._lastActiveTimestamp - _this._idleStartTimestamp;\r\n _this._totalIdleTime += lastIdleTime;\r\n _this._idleStartTimestamp = 0;\r\n }\r\n };\r\n _this._reactPlugin = reactPlugin;\r\n _this._componentName = componentName;\r\n return _this;\r\n }\r\n AITrackedComponentBase.prototype.componentDidMount = function () {\r\n var _this = this;\r\n this._mountTimestamp = dateNow();\r\n this._firstActiveTimestamp = 0;\r\n this._totalIdleTime = 0;\r\n this._lastActiveTimestamp = 0;\r\n this._idleStartTimestamp = 0;\r\n this._idleCount = 0;\r\n this._intervalId = setInterval(function () {\r\n if (_this._lastActiveTimestamp > 0 && _this._idleStartTimestamp === 0 && dateNow() - _this._lastActiveTimestamp >= _this._idleTimeout) {\r\n _this._idleStartTimestamp = dateNow();\r\n _this._idleCount++;\r\n }\r\n }, 100);\r\n };\r\n AITrackedComponentBase.prototype.componentWillUnmount = function () {\r\n if (this._mountTimestamp === 0) {\r\n throw new Error('withAITracking:componentWillUnmount: mountTimestamp is not initialized.');\r\n }\r\n if (this._intervalId) {\r\n clearInterval(this._intervalId);\r\n }\r\n if (this._firstActiveTimestamp === 0) {\r\n return;\r\n }\r\n var engagementTime = this.getEngagementTimeSeconds();\r\n var metricData = {\r\n average: engagementTime,\r\n name: 'React Component Engaged Time (seconds)',\r\n sampleCount: 1\r\n };\r\n var additionalProperties = { 'Component Name': this._componentName };\r\n this._reactPlugin.trackMetric(metricData, additionalProperties);\r\n };\r\n AITrackedComponentBase.prototype.getEngagementTimeSeconds = function () {\r\n return (dateNow() - this._firstActiveTimestamp - this._totalIdleTime - this._idleCount * this._idleTimeout) / 1000;\r\n };\r\n return AITrackedComponentBase;\r\n}(React.Component));\r\nexport { AITrackedComponentBase };\r\n/**\r\n * Higher-order component function to hook Application Insights tracking\r\n * in a React component's lifecycle.\r\n *\r\n * @param reactPlugin ReactPlugin instance\r\n * @param Component the React component to be instrumented\r\n * @param componentName (optional) component name\r\n * @param className (optional) className of the HOC div\r\n */\r\nexport default function withAITracking(reactPlugin, Component, componentName, className) {\r\n if (componentName === undefined || componentName === null || typeof componentName !== 'string') {\r\n componentName = Component.prototype &&\r\n Component.prototype.constructor &&\r\n Component.prototype.constructor.name ||\r\n 'Unknown';\r\n }\r\n if (className === undefined || className === null || typeof className !== 'string') {\r\n className = '';\r\n }\r\n return /** @class */ (function (_super) {\r\n __extends(class_1, _super);\r\n function class_1(props) {\r\n return _super.call(this, props, reactPlugin, componentName) || this;\r\n }\r\n class_1.prototype.render = function () {\r\n return (React.createElement(\"div\", { onKeyDown: this.trackActivity, onMouseMove: this.trackActivity, onScroll: this.trackActivity, onMouseDown: this.trackActivity, onTouchStart: this.trackActivity, onTouchMove: this.trackActivity, className: className },\r\n React.createElement(Component, __assign({}, this.props))));\r\n };\r\n return class_1;\r\n }(AITrackedComponentBase));\r\n}\r\n//# sourceMappingURL=withAITracking.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC,wGAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.52.8"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|