@microsoft/applicationinsights-analytics-js 3.0.0-beta.2211-03 → 3.0.0-beta.2212-03
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.
- package/browser/applicationinsights-analytics-js.integrity.json +9 -9
- package/browser/applicationinsights-analytics-js.js +713 -731
- package/browser/applicationinsights-analytics-js.js.map +1 -1
- package/browser/applicationinsights-analytics-js.min.js +2 -2
- package/browser/applicationinsights-analytics-js.min.js.map +1 -1
- package/dist/applicationinsights-analytics-js.d.ts +1 -1
- package/dist/applicationinsights-analytics-js.js +713 -731
- package/dist/applicationinsights-analytics-js.js.map +1 -1
- package/dist/applicationinsights-analytics-js.min.js +2 -2
- package/dist/applicationinsights-analytics-js.min.js.map +1 -1
- package/dist/applicationinsights-analytics-js.rollup.d.ts +1 -1
- package/dist-esm/JavaScriptSDK/AnalyticsPlugin.js +2 -2
- package/dist-esm/JavaScriptSDK/AnalyticsPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js +1 -1
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js +1 -1
- package/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js +1 -1
- package/dist-esm/JavaScriptSDK/Timing.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryConfig.js +1 -1
- package/dist-esm/__DynamicConstants.js +1 -1
- package/dist-esm/applicationinsights-analytics-js.js +1 -1
- package/package.json +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Web Analytics, 3.0.0-beta.
|
|
2
|
+
* Application Insights JavaScript SDK - Web Analytics, 3.0.0-beta.2212-03
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -557,114 +557,39 @@
|
|
|
557
557
|
return registry.k[key];
|
|
558
558
|
}
|
|
559
559
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
this.constructor = d;
|
|
577
|
-
}
|
|
578
|
-
__[PROTOTYPE] = b[PROTOTYPE];
|
|
579
|
-
__[PROTOTYPE].name = name;
|
|
580
|
-
d[PROTOTYPE] = new __();
|
|
581
|
-
return d;
|
|
582
|
-
}
|
|
583
|
-
function createCustomError(name, constructCb) {
|
|
584
|
-
var baseClass = Error;
|
|
585
|
-
var customError = _createCustomError(name, function () {
|
|
586
|
-
var _this = this;
|
|
587
|
-
_this = baseClass.apply(_this, arguments) || _this;
|
|
588
|
-
constructCb && constructCb(_this, arguments);
|
|
589
|
-
return _this;
|
|
590
|
-
}, baseClass);
|
|
591
|
-
return customError;
|
|
592
|
-
}
|
|
593
|
-
var _unsupportedError;
|
|
594
|
-
function throwUnsupported(message) {
|
|
595
|
-
if (!_unsupportedError) {
|
|
596
|
-
_unsupportedError = createCustomError("UnsupportedError");
|
|
597
|
-
}
|
|
598
|
-
throw new _unsupportedError(message);
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
function dumpObj(object, format) {
|
|
602
|
-
var objectTypeDump = objToString(object);
|
|
603
|
-
var propertyValueDump = "";
|
|
604
|
-
if (objectTypeDump === "[object Error]") {
|
|
605
|
-
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
606
|
-
}
|
|
607
|
-
else {
|
|
608
|
-
try {
|
|
609
|
-
if (format) {
|
|
610
|
-
if (isNumber(format)) {
|
|
611
|
-
propertyValueDump = JSON.stringify(object, null, format);
|
|
612
|
-
}
|
|
613
|
-
else {
|
|
614
|
-
propertyValueDump = JSON.stringify(object, null, 4);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
else {
|
|
618
|
-
propertyValueDump = JSON.stringify(object);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
catch (e) {
|
|
622
|
-
propertyValueDump = objToString(object) + " - " + dumpObj(e, format);
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
return objectTypeDump + ": " + propertyValueDump;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
var _objDefineProperty$1 = ObjClass["defineProperty"];
|
|
629
|
-
function objDefineProp(target, key, descriptor) {
|
|
630
|
-
if (_objDefineProperty$1) {
|
|
631
|
-
_objDefineProperty$1(target, key, descriptor);
|
|
632
|
-
return target;
|
|
633
|
-
}
|
|
634
|
-
throwUnsupported("Unable to define property [" + objToString(key) + "] on " + dumpObj(target));
|
|
560
|
+
var propMap = {
|
|
561
|
+
e: "enumerable",
|
|
562
|
+
c: "configurable",
|
|
563
|
+
v: VALUE,
|
|
564
|
+
w: "writable",
|
|
565
|
+
g: "get",
|
|
566
|
+
s: "set"
|
|
567
|
+
};
|
|
568
|
+
function _createProp(value) {
|
|
569
|
+
var prop = {};
|
|
570
|
+
prop[propMap["c"]] = true;
|
|
571
|
+
prop[propMap["e"]] = true;
|
|
572
|
+
objForEachKey(value, function (key, value) {
|
|
573
|
+
prop[propMap[key]] = isUndefined(value) ? prop[propMap[key]] : value;
|
|
574
|
+
});
|
|
575
|
+
return prop;
|
|
635
576
|
}
|
|
636
|
-
|
|
577
|
+
var objDefineProp = ObjClass.defineProperty;
|
|
578
|
+
function objDefineAccessors(target, prop, getProp, setProp, configurable, enumerable) {
|
|
637
579
|
var desc = {
|
|
638
|
-
|
|
639
|
-
|
|
580
|
+
e: enumerable,
|
|
581
|
+
c: configurable
|
|
640
582
|
};
|
|
641
|
-
if (
|
|
642
|
-
desc.
|
|
583
|
+
if (getProp) {
|
|
584
|
+
desc.g = getProp;
|
|
643
585
|
}
|
|
644
|
-
|
|
645
|
-
desc
|
|
586
|
+
if (setProp) {
|
|
587
|
+
desc.s = setProp;
|
|
646
588
|
}
|
|
647
|
-
return objDefineProp(target,
|
|
589
|
+
return objDefineProp(target, prop, _createProp(desc));
|
|
648
590
|
}
|
|
649
|
-
function
|
|
650
|
-
|
|
651
|
-
try {
|
|
652
|
-
var descriptor = {
|
|
653
|
-
enumerable: true,
|
|
654
|
-
configurable: isUndefined(configurable) ? true : configurable
|
|
655
|
-
};
|
|
656
|
-
if (getProp) {
|
|
657
|
-
descriptor.get = getProp;
|
|
658
|
-
}
|
|
659
|
-
if (setProp) {
|
|
660
|
-
descriptor.set = setProp;
|
|
661
|
-
}
|
|
662
|
-
return objDefineProp(target, prop, descriptor);
|
|
663
|
-
}
|
|
664
|
-
catch (e) {
|
|
665
|
-
throwUnsupported("Unable to define accessors for [" + objToString(prop) + "] on " + dumpObj(target));
|
|
666
|
-
}
|
|
667
|
-
}
|
|
591
|
+
function objDefine(target, key, propDesc) {
|
|
592
|
+
return objDefineProp(target, key, _createProp(propDesc));
|
|
668
593
|
}
|
|
669
594
|
|
|
670
595
|
var _globalLazyTestHooks;
|
|
@@ -676,24 +601,21 @@
|
|
|
676
601
|
var lazyValue = {};
|
|
677
602
|
_fetchLazyTestHooks && _fetchLazyTestHooks();
|
|
678
603
|
lazyValue.b = _globalLazyTestHooks.lzy;
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
});
|
|
688
|
-
if (lazyValue.b) {
|
|
689
|
-
delete lazyValue.b;
|
|
604
|
+
objDefine(lazyValue, "v", {
|
|
605
|
+
g: function () {
|
|
606
|
+
var result = cb();
|
|
607
|
+
if (!_globalLazyTestHooks.lzy) {
|
|
608
|
+
objDefine(lazyValue, "v", { v: result });
|
|
609
|
+
if (lazyValue.b) {
|
|
610
|
+
delete lazyValue.b;
|
|
611
|
+
}
|
|
690
612
|
}
|
|
613
|
+
if (_globalLazyTestHooks.lzy && lazyValue.b !== _globalLazyTestHooks.lzy) {
|
|
614
|
+
lazyValue.b = _globalLazyTestHooks.lzy;
|
|
615
|
+
}
|
|
616
|
+
return result;
|
|
691
617
|
}
|
|
692
|
-
|
|
693
|
-
lazyValue.b = _globalLazyTestHooks.lzy;
|
|
694
|
-
}
|
|
695
|
-
return result;
|
|
696
|
-
}, true);
|
|
618
|
+
});
|
|
697
619
|
return lazyValue;
|
|
698
620
|
}
|
|
699
621
|
|
|
@@ -802,6 +724,33 @@
|
|
|
802
724
|
}
|
|
803
725
|
}
|
|
804
726
|
|
|
727
|
+
function dumpObj(object, format) {
|
|
728
|
+
var objectTypeDump = objToString(object);
|
|
729
|
+
var propertyValueDump = "";
|
|
730
|
+
if (objectTypeDump === "[object Error]") {
|
|
731
|
+
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
732
|
+
}
|
|
733
|
+
else {
|
|
734
|
+
try {
|
|
735
|
+
if (format) {
|
|
736
|
+
if (isNumber(format)) {
|
|
737
|
+
propertyValueDump = JSON.stringify(object, null, format);
|
|
738
|
+
}
|
|
739
|
+
else {
|
|
740
|
+
propertyValueDump = JSON.stringify(object, null, 4);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
else {
|
|
744
|
+
propertyValueDump = JSON.stringify(object);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
catch (e) {
|
|
748
|
+
propertyValueDump = objToString(object) + " - " + dumpObj(e, format);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
return objectTypeDump + ": " + propertyValueDump;
|
|
752
|
+
}
|
|
753
|
+
|
|
805
754
|
function _unwrapFunction(funcName) {
|
|
806
755
|
return function (thisArg) {
|
|
807
756
|
var args = [];
|
|
@@ -819,6 +768,40 @@
|
|
|
819
768
|
|
|
820
769
|
var arrMap = _unwrapFunction("map");
|
|
821
770
|
|
|
771
|
+
function objSetPrototypeOf(obj, proto) {
|
|
772
|
+
var fn = ObjClass["setPrototypeOf"] ||
|
|
773
|
+
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
774
|
+
d.__proto__ = b;
|
|
775
|
+
}) ||
|
|
776
|
+
function (d, b) {
|
|
777
|
+
objForEachKey(b, function (key, value) {
|
|
778
|
+
d[key] = value;
|
|
779
|
+
});
|
|
780
|
+
};
|
|
781
|
+
return fn(obj, proto);
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
function _createCustomError(name, d, b) {
|
|
785
|
+
objSetPrototypeOf(d, b);
|
|
786
|
+
function __() {
|
|
787
|
+
this.constructor = d;
|
|
788
|
+
}
|
|
789
|
+
__[PROTOTYPE] = b[PROTOTYPE];
|
|
790
|
+
__[PROTOTYPE].name = name;
|
|
791
|
+
d[PROTOTYPE] = new __();
|
|
792
|
+
return d;
|
|
793
|
+
}
|
|
794
|
+
function createCustomError(name, constructCb) {
|
|
795
|
+
var baseClass = Error;
|
|
796
|
+
var customError = _createCustomError(name, function () {
|
|
797
|
+
var _this = this;
|
|
798
|
+
_this = baseClass.apply(_this, arguments) || _this;
|
|
799
|
+
constructCb && constructCb(_this, arguments);
|
|
800
|
+
return _this;
|
|
801
|
+
}, baseClass);
|
|
802
|
+
return customError;
|
|
803
|
+
}
|
|
804
|
+
|
|
822
805
|
function utcNow() {
|
|
823
806
|
return (Date.now || polyUtcNow)();
|
|
824
807
|
}
|
|
@@ -965,13 +948,14 @@
|
|
|
965
948
|
var _DYN_INITIALIZE = "initialize";
|
|
966
949
|
var _DYN_IDENTIFIER = "identifier";
|
|
967
950
|
var _DYN_IS_INITIALIZED = "isInitialized";
|
|
951
|
+
var _DYN_GET_PLUGIN = "getPlugin";
|
|
968
952
|
var _DYN_NAME$1 = "name";
|
|
969
953
|
var _DYN_TIME = "time";
|
|
970
954
|
var _DYN_PROCESS_NEXT = "processNext";
|
|
971
955
|
var _DYN_GET_PROCESS_TEL_CONT0 = "getProcessTelContext";
|
|
972
956
|
var _DYN_CALL = "call";
|
|
973
|
-
var _DYN_GET_PLUGIN = "getPlugin";
|
|
974
957
|
var _DYN_LOGGING_LEVEL_CONSOL4 = "loggingLevelConsole";
|
|
958
|
+
var _DYN_CREATE_NEW = "createNew";
|
|
975
959
|
var _DYN_TEARDOWN = "teardown";
|
|
976
960
|
var _DYN_MESSAGE_ID = "messageId";
|
|
977
961
|
var _DYN_MESSAGE$2 = "message";
|
|
@@ -981,8 +965,6 @@
|
|
|
981
965
|
var _DYN_UPDATE = "update";
|
|
982
966
|
var _DYN_GET_NEXT = "getNext";
|
|
983
967
|
var _DYN_SET_NEXT_PLUGIN = "setNextPlugin";
|
|
984
|
-
var _DYN_CREATE_NEW = "createNew";
|
|
985
|
-
var _DYN_CONFIG = "config";
|
|
986
968
|
var _DYN_USER_AGENT = "userAgent";
|
|
987
969
|
var _DYN_SPLIT$1 = "split";
|
|
988
970
|
var _DYN_NODE_TYPE = "nodeType";
|
|
@@ -1226,7 +1208,7 @@
|
|
|
1226
1208
|
}
|
|
1227
1209
|
|
|
1228
1210
|
var _objDefineProperty = ObjDefineProperty;
|
|
1229
|
-
var version = "3.0.0-beta.
|
|
1211
|
+
var version = "3.0.0-beta.2212-03";
|
|
1230
1212
|
var instanceName = "." + newId(6);
|
|
1231
1213
|
var _dataUid = 0;
|
|
1232
1214
|
function _createAccessor(target, prop, value) {
|
|
@@ -1910,167 +1892,445 @@
|
|
|
1910
1892
|
_getLogger(logger)[STR_WARN_TO_CONSOLE ](message);
|
|
1911
1893
|
}
|
|
1912
1894
|
|
|
1913
|
-
var
|
|
1914
|
-
var
|
|
1915
|
-
var
|
|
1916
|
-
var
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1895
|
+
var _a$2, _b;
|
|
1896
|
+
var strToGMTString = "toGMTString";
|
|
1897
|
+
var strToUTCString = "toUTCString";
|
|
1898
|
+
var strCookie = "cookie";
|
|
1899
|
+
var strExpires = "expires";
|
|
1900
|
+
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
1901
|
+
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
1902
|
+
var strConfigCookieMgr = "_ckMgr";
|
|
1903
|
+
var _supportsCookies = null;
|
|
1904
|
+
var _allowUaSameSite = null;
|
|
1905
|
+
var _parsedCookieValue = null;
|
|
1906
|
+
var _doc = getDocument();
|
|
1907
|
+
var _cookieCache = {};
|
|
1908
|
+
var _globalCookieConfig = {};
|
|
1909
|
+
var defaultConfig = objDeepFreeze((_a$2 = {},
|
|
1910
|
+
_a$2[STR_DOMAIN] = { fb: "cookieDomain", dfVal: isNotNullOrUndefined },
|
|
1911
|
+
_a$2.path = { fb: "cookiePath", dfVal: isNotNullOrUndefined },
|
|
1912
|
+
_a$2.enabled = UNDEFINED_VALUE,
|
|
1913
|
+
_a$2));
|
|
1914
|
+
var rootDefaultConfig = (_b = {
|
|
1915
|
+
cookieCfg: {},
|
|
1916
|
+
cookieDomain: UNDEFINED_VALUE,
|
|
1917
|
+
cookiePath: UNDEFINED_VALUE
|
|
1918
|
+
},
|
|
1919
|
+
_b[strDisableCookiesUsage] = UNDEFINED_VALUE,
|
|
1920
|
+
_b);
|
|
1921
|
+
function _gblCookieMgr(config, logger) {
|
|
1922
|
+
var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
|
|
1923
|
+
if (!inst) {
|
|
1924
|
+
inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
|
|
1925
|
+
_globalCookieConfig[strConfigCookieMgr] = inst;
|
|
1926
|
+
}
|
|
1927
|
+
return inst;
|
|
1928
|
+
}
|
|
1929
|
+
function _isMgrEnabled(cookieMgr) {
|
|
1930
|
+
if (cookieMgr) {
|
|
1931
|
+
return cookieMgr.isEnabled();
|
|
1932
|
+
}
|
|
1933
|
+
return true;
|
|
1934
|
+
}
|
|
1935
|
+
function _isIgnoredCookie(cookieMgrCfg, name) {
|
|
1936
|
+
if (name && cookieMgrCfg && isArray(cookieMgrCfg.ignoreCookies)) {
|
|
1937
|
+
return arrIndexOf(cookieMgrCfg.ignoreCookies, name) !== -1;
|
|
1938
|
+
}
|
|
1939
|
+
return false;
|
|
1940
|
+
}
|
|
1941
|
+
function _isBlockedCookie(cookieMgrCfg, name) {
|
|
1942
|
+
if (name && cookieMgrCfg && isArray(cookieMgrCfg.blockedCookies)) {
|
|
1943
|
+
if (arrIndexOf(cookieMgrCfg.blockedCookies, name) !== -1) {
|
|
1944
|
+
return true;
|
|
1932
1945
|
}
|
|
1933
|
-
_self[_DYN_GET_CTX ] = function (key) {
|
|
1934
|
-
if (key) {
|
|
1935
|
-
if (key === PerfEvent[strParentContextKey] || key === PerfEvent[strChildrenContextKey]) {
|
|
1936
|
-
return _self[key];
|
|
1937
|
-
}
|
|
1938
|
-
return (_self[strExecutionContextKey] || {})[key];
|
|
1939
|
-
}
|
|
1940
|
-
return null;
|
|
1941
|
-
};
|
|
1942
|
-
_self[_DYN_SET_CTX ] = function (key, value) {
|
|
1943
|
-
if (key) {
|
|
1944
|
-
if (key === PerfEvent[strParentContextKey]) {
|
|
1945
|
-
if (!_self[key]) {
|
|
1946
|
-
_self[_DYN_IS_CHILD_EVT ] = function () { return true; };
|
|
1947
|
-
}
|
|
1948
|
-
_self[key] = value;
|
|
1949
|
-
}
|
|
1950
|
-
else if (key === PerfEvent[strChildrenContextKey]) {
|
|
1951
|
-
_self[key] = value;
|
|
1952
|
-
}
|
|
1953
|
-
else {
|
|
1954
|
-
var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};
|
|
1955
|
-
ctx[key] = value;
|
|
1956
|
-
}
|
|
1957
|
-
}
|
|
1958
|
-
};
|
|
1959
|
-
_self[_DYN_COMPLETE ] = function () {
|
|
1960
|
-
var childTime = 0;
|
|
1961
|
-
var childEvts = _self[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
|
|
1962
|
-
if (isArray(childEvts)) {
|
|
1963
|
-
for (var lp = 0; lp < childEvts[_DYN_LENGTH$2 ]; lp++) {
|
|
1964
|
-
var childEvt = childEvts[lp];
|
|
1965
|
-
if (childEvt) {
|
|
1966
|
-
childTime += childEvt[_DYN_TIME ];
|
|
1967
|
-
}
|
|
1968
|
-
}
|
|
1969
|
-
}
|
|
1970
|
-
_self[_DYN_TIME ] = utcNow() - _self.start;
|
|
1971
|
-
_self.exTime = _self[_DYN_TIME ] - childTime;
|
|
1972
|
-
_self[_DYN_COMPLETE ] = function () { };
|
|
1973
|
-
};
|
|
1974
1946
|
}
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1947
|
+
return _isIgnoredCookie(cookieMgrCfg, name);
|
|
1948
|
+
}
|
|
1949
|
+
function safeGetCookieMgr(core, config) {
|
|
1950
|
+
var cookieMgr;
|
|
1951
|
+
if (core) {
|
|
1952
|
+
cookieMgr = core.getCookieMgr();
|
|
1953
|
+
}
|
|
1954
|
+
else if (config) {
|
|
1955
|
+
var cookieCfg = config.cookieCfg;
|
|
1956
|
+
if (cookieCfg && cookieCfg[strConfigCookieMgr]) {
|
|
1957
|
+
cookieMgr = cookieCfg[strConfigCookieMgr];
|
|
1985
1958
|
}
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
1959
|
+
else {
|
|
1960
|
+
cookieMgr = createCookieMgr(config);
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
if (!cookieMgr) {
|
|
1964
|
+
cookieMgr = _gblCookieMgr(config, (core || {})[_DYN_LOGGER ]);
|
|
1965
|
+
}
|
|
1966
|
+
return cookieMgr;
|
|
1967
|
+
}
|
|
1968
|
+
function createCookieMgr(rootConfig, logger) {
|
|
1969
|
+
var cookieMgrConfig;
|
|
1970
|
+
var _path;
|
|
1971
|
+
var _domain;
|
|
1972
|
+
var _enabled;
|
|
1973
|
+
var _getCookieFn;
|
|
1974
|
+
var _setCookieFn;
|
|
1975
|
+
var _delCookieFn;
|
|
1976
|
+
rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;
|
|
1977
|
+
onConfigChange(rootConfig, function (details) {
|
|
1978
|
+
details[_DYN_SET_DF ](details.cfg, rootDefaultConfig);
|
|
1979
|
+
cookieMgrConfig = details[_DYN_SET_DF ](details.cfg.cookieCfg, defaultConfig);
|
|
1980
|
+
var isEnabled = cookieMgrConfig.enabled;
|
|
1981
|
+
if (isNullOrUndefined(isEnabled)) {
|
|
1982
|
+
var cookieEnabled = void 0;
|
|
1983
|
+
if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
|
|
1984
|
+
cookieEnabled = !rootConfig[strIsCookieUseDisabled];
|
|
1985
|
+
}
|
|
1986
|
+
if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
|
|
1987
|
+
cookieEnabled = !rootConfig[strDisableCookiesUsage];
|
|
1988
|
+
}
|
|
1989
|
+
isEnabled = cookieEnabled;
|
|
1990
|
+
}
|
|
1991
|
+
_path = cookieMgrConfig[STR_PATH ] || "/";
|
|
1992
|
+
_domain = cookieMgrConfig[STR_DOMAIN ];
|
|
1993
|
+
_enabled = isEnabled !== false;
|
|
1994
|
+
_getCookieFn = cookieMgrConfig.getCookie || _getCookieValue;
|
|
1995
|
+
_setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
|
|
1996
|
+
_delCookieFn = cookieMgrConfig.delCookie || _setCookieValue;
|
|
1997
|
+
}, logger);
|
|
1998
|
+
var cookieMgr = {
|
|
1999
|
+
isEnabled: function () {
|
|
2000
|
+
var enabled = _enabled && areCookiesSupported(logger);
|
|
2001
|
+
var gblManager = _globalCookieConfig[strConfigCookieMgr];
|
|
2002
|
+
if (enabled && gblManager && cookieMgr !== gblManager) {
|
|
2003
|
+
enabled = _isMgrEnabled(gblManager);
|
|
2004
|
+
}
|
|
2005
|
+
return enabled;
|
|
2006
|
+
},
|
|
2007
|
+
setEnabled: function (value) {
|
|
2008
|
+
_enabled = value !== false;
|
|
2009
|
+
},
|
|
2010
|
+
set: function (name, value, maxAgeSec, domain, path) {
|
|
2011
|
+
var result = false;
|
|
2012
|
+
if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
|
|
2013
|
+
var values = {};
|
|
2014
|
+
var theValue = strTrim(value || STR_EMPTY);
|
|
2015
|
+
var idx = strIndexOf(theValue, ";");
|
|
2016
|
+
if (idx !== -1) {
|
|
2017
|
+
theValue = strTrim(strLeft(value, idx));
|
|
2018
|
+
values = _extractParts(strSubstring(value, idx + 1));
|
|
2019
|
+
}
|
|
2020
|
+
setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
|
|
2021
|
+
if (!isNullOrUndefined(maxAgeSec)) {
|
|
2022
|
+
var _isIE = isIE();
|
|
2023
|
+
if (isUndefined(values[strExpires])) {
|
|
2024
|
+
var nowMs = utcNow();
|
|
2025
|
+
var expireMs = nowMs + (maxAgeSec * 1000);
|
|
2026
|
+
if (expireMs > 0) {
|
|
2027
|
+
var expiry = new Date();
|
|
2028
|
+
expiry.setTime(expireMs);
|
|
2029
|
+
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
|
|
2001
2030
|
}
|
|
2002
2031
|
}
|
|
2003
|
-
|
|
2004
|
-
|
|
2032
|
+
if (!_isIE) {
|
|
2033
|
+
setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
|
|
2034
|
+
}
|
|
2005
2035
|
}
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2036
|
+
var location_1 = getLocation();
|
|
2037
|
+
if (location_1 && location_1.protocol === "https:") {
|
|
2038
|
+
setValue(values, "secure", null, null, isUndefined);
|
|
2039
|
+
if (_allowUaSameSite === null) {
|
|
2040
|
+
_allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
|
|
2041
|
+
}
|
|
2042
|
+
if (_allowUaSameSite) {
|
|
2043
|
+
setValue(values, "SameSite", "None", null, isUndefined);
|
|
2044
|
+
}
|
|
2010
2045
|
}
|
|
2046
|
+
setValue(values, STR_PATH, path || _path, null, isUndefined);
|
|
2047
|
+
_setCookieFn(name, _formatCookieValue(theValue, values));
|
|
2048
|
+
result = true;
|
|
2011
2049
|
}
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2050
|
+
return result;
|
|
2051
|
+
},
|
|
2052
|
+
get: function (name) {
|
|
2053
|
+
var value = STR_EMPTY;
|
|
2054
|
+
if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {
|
|
2055
|
+
value = _getCookieFn(name);
|
|
2056
|
+
}
|
|
2057
|
+
return value;
|
|
2058
|
+
},
|
|
2059
|
+
del: function (name, path) {
|
|
2060
|
+
var result = false;
|
|
2061
|
+
if (_isMgrEnabled(cookieMgr)) {
|
|
2062
|
+
result = cookieMgr.purge(name, path);
|
|
2063
|
+
}
|
|
2064
|
+
return result;
|
|
2065
|
+
},
|
|
2066
|
+
purge: function (name, path) {
|
|
2067
|
+
var _a;
|
|
2068
|
+
var result = false;
|
|
2069
|
+
if (areCookiesSupported(logger)) {
|
|
2070
|
+
var values = (_a = {},
|
|
2071
|
+
_a[STR_PATH] = path ? path : "/",
|
|
2072
|
+
_a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
|
|
2073
|
+
_a);
|
|
2074
|
+
if (!isIE()) {
|
|
2075
|
+
values["max-age"] = "0";
|
|
2015
2076
|
}
|
|
2016
|
-
|
|
2077
|
+
_delCookieFn(name, _formatCookieValue(STR_EMPTY, values));
|
|
2078
|
+
result = true;
|
|
2017
2079
|
}
|
|
2080
|
+
return result;
|
|
2018
2081
|
}
|
|
2019
|
-
}
|
|
2020
|
-
|
|
2082
|
+
};
|
|
2083
|
+
cookieMgr[strConfigCookieMgr] = cookieMgr;
|
|
2084
|
+
return cookieMgr;
|
|
2021
2085
|
}
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
hexValues[tmp >> 12 & 0xF] +
|
|
2033
|
-
hexValues[tmp >> 16 & 0xF] +
|
|
2034
|
-
hexValues[tmp >> 20 & 0xF] +
|
|
2035
|
-
hexValues[tmp >> 24 & 0xF] +
|
|
2036
|
-
hexValues[tmp >> 28 & 0xF];
|
|
2086
|
+
function areCookiesSupported(logger) {
|
|
2087
|
+
if (_supportsCookies === null) {
|
|
2088
|
+
_supportsCookies = false;
|
|
2089
|
+
try {
|
|
2090
|
+
var doc = _doc || {};
|
|
2091
|
+
_supportsCookies = doc[strCookie] !== undefined;
|
|
2092
|
+
}
|
|
2093
|
+
catch (e) {
|
|
2094
|
+
_throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2095
|
+
}
|
|
2037
2096
|
}
|
|
2038
|
-
|
|
2039
|
-
return strSubstr(oct, 0, 8) + strSubstr(oct, 9, 4) + "4" + strSubstr(oct, 13, 3) + clockSequenceHi + strSubstr(oct, 16, 3) + strSubstr(oct, 19, 12);
|
|
2097
|
+
return _supportsCookies;
|
|
2040
2098
|
}
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2099
|
+
function _extractParts(theValue) {
|
|
2100
|
+
var values = {};
|
|
2101
|
+
if (theValue && theValue[_DYN_LENGTH$2 ]) {
|
|
2102
|
+
var parts = strTrim(theValue)[_DYN_SPLIT$1 ](";");
|
|
2103
|
+
arrForEach(parts, function (thePart) {
|
|
2104
|
+
thePart = strTrim(thePart || STR_EMPTY);
|
|
2105
|
+
if (thePart) {
|
|
2106
|
+
var idx = strIndexOf(thePart, "=");
|
|
2107
|
+
if (idx === -1) {
|
|
2108
|
+
values[thePart] = null;
|
|
2109
|
+
}
|
|
2110
|
+
else {
|
|
2111
|
+
values[strTrim(strLeft(thePart, idx))] = strTrim(strSubstring(thePart, idx + 1));
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
});
|
|
2047
2115
|
}
|
|
2048
|
-
return
|
|
2049
|
-
}
|
|
2050
|
-
function isValidTraceId(value) {
|
|
2051
|
-
return _isValid(value, 32, INVALID_TRACE_ID);
|
|
2116
|
+
return values;
|
|
2052
2117
|
}
|
|
2053
|
-
function
|
|
2054
|
-
|
|
2118
|
+
function _formatDate(theDate, func) {
|
|
2119
|
+
if (isFunction(theDate[func])) {
|
|
2120
|
+
return theDate[func]();
|
|
2121
|
+
}
|
|
2122
|
+
return null;
|
|
2055
2123
|
}
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2124
|
+
function _formatCookieValue(value, values) {
|
|
2125
|
+
var cookieValue = value || STR_EMPTY;
|
|
2126
|
+
objForEachKey(values, function (name, theValue) {
|
|
2127
|
+
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : STR_EMPTY);
|
|
2128
|
+
});
|
|
2129
|
+
return cookieValue;
|
|
2060
2130
|
}
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
if (proxy[_DYN_GET_PLUGIN ]() === startAt) {
|
|
2069
|
-
return proxy;
|
|
2131
|
+
function _getCookieValue(name) {
|
|
2132
|
+
var cookieValue = STR_EMPTY;
|
|
2133
|
+
if (_doc) {
|
|
2134
|
+
var theCookie = _doc[strCookie] || STR_EMPTY;
|
|
2135
|
+
if (_parsedCookieValue !== theCookie) {
|
|
2136
|
+
_cookieCache = _extractParts(theCookie);
|
|
2137
|
+
_parsedCookieValue = theCookie;
|
|
2070
2138
|
}
|
|
2071
|
-
|
|
2139
|
+
cookieValue = strTrim(_cookieCache[name] || STR_EMPTY);
|
|
2072
2140
|
}
|
|
2073
|
-
return
|
|
2141
|
+
return cookieValue;
|
|
2142
|
+
}
|
|
2143
|
+
function _setCookieValue(name, cookieValue) {
|
|
2144
|
+
if (_doc) {
|
|
2145
|
+
_doc[strCookie] = name + "=" + cookieValue;
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
function uaDisallowsSameSiteNone(userAgent) {
|
|
2149
|
+
if (!isString(userAgent)) {
|
|
2150
|
+
return false;
|
|
2151
|
+
}
|
|
2152
|
+
if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
|
|
2153
|
+
return true;
|
|
2154
|
+
}
|
|
2155
|
+
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
|
|
2156
|
+
return true;
|
|
2157
|
+
}
|
|
2158
|
+
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
|
|
2159
|
+
return true;
|
|
2160
|
+
}
|
|
2161
|
+
if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
|
|
2162
|
+
return true;
|
|
2163
|
+
}
|
|
2164
|
+
if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
|
|
2165
|
+
return true;
|
|
2166
|
+
}
|
|
2167
|
+
if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
|
|
2168
|
+
return true;
|
|
2169
|
+
}
|
|
2170
|
+
return false;
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
var strExecutionContextKey = "ctx";
|
|
2174
|
+
var strParentContextKey = "ParentContextKey";
|
|
2175
|
+
var strChildrenContextKey = "ChildrenContextKey";
|
|
2176
|
+
var PerfEvent = /** @class */ (function () {
|
|
2177
|
+
function PerfEvent(name, payloadDetails, isAsync) {
|
|
2178
|
+
var _self = this;
|
|
2179
|
+
_self.start = utcNow();
|
|
2180
|
+
_self[_DYN_NAME$1 ] = name;
|
|
2181
|
+
_self[_DYN_IS_ASYNC ] = isAsync;
|
|
2182
|
+
_self[_DYN_IS_CHILD_EVT ] = function () { return false; };
|
|
2183
|
+
if (isFunction(payloadDetails)) {
|
|
2184
|
+
var theDetails_1;
|
|
2185
|
+
objDefineAccessors(_self, "payload", function () {
|
|
2186
|
+
if (!theDetails_1 && isFunction(payloadDetails)) {
|
|
2187
|
+
theDetails_1 = payloadDetails();
|
|
2188
|
+
payloadDetails = null;
|
|
2189
|
+
}
|
|
2190
|
+
return theDetails_1;
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2193
|
+
_self[_DYN_GET_CTX ] = function (key) {
|
|
2194
|
+
if (key) {
|
|
2195
|
+
if (key === PerfEvent[strParentContextKey] || key === PerfEvent[strChildrenContextKey]) {
|
|
2196
|
+
return _self[key];
|
|
2197
|
+
}
|
|
2198
|
+
return (_self[strExecutionContextKey] || {})[key];
|
|
2199
|
+
}
|
|
2200
|
+
return null;
|
|
2201
|
+
};
|
|
2202
|
+
_self[_DYN_SET_CTX ] = function (key, value) {
|
|
2203
|
+
if (key) {
|
|
2204
|
+
if (key === PerfEvent[strParentContextKey]) {
|
|
2205
|
+
if (!_self[key]) {
|
|
2206
|
+
_self[_DYN_IS_CHILD_EVT ] = function () { return true; };
|
|
2207
|
+
}
|
|
2208
|
+
_self[key] = value;
|
|
2209
|
+
}
|
|
2210
|
+
else if (key === PerfEvent[strChildrenContextKey]) {
|
|
2211
|
+
_self[key] = value;
|
|
2212
|
+
}
|
|
2213
|
+
else {
|
|
2214
|
+
var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};
|
|
2215
|
+
ctx[key] = value;
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
};
|
|
2219
|
+
_self[_DYN_COMPLETE ] = function () {
|
|
2220
|
+
var childTime = 0;
|
|
2221
|
+
var childEvts = _self[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
|
|
2222
|
+
if (isArray(childEvts)) {
|
|
2223
|
+
for (var lp = 0; lp < childEvts[_DYN_LENGTH$2 ]; lp++) {
|
|
2224
|
+
var childEvt = childEvts[lp];
|
|
2225
|
+
if (childEvt) {
|
|
2226
|
+
childTime += childEvt[_DYN_TIME ];
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
_self[_DYN_TIME ] = utcNow() - _self.start;
|
|
2231
|
+
_self.exTime = _self[_DYN_TIME ] - childTime;
|
|
2232
|
+
_self[_DYN_COMPLETE ] = function () { };
|
|
2233
|
+
};
|
|
2234
|
+
}
|
|
2235
|
+
PerfEvent.ParentContextKey = "parent";
|
|
2236
|
+
PerfEvent.ChildrenContextKey = "childEvts";
|
|
2237
|
+
return PerfEvent;
|
|
2238
|
+
}());
|
|
2239
|
+
var doPerfActiveKey = "CoreUtils.doPerf";
|
|
2240
|
+
function doPerf(mgrSource, getSource, func, details, isAsync) {
|
|
2241
|
+
if (mgrSource) {
|
|
2242
|
+
var perfMgr = mgrSource;
|
|
2243
|
+
if (perfMgr[STR_GET_PERF_MGR]) {
|
|
2244
|
+
perfMgr = perfMgr[STR_GET_PERF_MGR]();
|
|
2245
|
+
}
|
|
2246
|
+
if (perfMgr) {
|
|
2247
|
+
var perfEvt = void 0;
|
|
2248
|
+
var currentActive = perfMgr[_DYN_GET_CTX ](doPerfActiveKey);
|
|
2249
|
+
try {
|
|
2250
|
+
perfEvt = perfMgr.create(getSource(), details, isAsync);
|
|
2251
|
+
if (perfEvt) {
|
|
2252
|
+
if (currentActive && perfEvt[_DYN_SET_CTX ]) {
|
|
2253
|
+
perfEvt[_DYN_SET_CTX ](PerfEvent[strParentContextKey], currentActive);
|
|
2254
|
+
if (currentActive[_DYN_GET_CTX ] && currentActive[_DYN_SET_CTX ]) {
|
|
2255
|
+
var children = currentActive[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
|
|
2256
|
+
if (!children) {
|
|
2257
|
+
children = [];
|
|
2258
|
+
currentActive[_DYN_SET_CTX ](PerfEvent[strChildrenContextKey], children);
|
|
2259
|
+
}
|
|
2260
|
+
children[_DYN_PUSH ](perfEvt);
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
perfMgr[_DYN_SET_CTX ](doPerfActiveKey, perfEvt);
|
|
2264
|
+
return func(perfEvt);
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
catch (ex) {
|
|
2268
|
+
if (perfEvt && perfEvt[_DYN_SET_CTX ]) {
|
|
2269
|
+
perfEvt[_DYN_SET_CTX ]("exception", ex);
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
finally {
|
|
2273
|
+
if (perfEvt) {
|
|
2274
|
+
perfMgr.fire(perfEvt);
|
|
2275
|
+
}
|
|
2276
|
+
perfMgr[_DYN_SET_CTX ](doPerfActiveKey, currentActive);
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
return func();
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
function generateW3CId() {
|
|
2284
|
+
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
2285
|
+
var oct = STR_EMPTY, tmp;
|
|
2286
|
+
for (var a = 0; a < 4; a++) {
|
|
2287
|
+
tmp = random32();
|
|
2288
|
+
oct +=
|
|
2289
|
+
hexValues[tmp & 0xF] +
|
|
2290
|
+
hexValues[tmp >> 4 & 0xF] +
|
|
2291
|
+
hexValues[tmp >> 8 & 0xF] +
|
|
2292
|
+
hexValues[tmp >> 12 & 0xF] +
|
|
2293
|
+
hexValues[tmp >> 16 & 0xF] +
|
|
2294
|
+
hexValues[tmp >> 20 & 0xF] +
|
|
2295
|
+
hexValues[tmp >> 24 & 0xF] +
|
|
2296
|
+
hexValues[tmp >> 28 & 0xF];
|
|
2297
|
+
}
|
|
2298
|
+
var clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];
|
|
2299
|
+
return strSubstr(oct, 0, 8) + strSubstr(oct, 9, 4) + "4" + strSubstr(oct, 13, 3) + clockSequenceHi + strSubstr(oct, 16, 3) + strSubstr(oct, 19, 12);
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
var INVALID_TRACE_ID = "00000000000000000000000000000000";
|
|
2303
|
+
var INVALID_SPAN_ID = "0000000000000000";
|
|
2304
|
+
function _isValid(value, len, invalidValue) {
|
|
2305
|
+
if (value && value[_DYN_LENGTH$2 ] === len && value !== invalidValue) {
|
|
2306
|
+
return !!value.match(/^[\da-f]*$/i);
|
|
2307
|
+
}
|
|
2308
|
+
return false;
|
|
2309
|
+
}
|
|
2310
|
+
function isValidTraceId(value) {
|
|
2311
|
+
return _isValid(value, 32, INVALID_TRACE_ID);
|
|
2312
|
+
}
|
|
2313
|
+
function isValidSpanId(value) {
|
|
2314
|
+
return _isValid(value, 16, INVALID_SPAN_ID);
|
|
2315
|
+
}
|
|
2316
|
+
|
|
2317
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
2318
|
+
function _getPluginState(plugin) {
|
|
2319
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
2323
|
+
var strHasRunFlags = "_hasRun";
|
|
2324
|
+
var strGetTelCtx = "_getTelCtx";
|
|
2325
|
+
var _chainId = 0;
|
|
2326
|
+
function _getNextProxyStart(proxy, core, startAt) {
|
|
2327
|
+
while (proxy) {
|
|
2328
|
+
if (proxy[_DYN_GET_PLUGIN ]() === startAt) {
|
|
2329
|
+
return proxy;
|
|
2330
|
+
}
|
|
2331
|
+
proxy = proxy[_DYN_GET_NEXT ]();
|
|
2332
|
+
}
|
|
2333
|
+
return createTelemetryProxyChain([startAt], core.config || {}, core);
|
|
2074
2334
|
}
|
|
2075
2335
|
function _createInternalContext(telemetryChain, dynamicHandler, core, startAt) {
|
|
2076
2336
|
var _nextProxy = null;
|
|
@@ -2209,492 +2469,214 @@
|
|
|
2209
2469
|
if (nextPlugin) {
|
|
2210
2470
|
nextPlugin[STR_PROCESS_TELEMETRY ](env, context);
|
|
2211
2471
|
}
|
|
2212
|
-
return !nextPlugin;
|
|
2213
|
-
}
|
|
2214
|
-
function _createNew(plugins, startAt) {
|
|
2215
|
-
if (plugins === void 0) { plugins = null; }
|
|
2216
|
-
if (isArray(plugins)) {
|
|
2217
|
-
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2218
|
-
}
|
|
2219
|
-
return createProcessTelemetryContext(plugins || context[_DYN_GET_NEXT ](), config.cfg, core, startAt);
|
|
2220
|
-
}
|
|
2221
|
-
context[_DYN_PROCESS_NEXT ] = _processNext;
|
|
2222
|
-
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2223
|
-
return context;
|
|
2224
|
-
}
|
|
2225
|
-
function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {
|
|
2226
|
-
var config = createDynamicConfig(core[_DYN_CONFIG ]);
|
|
2227
|
-
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
2228
|
-
var context = internalContext.ctx;
|
|
2229
|
-
function _processNext(unloadState) {
|
|
2230
|
-
var nextPlugin = internalContext._next();
|
|
2231
|
-
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
2232
|
-
return !nextPlugin;
|
|
2233
|
-
}
|
|
2234
|
-
function _createNew(plugins, startAt) {
|
|
2235
|
-
if (plugins === void 0) { plugins = null; }
|
|
2236
|
-
if (isArray(plugins)) {
|
|
2237
|
-
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2238
|
-
}
|
|
2239
|
-
return createProcessTelemetryUnloadContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
|
|
2240
|
-
}
|
|
2241
|
-
context[_DYN_PROCESS_NEXT ] = _processNext;
|
|
2242
|
-
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2243
|
-
return context;
|
|
2244
|
-
}
|
|
2245
|
-
function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {
|
|
2246
|
-
var config = createDynamicConfig(core[_DYN_CONFIG ]);
|
|
2247
|
-
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
2248
|
-
var context = internalContext.ctx;
|
|
2249
|
-
function _processNext(updateState) {
|
|
2250
|
-
return context.iterate(function (plugin) {
|
|
2251
|
-
if (isFunction(plugin[_DYN_UPDATE ])) {
|
|
2252
|
-
plugin[_DYN_UPDATE ](context, updateState);
|
|
2253
|
-
}
|
|
2254
|
-
});
|
|
2255
|
-
}
|
|
2256
|
-
function _createNew(plugins, startAt) {
|
|
2257
|
-
if (plugins === void 0) { plugins = null; }
|
|
2258
|
-
if (isArray(plugins)) {
|
|
2259
|
-
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2260
|
-
}
|
|
2261
|
-
return createProcessTelemetryUpdateContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
|
|
2262
|
-
}
|
|
2263
|
-
context[_DYN_PROCESS_NEXT ] = _processNext;
|
|
2264
|
-
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2265
|
-
return context;
|
|
2266
|
-
}
|
|
2267
|
-
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
2268
|
-
var firstProxy = null;
|
|
2269
|
-
var add = startAt ? false : true;
|
|
2270
|
-
if (isArray(plugins) && plugins[_DYN_LENGTH$2 ] > 0) {
|
|
2271
|
-
var lastProxy_1 = null;
|
|
2272
|
-
arrForEach(plugins, function (thePlugin) {
|
|
2273
|
-
if (!add && startAt === thePlugin) {
|
|
2274
|
-
add = true;
|
|
2275
|
-
}
|
|
2276
|
-
if (add && thePlugin && isFunction(thePlugin[STR_PROCESS_TELEMETRY ])) {
|
|
2277
|
-
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
2278
|
-
if (!firstProxy) {
|
|
2279
|
-
firstProxy = newProxy;
|
|
2280
|
-
}
|
|
2281
|
-
if (lastProxy_1) {
|
|
2282
|
-
lastProxy_1._setNext(newProxy);
|
|
2283
|
-
}
|
|
2284
|
-
lastProxy_1 = newProxy;
|
|
2285
|
-
}
|
|
2286
|
-
});
|
|
2287
|
-
}
|
|
2288
|
-
if (startAt && !firstProxy) {
|
|
2289
|
-
return createTelemetryProxyChain([startAt], config, core);
|
|
2290
|
-
}
|
|
2291
|
-
return firstProxy;
|
|
2292
|
-
}
|
|
2293
|
-
function createTelemetryPluginProxy(plugin, config, core) {
|
|
2294
|
-
var nextProxy = null;
|
|
2295
|
-
var hasProcessTelemetry = isFunction(plugin[STR_PROCESS_TELEMETRY ]);
|
|
2296
|
-
var hasSetNext = isFunction(plugin[_DYN_SET_NEXT_PLUGIN ]);
|
|
2297
|
-
var chainId;
|
|
2298
|
-
if (plugin) {
|
|
2299
|
-
chainId = plugin[_DYN_IDENTIFIER ] + "-" + plugin[STR_PRIORITY ] + "-" + _chainId++;
|
|
2300
|
-
}
|
|
2301
|
-
else {
|
|
2302
|
-
chainId = "Unknown-0-" + _chainId++;
|
|
2303
|
-
}
|
|
2304
|
-
var proxyChain = {
|
|
2305
|
-
getPlugin: function () {
|
|
2306
|
-
return plugin;
|
|
2307
|
-
},
|
|
2308
|
-
getNext: function () {
|
|
2309
|
-
return nextProxy;
|
|
2310
|
-
},
|
|
2311
|
-
processTelemetry: _processTelemetry,
|
|
2312
|
-
unload: _unloadPlugin,
|
|
2313
|
-
update: _updatePlugin,
|
|
2314
|
-
_id: chainId,
|
|
2315
|
-
_setNext: function (nextPlugin) {
|
|
2316
|
-
nextProxy = nextPlugin;
|
|
2317
|
-
}
|
|
2318
|
-
};
|
|
2319
|
-
function _getTelCtx() {
|
|
2320
|
-
var itemCtx;
|
|
2321
|
-
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
2322
|
-
itemCtx = plugin[strGetTelCtx]();
|
|
2323
|
-
}
|
|
2324
|
-
if (!itemCtx) {
|
|
2325
|
-
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
2326
|
-
}
|
|
2327
|
-
return itemCtx;
|
|
2328
|
-
}
|
|
2329
|
-
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
2330
|
-
var hasRun = false;
|
|
2331
|
-
var identifier = plugin ? plugin[_DYN_IDENTIFIER ] : strTelemetryPluginChain;
|
|
2332
|
-
var hasRunContext = itemCtx[strHasRunFlags];
|
|
2333
|
-
if (!hasRunContext) {
|
|
2334
|
-
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
2335
|
-
}
|
|
2336
|
-
itemCtx.setNext(nextProxy);
|
|
2337
|
-
if (plugin) {
|
|
2338
|
-
doPerf(itemCtx[STR_CORE ](), function () { return identifier + ":" + name; }, function () {
|
|
2339
|
-
hasRunContext[chainId] = true;
|
|
2340
|
-
try {
|
|
2341
|
-
var nextId = nextProxy ? nextProxy._id : STR_EMPTY;
|
|
2342
|
-
if (nextId) {
|
|
2343
|
-
hasRunContext[nextId] = false;
|
|
2344
|
-
}
|
|
2345
|
-
hasRun = processPluginFn(itemCtx);
|
|
2346
|
-
}
|
|
2347
|
-
catch (error) {
|
|
2348
|
-
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
2349
|
-
if (hasNextRun) {
|
|
2350
|
-
hasRun = true;
|
|
2351
|
-
}
|
|
2352
|
-
if (!nextProxy || !hasNextRun) {
|
|
2353
|
-
_throwInternal(itemCtx[_DYN_DIAG_LOG$1 ](), 1 , 73 , "Plugin [" + identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
2354
|
-
}
|
|
2355
|
-
}
|
|
2356
|
-
}, details, isAsync);
|
|
2357
|
-
}
|
|
2358
|
-
return hasRun;
|
|
2359
|
-
}
|
|
2360
|
-
function _processTelemetry(env, itemCtx) {
|
|
2361
|
-
itemCtx = itemCtx || _getTelCtx();
|
|
2362
|
-
function _callProcessTelemetry(itemCtx) {
|
|
2363
|
-
if (!plugin || !hasProcessTelemetry) {
|
|
2364
|
-
return false;
|
|
2365
|
-
}
|
|
2366
|
-
var pluginState = _getPluginState(plugin);
|
|
2367
|
-
if (pluginState[_DYN_TEARDOWN ] || pluginState[STR_DISABLED]) {
|
|
2368
|
-
return false;
|
|
2369
|
-
}
|
|
2370
|
-
if (hasSetNext) {
|
|
2371
|
-
plugin[_DYN_SET_NEXT_PLUGIN ](nextProxy);
|
|
2372
|
-
}
|
|
2373
|
-
plugin[STR_PROCESS_TELEMETRY ](env, itemCtx);
|
|
2374
|
-
return true;
|
|
2375
|
-
}
|
|
2376
|
-
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
2377
|
-
itemCtx[_DYN_PROCESS_NEXT ](env);
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
function _unloadPlugin(unloadCtx, unloadState) {
|
|
2381
|
-
function _callTeardown() {
|
|
2382
|
-
var hasRun = false;
|
|
2383
|
-
if (plugin) {
|
|
2384
|
-
var pluginState = _getPluginState(plugin);
|
|
2385
|
-
var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
|
|
2386
|
-
if (plugin && (!pluginCore || pluginCore === unloadCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
|
|
2387
|
-
pluginState[STR_CORE ] = null;
|
|
2388
|
-
pluginState[_DYN_TEARDOWN ] = true;
|
|
2389
|
-
pluginState[_DYN_IS_INITIALIZED ] = false;
|
|
2390
|
-
if (plugin[_DYN_TEARDOWN ] && plugin[_DYN_TEARDOWN ](unloadCtx, unloadState) === true) {
|
|
2391
|
-
hasRun = true;
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2394
|
-
}
|
|
2395
|
-
return hasRun;
|
|
2396
|
-
}
|
|
2397
|
-
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState[_DYN_IS_ASYNC ])) {
|
|
2398
|
-
unloadCtx[_DYN_PROCESS_NEXT ](unloadState);
|
|
2399
|
-
}
|
|
2400
|
-
}
|
|
2401
|
-
function _updatePlugin(updateCtx, updateState) {
|
|
2402
|
-
function _callUpdate() {
|
|
2403
|
-
var hasRun = false;
|
|
2404
|
-
if (plugin) {
|
|
2405
|
-
var pluginState = _getPluginState(plugin);
|
|
2406
|
-
var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
|
|
2407
|
-
if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
|
|
2408
|
-
if (plugin[_DYN_UPDATE ] && plugin[_DYN_UPDATE ](updateCtx, updateState) === true) {
|
|
2409
|
-
hasRun = true;
|
|
2410
|
-
}
|
|
2411
|
-
}
|
|
2412
|
-
}
|
|
2413
|
-
return hasRun;
|
|
2414
|
-
}
|
|
2415
|
-
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
2416
|
-
updateCtx[_DYN_PROCESS_NEXT ](updateState);
|
|
2417
|
-
}
|
|
2418
|
-
}
|
|
2419
|
-
return objFreeze(proxyChain);
|
|
2420
|
-
}
|
|
2421
|
-
|
|
2422
|
-
var _a$2, _b;
|
|
2423
|
-
var strToGMTString = "toGMTString";
|
|
2424
|
-
var strToUTCString = "toUTCString";
|
|
2425
|
-
var strCookie = "cookie";
|
|
2426
|
-
var strExpires = "expires";
|
|
2427
|
-
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
2428
|
-
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
2429
|
-
var strConfigCookieMgr = "_ckMgr";
|
|
2430
|
-
var _supportsCookies = null;
|
|
2431
|
-
var _allowUaSameSite = null;
|
|
2432
|
-
var _parsedCookieValue = null;
|
|
2433
|
-
var _doc = getDocument();
|
|
2434
|
-
var _cookieCache = {};
|
|
2435
|
-
var _globalCookieConfig = {};
|
|
2436
|
-
var defaultConfig = objDeepFreeze((_a$2 = {},
|
|
2437
|
-
_a$2[STR_DOMAIN] = { fb: "cookieDomain", dfVal: isNotNullOrUndefined },
|
|
2438
|
-
_a$2.path = { fb: "cookiePath", dfVal: isNotNullOrUndefined },
|
|
2439
|
-
_a$2.enabled = UNDEFINED_VALUE,
|
|
2440
|
-
_a$2));
|
|
2441
|
-
var rootDefaultConfig = (_b = {
|
|
2442
|
-
cookieCfg: {},
|
|
2443
|
-
cookieDomain: UNDEFINED_VALUE,
|
|
2444
|
-
cookiePath: UNDEFINED_VALUE
|
|
2445
|
-
},
|
|
2446
|
-
_b[strDisableCookiesUsage] = UNDEFINED_VALUE,
|
|
2447
|
-
_b);
|
|
2448
|
-
function _gblCookieMgr(config, logger) {
|
|
2449
|
-
var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
|
|
2450
|
-
if (!inst) {
|
|
2451
|
-
inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
|
|
2452
|
-
_globalCookieConfig[strConfigCookieMgr] = inst;
|
|
2453
|
-
}
|
|
2454
|
-
return inst;
|
|
2455
|
-
}
|
|
2456
|
-
function _isMgrEnabled(cookieMgr) {
|
|
2457
|
-
if (cookieMgr) {
|
|
2458
|
-
return cookieMgr.isEnabled();
|
|
2459
|
-
}
|
|
2460
|
-
return true;
|
|
2461
|
-
}
|
|
2462
|
-
function _isIgnoredCookie(cookieMgrCfg, name) {
|
|
2463
|
-
if (name && cookieMgrCfg && isArray(cookieMgrCfg.ignoreCookies)) {
|
|
2464
|
-
return arrIndexOf(cookieMgrCfg.ignoreCookies, name) !== -1;
|
|
2465
|
-
}
|
|
2466
|
-
return false;
|
|
2467
|
-
}
|
|
2468
|
-
function _isBlockedCookie(cookieMgrCfg, name) {
|
|
2469
|
-
if (name && cookieMgrCfg && isArray(cookieMgrCfg.blockedCookies)) {
|
|
2470
|
-
if (arrIndexOf(cookieMgrCfg.blockedCookies, name) !== -1) {
|
|
2471
|
-
return true;
|
|
2472
|
-
}
|
|
2473
|
-
}
|
|
2474
|
-
return _isIgnoredCookie(cookieMgrCfg, name);
|
|
2475
|
-
}
|
|
2476
|
-
function safeGetCookieMgr(core, config) {
|
|
2477
|
-
var cookieMgr;
|
|
2478
|
-
if (core) {
|
|
2479
|
-
cookieMgr = core.getCookieMgr();
|
|
2480
|
-
}
|
|
2481
|
-
else if (config) {
|
|
2482
|
-
var cookieCfg = config.cookieCfg;
|
|
2483
|
-
if (cookieCfg && cookieCfg[strConfigCookieMgr]) {
|
|
2484
|
-
cookieMgr = cookieCfg[strConfigCookieMgr];
|
|
2485
|
-
}
|
|
2486
|
-
else {
|
|
2487
|
-
cookieMgr = createCookieMgr(config);
|
|
2488
|
-
}
|
|
2489
|
-
}
|
|
2490
|
-
if (!cookieMgr) {
|
|
2491
|
-
cookieMgr = _gblCookieMgr(config, (core || {})[_DYN_LOGGER ]);
|
|
2492
|
-
}
|
|
2493
|
-
return cookieMgr;
|
|
2494
|
-
}
|
|
2495
|
-
function createCookieMgr(rootConfig, logger) {
|
|
2496
|
-
var cookieMgrConfig;
|
|
2497
|
-
var _path;
|
|
2498
|
-
var _domain;
|
|
2499
|
-
var _enabled;
|
|
2500
|
-
var _getCookieFn;
|
|
2501
|
-
var _setCookieFn;
|
|
2502
|
-
var _delCookieFn;
|
|
2503
|
-
rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;
|
|
2504
|
-
onConfigChange(rootConfig, function (details) {
|
|
2505
|
-
details[_DYN_SET_DF ](details.cfg, rootDefaultConfig);
|
|
2506
|
-
cookieMgrConfig = details[_DYN_SET_DF ](details.cfg.cookieCfg, defaultConfig);
|
|
2507
|
-
var isEnabled = cookieMgrConfig.enabled;
|
|
2508
|
-
if (isNullOrUndefined(isEnabled)) {
|
|
2509
|
-
var cookieEnabled = void 0;
|
|
2510
|
-
if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
|
|
2511
|
-
cookieEnabled = !rootConfig[strIsCookieUseDisabled];
|
|
2512
|
-
}
|
|
2513
|
-
if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
|
|
2514
|
-
cookieEnabled = !rootConfig[strDisableCookiesUsage];
|
|
2515
|
-
}
|
|
2516
|
-
isEnabled = cookieEnabled;
|
|
2517
|
-
}
|
|
2518
|
-
_path = cookieMgrConfig[STR_PATH ] || "/";
|
|
2519
|
-
_domain = cookieMgrConfig[STR_DOMAIN ];
|
|
2520
|
-
_enabled = isEnabled !== false;
|
|
2521
|
-
_getCookieFn = cookieMgrConfig.getCookie || _getCookieValue;
|
|
2522
|
-
_setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
|
|
2523
|
-
_delCookieFn = cookieMgrConfig.delCookie || _setCookieValue;
|
|
2524
|
-
}, logger);
|
|
2525
|
-
var cookieMgr = {
|
|
2526
|
-
isEnabled: function () {
|
|
2527
|
-
var enabled = _enabled && areCookiesSupported(logger);
|
|
2528
|
-
var gblManager = _globalCookieConfig[strConfigCookieMgr];
|
|
2529
|
-
if (enabled && gblManager && cookieMgr !== gblManager) {
|
|
2530
|
-
enabled = _isMgrEnabled(gblManager);
|
|
2531
|
-
}
|
|
2532
|
-
return enabled;
|
|
2533
|
-
},
|
|
2534
|
-
setEnabled: function (value) {
|
|
2535
|
-
_enabled = value !== false;
|
|
2536
|
-
},
|
|
2537
|
-
set: function (name, value, maxAgeSec, domain, path) {
|
|
2538
|
-
var result = false;
|
|
2539
|
-
if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
|
|
2540
|
-
var values = {};
|
|
2541
|
-
var theValue = strTrim(value || STR_EMPTY);
|
|
2542
|
-
var idx = strIndexOf(theValue, ";");
|
|
2543
|
-
if (idx !== -1) {
|
|
2544
|
-
theValue = strTrim(strLeft(value, idx));
|
|
2545
|
-
values = _extractParts(strSubstring(value, idx + 1));
|
|
2546
|
-
}
|
|
2547
|
-
setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
|
|
2548
|
-
if (!isNullOrUndefined(maxAgeSec)) {
|
|
2549
|
-
var _isIE = isIE();
|
|
2550
|
-
if (isUndefined(values[strExpires])) {
|
|
2551
|
-
var nowMs = utcNow();
|
|
2552
|
-
var expireMs = nowMs + (maxAgeSec * 1000);
|
|
2553
|
-
if (expireMs > 0) {
|
|
2554
|
-
var expiry = new Date();
|
|
2555
|
-
expiry.setTime(expireMs);
|
|
2556
|
-
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
2559
|
-
if (!_isIE) {
|
|
2560
|
-
setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
|
|
2561
|
-
}
|
|
2562
|
-
}
|
|
2563
|
-
var location_1 = getLocation();
|
|
2564
|
-
if (location_1 && location_1.protocol === "https:") {
|
|
2565
|
-
setValue(values, "secure", null, null, isUndefined);
|
|
2566
|
-
if (_allowUaSameSite === null) {
|
|
2567
|
-
_allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
|
|
2568
|
-
}
|
|
2569
|
-
if (_allowUaSameSite) {
|
|
2570
|
-
setValue(values, "SameSite", "None", null, isUndefined);
|
|
2571
|
-
}
|
|
2572
|
-
}
|
|
2573
|
-
setValue(values, STR_PATH, path || _path, null, isUndefined);
|
|
2574
|
-
_setCookieFn(name, _formatCookieValue(theValue, values));
|
|
2575
|
-
result = true;
|
|
2576
|
-
}
|
|
2577
|
-
return result;
|
|
2578
|
-
},
|
|
2579
|
-
get: function (name) {
|
|
2580
|
-
var value = STR_EMPTY;
|
|
2581
|
-
if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {
|
|
2582
|
-
value = _getCookieFn(name);
|
|
2583
|
-
}
|
|
2584
|
-
return value;
|
|
2585
|
-
},
|
|
2586
|
-
del: function (name, path) {
|
|
2587
|
-
var result = false;
|
|
2588
|
-
if (_isMgrEnabled(cookieMgr)) {
|
|
2589
|
-
result = cookieMgr.purge(name, path);
|
|
2590
|
-
}
|
|
2591
|
-
return result;
|
|
2592
|
-
},
|
|
2593
|
-
purge: function (name, path) {
|
|
2594
|
-
var _a;
|
|
2595
|
-
var result = false;
|
|
2596
|
-
if (areCookiesSupported(logger)) {
|
|
2597
|
-
var values = (_a = {},
|
|
2598
|
-
_a[STR_PATH] = path ? path : "/",
|
|
2599
|
-
_a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
|
|
2600
|
-
_a);
|
|
2601
|
-
if (!isIE()) {
|
|
2602
|
-
values["max-age"] = "0";
|
|
2603
|
-
}
|
|
2604
|
-
_delCookieFn(name, _formatCookieValue(STR_EMPTY, values));
|
|
2605
|
-
result = true;
|
|
2606
|
-
}
|
|
2607
|
-
return result;
|
|
2472
|
+
return !nextPlugin;
|
|
2473
|
+
}
|
|
2474
|
+
function _createNew(plugins, startAt) {
|
|
2475
|
+
if (plugins === void 0) { plugins = null; }
|
|
2476
|
+
if (isArray(plugins)) {
|
|
2477
|
+
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2608
2478
|
}
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2479
|
+
return createProcessTelemetryContext(plugins || context[_DYN_GET_NEXT ](), config.cfg, core, startAt);
|
|
2480
|
+
}
|
|
2481
|
+
context[_DYN_PROCESS_NEXT ] = _processNext;
|
|
2482
|
+
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2483
|
+
return context;
|
|
2612
2484
|
}
|
|
2613
|
-
function
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2485
|
+
function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {
|
|
2486
|
+
var config = createDynamicConfig(core.config);
|
|
2487
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
2488
|
+
var context = internalContext.ctx;
|
|
2489
|
+
function _processNext(unloadState) {
|
|
2490
|
+
var nextPlugin = internalContext._next();
|
|
2491
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
2492
|
+
return !nextPlugin;
|
|
2493
|
+
}
|
|
2494
|
+
function _createNew(plugins, startAt) {
|
|
2495
|
+
if (plugins === void 0) { plugins = null; }
|
|
2496
|
+
if (isArray(plugins)) {
|
|
2497
|
+
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2622
2498
|
}
|
|
2499
|
+
return createProcessTelemetryUnloadContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
|
|
2623
2500
|
}
|
|
2624
|
-
|
|
2501
|
+
context[_DYN_PROCESS_NEXT ] = _processNext;
|
|
2502
|
+
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2503
|
+
return context;
|
|
2625
2504
|
}
|
|
2626
|
-
function
|
|
2627
|
-
var
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
if (
|
|
2633
|
-
|
|
2634
|
-
if (idx === -1) {
|
|
2635
|
-
values[thePart] = null;
|
|
2636
|
-
}
|
|
2637
|
-
else {
|
|
2638
|
-
values[strTrim(strLeft(thePart, idx))] = strTrim(strSubstring(thePart, idx + 1));
|
|
2639
|
-
}
|
|
2505
|
+
function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {
|
|
2506
|
+
var config = createDynamicConfig(core.config);
|
|
2507
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
2508
|
+
var context = internalContext.ctx;
|
|
2509
|
+
function _processNext(updateState) {
|
|
2510
|
+
return context.iterate(function (plugin) {
|
|
2511
|
+
if (isFunction(plugin[_DYN_UPDATE ])) {
|
|
2512
|
+
plugin[_DYN_UPDATE ](context, updateState);
|
|
2640
2513
|
}
|
|
2641
2514
|
});
|
|
2642
2515
|
}
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
return theDate[func]();
|
|
2648
|
-
}
|
|
2649
|
-
return null;
|
|
2650
|
-
}
|
|
2651
|
-
function _formatCookieValue(value, values) {
|
|
2652
|
-
var cookieValue = value || STR_EMPTY;
|
|
2653
|
-
objForEachKey(values, function (name, theValue) {
|
|
2654
|
-
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : STR_EMPTY);
|
|
2655
|
-
});
|
|
2656
|
-
return cookieValue;
|
|
2657
|
-
}
|
|
2658
|
-
function _getCookieValue(name) {
|
|
2659
|
-
var cookieValue = STR_EMPTY;
|
|
2660
|
-
if (_doc) {
|
|
2661
|
-
var theCookie = _doc[strCookie] || STR_EMPTY;
|
|
2662
|
-
if (_parsedCookieValue !== theCookie) {
|
|
2663
|
-
_cookieCache = _extractParts(theCookie);
|
|
2664
|
-
_parsedCookieValue = theCookie;
|
|
2516
|
+
function _createNew(plugins, startAt) {
|
|
2517
|
+
if (plugins === void 0) { plugins = null; }
|
|
2518
|
+
if (isArray(plugins)) {
|
|
2519
|
+
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2665
2520
|
}
|
|
2666
|
-
|
|
2521
|
+
return createProcessTelemetryUpdateContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
|
|
2667
2522
|
}
|
|
2668
|
-
|
|
2523
|
+
context[_DYN_PROCESS_NEXT ] = _processNext;
|
|
2524
|
+
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2525
|
+
return context;
|
|
2669
2526
|
}
|
|
2670
|
-
function
|
|
2671
|
-
|
|
2672
|
-
|
|
2527
|
+
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
2528
|
+
var firstProxy = null;
|
|
2529
|
+
var add = startAt ? false : true;
|
|
2530
|
+
if (isArray(plugins) && plugins[_DYN_LENGTH$2 ] > 0) {
|
|
2531
|
+
var lastProxy_1 = null;
|
|
2532
|
+
arrForEach(plugins, function (thePlugin) {
|
|
2533
|
+
if (!add && startAt === thePlugin) {
|
|
2534
|
+
add = true;
|
|
2535
|
+
}
|
|
2536
|
+
if (add && thePlugin && isFunction(thePlugin[STR_PROCESS_TELEMETRY ])) {
|
|
2537
|
+
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
2538
|
+
if (!firstProxy) {
|
|
2539
|
+
firstProxy = newProxy;
|
|
2540
|
+
}
|
|
2541
|
+
if (lastProxy_1) {
|
|
2542
|
+
lastProxy_1._setNext(newProxy);
|
|
2543
|
+
}
|
|
2544
|
+
lastProxy_1 = newProxy;
|
|
2545
|
+
}
|
|
2546
|
+
});
|
|
2673
2547
|
}
|
|
2548
|
+
if (startAt && !firstProxy) {
|
|
2549
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
2550
|
+
}
|
|
2551
|
+
return firstProxy;
|
|
2674
2552
|
}
|
|
2675
|
-
function
|
|
2676
|
-
|
|
2677
|
-
|
|
2553
|
+
function createTelemetryPluginProxy(plugin, config, core) {
|
|
2554
|
+
var nextProxy = null;
|
|
2555
|
+
var hasProcessTelemetry = isFunction(plugin[STR_PROCESS_TELEMETRY ]);
|
|
2556
|
+
var hasSetNext = isFunction(plugin[_DYN_SET_NEXT_PLUGIN ]);
|
|
2557
|
+
var chainId;
|
|
2558
|
+
if (plugin) {
|
|
2559
|
+
chainId = plugin[_DYN_IDENTIFIER ] + "-" + plugin[STR_PRIORITY ] + "-" + _chainId++;
|
|
2678
2560
|
}
|
|
2679
|
-
|
|
2680
|
-
|
|
2561
|
+
else {
|
|
2562
|
+
chainId = "Unknown-0-" + _chainId++;
|
|
2681
2563
|
}
|
|
2682
|
-
|
|
2683
|
-
|
|
2564
|
+
var proxyChain = {
|
|
2565
|
+
getPlugin: function () {
|
|
2566
|
+
return plugin;
|
|
2567
|
+
},
|
|
2568
|
+
getNext: function () {
|
|
2569
|
+
return nextProxy;
|
|
2570
|
+
},
|
|
2571
|
+
processTelemetry: _processTelemetry,
|
|
2572
|
+
unload: _unloadPlugin,
|
|
2573
|
+
update: _updatePlugin,
|
|
2574
|
+
_id: chainId,
|
|
2575
|
+
_setNext: function (nextPlugin) {
|
|
2576
|
+
nextProxy = nextPlugin;
|
|
2577
|
+
}
|
|
2578
|
+
};
|
|
2579
|
+
function _getTelCtx() {
|
|
2580
|
+
var itemCtx;
|
|
2581
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
2582
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
2583
|
+
}
|
|
2584
|
+
if (!itemCtx) {
|
|
2585
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
2586
|
+
}
|
|
2587
|
+
return itemCtx;
|
|
2684
2588
|
}
|
|
2685
|
-
|
|
2686
|
-
|
|
2589
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
2590
|
+
var hasRun = false;
|
|
2591
|
+
var identifier = plugin ? plugin[_DYN_IDENTIFIER ] : strTelemetryPluginChain;
|
|
2592
|
+
var hasRunContext = itemCtx[strHasRunFlags];
|
|
2593
|
+
if (!hasRunContext) {
|
|
2594
|
+
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
2595
|
+
}
|
|
2596
|
+
itemCtx.setNext(nextProxy);
|
|
2597
|
+
if (plugin) {
|
|
2598
|
+
doPerf(itemCtx[STR_CORE ](), function () { return identifier + ":" + name; }, function () {
|
|
2599
|
+
hasRunContext[chainId] = true;
|
|
2600
|
+
try {
|
|
2601
|
+
var nextId = nextProxy ? nextProxy._id : STR_EMPTY;
|
|
2602
|
+
if (nextId) {
|
|
2603
|
+
hasRunContext[nextId] = false;
|
|
2604
|
+
}
|
|
2605
|
+
hasRun = processPluginFn(itemCtx);
|
|
2606
|
+
}
|
|
2607
|
+
catch (error) {
|
|
2608
|
+
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
2609
|
+
if (hasNextRun) {
|
|
2610
|
+
hasRun = true;
|
|
2611
|
+
}
|
|
2612
|
+
if (!nextProxy || !hasNextRun) {
|
|
2613
|
+
_throwInternal(itemCtx[_DYN_DIAG_LOG$1 ](), 1 , 73 , "Plugin [" + identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
}, details, isAsync);
|
|
2617
|
+
}
|
|
2618
|
+
return hasRun;
|
|
2687
2619
|
}
|
|
2688
|
-
|
|
2689
|
-
|
|
2620
|
+
function _processTelemetry(env, itemCtx) {
|
|
2621
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
2622
|
+
function _callProcessTelemetry(itemCtx) {
|
|
2623
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
2624
|
+
return false;
|
|
2625
|
+
}
|
|
2626
|
+
var pluginState = _getPluginState(plugin);
|
|
2627
|
+
if (pluginState[_DYN_TEARDOWN ] || pluginState[STR_DISABLED]) {
|
|
2628
|
+
return false;
|
|
2629
|
+
}
|
|
2630
|
+
if (hasSetNext) {
|
|
2631
|
+
plugin[_DYN_SET_NEXT_PLUGIN ](nextProxy);
|
|
2632
|
+
}
|
|
2633
|
+
plugin[STR_PROCESS_TELEMETRY ](env, itemCtx);
|
|
2634
|
+
return true;
|
|
2635
|
+
}
|
|
2636
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
2637
|
+
itemCtx[_DYN_PROCESS_NEXT ](env);
|
|
2638
|
+
}
|
|
2690
2639
|
}
|
|
2691
|
-
|
|
2692
|
-
|
|
2640
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
2641
|
+
function _callTeardown() {
|
|
2642
|
+
var hasRun = false;
|
|
2643
|
+
if (plugin) {
|
|
2644
|
+
var pluginState = _getPluginState(plugin);
|
|
2645
|
+
var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
|
|
2646
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
|
|
2647
|
+
pluginState[STR_CORE ] = null;
|
|
2648
|
+
pluginState[_DYN_TEARDOWN ] = true;
|
|
2649
|
+
pluginState[_DYN_IS_INITIALIZED ] = false;
|
|
2650
|
+
if (plugin[_DYN_TEARDOWN ] && plugin[_DYN_TEARDOWN ](unloadCtx, unloadState) === true) {
|
|
2651
|
+
hasRun = true;
|
|
2652
|
+
}
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
return hasRun;
|
|
2656
|
+
}
|
|
2657
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState[_DYN_IS_ASYNC ])) {
|
|
2658
|
+
unloadCtx[_DYN_PROCESS_NEXT ](unloadState);
|
|
2659
|
+
}
|
|
2693
2660
|
}
|
|
2694
|
-
|
|
2695
|
-
|
|
2661
|
+
function _updatePlugin(updateCtx, updateState) {
|
|
2662
|
+
function _callUpdate() {
|
|
2663
|
+
var hasRun = false;
|
|
2664
|
+
if (plugin) {
|
|
2665
|
+
var pluginState = _getPluginState(plugin);
|
|
2666
|
+
var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
|
|
2667
|
+
if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
|
|
2668
|
+
if (plugin[_DYN_UPDATE ] && plugin[_DYN_UPDATE ](updateCtx, updateState) === true) {
|
|
2669
|
+
hasRun = true;
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
return hasRun;
|
|
2674
|
+
}
|
|
2675
|
+
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
2676
|
+
updateCtx[_DYN_PROCESS_NEXT ](updateState);
|
|
2677
|
+
}
|
|
2696
2678
|
}
|
|
2697
|
-
return
|
|
2679
|
+
return objFreeze(proxyChain);
|
|
2698
2680
|
}
|
|
2699
2681
|
|
|
2700
2682
|
function createUnloadHandlerContainer() {
|
|
@@ -5221,7 +5203,7 @@
|
|
|
5221
5203
|
});
|
|
5222
5204
|
return _this;
|
|
5223
5205
|
}
|
|
5224
|
-
AnalyticsPlugin.Version = "3.0.0-beta.
|
|
5206
|
+
AnalyticsPlugin.Version = "3.0.0-beta.2212-03";
|
|
5225
5207
|
return AnalyticsPlugin;
|
|
5226
5208
|
}(BaseTelemetryPlugin));
|
|
5227
5209
|
|