@microsoft/applicationinsights-offlinechannel-js 0.1.1 → 0.1.2

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 - Offline Channel, 0.1.1
2
+ * Application Insights JavaScript SDK - Offline Channel, 0.1.2
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -12,21 +12,15 @@
12
12
  var NULL_VALUE = null;
13
13
  var EMPTY = "";
14
14
  var FUNCTION = "function";
15
- var NUMBER = "number";
16
15
  var OBJECT = "object";
17
16
  var PROTOTYPE = "prototype";
18
17
  var __PROTO__ = "__proto__";
19
- var STRING = "string";
20
18
  var UNDEFINED = "undefined";
21
19
  var CONSTRUCTOR = "constructor";
22
20
  var SYMBOL = "Symbol";
23
21
  var POLYFILL_TAG = "_polyfill";
24
- var INDEX_OF = "indexOf";
25
22
  var LENGTH = "length";
26
- var DONE = "done";
27
- var VALUE = "value";
28
23
  var NAME = "name";
29
- var SLICE = "slice";
30
24
  var CALL = "call";
31
25
  var TO_STRING = "toString";
32
26
  var ObjClass$1 = Object;
@@ -36,6 +30,7 @@
36
30
  var MathCls = Math;
37
31
  var ArrCls = Array;
38
32
  var ArrProto = ArrCls[PROTOTYPE];
33
+ var ArrSlice = ArrProto["slice"];
39
34
 
40
35
  function safe(func, argArray) {
41
36
  try {
@@ -55,17 +50,6 @@
55
50
  };
56
51
  }
57
52
  /*#__NO_SIDE_EFFECTS__*/
58
- function _createObjIs(theName) {
59
- var theType = "[object " + theName + "]";
60
- return function (value) {
61
- return !!(value && objToString(value) === theType);
62
- };
63
- }
64
- /*#__NO_SIDE_EFFECTS__*/
65
- function objToString(value) {
66
- return ObjProto.toString.call(value);
67
- }
68
- /*#__NO_SIDE_EFFECTS__*/
69
53
  function isUndefined(value) {
70
54
  return typeof value === UNDEFINED || value === UNDEFINED;
71
55
  }
@@ -81,7 +65,7 @@
81
65
  function isDefined(arg) {
82
66
  return !!arg || arg !== UNDEF_VALUE;
83
67
  }
84
- var isString = ( /*#__PURE__*/_createIs(STRING));
68
+ var isString = ( /*#__PURE__*/_createIs("string"));
85
69
  var isFunction = ( /*#__PURE__*/_createIs(FUNCTION));
86
70
  /*#__NO_SIDE_EFFECTS__*/
87
71
  function isObject(value) {
@@ -91,8 +75,7 @@
91
75
  return !!value && typeof value === OBJECT;
92
76
  }
93
77
  var isArray = ArrCls.isArray;
94
- var isNumber = ( /*#__PURE__*/_createIs(NUMBER));
95
- var isError = ( /*#__PURE__*/_createObjIs("Error"));
78
+ var isNumber = ( /*#__PURE__*/_createIs("number"));
96
79
  /*#__NO_SIDE_EFFECTS__*/
