@microsoft/applicationinsights-properties-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-04

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 +949 -471
  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 +110 -56
  7. package/dist/applicationinsights-properties-js.d.ts +1 -1
  8. package/dist/applicationinsights-properties-js.js +949 -471
  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 +4 -4
  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.8.0-nightly.2202-06
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.8.0-nightly.2204-04
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -62,7 +62,9 @@
62
62
  (getGlobal() || {})["Reflect"];
63
63
  var extendStaticsFn = function (d, b) {
64
64
  extendStaticsFn = ObjClass["setPrototypeOf"] ||
65
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
65
+ ({ __proto__: [] } instanceof Array && function (d, b) {
66
+ d.__proto__ = b;
67
+ }) ||
66
68
  function (d, b) {
67
69
  for (var p in b) {
68
70
  if (b[strShimHasOwnProperty](p)) {
@@ -77,7 +79,9 @@
77
79
  throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
78
80
  }
79
81
  extendStaticsFn(d, b);
80
- function __() { this.constructor = d; }
82
+ function __() {
83
+ this.constructor = d;
84
+ }
81
85
  d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
82
86
  }
83
87
 
@@ -96,11 +100,11 @@
96
100
  var DynAllowInstChkTag = DynInstChkTag;
97
101
  var DynProtoDefaultOptions = '_dfOpts';
98
102
  var UnknownValue = '_unknown_';
99
- var str__Proto = "__proto__";
103
+ var str__Proto$1 = "__proto__";
100
104
  var strUseBaseInst = 'useBaseInst';
101
105
  var strSetInstFuncs = 'setInstFuncs';
102
106
  var Obj = Object;
103
- var _objGetPrototypeOf = Obj["getPrototypeOf"];
107
+ var _objGetPrototypeOf$1 = Obj["getPrototypeOf"];
104
108
  var _dynamicNames = 0;
105
109
  function _hasOwnProperty(obj, prop) {
106
110
  return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
@@ -111,12 +115,12 @@
111
115
  function _isObjectArrayOrFunctionPrototype(target) {
112
116
  return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
113
117
  }
114
- function _getObjProto(target) {
118
+ function _getObjProto$1(target) {
115
119
  if (target) {
116
- if (_objGetPrototypeOf) {
117
- return _objGetPrototypeOf(target);
120
+ if (_objGetPrototypeOf$1) {
121
+ return _objGetPrototypeOf$1(target);
118
122
  }
119
- var newProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
123
+ var newProto = target[str__Proto$1] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
120
124
  if (newProto) {
121
125
  return newProto;
122
126
  }
@@ -182,16 +186,16 @@
182
186
  _forEachProp(instFuncs, function (name) {
183
187
  baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
184
188
  });
185
- var baseProto = _getObjProto(classProto);
189
+ var baseProto = _getObjProto$1(classProto);
186
190
  var visited = [];
187
191
  while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
188
192
  _forEachProp(baseProto, function (name) {
189
- if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
193
+ if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf$1)) {
190
194
  baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
191
195
  }
192
196
  });
193
197
  visited.push(baseProto);
194
- baseProto = _getObjProto(baseProto);
198
+ baseProto = _getObjProto$1(baseProto);
195
199
  }
196
200
  return baseFuncs;
197
201
  }
@@ -205,7 +209,7 @@
205
209
  }
206
210
  if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
207
211
  var canAddInst = !_hasOwnProperty(target, funcName);
208
- var objProto = _getObjProto(target);
212
+ var objProto = _getObjProto$1(target);
209
213
  var visited = [];
210
214
  while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
211
215
  var protoFunc = objProto[funcName];
@@ -214,7 +218,7 @@
214
218
  break;
215
219
  }
216
220
  visited.push(objProto);
217
- objProto = _getObjProto(objProto);
221
+ objProto = _getObjProto$1(objProto);
218
222
  }
