@microsoft/applicationinsights-core-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-06
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-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +2440 -1199
- package/browser/applicationinsights-core-js.js.map +1 -1
- package/browser/applicationinsights-core-js.min.js +2 -2
- package/browser/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.api.json +16710 -8876
- package/dist/applicationinsights-core-js.api.md +465 -140
- package/dist/applicationinsights-core-js.d.ts +856 -217
- package/dist/applicationinsights-core-js.js +2440 -1199
- package/dist/applicationinsights-core-js.js.map +1 -1
- package/dist/applicationinsights-core-js.min.js +2 -2
- package/dist/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.rollup.d.ts +856 -217
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +4 -72
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +496 -99
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +120 -21
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +202 -87
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +4 -4
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +7 -148
- package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +93 -0
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -0
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +45 -12
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +13 -12
- package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +477 -0
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -0
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +80 -86
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +3 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +28 -0
- package/dist-esm/JavaScriptSDK/InternalConstants.js.map +1 -0
- package/dist-esm/JavaScriptSDK/NotificationManager.js +37 -42
- package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +430 -119
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +30 -4
- package/dist-esm/JavaScriptSDK/RandomHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +60 -14
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +81 -0
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -0
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +33 -0
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +51 -0
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +10 -9
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +90 -96
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +8 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +8 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -2
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +6 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -2
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +6 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js.map +1 -0
- package/dist-esm/applicationinsights-core-js.js +13 -7
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +2 -2
- package/src/JavaScriptSDK/AppInsightsCore.ts +4 -105
- package/src/JavaScriptSDK/BaseCore.ts +696 -120
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +205 -31
- package/src/JavaScriptSDK/ChannelController.ts +242 -103
- package/src/JavaScriptSDK/CookieMgr.ts +7 -5
- package/src/JavaScriptSDK/CoreUtils.ts +8 -172
- package/src/JavaScriptSDK/DataCacheHelper.ts +106 -0
- package/src/JavaScriptSDK/DiagnosticLogger.ts +49 -12
- package/src/JavaScriptSDK/EnvUtils.ts +13 -12
- package/src/JavaScriptSDK/EventHelpers.ts +550 -0
- package/src/JavaScriptSDK/HelperFuncs.ts +114 -97
- package/src/JavaScriptSDK/InstrumentHooks.ts +4 -2
- package/src/JavaScriptSDK/InternalConstants.ts +26 -0
- package/src/JavaScriptSDK/NotificationManager.ts +34 -37
- package/src/JavaScriptSDK/PerfManager.ts +4 -7
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +543 -134
- package/src/JavaScriptSDK/RandomHelper.ts +35 -3
- package/src/JavaScriptSDK/TelemetryHelpers.ts +83 -21
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +111 -0
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +46 -0
- package/src/JavaScriptSDK.Enums/EnumHelperFuncs.ts +56 -0
- package/src/JavaScriptSDK.Enums/EventsDiscardedReason.ts +48 -8
- package/src/JavaScriptSDK.Enums/LoggingEnums.ts +183 -87
- package/src/JavaScriptSDK.Enums/SendRequestReason.ts +5 -0
- package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +27 -0
- package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +27 -0
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +82 -2
- package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +16 -5
- package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +16 -6
- package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +94 -14
- package/src/JavaScriptSDK.Interfaces/ITelemetryInitializers.ts +16 -0
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +28 -10
- package/src/JavaScriptSDK.Interfaces/ITelemetryPluginChain.ts +9 -11
- package/src/JavaScriptSDK.Interfaces/ITelemetryUnloadState.ts +10 -0
- package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +34 -0
- package/src/JavaScriptSDK.Interfaces/IUnloadableComponent.ts +17 -0
- package/types/JavaScriptSDK/AppInsightsCore.d.ts +0 -21
- package/types/JavaScriptSDK/BaseCore.d.ts +81 -3
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +53 -10
- package/types/JavaScriptSDK/ChannelController.d.ts +16 -17
- package/types/JavaScriptSDK/CoreUtils.d.ts +1 -48
- package/types/JavaScriptSDK/DataCacheHelper.d.ts +13 -0
- package/types/JavaScriptSDK/DiagnosticLogger.d.ts +23 -0
- package/types/JavaScriptSDK/EventHelpers.d.ts +154 -0
- package/types/JavaScriptSDK/HelperFuncs.d.ts +37 -32
- package/types/JavaScriptSDK/InternalConstants.d.ts +20 -0
- package/types/JavaScriptSDK/PerfManager.d.ts +1 -1
- package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +69 -6
- package/types/JavaScriptSDK/RandomHelper.d.ts +6 -0
- package/types/JavaScriptSDK/TelemetryHelpers.d.ts +23 -3
- package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +16 -0
- package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +11 -0
- package/types/JavaScriptSDK.Enums/EnumHelperFuncs.d.ts +34 -0
- package/types/JavaScriptSDK.Enums/EventsDiscardedReason.d.ts +14 -9
- package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +89 -86
- package/types/JavaScriptSDK.Enums/SendRequestReason.d.ts +4 -0
- package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +21 -0
- package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +20 -0
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +72 -1
- package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +16 -5
- package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +9 -0
- package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +82 -11
- package/types/JavaScriptSDK.Interfaces/ITelemetryInitializers.d.ts +13 -0
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +25 -8
- package/types/JavaScriptSDK.Interfaces/ITelemetryPluginChain.d.ts +9 -10
- package/types/JavaScriptSDK.Interfaces/ITelemetryUnloadState.d.ts +6 -0
- package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +22 -0
- package/types/JavaScriptSDK.Interfaces/IUnloadableComponent.d.ts +13 -0
- package/types/applicationinsights-core-js.d.ts +20 -10
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js +0 -76
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js.map +0 -1
- package/src/JavaScriptSDK/TelemetryPluginChain.ts +0 -120
- package/types/JavaScriptSDK/TelemetryPluginChain.d.ts +0 -32
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 2.8.0-nightly.
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 2.8.0-nightly.2204-06
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -10,15 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
var MinChannelPriorty = 100;
|
|
12
12
|
|
|
13
|
-
var EventsDiscardedReason = {
|
|
14
|
-
Unknown: 0,
|
|
15
|
-
NonRetryableStatus: 1,
|
|
16
|
-
InvalidEvent: 2,
|
|
17
|
-
SizeLimitExceeded: 3,
|
|
18
|
-
KillSwitch: 4,
|
|
19
|
-
QueueFull: 5
|
|
20
|
-
};
|
|
21
|
-
|
|
22
13
|
var strShimFunction = "function";
|
|
23
14
|
var strShimObject = "object";
|
|
24
15
|
var strShimUndefined = "undefined";
|
|
@@ -74,7 +65,9 @@
|
|
|
74
65
|
(getGlobal() || {})["Reflect"];
|
|
75
66
|
var extendStaticsFn = function (d, b) {
|
|
76
67
|
extendStaticsFn = ObjClass["setPrototypeOf"] ||
|
|
77
|
-
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
68
|
+
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
69
|
+
d.__proto__ = b;
|
|
70
|
+
}) ||
|
|
78
71
|
function (d, b) {
|
|
79
72
|
for (var p in b) {
|
|
80
73
|
if (b[strShimHasOwnProperty](p)) {
|
|
@@ -89,7 +82,9 @@
|
|
|
89
82
|
throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
90
83
|
}
|
|
91
84
|
extendStaticsFn(d, b);
|
|
92
|
-
function __() {
|
|
85
|
+
function __() {
|
|
86
|
+
this.constructor = d;
|
|
87
|
+
}
|
|
93
88
|
d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
|
|
94
89
|
}
|
|
95
90
|
function __spreadArrayFn(to, from) {
|
|
@@ -99,342 +94,27 @@
|
|
|
99
94
|
return to;
|
|
100
95
|
}
|
|
101
96
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var
|
|
107
|
-
var
|
|
108
|
-
var
|
|
109
|
-
var
|
|
110
|
-
var
|
|
111
|
-
var
|
|
112
|
-
var
|
|
113
|
-
var
|
|
114
|
-
var
|
|
115
|
-
var
|
|
116
|
-
var
|
|
117
|
-
var
|
|
118
|
-
var
|
|
119
|
-
var
|
|
120
|
-
var
|
|
121
|
-
var
|
|
122
|
-
var _dynamicNames = 0;
|
|
123
|
-
function _hasOwnProperty(obj, prop) {
|
|
124
|
-
return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
|
|
125
|
-
}
|
|
126
|
-
function _isObjectOrArrayPrototype(target) {
|
|
127
|
-
return target && (target === Obj[Prototype] || target === Array[Prototype]);
|
|
128
|
-
}
|
|
129
|
-
function _isObjectArrayOrFunctionPrototype(target) {
|
|
130
|
-
return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
|
|
131
|
-
}
|
|
132
|
-
function _getObjProto$1(target) {
|
|
133
|
-
if (target) {
|
|
134
|
-
if (_objGetPrototypeOf$1) {
|
|
135
|
-
return _objGetPrototypeOf$1(target);
|
|
136
|
-
}
|
|
137
|
-
var newProto = target[str__Proto$1] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
138
|
-
if (newProto) {
|
|
139
|
-
return newProto;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return null;
|
|
143
|
-
}
|
|
144
|
-
function _forEachProp(target, func) {
|
|
145
|
-
var props = [];
|
|
146
|
-
var getOwnProps = Obj["getOwnPropertyNames"];
|
|
147
|
-
if (getOwnProps) {
|
|
148
|
-
props = getOwnProps(target);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
for (var name_1 in target) {
|
|
152
|
-
if (typeof name_1 === "string" && _hasOwnProperty(target, name_1)) {
|
|
153
|
-
props.push(name_1);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (props && props.length > 0) {
|
|
158
|
-
for (var lp = 0; lp < props.length; lp++) {
|
|
159
|
-
func(props[lp]);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
function _isDynamicCandidate(target, funcName, skipOwn) {
|
|
164
|
-
return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));
|
|
165
|
-
}
|
|
166
|
-
function _throwTypeError(message) {
|
|
167
|
-
throw new TypeError("DynamicProto: " + message);
|
|
168
|
-
}
|
|
169
|
-
function _getInstanceFuncs(thisTarget) {
|
|
170
|
-
var instFuncs = {};
|
|
171
|
-
_forEachProp(thisTarget, function (name) {
|
|
172
|
-
if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {
|
|
173
|
-
instFuncs[name] = thisTarget[name];
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
return instFuncs;
|
|
177
|
-
}
|
|
178
|
-
function _hasVisited(values, value) {
|
|
179
|
-
for (var lp = values.length - 1; lp >= 0; lp--) {
|
|
180
|
-
if (values[lp] === value) {
|
|
181
|
-
return true;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
function _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {
|
|
187
|
-
function _instFuncProxy(target, funcHost, funcName) {
|
|
188
|
-
var theFunc = funcHost[funcName];
|
|
189
|
-
if (theFunc[DynProxyTag] && useBaseInst) {
|
|
190
|
-
var instFuncTable = target[DynInstFuncTable] || {};
|
|
191
|
-
if (instFuncTable[DynAllowInstChkTag] !== false) {
|
|
192
|
-
theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
return function () {
|
|
196
|
-
return theFunc.apply(target, arguments);
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
var baseFuncs = {};
|
|
200
|
-
_forEachProp(instFuncs, function (name) {
|
|
201
|
-
baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
|
|
202
|
-
});
|
|
203
|
-
var baseProto = _getObjProto$1(classProto);
|
|
204
|
-
var visited = [];
|
|
205
|
-
while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
|
|
206
|
-
_forEachProp(baseProto, function (name) {
|
|
207
|
-
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf$1)) {
|
|
208
|
-
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
visited.push(baseProto);
|
|
212
|
-
baseProto = _getObjProto$1(baseProto);
|
|
213
|
-
}
|
|
214
|
-
return baseFuncs;
|
|
215
|
-
}
|
|
216
|
-
function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
|
|
217
|
-
var instFunc = null;
|
|
218
|
-
if (target && _hasOwnProperty(proto, DynClassName)) {
|
|
219
|
-
var instFuncTable = target[DynInstFuncTable] || {};
|
|
220
|
-
instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
|
|
221
|
-
if (!instFunc) {
|
|
222
|
-
_throwTypeError("Missing [" + funcName + "] " + strFunction);
|
|
223
|
-
}
|
|
224
|
-
if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
|
|
225
|
-
var canAddInst = !_hasOwnProperty(target, funcName);
|
|
226
|
-
var objProto = _getObjProto$1(target);
|
|
227
|
-
var visited = [];
|
|
228
|
-
while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
|
|
229
|
-
var protoFunc = objProto[funcName];
|
|
230
|
-
if (protoFunc) {
|
|
231
|
-
canAddInst = (protoFunc === currentDynProtoProxy);
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
visited.push(objProto);
|
|
235
|
-
objProto = _getObjProto$1(objProto);
|
|
236
|
-
}
|
|
237
|
-
try {
|
|
238
|
-
if (canAddInst) {
|
|
239
|
-
target[funcName] = instFunc;
|
|
240
|
-
}
|
|
241
|
-
instFunc[DynInstChkTag] = 1;
|
|
242
|
-
}
|
|
243
|
-
catch (e) {
|
|
244
|
-
instFuncTable[DynAllowInstChkTag] = false;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return instFunc;
|
|
249
|
-
}
|
|
250
|
-
function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
|
|
251
|
-
var protoFunc = proto[funcName];
|
|
252
|
-
if (protoFunc === currentDynProtoProxy) {
|
|
253
|
-
protoFunc = _getObjProto$1(proto)[funcName];
|
|
254
|
-
}
|
|
255
|
-
if (typeof protoFunc !== strFunction) {
|
|
256
|
-
_throwTypeError("[" + funcName + "] is not a " + strFunction);
|
|
257
|
-
}
|
|
258
|
-
return protoFunc;
|
|
259
|
-
}
|
|
260
|
-
function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
|
|
261
|
-
function _createDynamicPrototype(proto, funcName) {
|
|
262
|
-
var dynProtoProxy = function () {
|
|
263
|
-
var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
|
|
264
|
-
return instFunc.apply(this, arguments);
|
|
265
|
-
};
|
|
266
|
-
dynProtoProxy[DynProxyTag] = 1;
|
|
267
|
-
return dynProtoProxy;
|
|
268
|
-
}
|
|
269
|
-
if (!_isObjectOrArrayPrototype(proto)) {
|
|
270
|
-
var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
|
|
271
|
-
var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
|
|
272
|
-
if (instFuncTable[DynAllowInstChkTag] !== false) {
|
|
273
|
-
instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
|
|
274
|
-
}
|
|
275
|
-
_forEachProp(target, function (name) {
|
|
276
|
-
if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
|
|
277
|
-
instFuncs_1[name] = target[name];
|
|
278
|
-
delete target[name];
|
|
279
|
-
if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
|
|
280
|
-
proto[name] = _createDynamicPrototype(proto, name);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
function _checkPrototype(classProto, thisTarget) {
|
|
287
|
-
if (_objGetPrototypeOf$1) {
|
|
288
|
-
var visited = [];
|
|
289
|
-
var thisProto = _getObjProto$1(thisTarget);
|
|
290
|
-
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
291
|
-
if (thisProto === classProto) {
|
|
292
|
-
return true;
|
|
293
|
-
}
|
|
294
|
-
visited.push(thisProto);
|
|
295
|
-
thisProto = _getObjProto$1(thisProto);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
return false;
|
|
299
|
-
}
|
|
300
|
-
function _getObjName(target, unknownValue) {
|
|
301
|
-
if (_hasOwnProperty(target, Prototype)) {
|
|
302
|
-
return target.name || unknownValue || UnknownValue;
|
|
303
|
-
}
|
|
304
|
-
return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
|
|
305
|
-
}
|
|
306
|
-
function dynamicProto(theClass, target, delegateFunc, options) {
|
|
307
|
-
if (!_hasOwnProperty(theClass, Prototype)) {
|
|
308
|
-
_throwTypeError("theClass is an invalid class definition.");
|
|
309
|
-
}
|
|
310
|
-
var classProto = theClass[Prototype];
|
|
311
|
-
if (!_checkPrototype(classProto, target)) {
|
|
312
|
-
_throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
|
|
313
|
-
}
|
|
314
|
-
var className = null;
|
|
315
|
-
if (_hasOwnProperty(classProto, DynClassName)) {
|
|
316
|
-
className = classProto[DynClassName];
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
|
|
320
|
-
_dynamicNames++;
|
|
321
|
-
classProto[DynClassName] = className;
|
|
322
|
-
}
|
|
323
|
-
var perfOptions = dynamicProto[DynProtoDefaultOptions];
|
|
324
|
-
var useBaseInst = !!perfOptions[strUseBaseInst];
|
|
325
|
-
if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
|
|
326
|
-
useBaseInst = !!options[strUseBaseInst];
|
|
327
|
-
}
|
|
328
|
-
var instFuncs = _getInstanceFuncs(target);
|
|
329
|
-
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
330
|
-
delegateFunc(target, baseFuncs);
|
|
331
|
-
var setInstanceFunc = !!_objGetPrototypeOf$1 && !!perfOptions[strSetInstFuncs];
|
|
332
|
-
if (setInstanceFunc && options) {
|
|
333
|
-
setInstanceFunc = !!options[strSetInstFuncs];
|
|
334
|
-
}
|
|
335
|
-
_populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
|
|
336
|
-
}
|
|
337
|
-
var perfDefaults = {
|
|
338
|
-
setInstFuncs: true,
|
|
339
|
-
useBaseInst: true
|
|
340
|
-
};
|
|
341
|
-
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
342
|
-
|
|
343
|
-
exports.LoggingSeverity = void 0;
|
|
344
|
-
(function (LoggingSeverity) {
|
|
345
|
-
LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
|
|
346
|
-
LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
|
|
347
|
-
})(exports.LoggingSeverity || (exports.LoggingSeverity = {}));
|
|
348
|
-
var _InternalMessageId = {
|
|
349
|
-
BrowserDoesNotSupportLocalStorage: 0,
|
|
350
|
-
BrowserCannotReadLocalStorage: 1,
|
|
351
|
-
BrowserCannotReadSessionStorage: 2,
|
|
352
|
-
BrowserCannotWriteLocalStorage: 3,
|
|
353
|
-
BrowserCannotWriteSessionStorage: 4,
|
|
354
|
-
BrowserFailedRemovalFromLocalStorage: 5,
|
|
355
|
-
BrowserFailedRemovalFromSessionStorage: 6,
|
|
356
|
-
CannotSendEmptyTelemetry: 7,
|
|
357
|
-
ClientPerformanceMathError: 8,
|
|
358
|
-
ErrorParsingAISessionCookie: 9,
|
|
359
|
-
ErrorPVCalc: 10,
|
|
360
|
-
ExceptionWhileLoggingError: 11,
|
|
361
|
-
FailedAddingTelemetryToBuffer: 12,
|
|
362
|
-
FailedMonitorAjaxAbort: 13,
|
|
363
|
-
FailedMonitorAjaxDur: 14,
|
|
364
|
-
FailedMonitorAjaxOpen: 15,
|
|
365
|
-
FailedMonitorAjaxRSC: 16,
|
|
366
|
-
FailedMonitorAjaxSend: 17,
|
|
367
|
-
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
368
|
-
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
369
|
-
FailedToSendQueuedTelemetry: 20,
|
|
370
|
-
FailedToReportDataLoss: 21,
|
|
371
|
-
FlushFailed: 22,
|
|
372
|
-
MessageLimitPerPVExceeded: 23,
|
|
373
|
-
MissingRequiredFieldSpecification: 24,
|
|
374
|
-
NavigationTimingNotSupported: 25,
|
|
375
|
-
OnError: 26,
|
|
376
|
-
SessionRenewalDateIsZero: 27,
|
|
377
|
-
SenderNotInitialized: 28,
|
|
378
|
-
StartTrackEventFailed: 29,
|
|
379
|
-
StopTrackEventFailed: 30,
|
|
380
|
-
StartTrackFailed: 31,
|
|
381
|
-
StopTrackFailed: 32,
|
|
382
|
-
TelemetrySampledAndNotSent: 33,
|
|
383
|
-
TrackEventFailed: 34,
|
|
384
|
-
TrackExceptionFailed: 35,
|
|
385
|
-
TrackMetricFailed: 36,
|
|
386
|
-
TrackPVFailed: 37,
|
|
387
|
-
TrackPVFailedCalc: 38,
|
|
388
|
-
TrackTraceFailed: 39,
|
|
389
|
-
TransmissionFailed: 40,
|
|
390
|
-
FailedToSetStorageBuffer: 41,
|
|
391
|
-
FailedToRestoreStorageBuffer: 42,
|
|
392
|
-
InvalidBackendResponse: 43,
|
|
393
|
-
FailedToFixDepricatedValues: 44,
|
|
394
|
-
InvalidDurationValue: 45,
|
|
395
|
-
TelemetryEnvelopeInvalid: 46,
|
|
396
|
-
CreateEnvelopeError: 47,
|
|
397
|
-
CannotSerializeObject: 48,
|
|
398
|
-
CannotSerializeObjectNonSerializable: 49,
|
|
399
|
-
CircularReferenceDetected: 50,
|
|
400
|
-
ClearAuthContextFailed: 51,
|
|
401
|
-
ExceptionTruncated: 52,
|
|
402
|
-
IllegalCharsInName: 53,
|
|
403
|
-
ItemNotInArray: 54,
|
|
404
|
-
MaxAjaxPerPVExceeded: 55,
|
|
405
|
-
MessageTruncated: 56,
|
|
406
|
-
NameTooLong: 57,
|
|
407
|
-
SampleRateOutOfRange: 58,
|
|
408
|
-
SetAuthContextFailed: 59,
|
|
409
|
-
SetAuthContextFailedAccountName: 60,
|
|
410
|
-
StringValueTooLong: 61,
|
|
411
|
-
StartCalledMoreThanOnce: 62,
|
|
412
|
-
StopCalledWithoutStart: 63,
|
|
413
|
-
TelemetryInitializerFailed: 64,
|
|
414
|
-
TrackArgumentsNotSpecified: 65,
|
|
415
|
-
UrlTooLong: 66,
|
|
416
|
-
SessionStorageBufferFull: 67,
|
|
417
|
-
CannotAccessCookie: 68,
|
|
418
|
-
IdTooLong: 69,
|
|
419
|
-
InvalidEvent: 70,
|
|
420
|
-
FailedMonitorAjaxSetRequestHeader: 71,
|
|
421
|
-
SendBrowserInfoOnUserInit: 72,
|
|
422
|
-
PluginException: 73,
|
|
423
|
-
NotificationException: 74,
|
|
424
|
-
SnippetScriptLoadFailure: 99,
|
|
425
|
-
InvalidInstrumentationKey: 100,
|
|
426
|
-
CannotParseAiBlobValue: 101,
|
|
427
|
-
InvalidContentBlob: 102,
|
|
428
|
-
TrackPageActionEventFailed: 103,
|
|
429
|
-
FailedAddingCustomDefinedRequestContext: 104,
|
|
430
|
-
InMemoryStorageBufferFull: 105
|
|
431
|
-
};
|
|
97
|
+
var strEmpty = "";
|
|
98
|
+
var strProcessTelemetry = "processTelemetry";
|
|
99
|
+
var strPriority = "priority";
|
|
100
|
+
var strSetNextPlugin = "setNextPlugin";
|
|
101
|
+
var strIsInitialized = "isInitialized";
|
|
102
|
+
var strTeardown = "teardown";
|
|
103
|
+
var strCore = "core";
|
|
104
|
+
var strUpdate = "update";
|
|
105
|
+
var strDisabled = "disabled";
|
|
106
|
+
var strDoTeardown = "_doTeardown";
|
|
107
|
+
var strProcessNext = "processNext";
|
|
108
|
+
var strResume = "resume";
|
|
109
|
+
var strPause = "pause";
|
|
110
|
+
var strNotificationListener = "NotificationListener";
|
|
111
|
+
var strAddNotificationListener = "add" + strNotificationListener;
|
|
112
|
+
var strRemoveNotificationListener = "remove" + strNotificationListener;
|
|
113
|
+
var strEventsSent = "eventsSent";
|
|
114
|
+
var strEventsDiscarded = "eventsDiscarded";
|
|
115
|
+
var strEventsSendRequest = "eventsSendRequest";
|
|
116
|
+
var strPerfEvent = "perfEvent";
|
|
432
117
|
|
|
433
|
-
var strOnPrefix = "on";
|
|
434
|
-
var strAttachEvent = "attachEvent";
|
|
435
|
-
var strAddEventHelper = "addEventListener";
|
|
436
|
-
var strDetachEvent = "detachEvent";
|
|
437
|
-
var strRemoveEventListener = "removeEventListener";
|
|
438
118
|
var strToISOString = "toISOString";
|
|
439
119
|
var cStrEndsWith = "endsWith";
|
|
440
120
|
var cStrStartsWith = "startsWith";
|
|
@@ -443,9 +123,9 @@
|
|
|
443
123
|
var strReduce = "reduce";
|
|
444
124
|
var cStrTrim = "trim";
|
|
445
125
|
var strToString = "toString";
|
|
446
|
-
var str__Proto = "__proto__";
|
|
126
|
+
var str__Proto$1 = "__proto__";
|
|
447
127
|
var strConstructor = "constructor";
|
|
448
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
128
|
+
var _objDefineProperty$1 = ObjDefineProperty;
|
|
449
129
|
var _objFreeze = ObjClass.freeze;
|
|
450
130
|
var _objSeal = ObjClass.seal;
|
|
451
131
|
var _objKeys = ObjClass.keys;
|
|
@@ -458,23 +138,26 @@
|
|
|
458
138
|
var _isArray = Array.isArray;
|
|
459
139
|
var _objToString = ObjProto[strToString];
|
|
460
140
|
var _fnToString = ObjHasOwnProperty[strToString];
|
|
461
|
-
_fnToString.call(ObjClass);
|
|
141
|
+
var _objFunctionString = _fnToString.call(ObjClass);
|
|
462
142
|
var rCamelCase = /-([a-z])/g;
|
|
463
143
|
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
464
144
|
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
465
|
-
var _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
466
|
-
function _getObjProto(target) {
|
|
145
|
+
var _objGetPrototypeOf$1 = Object["getPrototypeOf"];
|
|
146
|
+
function _getObjProto$1(target) {
|
|
467
147
|
if (target) {
|
|
468
|
-
if (_objGetPrototypeOf) {
|
|
469
|
-
return _objGetPrototypeOf(target);
|
|
148
|
+
if (_objGetPrototypeOf$1) {
|
|
149
|
+
return _objGetPrototypeOf$1(target);
|
|
470
150
|
}
|
|
471
|
-
var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
|
|
151
|
+
var newProto = target[str__Proto$1] || target[strShimPrototype] || target[strConstructor];
|
|
472
152
|
if (newProto) {
|
|
473
153
|
return newProto;
|
|
474
154
|
}
|
|
475
155
|
}
|
|
476
156
|
return null;
|
|
477
157
|
}
|
|
158
|
+
function objToString(obj) {
|
|
159
|
+
return _objToString.call(obj);
|
|
160
|
+
}
|
|
478
161
|
function isTypeof(value, theType) {
|
|
479
162
|
return typeof value === theType;
|
|
480
163
|
}
|
|
@@ -499,40 +182,6 @@
|
|
|
499
182
|
function isFunction(value) {
|
|
500
183
|
return !!(value && typeof value === strShimFunction);
|
|
501
184
|
}
|
|
502
|
-
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
503
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
504
|
-
var result = false;
|
|
505
|
-
if (!isNullOrUndefined(obj)) {
|
|
506
|
-
try {
|
|
507
|
-
if (!isNullOrUndefined(obj[strAddEventHelper])) {
|
|
508
|
-
obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
|
|
509
|
-
result = true;
|
|
510
|
-
}
|
|
511
|
-
else if (!isNullOrUndefined(obj[strAttachEvent])) {
|
|
512
|
-
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
513
|
-
result = true;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
catch (e) {
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
return result;
|
|
520
|
-
}
|
|
521
|
-
function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
522
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
523
|
-
if (!isNullOrUndefined(obj)) {
|
|
524
|
-
try {
|
|
525
|
-
if (!isNullOrUndefined(obj[strRemoveEventListener])) {
|
|
526
|
-
obj[strRemoveEventListener](eventNameWithoutOn, handlerRef, useCapture);
|
|
527
|
-
}
|
|
528
|
-
else if (!isNullOrUndefined(obj[strDetachEvent])) {
|
|
529
|
-
obj[strDetachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
catch (e) {
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
185
|
function normalizeJsName(name) {
|
|
537
186
|
var value = name;
|
|
538
187
|
if (value && isString(value)) {
|
|
@@ -626,6 +275,22 @@
|
|
|
626
275
|
function isSymbol(value) {
|
|
627
276
|
return typeof value === "symbol";
|
|
628
277
|
}
|
|
278
|
+
function isPlainObject(value) {
|
|
279
|
+
var result = false;
|
|
280
|
+
if (value && typeof value === "object") {
|
|
281
|
+
var proto = _objGetPrototypeOf$1 ? _objGetPrototypeOf$1(value) : _getObjProto$1(value);
|
|
282
|
+
if (!proto) {
|
|
283
|
+
result = true;
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
|
|
287
|
+
proto = proto[strConstructor];
|
|
288
|
+
}
|
|
289
|
+
result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return result;
|
|
293
|
+
}
|
|
629
294
|
function toISOString(date) {
|
|
630
295
|
if (date) {
|
|
631
296
|
return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
|
|
@@ -771,7 +436,7 @@
|
|
|
771
436
|
return result;
|
|
772
437
|
}
|
|
773
438
|
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
774
|
-
if (_objDefineProperty) {
|
|
439
|
+
if (_objDefineProperty$1) {
|
|
775
440
|
try {
|
|
776
441
|
var descriptor = {
|
|
777
442
|
enumerable: true,
|
|
@@ -783,7 +448,7 @@
|
|
|
783
448
|
if (setProp) {
|
|
784
449
|
descriptor.set = setProp;
|
|
785
450
|
}
|
|
786
|
-
_objDefineProperty(target, prop, descriptor);
|
|
451
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
787
452
|
return true;
|
|
788
453
|
}
|
|
789
454
|
catch (e) {
|
|
@@ -794,6 +459,16 @@
|
|
|
794
459
|
function _doNothing(value) {
|
|
795
460
|
return value;
|
|
796
461
|
}
|
|
462
|
+
function deepFreeze(obj) {
|
|
463
|
+
if (_objFreeze) {
|
|
464
|
+
objForEachKey(obj, function (name, value) {
|
|
465
|
+
if (isArray(value) || isObject(value)) {
|
|
466
|
+
_objFreeze(value);
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
return objFreeze(obj);
|
|
471
|
+
}
|
|
797
472
|
var objFreeze = _objFreeze || _doNothing;
|
|
798
473
|
var objSeal = _objSeal || _doNothing;
|
|
799
474
|
function dateNow() {
|
|
@@ -804,7 +479,7 @@
|
|
|
804
479
|
if (isError(object)) {
|
|
805
480
|
return object.name;
|
|
806
481
|
}
|
|
807
|
-
return
|
|
482
|
+
return strEmpty;
|
|
808
483
|
}
|
|
809
484
|
function setValue(target, field, value, valChk, srcChk) {
|
|
810
485
|
var theValue = value;
|
|
@@ -840,19 +515,33 @@
|
|
|
840
515
|
function throwError(message) {
|
|
841
516
|
throw new Error(message);
|
|
842
517
|
}
|
|
518
|
+
function _createProxyFunction(source, funcName) {
|
|
519
|
+
var srcFunc = null;
|
|
520
|
+
var src = null;
|
|
521
|
+
if (isFunction(source)) {
|
|
522
|
+
srcFunc = source;
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
src = source;
|
|
526
|
+
}
|
|
527
|
+
return function () {
|
|
528
|
+
var originalArguments = arguments;
|
|
529
|
+
if (srcFunc) {
|
|
530
|
+
src = srcFunc();
|
|
531
|
+
}
|
|
532
|
+
if (src) {
|
|
533
|
+
return src[funcName].apply(src, originalArguments);
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
}
|
|
843
537
|
function proxyAssign(target, source, chkSet) {
|
|
844
|
-
if (target && source &&
|
|
538
|
+
if (target && source && isObject(target) && isObject(source)) {
|
|
845
539
|
var _loop_1 = function (field) {
|
|
846
540
|
if (isString(field)) {
|
|
847
541
|
var value = source[field];
|
|
848
542
|
if (isFunction(value)) {
|
|
849
543
|
if (!chkSet || chkSet(field, true, source, target)) {
|
|
850
|
-
target[field] = (
|
|
851
|
-
return function () {
|
|
852
|
-
var originalArguments = arguments;
|
|
853
|
-
return source[funcName].apply(source, originalArguments);
|
|
854
|
-
};
|
|
855
|
-
})(field);
|
|
544
|
+
target[field] = _createProxyFunction(source, field);
|
|
856
545
|
}
|
|
857
546
|
}
|
|
858
547
|
else if (!chkSet || chkSet(field, false, source, target)) {
|
|
@@ -875,6 +564,23 @@
|
|
|
875
564
|
}
|
|
876
565
|
return target;
|
|
877
566
|
}
|
|
567
|
+
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
568
|
+
if (target && name && source) {
|
|
569
|
+
if (overwriteTarget !== false || isUndefined(target[name])) {
|
|
570
|
+
target[name] = _createProxyFunction(source, theFunc);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {
|
|
575
|
+
if (target && source && isObject(target) && isArray(functionsToProxy)) {
|
|
576
|
+
arrForEach(functionsToProxy, function (theFuncName) {
|
|
577
|
+
if (isString(theFuncName)) {
|
|
578
|
+
proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
return target;
|
|
583
|
+
}
|
|
878
584
|
function createClassFromInterface(defaults) {
|
|
879
585
|
return /** @class */ (function () {
|
|
880
586
|
function class_1() {
|
|
@@ -894,159 +600,479 @@
|
|
|
894
600
|
}
|
|
895
601
|
return theObject;
|
|
896
602
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
if (theClass) {
|
|
920
|
-
try {
|
|
921
|
-
supported = property in theClass;
|
|
922
|
-
if (!supported) {
|
|
923
|
-
var proto = theClass[strShimPrototype];
|
|
924
|
-
if (proto) {
|
|
925
|
-
supported = property in proto;
|
|
926
|
-
}
|
|
603
|
+
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
604
|
+
var theArgs = arguments;
|
|
605
|
+
var extended = theArgs[0] || {};
|
|
606
|
+
var argLen = theArgs.length;
|
|
607
|
+
var deep = false;
|
|
608
|
+
var idx = 1;
|
|
609
|
+
if (argLen > 0 && isBoolean(extended)) {
|
|
610
|
+
deep = extended;
|
|
611
|
+
extended = theArgs[idx] || {};
|
|
612
|
+
idx++;
|
|
613
|
+
}
|
|
614
|
+
if (!isObject(extended)) {
|
|
615
|
+
extended = {};
|
|
616
|
+
}
|
|
617
|
+
for (; idx < argLen; idx++) {
|
|
618
|
+
var arg = theArgs[idx];
|
|
619
|
+
var isArgArray = isArray(arg);
|
|
620
|
+
var isArgObj = isObject(arg);
|
|
621
|
+
for (var prop in arg) {
|
|
622
|
+
var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
|
|
623
|
+
if (!propOk) {
|
|
624
|
+
continue;
|
|
927
625
|
}
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
626
|
+
var newValue = arg[prop];
|
|
627
|
+
var isNewArray = void 0;
|
|
628
|
+
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
629
|
+
var clone = extended[prop];
|
|
630
|
+
if (isNewArray) {
|
|
631
|
+
if (!isArray(clone)) {
|
|
632
|
+
clone = [];
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
else if (!isPlainObject(clone)) {
|
|
636
|
+
clone = {};
|
|
637
|
+
}
|
|
638
|
+
newValue = objExtend(deep, clone, newValue);
|
|
935
639
|
}
|
|
936
|
-
|
|
640
|
+
if (newValue !== undefined) {
|
|
641
|
+
extended[prop] = newValue;
|
|
937
642
|
}
|
|
938
643
|
}
|
|
939
644
|
}
|
|
940
|
-
return
|
|
941
|
-
}
|
|
942
|
-
function setEnableEnvMocks(enabled) {
|
|
943
|
-
_enableMocks = enabled;
|
|
645
|
+
return extended;
|
|
944
646
|
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
return null;
|
|
647
|
+
|
|
648
|
+
function createEnumStyle(values) {
|
|
649
|
+
var enumClass = {};
|
|
650
|
+
objForEachKey(values, function (field, value) {
|
|
651
|
+
enumClass[field] = value;
|
|
652
|
+
enumClass[value] = field;
|
|
653
|
+
});
|
|
654
|
+
return deepFreeze(enumClass);
|
|
954
655
|
}
|
|
955
|
-
function
|
|
956
|
-
|
|
656
|
+
function createEnumMap(values) {
|
|
657
|
+
var mapClass = {};
|
|
658
|
+
objForEachKey(values, function (field, value) {
|
|
659
|
+
mapClass[field] = field;
|
|
660
|
+
mapClass[value] = field;
|
|
661
|
+
});
|
|
662
|
+
return deepFreeze(mapClass);
|
|
957
663
|
}
|
|
958
|
-
function
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
664
|
+
function createValueMap(values) {
|
|
665
|
+
var mapClass = {};
|
|
666
|
+
objForEachKey(values, function (field, value) {
|
|
667
|
+
mapClass[field] = value[1];
|
|
668
|
+
mapClass[value[0]] = value[1];
|
|
669
|
+
});
|
|
670
|
+
return deepFreeze(mapClass);
|
|
963
671
|
}
|
|
964
|
-
|
|
965
|
-
|
|
672
|
+
|
|
673
|
+
var EventsDiscardedReason = createEnumStyle({
|
|
674
|
+
Unknown: 0 ,
|
|
675
|
+
NonRetryableStatus: 1 ,
|
|
676
|
+
InvalidEvent: 2 ,
|
|
677
|
+
SizeLimitExceeded: 3 ,
|
|
678
|
+
KillSwitch: 4 ,
|
|
679
|
+
QueueFull: 5
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
/*!
|
|
683
|
+
* Microsoft Dynamic Proto Utility, 1.1.4
|
|
684
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
685
|
+
*/
|
|
686
|
+
var Constructor = 'constructor';
|
|
687
|
+
var Prototype = 'prototype';
|
|
688
|
+
var strFunction = 'function';
|
|
689
|
+
var DynInstFuncTable = '_dynInstFuncs';
|
|
690
|
+
var DynProxyTag = '_isDynProxy';
|
|
691
|
+
var DynClassName = '_dynClass';
|
|
692
|
+
var DynClassNamePrefix = '_dynCls$';
|
|
693
|
+
var DynInstChkTag = '_dynInstChk';
|
|
694
|
+
var DynAllowInstChkTag = DynInstChkTag;
|
|
695
|
+
var DynProtoDefaultOptions = '_dfOpts';
|
|
696
|
+
var UnknownValue = '_unknown_';
|
|
697
|
+
var str__Proto = "__proto__";
|
|
698
|
+
var strUseBaseInst = 'useBaseInst';
|
|
699
|
+
var strSetInstFuncs = 'setInstFuncs';
|
|
700
|
+
var Obj = Object;
|
|
701
|
+
var _objGetPrototypeOf = Obj["getPrototypeOf"];
|
|
702
|
+
var _dynamicNames = 0;
|
|
703
|
+
function _hasOwnProperty(obj, prop) {
|
|
704
|
+
return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
|
|
966
705
|
}
|
|
967
|
-
function
|
|
968
|
-
|
|
969
|
-
return document;
|
|
970
|
-
}
|
|
971
|
-
return getGlobalInst(strDocument);
|
|
706
|
+
function _isObjectOrArrayPrototype(target) {
|
|
707
|
+
return target && (target === Obj[Prototype] || target === Array[Prototype]);
|
|
972
708
|
}
|
|
973
|
-
function
|
|
974
|
-
return
|
|
709
|
+
function _isObjectArrayOrFunctionPrototype(target) {
|
|
710
|
+
return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
|
|
975
711
|
}
|
|
976
|
-
function
|
|
977
|
-
if (
|
|
978
|
-
|
|
712
|
+
function _getObjProto(target) {
|
|
713
|
+
if (target) {
|
|
714
|
+
if (_objGetPrototypeOf) {
|
|
715
|
+
return _objGetPrototypeOf(target);
|
|
716
|
+
}
|
|
717
|
+
var newProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
718
|
+
if (newProto) {
|
|
719
|
+
return newProto;
|
|
720
|
+
}
|
|
979
721
|
}
|
|
980
|
-
return
|
|
981
|
-
}
|
|
982
|
-
function hasHistory() {
|
|
983
|
-
return Boolean(typeof history === strShimObject && history);
|
|
722
|
+
return null;
|
|
984
723
|
}
|
|
985
|
-
function
|
|
986
|
-
|
|
987
|
-
|
|
724
|
+
function _forEachProp(target, func) {
|
|
725
|
+
var props = [];
|
|
726
|
+
var getOwnProps = Obj["getOwnPropertyNames"];
|
|
727
|
+
if (getOwnProps) {
|
|
728
|
+
props = getOwnProps(target);
|
|
988
729
|
}
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
if (mockLocation) {
|
|
995
|
-
return mockLocation;
|
|
730
|
+
else {
|
|
731
|
+
for (var name_1 in target) {
|
|
732
|
+
if (typeof name_1 === "string" && _hasOwnProperty(target, name_1)) {
|
|
733
|
+
props.push(name_1);
|
|
734
|
+
}
|
|
996
735
|
}
|
|
997
736
|
}
|
|
998
|
-
if (
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
}
|
|
1003
|
-
function getConsole() {
|
|
1004
|
-
if (typeof console !== strShimUndefined) {
|
|
1005
|
-
return console;
|
|
737
|
+
if (props && props.length > 0) {
|
|
738
|
+
for (var lp = 0; lp < props.length; lp++) {
|
|
739
|
+
func(props[lp]);
|
|
740
|
+
}
|
|
1006
741
|
}
|
|
1007
|
-
return getGlobalInst(strConsole);
|
|
1008
|
-
}
|
|
1009
|
-
function getPerformance() {
|
|
1010
|
-
return getGlobalInst(strPerformance);
|
|
1011
742
|
}
|
|
1012
|
-
function
|
|
1013
|
-
return
|
|
1014
|
-
}
|
|
1015
|
-
function getJSON() {
|
|
1016
|
-
if (hasJSON()) {
|
|
1017
|
-
return JSON || getGlobalInst(strJSON);
|
|
1018
|
-
}
|
|
1019
|
-
return null;
|
|
743
|
+
function _isDynamicCandidate(target, funcName, skipOwn) {
|
|
744
|
+
return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));
|
|
1020
745
|
}
|
|
1021
|
-
function
|
|
1022
|
-
|
|
746
|
+
function _throwTypeError(message) {
|
|
747
|
+
throw new TypeError("DynamicProto: " + message);
|
|
1023
748
|
}
|
|
1024
|
-
function
|
|
1025
|
-
|
|
749
|
+
function _getInstanceFuncs(thisTarget) {
|
|
750
|
+
var instFuncs = {};
|
|
751
|
+
_forEachProp(thisTarget, function (name) {
|
|
752
|
+
if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {
|
|
753
|
+
instFuncs[name] = thisTarget[name];
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
return instFuncs;
|
|
1026
757
|
}
|
|
1027
|
-
function
|
|
1028
|
-
var
|
|
1029
|
-
|
|
1030
|
-
|
|
758
|
+
function _hasVisited(values, value) {
|
|
759
|
+
for (var lp = values.length - 1; lp >= 0; lp--) {
|
|
760
|
+
if (values[lp] === value) {
|
|
761
|
+
return true;
|
|
762
|
+
}
|
|
1031
763
|
}
|
|
1032
764
|
return false;
|
|
1033
765
|
}
|
|
1034
|
-
function
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
766
|
+
function _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {
|
|
767
|
+
function _instFuncProxy(target, funcHost, funcName) {
|
|
768
|
+
var theFunc = funcHost[funcName];
|
|
769
|
+
if (theFunc[DynProxyTag] && useBaseInst) {
|
|
770
|
+
var instFuncTable = target[DynInstFuncTable] || {};
|
|
771
|
+
if (instFuncTable[DynAllowInstChkTag] !== false) {
|
|
772
|
+
theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
return function () {
|
|
776
|
+
return theFunc.apply(target, arguments);
|
|
777
|
+
};
|
|
1040
778
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
779
|
+
var baseFuncs = {};
|
|
780
|
+
_forEachProp(instFuncs, function (name) {
|
|
781
|
+
baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
|
|
782
|
+
});
|
|
783
|
+
var baseProto = _getObjProto(classProto);
|
|
784
|
+
var visited = [];
|
|
785
|
+
while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
|
|
786
|
+
_forEachProp(baseProto, function (name) {
|
|
787
|
+
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
|
|
788
|
+
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
789
|
+
}
|
|
790
|
+
});
|
|
791
|
+
visited.push(baseProto);
|
|
792
|
+
baseProto = _getObjProto(baseProto);
|
|
793
|
+
}
|
|
794
|
+
return baseFuncs;
|
|
795
|
+
}
|
|
796
|
+
function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
|
|
797
|
+
var instFunc = null;
|
|
798
|
+
if (target && _hasOwnProperty(proto, DynClassName)) {
|
|
799
|
+
var instFuncTable = target[DynInstFuncTable] || {};
|
|
800
|
+
instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
|
|
801
|
+
if (!instFunc) {
|
|
802
|
+
_throwTypeError("Missing [" + funcName + "] " + strFunction);
|
|
803
|
+
}
|
|
804
|
+
if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
|
|
805
|
+
var canAddInst = !_hasOwnProperty(target, funcName);
|
|
806
|
+
var objProto = _getObjProto(target);
|
|
807
|
+
var visited = [];
|
|
808
|
+
while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
|
|
809
|
+
var protoFunc = objProto[funcName];
|
|
810
|
+
if (protoFunc) {
|
|
811
|
+
canAddInst = (protoFunc === currentDynProtoProxy);
|
|
812
|
+
break;
|
|
813
|
+
}
|
|
814
|
+
visited.push(objProto);
|
|
815
|
+
objProto = _getObjProto(objProto);
|
|
816
|
+
}
|
|
817
|
+
try {
|
|
818
|
+
if (canAddInst) {
|
|
819
|
+
target[funcName] = instFunc;
|
|
820
|
+
}
|
|
821
|
+
instFunc[DynInstChkTag] = 1;
|
|
822
|
+
}
|
|
823
|
+
catch (e) {
|
|
824
|
+
instFuncTable[DynAllowInstChkTag] = false;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
return instFunc;
|
|
829
|
+
}
|
|
830
|
+
function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
|
|
831
|
+
var protoFunc = proto[funcName];
|
|
832
|
+
if (protoFunc === currentDynProtoProxy) {
|
|
833
|
+
protoFunc = _getObjProto(proto)[funcName];
|
|
834
|
+
}
|
|
835
|
+
if (typeof protoFunc !== strFunction) {
|
|
836
|
+
_throwTypeError("[" + funcName + "] is not a " + strFunction);
|
|
837
|
+
}
|
|
838
|
+
return protoFunc;
|
|
839
|
+
}
|
|
840
|
+
function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
|
|
841
|
+
function _createDynamicPrototype(proto, funcName) {
|
|
842
|
+
var dynProtoProxy = function () {
|
|
843
|
+
var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
|
|
844
|
+
return instFunc.apply(this, arguments);
|
|
845
|
+
};
|
|
846
|
+
dynProtoProxy[DynProxyTag] = 1;
|
|
847
|
+
return dynProtoProxy;
|
|
848
|
+
}
|
|
849
|
+
if (!_isObjectOrArrayPrototype(proto)) {
|
|
850
|
+
var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
|
|
851
|
+
var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
|
|
852
|
+
if (instFuncTable[DynAllowInstChkTag] !== false) {
|
|
853
|
+
instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
|
|
854
|
+
}
|
|
855
|
+
_forEachProp(target, function (name) {
|
|
856
|
+
if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
|
|
857
|
+
instFuncs_1[name] = target[name];
|
|
858
|
+
delete target[name];
|
|
859
|
+
if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
|
|
860
|
+
proto[name] = _createDynamicPrototype(proto, name);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
function _checkPrototype(classProto, thisTarget) {
|
|
867
|
+
if (_objGetPrototypeOf) {
|
|
868
|
+
var visited = [];
|
|
869
|
+
var thisProto = _getObjProto(thisTarget);
|
|
870
|
+
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
871
|
+
if (thisProto === classProto) {
|
|
872
|
+
return true;
|
|
873
|
+
}
|
|
874
|
+
visited.push(thisProto);
|
|
875
|
+
thisProto = _getObjProto(thisProto);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
return false;
|
|
879
|
+
}
|
|
880
|
+
function _getObjName(target, unknownValue) {
|
|
881
|
+
if (_hasOwnProperty(target, Prototype)) {
|
|
882
|
+
return target.name || unknownValue || UnknownValue;
|
|
883
|
+
}
|
|
884
|
+
return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
|
|
885
|
+
}
|
|
886
|
+
function dynamicProto(theClass, target, delegateFunc, options) {
|
|
887
|
+
if (!_hasOwnProperty(theClass, Prototype)) {
|
|
888
|
+
_throwTypeError("theClass is an invalid class definition.");
|
|
889
|
+
}
|
|
890
|
+
var classProto = theClass[Prototype];
|
|
891
|
+
if (!_checkPrototype(classProto, target)) {
|
|
892
|
+
_throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
|
|
893
|
+
}
|
|
894
|
+
var className = null;
|
|
895
|
+
if (_hasOwnProperty(classProto, DynClassName)) {
|
|
896
|
+
className = classProto[DynClassName];
|
|
897
|
+
}
|
|
898
|
+
else {
|
|
899
|
+
className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
|
|
900
|
+
_dynamicNames++;
|
|
901
|
+
classProto[DynClassName] = className;
|
|
902
|
+
}
|
|
903
|
+
var perfOptions = dynamicProto[DynProtoDefaultOptions];
|
|
904
|
+
var useBaseInst = !!perfOptions[strUseBaseInst];
|
|
905
|
+
if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
|
|
906
|
+
useBaseInst = !!options[strUseBaseInst];
|
|
907
|
+
}
|
|
908
|
+
var instFuncs = _getInstanceFuncs(target);
|
|
909
|
+
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
910
|
+
delegateFunc(target, baseFuncs);
|
|
911
|
+
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
912
|
+
if (setInstanceFunc && options) {
|
|
913
|
+
setInstanceFunc = !!options[strSetInstFuncs];
|
|
914
|
+
}
|
|
915
|
+
_populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
|
|
916
|
+
}
|
|
917
|
+
var perfDefaults = {
|
|
918
|
+
setInstFuncs: true,
|
|
919
|
+
useBaseInst: true
|
|
920
|
+
};
|
|
921
|
+
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
922
|
+
|
|
923
|
+
var strWindow = "window";
|
|
924
|
+
var strDocument = "document";
|
|
925
|
+
var strDocumentMode = "documentMode";
|
|
926
|
+
var strNavigator = "navigator";
|
|
927
|
+
var strHistory = "history";
|
|
928
|
+
var strLocation = "location";
|
|
929
|
+
var strConsole = "console";
|
|
930
|
+
var strPerformance = "performance";
|
|
931
|
+
var strJSON = "JSON";
|
|
932
|
+
var strCrypto = "crypto";
|
|
933
|
+
var strMsCrypto = "msCrypto";
|
|
934
|
+
var strReactNative = "ReactNative";
|
|
935
|
+
var strMsie = "msie";
|
|
936
|
+
var strTrident = "trident/";
|
|
937
|
+
var strXMLHttpRequest = "XMLHttpRequest";
|
|
938
|
+
var _isTrident = null;
|
|
939
|
+
var _navUserAgentCheck = null;
|
|
940
|
+
var _enableMocks = false;
|
|
941
|
+
var _useXDomainRequest = null;
|
|
942
|
+
var _beaconsSupported = null;
|
|
943
|
+
function _hasProperty(theClass, property) {
|
|
944
|
+
var supported = false;
|
|
945
|
+
if (theClass) {
|
|
946
|
+
try {
|
|
947
|
+
supported = property in theClass;
|
|
948
|
+
if (!supported) {
|
|
949
|
+
var proto = theClass[strShimPrototype];
|
|
950
|
+
if (proto) {
|
|
951
|
+
supported = property in proto;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
catch (e) {
|
|
956
|
+
}
|
|
957
|
+
if (!supported) {
|
|
958
|
+
try {
|
|
959
|
+
var tmp = new theClass();
|
|
960
|
+
supported = !isUndefined(tmp[property]);
|
|
961
|
+
}
|
|
962
|
+
catch (e) {
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
return supported;
|
|
967
|
+
}
|
|
968
|
+
function setEnableEnvMocks(enabled) {
|
|
969
|
+
_enableMocks = enabled;
|
|
970
|
+
}
|
|
971
|
+
function getGlobalInst(name) {
|
|
972
|
+
var gbl = getGlobal();
|
|
973
|
+
if (gbl && gbl[name]) {
|
|
974
|
+
return gbl[name];
|
|
975
|
+
}
|
|
976
|
+
if (name === strWindow && hasWindow()) {
|
|
977
|
+
return window;
|
|
978
|
+
}
|
|
979
|
+
return null;
|
|
980
|
+
}
|
|
981
|
+
function hasWindow() {
|
|
982
|
+
return Boolean(typeof window === strShimObject && window);
|
|
983
|
+
}
|
|
984
|
+
function getWindow() {
|
|
985
|
+
if (hasWindow()) {
|
|
986
|
+
return window;
|
|
987
|
+
}
|
|
988
|
+
return getGlobalInst(strWindow);
|
|
989
|
+
}
|
|
990
|
+
function hasDocument() {
|
|
991
|
+
return Boolean(typeof document === strShimObject && document);
|
|
992
|
+
}
|
|
993
|
+
function getDocument() {
|
|
994
|
+
if (hasDocument()) {
|
|
995
|
+
return document;
|
|
996
|
+
}
|
|
997
|
+
return getGlobalInst(strDocument);
|
|
998
|
+
}
|
|
999
|
+
function hasNavigator() {
|
|
1000
|
+
return Boolean(typeof navigator === strShimObject && navigator);
|
|
1001
|
+
}
|
|
1002
|
+
function getNavigator() {
|
|
1003
|
+
if (hasNavigator()) {
|
|
1004
|
+
return navigator;
|
|
1005
|
+
}
|
|
1006
|
+
return getGlobalInst(strNavigator);
|
|
1007
|
+
}
|
|
1008
|
+
function hasHistory() {
|
|
1009
|
+
return Boolean(typeof history === strShimObject && history);
|
|
1010
|
+
}
|
|
1011
|
+
function getHistory() {
|
|
1012
|
+
if (hasHistory()) {
|
|
1013
|
+
return history;
|
|
1014
|
+
}
|
|
1015
|
+
return getGlobalInst(strHistory);
|
|
1016
|
+
}
|
|
1017
|
+
function getLocation(checkForMock) {
|
|
1018
|
+
if (checkForMock && _enableMocks) {
|
|
1019
|
+
var mockLocation = getGlobalInst("__mockLocation");
|
|
1020
|
+
if (mockLocation) {
|
|
1021
|
+
return mockLocation;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
if (typeof location === strShimObject && location) {
|
|
1025
|
+
return location;
|
|
1026
|
+
}
|
|
1027
|
+
return getGlobalInst(strLocation);
|
|
1028
|
+
}
|
|
1029
|
+
function getConsole() {
|
|
1030
|
+
if (typeof console !== strShimUndefined) {
|
|
1031
|
+
return console;
|
|
1032
|
+
}
|
|
1033
|
+
return getGlobalInst(strConsole);
|
|
1034
|
+
}
|
|
1035
|
+
function getPerformance() {
|
|
1036
|
+
return getGlobalInst(strPerformance);
|
|
1037
|
+
}
|
|
1038
|
+
function hasJSON() {
|
|
1039
|
+
return Boolean((typeof JSON === strShimObject && JSON) || getGlobalInst(strJSON) !== null);
|
|
1040
|
+
}
|
|
1041
|
+
function getJSON() {
|
|
1042
|
+
if (hasJSON()) {
|
|
1043
|
+
return JSON || getGlobalInst(strJSON);
|
|
1044
|
+
}
|
|
1045
|
+
return null;
|
|
1046
|
+
}
|
|
1047
|
+
function getCrypto() {
|
|
1048
|
+
return getGlobalInst(strCrypto);
|
|
1049
|
+
}
|
|
1050
|
+
function getMsCrypto() {
|
|
1051
|
+
return getGlobalInst(strMsCrypto);
|
|
1052
|
+
}
|
|
1053
|
+
function isReactNative() {
|
|
1054
|
+
var nav = getNavigator();
|
|
1055
|
+
if (nav && nav.product) {
|
|
1056
|
+
return nav.product === strReactNative;
|
|
1057
|
+
}
|
|
1058
|
+
return false;
|
|
1059
|
+
}
|
|
1060
|
+
function isIE() {
|
|
1061
|
+
var nav = getNavigator();
|
|
1062
|
+
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
1063
|
+
_navUserAgentCheck = nav.userAgent;
|
|
1064
|
+
var userAgent = (_navUserAgentCheck || strEmpty).toLowerCase();
|
|
1065
|
+
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
1066
|
+
}
|
|
1067
|
+
return _isTrident;
|
|
1068
|
+
}
|
|
1043
1069
|
function getIEVersion(userAgentStr) {
|
|
1044
1070
|
if (userAgentStr === void 0) { userAgentStr = null; }
|
|
1045
1071
|
if (!userAgentStr) {
|
|
1046
1072
|
var navigator_1 = getNavigator() || {};
|
|
1047
|
-
userAgentStr = navigator_1 ? (navigator_1.userAgent ||
|
|
1073
|
+
userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty).toLowerCase() : strEmpty;
|
|
1048
1074
|
}
|
|
1049
|
-
var ua = (userAgentStr ||
|
|
1075
|
+
var ua = (userAgentStr || strEmpty).toLowerCase();
|
|
1050
1076
|
if (strContains(ua, strMsie)) {
|
|
1051
1077
|
var doc = getDocument() || {};
|
|
1052
1078
|
return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
|
|
@@ -1061,7 +1087,7 @@
|
|
|
1061
1087
|
}
|
|
1062
1088
|
function dumpObj(object) {
|
|
1063
1089
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
1064
|
-
var propertyValueDump =
|
|
1090
|
+
var propertyValueDump = strEmpty;
|
|
1065
1091
|
if (objectTypeDump === "[object Error]") {
|
|
1066
1092
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
1067
1093
|
}
|
|
@@ -1073,9 +1099,9 @@
|
|
|
1073
1099
|
function isSafari(userAgentStr) {
|
|
1074
1100
|
if (!userAgentStr || !isString(userAgentStr)) {
|
|
1075
1101
|
var navigator_2 = getNavigator() || {};
|
|
1076
|
-
userAgentStr = navigator_2 ? (navigator_2.userAgent ||
|
|
1102
|
+
userAgentStr = navigator_2 ? (navigator_2.userAgent || strEmpty).toLowerCase() : strEmpty;
|
|
1077
1103
|
}
|
|
1078
|
-
var ua = (userAgentStr ||
|
|
1104
|
+
var ua = (userAgentStr || strEmpty).toLowerCase();
|
|
1079
1105
|
return (ua.indexOf("safari") >= 0);
|
|
1080
1106
|
}
|
|
1081
1107
|
function isBeaconsSupported() {
|
|
@@ -1087,8 +1113,7 @@
|
|
|
1087
1113
|
function isFetchSupported(withKeepAlive) {
|
|
1088
1114
|
var isSupported = false;
|
|
1089
1115
|
try {
|
|
1090
|
-
|
|
1091
|
-
isSupported = !!fetchApi;
|
|
1116
|
+
isSupported = !!getGlobalInst("fetch");
|
|
1092
1117
|
var request = getGlobalInst("Request");
|
|
1093
1118
|
if (isSupported && withKeepAlive && request) {
|
|
1094
1119
|
isSupported = _hasProperty(request, "keepalive");
|
|
@@ -1100,9 +1125,9 @@
|
|
|
1100
1125
|
}
|
|
1101
1126
|
function useXDomainRequest() {
|
|
1102
1127
|
if (_useXDomainRequest === null) {
|
|
1103
|
-
_useXDomainRequest = (typeof XDomainRequest !==
|
|
1128
|
+
_useXDomainRequest = (typeof XDomainRequest !== strShimUndefined);
|
|
1104
1129
|
if (_useXDomainRequest && isXhrSupported()) {
|
|
1105
|
-
_useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(
|
|
1130
|
+
_useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(strXMLHttpRequest), "withCredentials");
|
|
1106
1131
|
}
|
|
1107
1132
|
}
|
|
1108
1133
|
return _useXDomainRequest;
|
|
@@ -1110,7 +1135,7 @@
|
|
|
1110
1135
|
function isXhrSupported() {
|
|
1111
1136
|
var isSupported = false;
|
|
1112
1137
|
try {
|
|
1113
|
-
var xmlHttpRequest = getGlobalInst(
|
|
1138
|
+
var xmlHttpRequest = getGlobalInst(strXMLHttpRequest);
|
|
1114
1139
|
isSupported = !!xmlHttpRequest;
|
|
1115
1140
|
}
|
|
1116
1141
|
catch (e) {
|
|
@@ -1164,9 +1189,9 @@
|
|
|
1164
1189
|
var strWarnToConsole = "warnToConsole";
|
|
1165
1190
|
function _sanitizeDiagnosticText(text) {
|
|
1166
1191
|
if (text) {
|
|
1167
|
-
return "\"" + text.replace(/\"/g,
|
|
1192
|
+
return "\"" + text.replace(/\"/g, strEmpty) + "\"";
|
|
1168
1193
|
}
|
|
1169
|
-
return
|
|
1194
|
+
return strEmpty;
|
|
1170
1195
|
}
|
|
1171
1196
|
function _logToConsole(func, message) {
|
|
1172
1197
|
var theConsole = getConsole();
|
|
@@ -1188,12 +1213,12 @@
|
|
|
1188
1213
|
_self.message =
|
|
1189
1214
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
1190
1215
|
msgId;
|
|
1191
|
-
var strProps =
|
|
1216
|
+
var strProps = strEmpty;
|
|
1192
1217
|
if (hasJSON()) {
|
|
1193
1218
|
strProps = getJSON().stringify(properties);
|
|
1194
1219
|
}
|
|
1195
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
1196
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
1220
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty) +
|
|
1221
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty);
|
|
1197
1222
|
_self.message += diagnosticText;
|
|
1198
1223
|
}
|
|
1199
1224
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -1223,7 +1248,7 @@
|
|
|
1223
1248
|
throw message;
|
|
1224
1249
|
}
|
|
1225
1250
|
else {
|
|
1226
|
-
var logFunc = severity ===
|
|
1251
|
+
var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
|
|
1227
1252
|
if (!isUndefined(message.message)) {
|
|
1228
1253
|
var logLevel = _self.consoleLoggingLevel();
|
|
1229
1254
|
if (isUserAct) {
|
|
@@ -1241,7 +1266,7 @@
|
|
|
1241
1266
|
_self.logInternalMessage(severity, message);
|
|
1242
1267
|
}
|
|
1243
1268
|
else {
|
|
1244
|
-
_debugExtMsg("throw" + (severity ===
|
|
1269
|
+
_debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
|
|
1245
1270
|
}
|
|
1246
1271
|
}
|
|
1247
1272
|
};
|
|
@@ -1273,13 +1298,13 @@
|
|
|
1273
1298
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
1274
1299
|
_self.queue.push(message);
|
|
1275
1300
|
_messageCount++;
|
|
1276
|
-
_debugExtMsg((severity ===
|
|
1301
|
+
_debugExtMsg((severity === 1 ? "error" : "warn"), message);
|
|
1277
1302
|
}
|
|
1278
1303
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
1279
1304
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
1280
|
-
var throttleMessage = new _InternalLogMessage(
|
|
1305
|
+
var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
|
|
1281
1306
|
_self.queue.push(throttleMessage);
|
|
1282
|
-
if (severity ===
|
|
1307
|
+
if (severity === 1 ) {
|
|
1283
1308
|
_self.errorToConsole(throttleLimitMessage);
|
|
1284
1309
|
}
|
|
1285
1310
|
else {
|
|
@@ -1308,6 +1333,19 @@
|
|
|
1308
1333
|
}
|
|
1309
1334
|
return DiagnosticLogger;
|
|
1310
1335
|
}());
|
|
1336
|
+
function _getLogger(logger) {
|
|
1337
|
+
return (logger || new DiagnosticLogger());
|
|
1338
|
+
}
|
|
1339
|
+
function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
|
|
1340
|
+
if (isUserAct === void 0) { isUserAct = false; }
|
|
1341
|
+
(logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
|
|
1342
|
+
}
|
|
1343
|
+
function _warnToConsole(logger, message) {
|
|
1344
|
+
_getLogger(logger).warnToConsole(message);
|
|
1345
|
+
}
|
|
1346
|
+
function _logInternalMessage(logger, severity, message) {
|
|
1347
|
+
_getLogger(logger).logInternalMessage(severity, message);
|
|
1348
|
+
}
|
|
1311
1349
|
|
|
1312
1350
|
var strExecutionContextKey = "ctx";
|
|
1313
1351
|
var _defaultPerfManager = null;
|
|
@@ -1447,280 +1485,196 @@
|
|
|
1447
1485
|
}
|
|
1448
1486
|
}
|
|
1449
1487
|
}
|
|
1450
|
-
return func();
|
|
1488
|
+
return func();
|
|
1489
|
+
}
|
|
1490
|
+
function setGblPerfMgr(perfManager) {
|
|
1491
|
+
_defaultPerfManager = perfManager;
|
|
1492
|
+
}
|
|
1493
|
+
function getGblPerfMgr() {
|
|
1494
|
+
return _defaultPerfManager;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
var UInt32Mask = 0x100000000;
|
|
1498
|
+
var MaxUInt32 = 0xffffffff;
|
|
1499
|
+
var _mwcSeeded = false;
|
|
1500
|
+
var _mwcW = 123456789;
|
|
1501
|
+
var _mwcZ = 987654321;
|
|
1502
|
+
function _mwcSeed(seedValue) {
|
|
1503
|
+
if (seedValue < 0) {
|
|
1504
|
+
seedValue >>>= 0;
|
|
1505
|
+
}
|
|
1506
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
1507
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
1508
|
+
_mwcSeeded = true;
|
|
1451
1509
|
}
|
|
1452
|
-
function
|
|
1453
|
-
|
|
1510
|
+
function _autoSeedMwc() {
|
|
1511
|
+
try {
|
|
1512
|
+
var now = dateNow() & 0x7fffffff;
|
|
1513
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
1514
|
+
}
|
|
1515
|
+
catch (e) {
|
|
1516
|
+
}
|
|
1454
1517
|
}
|
|
1455
|
-
function
|
|
1456
|
-
|
|
1518
|
+
function randomValue(maxValue) {
|
|
1519
|
+
if (maxValue > 0) {
|
|
1520
|
+
return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
|
|
1521
|
+
}
|
|
1522
|
+
return 0;
|
|
1457
1523
|
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1464
|
-
var _hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1465
|
-
_self._hasRun = false;
|
|
1466
|
-
_self.getPlugin = function () {
|
|
1467
|
-
return plugin;
|
|
1468
|
-
};
|
|
1469
|
-
_self.getNext = function () {
|
|
1470
|
-
return _nextProxy;
|
|
1471
|
-
};
|
|
1472
|
-
_self.setNext = function (nextPlugin) {
|
|
1473
|
-
_nextProxy = nextPlugin;
|
|
1474
|
-
};
|
|
1475
|
-
_self.processTelemetry = function (env, itemCtx) {
|
|
1476
|
-
if (!itemCtx) {
|
|
1477
|
-
itemCtx = defItemCtx;
|
|
1478
|
-
}
|
|
1479
|
-
var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
|
|
1480
|
-
doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
|
|
1481
|
-
if (plugin && _hasProcessTelemetry) {
|
|
1482
|
-
_self._hasRun = true;
|
|
1483
|
-
try {
|
|
1484
|
-
itemCtx.setNext(_nextProxy);
|
|
1485
|
-
if (_hasSetNext) {
|
|
1486
|
-
plugin.setNextPlugin(_nextProxy);
|
|
1487
|
-
}
|
|
1488
|
-
_nextProxy && (_nextProxy._hasRun = false);
|
|
1489
|
-
plugin.processTelemetry(env, itemCtx);
|
|
1490
|
-
}
|
|
1491
|
-
catch (error) {
|
|
1492
|
-
var hasRun = _nextProxy && _nextProxy._hasRun;
|
|
1493
|
-
if (!_nextProxy || !hasRun) {
|
|
1494
|
-
itemCtx.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
|
|
1495
|
-
}
|
|
1496
|
-
if (_nextProxy && !hasRun) {
|
|
1497
|
-
_nextProxy.processTelemetry(env, itemCtx);
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
else if (_nextProxy) {
|
|
1502
|
-
_self._hasRun = true;
|
|
1503
|
-
_nextProxy.processTelemetry(env, itemCtx);
|
|
1504
|
-
}
|
|
1505
|
-
}, function () { return ({ item: env }); }, !(env.sync));
|
|
1506
|
-
};
|
|
1524
|
+
function random32(signed) {
|
|
1525
|
+
var value = 0;
|
|
1526
|
+
var c = getCrypto() || getMsCrypto();
|
|
1527
|
+
if (c && c.getRandomValues) {
|
|
1528
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1507
1529
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
function _createProxyChain(plugins, itemCtx) {
|
|
1512
|
-
var proxies = [];
|
|
1513
|
-
if (plugins && plugins.length > 0) {
|
|
1514
|
-
var lastProxy = null;
|
|
1515
|
-
for (var idx = 0; idx < plugins.length; idx++) {
|
|
1516
|
-
var thePlugin = plugins[idx];
|
|
1517
|
-
if (thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1518
|
-
var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
|
|
1519
|
-
proxies.push(newProxy);
|
|
1520
|
-
if (lastProxy) {
|
|
1521
|
-
lastProxy.setNext(newProxy);
|
|
1522
|
-
}
|
|
1523
|
-
lastProxy = newProxy;
|
|
1524
|
-
}
|
|
1530
|
+
if (value === 0 && isIE()) {
|
|
1531
|
+
if (!_mwcSeeded) {
|
|
1532
|
+
_autoSeedMwc();
|
|
1525
1533
|
}
|
|
1534
|
+
value = mwcRandom32() & MaxUInt32;
|
|
1535
|
+
}
|
|
1536
|
+
if (value === 0) {
|
|
1537
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1538
|
+
}
|
|
1539
|
+
if (!signed) {
|
|
1540
|
+
value >>>= 0;
|
|
1526
1541
|
}
|
|
1527
|
-
return
|
|
1542
|
+
return value;
|
|
1528
1543
|
}
|
|
1529
|
-
function
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
if (proxy) {
|
|
1533
|
-
while (proxy) {
|
|
1534
|
-
var thePlugin = proxy.getPlugin();
|
|
1535
|
-
if (add || thePlugin === startAt) {
|
|
1536
|
-
add = true;
|
|
1537
|
-
plugins.push(thePlugin);
|
|
1538
|
-
}
|
|
1539
|
-
proxy = proxy.getNext();
|
|
1540
|
-
}
|
|
1544
|
+
function mwcRandomSeed(value) {
|
|
1545
|
+
if (!value) {
|
|
1546
|
+
_autoSeedMwc();
|
|
1541
1547
|
}
|
|
1542
|
-
|
|
1543
|
-
|
|
1548
|
+
else {
|
|
1549
|
+
_mwcSeed(value);
|
|
1544
1550
|
}
|
|
1545
|
-
return _createProxyChain(plugins, itemCtx);
|
|
1546
1551
|
}
|
|
1547
|
-
function
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
if (add || thePlugin === startAt) {
|
|
1554
|
-
add = true;
|
|
1555
|
-
plugins.push(thePlugin);
|
|
1556
|
-
}
|
|
1557
|
-
});
|
|
1552
|
+
function mwcRandom32(signed) {
|
|
1553
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1554
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1555
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1556
|
+
if (!signed) {
|
|
1557
|
+
value >>>= 0;
|
|
1558
1558
|
}
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1559
|
+
return value;
|
|
1560
|
+
}
|
|
1561
|
+
function newId(maxLength) {
|
|
1562
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1563
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1564
|
+
var number = random32() >>> 0;
|
|
1565
|
+
var chars = 0;
|
|
1566
|
+
var result = strEmpty;
|
|
1567
|
+
while (result.length < maxLength) {
|
|
1568
|
+
chars++;
|
|
1569
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1570
|
+
number >>>= 6;
|
|
1571
|
+
if (chars === 5) {
|
|
1572
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1573
|
+
chars = 0;
|
|
1562
1574
|
}
|
|
1563
|
-
plugins.push(startAt);
|
|
1564
1575
|
}
|
|
1565
|
-
return
|
|
1576
|
+
return result;
|
|
1566
1577
|
}
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1578
|
+
|
|
1579
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
1580
|
+
var version = "2.8.0-nightly.2204-06";
|
|
1581
|
+
var instanceName = "." + newId(6);
|
|
1582
|
+
var _dataUid = 0;
|
|
1583
|
+
function _createAccessor(target, prop, value) {
|
|
1584
|
+
if (_objDefineProperty) {
|
|
1585
|
+
try {
|
|
1586
|
+
_objDefineProperty(target, prop, {
|
|
1587
|
+
value: value,
|
|
1588
|
+
enumerable: false,
|
|
1589
|
+
configurable: true
|
|
1590
|
+
});
|
|
1591
|
+
return true;
|
|
1583
1592
|
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
if (
|
|
1599
|
-
|
|
1593
|
+
catch (e) {
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
return false;
|
|
1597
|
+
}
|
|
1598
|
+
function _canAcceptData(target) {
|
|
1599
|
+
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1600
|
+
}
|
|
1601
|
+
function _getCache(data, target) {
|
|
1602
|
+
var theCache = target[data.id];
|
|
1603
|
+
if (!theCache) {
|
|
1604
|
+
theCache = {};
|
|
1605
|
+
try {
|
|
1606
|
+
if (_canAcceptData(target)) {
|
|
1607
|
+
if (!_createAccessor(target, data.id, theCache)) {
|
|
1608
|
+
target[data.id] = theCache;
|
|
1600
1609
|
}
|
|
1601
1610
|
}
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
if (defaultValue === void 0) { defaultValue = false; }
|
|
1606
|
-
var theValue;
|
|
1607
|
-
var extConfig = _self.getExtCfg(identifier, null);
|
|
1608
|
-
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1609
|
-
theValue = extConfig[field];
|
|
1610
|
-
}
|
|
1611
|
-
else if (config && !isNullOrUndefined(config[field])) {
|
|
1612
|
-
theValue = config[field];
|
|
1613
|
-
}
|
|
1614
|
-
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1615
|
-
};
|
|
1616
|
-
_self.hasNext = function () {
|
|
1617
|
-
return _nextProxy != null;
|
|
1618
|
-
};
|
|
1619
|
-
_self.getNext = function () {
|
|
1620
|
-
return _nextProxy;
|
|
1621
|
-
};
|
|
1622
|
-
_self.setNext = function (nextPlugin) {
|
|
1623
|
-
_nextProxy = nextPlugin;
|
|
1624
|
-
};
|
|
1625
|
-
_self.processNext = function (env) {
|
|
1626
|
-
var nextPlugin = _nextProxy;
|
|
1627
|
-
if (nextPlugin) {
|
|
1628
|
-
_nextProxy = nextPlugin.getNext();
|
|
1629
|
-
nextPlugin.processTelemetry(env, _self);
|
|
1630
|
-
}
|
|
1631
|
-
};
|
|
1632
|
-
_self.createNew = function (plugins, startAt) {
|
|
1633
|
-
if (plugins === void 0) { plugins = null; }
|
|
1634
|
-
return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1635
|
-
};
|
|
1611
|
+
}
|
|
1612
|
+
catch (e) {
|
|
1613
|
+
}
|
|
1636
1614
|
}
|
|
1637
|
-
return
|
|
1638
|
-
}
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
_self.setInitialized = function (isInitialized) {
|
|
1658
|
-
_isinitialized = isInitialized;
|
|
1659
|
-
};
|
|
1660
|
-
_self.setNextPlugin = function (next) {
|
|
1661
|
-
_nextPlugin = next;
|
|
1662
|
-
};
|
|
1663
|
-
_self.processNext = function (env, itemCtx) {
|
|
1664
|
-
if (itemCtx) {
|
|
1665
|
-
itemCtx.processNext(env);
|
|
1666
|
-
}
|
|
1667
|
-
else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
|
|
1668
|
-
_nextPlugin.processTelemetry(env, null);
|
|
1615
|
+
return theCache;
|
|
1616
|
+
}
|
|
1617
|
+
function createUniqueNamespace(name, includeVersion) {
|
|
1618
|
+
if (includeVersion === void 0) { includeVersion = false; }
|
|
1619
|
+
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1620
|
+
}
|
|
1621
|
+
function createElmNodeData(name) {
|
|
1622
|
+
var data = {
|
|
1623
|
+
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1624
|
+
accept: function (target) {
|
|
1625
|
+
return _canAcceptData(target);
|
|
1626
|
+
},
|
|
1627
|
+
get: function (target, name, defValue, addDefault) {
|
|
1628
|
+
var theCache = target[data.id];
|
|
1629
|
+
if (!theCache) {
|
|
1630
|
+
if (addDefault) {
|
|
1631
|
+
theCache = _getCache(data, target);
|
|
1632
|
+
theCache[normalizeJsName(name)] = defValue;
|
|
1633
|
+
}
|
|
1634
|
+
return defValue;
|
|
1669
1635
|
}
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1677
|
-
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
1636
|
+
return theCache[normalizeJsName(name)];
|
|
1637
|
+
},
|
|
1638
|
+
kill: function (target, name) {
|
|
1639
|
+
if (target && target[name]) {
|
|
1640
|
+
try {
|
|
1641
|
+
delete target[name];
|
|
1678
1642
|
}
|
|
1679
|
-
|
|
1680
|
-
itemCtx = rootCtx.createNew(null, _nextPlugin);
|
|
1643
|
+
catch (e) {
|
|
1681
1644
|
}
|
|
1682
1645
|
}
|
|
1683
|
-
|
|
1684
|
-
};
|
|
1685
|
-
_self._baseTelInit = function (config, core, extensions, pluginChain) {
|
|
1686
|
-
if (config) {
|
|
1687
|
-
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
1688
|
-
}
|
|
1689
|
-
if (!pluginChain && core) {
|
|
1690
|
-
pluginChain = core.getProcessTelContext().getNext();
|
|
1691
|
-
}
|
|
1692
|
-
var nextPlugin = _nextPlugin;
|
|
1693
|
-
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1694
|
-
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
1695
|
-
}
|
|
1696
|
-
_self.core = core;
|
|
1697
|
-
_rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
1698
|
-
_isinitialized = true;
|
|
1699
|
-
};
|
|
1700
|
-
}
|
|
1701
|
-
BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
|
|
1702
|
-
this._baseTelInit(config, core, extensions, pluginChain);
|
|
1646
|
+
}
|
|
1703
1647
|
};
|
|
1704
|
-
return
|
|
1705
|
-
}
|
|
1648
|
+
return data;
|
|
1649
|
+
}
|
|
1706
1650
|
|
|
1707
|
-
var
|
|
1708
|
-
var
|
|
1709
|
-
|
|
1710
|
-
|
|
1651
|
+
var strDoUnload = "_doUnload";
|
|
1652
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1653
|
+
function _getPluginState(plugin) {
|
|
1654
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1655
|
+
}
|
|
1711
1656
|
function initializePlugins(processContext, extensions) {
|
|
1712
1657
|
var initPlugins = [];
|
|
1713
1658
|
var lastPlugin = null;
|
|
1714
1659
|
var proxy = processContext.getNext();
|
|
1660
|
+
var pluginState;
|
|
1715
1661
|
while (proxy) {
|
|
1716
1662
|
var thePlugin = proxy.getPlugin();
|
|
1717
1663
|
if (thePlugin) {
|
|
1718
1664
|
if (lastPlugin &&
|
|
1719
|
-
isFunction(lastPlugin[
|
|
1720
|
-
isFunction(thePlugin[
|
|
1721
|
-
lastPlugin[
|
|
1665
|
+
isFunction(lastPlugin[strSetNextPlugin]) &&
|
|
1666
|
+
isFunction(thePlugin[strProcessTelemetry])) {
|
|
1667
|
+
lastPlugin[strSetNextPlugin](thePlugin);
|
|
1668
|
+
}
|
|
1669
|
+
var isInitialized = false;
|
|
1670
|
+
if (isFunction(thePlugin[strIsInitialized])) {
|
|
1671
|
+
isInitialized = thePlugin[strIsInitialized]();
|
|
1722
1672
|
}
|
|
1723
|
-
|
|
1673
|
+
else {
|
|
1674
|
+
pluginState = _getPluginState(thePlugin);
|
|
1675
|
+
isInitialized = pluginState[strIsInitialized];
|
|
1676
|
+
}
|
|
1677
|
+
if (!isInitialized) {
|
|
1724
1678
|
initPlugins.push(thePlugin);
|
|
1725
1679
|
}
|
|
1726
1680
|
lastPlugin = thePlugin;
|
|
@@ -1728,15 +1682,22 @@
|
|
|
1728
1682
|
}
|
|
1729
1683
|
}
|
|
1730
1684
|
arrForEach(initPlugins, function (thePlugin) {
|
|
1731
|
-
|
|
1685
|
+
var core = processContext.core();
|
|
1686
|
+
thePlugin.initialize(processContext.getCfg(), core, extensions, processContext.getNext());
|
|
1687
|
+
pluginState = _getPluginState(thePlugin);
|
|
1688
|
+
if (!thePlugin[strCore] && !pluginState[strCore]) {
|
|
1689
|
+
pluginState[strCore] = core;
|
|
1690
|
+
}
|
|
1691
|
+
pluginState[strIsInitialized] = true;
|
|
1692
|
+
delete pluginState[strTeardown];
|
|
1732
1693
|
});
|
|
1733
1694
|
}
|
|
1734
1695
|
function sortPlugins(plugins) {
|
|
1735
1696
|
return plugins.sort(function (extA, extB) {
|
|
1736
1697
|
var result = 0;
|
|
1737
|
-
var bHasProcess = isFunction(extB[
|
|
1738
|
-
if (isFunction(extA[
|
|
1739
|
-
result = bHasProcess ? extA[
|
|
1698
|
+
var bHasProcess = isFunction(extB[strProcessTelemetry]);
|
|
1699
|
+
if (isFunction(extA[strProcessTelemetry])) {
|
|
1700
|
+
result = bHasProcess ? extA[strPriority] - extB[strPriority] : 1;
|
|
1740
1701
|
}
|
|
1741
1702
|
else if (bHasProcess) {
|
|
1742
1703
|
result = -1;
|
|
@@ -1744,81 +1705,376 @@
|
|
|
1744
1705
|
return result;
|
|
1745
1706
|
});
|
|
1746
1707
|
}
|
|
1708
|
+
function unloadComponents(components, unloadCtx, unloadState, asyncCallback) {
|
|
1709
|
+
var idx = 0;
|
|
1710
|
+
function _doUnload() {
|
|
1711
|
+
while (idx < components.length) {
|
|
1712
|
+
var component = components[idx++];
|
|
1713
|
+
if (component) {
|
|
1714
|
+
var func = component[strDoUnload] || component[strDoTeardown];
|
|
1715
|
+
if (isFunction(func)) {
|
|
1716
|
+
if (func.call(component, unloadCtx, unloadState, _doUnload) === true) {
|
|
1717
|
+
return true;
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
return _doUnload();
|
|
1724
|
+
}
|
|
1747
1725
|
|
|
1748
|
-
var
|
|
1749
|
-
var
|
|
1750
|
-
var
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1726
|
+
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1727
|
+
var strHasRunFlags = "_hasRun";
|
|
1728
|
+
var strGetTelCtx = "_getTelCtx";
|
|
1729
|
+
var _chainId = 0;
|
|
1730
|
+
function _getNextProxyStart(proxy, config, core, startAt) {
|
|
1731
|
+
while (proxy) {
|
|
1732
|
+
if (proxy.getPlugin() === startAt) {
|
|
1733
|
+
return proxy;
|
|
1734
|
+
}
|
|
1735
|
+
proxy = proxy.getNext();
|
|
1736
|
+
}
|
|
1737
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1738
|
+
}
|
|
1739
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1740
|
+
var _nextProxy = null;
|
|
1741
|
+
var _onComplete = [];
|
|
1742
|
+
if (startAt !== null) {
|
|
1743
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1744
|
+
}
|
|
1745
|
+
var context = {
|
|
1746
|
+
_next: _moveNext,
|
|
1747
|
+
ctx: {
|
|
1748
|
+
core: function () {
|
|
1749
|
+
return core;
|
|
1750
|
+
},
|
|
1751
|
+
diagLog: function () {
|
|
1752
|
+
return safeGetLogger(core, config);
|
|
1753
|
+
},
|
|
1754
|
+
getCfg: function () {
|
|
1755
|
+
return config;
|
|
1756
|
+
},
|
|
1757
|
+
getExtCfg: _getExtCfg,
|
|
1758
|
+
getConfig: _getConfig,
|
|
1759
|
+
hasNext: function () {
|
|
1760
|
+
return !!_nextProxy;
|
|
1761
|
+
},
|
|
1762
|
+
getNext: function () {
|
|
1763
|
+
return _nextProxy;
|
|
1764
|
+
},
|
|
1765
|
+
setNext: function (nextPlugin) {
|
|
1766
|
+
_nextProxy = nextPlugin;
|
|
1767
|
+
},
|
|
1768
|
+
iterate: _iterateChain,
|
|
1769
|
+
onComplete: _addOnComplete
|
|
1770
|
+
}
|
|
1771
|
+
};
|
|
1772
|
+
function _addOnComplete(onComplete, that) {
|
|
1773
|
+
var args = [];
|
|
1774
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1775
|
+
args[_i - 2] = arguments[_i];
|
|
1776
|
+
}
|
|
1777
|
+
if (onComplete) {
|
|
1778
|
+
_onComplete.push({
|
|
1779
|
+
func: onComplete,
|
|
1780
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1781
|
+
args: args
|
|
1782
|
+
});
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
function _moveNext() {
|
|
1786
|
+
var nextProxy = _nextProxy;
|
|
1787
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1788
|
+
if (!nextProxy) {
|
|
1789
|
+
var onComplete = _onComplete;
|
|
1790
|
+
if (onComplete && onComplete.length > 0) {
|
|
1791
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
1792
|
+
try {
|
|
1793
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1794
|
+
}
|
|
1795
|
+
catch (e) {
|
|
1796
|
+
_throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1797
|
+
}
|
|
1798
|
+
});
|
|
1799
|
+
_onComplete = [];
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
return nextProxy;
|
|
1803
|
+
}
|
|
1804
|
+
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1805
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1806
|
+
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
1807
|
+
var theConfig;
|
|
1808
|
+
if (config) {
|
|
1809
|
+
var extConfig = config.extensionConfig;
|
|
1810
|
+
if (extConfig && identifier) {
|
|
1811
|
+
theConfig = extConfig[identifier];
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
if (!theConfig) {
|
|
1815
|
+
theConfig = defaultValue;
|
|
1816
|
+
}
|
|
1817
|
+
else if (isObject(defaultValue)) {
|
|
1818
|
+
if (mergeDefault !== 0 ) {
|
|
1819
|
+
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1820
|
+
if (config && mergeDefault === 2 ) {
|
|
1821
|
+
objForEachKey(defaultValue, function (field) {
|
|
1822
|
+
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1823
|
+
var cfgValue = config[field];
|
|
1824
|
+
if (!isNullOrUndefined(cfgValue)) {
|
|
1825
|
+
newConfig_1[field] = cfgValue;
|
|
1826
|
+
}
|
|
1766
1827
|
}
|
|
1767
1828
|
});
|
|
1768
1829
|
}
|
|
1769
|
-
}
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
return theConfig;
|
|
1833
|
+
}
|
|
1834
|
+
function _getConfig(identifier, field, defaultValue) {
|
|
1835
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
1836
|
+
var theValue;
|
|
1837
|
+
var extConfig = _getExtCfg(identifier, null);
|
|
1838
|
+
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1839
|
+
theValue = extConfig[field];
|
|
1840
|
+
}
|
|
1841
|
+
else if (config && !isNullOrUndefined(config[field])) {
|
|
1842
|
+
theValue = config[field];
|
|
1843
|
+
}
|
|
1844
|
+
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1845
|
+
}
|
|
1846
|
+
function _iterateChain(cb) {
|
|
1847
|
+
var nextPlugin;
|
|
1848
|
+
while (!!(nextPlugin = context._next())) {
|
|
1849
|
+
var plugin = nextPlugin.getPlugin();
|
|
1850
|
+
if (plugin) {
|
|
1851
|
+
cb(plugin);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
return context;
|
|
1856
|
+
}
|
|
1857
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1858
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1859
|
+
var context = internalContext.ctx;
|
|
1860
|
+
function _processNext(env) {
|
|
1861
|
+
var nextPlugin = internalContext._next();
|
|
1862
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1863
|
+
return !nextPlugin;
|
|
1864
|
+
}
|
|
1865
|
+
function _createNew(plugins, startAt) {
|
|
1866
|
+
if (plugins === void 0) { plugins = null; }
|
|
1867
|
+
if (isArray(plugins)) {
|
|
1868
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1869
|
+
}
|
|
1870
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1871
|
+
}
|
|
1872
|
+
context.processNext = _processNext;
|
|
1873
|
+
context.createNew = _createNew;
|
|
1874
|
+
return context;
|
|
1875
|
+
}
|
|
1876
|
+
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1877
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1878
|
+
var context = internalContext.ctx;
|
|
1879
|
+
function _processNext(unloadState) {
|
|
1880
|
+
var nextPlugin = internalContext._next();
|
|
1881
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1882
|
+
return !nextPlugin;
|
|
1883
|
+
}
|
|
1884
|
+
function _createNew(plugins, startAt) {
|
|
1885
|
+
if (plugins === void 0) { plugins = null; }
|
|
1886
|
+
if (isArray(plugins)) {
|
|
1887
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1888
|
+
}
|
|
1889
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1890
|
+
}
|
|
1891
|
+
context.processNext = _processNext;
|
|
1892
|
+
context.createNew = _createNew;
|
|
1893
|
+
return context;
|
|
1894
|
+
}
|
|
1895
|
+
function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
|
|
1896
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1897
|
+
var context = internalContext.ctx;
|
|
1898
|
+
function _processNext(updateState) {
|
|
1899
|
+
return context.iterate(function (plugin) {
|
|
1900
|
+
if (isFunction(plugin[strUpdate])) {
|
|
1901
|
+
plugin[strUpdate](context, updateState);
|
|
1902
|
+
}
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
function _createNew(plugins, startAt) {
|
|
1906
|
+
if (plugins === void 0) { plugins = null; }
|
|
1907
|
+
if (isArray(plugins)) {
|
|
1908
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1909
|
+
}
|
|
1910
|
+
return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
|
|
1911
|
+
}
|
|
1912
|
+
context.processNext = _processNext;
|
|
1913
|
+
context.createNew = _createNew;
|
|
1914
|
+
return context;
|
|
1915
|
+
}
|
|
1916
|
+
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
1917
|
+
var firstProxy = null;
|
|
1918
|
+
var add = startAt ? false : true;
|
|
1919
|
+
if (isArray(plugins) && plugins.length > 0) {
|
|
1920
|
+
var lastProxy_1 = null;
|
|
1921
|
+
arrForEach(plugins, function (thePlugin) {
|
|
1922
|
+
if (!add && startAt === thePlugin) {
|
|
1923
|
+
add = true;
|
|
1924
|
+
}
|
|
1925
|
+
if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1926
|
+
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
1927
|
+
if (!firstProxy) {
|
|
1928
|
+
firstProxy = newProxy;
|
|
1929
|
+
}
|
|
1930
|
+
if (lastProxy_1) {
|
|
1931
|
+
lastProxy_1._setNext(newProxy);
|
|
1932
|
+
}
|
|
1933
|
+
lastProxy_1 = newProxy;
|
|
1934
|
+
}
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
1937
|
+
if (startAt && !firstProxy) {
|
|
1938
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1939
|
+
}
|
|
1940
|
+
return firstProxy;
|
|
1941
|
+
}
|
|
1942
|
+
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1943
|
+
var nextProxy = null;
|
|
1944
|
+
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1945
|
+
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1946
|
+
var chainId;
|
|
1947
|
+
if (plugin) {
|
|
1948
|
+
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1949
|
+
}
|
|
1950
|
+
else {
|
|
1951
|
+
chainId = "Unknown-0-" + _chainId++;
|
|
1952
|
+
}
|
|
1953
|
+
var proxyChain = {
|
|
1954
|
+
getPlugin: function () {
|
|
1955
|
+
return plugin;
|
|
1956
|
+
},
|
|
1957
|
+
getNext: function () {
|
|
1958
|
+
return nextProxy;
|
|
1959
|
+
},
|
|
1960
|
+
processTelemetry: _processTelemetry,
|
|
1961
|
+
unload: _unloadPlugin,
|
|
1962
|
+
update: _updatePlugin,
|
|
1963
|
+
_id: chainId,
|
|
1964
|
+
_setNext: function (nextPlugin) {
|
|
1965
|
+
nextProxy = nextPlugin;
|
|
1966
|
+
}
|
|
1967
|
+
};
|
|
1968
|
+
function _getTelCtx() {
|
|
1969
|
+
var itemCtx;
|
|
1970
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1971
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1972
|
+
}
|
|
1973
|
+
if (!itemCtx) {
|
|
1974
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1975
|
+
}
|
|
1976
|
+
return itemCtx;
|
|
1977
|
+
}
|
|
1978
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1979
|
+
var hasRun = false;
|
|
1980
|
+
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1981
|
+
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1982
|
+
if (!hasRunContext) {
|
|
1983
|
+
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1984
|
+
}
|
|
1985
|
+
itemCtx.setNext(nextProxy);
|
|
1986
|
+
if (plugin) {
|
|
1987
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1988
|
+
hasRunContext[chainId] = true;
|
|
1989
|
+
try {
|
|
1990
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty;
|
|
1991
|
+
if (nextId) {
|
|
1992
|
+
hasRunContext[nextId] = false;
|
|
1993
|
+
}
|
|
1994
|
+
hasRun = processPluginFn(itemCtx);
|
|
1776
1995
|
}
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
throwError(ChannelValidationMessage + queueItem.identifier);
|
|
1996
|
+
catch (error) {
|
|
1997
|
+
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1998
|
+
if (hasNextRun) {
|
|
1999
|
+
hasRun = true;
|
|
2000
|
+
}
|
|
2001
|
+
if (!nextProxy || !hasNextRun) {
|
|
2002
|
+
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
2003
|
+
}
|
|
1786
2004
|
}
|
|
1787
|
-
});
|
|
2005
|
+
}, details, isAsync);
|
|
1788
2006
|
}
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
2007
|
+
return hasRun;
|
|
2008
|
+
}
|
|
2009
|
+
function _processTelemetry(env, itemCtx) {
|
|
2010
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
2011
|
+
function _callProcessTelemetry(itemCtx) {
|
|
2012
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
2013
|
+
return false;
|
|
2014
|
+
}
|
|
2015
|
+
var pluginState = _getPluginState(plugin);
|
|
2016
|
+
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
2017
|
+
return false;
|
|
1796
2018
|
}
|
|
2019
|
+
if (hasSetNext) {
|
|
2020
|
+
plugin.setNextPlugin(nextProxy);
|
|
2021
|
+
}
|
|
2022
|
+
plugin.processTelemetry(env, itemCtx);
|
|
2023
|
+
return true;
|
|
1797
2024
|
}
|
|
1798
|
-
function
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
2025
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
2026
|
+
itemCtx.processNext(env);
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
2030
|
+
function _callTeardown() {
|
|
2031
|
+
var hasRun = false;
|
|
2032
|
+
if (plugin) {
|
|
2033
|
+
var pluginState = _getPluginState(plugin);
|
|
2034
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
2035
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
2036
|
+
pluginState[strCore] = null;
|
|
2037
|
+
pluginState[strTeardown] = true;
|
|
2038
|
+
pluginState[strIsInitialized] = false;
|
|
2039
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
2040
|
+
hasRun = true;
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
1802
2043
|
}
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
2044
|
+
return hasRun;
|
|
2045
|
+
}
|
|
2046
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
2047
|
+
unloadCtx.processNext(unloadState);
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
function _updatePlugin(updateCtx, updateState) {
|
|
2051
|
+
function _callUpdate() {
|
|
2052
|
+
var hasRun = false;
|
|
2053
|
+
if (plugin) {
|
|
2054
|
+
var pluginState = _getPluginState(plugin);
|
|
2055
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
2056
|
+
if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
2057
|
+
if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
|
|
2058
|
+
hasRun = true;
|
|
1808
2059
|
}
|
|
1809
|
-
}
|
|
1810
|
-
_addChannelQueue(extensionQueue_1);
|
|
2060
|
+
}
|
|
1811
2061
|
}
|
|
2062
|
+
return hasRun;
|
|
2063
|
+
}
|
|
2064
|
+
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
2065
|
+
updateCtx.processNext(updateState);
|
|
1812
2066
|
}
|
|
1813
|
-
return _this;
|
|
1814
2067
|
}
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
2068
|
+
return objFreeze(proxyChain);
|
|
2069
|
+
}
|
|
2070
|
+
var ProcessTelemetryContext = /** @class */ (function () {
|
|
2071
|
+
function ProcessTelemetryContext(pluginChain, config, core, startAt) {
|
|
2072
|
+
var _self = this;
|
|
2073
|
+
var context = createProcessTelemetryContext(pluginChain, config, core, startAt);
|
|
2074
|
+
proxyFunctions(_self, context, objKeys(context));
|
|
2075
|
+
}
|
|
2076
|
+
return ProcessTelemetryContext;
|
|
2077
|
+
}());
|
|
1822
2078
|
|
|
1823
2079
|
var strToGMTString = "toGMTString";
|
|
1824
2080
|
var strToUTCString = "toUTCString";
|
|
@@ -1828,7 +2084,6 @@
|
|
|
1828
2084
|
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
1829
2085
|
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
1830
2086
|
var strConfigCookieMgr = "_ckMgr";
|
|
1831
|
-
var strEmpty = "";
|
|
1832
2087
|
var _supportsCookies = null;
|
|
1833
2088
|
var _allowUaSameSite = null;
|
|
1834
2089
|
var _parsedCookieValue = null;
|
|
@@ -1986,106 +2241,599 @@
|
|
|
1986
2241
|
var doc = _doc || {};
|
|
1987
2242
|
_supportsCookies = doc[strCookie] !== undefined;
|
|
1988
2243
|
}
|
|
1989
|
-
catch (e) {
|
|
1990
|
-
logger
|
|
2244
|
+
catch (e) {
|
|
2245
|
+
_throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
return _supportsCookies;
|
|
2249
|
+
}
|
|
2250
|
+
function _extractParts(theValue) {
|
|
2251
|
+
var values = {};
|
|
2252
|
+
if (theValue && theValue.length) {
|
|
2253
|
+
var parts = strTrim(theValue).split(";");
|
|
2254
|
+
arrForEach(parts, function (thePart) {
|
|
2255
|
+
thePart = strTrim(thePart || strEmpty);
|
|
2256
|
+
if (thePart) {
|
|
2257
|
+
var idx = thePart.indexOf("=");
|
|
2258
|
+
if (idx === -1) {
|
|
2259
|
+
values[thePart] = null;
|
|
2260
|
+
}
|
|
2261
|
+
else {
|
|
2262
|
+
values[strTrim(thePart.substring(0, idx))] = strTrim(thePart.substring(idx + 1));
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
});
|
|
2266
|
+
}
|
|
2267
|
+
return values;
|
|
2268
|
+
}
|
|
2269
|
+
function _formatDate(theDate, func) {
|
|
2270
|
+
if (isFunction(theDate[func])) {
|
|
2271
|
+
return theDate[func]();
|
|
2272
|
+
}
|
|
2273
|
+
return null;
|
|
2274
|
+
}
|
|
2275
|
+
function _formatCookieValue(value, values) {
|
|
2276
|
+
var cookieValue = value || strEmpty;
|
|
2277
|
+
objForEachKey(values, function (name, theValue) {
|
|
2278
|
+
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
|
|
2279
|
+
});
|
|
2280
|
+
return cookieValue;
|
|
2281
|
+
}
|
|
2282
|
+
function _getCookieValue(name) {
|
|
2283
|
+
var cookieValue = strEmpty;
|
|
2284
|
+
if (_doc) {
|
|
2285
|
+
var theCookie = _doc[strCookie] || strEmpty;
|
|
2286
|
+
if (_parsedCookieValue !== theCookie) {
|
|
2287
|
+
_cookieCache = _extractParts(theCookie);
|
|
2288
|
+
_parsedCookieValue = theCookie;
|
|
2289
|
+
}
|
|
2290
|
+
cookieValue = strTrim(_cookieCache[name] || strEmpty);
|
|
2291
|
+
}
|
|
2292
|
+
return cookieValue;
|
|
2293
|
+
}
|
|
2294
|
+
function _setCookieValue(name, cookieValue) {
|
|
2295
|
+
if (_doc) {
|
|
2296
|
+
_doc[strCookie] = name + "=" + cookieValue;
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
function uaDisallowsSameSiteNone(userAgent) {
|
|
2300
|
+
if (!isString(userAgent)) {
|
|
2301
|
+
return false;
|
|
2302
|
+
}
|
|
2303
|
+
if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
|
|
2304
|
+
return true;
|
|
2305
|
+
}
|
|
2306
|
+
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
|
|
2307
|
+
return true;
|
|
2308
|
+
}
|
|
2309
|
+
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
|
|
2310
|
+
return true;
|
|
2311
|
+
}
|
|
2312
|
+
if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
|
|
2313
|
+
return true;
|
|
2314
|
+
}
|
|
2315
|
+
if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
|
|
2316
|
+
return true;
|
|
2317
|
+
}
|
|
2318
|
+
if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
|
|
2319
|
+
return true;
|
|
2320
|
+
}
|
|
2321
|
+
return false;
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
var strIKey = "iKey";
|
|
2325
|
+
var strExtensionConfig = "extensionConfig";
|
|
2326
|
+
|
|
2327
|
+
var ChannelControllerPriority = 500;
|
|
2328
|
+
var ChannelValidationMessage = "Channel has invalid priority - ";
|
|
2329
|
+
function _addChannelQueue(channelQueue, queue, config, core) {
|
|
2330
|
+
if (queue && isArray(queue) && queue.length > 0) {
|
|
2331
|
+
queue = queue.sort(function (a, b) {
|
|
2332
|
+
return a.priority - b.priority;
|
|
2333
|
+
});
|
|
2334
|
+
arrForEach(queue, function (queueItem) {
|
|
2335
|
+
if (queueItem.priority < ChannelControllerPriority) {
|
|
2336
|
+
throwError(ChannelValidationMessage + queueItem.identifier);
|
|
2337
|
+
}
|
|
2338
|
+
});
|
|
2339
|
+
channelQueue.push({
|
|
2340
|
+
queue: objFreeze(queue),
|
|
2341
|
+
chain: createTelemetryProxyChain(queue, config, core)
|
|
2342
|
+
});
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2345
|
+
function createChannelControllerPlugin(channelQueue, core) {
|
|
2346
|
+
var _a;
|
|
2347
|
+
function _getTelCtx() {
|
|
2348
|
+
return createProcessTelemetryContext(null, core.config, core, null);
|
|
2349
|
+
}
|
|
2350
|
+
function _processChannelQueue(theChannels, itemCtx, processFn, onComplete) {
|
|
2351
|
+
var waiting = theChannels ? (theChannels.length + 1) : 1;
|
|
2352
|
+
function _runChainOnComplete() {
|
|
2353
|
+
waiting--;
|
|
2354
|
+
if (waiting === 0) {
|
|
2355
|
+
onComplete && onComplete();
|
|
2356
|
+
onComplete = null;
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
if (waiting > 0) {
|
|
2360
|
+
arrForEach(theChannels, function (channels) {
|
|
2361
|
+
if (channels && channels.queue.length > 0) {
|
|
2362
|
+
var channelChain = channels.chain;
|
|
2363
|
+
var chainCtx = itemCtx.createNew(channelChain);
|
|
2364
|
+
chainCtx.onComplete(_runChainOnComplete);
|
|
2365
|
+
processFn(chainCtx);
|
|
2366
|
+
}
|
|
2367
|
+
else {
|
|
2368
|
+
waiting--;
|
|
2369
|
+
}
|
|
2370
|
+
});
|
|
2371
|
+
}
|
|
2372
|
+
_runChainOnComplete();
|
|
2373
|
+
}
|
|
2374
|
+
function _doUpdate(updateCtx, updateState) {
|
|
2375
|
+
var theUpdateState = updateState || {
|
|
2376
|
+
reason: 0
|
|
2377
|
+
};
|
|
2378
|
+
_processChannelQueue(channelQueue, updateCtx, function (chainCtx) {
|
|
2379
|
+
chainCtx[strProcessNext](theUpdateState);
|
|
2380
|
+
}, function () {
|
|
2381
|
+
updateCtx[strProcessNext](theUpdateState);
|
|
2382
|
+
});
|
|
2383
|
+
return true;
|
|
2384
|
+
}
|
|
2385
|
+
function _doTeardown(unloadCtx, unloadState) {
|
|
2386
|
+
var theUnloadState = unloadState || {
|
|
2387
|
+
reason: 0 ,
|
|
2388
|
+
isAsync: false
|
|
2389
|
+
};
|
|
2390
|
+
_processChannelQueue(channelQueue, unloadCtx, function (chainCtx) {
|
|
2391
|
+
chainCtx[strProcessNext](theUnloadState);
|
|
2392
|
+
}, function () {
|
|
2393
|
+
unloadCtx[strProcessNext](theUnloadState);
|
|
2394
|
+
isInitialized = false;
|
|
2395
|
+
});
|
|
2396
|
+
return true;
|
|
2397
|
+
}
|
|
2398
|
+
function _getChannel(pluginIdentifier) {
|
|
2399
|
+
var thePlugin = null;
|
|
2400
|
+
if (channelQueue && channelQueue.length > 0) {
|
|
2401
|
+
arrForEach(channelQueue, function (channels) {
|
|
2402
|
+
if (channels && channels.queue.length > 0) {
|
|
2403
|
+
arrForEach(channels.queue, function (ext) {
|
|
2404
|
+
if (ext.identifier === pluginIdentifier) {
|
|
2405
|
+
thePlugin = ext;
|
|
2406
|
+
return -1;
|
|
2407
|
+
}
|
|
2408
|
+
});
|
|
2409
|
+
if (thePlugin) {
|
|
2410
|
+
return -1;
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
});
|
|
2414
|
+
}
|
|
2415
|
+
return thePlugin;
|
|
2416
|
+
}
|
|
2417
|
+
var isInitialized = false;
|
|
2418
|
+
var channelController = (_a = {
|
|
2419
|
+
identifier: "ChannelControllerPlugin",
|
|
2420
|
+
priority: ChannelControllerPriority,
|
|
2421
|
+
initialize: function (config, core, extensions, pluginChain) {
|
|
2422
|
+
isInitialized = true;
|
|
2423
|
+
arrForEach(channelQueue, function (channels) {
|
|
2424
|
+
if (channels && channels.queue.length > 0) {
|
|
2425
|
+
initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);
|
|
2426
|
+
}
|
|
2427
|
+
});
|
|
2428
|
+
},
|
|
2429
|
+
isInitialized: function () {
|
|
2430
|
+
return isInitialized;
|
|
2431
|
+
},
|
|
2432
|
+
processTelemetry: function (item, itemCtx) {
|
|
2433
|
+
_processChannelQueue(channelQueue, itemCtx || _getTelCtx(), function (chainCtx) {
|
|
2434
|
+
chainCtx[strProcessNext](item);
|
|
2435
|
+
}, function () {
|
|
2436
|
+
itemCtx[strProcessNext](item);
|
|
2437
|
+
});
|
|
2438
|
+
},
|
|
2439
|
+
update: _doUpdate
|
|
2440
|
+
},
|
|
2441
|
+
_a[strPause] = function () {
|
|
2442
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2443
|
+
chainCtx.iterate(function (plugin) {
|
|
2444
|
+
plugin[strPause] && plugin[strPause]();
|
|
2445
|
+
});
|
|
2446
|
+
}, null);
|
|
2447
|
+
},
|
|
2448
|
+
_a[strResume] = function () {
|
|
2449
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2450
|
+
chainCtx.iterate(function (plugin) {
|
|
2451
|
+
plugin[strResume] && plugin[strResume]();
|
|
2452
|
+
});
|
|
2453
|
+
}, null);
|
|
2454
|
+
},
|
|
2455
|
+
_a[strTeardown] = _doTeardown,
|
|
2456
|
+
_a.getChannel = _getChannel,
|
|
2457
|
+
_a.flush = function (isAsync, callBack, sendReason, cbTimeout) {
|
|
2458
|
+
var waiting = 1;
|
|
2459
|
+
var doneIterating = false;
|
|
2460
|
+
var cbTimer = null;
|
|
2461
|
+
cbTimeout = cbTimeout || 5000;
|
|
2462
|
+
function doCallback() {
|
|
2463
|
+
waiting--;
|
|
2464
|
+
if (doneIterating && waiting === 0) {
|
|
2465
|
+
if (cbTimer) {
|
|
2466
|
+
clearTimeout(cbTimer);
|
|
2467
|
+
cbTimer = null;
|
|
2468
|
+
}
|
|
2469
|
+
callBack && callBack(doneIterating);
|
|
2470
|
+
callBack = null;
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2474
|
+
chainCtx.iterate(function (plugin) {
|
|
2475
|
+
if (plugin.flush) {
|
|
2476
|
+
waiting++;
|
|
2477
|
+
var handled_1 = false;
|
|
2478
|
+
if (!plugin.flush(isAsync, function () {
|
|
2479
|
+
handled_1 = true;
|
|
2480
|
+
doCallback();
|
|
2481
|
+
}, sendReason)) {
|
|
2482
|
+
if (!handled_1) {
|
|
2483
|
+
if (isAsync && cbTimer == null) {
|
|
2484
|
+
cbTimer = setTimeout(function () {
|
|
2485
|
+
cbTimer = null;
|
|
2486
|
+
doCallback();
|
|
2487
|
+
}, cbTimeout);
|
|
2488
|
+
}
|
|
2489
|
+
else {
|
|
2490
|
+
doCallback();
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
});
|
|
2496
|
+
}, function () {
|
|
2497
|
+
doneIterating = true;
|
|
2498
|
+
doCallback();
|
|
2499
|
+
});
|
|
2500
|
+
return true;
|
|
2501
|
+
},
|
|
2502
|
+
_a._setQueue = function (queue) {
|
|
2503
|
+
channelQueue = queue;
|
|
2504
|
+
},
|
|
2505
|
+
_a);
|
|
2506
|
+
return channelController;
|
|
2507
|
+
}
|
|
2508
|
+
function createChannelQueues(channels, extensions, config, core) {
|
|
2509
|
+
var channelQueue = [];
|
|
2510
|
+
if (channels) {
|
|
2511
|
+
arrForEach(channels, function (queue) { return _addChannelQueue(channelQueue, queue, config, core); });
|
|
2512
|
+
}
|
|
2513
|
+
if (extensions) {
|
|
2514
|
+
var extensionQueue_1 = [];
|
|
2515
|
+
arrForEach(extensions, function (plugin) {
|
|
2516
|
+
if (plugin.priority > ChannelControllerPriority) {
|
|
2517
|
+
extensionQueue_1.push(plugin);
|
|
2518
|
+
}
|
|
2519
|
+
});
|
|
2520
|
+
_addChannelQueue(channelQueue, extensionQueue_1, config, core);
|
|
2521
|
+
}
|
|
2522
|
+
return channelQueue;
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
function createUnloadHandlerContainer() {
|
|
2526
|
+
var handlers = [];
|
|
2527
|
+
function _addHandler(handler) {
|
|
2528
|
+
if (handler) {
|
|
2529
|
+
handlers.push(handler);
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
2533
|
+
arrForEach(handlers, function (handler) {
|
|
2534
|
+
try {
|
|
2535
|
+
handler(unloadCtx, unloadState);
|
|
2536
|
+
}
|
|
2537
|
+
catch (e) {
|
|
2538
|
+
_throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
2539
|
+
}
|
|
2540
|
+
});
|
|
2541
|
+
handlers = [];
|
|
2542
|
+
}
|
|
2543
|
+
return {
|
|
2544
|
+
add: _addHandler,
|
|
2545
|
+
run: _runHandlers
|
|
2546
|
+
};
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
var strGetPlugin = "getPlugin";
|
|
2550
|
+
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
2551
|
+
function BaseTelemetryPlugin() {
|
|
2552
|
+
var _self = this;
|
|
2553
|
+
var _isinitialized;
|
|
2554
|
+
var _rootCtx;
|
|
2555
|
+
var _nextPlugin;
|
|
2556
|
+
var _unloadHandlerContainer;
|
|
2557
|
+
var _hooks;
|
|
2558
|
+
_initDefaults();
|
|
2559
|
+
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
2560
|
+
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
2561
|
+
_setDefaults(config, core, pluginChain);
|
|
2562
|
+
_isinitialized = true;
|
|
2563
|
+
};
|
|
2564
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
2565
|
+
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
2566
|
+
return;
|
|
2567
|
+
}
|
|
2568
|
+
var result;
|
|
2569
|
+
var unloadDone = false;
|
|
2570
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
2571
|
+
var theUnloadState = unloadState || {
|
|
2572
|
+
reason: 0 ,
|
|
2573
|
+
isAsync: false
|
|
2574
|
+
};
|
|
2575
|
+
function _unloadCallback() {
|
|
2576
|
+
if (!unloadDone) {
|
|
2577
|
+
unloadDone = true;
|
|
2578
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
2579
|
+
arrForEach(_hooks, function (fn) {
|
|
2580
|
+
fn.rm();
|
|
2581
|
+
});
|
|
2582
|
+
_hooks = [];
|
|
2583
|
+
if (result === true) {
|
|
2584
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
2585
|
+
}
|
|
2586
|
+
_initDefaults();
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
2590
|
+
_unloadCallback();
|
|
2591
|
+
}
|
|
2592
|
+
else {
|
|
2593
|
+
result = true;
|
|
2594
|
+
}
|
|
2595
|
+
return result;
|
|
2596
|
+
};
|
|
2597
|
+
_self.update = function (updateCtx, updateState) {
|
|
2598
|
+
if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
|
|
2599
|
+
return;
|
|
2600
|
+
}
|
|
2601
|
+
var result;
|
|
2602
|
+
var updateDone = false;
|
|
2603
|
+
var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
2604
|
+
var theUpdateState = updateState || {
|
|
2605
|
+
reason: 0
|
|
2606
|
+
};
|
|
2607
|
+
function _updateCallback() {
|
|
2608
|
+
if (!updateDone) {
|
|
2609
|
+
updateDone = true;
|
|
2610
|
+
_setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
|
|
2614
|
+
_updateCallback();
|
|
2615
|
+
}
|
|
2616
|
+
else {
|
|
2617
|
+
result = true;
|
|
2618
|
+
}
|
|
2619
|
+
return result;
|
|
2620
|
+
};
|
|
2621
|
+
_self._addHook = function (hooks) {
|
|
2622
|
+
if (hooks) {
|
|
2623
|
+
if (isArray(hooks)) {
|
|
2624
|
+
_hooks = _hooks.concat(hooks);
|
|
2625
|
+
}
|
|
2626
|
+
else {
|
|
2627
|
+
_hooks.push(hooks);
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
};
|
|
2631
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
2632
|
+
});
|
|
2633
|
+
_self.diagLog = function (itemCtx) {
|
|
2634
|
+
return _getTelCtx(itemCtx).diagLog();
|
|
2635
|
+
};
|
|
2636
|
+
_self[strIsInitialized] = function () {
|
|
2637
|
+
return _isinitialized;
|
|
2638
|
+
};
|
|
2639
|
+
_self.setInitialized = function (isInitialized) {
|
|
2640
|
+
_isinitialized = isInitialized;
|
|
2641
|
+
};
|
|
2642
|
+
_self[strSetNextPlugin] = function (next) {
|
|
2643
|
+
_nextPlugin = next;
|
|
2644
|
+
};
|
|
2645
|
+
_self.processNext = function (env, itemCtx) {
|
|
2646
|
+
if (itemCtx) {
|
|
2647
|
+
itemCtx.processNext(env);
|
|
2648
|
+
}
|
|
2649
|
+
else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
|
|
2650
|
+
_nextPlugin.processTelemetry(env, null);
|
|
2651
|
+
}
|
|
2652
|
+
};
|
|
2653
|
+
_self._getTelCtx = _getTelCtx;
|
|
2654
|
+
function _getTelCtx(currentCtx) {
|
|
2655
|
+
if (currentCtx === void 0) { currentCtx = null; }
|
|
2656
|
+
var itemCtx = currentCtx;
|
|
2657
|
+
if (!itemCtx) {
|
|
2658
|
+
var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
|
|
2659
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
2660
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
2661
|
+
}
|
|
2662
|
+
else {
|
|
2663
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin);
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
return itemCtx;
|
|
2667
|
+
}
|
|
2668
|
+
function _setDefaults(config, core, pluginChain) {
|
|
2669
|
+
if (config) {
|
|
2670
|
+
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
2671
|
+
}
|
|
2672
|
+
if (!pluginChain && core) {
|
|
2673
|
+
pluginChain = core.getProcessTelContext().getNext();
|
|
2674
|
+
}
|
|
2675
|
+
var nextPlugin = _nextPlugin;
|
|
2676
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
2677
|
+
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
2678
|
+
}
|
|
2679
|
+
_self.core = core;
|
|
2680
|
+
_rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
2681
|
+
}
|
|
2682
|
+
function _initDefaults() {
|
|
2683
|
+
_isinitialized = false;
|
|
2684
|
+
_self.core = null;
|
|
2685
|
+
_rootCtx = null;
|
|
2686
|
+
_nextPlugin = null;
|
|
2687
|
+
_hooks = [];
|
|
2688
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
1991
2689
|
}
|
|
1992
2690
|
}
|
|
1993
|
-
return
|
|
1994
|
-
}
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2691
|
+
return BaseTelemetryPlugin;
|
|
2692
|
+
}());
|
|
2693
|
+
|
|
2694
|
+
var TelemetryInitializerPlugin = /** @class */ (function (_super) {
|
|
2695
|
+
__extendsFn(TelemetryInitializerPlugin, _super);
|
|
2696
|
+
function TelemetryInitializerPlugin() {
|
|
2697
|
+
var _this = _super.call(this) || this;
|
|
2698
|
+
_this.identifier = "TelemetryInitializerPlugin";
|
|
2699
|
+
_this.priority = 199;
|
|
2700
|
+
var _id;
|
|
2701
|
+
var _initializers;
|
|
2702
|
+
_initDefaults();
|
|
2703
|
+
dynamicProto(TelemetryInitializerPlugin, _this, function (_self, _base) {
|
|
2704
|
+
_self.addTelemetryInitializer = function (telemetryInitializer) {
|
|
2705
|
+
var theInitializer = {
|
|
2706
|
+
id: _id++,
|
|
2707
|
+
fn: telemetryInitializer
|
|
2708
|
+
};
|
|
2709
|
+
_initializers.push(theInitializer);
|
|
2710
|
+
var handler = {
|
|
2711
|
+
remove: function () {
|
|
2712
|
+
arrForEach(_initializers, function (initializer, idx) {
|
|
2713
|
+
if (initializer.id === theInitializer.id) {
|
|
2714
|
+
_initializers.splice(idx, 1);
|
|
2715
|
+
return -1;
|
|
2716
|
+
}
|
|
2717
|
+
});
|
|
2718
|
+
}
|
|
2719
|
+
};
|
|
2720
|
+
return handler;
|
|
2721
|
+
};
|
|
2722
|
+
_self.processTelemetry = function (item, itemCtx) {
|
|
2723
|
+
var doNotSendItem = false;
|
|
2724
|
+
var telemetryInitializersCount = _initializers.length;
|
|
2725
|
+
for (var i = 0; i < telemetryInitializersCount; ++i) {
|
|
2726
|
+
var telemetryInitializer = _initializers[i];
|
|
2727
|
+
if (telemetryInitializer) {
|
|
2728
|
+
try {
|
|
2729
|
+
if (telemetryInitializer.fn.apply(null, [item]) === false) {
|
|
2730
|
+
doNotSendItem = true;
|
|
2731
|
+
break;
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2734
|
+
catch (e) {
|
|
2735
|
+
_throwInternal(itemCtx.diagLog(), 1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2005
2738
|
}
|
|
2006
|
-
|
|
2007
|
-
|
|
2739
|
+
if (!doNotSendItem) {
|
|
2740
|
+
_self.processNext(item, itemCtx);
|
|
2008
2741
|
}
|
|
2009
|
-
}
|
|
2742
|
+
};
|
|
2743
|
+
_self[strDoTeardown] = function () {
|
|
2744
|
+
_initDefaults();
|
|
2745
|
+
};
|
|
2010
2746
|
});
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
function _formatDate(theDate, func) {
|
|
2015
|
-
if (isFunction(theDate[func])) {
|
|
2016
|
-
return theDate[func]();
|
|
2017
|
-
}
|
|
2018
|
-
return null;
|
|
2019
|
-
}
|
|
2020
|
-
function _formatCookieValue(value, values) {
|
|
2021
|
-
var cookieValue = value || strEmpty;
|
|
2022
|
-
objForEachKey(values, function (name, theValue) {
|
|
2023
|
-
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
|
|
2024
|
-
});
|
|
2025
|
-
return cookieValue;
|
|
2026
|
-
}
|
|
2027
|
-
function _getCookieValue(name) {
|
|
2028
|
-
var cookieValue = strEmpty;
|
|
2029
|
-
if (_doc) {
|
|
2030
|
-
var theCookie = _doc[strCookie] || strEmpty;
|
|
2031
|
-
if (_parsedCookieValue !== theCookie) {
|
|
2032
|
-
_cookieCache = _extractParts(theCookie);
|
|
2033
|
-
_parsedCookieValue = theCookie;
|
|
2747
|
+
function _initDefaults() {
|
|
2748
|
+
_id = 0;
|
|
2749
|
+
_initializers = [];
|
|
2034
2750
|
}
|
|
2035
|
-
|
|
2036
|
-
}
|
|
2037
|
-
return cookieValue;
|
|
2038
|
-
}
|
|
2039
|
-
function _setCookieValue(name, cookieValue) {
|
|
2040
|
-
if (_doc) {
|
|
2041
|
-
_doc[strCookie] = name + "=" + cookieValue;
|
|
2042
|
-
}
|
|
2043
|
-
}
|
|
2044
|
-
function uaDisallowsSameSiteNone(userAgent) {
|
|
2045
|
-
if (!isString(userAgent)) {
|
|
2046
|
-
return false;
|
|
2047
|
-
}
|
|
2048
|
-
if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
|
|
2049
|
-
return true;
|
|
2050
|
-
}
|
|
2051
|
-
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
|
|
2052
|
-
return true;
|
|
2053
|
-
}
|
|
2054
|
-
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
|
|
2055
|
-
return true;
|
|
2056
|
-
}
|
|
2057
|
-
if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
|
|
2058
|
-
return true;
|
|
2059
|
-
}
|
|
2060
|
-
if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
|
|
2061
|
-
return true;
|
|
2062
|
-
}
|
|
2063
|
-
if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
|
|
2064
|
-
return true;
|
|
2751
|
+
return _this;
|
|
2065
2752
|
}
|
|
2066
|
-
return
|
|
2067
|
-
}
|
|
2753
|
+
return TelemetryInitializerPlugin;
|
|
2754
|
+
}(BaseTelemetryPlugin));
|
|
2068
2755
|
|
|
2069
|
-
var
|
|
2756
|
+
var strValidationError = "Plugins must provide initialize method";
|
|
2070
2757
|
var strNotificationManager = "_notificationManager";
|
|
2758
|
+
var strSdkUnloadingError = "SDK is still unloading...";
|
|
2759
|
+
var strSdkNotInitialized = "SDK is not initialized";
|
|
2071
2760
|
function _createPerfManager(core, notificationMgr) {
|
|
2072
2761
|
return new PerfManager(notificationMgr);
|
|
2073
2762
|
}
|
|
2763
|
+
function _validateExtensions(logger, channelPriority, allExtensions) {
|
|
2764
|
+
var coreExtensions = [];
|
|
2765
|
+
var extPriorities = {};
|
|
2766
|
+
arrForEach(allExtensions, function (ext) {
|
|
2767
|
+
if (isNullOrUndefined(ext) || isNullOrUndefined(ext.initialize)) {
|
|
2768
|
+
throwError(strValidationError);
|
|
2769
|
+
}
|
|
2770
|
+
var extPriority = ext.priority;
|
|
2771
|
+
var identifier = ext.identifier;
|
|
2772
|
+
if (ext && extPriority) {
|
|
2773
|
+
if (!isNullOrUndefined(extPriorities[extPriority])) {
|
|
2774
|
+
_warnToConsole(logger, "Two extensions have same priority #" + extPriority + " - " + extPriorities[extPriority] + ", " + identifier);
|
|
2775
|
+
}
|
|
2776
|
+
else {
|
|
2777
|
+
extPriorities[extPriority] = identifier;
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
if (!extPriority || extPriority < channelPriority) {
|
|
2781
|
+
coreExtensions.push(ext);
|
|
2782
|
+
}
|
|
2783
|
+
});
|
|
2784
|
+
return {
|
|
2785
|
+
all: allExtensions,
|
|
2786
|
+
core: coreExtensions
|
|
2787
|
+
};
|
|
2788
|
+
}
|
|
2789
|
+
function _isPluginPresent(thePlugin, plugins) {
|
|
2790
|
+
var exists = false;
|
|
2791
|
+
arrForEach(plugins, function (plugin) {
|
|
2792
|
+
if (plugin === thePlugin) {
|
|
2793
|
+
exists = true;
|
|
2794
|
+
return -1;
|
|
2795
|
+
}
|
|
2796
|
+
});
|
|
2797
|
+
return exists;
|
|
2798
|
+
}
|
|
2799
|
+
function _createDummyNotificationManager() {
|
|
2800
|
+
var _a;
|
|
2801
|
+
return objCreateFn((_a = {},
|
|
2802
|
+
_a[strAddNotificationListener] = function (listener) { },
|
|
2803
|
+
_a[strRemoveNotificationListener] = function (listener) { },
|
|
2804
|
+
_a[strEventsSent] = function (events) { },
|
|
2805
|
+
_a[strEventsDiscarded] = function (events, reason) { },
|
|
2806
|
+
_a[strEventsSendRequest] = function (sendReason, isAsync) { },
|
|
2807
|
+
_a));
|
|
2808
|
+
}
|
|
2074
2809
|
var BaseCore = /** @class */ (function () {
|
|
2075
2810
|
function BaseCore() {
|
|
2076
|
-
var _isInitialized
|
|
2811
|
+
var _isInitialized;
|
|
2077
2812
|
var _eventQueue;
|
|
2078
|
-
var _channelController;
|
|
2079
2813
|
var _notificationManager;
|
|
2080
2814
|
var _perfManager;
|
|
2815
|
+
var _cfgPerfManager;
|
|
2081
2816
|
var _cookieManager;
|
|
2817
|
+
var _pluginChain;
|
|
2818
|
+
var _configExtensions;
|
|
2819
|
+
var _coreExtensions;
|
|
2820
|
+
var _channelControl;
|
|
2821
|
+
var _channelConfig;
|
|
2822
|
+
var _channelQueue;
|
|
2823
|
+
var _isUnloading;
|
|
2824
|
+
var _telemetryInitializerPlugin;
|
|
2825
|
+
var _internalLogsEventName;
|
|
2826
|
+
var _evtNamespace;
|
|
2827
|
+
var _unloadHandlers;
|
|
2828
|
+
var _debugListener;
|
|
2829
|
+
var _internalLogPoller = 0;
|
|
2082
2830
|
dynamicProto(BaseCore, this, function (_self) {
|
|
2083
|
-
|
|
2084
|
-
_channelController = new ChannelController();
|
|
2085
|
-
_self.logger = new DiagnosticLogger({ loggingLevelConsole: exports.LoggingSeverity.CRITICAL });
|
|
2086
|
-
_eventQueue = [];
|
|
2831
|
+
_initDefaults();
|
|
2087
2832
|
_self.isInitialized = function () { return _isInitialized; };
|
|
2088
2833
|
_self.initialize = function (config, extensions, logger, notificationManager) {
|
|
2834
|
+
if (_isUnloading) {
|
|
2835
|
+
throwError(strSdkUnloadingError);
|
|
2836
|
+
}
|
|
2089
2837
|
if (_self.isInitialized()) {
|
|
2090
2838
|
throwError("Core should not be initialized more than once");
|
|
2091
2839
|
}
|
|
@@ -2095,185 +2843,460 @@
|
|
|
2095
2843
|
_notificationManager = notificationManager;
|
|
2096
2844
|
_self[strNotificationManager] = notificationManager;
|
|
2097
2845
|
_self.config = config || {};
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
}
|
|
2101
|
-
if (_self.config.enablePerfMgr) {
|
|
2102
|
-
setValue(_self.config, "createPerfMgr", _createPerfManager);
|
|
2103
|
-
}
|
|
2846
|
+
_initDebugListener(config);
|
|
2847
|
+
_initPerfManager(config);
|
|
2104
2848
|
config.extensions = isNullOrUndefined(config.extensions) ? [] : config.extensions;
|
|
2105
|
-
|
|
2106
|
-
extConfig.NotificationManager = notificationManager;
|
|
2849
|
+
_initExtConfig(config);
|
|
2107
2850
|
if (logger) {
|
|
2108
2851
|
_self.logger = logger;
|
|
2109
2852
|
}
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
arrForEach(allExtensions, function (ext) {
|
|
2116
|
-
if (isNullOrUndefined(ext) || isNullOrUndefined(ext.initialize)) {
|
|
2117
|
-
throwError(validationError);
|
|
2118
|
-
}
|
|
2119
|
-
var extPriority = ext.priority;
|
|
2120
|
-
var identifier = ext.identifier;
|
|
2121
|
-
if (ext && extPriority) {
|
|
2122
|
-
if (!isNullOrUndefined(extPriorities[extPriority])) {
|
|
2123
|
-
logger.warnToConsole("Two extensions have same priority #" + extPriority + " - " + extPriorities[extPriority] + ", " + identifier);
|
|
2124
|
-
}
|
|
2125
|
-
else {
|
|
2126
|
-
extPriorities[extPriority] = identifier;
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
if (!extPriority || extPriority < _channelController.priority) {
|
|
2130
|
-
coreExtensions.push(ext);
|
|
2131
|
-
}
|
|
2132
|
-
});
|
|
2133
|
-
allExtensions.push(_channelController);
|
|
2134
|
-
coreExtensions.push(_channelController);
|
|
2135
|
-
allExtensions = sortPlugins(allExtensions);
|
|
2136
|
-
_self._extensions = allExtensions;
|
|
2137
|
-
initializePlugins(new ProcessTelemetryContext([_channelController], config, _self), allExtensions);
|
|
2138
|
-
initializePlugins(new ProcessTelemetryContext(coreExtensions, config, _self), allExtensions);
|
|
2139
|
-
_self._extensions = coreExtensions;
|
|
2140
|
-
if (_self.getTransmissionControls().length === 0) {
|
|
2853
|
+
_configExtensions = [];
|
|
2854
|
+
_configExtensions.push.apply(_configExtensions, __spreadArrayFn(__spreadArrayFn([], extensions, false), config.extensions));
|
|
2855
|
+
_channelConfig = (config || {}).channels;
|
|
2856
|
+
_initPluginChain(config, null);
|
|
2857
|
+
if (!_channelQueue || _channelQueue.length === 0) {
|
|
2141
2858
|
throwError("No channels available");
|
|
2142
2859
|
}
|
|
2143
2860
|
_isInitialized = true;
|
|
2144
2861
|
_self.releaseQueue();
|
|
2145
2862
|
};
|
|
2146
2863
|
_self.getTransmissionControls = function () {
|
|
2147
|
-
|
|
2864
|
+
var controls = [];
|
|
2865
|
+
if (_channelQueue) {
|
|
2866
|
+
arrForEach(_channelQueue, function (channels) {
|
|
2867
|
+
controls.push(channels.queue);
|
|
2868
|
+
});
|
|
2869
|
+
}
|
|
2870
|
+
return objFreeze(controls);
|
|
2148
2871
|
};
|
|
2149
2872
|
_self.track = function (telemetryItem) {
|
|
2150
2873
|
setValue(telemetryItem, strIKey, _self.config.instrumentationKey, null, isNotTruthy);
|
|
2151
2874
|
setValue(telemetryItem, "time", toISOString(new Date()), null, isNotTruthy);
|
|
2152
2875
|
setValue(telemetryItem, "ver", "4.0", null, isNullOrUndefined);
|
|
2153
|
-
if (_self.isInitialized()) {
|
|
2154
|
-
|
|
2876
|
+
if (!_isUnloading && _self.isInitialized()) {
|
|
2877
|
+
_createTelCtx().processNext(telemetryItem);
|
|
2155
2878
|
}
|
|
2156
2879
|
else {
|
|
2157
2880
|
_eventQueue.push(telemetryItem);
|
|
2158
2881
|
}
|
|
2159
2882
|
};
|
|
2160
|
-
_self.getProcessTelContext =
|
|
2161
|
-
var extensions = _self._extensions;
|
|
2162
|
-
var thePlugins = extensions;
|
|
2163
|
-
if (!extensions || extensions.length === 0) {
|
|
2164
|
-
thePlugins = [_channelController];
|
|
2165
|
-
}
|
|
2166
|
-
return new ProcessTelemetryContext(thePlugins, _self.config, _self);
|
|
2167
|
-
};
|
|
2883
|
+
_self.getProcessTelContext = _createTelCtx;
|
|
2168
2884
|
_self.getNotifyMgr = function () {
|
|
2169
2885
|
if (!_notificationManager) {
|
|
2170
|
-
_notificationManager =
|
|
2171
|
-
addNotificationListener: function (listener) { },
|
|
2172
|
-
removeNotificationListener: function (listener) { },
|
|
2173
|
-
eventsSent: function (events) { },
|
|
2174
|
-
eventsDiscarded: function (events, reason) { },
|
|
2175
|
-
eventsSendRequest: function (sendReason, isAsync) { }
|
|
2176
|
-
});
|
|
2886
|
+
_notificationManager = _createDummyNotificationManager();
|
|
2177
2887
|
_self[strNotificationManager] = _notificationManager;
|
|
2178
2888
|
}
|
|
2179
|
-
return _notificationManager;
|
|
2180
|
-
};
|
|
2181
|
-
_self
|
|
2182
|
-
if (
|
|
2183
|
-
|
|
2889
|
+
return _notificationManager;
|
|
2890
|
+
};
|
|
2891
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2892
|
+
if (_notificationManager) {
|
|
2893
|
+
_notificationManager[strAddNotificationListener](listener);
|
|
2894
|
+
}
|
|
2895
|
+
};
|
|
2896
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2897
|
+
if (_notificationManager) {
|
|
2898
|
+
_notificationManager[strRemoveNotificationListener](listener);
|
|
2899
|
+
}
|
|
2900
|
+
};
|
|
2901
|
+
_self.getCookieMgr = function () {
|
|
2902
|
+
if (!_cookieManager) {
|
|
2903
|
+
_cookieManager = createCookieMgr(_self.config, _self.logger);
|
|
2904
|
+
}
|
|
2905
|
+
return _cookieManager;
|
|
2906
|
+
};
|
|
2907
|
+
_self.setCookieMgr = function (cookieMgr) {
|
|
2908
|
+
_cookieManager = cookieMgr;
|
|
2909
|
+
};
|
|
2910
|
+
_self.getPerfMgr = function () {
|
|
2911
|
+
if (!_perfManager && !_cfgPerfManager) {
|
|
2912
|
+
if (_self.config && _self.config.enablePerfMgr && isFunction(_self.config.createPerfMgr)) {
|
|
2913
|
+
_cfgPerfManager = _self.config.createPerfMgr(_self, _self.getNotifyMgr());
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
return _perfManager || _cfgPerfManager || getGblPerfMgr();
|
|
2917
|
+
};
|
|
2918
|
+
_self.setPerfMgr = function (perfMgr) {
|
|
2919
|
+
_perfManager = perfMgr;
|
|
2920
|
+
};
|
|
2921
|
+
_self.eventCnt = function () {
|
|
2922
|
+
return _eventQueue.length;
|
|
2923
|
+
};
|
|
2924
|
+
_self.releaseQueue = function () {
|
|
2925
|
+
if (_isInitialized && _eventQueue.length > 0) {
|
|
2926
|
+
var eventQueue = _eventQueue;
|
|
2927
|
+
_eventQueue = [];
|
|
2928
|
+
arrForEach(eventQueue, function (event) {
|
|
2929
|
+
_createTelCtx().processNext(event);
|
|
2930
|
+
});
|
|
2931
|
+
}
|
|
2932
|
+
};
|
|
2933
|
+
_self.pollInternalLogs = function (eventName) {
|
|
2934
|
+
_internalLogsEventName = eventName || null;
|
|
2935
|
+
var interval = _self.config.diagnosticLogInterval;
|
|
2936
|
+
if (!interval || !(interval > 0)) {
|
|
2937
|
+
interval = 10000;
|
|
2938
|
+
}
|
|
2939
|
+
if (_internalLogPoller) {
|
|
2940
|
+
clearInterval(_internalLogPoller);
|
|
2941
|
+
}
|
|
2942
|
+
_internalLogPoller = setInterval(function () {
|
|
2943
|
+
_flushInternalLogs();
|
|
2944
|
+
}, interval);
|
|
2945
|
+
return _internalLogPoller;
|
|
2946
|
+
};
|
|
2947
|
+
_self.stopPollingInternalLogs = function () {
|
|
2948
|
+
if (_internalLogPoller) {
|
|
2949
|
+
clearInterval(_internalLogPoller);
|
|
2950
|
+
_internalLogPoller = 0;
|
|
2951
|
+
_flushInternalLogs();
|
|
2952
|
+
}
|
|
2953
|
+
};
|
|
2954
|
+
proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, ["addTelemetryInitializer"]);
|
|
2955
|
+
_self.unload = function (isAsync, unloadComplete, cbTimeout) {
|
|
2956
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
2957
|
+
if (!_isInitialized) {
|
|
2958
|
+
throwError(strSdkNotInitialized);
|
|
2959
|
+
}
|
|
2960
|
+
if (_isUnloading) {
|
|
2961
|
+
throwError(strSdkUnloadingError);
|
|
2962
|
+
}
|
|
2963
|
+
var unloadState = {
|
|
2964
|
+
reason: 50 ,
|
|
2965
|
+
isAsync: isAsync,
|
|
2966
|
+
flushComplete: false
|
|
2967
|
+
};
|
|
2968
|
+
var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self.config, _self);
|
|
2969
|
+
processUnloadCtx.onComplete(function () {
|
|
2970
|
+
_initDefaults();
|
|
2971
|
+
unloadComplete && unloadComplete(unloadState);
|
|
2972
|
+
}, _self);
|
|
2973
|
+
function _doUnload(flushComplete) {
|
|
2974
|
+
unloadState.flushComplete = flushComplete;
|
|
2975
|
+
_isUnloading = true;
|
|
2976
|
+
_unloadHandlers.run(processUnloadCtx, unloadState);
|
|
2977
|
+
_self.stopPollingInternalLogs();
|
|
2978
|
+
processUnloadCtx.processNext(unloadState);
|
|
2979
|
+
}
|
|
2980
|
+
if (!_flushChannels(isAsync, _doUnload, 6 , cbTimeout)) {
|
|
2981
|
+
_doUnload(false);
|
|
2982
|
+
}
|
|
2983
|
+
};
|
|
2984
|
+
_self.getPlugin = _getPlugin;
|
|
2985
|
+
_self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {
|
|
2986
|
+
if (!plugin) {
|
|
2987
|
+
addCb && addCb(false);
|
|
2988
|
+
_logOrThrowError(strValidationError);
|
|
2989
|
+
return;
|
|
2990
|
+
}
|
|
2991
|
+
var existingPlugin = _getPlugin(plugin.identifier);
|
|
2992
|
+
if (existingPlugin && !replaceExisting) {
|
|
2993
|
+
addCb && addCb(false);
|
|
2994
|
+
_logOrThrowError("Plugin [" + plugin.identifier + "] is already loaded!");
|
|
2995
|
+
return;
|
|
2996
|
+
}
|
|
2997
|
+
var updateState = {
|
|
2998
|
+
reason: 16
|
|
2999
|
+
};
|
|
3000
|
+
function _addPlugin(removed) {
|
|
3001
|
+
_configExtensions.push(plugin);
|
|
3002
|
+
updateState.added = [plugin];
|
|
3003
|
+
_initPluginChain(_self.config, updateState);
|
|
3004
|
+
addCb && addCb(true);
|
|
3005
|
+
}
|
|
3006
|
+
if (existingPlugin) {
|
|
3007
|
+
var removedPlugins_1 = [existingPlugin.plugin];
|
|
3008
|
+
var unloadState = {
|
|
3009
|
+
reason: 2 ,
|
|
3010
|
+
isAsync: !!isAsync
|
|
3011
|
+
};
|
|
3012
|
+
_removePlugins(removedPlugins_1, unloadState, function (removed) {
|
|
3013
|
+
if (!removed) {
|
|
3014
|
+
addCb && addCb(false);
|
|
3015
|
+
}
|
|
3016
|
+
else {
|
|
3017
|
+
updateState.removed = removedPlugins_1;
|
|
3018
|
+
updateState.reason |= 32 ;
|
|
3019
|
+
_addPlugin();
|
|
3020
|
+
}
|
|
3021
|
+
});
|
|
3022
|
+
}
|
|
3023
|
+
else {
|
|
3024
|
+
_addPlugin();
|
|
3025
|
+
}
|
|
3026
|
+
};
|
|
3027
|
+
_self.evtNamespace = function () {
|
|
3028
|
+
return _evtNamespace;
|
|
3029
|
+
};
|
|
3030
|
+
_self.flush = _flushChannels;
|
|
3031
|
+
proxyFunctionAs(_self, "addUnloadCb", function () { return _unloadHandlers; }, "add");
|
|
3032
|
+
function _initDefaults() {
|
|
3033
|
+
_isInitialized = false;
|
|
3034
|
+
_self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 });
|
|
3035
|
+
_self.config = {};
|
|
3036
|
+
_self._extensions = [];
|
|
3037
|
+
_telemetryInitializerPlugin = new TelemetryInitializerPlugin();
|
|
3038
|
+
_eventQueue = [];
|
|
3039
|
+
_notificationManager = null;
|
|
3040
|
+
_perfManager = null;
|
|
3041
|
+
_cfgPerfManager = null;
|
|
3042
|
+
_cookieManager = null;
|
|
3043
|
+
_pluginChain = null;
|
|
3044
|
+
_coreExtensions = null;
|
|
3045
|
+
_configExtensions = [];
|
|
3046
|
+
_channelControl = null;
|
|
3047
|
+
_channelConfig = null;
|
|
3048
|
+
_channelQueue = null;
|
|
3049
|
+
_isUnloading = false;
|
|
3050
|
+
_internalLogsEventName = null;
|
|
3051
|
+
_evtNamespace = createUniqueNamespace("AIBaseCore", true);
|
|
3052
|
+
_unloadHandlers = createUnloadHandlerContainer();
|
|
3053
|
+
}
|
|
3054
|
+
function _createTelCtx() {
|
|
3055
|
+
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
3056
|
+
}
|
|
3057
|
+
function _initPluginChain(config, updateState) {
|
|
3058
|
+
var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
|
|
3059
|
+
_coreExtensions = theExtensions.core;
|
|
3060
|
+
_pluginChain = null;
|
|
3061
|
+
var allExtensions = theExtensions.all;
|
|
3062
|
+
_channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, config, _self));
|
|
3063
|
+
if (_channelControl) {
|
|
3064
|
+
var idx = allExtensions.indexOf(_channelControl);
|
|
3065
|
+
if (idx !== -1) {
|
|
3066
|
+
allExtensions.splice(idx, 1);
|
|
3067
|
+
}
|
|
3068
|
+
idx = _coreExtensions.indexOf(_channelControl);
|
|
3069
|
+
if (idx !== -1) {
|
|
3070
|
+
_coreExtensions.splice(idx, 1);
|
|
3071
|
+
}
|
|
3072
|
+
_channelControl._setQueue(_channelQueue);
|
|
3073
|
+
}
|
|
3074
|
+
else {
|
|
3075
|
+
_channelControl = createChannelControllerPlugin(_channelQueue, _self);
|
|
3076
|
+
}
|
|
3077
|
+
allExtensions.push(_channelControl);
|
|
3078
|
+
_coreExtensions.push(_channelControl);
|
|
3079
|
+
_self._extensions = sortPlugins(allExtensions);
|
|
3080
|
+
_channelControl.initialize(config, _self, allExtensions);
|
|
3081
|
+
initializePlugins(_createTelCtx(), allExtensions);
|
|
3082
|
+
_self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
|
|
3083
|
+
if (updateState) {
|
|
3084
|
+
_doUpdate(updateState);
|
|
3085
|
+
}
|
|
3086
|
+
}
|
|
3087
|
+
function _getPlugin(pluginIdentifier) {
|
|
3088
|
+
var theExt = null;
|
|
3089
|
+
var thePlugin = null;
|
|
3090
|
+
arrForEach(_self._extensions, function (ext) {
|
|
3091
|
+
if (ext.identifier === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
|
|
3092
|
+
thePlugin = ext;
|
|
3093
|
+
return -1;
|
|
3094
|
+
}
|
|
3095
|
+
});
|
|
3096
|
+
if (!thePlugin && _channelControl) {
|
|
3097
|
+
thePlugin = _channelControl.getChannel(pluginIdentifier);
|
|
3098
|
+
}
|
|
3099
|
+
if (thePlugin) {
|
|
3100
|
+
theExt = {
|
|
3101
|
+
plugin: thePlugin,
|
|
3102
|
+
setEnabled: function (enabled) {
|
|
3103
|
+
_getPluginState(thePlugin)[strDisabled] = !enabled;
|
|
3104
|
+
},
|
|
3105
|
+
isEnabled: function () {
|
|
3106
|
+
var pluginState = _getPluginState(thePlugin);
|
|
3107
|
+
return !pluginState[strTeardown] && !pluginState[strDisabled];
|
|
3108
|
+
},
|
|
3109
|
+
remove: function (isAsync, removeCb) {
|
|
3110
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
3111
|
+
var pluginsToRemove = [thePlugin];
|
|
3112
|
+
var unloadState = {
|
|
3113
|
+
reason: 1 ,
|
|
3114
|
+
isAsync: isAsync
|
|
3115
|
+
};
|
|
3116
|
+
_removePlugins(pluginsToRemove, unloadState, function (removed) {
|
|
3117
|
+
if (removed) {
|
|
3118
|
+
_initPluginChain(_self.config, {
|
|
3119
|
+
reason: 32 ,
|
|
3120
|
+
removed: pluginsToRemove
|
|
3121
|
+
});
|
|
3122
|
+
}
|
|
3123
|
+
removeCb && removeCb(removed);
|
|
3124
|
+
});
|
|
3125
|
+
}
|
|
3126
|
+
};
|
|
3127
|
+
}
|
|
3128
|
+
return theExt;
|
|
3129
|
+
}
|
|
3130
|
+
function _getPluginChain() {
|
|
3131
|
+
if (!_pluginChain) {
|
|
3132
|
+
var extensions = (_coreExtensions || []).slice();
|
|
3133
|
+
if (extensions.indexOf(_telemetryInitializerPlugin) === -1) {
|
|
3134
|
+
extensions.push(_telemetryInitializerPlugin);
|
|
3135
|
+
}
|
|
3136
|
+
_pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _self.config, _self);
|
|
3137
|
+
}
|
|
3138
|
+
return _pluginChain;
|
|
3139
|
+
}
|
|
3140
|
+
function _removePlugins(thePlugins, unloadState, removeComplete) {
|
|
3141
|
+
if (thePlugins && thePlugins.length > 0) {
|
|
3142
|
+
var unloadChain = createTelemetryProxyChain(thePlugins, _self.config, _self);
|
|
3143
|
+
var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self.config, _self);
|
|
3144
|
+
unloadCtx.onComplete(function () {
|
|
3145
|
+
var removed = false;
|
|
3146
|
+
var newConfigExtensions = [];
|
|
3147
|
+
arrForEach(_configExtensions, function (plugin, idx) {
|
|
3148
|
+
if (!_isPluginPresent(plugin, thePlugins)) {
|
|
3149
|
+
newConfigExtensions.push(plugin);
|
|
3150
|
+
}
|
|
3151
|
+
else {
|
|
3152
|
+
removed = true;
|
|
3153
|
+
}
|
|
3154
|
+
});
|
|
3155
|
+
_configExtensions = newConfigExtensions;
|
|
3156
|
+
var newChannelConfig = [];
|
|
3157
|
+
if (_channelConfig) {
|
|
3158
|
+
arrForEach(_channelConfig, function (queue, idx) {
|
|
3159
|
+
var newQueue = [];
|
|
3160
|
+
arrForEach(queue, function (channel) {
|
|
3161
|
+
if (!_isPluginPresent(channel, thePlugins)) {
|
|
3162
|
+
newQueue.push(channel);
|
|
3163
|
+
}
|
|
3164
|
+
else {
|
|
3165
|
+
removed = true;
|
|
3166
|
+
}
|
|
3167
|
+
});
|
|
3168
|
+
newChannelConfig.push(newQueue);
|
|
3169
|
+
});
|
|
3170
|
+
_channelConfig = newChannelConfig;
|
|
3171
|
+
}
|
|
3172
|
+
removeComplete && removeComplete(removed);
|
|
3173
|
+
});
|
|
3174
|
+
unloadCtx.processNext(unloadState);
|
|
3175
|
+
}
|
|
3176
|
+
else {
|
|
3177
|
+
removeComplete(false);
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
function _flushInternalLogs() {
|
|
3181
|
+
var queue = _self.logger ? _self.logger.queue : [];
|
|
3182
|
+
if (queue) {
|
|
3183
|
+
arrForEach(queue, function (logMessage) {
|
|
3184
|
+
var item = {
|
|
3185
|
+
name: _internalLogsEventName ? _internalLogsEventName : "InternalMessageId: " + logMessage.messageId,
|
|
3186
|
+
iKey: _self.config.instrumentationKey,
|
|
3187
|
+
time: toISOString(new Date()),
|
|
3188
|
+
baseType: _InternalLogMessage.dataType,
|
|
3189
|
+
baseData: { message: logMessage.message }
|
|
3190
|
+
};
|
|
3191
|
+
_self.track(item);
|
|
3192
|
+
});
|
|
3193
|
+
queue.length = 0;
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
function _flushChannels(isAsync, callBack, sendReason, cbTimeout) {
|
|
3197
|
+
if (_channelControl) {
|
|
3198
|
+
return _channelControl.flush(isAsync, callBack, sendReason || 6 , cbTimeout);
|
|
3199
|
+
}
|
|
3200
|
+
callBack && callBack(false);
|
|
3201
|
+
return true;
|
|
3202
|
+
}
|
|
3203
|
+
function _initDebugListener(config) {
|
|
3204
|
+
if (config.disableDbgExt === true && _debugListener) {
|
|
3205
|
+
_notificationManager[strRemoveNotificationListener](_debugListener);
|
|
3206
|
+
_debugListener = null;
|
|
3207
|
+
}
|
|
3208
|
+
if (_notificationManager && !_debugListener && config.disableDbgExt !== true) {
|
|
3209
|
+
_debugListener = getDebugListener(config);
|
|
3210
|
+
_notificationManager[strAddNotificationListener](_debugListener);
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
function _initPerfManager(config) {
|
|
3214
|
+
if (!config.enablePerfMgr && _cfgPerfManager) {
|
|
3215
|
+
_cfgPerfManager = null;
|
|
3216
|
+
}
|
|
3217
|
+
if (config.enablePerfMgr) {
|
|
3218
|
+
setValue(_self.config, "createPerfMgr", _createPerfManager);
|
|
3219
|
+
}
|
|
3220
|
+
}
|
|
3221
|
+
function _initExtConfig(config) {
|
|
3222
|
+
var extConfig = getSetValue(config, strExtensionConfig);
|
|
3223
|
+
extConfig.NotificationManager = _notificationManager;
|
|
3224
|
+
}
|
|
3225
|
+
function _doUpdate(updateState) {
|
|
3226
|
+
var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self.config, _self);
|
|
3227
|
+
if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) {
|
|
3228
|
+
updateCtx.processNext(updateState);
|
|
2184
3229
|
}
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
_self.getPerfMgr = function () {
|
|
2191
|
-
if (!_perfManager) {
|
|
2192
|
-
if (_self.config && _self.config.enablePerfMgr && isFunction(_self.config.createPerfMgr)) {
|
|
2193
|
-
_perfManager = _self.config.createPerfMgr(_self, _self.getNotifyMgr());
|
|
2194
|
-
}
|
|
3230
|
+
}
|
|
3231
|
+
function _logOrThrowError(message) {
|
|
3232
|
+
var logger = _self.logger;
|
|
3233
|
+
if (logger) {
|
|
3234
|
+
_throwInternal(logger, 2 , 73 , message);
|
|
2195
3235
|
}
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
_self.setPerfMgr = function (perfMgr) {
|
|
2199
|
-
_perfManager = perfMgr;
|
|
2200
|
-
};
|
|
2201
|
-
_self.eventCnt = function () {
|
|
2202
|
-
return _eventQueue.length;
|
|
2203
|
-
};
|
|
2204
|
-
_self.releaseQueue = function () {
|
|
2205
|
-
if (_eventQueue.length > 0) {
|
|
2206
|
-
arrForEach(_eventQueue, function (event) {
|
|
2207
|
-
_self.getProcessTelContext().processNext(event);
|
|
2208
|
-
});
|
|
2209
|
-
_eventQueue = [];
|
|
3236
|
+
else {
|
|
3237
|
+
throwError(message);
|
|
2210
3238
|
}
|
|
2211
|
-
}
|
|
3239
|
+
}
|
|
2212
3240
|
});
|
|
2213
3241
|
}
|
|
2214
3242
|
return BaseCore;
|
|
2215
3243
|
}());
|
|
2216
3244
|
|
|
3245
|
+
function _runListeners(listeners, name, isAsync, callback) {
|
|
3246
|
+
arrForEach(listeners, function (listener) {
|
|
3247
|
+
if (listener && listener[name]) {
|
|
3248
|
+
if (isAsync) {
|
|
3249
|
+
setTimeout(function () { return callback(listener); }, 0);
|
|
3250
|
+
}
|
|
3251
|
+
else {
|
|
3252
|
+
try {
|
|
3253
|
+
callback(listener);
|
|
3254
|
+
}
|
|
3255
|
+
catch (e) {
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
}
|
|
3259
|
+
});
|
|
3260
|
+
}
|
|
2217
3261
|
var NotificationManager = /** @class */ (function () {
|
|
2218
3262
|
function NotificationManager(config) {
|
|
2219
3263
|
this.listeners = [];
|
|
2220
3264
|
var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;
|
|
2221
3265
|
dynamicProto(NotificationManager, this, function (_self) {
|
|
2222
|
-
_self
|
|
3266
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2223
3267
|
_self.listeners.push(listener);
|
|
2224
3268
|
};
|
|
2225
|
-
_self
|
|
3269
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2226
3270
|
var index = arrIndexOf(_self.listeners, listener);
|
|
2227
3271
|
while (index > -1) {
|
|
2228
3272
|
_self.listeners.splice(index, 1);
|
|
2229
3273
|
index = arrIndexOf(_self.listeners, listener);
|
|
2230
3274
|
}
|
|
2231
3275
|
};
|
|
2232
|
-
_self
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
setTimeout(function () { return listener.eventsSent(events); }, 0);
|
|
2236
|
-
}
|
|
3276
|
+
_self[strEventsSent] = function (events) {
|
|
3277
|
+
_runListeners(_self.listeners, strEventsSent, true, function (listener) {
|
|
3278
|
+
listener[strEventsSent](events);
|
|
2237
3279
|
});
|
|
2238
3280
|
};
|
|
2239
|
-
_self
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
setTimeout(function () { return listener.eventsDiscarded(events, reason); }, 0);
|
|
2243
|
-
}
|
|
3281
|
+
_self[strEventsDiscarded] = function (events, reason) {
|
|
3282
|
+
_runListeners(_self.listeners, strEventsDiscarded, true, function (listener) {
|
|
3283
|
+
listener[strEventsDiscarded](events, reason);
|
|
2244
3284
|
});
|
|
2245
3285
|
};
|
|
2246
|
-
_self
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
if (isAsync) {
|
|
2250
|
-
setTimeout(function () { return listener.eventsSendRequest(sendReason, isAsync); }, 0);
|
|
2251
|
-
}
|
|
2252
|
-
else {
|
|
2253
|
-
try {
|
|
2254
|
-
listener.eventsSendRequest(sendReason, isAsync);
|
|
2255
|
-
}
|
|
2256
|
-
catch (e) {
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
3286
|
+
_self[strEventsSendRequest] = function (sendReason, isAsync) {
|
|
3287
|
+
_runListeners(_self.listeners, strEventsSendRequest, isAsync, function (listener) {
|
|
3288
|
+
listener[strEventsSendRequest](sendReason, isAsync);
|
|
2260
3289
|
});
|
|
2261
3290
|
};
|
|
2262
|
-
_self
|
|
3291
|
+
_self[strPerfEvent] = function (perfEvent) {
|
|
2263
3292
|
if (perfEvent) {
|
|
2264
3293
|
if (perfEvtsSendAll || !perfEvent.isChildEvt()) {
|
|
2265
|
-
|
|
2266
|
-
if (
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
try {
|
|
2272
|
-
listener.perfEvent(perfEvent);
|
|
2273
|
-
}
|
|
2274
|
-
catch (e) {
|
|
2275
|
-
}
|
|
2276
|
-
}
|
|
3294
|
+
_runListeners(_self.listeners, strPerfEvent, false, function (listener) {
|
|
3295
|
+
if (perfEvent.isAsync) {
|
|
3296
|
+
setTimeout(function () { return listener[strPerfEvent](perfEvent); }, 0);
|
|
3297
|
+
}
|
|
3298
|
+
else {
|
|
3299
|
+
listener[strPerfEvent](perfEvent);
|
|
2277
3300
|
}
|
|
2278
3301
|
});
|
|
2279
3302
|
}
|
|
@@ -2288,7 +3311,6 @@
|
|
|
2288
3311
|
__extendsFn(AppInsightsCore, _super);
|
|
2289
3312
|
function AppInsightsCore() {
|
|
2290
3313
|
var _this = _super.call(this) || this;
|
|
2291
|
-
var _internalLogPoller = 0;
|
|
2292
3314
|
dynamicProto(AppInsightsCore, _this, function (_self, _base) {
|
|
2293
3315
|
_self.initialize = function (config, extensions, logger, notificationManager) {
|
|
2294
3316
|
_base.initialize(config, extensions, logger || new DiagnosticLogger(config), notificationManager || new NotificationManager(config));
|
|
@@ -2303,48 +3325,6 @@
|
|
|
2303
3325
|
_base.track(telemetryItem);
|
|
2304
3326
|
}, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));
|
|
2305
3327
|
};
|
|
2306
|
-
_self.addNotificationListener = function (listener) {
|
|
2307
|
-
var manager = _self.getNotifyMgr();
|
|
2308
|
-
if (manager) {
|
|
2309
|
-
manager.addNotificationListener(listener);
|
|
2310
|
-
}
|
|
2311
|
-
};
|
|
2312
|
-
_self.removeNotificationListener = function (listener) {
|
|
2313
|
-
var manager = _self.getNotifyMgr();
|
|
2314
|
-
if (manager) {
|
|
2315
|
-
manager.removeNotificationListener(listener);
|
|
2316
|
-
}
|
|
2317
|
-
};
|
|
2318
|
-
_self.pollInternalLogs = function (eventName) {
|
|
2319
|
-
var interval = _self.config.diagnosticLogInterval;
|
|
2320
|
-
if (!interval || !(interval > 0)) {
|
|
2321
|
-
interval = 10000;
|
|
2322
|
-
}
|
|
2323
|
-
if (_internalLogPoller) {
|
|
2324
|
-
_self.stopPollingInternalLogs();
|
|
2325
|
-
}
|
|
2326
|
-
_internalLogPoller = setInterval(function () {
|
|
2327
|
-
var queue = _self.logger ? _self.logger.queue : [];
|
|
2328
|
-
arrForEach(queue, function (logMessage) {
|
|
2329
|
-
var item = {
|
|
2330
|
-
name: eventName ? eventName : "InternalMessageId: " + logMessage.messageId,
|
|
2331
|
-
iKey: _self.config.instrumentationKey,
|
|
2332
|
-
time: toISOString(new Date()),
|
|
2333
|
-
baseType: _InternalLogMessage.dataType,
|
|
2334
|
-
baseData: { message: logMessage.message }
|
|
2335
|
-
};
|
|
2336
|
-
_self.track(item);
|
|
2337
|
-
});
|
|
2338
|
-
queue.length = 0;
|
|
2339
|
-
}, interval);
|
|
2340
|
-
return _internalLogPoller;
|
|
2341
|
-
};
|
|
2342
|
-
_self.stopPollingInternalLogs = function () {
|
|
2343
|
-
if (!_internalLogPoller)
|
|
2344
|
-
return;
|
|
2345
|
-
clearInterval(_internalLogPoller);
|
|
2346
|
-
_internalLogPoller = 0;
|
|
2347
|
-
};
|
|
2348
3328
|
function _validateTelemetryItem(telemetryItem) {
|
|
2349
3329
|
if (isNullOrUndefined(telemetryItem.name)) {
|
|
2350
3330
|
_notifyInvalidEvent(telemetryItem);
|
|
@@ -2354,7 +3334,7 @@
|
|
|
2354
3334
|
function _notifyInvalidEvent(telemetryItem) {
|
|
2355
3335
|
var manager = _self.getNotifyMgr();
|
|
2356
3336
|
if (manager) {
|
|
2357
|
-
manager.eventsDiscarded([telemetryItem],
|
|
3337
|
+
manager.eventsDiscarded([telemetryItem], 2 );
|
|
2358
3338
|
}
|
|
2359
3339
|
}
|
|
2360
3340
|
});
|
|
@@ -2363,151 +3343,315 @@
|
|
|
2363
3343
|
return AppInsightsCore;
|
|
2364
3344
|
}(BaseCore));
|
|
2365
3345
|
|
|
2366
|
-
var
|
|
2367
|
-
var
|
|
2368
|
-
var
|
|
2369
|
-
var
|
|
2370
|
-
var
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
3346
|
+
var strOnPrefix = "on";
|
|
3347
|
+
var strAttachEvent = "attachEvent";
|
|
3348
|
+
var strAddEventHelper = "addEventListener";
|
|
3349
|
+
var strDetachEvent = "detachEvent";
|
|
3350
|
+
var strRemoveEventListener = "removeEventListener";
|
|
3351
|
+
var strEvents = "events";
|
|
3352
|
+
var strVisibilityChangeEvt = "visibilitychange";
|
|
3353
|
+
var strPageHide = "pagehide";
|
|
3354
|
+
var strPageShow = "pageshow";
|
|
3355
|
+
var strUnload = "unload";
|
|
3356
|
+
var strBeforeUnload = "beforeunload";
|
|
3357
|
+
var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
|
|
3358
|
+
var strPageShowNamespace = createUniqueNamespace("aiEvtPageShow");
|
|
3359
|
+
var rRemoveEmptyNs = /\.[\.]+/g;
|
|
3360
|
+
var rRemoveTrailingEmptyNs = /[\.]+$/;
|
|
3361
|
+
var _guid = 1;
|
|
3362
|
+
var elmNodeData = createElmNodeData("events");
|
|
3363
|
+
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
3364
|
+
function _normalizeNamespace(name) {
|
|
3365
|
+
if (name && name.replace) {
|
|
3366
|
+
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
3367
|
+
}
|
|
3368
|
+
return name;
|
|
3369
|
+
}
|
|
3370
|
+
function _getEvtNamespace(eventName, evtNamespace) {
|
|
3371
|
+
if (evtNamespace) {
|
|
3372
|
+
var theNamespace_1 = "";
|
|
3373
|
+
if (isArray(evtNamespace)) {
|
|
3374
|
+
theNamespace_1 = "";
|
|
3375
|
+
arrForEach(evtNamespace, function (name) {
|
|
3376
|
+
name = _normalizeNamespace(name);
|
|
3377
|
+
if (name) {
|
|
3378
|
+
if (name[0] !== ".") {
|
|
3379
|
+
name = "." + name;
|
|
3380
|
+
}
|
|
3381
|
+
theNamespace_1 += name;
|
|
3382
|
+
}
|
|
3383
|
+
});
|
|
3384
|
+
}
|
|
3385
|
+
else {
|
|
3386
|
+
theNamespace_1 = _normalizeNamespace(evtNamespace);
|
|
3387
|
+
}
|
|
3388
|
+
if (theNamespace_1) {
|
|
3389
|
+
if (theNamespace_1[0] !== ".") {
|
|
3390
|
+
theNamespace_1 = "." + theNamespace_1;
|
|
3391
|
+
}
|
|
3392
|
+
eventName = (eventName || "") + theNamespace_1;
|
|
3393
|
+
}
|
|
2374
3394
|
}
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
3395
|
+
var parsedEvent = (eventNamespace.exec(eventName || "") || []);
|
|
3396
|
+
return {
|
|
3397
|
+
type: parsedEvent[1],
|
|
3398
|
+
ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
|
|
3399
|
+
};
|
|
2378
3400
|
}
|
|
2379
|
-
function
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
3401
|
+
function __getRegisteredEvents(target, eventName, evtNamespace) {
|
|
3402
|
+
var theEvents = [];
|
|
3403
|
+
var eventCache = elmNodeData.get(target, strEvents, {}, false);
|
|
3404
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
3405
|
+
objForEachKey(eventCache, function (evtType, registeredEvents) {
|
|
3406
|
+
arrForEach(registeredEvents, function (value) {
|
|
3407
|
+
if (!evtName.type || evtName.type === value.evtName.type) {
|
|
3408
|
+
if (!evtName.ns || evtName.ns === evtName.ns) {
|
|
3409
|
+
theEvents.push({
|
|
3410
|
+
name: value.evtName.type + (value.evtName.ns ? "." + value.evtName.ns : ""),
|
|
3411
|
+
handler: value.handler
|
|
3412
|
+
});
|
|
3413
|
+
}
|
|
3414
|
+
}
|
|
3415
|
+
});
|
|
3416
|
+
});
|
|
3417
|
+
return theEvents;
|
|
3418
|
+
}
|
|
3419
|
+
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
3420
|
+
if (addDefault === void 0) { addDefault = true; }
|
|
3421
|
+
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
3422
|
+
var registeredEvents = aiEvts[evtName];
|
|
3423
|
+
if (!registeredEvents) {
|
|
3424
|
+
registeredEvents = aiEvts[evtName] = [];
|
|
2385
3425
|
}
|
|
3426
|
+
return registeredEvents;
|
|
2386
3427
|
}
|
|
2387
|
-
function
|
|
2388
|
-
if (
|
|
2389
|
-
|
|
3428
|
+
function _doDetach(obj, evtName, handlerRef, useCapture) {
|
|
3429
|
+
if (obj && evtName && evtName.type) {
|
|
3430
|
+
if (obj[strRemoveEventListener]) {
|
|
3431
|
+
obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);
|
|
3432
|
+
}
|
|
3433
|
+
else if (obj[strDetachEvent]) {
|
|
3434
|
+
obj[strDetachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
3435
|
+
}
|
|
2390
3436
|
}
|
|
2391
|
-
return 0;
|
|
2392
3437
|
}
|
|
2393
|
-
function
|
|
2394
|
-
var
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
3438
|
+
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
3439
|
+
var result = false;
|
|
3440
|
+
if (obj && evtName && evtName.type && handlerRef) {
|
|
3441
|
+
if (obj[strAddEventHelper]) {
|
|
3442
|
+
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
3443
|
+
result = true;
|
|
3444
|
+
}
|
|
3445
|
+
else if (obj[strAttachEvent]) {
|
|
3446
|
+
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
3447
|
+
result = true;
|
|
3448
|
+
}
|
|
2398
3449
|
}
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
3450
|
+
return result;
|
|
3451
|
+
}
|
|
3452
|
+
function _doUnregister(target, events, evtName, unRegFn) {
|
|
3453
|
+
var idx = events.length;
|
|
3454
|
+
while (idx--) {
|
|
3455
|
+
var theEvent = events[idx];
|
|
3456
|
+
if (theEvent) {
|
|
3457
|
+
if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {
|
|
3458
|
+
if (!unRegFn || unRegFn(theEvent)) {
|
|
3459
|
+
_doDetach(target, theEvent.evtName, theEvent.handler, theEvent.capture);
|
|
3460
|
+
events.splice(idx, 1);
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
2402
3463
|
}
|
|
2403
|
-
value = mwcRandom32() & MaxUInt32;
|
|
2404
3464
|
}
|
|
2405
|
-
|
|
2406
|
-
|
|
3465
|
+
}
|
|
3466
|
+
function _unregisterEvents(target, evtName, unRegFn) {
|
|
3467
|
+
if (evtName.type) {
|
|
3468
|
+
_doUnregister(target, _getRegisteredEvents(target, evtName.type), evtName, unRegFn);
|
|
2407
3469
|
}
|
|
2408
|
-
|
|
2409
|
-
|
|
3470
|
+
else {
|
|
3471
|
+
var eventCache = elmNodeData.get(target, strEvents, {});
|
|
3472
|
+
objForEachKey(eventCache, function (evtType, events) {
|
|
3473
|
+
_doUnregister(target, events, evtName, unRegFn);
|
|
3474
|
+
});
|
|
3475
|
+
if (objKeys(eventCache).length === 0) {
|
|
3476
|
+
elmNodeData.kill(target, strEvents);
|
|
3477
|
+
}
|
|
2410
3478
|
}
|
|
2411
|
-
return value;
|
|
2412
3479
|
}
|
|
2413
|
-
function
|
|
2414
|
-
|
|
2415
|
-
|
|
3480
|
+
function mergeEvtNamespace(theNamespace, namespaces) {
|
|
3481
|
+
var newNamespaces;
|
|
3482
|
+
if (namespaces) {
|
|
3483
|
+
if (isArray(namespaces)) {
|
|
3484
|
+
newNamespaces = [theNamespace].concat(namespaces);
|
|
3485
|
+
}
|
|
3486
|
+
else {
|
|
3487
|
+
newNamespaces = [theNamespace, namespaces];
|
|
3488
|
+
}
|
|
3489
|
+
newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
|
|
2416
3490
|
}
|
|
2417
3491
|
else {
|
|
2418
|
-
|
|
3492
|
+
newNamespaces = theNamespace;
|
|
2419
3493
|
}
|
|
3494
|
+
return newNamespaces;
|
|
2420
3495
|
}
|
|
2421
|
-
function
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
3496
|
+
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
3497
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3498
|
+
var result = false;
|
|
3499
|
+
if (target) {
|
|
3500
|
+
try {
|
|
3501
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
3502
|
+
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
3503
|
+
if (result && elmNodeData.accept(target)) {
|
|
3504
|
+
var registeredEvent = {
|
|
3505
|
+
guid: _guid++,
|
|
3506
|
+
evtName: evtName,
|
|
3507
|
+
handler: handlerRef,
|
|
3508
|
+
capture: useCapture
|
|
3509
|
+
};
|
|
3510
|
+
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
3511
|
+
}
|
|
3512
|
+
}
|
|
3513
|
+
catch (e) {
|
|
3514
|
+
}
|
|
2427
3515
|
}
|
|
2428
|
-
return
|
|
3516
|
+
return result;
|
|
2429
3517
|
}
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
3518
|
+
function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
3519
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3520
|
+
if (target) {
|
|
3521
|
+
try {
|
|
3522
|
+
var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
|
|
3523
|
+
var found_1 = false;
|
|
3524
|
+
_unregisterEvents(target, evtName_1, function (regEvent) {
|
|
3525
|
+
if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {
|
|
3526
|
+
found_1 = true;
|
|
3527
|
+
return true;
|
|
3528
|
+
}
|
|
3529
|
+
return false;
|
|
3530
|
+
});
|
|
3531
|
+
if (!found_1) {
|
|
3532
|
+
_doDetach(target, evtName_1, handlerRef, useCapture);
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
catch (e) {
|
|
3536
|
+
}
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3539
|
+
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
3540
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3541
|
+
return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
|
|
3542
|
+
}
|
|
3543
|
+
function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
3544
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3545
|
+
eventOff(obj, eventNameWithoutOn, handlerRef, null, useCapture);
|
|
3546
|
+
}
|
|
3547
|
+
function addEventHandler(eventName, callback, evtNamespace) {
|
|
2438
3548
|
var result = false;
|
|
2439
3549
|
var w = getWindow();
|
|
2440
3550
|
if (w) {
|
|
2441
|
-
result =
|
|
2442
|
-
result =
|
|
3551
|
+
result = eventOn(w, eventName, callback, evtNamespace);
|
|
3552
|
+
result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
|
|
2443
3553
|
}
|
|
2444
3554
|
var doc = getDocument();
|
|
2445
3555
|
if (doc) {
|
|
2446
|
-
result =
|
|
3556
|
+
result = eventOn(doc, eventName, callback, evtNamespace) || result;
|
|
2447
3557
|
}
|
|
2448
3558
|
return result;
|
|
2449
3559
|
}
|
|
2450
|
-
function
|
|
3560
|
+
function removeEventHandler(eventName, callback, evtNamespace) {
|
|
3561
|
+
var w = getWindow();
|
|
3562
|
+
if (w) {
|
|
3563
|
+
eventOff(w, eventName, callback, evtNamespace);
|
|
3564
|
+
eventOff(w["body"], eventName, callback, evtNamespace);
|
|
3565
|
+
}
|
|
3566
|
+
var doc = getDocument();
|
|
3567
|
+
if (doc) {
|
|
3568
|
+
eventOff(doc, eventName, callback, evtNamespace);
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
function _addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
2451
3572
|
var added = false;
|
|
2452
|
-
if (listener && events &&
|
|
2453
|
-
var excluded_1 = [];
|
|
3573
|
+
if (listener && events && events.length > 0) {
|
|
2454
3574
|
arrForEach(events, function (name) {
|
|
2455
|
-
if (
|
|
3575
|
+
if (name) {
|
|
2456
3576
|
if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {
|
|
2457
|
-
added = addEventHandler(name, listener) || added;
|
|
2458
|
-
}
|
|
2459
|
-
else {
|
|
2460
|
-
excluded_1.push(name);
|
|
3577
|
+
added = addEventHandler(name, listener, evtNamespace) || added;
|
|
2461
3578
|
}
|
|
2462
3579
|
}
|
|
2463
3580
|
});
|
|
2464
|
-
|
|
2465
|
-
|
|
3581
|
+
}
|
|
3582
|
+
return added;
|
|
3583
|
+
}
|
|
3584
|
+
function addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
3585
|
+
var added = false;
|
|
3586
|
+
if (listener && events && isArray(events)) {
|
|
3587
|
+
added = _addEventListeners(events, listener, excludeEvents, evtNamespace);
|
|
3588
|
+
if (!added && excludeEvents && excludeEvents.length > 0) {
|
|
3589
|
+
added = _addEventListeners(events, listener, null, evtNamespace);
|
|
2466
3590
|
}
|
|
2467
3591
|
}
|
|
2468
3592
|
return added;
|
|
2469
3593
|
}
|
|
2470
|
-
function
|
|
2471
|
-
|
|
3594
|
+
function removeEventListeners(events, listener, evtNamespace) {
|
|
3595
|
+
if (events && isArray(events)) {
|
|
3596
|
+
arrForEach(events, function (name) {
|
|
3597
|
+
if (name) {
|
|
3598
|
+
removeEventHandler(name, listener, evtNamespace);
|
|
3599
|
+
}
|
|
3600
|
+
});
|
|
3601
|
+
}
|
|
3602
|
+
}
|
|
3603
|
+
function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {
|
|
3604
|
+
return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);
|
|
3605
|
+
}
|
|
3606
|
+
function removePageUnloadEventListener(listener, evtNamespace) {
|
|
3607
|
+
removeEventListeners([strBeforeUnload, strUnload, strPageHide], listener, evtNamespace);
|
|
2472
3608
|
}
|
|
2473
|
-
function addPageHideEventListener(listener, excludeEvents) {
|
|
3609
|
+
function addPageHideEventListener(listener, excludeEvents, evtNamespace) {
|
|
2474
3610
|
function _handlePageVisibility(evt) {
|
|
2475
3611
|
var doc = getDocument();
|
|
2476
3612
|
if (listener && doc && doc.visibilityState === "hidden") {
|
|
2477
3613
|
listener(evt);
|
|
2478
3614
|
}
|
|
2479
3615
|
}
|
|
2480
|
-
var
|
|
2481
|
-
|
|
2482
|
-
pageUnloadAdded = addEventHandler(strPageHide, listener);
|
|
2483
|
-
}
|
|
3616
|
+
var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
|
|
3617
|
+
var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);
|
|
2484
3618
|
if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
|
|
2485
|
-
pageUnloadAdded =
|
|
3619
|
+
pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;
|
|
2486
3620
|
}
|
|
2487
3621
|
if (!pageUnloadAdded && excludeEvents) {
|
|
2488
|
-
pageUnloadAdded = addPageHideEventListener(listener);
|
|
3622
|
+
pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);
|
|
2489
3623
|
}
|
|
2490
3624
|
return pageUnloadAdded;
|
|
2491
3625
|
}
|
|
2492
|
-
function
|
|
3626
|
+
function removePageHideEventListener(listener, evtNamespace) {
|
|
3627
|
+
var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
|
|
3628
|
+
removeEventListeners([strPageHide], listener, newNamespaces);
|
|
3629
|
+
removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
|
|
3630
|
+
}
|
|
3631
|
+
function addPageShowEventListener(listener, excludeEvents, evtNamespace) {
|
|
2493
3632
|
function _handlePageVisibility(evt) {
|
|
2494
3633
|
var doc = getDocument();
|
|
2495
3634
|
if (listener && doc && doc.visibilityState === "visible") {
|
|
2496
3635
|
listener(evt);
|
|
2497
3636
|
}
|
|
2498
3637
|
}
|
|
2499
|
-
var
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
}
|
|
2503
|
-
if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
|
|
2504
|
-
pageShowAdded = addEventHandler(strVisibilityChangeEvt, _handlePageVisibility) || pageShowAdded;
|
|
2505
|
-
}
|
|
3638
|
+
var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
|
|
3639
|
+
var pageShowAdded = _addEventListeners([strPageShow], listener, excludeEvents, newNamespaces);
|
|
3640
|
+
pageShowAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageShowAdded;
|
|
2506
3641
|
if (!pageShowAdded && excludeEvents) {
|
|
2507
|
-
pageShowAdded = addPageShowEventListener(listener);
|
|
3642
|
+
pageShowAdded = addPageShowEventListener(listener, null, evtNamespace);
|
|
2508
3643
|
}
|
|
2509
3644
|
return pageShowAdded;
|
|
2510
3645
|
}
|
|
3646
|
+
function removePageShowEventListener(listener, evtNamespace) {
|
|
3647
|
+
var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
|
|
3648
|
+
removeEventListeners([strPageShow], listener, newNamespaces);
|
|
3649
|
+
removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
|
|
3650
|
+
}
|
|
3651
|
+
|
|
3652
|
+
var _cookieMgrs = null;
|
|
3653
|
+
var _canUseCookies;
|
|
3654
|
+
var Undefined = strShimUndefined;
|
|
2511
3655
|
function newGuid() {
|
|
2512
3656
|
function randomHexDigit() {
|
|
2513
3657
|
return randomValue(15);
|
|
@@ -2524,26 +3668,9 @@
|
|
|
2524
3668
|
}
|
|
2525
3669
|
return dateNow();
|
|
2526
3670
|
}
|
|
2527
|
-
function newId(maxLength) {
|
|
2528
|
-
if (maxLength === void 0) { maxLength = 22; }
|
|
2529
|
-
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
2530
|
-
var number = random32() >>> 0;
|
|
2531
|
-
var chars = 0;
|
|
2532
|
-
var result = "";
|
|
2533
|
-
while (result.length < maxLength) {
|
|
2534
|
-
chars++;
|
|
2535
|
-
result += base64chars.charAt(number & 0x3F);
|
|
2536
|
-
number >>>= 6;
|
|
2537
|
-
if (chars === 5) {
|
|
2538
|
-
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
2539
|
-
chars = 0;
|
|
2540
|
-
}
|
|
2541
|
-
}
|
|
2542
|
-
return result;
|
|
2543
|
-
}
|
|
2544
3671
|
function generateW3CId() {
|
|
2545
3672
|
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
2546
|
-
var oct =
|
|
3673
|
+
var oct = strEmpty, tmp;
|
|
2547
3674
|
for (var a = 0; a < 4; a++) {
|
|
2548
3675
|
tmp = random32();
|
|
2549
3676
|
oct +=
|
|
@@ -2644,6 +3771,95 @@
|
|
|
2644
3771
|
return _legacyCookieMgr(null, logger).del(name);
|
|
2645
3772
|
}
|
|
2646
3773
|
|
|
3774
|
+
var LoggingSeverity = createEnumStyle({
|
|
3775
|
+
CRITICAL: 1 ,
|
|
3776
|
+
WARNING: 2
|
|
3777
|
+
});
|
|
3778
|
+
var _InternalMessageId = createEnumStyle({
|
|
3779
|
+
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
3780
|
+
BrowserCannotReadLocalStorage: 1 ,
|
|
3781
|
+
BrowserCannotReadSessionStorage: 2 ,
|
|
3782
|
+
BrowserCannotWriteLocalStorage: 3 ,
|
|
3783
|
+
BrowserCannotWriteSessionStorage: 4 ,
|
|
3784
|
+
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
3785
|
+
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
3786
|
+
CannotSendEmptyTelemetry: 7 ,
|
|
3787
|
+
ClientPerformanceMathError: 8 ,
|
|
3788
|
+
ErrorParsingAISessionCookie: 9 ,
|
|
3789
|
+
ErrorPVCalc: 10 ,
|
|
3790
|
+
ExceptionWhileLoggingError: 11 ,
|
|
3791
|
+
FailedAddingTelemetryToBuffer: 12 ,
|
|
3792
|
+
FailedMonitorAjaxAbort: 13 ,
|
|
3793
|
+
FailedMonitorAjaxDur: 14 ,
|
|
3794
|
+
FailedMonitorAjaxOpen: 15 ,
|
|
3795
|
+
FailedMonitorAjaxRSC: 16 ,
|
|
3796
|
+
FailedMonitorAjaxSend: 17 ,
|
|
3797
|
+
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
3798
|
+
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
3799
|
+
FailedToSendQueuedTelemetry: 20 ,
|
|
3800
|
+
FailedToReportDataLoss: 21 ,
|
|
3801
|
+
FlushFailed: 22 ,
|
|
3802
|
+
MessageLimitPerPVExceeded: 23 ,
|
|
3803
|
+
MissingRequiredFieldSpecification: 24 ,
|
|
3804
|
+
NavigationTimingNotSupported: 25 ,
|
|
3805
|
+
OnError: 26 ,
|
|
3806
|
+
SessionRenewalDateIsZero: 27 ,
|
|
3807
|
+
SenderNotInitialized: 28 ,
|
|
3808
|
+
StartTrackEventFailed: 29 ,
|
|
3809
|
+
StopTrackEventFailed: 30 ,
|
|
3810
|
+
StartTrackFailed: 31 ,
|
|
3811
|
+
StopTrackFailed: 32 ,
|
|
3812
|
+
TelemetrySampledAndNotSent: 33 ,
|
|
3813
|
+
TrackEventFailed: 34 ,
|
|
3814
|
+
TrackExceptionFailed: 35 ,
|
|
3815
|
+
TrackMetricFailed: 36 ,
|
|
3816
|
+
TrackPVFailed: 37 ,
|
|
3817
|
+
TrackPVFailedCalc: 38 ,
|
|
3818
|
+
TrackTraceFailed: 39 ,
|
|
3819
|
+
TransmissionFailed: 40 ,
|
|
3820
|
+
FailedToSetStorageBuffer: 41 ,
|
|
3821
|
+
FailedToRestoreStorageBuffer: 42 ,
|
|
3822
|
+
InvalidBackendResponse: 43 ,
|
|
3823
|
+
FailedToFixDepricatedValues: 44 ,
|
|
3824
|
+
InvalidDurationValue: 45 ,
|
|
3825
|
+
TelemetryEnvelopeInvalid: 46 ,
|
|
3826
|
+
CreateEnvelopeError: 47 ,
|
|
3827
|
+
CannotSerializeObject: 48 ,
|
|
3828
|
+
CannotSerializeObjectNonSerializable: 49 ,
|
|
3829
|
+
CircularReferenceDetected: 50 ,
|
|
3830
|
+
ClearAuthContextFailed: 51 ,
|
|
3831
|
+
ExceptionTruncated: 52 ,
|
|
3832
|
+
IllegalCharsInName: 53 ,
|
|
3833
|
+
ItemNotInArray: 54 ,
|
|
3834
|
+
MaxAjaxPerPVExceeded: 55 ,
|
|
3835
|
+
MessageTruncated: 56 ,
|
|
3836
|
+
NameTooLong: 57 ,
|
|
3837
|
+
SampleRateOutOfRange: 58 ,
|
|
3838
|
+
SetAuthContextFailed: 59 ,
|
|
3839
|
+
SetAuthContextFailedAccountName: 60 ,
|
|
3840
|
+
StringValueTooLong: 61 ,
|
|
3841
|
+
StartCalledMoreThanOnce: 62 ,
|
|
3842
|
+
StopCalledWithoutStart: 63 ,
|
|
3843
|
+
TelemetryInitializerFailed: 64 ,
|
|
3844
|
+
TrackArgumentsNotSpecified: 65 ,
|
|
3845
|
+
UrlTooLong: 66 ,
|
|
3846
|
+
SessionStorageBufferFull: 67 ,
|
|
3847
|
+
CannotAccessCookie: 68 ,
|
|
3848
|
+
IdTooLong: 69 ,
|
|
3849
|
+
InvalidEvent: 70 ,
|
|
3850
|
+
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
3851
|
+
SendBrowserInfoOnUserInit: 72 ,
|
|
3852
|
+
PluginException: 73 ,
|
|
3853
|
+
NotificationException: 74 ,
|
|
3854
|
+
SnippetScriptLoadFailure: 99 ,
|
|
3855
|
+
InvalidInstrumentationKey: 100 ,
|
|
3856
|
+
CannotParseAiBlobValue: 101 ,
|
|
3857
|
+
InvalidContentBlob: 102 ,
|
|
3858
|
+
TrackPageActionEventFailed: 103 ,
|
|
3859
|
+
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
3860
|
+
InMemoryStorageBufferFull: 105
|
|
3861
|
+
});
|
|
3862
|
+
|
|
2647
3863
|
var aiInstrumentHooks = "_aiHooks";
|
|
2648
3864
|
var cbNames = [
|
|
2649
3865
|
"req", "rsp", "hkErr", "fnErr"
|
|
@@ -2702,6 +3918,7 @@
|
|
|
2702
3918
|
};
|
|
2703
3919
|
var hookCtx = [];
|
|
2704
3920
|
var cbArgs = _createArgs([funcArgs], orgArgs);
|
|
3921
|
+
funcArgs.evt = getGlobalInst("event");
|
|
2705
3922
|
function _createArgs(target, theArgs) {
|
|
2706
3923
|
_arrLoop(theArgs, function (arg) {
|
|
2707
3924
|
target.push(arg);
|
|
@@ -2734,7 +3951,7 @@
|
|
|
2734
3951
|
owner = target;
|
|
2735
3952
|
}
|
|
2736
3953
|
else if (checkPrototype) {
|
|
2737
|
-
owner = _getOwner(_getObjProto(target), name, false);
|
|
3954
|
+
owner = _getOwner(_getObjProto$1(target), name, false);
|
|
2738
3955
|
}
|
|
2739
3956
|
}
|
|
2740
3957
|
return owner;
|
|
@@ -2817,6 +4034,7 @@
|
|
|
2817
4034
|
exports.InstrumentFuncs = InstrumentFuncs;
|
|
2818
4035
|
exports.InstrumentProto = InstrumentProto;
|
|
2819
4036
|
exports.InstrumentProtos = InstrumentProtos;
|
|
4037
|
+
exports.LoggingSeverity = LoggingSeverity;
|
|
2820
4038
|
exports.MinChannelPriorty = MinChannelPriorty;
|
|
2821
4039
|
exports.NotificationManager = NotificationManager;
|
|
2822
4040
|
exports.PerfEvent = PerfEvent;
|
|
@@ -2825,7 +4043,11 @@
|
|
|
2825
4043
|
exports.Undefined = Undefined;
|
|
2826
4044
|
exports._InternalLogMessage = _InternalLogMessage;
|
|
2827
4045
|
exports._InternalMessageId = _InternalMessageId;
|
|
4046
|
+
exports.__getRegisteredEvents = __getRegisteredEvents;
|
|
2828
4047
|
exports._legacyCookieMgr = _legacyCookieMgr;
|
|
4048
|
+
exports._logInternalMessage = _logInternalMessage;
|
|
4049
|
+
exports._throwInternal = _throwInternal;
|
|
4050
|
+
exports._warnToConsole = _warnToConsole;
|
|
2829
4051
|
exports.addEventHandler = addEventHandler;
|
|
2830
4052
|
exports.addEventListeners = addEventListeners;
|
|
2831
4053
|
exports.addPageHideEventListener = addPageHideEventListener;
|
|
@@ -2840,12 +4062,20 @@
|
|
|
2840
4062
|
exports.canUseCookies = canUseCookies;
|
|
2841
4063
|
exports.createClassFromInterface = createClassFromInterface;
|
|
2842
4064
|
exports.createCookieMgr = createCookieMgr;
|
|
4065
|
+
exports.createEnumMap = createEnumMap;
|
|
4066
|
+
exports.createEnumStyle = createEnumStyle;
|
|
4067
|
+
exports.createProcessTelemetryContext = createProcessTelemetryContext;
|
|
4068
|
+
exports.createUniqueNamespace = createUniqueNamespace;
|
|
4069
|
+
exports.createUnloadHandlerContainer = createUnloadHandlerContainer;
|
|
4070
|
+
exports.createValueMap = createValueMap;
|
|
2843
4071
|
exports.dateNow = dateNow;
|
|
2844
4072
|
exports.deleteCookie = deleteCookie;
|
|
2845
4073
|
exports.detachEvent = detachEvent;
|
|
2846
4074
|
exports.disableCookies = disableCookies;
|
|
2847
4075
|
exports.doPerf = doPerf;
|
|
2848
4076
|
exports.dumpObj = dumpObj;
|
|
4077
|
+
exports.eventOff = eventOff;
|
|
4078
|
+
exports.eventOn = eventOn;
|
|
2849
4079
|
exports.generateW3CId = generateW3CId;
|
|
2850
4080
|
exports.getConsole = getConsole;
|
|
2851
4081
|
exports.getCookie = getCookie;
|
|
@@ -2895,6 +4125,7 @@
|
|
|
2895
4125
|
exports.isTypeof = isTypeof;
|
|
2896
4126
|
exports.isUndefined = isUndefined;
|
|
2897
4127
|
exports.isXhrSupported = isXhrSupported;
|
|
4128
|
+
exports.mergeEvtNamespace = mergeEvtNamespace;
|
|
2898
4129
|
exports.mwcRandom32 = mwcRandom32;
|
|
2899
4130
|
exports.mwcRandomSeed = mwcRandomSeed;
|
|
2900
4131
|
exports.newGuid = newGuid;
|
|
@@ -2902,15 +4133,24 @@
|
|
|
2902
4133
|
exports.normalizeJsName = normalizeJsName;
|
|
2903
4134
|
exports.objCreate = objCreateFn;
|
|
2904
4135
|
exports.objDefineAccessors = objDefineAccessors;
|
|
4136
|
+
exports.objExtend = objExtend;
|
|
2905
4137
|
exports.objForEachKey = objForEachKey;
|
|
2906
4138
|
exports.objFreeze = objFreeze;
|
|
2907
4139
|
exports.objKeys = objKeys;
|
|
2908
4140
|
exports.objSeal = objSeal;
|
|
4141
|
+
exports.objToString = objToString;
|
|
2909
4142
|
exports.optimizeObject = optimizeObject;
|
|
2910
4143
|
exports.perfNow = perfNow;
|
|
2911
4144
|
exports.proxyAssign = proxyAssign;
|
|
4145
|
+
exports.proxyFunctionAs = proxyFunctionAs;
|
|
4146
|
+
exports.proxyFunctions = proxyFunctions;
|
|
2912
4147
|
exports.random32 = random32;
|
|
2913
4148
|
exports.randomValue = randomValue;
|
|
4149
|
+
exports.removeEventHandler = removeEventHandler;
|
|
4150
|
+
exports.removeEventListeners = removeEventListeners;
|
|
4151
|
+
exports.removePageHideEventListener = removePageHideEventListener;
|
|
4152
|
+
exports.removePageShowEventListener = removePageShowEventListener;
|
|
4153
|
+
exports.removePageUnloadEventListener = removePageUnloadEventListener;
|
|
2914
4154
|
exports.safeGetCookieMgr = safeGetCookieMgr;
|
|
2915
4155
|
exports.safeGetLogger = safeGetLogger;
|
|
2916
4156
|
exports.setCookie = setCookie;
|
|
@@ -2931,6 +4171,7 @@
|
|
|
2931
4171
|
exports.throwError = throwError;
|
|
2932
4172
|
exports.toISOString = toISOString;
|
|
2933
4173
|
exports.uaDisallowsSameSiteNone = uaDisallowsSameSiteNone;
|
|
4174
|
+
exports.unloadComponents = unloadComponents;
|
|
2934
4175
|
exports.useXDomainRequest = useXDomainRequest;
|
|
2935
4176
|
|
|
2936
4177
|
(function(obj, prop, descriptor) { /* ai_es3_polyfil defineProperty */ var func = Object["defineProperty"]; if (func) { try { return func(obj, prop, descriptor); } catch(e) { /* IE8 defines defineProperty, but will throw */ } } if (descriptor && typeof descriptor.value !== undefined) { obj[prop] = descriptor.value; } return obj; })(exports, '__esModule', { value: true });
|