97
80
  function isPromiseLike(value) {
98
81
  return !!(value && value.then && isFunction(value.then));
@@ -188,6 +171,7 @@
188
171
 
189
172
  var GLOBAL_CONFIG_KEY = "__tsUtils$gblCfg";
190
173
  var _globalCfg;
174
+ /*#__NO_SIDE_EFFECTS__*/
191
175
  function _getGlobalValue() {
192
176
  var result;
193
177
  if (typeof globalThis !== UNDEFINED) {
@@ -222,7 +206,7 @@
222
206
  object = { stack: asString(object.stack), message: asString(object.message), name: asString(object.name) };
223
207
  }
224
208
  try {
225
- propertyValueDump = JSON.stringify(object, NULL_VALUE, format ? ((typeof format === NUMBER) ? format : 4) : UNDEF_VALUE);
209
+ propertyValueDump = JSON.stringify(object, NULL_VALUE, format ? ((typeof format === "number") ? format : 4) : UNDEF_VALUE);
226
210
  propertyValueDump = (propertyValueDump && propertyValueDump.replace(/"(\w+)"\s*:\s{0,1}/g, "$1: ")) || asString(object);
227
211
  }
228
212
  catch (e) {
@@ -231,18 +215,15 @@
231
215
  return objType + ": " + propertyValueDump;
232
216
  }
233
217
 
234
- var _slice;
235
- var _unwrapInstFunction = _unwrapFunctionWithPoly;
236
218
  var _unwrapFunction = _unwrapFunctionWithPoly;
237
219
  /*#__NO_SIDE_EFFECTS__*/
238
220
  function _unwrapFunctionWithPoly(funcName, clsProto, polyFunc) {
239
- _slice = _slice || ArrProto[SLICE];
240
221
  var clsFn = clsProto && clsProto[funcName];
241
222
  return function (thisArg) {
242
223
  var theFunc = (thisArg && thisArg[funcName]) || clsFn;
243
224
  if (theFunc || polyFunc) {
244
225
  var theArgs = arguments;
245
- return (theFunc || polyFunc).apply(thisArg, theFunc ? _slice[CALL](theArgs, 1) : theArgs);
226
+ return (theFunc || polyFunc).apply(thisArg, theFunc ? ArrSlice[CALL](theArgs, 1) : theArgs);
246
227
  }
247
228
  throwTypeError("\"" + asString(funcName) + "\" not defined for " + dumpObj(thisArg));
248
229
  };
@@ -256,7 +237,7 @@
256
237
 
257
238
  var mathMax = MathCls.max;
258
239
 
259
- var strSlice = ( /*#__PURE__*/_unwrapFunction(SLICE, StrProto));
240
+ var strSlice = ( /*#__PURE__*/_unwrapFunction("slice", StrProto));
260
241
 
261
242
  var strSubstring = ( /*#__PURE__*/_unwrapFunction("substring", StrProto));
262
243
  var strSubstr = ( /*#__PURE__*/_unwrapFunctionWithPoly("substr", StrProto, polyStrSubstr));
@@ -324,7 +305,7 @@
324
305
  var propMap = {
325
306
  e: "enumerable",
326
307
  c: "configurable",
327
- v: VALUE,
308
+ v: "value",
328
309
  w: "writable",
329
310
  g: "get",
330
311
  s: "set"
@@ -357,6 +338,7 @@
357
338
  function _initTestHooks() {
358
339
  _globalLazyTestHooks = _getGlobalConfig();
359
340
  }
341
+ /*#__NO_SIDE_EFFECTS__*/
360
342
  function getLazy(cb) {
361
343
  var lazyValue = {};
362
344
  !_globalLazyTestHooks && _initTestHooks();
@@ -394,10 +376,14 @@
394
376
 
395
377
  var WINDOW = "window";
396
378
  var _cachedGlobal;
397
- var _cachedWindow;
398
- var _cachedDocument;
399
- var _cachedNavigator;
400
- var _isNode;
379
+ function _getGlobalInstFn(getFn, theArgs) {
380
+ var cachedValue;
381
+ return function () {
382
+ !_globalLazyTestHooks && _initTestHooks();
383
+ (!cachedValue || _globalLazyTestHooks.lzy) && (cachedValue = createCachedValue(safe(getFn, theArgs).v));
384
+ return cachedValue.v;
385
+ };
386
+ }
401
387
  /*#__NO_SIDE_EFFECTS__*/
402
388
  function lazySafeGetInst(name) {
403
389
  return getLazy(function () { return safe((getInst), [name]).v || UNDEF_VALUE; });
@@ -414,41 +400,25 @@
414
400
  if (gbl && gbl[name]) {
415
401
  return gbl[name];
416
402
  }
417
- if (name === WINDOW && _cachedWindow) {
418
- return _cachedWindow.v;
403
+ if (name === WINDOW) {
404
+ return getWindow();
419
405
  }
420
406
  return NULL_VALUE;
421
407
  }
422
- /*#__NO_SIDE_EFFECTS__*/
423
- function getDocument() {
424
- !_globalLazyTestHooks && _initTestHooks();
425
- (!_cachedDocument || _globalLazyTestHooks.lzy) && (_cachedDocument = createCachedValue(safe((getInst), ["document"]).v));
426
- return _cachedDocument.v;
427
- }
408
+ var getDocument = ( /*#__PURE__*/_getGlobalInstFn(getInst, ["document"]));
428
409
  /*#__NO_SIDE_EFFECTS__*/
429
410
  function hasWindow() {
430
411
  return !!getWindow();
431
412
  }
432
- /*#__NO_SIDE_EFFECTS__*/
433
- function getWindow() {
434
- !_globalLazyTestHooks && _initTestHooks();
435
- (!_cachedWindow || _globalLazyTestHooks.lzy) && (_cachedWindow = createCachedValue(safe((getInst), [WINDOW]).v));
436
- return _cachedWindow.v;
437
- }
413
+ var getWindow = ( /*#__PURE__*/_getGlobalInstFn(getInst, [WINDOW]));
438
414
  /*#__NO_SIDE_EFFECTS__*/
439
415
  function hasNavigator() {
440
416
  return !!getNavigator();
441
417
  }
442
- /*#__NO_SIDE_EFFECTS__*/
443
- function getNavigator() {
444
- !_globalLazyTestHooks && _initTestHooks();
445
- (!_cachedNavigator || _globalLazyTestHooks.lzy) && (_cachedNavigator = createCachedValue(safe((getInst), ["navigator"]).v));
446
- return _cachedNavigator.v;
447
- }
448
- function isNode() {
449
- !_isNode && (_isNode = createCachedValue(!!safe(function () { return (process && (process.versions || {}).node); }).v));
450
- return _isNode.v;
451
- }
418
+ var getNavigator = ( /*#__PURE__*/_getGlobalInstFn(getInst, ["navigator"]));
419
+ var isNode = ( /*#__PURE__*/_getGlobalInstFn(function () {
420
+ return !!safe(function () { return (process && (process.versions || {}).node); }).v;
421
+ }));
452
422
 
453
423
  var _symbol;
454
424
  var _symbolFor;
@@ -509,8 +479,8 @@
509
479
  var iterResult = void 0;
510
480
  try {
511
481
  var count = 0;
512
- while (!(iterResult = iter.next())[DONE]) {
513
- if (callbackfn[CALL](thisArg || iter, iterResult[VALUE], count, iter) === -1) {
482
+ while (!(iterResult = iter.next()).done) {
483
+ if (callbackfn[CALL](thisArg || iter, iterResult.value, count, iter) === -1) {
514
484
  break;
515
485
  }
516
486
  count++;
@@ -525,7 +495,7 @@
525
495
  }
526
496
  finally {
527
497
  try {
528
- if (iterResult && !iterResult[DONE]) {
498
+ if (iterResult && !iterResult.done) {
529
499
  iter.return && iter.return(iterResult);
530
500
  }
531
501
  }
@@ -539,7 +509,9 @@
539
509
  }
540
510
  }
541
511
 
542
- var fnApply = ( /*#__PURE__*/_unwrapInstFunction("apply"));
512
+ function fnApply(fn, thisArg, argArray) {
513
+ return fn.apply(thisArg, argArray);
514
+ }
543
515
 
544
516
  function arrAppend(target, elms) {
545
517
  if (!isUndefined(elms) && target) {
@@ -571,9 +543,11 @@
571
543
  }
572
544
  }
573
545
 
574
- var arrIndexOf = ( /*#__PURE__*/_unwrapFunction(INDEX_OF, ArrProto));
546
+ var arrIndexOf = ( /*#__PURE__*/_unwrapFunction("indexOf", ArrProto));
575
547
 
576
- var arrSlice = ( /*#__PURE__*/_unwrapFunction(SLICE, ArrProto));
548
+ function arrSlice(theArray, start, end) {
549
+ return ((theArray && theArray["slice"]) || ArrSlice).apply(theArray, ArrSlice[CALL](arguments, 1));
550
+ }
577
551
 
578
552
  var objCreate = ObjClass$1["create"] || polyObjCreate;
579
553
  /*#__NO_SIDE_EFFECTS__*/
@@ -603,6 +577,7 @@
603
577
  return fn(obj, proto);
604
578
  }
605
579
 
580
+ /*#__NO_SIDE_EFFECTS__*/
606
581
  function _createCustomError(name, d, b) {
607
582
  safe(objDefine, [d, NAME, { v: name, c: true, e: false }]);
608
583
  d = objSetPrototypeOf(d, b);
@@ -626,7 +601,7 @@
626
601
  var theArgs = arguments;
627
602
  try {
628
603
  safe(_setName, [theBaseClass, name]);
629
- var _self = fnApply(theBaseClass, _this, ArrProto[SLICE][CALL](theArgs)) || _this;
604
+ var _self = fnApply(theBaseClass, _this, ArrSlice[CALL](theArgs)) || _this;
630
605
  if (_self !== _this) {
631
606
  var orgProto = objGetPrototypeOf(_this);
632
607
  if (orgProto !== objGetPrototypeOf(_self)) {
@@ -703,58 +678,54 @@
703
678
 
704
679
  var getLength = ( /*#__PURE__*/_unwrapProp(LENGTH));
705
680
 
706
- var strIndexOf = ( /*#__PURE__*/_unwrapFunction(INDEX_OF, StrProto));
681
+ var strIndexOf = ( /*#__PURE__*/_unwrapFunction("indexOf", StrProto));
707
682
 
708
683
  var REF = "ref";
709
- var UNREF = "un" + REF;
684
+ var UNREF = "unref";
710
685
  var HAS_REF = "hasRef";
711
686
  var ENABLED = "enabled";
687
+ /*#__NO_SIDE_EFFECTS__*/
712
688
  function _createTimerHandler(startTimer, refreshFn, cancelFn) {
713
- var _a;
714
689
  var ref = true;
715
690
  var timerId = startTimer ? refreshFn(NULL_VALUE) : NULL_VALUE;
716
691
  var theTimerHandler;
717
- var _unref = function () {
692
+ function _unref() {
718
693
  ref = false;
719
694
  timerId && timerId[UNREF] && timerId[UNREF]();
720
695
  return theTimerHandler;
721
- };
722
- var _ref = function () {
723
- ref = true;
724
- timerId && timerId[REF] && timerId[REF]();
696
+ }
697
+ function _cancel() {
698
+ timerId && cancelFn(timerId);
699
+ timerId = NULL_VALUE;
700
+ }
701
+ function _refresh() {
702
+ timerId = refreshFn(timerId);
703
+ if (!ref) {
704
+ _unref();
705
+ }
725
706
  return theTimerHandler;
707
+ }
708
+ function _setEnabled(value) {
709
+ !value && timerId && _cancel();
710
+ value && !timerId && _refresh();
711
+ }
712
+ theTimerHandler = {
713
+ cancel: _cancel,
714
+ refresh: _refresh
726
715
  };
727
- var _hasRef = function () {
716
+ theTimerHandler[HAS_REF] = function () {
728
717
  if (timerId && timerId[HAS_REF]) {
729
718
  return timerId[HAS_REF]();
730
719
  }
731
720
  return ref;
732
721
  };
733
- var _refresh = function () {
734
- timerId = refreshFn(timerId);
735
- if (!ref) {
736
- _unref();
737
- }
722
+ theTimerHandler[REF] = function () {
723
+ ref = true;
724
+ timerId && timerId[REF] && timerId[REF]();
738
725
  return theTimerHandler;
739
726
  };
740
- var _cancel = function () {
741
- timerId && cancelFn(timerId);
742
- timerId = NULL_VALUE;
743
- };
744
- var _setEnabled = function (value) {
745
- !value && timerId && _cancel();
746
- value && !timerId && _refresh();
747
- };
748
- theTimerHandler = (_a = {
749
- cancel: _cancel,
750
- refresh: _refresh
751
- },
752
- _a[HAS_REF] = _hasRef,
753
- _a[REF] = _ref,
754
- _a[UNREF] = _unref,
755
- _a[ENABLED] = false,
756
- _a);
757
- objDefineProp(theTimerHandler, ENABLED, {
727
+ theTimerHandler[UNREF] = _unref;
728
+ theTimerHandler = objDefineProp(theTimerHandler, ENABLED, {
758
729
  get: function () { return !!timerId; },
759
730
  set: _setEnabled
760
731
  });
@@ -766,7 +737,7 @@
766
737
  };
767
738
  }
768
739
 
769
- function _createTimeoutWith(self, startTimer, overrideFn, theArgs) {
740
+ function _createTimeoutWith(startTimer, overrideFn, theArgs) {
770
741
  var isArr = isArray(overrideFn);
771
742
  var len = isArr ? overrideFn.length : 0;
772
743
  var setFn = (len > 0 ? overrideFn[0] : (!isArr ? overrideFn : UNDEF_VALUE)) || setTimeout;
@@ -774,7 +745,7 @@
774
745
  var timerFn = theArgs[0];
775
746
  theArgs[0] = function () {
776
747
  handler.dn();
777
- fnApply(timerFn, self, ArrProto[SLICE][CALL](arguments));
748
+ fnApply(timerFn, UNDEF_VALUE, ArrSlice[CALL](arguments));
778
749
  };
779
750
  var handler = _createTimerHandler(startTimer, function (timerId) {
780
751
  if (timerId) {
@@ -782,16 +753,16 @@
782
753
  timerId.refresh();
783
754
  return timerId;
784
755
  }
785
- fnApply(clearFn, self, [timerId]);
756
+ fnApply(clearFn, UNDEF_VALUE, [timerId]);
786
757
  }
787
- return fnApply(setFn, self, theArgs);
758
+ return fnApply(setFn, UNDEF_VALUE, theArgs);
788
759
  }, function (timerId) {
789
- fnApply(clearFn, self, [timerId]);
760
+ fnApply(clearFn, UNDEF_VALUE, [timerId]);
790
761
  });
791
762
  return handler.h;
792
763
  }
793
764
  function scheduleTimeout(callback, timeout) {
794
- return _createTimeoutWith(this, true, UNDEF_VALUE, ArrProto[SLICE][CALL](arguments));
765
+ return _createTimeoutWith(true, UNDEF_VALUE, ArrSlice[CALL](arguments));
795
766
  }
796
767
 
797
768
  var _a$2;
@@ -1077,7 +1048,7 @@
1077
1048
  var _DYN_NAME$1 = "name";
1078
1049
  var _DYN_TIME = "time";
1079
1050
  var _DYN_PROCESS_NEXT$1 = "processNext";
1080
- var _DYN_GET_PROCESS_TEL_CONT0 = "getProcessTelContext";
1051
+ var _DYN_GET_PROCESS_TEL_CONT2 = "getProcessTelContext";
1081
1052
  var _DYN_UNLOAD = "unload";
1082
1053
  var _DYN_LOGGING_LEVEL_CONSOL4 = "loggingLevelConsole";
1083
1054
  var _DYN_CREATE_NEW = "createNew";
@@ -1099,7 +1070,6 @@
1099
1070
  var _DYN_TYPE = "type";
1100
1071
  var _DYN_HANDLER = "handler";
1101
1072
  var _DYN_STATUS = "status";
1102
- var _DYN_ITEMS_RECEIVED = "itemsReceived";
1103
1073
  var _DYN_GET_RESPONSE_HEADER = "getResponseHeader";
1104
1074
  var _DYN_GET_ALL_RESPONSE_HEA5 = "getAllResponseHeaders";
1105
1075
  var _DYN_IS_CHILD_EVT = "isChildEvt";
@@ -1107,6 +1077,7 @@
1107
1077
  var _DYN_GET_CTX = "getCtx";
1108
1078
  var _DYN_SET_CTX = "setCtx";
1109
1079
  var _DYN_COMPLETE = "complete";
1080
+ var _DYN_ITEMS_RECEIVED = "itemsReceived";
1110
1081
  var _DYN_URL_STRING = "urlString";
1111
1082
  var _DYN_SEND_POST$1 = "sendPOST";
1112
1083
  var _DYN_HEADERS = "headers";
@@ -1695,20 +1666,162 @@
1695
1666
  var STR_GET_PERF_MGR = "getPerfMgr";
1696
1667
  var STR_NOT_DYNAMIC_ERROR = "Not dynamic - ";
1697
1668
 
1698
- var _aiNamespace = null;
1699
- function _getExtensionNamespace() {
1700
- var target = getInst("Microsoft");
1701
- if (target) {
1702
- _aiNamespace = target["ApplicationInsights"];
1669
+ var rCamelCase = /-([a-z])/g;
1670
+ var rNormalizeInvalid = /([^\w\d_$])/g;
1671
+ var rLeadingNumeric = /^(\d+[\w\d_$])/;
1672
+ function isNotNullOrUndefined(value) {
1673
+ return !isNullOrUndefined(value);
1674
+ }
1675
+ function normalizeJsName(name) {
1676
+ var value = name;
1677
+ if (value && isString(value)) {
1678
+ value = value[_DYN_REPLACE ](rCamelCase, function (_all, letter) {
1679
+ return letter.toUpperCase();
1680
+ });
1681
+ value = value[_DYN_REPLACE ](rNormalizeInvalid, "_");
1682
+ value = value[_DYN_REPLACE ](rLeadingNumeric, function (_all, match) {
1683
+ return "_" + match;
1684
+ });
1703
1685
  }
1704
- return _aiNamespace;
1686
+ return value;
1705
1687
  }
1706
- function getDebugExt(config) {
1707
- var ns = _aiNamespace;
1708
- if (!ns && config.disableDbgExt !== true) {
1709
- ns = _aiNamespace || _getExtensionNamespace();
1688
+ function strContains(value, search) {
1689
+ if (value && search) {
1690
+ return strIndexOf(value, search) !== -1;
1710
1691
  }
1711
- return ns ? ns["ChromeDbgExt"] : null;
1692
+ return false;
1693
+ }
1694
+ function _createProxyFunction(source, funcName) {
1695
+ var srcFunc = null;
1696
+ var src = null;
1697
+ if (isFunction(source)) {
1698
+ srcFunc = source;
1699
+ }
1700
+ else {
1701
+ src = source;
1702
+ }
1703
+ return function () {
1704
+ var originalArguments = arguments;
1705
+ if (srcFunc) {
1706
+ src = srcFunc();
1707
+ }
1708
+ if (src) {
1709
+ return src[funcName][_DYN_APPLY ](src, originalArguments);
1710
+ }
1711
+ };
1712
+ }
1713
+ function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
1714
+ if (target && name && source) {
1715
+ if (overwriteTarget !== false || isUndefined(target[name])) {
1716
+ target[name] = _createProxyFunction(source, theFunc);
1717
+ }
1718
+ }
1719
+ }
1720
+ function getResponseText(xhr) {
1721
+ try {
1722
+ return xhr.responseText;
1723
+ }
1724
+ catch (e) {
1725
+ }
1726
+ return null;
1727
+ }
1728
+ function formatErrorMessageXdr(xdr, message) {
1729
+ if (xdr) {
1730
+ return "XDomainRequest,Response:" + getResponseText(xdr) || "";
1731
+ }
1732
+ return message;
1733
+ }
1734
+ function formatErrorMessageXhr(xhr, message) {
1735
+ if (xhr) {
1736
+ return "XMLHttpRequest,Status:" + xhr[_DYN_STATUS ] + ",Response:" + getResponseText(xhr) || xhr.response || "";
1737
+ }
1738
+ return message;
1739
+ }
1740
+ function prependTransports(theTransports, newTransports) {
1741
+ if (newTransports) {
1742
+ if (isNumber(newTransports)) {
1743
+ theTransports = [newTransports].concat(theTransports);
1744
+ }
1745
+ else if (isArray(newTransports)) {
1746
+ theTransports = newTransports.concat(theTransports);
1747
+ }
1748
+ }
1749
+ return theTransports;
1750
+ }
1751
+ var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
1752
+ var strWithCredentials = "withCredentials";
1753
+ var strTimeout = "timeout";
1754
+ function openXhr(method, urlString, withCredentials, disabled, isSync, timeout) {
1755
+ if (disabled === void 0) { disabled = false; }
1756
+ if (isSync === void 0) { isSync = false; }
1757
+ function _wrapSetXhrProp(xhr, prop, value) {
1758
+ try {
1759
+ xhr[prop] = value;
1760
+ }
1761
+ catch (e) {
1762
+ }
1763
+ }
1764
+ var xhr = new XMLHttpRequest();
1765
+ if (disabled) {
1766
+ _wrapSetXhrProp(xhr, strDisabledPropertyName, disabled);
1767
+ }
1768
+ if (withCredentials) {
1769
+ _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);
1770
+ }
1771
+ xhr.open(method, urlString, !isSync);
1772
+ if (withCredentials) {
1773
+ _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);
1774
+ }
1775
+ if (!isSync && timeout) {
1776
+ _wrapSetXhrProp(xhr, strTimeout, timeout);
1777
+ }
1778
+ return xhr;
1779
+ }
1780
+ function convertAllHeadersToMap(headersString) {
1781
+ var headers = {};
1782
+ if (isString(headersString)) {
1783
+ var headersArray = strTrim(headersString)[_DYN_SPLIT$1 ](/[\r\n]+/);
1784
+ arrForEach(headersArray, function (headerEntry) {
1785
+ if (headerEntry) {
1786
+ var idx = headerEntry.indexOf(": ");
1787
+ if (idx !== -1) {
1788
+ var header = strTrim(headerEntry.substring(0, idx))[_DYN_TO_LOWER_CASE ]();
1789
+ var value = strTrim(headerEntry.substring(idx + 1));
1790
+ headers[header] = value;
1791
+ }
1792
+ else {
1793
+ headers[strTrim(headerEntry)] = 1;
1794
+ }
1795
+ }
1796
+ });
1797
+ }
1798
+ return headers;
1799
+ }
1800
+ function _appendHeader(theHeaders, xhr, name) {
1801
+ if (!theHeaders[name] && xhr && xhr[_DYN_GET_RESPONSE_HEADER ]) {
1802
+ var value = xhr[_DYN_GET_RESPONSE_HEADER ](name);
1803
+ if (value) {
1804
+ theHeaders[name] = strTrim(value);
1805
+ }
1806
+ }
1807
+ return theHeaders;
1808
+ }
1809
+ var STR_KILL_DURATION_HEADER = "kill-duration";
1810
+ var STR_KILL_DURATION_SECONDS_HEADER = "kill-duration-seconds";
1811
+ var STR_TIME_DELTA_HEADER = "time-delta-millis";
1812
+ function _getAllResponseHeaders(xhr, isOneDs) {
1813
+ var theHeaders = {};
1814
+ if (!xhr[_DYN_GET_ALL_RESPONSE_HEA5 ]) {
1815
+ if (!!isOneDs) {
1816
+ theHeaders = _appendHeader(theHeaders, xhr, STR_TIME_DELTA_HEADER);
1817
+ theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_HEADER);
1818
+ theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_SECONDS_HEADER);
1819
+ }
1820
+ }
1821
+ else {
1822
+ theHeaders = convertAllHeadersToMap(xhr[_DYN_GET_ALL_RESPONSE_HEA5 ]());
1823
+ }
1824
+ return theHeaders;
1712
1825
  }
1713
1826
 
1714
1827
  var strLocation = "location";
@@ -1830,386 +1943,20 @@
1830
1943
  return isSupported;
1831
1944
  }
1832
1945
 
1833
- var _a$1;
1834
- var STR_WARN_TO_CONSOLE = "warnToConsole";
1835
- var AiNonUserActionablePrefix = "AI (Internal): ";
1836
- var AiUserActionablePrefix = "AI: ";
1837
- var AIInternalMessagePrefix = "AITR_";
1838
- var defaultValues$1 = {
1839
- loggingLevelConsole: 0,
1840
- loggingLevelTelemetry: 1,
1841
- maxMessageLimit: 25,
1842
- enableDebug: false
1843
- };
1844
- var _logFuncs = (_a$1 = {},
1845
- _a$1[0 ] = null,
1846
- _a$1[1 ] = "errorToConsole",
1847
- _a$1[2 ] = STR_WARN_TO_CONSOLE,
1848
- _a$1[3 ] = "debugToConsole",
1849
- _a$1);
1850
- function _sanitizeDiagnosticText(text) {
1851
- if (text) {
1852
- return "\"" + text[_DYN_REPLACE ](/\"/g, STR_EMPTY$1) + "\"";
1946
+ var UInt32Mask = 0x100000000;
1947
+ var MaxUInt32 = 0xffffffff;
1948
+ var SEED1 = 123456789;
1949
+ var SEED2 = 987654321;
1950
+ var _mwcSeeded = false;
1951
+ var _mwcW = SEED1;
1952
+ var _mwcZ = SEED2;
1953
+ function _mwcSeed(seedValue) {
1954
+ if (seedValue < 0) {
1955
+ seedValue >>>= 0;
1853
1956
  }
1854
- return STR_EMPTY$1;
1855
- }
1856
- function _logToConsole(func, message) {
1857
- var theConsole = getConsole();
1858
- if (!!theConsole) {
1859
- var logFunc = "log";
1860
- if (theConsole[func]) {
1861
- logFunc = func;
1862
- }
1863
- if (isFunction(theConsole[logFunc])) {
1864
- theConsole[logFunc](message);
1865
- }
1866
- }
1867
- }
1868
- var _InternalLogMessage = /** @class */ (function () {
1869
- function _InternalLogMessage(msgId, msg, isUserAct, properties) {
1870
- if (isUserAct === void 0) { isUserAct = false; }
1871
- var _self = this;
1872
- _self[_DYN_MESSAGE_ID ] = msgId;
1873
- _self[_DYN_MESSAGE ] =
1874
- (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
1875
- msgId;
1876
- var strProps = STR_EMPTY$1;
1877
- if (hasJSON()) {
1878
- strProps = getJSON().stringify(properties);
1879
- }
1880
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : STR_EMPTY$1) +
1881
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : STR_EMPTY$1);
1882
- _self[_DYN_MESSAGE ] += diagnosticText;
1883
- }
1884
- _InternalLogMessage.dataType = "MessageData";
1885
- return _InternalLogMessage;
1886
- }());
1887
- function safeGetLogger(core, config) {
1888
- return (core || {})[_DYN_LOGGER ] || new DiagnosticLogger(config);
1889
- }
1890
- var DiagnosticLogger = /** @class */ (function () {
1891
- function DiagnosticLogger(config) {
1892
- this.identifier = "DiagnosticLogger";
1893
- this.queue = [];
1894
- var _messageCount = 0;
1895
- var _messageLogged = {};
1896
- var _loggingLevelConsole;
1897
- var _loggingLevelTelemetry;
1898
- var _maxInternalMessageLimit;
1899
- var _enableDebug;
1900
- var _unloadHandler;
1901
- dynamicProto(DiagnosticLogger, this, function (_self) {
1902
- _unloadHandler = _setDefaultsFromConfig(config || {});
1903
- _self.consoleLoggingLevel = function () { return _loggingLevelConsole; };
1904
- _self[_DYN_THROW_INTERNAL ] = function (severity, msgId, msg, properties, isUserAct) {
1905
- if (isUserAct === void 0) { isUserAct = false; }
1906
- var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
1907
- if (_enableDebug) {
1908
- throw dumpObj(message);
1909
- }
1910
- else {
1911
- var logFunc = _logFuncs[severity] || STR_WARN_TO_CONSOLE;
1912
- if (!isUndefined(message[_DYN_MESSAGE ])) {
1913
- if (isUserAct) {
1914
- var messageKey = +message[_DYN_MESSAGE_ID ];
1915
- if (!_messageLogged[messageKey] && _loggingLevelConsole >= severity) {
1916
- _self[logFunc](message[_DYN_MESSAGE ]);
1917
- _messageLogged[messageKey] = true;
1918
- }
1919
- }
1920
- else {
1921
- if (_loggingLevelConsole >= severity) {
1922
- _self[logFunc](message[_DYN_MESSAGE ]);
1923
- }
1924
- }
1925
- _logInternalMessage(severity, message);
1926
- }
1927
- else {
1928
- _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
1929
- }
1930
- }
1931
- };
1932
- _self.debugToConsole = function (message) {
1933
- _logToConsole("debug", message);
1934
- _debugExtMsg("warning", message);
1935
- };
1936
- _self[_DYN_WARN_TO_CONSOLE ] = function (message) {
1937
- _logToConsole("warn", message);
1938
- _debugExtMsg("warning", message);
1939
- };
1940
- _self.errorToConsole = function (message) {
1941
- _logToConsole("error", message);
1942
- _debugExtMsg("error", message);
1943
- };
1944
- _self.resetInternalMessageCount = function () {
1945
- _messageCount = 0;
1946
- _messageLogged = {};
1947
- };
1948
- _self[_DYN_LOG_INTERNAL_MESSAGE ] = _logInternalMessage;
1949
- _self[_DYN_UNLOAD ] = function (isAsync) {
1950
- _unloadHandler && _unloadHandler.rm();
1951
- _unloadHandler = null;
1952
- };
1953
- function _logInternalMessage(severity, message) {
1954
- if (_areInternalMessagesThrottled()) {
1955
- return;
1956
- }
1957
- var logMessage = true;
1958
- var messageKey = AIInternalMessagePrefix + message[_DYN_MESSAGE_ID ];
1959
- if (_messageLogged[messageKey]) {
1960
- logMessage = false;
1961
- }
1962
- else {
1963
- _messageLogged[messageKey] = true;
1964
- }
1965
- if (logMessage) {
1966
- if (severity <= _loggingLevelTelemetry) {
1967
- _self.queue[_DYN_PUSH$2 ](message);
1968
- _messageCount++;
1969
- _debugExtMsg((severity === 1 ? "error" : "warn"), message);
1970
- }
1971
- if (_messageCount === _maxInternalMessageLimit) {
1972
- var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
1973
- var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
1974
- _self.queue[_DYN_PUSH$2 ](throttleMessage);
1975
- if (severity === 1 ) {
1976
- _self.errorToConsole(throttleLimitMessage);
1977
- }
1978
- else {
1979
- _self[_DYN_WARN_TO_CONSOLE ](throttleLimitMessage);
1980
- }
1981
- }
1982
- }
1983
- }
1984
- function _setDefaultsFromConfig(config) {
1985
- return onConfigChange(createDynamicConfig(config, defaultValues$1, _self).cfg, function (details) {
1986
- var config = details.cfg;
1987
- _loggingLevelConsole = config[_DYN_LOGGING_LEVEL_CONSOL4 ];
1988
- _loggingLevelTelemetry = config.loggingLevelTelemetry;
1989
- _maxInternalMessageLimit = config.maxMessageLimit;
1990
- _enableDebug = config.enableDebug;
1991
- });
1992
- }
1993
- function _areInternalMessagesThrottled() {
1994
- return _messageCount >= _maxInternalMessageLimit;
1995
- }
1996
- function _debugExtMsg(name, data) {
1997
- var dbgExt = getDebugExt(config || {});
1998
- if (dbgExt && dbgExt[_DYN_DIAG_LOG$1 ]) {
1999
- dbgExt[_DYN_DIAG_LOG$1 ](name, data);
2000
- }
2001
- }
2002
- });
2003
- }
2004
- DiagnosticLogger.__ieDyn=1;
2005
- return DiagnosticLogger;
2006
- }());
2007
- function _getLogger(logger) {
2008
- return (logger || new DiagnosticLogger());
2009
- }
2010
- function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
2011
- if (isUserAct === void 0) { isUserAct = false; }
2012
- _getLogger(logger)[_DYN_THROW_INTERNAL ](severity, msgId, msg, properties, isUserAct);
2013
- }
2014
- function _warnToConsole(logger, message) {
2015
- _getLogger(logger)[_DYN_WARN_TO_CONSOLE ](message);
2016
- }
2017
-
2018
- var rCamelCase = /-([a-z])/g;
2019
- var rNormalizeInvalid = /([^\w\d_$])/g;
2020
- var rLeadingNumeric = /^(\d+[\w\d_$])/;
2021
- function isNotNullOrUndefined(value) {
2022
- return !isNullOrUndefined(value);
2023
- }
2024
- function normalizeJsName(name) {
2025
- var value = name;
2026
- if (value && isString(value)) {
2027
- value = value[_DYN_REPLACE ](rCamelCase, function (_all, letter) {
2028
- return letter.toUpperCase();
2029
- });
2030
- value = value[_DYN_REPLACE ](rNormalizeInvalid, "_");
2031
- value = value[_DYN_REPLACE ](rLeadingNumeric, function (_all, match) {
2032
- return "_" + match;
2033
- });
2034
- }
2035
- return value;
2036
- }
2037
- function strContains(value, search) {
2038
- if (value && search) {
2039
- return strIndexOf(value, search) !== -1;
2040
- }
2041
- return false;
2042
- }
2043
- function getExceptionName(object) {
2044
- if (isError(object)) {
2045
- return object[_DYN_NAME$1 ];
2046
- }
2047
- return STR_EMPTY$1;
2048
- }
2049
- function _createProxyFunction(source, funcName) {
2050
- var srcFunc = null;
2051
- var src = null;
2052
- if (isFunction(source)) {
2053
- srcFunc = source;
2054
- }
2055
- else {
2056
- src = source;
2057
- }
2058
- return function () {
2059
- var originalArguments = arguments;
2060
- if (srcFunc) {
2061
- src = srcFunc();
2062
- }
2063
- if (src) {
2064
- return src[funcName][_DYN_APPLY ](src, originalArguments);
2065
- }
2066
- };
2067
- }
2068
- function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
2069
- if (target && name && source) {
2070
- if (overwriteTarget !== false || isUndefined(target[name])) {
2071
- target[name] = _createProxyFunction(source, theFunc);
2072
- }
2073
- }
2074
- }
2075
- function getResponseText(xhr) {
2076
- try {
2077
- return xhr.responseText;
2078
- }
2079
- catch (e) {
2080
- }
2081
- return null;
2082
- }
2083
- function formatErrorMessageXdr(xdr, message) {
2084
- if (xdr) {
2085
- return "XDomainRequest,Response:" + getResponseText(xdr) || "";
2086
- }
2087
- return message;
2088
- }
2089
- function formatErrorMessageXhr(xhr, message) {
2090
- if (xhr) {
2091
- return "XMLHttpRequest,Status:" + xhr[_DYN_STATUS ] + ",Response:" + getResponseText(xhr) || xhr.response || "";
2092
- }
2093
- return message;
2094
- }
2095
- function prependTransports(theTransports, newTransports) {
2096
- if (newTransports) {
2097
- if (isNumber(newTransports)) {
2098
- theTransports = [newTransports].concat(theTransports);
2099
- }
2100
- else if (isArray(newTransports)) {
2101
- theTransports = newTransports.concat(theTransports);
2102
- }
2103
- }
2104
- return theTransports;
2105
- }
2106
- function parseResponse(response, diagLog) {
2107
- try {
2108
- if (response && response !== "") {
2109
- var result = getJSON().parse(response);
2110
- if (result && result[_DYN_ITEMS_RECEIVED ] && result[_DYN_ITEMS_RECEIVED ] >= result.itemsAccepted &&
2111
- result.itemsReceived - result.itemsAccepted === result.errors[_DYN_LENGTH$1 ]) {
2112
- return result;
2113
- }
2114
- }
2115
- }
2116
- catch (e) {
2117
- _throwInternal(diagLog, 1 , 43 , "Cannot parse the response. " + getExceptionName(e), {
2118
- response: response
2119
- });
2120
- }
2121
- return null;
2122
- }
2123
- var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
2124
- var strWithCredentials = "withCredentials";
2125
- var strTimeout = "timeout";
2126
- function openXhr(method, urlString, withCredentials, disabled, isSync, timeout) {
2127
- if (disabled === void 0) { disabled = false; }
2128
- if (isSync === void 0) { isSync = false; }
2129
- function _wrapSetXhrProp(xhr, prop, value) {
2130
- try {
2131
- xhr[prop] = value;
2132
- }
2133
- catch (e) {
2134
- }
2135
- }
2136
- var xhr = new XMLHttpRequest();
2137
- if (disabled) {
2138
- _wrapSetXhrProp(xhr, strDisabledPropertyName, disabled);
2139
- }
2140
- if (withCredentials) {
2141
- _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);
2142
- }
2143
- xhr.open(method, urlString, !isSync);
2144
- if (withCredentials) {
2145
- _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);
2146
- }
2147
- if (!isSync && timeout) {
2148
- _wrapSetXhrProp(xhr, strTimeout, timeout);
2149
- }
2150
- return xhr;
2151
- }
2152
- function convertAllHeadersToMap(headersString) {
2153
- var headers = {};
2154
- if (isString(headersString)) {
2155
- var headersArray = strTrim(headersString)[_DYN_SPLIT$1 ](/[\r\n]+/);
2156
- arrForEach(headersArray, function (headerEntry) {
2157
- if (headerEntry) {
2158
- var idx = headerEntry.indexOf(": ");
2159
- if (idx !== -1) {
2160
- var header = strTrim(headerEntry.substring(0, idx))[_DYN_TO_LOWER_CASE ]();
2161
- var value = strTrim(headerEntry.substring(idx + 1));
2162
- headers[header] = value;
2163
- }
2164
- else {
2165
- headers[strTrim(headerEntry)] = 1;
2166
- }
2167
- }
2168
- });
2169
- }
2170
- return headers;
2171
- }
2172
- function _appendHeader(theHeaders, xhr, name) {
2173
- if (!theHeaders[name] && xhr && xhr[_DYN_GET_RESPONSE_HEADER ]) {
2174
- var value = xhr[_DYN_GET_RESPONSE_HEADER ](name);
2175
- if (value) {
2176
- theHeaders[name] = strTrim(value);
2177
- }
2178
- }
2179
- return theHeaders;
2180
- }
2181
- var STR_KILL_DURATION_HEADER = "kill-duration";
2182
- var STR_KILL_DURATION_SECONDS_HEADER = "kill-duration-seconds";
2183
- var STR_TIME_DELTA_HEADER = "time-delta-millis";
2184
- function _getAllResponseHeaders(xhr, isOneDs) {
2185
- var theHeaders = {};
2186
- if (!xhr[_DYN_GET_ALL_RESPONSE_HEA5 ]) {
2187
- if (!!isOneDs) {
2188
- theHeaders = _appendHeader(theHeaders, xhr, STR_TIME_DELTA_HEADER);
2189
- theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_HEADER);
2190
- theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_SECONDS_HEADER);
2191
- }
2192
- }
2193
- else {
2194
- theHeaders = convertAllHeadersToMap(xhr[_DYN_GET_ALL_RESPONSE_HEA5 ]());
2195
- }
2196
- return theHeaders;
2197
- }
2198
-
2199
- var UInt32Mask = 0x100000000;
2200
- var MaxUInt32 = 0xffffffff;
2201
- var SEED1 = 123456789;
2202
- var SEED2 = 987654321;
2203
- var _mwcSeeded = false;
2204
- var _mwcW = SEED1;
2205
- var _mwcZ = SEED2;
2206
- function _mwcSeed(seedValue) {
2207
- if (seedValue < 0) {
2208
- seedValue >>>= 0;
2209
- }
2210
- _mwcW = (SEED1 + seedValue) & MaxUInt32;
2211
- _mwcZ = (SEED2 - seedValue) & MaxUInt32;
2212
- _mwcSeeded = true;
1957
+ _mwcW = (SEED1 + seedValue) & MaxUInt32;
1958
+ _mwcZ = (SEED2 - seedValue) & MaxUInt32;
1959
+ _mwcSeeded = true;
2213
1960
  }
2214
1961
  function _autoSeedMwc() {
2215
1962
  try {
@@ -2825,6 +2572,7 @@
2825
2572
  configHandler = null;
2826
2573
  }
2827
2574
  };
2575
+ objDefine(handler, "toJSON", { v: function () { return "WatcherHandler" + (handler.fn ? "" : "[X]"); } });
2828
2576
  state.use(handler, configHandler);
2829
2577
  return handler;
2830
2578
  }
@@ -2943,6 +2691,207 @@
2943
2691
 
2944
2692
  var DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
2945
2693
 
2694
+ var _aiNamespace = null;
2695
+ function _getExtensionNamespace() {
2696
+ var target = getInst("Microsoft");
2697
+ if (target) {
2698
+ _aiNamespace = target["ApplicationInsights"];
2699
+ }
2700
+ return _aiNamespace;
2701
+ }
2702
+ function getDebugExt(config) {
2703
+ var ns = _aiNamespace;
2704
+ if (!ns && config.disableDbgExt !== true) {
2705
+ ns = _aiNamespace || _getExtensionNamespace();
2706
+ }
2707
+ return ns ? ns["ChromeDbgExt"] : null;
2708
+ }
2709
+
2710
+ var _a$1;
2711
+ var STR_WARN_TO_CONSOLE = "warnToConsole";
2712
+ var AiNonUserActionablePrefix = "AI (Internal): ";
2713
+ var AiUserActionablePrefix = "AI: ";
2714
+ var AIInternalMessagePrefix = "AITR_";
2715
+ var defaultValues$1 = {
2716
+ loggingLevelConsole: 0,
2717
+ loggingLevelTelemetry: 1,
2718
+ maxMessageLimit: 25,
2719
+ enableDebug: false
2720
+ };
2721
+ var _logFuncs = (_a$1 = {},
2722
+ _a$1[0 ] = null,
2723
+ _a$1[1 ] = "errorToConsole",
2724
+ _a$1[2 ] = STR_WARN_TO_CONSOLE,
2725
+ _a$1[3 ] = "debugToConsole",
2726
+ _a$1);
2727
+ function _sanitizeDiagnosticText(text) {
2728
+ if (text) {
2729
+ return "\"" + text[_DYN_REPLACE ](/\"/g, STR_EMPTY$1) + "\"";
2730
+ }
2731
+ return STR_EMPTY$1;
2732
+ }
2733
+ function _logToConsole(func, message) {
2734
+ var theConsole = getConsole();
2735
+ if (!!theConsole) {
2736
+ var logFunc = "log";
2737
+ if (theConsole[func]) {
2738
+ logFunc = func;
2739
+ }
2740
+ if (isFunction(theConsole[logFunc])) {
2741
+ theConsole[logFunc](message);
2742
+ }
2743
+ }
2744
+ }
2745
+ var _InternalLogMessage = /** @class */ (function () {
2746
+ function _InternalLogMessage(msgId, msg, isUserAct, properties) {
2747
+ if (isUserAct === void 0) { isUserAct = false; }
2748
+ var _self = this;
2749
+ _self[_DYN_MESSAGE_ID ] = msgId;
2750
+ _self[_DYN_MESSAGE ] =
2751
+ (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
2752
+ msgId;
2753
+ var strProps = STR_EMPTY$1;
2754
+ if (hasJSON()) {
2755
+ strProps = getJSON().stringify(properties);
2756
+ }
2757
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : STR_EMPTY$1) +
2758
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : STR_EMPTY$1);
2759
+ _self[_DYN_MESSAGE ] += diagnosticText;
2760
+ }
2761
+ _InternalLogMessage.dataType = "MessageData";
2762
+ return _InternalLogMessage;
2763
+ }());
2764
+ function safeGetLogger(core, config) {
2765
+ return (core || {})[_DYN_LOGGER ] || new DiagnosticLogger(config);
2766
+ }
2767
+ var DiagnosticLogger = /** @class */ (function () {
2768
+ function DiagnosticLogger(config) {
2769
+ this.identifier = "DiagnosticLogger";
2770
+ this.queue = [];
2771
+ var _messageCount = 0;
2772
+ var _messageLogged = {};
2773
+ var _loggingLevelConsole;
2774
+ var _loggingLevelTelemetry;
2775
+ var _maxInternalMessageLimit;
2776
+ var _enableDebug;
2777
+ var _unloadHandler;
2778
+ dynamicProto(DiagnosticLogger, this, function (_self) {
2779
+ _unloadHandler = _setDefaultsFromConfig(config || {});
2780
+ _self.consoleLoggingLevel = function () { return _loggingLevelConsole; };
2781
+ _self[_DYN_THROW_INTERNAL ] = function (severity, msgId, msg, properties, isUserAct) {
2782
+ if (isUserAct === void 0) { isUserAct = false; }
2783
+ var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
2784
+ if (_enableDebug) {
2785
+ throw dumpObj(message);
2786
+ }
2787
+ else {
2788
+ var logFunc = _logFuncs[severity] || STR_WARN_TO_CONSOLE;
2789
+ if (!isUndefined(message[_DYN_MESSAGE ])) {
2790
+ if (isUserAct) {
2791
+ var messageKey = +message[_DYN_MESSAGE_ID ];
2792
+ if (!_messageLogged[messageKey] && _loggingLevelConsole >= severity) {
2793
+ _self[logFunc](message[_DYN_MESSAGE ]);
2794
+ _messageLogged[messageKey] = true;
2795
+ }
2796
+ }
2797
+ else {
2798
+ if (_loggingLevelConsole >= severity) {
2799
+ _self[logFunc](message[_DYN_MESSAGE ]);
2800
+ }
2801
+ }
2802
+ _logInternalMessage(severity, message);
2803
+ }
2804
+ else {
2805
+ _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
2806
+ }
2807
+ }
2808
+ };
2809
+ _self.debugToConsole = function (message) {
2810
+ _logToConsole("debug", message);
2811
+ _debugExtMsg("warning", message);
2812
+ };
2813
+ _self[_DYN_WARN_TO_CONSOLE ] = function (message) {
2814
+ _logToConsole("warn", message);
2815
+ _debugExtMsg("warning", message);
2816
+ };
2817
+ _self.errorToConsole = function (message) {
2818
+ _logToConsole("error", message);
2819
+ _debugExtMsg("error", message);
2820
+ };
2821
+ _self.resetInternalMessageCount = function () {
2822
+ _messageCount = 0;
2823
+ _messageLogged = {};
2824
+ };
2825
+ _self[_DYN_LOG_INTERNAL_MESSAGE ] = _logInternalMessage;
2826
+ _self[_DYN_UNLOAD ] = function (isAsync) {
2827
+ _unloadHandler && _unloadHandler.rm();
2828
+ _unloadHandler = null;
2829
+ };
2830
+ function _logInternalMessage(severity, message) {
2831
+ if (_areInternalMessagesThrottled()) {
2832
+ return;
2833
+ }
2834
+ var logMessage = true;
2835
+ var messageKey = AIInternalMessagePrefix + message[_DYN_MESSAGE_ID ];
2836
+ if (_messageLogged[messageKey]) {
2837
+ logMessage = false;
2838
+ }
2839
+ else {
2840
+ _messageLogged[messageKey] = true;
2841
+ }
2842
+ if (logMessage) {
2843
+ if (severity <= _loggingLevelTelemetry) {
2844
+ _self.queue[_DYN_PUSH$2 ](message);
2845
+ _messageCount++;
2846
+ _debugExtMsg((severity === 1 ? "error" : "warn"), message);
2847
+ }
2848
+ if (_messageCount === _maxInternalMessageLimit) {
2849
+ var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
2850
+ var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
2851
+ _self.queue[_DYN_PUSH$2 ](throttleMessage);
2852
+ if (severity === 1 ) {
2853
+ _self.errorToConsole(throttleLimitMessage);
2854
+ }
2855
+ else {
2856
+ _self[_DYN_WARN_TO_CONSOLE ](throttleLimitMessage);
2857
+ }
2858
+ }
2859
+ }
2860
+ }
2861
+ function _setDefaultsFromConfig(config) {
2862
+ return onConfigChange(createDynamicConfig(config, defaultValues$1, _self).cfg, function (details) {
2863
+ var config = details.cfg;
2864
+ _loggingLevelConsole = config[_DYN_LOGGING_LEVEL_CONSOL4 ];
2865
+ _loggingLevelTelemetry = config.loggingLevelTelemetry;
2866
+ _maxInternalMessageLimit = config.maxMessageLimit;
2867
+ _enableDebug = config.enableDebug;
2868
+ });
2869
+ }
2870
+ function _areInternalMessagesThrottled() {
2871
+ return _messageCount >= _maxInternalMessageLimit;
2872
+ }
2873
+ function _debugExtMsg(name, data) {
2874
+ var dbgExt = getDebugExt(config || {});
2875
+ if (dbgExt && dbgExt[_DYN_DIAG_LOG$1 ]) {
2876
+ dbgExt[_DYN_DIAG_LOG$1 ](name, data);
2877
+ }
2878
+ }
2879
+ });
2880
+ }
2881
+ DiagnosticLogger.__ieDyn=1;
2882
+ return DiagnosticLogger;
2883
+ }());
2884
+ function _getLogger(logger) {
2885
+ return (logger || new DiagnosticLogger());
2886
+ }
2887
+ function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
2888
+ if (isUserAct === void 0) { isUserAct = false; }
2889
+ _getLogger(logger)[_DYN_THROW_INTERNAL ](severity, msgId, msg, properties, isUserAct);
2890
+ }
2891
+ function _warnToConsole(logger, message) {
2892
+ _getLogger(logger)[_DYN_WARN_TO_CONSOLE ](message);
2893
+ }
2894
+
2946
2895
  var strExecutionContextKey = "ctx";
2947
2896
  var strParentContextKey = "ParentContextKey";
2948
2897
  var strChildrenContextKey = "ChildrenContextKey";
@@ -3611,7 +3560,7 @@
3611
3560
  function _setDefaults(config, core, pluginChain) {
3612
3561
  createDynamicConfig(config, defaultValues, safeGetLogger(core));
3613
3562
  if (!pluginChain && core) {
3614
- pluginChain = core[_DYN_GET_PROCESS_TEL_CONT0 ]()[_DYN_GET_NEXT ]();
3563
+ pluginChain = core[_DYN_GET_PROCESS_TEL_CONT2 ]()[_DYN_GET_NEXT ]();
3615
3564
  }
3616
3565
  var nextPlugin = _nextPlugin;
3617
3566
  if (_nextPlugin && _nextPlugin[strGetPlugin]) {
@@ -3633,6 +3582,24 @@
3633
3582
  return BaseTelemetryPlugin;
3634
3583
  }());
3635
3584
 
3585
+ function parseResponse(response, diagLog) {
3586
+ try {
3587
+ if (response && response !== "") {
3588
+ var result = getJSON().parse(response);
3589
+ if (result && result[_DYN_ITEMS_RECEIVED ] && result[_DYN_ITEMS_RECEIVED ] >= result.itemsAccepted &&
3590
+ result.itemsReceived - result.itemsAccepted === result.errors[_DYN_LENGTH$1 ]) {
3591
+ return result;
3592
+ }
3593
+ }
3594
+ }
3595
+ catch (e) {
3596
+ _throwInternal(diagLog, 1 , 43 , "Cannot parse the response. " + (e[_DYN_NAME$1 ] || dumpObj(e)), {
3597
+ response: response
3598
+ });
3599
+ }
3600
+ return null;
3601
+ }
3602
+
3636
3603
  var STR_EMPTY = "";
3637
3604
  var STR_NO_RESPONSE_BODY = "NoResponseBody";
3638
3605
  var _noResponseQs = "&" + STR_NO_RESPONSE_BODY + "=true";
@@ -6369,7 +6336,7 @@
6369
6336
  return Sender;
6370
6337
  }());
6371
6338
 
6372
- var version = '0.1.1';
6339
+ var version = '0.1.2';
6373
6340
  var DefaultOfflineIdentifier = "OfflineChannel";
6374
6341
  var DefaultBatchInterval = 15000;
6375
6342
  var DefaultInMemoMaxTime = 15000;