@microsoft/applicationinsights-web 2.8.0-beta.2202-06 → 2.8.0-beta.2203-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.
Files changed (51) hide show
  1. package/README.md +1 -0
  2. package/browser/{ai.2.8.0-beta.2202-06.cjs.js → ai.2.8.0-beta.2203-02.cjs.js} +876 -515
  3. package/browser/ai.2.8.0-beta.2203-02.cjs.js.map +1 -0
  4. package/browser/ai.2.8.0-beta.2203-02.cjs.min.js +6 -0
  5. package/browser/ai.2.8.0-beta.2203-02.cjs.min.js.map +1 -0
  6. package/browser/{ai.2.8.0-beta.2202-06.gbl.js → ai.2.8.0-beta.2203-02.gbl.js} +876 -515
  7. package/browser/ai.2.8.0-beta.2203-02.gbl.js.map +1 -0
  8. package/browser/ai.2.8.0-beta.2203-02.gbl.min.js +6 -0
  9. package/browser/ai.2.8.0-beta.2203-02.gbl.min.js.map +1 -0
  10. package/browser/ai.2.8.0-beta.2203-02.integrity.json +66 -0
  11. package/browser/{ai.2.8.0-beta.2202-06.js → ai.2.8.0-beta.2203-02.js} +876 -515
  12. package/browser/ai.2.8.0-beta.2203-02.js.map +1 -0
  13. package/browser/ai.2.8.0-beta.2203-02.min.js +6 -0
  14. package/browser/ai.2.8.0-beta.2203-02.min.js.map +1 -0
  15. package/browser/ai.2.cjs.js +875 -514
  16. package/browser/ai.2.cjs.js.map +1 -1
  17. package/browser/ai.2.cjs.min.js +2 -2
  18. package/browser/ai.2.cjs.min.js.map +1 -1
  19. package/browser/ai.2.gbl.js +875 -514
  20. package/browser/ai.2.gbl.js.map +1 -1
  21. package/browser/ai.2.gbl.min.js +2 -2
  22. package/browser/ai.2.gbl.min.js.map +1 -1
  23. package/browser/ai.2.js +875 -514
  24. package/browser/ai.2.js.map +1 -1
  25. package/browser/ai.2.min.js +2 -2
  26. package/browser/ai.2.min.js.map +1 -1
  27. package/dist/applicationinsights-web.api.json +328 -568
  28. package/dist/applicationinsights-web.api.md +44 -32
  29. package/dist/applicationinsights-web.d.ts +298 -93
  30. package/dist/applicationinsights-web.js +941 -578
  31. package/dist/applicationinsights-web.js.map +1 -1
  32. package/dist/applicationinsights-web.min.js +2 -2
  33. package/dist/applicationinsights-web.min.js.map +1 -1
  34. package/dist/applicationinsights-web.rollup.d.ts +298 -93
  35. package/dist-esm/ApplicationInsightsContainer.js +1 -1
  36. package/dist-esm/ApplicationInsightsDeprecated.js +1 -1
  37. package/dist-esm/Init.js +1 -1
  38. package/dist-esm/Initialization.js +1 -1
  39. package/dist-esm/applicationinsights-web.js +1 -1
  40. package/package.json +7 -7
  41. package/types/Initialization.d.ts +6 -2
  42. package/browser/ai.2.8.0-beta.2202-06.cjs.js.map +0 -1
  43. package/browser/ai.2.8.0-beta.2202-06.cjs.min.js +0 -6
  44. package/browser/ai.2.8.0-beta.2202-06.cjs.min.js.map +0 -1
  45. package/browser/ai.2.8.0-beta.2202-06.gbl.js.map +0 -1
  46. package/browser/ai.2.8.0-beta.2202-06.gbl.min.js +0 -6
  47. package/browser/ai.2.8.0-beta.2202-06.gbl.min.js.map +0 -1
  48. package/browser/ai.2.8.0-beta.2202-06.integrity.json +0 -66
  49. package/browser/ai.2.8.0-beta.2202-06.js.map +0 -1
  50. package/browser/ai.2.8.0-beta.2202-06.min.js +0 -6
  51. package/browser/ai.2.8.0-beta.2202-06.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Web, 2.8.0-beta.2202-06
2
+ * Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -350,99 +350,26 @@
350
350
  };
351
351
  dynamicProto[DynProtoDefaultOptions] = perfDefaults;
352
352
 
353
- exports.LoggingSeverity = void 0;
354
- (function (LoggingSeverity) {
355
- LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
356
- LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
357
- })(exports.LoggingSeverity || (exports.LoggingSeverity = {}));
358
- var _InternalMessageId = {
359
- BrowserDoesNotSupportLocalStorage: 0,
360
- BrowserCannotReadLocalStorage: 1,
361
- BrowserCannotReadSessionStorage: 2,
362
- BrowserCannotWriteLocalStorage: 3,
363
- BrowserCannotWriteSessionStorage: 4,
364
- BrowserFailedRemovalFromLocalStorage: 5,
365
- BrowserFailedRemovalFromSessionStorage: 6,
366
- CannotSendEmptyTelemetry: 7,
367
- ClientPerformanceMathError: 8,
368
- ErrorParsingAISessionCookie: 9,
369
- ErrorPVCalc: 10,
370
- ExceptionWhileLoggingError: 11,
371
- FailedAddingTelemetryToBuffer: 12,
372
- FailedMonitorAjaxAbort: 13,
373
- FailedMonitorAjaxDur: 14,
374
- FailedMonitorAjaxOpen: 15,
375
- FailedMonitorAjaxRSC: 16,
376
- FailedMonitorAjaxSend: 17,
377
- FailedMonitorAjaxGetCorrelationHeader: 18,
378
- FailedToAddHandlerForOnBeforeUnload: 19,
379
- FailedToSendQueuedTelemetry: 20,
380
- FailedToReportDataLoss: 21,
381
- FlushFailed: 22,
382
- MessageLimitPerPVExceeded: 23,
383
- MissingRequiredFieldSpecification: 24,
384
- NavigationTimingNotSupported: 25,
385
- OnError: 26,
386
- SessionRenewalDateIsZero: 27,
387
- SenderNotInitialized: 28,
388
- StartTrackEventFailed: 29,
389
- StopTrackEventFailed: 30,
390
- StartTrackFailed: 31,
391
- StopTrackFailed: 32,
392
- TelemetrySampledAndNotSent: 33,
393
- TrackEventFailed: 34,
394
- TrackExceptionFailed: 35,
395
- TrackMetricFailed: 36,
396
- TrackPVFailed: 37,
397
- TrackPVFailedCalc: 38,
398
- TrackTraceFailed: 39,
399
- TransmissionFailed: 40,
400
- FailedToSetStorageBuffer: 41,
401
- FailedToRestoreStorageBuffer: 42,
402
- InvalidBackendResponse: 43,
403
- FailedToFixDepricatedValues: 44,
404
- InvalidDurationValue: 45,
405
- TelemetryEnvelopeInvalid: 46,
406
- CreateEnvelopeError: 47,
407
- CannotSerializeObject: 48,
408
- CannotSerializeObjectNonSerializable: 49,
409
- CircularReferenceDetected: 50,
410
- ClearAuthContextFailed: 51,
411
- ExceptionTruncated: 52,
412
- IllegalCharsInName: 53,
413
- ItemNotInArray: 54,
414
- MaxAjaxPerPVExceeded: 55,
415
- MessageTruncated: 56,
416
- NameTooLong: 57,
417
- SampleRateOutOfRange: 58,
418
- SetAuthContextFailed: 59,
419
- SetAuthContextFailedAccountName: 60,
420
- StringValueTooLong: 61,
421
- StartCalledMoreThanOnce: 62,
422
- StopCalledWithoutStart: 63,
423
- TelemetryInitializerFailed: 64,
424
- TrackArgumentsNotSpecified: 65,
425
- UrlTooLong: 66,
426
- SessionStorageBufferFull: 67,
427
- CannotAccessCookie: 68,
428
- IdTooLong: 69,
429
- InvalidEvent: 70,
430
- FailedMonitorAjaxSetRequestHeader: 71,
431
- SendBrowserInfoOnUserInit: 72,
432
- PluginException: 73,
433
- NotificationException: 74,
434
- SnippetScriptLoadFailure: 99,
435
- InvalidInstrumentationKey: 100,
436
- CannotParseAiBlobValue: 101,
437
- InvalidContentBlob: 102,
438
- TrackPageActionEventFailed: 103,
439
- FailedAddingCustomDefinedRequestContext: 104,
440
- InMemoryStorageBufferFull: 105
441
- };
353
+ var strEmpty$1 = "";
354
+ var strProcessTelemetry = "processTelemetry";
355
+ var strPriority = "priority";
356
+ var strSetNextPlugin = "setNextPlugin";
357
+ var strIsInitialized = "isInitialized";
358
+ var strTeardown = "teardown";
359
+ var strCore = "core";
360
+ var strDisabled = "disabled";
361
+ var strDoTeardown = "_doTeardown";
362
+ var strProcessNext = "processNext";
363
+ var strResume = "resume";
364
+ var strPause = "pause";
365
+ var strNotificationListener = "NotificationListener";
366
+ var strAddNotificationListener = "add" + strNotificationListener;
367
+ var strRemoveNotificationListener = "remove" + strNotificationListener;
368
+ var strEventsSent = "eventsSent";
369
+ var strEventsDiscarded = "eventsDiscarded";
370
+ var strEventsSendRequest = "eventsSendRequest";
371
+ var strPerfEvent = "perfEvent";
442
372
 
443
- var strOnPrefix = "on";
444
- var strAttachEvent = "attachEvent";
445
- var strAddEventHelper = "addEventListener";
446
373
  var strToISOString = "toISOString";
447
374
  var cStrEndsWith = "endsWith";
448
375
  var strIndexOf = "indexOf";
@@ -452,7 +379,7 @@
452
379
  var strToString = "toString";
453
380
  var str__Proto = "__proto__";
454
381
  var strConstructor = "constructor";
455
- var _objDefineProperty = ObjDefineProperty;
382
+ var _objDefineProperty$1 = ObjDefineProperty;
456
383
  var _objFreeze = ObjClass.freeze;
457
384
  var _objKeys = ObjClass.keys;
458
385
  var StringProto = String[strShimPrototype];
@@ -501,25 +428,6 @@
501
428
  function isFunction(value) {
502
429
  return !!(value && typeof value === strShimFunction);
503
430
  }
