@microsoft/applicationinsights-properties-js 2.8.0-beta.2203-01 → 2.8.0-beta.2203-02

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -322,95 +322,13 @@
322
322
  };
323
323
  dynamicProto[DynProtoDefaultOptions] = perfDefaults;
324
324
 
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
- };
325
+ var strEmpty$1 = "";
326
+ var strSetNextPlugin = "setNextPlugin";
327
+ var strIsInitialized = "isInitialized";
328
+ var strTeardown = "teardown";
329
+ var strCore = "core";
330
+ var strDisabled = "disabled";
331
+ var strDoTeardown = "_doTeardown";
414
332
 
415
333
  var strToISOString = "toISOString";
416
334
  var cStrEndsWith = "endsWith";
@@ -418,7 +336,7 @@
418
336
  var strToString = "toString";
419
337
  var str__Proto = "__proto__";
420
338
  var strConstructor = "constructor";
421
- var _objDefineProperty = ObjDefineProperty;
339
+ var _objDefineProperty$1 = ObjDefineProperty;
422
340
  var _objFreeze = ObjClass.freeze;
423
341
  var _objKeys = ObjClass.keys;
424
342
  var StringProto = String[strShimPrototype];
@@ -430,6 +348,9 @@
430
348
  var _objToString = ObjProto[strToString];
431
349
  var _fnToString = ObjHasOwnProperty[strToString];
432
350
  var _objFunctionString = _fnToString.call(ObjClass);
351
+ var rCamelCase = /-([a-z])/g;
352
+ var rNormalizeInvalid = /([^\w\d_$])/g;
353
+ var rLeadingNumeric = /^(\d+[\w\d_$])/;
433
354
  var _objGetPrototypeOf = Object["getPrototypeOf"];
