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

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 +454 -947
  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 +454 -947
  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.2204-03
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.7.6
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.6
90
86
  * Copyright (c) Microsoft and contributors. All rights reserved.
91
87
  */
92
88
  var Constructor = 'constructor';
@@ -100,11 +96,14 @@
100
96
  var DynAllowInstChkTag = DynInstChkTag;
101
97
  var DynProtoDefaultOptions = '_dfOpts';
102
98
  var UnknownValue = '_unknown_';
103
- var str__Proto$1 = "__proto__";
99
+ var str__Proto = "__proto__";
100
+ var DynProtoBaseProto = "_dyn" + str__Proto;
101
+ var DynProtoCurrent = "_dynInstProto";
104
102
  var strUseBaseInst = 'useBaseInst';
105
103
  var strSetInstFuncs = 'setInstFuncs';
106
104
  var Obj = Object;
107
- var _objGetPrototypeOf$1 = Obj["getPrototypeOf"];
105
+ var _objGetPrototypeOf = Obj["getPrototypeOf"];
106
+ var _objGetOwnProps = Obj["getOwnPropertyNames"];
108
107
  var _dynamicNames = 0;
109
108
  function _hasOwnProperty(obj, prop) {
110
109
  return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
@@ -115,23 +114,26 @@
115
114
  function _isObjectArrayOrFunctionPrototype(target) {
116
115
  return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
117
116
  }
118
- function _getObjProto$1(target) {
117
+ function _getObjProto(target) {
118
+ var newProto;
119
119
  if (target) {
120
- if (_objGetPrototypeOf$1) {
121
- return _objGetPrototypeOf$1(target);
120
+ if (_objGetPrototypeOf) {
121
+ return _objGetPrototypeOf(target);
122
122
  }
123
- var newProto = target[str__Proto$1] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
124
- if (newProto) {
125
- return newProto;
123
+ var curProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
124
+ newProto = target[DynProtoBaseProto] || curProto;
125
+ if (!_hasOwnProperty(target, DynProtoBaseProto)) {
126
+ delete target[DynProtoCurrent];
127
+ newProto = target[DynProtoBaseProto] = target[DynProtoCurrent] || target[DynProtoBaseProto];
128
+ target[DynProtoCurrent] = curProto;
126
129
  }
127
130
  }
128
- return null;
131
+ return newProto;
129
132
  }
130
133
  function _forEachProp(target, func) {
131
134
  var props = [];
132
- var getOwnProps = Obj["getOwnPropertyNames"];
133
- if (getOwnProps) {
134
- props = getOwnProps(target);
135
+ if (_objGetOwnProps) {
136
+ props = _objGetOwnProps(target);
135
137
  }
136
138
  else {
137
139
  for (var name_1 in target) {
@@ -186,16 +188,16 @@
186
188
  _forEachProp(instFuncs, function (name) {
187
189
  baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
188
190
  });
189
- var baseProto = _getObjProto$1(classProto);
191
+ var baseProto = _getObjProto(classProto);
190
192
  var visited = [];
191
193
  while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
192
194
  _forEachProp(baseProto, function (name) {
193
- if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf$1)) {
195
+ if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
194
196
  baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
195
197
  }
196
198
  });
197
199
  visited.push(baseProto);
198
- baseProto = _getObjProto$1(baseProto);
200
+ baseProto = _getObjProto(baseProto);
199
201
  }
200
202
  return baseFuncs;
201
203
  }
@@ -209,7 +211,7 @@
209
211
  }
210
212
  if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
211
213
  var canAddInst = !_hasOwnProperty(target, funcName);
212
- var objProto = _getObjProto$1(target);
214
+ var objProto = _getObjProto(target);
213
215
  var visited = [];
214
216
  while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
215
217
  var protoFunc = objProto[funcName];
@@ -218,7 +220,7 @@
218
220
  break;
219
221
  }
220
222
  visited.push(objProto);
221
- objProto = _getObjProto$1(objProto);
223
+ objProto = _getObjProto(objProto);
222
224
  }
223
225
  try {
224
226
  if (canAddInst) {
@@ -236,7 +238,7 @@
236
238
  function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
237
239
  var protoFunc = proto[funcName];
238
240
  if (protoFunc === currentDynProtoProxy) {
239
- protoFunc = _getObjProto$1(proto)[funcName];
241
+ protoFunc = _getObjProto(proto)[funcName];
240
242
  }
241
243
  if (typeof protoFunc !== strFunction) {
242
244
  _throwTypeError("[" + funcName + "] is not a " + strFunction);
@@ -270,18 +272,19 @@
270
272
  }
271
273
  }
272
274
  function _checkPrototype(classProto, thisTarget) {
273
- if (_objGetPrototypeOf$1) {
275
+ if (_objGetPrototypeOf) {
274
276
  var visited = [];
275
- var thisProto = _getObjProto$1(thisTarget);
277
+ var thisProto = _getObjProto(thisTarget);
276
278
  while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
277
279
  if (thisProto === classProto) {
278
280
  return true;
279
281
  }
280
282
  visited.push(thisProto);
281
- thisProto = _getObjProto$1(thisProto);
283
+ thisProto = _getObjProto(thisProto);
282
284
  }
285
+ return false;
283
286
  }
284
- return false;
287
+ return true;
285
288
  }
286
289
  function _getObjName(target, unknownValue) {
287
290
  if (_hasOwnProperty(target, Prototype)) {
@@ -314,7 +317,7 @@
314
317
  var instFuncs = _getInstanceFuncs(target);
315
318
  var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
316
319
  delegateFunc(target, baseFuncs);
317
- var setInstanceFunc = !!_objGetPrototypeOf$1 && !!perfOptions[strSetInstFuncs];
320
+ var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
318
321
  if (setInstanceFunc && options) {
319
322
  setInstanceFunc = !!options[strSetInstFuncs];
320
323
  }
@@ -326,23 +329,101 @@
326
329
  };
327
330
  dynamicProto[DynProtoDefaultOptions] = perfDefaults;
328
331
 
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";
332
+ var LoggingSeverity;
333
+ (function (LoggingSeverity) {
334
+ LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
335
+ LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
336
+ })(LoggingSeverity || (LoggingSeverity = {}));
337
+ var _InternalMessageId = {
338
+ BrowserDoesNotSupportLocalStorage: 0,
339
+ BrowserCannotReadLocalStorage: 1,
340
+ BrowserCannotReadSessionStorage: 2,
341
+ BrowserCannotWriteLocalStorage: 3,
342
+ BrowserCannotWriteSessionStorage: 4,
343
+ BrowserFailedRemovalFromLocalStorage: 5,
344
+ BrowserFailedRemovalFromSessionStorage: 6,
345
+ CannotSendEmptyTelemetry: 7,
346
+ ClientPerformanceMathError: 8,
347
+ ErrorParsingAISessionCookie: 9,
348
+ ErrorPVCalc: 10,
349
+ ExceptionWhileLoggingError: 11,
350
+ FailedAddingTelemetryToBuffer: 12,
351
+ FailedMonitorAjaxAbort: 13,
352
+ FailedMonitorAjaxDur: 14,
353
+ FailedMonitorAjaxOpen: 15,
354
+ FailedMonitorAjaxRSC: 16,
355
+ FailedMonitorAjaxSend: 17,
356
+ FailedMonitorAjaxGetCorrelationHeader: 18,
357
+ FailedToAddHandlerForOnBeforeUnload: 19,
358
+ FailedToSendQueuedTelemetry: 20,
359
+ FailedToReportDataLoss: 21,
360
+ FlushFailed: 22,
361
+ MessageLimitPerPVExceeded: 23,
362
+ MissingRequiredFieldSpecification: 24,
363
+ NavigationTimingNotSupported: 25,
364
+ OnError: 26,
365
+ SessionRenewalDateIsZero: 27,
366
+ SenderNotInitialized: 28,
367
+ StartTrackEventFailed: 29,
368
+ StopTrackEventFailed: 30,
369
+ StartTrackFailed: 31,
370
+ StopTrackFailed: 32,
371
+ TelemetrySampledAndNotSent: 33,
372
+ TrackEventFailed: 34,
373
+ TrackExceptionFailed: 35,
374
+ TrackMetricFailed: 36,
375
+ TrackPVFailed: 37,
376
+ TrackPVFailedCalc: 38,
377
+ TrackTraceFailed: 39,
378
+ TransmissionFailed: 40,
379
+ FailedToSetStorageBuffer: 41,
380
+ FailedToRestoreStorageBuffer: 42,
381
+ InvalidBackendResponse: 43,
382
+ FailedToFixDepricatedValues: 44,
383
+ InvalidDurationValue: 45,
384
+ TelemetryEnvelopeInvalid: 46,
385
+ CreateEnvelopeError: 47,
386
+ CannotSerializeObject: 48,
387
+ CannotSerializeObjectNonSerializable: 49,
388
+ CircularReferenceDetected: 50,
389
+ ClearAuthContextFailed: 51,
390
+ ExceptionTruncated: 52,
391
+ IllegalCharsInName: 53,
392
+ ItemNotInArray: 54,
393
+ MaxAjaxPerPVExceeded: 55,
394
+ MessageTruncated: 56,
395
+ NameTooLong: 57,
396
+ SampleRateOutOfRange: 58,
397
+ SetAuthContextFailed: 59,
398
+ SetAuthContextFailedAccountName: 60,
399
+ StringValueTooLong: 61,
400
+ StartCalledMoreThanOnce: 62,
401
+ StopCalledWithoutStart: 63,
402
+ TelemetryInitializerFailed: 64,
403
+ TrackArgumentsNotSpecified: 65,
404
+ UrlTooLong: 66,
405
+ SessionStorageBufferFull: 67,
406
+ CannotAccessCookie: 68,
407
+ IdTooLong: 69,
408
+ InvalidEvent: 70,
409
+ FailedMonitorAjaxSetRequestHeader: 71,
410
+ SendBrowserInfoOnUserInit: 72,
411
+ PluginException: 73,
412
+ NotificationException: 74,
413
+ SnippetScriptLoadFailure: 99,
414
+ InvalidInstrumentationKey: 100,
415
+ CannotParseAiBlobValue: 101,
416
+ InvalidContentBlob: 102,
417
+ TrackPageActionEventFailed: 103,
418
+ FailedAddingCustomDefinedRequestContext: 104,
419
+ InMemoryStorageBufferFull: 105
420
+ };
337
421
 
338
422
  var strToISOString = "toISOString";
339
423
  var cStrEndsWith = "endsWith";
340
424
  var cStrTrim = "trim";
341
425
  var strToString = "toString";
342
- var str__Proto = "__proto__";
343
- var strConstructor = "constructor";
344
- var _objDefineProperty$1 = ObjDefineProperty;
345
- var _objFreeze = ObjClass.freeze;
426
+ var _objDefineProperty = ObjDefineProperty;
346
427
  var _objKeys = ObjClass.keys;
347
428
  var StringProto = String[strShimPrototype];
348
429
  var _strTrim = StringProto[cStrTrim];
@@ -352,23 +433,7 @@
352
433
  var _isArray = Array.isArray;
353
434
  var _objToString = ObjProto[strToString];
354
435
  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
- }
436
+ _fnToString.call(ObjClass);
372
437
  function isUndefined(value) {
373
438
  return value === undefined || typeof value === strShimUndefined;
374
439
  }
@@ -384,19 +449,6 @@
384
449
  function isFunction(value) {
385
450
  return !!(value && typeof value === strShimFunction);
386
451
  }
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
452
  function objForEachKey(target, callbackfn) {
401
453
  if (target) {
402
454
  for (var prop in target) {
@@ -445,25 +497,6 @@
445
497
  function isString(value) {
446
498
  return typeof value === "string";
447
499
  }
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
500
  function toISOString(date) {
468
501
  if (date) {
469
502
  return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
@@ -543,7 +576,7 @@
543
576
  return result;
544
577
  }
545
578
  function objDefineAccessors(target, prop, getProp, setProp) {
546
- if (_objDefineProperty$1) {
579
+ if (_objDefineProperty) {
547
580
  try {
548
581
  var descriptor = {
549
582
  enumerable: true,
@@ -555,7 +588,7 @@
555
588
  if (setProp) {
556
589
  descriptor.set = setProp;
557
590
  }
558
- _objDefineProperty$1(target, prop, descriptor);
591
+ _objDefineProperty(target, prop, descriptor);
559
592
  return true;
560
593
  }
561
594
  catch (e) {
@@ -563,10 +596,6 @@
563
596
  }
564
597
  return false;
565
598
  }
566
- function _doNothing(value) {
567
- return value;
568
- }
569
- var objFreeze = _objFreeze || _doNothing;
570
599
  function dateNow() {
571
600
  var dt = Date;
572
601
  return dt.now ? dt.now() : new dt().getTime();
@@ -575,7 +604,7 @@
575
604
  if (isError(object)) {
576
605
  return object.name;
577
606
  }
578
- return strEmpty$1;
607
+ return "";
579
608
  }
580
609
  function setValue(target, field, value, valChk, srcChk) {
581
610
  var theValue = value;
@@ -605,36 +634,6 @@
605
634
  function isTruthy(value) {
606
635
  return !!value;
607
636
  }
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
637
  function createClassFromInterface(defaults) {
639
638
  return /** @class */ (function () {
640
639
  function class_1() {
@@ -648,61 +647,6 @@
648
647
  return class_1;
649
648
  }());
650
649
  }
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
650
 
707
651
  var strWindow = "window";
708
652
  var strDocument = "document";
@@ -785,14 +729,14 @@
785
729
  var nav = getNavigator();
786
730
  if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
787
731
  _navUserAgentCheck = nav.userAgent;
788
- var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
732
+ var userAgent = (_navUserAgentCheck || "").toLowerCase();
789
733
  _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
790
734
  }
791
735
  return _isTrident;
792
736
  }
793
737
  function dumpObj(object) {
794
738
  var objectTypeDump = Object[strShimPrototype].toString.call(object);
795
- var propertyValueDump = strEmpty$1;
739
+ var propertyValueDump = "";
796
740
  if (objectTypeDump === "[object Error]") {
797
741
  propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
798
742
  }
@@ -825,9 +769,9 @@
825
769
  var strWarnToConsole = "warnToConsole";
826
770
  function _sanitizeDiagnosticText(text) {
827
771
  if (text) {
828
- return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
772
+ return "\"" + text.replace(/\"/g, "") + "\"";
829
773
  }
830
- return strEmpty$1;
774
+ return "";
831
775
  }
832
776
  function _logToConsole(func, message) {
833
777
  var theConsole = getConsole();
@@ -849,12 +793,12 @@
849
793
  _self.message =
850
794
  (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
851
795
  msgId;
852
- var strProps = strEmpty$1;
796
+ var strProps = "";
853
797
  if (hasJSON()) {
854
798
  strProps = getJSON().stringify(properties);
855
799
  }
856
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
857
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
800
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : "") +
801
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : "");
858
802
  _self.message += diagnosticText;
859
803
  }
860
804
  _InternalLogMessage.dataType = "MessageData";
@@ -881,10 +825,10 @@
881
825
  if (isUserAct === void 0) { isUserAct = false; }
882
826
  var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
883
827
  if (_self.enableDebugExceptions()) {
884
- throw message;
828
+ throw dumpObj(message);
885
829
  }
886
830
  else {
887
- var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
831
+ var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
888
832
  if (!isUndefined(message.message)) {
889
833
  var logLevel = _self.consoleLoggingLevel();
890
834
  if (isUserAct) {
@@ -902,7 +846,7 @@
902
846
  _self.logInternalMessage(severity, message);
903
847
  }
904
848
  else {
905
- _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
849
+ _debugExtMsg("throw" + (severity === LoggingSeverity.CRITICAL ? "Critical" : "Warning"), message);
906
850
  }
907
851
  }
908
852
  };
@@ -934,13 +878,13 @@
934
878
  if (severity <= _self.telemetryLoggingLevel()) {
935
879
  _self.queue.push(message);
936
880
  _messageCount++;
937
- _debugExtMsg((severity === 1 ? "error" : "warn"), message);
881
+ _debugExtMsg((severity === LoggingSeverity.CRITICAL ? "error" : "warn"), message);
938
882
  }
939
883
  if (_messageCount === _self.maxInternalMessageLimit()) {
940
884
  var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
941
- var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
885
+ var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
942
886
  _self.queue.push(throttleMessage);
943
- if (severity === 1 ) {
887
+ if (severity === LoggingSeverity.CRITICAL) {
944
888
  _self.errorToConsole(throttleLimitMessage);
945
889
  }
946
890
  else {
@@ -969,10 +913,6 @@
969
913
  }
970
914
  return DiagnosticLogger;
971
915
  }());
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
916
 
977
917
  var strExecutionContextKey = "ctx";
978
918
  var PerfEvent = /** @class */ (function () {
@@ -1086,495 +1026,252 @@
1086
1026
  return func();
1087
1027
  }
1088
1028
 
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.2204-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
- }
1029
+ var TelemetryPluginChain = /** @class */ (function () {
1030
+ function TelemetryPluginChain(plugin, defItemCtx) {
1031
+ var _self = this;
1032
+ var _nextProxy = null;
1033
+ var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
1034
+ var _hasSetNext = isFunction(plugin.setNextPlugin);
1035
+ _self._hasRun = false;
1036
+ _self.getPlugin = function () {
1037
+ return plugin;
1038
+ };
1039
+ _self.getNext = function () {
1040
+ return _nextProxy;
1041
+ };
1042
+ _self.setNext = function (nextPlugin) {
1043
+ _nextProxy = nextPlugin;
1044
+ };
1045
+ _self.processTelemetry = function (env, itemCtx) {
1046
+ if (!itemCtx) {
1047
+ itemCtx = defItemCtx;
1223
1048
  }
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) {
1049
+ var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
1050
+ doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
1051
+ if (plugin && _hasProcessTelemetry) {
1052
+ _self._hasRun = true;
1300
1053
  try {
1301
- completeDetails.func.call(completeDetails.self, completeDetails.args);
1054
+ itemCtx.setNext(_nextProxy);
1055
+ if (_hasSetNext) {
1056
+ plugin.setNextPlugin(_nextProxy);
1057
+ }
1058
+ _nextProxy && (_nextProxy._hasRun = false);
1059
+ plugin.processTelemetry(env, itemCtx);
1302
1060
  }
1303
- catch (e) {
1304
- _throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1061
+ catch (error) {
1062
+ var hasRun = _nextProxy && _nextProxy._hasRun;
1063
+ if (!_nextProxy || !hasRun) {
1064
+ itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
1065
+ }
1066
+ if (_nextProxy && !hasRun) {
1067
+ _nextProxy.processTelemetry(env, itemCtx);
1068
+ }
1305
1069
  }
1306
- });
1307
- _onComplete = [];
1308
- }
1309
- }
1310
- return nextProxy;
1070
+ }
1071
+ else if (_nextProxy) {
1072
+ _self._hasRun = true;
1073
+ _nextProxy.processTelemetry(env, itemCtx);
1074
+ }
1075
+ }, function () { return ({ item: env }); }, !(env.sync));
1076
+ };
1311
1077
  }
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
- });
1078
+ return TelemetryPluginChain;
1079
+ }());
1080
+
1081
+ function _createProxyChain(plugins, itemCtx) {
1082
+ var proxies = [];
1083
+ if (plugins && plugins.length > 0) {
1084
+ var lastProxy = null;
1085
+ for (var idx = 0; idx < plugins.length; idx++) {
1086
+ var thePlugin = plugins[idx];
1087
+ if (thePlugin && isFunction(thePlugin.processTelemetry)) {
1088
+ var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
1089
+ proxies.push(newProxy);
1090
+ if (lastProxy) {
1091
+ lastProxy.setNext(newProxy);
1337
1092
  }
1093
+ lastProxy = newProxy;
1338
1094
  }
1339
1095
  }
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
1096
  }
1354
- function _iterateChain(cb) {
1355
- var nextPlugin;
1356
- while (!!(nextPlugin = context._next())) {
1357
- var plugin = nextPlugin.getPlugin();
1358
- if (plugin) {
1359
- cb(plugin);
1097
+ return proxies.length > 0 ? proxies[0] : null;
1098
+ }
1099
+ function _copyProxyChain(proxy, itemCtx, startAt) {
1100
+ var plugins = [];
1101
+ var add = startAt ? false : true;
1102
+ if (proxy) {
1103
+ while (proxy) {
1104
+ var thePlugin = proxy.getPlugin();
1105
+ if (add || thePlugin === startAt) {
1106
+ add = true;
1107
+ plugins.push(thePlugin);
1360
1108
  }
1109
+ proxy = proxy.getNext();
1361
1110
  }
1362
1111
  }
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;
1112
+ if (!add) {
1113
+ plugins.push(startAt);
1372
1114
  }
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);
1398
- }
1399
- context.processNext = _processNext;
1400
- context.createNew = _createNew;
1401
- return context;
1115
+ return _createProxyChain(plugins, itemCtx);
1402
1116
  }
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);
1117
+ function _copyPluginChain(srcPlugins, itemCtx, startAt) {
1118
+ var plugins = srcPlugins;
1119
+ var add = false;
1120
+ if (startAt && srcPlugins) {
1121
+ plugins = [];
1122
+ arrForEach(srcPlugins, function (thePlugin) {
1123
+ if (add || thePlugin === startAt) {
1124
+ add = true;
1125
+ plugins.push(thePlugin);
1410
1126
  }
1411
1127
  });
1412
1128
  }
1413
- function _createNew(plugins, startAt) {
1414
- if (plugins === void 0) { plugins = null; }
1415
- if (isArray(plugins)) {
1416
- plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1129
+ if (startAt && !add) {
1130
+ if (!plugins) {
1131
+ plugins = [];
1417
1132
  }
1418
- return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
1133
+ plugins.push(startAt);
1419
1134
  }
1420
- context.processNext = _processNext;
1421
- context.createNew = _createNew;
1422
- return context;
1135
+ return _createProxyChain(plugins, itemCtx);
1423
1136
  }
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;
1137
+ var ProcessTelemetryContext = /** @class */ (function () {
1138
+ function ProcessTelemetryContext(plugins, config, core, startAt) {
1139
+ var _self = this;
1140
+ var _nextProxy = null;
1141
+ if (startAt !== null) {
1142
+ if (plugins && isFunction(plugins.getPlugin)) {
1143
+ _nextProxy = _copyProxyChain(plugins, _self, startAt || plugins.getPlugin());
1432
1144
  }
1433
- if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
1434
- var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
1435
- if (!firstProxy) {
1436
- firstProxy = newProxy;
1145
+ else {
1146
+ if (startAt) {
1147
+ _nextProxy = _copyPluginChain(plugins, _self, startAt);
1437
1148
  }
1438
- if (lastProxy_1) {
1439
- lastProxy_1._setNext(newProxy);
1149
+ else if (isUndefined(startAt)) {
1150
+ _nextProxy = _createProxyChain(plugins, _self);
1440
1151
  }
1441
- lastProxy_1 = newProxy;
1442
1152
  }
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
1153
  }
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
- }
1154
+ _self.core = function () {
1155
+ return core;
1156
+ };
1157
+ _self.diagLog = function () {
1158
+ return safeGetLogger(core, config);
1159
+ };
1160
+ _self.getCfg = function () {
1161
+ return config;
1162
+ };
1163
+ _self.getExtCfg = function (identifier, defaultValue) {
1164
+ if (defaultValue === void 0) { defaultValue = {}; }
1165
+ var theConfig;
1166
+ if (config) {
1167
+ var extConfig = config.extensionConfig;
1168
+ if (extConfig && identifier) {
1169
+ theConfig = extConfig[identifier];
1512
1170
  }
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
1171
  }
1523
- var pluginState = _getPluginState(plugin);
1524
- if (pluginState[strTeardown] || pluginState[strDisabled]) {
1525
- return false;
1172
+ return (theConfig ? theConfig : defaultValue);
1173
+ };
1174
+ _self.getConfig = function (identifier, field, defaultValue) {
1175
+ if (defaultValue === void 0) { defaultValue = false; }
1176
+ var theValue;
1177
+ var extConfig = _self.getExtCfg(identifier, null);
1178
+ if (extConfig && !isNullOrUndefined(extConfig[field])) {
1179
+ theValue = extConfig[field];
1526
1180
  }
1527
- if (hasSetNext) {
1528
- plugin.setNextPlugin(nextProxy);
1181
+ else if (config && !isNullOrUndefined(config[field])) {
1182
+ theValue = config[field];
1529
1183
  }
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
- }
1184
+ return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1185
+ };
1186
+ _self.hasNext = function () {
1187
+ return _nextProxy != null;
1188
+ };
1189
+ _self.getNext = function () {
1190
+ return _nextProxy;
1191
+ };
1192
+ _self.setNext = function (nextPlugin) {
1193
+ _nextProxy = nextPlugin;
1194
+ };
1195
+ _self.processNext = function (env) {
1196
+ var nextPlugin = _nextProxy;
1197
+ if (nextPlugin) {
1198
+ _nextProxy = nextPlugin.getNext();
1199
+ nextPlugin.processTelemetry(env, _self);
1551
1200
  }
1552
- return hasRun;
1553
- }
1554
- if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
1555
- unloadCtx.processNext(unloadState);
1556
- }
1201
+ };
1202
+ _self.createNew = function (plugins, startAt) {
1203
+ if (plugins === void 0) { plugins = null; }
1204
+ return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
1205
+ };
1557
1206
  }
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
- }
1207
+ return ProcessTelemetryContext;
1208
+ }());
1209
+
1210
+ var strExtensionConfig = "extensionConfig";
1211
+
1212
+ var strGetPlugin = "getPlugin";
1213
+ var BaseTelemetryPlugin = /** @class */ (function () {
1214
+ function BaseTelemetryPlugin() {
1215
+ var _self = this;
1216
+ var _isinitialized = false;
1217
+ var _rootCtx = null;
1218
+ var _nextPlugin = null;
1219
+ _self.core = null;
1220
+ _self.diagLog = function (itemCtx) {
1221
+ return _self._getTelCtx(itemCtx).diagLog();
1222
+ };
1223
+ _self.isInitialized = function () {
1224
+ return _isinitialized;
1225
+ };
1226
+ _self.setInitialized = function (isInitialized) {
1227
+ _isinitialized = isInitialized;
1228
+ };
1229
+ _self.setNextPlugin = function (next) {
1230
+ _nextPlugin = next;
1231
+ };
1232
+ _self.processNext = function (env, itemCtx) {
1233
+ if (itemCtx) {
1234
+ itemCtx.processNext(env);
1235
+ }
1236
+ else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
1237
+ _nextPlugin.processTelemetry(env, null);
1238
+ }
1239
+ };
1240
+ _self._getTelCtx = function (currentCtx) {
1241
+ if (currentCtx === void 0) { currentCtx = null; }
1242
+ var itemCtx = currentCtx;
1243
+ if (!itemCtx) {
1244
+ var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);
1245
+ if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1246
+ itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
1247
+ }
1248
+ else {
1249
+ itemCtx = rootCtx.createNew(null, _nextPlugin);
1568
1250
  }
1569
1251
  }
1570
- return hasRun;
1571
- }
1572
- if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
1573
- updateCtx.processNext(updateState);
1574
- }
1252
+ return itemCtx;
1253
+ };
1254
+ _self._baseTelInit = function (config, core, extensions, pluginChain) {
1255
+ if (config) {
1256
+ setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
1257
+ }
1258
+ if (!pluginChain && core) {
1259
+ pluginChain = core.getProcessTelContext().getNext();
1260
+ }
1261
+ var nextPlugin = _nextPlugin;
1262
+ if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1263
+ nextPlugin = _nextPlugin[strGetPlugin]();
1264
+ }
1265
+ _self.core = core;
1266
+ _rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
1267
+ _isinitialized = true;
1268
+ };
1575
1269
  }
