@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
@@ -852,21 +852,8 @@
852
852
  },
853
853
  {
854
854
  "kind": "Reference",
855
- "text": "React.ReactElement",
856
- "canonicalReference": "@types/react!React.ReactElement:interface"
857
- },
858
- {
859
- "kind": "Content",
860
- "text": "<unknown, string | "
861
- },
862
- {
863
- "kind": "Reference",
864
- "text": "React.JSXElementConstructor",
865
- "canonicalReference": "@types/react!React.JSXElementConstructor:type"
866
- },
867
- {
868
- "kind": "Content",
869
- "text": "<any>>"
855
+ "text": "React.ReactNode",
856
+ "canonicalReference": "@types/react!React.ReactNode:type"
870
857
  },
871
858
  {
872
859
  "kind": "Content",
@@ -876,7 +863,7 @@
876
863
  "isStatic": false,
877
864
  "returnTypeTokenRange": {
878
865
  "startIndex": 1,
879
- "endIndex": 5
866
+ "endIndex": 2
880
867
  },
881
868
  "releaseTag": "Public",
882
869
  "isProtected": false,
@@ -896,8 +883,9 @@
896
883
  "text": "state: "
897
884
  },
898
885
  {
899
- "kind": "Content",
900
- "text": "{\n hasError: boolean;\n }"
886
+ "kind": "Reference",
887
+ "text": "IAppInsightsErrorBoundaryState",
888
+ "canonicalReference": "@microsoft/applicationinsights-react-js!~IAppInsightsErrorBoundaryState:interface"
901
889
  },
902
890
  {
903
891
  "kind": "Content",
@@ -1148,15 +1136,6 @@
1148
1136
  "text": "IConfiguration",
1149
1137
  "canonicalReference": "@microsoft/applicationinsights-core-js!IConfiguration:interface"
1150
1138
  },
1151
- {
1152
- "kind": "Content",
1153
- "text": " & "
1154
- },
1155
- {
1156
- "kind": "Reference",
1157
- "text": "IConfig",
1158
- "canonicalReference": "@microsoft/applicationinsights-core-js!IConfig:interface"
1159
- },
1160
1139
  {
1161
1140
  "kind": "Content",
1162
1141
  "text": ", core: "
@@ -1203,8 +1182,8 @@
1203
1182
  ],
1204
1183
  "isStatic": false,
1205
1184
  "returnTypeTokenRange": {
1206
- "startIndex": 12,
1207
- "endIndex": 13
1185
+ "startIndex": 10,
1186
+ "endIndex": 11
1208
1187
  },
1209
1188
  "releaseTag": "Public",
1210
1189
  "isProtected": false,
@@ -1214,31 +1193,31 @@
1214
1193
  "parameterName": "config",
1215
1194
  "parameterTypeTokenRange": {
1216
1195
  "startIndex": 1,
1217
- "endIndex": 4
1196
+ "endIndex": 2
1218
1197
  },
1219
1198
  "isOptional": false
1220
1199
  },
1221
1200
  {
1222
1201
  "parameterName": "core",
1223
1202
  "parameterTypeTokenRange": {
1224
- "startIndex": 5,
1225
- "endIndex": 6
1203
+ "startIndex": 3,
1204
+ "endIndex": 4
1226
1205
  },
1227
1206
  "isOptional": false
1228
1207
  },
1229
1208
  {
1230
1209
  "parameterName": "extensions",
1231
1210
  "parameterTypeTokenRange": {
1232
- "startIndex": 7,
1233
- "endIndex": 9
1211
+ "startIndex": 5,
1212
+ "endIndex": 7
1234
1213
  },
1235
1214
  "isOptional": false
1236
1215
  },
1237
1216
  {
1238
1217
  "parameterName": "pluginChain",
1239
1218
  "parameterTypeTokenRange": {
1240
- "startIndex": 10,
1241
- "endIndex": 11
1219
+ "startIndex": 8,
1220
+ "endIndex": 9
1242
1221
  },
1243
1222
  "isOptional": true
1244
1223
  }
