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