219
223
  try {
220
224
  if (canAddInst) {
@@ -232,7 +236,7 @@
232
236
  function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
233
237
  var protoFunc = proto[funcName];
234
238
  if (protoFunc === currentDynProtoProxy) {
235
- protoFunc = _getObjProto(proto)[funcName];
239
+ protoFunc = _getObjProto$1(proto)[funcName];
236
240
  }
237
241
  if (typeof protoFunc !== strFunction) {
238
242
  _throwTypeError("[" + funcName + "] is not a " + strFunction);
@@ -266,15 +270,15 @@
266
270
  }
267
271
  }
268
272
  function _checkPrototype(classProto, thisTarget) {
269
- if (_objGetPrototypeOf) {
273
+ if (_objGetPrototypeOf$1) {
270
274
  var visited = [];
271
- var thisProto = _getObjProto(thisTarget);
275
+ var thisProto = _getObjProto$1(thisTarget);
272
276
  while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
273
277
  if (thisProto === classProto) {
274
278
  return true;
275
279
  }
276
280
  visited.push(thisProto);
277
- thisProto = _getObjProto(thisProto);
281
+ thisProto = _getObjProto$1(thisProto);
278
282
  }
279
283
  }
280
284
  return false;
@@ -310,7 +314,7 @@
310
314
  var instFuncs = _getInstanceFuncs(target);
311
315
  var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
312
316
  delegateFunc(target, baseFuncs);
313
- var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
317
+ var setInstanceFunc = !!_objGetPrototypeOf$1 && !!perfOptions[strSetInstFuncs];
314
318
  if (setInstanceFunc && options) {
315
319
  setInstanceFunc = !!options[strSetInstFuncs];
316
320
  }
@@ -322,101 +326,23 @@
322
326
  };
323
327
  dynamicProto[DynProtoDefaultOptions] = perfDefaults;
324
328
 
325
- var LoggingSeverity;
326
- (function (LoggingSeverity) {
327
- LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
328
- LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
329
- })(LoggingSeverity || (LoggingSeverity = {}));
330
- var _InternalMessageId = {
331
- BrowserDoesNotSupportLocalStorage: 0,
332
- BrowserCannotReadLocalStorage: 1,
333
- BrowserCannotReadSessionStorage: 2,
334
- BrowserCannotWriteLocalStorage: 3,
335
- BrowserCannotWriteSessionStorage: 4,
336
- BrowserFailedRemovalFromLocalStorage: 5,
337
- BrowserFailedRemovalFromSessionStorage: 6,
338
- CannotSendEmptyTelemetry: 7,
339
- ClientPerformanceMathError: 8,
340
- ErrorParsingAISessionCookie: 9,
341
- ErrorPVCalc: 10,
342
- ExceptionWhileLoggingError: 11,
343
- FailedAddingTelemetryToBuffer: 12,
344
- FailedMonitorAjaxAbort: 13,
345
- FailedMonitorAjaxDur: 14,
346
- FailedMonitorAjaxOpen: 15,
347
- FailedMonitorAjaxRSC: 16,
348
- FailedMonitorAjaxSend: 17,
349
- FailedMonitorAjaxGetCorrelationHeader: 18,
350
- FailedToAddHandlerForOnBeforeUnload: 19,
351
- FailedToSendQueuedTelemetry: 20,
352
- FailedToReportDataLoss: 21,
353
- FlushFailed: 22,
354
- MessageLimitPerPVExceeded: 23,
355
- MissingRequiredFieldSpecification: 24,
356
- NavigationTimingNotSupported: 25,
357
- OnError: 26,
358
- SessionRenewalDateIsZero: 27,
359
- SenderNotInitialized: 28,
360
- StartTrackEventFailed: 29,
361
- StopTrackEventFailed: 30,
362
- StartTrackFailed: 31,
363
- StopTrackFailed: 32,
364
- TelemetrySampledAndNotSent: 33,
365
- TrackEventFailed: 34,
366
- TrackExceptionFailed: 35,
367
- TrackMetricFailed: 36,
368
- TrackPVFailed: 37,
369
- TrackPVFailedCalc: 38,
370
- TrackTraceFailed: 39,
371
- TransmissionFailed: 40,
372
- FailedToSetStorageBuffer: 41,
373
- FailedToRestoreStorageBuffer: 42,
374
- InvalidBackendResponse: 43,
375
- FailedToFixDepricatedValues: 44,
376
- InvalidDurationValue: 45,
377
- TelemetryEnvelopeInvalid: 46,
378
- CreateEnvelopeError: 47,
379
- CannotSerializeObject: 48,
380
- CannotSerializeObjectNonSerializable: 49,
381
- CircularReferenceDetected: 50,
382
- ClearAuthContextFailed: 51,
383
- ExceptionTruncated: 52,
384
- IllegalCharsInName: 53,
385
- ItemNotInArray: 54,
386
- MaxAjaxPerPVExceeded: 55,
387
- MessageTruncated: 56,
388
- NameTooLong: 57,
389
- SampleRateOutOfRange: 58,
390
- SetAuthContextFailed: 59,
391
- SetAuthContextFailedAccountName: 60,
392
- StringValueTooLong: 61,
393
- StartCalledMoreThanOnce: 62,
394
- StopCalledWithoutStart: 63,
395
- TelemetryInitializerFailed: 64,
396
- TrackArgumentsNotSpecified: 65,
397
- UrlTooLong: 66,
398
- SessionStorageBufferFull: 67,
399
- CannotAccessCookie: 68,
400
- IdTooLong: 69,
401
- InvalidEvent: 70,
402
- FailedMonitorAjaxSetRequestHeader: 71,
403
- SendBrowserInfoOnUserInit: 72,
404
- PluginException: 73,
405
- NotificationException: 74,
406
- SnippetScriptLoadFailure: 99,
407
- InvalidInstrumentationKey: 100,
408
- CannotParseAiBlobValue: 101,
409
- InvalidContentBlob: 102,
410
- TrackPageActionEventFailed: 103,
411
- FailedAddingCustomDefinedRequestContext: 104,
412
- InMemoryStorageBufferFull: 105
413
- };
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";
414
337
 
415
338
  var strToISOString = "toISOString";
416
339
  var cStrEndsWith = "endsWith";
417
340
  var cStrTrim = "trim";
418
341
  var strToString = "toString";
419
- var _objDefineProperty = ObjDefineProperty;
342
+ var str__Proto = "__proto__";
343
+ var strConstructor = "constructor";
344
+ var _objDefineProperty$1 = ObjDefineProperty;
345
+ var _objFreeze = ObjClass.freeze;
420
346
  var _objKeys = ObjClass.keys;
421
347
  var StringProto = String[strShimPrototype];
422
348
  var _strTrim = StringProto[cStrTrim];
@@ -426,7 +352,23 @@
426
352
  var _isArray = Array.isArray;
427
353
  var _objToString = ObjProto[strToString];
428
354
  var _fnToString = ObjHasOwnProperty[strToString];
429
- _fnToString.call(ObjClass);
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
+ }
430
372
  function isUndefined(value) {
431
373
  return value === undefined || typeof value === strShimUndefined;
432
374
  }