504
- function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
505
- if (useCapture === void 0) { useCapture = false; }
506
- var result = false;
507
- if (!isNullOrUndefined(obj)) {
508
- try {
509
- if (!isNullOrUndefined(obj[strAddEventHelper])) {
510
- obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
511
- result = true;
512
- }
513
- else if (!isNullOrUndefined(obj[strAttachEvent])) {
514
- obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
515
- result = true;
516
- }
517
- }
518
- catch (e) {
519
- }
520
- }
521
- return result;
522
- }
523
431
  function normalizeJsName(name) {
524
432
  var value = name;
525
433
  if (value && isString(value)) {
@@ -751,7 +659,7 @@
751
659
  return result;
752
660
  }
753
661
  function objDefineAccessors(target, prop, getProp, setProp) {
754
- if (_objDefineProperty) {
662
+ if (_objDefineProperty$1) {
755
663
  try {
756
664
  var descriptor = {
757
665
  enumerable: true,
@@ -763,7 +671,7 @@
763
671
  if (setProp) {
764
672
  descriptor.set = setProp;
765
673
  }
766
- _objDefineProperty(target, prop, descriptor);
674
+ _objDefineProperty$1(target, prop, descriptor);
767
675
  return true;
768
676
  }
769
677
  catch (e) {
@@ -783,7 +691,7 @@
783
691
  if (isError(object)) {
784
692
  return object.name;
785
693
  }
786
- return "";
694
+ return strEmpty$1;
787
695
  }
788
696
  function setValue(target, field, value, valChk, srcChk) {
789
697
  var theValue = value;
@@ -900,6 +808,17 @@
900
808
  return class_1;
901
809
  }());
902
810
  }
811
+ function createEnumStyle(values) {
812
+ var enumClass = {};
813
+ objForEachKey(values, function (field, value) {
814
+ enumClass[field] = value;
815
+ if (!isUndefined(enumClass[value])) {
816
+ throwError("Value: [" + value + "] already exists for " + field);
817
+ }
818
+ enumClass[value] = field;
819
+ });
820
+ return objFreeze(enumClass);
821
+ }
903
822
  function optimizeObject(theObject) {
904
823
  if (theObject && ObjAssign) {
905
824
  theObject = ObjClass(ObjAssign({}, theObject));
@@ -1089,7 +1008,7 @@
1089
1008
  var nav = getNavigator();
1090
1009
  if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
1091
1010
  _navUserAgentCheck = nav.userAgent;
1092
- var userAgent = (_navUserAgentCheck || "").toLowerCase();
1011
+ var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
1093
1012
  _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
1094
1013
  }
1095
1014
  return _isTrident;
@@ -1098,9 +1017,9 @@
1098
1017
  if (userAgentStr === void 0) { userAgentStr = null; }
1099
1018
  if (!userAgentStr) {
1100
1019
  var navigator_1 = getNavigator() || {};
1101
- userAgentStr = navigator_1 ? (navigator_1.userAgent || "").toLowerCase() : "";
1020
+ userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty$1).toLowerCase() : strEmpty$1;
1102
1021
  }
1103
- var ua = (userAgentStr || "").toLowerCase();
1022
+ var ua = (userAgentStr || strEmpty$1).toLowerCase();
1104
1023
  if (strContains(ua, strMsie)) {
1105
1024
  var doc = getDocument() || {};
1106
1025
  return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
@@ -1115,7 +1034,7 @@
1115
1034
  }
1116
1035
  function dumpObj(object) {
1117
1036
  var objectTypeDump = Object[strShimPrototype].toString.call(object);
1118
- var propertyValueDump = "";
1037
+ var propertyValueDump = strEmpty$1;
1119
1038
  if (objectTypeDump === "[object Error]") {
1120
1039
  propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
1121
1040
  }
@@ -1209,9 +1128,9 @@
1209
1128
  var strWarnToConsole = "warnToConsole";
1210
1129
  function _sanitizeDiagnosticText(text) {
1211
1130
  if (text) {
1212
- return "\"" + text.replace(/\"/g, "") + "\"";
1131
+ return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
1213
1132
  }
1214
- return "";
1133
+ return strEmpty$1;
1215
1134
  }
1216
1135
  function _logToConsole(func, message) {
1217
1136
  var theConsole = getConsole();
@@ -1233,12 +1152,12 @@
1233
1152
  _self.message =
1234
1153
  (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
1235
1154
  msgId;
1236
- var strProps = "";
1155
+ var strProps = strEmpty$1;
1237
1156
  if (hasJSON()) {
1238
1157
  strProps = getJSON().stringify(properties);
1239
1158
  }
1240
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : "") +
1241
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : "");
1159
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
1160
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
1242
1161
  _self.message += diagnosticText;
1243
1162
  }
1244
1163
  _InternalLogMessage.dataType = "MessageData";
@@ -1268,7 +1187,7 @@
1268
1187
  throw message;
1269
1188
  }
1270
1189
  else {
1271
- var logFunc = severity === exports.LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
1190
+ var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
1272
1191
  if (!isUndefined(message.message)) {
1273
1192
  var logLevel = _self.consoleLoggingLevel();
1274
1193
  if (isUserAct) {
@@ -1286,7 +1205,7 @@
1286
1205
  _self.logInternalMessage(severity, message);
1287
1206
  }
1288
1207
  else {
1289
- _debugExtMsg("throw" + (severity === exports.LoggingSeverity.CRITICAL ? "Critical" : "Warning"), message);
1208
+ _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
1290
1209
  }
1291
1210
  }
1292
1211
  };
@@ -1318,13 +1237,13 @@
1318
1237
  if (severity <= _self.telemetryLoggingLevel()) {
1319
1238
  _self.queue.push(message);
1320
1239
  _messageCount++;
1321
- _debugExtMsg((severity === exports.LoggingSeverity.CRITICAL ? "error" : "warn"), message);
1240
+ _debugExtMsg((severity === 1 ? "error" : "warn"), message);
1322
1241
  }
1323
1242
  if (_messageCount === _self.maxInternalMessageLimit()) {
1324
1243
  var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
1325
- var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
1244
+ var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
1326
1245
  _self.queue.push(throttleMessage);
1327
- if (severity === exports.LoggingSeverity.CRITICAL) {
1246
+ if (severity === 1 ) {
1328
1247
  _self.errorToConsole(throttleLimitMessage);
1329
1248
  }
1330
1249
  else {
@@ -1498,6 +1417,217 @@
1498
1417
  return _defaultPerfManager;
1499
1418
  }
1500
1419
 
1420
+ var UInt32Mask = 0x100000000;
1421
+ var MaxUInt32 = 0xffffffff;
1422
+ var _mwcSeeded = false;
1423
+ var _mwcW = 123456789;
1424
+ var _mwcZ = 987654321;
1425
+ function _mwcSeed(seedValue) {
1426
+ if (seedValue < 0) {
1427
+ seedValue >>>= 0;
1428
+ }
1429
+ _mwcW = (123456789 + seedValue) & MaxUInt32;
1430
+ _mwcZ = (987654321 - seedValue) & MaxUInt32;
1431
+ _mwcSeeded = true;
1432
+ }
1433
+ function _autoSeedMwc() {
1434
+ try {
1435
+ var now = dateNow() & 0x7fffffff;
1436
+ _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1437
+ }
1438
+ catch (e) {
1439
+ }
1440
+ }
1441
+ function randomValue(maxValue) {
1442
+ if (maxValue > 0) {
1443
+ return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
1444
+ }
1445
+ return 0;
1446
+ }
1447
+ function random32(signed) {
1448
+ var value = 0;
1449
+ var c = getCrypto() || getMsCrypto();
1450
+ if (c && c.getRandomValues) {
1451
+ value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1452
+ }
1453
+ if (value === 0 && isIE()) {
1454
+ if (!_mwcSeeded) {
1455
+ _autoSeedMwc();
1456
+ }
1457
+ value = mwcRandom32() & MaxUInt32;
1458
+ }
1459
+ if (value === 0) {
1460
+ value = Math.floor((UInt32Mask * Math.random()) | 0);
1461
+ }
1462
+ if (!signed) {
1463
+ value >>>= 0;
1464
+ }
1465
+ return value;
1466
+ }
1467
+ function mwcRandomSeed(value) {
1468
+ if (!value) {
1469
+ _autoSeedMwc();
1470
+ }
1471
+ else {
1472
+ _mwcSeed(value);
1473
+ }
1474
+ }
1475
+ function mwcRandom32(signed) {
1476
+ _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1477
+ _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1478
+ var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1479
+ if (!signed) {
1480
+ value >>>= 0;
1481
+ }
1482
+ return value;
1483
+ }
1484
+ function newId(maxLength) {
1485
+ if (maxLength === void 0) { maxLength = 22; }
1486
+ var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1487
+ var number = random32() >>> 0;
1488
+ var chars = 0;
1489
+ var result = strEmpty$1;
1490
+ while (result.length < maxLength) {
1491
+ chars++;
1492
+ result += base64chars.charAt(number & 0x3F);
1493
+ number >>>= 6;
1494
+ if (chars === 5) {
1495
+ number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1496
+ chars = 0;
1497
+ }
1498
+ }
1499
+ return result;
1500
+ }
1501
+
1502
+ var _objDefineProperty = ObjDefineProperty;
1503
+ var version = "2.7.3";
1504
+ var instanceName = "." + newId(6);
1505
+ var _dataUid = 0;
1506
+ function _createAccessor(target, prop, value) {
1507
+ if (_objDefineProperty) {
1508
+ try {
1509
+ _objDefineProperty(target, prop, {
1510
+ value: value,
1511
+ enumerable: false,
1512
+ configurable: true
1513
+ });
1514
+ return true;
1515
+ }
1516
+ catch (e) {
1517
+ }
1518
+ }
1519
+ return false;
1520
+ }
1521
+ function _canAcceptData(target) {
1522
+ return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
1523
+ }
1524
+ function _getCache(data, target) {
1525
+ var theCache = target[data.id];
1526
+ if (!theCache) {
1527
+ theCache = {};
1528
+ try {
1529
+ if (_canAcceptData(target)) {
1530
+ if (!_createAccessor(target, data.id, theCache)) {
1531
+ target[data.id] = theCache;
1532
+ }
1533
+ }
1534
+ }
1535
+ catch (e) {
1536
+ }
1537
+ }
1538
+ return theCache;
1539
+ }
1540
+ function createUniqueNamespace(name, includeVersion) {
1541
+ if (includeVersion === void 0) { includeVersion = false; }
1542
+ return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
1543
+ }
1544
+ function createElmNodeData(name) {
1545
+ var data = {
1546
+ id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
1547
+ accept: function (target) {
1548
+ return _canAcceptData(target);
1549
+ },
1550
+ get: function (target, name, defValue, addDefault) {
1551
+ var theCache = target[data.id];
1552
+ if (!theCache) {
1553
+ if (addDefault) {
1554
+ theCache = _getCache(data, target);
1555
+ theCache[normalizeJsName(name)] = defValue;
1556
+ }
1557
+ return defValue;
1558
+ }
1559
+ return theCache[normalizeJsName(name)];
1560
+ },
1561
+ kill: function (target, name) {
1562
+ if (target && target[name]) {
1563
+ try {
1564
+ delete target[name];
1565
+ }
1566
+ catch (e) {
1567
+ }
1568
+ }
1569
+ }
1570
+ };
1571
+ return data;
1572
+ }
1573
+
1574
+ var pluginStateData = createElmNodeData("plugin");
1575
+ function _getPluginState(plugin) {
1576
+ return pluginStateData.get(plugin, "state", {}, true);
1577
+ }
1578
+ function initializePlugins(processContext, extensions) {
1579
+ var initPlugins = [];
1580
+ var lastPlugin = null;
1581
+ var proxy = processContext.getNext();
1582
+ var pluginState;
1583
+ while (proxy) {
1584
+ var thePlugin = proxy.getPlugin();
1585
+ if (thePlugin) {
1586
+ if (lastPlugin &&
1587
+ isFunction(lastPlugin[strSetNextPlugin]) &&
1588
+ isFunction(thePlugin[strProcessTelemetry])) {
1589
+ lastPlugin[strSetNextPlugin](thePlugin);
1590
+ }
1591
+ var isInitialized = false;
1592
+ if (isFunction(thePlugin[strIsInitialized])) {
1593
+ isInitialized = thePlugin[strIsInitialized]();
1594
+ }
1595
+ else {
1596
+ pluginState = _getPluginState(thePlugin);
1597
+ isInitialized = pluginState[strIsInitialized];
1598
+ }
1599
+ if (!isInitialized) {
1600
+ initPlugins.push(thePlugin);
1601
+ }
1602
+ lastPlugin = thePlugin;
1603
+ proxy = proxy.getNext();
1604
+ }
1605
+ }
1606
+ arrForEach(initPlugins, function (thePlugin) {
1607
+ var core = processContext.core();
1608
+ thePlugin.initialize(processContext.getCfg(), core, extensions, processContext.getNext());
1609
+ pluginState = _getPluginState(thePlugin);
1610
+ if (!thePlugin[strCore] && !pluginState[strCore]) {
1611
+ pluginState[strCore] = core;
1612
+ }
1613
+ pluginState[strIsInitialized] = true;
1614
+ delete pluginState[strTeardown];
1615
+ });
1616
+ }
1617
+ function sortPlugins(plugins) {
1618
+ return plugins.sort(function (extA, extB) {
1619
+ var result = 0;
1620
+ var bHasProcess = isFunction(extB[strProcessTelemetry]);
1621
+ if (isFunction(extA[strProcessTelemetry])) {
1622
+ result = bHasProcess ? extA[strPriority] - extB[strPriority] : 1;
1623
+ }
1624
+ else if (bHasProcess) {
1625
+ result = -1;
1626
+ }
1627
+ return result;
1628
+ });
1629
+ }
1630
+
1501
1631
  var strTelemetryPluginChain = "TelemetryPluginChain";
1502
1632
  var strHasRunFlags = "_hasRun";
1503
1633
  var strGetTelCtx = "_getTelCtx";
@@ -1511,53 +1641,66 @@
1511
1641
  }
1512
1642
  return createTelemetryProxyChain([startAt], config, core);
1513
1643
  }
1514
- function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
1515
- var _nextProxy = null;
1516
- var _onComplete = null;
1517
- if (startAt) {
1518
- _nextProxy = _getNextProxyStart(telemetryChain, config, core, startAt);
1519
- }
1520
- else {
1521
- _nextProxy = telemetryChain;
1522
- }
1644
+ function _createInternalContext(telemetryChain, config, core, startAt) {
1645
+ var _nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
1646
+ var _onComplete = [];
1523
1647
  var context = {
1524
- core: function () {
1525
- return core;
1526
- },
1527
- diagLog: function () {
1528
- return safeGetLogger(core, config);
1529
- },
1530
- getCfg: function () {
1531
- return config;
1532
- },
1533
- getExtCfg: _getExtCfg,
1534
- getConfig: _getConfig,
1535
- hasNext: function () {
1536
- return _nextProxy != null;
1537
- },
1538
- getNext: function () {
1539
- return _nextProxy;
1540
- },
1541
- setNext: function (nextPlugin) {
1542
- _nextProxy = nextPlugin;
1543
- },
1544
- processNext: function (env) {
1545
- _processChain(function (nextPlugin) {
1546
- nextPlugin.processTelemetry(env, context);
1648
+ _next: _moveNext,
1649
+ ctx: {
1650
+ core: function () { return core; },
1651
+ diagLog: function () {
1652
+ return safeGetLogger(core, config);
1653
+ },
1654
+ getCfg: function () {
1655
+ return config;
1656
+ },
1657
+ getExtCfg: _getExtCfg,
1658
+ getConfig: _getConfig,
1659
+ hasNext: function () {
1660
+ return !!_nextProxy;
1661
+ },
1662
+ getNext: function () {
1663
+ return _nextProxy;
1664
+ },
1665
+ setNext: function (nextPlugin) {
1666
+ _nextProxy = nextPlugin;
1667
+ },
1668
+ iterate: _iterateChain,
1669
+ onComplete: _addOnComplete
1670
+ }
1671
+ };
1672
+ function _addOnComplete(onComplete, that) {
1673
+ var args = [];
1674
+ for (var _i = 2; _i < arguments.length; _i++) {
1675
+ args[_i - 2] = arguments[_i];
1676
+ }
1677
+ if (onComplete) {
1678
+ _onComplete.push({
1679
+ func: onComplete,
1680
+ self: !isUndefined(that) ? that : context.ctx,
1681
+ args: args
1547
1682
  });
1548
- },
1549
- iterate: _iterateChain,
1550
- createNew: function (plugins, startAt) {
1551
- if (plugins === void 0) { plugins = null; }
1552
- if (isArray(plugins)) {
1553
- plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1683
+ }
1684
+ }
1685
+ function _moveNext() {
1686
+ var nextProxy = _nextProxy;
1687
+ _nextProxy = nextProxy ? nextProxy.getNext() : null;
1688
+ if (!nextProxy) {
1689
+ var onComplete = _onComplete;
1690
+ if (onComplete && onComplete.length > 0) {
1691
+ arrForEach(onComplete, function (completeDetails) {
1692
+ try {
1693
+ completeDetails.func.call(completeDetails.self, completeDetails.args);
1694
+ }
1695
+ catch (e) {
1696
+ core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1697
+ }
1698
+ });
1699
+ _onComplete = [];
1554
1700
  }
1555
- return createProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
1556
- },
1557
- onComplete: function (onComplete) {
1558
- _onComplete = onComplete;
1559
1701
  }
1560
- };
1702
+ return nextProxy;
1703
+ }
1561
1704
  function _getExtCfg(identifier, defaultValue, mergeDefault) {
1562
1705
  if (defaultValue === void 0) { defaultValue = {}; }
1563
1706
  if (mergeDefault === void 0) { mergeDefault = 0 ; }
@@ -1600,29 +1743,53 @@
1600
1743
  }
1601
1744
  return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1602
1745
  }
1603
- function _processChain(cb) {
1604
- var nextPlugin = _nextProxy;
1605
- if (nextPlugin) {
1606
- _nextProxy = nextPlugin.getNext();
1607
- cb(nextPlugin);
1608
- }
1609
- else {
1610
- if (_onComplete) {
1611
- _onComplete();
1612
- _onComplete = null;
1746
+ function _iterateChain(cb) {
1747
+ var nextPlugin;
1748
+ while (!!(nextPlugin = context._next())) {
1749
+ var plugin = nextPlugin.getPlugin();
1750
+ if (plugin) {
1751
+ cb(plugin);
1613
1752
  }
1614
1753
  }
1615
1754
  }
1616
- function _iterateChain(cb) {
1617
- while (_nextProxy) {
1618
- _processChain(function (nextPlugin) {
1619
- var plugin = nextPlugin.getPlugin();
1620
- if (plugin) {
1621
- cb(plugin);
1622
- }
1623
- });
1755
+ return context;
1756
+ }
1757
+ function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
1758
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1759
+ var context = internalContext.ctx;
1760
+ function _processNext(env) {
1761
+ var nextPlugin = internalContext._next();
1762
+ nextPlugin && nextPlugin.processTelemetry(env, context);
1763
+ return !nextPlugin;
1764
+ }
1765
+ function _createNew(plugins, startAt) {
1766
+ if (plugins === void 0) { plugins = null; }
1767
+ if (isArray(plugins)) {
1768
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1769
+ }
1770
+ return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
1771
+ }
1772
+ context.processNext = _processNext;
1773
+ context.createNew = _createNew;
1774
+ return context;
1775
+ }
1776
+ function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
1777
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1778
+ var context = internalContext.ctx;
1779
+ function _processNext(unloadState) {
1780
+ var nextPlugin = internalContext._next();
1781
+ nextPlugin && nextPlugin.unload(context, unloadState);
1782
+ return !nextPlugin;
1783
+ }
1784
+ function _createNew(plugins, startAt) {
1785
+ if (plugins === void 0) { plugins = null; }
1786
+ if (isArray(plugins)) {
1787
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1624
1788
  }
1789
+ return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
1625
1790
  }
1791
+ context.processNext = _processNext;
1792
+ context.createNew = _createNew;
1626
1793
  return context;
1627
1794
  }
1628
1795
  function createTelemetryProxyChain(plugins, config, core, startAt) {
@@ -1670,32 +1837,35 @@
1670
1837
  return nextProxy;
1671
1838
  },
1672
1839
  processTelemetry: _processTelemetry,
1840
+ unload: _unloadPlugin,
1673
1841
  _id: chainId,
1674
1842
  _setNext: function (nextPlugin) {
1675
1843
  nextProxy = nextPlugin;
1676
1844
  }
1677
1845
  };
1678
- function _processChain(itemCtx, processPluginFn, processProxyFn, name, details, isAsync) {
1846
+ function _getTelCtx() {
1847
+ var itemCtx;
1848
+ if (plugin && isFunction(plugin[strGetTelCtx])) {
1849
+ itemCtx = plugin[strGetTelCtx]();
1850
+ }
1679
1851
  if (!itemCtx) {
1680
- if (plugin && isFunction(plugin[strGetTelCtx])) {
1681
- itemCtx = plugin[strGetTelCtx]();
1682
- }
1683
- if (!itemCtx) {
1684
- itemCtx = createProcessTelemetryContext(proxyChain, config, core);
1685
- }
1852
+ itemCtx = createProcessTelemetryContext(proxyChain, config, core);
1686
1853
  }
1854
+ return itemCtx;
1855
+ }
1856
+ function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
1857
+ var hasRun = false;
1687
1858
  var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
1688
1859
  var hasRunContext = itemCtx[strHasRunFlags];
1689
1860
  if (!hasRunContext) {
1690
1861
  hasRunContext = itemCtx[strHasRunFlags] = {};
1691
1862
  }
1692
- doPerf(itemCtx.core(), function () { return identifier + ":" + name; }, function () {
1693
- hasRunContext[chainId] = true;
1694
- var hasRun = false;
1695
- itemCtx.setNext(nextProxy);
1696
- if (plugin) {
1863
+ itemCtx.setNext(nextProxy);
1864
+ if (plugin) {
1865
+ doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
1866
+ hasRunContext[chainId] = true;
1697
1867
  try {
1698
- var nextId = nextProxy ? nextProxy._id : "";
1868
+ var nextId = nextProxy ? nextProxy._id : strEmpty$1;
1699
1869
  if (nextId) {
1700
1870
  hasRunContext[nextId] = false;
1701
1871
  }
@@ -1707,18 +1877,21 @@
1707
1877
  hasRun = true;
1708
1878
  }
1709
1879
  if (!nextProxy || !hasNextRun) {
1710
- itemCtx.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1880
+ itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1711
1881
  }
1712
1882
  }
1713
- }
1714
- if (nextProxy && !hasRun) {
1715
- processProxyFn(itemCtx);
1716
- }
1717
- }, details, isAsync);
1883
+ }, details, isAsync);
1884
+ }
1885
+ return hasRun;
1718
1886
  }
1719
1887
  function _processTelemetry(env, itemCtx) {
1720
- _processChain(itemCtx, function (itemCtx) {
1721
- if (!hasProcessTelemetry) {
1888
+ itemCtx = itemCtx || _getTelCtx();
1889
+ function _callProcessTelemetry(itemCtx) {
1890
+ if (!plugin || !hasProcessTelemetry) {
1891
+ return false;
1892
+ }
1893
+ var pluginState = _getPluginState(plugin);
1894
+ if (pluginState[strTeardown] || pluginState[strDisabled]) {
1722
1895
  return false;
1723
1896
  }
1724
1897
  if (hasSetNext) {
@@ -1726,52 +1899,33 @@
1726
1899
  }
1727
1900
  plugin.processTelemetry(env, itemCtx);
1728
1901
  return true;
1729
- }, function (itemCtx) {
1730
- nextProxy.processTelemetry(env, itemCtx);
1731
- }, "processTelemetry", function () { return ({ item: env }); }, !(env.sync));
1732
- }
1733
- return objFreeze(proxyChain);
1734
- }
1735
-
1736
- var processTelemetry = "processTelemetry";
1737
- var priority = "priority";
1738
- var setNextPlugin = "setNextPlugin";
1739
- var isInitialized = "isInitialized";
1740
- function initializePlugins(processContext, extensions) {
1741
- var initPlugins = [];
1742
- var lastPlugin = null;
1743
- var proxy = processContext.getNext();
1744
- while (proxy) {
1745
- var thePlugin = proxy.getPlugin();
1746
- if (thePlugin) {
1747
- if (lastPlugin &&
1748
- isFunction(lastPlugin[setNextPlugin]) &&
1749
- isFunction(thePlugin[processTelemetry])) {
1750
- lastPlugin[setNextPlugin](thePlugin);
1751
- }
1752
- if (!isFunction(thePlugin[isInitialized]) || !thePlugin[isInitialized]()) {
1753
- initPlugins.push(thePlugin);
1754
- }
1755
- lastPlugin = thePlugin;
1756
- proxy = proxy.getNext();
1902
+ }
1903
+ if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
1904
+ itemCtx.processNext(env);
1757
1905
  }
1758
1906
  }
1759
- arrForEach(initPlugins, function (thePlugin) {
1760
- thePlugin.initialize(processContext.getCfg(), processContext.core(), extensions, processContext.getNext());
1761
- });
1762
- }
1763
- function sortPlugins(plugins) {
1764
- return plugins.sort(function (extA, extB) {
1765
- var result = 0;
1766
- var bHasProcess = isFunction(extB[processTelemetry]);
1767
- if (isFunction(extA[processTelemetry])) {
1768
- result = bHasProcess ? extA[priority] - extB[priority] : 1;
1907
+ function _unloadPlugin(unloadCtx, unloadState) {
1908
+ function _callTeardown() {
1909
+ var hasRun = false;
1910
+ if (plugin) {
1911
+ var pluginState = _getPluginState(plugin);
1912
+ var pluginCore = plugin[strCore] || pluginState.core;
1913
+ if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
1914
+ pluginState[strCore] = null;
1915
+ pluginState[strTeardown] = true;
1916
+ pluginState[strIsInitialized] = false;
1917
+ if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
1918
+ hasRun = true;
1919
+ }
1920
+ }
1921
+ }
1922
+ return hasRun;
1769
1923
  }
1770
- else if (bHasProcess) {
1771
- result = -1;
1924
+ if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
1925
+ unloadCtx.processNext(unloadState);
1772
1926
  }
1773
- return result;
1774
- });
1927
+ }
1928
+ return objFreeze(proxyChain);
1775
1929
  }
1776
1930
 
1777
1931
  var strToGMTString = "toGMTString";
@@ -1782,7 +1936,6 @@
1782
1936
  var strIsCookieUseDisabled = "isCookieUseDisabled";
1783
1937
  var strDisableCookiesUsage = "disableCookiesUsage";
1784
1938
  var strConfigCookieMgr = "_ckMgr";
1785
- var strEmpty = "";
1786
1939
  var _supportsCookies = null;
1787
1940
  var _allowUaSameSite = null;
1788
1941
  var _parsedCookieValue = null;
@@ -1859,7 +2012,7 @@
1859
2012
  var result = false;
1860
2013
  if (_isMgrEnabled(cookieMgr)) {
1861
2014
  var values = {};
1862
- var theValue = strTrim(value || strEmpty);
2015
+ var theValue = strTrim(value || strEmpty$1);
1863
2016
  var idx = theValue.indexOf(";");
1864
2017
  if (idx !== -1) {
1865
2018
  theValue = strTrim(value.substring(0, idx));
@@ -1874,11 +2027,11 @@
1874
2027
  if (expireMs > 0) {
1875
2028
  var expiry = new Date();
1876
2029
  expiry.setTime(expireMs);
1877
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
2030
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty$1, isTruthy);
1878
2031
  }
1879
2032
  }
1880
2033
  if (!_isIE) {
1881
- setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
2034
+ setValue(values, "max-age", strEmpty$1 + maxAgeSec, null, isUndefined);
1882
2035
  }
1883
2036
  }
1884
2037
  var location_1 = getLocation();
@@ -1899,7 +2052,7 @@
1899
2052
  return result;
1900
2053
  },
1901
2054
  get: function (name) {
1902
- var value = strEmpty;
2055
+ var value = strEmpty$1;
1903
2056
  if (_isMgrEnabled(cookieMgr)) {
1904
2057
  value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
1905
2058
  }
@@ -1924,7 +2077,7 @@
1924
2077
  values["max-age"] = "0";
1925
2078
  }
1926
2079
  var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
1927
- delCookie(name, _formatCookieValue(strEmpty, values));
2080
+ delCookie(name, _formatCookieValue(strEmpty$1, values));
1928
2081
  result = true;
1929
2082
  }
