@microsoft/applicationinsights-web 2.8.0-beta.2202-06 → 2.8.0-beta.2203-02
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/browser/{ai.2.8.0-beta.2202-06.cjs.js → ai.2.8.0-beta.2203-02.cjs.js} +876 -515
- package/browser/ai.2.8.0-beta.2203-02.cjs.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-02.cjs.min.js +6 -0
- package/browser/ai.2.8.0-beta.2203-02.cjs.min.js.map +1 -0
- package/browser/{ai.2.8.0-beta.2202-06.gbl.js → ai.2.8.0-beta.2203-02.gbl.js} +876 -515
- package/browser/ai.2.8.0-beta.2203-02.gbl.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-02.gbl.min.js +6 -0
- package/browser/ai.2.8.0-beta.2203-02.gbl.min.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-02.integrity.json +66 -0
- package/browser/{ai.2.8.0-beta.2202-06.js → ai.2.8.0-beta.2203-02.js} +876 -515
- package/browser/ai.2.8.0-beta.2203-02.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-02.min.js +6 -0
- package/browser/ai.2.8.0-beta.2203-02.min.js.map +1 -0
- package/browser/ai.2.cjs.js +875 -514
- package/browser/ai.2.cjs.js.map +1 -1
- package/browser/ai.2.cjs.min.js +2 -2
- package/browser/ai.2.cjs.min.js.map +1 -1
- package/browser/ai.2.gbl.js +875 -514
- package/browser/ai.2.gbl.js.map +1 -1
- package/browser/ai.2.gbl.min.js +2 -2
- package/browser/ai.2.gbl.min.js.map +1 -1
- package/browser/ai.2.js +875 -514
- package/browser/ai.2.js.map +1 -1
- package/browser/ai.2.min.js +2 -2
- package/browser/ai.2.min.js.map +1 -1
- package/dist/applicationinsights-web.api.json +328 -568
- package/dist/applicationinsights-web.api.md +44 -32
- package/dist/applicationinsights-web.d.ts +298 -93
- package/dist/applicationinsights-web.js +941 -578
- package/dist/applicationinsights-web.js.map +1 -1
- package/dist/applicationinsights-web.min.js +2 -2
- package/dist/applicationinsights-web.min.js.map +1 -1
- package/dist/applicationinsights-web.rollup.d.ts +298 -93
- package/dist-esm/ApplicationInsightsContainer.js +1 -1
- package/dist-esm/ApplicationInsightsDeprecated.js +1 -1
- package/dist-esm/Init.js +1 -1
- package/dist-esm/Initialization.js +1 -1
- package/dist-esm/applicationinsights-web.js +1 -1
- package/package.json +7 -7
- package/types/Initialization.d.ts +6 -2
- package/browser/ai.2.8.0-beta.2202-06.cjs.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-06.cjs.min.js +0 -6
- package/browser/ai.2.8.0-beta.2202-06.cjs.min.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-06.gbl.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-06.gbl.min.js +0 -6
- package/browser/ai.2.8.0-beta.2202-06.gbl.min.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-06.integrity.json +0 -66
- package/browser/ai.2.8.0-beta.2202-06.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-06.min.js +0 -6
- package/browser/ai.2.8.0-beta.2202-06.min.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Web, 2.8.0-beta.
|
|
2
|
+
* Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-02
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
'use strict';
|
|
@@ -348,99 +348,26 @@ var perfDefaults = {
|
|
|
348
348
|
};
|
|
349
349
|
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
350
350
|
|
|
351
|
-
var
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
var
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
FailedMonitorAjaxAbort: 13,
|
|
371
|
-
FailedMonitorAjaxDur: 14,
|
|
372
|
-
FailedMonitorAjaxOpen: 15,
|
|
373
|
-
FailedMonitorAjaxRSC: 16,
|
|
374
|
-
FailedMonitorAjaxSend: 17,
|
|
375
|
-
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
376
|
-
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
377
|
-
FailedToSendQueuedTelemetry: 20,
|
|
378
|
-
FailedToReportDataLoss: 21,
|
|
379
|
-
FlushFailed: 22,
|
|
380
|
-
MessageLimitPerPVExceeded: 23,
|
|
381
|
-
MissingRequiredFieldSpecification: 24,
|
|
382
|
-
NavigationTimingNotSupported: 25,
|
|
383
|
-
OnError: 26,
|
|
384
|
-
SessionRenewalDateIsZero: 27,
|
|
385
|
-
SenderNotInitialized: 28,
|
|
386
|
-
StartTrackEventFailed: 29,
|
|
387
|
-
StopTrackEventFailed: 30,
|
|
388
|
-
StartTrackFailed: 31,
|
|
389
|
-
StopTrackFailed: 32,
|
|
390
|
-
TelemetrySampledAndNotSent: 33,
|
|
391
|
-
TrackEventFailed: 34,
|
|
392
|
-
TrackExceptionFailed: 35,
|
|
393
|
-
TrackMetricFailed: 36,
|
|
394
|
-
TrackPVFailed: 37,
|
|
395
|
-
TrackPVFailedCalc: 38,
|
|
396
|
-
TrackTraceFailed: 39,
|
|
397
|
-
TransmissionFailed: 40,
|
|
398
|
-
FailedToSetStorageBuffer: 41,
|
|
399
|
-
FailedToRestoreStorageBuffer: 42,
|
|
400
|
-
InvalidBackendResponse: 43,
|
|
401
|
-
FailedToFixDepricatedValues: 44,
|
|
402
|
-
InvalidDurationValue: 45,
|
|
403
|
-
TelemetryEnvelopeInvalid: 46,
|
|
404
|
-
CreateEnvelopeError: 47,
|
|
405
|
-
CannotSerializeObject: 48,
|
|
406
|
-
CannotSerializeObjectNonSerializable: 49,
|
|
407
|
-
CircularReferenceDetected: 50,
|
|
408
|
-
ClearAuthContextFailed: 51,
|
|
409
|
-
ExceptionTruncated: 52,
|
|
410
|
-
IllegalCharsInName: 53,
|
|
411
|
-
ItemNotInArray: 54,
|
|
412
|
-
MaxAjaxPerPVExceeded: 55,
|
|
413
|
-
MessageTruncated: 56,
|
|
414
|
-
NameTooLong: 57,
|
|
415
|
-
SampleRateOutOfRange: 58,
|
|
416
|
-
SetAuthContextFailed: 59,
|
|
417
|
-
SetAuthContextFailedAccountName: 60,
|
|
418
|
-
StringValueTooLong: 61,
|
|
419
|
-
StartCalledMoreThanOnce: 62,
|
|
420
|
-
StopCalledWithoutStart: 63,
|
|
421
|
-
TelemetryInitializerFailed: 64,
|
|
422
|
-
TrackArgumentsNotSpecified: 65,
|
|
423
|
-
UrlTooLong: 66,
|
|
424
|
-
SessionStorageBufferFull: 67,
|
|
425
|
-
CannotAccessCookie: 68,
|
|
426
|
-
IdTooLong: 69,
|
|
427
|
-
InvalidEvent: 70,
|
|
428
|
-
FailedMonitorAjaxSetRequestHeader: 71,
|
|
429
|
-
SendBrowserInfoOnUserInit: 72,
|
|
430
|
-
PluginException: 73,
|
|
431
|
-
NotificationException: 74,
|
|
432
|
-
SnippetScriptLoadFailure: 99,
|
|
433
|
-
InvalidInstrumentationKey: 100,
|
|
434
|
-
CannotParseAiBlobValue: 101,
|
|
435
|
-
InvalidContentBlob: 102,
|
|
436
|
-
TrackPageActionEventFailed: 103,
|
|
437
|
-
FailedAddingCustomDefinedRequestContext: 104,
|
|
438
|
-
InMemoryStorageBufferFull: 105
|
|
439
|
-
};
|
|
351
|
+
var strEmpty$1 = "";
|
|
352
|
+
var strProcessTelemetry = "processTelemetry";
|
|
353
|
+
var strPriority = "priority";
|
|
354
|
+
var strSetNextPlugin = "setNextPlugin";
|
|
355
|
+
var strIsInitialized = "isInitialized";
|
|
356
|
+
var strTeardown = "teardown";
|
|
357
|
+
var strCore = "core";
|
|
358
|
+
var strDisabled = "disabled";
|
|
359
|
+
var strDoTeardown = "_doTeardown";
|
|
360
|
+
var strProcessNext = "processNext";
|
|
361
|
+
var strResume = "resume";
|
|
362
|
+
var strPause = "pause";
|
|
363
|
+
var strNotificationListener = "NotificationListener";
|
|
364
|
+
var strAddNotificationListener = "add" + strNotificationListener;
|
|
365
|
+
var strRemoveNotificationListener = "remove" + strNotificationListener;
|
|
366
|
+
var strEventsSent = "eventsSent";
|
|
367
|
+
var strEventsDiscarded = "eventsDiscarded";
|
|
368
|
+
var strEventsSendRequest = "eventsSendRequest";
|
|
369
|
+
var strPerfEvent = "perfEvent";
|
|
440
370
|
|
|
441
|
-
var strOnPrefix = "on";
|
|
442
|
-
var strAttachEvent = "attachEvent";
|
|
443
|
-
var strAddEventHelper = "addEventListener";
|
|
444
371
|
var strToISOString = "toISOString";
|
|
445
372
|
var cStrEndsWith = "endsWith";
|
|
446
373
|
var strIndexOf = "indexOf";
|
|
@@ -450,7 +377,7 @@ var cStrTrim = "trim";
|
|
|
450
377
|
var strToString = "toString";
|
|
451
378
|
var str__Proto = "__proto__";
|
|
452
379
|
var strConstructor = "constructor";
|
|
453
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
380
|
+
var _objDefineProperty$1 = ObjDefineProperty;
|
|
454
381
|
var _objFreeze = ObjClass.freeze;
|
|
455
382
|
var _objKeys = ObjClass.keys;
|
|
456
383
|
var StringProto = String[strShimPrototype];
|
|
@@ -499,25 +426,6 @@ function isObject(value) {
|
|
|
499
426
|
function isFunction(value) {
|
|
500
427
|
return !!(value && typeof value === strShimFunction);
|
|
501
428
|
}
|
|
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
429
|
function normalizeJsName(name) {
|
|
522
430
|
var value = name;
|
|
523
431
|
if (value && isString(value)) {
|
|
@@ -749,7 +657,7 @@ function objKeys(obj) {
|
|
|
749
657
|
return result;
|
|
750
658
|
}
|
|
751
659
|
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
752
|
-
if (_objDefineProperty) {
|
|
660
|
+
if (_objDefineProperty$1) {
|
|
753
661
|
try {
|
|
754
662
|
var descriptor = {
|
|
755
663
|
enumerable: true,
|
|
@@ -761,7 +669,7 @@ function objDefineAccessors(target, prop, getProp, setProp) {
|
|
|
761
669
|
if (setProp) {
|
|
762
670
|
descriptor.set = setProp;
|
|
763
671
|
}
|
|
764
|
-
_objDefineProperty(target, prop, descriptor);
|
|
672
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
765
673
|
return true;
|
|
766
674
|
}
|
|
767
675
|
catch (e) {
|
|
@@ -781,7 +689,7 @@ function getExceptionName(object) {
|
|
|
781
689
|
if (isError(object)) {
|
|
782
690
|
return object.name;
|
|
783
691
|
}
|
|
784
|
-
return
|
|
692
|
+
return strEmpty$1;
|
|
785
693
|
}
|
|
786
694
|
function setValue(target, field, value, valChk, srcChk) {
|
|
787
695
|
var theValue = value;
|
|
@@ -898,6 +806,17 @@ function createClassFromInterface(defaults) {
|
|
|
898
806
|
return class_1;
|
|
899
807
|
}());
|
|
900
808
|
}
|
|
809
|
+
function createEnumStyle(values) {
|
|
810
|
+
var enumClass = {};
|
|
811
|
+
objForEachKey(values, function (field, value) {
|
|
812
|
+
enumClass[field] = value;
|
|
813
|
+
if (!isUndefined(enumClass[value])) {
|
|
814
|
+
throwError("Value: [" + value + "] already exists for " + field);
|
|
815
|
+
}
|
|
816
|
+
enumClass[value] = field;
|
|
817
|
+
});
|
|
818
|
+
return objFreeze(enumClass);
|
|
819
|
+
}
|
|
901
820
|
function optimizeObject(theObject) {
|
|
902
821
|
if (theObject && ObjAssign) {
|
|
903
822
|
theObject = ObjClass(ObjAssign({}, theObject));
|
|
@@ -1087,7 +1006,7 @@ function isIE() {
|
|
|
1087
1006
|
var nav = getNavigator();
|
|
1088
1007
|
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
1089
1008
|
_navUserAgentCheck = nav.userAgent;
|
|
1090
|
-
var userAgent = (_navUserAgentCheck ||
|
|
1009
|
+
var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
|
|
1091
1010
|
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
1092
1011
|
}
|
|
1093
1012
|
return _isTrident;
|
|
@@ -1096,9 +1015,9 @@ function getIEVersion(userAgentStr) {
|
|
|
1096
1015
|
if (userAgentStr === void 0) { userAgentStr = null; }
|
|
1097
1016
|
if (!userAgentStr) {
|
|
1098
1017
|
var navigator_1 = getNavigator() || {};
|
|
1099
|
-
userAgentStr = navigator_1 ? (navigator_1.userAgent ||
|
|
1018
|
+
userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty$1).toLowerCase() : strEmpty$1;
|
|
1100
1019
|
}
|
|
1101
|
-
var ua = (userAgentStr ||
|
|
1020
|
+
var ua = (userAgentStr || strEmpty$1).toLowerCase();
|
|
1102
1021
|
if (strContains(ua, strMsie)) {
|
|
1103
1022
|
var doc = getDocument() || {};
|
|
1104
1023
|
return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
|
|
@@ -1113,7 +1032,7 @@ function getIEVersion(userAgentStr) {
|
|
|
1113
1032
|
}
|
|
1114
1033
|
function dumpObj(object) {
|
|
1115
1034
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
1116
|
-
var propertyValueDump =
|
|
1035
|
+
var propertyValueDump = strEmpty$1;
|
|
1117
1036
|
if (objectTypeDump === "[object Error]") {
|
|
1118
1037
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
1119
1038
|
}
|
|
@@ -1207,9 +1126,9 @@ var strErrorToConsole = "errorToConsole";
|
|
|
1207
1126
|
var strWarnToConsole = "warnToConsole";
|
|
1208
1127
|
function _sanitizeDiagnosticText(text) {
|
|
1209
1128
|
if (text) {
|
|
1210
|
-
return "\"" + text.replace(/\"/g,
|
|
1129
|
+
return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
|
|
1211
1130
|
}
|
|
1212
|
-
return
|
|
1131
|
+
return strEmpty$1;
|
|
1213
1132
|
}
|
|
1214
1133
|
function _logToConsole(func, message) {
|
|
1215
1134
|
var theConsole = getConsole();
|
|
@@ -1231,12 +1150,12 @@ var _InternalLogMessage = /** @class */ (function () {
|
|
|
1231
1150
|
_self.message =
|
|
1232
1151
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
1233
1152
|
msgId;
|
|
1234
|
-
var strProps =
|
|
1153
|
+
var strProps = strEmpty$1;
|
|
1235
1154
|
if (hasJSON()) {
|
|
1236
1155
|
strProps = getJSON().stringify(properties);
|
|
1237
1156
|
}
|
|
1238
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
1239
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
1157
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
|
|
1158
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
|
|
1240
1159
|
_self.message += diagnosticText;
|
|
1241
1160
|
}
|
|
1242
1161
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -1266,7 +1185,7 @@ var DiagnosticLogger = /** @class */ (function () {
|
|
|
1266
1185
|
throw message;
|
|
1267
1186
|
}
|
|
1268
1187
|
else {
|
|
1269
|
-
var logFunc = severity ===
|
|
1188
|
+
var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
|
|
1270
1189
|
if (!isUndefined(message.message)) {
|
|
1271
1190
|
var logLevel = _self.consoleLoggingLevel();
|
|
1272
1191
|
if (isUserAct) {
|
|
@@ -1284,7 +1203,7 @@ var DiagnosticLogger = /** @class */ (function () {
|
|
|
1284
1203
|
_self.logInternalMessage(severity, message);
|
|
1285
1204
|
}
|
|
1286
1205
|
else {
|
|
1287
|
-
_debugExtMsg("throw" + (severity ===
|
|
1206
|
+
_debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
|
|
1288
1207
|
}
|
|
1289
1208
|
}
|
|
1290
1209
|
};
|
|
@@ -1316,13 +1235,13 @@ var DiagnosticLogger = /** @class */ (function () {
|
|
|
1316
1235
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
1317
1236
|
_self.queue.push(message);
|
|
1318
1237
|
_messageCount++;
|
|
1319
|
-
_debugExtMsg((severity ===
|
|
1238
|
+
_debugExtMsg((severity === 1 ? "error" : "warn"), message);
|
|
1320
1239
|
}
|
|
1321
1240
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
1322
1241
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
1323
|
-
var throttleMessage = new _InternalLogMessage(
|
|
1242
|
+
var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
|
|
1324
1243
|
_self.queue.push(throttleMessage);
|
|
1325
|
-
if (severity ===
|
|
1244
|
+
if (severity === 1 ) {
|
|
1326
1245
|
_self.errorToConsole(throttleLimitMessage);
|
|
1327
1246
|
}
|
|
1328
1247
|
else {
|
|
@@ -1496,6 +1415,217 @@ function getGblPerfMgr() {
|
|
|
1496
1415
|
return _defaultPerfManager;
|
|
1497
1416
|
}
|
|
1498
1417
|
|
|
1418
|
+
var UInt32Mask = 0x100000000;
|
|
1419
|
+
var MaxUInt32 = 0xffffffff;
|
|
1420
|
+
var _mwcSeeded = false;
|
|
1421
|
+
var _mwcW = 123456789;
|
|
1422
|
+
var _mwcZ = 987654321;
|
|
1423
|
+
function _mwcSeed(seedValue) {
|
|
1424
|
+
if (seedValue < 0) {
|
|
1425
|
+
seedValue >>>= 0;
|
|
1426
|
+
}
|
|
1427
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
1428
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
1429
|
+
_mwcSeeded = true;
|
|
1430
|
+
}
|
|
1431
|
+
function _autoSeedMwc() {
|
|
1432
|
+
try {
|
|
1433
|
+
var now = dateNow() & 0x7fffffff;
|
|
1434
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
1435
|
+
}
|
|
1436
|
+
catch (e) {
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
function randomValue(maxValue) {
|
|
1440
|
+
if (maxValue > 0) {
|
|
1441
|
+
return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
|
|
1442
|
+
}
|
|
1443
|
+
return 0;
|
|
1444
|
+
}
|
|
1445
|
+
function random32(signed) {
|
|
1446
|
+
var value = 0;
|
|
1447
|
+
var c = getCrypto() || getMsCrypto();
|
|
1448
|
+
if (c && c.getRandomValues) {
|
|
1449
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1450
|
+
}
|
|
1451
|
+
if (value === 0 && isIE()) {
|
|
1452
|
+
if (!_mwcSeeded) {
|
|
1453
|
+
_autoSeedMwc();
|
|
1454
|
+
}
|
|
1455
|
+
value = mwcRandom32() & MaxUInt32;
|
|
1456
|
+
}
|
|
1457
|
+
if (value === 0) {
|
|
1458
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1459
|
+
}
|
|
1460
|
+
if (!signed) {
|
|
1461
|
+
value >>>= 0;
|
|
1462
|
+
}
|
|
1463
|
+
return value;
|
|
1464
|
+
}
|
|
1465
|
+
function mwcRandomSeed(value) {
|
|
1466
|
+
if (!value) {
|
|
1467
|
+
_autoSeedMwc();
|
|
1468
|
+
}
|
|
1469
|
+
else {
|
|
1470
|
+
_mwcSeed(value);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
function mwcRandom32(signed) {
|
|
1474
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1475
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1476
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1477
|
+
if (!signed) {
|
|
1478
|
+
value >>>= 0;
|
|
1479
|
+
}
|
|
1480
|
+
return value;
|
|
1481
|
+
}
|
|
1482
|
+
function newId(maxLength) {
|
|
1483
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1484
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1485
|
+
var number = random32() >>> 0;
|
|
1486
|
+
var chars = 0;
|
|
1487
|
+
var result = strEmpty$1;
|
|
1488
|
+
while (result.length < maxLength) {
|
|
1489
|
+
chars++;
|
|
1490
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1491
|
+
number >>>= 6;
|
|
1492
|
+
if (chars === 5) {
|
|
1493
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1494
|
+
chars = 0;
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
return result;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
1501
|
+
var version = "2.7.3";
|
|
1502
|
+
var instanceName = "." + newId(6);
|
|
1503
|
+
var _dataUid = 0;
|
|
1504
|
+
function _createAccessor(target, prop, value) {
|
|
1505
|
+
if (_objDefineProperty) {
|
|
1506
|
+
try {
|
|
1507
|
+
_objDefineProperty(target, prop, {
|
|
1508
|
+
value: value,
|
|
1509
|
+
enumerable: false,
|
|
1510
|
+
configurable: true
|
|
1511
|
+
});
|
|
1512
|
+
return true;
|
|
1513
|
+
}
|
|
1514
|
+
catch (e) {
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
return false;
|
|
1518
|
+
}
|
|
1519
|
+
function _canAcceptData(target) {
|
|
1520
|
+
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1521
|
+
}
|
|
1522
|
+
function _getCache(data, target) {
|
|
1523
|
+
var theCache = target[data.id];
|
|
1524
|
+
if (!theCache) {
|
|
1525
|
+
theCache = {};
|
|
1526
|
+
try {
|
|
1527
|
+
if (_canAcceptData(target)) {
|
|
1528
|
+
if (!_createAccessor(target, data.id, theCache)) {
|
|
1529
|
+
target[data.id] = theCache;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
catch (e) {
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
return theCache;
|
|
1537
|
+
}
|
|
1538
|
+
function createUniqueNamespace(name, includeVersion) {
|
|
1539
|
+
if (includeVersion === void 0) { includeVersion = false; }
|
|
1540
|
+
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1541
|
+
}
|
|
1542
|
+
function createElmNodeData(name) {
|
|
1543
|
+
var data = {
|
|
1544
|
+
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1545
|
+
accept: function (target) {
|
|
1546
|
+
return _canAcceptData(target);
|
|
1547
|
+
},
|
|
1548
|
+
get: function (target, name, defValue, addDefault) {
|
|
1549
|
+
var theCache = target[data.id];
|
|
1550
|
+
if (!theCache) {
|
|
1551
|
+
if (addDefault) {
|
|
1552
|
+
theCache = _getCache(data, target);
|
|
1553
|
+
theCache[normalizeJsName(name)] = defValue;
|
|
1554
|
+
}
|
|
1555
|
+
return defValue;
|
|
1556
|
+
}
|
|
1557
|
+
return theCache[normalizeJsName(name)];
|
|
1558
|
+
},
|
|
1559
|
+
kill: function (target, name) {
|
|
1560
|
+
if (target && target[name]) {
|
|
1561
|
+
try {
|
|
1562
|
+
delete target[name];
|
|
1563
|
+
}
|
|
1564
|
+
catch (e) {
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
};
|
|
1569
|
+
return data;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1573
|
+
function _getPluginState(plugin) {
|
|
1574
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1575
|
+
}
|
|
1576
|
+
function initializePlugins(processContext, extensions) {
|
|
1577
|
+
var initPlugins = [];
|
|
1578
|
+
var lastPlugin = null;
|
|
1579
|
+
var proxy = processContext.getNext();
|
|
1580
|
+
var pluginState;
|
|
1581
|
+
while (proxy) {
|
|
1582
|
+
var thePlugin = proxy.getPlugin();
|
|
1583
|
+
if (thePlugin) {
|
|
1584
|
+
if (lastPlugin &&
|
|
1585
|
+
isFunction(lastPlugin[strSetNextPlugin]) &&
|
|
1586
|
+
isFunction(thePlugin[strProcessTelemetry])) {
|
|
1587
|
+
lastPlugin[strSetNextPlugin](thePlugin);
|
|
1588
|
+
}
|
|
1589
|
+
var isInitialized = false;
|
|
1590
|
+
if (isFunction(thePlugin[strIsInitialized])) {
|
|
1591
|
+
isInitialized = thePlugin[strIsInitialized]();
|
|
1592
|
+
}
|
|
1593
|
+
else {
|
|
1594
|
+
pluginState = _getPluginState(thePlugin);
|
|
1595
|
+
isInitialized = pluginState[strIsInitialized];
|
|
1596
|
+
}
|
|
1597
|
+
if (!isInitialized) {
|
|
1598
|
+
initPlugins.push(thePlugin);
|
|
1599
|
+
}
|
|
1600
|
+
lastPlugin = thePlugin;
|
|
1601
|
+
proxy = proxy.getNext();
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
arrForEach(initPlugins, function (thePlugin) {
|
|
1605
|
+
var core = processContext.core();
|
|
1606
|
+
thePlugin.initialize(processContext.getCfg(), core, extensions, processContext.getNext());
|
|
1607
|
+
pluginState = _getPluginState(thePlugin);
|
|
1608
|
+
if (!thePlugin[strCore] && !pluginState[strCore]) {
|
|
1609
|
+
pluginState[strCore] = core;
|
|
1610
|
+
}
|
|
1611
|
+
pluginState[strIsInitialized] = true;
|
|
1612
|
+
delete pluginState[strTeardown];
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1615
|
+
function sortPlugins(plugins) {
|
|
1616
|
+
return plugins.sort(function (extA, extB) {
|
|
1617
|
+
var result = 0;
|
|
1618
|
+
var bHasProcess = isFunction(extB[strProcessTelemetry]);
|
|
1619
|
+
if (isFunction(extA[strProcessTelemetry])) {
|
|
1620
|
+
result = bHasProcess ? extA[strPriority] - extB[strPriority] : 1;
|
|
1621
|
+
}
|
|
1622
|
+
else if (bHasProcess) {
|
|
1623
|
+
result = -1;
|
|
1624
|
+
}
|
|
1625
|
+
return result;
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1499
1629
|
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1500
1630
|
var strHasRunFlags = "_hasRun";
|
|
1501
1631
|
var strGetTelCtx = "_getTelCtx";
|
|
@@ -1509,53 +1639,66 @@ function _getNextProxyStart(proxy, config, core, startAt) {
|
|
|
1509
1639
|
}
|
|
1510
1640
|
return createTelemetryProxyChain([startAt], config, core);
|
|
1511
1641
|
}
|
|
1512
|
-
function
|
|
1513
|
-
var _nextProxy =
|
|
1514
|
-
var _onComplete =
|
|
1515
|
-
if (startAt) {
|
|
1516
|
-
_nextProxy = _getNextProxyStart(telemetryChain, config, core, startAt);
|
|
1517
|
-
}
|
|
1518
|
-
else {
|
|
1519
|
-
_nextProxy = telemetryChain;
|
|
1520
|
-
}
|
|
1642
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1643
|
+
var _nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1644
|
+
var _onComplete = [];
|
|
1521
1645
|
var context = {
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1646
|
+
_next: _moveNext,
|
|
1647
|
+
ctx: {
|
|
1648
|
+
core: function () { return core; },
|
|
1649
|
+
diagLog: function () {
|
|
1650
|
+
return safeGetLogger(core, config);
|
|
1651
|
+
},
|
|
1652
|
+
getCfg: function () {
|
|
1653
|
+
return config;
|
|
1654
|
+
},
|
|
1655
|
+
getExtCfg: _getExtCfg,
|
|
1656
|
+
getConfig: _getConfig,
|
|
1657
|
+
hasNext: function () {
|
|
1658
|
+
return !!_nextProxy;
|
|
1659
|
+
},
|
|
1660
|
+
getNext: function () {
|
|
1661
|
+
return _nextProxy;
|
|
1662
|
+
},
|
|
1663
|
+
setNext: function (nextPlugin) {
|
|
1664
|
+
_nextProxy = nextPlugin;
|
|
1665
|
+
},
|
|
1666
|
+
iterate: _iterateChain,
|
|
1667
|
+
onComplete: _addOnComplete
|
|
1668
|
+
}
|
|
1669
|
+
};
|
|
1670
|
+
function _addOnComplete(onComplete, that) {
|
|
1671
|
+
var args = [];
|
|
1672
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1673
|
+
args[_i - 2] = arguments[_i];
|
|
1674
|
+
}
|
|
1675
|
+
if (onComplete) {
|
|
1676
|
+
_onComplete.push({
|
|
1677
|
+
func: onComplete,
|
|
1678
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1679
|
+
args: args
|
|
1545
1680
|
});
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
function _moveNext() {
|
|
1684
|
+
var nextProxy = _nextProxy;
|
|
1685
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1686
|
+
if (!nextProxy) {
|
|
1687
|
+
var onComplete = _onComplete;
|
|
1688
|
+
if (onComplete && onComplete.length > 0) {
|
|
1689
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
1690
|
+
try {
|
|
1691
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1692
|
+
}
|
|
1693
|
+
catch (e) {
|
|
1694
|
+
core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1695
|
+
}
|
|
1696
|
+
});
|
|
1697
|
+
_onComplete = [];
|
|
1552
1698
|
}
|
|
1553
|
-
return createProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1554
|
-
},
|
|
1555
|
-
onComplete: function (onComplete) {
|
|
1556
|
-
_onComplete = onComplete;
|
|
1557
1699
|
}
|
|
1558
|
-
|
|
1700
|
+
return nextProxy;
|
|
1701
|
+
}
|
|
1559
1702
|
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1560
1703
|
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1561
1704
|
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
@@ -1598,29 +1741,53 @@ function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
|
1598
1741
|
}
|
|
1599
1742
|
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1600
1743
|
}
|
|
1601
|
-
function
|
|
1602
|
-
var nextPlugin
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
else {
|
|
1608
|
-
if (_onComplete) {
|
|
1609
|
-
_onComplete();
|
|
1610
|
-
_onComplete = null;
|
|
1744
|
+
function _iterateChain(cb) {
|
|
1745
|
+
var nextPlugin;
|
|
1746
|
+
while (!!(nextPlugin = context._next())) {
|
|
1747
|
+
var plugin = nextPlugin.getPlugin();
|
|
1748
|
+
if (plugin) {
|
|
1749
|
+
cb(plugin);
|
|
1611
1750
|
}
|
|
1612
1751
|
}
|
|
1613
1752
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1753
|
+
return context;
|
|
1754
|
+
}
|
|
1755
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1756
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1757
|
+
var context = internalContext.ctx;
|
|
1758
|
+
function _processNext(env) {
|
|
1759
|
+
var nextPlugin = internalContext._next();
|
|
1760
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1761
|
+
return !nextPlugin;
|
|
1762
|
+
}
|
|
1763
|
+
function _createNew(plugins, startAt) {
|
|
1764
|
+
if (plugins === void 0) { plugins = null; }
|
|
1765
|
+
if (isArray(plugins)) {
|
|
1766
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1767
|
+
}
|
|
1768
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1769
|
+
}
|
|
1770
|
+
context.processNext = _processNext;
|
|
1771
|
+
context.createNew = _createNew;
|
|
1772
|
+
return context;
|
|
1773
|
+
}
|
|
1774
|
+
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1775
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1776
|
+
var context = internalContext.ctx;
|
|
1777
|
+
function _processNext(unloadState) {
|
|
1778
|
+
var nextPlugin = internalContext._next();
|
|
1779
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1780
|
+
return !nextPlugin;
|
|
1781
|
+
}
|
|
1782
|
+
function _createNew(plugins, startAt) {
|
|
1783
|
+
if (plugins === void 0) { plugins = null; }
|
|
1784
|
+
if (isArray(plugins)) {
|
|
1785
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1622
1786
|
}
|
|
1787
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1623
1788
|
}
|
|
1789
|
+
context.processNext = _processNext;
|
|
1790
|
+
context.createNew = _createNew;
|
|
1624
1791
|
return context;
|
|
1625
1792
|
}
|
|
1626
1793
|
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
@@ -1668,32 +1835,35 @@ function createTelemetryPluginProxy(plugin, config, core) {
|
|
|
1668
1835
|
return nextProxy;
|
|
1669
1836
|
},
|
|
1670
1837
|
processTelemetry: _processTelemetry,
|
|
1838
|
+
unload: _unloadPlugin,
|
|
1671
1839
|
_id: chainId,
|
|
1672
1840
|
_setNext: function (nextPlugin) {
|
|
1673
1841
|
nextProxy = nextPlugin;
|
|
1674
1842
|
}
|
|
1675
1843
|
};
|
|
1676
|
-
function
|
|
1844
|
+
function _getTelCtx() {
|
|
1845
|
+
var itemCtx;
|
|
1846
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1847
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1848
|
+
}
|
|
1677
1849
|
if (!itemCtx) {
|
|
1678
|
-
|
|
1679
|
-
itemCtx = plugin[strGetTelCtx]();
|
|
1680
|
-
}
|
|
1681
|
-
if (!itemCtx) {
|
|
1682
|
-
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1683
|
-
}
|
|
1850
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1684
1851
|
}
|
|
1852
|
+
return itemCtx;
|
|
1853
|
+
}
|
|
1854
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1855
|
+
var hasRun = false;
|
|
1685
1856
|
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1686
1857
|
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1687
1858
|
if (!hasRunContext) {
|
|
1688
1859
|
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1689
1860
|
}
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
if (plugin) {
|
|
1861
|
+
itemCtx.setNext(nextProxy);
|
|
1862
|
+
if (plugin) {
|
|
1863
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1864
|
+
hasRunContext[chainId] = true;
|
|
1695
1865
|
try {
|
|
1696
|
-
var nextId = nextProxy ? nextProxy._id :
|
|
1866
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty$1;
|
|
1697
1867
|
if (nextId) {
|
|
1698
1868
|
hasRunContext[nextId] = false;
|
|
1699
1869
|
}
|
|
@@ -1705,18 +1875,21 @@ function createTelemetryPluginProxy(plugin, config, core) {
|
|
|
1705
1875
|
hasRun = true;
|
|
1706
1876
|
}
|
|
1707
1877
|
if (!nextProxy || !hasNextRun) {
|
|
1708
|
-
itemCtx.diagLog().throwInternal(
|
|
1878
|
+
itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1709
1879
|
}
|
|
1710
1880
|
}
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
}
|
|
1715
|
-
}, details, isAsync);
|
|
1881
|
+
}, details, isAsync);
|
|
1882
|
+
}
|
|
1883
|
+
return hasRun;
|
|
1716
1884
|
}
|
|
1717
1885
|
function _processTelemetry(env, itemCtx) {
|
|
1718
|
-
|
|
1719
|
-
|
|
1886
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
1887
|
+
function _callProcessTelemetry(itemCtx) {
|
|
1888
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
1889
|
+
return false;
|
|
1890
|
+
}
|
|
1891
|
+
var pluginState = _getPluginState(plugin);
|
|
1892
|
+
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
1720
1893
|
return false;
|
|
1721
1894
|
}
|
|
1722
1895
|
if (hasSetNext) {
|
|
@@ -1724,52 +1897,33 @@ function createTelemetryPluginProxy(plugin, config, core) {
|
|
|
1724
1897
|
}
|
|
1725
1898
|
plugin.processTelemetry(env, itemCtx);
|
|
1726
1899
|
return true;
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
}
|
|
1731
|
-
return objFreeze(proxyChain);
|
|
1732
|
-
}
|
|
1733
|
-
|
|
1734
|
-
var processTelemetry = "processTelemetry";
|
|
1735
|
-
var priority = "priority";
|
|
1736
|
-
var setNextPlugin = "setNextPlugin";
|
|
1737
|
-
var isInitialized = "isInitialized";
|
|
1738
|
-
function initializePlugins(processContext, extensions) {
|
|
1739
|
-
var initPlugins = [];
|
|
1740
|
-
var lastPlugin = null;
|
|
1741
|
-
var proxy = processContext.getNext();
|
|
1742
|
-
while (proxy) {
|
|
1743
|
-
var thePlugin = proxy.getPlugin();
|
|
1744
|
-
if (thePlugin) {
|
|
1745
|
-
if (lastPlugin &&
|
|
1746
|
-
isFunction(lastPlugin[setNextPlugin]) &&
|
|
1747
|
-
isFunction(thePlugin[processTelemetry])) {
|
|
1748
|
-
lastPlugin[setNextPlugin](thePlugin);
|
|
1749
|
-
}
|
|
1750
|
-
if (!isFunction(thePlugin[isInitialized]) || !thePlugin[isInitialized]()) {
|
|
1751
|
-
initPlugins.push(thePlugin);
|
|
1752
|
-
}
|
|
1753
|
-
lastPlugin = thePlugin;
|
|
1754
|
-
proxy = proxy.getNext();
|
|
1900
|
+
}
|
|
1901
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1902
|
+
itemCtx.processNext(env);
|
|
1755
1903
|
}
|
|
1756
1904
|
}
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1905
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1906
|
+
function _callTeardown() {
|
|
1907
|
+
var hasRun = false;
|
|
1908
|
+
if (plugin) {
|
|
1909
|
+
var pluginState = _getPluginState(plugin);
|
|
1910
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1911
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1912
|
+
pluginState[strCore] = null;
|
|
1913
|
+
pluginState[strTeardown] = true;
|
|
1914
|
+
pluginState[strIsInitialized] = false;
|
|
1915
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1916
|
+
hasRun = true;
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
return hasRun;
|
|
1767
1921
|
}
|
|
1768
|
-
|
|
1769
|
-
|
|
1922
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1923
|
+
unloadCtx.processNext(unloadState);
|
|
1770
1924
|
}
|
|
1771
|
-
|
|
1772
|
-
|
|
1925
|
+
}
|
|
1926
|
+
return objFreeze(proxyChain);
|
|
1773
1927
|
}
|
|
1774
1928
|
|
|
1775
1929
|
var strToGMTString = "toGMTString";
|
|
@@ -1780,7 +1934,6 @@ var strEnabled = "enabled";
|
|
|
1780
1934
|
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
1781
1935
|
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
1782
1936
|
var strConfigCookieMgr = "_ckMgr";
|
|
1783
|
-
var strEmpty = "";
|
|
1784
1937
|
var _supportsCookies = null;
|
|
1785
1938
|
var _allowUaSameSite = null;
|
|
1786
1939
|
var _parsedCookieValue = null;
|
|
@@ -1857,7 +2010,7 @@ function createCookieMgr(rootConfig, logger) {
|
|
|
1857
2010
|
var result = false;
|
|
1858
2011
|
if (_isMgrEnabled(cookieMgr)) {
|
|
1859
2012
|
var values = {};
|
|
1860
|
-
var theValue = strTrim(value || strEmpty);
|
|
2013
|
+
var theValue = strTrim(value || strEmpty$1);
|
|
1861
2014
|
var idx = theValue.indexOf(";");
|
|
1862
2015
|
if (idx !== -1) {
|
|
1863
2016
|
theValue = strTrim(value.substring(0, idx));
|
|
@@ -1872,11 +2025,11 @@ function createCookieMgr(rootConfig, logger) {
|
|
|
1872
2025
|
if (expireMs > 0) {
|
|
1873
2026
|
var expiry = new Date();
|
|
1874
2027
|
expiry.setTime(expireMs);
|
|
1875
|
-
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
|
|
2028
|
+
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty$1, isTruthy);
|
|
1876
2029
|
}
|
|
1877
2030
|
}
|
|
1878
2031
|
if (!_isIE) {
|
|
1879
|
-
setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
|
|
2032
|
+
setValue(values, "max-age", strEmpty$1 + maxAgeSec, null, isUndefined);
|
|
1880
2033
|
}
|
|
1881
2034
|
}
|
|
1882
2035
|
var location_1 = getLocation();
|
|
@@ -1897,7 +2050,7 @@ function createCookieMgr(rootConfig, logger) {
|
|
|
1897
2050
|
return result;
|
|
1898
2051
|
},
|
|
1899
2052
|
get: function (name) {
|
|
1900
|
-
var value = strEmpty;
|
|
2053
|
+
var value = strEmpty$1;
|
|
1901
2054
|
if (_isMgrEnabled(cookieMgr)) {
|
|
1902
2055
|
value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
|
|
1903
2056
|
}
|
|
@@ -1922,7 +2075,7 @@ function createCookieMgr(rootConfig, logger) {
|
|
|
1922
2075
|
values["max-age"] = "0";
|
|
1923
2076
|
}
|
|
1924
2077
|
var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
|
|
1925
|
-
delCookie(name, _formatCookieValue(strEmpty, values));
|
|
2078
|
+
delCookie(name, _formatCookieValue(strEmpty$1, values));
|
|
1926
2079
|
result = true;
|
|
1927
2080
|
}
|
|
1928
2081
|
return result;
|
|
@@ -1939,7 +2092,7 @@ function areCookiesSupported(logger) {
|
|
|
1939
2092
|
_supportsCookies = doc[strCookie] !== undefined;
|
|
1940
2093
|
}
|
|
1941
2094
|
catch (e) {
|
|
1942
|
-
logger && logger.throwInternal(
|
|
2095
|
+
logger && logger.throwInternal(2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1943
2096
|
}
|
|
1944
2097
|
}
|
|
1945
2098
|
return _supportsCookies;
|
|
@@ -1949,7 +2102,7 @@ function _extractParts(theValue) {
|
|
|
1949
2102
|
if (theValue && theValue.length) {
|
|
1950
2103
|
var parts = strTrim(theValue).split(";");
|
|
1951
2104
|
arrForEach(parts, function (thePart) {
|
|
1952
|
-
thePart = strTrim(thePart || strEmpty);
|
|
2105
|
+
thePart = strTrim(thePart || strEmpty$1);
|
|
1953
2106
|
if (thePart) {
|
|
1954
2107
|
var idx = thePart.indexOf("=");
|
|
1955
2108
|
if (idx === -1) {
|
|
@@ -1970,21 +2123,21 @@ function _formatDate(theDate, func) {
|
|
|
1970
2123
|
return null;
|
|
1971
2124
|
}
|
|
1972
2125
|
function _formatCookieValue(value, values) {
|
|
1973
|
-
var cookieValue = value || strEmpty;
|
|
2126
|
+
var cookieValue = value || strEmpty$1;
|
|
1974
2127
|
objForEachKey(values, function (name, theValue) {
|
|
1975
|
-
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
|
|
2128
|
+
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty$1);
|
|
1976
2129
|
});
|
|
1977
2130
|
return cookieValue;
|
|
1978
2131
|
}
|
|
1979
2132
|
function _getCookieValue(name) {
|
|
1980
|
-
var cookieValue = strEmpty;
|
|
2133
|
+
var cookieValue = strEmpty$1;
|
|
1981
2134
|
if (_doc) {
|
|
1982
|
-
var theCookie = _doc[strCookie] || strEmpty;
|
|
2135
|
+
var theCookie = _doc[strCookie] || strEmpty$1;
|
|
1983
2136
|
if (_parsedCookieValue !== theCookie) {
|
|
1984
2137
|
_cookieCache = _extractParts(theCookie);
|
|
1985
2138
|
_parsedCookieValue = theCookie;
|
|
1986
2139
|
}
|
|
1987
|
-
cookieValue = strTrim(_cookieCache[name] || strEmpty);
|
|
2140
|
+
cookieValue = strTrim(_cookieCache[name] || strEmpty$1);
|
|
1988
2141
|
}
|
|
1989
2142
|
return cookieValue;
|
|
1990
2143
|
}
|
|
@@ -2040,87 +2193,110 @@ function _addChannelQueue(channelQueue, queue, config, core) {
|
|
|
2040
2193
|
}
|
|
2041
2194
|
}
|
|
2042
2195
|
function createChannelControllerPlugin(channelQueue, core) {
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2196
|
+
var _a;
|
|
2197
|
+
function _getTelCtx() {
|
|
2198
|
+
return createProcessTelemetryContext(null, core.config, core, null);
|
|
2199
|
+
}
|
|
2200
|
+
function _processChannelQueue(theChannels, itemCtx, processFn, onComplete) {
|
|
2201
|
+
var waiting = theChannels ? (theChannels.length + 1) : 1;
|
|
2202
|
+
function _runChainOnComplete() {
|
|
2203
|
+
waiting--;
|
|
2204
|
+
if (waiting === 0) {
|
|
2205
|
+
onComplete && onComplete();
|
|
2206
|
+
onComplete = null;
|
|
2207
|
+
}
|
|
2046
2208
|
}
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
function _processChannelQueue(itemCtx, processFn, onComplete) {
|
|
2050
|
-
if (channelQueue && channelQueue.length > 0) {
|
|
2051
|
-
var waiting_1 = channelQueue.length;
|
|
2052
|
-
arrForEach(channelQueue, function (channels) {
|
|
2209
|
+
if (waiting > 0) {
|
|
2210
|
+
arrForEach(theChannels, function (channels) {
|
|
2053
2211
|
if (channels && channels.queue.length > 0) {
|
|
2054
2212
|
var channelChain = channels.chain;
|
|
2055
|
-
var chainCtx =
|
|
2056
|
-
chainCtx.onComplete(
|
|
2057
|
-
waiting_1--;
|
|
2058
|
-
if (waiting_1 === 0) {
|
|
2059
|
-
onComplete && onComplete();
|
|
2060
|
-
onComplete = null;
|
|
2061
|
-
}
|
|
2062
|
-
});
|
|
2213
|
+
var chainCtx = itemCtx.createNew(channelChain);
|
|
2214
|
+
chainCtx.onComplete(_runChainOnComplete);
|
|
2063
2215
|
processFn(chainCtx);
|
|
2064
2216
|
}
|
|
2065
2217
|
else {
|
|
2066
|
-
|
|
2218
|
+
waiting--;
|
|
2067
2219
|
}
|
|
2068
2220
|
});
|
|
2069
|
-
if (waiting_1 === 0) {
|
|
2070
|
-
onComplete && onComplete();
|
|
2071
|
-
}
|
|
2072
|
-
}
|
|
2073
|
-
else {
|
|
2074
|
-
onComplete && onComplete();
|
|
2075
2221
|
}
|
|
2222
|
+
_runChainOnComplete();
|
|
2076
2223
|
}
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2224
|
+
function _doTeardown(unloadCtx, unloadState) {
|
|
2225
|
+
var theUnloadState = unloadState || {
|
|
2226
|
+
reason: 0 ,
|
|
2227
|
+
isAsync: false
|
|
2228
|
+
};
|
|
2229
|
+
_processChannelQueue(channelQueue, unloadCtx, function (chainCtx) {
|
|
2230
|
+
chainCtx[strProcessNext](theUnloadState);
|
|
2231
|
+
}, function () {
|
|
2232
|
+
unloadCtx[strProcessNext](theUnloadState);
|
|
2233
|
+
isInitialized = false;
|
|
2234
|
+
});
|
|
2235
|
+
return true;
|
|
2236
|
+
}
|
|
2237
|
+
function _getChannel(pluginIdentifier) {
|
|
2238
|
+
var thePlugin = null;
|
|
2239
|
+
if (channelQueue && channelQueue.length > 0) {
|
|
2083
2240
|
arrForEach(channelQueue, function (channels) {
|
|
2084
2241
|
if (channels && channels.queue.length > 0) {
|
|
2085
|
-
|
|
2242
|
+
arrForEach(channels.queue, function (ext) {
|
|
2243
|
+
if (ext.identifier === pluginIdentifier) {
|
|
2244
|
+
thePlugin = ext;
|
|
2245
|
+
return -1;
|
|
2246
|
+
}
|
|
2247
|
+
});
|
|
2248
|
+
if (thePlugin) {
|
|
2249
|
+
return -1;
|
|
2250
|
+
}
|
|
2086
2251
|
}
|
|
2087
2252
|
});
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2253
|
+
}
|
|
2254
|
+
return thePlugin;
|
|
2255
|
+
}
|
|
2256
|
+
var isInitialized = false;
|
|
2257
|
+
var channelController = (_a = {
|
|
2258
|
+
identifier: "ChannelControllerPlugin",
|
|
2259
|
+
priority: ChannelControllerPriority,
|
|
2260
|
+
initialize: function (config, core, extensions, pluginChain) {
|
|
2261
|
+
isInitialized = true;
|
|
2262
|
+
arrForEach(channelQueue, function (channels) {
|
|
2263
|
+
if (channels && channels.queue.length > 0) {
|
|
2264
|
+
initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);
|
|
2265
|
+
}
|
|
2101
2266
|
});
|
|
2102
|
-
}
|
|
2267
|
+
},
|
|
2268
|
+
isInitialized: function () { return isInitialized; },
|
|
2269
|
+
processTelemetry: function (item, itemCtx) {
|
|
2270
|
+
_processChannelQueue(channelQueue, itemCtx || _getTelCtx(), function (chainCtx) {
|
|
2271
|
+
chainCtx[strProcessNext](item);
|
|
2272
|
+
}, function () {
|
|
2273
|
+
itemCtx[strProcessNext](item);
|
|
2274
|
+
});
|
|
2275
|
+
}
|
|
2103
2276
|
},
|
|
2104
|
-
|
|
2105
|
-
_processChannelQueue(
|
|
2277
|
+
_a[strPause] = function () {
|
|
2278
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2106
2279
|
chainCtx.iterate(function (plugin) {
|
|
2107
|
-
plugin
|
|
2280
|
+
plugin[strPause] && plugin[strPause]();
|
|
2108
2281
|
});
|
|
2109
|
-
});
|
|
2282
|
+
}, null);
|
|
2110
2283
|
},
|
|
2111
|
-
|
|
2112
|
-
_processChannelQueue(
|
|
2284
|
+
_a[strResume] = function () {
|
|
2285
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2113
2286
|
chainCtx.iterate(function (plugin) {
|
|
2114
|
-
plugin
|
|
2287
|
+
plugin[strResume] && plugin[strResume]();
|
|
2115
2288
|
});
|
|
2116
|
-
});
|
|
2289
|
+
}, null);
|
|
2117
2290
|
},
|
|
2118
|
-
|
|
2291
|
+
_a[strTeardown] = _doTeardown,
|
|
2292
|
+
_a.getChannel = _getChannel,
|
|
2293
|
+
_a.flush = function (isAsync, callBack, sendReason, cbTimeout) {
|
|
2294
|
+
var waiting = 1;
|
|
2119
2295
|
var doneIterating = false;
|
|
2120
|
-
var waiting = 0;
|
|
2121
2296
|
var cbTimer = null;
|
|
2122
2297
|
cbTimeout = cbTimeout || 5000;
|
|
2123
2298
|
function doCallback() {
|
|
2299
|
+
waiting--;
|
|
2124
2300
|
if (doneIterating && waiting === 0) {
|
|
2125
2301
|
if (cbTimer) {
|
|
2126
2302
|
clearTimeout(cbTimer);
|
|
@@ -2130,32 +2306,38 @@ function createChannelControllerPlugin(channelQueue, core) {
|
|
|
2130
2306
|
callBack = null;
|
|
2131
2307
|
}
|
|
2132
2308
|
}
|
|
2133
|
-
|
|
2134
|
-
_processChannelQueue(null, function (chainCtx) {
|
|
2309
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2135
2310
|
chainCtx.iterate(function (plugin) {
|
|
2136
2311
|
if (plugin.flush) {
|
|
2137
2312
|
waiting++;
|
|
2313
|
+
var handled_1 = false;
|
|
2138
2314
|
if (!plugin.flush(isAsync, function () {
|
|
2139
|
-
|
|
2315
|
+
handled_1 = true;
|
|
2140
2316
|
doCallback();
|
|
2141
2317
|
}, sendReason)) {
|
|
2142
|
-
if (
|
|
2143
|
-
cbTimer
|
|
2144
|
-
cbTimer =
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2318
|
+
if (!handled_1) {
|
|
2319
|
+
if (isAsync && cbTimer == null) {
|
|
2320
|
+
cbTimer = setTimeout(function () {
|
|
2321
|
+
cbTimer = null;
|
|
2322
|
+
doCallback();
|
|
2323
|
+
}, cbTimeout);
|
|
2324
|
+
}
|
|
2325
|
+
else {
|
|
2326
|
+
doCallback();
|
|
2327
|
+
}
|
|
2148
2328
|
}
|
|
2149
2329
|
}
|
|
2150
2330
|
}
|
|
2151
2331
|
});
|
|
2152
2332
|
}, function () {
|
|
2153
|
-
waiting--;
|
|
2154
2333
|
doneIterating = true;
|
|
2155
2334
|
doCallback();
|
|
2156
2335
|
});
|
|
2157
|
-
}
|
|
2158
|
-
|
|
2336
|
+
},
|
|
2337
|
+
_a._setQueue = function (queue) {
|
|
2338
|
+
channelQueue = queue;
|
|
2339
|
+
},
|
|
2340
|
+
_a);
|
|
2159
2341
|
return channelController;
|
|
2160
2342
|
}
|
|
2161
2343
|
function createChannelQueues(channels, extensions, config, core) {
|
|
@@ -2189,6 +2371,38 @@ var BaseTelemetryPlugin = /** @class */ (function () {
|
|
|
2189
2371
|
_setDefaults(config, core, pluginChain);
|
|
2190
2372
|
_isinitialized = true;
|
|
2191
2373
|
};
|
|
2374
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
2375
|
+
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
2376
|
+
return;
|
|
2377
|
+
}
|
|
2378
|
+
var result;
|
|
2379
|
+
var unloadDone = false;
|
|
2380
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
2381
|
+
var theUnloadState = unloadState || {
|
|
2382
|
+
reason: 0 ,
|
|
2383
|
+
isAsync: false
|
|
2384
|
+
};
|
|
2385
|
+
function _unloadCallback() {
|
|
2386
|
+
if (!unloadDone) {
|
|
2387
|
+
unloadDone = true;
|
|
2388
|
+
arrForEach(_hooks, function (fn) {
|
|
2389
|
+
fn.rm();
|
|
2390
|
+
});
|
|
2391
|
+
_hooks = [];
|
|
2392
|
+
if (result === true) {
|
|
2393
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
2394
|
+
}
|
|
2395
|
+
_initDefaults();
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
2399
|
+
_unloadCallback();
|
|
2400
|
+
}
|
|
2401
|
+
else {
|
|
2402
|
+
result = true;
|
|
2403
|
+
}
|
|
2404
|
+
return result;
|
|
2405
|
+
};
|
|
2192
2406
|
_self._addHook = function (hooks) {
|
|
2193
2407
|
if (hooks) {
|
|
2194
2408
|
if (isArray(hooks)) {
|
|
@@ -2203,13 +2417,13 @@ var BaseTelemetryPlugin = /** @class */ (function () {
|
|
|
2203
2417
|
_self.diagLog = function (itemCtx) {
|
|
2204
2418
|
return _getTelCtx(itemCtx).diagLog();
|
|
2205
2419
|
};
|
|
2206
|
-
_self
|
|
2420
|
+
_self[strIsInitialized] = function () {
|
|
2207
2421
|
return _isinitialized;
|
|
2208
2422
|
};
|
|
2209
2423
|
_self.setInitialized = function (isInitialized) {
|
|
2210
2424
|
_isinitialized = isInitialized;
|
|
2211
2425
|
};
|
|
2212
|
-
_self
|
|
2426
|
+
_self[strSetNextPlugin] = function (next) {
|
|
2213
2427
|
_nextPlugin = next;
|
|
2214
2428
|
};
|
|
2215
2429
|
_self.processNext = function (env, itemCtx) {
|
|
@@ -2301,7 +2515,7 @@ var TelemetryInitializerPlugin = /** @class */ (function (_super) {
|
|
|
2301
2515
|
}
|
|
2302
2516
|
}
|
|
2303
2517
|
catch (e) {
|
|
2304
|
-
itemCtx.diagLog().throwInternal(
|
|
2518
|
+
itemCtx.diagLog().throwInternal(1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
|
|
2305
2519
|
}
|
|
2306
2520
|
}
|
|
2307
2521
|
}
|
|
@@ -2309,8 +2523,7 @@ var TelemetryInitializerPlugin = /** @class */ (function (_super) {
|
|
|
2309
2523
|
_self.processNext(item, itemCtx);
|
|
2310
2524
|
}
|
|
2311
2525
|
};
|
|
2312
|
-
_self
|
|
2313
|
-
_base.unload(itemCtx, isAsync);
|
|
2526
|
+
_self[strDoTeardown] = function () {
|
|
2314
2527
|
_initDefaults();
|
|
2315
2528
|
};
|
|
2316
2529
|
});
|
|
@@ -2354,6 +2567,16 @@ function _validateExtensions(logger, channelPriority, allExtensions) {
|
|
|
2354
2567
|
core: coreExtensions
|
|
2355
2568
|
};
|
|
2356
2569
|
}
|
|
2570
|
+
function _createDummyNotificationManager() {
|
|
2571
|
+
var _a;
|
|
2572
|
+
return objCreateFn((_a = {},
|
|
2573
|
+
_a[strAddNotificationListener] = function (listener) { },
|
|
2574
|
+
_a[strRemoveNotificationListener] = function (listener) { },
|
|
2575
|
+
_a[strEventsSent] = function (events) { },
|
|
2576
|
+
_a[strEventsDiscarded] = function (events, reason) { },
|
|
2577
|
+
_a[strEventsSendRequest] = function (sendReason, isAsync) { },
|
|
2578
|
+
_a));
|
|
2579
|
+
}
|
|
2357
2580
|
var BaseCore = /** @class */ (function () {
|
|
2358
2581
|
function BaseCore() {
|
|
2359
2582
|
var _isInitialized;
|
|
@@ -2370,6 +2593,7 @@ var BaseCore = /** @class */ (function () {
|
|
|
2370
2593
|
var _channelQueue;
|
|
2371
2594
|
var _telemetryInitializerPlugin;
|
|
2372
2595
|
var _internalLogsEventName;
|
|
2596
|
+
var _evtNamespace;
|
|
2373
2597
|
var _debugListener;
|
|
2374
2598
|
var _internalLogPoller = 0;
|
|
2375
2599
|
dynamicProto(BaseCore, this, function (_self) {
|
|
@@ -2415,24 +2639,16 @@ var BaseCore = /** @class */ (function () {
|
|
|
2415
2639
|
setValue(telemetryItem, "time", toISOString(new Date()), null, isNotTruthy);
|
|
2416
2640
|
setValue(telemetryItem, "ver", "4.0", null, isNullOrUndefined);
|
|
2417
2641
|
if (_self.isInitialized()) {
|
|
2418
|
-
|
|
2642
|
+
_createTelCtx().processNext(telemetryItem);
|
|
2419
2643
|
}
|
|
2420
2644
|
else {
|
|
2421
2645
|
_eventQueue.push(telemetryItem);
|
|
2422
2646
|
}
|
|
2423
2647
|
};
|
|
2424
|
-
_self.getProcessTelContext =
|
|
2425
|
-
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
2426
|
-
};
|
|
2648
|
+
_self.getProcessTelContext = _createTelCtx;
|
|
2427
2649
|
_self.getNotifyMgr = function () {
|
|
2428
2650
|
if (!_notificationManager) {
|
|
2429
|
-
_notificationManager =
|
|
2430
|
-
addNotificationListener: function (listener) { },
|
|
2431
|
-
removeNotificationListener: function (listener) { },
|
|
2432
|
-
eventsSent: function (events) { },
|
|
2433
|
-
eventsDiscarded: function (events, reason) { },
|
|
2434
|
-
eventsSendRequest: function (sendReason, isAsync) { }
|
|
2435
|
-
});
|
|
2651
|
+
_notificationManager = _createDummyNotificationManager();
|
|
2436
2652
|
_self[strNotificationManager] = _notificationManager;
|
|
2437
2653
|
}
|
|
2438
2654
|
return _notificationManager;
|
|
@@ -2475,7 +2691,7 @@ var BaseCore = /** @class */ (function () {
|
|
|
2475
2691
|
var eventQueue = _eventQueue;
|
|
2476
2692
|
_eventQueue = [];
|
|
2477
2693
|
arrForEach(eventQueue, function (event) {
|
|
2478
|
-
|
|
2694
|
+
_createTelCtx().processNext(event);
|
|
2479
2695
|
});
|
|
2480
2696
|
}
|
|
2481
2697
|
};
|
|
@@ -2502,9 +2718,12 @@ var BaseCore = /** @class */ (function () {
|
|
|
2502
2718
|
};
|
|
2503
2719
|
proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, ["addTelemetryInitializer"]);
|
|
2504
2720
|
_self.getPlugin = _getPlugin;
|
|
2721
|
+
_self.evtNamespace = function () {
|
|
2722
|
+
return _evtNamespace;
|
|
2723
|
+
};
|
|
2505
2724
|
function _initDefaults() {
|
|
2506
2725
|
_isInitialized = false;
|
|
2507
|
-
_self.logger = new DiagnosticLogger({ loggingLevelConsole:
|
|
2726
|
+
_self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 });
|
|
2508
2727
|
_self.config = null;
|
|
2509
2728
|
_self._extensions = [];
|
|
2510
2729
|
_telemetryInitializerPlugin = new TelemetryInitializerPlugin();
|
|
@@ -2520,6 +2739,10 @@ var BaseCore = /** @class */ (function () {
|
|
|
2520
2739
|
_channelConfig = null;
|
|
2521
2740
|
_channelQueue = null;
|
|
2522
2741
|
_internalLogsEventName = null;
|
|
2742
|
+
_evtNamespace = createUniqueNamespace("AIBaseCore", true);
|
|
2743
|
+
}
|
|
2744
|
+
function _createTelCtx() {
|
|
2745
|
+
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
2523
2746
|
}
|
|
2524
2747
|
function _initPluginChain(config) {
|
|
2525
2748
|
var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
|
|
@@ -2527,26 +2750,49 @@ var BaseCore = /** @class */ (function () {
|
|
|
2527
2750
|
_pluginChain = null;
|
|
2528
2751
|
var allExtensions = theExtensions.all;
|
|
2529
2752
|
_channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, config, _self));
|
|
2530
|
-
|
|
2753
|
+
if (_channelControl) {
|
|
2754
|
+
var idx = allExtensions.indexOf(_channelControl);
|
|
2755
|
+
if (idx !== -1) {
|
|
2756
|
+
allExtensions.splice(idx, 1);
|
|
2757
|
+
}
|
|
2758
|
+
idx = _coreExtensions.indexOf(_channelControl);
|
|
2759
|
+
if (idx !== -1) {
|
|
2760
|
+
_coreExtensions.splice(idx, 1);
|
|
2761
|
+
}
|
|
2762
|
+
_channelControl._setQueue(_channelQueue);
|
|
2763
|
+
}
|
|
2764
|
+
else {
|
|
2765
|
+
_channelControl = createChannelControllerPlugin(_channelQueue, _self);
|
|
2766
|
+
}
|
|
2531
2767
|
allExtensions.push(_channelControl);
|
|
2532
2768
|
_coreExtensions.push(_channelControl);
|
|
2533
2769
|
_self._extensions = sortPlugins(allExtensions);
|
|
2534
2770
|
_channelControl.initialize(config, _self, allExtensions);
|
|
2535
|
-
initializePlugins(
|
|
2771
|
+
initializePlugins(_createTelCtx(), allExtensions);
|
|
2536
2772
|
_self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
|
|
2537
2773
|
}
|
|
2538
2774
|
function _getPlugin(pluginIdentifier) {
|
|
2539
2775
|
var theExt = null;
|
|
2540
2776
|
var thePlugin = null;
|
|
2541
2777
|
arrForEach(_self._extensions, function (ext) {
|
|
2542
|
-
if (ext.identifier === pluginIdentifier) {
|
|
2778
|
+
if (ext.identifier === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
|
|
2543
2779
|
thePlugin = ext;
|
|
2544
2780
|
return -1;
|
|
2545
2781
|
}
|
|
2546
2782
|
});
|
|
2783
|
+
if (!thePlugin && _channelControl) {
|
|
2784
|
+
thePlugin = _channelControl.getChannel(pluginIdentifier);
|
|
2785
|
+
}
|
|
2547
2786
|
if (thePlugin) {
|
|
2548
2787
|
theExt = {
|
|
2549
|
-
plugin: thePlugin
|
|
2788
|
+
plugin: thePlugin,
|
|
2789
|
+
setEnabled: function (enabled) {
|
|
2790
|
+
_getPluginState(thePlugin)[strDisabled] = !enabled;
|
|
2791
|
+
},
|
|
2792
|
+
isEnabled: function () {
|
|
2793
|
+
var pluginState = _getPluginState(thePlugin);
|
|
2794
|
+
return !pluginState[strTeardown] && !pluginState[strDisabled];
|
|
2795
|
+
}
|
|
2550
2796
|
};
|
|
2551
2797
|
}
|
|
2552
2798
|
return theExt;
|
|
@@ -2554,7 +2800,9 @@ var BaseCore = /** @class */ (function () {
|
|
|
2554
2800
|
function _getPluginChain() {
|
|
2555
2801
|
if (!_pluginChain) {
|
|
2556
2802
|
var extensions = (_coreExtensions || []).slice();
|
|
2557
|
-
extensions.
|
|
2803
|
+
if (extensions.indexOf(_telemetryInitializerPlugin) === -1) {
|
|
2804
|
+
extensions.push(_telemetryInitializerPlugin);
|
|
2805
|
+
}
|
|
2558
2806
|
_pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _self.config, _self);
|
|
2559
2807
|
}
|
|
2560
2808
|
return _pluginChain;
|
|
@@ -2577,12 +2825,12 @@ var BaseCore = /** @class */ (function () {
|
|
|
2577
2825
|
}
|
|
2578
2826
|
function _initDebugListener(config) {
|
|
2579
2827
|
if (config.disableDbgExt === true && _debugListener) {
|
|
2580
|
-
_notificationManager
|
|
2828
|
+
_notificationManager[strRemoveNotificationListener](_debugListener);
|
|
2581
2829
|
_debugListener = null;
|
|
2582
2830
|
}
|
|
2583
2831
|
if (_notificationManager && !_debugListener && config.disableDbgExt !== true) {
|
|
2584
2832
|
_debugListener = getDebugListener(config);
|
|
2585
|
-
_notificationManager
|
|
2833
|
+
_notificationManager[strAddNotificationListener](_debugListener);
|
|
2586
2834
|
}
|
|
2587
2835
|
}
|
|
2588
2836
|
function _initPerfManager(config) {
|
|
@@ -2598,10 +2846,6 @@ var BaseCore = /** @class */ (function () {
|
|
|
2598
2846
|
return BaseCore;
|
|
2599
2847
|
}());
|
|
2600
2848
|
|
|
2601
|
-
var strEventsSent = "eventsSent";
|
|
2602
|
-
var strEventsDiscarded = "eventsDiscarded";
|
|
2603
|
-
var strEventsSendRequest = "eventsSendRequest";
|
|
2604
|
-
var strPerfEvent = "perfEvent";
|
|
2605
2849
|
function _runListeners(listeners, name, isAsync, callback) {
|
|
2606
2850
|
arrForEach(listeners, function (listener) {
|
|
2607
2851
|
if (listener && listener[name]) {
|
|
@@ -2623,32 +2867,32 @@ var NotificationManager = /** @class */ (function () {
|
|
|
2623
2867
|
this.listeners = [];
|
|
2624
2868
|
var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;
|
|
2625
2869
|
dynamicProto(NotificationManager, this, function (_self) {
|
|
2626
|
-
_self
|
|
2870
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2627
2871
|
_self.listeners.push(listener);
|
|
2628
2872
|
};
|
|
2629
|
-
_self
|
|
2873
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2630
2874
|
var index = arrIndexOf(_self.listeners, listener);
|
|
2631
2875
|
while (index > -1) {
|
|
2632
2876
|
_self.listeners.splice(index, 1);
|
|
2633
2877
|
index = arrIndexOf(_self.listeners, listener);
|
|
2634
2878
|
}
|
|
2635
2879
|
};
|
|
2636
|
-
_self
|
|
2880
|
+
_self[strEventsSent] = function (events) {
|
|
2637
2881
|
_runListeners(_self.listeners, strEventsSent, true, function (listener) {
|
|
2638
2882
|
listener[strEventsSent](events);
|
|
2639
2883
|
});
|
|
2640
2884
|
};
|
|
2641
|
-
_self
|
|
2885
|
+
_self[strEventsDiscarded] = function (events, reason) {
|
|
2642
2886
|
_runListeners(_self.listeners, strEventsDiscarded, true, function (listener) {
|
|
2643
2887
|
listener[strEventsDiscarded](events, reason);
|
|
2644
2888
|
});
|
|
2645
2889
|
};
|
|
2646
|
-
_self
|
|
2890
|
+
_self[strEventsSendRequest] = function (sendReason, isAsync) {
|
|
2647
2891
|
_runListeners(_self.listeners, strEventsSendRequest, isAsync, function (listener) {
|
|
2648
2892
|
listener[strEventsSendRequest](sendReason, isAsync);
|
|
2649
2893
|
});
|
|
2650
2894
|
};
|
|
2651
|
-
_self
|
|
2895
|
+
_self[strPerfEvent] = function (perfEvent) {
|
|
2652
2896
|
if (perfEvent) {
|
|
2653
2897
|
if (perfEvtsSendAll || !perfEvent.isChildEvt()) {
|
|
2654
2898
|
_runListeners(_self.listeners, strPerfEvent, false, function (listener) {
|
|
@@ -2703,147 +2947,179 @@ var AppInsightsCore = /** @class */ (function (_super) {
|
|
|
2703
2947
|
return AppInsightsCore;
|
|
2704
2948
|
}(BaseCore));
|
|
2705
2949
|
|
|
2706
|
-
var
|
|
2707
|
-
var
|
|
2708
|
-
var
|
|
2709
|
-
var
|
|
2710
|
-
var
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2950
|
+
var strOnPrefix = "on";
|
|
2951
|
+
var strAttachEvent = "attachEvent";
|
|
2952
|
+
var strAddEventHelper = "addEventListener";
|
|
2953
|
+
var strEvents = "events";
|
|
2954
|
+
var strVisibilityChangeEvt = "visibilitychange";
|
|
2955
|
+
var strPageHide = "pagehide";
|
|
2956
|
+
var strUnload = "unload";
|
|
2957
|
+
var strBeforeUnload = "beforeunload";
|
|
2958
|
+
var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
|
|
2959
|
+
createUniqueNamespace("aiEvtPageShow");
|
|
2960
|
+
var _guid = 1;
|
|
2961
|
+
var elmNodeData = createElmNodeData("events");
|
|
2962
|
+
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
2963
|
+
function _normalizeNamespace(name) {
|
|
2964
|
+
if (name && name.replace) {
|
|
2965
|
+
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
2966
|
+
}
|
|
2967
|
+
return name;
|
|
2968
|
+
}
|
|
2969
|
+
function _getEvtNamespace(eventName, namespaces) {
|
|
2970
|
+
if (namespaces) {
|
|
2971
|
+
var theNamespace_1 = "";
|
|
2972
|
+
if (isArray(namespaces)) {
|
|
2973
|
+
theNamespace_1 = "";
|
|
2974
|
+
arrForEach(namespaces, function (name) {
|
|
2975
|
+
name = _normalizeNamespace(name);
|
|
2976
|
+
if (name) {
|
|
2977
|
+
if (name[0] !== ".") {
|
|
2978
|
+
name = "." + name;
|
|
2979
|
+
}
|
|
2980
|
+
theNamespace_1 += name;
|
|
2981
|
+
}
|
|
2982
|
+
});
|
|
2983
|
+
}
|
|
2984
|
+
else {
|
|
2985
|
+
theNamespace_1 = _normalizeNamespace(namespaces);
|
|
2986
|
+
}
|
|
2987
|
+
if (theNamespace_1) {
|
|
2988
|
+
if (theNamespace_1[0] !== ".") {
|
|
2989
|
+
theNamespace_1 = "." + theNamespace_1;
|
|
2990
|
+
}
|
|
2991
|
+
eventName = (eventName || "") + theNamespace_1;
|
|
2992
|
+
}
|
|
2714
2993
|
}
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2994
|
+
var parsedEvent = (eventNamespace.exec(eventName) || []);
|
|
2995
|
+
return {
|
|
2996
|
+
type: parsedEvent[1],
|
|
2997
|
+
ns: ((parsedEvent[2] || "").split(".").sort()).join(".")
|
|
2998
|
+
};
|
|
2718
2999
|
}
|
|
2719
|
-
function
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
3000
|
+
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
3001
|
+
if (addDefault === void 0) { addDefault = true; }
|
|
3002
|
+
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
3003
|
+
var registeredEvents = aiEvts[evtName];
|
|
3004
|
+
if (!registeredEvents) {
|
|
3005
|
+
registeredEvents = aiEvts[evtName] = [];
|
|
2725
3006
|
}
|
|
3007
|
+
return registeredEvents;
|
|
2726
3008
|
}
|
|
2727
|
-
function
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
2738
|
-
}
|
|
2739
|
-
if (value === 0 && isIE()) {
|
|
2740
|
-
if (!_mwcSeeded) {
|
|
2741
|
-
_autoSeedMwc();
|
|
3009
|
+
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
3010
|
+
var result = false;
|
|
3011
|
+
if (obj && evtName && evtName.type && handlerRef) {
|
|
3012
|
+
if (obj[strAddEventHelper]) {
|
|
3013
|
+
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
3014
|
+
result = true;
|
|
3015
|
+
}
|
|
3016
|
+
else if (obj[strAttachEvent]) {
|
|
3017
|
+
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
3018
|
+
result = true;
|
|
2742
3019
|
}
|
|
2743
|
-
value = mwcRandom32() & MaxUInt32;
|
|
2744
|
-
}
|
|
2745
|
-
if (value === 0) {
|
|
2746
|
-
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
2747
|
-
}
|
|
2748
|
-
if (!signed) {
|
|
2749
|
-
value >>>= 0;
|
|
2750
3020
|
}
|
|
2751
|
-
return
|
|
3021
|
+
return result;
|
|
2752
3022
|
}
|
|
2753
|
-
function
|
|
2754
|
-
|
|
2755
|
-
|
|
3023
|
+
function mergeEvtNamespace(theNamespace, namespaces) {
|
|
3024
|
+
var newNamespaces;
|
|
3025
|
+
if (namespaces) {
|
|
3026
|
+
if (isArray(namespaces)) {
|
|
3027
|
+
newNamespaces = [theNamespace].concat(namespaces);
|
|
3028
|
+
}
|
|
3029
|
+
else {
|
|
3030
|
+
newNamespaces = [theNamespace, namespaces];
|
|
3031
|
+
}
|
|
2756
3032
|
}
|
|
2757
3033
|
else {
|
|
2758
|
-
|
|
3034
|
+
newNamespaces = theNamespace;
|
|
2759
3035
|
}
|
|
3036
|
+
return newNamespaces;
|
|
2760
3037
|
}
|
|
2761
|
-
function
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
number >>>= 6;
|
|
2780
|
-
if (chars === 5) {
|
|
2781
|
-
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
2782
|
-
chars = 0;
|
|
3038
|
+
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
3039
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3040
|
+
var result = false;
|
|
3041
|
+
if (target) {
|
|
3042
|
+
try {
|
|
3043
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
3044
|
+
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
3045
|
+
if (result && elmNodeData.accept(target)) {
|
|
3046
|
+
var registeredEvent = {
|
|
3047
|
+
guid: _guid++,
|
|
3048
|
+
evtName: evtName,
|
|
3049
|
+
handler: handlerRef,
|
|
3050
|
+
capture: useCapture
|
|
3051
|
+
};
|
|
3052
|
+
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
catch (e) {
|
|
2783
3056
|
}
|
|
2784
3057
|
}
|
|
2785
3058
|
return result;
|
|
2786
3059
|
}
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
function addEventHandler(eventName, callback) {
|
|
3060
|
+
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
3061
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3062
|
+
return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
|
|
3063
|
+
}
|
|
3064
|
+
function addEventHandler(eventName, callback, evtNamespace) {
|
|
2793
3065
|
var result = false;
|
|
2794
3066
|
var w = getWindow();
|
|
2795
3067
|
if (w) {
|
|
2796
|
-
result =
|
|
2797
|
-
result =
|
|
3068
|
+
result = eventOn(w, eventName, callback, evtNamespace);
|
|
3069
|
+
result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
|
|
2798
3070
|
}
|
|
2799
3071
|
var doc = getDocument();
|
|
2800
3072
|
if (doc) {
|
|
2801
|
-
result =
|
|
3073
|
+
result = eventOn(doc, eventName, callback, evtNamespace) || result;
|
|
2802
3074
|
}
|
|
2803
3075
|
return result;
|
|
2804
3076
|
}
|
|
2805
|
-
function
|
|
3077
|
+
function _addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
2806
3078
|
var added = false;
|
|
2807
|
-
if (listener && events &&
|
|
2808
|
-
var excluded_1 = [];
|
|
3079
|
+
if (listener && events && events.length > 0) {
|
|
2809
3080
|
arrForEach(events, function (name) {
|
|
2810
|
-
if (
|
|
3081
|
+
if (name) {
|
|
2811
3082
|
if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {
|
|
2812
|
-
added = addEventHandler(name, listener) || added;
|
|
2813
|
-
}
|
|
2814
|
-
else {
|
|
2815
|
-
excluded_1.push(name);
|
|
3083
|
+
added = addEventHandler(name, listener, evtNamespace) || added;
|
|
2816
3084
|
}
|
|
2817
3085
|
}
|
|
2818
3086
|
});
|
|
2819
|
-
|
|
2820
|
-
|
|
3087
|
+
}
|
|
3088
|
+
return added;
|
|
3089
|
+
}
|
|
3090
|
+
function addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
3091
|
+
var added = false;
|
|
3092
|
+
if (listener && events && isArray(events)) {
|
|
3093
|
+
added = _addEventListeners(events, listener, excludeEvents, evtNamespace);
|
|
3094
|
+
if (!added && excludeEvents && excludeEvents.length > 0) {
|
|
3095
|
+
added = _addEventListeners(events, listener, null, evtNamespace);
|
|
2821
3096
|
}
|
|
2822
3097
|
}
|
|
2823
3098
|
return added;
|
|
2824
3099
|
}
|
|
2825
|
-
function addPageUnloadEventListener(listener, excludeEvents) {
|
|
2826
|
-
return addEventListeners([
|
|
3100
|
+
function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {
|
|
3101
|
+
return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);
|
|
2827
3102
|
}
|
|
2828
|
-
function addPageHideEventListener(listener, excludeEvents) {
|
|
3103
|
+
function addPageHideEventListener(listener, excludeEvents, evtNamespace) {
|
|
2829
3104
|
function _handlePageVisibility(evt) {
|
|
2830
3105
|
var doc = getDocument();
|
|
2831
3106
|
if (listener && doc && doc.visibilityState === "hidden") {
|
|
2832
3107
|
listener(evt);
|
|
2833
3108
|
}
|
|
2834
3109
|
}
|
|
2835
|
-
var
|
|
2836
|
-
|
|
2837
|
-
pageUnloadAdded = addEventHandler(strPageHide, listener);
|
|
2838
|
-
}
|
|
3110
|
+
var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
|
|
3111
|
+
var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);
|
|
2839
3112
|
if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
|
|
2840
|
-
pageUnloadAdded =
|
|
3113
|
+
pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;
|
|
2841
3114
|
}
|
|
2842
3115
|
if (!pageUnloadAdded && excludeEvents) {
|
|
2843
|
-
pageUnloadAdded = addPageHideEventListener(listener);
|
|
3116
|
+
pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);
|
|
2844
3117
|
}
|
|
2845
3118
|
return pageUnloadAdded;
|
|
2846
3119
|
}
|
|
3120
|
+
|
|
3121
|
+
var _cookieMgrs = null;
|
|
3122
|
+
var _canUseCookies;
|
|
2847
3123
|
function newGuid() {
|
|
2848
3124
|
function randomHexDigit() {
|
|
2849
3125
|
return randomValue(15);
|
|
@@ -2862,7 +3138,7 @@ function perfNow() {
|
|
|
2862
3138
|
}
|
|
2863
3139
|
function generateW3CId() {
|
|
2864
3140
|
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
2865
|
-
var oct =
|
|
3141
|
+
var oct = strEmpty$1, tmp;
|
|
2866
3142
|
for (var a = 0; a < 4; a++) {
|
|
2867
3143
|
tmp = random32();
|
|
2868
3144
|
oct +=
|
|
@@ -2957,6 +3233,95 @@ function deleteCookie(logger, name) {
|
|
|
2957
3233
|
return _legacyCookieMgr(null, logger).del(name);
|
|
2958
3234
|
}
|
|
2959
3235
|
|
|
3236
|
+
var LoggingSeverity = createEnumStyle({
|
|
3237
|
+
CRITICAL: 1 ,
|
|
3238
|
+
WARNING: 2
|
|
3239
|
+
});
|
|
3240
|
+
var _InternalMessageId = createEnumStyle({
|
|
3241
|
+
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
3242
|
+
BrowserCannotReadLocalStorage: 1 ,
|
|
3243
|
+
BrowserCannotReadSessionStorage: 2 ,
|
|
3244
|
+
BrowserCannotWriteLocalStorage: 3 ,
|
|
3245
|
+
BrowserCannotWriteSessionStorage: 4 ,
|
|
3246
|
+
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
3247
|
+
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
3248
|
+
CannotSendEmptyTelemetry: 7 ,
|
|
3249
|
+
ClientPerformanceMathError: 8 ,
|
|
3250
|
+
ErrorParsingAISessionCookie: 9 ,
|
|
3251
|
+
ErrorPVCalc: 10 ,
|
|
3252
|
+
ExceptionWhileLoggingError: 11 ,
|
|
3253
|
+
FailedAddingTelemetryToBuffer: 12 ,
|
|
3254
|
+
FailedMonitorAjaxAbort: 13 ,
|
|
3255
|
+
FailedMonitorAjaxDur: 14 ,
|
|
3256
|
+
FailedMonitorAjaxOpen: 15 ,
|
|
3257
|
+
FailedMonitorAjaxRSC: 16 ,
|
|
3258
|
+
FailedMonitorAjaxSend: 17 ,
|
|
3259
|
+
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
3260
|
+
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
3261
|
+
FailedToSendQueuedTelemetry: 20 ,
|
|
3262
|
+
FailedToReportDataLoss: 21 ,
|
|
3263
|
+
FlushFailed: 22 ,
|
|
3264
|
+
MessageLimitPerPVExceeded: 23 ,
|
|
3265
|
+
MissingRequiredFieldSpecification: 24 ,
|
|
3266
|
+
NavigationTimingNotSupported: 25 ,
|
|
3267
|
+
OnError: 26 ,
|
|
3268
|
+
SessionRenewalDateIsZero: 27 ,
|
|
3269
|
+
SenderNotInitialized: 28 ,
|
|
3270
|
+
StartTrackEventFailed: 29 ,
|
|
3271
|
+
StopTrackEventFailed: 30 ,
|
|
3272
|
+
StartTrackFailed: 31 ,
|
|
3273
|
+
StopTrackFailed: 32 ,
|
|
3274
|
+
TelemetrySampledAndNotSent: 33 ,
|
|
3275
|
+
TrackEventFailed: 34 ,
|
|
3276
|
+
TrackExceptionFailed: 35 ,
|
|
3277
|
+
TrackMetricFailed: 36 ,
|
|
3278
|
+
TrackPVFailed: 37 ,
|
|
3279
|
+
TrackPVFailedCalc: 38 ,
|
|
3280
|
+
TrackTraceFailed: 39 ,
|
|
3281
|
+
TransmissionFailed: 40 ,
|
|
3282
|
+
FailedToSetStorageBuffer: 41 ,
|
|
3283
|
+
FailedToRestoreStorageBuffer: 42 ,
|
|
3284
|
+
InvalidBackendResponse: 43 ,
|
|
3285
|
+
FailedToFixDepricatedValues: 44 ,
|
|
3286
|
+
InvalidDurationValue: 45 ,
|
|
3287
|
+
TelemetryEnvelopeInvalid: 46 ,
|
|
3288
|
+
CreateEnvelopeError: 47 ,
|
|
3289
|
+
CannotSerializeObject: 48 ,
|
|
3290
|
+
CannotSerializeObjectNonSerializable: 49 ,
|
|
3291
|
+
CircularReferenceDetected: 50 ,
|
|
3292
|
+
ClearAuthContextFailed: 51 ,
|
|
3293
|
+
ExceptionTruncated: 52 ,
|
|
3294
|
+
IllegalCharsInName: 53 ,
|
|
3295
|
+
ItemNotInArray: 54 ,
|
|
3296
|
+
MaxAjaxPerPVExceeded: 55 ,
|
|
3297
|
+
MessageTruncated: 56 ,
|
|
3298
|
+
NameTooLong: 57 ,
|
|
3299
|
+
SampleRateOutOfRange: 58 ,
|
|
3300
|
+
SetAuthContextFailed: 59 ,
|
|
3301
|
+
SetAuthContextFailedAccountName: 60 ,
|
|
3302
|
+
StringValueTooLong: 61 ,
|
|
3303
|
+
StartCalledMoreThanOnce: 62 ,
|
|
3304
|
+
StopCalledWithoutStart: 63 ,
|
|
3305
|
+
TelemetryInitializerFailed: 64 ,
|
|
3306
|
+
TrackArgumentsNotSpecified: 65 ,
|
|
3307
|
+
UrlTooLong: 66 ,
|
|
3308
|
+
SessionStorageBufferFull: 67 ,
|
|
3309
|
+
CannotAccessCookie: 68 ,
|
|
3310
|
+
IdTooLong: 69 ,
|
|
3311
|
+
InvalidEvent: 70 ,
|
|
3312
|
+
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
3313
|
+
SendBrowserInfoOnUserInit: 72 ,
|
|
3314
|
+
PluginException: 73 ,
|
|
3315
|
+
NotificationException: 74 ,
|
|
3316
|
+
SnippetScriptLoadFailure: 99 ,
|
|
3317
|
+
InvalidInstrumentationKey: 100 ,
|
|
3318
|
+
CannotParseAiBlobValue: 101 ,
|
|
3319
|
+
InvalidContentBlob: 102 ,
|
|
3320
|
+
TrackPageActionEventFailed: 103 ,
|
|
3321
|
+
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
3322
|
+
InMemoryStorageBufferFull: 105
|
|
3323
|
+
});
|
|
3324
|
+
|
|
2960
3325
|
var aiInstrumentHooks = "_aiHooks";
|
|
2961
3326
|
var cbNames = [
|
|
2962
3327
|
"req", "rsp", "hkErr", "fnErr"
|
|
@@ -3132,7 +3497,7 @@ function dataSanitizeKey(logger, name) {
|
|
|
3132
3497
|
name = strTrim(name.toString());
|
|
3133
3498
|
if (name.length > 150 ) {
|
|
3134
3499
|
nameTrunc = name.substring(0, 150 );
|
|
3135
|
-
logger && logger.throwInternal(
|
|
3500
|
+
logger && logger.throwInternal(2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
|
|
3136
3501
|
}
|
|
3137
3502
|
}
|
|
3138
3503
|
return nameTrunc || name;
|
|
@@ -3145,7 +3510,7 @@ function dataSanitizeString(logger, value, maxLength) {
|
|
|
3145
3510
|
value = strTrim(value);
|
|
3146
3511
|
if (value.toString().length > maxLength) {
|
|
3147
3512
|
valueTrunc = value.toString().substring(0, maxLength);
|
|
3148
|
-
logger && logger.throwInternal(
|
|
3513
|
+
logger && logger.throwInternal(2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
|
|
3149
3514
|
}
|
|
3150
3515
|
}
|
|
3151
3516
|
return valueTrunc || value;
|
|
@@ -3158,7 +3523,7 @@ function dataSanitizeMessage(logger, message) {
|
|
|
3158
3523
|
if (message) {
|
|
3159
3524
|
if (message.length > 32768 ) {
|
|
3160
3525
|
messageTrunc = message.substring(0, 32768 );
|
|
3161
|
-
logger && logger.throwInternal(
|
|
3526
|
+
logger && logger.throwInternal(2 , _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
|
|
3162
3527
|
}
|
|
3163
3528
|
}
|
|
3164
3529
|
return messageTrunc || message;
|
|
@@ -3169,7 +3534,7 @@ function dataSanitizeException(logger, exception) {
|
|
|
3169
3534
|
var value = "" + exception;
|
|
3170
3535
|
if (value.length > 32768 ) {
|
|
3171
3536
|
exceptionTrunc = value.substring(0, 32768 );
|
|
3172
|
-
logger && logger.throwInternal(
|
|
3537
|
+
logger && logger.throwInternal(2 , _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
|
|
3173
3538
|
}
|
|
3174
3539
|
}
|
|
3175
3540
|
return exceptionTrunc || exception;
|
|
@@ -3183,7 +3548,7 @@ function dataSanitizeProperties(logger, properties) {
|
|
|
3183
3548
|
value = getJSON().stringify(value);
|
|
3184
3549
|
}
|
|
3185
3550
|
catch (e) {
|
|
3186
|
-
logger && logger.throwInternal(
|
|
3551
|
+
logger && logger.throwInternal(2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
|
|
3187
3552
|
}
|
|
3188
3553
|
}
|
|
3189
3554
|
value = dataSanitizeString(logger, value, 8192 );
|
|
@@ -3214,7 +3579,7 @@ function dataSanitizeInput(logger, input, maxLength, _msgId) {
|
|
|
3214
3579
|
input = strTrim(input);
|
|
3215
3580
|
if (input.length > maxLength) {
|
|
3216
3581
|
inputTrunc = input.substring(0, maxLength);
|
|
3217
|
-
logger && logger.throwInternal(
|
|
3582
|
+
logger && logger.throwInternal(2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
|
|
3218
3583
|
}
|
|
3219
3584
|
}
|
|
3220
3585
|
return inputTrunc || input;
|
|
@@ -3260,6 +3625,7 @@ function createDomEvent(eventName) {
|
|
|
3260
3625
|
return event;
|
|
3261
3626
|
}
|
|
3262
3627
|
|
|
3628
|
+
var strEmpty = "";
|
|
3263
3629
|
function stringToBoolOrDefault(str, defaultValue) {
|
|
3264
3630
|
if (defaultValue === void 0) { defaultValue = false; }
|
|
3265
3631
|
if (str === undefined || str === null) {
|
|
@@ -3272,16 +3638,16 @@ function msToTimeSpan(totalms) {
|
|
|
3272
3638
|
totalms = 0;
|
|
3273
3639
|
}
|
|
3274
3640
|
totalms = Math.round(totalms);
|
|
3275
|
-
var ms =
|
|
3276
|
-
var sec =
|
|
3277
|
-
var min =
|
|
3278
|
-
var hour =
|
|
3641
|
+
var ms = strEmpty + totalms % 1000;
|
|
3642
|
+
var sec = strEmpty + Math.floor(totalms / 1000) % 60;
|
|
3643
|
+
var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
|
|
3644
|
+
var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
|
|
3279
3645
|
var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
|
|
3280
3646
|
ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
|
|
3281
3647
|
sec = sec.length < 2 ? "0" + sec : sec;
|
|
3282
3648
|
min = min.length < 2 ? "0" + min : min;
|
|
3283
3649
|
hour = hour.length < 2 ? "0" + hour : hour;
|
|
3284
|
-
return (days > 0 ? days + "." :
|
|
3650
|
+
return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
|
|
3285
3651
|
}
|
|
3286
3652
|
function getExtensionByName(extensions, identifier) {
|
|
3287
3653
|
var extension = null;
|
|
@@ -3305,17 +3671,15 @@ var DEFAULT_BREEZE_ENDPOINT = "https://dc.services.visualstudio.com";
|
|
|
3305
3671
|
var strNotSpecified = "not_specified";
|
|
3306
3672
|
var strIkey = "iKey";
|
|
3307
3673
|
|
|
3308
|
-
var StorageType
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
|
|
3318
|
-
})(DistributedTracingModes || (DistributedTracingModes = {}));
|
|
3674
|
+
var StorageType = createEnumStyle({
|
|
3675
|
+
LocalStorage: 0 ,
|
|
3676
|
+
SessionStorage: 1
|
|
3677
|
+
});
|
|
3678
|
+
var DistributedTracingModes = createEnumStyle({
|
|
3679
|
+
AI: 0 ,
|
|
3680
|
+
AI_AND_W3C: 1 ,
|
|
3681
|
+
W3C: 2
|
|
3682
|
+
});
|
|
3319
3683
|
|
|
3320
3684
|
var _canUseLocalStorage = undefined;
|
|
3321
3685
|
var _canUseSessionStorage = undefined;
|
|
@@ -3367,7 +3731,7 @@ function utlGetLocalStorage(logger, name) {
|
|
|
3367
3731
|
}
|
|
3368
3732
|
catch (e) {
|
|
3369
3733
|
_canUseLocalStorage = false;
|
|
3370
|
-
logger.throwInternal(
|
|
3734
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3371
3735
|
}
|
|
3372
3736
|
}
|
|
3373
3737
|
return null;
|
|
@@ -3381,7 +3745,7 @@ function utlSetLocalStorage(logger, name, data) {
|
|
|
3381
3745
|
}
|
|
3382
3746
|
catch (e) {
|
|
3383
3747
|
_canUseLocalStorage = false;
|
|
3384
|
-
logger.throwInternal(
|
|
3748
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3385
3749
|
}
|
|
3386
3750
|
}
|
|
3387
3751
|
return false;
|
|
@@ -3395,7 +3759,7 @@ function utlRemoveStorage(logger, name) {
|
|
|
3395
3759
|
}
|
|
3396
3760
|
catch (e) {
|
|
3397
3761
|
_canUseLocalStorage = false;
|
|
3398
|
-
logger.throwInternal(
|
|
3762
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3399
3763
|
}
|
|
3400
3764
|
}
|
|
3401
3765
|
return false;
|
|
@@ -3423,7 +3787,7 @@ function utlGetSessionStorage(logger, name) {
|
|
|
3423
3787
|
}
|
|
3424
3788
|
catch (e) {
|
|
3425
3789
|
_canUseSessionStorage = false;
|
|
3426
|
-
logger.throwInternal(
|
|
3790
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3427
3791
|
}
|
|
3428
3792
|
}
|
|
3429
3793
|
return null;
|
|
@@ -3437,7 +3801,7 @@ function utlSetSessionStorage(logger, name, data) {
|
|
|
3437
3801
|
}
|
|
3438
3802
|
catch (e) {
|
|
3439
3803
|
_canUseSessionStorage = false;
|
|
3440
|
-
logger.throwInternal(
|
|
3804
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3441
3805
|
}
|
|
3442
3806
|
}
|
|
3443
3807
|
return false;
|
|
@@ -3451,7 +3815,7 @@ function utlRemoveSessionStorage(logger, name) {
|
|
|
3451
3815
|
}
|
|
3452
3816
|
catch (e) {
|
|
3453
3817
|
_canUseSessionStorage = false;
|
|
3454
|
-
logger.throwInternal(
|
|
3818
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3455
3819
|
}
|
|
3456
3820
|
}
|
|
3457
3821
|
return false;
|
|
@@ -5610,7 +5974,7 @@ var ApplicationInsights = /** @class */ (function (_super) {
|
|
|
5610
5974
|
config.disableFlushOnUnload = stringToBoolOrDefault(config.disableFlushOnUnload, config.disableFlushOnBeforeUnload);
|
|
5611
5975
|
return config;
|
|
5612
5976
|
};
|
|
5613
|
-
ApplicationInsights.Version = "2.8.0-beta.
|
|
5977
|
+
ApplicationInsights.Version = "2.8.0-beta.2203-02";
|
|
5614
5978
|
return ApplicationInsights;
|
|
5615
5979
|
}(BaseTelemetryPlugin));
|
|
5616
5980
|
var Timing = /** @class */ (function () {
|
|
@@ -5917,7 +6281,7 @@ function EnvelopeCreatorInit(logger, telemetryItem) {
|
|
|
5917
6281
|
}
|
|
5918
6282
|
}
|
|
5919
6283
|
var EnvelopeCreator = {
|
|
5920
|
-
Version: "2.8.0-beta.
|
|
6284
|
+
Version: "2.8.0-beta.2203-02"
|
|
5921
6285
|
};
|
|
5922
6286
|
function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
|
|
5923
6287
|
EnvelopeCreatorInit(logger, telemetryItem);
|
|
@@ -7186,7 +7550,7 @@ var Device = /** @class */ (function () {
|
|
|
7186
7550
|
return Device;
|
|
7187
7551
|
}());
|
|
7188
7552
|
|
|
7189
|
-
var Version = "2.8.0-beta.
|
|
7553
|
+
var Version = "2.8.0-beta.2203-02";
|
|
7190
7554
|
var Internal = /** @class */ (function () {
|
|
7191
7555
|
function Internal(config) {
|
|
7192
7556
|
this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + Version;
|
|
@@ -7870,19 +8234,21 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
7870
8234
|
var _enableAjaxPerfTracking = false;
|
|
7871
8235
|
var _maxAjaxCallsPerView = 0;
|
|
7872
8236
|
var _enableResponseHeaderTracking = false;
|
|
7873
|
-
var _hooks = [];
|
|
7874
8237
|
var _disabledUrls = {};
|
|
7875
8238
|
var _excludeRequestFromAutoTrackingPatterns;
|
|
7876
8239
|
var _addRequestContext;
|
|
7877
|
-
|
|
8240
|
+
var _evtNamespace;
|
|
8241
|
+
dynamicProto(AjaxMonitor, _this, function (_self, _base) {
|
|
8242
|
+
var _addHook = _base._addHook;
|
|
7878
8243
|
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
7879
8244
|
if (!_self.isInitialized()) {
|
|
7880
|
-
|
|
8245
|
+
_base.initialize(config, core, extensions, pluginChain);
|
|
7881
8246
|
var ctx_1 = _self._getTelCtx();
|
|
7882
8247
|
var defaultConfig = AjaxMonitor.getDefaultConfig();
|
|
7883
8248
|
objForEachKey(defaultConfig, function (field, value) {
|
|
7884
8249
|
_config[field] = ctx_1.getConfig(AjaxMonitor.identifier, field, value);
|
|
7885
8250
|
});
|
|
8251
|
+
_evtNamespace = mergeEvtNamespace(createUniqueNamespace("ajax"), core && core.evtNamespace && core.evtNamespace());
|
|
7886
8252
|
var distributedTracingMode = _config.distributedTracingMode;
|
|
7887
8253
|
_enableRequestHeaderTracking = _config.enableRequestHeaderTracking;
|
|
7888
8254
|
_enableAjaxErrorStatusText = _config.enableAjaxErrorStatusText;
|
|
@@ -7891,8 +8257,8 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
7891
8257
|
_enableResponseHeaderTracking = _config.enableResponseHeaderTracking;
|
|
7892
8258
|
_excludeRequestFromAutoTrackingPatterns = _config.excludeRequestFromAutoTrackingPatterns;
|
|
7893
8259
|
_addRequestContext = _config.addRequestContext;
|
|
7894
|
-
_isUsingAIHeaders = distributedTracingMode ===
|
|
7895
|
-
_isUsingW3CHeaders = distributedTracingMode ===
|
|
8260
|
+
_isUsingAIHeaders = distributedTracingMode === 0 || distributedTracingMode === 1 ;
|
|
8261
|
+
_isUsingW3CHeaders = distributedTracingMode === 1 || distributedTracingMode === 2 ;
|
|
7896
8262
|
if (_enableAjaxPerfTracking) {
|
|
7897
8263
|
var iKey = config.instrumentationKey || "unkwn";
|
|
7898
8264
|
if (iKey.length > 5) {
|
|
@@ -7920,14 +8286,9 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
7920
8286
|
}
|
|
7921
8287
|
}
|
|
7922
8288
|
};
|
|
7923
|
-
_self.
|
|
7924
|
-
arrForEach(_hooks, function (fn) {
|
|
7925
|
-
fn.rm();
|
|
7926
|
-
});
|
|
7927
|
-
_hooks = [];
|
|
8289
|
+
_self._doTeardown = function () {
|
|
7928
8290
|
_fetchInitialized = false;
|
|
7929
8291
|
_xhrInitialized = false;
|
|
7930
|
-
_self.setInitialized(false);
|
|
7931
8292
|
};
|
|
7932
8293
|
_self.trackDependencyData = function (dependency, properties) {
|
|
7933
8294
|
_self[strTrackDependencyDataInternal](dependency, properties);
|
|
@@ -7994,8 +8355,8 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
7994
8355
|
};
|
|
7995
8356
|
_self[strTrackDependencyDataInternal] = function (dependency, properties, systemProperties) {
|
|
7996
8357
|
if (_maxAjaxCallsPerView === -1 || _trackAjaxAttempts < _maxAjaxCallsPerView) {
|
|
7997
|
-
if ((_config.distributedTracingMode ===
|
|
7998
|
-
|| _config.distributedTracingMode ===
|
|
8358
|
+
if ((_config.distributedTracingMode === 2
|
|
8359
|
+
|| _config.distributedTracingMode === 1 )
|
|
7999
8360
|
&& typeof dependency.id === "string" && dependency.id[dependency.id.length - 1] !== ".") {
|
|
8000
8361
|
dependency.id += ".";
|
|
8001
8362
|
}
|
|
@@ -8030,7 +8391,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
8030
8391
|
var global = getGlobal();
|
|
8031
8392
|
var isPolyfill = fetch.polyfill;
|
|
8032
8393
|
if (_config.disableFetchTracking === false) {
|
|
8033
|
-
|
|
8394
|
+
_addHook(InstrumentFunc(global, strFetch, {
|
|
8034
8395
|
req: function (callDetails, input, init) {
|
|
8035
8396
|
var fetchData;
|
|
8036
8397
|
if (_fetchInitialized &&
|
|
@@ -8078,7 +8439,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
8078
8439
|
_fetchInitialized = true;
|
|
8079
8440
|
}
|
|
8080
8441
|
else if (isPolyfill) {
|
|
8081
|
-
|
|
8442
|
+
_addHook(InstrumentFunc(global, strFetch, {
|
|
8082
8443
|
req: function (callDetails, input, init) {
|
|
8083
8444
|
_isDisabledRequest(null, input, init);
|
|
8084
8445
|
}
|
|
@@ -8089,7 +8450,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
8089
8450
|
}
|
|
8090
8451
|
}
|
|
8091
8452
|
function _hookProto(target, funcName, callbacks) {
|
|
8092
|
-
|
|
8453
|
+
_addHook(InstrumentProto(target, funcName, callbacks));
|
|
8093
8454
|
}
|
|
8094
8455
|
function _instrumentXhr() {
|
|
8095
8456
|
if (_supportsAjaxMonitoring(_self) && !_xhrInitialized) {
|
|
@@ -8211,7 +8572,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
8211
8572
|
xhr[strAjaxData] = ajaxData;
|
|
8212
8573
|
}
|
|
8213
8574
|
function _attachToOnReadyStateChange(xhr) {
|
|
8214
|
-
xhr[strAjaxData].xhrMonitoringState.stateChangeAttached =
|
|
8575
|
+
xhr[strAjaxData].xhrMonitoringState.stateChangeAttached = eventOn(xhr, "readystatechange", function () {
|
|
8215
8576
|
try {
|
|
8216
8577
|
if (xhr && xhr.readyState === 4 && _isMonitoredXhrInstance(xhr)) {
|
|
8217
8578
|
_onAjaxComplete(xhr);
|
|
@@ -8226,7 +8587,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
8226
8587
|
});
|
|
8227
8588
|
}
|
|
8228
8589
|
}
|
|
8229
|
-
});
|
|
8590
|
+
}, _evtNamespace);
|
|
8230
8591
|
}
|
|
8231
8592
|
function _getResponseText(xhr) {
|
|
8232
8593
|
try {
|
|
@@ -8511,7 +8872,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
8511
8872
|
disableFetchTracking: true,
|
|
8512
8873
|
excludeRequestFromAutoTrackingPatterns: undefined,
|
|
8513
8874
|
disableCorrelationHeaders: false,
|
|
8514
|
-
distributedTracingMode:
|
|
8875
|
+
distributedTracingMode: 1 ,
|
|
8515
8876
|
correlationHeaderExcludedDomains: [
|
|
8516
8877
|
"*.blob.core.windows.net",
|
|
8517
8878
|
"*.blob.core.chinacloudapi.cn",
|
|
@@ -8912,4 +9273,4 @@ catch (e) {
|
|
|
8912
9273
|
|
|
8913
9274
|
exports.ApplicationInsights = Initialization;
|
|
8914
9275
|
exports.Telemetry = Telemetry;
|
|
8915
|
-
//# sourceMappingURL=ai.2.8.0-beta.
|
|
9276
|
+
//# sourceMappingURL=ai.2.8.0-beta.2203-02.cjs.js.map
|