@microsoft/applicationinsights-clickanalytics-js 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/browser/{ai.clck.2.8.0-beta.2202-07.cjs.js → ai.clck.2.8.0-beta.2203-03.cjs.js} +663 -212
- package/browser/ai.clck.2.8.0-beta.2203-03.cjs.js.map +1 -0
- package/browser/ai.clck.2.8.0-beta.2203-03.cjs.min.js +6 -0
- package/browser/ai.clck.2.8.0-beta.2203-03.cjs.min.js.map +1 -0
- package/browser/{ai.clck.2.8.0-beta.2202-07.gbl.js → ai.clck.2.8.0-beta.2203-03.gbl.js} +663 -212
- package/browser/ai.clck.2.8.0-beta.2203-03.gbl.js.map +1 -0
- package/browser/ai.clck.2.8.0-beta.2203-03.gbl.min.js +6 -0
- package/browser/ai.clck.2.8.0-beta.2203-03.gbl.min.js.map +1 -0
- package/browser/ai.clck.2.8.0-beta.2203-03.integrity.json +66 -0
- package/browser/{ai.clck.2.8.0-beta.2202-07.js → ai.clck.2.8.0-beta.2203-03.js} +663 -212
- package/browser/ai.clck.2.8.0-beta.2203-03.js.map +1 -0
- package/browser/ai.clck.2.8.0-beta.2203-03.min.js +6 -0
- package/browser/ai.clck.2.8.0-beta.2203-03.min.js.map +1 -0
- package/browser/ai.clck.2.cjs.js +662 -211
- package/browser/ai.clck.2.cjs.js.map +1 -1
- package/browser/ai.clck.2.cjs.min.js +2 -2
- package/browser/ai.clck.2.cjs.min.js.map +1 -1
- package/browser/ai.clck.2.gbl.js +662 -211
- package/browser/ai.clck.2.gbl.js.map +1 -1
- package/browser/ai.clck.2.gbl.min.js +2 -2
- package/browser/ai.clck.2.gbl.min.js.map +1 -1
- package/browser/ai.clck.2.js +662 -211
- package/browser/ai.clck.2.js.map +1 -1
- package/browser/ai.clck.2.min.js +2 -2
- package/browser/ai.clck.2.min.js.map +1 -1
- package/dist/applicationinsights-clickanalytics-js.d.ts +1 -1
- package/dist/applicationinsights-clickanalytics-js.js +662 -211
- package/dist/applicationinsights-clickanalytics-js.js.map +1 -1
- package/dist/applicationinsights-clickanalytics-js.min.js +2 -2
- package/dist/applicationinsights-clickanalytics-js.min.js.map +1 -1
- package/dist/applicationinsights-clickanalytics-js.rollup.d.ts +1 -1
- package/dist-esm/Behaviours.js +1 -1
- package/dist-esm/ClickAnalyticsPlugin.js +2 -2
- package/dist-esm/ClickAnalyticsPlugin.js.map +1 -1
- package/dist-esm/DataCollector.js +1 -1
- package/dist-esm/Enums.js +1 -1
- package/dist-esm/Interfaces/Datamodel.js +1 -1
- package/dist-esm/applicationinsights-clickanalytics-js.js +1 -1
- package/dist-esm/common/Utils.js +1 -1
- package/dist-esm/events/PageAction.js +1 -1
- package/dist-esm/events/WebEvent.js +1 -1
- package/dist-esm/handlers/AutoCaptureHandler.js +1 -1
- package/dist-esm/handlers/DomContentHandler.js +1 -1
- package/package.json +4 -4
- package/src/ClickAnalyticsPlugin.ts +1 -1
- package/browser/ai.clck.2.8.0-beta.2202-07.cjs.js.map +0 -1
- package/browser/ai.clck.2.8.0-beta.2202-07.cjs.min.js +0 -6
- package/browser/ai.clck.2.8.0-beta.2202-07.cjs.min.js.map +0 -1
- package/browser/ai.clck.2.8.0-beta.2202-07.gbl.js.map +0 -1
- package/browser/ai.clck.2.8.0-beta.2202-07.gbl.min.js +0 -6
- package/browser/ai.clck.2.8.0-beta.2202-07.gbl.min.js.map +0 -1
- package/browser/ai.clck.2.8.0-beta.2202-07.integrity.json +0 -66
- package/browser/ai.clck.2.8.0-beta.2202-07.js.map +0 -1
- package/browser/ai.clck.2.8.0-beta.2202-07.min.js +0 -6
- package/browser/ai.clck.2.8.0-beta.2202-07.min.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Click Analytics, 2.8.0-beta.
|
|
2
|
+
* Application Insights JavaScript SDK - Click Analytics, 2.8.0-beta.2203-03
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -335,108 +335,26 @@
|
|
|
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 = "";
|
|
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 strToString = "toString";
|
|
432
347
|
var str__Proto = "__proto__";
|
|
433
348
|
var strConstructor = "constructor";
|
|
434
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
349
|
+
var _objDefineProperty$1 = ObjDefineProperty;
|
|
435
350
|
var _objFreeze = ObjClass.freeze;
|
|
436
351
|
var _isArray = Array.isArray;
|
|
437
352
|
var _objToString = ObjProto[strToString];
|
|
438
353
|
var _fnToString = ObjHasOwnProperty[strToString];
|
|
439
354
|
var _objFunctionString = _fnToString.call(ObjClass);
|
|
355
|
+
var rCamelCase = /-([a-z])/g;
|
|
356
|
+
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
357
|
+
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
440
358
|
var _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
441
359
|
function _getObjProto(target) {
|
|
442
360
|
if (target) {
|
|
@@ -465,24 +383,18 @@
|
|
|
465
383
|
function isFunction(value) {
|
|
466
384
|
return !!(value && typeof value === strShimFunction);
|
|
467
385
|
}
|
|
468
|
-
function
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
479
|
-
result = true;
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
catch (e) {
|
|
483
|
-
}
|
|
386
|
+
function normalizeJsName(name) {
|
|
387
|
+
var value = name;
|
|
388
|
+
if (value && isString(value)) {
|
|
389
|
+
value = value.replace(rCamelCase, function (_all, letter) {
|
|
390
|
+
return letter.toUpperCase();
|
|
391
|
+
});
|
|
392
|
+
value = value.replace(rNormalizeInvalid, "_");
|
|
393
|
+
value = value.replace(rLeadingNumeric, function (_all, match) {
|
|
394
|
+
return "_" + match;
|
|
395
|
+
});
|
|
484
396
|
}
|
|
485
|
-
return
|
|
397
|
+
return value;
|
|
486
398
|
}
|
|
487
399
|
function objForEachKey(target, callbackfn) {
|
|
488
400
|
if (target) {
|
|
@@ -493,6 +405,12 @@
|
|
|
493
405
|
}
|
|
494
406
|
}
|
|
495
407
|
}
|
|
408
|
+
function strContains(value, search) {
|
|
409
|
+
if (value && search) {
|
|
410
|
+
return value.indexOf(search) !== -1;
|
|
411
|
+
}
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
496
414
|
var isArray = _isArray || _isArrayPoly;
|
|
497
415
|
function _isArrayPoly(obj) {
|
|
498
416
|
return !!(obj && _objToString.call(obj) === "[object Array]");
|
|
@@ -500,6 +418,9 @@
|
|
|
500
418
|
function isError(obj) {
|
|
501
419
|
return !!(obj && _objToString.call(obj) === "[object Error]");
|
|
502
420
|
}
|
|
421
|
+
function isString(value) {
|
|
422
|
+
return typeof value === "string";
|
|
423
|
+
}
|
|
503
424
|
function isBoolean(value) {
|
|
504
425
|
return typeof value === "boolean";
|
|
505
426
|
}
|
|
@@ -534,7 +455,7 @@
|
|
|
534
455
|
}
|
|
535
456
|
}
|
|
536
457
|
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
537
|
-
if (_objDefineProperty) {
|
|
458
|
+
if (_objDefineProperty$1) {
|
|
538
459
|
try {
|
|
539
460
|
var descriptor = {
|
|
540
461
|
enumerable: true,
|
|
@@ -546,7 +467,7 @@
|
|
|
546
467
|
if (setProp) {
|
|
547
468
|
descriptor.set = setProp;
|
|
548
469
|
}
|
|
549
|
-
_objDefineProperty(target, prop, descriptor);
|
|
470
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
550
471
|
return true;
|
|
551
472
|
}
|
|
552
473
|
catch (e) {
|
|
@@ -566,7 +487,7 @@
|
|
|
566
487
|
if (isError(object)) {
|
|
567
488
|
return object.name;
|
|
568
489
|
}
|
|
569
|
-
return
|
|
490
|
+
return strEmpty;
|
|
570
491
|
}
|
|
571
492
|
function setValue(target, field, value, valChk, srcChk) {
|
|
572
493
|
var theValue = value;
|
|
@@ -579,6 +500,47 @@
|
|
|
579
500
|
}
|
|
580
501
|
return theValue;
|
|
581
502
|
}
|
|
503
|
+
function throwError(message) {
|
|
504
|
+
throw new Error(message);
|
|
505
|
+
}
|
|
506
|
+
function _createProxyFunction(source, funcName) {
|
|
507
|
+
var srcFunc = null;
|
|
508
|
+
var src = null;
|
|
509
|
+
if (isFunction(source)) {
|
|
510
|
+
srcFunc = source;
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
src = source;
|
|
514
|
+
}
|
|
515
|
+
return function () {
|
|
516
|
+
var originalArguments = arguments;
|
|
517
|
+
if (srcFunc) {
|
|
518
|
+
src = srcFunc();
|
|
519
|
+
}
|
|
520
|
+
if (src) {
|
|
521
|
+
return src[funcName].apply(src, originalArguments);
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
526
|
+
if (overwriteTarget === void 0) { overwriteTarget = true; }
|
|
527
|
+
if (target && name && source) {
|
|
528
|
+
if (overwriteTarget || isUndefined(target[name])) {
|
|
529
|
+
target[name] = _createProxyFunction(source, theFunc);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
function createEnumStyle(values) {
|
|
534
|
+
var enumClass = {};
|
|
535
|
+
objForEachKey(values, function (field, value) {
|
|
536
|
+
enumClass[field] = value;
|
|
537
|
+
if (!isUndefined(enumClass[value])) {
|
|
538
|
+
throwError("[" + value + "] exists for " + field);
|
|
539
|
+
}
|
|
540
|
+
enumClass[value] = field;
|
|
541
|
+
});
|
|
542
|
+
return objFreeze(enumClass);
|
|
543
|
+
}
|
|
582
544
|
function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
|
|
583
545
|
var theArgs = arguments;
|
|
584
546
|
var extended = theArgs[0] || {};
|
|
@@ -626,10 +588,17 @@
|
|
|
626
588
|
|
|
627
589
|
var strWindow = "window";
|
|
628
590
|
var strDocument = "document";
|
|
591
|
+
var strNavigator = "navigator";
|
|
629
592
|
var strLocation = "location";
|
|
630
593
|
var strConsole = "console";
|
|
631
594
|
var strPerformance = "performance";
|
|
632
595
|
var strJSON = "JSON";
|
|
596
|
+
var strCrypto = "crypto";
|
|
597
|
+
var strMsCrypto = "msCrypto";
|
|
598
|
+
var strMsie = "msie";
|
|
599
|
+
var strTrident = "trident/";
|
|
600
|
+
var _isTrident = null;
|
|
601
|
+
var _navUserAgentCheck = null;
|
|
633
602
|
var _enableMocks = false;
|
|
634
603
|
function getGlobalInst(name) {
|
|
635
604
|
var gbl = getGlobal();
|
|
@@ -659,6 +628,15 @@
|
|
|
659
628
|
}
|
|
660
629
|
return getGlobalInst(strDocument);
|
|
661
630
|
}
|
|
631
|
+
function hasNavigator() {
|
|
632
|
+
return Boolean(typeof navigator === strShimObject && navigator);
|
|
633
|
+
}
|
|
634
|
+
function getNavigator() {
|
|
635
|
+
if (hasNavigator()) {
|
|
636
|
+
return navigator;
|
|
637
|
+
}
|
|
638
|
+
return getGlobalInst(strNavigator);
|
|
639
|
+
}
|
|
662
640
|
function getLocation(checkForMock) {
|
|
663
641
|
if (checkForMock && _enableMocks) {
|
|
664
642
|
var mockLocation = getGlobalInst("__mockLocation");
|
|
@@ -689,9 +667,24 @@
|
|
|
689
667
|
}
|
|
690
668
|
return null;
|
|
691
669
|
}
|
|
670
|
+
function getCrypto() {
|
|
671
|
+
return getGlobalInst(strCrypto);
|
|
672
|
+
}
|
|
673
|
+
function getMsCrypto() {
|
|
674
|
+
return getGlobalInst(strMsCrypto);
|
|
675
|
+
}
|
|
676
|
+
function isIE() {
|
|
677
|
+
var nav = getNavigator();
|
|
678
|
+
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
679
|
+
_navUserAgentCheck = nav.userAgent;
|
|
680
|
+
var userAgent = (_navUserAgentCheck || strEmpty).toLowerCase();
|
|
681
|
+
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
682
|
+
}
|
|
683
|
+
return _isTrident;
|
|
684
|
+
}
|
|
692
685
|
function dumpObj(object) {
|
|
693
686
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
694
|
-
var propertyValueDump =
|
|
687
|
+
var propertyValueDump = strEmpty;
|
|
695
688
|
if (objectTypeDump === "[object Error]") {
|
|
696
689
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
697
690
|
}
|
|
@@ -724,9 +717,9 @@
|
|
|
724
717
|
var strWarnToConsole = "warnToConsole";
|
|
725
718
|
function _sanitizeDiagnosticText(text) {
|
|
726
719
|
if (text) {
|
|
727
|
-
return "\"" + text.replace(/\"/g,
|
|
720
|
+
return "\"" + text.replace(/\"/g, strEmpty) + "\"";
|
|
728
721
|
}
|
|
729
|
-
return
|
|
722
|
+
return strEmpty;
|
|
730
723
|
}
|
|
731
724
|
function _logToConsole(func, message) {
|
|
732
725
|
var theConsole = getConsole();
|
|
@@ -748,12 +741,12 @@
|
|
|
748
741
|
_self.message =
|
|
749
742
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
750
743
|
msgId;
|
|
751
|
-
var strProps =
|
|
744
|
+
var strProps = strEmpty;
|
|
752
745
|
if (hasJSON()) {
|
|
753
746
|
strProps = getJSON().stringify(properties);
|
|
754
747
|
}
|
|
755
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
756
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
748
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty) +
|
|
749
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty);
|
|
757
750
|
_self.message += diagnosticText;
|
|
758
751
|
}
|
|
759
752
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -783,7 +776,7 @@
|
|
|
783
776
|
throw message;
|
|
784
777
|
}
|
|
785
778
|
else {
|
|
786
|
-
var logFunc = severity ===
|
|
779
|
+
var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
|
|
787
780
|
if (!isUndefined(message.message)) {
|
|
788
781
|
var logLevel = _self.consoleLoggingLevel();
|
|
789
782
|
if (isUserAct) {
|
|
@@ -801,7 +794,7 @@
|
|
|
801
794
|
_self.logInternalMessage(severity, message);
|
|
802
795
|
}
|
|
803
796
|
else {
|
|
804
|
-
_debugExtMsg("throw" + (severity ===
|
|
797
|
+
_debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
|
|
805
798
|
}
|
|
806
799
|
}
|
|
807
800
|
};
|
|
@@ -833,13 +826,13 @@
|
|
|
833
826
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
834
827
|
_self.queue.push(message);
|
|
835
828
|
_messageCount++;
|
|
836
|
-
_debugExtMsg((severity ===
|
|
829
|
+
_debugExtMsg((severity === 1 ? "error" : "warn"), message);
|
|
837
830
|
}
|
|
838
831
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
839
832
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
840
|
-
var throttleMessage = new _InternalLogMessage(
|
|
833
|
+
var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
|
|
841
834
|
_self.queue.push(throttleMessage);
|
|
842
|
-
if (severity ===
|
|
835
|
+
if (severity === 1 ) {
|
|
843
836
|
_self.errorToConsole(throttleLimitMessage);
|
|
844
837
|
}
|
|
845
838
|
else {
|
|
@@ -981,6 +974,151 @@
|
|
|
981
974
|
return func();
|
|
982
975
|
}
|
|
983
976
|
|
|
977
|
+
var UInt32Mask = 0x100000000;
|
|
978
|
+
var MaxUInt32 = 0xffffffff;
|
|
979
|
+
var _mwcSeeded = false;
|
|
980
|
+
var _mwcW = 123456789;
|
|
981
|
+
var _mwcZ = 987654321;
|
|
982
|
+
function _mwcSeed(seedValue) {
|
|
983
|
+
if (seedValue < 0) {
|
|
984
|
+
seedValue >>>= 0;
|
|
985
|
+
}
|
|
986
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
987
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
988
|
+
_mwcSeeded = true;
|
|
989
|
+
}
|
|
990
|
+
function _autoSeedMwc() {
|
|
991
|
+
try {
|
|
992
|
+
var now = dateNow() & 0x7fffffff;
|
|
993
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
994
|
+
}
|
|
995
|
+
catch (e) {
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
function random32(signed) {
|
|
999
|
+
var value = 0;
|
|
1000
|
+
var c = getCrypto() || getMsCrypto();
|
|
1001
|
+
if (c && c.getRandomValues) {
|
|
1002
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1003
|
+
}
|
|
1004
|
+
if (value === 0 && isIE()) {
|
|
1005
|
+
if (!_mwcSeeded) {
|
|
1006
|
+
_autoSeedMwc();
|
|
1007
|
+
}
|
|
1008
|
+
value = mwcRandom32() & MaxUInt32;
|
|
1009
|
+
}
|
|
1010
|
+
if (value === 0) {
|
|
1011
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1012
|
+
}
|
|
1013
|
+
if (!signed) {
|
|
1014
|
+
value >>>= 0;
|
|
1015
|
+
}
|
|
1016
|
+
return value;
|
|
1017
|
+
}
|
|
1018
|
+
function mwcRandom32(signed) {
|
|
1019
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1020
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1021
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1022
|
+
if (!signed) {
|
|
1023
|
+
value >>>= 0;
|
|
1024
|
+
}
|
|
1025
|
+
return value;
|
|
1026
|
+
}
|
|
1027
|
+
function newId(maxLength) {
|
|
1028
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1029
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1030
|
+
var number = random32() >>> 0;
|
|
1031
|
+
var chars = 0;
|
|
1032
|
+
var result = strEmpty;
|
|
1033
|
+
while (result.length < maxLength) {
|
|
1034
|
+
chars++;
|
|
1035
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1036
|
+
number >>>= 6;
|
|
1037
|
+
if (chars === 5) {
|
|
1038
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1039
|
+
chars = 0;
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
return result;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
1046
|
+
var version = "2.7.3";
|
|
1047
|
+
var instanceName = "." + newId(6);
|
|
1048
|
+
var _dataUid = 0;
|
|
1049
|
+
function _createAccessor(target, prop, value) {
|
|
1050
|
+
if (_objDefineProperty) {
|
|
1051
|
+
try {
|
|
1052
|
+
_objDefineProperty(target, prop, {
|
|
1053
|
+
value: value,
|
|
1054
|
+
enumerable: false,
|
|
1055
|
+
configurable: true
|
|
1056
|
+
});
|
|
1057
|
+
return true;
|
|
1058
|
+
}
|
|
1059
|
+
catch (e) {
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
return false;
|
|
1063
|
+
}
|
|
1064
|
+
function _canAcceptData(target) {
|
|
1065
|
+
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1066
|
+
}
|
|
1067
|
+
function _getCache(data, target) {
|
|
1068
|
+
var theCache = target[data.id];
|
|
1069
|
+
if (!theCache) {
|
|
1070
|
+
theCache = {};
|
|
1071
|
+
try {
|
|
1072
|
+
if (_canAcceptData(target)) {
|
|
1073
|
+
if (!_createAccessor(target, data.id, theCache)) {
|
|
1074
|
+
target[data.id] = theCache;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
catch (e) {
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
return theCache;
|
|
1082
|
+
}
|
|
1083
|
+
function createUniqueNamespace(name, includeVersion) {
|
|
1084
|
+
if (includeVersion === void 0) { includeVersion = false; }
|
|
1085
|
+
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1086
|
+
}
|
|
1087
|
+
function createElmNodeData(name) {
|
|
1088
|
+
var data = {
|
|
1089
|
+
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1090
|
+
accept: function (target) {
|
|
1091
|
+
return _canAcceptData(target);
|
|
1092
|
+
},
|
|
1093
|
+
get: function (target, name, defValue, addDefault) {
|
|
1094
|
+
var theCache = target[data.id];
|
|
1095
|
+
if (!theCache) {
|
|
1096
|
+
if (addDefault) {
|
|
1097
|
+
theCache = _getCache(data, target);
|
|
1098
|
+
theCache[normalizeJsName(name)] = defValue;
|
|
1099
|
+
}
|
|
1100
|
+
return defValue;
|
|
1101
|
+
}
|
|
1102
|
+
return theCache[normalizeJsName(name)];
|
|
1103
|
+
},
|
|
1104
|
+
kill: function (target, name) {
|
|
1105
|
+
if (target && target[name]) {
|
|
1106
|
+
try {
|
|
1107
|
+
delete target[name];
|
|
1108
|
+
}
|
|
1109
|
+
catch (e) {
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
return data;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1118
|
+
function _getPluginState(plugin) {
|
|
1119
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1120
|
+
}
|
|
1121
|
+
|
|
984
1122
|
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
985
1123
|
var strHasRunFlags = "_hasRun";
|
|
986
1124
|
var strGetTelCtx = "_getTelCtx";
|
|
@@ -994,53 +1132,69 @@
|
|
|
994
1132
|
}
|
|
995
1133
|
return createTelemetryProxyChain([startAt], config, core);
|
|
996
1134
|
}
|
|
997
|
-
function
|
|
1135
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
998
1136
|
var _nextProxy = null;
|
|
999
|
-
var _onComplete =
|
|
1000
|
-
if (startAt) {
|
|
1001
|
-
_nextProxy = _getNextProxyStart(telemetryChain, config, core, startAt);
|
|
1002
|
-
}
|
|
1003
|
-
else {
|
|
1004
|
-
_nextProxy = telemetryChain;
|
|
1137
|
+
var _onComplete = [];
|
|
1138
|
+
if (startAt !== null) {
|
|
1139
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1005
1140
|
}
|
|
1006
1141
|
var context = {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1142
|
+
_next: _moveNext,
|
|
1143
|
+
ctx: {
|
|
1144
|
+
core: function () { return core; },
|
|
1145
|
+
diagLog: function () {
|
|
1146
|
+
return safeGetLogger(core, config);
|
|
1147
|
+
},
|
|
1148
|
+
getCfg: function () {
|
|
1149
|
+
return config;
|
|
1150
|
+
},
|
|
1151
|
+
getExtCfg: _getExtCfg,
|
|
1152
|
+
getConfig: _getConfig,
|
|
1153
|
+
hasNext: function () {
|
|
1154
|
+
return !!_nextProxy;
|
|
1155
|
+
},
|
|
1156
|
+
getNext: function () {
|
|
1157
|
+
return _nextProxy;
|
|
1158
|
+
},
|
|
1159
|
+
setNext: function (nextPlugin) {
|
|
1160
|
+
_nextProxy = nextPlugin;
|
|
1161
|
+
},
|
|
1162
|
+
iterate: _iterateChain,
|
|
1163
|
+
onComplete: _addOnComplete
|
|
1164
|
+
}
|
|
1165
|
+
};
|
|
1166
|
+
function _addOnComplete(onComplete, that) {
|
|
1167
|
+
var args = [];
|
|
1168
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1169
|
+
args[_i - 2] = arguments[_i];
|
|
1170
|
+
}
|
|
1171
|
+
if (onComplete) {
|
|
1172
|
+
_onComplete.push({
|
|
1173
|
+
func: onComplete,
|
|
1174
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1175
|
+
args: args
|
|
1030
1176
|
});
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
function _moveNext() {
|
|
1180
|
+
var nextProxy = _nextProxy;
|
|
1181
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1182
|
+
if (!nextProxy) {
|
|
1183
|
+
var onComplete = _onComplete;
|
|
1184
|
+
if (onComplete && onComplete.length > 0) {
|
|
1185
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
1186
|
+
try {
|
|
1187
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1188
|
+
}
|
|
1189
|
+
catch (e) {
|
|
1190
|
+
core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1191
|
+
}
|
|
1192
|
+
});
|
|
1193
|
+
_onComplete = [];
|
|
1037
1194
|
}
|
|
1038
|
-
return createProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1039
|
-
},
|
|
1040
|
-
onComplete: function (onComplete) {
|
|
1041
|
-
_onComplete = onComplete;
|
|
1042
1195
|
}
|
|
1043
|
-
|
|
1196
|
+
return nextProxy;
|
|
1197
|
+
}
|
|
1044
1198
|
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1045
1199
|
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1046
1200
|
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
@@ -1083,29 +1237,53 @@
|
|
|
1083
1237
|
}
|
|
1084
1238
|
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1085
1239
|
}
|
|
1086
|
-
function
|
|
1087
|
-
var nextPlugin
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
else {
|
|
1093
|
-
if (_onComplete) {
|
|
1094
|
-
_onComplete();
|
|
1095
|
-
_onComplete = null;
|
|
1240
|
+
function _iterateChain(cb) {
|
|
1241
|
+
var nextPlugin;
|
|
1242
|
+
while (!!(nextPlugin = context._next())) {
|
|
1243
|
+
var plugin = nextPlugin.getPlugin();
|
|
1244
|
+
if (plugin) {
|
|
1245
|
+
cb(plugin);
|
|
1096
1246
|
}
|
|
1097
1247
|
}
|
|
1098
1248
|
}
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1249
|
+
return context;
|
|
1250
|
+
}
|
|
1251
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1252
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1253
|
+
var context = internalContext.ctx;
|
|
1254
|
+
function _processNext(env) {
|
|
1255
|
+
var nextPlugin = internalContext._next();
|
|
1256
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1257
|
+
return !nextPlugin;
|
|
1258
|
+
}
|
|
1259
|
+
function _createNew(plugins, startAt) {
|
|
1260
|
+
if (plugins === void 0) { plugins = null; }
|
|
1261
|
+
if (isArray(plugins)) {
|
|
1262
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1263
|
+
}
|
|
1264
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1265
|
+
}
|
|
1266
|
+
context.processNext = _processNext;
|
|
1267
|
+
context.createNew = _createNew;
|
|
1268
|
+
return context;
|
|
1269
|
+
}
|
|
1270
|
+
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1271
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1272
|
+
var context = internalContext.ctx;
|
|
1273
|
+
function _processNext(unloadState) {
|
|
1274
|
+
var nextPlugin = internalContext._next();
|
|
1275
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1276
|
+
return !nextPlugin;
|
|
1277
|
+
}
|
|
1278
|
+
function _createNew(plugins, startAt) {
|
|
1279
|
+
if (plugins === void 0) { plugins = null; }
|
|
1280
|
+
if (isArray(plugins)) {
|
|
1281
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1107
1282
|
}
|
|
1283
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1108
1284
|
}
|
|
1285
|
+
context.processNext = _processNext;
|
|
1286
|
+
context.createNew = _createNew;
|
|
1109
1287
|
return context;
|
|
1110
1288
|
}
|
|
1111
1289
|
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
@@ -1153,32 +1331,35 @@
|
|
|
1153
1331
|
return nextProxy;
|
|
1154
1332
|
},
|
|
1155
1333
|
processTelemetry: _processTelemetry,
|
|
1334
|
+
unload: _unloadPlugin,
|
|
1156
1335
|
_id: chainId,
|
|
1157
1336
|
_setNext: function (nextPlugin) {
|
|
1158
1337
|
nextProxy = nextPlugin;
|
|
1159
1338
|
}
|
|
1160
1339
|
};
|
|
1161
|
-
function
|
|
1340
|
+
function _getTelCtx() {
|
|
1341
|
+
var itemCtx;
|
|
1342
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1343
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1344
|
+
}
|
|
1162
1345
|
if (!itemCtx) {
|
|
1163
|
-
|
|
1164
|
-
itemCtx = plugin[strGetTelCtx]();
|
|
1165
|
-
}
|
|
1166
|
-
if (!itemCtx) {
|
|
1167
|
-
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1168
|
-
}
|
|
1346
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1169
1347
|
}
|
|
1348
|
+
return itemCtx;
|
|
1349
|
+
}
|
|
1350
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1351
|
+
var hasRun = false;
|
|
1170
1352
|
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1171
1353
|
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1172
1354
|
if (!hasRunContext) {
|
|
1173
1355
|
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1174
1356
|
}
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
if (plugin) {
|
|
1357
|
+
itemCtx.setNext(nextProxy);
|
|
1358
|
+
if (plugin) {
|
|
1359
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1360
|
+
hasRunContext[chainId] = true;
|
|
1180
1361
|
try {
|
|
1181
|
-
var nextId = nextProxy ? nextProxy._id :
|
|
1362
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty;
|
|
1182
1363
|
if (nextId) {
|
|
1183
1364
|
hasRunContext[nextId] = false;
|
|
1184
1365
|
}
|
|
@@ -1190,18 +1371,21 @@
|
|
|
1190
1371
|
hasRun = true;
|
|
1191
1372
|
}
|
|
1192
1373
|
if (!nextProxy || !hasNextRun) {
|
|
1193
|
-
itemCtx.diagLog().throwInternal(
|
|
1374
|
+
itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1194
1375
|
}
|
|
1195
1376
|
}
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
}
|
|
1200
|
-
}, details, isAsync);
|
|
1377
|
+
}, details, isAsync);
|
|
1378
|
+
}
|
|
1379
|
+
return hasRun;
|
|
1201
1380
|
}
|
|
1202
1381
|
function _processTelemetry(env, itemCtx) {
|
|
1203
|
-
|
|
1204
|
-
|
|
1382
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
1383
|
+
function _callProcessTelemetry(itemCtx) {
|
|
1384
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
1385
|
+
return false;
|
|
1386
|
+
}
|
|
1387
|
+
var pluginState = _getPluginState(plugin);
|
|
1388
|
+
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
1205
1389
|
return false;
|
|
1206
1390
|
}
|
|
1207
1391
|
if (hasSetNext) {
|
|
@@ -1209,15 +1393,61 @@
|
|
|
1209
1393
|
}
|
|
1210
1394
|
plugin.processTelemetry(env, itemCtx);
|
|
1211
1395
|
return true;
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1396
|
+
}
|
|
1397
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1398
|
+
itemCtx.processNext(env);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1402
|
+
function _callTeardown() {
|
|
1403
|
+
var hasRun = false;
|
|
1404
|
+
if (plugin) {
|
|
1405
|
+
var pluginState = _getPluginState(plugin);
|
|
1406
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1407
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1408
|
+
pluginState[strCore] = null;
|
|
1409
|
+
pluginState[strTeardown] = true;
|
|
1410
|
+
pluginState[strIsInitialized] = false;
|
|
1411
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1412
|
+
hasRun = true;
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
return hasRun;
|
|
1417
|
+
}
|
|
1418
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1419
|
+
unloadCtx.processNext(unloadState);
|
|
1420
|
+
}
|
|
1215
1421
|
}
|
|
1216
1422
|
return objFreeze(proxyChain);
|
|
1217
1423
|
}
|
|
1218
1424
|
|
|
1219
1425
|
var strExtensionConfig = "extensionConfig";
|
|
1220
1426
|
|
|
1427
|
+
function createUnloadHandlerContainer() {
|
|
1428
|
+
var handlers = [];
|
|
1429
|
+
function _addHandler(handler) {
|
|
1430
|
+
if (handler) {
|
|
1431
|
+
handlers.push(handler);
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
1435
|
+
arrForEach(handlers, function (handler) {
|
|
1436
|
+
try {
|
|
1437
|
+
handler(unloadCtx, unloadState);
|
|
1438
|
+
}
|
|
1439
|
+
catch (e) {
|
|
1440
|
+
unloadCtx.diagLog().throwInternal(2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
1441
|
+
}
|
|
1442
|
+
});
|
|
1443
|
+
handlers = [];
|
|
1444
|
+
}
|
|
1445
|
+
return {
|
|
1446
|
+
add: _addHandler,
|
|
1447
|
+
run: _runHandlers
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1221
1451
|
var strGetPlugin = "getPlugin";
|
|
1222
1452
|
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
1223
1453
|
function BaseTelemetryPlugin() {
|
|
@@ -1225,6 +1455,7 @@
|
|
|
1225
1455
|
var _isinitialized;
|
|
1226
1456
|
var _rootCtx;
|
|
1227
1457
|
var _nextPlugin;
|
|
1458
|
+
var _unloadHandlerContainer;
|
|
1228
1459
|
var _hooks;
|
|
1229
1460
|
_initDefaults();
|
|
1230
1461
|
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
@@ -1232,6 +1463,39 @@
|
|
|
1232
1463
|
_setDefaults(config, core, pluginChain);
|
|
1233
1464
|
_isinitialized = true;
|
|
1234
1465
|
};
|
|
1466
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
1467
|
+
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
1468
|
+
return;
|
|
1469
|
+
}
|
|
1470
|
+
var result;
|
|
1471
|
+
var unloadDone = false;
|
|
1472
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1473
|
+
var theUnloadState = unloadState || {
|
|
1474
|
+
reason: 0 ,
|
|
1475
|
+
isAsync: false
|
|
1476
|
+
};
|
|
1477
|
+
function _unloadCallback() {
|
|
1478
|
+
if (!unloadDone) {
|
|
1479
|
+
unloadDone = true;
|
|
1480
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
1481
|
+
arrForEach(_hooks, function (fn) {
|
|
1482
|
+
fn.rm();
|
|
1483
|
+
});
|
|
1484
|
+
_hooks = [];
|
|
1485
|
+
if (result === true) {
|
|
1486
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
1487
|
+
}
|
|
1488
|
+
_initDefaults();
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
1492
|
+
_unloadCallback();
|
|
1493
|
+
}
|
|
1494
|
+
else {
|
|
1495
|
+
result = true;
|
|
1496
|
+
}
|
|
1497
|
+
return result;
|
|
1498
|
+
};
|
|
1235
1499
|
_self._addHook = function (hooks) {
|
|
1236
1500
|
if (hooks) {
|
|
1237
1501
|
if (isArray(hooks)) {
|
|
@@ -1242,17 +1506,18 @@
|
|
|
1242
1506
|
}
|
|
1243
1507
|
}
|
|
1244
1508
|
};
|
|
1509
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
1245
1510
|
});
|
|
1246
1511
|
_self.diagLog = function (itemCtx) {
|
|
1247
1512
|
return _getTelCtx(itemCtx).diagLog();
|
|
1248
1513
|
};
|
|
1249
|
-
_self
|
|
1514
|
+
_self[strIsInitialized] = function () {
|
|
1250
1515
|
return _isinitialized;
|
|
1251
1516
|
};
|
|
1252
1517
|
_self.setInitialized = function (isInitialized) {
|
|
1253
1518
|
_isinitialized = isInitialized;
|
|
1254
1519
|
};
|
|
1255
|
-
_self
|
|
1520
|
+
_self[strSetNextPlugin] = function (next) {
|
|
1256
1521
|
_nextPlugin = next;
|
|
1257
1522
|
};
|
|
1258
1523
|
_self.processNext = function (env, itemCtx) {
|
|
@@ -1298,11 +1563,197 @@
|
|
|
1298
1563
|
_rootCtx = null;
|
|
1299
1564
|
_nextPlugin = null;
|
|
1300
1565
|
_hooks = [];
|
|
1566
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
1301
1567
|
}
|
|
1302
1568
|
}
|
|
1303
1569
|
return BaseTelemetryPlugin;
|
|
1304
1570
|
}());
|
|
1305
1571
|
|
|
1572
|
+
var strOnPrefix = "on";
|
|
1573
|
+
var strAttachEvent = "attachEvent";
|
|
1574
|
+
var strAddEventHelper = "addEventListener";
|
|
1575
|
+
var strEvents = "events";
|
|
1576
|
+
createUniqueNamespace("aiEvtPageHide");
|
|
1577
|
+
createUniqueNamespace("aiEvtPageShow");
|
|
1578
|
+
var _guid = 1;
|
|
1579
|
+
var elmNodeData = createElmNodeData("events");
|
|
1580
|
+
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
1581
|
+
function _normalizeNamespace(name) {
|
|
1582
|
+
if (name && name.replace) {
|
|
1583
|
+
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
1584
|
+
}
|
|
1585
|
+
return name;
|
|
1586
|
+
}
|
|
1587
|
+
function _getEvtNamespace(eventName, namespaces) {
|
|
1588
|
+
if (namespaces) {
|
|
1589
|
+
var theNamespace_1 = "";
|
|
1590
|
+
if (isArray(namespaces)) {
|
|
1591
|
+
theNamespace_1 = "";
|
|
1592
|
+
arrForEach(namespaces, function (name) {
|
|
1593
|
+
name = _normalizeNamespace(name);
|
|
1594
|
+
if (name) {
|
|
1595
|
+
if (name[0] !== ".") {
|
|
1596
|
+
name = "." + name;
|
|
1597
|
+
}
|
|
1598
|
+
theNamespace_1 += name;
|
|
1599
|
+
}
|
|
1600
|
+
});
|
|
1601
|
+
}
|
|
1602
|
+
else {
|
|
1603
|
+
theNamespace_1 = _normalizeNamespace(namespaces);
|
|
1604
|
+
}
|
|
1605
|
+
if (theNamespace_1) {
|
|
1606
|
+
if (theNamespace_1[0] !== ".") {
|
|
1607
|
+
theNamespace_1 = "." + theNamespace_1;
|
|
1608
|
+
}
|
|
1609
|
+
eventName = (eventName || "") + theNamespace_1;
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
var parsedEvent = (eventNamespace.exec(eventName) || []);
|
|
1613
|
+
return {
|
|
1614
|
+
type: parsedEvent[1],
|
|
1615
|
+
ns: ((parsedEvent[2] || "").split(".").sort()).join(".")
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
1619
|
+
if (addDefault === void 0) { addDefault = true; }
|
|
1620
|
+
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
1621
|
+
var registeredEvents = aiEvts[evtName];
|
|
1622
|
+
if (!registeredEvents) {
|
|
1623
|
+
registeredEvents = aiEvts[evtName] = [];
|
|
1624
|
+
}
|
|
1625
|
+
return registeredEvents;
|
|
1626
|
+
}
|
|
1627
|
+
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
1628
|
+
var result = false;
|
|
1629
|
+
if (obj && evtName && evtName.type && handlerRef) {
|
|
1630
|
+
if (obj[strAddEventHelper]) {
|
|
1631
|
+
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
1632
|
+
result = true;
|
|
1633
|
+
}
|
|
1634
|
+
else if (obj[strAttachEvent]) {
|
|
1635
|
+
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
1636
|
+
result = true;
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
return result;
|
|
1640
|
+
}
|
|
1641
|
+
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
1642
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
1643
|
+
var result = false;
|
|
1644
|
+
if (target) {
|
|
1645
|
+
try {
|
|
1646
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
1647
|
+
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
1648
|
+
if (result && elmNodeData.accept(target)) {
|
|
1649
|
+
var registeredEvent = {
|
|
1650
|
+
guid: _guid++,
|
|
1651
|
+
evtName: evtName,
|
|
1652
|
+
handler: handlerRef,
|
|
1653
|
+
capture: useCapture
|
|
1654
|
+
};
|
|
1655
|
+
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
catch (e) {
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
return result;
|
|
1662
|
+
}
|
|
1663
|
+
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
1664
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
1665
|
+
return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
var LoggingSeverity = createEnumStyle({
|
|
1669
|
+
CRITICAL: 1 ,
|
|
1670
|
+
WARNING: 2
|
|
1671
|
+
});
|
|
1672
|
+
var _InternalMessageId = createEnumStyle({
|
|
1673
|
+
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
1674
|
+
BrowserCannotReadLocalStorage: 1 ,
|
|
1675
|
+
BrowserCannotReadSessionStorage: 2 ,
|
|
1676
|
+
BrowserCannotWriteLocalStorage: 3 ,
|
|
1677
|
+
BrowserCannotWriteSessionStorage: 4 ,
|
|
1678
|
+
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
1679
|
+
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
1680
|
+
CannotSendEmptyTelemetry: 7 ,
|
|
1681
|
+
ClientPerformanceMathError: 8 ,
|
|
1682
|
+
ErrorParsingAISessionCookie: 9 ,
|
|
1683
|
+
ErrorPVCalc: 10 ,
|
|
1684
|
+
ExceptionWhileLoggingError: 11 ,
|
|
1685
|
+
FailedAddingTelemetryToBuffer: 12 ,
|
|
1686
|
+
FailedMonitorAjaxAbort: 13 ,
|
|
1687
|
+
FailedMonitorAjaxDur: 14 ,
|
|
1688
|
+
FailedMonitorAjaxOpen: 15 ,
|
|
1689
|
+
FailedMonitorAjaxRSC: 16 ,
|
|
1690
|
+
FailedMonitorAjaxSend: 17 ,
|
|
1691
|
+
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
1692
|
+
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
1693
|
+
FailedToSendQueuedTelemetry: 20 ,
|
|
1694
|
+
FailedToReportDataLoss: 21 ,
|
|
1695
|
+
FlushFailed: 22 ,
|
|
1696
|
+
MessageLimitPerPVExceeded: 23 ,
|
|
1697
|
+
MissingRequiredFieldSpecification: 24 ,
|
|
1698
|
+
NavigationTimingNotSupported: 25 ,
|
|
1699
|
+
OnError: 26 ,
|
|
1700
|
+
SessionRenewalDateIsZero: 27 ,
|
|
1701
|
+
SenderNotInitialized: 28 ,
|
|
1702
|
+
StartTrackEventFailed: 29 ,
|
|
1703
|
+
StopTrackEventFailed: 30 ,
|
|
1704
|
+
StartTrackFailed: 31 ,
|
|
1705
|
+
StopTrackFailed: 32 ,
|
|
1706
|
+
TelemetrySampledAndNotSent: 33 ,
|
|
1707
|
+
TrackEventFailed: 34 ,
|
|
1708
|
+
TrackExceptionFailed: 35 ,
|
|
1709
|
+
TrackMetricFailed: 36 ,
|
|
1710
|
+
TrackPVFailed: 37 ,
|
|
1711
|
+
TrackPVFailedCalc: 38 ,
|
|
1712
|
+
TrackTraceFailed: 39 ,
|
|
1713
|
+
TransmissionFailed: 40 ,
|
|
1714
|
+
FailedToSetStorageBuffer: 41 ,
|
|
1715
|
+
FailedToRestoreStorageBuffer: 42 ,
|
|
1716
|
+
InvalidBackendResponse: 43 ,
|
|
1717
|
+
FailedToFixDepricatedValues: 44 ,
|
|
1718
|
+
InvalidDurationValue: 45 ,
|
|
1719
|
+
TelemetryEnvelopeInvalid: 46 ,
|
|
1720
|
+
CreateEnvelopeError: 47 ,
|
|
1721
|
+
CannotSerializeObject: 48 ,
|
|
1722
|
+
CannotSerializeObjectNonSerializable: 49 ,
|
|
1723
|
+
CircularReferenceDetected: 50 ,
|
|
1724
|
+
ClearAuthContextFailed: 51 ,
|
|
1725
|
+
ExceptionTruncated: 52 ,
|
|
1726
|
+
IllegalCharsInName: 53 ,
|
|
1727
|
+
ItemNotInArray: 54 ,
|
|
1728
|
+
MaxAjaxPerPVExceeded: 55 ,
|
|
1729
|
+
MessageTruncated: 56 ,
|
|
1730
|
+
NameTooLong: 57 ,
|
|
1731
|
+
SampleRateOutOfRange: 58 ,
|
|
1732
|
+
SetAuthContextFailed: 59 ,
|
|
1733
|
+
SetAuthContextFailedAccountName: 60 ,
|
|
1734
|
+
StringValueTooLong: 61 ,
|
|
1735
|
+
StartCalledMoreThanOnce: 62 ,
|
|
1736
|
+
StopCalledWithoutStart: 63 ,
|
|
1737
|
+
TelemetryInitializerFailed: 64 ,
|
|
1738
|
+
TrackArgumentsNotSpecified: 65 ,
|
|
1739
|
+
UrlTooLong: 66 ,
|
|
1740
|
+
SessionStorageBufferFull: 67 ,
|
|
1741
|
+
CannotAccessCookie: 68 ,
|
|
1742
|
+
IdTooLong: 69 ,
|
|
1743
|
+
InvalidEvent: 70 ,
|
|
1744
|
+
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
1745
|
+
SendBrowserInfoOnUserInit: 72 ,
|
|
1746
|
+
PluginException: 73 ,
|
|
1747
|
+
NotificationException: 74 ,
|
|
1748
|
+
SnippetScriptLoadFailure: 99 ,
|
|
1749
|
+
InvalidInstrumentationKey: 100 ,
|
|
1750
|
+
CannotParseAiBlobValue: 101 ,
|
|
1751
|
+
InvalidContentBlob: 102 ,
|
|
1752
|
+
TrackPageActionEventFailed: 103 ,
|
|
1753
|
+
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
1754
|
+
InMemoryStorageBufferFull: 105
|
|
1755
|
+
});
|
|
1756
|
+
|
|
1306
1757
|
var strNotSpecified = "not_specified";
|
|
1307
1758
|
|
|
1308
1759
|
var PropertiesPluginIdentifier = "AppInsightsPropertiesPlugin";
|
|
@@ -2158,7 +2609,7 @@
|
|
|
2158
2609
|
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.TrackPageActionEventFailed, "trackPageAction failed, page action event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2159
2610
|
}
|
|
2160
2611
|
};
|
|
2161
|
-
ClickAnalyticsPlugin.Version = "2.8.0-beta.
|
|
2612
|
+
ClickAnalyticsPlugin.Version = "2.8.0-beta.2203-03";
|
|
2162
2613
|
return ClickAnalyticsPlugin;
|
|
2163
2614
|
}(BaseTelemetryPlugin));
|
|
2164
2615
|
|