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