@microsoft/applicationinsights-react-native 2.5.0-nightly.2202-06 → 2.5.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-native.js +898 -360
- package/browser/applicationinsights-react-native.js.map +1 -1
- package/browser/applicationinsights-react-native.min.js +2 -2
- package/browser/applicationinsights-react-native.min.js.map +1 -1
- package/dist/applicationinsights-react-native.api.json +20 -11
- package/dist/applicationinsights-react-native.d.ts +1 -1
- package/dist/applicationinsights-react-native.js +898 -360
- package/dist/applicationinsights-react-native.js.map +1 -1
- package/dist/applicationinsights-react-native.min.js +2 -2
- package/dist/applicationinsights-react-native.min.js.map +1 -1
- package/dist/applicationinsights-react-native.rollup.d.ts +1 -1
- package/dist-esm/Interfaces/INativeDevice.js +1 -1
- package/dist-esm/Interfaces/IReactNativePluginConfig.js +1 -1
- package/dist-esm/Interfaces/index.js +1 -1
- package/dist-esm/ReactNativePlugin.js +26 -8
- package/dist-esm/ReactNativePlugin.js.map +1 -1
- package/dist-esm/index.js +1 -1
- package/package.json +5 -5
- package/src/ReactNativePlugin.ts +35 -10
- package/types/tsdoc-metadata.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - React Native Plugin, 2.5.0-nightly.
|
|
2
|
+
* Application Insights JavaScript SDK - React Native Plugin, 2.5.0-nightly.2204-06
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -66,7 +66,9 @@
|
|
|
66
66
|
(getGlobal() || {})["Reflect"];
|
|
67
67
|
var extendStaticsFn = function (d, b) {
|
|
68
68
|
extendStaticsFn = ObjClass["setPrototypeOf"] ||
|
|
69
|
-
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
69
|
+
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
70
|
+
d.__proto__ = b;
|
|
71
|
+
}) ||
|
|
70
72
|
function (d, b) {
|
|
71
73
|
for (var p in b) {
|
|
72
74
|
if (b[strShimHasOwnProperty](p)) {
|
|
@@ -81,10 +83,249 @@
|
|
|
81
83
|
throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
82
84
|
}
|
|
83
85
|
extendStaticsFn(d, b);
|
|
84
|
-
function __() {
|
|
86
|
+
function __() {
|
|
87
|
+
this.constructor = d;
|
|
88
|
+
}
|
|
85
89
|
d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
|
|
86
90
|
}
|
|
87
91
|
|
|
92
|
+
var strEmpty = "";
|
|
93
|
+
var strSetNextPlugin = "setNextPlugin";
|
|
94
|
+
var strIsInitialized = "isInitialized";
|
|
95
|
+
var strTeardown = "teardown";
|
|
96
|
+
var strCore = "core";
|
|
97
|
+
var strUpdate = "update";
|
|
98
|
+
var strDisabled = "disabled";
|
|
99
|
+
var strDoTeardown = "_doTeardown";
|
|
100
|
+
|
|
101
|
+
var strToString = "toString";
|
|
102
|
+
var str__Proto$1 = "__proto__";
|
|
103
|
+
var strConstructor = "constructor";
|
|
104
|
+
var _objDefineProperty$1 = ObjDefineProperty;
|
|
105
|
+
var _objFreeze = ObjClass.freeze;
|
|
106
|
+
var _isArray = Array.isArray;
|
|
107
|
+
var _objToString = ObjProto[strToString];
|
|
108
|
+
var _fnToString = ObjHasOwnProperty[strToString];
|
|
109
|
+
var _objFunctionString = _fnToString.call(ObjClass);
|
|
110
|
+
var rCamelCase = /-([a-z])/g;
|
|
111
|
+
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
112
|
+
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
113
|
+
var _objGetPrototypeOf$1 = Object["getPrototypeOf"];
|
|
114
|
+
function _getObjProto$1(target) {
|
|
115
|
+
if (target) {
|
|
116
|
+
if (_objGetPrototypeOf$1) {
|
|
117
|
+
return _objGetPrototypeOf$1(target);
|
|
118
|
+
}
|
|
119
|
+
var newProto = target[str__Proto$1] || target[strShimPrototype] || target[strConstructor];
|
|
120
|
+
if (newProto) {
|
|
121
|
+
return newProto;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
function isUndefined(value) {
|
|
127
|
+
return value === undefined || typeof value === strShimUndefined;
|
|
128
|
+
}
|
|
129
|
+
function isNullOrUndefined(value) {
|
|
130
|
+
return (value === null || isUndefined(value));
|
|
131
|
+
}
|
|
132
|
+
function hasOwnProperty(obj, prop) {
|
|
133
|
+
return !!(obj && ObjHasOwnProperty.call(obj, prop));
|
|
134
|
+
}
|
|
135
|
+
function isObject(value) {
|
|
136
|
+
return !!(value && typeof value === strShimObject);
|
|
137
|
+
}
|
|
138
|
+
function isFunction(value) {
|
|
139
|
+
return !!(value && typeof value === strShimFunction);
|
|
140
|
+
}
|
|
141
|
+
function normalizeJsName(name) {
|
|
142
|
+
var value = name;
|
|
143
|
+
if (value && isString(value)) {
|
|
144
|
+
value = value.replace(rCamelCase, function (_all, letter) {
|
|
145
|
+
return letter.toUpperCase();
|
|
146
|
+
});
|
|
147
|
+
value = value.replace(rNormalizeInvalid, "_");
|
|
148
|
+
value = value.replace(rLeadingNumeric, function (_all, match) {
|
|
149
|
+
return "_" + match;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return value;
|
|
153
|
+
}
|
|
154
|
+
function objForEachKey$1(target, callbackfn) {
|
|
155
|
+
if (target) {
|
|
156
|
+
for (var prop in target) {
|
|
157
|
+
if (ObjHasOwnProperty.call(target, prop)) {
|
|
158
|
+
callbackfn.call(target, prop, target[prop]);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function strContains(value, search) {
|
|
164
|
+
if (value && search) {
|
|
165
|
+
return value.indexOf(search) !== -1;
|
|
166
|
+
}
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
var isArray = _isArray || _isArrayPoly;
|
|
170
|
+
function _isArrayPoly(obj) {
|
|
171
|
+
return !!(obj && _objToString.call(obj) === "[object Array]");
|
|
172
|
+
}
|
|
173
|
+
function isError(obj) {
|
|
174
|
+
return !!(obj && _objToString.call(obj) === "[object Error]");
|
|
175
|
+
}
|
|
176
|
+
function isString(value) {
|
|
177
|
+
return typeof value === "string";
|
|
178
|
+
}
|
|
179
|
+
function isBoolean(value) {
|
|
180
|
+
return typeof value === "boolean";
|
|
181
|
+
}
|
|
182
|
+
function isPlainObject(value) {
|
|
183
|
+
var result = false;
|
|
184
|
+
if (value && typeof value === "object") {
|
|
185
|
+
var proto = _objGetPrototypeOf$1 ? _objGetPrototypeOf$1(value) : _getObjProto$1(value);
|
|
186
|
+
if (!proto) {
|
|
187
|
+
result = true;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
|
|
191
|
+
proto = proto[strConstructor];
|
|
192
|
+
}
|
|
193
|
+
result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
function arrForEach(arr, callbackfn, thisArg) {
|
|
199
|
+
var len = arr.length;
|
|
200
|
+
try {
|
|
201
|
+
for (var idx = 0; idx < len; idx++) {
|
|
202
|
+
if (idx in arr) {
|
|
203
|
+
if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
catch (e) {
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
213
|
+
if (_objDefineProperty$1) {
|
|
214
|
+
try {
|
|
215
|
+
var descriptor = {
|
|
216
|
+
enumerable: true,
|
|
217
|
+
configurable: true
|
|
218
|
+
};
|
|
219
|
+
if (getProp) {
|
|
220
|
+
descriptor.get = getProp;
|
|
221
|
+
}
|
|
222
|
+
if (setProp) {
|
|
223
|
+
descriptor.set = setProp;
|
|
224
|
+
}
|
|
225
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
catch (e) {
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
function _doNothing(value) {
|
|
234
|
+
return value;
|
|
235
|
+
}
|
|
236
|
+
var objFreeze = _objFreeze || _doNothing;
|
|
237
|
+
function dateNow() {
|
|
238
|
+
var dt = Date;
|
|
239
|
+
return dt.now ? dt.now() : new dt().getTime();
|
|
240
|
+
}
|
|
241
|
+
function getExceptionName(object) {
|
|
242
|
+
if (isError(object)) {
|
|
243
|
+
return object.name;
|
|
244
|
+
}
|
|
245
|
+
return strEmpty;
|
|
246
|
+
}
|
|
247
|
+
function setValue(target, field, value, valChk, srcChk) {
|
|
248
|
+
var theValue = value;
|
|
249
|
+
if (target) {
|
|
250
|
+
theValue = target[field];
|
|
251
|
+
if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
|
|
252
|
+
theValue = value;
|
|
253
|
+
target[field] = theValue;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return theValue;
|
|
257
|
+
}
|
|
258
|
+
function _createProxyFunction(source, funcName) {
|
|
259
|
+
var srcFunc = null;
|
|
260
|
+
var src = null;
|
|
261
|
+
if (isFunction(source)) {
|
|
262
|
+
srcFunc = source;
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
src = source;
|
|
266
|
+
}
|
|
267
|
+
return function () {
|
|
268
|
+
var originalArguments = arguments;
|
|
269
|
+
if (srcFunc) {
|
|
270
|
+
src = srcFunc();
|
|
271
|
+
}
|
|
272
|
+
if (src) {
|
|
273
|
+
return src[funcName].apply(src, originalArguments);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
278
|
+
if (target && name && source) {
|
|
279
|
+
if (overwriteTarget !== false || isUndefined(target[name])) {
|
|
280
|
+
target[name] = _createProxyFunction(source, theFunc);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
285
|
+
var theArgs = arguments;
|
|
286
|
+
var extended = theArgs[0] || {};
|
|
287
|
+
var argLen = theArgs.length;
|
|
288
|
+
var deep = false;
|
|
289
|
+
var idx = 1;
|
|
290
|
+
if (argLen > 0 && isBoolean(extended)) {
|
|
291
|
+
deep = extended;
|
|
292
|
+
extended = theArgs[idx] || {};
|
|
293
|
+
idx++;
|
|
294
|
+
}
|
|
295
|
+
if (!isObject(extended)) {
|
|
296
|
+
extended = {};
|
|
297
|
+
}
|
|
298
|
+
for (; idx < argLen; idx++) {
|
|
299
|
+
var arg = theArgs[idx];
|
|
300
|
+
var isArgArray = isArray(arg);
|
|
301
|
+
var isArgObj = isObject(arg);
|
|
302
|
+
for (var prop in arg) {
|
|
303
|
+
var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
|
|
304
|
+
if (!propOk) {
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
var newValue = arg[prop];
|
|
308
|
+
var isNewArray = void 0;
|
|
309
|
+
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
310
|
+
var clone = extended[prop];
|
|
311
|
+
if (isNewArray) {
|
|
312
|
+
if (!isArray(clone)) {
|
|
313
|
+
clone = [];
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
else if (!isPlainObject(clone)) {
|
|
317
|
+
clone = {};
|
|
318
|
+
}
|
|
319
|
+
newValue = objExtend(deep, clone, newValue);
|
|
320
|
+
}
|
|
321
|
+
if (newValue !== undefined) {
|
|
322
|
+
extended[prop] = newValue;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return extended;
|
|
327
|
+
}
|
|
328
|
+
|
|
88
329
|
/*!
|
|
89
330
|
* Microsoft Dynamic Proto Utility, 1.1.4
|
|
90
331
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
@@ -326,184 +567,16 @@
|
|
|
326
567
|
};
|
|
327
568
|
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
328
569
|
|
|
329
|
-
var LoggingSeverity;
|
|
330
|
-
(function (LoggingSeverity) {
|
|
331
|
-
LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
|
|
332
|
-
LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
|
|
333
|
-
})(LoggingSeverity || (LoggingSeverity = {}));
|
|
334
|
-
var _InternalMessageId = {
|
|
335
|
-
BrowserDoesNotSupportLocalStorage: 0,
|
|
336
|
-
BrowserCannotReadLocalStorage: 1,
|
|
337
|
-
BrowserCannotReadSessionStorage: 2,
|
|
338
|
-
BrowserCannotWriteLocalStorage: 3,
|
|
339
|
-
BrowserCannotWriteSessionStorage: 4,
|
|
340
|
-
BrowserFailedRemovalFromLocalStorage: 5,
|
|
341
|
-
BrowserFailedRemovalFromSessionStorage: 6,
|
|
342
|
-
CannotSendEmptyTelemetry: 7,
|
|
343
|
-
ClientPerformanceMathError: 8,
|
|
344
|
-
ErrorParsingAISessionCookie: 9,
|
|
345
|
-
ErrorPVCalc: 10,
|
|
346
|
-
ExceptionWhileLoggingError: 11,
|
|
347
|
-
FailedAddingTelemetryToBuffer: 12,
|
|
348
|
-
FailedMonitorAjaxAbort: 13,
|
|
349
|
-
FailedMonitorAjaxDur: 14,
|
|
350
|
-
FailedMonitorAjaxOpen: 15,
|
|
351
|
-
FailedMonitorAjaxRSC: 16,
|
|
352
|
-
FailedMonitorAjaxSend: 17,
|
|
353
|
-
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
354
|
-
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
355
|
-
FailedToSendQueuedTelemetry: 20,
|
|
356
|
-
FailedToReportDataLoss: 21,
|
|
357
|
-
FlushFailed: 22,
|
|
358
|
-
MessageLimitPerPVExceeded: 23,
|
|
359
|
-
MissingRequiredFieldSpecification: 24,
|
|
360
|
-
NavigationTimingNotSupported: 25,
|
|
361
|
-
OnError: 26,
|
|
362
|
-
SessionRenewalDateIsZero: 27,
|
|
363
|
-
SenderNotInitialized: 28,
|
|
364
|
-
StartTrackEventFailed: 29,
|
|
365
|
-
StopTrackEventFailed: 30,
|
|
366
|
-
StartTrackFailed: 31,
|
|
367
|
-
StopTrackFailed: 32,
|
|
368
|
-
TelemetrySampledAndNotSent: 33,
|
|
369
|
-
TrackEventFailed: 34,
|
|
370
|
-
TrackExceptionFailed: 35,
|
|
371
|
-
TrackMetricFailed: 36,
|
|
372
|
-
TrackPVFailed: 37,
|
|
373
|
-
TrackPVFailedCalc: 38,
|
|
374
|
-
TrackTraceFailed: 39,
|
|
375
|
-
TransmissionFailed: 40,
|
|
376
|
-
FailedToSetStorageBuffer: 41,
|
|
377
|
-
FailedToRestoreStorageBuffer: 42,
|
|
378
|
-
InvalidBackendResponse: 43,
|
|
379
|
-
FailedToFixDepricatedValues: 44,
|
|
380
|
-
InvalidDurationValue: 45,
|
|
381
|
-
TelemetryEnvelopeInvalid: 46,
|
|
382
|
-
CreateEnvelopeError: 47,
|
|
383
|
-
CannotSerializeObject: 48,
|
|
384
|
-
CannotSerializeObjectNonSerializable: 49,
|
|
385
|
-
CircularReferenceDetected: 50,
|
|
386
|
-
ClearAuthContextFailed: 51,
|
|
387
|
-
ExceptionTruncated: 52,
|
|
388
|
-
IllegalCharsInName: 53,
|
|
389
|
-
ItemNotInArray: 54,
|
|
390
|
-
MaxAjaxPerPVExceeded: 55,
|
|
391
|
-
MessageTruncated: 56,
|
|
392
|
-
NameTooLong: 57,
|
|
393
|
-
SampleRateOutOfRange: 58,
|
|
394
|
-
SetAuthContextFailed: 59,
|
|
395
|
-
SetAuthContextFailedAccountName: 60,
|
|
396
|
-
StringValueTooLong: 61,
|
|
397
|
-
StartCalledMoreThanOnce: 62,
|
|
398
|
-
StopCalledWithoutStart: 63,
|
|
399
|
-
TelemetryInitializerFailed: 64,
|
|
400
|
-
TrackArgumentsNotSpecified: 65,
|
|
401
|
-
UrlTooLong: 66,
|
|
402
|
-
SessionStorageBufferFull: 67,
|
|
403
|
-
CannotAccessCookie: 68,
|
|
404
|
-
IdTooLong: 69,
|
|
405
|
-
InvalidEvent: 70,
|
|
406
|
-
FailedMonitorAjaxSetRequestHeader: 71,
|
|
407
|
-
SendBrowserInfoOnUserInit: 72,
|
|
408
|
-
PluginException: 73,
|
|
409
|
-
NotificationException: 74,
|
|
410
|
-
SnippetScriptLoadFailure: 99,
|
|
411
|
-
InvalidInstrumentationKey: 100,
|
|
412
|
-
CannotParseAiBlobValue: 101,
|
|
413
|
-
InvalidContentBlob: 102,
|
|
414
|
-
TrackPageActionEventFailed: 103,
|
|
415
|
-
FailedAddingCustomDefinedRequestContext: 104,
|
|
416
|
-
InMemoryStorageBufferFull: 105
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
var strToString = "toString";
|
|
420
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
421
|
-
var _isArray = Array.isArray;
|
|
422
|
-
var _objToString = ObjProto[strToString];
|
|
423
|
-
var _fnToString = ObjHasOwnProperty[strToString];
|
|
424
|
-
_fnToString.call(ObjClass);
|
|
425
|
-
function isUndefined(value) {
|
|
426
|
-
return value === undefined || typeof value === strShimUndefined;
|
|
427
|
-
}
|
|
428
|
-
function isNullOrUndefined(value) {
|
|
429
|
-
return (value === null || isUndefined(value));
|
|
430
|
-
}
|
|
431
|
-
function hasOwnProperty(obj, prop) {
|
|
432
|
-
return !!(obj && ObjHasOwnProperty.call(obj, prop));
|
|
433
|
-
}
|
|
434
|
-
function isObject(value) {
|
|
435
|
-
return !!(value && typeof value === strShimObject);
|
|
436
|
-
}
|
|
437
|
-
function isFunction(value) {
|
|
438
|
-
return !!(value && typeof value === strShimFunction);
|
|
439
|
-
}
|
|
440
|
-
var isArray = _isArray || _isArrayPoly;
|
|
441
|
-
function _isArrayPoly(obj) {
|
|
442
|
-
return !!(obj && _objToString.call(obj) === "[object Array]");
|
|
443
|
-
}
|
|
444
|
-
function isError(obj) {
|
|
445
|
-
return !!(obj && _objToString.call(obj) === "[object Error]");
|
|
446
|
-
}
|
|
447
|
-
function arrForEach(arr, callbackfn, thisArg) {
|
|
448
|
-
var len = arr.length;
|
|
449
|
-
try {
|
|
450
|
-
for (var idx = 0; idx < len; idx++) {
|
|
451
|
-
if (idx in arr) {
|
|
452
|
-
if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
|
|
453
|
-
break;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
catch (e) {
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
462
|
-
if (_objDefineProperty) {
|
|
463
|
-
try {
|
|
464
|
-
var descriptor = {
|
|
465
|
-
enumerable: true,
|
|
466
|
-
configurable: true
|
|
467
|
-
};
|
|
468
|
-
if (getProp) {
|
|
469
|
-
descriptor.get = getProp;
|
|
470
|
-
}
|
|
471
|
-
if (setProp) {
|
|
472
|
-
descriptor.set = setProp;
|
|
473
|
-
}
|
|
474
|
-
_objDefineProperty(target, prop, descriptor);
|
|
475
|
-
return true;
|
|
476
|
-
}
|
|
477
|
-
catch (e) {
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
return false;
|
|
481
|
-
}
|
|
482
|
-
function dateNow() {
|
|
483
|
-
var dt = Date;
|
|
484
|
-
return dt.now ? dt.now() : new dt().getTime();
|
|
485
|
-
}
|
|
486
|
-
function getExceptionName(object) {
|
|
487
|
-
if (isError(object)) {
|
|
488
|
-
return object.name;
|
|
489
|
-
}
|
|
490
|
-
return "";
|
|
491
|
-
}
|
|
492
|
-
function setValue(target, field, value, valChk, srcChk) {
|
|
493
|
-
var theValue = value;
|
|
494
|
-
if (target) {
|
|
495
|
-
theValue = target[field];
|
|
496
|
-
if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
|
|
497
|
-
theValue = value;
|
|
498
|
-
target[field] = theValue;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
return theValue;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
570
|
var strWindow = "window";
|
|
571
|
+
var strNavigator = "navigator";
|
|
505
572
|
var strConsole = "console";
|
|
506
573
|
var strJSON = "JSON";
|
|
574
|
+
var strCrypto = "crypto";
|
|
575
|
+
var strMsCrypto = "msCrypto";
|
|
576
|
+
var strMsie = "msie";
|
|
577
|
+
var strTrident = "trident/";
|
|
578
|
+
var _isTrident = null;
|
|
579
|
+
var _navUserAgentCheck = null;
|
|
507
580
|
function getGlobalInst(name) {
|
|
508
581
|
var gbl = getGlobal();
|
|
509
582
|
if (gbl && gbl[name]) {
|
|
@@ -517,6 +590,15 @@
|
|
|
517
590
|
function hasWindow() {
|
|
518
591
|
return Boolean(typeof window === strShimObject && window);
|
|
519
592
|
}
|
|
593
|
+
function hasNavigator() {
|
|
594
|
+
return Boolean(typeof navigator === strShimObject && navigator);
|
|
595
|
+
}
|
|
596
|
+
function getNavigator() {
|
|
597
|
+
if (hasNavigator()) {
|
|
598
|
+
return navigator;
|
|
599
|
+
}
|
|
600
|
+
return getGlobalInst(strNavigator);
|
|
601
|
+
}
|
|
520
602
|
function getConsole() {
|
|
521
603
|
if (typeof console !== strShimUndefined) {
|
|
522
604
|
return console;
|
|
@@ -532,9 +614,24 @@
|
|
|
532
614
|
}
|
|
533
615
|
return null;
|
|
534
616
|
}
|
|
617
|
+
function getCrypto() {
|
|
618
|
+
return getGlobalInst(strCrypto);
|
|
619
|
+
}
|
|
620
|
+
function getMsCrypto() {
|
|
621
|
+
return getGlobalInst(strMsCrypto);
|
|
622
|
+
}
|
|
623
|
+
function isIE() {
|
|
624
|
+
var nav = getNavigator();
|
|
625
|
+
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
626
|
+
_navUserAgentCheck = nav.userAgent;
|
|
627
|
+
var userAgent = (_navUserAgentCheck || strEmpty).toLowerCase();
|
|
628
|
+
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
629
|
+
}
|
|
630
|
+
return _isTrident;
|
|
631
|
+
}
|
|
535
632
|
function dumpObj(object) {
|
|
536
633
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
537
|
-
var propertyValueDump =
|
|
634
|
+
var propertyValueDump = strEmpty;
|
|
538
635
|
if (objectTypeDump === "[object Error]") {
|
|
539
636
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
540
637
|
}
|
|
@@ -567,9 +664,9 @@
|
|
|
567
664
|
var strWarnToConsole = "warnToConsole";
|
|
568
665
|
function _sanitizeDiagnosticText(text) {
|
|
569
666
|
if (text) {
|
|
570
|
-
return "\"" + text.replace(/\"/g,
|
|
667
|
+
return "\"" + text.replace(/\"/g, strEmpty) + "\"";
|
|
571
668
|
}
|
|
572
|
-
return
|
|
669
|
+
return strEmpty;
|
|
573
670
|
}
|
|
574
671
|
function _logToConsole(func, message) {
|
|
575
672
|
var theConsole = getConsole();
|
|
@@ -591,12 +688,12 @@
|
|
|
591
688
|
_self.message =
|
|
592
689
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
593
690
|
msgId;
|
|
594
|
-
var strProps =
|
|
691
|
+
var strProps = strEmpty;
|
|
595
692
|
if (hasJSON()) {
|
|
596
693
|
strProps = getJSON().stringify(properties);
|
|
597
694
|
}
|
|
598
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
599
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
695
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty) +
|
|
696
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty);
|
|
600
697
|
_self.message += diagnosticText;
|
|
601
698
|
}
|
|
602
699
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -626,7 +723,7 @@
|
|
|
626
723
|
throw message;
|
|
627
724
|
}
|
|
628
725
|
else {
|
|
629
|
-
var logFunc = severity ===
|
|
726
|
+
var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
|
|
630
727
|
if (!isUndefined(message.message)) {
|
|
631
728
|
var logLevel = _self.consoleLoggingLevel();
|
|
632
729
|
if (isUserAct) {
|
|
@@ -644,7 +741,7 @@
|
|
|
644
741
|
_self.logInternalMessage(severity, message);
|
|
645
742
|
}
|
|
646
743
|
else {
|
|
647
|
-
_debugExtMsg("throw" + (severity ===
|
|
744
|
+
_debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
|
|
648
745
|
}
|
|
649
746
|
}
|
|
650
747
|
};
|
|
@@ -676,13 +773,13 @@
|
|
|
676
773
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
677
774
|
_self.queue.push(message);
|
|
678
775
|
_messageCount++;
|
|
679
|
-
_debugExtMsg((severity ===
|
|
776
|
+
_debugExtMsg((severity === 1 ? "error" : "warn"), message);
|
|
680
777
|
}
|
|
681
778
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
682
779
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
683
|
-
var throttleMessage = new _InternalLogMessage(
|
|
780
|
+
var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
|
|
684
781
|
_self.queue.push(throttleMessage);
|
|
685
|
-
if (severity ===
|
|
782
|
+
if (severity === 1 ) {
|
|
686
783
|
_self.errorToConsole(throttleLimitMessage);
|
|
687
784
|
}
|
|
688
785
|
else {
|
|
@@ -711,6 +808,16 @@
|
|
|
711
808
|
}
|
|
712
809
|
return DiagnosticLogger;
|
|
713
810
|
}());
|
|
811
|
+
function _getLogger(logger) {
|
|
812
|
+
return (logger || new DiagnosticLogger());
|
|
813
|
+
}
|
|
814
|
+
function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
|
|
815
|
+
if (isUserAct === void 0) { isUserAct = false; }
|
|
816
|
+
(logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
|
|
817
|
+
}
|
|
818
|
+
function _warnToConsole(logger, message) {
|
|
819
|
+
_getLogger(logger).warnToConsole(message);
|
|
820
|
+
}
|
|
714
821
|
|
|
715
822
|
var strExecutionContextKey = "ctx";
|
|
716
823
|
var PerfEvent = /** @class */ (function () {
|
|
@@ -824,207 +931,616 @@
|
|
|
824
931
|
return func();
|
|
825
932
|
}
|
|
826
933
|
|
|
827
|
-
var
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
934
|
+
var UInt32Mask = 0x100000000;
|
|
935
|
+
var MaxUInt32 = 0xffffffff;
|
|
936
|
+
var _mwcSeeded = false;
|
|
937
|
+
var _mwcW = 123456789;
|
|
938
|
+
var _mwcZ = 987654321;
|
|
939
|
+
function _mwcSeed(seedValue) {
|
|
940
|
+
if (seedValue < 0) {
|
|
941
|
+
seedValue >>>= 0;
|
|
942
|
+
}
|
|
943
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
944
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
945
|
+
_mwcSeeded = true;
|
|
946
|
+
}
|
|
947
|
+
function _autoSeedMwc() {
|
|
948
|
+
try {
|
|
949
|
+
var now = dateNow() & 0x7fffffff;
|
|
950
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
951
|
+
}
|
|
952
|
+
catch (e) {
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
function random32(signed) {
|
|
956
|
+
var value = 0;
|
|
957
|
+
var c = getCrypto() || getMsCrypto();
|
|
958
|
+
if (c && c.getRandomValues) {
|
|
959
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
960
|
+
}
|
|
961
|
+
if (value === 0 && isIE()) {
|
|
962
|
+
if (!_mwcSeeded) {
|
|
963
|
+
_autoSeedMwc();
|
|
964
|
+
}
|
|
965
|
+
value = mwcRandom32() & MaxUInt32;
|
|
966
|
+
}
|
|
967
|
+
if (value === 0) {
|
|
968
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
969
|
+
}
|
|
970
|
+
if (!signed) {
|
|
971
|
+
value >>>= 0;
|
|
972
|
+
}
|
|
973
|
+
return value;
|
|
974
|
+
}
|
|
975
|
+
function mwcRandom32(signed) {
|
|
976
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
977
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
978
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
979
|
+
if (!signed) {
|
|
980
|
+
value >>>= 0;
|
|
981
|
+
}
|
|
982
|
+
return value;
|
|
983
|
+
}
|
|
984
|
+
function newId(maxLength) {
|
|
985
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
986
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
987
|
+
var number = random32() >>> 0;
|
|
988
|
+
var chars = 0;
|
|
989
|
+
var result = strEmpty;
|
|
990
|
+
while (result.length < maxLength) {
|
|
991
|
+
chars++;
|
|
992
|
+
result += base64chars.charAt(number & 0x3F);
|
|
993
|
+
number >>>= 6;
|
|
994
|
+
if (chars === 5) {
|
|
995
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
996
|
+
chars = 0;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
return result;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
1003
|
+
var version = "2.8.0-nightly.2204-06";
|
|
1004
|
+
var instanceName = "." + newId(6);
|
|
1005
|
+
var _dataUid = 0;
|
|
1006
|
+
function _createAccessor(target, prop, value) {
|
|
1007
|
+
if (_objDefineProperty) {
|
|
1008
|
+
try {
|
|
1009
|
+
_objDefineProperty(target, prop, {
|
|
1010
|
+
value: value,
|
|
1011
|
+
enumerable: false,
|
|
1012
|
+
configurable: true
|
|
1013
|
+
});
|
|
1014
|
+
return true;
|
|
1015
|
+
}
|
|
1016
|
+
catch (e) {
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
return false;
|
|
1020
|
+
}
|
|
1021
|
+
function _canAcceptData(target) {
|
|
1022
|
+
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1023
|
+
}
|
|
1024
|
+
function _getCache(data, target) {
|
|
1025
|
+
var theCache = target[data.id];
|
|
1026
|
+
if (!theCache) {
|
|
1027
|
+
theCache = {};
|
|
1028
|
+
try {
|
|
1029
|
+
if (_canAcceptData(target)) {
|
|
1030
|
+
if (!_createAccessor(target, data.id, theCache)) {
|
|
1031
|
+
target[data.id] = theCache;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
catch (e) {
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
return theCache;
|
|
1039
|
+
}
|
|
1040
|
+
function createUniqueNamespace(name, includeVersion) {
|
|
1041
|
+
if (includeVersion === void 0) { includeVersion = false; }
|
|
1042
|
+
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1043
|
+
}
|
|
1044
|
+
function createElmNodeData(name) {
|
|
1045
|
+
var data = {
|
|
1046
|
+
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1047
|
+
accept: function (target) {
|
|
1048
|
+
return _canAcceptData(target);
|
|
1049
|
+
},
|
|
1050
|
+
get: function (target, name, defValue, addDefault) {
|
|
1051
|
+
var theCache = target[data.id];
|
|
1052
|
+
if (!theCache) {
|
|
1053
|
+
if (addDefault) {
|
|
1054
|
+
theCache = _getCache(data, target);
|
|
1055
|
+
theCache[normalizeJsName(name)] = defValue;
|
|
1056
|
+
}
|
|
1057
|
+
return defValue;
|
|
846
1058
|
}
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
1059
|
+
return theCache[normalizeJsName(name)];
|
|
1060
|
+
},
|
|
1061
|
+
kill: function (target, name) {
|
|
1062
|
+
if (target && target[name]) {
|
|
1063
|
+
try {
|
|
1064
|
+
delete target[name];
|
|
1065
|
+
}
|
|
1066
|
+
catch (e) {
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
};
|
|
1071
|
+
return data;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1075
|
+
function _getPluginState(plugin) {
|
|
1076
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1080
|
+
var strHasRunFlags = "_hasRun";
|
|
1081
|
+
var strGetTelCtx = "_getTelCtx";
|
|
1082
|
+
var _chainId = 0;
|
|
1083
|
+
function _getNextProxyStart(proxy, config, core, startAt) {
|
|
1084
|
+
while (proxy) {
|
|
1085
|
+
if (proxy.getPlugin() === startAt) {
|
|
1086
|
+
return proxy;
|
|
1087
|
+
}
|
|
1088
|
+
proxy = proxy.getNext();
|
|
1089
|
+
}
|
|
1090
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1091
|
+
}
|
|
1092
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1093
|
+
var _nextProxy = null;
|
|
1094
|
+
var _onComplete = [];
|
|
1095
|
+
if (startAt !== null) {
|
|
1096
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1097
|
+
}
|
|
1098
|
+
var context = {
|
|
1099
|
+
_next: _moveNext,
|
|
1100
|
+
ctx: {
|
|
1101
|
+
core: function () {
|
|
1102
|
+
return core;
|
|
1103
|
+
},
|
|
1104
|
+
diagLog: function () {
|
|
1105
|
+
return safeGetLogger(core, config);
|
|
1106
|
+
},
|
|
1107
|
+
getCfg: function () {
|
|
1108
|
+
return config;
|
|
1109
|
+
},
|
|
1110
|
+
getExtCfg: _getExtCfg,
|
|
1111
|
+
getConfig: _getConfig,
|
|
1112
|
+
hasNext: function () {
|
|
1113
|
+
return !!_nextProxy;
|
|
1114
|
+
},
|
|
1115
|
+
getNext: function () {
|
|
1116
|
+
return _nextProxy;
|
|
1117
|
+
},
|
|
1118
|
+
setNext: function (nextPlugin) {
|
|
1119
|
+
_nextProxy = nextPlugin;
|
|
1120
|
+
},
|
|
1121
|
+
iterate: _iterateChain,
|
|
1122
|
+
onComplete: _addOnComplete
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
function _addOnComplete(onComplete, that) {
|
|
1126
|
+
var args = [];
|
|
1127
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1128
|
+
args[_i - 2] = arguments[_i];
|
|
1129
|
+
}
|
|
1130
|
+
if (onComplete) {
|
|
1131
|
+
_onComplete.push({
|
|
1132
|
+
func: onComplete,
|
|
1133
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1134
|
+
args: args
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
function _moveNext() {
|
|
1139
|
+
var nextProxy = _nextProxy;
|
|
1140
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1141
|
+
if (!nextProxy) {
|
|
1142
|
+
var onComplete = _onComplete;
|
|
1143
|
+
if (onComplete && onComplete.length > 0) {
|
|
1144
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
851
1145
|
try {
|
|
852
|
-
|
|
853
|
-
if (_hasSetNext) {
|
|
854
|
-
plugin.setNextPlugin(_nextProxy);
|
|
855
|
-
}
|
|
856
|
-
_nextProxy && (_nextProxy._hasRun = false);
|
|
857
|
-
plugin.processTelemetry(env, itemCtx);
|
|
1146
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
858
1147
|
}
|
|
859
|
-
catch (
|
|
860
|
-
|
|
861
|
-
if (!_nextProxy || !hasRun) {
|
|
862
|
-
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
|
|
863
|
-
}
|
|
864
|
-
if (_nextProxy && !hasRun) {
|
|
865
|
-
_nextProxy.processTelemetry(env, itemCtx);
|
|
866
|
-
}
|
|
1148
|
+
catch (e) {
|
|
1149
|
+
_throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
867
1150
|
}
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
}, function () { return ({ item: env }); }, !(env.sync));
|
|
874
|
-
};
|
|
1151
|
+
});
|
|
1152
|
+
_onComplete = [];
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
return nextProxy;
|
|
875
1156
|
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
1157
|
+
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1158
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1159
|
+
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
1160
|
+
var theConfig;
|
|
1161
|
+
if (config) {
|
|
1162
|
+
var extConfig = config.extensionConfig;
|
|
1163
|
+
if (extConfig && identifier) {
|
|
1164
|
+
theConfig = extConfig[identifier];
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
if (!theConfig) {
|
|
1168
|
+
theConfig = defaultValue;
|
|
1169
|
+
}
|
|
1170
|
+
else if (isObject(defaultValue)) {
|
|
1171
|
+
if (mergeDefault !== 0 ) {
|
|
1172
|
+
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1173
|
+
if (config && mergeDefault === 2 ) {
|
|
1174
|
+
objForEachKey$1(defaultValue, function (field) {
|
|
1175
|
+
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1176
|
+
var cfgValue = config[field];
|
|
1177
|
+
if (!isNullOrUndefined(cfgValue)) {
|
|
1178
|
+
newConfig_1[field] = cfgValue;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
890
1182
|
}
|
|
891
|
-
lastProxy = newProxy;
|
|
892
1183
|
}
|
|
893
1184
|
}
|
|
1185
|
+
return theConfig;
|
|
894
1186
|
}
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
1187
|
+
function _getConfig(identifier, field, defaultValue) {
|
|
1188
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
1189
|
+
var theValue;
|
|
1190
|
+
var extConfig = _getExtCfg(identifier, null);
|
|
1191
|
+
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1192
|
+
theValue = extConfig[field];
|
|
1193
|
+
}
|
|
1194
|
+
else if (config && !isNullOrUndefined(config[field])) {
|
|
1195
|
+
theValue = config[field];
|
|
1196
|
+
}
|
|
1197
|
+
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1198
|
+
}
|
|
1199
|
+
function _iterateChain(cb) {
|
|
1200
|
+
var nextPlugin;
|
|
1201
|
+
while (!!(nextPlugin = context._next())) {
|
|
1202
|
+
var plugin = nextPlugin.getPlugin();
|
|
1203
|
+
if (plugin) {
|
|
1204
|
+
cb(plugin);
|
|
906
1205
|
}
|
|
907
|
-
proxy = proxy.getNext();
|
|
908
1206
|
}
|
|
909
1207
|
}
|
|
910
|
-
|
|
911
|
-
|
|
1208
|
+
return context;
|
|
1209
|
+
}
|
|
1210
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1211
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1212
|
+
var context = internalContext.ctx;
|
|
1213
|
+
function _processNext(env) {
|
|
1214
|
+
var nextPlugin = internalContext._next();
|
|
1215
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1216
|
+
return !nextPlugin;
|
|
1217
|
+
}
|
|
1218
|
+
function _createNew(plugins, startAt) {
|
|
1219
|
+
if (plugins === void 0) { plugins = null; }
|
|
1220
|
+
if (isArray(plugins)) {
|
|
1221
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1222
|
+
}
|
|
1223
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
912
1224
|
}
|
|
913
|
-
|
|
1225
|
+
context.processNext = _processNext;
|
|
1226
|
+
context.createNew = _createNew;
|
|
1227
|
+
return context;
|
|
914
1228
|
}
|
|
915
|
-
function
|
|
916
|
-
var
|
|
917
|
-
var
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
1229
|
+
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1230
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1231
|
+
var context = internalContext.ctx;
|
|
1232
|
+
function _processNext(unloadState) {
|
|
1233
|
+
var nextPlugin = internalContext._next();
|
|
1234
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1235
|
+
return !nextPlugin;
|
|
1236
|
+
}
|
|
1237
|
+
function _createNew(plugins, startAt) {
|
|
1238
|
+
if (plugins === void 0) { plugins = null; }
|
|
1239
|
+
if (isArray(plugins)) {
|
|
1240
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1241
|
+
}
|
|
1242
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1243
|
+
}
|
|
1244
|
+
context.processNext = _processNext;
|
|
1245
|
+
context.createNew = _createNew;
|
|
1246
|
+
return context;
|
|
1247
|
+
}
|
|
1248
|
+
function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
|
|
1249
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1250
|
+
var context = internalContext.ctx;
|
|
1251
|
+
function _processNext(updateState) {
|
|
1252
|
+
return context.iterate(function (plugin) {
|
|
1253
|
+
if (isFunction(plugin[strUpdate])) {
|
|
1254
|
+
plugin[strUpdate](context, updateState);
|
|
924
1255
|
}
|
|
925
1256
|
});
|
|
926
1257
|
}
|
|
927
|
-
|
|
928
|
-
if (
|
|
929
|
-
|
|
1258
|
+
function _createNew(plugins, startAt) {
|
|
1259
|
+
if (plugins === void 0) { plugins = null; }
|
|
1260
|
+
if (isArray(plugins)) {
|
|
1261
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
930
1262
|
}
|
|
931
|
-
plugins.
|
|
1263
|
+
return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
|
|
932
1264
|
}
|
|
933
|
-
|
|
1265
|
+
context.processNext = _processNext;
|
|
1266
|
+
context.createNew = _createNew;
|
|
1267
|
+
return context;
|
|
934
1268
|
}
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1269
|
+
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
1270
|
+
var firstProxy = null;
|
|
1271
|
+
var add = startAt ? false : true;
|
|
1272
|
+
if (isArray(plugins) && plugins.length > 0) {
|
|
1273
|
+
var lastProxy_1 = null;
|
|
1274
|
+
arrForEach(plugins, function (thePlugin) {
|
|
1275
|
+
if (!add && startAt === thePlugin) {
|
|
1276
|
+
add = true;
|
|
942
1277
|
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1278
|
+
if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1279
|
+
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
1280
|
+
if (!firstProxy) {
|
|
1281
|
+
firstProxy = newProxy;
|
|
946
1282
|
}
|
|
947
|
-
|
|
948
|
-
|
|
1283
|
+
if (lastProxy_1) {
|
|
1284
|
+
lastProxy_1._setNext(newProxy);
|
|
949
1285
|
}
|
|
1286
|
+
lastProxy_1 = newProxy;
|
|
950
1287
|
}
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
if (startAt && !firstProxy) {
|
|
1291
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1292
|
+
}
|
|
1293
|
+
return firstProxy;
|
|
1294
|
+
}
|
|
1295
|
+
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1296
|
+
var nextProxy = null;
|
|
1297
|
+
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1298
|
+
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1299
|
+
var chainId;
|
|
1300
|
+
if (plugin) {
|
|
1301
|
+
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1302
|
+
}
|
|
1303
|
+
else {
|
|
1304
|
+
chainId = "Unknown-0-" + _chainId++;
|
|
1305
|
+
}
|
|
1306
|
+
var proxyChain = {
|
|
1307
|
+
getPlugin: function () {
|
|
1308
|
+
return plugin;
|
|
1309
|
+
},
|
|
1310
|
+
getNext: function () {
|
|
1311
|
+
return nextProxy;
|
|
1312
|
+
},
|
|
1313
|
+
processTelemetry: _processTelemetry,
|
|
1314
|
+
unload: _unloadPlugin,
|
|
1315
|
+
update: _updatePlugin,
|
|
1316
|
+
_id: chainId,
|
|
1317
|
+
_setNext: function (nextPlugin) {
|
|
1318
|
+
nextProxy = nextPlugin;
|
|
951
1319
|
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1320
|
+
};
|
|
1321
|
+
function _getTelCtx() {
|
|
1322
|
+
var itemCtx;
|
|
1323
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1324
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1325
|
+
}
|
|
1326
|
+
if (!itemCtx) {
|
|
1327
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1328
|
+
}
|
|
1329
|
+
return itemCtx;
|
|
1330
|
+
}
|
|
1331
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1332
|
+
var hasRun = false;
|
|
1333
|
+
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1334
|
+
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1335
|
+
if (!hasRunContext) {
|
|
1336
|
+
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1337
|
+
}
|
|
1338
|
+
itemCtx.setNext(nextProxy);
|
|
1339
|
+
if (plugin) {
|
|
1340
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1341
|
+
hasRunContext[chainId] = true;
|
|
1342
|
+
try {
|
|
1343
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty;
|
|
1344
|
+
if (nextId) {
|
|
1345
|
+
hasRunContext[nextId] = false;
|
|
1346
|
+
}
|
|
1347
|
+
hasRun = processPluginFn(itemCtx);
|
|
1348
|
+
}
|
|
1349
|
+
catch (error) {
|
|
1350
|
+
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1351
|
+
if (hasNextRun) {
|
|
1352
|
+
hasRun = true;
|
|
1353
|
+
}
|
|
1354
|
+
if (!nextProxy || !hasNextRun) {
|
|
1355
|
+
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1356
|
+
}
|
|
968
1357
|
}
|
|
1358
|
+
}, details, isAsync);
|
|
1359
|
+
}
|
|
1360
|
+
return hasRun;
|
|
1361
|
+
}
|
|
1362
|
+
function _processTelemetry(env, itemCtx) {
|
|
1363
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
1364
|
+
function _callProcessTelemetry(itemCtx) {
|
|
1365
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
1366
|
+
return false;
|
|
969
1367
|
}
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
if (defaultValue === void 0) { defaultValue = false; }
|
|
974
|
-
var theValue;
|
|
975
|
-
var extConfig = _self.getExtCfg(identifier, null);
|
|
976
|
-
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
977
|
-
theValue = extConfig[field];
|
|
1368
|
+
var pluginState = _getPluginState(plugin);
|
|
1369
|
+
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
1370
|
+
return false;
|
|
978
1371
|
}
|
|
979
|
-
|
|
980
|
-
|
|
1372
|
+
if (hasSetNext) {
|
|
1373
|
+
plugin.setNextPlugin(nextProxy);
|
|
981
1374
|
}
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1375
|
+
plugin.processTelemetry(env, itemCtx);
|
|
1376
|
+
return true;
|
|
1377
|
+
}
|
|
1378
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1379
|
+
itemCtx.processNext(env);
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1383
|
+
function _callTeardown() {
|
|
1384
|
+
var hasRun = false;
|
|
1385
|
+
if (plugin) {
|
|
1386
|
+
var pluginState = _getPluginState(plugin);
|
|
1387
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1388
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1389
|
+
pluginState[strCore] = null;
|
|
1390
|
+
pluginState[strTeardown] = true;
|
|
1391
|
+
pluginState[strIsInitialized] = false;
|
|
1392
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1393
|
+
hasRun = true;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
998
1396
|
}
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
}
|
|
1397
|
+
return hasRun;
|
|
1398
|
+
}
|
|
1399
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1400
|
+
unloadCtx.processNext(unloadState);
|
|
1401
|
+
}
|
|
1004
1402
|
}
|
|
1005
|
-
|
|
1006
|
-
|
|
1403
|
+
function _updatePlugin(updateCtx, updateState) {
|
|
1404
|
+
function _callUpdate() {
|
|
1405
|
+
var hasRun = false;
|
|
1406
|
+
if (plugin) {
|
|
1407
|
+
var pluginState = _getPluginState(plugin);
|
|
1408
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1409
|
+
if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1410
|
+
if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
|
|
1411
|
+
hasRun = true;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
return hasRun;
|
|
1416
|
+
}
|
|
1417
|
+
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
1418
|
+
updateCtx.processNext(updateState);
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
return objFreeze(proxyChain);
|
|
1422
|
+
}
|
|
1007
1423
|
|
|
1008
1424
|
var strExtensionConfig = "extensionConfig";
|
|
1009
1425
|
|
|
1426
|
+
function createUnloadHandlerContainer() {
|
|
1427
|
+
var handlers = [];
|
|
1428
|
+
function _addHandler(handler) {
|
|
1429
|
+
if (handler) {
|
|
1430
|
+
handlers.push(handler);
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
1434
|
+
arrForEach(handlers, function (handler) {
|
|
1435
|
+
try {
|
|
1436
|
+
handler(unloadCtx, unloadState);
|
|
1437
|
+
}
|
|
1438
|
+
catch (e) {
|
|
1439
|
+
_throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
1440
|
+
}
|
|
1441
|
+
});
|
|
1442
|
+
handlers = [];
|
|
1443
|
+
}
|
|
1444
|
+
return {
|
|
1445
|
+
add: _addHandler,
|
|
1446
|
+
run: _runHandlers
|
|
1447
|
+
};
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1010
1450
|
var strGetPlugin = "getPlugin";
|
|
1011
1451
|
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
1012
1452
|
function BaseTelemetryPlugin() {
|
|
1013
1453
|
var _self = this;
|
|
1014
|
-
var _isinitialized
|
|
1015
|
-
var _rootCtx
|
|
1016
|
-
var _nextPlugin
|
|
1017
|
-
|
|
1454
|
+
var _isinitialized;
|
|
1455
|
+
var _rootCtx;
|
|
1456
|
+
var _nextPlugin;
|
|
1457
|
+
var _unloadHandlerContainer;
|
|
1458
|
+
var _hooks;
|
|
1459
|
+
_initDefaults();
|
|
1460
|
+
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
1461
|
+
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
1462
|
+
_setDefaults(config, core, pluginChain);
|
|
1463
|
+
_isinitialized = true;
|
|
1464
|
+
};
|
|
1465
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
1466
|
+
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
1467
|
+
return;
|
|
1468
|
+
}
|
|
1469
|
+
var result;
|
|
1470
|
+
var unloadDone = false;
|
|
1471
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1472
|
+
var theUnloadState = unloadState || {
|
|
1473
|
+
reason: 0 ,
|
|
1474
|
+
isAsync: false
|
|
1475
|
+
};
|
|
1476
|
+
function _unloadCallback() {
|
|
1477
|
+
if (!unloadDone) {
|
|
1478
|
+
unloadDone = true;
|
|
1479
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
1480
|
+
arrForEach(_hooks, function (fn) {
|
|
1481
|
+
fn.rm();
|
|
1482
|
+
});
|
|
1483
|
+
_hooks = [];
|
|
1484
|
+
if (result === true) {
|
|
1485
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
1486
|
+
}
|
|
1487
|
+
_initDefaults();
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
1491
|
+
_unloadCallback();
|
|
1492
|
+
}
|
|
1493
|
+
else {
|
|
1494
|
+
result = true;
|
|
1495
|
+
}
|
|
1496
|
+
return result;
|
|
1497
|
+
};
|
|
1498
|
+
_self.update = function (updateCtx, updateState) {
|
|
1499
|
+
if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
|
|
1500
|
+
return;
|
|
1501
|
+
}
|
|
1502
|
+
var result;
|
|
1503
|
+
var updateDone = false;
|
|
1504
|
+
var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1505
|
+
var theUpdateState = updateState || {
|
|
1506
|
+
reason: 0
|
|
1507
|
+
};
|
|
1508
|
+
function _updateCallback() {
|
|
1509
|
+
if (!updateDone) {
|
|
1510
|
+
updateDone = true;
|
|
1511
|
+
_setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
|
|
1515
|
+
_updateCallback();
|
|
1516
|
+
}
|
|
1517
|
+
else {
|
|
1518
|
+
result = true;
|
|
1519
|
+
}
|
|
1520
|
+
return result;
|
|
1521
|
+
};
|
|
1522
|
+
_self._addHook = function (hooks) {
|
|
1523
|
+
if (hooks) {
|
|
1524
|
+
if (isArray(hooks)) {
|
|
1525
|
+
_hooks = _hooks.concat(hooks);
|
|
1526
|
+
}
|
|
1527
|
+
else {
|
|
1528
|
+
_hooks.push(hooks);
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
};
|
|
1532
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
1533
|
+
});
|
|
1018
1534
|
_self.diagLog = function (itemCtx) {
|
|
1019
|
-
return
|
|
1535
|
+
return _getTelCtx(itemCtx).diagLog();
|
|
1020
1536
|
};
|
|
1021
|
-
_self
|
|
1537
|
+
_self[strIsInitialized] = function () {
|
|
1022
1538
|
return _isinitialized;
|
|
1023
1539
|
};
|
|
1024
1540
|
_self.setInitialized = function (isInitialized) {
|
|
1025
1541
|
_isinitialized = isInitialized;
|
|
1026
1542
|
};
|
|
1027
|
-
_self
|
|
1543
|
+
_self[strSetNextPlugin] = function (next) {
|
|
1028
1544
|
_nextPlugin = next;
|
|
1029
1545
|
};
|
|
1030
1546
|
_self.processNext = function (env, itemCtx) {
|
|
@@ -1035,11 +1551,12 @@
|
|
|
1035
1551
|
_nextPlugin.processTelemetry(env, null);
|
|
1036
1552
|
}
|
|
1037
1553
|
};
|
|
1038
|
-
_self._getTelCtx =
|
|
1554
|
+
_self._getTelCtx = _getTelCtx;
|
|
1555
|
+
function _getTelCtx(currentCtx) {
|
|
1039
1556
|
if (currentCtx === void 0) { currentCtx = null; }
|
|
1040
1557
|
var itemCtx = currentCtx;
|
|
1041
1558
|
if (!itemCtx) {
|
|
1042
|
-
var rootCtx = _rootCtx ||
|
|
1559
|
+
var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
|
|
1043
1560
|
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1044
1561
|
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
1045
1562
|
}
|
|
@@ -1048,8 +1565,8 @@
|
|
|
1048
1565
|
}
|
|
1049
1566
|
}
|
|
1050
1567
|
return itemCtx;
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1568
|
+
}
|
|
1569
|
+
function _setDefaults(config, core, pluginChain) {
|
|
1053
1570
|
if (config) {
|
|
1054
1571
|
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
1055
1572
|
}
|
|
@@ -1061,13 +1578,17 @@
|
|
|
1061
1578
|
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
1062
1579
|
}
|
|
1063
1580
|
_self.core = core;
|
|
1064
|
-
_rootCtx =
|
|
1065
|
-
|
|
1066
|
-
|
|
1581
|
+
_rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
1582
|
+
}
|
|
1583
|
+
function _initDefaults() {
|
|
1584
|
+
_isinitialized = false;
|
|
1585
|
+
_self.core = null;
|
|
1586
|
+
_rootCtx = null;
|
|
1587
|
+
_nextPlugin = null;
|
|
1588
|
+
_hooks = [];
|
|
1589
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
1590
|
+
}
|
|
1067
1591
|
}
|
|
1068
|
-
BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
|
|
1069
|
-
this._baseTelInit(config, core, extensions, pluginChain);
|
|
1070
|
-
};
|
|
1071
1592
|
return BaseTelemetryPlugin;
|
|
1072
1593
|
}());
|
|
1073
1594
|
|
|
@@ -1114,11 +1635,12 @@
|
|
|
1114
1635
|
var _this = _super.call(this) || this;
|
|
1115
1636
|
_this.identifier = "AppInsightsReactNativePlugin";
|
|
1116
1637
|
_this.priority = 140;
|
|
1117
|
-
var _device
|
|
1118
|
-
var _config
|
|
1638
|
+
var _device;
|
|
1639
|
+
var _config;
|
|
1119
1640
|
var _analyticsPlugin;
|
|
1120
1641
|
var _defaultHandler;
|
|
1121
1642
|
dynamicProto(ReactNativePlugin, _this, function (_self, _base) {
|
|
1643
|
+
_initDefaults();
|
|
1122
1644
|
_self.initialize = function (config,
|
|
1123
1645
|
core, extensions) {
|
|
1124
1646
|
if (!_self.isInitialized()) {
|
|
@@ -1164,9 +1686,19 @@
|
|
|
1164
1686
|
_device.model = DeviceInfo__default["default"].getModel();
|
|
1165
1687
|
}
|
|
1166
1688
|
catch (e) {
|
|
1167
|
-
_self.diagLog()
|
|
1689
|
+
_warnToConsole(_self.diagLog(), "Failed to get DeviceInfo: " + getExceptionName(e) + " - " + dumpObj(e));
|
|
1168
1690
|
}
|
|
1169
1691
|
};
|
|
1692
|
+
_self._doTeardown = function (unloadCtx, unloadState, asyncCallback) {
|
|
1693
|
+
_resetGlobalErrorHandler();
|
|
1694
|
+
_initDefaults();
|
|
1695
|
+
};
|
|
1696
|
+
function _initDefaults() {
|
|
1697
|
+
_device = {};
|
|
1698
|
+
_config = config || _getDefaultConfig();
|
|
1699
|
+
_analyticsPlugin = null;
|
|
1700
|
+
_defaultHandler = null;
|
|
1701
|
+
}
|
|
1170
1702
|
function _applyDeviceContext(item) {
|
|
1171
1703
|
if (_device) {
|
|
1172
1704
|
item.ext = item.ext || {};
|
|
@@ -1192,16 +1724,22 @@
|
|
|
1192
1724
|
var _global = _getGlobal();
|
|
1193
1725
|
if (_global && _global.ErrorUtils) {
|
|
1194
1726
|
_defaultHandler = (typeof _global.ErrorUtils.getGlobalHandler === "function" && _global.ErrorUtils.getGlobalHandler()) || _global.ErrorUtils._globalHandler;
|
|
1195
|
-
_global.ErrorUtils.setGlobalHandler(_trackException
|
|
1727
|
+
_global.ErrorUtils.setGlobalHandler(_trackException);
|
|
1196
1728
|
}
|
|
1197
1729
|
};
|
|
1730
|
+
function _resetGlobalErrorHandler() {
|
|
1731
|
+
var _global = _getGlobal();
|
|
1732
|
+
if (_global && _global.ErrorUtils && _global.ErrorUtils.getGlobalHandler() === _trackException) {
|
|
1733
|
+
_global.ErrorUtils.setGlobalHandler(_defaultHandler || null);
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1198
1736
|
function _trackException(e, isFatal) {
|
|
1199
1737
|
var exception = { exception: e, severityLevel: SeverityLevel.Error };
|
|
1200
1738
|
if (_analyticsPlugin) {
|
|
1201
1739
|
_analyticsPlugin.trackException(exception);
|
|
1202
1740
|
}
|
|
1203
1741
|
else {
|
|
1204
|
-
_self.diagLog()
|
|
1742
|
+
_throwInternal(_self.diagLog(), 1 , 64 , "Analytics plugin is not available, ReactNative plugin telemetry will not be sent: ");
|
|
1205
1743
|
}
|
|
1206
1744
|
if (_defaultHandler) {
|
|
1207
1745
|
_defaultHandler.call(global, e, isFatal);
|