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