@microsoft/applicationinsights-react-js 3.3.2 → 3.3.3-nightly.2205-03

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.3.2
2
+ * Microsoft Application Insights react plugin, 3.3.3-nightly.2205-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  *
@@ -38,6 +38,28 @@ import { SetStateAction } from 'react';
38
38
 
39
39
  declare type AIReactCustomEvent<T> = Dispatch<SetStateAction<T>>;
40
40
 
41
+ /**
42
+ * Higher-order component base class to hook Application Insights tracking
43
+ * in a React component's lifecycle.
44
+ */
45
+ export declare abstract class AITrackedComponentBase<P> extends React_2.Component<P> {
46
+ protected _mountTimestamp: number;
47
+ protected _firstActiveTimestamp: number;
48
+ protected _idleStartTimestamp: number;
49
+ protected _lastActiveTimestamp: number;
50
+ protected _totalIdleTime: number;
51
+ protected _idleCount: number;
52
+ protected _idleTimeout: number;
53
+ protected _intervalId?: any;
54
+ protected _componentName: string;
55
+ protected _reactPlugin: ReactPlugin;
56
+ constructor(props: P, reactPlugin: ReactPlugin, componentName: string);
57
+ componentDidMount(): void;
58
+ componentWillUnmount(): void;
59
+ protected trackActivity: (e: React_2.SyntheticEvent<any>) => void;
60
+ private getEngagementTimeSeconds;
61
+ }
62
+
41
63
  export declare const AppInsightsContext: AppInsightsReactContext;
42
64
 
43
65
  export declare class AppInsightsErrorBoundary extends React_3.Component<IAppInsightsErrorBoundaryProps, IAppInsightsErrorBoundaryState> {
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 3.3.2
2
+ * Application Insights JavaScript SDK - React Plugin, 3.3.3-nightly.2205-03
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.3.2
2
+ * Application Insights JavaScript SDK - React Plugin, 3.3.3-nightly.2205-03
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.3.2
2
+ * Application Insights JavaScript SDK - React Plugin, 3.3.3-nightly.2205-03
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.3.2
2
+ * Application Insights JavaScript SDK - React Plugin, 3.3.3-nightly.2205-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -1,14 +1,14 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 3.3.2
2
+ * Application Insights JavaScript SDK - React Plugin, 3.3.3-nightly.2205-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
6
6
 
7
7
  import ReactPlugin from "./ReactPlugin";
8
- import withAITracking from "./withAITracking";
8
+ import withAITracking, { AITrackedComponentBase } from "./withAITracking";
9
9
  import AppInsightsErrorBoundary from "./AppInsightsErrorBoundary";
10
10
  import { AppInsightsContext, useAppInsightsContext } from "./AppInsightsContext";
11
11
  import useTrackEvent from "./useTrackEvent";
12
12
  import useTrackMetric from "./useTrackMetric";
13
- export { ReactPlugin, withAITracking, AppInsightsErrorBoundary, AppInsightsContext, useAppInsightsContext, useTrackEvent, useTrackMetric };
13
+ export { ReactPlugin, withAITracking, AppInsightsErrorBoundary, AppInsightsContext, useAppInsightsContext, useTrackEvent, useTrackMetric, AITrackedComponentBase };
14
14
  //# sourceMappingURL=applicationinsights-react-js.js.map
@@ -1 +1 @@
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 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 };\r\n//# sourceMappingURL=applicationinsights-react-js.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
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,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 3.3.2
2
+ * Application Insights JavaScript SDK - React Plugin, 3.3.3-nightly.2205-03
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.3.2
2
+ * Application Insights JavaScript SDK - React Plugin, 3.3.3-nightly.2205-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  import { __assignFn as __assign } from "@microsoft/applicationinsights-shims";
@@ -1,12 +1,85 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - React Plugin, 3.3.2
2
+ * Application Insights JavaScript SDK - React Plugin, 3.3.3-nightly.2205-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
6
6
 
