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