434
355
  function _getObjProto(target) {
435
356
  if (target) {
@@ -458,6 +379,19 @@
458
379
  function isFunction(value) {
459
380
  return !!(value && typeof value === strShimFunction);
460
381
  }
382
+ function normalizeJsName(name) {
383
+ var value = name;
384
+ if (value && isString(value)) {
385
+ value = value.replace(rCamelCase, function (_all, letter) {
386
+ return letter.toUpperCase();
387
+ });
388
+ value = value.replace(rNormalizeInvalid, "_");
389
+ value = value.replace(rLeadingNumeric, function (_all, match) {
390
+ return "_" + match;
391
+ });
392
+ }
393
+ return value;
394
+ }
461
395
  function objForEachKey(target, callbackfn) {
462
396
  if (target) {
463
397
  for (var prop in target) {
@@ -604,7 +538,7 @@
604
538
  return result;
605
539
  }
606
540
  function objDefineAccessors(target, prop, getProp, setProp) {
607
- if (_objDefineProperty) {
541
+ if (_objDefineProperty$1) {
608
542
  try {
609
543
  var descriptor = {
610
544
  enumerable: true,
@@ -616,7 +550,7 @@
616
550
  if (setProp) {
617
551
  descriptor.set = setProp;
618
552
  }
619
- _objDefineProperty(target, prop, descriptor);
553
+ _objDefineProperty$1(target, prop, descriptor);
620
554
  return true;
621
555
  }
622
556
  catch (e) {
@@ -636,7 +570,7 @@
636
570
  if (isError(object)) {
637
571
  return object.name;
638
572
  }
639
- return "";
573
+ return strEmpty$1;
640
574
  }
641
575
  function setValue(target, field, value, valChk, srcChk) {
642
576
  var theValue = value;
@@ -666,6 +600,9 @@
666
600
  function isTruthy(value) {
667
601
  return !!value;
668
602
  }
603
+ function throwError(message) {
604
+ throw new Error(message);
605
+ }
669
606
  function createClassFromInterface(defaults) {
670
607
  return /** @class */ (function () {
671
608
  function class_1() {
@@ -679,6 +616,17 @@
679
616
  return class_1;
680
617
  }());
681
618
  }
619
+ function createEnumStyle(values) {
620
+ var enumClass = {};
621
+ objForEachKey(values, function (field, value) {
622
+ enumClass[field] = value;
623
+ if (!isUndefined(enumClass[value])) {
624
+ throwError("Value: [" + value + "] already exists for " + field);
625
+ }
626
+ enumClass[value] = field;
627
+ });
628
+ return objFreeze(enumClass);
629
+ }
682
630
  function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
683
631
  var theArgs = arguments;
684
632
  var extended = theArgs[0] || {};
@@ -805,14 +753,14 @@
805
753
  var nav = getNavigator();
806
754
  if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
807
755
  _navUserAgentCheck = nav.userAgent;
808
- var userAgent = (_navUserAgentCheck || "").toLowerCase();
756
+ var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
809
757
  _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
810
758
  }
811
759
  return _isTrident;
812
760
  }
813
761
  function dumpObj(object) {
814
762
  var objectTypeDump = Object[strShimPrototype].toString.call(object);
815
- var propertyValueDump = "";
763
+ var propertyValueDump = strEmpty$1;
816
764
  if (objectTypeDump === "[object Error]") {
817
765
  propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
818
766
  }
@@ -845,9 +793,9 @@
845
793
  var strWarnToConsole = "warnToConsole";
846
794
  function _sanitizeDiagnosticText(text) {
847
795
  if (text) {
848
- return "\"" + text.replace(/\"/g, "") + "\"";
796
+ return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
849
797
  }
850
- return "";
798
+ return strEmpty$1;
851
799
  }
852
800
  function _logToConsole(func, message) {
853
801
  var theConsole = getConsole();
@@ -869,12 +817,12 @@
869
817
  _self.message =
870
818
  (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
871
819
  msgId;
872
- var strProps = "";
820
+ var strProps = strEmpty$1;
873
821
  if (hasJSON()) {
874
822
  strProps = getJSON().stringify(properties);
875
823
  }
876
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : "") +
877
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : "");
824
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
825
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
878
826
  _self.message += diagnosticText;
879
827
  }
880
828
  _InternalLogMessage.dataType = "MessageData";
@@ -904,7 +852,7 @@
904
852
  throw message;
905
853
  }
906
854
  else {
907
- var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
855
+ var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
908
856
  if (!isUndefined(message.message)) {
909
857
  var logLevel = _self.consoleLoggingLevel();
910
858
  if (isUserAct) {
@@ -922,7 +870,7 @@
922
870
  _self.logInternalMessage(severity, message);
923
871
  }
924
872
  else {
925
- _debugExtMsg("throw" + (severity === LoggingSeverity.CRITICAL ? "Critical" : "Warning"), message);
873
+ _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
926
874
  }
927
875
  }
928
876
  };
@@ -954,13 +902,13 @@
954
902
  if (severity <= _self.telemetryLoggingLevel()) {
955
903
  _self.queue.push(message);
956
904
  _messageCount++;
957
- _debugExtMsg((severity === LoggingSeverity.CRITICAL ? "error" : "warn"), message);
905
+ _debugExtMsg((severity === 1 ? "error" : "warn"), message);
958
906
  }
959
907
  if (_messageCount === _self.maxInternalMessageLimit()) {
960
908
  var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
961
- var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
909
+ var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
962
910
  _self.queue.push(throttleMessage);
963
- if (severity === LoggingSeverity.CRITICAL) {
911
+ if (severity === 1 ) {
964
912
  _self.errorToConsole(throttleLimitMessage);
965
913
  }
966
914
  else {
@@ -1102,6 +1050,151 @@
1102
1050
  return func();
1103
1051
  }
1104
1052
 
1053
+ var UInt32Mask = 0x100000000;
1054
+ var MaxUInt32 = 0xffffffff;
1055
+ var _mwcSeeded = false;
1056
+ var _mwcW = 123456789;
1057
+ var _mwcZ = 987654321;
1058
+ function _mwcSeed(seedValue) {
1059
+ if (seedValue < 0) {
1060
+ seedValue >>>= 0;
1061
+ }
1062
+ _mwcW = (123456789 + seedValue) & MaxUInt32;
1063
+ _mwcZ = (987654321 - seedValue) & MaxUInt32;
1064
+ _mwcSeeded = true;
1065
+ }
1066
+ function _autoSeedMwc() {
1067
+ try {
1068
+ var now = dateNow() & 0x7fffffff;
1069
+ _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1070
+ }
1071
+ catch (e) {
1072
+ }
1073
+ }
1074
+ function random32(signed) {
1075
+ var value = 0;
1076
+ var c = getCrypto() || getMsCrypto();
1077
+ if (c && c.getRandomValues) {
1078
+ value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1079
+ }
1080
+ if (value === 0 && isIE()) {
1081
+ if (!_mwcSeeded) {
1082
+ _autoSeedMwc();
1083
+ }
1084
+ value = mwcRandom32() & MaxUInt32;
1085
+ }
1086
+ if (value === 0) {
1087
+ value = Math.floor((UInt32Mask * Math.random()) | 0);
1088
+ }
1089
+ if (!signed) {
1090
+ value >>>= 0;
1091
+ }
1092
+ return value;
1093
+ }
1094
+ function mwcRandom32(signed) {
1095
+ _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1096
+ _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1097
+ var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1098
+ if (!signed) {
1099
+ value >>>= 0;
1100
+ }
1101
+ return value;
1102
+ }
1103
+ function newId(maxLength) {
1104
+ if (maxLength === void 0) { maxLength = 22; }
1105
+ var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1106
+ var number = random32() >>> 0;
1107
+ var chars = 0;
1108
+ var result = strEmpty$1;
1109
+ while (result.length < maxLength) {
1110
+ chars++;
1111
+ result += base64chars.charAt(number & 0x3F);
1112
+ number >>>= 6;
1113
+ if (chars === 5) {
1114
+ number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1115
+ chars = 0;
1116
+ }
1117
+ }
1118
+ return result;
1119
+ }
1120
+
1121
+ var _objDefineProperty = ObjDefineProperty;
1122
+ var version = "2.7.3";
1123
+ var instanceName = "." + newId(6);
1124
+ var _dataUid = 0;
1125
+ function _createAccessor(target, prop, value) {
1126
+ if (_objDefineProperty) {
1127
+ try {
1128
+ _objDefineProperty(target, prop, {
1129
+ value: value,
1130
+ enumerable: false,
1131
+ configurable: true
1132
+ });
1133
+ return true;
1134
+ }
1135
+ catch (e) {
1136
+ }
1137
+ }
1138
+ return false;
1139
+ }
1140
+ function _canAcceptData(target) {
1141
+ return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
1142
+ }
1143
+ function _getCache(data, target) {
1144
+ var theCache = target[data.id];
1145
+ if (!theCache) {
1146
+ theCache = {};
1147
+ try {
1148
+ if (_canAcceptData(target)) {
1149
+ if (!_createAccessor(target, data.id, theCache)) {
1150
+ target[data.id] = theCache;
1151
+ }
1152
+ }
1153
+ }
1154
+ catch (e) {
1155
+ }
1156
+ }
1157
+ return theCache;
1158
+ }
1159
+ function createUniqueNamespace(name, includeVersion) {
1160
+ if (includeVersion === void 0) { includeVersion = false; }
1161
+ return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
1162
+ }
1163
+ function createElmNodeData(name) {
1164
+ var data = {
1165
+ id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
1166
+ accept: function (target) {
1167
+ return _canAcceptData(target);
1168
+ },
1169
+ get: function (target, name, defValue, addDefault) {
1170
+ var theCache = target[data.id];
1171
+ if (!theCache) {
1172
+ if (addDefault) {
1173
+ theCache = _getCache(data, target);
1174
+ theCache[normalizeJsName(name)] = defValue;
1175
+ }
1176
+ return defValue;
1177
+ }
1178
+ return theCache[normalizeJsName(name)];
1179
+ },
1180
+ kill: function (target, name) {
1181
+ if (target && target[name]) {
1182
+ try {
1183
+ delete target[name];
1184
+ }
1185
+ catch (e) {
1186
+ }
1187
+ }
1188
+ }
1189
+ };
1190
+ return data;
1191
+ }
1192
+
1193
+ var pluginStateData = createElmNodeData("plugin");
1194
+ function _getPluginState(plugin) {
1195
+ return pluginStateData.get(plugin, "state", {}, true);
1196
+ }
1197
+
1105
1198
  var strTelemetryPluginChain = "TelemetryPluginChain";
1106
1199
  var strHasRunFlags = "_hasRun";
1107
1200
  var strGetTelCtx = "_getTelCtx";
@@ -1115,53 +1208,66 @@
1115
1208
  }
1116
1209
  return createTelemetryProxyChain([startAt], config, core);
1117
1210
  }
1118
- function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
1119
- var _nextProxy = null;
1120
- var _onComplete = null;
1121
- if (startAt) {
1122
- _nextProxy = _getNextProxyStart(telemetryChain, config, core, startAt);
1123
- }
1124
- else {
1125
- _nextProxy = telemetryChain;
1126
- }
1211
+ function _createInternalContext(telemetryChain, config, core, startAt) {
1212
+ var _nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
1213
+ var _onComplete = [];
1127
1214
  var context = {
1128
- core: function () {
1129
- return core;
1130
- },
1131
- diagLog: function () {
1132
- return safeGetLogger(core, config);
1133
- },
1134
- getCfg: function () {
1135
- return config;
1136
- },
1137
- getExtCfg: _getExtCfg,
1138
- getConfig: _getConfig,
1139
- hasNext: function () {
1140
- return _nextProxy != null;
1141
- },
1142
- getNext: function () {
1143
- return _nextProxy;
1144
- },
1145
- setNext: function (nextPlugin) {
1146
- _nextProxy = nextPlugin;
1147
- },
1148
- processNext: function (env) {
1149
- _processChain(function (nextPlugin) {
1150
- nextPlugin.processTelemetry(env, context);
1215
+ _next: _moveNext,
1216
+ ctx: {
1217
+ core: function () { return core; },
1218
+ diagLog: function () {
1219
+ return safeGetLogger(core, config);
1220
+ },
1221
+ getCfg: function () {
1222
+ return config;
1223
+ },
1224
+ getExtCfg: _getExtCfg,
1225
+ getConfig: _getConfig,
1226
+ hasNext: function () {
1227
+ return !!_nextProxy;
1228
+ },
1229
+ getNext: function () {
1230
+ return _nextProxy;
1231
+ },
1232
+ setNext: function (nextPlugin) {
1233
+ _nextProxy = nextPlugin;
1234
+ },
1235
+ iterate: _iterateChain,
1236
+ onComplete: _addOnComplete
1237
+ }
1238
+ };
1239
+ function _addOnComplete(onComplete, that) {
1240
+ var args = [];
1241
+ for (var _i = 2; _i < arguments.length; _i++) {
1242
+ args[_i - 2] = arguments[_i];
1243
+ }
1244
+ if (onComplete) {
1245
+ _onComplete.push({
1246
+ func: onComplete,
1247
+ self: !isUndefined(that) ? that : context.ctx,
1248
+ args: args
1151
1249
  });
1152
- },
1153
- iterate: _iterateChain,
1154
- createNew: function (plugins, startAt) {
1155
- if (plugins === void 0) { plugins = null; }
1156
- if (isArray(plugins)) {
1157
- plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1250
+ }
1251
+ }
1252
+ function _moveNext() {
1253
+ var nextProxy = _nextProxy;
1254
+ _nextProxy = nextProxy ? nextProxy.getNext() : null;
1255
+ if (!nextProxy) {
1256
+ var onComplete = _onComplete;
1257
+ if (onComplete && onComplete.length > 0) {
1258
+ arrForEach(onComplete, function (completeDetails) {
1259
+ try {
1260
+ completeDetails.func.call(completeDetails.self, completeDetails.args);
1261
+ }
1262
+ catch (e) {
1263
+ core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1264
+ }
1265
+ });
1266
+ _onComplete = [];
1158
1267
  }
1159
- return createProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
1160
- },
1161
- onComplete: function (onComplete) {
1162
- _onComplete = onComplete;
1163
1268
  }
1164
- };
1269
+ return nextProxy;
1270
+ }
1165
1271
  function _getExtCfg(identifier, defaultValue, mergeDefault) {
1166
1272
  if (defaultValue === void 0) { defaultValue = {}; }
1167
1273
  if (mergeDefault === void 0) { mergeDefault = 0 ; }
@@ -1204,29 +1310,53 @@
1204
1310
  }
1205
1311
  return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1206
1312
  }
1207
- function _processChain(cb) {
1208
- var nextPlugin = _nextProxy;
1209
- if (nextPlugin) {
1210
- _nextProxy = nextPlugin.getNext();
1211
- cb(nextPlugin);
1212
- }
1213
- else {
1214
- if (_onComplete) {
1215
- _onComplete();
1216
- _onComplete = null;
1313
+ function _iterateChain(cb) {
1314
+ var nextPlugin;
1315
+ while (!!(nextPlugin = context._next())) {
1316
+ var plugin = nextPlugin.getPlugin();
1317
+ if (plugin) {
1318
+ cb(plugin);
1217
1319
  }
1218
1320
  }
1219
1321
  }
1220
- function _iterateChain(cb) {
1221
- while (_nextProxy) {
1222
- _processChain(function (nextPlugin) {
1223
- var plugin = nextPlugin.getPlugin();
1224
- if (plugin) {
1225
- cb(plugin);
1226
- }
1227
- });
1322
+ return context;
1323
+ }
1324
+ function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
1325
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1326
+ var context = internalContext.ctx;
1327
+ function _processNext(env) {
1328
+ var nextPlugin = internalContext._next();
1329
+ nextPlugin && nextPlugin.processTelemetry(env, context);
1330
+ return !nextPlugin;
1331
+ }
1332
+ function _createNew(plugins, startAt) {
1333
+ if (plugins === void 0) { plugins = null; }
1334
+ if (isArray(plugins)) {
1335
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1336
+ }
1337
+ return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
1338
+ }
1339
+ context.processNext = _processNext;
1340
+ context.createNew = _createNew;
1341
+ return context;
1342
+ }
1343
+ function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
1344
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1345
+ var context = internalContext.ctx;
1346
+ function _processNext(unloadState) {
1347
+ var nextPlugin = internalContext._next();
1348
+ nextPlugin && nextPlugin.unload(context, unloadState);
1349
+ return !nextPlugin;
1350
+ }
1351
+ function _createNew(plugins, startAt) {
1352
+ if (plugins === void 0) { plugins = null; }
1353
+ if (isArray(plugins)) {
1354
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1228
1355
  }
1356
+ return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
1229
1357
  }
1358
+ context.processNext = _processNext;
1359
+ context.createNew = _createNew;
1230
1360
  return context;
1231
1361
  }
1232
1362
  function createTelemetryProxyChain(plugins, config, core, startAt) {
@@ -1274,32 +1404,35 @@
1274
1404
  return nextProxy;
1275
1405
  },
1276
1406
  processTelemetry: _processTelemetry,
1407
+ unload: _unloadPlugin,
1277
1408
  _id: chainId,
1278
1409
  _setNext: function (nextPlugin) {
1279
1410
  nextProxy = nextPlugin;
1280
1411
  }
1281
1412
  };
1282
- function _processChain(itemCtx, processPluginFn, processProxyFn, name, details, isAsync) {
1413
+ function _getTelCtx() {
1414
+ var itemCtx;
1415
+ if (plugin && isFunction(plugin[strGetTelCtx])) {
1416
+ itemCtx = plugin[strGetTelCtx]();
1417
+ }
1283
1418
  if (!itemCtx) {
1284
- if (plugin && isFunction(plugin[strGetTelCtx])) {
1285
- itemCtx = plugin[strGetTelCtx]();
1286
- }
1287
- if (!itemCtx) {
1288
- itemCtx = createProcessTelemetryContext(proxyChain, config, core);
1289
- }
1419
+ itemCtx = createProcessTelemetryContext(proxyChain, config, core);
1290
1420
  }
1421
+ return itemCtx;
1422
+ }
1423
+ function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
1424
+ var hasRun = false;
1291
1425
  var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
1292
1426
  var hasRunContext = itemCtx[strHasRunFlags];
1293
1427
  if (!hasRunContext) {
1294
1428
  hasRunContext = itemCtx[strHasRunFlags] = {};
1295
1429
  }
1296
- doPerf(itemCtx.core(), function () { return identifier + ":" + name; }, function () {
1297
- hasRunContext[chainId] = true;
1298
- var hasRun = false;
1299
- itemCtx.setNext(nextProxy);
1300
- if (plugin) {
1430
+ itemCtx.setNext(nextProxy);
1431
+ if (plugin) {
1432
+ doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
1433
+ hasRunContext[chainId] = true;
1301
1434
  try {
1302
- var nextId = nextProxy ? nextProxy._id : "";
1435
+ var nextId = nextProxy ? nextProxy._id : strEmpty$1;
1303
1436
  if (nextId) {
1304
1437
  hasRunContext[nextId] = false;
1305
1438
  }
@@ -1311,18 +1444,21 @@
1311
1444
  hasRun = true;
1312
1445
  }
1313
1446
  if (!nextProxy || !hasNextRun) {
1314
- itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1447
+ itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1315
1448
  }
1316
1449
  }
1317
- }
1318
- if (nextProxy && !hasRun) {
1319
- processProxyFn(itemCtx);
1320
- }
1321
- }, details, isAsync);
1450
+ }, details, isAsync);
1451
+ }
1452
+ return hasRun;
1322
1453
  }
1323
1454
  function _processTelemetry(env, itemCtx) {
1324
- _processChain(itemCtx, function (itemCtx) {
1325
- if (!hasProcessTelemetry) {
1455
+ itemCtx = itemCtx || _getTelCtx();
1456
+ function _callProcessTelemetry(itemCtx) {
1457
+ if (!plugin || !hasProcessTelemetry) {
1458
+ return false;
1459
+ }
1460
+ var pluginState = _getPluginState(plugin);
1461
+ if (pluginState[strTeardown] || pluginState[strDisabled]) {
1326
1462
  return false;
1327
1463
  }
1328
1464
  if (hasSetNext) {
@@ -1330,9 +1466,31 @@
1330
1466
  }
1331
1467
  plugin.processTelemetry(env, itemCtx);
1332
1468
  return true;
1333
- }, function (itemCtx) {
1334
- nextProxy.processTelemetry(env, itemCtx);
1335
- }, "processTelemetry", function () { return ({ item: env }); }, !(env.sync));
1469
+ }
1470
+ if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
1471
+ itemCtx.processNext(env);
1472
+ }
1473
+ }
1474
+ function _unloadPlugin(unloadCtx, unloadState) {
1475
+ function _callTeardown() {
1476
+ var hasRun = false;
1477
+ if (plugin) {
1478
+ var pluginState = _getPluginState(plugin);
1479
+ var pluginCore = plugin[strCore] || pluginState.core;
1480
+ if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
1481
+ pluginState[strCore] = null;
1482
+ pluginState[strTeardown] = true;
1483
+ pluginState[strIsInitialized] = false;
1484
+ if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
1485
+ hasRun = true;
1486
+ }
1487
+ }
1488
+ }
1489
+ return hasRun;
1490
+ }
1491
+ if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
1492
+ unloadCtx.processNext(unloadState);
1493
+ }
1336
1494
  }
1337
1495
  return objFreeze(proxyChain);
1338
1496
  }
@@ -1345,7 +1503,6 @@
1345
1503
  var strIsCookieUseDisabled = "isCookieUseDisabled";
1346
1504
  var strDisableCookiesUsage = "disableCookiesUsage";
1347
1505
  var strConfigCookieMgr = "_ckMgr";
1348
- var strEmpty = "";
1349
1506
  var _supportsCookies = null;
1350
1507
  var _allowUaSameSite = null;
1351
1508
  var _parsedCookieValue = null;
@@ -1422,7 +1579,7 @@
1422
1579
  var result = false;
1423
1580
  if (_isMgrEnabled(cookieMgr)) {
1424
1581
  var values = {};
1425
- var theValue = strTrim(value || strEmpty);
1582
+ var theValue = strTrim(value || strEmpty$1);
1426
1583
  var idx = theValue.indexOf(";");
1427
1584
  if (idx !== -1) {
1428
1585
  theValue = strTrim(value.substring(0, idx));
@@ -1437,11 +1594,11 @@
1437
1594
  if (expireMs > 0) {
1438
1595
  var expiry = new Date();
1439
1596
  expiry.setTime(expireMs);
1440
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
1597
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty$1, isTruthy);
1441
1598
  }
1442
1599
  }
1443
1600
  if (!_isIE) {
1444
- setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
1601
+ setValue(values, "max-age", strEmpty$1 + maxAgeSec, null, isUndefined);
1445
1602
  }
1446
1603
  }
1447
1604
  var location_1 = getLocation();
@@ -1462,7 +1619,7 @@
1462
1619
  return result;
1463
1620
  },
1464
1621
  get: function (name) {
1465
- var value = strEmpty;
1622
+ var value = strEmpty$1;
1466
1623
  if (_isMgrEnabled(cookieMgr)) {
1467
1624
  value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
1468
1625
  }
@@ -1487,7 +1644,7 @@
1487
1644
  values["max-age"] = "0";
1488
1645
  }
1489
1646
  var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
1490
- delCookie(name, _formatCookieValue(strEmpty, values));
1647
+ delCookie(name, _formatCookieValue(strEmpty$1, values));
1491
1648
  result = true;
1492
1649
  }
1493
1650
  return result;
@@ -1504,7 +1661,7 @@
1504
1661
  _supportsCookies = doc[strCookie] !== undefined;
1505
1662
  }
1506
1663
  catch (e) {
1507
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotAccessCookie, "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1664
+ logger && logger.throwInternal(2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1508
1665
  }
1509
1666
  }
1510
1667
  return _supportsCookies;
@@ -1514,7 +1671,7 @@
1514
1671
  if (theValue && theValue.length) {
1515
1672
  var parts = strTrim(theValue).split(";");
1516
1673
  arrForEach(parts, function (thePart) {
1517
- thePart = strTrim(thePart || strEmpty);
1674
+ thePart = strTrim(thePart || strEmpty$1);
1518
1675
  if (thePart) {
1519
1676
  var idx = thePart.indexOf("=");
1520
1677
  if (idx === -1) {
@@ -1535,21 +1692,21 @@
1535
1692
  return null;
1536
1693
  }
1537
1694
  function _formatCookieValue(value, values) {
1538
- var cookieValue = value || strEmpty;
1695
+ var cookieValue = value || strEmpty$1;
1539
1696
  objForEachKey(values, function (name, theValue) {
1540
- cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
1697
+ cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty$1);
1541
1698
  });
1542
1699
  return cookieValue;
1543
1700
  }
1544
1701
  function _getCookieValue(name) {
1545
- var cookieValue = strEmpty;
1702
+ var cookieValue = strEmpty$1;
1546
1703
  if (_doc) {
1547
- var theCookie = _doc[strCookie] || strEmpty;
1704
+ var theCookie = _doc[strCookie] || strEmpty$1;
1548
1705
  if (_parsedCookieValue !== theCookie) {
1549
1706
  _cookieCache = _extractParts(theCookie);
1550
1707
  _parsedCookieValue = theCookie;
1551
1708
  }
1552
- cookieValue = strTrim(_cookieCache[name] || strEmpty);
1709
+ cookieValue = strTrim(_cookieCache[name] || strEmpty$1);
1553
1710
  }
1554
1711
  return cookieValue;
1555
1712
  }
@@ -1599,6 +1756,38 @@
1599
1756
  _setDefaults(config, core, pluginChain);
1600
1757
  _isinitialized = true;
1601
1758
  };
1759
+ _self.teardown = function (unloadCtx, unloadState) {
1760
+ if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
1761
+ return;
1762
+ }
1763
+ var result;
1764
+ var unloadDone = false;
1765
+ var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
1766
+ var theUnloadState = unloadState || {
1767
+ reason: 0 ,
1768
+ isAsync: false
1769
+ };
1770
+ function _unloadCallback() {
1771
+ if (!unloadDone) {
1772
+ unloadDone = true;
1773
+ arrForEach(_hooks, function (fn) {
1774
+ fn.rm();
1775
+ });
1776
+ _hooks = [];
1777
+ if (result === true) {
1778
+ theUnloadCtx.processNext(theUnloadState);
1779
+ }
1780
+ _initDefaults();
1781
+ }
1782
+ }
1783
+ if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
1784
+ _unloadCallback();
1785
+ }
1786
+ else {
1787
+ result = true;
1788
+ }
1789
+ return result;
1790
+ };
1602
1791
  _self._addHook = function (hooks) {
1603
1792
  if (hooks) {
1604
1793
  if (isArray(hooks)) {
@@ -1613,13 +1802,13 @@
1613
1802
  _self.diagLog = function (itemCtx) {
1614
1803
  return _getTelCtx(itemCtx).diagLog();
1615
1804
  };
1616
- _self.isInitialized = function () {
1805
+ _self[strIsInitialized] = function () {
1617
1806
  return _isinitialized;
1618
1807
  };
1619
1808
  _self.setInitialized = function (isInitialized) {
1620
1809
  _isinitialized = isInitialized;
1621
1810
  };
1622
- _self.setNextPlugin = function (next) {
1811
+ _self[strSetNextPlugin] = function (next) {
1623
1812
  _nextPlugin = next;
1624
1813
  };
1625
1814
  _self.processNext = function (env, itemCtx) {
@@ -1670,77 +1859,9 @@
1670
1859
  return BaseTelemetryPlugin;
1671
1860
  }());
1672
1861
 
1673
- var UInt32Mask = 0x100000000;
1674
- var MaxUInt32 = 0xffffffff;
1675
- var _mwcSeeded = false;
1676
- var _mwcW = 123456789;
1677
- var _mwcZ = 987654321;
1678
- function _mwcSeed(seedValue) {
1679
- if (seedValue < 0) {
1680
- seedValue >>>= 0;
1681
- }
1682
- _mwcW = (123456789 + seedValue) & MaxUInt32;
1683
- _mwcZ = (987654321 - seedValue) & MaxUInt32;
1684
- _mwcSeeded = true;
1685
- }
1686
- function _autoSeedMwc() {
1687
- try {
1688
- var now = dateNow() & 0x7fffffff;
1689
- _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1690
- }
1691
- catch (e) {
1692
- }
1693
- }
1694
- function random32(signed) {
1695
- var value = 0;
1696
- var c = getCrypto() || getMsCrypto();
1697
- if (c && c.getRandomValues) {
1698
- value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1699
- }
1700
- if (value === 0 && isIE()) {
1701
- if (!_mwcSeeded) {
1702
- _autoSeedMwc();
1703
- }
1704
- value = mwcRandom32() & MaxUInt32;
1705
- }
1706
- if (value === 0) {
1707
- value = Math.floor((UInt32Mask * Math.random()) | 0);
1708
- }
1709
- if (!signed) {
1710
- value >>>= 0;
1711
- }
1712
- return value;
1713
- }
1714
- function mwcRandom32(signed) {
1715
- _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1716
- _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1717
- var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1718
- if (!signed) {
1719
- value >>>= 0;
1720
- }
1721
- return value;
1722
- }
1723
- function newId(maxLength) {
1724
- if (maxLength === void 0) { maxLength = 22; }
1725
- var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1726
- var number = random32() >>> 0;
1727
- var chars = 0;
1728
- var result = "";
1729
- while (result.length < maxLength) {
1730
- chars++;
1731
- result += base64chars.charAt(number & 0x3F);
1732
- number >>>= 6;
1733
- if (chars === 5) {
1734
- number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1735
- chars = 0;
1736
- }
1737
- }
1738
- return result;
1739
- }
1740
-
1741
1862
  function generateW3CId() {
1742
1863
  var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
1743
- var oct = "", tmp;
1864
+ var oct = strEmpty$1, tmp;
1744
1865
  for (var a = 0; a < 4; a++) {
1745
1866
  tmp = random32();
1746
1867
  oct +=
@@ -1757,6 +1878,95 @@
1757
1878
  return oct.substr(0, 8) + oct.substr(9, 4) + "4" + oct.substr(13, 3) + clockSequenceHi + oct.substr(16, 3) + oct.substr(19, 12);
1758
1879
  }
1759
1880
 
1881
+ var LoggingSeverity = createEnumStyle({
1882
+ CRITICAL: 1 ,
1883
+ WARNING: 2
1884
+ });
1885
+ var _InternalMessageId = createEnumStyle({
1886
+ BrowserDoesNotSupportLocalStorage: 0 ,
1887
+ BrowserCannotReadLocalStorage: 1 ,
1888
+ BrowserCannotReadSessionStorage: 2 ,
1889
+ BrowserCannotWriteLocalStorage: 3 ,
1890
+ BrowserCannotWriteSessionStorage: 4 ,
1891
+ BrowserFailedRemovalFromLocalStorage: 5 ,
1892
+ BrowserFailedRemovalFromSessionStorage: 6 ,
1893
+ CannotSendEmptyTelemetry: 7 ,
1894
+ ClientPerformanceMathError: 8 ,
1895
+ ErrorParsingAISessionCookie: 9 ,
1896
+ ErrorPVCalc: 10 ,
1897
+ ExceptionWhileLoggingError: 11 ,
1898
+ FailedAddingTelemetryToBuffer: 12 ,
1899
+ FailedMonitorAjaxAbort: 13 ,
1900
+ FailedMonitorAjaxDur: 14 ,
1901
+ FailedMonitorAjaxOpen: 15 ,
1902
+ FailedMonitorAjaxRSC: 16 ,
1903
+ FailedMonitorAjaxSend: 17 ,
1904
+ FailedMonitorAjaxGetCorrelationHeader: 18 ,
1905
+ FailedToAddHandlerForOnBeforeUnload: 19 ,
1906
+ FailedToSendQueuedTelemetry: 20 ,
1907
+ FailedToReportDataLoss: 21 ,
1908
+ FlushFailed: 22 ,
1909
+ MessageLimitPerPVExceeded: 23 ,
1910
+ MissingRequiredFieldSpecification: 24 ,
1911
+ NavigationTimingNotSupported: 25 ,
1912
+ OnError: 26 ,
1913
+ SessionRenewalDateIsZero: 27 ,
1914
+ SenderNotInitialized: 28 ,
1915
+ StartTrackEventFailed: 29 ,
1916
+ StopTrackEventFailed: 30 ,
1917
+ StartTrackFailed: 31 ,
1918
+ StopTrackFailed: 32 ,
1919
+ TelemetrySampledAndNotSent: 33 ,
1920
+ TrackEventFailed: 34 ,
1921
+ TrackExceptionFailed: 35 ,
1922
+ TrackMetricFailed: 36 ,
1923
+ TrackPVFailed: 37 ,
1924
+ TrackPVFailedCalc: 38 ,
1925
+ TrackTraceFailed: 39 ,
1926
+ TransmissionFailed: 40 ,
1927
+ FailedToSetStorageBuffer: 41 ,
1928
+ FailedToRestoreStorageBuffer: 42 ,
1929
+ InvalidBackendResponse: 43 ,
1930
+ FailedToFixDepricatedValues: 44 ,
1931
+ InvalidDurationValue: 45 ,
1932
+ TelemetryEnvelopeInvalid: 46 ,
1933
+ CreateEnvelopeError: 47 ,
1934
+ CannotSerializeObject: 48 ,
1935
+ CannotSerializeObjectNonSerializable: 49 ,
1936
+ CircularReferenceDetected: 50 ,
1937
+ ClearAuthContextFailed: 51 ,
1938
+ ExceptionTruncated: 52 ,
1939
+ IllegalCharsInName: 53 ,
1940
+ ItemNotInArray: 54 ,
1941
+ MaxAjaxPerPVExceeded: 55 ,
1942
+ MessageTruncated: 56 ,
1943
+ NameTooLong: 57 ,
1944
+ SampleRateOutOfRange: 58 ,
1945
+ SetAuthContextFailed: 59 ,
1946
+ SetAuthContextFailedAccountName: 60 ,
1947
+ StringValueTooLong: 61 ,
1948
+ StartCalledMoreThanOnce: 62 ,
1949
+ StopCalledWithoutStart: 63 ,
1950
+ TelemetryInitializerFailed: 64 ,
1951
+ TrackArgumentsNotSpecified: 65 ,
1952
+ UrlTooLong: 66 ,
1953
+ SessionStorageBufferFull: 67 ,
1954
+ CannotAccessCookie: 68 ,
1955
+ IdTooLong: 69 ,
1956
+ InvalidEvent: 70 ,
1957
+ FailedMonitorAjaxSetRequestHeader: 71 ,
1958
+ SendBrowserInfoOnUserInit: 72 ,
1959
+ PluginException: 73 ,
1960
+ NotificationException: 74 ,
1961
+ SnippetScriptLoadFailure: 99 ,
1962
+ InvalidInstrumentationKey: 100 ,
1963
+ CannotParseAiBlobValue: 101 ,
1964
+ InvalidContentBlob: 102 ,
1965
+ TrackPageActionEventFailed: 103 ,
1966
+ FailedAddingCustomDefinedRequestContext: 104 ,
1967
+ InMemoryStorageBufferFull: 105
1968
+ });
1969
+
1760
1970
  function dataSanitizeKeyAndAddUniqueness(logger, key, map) {
1761
1971
  var origLength = key.length;
1762
1972
  var field = dataSanitizeKey(logger, key);
@@ -1777,7 +1987,7 @@
1777
1987
  name = strTrim(name.toString());
1778
1988
  if (name.length > 150 ) {
1779
1989
  nameTrunc = name.substring(0, 150 );
1780
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
1990
+ logger && logger.throwInternal(2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
1781
1991
  }
1782
1992
  }
1783
1993
  return nameTrunc || name;
@@ -1790,7 +2000,7 @@
1790
2000
  value = strTrim(value);
1791
2001
  if (value.toString().length > maxLength) {
1792
2002
  valueTrunc = value.toString().substring(0, maxLength);
1793
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
2003
+ logger && logger.throwInternal(2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
1794
2004
  }
1795
2005
  }
1796
2006
  return valueTrunc || value;
@@ -1807,7 +2017,7 @@
1807
2017
  value = getJSON().stringify(value);
1808
2018
  }
1809
2019
  catch (e) {
1810
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
2020
+ logger && logger.throwInternal(2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
1811
2021
  }
1812
2022
  }
1813
2023
  value = dataSanitizeString(logger, value, 8192 );
@@ -1838,7 +2048,7 @@
1838
2048
  input = strTrim(input);
1839
2049
  if (input.length > maxLength) {
1840
2050
  inputTrunc = input.substring(0, maxLength);
1841
- logger && logger.throwInternal(LoggingSeverity.WARNING, _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
2051
+ logger && logger.throwInternal(2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
1842
2052
  }
1843
2053
  }
1844
2054
  return inputTrunc || input;
@@ -1848,21 +2058,22 @@
1848
2058
  return s.substr(s.length - 3);
1849
2059
  }
1850
2060
 
2061
+ var strEmpty = "";
1851
2062
  function msToTimeSpan(totalms) {
1852
2063
  if (isNaN(totalms) || totalms < 0) {
1853
2064
  totalms = 0;
1854
2065
  }
1855
2066
  totalms = Math.round(totalms);
1856
- var ms = "" + totalms % 1000;
1857
- var sec = "" + Math.floor(totalms / 1000) % 60;
1858
- var min = "" + Math.floor(totalms / (1000 * 60)) % 60;
1859
- var hour = "" + Math.floor(totalms / (1000 * 60 * 60)) % 24;
2067
+ var ms = strEmpty + totalms % 1000;
2068
+ var sec = strEmpty + Math.floor(totalms / 1000) % 60;
2069
+ var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
2070
+ var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
1860
2071
  var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
1861
2072
  ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
1862
2073
  sec = sec.length < 2 ? "0" + sec : sec;
1863
2074
  min = min.length < 2 ? "0" + min : min;
1864
2075
  hour = hour.length < 2 ? "0" + hour : hour;
1865
- return (days > 0 ? days + "." : "") + hour + ":" + min + ":" + sec + "." + ms;
2076
+ return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
1866
2077
  }
1867
2078
  function getExtensionByName(extensions, identifier) {
1868
2079
  var extension = null;
@@ -1877,17 +2088,15 @@
1877
2088
 
1878
2089
  var strNotSpecified = "not_specified";
1879
2090
 
1880
- var StorageType;
1881
- (function (StorageType) {
1882
- StorageType[StorageType["LocalStorage"] = 0] = "LocalStorage";
1883
- StorageType[StorageType["SessionStorage"] = 1] = "SessionStorage";
1884
- })(StorageType || (StorageType = {}));
1885
- var DistributedTracingModes;
1886
- (function (DistributedTracingModes) {
1887
- DistributedTracingModes[DistributedTracingModes["AI"] = 0] = "AI";
1888
- DistributedTracingModes[DistributedTracingModes["AI_AND_W3C"] = 1] = "AI_AND_W3C";
1889
- DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
1890
- })(DistributedTracingModes || (DistributedTracingModes = {}));
2091
+ var StorageType = createEnumStyle({
2092
+ LocalStorage: 0 ,
2093
+ SessionStorage: 1
2094
+ });
2095
+ createEnumStyle({
2096
+ AI: 0 ,
2097
+ AI_AND_W3C: 1 ,
2098
+ W3C: 2
2099
+ });
1891
2100
 
1892
2101
  var _canUseLocalStorage = undefined;
1893
2102
  function _getLocalStorageObject() {
@@ -1928,7 +2137,7 @@
1928
2137
  }
1929
2138
  catch (e) {
1930
2139
  _canUseLocalStorage = false;
1931
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2140
+ logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
1932
2141
  }
1933
2142
  }
1934
2143
  return null;
@@ -1942,7 +2151,7 @@
1942
2151
  }
1943
2152
  catch (e) {
1944
2153
  _canUseLocalStorage = false;
1945
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2154
+ logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
1946
2155
  }
1947
2156
  }
1948
2157
  return false;
@@ -1956,7 +2165,7 @@
1956
2165
  }
1957
2166
  catch (e) {
1958
2167
  _canUseLocalStorage = false;
1959
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2168
+ logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
1960
2169
  }
1961
2170
  }
1962
2171
  return false;
@@ -2258,7 +2467,7 @@
2258
2467
  return Device;
2259
2468
  }());
2260
2469
 
2261
- var Version = "2.8.0-beta.2203-01";
2470
+ var Version = "2.8.0-beta.2203-02";
2262
2471
  var Internal = /** @class */ (function () {
2263
2472
  function Internal(config) {
2264
2473
  this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + Version;