@microsoft/applicationinsights-web 2.8.0-beta.2202-07 → 2.8.0-beta.2203-03
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-07.cjs.js → ai.2.8.0-beta.2203-03.cjs.js} +1069 -522
- package/browser/ai.2.8.0-beta.2203-03.cjs.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-03.cjs.min.js +6 -0
- package/browser/ai.2.8.0-beta.2203-03.cjs.min.js.map +1 -0
- package/browser/{ai.2.8.0-beta.2202-07.gbl.js → ai.2.8.0-beta.2203-03.gbl.js} +1069 -522
- package/browser/ai.2.8.0-beta.2203-03.gbl.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-03.gbl.min.js +6 -0
- package/browser/ai.2.8.0-beta.2203-03.gbl.min.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-03.integrity.json +66 -0
- package/browser/{ai.2.8.0-beta.2202-07.js → ai.2.8.0-beta.2203-03.js} +1069 -522
- package/browser/ai.2.8.0-beta.2203-03.js.map +1 -0
- package/browser/ai.2.8.0-beta.2203-03.min.js +6 -0
- package/browser/ai.2.8.0-beta.2203-03.min.js.map +1 -0
- package/browser/ai.2.cjs.js +1068 -521
- 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 +1068 -521
- 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 +1068 -521
- 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 +925 -660
- package/dist/applicationinsights-web.api.md +53 -32
- package/dist/applicationinsights-web.d.ts +358 -93
- package/dist/applicationinsights-web.js +1134 -585
- 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 +358 -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-07.cjs.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-07.cjs.min.js +0 -6
- package/browser/ai.2.8.0-beta.2202-07.cjs.min.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-07.gbl.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-07.gbl.min.js +0 -6
- package/browser/ai.2.8.0-beta.2202-07.gbl.min.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-07.integrity.json +0 -66
- package/browser/ai.2.8.0-beta.2202-07.js.map +0 -1
- package/browser/ai.2.8.0-beta.2202-07.min.js +0 -6
- package/browser/ai.2.8.0-beta.2202-07.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-03
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -350,99 +350,26 @@
|
|
|
350
350
|
};
|
|
351
351
|
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
352
352
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
var
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
FailedMonitorAjaxAbort: 13,
|
|
373
|
-
FailedMonitorAjaxDur: 14,
|
|
374
|
-
FailedMonitorAjaxOpen: 15,
|
|
375
|
-
FailedMonitorAjaxRSC: 16,
|
|
376
|
-
FailedMonitorAjaxSend: 17,
|
|
377
|
-
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
378
|
-
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
379
|
-
FailedToSendQueuedTelemetry: 20,
|
|
380
|
-
FailedToReportDataLoss: 21,
|
|
381
|
-
FlushFailed: 22,
|
|
382
|
-
MessageLimitPerPVExceeded: 23,
|
|
383
|
-
MissingRequiredFieldSpecification: 24,
|
|
384
|
-
NavigationTimingNotSupported: 25,
|
|
385
|
-
OnError: 26,
|
|
386
|
-
SessionRenewalDateIsZero: 27,
|
|
387
|
-
SenderNotInitialized: 28,
|
|
388
|
-
StartTrackEventFailed: 29,
|
|
389
|
-
StopTrackEventFailed: 30,
|
|
390
|
-
StartTrackFailed: 31,
|
|
391
|
-
StopTrackFailed: 32,
|
|
392
|
-
TelemetrySampledAndNotSent: 33,
|
|
393
|
-
TrackEventFailed: 34,
|
|
394
|
-
TrackExceptionFailed: 35,
|
|
395
|
-
TrackMetricFailed: 36,
|
|
396
|
-
TrackPVFailed: 37,
|
|
397
|
-
TrackPVFailedCalc: 38,
|
|
398
|
-
TrackTraceFailed: 39,
|
|
399
|
-
TransmissionFailed: 40,
|
|
400
|
-
FailedToSetStorageBuffer: 41,
|
|
401
|
-
FailedToRestoreStorageBuffer: 42,
|
|
402
|
-
InvalidBackendResponse: 43,
|
|
403
|
-
FailedToFixDepricatedValues: 44,
|
|
404
|
-
InvalidDurationValue: 45,
|
|
405
|
-
TelemetryEnvelopeInvalid: 46,
|
|
406
|
-
CreateEnvelopeError: 47,
|
|
407
|
-
CannotSerializeObject: 48,
|
|
408
|
-
CannotSerializeObjectNonSerializable: 49,
|
|
409
|
-
CircularReferenceDetected: 50,
|
|
410
|
-
ClearAuthContextFailed: 51,
|
|
411
|
-
ExceptionTruncated: 52,
|
|
412
|
-
IllegalCharsInName: 53,
|
|
413
|
-
ItemNotInArray: 54,
|
|
414
|
-
MaxAjaxPerPVExceeded: 55,
|
|
415
|
-
MessageTruncated: 56,
|
|
416
|
-
NameTooLong: 57,
|
|
417
|
-
SampleRateOutOfRange: 58,
|
|
418
|
-
SetAuthContextFailed: 59,
|
|
419
|
-
SetAuthContextFailedAccountName: 60,
|
|
420
|
-
StringValueTooLong: 61,
|
|
421
|
-
StartCalledMoreThanOnce: 62,
|
|
422
|
-
StopCalledWithoutStart: 63,
|
|
423
|
-
TelemetryInitializerFailed: 64,
|
|
424
|
-
TrackArgumentsNotSpecified: 65,
|
|
425
|
-
UrlTooLong: 66,
|
|
426
|
-
SessionStorageBufferFull: 67,
|
|
427
|
-
CannotAccessCookie: 68,
|
|
428
|
-
IdTooLong: 69,
|
|
429
|
-
InvalidEvent: 70,
|
|
430
|
-
FailedMonitorAjaxSetRequestHeader: 71,
|
|
431
|
-
SendBrowserInfoOnUserInit: 72,
|
|
432
|
-
PluginException: 73,
|
|
433
|
-
NotificationException: 74,
|
|
434
|
-
SnippetScriptLoadFailure: 99,
|
|
435
|
-
InvalidInstrumentationKey: 100,
|
|
436
|
-
CannotParseAiBlobValue: 101,
|
|
437
|
-
InvalidContentBlob: 102,
|
|
438
|
-
TrackPageActionEventFailed: 103,
|
|
439
|
-
FailedAddingCustomDefinedRequestContext: 104,
|
|
440
|
-
InMemoryStorageBufferFull: 105
|
|
441
|
-
};
|
|
353
|
+
var strEmpty$1 = "";
|
|
354
|
+
var strProcessTelemetry = "processTelemetry";
|
|
355
|
+
var strPriority = "priority";
|
|
356
|
+
var strSetNextPlugin = "setNextPlugin";
|
|
357
|
+
var strIsInitialized = "isInitialized";
|
|
358
|
+
var strTeardown = "teardown";
|
|
359
|
+
var strCore = "core";
|
|
360
|
+
var strDisabled = "disabled";
|
|
361
|
+
var strDoTeardown = "_doTeardown";
|
|
362
|
+
var strProcessNext = "processNext";
|
|
363
|
+
var strResume = "resume";
|
|
364
|
+
var strPause = "pause";
|
|
365
|
+
var strNotificationListener = "NotificationListener";
|
|
366
|
+
var strAddNotificationListener = "add" + strNotificationListener;
|
|
367
|
+
var strRemoveNotificationListener = "remove" + strNotificationListener;
|
|
368
|
+
var strEventsSent = "eventsSent";
|
|
369
|
+
var strEventsDiscarded = "eventsDiscarded";
|
|
370
|
+
var strEventsSendRequest = "eventsSendRequest";
|
|
371
|
+
var strPerfEvent = "perfEvent";
|
|
442
372
|
|
|
443
|
-
var strOnPrefix = "on";
|
|
444
|
-
var strAttachEvent = "attachEvent";
|
|
445
|
-
var strAddEventHelper = "addEventListener";
|
|
446
373
|
var strToISOString = "toISOString";
|
|
447
374
|
var cStrEndsWith = "endsWith";
|
|
448
375
|
var strIndexOf = "indexOf";
|
|
@@ -452,7 +379,7 @@
|
|
|
452
379
|
var strToString = "toString";
|
|
453
380
|
var str__Proto = "__proto__";
|
|
454
381
|
var strConstructor = "constructor";
|
|
455
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
382
|
+
var _objDefineProperty$1 = ObjDefineProperty;
|
|
456
383
|
var _objFreeze = ObjClass.freeze;
|
|
457
384
|
var _objKeys = ObjClass.keys;
|
|
458
385
|
var StringProto = String[strShimPrototype];
|
|
@@ -501,25 +428,6 @@
|
|
|
501
428
|
function isFunction(value) {
|
|
502
429
|
return !!(value && typeof value === strShimFunction);
|
|
503
430
|
}
|
|
504
|
-
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
505
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
506
|
-
var result = false;
|
|
507
|
-
if (!isNullOrUndefined(obj)) {
|
|
508
|
-
try {
|
|
509
|
-
if (!isNullOrUndefined(obj[strAddEventHelper])) {
|
|
510
|
-
obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
|
|
511
|
-
result = true;
|
|
512
|
-
}
|
|
513
|
-
else if (!isNullOrUndefined(obj[strAttachEvent])) {
|
|
514
|
-
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
515
|
-
result = true;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
catch (e) {
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
return result;
|
|
522
|
-
}
|
|
523
431
|
function normalizeJsName(name) {
|
|
524
432
|
var value = name;
|
|
525
433
|
if (value && isString(value)) {
|
|
@@ -751,7 +659,7 @@
|
|
|
751
659
|
return result;
|
|
752
660
|
}
|
|
753
661
|
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
754
|
-
if (_objDefineProperty) {
|
|
662
|
+
if (_objDefineProperty$1) {
|
|
755
663
|
try {
|
|
756
664
|
var descriptor = {
|
|
757
665
|
enumerable: true,
|
|
@@ -763,7 +671,7 @@
|
|
|
763
671
|
if (setProp) {
|
|
764
672
|
descriptor.set = setProp;
|
|
765
673
|
}
|
|
766
|
-
_objDefineProperty(target, prop, descriptor);
|
|
674
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
767
675
|
return true;
|
|
768
676
|
}
|
|
769
677
|
catch (e) {
|
|
@@ -783,7 +691,7 @@
|
|
|
783
691
|
if (isError(object)) {
|
|
784
692
|
return object.name;
|
|
785
693
|
}
|
|
786
|
-
return
|
|
694
|
+
return strEmpty$1;
|
|
787
695
|
}
|
|
788
696
|
function setValue(target, field, value, valChk, srcChk) {
|
|
789
697
|
var theValue = value;
|
|
@@ -900,6 +808,17 @@
|
|
|
900
808
|
return class_1;
|
|
901
809
|
}());
|
|
902
810
|
}
|
|
811
|
+
function createEnumStyle(values) {
|
|
812
|
+
var enumClass = {};
|
|
813
|
+
objForEachKey(values, function (field, value) {
|
|
814
|
+
enumClass[field] = value;
|
|
815
|
+
if (!isUndefined(enumClass[value])) {
|
|
816
|
+
throwError("[" + value + "] exists for " + field);
|
|
817
|
+
}
|
|
818
|
+
enumClass[value] = field;
|
|
819
|
+
});
|
|
820
|
+
return objFreeze(enumClass);
|
|
821
|
+
}
|
|
903
822
|
function optimizeObject(theObject) {
|
|
904
823
|
if (theObject && ObjAssign) {
|
|
905
824
|
theObject = ObjClass(ObjAssign({}, theObject));
|
|
@@ -1089,7 +1008,7 @@
|
|
|
1089
1008
|
var nav = getNavigator();
|
|
1090
1009
|
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
1091
1010
|
_navUserAgentCheck = nav.userAgent;
|
|
1092
|
-
var userAgent = (_navUserAgentCheck ||
|
|
1011
|
+
var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
|
|
1093
1012
|
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
1094
1013
|
}
|
|
1095
1014
|
return _isTrident;
|
|
@@ -1098,9 +1017,9 @@
|
|
|
1098
1017
|
if (userAgentStr === void 0) { userAgentStr = null; }
|
|
1099
1018
|
if (!userAgentStr) {
|
|
1100
1019
|
var navigator_1 = getNavigator() || {};
|
|
1101
|
-
userAgentStr = navigator_1 ? (navigator_1.userAgent ||
|
|
1020
|
+
userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty$1).toLowerCase() : strEmpty$1;
|
|
1102
1021
|
}
|
|
1103
|
-
var ua = (userAgentStr ||
|
|
1022
|
+
var ua = (userAgentStr || strEmpty$1).toLowerCase();
|
|
1104
1023
|
if (strContains(ua, strMsie)) {
|
|
1105
1024
|
var doc = getDocument() || {};
|
|
1106
1025
|
return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
|
|
@@ -1115,7 +1034,7 @@
|
|
|
1115
1034
|
}
|
|
1116
1035
|
function dumpObj(object) {
|
|
1117
1036
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
1118
|
-
var propertyValueDump =
|
|
1037
|
+
var propertyValueDump = strEmpty$1;
|
|
1119
1038
|
if (objectTypeDump === "[object Error]") {
|
|
1120
1039
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
1121
1040
|
}
|
|
@@ -1209,9 +1128,9 @@
|
|
|
1209
1128
|
var strWarnToConsole = "warnToConsole";
|
|
1210
1129
|
function _sanitizeDiagnosticText(text) {
|
|
1211
1130
|
if (text) {
|
|
1212
|
-
return "\"" + text.replace(/\"/g,
|
|
1131
|
+
return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
|
|
1213
1132
|
}
|
|
1214
|
-
return
|
|
1133
|
+
return strEmpty$1;
|
|
1215
1134
|
}
|
|
1216
1135
|
function _logToConsole(func, message) {
|
|
1217
1136
|
var theConsole = getConsole();
|
|
@@ -1233,12 +1152,12 @@
|
|
|
1233
1152
|
_self.message =
|
|
1234
1153
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
1235
1154
|
msgId;
|
|
1236
|
-
var strProps =
|
|
1155
|
+
var strProps = strEmpty$1;
|
|
1237
1156
|
if (hasJSON()) {
|
|
1238
1157
|
strProps = getJSON().stringify(properties);
|
|
1239
1158
|
}
|
|
1240
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
1241
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
1159
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
|
|
1160
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
|
|
1242
1161
|
_self.message += diagnosticText;
|
|
1243
1162
|
}
|
|
1244
1163
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -1268,7 +1187,7 @@
|
|
|
1268
1187
|
throw message;
|
|
1269
1188
|
}
|
|
1270
1189
|
else {
|
|
1271
|
-
var logFunc = severity ===
|
|
1190
|
+
var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
|
|
1272
1191
|
if (!isUndefined(message.message)) {
|
|
1273
1192
|
var logLevel = _self.consoleLoggingLevel();
|
|
1274
1193
|
if (isUserAct) {
|
|
@@ -1286,7 +1205,7 @@
|
|
|
1286
1205
|
_self.logInternalMessage(severity, message);
|
|
1287
1206
|
}
|
|
1288
1207
|
else {
|
|
1289
|
-
_debugExtMsg("throw" + (severity ===
|
|
1208
|
+
_debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
|
|
1290
1209
|
}
|
|
1291
1210
|
}
|
|
1292
1211
|
};
|
|
@@ -1318,13 +1237,13 @@
|
|
|
1318
1237
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
1319
1238
|
_self.queue.push(message);
|
|
1320
1239
|
_messageCount++;
|
|
1321
|
-
_debugExtMsg((severity ===
|
|
1240
|
+
_debugExtMsg((severity === 1 ? "error" : "warn"), message);
|
|
1322
1241
|
}
|
|
1323
1242
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
1324
1243
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
1325
|
-
var throttleMessage = new _InternalLogMessage(
|
|
1244
|
+
var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
|
|
1326
1245
|
_self.queue.push(throttleMessage);
|
|
1327
|
-
if (severity ===
|
|
1246
|
+
if (severity === 1 ) {
|
|
1328
1247
|
_self.errorToConsole(throttleLimitMessage);
|
|
1329
1248
|
}
|
|
1330
1249
|
else {
|
|
@@ -1498,6 +1417,217 @@
|
|
|
1498
1417
|
return _defaultPerfManager;
|
|
1499
1418
|
}
|
|
1500
1419
|
|
|
1420
|
+
var UInt32Mask = 0x100000000;
|
|
1421
|
+
var MaxUInt32 = 0xffffffff;
|
|
1422
|
+
var _mwcSeeded = false;
|
|
1423
|
+
var _mwcW = 123456789;
|
|
1424
|
+
var _mwcZ = 987654321;
|
|
1425
|
+
function _mwcSeed(seedValue) {
|
|
1426
|
+
if (seedValue < 0) {
|
|
1427
|
+
seedValue >>>= 0;
|
|
1428
|
+
}
|
|
1429
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
1430
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
1431
|
+
_mwcSeeded = true;
|
|
1432
|
+
}
|
|
1433
|
+
function _autoSeedMwc() {
|
|
1434
|
+
try {
|
|
1435
|
+
var now = dateNow() & 0x7fffffff;
|
|
1436
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
1437
|
+
}
|
|
1438
|
+
catch (e) {
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
function randomValue(maxValue) {
|
|
1442
|
+
if (maxValue > 0) {
|
|
1443
|
+
return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
|
|
1444
|
+
}
|
|
1445
|
+
return 0;
|
|
1446
|
+
}
|
|
1447
|
+
function random32(signed) {
|
|
1448
|
+
var value = 0;
|
|
1449
|
+
var c = getCrypto() || getMsCrypto();
|
|
1450
|
+
if (c && c.getRandomValues) {
|
|
1451
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1452
|
+
}
|
|
1453
|
+
if (value === 0 && isIE()) {
|
|
1454
|
+
if (!_mwcSeeded) {
|
|
1455
|
+
_autoSeedMwc();
|
|
1456
|
+
}
|
|
1457
|
+
value = mwcRandom32() & MaxUInt32;
|
|
1458
|
+
}
|
|
1459
|
+
if (value === 0) {
|
|
1460
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1461
|
+
}
|
|
1462
|
+
if (!signed) {
|
|
1463
|
+
value >>>= 0;
|
|
1464
|
+
}
|
|
1465
|
+
return value;
|
|
1466
|
+
}
|
|
1467
|
+
function mwcRandomSeed(value) {
|
|
1468
|
+
if (!value) {
|
|
1469
|
+
_autoSeedMwc();
|
|
1470
|
+
}
|
|
1471
|
+
else {
|
|
1472
|
+
_mwcSeed(value);
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
function mwcRandom32(signed) {
|
|
1476
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1477
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1478
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1479
|
+
if (!signed) {
|
|
1480
|
+
value >>>= 0;
|
|
1481
|
+
}
|
|
1482
|
+
return value;
|
|
1483
|
+
}
|
|
1484
|
+
function newId(maxLength) {
|
|
1485
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1486
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1487
|
+
var number = random32() >>> 0;
|
|
1488
|
+
var chars = 0;
|
|
1489
|
+
var result = strEmpty$1;
|
|
1490
|
+
while (result.length < maxLength) {
|
|
1491
|
+
chars++;
|
|
1492
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1493
|
+
number >>>= 6;
|
|
1494
|
+
if (chars === 5) {
|
|
1495
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1496
|
+
chars = 0;
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
return result;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
1503
|
+
var version = "2.7.3";
|
|
1504
|
+
var instanceName = "." + newId(6);
|
|
1505
|
+
var _dataUid = 0;
|
|
1506
|
+
function _createAccessor(target, prop, value) {
|
|
1507
|
+
if (_objDefineProperty) {
|
|
1508
|
+
try {
|
|
1509
|
+
_objDefineProperty(target, prop, {
|
|
1510
|
+
value: value,
|
|
1511
|
+
enumerable: false,
|
|
1512
|
+
configurable: true
|
|
1513
|
+
});
|
|
1514
|
+
return true;
|
|
1515
|
+
}
|
|
1516
|
+
catch (e) {
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
return false;
|
|
1520
|
+
}
|
|
1521
|
+
function _canAcceptData(target) {
|
|
1522
|
+
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1523
|
+
}
|
|
1524
|
+
function _getCache(data, target) {
|
|
1525
|
+
var theCache = target[data.id];
|
|
1526
|
+
if (!theCache) {
|
|
1527
|
+
theCache = {};
|
|
1528
|
+
try {
|
|
1529
|
+
if (_canAcceptData(target)) {
|
|
1530
|
+
if (!_createAccessor(target, data.id, theCache)) {
|
|
1531
|
+
target[data.id] = theCache;
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
catch (e) {
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
return theCache;
|
|
1539
|
+
}
|
|
1540
|
+
function createUniqueNamespace(name, includeVersion) {
|
|
1541
|
+
if (includeVersion === void 0) { includeVersion = false; }
|
|
1542
|
+
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1543
|
+
}
|
|
1544
|
+
function createElmNodeData(name) {
|
|
1545
|
+
var data = {
|
|
1546
|
+
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1547
|
+
accept: function (target) {
|
|
1548
|
+
return _canAcceptData(target);
|
|
1549
|
+
},
|
|
1550
|
+
get: function (target, name, defValue, addDefault) {
|
|
1551
|
+
var theCache = target[data.id];
|
|
1552
|
+
if (!theCache) {
|
|
1553
|
+
if (addDefault) {
|
|
1554
|
+
theCache = _getCache(data, target);
|
|
1555
|
+
theCache[normalizeJsName(name)] = defValue;
|
|
1556
|
+
}
|
|
1557
|
+
return defValue;
|
|
1558
|
+
}
|
|
1559
|
+
return theCache[normalizeJsName(name)];
|
|
1560
|
+
},
|
|
1561
|
+
kill: function (target, name) {
|
|
1562
|
+
if (target && target[name]) {
|
|
1563
|
+
try {
|
|
1564
|
+
delete target[name];
|
|
1565
|
+
}
|
|
1566
|
+
catch (e) {
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
return data;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1575
|
+
function _getPluginState(plugin) {
|
|
1576
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1577
|
+
}
|
|
1578
|
+
function initializePlugins(processContext, extensions) {
|
|
1579
|
+
var initPlugins = [];
|
|
1580
|
+
var lastPlugin = null;
|
|
1581
|
+
var proxy = processContext.getNext();
|
|
1582
|
+
var pluginState;
|
|
1583
|
+
while (proxy) {
|
|
1584
|
+
var thePlugin = proxy.getPlugin();
|
|
1585
|
+
if (thePlugin) {
|
|
1586
|
+
if (lastPlugin &&
|
|
1587
|
+
isFunction(lastPlugin[strSetNextPlugin]) &&
|
|
1588
|
+
isFunction(thePlugin[strProcessTelemetry])) {
|
|
1589
|
+
lastPlugin[strSetNextPlugin](thePlugin);
|
|
1590
|
+
}
|
|
1591
|
+
var isInitialized = false;
|
|
1592
|
+
if (isFunction(thePlugin[strIsInitialized])) {
|
|
1593
|
+
isInitialized = thePlugin[strIsInitialized]();
|
|
1594
|
+
}
|
|
1595
|
+
else {
|
|
1596
|
+
pluginState = _getPluginState(thePlugin);
|
|
1597
|
+
isInitialized = pluginState[strIsInitialized];
|
|
1598
|
+
}
|
|
1599
|
+
if (!isInitialized) {
|
|
1600
|
+
initPlugins.push(thePlugin);
|
|
1601
|
+
}
|
|
1602
|
+
lastPlugin = thePlugin;
|
|
1603
|
+
proxy = proxy.getNext();
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
arrForEach(initPlugins, function (thePlugin) {
|
|
1607
|
+
var core = processContext.core();
|
|
1608
|
+
thePlugin.initialize(processContext.getCfg(), core, extensions, processContext.getNext());
|
|
1609
|
+
pluginState = _getPluginState(thePlugin);
|
|
1610
|
+
if (!thePlugin[strCore] && !pluginState[strCore]) {
|
|
1611
|
+
pluginState[strCore] = core;
|
|
1612
|
+
}
|
|
1613
|
+
pluginState[strIsInitialized] = true;
|
|
1614
|
+
delete pluginState[strTeardown];
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1617
|
+
function sortPlugins(plugins) {
|
|
1618
|
+
return plugins.sort(function (extA, extB) {
|
|
1619
|
+
var result = 0;
|
|
1620
|
+
var bHasProcess = isFunction(extB[strProcessTelemetry]);
|
|
1621
|
+
if (isFunction(extA[strProcessTelemetry])) {
|
|
1622
|
+
result = bHasProcess ? extA[strPriority] - extB[strPriority] : 1;
|
|
1623
|
+
}
|
|
1624
|
+
else if (bHasProcess) {
|
|
1625
|
+
result = -1;
|
|
1626
|
+
}
|
|
1627
|
+
return result;
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1501
1631
|
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1502
1632
|
var strHasRunFlags = "_hasRun";
|
|
1503
1633
|
var strGetTelCtx = "_getTelCtx";
|
|
@@ -1511,53 +1641,69 @@
|
|
|
1511
1641
|
}
|
|
1512
1642
|
return createTelemetryProxyChain([startAt], config, core);
|
|
1513
1643
|
}
|
|
1514
|
-
function
|
|
1644
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1515
1645
|
var _nextProxy = null;
|
|
1516
|
-
var _onComplete =
|
|
1517
|
-
if (startAt) {
|
|
1518
|
-
_nextProxy = _getNextProxyStart(telemetryChain, config, core, startAt);
|
|
1519
|
-
}
|
|
1520
|
-
else {
|
|
1521
|
-
_nextProxy = telemetryChain;
|
|
1646
|
+
var _onComplete = [];
|
|
1647
|
+
if (startAt !== null) {
|
|
1648
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1522
1649
|
}
|
|
1523
1650
|
var context = {
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1651
|
+
_next: _moveNext,
|
|
1652
|
+
ctx: {
|
|
1653
|
+
core: function () { return core; },
|
|
1654
|
+
diagLog: function () {
|
|
1655
|
+
return safeGetLogger(core, config);
|
|
1656
|
+
},
|
|
1657
|
+
getCfg: function () {
|
|
1658
|
+
return config;
|
|
1659
|
+
},
|
|
1660
|
+
getExtCfg: _getExtCfg,
|
|
1661
|
+
getConfig: _getConfig,
|
|
1662
|
+
hasNext: function () {
|
|
1663
|
+
return !!_nextProxy;
|
|
1664
|
+
},
|
|
1665
|
+
getNext: function () {
|
|
1666
|
+
return _nextProxy;
|
|
1667
|
+
},
|
|
1668
|
+
setNext: function (nextPlugin) {
|
|
1669
|
+
_nextProxy = nextPlugin;
|
|
1670
|
+
},
|
|
1671
|
+
iterate: _iterateChain,
|
|
1672
|
+
onComplete: _addOnComplete
|
|
1673
|
+
}
|
|
1674
|
+
};
|
|
1675
|
+
function _addOnComplete(onComplete, that) {
|
|
1676
|
+
var args = [];
|
|
1677
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1678
|
+
args[_i - 2] = arguments[_i];
|
|
1679
|
+
}
|
|
1680
|
+
if (onComplete) {
|
|
1681
|
+
_onComplete.push({
|
|
1682
|
+
func: onComplete,
|
|
1683
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1684
|
+
args: args
|
|
1547
1685
|
});
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
function _moveNext() {
|
|
1689
|
+
var nextProxy = _nextProxy;
|
|
1690
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1691
|
+
if (!nextProxy) {
|
|
1692
|
+
var onComplete = _onComplete;
|
|
1693
|
+
if (onComplete && onComplete.length > 0) {
|
|
1694
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
1695
|
+
try {
|
|
1696
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1697
|
+
}
|
|
1698
|
+
catch (e) {
|
|
1699
|
+
core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1700
|
+
}
|
|
1701
|
+
});
|
|
1702
|
+
_onComplete = [];
|
|
1554
1703
|
}
|
|
1555
|
-
return createProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1556
|
-
},
|
|
1557
|
-
onComplete: function (onComplete) {
|
|
1558
|
-
_onComplete = onComplete;
|
|
1559
1704
|
}
|
|
1560
|
-
|
|
1705
|
+
return nextProxy;
|
|
1706
|
+
}
|
|
1561
1707
|
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1562
1708
|
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1563
1709
|
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
@@ -1600,29 +1746,53 @@
|
|
|
1600
1746
|
}
|
|
1601
1747
|
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1602
1748
|
}
|
|
1603
|
-
function
|
|
1604
|
-
var nextPlugin
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
else {
|
|
1610
|
-
if (_onComplete) {
|
|
1611
|
-
_onComplete();
|
|
1612
|
-
_onComplete = null;
|
|
1749
|
+
function _iterateChain(cb) {
|
|
1750
|
+
var nextPlugin;
|
|
1751
|
+
while (!!(nextPlugin = context._next())) {
|
|
1752
|
+
var plugin = nextPlugin.getPlugin();
|
|
1753
|
+
if (plugin) {
|
|
1754
|
+
cb(plugin);
|
|
1613
1755
|
}
|
|
1614
1756
|
}
|
|
1615
1757
|
}
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1758
|
+
return context;
|
|
1759
|
+
}
|
|
1760
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1761
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1762
|
+
var context = internalContext.ctx;
|
|
1763
|
+
function _processNext(env) {
|
|
1764
|
+
var nextPlugin = internalContext._next();
|
|
1765
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1766
|
+
return !nextPlugin;
|
|
1767
|
+
}
|
|
1768
|
+
function _createNew(plugins, startAt) {
|
|
1769
|
+
if (plugins === void 0) { plugins = null; }
|
|
1770
|
+
if (isArray(plugins)) {
|
|
1771
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1772
|
+
}
|
|
1773
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1774
|
+
}
|
|
1775
|
+
context.processNext = _processNext;
|
|
1776
|
+
context.createNew = _createNew;
|
|
1777
|
+
return context;
|
|
1778
|
+
}
|
|
1779
|
+
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1780
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1781
|
+
var context = internalContext.ctx;
|
|
1782
|
+
function _processNext(unloadState) {
|
|
1783
|
+
var nextPlugin = internalContext._next();
|
|
1784
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1785
|
+
return !nextPlugin;
|
|
1786
|
+
}
|
|
1787
|
+
function _createNew(plugins, startAt) {
|
|
1788
|
+
if (plugins === void 0) { plugins = null; }
|
|
1789
|
+
if (isArray(plugins)) {
|
|
1790
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1624
1791
|
}
|
|
1792
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1625
1793
|
}
|
|
1794
|
+
context.processNext = _processNext;
|
|
1795
|
+
context.createNew = _createNew;
|
|
1626
1796
|
return context;
|
|
1627
1797
|
}
|
|
1628
1798
|
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
@@ -1670,32 +1840,35 @@
|
|
|
1670
1840
|
return nextProxy;
|
|
1671
1841
|
},
|
|
1672
1842
|
processTelemetry: _processTelemetry,
|
|
1843
|
+
unload: _unloadPlugin,
|
|
1673
1844
|
_id: chainId,
|
|
1674
1845
|
_setNext: function (nextPlugin) {
|
|
1675
1846
|
nextProxy = nextPlugin;
|
|
1676
1847
|
}
|
|
1677
1848
|
};
|
|
1678
|
-
function
|
|
1849
|
+
function _getTelCtx() {
|
|
1850
|
+
var itemCtx;
|
|
1851
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1852
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1853
|
+
}
|
|
1679
1854
|
if (!itemCtx) {
|
|
1680
|
-
|
|
1681
|
-
itemCtx = plugin[strGetTelCtx]();
|
|
1682
|
-
}
|
|
1683
|
-
if (!itemCtx) {
|
|
1684
|
-
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1685
|
-
}
|
|
1855
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1686
1856
|
}
|
|
1857
|
+
return itemCtx;
|
|
1858
|
+
}
|
|
1859
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1860
|
+
var hasRun = false;
|
|
1687
1861
|
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1688
1862
|
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1689
1863
|
if (!hasRunContext) {
|
|
1690
1864
|
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1691
1865
|
}
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
if (plugin) {
|
|
1866
|
+
itemCtx.setNext(nextProxy);
|
|
1867
|
+
if (plugin) {
|
|
1868
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1869
|
+
hasRunContext[chainId] = true;
|
|
1697
1870
|
try {
|
|
1698
|
-
var nextId = nextProxy ? nextProxy._id :
|
|
1871
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty$1;
|
|
1699
1872
|
if (nextId) {
|
|
1700
1873
|
hasRunContext[nextId] = false;
|
|
1701
1874
|
}
|
|
@@ -1707,18 +1880,21 @@
|
|
|
1707
1880
|
hasRun = true;
|
|
1708
1881
|
}
|
|
1709
1882
|
if (!nextProxy || !hasNextRun) {
|
|
1710
|
-
itemCtx.diagLog().throwInternal(
|
|
1883
|
+
itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1711
1884
|
}
|
|
1712
1885
|
}
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
}
|
|
1717
|
-
}, details, isAsync);
|
|
1886
|
+
}, details, isAsync);
|
|
1887
|
+
}
|
|
1888
|
+
return hasRun;
|
|
1718
1889
|
}
|
|
1719
1890
|
function _processTelemetry(env, itemCtx) {
|
|
1720
|
-
|
|
1721
|
-
|
|
1891
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
1892
|
+
function _callProcessTelemetry(itemCtx) {
|
|
1893
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
1894
|
+
return false;
|
|
1895
|
+
}
|
|
1896
|
+
var pluginState = _getPluginState(plugin);
|
|
1897
|
+
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
1722
1898
|
return false;
|
|
1723
1899
|
}
|
|
1724
1900
|
if (hasSetNext) {
|
|
@@ -1726,52 +1902,33 @@
|
|
|
1726
1902
|
}
|
|
1727
1903
|
plugin.processTelemetry(env, itemCtx);
|
|
1728
1904
|
return true;
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
}
|
|
1733
|
-
return objFreeze(proxyChain);
|
|
1734
|
-
}
|
|
1735
|
-
|
|
1736
|
-
var processTelemetry = "processTelemetry";
|
|
1737
|
-
var priority = "priority";
|
|
1738
|
-
var setNextPlugin = "setNextPlugin";
|
|
1739
|
-
var isInitialized = "isInitialized";
|
|
1740
|
-
function initializePlugins(processContext, extensions) {
|
|
1741
|
-
var initPlugins = [];
|
|
1742
|
-
var lastPlugin = null;
|
|
1743
|
-
var proxy = processContext.getNext();
|
|
1744
|
-
while (proxy) {
|
|
1745
|
-
var thePlugin = proxy.getPlugin();
|
|
1746
|
-
if (thePlugin) {
|
|
1747
|
-
if (lastPlugin &&
|
|
1748
|
-
isFunction(lastPlugin[setNextPlugin]) &&
|
|
1749
|
-
isFunction(thePlugin[processTelemetry])) {
|
|
1750
|
-
lastPlugin[setNextPlugin](thePlugin);
|
|
1751
|
-
}
|
|
1752
|
-
if (!isFunction(thePlugin[isInitialized]) || !thePlugin[isInitialized]()) {
|
|
1753
|
-
initPlugins.push(thePlugin);
|
|
1754
|
-
}
|
|
1755
|
-
lastPlugin = thePlugin;
|
|
1756
|
-
proxy = proxy.getNext();
|
|
1905
|
+
}
|
|
1906
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1907
|
+
itemCtx.processNext(env);
|
|
1757
1908
|
}
|
|
1758
1909
|
}
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1910
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1911
|
+
function _callTeardown() {
|
|
1912
|
+
var hasRun = false;
|
|
1913
|
+
if (plugin) {
|
|
1914
|
+
var pluginState = _getPluginState(plugin);
|
|
1915
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1916
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1917
|
+
pluginState[strCore] = null;
|
|
1918
|
+
pluginState[strTeardown] = true;
|
|
1919
|
+
pluginState[strIsInitialized] = false;
|
|
1920
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1921
|
+
hasRun = true;
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
return hasRun;
|
|
1769
1926
|
}
|
|
1770
|
-
|
|
1771
|
-
|
|
1927
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1928
|
+
unloadCtx.processNext(unloadState);
|
|
1772
1929
|
}
|
|
1773
|
-
|
|
1774
|
-
|
|
1930
|
+
}
|
|
1931
|
+
return objFreeze(proxyChain);
|
|
1775
1932
|
}
|
|
1776
1933
|
|
|
1777
1934
|
var strToGMTString = "toGMTString";
|
|
@@ -1782,7 +1939,6 @@
|
|
|
1782
1939
|
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
1783
1940
|
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
1784
1941
|
var strConfigCookieMgr = "_ckMgr";
|
|
1785
|
-
var strEmpty = "";
|
|
1786
1942
|
var _supportsCookies = null;
|
|
1787
1943
|
var _allowUaSameSite = null;
|
|
1788
1944
|
var _parsedCookieValue = null;
|
|
@@ -1859,7 +2015,7 @@
|
|
|
1859
2015
|
var result = false;
|
|
1860
2016
|
if (_isMgrEnabled(cookieMgr)) {
|
|
1861
2017
|
var values = {};
|
|
1862
|
-
var theValue = strTrim(value || strEmpty);
|
|
2018
|
+
var theValue = strTrim(value || strEmpty$1);
|
|
1863
2019
|
var idx = theValue.indexOf(";");
|
|
1864
2020
|
if (idx !== -1) {
|
|
1865
2021
|
theValue = strTrim(value.substring(0, idx));
|
|
@@ -1874,11 +2030,11 @@
|
|
|
1874
2030
|
if (expireMs > 0) {
|
|
1875
2031
|
var expiry = new Date();
|
|
1876
2032
|
expiry.setTime(expireMs);
|
|
1877
|
-
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
|
|
2033
|
+
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty$1, isTruthy);
|
|
1878
2034
|
}
|
|
1879
2035
|
}
|
|
1880
2036
|
if (!_isIE) {
|
|
1881
|
-
setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
|
|
2037
|
+
setValue(values, "max-age", strEmpty$1 + maxAgeSec, null, isUndefined);
|
|
1882
2038
|
}
|
|
1883
2039
|
}
|
|
1884
2040
|
var location_1 = getLocation();
|
|
@@ -1899,7 +2055,7 @@
|
|
|
1899
2055
|
return result;
|
|
1900
2056
|
},
|
|
1901
2057
|
get: function (name) {
|
|
1902
|
-
var value = strEmpty;
|
|
2058
|
+
var value = strEmpty$1;
|
|
1903
2059
|
if (_isMgrEnabled(cookieMgr)) {
|
|
1904
2060
|
value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
|
|
1905
2061
|
}
|
|
@@ -1924,7 +2080,7 @@
|
|
|
1924
2080
|
values["max-age"] = "0";
|
|
1925
2081
|
}
|
|
1926
2082
|
var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
|
|
1927
|
-
delCookie(name, _formatCookieValue(strEmpty, values));
|
|
2083
|
+
delCookie(name, _formatCookieValue(strEmpty$1, values));
|
|
1928
2084
|
result = true;
|
|
1929
2085
|
}
|
|
1930
2086
|
return result;
|
|
@@ -1941,7 +2097,7 @@
|
|
|
1941
2097
|
_supportsCookies = doc[strCookie] !== undefined;
|
|
1942
2098
|
}
|
|
1943
2099
|
catch (e) {
|
|
1944
|
-
logger && logger.throwInternal(
|
|
2100
|
+
logger && logger.throwInternal(2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1945
2101
|
}
|
|
1946
2102
|
}
|
|
1947
2103
|
return _supportsCookies;
|
|
@@ -1951,7 +2107,7 @@
|
|
|
1951
2107
|
if (theValue && theValue.length) {
|
|
1952
2108
|
var parts = strTrim(theValue).split(";");
|
|
1953
2109
|
arrForEach(parts, function (thePart) {
|
|
1954
|
-
thePart = strTrim(thePart || strEmpty);
|
|
2110
|
+
thePart = strTrim(thePart || strEmpty$1);
|
|
1955
2111
|
if (thePart) {
|
|
1956
2112
|
var idx = thePart.indexOf("=");
|
|
1957
2113
|
if (idx === -1) {
|
|
@@ -1972,21 +2128,21 @@
|
|
|
1972
2128
|
return null;
|
|
1973
2129
|
}
|
|
1974
2130
|
function _formatCookieValue(value, values) {
|
|
1975
|
-
var cookieValue = value || strEmpty;
|
|
2131
|
+
var cookieValue = value || strEmpty$1;
|
|
1976
2132
|
objForEachKey(values, function (name, theValue) {
|
|
1977
|
-
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
|
|
2133
|
+
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty$1);
|
|
1978
2134
|
});
|
|
1979
2135
|
return cookieValue;
|
|
1980
2136
|
}
|
|
1981
2137
|
function _getCookieValue(name) {
|
|
1982
|
-
var cookieValue = strEmpty;
|
|
2138
|
+
var cookieValue = strEmpty$1;
|
|
1983
2139
|
if (_doc) {
|
|
1984
|
-
var theCookie = _doc[strCookie] || strEmpty;
|
|
2140
|
+
var theCookie = _doc[strCookie] || strEmpty$1;
|
|
1985
2141
|
if (_parsedCookieValue !== theCookie) {
|
|
1986
2142
|
_cookieCache = _extractParts(theCookie);
|
|
1987
2143
|
_parsedCookieValue = theCookie;
|
|
1988
2144
|
}
|
|
1989
|
-
cookieValue = strTrim(_cookieCache[name] || strEmpty);
|
|
2145
|
+
cookieValue = strTrim(_cookieCache[name] || strEmpty$1);
|
|
1990
2146
|
}
|
|
1991
2147
|
return cookieValue;
|
|
1992
2148
|
}
|
|
@@ -2042,87 +2198,110 @@
|
|
|
2042
2198
|
}
|
|
2043
2199
|
}
|
|
2044
2200
|
function createChannelControllerPlugin(channelQueue, core) {
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2201
|
+
var _a;
|
|
2202
|
+
function _getTelCtx() {
|
|
2203
|
+
return createProcessTelemetryContext(null, core.config, core, null);
|
|
2204
|
+
}
|
|
2205
|
+
function _processChannelQueue(theChannels, itemCtx, processFn, onComplete) {
|
|
2206
|
+
var waiting = theChannels ? (theChannels.length + 1) : 1;
|
|
2207
|
+
function _runChainOnComplete() {
|
|
2208
|
+
waiting--;
|
|
2209
|
+
if (waiting === 0) {
|
|
2210
|
+
onComplete && onComplete();
|
|
2211
|
+
onComplete = null;
|
|
2212
|
+
}
|
|
2048
2213
|
}
|
|
2049
|
-
|
|
2214
|
+
if (waiting > 0) {
|
|
2215
|
+
arrForEach(theChannels, function (channels) {
|
|
2216
|
+
if (channels && channels.queue.length > 0) {
|
|
2217
|
+
var channelChain = channels.chain;
|
|
2218
|
+
var chainCtx = itemCtx.createNew(channelChain);
|
|
2219
|
+
chainCtx.onComplete(_runChainOnComplete);
|
|
2220
|
+
processFn(chainCtx);
|
|
2221
|
+
}
|
|
2222
|
+
else {
|
|
2223
|
+
waiting--;
|
|
2224
|
+
}
|
|
2225
|
+
});
|
|
2226
|
+
}
|
|
2227
|
+
_runChainOnComplete();
|
|
2228
|
+
}
|
|
2229
|
+
function _doTeardown(unloadCtx, unloadState) {
|
|
2230
|
+
var theUnloadState = unloadState || {
|
|
2231
|
+
reason: 0 ,
|
|
2232
|
+
isAsync: false
|
|
2233
|
+
};
|
|
2234
|
+
_processChannelQueue(channelQueue, unloadCtx, function (chainCtx) {
|
|
2235
|
+
chainCtx[strProcessNext](theUnloadState);
|
|
2236
|
+
}, function () {
|
|
2237
|
+
unloadCtx[strProcessNext](theUnloadState);
|
|
2238
|
+
isInitialized = false;
|
|
2239
|
+
});
|
|
2240
|
+
return true;
|
|
2050
2241
|
}
|
|
2051
|
-
function
|
|
2242
|
+
function _getChannel(pluginIdentifier) {
|
|
2243
|
+
var thePlugin = null;
|
|
2052
2244
|
if (channelQueue && channelQueue.length > 0) {
|
|
2053
|
-
var waiting_1 = channelQueue.length;
|
|
2054
2245
|
arrForEach(channelQueue, function (channels) {
|
|
2055
2246
|
if (channels && channels.queue.length > 0) {
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
if (waiting_1 === 0) {
|
|
2061
|
-
onComplete && onComplete();
|
|
2062
|
-
onComplete = null;
|
|
2247
|
+
arrForEach(channels.queue, function (ext) {
|
|
2248
|
+
if (ext.identifier === pluginIdentifier) {
|
|
2249
|
+
thePlugin = ext;
|
|
2250
|
+
return -1;
|
|
2063
2251
|
}
|
|
2064
2252
|
});
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
waiting_1--;
|
|
2253
|
+
if (thePlugin) {
|
|
2254
|
+
return -1;
|
|
2255
|
+
}
|
|
2069
2256
|
}
|
|
2070
2257
|
});
|
|
2071
|
-
if (waiting_1 === 0) {
|
|
2072
|
-
onComplete && onComplete();
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
else {
|
|
2076
|
-
onComplete && onComplete();
|
|
2077
2258
|
}
|
|
2259
|
+
return thePlugin;
|
|
2078
2260
|
}
|
|
2079
2261
|
var isInitialized = false;
|
|
2080
|
-
var channelController = {
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
});
|
|
2090
|
-
},
|
|
2091
|
-
isInitialized: function () { return isInitialized; },
|
|
2092
|
-
processTelemetry: function (item, itemCtx) {
|
|
2093
|
-
_processChannelQueue(itemCtx, function (chainCtx) {
|
|
2094
|
-
chainCtx.processNext(item);
|
|
2095
|
-
}, function () {
|
|
2096
|
-
itemCtx.processNext(item);
|
|
2097
|
-
});
|
|
2098
|
-
},
|
|
2099
|
-
pause: function () {
|
|
2100
|
-
_processChannelQueue(null, function (chainCtx) {
|
|
2101
|
-
chainCtx.iterate(function (plugin) {
|
|
2102
|
-
plugin.pause && plugin.pause();
|
|
2262
|
+
var channelController = (_a = {
|
|
2263
|
+
identifier: "ChannelControllerPlugin",
|
|
2264
|
+
priority: ChannelControllerPriority,
|
|
2265
|
+
initialize: function (config, core, extensions, pluginChain) {
|
|
2266
|
+
isInitialized = true;
|
|
2267
|
+
arrForEach(channelQueue, function (channels) {
|
|
2268
|
+
if (channels && channels.queue.length > 0) {
|
|
2269
|
+
initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);
|
|
2270
|
+
}
|
|
2103
2271
|
});
|
|
2104
|
-
}
|
|
2272
|
+
},
|
|
2273
|
+
isInitialized: function () { return isInitialized; },
|
|
2274
|
+
processTelemetry: function (item, itemCtx) {
|
|
2275
|
+
_processChannelQueue(channelQueue, itemCtx || _getTelCtx(), function (chainCtx) {
|
|
2276
|
+
chainCtx[strProcessNext](item);
|
|
2277
|
+
}, function () {
|
|
2278
|
+
itemCtx[strProcessNext](item);
|
|
2279
|
+
});
|
|
2280
|
+
}
|
|
2105
2281
|
},
|
|
2106
|
-
|
|
2107
|
-
_processChannelQueue(
|
|
2282
|
+
_a[strPause] = function () {
|
|
2283
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2108
2284
|
chainCtx.iterate(function (plugin) {
|
|
2109
|
-
plugin
|
|
2285
|
+
plugin[strPause] && plugin[strPause]();
|
|
2110
2286
|
});
|
|
2111
|
-
});
|
|
2287
|
+
}, null);
|
|
2112
2288
|
},
|
|
2113
|
-
|
|
2114
|
-
_processChannelQueue(
|
|
2289
|
+
_a[strResume] = function () {
|
|
2290
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2115
2291
|
chainCtx.iterate(function (plugin) {
|
|
2116
|
-
plugin
|
|
2292
|
+
plugin[strResume] && plugin[strResume]();
|
|
2117
2293
|
});
|
|
2118
|
-
});
|
|
2294
|
+
}, null);
|
|
2119
2295
|
},
|
|
2120
|
-
|
|
2296
|
+
_a[strTeardown] = _doTeardown,
|
|
2297
|
+
_a.getChannel = _getChannel,
|
|
2298
|
+
_a.flush = function (isAsync, callBack, sendReason, cbTimeout) {
|
|
2299
|
+
var waiting = 1;
|
|
2121
2300
|
var doneIterating = false;
|
|
2122
|
-
var waiting = 0;
|
|
2123
2301
|
var cbTimer = null;
|
|
2124
2302
|
cbTimeout = cbTimeout || 5000;
|
|
2125
2303
|
function doCallback() {
|
|
2304
|
+
waiting--;
|
|
2126
2305
|
if (doneIterating && waiting === 0) {
|
|
2127
2306
|
if (cbTimer) {
|
|
2128
2307
|
clearTimeout(cbTimer);
|
|
@@ -2132,32 +2311,38 @@
|
|
|
2132
2311
|
callBack = null;
|
|
2133
2312
|
}
|
|
2134
2313
|
}
|
|
2135
|
-
|
|
2136
|
-
_processChannelQueue(null, function (chainCtx) {
|
|
2314
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2137
2315
|
chainCtx.iterate(function (plugin) {
|
|
2138
2316
|
if (plugin.flush) {
|
|
2139
2317
|
waiting++;
|
|
2318
|
+
var handled_1 = false;
|
|
2140
2319
|
if (!plugin.flush(isAsync, function () {
|
|
2141
|
-
|
|
2320
|
+
handled_1 = true;
|
|
2142
2321
|
doCallback();
|
|
2143
2322
|
}, sendReason)) {
|
|
2144
|
-
if (
|
|
2145
|
-
cbTimer
|
|
2146
|
-
cbTimer =
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2323
|
+
if (!handled_1) {
|
|
2324
|
+
if (isAsync && cbTimer == null) {
|
|
2325
|
+
cbTimer = setTimeout(function () {
|
|
2326
|
+
cbTimer = null;
|
|
2327
|
+
doCallback();
|
|
2328
|
+
}, cbTimeout);
|
|
2329
|
+
}
|
|
2330
|
+
else {
|
|
2331
|
+
doCallback();
|
|
2332
|
+
}
|
|
2150
2333
|
}
|
|
2151
2334
|
}
|
|
2152
2335
|
}
|
|
2153
2336
|
});
|
|
2154
2337
|
}, function () {
|
|
2155
|
-
waiting--;
|
|
2156
2338
|
doneIterating = true;
|
|
2157
2339
|
doCallback();
|
|
2158
2340
|
});
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2341
|
+
},
|
|
2342
|
+
_a._setQueue = function (queue) {
|
|
2343
|
+
channelQueue = queue;
|
|
2344
|
+
},
|
|
2345
|
+
_a);
|
|
2161
2346
|
return channelController;
|
|
2162
2347
|
}
|
|
2163
2348
|
function createChannelQueues(channels, extensions, config, core) {
|
|
@@ -2177,6 +2362,30 @@
|
|
|
2177
2362
|
return channelQueue;
|
|
2178
2363
|
}
|
|
2179
2364
|
|
|
2365
|
+
function createUnloadHandlerContainer() {
|
|
2366
|
+
var handlers = [];
|
|
2367
|
+
function _addHandler(handler) {
|
|
2368
|
+
if (handler) {
|
|
2369
|
+
handlers.push(handler);
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
2373
|
+
arrForEach(handlers, function (handler) {
|
|
2374
|
+
try {
|
|
2375
|
+
handler(unloadCtx, unloadState);
|
|
2376
|
+
}
|
|
2377
|
+
catch (e) {
|
|
2378
|
+
unloadCtx.diagLog().throwInternal(2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
2379
|
+
}
|
|
2380
|
+
});
|
|
2381
|
+
handlers = [];
|
|
2382
|
+
}
|
|
2383
|
+
return {
|
|
2384
|
+
add: _addHandler,
|
|
2385
|
+
run: _runHandlers
|
|
2386
|
+
};
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2180
2389
|
var strGetPlugin = "getPlugin";
|
|
2181
2390
|
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
2182
2391
|
function BaseTelemetryPlugin() {
|
|
@@ -2184,6 +2393,7 @@
|
|
|
2184
2393
|
var _isinitialized;
|
|
2185
2394
|
var _rootCtx;
|
|
2186
2395
|
var _nextPlugin;
|
|
2396
|
+
var _unloadHandlerContainer;
|
|
2187
2397
|
var _hooks;
|
|
2188
2398
|
_initDefaults();
|
|
2189
2399
|
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
@@ -2191,6 +2401,39 @@
|
|
|
2191
2401
|
_setDefaults(config, core, pluginChain);
|
|
2192
2402
|
_isinitialized = true;
|
|
2193
2403
|
};
|
|
2404
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
2405
|
+
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
2406
|
+
return;
|
|
2407
|
+
}
|
|
2408
|
+
var result;
|
|
2409
|
+
var unloadDone = false;
|
|
2410
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
2411
|
+
var theUnloadState = unloadState || {
|
|
2412
|
+
reason: 0 ,
|
|
2413
|
+
isAsync: false
|
|
2414
|
+
};
|
|
2415
|
+
function _unloadCallback() {
|
|
2416
|
+
if (!unloadDone) {
|
|
2417
|
+
unloadDone = true;
|
|
2418
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
2419
|
+
arrForEach(_hooks, function (fn) {
|
|
2420
|
+
fn.rm();
|
|
2421
|
+
});
|
|
2422
|
+
_hooks = [];
|
|
2423
|
+
if (result === true) {
|
|
2424
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
2425
|
+
}
|
|
2426
|
+
_initDefaults();
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2429
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
2430
|
+
_unloadCallback();
|
|
2431
|
+
}
|
|
2432
|
+
else {
|
|
2433
|
+
result = true;
|
|
2434
|
+
}
|
|
2435
|
+
return result;
|
|
2436
|
+
};
|
|
2194
2437
|
_self._addHook = function (hooks) {
|
|
2195
2438
|
if (hooks) {
|
|
2196
2439
|
if (isArray(hooks)) {
|
|
@@ -2201,17 +2444,18 @@
|
|
|
2201
2444
|
}
|
|
2202
2445
|
}
|
|
2203
2446
|
};
|
|
2447
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
2204
2448
|
});
|
|
2205
2449
|
_self.diagLog = function (itemCtx) {
|
|
2206
2450
|
return _getTelCtx(itemCtx).diagLog();
|
|
2207
2451
|
};
|
|
2208
|
-
_self
|
|
2452
|
+
_self[strIsInitialized] = function () {
|
|
2209
2453
|
return _isinitialized;
|
|
2210
2454
|
};
|
|
2211
2455
|
_self.setInitialized = function (isInitialized) {
|
|
2212
2456
|
_isinitialized = isInitialized;
|
|
2213
2457
|
};
|
|
2214
|
-
_self
|
|
2458
|
+
_self[strSetNextPlugin] = function (next) {
|
|
2215
2459
|
_nextPlugin = next;
|
|
2216
2460
|
};
|
|
2217
2461
|
_self.processNext = function (env, itemCtx) {
|
|
@@ -2257,6 +2501,7 @@
|
|
|
2257
2501
|
_rootCtx = null;
|
|
2258
2502
|
_nextPlugin = null;
|
|
2259
2503
|
_hooks = [];
|
|
2504
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
2260
2505
|
}
|
|
2261
2506
|
}
|
|
2262
2507
|
return BaseTelemetryPlugin;
|
|
@@ -2303,7 +2548,7 @@
|
|
|
2303
2548
|
}
|
|
2304
2549
|
}
|
|
2305
2550
|
catch (e) {
|
|
2306
|
-
itemCtx.diagLog().throwInternal(
|
|
2551
|
+
itemCtx.diagLog().throwInternal(1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
|
|
2307
2552
|
}
|
|
2308
2553
|
}
|
|
2309
2554
|
}
|
|
@@ -2311,8 +2556,7 @@
|
|
|
2311
2556
|
_self.processNext(item, itemCtx);
|
|
2312
2557
|
}
|
|
2313
2558
|
};
|
|
2314
|
-
_self
|
|
2315
|
-
_base.unload(itemCtx, isAsync);
|
|
2559
|
+
_self[strDoTeardown] = function () {
|
|
2316
2560
|
_initDefaults();
|
|
2317
2561
|
};
|
|
2318
2562
|
});
|
|
@@ -2327,6 +2571,8 @@
|
|
|
2327
2571
|
|
|
2328
2572
|
var strValidationError = "Plugins must provide initialize method";
|
|
2329
2573
|
var strNotificationManager = "_notificationManager";
|
|
2574
|
+
var strSdkUnloadingError = "SDK is still unloading...";
|
|
2575
|
+
var strSdkNotInitialized = "SDK is not initialized";
|
|
2330
2576
|
function _createPerfManager(core, notificationMgr) {
|
|
2331
2577
|
return new PerfManager(notificationMgr);
|
|
2332
2578
|
}
|
|
@@ -2356,6 +2602,26 @@
|
|
|
2356
2602
|
core: coreExtensions
|
|
2357
2603
|
};
|
|
2358
2604
|
}
|
|
2605
|
+
function _isPluginPresent(thePlugin, plugins) {
|
|
2606
|
+
var exists = false;
|
|
2607
|
+
arrForEach(plugins, function (plugin) {
|
|
2608
|
+
if (plugin === thePlugin) {
|
|
2609
|
+
exists = true;
|
|
2610
|
+
return -1;
|
|
2611
|
+
}
|
|
2612
|
+
});
|
|
2613
|
+
return exists;
|
|
2614
|
+
}
|
|
2615
|
+
function _createDummyNotificationManager() {
|
|
2616
|
+
var _a;
|
|
2617
|
+
return objCreateFn((_a = {},
|
|
2618
|
+
_a[strAddNotificationListener] = function (listener) { },
|
|
2619
|
+
_a[strRemoveNotificationListener] = function (listener) { },
|
|
2620
|
+
_a[strEventsSent] = function (events) { },
|
|
2621
|
+
_a[strEventsDiscarded] = function (events, reason) { },
|
|
2622
|
+
_a[strEventsSendRequest] = function (sendReason, isAsync) { },
|
|
2623
|
+
_a));
|
|
2624
|
+
}
|
|
2359
2625
|
var BaseCore = /** @class */ (function () {
|
|
2360
2626
|
function BaseCore() {
|
|
2361
2627
|
var _isInitialized;
|
|
@@ -2370,14 +2636,20 @@
|
|
|
2370
2636
|
var _channelControl;
|
|
2371
2637
|
var _channelConfig;
|
|
2372
2638
|
var _channelQueue;
|
|
2639
|
+
var _isUnloading;
|
|
2373
2640
|
var _telemetryInitializerPlugin;
|
|
2374
2641
|
var _internalLogsEventName;
|
|
2642
|
+
var _evtNamespace;
|
|
2643
|
+
var _unloadHandlers;
|
|
2375
2644
|
var _debugListener;
|
|
2376
2645
|
var _internalLogPoller = 0;
|
|
2377
2646
|
dynamicProto(BaseCore, this, function (_self) {
|
|
2378
2647
|
_initDefaults();
|
|
2379
2648
|
_self.isInitialized = function () { return _isInitialized; };
|
|
2380
2649
|
_self.initialize = function (config, extensions, logger, notificationManager) {
|
|
2650
|
+
if (_isUnloading) {
|
|
2651
|
+
throwError(strSdkUnloadingError);
|
|
2652
|
+
}
|
|
2381
2653
|
if (_self.isInitialized()) {
|
|
2382
2654
|
throwError("Core should not be initialized more than once");
|
|
2383
2655
|
}
|
|
@@ -2390,8 +2662,7 @@
|
|
|
2390
2662
|
_initDebugListener(config);
|
|
2391
2663
|
_initPerfManager(config);
|
|
2392
2664
|
config.extensions = isNullOrUndefined(config.extensions) ? [] : config.extensions;
|
|
2393
|
-
|
|
2394
|
-
extConfig.NotificationManager = notificationManager;
|
|
2665
|
+
_initExtConfig(config);
|
|
2395
2666
|
if (logger) {
|
|
2396
2667
|
_self.logger = logger;
|
|
2397
2668
|
}
|
|
@@ -2416,37 +2687,29 @@
|
|
|
2416
2687
|
setValue(telemetryItem, strIKey, _self.config.instrumentationKey, null, isNotTruthy);
|
|
2417
2688
|
setValue(telemetryItem, "time", toISOString(new Date()), null, isNotTruthy);
|
|
2418
2689
|
setValue(telemetryItem, "ver", "4.0", null, isNullOrUndefined);
|
|
2419
|
-
if (_self.isInitialized()) {
|
|
2420
|
-
|
|
2690
|
+
if (!_isUnloading && _self.isInitialized()) {
|
|
2691
|
+
_createTelCtx().processNext(telemetryItem);
|
|
2421
2692
|
}
|
|
2422
2693
|
else {
|
|
2423
2694
|
_eventQueue.push(telemetryItem);
|
|
2424
2695
|
}
|
|
2425
2696
|
};
|
|
2426
|
-
_self.getProcessTelContext =
|
|
2427
|
-
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
2428
|
-
};
|
|
2697
|
+
_self.getProcessTelContext = _createTelCtx;
|
|
2429
2698
|
_self.getNotifyMgr = function () {
|
|
2430
2699
|
if (!_notificationManager) {
|
|
2431
|
-
_notificationManager =
|
|
2432
|
-
addNotificationListener: function (listener) { },
|
|
2433
|
-
removeNotificationListener: function (listener) { },
|
|
2434
|
-
eventsSent: function (events) { },
|
|
2435
|
-
eventsDiscarded: function (events, reason) { },
|
|
2436
|
-
eventsSendRequest: function (sendReason, isAsync) { }
|
|
2437
|
-
});
|
|
2700
|
+
_notificationManager = _createDummyNotificationManager();
|
|
2438
2701
|
_self[strNotificationManager] = _notificationManager;
|
|
2439
2702
|
}
|
|
2440
2703
|
return _notificationManager;
|
|
2441
2704
|
};
|
|
2442
|
-
_self
|
|
2705
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2443
2706
|
if (_notificationManager) {
|
|
2444
|
-
_notificationManager
|
|
2707
|
+
_notificationManager[strAddNotificationListener](listener);
|
|
2445
2708
|
}
|
|
2446
2709
|
};
|
|
2447
|
-
_self
|
|
2710
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2448
2711
|
if (_notificationManager) {
|
|
2449
|
-
_notificationManager
|
|
2712
|
+
_notificationManager[strRemoveNotificationListener](listener);
|
|
2450
2713
|
}
|
|
2451
2714
|
};
|
|
2452
2715
|
_self.getCookieMgr = function () {
|
|
@@ -2477,7 +2740,7 @@
|
|
|
2477
2740
|
var eventQueue = _eventQueue;
|
|
2478
2741
|
_eventQueue = [];
|
|
2479
2742
|
arrForEach(eventQueue, function (event) {
|
|
2480
|
-
|
|
2743
|
+
_createTelCtx().processNext(event);
|
|
2481
2744
|
});
|
|
2482
2745
|
}
|
|
2483
2746
|
};
|
|
@@ -2503,10 +2766,83 @@
|
|
|
2503
2766
|
}
|
|
2504
2767
|
};
|
|
2505
2768
|
proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, ["addTelemetryInitializer"]);
|
|
2769
|
+
_self.unload = function (isAsync, unloadComplete, cbTimeout) {
|
|
2770
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
2771
|
+
if (!_isInitialized) {
|
|
2772
|
+
throwError(strSdkNotInitialized);
|
|
2773
|
+
}
|
|
2774
|
+
if (_isUnloading) {
|
|
2775
|
+
throwError(strSdkUnloadingError);
|
|
2776
|
+
}
|
|
2777
|
+
var unloadState = {
|
|
2778
|
+
reason: 50 ,
|
|
2779
|
+
isAsync: isAsync,
|
|
2780
|
+
flushComplete: false
|
|
2781
|
+
};
|
|
2782
|
+
var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self.config, _self);
|
|
2783
|
+
processUnloadCtx.onComplete(function () {
|
|
2784
|
+
_initDefaults();
|
|
2785
|
+
unloadComplete && unloadComplete(unloadState);
|
|
2786
|
+
}, _self);
|
|
2787
|
+
function _doUnload(flushComplete) {
|
|
2788
|
+
unloadState.flushComplete = flushComplete;
|
|
2789
|
+
_isUnloading = true;
|
|
2790
|
+
_unloadHandlers.run(processUnloadCtx, unloadState);
|
|
2791
|
+
_self.stopPollingInternalLogs();
|
|
2792
|
+
processUnloadCtx.processNext(unloadState);
|
|
2793
|
+
}
|
|
2794
|
+
if (_channelControl) {
|
|
2795
|
+
_channelControl.flush(isAsync, _doUnload, 6 , cbTimeout);
|
|
2796
|
+
}
|
|
2797
|
+
else {
|
|
2798
|
+
_doUnload(true);
|
|
2799
|
+
}
|
|
2800
|
+
};
|
|
2506
2801
|
_self.getPlugin = _getPlugin;
|
|
2802
|
+
_self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {
|
|
2803
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
2804
|
+
if (!plugin) {
|
|
2805
|
+
addCb && addCb(false);
|
|
2806
|
+
_logOrThrowError(strValidationError);
|
|
2807
|
+
return;
|
|
2808
|
+
}
|
|
2809
|
+
var existingPlugin = _getPlugin(plugin.identifier);
|
|
2810
|
+
if (existingPlugin && !replaceExisting) {
|
|
2811
|
+
addCb && addCb(false);
|
|
2812
|
+
_logOrThrowError("Plugin [" + plugin.identifier + "] is already loaded!");
|
|
2813
|
+
return;
|
|
2814
|
+
}
|
|
2815
|
+
function _addPlugin(removed) {
|
|
2816
|
+
_configExtensions.push(plugin);
|
|
2817
|
+
_initPluginChain(_self.config);
|
|
2818
|
+
addCb && addCb(true);
|
|
2819
|
+
}
|
|
2820
|
+
if (existingPlugin) {
|
|
2821
|
+
var removedPlugins = [existingPlugin.plugin];
|
|
2822
|
+
var unloadState = {
|
|
2823
|
+
reason: 2 ,
|
|
2824
|
+
isAsync: isAsync
|
|
2825
|
+
};
|
|
2826
|
+
_removePlugins(removedPlugins, unloadState, function (removed) {
|
|
2827
|
+
if (!removed) {
|
|
2828
|
+
addCb && addCb(false);
|
|
2829
|
+
}
|
|
2830
|
+
else {
|
|
2831
|
+
_addPlugin();
|
|
2832
|
+
}
|
|
2833
|
+
});
|
|
2834
|
+
}
|
|
2835
|
+
else {
|
|
2836
|
+
_addPlugin();
|
|
2837
|
+
}
|
|
2838
|
+
};
|
|
2839
|
+
_self.evtNamespace = function () {
|
|
2840
|
+
return _evtNamespace;
|
|
2841
|
+
};
|
|
2842
|
+
proxyFunctionAs(_self, "addUnloadCb", function () { return _unloadHandlers; }, "add");
|
|
2507
2843
|
function _initDefaults() {
|
|
2508
2844
|
_isInitialized = false;
|
|
2509
|
-
_self.logger = new DiagnosticLogger({ loggingLevelConsole:
|
|
2845
|
+
_self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 });
|
|
2510
2846
|
_self.config = null;
|
|
2511
2847
|
_self._extensions = [];
|
|
2512
2848
|
_telemetryInitializerPlugin = new TelemetryInitializerPlugin();
|
|
@@ -2521,7 +2857,13 @@
|
|
|
2521
2857
|
_channelControl = null;
|
|
2522
2858
|
_channelConfig = null;
|
|
2523
2859
|
_channelQueue = null;
|
|
2860
|
+
_isUnloading = false;
|
|
2524
2861
|
_internalLogsEventName = null;
|
|
2862
|
+
_evtNamespace = createUniqueNamespace("AIBaseCore", true);
|
|
2863
|
+
_unloadHandlers = createUnloadHandlerContainer();
|
|
2864
|
+
}
|
|
2865
|
+
function _createTelCtx() {
|
|
2866
|
+
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
2525
2867
|
}
|
|
2526
2868
|
function _initPluginChain(config) {
|
|
2527
2869
|
var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
|
|
@@ -2529,26 +2871,63 @@
|
|
|
2529
2871
|
_pluginChain = null;
|
|
2530
2872
|
var allExtensions = theExtensions.all;
|
|
2531
2873
|
_channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, config, _self));
|
|
2532
|
-
|
|
2874
|
+
if (_channelControl) {
|
|
2875
|
+
var idx = allExtensions.indexOf(_channelControl);
|
|
2876
|
+
if (idx !== -1) {
|
|
2877
|
+
allExtensions.splice(idx, 1);
|
|
2878
|
+
}
|
|
2879
|
+
idx = _coreExtensions.indexOf(_channelControl);
|
|
2880
|
+
if (idx !== -1) {
|
|
2881
|
+
_coreExtensions.splice(idx, 1);
|
|
2882
|
+
}
|
|
2883
|
+
_channelControl._setQueue(_channelQueue);
|
|
2884
|
+
}
|
|
2885
|
+
else {
|
|
2886
|
+
_channelControl = createChannelControllerPlugin(_channelQueue, _self);
|
|
2887
|
+
}
|
|
2533
2888
|
allExtensions.push(_channelControl);
|
|
2534
2889
|
_coreExtensions.push(_channelControl);
|
|
2535
2890
|
_self._extensions = sortPlugins(allExtensions);
|
|
2536
2891
|
_channelControl.initialize(config, _self, allExtensions);
|
|
2537
|
-
initializePlugins(
|
|
2892
|
+
initializePlugins(_createTelCtx(), allExtensions);
|
|
2538
2893
|
_self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
|
|
2539
2894
|
}
|
|
2540
2895
|
function _getPlugin(pluginIdentifier) {
|
|
2541
2896
|
var theExt = null;
|
|
2542
2897
|
var thePlugin = null;
|
|
2543
2898
|
arrForEach(_self._extensions, function (ext) {
|
|
2544
|
-
if (ext.identifier === pluginIdentifier) {
|
|
2899
|
+
if (ext.identifier === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
|
|
2545
2900
|
thePlugin = ext;
|
|
2546
2901
|
return -1;
|
|
2547
2902
|
}
|
|
2548
2903
|
});
|
|
2904
|
+
if (!thePlugin && _channelControl) {
|
|
2905
|
+
thePlugin = _channelControl.getChannel(pluginIdentifier);
|
|
2906
|
+
}
|
|
2549
2907
|
if (thePlugin) {
|
|
2550
2908
|
theExt = {
|
|
2551
|
-
plugin: thePlugin
|
|
2909
|
+
plugin: thePlugin,
|
|
2910
|
+
setEnabled: function (enabled) {
|
|
2911
|
+
_getPluginState(thePlugin)[strDisabled] = !enabled;
|
|
2912
|
+
},
|
|
2913
|
+
isEnabled: function () {
|
|
2914
|
+
var pluginState = _getPluginState(thePlugin);
|
|
2915
|
+
return !pluginState[strTeardown] && !pluginState[strDisabled];
|
|
2916
|
+
},
|
|
2917
|
+
remove: function (isAsync, removeCb) {
|
|
2918
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
2919
|
+
var pluginsToRemove = [thePlugin];
|
|
2920
|
+
var unloadState = {
|
|
2921
|
+
reason: 1 ,
|
|
2922
|
+
isAsync: isAsync
|
|
2923
|
+
};
|
|
2924
|
+
_removePlugins(pluginsToRemove, unloadState, function (removed) {
|
|
2925
|
+
if (removed) {
|
|
2926
|
+
_initPluginChain(_self.config);
|
|
2927
|
+
}
|
|
2928
|
+
removeCb && removeCb(removed);
|
|
2929
|
+
});
|
|
2930
|
+
}
|
|
2552
2931
|
};
|
|
2553
2932
|
}
|
|
2554
2933
|
return theExt;
|
|
@@ -2556,11 +2935,53 @@
|
|
|
2556
2935
|
function _getPluginChain() {
|
|
2557
2936
|
if (!_pluginChain) {
|
|
2558
2937
|
var extensions = (_coreExtensions || []).slice();
|
|
2559
|
-
extensions.
|
|
2938
|
+
if (extensions.indexOf(_telemetryInitializerPlugin) === -1) {
|
|
2939
|
+
extensions.push(_telemetryInitializerPlugin);
|
|
2940
|
+
}
|
|
2560
2941
|
_pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _self.config, _self);
|
|
2561
2942
|
}
|
|
2562
2943
|
return _pluginChain;
|
|
2563
2944
|
}
|
|
2945
|
+
function _removePlugins(thePlugins, unloadState, removeComplete) {
|
|
2946
|
+
if (thePlugins && thePlugins.length > 0) {
|
|
2947
|
+
var unloadChain = createTelemetryProxyChain(thePlugins, _self.config, _self);
|
|
2948
|
+
var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self.config, _self);
|
|
2949
|
+
unloadCtx.onComplete(function () {
|
|
2950
|
+
var removed = false;
|
|
2951
|
+
var newConfigExtensions = [];
|
|
2952
|
+
arrForEach(_configExtensions, function (plugin, idx) {
|
|
2953
|
+
if (!_isPluginPresent(plugin, thePlugins)) {
|
|
2954
|
+
newConfigExtensions.push(plugin);
|
|
2955
|
+
}
|
|
2956
|
+
else {
|
|
2957
|
+
removed = true;
|
|
2958
|
+
}
|
|
2959
|
+
});
|
|
2960
|
+
_configExtensions = newConfigExtensions;
|
|
2961
|
+
var newChannelConfig = [];
|
|
2962
|
+
if (_channelConfig) {
|
|
2963
|
+
arrForEach(_channelConfig, function (queue, idx) {
|
|
2964
|
+
var newQueue = [];
|
|
2965
|
+
arrForEach(queue, function (channel) {
|
|
2966
|
+
if (!_isPluginPresent(channel, thePlugins)) {
|
|
2967
|
+
newQueue.push(channel);
|
|
2968
|
+
}
|
|
2969
|
+
else {
|
|
2970
|
+
removed = true;
|
|
2971
|
+
}
|
|
2972
|
+
});
|
|
2973
|
+
newChannelConfig.push(newQueue);
|
|
2974
|
+
});
|
|
2975
|
+
_channelConfig = newChannelConfig;
|
|
2976
|
+
}
|
|
2977
|
+
removeComplete && removeComplete(removed);
|
|
2978
|
+
});
|
|
2979
|
+
unloadCtx.processNext(unloadState);
|
|
2980
|
+
}
|
|
2981
|
+
else {
|
|
2982
|
+
removeComplete(false);
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2564
2985
|
function _flushInternalLogs() {
|
|
2565
2986
|
var queue = _self.logger ? _self.logger.queue : [];
|
|
2566
2987
|
if (queue) {
|
|
@@ -2579,12 +3000,12 @@
|
|
|
2579
3000
|
}
|
|
2580
3001
|
function _initDebugListener(config) {
|
|
2581
3002
|
if (config.disableDbgExt === true && _debugListener) {
|
|
2582
|
-
_notificationManager
|
|
3003
|
+
_notificationManager[strRemoveNotificationListener](_debugListener);
|
|
2583
3004
|
_debugListener = null;
|
|
2584
3005
|
}
|
|
2585
3006
|
if (_notificationManager && !_debugListener && config.disableDbgExt !== true) {
|
|
2586
3007
|
_debugListener = getDebugListener(config);
|
|
2587
|
-
_notificationManager
|
|
3008
|
+
_notificationManager[strAddNotificationListener](_debugListener);
|
|
2588
3009
|
}
|
|
2589
3010
|
}
|
|
2590
3011
|
function _initPerfManager(config) {
|
|
@@ -2595,15 +3016,24 @@
|
|
|
2595
3016
|
setValue(_self.config, "createPerfMgr", _createPerfManager);
|
|
2596
3017
|
}
|
|
2597
3018
|
}
|
|
3019
|
+
function _initExtConfig(config) {
|
|
3020
|
+
var extConfig = getSetValue(config, strExtensionConfig);
|
|
3021
|
+
extConfig.NotificationManager = _notificationManager;
|
|
3022
|
+
}
|
|
3023
|
+
function _logOrThrowError(message) {
|
|
3024
|
+
var logger = _self.logger;
|
|
3025
|
+
if (logger) {
|
|
3026
|
+
logger.throwInternal(2 , 73 , message);
|
|
3027
|
+
}
|
|
3028
|
+
else {
|
|
3029
|
+
throwError(message);
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
2598
3032
|
});
|
|
2599
3033
|
}
|
|
2600
3034
|
return BaseCore;
|
|
2601
3035
|
}());
|
|
2602
3036
|
|
|
2603
|
-
var strEventsSent = "eventsSent";
|
|
2604
|
-
var strEventsDiscarded = "eventsDiscarded";
|
|
2605
|
-
var strEventsSendRequest = "eventsSendRequest";
|
|
2606
|
-
var strPerfEvent = "perfEvent";
|
|
2607
3037
|
function _runListeners(listeners, name, isAsync, callback) {
|
|
2608
3038
|
arrForEach(listeners, function (listener) {
|
|
2609
3039
|
if (listener && listener[name]) {
|
|
@@ -2625,32 +3055,32 @@
|
|
|
2625
3055
|
this.listeners = [];
|
|
2626
3056
|
var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;
|
|
2627
3057
|
dynamicProto(NotificationManager, this, function (_self) {
|
|
2628
|
-
_self
|
|
3058
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2629
3059
|
_self.listeners.push(listener);
|
|
2630
3060
|
};
|
|
2631
|
-
_self
|
|
3061
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2632
3062
|
var index = arrIndexOf(_self.listeners, listener);
|
|
2633
3063
|
while (index > -1) {
|
|
2634
3064
|
_self.listeners.splice(index, 1);
|
|
2635
3065
|
index = arrIndexOf(_self.listeners, listener);
|
|
2636
3066
|
}
|
|
2637
3067
|
};
|
|
2638
|
-
_self
|
|
3068
|
+
_self[strEventsSent] = function (events) {
|
|
2639
3069
|
_runListeners(_self.listeners, strEventsSent, true, function (listener) {
|
|
2640
3070
|
listener[strEventsSent](events);
|
|
2641
3071
|
});
|
|
2642
3072
|
};
|
|
2643
|
-
_self
|
|
3073
|
+
_self[strEventsDiscarded] = function (events, reason) {
|
|
2644
3074
|
_runListeners(_self.listeners, strEventsDiscarded, true, function (listener) {
|
|
2645
3075
|
listener[strEventsDiscarded](events, reason);
|
|
2646
3076
|
});
|
|
2647
3077
|
};
|
|
2648
|
-
_self
|
|
3078
|
+
_self[strEventsSendRequest] = function (sendReason, isAsync) {
|
|
2649
3079
|
_runListeners(_self.listeners, strEventsSendRequest, isAsync, function (listener) {
|
|
2650
3080
|
listener[strEventsSendRequest](sendReason, isAsync);
|
|
2651
3081
|
});
|
|
2652
3082
|
};
|
|
2653
|
-
_self
|
|
3083
|
+
_self[strPerfEvent] = function (perfEvent) {
|
|
2654
3084
|
if (perfEvent) {
|
|
2655
3085
|
if (perfEvtsSendAll || !perfEvent.isChildEvt()) {
|
|
2656
3086
|
_runListeners(_self.listeners, strPerfEvent, false, function (listener) {
|
|
@@ -2705,147 +3135,179 @@
|
|
|
2705
3135
|
return AppInsightsCore;
|
|
2706
3136
|
}(BaseCore));
|
|
2707
3137
|
|
|
2708
|
-
var
|
|
2709
|
-
var
|
|
2710
|
-
var
|
|
2711
|
-
var
|
|
2712
|
-
var
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
function
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
3138
|
+
var strOnPrefix = "on";
|
|
3139
|
+
var strAttachEvent = "attachEvent";
|
|
3140
|
+
var strAddEventHelper = "addEventListener";
|
|
3141
|
+
var strEvents = "events";
|
|
3142
|
+
var strVisibilityChangeEvt = "visibilitychange";
|
|
3143
|
+
var strPageHide = "pagehide";
|
|
3144
|
+
var strUnload = "unload";
|
|
3145
|
+
var strBeforeUnload = "beforeunload";
|
|
3146
|
+
var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
|
|
3147
|
+
createUniqueNamespace("aiEvtPageShow");
|
|
3148
|
+
var _guid = 1;
|
|
3149
|
+
var elmNodeData = createElmNodeData("events");
|
|
3150
|
+
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
3151
|
+
function _normalizeNamespace(name) {
|
|
3152
|
+
if (name && name.replace) {
|
|
3153
|
+
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
3154
|
+
}
|
|
3155
|
+
return name;
|
|
3156
|
+
}
|
|
3157
|
+
function _getEvtNamespace(eventName, namespaces) {
|
|
3158
|
+
if (namespaces) {
|
|
3159
|
+
var theNamespace_1 = "";
|
|
3160
|
+
if (isArray(namespaces)) {
|
|
3161
|
+
theNamespace_1 = "";
|
|
3162
|
+
arrForEach(namespaces, function (name) {
|
|
3163
|
+
name = _normalizeNamespace(name);
|
|
3164
|
+
if (name) {
|
|
3165
|
+
if (name[0] !== ".") {
|
|
3166
|
+
name = "." + name;
|
|
3167
|
+
}
|
|
3168
|
+
theNamespace_1 += name;
|
|
3169
|
+
}
|
|
3170
|
+
});
|
|
3171
|
+
}
|
|
3172
|
+
else {
|
|
3173
|
+
theNamespace_1 = _normalizeNamespace(namespaces);
|
|
3174
|
+
}
|
|
3175
|
+
if (theNamespace_1) {
|
|
3176
|
+
if (theNamespace_1[0] !== ".") {
|
|
3177
|
+
theNamespace_1 = "." + theNamespace_1;
|
|
3178
|
+
}
|
|
3179
|
+
eventName = (eventName || "") + theNamespace_1;
|
|
3180
|
+
}
|
|
2727
3181
|
}
|
|
3182
|
+
var parsedEvent = (eventNamespace.exec(eventName) || []);
|
|
3183
|
+
return {
|
|
3184
|
+
type: parsedEvent[1],
|
|
3185
|
+
ns: ((parsedEvent[2] || "").split(".").sort()).join(".")
|
|
3186
|
+
};
|
|
2728
3187
|
}
|
|
2729
|
-
function
|
|
2730
|
-
if (
|
|
2731
|
-
|
|
3188
|
+
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
3189
|
+
if (addDefault === void 0) { addDefault = true; }
|
|
3190
|
+
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
3191
|
+
var registeredEvents = aiEvts[evtName];
|
|
3192
|
+
if (!registeredEvents) {
|
|
3193
|
+
registeredEvents = aiEvts[evtName] = [];
|
|
2732
3194
|
}
|
|
2733
|
-
return
|
|
3195
|
+
return registeredEvents;
|
|
2734
3196
|
}
|
|
2735
|
-
function
|
|
2736
|
-
var
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
if (
|
|
2743
|
-
|
|
3197
|
+
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
3198
|
+
var result = false;
|
|
3199
|
+
if (obj && evtName && evtName.type && handlerRef) {
|
|
3200
|
+
if (obj[strAddEventHelper]) {
|
|
3201
|
+
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
3202
|
+
result = true;
|
|
3203
|
+
}
|
|
3204
|
+
else if (obj[strAttachEvent]) {
|
|
3205
|
+
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
3206
|
+
result = true;
|
|
2744
3207
|
}
|
|
2745
|
-
value = mwcRandom32() & MaxUInt32;
|
|
2746
|
-
}
|
|
2747
|
-
if (value === 0) {
|
|
2748
|
-
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
2749
|
-
}
|
|
2750
|
-
if (!signed) {
|
|
2751
|
-
value >>>= 0;
|
|
2752
3208
|
}
|
|
2753
|
-
return
|
|
3209
|
+
return result;
|
|
2754
3210
|
}
|
|
2755
|
-
function
|
|
2756
|
-
|
|
2757
|
-
|
|
3211
|
+
function mergeEvtNamespace(theNamespace, namespaces) {
|
|
3212
|
+
var newNamespaces;
|
|
3213
|
+
if (namespaces) {
|
|
3214
|
+
if (isArray(namespaces)) {
|
|
3215
|
+
newNamespaces = [theNamespace].concat(namespaces);
|
|
3216
|
+
}
|
|
3217
|
+
else {
|
|
3218
|
+
newNamespaces = [theNamespace, namespaces];
|
|
3219
|
+
}
|
|
2758
3220
|
}
|
|
2759
3221
|
else {
|
|
2760
|
-
|
|
2761
|
-
}
|
|
2762
|
-
}
|
|
2763
|
-
function mwcRandom32(signed) {
|
|
2764
|
-
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
2765
|
-
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
2766
|
-
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
2767
|
-
if (!signed) {
|
|
2768
|
-
value >>>= 0;
|
|
3222
|
+
newNamespaces = theNamespace;
|
|
2769
3223
|
}
|
|
2770
|
-
return
|
|
3224
|
+
return newNamespaces;
|
|
2771
3225
|
}
|
|
2772
|
-
function
|
|
2773
|
-
if (
|
|
2774
|
-
var
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
3226
|
+
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
3227
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3228
|
+
var result = false;
|
|
3229
|
+
if (target) {
|
|
3230
|
+
try {
|
|
3231
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
3232
|
+
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
3233
|
+
if (result && elmNodeData.accept(target)) {
|
|
3234
|
+
var registeredEvent = {
|
|
3235
|
+
guid: _guid++,
|
|
3236
|
+
evtName: evtName,
|
|
3237
|
+
handler: handlerRef,
|
|
3238
|
+
capture: useCapture
|
|
3239
|
+
};
|
|
3240
|
+
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
catch (e) {
|
|
2785
3244
|
}
|
|
2786
3245
|
}
|
|
2787
3246
|
return result;
|
|
2788
3247
|
}
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
function addEventHandler(eventName, callback) {
|
|
3248
|
+
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
3249
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3250
|
+
return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
|
|
3251
|
+
}
|
|
3252
|
+
function addEventHandler(eventName, callback, evtNamespace) {
|
|
2795
3253
|
var result = false;
|
|
2796
3254
|
var w = getWindow();
|
|
2797
3255
|
if (w) {
|
|
2798
|
-
result =
|
|
2799
|
-
result =
|
|
3256
|
+
result = eventOn(w, eventName, callback, evtNamespace);
|
|
3257
|
+
result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
|
|
2800
3258
|
}
|
|
2801
3259
|
var doc = getDocument();
|
|
2802
3260
|
if (doc) {
|
|
2803
|
-
result =
|
|
3261
|
+
result = eventOn(doc, eventName, callback, evtNamespace) || result;
|
|
2804
3262
|
}
|
|
2805
3263
|
return result;
|
|
2806
3264
|
}
|
|
2807
|
-
function
|
|
3265
|
+
function _addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
2808
3266
|
var added = false;
|
|
2809
|
-
if (listener && events &&
|
|
2810
|
-
var excluded_1 = [];
|
|
3267
|
+
if (listener && events && events.length > 0) {
|
|
2811
3268
|
arrForEach(events, function (name) {
|
|
2812
|
-
if (
|
|
3269
|
+
if (name) {
|
|
2813
3270
|
if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {
|
|
2814
|
-
added = addEventHandler(name, listener) || added;
|
|
2815
|
-
}
|
|
2816
|
-
else {
|
|
2817
|
-
excluded_1.push(name);
|
|
3271
|
+
added = addEventHandler(name, listener, evtNamespace) || added;
|
|
2818
3272
|
}
|
|
2819
3273
|
}
|
|
2820
3274
|
});
|
|
2821
|
-
|
|
2822
|
-
|
|
3275
|
+
}
|
|
3276
|
+
return added;
|
|
3277
|
+
}
|
|
3278
|
+
function addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
3279
|
+
var added = false;
|
|
3280
|
+
if (listener && events && isArray(events)) {
|
|
3281
|
+
added = _addEventListeners(events, listener, excludeEvents, evtNamespace);
|
|
3282
|
+
if (!added && excludeEvents && excludeEvents.length > 0) {
|
|
3283
|
+
added = _addEventListeners(events, listener, null, evtNamespace);
|
|
2823
3284
|
}
|
|
2824
3285
|
}
|
|
2825
3286
|
return added;
|
|
2826
3287
|
}
|
|
2827
|
-
function addPageUnloadEventListener(listener, excludeEvents) {
|
|
2828
|
-
return addEventListeners([
|
|
3288
|
+
function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {
|
|
3289
|
+
return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);
|
|
2829
3290
|
}
|
|
2830
|
-
function addPageHideEventListener(listener, excludeEvents) {
|
|
3291
|
+
function addPageHideEventListener(listener, excludeEvents, evtNamespace) {
|
|
2831
3292
|
function _handlePageVisibility(evt) {
|
|
2832
3293
|
var doc = getDocument();
|
|
2833
3294
|
if (listener && doc && doc.visibilityState === "hidden") {
|
|
2834
3295
|
listener(evt);
|
|
2835
3296
|
}
|
|
2836
3297
|
}
|
|
2837
|
-
var
|
|
2838
|
-
|
|
2839
|
-
pageUnloadAdded = addEventHandler(strPageHide, listener);
|
|
2840
|
-
}
|
|
3298
|
+
var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
|
|
3299
|
+
var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);
|
|
2841
3300
|
if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
|
|
2842
|
-
pageUnloadAdded =
|
|
3301
|
+
pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;
|
|
2843
3302
|
}
|
|
2844
3303
|
if (!pageUnloadAdded && excludeEvents) {
|
|
2845
|
-
pageUnloadAdded = addPageHideEventListener(listener);
|
|
3304
|
+
pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);
|
|
2846
3305
|
}
|
|
2847
3306
|
return pageUnloadAdded;
|
|
2848
3307
|
}
|
|
3308
|
+
|
|
3309
|
+
var _cookieMgrs = null;
|
|
3310
|
+
var _canUseCookies;
|
|
2849
3311
|
function newGuid() {
|
|
2850
3312
|
function randomHexDigit() {
|
|
2851
3313
|
return randomValue(15);
|
|
@@ -2864,7 +3326,7 @@
|
|
|
2864
3326
|
}
|
|
2865
3327
|
function generateW3CId() {
|
|
2866
3328
|
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
2867
|
-
var oct =
|
|
3329
|
+
var oct = strEmpty$1, tmp;
|
|
2868
3330
|
for (var a = 0; a < 4; a++) {
|
|
2869
3331
|
tmp = random32();
|
|
2870
3332
|
oct +=
|
|
@@ -2959,6 +3421,95 @@
|
|
|
2959
3421
|
return _legacyCookieMgr(null, logger).del(name);
|
|
2960
3422
|
}
|
|
2961
3423
|
|
|
3424
|
+
var LoggingSeverity = createEnumStyle({
|
|
3425
|
+
CRITICAL: 1 ,
|
|
3426
|
+
WARNING: 2
|
|
3427
|
+
});
|
|
3428
|
+
var _InternalMessageId = createEnumStyle({
|
|
3429
|
+
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
3430
|
+
BrowserCannotReadLocalStorage: 1 ,
|
|
3431
|
+
BrowserCannotReadSessionStorage: 2 ,
|
|
3432
|
+
BrowserCannotWriteLocalStorage: 3 ,
|
|
3433
|
+
BrowserCannotWriteSessionStorage: 4 ,
|
|
3434
|
+
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
3435
|
+
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
3436
|
+
CannotSendEmptyTelemetry: 7 ,
|
|
3437
|
+
ClientPerformanceMathError: 8 ,
|
|
3438
|
+
ErrorParsingAISessionCookie: 9 ,
|
|
3439
|
+
ErrorPVCalc: 10 ,
|
|
3440
|
+
ExceptionWhileLoggingError: 11 ,
|
|
3441
|
+
FailedAddingTelemetryToBuffer: 12 ,
|
|
3442
|
+
FailedMonitorAjaxAbort: 13 ,
|
|
3443
|
+
FailedMonitorAjaxDur: 14 ,
|
|
3444
|
+
FailedMonitorAjaxOpen: 15 ,
|
|
3445
|
+
FailedMonitorAjaxRSC: 16 ,
|
|
3446
|
+
FailedMonitorAjaxSend: 17 ,
|
|
3447
|
+
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
3448
|
+
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
3449
|
+
FailedToSendQueuedTelemetry: 20 ,
|
|
3450
|
+
FailedToReportDataLoss: 21 ,
|
|
3451
|
+
FlushFailed: 22 ,
|
|
3452
|
+
MessageLimitPerPVExceeded: 23 ,
|
|
3453
|
+
MissingRequiredFieldSpecification: 24 ,
|
|
3454
|
+
NavigationTimingNotSupported: 25 ,
|
|
3455
|
+
OnError: 26 ,
|
|
3456
|
+
SessionRenewalDateIsZero: 27 ,
|
|
3457
|
+
SenderNotInitialized: 28 ,
|
|
3458
|
+
StartTrackEventFailed: 29 ,
|
|
3459
|
+
StopTrackEventFailed: 30 ,
|
|
3460
|
+
StartTrackFailed: 31 ,
|
|
3461
|
+
StopTrackFailed: 32 ,
|
|
3462
|
+
TelemetrySampledAndNotSent: 33 ,
|
|
3463
|
+
TrackEventFailed: 34 ,
|
|
3464
|
+
TrackExceptionFailed: 35 ,
|
|
3465
|
+
TrackMetricFailed: 36 ,
|
|
3466
|
+
TrackPVFailed: 37 ,
|
|
3467
|
+
TrackPVFailedCalc: 38 ,
|
|
3468
|
+
TrackTraceFailed: 39 ,
|
|
3469
|
+
TransmissionFailed: 40 ,
|
|
3470
|
+
FailedToSetStorageBuffer: 41 ,
|
|
3471
|
+
FailedToRestoreStorageBuffer: 42 ,
|
|
3472
|
+
InvalidBackendResponse: 43 ,
|
|
3473
|
+
FailedToFixDepricatedValues: 44 ,
|
|
3474
|
+
InvalidDurationValue: 45 ,
|
|
3475
|
+
TelemetryEnvelopeInvalid: 46 ,
|
|
3476
|
+
CreateEnvelopeError: 47 ,
|
|
3477
|
+
CannotSerializeObject: 48 ,
|
|
3478
|
+
CannotSerializeObjectNonSerializable: 49 ,
|
|
3479
|
+
CircularReferenceDetected: 50 ,
|
|
3480
|
+
ClearAuthContextFailed: 51 ,
|
|
3481
|
+
ExceptionTruncated: 52 ,
|
|
3482
|
+
IllegalCharsInName: 53 ,
|
|
3483
|
+
ItemNotInArray: 54 ,
|
|
3484
|
+
MaxAjaxPerPVExceeded: 55 ,
|
|
3485
|
+
MessageTruncated: 56 ,
|
|
3486
|
+
NameTooLong: 57 ,
|
|
3487
|
+
SampleRateOutOfRange: 58 ,
|
|
3488
|
+
SetAuthContextFailed: 59 ,
|
|
3489
|
+
SetAuthContextFailedAccountName: 60 ,
|
|
3490
|
+
StringValueTooLong: 61 ,
|
|
3491
|
+
StartCalledMoreThanOnce: 62 ,
|
|
3492
|
+
StopCalledWithoutStart: 63 ,
|
|
3493
|
+
TelemetryInitializerFailed: 64 ,
|
|
3494
|
+
TrackArgumentsNotSpecified: 65 ,
|
|
3495
|
+
UrlTooLong: 66 ,
|
|
3496
|
+
SessionStorageBufferFull: 67 ,
|
|
3497
|
+
CannotAccessCookie: 68 ,
|
|
3498
|
+
IdTooLong: 69 ,
|
|
3499
|
+
InvalidEvent: 70 ,
|
|
3500
|
+
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
3501
|
+
SendBrowserInfoOnUserInit: 72 ,
|
|
3502
|
+
PluginException: 73 ,
|
|
3503
|
+
NotificationException: 74 ,
|
|
3504
|
+
SnippetScriptLoadFailure: 99 ,
|
|
3505
|
+
InvalidInstrumentationKey: 100 ,
|
|
3506
|
+
CannotParseAiBlobValue: 101 ,
|
|
3507
|
+
InvalidContentBlob: 102 ,
|
|
3508
|
+
TrackPageActionEventFailed: 103 ,
|
|
3509
|
+
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
3510
|
+
InMemoryStorageBufferFull: 105
|
|
3511
|
+
});
|
|
3512
|
+
|
|
2962
3513
|
var aiInstrumentHooks = "_aiHooks";
|
|
2963
3514
|
var cbNames = [
|
|
2964
3515
|
"req", "rsp", "hkErr", "fnErr"
|
|
@@ -3134,7 +3685,7 @@
|
|
|
3134
3685
|
name = strTrim(name.toString());
|
|
3135
3686
|
if (name.length > 150 ) {
|
|
3136
3687
|
nameTrunc = name.substring(0, 150 );
|
|
3137
|
-
logger && logger.throwInternal(
|
|
3688
|
+
logger && logger.throwInternal(2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
|
|
3138
3689
|
}
|
|
3139
3690
|
}
|
|
3140
3691
|
return nameTrunc || name;
|
|
@@ -3147,7 +3698,7 @@
|
|
|
3147
3698
|
value = strTrim(value);
|
|
3148
3699
|
if (value.toString().length > maxLength) {
|
|
3149
3700
|
valueTrunc = value.toString().substring(0, maxLength);
|
|
3150
|
-
logger && logger.throwInternal(
|
|
3701
|
+
logger && logger.throwInternal(2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
|
|
3151
3702
|
}
|
|
3152
3703
|
}
|
|
3153
3704
|
return valueTrunc || value;
|
|
@@ -3160,7 +3711,7 @@
|
|
|
3160
3711
|
if (message) {
|
|
3161
3712
|
if (message.length > 32768 ) {
|
|
3162
3713
|
messageTrunc = message.substring(0, 32768 );
|
|
3163
|
-
logger && logger.throwInternal(
|
|
3714
|
+
logger && logger.throwInternal(2 , _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
|
|
3164
3715
|
}
|
|
3165
3716
|
}
|
|
3166
3717
|
return messageTrunc || message;
|
|
@@ -3171,7 +3722,7 @@
|
|
|
3171
3722
|
var value = "" + exception;
|
|
3172
3723
|
if (value.length > 32768 ) {
|
|
3173
3724
|
exceptionTrunc = value.substring(0, 32768 );
|
|
3174
|
-
logger && logger.throwInternal(
|
|
3725
|
+
logger && logger.throwInternal(2 , _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
|
|
3175
3726
|
}
|
|
3176
3727
|
}
|
|
3177
3728
|
return exceptionTrunc || exception;
|
|
@@ -3185,7 +3736,7 @@
|
|
|
3185
3736
|
value = getJSON().stringify(value);
|
|
3186
3737
|
}
|
|
3187
3738
|
catch (e) {
|
|
3188
|
-
logger && logger.throwInternal(
|
|
3739
|
+
logger && logger.throwInternal(2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
|
|
3189
3740
|
}
|
|
3190
3741
|
}
|
|
3191
3742
|
value = dataSanitizeString(logger, value, 8192 );
|
|
@@ -3216,7 +3767,7 @@
|
|
|
3216
3767
|
input = strTrim(input);
|
|
3217
3768
|
if (input.length > maxLength) {
|
|
3218
3769
|
inputTrunc = input.substring(0, maxLength);
|
|
3219
|
-
logger && logger.throwInternal(
|
|
3770
|
+
logger && logger.throwInternal(2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
|
|
3220
3771
|
}
|
|
3221
3772
|
}
|
|
3222
3773
|
return inputTrunc || input;
|
|
@@ -3262,6 +3813,7 @@
|
|
|
3262
3813
|
return event;
|
|
3263
3814
|
}
|
|
3264
3815
|
|
|
3816
|
+
var strEmpty = "";
|
|
3265
3817
|
function stringToBoolOrDefault(str, defaultValue) {
|
|
3266
3818
|
if (defaultValue === void 0) { defaultValue = false; }
|
|
3267
3819
|
if (str === undefined || str === null) {
|
|
@@ -3274,16 +3826,16 @@
|
|
|
3274
3826
|
totalms = 0;
|
|
3275
3827
|
}
|
|
3276
3828
|
totalms = Math.round(totalms);
|
|
3277
|
-
var ms =
|
|
3278
|
-
var sec =
|
|
3279
|
-
var min =
|
|
3280
|
-
var hour =
|
|
3829
|
+
var ms = strEmpty + totalms % 1000;
|
|
3830
|
+
var sec = strEmpty + Math.floor(totalms / 1000) % 60;
|
|
3831
|
+
var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
|
|
3832
|
+
var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
|
|
3281
3833
|
var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
|
|
3282
3834
|
ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
|
|
3283
3835
|
sec = sec.length < 2 ? "0" + sec : sec;
|
|
3284
3836
|
min = min.length < 2 ? "0" + min : min;
|
|
3285
3837
|
hour = hour.length < 2 ? "0" + hour : hour;
|
|
3286
|
-
return (days > 0 ? days + "." :
|
|
3838
|
+
return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
|
|
3287
3839
|
}
|
|
3288
3840
|
function getExtensionByName(extensions, identifier) {
|
|
3289
3841
|
var extension = null;
|
|
@@ -3307,17 +3859,15 @@
|
|
|
3307
3859
|
var strNotSpecified = "not_specified";
|
|
3308
3860
|
var strIkey = "iKey";
|
|
3309
3861
|
|
|
3310
|
-
var StorageType
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
|
|
3320
|
-
})(exports.DistributedTracingModes || (exports.DistributedTracingModes = {}));
|
|
3862
|
+
var StorageType = createEnumStyle({
|
|
3863
|
+
LocalStorage: 0 ,
|
|
3864
|
+
SessionStorage: 1
|
|
3865
|
+
});
|
|
3866
|
+
var DistributedTracingModes = createEnumStyle({
|
|
3867
|
+
AI: 0 ,
|
|
3868
|
+
AI_AND_W3C: 1 ,
|
|
3869
|
+
W3C: 2
|
|
3870
|
+
});
|
|
3321
3871
|
|
|
3322
3872
|
var _canUseLocalStorage = undefined;
|
|
3323
3873
|
var _canUseSessionStorage = undefined;
|
|
@@ -3369,7 +3919,7 @@
|
|
|
3369
3919
|
}
|
|
3370
3920
|
catch (e) {
|
|
3371
3921
|
_canUseLocalStorage = false;
|
|
3372
|
-
logger.throwInternal(
|
|
3922
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3373
3923
|
}
|
|
3374
3924
|
}
|
|
3375
3925
|
return null;
|
|
@@ -3383,7 +3933,7 @@
|
|
|
3383
3933
|
}
|
|
3384
3934
|
catch (e) {
|
|
3385
3935
|
_canUseLocalStorage = false;
|
|
3386
|
-
logger.throwInternal(
|
|
3936
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3387
3937
|
}
|
|
3388
3938
|
}
|
|
3389
3939
|
return false;
|
|
@@ -3397,7 +3947,7 @@
|
|
|
3397
3947
|
}
|
|
3398
3948
|
catch (e) {
|
|
3399
3949
|
_canUseLocalStorage = false;
|
|
3400
|
-
logger.throwInternal(
|
|
3950
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3401
3951
|
}
|
|
3402
3952
|
}
|
|
3403
3953
|
return false;
|
|
@@ -3425,7 +3975,7 @@
|
|
|
3425
3975
|
}
|
|
3426
3976
|
catch (e) {
|
|
3427
3977
|
_canUseSessionStorage = false;
|
|
3428
|
-
logger.throwInternal(
|
|
3978
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3429
3979
|
}
|
|
3430
3980
|
}
|
|
3431
3981
|
return null;
|
|
@@ -3439,7 +3989,7 @@
|
|
|
3439
3989
|
}
|
|
3440
3990
|
catch (e) {
|
|
3441
3991
|
_canUseSessionStorage = false;
|
|
3442
|
-
logger.throwInternal(
|
|
3992
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3443
3993
|
}
|
|
3444
3994
|
}
|
|
3445
3995
|
return false;
|
|
@@ -3453,7 +4003,7 @@
|
|
|
3453
4003
|
}
|
|
3454
4004
|
catch (e) {
|
|
3455
4005
|
_canUseSessionStorage = false;
|
|
3456
|
-
logger.throwInternal(
|
|
4006
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3457
4007
|
}
|
|
3458
4008
|
}
|
|
3459
4009
|
return false;
|
|
@@ -4765,7 +5315,7 @@
|
|
|
4765
5315
|
if (!pageViewPerformanceManager.isPerformanceTimingSupported()) {
|
|
4766
5316
|
appInsights.sendPageViewInternal(pageView, customProperties);
|
|
4767
5317
|
_flushChannels();
|
|
4768
|
-
_logger.throwInternal(
|
|
5318
|
+
_logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.NavigationTimingNotSupported, "trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");
|
|
4769
5319
|
return;
|
|
4770
5320
|
}
|
|
4771
5321
|
var pageViewSent = false;
|
|
@@ -4831,7 +5381,7 @@
|
|
|
4831
5381
|
}
|
|
4832
5382
|
}
|
|
4833
5383
|
catch (e) {
|
|
4834
|
-
_logger.throwInternal(
|
|
5384
|
+
_logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailedCalc, "trackPageView failed on page load calculation: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
4835
5385
|
}
|
|
4836
5386
|
return processed;
|
|
4837
5387
|
});
|
|
@@ -4949,13 +5499,13 @@
|
|
|
4949
5499
|
dom = dateTimeUtilsDuration(timing.responseEnd, timing.loadEventEnd);
|
|
4950
5500
|
}
|
|
4951
5501
|
if (total === 0) {
|
|
4952
|
-
this._logger.throwInternal(
|
|
5502
|
+
this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ErrorPVCalc, "error calculating page view performance.", { total: total, network: network, request: request, response: response, dom: dom });
|
|
4953
5503
|
}
|
|
4954
5504
|
else if (!this.shouldCollectDuration(total, network, request, response, dom)) {
|
|
4955
|
-
this._logger.throwInternal(
|
|
5505
|
+
this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.InvalidDurationValue, "Invalid page load duration value. Browser perf data won't be sent.", { total: total, network: network, request: request, response: response, dom: dom });
|
|
4956
5506
|
}
|
|
4957
5507
|
else if (total < Math.floor(network) + Math.floor(request) + Math.floor(response) + Math.floor(dom)) {
|
|
4958
|
-
this._logger.throwInternal(
|
|
5508
|
+
this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.ClientPerformanceMathError, "client performance math error.", { total: total, network: network, request: request, response: response, dom: dom });
|
|
4959
5509
|
}
|
|
4960
5510
|
else {
|
|
4961
5511
|
pageViewPerformance.durationMs = total;
|
|
@@ -5080,7 +5630,7 @@
|
|
|
5080
5630
|
}
|
|
5081
5631
|
}
|
|
5082
5632
|
catch (e) {
|
|
5083
|
-
itemCtx.diagLog().throwInternal(
|
|
5633
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
|
|
5084
5634
|
}
|
|
5085
5635
|
}
|
|
5086
5636
|
}
|
|
@@ -5095,7 +5645,7 @@
|
|
|
5095
5645
|
_self.core.track(telemetryItem);
|
|
5096
5646
|
}
|
|
5097
5647
|
catch (e) {
|
|
5098
|
-
_self.diagLog().throwInternal(
|
|
5648
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
5099
5649
|
}
|
|
5100
5650
|
};
|
|
5101
5651
|
_self.startTrackEvent = function (name) {
|
|
@@ -5103,7 +5653,7 @@
|
|
|
5103
5653
|
_eventTracking.start(name);
|
|
5104
5654
|
}
|
|
5105
5655
|
catch (e) {
|
|
5106
|
-
_self.diagLog().throwInternal(
|
|
5656
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackEventFailed, "startTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
5107
5657
|
}
|
|
5108
5658
|
};
|
|
5109
5659
|
_self.stopTrackEvent = function (name, properties, measurements) {
|
|
@@ -5111,7 +5661,7 @@
|
|
|
5111
5661
|
_eventTracking.stop(name, undefined, properties);
|
|
5112
5662
|
}
|
|
5113
5663
|
catch (e) {
|
|
5114
|
-
_self.diagLog().throwInternal(
|
|
5664
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackEventFailed, "stopTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
5115
5665
|
}
|
|
5116
5666
|
};
|
|
5117
5667
|
_self.trackTrace = function (trace, customProperties) {
|
|
@@ -5120,7 +5670,7 @@
|
|
|
5120
5670
|
_self.core.track(telemetryItem);
|
|
5121
5671
|
}
|
|
5122
5672
|
catch (e) {
|
|
5123
|
-
_self.diagLog().throwInternal(
|
|
5673
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
5124
5674
|
}
|
|
5125
5675
|
};
|
|
5126
5676
|
_self.trackMetric = function (metric, customProperties) {
|
|
@@ -5129,7 +5679,7 @@
|
|
|
5129
5679
|
_self.core.track(telemetryItem);
|
|
5130
5680
|
}
|
|
5131
5681
|
catch (e) {
|
|
5132
|
-
_self.diagLog().throwInternal(
|
|
5682
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackMetricFailed, "trackMetric failed, metric will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
5133
5683
|
}
|
|
5134
5684
|
};
|
|
5135
5685
|
_self.trackPageView = function (pageView, customProperties) {
|
|
@@ -5141,7 +5691,7 @@
|
|
|
5141
5691
|
}
|
|
5142
5692
|
}
|
|
5143
5693
|
catch (e) {
|
|
5144
|
-
_self.diagLog().throwInternal(
|
|
5694
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, "trackPageView failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
5145
5695
|
}
|
|
5146
5696
|
};
|
|
5147
5697
|
_self.sendPageViewInternal = function (pageView, properties, systemProperties) {
|
|
@@ -5162,7 +5712,7 @@
|
|
|
5162
5712
|
_self.sendPageViewPerformanceInternal(pageViewPerformance, customProperties);
|
|
5163
5713
|
}
|
|
5164
5714
|
catch (e) {
|
|
5165
|
-
_self.diagLog().throwInternal(
|
|
5715
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, "trackPageViewPerformance failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
5166
5716
|
}
|
|
5167
5717
|
};
|
|
5168
5718
|
_self.startTrackPage = function (name) {
|
|
@@ -5174,7 +5724,7 @@
|
|
|
5174
5724
|
_pageTracking.start(name);
|
|
5175
5725
|
}
|
|
5176
5726
|
catch (e) {
|
|
5177
|
-
_self.diagLog().throwInternal(
|
|
5727
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackFailed, "startTrackPage failed, page view may not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
5178
5728
|
}
|
|
5179
5729
|
};
|
|
5180
5730
|
_self.stopTrackPage = function (name, url, properties, measurement) {
|
|
@@ -5193,7 +5743,7 @@
|
|
|
5193
5743
|
}
|
|
5194
5744
|
}
|
|
5195
5745
|
catch (e) {
|
|
5196
|
-
_self.diagLog().throwInternal(
|
|
5746
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackFailed, "stopTrackPage failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
5197
5747
|
}
|
|
5198
5748
|
};
|
|
5199
5749
|
_self.sendExceptionInternal = function (exception, customProperties, systemProperties) {
|
|
@@ -5207,7 +5757,7 @@
|
|
|
5207
5757
|
_self.sendExceptionInternal(exception, customProperties);
|
|
5208
5758
|
}
|
|
5209
5759
|
catch (e) {
|
|
5210
|
-
_self.diagLog().throwInternal(
|
|
5760
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackExceptionFailed, "trackException failed, exception will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
5211
5761
|
}
|
|
5212
5762
|
};
|
|
5213
5763
|
_self._onerror = function (exception) {
|
|
@@ -5241,7 +5791,7 @@
|
|
|
5241
5791
|
}
|
|
5242
5792
|
catch (e) {
|
|
5243
5793
|
var errorString = error ? (error.name + ", " + error.message) : "null";
|
|
5244
|
-
_self.diagLog().throwInternal(
|
|
5794
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ExceptionWhileLoggingError, "_onError threw exception while logging error, error will not be collected: "
|
|
5245
5795
|
+ getExceptionName(e), { exception: dumpObj(e), errorString: errorString });
|
|
5246
5796
|
}
|
|
5247
5797
|
};
|
|
@@ -5454,7 +6004,7 @@
|
|
|
5454
6004
|
config.disableFlushOnUnload = stringToBoolOrDefault(config.disableFlushOnUnload, config.disableFlushOnBeforeUnload);
|
|
5455
6005
|
return config;
|
|
5456
6006
|
};
|
|
5457
|
-
ApplicationInsights.Version = "2.8.0-beta.
|
|
6007
|
+
ApplicationInsights.Version = "2.8.0-beta.2203-03";
|
|
5458
6008
|
return ApplicationInsights;
|
|
5459
6009
|
}(BaseTelemetryPlugin));
|
|
5460
6010
|
var Timing = /** @class */ (function () {
|
|
@@ -5463,14 +6013,14 @@
|
|
|
5463
6013
|
var _events = {};
|
|
5464
6014
|
_self.start = function (name) {
|
|
5465
6015
|
if (typeof _events[name] !== "undefined") {
|
|
5466
|
-
logger.throwInternal(
|
|
6016
|
+
logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.", { name: name, key: name }, true);
|
|
5467
6017
|
}
|
|
5468
6018
|
_events[name] = +new Date;
|
|
5469
6019
|
};
|
|
5470
6020
|
_self.stop = function (name, url, properties, measurements) {
|
|
5471
6021
|
var start = _events[name];
|
|
5472
6022
|
if (isNaN(start)) {
|
|
5473
|
-
logger.throwInternal(
|
|
6023
|
+
logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.", { name: name, key: name }, true);
|
|
5474
6024
|
}
|
|
5475
6025
|
else {
|
|
5476
6026
|
var end = +new Date;
|
|
@@ -5499,7 +6049,7 @@
|
|
|
5499
6049
|
_self.enqueue = function (payload) {
|
|
5500
6050
|
if (_self.count() >= config.eventsLimitInMem()) {
|
|
5501
6051
|
if (!_bufferFullMessageSent) {
|
|
5502
|
-
logger.throwInternal(
|
|
6052
|
+
logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.InMemoryStorageBufferFull, "Maximum in-memory buffer size reached: " + _self.count(), true);
|
|
5503
6053
|
_bufferFullMessageSent = true;
|
|
5504
6054
|
}
|
|
5505
6055
|
return;
|
|
@@ -5571,7 +6121,7 @@
|
|
|
5571
6121
|
_self.enqueue = function (payload) {
|
|
5572
6122
|
if (_self.count() >= SessionStorageSendBuffer.MAX_BUFFER_SIZE) {
|
|
5573
6123
|
if (!_bufferFullMessageSent) {
|
|
5574
|
-
logger.throwInternal(
|
|
6124
|
+
logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionStorageBufferFull, "Maximum buffer size reached: " + _self.count(), true);
|
|
5575
6125
|
_bufferFullMessageSent = true;
|
|
5576
6126
|
}
|
|
5577
6127
|
return;
|
|
@@ -5591,7 +6141,7 @@
|
|
|
5591
6141
|
if (sentElements instanceof Array && payload instanceof Array) {
|
|
5592
6142
|
sentElements = sentElements.concat(payload);
|
|
5593
6143
|
if (sentElements.length > SessionStorageSendBuffer.MAX_BUFFER_SIZE) {
|
|
5594
|
-
logger.throwInternal(
|
|
6144
|
+
logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.SessionStorageBufferFull, "Sent buffer reached its maximum size: " + sentElements.length, true);
|
|
5595
6145
|
sentElements.length = SessionStorageSendBuffer.MAX_BUFFER_SIZE;
|
|
5596
6146
|
}
|
|
5597
6147
|
_setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, sentElements);
|
|
@@ -5627,7 +6177,7 @@
|
|
|
5627
6177
|
}
|
|
5628
6178
|
}
|
|
5629
6179
|
catch (e) {
|
|
5630
|
-
logger.throwInternal(
|
|
6180
|
+
logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToRestoreStorageBuffer, " storage key: " + prefixedKey + ", " + getExceptionName(e), { exception: dumpObj(e) });
|
|
5631
6181
|
}
|
|
5632
6182
|
return [];
|
|
5633
6183
|
}
|
|
@@ -5640,7 +6190,7 @@
|
|
|
5640
6190
|
}
|
|
5641
6191
|
catch (e) {
|
|
5642
6192
|
utlSetSessionStorage(logger, prefixedKey, JSON.stringify([]));
|
|
5643
|
-
logger.throwInternal(
|
|
6193
|
+
logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedToSetStorageBuffer, " storage key: " + prefixedKey + ", " + getExceptionName(e) + ". Buffer cleared", { exception: dumpObj(e) });
|
|
5644
6194
|
}
|
|
5645
6195
|
}
|
|
5646
6196
|
});
|
|
@@ -5757,11 +6307,11 @@
|
|
|
5757
6307
|
}
|
|
5758
6308
|
function EnvelopeCreatorInit(logger, telemetryItem) {
|
|
5759
6309
|
if (isNullOrUndefined(telemetryItem[strBaseData])) {
|
|
5760
|
-
logger.throwInternal(
|
|
6310
|
+
logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryEnvelopeInvalid, "telemetryItem.baseData cannot be null.");
|
|
5761
6311
|
}
|
|
5762
6312
|
}
|
|
5763
6313
|
var EnvelopeCreator = {
|
|
5764
|
-
Version: "2.8.0-beta.
|
|
6314
|
+
Version: "2.8.0-beta.2203-03"
|
|
5765
6315
|
};
|
|
5766
6316
|
function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
|
|
5767
6317
|
EnvelopeCreatorInit(logger, telemetryItem);
|
|
@@ -5920,18 +6470,18 @@
|
|
|
5920
6470
|
return getJSON().stringify(output);
|
|
5921
6471
|
}
|
|
5922
6472
|
catch (e) {
|
|
5923
|
-
logger.throwInternal(
|
|
6473
|
+
logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, (e && isFunction(e.toString)) ? e.toString() : "Error serializing object", null, true);
|
|
5924
6474
|
}
|
|
5925
6475
|
};
|
|
5926
6476
|
function _serializeObject(source, name) {
|
|
5927
6477
|
var circularReferenceCheck = "__aiCircularRefCheck";
|
|
5928
6478
|
var output = {};
|
|
5929
6479
|
if (!source) {
|
|
5930
|
-
logger.throwInternal(
|
|
6480
|
+
logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, "cannot serialize object because it is null or undefined", { name: name }, true);
|
|
5931
6481
|
return output;
|
|
5932
6482
|
}
|
|
5933
6483
|
if (source[circularReferenceCheck]) {
|
|
5934
|
-
logger.throwInternal(
|
|
6484
|
+
logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CircularReferenceDetected, "Circular reference detected while serializing object", { name: name }, true);
|
|
5935
6485
|
return output;
|
|
5936
6486
|
}
|
|
5937
6487
|
if (!source.aiDataContract) {
|
|
@@ -5948,13 +6498,13 @@
|
|
|
5948
6498
|
output = _serializeArray(source, name);
|
|
5949
6499
|
}
|
|
5950
6500
|
else {
|
|
5951
|
-
logger.throwInternal(
|
|
6501
|
+
logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotSerializeObjectNonSerializable, "Attempting to serialize an object which does not implement ISerializable", { name: name }, true);
|
|
5952
6502
|
try {
|
|
5953
6503
|
getJSON().stringify(source);
|
|
5954
6504
|
output = source;
|
|
5955
6505
|
}
|
|
5956
6506
|
catch (e) {
|
|
5957
|
-
logger.throwInternal(
|
|
6507
|
+
logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSerializeObject, (e && isFunction(e.toString)) ? e.toString() : "Error serializing object", null, true);
|
|
5958
6508
|
}
|
|
5959
6509
|
}
|
|
5960
6510
|
return output;
|
|
@@ -5967,7 +6517,7 @@
|
|
|
5967
6517
|
var isPresent = source[field] !== undefined;
|
|
5968
6518
|
var isObj = isObject(source[field]) && source[field] !== null;
|
|
5969
6519
|
if (isRequired && !isPresent && !isArray) {
|
|
5970
|
-
logger.throwInternal(
|
|
6520
|
+
logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.MissingRequiredFieldSpecification, "Missing required field specification. The field is required but not present on source", { field: field, name: name });
|
|
5971
6521
|
}
|
|
5972
6522
|
else if (!isHidden) {
|
|
5973
6523
|
var value = void 0;
|
|
@@ -5994,7 +6544,7 @@
|
|
|
5994
6544
|
var output;
|
|
5995
6545
|
if (!!sources) {
|
|
5996
6546
|
if (!isArray(sources)) {
|
|
5997
|
-
logger.throwInternal(
|
|
6547
|
+
logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ItemNotInArray, "This field was specified as an array in the contract but the item is not an array.\r\n", { name: name }, true);
|
|
5998
6548
|
}
|
|
5999
6549
|
else {
|
|
6000
6550
|
output = [];
|
|
@@ -6045,7 +6595,7 @@
|
|
|
6045
6595
|
}
|
|
6046
6596
|
else {
|
|
6047
6597
|
output[field] = "invalid field: " + name + " is of unknown type.";
|
|
6048
|
-
logger.throwInternal(
|
|
6598
|
+
logger.throwInternal(LoggingSeverity.CRITICAL, output[field], null, true);
|
|
6049
6599
|
}
|
|
6050
6600
|
});
|
|
6051
6601
|
}
|
|
@@ -6175,7 +6725,7 @@
|
|
|
6175
6725
|
this.INT_MAX_VALUE = 2147483647;
|
|
6176
6726
|
var _logger = logger || safeGetLogger(null);
|
|
6177
6727
|
if (sampleRate > 100 || sampleRate < 0) {
|
|
6178
|
-
_logger.throwInternal(
|
|
6728
|
+
_logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SampleRateOutOfRange, "Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.", { samplingRate: sampleRate }, true);
|
|
6179
6729
|
sampleRate = 100;
|
|
6180
6730
|
}
|
|
6181
6731
|
this.sampleRate = sampleRate;
|
|
@@ -6280,7 +6830,7 @@
|
|
|
6280
6830
|
_self.triggerSend(isAsync, null, sendReason || 1 );
|
|
6281
6831
|
}
|
|
6282
6832
|
catch (e) {
|
|
6283
|
-
_self.diagLog().throwInternal(
|
|
6833
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FlushFailed, "flush failed, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
6284
6834
|
}
|
|
6285
6835
|
}
|
|
6286
6836
|
};
|
|
@@ -6291,7 +6841,7 @@
|
|
|
6291
6841
|
_self.triggerSend(true, _doUnloadSend, 2 );
|
|
6292
6842
|
}
|
|
6293
6843
|
catch (e) {
|
|
6294
|
-
_self.diagLog().throwInternal(
|
|
6844
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToSendQueuedTelemetry, "failed to flush with beacon sender on page unload, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
6295
6845
|
}
|
|
6296
6846
|
}
|
|
6297
6847
|
else {
|
|
@@ -6322,7 +6872,7 @@
|
|
|
6322
6872
|
? new SessionStorageSendBuffer(diagLog, _self._senderConfig) : new ArraySendBuffer(diagLog, _self._senderConfig);
|
|
6323
6873
|
_self._sample = new Sample(_self._senderConfig.samplingPercentage(), diagLog);
|
|
6324
6874
|
if (!_validateInstrumentationKey(config)) {
|
|
6325
|
-
diagLog.throwInternal(
|
|
6875
|
+
diagLog.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidInstrumentationKey, "Invalid Instrumentation key " + config.instrumentationKey);
|
|
6326
6876
|
}
|
|
6327
6877
|
if (!isInternalApplicationInsightsEndpoint(_self._senderConfig.endpointUrl()) && _self._senderConfig.customHeaders() && _self._senderConfig.customHeaders().length > 0) {
|
|
6328
6878
|
arrForEach(_self._senderConfig.customHeaders(), function (customHeader) {
|
|
@@ -6368,22 +6918,22 @@
|
|
|
6368
6918
|
return;
|
|
6369
6919
|
}
|
|
6370
6920
|
if (!telemetryItem) {
|
|
6371
|
-
itemCtx.diagLog().throwInternal(
|
|
6921
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSendEmptyTelemetry, "Cannot send empty telemetry");
|
|
6372
6922
|
return;
|
|
6373
6923
|
}
|
|
6374
6924
|
if (telemetryItem.baseData && !telemetryItem.baseType) {
|
|
6375
|
-
itemCtx.diagLog().throwInternal(
|
|
6925
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidEvent, "Cannot send telemetry without baseData and baseType");
|
|
6376
6926
|
return;
|
|
6377
6927
|
}
|
|
6378
6928
|
if (!telemetryItem.baseType) {
|
|
6379
6929
|
telemetryItem.baseType = "EventData";
|
|
6380
6930
|
}
|
|
6381
6931
|
if (!_self._sender) {
|
|
6382
|
-
itemCtx.diagLog().throwInternal(
|
|
6932
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, "Sender was not initialized");
|
|
6383
6933
|
return;
|
|
6384
6934
|
}
|
|
6385
6935
|
if (!_isSampledIn(telemetryItem)) {
|
|
6386
|
-
itemCtx.diagLog().throwInternal(
|
|
6936
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TelemetrySampledAndNotSent, "Telemetry item was sampled out and not sent", { SampleRate: _self._sample.sampleRate });
|
|
6387
6937
|
return;
|
|
6388
6938
|
}
|
|
6389
6939
|
else {
|
|
@@ -6393,7 +6943,7 @@
|
|
|
6393
6943
|
var defaultEnvelopeIkey = telemetryItem.iKey || _self._senderConfig.instrumentationKey();
|
|
6394
6944
|
var aiEnvelope_1 = Sender.constructEnvelope(telemetryItem, defaultEnvelopeIkey, itemCtx.diagLog(), convertUndefined);
|
|
6395
6945
|
if (!aiEnvelope_1) {
|
|
6396
|
-
itemCtx.diagLog().throwInternal(
|
|
6946
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CreateEnvelopeError, "Unable to create an AppInsights envelope");
|
|
6397
6947
|
return;
|
|
6398
6948
|
}
|
|
6399
6949
|
var doNotSendItem_1 = false;
|
|
@@ -6406,7 +6956,7 @@
|
|
|
6406
6956
|
}
|
|
6407
6957
|
}
|
|
6408
6958
|
catch (e) {
|
|
6409
|
-
itemCtx.diagLog().throwInternal(
|
|
6959
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
|
|
6410
6960
|
}
|
|
6411
6961
|
});
|
|
6412
6962
|
delete telemetryItem.tags[ProcessLegacy];
|
|
@@ -6424,7 +6974,7 @@
|
|
|
6424
6974
|
_setupTimer();
|
|
6425
6975
|
}
|
|
6426
6976
|
catch (e) {
|
|
6427
|
-
itemCtx.diagLog().throwInternal(
|
|
6977
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedAddingTelemetryToBuffer, "Failed adding telemetry to the sender's buffer, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
6428
6978
|
}
|
|
6429
6979
|
_self.processNext(telemetryItem, itemCtx);
|
|
6430
6980
|
};
|
|
@@ -6459,13 +7009,13 @@
|
|
|
6459
7009
|
catch (e) {
|
|
6460
7010
|
var ieVer = getIEVersion();
|
|
6461
7011
|
if (!ieVer || ieVer > 9) {
|
|
6462
|
-
_self.diagLog().throwInternal(
|
|
7012
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TransmissionFailed, "Telemetry transmission failed, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
6463
7013
|
}
|
|
6464
7014
|
}
|
|
6465
7015
|
}
|
|
6466
7016
|
};
|
|
6467
7017
|
_self._onError = function (payload, message, event) {
|
|
6468
|
-
_self.diagLog().throwInternal(
|
|
7018
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.OnError, "Failed to send telemetry.", { message: message });
|
|
6469
7019
|
_self._buffer.clearSent(payload);
|
|
6470
7020
|
};
|
|
6471
7021
|
_self._onPartialSuccess = function (payload, results) {
|
|
@@ -6490,7 +7040,7 @@
|
|
|
6490
7040
|
}
|
|
6491
7041
|
if (retry.length > 0) {
|
|
6492
7042
|
_resendPayload(retry);
|
|
6493
|
-
_self.diagLog().throwInternal(
|
|
7043
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, "Partial success. " +
|
|
6494
7044
|
"Delivered: " + payload.length + ", Failed: " + failed.length +
|
|
6495
7045
|
". Will retry to send " + retry.length + " our of " + results.itemsReceived + " items");
|
|
6496
7046
|
}
|
|
@@ -6535,7 +7085,7 @@
|
|
|
6535
7085
|
}
|
|
6536
7086
|
if (!_self._senderConfig.isRetryDisabled() && _isRetriable(status)) {
|
|
6537
7087
|
_resendPayload(payload);
|
|
6538
|
-
_self.diagLog().throwInternal(
|
|
7088
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
|
|
6539
7089
|
"Response code " + status + ". Will retry to send " + payload.length + " items.");
|
|
6540
7090
|
}
|
|
6541
7091
|
else {
|
|
@@ -6546,7 +7096,7 @@
|
|
|
6546
7096
|
if (!_self._senderConfig.isRetryDisabled()) {
|
|
6547
7097
|
var offlineBackOffMultiplier = 10;
|
|
6548
7098
|
_resendPayload(payload, offlineBackOffMultiplier);
|
|
6549
|
-
_self.diagLog().throwInternal(
|
|
7099
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". Offline - Response Code: ".concat(status, ". Offline status: ").concat(Offline.isOffline(), ". Will retry to send ").concat(payload.length, " items."));
|
|
6550
7100
|
}
|
|
6551
7101
|
}
|
|
6552
7102
|
else {
|
|
@@ -6614,7 +7164,7 @@
|
|
|
6614
7164
|
}
|
|
6615
7165
|
if (droppedPayload.length > 0) {
|
|
6616
7166
|
_fallbackSender(droppedPayload, true);
|
|
6617
|
-
_self.diagLog().throwInternal(
|
|
7167
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with normal sender.");
|
|
6618
7168
|
}
|
|
6619
7169
|
}
|
|
6620
7170
|
}
|
|
@@ -6655,7 +7205,7 @@
|
|
|
6655
7205
|
}
|
|
6656
7206
|
else {
|
|
6657
7207
|
_fallbackSender && _fallbackSender(payload, true);
|
|
6658
|
-
_self.diagLog().throwInternal(
|
|
7208
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with xhrSender.");
|
|
6659
7209
|
}
|
|
6660
7210
|
}
|
|
6661
7211
|
}
|
|
@@ -6746,7 +7296,7 @@
|
|
|
6746
7296
|
}
|
|
6747
7297
|
}
|
|
6748
7298
|
catch (e) {
|
|
6749
|
-
_self.diagLog().throwInternal(
|
|
7299
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidBackendResponse, "Cannot parse the response. " + getExceptionName(e), {
|
|
6750
7300
|
response: response
|
|
6751
7301
|
});
|
|
6752
7302
|
}
|
|
@@ -6817,7 +7367,7 @@
|
|
|
6817
7367
|
xdr.onerror = function (event) { return _self._onError(payload, _formatErrorMessageXdr(xdr), event); };
|
|
6818
7368
|
var hostingProtocol = _window && _window.location && _window.location.protocol || "";
|
|
6819
7369
|
if (_self._senderConfig.endpointUrl().lastIndexOf(hostingProtocol, 0) !== 0) {
|
|
6820
|
-
_self.diagLog().throwInternal(
|
|
7370
|
+
_self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
|
|
6821
7371
|
"Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.");
|
|
6822
7372
|
buffer.clear();
|
|
6823
7373
|
return;
|
|
@@ -6848,7 +7398,7 @@
|
|
|
6848
7398
|
manager.eventsSendRequest(sendRequest, isAsync);
|
|
6849
7399
|
}
|
|
6850
7400
|
catch (e) {
|
|
6851
|
-
_self.diagLog().throwInternal(
|
|
7401
|
+
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.NotificationException, "send request notification failed: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
6852
7402
|
}
|
|
6853
7403
|
}
|
|
6854
7404
|
}
|
|
@@ -6959,10 +7509,10 @@
|
|
|
6959
7509
|
var acqMs = +tokens[1] || 0;
|
|
6960
7510
|
var renewalMs = +tokens[2] || 0;
|
|
6961
7511
|
if (isNaN(acqMs) || acqMs <= 0) {
|
|
6962
|
-
_logger.throwInternal(
|
|
7512
|
+
_logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionRenewalDateIsZero, "AI session acquisition date is 0" + sessionReset);
|
|
6963
7513
|
}
|
|
6964
7514
|
else if (isNaN(renewalMs) || renewalMs <= 0) {
|
|
6965
|
-
_logger.throwInternal(
|
|
7515
|
+
_logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionRenewalDateIsZero, "AI session renewal date is 0" + sessionReset);
|
|
6966
7516
|
}
|
|
6967
7517
|
else if (tokens[0]) {
|
|
6968
7518
|
session.id = tokens[0];
|
|
@@ -6972,7 +7522,7 @@
|
|
|
6972
7522
|
}
|
|
6973
7523
|
}
|
|
6974
7524
|
catch (e) {
|
|
6975
|
-
_logger.throwInternal(
|
|
7525
|
+
_logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ErrorParsingAISessionCookie, "Error parsing ai_session value [" + (sessionData || "") + "]" + sessionReset + " - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
6976
7526
|
}
|
|
6977
7527
|
}
|
|
6978
7528
|
return isValid;
|
|
@@ -6984,7 +7534,7 @@
|
|
|
6984
7534
|
_self.automaticSession.acquisitionDate = nowMs;
|
|
6985
7535
|
_setCookie(_self.automaticSession, nowMs);
|
|
6986
7536
|
if (!utlCanUseLocalStorage()) {
|
|
6987
|
-
_logger.throwInternal(
|
|
7537
|
+
_logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserDoesNotSupportLocalStorage, "Browser does not support local storage. Session durations will be inaccurate.");
|
|
6988
7538
|
}
|
|
6989
7539
|
}
|
|
6990
7540
|
function _setCookie(session, nowMs) {
|
|
@@ -7030,7 +7580,7 @@
|
|
|
7030
7580
|
return Device;
|
|
7031
7581
|
}());
|
|
7032
7582
|
|
|
7033
|
-
var Version = "2.8.0-beta.
|
|
7583
|
+
var Version = "2.8.0-beta.2203-03";
|
|
7034
7584
|
var Internal = /** @class */ (function () {
|
|
7035
7585
|
function Internal(config) {
|
|
7036
7586
|
this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + Version;
|
|
@@ -7106,7 +7656,7 @@
|
|
|
7106
7656
|
if (storeInCookie === void 0) { storeInCookie = false; }
|
|
7107
7657
|
var isInvalidInput = !_validateUserInput(authenticatedUserId) || (accountId && !_validateUserInput(accountId));
|
|
7108
7658
|
if (isInvalidInput) {
|
|
7109
|
-
_logger.throwInternal(
|
|
7659
|
+
_logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SetAuthContextFailedAccountName, "Setting auth user context failed. " +
|
|
7110
7660
|
"User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.", true);
|
|
7111
7661
|
return;
|
|
7112
7662
|
}
|
|
@@ -7324,7 +7874,7 @@
|
|
|
7324
7874
|
if (userCtx && userCtx.isNewUser) {
|
|
7325
7875
|
userCtx.isNewUser = false;
|
|
7326
7876
|
var message = new _InternalLogMessage(_InternalMessageId.SendBrowserInfoOnUserInit, ((getNavigator() || {}).userAgent || ""));
|
|
7327
|
-
itemCtx.diagLog().logInternalMessage(
|
|
7877
|
+
itemCtx.diagLog().logInternalMessage(LoggingSeverity.CRITICAL, message);
|
|
7328
7878
|
}
|
|
7329
7879
|
_self.processNext(event, itemCtx);
|
|
7330
7880
|
}
|
|
@@ -7673,10 +8223,10 @@
|
|
|
7673
8223
|
return result;
|
|
7674
8224
|
}
|
|
7675
8225
|
function _throwInternalCritical(ajaxMonitorInstance, msgId, message, properties, isUserAct) {
|
|
7676
|
-
ajaxMonitorInstance[strDiagLog]()[strThrowInternal](
|
|
8226
|
+
ajaxMonitorInstance[strDiagLog]()[strThrowInternal](LoggingSeverity.CRITICAL, msgId, message, properties, isUserAct);
|
|
7677
8227
|
}
|
|
7678
8228
|
function _throwInternalWarning(ajaxMonitorInstance, msgId, message, properties, isUserAct) {
|
|
7679
|
-
ajaxMonitorInstance[strDiagLog]()[strThrowInternal](
|
|
8229
|
+
ajaxMonitorInstance[strDiagLog]()[strThrowInternal](LoggingSeverity.WARNING, msgId, message, properties, isUserAct);
|
|
7680
8230
|
}
|
|
7681
8231
|
function _createErrorCallbackFunc(ajaxMonitorInstance, internalMessage, message) {
|
|
7682
8232
|
return function (args) {
|
|
@@ -7714,19 +8264,21 @@
|
|
|
7714
8264
|
var _enableAjaxPerfTracking = false;
|
|
7715
8265
|
var _maxAjaxCallsPerView = 0;
|
|
7716
8266
|
var _enableResponseHeaderTracking = false;
|
|
7717
|
-
var _hooks = [];
|
|
7718
8267
|
var _disabledUrls = {};
|
|
7719
8268
|
var _excludeRequestFromAutoTrackingPatterns;
|
|
7720
8269
|
var _addRequestContext;
|
|
7721
|
-
|
|
8270
|
+
var _evtNamespace;
|
|
8271
|
+
dynamicProto(AjaxMonitor, _this, function (_self, _base) {
|
|
8272
|
+
var _addHook = _base._addHook;
|
|
7722
8273
|
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
7723
8274
|
if (!_self.isInitialized()) {
|
|
7724
|
-
|
|
8275
|
+
_base.initialize(config, core, extensions, pluginChain);
|
|
7725
8276
|
var ctx_1 = _self._getTelCtx();
|
|
7726
8277
|
var defaultConfig = AjaxMonitor.getDefaultConfig();
|
|
7727
8278
|
objForEachKey(defaultConfig, function (field, value) {
|
|
7728
8279
|
_config[field] = ctx_1.getConfig(AjaxMonitor.identifier, field, value);
|
|
7729
8280
|
});
|
|
8281
|
+
_evtNamespace = mergeEvtNamespace(createUniqueNamespace("ajax"), core && core.evtNamespace && core.evtNamespace());
|
|
7730
8282
|
var distributedTracingMode = _config.distributedTracingMode;
|
|
7731
8283
|
_enableRequestHeaderTracking = _config.enableRequestHeaderTracking;
|
|
7732
8284
|
_enableAjaxErrorStatusText = _config.enableAjaxErrorStatusText;
|
|
@@ -7735,8 +8287,8 @@
|
|
|
7735
8287
|
_enableResponseHeaderTracking = _config.enableResponseHeaderTracking;
|
|
7736
8288
|
_excludeRequestFromAutoTrackingPatterns = _config.excludeRequestFromAutoTrackingPatterns;
|
|
7737
8289
|
_addRequestContext = _config.addRequestContext;
|
|
7738
|
-
_isUsingAIHeaders = distributedTracingMode ===
|
|
7739
|
-
_isUsingW3CHeaders = distributedTracingMode ===
|
|
8290
|
+
_isUsingAIHeaders = distributedTracingMode === 0 || distributedTracingMode === 1 ;
|
|
8291
|
+
_isUsingW3CHeaders = distributedTracingMode === 1 || distributedTracingMode === 2 ;
|
|
7740
8292
|
if (_enableAjaxPerfTracking) {
|
|
7741
8293
|
var iKey = config.instrumentationKey || "unkwn";
|
|
7742
8294
|
if (iKey.length > 5) {
|
|
@@ -7764,14 +8316,9 @@
|
|
|
7764
8316
|
}
|
|
7765
8317
|
}
|
|
7766
8318
|
};
|
|
7767
|
-
_self.
|
|
7768
|
-
arrForEach(_hooks, function (fn) {
|
|
7769
|
-
fn.rm();
|
|
7770
|
-
});
|
|
7771
|
-
_hooks = [];
|
|
8319
|
+
_self._doTeardown = function () {
|
|
7772
8320
|
_fetchInitialized = false;
|
|
7773
8321
|
_xhrInitialized = false;
|
|
7774
|
-
_self.setInitialized(false);
|
|
7775
8322
|
};
|
|
7776
8323
|
_self.trackDependencyData = function (dependency, properties) {
|
|
7777
8324
|
_self[strTrackDependencyDataInternal](dependency, properties);
|
|
@@ -7838,8 +8385,8 @@
|
|
|
7838
8385
|
};
|
|
7839
8386
|
_self[strTrackDependencyDataInternal] = function (dependency, properties, systemProperties) {
|
|
7840
8387
|
if (_maxAjaxCallsPerView === -1 || _trackAjaxAttempts < _maxAjaxCallsPerView) {
|
|
7841
|
-
if ((_config.distributedTracingMode ===
|
|
7842
|
-
|| _config.distributedTracingMode ===
|
|
8388
|
+
if ((_config.distributedTracingMode === 2
|
|
8389
|
+
|| _config.distributedTracingMode === 1 )
|
|
7843
8390
|
&& typeof dependency.id === "string" && dependency.id[dependency.id.length - 1] !== ".") {
|
|
7844
8391
|
dependency.id += ".";
|
|
7845
8392
|
}
|
|
@@ -7874,7 +8421,7 @@
|
|
|
7874
8421
|
var global = getGlobal();
|
|
7875
8422
|
var isPolyfill = fetch.polyfill;
|
|
7876
8423
|
if (_config.disableFetchTracking === false) {
|
|
7877
|
-
|
|
8424
|
+
_addHook(InstrumentFunc(global, strFetch, {
|
|
7878
8425
|
req: function (callDetails, input, init) {
|
|
7879
8426
|
var fetchData;
|
|
7880
8427
|
if (_fetchInitialized &&
|
|
@@ -7922,7 +8469,7 @@
|
|
|
7922
8469
|
_fetchInitialized = true;
|
|
7923
8470
|
}
|
|
7924
8471
|
else if (isPolyfill) {
|
|
7925
|
-
|
|
8472
|
+
_addHook(InstrumentFunc(global, strFetch, {
|
|
7926
8473
|
req: function (callDetails, input, init) {
|
|
7927
8474
|
_isDisabledRequest(null, input, init);
|
|
7928
8475
|
}
|
|
@@ -7933,7 +8480,7 @@
|
|
|
7933
8480
|
}
|
|
7934
8481
|
}
|
|
7935
8482
|
function _hookProto(target, funcName, callbacks) {
|
|
7936
|
-
|
|
8483
|
+
_addHook(InstrumentProto(target, funcName, callbacks));
|
|
7937
8484
|
}
|
|
7938
8485
|
function _instrumentXhr() {
|
|
7939
8486
|
if (_supportsAjaxMonitoring(_self) && !_xhrInitialized) {
|
|
@@ -8055,7 +8602,7 @@
|
|
|
8055
8602
|
xhr[strAjaxData] = ajaxData;
|
|
8056
8603
|
}
|
|
8057
8604
|
function _attachToOnReadyStateChange(xhr) {
|
|
8058
|
-
xhr[strAjaxData].xhrMonitoringState.stateChangeAttached =
|
|
8605
|
+
xhr[strAjaxData].xhrMonitoringState.stateChangeAttached = eventOn(xhr, "readystatechange", function () {
|
|
8059
8606
|
try {
|
|
8060
8607
|
if (xhr && xhr.readyState === 4 && _isMonitoredXhrInstance(xhr)) {
|
|
8061
8608
|
_onAjaxComplete(xhr);
|
|
@@ -8070,7 +8617,7 @@
|
|
|
8070
8617
|
});
|
|
8071
8618
|
}
|
|
8072
8619
|
}
|
|
8073
|
-
});
|
|
8620
|
+
}, _evtNamespace);
|
|
8074
8621
|
}
|
|
8075
8622
|
function _getResponseText(xhr) {
|
|
8076
8623
|
try {
|
|
@@ -8355,7 +8902,7 @@
|
|
|
8355
8902
|
disableFetchTracking: true,
|
|
8356
8903
|
excludeRequestFromAutoTrackingPatterns: undefined,
|
|
8357
8904
|
disableCorrelationHeaders: false,
|
|
8358
|
-
distributedTracingMode:
|
|
8905
|
+
distributedTracingMode: 1 ,
|
|
8359
8906
|
correlationHeaderExcludedDomains: [
|
|
8360
8907
|
"*.blob.core.windows.net",
|
|
8361
8908
|
"*.blob.core.chinacloudapi.cn",
|
|
@@ -8441,7 +8988,7 @@
|
|
|
8441
8988
|
TelemetryItemCreator: TelemetryItemCreator,
|
|
8442
8989
|
CtxTagKeys: CtxTagKeys,
|
|
8443
8990
|
Extensions: Extensions,
|
|
8444
|
-
DistributedTracingModes:
|
|
8991
|
+
DistributedTracingModes: DistributedTracingModes
|
|
8445
8992
|
};
|
|
8446
8993
|
var Initialization = /** @class */ (function () {
|
|
8447
8994
|
function Initialization(snippet) {
|
|
@@ -8640,7 +9187,7 @@
|
|
|
8640
9187
|
added = addPageUnloadEventListener(performHousekeeping, excludePageUnloadEvents);
|
|
8641
9188
|
added = addPageHideEventListener(performHousekeeping, excludePageUnloadEvents) || added;
|
|
8642
9189
|
if (!added && !isReactNative()) {
|
|
8643
|
-
appInsightsInstance.appInsights.core.logger.throwInternal(
|
|
9190
|
+
appInsightsInstance.appInsights.core.logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToAddHandlerForOnBeforeUnload, "Could not add handler for beforeunload and pagehide");
|
|
8644
9191
|
}
|
|
8645
9192
|
}
|
|
8646
9193
|
if (!added && !appInsightsInstance.appInsights.config.disableFlushOnUnload) {
|
|
@@ -8888,8 +9435,10 @@
|
|
|
8888
9435
|
exports.BaseTelemetryPlugin = BaseTelemetryPlugin;
|
|
8889
9436
|
exports.CoreUtils = CoreUtils;
|
|
8890
9437
|
exports.DependenciesPlugin = AjaxMonitor;
|
|
9438
|
+
exports.DistributedTracingModes = DistributedTracingModes;
|
|
8891
9439
|
exports.Event = Event$1;
|
|
8892
9440
|
exports.Exception = Exception;
|
|
9441
|
+
exports.LoggingSeverity = LoggingSeverity;
|
|
8893
9442
|
exports.Metric = Metric;
|
|
8894
9443
|
exports.NotificationManager = NotificationManager;
|
|
8895
9444
|
exports.PageView = PageView;
|