@microsoft/applicationinsights-react-js 3.3.4-nightly.2205-08 → 3.3.4

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
- * Application Insights JavaScript SDK - React Plugin, 3.3.4-nightly.2205-08
2
+ * Application Insights JavaScript SDK - React Plugin, 3.3.4
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -1123,7 +1123,7 @@
1123
1123
  }
1124
1124
 
1125
1125
  var _objDefineProperty = ObjDefineProperty;
1126
- var version = "2.8.4-nightly.2205-08";
1126
+ var version = "2.8.4";
1127
1127
  var instanceName = "." + newId(6);
1128
1128
  var _dataUid = 0;
1129
1129
  function _createAccessor(target, prop, value) {
@@ -1194,6 +1194,251 @@
1194
1194
  return data;
1195
1195
  }
1196
1196
 
1197
+ var strToGMTString = "toGMTString";
1198
+ var strToUTCString = "toUTCString";
1199
+ var strCookie = "cookie";
1200
+ var strExpires = "expires";
1201
+ var strEnabled = "enabled";
1202
+ var strIsCookieUseDisabled = "isCookieUseDisabled";
1203
+ var strDisableCookiesUsage = "disableCookiesUsage";
1204
+ var strConfigCookieMgr = "_ckMgr";
1205
+ var _supportsCookies = null;
1206
+ var _allowUaSameSite = null;
1207
+ var _parsedCookieValue = null;
1208
+ var _doc = getDocument();
1209
+ var _cookieCache = {};
1210
+ var _globalCookieConfig = {};
1211
+ function _gblCookieMgr(config, logger) {
1212
+ var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
1213
+ if (!inst) {
1214
+ inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
1215
+ _globalCookieConfig[strConfigCookieMgr] = inst;
1216
+ }
1217
+ return inst;
1218
+ }
1219
+ function _isMgrEnabled(cookieMgr) {
1220
+ if (cookieMgr) {
1221
+ return cookieMgr.isEnabled();
1222
+ }
1223
+ return true;
1224
+ }
1225
+ function _createCookieMgrConfig(rootConfig) {
1226
+ var cookieMgrCfg = rootConfig.cookieCfg = rootConfig.cookieCfg || {};
1227
+ setValue(cookieMgrCfg, "domain", rootConfig.cookieDomain, isNotNullOrUndefined, isNullOrUndefined);
1228
+ setValue(cookieMgrCfg, "path", rootConfig.cookiePath || "/", null, isNullOrUndefined);
1229
+ if (isNullOrUndefined(cookieMgrCfg[strEnabled])) {
1230
+ var cookieEnabled = void 0;
1231
+ if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
1232
+ cookieEnabled = !rootConfig[strIsCookieUseDisabled];
1233
+ }
1234
+ if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
1235
+ cookieEnabled = !rootConfig[strDisableCookiesUsage];
1236
+ }
1237
+ cookieMgrCfg[strEnabled] = cookieEnabled;
1238
+ }
1239
+ return cookieMgrCfg;
1240
+ }
1241
+ function safeGetCookieMgr(core, config) {
1242
+ var cookieMgr;
1243
+ if (core) {
1244
+ cookieMgr = core.getCookieMgr();
1245
+ }
1246
+ else if (config) {
1247
+ var cookieCfg = config.cookieCfg;
1248
+ if (cookieCfg[strConfigCookieMgr]) {
1249
+ cookieMgr = cookieCfg[strConfigCookieMgr];
1250
+ }
1251
+ else {
1252
+ cookieMgr = createCookieMgr(config);
1253
+ }
1254
+ }
1255
+ if (!cookieMgr) {
1256
+ cookieMgr = _gblCookieMgr(config, (core || {}).logger);
1257
+ }
1258
+ return cookieMgr;
1259
+ }
1260
+ function createCookieMgr(rootConfig, logger) {
1261
+ var cookieMgrConfig = _createCookieMgrConfig(rootConfig || _globalCookieConfig);
1262
+ var _path = cookieMgrConfig.path || "/";
1263
+ var _domain = cookieMgrConfig.domain;
1264
+ var _enabled = cookieMgrConfig[strEnabled] !== false;
1265
+ var cookieMgr = {
1266
+ isEnabled: function () {
1267
+ var enabled = _enabled && areCookiesSupported(logger);
1268
+ var gblManager = _globalCookieConfig[strConfigCookieMgr];
1269
+ if (enabled && gblManager && cookieMgr !== gblManager) {
1270
+ enabled = _isMgrEnabled(gblManager);
1271
+ }
1272
+ return enabled;
1273
+ },
1274
+ setEnabled: function (value) {
1275
+ _enabled = value !== false;
1276
+ },
1277
+ set: function (name, value, maxAgeSec, domain, path) {
1278
+ var result = false;
1279
+ if (_isMgrEnabled(cookieMgr)) {
1280
+ var values = {};
1281
+ var theValue = strTrim(value || strEmpty);
1282
+ var idx = theValue.indexOf(";");
1283
+ if (idx !== -1) {
1284
+ theValue = strTrim(value.substring(0, idx));
1285
+ values = _extractParts(value.substring(idx + 1));
1286
+ }
1287
+ setValue(values, "domain", domain || _domain, isTruthy, isUndefined);
1288
+ if (!isNullOrUndefined(maxAgeSec)) {
1289
+ var _isIE = isIE();
1290
+ if (isUndefined(values[strExpires])) {
1291
+ var nowMs = dateNow();
1292
+ var expireMs = nowMs + (maxAgeSec * 1000);
1293
+ if (expireMs > 0) {
1294
+ var expiry = new Date();
1295
+ expiry.setTime(expireMs);
1296
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
1297
+ }
1298
+ }
1299
+ if (!_isIE) {
1300
+ setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
1301
+ }
1302
+ }
1303
+ var location_1 = getLocation();
1304
+ if (location_1 && location_1.protocol === "https:") {
1305
+ setValue(values, "secure", null, null, isUndefined);
1306
+ if (_allowUaSameSite === null) {
1307
+ _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {}).userAgent);
1308
+ }
1309
+ if (_allowUaSameSite) {
1310
+ setValue(values, "SameSite", "None", null, isUndefined);
1311
+ }
1312
+ }
1313
+ setValue(values, "path", path || _path, null, isUndefined);
1314
+ var setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
1315
+ setCookieFn(name, _formatCookieValue(theValue, values));
1316
+ result = true;
1317
+ }
1318
+ return result;
1319
+ },
1320
+ get: function (name) {
1321
+ var value = strEmpty;
1322
+ if (_isMgrEnabled(cookieMgr)) {
1323
+ value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
1324
+ }
1325
+ return value;
1326
+ },
1327
+ del: function (name, path) {
1328
+ var result = false;
1329
+ if (_isMgrEnabled(cookieMgr)) {
1330
+ result = cookieMgr.purge(name, path);
1331
+ }
1332
+ return result;
1333
+ },
1334
+ purge: function (name, path) {
1335
+ var _a;
1336
+ var result = false;
1337
+ if (areCookiesSupported(logger)) {
1338
+ var values = (_a = {},
1339
+ _a["path"] = path ? path : "/",
1340
+ _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
1341
+ _a);
1342
+ if (!isIE()) {
1343
+ values["max-age"] = "0";
1344
+ }
1345
+ var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
1346
+ delCookie(name, _formatCookieValue(strEmpty, values));
1347
+ result = true;
1348
+ }
1349
+ return result;
1350
+ }
1351
+ };
1352
+ cookieMgr[strConfigCookieMgr] = cookieMgr;
1353
+ return cookieMgr;
1354
+ }
1355
+ function areCookiesSupported(logger) {
1356
+ if (_supportsCookies === null) {
1357
+ _supportsCookies = false;
1358
+ try {
1359
+ var doc = _doc || {};
1360
+ _supportsCookies = doc[strCookie] !== undefined;
1361
+ }
1362
+ catch (e) {
1363
+ _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1364
+ }
1365
+ }
1366
+ return _supportsCookies;
1367
+ }
1368
+ function _extractParts(theValue) {
1369
+ var values = {};
1370
+ if (theValue && theValue.length) {
1371
+ var parts = strTrim(theValue).split(";");
1372
+ arrForEach(parts, function (thePart) {
1373
+ thePart = strTrim(thePart || strEmpty);
1374
+ if (thePart) {
1375
+ var idx = thePart.indexOf("=");
1376
+ if (idx === -1) {
1377
+ values[thePart] = null;
1378
+ }
1379
+ else {
1380
+ values[strTrim(thePart.substring(0, idx))] = strTrim(thePart.substring(idx + 1));
1381
+ }
1382
+ }
1383
+ });
1384
+ }
1385
+ return values;
1386
+ }
1387
+ function _formatDate(theDate, func) {
1388
+ if (isFunction(theDate[func])) {
1389
+ return theDate[func]();
1390
+ }
1391
+ return null;
1392
+ }
1393
+ function _formatCookieValue(value, values) {
1394
+ var cookieValue = value || strEmpty;
1395
+ objForEachKey(values, function (name, theValue) {
1396
+ cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
1397
+ });
1398
+ return cookieValue;
1399
+ }
1400
+ function _getCookieValue(name) {
1401
+ var cookieValue = strEmpty;
1402
+ if (_doc) {
1403
+ var theCookie = _doc[strCookie] || strEmpty;
1404
+ if (_parsedCookieValue !== theCookie) {
1405
+ _cookieCache = _extractParts(theCookie);
1406
+ _parsedCookieValue = theCookie;
1407
+ }
1408
+ cookieValue = strTrim(_cookieCache[name] || strEmpty);
1409
+ }
1410
+ return cookieValue;
1411
+ }
1412
+ function _setCookieValue(name, cookieValue) {
1413
+ if (_doc) {
1414
+ _doc[strCookie] = name + "=" + cookieValue;
1415
+ }
1416
+ }
1417
+ function uaDisallowsSameSiteNone(userAgent) {
1418
+ if (!isString(userAgent)) {
1419
+ return false;
1420
+ }
1421
+ if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
1422
+ return true;
1423
+ }
1424
+ if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
1425
+ return true;
1426
+ }
1427
+ if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
1428
+ return true;
1429
+ }
1430
+ if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
1431
+ return true;
1432
+ }
1433
+ if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
1434
+ return true;
1435
+ }
1436
+ if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
1437
+ return true;
1438
+ }
1439
+ return false;
1440
+ }
1441
+
1197
1442
  var pluginStateData = createElmNodeData("plugin");