@@ -442,6 +384,19 @@
442
384
  function isFunction(value) {
443
385
  return !!(value && typeof value === strShimFunction);
444
386
  }
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
+ }
445
400
  function objForEachKey(target, callbackfn) {
446
401
  if (target) {
447
402
  for (var prop in target) {
@@ -490,6 +445,25 @@
490
445
  function isString(value) {
491
446
  return typeof value === "string";
492
447
  }
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
+ }
493
467
  function toISOString(date) {
494
468
  if (date) {
495
469
  return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
@@ -569,7 +543,7 @@
569
543
  return result;
570
544
  }
571
545
  function objDefineAccessors(target, prop, getProp, setProp) {
572
- if (_objDefineProperty) {
546
+ if (_objDefineProperty$1) {
573
547
  try {
574
548
  var descriptor = {
575
549
  enumerable: true,
@@ -581,7 +555,7 @@
581
555
  if (setProp) {
582
556
  descriptor.set = setProp;
583
557
  }
584
- _objDefineProperty(target, prop, descriptor);
558
+ _objDefineProperty$1(target, prop, descriptor);
585
559
  return true;
586
560
  }
587
561
  catch (e) {
@@ -589,6 +563,10 @@
589
563
  }
590
564
  return false;
591
565
  }
566
+ function _doNothing(value) {
567
+ return value;
568
+ }
569
+ var objFreeze = _objFreeze || _doNothing;
592
570
  function dateNow() {
593
571
  var dt = Date;
594
572
  return dt.now ? dt.now() : new dt().getTime();
@@ -597,7 +575,7 @@
597
575
  if (isError(object)) {
598
576
  return object.name;
599
577
  }
600
- return "";
578
+ return strEmpty$1;
601
579
  }
602
580
  function setValue(target, field, value, valChk, srcChk) {
603
581
  var theValue = value;
@@ -627,6 +605,36 @@
627
605
  function isTruthy(value) {
628
606
  return !!value;
629
607
  }
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
+ }
630
638
  function createClassFromInterface(defaults) {
631
639
  return /** @class */ (function () {
632
640
  function class_1() {
@@ -640,6 +648,61 @@
640
648
  return class_1;
641
649
  }());
642
650
  }
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
+ }
643
706
 
644
707
  var strWindow = "window";
645
708
  var strDocument = "document";
@@ -722,14 +785,14 @@
722
785
  var nav = getNavigator();
723
786
  if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
724
787
  _navUserAgentCheck = nav.userAgent;
725
- var userAgent = (_navUserAgentCheck || "").toLowerCase();
788
+ var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
726
789
  _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
727
790
  }
728
791
  return _isTrident;
729
792
  }
730
793
  function dumpObj(object) {
731
794
  var objectTypeDump = Object[strShimPrototype].toString.call(object);
732
- var propertyValueDump = "";
795
+ var propertyValueDump = strEmpty$1;
733
796
  if (objectTypeDump === "[object Error]") {
734
797
  propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
735
798
  }
@@ -762,9 +825,9 @@
762
825
  var strWarnToConsole = "warnToConsole";
763
826
  function _sanitizeDiagnosticText(text) {
764
827
  if (text) {
765
- return "\"" + text.replace(/\"/g, "") + "\"";
828
+ return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
766
829
  }
767
- return "";
830
+ return strEmpty$1;
768
831
  }
769
832
  function _logToConsole(func, message) {
770
833
  var theConsole = getConsole();
@@ -786,12 +849,12 @@
786
849
  _self.message =
787
850
  (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
788
851
  msgId;
789
- var strProps = "";
852
+ var strProps = strEmpty$1;
790
853
  if (hasJSON()) {
791
854
  strProps = getJSON().stringify(properties);
792
855
  }
793
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : "") +
794
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : "");
856
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
857
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
795
858
  _self.message += diagnosticText;
796
859
  }
797
860
  _InternalLogMessage.dataType = "MessageData";
@@ -821,7 +884,7 @@
821
884
  throw message;
822
885
  }
823
886
  else {
824
- var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
887
+ var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
825
888
  if (!isUndefined(message.message)) {
826
889
  var logLevel = _self.consoleLoggingLevel();
827
890
  if (isUserAct) {
@@ -839,7 +902,7 @@
839
902
  _self.logInternalMessage(severity, message);
840
903
  }
841
904
  else {
842
- _debugExtMsg("throw" + (severity === LoggingSeverity.CRITICAL ? "Critical" : "Warning"), message);
905
+ _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
843
906
  }
844
907
  }
845
908
  };
@@ -871,13 +934,13 @@
871
934
  if (severity <= _self.telemetryLoggingLevel()) {
872
935
  _self.queue.push(message);
873
936
  _messageCount++;
874
- _debugExtMsg((severity === LoggingSeverity.CRITICAL ? "error" : "warn"), message);
937
+ _debugExtMsg((severity === 1 ? "error" : "warn"), message);
875
938
  }
876
939
  if (_messageCount === _self.maxInternalMessageLimit()) {
877
940
  var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
878
- var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
941
+ var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
879
942
  _self.queue.push(throttleMessage);
880
- if (severity === LoggingSeverity.CRITICAL) {
943
+ if (severity === 1 ) {
881
944
  _self.errorToConsole(throttleLimitMessage);
882
945
  }
883
946
  else {
@@ -906,6 +969,10 @@
906
969
  }
907
970
  return DiagnosticLogger;
908
971
  }());
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
+ }
909
976
 
910
977
  var strExecutionContextKey = "ctx";
911
978
  var PerfEvent = /** @class */ (function () {
@@ -1019,252 +1086,495 @@
1019
1086
  return func();
1020
1087
  }
1021
1088
 
1022
- var TelemetryPluginChain = /** @class */ (function () {
1023
- function TelemetryPluginChain(plugin, defItemCtx) {
1024
- var _self = this;
1025
- var _nextProxy = null;
1026
- var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
1027
- var _hasSetNext = isFunction(plugin.setNextPlugin);
1028
- _self._hasRun = false;
1029
- _self.getPlugin = function () {
1030
- return plugin;
1031
- };
1032
- _self.getNext = function () {
1033
- return _nextProxy;
1034
- };
1035
- _self.setNext = function (nextPlugin) {
1036
- _nextProxy = nextPlugin;
1037
- };
1038
- _self.processTelemetry = function (env, itemCtx) {
1039
- if (!itemCtx) {
1040
- itemCtx = defItemCtx;
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.8.0-nightly.2204-04";
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
+ }
1041
1223
  }
1042
- var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
1043
- doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
1044
- if (plugin && _hasProcessTelemetry) {
1045
- _self._hasRun = true;
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) {
1046
1300
  try {
1047
- itemCtx.setNext(_nextProxy);
1048
- if (_hasSetNext) {
1049
- plugin.setNextPlugin(_nextProxy);
1050
- }
1051
- _nextProxy && (_nextProxy._hasRun = false);
1052
- plugin.processTelemetry(env, itemCtx);
1301
+ completeDetails.func.call(completeDetails.self, completeDetails.args);
1053
1302
  }
1054
- catch (error) {
1055
- var hasRun = _nextProxy && _nextProxy._hasRun;
1056
- if (!_nextProxy || !hasRun) {
1057
- itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
1058
- }
1059
- if (_nextProxy && !hasRun) {
1060
- _nextProxy.processTelemetry(env, itemCtx);
1061
- }
1303
+ catch (e) {
1304
+ _throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1062
1305
  }
1063
- }
1064
- else if (_nextProxy) {
1065
- _self._hasRun = true;
1066
- _nextProxy.processTelemetry(env, itemCtx);
1067
- }
1068
- }, function () { return ({ item: env }); }, !(env.sync));
1069
- };
1306
+ });
1307
+ _onComplete = [];
1308
+ }
1309
+ }
1310
+ return nextProxy;
1070
1311
  }
