@microsoft/applicationinsights-channel-js 2.8.0-beta.2203-01 → 2.8.0-beta.2203-02
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-channel-js.integrity.json +9 -9
- package/browser/applicationinsights-channel-js.js +607 -239
- package/browser/applicationinsights-channel-js.js.map +1 -1
- package/browser/applicationinsights-channel-js.min.js +2 -2
- package/browser/applicationinsights-channel-js.min.js.map +1 -1
- package/dist/applicationinsights-channel-js.d.ts +1 -1
- package/dist/applicationinsights-channel-js.js +607 -239
- package/dist/applicationinsights-channel-js.js.map +1 -1
- package/dist/applicationinsights-channel-js.min.js +2 -2
- package/dist/applicationinsights-channel-js.min.js.map +1 -1
- package/dist/applicationinsights-channel-js.rollup.d.ts +1 -1
- package/dist-esm/EnvelopeCreator.js +2 -2
- package/dist-esm/EnvelopeCreator.js.map +1 -1
- package/dist-esm/Interfaces.js +1 -1
- package/dist-esm/Offline.js +1 -1
- package/dist-esm/SendBuffer.js +1 -1
- package/dist-esm/Sender.js +1 -1
- package/dist-esm/Serializer.js +1 -1
- package/dist-esm/TelemetryProcessors/Sample.js +1 -1
- package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js +1 -1
- package/dist-esm/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js +1 -1
- package/dist-esm/applicationinsights-channel-js.js +1 -1
- package/package.json +3 -3
- package/src/EnvelopeCreator.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Channel, 2.8.0-beta.2203-
|
|
2
|
+
* Application Insights JavaScript SDK - Channel, 2.8.0-beta.2203-02
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -335,99 +335,14 @@
|
|
|
335
335
|
};
|
|
336
336
|
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
337
337
|
|
|
338
|
-
var
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
var
|
|
344
|
-
|
|
345
|
-
BrowserCannotReadLocalStorage: 1,
|
|
346
|
-
BrowserCannotReadSessionStorage: 2,
|
|
347
|
-
BrowserCannotWriteLocalStorage: 3,
|
|
348
|
-
BrowserCannotWriteSessionStorage: 4,
|
|
349
|
-
BrowserFailedRemovalFromLocalStorage: 5,
|
|
350
|
-
BrowserFailedRemovalFromSessionStorage: 6,
|
|
351
|
-
CannotSendEmptyTelemetry: 7,
|
|
352
|
-
ClientPerformanceMathError: 8,
|
|
353
|
-
ErrorParsingAISessionCookie: 9,
|
|
354
|
-
ErrorPVCalc: 10,
|
|
355
|
-
ExceptionWhileLoggingError: 11,
|
|
356
|
-
FailedAddingTelemetryToBuffer: 12,
|
|
357
|
-
FailedMonitorAjaxAbort: 13,
|
|
358
|
-
FailedMonitorAjaxDur: 14,
|
|
359
|
-
FailedMonitorAjaxOpen: 15,
|
|
360
|
-
FailedMonitorAjaxRSC: 16,
|
|
361
|
-
FailedMonitorAjaxSend: 17,
|
|
362
|
-
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
363
|
-
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
364
|
-
FailedToSendQueuedTelemetry: 20,
|
|
365
|
-
FailedToReportDataLoss: 21,
|
|
366
|
-
FlushFailed: 22,
|
|
367
|
-
MessageLimitPerPVExceeded: 23,
|
|
368
|
-
MissingRequiredFieldSpecification: 24,
|
|
369
|
-
NavigationTimingNotSupported: 25,
|
|
370
|
-
OnError: 26,
|
|
371
|
-
SessionRenewalDateIsZero: 27,
|
|
372
|
-
SenderNotInitialized: 28,
|
|
373
|
-
StartTrackEventFailed: 29,
|
|
374
|
-
StopTrackEventFailed: 30,
|
|
375
|
-
StartTrackFailed: 31,
|
|
376
|
-
StopTrackFailed: 32,
|
|
377
|
-
TelemetrySampledAndNotSent: 33,
|
|
378
|
-
TrackEventFailed: 34,
|
|
379
|
-
TrackExceptionFailed: 35,
|
|
380
|
-
TrackMetricFailed: 36,
|
|
381
|
-
TrackPVFailed: 37,
|
|
382
|
-
TrackPVFailedCalc: 38,
|
|
383
|
-
TrackTraceFailed: 39,
|
|
384
|
-
TransmissionFailed: 40,
|
|
385
|
-
FailedToSetStorageBuffer: 41,
|
|
386
|
-
FailedToRestoreStorageBuffer: 42,
|
|
387
|
-
InvalidBackendResponse: 43,
|
|
388
|
-
FailedToFixDepricatedValues: 44,
|
|
389
|
-
InvalidDurationValue: 45,
|
|
390
|
-
TelemetryEnvelopeInvalid: 46,
|
|
391
|
-
CreateEnvelopeError: 47,
|
|
392
|
-
CannotSerializeObject: 48,
|
|
393
|
-
CannotSerializeObjectNonSerializable: 49,
|
|
394
|
-
CircularReferenceDetected: 50,
|
|
395
|
-
ClearAuthContextFailed: 51,
|
|
396
|
-
ExceptionTruncated: 52,
|
|
397
|
-
IllegalCharsInName: 53,
|
|
398
|
-
ItemNotInArray: 54,
|
|
399
|
-
MaxAjaxPerPVExceeded: 55,
|
|
400
|
-
MessageTruncated: 56,
|
|
401
|
-
NameTooLong: 57,
|
|
402
|
-
SampleRateOutOfRange: 58,
|
|
403
|
-
SetAuthContextFailed: 59,
|
|
404
|
-
SetAuthContextFailedAccountName: 60,
|
|
405
|
-
StringValueTooLong: 61,
|
|
406
|
-
StartCalledMoreThanOnce: 62,
|
|
407
|
-
StopCalledWithoutStart: 63,
|
|
408
|
-
TelemetryInitializerFailed: 64,
|
|
409
|
-
TrackArgumentsNotSpecified: 65,
|
|
410
|
-
UrlTooLong: 66,
|
|
411
|
-
SessionStorageBufferFull: 67,
|
|
412
|
-
CannotAccessCookie: 68,
|
|
413
|
-
IdTooLong: 69,
|
|
414
|
-
InvalidEvent: 70,
|
|
415
|
-
FailedMonitorAjaxSetRequestHeader: 71,
|
|
416
|
-
SendBrowserInfoOnUserInit: 72,
|
|
417
|
-
PluginException: 73,
|
|
418
|
-
NotificationException: 74,
|
|
419
|
-
SnippetScriptLoadFailure: 99,
|
|
420
|
-
InvalidInstrumentationKey: 100,
|
|
421
|
-
CannotParseAiBlobValue: 101,
|
|
422
|
-
InvalidContentBlob: 102,
|
|
423
|
-
TrackPageActionEventFailed: 103,
|
|
424
|
-
FailedAddingCustomDefinedRequestContext: 104,
|
|
425
|
-
InMemoryStorageBufferFull: 105
|
|
426
|
-
};
|
|
338
|
+
var strEmpty$1 = "";
|
|
339
|
+
var strSetNextPlugin = "setNextPlugin";
|
|
340
|
+
var strIsInitialized = "isInitialized";
|
|
341
|
+
var strTeardown = "teardown";
|
|
342
|
+
var strCore = "core";
|
|
343
|
+
var strDisabled = "disabled";
|
|
344
|
+
var strDoTeardown = "_doTeardown";
|
|
427
345
|
|
|
428
|
-
var strOnPrefix = "on";
|
|
429
|
-
var strAttachEvent = "attachEvent";
|
|
430
|
-
var strAddEventHelper = "addEventListener";
|
|
431
346
|
var strToISOString = "toISOString";
|
|
432
347
|
var strIndexOf = "indexOf";
|
|
433
348
|
var strMap = "map";
|
|
@@ -435,7 +350,7 @@
|
|
|
435
350
|
var strToString = "toString";
|
|
436
351
|
var str__Proto = "__proto__";
|
|
437
352
|
var strConstructor = "constructor";
|
|
438
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
353
|
+
var _objDefineProperty$1 = ObjDefineProperty;
|
|
439
354
|
var _objFreeze = ObjClass.freeze;
|
|
440
355
|
var _objKeys = ObjClass.keys;
|
|
441
356
|
var StringProto = String[strShimPrototype];
|
|
@@ -446,6 +361,9 @@
|
|
|
446
361
|
var _objToString = ObjProto[strToString];
|
|
447
362
|
var _fnToString = ObjHasOwnProperty[strToString];
|
|
448
363
|
var _objFunctionString = _fnToString.call(ObjClass);
|
|
364
|
+
var rCamelCase = /-([a-z])/g;
|
|
365
|
+
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
366
|
+
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
449
367
|
var _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
450
368
|
function _getObjProto(target) {
|
|
451
369
|
if (target) {
|
|
@@ -471,24 +389,18 @@
|
|
|
471
389
|
function isFunction(value) {
|
|
472
390
|
return !!(value && typeof value === strShimFunction);
|
|
473
391
|
}
|
|
474
|
-
function
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
485
|
-
result = true;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
catch (e) {
|
|
489
|
-
}
|
|
392
|
+
function normalizeJsName(name) {
|
|
393
|
+
var value = name;
|
|
394
|
+
if (value && isString(value)) {
|
|
395
|
+
value = value.replace(rCamelCase, function (_all, letter) {
|
|
396
|
+
return letter.toUpperCase();
|
|
397
|
+
});
|
|
398
|
+
value = value.replace(rNormalizeInvalid, "_");
|
|
399
|
+
value = value.replace(rLeadingNumeric, function (_all, match) {
|
|
400
|
+
return "_" + match;
|
|
401
|
+
});
|
|
490
402
|
}
|
|
491
|
-
return
|
|
403
|
+
return value;
|
|
492
404
|
}
|
|
493
405
|
function objForEachKey(target, callbackfn) {
|
|
494
406
|
if (target) {
|
|
@@ -656,7 +568,7 @@
|
|
|
656
568
|
return result;
|
|
657
569
|
}
|
|
658
570
|
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
659
|
-
if (_objDefineProperty) {
|
|
571
|
+
if (_objDefineProperty$1) {
|
|
660
572
|
try {
|
|
661
573
|
var descriptor = {
|
|
662
574
|
enumerable: true,
|
|
@@ -668,7 +580,7 @@
|
|
|
668
580
|
if (setProp) {
|
|
669
581
|
descriptor.set = setProp;
|
|
670
582
|
}
|
|
671
|
-
_objDefineProperty(target, prop, descriptor);
|
|
583
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
672
584
|
return true;
|
|
673
585
|
}
|
|
674
586
|
catch (e) {
|
|
@@ -688,7 +600,7 @@
|
|
|
688
600
|
if (isError(object)) {
|
|
689
601
|
return object.name;
|
|
690
602
|
}
|
|
691
|
-
return
|
|
603
|
+
return strEmpty$1;
|
|
692
604
|
}
|
|
693
605
|
function setValue(target, field, value, valChk, srcChk) {
|
|
694
606
|
var theValue = value;
|
|
@@ -720,6 +632,17 @@
|
|
|
720
632
|
return class_1;
|
|
721
633
|
}());
|
|
722
634
|
}
|
|
635
|
+
function createEnumStyle(values) {
|
|
636
|
+
var enumClass = {};
|
|
637
|
+
objForEachKey(values, function (field, value) {
|
|
638
|
+
enumClass[field] = value;
|
|
639
|
+
if (!isUndefined(enumClass[value])) {
|
|
640
|
+
throwError("Value: [" + value + "] already exists for " + field);
|
|
641
|
+
}
|
|
642
|
+
enumClass[value] = field;
|
|
643
|
+
});
|
|
644
|
+
return objFreeze(enumClass);
|
|
645
|
+
}
|
|
723
646
|
function optimizeObject(theObject) {
|
|
724
647
|
if (theObject && ObjAssign) {
|
|
725
648
|
theObject = ObjClass(ObjAssign({}, theObject));
|
|
@@ -777,9 +700,13 @@
|
|
|
777
700
|
var strNavigator = "navigator";
|
|
778
701
|
var strConsole = "console";
|
|
779
702
|
var strJSON = "JSON";
|
|
703
|
+
var strCrypto = "crypto";
|
|
704
|
+
var strMsCrypto = "msCrypto";
|
|
780
705
|
var strMsie = "msie";
|
|
781
706
|
var strTrident = "trident/";
|
|
782
707
|
var strXMLHttpRequest = "XMLHttpRequest";
|
|
708
|
+
var _isTrident = null;
|
|
709
|
+
var _navUserAgentCheck = null;
|
|
783
710
|
var _useXDomainRequest = null;
|
|
784
711
|
var _beaconsSupported = null;
|
|
785
712
|
function _hasProperty(theClass, property) {
|
|
@@ -859,13 +786,28 @@
|
|
|
859
786
|
}
|
|
860
787
|
return null;
|
|
861
788
|
}
|
|
789
|
+
function getCrypto() {
|
|
790
|
+
return getGlobalInst(strCrypto);
|
|
791
|
+
}
|
|
792
|
+
function getMsCrypto() {
|
|
793
|
+
return getGlobalInst(strMsCrypto);
|
|
794
|
+
}
|
|
795
|
+
function isIE() {
|
|
796
|
+
var nav = getNavigator();
|
|
797
|
+
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
798
|
+
_navUserAgentCheck = nav.userAgent;
|
|
799
|
+
var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
|
|
800
|
+
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
801
|
+
}
|
|
802
|
+
return _isTrident;
|
|
803
|
+
}
|
|
862
804
|
function getIEVersion(userAgentStr) {
|
|
863
805
|
if (userAgentStr === void 0) { userAgentStr = null; }
|
|
864
806
|
if (!userAgentStr) {
|
|
865
807
|
var navigator_1 = getNavigator() || {};
|
|
866
|
-
userAgentStr = navigator_1 ? (navigator_1.userAgent ||
|
|
808
|
+
userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty$1).toLowerCase() : strEmpty$1;
|
|
867
809
|
}
|
|
868
|
-
var ua = (userAgentStr ||
|
|
810
|
+
var ua = (userAgentStr || strEmpty$1).toLowerCase();
|
|
869
811
|
if (strContains(ua, strMsie)) {
|
|
870
812
|
var doc = getDocument() || {};
|
|
871
813
|
return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
|
|
@@ -880,7 +822,7 @@
|
|
|
880
822
|
}
|
|
881
823
|
function dumpObj(object) {
|
|
882
824
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
883
|
-
var propertyValueDump =
|
|
825
|
+
var propertyValueDump = strEmpty$1;
|
|
884
826
|
if (objectTypeDump === "[object Error]") {
|
|
885
827
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
886
828
|
}
|
|
@@ -951,9 +893,9 @@
|
|
|
951
893
|
var strWarnToConsole = "warnToConsole";
|
|
952
894
|
function _sanitizeDiagnosticText(text) {
|
|
953
895
|
if (text) {
|
|
954
|
-
return "\"" + text.replace(/\"/g,
|
|
896
|
+
return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
|
|
955
897
|
}
|
|
956
|
-
return
|
|
898
|
+
return strEmpty$1;
|
|
957
899
|
}
|
|
958
900
|
function _logToConsole(func, message) {
|
|
959
901
|
var theConsole = getConsole();
|
|
@@ -975,12 +917,12 @@
|
|
|
975
917
|
_self.message =
|
|
976
918
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
977
919
|
msgId;
|
|
978
|
-
var strProps =
|
|
920
|
+
var strProps = strEmpty$1;
|
|
979
921
|
if (hasJSON()) {
|
|
980
922
|
strProps = getJSON().stringify(properties);
|
|
981
923
|
}
|
|
982
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
983
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
924
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
|
|
925
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
|
|
984
926
|
_self.message += diagnosticText;
|
|
985
927
|
}
|
|
986
928
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -1010,7 +952,7 @@
|
|
|
1010
952
|
throw message;
|
|
1011
953
|
}
|
|
1012
954
|
else {
|
|
1013
|
-
var logFunc = severity ===
|
|
955
|
+
var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
|
|
1014
956
|
if (!isUndefined(message.message)) {
|
|
1015
957
|
var logLevel = _self.consoleLoggingLevel();
|
|
1016
958
|
if (isUserAct) {
|
|
@@ -1028,7 +970,7 @@
|
|
|
1028
970
|
_self.logInternalMessage(severity, message);
|
|
1029
971
|
}
|
|
1030
972
|
else {
|
|
1031
|
-
_debugExtMsg("throw" + (severity ===
|
|
973
|
+
_debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
|
|
1032
974
|
}
|
|
1033
975
|
}
|
|
1034
976
|
};
|
|
@@ -1060,13 +1002,13 @@
|
|
|
1060
1002
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
1061
1003
|
_self.queue.push(message);
|
|
1062
1004
|
_messageCount++;
|
|
1063
|
-
_debugExtMsg((severity ===
|
|
1005
|
+
_debugExtMsg((severity === 1 ? "error" : "warn"), message);
|
|
1064
1006
|
}
|
|
1065
1007
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
1066
1008
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
1067
|
-
var throttleMessage = new _InternalLogMessage(
|
|
1009
|
+
var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
|
|
1068
1010
|
_self.queue.push(throttleMessage);
|
|
1069
|
-
if (severity ===
|
|
1011
|
+
if (severity === 1 ) {
|
|
1070
1012
|
_self.errorToConsole(throttleLimitMessage);
|
|
1071
1013
|
}
|
|
1072
1014
|
else {
|
|
@@ -1208,6 +1150,151 @@
|
|
|
1208
1150
|
return func();
|
|
1209
1151
|
}
|
|
1210
1152
|
|
|
1153
|
+
var UInt32Mask = 0x100000000;
|
|
1154
|
+
var MaxUInt32 = 0xffffffff;
|
|
1155
|
+
var _mwcSeeded = false;
|
|
1156
|
+
var _mwcW = 123456789;
|
|
1157
|
+
var _mwcZ = 987654321;
|
|
1158
|
+
function _mwcSeed(seedValue) {
|
|
1159
|
+
if (seedValue < 0) {
|
|
1160
|
+
seedValue >>>= 0;
|
|
1161
|
+
}
|
|
1162
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
1163
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
1164
|
+
_mwcSeeded = true;
|
|
1165
|
+
}
|
|
1166
|
+
function _autoSeedMwc() {
|
|
1167
|
+
try {
|
|
1168
|
+
var now = dateNow() & 0x7fffffff;
|
|
1169
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
1170
|
+
}
|
|
1171
|
+
catch (e) {
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
function random32(signed) {
|
|
1175
|
+
var value = 0;
|
|
1176
|
+
var c = getCrypto() || getMsCrypto();
|
|
1177
|
+
if (c && c.getRandomValues) {
|
|
1178
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1179
|
+
}
|
|
1180
|
+
if (value === 0 && isIE()) {
|
|
1181
|
+
if (!_mwcSeeded) {
|
|
1182
|
+
_autoSeedMwc();
|
|
1183
|
+
}
|
|
1184
|
+
value = mwcRandom32() & MaxUInt32;
|
|
1185
|
+
}
|
|
1186
|
+
if (value === 0) {
|
|
1187
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1188
|
+
}
|
|
1189
|
+
if (!signed) {
|
|
1190
|
+
value >>>= 0;
|
|
1191
|
+
}
|
|
1192
|
+
return value;
|
|
1193
|
+
}
|
|
1194
|
+
function mwcRandom32(signed) {
|
|
1195
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1196
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1197
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1198
|
+
if (!signed) {
|
|
1199
|
+
value >>>= 0;
|
|
1200
|
+
}
|
|
1201
|
+
return value;
|
|
1202
|
+
}
|
|
1203
|
+
function newId(maxLength) {
|
|
1204
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1205
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1206
|
+
var number = random32() >>> 0;
|
|
1207
|
+
var chars = 0;
|
|
1208
|
+
var result = strEmpty$1;
|
|
1209
|
+
while (result.length < maxLength) {
|
|
1210
|
+
chars++;
|
|
1211
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1212
|
+
number >>>= 6;
|
|
1213
|
+
if (chars === 5) {
|
|
1214
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1215
|
+
chars = 0;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
return result;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
1222
|
+
var version = "2.7.3";
|
|
1223
|
+
var instanceName = "." + newId(6);
|
|
1224
|
+
var _dataUid = 0;
|
|
1225
|
+
function _createAccessor(target, prop, value) {
|
|
1226
|
+
if (_objDefineProperty) {
|
|
1227
|
+
try {
|
|
1228
|
+
_objDefineProperty(target, prop, {
|
|
1229
|
+
value: value,
|
|
1230
|
+
enumerable: false,
|
|
1231
|
+
configurable: true
|
|
1232
|
+
});
|
|
1233
|
+
return true;
|
|
1234
|
+
}
|
|
1235
|
+
catch (e) {
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
return false;
|
|
1239
|
+
}
|
|
1240
|
+
function _canAcceptData(target) {
|
|
1241
|
+
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1242
|
+
}
|
|
1243
|
+
function _getCache(data, target) {
|
|
1244
|
+
var theCache = target[data.id];
|
|
1245
|
+
if (!theCache) {
|
|
1246
|
+
theCache = {};
|
|
1247
|
+
try {
|
|
1248
|
+
if (_canAcceptData(target)) {
|
|
1249
|
+
if (!_createAccessor(target, data.id, theCache)) {
|
|
1250
|
+
target[data.id] = theCache;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
catch (e) {
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
return theCache;
|
|
1258
|
+
}
|
|
1259
|
+
function createUniqueNamespace(name, includeVersion) {
|
|
1260
|
+
if (includeVersion === void 0) { includeVersion = false; }
|
|
1261
|
+
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1262
|
+
}
|
|
1263
|
+
function createElmNodeData(name) {
|
|
1264
|
+
var data = {
|
|
1265
|
+
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1266
|
+
accept: function (target) {
|
|
1267
|
+
return _canAcceptData(target);
|
|
1268
|
+
},
|
|
1269
|
+
get: function (target, name, defValue, addDefault) {
|
|
1270
|
+
var theCache = target[data.id];
|
|
1271
|
+
if (!theCache) {
|
|
1272
|
+
if (addDefault) {
|
|
1273
|
+
theCache = _getCache(data, target);
|
|
1274
|
+
theCache[normalizeJsName(name)] = defValue;
|
|
1275
|
+
}
|
|
1276
|
+
return defValue;
|
|
1277
|
+
}
|
|
1278
|
+
return theCache[normalizeJsName(name)];
|
|
1279
|
+
},
|
|
1280
|
+
kill: function (target, name) {
|
|
1281
|
+
if (target && target[name]) {
|
|
1282
|
+
try {
|
|
1283
|
+
delete target[name];
|
|
1284
|
+
}
|
|
1285
|
+
catch (e) {
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
};
|
|
1290
|
+
return data;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1294
|
+
function _getPluginState(plugin) {
|
|
1295
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1211
1298
|
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1212
1299
|
var strHasRunFlags = "_hasRun";
|
|
1213
1300
|
var strGetTelCtx = "_getTelCtx";
|
|
@@ -1221,53 +1308,66 @@
|
|
|
1221
1308
|
}
|
|
1222
1309
|
return createTelemetryProxyChain([startAt], config, core);
|
|
1223
1310
|
}
|
|
1224
|
-
function
|
|
1225
|
-
var _nextProxy =
|
|
1226
|
-
var _onComplete =
|
|
1227
|
-
if (startAt) {
|
|
1228
|
-
_nextProxy = _getNextProxyStart(telemetryChain, config, core, startAt);
|
|
1229
|
-
}
|
|
1230
|
-
else {
|
|
1231
|
-
_nextProxy = telemetryChain;
|
|
1232
|
-
}
|
|
1311
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1312
|
+
var _nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1313
|
+
var _onComplete = [];
|
|
1233
1314
|
var context = {
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1315
|
+
_next: _moveNext,
|
|
1316
|
+
ctx: {
|
|
1317
|
+
core: function () { return core; },
|
|
1318
|
+
diagLog: function () {
|
|
1319
|
+
return safeGetLogger(core, config);
|
|
1320
|
+
},
|
|
1321
|
+
getCfg: function () {
|
|
1322
|
+
return config;
|
|
1323
|
+
},
|
|
1324
|
+
getExtCfg: _getExtCfg,
|
|
1325
|
+
getConfig: _getConfig,
|
|
1326
|
+
hasNext: function () {
|
|
1327
|
+
return !!_nextProxy;
|
|
1328
|
+
},
|
|
1329
|
+
getNext: function () {
|
|
1330
|
+
return _nextProxy;
|
|
1331
|
+
},
|
|
1332
|
+
setNext: function (nextPlugin) {
|
|
1333
|
+
_nextProxy = nextPlugin;
|
|
1334
|
+
},
|
|
1335
|
+
iterate: _iterateChain,
|
|
1336
|
+
onComplete: _addOnComplete
|
|
1337
|
+
}
|
|
1338
|
+
};
|
|
1339
|
+
function _addOnComplete(onComplete, that) {
|
|
1340
|
+
var args = [];
|
|
1341
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1342
|
+
args[_i - 2] = arguments[_i];
|
|
1343
|
+
}
|
|
1344
|
+
if (onComplete) {
|
|
1345
|
+
_onComplete.push({
|
|
1346
|
+
func: onComplete,
|
|
1347
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1348
|
+
args: args
|
|
1257
1349
|
});
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
function _moveNext() {
|
|
1353
|
+
var nextProxy = _nextProxy;
|
|
1354
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1355
|
+
if (!nextProxy) {
|
|
1356
|
+
var onComplete = _onComplete;
|
|
1357
|
+
if (onComplete && onComplete.length > 0) {
|
|
1358
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
1359
|
+
try {
|
|
1360
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1361
|
+
}
|
|
1362
|
+
catch (e) {
|
|
1363
|
+
core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1364
|
+
}
|
|
1365
|
+
});
|
|
1366
|
+
_onComplete = [];
|
|
1264
1367
|
}
|
|
1265
|
-
return createProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1266
|
-
},
|
|
1267
|
-
onComplete: function (onComplete) {
|
|
1268
|
-
_onComplete = onComplete;
|
|
1269
1368
|
}
|
|
1270
|
-
|
|
1369
|
+
return nextProxy;
|
|
1370
|
+
}
|
|
1271
1371
|
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1272
1372
|
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1273
1373
|
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
@@ -1310,29 +1410,53 @@
|
|
|
1310
1410
|
}
|
|
1311
1411
|
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1312
1412
|
}
|
|
1313
|
-
function
|
|
1314
|
-
var nextPlugin
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
else {
|
|
1320
|
-
if (_onComplete) {
|
|
1321
|
-
_onComplete();
|
|
1322
|
-
_onComplete = null;
|
|
1413
|
+
function _iterateChain(cb) {
|
|
1414
|
+
var nextPlugin;
|
|
1415
|
+
while (!!(nextPlugin = context._next())) {
|
|
1416
|
+
var plugin = nextPlugin.getPlugin();
|
|
1417
|
+
if (plugin) {
|
|
1418
|
+
cb(plugin);
|
|
1323
1419
|
}
|
|
1324
1420
|
}
|
|
1325
1421
|
}
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1422
|
+
return context;
|
|
1423
|
+
}
|
|
1424
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1425
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1426
|
+
var context = internalContext.ctx;
|
|
1427
|
+
function _processNext(env) {
|
|
1428
|
+
var nextPlugin = internalContext._next();
|
|
1429
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1430
|
+
return !nextPlugin;
|
|
1431
|
+
}
|
|
1432
|
+
function _createNew(plugins, startAt) {
|
|
1433
|
+
if (plugins === void 0) { plugins = null; }
|
|
1434
|
+
if (isArray(plugins)) {
|
|
1435
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1436
|
+
}
|
|
1437
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1438
|
+
}
|
|
1439
|
+
context.processNext = _processNext;
|
|
1440
|
+
context.createNew = _createNew;
|
|
1441
|
+
return context;
|
|
1442
|
+
}
|
|
1443
|
+
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1444
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1445
|
+
var context = internalContext.ctx;
|
|
1446
|
+
function _processNext(unloadState) {
|
|
1447
|
+
var nextPlugin = internalContext._next();
|
|
1448
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1449
|
+
return !nextPlugin;
|
|
1450
|
+
}
|
|
1451
|
+
function _createNew(plugins, startAt) {
|
|
1452
|
+
if (plugins === void 0) { plugins = null; }
|
|
1453
|
+
if (isArray(plugins)) {
|
|
1454
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1334
1455
|
}
|
|
1456
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1335
1457
|
}
|
|
1458
|
+
context.processNext = _processNext;
|
|
1459
|
+
context.createNew = _createNew;
|
|
1336
1460
|
return context;
|
|
1337
1461
|
}
|
|
1338
1462
|
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
@@ -1380,32 +1504,35 @@
|
|
|
1380
1504
|
return nextProxy;
|
|
1381
1505
|
},
|
|
1382
1506
|
processTelemetry: _processTelemetry,
|
|
1507
|
+
unload: _unloadPlugin,
|
|
1383
1508
|
_id: chainId,
|
|
1384
1509
|
_setNext: function (nextPlugin) {
|
|
1385
1510
|
nextProxy = nextPlugin;
|
|
1386
1511
|
}
|
|
1387
1512
|
};
|
|
1388
|
-
function
|
|
1513
|
+
function _getTelCtx() {
|
|
1514
|
+
var itemCtx;
|
|
1515
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1516
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1517
|
+
}
|
|
1389
1518
|
if (!itemCtx) {
|
|
1390
|
-
|
|
1391
|
-
itemCtx = plugin[strGetTelCtx]();
|
|
1392
|
-
}
|
|
1393
|
-
if (!itemCtx) {
|
|
1394
|
-
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1395
|
-
}
|
|
1519
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1396
1520
|
}
|
|
1521
|
+
return itemCtx;
|
|
1522
|
+
}
|
|
1523
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1524
|
+
var hasRun = false;
|
|
1397
1525
|
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1398
1526
|
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1399
1527
|
if (!hasRunContext) {
|
|
1400
1528
|
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1401
1529
|
}
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
if (plugin) {
|
|
1530
|
+
itemCtx.setNext(nextProxy);
|
|
1531
|
+
if (plugin) {
|
|
1532
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1533
|
+
hasRunContext[chainId] = true;
|
|
1407
1534
|
try {
|
|
1408
|
-
var nextId = nextProxy ? nextProxy._id :
|
|
1535
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty$1;
|
|
1409
1536
|
if (nextId) {
|
|
1410
1537
|
hasRunContext[nextId] = false;
|
|
1411
1538
|
}
|
|
@@ -1417,18 +1544,21 @@
|
|
|
1417
1544
|
hasRun = true;
|
|
1418
1545
|
}
|
|
1419
1546
|
if (!nextProxy || !hasNextRun) {
|
|
1420
|
-
itemCtx.diagLog().throwInternal(
|
|
1547
|
+
itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1421
1548
|
}
|
|
1422
1549
|
}
|
|
1423
|
-
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
}
|
|
1427
|
-
}, details, isAsync);
|
|
1550
|
+
}, details, isAsync);
|
|
1551
|
+
}
|
|
1552
|
+
return hasRun;
|
|
1428
1553
|
}
|
|
1429
1554
|
function _processTelemetry(env, itemCtx) {
|
|
1430
|
-
|
|
1431
|
-
|
|
1555
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
1556
|
+
function _callProcessTelemetry(itemCtx) {
|
|
1557
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
1558
|
+
return false;
|
|
1559
|
+
}
|
|
1560
|
+
var pluginState = _getPluginState(plugin);
|
|
1561
|
+
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
1432
1562
|
return false;
|
|
1433
1563
|
}
|
|
1434
1564
|
if (hasSetNext) {
|
|
@@ -1436,9 +1566,31 @@
|
|
|
1436
1566
|
}
|
|
1437
1567
|
plugin.processTelemetry(env, itemCtx);
|
|
1438
1568
|
return true;
|
|
1439
|
-
}
|
|
1440
|
-
|
|
1441
|
-
|
|
1569
|
+
}
|
|
1570
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1571
|
+
itemCtx.processNext(env);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1575
|
+
function _callTeardown() {
|
|
1576
|
+
var hasRun = false;
|
|
1577
|
+
if (plugin) {
|
|
1578
|
+
var pluginState = _getPluginState(plugin);
|
|
1579
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1580
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1581
|
+
pluginState[strCore] = null;
|
|
1582
|
+
pluginState[strTeardown] = true;
|
|
1583
|
+
pluginState[strIsInitialized] = false;
|
|
1584
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1585
|
+
hasRun = true;
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
return hasRun;
|
|
1590
|
+
}
|
|
1591
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1592
|
+
unloadCtx.processNext(unloadState);
|
|
1593
|
+
}
|
|
1442
1594
|
}
|
|
1443
1595
|
return objFreeze(proxyChain);
|
|
1444
1596
|
}
|
|
@@ -1459,6 +1611,38 @@
|
|
|
1459
1611
|
_setDefaults(config, core, pluginChain);
|
|
1460
1612
|
_isinitialized = true;
|
|
1461
1613
|
};
|
|
1614
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
1615
|
+
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
1616
|
+
return;
|
|
1617
|
+
}
|
|
1618
|
+
var result;
|
|
1619
|
+
var unloadDone = false;
|
|
1620
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1621
|
+
var theUnloadState = unloadState || {
|
|
1622
|
+
reason: 0 ,
|
|
1623
|
+
isAsync: false
|
|
1624
|
+
};
|
|
1625
|
+
function _unloadCallback() {
|
|
1626
|
+
if (!unloadDone) {
|
|
1627
|
+
unloadDone = true;
|
|
1628
|
+
arrForEach(_hooks, function (fn) {
|
|
1629
|
+
fn.rm();
|
|
1630
|
+
});
|
|
1631
|
+
_hooks = [];
|
|
1632
|
+
if (result === true) {
|
|
1633
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
1634
|
+
}
|
|
1635
|
+
_initDefaults();
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
1639
|
+
_unloadCallback();
|
|
1640
|
+
}
|
|
1641
|
+
else {
|
|
1642
|
+
result = true;
|
|
1643
|
+
}
|
|
1644
|
+
return result;
|
|
1645
|
+
};
|
|
1462
1646
|
_self._addHook = function (hooks) {
|
|
1463
1647
|
if (hooks) {
|
|
1464
1648
|
if (isArray(hooks)) {
|
|
@@ -1473,13 +1657,13 @@
|
|
|
1473
1657
|
_self.diagLog = function (itemCtx) {
|
|
1474
1658
|
return _getTelCtx(itemCtx).diagLog();
|
|
1475
1659
|
};
|
|
1476
|
-
_self
|
|
1660
|
+
_self[strIsInitialized] = function () {
|
|
1477
1661
|
return _isinitialized;
|
|
1478
1662
|
};
|
|
1479
1663
|
_self.setInitialized = function (isInitialized) {
|
|
1480
1664
|
_isinitialized = isInitialized;
|
|
1481
1665
|
};
|
|
1482
|
-
_self
|
|
1666
|
+
_self[strSetNextPlugin] = function (next) {
|
|
1483
1667
|
_nextPlugin = next;
|
|
1484
1668
|
};
|
|
1485
1669
|
_self.processNext = function (env, itemCtx) {
|
|
@@ -1530,6 +1714,191 @@
|
|
|
1530
1714
|
return BaseTelemetryPlugin;
|
|
1531
1715
|
}());
|
|
1532
1716
|
|
|
1717
|
+
var strOnPrefix = "on";
|
|
1718
|
+
var strAttachEvent = "attachEvent";
|
|
1719
|
+
var strAddEventHelper = "addEventListener";
|
|
1720
|
+
var strEvents = "events";
|
|
1721
|
+
createUniqueNamespace("aiEvtPageHide");
|
|
1722
|
+
createUniqueNamespace("aiEvtPageShow");
|
|
1723
|
+
var _guid = 1;
|
|
1724
|
+
var elmNodeData = createElmNodeData("events");
|
|
1725
|
+
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
1726
|
+
function _normalizeNamespace(name) {
|
|
1727
|
+
if (name && name.replace) {
|
|
1728
|
+
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
1729
|
+
}
|
|
1730
|
+
return name;
|
|
1731
|
+
}
|
|
1732
|
+
function _getEvtNamespace(eventName, namespaces) {
|
|
1733
|
+
if (namespaces) {
|
|
1734
|
+
var theNamespace_1 = "";
|
|
1735
|
+
if (isArray(namespaces)) {
|
|
1736
|
+
theNamespace_1 = "";
|
|
1737
|
+
arrForEach(namespaces, function (name) {
|
|
1738
|
+
name = _normalizeNamespace(name);
|
|
1739
|
+
if (name) {
|
|
1740
|
+
if (name[0] !== ".") {
|
|
1741
|
+
name = "." + name;
|
|
1742
|
+
}
|
|
1743
|
+
theNamespace_1 += name;
|
|
1744
|
+
}
|
|
1745
|
+
});
|
|
1746
|
+
}
|
|
1747
|
+
else {
|
|
1748
|
+
theNamespace_1 = _normalizeNamespace(namespaces);
|
|
1749
|
+
}
|
|
1750
|
+
if (theNamespace_1) {
|
|
1751
|
+
if (theNamespace_1[0] !== ".") {
|
|
1752
|
+
theNamespace_1 = "." + theNamespace_1;
|
|
1753
|
+
}
|
|
1754
|
+
eventName = (eventName || "") + theNamespace_1;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
var parsedEvent = (eventNamespace.exec(eventName) || []);
|
|
1758
|
+
return {
|
|
1759
|
+
type: parsedEvent[1],
|
|
1760
|
+
ns: ((parsedEvent[2] || "").split(".").sort()).join(".")
|
|
1761
|
+
};
|
|
1762
|
+
}
|
|
1763
|
+
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
1764
|
+
if (addDefault === void 0) { addDefault = true; }
|
|
1765
|
+
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
1766
|
+
var registeredEvents = aiEvts[evtName];
|
|
1767
|
+
if (!registeredEvents) {
|
|
1768
|
+
registeredEvents = aiEvts[evtName] = [];
|
|
1769
|
+
}
|
|
1770
|
+
return registeredEvents;
|
|
1771
|
+
}
|
|
1772
|
+
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
1773
|
+
var result = false;
|
|
1774
|
+
if (obj && evtName && evtName.type && handlerRef) {
|
|
1775
|
+
if (obj[strAddEventHelper]) {
|
|
1776
|
+
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
1777
|
+
result = true;
|
|
1778
|
+
}
|
|
1779
|
+
else if (obj[strAttachEvent]) {
|
|
1780
|
+
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
1781
|
+
result = true;
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
return result;
|
|
1785
|
+
}
|
|
1786
|
+
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
1787
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
1788
|
+
var result = false;
|
|
1789
|
+
if (target) {
|
|
1790
|
+
try {
|
|
1791
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
1792
|
+
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
1793
|
+
if (result && elmNodeData.accept(target)) {
|
|
1794
|
+
var registeredEvent = {
|
|
1795
|
+
guid: _guid++,
|
|
1796
|
+
evtName: evtName,
|
|
1797
|
+
handler: handlerRef,
|
|
1798
|
+
capture: useCapture
|
|
1799
|
+
};
|
|
1800
|
+
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
catch (e) {
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
return result;
|
|
1807
|
+
}
|
|
1808
|
+
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
1809
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
1810
|
+
return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
var LoggingSeverity = createEnumStyle({
|
|
1814
|
+
CRITICAL: 1 ,
|
|
1815
|
+
WARNING: 2
|
|
1816
|
+
});
|
|
1817
|
+
var _InternalMessageId = createEnumStyle({
|
|
1818
|
+
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
1819
|
+
BrowserCannotReadLocalStorage: 1 ,
|
|
1820
|
+
BrowserCannotReadSessionStorage: 2 ,
|
|
1821
|
+
BrowserCannotWriteLocalStorage: 3 ,
|
|
1822
|
+
BrowserCannotWriteSessionStorage: 4 ,
|
|
1823
|
+
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
1824
|
+
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
1825
|
+
CannotSendEmptyTelemetry: 7 ,
|
|
1826
|
+
ClientPerformanceMathError: 8 ,
|
|
1827
|
+
ErrorParsingAISessionCookie: 9 ,
|
|
1828
|
+
ErrorPVCalc: 10 ,
|
|
1829
|
+
ExceptionWhileLoggingError: 11 ,
|
|
1830
|
+
FailedAddingTelemetryToBuffer: 12 ,
|
|
1831
|
+
FailedMonitorAjaxAbort: 13 ,
|
|
1832
|
+
FailedMonitorAjaxDur: 14 ,
|
|
1833
|
+
FailedMonitorAjaxOpen: 15 ,
|
|
1834
|
+
FailedMonitorAjaxRSC: 16 ,
|
|
1835
|
+
FailedMonitorAjaxSend: 17 ,
|
|
1836
|
+
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
1837
|
+
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
1838
|
+
FailedToSendQueuedTelemetry: 20 ,
|
|
1839
|
+
FailedToReportDataLoss: 21 ,
|
|
1840
|
+
FlushFailed: 22 ,
|
|
1841
|
+
MessageLimitPerPVExceeded: 23 ,
|
|
1842
|
+
MissingRequiredFieldSpecification: 24 ,
|
|
1843
|
+
NavigationTimingNotSupported: 25 ,
|
|
1844
|
+
OnError: 26 ,
|
|
1845
|
+
SessionRenewalDateIsZero: 27 ,
|
|
1846
|
+
SenderNotInitialized: 28 ,
|
|
1847
|
+
StartTrackEventFailed: 29 ,
|
|
1848
|
+
StopTrackEventFailed: 30 ,
|
|
1849
|
+
StartTrackFailed: 31 ,
|
|
1850
|
+
StopTrackFailed: 32 ,
|
|
1851
|
+
TelemetrySampledAndNotSent: 33 ,
|
|
1852
|
+
TrackEventFailed: 34 ,
|
|
1853
|
+
TrackExceptionFailed: 35 ,
|
|
1854
|
+
TrackMetricFailed: 36 ,
|
|
1855
|
+
TrackPVFailed: 37 ,
|
|
1856
|
+
TrackPVFailedCalc: 38 ,
|
|
1857
|
+
TrackTraceFailed: 39 ,
|
|
1858
|
+
TransmissionFailed: 40 ,
|
|
1859
|
+
FailedToSetStorageBuffer: 41 ,
|
|
1860
|
+
FailedToRestoreStorageBuffer: 42 ,
|
|
1861
|
+
InvalidBackendResponse: 43 ,
|
|
1862
|
+
FailedToFixDepricatedValues: 44 ,
|
|
1863
|
+
InvalidDurationValue: 45 ,
|
|
1864
|
+
TelemetryEnvelopeInvalid: 46 ,
|
|
1865
|
+
CreateEnvelopeError: 47 ,
|
|
1866
|
+
CannotSerializeObject: 48 ,
|
|
1867
|
+
CannotSerializeObjectNonSerializable: 49 ,
|
|
1868
|
+
CircularReferenceDetected: 50 ,
|
|
1869
|
+
ClearAuthContextFailed: 51 ,
|
|
1870
|
+
ExceptionTruncated: 52 ,
|
|
1871
|
+
IllegalCharsInName: 53 ,
|
|
1872
|
+
ItemNotInArray: 54 ,
|
|
1873
|
+
MaxAjaxPerPVExceeded: 55 ,
|
|
1874
|
+
MessageTruncated: 56 ,
|
|
1875
|
+
NameTooLong: 57 ,
|
|
1876
|
+
SampleRateOutOfRange: 58 ,
|
|
1877
|
+
SetAuthContextFailed: 59 ,
|
|
1878
|
+
SetAuthContextFailedAccountName: 60 ,
|
|
1879
|
+
StringValueTooLong: 61 ,
|
|
1880
|
+
StartCalledMoreThanOnce: 62 ,
|
|
1881
|
+
StopCalledWithoutStart: 63 ,
|
|
1882
|
+
TelemetryInitializerFailed: 64 ,
|
|
1883
|
+
TrackArgumentsNotSpecified: 65 ,
|
|
1884
|
+
UrlTooLong: 66 ,
|
|
1885
|
+
SessionStorageBufferFull: 67 ,
|
|
1886
|
+
CannotAccessCookie: 68 ,
|
|
1887
|
+
IdTooLong: 69 ,
|
|
1888
|
+
InvalidEvent: 70 ,
|
|
1889
|
+
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
1890
|
+
SendBrowserInfoOnUserInit: 72 ,
|
|
1891
|
+
PluginException: 73 ,
|
|
1892
|
+
NotificationException: 74 ,
|
|
1893
|
+
SnippetScriptLoadFailure: 99 ,
|
|
1894
|
+
InvalidInstrumentationKey: 100 ,
|
|
1895
|
+
CannotParseAiBlobValue: 101 ,
|
|
1896
|
+
InvalidContentBlob: 102 ,
|
|
1897
|
+
TrackPageActionEventFailed: 103 ,
|
|
1898
|
+
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
1899
|
+
InMemoryStorageBufferFull: 105
|
|
1900
|
+
});
|
|
1901
|
+
|
|
1533
1902
|
var RequestHeaders = {
|
|
1534
1903
|
requestContextHeader: "Request-Context",
|
|
1535
1904
|
requestContextTargetKey: "appId",
|
|
@@ -1562,7 +1931,7 @@
|
|
|
1562
1931
|
name = strTrim(name.toString());
|
|
1563
1932
|
if (name.length > 150 ) {
|
|
1564
1933
|
nameTrunc = name.substring(0, 150 );
|
|
1565
|
-
logger && logger.throwInternal(
|
|
1934
|
+
logger && logger.throwInternal(2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
|
|
1566
1935
|
}
|
|
1567
1936
|
}
|
|
1568
1937
|
return nameTrunc || name;
|
|
@@ -1575,7 +1944,7 @@
|
|
|
1575
1944
|
value = strTrim(value);
|
|
1576
1945
|
if (value.toString().length > maxLength) {
|
|
1577
1946
|
valueTrunc = value.toString().substring(0, maxLength);
|
|
1578
|
-
logger && logger.throwInternal(
|
|
1947
|
+
logger && logger.throwInternal(2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
|
|
1579
1948
|
}
|
|
1580
1949
|
}
|
|
1581
1950
|
return valueTrunc || value;
|
|
@@ -1588,7 +1957,7 @@
|
|
|
1588
1957
|
if (message) {
|
|
1589
1958
|
if (message.length > 32768 ) {
|
|
1590
1959
|
messageTrunc = message.substring(0, 32768 );
|
|
1591
|
-
logger && logger.throwInternal(
|
|
1960
|
+
logger && logger.throwInternal(2 , _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
|
|
1592
1961
|
}
|
|
1593
1962
|
}
|
|
1594
1963
|
return messageTrunc || message;
|
|
@@ -1599,7 +1968,7 @@
|
|
|
1599
1968
|
var value = "" + exception;
|
|
1600
1969
|
if (value.length > 32768 ) {
|
|
1601
1970
|
exceptionTrunc = value.substring(0, 32768 );
|
|
1602
|
-
logger && logger.throwInternal(
|
|
1971
|
+
logger && logger.throwInternal(2 , _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
|
|
1603
1972
|
}
|
|
1604
1973
|
}
|
|
1605
1974
|
return exceptionTrunc || exception;
|
|
@@ -1613,7 +1982,7 @@
|
|
|
1613
1982
|
value = getJSON().stringify(value);
|
|
1614
1983
|
}
|
|
1615
1984
|
catch (e) {
|
|
1616
|
-
logger && logger.throwInternal(
|
|
1985
|
+
logger && logger.throwInternal(2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
|
|
1617
1986
|
}
|
|
1618
1987
|
}
|
|
1619
1988
|
value = dataSanitizeString(logger, value, 8192 );
|
|
@@ -1644,7 +2013,7 @@
|
|
|
1644
2013
|
input = strTrim(input);
|
|
1645
2014
|
if (input.length > maxLength) {
|
|
1646
2015
|
inputTrunc = input.substring(0, maxLength);
|
|
1647
|
-
logger && logger.throwInternal(
|
|
2016
|
+
logger && logger.throwInternal(2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
|
|
1648
2017
|
}
|
|
1649
2018
|
}
|
|
1650
2019
|
return inputTrunc || input;
|
|
@@ -1654,21 +2023,22 @@
|
|
|
1654
2023
|
return s.substr(s.length - 3);
|
|
1655
2024
|
}
|
|
1656
2025
|
|
|
2026
|
+
var strEmpty = "";
|
|
1657
2027
|
function msToTimeSpan(totalms) {
|
|
1658
2028
|
if (isNaN(totalms) || totalms < 0) {
|
|
1659
2029
|
totalms = 0;
|
|
1660
2030
|
}
|
|
1661
2031
|
totalms = Math.round(totalms);
|
|
1662
|
-
var ms =
|
|
1663
|
-
var sec =
|
|
1664
|
-
var min =
|
|
1665
|
-
var hour =
|
|
2032
|
+
var ms = strEmpty + totalms % 1000;
|
|
2033
|
+
var sec = strEmpty + Math.floor(totalms / 1000) % 60;
|
|
2034
|
+
var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
|
|
2035
|
+
var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
|
|
1666
2036
|
var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
|
|
1667
2037
|
ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
|
|
1668
2038
|
sec = sec.length < 2 ? "0" + sec : sec;
|
|
1669
2039
|
min = min.length < 2 ? "0" + min : min;
|
|
1670
2040
|
hour = hour.length < 2 ? "0" + hour : hour;
|
|
1671
|
-
return (days > 0 ? days + "." :
|
|
2041
|
+
return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
|
|
1672
2042
|
}
|
|
1673
2043
|
|
|
1674
2044
|
var DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
|
|
@@ -1677,17 +2047,15 @@
|
|
|
1677
2047
|
var HttpMethod = "http.method";
|
|
1678
2048
|
var strNotSpecified = "not_specified";
|
|
1679
2049
|
|
|
1680
|
-
var StorageType
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
|
|
1690
|
-
})(DistributedTracingModes || (DistributedTracingModes = {}));
|
|
2050
|
+
var StorageType = createEnumStyle({
|
|
2051
|
+
LocalStorage: 0 ,
|
|
2052
|
+
SessionStorage: 1
|
|
2053
|
+
});
|
|
2054
|
+
createEnumStyle({
|
|
2055
|
+
AI: 0 ,
|
|
2056
|
+
AI_AND_W3C: 1 ,
|
|
2057
|
+
W3C: 2
|
|
2058
|
+
});
|
|
1691
2059
|
|
|
1692
2060
|
var _canUseSessionStorage = undefined;
|
|
1693
2061
|
function _getVerifiedStorageObject(storageType) {
|
|
@@ -1728,7 +2096,7 @@
|
|
|
1728
2096
|
}
|
|
1729
2097
|
catch (e) {
|
|
1730
2098
|
_canUseSessionStorage = false;
|
|
1731
|
-
logger.throwInternal(
|
|
2099
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1732
2100
|
}
|
|
1733
2101
|
}
|
|
1734
2102
|
return null;
|
|
@@ -1742,7 +2110,7 @@
|
|
|
1742
2110
|
}
|
|
1743
2111
|
catch (e) {
|
|
1744
2112
|
_canUseSessionStorage = false;
|
|
1745
|
-
logger.throwInternal(
|
|
2113
|
+
logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1746
2114
|
}
|
|
1747
2115
|
}
|
|
1748
2116
|
return false;
|
|
@@ -3019,7 +3387,7 @@
|
|
|
3019
3387
|
}
|
|
3020
3388
|
}
|
|
3021
3389
|
var EnvelopeCreator = {
|
|
3022
|
-
Version: "2.8.0-beta.2203-
|
|
3390
|
+
Version: "2.8.0-beta.2203-02"
|
|
3023
3391
|
};
|
|
3024
3392
|
function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
|
|
3025
3393
|
EnvelopeCreatorInit(logger, telemetryItem);
|