@microsoft/applicationinsights-react-js 3.3.0-beta.2202-07 → 3.3.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/browser/applicationinsights-react-js.js +629 -291
- package/browser/applicationinsights-react-js.js.map +1 -1
- package/browser/applicationinsights-react-js.min.js +2 -2
- package/browser/applicationinsights-react-js.min.js.map +1 -1
- package/dist/applicationinsights-react-js.d.ts +1 -1
- package/dist/applicationinsights-react-js.js +629 -291
- package/dist/applicationinsights-react-js.js.map +1 -1
- package/dist/applicationinsights-react-js.min.js +2 -2
- package/dist/applicationinsights-react-js.min.js.map +1 -1
- package/dist/applicationinsights-react-js.rollup.d.ts +1 -1
- package/dist-esm/AppInsightsContext.js +1 -1
- package/dist-esm/AppInsightsErrorBoundary.js +1 -1
- package/dist-esm/Interfaces/IReactExtensionConfig.js +1 -1
- package/dist-esm/ReactPlugin.js +1 -1
- package/dist-esm/applicationinsights-react-js.js +1 -1
- package/dist-esm/useTrackEvent.js +1 -1
- package/dist-esm/useTrackMetric.js +1 -1
- package/dist-esm/withAITracking.js +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - React Plugin, 3.3.0-beta.
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 3.3.0-beta.2203-03
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -358,99 +358,14 @@
|
|
|
358
358
|
};
|
|
359
359
|
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
360
360
|
|
|
361
|
-
var
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
var
|
|
367
|
-
|
|
368
|
-
BrowserCannotReadLocalStorage: 1,
|
|
369
|
-
BrowserCannotReadSessionStorage: 2,
|
|
370
|
-
BrowserCannotWriteLocalStorage: 3,
|
|
371
|
-
BrowserCannotWriteSessionStorage: 4,
|
|
372
|
-
BrowserFailedRemovalFromLocalStorage: 5,
|
|
373
|
-
BrowserFailedRemovalFromSessionStorage: 6,
|
|
374
|
-
CannotSendEmptyTelemetry: 7,
|
|
375
|
-
ClientPerformanceMathError: 8,
|
|
376
|
-
ErrorParsingAISessionCookie: 9,
|
|
377
|
-
ErrorPVCalc: 10,
|
|
378
|
-
ExceptionWhileLoggingError: 11,
|
|
379
|
-
FailedAddingTelemetryToBuffer: 12,
|
|
380
|
-
FailedMonitorAjaxAbort: 13,
|
|
381
|
-
FailedMonitorAjaxDur: 14,
|
|
382
|
-
FailedMonitorAjaxOpen: 15,
|
|
383
|
-
FailedMonitorAjaxRSC: 16,
|
|
384
|
-
FailedMonitorAjaxSend: 17,
|
|
385
|
-
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
386
|
-
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
387
|
-
FailedToSendQueuedTelemetry: 20,
|
|
388
|
-
FailedToReportDataLoss: 21,
|
|
389
|
-
FlushFailed: 22,
|
|
390
|
-
MessageLimitPerPVExceeded: 23,
|
|
391
|
-
MissingRequiredFieldSpecification: 24,
|
|
392
|
-
NavigationTimingNotSupported: 25,
|
|
393
|
-
OnError: 26,
|
|
394
|
-
SessionRenewalDateIsZero: 27,
|
|
395
|
-
SenderNotInitialized: 28,
|
|
396
|
-
StartTrackEventFailed: 29,
|
|
397
|
-
StopTrackEventFailed: 30,
|
|
398
|
-
StartTrackFailed: 31,
|
|
399
|
-
StopTrackFailed: 32,
|
|
400
|
-
TelemetrySampledAndNotSent: 33,
|
|
401
|
-
TrackEventFailed: 34,
|
|
402
|
-
TrackExceptionFailed: 35,
|
|
403
|
-
TrackMetricFailed: 36,
|
|
404
|
-
TrackPVFailed: 37,
|
|
405
|
-
TrackPVFailedCalc: 38,
|
|
406
|
-
TrackTraceFailed: 39,
|
|
407
|
-
TransmissionFailed: 40,
|
|
408
|
-
FailedToSetStorageBuffer: 41,
|
|
409
|
-
FailedToRestoreStorageBuffer: 42,
|
|
410
|
-
InvalidBackendResponse: 43,
|
|
411
|
-
FailedToFixDepricatedValues: 44,
|
|
412
|
-
InvalidDurationValue: 45,
|
|
413
|
-
TelemetryEnvelopeInvalid: 46,
|
|
414
|
-
CreateEnvelopeError: 47,
|
|
415
|
-
CannotSerializeObject: 48,
|
|
416
|
-
CannotSerializeObjectNonSerializable: 49,
|
|
417
|
-
CircularReferenceDetected: 50,
|
|
418
|
-
ClearAuthContextFailed: 51,
|
|
419
|
-
ExceptionTruncated: 52,
|
|
420
|
-
IllegalCharsInName: 53,
|
|
421
|
-
ItemNotInArray: 54,
|
|
422
|
-
MaxAjaxPerPVExceeded: 55,
|
|
423
|
-
MessageTruncated: 56,
|
|
424
|
-
NameTooLong: 57,
|
|
425
|
-
SampleRateOutOfRange: 58,
|
|
426
|
-
SetAuthContextFailed: 59,
|
|
427
|
-
SetAuthContextFailedAccountName: 60,
|
|
428
|
-
StringValueTooLong: 61,
|
|
429
|
-
StartCalledMoreThanOnce: 62,
|
|
430
|
-
StopCalledWithoutStart: 63,
|
|
431
|
-
TelemetryInitializerFailed: 64,
|
|
432
|
-
TrackArgumentsNotSpecified: 65,
|
|
433
|
-
UrlTooLong: 66,
|
|
434
|
-
SessionStorageBufferFull: 67,
|
|
435
|
-
CannotAccessCookie: 68,
|
|
436
|
-
IdTooLong: 69,
|
|
437
|
-
InvalidEvent: 70,
|
|
438
|
-
FailedMonitorAjaxSetRequestHeader: 71,
|
|
439
|
-
SendBrowserInfoOnUserInit: 72,
|
|
440
|
-
PluginException: 73,
|
|
441
|
-
NotificationException: 74,
|
|
442
|
-
SnippetScriptLoadFailure: 99,
|
|
443
|
-
InvalidInstrumentationKey: 100,
|
|
444
|
-
CannotParseAiBlobValue: 101,
|
|
445
|
-
InvalidContentBlob: 102,
|
|
446
|
-
TrackPageActionEventFailed: 103,
|
|
447
|
-
FailedAddingCustomDefinedRequestContext: 104,
|
|
448
|
-
InMemoryStorageBufferFull: 105
|
|
449
|
-
};
|
|
361
|
+
var strEmpty = "";
|
|
362
|
+
var strSetNextPlugin = "setNextPlugin";
|
|
363
|
+
var strIsInitialized = "isInitialized";
|
|
364
|
+
var strTeardown = "teardown";
|
|
365
|
+
var strCore = "core";
|
|
366
|
+
var strDisabled = "disabled";
|
|
367
|
+
var strDoTeardown = "_doTeardown";
|
|
450
368
|
|
|
451
|
-
var strOnPrefix = "on";
|
|
452
|
-
var strAttachEvent = "attachEvent";
|
|
453
|
-
var strAddEventHelper = "addEventListener";
|
|
454
369
|
var strToISOString = "toISOString";
|
|
455
370
|
var cStrEndsWith = "endsWith";
|
|
456
371
|
var strIndexOf = "indexOf";
|
|
@@ -460,7 +375,7 @@
|
|
|
460
375
|
var strToString = "toString";
|
|
461
376
|
var str__Proto = "__proto__";
|
|
462
377
|
var strConstructor = "constructor";
|
|
463
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
378
|
+
var _objDefineProperty$1 = ObjDefineProperty;
|
|
464
379
|
var _objFreeze = ObjClass.freeze;
|
|
465
380
|
var _objKeys = ObjClass.keys;
|
|
466
381
|
var StringProto = String[strShimPrototype];
|
|
@@ -472,6 +387,9 @@
|
|
|
472
387
|
var _objToString = ObjProto[strToString];
|
|
473
388
|
var _fnToString = ObjHasOwnProperty[strToString];
|
|
474
389
|
var _objFunctionString = _fnToString.call(ObjClass);
|
|
390
|
+
var rCamelCase = /-([a-z])/g;
|
|
391
|
+
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
392
|
+
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
475
393
|
var _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
476
394
|
function _getObjProto(target) {
|
|
477
395
|
if (target) {
|
|
@@ -506,24 +424,18 @@
|
|
|
506
424
|
function isFunction(value) {
|
|
507
425
|
return !!(value && typeof value === strShimFunction);
|
|
508
426
|
}
|
|
509
|
-
function
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
520
|
-
result = true;
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
catch (e) {
|
|
524
|
-
}
|
|
427
|
+
function normalizeJsName(name) {
|
|
428
|
+
var value = name;
|
|
429
|
+
if (value && isString(value)) {
|
|
430
|
+
value = value.replace(rCamelCase, function (_all, letter) {
|
|
431
|
+
return letter.toUpperCase();
|
|
432
|
+
});
|
|
433
|
+
value = value.replace(rNormalizeInvalid, "_");
|
|
434
|
+
value = value.replace(rLeadingNumeric, function (_all, match) {
|
|
435
|
+
return "_" + match;
|
|
436
|
+
});
|
|
525
437
|
}
|
|
526
|
-
return
|
|
438
|
+
return value;
|
|
527
439
|
}
|
|
528
440
|
function objForEachKey(target, callbackfn) {
|
|
529
441
|
if (target) {
|
|
@@ -743,7 +655,7 @@
|
|
|
743
655
|
return result;
|
|
744
656
|
}
|
|
745
657
|
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
746
|
-
if (_objDefineProperty) {
|
|
658
|
+
if (_objDefineProperty$1) {
|
|
747
659
|
try {
|
|
748
660
|
var descriptor = {
|
|
749
661
|
enumerable: true,
|
|
@@ -755,7 +667,7 @@
|
|
|
755
667
|
if (setProp) {
|
|
756
668
|
descriptor.set = setProp;
|
|
757
669
|
}
|
|
758
|
-
_objDefineProperty(target, prop, descriptor);
|
|
670
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
759
671
|
return true;
|
|
760
672
|
}
|
|
761
673
|
catch (e) {
|
|
@@ -775,7 +687,7 @@
|
|
|
775
687
|
if (isError(object)) {
|
|
776
688
|
return object.name;
|
|
777
689
|
}
|
|
778
|
-
return
|
|
690
|
+
return strEmpty;
|
|
779
691
|
}
|
|
780
692
|
function setValue(target, field, value, valChk, srcChk) {
|
|
781
693
|
var theValue = value;
|
|
@@ -791,6 +703,47 @@
|
|
|
791
703
|
function isTruthy(value) {
|
|
792
704
|
return !!value;
|
|
793
705
|
}
|
|
706
|
+
function throwError(message) {
|
|
707
|
+
throw new Error(message);
|
|
708
|
+
}
|
|
709
|
+
function _createProxyFunction(source, funcName) {
|
|
710
|
+
var srcFunc = null;
|
|
711
|
+
var src = null;
|
|
712
|
+
if (isFunction(source)) {
|
|
713
|
+
srcFunc = source;
|
|
714
|
+
}
|
|
715
|
+
else {
|
|
716
|
+
src = source;
|
|
717
|
+
}
|
|
718
|
+
return function () {
|
|
719
|
+
var originalArguments = arguments;
|
|
720
|
+
if (srcFunc) {
|
|
721
|
+
src = srcFunc();
|
|
722
|
+
}
|
|
723
|
+
if (src) {
|
|
724
|
+
return src[funcName].apply(src, originalArguments);
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
729
|
+
if (overwriteTarget === void 0) { overwriteTarget = true; }
|
|
730
|
+
if (target && name && source) {
|
|
731
|
+
if (overwriteTarget || isUndefined(target[name])) {
|
|
732
|
+
target[name] = _createProxyFunction(source, theFunc);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
function createEnumStyle(values) {
|
|
737
|
+
var enumClass = {};
|
|
738
|
+
objForEachKey(values, function (field, value) {
|
|
739
|
+
enumClass[field] = value;
|
|
740
|
+
if (!isUndefined(enumClass[value])) {
|
|
741
|
+
throwError("[" + value + "] exists for " + field);
|
|
742
|
+
}
|
|
743
|
+
enumClass[value] = field;
|
|
744
|
+
});
|
|
745
|
+
return objFreeze(enumClass);
|
|
746
|
+
}
|
|
794
747
|
function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
|
|
795
748
|
var theArgs = arguments;
|
|
796
749
|
var extended = theArgs[0] || {};
|
|
@@ -927,14 +880,14 @@
|
|
|
927
880
|
var nav = getNavigator();
|
|
928
881
|
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
929
882
|
_navUserAgentCheck = nav.userAgent;
|
|
930
|
-
var userAgent = (_navUserAgentCheck ||
|
|
883
|
+
var userAgent = (_navUserAgentCheck || strEmpty).toLowerCase();
|
|
931
884
|
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
932
885
|
}
|
|
933
886
|
return _isTrident;
|
|
934
887
|
}
|
|
935
888
|
function dumpObj(object) {
|
|
936
889
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
937
|
-
var propertyValueDump =
|
|
890
|
+
var propertyValueDump = strEmpty;
|
|
938
891
|
if (objectTypeDump === "[object Error]") {
|
|
939
892
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
940
893
|
}
|
|
@@ -967,9 +920,9 @@
|
|
|
967
920
|
var strWarnToConsole = "warnToConsole";
|
|
968
921
|
function _sanitizeDiagnosticText(text) {
|
|
969
922
|
if (text) {
|
|
970
|
-
return "\"" + text.replace(/\"/g,
|
|
923
|
+
return "\"" + text.replace(/\"/g, strEmpty) + "\"";
|
|
971
924
|
}
|
|
972
|
-
return
|
|
925
|
+
return strEmpty;
|
|
973
926
|
}
|
|
974
927
|
function _logToConsole(func, message) {
|
|
975
928
|
var theConsole = getConsole();
|
|
@@ -991,12 +944,12 @@
|
|
|
991
944
|
_self.message =
|
|
992
945
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
993
946
|
msgId;
|
|
994
|
-
var strProps =
|
|
947
|
+
var strProps = strEmpty;
|
|
995
948
|
if (hasJSON()) {
|
|
996
949
|
strProps = getJSON().stringify(properties);
|
|
997
950
|
}
|
|
998
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
999
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
951
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty) +
|
|
952
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty);
|
|
1000
953
|
_self.message += diagnosticText;
|
|
1001
954
|
}
|
|
1002
955
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -1026,7 +979,7 @@
|
|
|
1026
979
|
throw message;
|
|
1027
980
|
}
|
|
1028
981
|
else {
|
|
1029
|
-
var logFunc = severity ===
|
|
982
|
+
var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
|
|
1030
983
|
if (!isUndefined(message.message)) {
|
|
1031
984
|
var logLevel = _self.consoleLoggingLevel();
|
|
1032
985
|
if (isUserAct) {
|
|
@@ -1044,7 +997,7 @@
|
|
|
1044
997
|
_self.logInternalMessage(severity, message);
|
|
1045
998
|
}
|
|
1046
999
|
else {
|
|
1047
|
-
_debugExtMsg("throw" + (severity ===
|
|
1000
|
+
_debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
|
|
1048
1001
|
}
|
|
1049
1002
|
}
|
|
1050
1003
|
};
|
|
@@ -1076,13 +1029,13 @@
|
|
|
1076
1029
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
1077
1030
|
_self.queue.push(message);
|
|
1078
1031
|
_messageCount++;
|
|
1079
|
-
_debugExtMsg((severity ===
|
|
1032
|
+
_debugExtMsg((severity === 1 ? "error" : "warn"), message);
|
|
1080
1033
|
}
|
|
1081
1034
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
1082
1035
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
1083
|
-
var throttleMessage = new _InternalLogMessage(
|
|
1036
|
+
var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
|
|
1084
1037
|
_self.queue.push(throttleMessage);
|
|
1085
|
-
if (severity ===
|
|
1038
|
+
if (severity === 1 ) {
|
|
1086
1039
|
_self.errorToConsole(throttleLimitMessage);
|
|
1087
1040
|
}
|
|
1088
1041
|
else {
|
|
@@ -1224,6 +1177,165 @@
|
|
|
1224
1177
|
return func();
|
|
1225
1178
|
}
|
|
1226
1179
|
|
|
1180
|
+
var UInt32Mask = 0x100000000;
|
|
1181
|
+
var MaxUInt32 = 0xffffffff;
|
|
1182
|
+
var _mwcSeeded = false;
|
|
1183
|
+
var _mwcW = 123456789;
|
|
1184
|
+
var _mwcZ = 987654321;
|
|
1185
|
+
function _mwcSeed(seedValue) {
|
|
1186
|
+
if (seedValue < 0) {
|
|
1187
|
+
seedValue >>>= 0;
|
|
1188
|
+
}
|
|
1189
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
1190
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
1191
|
+
_mwcSeeded = true;
|
|
1192
|
+
}
|
|
1193
|
+
function _autoSeedMwc() {
|
|
1194
|
+
try {
|
|
1195
|
+
var now = dateNow() & 0x7fffffff;
|
|
1196
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
1197
|
+
}
|
|
1198
|
+
catch (e) {
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
function randomValue(maxValue) {
|
|
1202
|
+
if (maxValue > 0) {
|
|
1203
|
+
return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
|
|
1204
|
+
}
|
|
1205
|
+
return 0;
|
|
1206
|
+
}
|
|
1207
|
+
function random32(signed) {
|
|
1208
|
+
var value = 0;
|
|
1209
|
+
var c = getCrypto() || getMsCrypto();
|
|
1210
|
+
if (c && c.getRandomValues) {
|
|
1211
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1212
|
+
}
|
|
1213
|
+
if (value === 0 && isIE()) {
|
|
1214
|
+
if (!_mwcSeeded) {
|
|
1215
|
+
_autoSeedMwc();
|
|
1216
|
+
}
|
|
1217
|
+
value = mwcRandom32() & MaxUInt32;
|
|
1218
|
+
}
|
|
1219
|
+
if (value === 0) {
|
|
1220
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1221
|
+
}
|
|
1222
|
+
if (!signed) {
|
|
1223
|
+
value >>>= 0;
|
|
1224
|
+
}
|
|
1225
|
+
return value;
|
|
1226
|
+
}
|
|
1227
|
+
function mwcRandomSeed(value) {
|
|
1228
|
+
if (!value) {
|
|
1229
|
+
_autoSeedMwc();
|
|
1230
|
+
}
|
|
1231
|
+
else {
|
|
1232
|
+
_mwcSeed(value);
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
function mwcRandom32(signed) {
|
|
1236
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1237
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1238
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1239
|
+
if (!signed) {
|
|
1240
|
+
value >>>= 0;
|
|
1241
|
+
}
|
|
1242
|
+
return value;
|
|
1243
|
+
}
|
|
1244
|
+
function newId(maxLength) {
|
|
1245
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1246
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1247
|
+
var number = random32() >>> 0;
|
|
1248
|
+
var chars = 0;
|
|
1249
|
+
var result = strEmpty;
|
|
1250
|
+
while (result.length < maxLength) {
|
|
1251
|
+
chars++;
|
|
1252
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1253
|
+
number >>>= 6;
|
|
1254
|
+
if (chars === 5) {
|
|
1255
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1256
|
+
chars = 0;
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
return result;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
1263
|
+
var version = "2.7.3";
|
|
1264
|
+
var instanceName = "." + newId(6);
|
|
1265
|
+
var _dataUid = 0;
|
|
1266
|
+
function _createAccessor(target, prop, value) {
|
|
1267
|
+
if (_objDefineProperty) {
|
|
1268
|
+
try {
|
|
1269
|
+
_objDefineProperty(target, prop, {
|
|
1270
|
+
value: value,
|
|
1271
|
+
enumerable: false,
|
|
1272
|
+
configurable: true
|
|
1273
|
+
});
|
|
1274
|
+
return true;
|
|
1275
|
+
}
|
|
1276
|
+
catch (e) {
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
return false;
|
|
1280
|
+
}
|
|
1281
|
+
function _canAcceptData(target) {
|
|
1282
|
+
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1283
|
+
}
|
|
1284
|
+
function _getCache(data, target) {
|
|
1285
|
+
var theCache = target[data.id];
|
|
1286
|
+
if (!theCache) {
|
|
1287
|
+
theCache = {};
|
|
1288
|
+
try {
|
|
1289
|
+
if (_canAcceptData(target)) {
|
|
1290
|
+
if (!_createAccessor(target, data.id, theCache)) {
|
|
1291
|
+
target[data.id] = theCache;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
catch (e) {
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
return theCache;
|
|
1299
|
+
}
|
|
1300
|
+
function createUniqueNamespace(name, includeVersion) {
|
|
1301
|
+
if (includeVersion === void 0) { includeVersion = false; }
|
|
1302
|
+
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1303
|
+
}
|
|
1304
|
+
function createElmNodeData(name) {
|
|
1305
|
+
var data = {
|
|
1306
|
+
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1307
|
+
accept: function (target) {
|
|
1308
|
+
return _canAcceptData(target);
|
|
1309
|
+
},
|
|
1310
|
+
get: function (target, name, defValue, addDefault) {
|
|
1311
|
+
var theCache = target[data.id];
|
|
1312
|
+
if (!theCache) {
|
|
1313
|
+
if (addDefault) {
|
|
1314
|
+
theCache = _getCache(data, target);
|
|
1315
|
+
theCache[normalizeJsName(name)] = defValue;
|
|
1316
|
+
}
|
|
1317
|
+
return defValue;
|
|
1318
|
+
}
|
|
1319
|
+
return theCache[normalizeJsName(name)];
|
|
1320
|
+
},
|
|
1321
|
+
kill: function (target, name) {
|
|
1322
|
+
if (target && target[name]) {
|
|
1323
|
+
try {
|
|
1324
|
+
delete target[name];
|
|
1325
|
+
}
|
|
1326
|
+
catch (e) {
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
};
|
|
1331
|
+
return data;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1335
|
+
function _getPluginState(plugin) {
|
|
1336
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1227
1339
|
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1228
1340
|
var strHasRunFlags = "_hasRun";
|
|
1229
1341
|
var strGetTelCtx = "_getTelCtx";
|
|
@@ -1237,53 +1349,69 @@
|
|
|
1237
1349
|
}
|
|
1238
1350
|
return createTelemetryProxyChain([startAt], config, core);
|
|
1239
1351
|
}
|
|
1240
|
-
function
|
|
1352
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1241
1353
|
var _nextProxy = null;
|
|
1242
|
-
var _onComplete =
|
|
1243
|
-
if (startAt) {
|
|
1244
|
-
_nextProxy = _getNextProxyStart(telemetryChain, config, core, startAt);
|
|
1245
|
-
}
|
|
1246
|
-
else {
|
|
1247
|
-
_nextProxy = telemetryChain;
|
|
1354
|
+
var _onComplete = [];
|
|
1355
|
+
if (startAt !== null) {
|
|
1356
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1248
1357
|
}
|
|
1249
1358
|
var context = {
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1359
|
+
_next: _moveNext,
|
|
1360
|
+
ctx: {
|
|
1361
|
+
core: function () { return core; },
|
|
1362
|
+
diagLog: function () {
|
|
1363
|
+
return safeGetLogger(core, config);
|
|
1364
|
+
},
|
|
1365
|
+
getCfg: function () {
|
|
1366
|
+
return config;
|
|
1367
|
+
},
|
|
1368
|
+
getExtCfg: _getExtCfg,
|
|
1369
|
+
getConfig: _getConfig,
|
|
1370
|
+
hasNext: function () {
|
|
1371
|
+
return !!_nextProxy;
|
|
1372
|
+
},
|
|
1373
|
+
getNext: function () {
|
|
1374
|
+
return _nextProxy;
|
|
1375
|
+
},
|
|
1376
|
+
setNext: function (nextPlugin) {
|
|
1377
|
+
_nextProxy = nextPlugin;
|
|
1378
|
+
},
|
|
1379
|
+
iterate: _iterateChain,
|
|
1380
|
+
onComplete: _addOnComplete
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
function _addOnComplete(onComplete, that) {
|
|
1384
|
+
var args = [];
|
|
1385
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1386
|
+
args[_i - 2] = arguments[_i];
|
|
1387
|
+
}
|
|
1388
|
+
if (onComplete) {
|
|
1389
|
+
_onComplete.push({
|
|
1390
|
+
func: onComplete,
|
|
1391
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1392
|
+
args: args
|
|
1273
1393
|
});
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
function _moveNext() {
|
|
1397
|
+
var nextProxy = _nextProxy;
|
|
1398
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1399
|
+
if (!nextProxy) {
|
|
1400
|
+
var onComplete = _onComplete;
|
|
1401
|
+
if (onComplete && onComplete.length > 0) {
|
|
1402
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
1403
|
+
try {
|
|
1404
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1405
|
+
}
|
|
1406
|
+
catch (e) {
|
|
1407
|
+
core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1408
|
+
}
|
|
1409
|
+
});
|
|
1410
|
+
_onComplete = [];
|
|
1280
1411
|
}
|
|
1281
|
-
return createProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1282
|
-
},
|
|
1283
|
-
onComplete: function (onComplete) {
|
|
1284
|
-
_onComplete = onComplete;
|
|
1285
1412
|
}
|
|
1286
|
-
|
|
1413
|
+
return nextProxy;
|
|
1414
|
+
}
|
|
1287
1415
|
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1288
1416
|
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1289
1417
|
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
@@ -1326,29 +1454,53 @@
|
|
|
1326
1454
|
}
|
|
1327
1455
|
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1328
1456
|
}
|
|
1329
|
-
function
|
|
1330
|
-
var nextPlugin
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
else {
|
|
1336
|
-
if (_onComplete) {
|
|
1337
|
-
_onComplete();
|
|
1338
|
-
_onComplete = null;
|
|
1457
|
+
function _iterateChain(cb) {
|
|
1458
|
+
var nextPlugin;
|
|
1459
|
+
while (!!(nextPlugin = context._next())) {
|
|
1460
|
+
var plugin = nextPlugin.getPlugin();
|
|
1461
|
+
if (plugin) {
|
|
1462
|
+
cb(plugin);
|
|
1339
1463
|
}
|
|
1340
1464
|
}
|
|
1341
1465
|
}
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1466
|
+
return context;
|
|
1467
|
+
}
|
|
1468
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1469
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1470
|
+
var context = internalContext.ctx;
|
|
1471
|
+
function _processNext(env) {
|
|
1472
|
+
var nextPlugin = internalContext._next();
|
|
1473
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1474
|
+
return !nextPlugin;
|
|
1475
|
+
}
|
|
1476
|
+
function _createNew(plugins, startAt) {
|
|
1477
|
+
if (plugins === void 0) { plugins = null; }
|
|
1478
|
+
if (isArray(plugins)) {
|
|
1479
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1480
|
+
}
|
|
1481
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1482
|
+
}
|
|
1483
|
+
context.processNext = _processNext;
|
|
1484
|
+
context.createNew = _createNew;
|
|
1485
|
+
return context;
|
|
1486
|
+
}
|
|
1487
|
+
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1488
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1489
|
+
var context = internalContext.ctx;
|
|
1490
|
+
function _processNext(unloadState) {
|
|
1491
|
+
var nextPlugin = internalContext._next();
|
|
1492
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1493
|
+
return !nextPlugin;
|
|
1494
|
+
}
|
|
1495
|
+
function _createNew(plugins, startAt) {
|
|
1496
|
+
if (plugins === void 0) { plugins = null; }
|
|
1497
|
+
if (isArray(plugins)) {
|
|
1498
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1350
1499
|
}
|
|
1500
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1351
1501
|
}
|
|
1502
|
+
context.processNext = _processNext;
|
|
1503
|
+
context.createNew = _createNew;
|
|
1352
1504
|
return context;
|
|
1353
1505
|
}
|
|
1354
1506
|
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
@@ -1396,32 +1548,35 @@
|
|
|
1396
1548
|
return nextProxy;
|
|
1397
1549
|
},
|
|
1398
1550
|
processTelemetry: _processTelemetry,
|
|
1551
|
+
unload: _unloadPlugin,
|
|
1399
1552
|
_id: chainId,
|
|
1400
1553
|
_setNext: function (nextPlugin) {
|
|
1401
1554
|
nextProxy = nextPlugin;
|
|
1402
1555
|
}
|
|
1403
1556
|
};
|
|
1404
|
-
function
|
|
1557
|
+
function _getTelCtx() {
|
|
1558
|
+
var itemCtx;
|
|
1559
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1560
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1561
|
+
}
|
|
1405
1562
|
if (!itemCtx) {
|
|
1406
|
-
|
|
1407
|
-
itemCtx = plugin[strGetTelCtx]();
|
|
1408
|
-
}
|
|
1409
|
-
if (!itemCtx) {
|
|
1410
|
-
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1411
|
-
}
|
|
1563
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1412
1564
|
}
|
|
1565
|
+
return itemCtx;
|
|
1566
|
+
}
|
|
1567
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1568
|
+
var hasRun = false;
|
|
1413
1569
|
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1414
1570
|
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1415
1571
|
if (!hasRunContext) {
|
|
1416
1572
|
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1417
1573
|
}
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
if (plugin) {
|
|
1574
|
+
itemCtx.setNext(nextProxy);
|
|
1575
|
+
if (plugin) {
|
|
1576
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1577
|
+
hasRunContext[chainId] = true;
|
|
1423
1578
|
try {
|
|
1424
|
-
var nextId = nextProxy ? nextProxy._id :
|
|
1579
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty;
|
|
1425
1580
|
if (nextId) {
|
|
1426
1581
|
hasRunContext[nextId] = false;
|
|
1427
1582
|
}
|
|
@@ -1433,18 +1588,21 @@
|
|
|
1433
1588
|
hasRun = true;
|
|
1434
1589
|
}
|
|
1435
1590
|
if (!nextProxy || !hasNextRun) {
|
|
1436
|
-
itemCtx.diagLog().throwInternal(
|
|
1591
|
+
itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1437
1592
|
}
|
|
1438
1593
|
}
|
|
1439
|
-
}
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
}
|
|
1443
|
-
}, details, isAsync);
|
|
1594
|
+
}, details, isAsync);
|
|
1595
|
+
}
|
|
1596
|
+
return hasRun;
|
|
1444
1597
|
}
|
|
1445
1598
|
function _processTelemetry(env, itemCtx) {
|
|
1446
|
-
|
|
1447
|
-
|
|
1599
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
1600
|
+
function _callProcessTelemetry(itemCtx) {
|
|
1601
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
1602
|
+
return false;
|
|
1603
|
+
}
|
|
1604
|
+
var pluginState = _getPluginState(plugin);
|
|
1605
|
+
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
1448
1606
|
return false;
|
|
1449
1607
|
}
|
|
1450
1608
|
if (hasSetNext) {
|
|
@@ -1452,9 +1610,31 @@
|
|
|
1452
1610
|
}
|
|
1453
1611
|
plugin.processTelemetry(env, itemCtx);
|
|
1454
1612
|
return true;
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
|
|
1613
|
+
}
|
|
1614
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1615
|
+
itemCtx.processNext(env);
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1619
|
+
function _callTeardown() {
|
|
1620
|
+
var hasRun = false;
|
|
1621
|
+
if (plugin) {
|
|
1622
|
+
var pluginState = _getPluginState(plugin);
|
|
1623
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1624
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1625
|
+
pluginState[strCore] = null;
|
|
1626
|
+
pluginState[strTeardown] = true;
|
|
1627
|
+
pluginState[strIsInitialized] = false;
|
|
1628
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1629
|
+
hasRun = true;
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
return hasRun;
|
|
1634
|
+
}
|
|
1635
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1636
|
+
unloadCtx.processNext(unloadState);
|
|
1637
|
+
}
|
|
1458
1638
|
}
|
|
1459
1639
|
return objFreeze(proxyChain);
|
|
1460
1640
|
}
|
|
@@ -1467,7 +1647,6 @@
|
|
|
1467
1647
|
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
1468
1648
|
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
1469
1649
|
var strConfigCookieMgr = "_ckMgr";
|
|
1470
|
-
var strEmpty = "";
|
|
1471
1650
|
var _supportsCookies = null;
|
|
1472
1651
|
var _allowUaSameSite = null;
|
|
1473
1652
|
var _parsedCookieValue = null;
|
|
@@ -1626,7 +1805,7 @@
|
|
|
1626
1805
|
_supportsCookies = doc[strCookie] !== undefined;
|
|
1627
1806
|
}
|
|
1628
1807
|
catch (e) {
|
|
1629
|
-
logger && logger.throwInternal(
|
|
1808
|
+
logger && logger.throwInternal(2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1630
1809
|
}
|
|
1631
1810
|
}
|
|
1632
1811
|
return _supportsCookies;
|
|
@@ -1707,6 +1886,30 @@
|
|
|
1707
1886
|
|
|
1708
1887
|
var strExtensionConfig = "extensionConfig";
|
|
1709
1888
|
|
|
1889
|
+
function createUnloadHandlerContainer() {
|
|
1890
|
+
var handlers = [];
|
|
1891
|
+
function _addHandler(handler) {
|
|
1892
|
+
if (handler) {
|
|
1893
|
+
handlers.push(handler);
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
1897
|
+
arrForEach(handlers, function (handler) {
|
|
1898
|
+
try {
|
|
1899
|
+
handler(unloadCtx, unloadState);
|
|
1900
|
+
}
|
|
1901
|
+
catch (e) {
|
|
1902
|
+
unloadCtx.diagLog().throwInternal(2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
1903
|
+
}
|
|
1904
|
+
});
|
|
1905
|
+
handlers = [];
|
|
1906
|
+
}
|
|
1907
|
+
return {
|
|
1908
|
+
add: _addHandler,
|
|
1909
|
+
run: _runHandlers
|
|
1910
|
+
};
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1710
1913
|
var strGetPlugin = "getPlugin";
|
|
1711
1914
|
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
1712
1915
|
function BaseTelemetryPlugin() {
|
|
@@ -1714,6 +1917,7 @@
|
|
|
1714
1917
|
var _isinitialized;
|
|
1715
1918
|
var _rootCtx;
|
|
1716
1919
|
var _nextPlugin;
|
|
1920
|
+
var _unloadHandlerContainer;
|
|
1717
1921
|
var _hooks;
|
|
1718
1922
|
_initDefaults();
|
|
1719
1923
|
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
@@ -1721,6 +1925,39 @@
|
|
|
1721
1925
|
_setDefaults(config, core, pluginChain);
|
|
1722
1926
|
_isinitialized = true;
|
|
1723
1927
|
};
|
|
1928
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
1929
|
+
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
1930
|
+
return;
|
|
1931
|
+
}
|
|
1932
|
+
var result;
|
|
1933
|
+
var unloadDone = false;
|
|
1934
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1935
|
+
var theUnloadState = unloadState || {
|
|
1936
|
+
reason: 0 ,
|
|
1937
|
+
isAsync: false
|
|
1938
|
+
};
|
|
1939
|
+
function _unloadCallback() {
|
|
1940
|
+
if (!unloadDone) {
|
|
1941
|
+
unloadDone = true;
|
|
1942
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
1943
|
+
arrForEach(_hooks, function (fn) {
|
|
1944
|
+
fn.rm();
|
|
1945
|
+
});
|
|
1946
|
+
_hooks = [];
|
|
1947
|
+
if (result === true) {
|
|
1948
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
1949
|
+
}
|
|
1950
|
+
_initDefaults();
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
1954
|
+
_unloadCallback();
|
|
1955
|
+
}
|
|
1956
|
+
else {
|
|
1957
|
+
result = true;
|
|
1958
|
+
}
|
|
1959
|
+
return result;
|
|
1960
|
+
};
|
|
1724
1961
|
_self._addHook = function (hooks) {
|
|
1725
1962
|
if (hooks) {
|
|
1726
1963
|
if (isArray(hooks)) {
|
|
@@ -1731,17 +1968,18 @@
|
|
|
1731
1968
|
}
|
|
1732
1969
|
}
|
|
1733
1970
|
};
|
|
1971
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
1734
1972
|
});
|
|
1735
1973
|
_self.diagLog = function (itemCtx) {
|
|
1736
1974
|
return _getTelCtx(itemCtx).diagLog();
|
|
1737
1975
|
};
|
|
1738
|
-
_self
|
|
1976
|
+
_self[strIsInitialized] = function () {
|
|
1739
1977
|
return _isinitialized;
|
|
1740
1978
|
};
|
|
1741
1979
|
_self.setInitialized = function (isInitialized) {
|
|
1742
1980
|
_isinitialized = isInitialized;
|
|
1743
1981
|
};
|
|
1744
|
-
_self
|
|
1982
|
+
_self[strSetNextPlugin] = function (next) {
|
|
1745
1983
|
_nextPlugin = next;
|
|
1746
1984
|
};
|
|
1747
1985
|
_self.processNext = function (env, itemCtx) {
|
|
@@ -1787,108 +2025,119 @@
|
|
|
1787
2025
|
_rootCtx = null;
|
|
1788
2026
|
_nextPlugin = null;
|
|
1789
2027
|
_hooks = [];
|
|
2028
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
1790
2029
|
}
|
|
1791
2030
|
}
|
|
1792
2031
|
return BaseTelemetryPlugin;
|
|
1793
2032
|
}());
|
|
1794
2033
|
|
|
1795
|
-
var
|
|
1796
|
-
var
|
|
1797
|
-
var
|
|
1798
|
-
var
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
2034
|
+
var strOnPrefix = "on";
|
|
2035
|
+
var strAttachEvent = "attachEvent";
|
|
2036
|
+
var strAddEventHelper = "addEventListener";
|
|
2037
|
+
var strEvents = "events";
|
|
2038
|
+
createUniqueNamespace("aiEvtPageHide");
|
|
2039
|
+
createUniqueNamespace("aiEvtPageShow");
|
|
2040
|
+
var _guid = 1;
|
|
2041
|
+
var elmNodeData = createElmNodeData("events");
|
|
2042
|
+
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
2043
|
+
function _normalizeNamespace(name) {
|
|
2044
|
+
if (name && name.replace) {
|
|
2045
|
+
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
2046
|
+
}
|
|
2047
|
+
return name;
|
|
2048
|
+
}
|
|
2049
|
+
function _getEvtNamespace(eventName, namespaces) {
|
|
2050
|
+
if (namespaces) {
|
|
2051
|
+
var theNamespace_1 = "";
|
|
2052
|
+
if (isArray(namespaces)) {
|
|
2053
|
+
theNamespace_1 = "";
|
|
2054
|
+
arrForEach(namespaces, function (name) {
|
|
2055
|
+
name = _normalizeNamespace(name);
|
|
2056
|
+
if (name) {
|
|
2057
|
+
if (name[0] !== ".") {
|
|
2058
|
+
name = "." + name;
|
|
2059
|
+
}
|
|
2060
|
+
theNamespace_1 += name;
|
|
2061
|
+
}
|
|
2062
|
+
});
|
|
2063
|
+
}
|
|
2064
|
+
else {
|
|
2065
|
+
theNamespace_1 = _normalizeNamespace(namespaces);
|
|
2066
|
+
}
|
|
2067
|
+
if (theNamespace_1) {
|
|
2068
|
+
if (theNamespace_1[0] !== ".") {
|
|
2069
|
+
theNamespace_1 = "." + theNamespace_1;
|
|
2070
|
+
}
|
|
2071
|
+
eventName = (eventName || "") + theNamespace_1;
|
|
1831
2072
|
}
|
|
1832
|
-
value = mwcRandom32() & MaxUInt32;
|
|
1833
|
-
}
|
|
1834
|
-
if (value === 0) {
|
|
1835
|
-
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1836
|
-
}
|
|
1837
|
-
if (!signed) {
|
|
1838
|
-
value >>>= 0;
|
|
1839
2073
|
}
|
|
1840
|
-
|
|
2074
|
+
var parsedEvent = (eventNamespace.exec(eventName) || []);
|
|
2075
|
+
return {
|
|
2076
|
+
type: parsedEvent[1],
|
|
2077
|
+
ns: ((parsedEvent[2] || "").split(".").sort()).join(".")
|
|
2078
|
+
};
|
|
1841
2079
|
}
|
|
1842
|
-
function
|
|
1843
|
-
if (
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
2080
|
+
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
2081
|
+
if (addDefault === void 0) { addDefault = true; }
|
|
2082
|
+
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
2083
|
+
var registeredEvents = aiEvts[evtName];
|
|
2084
|
+
if (!registeredEvents) {
|
|
2085
|
+
registeredEvents = aiEvts[evtName] = [];
|
|
1848
2086
|
}
|
|
2087
|
+
return registeredEvents;
|
|
1849
2088
|
}
|
|
1850
|
-
function
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
2089
|
+
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
2090
|
+
var result = false;
|
|
2091
|
+
if (obj && evtName && evtName.type && handlerRef) {
|
|
2092
|
+
if (obj[strAddEventHelper]) {
|
|
2093
|
+
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
2094
|
+
result = true;
|
|
2095
|
+
}
|
|
2096
|
+
else if (obj[strAttachEvent]) {
|
|
2097
|
+
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
2098
|
+
result = true;
|
|
2099
|
+
}
|
|
1856
2100
|
}
|
|
1857
|
-
return
|
|
2101
|
+
return result;
|
|
1858
2102
|
}
|
|
1859
|
-
function
|
|
1860
|
-
if (
|
|
1861
|
-
var
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
2103
|
+
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
2104
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
2105
|
+
var result = false;
|
|
2106
|
+
if (target) {
|
|
2107
|
+
try {
|
|
2108
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
2109
|
+
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
2110
|
+
if (result && elmNodeData.accept(target)) {
|
|
2111
|
+
var registeredEvent = {
|
|
2112
|
+
guid: _guid++,
|
|
2113
|
+
evtName: evtName,
|
|
2114
|
+
handler: handlerRef,
|
|
2115
|
+
capture: useCapture
|
|
2116
|
+
};
|
|
2117
|
+
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
catch (e) {
|
|
1872
2121
|
}
|
|
1873
2122
|
}
|
|
1874
2123
|
return result;
|
|
1875
2124
|
}
|
|
1876
|
-
|
|
1877
|
-
var _cookieMgrs = null;
|
|
1878
|
-
var _canUseCookies;
|
|
1879
|
-
function addEventHandler(eventName, callback) {
|
|
2125
|
+
function addEventHandler(eventName, callback, evtNamespace) {
|
|
1880
2126
|
var result = false;
|
|
1881
2127
|
var w = getWindow();
|
|
1882
2128
|
if (w) {
|
|
1883
|
-
result =
|
|
1884
|
-
result =
|
|
2129
|
+
result = eventOn(w, eventName, callback, evtNamespace);
|
|
2130
|
+
result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
|
|
1885
2131
|
}
|
|
1886
2132
|
var doc = getDocument();
|
|
1887
2133
|
if (doc) {
|
|
1888
|
-
result =
|
|
2134
|
+
result = eventOn(doc, eventName, callback, evtNamespace) || result;
|
|
1889
2135
|
}
|
|
1890
2136
|
return result;
|
|
1891
2137
|
}
|
|
2138
|
+
|
|
2139
|
+
var _cookieMgrs = null;
|
|
2140
|
+
var _canUseCookies;
|
|
1892
2141
|
function newGuid() {
|
|
1893
2142
|
function randomHexDigit() {
|
|
1894
2143
|
return randomValue(15);
|
|
@@ -1907,7 +2156,7 @@
|
|
|
1907
2156
|
}
|
|
1908
2157
|
function generateW3CId() {
|
|
1909
2158
|
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
1910
|
-
var oct =
|
|
2159
|
+
var oct = strEmpty, tmp;
|
|
1911
2160
|
for (var a = 0; a < 4; a++) {
|
|
1912
2161
|
tmp = random32();
|
|
1913
2162
|
oct +=
|
|
@@ -1990,6 +2239,95 @@
|
|
|
1990
2239
|
_legacyCookieMgr().setEnabled(false);
|
|
1991
2240
|
}
|
|
1992
2241
|
|
|
2242
|
+
var LoggingSeverity = createEnumStyle({
|
|
2243
|
+
CRITICAL: 1 ,
|
|
2244
|
+
WARNING: 2
|
|
2245
|
+
});
|
|
2246
|
+
var _InternalMessageId = createEnumStyle({
|
|
2247
|
+
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
2248
|
+
BrowserCannotReadLocalStorage: 1 ,
|
|
2249
|
+
BrowserCannotReadSessionStorage: 2 ,
|
|
2250
|
+
BrowserCannotWriteLocalStorage: 3 ,
|
|
2251
|
+
BrowserCannotWriteSessionStorage: 4 ,
|
|
2252
|
+
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
2253
|
+
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
2254
|
+
CannotSendEmptyTelemetry: 7 ,
|
|
2255
|
+
ClientPerformanceMathError: 8 ,
|
|
2256
|
+
ErrorParsingAISessionCookie: 9 ,
|
|
2257
|
+
ErrorPVCalc: 10 ,
|
|
2258
|
+
ExceptionWhileLoggingError: 11 ,
|
|
2259
|
+
FailedAddingTelemetryToBuffer: 12 ,
|
|
2260
|
+
FailedMonitorAjaxAbort: 13 ,
|
|
2261
|
+
FailedMonitorAjaxDur: 14 ,
|
|
2262
|
+
FailedMonitorAjaxOpen: 15 ,
|
|
2263
|
+
FailedMonitorAjaxRSC: 16 ,
|
|
2264
|
+
FailedMonitorAjaxSend: 17 ,
|
|
2265
|
+
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
2266
|
+
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
2267
|
+
FailedToSendQueuedTelemetry: 20 ,
|
|
2268
|
+
FailedToReportDataLoss: 21 ,
|
|
2269
|
+
FlushFailed: 22 ,
|
|
2270
|
+
MessageLimitPerPVExceeded: 23 ,
|
|
2271
|
+
MissingRequiredFieldSpecification: 24 ,
|
|
2272
|
+
NavigationTimingNotSupported: 25 ,
|
|
2273
|
+
OnError: 26 ,
|
|
2274
|
+
SessionRenewalDateIsZero: 27 ,
|
|
2275
|
+
SenderNotInitialized: 28 ,
|
|
2276
|
+
StartTrackEventFailed: 29 ,
|
|
2277
|
+
StopTrackEventFailed: 30 ,
|
|
2278
|
+
StartTrackFailed: 31 ,
|
|
2279
|
+
StopTrackFailed: 32 ,
|
|
2280
|
+
TelemetrySampledAndNotSent: 33 ,
|
|
2281
|
+
TrackEventFailed: 34 ,
|
|
2282
|
+
TrackExceptionFailed: 35 ,
|
|
2283
|
+
TrackMetricFailed: 36 ,
|
|
2284
|
+
TrackPVFailed: 37 ,
|
|
2285
|
+
TrackPVFailedCalc: 38 ,
|
|
2286
|
+
TrackTraceFailed: 39 ,
|
|
2287
|
+
TransmissionFailed: 40 ,
|
|
2288
|
+
FailedToSetStorageBuffer: 41 ,
|
|
2289
|
+
FailedToRestoreStorageBuffer: 42 ,
|
|
2290
|
+
InvalidBackendResponse: 43 ,
|
|
2291
|
+
FailedToFixDepricatedValues: 44 ,
|
|
2292
|
+
InvalidDurationValue: 45 ,
|
|
2293
|
+
TelemetryEnvelopeInvalid: 46 ,
|
|
2294
|
+
CreateEnvelopeError: 47 ,
|
|
2295
|
+
CannotSerializeObject: 48 ,
|
|
2296
|
+
CannotSerializeObjectNonSerializable: 49 ,
|
|
2297
|
+
CircularReferenceDetected: 50 ,
|
|
2298
|
+
ClearAuthContextFailed: 51 ,
|
|
2299
|
+
ExceptionTruncated: 52 ,
|
|
2300
|
+
IllegalCharsInName: 53 ,
|
|
2301
|
+
ItemNotInArray: 54 ,
|
|
2302
|
+
MaxAjaxPerPVExceeded: 55 ,
|
|
2303
|
+
MessageTruncated: 56 ,
|
|
2304
|
+
NameTooLong: 57 ,
|
|
2305
|
+
SampleRateOutOfRange: 58 ,
|
|
2306
|
+
SetAuthContextFailed: 59 ,
|
|
2307
|
+
SetAuthContextFailedAccountName: 60 ,
|
|
2308
|
+
StringValueTooLong: 61 ,
|
|
2309
|
+
StartCalledMoreThanOnce: 62 ,
|
|
2310
|
+
StopCalledWithoutStart: 63 ,
|
|
2311
|
+
TelemetryInitializerFailed: 64 ,
|
|
2312
|
+
TrackArgumentsNotSpecified: 65 ,
|
|
2313
|
+
UrlTooLong: 66 ,
|
|
2314
|
+
SessionStorageBufferFull: 67 ,
|
|
2315
|
+
CannotAccessCookie: 68 ,
|
|
2316
|
+
IdTooLong: 69 ,
|
|
2317
|
+
InvalidEvent: 70 ,
|
|
2318
|
+
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
2319
|
+
SendBrowserInfoOnUserInit: 72 ,
|
|
2320
|
+
PluginException: 73 ,
|
|
2321
|
+
NotificationException: 74 ,
|
|
2322
|
+
SnippetScriptLoadFailure: 99 ,
|
|
2323
|
+
InvalidInstrumentationKey: 100 ,
|
|
2324
|
+
CannotParseAiBlobValue: 101 ,
|
|
2325
|
+
InvalidContentBlob: 102 ,
|
|
2326
|
+
TrackPageActionEventFailed: 103 ,
|
|
2327
|
+
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
2328
|
+
InMemoryStorageBufferFull: 105
|
|
2329
|
+
});
|
|
2330
|
+
|
|
1993
2331
|
var ReactPlugin = /** @class */ (function (_super) {
|
|
1994
2332
|
__extendsFn(ReactPlugin, _super);
|
|
1995
2333
|
function ReactPlugin() {
|