1071
- return TelemetryPluginChain;
1072
- }());
1073
-
1074
- function _createProxyChain(plugins, itemCtx) {
1075
- var proxies = [];
1076
- if (plugins && plugins.length > 0) {
1077
- var lastProxy = null;
1078
- for (var idx = 0; idx < plugins.length; idx++) {
1079
- var thePlugin = plugins[idx];
1080
- if (thePlugin && isFunction(thePlugin.processTelemetry)) {
1081
- var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
1082
- proxies.push(newProxy);
1083
- if (lastProxy) {
1084
- lastProxy.setNext(newProxy);
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
+ });
1085
1337
  }
1086
- lastProxy = newProxy;
1087
1338
  }
1088
1339
  }
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;
1089
1353
  }
1090
- return proxies.length > 0 ? proxies[0] : null;
1091
- }
1092
- function _copyProxyChain(proxy, itemCtx, startAt) {
1093
- var plugins = [];
1094
- var add = startAt ? false : true;
1095
- if (proxy) {
1096
- while (proxy) {
1097
- var thePlugin = proxy.getPlugin();
1098
- if (add || thePlugin === startAt) {
1099
- add = true;
1100
- plugins.push(thePlugin);
1354
+ function _iterateChain(cb) {
1355
+ var nextPlugin;
1356
+ while (!!(nextPlugin = context._next())) {
1357
+ var plugin = nextPlugin.getPlugin();
1358
+ if (plugin) {
1359
+ cb(plugin);
1101
1360
  }
1102
- proxy = proxy.getNext();
1103
1361
  }
1104
1362
  }
1105
- if (!add) {
1106
- plugins.push(startAt);
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);
1107
1398
  }
1108
- return _createProxyChain(plugins, itemCtx);
1399
+ context.processNext = _processNext;
1400
+ context.createNew = _createNew;
1401
+ return context;
1109
1402
  }
1110
- function _copyPluginChain(srcPlugins, itemCtx, startAt) {
1111
- var plugins = srcPlugins;
1112
- var add = false;
1113
- if (startAt && srcPlugins) {
1114
- plugins = [];
1115
- arrForEach(srcPlugins, function (thePlugin) {
1116
- if (add || thePlugin === startAt) {
1117
- add = true;
1118
- plugins.push(thePlugin);
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);
1119
1410
  }
1120
1411
  });
1121
1412
  }
1122
- if (startAt && !add) {
1123
- if (!plugins) {
1124
- plugins = [];
1413
+ function _createNew(plugins, startAt) {
1414
+ if (plugins === void 0) { plugins = null; }
1415
+ if (isArray(plugins)) {
1416
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1125
1417
  }
1126
- plugins.push(startAt);
1418
+ return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
1127
1419
  }
1128
- return _createProxyChain(plugins, itemCtx);
1420
+ context.processNext = _processNext;
1421
+ context.createNew = _createNew;
1422
+ return context;
1129
1423
  }
1130
- var ProcessTelemetryContext = /** @class */ (function () {
1131
- function ProcessTelemetryContext(plugins, config, core, startAt) {
1132
- var _self = this;
1133
- var _nextProxy = null;
1134
- if (startAt !== null) {
1135
- if (plugins && isFunction(plugins.getPlugin)) {
1136
- _nextProxy = _copyProxyChain(plugins, _self, startAt || plugins.getPlugin());
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
1432
  }
1138
- else {
1139
- if (startAt) {
1140
- _nextProxy = _copyPluginChain(plugins, _self, startAt);
1433
+ if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
1434
+ var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
1435
+ if (!firstProxy) {
1436
+ firstProxy = newProxy;
1141
1437
  }
1142
- else if (isUndefined(startAt)) {
1143
- _nextProxy = _createProxyChain(plugins, _self);
1438
+ if (lastProxy_1) {
1439
+ lastProxy_1._setNext(newProxy);
1144
1440
  }
1441
+ lastProxy_1 = newProxy;
1145
1442
  }
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;
1146
1474
  }
1147
- _self.core = function () {
1148
- return core;
1149
- };
1150
- _self.diagLog = function () {
1151
- return safeGetLogger(core, config);
1152
- };
1153
- _self.getCfg = function () {
1154
- return config;
1155
- };
1156
- _self.getExtCfg = function (identifier, defaultValue) {
1157
- if (defaultValue === void 0) { defaultValue = {}; }
1158
- var theConfig;
1159
- if (config) {
1160
- var extConfig = config.extensionConfig;
1161
- if (extConfig && identifier) {
1162
- theConfig = extConfig[identifier];
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);
1163
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
+ }
1512
+ }
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;
1164
1522
  }
1165
- return (theConfig ? theConfig : defaultValue);
1166
- };
1167
- _self.getConfig = function (identifier, field, defaultValue) {
1168
- if (defaultValue === void 0) { defaultValue = false; }
1169
- var theValue;
1170
- var extConfig = _self.getExtCfg(identifier, null);
1171
- if (extConfig && !isNullOrUndefined(extConfig[field])) {
1172
- theValue = extConfig[field];
1173
- }
1174
- else if (config && !isNullOrUndefined(config[field])) {
1175
- theValue = config[field];
1523
+ var pluginState = _getPluginState(plugin);
1524
+ if (pluginState[strTeardown] || pluginState[strDisabled]) {
1525
+ return false;
1176
1526
  }
1177
- return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1178
- };
1179
- _self.hasNext = function () {
1180
- return _nextProxy != null;
1181
- };
1182
- _self.getNext = function () {
1183
- return _nextProxy;
1184
- };
1185
- _self.setNext = function (nextPlugin) {
1186
- _nextProxy = nextPlugin;
1187
- };
1188
- _self.processNext = function (env) {
1189
- var nextPlugin = _nextProxy;
1190
- if (nextPlugin) {
1191
- _nextProxy = nextPlugin.getNext();
1192
- nextPlugin.processTelemetry(env, _self);
1527
+ if (hasSetNext) {
1528
+ plugin.setNextPlugin(nextProxy);
1193
1529
  }
1194
- };
1195
- _self.createNew = function (plugins, startAt) {
1196
- if (plugins === void 0) { plugins = null; }
1197
- return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
1198
- };
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
+ }
1199
1536
  }
1200
- return ProcessTelemetryContext;
1201
- }());
1202
-
1203
- var strExtensionConfig = "extensionConfig";
1204
-
1205
- var strGetPlugin = "getPlugin";
1206
- var BaseTelemetryPlugin = /** @class */ (function () {
1207
- function BaseTelemetryPlugin() {
1208
- var _self = this;
1209
- var _isinitialized = false;
1210
- var _rootCtx = null;
1211
- var _nextPlugin = null;
1212
- _self.core = null;
1213
- _self.diagLog = function (itemCtx) {
1214
- return _self._getTelCtx(itemCtx).diagLog();
1215
- };
1216
- _self.isInitialized = function () {
1217
- return _isinitialized;
1218
- };
1219
- _self.setInitialized = function (isInitialized) {
1220
- _isinitialized = isInitialized;
1221
- };
1222
- _self.setNextPlugin = function (next) {
1223
- _nextPlugin = next;
1224
- };
1225
- _self.processNext = function (env, itemCtx) {
1226
- if (itemCtx) {
1227
- itemCtx.processNext(env);
1228
- }
1229
- else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
1230
- _nextPlugin.processTelemetry(env, null);
1231
- }
1232
- };
1233
- _self._getTelCtx = function (currentCtx) {
1234
- if (currentCtx === void 0) { currentCtx = null; }
1235
- var itemCtx = currentCtx;
1236
- if (!itemCtx) {
1237
- var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);
1238
- if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1239
- itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
1240
- }
1241
- else {
1242
- itemCtx = rootCtx.createNew(null, _nextPlugin);
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
+ }
1243
1550
  }
1244
1551
  }
1245
- return itemCtx;
1246
- };
1247
- _self._baseTelInit = function (config, core, extensions, pluginChain) {
1248
- if (config) {
1249
- setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
1250
- }
1251
- if (!pluginChain && core) {
1252
- pluginChain = core.getProcessTelContext().getNext();
1253
- }
1254
- var nextPlugin = _nextPlugin;
1255
- if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1256
- nextPlugin = _nextPlugin[strGetPlugin]();
1552
+ return hasRun;
1553
+ }
1554
+ if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
1555
+ unloadCtx.processNext(unloadState);
1556
+ }
1557
+ }
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
+ }
1568
+ }
1257
1569
  }