1930
2083
  return result;
@@ -1941,7 +2094,7 @@
1941
2094
  _supportsCookies = doc[strCookie] !== undefined;
1942
2095
  }
1943
2096
  catch (e) {
1944
- logger && logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.CannotAccessCookie, "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
2097
+ logger && logger.throwInternal(2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1945
2098
  }
1946
2099
  }
1947
2100
  return _supportsCookies;
@@ -1951,7 +2104,7 @@
1951
2104
  if (theValue && theValue.length) {
1952
2105
  var parts = strTrim(theValue).split(";");
1953
2106
  arrForEach(parts, function (thePart) {
1954
- thePart = strTrim(thePart || strEmpty);
2107
+ thePart = strTrim(thePart || strEmpty$1);
1955
2108
  if (thePart) {
1956
2109
  var idx = thePart.indexOf("=");
1957
2110
  if (idx === -1) {
@@ -1972,21 +2125,21 @@
1972
2125
  return null;
1973
2126
  }
1974
2127
  function _formatCookieValue(value, values) {
1975
- var cookieValue = value || strEmpty;
2128
+ var cookieValue = value || strEmpty$1;
1976
2129
  objForEachKey(values, function (name, theValue) {
1977
- cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
2130
+ cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty$1);
1978
2131
  });
1979
2132
  return cookieValue;
1980
2133
  }
1981
2134
  function _getCookieValue(name) {
1982
- var cookieValue = strEmpty;
2135
+ var cookieValue = strEmpty$1;
1983
2136
  if (_doc) {
1984
- var theCookie = _doc[strCookie] || strEmpty;
2137
+ var theCookie = _doc[strCookie] || strEmpty$1;
1985
2138
  if (_parsedCookieValue !== theCookie) {
1986
2139
  _cookieCache = _extractParts(theCookie);
1987
2140
  _parsedCookieValue = theCookie;
1988
2141
  }
1989
- cookieValue = strTrim(_cookieCache[name] || strEmpty);
2142
+ cookieValue = strTrim(_cookieCache[name] || strEmpty$1);
1990
2143
  }
1991
2144
  return cookieValue;
1992
2145
  }
@@ -2042,87 +2195,110 @@
2042
2195
  }
2043
2196
  }
2044
2197
  function createChannelControllerPlugin(channelQueue, core) {
2045
- function _getTelCtx(itemCtx) {
2046
- if (!itemCtx) {
2047
- itemCtx = createProcessTelemetryContext(null, core.config, core, null);
2198
+ var _a;
2199
+ function _getTelCtx() {
2200
+ return createProcessTelemetryContext(null, core.config, core, null);
2201
+ }
2202
+ function _processChannelQueue(theChannels, itemCtx, processFn, onComplete) {
2203
+ var waiting = theChannels ? (theChannels.length + 1) : 1;
2204
+ function _runChainOnComplete() {
2205
+ waiting--;
2206
+ if (waiting === 0) {
2207
+ onComplete && onComplete();
2208
+ onComplete = null;
2209
+ }
2048
2210
  }
2049
- return itemCtx;
2050
- }
2051
- function _processChannelQueue(itemCtx, processFn, onComplete) {
2052
- if (channelQueue && channelQueue.length > 0) {
2053
- var waiting_1 = channelQueue.length;
2054
- arrForEach(channelQueue, function (channels) {
2211
+ if (waiting > 0) {
2212
+ arrForEach(theChannels, function (channels) {
2055
2213
  if (channels && channels.queue.length > 0) {
2056
2214
  var channelChain = channels.chain;
2057
- var chainCtx = _getTelCtx(itemCtx).createNew(channelChain);
2058
- chainCtx.onComplete(function () {
2059
- waiting_1--;
2060
- if (waiting_1 === 0) {
2061
- onComplete && onComplete();
2062
- onComplete = null;
2063
- }
2064
- });
2215
+ var chainCtx = itemCtx.createNew(channelChain);
2216
+ chainCtx.onComplete(_runChainOnComplete);
2065
2217
  processFn(chainCtx);
2066
2218
  }
2067
2219
  else {
2068
- waiting_1--;
2220
+ waiting--;
2069
2221
  }
2070
2222
  });
2071
- if (waiting_1 === 0) {
2072
- onComplete && onComplete();
2073
- }
2074
- }
2075
- else {
2076
- onComplete && onComplete();
2077
2223
  }
2224
+ _runChainOnComplete();
2078
2225
  }
2079
- var isInitialized = false;
2080
- var channelController = {
2081
- identifier: "ChannelControllerPlugin",
2082
- priority: ChannelControllerPriority,
2083
- initialize: function (config, core, extensions, pluginChain) {
2084
- isInitialized = true;
2226
+ function _doTeardown(unloadCtx, unloadState) {
2227
+ var theUnloadState = unloadState || {
2228
+ reason: 0 ,
2229
+ isAsync: false
2230
+ };
2231
+ _processChannelQueue(channelQueue, unloadCtx, function (chainCtx) {
2232
+ chainCtx[strProcessNext](theUnloadState);
2233
+ }, function () {
2234
+ unloadCtx[strProcessNext](theUnloadState);
2235
+ isInitialized = false;
2236
+ });
2237
+ return true;
2238
+ }
2239
+ function _getChannel(pluginIdentifier) {
2240
+ var thePlugin = null;
2241
+ if (channelQueue && channelQueue.length > 0) {
2085
2242
  arrForEach(channelQueue, function (channels) {
2086
2243
  if (channels && channels.queue.length > 0) {
2087
- initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);
2244
+ arrForEach(channels.queue, function (ext) {
2245
+ if (ext.identifier === pluginIdentifier) {
2246
+ thePlugin = ext;
2247
+ return -1;
2248
+ }
2249
+ });
2250
+ if (thePlugin) {
2251
+ return -1;
2252
+ }
2088
2253
  }
2089
2254
  });
2090
- },
2091
- isInitialized: function () { return isInitialized; },
2092
- processTelemetry: function (item, itemCtx) {
2093
- _processChannelQueue(itemCtx, function (chainCtx) {
2094
- chainCtx.processNext(item);
2095
- }, function () {
2096
- itemCtx.processNext(item);
2097
- });
2098
- },
2099
- pause: function () {
2100
- _processChannelQueue(null, function (chainCtx) {
2101
- chainCtx.iterate(function (plugin) {
2102
- plugin.pause && plugin.pause();
2255
+ }
2256
+ return thePlugin;
2257
+ }
2258
+ var isInitialized = false;
2259
+ var channelController = (_a = {
2260
+ identifier: "ChannelControllerPlugin",
2261
+ priority: ChannelControllerPriority,
2262
+ initialize: function (config, core, extensions, pluginChain) {
2263
+ isInitialized = true;
2264
+ arrForEach(channelQueue, function (channels) {
2265
+ if (channels && channels.queue.length > 0) {
2266
+ initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);
2267
+ }
2103
2268
  });
2104
- });
2269
+ },
2270
+ isInitialized: function () { return isInitialized; },
2271
+ processTelemetry: function (item, itemCtx) {
2272
+ _processChannelQueue(channelQueue, itemCtx || _getTelCtx(), function (chainCtx) {
2273
+ chainCtx[strProcessNext](item);
2274
+ }, function () {
2275
+ itemCtx[strProcessNext](item);
2276
+ });
2277
+ }
2105
2278
  },
2106
- resume: function () {
2107
- _processChannelQueue(null, function (chainCtx) {
2279
+ _a[strPause] = function () {
2280
+ _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
2108
2281
  chainCtx.iterate(function (plugin) {
2109
- plugin.resume && plugin.resume();
2282
+ plugin[strPause] && plugin[strPause]();
2110
2283
  });
2111
- });
2284
+ }, null);
2112
2285
  },
2113
- teardown: function () {
2114
- _processChannelQueue(null, function (chainCtx) {
2286
+ _a[strResume] = function () {
2287
+ _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
2115
2288
  chainCtx.iterate(function (plugin) {
2116
- plugin.teardown && plugin.teardown();
2289
+ plugin[strResume] && plugin[strResume]();
2117
2290
  });
2118
- });
2291
+ }, null);
2119
2292
  },
2120
- flush: function (isAsync, callBack, sendReason, cbTimeout) {
2293
+ _a[strTeardown] = _doTeardown,
2294
+ _a.getChannel = _getChannel,
2295
+ _a.flush = function (isAsync, callBack, sendReason, cbTimeout) {
2296
+ var waiting = 1;
2121
2297
  var doneIterating = false;
2122
- var waiting = 0;
2123
2298
  var cbTimer = null;
2124
2299
  cbTimeout = cbTimeout || 5000;
2125
2300
  function doCallback() {
2301
+ waiting--;
2126
2302
  if (doneIterating && waiting === 0) {
2127
2303
  if (cbTimer) {
2128
2304
  clearTimeout(cbTimer);
@@ -2132,32 +2308,38 @@
2132
2308
  callBack = null;
2133
2309
  }
2134
2310
  }
2135
- waiting = 1;
2136
- _processChannelQueue(null, function (chainCtx) {
2311
+ _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
2137
2312
  chainCtx.iterate(function (plugin) {
2138
2313
  if (plugin.flush) {
2139
2314
  waiting++;
2315
+ var handled_1 = false;
2140
2316
  if (!plugin.flush(isAsync, function () {
2141
- waiting--;
2317
+ handled_1 = true;
2142
2318
  doCallback();
2143
2319
  }, sendReason)) {
2144
- if (cbTimer == null) {
2145
- cbTimer = setTimeout(function () {
2146
- cbTimer = null;
2147
- callBack && callBack(false);
2148
- callBack = null;
2149
- }, cbTimeout);
2320
+ if (!handled_1) {
2321
+ if (isAsync && cbTimer == null) {
2322
+ cbTimer = setTimeout(function () {
2323
+ cbTimer = null;
2324
+ doCallback();
2325
+ }, cbTimeout);
2326
+ }
2327
+ else {
2328
+ doCallback();
2329
+ }
2150
2330
  }
2151
2331
  }
2152
2332
  }
2153
2333
  });
2154
2334
  }, function () {
2155
- waiting--;
2156
2335
  doneIterating = true;
2157
2336
  doCallback();
2158
2337
  });
2159
- }
2160
- };
2338
+ },
2339
+ _a._setQueue = function (queue) {
2340
+ channelQueue = queue;
2341
+ },
2342
+ _a);
2161
2343
  return channelController;
2162
2344
  }
2163
2345
  function createChannelQueues(channels, extensions, config, core) {
@@ -2191,6 +2373,38 @@
2191
2373
  _setDefaults(config, core, pluginChain);
2192
2374
  _isinitialized = true;
2193
2375
  };
2376
+ _self.teardown = function (unloadCtx, unloadState) {
2377
+ if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
2378
+ return;
2379
+ }
2380
+ var result;
2381
+ var unloadDone = false;
2382
+ var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
2383
+ var theUnloadState = unloadState || {
2384
+ reason: 0 ,
2385
+ isAsync: false
2386
+ };
2387
+ function _unloadCallback() {
2388
+ if (!unloadDone) {
2389
+ unloadDone = true;
2390
+ arrForEach(_hooks, function (fn) {
2391
+ fn.rm();
2392
+ });
2393
+ _hooks = [];
2394
+ if (result === true) {
2395
+ theUnloadCtx.processNext(theUnloadState);
2396
+ }
2397
+ _initDefaults();
2398
+ }
2399
+ }
2400
+ if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
2401
+ _unloadCallback();
2402
+ }
2403
+ else {
2404
+ result = true;
2405
+ }
2406
+ return result;
2407
+ };
2194
2408
  _self._addHook = function (hooks) {
2195
2409
  if (hooks) {
2196
2410
  if (isArray(hooks)) {
@@ -2205,13 +2419,13 @@
2205
2419
  _self.diagLog = function (itemCtx) {
2206
2420
  return _getTelCtx(itemCtx).diagLog();
2207
2421
  };
2208
- _self.isInitialized = function () {
2422
+ _self[strIsInitialized] = function () {
2209
2423
  return _isinitialized;
2210
2424
  };
2211
2425
  _self.setInitialized = function (isInitialized) {
2212
2426
  _isinitialized = isInitialized;
2213
2427
  };
2214
- _self.setNextPlugin = function (next) {
2428
+ _self[strSetNextPlugin] = function (next) {
2215
2429
  _nextPlugin = next;
2216
2430
  };
2217
2431
  _self.processNext = function (env, itemCtx) {
@@ -2303,7 +2517,7 @@
2303
2517
  }
2304
2518
  }
2305
2519
  catch (e) {
2306
- itemCtx.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
2520
+ itemCtx.diagLog().throwInternal(1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
2307
2521
  }
2308
2522
  }
2309
2523
  }
@@ -2311,8 +2525,7 @@
2311
2525
  _self.processNext(item, itemCtx);
2312
2526
  }
2313
2527
  };
2314
- _self.unload = function (itemCtx, isAsync) {
2315
- _base.unload(itemCtx, isAsync);
2528
+ _self[strDoTeardown] = function () {
2316
2529
  _initDefaults();
2317
2530
  };
2318
2531
  });
@@ -2356,6 +2569,16 @@
2356
2569
  core: coreExtensions
2357
2570
  };
2358
2571
  }
2572
+ function _createDummyNotificationManager() {
2573
+ var _a;
2574
+ return objCreateFn((_a = {},
2575
+ _a[strAddNotificationListener] = function (listener) { },
2576
+ _a[strRemoveNotificationListener] = function (listener) { },
2577
+ _a[strEventsSent] = function (events) { },
2578
+ _a[strEventsDiscarded] = function (events, reason) { },
2579
+ _a[strEventsSendRequest] = function (sendReason, isAsync) { },
2580
+ _a));
2581
+ }
2359
2582
  var BaseCore = /** @class */ (function () {
2360
2583
  function BaseCore() {
2361
2584
  var _isInitialized;
@@ -2372,6 +2595,7 @@
2372
2595
  var _channelQueue;
2373
2596
  var _telemetryInitializerPlugin;
2374
2597
  var _internalLogsEventName;
2598
+ var _evtNamespace;
2375
2599
  var _debugListener;
2376
2600
  var _internalLogPoller = 0;
2377
2601
  dynamicProto(BaseCore, this, function (_self) {
@@ -2417,24 +2641,16 @@
2417
2641
  setValue(telemetryItem, "time", toISOString(new Date()), null, isNotTruthy);
2418
2642
  setValue(telemetryItem, "ver", "4.0", null, isNullOrUndefined);
2419
2643
  if (_self.isInitialized()) {
2420
- _self.getProcessTelContext().processNext(telemetryItem);
2644
+ _createTelCtx().processNext(telemetryItem);
2421
2645
  }
2422
2646
  else {
2423
2647
  _eventQueue.push(telemetryItem);
2424
2648
  }
2425
2649
  };
2426
- _self.getProcessTelContext = function () {
2427
- return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
2428
- };
2650
+ _self.getProcessTelContext = _createTelCtx;
2429
2651
  _self.getNotifyMgr = function () {
2430
2652
  if (!_notificationManager) {
2431
- _notificationManager = objCreateFn({
2432
- addNotificationListener: function (listener) { },
2433
- removeNotificationListener: function (listener) { },
2434
- eventsSent: function (events) { },
2435
- eventsDiscarded: function (events, reason) { },
2436
- eventsSendRequest: function (sendReason, isAsync) { }
2437
- });
2653
+ _notificationManager = _createDummyNotificationManager();
2438
2654
  _self[strNotificationManager] = _notificationManager;
2439
2655
  }
2440
2656
  return _notificationManager;
@@ -2477,7 +2693,7 @@
2477
2693
  var eventQueue = _eventQueue;
2478
2694
  _eventQueue = [];
2479
2695
  arrForEach(eventQueue, function (event) {
2480
- _self.getProcessTelContext().processNext(event);
2696
+ _createTelCtx().processNext(event);
2481
2697
  });
2482
2698
  }
2483
2699
  };
@@ -2504,9 +2720,12 @@
2504
2720
  };
2505
2721
  proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, ["addTelemetryInitializer"]);
2506
2722
  _self.getPlugin = _getPlugin;
2723
+ _self.evtNamespace = function () {
2724
+ return _evtNamespace;
2725
+ };
2507
2726
  function _initDefaults() {
2508
2727
  _isInitialized = false;
2509
- _self.logger = new DiagnosticLogger({ loggingLevelConsole: exports.LoggingSeverity.CRITICAL });
2728
+ _self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 });
2510
2729
  _self.config = null;
2511
2730
  _self._extensions = [];
2512
2731
  _telemetryInitializerPlugin = new TelemetryInitializerPlugin();
@@ -2522,6 +2741,10 @@
2522
2741
  _channelConfig = null;
2523
2742
  _channelQueue = null;
2524
2743
  _internalLogsEventName = null;
2744
+ _evtNamespace = createUniqueNamespace("AIBaseCore", true);
2745
+ }
2746
+ function _createTelCtx() {
2747
+ return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
2525
2748
  }
2526
2749
  function _initPluginChain(config) {
2527
2750
  var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
@@ -2529,26 +2752,49 @@
2529
2752
  _pluginChain = null;
2530
2753
  var allExtensions = theExtensions.all;
2531
2754
  _channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, config, _self));
2532
- _channelControl = createChannelControllerPlugin(_channelQueue, _self);
2755
+ if (_channelControl) {
2756
+ var idx = allExtensions.indexOf(_channelControl);
2757
+ if (idx !== -1) {
2758
+ allExtensions.splice(idx, 1);
2759
+ }
2760
+ idx = _coreExtensions.indexOf(_channelControl);
2761
+ if (idx !== -1) {
2762
+ _coreExtensions.splice(idx, 1);
2763
+ }
2764
+ _channelControl._setQueue(_channelQueue);
2765
+ }
2766
+ else {
2767
+ _channelControl = createChannelControllerPlugin(_channelQueue, _self);
2768
+ }
2533
2769
  allExtensions.push(_channelControl);
2534
2770
  _coreExtensions.push(_channelControl);
2535
2771
  _self._extensions = sortPlugins(allExtensions);
2536
2772
  _channelControl.initialize(config, _self, allExtensions);
2537
- initializePlugins(_self.getProcessTelContext(), allExtensions);
2773
+ initializePlugins(_createTelCtx(), allExtensions);
2538
2774
  _self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
2539
2775
  }