1576
- return objFreeze(proxyChain);
1577
- }
1270
+ BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
1271
+ this._baseTelInit(config, core, extensions, pluginChain);
1272
+ };
1273
+ return BaseTelemetryPlugin;
1274
+ }());
1578
1275
 
1579
1276
  var strToGMTString = "toGMTString";
1580
1277
  var strToUTCString = "toUTCString";
@@ -1584,6 +1281,7 @@
1584
1281
  var strIsCookieUseDisabled = "isCookieUseDisabled";
1585
1282
  var strDisableCookiesUsage = "disableCookiesUsage";
1586
1283
  var strConfigCookieMgr = "_ckMgr";
1284
+ var strEmpty = "";
1587
1285
  var _supportsCookies = null;
1588
1286
  var _allowUaSameSite = null;
1589
1287
  var _parsedCookieValue = null;
@@ -1660,7 +1358,7 @@
1660
1358
  var result = false;
1661
1359
  if (_isMgrEnabled(cookieMgr)) {
1662
1360
  var values = {};
1663
- var theValue = strTrim(value || strEmpty$1);
1361
+ var theValue = strTrim(value || strEmpty);
1664
1362
  var idx = theValue.indexOf(";");
1665
1363
  if (idx !== -1) {
1666
1364
  theValue = strTrim(value.substring(0, idx));
@@ -1675,11 +1373,11 @@
1675
1373
  if (expireMs > 0) {
1676
1374
  var expiry = new Date();
1677
1375
  expiry.setTime(expireMs);
1678
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty$1, isTruthy);
1376
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
1679
1377
  }
1680
1378
  }
