@microsoft/applicationinsights-properties-js 3.0.0-beta.2211-01 → 3.0.0-beta.2211-04
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-properties-js.integrity.json +9 -9
- package/browser/applicationinsights-properties-js.js +698 -698
- package/browser/applicationinsights-properties-js.js.map +1 -1
- package/browser/applicationinsights-properties-js.min.js +2 -2
- package/browser/applicationinsights-properties-js.min.js.map +1 -1
- package/dist/applicationinsights-properties-js.d.ts +1 -1
- package/dist/applicationinsights-properties-js.js +698 -698
- package/dist/applicationinsights-properties-js.js.map +1 -1
- package/dist/applicationinsights-properties-js.min.js +2 -2
- package/dist/applicationinsights-properties-js.min.js.map +1 -1
- package/dist/applicationinsights-properties-js.rollup.d.ts +1 -1
- package/dist-esm/Context/Application.js +1 -1
- package/dist-esm/Context/Device.js +1 -1
- package/dist-esm/Context/Internal.js +1 -1
- package/dist-esm/Context/Location.js +1 -1
- package/dist-esm/Context/Session.js +1 -1
- package/dist-esm/Context/TelemetryTrace.js +1 -1
- package/dist-esm/Context/User.js +1 -1
- package/dist-esm/Interfaces/IPropTelemetryContext.js +1 -1
- package/dist-esm/Interfaces/IPropertiesConfig.js +1 -1
- package/dist-esm/PropertiesPlugin.js +1 -1
- package/dist-esm/TelemetryContext.js +1 -1
- package/dist-esm/__DynamicConstants.js +1 -1
- package/dist-esm/applicationinsights-properties-js.js +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Properties Plugin, 3.0.0-beta.2211-
|
|
2
|
+
* Application Insights JavaScript SDK - Properties Plugin, 3.0.0-beta.2211-04
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -927,16 +927,18 @@
|
|
|
927
927
|
var _DYN_APPLY = "apply";
|
|
928
928
|
var _DYN_PUSH = "push";
|
|
929
929
|
var _DYN_SPLICE = "splice";
|
|
930
|
+
var _DYN_CANCEL = "cancel";
|
|
930
931
|
var _DYN_INITIALIZE = "initialize";
|
|
931
932
|
var _DYN_IDENTIFIER = "identifier";
|
|
932
933
|
var _DYN_IS_INITIALIZED = "isInitialized";
|
|
934
|
+
var _DYN_GET_PLUGIN = "getPlugin";
|
|
933
935
|
var _DYN_NAME$1 = "name";
|
|
934
936
|
var _DYN_TIME = "time";
|
|
935
937
|
var _DYN_PROCESS_NEXT = "processNext";
|
|
936
938
|
var _DYN_GET_PROCESS_TEL_CONT0 = "getProcessTelContext";
|
|
937
939
|
var _DYN_CALL = "call";
|
|
938
|
-
var _DYN_GET_PLUGIN = "getPlugin";
|
|
939
940
|
var _DYN_LOGGING_LEVEL_CONSOL4 = "loggingLevelConsole";
|
|
941
|
+
var _DYN_CREATE_NEW = "createNew";
|
|
940
942
|
var _DYN_TEARDOWN = "teardown";
|
|
941
943
|
var _DYN_MESSAGE_ID = "messageId";
|
|
942
944
|
var _DYN_MESSAGE = "message";
|
|
@@ -946,8 +948,6 @@
|
|
|
946
948
|
var _DYN_UPDATE$1 = "update";
|
|
947
949
|
var _DYN_GET_NEXT = "getNext";
|
|
948
950
|
var _DYN_SET_NEXT_PLUGIN = "setNextPlugin";
|
|
949
|
-
var _DYN_CREATE_NEW = "createNew";
|
|
950
|
-
var _DYN_CONFIG = "config";
|
|
951
951
|
var _DYN_USER_AGENT = "userAgent";
|
|
952
952
|
var _DYN_SPLIT = "split";
|
|
953
953
|
var _DYN_NODE_TYPE = "nodeType";
|
|
@@ -1214,7 +1214,7 @@
|
|
|
1214
1214
|
}
|
|
1215
1215
|
|
|
1216
1216
|
var _objDefineProperty = ObjDefineProperty;
|
|
1217
|
-
var version = "3.0.0-beta.2211-
|
|
1217
|
+
var version = "3.0.0-beta.2211-04";
|
|
1218
1218
|
var instanceName = "." + newId(6);
|
|
1219
1219
|
var _dataUid = 0;
|
|
1220
1220
|
function _createAccessor(target, prop, value) {
|
|
@@ -1548,7 +1548,7 @@
|
|
|
1548
1548
|
if (_waitingHandlers) {
|
|
1549
1549
|
var notifyHandlers = _waitingHandlers;
|
|
1550
1550
|
_waitingHandlers = null;
|
|
1551
|
-
_watcherTimer && _watcherTimer
|
|
1551
|
+
_watcherTimer && _watcherTimer[_DYN_CANCEL ]();
|
|
1552
1552
|
_watcherTimer = null;
|
|
1553
1553
|
var watcherFailures_1 = [];
|
|
1554
1554
|
arrForEach(notifyHandlers, function (handler) {
|
|
@@ -1898,791 +1898,791 @@
|
|
|
1898
1898
|
_getLogger(logger)[_DYN_LOG_INTERNAL_MESSAGE ](severity, message);
|
|
1899
1899
|
}
|
|
1900
1900
|
|
|
1901
|
-
var
|
|
1902
|
-
var
|
|
1903
|
-
var
|
|
1904
|
-
var
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
if (key === PerfEvent[strParentContextKey]) {
|
|
1933
|
-
if (!_self[key]) {
|
|
1934
|
-
_self[_DYN_IS_CHILD_EVT ] = function () { return true; };
|
|
1935
|
-
}
|
|
1936
|
-
_self[key] = value;
|
|
1937
|
-
}
|
|
1938
|
-
else if (key === PerfEvent[strChildrenContextKey]) {
|
|
1939
|
-
_self[key] = value;
|
|
1940
|
-
}
|
|
1941
|
-
else {
|
|
1942
|
-
var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};
|
|
1943
|
-
ctx[key] = value;
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
};
|
|
1947
|
-
_self[_DYN_COMPLETE ] = function () {
|
|
1948
|
-
var childTime = 0;
|
|
1949
|
-
var childEvts = _self[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
|
|
1950
|
-
if (isArray(childEvts)) {
|
|
1951
|
-
for (var lp = 0; lp < childEvts[_DYN_LENGTH$2 ]; lp++) {
|
|
1952
|
-
var childEvt = childEvts[lp];
|
|
1953
|
-
if (childEvt) {
|
|
1954
|
-
childTime += childEvt[_DYN_TIME ];
|
|
1955
|
-
}
|
|
1956
|
-
}
|
|
1957
|
-
}
|
|
1958
|
-
_self[_DYN_TIME ] = utcNow() - _self.start;
|
|
1959
|
-
_self.exTime = _self[_DYN_TIME ] - childTime;
|
|
1960
|
-
_self[_DYN_COMPLETE ] = function () { };
|
|
1961
|
-
};
|
|
1962
|
-
}
|
|
1963
|
-
PerfEvent.ParentContextKey = "parent";
|
|
1964
|
-
PerfEvent.ChildrenContextKey = "childEvts";
|
|
1965
|
-
return PerfEvent;
|
|
1966
|
-
}());
|
|
1967
|
-
var doPerfActiveKey = "CoreUtils.doPerf";
|
|
1968
|
-
function doPerf(mgrSource, getSource, func, details, isAsync) {
|
|
1969
|
-
if (mgrSource) {
|
|
1970
|
-
var perfMgr = mgrSource;
|
|
1971
|
-
if (perfMgr[STR_GET_PERF_MGR]) {
|
|
1972
|
-
perfMgr = perfMgr[STR_GET_PERF_MGR]();
|
|
1973
|
-
}
|
|
1974
|
-
if (perfMgr) {
|
|
1975
|
-
var perfEvt = void 0;
|
|
1976
|
-
var currentActive = perfMgr[_DYN_GET_CTX ](doPerfActiveKey);
|
|
1977
|
-
try {
|
|
1978
|
-
perfEvt = perfMgr.create(getSource(), details, isAsync);
|
|
1979
|
-
if (perfEvt) {
|
|
1980
|
-
if (currentActive && perfEvt[_DYN_SET_CTX ]) {
|
|
1981
|
-
perfEvt[_DYN_SET_CTX ](PerfEvent[strParentContextKey], currentActive);
|
|
1982
|
-
if (currentActive[_DYN_GET_CTX ] && currentActive[_DYN_SET_CTX ]) {
|
|
1983
|
-
var children = currentActive[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
|
|
1984
|
-
if (!children) {
|
|
1985
|
-
children = [];
|
|
1986
|
-
currentActive[_DYN_SET_CTX ](PerfEvent[strChildrenContextKey], children);
|
|
1987
|
-
}
|
|
1988
|
-
children[_DYN_PUSH ](perfEvt);
|
|
1989
|
-
}
|
|
1990
|
-
}
|
|
1991
|
-
perfMgr[_DYN_SET_CTX ](doPerfActiveKey, perfEvt);
|
|
1992
|
-
return func(perfEvt);
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
catch (ex) {
|
|
1996
|
-
if (perfEvt && perfEvt[_DYN_SET_CTX ]) {
|
|
1997
|
-
perfEvt[_DYN_SET_CTX ]("exception", ex);
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
finally {
|
|
2001
|
-
if (perfEvt) {
|
|
2002
|
-
perfMgr.fire(perfEvt);
|
|
2003
|
-
}
|
|
2004
|
-
perfMgr[_DYN_SET_CTX ](doPerfActiveKey, currentActive);
|
|
2005
|
-
}
|
|
2006
|
-
}
|
|
1901
|
+
var _a$2, _b;
|
|
1902
|
+
var strToGMTString = "toGMTString";
|
|
1903
|
+
var strToUTCString = "toUTCString";
|
|
1904
|
+
var strCookie = "cookie";
|
|
1905
|
+
var strExpires = "expires";
|
|
1906
|
+
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
1907
|
+
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
1908
|
+
var strConfigCookieMgr = "_ckMgr";
|
|
1909
|
+
var _supportsCookies = null;
|
|
1910
|
+
var _allowUaSameSite = null;
|
|
1911
|
+
var _parsedCookieValue = null;
|
|
1912
|
+
var _doc = getDocument();
|
|
1913
|
+
var _cookieCache = {};
|
|
1914
|
+
var _globalCookieConfig = {};
|
|
1915
|
+
var defaultConfig = objDeepFreeze((_a$2 = {},
|
|
1916
|
+
_a$2[STR_DOMAIN] = { fb: "cookieDomain", dfVal: isNotNullOrUndefined },
|
|
1917
|
+
_a$2.path = { fb: "cookiePath", dfVal: isNotNullOrUndefined },
|
|
1918
|
+
_a$2.enabled = UNDEFINED_VALUE,
|
|
1919
|
+
_a$2));
|
|
1920
|
+
var rootDefaultConfig = (_b = {
|
|
1921
|
+
cookieCfg: {},
|
|
1922
|
+
cookieDomain: UNDEFINED_VALUE,
|
|
1923
|
+
cookiePath: UNDEFINED_VALUE
|
|
1924
|
+
},
|
|
1925
|
+
_b[strDisableCookiesUsage] = UNDEFINED_VALUE,
|
|
1926
|
+
_b);
|
|
1927
|
+
function _gblCookieMgr(config, logger) {
|
|
1928
|
+
var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
|
|
1929
|
+
if (!inst) {
|
|
1930
|
+
inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
|
|
1931
|
+
_globalCookieConfig[strConfigCookieMgr] = inst;
|
|
2007
1932
|
}
|
|
2008
|
-
return
|
|
1933
|
+
return inst;
|
|
2009
1934
|
}
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
var oct = STR_EMPTY, tmp;
|
|
2014
|
-
for (var a = 0; a < 4; a++) {
|
|
2015
|
-
tmp = random32();
|
|
2016
|
-
oct +=
|
|
2017
|
-
hexValues[tmp & 0xF] +
|
|
2018
|
-
hexValues[tmp >> 4 & 0xF] +
|
|
2019
|
-
hexValues[tmp >> 8 & 0xF] +
|
|
2020
|
-
hexValues[tmp >> 12 & 0xF] +
|
|
2021
|
-
hexValues[tmp >> 16 & 0xF] +
|
|
2022
|
-
hexValues[tmp >> 20 & 0xF] +
|
|
2023
|
-
hexValues[tmp >> 24 & 0xF] +
|
|
2024
|
-
hexValues[tmp >> 28 & 0xF];
|
|
1935
|
+
function _isMgrEnabled(cookieMgr) {
|
|
1936
|
+
if (cookieMgr) {
|
|
1937
|
+
return cookieMgr.isEnabled();
|
|
2025
1938
|
}
|
|
2026
|
-
|
|
2027
|
-
return strSubstr(oct, 0, 8) + strSubstr(oct, 9, 4) + "4" + strSubstr(oct, 13, 3) + clockSequenceHi + strSubstr(oct, 16, 3) + strSubstr(oct, 19, 12);
|
|
1939
|
+
return true;
|
|
2028
1940
|
}
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
function _isValid(value, len, invalidValue) {
|
|
2033
|
-
if (value && value[_DYN_LENGTH$2 ] === len && value !== invalidValue) {
|
|
2034
|
-
return !!value.match(/^[\da-f]*$/i);
|
|
1941
|
+
function _isIgnoredCookie(cookieMgrCfg, name) {
|
|
1942
|
+
if (name && cookieMgrCfg && isArray(cookieMgrCfg.ignoreCookies)) {
|
|
1943
|
+
return arrIndexOf(cookieMgrCfg.ignoreCookies, name) !== -1;
|
|
2035
1944
|
}
|
|
2036
1945
|
return false;
|
|
2037
1946
|
}
|
|
2038
|
-
function
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
return _isValid(value, 16, INVALID_SPAN_ID);
|
|
2043
|
-
}
|
|
2044
|
-
|
|
2045
|
-
var pluginStateData = createElmNodeData("plugin");
|
|
2046
|
-
function _getPluginState(plugin) {
|
|
2047
|
-
return pluginStateData.get(plugin, "state", {}, true);
|
|
2048
|
-
}
|
|
2049
|
-
|
|
2050
|
-
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
2051
|
-
var strHasRunFlags = "_hasRun";
|
|
2052
|
-
var strGetTelCtx = "_getTelCtx";
|
|
2053
|
-
var _chainId = 0;
|
|
2054
|
-
function _getNextProxyStart(proxy, core, startAt) {
|
|
2055
|
-
while (proxy) {
|
|
2056
|
-
if (proxy[_DYN_GET_PLUGIN ]() === startAt) {
|
|
2057
|
-
return proxy;
|
|
1947
|
+
function _isBlockedCookie(cookieMgrCfg, name) {
|
|
1948
|
+
if (name && cookieMgrCfg && isArray(cookieMgrCfg.blockedCookies)) {
|
|
1949
|
+
if (arrIndexOf(cookieMgrCfg.blockedCookies, name) !== -1) {
|
|
1950
|
+
return true;
|
|
2058
1951
|
}
|
|
2059
|
-
proxy = proxy[_DYN_GET_NEXT ]();
|
|
2060
1952
|
}
|
|
2061
|
-
return
|
|
1953
|
+
return _isIgnoredCookie(cookieMgrCfg, name);
|
|
2062
1954
|
}
|
|
2063
|
-
function
|
|
2064
|
-
var
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
dynamicHandler = createDynamicConfig({}, null, core[_DYN_LOGGER ]);
|
|
2068
|
-
}
|
|
2069
|
-
if (startAt !== null) {
|
|
2070
|
-
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;
|
|
1955
|
+
function safeGetCookieMgr(core, config) {
|
|
1956
|
+
var cookieMgr;
|
|
1957
|
+
if (core) {
|
|
1958
|
+
cookieMgr = core.getCookieMgr();
|
|
2071
1959
|
}
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
return core;
|
|
2077
|
-
},
|
|
2078
|
-
diagLog: function () {
|
|
2079
|
-
return safeGetLogger(core, dynamicHandler.cfg);
|
|
2080
|
-
},
|
|
2081
|
-
getCfg: function () {
|
|
2082
|
-
return dynamicHandler.cfg;
|
|
2083
|
-
},
|
|
2084
|
-
getExtCfg: _resolveExtCfg,
|
|
2085
|
-
getConfig: _getConfig,
|
|
2086
|
-
hasNext: function () {
|
|
2087
|
-
return !!_nextProxy;
|
|
2088
|
-
},
|
|
2089
|
-
getNext: function () {
|
|
2090
|
-
return _nextProxy;
|
|
2091
|
-
},
|
|
2092
|
-
setNext: function (nextPlugin) {
|
|
2093
|
-
_nextProxy = nextPlugin;
|
|
2094
|
-
},
|
|
2095
|
-
iterate: _iterateChain,
|
|
2096
|
-
onComplete: _addOnComplete
|
|
2097
|
-
}
|
|
2098
|
-
};
|
|
2099
|
-
function _addOnComplete(onComplete, that) {
|
|
2100
|
-
var args = [];
|
|
2101
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
2102
|
-
args[_i - 2] = arguments[_i];
|
|
1960
|
+
else if (config) {
|
|
1961
|
+
var cookieCfg = config.cookieCfg;
|
|
1962
|
+
if (cookieCfg && cookieCfg[strConfigCookieMgr]) {
|
|
1963
|
+
cookieMgr = cookieCfg[strConfigCookieMgr];
|
|
2103
1964
|
}
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
func: onComplete,
|
|
2107
|
-
self: !isUndefined(that) ? that : context.ctx,
|
|
2108
|
-
args: args
|
|
2109
|
-
});
|
|
1965
|
+
else {
|
|
1966
|
+
cookieMgr = createCookieMgr(config);
|
|
2110
1967
|
}
|
|
2111
1968
|
}
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
_nextProxy = nextProxy ? nextProxy[_DYN_GET_NEXT ]() : null;
|
|
2115
|
-
if (!nextProxy) {
|
|
2116
|
-
var onComplete = _onComplete;
|
|
2117
|
-
if (onComplete && onComplete[_DYN_LENGTH$2 ] > 0) {
|
|
2118
|
-
arrForEach(onComplete, function (completeDetails) {
|
|
2119
|
-
try {
|
|
2120
|
-
completeDetails.func[_DYN_CALL ](completeDetails.self, completeDetails.args);
|
|
2121
|
-
}
|
|
2122
|
-
catch (e) {
|
|
2123
|
-
_throwInternal(core[_DYN_LOGGER ], 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
2124
|
-
}
|
|
2125
|
-
});
|
|
2126
|
-
_onComplete = [];
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
return nextProxy;
|
|
1969
|
+
if (!cookieMgr) {
|
|
1970
|
+
cookieMgr = _gblCookieMgr(config, (core || {})[_DYN_LOGGER ]);
|
|
2130
1971
|
}
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
1972
|
+
return cookieMgr;
|
|
1973
|
+
}
|
|
1974
|
+
function createCookieMgr(rootConfig, logger) {
|
|
1975
|
+
var cookieMgrConfig;
|
|
1976
|
+
var _path;
|
|
1977
|
+
var _domain;
|
|
1978
|
+
var _enabled;
|
|
1979
|
+
var _getCookieFn;
|
|
1980
|
+
var _setCookieFn;
|
|
1981
|
+
var _delCookieFn;
|
|
1982
|
+
rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;
|
|
1983
|
+
onConfigChange(rootConfig, function (details) {
|
|
1984
|
+
details[_DYN_SET_DF ](details.cfg, rootDefaultConfig);
|
|
1985
|
+
cookieMgrConfig = details[_DYN_SET_DF ](details.cfg.cookieCfg, defaultConfig);
|
|
1986
|
+
var isEnabled = cookieMgrConfig.enabled;
|
|
1987
|
+
if (isNullOrUndefined(isEnabled)) {
|
|
1988
|
+
var cookieEnabled = void 0;
|
|
1989
|
+
if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
|
|
1990
|
+
cookieEnabled = !rootConfig[strIsCookieUseDisabled];
|
|
2138
1991
|
}
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
if (extCfg) {
|
|
2142
|
-
idCfg = extCfg[identifier];
|
|
2143
|
-
if (!idCfg && createIfMissing) {
|
|
2144
|
-
idCfg = {};
|
|
2145
|
-
}
|
|
2146
|
-
dynamicHandler.set(extCfg, identifier, idCfg);
|
|
2147
|
-
idCfg = extCfg[identifier];
|
|
1992
|
+
if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
|
|
1993
|
+
cookieEnabled = !rootConfig[strDisableCookiesUsage];
|
|
2148
1994
|
}
|
|
1995
|
+
isEnabled = cookieEnabled;
|
|
2149
1996
|
}
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
1997
|
+
_path = cookieMgrConfig[STR_PATH ] || "/";
|
|
1998
|
+
_domain = cookieMgrConfig[STR_DOMAIN ];
|
|
1999
|
+
_enabled = isEnabled !== false;
|
|
2000
|
+
_getCookieFn = cookieMgrConfig.getCookie || _getCookieValue;
|
|
2001
|
+
_setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
|
|
2002
|
+
_delCookieFn = cookieMgrConfig.delCookie || _setCookieValue;
|
|
2003
|
+
}, logger);
|
|
2004
|
+
var cookieMgr = {
|
|
2005
|
+
isEnabled: function () {
|
|
2006
|
+
var enabled = _enabled && areCookiesSupported(logger);
|
|
2007
|
+
var gblManager = _globalCookieConfig[strConfigCookieMgr];
|
|
2008
|
+
if (enabled && gblManager && cookieMgr !== gblManager) {
|
|
2009
|
+
enabled = _isMgrEnabled(gblManager);
|
|
2010
|
+
}
|
|
2011
|
+
return enabled;
|
|
2012
|
+
},
|
|
2013
|
+
setEnabled: function (value) {
|
|
2014
|
+
_enabled = value !== false;
|
|
2015
|
+
},
|
|
2016
|
+
set: function (name, value, maxAgeSec, domain, path) {
|
|
2017
|
+
var result = false;
|
|
2018
|
+
if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
|
|
2019
|
+
var values = {};
|
|
2020
|
+
var theValue = strTrim(value || STR_EMPTY);
|
|
2021
|
+
var idx = strIndexOf(theValue, ";");
|
|
2022
|
+
if (idx !== -1) {
|
|
2023
|
+
theValue = strTrim(strLeft(value, idx));
|
|
2024
|
+
values = _extractParts(strSubstring(value, idx + 1));
|
|
2025
|
+
}
|
|
2026
|
+
setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
|
|
2027
|
+
if (!isNullOrUndefined(maxAgeSec)) {
|
|
2028
|
+
var _isIE = isIE();
|
|
2029
|
+
if (isUndefined(values[strExpires])) {
|
|
2030
|
+
var nowMs = utcNow();
|
|
2031
|
+
var expireMs = nowMs + (maxAgeSec * 1000);
|
|
2032
|
+
if (expireMs > 0) {
|
|
2033
|
+
var expiry = new Date();
|
|
2034
|
+
expiry.setTime(expireMs);
|
|
2035
|
+
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
if (!_isIE) {
|
|
2039
|
+
setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
|
|
2160
2040
|
}
|
|
2161
2041
|
}
|
|
2162
|
-
|
|
2163
|
-
|
|
2042
|
+
var location_1 = getLocation();
|
|
2043
|
+
if (location_1 && location_1.protocol === "https:") {
|
|
2044
|
+
setValue(values, "secure", null, null, isUndefined);
|
|
2045
|
+
if (_allowUaSameSite === null) {
|
|
2046
|
+
_allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
|
|
2047
|
+
}
|
|
2048
|
+
if (_allowUaSameSite) {
|
|
2049
|
+
setValue(values, "SameSite", "None", null, isUndefined);
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
setValue(values, STR_PATH, path || _path, null, isUndefined);
|
|
2053
|
+
_setCookieFn(name, _formatCookieValue(theValue, values));
|
|
2054
|
+
result = true;
|
|
2055
|
+
}
|
|
2056
|
+
return result;
|
|
2057
|
+
},
|
|
2058
|
+
get: function (name) {
|
|
2059
|
+
var value = STR_EMPTY;
|
|
2060
|
+
if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {
|
|
2061
|
+
value = _getCookieFn(name);
|
|
2062
|
+
}
|
|
2063
|
+
return value;
|
|
2064
|
+
},
|
|
2065
|
+
del: function (name, path) {
|
|
2066
|
+
var result = false;
|
|
2067
|
+
if (_isMgrEnabled(cookieMgr)) {
|
|
2068
|
+
result = cookieMgr.purge(name, path);
|
|
2069
|
+
}
|
|
2070
|
+
return result;
|
|
2071
|
+
},
|
|
2072
|
+
purge: function (name, path) {
|
|
2073
|
+
var _a;
|
|
2074
|
+
var result = false;
|
|
2075
|
+
if (areCookiesSupported(logger)) {
|
|
2076
|
+
var values = (_a = {},
|
|
2077
|
+
_a[STR_PATH] = path ? path : "/",
|
|
2078
|
+
_a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
|
|
2079
|
+
_a);
|
|
2080
|
+
if (!isIE()) {
|
|
2081
|
+
values["max-age"] = "0";
|
|
2082
|
+
}
|
|
2083
|
+
_delCookieFn(name, _formatCookieValue(STR_EMPTY, values));
|
|
2084
|
+
result = true;
|
|
2085
|
+
}
|
|
2086
|
+
return result;
|
|
2164
2087
|
}
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2088
|
+
};
|
|
2089
|
+
cookieMgr[strConfigCookieMgr] = cookieMgr;
|
|
2090
|
+
return cookieMgr;
|
|
2091
|
+
}
|
|
2092
|
+
function areCookiesSupported(logger) {
|
|
2093
|
+
if (_supportsCookies === null) {
|
|
2094
|
+
_supportsCookies = false;
|
|
2095
|
+
try {
|
|
2096
|
+
var doc = _doc || {};
|
|
2097
|
+
_supportsCookies = doc[strCookie] !== undefined;
|
|
2174
2098
|
}
|
|
2175
|
-
|
|
2176
|
-
|
|
2099
|
+
catch (e) {
|
|
2100
|
+
_throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2177
2101
|
}
|
|
2178
|
-
return (theValue || !isNullOrUndefined(theValue)) ? theValue : defaultValue;
|
|
2179
2102
|
}
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2103
|
+
return _supportsCookies;
|
|
2104
|
+
}
|
|
2105
|
+
function _extractParts(theValue) {
|
|
2106
|
+
var values = {};
|
|
2107
|
+
if (theValue && theValue[_DYN_LENGTH$2 ]) {
|
|
2108
|
+
var parts = strTrim(theValue)[_DYN_SPLIT ](";");
|
|
2109
|
+
arrForEach(parts, function (thePart) {
|
|
2110
|
+
thePart = strTrim(thePart || STR_EMPTY);
|
|
2111
|
+
if (thePart) {
|
|
2112
|
+
var idx = strIndexOf(thePart, "=");
|
|
2113
|
+
if (idx === -1) {
|
|
2114
|
+
values[thePart] = null;
|
|
2115
|
+
}
|
|
2116
|
+
else {
|
|
2117
|
+
values[strTrim(strLeft(thePart, idx))] = strTrim(strSubstring(thePart, idx + 1));
|
|
2118
|
+
}
|
|
2186
2119
|
}
|
|
2187
|
-
}
|
|
2120
|
+
});
|
|
2188
2121
|
}
|
|
2189
|
-
return
|
|
2122
|
+
return values;
|
|
2190
2123
|
}
|
|
2191
|
-
function
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
var context = internalContext.ctx;
|
|
2195
|
-
function _processNext(env) {
|
|
2196
|
-
var nextPlugin = internalContext._next();
|
|
2197
|
-
if (nextPlugin) {
|
|
2198
|
-
nextPlugin[STR_PROCESS_TELEMETRY ](env, context);
|
|
2199
|
-
}
|
|
2200
|
-
return !nextPlugin;
|
|
2124
|
+
function _formatDate(theDate, func) {
|
|
2125
|
+
if (isFunction(theDate[func])) {
|
|
2126
|
+
return theDate[func]();
|
|
2201
2127
|
}
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2128
|
+
return null;
|
|
2129
|
+
}
|
|
2130
|
+
function _formatCookieValue(value, values) {
|
|
2131
|
+
var cookieValue = value || STR_EMPTY;
|
|
2132
|
+
objForEachKey(values, function (name, theValue) {
|
|
2133
|
+
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : STR_EMPTY);
|
|
2134
|
+
});
|
|
2135
|
+
return cookieValue;
|
|
2136
|
+
}
|
|
2137
|
+
function _getCookieValue(name) {
|
|
2138
|
+
var cookieValue = STR_EMPTY;
|
|
2139
|
+
if (_doc) {
|
|
2140
|
+
var theCookie = _doc[strCookie] || STR_EMPTY;
|
|
2141
|
+
if (_parsedCookieValue !== theCookie) {
|
|
2142
|
+
_cookieCache = _extractParts(theCookie);
|
|
2143
|
+
_parsedCookieValue = theCookie;
|
|
2206
2144
|
}
|
|
2207
|
-
|
|
2145
|
+
cookieValue = strTrim(_cookieCache[name] || STR_EMPTY);
|
|
2208
2146
|
}
|
|
2209
|
-
|
|
2210
|
-
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2211
|
-
return context;
|
|
2147
|
+
return cookieValue;
|
|
2212
2148
|
}
|
|
2213
|
-
function
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
var context = internalContext.ctx;
|
|
2217
|
-
function _processNext(unloadState) {
|
|
2218
|
-
var nextPlugin = internalContext._next();
|
|
2219
|
-
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
2220
|
-
return !nextPlugin;
|
|
2149
|
+
function _setCookieValue(name, cookieValue) {
|
|
2150
|
+
if (_doc) {
|
|
2151
|
+
_doc[strCookie] = name + "=" + cookieValue;
|
|
2221
2152
|
}
|
|
2222
|
-
function _createNew(plugins, startAt) {
|
|
2223
|
-
if (plugins === void 0) { plugins = null; }
|
|
2224
|
-
if (isArray(plugins)) {
|
|
2225
|
-
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2226
|
-
}
|
|
2227
|
-
return createProcessTelemetryUnloadContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
|
|
2228
|
-
}
|
|
2229
|
-
context[_DYN_PROCESS_NEXT ] = _processNext;
|
|
2230
|
-
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2231
|
-
return context;
|
|
2232
2153
|
}
|
|
2233
|
-
function
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
var context = internalContext.ctx;
|
|
2237
|
-
function _processNext(updateState) {
|
|
2238
|
-
return context.iterate(function (plugin) {
|
|
2239
|
-
if (isFunction(plugin[_DYN_UPDATE$1 ])) {
|
|
2240
|
-
plugin[_DYN_UPDATE$1 ](context, updateState);
|
|
2241
|
-
}
|
|
2242
|
-
});
|
|
2154
|
+
function uaDisallowsSameSiteNone(userAgent) {
|
|
2155
|
+
if (!isString(userAgent)) {
|
|
2156
|
+
return false;
|
|
2243
2157
|
}
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
if (isArray(plugins)) {
|
|
2247
|
-
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2248
|
-
}
|
|
2249
|
-
return createProcessTelemetryUpdateContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
|
|
2158
|
+
if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
|
|
2159
|
+
return true;
|
|
2250
2160
|
}
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
return context;
|
|
2254
|
-
}
|
|
2255
|
-
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
2256
|
-
var firstProxy = null;
|
|
2257
|
-
var add = startAt ? false : true;
|
|
2258
|
-
if (isArray(plugins) && plugins[_DYN_LENGTH$2 ] > 0) {
|
|
2259
|
-
var lastProxy_1 = null;
|
|
2260
|
-
arrForEach(plugins, function (thePlugin) {
|
|
2261
|
-
if (!add && startAt === thePlugin) {
|
|
2262
|
-
add = true;
|
|
2263
|
-
}
|
|
2264
|
-
if (add && thePlugin && isFunction(thePlugin[STR_PROCESS_TELEMETRY ])) {
|
|
2265
|
-
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
2266
|
-
if (!firstProxy) {
|
|
2267
|
-
firstProxy = newProxy;
|
|
2268
|
-
}
|
|
2269
|
-
if (lastProxy_1) {
|
|
2270
|
-
lastProxy_1._setNext(newProxy);
|
|
2271
|
-
}
|
|
2272
|
-
lastProxy_1 = newProxy;
|
|
2273
|
-
}
|
|
2274
|
-
});
|
|
2161
|
+
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
|
|
2162
|
+
return true;
|
|
2275
2163
|
}
|
|
2276
|
-
if (
|
|
2277
|
-
return
|
|
2164
|
+
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
|
|
2165
|
+
return true;
|
|
2278
2166
|
}
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
function createTelemetryPluginProxy(plugin, config, core) {
|
|
2282
|
-
var nextProxy = null;
|
|
2283
|
-
var hasProcessTelemetry = isFunction(plugin[STR_PROCESS_TELEMETRY ]);
|
|
2284
|
-
var hasSetNext = isFunction(plugin[_DYN_SET_NEXT_PLUGIN ]);
|
|
2285
|
-
var chainId;
|
|
2286
|
-
if (plugin) {
|
|
2287
|
-
chainId = plugin[_DYN_IDENTIFIER ] + "-" + plugin[STR_PRIORITY ] + "-" + _chainId++;
|
|
2167
|
+
if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
|
|
2168
|
+
return true;
|
|
2288
2169
|
}
|
|
2289
|
-
|
|
2290
|
-
|
|
2170
|
+
if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
|
|
2171
|
+
return true;
|
|
2291
2172
|
}
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
return plugin;
|
|
2295
|
-
},
|
|
2296
|
-
getNext: function () {
|
|
2297
|
-
return nextProxy;
|
|
2298
|
-
},
|
|
2299
|
-
processTelemetry: _processTelemetry,
|
|
2300
|
-
unload: _unloadPlugin,
|
|
2301
|
-
update: _updatePlugin,
|
|
2302
|
-
_id: chainId,
|
|
2303
|
-
_setNext: function (nextPlugin) {
|
|
2304
|
-
nextProxy = nextPlugin;
|
|
2305
|
-
}
|
|
2306
|
-
};
|
|
2307
|
-
function _getTelCtx() {
|
|
2308
|
-
var itemCtx;
|
|
2309
|
-
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
2310
|
-
itemCtx = plugin[strGetTelCtx]();
|
|
2311
|
-
}
|
|
2312
|
-
if (!itemCtx) {
|
|
2313
|
-
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
2314
|
-
}
|
|
2315
|
-
return itemCtx;
|
|
2173
|
+
if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
|
|
2174
|
+
return true;
|
|
2316
2175
|
}
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2176
|
+
return false;
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
var strExecutionContextKey = "ctx";
|
|
2180
|
+
var strParentContextKey = "ParentContextKey";
|
|
2181
|
+
var strChildrenContextKey = "ChildrenContextKey";
|
|
2182
|
+
var PerfEvent = /** @class */ (function () {
|
|
2183
|
+
function PerfEvent(name, payloadDetails, isAsync) {
|
|
2184
|
+
var _self = this;
|
|
2185
|
+
_self.start = utcNow();
|
|
2186
|
+
_self[_DYN_NAME$1 ] = name;
|
|
2187
|
+
_self[_DYN_IS_ASYNC ] = isAsync;
|
|
2188
|
+
_self[_DYN_IS_CHILD_EVT ] = function () { return false; };
|
|
2189
|
+
if (isFunction(payloadDetails)) {
|
|
2190
|
+
var theDetails_1;
|
|
2191
|
+
objDefineAccessors(_self, "payload", function () {
|
|
2192
|
+
if (!theDetails_1 && isFunction(payloadDetails)) {
|
|
2193
|
+
theDetails_1 = payloadDetails();
|
|
2194
|
+
payloadDetails = null;
|
|
2195
|
+
}
|
|
2196
|
+
return theDetails_1;
|
|
2197
|
+
});
|
|
2323
2198
|
}
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
try {
|
|
2329
|
-
var nextId = nextProxy ? nextProxy._id : STR_EMPTY;
|
|
2330
|
-
if (nextId) {
|
|
2331
|
-
hasRunContext[nextId] = false;
|
|
2332
|
-
}
|
|
2333
|
-
hasRun = processPluginFn(itemCtx);
|
|
2199
|
+
_self[_DYN_GET_CTX ] = function (key) {
|
|
2200
|
+
if (key) {
|
|
2201
|
+
if (key === PerfEvent[strParentContextKey] || key === PerfEvent[strChildrenContextKey]) {
|
|
2202
|
+
return _self[key];
|
|
2334
2203
|
}
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2204
|
+
return (_self[strExecutionContextKey] || {})[key];
|
|
2205
|
+
}
|
|
2206
|
+
return null;
|
|
2207
|
+
};
|
|
2208
|
+
_self[_DYN_SET_CTX ] = function (key, value) {
|
|
2209
|
+
if (key) {
|
|
2210
|
+
if (key === PerfEvent[strParentContextKey]) {
|
|
2211
|
+
if (!_self[key]) {
|
|
2212
|
+
_self[_DYN_IS_CHILD_EVT ] = function () { return true; };
|
|
2342
2213
|
}
|
|
2214
|
+
_self[key] = value;
|
|
2215
|
+
}
|
|
2216
|
+
else if (key === PerfEvent[strChildrenContextKey]) {
|
|
2217
|
+
_self[key] = value;
|
|
2218
|
+
}
|
|
2219
|
+
else {
|
|
2220
|
+
var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};
|
|
2221
|
+
ctx[key] = value;
|
|
2343
2222
|
}
|
|
2344
|
-
}, details, isAsync);
|
|
2345
|
-
}
|
|
2346
|
-
return hasRun;
|
|
2347
|
-
}
|
|
2348
|
-
function _processTelemetry(env, itemCtx) {
|
|
2349
|
-
itemCtx = itemCtx || _getTelCtx();
|
|
2350
|
-
function _callProcessTelemetry(itemCtx) {
|
|
2351
|
-
if (!plugin || !hasProcessTelemetry) {
|
|
2352
|
-
return false;
|
|
2353
|
-
}
|
|
2354
|
-
var pluginState = _getPluginState(plugin);
|
|
2355
|
-
if (pluginState[_DYN_TEARDOWN ] || pluginState[STR_DISABLED]) {
|
|
2356
|
-
return false;
|
|
2357
2223
|
}
|
|
2358
|
-
|
|
2359
|
-
|
|
2224
|
+
};
|
|
2225
|
+
_self[_DYN_COMPLETE ] = function () {
|
|
2226
|
+
var childTime = 0;
|
|
2227
|
+
var childEvts = _self[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
|
|
2228
|
+
if (isArray(childEvts)) {
|
|
2229
|
+
for (var lp = 0; lp < childEvts[_DYN_LENGTH$2 ]; lp++) {
|
|
2230
|
+
var childEvt = childEvts[lp];
|
|
2231
|
+
if (childEvt) {
|
|
2232
|
+
childTime += childEvt[_DYN_TIME ];
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2360
2235
|
}
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
itemCtx[_DYN_PROCESS_NEXT ](env);
|
|
2366
|
-
}
|
|
2236
|
+
_self[_DYN_TIME ] = utcNow() - _self.start;
|
|
2237
|
+
_self.exTime = _self[_DYN_TIME ] - childTime;
|
|
2238
|
+
_self[_DYN_COMPLETE ] = function () { };
|
|
2239
|
+
};
|
|
2367
2240
|
}
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2241
|
+
PerfEvent.ParentContextKey = "parent";
|
|
2242
|
+
PerfEvent.ChildrenContextKey = "childEvts";
|
|
2243
|
+
return PerfEvent;
|
|
2244
|
+
}());
|
|
2245
|
+
var doPerfActiveKey = "CoreUtils.doPerf";
|
|
2246
|
+
function doPerf(mgrSource, getSource, func, details, isAsync) {
|
|
2247
|
+
if (mgrSource) {
|
|
2248
|
+
var perfMgr = mgrSource;
|
|
2249
|
+
if (perfMgr[STR_GET_PERF_MGR]) {
|
|
2250
|
+
perfMgr = perfMgr[STR_GET_PERF_MGR]();
|
|
2251
|
+
}
|
|
2252
|
+
if (perfMgr) {
|
|
2253
|
+
var perfEvt = void 0;
|
|
2254
|
+
var currentActive = perfMgr[_DYN_GET_CTX ](doPerfActiveKey);
|
|
2255
|
+
try {
|
|
2256
|
+
perfEvt = perfMgr.create(getSource(), details, isAsync);
|
|
2257
|
+
if (perfEvt) {
|
|
2258
|
+
if (currentActive && perfEvt[_DYN_SET_CTX ]) {
|
|
2259
|
+
perfEvt[_DYN_SET_CTX ](PerfEvent[strParentContextKey], currentActive);
|
|
2260
|
+
if (currentActive[_DYN_GET_CTX ] && currentActive[_DYN_SET_CTX ]) {
|
|
2261
|
+
var children = currentActive[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
|
|
2262
|
+
if (!children) {
|
|
2263
|
+
children = [];
|
|
2264
|
+
currentActive[_DYN_SET_CTX ](PerfEvent[strChildrenContextKey], children);
|
|
2265
|
+
}
|
|
2266
|
+
children[_DYN_PUSH ](perfEvt);
|
|
2267
|
+
}
|
|
2380
2268
|
}
|
|
2269
|
+
perfMgr[_DYN_SET_CTX ](doPerfActiveKey, perfEvt);
|
|
2270
|
+
return func(perfEvt);
|
|
2381
2271
|
}
|
|
2382
2272
|
}
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2273
|
+
catch (ex) {
|
|
2274
|
+
if (perfEvt && perfEvt[_DYN_SET_CTX ]) {
|
|
2275
|
+
perfEvt[_DYN_SET_CTX ]("exception", ex);
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
finally {
|
|
2279
|
+
if (perfEvt) {
|
|
2280
|
+
perfMgr.fire(perfEvt);
|
|
2281
|
+
}
|
|
2282
|
+
perfMgr[_DYN_SET_CTX ](doPerfActiveKey, currentActive);
|
|
2283
|
+
}
|
|
2387
2284
|
}
|
|
2388
2285
|
}
|
|
2389
|
-
|
|
2390
|
-
function _callUpdate() {
|
|
2391
|
-
var hasRun = false;
|
|
2392
|
-
if (plugin) {
|
|
2393
|
-
var pluginState = _getPluginState(plugin);
|
|
2394
|
-
var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
|
|
2395
|
-
if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
|
|
2396
|
-
if (plugin[_DYN_UPDATE$1 ] && plugin[_DYN_UPDATE$1 ](updateCtx, updateState) === true) {
|
|
2397
|
-
hasRun = true;
|
|
2398
|
-
}
|
|
2399
|
-
}
|
|
2400
|
-
}
|
|
2401
|
-
return hasRun;
|
|
2402
|
-
}
|
|
2403
|
-
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
2404
|
-
updateCtx[_DYN_PROCESS_NEXT ](updateState);
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
return objFreeze(proxyChain);
|
|
2286
|
+
return func();
|
|
2408
2287
|
}
|
|
2409
2288
|
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
var defaultConfig = objDeepFreeze((_a$2 = {},
|
|
2425
|
-
_a$2[STR_DOMAIN] = { fb: "cookieDomain", dfVal: isNotNullOrUndefined },
|
|
2426
|
-
_a$2.path = { fb: "cookiePath", dfVal: isNotNullOrUndefined },
|
|
2427
|
-
_a$2.enabled = UNDEFINED_VALUE,
|
|
2428
|
-
_a$2));
|
|
2429
|
-
var rootDefaultConfig = (_b = {
|
|
2430
|
-
cookieCfg: {},
|
|
2431
|
-
cookieDomain: UNDEFINED_VALUE,
|
|
2432
|
-
cookiePath: UNDEFINED_VALUE
|
|
2433
|
-
},
|
|
2434
|
-
_b[strDisableCookiesUsage] = UNDEFINED_VALUE,
|
|
2435
|
-
_b);
|
|
2436
|
-
function _gblCookieMgr(config, logger) {
|
|
2437
|
-
var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
|
|
2438
|
-
if (!inst) {
|
|
2439
|
-
inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
|
|
2440
|
-
_globalCookieConfig[strConfigCookieMgr] = inst;
|
|
2441
|
-
}
|
|
2442
|
-
return inst;
|
|
2443
|
-
}
|
|
2444
|
-
function _isMgrEnabled(cookieMgr) {
|
|
2445
|
-
if (cookieMgr) {
|
|
2446
|
-
return cookieMgr.isEnabled();
|
|
2289
|
+
function generateW3CId() {
|
|
2290
|
+
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
2291
|
+
var oct = STR_EMPTY, tmp;
|
|
2292
|
+
for (var a = 0; a < 4; a++) {
|
|
2293
|
+
tmp = random32();
|
|
2294
|
+
oct +=
|
|
2295
|
+
hexValues[tmp & 0xF] +
|
|
2296
|
+
hexValues[tmp >> 4 & 0xF] +
|
|
2297
|
+
hexValues[tmp >> 8 & 0xF] +
|
|
2298
|
+
hexValues[tmp >> 12 & 0xF] +
|
|
2299
|
+
hexValues[tmp >> 16 & 0xF] +
|
|
2300
|
+
hexValues[tmp >> 20 & 0xF] +
|
|
2301
|
+
hexValues[tmp >> 24 & 0xF] +
|
|
2302
|
+
hexValues[tmp >> 28 & 0xF];
|
|
2447
2303
|
}
|
|
2448
|
-
|
|
2304
|
+
var clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];
|
|
2305
|
+
return strSubstr(oct, 0, 8) + strSubstr(oct, 9, 4) + "4" + strSubstr(oct, 13, 3) + clockSequenceHi + strSubstr(oct, 16, 3) + strSubstr(oct, 19, 12);
|
|
2449
2306
|
}
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2307
|
+
|
|
2308
|
+
var INVALID_TRACE_ID = "00000000000000000000000000000000";
|
|
2309
|
+
var INVALID_SPAN_ID = "0000000000000000";
|
|
2310
|
+
function _isValid(value, len, invalidValue) {
|
|
2311
|
+
if (value && value[_DYN_LENGTH$2 ] === len && value !== invalidValue) {
|
|
2312
|
+
return !!value.match(/^[\da-f]*$/i);
|
|
2453
2313
|
}
|
|
2454
2314
|
return false;
|
|
2455
2315
|
}
|
|
2456
|
-
function
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2316
|
+
function isValidTraceId(value) {
|
|
2317
|
+
return _isValid(value, 32, INVALID_TRACE_ID);
|
|
2318
|
+
}
|
|
2319
|
+
function isValidSpanId(value) {
|
|
2320
|
+
return _isValid(value, 16, INVALID_SPAN_ID);
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
2324
|
+
function _getPluginState(plugin) {
|
|
2325
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
2329
|
+
var strHasRunFlags = "_hasRun";
|
|
2330
|
+
var strGetTelCtx = "_getTelCtx";
|
|
2331
|
+
var _chainId = 0;
|
|
2332
|
+
function _getNextProxyStart(proxy, core, startAt) {
|
|
2333
|
+
while (proxy) {
|
|
2334
|
+
if (proxy[_DYN_GET_PLUGIN ]() === startAt) {
|
|
2335
|
+
return proxy;
|
|
2460
2336
|
}
|
|
2337
|
+
proxy = proxy[_DYN_GET_NEXT ]();
|
|
2461
2338
|
}
|
|
2462
|
-
return
|
|
2339
|
+
return createTelemetryProxyChain([startAt], core.config || {}, core);
|
|
2463
2340
|
}
|
|
2464
|
-
function
|
|
2465
|
-
var
|
|
2466
|
-
|
|
2467
|
-
|
|
2341
|
+
function _createInternalContext(telemetryChain, dynamicHandler, core, startAt) {
|
|
2342
|
+
var _nextProxy = null;
|
|
2343
|
+
var _onComplete = [];
|
|
2344
|
+
if (!dynamicHandler) {
|
|
2345
|
+
dynamicHandler = createDynamicConfig({}, null, core[_DYN_LOGGER ]);
|
|
2468
2346
|
}
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2347
|
+
if (startAt !== null) {
|
|
2348
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;
|
|
2349
|
+
}
|
|
2350
|
+
var context = {
|
|
2351
|
+
_next: _moveNext,
|
|
2352
|
+
ctx: {
|
|
2353
|
+
core: function () {
|
|
2354
|
+
return core;
|
|
2355
|
+
},
|
|
2356
|
+
diagLog: function () {
|
|
2357
|
+
return safeGetLogger(core, dynamicHandler.cfg);
|
|
2358
|
+
},
|
|
2359
|
+
getCfg: function () {
|
|
2360
|
+
return dynamicHandler.cfg;
|
|
2361
|
+
},
|
|
2362
|
+
getExtCfg: _resolveExtCfg,
|
|
2363
|
+
getConfig: _getConfig,
|
|
2364
|
+
hasNext: function () {
|
|
2365
|
+
return !!_nextProxy;
|
|
2366
|
+
},
|
|
2367
|
+
getNext: function () {
|
|
2368
|
+
return _nextProxy;
|
|
2369
|
+
},
|
|
2370
|
+
setNext: function (nextPlugin) {
|
|
2371
|
+
_nextProxy = nextPlugin;
|
|
2372
|
+
},
|
|
2373
|
+
iterate: _iterateChain,
|
|
2374
|
+
onComplete: _addOnComplete
|
|
2473
2375
|
}
|
|
2474
|
-
|
|
2475
|
-
|
|
2376
|
+
};
|
|
2377
|
+
function _addOnComplete(onComplete, that) {
|
|
2378
|
+
var args = [];
|
|
2379
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
2380
|
+
args[_i - 2] = arguments[_i];
|
|
2476
2381
|
}
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
function createCookieMgr(rootConfig, logger) {
|
|
2484
|
-
var cookieMgrConfig;
|
|
2485
|
-
var _path;
|
|
2486
|
-
var _domain;
|
|
2487
|
-
var _enabled;
|
|
2488
|
-
var _getCookieFn;
|
|
2489
|
-
var _setCookieFn;
|
|
2490
|
-
var _delCookieFn;
|
|
2491
|
-
rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;
|
|
2492
|
-
onConfigChange(rootConfig, function (details) {
|
|
2493
|
-
details[_DYN_SET_DF ](details.cfg, rootDefaultConfig);
|
|
2494
|
-
cookieMgrConfig = details[_DYN_SET_DF ](details.cfg.cookieCfg, defaultConfig);
|
|
2495
|
-
var isEnabled = cookieMgrConfig.enabled;
|
|
2496
|
-
if (isNullOrUndefined(isEnabled)) {
|
|
2497
|
-
var cookieEnabled = void 0;
|
|
2498
|
-
if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
|
|
2499
|
-
cookieEnabled = !rootConfig[strIsCookieUseDisabled];
|
|
2500
|
-
}
|
|
2501
|
-
if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
|
|
2502
|
-
cookieEnabled = !rootConfig[strDisableCookiesUsage];
|
|
2503
|
-
}
|
|
2504
|
-
isEnabled = cookieEnabled;
|
|
2382
|
+
if (onComplete) {
|
|
2383
|
+
_onComplete[_DYN_PUSH ]({
|
|
2384
|
+
func: onComplete,
|
|
2385
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
2386
|
+
args: args
|
|
2387
|
+
});
|
|
2505
2388
|
}
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
var gblManager = _globalCookieConfig[strConfigCookieMgr];
|
|
2517
|
-
if (enabled && gblManager && cookieMgr !== gblManager) {
|
|
2518
|
-
enabled = _isMgrEnabled(gblManager);
|
|
2519
|
-
}
|
|
2520
|
-
return enabled;
|
|
2521
|
-
},
|
|
2522
|
-
setEnabled: function (value) {
|
|
2523
|
-
_enabled = value !== false;
|
|
2524
|
-
},
|
|
2525
|
-
set: function (name, value, maxAgeSec, domain, path) {
|
|
2526
|
-
var result = false;
|
|
2527
|
-
if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
|
|
2528
|
-
var values = {};
|
|
2529
|
-
var theValue = strTrim(value || STR_EMPTY);
|
|
2530
|
-
var idx = strIndexOf(theValue, ";");
|
|
2531
|
-
if (idx !== -1) {
|
|
2532
|
-
theValue = strTrim(strLeft(value, idx));
|
|
2533
|
-
values = _extractParts(strSubstring(value, idx + 1));
|
|
2534
|
-
}
|
|
2535
|
-
setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
|
|
2536
|
-
if (!isNullOrUndefined(maxAgeSec)) {
|
|
2537
|
-
var _isIE = isIE();
|
|
2538
|
-
if (isUndefined(values[strExpires])) {
|
|
2539
|
-
var nowMs = utcNow();
|
|
2540
|
-
var expireMs = nowMs + (maxAgeSec * 1000);
|
|
2541
|
-
if (expireMs > 0) {
|
|
2542
|
-
var expiry = new Date();
|
|
2543
|
-
expiry.setTime(expireMs);
|
|
2544
|
-
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
|
|
2545
|
-
}
|
|
2546
|
-
}
|
|
2547
|
-
if (!_isIE) {
|
|
2548
|
-
setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
|
|
2549
|
-
}
|
|
2550
|
-
}
|
|
2551
|
-
var location_1 = getLocation();
|
|
2552
|
-
if (location_1 && location_1.protocol === "https:") {
|
|
2553
|
-
setValue(values, "secure", null, null, isUndefined);
|
|
2554
|
-
if (_allowUaSameSite === null) {
|
|
2555
|
-
_allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
|
|
2389
|
+
}
|
|
2390
|
+
function _moveNext() {
|
|
2391
|
+
var nextProxy = _nextProxy;
|
|
2392
|
+
_nextProxy = nextProxy ? nextProxy[_DYN_GET_NEXT ]() : null;
|
|
2393
|
+
if (!nextProxy) {
|
|
2394
|
+
var onComplete = _onComplete;
|
|
2395
|
+
if (onComplete && onComplete[_DYN_LENGTH$2 ] > 0) {
|
|
2396
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
2397
|
+
try {
|
|
2398
|
+
completeDetails.func[_DYN_CALL ](completeDetails.self, completeDetails.args);
|
|
2556
2399
|
}
|
|
2557
|
-
|
|
2558
|
-
|
|
2400
|
+
catch (e) {
|
|
2401
|
+
_throwInternal(core[_DYN_LOGGER ], 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
2559
2402
|
}
|
|
2560
|
-
}
|
|
2561
|
-
|
|
2562
|
-
_setCookieFn(name, _formatCookieValue(theValue, values));
|
|
2563
|
-
result = true;
|
|
2403
|
+
});
|
|
2404
|
+
_onComplete = [];
|
|
2564
2405
|
}
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2406
|
+
}
|
|
2407
|
+
return nextProxy;
|
|
2408
|
+
}
|
|
2409
|
+
function _getExtCfg(identifier, createIfMissing) {
|
|
2410
|
+
var idCfg = null;
|
|
2411
|
+
var cfg = dynamicHandler.cfg;
|
|
2412
|
+
if (cfg && identifier) {
|
|
2413
|
+
var extCfg = cfg[STR_EXTENSION_CONFIG ];
|
|
2414
|
+
if (!extCfg && createIfMissing) {
|
|
2415
|
+
extCfg = {};
|
|
2571
2416
|
}
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2417
|
+
dynamicHandler.set(cfg, STR_EXTENSION_CONFIG, extCfg);
|
|
2418
|
+
extCfg = cfg[STR_EXTENSION_CONFIG ];
|
|
2419
|
+
if (extCfg) {
|
|
2420
|
+
idCfg = extCfg[identifier];
|
|
2421
|
+
if (!idCfg && createIfMissing) {
|
|
2422
|
+
idCfg = {};
|
|
2423
|
+
}
|
|
2424
|
+
dynamicHandler.set(extCfg, identifier, idCfg);
|
|
2425
|
+
idCfg = extCfg[identifier];
|
|
2578
2426
|
}
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2427
|
+
}
|
|
2428
|
+
return idCfg;
|
|
2429
|
+
}
|
|
2430
|
+
function _resolveExtCfg(identifier, defaultValues) {
|
|
2431
|
+
var newConfig = _getExtCfg(identifier, true);
|
|
2432
|
+
if (defaultValues) {
|
|
2433
|
+
objForEachKey(defaultValues, function (field, defaultValue) {
|
|
2434
|
+
if (isNullOrUndefined(newConfig[field])) {
|
|
2435
|
+
var cfgValue = dynamicHandler.cfg[field];
|
|
2436
|
+
if (cfgValue || !isNullOrUndefined(cfgValue)) {
|
|
2437
|
+
newConfig[field] = cfgValue;
|
|
2438
|
+
}
|
|
2591
2439
|
}
|
|
2592
|
-
|
|
2593
|
-
|
|
2440
|
+
_applyDefaultValue(dynamicHandler, newConfig, field, defaultValue);
|
|
2441
|
+
});
|
|
2442
|
+
}
|
|
2443
|
+
return dynamicHandler[_DYN_SET_DF ](newConfig, defaultValues);
|
|
2444
|
+
}
|
|
2445
|
+
function _getConfig(identifier, field, defaultValue) {
|
|
2446
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
2447
|
+
var theValue;
|
|
2448
|
+
var extConfig = _getExtCfg(identifier, false);
|
|
2449
|
+
var rootConfig = dynamicHandler.cfg;
|
|
2450
|
+
if (extConfig && (extConfig[field] || !isNullOrUndefined(extConfig[field]))) {
|
|
2451
|
+
theValue = extConfig[field];
|
|
2452
|
+
}
|
|
2453
|
+
else if (rootConfig[field] || !isNullOrUndefined(rootConfig[field])) {
|
|
2454
|
+
theValue = rootConfig[field];
|
|
2455
|
+
}
|
|
2456
|
+
return (theValue || !isNullOrUndefined(theValue)) ? theValue : defaultValue;
|
|
2457
|
+
}
|
|
2458
|
+
function _iterateChain(cb) {
|
|
2459
|
+
var nextPlugin;
|
|
2460
|
+
while (!!(nextPlugin = context._next())) {
|
|
2461
|
+
var plugin = nextPlugin[_DYN_GET_PLUGIN ]();
|
|
2462
|
+
if (plugin) {
|
|
2463
|
+
cb(plugin);
|
|
2594
2464
|
}
|
|
2595
|
-
return result;
|
|
2596
2465
|
}
|
|
2597
|
-
}
|
|
2598
|
-
|
|
2599
|
-
|
|
2466
|
+
}
|
|
2467
|
+
return context;
|
|
2468
|
+
}
|
|
2469
|
+
function createProcessTelemetryContext(telemetryChain, cfg, core, startAt) {
|
|
2470
|
+
var config = createDynamicConfig(cfg);
|
|
2471
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
2472
|
+
var context = internalContext.ctx;
|
|
2473
|
+
function _processNext(env) {
|
|
2474
|
+
var nextPlugin = internalContext._next();
|
|
2475
|
+
if (nextPlugin) {
|
|
2476
|
+
nextPlugin[STR_PROCESS_TELEMETRY ](env, context);
|
|
2477
|
+
}
|
|
2478
|
+
return !nextPlugin;
|
|
2479
|
+
}
|
|
2480
|
+
function _createNew(plugins, startAt) {
|
|
2481
|
+
if (plugins === void 0) { plugins = null; }
|
|
2482
|
+
if (isArray(plugins)) {
|
|
2483
|
+
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2484
|
+
}
|
|
2485
|
+
return createProcessTelemetryContext(plugins || context[_DYN_GET_NEXT ](), config.cfg, core, startAt);
|
|
2486
|
+
}
|
|
2487
|
+
context[_DYN_PROCESS_NEXT ] = _processNext;
|
|
2488
|
+
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2489
|
+
return context;
|
|
2600
2490
|
}
|
|
2601
|
-
function
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2491
|
+
function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {
|
|
2492
|
+
var config = createDynamicConfig(core.config);
|
|
2493
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
2494
|
+
var context = internalContext.ctx;
|
|
2495
|
+
function _processNext(unloadState) {
|
|
2496
|
+
var nextPlugin = internalContext._next();
|
|
2497
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
2498
|
+
return !nextPlugin;
|
|
2499
|
+
}
|
|
2500
|
+
function _createNew(plugins, startAt) {
|
|
2501
|
+
if (plugins === void 0) { plugins = null; }
|
|
2502
|
+
if (isArray(plugins)) {
|
|
2503
|
+
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2610
2504
|
}
|
|
2505
|
+
return createProcessTelemetryUnloadContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
|
|
2611
2506
|
}
|
|
2612
|
-
|
|
2507
|
+
context[_DYN_PROCESS_NEXT ] = _processNext;
|
|
2508
|
+
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2509
|
+
return context;
|
|
2613
2510
|
}
|
|
2614
|
-
function
|
|
2615
|
-
var
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
if (
|
|
2621
|
-
|
|
2622
|
-
if (idx === -1) {
|
|
2623
|
-
values[thePart] = null;
|
|
2624
|
-
}
|
|
2625
|
-
else {
|
|
2626
|
-
values[strTrim(strLeft(thePart, idx))] = strTrim(strSubstring(thePart, idx + 1));
|
|
2627
|
-
}
|
|
2511
|
+
function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {
|
|
2512
|
+
var config = createDynamicConfig(core.config);
|
|
2513
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
2514
|
+
var context = internalContext.ctx;
|
|
2515
|
+
function _processNext(updateState) {
|
|
2516
|
+
return context.iterate(function (plugin) {
|
|
2517
|
+
if (isFunction(plugin[_DYN_UPDATE$1 ])) {
|
|
2518
|
+
plugin[_DYN_UPDATE$1 ](context, updateState);
|
|
2628
2519
|
}
|
|
2629
2520
|
});
|
|
2630
2521
|
}
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
return theDate[func]();
|
|
2636
|
-
}
|
|
2637
|
-
return null;
|
|
2638
|
-
}
|
|
2639
|
-
function _formatCookieValue(value, values) {
|
|
2640
|
-
var cookieValue = value || STR_EMPTY;
|
|
2641
|
-
objForEachKey(values, function (name, theValue) {
|
|
2642
|
-
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : STR_EMPTY);
|
|
2643
|
-
});
|
|
2644
|
-
return cookieValue;
|
|
2645
|
-
}
|
|
2646
|
-
function _getCookieValue(name) {
|
|
2647
|
-
var cookieValue = STR_EMPTY;
|
|
2648
|
-
if (_doc) {
|
|
2649
|
-
var theCookie = _doc[strCookie] || STR_EMPTY;
|
|
2650
|
-
if (_parsedCookieValue !== theCookie) {
|
|
2651
|
-
_cookieCache = _extractParts(theCookie);
|
|
2652
|
-
_parsedCookieValue = theCookie;
|
|
2522
|
+
function _createNew(plugins, startAt) {
|
|
2523
|
+
if (plugins === void 0) { plugins = null; }
|
|
2524
|
+
if (isArray(plugins)) {
|
|
2525
|
+
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2653
2526
|
}
|
|
2654
|
-
|
|
2527
|
+
return createProcessTelemetryUpdateContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
|
|
2655
2528
|
}
|
|
2656
|
-
|
|
2529
|
+
context[_DYN_PROCESS_NEXT ] = _processNext;
|
|
2530
|
+
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2531
|
+
return context;
|
|
2657
2532
|
}
|
|
2658
|
-
function
|
|
2659
|
-
|
|
2660
|
-
|
|
2533
|
+
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
2534
|
+
var firstProxy = null;
|
|
2535
|
+
var add = startAt ? false : true;
|
|
2536
|
+
if (isArray(plugins) && plugins[_DYN_LENGTH$2 ] > 0) {
|
|
2537
|
+
var lastProxy_1 = null;
|
|
2538
|
+
arrForEach(plugins, function (thePlugin) {
|
|
2539
|
+
if (!add && startAt === thePlugin) {
|
|
2540
|
+
add = true;
|
|
2541
|
+
}
|
|
2542
|
+
if (add && thePlugin && isFunction(thePlugin[STR_PROCESS_TELEMETRY ])) {
|
|
2543
|
+
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
2544
|
+
if (!firstProxy) {
|
|
2545
|
+
firstProxy = newProxy;
|
|
2546
|
+
}
|
|
2547
|
+
if (lastProxy_1) {
|
|
2548
|
+
lastProxy_1._setNext(newProxy);
|
|
2549
|
+
}
|
|
2550
|
+
lastProxy_1 = newProxy;
|
|
2551
|
+
}
|
|
2552
|
+
});
|
|
2661
2553
|
}
|
|
2554
|
+
if (startAt && !firstProxy) {
|
|
2555
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
2556
|
+
}
|
|
2557
|
+
return firstProxy;
|
|
2662
2558
|
}
|
|
2663
|
-
function
|
|
2664
|
-
|
|
2665
|
-
|
|
2559
|
+
function createTelemetryPluginProxy(plugin, config, core) {
|
|
2560
|
+
var nextProxy = null;
|
|
2561
|
+
var hasProcessTelemetry = isFunction(plugin[STR_PROCESS_TELEMETRY ]);
|
|
2562
|
+
var hasSetNext = isFunction(plugin[_DYN_SET_NEXT_PLUGIN ]);
|
|
2563
|
+
var chainId;
|
|
2564
|
+
if (plugin) {
|
|
2565
|
+
chainId = plugin[_DYN_IDENTIFIER ] + "-" + plugin[STR_PRIORITY ] + "-" + _chainId++;
|
|
2666
2566
|
}
|
|
2667
|
-
|
|
2668
|
-
|
|
2567
|
+
else {
|
|
2568
|
+
chainId = "Unknown-0-" + _chainId++;
|
|
2669
2569
|
}
|
|
2670
|
-
|
|
2671
|
-
|
|
2570
|
+
var proxyChain = {
|
|
2571
|
+
getPlugin: function () {
|
|
2572
|
+
return plugin;
|
|
2573
|
+
},
|
|
2574
|
+
getNext: function () {
|
|
2575
|
+
return nextProxy;
|
|
2576
|
+
},
|
|
2577
|
+
processTelemetry: _processTelemetry,
|
|
2578
|
+
unload: _unloadPlugin,
|
|
2579
|
+
update: _updatePlugin,
|
|
2580
|
+
_id: chainId,
|
|
2581
|
+
_setNext: function (nextPlugin) {
|
|
2582
|
+
nextProxy = nextPlugin;
|
|
2583
|
+
}
|
|
2584
|
+
};
|
|
2585
|
+
function _getTelCtx() {
|
|
2586
|
+
var itemCtx;
|
|
2587
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
2588
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
2589
|
+
}
|
|
2590
|
+
if (!itemCtx) {
|
|
2591
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
2592
|
+
}
|
|
2593
|
+
return itemCtx;
|
|
2672
2594
|
}
|
|
2673
|
-
|
|
2674
|
-
|
|
2595
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
2596
|
+
var hasRun = false;
|
|
2597
|
+
var identifier = plugin ? plugin[_DYN_IDENTIFIER ] : strTelemetryPluginChain;
|
|
2598
|
+
var hasRunContext = itemCtx[strHasRunFlags];
|
|
2599
|
+
if (!hasRunContext) {
|
|
2600
|
+
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
2601
|
+
}
|
|
2602
|
+
itemCtx.setNext(nextProxy);
|
|
2603
|
+
if (plugin) {
|
|
2604
|
+
doPerf(itemCtx[STR_CORE ](), function () { return identifier + ":" + name; }, function () {
|
|
2605
|
+
hasRunContext[chainId] = true;
|
|
2606
|
+
try {
|
|
2607
|
+
var nextId = nextProxy ? nextProxy._id : STR_EMPTY;
|
|
2608
|
+
if (nextId) {
|
|
2609
|
+
hasRunContext[nextId] = false;
|
|
2610
|
+
}
|
|
2611
|
+
hasRun = processPluginFn(itemCtx);
|
|
2612
|
+
}
|
|
2613
|
+
catch (error) {
|
|
2614
|
+
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
2615
|
+
if (hasNextRun) {
|
|
2616
|
+
hasRun = true;
|
|
2617
|
+
}
|
|
2618
|
+
if (!nextProxy || !hasNextRun) {
|
|
2619
|
+
_throwInternal(itemCtx[_DYN_DIAG_LOG ](), 1 , 73 , "Plugin [" + identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
}, details, isAsync);
|
|
2623
|
+
}
|
|
2624
|
+
return hasRun;
|
|
2675
2625
|
}
|
|
2676
|
-
|
|
2677
|
-
|
|
2626
|
+
function _processTelemetry(env, itemCtx) {
|
|
2627
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
2628
|
+
function _callProcessTelemetry(itemCtx) {
|
|
2629
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
2630
|
+
return false;
|
|
2631
|
+
}
|
|
2632
|
+
var pluginState = _getPluginState(plugin);
|
|
2633
|
+
if (pluginState[_DYN_TEARDOWN ] || pluginState[STR_DISABLED]) {
|
|
2634
|
+
return false;
|
|
2635
|
+
}
|
|
2636
|
+
if (hasSetNext) {
|
|
2637
|
+
plugin[_DYN_SET_NEXT_PLUGIN ](nextProxy);
|
|
2638
|
+
}
|
|
2639
|
+
plugin[STR_PROCESS_TELEMETRY ](env, itemCtx);
|
|
2640
|
+
return true;
|
|
2641
|
+
}
|
|
2642
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
2643
|
+
itemCtx[_DYN_PROCESS_NEXT ](env);
|
|
2644
|
+
}
|
|
2678
2645
|
}
|
|
2679
|
-
|
|
2680
|
-
|
|
2646
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
2647
|
+
function _callTeardown() {
|
|
2648
|
+
var hasRun = false;
|
|
2649
|
+
if (plugin) {
|
|
2650
|
+
var pluginState = _getPluginState(plugin);
|
|
2651
|
+
var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
|
|
2652
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
|
|
2653
|
+
pluginState[STR_CORE ] = null;
|
|
2654
|
+
pluginState[_DYN_TEARDOWN ] = true;
|
|
2655
|
+
pluginState[_DYN_IS_INITIALIZED ] = false;
|
|
2656
|
+
if (plugin[_DYN_TEARDOWN ] && plugin[_DYN_TEARDOWN ](unloadCtx, unloadState) === true) {
|
|
2657
|
+
hasRun = true;
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
return hasRun;
|
|
2662
|
+
}
|
|
2663
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState[_DYN_IS_ASYNC ])) {
|
|
2664
|
+
unloadCtx[_DYN_PROCESS_NEXT ](unloadState);
|
|
2665
|
+
}
|
|
2681
2666
|
}
|
|
2682
|
-
|
|
2683
|
-
|
|
2667
|
+
function _updatePlugin(updateCtx, updateState) {
|
|
2668
|
+
function _callUpdate() {
|
|
2669
|
+
var hasRun = false;
|
|
2670
|
+
if (plugin) {
|
|
2671
|
+
var pluginState = _getPluginState(plugin);
|
|
2672
|
+
var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
|
|
2673
|
+
if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
|
|
2674
|
+
if (plugin[_DYN_UPDATE$1 ] && plugin[_DYN_UPDATE$1 ](updateCtx, updateState) === true) {
|
|
2675
|
+
hasRun = true;
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
return hasRun;
|
|
2680
|
+
}
|
|
2681
|
+
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
2682
|
+
updateCtx[_DYN_PROCESS_NEXT ](updateState);
|
|
2683
|
+
}
|
|
2684
2684
|
}
|
|
2685
|
-
return
|
|
2685
|
+
return objFreeze(proxyChain);
|
|
2686
2686
|
}
|
|
2687
2687
|
|
|
2688
2688
|
function createUnloadHandlerContainer() {
|