@microsoft/applicationinsights-react-js 19.3.9-nightly.2604-02 → 19.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/browser/applicationinsights-react-js.js +19 -25
  2. package/browser/applicationinsights-react-js.js.map +1 -1
  3. package/browser/applicationinsights-react-js.min.js +2 -2
  4. package/browser/applicationinsights-react-js.min.js.map +1 -1
  5. package/dist/applicationinsights-react-js.api.json +18 -39
  6. package/dist/applicationinsights-react-js.api.md +11 -14
  7. package/dist/applicationinsights-react-js.d.ts +20 -21
  8. package/dist/applicationinsights-react-js.js +19 -25
  9. package/dist/applicationinsights-react-js.js.map +1 -1
  10. package/dist/applicationinsights-react-js.min.js +2 -2
  11. package/dist/applicationinsights-react-js.min.js.map +1 -1
  12. package/dist/applicationinsights-react-js.rollup.d.ts +20 -21
  13. package/dist-esm/AppInsightsContext.js +1 -1
  14. package/dist-esm/AppInsightsErrorBoundary.js +13 -8
  15. package/dist-esm/AppInsightsErrorBoundary.js.map +1 -1
  16. package/dist-esm/Interfaces/IReactExtensionConfig.js +1 -1
  17. package/dist-esm/ReactPlugin.js +7 -6
  18. package/dist-esm/ReactPlugin.js.map +1 -1
  19. package/dist-esm/applicationinsights-react-js.js +1 -1
  20. package/dist-esm/useTrackEvent.js +1 -1
  21. package/dist-esm/useTrackMetric.js +1 -1
  22. package/dist-esm/withAITracking.js +5 -5
  23. package/dist-esm/withAITracking.js.map +1 -1
  24. package/package.json +79 -83
  25. package/src/AppInsightsErrorBoundary.tsx +17 -8
  26. package/src/ReactPlugin.ts +13 -13
  27. package/src/withAITracking.tsx +5 -5
  28. package/types/AppInsightsErrorBoundary.d.ts +5 -5
  29. package/types/ReactPlugin.d.ts +4 -5
  30. package/types/withAITracking.d.ts +4 -4
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights react plugin, 19.3.9-nightly.2604-02
2
+ * Microsoft Application Insights react plugin, 19.4.0
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -17,22 +17,21 @@ import { BaseTelemetryPlugin } from '@microsoft/applicationinsights-core-js';
17
17
  import { Context } from 'react';
18
18
  import { Dispatch } from 'react';
19
19
  import { History as History_2 } from 'history';
20
- import { IAppInsights } from '@microsoft/applicationinsights-common';
20
+ import { IAppInsights } from '@microsoft/applicationinsights-core-js';
21
21
  import { IAppInsightsCore } from '@microsoft/applicationinsights-core-js';
22
- import { IConfig } from '@microsoft/applicationinsights-common';
23
22
  import { IConfiguration } from '@microsoft/applicationinsights-core-js';
24
23
  import { ICookieMgr } from '@microsoft/applicationinsights-core-js';
25
24
  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';
25
+ import { IEventTelemetry } from '@microsoft/applicationinsights-core-js';
26
+ import { IExceptionTelemetry } from '@microsoft/applicationinsights-core-js';
27
+ import { IMetricTelemetry } from '@microsoft/applicationinsights-core-js';
28
+ import { IPageViewTelemetry } from '@microsoft/applicationinsights-core-js';
30
29
  import { IPlugin } from '@microsoft/applicationinsights-core-js';
31
30
  import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
32
- import { ITelemetryContext } from '@microsoft/applicationinsights-common';
31
+ import { ITelemetryContext } from '@microsoft/applicationinsights-core-js';
33
32
  import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
34
33
  import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js';
35
- import { ITraceTelemetry } from '@microsoft/applicationinsights-common';
34
+ import { ITraceTelemetry } from '@microsoft/applicationinsights-core-js';
36
35
  import * as React_2 from 'react';
37
36
  import { default as React_3 } from 'react';
38
37
  import { SetStateAction } from 'react';
