@microsoft/applicationinsights-react-js 3.2.5-nightly.2204-03 → 3.2.6

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights react plugin, 3.2.5-nightly.2204-03
2
+ * Microsoft Application Insights react plugin, 3.2.6
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  *
@@ -75,7 +75,8 @@ export declare interface IReactExtensionConfig {
75
75
  export declare class ReactPlugin extends BaseTelemetryPlugin {
76
76
  priority: number;
77
77
  identifier: string;
78
- constructor();
78
+ private _analyticsPlugin;
79
+ private _extensionConfig;
79
80
  initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
80
81
  /**
81
82
  * Get the current cookie manager for this instance
@@ -93,15 +94,20 @@ export declare class ReactPlugin extends BaseTelemetryPlugin {
93
94
  trackMetric(metric: IMetricTelemetry, customProperties: ICustomProperties): void;
94
95
  trackPageView(pageView: IPageViewTelemetry): void;
95
96
  trackEvent(event: IEventTelemetry, customProperties?: ICustomProperties): void;
96
- trackException(exception: IExceptionTelemetry, customProperties?: ICustomProperties): void;
97
- trackTrace(trace: ITraceTelemetry, customProperties?: ICustomProperties): void;
97
+ trackException(exception: IExceptionTelemetry, customProperties?: {
98
+ [key: string]: any;
99
+ }): void;
100
+ trackTrace(trace: ITraceTelemetry, customProperties?: {
101
+ [key: string]: any;
102
+ }): void;
103
+ private addHistoryListener;
98
104
  }
99
105
 
100
106
  export declare const useAppInsightsContext: () => ReactPlugin;
101
107
 
102
108
  export declare function useTrackEvent<T>(reactPlugin: ReactPlugin, eventName: string, eventData: T, skipFirstRun?: boolean): AIReactCustomEvent<T>;
103
109
 
104
- export declare const useTrackMetric: (reactPlugin: ReactPlugin, componentName: string, customProperties?: ICustomProperties) => () => void;
110
+ export declare const useTrackMetric: (reactPlugin: ReactPlugin, componentName: string) => () => void;
105
111
 
106
112
  /**
107
113
  * Higher-order component function to hook Application Insights tracking
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 3.2.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - React Plugin, 3.2.6
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  import { createContext, useContext } from "react";
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 3.2.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - React Plugin, 3.2.6
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 3.2.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - React Plugin, 3.2.6
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 3.2.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - React Plugin, 3.2.6
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -7,109 +7,115 @@
7
7
  * @copyright Microsoft 2019
8
8
  */
9
9
  import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
10
- import dynamicProto from "@microsoft/dynamicproto-js";
11
- import { BaseTelemetryPlugin, _InternalMessageId, LoggingSeverity, safeGetCookieMgr, arrForEach, proxyFunctions, isFunction, objDefineAccessors } from "@microsoft/applicationinsights-core-js";
10
+ import { BaseTelemetryPlugin, _InternalMessageId, LoggingSeverity, safeGetCookieMgr, arrForEach } from "@microsoft/applicationinsights-core-js";
12
11
  var ReactPlugin = /** @class */ (function (_super) {
13
12
  __extends(ReactPlugin, _super);
14
13
  function ReactPlugin() {
15
- var _this = _super.call(this) || this;
14
+ var _this = _super !== null && _super.apply(this, arguments) || this;
16
15
  _this.priority = 185;
17
16
  _this.identifier = 'ReactPlugin';
18
- var _analyticsPlugin;
19
- var _extensionConfig;
20
- var _unlisten;
21
- var _pageViewTimer;
22
- dynamicProto(ReactPlugin, _this, function (_self, _base) {
23
- _initDefaults();
24
- _self.initialize = function (config, core, extensions, pluginChain) {
25
- _super.prototype.initialize.call(_this, config, core, extensions, pluginChain);
26
- _extensionConfig =
27
- config.extensionConfig && config.extensionConfig[_self.identifier]
28
- ? config.extensionConfig[_self.identifier]
29
- : { history: null };
30
- arrForEach(extensions, function (ext) {
31
- var identifier = ext.identifier;
32
- if (identifier === 'ApplicationInsightsAnalytics') {
33
- _analyticsPlugin = ext;
34
- }
35
- });
36
- if (_extensionConfig.history) {
37
- _addHistoryListener(_extensionConfig.history);
38
- var pageViewTelemetry = {
39
- uri: _extensionConfig.history.location.pathname
40
- };
41
- _self.trackPageView(pageViewTelemetry);
42
- }
43
- };
44
- _self.getCookieMgr = function () {
45
- return safeGetCookieMgr(_self.core);
46
- };
47
- _self.getAppInsights = _getAnalytics;
48
- _self.processTelemetry = function (event, itemCtx) {
49
- _self.processNext(event, itemCtx);
50
- };
51
- _self._doTeardown = function (unloadCtx, unloadState, asyncCallback) {
52
- if (isFunction(_unlisten)) {
53
- _unlisten();
54
- }
55
- if (_pageViewTimer) {
56
- clearTimeout(_pageViewTimer);
57
- }
58
- _initDefaults();
59
- };
60
- // Proxy the analytics functions
61
- proxyFunctions(_self, _getAnalytics, [
62
- "trackMetric",
63
- "trackPageView",
64
- "trackEvent",
65
- "trackException",
66
- "trackTrace",
67
- ]);
68
- function _initDefaults() {
69
- _analyticsPlugin = null;
70
- _extensionConfig = null;
71
- _unlisten = null;
72
- _pageViewTimer = null;
17
+ return _this;
18
+ }
19
+ ReactPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
20
+ var _this = this;
21
+ _super.prototype.initialize.call(this, config, core, extensions, pluginChain);
22
+ this._extensionConfig =
23
+ config.extensionConfig && config.extensionConfig[this.identifier]
24
+ ? config.extensionConfig[this.identifier]
25
+ : { history: null };
26
+ arrForEach(extensions, function (ext) {
27
+ var identifier = ext.identifier;
28
+ if (identifier === 'ApplicationInsightsAnalytics') {
29
+ _this._analyticsPlugin = ext;
73
30
  }
74
- function _getAnalytics() {
75
- if (!_analyticsPlugin) {
76
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, React plugin telemetry will not be sent: ");
77
- }
78
- return _analyticsPlugin;
31
+ });
32
+ if (this._extensionConfig.history) {
33
+ this.addHistoryListener(this._extensionConfig.history);
34
+ var pageViewTelemetry = {
35
+ uri: this._extensionConfig.history.location.pathname
36
+ };
37
+ this.trackPageView(pageViewTelemetry);
38
+ }
39
+ };
40
+ /**
41
+ * Get the current cookie manager for this instance
42
+ */
43
+ ReactPlugin.prototype.getCookieMgr = function () {
44
+ return safeGetCookieMgr(this.core);
45
+ };
46
+ /**
47
+ * Get application insights instance.
48
+ */
49
+ ReactPlugin.prototype.getAppInsights = function () {
50
+ return this._analyticsPlugin;
51
+ };
52
+ /**
53
+ * Add Part A fields to the event
54
+ * @param event The event that needs to be processed
55
+ */
56
+ ReactPlugin.prototype.processTelemetry = function (event, itemCtx) {
57
+ this.processNext(event, itemCtx);
58
+ };
59
+ ReactPlugin.prototype.trackMetric = function (metric, customProperties) {
60
+ if (this._analyticsPlugin) {
61
+ this._analyticsPlugin.trackMetric(metric, customProperties);
62
+ }
63
+ else {
64
+ this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, React plugin telemetry will not be sent: ");
65
+ }
66
+ };
67
+ ReactPlugin.prototype.trackPageView = function (pageView) {
68
+ if (this._analyticsPlugin) {
69
+ this._analyticsPlugin.trackPageView(pageView);
70
+ }
71
+ else {
72
+ this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, React plugin telemetry will not be sent: ");
73
+ }
74
+ };
75
+ ReactPlugin.prototype.trackEvent = function (event, customProperties) {
76
+ if (this._analyticsPlugin) {
77
+ this._analyticsPlugin.trackEvent(event, customProperties);
78
+ }
79
+ else {
80
+ this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, React plugin telemetry will not be sent: ");
81
+ }
82
+ };
83
+ ReactPlugin.prototype.trackException = function (exception, customProperties) {
84
+ if (this._analyticsPlugin) {
85
+ this._analyticsPlugin.trackException(exception, customProperties);
86
+ }
87
+ else {
88
+ this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, React plugin telemetry will not be sent: ");
89
+ }
90
+ };
91
+ ReactPlugin.prototype.trackTrace = function (trace, customProperties) {
92
+ if (this._analyticsPlugin) {
93
+ this._analyticsPlugin.trackTrace(trace, customProperties);
94
+ }
95
+ else {
96
+ this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, React plugin telemetry will not be sent: ");
97
+ }
98
+ };
99
+ ReactPlugin.prototype.addHistoryListener = function (history) {
100
+ var _this = this;
101
+ var locationListener = function (arg) {
102
+ // v4 of the history API passes "location" as the first argument, while v5 passes an object that contains location and action
103
+ var locn = null;
104
+ if ("location" in arg) {
105
+ // Looks like v5
106
+ locn = arg["location"];
79
107
  }
80
- function _addHistoryListener(history) {
81
- var locationListener = function (arg) {
82
- // v4 of the history API passes "location" as the first argument, while v5 passes an object that contains location and action
83
- var locn = null;
84
- if ("location" in arg) {
85
- // Looks like v5
86
- locn = arg["location"];
87
- }
88
- else {
89
- locn = arg;
90
- }
91
- // Timeout to ensure any changes to the DOM made by route changes get included in pageView telemetry
92
- _pageViewTimer = setTimeout(function () {
93
- _pageViewTimer = null;
94
- var pageViewTelemetry = { uri: locn.pathname };
95
- _self.trackPageView(pageViewTelemetry);
96
- }, 500);
97
- };
98
- _unlisten = history.listen(locationListener);
108
+ else {
109
+ locn = arg;
99
110
  }
100
- objDefineAccessors(_self, "_extensionConfig", function () { return _extensionConfig; });
101
- });
102
- return _this;
103
- }
104
- // Removed Stub for ReactPlugin.prototype.initialize.
105
- // Removed Stub for ReactPlugin.prototype.getCookieMgr.
106
- // Removed Stub for ReactPlugin.prototype.getAppInsights.
107
- // Removed Stub for ReactPlugin.prototype.processTelemetry.
108
- // Removed Stub for ReactPlugin.prototype.trackMetric.
109
- // Removed Stub for ReactPlugin.prototype.trackPageView.
110
- // Removed Stub for ReactPlugin.prototype.trackEvent.
111
- // Removed Stub for ReactPlugin.prototype.trackException.
112
- // Removed Stub for ReactPlugin.prototype.trackTrace.
111
+ // Timeout to ensure any changes to the DOM made by route changes get included in pageView telemetry
112
+ setTimeout(function () {
113
+ var pageViewTelemetry = { uri: locn.pathname };
114
+ _this.trackPageView(pageViewTelemetry);
115
+ }, 500);
116
+ };
117
+ history.listen(locationListener);
118
+ };
113
119
  return ReactPlugin;
114
120
  }(BaseTelemetryPlugin));
115
121
  export default ReactPlugin;
@@ -1 +1 @@
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 { BaseTelemetryPlugin, _InternalMessageId, LoggingSeverity, safeGetCookieMgr, arrForEach, proxyFunctions, isFunction, objDefineAccessors } from \"@microsoft/applicationinsights-core-js\";\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 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 _extensionConfig =\r\n config.extensionConfig && config.extensionConfig[_self.identifier]\r\n ? config.extensionConfig[_self.identifier]\r\n : { history: null };\r\n arrForEach(extensions, function (ext) {\r\n var identifier = ext.identifier;\r\n if (identifier === 'ApplicationInsightsAnalytics') {\r\n _analyticsPlugin = ext;\r\n }\r\n });\r\n if (_extensionConfig.history) {\r\n _addHistoryListener(_extensionConfig.history);\r\n var pageViewTelemetry = {\r\n uri: _extensionConfig.history.location.pathname\r\n };\r\n _self.trackPageView(pageViewTelemetry);\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 }\r\n function _getAnalytics() {\r\n if (!_analyticsPlugin) {\r\n _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.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;;;;;;;;qDAsCM;AACN;AACA;AACA;AACA"}
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 { BaseTelemetryPlugin, _InternalMessageId, LoggingSeverity, safeGetCookieMgr, arrForEach } from \"@microsoft/applicationinsights-core-js\";\r\nvar ReactPlugin = /** @class */ (function (_super) {\r\n __extends(ReactPlugin, _super);\r\n function ReactPlugin() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this.priority = 185;\r\n _this.identifier = 'ReactPlugin';\r\n return _this;\r\n }\r\n ReactPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {\r\n var _this = this;\r\n _super.prototype.initialize.call(this, config, core, extensions, pluginChain);\r\n this._extensionConfig =\r\n config.extensionConfig && config.extensionConfig[this.identifier]\r\n ? config.extensionConfig[this.identifier]\r\n : { history: null };\r\n arrForEach(extensions, function (ext) {\r\n var identifier = ext.identifier;\r\n if (identifier === 'ApplicationInsightsAnalytics') {\r\n _this._analyticsPlugin = ext;\r\n }\r\n });\r\n if (this._extensionConfig.history) {\r\n this.addHistoryListener(this._extensionConfig.history);\r\n var pageViewTelemetry = {\r\n uri: this._extensionConfig.history.location.pathname\r\n };\r\n this.trackPageView(pageViewTelemetry);\r\n }\r\n };\r\n /**\r\n * Get the current cookie manager for this instance\r\n */\r\n ReactPlugin.prototype.getCookieMgr = function () {\r\n return safeGetCookieMgr(this.core);\r\n };\r\n /**\r\n * Get application insights instance.\r\n */\r\n ReactPlugin.prototype.getAppInsights = function () {\r\n return this._analyticsPlugin;\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 this.processNext(event, itemCtx);\r\n };\r\n ReactPlugin.prototype.trackMetric = function (metric, customProperties) {\r\n if (this._analyticsPlugin) {\r\n this._analyticsPlugin.trackMetric(metric, customProperties);\r\n }\r\n else {\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, \"Analytics plugin is not available, React plugin telemetry will not be sent: \");\r\n }\r\n };\r\n ReactPlugin.prototype.trackPageView = function (pageView) {\r\n if (this._analyticsPlugin) {\r\n this._analyticsPlugin.trackPageView(pageView);\r\n }\r\n else {\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, \"Analytics plugin is not available, React plugin telemetry will not be sent: \");\r\n }\r\n };\r\n ReactPlugin.prototype.trackEvent = function (event, customProperties) {\r\n if (this._analyticsPlugin) {\r\n this._analyticsPlugin.trackEvent(event, customProperties);\r\n }\r\n else {\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, \"Analytics plugin is not available, React plugin telemetry will not be sent: \");\r\n }\r\n };\r\n ReactPlugin.prototype.trackException = function (exception, customProperties) {\r\n if (this._analyticsPlugin) {\r\n this._analyticsPlugin.trackException(exception, customProperties);\r\n }\r\n else {\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, \"Analytics plugin is not available, React plugin telemetry will not be sent: \");\r\n }\r\n };\r\n ReactPlugin.prototype.trackTrace = function (trace, customProperties) {\r\n if (this._analyticsPlugin) {\r\n this._analyticsPlugin.trackTrace(trace, customProperties);\r\n }\r\n else {\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, \"Analytics plugin is not available, React plugin telemetry will not be sent: \");\r\n }\r\n };\r\n ReactPlugin.prototype.addHistoryListener = function (history) {\r\n var _this = this;\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 setTimeout(function () {\r\n var pageViewTelemetry = { uri: locn.pathname };\r\n _this.trackPageView(pageViewTelemetry);\r\n }, 500);\r\n };\r\n history.listen(locationListener);\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"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 3.2.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - React Plugin, 3.2.6
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 3.2.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - React Plugin, 3.2.6
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -1,8 +1,7 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 3.2.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - React Plugin, 3.2.6
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
- import { __assignFn as __assign } from "@microsoft/applicationinsights-shims";
6
5
  import { useEffect, useRef } from "react";
7
6
  import { dateNow } from "@microsoft/applicationinsights-core-js";
8
7
  function getEngagementTimeSeconds(trackedData) {
@@ -12,7 +11,7 @@ function getEngagementTimeSeconds(trackedData) {
12
11
  trackedData.idleCount * trackedData.idleTimeout) /
13
12
  1000);
14
13
  }
15
- var useComponentTracking = function (reactPlugin, componentName, customProperties) {
14
+ var useComponentTracking = function (reactPlugin, componentName) {
16
15
  var tracking = useRef({
17
16
  hookTimestamp: dateNow(),
18
17
  firstActiveTimestamp: 0,
@@ -52,7 +51,7 @@ var useComponentTracking = function (reactPlugin, componentName, customPropertie
52
51
  name: "React Component Engaged Time (seconds)",
53
52
  sampleCount: 1
54
53
  };
55
- var additionalProperties = __assign({ "Component Name": componentName }, customProperties);
54
+ var additionalProperties = { "Component Name": componentName };
56
55
  reactPlugin.trackMetric(metricData, additionalProperties);
57
56
  };
58
57
  }, []);
@@ -1 +1 @@
1
- {"version":3,"file":"useTrackMetric.js.map","sources":["useTrackMetric.js"],"sourcesContent":["import { __assign } from \"tslib\";\r\nimport { useEffect, useRef } from \"react\";\r\nimport { dateNow } from \"@microsoft/applicationinsights-core-js\";\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();\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
+ {"version":3,"file":"useTrackMetric.js.map","sources":["useTrackMetric.js"],"sourcesContent":["import { useEffect, useRef } from \"react\";\r\nimport { dateNow } from \"@microsoft/applicationinsights-core-js\";\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) {\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();\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 = { \"Component Name\": componentName };\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;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,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 3.2.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - React Plugin, 3.2.6
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,74 +1,71 @@
1
- {
2
- "name": "@microsoft/applicationinsights-react-js",
3
- "version": "3.2.5-nightly.2204-03",
4
- "description": "Microsoft Application Insights React plugin",
5
- "main": "dist/applicationinsights-react-js.js",
6
- "module": "dist-esm/applicationinsights-react-js.js",
7
- "types": "types/applicationinsights-react-js.d.ts",
8
- "sideEffects": false,
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/microsoft/ApplicationInsights-JS/tree/master/extensions/applicationinsights-react-js"
12
- },
13
- "scripts": {
14
- "build": "npm run build:esm && npm run build:package && npm run dtsgen",
15
- "build:esm": "tsc -p tsconfig.json",
16
- "build:package": "rollup -c",
17
- "rebuild": "npm run build",
18
- "testx": "grunt reacttests",
19
- "test": "jest --config test/jestconfig.json",
20
- "test-watch": "jest --config test/jestconfig.json --watch",
21
- "lint": "tslint -p tsconfig.json",
22
- "dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"Microsoft Application Insights react plugin\""
23
- },
24
- "devDependencies": {
25
- "@microsoft/ai-test-framework": "0.0.1",
26
- "@microsoft/applicationinsights-rollup-es3": "1.1.3",
27
- "@microsoft/api-extractor": "^7.18.1",
28
- "@testing-library/dom": "^7.29.6",
29
- "@testing-library/jest-dom": "^5.11.9",
30
- "@testing-library/react": "^11.2.5",
31
- "@testing-library/user-event": "^12.8.1",
32
- "@types/cheerio": "0.22.13",
33
- "@types/history": "^4.7.9",
34
- "@types/jest": "^27.0.2",
35
- "@types/node": "11.13.2",
36
- "@types/prop-types": "^15.7.3",
37
- "@types/react": "^16.9.11",
38
- "@types/react-dom": "^16.9.4",
39
- "csstype": "~2.6.7",
40
- "grunt": "^1.4.1",
41
- "grunt-cli": "^1.4.3",
42
- "jest": "^27.3.1",
43
- "react": "^17.0.2",
44
- "react-dom": "^17.0.2",
45
- "globby": "^11.0.0",
46
- "magic-string": "^0.25.7",
47
- "@rollup/plugin-commonjs": "^18.0.0",
48
- "@rollup/plugin-node-resolve": "^11.2.1",
49
- "@rollup/plugin-replace": "^2.3.3",
50
- "rollup-plugin-cleanup": "^3.2.1",
51
- "rollup-plugin-peer-deps-external": "^2.2.4",
52
- "rollup": "^2.32.0",
53
- "ts-jest": "^27.0.7",
54
- "typescript": "^4.3.4",
55
- "tslib": "^2.0.0",
56
- "uglify-js": "^3.11.0",
57
- "history": "^5.1.0"
58
- },
59
- "dependencies": {
60
- "@microsoft/applicationinsights-shims": "2.0.1",
61
- "@microsoft/applicationinsights-core-js": "2.7.5-nightly.2204-03",
62
- "@microsoft/applicationinsights-common": "2.7.5-nightly.2204-03",
63
- "@microsoft/dynamicproto-js": "^1.1.4"
64
- },
65
- "peerDependencies": {
66
- "tslib": "*",
67
- "react": "^17.0.1",
68
- "history": ">= 4.10.1"
69
- },
70
- "license": "MIT",
71
- "publishConfig": {
72
- "tag": "nightly"
73
- }
74
- }
1
+ {
2
+ "name": "@microsoft/applicationinsights-react-js",
3
+ "version": "3.2.6",
4
+ "description": "Microsoft Application Insights React plugin",
5
+ "main": "dist/applicationinsights-react-js.js",
6
+ "module": "dist-esm/applicationinsights-react-js.js",
7
+ "types": "types/applicationinsights-react-js.d.ts",
8
+ "sideEffects": false,
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/microsoft/ApplicationInsights-JS/tree/master/extensions/applicationinsights-react-js"
12
+ },
13
+ "scripts": {
14
+ "build": "npm run build:esm && npm run build:package && npm run dtsgen",
15
+ "build:esm": "tsc -p tsconfig.json",
16
+ "build:package": "rollup -c",
17
+ "rebuild": "npm run build",
18
+ "testx": "grunt reacttests",
19
+ "test": "jest --config test/jestconfig.json",
20
+ "test-watch": "jest --config test/jestconfig.json --watch",
21
+ "lint": "tslint -p tsconfig.json",
22
+ "dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"Microsoft Application Insights react plugin\""
23
+ },
24
+ "devDependencies": {
25
+ "@microsoft/ai-test-framework": "0.0.1",
26
+ "@microsoft/applicationinsights-rollup-es3": "1.1.3",
27
+ "@microsoft/api-extractor": "^7.18.1",
28
+ "@testing-library/dom": "^7.29.6",
29
+ "@testing-library/jest-dom": "^5.11.9",
30
+ "@testing-library/react": "^11.2.5",
31
+ "@testing-library/user-event": "^12.8.1",
32
+ "@types/cheerio": "0.22.13",
33
+ "@types/history": "^4.7.9",
34
+ "@types/jest": "^27.0.2",
35
+ "@types/node": "11.13.2",
36
+ "@types/prop-types": "^15.7.3",
37
+ "@types/react": "^16.9.11",
38
+ "@types/react-dom": "^16.9.4",
39
+ "csstype": "~2.6.7",
40
+ "grunt": "^1.4.1",
41
+ "grunt-cli": "^1.4.3",
42
+ "jest": "^27.3.1",
43
+ "react": "^17.0.2",
44
+ "react-dom": "^17.0.2",
45
+ "globby": "^11.0.0",
46
+ "magic-string": "^0.25.7",
47
+ "@rollup/plugin-commonjs": "^18.0.0",
48
+ "@rollup/plugin-node-resolve": "^11.2.1",
49
+ "@rollup/plugin-replace": "^2.3.3",
50
+ "rollup-plugin-cleanup": "3.2.1",
51
+ "rollup-plugin-peer-deps-external": "^2.2.4",
52
+ "rollup": "^2.32.0",
53
+ "ts-jest": "^27.0.7",
54
+ "typescript": "^4.3.4",
55
+ "tslib": "^2.0.0",
56
+ "uglify-js": "^3.11.0",
57
+ "history": "^5.1.0"
58
+ },
59
+ "dependencies": {
60
+ "@microsoft/applicationinsights-shims": "2.0.1",
61
+ "@microsoft/applicationinsights-core-js": "2.7.6",
62
+ "@microsoft/applicationinsights-common": "2.7.6",
63
+ "@microsoft/dynamicproto-js": "^1.1.6"
64
+ },
65
+ "peerDependencies": {
66
+ "tslib": "*",
67
+ "react": "^17.0.1",
68
+ "history": ">= 4.10.1"
69
+ },
70
+ "license": "MIT"
71
+ }