1198
1443
  function _getPluginState(plugin) {
1199
1444
  return pluginStateData.get(plugin, "state", {}, true);
@@ -1547,251 +1792,6 @@
1547
1792
  return objFreeze(proxyChain);
1548
1793
  }
1549
1794
 
1550
- var strToGMTString = "toGMTString";
1551
- var strToUTCString = "toUTCString";
1552
- var strCookie = "cookie";
1553
- var strExpires = "expires";
1554
- var strEnabled = "enabled";
1555
- var strIsCookieUseDisabled = "isCookieUseDisabled";
1556
- var strDisableCookiesUsage = "disableCookiesUsage";
1557
- var strConfigCookieMgr = "_ckMgr";
1558
- var _supportsCookies = null;
1559
- var _allowUaSameSite = null;
1560
- var _parsedCookieValue = null;
1561
- var _doc = getDocument();
1562
- var _cookieCache = {};
1563
- var _globalCookieConfig = {};
1564
- function _gblCookieMgr(config, logger) {
1565
- var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
1566
- if (!inst) {
1567
- inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
1568
- _globalCookieConfig[strConfigCookieMgr] = inst;
1569
- }
1570
- return inst;
1571
- }
1572
- function _isMgrEnabled(cookieMgr) {
1573
- if (cookieMgr) {
1574
- return cookieMgr.isEnabled();
1575
- }
1576
- return true;
1577
- }
1578
- function _createCookieMgrConfig(rootConfig) {
1579
- var cookieMgrCfg = rootConfig.cookieCfg = rootConfig.cookieCfg || {};
1580
- setValue(cookieMgrCfg, "domain", rootConfig.cookieDomain, isNotNullOrUndefined, isNullOrUndefined);
1581
- setValue(cookieMgrCfg, "path", rootConfig.cookiePath || "/", null, isNullOrUndefined);
1582
- if (isNullOrUndefined(cookieMgrCfg[strEnabled])) {
1583
- var cookieEnabled = void 0;
1584
- if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
1585
- cookieEnabled = !rootConfig[strIsCookieUseDisabled];
1586
- }
1587
- if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
1588
- cookieEnabled = !rootConfig[strDisableCookiesUsage];
1589
- }
1590
- cookieMgrCfg[strEnabled] = cookieEnabled;
1591
- }
1592
- return cookieMgrCfg;
1593
- }
1594
- function safeGetCookieMgr(core, config) {
1595
- var cookieMgr;
1596
- if (core) {
1597
- cookieMgr = core.getCookieMgr();
1598
- }
1599
- else if (config) {
1600
- var cookieCfg = config.cookieCfg;
1601
- if (cookieCfg[strConfigCookieMgr]) {
1602
- cookieMgr = cookieCfg[strConfigCookieMgr];
1603
- }
1604
- else {
1605
- cookieMgr = createCookieMgr(config);
1606
- }
1607
- }
1608
- if (!cookieMgr) {
1609
- cookieMgr = _gblCookieMgr(config, (core || {}).logger);
1610
- }
1611
- return cookieMgr;
1612
- }
1613
- function createCookieMgr(rootConfig, logger) {
1614
- var cookieMgrConfig = _createCookieMgrConfig(rootConfig || _globalCookieConfig);
1615
- var _path = cookieMgrConfig.path || "/";
1616
- var _domain = cookieMgrConfig.domain;
1617
- var _enabled = cookieMgrConfig[strEnabled] !== false;
1618
- var cookieMgr = {
1619
- isEnabled: function () {
1620
- var enabled = _enabled && areCookiesSupported(logger);
1621
- var gblManager = _globalCookieConfig[strConfigCookieMgr];
1622
- if (enabled && gblManager && cookieMgr !== gblManager) {
1623
- enabled = _isMgrEnabled(gblManager);
1624
- }
1625
- return enabled;
1626
- },
1627
- setEnabled: function (value) {
1628
- _enabled = value !== false;
1629
- },
1630
- set: function (name, value, maxAgeSec, domain, path) {
1631
- var result = false;
1632
- if (_isMgrEnabled(cookieMgr)) {
1633
- var values = {};
1634
- var theValue = strTrim(value || strEmpty);
1635
- var idx = theValue.indexOf(";");
1636
- if (idx !== -1) {
1637
- theValue = strTrim(value.substring(0, idx));
1638
- values = _extractParts(value.substring(idx + 1));
1639
- }
1640
- setValue(values, "domain", domain || _domain, isTruthy, isUndefined);
1641
- if (!isNullOrUndefined(maxAgeSec)) {
1642
- var _isIE = isIE();
1643
- if (isUndefined(values[strExpires])) {
1644
- var nowMs = dateNow();
1645
- var expireMs = nowMs + (maxAgeSec * 1000);
1646
- if (expireMs > 0) {
1647
- var expiry = new Date();
1648
- expiry.setTime(expireMs);
1649
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
1650
- }
1651
- }
1652
- if (!_isIE) {
1653
- setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
1654
- }
1655
- }
1656
- var location_1 = getLocation();
1657
- if (location_1 && location_1.protocol === "https:") {
1658
- setValue(values, "secure", null, null, isUndefined);
1659
- if (_allowUaSameSite === null) {
1660
- _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {}).userAgent);
1661
- }
1662
- if (_allowUaSameSite) {
1663
- setValue(values, "SameSite", "None", null, isUndefined);
1664
- }
1665
- }
1666
- setValue(values, "path", path || _path, null, isUndefined);
1667
- var setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
1668
- setCookieFn(name, _formatCookieValue(theValue, values));
1669
- result = true;
1670
- }
1671
- return result;
1672
- },
1673
- get: function (name) {
1674
- var value = strEmpty;
1675
- if (_isMgrEnabled(cookieMgr)) {
1676
- value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
1677
- }
1678
- return value;
1679
- },
1680
- del: function (name, path) {
1681
- var result = false;
1682
- if (_isMgrEnabled(cookieMgr)) {
1683
- result = cookieMgr.purge(name, path);
1684
- }
1685
- return result;
1686
- },
1687
- purge: function (name, path) {
1688
- var _a;
1689
- var result = false;
1690
- if (areCookiesSupported(logger)) {
1691
- var values = (_a = {},
1692
- _a["path"] = path ? path : "/",
1693
- _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
1694
- _a);
1695
- if (!isIE()) {
1696
- values["max-age"] = "0";
1697
- }
1698
- var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
1699
- delCookie(name, _formatCookieValue(strEmpty, values));
1700
- result = true;
1701
- }
1702
- return result;
1703
- }
1704
- };
1705
- cookieMgr[strConfigCookieMgr] = cookieMgr;
1706
- return cookieMgr;
1707
- }
1708
- function areCookiesSupported(logger) {
1709
- if (_supportsCookies === null) {
1710
- _supportsCookies = false;
1711
- try {
1712
- var doc = _doc || {};
1713
- _supportsCookies = doc[strCookie] !== undefined;
1714
- }
1715
- catch (e) {
1716
- _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1717
- }
1718
- }
1719
- return _supportsCookies;
1720
- }
1721
- function _extractParts(theValue) {
1722
- var values = {};
1723
- if (theValue && theValue.length) {
1724
- var parts = strTrim(theValue).split(";");
1725
- arrForEach(parts, function (thePart) {
1726
- thePart = strTrim(thePart || strEmpty);
1727
- if (thePart) {
1728
- var idx = thePart.indexOf("=");
1729
- if (idx === -1) {
1730
- values[thePart] = null;
1731
- }
1732
- else {
1733
- values[strTrim(thePart.substring(0, idx))] = strTrim(thePart.substring(idx + 1));
1734
- }
1735
- }
1736
- });
1737
- }
1738
- return values;
1739
- }
1740
- function _formatDate(theDate, func) {
1741
- if (isFunction(theDate[func])) {
1742
- return theDate[func]();
1743
- }
1744
- return null;
1745
- }
1746
- function _formatCookieValue(value, values) {
1747
- var cookieValue = value || strEmpty;
1748
- objForEachKey(values, function (name, theValue) {
1749
- cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
1750
- });
1751
- return cookieValue;
1752
- }
1753
- function _getCookieValue(name) {
1754
- var cookieValue = strEmpty;
1755
- if (_doc) {
1756
- var theCookie = _doc[strCookie] || strEmpty;
1757
- if (_parsedCookieValue !== theCookie) {
1758
- _cookieCache = _extractParts(theCookie);
1759
- _parsedCookieValue = theCookie;
1760
- }
1761
- cookieValue = strTrim(_cookieCache[name] || strEmpty);
1762
- }
1763
- return cookieValue;
1764
- }
1765
- function _setCookieValue(name, cookieValue) {
1766
- if (_doc) {
1767
- _doc[strCookie] = name + "=" + cookieValue;
1768
- }
1769
- }
1770
- function uaDisallowsSameSiteNone(userAgent) {
1771
- if (!isString(userAgent)) {
1772
- return false;
1773
- }
1774
- if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
1775
- return true;
1776
- }
1777
- if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
1778
- return true;
1779
- }
1780
- if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
1781
- return true;
1782
- }
1783
- if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
1784
- return true;
1785
- }
1786
- if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
1787
- return true;
1788
- }
1789
- if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
1790
- return true;
1791
- }
1792
- return false;
1793
- }
1794
-
1795
1795
  var strExtensionConfig = "extensionConfig";
1796
1796
 
1797
1797
  function createUnloadHandlerContainer() {