@@ -64,11 +63,9 @@ export declare abstract class AITrackedComponentBase<P> extends React_2.Componen
64
63
  export declare const AppInsightsContext: AppInsightsReactContext;
65
64
 
66
65
  export declare class AppInsightsErrorBoundary extends React_3.Component<IAppInsightsErrorBoundaryProps, IAppInsightsErrorBoundaryState> {
67
- state: {
68
- hasError: boolean;
69
- };
66
+ state: IAppInsightsErrorBoundaryState;
70
67
  componentDidCatch(error: Error, errorInfo: React_3.ErrorInfo): void;
71
- render(): React_3.ReactElement<unknown, string | React_3.JSXElementConstructor<any>>;
68
+ render(): React_3.ReactNode;
72
69
  }
73
70
 
74
71
  declare type AppInsightsReactContext = Context<ReactPlugin>;
@@ -76,11 +73,13 @@ declare type AppInsightsReactContext = Context<ReactPlugin>;
76
73
  declare interface IAppInsightsErrorBoundaryProps {
77
74
  appInsights: ReactPlugin;
78
75
  onError: React_3.ComponentType<any>;
79
- children: React_3.ReactElement;
76
+ children: React_3.ReactNode;
80
77
  }
81
78
 
82
79
  declare interface IAppInsightsErrorBoundaryState {
83
80
  hasError: boolean;
81
+ error: Error | null;
82
+ errorInfo: React_3.ErrorInfo | null;
84
83
  }
85
84
 
86
85
  /**
@@ -101,7 +100,7 @@ export declare class ReactPlugin extends BaseTelemetryPlugin {
101
100
  identifier: string;
102
101
  readonly context: ITelemetryContext;
103
102
  constructor();
104
- initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
103
+ initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
105
104
  /**
106
105
  * Get the current cookie manager for this instance
107
106
  */