7
7
  import { __assignFn as __assign, __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
8
- import { CoreUtils } from '@microsoft/applicationinsights-core-js';
8
+ import { dateNow } from '@microsoft/applicationinsights-core-js';
9
9
  import * as React from 'react';
10
+ /**
11
+ * Higher-order component base class to hook Application Insights tracking
12
+ * in a React component's lifecycle.
13
+ */
14
+ var AITrackedComponentBase = /** @class */ (function (_super) {
15
+ __extends(AITrackedComponentBase, _super);
16
+ function AITrackedComponentBase(props, reactPlugin, componentName) {
17
+ var _this = _super.call(this, props) || this;
18
+ _this._mountTimestamp = 0;
19
+ _this._firstActiveTimestamp = 0;
20
+ _this._idleStartTimestamp = 0;
21
+ _this._lastActiveTimestamp = 0;
22
+ _this._totalIdleTime = 0;
23
+ _this._idleCount = 0;
24
+ _this._idleTimeout = 5000;
25
+ _this.trackActivity = function (e) {
26
+ if (_this._firstActiveTimestamp === 0) {
27
+ _this._firstActiveTimestamp = dateNow();
28
+ _this._lastActiveTimestamp = _this._firstActiveTimestamp;
29
+ }
30
+ else {
31
+ _this._lastActiveTimestamp = dateNow();
32
+ }
33
+ if (_this._idleStartTimestamp > 0) {
34
+ var lastIdleTime = _this._lastActiveTimestamp - _this._idleStartTimestamp;
35
+ _this._totalIdleTime += lastIdleTime;
36
+ _this._idleStartTimestamp = 0;
37
+ }
38
+ };
39
+ _this._reactPlugin = reactPlugin;
40
+ _this._componentName = componentName;
41
+ return _this;
42
+ }
43
+ AITrackedComponentBase.prototype.componentDidMount = function () {
44
+ var _this = this;
45
+ this._mountTimestamp = dateNow();
46
+ this._firstActiveTimestamp = 0;
47
+ this._totalIdleTime = 0;
48
+ this._lastActiveTimestamp = 0;
49
+ this._idleStartTimestamp = 0;
50
+ this._idleCount = 0;
51
+ this._intervalId = setInterval(function () {
52
+ if (_this._lastActiveTimestamp > 0 && _this._idleStartTimestamp === 0 && dateNow() - _this._lastActiveTimestamp >= _this._idleTimeout) {
53
+ _this._idleStartTimestamp = dateNow();
54
+ _this._idleCount++;
55
+ }
56
+ }, 100);
57
+ };
58
+ AITrackedComponentBase.prototype.componentWillUnmount = function () {
59
+ if (this._mountTimestamp === 0) {
60
+ throw new Error('withAITracking:componentWillUnmount: mountTimestamp is not initialized.');
61
+ }
62
+ if (this._intervalId) {
63
+ clearInterval(this._intervalId);
64
+ }
65
+ if (this._firstActiveTimestamp === 0) {
66
+ return;
67
+ }
68
+ var engagementTime = this.getEngagementTimeSeconds();
69
+ var metricData = {
70
+ average: engagementTime,
71
+ name: 'React Component Engaged Time (seconds)',
72
+ sampleCount: 1
73
+ };
74
+ var additionalProperties = { 'Component Name': this._componentName };
75
+ this._reactPlugin.trackMetric(metricData, additionalProperties);
76
+ };
77
+ AITrackedComponentBase.prototype.getEngagementTimeSeconds = function () {
78
+ return (dateNow() - this._firstActiveTimestamp - this._totalIdleTime - this._idleCount * this._idleTimeout) / 1000;
79
+ };
80
+ return AITrackedComponentBase;
81
+ }(React.Component));
82
+ export { AITrackedComponentBase };
10
83
  /**
11
84
  * Higher-order component function to hook Application Insights tracking
12
85
  * in a React component's lifecycle.
@@ -28,73 +101,14 @@ export default function withAITracking(reactPlugin, Component, componentName, cl
28
101
  }
29
102
  return /** @class */ (function (_super) {
30
103
  __extends(class_1, _super);
31
- function class_1() {
32
- var _this = _super !== null && _super.apply(this, arguments) || this;
33
- _this._mountTimestamp = 0;
34
- _this._firstActiveTimestamp = 0;
35
- _this._idleStartTimestamp = 0;
36
- _this._lastActiveTimestamp = 0;
37
- _this._totalIdleTime = 0;
38
- _this._idleCount = 0;
39
- _this._idleTimeout = 5000;
40
- _this.trackActivity = function (e) {
41
- if (_this._firstActiveTimestamp === 0) {
42
- _this._firstActiveTimestamp = CoreUtils.dateNow();
43
- _this._lastActiveTimestamp = _this._firstActiveTimestamp;
44
- }
45
- else {
46
- _this._lastActiveTimestamp = CoreUtils.dateNow();
47
- }
48
- if (_this._idleStartTimestamp > 0) {
49
- var lastIdleTime = _this._lastActiveTimestamp - _this._idleStartTimestamp;
50
- _this._totalIdleTime += lastIdleTime;
51
- _this._idleStartTimestamp = 0;
52
- }
53
- };
54
- return _this;
104
+ function class_1(props) {
105
+ return _super.call(this, props, reactPlugin, componentName) || this;
55
106
  }
56
- class_1.prototype.componentDidMount = function () {
57
- var _this = this;
58
- this._mountTimestamp = CoreUtils.dateNow();
59
- this._firstActiveTimestamp = 0;
60
- this._totalIdleTime = 0;
61
- this._lastActiveTimestamp = 0;
62
- this._idleStartTimestamp = 0;
63
- this._idleCount = 0;
64
- this._intervalId = setInterval(function () {
65
- if (_this._lastActiveTimestamp > 0 && _this._idleStartTimestamp === 0 && CoreUtils.dateNow() - _this._lastActiveTimestamp >= _this._idleTimeout) {
66
- _this._idleStartTimestamp = CoreUtils.dateNow();
67
- _this._idleCount++;
68
- }
69
- }, 100);
70
- };
71
- class_1.prototype.componentWillUnmount = function () {
72
- if (this._mountTimestamp === 0) {
73
- throw new Error('withAITracking:componentWillUnmount: mountTimestamp is not initialized.');
74
- }
75
- if (this._intervalId) {
76
- clearInterval(this._intervalId);
77
- }
78
- if (this._firstActiveTimestamp === 0) {
79
- return;
80
- }
81
- var engagementTime = this.getEngagementTimeSeconds();
82
- var metricData = {
83
- average: engagementTime,
84
- name: 'React Component Engaged Time (seconds)',
85
- sampleCount: 1
86
- };
87
- var additionalProperties = { 'Component Name': componentName };
88
- reactPlugin.trackMetric(metricData, additionalProperties);
89
- };
90
107
  class_1.prototype.render = function () {
91
108
  return (React.createElement("div", { onKeyDown: this.trackActivity, onMouseMove: this.trackActivity, onScroll: this.trackActivity, onMouseDown: this.trackActivity, onTouchStart: this.trackActivity, onTouchMove: this.trackActivity, className: className },
92
109
  React.createElement(Component, __assign({}, this.props))));
93
110
  };
94
- class_1.prototype.getEngagementTimeSeconds = function () {
95
- return (CoreUtils.dateNow() - this._firstActiveTimestamp - this._totalIdleTime - this._idleCount * this._idleTimeout) / 1000;
96
- };
97
111
  return class_1;
98
- }(React.Component));
112
+ }(AITrackedComponentBase));
99
113
  }