2540
2776
  function _getPlugin(pluginIdentifier) {
2541
2777
  var theExt = null;
2542
2778
  var thePlugin = null;
2543
2779
  arrForEach(_self._extensions, function (ext) {
2544
- if (ext.identifier === pluginIdentifier) {
2780
+ if (ext.identifier === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
2545
2781
  thePlugin = ext;
2546
2782
  return -1;
2547
2783
  }
2548
2784
  });
2785
+ if (!thePlugin && _channelControl) {
2786
+ thePlugin = _channelControl.getChannel(pluginIdentifier);
2787
+ }
2549
2788
  if (thePlugin) {
2550
2789
  theExt = {
2551
- plugin: thePlugin
2790
+ plugin: thePlugin,
2791
+ setEnabled: function (enabled) {
2792
+ _getPluginState(thePlugin)[strDisabled] = !enabled;
2793
+ },
2794
+ isEnabled: function () {
2795
+ var pluginState = _getPluginState(thePlugin);
2796
+ return !pluginState[strTeardown] && !pluginState[strDisabled];
2797
+ }
2552
2798
  };
2553
2799
  }
2554
2800
  return theExt;
@@ -2556,7 +2802,9 @@
2556
2802
  function _getPluginChain() {
2557
2803
  if (!_pluginChain) {
2558
2804
  var extensions = (_coreExtensions || []).slice();
2559
- extensions.push(_telemetryInitializerPlugin);
2805
+ if (extensions.indexOf(_telemetryInitializerPlugin) === -1) {
2806
+ extensions.push(_telemetryInitializerPlugin);
2807
+ }
2560
2808
  _pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _self.config, _self);
2561
2809
  }
2562
2810
  return _pluginChain;
@@ -2579,12 +2827,12 @@
2579
2827
  }
2580
2828
  function _initDebugListener(config) {
2581
2829
  if (config.disableDbgExt === true && _debugListener) {
2582
- _notificationManager.removeNotificationListener(_debugListener);
2830
+ _notificationManager[strRemoveNotificationListener](_debugListener);
2583
2831
  _debugListener = null;
2584
2832
  }
2585
2833
  if (_notificationManager && !_debugListener && config.disableDbgExt !== true) {
2586
2834
  _debugListener = getDebugListener(config);
2587
- _notificationManager.addNotificationListener(_debugListener);
2835
+ _notificationManager[strAddNotificationListener](_debugListener);
2588
2836
  }
2589
2837
  }
2590
2838
  function _initPerfManager(config) {
@@ -2600,10 +2848,6 @@
2600
2848
  return BaseCore;
2601
2849
  }());
2602
2850
 