@@ -112,9 +111,9 @@ export declare class ReactPlugin extends BaseTelemetryPlugin {
112
111
  getAppInsights(): IAppInsights;
113
112
  /**
114
113
  * Add Part A fields to the event
115
- * @param event The event that needs to be processed
114
+ * @param env The event that needs to be processed
116
115
  */
117
- processTelemetry(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
116
+ processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
118
117
  trackMetric(metric: IMetricTelemetry, customProperties: ICustomProperties): void;
119
118
  trackPageView(pageView: IPageViewTelemetry): void;
120
119
  trackEvent(event: IEventTelemetry, customProperties?: ICustomProperties): void;
@@ -132,10 +131,10 @@ export declare const useTrackMetric: (reactPlugin: ReactPlugin, componentName: s
132
131
  * Higher-order component function to hook Application Insights tracking
133
132
  * in a React component's lifecycle.
134
133
  *
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
134
+ * @param reactPlugin - ReactPlugin instance
135
+ * @param Component - the React component to be instrumented
136
+ * @param componentName - (optional) component name
137
+ * @param className - (optional) className of the HOC div
139
138
  */
140
139
  export declare function withAITracking<P>(reactPlugin: ReactPlugin, Component: React_2.ComponentType<P>, componentName?: string, className?: string): React_2.ComponentClass<P>;
141
140
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 19.3.9-nightly.2604-02
2
+ * Application Insights JavaScript SDK - React Plugin, 19.4.0
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  import { createContext, useContext } from "react";
@@ -1,21 +1,25 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 19.3.9-nightly.2604-02
2
+ * Application Insights JavaScript SDK - React Plugin, 19.4.0
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
6
6
 
7
7
  import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
8
8
  import React from "react";
9
- import { SeverityLevel } from "@microsoft/applicationinsights-common";
9
+ import { SeverityLevel } from "@microsoft/applicationinsights-core-js";
10
10
  var AppInsightsErrorBoundary = /** @class */ (function (_super) {
11
11
  __extends(AppInsightsErrorBoundary, _super);
12
12
  function AppInsightsErrorBoundary() {
13
13
  var _this = _super !== null && _super.apply(this, arguments) || this;
14
- _this.state = { hasError: false };
14
+ _this.state = {
15
+ hasError: false,
16
+ error: null,
17
+ errorInfo: null,
18
+ };
15
19
  return _this;
16
20
  }
17
21
  AppInsightsErrorBoundary.prototype.componentDidCatch = function (error, errorInfo) {
18
- this.setState({ hasError: true });
22
+ this.setState({ hasError: true, error: error, errorInfo: errorInfo });
19
23
  this.props.appInsights.trackException({
20
24
  error: error,
21
25
  exception: error,
@@ -24,11 +28,12 @@ var AppInsightsErrorBoundary = /** @class */ (function (_super) {
24
28
  });
25
29
  };
26
30
  AppInsightsErrorBoundary.prototype.render = function () {
27
- if (this.state.hasError) {
28
- var onError = this.props.onError;
29
- return React.createElement(onError);
31
+ var _a = this.state, hasError = _a.hasError, error = _a.error, errorInfo = _a.errorInfo;
32
+ var _b = this.props, onError = _b.onError, children = _b.children;
33
+ if (hasError) {
34
+ return React.createElement(onError, { error: error, errorInfo: errorInfo });
30
35
  }
31
- return this.props.children;
36
+ return children;
32
37
  };
33
38
  return AppInsightsErrorBoundary;
34
39
  }(React.Component));
@@ -1 +1 @@
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
+ {"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-core-js\";\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 = {\r\n hasError: false,\r\n error: null,\r\n errorInfo: null,\r\n };\r\n return _this;\r\n }\r\n AppInsightsErrorBoundary.prototype.componentDidCatch = function (error, errorInfo) {\r\n this.setState({ hasError: true, error: error, errorInfo: errorInfo });\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 var _a = this.state, hasError = _a.hasError, error = _a.error, errorInfo = _a.errorInfo;\r\n var _b = this.props, onError = _b.onError, children = _b.children;\r\n if (hasError) {\r\n return React.createElement(onError, { error: error, errorInfo: errorInfo });\r\n }\r\n return 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;AACA;AACA;AACA;AACA;AACA"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 19.3.9-nightly.2604-02
2
+ * Application Insights JavaScript SDK - React Plugin, 19.4.0
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, 19.3.9-nightly.2604-02
2
+ * Application Insights JavaScript SDK - React Plugin, 19.4.0
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -8,8 +8,7 @@
8
8
  */
9
9
  import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
10
10
  import dynamicProto from "@microsoft/dynamicproto-js";
11
- import { AnalyticsPluginIdentifier, PropertiesPluginIdentifier } from "@microsoft/applicationinsights-common";
12
- import { BaseTelemetryPlugin, _throwInternal, isFunction, proxyFunctions, safeGetCookieMgr, onConfigChange, objDefineAccessors } from "@microsoft/applicationinsights-core-js";
11
+ import { AnalyticsPluginIdentifier, PropertiesPluginIdentifier, BaseTelemetryPlugin, _throwInternal, isFunction, proxyFunctions, safeGetCookieMgr, onConfigChange } from "@microsoft/applicationinsights-core-js";
13
12
  import { objDeepFreeze, objDefine } from "@nevware21/ts-utils";
14
13
  var defaultReactExtensionConfig = objDeepFreeze({
15
14
  history: { blkVal: true, v: undefined }
@@ -62,8 +61,8 @@ var ReactPlugin = /** @class */ (function (_super) {
62
61
  return safeGetCookieMgr(_self.core);
63
62
  };
64
63
  _self.getAppInsights = _getAnalytics;
65
- _self.processTelemetry = function (event, itemCtx) {
66
- _self.processNext(event, itemCtx);
64
+ _self.processTelemetry = function (env, itemCtx) {
65
+ _self.processNext(env, itemCtx);
67
66
  };
68
67
  _self._doTeardown = function (unloadCtx, unloadState, asyncCallback) {
69
68
  if (isFunction(_unlisten)) {
@@ -116,7 +115,9 @@ var ReactPlugin = /** @class */ (function (_super) {
116
115
  };
117
116
  _unlisten = history.listen(locationListener);
118
117
  }
119
- objDefineAccessors(_self, "_extensionConfig", function () { return _extensionConfig; });
118
+ objDefine(_self, "_extensionConfig", {
119
+ g: function () { return _extensionConfig; }
120
+ });
120
121
  });
121
122
  return _this;
122
123
  }
@@ -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 { 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
+ {"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, BaseTelemetryPlugin, _throwInternal, isFunction, proxyFunctions, safeGetCookieMgr, onConfigChange } 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 (env, itemCtx) {\r\n _self.processNext(env, 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 objDefine(_self, \"_extensionConfig\", {\r\n g: function () { return _extensionConfig; }\r\n });\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 env The event that needs to be processed\r\n */\r\n ReactPlugin.prototype.processTelemetry = function (env, 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;AACA;;;;;;;;qDAsCM,CAAC;;;;;;uBACgB;AACvB;AACA;AACA"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 19.3.9-nightly.2604-02
2
+ * Application Insights JavaScript SDK - React Plugin, 19.4.0
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, 19.3.9-nightly.2604-02
2
+ * Application Insights JavaScript SDK - React Plugin, 19.4.0
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  import { useEffect, useRef, useState } from "react";
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 19.3.9-nightly.2604-02
2
+ * Application Insights JavaScript SDK - React Plugin, 19.4.0
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  import { __assignFn as __assign } from "@microsoft/applicationinsights-shims";
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 19.3.9-nightly.2604-02
2
+ * Application Insights JavaScript SDK - React Plugin, 19.4.0
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -84,10 +84,10 @@ export { AITrackedComponentBase };
84
84
  * Higher-order component function to hook Application Insights tracking
85
85
  * in a React component's lifecycle.
86
86
  *
87
- * @param reactPlugin ReactPlugin instance
88
- * @param Component the React component to be instrumented
89
- * @param componentName (optional) component name
90
- * @param className (optional) className of the HOC div
87
+ * @param reactPlugin - ReactPlugin instance
88
+ * @param Component - the React component to be instrumented
89
+ * @param componentName - (optional) component name
90
+ * @param className - (optional) className of the HOC div
91
91
  */
92
92
  export default function withAITracking(reactPlugin, Component, componentName, className) {
93
93
  if (componentName === undefined || componentName === null || typeof componentName !== 'string') {
@@ -1 +1 @@
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"}
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
@@ -1,83 +1,79 @@
1
- {
2
- "name": "@microsoft/applicationinsights-react-js",
3
- "version": "19.3.9-nightly.2604-02",
4
- "description": "Microsoft Application Insights React plugin",
5
- "author": "Microsoft Application Insights Team",
6
- "license": "MIT",
7
- "bugs": {
8
- "url": "https://github.com/microsoft/applicationinsights-react-js/issues"
9
- },
10
- "homepage": "https://github.com/microsoft/applicationinsights-react-js#readme",
11
- "main": "dist/applicationinsights-react-js.js",
12
- "module": "dist-esm/applicationinsights-react-js.js",
13
- "types": "types/applicationinsights-react-js.d.ts",
14
- "sideEffects": false,
15
- "repository": {
16
- "type": "git",
17
- "url": "https://github.com/microsoft/applicationinsights-react-js"
18
- },
19
- "scripts": {
20
- "build": "npm run build:esm && npm run build:package && npm run dtsgen",
21
- "build:esm": "tsc -p tsconfig.json",
22
- "build:package": "rollup -c",
23
- "rebuild": "npm run build",
24
- "testx": "grunt reacttests",
25
- "test": "jest --config test/jestconfig.json",
26
- "test-watch": "jest --config test/jestconfig.json --watch",
27
- "lint": "tslint -p tsconfig.json",
28
- "dtsgen": "api-extractor run --local && node ../scripts/dtsgen.js \"Microsoft Application Insights react plugin\"",
29
- "ai-min": "grunt react-min",
30
- "ai-restore": "grunt react-restore"
31
- },
32
- "devDependencies": {
33
- "@microsoft/ai-test-framework": "0.0.1",
34
- "@microsoft/applicationinsights-rollup-es3": "^1.1.3",
35
- "@microsoft/applicationinsights-properties-js": "nightly3",
36
- "@microsoft/api-extractor": "^7.18.1",
37
- "@testing-library/dom": "^10.0.0",
38
- "@testing-library/jest-dom": "^5.11.9",
39
- "@testing-library/react": "^16.1.0",
40
- "@testing-library/user-event": "^12.8.1",
41
- "@types/cheerio": "0.22.13",
42
- "@types/history": "^4.7.9",
43
- "@types/jest": "^27.0.2",
44
- "@types/node": "11.13.2",
45
- "@types/prop-types": "^15.7.3",
46
- "@types/react": "^19.0.0",
47
- "@types/react-dom": "^19.0.0",
48
- "csstype": "~2.6.7",
49
- "grunt": "^1.5.3",
50
- "grunt-cli": "^1.4.3",
51
- "jest": "^27.3.1",
52
- "react": "^19.1.2",
53
- "react-dom": "^19.1.2",
54
- "globby": "^11.0.0",
55
- "magic-string": "^0.25.7",
56
- "@rollup/plugin-commonjs": "^18.0.0",
57
- "@rollup/plugin-node-resolve": "^11.2.1",
58
- "@rollup/plugin-replace": "^2.3.3",
59
- "rollup-plugin-cleanup": "^3.2.1",
60
- "rollup-plugin-peer-deps-external": "^2.2.4",
61
- "rollup": "^2.32.0",
62
- "ts-jest": "^27.0.7",
63
- "typescript": "^4.3.4",
64
- "tslib": "^2.0.0",
65
- "uglify-js": "3.16.0",
66
- "history": "^5.1.0"
67
- },
68
- "dependencies": {
69
- "@microsoft/applicationinsights-shims": "^3.0.1",
70
- "@microsoft/applicationinsights-core-js": "nightly3",
71
- "@microsoft/applicationinsights-common": "nightly3",
72
- "@microsoft/dynamicproto-js": "^2.0.3",
73
- "@nevware21/ts-utils": ">= 0.11.3 < 2.x"
74
- },
75
- "peerDependencies": {
76
- "tslib": "*",
77
- "react": ">= 19.0.0",
78
- "history": ">= 4.10.1"
79
- },
80
- "publishConfig": {
81
- "tag": "nightly"
82
- }
83
- }
1
+ {
2
+ "name": "@microsoft/applicationinsights-react-js",
3
+ "version": "19.4.0",
4
+ "description": "Microsoft Application Insights React plugin",
5
+ "author": "Microsoft Application Insights Team",
6
+ "license": "MIT",
7
+ "bugs": {
8
+ "url": "https://github.com/microsoft/applicationinsights-react-js/issues"
9
+ },
10
+ "homepage": "https://github.com/microsoft/applicationinsights-react-js#readme",
11
+ "main": "dist/applicationinsights-react-js.js",
12
+ "module": "dist-esm/applicationinsights-react-js.js",
13
+ "types": "types/applicationinsights-react-js.d.ts",
14
+ "sideEffects": false,
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/microsoft/applicationinsights-react-js"
18
+ },
19
+ "scripts": {
20
+ "build": "npm run build:esm && npm run build:package && npm run dtsgen",
21
+ "build:esm": "tsc -p tsconfig.json",
22
+ "build:package": "rollup -c",
23
+ "rebuild": "npm run build",
24
+ "testx": "grunt reacttests",
25
+ "test": "jest --config test/jestconfig.json",
26
+ "test-watch": "jest --config test/jestconfig.json --watch",
27
+ "lint": "tslint -p tsconfig.json",
28
+ "dtsgen": "api-extractor run --local && node ../scripts/dtsgen.js \"Microsoft Application Insights react plugin\"",
29
+ "ai-min": "grunt react-min",
30
+ "ai-restore": "grunt react-restore"
31
+ },
32
+ "devDependencies": {
33
+ "@microsoft/ai-test-framework": "0.0.1",
34
+ "@microsoft/applicationinsights-rollup-es3": "^1.1.3",
35
+ "@microsoft/applicationinsights-properties-js": "^3.4.1",
36
+ "@microsoft/api-extractor": "^7.18.1",
37
+ "@testing-library/dom": "^10.0.0",
38
+ "@testing-library/jest-dom": "^5.11.9",
39
+ "@testing-library/react": "^16.1.0",
40
+ "@testing-library/user-event": "^12.8.1",
41
+ "@types/cheerio": "0.22.13",
42
+ "@types/history": "^4.7.9",
43
+ "@types/jest": "^27.0.2",
44
+ "@types/node": "11.13.2",
45
+ "@types/prop-types": "^15.7.3",
46
+ "@types/react": "^19.0.0",
47
+ "@types/react-dom": "^19.0.0",
48
+ "csstype": "~2.6.7",
49
+ "grunt": "^1.5.3",
50
+ "grunt-cli": "^1.4.3",
51
+ "jest": "^27.3.1",
52
+ "react": "^19.1.2",
53
+ "react-dom": "^19.1.2",
54
+ "globby": "^11.0.0",
55
+ "magic-string": "^0.25.7",
56
+ "@rollup/plugin-commonjs": "^18.0.0",
57
+ "@rollup/plugin-node-resolve": "^11.2.1",
58
+ "@rollup/plugin-replace": "^2.3.3",
59
+ "rollup-plugin-cleanup": "^3.2.1",
60
+ "rollup-plugin-peer-deps-external": "^2.2.4",
61
+ "rollup": "^2.32.0",
62
+ "ts-jest": "^27.0.7",
63
+ "typescript": "^4.3.4",
64
+ "tslib": "^2.0.0",
65
+ "uglify-js": "3.16.0",
66
+ "history": "^5.1.0"
67
+ },
68
+ "dependencies": {
69
+ "@microsoft/applicationinsights-shims": "^3.0.1",
70
+ "@microsoft/applicationinsights-core-js": "^3.4.1",
71
+ "@microsoft/dynamicproto-js": "^2.0.3",
72
+ "@nevware21/ts-utils": ">= 0.11.3 < 2.x"
73
+ },
74
+ "peerDependencies": {
75
+ "tslib": "*",
76
+ "react": ">= 19.0.0",
77
+ "history": ">= 4.10.1"
78
+ }
79
+ }
@@ -2,24 +2,30 @@
2
2
  // Licensed under the MIT License.
3
3
 
4
4
  import React from "react";
5
- import { SeverityLevel } from "@microsoft/applicationinsights-common";
5
+ import { SeverityLevel } from "@microsoft/applicationinsights-core-js";
6
6
  import ReactPlugin from "./ReactPlugin";
7
7
 
8
8
  export interface IAppInsightsErrorBoundaryProps {
9
9
  appInsights: ReactPlugin
10
10
  onError: React.ComponentType<any>
11
- children: React.ReactElement
11
+ children: React.ReactNode
12
12
  }
13
13
 
14
14
  export interface IAppInsightsErrorBoundaryState {
15
15
  hasError: boolean
16
+ error: Error | null;
17
+ errorInfo: React.ErrorInfo | null;
16
18
  }
17
19
 
18
20
  export default class AppInsightsErrorBoundary extends React.Component<IAppInsightsErrorBoundaryProps, IAppInsightsErrorBoundaryState> {
19
- state = { hasError: false };
21
+ state: IAppInsightsErrorBoundaryState = {
22
+ hasError: false,
23
+ error: null,
24
+ errorInfo: null,
25
+ };
20
26
 
21
27
  componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
22
- this.setState({ hasError: true });
28
+ this.setState({ hasError: true, error, errorInfo });
23
29
  this.props.appInsights.trackException({
24
30
  error: error,
25
31
  exception: error,
@@ -29,11 +35,14 @@ export default class AppInsightsErrorBoundary extends React.Component<IAppInsigh
29
35
  }
30
36
 
31
37
  render() {
32
- if (this.state.hasError) {
33
- const { onError } = this.props;
34
- return React.createElement(onError);
38
+ const { hasError, error, errorInfo } = this.state;
39
+
40
+ const { onError, children } = this.props;
41
+
42
+ if (hasError) {
43
+ return React.createElement(onError, {error, errorInfo});
35
44
  }
36
45
 
37
- return this.props.children;
46
+ return children;
38
47
  }
39
48
  }
@@ -5,13 +5,11 @@
5
5
 
6
6
  import dynamicProto from "@microsoft/dynamicproto-js";
7
7
  import {
8
- AnalyticsPluginIdentifier,
9
- IAppInsights, IConfig, IEventTelemetry, IExceptionTelemetry, IMetricTelemetry, IPageViewTelemetry, ITraceTelemetry, ITelemetryContext as Common_ITelemetryContext, PropertiesPluginIdentifier
10
- } from "@microsoft/applicationinsights-common";
11
- import {
8
+ AnalyticsPluginIdentifier, IAppInsights, IConfig, IEventTelemetry, IExceptionTelemetry, IMetricTelemetry, IPageViewTelemetry, ITraceTelemetry,
9
+ ITelemetryContext as Common_ITelemetryContext, PropertiesPluginIdentifier,
12
10
  BaseTelemetryPlugin, IAppInsightsCore, IConfiguration, ICookieMgr, ICustomProperties, IPlugin, IProcessTelemetryContext,
13
- IProcessTelemetryUnloadContext, ITelemetryItem, ITelemetryPlugin, ITelemetryPluginChain, ITelemetryUnloadState, _eInternalMessageId,
14
- _throwInternal, arrForEach, eLoggingSeverity, isFunction, proxyFunctions, safeGetCookieMgr, IConfigDefaults, onConfigChange, objDefineAccessors
11
+ IProcessTelemetryUnloadContext, ITelemetryItem, ITelemetryPluginChain, ITelemetryUnloadState, _eInternalMessageId,
12
+ _throwInternal, eLoggingSeverity, isFunction, proxyFunctions, safeGetCookieMgr, IConfigDefaults, onConfigChange
15
13
  } from "@microsoft/applicationinsights-core-js";
16
14
  import {objDeepFreeze, objDefine} from "@nevware21/ts-utils";
17
15
 
@@ -42,7 +40,7 @@ export default class ReactPlugin extends BaseTelemetryPlugin {
42
40
  dynamicProto(ReactPlugin, this, (_self, _base) => {
43
41
  _initDefaults();
44
42
 
45
- _self.initialize = (config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?:ITelemetryPluginChain) => {
43
+ _self.initialize = (config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain) => {
46
44
  super.initialize(config, core, extensions, pluginChain);
47
45
 
48
46
  let thePlugin = core.getPlugin<PropertiesPlugin>(PropertiesPluginIdentifier);
@@ -81,8 +79,8 @@ export default class ReactPlugin extends BaseTelemetryPlugin {
81
79
 
82
80
  _self.getAppInsights = _getAnalytics;
83
81
 
84
- _self.processTelemetry = (event: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => {
85
- _self.processNext(event, itemCtx);
82
+ _self.processTelemetry = (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => {
83
+ _self.processNext(env, itemCtx as IProcessTelemetryContext);
86
84
  };
87
85
 
88
86
  _self._doTeardown = (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void): void | boolean => {
@@ -146,11 +144,13 @@ export default class ReactPlugin extends BaseTelemetryPlugin {
146
144
  _unlisten = history.listen(locationListener);
147
145
  }
148
146
 
149
- objDefineAccessors(_self, "_extensionConfig", () => _extensionConfig);
147
+ objDefine(_self as any, "_extensionConfig", {
148
+ g: () => _extensionConfig
149
+ });
150
150
  });
151
151
  }
152
152
 
153
- initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?:ITelemetryPluginChain) {
153
+ initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain) {
154
154
  // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
155
155
  }
156
156
 
@@ -172,9 +172,9 @@ export default class ReactPlugin extends BaseTelemetryPlugin {
172
172
 
173
173
  /**
174
174
  * Add Part A fields to the event
175
- * @param event The event that needs to be processed
175
+ * @param env The event that needs to be processed
176
176
  */
177
- processTelemetry(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext) {
177
+ processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) {
178
178
  // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
179
179
  }
180
180