@microsoft/applicationinsights-channel-js 3.0.0-beta.2209-03 → 3.0.0-beta.2210-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.
Files changed (38) hide show
  1. package/browser/applicationinsights-channel-js.integrity.json +9 -9
  2. package/browser/applicationinsights-channel-js.js +946 -428
  3. package/browser/applicationinsights-channel-js.js.map +1 -1
  4. package/browser/applicationinsights-channel-js.min.js +2 -2
  5. package/browser/applicationinsights-channel-js.min.js.map +1 -1
  6. package/dist/applicationinsights-channel-js.api.json +2 -2
  7. package/dist/applicationinsights-channel-js.d.ts +22 -22
  8. package/dist/applicationinsights-channel-js.js +946 -428
  9. package/dist/applicationinsights-channel-js.js.map +1 -1
  10. package/dist/applicationinsights-channel-js.min.js +2 -2
  11. package/dist/applicationinsights-channel-js.min.js.map +1 -1
  12. package/dist/applicationinsights-channel-js.rollup.d.ts +22 -22
  13. package/dist-esm/EnvelopeCreator.js +2 -2
  14. package/dist-esm/EnvelopeCreator.js.map +1 -1
  15. package/dist-esm/Interfaces.js +1 -1
  16. package/dist-esm/InternalConstants.js +1 -1
  17. package/dist-esm/Offline.js +1 -1
  18. package/dist-esm/SendBuffer.js +9 -11
  19. package/dist-esm/SendBuffer.js.map +1 -1
  20. package/dist-esm/Sender.js +186 -135
  21. package/dist-esm/Sender.js.map +1 -1
  22. package/dist-esm/Serializer.js +2 -3
  23. package/dist-esm/Serializer.js.map +1 -1
  24. package/dist-esm/TelemetryProcessors/Sample.js +1 -1
  25. package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js +1 -1
  26. package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js +1 -1
  27. package/dist-esm/__DynamicConstants.js +11 -15
  28. package/dist-esm/__DynamicConstants.js.map +1 -1
  29. package/dist-esm/applicationinsights-channel-js.js +1 -1
  30. package/package.json +4 -4
  31. package/src/Interfaces.ts +17 -17
  32. package/src/SendBuffer.ts +5 -5
  33. package/src/Sender.ts +194 -129
  34. package/src/__DynamicConstants.ts +10 -14
  35. package/types/Interfaces.d.ts +17 -17
  36. package/types/Sender.d.ts +4 -4
  37. package/types/__DynamicConstants.d.ts +5 -9
  38. package/types/tsdoc-metadata.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Channel, 3.0.0-beta.2209-03
2
+ * Application Insights JavaScript SDK - Channel, 3.0.0-beta.2210-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -18,7 +18,6 @@
18
18
  var ObjAssign = ObjClass$1["assign"];
19
19
  var ObjCreate = ObjClass$1["create"];
20
20
  var ObjDefineProperty = ObjClass$1["defineProperty"];
21
- var ObjHasOwnProperty = ObjProto$1[strShimHasOwnProperty];
22
21
 
23
22
  var _cachedGlobal$1 = null;
