@microsoft/applicationinsights-properties-js 2.7.5-nightly.2203-03 → 2.7.5

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 (34) hide show
  1. package/browser/applicationinsights-properties-js.integrity.json +9 -9
  2. package/browser/applicationinsights-properties-js.js +446 -941
  3. package/browser/applicationinsights-properties-js.js.map +1 -1
  4. package/browser/applicationinsights-properties-js.min.js +2 -2
  5. package/browser/applicationinsights-properties-js.min.js.map +1 -1
  6. package/dist/applicationinsights-properties-js.api.json +118 -63
  7. package/dist/applicationinsights-properties-js.d.ts +1 -1
  8. package/dist/applicationinsights-properties-js.js +446 -941
  9. package/dist/applicationinsights-properties-js.js.map +1 -1
  10. package/dist/applicationinsights-properties-js.min.js +2 -2
  11. package/dist/applicationinsights-properties-js.min.js.map +1 -1
  12. package/dist/applicationinsights-properties-js.rollup.d.ts +1 -1
  13. package/dist-esm/Context/Application.js +1 -1
  14. package/dist-esm/Context/Device.js +1 -1
  15. package/dist-esm/Context/Internal.js +2 -2
  16. package/dist-esm/Context/Internal.js.map +1 -1
  17. package/dist-esm/Context/Location.js +1 -1
  18. package/dist-esm/Context/Session.js +1 -1
  19. package/dist-esm/Context/TelemetryTrace.js +1 -1
  20. package/dist-esm/Context/User.js +1 -1
  21. package/dist-esm/Context/User.js.map +1 -1
  22. package/dist-esm/Interfaces/IPropTelemetryContext.js +1 -1
  23. package/dist-esm/Interfaces/ITelemetryConfig.js +1 -1
  24. package/dist-esm/PropertiesPlugin.js +1 -1
  25. package/dist-esm/TelemetryContext.js +1 -1
  26. package/dist-esm/applicationinsights-properties-js.js +1 -1
  27. package/package.json +58 -61
  28. package/src/Context/Internal.ts +1 -1
  29. package/src/Context/Session.ts +2 -2
  30. package/src/Context/User.ts +1 -1
  31. package/src/PropertiesPlugin.ts +1 -1
  32. package/src/TelemetryContext.ts +1 -1
  33. package/types/Context/User.d.ts +5 -5
  34. package/types/tsdoc-metadata.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.7.5-nightly.2203-03
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.7.5
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -62,9 +62,7 @@
62
62
  (getGlobal() || {})["Reflect"];
63
63
  var extendStaticsFn = function (d, b) {
64
64
  extendStaticsFn = ObjClass["setPrototypeOf"] ||
65
- ({ __proto__: [] } instanceof Array && function (d, b) {
66
- d.__proto__ = b;
67
- }) ||
65
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
68
66
  function (d, b) {
69
67
  for (var p in b) {
70
68
  if (b[strShimHasOwnProperty](p)) {
@@ -79,14 +77,12 @@
79
77
  throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
80
78
  }
81
79
  extendStaticsFn(d, b);
82
- function __() {
83
- this.constructor = d;
84
- }
80
+ function __() { this.constructor = d; }
85
81
  d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
86
82
  }
87
83
 
88
84
  /*!
89
- * Microsoft Dynamic Proto Utility, 1.1.4
85
+ * Microsoft Dynamic Proto Utility, 1.1.5
90
86
  * Copyright (c) Microsoft and contributors. All rights reserved.
91
87
  */
92
88
  var Constructor = 'constructor';
@@ -99,12 +95,13 @@
99
95
  var DynInstChkTag = '_dynInstChk';
100
96
  var DynAllowInstChkTag = DynInstChkTag;
101
97
  var DynProtoDefaultOptions = '_dfOpts';
98
+ var DynProtoPolyProto = "_dynProto";
102
99
  var UnknownValue = '_unknown_';
103
- var str__Proto$1 = "__proto__";
100
+ var str__Proto = "__proto__";
104
101
  var strUseBaseInst = 'useBaseInst';
105
102
  var strSetInstFuncs = 'setInstFuncs';
106
103
  var Obj = Object;
107
- var _objGetPrototypeOf$1 = Obj["getPrototypeOf"];
104
+ var _objGetPrototypeOf = Obj["getPrototypeOf"];
108
105
  var _dynamicNames = 0;
109
106
  function _hasOwnProperty(obj, prop) {
110
107
  return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
@@ -115,13 +112,16 @@
115
112
  function _isObjectArrayOrFunctionPrototype(target) {
116
113
  return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
117
114
  }
118
- function _getObjProto$1(target) {
115
+ function _getObjProto(target) {
119
116
  if (target) {
120
- if (_objGetPrototypeOf$1) {
121
- return _objGetPrototypeOf$1(target);
117
+ if (_objGetPrototypeOf) {
118
+ return _objGetPrototypeOf(target);
122
119
  }
123
- var newProto = target[str__Proto$1] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
120
+ var newProto = target[DynProtoPolyProto] || target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
124
121
  if (newProto) {
122
+ if (!target[DynProtoPolyProto]) {
123
+ target[DynProtoPolyProto] = newProto;
124
+ }
125
125
  return newProto;
126
126
  }
127
127
  }
@@ -186,16 +186,16 @@
186
186
  _forEachProp(instFuncs, function (name) {
187
187
  baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
188
188
  });
189
- var baseProto = _getObjProto$1(classProto);
189
+ var baseProto = _getObjProto(classProto);
190
190
  var visited = [];
191
191
  while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
192
192
  _forEachProp(baseProto, function (name) {
193
- if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf$1)) {
193
+ if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
194
194
  baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
195
195
  }
196
196
  });
197
197
  visited.push(baseProto);
198
- baseProto = _getObjProto$1(baseProto);
198
+ baseProto = _getObjProto(baseProto);
199
199
  }
200
200
  return baseFuncs;
201
201
  }
@@ -209,7 +209,7 @@
209
209
  }
210
210
  if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
211
211
  var canAddInst = !_hasOwnProperty(target, funcName);
212
- var objProto = _getObjProto$1(target);
212
+ var objProto = _getObjProto(target);
213
213
  var visited = [];
214
214
  while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
215
215
  var protoFunc = objProto[funcName];
@@ -218,7 +218,7 @@
218
218
  break;
219
219
  }
220
220
  visited.push(objProto);
221
- objProto = _getObjProto$1(objProto);
221
+ objProto = _getObjProto(objProto);
222
222
  }