1258
- _self.core = core;
1259
- _rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
1260
- _isinitialized = true;
1261
- };
1570
+ return hasRun;
1571
+ }
1572
+ if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
1573
+ updateCtx.processNext(updateState);
1574
+ }
1262
1575
  }
1263
- BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
1264
- this._baseTelInit(config, core, extensions, pluginChain);
1265
- };
1266
- return BaseTelemetryPlugin;
1267
- }());
1576
+ return objFreeze(proxyChain);
1577
+ }
1268
1578
 
1269
1579
  var strToGMTString = "toGMTString";
1270
1580
  var strToUTCString = "toUTCString";
@@ -1274,7 +1584,6 @@
1274
1584
  var strIsCookieUseDisabled = "isCookieUseDisabled";
1275
1585
  var strDisableCookiesUsage = "disableCookiesUsage";
1276
1586
  var strConfigCookieMgr = "_ckMgr";
1277
- var strEmpty = "";
1278
1587
  var _supportsCookies = null;
1279
1588
  var _allowUaSameSite = null;
1280
1589
  var _parsedCookieValue = null;
@@ -1351,7 +1660,7 @@
1351
1660
  var result = false;
1352
1661
  if (_isMgrEnabled(cookieMgr)) {
1353
1662
  var values = {};
1354
- var theValue = strTrim(value || strEmpty);
1663
+ var theValue = strTrim(value || strEmpty$1);
1355
1664
  var idx = theValue.indexOf(";");
1356
1665
  if (idx !== -1) {
1357
1666
  theValue = strTrim(value.substring(0, idx));
@@ -1366,11 +1675,11 @@
1366
1675
  if (expireMs > 0) {
1367
1676
  var expiry = new Date();
1368
1677
  expiry.setTime(expireMs);
1369
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
1678
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty$1, isTruthy);
1370
1679
  }
1371
1680
  }