@@ -1280,11 +1259,11 @@
1280
1259
  {
1281
1260
  "kind": "Method",
1282
1261
  "canonicalReference": "@microsoft/applicationinsights-react-js!ReactPlugin#processTelemetry:member(1)",
1283
- "docComment": "/**\n * Add Part A fields to the event\n *\n * @param event - The event that needs to be processed\n */\n",
1262
+ "docComment": "/**\n * Add Part A fields to the event\n *\n * @param env - The event that needs to be processed\n */\n",
1284
1263
  "excerptTokens": [
1285
1264
  {
1286
1265
  "kind": "Content",
1287
- "text": "processTelemetry(event: "
1266
+ "text": "processTelemetry(env: "
1288
1267
  },
1289
1268
  {
1290
1269
  "kind": "Reference",
@@ -1323,7 +1302,7 @@
1323
1302
  "overloadIndex": 1,
1324
1303
  "parameters": [
1325
1304
  {
1326
- "parameterName": "event",
1305
+ "parameterName": "env",
1327
1306
  "parameterTypeTokenRange": {
1328
1307
  "startIndex": 1,
1329
1308
  "endIndex": 2
@@ -8,22 +8,21 @@ import { BaseTelemetryPlugin } from '@microsoft/applicationinsights-core-js';
8
8
  import { Context } from 'react';
9
9
  import { Dispatch } from 'react';
10
10
  import { History as History_2 } from 'history';
11
- import { IAppInsights } from '@microsoft/applicationinsights-common';
11
+ import { IAppInsights } from '@microsoft/applicationinsights-core-js';
12
12
  import { IAppInsightsCore } from '@microsoft/applicationinsights-core-js';
13
- import { IConfig } from '@microsoft/applicationinsights-common';
14
13
  import { IConfiguration } from '@microsoft/applicationinsights-core-js';
15
14
  import { ICookieMgr } from '@microsoft/applicationinsights-core-js';
16
15
  import { ICustomProperties } from '@microsoft/applicationinsights-core-js';
17
- import { IEventTelemetry } from '@microsoft/applicationinsights-common';
18
- import { IExceptionTelemetry } from '@microsoft/applicationinsights-common';
19
- import { IMetricTelemetry } from '@microsoft/applicationinsights-common';
20
- import { IPageViewTelemetry } from '@microsoft/applicationinsights-common';
16
+ import { IEventTelemetry } from '@microsoft/applicationinsights-core-js';
17
+ import { IExceptionTelemetry } from '@microsoft/applicationinsights-core-js';
18
+ import { IMetricTelemetry } from '@microsoft/applicationinsights-core-js';
19
+ import { IPageViewTelemetry } from '@microsoft/applicationinsights-core-js';
21
20
  import { IPlugin } from '@microsoft/applicationinsights-core-js';
22
21
  import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
23
- import { ITelemetryContext } from '@microsoft/applicationinsights-common';
22
+ import { ITelemetryContext } from '@microsoft/applicationinsights-core-js';
24
23
  import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
25
24
  import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js';
26
- import { ITraceTelemetry } from '@microsoft/applicationinsights-common';
25
+ import { ITraceTelemetry } from '@microsoft/applicationinsights-core-js';
27
26
  import * as React_2 from 'react';
28
27
  import { default as React_3 } from 'react';
29
28
  import { SetStateAction } from 'react';
@@ -72,11 +71,9 @@ export class AppInsightsErrorBoundary extends React_3.Component<IAppInsightsErro
72
71
  // (undocumented)
73
72
  componentDidCatch(error: Error, errorInfo: React_3.ErrorInfo): void;
74
73
  // (undocumented)
75
- render(): React_3.ReactElement<unknown, string | React_3.JSXElementConstructor<any>>;
74
+ render(): React_3.ReactNode;
76
75
  // (undocumented)
77
- state: {
78
- hasError: boolean;
79
- };
76
+ state: IAppInsightsErrorBoundaryState;
80
77
  }
81
78
 
82
79
  // @public
@@ -94,10 +91,10 @@ export class ReactPlugin extends BaseTelemetryPlugin {
94
91
  // (undocumented)
95
92
  identifier: string;
96
93
  // (undocumented)
97
- initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
94
+ initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
98
95
  // (undocumented)
99
96
  priority: number;
100
- processTelemetry(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
97
+ processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
101
98
  // (undocumented)
102
99
  trackEvent(event: IEventTelemetry, customProperties?: ICustomProperties): void;
103
100
  // (undocumented)
@@ -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
@@ -11,22 +11,21 @@ declare namespace ApplicationInsights {
11
11
  import { Context } from 'react';
12
12
  import { Dispatch } from 'react';
13
13
  import { History as History_2 } from 'history';
14
- import { IAppInsights } from '@microsoft/applicationinsights-common';
14
+ import { IAppInsights } from '@microsoft/applicationinsights-core-js';
15
15
  import { IAppInsightsCore } from '@microsoft/applicationinsights-core-js';
16
- import { IConfig } from '@microsoft/applicationinsights-common';
17
16
  import { IConfiguration } from '@microsoft/applicationinsights-core-js';
18
17
  import { ICookieMgr } from '@microsoft/applicationinsights-core-js';
19
18
  import { ICustomProperties } from '@microsoft/applicationinsights-core-js';
20
- import { IEventTelemetry } from '@microsoft/applicationinsights-common';
21
- import { IExceptionTelemetry } from '@microsoft/applicationinsights-common';
22
- import { IMetricTelemetry } from '@microsoft/applicationinsights-common';
23
- import { IPageViewTelemetry } from '@microsoft/applicationinsights-common';
19
+ import { IEventTelemetry } from '@microsoft/applicationinsights-core-js';
20
+ import { IExceptionTelemetry } from '@microsoft/applicationinsights-core-js';
21
+ import { IMetricTelemetry } from '@microsoft/applicationinsights-core-js';
22
+ import { IPageViewTelemetry } from '@microsoft/applicationinsights-core-js';
24
23
  import { IPlugin } from '@microsoft/applicationinsights-core-js';
25
24
  import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
26
- import { ITelemetryContext } from '@microsoft/applicationinsights-common';
25
+ import { ITelemetryContext } from '@microsoft/applicationinsights-core-js';
27
26
  import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
28
27
  import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js';
29
- import { ITraceTelemetry } from '@microsoft/applicationinsights-common';
28
+ import { ITraceTelemetry } from '@microsoft/applicationinsights-core-js';
30
29
  import * as React_2 from 'react';
31
30
  import { default as React_3 } from 'react';
32
31
  import { SetStateAction } from 'react';
@@ -58,11 +57,9 @@ declare namespace ApplicationInsights {
58
57
  const AppInsightsContext: AppInsightsReactContext;
59
58
 
60
59
  class AppInsightsErrorBoundary extends React_3.Component<IAppInsightsErrorBoundaryProps, IAppInsightsErrorBoundaryState> {
61
- state: {
62
- hasError: boolean;
63
- };
60
+ state: IAppInsightsErrorBoundaryState;
64
61
  componentDidCatch(error: Error, errorInfo: React_3.ErrorInfo): void;
65
- render(): React_3.ReactElement<unknown, string | React_3.JSXElementConstructor<any>>;
62
+ render(): React_3.ReactNode;
66
63
  }
67
64
 
68
65
  type AppInsightsReactContext = Context<ReactPlugin>;
@@ -70,11 +67,13 @@ declare namespace ApplicationInsights {
70
67
  interface IAppInsightsErrorBoundaryProps {
71
68
  appInsights: ReactPlugin;
72
69
  onError: React_3.ComponentType<any>;
73
- children: React_3.ReactElement;
70
+ children: React_3.ReactNode;
74
71
  }
75
72
 
76
73
  interface IAppInsightsErrorBoundaryState {
77
74
  hasError: boolean;
75
+ error: Error | null;
76
+ errorInfo: React_3.ErrorInfo | null;
78
77
  }
79
78
 
80
79
  /**
@@ -95,7 +94,7 @@ declare namespace ApplicationInsights {
95
94
  identifier: string;
96
95
  readonly context: ITelemetryContext;
97
96
  constructor();
98
- initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
97
+ initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
99
98
  /**
100
99
  * Get the current cookie manager for this instance
101
100
  */
@@ -106,9 +105,9 @@ declare namespace ApplicationInsights {
106
105
  getAppInsights(): IAppInsights;
107
106
  /**
108
107
  * Add Part A fields to the event
109
- * @param event The event that needs to be processed
108
+ * @param env The event that needs to be processed
110
109
  */
111
- processTelemetry(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
110
+ processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
112
111
  trackMetric(metric: IMetricTelemetry, customProperties: ICustomProperties): void;
113
112
  trackPageView(pageView: IPageViewTelemetry): void;
114
113
  trackEvent(event: IEventTelemetry, customProperties?: ICustomProperties): void;
@@ -126,10 +125,10 @@ declare namespace ApplicationInsights {
126
125
  * Higher-order component function to hook Application Insights tracking
127
126
  * in a React component's lifecycle.
128
127
  *
129
- * @param reactPlugin ReactPlugin instance
130
- * @param Component the React component to be instrumented
131
- * @param componentName (optional) component name
132
- * @param className (optional) className of the HOC div
128
+ * @param reactPlugin - ReactPlugin instance
129
+ * @param Component - the React component to be instrumented
130
+ * @param componentName - (optional) component name
131
+ * @param className - (optional) className of the HOC div
133
132
  */
134
133
  function withAITracking<P>(reactPlugin: ReactPlugin, Component: React_2.ComponentType<P>, componentName?: string, className?: string): React_2.ComponentClass<P>;
135
134
 
@@ -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
  (function (global, factory) {
@@ -265,19 +265,6 @@
265
265
  }
266
266
  var objDefineProp = ( _pureRef(ObjClass, "defineProperty"));
267
267
  var objDefineProperties = ( _pureRef(ObjClass, "defineProperties"));
268
- function objDefineAccessors(target, prop, getProp, setProp, configurable, enumerable) {
269
- var desc = {
270
- e: enumerable,
271
- c: configurable
272
- };
273
- if (getProp) {
274
- desc.g = getProp;
275
- }
276
- if (setProp) {
277
- desc.s = setProp;
278
- }
279
- return objDefineProp(target, prop, _createProp(desc));
280
- }
281
268
  function objDefine(target, key, propDesc) {
282
269
  return objDefineProp(target, key, _createProp(propDesc));
283
270
  }
@@ -1708,7 +1695,7 @@
1708
1695
  return result;
1709
1696
  }
1710
1697
 
1711
- var version = '3.4.0-nightly3.2604-03';
1698
+ var version = '3.4.1';
1712
1699
  var instanceName = "." + newId(6);
1713
1700
  var _dataUid = 0;
1714
1701
  function _canAcceptData(target) {
@@ -2445,7 +2432,7 @@
2445
2432
  return _InternalLogMessage;
2446
2433
  }());
2447
2434
  function safeGetLogger(core, config) {
2448
- return (core || {})[_DYN_LOGGER ] || new DiagnosticLogger(config);
2435
+ return (core || {})[_DYN_LOGGER ] || new DiagnosticLogger(config || (core || {})[_DYN_CONFIG ]);
2449
2436
  }
2450
2437
  var DiagnosticLogger = /** @class */ (function () {
2451
2438
  function DiagnosticLogger(config) {
@@ -3683,8 +3670,8 @@
3683
3670
  return safeGetCookieMgr(_self.core);
3684
3671
  };
3685
3672
  _self.getAppInsights = _getAnalytics;
3686
- _self.processTelemetry = function (event, itemCtx) {
3687
- _self.processNext(event, itemCtx);
3673
+ _self.processTelemetry = function (env, itemCtx) {
3674
+ _self.processNext(env, itemCtx);
3688
3675
  };
3689
3676
  _self._doTeardown = function (unloadCtx, unloadState, asyncCallback) {
3690
3677
  if (isFunction(_unlisten)) {
@@ -3733,7 +3720,9 @@
3733
3720
  };
3734
3721
  _unlisten = history.listen(locationListener);
3735
3722
  }
3736
- objDefineAccessors(_self, "_extensionConfig", function () { return _extensionConfig; });
3723
+ objDefine(_self, "_extensionConfig", {
3724
+ g: function () { return _extensionConfig; }
3725
+ });
3737
3726
  });
3738
3727
  return _this;
3739
3728
  }
@@ -3837,11 +3826,15 @@
3837
3826
  __extendsFn(AppInsightsErrorBoundary, _super);
3838
3827
  function AppInsightsErrorBoundary() {
3839
3828
  var _this = _super !== null && _super.apply(this, arguments) || this;
3840
- _this.state = { hasError: false };
3829
+ _this.state = {
3830
+ hasError: false,
3831
+ error: null,
3832
+ errorInfo: null,
3833
+ };
3841
3834
  return _this;
3842
3835
  }
3843
3836
  AppInsightsErrorBoundary.prototype.componentDidCatch = function (error, errorInfo) {
3844
- this.setState({ hasError: true });
3837
+ this.setState({ hasError: true, error: error, errorInfo: errorInfo });
3845
3838
  this.props.appInsights.trackException({
3846
3839
  error: error,
3847
3840
  exception: error,
@@ -3850,11 +3843,12 @@
3850
3843
  });
3851
3844
  };
3852
3845
  AppInsightsErrorBoundary.prototype.render = function () {
3853
- if (this.state.hasError) {
3854
- var onError = this.props.onError;
3855
- return React__default["default"].createElement(onError);
3846
+ var _a = this.state, hasError = _a.hasError, error = _a.error, errorInfo = _a.errorInfo;
3847
+ var _b = this.props, onError = _b.onError, children = _b.children;
3848
+ if (hasError) {
3849
+ return React__default["default"].createElement(onError, { error: error, errorInfo: errorInfo });
3856
3850
  }
3857
- return this.props.children;
3851
+ return children;
3858
3852
  };
3859
3853
  return AppInsightsErrorBoundary;
3860
3854
  }(React__default["default"].Component));