2603
- var strEventsSent = "eventsSent";
2604
- var strEventsDiscarded = "eventsDiscarded";
2605
- var strEventsSendRequest = "eventsSendRequest";
2606
- var strPerfEvent = "perfEvent";
2607
2851
  function _runListeners(listeners, name, isAsync, callback) {
2608
2852
  arrForEach(listeners, function (listener) {
2609
2853
  if (listener && listener[name]) {
@@ -2625,32 +2869,32 @@
2625
2869
  this.listeners = [];
2626
2870
  var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;
2627
2871
  dynamicProto(NotificationManager, this, function (_self) {
2628
- _self.addNotificationListener = function (listener) {
2872
+ _self[strAddNotificationListener] = function (listener) {
2629
2873
  _self.listeners.push(listener);
2630
2874
  };
2631
- _self.removeNotificationListener = function (listener) {
2875
+ _self[strRemoveNotificationListener] = function (listener) {
2632
2876
  var index = arrIndexOf(_self.listeners, listener);
2633
2877
  while (index > -1) {
2634
2878
  _self.listeners.splice(index, 1);
2635
2879
  index = arrIndexOf(_self.listeners, listener);
2636
2880
  }
2637
2881
  };
2638
- _self.eventsSent = function (events) {
2882
+ _self[strEventsSent] = function (events) {
2639
2883
  _runListeners(_self.listeners, strEventsSent, true, function (listener) {
2640
2884
  listener[strEventsSent](events);
2641
2885
  });
2642
2886
  };
2643
- _self.eventsDiscarded = function (events, reason) {
2887
+ _self[strEventsDiscarded] = function (events, reason) {
2644
2888
  _runListeners(_self.listeners, strEventsDiscarded, true, function (listener) {
2645
2889
  listener[strEventsDiscarded](events, reason);
2646
2890
  });
2647
2891
  };
2648
- _self.eventsSendRequest = function (sendReason, isAsync) {
2892
+ _self[strEventsSendRequest] = function (sendReason, isAsync) {
2649
2893
  _runListeners(_self.listeners, strEventsSendRequest, isAsync, function (listener) {
2650
2894
  listener[strEventsSendRequest](sendReason, isAsync);
2651
2895
  });
2652
2896
  };
2653
- _self.perfEvent = function (perfEvent) {
2897
+ _self[strPerfEvent] = function (perfEvent) {
2654
2898
  if (perfEvent) {
2655
2899
  if (perfEvtsSendAll || !perfEvent.isChildEvt()) {
2656
2900
  _runListeners(_self.listeners, strPerfEvent, false, function (listener) {
@@ -2705,147 +2949,179 @@
2705
2949
  return AppInsightsCore;
2706
2950
  }(BaseCore));
2707
2951
 
2708
- var UInt32Mask = 0x100000000;
2709
- var MaxUInt32 = 0xffffffff;
2710
- var _mwcSeeded = false;
2711
- var _mwcW = 123456789;
2712
- var _mwcZ = 987654321;
2713
- function _mwcSeed(seedValue) {
2714
- if (seedValue < 0) {
2715
- seedValue >>>= 0;
2952
+ var strOnPrefix = "on";
2953
+ var strAttachEvent = "attachEvent";
2954
+ var strAddEventHelper = "addEventListener";
2955
+ var strEvents = "events";
2956
+ var strVisibilityChangeEvt = "visibilitychange";
2957
+ var strPageHide = "pagehide";
2958
+ var strUnload = "unload";
2959
+ var strBeforeUnload = "beforeunload";
2960
+ var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
2961
+ createUniqueNamespace("aiEvtPageShow");
2962
+ var _guid = 1;
2963
+ var elmNodeData = createElmNodeData("events");
2964
+ var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
2965
+ function _normalizeNamespace(name) {
2966
+ if (name && name.replace) {
2967
+ return name.replace(/^\s*\.*|\.*\s*$/g, "");
2968
+ }
2969
+ return name;
2970
+ }
2971
+ function _getEvtNamespace(eventName, namespaces) {
2972
+ if (namespaces) {
2973
+ var theNamespace_1 = "";
2974
+ if (isArray(namespaces)) {
2975
+ theNamespace_1 = "";
2976
+ arrForEach(namespaces, function (name) {
2977
+ name = _normalizeNamespace(name);
2978
+ if (name) {
2979
+ if (name[0] !== ".") {
2980
+ name = "." + name;
2981
+ }
2982
+ theNamespace_1 += name;
2983
+ }
2984
+ });
2985
+ }
2986
+ else {
2987
+ theNamespace_1 = _normalizeNamespace(namespaces);
2988
+ }
2989
+ if (theNamespace_1) {
2990
+ if (theNamespace_1[0] !== ".") {
2991
+ theNamespace_1 = "." + theNamespace_1;
2992
+ }
2993
+ eventName = (eventName || "") + theNamespace_1;
2994
+ }
2716
2995
  }
2717
- _mwcW = (123456789 + seedValue) & MaxUInt32;
2718
- _mwcZ = (987654321 - seedValue) & MaxUInt32;
2719
- _mwcSeeded = true;
2996
+ var parsedEvent = (eventNamespace.exec(eventName) || []);
2997
+ return {
2998
+ type: parsedEvent[1],
2999
+ ns: ((parsedEvent[2] || "").split(".").sort()).join(".")
3000
+ };
2720
3001
  }
2721
- function _autoSeedMwc() {
2722
- try {
2723
- var now = dateNow() & 0x7fffffff;
2724
- _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
2725
- }
2726
- catch (e) {
3002
+ function _getRegisteredEvents(target, evtName, addDefault) {
3003
+ if (addDefault === void 0) { addDefault = true; }
3004
+ var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
3005
+ var registeredEvents = aiEvts[evtName];
3006
+ if (!registeredEvents) {
3007
+ registeredEvents = aiEvts[evtName] = [];
2727
3008
  }
3009
+ return registeredEvents;
2728
3010
  }
2729
- function randomValue(maxValue) {
2730
- if (maxValue > 0) {
2731
- return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
2732
- }
2733
- return 0;
2734
- }
2735
- function random32(signed) {
2736
- var value = 0;
2737
- var c = getCrypto() || getMsCrypto();
2738
- if (c && c.getRandomValues) {
2739
- value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
2740
- }
2741
- if (value === 0 && isIE()) {
2742
- if (!_mwcSeeded) {
2743
- _autoSeedMwc();
3011
+ function _doAttach(obj, evtName, handlerRef, useCapture) {
3012
+ var result = false;
3013
+ if (obj && evtName && evtName.type && handlerRef) {
3014
+ if (obj[strAddEventHelper]) {
3015
+ obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
3016
+ result = true;
3017
+ }
3018
+ else if (obj[strAttachEvent]) {
3019
+ obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
3020
+ result = true;
2744
3021
  }
2745
- value = mwcRandom32() & MaxUInt32;
2746
- }
2747
- if (value === 0) {
2748
- value = Math.floor((UInt32Mask * Math.random()) | 0);
2749
- }
2750
- if (!signed) {
2751
- value >>>= 0;
2752
3022
  }
2753
- return value;
3023
+ return result;
2754
3024
  }
2755
- function mwcRandomSeed(value) {
2756
- if (!value) {
2757
- _autoSeedMwc();
3025
+ function mergeEvtNamespace(theNamespace, namespaces) {
3026
+ var newNamespaces;
3027
+ if (namespaces) {
3028
+ if (isArray(namespaces)) {
3029
+ newNamespaces = [theNamespace].concat(namespaces);
3030
+ }
3031
+ else {
3032
+ newNamespaces = [theNamespace, namespaces];
3033
+ }
2758
3034
  }
2759
3035
  else {
2760
- _mwcSeed(value);
3036
+ newNamespaces = theNamespace;
2761
3037
  }
3038
+ return newNamespaces;
2762
3039
  }
2763
- function mwcRandom32(signed) {
2764
- _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
2765
- _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
2766
- var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
2767
- if (!signed) {
2768
- value >>>= 0;
2769
- }
2770
- return value;
2771
- }
2772
- function newId(maxLength) {
2773
- if (maxLength === void 0) { maxLength = 22; }
2774
- var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
2775
- var number = random32() >>> 0;
2776
- var chars = 0;
2777
- var result = "";
2778
- while (result.length < maxLength) {
2779
- chars++;
2780
- result += base64chars.charAt(number & 0x3F);
2781
- number >>>= 6;
2782
- if (chars === 5) {
2783
- number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
2784
- chars = 0;
3040
+ function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
3041
+ if (useCapture === void 0) { useCapture = false; }
3042
+ var result = false;
3043
+ if (target) {
3044
+ try {
3045
+ var evtName = _getEvtNamespace(eventName, evtNamespace);
3046
+ result = _doAttach(target, evtName, handlerRef, useCapture);
3047
+ if (result && elmNodeData.accept(target)) {
3048
+ var registeredEvent = {
3049
+ guid: _guid++,
3050
+ evtName: evtName,
3051
+ handler: handlerRef,
3052
+ capture: useCapture
3053
+ };
3054
+ _getRegisteredEvents(target, evtName.type).push(registeredEvent);
3055
+ }
3056
+ }
3057
+ catch (e) {
2785
3058
  }
2786
3059
  }
2787
3060
  return result;
2788
3061
  }
2789
-
2790
- var strVisibilityChangeEvt = "visibilitychange";
2791
- var strPageHide = "pagehide";
2792
- var _cookieMgrs = null;
2793
- var _canUseCookies;
2794
- function addEventHandler(eventName, callback) {
3062
+ function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
3063
+ if (useCapture === void 0) { useCapture = false; }
3064
+ return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
3065
+ }
3066
+ function addEventHandler(eventName, callback, evtNamespace) {
2795
3067
  var result = false;
2796
3068
  var w = getWindow();
2797
3069
  if (w) {
2798
- result = attachEvent(w, eventName, callback);
2799
- result = attachEvent(w["body"], eventName, callback) || result;
3070
+ result = eventOn(w, eventName, callback, evtNamespace);
3071
+ result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
2800
3072
  }
2801
3073
  var doc = getDocument();
2802
3074
  if (doc) {
2803
- result = attachEvent(doc, eventName, callback) || result;
3075
+ result = eventOn(doc, eventName, callback, evtNamespace) || result;
2804
3076
  }
2805
3077
  return result;
2806
3078
  }
2807
- function addEventListeners(events, listener, excludeEvents) {
3079
+ function _addEventListeners(events, listener, excludeEvents, evtNamespace) {
2808
3080
  var added = false;
2809
- if (listener && events && isArray(events)) {
2810
- var excluded_1 = [];
3081
+ if (listener && events && events.length > 0) {
2811
3082
  arrForEach(events, function (name) {
2812
- if (isString(name)) {
3083
+ if (name) {
2813
3084
  if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {
2814
- added = addEventHandler(name, listener) || added;
2815
- }
2816
- else {
2817
- excluded_1.push(name);
3085
+ added = addEventHandler(name, listener, evtNamespace) || added;
2818
3086
  }
2819
3087
  }
2820
3088
  });
2821
- if (!added && excluded_1.length > 0) {
2822
- added = addEventListeners(excluded_1, listener);
3089
+ }
3090
+ return added;
3091
+ }
3092
+ function addEventListeners(events, listener, excludeEvents, evtNamespace) {
3093
+ var added = false;
3094
+ if (listener && events && isArray(events)) {
3095
+ added = _addEventListeners(events, listener, excludeEvents, evtNamespace);
3096
+ if (!added && excludeEvents && excludeEvents.length > 0) {
3097
+ added = _addEventListeners(events, listener, null, evtNamespace);
2823
3098
  }
2824
3099
  }
2825
3100
  return added;
2826
3101
  }
2827
- function addPageUnloadEventListener(listener, excludeEvents) {
2828
- return addEventListeners(["beforeunload", "unload", "pagehide"], listener, excludeEvents);
3102
+ function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {
3103
+ return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);
2829
3104
  }
2830
- function addPageHideEventListener(listener, excludeEvents) {
3105
+ function addPageHideEventListener(listener, excludeEvents, evtNamespace) {
2831
3106
  function _handlePageVisibility(evt) {
2832
3107
  var doc = getDocument();
2833
3108
  if (listener && doc && doc.visibilityState === "hidden") {
2834
3109
  listener(evt);
2835
3110
  }
2836
3111
  }
2837
- var pageUnloadAdded = false;
2838
- if (!excludeEvents || arrIndexOf(excludeEvents, strPageHide) === -1) {
2839
- pageUnloadAdded = addEventHandler(strPageHide, listener);
2840
- }
3112
+ var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
3113
+ var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);
2841
3114
  if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
2842
- pageUnloadAdded = addEventHandler(strVisibilityChangeEvt, _handlePageVisibility) || pageUnloadAdded;
3115
+ pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;
2843
3116
  }
2844
3117
  if (!pageUnloadAdded && excludeEvents) {
2845
- pageUnloadAdded = addPageHideEventListener(listener);
3118
+ pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);
2846
3119
  }
2847
3120
  return pageUnloadAdded;
2848
3121
  }
3122
+
3123
+ var _cookieMgrs = null;
3124
+ var _canUseCookies;
2849
3125
  function newGuid() {
2850
3126
  function randomHexDigit() {
2851
3127
  return randomValue(15);
@@ -2864,7 +3140,7 @@
2864
3140
  }
2865
3141
  function generateW3CId() {
2866
3142
  var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
2867
- var oct = "", tmp;
3143
+ var oct = strEmpty$1, tmp;
2868
3144
  for (var a = 0; a < 4; a++) {
2869
3145
  tmp = random32();
2870
3146
  oct +=
@@ -2959,6 +3235,95 @@
2959
3235
  return _legacyCookieMgr(null, logger).del(name);
2960
3236
  }
2961
3237
 
3238
+ var LoggingSeverity = createEnumStyle({
3239
+ CRITICAL: 1 ,
3240
+ WARNING: 2
3241
+ });
3242
+ var _InternalMessageId = createEnumStyle({
3243
+ BrowserDoesNotSupportLocalStorage: 0 ,
3244
+ BrowserCannotReadLocalStorage: 1 ,
3245
+ BrowserCannotReadSessionStorage: 2 ,
3246
+ BrowserCannotWriteLocalStorage: 3 ,
3247
+ BrowserCannotWriteSessionStorage: 4 ,
3248
+ BrowserFailedRemovalFromLocalStorage: 5 ,
3249
+ BrowserFailedRemovalFromSessionStorage: 6 ,
3250
+ CannotSendEmptyTelemetry: 7 ,
3251
+ ClientPerformanceMathError: 8 ,
3252
+ ErrorParsingAISessionCookie: 9 ,
3253
+ ErrorPVCalc: 10 ,
3254
+ ExceptionWhileLoggingError: 11 ,
3255
+ FailedAddingTelemetryToBuffer: 12 ,
3256
+ FailedMonitorAjaxAbort: 13 ,
3257
+ FailedMonitorAjaxDur: 14 ,
3258
+ FailedMonitorAjaxOpen: 15 ,
3259
+ FailedMonitorAjaxRSC: 16 ,
3260
+ FailedMonitorAjaxSend: 17 ,
3261
+ FailedMonitorAjaxGetCorrelationHeader: 18 ,
3262
+ FailedToAddHandlerForOnBeforeUnload: 19 ,
3263
+ FailedToSendQueuedTelemetry: 20 ,
3264
+ FailedToReportDataLoss: 21 ,
3265
+ FlushFailed: 22 ,
3266
+ MessageLimitPerPVExceeded: 23 ,
3267
+ MissingRequiredFieldSpecification: 24 ,
3268
+ NavigationTimingNotSupported: 25 ,
3269
+ OnError: 26 ,
3270
+ SessionRenewalDateIsZero: 27 ,
3271
+ SenderNotInitialized: 28 ,
3272
+ StartTrackEventFailed: 29 ,
3273
+ StopTrackEventFailed: 30 ,
3274
+ StartTrackFailed: 31 ,
3275
+ StopTrackFailed: 32 ,
3276
+ TelemetrySampledAndNotSent: 33 ,
3277
+ TrackEventFailed: 34 ,
3278
+ TrackExceptionFailed: 35 ,
3279
+ TrackMetricFailed: 36 ,
3280
+ TrackPVFailed: 37 ,
3281
+ TrackPVFailedCalc: 38 ,
3282
+ TrackTraceFailed: 39 ,
3283
+ TransmissionFailed: 40 ,
3284
+ FailedToSetStorageBuffer: 41 ,
3285
+ FailedToRestoreStorageBuffer: 42 ,
3286
+ InvalidBackendResponse: 43 ,
3287
+ FailedToFixDepricatedValues: 44 ,
3288
+ InvalidDurationValue: 45 ,
3289
+ TelemetryEnvelopeInvalid: 46 ,
3290
+ CreateEnvelopeError: 47 ,
3291
+ CannotSerializeObject: 48 ,
3292
+ CannotSerializeObjectNonSerializable: 49 ,
3293
+ CircularReferenceDetected: 50 ,
3294
+ ClearAuthContextFailed: 51 ,
3295
+ ExceptionTruncated: 52 ,
3296
+ IllegalCharsInName: 53 ,
3297
+ ItemNotInArray: 54 ,
3298
+ MaxAjaxPerPVExceeded: 55 ,
3299
+ MessageTruncated: 56 ,
3300
+ NameTooLong: 57 ,
3301
+ SampleRateOutOfRange: 58 ,
3302
+ SetAuthContextFailed: 59 ,
3303
+ SetAuthContextFailedAccountName: 60 ,
3304
+ StringValueTooLong: 61 ,
3305
+ StartCalledMoreThanOnce: 62 ,
3306
+ StopCalledWithoutStart: 63 ,
3307
+ TelemetryInitializerFailed: 64 ,
3308
+ TrackArgumentsNotSpecified: 65 ,
3309
+ UrlTooLong: 66 ,
3310
+ SessionStorageBufferFull: 67 ,
3311
+ CannotAccessCookie: 68 ,
3312
+ IdTooLong: 69 ,
3313
+ InvalidEvent: 70 ,
3314
+ FailedMonitorAjaxSetRequestHeader: 71 ,
3315
+ SendBrowserInfoOnUserInit: 72 ,
3316
+ PluginException: 73 ,
3317
+ NotificationException: 74 ,
3318
+ SnippetScriptLoadFailure: 99 ,
3319
+ InvalidInstrumentationKey: 100 ,
3320
+ CannotParseAiBlobValue: 101 ,
3321
+ InvalidContentBlob: 102 ,
3322
+ TrackPageActionEventFailed: 103 ,
3323
+ FailedAddingCustomDefinedRequestContext: 104 ,
3324
+ InMemoryStorageBufferFull: 105
3325
+ });
3326
+
2962
3327
  var aiInstrumentHooks = "_aiHooks";
2963
3328
  var cbNames = [
2964
3329
  "req", "rsp", "hkErr", "fnErr"
@@ -3134,7 +3499,7 @@
3134
3499
  name = strTrim(name.toString());
3135
3500
  if (name.length > 150 ) {
3136
3501
  nameTrunc = name.substring(0, 150 );
3137
- logger && logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
3502
+ logger && logger.throwInternal(2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
3138
3503
  }
3139
3504
  }
3140
3505
  return nameTrunc || name;
@@ -3147,7 +3512,7 @@
3147
3512
  value = strTrim(value);
3148
3513
  if (value.toString().length > maxLength) {
3149
3514
  valueTrunc = value.toString().substring(0, maxLength);
3150
- logger && logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
3515
+ logger && logger.throwInternal(2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
3151
3516
  }
3152
3517
  }
3153
3518
  return valueTrunc || value;
@@ -3160,7 +3525,7 @@
3160
3525
  if (message) {
3161
3526
  if (message.length > 32768 ) {
3162
3527
  messageTrunc = message.substring(0, 32768 );
3163
- logger && logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
3528
+ logger && logger.throwInternal(2 , _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
3164
3529
  }
3165
3530
  }
3166
3531
  return messageTrunc || message;
@@ -3171,7 +3536,7 @@
3171
3536
  var value = "" + exception;
3172
3537
  if (value.length > 32768 ) {
3173
3538
  exceptionTrunc = value.substring(0, 32768 );
3174
- logger && logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
3539
+ logger && logger.throwInternal(2 , _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
3175
3540
  }
3176
3541
  }
3177
3542
  return exceptionTrunc || exception;
@@ -3185,7 +3550,7 @@
3185
3550
  value = getJSON().stringify(value);
3186
3551
  }
3187
3552
  catch (e) {
3188
- logger && logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
3553
+ logger && logger.throwInternal(2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
3189
3554
  }
3190
3555
  }
3191
3556
  value = dataSanitizeString(logger, value, 8192 );
@@ -3216,7 +3581,7 @@
3216
3581
  input = strTrim(input);
3217
3582
  if (input.length > maxLength) {
3218
3583
  inputTrunc = input.substring(0, maxLength);
3219
- logger && logger.throwInternal(exports.LoggingSeverity.WARNING, _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
3584
+ logger && logger.throwInternal(2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
3220
3585
  }
3221
3586
  }
3222
3587
  return inputTrunc || input;
@@ -3262,6 +3627,7 @@
3262
3627
  return event;
3263
3628
  }
3264
3629
 
3630
+ var strEmpty = "";
3265
3631
  function stringToBoolOrDefault(str, defaultValue) {
3266
3632
  if (defaultValue === void 0) { defaultValue = false; }
3267
3633
  if (str === undefined || str === null) {
@@ -3274,16 +3640,16 @@
3274
3640
  totalms = 0;
3275
3641
  }
3276
3642
  totalms = Math.round(totalms);
3277
- var ms = "" + totalms % 1000;
3278
- var sec = "" + Math.floor(totalms / 1000) % 60;
3279
- var min = "" + Math.floor(totalms / (1000 * 60)) % 60;
3280
- var hour = "" + Math.floor(totalms / (1000 * 60 * 60)) % 24;
3643
+ var ms = strEmpty + totalms % 1000;
3644
+ var sec = strEmpty + Math.floor(totalms / 1000) % 60;
3645
+ var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
3646
+ var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
3281
3647
  var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
3282
3648
  ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
3283
3649
  sec = sec.length < 2 ? "0" + sec : sec;
3284
3650
  min = min.length < 2 ? "0" + min : min;
3285
3651
  hour = hour.length < 2 ? "0" + hour : hour;
3286
- return (days > 0 ? days + "." : "") + hour + ":" + min + ":" + sec + "." + ms;
3652
+ return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
3287
3653
  }
3288
3654
  function getExtensionByName(extensions, identifier) {
3289
3655
  var extension = null;
@@ -3307,17 +3673,15 @@
3307
3673
  var strNotSpecified = "not_specified";
3308
3674
  var strIkey = "iKey";
3309
3675
 
3310
- var StorageType;
3311
- (function (StorageType) {
3312
- StorageType[StorageType["LocalStorage"] = 0] = "LocalStorage";
3313
- StorageType[StorageType["SessionStorage"] = 1] = "SessionStorage";
3314
- })(StorageType || (StorageType = {}));
3315
- exports.DistributedTracingModes = void 0;
3316
- (function (DistributedTracingModes) {
3317
- DistributedTracingModes[DistributedTracingModes["AI"] = 0] = "AI";
3318
- DistributedTracingModes[DistributedTracingModes["AI_AND_W3C"] = 1] = "AI_AND_W3C";
3319
- DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
3320
- })(exports.DistributedTracingModes || (exports.DistributedTracingModes = {}));
3676
+ var StorageType = createEnumStyle({
3677
+ LocalStorage: 0 ,
3678
+ SessionStorage: 1
3679
+ });
3680
+ var DistributedTracingModes = createEnumStyle({
3681
+ AI: 0 ,
3682
+ AI_AND_W3C: 1 ,
3683
+ W3C: 2
3684
+ });
3321
3685
 
3322
3686
  var _canUseLocalStorage = undefined;
3323
3687
  var _canUseSessionStorage = undefined;
@@ -3369,7 +3733,7 @@
3369
3733
  }
3370
3734
  catch (e) {
3371
3735
  _canUseLocalStorage = false;
3372
- logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
3736
+ logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
3373
3737
  }
3374
3738
  }
3375
3739
  return null;
@@ -3383,7 +3747,7 @@
3383
3747
  }
3384
3748
  catch (e) {
3385
3749
  _canUseLocalStorage = false;
3386
- logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
3750
+ logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
3387
3751
  }
3388
3752
  }
3389
3753
  return false;
@@ -3397,7 +3761,7 @@
3397
3761
  }
3398
3762
  catch (e) {
3399
3763
  _canUseLocalStorage = false;
3400
- logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
3764
+ logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
3401
3765
  }
3402
3766
  }
3403
3767
  return false;
@@ -3425,7 +3789,7 @@
3425
3789
  }
3426
3790
  catch (e) {
3427
3791
  _canUseSessionStorage = false;
3428
- logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
3792
+ logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
3429
3793
  }
3430
3794
  }
3431
3795
  return null;
@@ -3439,7 +3803,7 @@
3439
3803
  }
3440
3804
  catch (e) {
3441
3805
  _canUseSessionStorage = false;
3442
- logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
3806
+ logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
3443
3807
  }
3444
3808
  }
3445
3809
  return false;
@@ -3453,7 +3817,7 @@
3453
3817
  }
3454
3818
  catch (e) {
3455
3819
  _canUseSessionStorage = false;
3456
- logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
3820
+ logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
3457
3821
  }
3458
3822
  }
3459
3823
  return false;
@@ -4765,7 +5129,7 @@
4765
5129
  if (!pageViewPerformanceManager.isPerformanceTimingSupported()) {
4766
5130
  appInsights.sendPageViewInternal(pageView, customProperties);
4767
5131
  _flushChannels();
4768
- _logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.NavigationTimingNotSupported, "trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");
5132
+ _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NavigationTimingNotSupported, "trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");
4769
5133
  return;
4770
5134
  }
4771
5135
  var pageViewSent = false;
@@ -4831,7 +5195,7 @@
4831
5195
  }
4832
5196
  }
4833
5197
  catch (e) {
4834
- _logger.throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailedCalc, "trackPageView failed on page load calculation: " + getExceptionName(e), { exception: dumpObj(e) });
5198
+ _logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailedCalc, "trackPageView failed on page load calculation: " + getExceptionName(e), { exception: dumpObj(e) });
4835
5199
  }
4836
5200
  return processed;
4837
5201
  });
@@ -4949,13 +5313,13 @@
4949
5313
  dom = dateTimeUtilsDuration(timing.responseEnd, timing.loadEventEnd);
4950
5314
  }
4951
5315
  if (total === 0) {
4952
- this._logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.ErrorPVCalc, "error calculating page view performance.", { total: total, network: network, request: request, response: response, dom: dom });
5316
+ this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ErrorPVCalc, "error calculating page view performance.", { total: total, network: network, request: request, response: response, dom: dom });
4953
5317
  }
4954
5318
  else if (!this.shouldCollectDuration(total, network, request, response, dom)) {
4955
- this._logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.InvalidDurationValue, "Invalid page load duration value. Browser perf data won't be sent.", { total: total, network: network, request: request, response: response, dom: dom });
5319
+ this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.InvalidDurationValue, "Invalid page load duration value. Browser perf data won't be sent.", { total: total, network: network, request: request, response: response, dom: dom });
4956
5320
  }
4957
5321
  else if (total < Math.floor(network) + Math.floor(request) + Math.floor(response) + Math.floor(dom)) {
4958
- this._logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.ClientPerformanceMathError, "client performance math error.", { total: total, network: network, request: request, response: response, dom: dom });
5322
+ this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ClientPerformanceMathError, "client performance math error.", { total: total, network: network, request: request, response: response, dom: dom });
4959
5323
  }
4960
5324
  else {
4961
5325
  pageViewPerformance.durationMs = total;
@@ -5080,7 +5444,7 @@
5080
5444
  }
5081
5445
  }
5082
5446
  catch (e) {
5083
- itemCtx.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
5447
+ itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
5084
5448
  }
5085
5449
  }
5086
5450
  }
@@ -5095,7 +5459,7 @@
5095
5459
  _self.core.track(telemetryItem);
5096
5460
  }
5097
5461
  catch (e) {
5098
- _self.diagLog().throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5462
+ _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5099
5463
  }
5100
5464
  };