100
114
  //# sourceMappingURL=withAITracking.js.map
@@ -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 { CoreUtils } from '@microsoft/applicationinsights-core-js';\r\nimport * as React from 'react';\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() {\r\n var _this = _super !== null && _super.apply(this, arguments) || 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 = CoreUtils.dateNow();\r\n _this._lastActiveTimestamp = _this._firstActiveTimestamp;\r\n }\r\n else {\r\n _this._lastActiveTimestamp = CoreUtils.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 return _this;\r\n }\r\n class_1.prototype.componentDidMount = function () {\r\n var _this = this;\r\n this._mountTimestamp = CoreUtils.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 && CoreUtils.dateNow() - _this._lastActiveTimestamp >= _this._idleTimeout) {\r\n _this._idleStartTimestamp = CoreUtils.dateNow();\r\n _this._idleCount++;\r\n }\r\n }, 100);\r\n };\r\n class_1.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': componentName };\r\n reactPlugin.trackMetric(metricData, additionalProperties);\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 class_1.prototype.getEngagementTimeSeconds = function () {\r\n return (CoreUtils.dateNow() - this._firstActiveTimestamp - this._totalIdleTime - this._idleCount * this._idleTimeout) / 1000;\r\n };\r\n return class_1;\r\n }(React.Component));\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"}
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,71 +1,74 @@
1
- {
2
- "name": "@microsoft/applicationinsights-react-js",
3
- "version": "3.3.2",
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.8.2",
62
- "@microsoft/applicationinsights-common": "2.8.2",
63
- "@microsoft/dynamicproto-js": "^1.1.5"
64
- },
65
- "peerDependencies": {
66
- "tslib": "*",
67
- "react": "^17.0.1",
68
- "history": ">= 4.10.1"
69
- },
70
- "license": "MIT"
71
- }
1
+ {
2
+ "name": "@microsoft/applicationinsights-react-js",
3
+ "version": "3.3.3-nightly.2205-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.8.3-nightly.2205-03",
62
+ "@microsoft/applicationinsights-common": "2.8.3-nightly.2205-03",
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
+ "publishConfig": {
72
+ "tag": "nightly"
73
+ }
74
+ }
@@ -3,7 +3,7 @@
3
3
 
4
4
  import { IReactExtensionConfig } from "./Interfaces/IReactExtensionConfig";
5
5
  import ReactPlugin from "./ReactPlugin";
6
- import withAITracking from "./withAITracking";
6
+ import withAITracking, { AITrackedComponentBase } from "./withAITracking";
7
7
  import AppInsightsErrorBoundary from "./AppInsightsErrorBoundary"
8
8
  import {
9
9
  AppInsightsContext,
@@ -20,5 +20,6 @@ export {
20
20
  AppInsightsContext,
21
21
  useAppInsightsContext,
22
22
  useTrackEvent,
23
- useTrackMetric
23
+ useTrackMetric,
24
+ AITrackedComponentBase
24
25
  };