@microsoft/applicationinsights-core-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-04
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +1999 -793
- package/browser/applicationinsights-core-js.js.map +1 -1
- package/browser/applicationinsights-core-js.min.js +2 -2
- package/browser/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.api.json +16363 -9167
- package/dist/applicationinsights-core-js.api.md +425 -48
- package/dist/applicationinsights-core-js.d.ts +784 -123
- package/dist/applicationinsights-core-js.js +1999 -793
- package/dist/applicationinsights-core-js.js.map +1 -1
- package/dist/applicationinsights-core-js.min.js +2 -2
- package/dist/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.rollup.d.ts +784 -123
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +3 -69
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +496 -99
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +120 -21
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +202 -87
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +4 -4
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +7 -148
- package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +93 -0
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -0
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +25 -12
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +13 -12
- package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +477 -0
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -0
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +89 -86
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +3 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +28 -0
- package/dist-esm/JavaScriptSDK/InternalConstants.js.map +1 -0
- package/dist-esm/JavaScriptSDK/NotificationManager.js +37 -42
- package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +430 -119
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +30 -4
- package/dist-esm/JavaScriptSDK/RandomHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +60 -14
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +81 -0
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -0
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +33 -0
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +90 -96
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +8 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +8 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -2
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +6 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -2
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +6 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js.map +1 -0
- package/dist-esm/applicationinsights-core-js.js +12 -7
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +2 -2
- package/src/JavaScriptSDK/AppInsightsCore.ts +2 -101
- package/src/JavaScriptSDK/BaseCore.ts +696 -120
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +205 -31
- package/src/JavaScriptSDK/ChannelController.ts +242 -103
- package/src/JavaScriptSDK/CookieMgr.ts +7 -5
- package/src/JavaScriptSDK/CoreUtils.ts +8 -172
- package/src/JavaScriptSDK/DataCacheHelper.ts +106 -0
- package/src/JavaScriptSDK/DiagnosticLogger.ts +27 -12
- package/src/JavaScriptSDK/EnvUtils.ts +13 -12
- package/src/JavaScriptSDK/EventHelpers.ts +550 -0
- package/src/JavaScriptSDK/HelperFuncs.ts +123 -97
- package/src/JavaScriptSDK/InstrumentHooks.ts +4 -2
- package/src/JavaScriptSDK/InternalConstants.ts +26 -0
- package/src/JavaScriptSDK/NotificationManager.ts +34 -37
- package/src/JavaScriptSDK/PerfManager.ts +4 -7
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +543 -134
- package/src/JavaScriptSDK/RandomHelper.ts +35 -3
- package/src/JavaScriptSDK/TelemetryHelpers.ts +83 -21
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +111 -0
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +46 -0
- package/src/JavaScriptSDK.Enums/LoggingEnums.ts +184 -87
- package/src/JavaScriptSDK.Enums/SendRequestReason.ts +5 -0
- package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +27 -0
- package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +27 -0
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +82 -2
- package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +16 -5
- package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +16 -6
- package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +94 -14
- package/src/JavaScriptSDK.Interfaces/ITelemetryInitializers.ts +16 -0
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +28 -10
- package/src/JavaScriptSDK.Interfaces/ITelemetryPluginChain.ts +9 -11
- package/src/JavaScriptSDK.Interfaces/ITelemetryUnloadState.ts +10 -0
- package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +34 -0
- package/src/JavaScriptSDK.Interfaces/IUnloadableComponent.ts +17 -0
- package/types/JavaScriptSDK/AppInsightsCore.d.ts +0 -21
- package/types/JavaScriptSDK/BaseCore.d.ts +81 -3
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +53 -10
- package/types/JavaScriptSDK/ChannelController.d.ts +16 -17
- package/types/JavaScriptSDK/CoreUtils.d.ts +1 -48
- package/types/JavaScriptSDK/DataCacheHelper.d.ts +13 -0
- package/types/JavaScriptSDK/DiagnosticLogger.d.ts +10 -0
- package/types/JavaScriptSDK/EventHelpers.d.ts +154 -0
- package/types/JavaScriptSDK/HelperFuncs.d.ts +33 -32
- package/types/JavaScriptSDK/InternalConstants.d.ts +20 -0
- package/types/JavaScriptSDK/PerfManager.d.ts +1 -1
- package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +69 -6
- package/types/JavaScriptSDK/RandomHelper.d.ts +6 -0
- package/types/JavaScriptSDK/TelemetryHelpers.d.ts +23 -3
- package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +16 -0
- package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +11 -0
- package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +91 -2
- package/types/JavaScriptSDK.Enums/SendRequestReason.d.ts +4 -0
- package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +21 -0
- package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +20 -0
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +72 -1
- package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +16 -5
- package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +9 -0
- package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +82 -11
- package/types/JavaScriptSDK.Interfaces/ITelemetryInitializers.d.ts +13 -0
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +25 -8
- package/types/JavaScriptSDK.Interfaces/ITelemetryPluginChain.d.ts +9 -10
- package/types/JavaScriptSDK.Interfaces/ITelemetryUnloadState.d.ts +6 -0
- package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +22 -0
- package/types/JavaScriptSDK.Interfaces/IUnloadableComponent.d.ts +13 -0
- package/types/applicationinsights-core-js.d.ts +18 -9
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js +0 -76
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js.map +0 -1
- package/src/JavaScriptSDK/TelemetryPluginChain.ts +0 -120
- package/types/JavaScriptSDK/TelemetryPluginChain.d.ts +0 -32
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 2.8.0-nightly.
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 2.8.0-nightly.2204-04
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -74,7 +74,9 @@
|
|
|
74
74
|
(getGlobal() || {})["Reflect"];
|
|
75
75
|
var extendStaticsFn = function (d, b) {
|
|
76
76
|
extendStaticsFn = ObjClass["setPrototypeOf"] ||
|
|
77
|
-
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
77
|
+
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
78
|
+
d.__proto__ = b;
|
|
79
|
+
}) ||
|
|
78
80
|
function (d, b) {
|
|
79
81
|
for (var p in b) {
|
|
80
82
|
if (b[strShimHasOwnProperty](p)) {
|
|
@@ -89,7 +91,9 @@
|
|
|
89
91
|
throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
90
92
|
}
|
|
91
93
|
extendStaticsFn(d, b);
|
|
92
|
-
function __() {
|
|
94
|
+
function __() {
|
|
95
|
+
this.constructor = d;
|
|
96
|
+
}
|
|
93
97
|
d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
|
|
94
98
|
}
|
|
95
99
|
function __spreadArrayFn(to, from) {
|
|
@@ -340,101 +344,27 @@
|
|
|
340
344
|
};
|
|
341
345
|
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
342
346
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
var
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
FailedMonitorAjaxDur: 14,
|
|
364
|
-
FailedMonitorAjaxOpen: 15,
|
|
365
|
-
FailedMonitorAjaxRSC: 16,
|
|
366
|
-
FailedMonitorAjaxSend: 17,
|
|
367
|
-
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
368
|
-
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
369
|
-
FailedToSendQueuedTelemetry: 20,
|
|
370
|
-
FailedToReportDataLoss: 21,
|
|
371
|
-
FlushFailed: 22,
|
|
372
|
-
MessageLimitPerPVExceeded: 23,
|
|
373
|
-
MissingRequiredFieldSpecification: 24,
|
|
374
|
-
NavigationTimingNotSupported: 25,
|
|
375
|
-
OnError: 26,
|
|
376
|
-
SessionRenewalDateIsZero: 27,
|
|
377
|
-
SenderNotInitialized: 28,
|
|
378
|
-
StartTrackEventFailed: 29,
|
|
379
|
-
StopTrackEventFailed: 30,
|
|
380
|
-
StartTrackFailed: 31,
|
|
381
|
-
StopTrackFailed: 32,
|
|
382
|
-
TelemetrySampledAndNotSent: 33,
|
|
383
|
-
TrackEventFailed: 34,
|
|
384
|
-
TrackExceptionFailed: 35,
|
|
385
|
-
TrackMetricFailed: 36,
|
|
386
|
-
TrackPVFailed: 37,
|
|
387
|
-
TrackPVFailedCalc: 38,
|
|
388
|
-
TrackTraceFailed: 39,
|
|
389
|
-
TransmissionFailed: 40,
|
|
390
|
-
FailedToSetStorageBuffer: 41,
|
|
391
|
-
FailedToRestoreStorageBuffer: 42,
|
|
392
|
-
InvalidBackendResponse: 43,
|
|
393
|
-
FailedToFixDepricatedValues: 44,
|
|
394
|
-
InvalidDurationValue: 45,
|
|
395
|
-
TelemetryEnvelopeInvalid: 46,
|
|
396
|
-
CreateEnvelopeError: 47,
|
|
397
|
-
CannotSerializeObject: 48,
|
|
398
|
-
CannotSerializeObjectNonSerializable: 49,
|
|
399
|
-
CircularReferenceDetected: 50,
|
|
400
|
-
ClearAuthContextFailed: 51,
|
|
401
|
-
ExceptionTruncated: 52,
|
|
402
|
-
IllegalCharsInName: 53,
|
|
403
|
-
ItemNotInArray: 54,
|
|
404
|
-
MaxAjaxPerPVExceeded: 55,
|
|
405
|
-
MessageTruncated: 56,
|
|
406
|
-
NameTooLong: 57,
|
|
407
|
-
SampleRateOutOfRange: 58,
|
|
408
|
-
SetAuthContextFailed: 59,
|
|
409
|
-
SetAuthContextFailedAccountName: 60,
|
|
410
|
-
StringValueTooLong: 61,
|
|
411
|
-
StartCalledMoreThanOnce: 62,
|
|
412
|
-
StopCalledWithoutStart: 63,
|
|
413
|
-
TelemetryInitializerFailed: 64,
|
|
414
|
-
TrackArgumentsNotSpecified: 65,
|
|
415
|
-
UrlTooLong: 66,
|
|
416
|
-
SessionStorageBufferFull: 67,
|
|
417
|
-
CannotAccessCookie: 68,
|
|
418
|
-
IdTooLong: 69,
|
|
419
|
-
InvalidEvent: 70,
|
|
420
|
-
FailedMonitorAjaxSetRequestHeader: 71,
|
|
421
|
-
SendBrowserInfoOnUserInit: 72,
|
|
422
|
-
PluginException: 73,
|
|
423
|
-
NotificationException: 74,
|
|
424
|
-
SnippetScriptLoadFailure: 99,
|
|
425
|
-
InvalidInstrumentationKey: 100,
|
|
426
|
-
CannotParseAiBlobValue: 101,
|
|
427
|
-
InvalidContentBlob: 102,
|
|
428
|
-
TrackPageActionEventFailed: 103,
|
|
429
|
-
FailedAddingCustomDefinedRequestContext: 104,
|
|
430
|
-
InMemoryStorageBufferFull: 105
|
|
431
|
-
};
|
|
347
|
+
var strEmpty = "";
|
|
348
|
+
var strProcessTelemetry = "processTelemetry";
|
|
349
|
+
var strPriority = "priority";
|
|
350
|
+
var strSetNextPlugin = "setNextPlugin";
|
|
351
|
+
var strIsInitialized = "isInitialized";
|
|
352
|
+
var strTeardown = "teardown";
|
|
353
|
+
var strCore = "core";
|
|
354
|
+
var strUpdate = "update";
|
|
355
|
+
var strDisabled = "disabled";
|
|
356
|
+
var strDoTeardown = "_doTeardown";
|
|
357
|
+
var strProcessNext = "processNext";
|
|
358
|
+
var strResume = "resume";
|
|
359
|
+
var strPause = "pause";
|
|
360
|
+
var strNotificationListener = "NotificationListener";
|
|
361
|
+
var strAddNotificationListener = "add" + strNotificationListener;
|
|
362
|
+
var strRemoveNotificationListener = "remove" + strNotificationListener;
|
|
363
|
+
var strEventsSent = "eventsSent";
|
|
364
|
+
var strEventsDiscarded = "eventsDiscarded";
|
|
365
|
+
var strEventsSendRequest = "eventsSendRequest";
|
|
366
|
+
var strPerfEvent = "perfEvent";
|
|
432
367
|
|
|
433
|
-
var strOnPrefix = "on";
|
|
434
|
-
var strAttachEvent = "attachEvent";
|
|
435
|
-
var strAddEventHelper = "addEventListener";
|
|
436
|
-
var strDetachEvent = "detachEvent";
|
|
437
|
-
var strRemoveEventListener = "removeEventListener";
|
|
438
368
|
var strToISOString = "toISOString";
|
|
439
369
|
var cStrEndsWith = "endsWith";
|
|
440
370
|
var cStrStartsWith = "startsWith";
|
|
@@ -445,7 +375,7 @@
|
|
|
445
375
|
var strToString = "toString";
|
|
446
376
|
var str__Proto = "__proto__";
|
|
447
377
|
var strConstructor = "constructor";
|
|
448
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
378
|
+
var _objDefineProperty$1 = ObjDefineProperty;
|
|
449
379
|
var _objFreeze = ObjClass.freeze;
|
|
450
380
|
var _objSeal = ObjClass.seal;
|
|
451
381
|
var _objKeys = ObjClass.keys;
|
|
@@ -458,7 +388,7 @@
|
|
|
458
388
|
var _isArray = Array.isArray;
|
|
459
389
|
var _objToString = ObjProto[strToString];
|
|
460
390
|
var _fnToString = ObjHasOwnProperty[strToString];
|
|
461
|
-
_fnToString.call(ObjClass);
|
|
391
|
+
var _objFunctionString = _fnToString.call(ObjClass);
|
|
462
392
|
var rCamelCase = /-([a-z])/g;
|
|
463
393
|
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
464
394
|
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
@@ -475,6 +405,9 @@
|
|
|
475
405
|
}
|
|
476
406
|
return null;
|
|
477
407
|
}
|
|
408
|
+
function objToString(obj) {
|
|
409
|
+
return _objToString.call(obj);
|
|
410
|
+
}
|
|
478
411
|
function isTypeof(value, theType) {
|
|
479
412
|
return typeof value === theType;
|
|
480
413
|
}
|
|
@@ -499,40 +432,6 @@
|
|
|
499
432
|
function isFunction(value) {
|
|
500
433
|
return !!(value && typeof value === strShimFunction);
|
|
501
434
|
}
|
|
502
|
-
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
503
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
504
|
-
var result = false;
|
|
505
|
-
if (!isNullOrUndefined(obj)) {
|
|
506
|
-
try {
|
|
507
|
-
if (!isNullOrUndefined(obj[strAddEventHelper])) {
|
|
508
|
-
obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
|
|
509
|
-
result = true;
|
|
510
|
-
}
|
|
511
|
-
else if (!isNullOrUndefined(obj[strAttachEvent])) {
|
|
512
|
-
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
513
|
-
result = true;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
catch (e) {
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
return result;
|
|
520
|
-
}
|
|
521
|
-
function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
522
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
523
|
-
if (!isNullOrUndefined(obj)) {
|
|
524
|
-
try {
|
|
525
|
-
if (!isNullOrUndefined(obj[strRemoveEventListener])) {
|
|
526
|
-
obj[strRemoveEventListener](eventNameWithoutOn, handlerRef, useCapture);
|
|
527
|
-
}
|
|
528
|
-
else if (!isNullOrUndefined(obj[strDetachEvent])) {
|
|
529
|
-
obj[strDetachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
catch (e) {
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
435
|
function normalizeJsName(name) {
|
|
537
436
|
var value = name;
|
|
538
437
|
if (value && isString(value)) {
|
|
@@ -626,6 +525,22 @@
|
|
|
626
525
|
function isSymbol(value) {
|
|
627
526
|
return typeof value === "symbol";
|
|
628
527
|
}
|
|
528
|
+
function isPlainObject(value) {
|
|
529
|
+
var result = false;
|
|
530
|
+
if (value && typeof value === "object") {
|
|
531
|
+
var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
|
|
532
|
+
if (!proto) {
|
|
533
|
+
result = true;
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
|
|
537
|
+
proto = proto[strConstructor];
|
|
538
|
+
}
|
|
539
|
+
result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
return result;
|
|
543
|
+
}
|
|
629
544
|
function toISOString(date) {
|
|
630
545
|
if (date) {
|
|
631
546
|
return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
|
|
@@ -771,7 +686,7 @@
|
|
|
771
686
|
return result;
|
|
772
687
|
}
|
|
773
688
|
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
774
|
-
if (_objDefineProperty) {
|
|
689
|
+
if (_objDefineProperty$1) {
|
|
775
690
|
try {
|
|
776
691
|
var descriptor = {
|
|
777
692
|
enumerable: true,
|
|
@@ -783,7 +698,7 @@
|
|
|
783
698
|
if (setProp) {
|
|
784
699
|
descriptor.set = setProp;
|
|
785
700
|
}
|
|
786
|
-
_objDefineProperty(target, prop, descriptor);
|
|
701
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
787
702
|
return true;
|
|
788
703
|
}
|
|
789
704
|
catch (e) {
|
|
@@ -804,7 +719,7 @@
|
|
|
804
719
|
if (isError(object)) {
|
|
805
720
|
return object.name;
|
|
806
721
|
}
|
|
807
|
-
return
|
|
722
|
+
return strEmpty;
|
|
808
723
|
}
|
|
809
724
|
function setValue(target, field, value, valChk, srcChk) {
|
|
810
725
|
var theValue = value;
|
|
@@ -840,19 +755,33 @@
|
|
|
840
755
|
function throwError(message) {
|
|
841
756
|
throw new Error(message);
|
|
842
757
|
}
|
|
758
|
+
function _createProxyFunction(source, funcName) {
|
|
759
|
+
var srcFunc = null;
|
|
760
|
+
var src = null;
|
|
761
|
+
if (isFunction(source)) {
|
|
762
|
+
srcFunc = source;
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
src = source;
|
|
766
|
+
}
|
|
767
|
+
return function () {
|
|
768
|
+
var originalArguments = arguments;
|
|
769
|
+
if (srcFunc) {
|
|
770
|
+
src = srcFunc();
|
|
771
|
+
}
|
|
772
|
+
if (src) {
|
|
773
|
+
return src[funcName].apply(src, originalArguments);
|
|
774
|
+
}
|
|
775
|
+
};
|
|
776
|
+
}
|
|
843
777
|
function proxyAssign(target, source, chkSet) {
|
|
844
|
-
if (target && source &&
|
|
778
|
+
if (target && source && isObject(target) && isObject(source)) {
|
|
845
779
|
var _loop_1 = function (field) {
|
|
846
780
|
if (isString(field)) {
|
|
847
781
|
var value = source[field];
|
|
848
782
|
if (isFunction(value)) {
|
|
849
783
|
if (!chkSet || chkSet(field, true, source, target)) {
|
|
850
|
-
target[field] = (
|
|
851
|
-
return function () {
|
|
852
|
-
var originalArguments = arguments;
|
|
853
|
-
return source[funcName].apply(source, originalArguments);
|
|
854
|
-
};
|
|
855
|
-
})(field);
|
|
784
|
+
target[field] = _createProxyFunction(source, field);
|
|
856
785
|
}
|
|
857
786
|
}
|
|
858
787
|
else if (!chkSet || chkSet(field, false, source, target)) {
|
|
@@ -875,6 +804,25 @@
|
|
|
875
804
|
}
|
|
876
805
|
return target;
|
|
877
806
|
}
|
|
807
|
+
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
808
|
+
if (overwriteTarget === void 0) { overwriteTarget = true; }
|
|
809
|
+
if (target && name && source) {
|
|
810
|
+
if (overwriteTarget || isUndefined(target[name])) {
|
|
811
|
+
target[name] = _createProxyFunction(source, theFunc);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {
|
|
816
|
+
if (overwriteTarget === void 0) { overwriteTarget = true; }
|
|
817
|
+
if (target && source && isObject(target) && isArray(functionsToProxy)) {
|
|
818
|
+
arrForEach(functionsToProxy, function (theFuncName) {
|
|
819
|
+
if (isString(theFuncName)) {
|
|
820
|
+
proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
return target;
|
|
825
|
+
}
|
|
878
826
|
function createClassFromInterface(defaults) {
|
|
879
827
|
return /** @class */ (function () {
|
|
880
828
|
function class_1() {
|
|
@@ -888,12 +836,67 @@
|
|
|
888
836
|
return class_1;
|
|
889
837
|
}());
|
|
890
838
|
}
|
|
839
|
+
function createEnumStyle(values) {
|
|
840
|
+
var enumClass = {};
|
|
841
|
+
objForEachKey(values, function (field, value) {
|
|
842
|
+
enumClass[field] = value;
|
|
843
|
+
if (!isUndefined(enumClass[value])) {
|
|
844
|
+
throwError("[" + value + "] exists for " + field);
|
|
845
|
+
}
|
|
846
|
+
enumClass[value] = field;
|
|
847
|
+
});
|
|
848
|
+
return objFreeze(enumClass);
|
|
849
|
+
}
|
|
891
850
|
function optimizeObject(theObject) {
|
|
892
851
|
if (theObject && ObjAssign) {
|
|
893
852
|
theObject = ObjClass(ObjAssign({}, theObject));
|
|
894
853
|
}
|
|
895
854
|
return theObject;
|
|
896
855
|
}
|
|
856
|
+
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
857
|
+
var theArgs = arguments;
|
|
858
|
+
var extended = theArgs[0] || {};
|
|
859
|
+
var argLen = theArgs.length;
|
|
860
|
+
var deep = false;
|
|
861
|
+
var idx = 1;
|
|
862
|
+
if (argLen > 0 && isBoolean(extended)) {
|
|
863
|
+
deep = extended;
|
|
864
|
+
extended = theArgs[idx] || {};
|
|
865
|
+
idx++;
|
|
866
|
+
}
|
|
867
|
+
if (!isObject(extended)) {
|
|
868
|
+
extended = {};
|
|
869
|
+
}
|
|
870
|
+
for (; idx < argLen; idx++) {
|
|
871
|
+
var arg = theArgs[idx];
|
|
872
|
+
var isArgArray = isArray(arg);
|
|
873
|
+
var isArgObj = isObject(arg);
|
|
874
|
+
for (var prop in arg) {
|
|
875
|
+
var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
|
|
876
|
+
if (!propOk) {
|
|
877
|
+
continue;
|
|
878
|
+
}
|
|
879
|
+
var newValue = arg[prop];
|
|
880
|
+
var isNewArray = void 0;
|
|
881
|
+
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
882
|
+
var clone = extended[prop];
|
|
883
|
+
if (isNewArray) {
|
|
884
|
+
if (!isArray(clone)) {
|
|
885
|
+
clone = [];
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
else if (!isPlainObject(clone)) {
|
|
889
|
+
clone = {};
|
|
890
|
+
}
|
|
891
|
+
newValue = objExtend(deep, clone, newValue);
|
|
892
|
+
}
|
|
893
|
+
if (newValue !== undefined) {
|
|
894
|
+
extended[prop] = newValue;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
return extended;
|
|
899
|
+
}
|
|
897
900
|
|
|
898
901
|
var strWindow = "window";
|
|
899
902
|
var strDocument = "document";
|
|
@@ -909,6 +912,7 @@
|
|
|
909
912
|
var strReactNative = "ReactNative";
|
|
910
913
|
var strMsie = "msie";
|
|
911
914
|
var strTrident = "trident/";
|
|
915
|
+
var strXMLHttpRequest = "XMLHttpRequest";
|
|
912
916
|
var _isTrident = null;
|
|
913
917
|
var _navUserAgentCheck = null;
|
|
914
918
|
var _enableMocks = false;
|
|
@@ -1035,7 +1039,7 @@
|
|
|
1035
1039
|
var nav = getNavigator();
|
|
1036
1040
|
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
1037
1041
|
_navUserAgentCheck = nav.userAgent;
|
|
1038
|
-
var userAgent = (_navUserAgentCheck ||
|
|
1042
|
+
var userAgent = (_navUserAgentCheck || strEmpty).toLowerCase();
|
|
1039
1043
|
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
1040
1044
|
}
|
|
1041
1045
|
return _isTrident;
|
|
@@ -1044,9 +1048,9 @@
|
|
|
1044
1048
|
if (userAgentStr === void 0) { userAgentStr = null; }
|
|
1045
1049
|
if (!userAgentStr) {
|
|
1046
1050
|
var navigator_1 = getNavigator() || {};
|
|
1047
|
-
userAgentStr = navigator_1 ? (navigator_1.userAgent ||
|
|
1051
|
+
userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty).toLowerCase() : strEmpty;
|
|
1048
1052
|
}
|
|
1049
|
-
var ua = (userAgentStr ||
|
|
1053
|
+
var ua = (userAgentStr || strEmpty).toLowerCase();
|
|
1050
1054
|
if (strContains(ua, strMsie)) {
|
|
1051
1055
|
var doc = getDocument() || {};
|
|
1052
1056
|
return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
|
|
@@ -1061,7 +1065,7 @@
|
|
|
1061
1065
|
}
|
|
1062
1066
|
function dumpObj(object) {
|
|
1063
1067
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
1064
|
-
var propertyValueDump =
|
|
1068
|
+
var propertyValueDump = strEmpty;
|
|
1065
1069
|
if (objectTypeDump === "[object Error]") {
|
|
1066
1070
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
1067
1071
|
}
|
|
@@ -1073,9 +1077,9 @@
|
|
|
1073
1077
|
function isSafari(userAgentStr) {
|
|
1074
1078
|
if (!userAgentStr || !isString(userAgentStr)) {
|
|
1075
1079
|
var navigator_2 = getNavigator() || {};
|
|
1076
|
-
userAgentStr = navigator_2 ? (navigator_2.userAgent ||
|
|
1080
|
+
userAgentStr = navigator_2 ? (navigator_2.userAgent || strEmpty).toLowerCase() : strEmpty;
|
|
1077
1081
|
}
|
|
1078
|
-
var ua = (userAgentStr ||
|
|
1082
|
+
var ua = (userAgentStr || strEmpty).toLowerCase();
|
|
1079
1083
|
return (ua.indexOf("safari") >= 0);
|
|
1080
1084
|
}
|
|
1081
1085
|
function isBeaconsSupported() {
|
|
@@ -1087,8 +1091,7 @@
|
|
|
1087
1091
|
function isFetchSupported(withKeepAlive) {
|
|
1088
1092
|
var isSupported = false;
|
|
1089
1093
|
try {
|
|
1090
|
-
|
|
1091
|
-
isSupported = !!fetchApi;
|
|
1094
|
+
isSupported = !!getGlobalInst("fetch");
|
|
1092
1095
|
var request = getGlobalInst("Request");
|
|
1093
1096
|
if (isSupported && withKeepAlive && request) {
|
|
1094
1097
|
isSupported = _hasProperty(request, "keepalive");
|
|
@@ -1100,9 +1103,9 @@
|
|
|
1100
1103
|
}
|
|
1101
1104
|
function useXDomainRequest() {
|
|
1102
1105
|
if (_useXDomainRequest === null) {
|
|
1103
|
-
_useXDomainRequest = (typeof XDomainRequest !==
|
|
1106
|
+
_useXDomainRequest = (typeof XDomainRequest !== strShimUndefined);
|
|
1104
1107
|
if (_useXDomainRequest && isXhrSupported()) {
|
|
1105
|
-
_useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(
|
|
1108
|
+
_useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(strXMLHttpRequest), "withCredentials");
|
|
1106
1109
|
}
|
|
1107
1110
|
}
|
|
1108
1111
|
return _useXDomainRequest;
|
|
@@ -1110,7 +1113,7 @@
|
|
|
1110
1113
|
function isXhrSupported() {
|
|
1111
1114
|
var isSupported = false;
|
|
1112
1115
|
try {
|
|
1113
|
-
var xmlHttpRequest = getGlobalInst(
|
|
1116
|
+
var xmlHttpRequest = getGlobalInst(strXMLHttpRequest);
|
|
1114
1117
|
isSupported = !!xmlHttpRequest;
|
|
1115
1118
|
}
|
|
1116
1119
|
catch (e) {
|
|
@@ -1164,9 +1167,9 @@
|
|
|
1164
1167
|
var strWarnToConsole = "warnToConsole";
|
|
1165
1168
|
function _sanitizeDiagnosticText(text) {
|
|
1166
1169
|
if (text) {
|
|
1167
|
-
return "\"" + text.replace(/\"/g,
|
|
1170
|
+
return "\"" + text.replace(/\"/g, strEmpty) + "\"";
|
|
1168
1171
|
}
|
|
1169
|
-
return
|
|
1172
|
+
return strEmpty;
|
|
1170
1173
|
}
|
|
1171
1174
|
function _logToConsole(func, message) {
|
|
1172
1175
|
var theConsole = getConsole();
|
|
@@ -1188,12 +1191,12 @@
|
|
|
1188
1191
|
_self.message =
|
|
1189
1192
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
1190
1193
|
msgId;
|
|
1191
|
-
var strProps =
|
|
1194
|
+
var strProps = strEmpty;
|
|
1192
1195
|
if (hasJSON()) {
|
|
1193
1196
|
strProps = getJSON().stringify(properties);
|
|
1194
1197
|
}
|
|
1195
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
1196
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
1198
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty) +
|
|
1199
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty);
|
|
1197
1200
|
_self.message += diagnosticText;
|
|
1198
1201
|
}
|
|
1199
1202
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -1223,7 +1226,7 @@
|
|
|
1223
1226
|
throw message;
|
|
1224
1227
|
}
|
|
1225
1228
|
else {
|
|
1226
|
-
var logFunc = severity ===
|
|
1229
|
+
var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
|
|
1227
1230
|
if (!isUndefined(message.message)) {
|
|
1228
1231
|
var logLevel = _self.consoleLoggingLevel();
|
|
1229
1232
|
if (isUserAct) {
|
|
@@ -1241,7 +1244,7 @@
|
|
|
1241
1244
|
_self.logInternalMessage(severity, message);
|
|
1242
1245
|
}
|
|
1243
1246
|
else {
|
|
1244
|
-
_debugExtMsg("throw" + (severity ===
|
|
1247
|
+
_debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
|
|
1245
1248
|
}
|
|
1246
1249
|
}
|
|
1247
1250
|
};
|
|
@@ -1273,13 +1276,13 @@
|
|
|
1273
1276
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
1274
1277
|
_self.queue.push(message);
|
|
1275
1278
|
_messageCount++;
|
|
1276
|
-
_debugExtMsg((severity ===
|
|
1279
|
+
_debugExtMsg((severity === 1 ? "error" : "warn"), message);
|
|
1277
1280
|
}
|
|
1278
1281
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
1279
1282
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
1280
|
-
var throttleMessage = new _InternalLogMessage(
|
|
1283
|
+
var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
|
|
1281
1284
|
_self.queue.push(throttleMessage);
|
|
1282
|
-
if (severity ===
|
|
1285
|
+
if (severity === 1 ) {
|
|
1283
1286
|
_self.errorToConsole(throttleLimitMessage);
|
|
1284
1287
|
}
|
|
1285
1288
|
else {
|
|
@@ -1308,6 +1311,10 @@
|
|
|
1308
1311
|
}
|
|
1309
1312
|
return DiagnosticLogger;
|
|
1310
1313
|
}());
|
|
1314
|
+
function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
|
|
1315
|
+
if (isUserAct === void 0) { isUserAct = false; }
|
|
1316
|
+
(logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
|
|
1317
|
+
}
|
|
1311
1318
|
|
|
1312
1319
|
var strExecutionContextKey = "ctx";
|
|
1313
1320
|
var _defaultPerfManager = null;
|
|
@@ -1456,369 +1463,587 @@
|
|
|
1456
1463
|
return _defaultPerfManager;
|
|
1457
1464
|
}
|
|
1458
1465
|
|
|
1459
|
-
var
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
return plugin;
|
|
1468
|
-
};
|
|
1469
|
-
_self.getNext = function () {
|
|
1470
|
-
return _nextProxy;
|
|
1471
|
-
};
|
|
1472
|
-
_self.setNext = function (nextPlugin) {
|
|
1473
|
-
_nextProxy = nextPlugin;
|
|
1474
|
-
};
|
|
1475
|
-
_self.processTelemetry = function (env, itemCtx) {
|
|
1476
|
-
if (!itemCtx) {
|
|
1477
|
-
itemCtx = defItemCtx;
|
|
1478
|
-
}
|
|
1479
|
-
var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
|
|
1480
|
-
doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
|
|
1481
|
-
if (plugin && _hasProcessTelemetry) {
|
|
1482
|
-
_self._hasRun = true;
|
|
1483
|
-
try {
|
|
1484
|
-
itemCtx.setNext(_nextProxy);
|
|
1485
|
-
if (_hasSetNext) {
|
|
1486
|
-
plugin.setNextPlugin(_nextProxy);
|
|
1487
|
-
}
|
|
1488
|
-
_nextProxy && (_nextProxy._hasRun = false);
|
|
1489
|
-
plugin.processTelemetry(env, itemCtx);
|
|
1490
|
-
}
|
|
1491
|
-
catch (error) {
|
|
1492
|
-
var hasRun = _nextProxy && _nextProxy._hasRun;
|
|
1493
|
-
if (!_nextProxy || !hasRun) {
|
|
1494
|
-
itemCtx.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
|
|
1495
|
-
}
|
|
1496
|
-
if (_nextProxy && !hasRun) {
|
|
1497
|
-
_nextProxy.processTelemetry(env, itemCtx);
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
else if (_nextProxy) {
|
|
1502
|
-
_self._hasRun = true;
|
|
1503
|
-
_nextProxy.processTelemetry(env, itemCtx);
|
|
1504
|
-
}
|
|
1505
|
-
}, function () { return ({ item: env }); }, !(env.sync));
|
|
1506
|
-
};
|
|
1466
|
+
var UInt32Mask = 0x100000000;
|
|
1467
|
+
var MaxUInt32 = 0xffffffff;
|
|
1468
|
+
var _mwcSeeded = false;
|
|
1469
|
+
var _mwcW = 123456789;
|
|
1470
|
+
var _mwcZ = 987654321;
|
|
1471
|
+
function _mwcSeed(seedValue) {
|
|
1472
|
+
if (seedValue < 0) {
|
|
1473
|
+
seedValue >>>= 0;
|
|
1507
1474
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
var
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1475
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
1476
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
1477
|
+
_mwcSeeded = true;
|
|
1478
|
+
}
|
|
1479
|
+
function _autoSeedMwc() {
|
|
1480
|
+
try {
|
|
1481
|
+
var now = dateNow() & 0x7fffffff;
|
|
1482
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
1483
|
+
}
|
|
1484
|
+
catch (e) {
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
function randomValue(maxValue) {
|
|
1488
|
+
if (maxValue > 0) {
|
|
1489
|
+
return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
|
|
1490
|
+
}
|
|
1491
|
+
return 0;
|
|
1492
|
+
}
|
|
1493
|
+
function random32(signed) {
|
|
1494
|
+
var value = 0;
|
|
1495
|
+
var c = getCrypto() || getMsCrypto();
|
|
1496
|
+
if (c && c.getRandomValues) {
|
|
1497
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1498
|
+
}
|
|
1499
|
+
if (value === 0 && isIE()) {
|
|
1500
|
+
if (!_mwcSeeded) {
|
|
1501
|
+
_autoSeedMwc();
|
|
1525
1502
|
}
|
|
1503
|
+
value = mwcRandom32() & MaxUInt32;
|
|
1526
1504
|
}
|
|
1527
|
-
|
|
1505
|
+
if (value === 0) {
|
|
1506
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1507
|
+
}
|
|
1508
|
+
if (!signed) {
|
|
1509
|
+
value >>>= 0;
|
|
1510
|
+
}
|
|
1511
|
+
return value;
|
|
1528
1512
|
}
|
|
1529
|
-
function
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1513
|
+
function mwcRandomSeed(value) {
|
|
1514
|
+
if (!value) {
|
|
1515
|
+
_autoSeedMwc();
|
|
1516
|
+
}
|
|
1517
|
+
else {
|
|
1518
|
+
_mwcSeed(value);
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
function mwcRandom32(signed) {
|
|
1522
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1523
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1524
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1525
|
+
if (!signed) {
|
|
1526
|
+
value >>>= 0;
|
|
1527
|
+
}
|
|
1528
|
+
return value;
|
|
1529
|
+
}
|
|
1530
|
+
function newId(maxLength) {
|
|
1531
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1532
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1533
|
+
var number = random32() >>> 0;
|
|
1534
|
+
var chars = 0;
|
|
1535
|
+
var result = strEmpty;
|
|
1536
|
+
while (result.length < maxLength) {
|
|
1537
|
+
chars++;
|
|
1538
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1539
|
+
number >>>= 6;
|
|
1540
|
+
if (chars === 5) {
|
|
1541
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1542
|
+
chars = 0;
|
|
1540
1543
|
}
|
|
1541
1544
|
}
|
|
1542
|
-
|
|
1543
|
-
|
|
1545
|
+
return result;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
1549
|
+
var version = "2.8.0-nightly.2204-04";
|
|
1550
|
+
var instanceName = "." + newId(6);
|
|
1551
|
+
var _dataUid = 0;
|
|
1552
|
+
function _createAccessor(target, prop, value) {
|
|
1553
|
+
if (_objDefineProperty) {
|
|
1554
|
+
try {
|
|
1555
|
+
_objDefineProperty(target, prop, {
|
|
1556
|
+
value: value,
|
|
1557
|
+
enumerable: false,
|
|
1558
|
+
configurable: true
|
|
1559
|
+
});
|
|
1560
|
+
return true;
|
|
1561
|
+
}
|
|
1562
|
+
catch (e) {
|
|
1563
|
+
}
|
|
1544
1564
|
}
|
|
1545
|
-
return
|
|
1565
|
+
return false;
|
|
1546
1566
|
}
|
|
1547
|
-
function
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1567
|
+
function _canAcceptData(target) {
|
|
1568
|
+
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1569
|
+
}
|
|
1570
|
+
function _getCache(data, target) {
|
|
1571
|
+
var theCache = target[data.id];
|
|
1572
|
+
if (!theCache) {
|
|
1573
|
+
theCache = {};
|
|
1574
|
+
try {
|
|
1575
|
+
if (_canAcceptData(target)) {
|
|
1576
|
+
if (!_createAccessor(target, data.id, theCache)) {
|
|
1577
|
+
target[data.id] = theCache;
|
|
1578
|
+
}
|
|
1556
1579
|
}
|
|
1557
|
-
});
|
|
1558
|
-
}
|
|
1559
|
-
if (startAt && !add) {
|
|
1560
|
-
if (!plugins) {
|
|
1561
|
-
plugins = [];
|
|
1562
1580
|
}
|
|
1563
|
-
|
|
1581
|
+
catch (e) {
|
|
1582
|
+
}
|
|
1564
1583
|
}
|
|
1565
|
-
return
|
|
1584
|
+
return theCache;
|
|
1566
1585
|
}
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1586
|
+
function createUniqueNamespace(name, includeVersion) {
|
|
1587
|
+
if (includeVersion === void 0) { includeVersion = false; }
|
|
1588
|
+
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1589
|
+
}
|
|
1590
|
+
function createElmNodeData(name) {
|
|
1591
|
+
var data = {
|
|
1592
|
+
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1593
|
+
accept: function (target) {
|
|
1594
|
+
return _canAcceptData(target);
|
|
1595
|
+
},
|
|
1596
|
+
get: function (target, name, defValue, addDefault) {
|
|
1597
|
+
var theCache = target[data.id];
|
|
1598
|
+
if (!theCache) {
|
|
1599
|
+
if (addDefault) {
|
|
1600
|
+
theCache = _getCache(data, target);
|
|
1601
|
+
theCache[normalizeJsName(name)] = defValue;
|
|
1602
|
+
}
|
|
1603
|
+
return defValue;
|
|
1574
1604
|
}
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1605
|
+
return theCache[normalizeJsName(name)];
|
|
1606
|
+
},
|
|
1607
|
+
kill: function (target, name) {
|
|
1608
|
+
if (target && target[name]) {
|
|
1609
|
+
try {
|
|
1610
|
+
delete target[name];
|
|
1578
1611
|
}
|
|
1579
|
-
|
|
1580
|
-
_nextProxy = _createProxyChain(plugins, _self);
|
|
1612
|
+
catch (e) {
|
|
1581
1613
|
}
|
|
1582
1614
|
}
|
|
1583
1615
|
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1616
|
+
};
|
|
1617
|
+
return data;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
var strDoUnload = "_doUnload";
|
|
1621
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1622
|
+
function _getPluginState(plugin) {
|
|
1623
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1624
|
+
}
|
|
1625
|
+
function initializePlugins(processContext, extensions) {
|
|
1626
|
+
var initPlugins = [];
|
|
1627
|
+
var lastPlugin = null;
|
|
1628
|
+
var proxy = processContext.getNext();
|
|
1629
|
+
var pluginState;
|
|
1630
|
+
while (proxy) {
|
|
1631
|
+
var thePlugin = proxy.getPlugin();
|
|
1632
|
+
if (thePlugin) {
|
|
1633
|
+
if (lastPlugin &&
|
|
1634
|
+
isFunction(lastPlugin[strSetNextPlugin]) &&
|
|
1635
|
+
isFunction(thePlugin[strProcessTelemetry])) {
|
|
1636
|
+
lastPlugin[strSetNextPlugin](thePlugin);
|
|
1601
1637
|
}
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
if (defaultValue === void 0) { defaultValue = false; }
|
|
1606
|
-
var theValue;
|
|
1607
|
-
var extConfig = _self.getExtCfg(identifier, null);
|
|
1608
|
-
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1609
|
-
theValue = extConfig[field];
|
|
1638
|
+
var isInitialized = false;
|
|
1639
|
+
if (isFunction(thePlugin[strIsInitialized])) {
|
|
1640
|
+
isInitialized = thePlugin[strIsInitialized]();
|
|
1610
1641
|
}
|
|
1611
|
-
else
|
|
1612
|
-
|
|
1642
|
+
else {
|
|
1643
|
+
pluginState = _getPluginState(thePlugin);
|
|
1644
|
+
isInitialized = pluginState[strIsInitialized];
|
|
1613
1645
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
_self.hasNext = function () {
|
|
1617
|
-
return _nextProxy != null;
|
|
1618
|
-
};
|
|
1619
|
-
_self.getNext = function () {
|
|
1620
|
-
return _nextProxy;
|
|
1621
|
-
};
|
|
1622
|
-
_self.setNext = function (nextPlugin) {
|
|
1623
|
-
_nextProxy = nextPlugin;
|
|
1624
|
-
};
|
|
1625
|
-
_self.processNext = function (env) {
|
|
1626
|
-
var nextPlugin = _nextProxy;
|
|
1627
|
-
if (nextPlugin) {
|
|
1628
|
-
_nextProxy = nextPlugin.getNext();
|
|
1629
|
-
nextPlugin.processTelemetry(env, _self);
|
|
1646
|
+
if (!isInitialized) {
|
|
1647
|
+
initPlugins.push(thePlugin);
|
|
1630
1648
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1635
|
-
};
|
|
1649
|
+
lastPlugin = thePlugin;
|
|
1650
|
+
proxy = proxy.getNext();
|
|
1651
|
+
}
|
|
1636
1652
|
}
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1653
|
+
arrForEach(initPlugins, function (thePlugin) {
|
|
1654
|
+
var core = processContext.core();
|
|
1655
|
+
thePlugin.initialize(processContext.getCfg(), core, extensions, processContext.getNext());
|
|
1656
|
+
pluginState = _getPluginState(thePlugin);
|
|
1657
|
+
if (!thePlugin[strCore] && !pluginState[strCore]) {
|
|
1658
|
+
pluginState[strCore] = core;
|
|
1659
|
+
}
|
|
1660
|
+
pluginState[strIsInitialized] = true;
|
|
1661
|
+
delete pluginState[strTeardown];
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
function sortPlugins(plugins) {
|
|
1665
|
+
return plugins.sort(function (extA, extB) {
|
|
1666
|
+
var result = 0;
|
|
1667
|
+
var bHasProcess = isFunction(extB[strProcessTelemetry]);
|
|
1668
|
+
if (isFunction(extA[strProcessTelemetry])) {
|
|
1669
|
+
result = bHasProcess ? extA[strPriority] - extB[strPriority] : 1;
|
|
1670
|
+
}
|
|
1671
|
+
else if (bHasProcess) {
|
|
1672
|
+
result = -1;
|
|
1673
|
+
}
|
|
1674
|
+
return result;
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
function unloadComponents(components, unloadCtx, unloadState, asyncCallback) {
|
|
1678
|
+
var idx = 0;
|
|
1679
|
+
function _doUnload() {
|
|
1680
|
+
while (idx < components.length) {
|
|
1681
|
+
var component = components[idx++];
|
|
1682
|
+
if (component) {
|
|
1683
|
+
var func = component[strDoUnload] || component[strDoTeardown];
|
|
1684
|
+
if (isFunction(func)) {
|
|
1685
|
+
if (func.call(component, unloadCtx, unloadState, _doUnload) === true) {
|
|
1686
|
+
return true;
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
return _doUnload();
|
|
1693
|
+
}
|
|
1642
1694
|
|
|
1643
|
-
var
|
|
1644
|
-
var
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1695
|
+
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1696
|
+
var strHasRunFlags = "_hasRun";
|
|
1697
|
+
var strGetTelCtx = "_getTelCtx";
|
|
1698
|
+
var _chainId = 0;
|
|
1699
|
+
function _getNextProxyStart(proxy, config, core, startAt) {
|
|
1700
|
+
while (proxy) {
|
|
1701
|
+
if (proxy.getPlugin() === startAt) {
|
|
1702
|
+
return proxy;
|
|
1703
|
+
}
|
|
1704
|
+
proxy = proxy.getNext();
|
|
1705
|
+
}
|
|
1706
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1707
|
+
}
|
|
1708
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1709
|
+
var _nextProxy = null;
|
|
1710
|
+
var _onComplete = [];
|
|
1711
|
+
if (startAt !== null) {
|
|
1712
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1713
|
+
}
|
|
1714
|
+
var context = {
|
|
1715
|
+
_next: _moveNext,
|
|
1716
|
+
ctx: {
|
|
1717
|
+
core: function () {
|
|
1718
|
+
return core;
|
|
1719
|
+
},
|
|
1720
|
+
diagLog: function () {
|
|
1721
|
+
return safeGetLogger(core, config);
|
|
1722
|
+
},
|
|
1723
|
+
getCfg: function () {
|
|
1724
|
+
return config;
|
|
1725
|
+
},
|
|
1726
|
+
getExtCfg: _getExtCfg,
|
|
1727
|
+
getConfig: _getConfig,
|
|
1728
|
+
hasNext: function () {
|
|
1729
|
+
return !!_nextProxy;
|
|
1730
|
+
},
|
|
1731
|
+
getNext: function () {
|
|
1732
|
+
return _nextProxy;
|
|
1733
|
+
},
|
|
1734
|
+
setNext: function (nextPlugin) {
|
|
1735
|
+
_nextProxy = nextPlugin;
|
|
1736
|
+
},
|
|
1737
|
+
iterate: _iterateChain,
|
|
1738
|
+
onComplete: _addOnComplete
|
|
1739
|
+
}
|
|
1740
|
+
};
|
|
1741
|
+
function _addOnComplete(onComplete, that) {
|
|
1742
|
+
var args = [];
|
|
1743
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1744
|
+
args[_i - 2] = arguments[_i];
|
|
1745
|
+
}
|
|
1746
|
+
if (onComplete) {
|
|
1747
|
+
_onComplete.push({
|
|
1748
|
+
func: onComplete,
|
|
1749
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1750
|
+
args: args
|
|
1751
|
+
});
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
function _moveNext() {
|
|
1755
|
+
var nextProxy = _nextProxy;
|
|
1756
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1757
|
+
if (!nextProxy) {
|
|
1758
|
+
var onComplete = _onComplete;
|
|
1759
|
+
if (onComplete && onComplete.length > 0) {
|
|
1760
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
1761
|
+
try {
|
|
1762
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1763
|
+
}
|
|
1764
|
+
catch (e) {
|
|
1765
|
+
_throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1766
|
+
}
|
|
1767
|
+
});
|
|
1768
|
+
_onComplete = [];
|
|
1666
1769
|
}
|
|
1667
|
-
|
|
1668
|
-
|
|
1770
|
+
}
|
|
1771
|
+
return nextProxy;
|
|
1772
|
+
}
|
|
1773
|
+
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1774
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1775
|
+
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
1776
|
+
var theConfig;
|
|
1777
|
+
if (config) {
|
|
1778
|
+
var extConfig = config.extensionConfig;
|
|
1779
|
+
if (extConfig && identifier) {
|
|
1780
|
+
theConfig = extConfig[identifier];
|
|
1669
1781
|
}
|
|
1670
|
-
}
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1782
|
+
}
|
|
1783
|
+
if (!theConfig) {
|
|
1784
|
+
theConfig = defaultValue;
|
|
1785
|
+
}
|
|
1786
|
+
else if (isObject(defaultValue)) {
|
|
1787
|
+
if (mergeDefault !== 0 ) {
|
|
1788
|
+
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1789
|
+
if (config && mergeDefault === 2 ) {
|
|
1790
|
+
objForEachKey(defaultValue, function (field) {
|
|
1791
|
+
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1792
|
+
var cfgValue = config[field];
|
|
1793
|
+
if (!isNullOrUndefined(cfgValue)) {
|
|
1794
|
+
newConfig_1[field] = cfgValue;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
});
|
|
1681
1798
|
}
|
|
1682
1799
|
}
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
return BaseTelemetryPlugin;
|
|
1705
|
-
}());
|
|
1706
|
-
|
|
1707
|
-
var processTelemetry = "processTelemetry";
|
|
1708
|
-
var priority = "priority";
|
|
1709
|
-
var setNextPlugin = "setNextPlugin";
|
|
1710
|
-
var isInitialized = "isInitialized";
|
|
1711
|
-
function initializePlugins(processContext, extensions) {
|
|
1712
|
-
var initPlugins = [];
|
|
1713
|
-
var lastPlugin = null;
|
|
1714
|
-
var proxy = processContext.getNext();
|
|
1715
|
-
while (proxy) {
|
|
1716
|
-
var thePlugin = proxy.getPlugin();
|
|
1717
|
-
if (thePlugin) {
|
|
1718
|
-
if (lastPlugin &&
|
|
1719
|
-
isFunction(lastPlugin[setNextPlugin]) &&
|
|
1720
|
-
isFunction(thePlugin[processTelemetry])) {
|
|
1721
|
-
lastPlugin[setNextPlugin](thePlugin);
|
|
1722
|
-
}
|
|
1723
|
-
if (!isFunction(thePlugin[isInitialized]) || !thePlugin[isInitialized]()) {
|
|
1724
|
-
initPlugins.push(thePlugin);
|
|
1800
|
+
}
|
|
1801
|
+
return theConfig;
|
|
1802
|
+
}
|
|
1803
|
+
function _getConfig(identifier, field, defaultValue) {
|
|
1804
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
1805
|
+
var theValue;
|
|
1806
|
+
var extConfig = _getExtCfg(identifier, null);
|
|
1807
|
+
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1808
|
+
theValue = extConfig[field];
|
|
1809
|
+
}
|
|
1810
|
+
else if (config && !isNullOrUndefined(config[field])) {
|
|
1811
|
+
theValue = config[field];
|
|
1812
|
+
}
|
|
1813
|
+
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1814
|
+
}
|
|
1815
|
+
function _iterateChain(cb) {
|
|
1816
|
+
var nextPlugin;
|
|
1817
|
+
while (!!(nextPlugin = context._next())) {
|
|
1818
|
+
var plugin = nextPlugin.getPlugin();
|
|
1819
|
+
if (plugin) {
|
|
1820
|
+
cb(plugin);
|
|
1725
1821
|
}
|
|
1726
|
-
lastPlugin = thePlugin;
|
|
1727
|
-
proxy = proxy.getNext();
|
|
1728
1822
|
}
|
|
1729
1823
|
}
|
|
1730
|
-
|
|
1731
|
-
thePlugin.initialize(processContext.getCfg(), processContext.core(), extensions, processContext.getNext());
|
|
1732
|
-
});
|
|
1824
|
+
return context;
|
|
1733
1825
|
}
|
|
1734
|
-
function
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1826
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1827
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1828
|
+
var context = internalContext.ctx;
|
|
1829
|
+
function _processNext(env) {
|
|
1830
|
+
var nextPlugin = internalContext._next();
|
|
1831
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1832
|
+
return !nextPlugin;
|
|
1833
|
+
}
|
|
1834
|
+
function _createNew(plugins, startAt) {
|
|
1835
|
+
if (plugins === void 0) { plugins = null; }
|
|
1836
|
+
if (isArray(plugins)) {
|
|
1837
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1740
1838
|
}
|
|
1741
|
-
|
|
1742
|
-
|
|
1839
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1840
|
+
}
|
|
1841
|
+
context.processNext = _processNext;
|
|
1842
|
+
context.createNew = _createNew;
|
|
1843
|
+
return context;
|
|
1844
|
+
}
|
|
1845
|
+
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1846
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1847
|
+
var context = internalContext.ctx;
|
|
1848
|
+
function _processNext(unloadState) {
|
|
1849
|
+
var nextPlugin = internalContext._next();
|
|
1850
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1851
|
+
return !nextPlugin;
|
|
1852
|
+
}
|
|
1853
|
+
function _createNew(plugins, startAt) {
|
|
1854
|
+
if (plugins === void 0) { plugins = null; }
|
|
1855
|
+
if (isArray(plugins)) {
|
|
1856
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1743
1857
|
}
|
|
1744
|
-
return
|
|
1745
|
-
}
|
|
1858
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1859
|
+
}
|
|
1860
|
+
context.processNext = _processNext;
|
|
1861
|
+
context.createNew = _createNew;
|
|
1862
|
+
return context;
|
|
1863
|
+
}
|
|
1864
|
+
function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
|
|
1865
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1866
|
+
var context = internalContext.ctx;
|
|
1867
|
+
function _processNext(updateState) {
|
|
1868
|
+
return context.iterate(function (plugin) {
|
|
1869
|
+
if (isFunction(plugin[strUpdate])) {
|
|
1870
|
+
plugin[strUpdate](context, updateState);
|
|
1871
|
+
}
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
function _createNew(plugins, startAt) {
|
|
1875
|
+
if (plugins === void 0) { plugins = null; }
|
|
1876
|
+
if (isArray(plugins)) {
|
|
1877
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1878
|
+
}
|
|
1879
|
+
return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
|
|
1880
|
+
}
|
|
1881
|
+
context.processNext = _processNext;
|
|
1882
|
+
context.createNew = _createNew;
|
|
1883
|
+
return context;
|
|
1746
1884
|
}
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
_self.processTelemetry = function (item, itemCtx) {
|
|
1761
|
-
if (_channelQueue) {
|
|
1762
|
-
arrForEach(_channelQueue, function (queues) {
|
|
1763
|
-
if (queues.length > 0) {
|
|
1764
|
-
var chainCtx = _this._getTelCtx(itemCtx).createNew(queues);
|
|
1765
|
-
chainCtx.processNext(item);
|
|
1766
|
-
}
|
|
1767
|
-
});
|
|
1885
|
+
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
1886
|
+
var firstProxy = null;
|
|
1887
|
+
var add = startAt ? false : true;
|
|
1888
|
+
if (isArray(plugins) && plugins.length > 0) {
|
|
1889
|
+
var lastProxy_1 = null;
|
|
1890
|
+
arrForEach(plugins, function (thePlugin) {
|
|
1891
|
+
if (!add && startAt === thePlugin) {
|
|
1892
|
+
add = true;
|
|
1893
|
+
}
|
|
1894
|
+
if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1895
|
+
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
1896
|
+
if (!firstProxy) {
|
|
1897
|
+
firstProxy = newProxy;
|
|
1768
1898
|
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
return _channelQueue;
|
|
1772
|
-
};
|
|
1773
|
-
_self.initialize = function (config, core, extensions) {
|
|
1774
|
-
if (_self.isInitialized()) {
|
|
1775
|
-
return;
|
|
1899
|
+
if (lastProxy_1) {
|
|
1900
|
+
lastProxy_1._setNext(newProxy);
|
|
1776
1901
|
}
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
arrForEach(_channelQueue, function (queue) { return initializePlugins(new ProcessTelemetryContext(queue, config, core), extensions); });
|
|
1780
|
-
};
|
|
1902
|
+
lastProxy_1 = newProxy;
|
|
1903
|
+
}
|
|
1781
1904
|
});
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1905
|
+
}
|
|
1906
|
+
if (startAt && !firstProxy) {
|
|
1907
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1908
|
+
}
|
|
1909
|
+
return firstProxy;
|
|
1910
|
+
}
|
|
1911
|
+
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1912
|
+
var nextProxy = null;
|
|
1913
|
+
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1914
|
+
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1915
|
+
var chainId;
|
|
1916
|
+
if (plugin) {
|
|
1917
|
+
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1918
|
+
}
|
|
1919
|
+
else {
|
|
1920
|
+
chainId = "Unknown-0-" + _chainId++;
|
|
1921
|
+
}
|
|
1922
|
+
var proxyChain = {
|
|
1923
|
+
getPlugin: function () {
|
|
1924
|
+
return plugin;
|
|
1925
|
+
},
|
|
1926
|
+
getNext: function () {
|
|
1927
|
+
return nextProxy;
|
|
1928
|
+
},
|
|
1929
|
+
processTelemetry: _processTelemetry,
|
|
1930
|
+
unload: _unloadPlugin,
|
|
1931
|
+
update: _updatePlugin,
|
|
1932
|
+
_id: chainId,
|
|
1933
|
+
_setNext: function (nextPlugin) {
|
|
1934
|
+
nextProxy = nextPlugin;
|
|
1935
|
+
}
|
|
1936
|
+
};
|
|
1937
|
+
function _getTelCtx() {
|
|
1938
|
+
var itemCtx;
|
|
1939
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1940
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1941
|
+
}
|
|
1942
|
+
if (!itemCtx) {
|
|
1943
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1944
|
+
}
|
|
1945
|
+
return itemCtx;
|
|
1946
|
+
}
|
|
1947
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1948
|
+
var hasRun = false;
|
|
1949
|
+
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1950
|
+
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1951
|
+
if (!hasRunContext) {
|
|
1952
|
+
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1953
|
+
}
|
|
1954
|
+
itemCtx.setNext(nextProxy);
|
|
1955
|
+
if (plugin) {
|
|
1956
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1957
|
+
hasRunContext[chainId] = true;
|
|
1958
|
+
try {
|
|
1959
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty;
|
|
1960
|
+
if (nextId) {
|
|
1961
|
+
hasRunContext[nextId] = false;
|
|
1962
|
+
}
|
|
1963
|
+
hasRun = processPluginFn(itemCtx);
|
|
1786
1964
|
}
|
|
1787
|
-
|
|
1965
|
+
catch (error) {
|
|
1966
|
+
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1967
|
+
if (hasNextRun) {
|
|
1968
|
+
hasRun = true;
|
|
1969
|
+
}
|
|
1970
|
+
if (!nextProxy || !hasNextRun) {
|
|
1971
|
+
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
}, details, isAsync);
|
|
1788
1975
|
}
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1976
|
+
return hasRun;
|
|
1977
|
+
}
|
|
1978
|
+
function _processTelemetry(env, itemCtx) {
|
|
1979
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
1980
|
+
function _callProcessTelemetry(itemCtx) {
|
|
1981
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
1982
|
+
return false;
|
|
1983
|
+
}
|
|
1984
|
+
var pluginState = _getPluginState(plugin);
|
|
1985
|
+
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
1986
|
+
return false;
|
|
1987
|
+
}
|
|
1988
|
+
if (hasSetNext) {
|
|
1989
|
+
plugin.setNextPlugin(nextProxy);
|
|
1796
1990
|
}
|
|
1991
|
+
plugin.processTelemetry(env, itemCtx);
|
|
1992
|
+
return true;
|
|
1993
|
+
}
|
|
1994
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1995
|
+
itemCtx.processNext(env);
|
|
1797
1996
|
}
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1997
|
+
}
|
|
1998
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1999
|
+
function _callTeardown() {
|
|
2000
|
+
var hasRun = false;
|
|
2001
|
+
if (plugin) {
|
|
2002
|
+
var pluginState = _getPluginState(plugin);
|
|
2003
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
2004
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
2005
|
+
pluginState[strCore] = null;
|
|
2006
|
+
pluginState[strTeardown] = true;
|
|
2007
|
+
pluginState[strIsInitialized] = false;
|
|
2008
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
2009
|
+
hasRun = true;
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
1802
2012
|
}
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
2013
|
+
return hasRun;
|
|
2014
|
+
}
|
|
2015
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
2016
|
+
unloadCtx.processNext(unloadState);
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
function _updatePlugin(updateCtx, updateState) {
|
|
2020
|
+
function _callUpdate() {
|
|
2021
|
+
var hasRun = false;
|
|
2022
|
+
if (plugin) {
|
|
2023
|
+
var pluginState = _getPluginState(plugin);
|
|
2024
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
2025
|
+
if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
2026
|
+
if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
|
|
2027
|
+
hasRun = true;
|
|
1808
2028
|
}
|
|
1809
|
-
}
|
|
1810
|
-
_addChannelQueue(extensionQueue_1);
|
|
2029
|
+
}
|
|
1811
2030
|
}
|
|
2031
|
+
return hasRun;
|
|
2032
|
+
}
|
|
2033
|
+
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
2034
|
+
updateCtx.processNext(updateState);
|
|
1812
2035
|
}
|
|
1813
|
-
return _this;
|
|
1814
2036
|
}
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
2037
|
+
return objFreeze(proxyChain);
|
|
2038
|
+
}
|
|
2039
|
+
var ProcessTelemetryContext = /** @class */ (function () {
|
|
2040
|
+
function ProcessTelemetryContext(pluginChain, config, core, startAt) {
|
|
2041
|
+
var _self = this;
|
|
2042
|
+
var context = createProcessTelemetryContext(pluginChain, config, core, startAt);
|
|
2043
|
+
proxyFunctions(_self, context, objKeys(context));
|
|
2044
|
+
}
|
|
2045
|
+
return ProcessTelemetryContext;
|
|
2046
|
+
}());
|
|
1822
2047
|
|
|
1823
2048
|
var strToGMTString = "toGMTString";
|
|
1824
2049
|
var strToUTCString = "toUTCString";
|
|
@@ -1828,7 +2053,6 @@
|
|
|
1828
2053
|
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
1829
2054
|
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
1830
2055
|
var strConfigCookieMgr = "_ckMgr";
|
|
1831
|
-
var strEmpty = "";
|
|
1832
2056
|
var _supportsCookies = null;
|
|
1833
2057
|
var _allowUaSameSite = null;
|
|
1834
2058
|
var _parsedCookieValue = null;
|
|
@@ -1987,7 +2211,7 @@
|
|
|
1987
2211
|
_supportsCookies = doc[strCookie] !== undefined;
|
|
1988
2212
|
}
|
|
1989
2213
|
catch (e) {
|
|
1990
|
-
logger
|
|
2214
|
+
_throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1991
2215
|
}
|
|
1992
2216
|
}
|
|
1993
2217
|
return _supportsCookies;
|
|
@@ -2066,135 +2290,600 @@
|
|
|
2066
2290
|
return false;
|
|
2067
2291
|
}
|
|
2068
2292
|
|
|
2069
|
-
var
|
|
2070
|
-
var
|
|
2071
|
-
|
|
2072
|
-
|
|
2293
|
+
var strIKey = "iKey";
|
|
2294
|
+
var strExtensionConfig = "extensionConfig";
|
|
2295
|
+
|
|
2296
|
+
var ChannelControllerPriority = 500;
|
|
2297
|
+
var ChannelValidationMessage = "Channel has invalid priority - ";
|
|
2298
|
+
function _addChannelQueue(channelQueue, queue, config, core) {
|
|
2299
|
+
if (queue && isArray(queue) && queue.length > 0) {
|
|
2300
|
+
queue = queue.sort(function (a, b) {
|
|
2301
|
+
return a.priority - b.priority;
|
|
2302
|
+
});
|
|
2303
|
+
arrForEach(queue, function (queueItem) {
|
|
2304
|
+
if (queueItem.priority < ChannelControllerPriority) {
|
|
2305
|
+
throwError(ChannelValidationMessage + queueItem.identifier);
|
|
2306
|
+
}
|
|
2307
|
+
});
|
|
2308
|
+
channelQueue.push({
|
|
2309
|
+
queue: objFreeze(queue),
|
|
2310
|
+
chain: createTelemetryProxyChain(queue, config, core)
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2073
2313
|
}
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
var
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
_notificationManager = notificationManager;
|
|
2096
|
-
_self[strNotificationManager] = notificationManager;
|
|
2097
|
-
_self.config = config || {};
|
|
2098
|
-
if (notificationManager && _self.config.disableDbgExt !== true) {
|
|
2099
|
-
notificationManager.addNotificationListener(getDebugListener(config));
|
|
2100
|
-
}
|
|
2101
|
-
if (_self.config.enablePerfMgr) {
|
|
2102
|
-
setValue(_self.config, "createPerfMgr", _createPerfManager);
|
|
2314
|
+
function createChannelControllerPlugin(channelQueue, core) {
|
|
2315
|
+
var _a;
|
|
2316
|
+
function _getTelCtx() {
|
|
2317
|
+
return createProcessTelemetryContext(null, core.config, core, null);
|
|
2318
|
+
}
|
|
2319
|
+
function _processChannelQueue(theChannels, itemCtx, processFn, onComplete) {
|
|
2320
|
+
var waiting = theChannels ? (theChannels.length + 1) : 1;
|
|
2321
|
+
function _runChainOnComplete() {
|
|
2322
|
+
waiting--;
|
|
2323
|
+
if (waiting === 0) {
|
|
2324
|
+
onComplete && onComplete();
|
|
2325
|
+
onComplete = null;
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
if (waiting > 0) {
|
|
2329
|
+
arrForEach(theChannels, function (channels) {
|
|
2330
|
+
if (channels && channels.queue.length > 0) {
|
|
2331
|
+
var channelChain = channels.chain;
|
|
2332
|
+
var chainCtx = itemCtx.createNew(channelChain);
|
|
2333
|
+
chainCtx.onComplete(_runChainOnComplete);
|
|
2334
|
+
processFn(chainCtx);
|
|
2103
2335
|
}
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
extConfig.NotificationManager = notificationManager;
|
|
2107
|
-
if (logger) {
|
|
2108
|
-
_self.logger = logger;
|
|
2336
|
+
else {
|
|
2337
|
+
waiting--;
|
|
2109
2338
|
}
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2339
|
+
});
|
|
2340
|
+
}
|
|
2341
|
+
_runChainOnComplete();
|
|
2342
|
+
}
|
|
2343
|
+
function _doUpdate(updateCtx, updateState) {
|
|
2344
|
+
var theUpdateState = updateState || {
|
|
2345
|
+
reason: 0
|
|
2346
|
+
};
|
|
2347
|
+
_processChannelQueue(channelQueue, updateCtx, function (chainCtx) {
|
|
2348
|
+
chainCtx[strProcessNext](theUpdateState);
|
|
2349
|
+
}, function () {
|
|
2350
|
+
updateCtx[strProcessNext](theUpdateState);
|
|
2351
|
+
});
|
|
2352
|
+
return true;
|
|
2353
|
+
}
|
|
2354
|
+
function _doTeardown(unloadCtx, unloadState) {
|
|
2355
|
+
var theUnloadState = unloadState || {
|
|
2356
|
+
reason: 0 ,
|
|
2357
|
+
isAsync: false
|
|
2358
|
+
};
|
|
2359
|
+
_processChannelQueue(channelQueue, unloadCtx, function (chainCtx) {
|
|
2360
|
+
chainCtx[strProcessNext](theUnloadState);
|
|
2361
|
+
}, function () {
|
|
2362
|
+
unloadCtx[strProcessNext](theUnloadState);
|
|
2363
|
+
isInitialized = false;
|
|
2364
|
+
});
|
|
2365
|
+
return true;
|
|
2366
|
+
}
|
|
2367
|
+
function _getChannel(pluginIdentifier) {
|
|
2368
|
+
var thePlugin = null;
|
|
2369
|
+
if (channelQueue && channelQueue.length > 0) {
|
|
2370
|
+
arrForEach(channelQueue, function (channels) {
|
|
2371
|
+
if (channels && channels.queue.length > 0) {
|
|
2372
|
+
arrForEach(channels.queue, function (ext) {
|
|
2373
|
+
if (ext.identifier === pluginIdentifier) {
|
|
2374
|
+
thePlugin = ext;
|
|
2375
|
+
return -1;
|
|
2127
2376
|
}
|
|
2377
|
+
});
|
|
2378
|
+
if (thePlugin) {
|
|
2379
|
+
return -1;
|
|
2128
2380
|
}
|
|
2129
|
-
|
|
2130
|
-
|
|
2381
|
+
}
|
|
2382
|
+
});
|
|
2383
|
+
}
|
|
2384
|
+
return thePlugin;
|
|
2385
|
+
}
|
|
2386
|
+
var isInitialized = false;
|
|
2387
|
+
var channelController = (_a = {
|
|
2388
|
+
identifier: "ChannelControllerPlugin",
|
|
2389
|
+
priority: ChannelControllerPriority,
|
|
2390
|
+
initialize: function (config, core, extensions, pluginChain) {
|
|
2391
|
+
isInitialized = true;
|
|
2392
|
+
arrForEach(channelQueue, function (channels) {
|
|
2393
|
+
if (channels && channels.queue.length > 0) {
|
|
2394
|
+
initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);
|
|
2131
2395
|
}
|
|
2132
2396
|
});
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
}
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
if (
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
eventsSent: function (events) { },
|
|
2174
|
-
eventsDiscarded: function (events, reason) { },
|
|
2175
|
-
eventsSendRequest: function (sendReason, isAsync) { }
|
|
2176
|
-
});
|
|
2177
|
-
_self[strNotificationManager] = _notificationManager;
|
|
2178
|
-
}
|
|
2179
|
-
return _notificationManager;
|
|
2180
|
-
};
|
|
2181
|
-
_self.getCookieMgr = function () {
|
|
2182
|
-
if (!_cookieManager) {
|
|
2183
|
-
_cookieManager = createCookieMgr(_self.config, _self.logger);
|
|
2184
|
-
}
|
|
2185
|
-
return _cookieManager;
|
|
2186
|
-
};
|
|
2187
|
-
_self.setCookieMgr = function (cookieMgr) {
|
|
2188
|
-
_cookieManager = cookieMgr;
|
|
2189
|
-
};
|
|
2190
|
-
_self.getPerfMgr = function () {
|
|
2191
|
-
if (!_perfManager) {
|
|
2192
|
-
if (_self.config && _self.config.enablePerfMgr && isFunction(_self.config.createPerfMgr)) {
|
|
2193
|
-
_perfManager = _self.config.createPerfMgr(_self, _self.getNotifyMgr());
|
|
2397
|
+
},
|
|
2398
|
+
isInitialized: function () {
|
|
2399
|
+
return isInitialized;
|
|
2400
|
+
},
|
|
2401
|
+
processTelemetry: function (item, itemCtx) {
|
|
2402
|
+
_processChannelQueue(channelQueue, itemCtx || _getTelCtx(), function (chainCtx) {
|
|
2403
|
+
chainCtx[strProcessNext](item);
|
|
2404
|
+
}, function () {
|
|
2405
|
+
itemCtx[strProcessNext](item);
|
|
2406
|
+
});
|
|
2407
|
+
},
|
|
2408
|
+
update: _doUpdate
|
|
2409
|
+
},
|
|
2410
|
+
_a[strPause] = function () {
|
|
2411
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2412
|
+
chainCtx.iterate(function (plugin) {
|
|
2413
|
+
plugin[strPause] && plugin[strPause]();
|
|
2414
|
+
});
|
|
2415
|
+
}, null);
|
|
2416
|
+
},
|
|
2417
|
+
_a[strResume] = function () {
|
|
2418
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2419
|
+
chainCtx.iterate(function (plugin) {
|
|
2420
|
+
plugin[strResume] && plugin[strResume]();
|
|
2421
|
+
});
|
|
2422
|
+
}, null);
|
|
2423
|
+
},
|
|
2424
|
+
_a[strTeardown] = _doTeardown,
|
|
2425
|
+
_a.getChannel = _getChannel,
|
|
2426
|
+
_a.flush = function (isAsync, callBack, sendReason, cbTimeout) {
|
|
2427
|
+
var waiting = 1;
|
|
2428
|
+
var doneIterating = false;
|
|
2429
|
+
var cbTimer = null;
|
|
2430
|
+
cbTimeout = cbTimeout || 5000;
|
|
2431
|
+
function doCallback() {
|
|
2432
|
+
waiting--;
|
|
2433
|
+
if (doneIterating && waiting === 0) {
|
|
2434
|
+
if (cbTimer) {
|
|
2435
|
+
clearTimeout(cbTimer);
|
|
2436
|
+
cbTimer = null;
|
|
2194
2437
|
}
|
|
2438
|
+
callBack && callBack(doneIterating);
|
|
2439
|
+
callBack = null;
|
|
2195
2440
|
}
|
|
2196
|
-
|
|
2197
|
-
|
|
2441
|
+
}
|
|
2442
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2443
|
+
chainCtx.iterate(function (plugin) {
|
|
2444
|
+
if (plugin.flush) {
|
|
2445
|
+
waiting++;
|
|
2446
|
+
var handled_1 = false;
|
|
2447
|
+
if (!plugin.flush(isAsync, function () {
|
|
2448
|
+
handled_1 = true;
|
|
2449
|
+
doCallback();
|
|
2450
|
+
}, sendReason)) {
|
|
2451
|
+
if (!handled_1) {
|
|
2452
|
+
if (isAsync && cbTimer == null) {
|
|
2453
|
+
cbTimer = setTimeout(function () {
|
|
2454
|
+
cbTimer = null;
|
|
2455
|
+
doCallback();
|
|
2456
|
+
}, cbTimeout);
|
|
2457
|
+
}
|
|
2458
|
+
else {
|
|
2459
|
+
doCallback();
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
});
|
|
2465
|
+
}, function () {
|
|
2466
|
+
doneIterating = true;
|
|
2467
|
+
doCallback();
|
|
2468
|
+
});
|
|
2469
|
+
return true;
|
|
2470
|
+
},
|
|
2471
|
+
_a._setQueue = function (queue) {
|
|
2472
|
+
channelQueue = queue;
|
|
2473
|
+
},
|
|
2474
|
+
_a);
|
|
2475
|
+
return channelController;
|
|
2476
|
+
}
|
|
2477
|
+
function createChannelQueues(channels, extensions, config, core) {
|
|
2478
|
+
var channelQueue = [];
|
|
2479
|
+
if (channels) {
|
|
2480
|
+
arrForEach(channels, function (queue) { return _addChannelQueue(channelQueue, queue, config, core); });
|
|
2481
|
+
}
|
|
2482
|
+
if (extensions) {
|
|
2483
|
+
var extensionQueue_1 = [];
|
|
2484
|
+
arrForEach(extensions, function (plugin) {
|
|
2485
|
+
if (plugin.priority > ChannelControllerPriority) {
|
|
2486
|
+
extensionQueue_1.push(plugin);
|
|
2487
|
+
}
|
|
2488
|
+
});
|
|
2489
|
+
_addChannelQueue(channelQueue, extensionQueue_1, config, core);
|
|
2490
|
+
}
|
|
2491
|
+
return channelQueue;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
function createUnloadHandlerContainer() {
|
|
2495
|
+
var handlers = [];
|
|
2496
|
+
function _addHandler(handler) {
|
|
2497
|
+
if (handler) {
|
|
2498
|
+
handlers.push(handler);
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
2502
|
+
arrForEach(handlers, function (handler) {
|
|
2503
|
+
try {
|
|
2504
|
+
handler(unloadCtx, unloadState);
|
|
2505
|
+
}
|
|
2506
|
+
catch (e) {
|
|
2507
|
+
_throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
2508
|
+
}
|
|
2509
|
+
});
|
|
2510
|
+
handlers = [];
|
|
2511
|
+
}
|
|
2512
|
+
return {
|
|
2513
|
+
add: _addHandler,
|
|
2514
|
+
run: _runHandlers
|
|
2515
|
+
};
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2518
|
+
var strGetPlugin = "getPlugin";
|
|
2519
|
+
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
2520
|
+
function BaseTelemetryPlugin() {
|
|
2521
|
+
var _self = this;
|
|
2522
|
+
var _isinitialized;
|
|
2523
|
+
var _rootCtx;
|
|
2524
|
+
var _nextPlugin;
|
|
2525
|
+
var _unloadHandlerContainer;
|
|
2526
|
+
var _hooks;
|
|
2527
|
+
_initDefaults();
|
|
2528
|
+
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
2529
|
+
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
2530
|
+
_setDefaults(config, core, pluginChain);
|
|
2531
|
+
_isinitialized = true;
|
|
2532
|
+
};
|
|
2533
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
2534
|
+
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
2535
|
+
return;
|
|
2536
|
+
}
|
|
2537
|
+
var result;
|
|
2538
|
+
var unloadDone = false;
|
|
2539
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
2540
|
+
var theUnloadState = unloadState || {
|
|
2541
|
+
reason: 0 ,
|
|
2542
|
+
isAsync: false
|
|
2543
|
+
};
|
|
2544
|
+
function _unloadCallback() {
|
|
2545
|
+
if (!unloadDone) {
|
|
2546
|
+
unloadDone = true;
|
|
2547
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
2548
|
+
arrForEach(_hooks, function (fn) {
|
|
2549
|
+
fn.rm();
|
|
2550
|
+
});
|
|
2551
|
+
_hooks = [];
|
|
2552
|
+
if (result === true) {
|
|
2553
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
2554
|
+
}
|
|
2555
|
+
_initDefaults();
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
2559
|
+
_unloadCallback();
|
|
2560
|
+
}
|
|
2561
|
+
else {
|
|
2562
|
+
result = true;
|
|
2563
|
+
}
|
|
2564
|
+
return result;
|
|
2565
|
+
};
|
|
2566
|
+
_self.update = function (updateCtx, updateState) {
|
|
2567
|
+
if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
|
|
2568
|
+
return;
|
|
2569
|
+
}
|
|
2570
|
+
var result;
|
|
2571
|
+
var updateDone = false;
|
|
2572
|
+
var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
2573
|
+
var theUpdateState = updateState || {
|
|
2574
|
+
reason: 0
|
|
2575
|
+
};
|
|
2576
|
+
function _updateCallback() {
|
|
2577
|
+
if (!updateDone) {
|
|
2578
|
+
updateDone = true;
|
|
2579
|
+
_setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
|
|
2583
|
+
_updateCallback();
|
|
2584
|
+
}
|
|
2585
|
+
else {
|
|
2586
|
+
result = true;
|
|
2587
|
+
}
|
|
2588
|
+
return result;
|
|
2589
|
+
};
|
|
2590
|
+
_self._addHook = function (hooks) {
|
|
2591
|
+
if (hooks) {
|
|
2592
|
+
if (isArray(hooks)) {
|
|
2593
|
+
_hooks = _hooks.concat(hooks);
|
|
2594
|
+
}
|
|
2595
|
+
else {
|
|
2596
|
+
_hooks.push(hooks);
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
};
|
|
2600
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
2601
|
+
});
|
|
2602
|
+
_self.diagLog = function (itemCtx) {
|
|
2603
|
+
return _getTelCtx(itemCtx).diagLog();
|
|
2604
|
+
};
|
|
2605
|
+
_self[strIsInitialized] = function () {
|
|
2606
|
+
return _isinitialized;
|
|
2607
|
+
};
|
|
2608
|
+
_self.setInitialized = function (isInitialized) {
|
|
2609
|
+
_isinitialized = isInitialized;
|
|
2610
|
+
};
|
|
2611
|
+
_self[strSetNextPlugin] = function (next) {
|
|
2612
|
+
_nextPlugin = next;
|
|
2613
|
+
};
|
|
2614
|
+
_self.processNext = function (env, itemCtx) {
|
|
2615
|
+
if (itemCtx) {
|
|
2616
|
+
itemCtx.processNext(env);
|
|
2617
|
+
}
|
|
2618
|
+
else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
|
|
2619
|
+
_nextPlugin.processTelemetry(env, null);
|
|
2620
|
+
}
|
|
2621
|
+
};
|
|
2622
|
+
_self._getTelCtx = _getTelCtx;
|
|
2623
|
+
function _getTelCtx(currentCtx) {
|
|
2624
|
+
if (currentCtx === void 0) { currentCtx = null; }
|
|
2625
|
+
var itemCtx = currentCtx;
|
|
2626
|
+
if (!itemCtx) {
|
|
2627
|
+
var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
|
|
2628
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
2629
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
2630
|
+
}
|
|
2631
|
+
else {
|
|
2632
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin);
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
return itemCtx;
|
|
2636
|
+
}
|
|
2637
|
+
function _setDefaults(config, core, pluginChain) {
|
|
2638
|
+
if (config) {
|
|
2639
|
+
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
2640
|
+
}
|
|
2641
|
+
if (!pluginChain && core) {
|
|
2642
|
+
pluginChain = core.getProcessTelContext().getNext();
|
|
2643
|
+
}
|
|
2644
|
+
var nextPlugin = _nextPlugin;
|
|
2645
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
2646
|
+
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
2647
|
+
}
|
|
2648
|
+
_self.core = core;
|
|
2649
|
+
_rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
2650
|
+
}
|
|
2651
|
+
function _initDefaults() {
|
|
2652
|
+
_isinitialized = false;
|
|
2653
|
+
_self.core = null;
|
|
2654
|
+
_rootCtx = null;
|
|
2655
|
+
_nextPlugin = null;
|
|
2656
|
+
_hooks = [];
|
|
2657
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
return BaseTelemetryPlugin;
|
|
2661
|
+
}());
|
|
2662
|
+
|
|
2663
|
+
var TelemetryInitializerPlugin = /** @class */ (function (_super) {
|
|
2664
|
+
__extendsFn(TelemetryInitializerPlugin, _super);
|
|
2665
|
+
function TelemetryInitializerPlugin() {
|
|
2666
|
+
var _this = _super.call(this) || this;
|
|
2667
|
+
_this.identifier = "TelemetryInitializerPlugin";
|
|
2668
|
+
_this.priority = 199;
|
|
2669
|
+
var _id;
|
|
2670
|
+
var _initializers;
|
|
2671
|
+
_initDefaults();
|
|
2672
|
+
dynamicProto(TelemetryInitializerPlugin, _this, function (_self, _base) {
|
|
2673
|
+
_self.addTelemetryInitializer = function (telemetryInitializer) {
|
|
2674
|
+
var theInitializer = {
|
|
2675
|
+
id: _id++,
|
|
2676
|
+
fn: telemetryInitializer
|
|
2677
|
+
};
|
|
2678
|
+
_initializers.push(theInitializer);
|
|
2679
|
+
var handler = {
|
|
2680
|
+
remove: function () {
|
|
2681
|
+
arrForEach(_initializers, function (initializer, idx) {
|
|
2682
|
+
if (initializer.id === theInitializer.id) {
|
|
2683
|
+
_initializers.splice(idx, 1);
|
|
2684
|
+
return -1;
|
|
2685
|
+
}
|
|
2686
|
+
});
|
|
2687
|
+
}
|
|
2688
|
+
};
|
|
2689
|
+
return handler;
|
|
2690
|
+
};
|
|
2691
|
+
_self.processTelemetry = function (item, itemCtx) {
|
|
2692
|
+
var doNotSendItem = false;
|
|
2693
|
+
var telemetryInitializersCount = _initializers.length;
|
|
2694
|
+
for (var i = 0; i < telemetryInitializersCount; ++i) {
|
|
2695
|
+
var telemetryInitializer = _initializers[i];
|
|
2696
|
+
if (telemetryInitializer) {
|
|
2697
|
+
try {
|
|
2698
|
+
if (telemetryInitializer.fn.apply(null, [item]) === false) {
|
|
2699
|
+
doNotSendItem = true;
|
|
2700
|
+
break;
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
catch (e) {
|
|
2704
|
+
_throwInternal(itemCtx.diagLog(), 1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
if (!doNotSendItem) {
|
|
2709
|
+
_self.processNext(item, itemCtx);
|
|
2710
|
+
}
|
|
2711
|
+
};
|
|
2712
|
+
_self[strDoTeardown] = function () {
|
|
2713
|
+
_initDefaults();
|
|
2714
|
+
};
|
|
2715
|
+
});
|
|
2716
|
+
function _initDefaults() {
|
|
2717
|
+
_id = 0;
|
|
2718
|
+
_initializers = [];
|
|
2719
|
+
}
|
|
2720
|
+
return _this;
|
|
2721
|
+
}
|
|
2722
|
+
return TelemetryInitializerPlugin;
|
|
2723
|
+
}(BaseTelemetryPlugin));
|
|
2724
|
+
|
|
2725
|
+
var strValidationError = "Plugins must provide initialize method";
|
|
2726
|
+
var strNotificationManager = "_notificationManager";
|
|
2727
|
+
var strSdkUnloadingError = "SDK is still unloading...";
|
|
2728
|
+
var strSdkNotInitialized = "SDK is not initialized";
|
|
2729
|
+
function _createPerfManager(core, notificationMgr) {
|
|
2730
|
+
return new PerfManager(notificationMgr);
|
|
2731
|
+
}
|
|
2732
|
+
function _validateExtensions(logger, channelPriority, allExtensions) {
|
|
2733
|
+
var coreExtensions = [];
|
|
2734
|
+
var extPriorities = {};
|
|
2735
|
+
arrForEach(allExtensions, function (ext) {
|
|
2736
|
+
if (isNullOrUndefined(ext) || isNullOrUndefined(ext.initialize)) {
|
|
2737
|
+
throwError(strValidationError);
|
|
2738
|
+
}
|
|
2739
|
+
var extPriority = ext.priority;
|
|
2740
|
+
var identifier = ext.identifier;
|
|
2741
|
+
if (ext && extPriority) {
|
|
2742
|
+
if (!isNullOrUndefined(extPriorities[extPriority])) {
|
|
2743
|
+
logger.warnToConsole("Two extensions have same priority #" + extPriority + " - " + extPriorities[extPriority] + ", " + identifier);
|
|
2744
|
+
}
|
|
2745
|
+
else {
|
|
2746
|
+
extPriorities[extPriority] = identifier;
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
if (!extPriority || extPriority < channelPriority) {
|
|
2750
|
+
coreExtensions.push(ext);
|
|
2751
|
+
}
|
|
2752
|
+
});
|
|
2753
|
+
return {
|
|
2754
|
+
all: allExtensions,
|
|
2755
|
+
core: coreExtensions
|
|
2756
|
+
};
|
|
2757
|
+
}
|
|
2758
|
+
function _isPluginPresent(thePlugin, plugins) {
|
|
2759
|
+
var exists = false;
|
|
2760
|
+
arrForEach(plugins, function (plugin) {
|
|
2761
|
+
if (plugin === thePlugin) {
|
|
2762
|
+
exists = true;
|
|
2763
|
+
return -1;
|
|
2764
|
+
}
|
|
2765
|
+
});
|
|
2766
|
+
return exists;
|
|
2767
|
+
}
|
|
2768
|
+
function _createDummyNotificationManager() {
|
|
2769
|
+
var _a;
|
|
2770
|
+
return objCreateFn((_a = {},
|
|
2771
|
+
_a[strAddNotificationListener] = function (listener) { },
|
|
2772
|
+
_a[strRemoveNotificationListener] = function (listener) { },
|
|
2773
|
+
_a[strEventsSent] = function (events) { },
|
|
2774
|
+
_a[strEventsDiscarded] = function (events, reason) { },
|
|
2775
|
+
_a[strEventsSendRequest] = function (sendReason, isAsync) { },
|
|
2776
|
+
_a));
|
|
2777
|
+
}
|
|
2778
|
+
var BaseCore = /** @class */ (function () {
|
|
2779
|
+
function BaseCore() {
|
|
2780
|
+
var _isInitialized;
|
|
2781
|
+
var _eventQueue;
|
|
2782
|
+
var _notificationManager;
|
|
2783
|
+
var _perfManager;
|
|
2784
|
+
var _cfgPerfManager;
|
|
2785
|
+
var _cookieManager;
|
|
2786
|
+
var _pluginChain;
|
|
2787
|
+
var _configExtensions;
|
|
2788
|
+
var _coreExtensions;
|
|
2789
|
+
var _channelControl;
|
|
2790
|
+
var _channelConfig;
|
|
2791
|
+
var _channelQueue;
|
|
2792
|
+
var _isUnloading;
|
|
2793
|
+
var _telemetryInitializerPlugin;
|
|
2794
|
+
var _internalLogsEventName;
|
|
2795
|
+
var _evtNamespace;
|
|
2796
|
+
var _unloadHandlers;
|
|
2797
|
+
var _debugListener;
|
|
2798
|
+
var _internalLogPoller = 0;
|
|
2799
|
+
dynamicProto(BaseCore, this, function (_self) {
|
|
2800
|
+
_initDefaults();
|
|
2801
|
+
_self.isInitialized = function () { return _isInitialized; };
|
|
2802
|
+
_self.initialize = function (config, extensions, logger, notificationManager) {
|
|
2803
|
+
if (_isUnloading) {
|
|
2804
|
+
throwError(strSdkUnloadingError);
|
|
2805
|
+
}
|
|
2806
|
+
if (_self.isInitialized()) {
|
|
2807
|
+
throwError("Core should not be initialized more than once");
|
|
2808
|
+
}
|
|
2809
|
+
if (!config || isNullOrUndefined(config.instrumentationKey)) {
|
|
2810
|
+
throwError("Please provide instrumentation key");
|
|
2811
|
+
}
|
|
2812
|
+
_notificationManager = notificationManager;
|
|
2813
|
+
_self[strNotificationManager] = notificationManager;
|
|
2814
|
+
_self.config = config || {};
|
|
2815
|
+
_initDebugListener(config);
|
|
2816
|
+
_initPerfManager(config);
|
|
2817
|
+
config.extensions = isNullOrUndefined(config.extensions) ? [] : config.extensions;
|
|
2818
|
+
_initExtConfig(config);
|
|
2819
|
+
if (logger) {
|
|
2820
|
+
_self.logger = logger;
|
|
2821
|
+
}
|
|
2822
|
+
_configExtensions = [];
|
|
2823
|
+
_configExtensions.push.apply(_configExtensions, __spreadArrayFn(__spreadArrayFn([], extensions, false), config.extensions));
|
|
2824
|
+
_channelConfig = (config || {}).channels;
|
|
2825
|
+
_initPluginChain(config, null);
|
|
2826
|
+
if (!_channelQueue || _channelQueue.length === 0) {
|
|
2827
|
+
throwError("No channels available");
|
|
2828
|
+
}
|
|
2829
|
+
_isInitialized = true;
|
|
2830
|
+
_self.releaseQueue();
|
|
2831
|
+
};
|
|
2832
|
+
_self.getTransmissionControls = function () {
|
|
2833
|
+
var controls = [];
|
|
2834
|
+
if (_channelQueue) {
|
|
2835
|
+
arrForEach(_channelQueue, function (channels) {
|
|
2836
|
+
controls.push(channels.queue);
|
|
2837
|
+
});
|
|
2838
|
+
}
|
|
2839
|
+
return objFreeze(controls);
|
|
2840
|
+
};
|
|
2841
|
+
_self.track = function (telemetryItem) {
|
|
2842
|
+
setValue(telemetryItem, strIKey, _self.config.instrumentationKey, null, isNotTruthy);
|
|
2843
|
+
setValue(telemetryItem, "time", toISOString(new Date()), null, isNotTruthy);
|
|
2844
|
+
setValue(telemetryItem, "ver", "4.0", null, isNullOrUndefined);
|
|
2845
|
+
if (!_isUnloading && _self.isInitialized()) {
|
|
2846
|
+
_createTelCtx().processNext(telemetryItem);
|
|
2847
|
+
}
|
|
2848
|
+
else {
|
|
2849
|
+
_eventQueue.push(telemetryItem);
|
|
2850
|
+
}
|
|
2851
|
+
};
|
|
2852
|
+
_self.getProcessTelContext = _createTelCtx;
|
|
2853
|
+
_self.getNotifyMgr = function () {
|
|
2854
|
+
if (!_notificationManager) {
|
|
2855
|
+
_notificationManager = _createDummyNotificationManager();
|
|
2856
|
+
_self[strNotificationManager] = _notificationManager;
|
|
2857
|
+
}
|
|
2858
|
+
return _notificationManager;
|
|
2859
|
+
};
|
|
2860
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2861
|
+
if (_notificationManager) {
|
|
2862
|
+
_notificationManager[strAddNotificationListener](listener);
|
|
2863
|
+
}
|
|
2864
|
+
};
|
|
2865
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2866
|
+
if (_notificationManager) {
|
|
2867
|
+
_notificationManager[strRemoveNotificationListener](listener);
|
|
2868
|
+
}
|
|
2869
|
+
};
|
|
2870
|
+
_self.getCookieMgr = function () {
|
|
2871
|
+
if (!_cookieManager) {
|
|
2872
|
+
_cookieManager = createCookieMgr(_self.config, _self.logger);
|
|
2873
|
+
}
|
|
2874
|
+
return _cookieManager;
|
|
2875
|
+
};
|
|
2876
|
+
_self.setCookieMgr = function (cookieMgr) {
|
|
2877
|
+
_cookieManager = cookieMgr;
|
|
2878
|
+
};
|
|
2879
|
+
_self.getPerfMgr = function () {
|
|
2880
|
+
if (!_perfManager && !_cfgPerfManager) {
|
|
2881
|
+
if (_self.config && _self.config.enablePerfMgr && isFunction(_self.config.createPerfMgr)) {
|
|
2882
|
+
_cfgPerfManager = _self.config.createPerfMgr(_self, _self.getNotifyMgr());
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
return _perfManager || _cfgPerfManager || getGblPerfMgr();
|
|
2886
|
+
};
|
|
2198
2887
|
_self.setPerfMgr = function (perfMgr) {
|
|
2199
2888
|
_perfManager = perfMgr;
|
|
2200
2889
|
};
|
|
@@ -2202,78 +2891,381 @@
|
|
|
2202
2891
|
return _eventQueue.length;
|
|
2203
2892
|
};
|
|
2204
2893
|
_self.releaseQueue = function () {
|
|
2205
|
-
if (_eventQueue.length > 0) {
|
|
2206
|
-
|
|
2207
|
-
|
|
2894
|
+
if (_isInitialized && _eventQueue.length > 0) {
|
|
2895
|
+
var eventQueue = _eventQueue;
|
|
2896
|
+
_eventQueue = [];
|
|
2897
|
+
arrForEach(eventQueue, function (event) {
|
|
2898
|
+
_createTelCtx().processNext(event);
|
|
2899
|
+
});
|
|
2900
|
+
}
|
|
2901
|
+
};
|
|
2902
|
+
_self.pollInternalLogs = function (eventName) {
|
|
2903
|
+
_internalLogsEventName = eventName || null;
|
|
2904
|
+
var interval = _self.config.diagnosticLogInterval;
|
|
2905
|
+
if (!interval || !(interval > 0)) {
|
|
2906
|
+
interval = 10000;
|
|
2907
|
+
}
|
|
2908
|
+
if (_internalLogPoller) {
|
|
2909
|
+
clearInterval(_internalLogPoller);
|
|
2910
|
+
}
|
|
2911
|
+
_internalLogPoller = setInterval(function () {
|
|
2912
|
+
_flushInternalLogs();
|
|
2913
|
+
}, interval);
|
|
2914
|
+
return _internalLogPoller;
|
|
2915
|
+
};
|
|
2916
|
+
_self.stopPollingInternalLogs = function () {
|
|
2917
|
+
if (_internalLogPoller) {
|
|
2918
|
+
clearInterval(_internalLogPoller);
|
|
2919
|
+
_internalLogPoller = 0;
|
|
2920
|
+
_flushInternalLogs();
|
|
2921
|
+
}
|
|
2922
|
+
};
|
|
2923
|
+
proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, ["addTelemetryInitializer"]);
|
|
2924
|
+
_self.unload = function (isAsync, unloadComplete, cbTimeout) {
|
|
2925
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
2926
|
+
if (!_isInitialized) {
|
|
2927
|
+
throwError(strSdkNotInitialized);
|
|
2928
|
+
}
|
|
2929
|
+
if (_isUnloading) {
|
|
2930
|
+
throwError(strSdkUnloadingError);
|
|
2931
|
+
}
|
|
2932
|
+
var unloadState = {
|
|
2933
|
+
reason: 50 ,
|
|
2934
|
+
isAsync: isAsync,
|
|
2935
|
+
flushComplete: false
|
|
2936
|
+
};
|
|
2937
|
+
var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self.config, _self);
|
|
2938
|
+
processUnloadCtx.onComplete(function () {
|
|
2939
|
+
_initDefaults();
|
|
2940
|
+
unloadComplete && unloadComplete(unloadState);
|
|
2941
|
+
}, _self);
|
|
2942
|
+
function _doUnload(flushComplete) {
|
|
2943
|
+
unloadState.flushComplete = flushComplete;
|
|
2944
|
+
_isUnloading = true;
|
|
2945
|
+
_unloadHandlers.run(processUnloadCtx, unloadState);
|
|
2946
|
+
_self.stopPollingInternalLogs();
|
|
2947
|
+
processUnloadCtx.processNext(unloadState);
|
|
2948
|
+
}
|
|
2949
|
+
if (!_flushChannels(isAsync, _doUnload, 6 , cbTimeout)) {
|
|
2950
|
+
_doUnload(false);
|
|
2951
|
+
}
|
|
2952
|
+
};
|
|
2953
|
+
_self.getPlugin = _getPlugin;
|
|
2954
|
+
_self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {
|
|
2955
|
+
if (!plugin) {
|
|
2956
|
+
addCb && addCb(false);
|
|
2957
|
+
_logOrThrowError(strValidationError);
|
|
2958
|
+
return;
|
|
2959
|
+
}
|
|
2960
|
+
var existingPlugin = _getPlugin(plugin.identifier);
|
|
2961
|
+
if (existingPlugin && !replaceExisting) {
|
|
2962
|
+
addCb && addCb(false);
|
|
2963
|
+
_logOrThrowError("Plugin [" + plugin.identifier + "] is already loaded!");
|
|
2964
|
+
return;
|
|
2965
|
+
}
|
|
2966
|
+
var updateState = {
|
|
2967
|
+
reason: 16
|
|
2968
|
+
};
|
|
2969
|
+
function _addPlugin(removed) {
|
|
2970
|
+
_configExtensions.push(plugin);
|
|
2971
|
+
updateState.added = [plugin];
|
|
2972
|
+
_initPluginChain(_self.config, updateState);
|
|
2973
|
+
addCb && addCb(true);
|
|
2974
|
+
}
|
|
2975
|
+
if (existingPlugin) {
|
|
2976
|
+
var removedPlugins_1 = [existingPlugin.plugin];
|
|
2977
|
+
var unloadState = {
|
|
2978
|
+
reason: 2 ,
|
|
2979
|
+
isAsync: !!isAsync
|
|
2980
|
+
};
|
|
2981
|
+
_removePlugins(removedPlugins_1, unloadState, function (removed) {
|
|
2982
|
+
if (!removed) {
|
|
2983
|
+
addCb && addCb(false);
|
|
2984
|
+
}
|
|
2985
|
+
else {
|
|
2986
|
+
updateState.removed = removedPlugins_1;
|
|
2987
|
+
updateState.reason |= 32 ;
|
|
2988
|
+
_addPlugin();
|
|
2989
|
+
}
|
|
2990
|
+
});
|
|
2991
|
+
}
|
|
2992
|
+
else {
|
|
2993
|
+
_addPlugin();
|
|
2994
|
+
}
|
|
2995
|
+
};
|
|
2996
|
+
_self.evtNamespace = function () {
|
|
2997
|
+
return _evtNamespace;
|
|
2998
|
+
};
|
|
2999
|
+
_self.flush = _flushChannels;
|
|
3000
|
+
proxyFunctionAs(_self, "addUnloadCb", function () { return _unloadHandlers; }, "add");
|
|
3001
|
+
function _initDefaults() {
|
|
3002
|
+
_isInitialized = false;
|
|
3003
|
+
_self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 });
|
|
3004
|
+
_self.config = {};
|
|
3005
|
+
_self._extensions = [];
|
|
3006
|
+
_telemetryInitializerPlugin = new TelemetryInitializerPlugin();
|
|
3007
|
+
_eventQueue = [];
|
|
3008
|
+
_notificationManager = null;
|
|
3009
|
+
_perfManager = null;
|
|
3010
|
+
_cfgPerfManager = null;
|
|
3011
|
+
_cookieManager = null;
|
|
3012
|
+
_pluginChain = null;
|
|
3013
|
+
_coreExtensions = null;
|
|
3014
|
+
_configExtensions = [];
|
|
3015
|
+
_channelControl = null;
|
|
3016
|
+
_channelConfig = null;
|
|
3017
|
+
_channelQueue = null;
|
|
3018
|
+
_isUnloading = false;
|
|
3019
|
+
_internalLogsEventName = null;
|
|
3020
|
+
_evtNamespace = createUniqueNamespace("AIBaseCore", true);
|
|
3021
|
+
_unloadHandlers = createUnloadHandlerContainer();
|
|
3022
|
+
}
|
|
3023
|
+
function _createTelCtx() {
|
|
3024
|
+
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
3025
|
+
}
|
|
3026
|
+
function _initPluginChain(config, updateState) {
|
|
3027
|
+
var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
|
|
3028
|
+
_coreExtensions = theExtensions.core;
|
|
3029
|
+
_pluginChain = null;
|
|
3030
|
+
var allExtensions = theExtensions.all;
|
|
3031
|
+
_channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, config, _self));
|
|
3032
|
+
if (_channelControl) {
|
|
3033
|
+
var idx = allExtensions.indexOf(_channelControl);
|
|
3034
|
+
if (idx !== -1) {
|
|
3035
|
+
allExtensions.splice(idx, 1);
|
|
3036
|
+
}
|
|
3037
|
+
idx = _coreExtensions.indexOf(_channelControl);
|
|
3038
|
+
if (idx !== -1) {
|
|
3039
|
+
_coreExtensions.splice(idx, 1);
|
|
3040
|
+
}
|
|
3041
|
+
_channelControl._setQueue(_channelQueue);
|
|
3042
|
+
}
|
|
3043
|
+
else {
|
|
3044
|
+
_channelControl = createChannelControllerPlugin(_channelQueue, _self);
|
|
3045
|
+
}
|
|
3046
|
+
allExtensions.push(_channelControl);
|
|
3047
|
+
_coreExtensions.push(_channelControl);
|
|
3048
|
+
_self._extensions = sortPlugins(allExtensions);
|
|
3049
|
+
_channelControl.initialize(config, _self, allExtensions);
|
|
3050
|
+
initializePlugins(_createTelCtx(), allExtensions);
|
|
3051
|
+
_self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
|
|
3052
|
+
if (updateState) {
|
|
3053
|
+
_doUpdate(updateState);
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
function _getPlugin(pluginIdentifier) {
|
|
3057
|
+
var theExt = null;
|
|
3058
|
+
var thePlugin = null;
|
|
3059
|
+
arrForEach(_self._extensions, function (ext) {
|
|
3060
|
+
if (ext.identifier === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
|
|
3061
|
+
thePlugin = ext;
|
|
3062
|
+
return -1;
|
|
3063
|
+
}
|
|
3064
|
+
});
|
|
3065
|
+
if (!thePlugin && _channelControl) {
|
|
3066
|
+
thePlugin = _channelControl.getChannel(pluginIdentifier);
|
|
3067
|
+
}
|
|
3068
|
+
if (thePlugin) {
|
|
3069
|
+
theExt = {
|
|
3070
|
+
plugin: thePlugin,
|
|
3071
|
+
setEnabled: function (enabled) {
|
|
3072
|
+
_getPluginState(thePlugin)[strDisabled] = !enabled;
|
|
3073
|
+
},
|
|
3074
|
+
isEnabled: function () {
|
|
3075
|
+
var pluginState = _getPluginState(thePlugin);
|
|
3076
|
+
return !pluginState[strTeardown] && !pluginState[strDisabled];
|
|
3077
|
+
},
|
|
3078
|
+
remove: function (isAsync, removeCb) {
|
|
3079
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
3080
|
+
var pluginsToRemove = [thePlugin];
|
|
3081
|
+
var unloadState = {
|
|
3082
|
+
reason: 1 ,
|
|
3083
|
+
isAsync: isAsync
|
|
3084
|
+
};
|
|
3085
|
+
_removePlugins(pluginsToRemove, unloadState, function (removed) {
|
|
3086
|
+
if (removed) {
|
|
3087
|
+
_initPluginChain(_self.config, {
|
|
3088
|
+
reason: 32 ,
|
|
3089
|
+
removed: pluginsToRemove
|
|
3090
|
+
});
|
|
3091
|
+
}
|
|
3092
|
+
removeCb && removeCb(removed);
|
|
3093
|
+
});
|
|
3094
|
+
}
|
|
3095
|
+
};
|
|
3096
|
+
}
|
|
3097
|
+
return theExt;
|
|
3098
|
+
}
|
|
3099
|
+
function _getPluginChain() {
|
|
3100
|
+
if (!_pluginChain) {
|
|
3101
|
+
var extensions = (_coreExtensions || []).slice();
|
|
3102
|
+
if (extensions.indexOf(_telemetryInitializerPlugin) === -1) {
|
|
3103
|
+
extensions.push(_telemetryInitializerPlugin);
|
|
3104
|
+
}
|
|
3105
|
+
_pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _self.config, _self);
|
|
3106
|
+
}
|
|
3107
|
+
return _pluginChain;
|
|
3108
|
+
}
|
|
3109
|
+
function _removePlugins(thePlugins, unloadState, removeComplete) {
|
|
3110
|
+
if (thePlugins && thePlugins.length > 0) {
|
|
3111
|
+
var unloadChain = createTelemetryProxyChain(thePlugins, _self.config, _self);
|
|
3112
|
+
var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self.config, _self);
|
|
3113
|
+
unloadCtx.onComplete(function () {
|
|
3114
|
+
var removed = false;
|
|
3115
|
+
var newConfigExtensions = [];
|
|
3116
|
+
arrForEach(_configExtensions, function (plugin, idx) {
|
|
3117
|
+
if (!_isPluginPresent(plugin, thePlugins)) {
|
|
3118
|
+
newConfigExtensions.push(plugin);
|
|
3119
|
+
}
|
|
3120
|
+
else {
|
|
3121
|
+
removed = true;
|
|
3122
|
+
}
|
|
3123
|
+
});
|
|
3124
|
+
_configExtensions = newConfigExtensions;
|
|
3125
|
+
var newChannelConfig = [];
|
|
3126
|
+
if (_channelConfig) {
|
|
3127
|
+
arrForEach(_channelConfig, function (queue, idx) {
|
|
3128
|
+
var newQueue = [];
|
|
3129
|
+
arrForEach(queue, function (channel) {
|
|
3130
|
+
if (!_isPluginPresent(channel, thePlugins)) {
|
|
3131
|
+
newQueue.push(channel);
|
|
3132
|
+
}
|
|
3133
|
+
else {
|
|
3134
|
+
removed = true;
|
|
3135
|
+
}
|
|
3136
|
+
});
|
|
3137
|
+
newChannelConfig.push(newQueue);
|
|
3138
|
+
});
|
|
3139
|
+
_channelConfig = newChannelConfig;
|
|
3140
|
+
}
|
|
3141
|
+
removeComplete && removeComplete(removed);
|
|
3142
|
+
});
|
|
3143
|
+
unloadCtx.processNext(unloadState);
|
|
3144
|
+
}
|
|
3145
|
+
else {
|
|
3146
|
+
removeComplete(false);
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
function _flushInternalLogs() {
|
|
3150
|
+
var queue = _self.logger ? _self.logger.queue : [];
|
|
3151
|
+
if (queue) {
|
|
3152
|
+
arrForEach(queue, function (logMessage) {
|
|
3153
|
+
var item = {
|
|
3154
|
+
name: _internalLogsEventName ? _internalLogsEventName : "InternalMessageId: " + logMessage.messageId,
|
|
3155
|
+
iKey: _self.config.instrumentationKey,
|
|
3156
|
+
time: toISOString(new Date()),
|
|
3157
|
+
baseType: _InternalLogMessage.dataType,
|
|
3158
|
+
baseData: { message: logMessage.message }
|
|
3159
|
+
};
|
|
3160
|
+
_self.track(item);
|
|
2208
3161
|
});
|
|
2209
|
-
|
|
3162
|
+
queue.length = 0;
|
|
2210
3163
|
}
|
|
2211
|
-
}
|
|
3164
|
+
}
|
|
3165
|
+
function _flushChannels(isAsync, callBack, sendReason, cbTimeout) {
|
|
3166
|
+
if (_channelControl) {
|
|
3167
|
+
return _channelControl.flush(isAsync, callBack, sendReason || 6 , cbTimeout);
|
|
3168
|
+
}
|
|
3169
|
+
callBack && callBack(false);
|
|
3170
|
+
return true;
|
|
3171
|
+
}
|
|
3172
|
+
function _initDebugListener(config) {
|
|
3173
|
+
if (config.disableDbgExt === true && _debugListener) {
|
|
3174
|
+
_notificationManager[strRemoveNotificationListener](_debugListener);
|
|
3175
|
+
_debugListener = null;
|
|
3176
|
+
}
|
|
3177
|
+
if (_notificationManager && !_debugListener && config.disableDbgExt !== true) {
|
|
3178
|
+
_debugListener = getDebugListener(config);
|
|
3179
|
+
_notificationManager[strAddNotificationListener](_debugListener);
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
function _initPerfManager(config) {
|
|
3183
|
+
if (!config.enablePerfMgr && _cfgPerfManager) {
|
|
3184
|
+
_cfgPerfManager = null;
|
|
3185
|
+
}
|
|
3186
|
+
if (config.enablePerfMgr) {
|
|
3187
|
+
setValue(_self.config, "createPerfMgr", _createPerfManager);
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3190
|
+
function _initExtConfig(config) {
|
|
3191
|
+
var extConfig = getSetValue(config, strExtensionConfig);
|
|
3192
|
+
extConfig.NotificationManager = _notificationManager;
|
|
3193
|
+
}
|
|
3194
|
+
function _doUpdate(updateState) {
|
|
3195
|
+
var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self.config, _self);
|
|
3196
|
+
if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) {
|
|
3197
|
+
updateCtx.processNext(updateState);
|
|
3198
|
+
}
|
|
3199
|
+
}
|
|
3200
|
+
function _logOrThrowError(message) {
|
|
3201
|
+
var logger = _self.logger;
|
|
3202
|
+
if (logger) {
|
|
3203
|
+
_throwInternal(logger, 2 , 73 , message);
|
|
3204
|
+
}
|
|
3205
|
+
else {
|
|
3206
|
+
throwError(message);
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
2212
3209
|
});
|
|
2213
3210
|
}
|
|
2214
3211
|
return BaseCore;
|
|
2215
3212
|
}());
|
|
2216
3213
|
|
|
3214
|
+
function _runListeners(listeners, name, isAsync, callback) {
|
|
3215
|
+
arrForEach(listeners, function (listener) {
|
|
3216
|
+
if (listener && listener[name]) {
|
|
3217
|
+
if (isAsync) {
|
|
3218
|
+
setTimeout(function () { return callback(listener); }, 0);
|
|
3219
|
+
}
|
|
3220
|
+
else {
|
|
3221
|
+
try {
|
|
3222
|
+
callback(listener);
|
|
3223
|
+
}
|
|
3224
|
+
catch (e) {
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
});
|
|
3229
|
+
}
|
|
2217
3230
|
var NotificationManager = /** @class */ (function () {
|
|
2218
3231
|
function NotificationManager(config) {
|
|
2219
3232
|
this.listeners = [];
|
|
2220
3233
|
var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;
|
|
2221
3234
|
dynamicProto(NotificationManager, this, function (_self) {
|
|
2222
|
-
_self
|
|
3235
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2223
3236
|
_self.listeners.push(listener);
|
|
2224
3237
|
};
|
|
2225
|
-
_self
|
|
3238
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2226
3239
|
var index = arrIndexOf(_self.listeners, listener);
|
|
2227
3240
|
while (index > -1) {
|
|
2228
3241
|
_self.listeners.splice(index, 1);
|
|
2229
3242
|
index = arrIndexOf(_self.listeners, listener);
|
|
2230
3243
|
}
|
|
2231
3244
|
};
|
|
2232
|
-
_self
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
setTimeout(function () { return listener.eventsSent(events); }, 0);
|
|
2236
|
-
}
|
|
3245
|
+
_self[strEventsSent] = function (events) {
|
|
3246
|
+
_runListeners(_self.listeners, strEventsSent, true, function (listener) {
|
|
3247
|
+
listener[strEventsSent](events);
|
|
2237
3248
|
});
|
|
2238
3249
|
};
|
|
2239
|
-
_self
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
setTimeout(function () { return listener.eventsDiscarded(events, reason); }, 0);
|
|
2243
|
-
}
|
|
3250
|
+
_self[strEventsDiscarded] = function (events, reason) {
|
|
3251
|
+
_runListeners(_self.listeners, strEventsDiscarded, true, function (listener) {
|
|
3252
|
+
listener[strEventsDiscarded](events, reason);
|
|
2244
3253
|
});
|
|
2245
3254
|
};
|
|
2246
|
-
_self
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
if (isAsync) {
|
|
2250
|
-
setTimeout(function () { return listener.eventsSendRequest(sendReason, isAsync); }, 0);
|
|
2251
|
-
}
|
|
2252
|
-
else {
|
|
2253
|
-
try {
|
|
2254
|
-
listener.eventsSendRequest(sendReason, isAsync);
|
|
2255
|
-
}
|
|
2256
|
-
catch (e) {
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
3255
|
+
_self[strEventsSendRequest] = function (sendReason, isAsync) {
|
|
3256
|
+
_runListeners(_self.listeners, strEventsSendRequest, isAsync, function (listener) {
|
|
3257
|
+
listener[strEventsSendRequest](sendReason, isAsync);
|
|
2260
3258
|
});
|
|
2261
3259
|
};
|
|
2262
|
-
_self
|
|
3260
|
+
_self[strPerfEvent] = function (perfEvent) {
|
|
2263
3261
|
if (perfEvent) {
|
|
2264
3262
|
if (perfEvtsSendAll || !perfEvent.isChildEvt()) {
|
|
2265
|
-
|
|
2266
|
-
if (
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
try {
|
|
2272
|
-
listener.perfEvent(perfEvent);
|
|
2273
|
-
}
|
|
2274
|
-
catch (e) {
|
|
2275
|
-
}
|
|
2276
|
-
}
|
|
3263
|
+
_runListeners(_self.listeners, strPerfEvent, false, function (listener) {
|
|
3264
|
+
if (perfEvent.isAsync) {
|
|
3265
|
+
setTimeout(function () { return listener[strPerfEvent](perfEvent); }, 0);
|
|
3266
|
+
}
|
|
3267
|
+
else {
|
|
3268
|
+
listener[strPerfEvent](perfEvent);
|
|
2277
3269
|
}
|
|
2278
3270
|
});
|
|
2279
3271
|
}
|
|
@@ -2288,7 +3280,6 @@
|
|
|
2288
3280
|
__extendsFn(AppInsightsCore, _super);
|
|
2289
3281
|
function AppInsightsCore() {
|
|
2290
3282
|
var _this = _super.call(this) || this;
|
|
2291
|
-
var _internalLogPoller = 0;
|
|
2292
3283
|
dynamicProto(AppInsightsCore, _this, function (_self, _base) {
|
|
2293
3284
|
_self.initialize = function (config, extensions, logger, notificationManager) {
|
|
2294
3285
|
_base.initialize(config, extensions, logger || new DiagnosticLogger(config), notificationManager || new NotificationManager(config));
|
|
@@ -2303,48 +3294,6 @@
|
|
|
2303
3294
|
_base.track(telemetryItem);
|
|
2304
3295
|
}, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));
|
|
2305
3296
|
};
|
|
2306
|
-
_self.addNotificationListener = function (listener) {
|
|
2307
|
-
var manager = _self.getNotifyMgr();
|
|
2308
|
-
if (manager) {
|
|
2309
|
-
manager.addNotificationListener(listener);
|
|
2310
|
-
}
|
|
2311
|
-
};
|
|
2312
|
-
_self.removeNotificationListener = function (listener) {
|
|
2313
|
-
var manager = _self.getNotifyMgr();
|
|
2314
|
-
if (manager) {
|
|
2315
|
-
manager.removeNotificationListener(listener);
|
|
2316
|
-
}
|
|
2317
|
-
};
|
|
2318
|
-
_self.pollInternalLogs = function (eventName) {
|
|
2319
|
-
var interval = _self.config.diagnosticLogInterval;
|
|
2320
|
-
if (!interval || !(interval > 0)) {
|
|
2321
|
-
interval = 10000;
|
|
2322
|
-
}
|
|
2323
|
-
if (_internalLogPoller) {
|
|
2324
|
-
_self.stopPollingInternalLogs();
|
|
2325
|
-
}
|
|
2326
|
-
_internalLogPoller = setInterval(function () {
|
|
2327
|
-
var queue = _self.logger ? _self.logger.queue : [];
|
|
2328
|
-
arrForEach(queue, function (logMessage) {
|
|
2329
|
-
var item = {
|
|
2330
|
-
name: eventName ? eventName : "InternalMessageId: " + logMessage.messageId,
|
|
2331
|
-
iKey: _self.config.instrumentationKey,
|
|
2332
|
-
time: toISOString(new Date()),
|
|
2333
|
-
baseType: _InternalLogMessage.dataType,
|
|
2334
|
-
baseData: { message: logMessage.message }
|
|
2335
|
-
};
|
|
2336
|
-
_self.track(item);
|
|
2337
|
-
});
|
|
2338
|
-
queue.length = 0;
|
|
2339
|
-
}, interval);
|
|
2340
|
-
return _internalLogPoller;
|
|
2341
|
-
};
|
|
2342
|
-
_self.stopPollingInternalLogs = function () {
|
|
2343
|
-
if (!_internalLogPoller)
|
|
2344
|
-
return;
|
|
2345
|
-
clearInterval(_internalLogPoller);
|
|
2346
|
-
_internalLogPoller = 0;
|
|
2347
|
-
};
|
|
2348
3297
|
function _validateTelemetryItem(telemetryItem) {
|
|
2349
3298
|
if (isNullOrUndefined(telemetryItem.name)) {
|
|
2350
3299
|
_notifyInvalidEvent(telemetryItem);
|
|
@@ -2363,151 +3312,315 @@
|
|
|
2363
3312
|
return AppInsightsCore;
|
|
2364
3313
|
}(BaseCore));
|
|
2365
3314
|
|
|
2366
|
-
var
|
|
2367
|
-
var
|
|
2368
|
-
var
|
|
2369
|
-
var
|
|
2370
|
-
var
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
3315
|
+
var strOnPrefix = "on";
|
|
3316
|
+
var strAttachEvent = "attachEvent";
|
|
3317
|
+
var strAddEventHelper = "addEventListener";
|
|
3318
|
+
var strDetachEvent = "detachEvent";
|
|
3319
|
+
var strRemoveEventListener = "removeEventListener";
|
|
3320
|
+
var strEvents = "events";
|
|
3321
|
+
var strVisibilityChangeEvt = "visibilitychange";
|
|
3322
|
+
var strPageHide = "pagehide";
|
|
3323
|
+
var strPageShow = "pageshow";
|
|
3324
|
+
var strUnload = "unload";
|
|
3325
|
+
var strBeforeUnload = "beforeunload";
|
|
3326
|
+
var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
|
|
3327
|
+
var strPageShowNamespace = createUniqueNamespace("aiEvtPageShow");
|
|
3328
|
+
var rRemoveEmptyNs = /\.[\.]+/g;
|
|
3329
|
+
var rRemoveTrailingEmptyNs = /[\.]+$/;
|
|
3330
|
+
var _guid = 1;
|
|
3331
|
+
var elmNodeData = createElmNodeData("events");
|
|
3332
|
+
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
3333
|
+
function _normalizeNamespace(name) {
|
|
3334
|
+
if (name && name.replace) {
|
|
3335
|
+
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
3336
|
+
}
|
|
3337
|
+
return name;
|
|
3338
|
+
}
|
|
3339
|
+
function _getEvtNamespace(eventName, evtNamespace) {
|
|
3340
|
+
if (evtNamespace) {
|
|
3341
|
+
var theNamespace_1 = "";
|
|
3342
|
+
if (isArray(evtNamespace)) {
|
|
3343
|
+
theNamespace_1 = "";
|
|
3344
|
+
arrForEach(evtNamespace, function (name) {
|
|
3345
|
+
name = _normalizeNamespace(name);
|
|
3346
|
+
if (name) {
|
|
3347
|
+
if (name[0] !== ".") {
|
|
3348
|
+
name = "." + name;
|
|
3349
|
+
}
|
|
3350
|
+
theNamespace_1 += name;
|
|
3351
|
+
}
|
|
3352
|
+
});
|
|
3353
|
+
}
|
|
3354
|
+
else {
|
|
3355
|
+
theNamespace_1 = _normalizeNamespace(evtNamespace);
|
|
3356
|
+
}
|
|
3357
|
+
if (theNamespace_1) {
|
|
3358
|
+
if (theNamespace_1[0] !== ".") {
|
|
3359
|
+
theNamespace_1 = "." + theNamespace_1;
|
|
3360
|
+
}
|
|
3361
|
+
eventName = (eventName || "") + theNamespace_1;
|
|
3362
|
+
}
|
|
2374
3363
|
}
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
3364
|
+
var parsedEvent = (eventNamespace.exec(eventName || "") || []);
|
|
3365
|
+
return {
|
|
3366
|
+
type: parsedEvent[1],
|
|
3367
|
+
ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
|
|
3368
|
+
};
|
|
2378
3369
|
}
|
|
2379
|
-
function
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
3370
|
+
function __getRegisteredEvents(target, eventName, evtNamespace) {
|
|
3371
|
+
var theEvents = [];
|
|
3372
|
+
var eventCache = elmNodeData.get(target, strEvents, {}, false);
|
|
3373
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
3374
|
+
objForEachKey(eventCache, function (evtType, registeredEvents) {
|
|
3375
|
+
arrForEach(registeredEvents, function (value) {
|
|
3376
|
+
if (!evtName.type || evtName.type === value.evtName.type) {
|
|
3377
|
+
if (!evtName.ns || evtName.ns === evtName.ns) {
|
|
3378
|
+
theEvents.push({
|
|
3379
|
+
name: value.evtName.type + (value.evtName.ns ? "." + value.evtName.ns : ""),
|
|
3380
|
+
handler: value.handler
|
|
3381
|
+
});
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
});
|
|
3385
|
+
});
|
|
3386
|
+
return theEvents;
|
|
3387
|
+
}
|
|
3388
|
+
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
3389
|
+
if (addDefault === void 0) { addDefault = true; }
|
|
3390
|
+
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
3391
|
+
var registeredEvents = aiEvts[evtName];
|
|
3392
|
+
if (!registeredEvents) {
|
|
3393
|
+
registeredEvents = aiEvts[evtName] = [];
|
|
2385
3394
|
}
|
|
3395
|
+
return registeredEvents;
|
|
2386
3396
|
}
|
|
2387
|
-
function
|
|
2388
|
-
if (
|
|
2389
|
-
|
|
3397
|
+
function _doDetach(obj, evtName, handlerRef, useCapture) {
|
|
3398
|
+
if (obj && evtName && evtName.type) {
|
|
3399
|
+
if (obj[strRemoveEventListener]) {
|
|
3400
|
+
obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);
|
|
3401
|
+
}
|
|
3402
|
+
else if (obj[strDetachEvent]) {
|
|
3403
|
+
obj[strDetachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
3404
|
+
}
|
|
2390
3405
|
}
|
|
2391
|
-
return 0;
|
|
2392
3406
|
}
|
|
2393
|
-
function
|
|
2394
|
-
var
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
3407
|
+
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
3408
|
+
var result = false;
|
|
3409
|
+
if (obj && evtName && evtName.type && handlerRef) {
|
|
3410
|
+
if (obj[strAddEventHelper]) {
|
|
3411
|
+
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
3412
|
+
result = true;
|
|
3413
|
+
}
|
|
3414
|
+
else if (obj[strAttachEvent]) {
|
|
3415
|
+
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
3416
|
+
result = true;
|
|
3417
|
+
}
|
|
2398
3418
|
}
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
3419
|
+
return result;
|
|
3420
|
+
}
|
|
3421
|
+
function _doUnregister(target, events, evtName, unRegFn) {
|
|
3422
|
+
var idx = events.length;
|
|
3423
|
+
while (idx--) {
|
|
3424
|
+
var theEvent = events[idx];
|
|
3425
|
+
if (theEvent) {
|
|
3426
|
+
if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {
|
|
3427
|
+
if (!unRegFn || unRegFn(theEvent)) {
|
|
3428
|
+
_doDetach(target, theEvent.evtName, theEvent.handler, theEvent.capture);
|
|
3429
|
+
events.splice(idx, 1);
|
|
3430
|
+
}
|
|
3431
|
+
}
|
|
2402
3432
|
}
|
|
2403
|
-
value = mwcRandom32() & MaxUInt32;
|
|
2404
3433
|
}
|
|
2405
|
-
|
|
2406
|
-
|
|
3434
|
+
}
|
|
3435
|
+
function _unregisterEvents(target, evtName, unRegFn) {
|
|
3436
|
+
if (evtName.type) {
|
|
3437
|
+
_doUnregister(target, _getRegisteredEvents(target, evtName.type), evtName, unRegFn);
|
|
2407
3438
|
}
|
|
2408
|
-
|
|
2409
|
-
|
|
3439
|
+
else {
|
|
3440
|
+
var eventCache = elmNodeData.get(target, strEvents, {});
|
|
3441
|
+
objForEachKey(eventCache, function (evtType, events) {
|
|
3442
|
+
_doUnregister(target, events, evtName, unRegFn);
|
|
3443
|
+
});
|
|
3444
|
+
if (objKeys(eventCache).length === 0) {
|
|
3445
|
+
elmNodeData.kill(target, strEvents);
|
|
3446
|
+
}
|
|
2410
3447
|
}
|
|
2411
|
-
return value;
|
|
2412
3448
|
}
|
|
2413
|
-
function
|
|
2414
|
-
|
|
2415
|
-
|
|
3449
|
+
function mergeEvtNamespace(theNamespace, namespaces) {
|
|
3450
|
+
var newNamespaces;
|
|
3451
|
+
if (namespaces) {
|
|
3452
|
+
if (isArray(namespaces)) {
|
|
3453
|
+
newNamespaces = [theNamespace].concat(namespaces);
|
|
3454
|
+
}
|
|
3455
|
+
else {
|
|
3456
|
+
newNamespaces = [theNamespace, namespaces];
|
|
3457
|
+
}
|
|
3458
|
+
newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
|
|
2416
3459
|
}
|
|
2417
3460
|
else {
|
|
2418
|
-
|
|
3461
|
+
newNamespaces = theNamespace;
|
|
2419
3462
|
}
|
|
3463
|
+
return newNamespaces;
|
|
2420
3464
|
}
|
|
2421
|
-
function
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
3465
|
+
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
3466
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3467
|
+
var result = false;
|
|
3468
|
+
if (target) {
|
|
3469
|
+
try {
|
|
3470
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
3471
|
+
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
3472
|
+
if (result && elmNodeData.accept(target)) {
|
|
3473
|
+
var registeredEvent = {
|
|
3474
|
+
guid: _guid++,
|
|
3475
|
+
evtName: evtName,
|
|
3476
|
+
handler: handlerRef,
|
|
3477
|
+
capture: useCapture
|
|
3478
|
+
};
|
|
3479
|
+
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
catch (e) {
|
|
3483
|
+
}
|
|
2427
3484
|
}
|
|
2428
|
-
return
|
|
3485
|
+
return result;
|
|
2429
3486
|
}
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
3487
|
+
function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
3488
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3489
|
+
if (target) {
|
|
3490
|
+
try {
|
|
3491
|
+
var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
|
|
3492
|
+
var found_1 = false;
|
|
3493
|
+
_unregisterEvents(target, evtName_1, function (regEvent) {
|
|
3494
|
+
if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {
|
|
3495
|
+
found_1 = true;
|
|
3496
|
+
return true;
|
|
3497
|
+
}
|
|
3498
|
+
return false;
|
|
3499
|
+
});
|
|
3500
|
+
if (!found_1) {
|
|
3501
|
+
_doDetach(target, evtName_1, handlerRef, useCapture);
|
|
3502
|
+
}
|
|
3503
|
+
}
|
|
3504
|
+
catch (e) {
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3507
|
+
}
|
|
3508
|
+
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
3509
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3510
|
+
return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
|
|
3511
|
+
}
|
|
3512
|
+
function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
3513
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3514
|
+
eventOff(obj, eventNameWithoutOn, handlerRef, null, useCapture);
|
|
3515
|
+
}
|
|
3516
|
+
function addEventHandler(eventName, callback, evtNamespace) {
|
|
2438
3517
|
var result = false;
|
|
2439
3518
|
var w = getWindow();
|
|
2440
3519
|
if (w) {
|
|
2441
|
-
result =
|
|
2442
|
-
result =
|
|
3520
|
+
result = eventOn(w, eventName, callback, evtNamespace);
|
|
3521
|
+
result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
|
|
2443
3522
|
}
|
|
2444
3523
|
var doc = getDocument();
|
|
2445
3524
|
if (doc) {
|
|
2446
|
-
result =
|
|
3525
|
+
result = eventOn(doc, eventName, callback, evtNamespace) || result;
|
|
2447
3526
|
}
|
|
2448
3527
|
return result;
|
|
2449
3528
|
}
|
|
2450
|
-
function
|
|
3529
|
+
function removeEventHandler(eventName, callback, evtNamespace) {
|
|
3530
|
+
var w = getWindow();
|
|
3531
|
+
if (w) {
|
|
3532
|
+
eventOff(w, eventName, callback, evtNamespace);
|
|
3533
|
+
eventOff(w["body"], eventName, callback, evtNamespace);
|
|
3534
|
+
}
|
|
3535
|
+
var doc = getDocument();
|
|
3536
|
+
if (doc) {
|
|
3537
|
+
eventOff(doc, eventName, callback, evtNamespace);
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
function _addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
2451
3541
|
var added = false;
|
|
2452
|
-
if (listener && events &&
|
|
2453
|
-
var excluded_1 = [];
|
|
3542
|
+
if (listener && events && events.length > 0) {
|
|
2454
3543
|
arrForEach(events, function (name) {
|
|
2455
|
-
if (
|
|
3544
|
+
if (name) {
|
|
2456
3545
|
if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {
|
|
2457
|
-
added = addEventHandler(name, listener) || added;
|
|
2458
|
-
}
|
|
2459
|
-
else {
|
|
2460
|
-
excluded_1.push(name);
|
|
3546
|
+
added = addEventHandler(name, listener, evtNamespace) || added;
|
|
2461
3547
|
}
|
|
2462
3548
|
}
|
|
2463
3549
|
});
|
|
2464
|
-
|
|
2465
|
-
|
|
3550
|
+
}
|
|
3551
|
+
return added;
|
|
3552
|
+
}
|
|
3553
|
+
function addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
3554
|
+
var added = false;
|
|
3555
|
+
if (listener && events && isArray(events)) {
|
|
3556
|
+
added = _addEventListeners(events, listener, excludeEvents, evtNamespace);
|
|
3557
|
+
if (!added && excludeEvents && excludeEvents.length > 0) {
|
|
3558
|
+
added = _addEventListeners(events, listener, null, evtNamespace);
|
|
2466
3559
|
}
|
|
2467
3560
|
}
|
|
2468
3561
|
return added;
|
|
2469
3562
|
}
|
|
2470
|
-
function
|
|
2471
|
-
|
|
3563
|
+
function removeEventListeners(events, listener, evtNamespace) {
|
|
3564
|
+
if (events && isArray(events)) {
|
|
3565
|
+
arrForEach(events, function (name) {
|
|
3566
|
+
if (name) {
|
|
3567
|
+
removeEventHandler(name, listener, evtNamespace);
|
|
3568
|
+
}
|
|
3569
|
+
});
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {
|
|
3573
|
+
return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);
|
|
3574
|
+
}
|
|
3575
|
+
function removePageUnloadEventListener(listener, evtNamespace) {
|
|
3576
|
+
removeEventListeners([strBeforeUnload, strUnload, strPageHide], listener, evtNamespace);
|
|
2472
3577
|
}
|
|
2473
|
-
function addPageHideEventListener(listener, excludeEvents) {
|
|
3578
|
+
function addPageHideEventListener(listener, excludeEvents, evtNamespace) {
|
|
2474
3579
|
function _handlePageVisibility(evt) {
|
|
2475
3580
|
var doc = getDocument();
|
|
2476
3581
|
if (listener && doc && doc.visibilityState === "hidden") {
|
|
2477
3582
|
listener(evt);
|
|
2478
3583
|
}
|
|
2479
3584
|
}
|
|
2480
|
-
var
|
|
2481
|
-
|
|
2482
|
-
pageUnloadAdded = addEventHandler(strPageHide, listener);
|
|
2483
|
-
}
|
|
3585
|
+
var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
|
|
3586
|
+
var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);
|
|
2484
3587
|
if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
|
|
2485
|
-
pageUnloadAdded =
|
|
3588
|
+
pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;
|
|
2486
3589
|
}
|
|
2487
3590
|
if (!pageUnloadAdded && excludeEvents) {
|
|
2488
|
-
pageUnloadAdded = addPageHideEventListener(listener);
|
|
3591
|
+
pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);
|
|
2489
3592
|
}
|
|
2490
3593
|
return pageUnloadAdded;
|
|
2491
3594
|
}
|
|
2492
|
-
function
|
|
3595
|
+
function removePageHideEventListener(listener, evtNamespace) {
|
|
3596
|
+
var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
|
|
3597
|
+
removeEventListeners([strPageHide], listener, newNamespaces);
|
|
3598
|
+
removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
|
|
3599
|
+
}
|
|
3600
|
+
function addPageShowEventListener(listener, excludeEvents, evtNamespace) {
|
|
2493
3601
|
function _handlePageVisibility(evt) {
|
|
2494
3602
|
var doc = getDocument();
|
|
2495
3603
|
if (listener && doc && doc.visibilityState === "visible") {
|
|
2496
3604
|
listener(evt);
|
|
2497
3605
|
}
|
|
2498
3606
|
}
|
|
2499
|
-
var
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
}
|
|
2503
|
-
if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
|
|
2504
|
-
pageShowAdded = addEventHandler(strVisibilityChangeEvt, _handlePageVisibility) || pageShowAdded;
|
|
2505
|
-
}
|
|
3607
|
+
var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
|
|
3608
|
+
var pageShowAdded = _addEventListeners([strPageShow], listener, excludeEvents, newNamespaces);
|
|
3609
|
+
pageShowAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageShowAdded;
|
|
2506
3610
|
if (!pageShowAdded && excludeEvents) {
|
|
2507
|
-
pageShowAdded = addPageShowEventListener(listener);
|
|
3611
|
+
pageShowAdded = addPageShowEventListener(listener, null, evtNamespace);
|
|
2508
3612
|
}
|
|
2509
3613
|
return pageShowAdded;
|
|
2510
3614
|
}
|
|
3615
|
+
function removePageShowEventListener(listener, evtNamespace) {
|
|
3616
|
+
var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
|
|
3617
|
+
removeEventListeners([strPageShow], listener, newNamespaces);
|
|
3618
|
+
removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
|
|
3619
|
+
}
|
|
3620
|
+
|
|
3621
|
+
var _cookieMgrs = null;
|
|
3622
|
+
var _canUseCookies;
|
|
3623
|
+
var Undefined = strShimUndefined;
|
|
2511
3624
|
function newGuid() {
|
|
2512
3625
|
function randomHexDigit() {
|
|
2513
3626
|
return randomValue(15);
|
|
@@ -2524,26 +3637,9 @@
|
|
|
2524
3637
|
}
|
|
2525
3638
|
return dateNow();
|
|
2526
3639
|
}
|
|
2527
|
-
function newId(maxLength) {
|
|
2528
|
-
if (maxLength === void 0) { maxLength = 22; }
|
|
2529
|
-
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
2530
|
-
var number = random32() >>> 0;
|
|
2531
|
-
var chars = 0;
|
|
2532
|
-
var result = "";
|
|
2533
|
-
while (result.length < maxLength) {
|
|
2534
|
-
chars++;
|
|
2535
|
-
result += base64chars.charAt(number & 0x3F);
|
|
2536
|
-
number >>>= 6;
|
|
2537
|
-
if (chars === 5) {
|
|
2538
|
-
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
2539
|
-
chars = 0;
|
|
2540
|
-
}
|
|
2541
|
-
}
|
|
2542
|
-
return result;
|
|
2543
|
-
}
|
|
2544
3640
|
function generateW3CId() {
|
|
2545
3641
|
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
2546
|
-
var oct =
|
|
3642
|
+
var oct = strEmpty, tmp;
|
|
2547
3643
|
for (var a = 0; a < 4; a++) {
|
|
2548
3644
|
tmp = random32();
|
|
2549
3645
|
oct +=
|
|
@@ -2644,6 +3740,95 @@
|
|
|
2644
3740
|
return _legacyCookieMgr(null, logger).del(name);
|
|
2645
3741
|
}
|
|
2646
3742
|
|
|
3743
|
+
var LoggingSeverity = createEnumStyle({
|
|
3744
|
+
CRITICAL: 1 ,
|
|
3745
|
+
WARNING: 2
|
|
3746
|
+
});
|
|
3747
|
+
var _InternalMessageId = createEnumStyle({
|
|
3748
|
+
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
3749
|
+
BrowserCannotReadLocalStorage: 1 ,
|
|
3750
|
+
BrowserCannotReadSessionStorage: 2 ,
|
|
3751
|
+
BrowserCannotWriteLocalStorage: 3 ,
|
|
3752
|
+
BrowserCannotWriteSessionStorage: 4 ,
|
|
3753
|
+
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
3754
|
+
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
3755
|
+
CannotSendEmptyTelemetry: 7 ,
|
|
3756
|
+
ClientPerformanceMathError: 8 ,
|
|
3757
|
+
ErrorParsingAISessionCookie: 9 ,
|
|
3758
|
+
ErrorPVCalc: 10 ,
|
|
3759
|
+
ExceptionWhileLoggingError: 11 ,
|
|
3760
|
+
FailedAddingTelemetryToBuffer: 12 ,
|
|
3761
|
+
FailedMonitorAjaxAbort: 13 ,
|
|
3762
|
+
FailedMonitorAjaxDur: 14 ,
|
|
3763
|
+
FailedMonitorAjaxOpen: 15 ,
|
|
3764
|
+
FailedMonitorAjaxRSC: 16 ,
|
|
3765
|
+
FailedMonitorAjaxSend: 17 ,
|
|
3766
|
+
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
3767
|
+
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
3768
|
+
FailedToSendQueuedTelemetry: 20 ,
|
|
3769
|
+
FailedToReportDataLoss: 21 ,
|
|
3770
|
+
FlushFailed: 22 ,
|
|
3771
|
+
MessageLimitPerPVExceeded: 23 ,
|
|
3772
|
+
MissingRequiredFieldSpecification: 24 ,
|
|
3773
|
+
NavigationTimingNotSupported: 25 ,
|
|
3774
|
+
OnError: 26 ,
|
|
3775
|
+
SessionRenewalDateIsZero: 27 ,
|
|
3776
|
+
SenderNotInitialized: 28 ,
|
|
3777
|
+
StartTrackEventFailed: 29 ,
|
|
3778
|
+
StopTrackEventFailed: 30 ,
|
|
3779
|
+
StartTrackFailed: 31 ,
|
|
3780
|
+
StopTrackFailed: 32 ,
|
|
3781
|
+
TelemetrySampledAndNotSent: 33 ,
|
|
3782
|
+
TrackEventFailed: 34 ,
|
|
3783
|
+
TrackExceptionFailed: 35 ,
|
|
3784
|
+
TrackMetricFailed: 36 ,
|
|
3785
|
+
TrackPVFailed: 37 ,
|
|
3786
|
+
TrackPVFailedCalc: 38 ,
|
|
3787
|
+
TrackTraceFailed: 39 ,
|
|
3788
|
+
TransmissionFailed: 40 ,
|
|
3789
|
+
FailedToSetStorageBuffer: 41 ,
|
|
3790
|
+
FailedToRestoreStorageBuffer: 42 ,
|
|
3791
|
+
InvalidBackendResponse: 43 ,
|
|
3792
|
+
FailedToFixDepricatedValues: 44 ,
|
|
3793
|
+
InvalidDurationValue: 45 ,
|
|
3794
|
+
TelemetryEnvelopeInvalid: 46 ,
|
|
3795
|
+
CreateEnvelopeError: 47 ,
|
|
3796
|
+
CannotSerializeObject: 48 ,
|
|
3797
|
+
CannotSerializeObjectNonSerializable: 49 ,
|
|
3798
|
+
CircularReferenceDetected: 50 ,
|
|
3799
|
+
ClearAuthContextFailed: 51 ,
|
|
3800
|
+
ExceptionTruncated: 52 ,
|
|
3801
|
+
IllegalCharsInName: 53 ,
|
|
3802
|
+
ItemNotInArray: 54 ,
|
|
3803
|
+
MaxAjaxPerPVExceeded: 55 ,
|
|
3804
|
+
MessageTruncated: 56 ,
|
|
3805
|
+
NameTooLong: 57 ,
|
|
3806
|
+
SampleRateOutOfRange: 58 ,
|
|
3807
|
+
SetAuthContextFailed: 59 ,
|
|
3808
|
+
SetAuthContextFailedAccountName: 60 ,
|
|
3809
|
+
StringValueTooLong: 61 ,
|
|
3810
|
+
StartCalledMoreThanOnce: 62 ,
|
|
3811
|
+
StopCalledWithoutStart: 63 ,
|
|
3812
|
+
TelemetryInitializerFailed: 64 ,
|
|
3813
|
+
TrackArgumentsNotSpecified: 65 ,
|
|
3814
|
+
UrlTooLong: 66 ,
|
|
3815
|
+
SessionStorageBufferFull: 67 ,
|
|
3816
|
+
CannotAccessCookie: 68 ,
|
|
3817
|
+
IdTooLong: 69 ,
|
|
3818
|
+
InvalidEvent: 70 ,
|
|
3819
|
+
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
3820
|
+
SendBrowserInfoOnUserInit: 72 ,
|
|
3821
|
+
PluginException: 73 ,
|
|
3822
|
+
NotificationException: 74 ,
|
|
3823
|
+
SnippetScriptLoadFailure: 99 ,
|
|
3824
|
+
InvalidInstrumentationKey: 100 ,
|
|
3825
|
+
CannotParseAiBlobValue: 101 ,
|
|
3826
|
+
InvalidContentBlob: 102 ,
|
|
3827
|
+
TrackPageActionEventFailed: 103 ,
|
|
3828
|
+
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
3829
|
+
InMemoryStorageBufferFull: 105
|
|
3830
|
+
});
|
|
3831
|
+
|
|
2647
3832
|
var aiInstrumentHooks = "_aiHooks";
|
|
2648
3833
|
var cbNames = [
|
|
2649
3834
|
"req", "rsp", "hkErr", "fnErr"
|
|
@@ -2702,6 +3887,7 @@
|
|
|
2702
3887
|
};
|
|
2703
3888
|
var hookCtx = [];
|
|
2704
3889
|
var cbArgs = _createArgs([funcArgs], orgArgs);
|
|
3890
|
+
funcArgs.evt = getGlobalInst("event");
|
|
2705
3891
|
function _createArgs(target, theArgs) {
|
|
2706
3892
|
_arrLoop(theArgs, function (arg) {
|
|
2707
3893
|
target.push(arg);
|
|
@@ -2817,6 +4003,7 @@
|
|
|
2817
4003
|
exports.InstrumentFuncs = InstrumentFuncs;
|
|
2818
4004
|
exports.InstrumentProto = InstrumentProto;
|
|
2819
4005
|
exports.InstrumentProtos = InstrumentProtos;
|
|
4006
|
+
exports.LoggingSeverity = LoggingSeverity;
|
|
2820
4007
|
exports.MinChannelPriorty = MinChannelPriorty;
|
|
2821
4008
|
exports.NotificationManager = NotificationManager;
|
|
2822
4009
|
exports.PerfEvent = PerfEvent;
|
|
@@ -2825,7 +4012,9 @@
|
|
|
2825
4012
|
exports.Undefined = Undefined;
|
|
2826
4013
|
exports._InternalLogMessage = _InternalLogMessage;
|
|
2827
4014
|
exports._InternalMessageId = _InternalMessageId;
|
|
4015
|
+
exports.__getRegisteredEvents = __getRegisteredEvents;
|
|
2828
4016
|
exports._legacyCookieMgr = _legacyCookieMgr;
|
|
4017
|
+
exports._throwInternal = _throwInternal;
|
|
2829
4018
|
exports.addEventHandler = addEventHandler;
|
|
2830
4019
|
exports.addEventListeners = addEventListeners;
|
|
2831
4020
|
exports.addPageHideEventListener = addPageHideEventListener;
|
|
@@ -2840,12 +4029,18 @@
|
|
|
2840
4029
|
exports.canUseCookies = canUseCookies;
|
|
2841
4030
|
exports.createClassFromInterface = createClassFromInterface;
|
|
2842
4031
|
exports.createCookieMgr = createCookieMgr;
|
|
4032
|
+
exports.createEnumStyle = createEnumStyle;
|
|
4033
|
+
exports.createProcessTelemetryContext = createProcessTelemetryContext;
|
|
4034
|
+
exports.createUniqueNamespace = createUniqueNamespace;
|
|
4035
|
+
exports.createUnloadHandlerContainer = createUnloadHandlerContainer;
|
|
2843
4036
|
exports.dateNow = dateNow;
|
|
2844
4037
|
exports.deleteCookie = deleteCookie;
|
|
2845
4038
|
exports.detachEvent = detachEvent;
|
|
2846
4039
|
exports.disableCookies = disableCookies;
|
|
2847
4040
|
exports.doPerf = doPerf;
|
|
2848
4041
|
exports.dumpObj = dumpObj;
|
|
4042
|
+
exports.eventOff = eventOff;
|
|
4043
|
+
exports.eventOn = eventOn;
|
|
2849
4044
|
exports.generateW3CId = generateW3CId;
|
|
2850
4045
|
exports.getConsole = getConsole;
|
|
2851
4046
|
exports.getCookie = getCookie;
|
|
@@ -2895,6 +4090,7 @@
|
|
|
2895
4090
|
exports.isTypeof = isTypeof;
|
|
2896
4091
|
exports.isUndefined = isUndefined;
|
|
2897
4092
|
exports.isXhrSupported = isXhrSupported;
|
|
4093
|
+
exports.mergeEvtNamespace = mergeEvtNamespace;
|
|
2898
4094
|
exports.mwcRandom32 = mwcRandom32;
|
|
2899
4095
|
exports.mwcRandomSeed = mwcRandomSeed;
|
|
2900
4096
|
exports.newGuid = newGuid;
|
|
@@ -2902,15 +4098,24 @@
|
|
|
2902
4098
|
exports.normalizeJsName = normalizeJsName;
|
|
2903
4099
|
exports.objCreate = objCreateFn;
|
|
2904
4100
|
exports.objDefineAccessors = objDefineAccessors;
|
|
4101
|
+
exports.objExtend = objExtend;
|
|
2905
4102
|
exports.objForEachKey = objForEachKey;
|
|
2906
4103
|
exports.objFreeze = objFreeze;
|
|
2907
4104
|
exports.objKeys = objKeys;
|
|
2908
4105
|
exports.objSeal = objSeal;
|
|
4106
|
+
exports.objToString = objToString;
|
|
2909
4107
|
exports.optimizeObject = optimizeObject;
|
|
2910
4108
|
exports.perfNow = perfNow;
|
|
2911
4109
|
exports.proxyAssign = proxyAssign;
|
|
4110
|
+
exports.proxyFunctionAs = proxyFunctionAs;
|
|
4111
|
+
exports.proxyFunctions = proxyFunctions;
|
|
2912
4112
|
exports.random32 = random32;
|
|
2913
4113
|
exports.randomValue = randomValue;
|
|
4114
|
+
exports.removeEventHandler = removeEventHandler;
|
|
4115
|
+
exports.removeEventListeners = removeEventListeners;
|
|
4116
|
+
exports.removePageHideEventListener = removePageHideEventListener;
|
|
4117
|
+
exports.removePageShowEventListener = removePageShowEventListener;
|
|
4118
|
+
exports.removePageUnloadEventListener = removePageUnloadEventListener;
|
|
2914
4119
|
exports.safeGetCookieMgr = safeGetCookieMgr;
|
|
2915
4120
|
exports.safeGetLogger = safeGetLogger;
|
|
2916
4121
|
exports.setCookie = setCookie;
|
|
@@ -2931,6 +4136,7 @@
|
|
|
2931
4136
|
exports.throwError = throwError;
|
|
2932
4137
|
exports.toISOString = toISOString;
|
|
2933
4138
|
exports.uaDisallowsSameSiteNone = uaDisallowsSameSiteNone;
|
|
4139
|
+
exports.unloadComponents = unloadComponents;
|
|
2934
4140
|
exports.useXDomainRequest = useXDomainRequest;
|
|
2935
4141
|
|
|
2936
4142
|
(function(obj, prop, descriptor) { /* ai_es3_polyfil defineProperty */ var func = Object["defineProperty"]; if (func) { try { return func(obj, prop, descriptor); } catch(e) { /* IE8 defines defineProperty, but will throw */ } } if (descriptor && typeof descriptor.value !== undefined) { obj[prop] = descriptor.value; } return obj; })(exports, '__esModule', { value: true });
|