@microsoft/applicationinsights-react-js 3.2.5-nightly.2203-03 → 3.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-react-js.js +535 -1104
- package/browser/applicationinsights-react-js.js.map +1 -1
- package/browser/applicationinsights-react-js.min.js +2 -2
- package/browser/applicationinsights-react-js.min.js.map +1 -1
- package/dist/applicationinsights-react-js.api.json +62 -61
- package/dist/applicationinsights-react-js.api.md +7 -4
- package/dist/applicationinsights-react-js.d.ts +11 -5
- package/dist/applicationinsights-react-js.js +535 -1104
- package/dist/applicationinsights-react-js.js.map +1 -1
- package/dist/applicationinsights-react-js.min.js +2 -2
- package/dist/applicationinsights-react-js.min.js.map +1 -1
- package/dist/applicationinsights-react-js.rollup.d.ts +11 -5
- package/dist-esm/AppInsightsContext.js +1 -1
- package/dist-esm/AppInsightsErrorBoundary.js +1 -1
- package/dist-esm/Interfaces/IReactExtensionConfig.js +1 -1
- package/dist-esm/ReactPlugin.js +102 -96
- package/dist-esm/ReactPlugin.js.map +1 -1
- package/dist-esm/applicationinsights-react-js.js +1 -1
- package/dist-esm/useTrackEvent.js +1 -1
- package/dist-esm/useTrackMetric.js +3 -4
- package/dist-esm/useTrackMetric.js.map +1 -1
- package/dist-esm/withAITracking.js +1 -1
- package/package.json +71 -74
- package/src/ReactPlugin.ts +81 -118
- package/src/useTrackMetric.ts +3 -4
- package/types/ReactPlugin.d.ts +9 -3
- package/types/tsdoc-metadata.json +1 -1
- package/types/useTrackMetric.d.ts +1 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - React Plugin, 3.2.5
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 3.2.5
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -98,9 +98,7 @@
|
|
|
98
98
|
var __assignFn = ObjAssign || __objAssignFnImpl;
|
|
99
99
|
var extendStaticsFn = function (d, b) {
|
|
100
100
|
extendStaticsFn = ObjClass["setPrototypeOf"] ||
|
|
101
|
-
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
102
|
-
d.__proto__ = b;
|
|
103
|
-
}) ||
|
|
101
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
104
102
|
function (d, b) {
|
|
105
103
|
for (var p in b) {
|
|
106
104
|
if (b[strShimHasOwnProperty](p)) {
|
|
@@ -115,14 +113,12 @@
|
|
|
115
113
|
throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
116
114
|
}
|
|
117
115
|
extendStaticsFn(d, b);
|
|
118
|
-
function __() {
|
|
119
|
-
this.constructor = d;
|
|
120
|
-
}
|
|
116
|
+
function __() { this.constructor = d; }
|
|
121
117
|
d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
|
|
122
118
|
}
|
|
123
119
|
|
|
124
120
|
/*!
|
|
125
|
-
* Microsoft Dynamic Proto Utility, 1.1.
|
|
121
|
+
* Microsoft Dynamic Proto Utility, 1.1.5
|
|
126
122
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
127
123
|
*/
|
|
128
124
|
var Constructor = 'constructor';
|
|
@@ -135,12 +131,13 @@
|
|
|
135
131
|
var DynInstChkTag = '_dynInstChk';
|
|
136
132
|
var DynAllowInstChkTag = DynInstChkTag;
|
|
137
133
|
var DynProtoDefaultOptions = '_dfOpts';
|
|
134
|
+
var DynProtoPolyProto = "_dynProto";
|
|
138
135
|
var UnknownValue = '_unknown_';
|
|
139
|
-
var str__Proto
|
|
136
|
+
var str__Proto = "__proto__";
|
|
140
137
|
var strUseBaseInst = 'useBaseInst';
|
|
141
138
|
var strSetInstFuncs = 'setInstFuncs';
|
|
142
139
|
var Obj = Object;
|
|
143
|
-
var _objGetPrototypeOf
|
|
140
|
+
var _objGetPrototypeOf = Obj["getPrototypeOf"];
|
|
144
141
|
var _dynamicNames = 0;
|
|
145
142
|
function _hasOwnProperty(obj, prop) {
|
|
146
143
|
return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
|
|
@@ -151,13 +148,16 @@
|
|
|
151
148
|
function _isObjectArrayOrFunctionPrototype(target) {
|
|
152
149
|
return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
|
|
153
150
|
}
|
|
154
|
-
function _getObjProto
|
|
151
|
+
function _getObjProto(target) {
|
|
155
152
|
if (target) {
|
|
156
|
-
if (_objGetPrototypeOf
|
|
157
|
-
return _objGetPrototypeOf
|
|
153
|
+
if (_objGetPrototypeOf) {
|
|
154
|
+
return _objGetPrototypeOf(target);
|
|
158
155
|
}
|
|
159
|
-
var newProto = target[str__Proto
|
|
156
|
+
var newProto = target[DynProtoPolyProto] || target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
160
157
|
if (newProto) {
|
|
158
|
+
if (!target[DynProtoPolyProto]) {
|
|
159
|
+
target[DynProtoPolyProto] = newProto;
|
|
160
|
+
}
|
|
161
161
|
return newProto;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
@@ -222,16 +222,16 @@
|
|
|
222
222
|
_forEachProp(instFuncs, function (name) {
|
|
223
223
|
baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
|
|
224
224
|
});
|
|
225
|
-
var baseProto = _getObjProto
|
|
225
|
+
var baseProto = _getObjProto(classProto);
|
|
226
226
|
var visited = [];
|
|
227
227
|
while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
|
|
228
228
|
_forEachProp(baseProto, function (name) {
|
|
229
|
-
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf
|
|
229
|
+
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
|
|
230
230
|
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
231
231
|
}
|
|
232
232
|
});
|
|
233
233
|
visited.push(baseProto);
|
|
234
|
-
baseProto = _getObjProto
|
|
234
|
+
baseProto = _getObjProto(baseProto);
|
|
235
235
|
}
|
|
236
236
|
return baseFuncs;
|
|
237
237
|
}
|
|
@@ -245,7 +245,7 @@
|
|
|
245
245
|
}
|
|
246
246
|
if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
|
|
247
247
|
var canAddInst = !_hasOwnProperty(target, funcName);
|
|
248
|
-
var objProto = _getObjProto
|
|
248
|
+
var objProto = _getObjProto(target);
|
|
249
249
|
var visited = [];
|
|
250
250
|
while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
|
|
251
251
|
var protoFunc = objProto[funcName];
|
|
@@ -254,7 +254,7 @@
|
|
|
254
254
|
break;
|
|
255
255
|
}
|
|
256
256
|
visited.push(objProto);
|
|
257
|
-
objProto = _getObjProto
|
|
257
|
+
objProto = _getObjProto(objProto);
|
|
258
258
|
}
|
|
259
259
|
try {
|
|
260
260
|
if (canAddInst) {
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
|
|
273
273
|
var protoFunc = proto[funcName];
|
|
274
274
|
if (protoFunc === currentDynProtoProxy) {
|
|
275
|
-
protoFunc = _getObjProto
|
|
275
|
+
protoFunc = _getObjProto(proto)[funcName];
|
|
276
276
|
}
|
|
277
277
|
if (typeof protoFunc !== strFunction) {
|
|
278
278
|
_throwTypeError("[" + funcName + "] is not a " + strFunction);
|
|
@@ -306,18 +306,19 @@
|
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
function _checkPrototype(classProto, thisTarget) {
|
|
309
|
-
if (_objGetPrototypeOf
|
|
309
|
+
if (_objGetPrototypeOf) {
|
|
310
310
|
var visited = [];
|
|
311
|
-
var thisProto = _getObjProto
|
|
311
|
+
var thisProto = _getObjProto(thisTarget);
|
|
312
312
|
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
313
313
|
if (thisProto === classProto) {
|
|
314
314
|
return true;
|
|
315
315
|
}
|
|
316
316
|
visited.push(thisProto);
|
|
317
|
-
thisProto = _getObjProto
|
|
317
|
+
thisProto = _getObjProto(thisProto);
|
|
318
318
|
}
|
|
319
|
+
return false;
|
|
319
320
|
}
|
|
320
|
-
return
|
|
321
|
+
return true;
|
|
321
322
|
}
|
|
322
323
|
function _getObjName(target, unknownValue) {
|
|
323
324
|
if (_hasOwnProperty(target, Prototype)) {
|
|
@@ -350,7 +351,7 @@
|
|
|
350
351
|
var instFuncs = _getInstanceFuncs(target);
|
|
351
352
|
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
352
353
|
delegateFunc(target, baseFuncs);
|
|
353
|
-
var setInstanceFunc = !!_objGetPrototypeOf
|
|
354
|
+
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
354
355
|
if (setInstanceFunc && options) {
|
|
355
356
|
setInstanceFunc = !!options[strSetInstFuncs];
|
|
356
357
|
}
|
|
@@ -362,15 +363,99 @@
|
|
|
362
363
|
};
|
|
363
364
|
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
364
365
|
|
|
365
|
-
var
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
var
|
|
371
|
-
|
|
372
|
-
|
|
366
|
+
var LoggingSeverity;
|
|
367
|
+
(function (LoggingSeverity) {
|
|
368
|
+
LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
|
|
369
|
+
LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
|
|
370
|
+
})(LoggingSeverity || (LoggingSeverity = {}));
|
|
371
|
+
var _InternalMessageId = {
|
|
372
|
+
BrowserDoesNotSupportLocalStorage: 0,
|
|
373
|
+
BrowserCannotReadLocalStorage: 1,
|
|
374
|
+
BrowserCannotReadSessionStorage: 2,
|
|
375
|
+
BrowserCannotWriteLocalStorage: 3,
|
|
376
|
+
BrowserCannotWriteSessionStorage: 4,
|
|
377
|
+
BrowserFailedRemovalFromLocalStorage: 5,
|
|
378
|
+
BrowserFailedRemovalFromSessionStorage: 6,
|
|
379
|
+
CannotSendEmptyTelemetry: 7,
|
|
380
|
+
ClientPerformanceMathError: 8,
|
|
381
|
+
ErrorParsingAISessionCookie: 9,
|
|
382
|
+
ErrorPVCalc: 10,
|
|
383
|
+
ExceptionWhileLoggingError: 11,
|
|
384
|
+
FailedAddingTelemetryToBuffer: 12,
|
|
385
|
+
FailedMonitorAjaxAbort: 13,
|
|
386
|
+
FailedMonitorAjaxDur: 14,
|
|
387
|
+
FailedMonitorAjaxOpen: 15,
|
|
388
|
+
FailedMonitorAjaxRSC: 16,
|
|
389
|
+
FailedMonitorAjaxSend: 17,
|
|
390
|
+
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
391
|
+
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
392
|
+
FailedToSendQueuedTelemetry: 20,
|
|
393
|
+
FailedToReportDataLoss: 21,
|
|
394
|
+
FlushFailed: 22,
|
|
395
|
+
MessageLimitPerPVExceeded: 23,
|
|
396
|
+
MissingRequiredFieldSpecification: 24,
|
|
397
|
+
NavigationTimingNotSupported: 25,
|
|
398
|
+
OnError: 26,
|
|
399
|
+
SessionRenewalDateIsZero: 27,
|
|
400
|
+
SenderNotInitialized: 28,
|
|
401
|
+
StartTrackEventFailed: 29,
|
|
402
|
+
StopTrackEventFailed: 30,
|
|
403
|
+
StartTrackFailed: 31,
|
|
404
|
+
StopTrackFailed: 32,
|
|
405
|
+
TelemetrySampledAndNotSent: 33,
|
|
406
|
+
TrackEventFailed: 34,
|
|
407
|
+
TrackExceptionFailed: 35,
|
|
408
|
+
TrackMetricFailed: 36,
|
|
409
|
+
TrackPVFailed: 37,
|
|
410
|
+
TrackPVFailedCalc: 38,
|
|
411
|
+
TrackTraceFailed: 39,
|
|
412
|
+
TransmissionFailed: 40,
|
|
413
|
+
FailedToSetStorageBuffer: 41,
|
|
414
|
+
FailedToRestoreStorageBuffer: 42,
|
|
415
|
+
InvalidBackendResponse: 43,
|
|
416
|
+
FailedToFixDepricatedValues: 44,
|
|
417
|
+
InvalidDurationValue: 45,
|
|
418
|
+
TelemetryEnvelopeInvalid: 46,
|
|
419
|
+
CreateEnvelopeError: 47,
|
|
420
|
+
CannotSerializeObject: 48,
|
|
421
|
+
CannotSerializeObjectNonSerializable: 49,
|
|
422
|
+
CircularReferenceDetected: 50,
|
|
423
|
+
ClearAuthContextFailed: 51,
|
|
424
|
+
ExceptionTruncated: 52,
|
|
425
|
+
IllegalCharsInName: 53,
|
|
426
|
+
ItemNotInArray: 54,
|
|
427
|
+
MaxAjaxPerPVExceeded: 55,
|
|
428
|
+
MessageTruncated: 56,
|
|
429
|
+
NameTooLong: 57,
|
|
430
|
+
SampleRateOutOfRange: 58,
|
|
431
|
+
SetAuthContextFailed: 59,
|
|
432
|
+
SetAuthContextFailedAccountName: 60,
|
|
433
|
+
StringValueTooLong: 61,
|
|
434
|
+
StartCalledMoreThanOnce: 62,
|
|
435
|
+
StopCalledWithoutStart: 63,
|
|
436
|
+
TelemetryInitializerFailed: 64,
|
|
437
|
+
TrackArgumentsNotSpecified: 65,
|
|
438
|
+
UrlTooLong: 66,
|
|
439
|
+
SessionStorageBufferFull: 67,
|
|
440
|
+
CannotAccessCookie: 68,
|
|
441
|
+
IdTooLong: 69,
|
|
442
|
+
InvalidEvent: 70,
|
|
443
|
+
FailedMonitorAjaxSetRequestHeader: 71,
|
|
444
|
+
SendBrowserInfoOnUserInit: 72,
|
|
445
|
+
PluginException: 73,
|
|
446
|
+
NotificationException: 74,
|
|
447
|
+
SnippetScriptLoadFailure: 99,
|
|
448
|
+
InvalidInstrumentationKey: 100,
|
|
449
|
+
CannotParseAiBlobValue: 101,
|
|
450
|
+
InvalidContentBlob: 102,
|
|
451
|
+
TrackPageActionEventFailed: 103,
|
|
452
|
+
FailedAddingCustomDefinedRequestContext: 104,
|
|
453
|
+
InMemoryStorageBufferFull: 105
|
|
454
|
+
};
|
|
373
455
|
|
|
456
|
+
var strOnPrefix = "on";
|
|
457
|
+
var strAttachEvent = "attachEvent";
|
|
458
|
+
var strAddEventHelper = "addEventListener";
|
|
374
459
|
var strToISOString = "toISOString";
|
|
375
460
|
var cStrEndsWith = "endsWith";
|
|
376
461
|
var strIndexOf = "indexOf";
|
|
@@ -378,10 +463,7 @@
|
|
|
378
463
|
var strReduce = "reduce";
|
|
379
464
|
var cStrTrim = "trim";
|
|
380
465
|
var strToString = "toString";
|
|
381
|
-
var
|
|
382
|
-
var strConstructor = "constructor";
|
|
383
|
-
var _objDefineProperty$1 = ObjDefineProperty;
|
|
384
|
-
var _objFreeze = ObjClass.freeze;
|
|
466
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
385
467
|
var _objKeys = ObjClass.keys;
|
|
386
468
|
var StringProto = String[strShimPrototype];
|
|
387
469
|
var _strTrim = StringProto[cStrTrim];
|
|
@@ -391,23 +473,7 @@
|
|
|
391
473
|
var _isArray = Array.isArray;
|
|
392
474
|
var _objToString = ObjProto[strToString];
|
|
393
475
|
var _fnToString = ObjHasOwnProperty[strToString];
|
|
394
|
-
|
|
395
|
-
var rCamelCase = /-([a-z])/g;
|
|
396
|
-
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
397
|
-
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
398
|
-
var _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
399
|
-
function _getObjProto(target) {
|
|
400
|
-
if (target) {
|
|
401
|
-
if (_objGetPrototypeOf) {
|
|
402
|
-
return _objGetPrototypeOf(target);
|
|
403
|
-
}
|
|
404
|
-
var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
|
|
405
|
-
if (newProto) {
|
|
406
|
-
return newProto;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
return null;
|
|
410
|
-
}
|
|
476
|
+
_fnToString.call(ObjClass);
|
|
411
477
|
function isTypeof(value, theType) {
|
|
412
478
|
return typeof value === theType;
|
|
413
479
|
}
|
|
@@ -429,18 +495,24 @@
|
|
|
429
495
|
function isFunction(value) {
|
|
430
496
|
return !!(value && typeof value === strShimFunction);
|
|
431
497
|
}
|
|
432
|
-
function
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
498
|
+
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
499
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
500
|
+
var result = false;
|
|
501
|
+
if (!isNullOrUndefined(obj)) {
|
|
502
|
+
try {
|
|
503
|
+
if (!isNullOrUndefined(obj[strAddEventHelper])) {
|
|
504
|
+
obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
|
|
505
|
+
result = true;
|
|
506
|
+
}
|
|
507
|
+
else if (!isNullOrUndefined(obj[strAttachEvent])) {
|
|
508
|
+
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
509
|
+
result = true;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
catch (e) {
|
|
513
|
+
}
|
|
442
514
|
}
|
|
443
|
-
return
|
|
515
|
+
return result;
|
|
444
516
|
}
|
|
445
517
|
function objForEachKey(target, callbackfn) {
|
|
446
518
|
if (target) {
|
|
@@ -499,22 +571,6 @@
|
|
|
499
571
|
function isBoolean(value) {
|
|
500
572
|
return typeof value === "boolean";
|
|
501
573
|
}
|
|
502
|
-
function isPlainObject(value) {
|
|
503
|
-
var result = false;
|
|
504
|
-
if (value && typeof value === "object") {
|
|
505
|
-
var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
|
|
506
|
-
if (!proto) {
|
|
507
|
-
result = true;
|
|
508
|
-
}
|
|
509
|
-
else {
|
|
510
|
-
if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
|
|
511
|
-
proto = proto[strConstructor];
|
|
512
|
-
}
|
|
513
|
-
result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
return result;
|
|
517
|
-
}
|
|
518
574
|
function toISOString(date) {
|
|
519
575
|
if (date) {
|
|
520
576
|
return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
|
|
@@ -660,7 +716,7 @@
|
|
|
660
716
|
return result;
|
|
661
717
|
}
|
|
662
718
|
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
663
|
-
if (_objDefineProperty
|
|
719
|
+
if (_objDefineProperty) {
|
|
664
720
|
try {
|
|
665
721
|
var descriptor = {
|
|
666
722
|
enumerable: true,
|
|
@@ -672,7 +728,7 @@
|
|
|
672
728
|
if (setProp) {
|
|
673
729
|
descriptor.set = setProp;
|
|
674
730
|
}
|
|
675
|
-
_objDefineProperty
|
|
731
|
+
_objDefineProperty(target, prop, descriptor);
|
|
676
732
|
return true;
|
|
677
733
|
}
|
|
678
734
|
catch (e) {
|
|
@@ -680,10 +736,6 @@
|
|
|
680
736
|
}
|
|
681
737
|
return false;
|
|
682
738
|
}
|
|
683
|
-
function _doNothing(value) {
|
|
684
|
-
return value;
|
|
685
|
-
}
|
|
686
|
-
var objFreeze = _objFreeze || _doNothing;
|
|
687
739
|
function dateNow() {
|
|
688
740
|
var dt = Date;
|
|
689
741
|
return dt.now ? dt.now() : new dt().getTime();
|
|
@@ -692,7 +744,7 @@
|
|
|
692
744
|
if (isError(object)) {
|
|
693
745
|
return object.name;
|
|
694
746
|
}
|
|
695
|
-
return
|
|
747
|
+
return "";
|
|
696
748
|
}
|
|
697
749
|
function setValue(target, field, value, valChk, srcChk) {
|
|
698
750
|
var theValue = value;
|
|
@@ -708,102 +760,6 @@
|
|
|
708
760
|
function isTruthy(value) {
|
|
709
761
|
return !!value;
|
|
710
762
|
}
|
|
711
|
-
function throwError(message) {
|
|
712
|
-
throw new Error(message);
|
|
713
|
-
}
|
|
714
|
-
function _createProxyFunction(source, funcName) {
|
|
715
|
-
var srcFunc = null;
|
|
716
|
-
var src = null;
|
|
717
|
-
if (isFunction(source)) {
|
|
718
|
-
srcFunc = source;
|
|
719
|
-
}
|
|
720
|
-
else {
|
|
721
|
-
src = source;
|
|
722
|
-
}
|
|
723
|
-
return function () {
|
|
724
|
-
var originalArguments = arguments;
|
|
725
|
-
if (srcFunc) {
|
|
726
|
-
src = srcFunc();
|
|
727
|
-
}
|
|
728
|
-
if (src) {
|
|
729
|
-
return src[funcName].apply(src, originalArguments);
|
|
730
|
-
}
|
|
731
|
-
};
|
|
732
|
-
}
|
|
733
|
-
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
734
|
-
if (overwriteTarget === void 0) { overwriteTarget = true; }
|
|
735
|
-
if (target && name && source) {
|
|
736
|
-
if (overwriteTarget || isUndefined(target[name])) {
|
|
737
|
-
target[name] = _createProxyFunction(source, theFunc);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {
|
|
742
|
-
if (overwriteTarget === void 0) { overwriteTarget = true; }
|
|
743
|
-
if (target && source && isObject(target) && isArray(functionsToProxy)) {
|
|
744
|
-
arrForEach(functionsToProxy, function (theFuncName) {
|
|
745
|
-
if (isString(theFuncName)) {
|
|
746
|
-
proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);
|
|
747
|
-
}
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
|
-
return target;
|
|
751
|
-
}
|
|
752
|
-
function createEnumStyle(values) {
|
|
753
|
-
var enumClass = {};
|
|
754
|
-
objForEachKey(values, function (field, value) {
|
|
755
|
-
enumClass[field] = value;
|
|
756
|
-
if (!isUndefined(enumClass[value])) {
|
|
757
|
-
throwError("[" + value + "] exists for " + field);
|
|
758
|
-
}
|
|
759
|
-
enumClass[value] = field;
|
|
760
|
-
});
|
|
761
|
-
return objFreeze(enumClass);
|
|
762
|
-
}
|
|
763
|
-
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
764
|
-
var theArgs = arguments;
|
|
765
|
-
var extended = theArgs[0] || {};
|
|
766
|
-
var argLen = theArgs.length;
|
|
767
|
-
var deep = false;
|
|
768
|
-
var idx = 1;
|
|
769
|
-
if (argLen > 0 && isBoolean(extended)) {
|
|
770
|
-
deep = extended;
|
|
771
|
-
extended = theArgs[idx] || {};
|
|
772
|
-
idx++;
|
|
773
|
-
}
|
|
774
|
-
if (!isObject(extended)) {
|
|
775
|
-
extended = {};
|
|
776
|
-
}
|
|
777
|
-
for (; idx < argLen; idx++) {
|
|
778
|
-
var arg = theArgs[idx];
|
|
779
|
-
var isArgArray = isArray(arg);
|
|
780
|
-
var isArgObj = isObject(arg);
|
|
781
|
-
for (var prop in arg) {
|
|
782
|
-
var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
|
|
783
|
-
if (!propOk) {
|
|
784
|
-
continue;
|
|
785
|
-
}
|
|
786
|
-
var newValue = arg[prop];
|
|
787
|
-
var isNewArray = void 0;
|
|
788
|
-
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
789
|
-
var clone = extended[prop];
|
|
790
|
-
if (isNewArray) {
|
|
791
|
-
if (!isArray(clone)) {
|
|
792
|
-
clone = [];
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
else if (!isPlainObject(clone)) {
|
|
796
|
-
clone = {};
|
|
797
|
-
}
|
|
798
|
-
newValue = objExtend(deep, clone, newValue);
|
|
799
|
-
}
|
|
800
|
-
if (newValue !== undefined) {
|
|
801
|
-
extended[prop] = newValue;
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
return extended;
|
|
806
|
-
}
|
|
807
763
|
|
|
808
764
|
var strWindow = "window";
|
|
809
765
|
var strDocument = "document";
|
|
@@ -896,14 +852,14 @@
|
|
|
896
852
|
var nav = getNavigator();
|
|
897
853
|
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
898
854
|
_navUserAgentCheck = nav.userAgent;
|
|
899
|
-
var userAgent = (_navUserAgentCheck ||
|
|
855
|
+
var userAgent = (_navUserAgentCheck || "").toLowerCase();
|
|
900
856
|
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
901
857
|
}
|
|
902
858
|
return _isTrident;
|
|
903
859
|
}
|
|
904
860
|
function dumpObj(object) {
|
|
905
861
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
906
|
-
var propertyValueDump =
|
|
862
|
+
var propertyValueDump = "";
|
|
907
863
|
if (objectTypeDump === "[object Error]") {
|
|
908
864
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
909
865
|
}
|
|
@@ -936,9 +892,9 @@
|
|
|
936
892
|
var strWarnToConsole = "warnToConsole";
|
|
937
893
|
function _sanitizeDiagnosticText(text) {
|
|
938
894
|
if (text) {
|
|
939
|
-
return "\"" + text.replace(/\"/g,
|
|
895
|
+
return "\"" + text.replace(/\"/g, "") + "\"";
|
|
940
896
|
}
|
|
941
|
-
return
|
|
897
|
+
return "";
|
|
942
898
|
}
|
|
943
899
|
function _logToConsole(func, message) {
|
|
944
900
|
var theConsole = getConsole();
|
|
@@ -960,12 +916,12 @@
|
|
|
960
916
|
_self.message =
|
|
961
917
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
962
918
|
msgId;
|
|
963
|
-
var strProps =
|
|
919
|
+
var strProps = "";
|
|
964
920
|
if (hasJSON()) {
|
|
965
921
|
strProps = getJSON().stringify(properties);
|
|
966
922
|
}
|
|
967
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
968
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
923
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : "") +
|
|
924
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : "");
|
|
969
925
|
_self.message += diagnosticText;
|
|
970
926
|
}
|
|
971
927
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -992,10 +948,10 @@
|
|
|
992
948
|
if (isUserAct === void 0) { isUserAct = false; }
|
|
993
949
|
var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
|
|
994
950
|
if (_self.enableDebugExceptions()) {
|
|
995
|
-
throw message;
|
|
951
|
+
throw dumpObj(message);
|
|
996
952
|
}
|
|
997
953
|
else {
|
|
998
|
-
var logFunc = severity ===
|
|
954
|
+
var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
|
|
999
955
|
if (!isUndefined(message.message)) {
|
|
1000
956
|
var logLevel = _self.consoleLoggingLevel();
|
|
1001
957
|
if (isUserAct) {
|
|
@@ -1013,7 +969,7 @@
|
|
|
1013
969
|
_self.logInternalMessage(severity, message);
|
|
1014
970
|
}
|
|
1015
971
|
else {
|
|
1016
|
-
_debugExtMsg("throw" + (severity ===
|
|
972
|
+
_debugExtMsg("throw" + (severity === LoggingSeverity.CRITICAL ? "Critical" : "Warning"), message);
|
|
1017
973
|
}
|
|
1018
974
|
}
|
|
1019
975
|
};
|
|
@@ -1045,13 +1001,13 @@
|
|
|
1045
1001
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
1046
1002
|
_self.queue.push(message);
|
|
1047
1003
|
_messageCount++;
|
|
1048
|
-
_debugExtMsg((severity ===
|
|
1004
|
+
_debugExtMsg((severity === LoggingSeverity.CRITICAL ? "error" : "warn"), message);
|
|
1049
1005
|
}
|
|
1050
1006
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
1051
1007
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
1052
|
-
var throttleMessage = new _InternalLogMessage(
|
|
1008
|
+
var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
|
|
1053
1009
|
_self.queue.push(throttleMessage);
|
|
1054
|
-
if (severity ===
|
|
1010
|
+
if (severity === LoggingSeverity.CRITICAL) {
|
|
1055
1011
|
_self.errorToConsole(throttleLimitMessage);
|
|
1056
1012
|
}
|
|
1057
1013
|
else {
|
|
@@ -1080,10 +1036,6 @@
|
|
|
1080
1036
|
}
|
|
1081
1037
|
return DiagnosticLogger;
|
|
1082
1038
|
}());
|
|
1083
|
-
function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
|
|
1084
|
-
if (isUserAct === void 0) { isUserAct = false; }
|
|
1085
|
-
(logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
|
|
1086
|
-
}
|
|
1087
1039
|
|
|
1088
1040
|
var strExecutionContextKey = "ctx";
|
|
1089
1041
|
var PerfEvent = /** @class */ (function () {
|
|
@@ -1197,509 +1149,252 @@
|
|
|
1197
1149
|
return func();
|
|
1198
1150
|
}
|
|
1199
1151
|
|
|
1200
|
-
var
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
function randomValue(maxValue) {
|
|
1222
|
-
if (maxValue > 0) {
|
|
1223
|
-
return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
|
|
1224
|
-
}
|
|
1225
|
-
return 0;
|
|
1226
|
-
}
|
|
1227
|
-
function random32(signed) {
|
|
1228
|
-
var value = 0;
|
|
1229
|
-
var c = getCrypto() || getMsCrypto();
|
|
1230
|
-
if (c && c.getRandomValues) {
|
|
1231
|
-
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1232
|
-
}
|
|
1233
|
-
if (value === 0 && isIE()) {
|
|
1234
|
-
if (!_mwcSeeded) {
|
|
1235
|
-
_autoSeedMwc();
|
|
1236
|
-
}
|
|
1237
|
-
value = mwcRandom32() & MaxUInt32;
|
|
1238
|
-
}
|
|
1239
|
-
if (value === 0) {
|
|
1240
|
-
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1241
|
-
}
|
|
1242
|
-
if (!signed) {
|
|
1243
|
-
value >>>= 0;
|
|
1244
|
-
}
|
|
1245
|
-
return value;
|
|
1246
|
-
}
|
|
1247
|
-
function mwcRandomSeed(value) {
|
|
1248
|
-
if (!value) {
|
|
1249
|
-
_autoSeedMwc();
|
|
1250
|
-
}
|
|
1251
|
-
else {
|
|
1252
|
-
_mwcSeed(value);
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
function mwcRandom32(signed) {
|
|
1256
|
-
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1257
|
-
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1258
|
-
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1259
|
-
if (!signed) {
|
|
1260
|
-
value >>>= 0;
|
|
1261
|
-
}
|
|
1262
|
-
return value;
|
|
1263
|
-
}
|
|
1264
|
-
function newId(maxLength) {
|
|
1265
|
-
if (maxLength === void 0) { maxLength = 22; }
|
|
1266
|
-
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1267
|
-
var number = random32() >>> 0;
|
|
1268
|
-
var chars = 0;
|
|
1269
|
-
var result = strEmpty;
|
|
1270
|
-
while (result.length < maxLength) {
|
|
1271
|
-
chars++;
|
|
1272
|
-
result += base64chars.charAt(number & 0x3F);
|
|
1273
|
-
number >>>= 6;
|
|
1274
|
-
if (chars === 5) {
|
|
1275
|
-
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1276
|
-
chars = 0;
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
return result;
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
1283
|
-
var version = "2.7.5-nightly.2203-03";
|
|
1284
|
-
var instanceName = "." + newId(6);
|
|
1285
|
-
var _dataUid = 0;
|
|
1286
|
-
function _createAccessor(target, prop, value) {
|
|
1287
|
-
if (_objDefineProperty) {
|
|
1288
|
-
try {
|
|
1289
|
-
_objDefineProperty(target, prop, {
|
|
1290
|
-
value: value,
|
|
1291
|
-
enumerable: false,
|
|
1292
|
-
configurable: true
|
|
1293
|
-
});
|
|
1294
|
-
return true;
|
|
1295
|
-
}
|
|
1296
|
-
catch (e) {
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
return false;
|
|
1300
|
-
}
|
|
1301
|
-
function _canAcceptData(target) {
|
|
1302
|
-
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1303
|
-
}
|
|
1304
|
-
function _getCache(data, target) {
|
|
1305
|
-
var theCache = target[data.id];
|
|
1306
|
-
if (!theCache) {
|
|
1307
|
-
theCache = {};
|
|
1308
|
-
try {
|
|
1309
|
-
if (_canAcceptData(target)) {
|
|
1310
|
-
if (!_createAccessor(target, data.id, theCache)) {
|
|
1311
|
-
target[data.id] = theCache;
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
catch (e) {
|
|
1316
|
-
}
|
|
1317
|
-
}
|
|
1318
|
-
return theCache;
|
|
1319
|
-
}
|
|
1320
|
-
function createUniqueNamespace(name, includeVersion) {
|
|
1321
|
-
if (includeVersion === void 0) { includeVersion = false; }
|
|
1322
|
-
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1323
|
-
}
|
|
1324
|
-
function createElmNodeData(name) {
|
|
1325
|
-
var data = {
|
|
1326
|
-
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1327
|
-
accept: function (target) {
|
|
1328
|
-
return _canAcceptData(target);
|
|
1329
|
-
},
|
|
1330
|
-
get: function (target, name, defValue, addDefault) {
|
|
1331
|
-
var theCache = target[data.id];
|
|
1332
|
-
if (!theCache) {
|
|
1333
|
-
if (addDefault) {
|
|
1334
|
-
theCache = _getCache(data, target);
|
|
1335
|
-
theCache[normalizeJsName(name)] = defValue;
|
|
1336
|
-
}
|
|
1337
|
-
return defValue;
|
|
1338
|
-
}
|
|
1339
|
-
return theCache[normalizeJsName(name)];
|
|
1340
|
-
},
|
|
1341
|
-
kill: function (target, name) {
|
|
1342
|
-
if (target && target[name]) {
|
|
1343
|
-
try {
|
|
1344
|
-
delete target[name];
|
|
1345
|
-
}
|
|
1346
|
-
catch (e) {
|
|
1347
|
-
}
|
|
1152
|
+
var TelemetryPluginChain = /** @class */ (function () {
|
|
1153
|
+
function TelemetryPluginChain(plugin, defItemCtx) {
|
|
1154
|
+
var _self = this;
|
|
1155
|
+
var _nextProxy = null;
|
|
1156
|
+
var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1157
|
+
var _hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1158
|
+
_self._hasRun = false;
|
|
1159
|
+
_self.getPlugin = function () {
|
|
1160
|
+
return plugin;
|
|
1161
|
+
};
|
|
1162
|
+
_self.getNext = function () {
|
|
1163
|
+
return _nextProxy;
|
|
1164
|
+
};
|
|
1165
|
+
_self.setNext = function (nextPlugin) {
|
|
1166
|
+
_nextProxy = nextPlugin;
|
|
1167
|
+
};
|
|
1168
|
+
_self.processTelemetry = function (env, itemCtx) {
|
|
1169
|
+
if (!itemCtx) {
|
|
1170
|
+
itemCtx = defItemCtx;
|
|
1348
1171
|
}
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
var pluginStateData = createElmNodeData("plugin");
|
|
1355
|
-
function _getPluginState(plugin) {
|
|
1356
|
-
return pluginStateData.get(plugin, "state", {}, true);
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1360
|
-
var strHasRunFlags = "_hasRun";
|
|
1361
|
-
var strGetTelCtx = "_getTelCtx";
|
|
1362
|
-
var _chainId = 0;
|
|
1363
|
-
function _getNextProxyStart(proxy, config, core, startAt) {
|
|
1364
|
-
while (proxy) {
|
|
1365
|
-
if (proxy.getPlugin() === startAt) {
|
|
1366
|
-
return proxy;
|
|
1367
|
-
}
|
|
1368
|
-
proxy = proxy.getNext();
|
|
1369
|
-
}
|
|
1370
|
-
return createTelemetryProxyChain([startAt], config, core);
|
|
1371
|
-
}
|
|
1372
|
-
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1373
|
-
var _nextProxy = null;
|
|
1374
|
-
var _onComplete = [];
|
|
1375
|
-
if (startAt !== null) {
|
|
1376
|
-
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1377
|
-
}
|
|
1378
|
-
var context = {
|
|
1379
|
-
_next: _moveNext,
|
|
1380
|
-
ctx: {
|
|
1381
|
-
core: function () {
|
|
1382
|
-
return core;
|
|
1383
|
-
},
|
|
1384
|
-
diagLog: function () {
|
|
1385
|
-
return safeGetLogger(core, config);
|
|
1386
|
-
},
|
|
1387
|
-
getCfg: function () {
|
|
1388
|
-
return config;
|
|
1389
|
-
},
|
|
1390
|
-
getExtCfg: _getExtCfg,
|
|
1391
|
-
getConfig: _getConfig,
|
|
1392
|
-
hasNext: function () {
|
|
1393
|
-
return !!_nextProxy;
|
|
1394
|
-
},
|
|
1395
|
-
getNext: function () {
|
|
1396
|
-
return _nextProxy;
|
|
1397
|
-
},
|
|
1398
|
-
setNext: function (nextPlugin) {
|
|
1399
|
-
_nextProxy = nextPlugin;
|
|
1400
|
-
},
|
|
1401
|
-
iterate: _iterateChain,
|
|
1402
|
-
onComplete: _addOnComplete
|
|
1403
|
-
}
|
|
1404
|
-
};
|
|
1405
|
-
function _addOnComplete(onComplete, that) {
|
|
1406
|
-
var args = [];
|
|
1407
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1408
|
-
args[_i - 2] = arguments[_i];
|
|
1409
|
-
}
|
|
1410
|
-
if (onComplete) {
|
|
1411
|
-
_onComplete.push({
|
|
1412
|
-
func: onComplete,
|
|
1413
|
-
self: !isUndefined(that) ? that : context.ctx,
|
|
1414
|
-
args: args
|
|
1415
|
-
});
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
function _moveNext() {
|
|
1419
|
-
var nextProxy = _nextProxy;
|
|
1420
|
-
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1421
|
-
if (!nextProxy) {
|
|
1422
|
-
var onComplete = _onComplete;
|
|
1423
|
-
if (onComplete && onComplete.length > 0) {
|
|
1424
|
-
arrForEach(onComplete, function (completeDetails) {
|
|
1172
|
+
var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
|
|
1173
|
+
doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
|
|
1174
|
+
if (plugin && _hasProcessTelemetry) {
|
|
1175
|
+
_self._hasRun = true;
|
|
1425
1176
|
try {
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1177
|
+
itemCtx.setNext(_nextProxy);
|
|
1178
|
+
if (_hasSetNext) {
|
|
1179
|
+
plugin.setNextPlugin(_nextProxy);
|
|
1180
|
+
}
|
|
1181
|
+
_nextProxy && (_nextProxy._hasRun = false);
|
|
1182
|
+
plugin.processTelemetry(env, itemCtx);
|
|
1430
1183
|
}
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1439
|
-
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
1440
|
-
var theConfig;
|
|
1441
|
-
if (config) {
|
|
1442
|
-
var extConfig = config.extensionConfig;
|
|
1443
|
-
if (extConfig && identifier) {
|
|
1444
|
-
theConfig = extConfig[identifier];
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
if (!theConfig) {
|
|
1448
|
-
theConfig = defaultValue;
|
|
1449
|
-
}
|
|
1450
|
-
else if (isObject(defaultValue)) {
|
|
1451
|
-
if (mergeDefault !== 0 ) {
|
|
1452
|
-
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1453
|
-
if (config && mergeDefault === 2 ) {
|
|
1454
|
-
objForEachKey(defaultValue, function (field) {
|
|
1455
|
-
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1456
|
-
var cfgValue = config[field];
|
|
1457
|
-
if (!isNullOrUndefined(cfgValue)) {
|
|
1458
|
-
newConfig_1[field] = cfgValue;
|
|
1459
|
-
}
|
|
1184
|
+
catch (error) {
|
|
1185
|
+
var hasRun = _nextProxy && _nextProxy._hasRun;
|
|
1186
|
+
if (!_nextProxy || !hasRun) {
|
|
1187
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
|
|
1188
|
+
}
|
|
1189
|
+
if (_nextProxy && !hasRun) {
|
|
1190
|
+
_nextProxy.processTelemetry(env, itemCtx);
|
|
1460
1191
|
}
|
|
1461
|
-
}
|
|
1192
|
+
}
|
|
1462
1193
|
}
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
var theValue;
|
|
1470
|
-
var extConfig = _getExtCfg(identifier, null);
|
|
1471
|
-
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1472
|
-
theValue = extConfig[field];
|
|
1473
|
-
}
|
|
1474
|
-
else if (config && !isNullOrUndefined(config[field])) {
|
|
1475
|
-
theValue = config[field];
|
|
1476
|
-
}
|
|
1477
|
-
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1194
|
+
else if (_nextProxy) {
|
|
1195
|
+
_self._hasRun = true;
|
|
1196
|
+
_nextProxy.processTelemetry(env, itemCtx);
|
|
1197
|
+
}
|
|
1198
|
+
}, function () { return ({ item: env }); }, !(env.sync));
|
|
1199
|
+
};
|
|
1478
1200
|
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1201
|
+
return TelemetryPluginChain;
|
|
1202
|
+
}());
|
|
1203
|
+
|
|
1204
|
+
function _createProxyChain(plugins, itemCtx) {
|
|
1205
|
+
var proxies = [];
|
|
1206
|
+
if (plugins && plugins.length > 0) {
|
|
1207
|
+
var lastProxy = null;
|
|
1208
|
+
for (var idx = 0; idx < plugins.length; idx++) {
|
|
1209
|
+
var thePlugin = plugins[idx];
|
|
1210
|
+
if (thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1211
|
+
var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
|
|
1212
|
+
proxies.push(newProxy);
|
|
1213
|
+
if (lastProxy) {
|
|
1214
|
+
lastProxy.setNext(newProxy);
|
|
1215
|
+
}
|
|
1216
|
+
lastProxy = newProxy;
|
|
1485
1217
|
}
|
|
1486
1218
|
}
|
|
1487
1219
|
}
|
|
1488
|
-
return
|
|
1220
|
+
return proxies.length > 0 ? proxies[0] : null;
|
|
1489
1221
|
}
|
|
1490
|
-
function
|
|
1491
|
-
var
|
|
1492
|
-
var
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1222
|
+
function _copyProxyChain(proxy, itemCtx, startAt) {
|
|
1223
|
+
var plugins = [];
|
|
1224
|
+
var add = startAt ? false : true;
|
|
1225
|
+
if (proxy) {
|
|
1226
|
+
while (proxy) {
|
|
1227
|
+
var thePlugin = proxy.getPlugin();
|
|
1228
|
+
if (add || thePlugin === startAt) {
|
|
1229
|
+
add = true;
|
|
1230
|
+
plugins.push(thePlugin);
|
|
1231
|
+
}
|
|
1232
|
+
proxy = proxy.getNext();
|
|
1502
1233
|
}
|
|
1503
|
-
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1504
|
-
}
|
|
1505
|
-
context.processNext = _processNext;
|
|
1506
|
-
context.createNew = _createNew;
|
|
1507
|
-
return context;
|
|
1508
|
-
}
|
|
1509
|
-
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1510
|
-
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1511
|
-
var context = internalContext.ctx;
|
|
1512
|
-
function _processNext(unloadState) {
|
|
1513
|
-
var nextPlugin = internalContext._next();
|
|
1514
|
-
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1515
|
-
return !nextPlugin;
|
|
1516
1234
|
}
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
if (isArray(plugins)) {
|
|
1520
|
-
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1521
|
-
}
|
|
1522
|
-
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1235
|
+
if (!add) {
|
|
1236
|
+
plugins.push(startAt);
|
|
1523
1237
|
}
|
|
1524
|
-
|
|
1525
|
-
context.createNew = _createNew;
|
|
1526
|
-
return context;
|
|
1238
|
+
return _createProxyChain(plugins, itemCtx);
|
|
1527
1239
|
}
|
|
1528
|
-
function
|
|
1529
|
-
var
|
|
1530
|
-
var
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1240
|
+
function _copyPluginChain(srcPlugins, itemCtx, startAt) {
|
|
1241
|
+
var plugins = srcPlugins;
|
|
1242
|
+
var add = false;
|
|
1243
|
+
if (startAt && srcPlugins) {
|
|
1244
|
+
plugins = [];
|
|
1245
|
+
arrForEach(srcPlugins, function (thePlugin) {
|
|
1246
|
+
if (add || thePlugin === startAt) {
|
|
1247
|
+
add = true;
|
|
1248
|
+
plugins.push(thePlugin);
|
|
1535
1249
|
}
|
|
1536
1250
|
});
|
|
1537
1251
|
}
|
|
1538
|
-
|
|
1539
|
-
if (plugins
|
|
1540
|
-
|
|
1541
|
-
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1252
|
+
if (startAt && !add) {
|
|
1253
|
+
if (!plugins) {
|
|
1254
|
+
plugins = [];
|
|
1542
1255
|
}
|
|
1543
|
-
|
|
1256
|
+
plugins.push(startAt);
|
|
1544
1257
|
}
|
|
1545
|
-
|
|
1546
|
-
context.createNew = _createNew;
|
|
1547
|
-
return context;
|
|
1258
|
+
return _createProxyChain(plugins, itemCtx);
|
|
1548
1259
|
}
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
if (!firstProxy) {
|
|
1561
|
-
firstProxy = newProxy;
|
|
1260
|
+
var ProcessTelemetryContext = /** @class */ (function () {
|
|
1261
|
+
function ProcessTelemetryContext(plugins, config, core, startAt) {
|
|
1262
|
+
var _self = this;
|
|
1263
|
+
var _nextProxy = null;
|
|
1264
|
+
if (startAt !== null) {
|
|
1265
|
+
if (plugins && isFunction(plugins.getPlugin)) {
|
|
1266
|
+
_nextProxy = _copyProxyChain(plugins, _self, startAt || plugins.getPlugin());
|
|
1267
|
+
}
|
|
1268
|
+
else {
|
|
1269
|
+
if (startAt) {
|
|
1270
|
+
_nextProxy = _copyPluginChain(plugins, _self, startAt);
|
|
1562
1271
|
}
|
|
1563
|
-
if (
|
|
1564
|
-
|
|
1272
|
+
else if (isUndefined(startAt)) {
|
|
1273
|
+
_nextProxy = _createProxyChain(plugins, _self);
|
|
1565
1274
|
}
|
|
1566
|
-
lastProxy_1 = newProxy;
|
|
1567
1275
|
}
|
|
1568
|
-
});
|
|
1569
|
-
}
|
|
1570
|
-
if (startAt && !firstProxy) {
|
|
1571
|
-
return createTelemetryProxyChain([startAt], config, core);
|
|
1572
|
-
}
|
|
1573
|
-
return firstProxy;
|
|
1574
|
-
}
|
|
1575
|
-
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1576
|
-
var nextProxy = null;
|
|
1577
|
-
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1578
|
-
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1579
|
-
var chainId;
|
|
1580
|
-
if (plugin) {
|
|
1581
|
-
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1582
|
-
}
|
|
1583
|
-
else {
|
|
1584
|
-
chainId = "Unknown-0-" + _chainId++;
|
|
1585
|
-
}
|
|
1586
|
-
var proxyChain = {
|
|
1587
|
-
getPlugin: function () {
|
|
1588
|
-
return plugin;
|
|
1589
|
-
},
|
|
1590
|
-
getNext: function () {
|
|
1591
|
-
return nextProxy;
|
|
1592
|
-
},
|
|
1593
|
-
processTelemetry: _processTelemetry,
|
|
1594
|
-
unload: _unloadPlugin,
|
|
1595
|
-
update: _updatePlugin,
|
|
1596
|
-
_id: chainId,
|
|
1597
|
-
_setNext: function (nextPlugin) {
|
|
1598
|
-
nextProxy = nextPlugin;
|
|
1599
1276
|
}
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1617
|
-
}
|
|
1618
|
-
itemCtx.setNext(nextProxy);
|
|
1619
|
-
if (plugin) {
|
|
1620
|
-
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1621
|
-
hasRunContext[chainId] = true;
|
|
1622
|
-
try {
|
|
1623
|
-
var nextId = nextProxy ? nextProxy._id : strEmpty;
|
|
1624
|
-
if (nextId) {
|
|
1625
|
-
hasRunContext[nextId] = false;
|
|
1626
|
-
}
|
|
1627
|
-
hasRun = processPluginFn(itemCtx);
|
|
1628
|
-
}
|
|
1629
|
-
catch (error) {
|
|
1630
|
-
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1631
|
-
if (hasNextRun) {
|
|
1632
|
-
hasRun = true;
|
|
1633
|
-
}
|
|
1634
|
-
if (!nextProxy || !hasNextRun) {
|
|
1635
|
-
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1636
|
-
}
|
|
1277
|
+
_self.core = function () {
|
|
1278
|
+
return core;
|
|
1279
|
+
};
|
|
1280
|
+
_self.diagLog = function () {
|
|
1281
|
+
return safeGetLogger(core, config);
|
|
1282
|
+
};
|
|
1283
|
+
_self.getCfg = function () {
|
|
1284
|
+
return config;
|
|
1285
|
+
};
|
|
1286
|
+
_self.getExtCfg = function (identifier, defaultValue) {
|
|
1287
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1288
|
+
var theConfig;
|
|
1289
|
+
if (config) {
|
|
1290
|
+
var extConfig = config.extensionConfig;
|
|
1291
|
+
if (extConfig && identifier) {
|
|
1292
|
+
theConfig = extConfig[identifier];
|
|
1637
1293
|
}
|
|
1638
|
-
}, details, isAsync);
|
|
1639
|
-
}
|
|
1640
|
-
return hasRun;
|
|
1641
|
-
}
|
|
1642
|
-
function _processTelemetry(env, itemCtx) {
|
|
1643
|
-
itemCtx = itemCtx || _getTelCtx();
|
|
1644
|
-
function _callProcessTelemetry(itemCtx) {
|
|
1645
|
-
if (!plugin || !hasProcessTelemetry) {
|
|
1646
|
-
return false;
|
|
1647
1294
|
}
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1295
|
+
return (theConfig ? theConfig : defaultValue);
|
|
1296
|
+
};
|
|
1297
|
+
_self.getConfig = function (identifier, field, defaultValue) {
|
|
1298
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
1299
|
+
var theValue;
|
|
1300
|
+
var extConfig = _self.getExtCfg(identifier, null);
|
|
1301
|
+
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1302
|
+
theValue = extConfig[field];
|
|
1651
1303
|
}
|
|
1652
|
-
if (
|
|
1653
|
-
|
|
1304
|
+
else if (config && !isNullOrUndefined(config[field])) {
|
|
1305
|
+
theValue = config[field];
|
|
1654
1306
|
}
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
function
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
pluginState[strIsInitialized] = false;
|
|
1672
|
-
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1673
|
-
hasRun = true;
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1307
|
+
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1308
|
+
};
|
|
1309
|
+
_self.hasNext = function () {
|
|
1310
|
+
return _nextProxy != null;
|
|
1311
|
+
};
|
|
1312
|
+
_self.getNext = function () {
|
|
1313
|
+
return _nextProxy;
|
|
1314
|
+
};
|
|
1315
|
+
_self.setNext = function (nextPlugin) {
|
|
1316
|
+
_nextProxy = nextPlugin;
|
|
1317
|
+
};
|
|
1318
|
+
_self.processNext = function (env) {
|
|
1319
|
+
var nextPlugin = _nextProxy;
|
|
1320
|
+
if (nextPlugin) {
|
|
1321
|
+
_nextProxy = nextPlugin.getNext();
|
|
1322
|
+
nextPlugin.processTelemetry(env, _self);
|
|
1676
1323
|
}
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
}
|
|
1324
|
+
};
|
|
1325
|
+
_self.createNew = function (plugins, startAt) {
|
|
1326
|
+
if (plugins === void 0) { plugins = null; }
|
|
1327
|
+
return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1328
|
+
};
|
|
1682
1329
|
}
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1330
|
+
return ProcessTelemetryContext;
|
|
1331
|
+
}());
|
|
1332
|
+
|
|
1333
|
+
var strExtensionConfig = "extensionConfig";
|
|
1334
|
+
|
|
1335
|
+
var strGetPlugin = "getPlugin";
|
|
1336
|
+
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
1337
|
+
function BaseTelemetryPlugin() {
|
|
1338
|
+
var _self = this;
|
|
1339
|
+
var _isinitialized = false;
|
|
1340
|
+
var _rootCtx = null;
|
|
1341
|
+
var _nextPlugin = null;
|
|
1342
|
+
_self.core = null;
|
|
1343
|
+
_self.diagLog = function (itemCtx) {
|
|
1344
|
+
return _self._getTelCtx(itemCtx).diagLog();
|
|
1345
|
+
};
|
|
1346
|
+
_self.isInitialized = function () {
|
|
1347
|
+
return _isinitialized;
|
|
1348
|
+
};
|
|
1349
|
+
_self.setInitialized = function (isInitialized) {
|
|
1350
|
+
_isinitialized = isInitialized;
|
|
1351
|
+
};
|
|
1352
|
+
_self.setNextPlugin = function (next) {
|
|
1353
|
+
_nextPlugin = next;
|
|
1354
|
+
};
|
|
1355
|
+
_self.processNext = function (env, itemCtx) {
|
|
1356
|
+
if (itemCtx) {
|
|
1357
|
+
itemCtx.processNext(env);
|
|
1358
|
+
}
|
|
1359
|
+
else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
|
|
1360
|
+
_nextPlugin.processTelemetry(env, null);
|
|
1361
|
+
}
|
|
1362
|
+
};
|
|
1363
|
+
_self._getTelCtx = function (currentCtx) {
|
|
1364
|
+
if (currentCtx === void 0) { currentCtx = null; }
|
|
1365
|
+
var itemCtx = currentCtx;
|
|
1366
|
+
if (!itemCtx) {
|
|
1367
|
+
var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);
|
|
1368
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1369
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
1370
|
+
}
|
|
1371
|
+
else {
|
|
1372
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin);
|
|
1693
1373
|
}
|
|
1694
1374
|
}
|
|
1695
|
-
return
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1375
|
+
return itemCtx;
|
|
1376
|
+
};
|
|
1377
|
+
_self._baseTelInit = function (config, core, extensions, pluginChain) {
|
|
1378
|
+
if (config) {
|
|
1379
|
+
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
1380
|
+
}
|
|
1381
|
+
if (!pluginChain && core) {
|
|
1382
|
+
pluginChain = core.getProcessTelContext().getNext();
|
|
1383
|
+
}
|
|
1384
|
+
var nextPlugin = _nextPlugin;
|
|
1385
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1386
|
+
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
1387
|
+
}
|
|
1388
|
+
_self.core = core;
|
|
1389
|
+
_rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
1390
|
+
_isinitialized = true;
|
|
1391
|
+
};
|
|
1700
1392
|
}
|
|
1701
|
-
|
|
1702
|
-
|
|
1393
|
+
BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
|
|
1394
|
+
this._baseTelInit(config, core, extensions, pluginChain);
|
|
1395
|
+
};
|
|
1396
|
+
return BaseTelemetryPlugin;
|
|
1397
|
+
}());
|
|
1703
1398
|
|
|
1704
1399
|
var strToGMTString = "toGMTString";
|
|
1705
1400
|
var strToUTCString = "toUTCString";
|
|
@@ -1709,6 +1404,7 @@
|
|
|
1709
1404
|
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
1710
1405
|
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
1711
1406
|
var strConfigCookieMgr = "_ckMgr";
|
|
1407
|
+
var strEmpty = "";
|
|
1712
1408
|
var _supportsCookies = null;
|
|
1713
1409
|
var _allowUaSameSite = null;
|
|
1714
1410
|
var _parsedCookieValue = null;
|
|
@@ -1867,7 +1563,7 @@
|
|
|
1867
1563
|
_supportsCookies = doc[strCookie] !== undefined;
|
|
1868
1564
|
}
|
|
1869
1565
|
catch (e) {
|
|
1870
|
-
|
|
1566
|
+
logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotAccessCookie, "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1871
1567
|
}
|
|
1872
1568
|
}
|
|
1873
1569
|
return _supportsCookies;
|
|
@@ -1946,286 +1642,86 @@
|
|
|
1946
1642
|
return false;
|
|
1947
1643
|
}
|
|
1948
1644
|
|
|
1949
|
-
var
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
}
|
|
1958
|
-
function _runHandlers(unloadCtx, unloadState) {
|
|
1959
|
-
arrForEach(handlers, function (handler) {
|
|
1960
|
-
try {
|
|
1961
|
-
handler(unloadCtx, unloadState);
|
|
1962
|
-
}
|
|
1963
|
-
catch (e) {
|
|
1964
|
-
_throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
1965
|
-
}
|
|
1966
|
-
});
|
|
1967
|
-
handlers = [];
|
|
1645
|
+
var UInt32Mask = 0x100000000;
|
|
1646
|
+
var MaxUInt32 = 0xffffffff;
|
|
1647
|
+
var _mwcSeeded = false;
|
|
1648
|
+
var _mwcW = 123456789;
|
|
1649
|
+
var _mwcZ = 987654321;
|
|
1650
|
+
function _mwcSeed(seedValue) {
|
|
1651
|
+
if (seedValue < 0) {
|
|
1652
|
+
seedValue >>>= 0;
|
|
1968
1653
|
}
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
};
|
|
1654
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
1655
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
1656
|
+
_mwcSeeded = true;
|
|
1973
1657
|
}
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
var _self = this;
|
|
1979
|
-
var _isinitialized;
|
|
1980
|
-
var _rootCtx;
|
|
1981
|
-
var _nextPlugin;
|
|
1982
|
-
var _unloadHandlerContainer;
|
|
1983
|
-
var _hooks;
|
|
1984
|
-
_initDefaults();
|
|
1985
|
-
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
1986
|
-
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
1987
|
-
_setDefaults(config, core, pluginChain);
|
|
1988
|
-
_isinitialized = true;
|
|
1989
|
-
};
|
|
1990
|
-
_self.teardown = function (unloadCtx, unloadState) {
|
|
1991
|
-
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
1992
|
-
return;
|
|
1993
|
-
}
|
|
1994
|
-
var result;
|
|
1995
|
-
var unloadDone = false;
|
|
1996
|
-
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1997
|
-
var theUnloadState = unloadState || {
|
|
1998
|
-
reason: 0 ,
|
|
1999
|
-
isAsync: false
|
|
2000
|
-
};
|
|
2001
|
-
function _unloadCallback() {
|
|
2002
|
-
if (!unloadDone) {
|
|
2003
|
-
unloadDone = true;
|
|
2004
|
-
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
2005
|
-
arrForEach(_hooks, function (fn) {
|
|
2006
|
-
fn.rm();
|
|
2007
|
-
});
|
|
2008
|
-
_hooks = [];
|
|
2009
|
-
if (result === true) {
|
|
2010
|
-
theUnloadCtx.processNext(theUnloadState);
|
|
2011
|
-
}
|
|
2012
|
-
_initDefaults();
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
2016
|
-
_unloadCallback();
|
|
2017
|
-
}
|
|
2018
|
-
else {
|
|
2019
|
-
result = true;
|
|
2020
|
-
}
|
|
2021
|
-
return result;
|
|
2022
|
-
};
|
|
2023
|
-
_self.update = function (updateCtx, updateState) {
|
|
2024
|
-
if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
|
|
2025
|
-
return;
|
|
2026
|
-
}
|
|
2027
|
-
var result;
|
|
2028
|
-
var updateDone = false;
|
|
2029
|
-
var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
2030
|
-
var theUpdateState = updateState || {
|
|
2031
|
-
reason: 0
|
|
2032
|
-
};
|
|
2033
|
-
function _updateCallback() {
|
|
2034
|
-
if (!updateDone) {
|
|
2035
|
-
updateDone = true;
|
|
2036
|
-
_setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
|
|
2037
|
-
}
|
|
2038
|
-
}
|
|
2039
|
-
if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
|
|
2040
|
-
_updateCallback();
|
|
2041
|
-
}
|
|
2042
|
-
else {
|
|
2043
|
-
result = true;
|
|
2044
|
-
}
|
|
2045
|
-
return result;
|
|
2046
|
-
};
|
|
2047
|
-
_self._addHook = function (hooks) {
|
|
2048
|
-
if (hooks) {
|
|
2049
|
-
if (isArray(hooks)) {
|
|
2050
|
-
_hooks = _hooks.concat(hooks);
|
|
2051
|
-
}
|
|
2052
|
-
else {
|
|
2053
|
-
_hooks.push(hooks);
|
|
2054
|
-
}
|
|
2055
|
-
}
|
|
2056
|
-
};
|
|
2057
|
-
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
2058
|
-
});
|
|
2059
|
-
_self.diagLog = function (itemCtx) {
|
|
2060
|
-
return _getTelCtx(itemCtx).diagLog();
|
|
2061
|
-
};
|
|
2062
|
-
_self[strIsInitialized] = function () {
|
|
2063
|
-
return _isinitialized;
|
|
2064
|
-
};
|
|
2065
|
-
_self.setInitialized = function (isInitialized) {
|
|
2066
|
-
_isinitialized = isInitialized;
|
|
2067
|
-
};
|
|
2068
|
-
_self[strSetNextPlugin] = function (next) {
|
|
2069
|
-
_nextPlugin = next;
|
|
2070
|
-
};
|
|
2071
|
-
_self.processNext = function (env, itemCtx) {
|
|
2072
|
-
if (itemCtx) {
|
|
2073
|
-
itemCtx.processNext(env);
|
|
2074
|
-
}
|
|
2075
|
-
else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
|
|
2076
|
-
_nextPlugin.processTelemetry(env, null);
|
|
2077
|
-
}
|
|
2078
|
-
};
|
|
2079
|
-
_self._getTelCtx = _getTelCtx;
|
|
2080
|
-
function _getTelCtx(currentCtx) {
|
|
2081
|
-
if (currentCtx === void 0) { currentCtx = null; }
|
|
2082
|
-
var itemCtx = currentCtx;
|
|
2083
|
-
if (!itemCtx) {
|
|
2084
|
-
var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
|
|
2085
|
-
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
2086
|
-
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
2087
|
-
}
|
|
2088
|
-
else {
|
|
2089
|
-
itemCtx = rootCtx.createNew(null, _nextPlugin);
|
|
2090
|
-
}
|
|
2091
|
-
}
|
|
2092
|
-
return itemCtx;
|
|
2093
|
-
}
|
|
2094
|
-
function _setDefaults(config, core, pluginChain) {
|
|
2095
|
-
if (config) {
|
|
2096
|
-
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
2097
|
-
}
|
|
2098
|
-
if (!pluginChain && core) {
|
|
2099
|
-
pluginChain = core.getProcessTelContext().getNext();
|
|
2100
|
-
}
|
|
2101
|
-
var nextPlugin = _nextPlugin;
|
|
2102
|
-
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
2103
|
-
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
2104
|
-
}
|
|
2105
|
-
_self.core = core;
|
|
2106
|
-
_rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
2107
|
-
}
|
|
2108
|
-
function _initDefaults() {
|
|
2109
|
-
_isinitialized = false;
|
|
2110
|
-
_self.core = null;
|
|
2111
|
-
_rootCtx = null;
|
|
2112
|
-
_nextPlugin = null;
|
|
2113
|
-
_hooks = [];
|
|
2114
|
-
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
2115
|
-
}
|
|
1658
|
+
function _autoSeedMwc() {
|
|
1659
|
+
try {
|
|
1660
|
+
var now = dateNow() & 0x7fffffff;
|
|
1661
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
2116
1662
|
}
|
|
2117
|
-
|
|
2118
|
-
}());
|
|
2119
|
-
|
|
2120
|
-
var strOnPrefix = "on";
|
|
2121
|
-
var strAttachEvent = "attachEvent";
|
|
2122
|
-
var strAddEventHelper = "addEventListener";
|
|
2123
|
-
var strEvents = "events";
|
|
2124
|
-
createUniqueNamespace("aiEvtPageHide");
|
|
2125
|
-
createUniqueNamespace("aiEvtPageShow");
|
|
2126
|
-
var rRemoveEmptyNs = /\.[\.]+/g;
|
|
2127
|
-
var rRemoveTrailingEmptyNs = /[\.]+$/;
|
|
2128
|
-
var _guid = 1;
|
|
2129
|
-
var elmNodeData = createElmNodeData("events");
|
|
2130
|
-
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
2131
|
-
function _normalizeNamespace(name) {
|
|
2132
|
-
if (name && name.replace) {
|
|
2133
|
-
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
2134
|
-
}
|
|
2135
|
-
return name;
|
|
2136
|
-
}
|
|
2137
|
-
function _getEvtNamespace(eventName, evtNamespace) {
|
|
2138
|
-
if (evtNamespace) {
|
|
2139
|
-
var theNamespace_1 = "";
|
|
2140
|
-
if (isArray(evtNamespace)) {
|
|
2141
|
-
theNamespace_1 = "";
|
|
2142
|
-
arrForEach(evtNamespace, function (name) {
|
|
2143
|
-
name = _normalizeNamespace(name);
|
|
2144
|
-
if (name) {
|
|
2145
|
-
if (name[0] !== ".") {
|
|
2146
|
-
name = "." + name;
|
|
2147
|
-
}
|
|
2148
|
-
theNamespace_1 += name;
|
|
2149
|
-
}
|
|
2150
|
-
});
|
|
2151
|
-
}
|
|
2152
|
-
else {
|
|
2153
|
-
theNamespace_1 = _normalizeNamespace(evtNamespace);
|
|
2154
|
-
}
|
|
2155
|
-
if (theNamespace_1) {
|
|
2156
|
-
if (theNamespace_1[0] !== ".") {
|
|
2157
|
-
theNamespace_1 = "." + theNamespace_1;
|
|
2158
|
-
}
|
|
2159
|
-
eventName = (eventName || "") + theNamespace_1;
|
|
2160
|
-
}
|
|
1663
|
+
catch (e) {
|
|
2161
1664
|
}
|
|
2162
|
-
var parsedEvent = (eventNamespace.exec(eventName || "") || []);
|
|
2163
|
-
return {
|
|
2164
|
-
type: parsedEvent[1],
|
|
2165
|
-
ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
|
|
2166
|
-
};
|
|
2167
1665
|
}
|
|
2168
|
-
function
|
|
2169
|
-
if (
|
|
2170
|
-
|
|
2171
|
-
var registeredEvents = aiEvts[evtName];
|
|
2172
|
-
if (!registeredEvents) {
|
|
2173
|
-
registeredEvents = aiEvts[evtName] = [];
|
|
1666
|
+
function randomValue(maxValue) {
|
|
1667
|
+
if (maxValue > 0) {
|
|
1668
|
+
return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
|
|
2174
1669
|
}
|
|
2175
|
-
return
|
|
1670
|
+
return 0;
|
|
2176
1671
|
}
|
|
2177
|
-
function
|
|
2178
|
-
var
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
result = true;
|
|
1672
|
+
function random32(signed) {
|
|
1673
|
+
var value;
|
|
1674
|
+
var c = getCrypto() || getMsCrypto();
|
|
1675
|
+
if (c && c.getRandomValues) {
|
|
1676
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1677
|
+
}
|
|
1678
|
+
else if (isIE()) {
|
|
1679
|
+
if (!_mwcSeeded) {
|
|
1680
|
+
_autoSeedMwc();
|
|
2187
1681
|
}
|
|
1682
|
+
value = mwcRandom32() & MaxUInt32;
|
|
2188
1683
|
}
|
|
2189
|
-
|
|
1684
|
+
else {
|
|
1685
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1686
|
+
}
|
|
1687
|
+
if (!signed) {
|
|
1688
|
+
value >>>= 0;
|
|
1689
|
+
}
|
|
1690
|
+
return value;
|
|
2190
1691
|
}
|
|
2191
|
-
function
|
|
2192
|
-
if (
|
|
2193
|
-
|
|
2194
|
-
if (target) {
|
|
2195
|
-
try {
|
|
2196
|
-
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
2197
|
-
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
2198
|
-
if (result && elmNodeData.accept(target)) {
|
|
2199
|
-
var registeredEvent = {
|
|
2200
|
-
guid: _guid++,
|
|
2201
|
-
evtName: evtName,
|
|
2202
|
-
handler: handlerRef,
|
|
2203
|
-
capture: useCapture
|
|
2204
|
-
};
|
|
2205
|
-
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
catch (e) {
|
|
2209
|
-
}
|
|
1692
|
+
function mwcRandomSeed(value) {
|
|
1693
|
+
if (!value) {
|
|
1694
|
+
_autoSeedMwc();
|
|
2210
1695
|
}
|
|
2211
|
-
|
|
1696
|
+
else {
|
|
1697
|
+
_mwcSeed(value);
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
function mwcRandom32(signed) {
|
|
1701
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1702
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1703
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1704
|
+
if (!signed) {
|
|
1705
|
+
value >>>= 0;
|
|
1706
|
+
}
|
|
1707
|
+
return value;
|
|
2212
1708
|
}
|
|
2213
|
-
|
|
1709
|
+
|
|
1710
|
+
var _cookieMgrs = null;
|
|
1711
|
+
var _canUseCookies;
|
|
1712
|
+
function addEventHandler(eventName, callback) {
|
|
2214
1713
|
var result = false;
|
|
2215
1714
|
var w = getWindow();
|
|
2216
1715
|
if (w) {
|
|
2217
|
-
result =
|
|
2218
|
-
result =
|
|
1716
|
+
result = attachEvent(w, eventName, callback);
|
|
1717
|
+
result = attachEvent(w["body"], eventName, callback) || result;
|
|
2219
1718
|
}
|
|
2220
1719
|
var doc = getDocument();
|
|
2221
1720
|
if (doc) {
|
|
2222
|
-
result =
|
|
1721
|
+
result = attachEvent(doc, eventName, callback) || result;
|
|
2223
1722
|
}
|
|
2224
1723
|
return result;
|
|
2225
1724
|
}
|
|
2226
|
-
|
|
2227
|
-
var _cookieMgrs = null;
|
|
2228
|
-
var _canUseCookies;
|
|
2229
1725
|
function newGuid() {
|
|
2230
1726
|
function randomHexDigit() {
|
|
2231
1727
|
return randomValue(15);
|
|
@@ -2242,9 +1738,26 @@
|
|
|
2242
1738
|
}
|
|
2243
1739
|
return dateNow();
|
|
2244
1740
|
}
|
|
1741
|
+
function newId(maxLength) {
|
|
1742
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1743
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1744
|
+
var number = random32() >>> 0;
|
|
1745
|
+
var chars = 0;
|
|
1746
|
+
var result = "";
|
|
1747
|
+
while (result.length < maxLength) {
|
|
1748
|
+
chars++;
|
|
1749
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1750
|
+
number >>>= 6;
|
|
1751
|
+
if (chars === 5) {
|
|
1752
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1753
|
+
chars = 0;
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
return result;
|
|
1757
|
+
}
|
|
2245
1758
|
function generateW3CId() {
|
|
2246
1759
|
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
2247
|
-
var oct =
|
|
1760
|
+
var oct = "", tmp;
|
|
2248
1761
|
for (var a = 0; a < 4; a++) {
|
|
2249
1762
|
tmp = random32();
|
|
2250
1763
|
oct +=
|
|
@@ -2327,183 +1840,101 @@
|
|
|
2327
1840
|
_legacyCookieMgr().setEnabled(false);
|
|
2328
1841
|
}
|
|
2329
1842
|
|
|
2330
|
-
var LoggingSeverity = createEnumStyle({
|
|
2331
|
-
CRITICAL: 1 ,
|
|
2332
|
-
WARNING: 2
|
|
2333
|
-
});
|
|
2334
|
-
var _InternalMessageId = createEnumStyle({
|
|
2335
|
-
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
2336
|
-
BrowserCannotReadLocalStorage: 1 ,
|
|
2337
|
-
BrowserCannotReadSessionStorage: 2 ,
|
|
2338
|
-
BrowserCannotWriteLocalStorage: 3 ,
|
|
2339
|
-
BrowserCannotWriteSessionStorage: 4 ,
|
|
2340
|
-
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
2341
|
-
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
2342
|
-
CannotSendEmptyTelemetry: 7 ,
|
|
2343
|
-
ClientPerformanceMathError: 8 ,
|
|
2344
|
-
ErrorParsingAISessionCookie: 9 ,
|
|
2345
|
-
ErrorPVCalc: 10 ,
|
|
2346
|
-
ExceptionWhileLoggingError: 11 ,
|
|
2347
|
-
FailedAddingTelemetryToBuffer: 12 ,
|
|
2348
|
-
FailedMonitorAjaxAbort: 13 ,
|
|
2349
|
-
FailedMonitorAjaxDur: 14 ,
|
|
2350
|
-
FailedMonitorAjaxOpen: 15 ,
|
|
2351
|
-
FailedMonitorAjaxRSC: 16 ,
|
|
2352
|
-
FailedMonitorAjaxSend: 17 ,
|
|
2353
|
-
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
2354
|
-
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
2355
|
-
FailedToSendQueuedTelemetry: 20 ,
|
|
2356
|
-
FailedToReportDataLoss: 21 ,
|
|
2357
|
-
FlushFailed: 22 ,
|
|
2358
|
-
MessageLimitPerPVExceeded: 23 ,
|
|
2359
|
-
MissingRequiredFieldSpecification: 24 ,
|
|
2360
|
-
NavigationTimingNotSupported: 25 ,
|
|
2361
|
-
OnError: 26 ,
|
|
2362
|
-
SessionRenewalDateIsZero: 27 ,
|
|
2363
|
-
SenderNotInitialized: 28 ,
|
|
2364
|
-
StartTrackEventFailed: 29 ,
|
|
2365
|
-
StopTrackEventFailed: 30 ,
|
|
2366
|
-
StartTrackFailed: 31 ,
|
|
2367
|
-
StopTrackFailed: 32 ,
|
|
2368
|
-
TelemetrySampledAndNotSent: 33 ,
|
|
2369
|
-
TrackEventFailed: 34 ,
|
|
2370
|
-
TrackExceptionFailed: 35 ,
|
|
2371
|
-
TrackMetricFailed: 36 ,
|
|
2372
|
-
TrackPVFailed: 37 ,
|
|
2373
|
-
TrackPVFailedCalc: 38 ,
|
|
2374
|
-
TrackTraceFailed: 39 ,
|
|
2375
|
-
TransmissionFailed: 40 ,
|
|
2376
|
-
FailedToSetStorageBuffer: 41 ,
|
|
2377
|
-
FailedToRestoreStorageBuffer: 42 ,
|
|
2378
|
-
InvalidBackendResponse: 43 ,
|
|
2379
|
-
FailedToFixDepricatedValues: 44 ,
|
|
2380
|
-
InvalidDurationValue: 45 ,
|
|
2381
|
-
TelemetryEnvelopeInvalid: 46 ,
|
|
2382
|
-
CreateEnvelopeError: 47 ,
|
|
2383
|
-
CannotSerializeObject: 48 ,
|
|
2384
|
-
CannotSerializeObjectNonSerializable: 49 ,
|
|
2385
|
-
CircularReferenceDetected: 50 ,
|
|
2386
|
-
ClearAuthContextFailed: 51 ,
|
|
2387
|
-
ExceptionTruncated: 52 ,
|
|
2388
|
-
IllegalCharsInName: 53 ,
|
|
2389
|
-
ItemNotInArray: 54 ,
|
|
2390
|
-
MaxAjaxPerPVExceeded: 55 ,
|
|
2391
|
-
MessageTruncated: 56 ,
|
|
2392
|
-
NameTooLong: 57 ,
|
|
2393
|
-
SampleRateOutOfRange: 58 ,
|
|
2394
|
-
SetAuthContextFailed: 59 ,
|
|
2395
|
-
SetAuthContextFailedAccountName: 60 ,
|
|
2396
|
-
StringValueTooLong: 61 ,
|
|
2397
|
-
StartCalledMoreThanOnce: 62 ,
|
|
2398
|
-
StopCalledWithoutStart: 63 ,
|
|
2399
|
-
TelemetryInitializerFailed: 64 ,
|
|
2400
|
-
TrackArgumentsNotSpecified: 65 ,
|
|
2401
|
-
UrlTooLong: 66 ,
|
|
2402
|
-
SessionStorageBufferFull: 67 ,
|
|
2403
|
-
CannotAccessCookie: 68 ,
|
|
2404
|
-
IdTooLong: 69 ,
|
|
2405
|
-
InvalidEvent: 70 ,
|
|
2406
|
-
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
2407
|
-
SendBrowserInfoOnUserInit: 72 ,
|
|
2408
|
-
PluginException: 73 ,
|
|
2409
|
-
NotificationException: 74 ,
|
|
2410
|
-
SnippetScriptLoadFailure: 99 ,
|
|
2411
|
-
InvalidInstrumentationKey: 100 ,
|
|
2412
|
-
CannotParseAiBlobValue: 101 ,
|
|
2413
|
-
InvalidContentBlob: 102 ,
|
|
2414
|
-
TrackPageActionEventFailed: 103 ,
|
|
2415
|
-
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
2416
|
-
InMemoryStorageBufferFull: 105
|
|
2417
|
-
});
|
|
2418
|
-
|
|
2419
1843
|
var ReactPlugin = /** @class */ (function (_super) {
|
|
2420
1844
|
__extendsFn(ReactPlugin, _super);
|
|
2421
1845
|
function ReactPlugin() {
|
|
2422
|
-
var _this = _super.
|
|
1846
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
2423
1847
|
_this.priority = 185;
|
|
2424
1848
|
_this.identifier = 'ReactPlugin';
|
|
2425
|
-
var _analyticsPlugin;
|
|
2426
|
-
var _extensionConfig;
|
|
2427
|
-
var _unlisten;
|
|
2428
|
-
var _pageViewTimer;
|
|
2429
|
-
dynamicProto(ReactPlugin, _this, function (_self, _base) {
|
|
2430
|
-
_initDefaults();
|
|
2431
|
-
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
2432
|
-
_super.prototype.initialize.call(_this, config, core, extensions, pluginChain);
|
|
2433
|
-
_extensionConfig =
|
|
2434
|
-
config.extensionConfig && config.extensionConfig[_self.identifier]
|
|
2435
|
-
? config.extensionConfig[_self.identifier]
|
|
2436
|
-
: { history: null };
|
|
2437
|
-
arrForEach(extensions, function (ext) {
|
|
2438
|
-
var identifier = ext.identifier;
|
|
2439
|
-
if (identifier === 'ApplicationInsightsAnalytics') {
|
|
2440
|
-
_analyticsPlugin = ext;
|
|
2441
|
-
}
|
|
2442
|
-
});
|
|
2443
|
-
if (_extensionConfig.history) {
|
|
2444
|
-
_addHistoryListener(_extensionConfig.history);
|
|
2445
|
-
var pageViewTelemetry = {
|
|
2446
|
-
uri: _extensionConfig.history.location.pathname
|
|
2447
|
-
};
|
|
2448
|
-
_self.trackPageView(pageViewTelemetry);
|
|
2449
|
-
}
|
|
2450
|
-
};
|
|
2451
|
-
_self.getCookieMgr = function () {
|
|
2452
|
-
return safeGetCookieMgr(_self.core);
|
|
2453
|
-
};
|
|
2454
|
-
_self.getAppInsights = _getAnalytics;
|
|
2455
|
-
_self.processTelemetry = function (event, itemCtx) {
|
|
2456
|
-
_self.processNext(event, itemCtx);
|
|
2457
|
-
};
|
|
2458
|
-
_self._doTeardown = function (unloadCtx, unloadState, asyncCallback) {
|
|
2459
|
-
if (isFunction(_unlisten)) {
|
|
2460
|
-
_unlisten();
|
|
2461
|
-
}
|
|
2462
|
-
if (_pageViewTimer) {
|
|
2463
|
-
clearTimeout(_pageViewTimer);
|
|
2464
|
-
}
|
|
2465
|
-
_initDefaults();
|
|
2466
|
-
};
|
|
2467
|
-
proxyFunctions(_self, _getAnalytics, [
|
|
2468
|
-
"trackMetric",
|
|
2469
|
-
"trackPageView",
|
|
2470
|
-
"trackEvent",
|
|
2471
|
-
"trackException",
|
|
2472
|
-
"trackTrace",
|
|
2473
|
-
]);
|
|
2474
|
-
function _initDefaults() {
|
|
2475
|
-
_analyticsPlugin = null;
|
|
2476
|
-
_extensionConfig = null;
|
|
2477
|
-
_unlisten = null;
|
|
2478
|
-
_pageViewTimer = null;
|
|
2479
|
-
}
|
|
2480
|
-
function _getAnalytics() {
|
|
2481
|
-
if (!_analyticsPlugin) {
|
|
2482
|
-
_self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, React plugin telemetry will not be sent: ");
|
|
2483
|
-
}
|
|
2484
|
-
return _analyticsPlugin;
|
|
2485
|
-
}
|
|
2486
|
-
function _addHistoryListener(history) {
|
|
2487
|
-
var locationListener = function (arg) {
|
|
2488
|
-
var locn = null;
|
|
2489
|
-
if ("location" in arg) {
|
|
2490
|
-
locn = arg["location"];
|
|
2491
|
-
}
|
|
2492
|
-
else {
|
|
2493
|
-
locn = arg;
|
|
2494
|
-
}
|
|
2495
|
-
_pageViewTimer = setTimeout(function () {
|
|
2496
|
-
_pageViewTimer = null;
|
|
2497
|
-
var pageViewTelemetry = { uri: locn.pathname };
|
|
2498
|
-
_self.trackPageView(pageViewTelemetry);
|
|
2499
|
-
}, 500);
|
|
2500
|
-
};
|
|
2501
|
-
_unlisten = history.listen(locationListener);
|
|
2502
|
-
}
|
|
2503
|
-
objDefineAccessors(_self, "_extensionConfig", function () { return _extensionConfig; });
|
|
2504
|
-
});
|
|
2505
1849
|
return _this;
|
|
2506
1850
|
}
|
|
1851
|
+
ReactPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
|
|
1852
|
+
var _this = this;
|
|
1853
|
+
_super.prototype.initialize.call(this, config, core, extensions, pluginChain);
|
|
1854
|
+
this._extensionConfig =
|
|
1855
|
+
config.extensionConfig && config.extensionConfig[this.identifier]
|
|
1856
|
+
? config.extensionConfig[this.identifier]
|
|
1857
|
+
: { history: null };
|
|
1858
|
+
arrForEach(extensions, function (ext) {
|
|
1859
|
+
var identifier = ext.identifier;
|
|
1860
|
+
if (identifier === 'ApplicationInsightsAnalytics') {
|
|
1861
|
+
_this._analyticsPlugin = ext;
|
|
1862
|
+
}
|
|
1863
|
+
});
|
|
1864
|
+
if (this._extensionConfig.history) {
|
|
1865
|
+
this.addHistoryListener(this._extensionConfig.history);
|
|
1866
|
+
var pageViewTelemetry = {
|
|
1867
|
+
uri: this._extensionConfig.history.location.pathname
|
|
1868
|
+
};
|
|
1869
|
+
this.trackPageView(pageViewTelemetry);
|
|
1870
|
+
}
|
|
1871
|
+
};
|
|
1872
|
+
ReactPlugin.prototype.getCookieMgr = function () {
|
|
1873
|
+
return safeGetCookieMgr(this.core);
|
|
1874
|
+
};
|
|
1875
|
+
ReactPlugin.prototype.getAppInsights = function () {
|
|
1876
|
+
return this._analyticsPlugin;
|
|
1877
|
+
};
|
|
1878
|
+
ReactPlugin.prototype.processTelemetry = function (event, itemCtx) {
|
|
1879
|
+
this.processNext(event, itemCtx);
|
|
1880
|
+
};
|
|
1881
|
+
ReactPlugin.prototype.trackMetric = function (metric, customProperties) {
|
|
1882
|
+
if (this._analyticsPlugin) {
|
|
1883
|
+
this._analyticsPlugin.trackMetric(metric, customProperties);
|
|
1884
|
+
}
|
|
1885
|
+
else {
|
|
1886
|
+
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, React plugin telemetry will not be sent: ");
|
|
1887
|
+
}
|
|
1888
|
+
};
|
|
1889
|
+
ReactPlugin.prototype.trackPageView = function (pageView) {
|
|
1890
|
+
if (this._analyticsPlugin) {
|
|
1891
|
+
this._analyticsPlugin.trackPageView(pageView);
|
|
1892
|
+
}
|
|
1893
|
+
else {
|
|
1894
|
+
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, React plugin telemetry will not be sent: ");
|
|
1895
|
+
}
|
|
1896
|
+
};
|
|
1897
|
+
ReactPlugin.prototype.trackEvent = function (event, customProperties) {
|
|
1898
|
+
if (this._analyticsPlugin) {
|
|
1899
|
+
this._analyticsPlugin.trackEvent(event, customProperties);
|
|
1900
|
+
}
|
|
1901
|
+
else {
|
|
1902
|
+
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, React plugin telemetry will not be sent: ");
|
|
1903
|
+
}
|
|
1904
|
+
};
|
|
1905
|
+
ReactPlugin.prototype.trackException = function (exception, customProperties) {
|
|
1906
|
+
if (this._analyticsPlugin) {
|
|
1907
|
+
this._analyticsPlugin.trackException(exception, customProperties);
|
|
1908
|
+
}
|
|
1909
|
+
else {
|
|
1910
|
+
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, React plugin telemetry will not be sent: ");
|
|
1911
|
+
}
|
|
1912
|
+
};
|
|
1913
|
+
ReactPlugin.prototype.trackTrace = function (trace, customProperties) {
|
|
1914
|
+
if (this._analyticsPlugin) {
|
|
1915
|
+
this._analyticsPlugin.trackTrace(trace, customProperties);
|
|
1916
|
+
}
|
|
1917
|
+
else {
|
|
1918
|
+
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, React plugin telemetry will not be sent: ");
|
|
1919
|
+
}
|
|
1920
|
+
};
|
|
1921
|
+
ReactPlugin.prototype.addHistoryListener = function (history) {
|
|
1922
|
+
var _this = this;
|
|
1923
|
+
var locationListener = function (arg) {
|
|
1924
|
+
var locn = null;
|
|
1925
|
+
if ("location" in arg) {
|
|
1926
|
+
locn = arg["location"];
|
|
1927
|
+
}
|
|
1928
|
+
else {
|
|
1929
|
+
locn = arg;
|
|
1930
|
+
}
|
|
1931
|
+
setTimeout(function () {
|
|
1932
|
+
var pageViewTelemetry = { uri: locn.pathname };
|
|
1933
|
+
_this.trackPageView(pageViewTelemetry);
|
|
1934
|
+
}, 500);
|
|
1935
|
+
};
|
|
1936
|
+
history.listen(locationListener);
|
|
1937
|
+
};
|
|
2507
1938
|
return ReactPlugin;
|
|
2508
1939
|
}(BaseTelemetryPlugin));
|
|
2509
1940
|
var ReactPlugin$1 = ReactPlugin;
|
|
@@ -2650,7 +2081,7 @@
|
|
|
2650
2081
|
trackedData.idleCount * trackedData.idleTimeout) /
|
|
2651
2082
|
1000);
|
|
2652
2083
|
}
|
|
2653
|
-
var useComponentTracking = function (reactPlugin, componentName
|
|
2084
|
+
var useComponentTracking = function (reactPlugin, componentName) {
|
|
2654
2085
|
var tracking = React.useRef({
|
|
2655
2086
|
hookTimestamp: dateNow(),
|
|
2656
2087
|
firstActiveTimestamp: 0,
|
|
@@ -2689,7 +2120,7 @@
|
|
|
2689
2120
|
name: "React Component Engaged Time (seconds)",
|
|
2690
2121
|
sampleCount: 1
|
|
2691
2122
|
};
|
|
2692
|
-
var additionalProperties =
|
|
2123
|
+
var additionalProperties = { "Component Name": componentName };
|
|
2693
2124
|
reactPlugin.trackMetric(metricData, additionalProperties);
|
|
2694
2125
|
};
|
|
2695
2126
|
}, []);
|