5101
5465
  _self.startTrackEvent = function (name) {
@@ -5103,7 +5467,7 @@
5103
5467
  _eventTracking.start(name);
5104
5468
  }
5105
5469
  catch (e) {
5106
- _self.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackEventFailed, "startTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5470
+ _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackEventFailed, "startTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5107
5471
  }
5108
5472
  };
5109
5473
  _self.stopTrackEvent = function (name, properties, measurements) {
@@ -5111,7 +5475,7 @@
5111
5475
  _eventTracking.stop(name, undefined, properties);
5112
5476
  }
5113
5477
  catch (e) {
5114
- _self.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackEventFailed, "stopTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5478
+ _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackEventFailed, "stopTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5115
5479
  }
5116
5480
  };
5117
5481
  _self.trackTrace = function (trace, customProperties) {
@@ -5120,7 +5484,7 @@
5120
5484
  _self.core.track(telemetryItem);
5121
5485
  }
5122
5486
  catch (e) {
5123
- _self.diagLog().throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5487
+ _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5124
5488
  }
5125
5489
  };
5126
5490
  _self.trackMetric = function (metric, customProperties) {
@@ -5129,7 +5493,7 @@
5129
5493
  _self.core.track(telemetryItem);
5130
5494
  }
5131
5495
  catch (e) {
5132
- _self.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.TrackMetricFailed, "trackMetric failed, metric will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5496
+ _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackMetricFailed, "trackMetric failed, metric will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5133
5497
  }
5134
5498
  };
5135
5499
  _self.trackPageView = function (pageView, customProperties) {
@@ -5141,7 +5505,7 @@
5141
5505
  }
5142
5506
  }
5143
5507
  catch (e) {
5144
- _self.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, "trackPageView failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5508
+ _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, "trackPageView failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5145
5509
  }
5146
5510
  };
5147
5511
  _self.sendPageViewInternal = function (pageView, properties, systemProperties) {
@@ -5162,7 +5526,7 @@
5162
5526
  _self.sendPageViewPerformanceInternal(pageViewPerformance, customProperties);
5163
5527
  }
5164
5528
  catch (e) {
5165
- _self.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, "trackPageViewPerformance failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5529
+ _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, "trackPageViewPerformance failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5166
5530
  }
5167
5531
  };
5168
5532
  _self.startTrackPage = function (name) {
@@ -5174,7 +5538,7 @@
5174
5538
  _pageTracking.start(name);
5175
5539
  }
5176
5540
  catch (e) {
5177
- _self.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackFailed, "startTrackPage failed, page view may not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5541
+ _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackFailed, "startTrackPage failed, page view may not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5178
5542
  }
5179
5543
  };
5180
5544
  _self.stopTrackPage = function (name, url, properties, measurement) {
@@ -5193,7 +5557,7 @@
5193
5557
  }
5194
5558
  }
5195
5559
  catch (e) {
5196
- _self.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackFailed, "stopTrackPage failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5560
+ _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackFailed, "stopTrackPage failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5197
5561
  }
5198
5562
  };
5199
5563
  _self.sendExceptionInternal = function (exception, customProperties, systemProperties) {
@@ -5207,7 +5571,7 @@
5207
5571
  _self.sendExceptionInternal(exception, customProperties);
5208
5572
  }
5209
5573
  catch (e) {
5210
- _self.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.TrackExceptionFailed, "trackException failed, exception will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5574
+ _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackExceptionFailed, "trackException failed, exception will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5211
5575
  }
5212
5576
  };
5213
5577
  _self._onerror = function (exception) {
@@ -5241,7 +5605,7 @@
5241
5605
  }
5242
5606
  catch (e) {
5243
5607
  var errorString = error ? (error.name + ", " + error.message) : "null";
5244
- _self.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.ExceptionWhileLoggingError, "_onError threw exception while logging error, error will not be collected: "
5608
+ _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ExceptionWhileLoggingError, "_onError threw exception while logging error, error will not be collected: "
5245
5609
  + getExceptionName(e), { exception: dumpObj(e), errorString: errorString });
5246
5610
  }
5247
5611
  };
@@ -5454,7 +5818,7 @@
5454
5818
  config.disableFlushOnUnload = stringToBoolOrDefault(config.disableFlushOnUnload, config.disableFlushOnBeforeUnload);
5455
5819
  return config;
5456
5820
  };
5457
- ApplicationInsights.Version = "2.8.0-beta.2202-06";
5821
+ ApplicationInsights.Version = "2.8.0-beta.2203-02";
5458
5822
  return ApplicationInsights;
5459
5823
  }(BaseTelemetryPlugin));