1681
1379
  if (!_isIE) {
1682
- setValue(values, "max-age", strEmpty$1 + maxAgeSec, null, isUndefined);
1380
+ setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
1683
1381
  }
1684
1382
  }
1685
1383
  var location_1 = getLocation();
@@ -1700,7 +1398,7 @@
1700
1398
  return result;
1701
1399
  },
1702
1400
  get: function (name) {
1703
- var value = strEmpty$1;
1401
+ var value = strEmpty;
1704
1402
  if (_isMgrEnabled(cookieMgr)) {
1705
1403
  value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
1706
1404
  }
@@ -1725,7 +1423,7 @@
1725
1423
  values["max-age"] = "0";
1726
1424
  }
1727
1425
  var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
1728
- delCookie(name, _formatCookieValue(strEmpty$1, values));
1426
+ delCookie(name, _formatCookieValue(strEmpty, values));
1729
1427
  result = true;
1730
1428
  }
1731
1429
  return result;
@@ -1742,7 +1440,7 @@
1742
1440
  _supportsCookies = doc[strCookie] !== undefined;
1743
1441
  }
1744
1442
  catch (e) {
1745
- _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1443
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotAccessCookie, "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1746
1444
  }
1747
1445
  }
1748
1446
  return _supportsCookies;
@@ -1752,7 +1450,7 @@
1752
1450
  if (theValue && theValue.length) {
1753
1451
  var parts = strTrim(theValue).split(";");
1754
1452
  arrForEach(parts, function (thePart) {
1755
- thePart = strTrim(thePart || strEmpty$1);
1453
+ thePart = strTrim(thePart || strEmpty);
1756
1454
  if (thePart) {
1757
1455
  var idx = thePart.indexOf("=");
1758
1456
  if (idx === -1) {
@@ -1773,21 +1471,21 @@
1773
1471
  return null;
1774
1472
  }
1775
1473
  function _formatCookieValue(value, values) {
1776
- var cookieValue = value || strEmpty$1;
1474
+ var cookieValue = value || strEmpty;
1777
1475
  objForEachKey(values, function (name, theValue) {
1778
- cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty$1);
1476
+ cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
1779
1477
  });
1780
1478
  return cookieValue;
1781
1479
  }
1782
1480
  function _getCookieValue(name) {
1783
- var cookieValue = strEmpty$1;
1481
+ var cookieValue = strEmpty;
1784
1482
  if (_doc) {
1785
- var theCookie = _doc[strCookie] || strEmpty$1;
1483
+ var theCookie = _doc[strCookie] || strEmpty;
1786
1484
  if (_parsedCookieValue !== theCookie) {
1787
1485
  _cookieCache = _extractParts(theCookie);
1788
1486
  _parsedCookieValue = theCookie;
1789
1487
  }
1790
- cookieValue = strTrim(_cookieCache[name] || strEmpty$1);
1488
+ cookieValue = strTrim(_cookieCache[name] || strEmpty);
1791
1489
  }
1792
1490
  return cookieValue;
1793
1491
  }
@@ -1821,180 +1519,77 @@
1821
1519
  return false;
1822
1520
  }
1823
1521
 
1824
- var strExtensionConfig = "extensionConfig";
1825
-
1826
- function createUnloadHandlerContainer() {
1827
- var handlers = [];
1828
- function _addHandler(handler) {
1829
- if (handler) {
1830
- handlers.push(handler);
1522
+ var UInt32Mask = 0x100000000;
1523
+ var MaxUInt32 = 0xffffffff;
1524
+ var _mwcSeeded = false;
1525
+ var _mwcW = 123456789;
1526
+ var _mwcZ = 987654321;
1527
+ function _mwcSeed(seedValue) {
1528
+ if (seedValue < 0) {
1529
+ seedValue >>>= 0;
1530
+ }
1531
+ _mwcW = (123456789 + seedValue) & MaxUInt32;
1532
+ _mwcZ = (987654321 - seedValue) & MaxUInt32;
1533
+ _mwcSeeded = true;
1534
+ }
1535
+ function _autoSeedMwc() {
1536
+ try {
1537
+ var now = dateNow() & 0x7fffffff;
1538
+ _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1539
+ }
1540
+ catch (e) {
1541
+ }
1542
+ }
1543
+ function random32(signed) {
1544
+ var value;
1545
+ var c = getCrypto() || getMsCrypto();
1546
+ if (c && c.getRandomValues) {
1547
+ value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1548
+ }
1549
+ else if (isIE()) {
1550
+ if (!_mwcSeeded) {
1551
+ _autoSeedMwc();
1831
1552
  }
1553
+ value = mwcRandom32() & MaxUInt32;
1832
1554
  }
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 = [];
1555
+ else {
1556
+ value = Math.floor((UInt32Mask * Math.random()) | 0);
1843
1557
  }
1844
- return {
1845
- add: _addHandler,
1846
- run: _runHandlers
1847
- };
1558
+ if (!signed) {
1559
+ value >>>= 0;
1560
+ }
1561
+ return value;
1562
+ }
1563
+ function mwcRandom32(signed) {
1564
+ _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1565
+ _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1566
+ var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1567
+ if (!signed) {
1568
+ value >>>= 0;
1569
+ }
1570
+ return value;
1848
1571
  }
1849
1572
 
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();
1573
+ function newId(maxLength) {
1574
+ if (maxLength === void 0) { maxLength = 22; }
1575
+ var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1576
+ var number = random32() >>> 0;
1577
+ var chars = 0;
1578
+ var result = "";
1579
+ while (result.length < maxLength) {
1580
+ chars++;
1581
+ result += base64chars.charAt(number & 0x3F);
1582
+ number >>>= 6;
1583
+ if (chars === 5) {
1584
+ number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1585
+ chars = 0;
1990
1586
  }
1991
1587
  }
1992
- return BaseTelemetryPlugin;
1993
- }());
1994
-
1588
+ return result;
1589
+ }
1995
1590
  function generateW3CId() {
1996
1591
  var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
1997
- var oct = strEmpty$1, tmp;
1592
+ var oct = "", tmp;
1998
1593
  for (var a = 0; a < 4; a++) {
1999
1594
  tmp = random32();
2000
1595
  oct +=
@@ -2011,95 +1606,6 @@
2011
1606
  return oct.substr(0, 8) + oct.substr(9, 4) + "4" + oct.substr(13, 3) + clockSequenceHi + oct.substr(16, 3) + oct.substr(19, 12);
2012
1607
  }
2013
1608
 
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
1609
  function dataSanitizeKeyAndAddUniqueness(logger, key, map) {
2104
1610
  var origLength = key.length;
2105
1611
  var field = dataSanitizeKey(logger, key);
@@ -2120,7 +1626,7 @@
2120
1626
  name = strTrim(name.toString());
2121
1627
  if (name.length > 150 ) {
2122
1628
  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);
1629
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
2124
1630
  }
2125
1631
  }
2126
1632
  return nameTrunc || name;
@@ -2133,7 +1639,7 @@
2133
1639
  value = strTrim(value);
2134
1640
  if (value.toString().length > maxLength) {
2135
1641
  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);
1642
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
2137
1643
  }
2138
1644
  }
2139
1645
  return valueTrunc || value;
@@ -2150,7 +1656,7 @@
2150
1656
  value = getJSON().stringify(value);
2151
1657
  }