223
223
  try {
224
224
  if (canAddInst) {
@@ -236,7 +236,7 @@
236
236
  function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
237
237
  var protoFunc = proto[funcName];
238
238
  if (protoFunc === currentDynProtoProxy) {
239
- protoFunc = _getObjProto$1(proto)[funcName];
239
+ protoFunc = _getObjProto(proto)[funcName];
240
240
  }
241
241
  if (typeof protoFunc !== strFunction) {
242
242
  _throwTypeError("[" + funcName + "] is not a " + strFunction);
@@ -270,18 +270,19 @@
270
270
  }
271
271
  }
272
272
  function _checkPrototype(classProto, thisTarget) {
273
- if (_objGetPrototypeOf$1) {
273
+ if (_objGetPrototypeOf) {
274
274
  var visited = [];
275
- var thisProto = _getObjProto$1(thisTarget);
275
+ var thisProto = _getObjProto(thisTarget);
276
276
  while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
277
277
  if (thisProto === classProto) {
278
278
  return true;
279
279
  }
280
280
  visited.push(thisProto);
281
- thisProto = _getObjProto$1(thisProto);
281
+ thisProto = _getObjProto(thisProto);
282
282
  }
283
+ return false;
283
284
  }
284
- return false;
285
+ return true;
285
286
  }
286
287
  function _getObjName(target, unknownValue) {
287
288
  if (_hasOwnProperty(target, Prototype)) {
@@ -314,7 +315,7 @@
314
315
  var instFuncs = _getInstanceFuncs(target);
315
316
  var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
316
317
  delegateFunc(target, baseFuncs);
317
- var setInstanceFunc = !!_objGetPrototypeOf$1 && !!perfOptions[strSetInstFuncs];
318
+ var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
318
319
  if (setInstanceFunc && options) {
319
320
  setInstanceFunc = !!options[strSetInstFuncs];
320
321
  }
@@ -326,23 +327,101 @@
326
327
  };
327
328
  dynamicProto[DynProtoDefaultOptions] = perfDefaults;
328
329
 
329
- var strEmpty$1 = "";
330
- var strSetNextPlugin = "setNextPlugin";
331
- var strIsInitialized = "isInitialized";
332
- var strTeardown = "teardown";
333
- var strCore = "core";
334
- var strUpdate = "update";
335
- var strDisabled = "disabled";
336
- var strDoTeardown = "_doTeardown";
330
+ var LoggingSeverity;
331
+ (function (LoggingSeverity) {
332
+ LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
333
+ LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
334
+ })(LoggingSeverity || (LoggingSeverity = {}));
335
+ var _InternalMessageId = {
336
+ BrowserDoesNotSupportLocalStorage: 0,
337
+ BrowserCannotReadLocalStorage: 1,
338
+ BrowserCannotReadSessionStorage: 2,
339
+ BrowserCannotWriteLocalStorage: 3,
340
+ BrowserCannotWriteSessionStorage: 4,
341
+ BrowserFailedRemovalFromLocalStorage: 5,
342
+ BrowserFailedRemovalFromSessionStorage: 6,
343
+ CannotSendEmptyTelemetry: 7,
344
+ ClientPerformanceMathError: 8,
345
+ ErrorParsingAISessionCookie: 9,
346
+ ErrorPVCalc: 10,
347
+ ExceptionWhileLoggingError: 11,
348
+ FailedAddingTelemetryToBuffer: 12,
349
+ FailedMonitorAjaxAbort: 13,
350
+ FailedMonitorAjaxDur: 14,
351
+ FailedMonitorAjaxOpen: 15,
352
+ FailedMonitorAjaxRSC: 16,
353
+ FailedMonitorAjaxSend: 17,
354
+ FailedMonitorAjaxGetCorrelationHeader: 18,
355
+ FailedToAddHandlerForOnBeforeUnload: 19,
356
+ FailedToSendQueuedTelemetry: 20,
357
+ FailedToReportDataLoss: 21,
358
+ FlushFailed: 22,
359
+ MessageLimitPerPVExceeded: 23,
360
+ MissingRequiredFieldSpecification: 24,
361
+ NavigationTimingNotSupported: 25,
362
+ OnError: 26,
363
+ SessionRenewalDateIsZero: 27,
364
+ SenderNotInitialized: 28,
365
+ StartTrackEventFailed: 29,
366
+ StopTrackEventFailed: 30,
367
+ StartTrackFailed: 31,
368
+ StopTrackFailed: 32,
369
+ TelemetrySampledAndNotSent: 33,
370
+ TrackEventFailed: 34,
371
+ TrackExceptionFailed: 35,
372
+ TrackMetricFailed: 36,
373
+ TrackPVFailed: 37,
374
+ TrackPVFailedCalc: 38,
375
+ TrackTraceFailed: 39,
376
+ TransmissionFailed: 40,
377
+ FailedToSetStorageBuffer: 41,
378
+ FailedToRestoreStorageBuffer: 42,
379
+ InvalidBackendResponse: 43,
380
+ FailedToFixDepricatedValues: 44,
381
+ InvalidDurationValue: 45,
382
+ TelemetryEnvelopeInvalid: 46,
383
+ CreateEnvelopeError: 47,
384
+ CannotSerializeObject: 48,
385
+ CannotSerializeObjectNonSerializable: 49,
386
+ CircularReferenceDetected: 50,
387
+ ClearAuthContextFailed: 51,
388
+ ExceptionTruncated: 52,
389
+ IllegalCharsInName: 53,
390
+ ItemNotInArray: 54,
391
+ MaxAjaxPerPVExceeded: 55,
392
+ MessageTruncated: 56,
393
+ NameTooLong: 57,
394
+ SampleRateOutOfRange: 58,
395
+ SetAuthContextFailed: 59,
396
+ SetAuthContextFailedAccountName: 60,
397
+ StringValueTooLong: 61,
398
+ StartCalledMoreThanOnce: 62,
399
+ StopCalledWithoutStart: 63,
400
+ TelemetryInitializerFailed: 64,
401
+ TrackArgumentsNotSpecified: 65,
402
+ UrlTooLong: 66,
403
+ SessionStorageBufferFull: 67,
404
+ CannotAccessCookie: 68,
405
+ IdTooLong: 69,
406
+ InvalidEvent: 70,
407
+ FailedMonitorAjaxSetRequestHeader: 71,
408
+ SendBrowserInfoOnUserInit: 72,
409
+ PluginException: 73,
410
+ NotificationException: 74,
411
+ SnippetScriptLoadFailure: 99,
412
+ InvalidInstrumentationKey: 100,
413
+ CannotParseAiBlobValue: 101,
414
+ InvalidContentBlob: 102,
415
+ TrackPageActionEventFailed: 103,
416
+ FailedAddingCustomDefinedRequestContext: 104,
417
+ InMemoryStorageBufferFull: 105
418
+ };
337
419
 
338
420
  var strToISOString = "toISOString";
339
421
  var cStrEndsWith = "endsWith";
340
422
  var cStrTrim = "trim";
341
423
  var strToString = "toString";
342
- var str__Proto = "__proto__";
343
- var strConstructor = "constructor";
344
- var _objDefineProperty$1 = ObjDefineProperty;
345
- var _objFreeze = ObjClass.freeze;
424
+ var _objDefineProperty = ObjDefineProperty;
346
425
  var _objKeys = ObjClass.keys;
347
426
  var StringProto = String[strShimPrototype];
348
427
  var _strTrim = StringProto[cStrTrim];
@@ -352,23 +431,7 @@
352
431
  var _isArray = Array.isArray;
353
432
  var _objToString = ObjProto[strToString];
354
433
  var _fnToString = ObjHasOwnProperty[strToString];
355
- var _objFunctionString = _fnToString.call(ObjClass);
356
- var rCamelCase = /-([a-z])/g;
357
- var rNormalizeInvalid = /([^\w\d_$])/g;
358
- var rLeadingNumeric = /^(\d+[\w\d_$])/;
359
- var _objGetPrototypeOf = Object["getPrototypeOf"];
360
- function _getObjProto(target) {
361
- if (target) {
362
- if (_objGetPrototypeOf) {
363
- return _objGetPrototypeOf(target);
364
- }
365
- var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
366
- if (newProto) {
367
- return newProto;
368
- }
369
- }
370
- return null;
371
- }
434
+ _fnToString.call(ObjClass);
372
435
  function isUndefined(value) {
373
436
  return value === undefined || typeof value === strShimUndefined;
374
437
  }
@@ -384,19 +447,6 @@
384
447
  function isFunction(value) {
385
448
  return !!(value && typeof value === strShimFunction);
386
449
  }
387
- function normalizeJsName(name) {
388
- var value = name;
389
- if (value && isString(value)) {
390
- value = value.replace(rCamelCase, function (_all, letter) {
391
- return letter.toUpperCase();
392
- });
393
- value = value.replace(rNormalizeInvalid, "_");
394
- value = value.replace(rLeadingNumeric, function (_all, match) {
395
- return "_" + match;
396
- });
397
- }
398
- return value;
399
- }
400
450
  function objForEachKey(target, callbackfn) {
401
451
  if (target) {
402
452
  for (var prop in target) {
@@ -445,25 +495,6 @@
445
495
  function isString(value) {
446
496
  return typeof value === "string";
447
497
  }
448
- function isBoolean(value) {
449
- return typeof value === "boolean";
450
- }
451
- function isPlainObject(value) {
452
- var result = false;
453
- if (value && typeof value === "object") {
454
- var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
455
- if (!proto) {
456
- result = true;
457
- }
458
- else {
459
- if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
460
- proto = proto[strConstructor];
461
- }
462
- result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
463
- }
464
- }
465
- return result;
466
- }
467
498
  function toISOString(date) {
468
499
  if (date) {
469
500
  return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
@@ -543,7 +574,7 @@
543
574
  return result;
544
575
  }
545
576
  function objDefineAccessors(target, prop, getProp, setProp) {
546
- if (_objDefineProperty$1) {
577
+ if (_objDefineProperty) {
547
578
  try {
548
579
  var descriptor = {
549
580
  enumerable: true,
@@ -555,7 +586,7 @@
555
586
  if (setProp) {
556
587
  descriptor.set = setProp;
557
588
  }
558
- _objDefineProperty$1(target, prop, descriptor);
589
+ _objDefineProperty(target, prop, descriptor);
559
590
  return true;
560
591
  }
561
592
  catch (e) {
@@ -563,10 +594,6 @@
563
594
  }
564
595
  return false;
565
596
  }
566
- function _doNothing(value) {
567
- return value;
568
- }
569
- var objFreeze = _objFreeze || _doNothing;
570
597
  function dateNow() {
571
598
  var dt = Date;
572
599
  return dt.now ? dt.now() : new dt().getTime();
@@ -575,7 +602,7 @@
575
602
  if (isError(object)) {
576
603
  return object.name;
577
604
  }
578
- return strEmpty$1;
605
+ return "";
579
606
  }
580
607
  function setValue(target, field, value, valChk, srcChk) {
581
608
  var theValue = value;
@@ -605,36 +632,6 @@
605
632
  function isTruthy(value) {
606
633
  return !!value;
607
634
  }
608
- function throwError(message) {
609
- throw new Error(message);
610
- }
611
- function _createProxyFunction(source, funcName) {
612
- var srcFunc = null;
613
- var src = null;
614
- if (isFunction(source)) {
615
- srcFunc = source;
616
- }
617
- else {
618
- src = source;
619
- }
620
- return function () {
621
- var originalArguments = arguments;
622
- if (srcFunc) {
623
- src = srcFunc();
624
- }
625
- if (src) {
626
- return src[funcName].apply(src, originalArguments);
627
- }
628
- };
629
- }
630
- function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
631
- if (overwriteTarget === void 0) { overwriteTarget = true; }
632
- if (target && name && source) {
633
- if (overwriteTarget || isUndefined(target[name])) {
634
- target[name] = _createProxyFunction(source, theFunc);
635
- }
636
- }
637
- }
638
635
  function createClassFromInterface(defaults) {
639
636
  return /** @class */ (function () {
640
637
  function class_1() {
@@ -648,61 +645,6 @@
648
645
  return class_1;
649
646
  }());
650
647
  }
651
- function createEnumStyle(values) {
652
- var enumClass = {};
653
- objForEachKey(values, function (field, value) {
654
- enumClass[field] = value;
655
- if (!isUndefined(enumClass[value])) {
656
- throwError("[" + value + "] exists for " + field);
657
- }
658
- enumClass[value] = field;
659
- });
660
- return objFreeze(enumClass);
661
- }
662
- function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
663
- var theArgs = arguments;
664
- var extended = theArgs[0] || {};
665
- var argLen = theArgs.length;
666
- var deep = false;
667
- var idx = 1;
668
- if (argLen > 0 && isBoolean(extended)) {
669
- deep = extended;
670
- extended = theArgs[idx] || {};
671
- idx++;
672
- }
673
- if (!isObject(extended)) {
674
- extended = {};
675
- }
676
- for (; idx < argLen; idx++) {
677
- var arg = theArgs[idx];
678
- var isArgArray = isArray(arg);
679
- var isArgObj = isObject(arg);
680
- for (var prop in arg) {
681
- var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
682
- if (!propOk) {
683
- continue;
684
- }
685
- var newValue = arg[prop];
686
- var isNewArray = void 0;
687
- if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
688
- var clone = extended[prop];
689
- if (isNewArray) {
690
- if (!isArray(clone)) {
691
- clone = [];
692
- }
693
- }
694
- else if (!isPlainObject(clone)) {
695
- clone = {};
696
- }
697
- newValue = objExtend(deep, clone, newValue);
698
- }
699
- if (newValue !== undefined) {
700
- extended[prop] = newValue;
701
- }
702
- }
703
- }
704
- return extended;
705
- }
706
648
 
707
649
  var strWindow = "window";
708
650
  var strDocument = "document";
@@ -785,14 +727,14 @@
785
727
  var nav = getNavigator();
786
728
  if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
787
729
  _navUserAgentCheck = nav.userAgent;
788
- var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
730
+ var userAgent = (_navUserAgentCheck || "").toLowerCase();
789
731
  _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
790
732
  }
791
733
  return _isTrident;
792
734
  }
793
735
  function dumpObj(object) {
794
736
  var objectTypeDump = Object[strShimPrototype].toString.call(object);
795
- var propertyValueDump = strEmpty$1;
737
+ var propertyValueDump = "";
796
738
  if (objectTypeDump === "[object Error]") {
797
739
  propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
798
740
  }
@@ -825,9 +767,9 @@
825
767
  var strWarnToConsole = "warnToConsole";
826
768
  function _sanitizeDiagnosticText(text) {
827
769
  if (text) {
828
- return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
770
+ return "\"" + text.replace(/\"/g, "") + "\"";
829
771
  }
830
- return strEmpty$1;
772
+ return "";
831
773
  }
832
774
  function _logToConsole(func, message) {
833
775
  var theConsole = getConsole();
@@ -849,12 +791,12 @@
849
791
  _self.message =
850
792
  (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
851
793
  msgId;
852
- var strProps = strEmpty$1;
794
+ var strProps = "";
853
795
  if (hasJSON()) {
854
796
  strProps = getJSON().stringify(properties);
855
797
  }
856
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
857
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
798
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : "") +
799
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : "");
858
800
  _self.message += diagnosticText;
859
801
  }
860
802
  _InternalLogMessage.dataType = "MessageData";
@@ -881,10 +823,10 @@
881
823
  if (isUserAct === void 0) { isUserAct = false; }
882
824
  var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
883
825
  if (_self.enableDebugExceptions()) {
884
- throw message;
826
+ throw dumpObj(message);
885
827
  }
886
828
  else {
887
- var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
829
+ var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
888
830
  if (!isUndefined(message.message)) {
889
831
  var logLevel = _self.consoleLoggingLevel();
890
832
  if (isUserAct) {
@@ -902,7 +844,7 @@
902
844
  _self.logInternalMessage(severity, message);
903
845
  }
904
846
  else {
905
- _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
847
+ _debugExtMsg("throw" + (severity === LoggingSeverity.CRITICAL ? "Critical" : "Warning"), message);
906
848
  }
907
849
  }
908
850
  };
@@ -934,13 +876,13 @@
934
876
  if (severity <= _self.telemetryLoggingLevel()) {
935
877
  _self.queue.push(message);
936
878
  _messageCount++;
937
- _debugExtMsg((severity === 1 ? "error" : "warn"), message);
879
+ _debugExtMsg((severity === LoggingSeverity.CRITICAL ? "error" : "warn"), message);
938
880
  }
939
881
  if (_messageCount === _self.maxInternalMessageLimit()) {
940
882
  var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
941
- var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
883
+ var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
942
884
  _self.queue.push(throttleMessage);
943
- if (severity === 1 ) {
885
+ if (severity === LoggingSeverity.CRITICAL) {
944
886
  _self.errorToConsole(throttleLimitMessage);
945
887
  }
946
888
  else {
@@ -969,10 +911,6 @@
969
911
  }
970
912
  return DiagnosticLogger;
971
913
  }());
972
- function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
973
- if (isUserAct === void 0) { isUserAct = false; }
974
- (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
975
- }
976
914
 
977
915
  var strExecutionContextKey = "ctx";
978
916
  var PerfEvent = /** @class */ (function () {
@@ -1086,495 +1024,252 @@
1086
1024
  return func();
1087
1025
  }
1088
1026
 
1089
- var UInt32Mask = 0x100000000;
1090
- var MaxUInt32 = 0xffffffff;
1091
- var _mwcSeeded = false;
1092
- var _mwcW = 123456789;
1093
- var _mwcZ = 987654321;
1094
- function _mwcSeed(seedValue) {
1095
- if (seedValue < 0) {
1096
- seedValue >>>= 0;
1097
- }
1098
- _mwcW = (123456789 + seedValue) & MaxUInt32;
1099
- _mwcZ = (987654321 - seedValue) & MaxUInt32;
1100
- _mwcSeeded = true;
1101
- }
1102
- function _autoSeedMwc() {
1103
- try {
1104
- var now = dateNow() & 0x7fffffff;
1105
- _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1106
- }
1107
- catch (e) {
1108
- }
1109
- }
1110
- function random32(signed) {
1111
- var value = 0;
1112
- var c = getCrypto() || getMsCrypto();
1113
- if (c && c.getRandomValues) {
1114
- value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1115
- }
1116
- if (value === 0 && isIE()) {
1117
- if (!_mwcSeeded) {
1118
- _autoSeedMwc();
1119
- }
1120
- value = mwcRandom32() & MaxUInt32;
1121
- }
1122
- if (value === 0) {
1123
- value = Math.floor((UInt32Mask * Math.random()) | 0);
1124
- }
1125
- if (!signed) {
1126
- value >>>= 0;
1127
- }
1128
- return value;
1129
- }
1130
- function mwcRandom32(signed) {
1131
- _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1132
- _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1133
- var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1134
- if (!signed) {
1135
- value >>>= 0;
1136
- }
1137
- return value;
1138
- }
1139
- function newId(maxLength) {
1140
- if (maxLength === void 0) { maxLength = 22; }
1141
- var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1142
- var number = random32() >>> 0;
1143
- var chars = 0;
1144
- var result = strEmpty$1;
1145
- while (result.length < maxLength) {
1146
- chars++;
1147
- result += base64chars.charAt(number & 0x3F);
1148
- number >>>= 6;
1149
- if (chars === 5) {
1150
- number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1151
- chars = 0;
1152
- }
1153
- }
1154
- return result;
1155
- }
1156
-
1157
- var _objDefineProperty = ObjDefineProperty;
1158
- var version = "2.7.5-nightly.2203-03";
1159
- var instanceName = "." + newId(6);
1160
- var _dataUid = 0;
1161
- function _createAccessor(target, prop, value) {
1162
- if (_objDefineProperty) {
1163
- try {
1164
- _objDefineProperty(target, prop, {
1165
- value: value,
1166
- enumerable: false,
1167
- configurable: true
1168
- });
1169
- return true;
1170
- }
1171
- catch (e) {
1172
- }
1173
- }
1174
- return false;
1175
- }
1176
- function _canAcceptData(target) {
1177
- return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
1178
- }
1179
- function _getCache(data, target) {
1180
- var theCache = target[data.id];
1181
- if (!theCache) {
1182
- theCache = {};
1183
- try {
1184
- if (_canAcceptData(target)) {
1185
- if (!_createAccessor(target, data.id, theCache)) {
1186
- target[data.id] = theCache;
1187
- }
1188
- }
1189
- }
1190
- catch (e) {
1191
- }
1192
- }
1193
- return theCache;
1194
- }
1195
- function createUniqueNamespace(name, includeVersion) {
1196
- if (includeVersion === void 0) { includeVersion = false; }
1197
- return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
1198
- }
1199
- function createElmNodeData(name) {
1200
- var data = {
1201
- id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
1202
- accept: function (target) {
1203
- return _canAcceptData(target);
1204
- },
1205
- get: function (target, name, defValue, addDefault) {
1206
- var theCache = target[data.id];
1207
- if (!theCache) {
1208
- if (addDefault) {
1209
- theCache = _getCache(data, target);
1210
- theCache[normalizeJsName(name)] = defValue;
1211
- }
1212
- return defValue;
1213
- }
1214
- return theCache[normalizeJsName(name)];
1215
- },
1216
- kill: function (target, name) {
1217
- if (target && target[name]) {
1218
- try {
1219
- delete target[name];
1220
- }
1221
- catch (e) {
1222
- }
1027
+ var TelemetryPluginChain = /** @class */ (function () {
1028
+ function TelemetryPluginChain(plugin, defItemCtx) {
1029
+ var _self = this;
1030
+ var _nextProxy = null;
1031
+ var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
1032
+ var _hasSetNext = isFunction(plugin.setNextPlugin);
1033
+ _self._hasRun = false;
1034
+ _self.getPlugin = function () {
1035
+ return plugin;
1036
+ };
1037
+ _self.getNext = function () {
1038
+ return _nextProxy;
1039
+ };
1040
+ _self.setNext = function (nextPlugin) {
1041
+ _nextProxy = nextPlugin;
1042
+ };
1043
+ _self.processTelemetry = function (env, itemCtx) {
1044
+ if (!itemCtx) {
1045
+ itemCtx = defItemCtx;
1223
1046
  }
1224
- }
1225
- };
1226
- return data;
1227
- }
1228
-
1229
- var pluginStateData = createElmNodeData("plugin");
1230
- function _getPluginState(plugin) {
1231
- return pluginStateData.get(plugin, "state", {}, true);
1232
- }
1233
-
1234
- var strTelemetryPluginChain = "TelemetryPluginChain";
1235
- var strHasRunFlags = "_hasRun";
1236
- var strGetTelCtx = "_getTelCtx";
1237
- var _chainId = 0;
1238
- function _getNextProxyStart(proxy, config, core, startAt) {
1239
- while (proxy) {
1240
- if (proxy.getPlugin() === startAt) {
1241
- return proxy;
1242
- }
1243
- proxy = proxy.getNext();
1244
- }
1245
- return createTelemetryProxyChain([startAt], config, core);
1246
- }
1247
- function _createInternalContext(telemetryChain, config, core, startAt) {
1248
- var _nextProxy = null;
1249
- var _onComplete = [];
1250
- if (startAt !== null) {
1251
- _nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
1252
- }
1253
- var context = {
1254
- _next: _moveNext,
1255
- ctx: {
1256
- core: function () {
1257
- return core;
1258
- },
1259
- diagLog: function () {
1260
- return safeGetLogger(core, config);
1261
- },
1262
- getCfg: function () {
1263
- return config;
1264
- },
1265
- getExtCfg: _getExtCfg,
1266
- getConfig: _getConfig,
1267
- hasNext: function () {
1268
- return !!_nextProxy;
1269
- },
1270
- getNext: function () {
1271
- return _nextProxy;
1272
- },
1273
- setNext: function (nextPlugin) {
1274
- _nextProxy = nextPlugin;
1275
- },
1276
- iterate: _iterateChain,
1277
- onComplete: _addOnComplete
1278
- }
1279
- };
1280
- function _addOnComplete(onComplete, that) {
1281
- var args = [];
1282
- for (var _i = 2; _i < arguments.length; _i++) {
1283
- args[_i - 2] = arguments[_i];
1284
- }
1285
- if (onComplete) {
1286
- _onComplete.push({
1287
- func: onComplete,
1288
- self: !isUndefined(that) ? that : context.ctx,
1289
- args: args
1290
- });
1291
- }
1292
- }
1293
- function _moveNext() {
1294
- var nextProxy = _nextProxy;
1295
- _nextProxy = nextProxy ? nextProxy.getNext() : null;
1296
- if (!nextProxy) {
1297
- var onComplete = _onComplete;
1298
- if (onComplete && onComplete.length > 0) {
1299
- arrForEach(onComplete, function (completeDetails) {
1047
+ var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
1048
+ doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
1049
+ if (plugin && _hasProcessTelemetry) {
1050
+ _self._hasRun = true;
1300
1051
  try {
1301
- completeDetails.func.call(completeDetails.self, completeDetails.args);
1052
+ itemCtx.setNext(_nextProxy);
1053
+ if (_hasSetNext) {
1054
+ plugin.setNextPlugin(_nextProxy);
1055
+ }
1056
+ _nextProxy && (_nextProxy._hasRun = false);
1057
+ plugin.processTelemetry(env, itemCtx);
1302
1058
  }
1303
- catch (e) {
1304
- _throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1059
+ catch (error) {
1060
+ var hasRun = _nextProxy && _nextProxy._hasRun;
1061
+ if (!_nextProxy || !hasRun) {
1062
+ itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
1063
+ }
1064
+ if (_nextProxy && !hasRun) {
1065
+ _nextProxy.processTelemetry(env, itemCtx);
1066
+ }
1305
1067
  }
1306
- });
1307
- _onComplete = [];
1308
- }
1309
- }
1310
- return nextProxy;
1068
+ }
1069
+ else if (_nextProxy) {
1070
+ _self._hasRun = true;
1071
+ _nextProxy.processTelemetry(env, itemCtx);
1072
+ }
1073
+ }, function () { return ({ item: env }); }, !(env.sync));
1074
+ };
1311
1075
  }
1312
- function _getExtCfg(identifier, defaultValue, mergeDefault) {
1313
- if (defaultValue === void 0) { defaultValue = {}; }
1314
- if (mergeDefault === void 0) { mergeDefault = 0 ; }
1315
- var theConfig;
1316
- if (config) {
1317
- var extConfig = config.extensionConfig;
1318
- if (extConfig && identifier) {
1319
- theConfig = extConfig[identifier];
1320
- }
1321
- }
1322
- if (!theConfig) {
1323
- theConfig = defaultValue;
1324
- }
1325
- else if (isObject(defaultValue)) {
1326
- if (mergeDefault !== 0 ) {
1327
- var newConfig_1 = objExtend(true, defaultValue, theConfig);
1328
- if (config && mergeDefault === 2 ) {
1329
- objForEachKey(defaultValue, function (field) {
1330
- if (isNullOrUndefined(newConfig_1[field])) {
1331
- var cfgValue = config[field];
1332
- if (!isNullOrUndefined(cfgValue)) {
1333
- newConfig_1[field] = cfgValue;
1334
- }
1335
- }
1336
- });
1076
+ return TelemetryPluginChain;
1077
+ }());
1078
+
1079
+ function _createProxyChain(plugins, itemCtx) {
1080
+ var proxies = [];
1081
+ if (plugins && plugins.length > 0) {
1082
+ var lastProxy = null;
1083
+ for (var idx = 0; idx < plugins.length; idx++) {
1084
+ var thePlugin = plugins[idx];
1085
+ if (thePlugin && isFunction(thePlugin.processTelemetry)) {
1086
+ var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
1087
+ proxies.push(newProxy);
1088
+ if (lastProxy) {
1089
+ lastProxy.setNext(newProxy);
1337
1090
  }
1091
+ lastProxy = newProxy;
1338
1092
  }
1339
1093
  }
1340
- return theConfig;
1341
- }
1342
- function _getConfig(identifier, field, defaultValue) {
1343
- if (defaultValue === void 0) { defaultValue = false; }
1344
- var theValue;
1345
- var extConfig = _getExtCfg(identifier, null);
1346
- if (extConfig && !isNullOrUndefined(extConfig[field])) {
1347
- theValue = extConfig[field];
1348
- }
1349
- else if (config && !isNullOrUndefined(config[field])) {
1350
- theValue = config[field];
1351
- }
1352
- return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1353
1094
  }
1354
- function _iterateChain(cb) {
1355
- var nextPlugin;
1356
- while (!!(nextPlugin = context._next())) {
1357
- var plugin = nextPlugin.getPlugin();
1358
- if (plugin) {
1359
- cb(plugin);
1095
+ return proxies.length > 0 ? proxies[0] : null;
1096
+ }
1097
+ function _copyProxyChain(proxy, itemCtx, startAt) {
1098
+ var plugins = [];
1099
+ var add = startAt ? false : true;
1100
+ if (proxy) {
1101
+ while (proxy) {
1102
+ var thePlugin = proxy.getPlugin();
1103
+ if (add || thePlugin === startAt) {
1104
+ add = true;
1105
+ plugins.push(thePlugin);
1360
1106
  }
1107
+ proxy = proxy.getNext();
1361
1108
  }
1362
1109
  }
1363
- return context;
1364
- }
1365
- function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
1366
- var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1367
- var context = internalContext.ctx;
1368
- function _processNext(env) {
1369
- var nextPlugin = internalContext._next();
1370
- nextPlugin && nextPlugin.processTelemetry(env, context);
1371
- return !nextPlugin;
1372
- }
1373
- function _createNew(plugins, startAt) {
1374
- if (plugins === void 0) { plugins = null; }
1375
- if (isArray(plugins)) {
1376
- plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1377
- }
1378
- return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
1379
- }
1380
- context.processNext = _processNext;
1381
- context.createNew = _createNew;
1382
- return context;
1383
- }
1384
- function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
1385
- var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1386
- var context = internalContext.ctx;
1387
- function _processNext(unloadState) {
1388
- var nextPlugin = internalContext._next();
1389
- nextPlugin && nextPlugin.unload(context, unloadState);
1390
- return !nextPlugin;
1391
- }
1392
- function _createNew(plugins, startAt) {
1393
- if (plugins === void 0) { plugins = null; }
1394
- if (isArray(plugins)) {
1395
- plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1396
- }
1397
- return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
1110
+ if (!add) {
1111
+ plugins.push(startAt);
1398
1112
  }
1399
- context.processNext = _processNext;
1400
- context.createNew = _createNew;
1401
- return context;
1113
+ return _createProxyChain(plugins, itemCtx);
1402
1114
  }
1403
- function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
1404
- var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1405
- var context = internalContext.ctx;
1406
- function _processNext(updateState) {
1407
- return context.iterate(function (plugin) {
1408
- if (isFunction(plugin[strUpdate])) {
1409
- plugin[strUpdate](context, updateState);
1115
+ function _copyPluginChain(srcPlugins, itemCtx, startAt) {
1116
+ var plugins = srcPlugins;
1117
+ var add = false;
1118
+ if (startAt && srcPlugins) {
1119
+ plugins = [];
1120
+ arrForEach(srcPlugins, function (thePlugin) {
1121
+ if (add || thePlugin === startAt) {
1122
+ add = true;
1123
+ plugins.push(thePlugin);
1410
1124
  }
1411
1125
  });
1412
1126
  }
1413
- function _createNew(plugins, startAt) {
1414
- if (plugins === void 0) { plugins = null; }
1415
- if (isArray(plugins)) {
1416
- plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1127
+ if (startAt && !add) {
1128
+ if (!plugins) {
1129
+ plugins = [];
1417
1130
  }
1418
- return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
1131
+ plugins.push(startAt);
1419
1132
  }
1420
- context.processNext = _processNext;
1421
- context.createNew = _createNew;
1422
- return context;
1133
+ return _createProxyChain(plugins, itemCtx);
1423
1134
  }
1424
- function createTelemetryProxyChain(plugins, config, core, startAt) {
1425
- var firstProxy = null;
1426
- var add = startAt ? false : true;
1427
- if (isArray(plugins) && plugins.length > 0) {
1428
- var lastProxy_1 = null;
1429
- arrForEach(plugins, function (thePlugin) {
1430
- if (!add && startAt === thePlugin) {
1431
- add = true;
1135
+ var ProcessTelemetryContext = /** @class */ (function () {
1136
+ function ProcessTelemetryContext(plugins, config, core, startAt) {
1137
+ var _self = this;
1138
+ var _nextProxy = null;
1139
+ if (startAt !== null) {
1140
+ if (plugins && isFunction(plugins.getPlugin)) {
1141
+ _nextProxy = _copyProxyChain(plugins, _self, startAt || plugins.getPlugin());
1432
1142
  }
1433
- if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
1434
- var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
1435
- if (!firstProxy) {
1436
- firstProxy = newProxy;
1143
+ else {
1144
+ if (startAt) {
1145
+ _nextProxy = _copyPluginChain(plugins, _self, startAt);
1437
1146
  }
1438
- if (lastProxy_1) {
1439
- lastProxy_1._setNext(newProxy);
1147
+ else if (isUndefined(startAt)) {
1148
+ _nextProxy = _createProxyChain(plugins, _self);
1440
1149
  }
1441
- lastProxy_1 = newProxy;
1442
1150
  }
1443
- });
1444
- }
1445
- if (startAt && !firstProxy) {
1446
- return createTelemetryProxyChain([startAt], config, core);
1447
- }
1448
- return firstProxy;
1449
- }
1450
- function createTelemetryPluginProxy(plugin, config, core) {
1451
- var nextProxy = null;
1452
- var hasProcessTelemetry = isFunction(plugin.processTelemetry);
1453
- var hasSetNext = isFunction(plugin.setNextPlugin);
1454
- var chainId;
1455
- if (plugin) {
1456
- chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
1457
- }
1458
- else {
1459
- chainId = "Unknown-0-" + _chainId++;
1460
- }
1461
- var proxyChain = {
1462
- getPlugin: function () {
1463
- return plugin;
1464
- },
1465
- getNext: function () {
1466
- return nextProxy;
1467
- },
1468
- processTelemetry: _processTelemetry,
1469
- unload: _unloadPlugin,
1470
- update: _updatePlugin,
1471
- _id: chainId,
1472
- _setNext: function (nextPlugin) {
1473
- nextProxy = nextPlugin;
1474
1151
  }
1475
- };
1476
- function _getTelCtx() {
1477
- var itemCtx;
1478
- if (plugin && isFunction(plugin[strGetTelCtx])) {
1479
- itemCtx = plugin[strGetTelCtx]();
1480
- }
1481
- if (!itemCtx) {
1482
- itemCtx = createProcessTelemetryContext(proxyChain, config, core);
1483
- }
1484
- return itemCtx;
1485
- }
1486
- function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
1487
- var hasRun = false;
1488
- var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
1489
- var hasRunContext = itemCtx[strHasRunFlags];
1490
- if (!hasRunContext) {
1491
- hasRunContext = itemCtx[strHasRunFlags] = {};
1492
- }
1493
- itemCtx.setNext(nextProxy);
1494
- if (plugin) {
1495
- doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
1496
- hasRunContext[chainId] = true;
1497
- try {
1498
- var nextId = nextProxy ? nextProxy._id : strEmpty$1;
1499
- if (nextId) {
1500
- hasRunContext[nextId] = false;
1501
- }
1502
- hasRun = processPluginFn(itemCtx);
1503
- }
1504
- catch (error) {
1505
- var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
1506
- if (hasNextRun) {
1507
- hasRun = true;
1508
- }
1509
- if (!nextProxy || !hasNextRun) {
1510
- _throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1511
- }
1152
+ _self.core = function () {
1153
+ return core;
1154
+ };
1155
+ _self.diagLog = function () {
1156
+ return safeGetLogger(core, config);
1157
+ };
1158
+ _self.getCfg = function () {
1159
+ return config;
1160
+ };
1161
+ _self.getExtCfg = function (identifier, defaultValue) {
1162
+ if (defaultValue === void 0) { defaultValue = {}; }
1163
+ var theConfig;
1164
+ if (config) {
1165
+ var extConfig = config.extensionConfig;
1166
+ if (extConfig && identifier) {
1167
+ theConfig = extConfig[identifier];
1512
1168
  }
1513
- }, details, isAsync);
1514
- }
1515
- return hasRun;
1516
- }
1517
- function _processTelemetry(env, itemCtx) {
1518
- itemCtx = itemCtx || _getTelCtx();
1519
- function _callProcessTelemetry(itemCtx) {
1520
- if (!plugin || !hasProcessTelemetry) {
1521
- return false;
1522
1169
  }
1523
- var pluginState = _getPluginState(plugin);
1524
- if (pluginState[strTeardown] || pluginState[strDisabled]) {
1525
- return false;
1170
+ return (theConfig ? theConfig : defaultValue);
1171
+ };
1172
+ _self.getConfig = function (identifier, field, defaultValue) {
1173
+ if (defaultValue === void 0) { defaultValue = false; }
1174
+ var theValue;
1175
+ var extConfig = _self.getExtCfg(identifier, null);
1176
+ if (extConfig && !isNullOrUndefined(extConfig[field])) {
1177
+ theValue = extConfig[field];
1526
1178
  }
1527
- if (hasSetNext) {
1528
- plugin.setNextPlugin(nextProxy);
1179
+ else if (config && !isNullOrUndefined(config[field])) {
1180
+ theValue = config[field];
1529
1181
  }
1530
- plugin.processTelemetry(env, itemCtx);
1531
- return true;
1532
- }
1533
- if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
1534
- itemCtx.processNext(env);
1535
- }
1536
- }
1537
- function _unloadPlugin(unloadCtx, unloadState) {
1538
- function _callTeardown() {
1539
- var hasRun = false;
1540
- if (plugin) {
1541
- var pluginState = _getPluginState(plugin);
1542
- var pluginCore = plugin[strCore] || pluginState.core;
1543
- if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
1544
- pluginState[strCore] = null;
1545
- pluginState[strTeardown] = true;
1546
- pluginState[strIsInitialized] = false;
1547
- if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
1548
- hasRun = true;
1549
- }
1550
- }
1182
+ return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1183
+ };
1184
+ _self.hasNext = function () {
1185
+ return _nextProxy != null;
1186
+ };
1187
+ _self.getNext = function () {
1188
+ return _nextProxy;
1189
+ };
1190
+ _self.setNext = function (nextPlugin) {
1191
+ _nextProxy = nextPlugin;
1192
+ };
1193
+ _self.processNext = function (env) {
1194
+ var nextPlugin = _nextProxy;
1195
+ if (nextPlugin) {
1196
+ _nextProxy = nextPlugin.getNext();
1197
+ nextPlugin.processTelemetry(env, _self);
1551
1198
  }
1552
- return hasRun;
1553
- }
1554
- if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
1555
- unloadCtx.processNext(unloadState);
1556
- }
1199
+ };
1200
+ _self.createNew = function (plugins, startAt) {
1201
+ if (plugins === void 0) { plugins = null; }
1202
+ return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
1203
+ };
1557
1204
  }
1558
- function _updatePlugin(updateCtx, updateState) {
1559
- function _callUpdate() {
1560
- var hasRun = false;
1561
- if (plugin) {
1562
- var pluginState = _getPluginState(plugin);
1563
- var pluginCore = plugin[strCore] || pluginState.core;
1564
- if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
1565
- if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
1566
- hasRun = true;
1567
- }
1205
+ return ProcessTelemetryContext;
1206
+ }());
1207
+
1208
+ var strExtensionConfig = "extensionConfig";
1209
+
1210
+ var strGetPlugin = "getPlugin";
1211
+ var BaseTelemetryPlugin = /** @class */ (function () {
1212
+ function BaseTelemetryPlugin() {
1213
+ var _self = this;
1214
+ var _isinitialized = false;
1215
+ var _rootCtx = null;
1216
+ var _nextPlugin = null;
1217
+ _self.core = null;
1218
+ _self.diagLog = function (itemCtx) {
1219
+ return _self._getTelCtx(itemCtx).diagLog();
1220
+ };
1221
+ _self.isInitialized = function () {
1222
+ return _isinitialized;
1223
+ };
1224
+ _self.setInitialized = function (isInitialized) {
1225
+ _isinitialized = isInitialized;
1226
+ };
1227
+ _self.setNextPlugin = function (next) {
1228
+ _nextPlugin = next;
1229
+ };
1230
+ _self.processNext = function (env, itemCtx) {
1231
+ if (itemCtx) {
1232
+ itemCtx.processNext(env);
1233
+ }
1234
+ else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
1235
+ _nextPlugin.processTelemetry(env, null);
1236
+ }
1237
+ };
1238
+ _self._getTelCtx = function (currentCtx) {
1239
+ if (currentCtx === void 0) { currentCtx = null; }
1240
+ var itemCtx = currentCtx;
1241
+ if (!itemCtx) {
1242
+ var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);
1243
+ if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1244
+ itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
1245
+ }
1246
+ else {
1247
+ itemCtx = rootCtx.createNew(null, _nextPlugin);
1568
1248
  }
1569
1249
  }
1570
- return hasRun;
1571
- }
1572
- if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
1573
- updateCtx.processNext(updateState);
1574
- }
1250
+ return itemCtx;
1251
+ };
1252
+ _self._baseTelInit = function (config, core, extensions, pluginChain) {
1253
+ if (config) {
1254
+ setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
1255
+ }
1256
+ if (!pluginChain && core) {
1257
+ pluginChain = core.getProcessTelContext().getNext();
1258
+ }
1259
+ var nextPlugin = _nextPlugin;
1260
+ if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1261
+ nextPlugin = _nextPlugin[strGetPlugin]();
1262
+ }
1263
+ _self.core = core;
1264
+ _rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
1265
+ _isinitialized = true;
1266
+ };
1575
1267
  }
1576
- return objFreeze(proxyChain);
1577
- }
1268
+ BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
1269
+ this._baseTelInit(config, core, extensions, pluginChain);
1270
+ };
1271
+ return BaseTelemetryPlugin;
1272
+ }());
1578
1273
 
1579
1274
  var strToGMTString = "toGMTString";
1580
1275
  var strToUTCString = "toUTCString";
@@ -1584,6 +1279,7 @@
1584
1279
  var strIsCookieUseDisabled = "isCookieUseDisabled";
1585
1280
  var strDisableCookiesUsage = "disableCookiesUsage";
1586
1281
  var strConfigCookieMgr = "_ckMgr";
1282
+ var strEmpty = "";
1587
1283
  var _supportsCookies = null;
1588
1284
  var _allowUaSameSite = null;
1589
1285
  var _parsedCookieValue = null;
@@ -1660,7 +1356,7 @@
1660
1356
  var result = false;
1661
1357
  if (_isMgrEnabled(cookieMgr)) {
1662
1358
  var values = {};
1663
- var theValue = strTrim(value || strEmpty$1);
1359
+ var theValue = strTrim(value || strEmpty);
1664
1360
  var idx = theValue.indexOf(";");
1665
1361
  if (idx !== -1) {
1666
1362
  theValue = strTrim(value.substring(0, idx));
@@ -1675,11 +1371,11 @@
1675
1371
  if (expireMs > 0) {
1676
1372
  var expiry = new Date();
1677
1373
  expiry.setTime(expireMs);
1678
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty$1, isTruthy);
1374
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
1679
1375
  }
1680
1376
  }
1681
1377
  if (!_isIE) {
1682
- setValue(values, "max-age", strEmpty$1 + maxAgeSec, null, isUndefined);
1378
+ setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
1683
1379
  }
1684
1380
  }
1685
1381
  var location_1 = getLocation();
@@ -1700,7 +1396,7 @@
1700
1396
  return result;
1701
1397
  },
1702
1398
  get: function (name) {
1703
- var value = strEmpty$1;
1399
+ var value = strEmpty;
1704
1400
  if (_isMgrEnabled(cookieMgr)) {
1705
1401
  value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
1706
1402
  }
@@ -1725,7 +1421,7 @@
1725
1421
  values["max-age"] = "0";
1726
1422
  }
1727
1423
  var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
1728
- delCookie(name, _formatCookieValue(strEmpty$1, values));
1424
+ delCookie(name, _formatCookieValue(strEmpty, values));
1729
1425
  result = true;
1730
1426
  }
1731
1427
  return result;
@@ -1742,7 +1438,7 @@
1742
1438
  _supportsCookies = doc[strCookie] !== undefined;
1743
1439
  }
1744
1440
  catch (e) {
1745
- _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1441
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotAccessCookie, "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1746
1442
  }
1747
1443
  }
1748
1444
  return _supportsCookies;
@@ -1752,7 +1448,7 @@
1752
1448
  if (theValue && theValue.length) {
1753
1449
  var parts = strTrim(theValue).split(";");
1754
1450
  arrForEach(parts, function (thePart) {
1755
- thePart = strTrim(thePart || strEmpty$1);
1451
+ thePart = strTrim(thePart || strEmpty);
1756
1452
  if (thePart) {
1757
1453
  var idx = thePart.indexOf("=");
1758
1454
  if (idx === -1) {
@@ -1773,21 +1469,21 @@
1773
1469
  return null;
1774
1470
  }
1775
1471
  function _formatCookieValue(value, values) {
1776
- var cookieValue = value || strEmpty$1;
1472
+ var cookieValue = value || strEmpty;
1777
1473
  objForEachKey(values, function (name, theValue) {
1778
- cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty$1);
1474
+ cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
1779
1475
  });
1780
1476
  return cookieValue;
1781
1477
  }
1782
1478
  function _getCookieValue(name) {
1783
- var cookieValue = strEmpty$1;
1479
+ var cookieValue = strEmpty;
1784
1480
  if (_doc) {
1785
- var theCookie = _doc[strCookie] || strEmpty$1;
1481
+ var theCookie = _doc[strCookie] || strEmpty;
1786
1482
  if (_parsedCookieValue !== theCookie) {
1787
1483
  _cookieCache = _extractParts(theCookie);
1788
1484
  _parsedCookieValue = theCookie;
1789
1485
  }
1790
- cookieValue = strTrim(_cookieCache[name] || strEmpty$1);
1486
+ cookieValue = strTrim(_cookieCache[name] || strEmpty);
1791
1487
  }
1792
1488
  return cookieValue;
1793
1489
  }
@@ -1821,180 +1517,77 @@
1821
1517
  return false;
1822
1518
  }
1823
1519
 
1824
- var strExtensionConfig = "extensionConfig";
1825
-
1826
- function createUnloadHandlerContainer() {
1827
- var handlers = [];
1828
- function _addHandler(handler) {
1829
- if (handler) {
1830
- handlers.push(handler);
1520
+ var UInt32Mask = 0x100000000;
1521
+ var MaxUInt32 = 0xffffffff;
1522
+ var _mwcSeeded = false;
1523
+ var _mwcW = 123456789;
1524
+ var _mwcZ = 987654321;
1525
+ function _mwcSeed(seedValue) {
1526
+ if (seedValue < 0) {
1527
+ seedValue >>>= 0;
1528
+ }
1529
+ _mwcW = (123456789 + seedValue) & MaxUInt32;
1530
+ _mwcZ = (987654321 - seedValue) & MaxUInt32;
1531
+ _mwcSeeded = true;
1532
+ }
1533
+ function _autoSeedMwc() {
1534
+ try {
1535
+ var now = dateNow() & 0x7fffffff;
1536
+ _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1537
+ }
1538
+ catch (e) {
1539
+ }
1540
+ }
1541
+ function random32(signed) {
1542
+ var value;
1543
+ var c = getCrypto() || getMsCrypto();
1544
+ if (c && c.getRandomValues) {
1545
+ value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1546
+ }
1547
+ else if (isIE()) {
1548
+ if (!_mwcSeeded) {
1549
+ _autoSeedMwc();
1831
1550
  }
1551
+ value = mwcRandom32() & MaxUInt32;
1832
1552
  }
1833
- function _runHandlers(unloadCtx, unloadState) {
1834
- arrForEach(handlers, function (handler) {
1835
- try {
1836
- handler(unloadCtx, unloadState);
1837
- }
1838
- catch (e) {
1839
- _throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
1840
- }
1841
- });
1842
- handlers = [];
1553
+ else {
1554
+ value = Math.floor((UInt32Mask * Math.random()) | 0);
1843
1555
  }
1844
- return {
1845
- add: _addHandler,
1846
- run: _runHandlers
1847
- };
1556
+ if (!signed) {
1557
+ value >>>= 0;
1558
+ }
1559
+ return value;
1560
+ }
1561
+ function mwcRandom32(signed) {
1562
+ _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1563
+ _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1564
+ var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1565
+ if (!signed) {
1566
+ value >>>= 0;
1567
+ }
1568
+ return value;
1848
1569
  }
1849
1570
 
1850
- var strGetPlugin = "getPlugin";
1851
- var BaseTelemetryPlugin = /** @class */ (function () {
1852
- function BaseTelemetryPlugin() {
1853
- var _self = this;
1854
- var _isinitialized;
1855
- var _rootCtx;
1856
- var _nextPlugin;
1857
- var _unloadHandlerContainer;
1858
- var _hooks;
1859
- _initDefaults();
1860
- dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
1861
- _self.initialize = function (config, core, extensions, pluginChain) {
1862
- _setDefaults(config, core, pluginChain);
1863
- _isinitialized = true;
1864
- };
1865
- _self.teardown = function (unloadCtx, unloadState) {
1866
- if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
1867
- return;
1868
- }
1869
- var result;
1870
- var unloadDone = false;
1871
- var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
1872
- var theUnloadState = unloadState || {
1873
- reason: 0 ,
1874
- isAsync: false
1875
- };
1876
- function _unloadCallback() {
1877
- if (!unloadDone) {
1878
- unloadDone = true;
1879
- _unloadHandlerContainer.run(theUnloadCtx, unloadState);
1880
- arrForEach(_hooks, function (fn) {
1881
- fn.rm();
1882
- });
1883
- _hooks = [];
1884
- if (result === true) {
1885
- theUnloadCtx.processNext(theUnloadState);
1886
- }
1887
- _initDefaults();
1888
- }
1889
- }
1890
- if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
1891
- _unloadCallback();
1892
- }
1893
- else {
1894
- result = true;
1895
- }
1896
- return result;
1897
- };
1898
- _self.update = function (updateCtx, updateState) {
1899
- if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
1900
- return;
1901
- }
1902
- var result;
1903
- var updateDone = false;
1904
- var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
1905
- var theUpdateState = updateState || {
1906
- reason: 0
1907
- };
1908
- function _updateCallback() {
1909
- if (!updateDone) {
1910
- updateDone = true;
1911
- _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
1912
- }
1913
- }
1914
- if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
1915
- _updateCallback();
1916
- }
1917
- else {
1918
- result = true;
1919
- }
1920
- return result;
1921
- };
1922
- _self._addHook = function (hooks) {
1923
- if (hooks) {
1924
- if (isArray(hooks)) {
1925
- _hooks = _hooks.concat(hooks);
1926
- }
1927
- else {
1928
- _hooks.push(hooks);
1929
- }
1930
- }
1931
- };
1932
- proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
1933
- });
1934
- _self.diagLog = function (itemCtx) {
1935
- return _getTelCtx(itemCtx).diagLog();
1936
- };
1937
- _self[strIsInitialized] = function () {
1938
- return _isinitialized;
1939
- };
1940
- _self.setInitialized = function (isInitialized) {
1941
- _isinitialized = isInitialized;
1942
- };
1943
- _self[strSetNextPlugin] = function (next) {
1944
- _nextPlugin = next;
1945
- };
1946
- _self.processNext = function (env, itemCtx) {
1947
- if (itemCtx) {
1948
- itemCtx.processNext(env);
1949
- }
1950
- else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
1951
- _nextPlugin.processTelemetry(env, null);
1952
- }
1953
- };
1954
- _self._getTelCtx = _getTelCtx;
1955
- function _getTelCtx(currentCtx) {
1956
- if (currentCtx === void 0) { currentCtx = null; }
1957
- var itemCtx = currentCtx;
1958
- if (!itemCtx) {
1959
- var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
1960
- if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1961
- itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
1962
- }
1963
- else {
1964
- itemCtx = rootCtx.createNew(null, _nextPlugin);
1965
- }
1966
- }
1967
- return itemCtx;
1968
- }
1969
- function _setDefaults(config, core, pluginChain) {
1970
- if (config) {
1971
- setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
1972
- }
1973
- if (!pluginChain && core) {
1974
- pluginChain = core.getProcessTelContext().getNext();
1975
- }
1976
- var nextPlugin = _nextPlugin;
1977
- if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1978
- nextPlugin = _nextPlugin[strGetPlugin]();
1979
- }
1980
- _self.core = core;
1981
- _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
1982
- }
1983
- function _initDefaults() {
1984
- _isinitialized = false;
1985
- _self.core = null;
1986
- _rootCtx = null;
1987
- _nextPlugin = null;
1988
- _hooks = [];
1989
- _unloadHandlerContainer = createUnloadHandlerContainer();
1571
+ function newId(maxLength) {
1572
+ if (maxLength === void 0) { maxLength = 22; }
1573
+ var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1574
+ var number = random32() >>> 0;
1575
+ var chars = 0;
1576
+ var result = "";
1577
+ while (result.length < maxLength) {
1578
+ chars++;
1579
+ result += base64chars.charAt(number & 0x3F);
1580
+ number >>>= 6;
1581
+ if (chars === 5) {
1582
+ number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1583
+ chars = 0;
1990
1584
  }
1991
1585
  }
1992
- return BaseTelemetryPlugin;
1993
- }());
1994
-
1586
+ return result;
1587
+ }
1995
1588
  function generateW3CId() {
1996
1589
  var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
1997
- var oct = strEmpty$1, tmp;
1590
+ var oct = "", tmp;
1998
1591
  for (var a = 0; a < 4; a++) {
1999
1592
  tmp = random32();
2000
1593
  oct +=
@@ -2011,95 +1604,6 @@
2011
1604
  return oct.substr(0, 8) + oct.substr(9, 4) + "4" + oct.substr(13, 3) + clockSequenceHi + oct.substr(16, 3) + oct.substr(19, 12);
2012
1605
  }
2013
1606
 
2014
- var LoggingSeverity = createEnumStyle({
2015
- CRITICAL: 1 ,
2016
- WARNING: 2
2017
- });
2018
- var _InternalMessageId = createEnumStyle({
2019
- BrowserDoesNotSupportLocalStorage: 0 ,
2020
- BrowserCannotReadLocalStorage: 1 ,
2021
- BrowserCannotReadSessionStorage: 2 ,
2022
- BrowserCannotWriteLocalStorage: 3 ,
2023
- BrowserCannotWriteSessionStorage: 4 ,
2024
- BrowserFailedRemovalFromLocalStorage: 5 ,
2025
- BrowserFailedRemovalFromSessionStorage: 6 ,
2026
- CannotSendEmptyTelemetry: 7 ,
2027
- ClientPerformanceMathError: 8 ,
2028
- ErrorParsingAISessionCookie: 9 ,
2029
- ErrorPVCalc: 10 ,
2030
- ExceptionWhileLoggingError: 11 ,
2031
- FailedAddingTelemetryToBuffer: 12 ,
2032
- FailedMonitorAjaxAbort: 13 ,
2033
- FailedMonitorAjaxDur: 14 ,
2034
- FailedMonitorAjaxOpen: 15 ,
2035
- FailedMonitorAjaxRSC: 16 ,
2036
- FailedMonitorAjaxSend: 17 ,
2037
- FailedMonitorAjaxGetCorrelationHeader: 18 ,
2038
- FailedToAddHandlerForOnBeforeUnload: 19 ,
2039
- FailedToSendQueuedTelemetry: 20 ,
2040
- FailedToReportDataLoss: 21 ,
2041
- FlushFailed: 22 ,
2042
- MessageLimitPerPVExceeded: 23 ,
2043
- MissingRequiredFieldSpecification: 24 ,
2044
- NavigationTimingNotSupported: 25 ,
2045
- OnError: 26 ,
2046
- SessionRenewalDateIsZero: 27 ,
2047
- SenderNotInitialized: 28 ,
2048
- StartTrackEventFailed: 29 ,
2049
- StopTrackEventFailed: 30 ,
2050
- StartTrackFailed: 31 ,
2051
- StopTrackFailed: 32 ,
2052
- TelemetrySampledAndNotSent: 33 ,
2053
- TrackEventFailed: 34 ,
2054
- TrackExceptionFailed: 35 ,
2055
- TrackMetricFailed: 36 ,
2056
- TrackPVFailed: 37 ,
2057
- TrackPVFailedCalc: 38 ,
2058
- TrackTraceFailed: 39 ,
2059
- TransmissionFailed: 40 ,
2060
- FailedToSetStorageBuffer: 41 ,
2061
- FailedToRestoreStorageBuffer: 42 ,
2062
- InvalidBackendResponse: 43 ,
2063
- FailedToFixDepricatedValues: 44 ,
2064
- InvalidDurationValue: 45 ,
2065
- TelemetryEnvelopeInvalid: 46 ,
2066
- CreateEnvelopeError: 47 ,
2067
- CannotSerializeObject: 48 ,
2068
- CannotSerializeObjectNonSerializable: 49 ,
2069
- CircularReferenceDetected: 50 ,
2070
- ClearAuthContextFailed: 51 ,
2071
- ExceptionTruncated: 52 ,
2072
- IllegalCharsInName: 53 ,
2073
- ItemNotInArray: 54 ,
2074
- MaxAjaxPerPVExceeded: 55 ,
2075
- MessageTruncated: 56 ,
2076
- NameTooLong: 57 ,
2077
- SampleRateOutOfRange: 58 ,
2078
- SetAuthContextFailed: 59 ,
2079
- SetAuthContextFailedAccountName: 60 ,
2080
- StringValueTooLong: 61 ,
2081
- StartCalledMoreThanOnce: 62 ,
2082
- StopCalledWithoutStart: 63 ,
2083
- TelemetryInitializerFailed: 64 ,
2084
- TrackArgumentsNotSpecified: 65 ,
2085
- UrlTooLong: 66 ,
2086
- SessionStorageBufferFull: 67 ,
2087
- CannotAccessCookie: 68 ,
2088
- IdTooLong: 69 ,
2089
- InvalidEvent: 70 ,
2090
- FailedMonitorAjaxSetRequestHeader: 71 ,
2091
- SendBrowserInfoOnUserInit: 72 ,
2092
- PluginException: 73 ,
2093
- NotificationException: 74 ,
2094
- SnippetScriptLoadFailure: 99 ,
2095
- InvalidInstrumentationKey: 100 ,
2096
- CannotParseAiBlobValue: 101 ,
2097
- InvalidContentBlob: 102 ,
2098
- TrackPageActionEventFailed: 103 ,
2099
- FailedAddingCustomDefinedRequestContext: 104 ,
2100
- InMemoryStorageBufferFull: 105
2101
- });
2102
-
2103
1607
  function dataSanitizeKeyAndAddUniqueness(logger, key, map) {
2104
1608
  var origLength = key.length;
2105
1609
  var field = dataSanitizeKey(logger, key);
@@ -2120,7 +1624,7 @@
2120
1624
  name = strTrim(name.toString());
2121
1625
  if (name.length > 150 ) {
2122
1626
  nameTrunc = name.substring(0, 150 );
2123
- _throwInternal(logger, 2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
1627
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
2124
1628
  }
2125
1629
  }
2126
1630
  return nameTrunc || name;
@@ -2133,7 +1637,7 @@
2133
1637
  value = strTrim(value);
2134
1638
  if (value.toString().length > maxLength) {
2135
1639
  valueTrunc = value.toString().substring(0, maxLength);
2136
- _throwInternal(logger, 2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
1640
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
2137
1641
  }
2138
1642
  }
2139
1643
  return valueTrunc || value;
@@ -2150,7 +1654,7 @@
2150
1654
  value = getJSON().stringify(value);
2151
1655
  }
2152
1656
  catch (e) {
2153
- _throwInternal(logger, 2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
1657
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
2154
1658
  }
2155
1659
  }
2156
1660
  value = dataSanitizeString(logger, value, 8192 );
@@ -2181,7 +1685,7 @@
2181
1685
  input = strTrim(input);
2182
1686
  if (input.length > maxLength) {
2183
1687
  inputTrunc = input.substring(0, maxLength);
2184
- _throwInternal(logger, 2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
1688
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
2185
1689
  }
2186
1690
  }
2187
1691
  return inputTrunc || input;
@@ -2191,22 +1695,21 @@
2191
1695
  return s.substr(s.length - 3);
2192
1696
  }
2193
1697
 
2194
- var strEmpty = "";
2195
1698
  function msToTimeSpan(totalms) {
2196
1699
  if (isNaN(totalms) || totalms < 0) {
2197
1700
  totalms = 0;
2198
1701
  }
2199
1702
  totalms = Math.round(totalms);
2200
- var ms = strEmpty + totalms % 1000;
2201
- var sec = strEmpty + Math.floor(totalms / 1000) % 60;
2202
- var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
2203
- var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
1703
+ var ms = "" + totalms % 1000;
1704
+ var sec = "" + Math.floor(totalms / 1000) % 60;
1705
+ var min = "" + Math.floor(totalms / (1000 * 60)) % 60;
1706
+ var hour = "" + Math.floor(totalms / (1000 * 60 * 60)) % 24;
2204
1707
  var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
2205
1708
  ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
2206
1709
  sec = sec.length < 2 ? "0" + sec : sec;
2207
1710
  min = min.length < 2 ? "0" + min : min;
2208
1711
  hour = hour.length < 2 ? "0" + hour : hour;
2209
- return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
1712
+ return (days > 0 ? days + "." : "") + hour + ":" + min + ":" + sec + "." + ms;
2210
1713
  }
2211
1714
  function getExtensionByName(extensions, identifier) {
2212
1715
  var extension = null;
@@ -2221,15 +1724,17 @@
2221
1724
 
2222
1725
  var strNotSpecified = "not_specified";
2223
1726
 
2224
- var StorageType = createEnumStyle({
2225
- LocalStorage: 0 ,
2226
- SessionStorage: 1
2227
- });
2228
- createEnumStyle({
2229
- AI: 0 ,
2230
- AI_AND_W3C: 1 ,
2231
- W3C: 2
2232
- });
1727
+ var StorageType;
1728
+ (function (StorageType) {
1729
+ StorageType[StorageType["LocalStorage"] = 0] = "LocalStorage";
1730
+ StorageType[StorageType["SessionStorage"] = 1] = "SessionStorage";
1731
+ })(StorageType || (StorageType = {}));
1732
+ var DistributedTracingModes;
1733
+ (function (DistributedTracingModes) {
1734
+ DistributedTracingModes[DistributedTracingModes["AI"] = 0] = "AI";
1735
+ DistributedTracingModes[DistributedTracingModes["AI_AND_W3C"] = 1] = "AI_AND_W3C";
1736
+ DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
1737
+ })(DistributedTracingModes || (DistributedTracingModes = {}));
2233
1738
 
2234
1739
  var _canUseLocalStorage = undefined;
2235
1740
  function _getLocalStorageObject() {
@@ -2256,8 +1761,8 @@
2256
1761
  }
2257
1762
  return null;
2258
1763
  }
2259
- function utlCanUseLocalStorage(reset) {
2260
- if (reset || _canUseLocalStorage === undefined) {
1764
+ function utlCanUseLocalStorage() {
1765
+ if (_canUseLocalStorage === undefined) {
2261
1766
  _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
2262
1767
  }
2263
1768
  return _canUseLocalStorage;
@@ -2270,7 +1775,7 @@
2270
1775
  }
2271
1776
  catch (e) {
2272
1777
  _canUseLocalStorage = false;
2273
- _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
1778
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2274
1779
  }
2275
1780
  }
2276
1781
  return null;
@@ -2284,7 +1789,7 @@
2284
1789
  }
2285
1790
  catch (e) {
2286
1791
  _canUseLocalStorage = false;
2287
- _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
1792
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2288
1793
  }
2289
1794
  }
2290
1795
  return false;
@@ -2298,7 +1803,7 @@
2298
1803
  }
2299
1804
  catch (e) {
2300
1805
  _canUseLocalStorage = false;
2301
- _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
1806
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2302
1807
  }
2303
1808
  }
2304
1809
  return false;
@@ -2600,7 +2105,7 @@
2600
2105
  return Device;
2601
2106
  }());
2602
2107
 
2603
- var Version = "2.7.5-nightly.2203-03";
2108
+ var Version = "2.7.5";
2604
2109
  var Internal = /** @class */ (function () {
2605
2110
  function Internal(config) {
2606
2111
  this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + Version;