5460
5824
  var Timing = /** @class */ (function () {
@@ -5463,14 +5827,14 @@
5463
5827
  var _events = {};
5464
5828
  _self.start = function (name) {
5465
5829
  if (typeof _events[name] !== "undefined") {
5466
- logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.", { name: name, key: name }, true);
5830
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.", { name: name, key: name }, true);
5467
5831
  }
5468
5832
  _events[name] = +new Date;
5469
5833
  };
5470
5834
  _self.stop = function (name, url, properties, measurements) {
5471
5835
  var start = _events[name];
5472
5836
  if (isNaN(start)) {
5473
- logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.", { name: name, key: name }, true);
5837
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.", { name: name, key: name }, true);
5474
5838
  }
5475
5839
  else {
5476
5840
  var end = +new Date;
@@ -5499,7 +5863,7 @@
5499
5863
  _self.enqueue = function (payload) {
5500
5864
  if (_self.count() >= config.eventsLimitInMem()) {
5501
5865
  if (!_bufferFullMessageSent) {
5502
- logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.InMemoryStorageBufferFull, "Maximum in-memory buffer size reached: " + _self.count(), true);
5866
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.InMemoryStorageBufferFull, "Maximum in-memory buffer size reached: " + _self.count(), true);
5503
5867
  _bufferFullMessageSent = true;
5504
5868
  }
5505
5869
  return;
@@ -5571,7 +5935,7 @@
5571
5935
  _self.enqueue = function (payload) {
5572
5936
  if (_self.count() >= SessionStorageSendBuffer.MAX_BUFFER_SIZE) {
5573
5937
  if (!_bufferFullMessageSent) {
5574
- logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.SessionStorageBufferFull, "Maximum buffer size reached: " + _self.count(), true);
5938
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionStorageBufferFull, "Maximum buffer size reached: " + _self.count(), true);
5575
5939
  _bufferFullMessageSent = true;
5576
5940
  }
5577
5941
  return;
@@ -5591,7 +5955,7 @@
5591
5955
  if (sentElements instanceof Array && payload instanceof Array) {
5592
5956
  sentElements = sentElements.concat(payload);
5593
5957
  if (sentElements.length > SessionStorageSendBuffer.MAX_BUFFER_SIZE) {
5594
- logger.throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.SessionStorageBufferFull, "Sent buffer reached its maximum size: " + sentElements.length, true);
5958
+ logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.SessionStorageBufferFull, "Sent buffer reached its maximum size: " + sentElements.length, true);
5595
5959
  sentElements.length = SessionStorageSendBuffer.MAX_BUFFER_SIZE;
5596
5960
  }
5597
5961
  _setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, sentElements);
@@ -5627,7 +5991,7 @@
5627
5991
  }
5628
5992
  }
5629
5993
  catch (e) {
5630
- logger.throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.FailedToRestoreStorageBuffer, " storage key: " + prefixedKey + ", " + getExceptionName(e), { exception: dumpObj(e) });
5994
+ logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToRestoreStorageBuffer, " storage key: " + prefixedKey + ", " + getExceptionName(e), { exception: dumpObj(e) });
5631
5995
  }
5632
5996
  return [];
5633
5997
  }
@@ -5640,7 +6004,7 @@
5640
6004
  }
5641
6005
  catch (e) {
5642
6006
  utlSetSessionStorage(logger, prefixedKey, JSON.stringify([]));
5643
- logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.FailedToSetStorageBuffer, " storage key: " + prefixedKey + ", " + getExceptionName(e) + ". Buffer cleared", { exception: dumpObj(e) });
6007
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedToSetStorageBuffer, " storage key: " + prefixedKey + ", " + getExceptionName(e) + ". Buffer cleared", { exception: dumpObj(e) });
5644
6008
  }
5645
6009
  }
5646
6010
  });
@@ -5757,11 +6121,11 @@
5757
6121
  }
5758
6122
  function EnvelopeCreatorInit(logger, telemetryItem) {
5759
6123
  if (isNullOrUndefined(telemetryItem[strBaseData])) {
5760
- logger.throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryEnvelopeInvalid, "telemetryItem.baseData cannot be null.");
6124
+ logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryEnvelopeInvalid, "telemetryItem.baseData cannot be null.");
5761
6125
  }
5762
6126
  }
5763
6127
  var EnvelopeCreator = {
5764
- Version: "2.8.0-beta.2202-06"
6128
+ Version: "2.8.0-beta.2203-02"
5765
6129
  };
5766
6130
  function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
5767
6131
  EnvelopeCreatorInit(logger, telemetryItem);
@@ -5920,18 +6284,18 @@
5920
6284
  return getJSON().stringify(output);
5921
6285
  }
5922
6286
  catch (e) {
5923
- logger.throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, (e && isFunction(e.toString)) ? e.toString() : "Error serializing object", null, true);
6287
+ logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, (e && isFunction(e.toString)) ? e.toString() : "Error serializing object", null, true);
5924
6288
  }
5925
6289
  };
5926
6290
  function _serializeObject(source, name) {
5927
6291
  var circularReferenceCheck = "__aiCircularRefCheck";
5928
6292
  var output = {};
5929
6293
  if (!source) {
5930
- logger.throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, "cannot serialize object because it is null or undefined", { name: name }, true);
6294
+ logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, "cannot serialize object because it is null or undefined", { name: name }, true);
5931
6295
  return output;
5932
6296
  }
5933
6297
  if (source[circularReferenceCheck]) {
5934
- logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.CircularReferenceDetected, "Circular reference detected while serializing object", { name: name }, true);
6298
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CircularReferenceDetected, "Circular reference detected while serializing object", { name: name }, true);
5935
6299
  return output;
5936
6300
  }
5937
6301
  if (!source.aiDataContract) {
@@ -5948,13 +6312,13 @@
5948
6312
  output = _serializeArray(source, name);
5949
6313
  }
5950
6314
  else {
5951
- logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "Attempting to serialize an object which does not implement ISerializable", { name: name }, true);
6315
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "Attempting to serialize an object which does not implement ISerializable", { name: name }, true);
5952
6316
  try {
5953
6317
  getJSON().stringify(source);
5954
6318
  output = source;
5955
6319
  }
5956
6320
  catch (e) {
5957
- logger.throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, (e && isFunction(e.toString)) ? e.toString() : "Error serializing object", null, true);
6321
+ logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, (e && isFunction(e.toString)) ? e.toString() : "Error serializing object", null, true);
5958
6322
  }
5959
6323
  }
5960
6324
  return output;
@@ -5967,7 +6331,7 @@
5967
6331
  var isPresent = source[field] !== undefined;
5968
6332
  var isObj = isObject(source[field]) && source[field] !== null;
5969
6333
  if (isRequired && !isPresent && !isArray) {
5970
- logger.throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.MissingRequiredFieldSpecification, "Missing required field specification. The field is required but not present on source", { field: field, name: name });
6334
+ logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.MissingRequiredFieldSpecification, "Missing required field specification. The field is required but not present on source", { field: field, name: name });
5971
6335
  }
5972
6336
  else if (!isHidden) {
5973
6337
  var value = void 0;
@@ -5994,7 +6358,7 @@
5994
6358
  var output;
5995
6359
  if (!!sources) {
5996
6360
  if (!isArray(sources)) {
5997
- logger.throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.ItemNotInArray, "This field was specified as an array in the contract but the item is not an array.\r\n", { name: name }, true);
6361
+ logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ItemNotInArray, "This field was specified as an array in the contract but the item is not an array.\r\n", { name: name }, true);
5998
6362
  }
5999
6363
  else {
6000
6364
  output = [];
@@ -6045,7 +6409,7 @@
6045
6409
  }
6046
6410
  else {
6047
6411
  output[field] = "invalid field: " + name + " is of unknown type.";
6048
- logger.throwInternal(exports.LoggingSeverity.CRITICAL, output[field], null, true);
6412
+ logger.throwInternal(LoggingSeverity.CRITICAL, output[field], null, true);
6049
6413
  }
6050
6414
  });
6051
6415
  }
@@ -6175,7 +6539,7 @@
6175
6539
  this.INT_MAX_VALUE = 2147483647;
6176
6540
  var _logger = logger || safeGetLogger(null);
6177
6541
  if (sampleRate > 100 || sampleRate < 0) {
6178
- _logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.SampleRateOutOfRange, "Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.", { samplingRate: sampleRate }, true);
6542
+ _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SampleRateOutOfRange, "Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.", { samplingRate: sampleRate }, true);
6179
6543
  sampleRate = 100;
6180
6544
  }
6181
6545
  this.sampleRate = sampleRate;
@@ -6280,7 +6644,7 @@
6280
6644
  _self.triggerSend(isAsync, null, sendReason || 1 );
6281
6645
  }
6282
6646
  catch (e) {
6283
- _self.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.FlushFailed, "flush failed, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6647
+ _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FlushFailed, "flush failed, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6284
6648
  }
6285
6649
  }
6286
6650
  };
@@ -6291,7 +6655,7 @@
6291
6655
  _self.triggerSend(true, _doUnloadSend, 2 );
6292
6656
  }
6293
6657
  catch (e) {
6294
- _self.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.FailedToSendQueuedTelemetry, "failed to flush with beacon sender on page unload, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6658
+ _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToSendQueuedTelemetry, "failed to flush with beacon sender on page unload, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6295
6659
  }
6296
6660
  }
6297
6661
  else {
@@ -6322,7 +6686,7 @@
6322
6686
  ? new SessionStorageSendBuffer(diagLog, _self._senderConfig) : new ArraySendBuffer(diagLog, _self._senderConfig);
6323
6687
  _self._sample = new Sample(_self._senderConfig.samplingPercentage(), diagLog);
6324
6688
  if (!_validateInstrumentationKey(config)) {
6325
- diagLog.throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.InvalidInstrumentationKey, "Invalid Instrumentation key " + config.instrumentationKey);
6689
+ diagLog.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidInstrumentationKey, "Invalid Instrumentation key " + config.instrumentationKey);
6326
6690
  }
6327
6691
  if (!isInternalApplicationInsightsEndpoint(_self._senderConfig.endpointUrl()) && _self._senderConfig.customHeaders() && _self._senderConfig.customHeaders().length > 0) {
6328
6692
  arrForEach(_self._senderConfig.customHeaders(), function (customHeader) {
@@ -6368,22 +6732,22 @@
6368
6732
  return;
6369
6733
  }
6370
6734
  if (!telemetryItem) {
6371
- itemCtx.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.CannotSendEmptyTelemetry, "Cannot send empty telemetry");
6735
+ itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSendEmptyTelemetry, "Cannot send empty telemetry");
6372
6736
  return;
6373
6737
  }
6374
6738
  if (telemetryItem.baseData && !telemetryItem.baseType) {
6375
- itemCtx.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.InvalidEvent, "Cannot send telemetry without baseData and baseType");
6739
+ itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidEvent, "Cannot send telemetry without baseData and baseType");
6376
6740
  return;
6377
6741
  }
6378
6742
  if (!telemetryItem.baseType) {
6379
6743
  telemetryItem.baseType = "EventData";
6380
6744
  }
6381
6745
  if (!_self._sender) {
6382
- itemCtx.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, "Sender was not initialized");
6746
+ itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, "Sender was not initialized");
6383
6747
  return;
6384
6748
  }
6385
6749
  if (!_isSampledIn(telemetryItem)) {
6386
- itemCtx.diagLog().throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.TelemetrySampledAndNotSent, "Telemetry item was sampled out and not sent", { SampleRate: _self._sample.sampleRate });
6750
+ itemCtx.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TelemetrySampledAndNotSent, "Telemetry item was sampled out and not sent", { SampleRate: _self._sample.sampleRate });
6387
6751
  return;
6388
6752
  }
6389
6753
  else {
@@ -6393,7 +6757,7 @@
6393
6757
  var defaultEnvelopeIkey = telemetryItem.iKey || _self._senderConfig.instrumentationKey();
6394
6758
  var aiEnvelope_1 = Sender.constructEnvelope(telemetryItem, defaultEnvelopeIkey, itemCtx.diagLog(), convertUndefined);
6395
6759
  if (!aiEnvelope_1) {
6396
- itemCtx.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.CreateEnvelopeError, "Unable to create an AppInsights envelope");
6760
+ itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CreateEnvelopeError, "Unable to create an AppInsights envelope");
6397
6761
  return;
6398
6762
  }
6399
6763
  var doNotSendItem_1 = false;
@@ -6406,7 +6770,7 @@
6406
6770
  }
6407
6771
  }
6408
6772
  catch (e) {
6409
- itemCtx.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
6773
+ itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
6410
6774
  }
6411
6775
  });
6412
6776
  delete telemetryItem.tags[ProcessLegacy];
@@ -6424,7 +6788,7 @@
6424
6788
  _setupTimer();
6425
6789
  }
6426
6790
  catch (e) {
6427
- itemCtx.diagLog().throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.FailedAddingTelemetryToBuffer, "Failed adding telemetry to the sender's buffer, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
6791
+ itemCtx.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedAddingTelemetryToBuffer, "Failed adding telemetry to the sender's buffer, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
6428
6792
  }
6429
6793
  _self.processNext(telemetryItem, itemCtx);
6430
6794
  };
@@ -6459,13 +6823,13 @@
6459
6823
  catch (e) {
6460
6824
  var ieVer = getIEVersion();
6461
6825
  if (!ieVer || ieVer > 9) {
6462
- _self.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.TransmissionFailed, "Telemetry transmission failed, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
6826
+ _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TransmissionFailed, "Telemetry transmission failed, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
6463
6827
  }
6464
6828
  }
6465
6829
  }
6466
6830
  };
6467
6831
  _self._onError = function (payload, message, event) {
6468
- _self.diagLog().throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.OnError, "Failed to send telemetry.", { message: message });
6832
+ _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.OnError, "Failed to send telemetry.", { message: message });
6469
6833
  _self._buffer.clearSent(payload);
6470
6834
  };
6471
6835
  _self._onPartialSuccess = function (payload, results) {
@@ -6490,7 +6854,7 @@
6490
6854
  }
6491
6855
  if (retry.length > 0) {
6492
6856
  _resendPayload(retry);
6493
- _self.diagLog().throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, "Partial success. " +
6857
+ _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, "Partial success. " +
6494
6858
  "Delivered: " + payload.length + ", Failed: " + failed.length +
6495
6859
  ". Will retry to send " + retry.length + " our of " + results.itemsReceived + " items");
6496
6860
  }
@@ -6535,7 +6899,7 @@
6535
6899
  }
6536
6900
  if (!_self._senderConfig.isRetryDisabled() && _isRetriable(status)) {
6537
6901
  _resendPayload(payload);
6538
- _self.diagLog().throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
6902
+ _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
6539
6903
  "Response code " + status + ". Will retry to send " + payload.length + " items.");
6540
6904
  }
6541
6905
  else {
@@ -6546,7 +6910,7 @@
6546
6910
  if (!_self._senderConfig.isRetryDisabled()) {
6547
6911
  var offlineBackOffMultiplier = 10;
6548
6912
  _resendPayload(payload, offlineBackOffMultiplier);
6549
- _self.diagLog().throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". Offline - Response Code: ".concat(status, ". Offline status: ").concat(Offline.isOffline(), ". Will retry to send ").concat(payload.length, " items."));
6913
+ _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". Offline - Response Code: ".concat(status, ". Offline status: ").concat(Offline.isOffline(), ". Will retry to send ").concat(payload.length, " items."));
6550
6914
  }
6551
6915
  }
6552
6916
  else {
@@ -6614,7 +6978,7 @@
6614
6978
  }
6615
6979
  if (droppedPayload.length > 0) {
6616
6980
  _fallbackSender(droppedPayload, true);
6617
- _self.diagLog().throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with normal sender.");
6981
+ _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with normal sender.");
6618
6982
  }
6619
6983
  }