2152
1658
  catch (e) {
2153
- _throwInternal(logger, 2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
1659
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
2154
1660
  }
2155
1661
  }
2156
1662
  value = dataSanitizeString(logger, value, 8192 );
@@ -2181,7 +1687,7 @@
2181
1687
  input = strTrim(input);
2182
1688
  if (input.length > maxLength) {
2183
1689
  inputTrunc = input.substring(0, maxLength);
2184
- _throwInternal(logger, 2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
1690
+ logger && logger.throwInternal(LoggingSeverity.WARNING, _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
2185
1691
  }
2186
1692
  }
2187
1693
  return inputTrunc || input;
@@ -2191,22 +1697,21 @@
2191
1697
  return s.substr(s.length - 3);
2192
1698
  }
2193
1699
 
2194
- var strEmpty = "";
2195
1700
  function msToTimeSpan(totalms) {
2196
1701
  if (isNaN(totalms) || totalms < 0) {
2197
1702
  totalms = 0;
2198
1703
  }
2199
1704
  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;
1705
+ var ms = "" + totalms % 1000;
1706
+ var sec = "" + Math.floor(totalms / 1000) % 60;
1707
+ var min = "" + Math.floor(totalms / (1000 * 60)) % 60;
1708
+ var hour = "" + Math.floor(totalms / (1000 * 60 * 60)) % 24;
2204
1709
  var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
2205
1710
  ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
2206
1711
  sec = sec.length < 2 ? "0" + sec : sec;
2207
1712
  min = min.length < 2 ? "0" + min : min;
2208
1713
  hour = hour.length < 2 ? "0" + hour : hour;
2209
- return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
1714
+ return (days > 0 ? days + "." : "") + hour + ":" + min + ":" + sec + "." + ms;
2210
1715
  }