1372
1681
  if (!_isIE) {
1373
- setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
1682
+ setValue(values, "max-age", strEmpty$1 + maxAgeSec, null, isUndefined);
1374
1683
  }
1375
1684
  }
1376
1685
  var location_1 = getLocation();
@@ -1391,7 +1700,7 @@
1391
1700
  return result;
1392
1701
  },
1393
1702
  get: function (name) {
1394
- var value = strEmpty;
1703
+ var value = strEmpty$1;
1395
1704
  if (_isMgrEnabled(cookieMgr)) {
1396
1705
  value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
1397
1706
  }
@@ -1416,7 +1725,7 @@
1416
1725
  values["max-age"] = "0";
1417
1726
  }
1418
1727
  var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
1419
- delCookie(name, _formatCookieValue(strEmpty, values));
1728
+ delCookie(name, _formatCookieValue(strEmpty$1, values));
1420
1729
  result = true;
1421
1730
  }
1422
1731
  return result;
@@ -1433,7 +1742,7 @@
1433
1742
  _supportsCookies = doc[strCookie] !== undefined;
1434
1743
  }
1435
1744
  catch (e) {
1436
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotAccessCookie, "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1745
+ _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1437
1746
  }
1438
1747
  }
1439
1748
  return _supportsCookies;
@@ -1443,7 +1752,7 @@
1443
1752
  if (theValue && theValue.length) {
1444
1753
  var parts = strTrim(theValue).split(";");
1445
1754
  arrForEach(parts, function (thePart) {
1446
- thePart = strTrim(thePart || strEmpty);
1755
+ thePart = strTrim(thePart || strEmpty$1);
1447
1756
  if (thePart) {
1448
1757
  var idx = thePart.indexOf("=");
1449
1758
  if (idx === -1) {
@@ -1464,21 +1773,21 @@
1464
1773
  return null;
1465
1774
  }
1466
1775
  function _formatCookieValue(value, values) {
1467
- var cookieValue = value || strEmpty;
1776
+ var cookieValue = value || strEmpty$1;
1468
1777
  objForEachKey(values, function (name, theValue) {
1469
- cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
1778
+ cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty$1);
1470
1779
  });
1471
1780
  return cookieValue;
1472
1781
  }
1473
1782
  function _getCookieValue(name) {
1474
- var cookieValue = strEmpty;
1783
+ var cookieValue = strEmpty$1;
1475
1784
  if (_doc) {
1476
- var theCookie = _doc[strCookie] || strEmpty;
1785
+ var theCookie = _doc[strCookie] || strEmpty$1;
1477
1786
  if (_parsedCookieValue !== theCookie) {
1478
1787
  _cookieCache = _extractParts(theCookie);
1479
1788
  _parsedCookieValue = theCookie;
1480
1789
  }
1481
- cookieValue = strTrim(_cookieCache[name] || strEmpty);
1790
+ cookieValue = strTrim(_cookieCache[name] || strEmpty$1);
1482
1791
  }
1483
1792
  return cookieValue;
1484
1793
  }
@@ -1512,77 +1821,180 @@
1512
1821
  return false;
1513
1822
  }
1514
1823
 
1515
- var UInt32Mask = 0x100000000;
1516
- var MaxUInt32 = 0xffffffff;
1517
- var _mwcSeeded = false;
1518
- var _mwcW = 123456789;
1519
- var _mwcZ = 987654321;
1520
- function _mwcSeed(seedValue) {
1521
- if (seedValue < 0) {
1522
- seedValue >>>= 0;
1523
- }
1524
- _mwcW = (123456789 + seedValue) & MaxUInt32;
1525
- _mwcZ = (987654321 - seedValue) & MaxUInt32;
1526
- _mwcSeeded = true;
1527
- }
1528
- function _autoSeedMwc() {
1529
- try {
1530
- var now = dateNow() & 0x7fffffff;
1531
- _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1532
- }
1533
- catch (e) {
1534
- }
1535
- }
1536
- function random32(signed) {
1537
- var value;
1538
- var c = getCrypto() || getMsCrypto();
1539
- if (c && c.getRandomValues) {
1540
- value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1541
- }
1542
- else if (isIE()) {
1543
- if (!_mwcSeeded) {
1544
- _autoSeedMwc();
1824
+ var strExtensionConfig = "extensionConfig";
1825
+
1826
+ function createUnloadHandlerContainer() {
1827
+ var handlers = [];
1828
+ function _addHandler(handler) {
1829
+ if (handler) {
1830
+ handlers.push(handler);
1545
1831
  }
1546
- value = mwcRandom32() & MaxUInt32;
1547
- }
1548
- else {
1549
- value = Math.floor((UInt32Mask * Math.random()) | 0);
1550
- }
1551
- if (!signed) {
1552
- value >>>= 0;
1553
1832
  }
1554
- return value;
1555
- }
1556
- function mwcRandom32(signed) {
1557
- _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1558
- _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1559
- var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1560
- if (!signed) {
1561
- value >>>= 0;
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 = [];
1562
1843
  }
1563
- return value;
1844
+ return {
1845
+ add: _addHandler,
1846
+ run: _runHandlers
1847
+ };
1564
1848
  }
1565
1849
 
1566
- function newId(maxLength) {
1567
- if (maxLength === void 0) { maxLength = 22; }
1568
- var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1569
- var number = random32() >>> 0;
1570
- var chars = 0;
1571
- var result = "";
1572
- while (result.length < maxLength) {
1573
- chars++;
1574
- result += base64chars.charAt(number & 0x3F);
1575
- number >>>= 6;
1576
- if (chars === 5) {
1577
- number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1578
- chars = 0;
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();
1579
1990
  }
1580
1991
  }
1581
- return result;
1582
- }
1992
+ return BaseTelemetryPlugin;
1993
+ }());
1994
+
1583
1995
  function generateW3CId() {
1584
1996
  var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
1585
- var oct = "", tmp;
1997
+ var oct = strEmpty$1, tmp;
1586
1998
  for (var a = 0; a < 4; a++) {
1587
1999
  tmp = random32();
1588
2000
  oct +=
@@ -1599,6 +2011,95 @@
1599
2011
  return oct.substr(0, 8) + oct.substr(9, 4) + "4" + oct.substr(13, 3) + clockSequenceHi + oct.substr(16, 3) + oct.substr(19, 12);
1600
2012
  }
1601
2013
 
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
+
1602
2103
  function dataSanitizeKeyAndAddUniqueness(logger, key, map) {
1603
2104
  var origLength = key.length;
1604
2105
  var field = dataSanitizeKey(logger, key);
@@ -1619,7 +2120,7 @@
1619
2120
  name = strTrim(name.toString());
1620
2121
  if (name.length > 150 ) {
1621
2122
  nameTrunc = name.substring(0, 150 );
1622
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
2123
+ _throwInternal(logger, 2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
1623
2124
  }
1624
2125
  }
1625
2126
  return nameTrunc || name;
@@ -1632,7 +2133,7 @@
1632
2133
  value = strTrim(value);
1633
2134
  if (value.toString().length > maxLength) {
1634
2135
  valueTrunc = value.toString().substring(0, maxLength);
1635
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
2136
+ _throwInternal(logger, 2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
1636
2137
  }
1637
2138
  }
1638
2139
  return valueTrunc || value;
@@ -1649,7 +2150,7 @@
1649
2150
  value = getJSON().stringify(value);
1650
2151
  }
1651
2152
  catch (e) {
1652
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
2153
+ _throwInternal(logger, 2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
1653
2154
  }
1654
2155
  }
1655
2156
  value = dataSanitizeString(logger, value, 8192 );
@@ -1680,7 +2181,7 @@
1680
2181
  input = strTrim(input);
1681
2182
  if (input.length > maxLength) {
1682
2183
  inputTrunc = input.substring(0, maxLength);
1683
- logger && logger.throwInternal(LoggingSeverity.WARNING, _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
2184
+ _throwInternal(logger, 2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
1684
2185
  }
1685
2186
  }
1686
2187
  return inputTrunc || input;
@@ -1690,21 +2191,22 @@
1690
2191
  return s.substr(s.length - 3);
1691
2192
  }
1692
2193
 
2194
+ var strEmpty = "";
1693
2195
  function msToTimeSpan(totalms) {
1694
2196
  if (isNaN(totalms) || totalms < 0) {
1695
2197
  totalms = 0;
1696
2198
  }
1697
2199
  totalms = Math.round(totalms);
1698
- var ms = "" + totalms % 1000;
1699
- var sec = "" + Math.floor(totalms / 1000) % 60;
1700
- var min = "" + Math.floor(totalms / (1000 * 60)) % 60;
1701
- var hour = "" + Math.floor(totalms / (1000 * 60 * 60)) % 24;
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;
1702
2204
  var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
1703
2205
  ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
1704
2206
  sec = sec.length < 2 ? "0" + sec : sec;
1705
2207
  min = min.length < 2 ? "0" + min : min;
1706
2208
  hour = hour.length < 2 ? "0" + hour : hour;
1707
- return (days > 0 ? days + "." : "") + hour + ":" + min + ":" + sec + "." + ms;
2209
+ return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
1708
2210
  }
1709
2211
  function getExtensionByName(extensions, identifier) {
1710
2212
  var extension = null;
@@ -1719,17 +2221,15 @@
1719
2221
 
1720
2222
  var strNotSpecified = "not_specified";
1721
2223
 
1722
- var StorageType;
1723
- (function (StorageType) {
1724
- StorageType[StorageType["LocalStorage"] = 0] = "LocalStorage";
1725
- StorageType[StorageType["SessionStorage"] = 1] = "SessionStorage";
1726
- })(StorageType || (StorageType = {}));
1727
- var DistributedTracingModes;
1728
- (function (DistributedTracingModes) {
1729
- DistributedTracingModes[DistributedTracingModes["AI"] = 0] = "AI";
1730
- DistributedTracingModes[DistributedTracingModes["AI_AND_W3C"] = 1] = "AI_AND_W3C";
1731
- DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
1732
- })(DistributedTracingModes || (DistributedTracingModes = {}));
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
+ });
1733
2233
 
1734
2234
  var _canUseLocalStorage = undefined;
1735
2235
  function _getLocalStorageObject() {
@@ -1756,8 +2256,8 @@
1756
2256
  }
1757
2257
  return null;
1758
2258
  }
1759
- function utlCanUseLocalStorage() {
1760
- if (_canUseLocalStorage === undefined) {
2259
+ function utlCanUseLocalStorage(reset) {
2260
+ if (reset || _canUseLocalStorage === undefined) {
1761
2261
  _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
1762
2262
  }
1763
2263
  return _canUseLocalStorage;
@@ -1770,7 +2270,7 @@
1770
2270
  }
1771
2271
  catch (e) {
1772
2272
  _canUseLocalStorage = false;
1773
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2273
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
1774
2274
  }
1775
2275
  }
1776
2276
  return null;
@@ -1784,7 +2284,7 @@
1784
2284
  }
1785
2285
  catch (e) {
1786
2286
  _canUseLocalStorage = false;
1787
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2287
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
1788
2288
  }
1789
2289
  }
1790
2290
  return false;
@@ -1798,38 +2298,15 @@
1798
2298
  }