6620
6984
  }
@@ -6655,7 +7019,7 @@
6655
7019
  }
6656
7020
  else {
6657
7021
  _fallbackSender && _fallbackSender(payload, true);
6658
- _self.diagLog().throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with xhrSender.");
7022
+ _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with xhrSender.");
6659
7023
  }
6660
7024
  }
6661
7025
  }
@@ -6746,7 +7110,7 @@
6746
7110
  }
6747
7111
  }
6748
7112
  catch (e) {
6749
- _self.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.InvalidBackendResponse, "Cannot parse the response. " + getExceptionName(e), {
7113
+ _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidBackendResponse, "Cannot parse the response. " + getExceptionName(e), {
6750
7114
  response: response
6751
7115
  });
6752
7116
  }
@@ -6817,7 +7181,7 @@
6817
7181
  xdr.onerror = function (event) { return _self._onError(payload, _formatErrorMessageXdr(xdr), event); };
6818
7182
  var hostingProtocol = _window && _window.location && _window.location.protocol || "";
6819
7183
  if (_self._senderConfig.endpointUrl().lastIndexOf(hostingProtocol, 0) !== 0) {
6820
- _self.diagLog().throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
7184
+ _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
6821
7185
  "Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.");
6822
7186
  buffer.clear();
6823
7187
  return;
@@ -6848,7 +7212,7 @@
6848
7212
  manager.eventsSendRequest(sendRequest, isAsync);
6849
7213
  }
6850
7214
  catch (e) {
6851
- _self.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.NotificationException, "send request notification failed: " + getExceptionName(e), { exception: dumpObj(e) });
7215
+ _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.NotificationException, "send request notification failed: " + getExceptionName(e), { exception: dumpObj(e) });
6852
7216
  }
6853
7217
  }
6854
7218
  }
@@ -6959,10 +7323,10 @@
6959
7323
  var acqMs = +tokens[1] || 0;
6960
7324
  var renewalMs = +tokens[2] || 0;
6961
7325
  if (isNaN(acqMs) || acqMs <= 0) {
6962
- _logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.SessionRenewalDateIsZero, "AI session acquisition date is 0" + sessionReset);
7326
+ _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionRenewalDateIsZero, "AI session acquisition date is 0" + sessionReset);
6963
7327
  }
6964
7328
  else if (isNaN(renewalMs) || renewalMs <= 0) {
6965
- _logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.SessionRenewalDateIsZero, "AI session renewal date is 0" + sessionReset);
7329
+ _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionRenewalDateIsZero, "AI session renewal date is 0" + sessionReset);
6966
7330
  }
6967
7331
  else if (tokens[0]) {
6968
7332
  session.id = tokens[0];
@@ -6972,7 +7336,7 @@
6972
7336
  }
6973
7337
  }
6974
7338
  catch (e) {
6975
- _logger.throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.ErrorParsingAISessionCookie, "Error parsing ai_session value [" + (sessionData || "") + "]" + sessionReset + " - " + getExceptionName(e), { exception: dumpObj(e) });
7339
+ _logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ErrorParsingAISessionCookie, "Error parsing ai_session value [" + (sessionData || "") + "]" + sessionReset + " - " + getExceptionName(e), { exception: dumpObj(e) });
6976
7340
  }
6977
7341
  }
6978
7342
  return isValid;
@@ -6984,7 +7348,7 @@
6984
7348
  _self.automaticSession.acquisitionDate = nowMs;
6985
7349
  _setCookie(_self.automaticSession, nowMs);
6986
7350
  if (!utlCanUseLocalStorage()) {
6987
- _logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.BrowserDoesNotSupportLocalStorage, "Browser does not support local storage. Session durations will be inaccurate.");
7351
+ _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserDoesNotSupportLocalStorage, "Browser does not support local storage. Session durations will be inaccurate.");
6988
7352
  }
6989
7353
  }
6990
7354
  function _setCookie(session, nowMs) {
@@ -7030,7 +7394,7 @@
7030
7394
  return Device;
7031
7395
  }());
7032
7396
 
7033
- var Version = "2.8.0-beta.2202-06";
7397
+ var Version = "2.8.0-beta.2203-02";
7034
7398
  var Internal = /** @class */ (function () {
7035
7399
  function Internal(config) {
7036
7400
  this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + Version;
@@ -7106,7 +7470,7 @@
7106
7470
  if (storeInCookie === void 0) { storeInCookie = false; }
7107
7471
  var isInvalidInput = !_validateUserInput(authenticatedUserId) || (accountId && !_validateUserInput(accountId));
7108
7472
  if (isInvalidInput) {
7109
- _logger.throwInternal(exports.LoggingSeverity.WARNING, _InternalMessageId.SetAuthContextFailedAccountName, "Setting auth user context failed. " +
7473
+ _logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SetAuthContextFailedAccountName, "Setting auth user context failed. " +
7110
7474
  "User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.", true);
7111
7475
  return;
7112
7476
  }
@@ -7324,7 +7688,7 @@
7324
7688
  if (userCtx && userCtx.isNewUser) {
7325
7689
  userCtx.isNewUser = false;
7326
7690
  var message = new _InternalLogMessage(_InternalMessageId.SendBrowserInfoOnUserInit, ((getNavigator() || {}).userAgent || ""));
7327
- itemCtx.diagLog().logInternalMessage(exports.LoggingSeverity.CRITICAL, message);
7691
+ itemCtx.diagLog().logInternalMessage(LoggingSeverity.CRITICAL, message);
7328
7692
  }
7329
7693
  _self.processNext(event, itemCtx);
7330
7694
  }
@@ -7673,10 +8037,10 @@
7673
8037
  return result;
7674
8038
  }
7675
8039
  function _throwInternalCritical(ajaxMonitorInstance, msgId, message, properties, isUserAct) {
7676
- ajaxMonitorInstance[strDiagLog]()[strThrowInternal](exports.LoggingSeverity.CRITICAL, msgId, message, properties, isUserAct);
8040
+ ajaxMonitorInstance[strDiagLog]()[strThrowInternal](LoggingSeverity.CRITICAL, msgId, message, properties, isUserAct);
7677
8041
  }
7678
8042
  function _throwInternalWarning(ajaxMonitorInstance, msgId, message, properties, isUserAct) {
7679
- ajaxMonitorInstance[strDiagLog]()[strThrowInternal](exports.LoggingSeverity.WARNING, msgId, message, properties, isUserAct);
8043
+ ajaxMonitorInstance[strDiagLog]()[strThrowInternal](LoggingSeverity.WARNING, msgId, message, properties, isUserAct);
7680
8044
  }
7681
8045
  function _createErrorCallbackFunc(ajaxMonitorInstance, internalMessage, message) {
7682
8046
  return function (args) {
@@ -7714,19 +8078,21 @@
7714
8078
  var _enableAjaxPerfTracking = false;
7715
8079
  var _maxAjaxCallsPerView = 0;
7716
8080
  var _enableResponseHeaderTracking = false;
7717
- var _hooks = [];
7718
8081
  var _disabledUrls = {};
7719
8082
  var _excludeRequestFromAutoTrackingPatterns;
7720
8083
  var _addRequestContext;
7721
- dynamicProto(AjaxMonitor, _this, function (_self, base) {
8084
+ var _evtNamespace;
8085
+ dynamicProto(AjaxMonitor, _this, function (_self, _base) {
8086
+ var _addHook = _base._addHook;
7722
8087
  _self.initialize = function (config, core, extensions, pluginChain) {
7723
8088
  if (!_self.isInitialized()) {
7724
- base.initialize(config, core, extensions, pluginChain);
8089
+ _base.initialize(config, core, extensions, pluginChain);
7725
8090
  var ctx_1 = _self._getTelCtx();
7726
8091
  var defaultConfig = AjaxMonitor.getDefaultConfig();
7727
8092
  objForEachKey(defaultConfig, function (field, value) {
7728
8093
  _config[field] = ctx_1.getConfig(AjaxMonitor.identifier, field, value);
7729
8094
  });
8095
+ _evtNamespace = mergeEvtNamespace(createUniqueNamespace("ajax"), core && core.evtNamespace && core.evtNamespace());
7730
8096
  var distributedTracingMode = _config.distributedTracingMode;
7731
8097
  _enableRequestHeaderTracking = _config.enableRequestHeaderTracking;
7732
8098
  _enableAjaxErrorStatusText = _config.enableAjaxErrorStatusText;
@@ -7735,8 +8101,8 @@
7735
8101
  _enableResponseHeaderTracking = _config.enableResponseHeaderTracking;
7736
8102
  _excludeRequestFromAutoTrackingPatterns = _config.excludeRequestFromAutoTrackingPatterns;
7737
8103
  _addRequestContext = _config.addRequestContext;
7738
- _isUsingAIHeaders = distributedTracingMode === exports.DistributedTracingModes.AI || distributedTracingMode === exports.DistributedTracingModes.AI_AND_W3C;
7739
- _isUsingW3CHeaders = distributedTracingMode === exports.DistributedTracingModes.AI_AND_W3C || distributedTracingMode === exports.DistributedTracingModes.W3C;
8104
+ _isUsingAIHeaders = distributedTracingMode === 0 || distributedTracingMode === 1 ;
8105
+ _isUsingW3CHeaders = distributedTracingMode === 1 || distributedTracingMode === 2 ;
7740
8106
  if (_enableAjaxPerfTracking) {
7741
8107
  var iKey = config.instrumentationKey || "unkwn";
7742
8108
  if (iKey.length > 5) {
@@ -7764,14 +8130,9 @@
7764
8130
  }
7765
8131
  }
7766
8132
  };
7767
- _self.teardown = function () {
7768
- arrForEach(_hooks, function (fn) {
7769
- fn.rm();
7770
- });
7771
- _hooks = [];
8133
+ _self._doTeardown = function () {
7772
8134
  _fetchInitialized = false;
7773
8135
  _xhrInitialized = false;
7774
- _self.setInitialized(false);
7775
8136
  };
7776
8137
  _self.trackDependencyData = function (dependency, properties) {
7777
8138
  _self[strTrackDependencyDataInternal](dependency, properties);
@@ -7838,8 +8199,8 @@
7838
8199
  };
7839
8200
  _self[strTrackDependencyDataInternal] = function (dependency, properties, systemProperties) {
7840
8201
  if (_maxAjaxCallsPerView === -1 || _trackAjaxAttempts < _maxAjaxCallsPerView) {
7841
- if ((_config.distributedTracingMode === exports.DistributedTracingModes.W3C
7842
- || _config.distributedTracingMode === exports.DistributedTracingModes.AI_AND_W3C)
8202
+ if ((_config.distributedTracingMode === 2
8203
+ || _config.distributedTracingMode === 1 )
7843
8204
  && typeof dependency.id === "string" && dependency.id[dependency.id.length - 1] !== ".") {
7844
8205
  dependency.id += ".";
7845
8206
  }
@@ -7874,7 +8235,7 @@
7874
8235
  var global = getGlobal();
7875
8236
  var isPolyfill = fetch.polyfill;
7876
8237
  if (_config.disableFetchTracking === false) {
7877
- _hooks.push(InstrumentFunc(global, strFetch, {
8238
+ _addHook(InstrumentFunc(global, strFetch, {
7878
8239
  req: function (callDetails, input, init) {
7879
8240
  var fetchData;
7880
8241
  if (_fetchInitialized &&
@@ -7922,7 +8283,7 @@
7922
8283
  _fetchInitialized = true;
7923
8284
  }
7924
8285
  else if (isPolyfill) {
7925
- _hooks.push(InstrumentFunc(global, strFetch, {
8286
+ _addHook(InstrumentFunc(global, strFetch, {
7926
8287
  req: function (callDetails, input, init) {
7927
8288
  _isDisabledRequest(null, input, init);
7928
8289
  }
@@ -7933,7 +8294,7 @@
7933
8294
  }
7934
8295
  }
7935
8296
  function _hookProto(target, funcName, callbacks) {
7936
- _hooks.push(InstrumentProto(target, funcName, callbacks));
8297
+ _addHook(InstrumentProto(target, funcName, callbacks));
7937
8298
  }
7938
8299
  function _instrumentXhr() {
7939
8300
  if (_supportsAjaxMonitoring(_self) && !_xhrInitialized) {
@@ -8055,7 +8416,7 @@
8055
8416
  xhr[strAjaxData] = ajaxData;
8056
8417
  }
8057
8418
  function _attachToOnReadyStateChange(xhr) {
8058
- xhr[strAjaxData].xhrMonitoringState.stateChangeAttached = attachEvent(xhr, "readystatechange", function () {
8419
+ xhr[strAjaxData].xhrMonitoringState.stateChangeAttached = eventOn(xhr, "readystatechange", function () {
8059
8420
  try {
8060
8421
  if (xhr && xhr.readyState === 4 && _isMonitoredXhrInstance(xhr)) {
8061
8422
  _onAjaxComplete(xhr);
@@ -8070,7 +8431,7 @@
8070
8431
  });
8071
8432
  }
8072
8433
  }
8073
- });
8434
+ }, _evtNamespace);
8074
8435
  }
8075
8436
  function _getResponseText(xhr) {
8076
8437
  try {
@@ -8355,7 +8716,7 @@
8355
8716
  disableFetchTracking: true,
8356
8717
  excludeRequestFromAutoTrackingPatterns: undefined,
8357
8718
  disableCorrelationHeaders: false,
8358
- distributedTracingMode: exports.DistributedTracingModes.AI_AND_W3C,
8719
+ distributedTracingMode: 1 ,
8359
8720
  correlationHeaderExcludedDomains: [
8360
8721
  "*.blob.core.windows.net",
8361
8722
  "*.blob.core.chinacloudapi.cn",
@@ -8441,7 +8802,7 @@
8441
8802
  TelemetryItemCreator: TelemetryItemCreator,
8442
8803
  CtxTagKeys: CtxTagKeys,
8443
8804
  Extensions: Extensions,
8444
- DistributedTracingModes: exports.DistributedTracingModes
8805
+ DistributedTracingModes: DistributedTracingModes
8445
8806
  };
8446
8807
  var Initialization = /** @class */ (function () {
8447
8808
  function Initialization(snippet) {
@@ -8640,7 +9001,7 @@
8640
9001
  added = addPageUnloadEventListener(performHousekeeping, excludePageUnloadEvents);
8641
9002
  added = addPageHideEventListener(performHousekeeping, excludePageUnloadEvents) || added;
8642
9003
  if (!added && !isReactNative()) {
8643
- appInsightsInstance.appInsights.core.logger.throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.FailedToAddHandlerForOnBeforeUnload, "Could not add handler for beforeunload and pagehide");
9004
+ appInsightsInstance.appInsights.core.logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToAddHandlerForOnBeforeUnload, "Could not add handler for beforeunload and pagehide");
8644
9005
  }
8645
9006
  }
8646
9007
  if (!added && !appInsightsInstance.appInsights.config.disableFlushOnUnload) {
@@ -8888,8 +9249,10 @@
8888
9249
  exports.BaseTelemetryPlugin = BaseTelemetryPlugin;
8889
9250
  exports.CoreUtils = CoreUtils;
8890
9251
  exports.DependenciesPlugin = AjaxMonitor;
9252
+ exports.DistributedTracingModes = DistributedTracingModes;
8891
9253
  exports.Event = Event$1;
8892
9254
  exports.Exception = Exception;
9255
+ exports.LoggingSeverity = LoggingSeverity;
8893
9256
  exports.Metric = Metric;
8894
9257
  exports.NotificationManager = NotificationManager;
8895
9258
  exports.PageView = PageView;