2211
1716
  function getExtensionByName(extensions, identifier) {
2212
1717
  var extension = null;
@@ -2221,15 +1726,17 @@
2221
1726
 
2222
1727
  var strNotSpecified = "not_specified";
2223
1728
 
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
- });
1729
+ var StorageType;
1730
+ (function (StorageType) {
1731
+ StorageType[StorageType["LocalStorage"] = 0] = "LocalStorage";
1732
+ StorageType[StorageType["SessionStorage"] = 1] = "SessionStorage";
1733
+ })(StorageType || (StorageType = {}));
1734
+ var DistributedTracingModes;
1735
+ (function (DistributedTracingModes) {
1736
+ DistributedTracingModes[DistributedTracingModes["AI"] = 0] = "AI";
1737
+ DistributedTracingModes[DistributedTracingModes["AI_AND_W3C"] = 1] = "AI_AND_W3C";
1738
+ DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
1739
+ })(DistributedTracingModes || (DistributedTracingModes = {}));
2233
1740
 
2234
1741
  var _canUseLocalStorage = undefined;
2235
1742
  function _getLocalStorageObject() {
@@ -2256,8 +1763,8 @@
2256
1763
  }
2257
1764
  return null;
2258
1765
  }
2259
- function utlCanUseLocalStorage(reset) {
2260
- if (reset || _canUseLocalStorage === undefined) {
1766
+ function utlCanUseLocalStorage() {
1767
+ if (_canUseLocalStorage === undefined) {
2261
1768
  _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
2262
1769
  }
2263
1770
  return _canUseLocalStorage;
@@ -2270,7 +1777,7 @@
2270
1777
  }
2271
1778
  catch (e) {
2272
1779
  _canUseLocalStorage = false;
2273
- _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
1780
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2274
1781
  }
2275
1782
  }
2276
1783
  return null;
@@ -2284,7 +1791,7 @@
2284
1791
  }
2285
1792
  catch (e) {
2286
1793
  _canUseLocalStorage = false;
2287
- _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
1794
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2288
1795
  }
2289
1796
  }
2290
1797
  return false;
@@ -2298,7 +1805,7 @@
2298
1805
  }
2299
1806
  catch (e) {
2300
1807
  _canUseLocalStorage = false;
2301
- _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
1808
+ logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2302
1809
  }
2303
1810
  }
2304
1811
  return false;
@@ -2600,7 +2107,7 @@
2600
2107
  return Device;
2601
2108
  }());
2602
2109
 
2603
- var Version = "2.7.5-nightly.2204-03";
2110
+ var Version = "2.7.6";
2604
2111
  var Internal = /** @class */ (function () {
2605
2112
  function Internal(config) {
2606
2113
  this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + Version;