1799
2299
  catch (e) {
1800
2300
  _canUseLocalStorage = false;
1801
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2301
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
1802
2302
  }
1803
2303
  }
1804
2304
  return false;
1805
2305
  }
1806
2306
 
1807
- var EventData = /** @class */ (function () {
1808
- function EventData() {
1809
- this.ver = 2;
1810
- this.properties = {};
1811
- this.measurements = {};
1812
- }
1813
- return EventData;
1814
- }());
1815
-
1816
- var PageViewData = /** @class */ (function (_super) {
1817
- __extendsFn(PageViewData, _super);
1818
- function PageViewData() {
1819
- var _this = _super.call(this) || this;
1820
- _this.ver = 2;
1821
- _this.properties = {};
1822
- _this.measurements = {};
1823
- return _this;
1824
- }
1825
- return PageViewData;
1826
- }(EventData));
1827
-
1828
- var PageView = /** @class */ (function (_super) {
1829
- __extendsFn(PageView, _super);
2307
+ var PageView = /** @class */ (function () {
1830
2308
  function PageView(logger, name, url, durationMs, properties, measurements, id) {
1831
- var _this = _super.call(this) || this;
1832
- _this.aiDataContract = {
2309
+ this.aiDataContract = {
1833
2310
  ver: 1 ,
1834
2311
  name: 0 ,
1835
2312
  url: 0 ,
@@ -1838,20 +2315,21 @@
1838
2315
  measurements: 0 ,
1839
2316
  id: 0
1840
2317
  };
1841
- _this.id = dataSanitizeId(logger, id);
1842
- _this.url = dataSanitizeUrl(logger, url);
1843
- _this.name = dataSanitizeString(logger, name) || strNotSpecified;
2318
+ var _self = this;
2319
+ _self.ver = 2;
2320
+ _self.id = dataSanitizeId(logger, id);
2321
+ _self.url = dataSanitizeUrl(logger, url);
2322
+ _self.name = dataSanitizeString(logger, name) || strNotSpecified;
1844
2323
  if (!isNaN(durationMs)) {
1845
- _this.duration = msToTimeSpan(durationMs);
2324
+ _self.duration = msToTimeSpan(durationMs);
1846
2325
  }
1847
- _this.properties = dataSanitizeProperties(logger, properties);
1848
- _this.measurements = dataSanitizeMeasurements(logger, measurements);
1849
- return _this;
2326
+ _self.properties = dataSanitizeProperties(logger, properties);
2327
+ _self.measurements = dataSanitizeMeasurements(logger, measurements);
1850
2328
  }
1851
2329
  PageView.envelopeType = "Microsoft.ApplicationInsights.{0}.Pageview";
1852
2330
  PageView.dataType = "PageviewData";
1853
2331
  return PageView;
1854
- }(PageViewData));
2332
+ }());
1855
2333
 
1856
2334
  function _aiNameFunc(baseName) {
1857
2335
  var aiName = "ai." + baseName + ".";
@@ -2100,7 +2578,7 @@
2100
2578
  return Device;
2101
2579
  }());
2102
2580
 
2103
- var Version = "2.8.0-nightly.2202-06";
2581
+ var Version = "2.8.0-nightly.2204-04";
2104
2582
  var Internal = /** @class */ (function () {
2105
2583
  function Internal(config) {
2106
2584
  this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + Version;