24
23
  function getGlobal$1(useCached) {
@@ -356,13 +355,18 @@
356
355
  var STRING = "string";
357
356
  var UNDEFINED = "undefined";
358
357
  var HAS_OWN_PROPERTY = "hasOwnProperty";
358
+ var SYMBOL = "Symbol";
359
+ var POLYFILL_TAG = "_polyfill";
359
360
  var INDEX_OF = "indexOf";
360
361
  var LENGTH = "length";
362
+ var DONE = "done";
363
+ var VALUE = "value";
361
364
  var ObjClass = Object;
362
365
  var ObjProto = ObjClass[PROTOTYPE];
363
366
  var StrCls = String;
364
367
  var StrProto = StrCls[PROTOTYPE];
365
368
  var ArrCls = Array;
369
+ var ArrProto = ArrCls[PROTOTYPE];
366
370
 
367
371
  function _safeCheck(cb, defValue) {
368
372
  var result = defValue;
@@ -475,7 +479,7 @@
475
479
  return objHasOwnProperty(obj, prop) || !!objGetOwnPropertyDescriptor(obj, prop);
476
480
  }
477
481
 
478
- function objForEachKey(theObject, callbackfn, thisArg) {
482
+ function objForEachKey$1(theObject, callbackfn, thisArg) {
479
483
  if (theObject && isObject(theObject)) {
480
484
  for (var prop in theObject) {
481
485
  if (objHasOwn(theObject, prop)) {
@@ -504,6 +508,7 @@
504
508
  throw new TypeError(message);
505
509
  }
506
510
 
511
+ ObjClass["assign"];
507
512
  var _objFreeze = ObjClass["freeze"];
508
513
  function _doNothing(value) {
509
514
  return value;
@@ -516,7 +521,7 @@
516
521
  }
517
522
  function objDeepFreeze(value) {
518
523
  if (_objFreeze) {
519
- objForEachKey(value, function (key, value) {
524
+ objForEachKey$1(value, function (key, value) {
520
525
  if (isArray(value) || isObject(value)) {
521
526
  _objFreeze(value);
522
527
  }
@@ -525,10 +530,11 @@
525
530
  return objFreeze(value);
526
531
  }
527
532
  var objFreeze = _objFreeze || _doNothing;
533
+ ObjClass["seal"] || _doNothing;
528
534
 
529
535
  function createEnum(values) {
530
536
  var theEnum = {};
531
- objForEachKey(values, function (field, value) {
537
+ objForEachKey$1(values, function (field, value) {
532
538
  theEnum[field] = value;
533
539
  theEnum[value] = field;
534
540
  });
@@ -536,7 +542,7 @@
536
542
  }
537
543
  function createSimpleMap(values) {
538
544
  var mapClass = {};
539
- objForEachKey(values, function (field, value) {
545
+ objForEachKey$1(values, function (field, value) {
540
546
  mapClass[field] = value[1];
541
547
  mapClass[value[0]] = value[1];
542
548
  });
@@ -546,6 +552,65 @@
546
552
  return createSimpleMap(values);
547
553
  }
548
554
 
555
+ var POLY_GLOBAL_REGISTORT = "__polySymbols$ts_utils";
556
+ var _polySymbols;
557
+ function _globalSymbolRegistry() {
558
+ if (!_polySymbols) {
559
+ var gbl = getGlobal();
560
+ _polySymbols = gbl[POLY_GLOBAL_REGISTORT] = gbl[POLY_GLOBAL_REGISTORT] || { k: {}, s: {} };
561
+ }
562
+ return _polySymbols;
563
+ }
564
+ function polyNewSymbol(description) {
565
+ var theSymbol = {
566
+ description: "" + description,
567
+ toString: function () { return SYMBOL + "(" + description + ")"; }
568
+ };
569
+ theSymbol[POLYFILL_TAG] = true;
570
+ return theSymbol;
571
+ }
572
+ function polySymbolFor(key) {
573
+ var registry = _globalSymbolRegistry();
574
+ if (!objHasOwn(registry, key)) {
575
+ var newSymbol = polyNewSymbol(key);
576
+ registry.k[key] = newSymbol;
577
+ registry.s[newSymbol] = "" + key;
578
+ }
579
+ return registry.k[key];
580
+ }
581
+
582
+ var _hasSymbol = _safeCheck(function () { return isDefined(Symbol); }, false);
583
+ var _symbol = getInst(SYMBOL);
584
+ var _symbolFor = _symbol && _safeCheck(function () { return _symbol["for"]; }, null);
585
+ _symbol && _safeCheck(function () { return _symbol["keyFor"]; }, null);
586
+ function newSymbol(description, noPoly) {
587
+ return _hasSymbol ? Symbol(description) : (!noPoly ? polyNewSymbol(description) : null);
588
+ }
589
+ var symbolFor = _symbolFor || polySymbolFor;
590
+
591
+ function isIterator(value) {
592
+ return !!value && isFunction(value.next);
593
+ }
594
+
595
+ function arrAppend(target, elms) {
596
+ if (!isUndefined(elms) && target) {
597
+ if (isArray(elms)) {
598
+ ArrProto.push.apply(target, elms);
599
+ }
600
+ else if (isIterator(elms)) {
601
+ var value = elms.next();
602
+ while (!value[DONE]) {
603
+ target.push(value[VALUE]);
604
+ value = elms.next();
605
+ }
606
+ }
607
+ else {
608
+ target.push(elms);
609
+ }
610
+ }
611
+ return target;
612
+ }
613
+
549
614
  function dumpObj(object, format) {
550
615
  var objectTypeDump = objToString(object);
551
616
  var propertyValueDump = "";
@@ -591,7 +656,7 @@
591
656
  d.__proto__ = b;
592
657
  }) ||
593
658
  function (d, b) {
594
- objForEachKey(b, function (key, value) {
659
+ objForEachKey$1(b, function (key, value) {
595
660
  d[key] = value;
596
661
  });
597
662
  };
@@ -657,6 +722,8 @@
657
722
 
658
723
  var strIndexOf = _unwrapFunction(INDEX_OF);
659
724
 
725
+ var asString = StrCls;
726
+
660
727
  function _createTrimFn(exp) {
661
728
  return function _doTrim(value) {
662
729
  if (isNullOrUndefined(value)) {
@@ -676,45 +743,53 @@
676
743
  var createEnumStyle = createEnum;
677
744
  var createValueMap = createTypeMap;
678
745
 
746
+ var _DYN_LENGTH$2 = "length";
747
+ var _DYN_NOTIFY = "notify";
748
+ var _DYN_THROW_INTERNAL = "throwInternal";
749
+ var _DYN_WATCH = "watch";
750
+ var _DYN_LOGGER = "logger";
751
+ var _DYN_CONFIGURABLE = "configurable";
752
+ var _DYN_ENUMERABLE = "enumerable";
753
+ var _DYN_APPLY = "apply";
754
+ var _DYN_INDEX_OF$1 = "indexOf";
755
+ var _DYN_PUSH$1 = "push";
679
756
  var _DYN_INITIALIZE = "initialize";
680
- var _DYN_NAME$2 = "name";
681
757
  var _DYN_IDENTIFIER = "identifier";
682
- var _DYN_PUSH$1 = "push";
758
+ var _DYN_SPLICE = "splice";
683
759
  var _DYN_IS_INITIALIZED = "isInitialized";
684
- var _DYN_CONFIG = "config";
685
- var _DYN_LOGGER = "logger";
686
- var _DYN_LENGTH$2 = "length";
760
+ var _DYN_NAME$2 = "name";
687
761
  var _DYN_TIME = "time";
688
762
  var _DYN_PROCESS_NEXT = "processNext";
689
763
  var _DYN_GET_PROCESS_TEL_CONT0 = "getProcessTelContext";
764
+ var _DYN_CALL = "call";
690
765
  var _DYN_GET_PLUGIN = "getPlugin";
691
- var _DYN_SPLICE = "splice";
766
+ var _DYN_LOGGING_LEVEL_CONSOL4 = "loggingLevelConsole";
692
767
  var _DYN_TEARDOWN = "teardown";
693
768
  var _DYN_MESSAGE_ID = "messageId";
694
769
  var _DYN_MESSAGE$1 = "message";
695
770
  var _DYN_IS_ASYNC = "isAsync";
771
+ var _DYN_DIAG_LOG$1 = "diagLog";
696
772
  var _DYN__DO_TEARDOWN = "_doTeardown";
697
773
  var _DYN_UPDATE = "update";
698
774
  var _DYN_GET_NEXT = "getNext";
699
- var _DYN_DIAG_LOG$1 = "diagLog";
700
775
  var _DYN_SET_NEXT_PLUGIN = "setNextPlugin";
701
776
  var _DYN_CREATE_NEW = "createNew";
777
+ var _DYN_CONFIG = "config";
702
778
  var _DYN_USER_AGENT = "userAgent";
703
779
  var _DYN_SPLIT$1 = "split";
704
780
  var _DYN_NODE_TYPE = "nodeType";
705
- var _DYN_APPLY = "apply";
706
781
  var _DYN_REPLACE = "replace";
707
- var _DYN_ENABLE_DEBUG_EXCEPTI4 = "enableDebugExceptions";
782
+ var _DYN_ENABLE_DEBUG_EXCEPTI5 = "enableDebugExceptions";
708
783
  var _DYN_LOG_INTERNAL_MESSAGE = "logInternalMessage";
709
784
  var _DYN_TO_LOWER_CASE$1 = "toLowerCase";
710
785
  var _DYN_TYPE = "type";
711
786
  var _DYN_HANDLER = "handler";
712
- var _DYN_CALL = "call";
713
787
  var _DYN_IS_CHILD_EVT = "isChildEvt";
714
788
  var _DYN_GET_CTX = "getCtx";
715
789
  var _DYN_SET_CTX = "setCtx";
716
790
  var _DYN_COMPLETE = "complete";
717
791
 
792
+ var UNDEFINED_VALUE$1 = undefined;
718
793
  var STR_EMPTY = "";
719
794
  var STR_CORE = "core";
720
795
  var STR_DISABLED = "disabled";
@@ -724,42 +799,20 @@
724
799
  var STR_ERROR_TO_CONSOLE = "errorToConsole";
725
800
  var STR_WARN_TO_CONSOLE = "warnToConsole";
726
801
  var STR_GET_PERF_MGR = "getPerfMgr";
802
+ var STR_NOT_DYNAMIC_ERROR = "Not dynamic - ";
727
803
 
728
- var _aiNamespace = null;
729
- function _getExtensionNamespace() {
730
- var target = getInst("Microsoft");
731
- if (target) {
732
- _aiNamespace = target["ApplicationInsights"];
733
- }
734
- return _aiNamespace;
735
- }
736
- function getDebugExt(config) {
737
- var ns = _aiNamespace;
738
- if (!ns && config.disableDbgExt !== true) {
739
- ns = _aiNamespace || _getExtensionNamespace();
740
- }
741
- return ns ? ns["ChromeDbgExt"] : null;
742
- }
743
-
744
- var cString = "String";
745
- var cObject = "Object";
746
- var strToISOString = "toISOString";
747
804
  var strToString = "toString";
748
805
  var strGetPrototypeOf = "getPrototypeOf";
749
806
  var strConstructor = "constructor";
750
- var DateProto = Date[strShimPrototype];
751
- var _dateToISOString = DateProto[strToISOString] || _polyfillRequired("Date", strToISOString);
752
- var _fnToString = ObjHasOwnProperty[strToString] || _polyfillRequired(cString, strToString);
807
+ var _fnToString = ObjClass$1[strToString];
753
808
  var _objFunctionString = _fnToString[_DYN_CALL ](ObjClass$1);
754
809
  var rCamelCase = /-([a-z])/g;
755
810
  var rNormalizeInvalid = /([^\w\d_$])/g;
756
811
  var rLeadingNumeric = /^(\d+[\w\d_$])/;
757
- function _polyfillRequired(object, name) {
758
- return function () {
759
- throwUnsupported("Polyfill required for [" + name + "]");
760
- };
812
+ var _getObjProto = Object[strGetPrototypeOf];
813
+ function isNotNullOrUndefined(value) {
814
+ return !isNullOrUndefined(value);
761
815
  }
762
- var _getObjProto = Object[strGetPrototypeOf] || _polyfillRequired(cObject, strGetPrototypeOf);
763
816
  function normalizeJsName(name) {
764
817
  var value = name;
765
818
  if (value && isString(value)) {
@@ -773,6 +826,7 @@
773
826
  }
774
827
  return value;
775
828
  }
829
+ var objForEachKey = objForEachKey$1;
776
830
  function strContains(value, search) {
777
831
  if (value && search) {
778
832
  return strIndexOf(value, search) !== -1;
@@ -787,7 +841,7 @@
787
841
  result = true;
788
842
  }
789
843
  else {
790
- if (proto[strConstructor] && ObjHasOwnProperty[_DYN_CALL ](proto, strConstructor)) {
844
+ if (proto[strConstructor] && objHasOwnProperty(proto, strConstructor)) {
791
845
  proto = proto[strConstructor];
792
846
  }
793
847
  result = typeof proto === strShimFunction && _fnToString[_DYN_CALL ](proto) === _objFunctionString;
@@ -796,7 +850,7 @@
796
850
  return result;
797
851
  }
798
852
  function toISOString(date) {
799
- return _dateToISOString[_DYN_CALL ](date);
853
+ return date && date.toISOString() || "";
800
854
  }
801
855
  function dateNow() {
802
856
  var dt = Date;
@@ -819,9 +873,6 @@
819
873
  }
820
874
  return theValue;
821
875
  }
822
- function getCfgValue(theValue, defaultValue) {
823
- return !isNullOrUndefined(theValue) ? theValue : defaultValue;
824
- }
825
876
  function _createProxyFunction(source, funcName) {
826
877
  var srcFunc = null;
827
878
  var src = null;
@@ -886,7 +937,7 @@
886
937
  var isArgArray = isArray(arg);
887
938
  var isArgObj = isObject(arg);
888
939
  for (var prop in arg) {
889
- var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty[_DYN_CALL ](arg, prop)));
940
+ var propOk = (isArgArray && (prop in arg)) || (isArgObj && objHasOwn(arg, prop));
890
941
  if (!propOk) {
891
942
  continue;
892
943
  }
@@ -912,6 +963,122 @@
912
963
  return extended;
913
964
  }
914
965
 
966
+ var CFG_HANDLER_LINK = symbolFor("[[ai_dynCfg_1]]");
967
+ function _cfgDeepCopy(source) {
968
+ if (source) {
969
+ if (isArray(source)) {
970
+ var result_1 = [];
971
+ result_1[_DYN_LENGTH$2 ] = source[_DYN_LENGTH$2 ];
972
+ arrForEach(source, function (value, idx) {
973
+ result_1[idx] = _cfgDeepCopy(value);
974
+ });
975
+ return result_1;
976
+ }
977
+ if (isPlainObject(source)) {
978
+ var target_1 = {};
979
+ objForEachKey$1(source, function (key, value) {
980
+ target_1[key] = _cfgDeepCopy(value);
981
+ });
982
+ return target_1;
983
+ }
984
+ }
985
+ return source;
986
+ }
987
+ function getDynamicConfigHandler(value) {
988
+ if (value) {
989
+ var handler = value[CFG_HANDLER_LINK] || value;
990
+ if (handler.cfg && (handler.cfg === value || handler.cfg[CFG_HANDLER_LINK] === handler)) {
991
+ return handler;
992
+ }
993
+ }
994
+ return null;
995
+ }
996
+ function throwInvalidAccess(message) {
997
+ throwTypeError("InvalidAccess:" + message);
998
+ }
999
+
1000
+ function _getDefault(dynamicHandler, theConfig, cfgDefaults) {
1001
+ var defValue;
1002
+ var isDefaultValid = cfgDefaults.dfVal || isDefined;
1003
+ if (theConfig && cfgDefaults.fb) {
1004
+ var fallbacks = cfgDefaults.fb;
1005
+ if (!isArray(fallbacks)) {
1006
+ fallbacks = [fallbacks];
1007
+ }
1008
+ for (var lp = 0; lp < fallbacks[_DYN_LENGTH$2 ]; lp++) {
1009
+ var fallback = fallbacks[lp];
1010
+ var fbValue = theConfig[fallback];
1011
+ if (isDefaultValid(fbValue)) {
1012
+ defValue = fbValue;
1013
+ }
1014
+ else {
1015
+ fbValue = dynamicHandler.cfg[fallback];
1016
+ if (isDefaultValid(fbValue)) {
1017
+ defValue = fbValue;
1018
+ }
1019
+ dynamicHandler.set(dynamicHandler.cfg, asString(fallback), fbValue);
1020
+ }
1021
+ if (isDefaultValid(defValue)) {
1022
+ break;
1023
+ }
1024
+ }
1025
+ }
1026
+ if (!isDefaultValid(defValue) && isDefaultValid(cfgDefaults.v)) {
1027
+ defValue = cfgDefaults.v;
1028
+ }
1029
+ return defValue;
1030
+ }
1031
+ function _applyDefaultValue(theConfig, name, defaultValue) {
1032
+ var dynamicHandler = theConfig[CFG_HANDLER_LINK];
1033
+ if (!dynamicHandler) {
1034
+ throwInvalidAccess(STR_NOT_DYNAMIC_ERROR + dumpObj(theConfig));
1035
+ }
1036
+ var isValid;
1037
+ var setFn;
1038
+ var defValue;
1039
+ var cfgDefaults = defaultValue;
1040
+ if (cfgDefaults && isObject(cfgDefaults) && (cfgDefaults.isVal || cfgDefaults.set || cfgDefaults.fb || objHasOwn(cfgDefaults, "v"))) {
1041
+ isValid = cfgDefaults.isVal;
1042
+ setFn = cfgDefaults.set;
1043
+ defValue = _getDefault(dynamicHandler, theConfig, cfgDefaults);
1044
+ }
1045
+ else {
1046
+ defValue = defaultValue;
1047
+ }
1048
+ var theValue = defValue;
1049
+ var usingDefault = true;
1050
+ var cfgValue = theConfig[name];
1051
+ if (cfgValue || !isNullOrUndefined(cfgValue)) {
1052
+ theValue = cfgValue;
1053
+ usingDefault = false;
1054
+ }
1055
+ if (!usingDefault) {
1056
+ if (isValid && theValue !== defValue && !isValid(theValue)) {
1057
+ theValue = defValue;
1058
+ usingDefault = true;
1059
+ }
1060
+ if (setFn) {
1061
+ theValue = setFn(theValue, defValue, theConfig);
1062
+ usingDefault = theValue === defValue;
1063
+ }
1064
+ }
1065
+ if (theValue && usingDefault && (isPlainObject(theValue) || isArray(theValue))) {
1066
+ theValue = _cfgDeepCopy(theValue);
1067
+ }
1068
+ dynamicHandler.set(theConfig, name, theValue);
1069
+ }
1070
+ function applyDefaults(theConfig, defaultValues) {
1071
+ if (defaultValues) {
1072
+ if (theConfig && !theConfig[CFG_HANDLER_LINK] && (isPlainObject(theConfig) || isArray(theConfig))) {
1073
+ throwInvalidAccess(STR_NOT_DYNAMIC_ERROR + dumpObj(theConfig));
1074
+ }
1075
+ objForEachKey(defaultValues, function (name, value) {
1076
+ _applyDefaultValue(theConfig, name, value);
1077
+ });
1078
+ }
1079
+ return theConfig;
1080
+ }
1081
+
915
1082
  var strDocumentMode = "documentMode";
916
1083
  var strConsole = "console";
917
1084
  var strJSON = "JSON";
@@ -985,61 +1152,499 @@
985
1152
  var navigator_1 = getNavigator() || {};
986
1153
  userAgentStr = navigator_1 ? (navigator_1[_DYN_USER_AGENT ] || STR_EMPTY)[_DYN_TO_LOWER_CASE$1 ]() : STR_EMPTY;
987
1154
  }
988
- var ua = (userAgentStr || STR_EMPTY)[_DYN_TO_LOWER_CASE$1 ]();
989
- if (strContains(ua, strMsie)) {
990
- var doc = getDocument() || {};
991
- return Math.max(parseInt(ua[_DYN_SPLIT$1 ](strMsie)[1]), (doc[strDocumentMode] || 0));
1155
+ var ua = (userAgentStr || STR_EMPTY)[_DYN_TO_LOWER_CASE$1 ]();
1156
+ if (strContains(ua, strMsie)) {
1157
+ var doc = getDocument() || {};
1158
+ return Math.max(parseInt(ua[_DYN_SPLIT$1 ](strMsie)[1]), (doc[strDocumentMode] || 0));
1159
+ }
1160
+ else if (strContains(ua, strTrident)) {
1161
+ var tridentVer = parseInt(ua[_DYN_SPLIT$1 ](strTrident)[1]);
1162
+ if (tridentVer) {
1163
+ return tridentVer + 4;
1164
+ }
1165
+ }
1166
+ return null;
1167
+ }
1168
+ function isBeaconsSupported() {
1169
+ if (_beaconsSupported === null) {
1170
+ _beaconsSupported = hasNavigator() && Boolean(getNavigator().sendBeacon);
1171
+ }
1172
+ return _beaconsSupported;
1173
+ }
1174
+ function isFetchSupported(withKeepAlive) {
1175
+ var isSupported = false;
1176
+ try {
1177
+ isSupported = !!getInst("fetch");
1178
+ var request = getInst("Request");
1179
+ if (isSupported && withKeepAlive && request) {
1180
+ isSupported = _hasProperty(request, "keepalive");
1181
+ }
1182
+ }
1183
+ catch (e) {
1184
+ }
1185
+ return isSupported;
1186
+ }
1187
+ function useXDomainRequest() {
1188
+ if (_useXDomainRequest === null) {
1189
+ _useXDomainRequest = (typeof XDomainRequest !== strShimUndefined);
1190
+ if (_useXDomainRequest && isXhrSupported()) {
1191
+ _useXDomainRequest = _useXDomainRequest && !_hasProperty(getInst(strXMLHttpRequest), "withCredentials");
1192
+ }
1193
+ }
1194
+ return _useXDomainRequest;
1195
+ }
1196
+ function isXhrSupported() {
1197
+ var isSupported = false;
1198
+ try {
1199
+ var xmlHttpRequest = getInst(strXMLHttpRequest);
1200
+ isSupported = !!xmlHttpRequest;
1201
+ }
1202
+ catch (e) {
1203
+ }
1204
+ return isSupported;
1205
+ }
1206
+
1207
+ var UInt32Mask = 0x100000000;
1208
+ var MaxUInt32 = 0xffffffff;
1209
+ var _mwcSeeded = false;
1210
+ var _mwcW = 123456789;
1211
+ var _mwcZ = 987654321;
1212
+ function _mwcSeed(seedValue) {
1213
+ if (seedValue < 0) {
1214
+ seedValue >>>= 0;
1215
+ }
1216
+ _mwcW = (123456789 + seedValue) & MaxUInt32;
1217
+ _mwcZ = (987654321 - seedValue) & MaxUInt32;
1218
+ _mwcSeeded = true;
1219
+ }
1220
+ function _autoSeedMwc() {
1221
+ try {
1222
+ var now = dateNow() & 0x7fffffff;
1223
+ _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1224
+ }
1225
+ catch (e) {
1226
+ }
1227
+ }
1228
+ function random32(signed) {
1229
+ var value = 0;
1230
+ var c = getCrypto() || getMsCrypto();
1231
+ if (c && c.getRandomValues) {
1232
+ value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1233
+ }
1234
+ if (value === 0 && isIE()) {
1235
+ if (!_mwcSeeded) {
1236
+ _autoSeedMwc();
1237
+ }
1238
+ value = mwcRandom32() & MaxUInt32;
1239
+ }
1240
+ if (value === 0) {
1241
+ value = Math.floor((UInt32Mask * Math.random()) | 0);
1242
+ }
1243
+ if (!signed) {
1244
+ value >>>= 0;
1245
+ }
1246
+ return value;
1247
+ }
1248
+ function mwcRandom32(signed) {
1249
+ _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1250
+ _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1251
+ var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1252
+ if (!signed) {
1253
+ value >>>= 0;
1254
+ }
1255
+ return value;
1256
+ }
1257
+ function newId(maxLength) {
1258
+ if (maxLength === void 0) { maxLength = 22; }
1259
+ var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1260
+ var number = random32() >>> 0;
1261
+ var chars = 0;
1262
+ var result = STR_EMPTY;
1263
+ while (result[_DYN_LENGTH$2 ] < maxLength) {
1264
+ chars++;
1265
+ result += base64chars.charAt(number & 0x3F);
1266
+ number >>>= 6;
1267
+ if (chars === 5) {
1268
+ number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1269
+ chars = 0;
1270
+ }
1271
+ }
1272
+ return result;
1273
+ }
1274
+
1275
+ var _objDefineProperty = ObjDefineProperty;
1276
+ var version = "3.0.0-beta.2210-02";
1277
+ var instanceName = "." + newId(6);
1278
+ var _dataUid = 0;
1279
+ function _createAccessor(target, prop, value) {
1280
+ var _a;
1281
+ if (_objDefineProperty) {
1282
+ try {
1283
+ _objDefineProperty(target, prop, (_a = {
1284
+ value: value
1285
+ },
1286
+ _a[_DYN_ENUMERABLE ] = false,
1287
+ _a[_DYN_CONFIGURABLE ] = true,
1288
+ _a));
1289
+ return true;
1290
+ }
1291
+ catch (e) {
1292
+ }
1293
+ }
1294
+ return false;
1295
+ }
1296
+ function _canAcceptData(target) {
1297
+ return target[_DYN_NODE_TYPE ] === 1 || target[_DYN_NODE_TYPE ] === 9 || !(+target[_DYN_NODE_TYPE ]);
1298
+ }
1299
+ function _getCache(data, target) {
1300
+ var theCache = target[data.id];
1301
+ if (!theCache) {
1302
+ theCache = {};
1303
+ try {
1304
+ if (_canAcceptData(target)) {
1305
+ if (!_createAccessor(target, data.id, theCache)) {
1306
+ target[data.id] = theCache;
1307
+ }
1308
+ }
1309
+ }
1310
+ catch (e) {
1311
+ }
1312
+ }
1313
+ return theCache;
1314
+ }
1315
+ function createUniqueNamespace(name, includeVersion) {
1316
+ if (includeVersion === void 0) { includeVersion = false; }
1317
+ return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : STR_EMPTY) + instanceName);
1318
+ }
1319
+ function createElmNodeData(name) {
1320
+ var data = {
1321
+ id: createUniqueNamespace("_aiData-" + (name || STR_EMPTY) + "." + version),
1322
+ accept: function (target) {
1323
+ return _canAcceptData(target);
1324
+ },
1325
+ get: function (target, name, defValue, addDefault) {
1326
+ var theCache = target[data.id];
1327
+ if (!theCache) {
1328
+ if (addDefault) {
1329
+ theCache = _getCache(data, target);
1330
+ theCache[normalizeJsName(name)] = defValue;
1331
+ }
1332
+ return defValue;
1333
+ }
1334
+ return theCache[normalizeJsName(name)];
1335
+ },
1336
+ kill: function (target, name) {
1337
+ if (target && target[name]) {
1338
+ try {
1339
+ delete target[name];
1340
+ }
1341
+ catch (e) {
1342
+ }
1343
+ }
1344
+ }
1345
+ };
1346
+ return data;
1347
+ }
1348
+
1349
+ var arrayMethodsToPatch = [
1350
+ "push",
1351
+ "pop",
1352
+ "shift",
1353
+ "unshift",
1354
+ "splice"
1355
+ ];
1356
+ function _patchArray(state, target) {
1357
+ if (isArray(target)) {
1358
+ arrForEach(arrayMethodsToPatch, function (method) {
1359
+ var orgMethod = target[method];
1360
+ target[method] = function () {
1361
+ var args = [];
1362
+ for (var _i = 0; _i < arguments.length; _i++) {
1363
+ args[_i] = arguments[_i];
1364
+ }
1365
+ var result = orgMethod[_DYN_APPLY ](this, args);
1366
+ _makeDynamicObject(state, target);
1367
+ return result;
1368
+ };
1369
+ });
1370
+ }
1371
+ }
1372
+ function _makeDynamicProperty(state, theConfig, name, value) {
1373
+ var detail = {
1374
+ n: name,
1375
+ h: [],
1376
+ add: function (handler) {
1377
+ if (handler && handler.fn && detail.h[_DYN_INDEX_OF$1 ](handler) === -1) {
1378
+ detail.h[_DYN_PUSH$1 ](handler);
1379
+ }
1380
+ }
1381
+ };
1382
+ var checkDynamic = true;
1383
+ function _getProperty() {
1384
+ if (checkDynamic) {
1385
+ if (value && !value[CFG_HANDLER_LINK] && (isPlainObject(value) || isArray(value))) {
1386
+ value = _makeDynamicObject(state, value);
1387
+ }
1388
+ checkDynamic = false;
1389
+ }
1390
+ var activeHandler = state.act;
1391
+ if (activeHandler) {
1392
+ detail.add(activeHandler);
1393
+ }
1394
+ return value;
1395
+ }
1396
+ _getProperty[state.prop] = true;
1397
+ function _setProperty(newValue) {
1398
+ if (value !== newValue) {
1399
+ if (!!_setProperty[state.ro] && state.upd) {
1400
+ throwInvalidAccess("[" + name + "] is sealed from " + dumpObj(theConfig));
1401
+ }
1402
+ if (value && value[CFG_HANDLER_LINK]) {
1403
+ if (isPlainObject(value)) {
1404
+ objForEachKey$1(value, function (key) {
1405
+ value[key] = UNDEFINED_VALUE$1;
1406
+ });
1407
+ }
1408
+ else if (isArray(value)) {
1409
+ arrForEach(value, function (propValue, idx) {
1410
+ value[idx] = UNDEFINED_VALUE$1;
1411
+ });
1412
+ }
1413
+ }
1414
+ checkDynamic = false;
1415
+ if (isPlainObject(newValue) || isArray(newValue)) {
1416
+ _makeDynamicObject(state, newValue);
1417
+ }
1418
+ value = newValue;
1419
+ state.add(detail);
1420
+ }
1421
+ }
1422
+ objDefineAccessors(theConfig, detail.n, _getProperty, _setProperty, true);
1423
+ }
1424
+ function _setDynamicProperty(state, target, name, value) {
1425
+ if (target) {
1426
+ var isDynamic = false;
1427
+ var propDesc = objGetOwnPropertyDescriptor(target, name);
1428
+ if (propDesc && propDesc.get) {
1429
+ isDynamic = !!propDesc.get[state.prop];
1430
+ }
1431
+ if (!isDynamic) {
1432
+ _makeDynamicProperty(state, target, name, value);
1433
+ }
1434
+ else {
1435
+ target[name] = value;
1436
+ }
1437
+ }
1438
+ return value;
1439
+ }
1440
+ function _makeDynamicObject(state, target ) {
1441
+ var _a;
1442
+ objForEachKey$1( target, function (key, value) {
1443
+ _setDynamicProperty(state, target, key, value);
1444
+ });
1445
+ if (!target[CFG_HANDLER_LINK]) {
1446
+ objDefineProp(target, CFG_HANDLER_LINK, (_a = {},
1447
+ _a[_DYN_CONFIGURABLE ] = false,
1448
+ _a[_DYN_ENUMERABLE ] = false,
1449
+ _a.get = function () {
1450
+ return state.hdlr;
1451
+ },
1452
+ _a));
1453
+ _patchArray(state, target);
1454
+ }
1455
+ return target;
1456
+ }
1457
+
1458
+ var symPrefix = "[[ai_";
1459
+ var symPostfix = "]]";
1460
+ function _insertWatcher(watchers, theDetail) {
1461
+ if (theDetail && theDetail.h && theDetail.h[_DYN_LENGTH$2 ] > 0) {
1462
+ arrForEach(theDetail.h, function (handler) {
1463
+ if (handler && handler.fn && watchers[_DYN_INDEX_OF$1 ](handler) === -1) {
1464
+ watchers[_DYN_PUSH$1 ](handler);
1465
+ }
1466
+ });
1467
+ }
1468
+ }
1469
+ function _createState(cfgHandler) {
1470
+ var _a;
1471
+ var dynamicPropertySymbol = newSymbol(symPrefix + "get" + cfgHandler.uid + symPostfix);
1472
+ var dynamicPropertyReadOnly = newSymbol(symPrefix + "ro" + cfgHandler.uid + symPostfix);
1473
+ var _waitingHandlers = null;
1474
+ var _watcherTimer = null;
1475
+ var theState;
1476
+ function _useHandler(activeHandler, callback) {
1477
+ var prevWatcher = theState.act;
1478
+ try {
1479
+ theState.act = activeHandler;
1480
+ callback({
1481
+ cfg: cfgHandler.cfg,
1482
+ hdlr: cfgHandler
1483
+ });
1484
+ }
1485
+ catch (e) {
1486
+ var message = "Watcher [" + dumpObj(callback) + "] failed [" + dumpObj(e) + "]";
1487
+ var logger = cfgHandler[_DYN_LOGGER ];
1488
+ if (logger) {
1489
+ cfgHandler.logger[_DYN_THROW_INTERNAL ](1 , 107 , message);
1490
+ }
1491
+ else {
1492
+ throwInvalidAccess(message);
1493
+ }
1494
+ }
1495
+ finally {
1496
+ theState.act = prevWatcher || null;
1497
+ }
1498
+ }
1499
+ function _notifyWatchers() {
1500
+ if (_waitingHandlers) {
1501
+ var notifyHandlers = _waitingHandlers;
1502
+ _waitingHandlers = null;
1503
+ if (_watcherTimer) {
1504
+ clearTimeout(_watcherTimer);
1505
+ _watcherTimer = null;
1506
+ }
1507
+ arrForEach(notifyHandlers, function (handler) {
1508
+ if (handler.fn) {
1509
+ _useHandler(handler, handler.fn);
1510
+ }
1511
+ });
1512
+ if (_waitingHandlers) {
1513
+ _notifyWatchers();
1514
+ }
1515
+ }
1516
+ }
1517
+ function _addWatcher(detail) {
1518
+ if (detail && detail.h[_DYN_LENGTH$2 ] > 0) {
1519
+ if (!_waitingHandlers) {
1520
+ _waitingHandlers = [];
1521
+ }
1522
+ if (!_watcherTimer) {
1523
+ _watcherTimer = setTimeout(function () {
1524
+ _watcherTimer = null;
1525
+ _notifyWatchers();
1526
+ }, 0);
1527
+ }
1528
+ _insertWatcher(_waitingHandlers, detail);
1529
+ }
1530
+ }
1531
+ theState = (_a = {
1532
+ prop: dynamicPropertySymbol,
1533
+ ro: dynamicPropertyReadOnly,
1534
+ hdlr: cfgHandler,
1535
+ add: _addWatcher
1536
+ },
1537
+ _a[_DYN_NOTIFY ] = _notifyWatchers,
1538
+ _a.use = _useHandler,
1539
+ _a);
1540
+ return theState;
1541
+ }
1542
+
1543
+ function _createAndUseHandler(state, configHandler) {
1544
+ var handler = {
1545
+ fn: configHandler,
1546
+ rm: function () {
1547
+ handler.fn = null;
1548
+ state = null;
1549
+ configHandler = null;
1550
+ }
1551
+ };
1552
+ state.use(handler, configHandler);
1553
+ return handler;
1554
+ }
1555
+ function _createDynamicHandler(logger, target, inPlace) {
1556
+ var _a, _b;
1557
+ var dynamicConfig = getDynamicConfigHandler(target);
1558
+ if (dynamicConfig) {
1559
+ return dynamicConfig;
1560
+ }
1561
+ var uid = createUniqueNamespace("dyncfg", true);
1562
+ var newTarget = (target && inPlace !== false) ? target : _cfgDeepCopy(target);
1563
+ var theState;
1564
+ function _notifyWatchers() {
1565
+ theState[_DYN_NOTIFY ]();
1566
+ }
1567
+ function _setValue(target, name, value) {
1568
+ return _setDynamicProperty(theState, target, name, value);
1569
+ }
1570
+ function _watch(configHandler) {
1571
+ return _createAndUseHandler(theState, configHandler);
1572
+ }
1573
+ function _block(configHandler) {
1574
+ theState.use(null, configHandler);
1575
+ }
1576
+ var cfgHandler = (_a = {
1577
+ uid: null,
1578
+ cfg: newTarget
1579
+ },
1580
+ _a[_DYN_LOGGER ] = logger,
1581
+ _a[_DYN_NOTIFY ] = _notifyWatchers,
1582
+ _a.set = _setValue,
1583
+ _a[_DYN_WATCH ] = _watch,
1584
+ _a._block = _block,
1585
+ _a);
1586
+ objDefineProp(cfgHandler, "uid", (_b = {},
1587
+ _b[_DYN_CONFIGURABLE ] = false,
1588
+ _b[_DYN_ENUMERABLE ] = false,
1589
+ _b.writable = false,
1590
+ _b.value = uid,
1591
+ _b));
1592
+ theState = _createState(cfgHandler);
1593
+ _makeDynamicObject(theState, newTarget);
1594
+ return cfgHandler;
1595
+ }
1596
+ function _logInvalidAccess(logger, message) {
1597
+ if (logger) {
1598
+ logger[STR_WARN_TO_CONSOLE ](message);
1599
+ logger[_DYN_THROW_INTERNAL ](2 , 108 , message);
992
1600
  }
993
- else if (strContains(ua, strTrident)) {
994
- var tridentVer = parseInt(ua[_DYN_SPLIT$1 ](strTrident)[1]);
995
- if (tridentVer) {
996
- return tridentVer + 4;
997
- }
1601
+ else {
1602
+ throwInvalidAccess(message);
998
1603
  }
999
- return null;
1000
1604
  }
1001
- function isBeaconsSupported() {
1002
- if (_beaconsSupported === null) {
1003
- _beaconsSupported = hasNavigator() && Boolean(getNavigator().sendBeacon);
1605
+ function createDynamicConfig(config, defaultConfig, logger, inPlace) {
1606
+ var dynamic = _createDynamicHandler(logger, config || {}, inPlace);
1607
+ if (defaultConfig) {
1608
+ applyDefaults(dynamic.cfg, defaultConfig);
1004
1609
  }
1005
- return _beaconsSupported;
1610
+ return dynamic;
1006
1611
  }
1007
- function isFetchSupported(withKeepAlive) {
1008
- var isSupported = false;
1009
- try {
1010
- isSupported = !!getInst("fetch");
1011
- var request = getInst("Request");
1012
- if (isSupported && withKeepAlive && request) {
1013
- isSupported = _hasProperty(request, "keepalive");
1014
- }
1612
+ function onConfigChange(config, configHandler, logger) {
1613
+ var handler = config[CFG_HANDLER_LINK] || config;
1614
+ if (handler.cfg && (handler.cfg === config || handler.cfg[CFG_HANDLER_LINK] === handler)) {
1615
+ return handler[_DYN_WATCH ](configHandler);
1015
1616
  }
1016
- catch (e) {
1017
- }
1018
- return isSupported;
1617
+ _logInvalidAccess(logger, STR_NOT_DYNAMIC_ERROR + dumpObj(config));
1618
+ createDynamicConfig(config, null, logger)[_DYN_WATCH ](configHandler);
1019
1619
  }
1020
- function useXDomainRequest() {
1021
- if (_useXDomainRequest === null) {
1022
- _useXDomainRequest = (typeof XDomainRequest !== strShimUndefined);
1023
- if (_useXDomainRequest && isXhrSupported()) {
1024
- _useXDomainRequest = _useXDomainRequest && !_hasProperty(getInst(strXMLHttpRequest), "withCredentials");
1025
- }
1620
+
1621
+ var _aiNamespace = null;
1622
+ function _getExtensionNamespace() {
1623
+ var target = getInst("Microsoft");
1624
+ if (target) {
1625
+ _aiNamespace = target["ApplicationInsights"];
1026
1626
  }
1027
- return _useXDomainRequest;
1627
+ return _aiNamespace;
1028
1628
  }
1029
- function isXhrSupported() {
1030
- var isSupported = false;
1031
- try {
1032
- var xmlHttpRequest = getInst(strXMLHttpRequest);
1033
- isSupported = !!xmlHttpRequest;
1034
- }
1035
- catch (e) {
1629
+ function getDebugExt(config) {
1630
+ var ns = _aiNamespace;
1631
+ if (!ns && config.disableDbgExt !== true) {
1632
+ ns = _aiNamespace || _getExtensionNamespace();
1036
1633
  }
1037
- return isSupported;
1634
+ return ns ? ns["ChromeDbgExt"] : null;
1038
1635
  }
1039
1636
 
1637
+ var _a$2;
1040
1638
  var AiNonUserActionablePrefix = "AI (Internal): ";
1041
1639
  var AiUserActionablePrefix = "AI: ";
1042
1640
  var AIInternalMessagePrefix = "AITR_";
1641
+ var defaultValues$1 = (_a$2 = {
1642
+ loggingLevelConsole: 0,
1643
+ loggingLevelTelemetry: 1,
1644
+ maxMessageLimit: 25
1645
+ },
1646
+ _a$2[_DYN_ENABLE_DEBUG_EXCEPTI5 ] = false,
1647
+ _a$2);
1043
1648
  function _sanitizeDiagnosticText(text) {
1044
1649
  if (text) {
1045
1650
  return "\"" + text[_DYN_REPLACE ](/\"/g, STR_EMPTY) + "\"";
@@ -1095,8 +1700,8 @@
1095
1700
  _self.consoleLoggingLevel = function () { return _loggingLevelConsole; };
1096
1701
  _self.telemetryLoggingLevel = function () { return _loggingLevelTelemetry; };
1097
1702
  _self.maxInternalMessageLimit = function () { return _maxInternalMessageLimit; };
1098
- _self[_DYN_ENABLE_DEBUG_EXCEPTI4 ] = function () { return _enableDebugExceptions; };
1099
- _self.throwInternal = function (severity, msgId, msg, properties, isUserAct) {
1703
+ _self[_DYN_ENABLE_DEBUG_EXCEPTI5 ] = function () { return _enableDebugExceptions; };
1704
+ _self[_DYN_THROW_INTERNAL ] = function (severity, msgId, msg, properties, isUserAct) {
1100
1705
  if (isUserAct === void 0) { isUserAct = false; }
1101
1706
  var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
1102
1707
  if (_enableDebugExceptions) {
@@ -1169,10 +1774,14 @@
1169
1774
  }
1170
1775
  }
1171
1776
  function _setDefaultsFromConfig(config) {
1172
- _loggingLevelConsole = getCfgValue(config.loggingLevelConsole, 0);
1173
- _loggingLevelTelemetry = getCfgValue(config.loggingLevelTelemetry, 1);
1174
- _maxInternalMessageLimit = getCfgValue(config.maxMessageLimit, 25);
1175
- _enableDebugExceptions = getCfgValue(config[_DYN_ENABLE_DEBUG_EXCEPTI4 ], false);
1777
+ var handler = createDynamicConfig(config, defaultValues$1, _self);
1778
+ handler[_DYN_WATCH ](function (details) {
1779
+ var config = details.cfg;
1780
+ _loggingLevelConsole = config[_DYN_LOGGING_LEVEL_CONSOL4 ];
1781
+ _loggingLevelTelemetry = config.loggingLevelTelemetry;
1782
+ _maxInternalMessageLimit = config.maxMessageLimit;
1783
+ _enableDebugExceptions = config[_DYN_ENABLE_DEBUG_EXCEPTI5 ];
1784
+ });
1176
1785
  }
1177
1786
  function _areInternalMessagesThrottled() {
1178
1787
  return _messageCount >= _maxInternalMessageLimit;
@@ -1193,7 +1802,7 @@
1193
1802
  }
1194
1803
  function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
1195
1804
  if (isUserAct === void 0) { isUserAct = false; }
1196
- _getLogger(logger).throwInternal(severity, msgId, msg, properties, isUserAct);
1805
+ _getLogger(logger)[_DYN_THROW_INTERNAL ](severity, msgId, msg, properties, isUserAct);
1197
1806
  }
1198
1807
  function _warnToConsole(logger, message) {
1199
1808
  _getLogger(logger)[STR_WARN_TO_CONSOLE ](message);
@@ -1309,146 +1918,6 @@
1309
1918
  return func();
1310
1919
  }
1311
1920
 
1312
- var UInt32Mask = 0x100000000;
1313
- var MaxUInt32 = 0xffffffff;
1314
- var _mwcSeeded = false;
1315
- var _mwcW = 123456789;
1316
- var _mwcZ = 987654321;
1317
- function _mwcSeed(seedValue) {
1318
- if (seedValue < 0) {
1319
- seedValue >>>= 0;
1320
- }
1321
- _mwcW = (123456789 + seedValue) & MaxUInt32;
1322
- _mwcZ = (987654321 - seedValue) & MaxUInt32;
1323
- _mwcSeeded = true;
1324
- }
1325
- function _autoSeedMwc() {
1326
- try {
1327
- var now = dateNow() & 0x7fffffff;
1328
- _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1329
- }
1330
- catch (e) {
1331
- }
1332
- }
1333
- function random32(signed) {
1334
- var value = 0;
1335
- var c = getCrypto() || getMsCrypto();
1336
- if (c && c.getRandomValues) {
1337
- value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1338
- }
1339
- if (value === 0 && isIE()) {
1340
- if (!_mwcSeeded) {
1341
- _autoSeedMwc();
1342
- }
1343
- value = mwcRandom32() & MaxUInt32;
1344
- }
1345
- if (value === 0) {
1346
- value = Math.floor((UInt32Mask * Math.random()) | 0);
1347
- }
1348
- if (!signed) {
1349
- value >>>= 0;
1350
- }
1351
- return value;
1352
- }
1353
- function mwcRandom32(signed) {
1354
- _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1355
- _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1356
- var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1357
- if (!signed) {
1358
- value >>>= 0;
1359
- }
1360
- return value;
1361
- }
1362
- function newId(maxLength) {
1363
- if (maxLength === void 0) { maxLength = 22; }
1364
- var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1365
- var number = random32() >>> 0;
1366
- var chars = 0;
1367
- var result = STR_EMPTY;
1368
- while (result[_DYN_LENGTH$2 ] < maxLength) {
1369
- chars++;
1370
- result += base64chars.charAt(number & 0x3F);
1371
- number >>>= 6;
1372
- if (chars === 5) {
1373
- number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1374
- chars = 0;
1375
- }
1376
- }
1377
- return result;
1378
- }
1379
-
1380
- var _objDefineProperty = ObjDefineProperty;
1381
- var version = "3.0.0-beta.2209-03";
1382
- var instanceName = "." + newId(6);
1383
- var _dataUid = 0;
1384
- function _createAccessor(target, prop, value) {
1385
- if (_objDefineProperty) {
1386
- try {
1387
- _objDefineProperty(target, prop, {
1388
- value: value,
1389
- enumerable: false,
1390
- configurable: true
1391
- });
1392
- return true;
1393
- }
1394
- catch (e) {
1395
- }
1396
- }
1397
- return false;
1398
- }
1399
- function _canAcceptData(target) {
1400
- return target[_DYN_NODE_TYPE ] === 1 || target[_DYN_NODE_TYPE ] === 9 || !(+target[_DYN_NODE_TYPE ]);
1401
- }
1402
- function _getCache(data, target) {
1403
- var theCache = target[data.id];
1404
- if (!theCache) {
1405
- theCache = {};
1406
- try {
1407
- if (_canAcceptData(target)) {
1408
- if (!_createAccessor(target, data.id, theCache)) {
1409
- target[data.id] = theCache;
1410
- }
1411
- }
1412
- }
1413
- catch (e) {
1414
- }
1415
- }
1416
- return theCache;
1417
- }
1418
- function createUniqueNamespace(name, includeVersion) {
1419
- if (includeVersion === void 0) { includeVersion = false; }
1420
- return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : STR_EMPTY) + instanceName);
1421
- }
1422
- function createElmNodeData(name) {
1423
- var data = {
1424
- id: createUniqueNamespace("_aiData-" + (name || STR_EMPTY) + "." + version),
1425
- accept: function (target) {
1426
- return _canAcceptData(target);
1427
- },
1428
- get: function (target, name, defValue, addDefault) {
1429
- var theCache = target[data.id];
1430
- if (!theCache) {
1431
- if (addDefault) {
1432
- theCache = _getCache(data, target);
1433
- theCache[normalizeJsName(name)] = defValue;
1434
- }
1435
- return defValue;
1436
- }
1437
- return theCache[normalizeJsName(name)];
1438
- },
1439
- kill: function (target, name) {
1440
- if (target && target[name]) {
1441
- try {
1442
- delete target[name];
1443
- }
1444
- catch (e) {
1445
- }
1446
- }
1447
- }
1448
- };
1449
- return data;
1450
- }
1451
-
1452
1921
  var pluginStateData = createElmNodeData("plugin");
1453
1922
  function _getPluginState(plugin) {
1454
1923
  return pluginStateData.get(plugin, "state", {}, true);
@@ -1467,9 +1936,12 @@
1467
1936
  }
1468
1937
  return createTelemetryProxyChain([startAt], core[_DYN_CONFIG ] || {}, core);
1469
1938
  }
1470
- function _createInternalContext(telemetryChain, config, core, startAt) {
1939
+ function _createInternalContext(telemetryChain, dynamicConfig, core, startAt) {
1471
1940
  var _nextProxy = null;
1472
1941
  var _onComplete = [];
1942
+ if (!dynamicConfig) {
1943
+ dynamicConfig = createDynamicConfig({}, null, core[_DYN_LOGGER ]);
1944
+ }
1473
1945
  if (startAt !== null) {
1474
1946
  _nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;
1475
1947
  }
@@ -1480,12 +1952,12 @@
1480
1952
  return core;
1481
1953
  },
1482
1954
  diagLog: function () {
1483
- return safeGetLogger(core, config);
1955
+ return safeGetLogger(core, dynamicConfig.cfg);
1484
1956
  },
1485
1957
  getCfg: function () {
1486
- return config;
1958
+ return dynamicConfig.cfg;
1487
1959
  },
1488
- getExtCfg: _getExtCfg,
1960
+ getExtCfg: _resolveExtCfg,
1489
1961
  getConfig: _getConfig,
1490
1962
  hasNext: function () {
1491
1963
  return !!_nextProxy;
@@ -1532,48 +2004,51 @@
1532
2004
  }
1533
2005
  return nextProxy;
1534
2006
  }
1535
- function _getExtCfg(identifier, defaultValue, mergeDefault) {
1536
- if (defaultValue === void 0) { defaultValue = {}; }
1537
- if (mergeDefault === void 0) { mergeDefault = 0 ; }
1538
- var theConfig;
1539
- if (config) {
1540
- var extConfig = config[STR_EXTENSION_CONFIG ];
1541
- if (extConfig && identifier) {
1542
- theConfig = extConfig[identifier];
1543
- }
1544
- }
1545
- if (!theConfig) {
1546
- theConfig = defaultValue;
1547
- }
1548
- else if (isObject(defaultValue)) {
1549
- if (mergeDefault !== 0 ) {
1550
- var newConfig_1 = objExtend(true, defaultValue, theConfig);
1551
- if (config && mergeDefault === 2 ) {
1552
- objForEachKey(defaultValue, function (field) {
1553
- if (isNullOrUndefined(newConfig_1[field])) {
1554
- var cfgValue = config[field];
1555
- if (!isNullOrUndefined(cfgValue)) {
1556
- newConfig_1[field] = cfgValue;
1557
- }
1558
- }
1559
- });
2007
+ function _getExtCfg(identifier, createIfMissing) {
2008
+ var idCfg = null;
2009
+ if (dynamicConfig.cfg && identifier) {
2010
+ var extCfg = dynamicConfig.cfg[STR_EXTENSION_CONFIG ];
2011
+ if (!extCfg && createIfMissing) {
2012
+ dynamicConfig.set(dynamicConfig.cfg, "extensionConfig", {});
2013
+ extCfg = dynamicConfig.cfg[STR_EXTENSION_CONFIG ];
2014
+ }
2015
+ if (extCfg) {
2016
+ idCfg = extCfg[identifier];
2017
+ if (!idCfg && createIfMissing) {
2018
+ dynamicConfig.set(extCfg, identifier, {});
2019
+ idCfg = extCfg[identifier];
1560
2020
  }
1561
- theConfig = newConfig_1;
1562
2021
  }
1563
2022
  }
1564
- return theConfig;
2023
+ return idCfg;
2024
+ }
2025
+ function _resolveExtCfg(identifier, defaultValues) {
2026
+ var newConfig = _getExtCfg(identifier, true);
2027
+ if (defaultValues) {
2028
+ objForEachKey(defaultValues, function (field, defaultValue) {
2029
+ if (isNullOrUndefined(newConfig[field])) {
2030
+ var cfgValue = dynamicConfig.cfg[field];
2031
+ if (cfgValue || !isNullOrUndefined(cfgValue)) {
2032
+ newConfig[field] = cfgValue;
2033
+ }
2034
+ }
2035
+ _applyDefaultValue(newConfig, field, defaultValue);
2036
+ });
2037
+ }
2038
+ return applyDefaults(newConfig, defaultValues);
1565
2039
  }
1566
2040
  function _getConfig(identifier, field, defaultValue) {
1567
2041
  if (defaultValue === void 0) { defaultValue = false; }
1568
2042
  var theValue;
1569
- var extConfig = _getExtCfg(identifier, null);
1570
- if (extConfig && !isNullOrUndefined(extConfig[field])) {
2043
+ var extConfig = _getExtCfg(identifier, false);
2044
+ var rootConfig = dynamicConfig.cfg;
2045
+ if (extConfig && (extConfig[field] || !isNullOrUndefined(extConfig[field]))) {
1571
2046
  theValue = extConfig[field];
1572
2047
  }
1573
- else if (config && !isNullOrUndefined(config[field])) {
1574
- theValue = config[field];
2048
+ else if (rootConfig[field] || !isNullOrUndefined(rootConfig[field])) {
2049
+ theValue = rootConfig[field];
1575
2050
  }
1576
- return !isNullOrUndefined(theValue) ? theValue : defaultValue;
2051
+ return (theValue || !isNullOrUndefined(theValue)) ? theValue : defaultValue;
1577
2052
  }
1578
2053
  function _iterateChain(cb) {
1579
2054
  var nextPlugin;
@@ -1586,27 +2061,30 @@
1586
2061
  }
1587
2062
  return context;
1588
2063
  }
1589
- function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
2064
+ function createProcessTelemetryContext(telemetryChain, cfg, core, startAt) {
2065
+ var config = createDynamicConfig(cfg);
1590
2066
  var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1591
2067
  var context = internalContext.ctx;
1592
2068
  function _processNext(env) {
1593
2069
  var nextPlugin = internalContext._next();
1594
- nextPlugin && nextPlugin[STR_PROCESS_TELEMETRY ](env, context);
2070
+ if (nextPlugin) {
2071
+ nextPlugin[STR_PROCESS_TELEMETRY ](env, context);
2072
+ }
1595
2073
  return !nextPlugin;
1596
2074
  }
1597
2075
  function _createNew(plugins, startAt) {
1598
2076
  if (plugins === void 0) { plugins = null; }
1599
2077
  if (isArray(plugins)) {
1600
- plugins = createTelemetryProxyChain(plugins, config, core, startAt);
2078
+ plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
1601
2079
  }
1602
- return createProcessTelemetryContext(plugins || context[_DYN_GET_NEXT ](), config, core, startAt);
2080
+ return createProcessTelemetryContext(plugins || context[_DYN_GET_NEXT ](), config.cfg, core, startAt);
1603
2081
  }
1604
2082
  context[_DYN_PROCESS_NEXT ] = _processNext;
1605
2083
  context[_DYN_CREATE_NEW ] = _createNew;
1606
2084
  return context;
1607
2085
  }
1608
2086
  function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {
1609
- var config = core[_DYN_CONFIG ] || {};
2087
+ var config = createDynamicConfig(core[_DYN_CONFIG ]);
1610
2088
  var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1611
2089
  var context = internalContext.ctx;
1612
2090
  function _processNext(unloadState) {
@@ -1617,7 +2095,7 @@
1617
2095
  function _createNew(plugins, startAt) {
1618
2096
  if (plugins === void 0) { plugins = null; }
1619
2097
  if (isArray(plugins)) {
1620
- plugins = createTelemetryProxyChain(plugins, config, core, startAt);
2098
+ plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
1621
2099
  }
1622
2100
  return createProcessTelemetryUnloadContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
1623
2101
  }
@@ -1626,7 +2104,7 @@
1626
2104
  return context;
1627
2105
  }
1628
2106
  function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {
1629
- var config = core[_DYN_CONFIG ] || {};
2107
+ var config = createDynamicConfig(core[_DYN_CONFIG ]);
1630
2108
  var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1631
2109
  var context = internalContext.ctx;
1632
2110
  function _processNext(updateState) {
@@ -1639,7 +2117,7 @@
1639
2117
  function _createNew(plugins, startAt) {
1640
2118
  if (plugins === void 0) { plugins = null; }
1641
2119
  if (isArray(plugins)) {
1642
- plugins = createTelemetryProxyChain(plugins, config, core, startAt);
2120
+ plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
1643
2121
  }
1644
2122
  return createProcessTelemetryUpdateContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
1645
2123
  }
@@ -1826,7 +2304,11 @@
1826
2304
  };
1827
2305
  }
1828
2306
 
2307
+ var _a$1;
1829
2308
  var strGetPlugin = "getPlugin";
2309
+ var defaultValues = (_a$1 = {},
2310
+ _a$1[STR_EXTENSION_CONFIG] = { isVal: isNotNullOrUndefined, v: [] },
2311
+ _a$1);
1830
2312
  var BaseTelemetryPlugin = /** @class */ (function () {
1831
2313
  function BaseTelemetryPlugin() {
1832
2314
  var _self = this;
@@ -1862,7 +2344,12 @@
1862
2344
  var oldHooks = _hooks;
1863
2345
  _hooks = [];
1864
2346
  arrForEach(oldHooks, function (fn) {
1865
- fn.rm();
2347
+ try {
2348
+ (fn.rm || fn.remove)[_DYN_CALL ](fn);
2349
+ }
2350
+ catch (e) {
2351
+ _throwInternal(theUnloadCtx[_DYN_DIAG_LOG$1 ](), 2 , 73 , "Unloading:" + dumpObj(e));
2352
+ }
1866
2353
  });
1867
2354
  if (result === true) {
1868
2355
  theUnloadCtx[_DYN_PROCESS_NEXT ](theUnloadState);
@@ -1905,12 +2392,7 @@
1905
2392
  };
1906
2393
  _self._addHook = function (hooks) {
1907
2394
  if (hooks) {
1908
- if (isArray(hooks)) {
1909
- _hooks = _hooks.concat(hooks);
1910
- }
1911
- else {
1912
- _hooks[_DYN_PUSH$1 ](hooks);
1913
- }
2395
+ arrAppend(_hooks, hooks);
1914
2396
  }
1915
2397
  };
1916
2398
  proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
@@ -1951,9 +2433,7 @@
1951
2433
  return itemCtx;
1952
2434
  }
1953
2435
  function _setDefaults(config, core, pluginChain) {
1954
- if (config) {
1955
- setValue(config, STR_EXTENSION_CONFIG, [], null, isNullOrUndefined);
1956
- }
2436
+ createDynamicConfig(config, defaultValues, core[_DYN_LOGGER ]);
1957
2437
  if (!pluginChain && core) {
1958
2438
  pluginChain = core[_DYN_GET_PROCESS_TEL_CONT0 ]()[_DYN_GET_NEXT ]();
1959
2439
  }
@@ -1992,7 +2472,7 @@
1992
2472
  var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
1993
2473
  function _normalizeNamespace(name) {
1994
2474
  if (name && name[_DYN_REPLACE ]) {
1995
- return name.replace(/^\s*\.*|\.*\s*$/g, STR_EMPTY);
2475
+ return name[_DYN_REPLACE ](/^[\s\.]+|(?=[\s\.])[\.\s]+$/g, STR_EMPTY);
1996
2476
  }
1997
2477
  return name;
1998
2478
  }
@@ -2266,7 +2746,7 @@
2266
2746
  function dataSanitizeProperties(logger, properties) {
2267
2747
  if (properties) {
2268
2748
  var tempProps_1 = {};
2269
- objForEachKey(properties, function (prop, value) {
2749
+ objForEachKey$1(properties, function (prop, value) {
2270
2750
  if (isObject(value) && hasJSON()) {
2271
2751
  try {
2272
2752
  value = getJSON()[_DYN_STRINGIFY$1 ](value);
@@ -2286,7 +2766,7 @@
2286
2766
  function dataSanitizeMeasurements(logger, measurements) {
2287
2767
  if (measurements) {
2288
2768
  var tempMeasurements_1 = {};
2289
- objForEachKey(measurements, function (measure, value) {
2769
+ objForEachKey$1(measurements, function (measure, value) {
2290
2770
  measure = dataSanitizeKeyAndAddUniqueness(logger, measure, tempMeasurements_1);
2291
2771
  tempMeasurements_1[measure] = value;
2292
2772
  });
@@ -2337,7 +2817,7 @@
2337
2817
  function urlParseHost(url, inclPort) {
2338
2818
  var fullHost = urlParseFullHost(url, inclPort) || "";
2339
2819
  if (fullHost) {
2340
- var match = fullHost.match(/(www[0-9]?\.)?(.[^/:]+)(\:[\d]+)?/i);
2820
+ var match = fullHost.match(/(www\d{0,5}\.)?([^\/:]{1,256})(:\d{1,20})?/i);
2341
2821
  if (match != null && match[_DYN_LENGTH$1 ] > 3 && isString(match[2]) && match[2][_DYN_LENGTH$1 ] > 0) {
2342
2822
  return match[2] + (match[3] || "");
2343
2823
  }
@@ -2347,7 +2827,7 @@
2347
2827
  function urlParseFullHost(url, inclPort) {
2348
2828
  var result = null;
2349
2829
  if (url) {
2350
- var match = url.match(/(\w*):\/\/(.[^/:]+)(\:[\d]+)?/i);
2830
+ var match = url.match(/(\w{1,150}):\/\/([^\/:]{1,256})(:\d{1,20})?/i);
2351
2831
  if (match != null && match[_DYN_LENGTH$1 ] > 2 && isString(match[2]) && match[2][_DYN_LENGTH$1 ] > 0) {
2352
2832
  result = match[2] || "";
2353
2833
  if (inclPort && match[_DYN_LENGTH$1 ] > 2) {
@@ -3284,6 +3764,7 @@
3284
3764
  var _DYN_ON_LINE = "onLine";
3285
3765
  var _DYN_ENQUEUE = "enqueue";
3286
3766
  var _DYN_COUNT = "count";
3767
+ var _DYN_EVENTS_LIMIT_IN_MEM = "eventsLimitInMem";
3287
3768
  var _DYN_PUSH = "push";
3288
3769
  var _DYN_EMIT_LINE_DELIMITED_0 = "emitLineDelimitedJson";
3289
3770
  var _DYN_CLEAR = "clear";
@@ -3294,36 +3775,31 @@
3294
3775
  var _DYN__SENT__BUFFER__KEY = "SENT_BUFFER_KEY";
3295
3776
  var _DYN__MAX__BUFFER__SIZE = "MAX_BUFFER_SIZE";
3296
3777
  var _DYN_NAME_PREFIX = "namePrefix";
3297
- var _DYN_MAX_BATCH_SIZE_IN_BY1 = "maxBatchSizeInBytes";
3298
3778
  var _DYN_TRIGGER_SEND = "triggerSend";
3299
3779
  var _DYN_DIAG_LOG = "diagLog";
3780
+ var _DYN__SENDER = "_sender";
3781
+ var _DYN_MAX_BATCH_SIZE_IN_BY1 = "maxBatchSizeInBytes";
3300
3782
  var _DYN_ONUNLOAD_DISABLE_BEA2 = "onunloadDisableBeacon";
3301
3783
  var _DYN_IS_BEACON_API_DISABL3 = "isBeaconApiDisabled";
3302
- var _DYN__SENDER = "_sender";
3303
- var _DYN__SENDER_CONFIG = "_senderConfig";
3304
3784
  var _DYN__BUFFER = "_buffer";
3305
3785
  var _DYN_ENABLE_SESSION_STORA4 = "enableSessionStorageBuffer";
3306
3786
  var _DYN_SAMPLING_PERCENTAGE = "samplingPercentage";
3307
3787
  var _DYN_INSTRUMENTATION_KEY = "instrumentationKey";
3308
- var _DYN_ENDPOINT_URL = "endpointUrl";
3309
3788
  var _DYN_CUSTOM_HEADERS = "customHeaders";
3310
3789
  var _DYN_DISABLE_XHR = "disableXhr";
3311
3790
  var _DYN_ONUNLOAD_DISABLE_FET5 = "onunloadDisableFetch";
3312
- var _DYN_DISABLE_TELEMETRY = "disableTelemetry";
3791
+ var _DYN_CONVERT_UNDEFINED = "convertUndefined";
3792
+ var _DYN_MAX_BATCH_INTERVAL = "maxBatchInterval";
3313
3793
  var _DYN_BASE_TYPE = "baseType";
3314
3794
  var _DYN_SAMPLE_RATE = "sampleRate";
3315
- var _DYN_CONVERT_UNDEFINED = "convertUndefined";
3316
3795
  var _DYN__XHR_READY_STATE_CHA6 = "_xhrReadyStateChange";
3317
3796
  var _DYN__ON_ERROR = "_onError";
3318
3797
  var _DYN__ON_PARTIAL_SUCCESS = "_onPartialSuccess";
3319
3798
  var _DYN__ON_SUCCESS = "_onSuccess";
3320
3799
  var _DYN_ITEMS_ACCEPTED = "itemsAccepted";
3321
3800
  var _DYN_ITEMS_RECEIVED = "itemsReceived";
3322
- var _DYN_IS_RETRY_DISABLED = "isRetryDisabled";
3323
3801
  var _DYN_SET_REQUEST_HEADER = "setRequestHeader";
3324
- var _DYN_MAX_BATCH_INTERVAL = "maxBatchInterval";
3325
3802
  var _DYN_EVENTS_SEND_REQUEST = "eventsSendRequest";
3326
- var _DYN_DISABLE_INSTRUMENTAT7 = "disableInstrumentationKeyValidation";
3327
3803
  var _DYN_GET_SAMPLING_SCORE = "getSamplingScore";
3328
3804
  var _DYN_GET_HASH_CODE_SCORE = "getHashCodeScore";
3329
3805
 
@@ -3381,12 +3857,12 @@
3381
3857
  var tgs = {};
3382
3858
  for (var i = itmTags[_DYN_LENGTH ] - 1; i >= 0; i--) {
3383
3859
  var tg = itmTags[i];
3384
- objForEachKey(tg, function (key, value) {
3860
+ objForEachKey$1(tg, function (key, value) {
3385
3861
  tgs[key] = value;
3386
3862
  });
3387
3863
  itmTags.splice(i, 1);
3388
3864
  }
3389
- objForEachKey(itmTags, function (tg, value) {
3865
+ objForEachKey$1(itmTags, function (tg, value) {
3390
3866
  tgs[tg] = value;
3391
3867
  });
3392
3868
  var theTags = __assignFn(__assignFn({}, envTags), tgs);
@@ -3397,7 +3873,7 @@
3397
3873
  }
3398
3874
  function _extractPropsAndMeasurements(data, properties, measurements) {
3399
3875
  if (!isNullOrUndefined(data)) {
3400
- objForEachKey(data, function (key, value) {
3876
+ objForEachKey$1(data, function (key, value) {
3401
3877
  if (isNumber(value)) {
3402
3878
  measurements[key] = value;
3403
3879
  }
@@ -3412,7 +3888,7 @@
3412
3888
  }
3413
3889
  function _convertPropsUndefinedToCustomDefinedValue(properties, customUndefinedValue) {
3414
3890
  if (!isNullOrUndefined(properties)) {
3415
- objForEachKey(properties, function (key, value) {
3891
+ objForEachKey$1(properties, function (key, value) {
3416
3892
  properties[key] = value || customUndefinedValue;
3417
3893
  });
3418
3894
  }
@@ -3436,7 +3912,7 @@
3436
3912
  }
3437
3913
  }
3438
3914
  var EnvelopeCreator = {
3439
- Version: "3.0.0-beta.2209-03"
3915
+ Version: "3.0.0-beta.2210-02"
3440
3916
  };
3441
3917
  function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
3442
3918
  EnvelopeCreatorInit(logger, telemetryItem);
@@ -3543,7 +4019,7 @@
3543
4019
  }
3544
4020
  if (!isNullOrUndefined(bd[strProperties])) {
3545
4021
  var pageTags = bd[strProperties];
3546
- objForEachKey(pageTags, function (key, value) {
4022
+ objForEachKey$1(pageTags, function (key, value) {
3547
4023
  properties[key] = value;
3548
4024
  });
3549
4025
  }
@@ -3674,7 +4150,7 @@
3674
4150
  };
3675
4151
  dynamicProto(BaseSendBuffer, this, function (_self) {
3676
4152
  _self[_DYN_ENQUEUE ] = function (payload) {
3677
- if (_self[_DYN_COUNT ]() >= config.eventsLimitInMem()) {
4153
+ if (_self[_DYN_COUNT ]() >= config[_DYN_EVENTS_LIMIT_IN_MEM ]) {
3678
4154
  if (!_bufferFullMessageSent) {
3679
4155
  _throwInternal(logger, 2 , 105 , "Maximum in-memory buffer size reached: " + _self[_DYN_COUNT ](), true);
3680
4156
  _bufferFullMessageSent = true;
@@ -3691,7 +4167,7 @@
3691
4167
  for (var lp = 0; lp < _buffer[_DYN_LENGTH ]; lp++) {
3692
4168
  size += _buffer[lp][_DYN_LENGTH ];
3693
4169
  }
3694
- if (!config[_DYN_EMIT_LINE_DELIMITED_0 ]()) {
4170
+ if (!config[_DYN_EMIT_LINE_DELIMITED_0 ]) {
3695
4171
  size += 2;
3696
4172
  }
3697
4173
  return size;
@@ -3705,7 +4181,7 @@
3705
4181
  };
3706
4182
  _self[_DYN_BATCH_PAYLOADS ] = function (payload) {
3707
4183
  if (payload && payload[_DYN_LENGTH ] > 0) {
3708
- var batch = config[_DYN_EMIT_LINE_DELIMITED_0 ]() ?
4184
+ var batch = config[_DYN_EMIT_LINE_DELIMITED_0 ] ?
3709
4185
  payload.join("\n") :
3710
4186
  "[" + payload.join(",") + "]";
3711
4187
  return batch;
@@ -3793,7 +4269,7 @@
3793
4269
  function _getBuffer(key) {
3794
4270
  var prefixedKey = key;
3795
4271
  try {
3796
- prefixedKey = config[_DYN_NAME_PREFIX ] && config[_DYN_NAME_PREFIX ]() ? config[_DYN_NAME_PREFIX ]() + "_" + prefixedKey : prefixedKey;
4272
+ prefixedKey = config[_DYN_NAME_PREFIX ] ? config[_DYN_NAME_PREFIX ] + "_" + prefixedKey : prefixedKey;
3797
4273
  var bufferJson = utlGetSessionStorage(logger, prefixedKey);
3798
4274
  if (bufferJson) {
3799
4275
  var buffer_1 = getJSON().parse(bufferJson);
@@ -3813,7 +4289,7 @@
3813
4289
  function _setBuffer(key, buffer) {
3814
4290
  var prefixedKey = key;
3815
4291
  try {
3816
- prefixedKey = config[_DYN_NAME_PREFIX ] && config[_DYN_NAME_PREFIX ]() ? config[_DYN_NAME_PREFIX ]() + "_" + prefixedKey : prefixedKey;
4292
+ prefixedKey = config[_DYN_NAME_PREFIX ] ? config[_DYN_NAME_PREFIX ] + "_" + prefixedKey : prefixedKey;
3817
4293
  var bufferJson = JSON[_DYN_STRINGIFY ](buffer);
3818
4294
  utlSetSessionStorage(logger, prefixedKey, bufferJson);
3819
4295
  }
@@ -3880,7 +4356,7 @@
3880
4356
  return output;
3881
4357
  }
3882
4358
  source[circularReferenceCheck] = true;
3883
- objForEachKey(source.aiDataContract, function (field, contract) {
4359
+ objForEachKey$1(source.aiDataContract, function (field, contract) {
3884
4360
  var isRequired = (isFunction(contract)) ? (contract() & 1 ) : (contract & 1 );
3885
4361
  var isHidden = (isFunction(contract)) ? (contract() & 4 ) : (contract & 4 );
3886
4362
  var isArray = contract & 2 ;
@@ -3931,7 +4407,7 @@
3931
4407
  var output;
3932
4408
  if (map) {
3933
4409
  output = {};
3934
- objForEachKey(map, function (field, value) {
4410
+ objForEachKey$1(map, function (field, value) {
3935
4411
  if (expectedType === "string") {
3936
4412
  if (value === undefined) {
3937
4413
  output[field] = "undefined";
@@ -4057,7 +4533,8 @@
4057
4533
  return Sample;
4058
4534
  }());
4059
4535
 
4060
- var _a;
4536
+ var _a, _b;
4537
+ var UNDEFINED_VALUE = undefined;
4061
4538
  var FetchSyncRequestSizeLimitBytes = 65000;
4062
4539
  function _getResponseText(xhr) {
4063
4540
  try {
@@ -4067,47 +4544,41 @@
4067
4544
  }
4068
4545
  return null;
4069
4546
  }
4070
- function _getDefaultAppInsightsChannelConfig() {
4071
- var _a;
4072
- var defaultValue;
4073
- var defaultCustomHeaders;
4074
- return _a = {
4075
- endpointUrl: function () { return DEFAULT_BREEZE_ENDPOINT + DEFAULT_BREEZE_PATH; }
4076
- },
4077
- _a[_DYN_EMIT_LINE_DELIMITED_0 ] = function () { return false; },
4078
- _a[_DYN_MAX_BATCH_INTERVAL ] = function () { return 15000; },
4079
- _a[_DYN_MAX_BATCH_SIZE_IN_BY1 ] = function () { return 102400; },
4080
- _a[_DYN_DISABLE_TELEMETRY ] = function () { return false; },
4081
- _a[_DYN_ENABLE_SESSION_STORA4 ] = function () { return true; },
4082
- _a[_DYN_IS_RETRY_DISABLED ] = function () { return false; },
4083
- _a[_DYN_IS_BEACON_API_DISABL3 ] = function () { return true; },
4084
- _a[_DYN_DISABLE_XHR ] = function () { return false; },
4085
- _a[_DYN_ONUNLOAD_DISABLE_FET5 ] = function () { return false; },
4086
- _a[_DYN_ONUNLOAD_DISABLE_BEA2 ] = function () { return false; },
4087
- _a[_DYN_INSTRUMENTATION_KEY ] = function () { return defaultValue; },
4088
- _a[_DYN_NAME_PREFIX ] = function () { return defaultValue; },
4089
- _a[_DYN_SAMPLING_PERCENTAGE ] = function () { return 100; },
4090
- _a[_DYN_CUSTOM_HEADERS ] = function () { return defaultCustomHeaders; },
4091
- _a[_DYN_CONVERT_UNDEFINED ] = function () { return defaultValue; },
4092
- _a.eventsLimitInMem = function () { return 10000; },
4093
- _a;
4094
- }
4095
- var EnvelopeTypeCreator = (_a = {},
4096
- _a[Event.dataType] = EventEnvelopeCreator,
4097
- _a[Trace.dataType] = TraceEnvelopeCreator,
4098
- _a[PageView.dataType] = PageViewEnvelopeCreator,
4099
- _a[PageViewPerformance.dataType] = PageViewPerformanceEnvelopeCreator,
4100
- _a[Exception.dataType] = ExceptionEnvelopeCreator,
4101
- _a[Metric.dataType] = MetricEnvelopeCreator,
4102
- _a[RemoteDependencyData.dataType] = DependencyEnvelopeCreator,
4103
- _a);
4547
+ var defaultAppInsightsChannelConfig = objDeepFreeze((_a = {
4548
+ endpointUrl: { isVal: isTruthy, v: DEFAULT_BREEZE_ENDPOINT + DEFAULT_BREEZE_PATH }
4549
+ },
4550
+ _a[_DYN_EMIT_LINE_DELIMITED_0 ] = false,
4551
+ _a[_DYN_MAX_BATCH_INTERVAL ] = 15000,
4552
+ _a[_DYN_MAX_BATCH_SIZE_IN_BY1 ] = 102400,
4553
+ _a.disableTelemetry = false,
4554
+ _a[_DYN_ENABLE_SESSION_STORA4 ] = true,
4555
+ _a.isRetryDisabled = false,
4556
+ _a.isBeaconApiDisabled = true,
4557
+ _a[_DYN_DISABLE_XHR ] = false,
4558
+ _a[_DYN_ONUNLOAD_DISABLE_FET5 ] = false,
4559
+ _a[_DYN_ONUNLOAD_DISABLE_BEA2 ] = false,
4560
+ _a[_DYN_INSTRUMENTATION_KEY ] = UNDEFINED_VALUE,
4561
+ _a[_DYN_NAME_PREFIX ] = UNDEFINED_VALUE,
4562
+ _a[_DYN_SAMPLING_PERCENTAGE ] = 100,
4563
+ _a[_DYN_CUSTOM_HEADERS ] = UNDEFINED_VALUE,
4564
+ _a[_DYN_CONVERT_UNDEFINED ] = UNDEFINED_VALUE,
4565
+ _a[_DYN_EVENTS_LIMIT_IN_MEM ] = 10000,
4566
+ _a));
4567
+ var EnvelopeTypeCreator = (_b = {},
4568
+ _b[Event.dataType] = EventEnvelopeCreator,
4569
+ _b[Trace.dataType] = TraceEnvelopeCreator,
4570
+ _b[PageView.dataType] = PageViewEnvelopeCreator,
4571
+ _b[PageViewPerformance.dataType] = PageViewPerformanceEnvelopeCreator,
4572
+ _b[Exception.dataType] = ExceptionEnvelopeCreator,
4573
+ _b[Metric.dataType] = MetricEnvelopeCreator,
4574
+ _b[RemoteDependencyData.dataType] = DependencyEnvelopeCreator,
4575
+ _b);
4104
4576
  var Sender = /** @class */ (function (_super) {
4105
4577
  __extendsFn(Sender, _super);
4106
4578
  function Sender() {
4107
4579
  var _this = _super.call(this) || this;
4108
4580
  _this.priority = 1001;
4109
4581
  _this.identifier = BreezeChannelIdentifier;
4110
- _this._senderConfig = _getDefaultAppInsightsChannelConfig();
4111
4582
  var _consecutiveErrors;
4112
4583
  var _retryAt;
4113
4584
  var _lastSend;
@@ -4121,6 +4592,16 @@
4121
4592
  var _syncUnloadSender;
4122
4593
  var _offlineListener;
4123
4594
  var _evtNamespace;
4595
+ var _endpointUrl;
4596
+ var _orgEndpointUrl;
4597
+ var _maxBatchSizeInBytes;
4598
+ var _beaconSupported;
4599
+ var _customHeaders;
4600
+ var _disableTelemetry;
4601
+ var _instrumentationKey;
4602
+ var _convertUndefined;
4603
+ var _isRetryDisabled;
4604
+ var _maxBatchInterval;
4124
4605
  dynamicProto(Sender, _this, function (_self, _base) {
4125
4606
  _initDefaults();
4126
4607
  _self.pause = function () {
@@ -4131,7 +4612,7 @@
4131
4612
  if (_paused) {
4132
4613
  _paused = false;
4133
4614
  _retryAt = null;
4134
- if (_self._buffer.size() > _self._senderConfig[_DYN_MAX_BATCH_SIZE_IN_BY1 ]()) {
4615
+ if (_self[_DYN__BUFFER ].size() > _maxBatchSizeInBytes) {
4135
4616
  _self[_DYN_TRIGGER_SEND ](true, null, 10 );
4136
4617
  }
4137
4618
  _setupTimer();
@@ -4151,7 +4632,7 @@
4151
4632
  };
4152
4633
  _self.onunloadFlush = function () {
4153
4634
  if (!_paused) {
4154
- if ((_self._senderConfig[_DYN_ONUNLOAD_DISABLE_BEA2 ]() === false || _self[_DYN__SENDER_CONFIG ][_DYN_IS_BEACON_API_DISABL3 ]() === false) && isBeaconsSupported()) {
4635
+ if (_beaconSupported) {
4155
4636
  try {
4156
4637
  _self[_DYN_TRIGGER_SEND ](true, _doUnloadSend, 2 );
4157
4638
  }
@@ -4172,7 +4653,6 @@
4172
4653
  _throwInternal(_self[_DYN_DIAG_LOG ](), 1 , 28 , "Sender is already initialized");
4173
4654
  }
4174
4655
  _base.initialize(config, core, extensions, pluginChain);
4175
- var ctx = _self._getTelCtx();
4176
4656
  var identifier = _self.identifier;
4177
4657
  _serializer = new Serializer(core.logger);
4178
4658
  _consecutiveErrors = 0;
@@ -4183,64 +4663,86 @@
4183
4663
  var diagLog = _self[_DYN_DIAG_LOG ]();
4184
4664
  _evtNamespace = mergeEvtNamespace(createUniqueNamespace("Sender"), core.evtNamespace && core.evtNamespace());
4185
4665
  _offlineListener = createOfflineListener(_evtNamespace);
4186
- var defaultConfig = _getDefaultAppInsightsChannelConfig();
4187
- objForEachKey(defaultConfig, function (field, value) {
4188
- _self[_DYN__SENDER_CONFIG ][field] = function () {
4189
- var theValue = ctx.getConfig(identifier, field, value());
4190
- if (!theValue && field === "endpointUrl") {
4191
- theValue = value();
4666
+ _self._addHook(onConfigChange(config, function () {
4667
+ var ctx = createProcessTelemetryContext(null, config, core);
4668
+ var senderConfig = ctx.getExtCfg(identifier, defaultAppInsightsChannelConfig);
4669
+ objDefineProp(_self, "_senderConfig", {
4670
+ enumerable: true,
4671
+ configurable: true,
4672
+ get: function () {
4673
+ return senderConfig;
4192
4674
  }
4193
- return theValue;
4194
- };
4195
- });
4196
- _self._buffer = (_self[_DYN__SENDER_CONFIG ][_DYN_ENABLE_SESSION_STORA4 ]() && utlCanUseSessionStorage())
4197
- ? new SessionStorageSendBuffer(diagLog, _self[_DYN__SENDER_CONFIG ]) : new ArraySendBuffer(diagLog, _self[_DYN__SENDER_CONFIG ]);
4198
- _self._sample = new Sample(_self[_DYN__SENDER_CONFIG ][_DYN_SAMPLING_PERCENTAGE ](), diagLog);
4199
- if (!_validateInstrumentationKey(config)) {
4200
- _throwInternal(diagLog, 1 , 100 , "Invalid Instrumentation key " + config[_DYN_INSTRUMENTATION_KEY ]);
4201
- }
4202
- if (!isInternalApplicationInsightsEndpoint(_self._senderConfig.endpointUrl()) && _self._senderConfig.customHeaders() && _self._senderConfig.customHeaders()[_DYN_LENGTH ] > 0) {
4203
- arrForEach(_self[_DYN__SENDER_CONFIG ][_DYN_CUSTOM_HEADERS ](), function (customHeader) {
4204
- _this.addHeader(customHeader.header, customHeader.value);
4205
4675
  });
4206
- }
4207
- var senderConfig = _self[_DYN__SENDER_CONFIG ];
4208
- var sendPostFunc = null;
4209
- if (!senderConfig[_DYN_DISABLE_XHR ]() && useXDomainRequest()) {
4210
- sendPostFunc = _xdrSender;
4211
- }
4212
- else if (!senderConfig[_DYN_DISABLE_XHR ]() && isXhrSupported()) {
4213
- sendPostFunc = _xhrSender;
4214
- }
4215
- if (!sendPostFunc && isFetchSupported()) {
4216
- sendPostFunc = _fetchSender;
4217
- }
4218
- _fallbackSender = sendPostFunc || _xhrSender;
4219
- if (!senderConfig[_DYN_IS_BEACON_API_DISABL3 ]() && isBeaconsSupported()) {
4220
- sendPostFunc = _beaconSender;
4221
- }
4222
- _self[_DYN__SENDER ] = sendPostFunc || _xhrSender;
4223
- if (!senderConfig[_DYN_ONUNLOAD_DISABLE_FET5 ]() && isFetchSupported(true)) {
4224
- _syncUnloadSender = _fetchKeepAliveSender;
4225
- }
4226
- else if (isBeaconsSupported()) {
4227
- _syncUnloadSender = _beaconSender;
4228
- }
4229
- else if (!senderConfig[_DYN_DISABLE_XHR ]() && useXDomainRequest()) {
4230
- _syncUnloadSender = _xdrSender;
4231
- }
4232
- else if (!senderConfig[_DYN_DISABLE_XHR ]() && isXhrSupported()) {
4233
- _syncUnloadSender = _xhrSender;
4234
- }
4235
- else {
4236
- _syncUnloadSender = _fallbackSender;
4237
- }
4676
+ _maxBatchSizeInBytes = senderConfig[_DYN_MAX_BATCH_SIZE_IN_BY1 ];
4677
+ _beaconSupported = (senderConfig[_DYN_ONUNLOAD_DISABLE_BEA2 ] === false || senderConfig[_DYN_IS_BEACON_API_DISABL3 ] === false) && isBeaconsSupported();
4678
+ if (_self[_DYN__BUFFER ]) ;
4679
+ else {
4680
+ _self[_DYN__BUFFER ] = (senderConfig[_DYN_ENABLE_SESSION_STORA4 ] && utlCanUseSessionStorage())
4681
+ ? new SessionStorageSendBuffer(diagLog, senderConfig) : new ArraySendBuffer(diagLog, senderConfig);
4682
+ }
4683
+ _self._sample = new Sample(senderConfig[_DYN_SAMPLING_PERCENTAGE ], diagLog);
4684
+ _instrumentationKey = senderConfig[_DYN_INSTRUMENTATION_KEY ];
4685
+ if (!_validateInstrumentationKey(_instrumentationKey, config)) {
4686
+ _throwInternal(diagLog, 1 , 100 , "Invalid Instrumentation key " + _instrumentationKey);
4687
+ }
4688
+ if (_orgEndpointUrl !== senderConfig.endpointUrl) {
4689
+ _endpointUrl = _orgEndpointUrl = senderConfig.endpointUrl;
4690
+ }
4691
+ if (_customHeaders && _customHeaders !== senderConfig[_DYN_CUSTOM_HEADERS ]) {
4692
+ arrForEach(_customHeaders, function (customHeader) {
4693
+ delete _headers[customHeader.header];
4694
+ });
4695
+ }
4696
+ _customHeaders = senderConfig[_DYN_CUSTOM_HEADERS ];
4697
+ if (!isInternalApplicationInsightsEndpoint(_endpointUrl) && _customHeaders && _customHeaders[_DYN_LENGTH ] > 0) {
4698
+ arrForEach(_customHeaders, function (customHeader) {
4699
+ _this.addHeader(customHeader.header, customHeader.value);
4700
+ });
4701
+ }
4702
+ else {
4703
+ _customHeaders = null;
4704
+ }
4705
+ var sendPostFunc = null;
4706
+ if (!senderConfig[_DYN_DISABLE_XHR ] && useXDomainRequest()) {
4707
+ sendPostFunc = _xdrSender;
4708
+ }
4709
+ else if (!senderConfig[_DYN_DISABLE_XHR ] && isXhrSupported()) {
4710
+ sendPostFunc = _xhrSender;
4711
+ }
4712
+ if (!sendPostFunc && isFetchSupported()) {
4713
+ sendPostFunc = _fetchSender;
4714
+ }
4715
+ _fallbackSender = sendPostFunc || _xhrSender;
4716
+ if (!senderConfig[_DYN_IS_BEACON_API_DISABL3 ] && isBeaconsSupported()) {
4717
+ sendPostFunc = _beaconSender;
4718
+ }
4719
+ _self[_DYN__SENDER ] = sendPostFunc || _xhrSender;
4720
+ if (!senderConfig[_DYN_ONUNLOAD_DISABLE_FET5 ] && isFetchSupported(true)) {
4721
+ _syncUnloadSender = _fetchKeepAliveSender;
4722
+ }
4723
+ else if (isBeaconsSupported()) {
4724
+ _syncUnloadSender = _beaconSender;
4725
+ }
4726
+ else if (!senderConfig[_DYN_DISABLE_XHR ] && useXDomainRequest()) {
4727
+ _syncUnloadSender = _xdrSender;
4728
+ }
4729
+ else if (!senderConfig[_DYN_DISABLE_XHR ] && isXhrSupported()) {
4730
+ _syncUnloadSender = _xhrSender;
4731
+ }
4732
+ else {
4733
+ _syncUnloadSender = _fallbackSender;
4734
+ }
4735
+ _disableTelemetry = senderConfig.disableTelemetry;
4736
+ _convertUndefined = senderConfig[_DYN_CONVERT_UNDEFINED ] || UNDEFINED_VALUE;
4737
+ _isRetryDisabled = senderConfig.isRetryDisabled;
4738
+ _maxBatchInterval = senderConfig[_DYN_MAX_BATCH_INTERVAL ];
4739
+ }));
4238
4740
  };
4239
4741
  _self.processTelemetry = function (telemetryItem, itemCtx) {
4240
4742
  itemCtx = _self._getTelCtx(itemCtx);
4241
4743
  var diagLogger = itemCtx[_DYN_DIAG_LOG ]();
4242
4744
  try {
4243
- if (_self[_DYN__SENDER_CONFIG ][_DYN_DISABLE_TELEMETRY ]()) {
4745
+ if (_disableTelemetry) {
4244
4746
  return;
4245
4747
  }
4246
4748
  if (!telemetryItem) {
@@ -4265,9 +4767,8 @@
4265
4767
  else {
4266
4768
  telemetryItem[SampleRate] = _self._sample[_DYN_SAMPLE_RATE ];
4267
4769
  }
4268
- var convertUndefined = _self[_DYN__SENDER_CONFIG ][_DYN_CONVERT_UNDEFINED ]() || undefined;
4269
- var defaultEnvelopeIkey = telemetryItem.iKey || _self[_DYN__SENDER_CONFIG ][_DYN_INSTRUMENTATION_KEY ]();
4270
- var aiEnvelope_1 = Sender.constructEnvelope(telemetryItem, defaultEnvelopeIkey, diagLogger, convertUndefined);
4770
+ var defaultEnvelopeIkey = telemetryItem.iKey || _instrumentationKey;
4771
+ var aiEnvelope_1 = Sender.constructEnvelope(telemetryItem, defaultEnvelopeIkey, diagLogger, _convertUndefined);
4271
4772
  if (!aiEnvelope_1) {
4272
4773
  _throwInternal(diagLogger, 1 , 47 , "Unable to create an AppInsights envelope");
4273
4774
  return;
@@ -4293,7 +4794,7 @@
4293
4794
  var payload = _serializer.serialize(aiEnvelope_1);
4294
4795
  var buffer = _self[_DYN__BUFFER ];
4295
4796
  var bufferSize = buffer.size();
4296
- if ((bufferSize + payload[_DYN_LENGTH ]) > _self[_DYN__SENDER_CONFIG ][_DYN_MAX_BATCH_SIZE_IN_BY1 ]()) {
4797
+ if ((bufferSize + payload[_DYN_LENGTH ]) > _maxBatchSizeInBytes) {
4297
4798
  _self[_DYN_TRIGGER_SEND ](true, null, 10 );
4298
4799
  }
4299
4800
  buffer[_DYN_ENQUEUE ](payload);
@@ -4314,7 +4815,7 @@
4314
4815
  if (!_paused) {
4315
4816
  try {
4316
4817
  var buffer = _self[_DYN__BUFFER ];
4317
- if (!_self[_DYN__SENDER_CONFIG ][_DYN_DISABLE_TELEMETRY ]()) {
4818
+ if (!_disableTelemetry) {
4318
4819
  if (buffer[_DYN_COUNT ]() > 0) {
4319
4820
  var payload = buffer.getItems();
4320
4821
  _notifySendRequest(sendReason || 0 , async);
@@ -4388,7 +4889,7 @@
4388
4889
  else {
4389
4890
  var results = _parseResponse(responseText);
4390
4891
  if (results && results.itemsReceived && results.itemsReceived > results[_DYN_ITEMS_ACCEPTED ]
4391
- && !_self[_DYN__SENDER_CONFIG ][_DYN_IS_RETRY_DISABLED ]()) {
4892
+ && !_isRetryDisabled) {
4392
4893
  _self[_DYN__ON_PARTIAL_SUCCESS ](payload, results);
4393
4894
  }
4394
4895
  else {
@@ -4414,7 +4915,7 @@
4414
4915
  return;
4415
4916
  }
4416
4917
  }
4417
- if (!_self[_DYN__SENDER_CONFIG ][_DYN_IS_RETRY_DISABLED ]() && _isRetriable(status)) {
4918
+ if (!_isRetryDisabled && _isRetriable(status)) {
4418
4919
  _resendPayload(payload);
4419
4920
  _throwInternal(_self[_DYN_DIAG_LOG ](), 2 , 40 , ". " +
4420
4921
  "Response code " + status + ". Will retry to send " + payload[_DYN_LENGTH ] + " items.");
@@ -4424,7 +4925,7 @@
4424
4925
  }
4425
4926
  }
4426
4927
  else if (_offlineListener && !_offlineListener.isOnline()) {
4427
- if (!_self[_DYN__SENDER_CONFIG ][_DYN_IS_RETRY_DISABLED ]()) {
4928
+ if (!_isRetryDisabled) {
4428
4929
  var offlineBackOffMultiplier = 10;
4429
4930
  _resendPayload(payload, offlineBackOffMultiplier);
4430
4931
  _throwInternal(_self[_DYN_DIAG_LOG ](), 2 , 40 , ". Offline - Response Code: ".concat(status, ". Offline status: ").concat(!_offlineListener.isOnline(), ". Will retry to send ").concat(payload.length, " items."));
@@ -4436,7 +4937,7 @@
4436
4937
  if (!response) {
4437
4938
  response = _parseResponse(res);
4438
4939
  }
4439
- if (response && !_self[_DYN__SENDER_CONFIG ][_DYN_IS_RETRY_DISABLED ]()) {
4940
+ if (response && !_isRetryDisabled) {
4440
4941
  _self[_DYN__ON_PARTIAL_SUCCESS ](payload, response);
4441
4942
  }
4442
4943
  else {
@@ -4454,8 +4955,8 @@
4454
4955
  return false;
4455
4956
  }
4456
4957
  if (!isNullOrUndefined(responseUrl) && responseUrl !== "") {
4457
- if (responseUrl !== _self[_DYN__SENDER_CONFIG ][_DYN_ENDPOINT_URL ]()) {
4458
- _self[_DYN__SENDER_CONFIG ][_DYN_ENDPOINT_URL ] = function () { return responseUrl; };
4958
+ if (responseUrl !== _endpointUrl) {
4959
+ _endpointUrl = responseUrl;
4459
4960
  ++_stamp_specific_redirects;
4460
4961
  return true;
4461
4962
  }
@@ -4473,7 +4974,7 @@
4473
4974
  function _doBeaconSend(payload) {
4474
4975
  var nav = getNavigator();
4475
4976
  var buffer = _self[_DYN__BUFFER ];
4476
- var url = _self[_DYN__SENDER_CONFIG ][_DYN_ENDPOINT_URL ]();
4977
+ var url = _endpointUrl;
4477
4978
  var batch = _self._buffer[_DYN_BATCH_PAYLOADS ](payload);
4478
4979
  var plainTextBatch = new Blob([batch], { type: "text/plain;charset=UTF-8" });
4479
4980
  var queued = nav.sendBeacon(url, plainTextBatch);
@@ -4502,7 +5003,7 @@
4502
5003
  }
4503
5004
  function _xhrSender(payload, isAsync) {
4504
5005
  var xhr = new XMLHttpRequest();
4505
- var endPointUrl = _self[_DYN__SENDER_CONFIG ][_DYN_ENDPOINT_URL ]();
5006
+ var endPointUrl = _endpointUrl;
4506
5007
  try {
4507
5008
  xhr[DisabledPropertyName] = true;
4508
5009
  }
@@ -4545,7 +5046,7 @@
4545
5046
  }
4546
5047
  function _doFetchSender(payload, isAsync) {
4547
5048
  var _a;
4548
- var endPointUrl = _self[_DYN__SENDER_CONFIG ][_DYN_ENDPOINT_URL ]();
5049
+ var endPointUrl = _endpointUrl;
4549
5050
  var batch = _self._buffer[_DYN_BATCH_PAYLOADS ](payload);
4550
5051
  var plainTextBatch = new Blob([batch], { type: "application/json" });
4551
5052
  var requestHeaders = new Headers();
@@ -4666,7 +5167,7 @@
4666
5167
  function _setupTimer() {
4667
5168
  if (!_timeoutHandle && !_paused) {
4668
5169
  var retryInterval = _retryAt ? Math.max(0, _retryAt - dateNow()) : 0;
4669
- var timerValue = Math.max(_self[_DYN__SENDER_CONFIG ][_DYN_MAX_BATCH_INTERVAL ](), retryInterval);
5170
+ var timerValue = Math.max(_maxBatchInterval, retryInterval);
4670
5171
  _timeoutHandle = setTimeout(function () {
4671
5172
  _timeoutHandle = null;
4672
5173
  _self[_DYN_TRIGGER_SEND ](true, null, 1 );
@@ -4701,13 +5202,13 @@
4701
5202
  xdr.onload = function () { return _self._xdrOnLoad(xdr, payload); };
4702
5203
  xdr.onerror = function (event) { return _self[_DYN__ON_ERROR ](payload, _formatErrorMessageXdr(xdr), event); };
4703
5204
  var hostingProtocol = _window && _window.location && _window.location.protocol || "";
4704
- if (_self[_DYN__SENDER_CONFIG ][_DYN_ENDPOINT_URL ]().lastIndexOf(hostingProtocol, 0) !== 0) {
5205
+ if (_endpointUrl.lastIndexOf(hostingProtocol, 0) !== 0) {
4705
5206
  _throwInternal(_self[_DYN_DIAG_LOG ](), 2 , 40 , ". " +
4706
5207
  "Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.");
4707
5208
  buffer[_DYN_CLEAR ]();
4708
5209
  return;
4709
5210
  }
4710
- var endpointUrl = _self[_DYN__SENDER_CONFIG ][_DYN_ENDPOINT_URL ]().replace(/^(https?:)/, "");
5211
+ var endpointUrl = _endpointUrl.replace(/^(https?:)/, "");
4711
5212
  xdr.open("POST", endpointUrl);
4712
5213
  var batch = buffer[_DYN_BATCH_PAYLOADS ](payload);
4713
5214
  xdr.send(batch);
@@ -4737,14 +5238,15 @@
4737
5238
  }
4738
5239
  }
4739
5240
  }
4740
- function _validateInstrumentationKey(config) {
4741
- var disableIKeyValidationFlag = isNullOrUndefined(config[_DYN_DISABLE_INSTRUMENTAT7 ]) ? false : config[_DYN_DISABLE_INSTRUMENTAT7 ];
5241
+ function _validateInstrumentationKey(instrumentationKey, config) {
5242
+ var disableValidation = config.disableInstrumentationKeyValidation;
5243
+ var disableIKeyValidationFlag = isNullOrUndefined(disableValidation) ? false : disableValidation;
4742
5244
  if (disableIKeyValidationFlag) {
4743
5245
  return true;
4744
5246
  }
4745
5247
  var UUID_Regex = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
4746
5248
  var regexp = new RegExp(UUID_Regex);
4747
- return regexp.test(config[_DYN_INSTRUMENTATION_KEY ]);
5249
+ return regexp.test(instrumentationKey);
4748
5250
  }
4749
5251
  function _initDefaults() {
4750
5252
  _self[_DYN__SENDER ] = null;
@@ -4764,6 +5266,22 @@
4764
5266
  _fallbackSender = null;
4765
5267
  _syncUnloadSender = null;
4766
5268
  _evtNamespace = null;
5269
+ _endpointUrl = null;
5270
+ _orgEndpointUrl = null;
5271
+ _maxBatchSizeInBytes = 0;
5272
+ _beaconSupported = false;
5273
+ _customHeaders = null;
5274
+ _disableTelemetry = false;
5275
+ _instrumentationKey = null;
5276
+ _convertUndefined = UNDEFINED_VALUE;
5277
+ _isRetryDisabled = false;
5278
+ objDefineProp(_self, "_senderConfig", {
5279
+ enumerable: true,
5280
+ configurable: true,
5281
+ get: function () {
5282
+ return objExtend({}, defaultAppInsightsChannelConfig);
5283
+ }
5284
+ });
4767
5285
  }
4768
5286
  });
4769
5287
  return _this;