@microsoft/applicationinsights-react-js 3.1.4 → 3.2.1-nightly.202110-02
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-react-js.js +49 -50
- package/browser/applicationinsights-react-js.js.map +1 -1
- package/browser/applicationinsights-react-js.min.js +2 -2
- package/browser/applicationinsights-react-js.min.js.map +1 -1
- package/dist/applicationinsights-react-js.api.json +1194 -0
- package/dist/applicationinsights-react-js.api.md +91 -0
- package/dist/applicationinsights-react-js.d.ts +109 -0
- package/dist/applicationinsights-react-js.js +49 -50
- package/dist/applicationinsights-react-js.js.map +1 -1
- package/dist/applicationinsights-react-js.min.js +2 -2
- package/dist/applicationinsights-react-js.min.js.map +1 -1
- package/dist/applicationinsights-react-js.rollup.d.ts +114 -0
- package/dist-esm/AppInsightsContext.js +1 -1
- package/dist-esm/AppInsightsErrorBoundary.js +1 -1
- package/dist-esm/Interfaces/IReactExtensionConfig.js +2 -1
- package/dist-esm/Interfaces/IReactExtensionConfig.js.map +1 -1
- package/dist-esm/ReactPlugin.js +1 -1
- package/dist-esm/applicationinsights-react-js.js +1 -1
- package/dist-esm/useTrackEvent.js +1 -1
- package/dist-esm/useTrackMetric.js +1 -1
- package/dist-esm/withAITracking.js +1 -1
- package/package.json +73 -67
- package/src/AppInsightsContext.tsx +3 -2
- package/src/useTrackEvent.ts +5 -3
- package/tsconfig.json +1 -1
- package/types/AppInsightsContext.d.ts +3 -2
- package/types/AppInsightsErrorBoundary.d.ts +1 -1
- package/types/tsdoc-metadata.json +11 -0
- package/types/useTrackEvent.d.ts +7 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - React Plugin, 3.1.
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 3.2.1-nightly.202110-02
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
6
6
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
7
7
|
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
|
8
8
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.Microsoft = global.Microsoft || {}, global.Microsoft.ApplicationInsights = global.Microsoft.ApplicationInsights || {}), global.React));
|
|
9
|
-
}(this, (function (exports, React) { 'use strict';
|
|
9
|
+
})(this, (function (exports, React) { 'use strict';
|
|
10
10
|
|
|
11
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
12
|
|
|
@@ -19,14 +19,12 @@
|
|
|
19
19
|
var d = (function(obj, prop) { /* ai_es3_polyfil getOwnPropertyDescriptor */var func = Object["getOwnPropertyDescriptor"]; if (func) { return func(obj, prop); } return undefined; })(e, k);
|
|
20
20
|
(function(obj, prop, descriptor) { /* ai_es3_polyfil defineProperty */ var func = Object["defineProperty"]; if (func) { try { return func(obj, prop, descriptor); } catch(e) { /* IE8 defines defineProperty, but will throw */ } } if (descriptor && typeof descriptor.value !== undefined) { obj[prop] = descriptor.value; } return obj; })(n, k, d.get ? d : {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () {
|
|
23
|
-
return e[k];
|
|
24
|
-
}
|
|
22
|
+
get: function () { return e[k]; }
|
|
25
23
|
});
|
|
26
24
|
}
|
|
27
25
|
});
|
|
28
26
|
}
|
|
29
|
-
n[
|
|
27
|
+
n["default"] = e;
|
|
30
28
|
return n;
|
|
31
29
|
}
|
|
32
30
|
|
|
@@ -441,14 +439,13 @@
|
|
|
441
439
|
InvalidInstrumentationKey: 100,
|
|
442
440
|
CannotParseAiBlobValue: 101,
|
|
443
441
|
InvalidContentBlob: 102,
|
|
444
|
-
TrackPageActionEventFailed: 103
|
|
442
|
+
TrackPageActionEventFailed: 103,
|
|
443
|
+
FailedAddingCustomDefinedRequestContext: 104
|
|
445
444
|
};
|
|
446
445
|
|
|
447
446
|
var strOnPrefix = "on";
|
|
448
447
|
var strAttachEvent = "attachEvent";
|
|
449
448
|
var strAddEventHelper = "addEventListener";
|
|
450
|
-
var strDetachEvent = "detachEvent";
|
|
451
|
-
var strRemoveEventListener = "removeEventListener";
|
|
452
449
|
var _objDefineProperty = ObjDefineProperty;
|
|
453
450
|
function objToString(obj) {
|
|
454
451
|
return ObjProto.toString.call(obj);
|
|
@@ -493,21 +490,6 @@
|
|
|
493
490
|
}
|
|
494
491
|
return result;
|
|
495
492
|
}
|
|
496
|
-
function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
497
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
498
|
-
if (!isNullOrUndefined(obj)) {
|
|
499
|
-
try {
|
|
500
|
-
if (!isNullOrUndefined(obj[strRemoveEventListener])) {
|
|
501
|
-
obj[strRemoveEventListener](eventNameWithoutOn, handlerRef, useCapture);
|
|
502
|
-
}
|
|
503
|
-
else if (!isNullOrUndefined(obj[strDetachEvent])) {
|
|
504
|
-
obj[strDetachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
catch (e) {
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
493
|
function objForEachKey(target, callbackfn) {
|
|
512
494
|
if (target) {
|
|
513
495
|
for (var prop in target) {
|
|
@@ -582,33 +564,45 @@
|
|
|
582
564
|
}
|
|
583
565
|
function arrForEach(arr, callbackfn, thisArg) {
|
|
584
566
|
var len = arr.length;
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
if (
|
|
588
|
-
|
|
567
|
+
try {
|
|
568
|
+
for (var idx = 0; idx < len; idx++) {
|
|
569
|
+
if (idx in arr) {
|
|
570
|
+
if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
|
|
571
|
+
break;
|
|
572
|
+
}
|
|
589
573
|
}
|
|
590
574
|
}
|
|
591
575
|
}
|
|
576
|
+
catch (e) {
|
|
577
|
+
}
|
|
592
578
|
}
|
|
593
579
|
function arrIndexOf(arr, searchElement, fromIndex) {
|
|
594
580
|
var len = arr.length;
|
|
595
581
|
var from = fromIndex || 0;
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
582
|
+
try {
|
|
583
|
+
for (var lp = Math.max(from >= 0 ? from : len - Math.abs(from), 0); lp < len; lp++) {
|
|
584
|
+
if (lp in arr && arr[lp] === searchElement) {
|
|
585
|
+
return lp;
|
|
586
|
+
}
|
|
599
587
|
}
|
|
600
588
|
}
|
|
589
|
+
catch (e) {
|
|
590
|
+
}
|
|
601
591
|
return -1;
|
|
602
592
|
}
|
|
603
593
|
function arrMap(arr, callbackfn, thisArg) {
|
|
604
594
|
var len = arr.length;
|
|
605
595
|
var _this = thisArg || arr;
|
|
606
596
|
var results = new Array(len);
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
597
|
+
try {
|
|
598
|
+
for (var lp = 0; lp < len; lp++) {
|
|
599
|
+
if (lp in arr) {
|
|
600
|
+
results[lp] = callbackfn.call(_this, arr[lp], arr);
|
|
601
|
+
}
|
|
610
602
|
}
|
|
611
603
|
}
|
|
604
|
+
catch (e) {
|
|
605
|
+
}
|
|
612
606
|
return results;
|
|
613
607
|
}
|
|
614
608
|
function arrReduce(arr, callbackfn, initialValue) {
|
|
@@ -1099,7 +1093,7 @@
|
|
|
1099
1093
|
catch (error) {
|
|
1100
1094
|
var hasRun = _nextProxy && _nextProxy._hasRun;
|
|
1101
1095
|
if (!_nextProxy || !hasRun) {
|
|
1102
|
-
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + error);
|
|
1096
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
|
|
1103
1097
|
}
|
|
1104
1098
|
if (_nextProxy && !hasRun) {
|
|
1105
1099
|
_nextProxy.processTelemetry(env, itemCtx);
|
|
@@ -1393,6 +1387,7 @@
|
|
|
1393
1387
|
_enabled = value !== false;
|
|
1394
1388
|
},
|
|
1395
1389
|
set: function (name, value, maxAgeSec, domain, path) {
|
|
1390
|
+
var result = false;
|
|
1396
1391
|
if (_isMgrEnabled(cookieMgr)) {
|
|
1397
1392
|
var values = {};
|
|
1398
1393
|
var theValue = strTrim(value || strEmpty);
|
|
@@ -1430,7 +1425,9 @@
|
|
|
1430
1425
|
setValue(values, "path", path || _path, null, isUndefined);
|
|
1431
1426
|
var setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
|
|
1432
1427
|
setCookieFn(name, _formatCookieValue(theValue, values));
|
|
1428
|
+
result = true;
|
|
1433
1429
|
}
|
|
1430
|
+
return result;
|
|
1434
1431
|
},
|
|
1435
1432
|
get: function (name) {
|
|
1436
1433
|
var value = strEmpty;
|
|
@@ -1440,11 +1437,15 @@
|
|
|
1440
1437
|
return value;
|
|
1441
1438
|
},
|
|
1442
1439
|
del: function (name, path) {
|
|
1440
|
+
var result = false;
|
|
1443
1441
|
if (_isMgrEnabled(cookieMgr)) {
|
|
1444
|
-
cookieMgr.purge(name, path);
|
|
1442
|
+
result = cookieMgr.purge(name, path);
|
|
1445
1443
|
}
|
|
1444
|
+
return result;
|
|
1446
1445
|
},
|
|
1447
1446
|
purge: function (name, path) {
|
|
1447
|
+
var _a;
|
|
1448
|
+
var result = false;
|
|
1448
1449
|
if (areCookiesSupported(logger)) {
|
|
1449
1450
|
var values = (_a = {},
|
|
1450
1451
|
_a["path"] = path ? path : "/",
|
|
@@ -1455,8 +1456,9 @@
|
|
|
1455
1456
|
}
|
|
1456
1457
|
var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
|
|
1457
1458
|
delCookie(name, _formatCookieValue(strEmpty, values));
|
|
1459
|
+
result = true;
|
|
1458
1460
|
}
|
|
1459
|
-
|
|
1461
|
+
return result;
|
|
1460
1462
|
}
|
|
1461
1463
|
};
|
|
1462
1464
|
cookieMgr[strConfigCookieMgr] = cookieMgr;
|
|
@@ -1625,7 +1627,7 @@
|
|
|
1625
1627
|
}
|
|
1626
1628
|
var doc = getDocument();
|
|
1627
1629
|
if (doc) {
|
|
1628
|
-
result =
|
|
1630
|
+
result = attachEvent(doc, eventName, callback) || result;
|
|
1629
1631
|
}
|
|
1630
1632
|
return result;
|
|
1631
1633
|
}
|
|
@@ -1717,12 +1719,6 @@
|
|
|
1717
1719
|
generateW3CId: generateW3CId
|
|
1718
1720
|
};
|
|
1719
1721
|
var GuidRegex = /[xy]/g;
|
|
1720
|
-
var EventHelper = {
|
|
1721
|
-
Attach: attachEvent,
|
|
1722
|
-
AttachEvent: attachEvent,
|
|
1723
|
-
Detach: detachEvent,
|
|
1724
|
-
DetachEvent: detachEvent
|
|
1725
|
-
};
|
|
1726
1722
|
function _legacyCookieMgr(config, logger) {
|
|
1727
1723
|
var cookieMgr = _gblCookieMgr(config, logger);
|
|
1728
1724
|
var legacyCanUseCookies = CoreUtils._canUseCookies;
|
|
@@ -1832,6 +1828,7 @@
|
|
|
1832
1828
|
};
|
|
1833
1829
|
return ReactPlugin;
|
|
1834
1830
|
}(BaseTelemetryPlugin));
|
|
1831
|
+
var ReactPlugin$1 = ReactPlugin;
|
|
1835
1832
|
|
|
1836
1833
|
function withAITracking(reactPlugin, Component, componentName, className) {
|
|
1837
1834
|
if (componentName === undefined || componentName === null || typeof componentName !== 'string') {
|
|
@@ -1943,12 +1940,13 @@
|
|
|
1943
1940
|
AppInsightsErrorBoundary.prototype.render = function () {
|
|
1944
1941
|
if (this.state.hasError) {
|
|
1945
1942
|
var onError = this.props.onError;
|
|
1946
|
-
return React__default[
|
|
1943
|
+
return React__default["default"].createElement(onError);
|
|
1947
1944
|
}
|
|
1948
1945
|
return this.props.children;
|
|
1949
1946
|
};
|
|
1950
1947
|
return AppInsightsErrorBoundary;
|
|
1951
|
-
}(React__default[
|
|
1948
|
+
}(React__default["default"].Component));
|
|
1949
|
+
var AppInsightsErrorBoundary$1 = AppInsightsErrorBoundary;
|
|
1952
1950
|
|
|
1953
1951
|
var AppInsightsContext = React.createContext(undefined);
|
|
1954
1952
|
var useAppInsightsContext = function () { return React.useContext(AppInsightsContext); };
|
|
@@ -2034,16 +2032,17 @@
|
|
|
2034
2032
|
};
|
|
2035
2033
|
return trackActivity;
|
|
2036
2034
|
};
|
|
2035
|
+
var useComponentTracking$1 = useComponentTracking;
|
|
2037
2036
|
|
|
2038
2037
|
exports.AppInsightsContext = AppInsightsContext;
|
|
2039
|
-
exports.AppInsightsErrorBoundary = AppInsightsErrorBoundary;
|
|
2040
|
-
exports.ReactPlugin = ReactPlugin;
|
|
2038
|
+
exports.AppInsightsErrorBoundary = AppInsightsErrorBoundary$1;
|
|
2039
|
+
exports.ReactPlugin = ReactPlugin$1;
|
|
2041
2040
|
exports.useAppInsightsContext = useAppInsightsContext;
|
|
2042
2041
|
exports.useTrackEvent = useCustomEvent;
|
|
2043
|
-
exports.useTrackMetric = useComponentTracking;
|
|
2042
|
+
exports.useTrackMetric = useComponentTracking$1;
|
|
2044
2043
|
exports.withAITracking = withAITracking;
|
|
2045
2044
|
|
|
2046
2045
|
(function(obj, prop, descriptor) { /* ai_es3_polyfil defineProperty */ var func = Object["defineProperty"]; if (func) { try { return func(obj, prop, descriptor); } catch(e) { /* IE8 defines defineProperty, but will throw */ } } if (descriptor && typeof descriptor.value !== undefined) { obj[prop] = descriptor.value; } return obj; })(exports, '__esModule', { value: true });
|
|
2047
2046
|
|
|
2048
|
-
}))
|
|
2047
|
+
}));
|
|
2049
2048
|
//# sourceMappingURL=applicationinsights-react-js.js.map
|