@microsoft/applicationinsights-web-basic 2.7.5-nightly.2203-02 → 2.7.5-nightly.2203-03
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/aib.2.7.5-nightly.2203-03.integrity.json +26 -0
- package/browser/{aib.2.7.5-nightly.2203-02.js → aib.2.7.5-nightly.2203-03.js} +2163 -964
- package/browser/aib.2.7.5-nightly.2203-03.js.map +1 -0
- package/browser/aib.2.7.5-nightly.2203-03.min.js +6 -0
- package/browser/aib.2.7.5-nightly.2203-03.min.js.map +1 -0
- package/browser/aib.2.js +2162 -963
- package/browser/aib.2.js.map +1 -1
- package/browser/aib.2.min.js +2 -2
- package/browser/aib.2.min.js.map +1 -1
- package/dist/applicationinsights-web-basic.api.json +3937 -460
- package/dist/applicationinsights-web-basic.api.md +333 -12
- package/dist/applicationinsights-web-basic.d.ts +667 -101
- package/dist/applicationinsights-web-basic.js +2162 -963
- package/dist/applicationinsights-web-basic.js.map +1 -1
- package/dist/applicationinsights-web-basic.min.js +2 -2
- package/dist/applicationinsights-web-basic.min.js.map +1 -1
- package/dist/applicationinsights-web-basic.rollup.d.ts +670 -104
- package/dist-esm/index.js +47 -57
- package/dist-esm/index.js.map +1 -1
- package/package.json +8 -6
- package/src/index.ts +203 -0
- package/tsconfig.json +7 -3
- package/types/index.d.ts +34 -5
- package/types/tsdoc-metadata.json +1 -1
- package/browser/aib.2.7.5-nightly.2203-02.integrity.json +0 -26
- package/browser/aib.2.7.5-nightly.2203-02.js.map +0 -1
- package/browser/aib.2.7.5-nightly.2203-02.min.js +0 -6
- package/browser/aib.2.7.5-nightly.2203-02.min.js.map +0 -1
- package/index.ts +0 -125
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript Web SDK - Basic, 2.7.5-nightly.2203-
|
|
2
|
+
* Application Insights JavaScript Web SDK - Basic, 2.7.5-nightly.2203-03
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -8,107 +8,6 @@
|
|
|
8
8
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.Microsoft = global.Microsoft || {}, global.Microsoft.ApplicationInsights = global.Microsoft.ApplicationInsights || {})));
|
|
9
9
|
})(this, (function (exports) { 'use strict';
|
|
10
10
|
|
|
11
|
-
var EventsDiscardedReason = {
|
|
12
|
-
Unknown: 0,
|
|
13
|
-
NonRetryableStatus: 1,
|
|
14
|
-
InvalidEvent: 2,
|
|
15
|
-
SizeLimitExceeded: 3,
|
|
16
|
-
KillSwitch: 4,
|
|
17
|
-
QueueFull: 5
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
var strShimFunction = "function";
|
|
21
|
-
var strShimObject = "object";
|
|
22
|
-
var strShimUndefined = "undefined";
|
|
23
|
-
var strShimPrototype = "prototype";
|
|
24
|
-
var strShimHasOwnProperty = "hasOwnProperty";
|
|
25
|
-
var ObjClass = Object;
|
|
26
|
-
var ObjProto = ObjClass[strShimPrototype];
|
|
27
|
-
var ObjAssign = ObjClass["assign"];
|
|
28
|
-
var ObjCreate = ObjClass["create"];
|
|
29
|
-
var ObjDefineProperty = ObjClass["defineProperty"];
|
|
30
|
-
var ObjHasOwnProperty = ObjProto[strShimHasOwnProperty];
|
|
31
|
-
|
|
32
|
-
var _cachedGlobal = null;
|
|
33
|
-
function getGlobal(useCached) {
|
|
34
|
-
if (useCached === void 0) { useCached = true; }
|
|
35
|
-
if (!_cachedGlobal || !useCached) {
|
|
36
|
-
if (typeof globalThis !== strShimUndefined && globalThis) {
|
|
37
|
-
_cachedGlobal = globalThis;
|
|
38
|
-
}
|
|
39
|
-
if (typeof self !== strShimUndefined && self) {
|
|
40
|
-
_cachedGlobal = self;
|
|
41
|
-
}
|
|
42
|
-
if (typeof window !== strShimUndefined && window) {
|
|
43
|
-
_cachedGlobal = window;
|
|
44
|
-
}
|
|
45
|
-
if (typeof global !== strShimUndefined && global) {
|
|
46
|
-
_cachedGlobal = global;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return _cachedGlobal;
|
|
50
|
-
}
|
|
51
|
-
function throwTypeError(message) {
|
|
52
|
-
throw new TypeError(message);
|
|
53
|
-
}
|
|
54
|
-
function objCreateFn(obj) {
|
|
55
|
-
var func = ObjCreate;
|
|
56
|
-
if (func) {
|
|
57
|
-
return func(obj);
|
|
58
|
-
}
|
|
59
|
-
if (obj == null) {
|
|
60
|
-
return {};
|
|
61
|
-
}
|
|
62
|
-
var type = typeof obj;
|
|
63
|
-
if (type !== strShimObject && type !== strShimFunction) {
|
|
64
|
-
throwTypeError("Object prototype may only be an Object:" + obj);
|
|
65
|
-
}
|
|
66
|
-
function tmpFunc() { }
|
|
67
|
-
tmpFunc[strShimPrototype] = obj;
|
|
68
|
-
return new tmpFunc();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
(getGlobal() || {})["Symbol"];
|
|
72
|
-
(getGlobal() || {})["Reflect"];
|
|
73
|
-
var __objAssignFnImpl = function (t) {
|
|
74
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
75
|
-
s = arguments[i];
|
|
76
|
-
for (var p in s) {
|
|
77
|
-
if (ObjProto[strShimHasOwnProperty].call(s, p)) {
|
|
78
|
-
t[p] = s[p];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return t;
|
|
83
|
-
};
|
|
84
|
-
var __assignFn = ObjAssign || __objAssignFnImpl;
|
|
85
|
-
var extendStaticsFn = function (d, b) {
|
|
86
|
-
extendStaticsFn = ObjClass["setPrototypeOf"] ||
|
|
87
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
88
|
-
function (d, b) {
|
|
89
|
-
for (var p in b) {
|
|
90
|
-
if (b[strShimHasOwnProperty](p)) {
|
|
91
|
-
d[p] = b[p];
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
return extendStaticsFn(d, b);
|
|
96
|
-
};
|
|
97
|
-
function __extendsFn(d, b) {
|
|
98
|
-
if (typeof b !== strShimFunction && b !== null) {
|
|
99
|
-
throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
100
|
-
}
|
|
101
|
-
extendStaticsFn(d, b);
|
|
102
|
-
function __() { this.constructor = d; }
|
|
103
|
-
d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
|
|
104
|
-
}
|
|
105
|
-
function __spreadArrayFn(to, from) {
|
|
106
|
-
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
|
|
107
|
-
to[j] = from[i];
|
|
108
|
-
}
|
|
109
|
-
return to;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
11
|
/*!
|
|
113
12
|
* Microsoft Dynamic Proto Utility, 1.1.4
|
|
114
13
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
@@ -124,11 +23,11 @@
|
|
|
124
23
|
var DynAllowInstChkTag = DynInstChkTag;
|
|
125
24
|
var DynProtoDefaultOptions = '_dfOpts';
|
|
126
25
|
var UnknownValue = '_unknown_';
|
|
127
|
-
var str__Proto = "__proto__";
|
|
26
|
+
var str__Proto$1 = "__proto__";
|
|
128
27
|
var strUseBaseInst = 'useBaseInst';
|
|
129
28
|
var strSetInstFuncs = 'setInstFuncs';
|
|
130
29
|
var Obj = Object;
|
|
131
|
-
var _objGetPrototypeOf = Obj["getPrototypeOf"];
|
|
30
|
+
var _objGetPrototypeOf$1 = Obj["getPrototypeOf"];
|
|
132
31
|
var _dynamicNames = 0;
|
|
133
32
|
function _hasOwnProperty(obj, prop) {
|
|
134
33
|
return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
|
|
@@ -139,12 +38,12 @@
|
|
|
139
38
|
function _isObjectArrayOrFunctionPrototype(target) {
|
|
140
39
|
return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
|
|
141
40
|
}
|
|
142
|
-
function _getObjProto(target) {
|
|
41
|
+
function _getObjProto$1(target) {
|
|
143
42
|
if (target) {
|
|
144
|
-
if (_objGetPrototypeOf) {
|
|
145
|
-
return _objGetPrototypeOf(target);
|
|
43
|
+
if (_objGetPrototypeOf$1) {
|
|
44
|
+
return _objGetPrototypeOf$1(target);
|
|
146
45
|
}
|
|
147
|
-
var newProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
46
|
+
var newProto = target[str__Proto$1] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
148
47
|
if (newProto) {
|
|
149
48
|
return newProto;
|
|
150
49
|
}
|
|
@@ -210,16 +109,16 @@
|
|
|
210
109
|
_forEachProp(instFuncs, function (name) {
|
|
211
110
|
baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
|
|
212
111
|
});
|
|
213
|
-
var baseProto = _getObjProto(classProto);
|
|
112
|
+
var baseProto = _getObjProto$1(classProto);
|
|
214
113
|
var visited = [];
|
|
215
114
|
while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
|
|
216
115
|
_forEachProp(baseProto, function (name) {
|
|
217
|
-
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
|
|
116
|
+
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf$1)) {
|
|
218
117
|
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
219
118
|
}
|
|
220
119
|
});
|
|
221
120
|
visited.push(baseProto);
|
|
222
|
-
baseProto = _getObjProto(baseProto);
|
|
121
|
+
baseProto = _getObjProto$1(baseProto);
|
|
223
122
|
}
|
|
224
123
|
return baseFuncs;
|
|
225
124
|
}
|
|
@@ -233,7 +132,7 @@
|
|
|
233
132
|
}
|
|
234
133
|
if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
|
|
235
134
|
var canAddInst = !_hasOwnProperty(target, funcName);
|
|
236
|
-
var objProto = _getObjProto(target);
|
|
135
|
+
var objProto = _getObjProto$1(target);
|
|
237
136
|
var visited = [];
|
|
238
137
|
while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
|
|
239
138
|
var protoFunc = objProto[funcName];
|
|
@@ -242,7 +141,7 @@
|
|
|
242
141
|
break;
|
|
243
142
|
}
|
|
244
143
|
visited.push(objProto);
|
|
245
|
-
objProto = _getObjProto(objProto);
|
|
144
|
+
objProto = _getObjProto$1(objProto);
|
|
246
145
|
}
|
|
247
146
|
try {
|
|
248
147
|
if (canAddInst) {
|
|
@@ -260,7 +159,7 @@
|
|
|
260
159
|
function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
|
|
261
160
|
var protoFunc = proto[funcName];
|
|
262
161
|
if (protoFunc === currentDynProtoProxy) {
|
|
263
|
-
protoFunc = _getObjProto(proto)[funcName];
|
|
162
|
+
protoFunc = _getObjProto$1(proto)[funcName];
|
|
264
163
|
}
|
|
265
164
|
if (typeof protoFunc !== strFunction) {
|
|
266
165
|
_throwTypeError("[" + funcName + "] is not a " + strFunction);
|
|
@@ -294,15 +193,15 @@
|
|
|
294
193
|
}
|
|
295
194
|
}
|
|
296
195
|
function _checkPrototype(classProto, thisTarget) {
|
|
297
|
-
if (_objGetPrototypeOf) {
|
|
196
|
+
if (_objGetPrototypeOf$1) {
|
|
298
197
|
var visited = [];
|
|
299
|
-
var thisProto = _getObjProto(thisTarget);
|
|
198
|
+
var thisProto = _getObjProto$1(thisTarget);
|
|
300
199
|
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
301
200
|
if (thisProto === classProto) {
|
|
302
201
|
return true;
|
|
303
202
|
}
|
|
304
203
|
visited.push(thisProto);
|
|
305
|
-
thisProto = _getObjProto(thisProto);
|
|
204
|
+
thisProto = _getObjProto$1(thisProto);
|
|
306
205
|
}
|
|
307
206
|
}
|
|
308
207
|
return false;
|
|
@@ -338,7 +237,7 @@
|
|
|
338
237
|
var instFuncs = _getInstanceFuncs(target);
|
|
339
238
|
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
340
239
|
delegateFunc(target, baseFuncs);
|
|
341
|
-
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
240
|
+
var setInstanceFunc = !!_objGetPrototypeOf$1 && !!perfOptions[strSetInstFuncs];
|
|
342
241
|
if (setInstanceFunc && options) {
|
|
343
242
|
setInstanceFunc = !!options[strSetInstFuncs];
|
|
344
243
|
}
|
|
@@ -350,99 +249,132 @@
|
|
|
350
249
|
};
|
|
351
250
|
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
352
251
|
|
|
353
|
-
var
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
BrowserCannotReadLocalStorage: 1,
|
|
361
|
-
BrowserCannotReadSessionStorage: 2,
|
|
362
|
-
BrowserCannotWriteLocalStorage: 3,
|
|
363
|
-
BrowserCannotWriteSessionStorage: 4,
|
|
364
|
-
BrowserFailedRemovalFromLocalStorage: 5,
|
|
365
|
-
BrowserFailedRemovalFromSessionStorage: 6,
|
|
366
|
-
CannotSendEmptyTelemetry: 7,
|
|
367
|
-
ClientPerformanceMathError: 8,
|
|
368
|
-
ErrorParsingAISessionCookie: 9,
|
|
369
|
-
ErrorPVCalc: 10,
|
|
370
|
-
ExceptionWhileLoggingError: 11,
|
|
371
|
-
FailedAddingTelemetryToBuffer: 12,
|
|
372
|
-
FailedMonitorAjaxAbort: 13,
|
|
373
|
-
FailedMonitorAjaxDur: 14,
|
|
374
|
-
FailedMonitorAjaxOpen: 15,
|
|
375
|
-
FailedMonitorAjaxRSC: 16,
|
|
376
|
-
FailedMonitorAjaxSend: 17,
|
|
377
|
-
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
378
|
-
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
379
|
-
FailedToSendQueuedTelemetry: 20,
|
|
380
|
-
FailedToReportDataLoss: 21,
|
|
381
|
-
FlushFailed: 22,
|
|
382
|
-
MessageLimitPerPVExceeded: 23,
|
|
383
|
-
MissingRequiredFieldSpecification: 24,
|
|
384
|
-
NavigationTimingNotSupported: 25,
|
|
385
|
-
OnError: 26,
|
|
386
|
-
SessionRenewalDateIsZero: 27,
|
|
387
|
-
SenderNotInitialized: 28,
|
|
388
|
-
StartTrackEventFailed: 29,
|
|
389
|
-
StopTrackEventFailed: 30,
|
|
390
|
-
StartTrackFailed: 31,
|
|
391
|
-
StopTrackFailed: 32,
|
|
392
|
-
TelemetrySampledAndNotSent: 33,
|
|
393
|
-
TrackEventFailed: 34,
|
|
394
|
-
TrackExceptionFailed: 35,
|
|
395
|
-
TrackMetricFailed: 36,
|
|
396
|
-
TrackPVFailed: 37,
|
|
397
|
-
TrackPVFailedCalc: 38,
|
|
398
|
-
TrackTraceFailed: 39,
|
|
399
|
-
TransmissionFailed: 40,
|
|
400
|
-
FailedToSetStorageBuffer: 41,
|
|
401
|
-
FailedToRestoreStorageBuffer: 42,
|
|
402
|
-
InvalidBackendResponse: 43,
|
|
403
|
-
FailedToFixDepricatedValues: 44,
|
|
404
|
-
InvalidDurationValue: 45,
|
|
405
|
-
TelemetryEnvelopeInvalid: 46,
|
|
406
|
-
CreateEnvelopeError: 47,
|
|
407
|
-
CannotSerializeObject: 48,
|
|
408
|
-
CannotSerializeObjectNonSerializable: 49,
|
|
409
|
-
CircularReferenceDetected: 50,
|
|
410
|
-
ClearAuthContextFailed: 51,
|
|
411
|
-
ExceptionTruncated: 52,
|
|
412
|
-
IllegalCharsInName: 53,
|
|
413
|
-
ItemNotInArray: 54,
|
|
414
|
-
MaxAjaxPerPVExceeded: 55,
|
|
415
|
-
MessageTruncated: 56,
|
|
416
|
-
NameTooLong: 57,
|
|
417
|
-
SampleRateOutOfRange: 58,
|
|
418
|
-
SetAuthContextFailed: 59,
|
|
419
|
-
SetAuthContextFailedAccountName: 60,
|
|
420
|
-
StringValueTooLong: 61,
|
|
421
|
-
StartCalledMoreThanOnce: 62,
|
|
422
|
-
StopCalledWithoutStart: 63,
|
|
423
|
-
TelemetryInitializerFailed: 64,
|
|
424
|
-
TrackArgumentsNotSpecified: 65,
|
|
425
|
-
UrlTooLong: 66,
|
|
426
|
-
SessionStorageBufferFull: 67,
|
|
427
|
-
CannotAccessCookie: 68,
|
|
428
|
-
IdTooLong: 69,
|
|
429
|
-
InvalidEvent: 70,
|
|
430
|
-
FailedMonitorAjaxSetRequestHeader: 71,
|
|
431
|
-
SendBrowserInfoOnUserInit: 72,
|
|
432
|
-
PluginException: 73,
|
|
433
|
-
NotificationException: 74,
|
|
434
|
-
SnippetScriptLoadFailure: 99,
|
|
435
|
-
InvalidInstrumentationKey: 100,
|
|
436
|
-
CannotParseAiBlobValue: 101,
|
|
437
|
-
InvalidContentBlob: 102,
|
|
438
|
-
TrackPageActionEventFailed: 103,
|
|
439
|
-
FailedAddingCustomDefinedRequestContext: 104,
|
|
440
|
-
InMemoryStorageBufferFull: 105
|
|
252
|
+
var EventsDiscardedReason = {
|
|
253
|
+
Unknown: 0,
|
|
254
|
+
NonRetryableStatus: 1,
|
|
255
|
+
InvalidEvent: 2,
|
|
256
|
+
SizeLimitExceeded: 3,
|
|
257
|
+
KillSwitch: 4,
|
|
258
|
+
QueueFull: 5
|
|
441
259
|
};
|
|
442
260
|
|
|
443
|
-
var
|
|
444
|
-
var
|
|
445
|
-
var
|
|
261
|
+
var strShimFunction = "function";
|
|
262
|
+
var strShimObject = "object";
|
|
263
|
+
var strShimUndefined = "undefined";
|
|
264
|
+
var strShimPrototype = "prototype";
|
|
265
|
+
var strShimHasOwnProperty = "hasOwnProperty";
|
|
266
|
+
var ObjClass = Object;
|
|
267
|
+
var ObjProto = ObjClass[strShimPrototype];
|
|
268
|
+
var ObjAssign = ObjClass["assign"];
|
|
269
|
+
var ObjCreate = ObjClass["create"];
|
|
270
|
+
var ObjDefineProperty = ObjClass["defineProperty"];
|
|
271
|
+
var ObjHasOwnProperty = ObjProto[strShimHasOwnProperty];
|
|
272
|
+
|
|
273
|
+
var _cachedGlobal = null;
|
|
274
|
+
function getGlobal(useCached) {
|
|
275
|
+
if (useCached === void 0) { useCached = true; }
|
|
276
|
+
if (!_cachedGlobal || !useCached) {
|
|
277
|
+
if (typeof globalThis !== strShimUndefined && globalThis) {
|
|
278
|
+
_cachedGlobal = globalThis;
|
|
279
|
+
}
|
|
280
|
+
if (typeof self !== strShimUndefined && self) {
|
|
281
|
+
_cachedGlobal = self;
|
|
282
|
+
}
|
|
283
|
+
if (typeof window !== strShimUndefined && window) {
|
|
284
|
+
_cachedGlobal = window;
|
|
285
|
+
}
|
|
286
|
+
if (typeof global !== strShimUndefined && global) {
|
|
287
|
+
_cachedGlobal = global;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return _cachedGlobal;
|
|
291
|
+
}
|
|
292
|
+
function throwTypeError(message) {
|
|
293
|
+
throw new TypeError(message);
|
|
294
|
+
}
|
|
295
|
+
function objCreateFn(obj) {
|
|
296
|
+
var func = ObjCreate;
|
|
297
|
+
if (func) {
|
|
298
|
+
return func(obj);
|
|
299
|
+
}
|
|
300
|
+
if (obj == null) {
|
|
301
|
+
return {};
|
|
302
|
+
}
|
|
303
|
+
var type = typeof obj;
|
|
304
|
+
if (type !== strShimObject && type !== strShimFunction) {
|
|
305
|
+
throwTypeError("Object prototype may only be an Object:" + obj);
|
|
306
|
+
}
|
|
307
|
+
function tmpFunc() { }
|
|
308
|
+
tmpFunc[strShimPrototype] = obj;
|
|
309
|
+
return new tmpFunc();
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
(getGlobal() || {})["Symbol"];
|
|
313
|
+
(getGlobal() || {})["Reflect"];
|
|
314
|
+
var __objAssignFnImpl = function (t) {
|
|
315
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
316
|
+
s = arguments[i];
|
|
317
|
+
for (var p in s) {
|
|
318
|
+
if (ObjProto[strShimHasOwnProperty].call(s, p)) {
|
|
319
|
+
t[p] = s[p];
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return t;
|
|
324
|
+
};
|
|
325
|
+
var __assignFn = ObjAssign || __objAssignFnImpl;
|
|
326
|
+
var extendStaticsFn = function (d, b) {
|
|
327
|
+
extendStaticsFn = ObjClass["setPrototypeOf"] ||
|
|
328
|
+
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
329
|
+
d.__proto__ = b;
|
|
330
|
+
}) ||
|
|
331
|
+
function (d, b) {
|
|
332
|
+
for (var p in b) {
|
|
333
|
+
if (b[strShimHasOwnProperty](p)) {
|
|
334
|
+
d[p] = b[p];
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
return extendStaticsFn(d, b);
|
|
339
|
+
};
|
|
340
|
+
function __extendsFn(d, b) {
|
|
341
|
+
if (typeof b !== strShimFunction && b !== null) {
|
|
342
|
+
throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
343
|
+
}
|
|
344
|
+
extendStaticsFn(d, b);
|
|
345
|
+
function __() {
|
|
346
|
+
this.constructor = d;
|
|
347
|
+
}
|
|
348
|
+
d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
|
|
349
|
+
}
|
|
350
|
+
function __spreadArrayFn(to, from) {
|
|
351
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
|
|
352
|
+
to[j] = from[i];
|
|
353
|
+
}
|
|
354
|
+
return to;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
var strEmpty$1 = "";
|
|
358
|
+
var strProcessTelemetry = "processTelemetry";
|
|
359
|
+
var strPriority = "priority";
|
|
360
|
+
var strSetNextPlugin = "setNextPlugin";
|
|
361
|
+
var strIsInitialized = "isInitialized";
|
|
362
|
+
var strTeardown = "teardown";
|
|
363
|
+
var strCore = "core";
|
|
364
|
+
var strUpdate = "update";
|
|
365
|
+
var strDisabled = "disabled";
|
|
366
|
+
var strDoTeardown = "_doTeardown";
|
|
367
|
+
var strProcessNext = "processNext";
|
|
368
|
+
var strResume = "resume";
|
|
369
|
+
var strPause = "pause";
|
|
370
|
+
var strNotificationListener = "NotificationListener";
|
|
371
|
+
var strAddNotificationListener = "add" + strNotificationListener;
|
|
372
|
+
var strRemoveNotificationListener = "remove" + strNotificationListener;
|
|
373
|
+
var strEventsSent = "eventsSent";
|
|
374
|
+
var strEventsDiscarded = "eventsDiscarded";
|
|
375
|
+
var strEventsSendRequest = "eventsSendRequest";
|
|
376
|
+
var strPerfEvent = "perfEvent";
|
|
377
|
+
|
|
446
378
|
var strToISOString = "toISOString";
|
|
447
379
|
var cStrEndsWith = "endsWith";
|
|
448
380
|
var cStrStartsWith = "startsWith";
|
|
@@ -451,8 +383,10 @@
|
|
|
451
383
|
var strReduce = "reduce";
|
|
452
384
|
var cStrTrim = "trim";
|
|
453
385
|
var strToString = "toString";
|
|
454
|
-
var
|
|
455
|
-
|
|
386
|
+
var str__Proto = "__proto__";
|
|
387
|
+
var strConstructor = "constructor";
|
|
388
|
+
var _objDefineProperty$1 = ObjDefineProperty;
|
|
389
|
+
var _objFreeze = ObjClass.freeze;
|
|
456
390
|
ObjClass.seal;
|
|
457
391
|
var _objKeys = ObjClass.keys;
|
|
458
392
|
var StringProto = String[strShimPrototype];
|
|
@@ -464,7 +398,23 @@
|
|
|
464
398
|
var _isArray = Array.isArray;
|
|
465
399
|
var _objToString = ObjProto[strToString];
|
|
466
400
|
var _fnToString = ObjHasOwnProperty[strToString];
|
|
467
|
-
_fnToString.call(ObjClass);
|
|
401
|
+
var _objFunctionString = _fnToString.call(ObjClass);
|
|
402
|
+
var rCamelCase = /-([a-z])/g;
|
|
403
|
+
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
404
|
+
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
405
|
+
var _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
406
|
+
function _getObjProto(target) {
|
|
407
|
+
if (target) {
|
|
408
|
+
if (_objGetPrototypeOf) {
|
|
409
|
+
return _objGetPrototypeOf(target);
|
|
410
|
+
}
|
|
411
|
+
var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
|
|
412
|
+
if (newProto) {
|
|
413
|
+
return newProto;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return null;
|
|
417
|
+
}
|
|
468
418
|
function isTypeof(value, theType) {
|
|
469
419
|
return typeof value === theType;
|
|
470
420
|
}
|
|
@@ -486,24 +436,18 @@
|
|
|
486
436
|
function isFunction(value) {
|
|
487
437
|
return !!(value && typeof value === strShimFunction);
|
|
488
438
|
}
|
|
489
|
-
function
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
500
|
-
result = true;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
catch (e) {
|
|
504
|
-
}
|
|
439
|
+
function normalizeJsName(name) {
|
|
440
|
+
var value = name;
|
|
441
|
+
if (value && isString(value)) {
|
|
442
|
+
value = value.replace(rCamelCase, function (_all, letter) {
|
|
443
|
+
return letter.toUpperCase();
|
|
444
|
+
});
|
|
445
|
+
value = value.replace(rNormalizeInvalid, "_");
|
|
446
|
+
value = value.replace(rLeadingNumeric, function (_all, match) {
|
|
447
|
+
return "_" + match;
|
|
448
|
+
});
|
|
505
449
|
}
|
|
506
|
-
return
|
|
450
|
+
return value;
|
|
507
451
|
}
|
|
508
452
|
function objForEachKey(target, callbackfn) {
|
|
509
453
|
if (target) {
|
|
@@ -562,6 +506,22 @@
|
|
|
562
506
|
function isBoolean(value) {
|
|
563
507
|
return typeof value === "boolean";
|
|
564
508
|
}
|
|
509
|
+
function isPlainObject(value) {
|
|
510
|
+
var result = false;
|
|
511
|
+
if (value && typeof value === "object") {
|
|
512
|
+
var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
|
|
513
|
+
if (!proto) {
|
|
514
|
+
result = true;
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
|
|
518
|
+
proto = proto[strConstructor];
|
|
519
|
+
}
|
|
520
|
+
result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return result;
|
|
524
|
+
}
|
|
565
525
|
function toISOString(date) {
|
|
566
526
|
if (date) {
|
|
567
527
|
return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
|
|
@@ -707,7 +667,7 @@
|
|
|
707
667
|
return result;
|
|
708
668
|
}
|
|
709
669
|
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
710
|
-
if (_objDefineProperty) {
|
|
670
|
+
if (_objDefineProperty$1) {
|
|
711
671
|
try {
|
|
712
672
|
var descriptor = {
|
|
713
673
|
enumerable: true,
|
|
@@ -719,7 +679,7 @@
|
|
|
719
679
|
if (setProp) {
|
|
720
680
|
descriptor.set = setProp;
|
|
721
681
|
}
|
|
722
|
-
_objDefineProperty(target, prop, descriptor);
|
|
682
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
723
683
|
return true;
|
|
724
684
|
}
|
|
725
685
|
catch (e) {
|
|
@@ -727,6 +687,10 @@
|
|
|
727
687
|
}
|
|
728
688
|
return false;
|
|
729
689
|
}
|
|
690
|
+
function _doNothing(value) {
|
|
691
|
+
return value;
|
|
692
|
+
}
|
|
693
|
+
var objFreeze = _objFreeze || _doNothing;
|
|
730
694
|
function dateNow() {
|
|
731
695
|
var dt = Date;
|
|
732
696
|
return dt.now ? dt.now() : new dt().getTime();
|
|
@@ -735,7 +699,7 @@
|
|
|
735
699
|
if (isError(object)) {
|
|
736
700
|
return object.name;
|
|
737
701
|
}
|
|
738
|
-
return
|
|
702
|
+
return strEmpty$1;
|
|
739
703
|
}
|
|
740
704
|
function setValue(target, field, value, valChk, srcChk) {
|
|
741
705
|
var theValue = value;
|
|
@@ -771,18 +735,67 @@
|
|
|
771
735
|
function throwError(message) {
|
|
772
736
|
throw new Error(message);
|
|
773
737
|
}
|
|
774
|
-
function
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
738
|
+
function _createProxyFunction(source, funcName) {
|
|
739
|
+
var srcFunc = null;
|
|
740
|
+
var src = null;
|
|
741
|
+
if (isFunction(source)) {
|
|
742
|
+
srcFunc = source;
|
|
743
|
+
}
|
|
744
|
+
else {
|
|
745
|
+
src = source;
|
|
746
|
+
}
|
|
747
|
+
return function () {
|
|
748
|
+
var originalArguments = arguments;
|
|
749
|
+
if (srcFunc) {
|
|
750
|
+
src = srcFunc();
|
|
751
|
+
}
|
|
752
|
+
if (src) {
|
|
753
|
+
return src[funcName].apply(src, originalArguments);
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
758
|
+
if (overwriteTarget === void 0) { overwriteTarget = true; }
|
|
759
|
+
if (target && name && source) {
|
|
760
|
+
if (overwriteTarget || isUndefined(target[name])) {
|
|
761
|
+
target[name] = _createProxyFunction(source, theFunc);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {
|
|
766
|
+
if (overwriteTarget === void 0) { overwriteTarget = true; }
|
|
767
|
+
if (target && source && isObject(target) && isArray(functionsToProxy)) {
|
|
768
|
+
arrForEach(functionsToProxy, function (theFuncName) {
|
|
769
|
+
if (isString(theFuncName)) {
|
|
770
|
+
proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);
|
|
771
|
+
}
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
return target;
|
|
775
|
+
}
|
|
776
|
+
function createClassFromInterface(defaults) {
|
|
777
|
+
return /** @class */ (function () {
|
|
778
|
+
function class_1() {
|
|
779
|
+
var _this_1 = this;
|
|
780
|
+
if (defaults) {
|
|
781
|
+
objForEachKey(defaults, function (field, value) {
|
|
782
|
+
_this_1[field] = value;
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
return class_1;
|
|
787
|
+
}());
|
|
788
|
+
}
|
|
789
|
+
function createEnumStyle(values) {
|
|
790
|
+
var enumClass = {};
|
|
791
|
+
objForEachKey(values, function (field, value) {
|
|
792
|
+
enumClass[field] = value;
|
|
793
|
+
if (!isUndefined(enumClass[value])) {
|
|
794
|
+
throwError("[" + value + "] exists for " + field);
|
|
795
|
+
}
|
|
796
|
+
enumClass[value] = field;
|
|
797
|
+
});
|
|
798
|
+
return objFreeze(enumClass);
|
|
786
799
|
}
|
|
787
800
|
function optimizeObject(theObject) {
|
|
788
801
|
if (theObject && ObjAssign) {
|
|
@@ -790,6 +803,50 @@
|
|
|
790
803
|
}
|
|
791
804
|
return theObject;
|
|
792
805
|
}
|
|
806
|
+
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
807
|
+
var theArgs = arguments;
|
|
808
|
+
var extended = theArgs[0] || {};
|
|
809
|
+
var argLen = theArgs.length;
|
|
810
|
+
var deep = false;
|
|
811
|
+
var idx = 1;
|
|
812
|
+
if (argLen > 0 && isBoolean(extended)) {
|
|
813
|
+
deep = extended;
|
|
814
|
+
extended = theArgs[idx] || {};
|
|
815
|
+
idx++;
|
|
816
|
+
}
|
|
817
|
+
if (!isObject(extended)) {
|
|
818
|
+
extended = {};
|
|
819
|
+
}
|
|
820
|
+
for (; idx < argLen; idx++) {
|
|
821
|
+
var arg = theArgs[idx];
|
|
822
|
+
var isArgArray = isArray(arg);
|
|
823
|
+
var isArgObj = isObject(arg);
|
|
824
|
+
for (var prop in arg) {
|
|
825
|
+
var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
|
|
826
|
+
if (!propOk) {
|
|
827
|
+
continue;
|
|
828
|
+
}
|
|
829
|
+
var newValue = arg[prop];
|
|
830
|
+
var isNewArray = void 0;
|
|
831
|
+
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
832
|
+
var clone = extended[prop];
|
|
833
|
+
if (isNewArray) {
|
|
834
|
+
if (!isArray(clone)) {
|
|
835
|
+
clone = [];
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
else if (!isPlainObject(clone)) {
|
|
839
|
+
clone = {};
|
|
840
|
+
}
|
|
841
|
+
newValue = objExtend(deep, clone, newValue);
|
|
842
|
+
}
|
|
843
|
+
if (newValue !== undefined) {
|
|
844
|
+
extended[prop] = newValue;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
return extended;
|
|
849
|
+
}
|
|
793
850
|
|
|
794
851
|
var strWindow = "window";
|
|
795
852
|
var strDocument = "document";
|
|
@@ -803,6 +860,7 @@
|
|
|
803
860
|
var strMsCrypto = "msCrypto";
|
|
804
861
|
var strMsie = "msie";
|
|
805
862
|
var strTrident = "trident/";
|
|
863
|
+
var strXMLHttpRequest = "XMLHttpRequest";
|
|
806
864
|
var _isTrident = null;
|
|
807
865
|
var _navUserAgentCheck = null;
|
|
808
866
|
var _enableMocks = false;
|
|
@@ -910,7 +968,7 @@
|
|
|
910
968
|
var nav = getNavigator();
|
|
911
969
|
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
912
970
|
_navUserAgentCheck = nav.userAgent;
|
|
913
|
-
var userAgent = (_navUserAgentCheck ||
|
|
971
|
+
var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
|
|
914
972
|
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
915
973
|
}
|
|
916
974
|
return _isTrident;
|
|
@@ -919,9 +977,9 @@
|
|
|
919
977
|
if (userAgentStr === void 0) { userAgentStr = null; }
|
|
920
978
|
if (!userAgentStr) {
|
|
921
979
|
var navigator_1 = getNavigator() || {};
|
|
922
|
-
userAgentStr = navigator_1 ? (navigator_1.userAgent ||
|
|
980
|
+
userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty$1).toLowerCase() : strEmpty$1;
|
|
923
981
|
}
|
|
924
|
-
var ua = (userAgentStr ||
|
|
982
|
+
var ua = (userAgentStr || strEmpty$1).toLowerCase();
|
|
925
983
|
if (strContains(ua, strMsie)) {
|
|
926
984
|
var doc = getDocument() || {};
|
|
927
985
|
return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
|
|
@@ -936,7 +994,7 @@
|
|
|
936
994
|
}
|
|
937
995
|
function dumpObj(object) {
|
|
938
996
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
939
|
-
var propertyValueDump =
|
|
997
|
+
var propertyValueDump = strEmpty$1;
|
|
940
998
|
if (objectTypeDump === "[object Error]") {
|
|
941
999
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
942
1000
|
}
|
|
@@ -954,8 +1012,7 @@
|
|
|
954
1012
|
function isFetchSupported(withKeepAlive) {
|
|
955
1013
|
var isSupported = false;
|
|
956
1014
|
try {
|
|
957
|
-
|
|
958
|
-
isSupported = !!fetchApi;
|
|
1015
|
+
isSupported = !!getGlobalInst("fetch");
|
|
959
1016
|
var request = getGlobalInst("Request");
|
|
960
1017
|
if (isSupported && withKeepAlive && request) {
|
|
961
1018
|
isSupported = _hasProperty(request, "keepalive");
|
|
@@ -967,9 +1024,9 @@
|
|
|
967
1024
|
}
|
|
968
1025
|
function useXDomainRequest() {
|
|
969
1026
|
if (_useXDomainRequest === null) {
|
|
970
|
-
_useXDomainRequest = (typeof XDomainRequest !==
|
|
1027
|
+
_useXDomainRequest = (typeof XDomainRequest !== strShimUndefined);
|
|
971
1028
|
if (_useXDomainRequest && isXhrSupported()) {
|
|
972
|
-
_useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(
|
|
1029
|
+
_useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(strXMLHttpRequest), "withCredentials");
|
|
973
1030
|
}
|
|
974
1031
|
}
|
|
975
1032
|
return _useXDomainRequest;
|
|
@@ -977,7 +1034,7 @@
|
|
|
977
1034
|
function isXhrSupported() {
|
|
978
1035
|
var isSupported = false;
|
|
979
1036
|
try {
|
|
980
|
-
var xmlHttpRequest = getGlobalInst(
|
|
1037
|
+
var xmlHttpRequest = getGlobalInst(strXMLHttpRequest);
|
|
981
1038
|
isSupported = !!xmlHttpRequest;
|
|
982
1039
|
}
|
|
983
1040
|
catch (e) {
|
|
@@ -1031,9 +1088,9 @@
|
|
|
1031
1088
|
var strWarnToConsole = "warnToConsole";
|
|
1032
1089
|
function _sanitizeDiagnosticText(text) {
|
|
1033
1090
|
if (text) {
|
|
1034
|
-
return "\"" + text.replace(/\"/g,
|
|
1091
|
+
return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
|
|
1035
1092
|
}
|
|
1036
|
-
return
|
|
1093
|
+
return strEmpty$1;
|
|
1037
1094
|
}
|
|
1038
1095
|
function _logToConsole(func, message) {
|
|
1039
1096
|
var theConsole = getConsole();
|
|
@@ -1055,12 +1112,12 @@
|
|
|
1055
1112
|
_self.message =
|
|
1056
1113
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
1057
1114
|
msgId;
|
|
1058
|
-
var strProps =
|
|
1115
|
+
var strProps = strEmpty$1;
|
|
1059
1116
|
if (hasJSON()) {
|
|
1060
1117
|
strProps = getJSON().stringify(properties);
|
|
1061
1118
|
}
|
|
1062
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
1063
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
1119
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
|
|
1120
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
|
|
1064
1121
|
_self.message += diagnosticText;
|
|
1065
1122
|
}
|
|
1066
1123
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -1090,7 +1147,7 @@
|
|
|
1090
1147
|
throw message;
|
|
1091
1148
|
}
|
|
1092
1149
|
else {
|
|
1093
|
-
var logFunc = severity ===
|
|
1150
|
+
var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
|
|
1094
1151
|
if (!isUndefined(message.message)) {
|
|
1095
1152
|
var logLevel = _self.consoleLoggingLevel();
|
|
1096
1153
|
if (isUserAct) {
|
|
@@ -1108,7 +1165,7 @@
|
|
|
1108
1165
|
_self.logInternalMessage(severity, message);
|
|
1109
1166
|
}
|
|
1110
1167
|
else {
|
|
1111
|
-
_debugExtMsg("throw" + (severity ===
|
|
1168
|
+
_debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
|
|
1112
1169
|
}
|
|
1113
1170
|
}
|
|
1114
1171
|
};
|
|
@@ -1140,13 +1197,13 @@
|
|
|
1140
1197
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
1141
1198
|
_self.queue.push(message);
|
|
1142
1199
|
_messageCount++;
|
|
1143
|
-
_debugExtMsg((severity ===
|
|
1200
|
+
_debugExtMsg((severity === 1 ? "error" : "warn"), message);
|
|
1144
1201
|
}
|
|
1145
1202
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
1146
1203
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
1147
|
-
var throttleMessage = new _InternalLogMessage(
|
|
1204
|
+
var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
|
|
1148
1205
|
_self.queue.push(throttleMessage);
|
|
1149
|
-
if (severity ===
|
|
1206
|
+
if (severity === 1 ) {
|
|
1150
1207
|
_self.errorToConsole(throttleLimitMessage);
|
|
1151
1208
|
}
|
|
1152
1209
|
else {
|
|
@@ -1175,6 +1232,10 @@
|
|
|
1175
1232
|
}
|
|
1176
1233
|
return DiagnosticLogger;
|
|
1177
1234
|
}());
|
|
1235
|
+
function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
|
|
1236
|
+
if (isUserAct === void 0) { isUserAct = false; }
|
|
1237
|
+
(logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
|
|
1238
|
+
}
|
|
1178
1239
|
|
|
1179
1240
|
var strExecutionContextKey = "ctx";
|
|
1180
1241
|
var _defaultPerfManager = null;
|
|
@@ -1320,271 +1381,186 @@
|
|
|
1320
1381
|
return _defaultPerfManager;
|
|
1321
1382
|
}
|
|
1322
1383
|
|
|
1323
|
-
var
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
return plugin;
|
|
1332
|
-
};
|
|
1333
|
-
_self.getNext = function () {
|
|
1334
|
-
return _nextProxy;
|
|
1335
|
-
};
|
|
1336
|
-
_self.setNext = function (nextPlugin) {
|
|
1337
|
-
_nextProxy = nextPlugin;
|
|
1338
|
-
};
|
|
1339
|
-
_self.processTelemetry = function (env, itemCtx) {
|
|
1340
|
-
if (!itemCtx) {
|
|
1341
|
-
itemCtx = defItemCtx;
|
|
1342
|
-
}
|
|
1343
|
-
var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
|
|
1344
|
-
doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
|
|
1345
|
-
if (plugin && _hasProcessTelemetry) {
|
|
1346
|
-
_self._hasRun = true;
|
|
1347
|
-
try {
|
|
1348
|
-
itemCtx.setNext(_nextProxy);
|
|
1349
|
-
if (_hasSetNext) {
|
|
1350
|
-
plugin.setNextPlugin(_nextProxy);
|
|
1351
|
-
}
|
|
1352
|
-
_nextProxy && (_nextProxy._hasRun = false);
|
|
1353
|
-
plugin.processTelemetry(env, itemCtx);
|
|
1354
|
-
}
|
|
1355
|
-
catch (error) {
|
|
1356
|
-
var hasRun = _nextProxy && _nextProxy._hasRun;
|
|
1357
|
-
if (!_nextProxy || !hasRun) {
|
|
1358
|
-
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
|
|
1359
|
-
}
|
|
1360
|
-
if (_nextProxy && !hasRun) {
|
|
1361
|
-
_nextProxy.processTelemetry(env, itemCtx);
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
else if (_nextProxy) {
|
|
1366
|
-
_self._hasRun = true;
|
|
1367
|
-
_nextProxy.processTelemetry(env, itemCtx);
|
|
1368
|
-
}
|
|
1369
|
-
}, function () { return ({ item: env }); }, !(env.sync));
|
|
1370
|
-
};
|
|
1384
|
+
var UInt32Mask = 0x100000000;
|
|
1385
|
+
var MaxUInt32 = 0xffffffff;
|
|
1386
|
+
var _mwcSeeded = false;
|
|
1387
|
+
var _mwcW = 123456789;
|
|
1388
|
+
var _mwcZ = 987654321;
|
|
1389
|
+
function _mwcSeed(seedValue) {
|
|
1390
|
+
if (seedValue < 0) {
|
|
1391
|
+
seedValue >>>= 0;
|
|
1371
1392
|
}
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
var
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
|
|
1383
|
-
proxies.push(newProxy);
|
|
1384
|
-
if (lastProxy) {
|
|
1385
|
-
lastProxy.setNext(newProxy);
|
|
1386
|
-
}
|
|
1387
|
-
lastProxy = newProxy;
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1393
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
1394
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
1395
|
+
_mwcSeeded = true;
|
|
1396
|
+
}
|
|
1397
|
+
function _autoSeedMwc() {
|
|
1398
|
+
try {
|
|
1399
|
+
var now = dateNow() & 0x7fffffff;
|
|
1400
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
1401
|
+
}
|
|
1402
|
+
catch (e) {
|
|
1390
1403
|
}
|
|
1391
|
-
return proxies.length > 0 ? proxies[0] : null;
|
|
1392
1404
|
}
|
|
1393
|
-
function
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1405
|
+
function randomValue(maxValue) {
|
|
1406
|
+
if (maxValue > 0) {
|
|
1407
|
+
return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
|
|
1408
|
+
}
|
|
1409
|
+
return 0;
|
|
1410
|
+
}
|
|
1411
|
+
function random32(signed) {
|
|
1412
|
+
var value = 0;
|
|
1413
|
+
var c = getCrypto() || getMsCrypto();
|
|
1414
|
+
if (c && c.getRandomValues) {
|
|
1415
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1416
|
+
}
|
|
1417
|
+
if (value === 0 && isIE()) {
|
|
1418
|
+
if (!_mwcSeeded) {
|
|
1419
|
+
_autoSeedMwc();
|
|
1404
1420
|
}
|
|
1421
|
+
value = mwcRandom32() & MaxUInt32;
|
|
1405
1422
|
}
|
|
1406
|
-
if (
|
|
1407
|
-
|
|
1423
|
+
if (value === 0) {
|
|
1424
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1425
|
+
}
|
|
1426
|
+
if (!signed) {
|
|
1427
|
+
value >>>= 0;
|
|
1408
1428
|
}
|
|
1409
|
-
return
|
|
1429
|
+
return value;
|
|
1410
1430
|
}
|
|
1411
|
-
function
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1431
|
+
function mwcRandomSeed(value) {
|
|
1432
|
+
if (!value) {
|
|
1433
|
+
_autoSeedMwc();
|
|
1434
|
+
}
|
|
1435
|
+
else {
|
|
1436
|
+
_mwcSeed(value);
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
function mwcRandom32(signed) {
|
|
1440
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1441
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1442
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1443
|
+
if (!signed) {
|
|
1444
|
+
value >>>= 0;
|
|
1445
|
+
}
|
|
1446
|
+
return value;
|
|
1447
|
+
}
|
|
1448
|
+
function newId(maxLength) {
|
|
1449
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1450
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1451
|
+
var number = random32() >>> 0;
|
|
1452
|
+
var chars = 0;
|
|
1453
|
+
var result = strEmpty$1;
|
|
1454
|
+
while (result.length < maxLength) {
|
|
1455
|
+
chars++;
|
|
1456
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1457
|
+
number >>>= 6;
|
|
1458
|
+
if (chars === 5) {
|
|
1459
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1460
|
+
chars = 0;
|
|
1461
|
+
}
|
|
1422
1462
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1463
|
+
return result;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
1467
|
+
var version = "2.7.5-nightly.2203-03";
|
|
1468
|
+
var instanceName = "." + newId(6);
|
|
1469
|
+
var _dataUid = 0;
|
|
1470
|
+
function _createAccessor(target, prop, value) {
|
|
1471
|
+
if (_objDefineProperty) {
|
|
1472
|
+
try {
|
|
1473
|
+
_objDefineProperty(target, prop, {
|
|
1474
|
+
value: value,
|
|
1475
|
+
enumerable: false,
|
|
1476
|
+
configurable: true
|
|
1477
|
+
});
|
|
1478
|
+
return true;
|
|
1479
|
+
}
|
|
1480
|
+
catch (e) {
|
|
1426
1481
|
}
|
|
1427
|
-
plugins.push(startAt);
|
|
1428
1482
|
}
|
|
1429
|
-
return
|
|
1483
|
+
return false;
|
|
1430
1484
|
}
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
if (
|
|
1441
|
-
|
|
1442
|
-
}
|
|
1443
|
-
else if (isUndefined(startAt)) {
|
|
1444
|
-
_nextProxy = _createProxyChain(plugins, _self);
|
|
1485
|
+
function _canAcceptData(target) {
|
|
1486
|
+
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1487
|
+
}
|
|
1488
|
+
function _getCache(data, target) {
|
|
1489
|
+
var theCache = target[data.id];
|
|
1490
|
+
if (!theCache) {
|
|
1491
|
+
theCache = {};
|
|
1492
|
+
try {
|
|
1493
|
+
if (_canAcceptData(target)) {
|
|
1494
|
+
if (!_createAccessor(target, data.id, theCache)) {
|
|
1495
|
+
target[data.id] = theCache;
|
|
1445
1496
|
}
|
|
1446
1497
|
}
|
|
1447
1498
|
}
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
};
|
|
1451
|
-
_self.diagLog = function () {
|
|
1452
|
-
return safeGetLogger(core, config);
|
|
1453
|
-
};
|
|
1454
|
-
_self.getCfg = function () {
|
|
1455
|
-
return config;
|
|
1456
|
-
};
|
|
1457
|
-
_self.getExtCfg = function (identifier, defaultValue) {
|
|
1458
|
-
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1459
|
-
var theConfig;
|
|
1460
|
-
if (config) {
|
|
1461
|
-
var extConfig = config.extensionConfig;
|
|
1462
|
-
if (extConfig && identifier) {
|
|
1463
|
-
theConfig = extConfig[identifier];
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
return (theConfig ? theConfig : defaultValue);
|
|
1467
|
-
};
|
|
1468
|
-
_self.getConfig = function (identifier, field, defaultValue) {
|
|
1469
|
-
if (defaultValue === void 0) { defaultValue = false; }
|
|
1470
|
-
var theValue;
|
|
1471
|
-
var extConfig = _self.getExtCfg(identifier, null);
|
|
1472
|
-
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1473
|
-
theValue = extConfig[field];
|
|
1474
|
-
}
|
|
1475
|
-
else if (config && !isNullOrUndefined(config[field])) {
|
|
1476
|
-
theValue = config[field];
|
|
1477
|
-
}
|
|
1478
|
-
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1479
|
-
};
|
|
1480
|
-
_self.hasNext = function () {
|
|
1481
|
-
return _nextProxy != null;
|
|
1482
|
-
};
|
|
1483
|
-
_self.getNext = function () {
|
|
1484
|
-
return _nextProxy;
|
|
1485
|
-
};
|
|
1486
|
-
_self.setNext = function (nextPlugin) {
|
|
1487
|
-
_nextProxy = nextPlugin;
|
|
1488
|
-
};
|
|
1489
|
-
_self.processNext = function (env) {
|
|
1490
|
-
var nextPlugin = _nextProxy;
|
|
1491
|
-
if (nextPlugin) {
|
|
1492
|
-
_nextProxy = nextPlugin.getNext();
|
|
1493
|
-
nextPlugin.processTelemetry(env, _self);
|
|
1494
|
-
}
|
|
1495
|
-
};
|
|
1496
|
-
_self.createNew = function (plugins, startAt) {
|
|
1497
|
-
if (plugins === void 0) { plugins = null; }
|
|
1498
|
-
return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1499
|
-
};
|
|
1499
|
+
catch (e) {
|
|
1500
|
+
}
|
|
1500
1501
|
}
|
|
1501
|
-
return
|
|
1502
|
-
}
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
_self.setInitialized = function (isInitialized) {
|
|
1522
|
-
_isinitialized = isInitialized;
|
|
1523
|
-
};
|
|
1524
|
-
_self.setNextPlugin = function (next) {
|
|
1525
|
-
_nextPlugin = next;
|
|
1526
|
-
};
|
|
1527
|
-
_self.processNext = function (env, itemCtx) {
|
|
1528
|
-
if (itemCtx) {
|
|
1529
|
-
itemCtx.processNext(env);
|
|
1530
|
-
}
|
|
1531
|
-
else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
|
|
1532
|
-
_nextPlugin.processTelemetry(env, null);
|
|
1502
|
+
return theCache;
|
|
1503
|
+
}
|
|
1504
|
+
function createUniqueNamespace(name, includeVersion) {
|
|
1505
|
+
if (includeVersion === void 0) { includeVersion = false; }
|
|
1506
|
+
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1507
|
+
}
|
|
1508
|
+
function createElmNodeData(name) {
|
|
1509
|
+
var data = {
|
|
1510
|
+
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1511
|
+
accept: function (target) {
|
|
1512
|
+
return _canAcceptData(target);
|
|
1513
|
+
},
|
|
1514
|
+
get: function (target, name, defValue, addDefault) {
|
|
1515
|
+
var theCache = target[data.id];
|
|
1516
|
+
if (!theCache) {
|
|
1517
|
+
if (addDefault) {
|
|
1518
|
+
theCache = _getCache(data, target);
|
|
1519
|
+
theCache[normalizeJsName(name)] = defValue;
|
|
1520
|
+
}
|
|
1521
|
+
return defValue;
|
|
1533
1522
|
}
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1541
|
-
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
1523
|
+
return theCache[normalizeJsName(name)];
|
|
1524
|
+
},
|
|
1525
|
+
kill: function (target, name) {
|
|
1526
|
+
if (target && target[name]) {
|
|
1527
|
+
try {
|
|
1528
|
+
delete target[name];
|
|
1542
1529
|
}
|
|
1543
|
-
|
|
1544
|
-
itemCtx = rootCtx.createNew(null, _nextPlugin);
|
|
1530
|
+
catch (e) {
|
|
1545
1531
|
}
|
|
1546
1532
|
}
|
|
1547
|
-
|
|
1548
|
-
};
|
|
1549
|
-
_self._baseTelInit = function (config, core, extensions, pluginChain) {
|
|
1550
|
-
if (config) {
|
|
1551
|
-
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
1552
|
-
}
|
|
1553
|
-
if (!pluginChain && core) {
|
|
1554
|
-
pluginChain = core.getProcessTelContext().getNext();
|
|
1555
|
-
}
|
|
1556
|
-
var nextPlugin = _nextPlugin;
|
|
1557
|
-
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1558
|
-
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
1559
|
-
}
|
|
1560
|
-
_self.core = core;
|
|
1561
|
-
_rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
1562
|
-
_isinitialized = true;
|
|
1563
|
-
};
|
|
1564
|
-
}
|
|
1565
|
-
BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
|
|
1566
|
-
this._baseTelInit(config, core, extensions, pluginChain);
|
|
1533
|
+
}
|
|
1567
1534
|
};
|
|
1568
|
-
return
|
|
1569
|
-
}
|
|
1535
|
+
return data;
|
|
1536
|
+
}
|
|
1570
1537
|
|
|
1571
|
-
var
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1538
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1539
|
+
function _getPluginState(plugin) {
|
|
1540
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1541
|
+
}
|
|
1575
1542
|
function initializePlugins(processContext, extensions) {
|
|
1576
1543
|
var initPlugins = [];
|
|
1577
1544
|
var lastPlugin = null;
|
|
1578
1545
|
var proxy = processContext.getNext();
|
|
1546
|
+
var pluginState;
|
|
1579
1547
|
while (proxy) {
|
|
1580
1548
|
var thePlugin = proxy.getPlugin();
|
|
1581
1549
|
if (thePlugin) {
|
|
1582
1550
|
if (lastPlugin &&
|
|
1583
|
-
isFunction(lastPlugin[
|
|
1584
|
-
isFunction(thePlugin[
|
|
1585
|
-
lastPlugin[
|
|
1551
|
+
isFunction(lastPlugin[strSetNextPlugin]) &&
|
|
1552
|
+
isFunction(thePlugin[strProcessTelemetry])) {
|
|
1553
|
+
lastPlugin[strSetNextPlugin](thePlugin);
|
|
1554
|
+
}
|
|
1555
|
+
var isInitialized = false;
|
|
1556
|
+
if (isFunction(thePlugin[strIsInitialized])) {
|
|
1557
|
+
isInitialized = thePlugin[strIsInitialized]();
|
|
1558
|
+
}
|
|
1559
|
+
else {
|
|
1560
|
+
pluginState = _getPluginState(thePlugin);
|
|
1561
|
+
isInitialized = pluginState[strIsInitialized];
|
|
1586
1562
|
}
|
|
1587
|
-
if (!
|
|
1563
|
+
if (!isInitialized) {
|
|
1588
1564
|
initPlugins.push(thePlugin);
|
|
1589
1565
|
}
|
|
1590
1566
|
lastPlugin = thePlugin;
|
|
@@ -1592,15 +1568,22 @@
|
|
|
1592
1568
|
}
|
|
1593
1569
|
}
|
|
1594
1570
|
arrForEach(initPlugins, function (thePlugin) {
|
|
1595
|
-
|
|
1571
|
+
var core = processContext.core();
|
|
1572
|
+
thePlugin.initialize(processContext.getCfg(), core, extensions, processContext.getNext());
|
|
1573
|
+
pluginState = _getPluginState(thePlugin);
|
|
1574
|
+
if (!thePlugin[strCore] && !pluginState[strCore]) {
|
|
1575
|
+
pluginState[strCore] = core;
|
|
1576
|
+
}
|
|
1577
|
+
pluginState[strIsInitialized] = true;
|
|
1578
|
+
delete pluginState[strTeardown];
|
|
1596
1579
|
});
|
|
1597
1580
|
}
|
|
1598
1581
|
function sortPlugins(plugins) {
|
|
1599
1582
|
return plugins.sort(function (extA, extB) {
|
|
1600
1583
|
var result = 0;
|
|
1601
|
-
var bHasProcess = isFunction(extB[
|
|
1602
|
-
if (isFunction(extA[
|
|
1603
|
-
result = bHasProcess ? extA[
|
|
1584
|
+
var bHasProcess = isFunction(extB[strProcessTelemetry]);
|
|
1585
|
+
if (isFunction(extA[strProcessTelemetry])) {
|
|
1586
|
+
result = bHasProcess ? extA[strPriority] - extB[strPriority] : 1;
|
|
1604
1587
|
}
|
|
1605
1588
|
else if (bHasProcess) {
|
|
1606
1589
|
result = -1;
|
|
@@ -1609,80 +1592,350 @@
|
|
|
1609
1592
|
});
|
|
1610
1593
|
}
|
|
1611
1594
|
|
|
1612
|
-
var
|
|
1613
|
-
var
|
|
1614
|
-
var
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
var _channelQueue;
|
|
1621
|
-
dynamicProto(ChannelController, _this, function (_self, _base) {
|
|
1622
|
-
_self.setNextPlugin = function (next) {
|
|
1623
|
-
};
|
|
1624
|
-
_self.processTelemetry = function (item, itemCtx) {
|
|
1625
|
-
if (_channelQueue) {
|
|
1626
|
-
arrForEach(_channelQueue, function (queues) {
|
|
1627
|
-
if (queues.length > 0) {
|
|
1628
|
-
var chainCtx = _this._getTelCtx(itemCtx).createNew(queues);
|
|
1629
|
-
chainCtx.processNext(item);
|
|
1630
|
-
}
|
|
1631
|
-
});
|
|
1632
|
-
}
|
|
1633
|
-
};
|
|
1634
|
-
_self.getChannelControls = function () {
|
|
1635
|
-
return _channelQueue;
|
|
1636
|
-
};
|
|
1637
|
-
_self.initialize = function (config, core, extensions) {
|
|
1638
|
-
if (_self.isInitialized()) {
|
|
1639
|
-
return;
|
|
1640
|
-
}
|
|
1641
|
-
_base.initialize(config, core, extensions);
|
|
1642
|
-
_createChannelQueues((config || {}).channels, extensions);
|
|
1643
|
-
arrForEach(_channelQueue, function (queue) { return initializePlugins(new ProcessTelemetryContext(queue, config, core), extensions); });
|
|
1644
|
-
};
|
|
1645
|
-
});
|
|
1646
|
-
function _checkQueuePriority(queue) {
|
|
1647
|
-
arrForEach(queue, function (queueItem) {
|
|
1648
|
-
if (queueItem.priority < ChannelControllerPriority) {
|
|
1649
|
-
throwError(ChannelValidationMessage + queueItem.identifier);
|
|
1650
|
-
}
|
|
1651
|
-
});
|
|
1652
|
-
}
|
|
1653
|
-
function _addChannelQueue(queue) {
|
|
1654
|
-
if (queue && queue.length > 0) {
|
|
1655
|
-
queue = queue.sort(function (a, b) {
|
|
1656
|
-
return a.priority - b.priority;
|
|
1657
|
-
});
|
|
1658
|
-
_checkQueuePriority(queue);
|
|
1659
|
-
_channelQueue.push(queue);
|
|
1660
|
-
}
|
|
1595
|
+
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1596
|
+
var strHasRunFlags = "_hasRun";
|
|
1597
|
+
var strGetTelCtx = "_getTelCtx";
|
|
1598
|
+
var _chainId = 0;
|
|
1599
|
+
function _getNextProxyStart(proxy, config, core, startAt) {
|
|
1600
|
+
while (proxy) {
|
|
1601
|
+
if (proxy.getPlugin() === startAt) {
|
|
1602
|
+
return proxy;
|
|
1661
1603
|
}
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1604
|
+
proxy = proxy.getNext();
|
|
1605
|
+
}
|
|
1606
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1607
|
+
}
|
|
1608
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1609
|
+
var _nextProxy = null;
|
|
1610
|
+
var _onComplete = [];
|
|
1611
|
+
if (startAt !== null) {
|
|
1612
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1613
|
+
}
|
|
1614
|
+
var context = {
|
|
1615
|
+
_next: _moveNext,
|
|
1616
|
+
ctx: {
|
|
1617
|
+
core: function () {
|
|
1618
|
+
return core;
|
|
1619
|
+
},
|
|
1620
|
+
diagLog: function () {
|
|
1621
|
+
return safeGetLogger(core, config);
|
|
1622
|
+
},
|
|
1623
|
+
getCfg: function () {
|
|
1624
|
+
return config;
|
|
1625
|
+
},
|
|
1626
|
+
getExtCfg: _getExtCfg,
|
|
1627
|
+
getConfig: _getConfig,
|
|
1628
|
+
hasNext: function () {
|
|
1629
|
+
return !!_nextProxy;
|
|
1630
|
+
},
|
|
1631
|
+
getNext: function () {
|
|
1632
|
+
return _nextProxy;
|
|
1633
|
+
},
|
|
1634
|
+
setNext: function (nextPlugin) {
|
|
1635
|
+
_nextProxy = nextPlugin;
|
|
1636
|
+
},
|
|
1637
|
+
iterate: _iterateChain,
|
|
1638
|
+
onComplete: _addOnComplete
|
|
1639
|
+
}
|
|
1640
|
+
};
|
|
1641
|
+
function _addOnComplete(onComplete, that) {
|
|
1642
|
+
var args = [];
|
|
1643
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1644
|
+
args[_i - 2] = arguments[_i];
|
|
1645
|
+
}
|
|
1646
|
+
if (onComplete) {
|
|
1647
|
+
_onComplete.push({
|
|
1648
|
+
func: onComplete,
|
|
1649
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1650
|
+
args: args
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
function _moveNext() {
|
|
1655
|
+
var nextProxy = _nextProxy;
|
|
1656
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1657
|
+
if (!nextProxy) {
|
|
1658
|
+
var onComplete = _onComplete;
|
|
1659
|
+
if (onComplete && onComplete.length > 0) {
|
|
1660
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
1661
|
+
try {
|
|
1662
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1663
|
+
}
|
|
1664
|
+
catch (e) {
|
|
1665
|
+
_throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1672
1666
|
}
|
|
1673
1667
|
});
|
|
1674
|
-
|
|
1668
|
+
_onComplete = [];
|
|
1675
1669
|
}
|
|
1676
1670
|
}
|
|
1677
|
-
return
|
|
1671
|
+
return nextProxy;
|
|
1678
1672
|
}
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1673
|
+
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1674
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1675
|
+
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
1676
|
+
var theConfig;
|
|
1677
|
+
if (config) {
|
|
1678
|
+
var extConfig = config.extensionConfig;
|
|
1679
|
+
if (extConfig && identifier) {
|
|
1680
|
+
theConfig = extConfig[identifier];
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
if (!theConfig) {
|
|
1684
|
+
theConfig = defaultValue;
|
|
1685
|
+
}
|
|
1686
|
+
else if (isObject(defaultValue)) {
|
|
1687
|
+
if (mergeDefault !== 0 ) {
|
|
1688
|
+
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1689
|
+
if (config && mergeDefault === 2 ) {
|
|
1690
|
+
objForEachKey(defaultValue, function (field) {
|
|
1691
|
+
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1692
|
+
var cfgValue = config[field];
|
|
1693
|
+
if (!isNullOrUndefined(cfgValue)) {
|
|
1694
|
+
newConfig_1[field] = cfgValue;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
return theConfig;
|
|
1702
|
+
}
|
|
1703
|
+
function _getConfig(identifier, field, defaultValue) {
|
|
1704
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
1705
|
+
var theValue;
|
|
1706
|
+
var extConfig = _getExtCfg(identifier, null);
|
|
1707
|
+
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1708
|
+
theValue = extConfig[field];
|
|
1709
|
+
}
|
|
1710
|
+
else if (config && !isNullOrUndefined(config[field])) {
|
|
1711
|
+
theValue = config[field];
|
|
1712
|
+
}
|
|
1713
|
+
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1714
|
+
}
|
|
1715
|
+
function _iterateChain(cb) {
|
|
1716
|
+
var nextPlugin;
|
|
1717
|
+
while (!!(nextPlugin = context._next())) {
|
|
1718
|
+
var plugin = nextPlugin.getPlugin();
|
|
1719
|
+
if (plugin) {
|
|
1720
|
+
cb(plugin);
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
return context;
|
|
1725
|
+
}
|
|
1726
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1727
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1728
|
+
var context = internalContext.ctx;
|
|
1729
|
+
function _processNext(env) {
|
|
1730
|
+
var nextPlugin = internalContext._next();
|
|
1731
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1732
|
+
return !nextPlugin;
|
|
1733
|
+
}
|
|
1734
|
+
function _createNew(plugins, startAt) {
|
|
1735
|
+
if (plugins === void 0) { plugins = null; }
|
|
1736
|
+
if (isArray(plugins)) {
|
|
1737
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1738
|
+
}
|
|
1739
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1740
|
+
}
|
|
1741
|
+
context.processNext = _processNext;
|
|
1742
|
+
context.createNew = _createNew;
|
|
1743
|
+
return context;
|
|
1744
|
+
}
|
|
1745
|
+
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1746
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1747
|
+
var context = internalContext.ctx;
|
|
1748
|
+
function _processNext(unloadState) {
|
|
1749
|
+
var nextPlugin = internalContext._next();
|
|
1750
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1751
|
+
return !nextPlugin;
|
|
1752
|
+
}
|
|
1753
|
+
function _createNew(plugins, startAt) {
|
|
1754
|
+
if (plugins === void 0) { plugins = null; }
|
|
1755
|
+
if (isArray(plugins)) {
|
|
1756
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1757
|
+
}
|
|
1758
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1759
|
+
}
|
|
1760
|
+
context.processNext = _processNext;
|
|
1761
|
+
context.createNew = _createNew;
|
|
1762
|
+
return context;
|
|
1763
|
+
}
|
|
1764
|
+
function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
|
|
1765
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1766
|
+
var context = internalContext.ctx;
|
|
1767
|
+
function _processNext(updateState) {
|
|
1768
|
+
return context.iterate(function (plugin) {
|
|
1769
|
+
if (isFunction(plugin[strUpdate])) {
|
|
1770
|
+
plugin[strUpdate](context, updateState);
|
|
1771
|
+
}
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
function _createNew(plugins, startAt) {
|
|
1775
|
+
if (plugins === void 0) { plugins = null; }
|
|
1776
|
+
if (isArray(plugins)) {
|
|
1777
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1778
|
+
}
|
|
1779
|
+
return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
|
|
1780
|
+
}
|
|
1781
|
+
context.processNext = _processNext;
|
|
1782
|
+
context.createNew = _createNew;
|
|
1783
|
+
return context;
|
|
1784
|
+
}
|
|
1785
|
+
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
1786
|
+
var firstProxy = null;
|
|
1787
|
+
var add = startAt ? false : true;
|
|
1788
|
+
if (isArray(plugins) && plugins.length > 0) {
|
|
1789
|
+
var lastProxy_1 = null;
|
|
1790
|
+
arrForEach(plugins, function (thePlugin) {
|
|
1791
|
+
if (!add && startAt === thePlugin) {
|
|
1792
|
+
add = true;
|
|
1793
|
+
}
|
|
1794
|
+
if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1795
|
+
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
1796
|
+
if (!firstProxy) {
|
|
1797
|
+
firstProxy = newProxy;
|
|
1798
|
+
}
|
|
1799
|
+
if (lastProxy_1) {
|
|
1800
|
+
lastProxy_1._setNext(newProxy);
|
|
1801
|
+
}
|
|
1802
|
+
lastProxy_1 = newProxy;
|
|
1803
|
+
}
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
if (startAt && !firstProxy) {
|
|
1807
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1808
|
+
}
|
|
1809
|
+
return firstProxy;
|
|
1810
|
+
}
|
|
1811
|
+
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1812
|
+
var nextProxy = null;
|
|
1813
|
+
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1814
|
+
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1815
|
+
var chainId;
|
|
1816
|
+
if (plugin) {
|
|
1817
|
+
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1818
|
+
}
|
|
1819
|
+
else {
|
|
1820
|
+
chainId = "Unknown-0-" + _chainId++;
|
|
1821
|
+
}
|
|
1822
|
+
var proxyChain = {
|
|
1823
|
+
getPlugin: function () {
|
|
1824
|
+
return plugin;
|
|
1825
|
+
},
|
|
1826
|
+
getNext: function () {
|
|
1827
|
+
return nextProxy;
|
|
1828
|
+
},
|
|
1829
|
+
processTelemetry: _processTelemetry,
|
|
1830
|
+
unload: _unloadPlugin,
|
|
1831
|
+
update: _updatePlugin,
|
|
1832
|
+
_id: chainId,
|
|
1833
|
+
_setNext: function (nextPlugin) {
|
|
1834
|
+
nextProxy = nextPlugin;
|
|
1835
|
+
}
|
|
1836
|
+
};
|
|
1837
|
+
function _getTelCtx() {
|
|
1838
|
+
var itemCtx;
|
|
1839
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1840
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1841
|
+
}
|
|
1842
|
+
if (!itemCtx) {
|
|
1843
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1844
|
+
}
|
|
1845
|
+
return itemCtx;
|
|
1846
|
+
}
|
|
1847
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1848
|
+
var hasRun = false;
|
|
1849
|
+
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1850
|
+
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1851
|
+
if (!hasRunContext) {
|
|
1852
|
+
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1853
|
+
}
|
|
1854
|
+
itemCtx.setNext(nextProxy);
|
|
1855
|
+
if (plugin) {
|
|
1856
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1857
|
+
hasRunContext[chainId] = true;
|
|
1858
|
+
try {
|
|
1859
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty$1;
|
|
1860
|
+
if (nextId) {
|
|
1861
|
+
hasRunContext[nextId] = false;
|
|
1862
|
+
}
|
|
1863
|
+
hasRun = processPluginFn(itemCtx);
|
|
1864
|
+
}
|
|
1865
|
+
catch (error) {
|
|
1866
|
+
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1867
|
+
if (hasNextRun) {
|
|
1868
|
+
hasRun = true;
|
|
1869
|
+
}
|
|
1870
|
+
if (!nextProxy || !hasNextRun) {
|
|
1871
|
+
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
}, details, isAsync);
|
|
1875
|
+
}
|
|
1876
|
+
return hasRun;
|
|
1877
|
+
}
|
|
1878
|
+
function _processTelemetry(env, itemCtx) {
|
|
1879
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
1880
|
+
function _callProcessTelemetry(itemCtx) {
|
|
1881
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
1882
|
+
return false;
|
|
1883
|
+
}
|
|
1884
|
+
var pluginState = _getPluginState(plugin);
|
|
1885
|
+
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
1886
|
+
return false;
|
|
1887
|
+
}
|
|
1888
|
+
if (hasSetNext) {
|
|
1889
|
+
plugin.setNextPlugin(nextProxy);
|
|
1890
|
+
}
|
|
1891
|
+
plugin.processTelemetry(env, itemCtx);
|
|
1892
|
+
return true;
|
|
1893
|
+
}
|
|
1894
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1895
|
+
itemCtx.processNext(env);
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1899
|
+
function _callTeardown() {
|
|
1900
|
+
var hasRun = false;
|
|
1901
|
+
if (plugin) {
|
|
1902
|
+
var pluginState = _getPluginState(plugin);
|
|
1903
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1904
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1905
|
+
pluginState[strCore] = null;
|
|
1906
|
+
pluginState[strTeardown] = true;
|
|
1907
|
+
pluginState[strIsInitialized] = false;
|
|
1908
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1909
|
+
hasRun = true;
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
return hasRun;
|
|
1914
|
+
}
|
|
1915
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1916
|
+
unloadCtx.processNext(unloadState);
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
function _updatePlugin(updateCtx, updateState) {
|
|
1920
|
+
function _callUpdate() {
|
|
1921
|
+
var hasRun = false;
|
|
1922
|
+
if (plugin) {
|
|
1923
|
+
var pluginState = _getPluginState(plugin);
|
|
1924
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1925
|
+
if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1926
|
+
if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
|
|
1927
|
+
hasRun = true;
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
return hasRun;
|
|
1932
|
+
}
|
|
1933
|
+
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
1934
|
+
updateCtx.processNext(updateState);
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
return objFreeze(proxyChain);
|
|
1938
|
+
}
|
|
1686
1939
|
|
|
1687
1940
|
var strToGMTString = "toGMTString";
|
|
1688
1941
|
var strToUTCString = "toUTCString";
|
|
@@ -1692,7 +1945,6 @@
|
|
|
1692
1945
|
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
1693
1946
|
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
1694
1947
|
var strConfigCookieMgr = "_ckMgr";
|
|
1695
|
-
var strEmpty = "";
|
|
1696
1948
|
var _supportsCookies = null;
|
|
1697
1949
|
var _allowUaSameSite = null;
|
|
1698
1950
|
var _parsedCookieValue = null;
|
|
@@ -1750,7 +2002,7 @@
|
|
|
1750
2002
|
var result = false;
|
|
1751
2003
|
if (_isMgrEnabled(cookieMgr)) {
|
|
1752
2004
|
var values = {};
|
|
1753
|
-
var theValue = strTrim(value || strEmpty);
|
|
2005
|
+
var theValue = strTrim(value || strEmpty$1);
|
|
1754
2006
|
var idx = theValue.indexOf(";");
|
|
1755
2007
|
if (idx !== -1) {
|
|
1756
2008
|
theValue = strTrim(value.substring(0, idx));
|
|
@@ -1765,11 +2017,11 @@
|
|
|
1765
2017
|
if (expireMs > 0) {
|
|
1766
2018
|
var expiry = new Date();
|
|
1767
2019
|
expiry.setTime(expireMs);
|
|
1768
|
-
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
|
|
2020
|
+
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty$1, isTruthy);
|
|
1769
2021
|
}
|
|
1770
2022
|
}
|
|
1771
2023
|
if (!_isIE) {
|
|
1772
|
-
setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
|
|
2024
|
+
setValue(values, "max-age", strEmpty$1 + maxAgeSec, null, isUndefined);
|
|
1773
2025
|
}
|
|
1774
2026
|
}
|
|
1775
2027
|
var location_1 = getLocation();
|
|
@@ -1790,7 +2042,7 @@
|
|
|
1790
2042
|
return result;
|
|
1791
2043
|
},
|
|
1792
2044
|
get: function (name) {
|
|
1793
|
-
var value = strEmpty;
|
|
2045
|
+
var value = strEmpty$1;
|
|
1794
2046
|
if (_isMgrEnabled(cookieMgr)) {
|
|
1795
2047
|
value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
|
|
1796
2048
|
}
|
|
@@ -1815,7 +2067,7 @@
|
|
|
1815
2067
|
values["max-age"] = "0";
|
|
1816
2068
|
}
|
|
1817
2069
|
var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
|
|
1818
|
-
delCookie(name, _formatCookieValue(strEmpty, values));
|
|
2070
|
+
delCookie(name, _formatCookieValue(strEmpty$1, values));
|
|
1819
2071
|
result = true;
|
|
1820
2072
|
}
|
|
1821
2073
|
return result;
|
|
@@ -1832,7 +2084,7 @@
|
|
|
1832
2084
|
_supportsCookies = doc[strCookie] !== undefined;
|
|
1833
2085
|
}
|
|
1834
2086
|
catch (e) {
|
|
1835
|
-
logger
|
|
2087
|
+
_throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1836
2088
|
}
|
|
1837
2089
|
}
|
|
1838
2090
|
return _supportsCookies;
|
|
@@ -1842,7 +2094,7 @@
|
|
|
1842
2094
|
if (theValue && theValue.length) {
|
|
1843
2095
|
var parts = strTrim(theValue).split(";");
|
|
1844
2096
|
arrForEach(parts, function (thePart) {
|
|
1845
|
-
thePart = strTrim(thePart || strEmpty);
|
|
2097
|
+
thePart = strTrim(thePart || strEmpty$1);
|
|
1846
2098
|
if (thePart) {
|
|
1847
2099
|
var idx = thePart.indexOf("=");
|
|
1848
2100
|
if (idx === -1) {
|
|
@@ -1863,21 +2115,21 @@
|
|
|
1863
2115
|
return null;
|
|
1864
2116
|
}
|
|
1865
2117
|
function _formatCookieValue(value, values) {
|
|
1866
|
-
var cookieValue = value || strEmpty;
|
|
2118
|
+
var cookieValue = value || strEmpty$1;
|
|
1867
2119
|
objForEachKey(values, function (name, theValue) {
|
|
1868
|
-
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
|
|
2120
|
+
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty$1);
|
|
1869
2121
|
});
|
|
1870
2122
|
return cookieValue;
|
|
1871
2123
|
}
|
|
1872
2124
|
function _getCookieValue(name) {
|
|
1873
|
-
var cookieValue = strEmpty;
|
|
2125
|
+
var cookieValue = strEmpty$1;
|
|
1874
2126
|
if (_doc) {
|
|
1875
|
-
var theCookie = _doc[strCookie] || strEmpty;
|
|
2127
|
+
var theCookie = _doc[strCookie] || strEmpty$1;
|
|
1876
2128
|
if (_parsedCookieValue !== theCookie) {
|
|
1877
2129
|
_cookieCache = _extractParts(theCookie);
|
|
1878
2130
|
_parsedCookieValue = theCookie;
|
|
1879
2131
|
}
|
|
1880
|
-
cookieValue = strTrim(_cookieCache[name] || strEmpty);
|
|
2132
|
+
cookieValue = strTrim(_cookieCache[name] || strEmpty$1);
|
|
1881
2133
|
}
|
|
1882
2134
|
return cookieValue;
|
|
1883
2135
|
}
|
|
@@ -1911,26 +2163,519 @@
|
|
|
1911
2163
|
return false;
|
|
1912
2164
|
}
|
|
1913
2165
|
|
|
1914
|
-
var
|
|
2166
|
+
var strIKey = "iKey";
|
|
2167
|
+
var strExtensionConfig = "extensionConfig";
|
|
2168
|
+
|
|
2169
|
+
var ChannelControllerPriority = 500;
|
|
2170
|
+
var ChannelValidationMessage = "Channel has invalid priority - ";
|
|
2171
|
+
function _addChannelQueue(channelQueue, queue, config, core) {
|
|
2172
|
+
if (queue && isArray(queue) && queue.length > 0) {
|
|
2173
|
+
queue = queue.sort(function (a, b) {
|
|
2174
|
+
return a.priority - b.priority;
|
|
2175
|
+
});
|
|
2176
|
+
arrForEach(queue, function (queueItem) {
|
|
2177
|
+
if (queueItem.priority < ChannelControllerPriority) {
|
|
2178
|
+
throwError(ChannelValidationMessage + queueItem.identifier);
|
|
2179
|
+
}
|
|
2180
|
+
});
|
|
2181
|
+
channelQueue.push({
|
|
2182
|
+
queue: objFreeze(queue),
|
|
2183
|
+
chain: createTelemetryProxyChain(queue, config, core)
|
|
2184
|
+
});
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
function createChannelControllerPlugin(channelQueue, core) {
|
|
2188
|
+
var _a;
|
|
2189
|
+
function _getTelCtx() {
|
|
2190
|
+
return createProcessTelemetryContext(null, core.config, core, null);
|
|
2191
|
+
}
|
|
2192
|
+
function _processChannelQueue(theChannels, itemCtx, processFn, onComplete) {
|
|
2193
|
+
var waiting = theChannels ? (theChannels.length + 1) : 1;
|
|
2194
|
+
function _runChainOnComplete() {
|
|
2195
|
+
waiting--;
|
|
2196
|
+
if (waiting === 0) {
|
|
2197
|
+
onComplete && onComplete();
|
|
2198
|
+
onComplete = null;
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
if (waiting > 0) {
|
|
2202
|
+
arrForEach(theChannels, function (channels) {
|
|
2203
|
+
if (channels && channels.queue.length > 0) {
|
|
2204
|
+
var channelChain = channels.chain;
|
|
2205
|
+
var chainCtx = itemCtx.createNew(channelChain);
|
|
2206
|
+
chainCtx.onComplete(_runChainOnComplete);
|
|
2207
|
+
processFn(chainCtx);
|
|
2208
|
+
}
|
|
2209
|
+
else {
|
|
2210
|
+
waiting--;
|
|
2211
|
+
}
|
|
2212
|
+
});
|
|
2213
|
+
}
|
|
2214
|
+
_runChainOnComplete();
|
|
2215
|
+
}
|
|
2216
|
+
function _doUpdate(updateCtx, updateState) {
|
|
2217
|
+
var theUpdateState = updateState || {
|
|
2218
|
+
reason: 0
|
|
2219
|
+
};
|
|
2220
|
+
_processChannelQueue(channelQueue, updateCtx, function (chainCtx) {
|
|
2221
|
+
chainCtx[strProcessNext](theUpdateState);
|
|
2222
|
+
}, function () {
|
|
2223
|
+
updateCtx[strProcessNext](theUpdateState);
|
|
2224
|
+
});
|
|
2225
|
+
return true;
|
|
2226
|
+
}
|
|
2227
|
+
function _doTeardown(unloadCtx, unloadState) {
|
|
2228
|
+
var theUnloadState = unloadState || {
|
|
2229
|
+
reason: 0 ,
|
|
2230
|
+
isAsync: false
|
|
2231
|
+
};
|
|
2232
|
+
_processChannelQueue(channelQueue, unloadCtx, function (chainCtx) {
|
|
2233
|
+
chainCtx[strProcessNext](theUnloadState);
|
|
2234
|
+
}, function () {
|
|
2235
|
+
unloadCtx[strProcessNext](theUnloadState);
|
|
2236
|
+
isInitialized = false;
|
|
2237
|
+
});
|
|
2238
|
+
return true;
|
|
2239
|
+
}
|
|
2240
|
+
function _getChannel(pluginIdentifier) {
|
|
2241
|
+
var thePlugin = null;
|
|
2242
|
+
if (channelQueue && channelQueue.length > 0) {
|
|
2243
|
+
arrForEach(channelQueue, function (channels) {
|
|
2244
|
+
if (channels && channels.queue.length > 0) {
|
|
2245
|
+
arrForEach(channels.queue, function (ext) {
|
|
2246
|
+
if (ext.identifier === pluginIdentifier) {
|
|
2247
|
+
thePlugin = ext;
|
|
2248
|
+
return -1;
|
|
2249
|
+
}
|
|
2250
|
+
});
|
|
2251
|
+
if (thePlugin) {
|
|
2252
|
+
return -1;
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
});
|
|
2256
|
+
}
|
|
2257
|
+
return thePlugin;
|
|
2258
|
+
}
|
|
2259
|
+
var isInitialized = false;
|
|
2260
|
+
var channelController = (_a = {
|
|
2261
|
+
identifier: "ChannelControllerPlugin",
|
|
2262
|
+
priority: ChannelControllerPriority,
|
|
2263
|
+
initialize: function (config, core, extensions, pluginChain) {
|
|
2264
|
+
isInitialized = true;
|
|
2265
|
+
arrForEach(channelQueue, function (channels) {
|
|
2266
|
+
if (channels && channels.queue.length > 0) {
|
|
2267
|
+
initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);
|
|
2268
|
+
}
|
|
2269
|
+
});
|
|
2270
|
+
},
|
|
2271
|
+
isInitialized: function () {
|
|
2272
|
+
return isInitialized;
|
|
2273
|
+
},
|
|
2274
|
+
processTelemetry: function (item, itemCtx) {
|
|
2275
|
+
_processChannelQueue(channelQueue, itemCtx || _getTelCtx(), function (chainCtx) {
|
|
2276
|
+
chainCtx[strProcessNext](item);
|
|
2277
|
+
}, function () {
|
|
2278
|
+
itemCtx[strProcessNext](item);
|
|
2279
|
+
});
|
|
2280
|
+
},
|
|
2281
|
+
update: _doUpdate
|
|
2282
|
+
},
|
|
2283
|
+
_a[strPause] = function () {
|
|
2284
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2285
|
+
chainCtx.iterate(function (plugin) {
|
|
2286
|
+
plugin[strPause] && plugin[strPause]();
|
|
2287
|
+
});
|
|
2288
|
+
}, null);
|
|
2289
|
+
},
|
|
2290
|
+
_a[strResume] = function () {
|
|
2291
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2292
|
+
chainCtx.iterate(function (plugin) {
|
|
2293
|
+
plugin[strResume] && plugin[strResume]();
|
|
2294
|
+
});
|
|
2295
|
+
}, null);
|
|
2296
|
+
},
|
|
2297
|
+
_a[strTeardown] = _doTeardown,
|
|
2298
|
+
_a.getChannel = _getChannel,
|
|
2299
|
+
_a.flush = function (isAsync, callBack, sendReason, cbTimeout) {
|
|
2300
|
+
var waiting = 1;
|
|
2301
|
+
var doneIterating = false;
|
|
2302
|
+
var cbTimer = null;
|
|
2303
|
+
cbTimeout = cbTimeout || 5000;
|
|
2304
|
+
function doCallback() {
|
|
2305
|
+
waiting--;
|
|
2306
|
+
if (doneIterating && waiting === 0) {
|
|
2307
|
+
if (cbTimer) {
|
|
2308
|
+
clearTimeout(cbTimer);
|
|
2309
|
+
cbTimer = null;
|
|
2310
|
+
}
|
|
2311
|
+
callBack && callBack(doneIterating);
|
|
2312
|
+
callBack = null;
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2316
|
+
chainCtx.iterate(function (plugin) {
|
|
2317
|
+
if (plugin.flush) {
|
|
2318
|
+
waiting++;
|
|
2319
|
+
var handled_1 = false;
|
|
2320
|
+
if (!plugin.flush(isAsync, function () {
|
|
2321
|
+
handled_1 = true;
|
|
2322
|
+
doCallback();
|
|
2323
|
+
}, sendReason)) {
|
|
2324
|
+
if (!handled_1) {
|
|
2325
|
+
if (isAsync && cbTimer == null) {
|
|
2326
|
+
cbTimer = setTimeout(function () {
|
|
2327
|
+
cbTimer = null;
|
|
2328
|
+
doCallback();
|
|
2329
|
+
}, cbTimeout);
|
|
2330
|
+
}
|
|
2331
|
+
else {
|
|
2332
|
+
doCallback();
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
});
|
|
2338
|
+
}, function () {
|
|
2339
|
+
doneIterating = true;
|
|
2340
|
+
doCallback();
|
|
2341
|
+
});
|
|
2342
|
+
return true;
|
|
2343
|
+
},
|
|
2344
|
+
_a._setQueue = function (queue) {
|
|
2345
|
+
channelQueue = queue;
|
|
2346
|
+
},
|
|
2347
|
+
_a);
|
|
2348
|
+
return channelController;
|
|
2349
|
+
}
|
|
2350
|
+
function createChannelQueues(channels, extensions, config, core) {
|
|
2351
|
+
var channelQueue = [];
|
|
2352
|
+
if (channels) {
|
|
2353
|
+
arrForEach(channels, function (queue) { return _addChannelQueue(channelQueue, queue, config, core); });
|
|
2354
|
+
}
|
|
2355
|
+
if (extensions) {
|
|
2356
|
+
var extensionQueue_1 = [];
|
|
2357
|
+
arrForEach(extensions, function (plugin) {
|
|
2358
|
+
if (plugin.priority > ChannelControllerPriority) {
|
|
2359
|
+
extensionQueue_1.push(plugin);
|
|
2360
|
+
}
|
|
2361
|
+
});
|
|
2362
|
+
_addChannelQueue(channelQueue, extensionQueue_1, config, core);
|
|
2363
|
+
}
|
|
2364
|
+
return channelQueue;
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
function createUnloadHandlerContainer() {
|
|
2368
|
+
var handlers = [];
|
|
2369
|
+
function _addHandler(handler) {
|
|
2370
|
+
if (handler) {
|
|
2371
|
+
handlers.push(handler);
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
2375
|
+
arrForEach(handlers, function (handler) {
|
|
2376
|
+
try {
|
|
2377
|
+
handler(unloadCtx, unloadState);
|
|
2378
|
+
}
|
|
2379
|
+
catch (e) {
|
|
2380
|
+
_throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
2381
|
+
}
|
|
2382
|
+
});
|
|
2383
|
+
handlers = [];
|
|
2384
|
+
}
|
|
2385
|
+
return {
|
|
2386
|
+
add: _addHandler,
|
|
2387
|
+
run: _runHandlers
|
|
2388
|
+
};
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
var strGetPlugin = "getPlugin";
|
|
2392
|
+
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
2393
|
+
function BaseTelemetryPlugin() {
|
|
2394
|
+
var _self = this;
|
|
2395
|
+
var _isinitialized;
|
|
2396
|
+
var _rootCtx;
|
|
2397
|
+
var _nextPlugin;
|
|
2398
|
+
var _unloadHandlerContainer;
|
|
2399
|
+
var _hooks;
|
|
2400
|
+
_initDefaults();
|
|
2401
|
+
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
2402
|
+
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
2403
|
+
_setDefaults(config, core, pluginChain);
|
|
2404
|
+
_isinitialized = true;
|
|
2405
|
+
};
|
|
2406
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
2407
|
+
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
2408
|
+
return;
|
|
2409
|
+
}
|
|
2410
|
+
var result;
|
|
2411
|
+
var unloadDone = false;
|
|
2412
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
2413
|
+
var theUnloadState = unloadState || {
|
|
2414
|
+
reason: 0 ,
|
|
2415
|
+
isAsync: false
|
|
2416
|
+
};
|
|
2417
|
+
function _unloadCallback() {
|
|
2418
|
+
if (!unloadDone) {
|
|
2419
|
+
unloadDone = true;
|
|
2420
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
2421
|
+
arrForEach(_hooks, function (fn) {
|
|
2422
|
+
fn.rm();
|
|
2423
|
+
});
|
|
2424
|
+
_hooks = [];
|
|
2425
|
+
if (result === true) {
|
|
2426
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
2427
|
+
}
|
|
2428
|
+
_initDefaults();
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
2432
|
+
_unloadCallback();
|
|
2433
|
+
}
|
|
2434
|
+
else {
|
|
2435
|
+
result = true;
|
|
2436
|
+
}
|
|
2437
|
+
return result;
|
|
2438
|
+
};
|
|
2439
|
+
_self.update = function (updateCtx, updateState) {
|
|
2440
|
+
if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
|
|
2441
|
+
return;
|
|
2442
|
+
}
|
|
2443
|
+
var result;
|
|
2444
|
+
var updateDone = false;
|
|
2445
|
+
var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
2446
|
+
var theUpdateState = updateState || {
|
|
2447
|
+
reason: 0
|
|
2448
|
+
};
|
|
2449
|
+
function _updateCallback() {
|
|
2450
|
+
if (!updateDone) {
|
|
2451
|
+
updateDone = true;
|
|
2452
|
+
_setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
|
|
2456
|
+
_updateCallback();
|
|
2457
|
+
}
|
|
2458
|
+
else {
|
|
2459
|
+
result = true;
|
|
2460
|
+
}
|
|
2461
|
+
return result;
|
|
2462
|
+
};
|
|
2463
|
+
_self._addHook = function (hooks) {
|
|
2464
|
+
if (hooks) {
|
|
2465
|
+
if (isArray(hooks)) {
|
|
2466
|
+
_hooks = _hooks.concat(hooks);
|
|
2467
|
+
}
|
|
2468
|
+
else {
|
|
2469
|
+
_hooks.push(hooks);
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
};
|
|
2473
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
2474
|
+
});
|
|
2475
|
+
_self.diagLog = function (itemCtx) {
|
|
2476
|
+
return _getTelCtx(itemCtx).diagLog();
|
|
2477
|
+
};
|
|
2478
|
+
_self[strIsInitialized] = function () {
|
|
2479
|
+
return _isinitialized;
|
|
2480
|
+
};
|
|
2481
|
+
_self.setInitialized = function (isInitialized) {
|
|
2482
|
+
_isinitialized = isInitialized;
|
|
2483
|
+
};
|
|
2484
|
+
_self[strSetNextPlugin] = function (next) {
|
|
2485
|
+
_nextPlugin = next;
|
|
2486
|
+
};
|
|
2487
|
+
_self.processNext = function (env, itemCtx) {
|
|
2488
|
+
if (itemCtx) {
|
|
2489
|
+
itemCtx.processNext(env);
|
|
2490
|
+
}
|
|
2491
|
+
else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
|
|
2492
|
+
_nextPlugin.processTelemetry(env, null);
|
|
2493
|
+
}
|
|
2494
|
+
};
|
|
2495
|
+
_self._getTelCtx = _getTelCtx;
|
|
2496
|
+
function _getTelCtx(currentCtx) {
|
|
2497
|
+
if (currentCtx === void 0) { currentCtx = null; }
|
|
2498
|
+
var itemCtx = currentCtx;
|
|
2499
|
+
if (!itemCtx) {
|
|
2500
|
+
var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
|
|
2501
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
2502
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
2503
|
+
}
|
|
2504
|
+
else {
|
|
2505
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin);
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
return itemCtx;
|
|
2509
|
+
}
|
|
2510
|
+
function _setDefaults(config, core, pluginChain) {
|
|
2511
|
+
if (config) {
|
|
2512
|
+
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
2513
|
+
}
|
|
2514
|
+
if (!pluginChain && core) {
|
|
2515
|
+
pluginChain = core.getProcessTelContext().getNext();
|
|
2516
|
+
}
|
|
2517
|
+
var nextPlugin = _nextPlugin;
|
|
2518
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
2519
|
+
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
2520
|
+
}
|
|
2521
|
+
_self.core = core;
|
|
2522
|
+
_rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
2523
|
+
}
|
|
2524
|
+
function _initDefaults() {
|
|
2525
|
+
_isinitialized = false;
|
|
2526
|
+
_self.core = null;
|
|
2527
|
+
_rootCtx = null;
|
|
2528
|
+
_nextPlugin = null;
|
|
2529
|
+
_hooks = [];
|
|
2530
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
return BaseTelemetryPlugin;
|
|
2534
|
+
}());
|
|
2535
|
+
|
|
2536
|
+
var TelemetryInitializerPlugin = /** @class */ (function (_super) {
|
|
2537
|
+
__extendsFn(TelemetryInitializerPlugin, _super);
|
|
2538
|
+
function TelemetryInitializerPlugin() {
|
|
2539
|
+
var _this = _super.call(this) || this;
|
|
2540
|
+
_this.identifier = "TelemetryInitializerPlugin";
|
|
2541
|
+
_this.priority = 199;
|
|
2542
|
+
var _id;
|
|
2543
|
+
var _initializers;
|
|
2544
|
+
_initDefaults();
|
|
2545
|
+
dynamicProto(TelemetryInitializerPlugin, _this, function (_self, _base) {
|
|
2546
|
+
_self.addTelemetryInitializer = function (telemetryInitializer) {
|
|
2547
|
+
var theInitializer = {
|
|
2548
|
+
id: _id++,
|
|
2549
|
+
fn: telemetryInitializer
|
|
2550
|
+
};
|
|
2551
|
+
_initializers.push(theInitializer);
|
|
2552
|
+
var handler = {
|
|
2553
|
+
remove: function () {
|
|
2554
|
+
arrForEach(_initializers, function (initializer, idx) {
|
|
2555
|
+
if (initializer.id === theInitializer.id) {
|
|
2556
|
+
_initializers.splice(idx, 1);
|
|
2557
|
+
return -1;
|
|
2558
|
+
}
|
|
2559
|
+
});
|
|
2560
|
+
}
|
|
2561
|
+
};
|
|
2562
|
+
return handler;
|
|
2563
|
+
};
|
|
2564
|
+
_self.processTelemetry = function (item, itemCtx) {
|
|
2565
|
+
var doNotSendItem = false;
|
|
2566
|
+
var telemetryInitializersCount = _initializers.length;
|
|
2567
|
+
for (var i = 0; i < telemetryInitializersCount; ++i) {
|
|
2568
|
+
var telemetryInitializer = _initializers[i];
|
|
2569
|
+
if (telemetryInitializer) {
|
|
2570
|
+
try {
|
|
2571
|
+
if (telemetryInitializer.fn.apply(null, [item]) === false) {
|
|
2572
|
+
doNotSendItem = true;
|
|
2573
|
+
break;
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
catch (e) {
|
|
2577
|
+
_throwInternal(itemCtx.diagLog(), 1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
if (!doNotSendItem) {
|
|
2582
|
+
_self.processNext(item, itemCtx);
|
|
2583
|
+
}
|
|
2584
|
+
};
|
|
2585
|
+
_self[strDoTeardown] = function () {
|
|
2586
|
+
_initDefaults();
|
|
2587
|
+
};
|
|
2588
|
+
});
|
|
2589
|
+
function _initDefaults() {
|
|
2590
|
+
_id = 0;
|
|
2591
|
+
_initializers = [];
|
|
2592
|
+
}
|
|
2593
|
+
return _this;
|
|
2594
|
+
}
|
|
2595
|
+
return TelemetryInitializerPlugin;
|
|
2596
|
+
}(BaseTelemetryPlugin));
|
|
2597
|
+
|
|
2598
|
+
var strValidationError = "Plugins must provide initialize method";
|
|
1915
2599
|
var strNotificationManager = "_notificationManager";
|
|
2600
|
+
var strSdkUnloadingError = "SDK is still unloading...";
|
|
2601
|
+
var strSdkNotInitialized = "SDK is not initialized";
|
|
1916
2602
|
function _createPerfManager(core, notificationMgr) {
|
|
1917
2603
|
return new PerfManager(notificationMgr);
|
|
1918
2604
|
}
|
|
2605
|
+
function _validateExtensions(logger, channelPriority, allExtensions) {
|
|
2606
|
+
var coreExtensions = [];
|
|
2607
|
+
var extPriorities = {};
|
|
2608
|
+
arrForEach(allExtensions, function (ext) {
|
|
2609
|
+
if (isNullOrUndefined(ext) || isNullOrUndefined(ext.initialize)) {
|
|
2610
|
+
throwError(strValidationError);
|
|
2611
|
+
}
|
|
2612
|
+
var extPriority = ext.priority;
|
|
2613
|
+
var identifier = ext.identifier;
|
|
2614
|
+
if (ext && extPriority) {
|
|
2615
|
+
if (!isNullOrUndefined(extPriorities[extPriority])) {
|
|
2616
|
+
logger.warnToConsole("Two extensions have same priority #" + extPriority + " - " + extPriorities[extPriority] + ", " + identifier);
|
|
2617
|
+
}
|
|
2618
|
+
else {
|
|
2619
|
+
extPriorities[extPriority] = identifier;
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
if (!extPriority || extPriority < channelPriority) {
|
|
2623
|
+
coreExtensions.push(ext);
|
|
2624
|
+
}
|
|
2625
|
+
});
|
|
2626
|
+
return {
|
|
2627
|
+
all: allExtensions,
|
|
2628
|
+
core: coreExtensions
|
|
2629
|
+
};
|
|
2630
|
+
}
|
|
2631
|
+
function _isPluginPresent(thePlugin, plugins) {
|
|
2632
|
+
var exists = false;
|
|
2633
|
+
arrForEach(plugins, function (plugin) {
|
|
2634
|
+
if (plugin === thePlugin) {
|
|
2635
|
+
exists = true;
|
|
2636
|
+
return -1;
|
|
2637
|
+
}
|
|
2638
|
+
});
|
|
2639
|
+
return exists;
|
|
2640
|
+
}
|
|
2641
|
+
function _createDummyNotificationManager() {
|
|
2642
|
+
var _a;
|
|
2643
|
+
return objCreateFn((_a = {},
|
|
2644
|
+
_a[strAddNotificationListener] = function (listener) { },
|
|
2645
|
+
_a[strRemoveNotificationListener] = function (listener) { },
|
|
2646
|
+
_a[strEventsSent] = function (events) { },
|
|
2647
|
+
_a[strEventsDiscarded] = function (events, reason) { },
|
|
2648
|
+
_a[strEventsSendRequest] = function (sendReason, isAsync) { },
|
|
2649
|
+
_a));
|
|
2650
|
+
}
|
|
1919
2651
|
var BaseCore = /** @class */ (function () {
|
|
1920
2652
|
function BaseCore() {
|
|
1921
|
-
var _isInitialized
|
|
2653
|
+
var _isInitialized;
|
|
1922
2654
|
var _eventQueue;
|
|
1923
|
-
var _channelController;
|
|
1924
2655
|
var _notificationManager;
|
|
1925
2656
|
var _perfManager;
|
|
2657
|
+
var _cfgPerfManager;
|
|
1926
2658
|
var _cookieManager;
|
|
2659
|
+
var _pluginChain;
|
|
2660
|
+
var _configExtensions;
|
|
2661
|
+
var _coreExtensions;
|
|
2662
|
+
var _channelControl;
|
|
2663
|
+
var _channelConfig;
|
|
2664
|
+
var _channelQueue;
|
|
2665
|
+
var _isUnloading;
|
|
2666
|
+
var _telemetryInitializerPlugin;
|
|
2667
|
+
var _internalLogsEventName;
|
|
2668
|
+
var _evtNamespace;
|
|
2669
|
+
var _unloadHandlers;
|
|
2670
|
+
var _debugListener;
|
|
2671
|
+
var _internalLogPoller = 0;
|
|
1927
2672
|
dynamicProto(BaseCore, this, function (_self) {
|
|
1928
|
-
|
|
1929
|
-
_channelController = new ChannelController();
|
|
1930
|
-
_self.logger = new DiagnosticLogger({ loggingLevelConsole: LoggingSeverity.CRITICAL });
|
|
1931
|
-
_eventQueue = [];
|
|
2673
|
+
_initDefaults();
|
|
1932
2674
|
_self.isInitialized = function () { return _isInitialized; };
|
|
1933
2675
|
_self.initialize = function (config, extensions, logger, notificationManager) {
|
|
2676
|
+
if (_isUnloading) {
|
|
2677
|
+
throwError(strSdkUnloadingError);
|
|
2678
|
+
}
|
|
1934
2679
|
if (_self.isInitialized()) {
|
|
1935
2680
|
throwError("Core should not be initialized more than once");
|
|
1936
2681
|
}
|
|
@@ -1940,89 +2685,61 @@
|
|
|
1940
2685
|
_notificationManager = notificationManager;
|
|
1941
2686
|
_self[strNotificationManager] = notificationManager;
|
|
1942
2687
|
_self.config = config || {};
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
}
|
|
1946
|
-
if (_self.config.enablePerfMgr) {
|
|
1947
|
-
setValue(_self.config, "createPerfMgr", _createPerfManager);
|
|
1948
|
-
}
|
|
2688
|
+
_initDebugListener(config);
|
|
2689
|
+
_initPerfManager(config);
|
|
1949
2690
|
config.extensions = isNullOrUndefined(config.extensions) ? [] : config.extensions;
|
|
1950
|
-
|
|
1951
|
-
extConfig.NotificationManager = notificationManager;
|
|
2691
|
+
_initExtConfig(config);
|
|
1952
2692
|
if (logger) {
|
|
1953
2693
|
_self.logger = logger;
|
|
1954
2694
|
}
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
arrForEach(allExtensions, function (ext) {
|
|
1961
|
-
if (isNullOrUndefined(ext) || isNullOrUndefined(ext.initialize)) {
|
|
1962
|
-
throwError(validationError);
|
|
1963
|
-
}
|
|
1964
|
-
var extPriority = ext.priority;
|
|
1965
|
-
var identifier = ext.identifier;
|
|
1966
|
-
if (ext && extPriority) {
|
|
1967
|
-
if (!isNullOrUndefined(extPriorities[extPriority])) {
|
|
1968
|
-
logger.warnToConsole("Two extensions have same priority #" + extPriority + " - " + extPriorities[extPriority] + ", " + identifier);
|
|
1969
|
-
}
|
|
1970
|
-
else {
|
|
1971
|
-
extPriorities[extPriority] = identifier;
|
|
1972
|
-
}
|
|
1973
|
-
}
|
|
1974
|
-
if (!extPriority || extPriority < _channelController.priority) {
|
|
1975
|
-
coreExtensions.push(ext);
|
|
1976
|
-
}
|
|
1977
|
-
});
|
|
1978
|
-
allExtensions.push(_channelController);
|
|
1979
|
-
coreExtensions.push(_channelController);
|
|
1980
|
-
allExtensions = sortPlugins(allExtensions);
|
|
1981
|
-
_self._extensions = allExtensions;
|
|
1982
|
-
initializePlugins(new ProcessTelemetryContext([_channelController], config, _self), allExtensions);
|
|
1983
|
-
initializePlugins(new ProcessTelemetryContext(coreExtensions, config, _self), allExtensions);
|
|
1984
|
-
_self._extensions = coreExtensions;
|
|
1985
|
-
if (_self.getTransmissionControls().length === 0) {
|
|
2695
|
+
_configExtensions = [];
|
|
2696
|
+
_configExtensions.push.apply(_configExtensions, __spreadArrayFn(__spreadArrayFn([], extensions, false), config.extensions));
|
|
2697
|
+
_channelConfig = (config || {}).channels;
|
|
2698
|
+
_initPluginChain(config, null);
|
|
2699
|
+
if (!_channelQueue || _channelQueue.length === 0) {
|
|
1986
2700
|
throwError("No channels available");
|
|
1987
2701
|
}
|
|
1988
2702
|
_isInitialized = true;
|
|
1989
2703
|
_self.releaseQueue();
|
|
1990
2704
|
};
|
|
1991
2705
|
_self.getTransmissionControls = function () {
|
|
1992
|
-
|
|
2706
|
+
var controls = [];
|
|
2707
|
+
if (_channelQueue) {
|
|
2708
|
+
arrForEach(_channelQueue, function (channels) {
|
|
2709
|
+
controls.push(channels.queue);
|
|
2710
|
+
});
|
|
2711
|
+
}
|
|
2712
|
+
return objFreeze(controls);
|
|
1993
2713
|
};
|
|
1994
2714
|
_self.track = function (telemetryItem) {
|
|
1995
2715
|
setValue(telemetryItem, strIKey, _self.config.instrumentationKey, null, isNotTruthy);
|
|
1996
2716
|
setValue(telemetryItem, "time", toISOString(new Date()), null, isNotTruthy);
|
|
1997
2717
|
setValue(telemetryItem, "ver", "4.0", null, isNullOrUndefined);
|
|
1998
|
-
if (_self.isInitialized()) {
|
|
1999
|
-
|
|
2718
|
+
if (!_isUnloading && _self.isInitialized()) {
|
|
2719
|
+
_createTelCtx().processNext(telemetryItem);
|
|
2000
2720
|
}
|
|
2001
2721
|
else {
|
|
2002
2722
|
_eventQueue.push(telemetryItem);
|
|
2003
2723
|
}
|
|
2004
2724
|
};
|
|
2005
|
-
_self.getProcessTelContext =
|
|
2006
|
-
var extensions = _self._extensions;
|
|
2007
|
-
var thePlugins = extensions;
|
|
2008
|
-
if (!extensions || extensions.length === 0) {
|
|
2009
|
-
thePlugins = [_channelController];
|
|
2010
|
-
}
|
|
2011
|
-
return new ProcessTelemetryContext(thePlugins, _self.config, _self);
|
|
2012
|
-
};
|
|
2725
|
+
_self.getProcessTelContext = _createTelCtx;
|
|
2013
2726
|
_self.getNotifyMgr = function () {
|
|
2014
2727
|
if (!_notificationManager) {
|
|
2015
|
-
_notificationManager =
|
|
2016
|
-
addNotificationListener: function (listener) { },
|
|
2017
|
-
removeNotificationListener: function (listener) { },
|
|
2018
|
-
eventsSent: function (events) { },
|
|
2019
|
-
eventsDiscarded: function (events, reason) { },
|
|
2020
|
-
eventsSendRequest: function (sendReason, isAsync) { }
|
|
2021
|
-
});
|
|
2728
|
+
_notificationManager = _createDummyNotificationManager();
|
|
2022
2729
|
_self[strNotificationManager] = _notificationManager;
|
|
2023
2730
|
}
|
|
2024
2731
|
return _notificationManager;
|
|
2025
2732
|
};
|
|
2733
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2734
|
+
if (_notificationManager) {
|
|
2735
|
+
_notificationManager[strAddNotificationListener](listener);
|
|
2736
|
+
}
|
|
2737
|
+
};
|
|
2738
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2739
|
+
if (_notificationManager) {
|
|
2740
|
+
_notificationManager[strRemoveNotificationListener](listener);
|
|
2741
|
+
}
|
|
2742
|
+
};
|
|
2026
2743
|
_self.getCookieMgr = function () {
|
|
2027
2744
|
if (!_cookieManager) {
|
|
2028
2745
|
_cookieManager = createCookieMgr(_self.config, _self.logger);
|
|
@@ -2033,92 +2750,395 @@
|
|
|
2033
2750
|
_cookieManager = cookieMgr;
|
|
2034
2751
|
};
|
|
2035
2752
|
_self.getPerfMgr = function () {
|
|
2036
|
-
if (!_perfManager) {
|
|
2753
|
+
if (!_perfManager && !_cfgPerfManager) {
|
|
2037
2754
|
if (_self.config && _self.config.enablePerfMgr && isFunction(_self.config.createPerfMgr)) {
|
|
2038
|
-
|
|
2755
|
+
_cfgPerfManager = _self.config.createPerfMgr(_self, _self.getNotifyMgr());
|
|
2039
2756
|
}
|
|
2040
2757
|
}
|
|
2041
|
-
return _perfManager || getGblPerfMgr();
|
|
2042
|
-
};
|
|
2043
|
-
_self.setPerfMgr = function (perfMgr) {
|
|
2044
|
-
_perfManager = perfMgr;
|
|
2045
|
-
};
|
|
2046
|
-
_self.eventCnt = function () {
|
|
2047
|
-
return _eventQueue.length;
|
|
2048
|
-
};
|
|
2049
|
-
_self.releaseQueue = function () {
|
|
2050
|
-
if (_eventQueue.length > 0) {
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2758
|
+
return _perfManager || _cfgPerfManager || getGblPerfMgr();
|
|
2759
|
+
};
|
|
2760
|
+
_self.setPerfMgr = function (perfMgr) {
|
|
2761
|
+
_perfManager = perfMgr;
|
|
2762
|
+
};
|
|
2763
|
+
_self.eventCnt = function () {
|
|
2764
|
+
return _eventQueue.length;
|
|
2765
|
+
};
|
|
2766
|
+
_self.releaseQueue = function () {
|
|
2767
|
+
if (_isInitialized && _eventQueue.length > 0) {
|
|
2768
|
+
var eventQueue = _eventQueue;
|
|
2769
|
+
_eventQueue = [];
|
|
2770
|
+
arrForEach(eventQueue, function (event) {
|
|
2771
|
+
_createTelCtx().processNext(event);
|
|
2772
|
+
});
|
|
2773
|
+
}
|
|
2774
|
+
};
|
|
2775
|
+
_self.pollInternalLogs = function (eventName) {
|
|
2776
|
+
_internalLogsEventName = eventName || null;
|
|
2777
|
+
var interval = _self.config.diagnosticLogInterval;
|
|
2778
|
+
if (!interval || !(interval > 0)) {
|
|
2779
|
+
interval = 10000;
|
|
2780
|
+
}
|
|
2781
|
+
if (_internalLogPoller) {
|
|
2782
|
+
clearInterval(_internalLogPoller);
|
|
2783
|
+
}
|
|
2784
|
+
_internalLogPoller = setInterval(function () {
|
|
2785
|
+
_flushInternalLogs();
|
|
2786
|
+
}, interval);
|
|
2787
|
+
return _internalLogPoller;
|
|
2788
|
+
};
|
|
2789
|
+
_self.stopPollingInternalLogs = function () {
|
|
2790
|
+
if (_internalLogPoller) {
|
|
2791
|
+
clearInterval(_internalLogPoller);
|
|
2792
|
+
_internalLogPoller = 0;
|
|
2793
|
+
_flushInternalLogs();
|
|
2794
|
+
}
|
|
2795
|
+
};
|
|
2796
|
+
proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, ["addTelemetryInitializer"]);
|
|
2797
|
+
_self.unload = function (isAsync, unloadComplete, cbTimeout) {
|
|
2798
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
2799
|
+
if (!_isInitialized) {
|
|
2800
|
+
throwError(strSdkNotInitialized);
|
|
2801
|
+
}
|
|
2802
|
+
if (_isUnloading) {
|
|
2803
|
+
throwError(strSdkUnloadingError);
|
|
2804
|
+
}
|
|
2805
|
+
var unloadState = {
|
|
2806
|
+
reason: 50 ,
|
|
2807
|
+
isAsync: isAsync,
|
|
2808
|
+
flushComplete: false
|
|
2809
|
+
};
|
|
2810
|
+
var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self.config, _self);
|
|
2811
|
+
processUnloadCtx.onComplete(function () {
|
|
2812
|
+
_initDefaults();
|
|
2813
|
+
unloadComplete && unloadComplete(unloadState);
|
|
2814
|
+
}, _self);
|
|
2815
|
+
function _doUnload(flushComplete) {
|
|
2816
|
+
unloadState.flushComplete = flushComplete;
|
|
2817
|
+
_isUnloading = true;
|
|
2818
|
+
_unloadHandlers.run(processUnloadCtx, unloadState);
|
|
2819
|
+
_self.stopPollingInternalLogs();
|
|
2820
|
+
processUnloadCtx.processNext(unloadState);
|
|
2821
|
+
}
|
|
2822
|
+
if (!_flushChannels(isAsync, _doUnload, 6 , cbTimeout)) {
|
|
2823
|
+
_doUnload(false);
|
|
2824
|
+
}
|
|
2825
|
+
};
|
|
2826
|
+
_self.getPlugin = _getPlugin;
|
|
2827
|
+
_self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {
|
|
2828
|
+
if (!plugin) {
|
|
2829
|
+
addCb && addCb(false);
|
|
2830
|
+
_logOrThrowError(strValidationError);
|
|
2831
|
+
return;
|
|
2832
|
+
}
|
|
2833
|
+
var existingPlugin = _getPlugin(plugin.identifier);
|
|
2834
|
+
if (existingPlugin && !replaceExisting) {
|
|
2835
|
+
addCb && addCb(false);
|
|
2836
|
+
_logOrThrowError("Plugin [" + plugin.identifier + "] is already loaded!");
|
|
2837
|
+
return;
|
|
2838
|
+
}
|
|
2839
|
+
var updateState = {
|
|
2840
|
+
reason: 16
|
|
2841
|
+
};
|
|
2842
|
+
function _addPlugin(removed) {
|
|
2843
|
+
_configExtensions.push(plugin);
|
|
2844
|
+
updateState.added = [plugin];
|
|
2845
|
+
_initPluginChain(_self.config, updateState);
|
|
2846
|
+
addCb && addCb(true);
|
|
2847
|
+
}
|
|
2848
|
+
if (existingPlugin) {
|
|
2849
|
+
var removedPlugins_1 = [existingPlugin.plugin];
|
|
2850
|
+
var unloadState = {
|
|
2851
|
+
reason: 2 ,
|
|
2852
|
+
isAsync: !!isAsync
|
|
2853
|
+
};
|
|
2854
|
+
_removePlugins(removedPlugins_1, unloadState, function (removed) {
|
|
2855
|
+
if (!removed) {
|
|
2856
|
+
addCb && addCb(false);
|
|
2857
|
+
}
|
|
2858
|
+
else {
|
|
2859
|
+
updateState.removed = removedPlugins_1;
|
|
2860
|
+
updateState.reason |= 32 ;
|
|
2861
|
+
_addPlugin();
|
|
2862
|
+
}
|
|
2863
|
+
});
|
|
2864
|
+
}
|
|
2865
|
+
else {
|
|
2866
|
+
_addPlugin();
|
|
2867
|
+
}
|
|
2868
|
+
};
|
|
2869
|
+
_self.evtNamespace = function () {
|
|
2870
|
+
return _evtNamespace;
|
|
2871
|
+
};
|
|
2872
|
+
_self.flush = _flushChannels;
|
|
2873
|
+
proxyFunctionAs(_self, "addUnloadCb", function () { return _unloadHandlers; }, "add");
|
|
2874
|
+
function _initDefaults() {
|
|
2875
|
+
_isInitialized = false;
|
|
2876
|
+
_self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 });
|
|
2877
|
+
_self.config = {};
|
|
2878
|
+
_self._extensions = [];
|
|
2879
|
+
_telemetryInitializerPlugin = new TelemetryInitializerPlugin();
|
|
2880
|
+
_eventQueue = [];
|
|
2881
|
+
_notificationManager = null;
|
|
2882
|
+
_perfManager = null;
|
|
2883
|
+
_cfgPerfManager = null;
|
|
2884
|
+
_cookieManager = null;
|
|
2885
|
+
_pluginChain = null;
|
|
2886
|
+
_coreExtensions = null;
|
|
2887
|
+
_configExtensions = [];
|
|
2888
|
+
_channelControl = null;
|
|
2889
|
+
_channelConfig = null;
|
|
2890
|
+
_channelQueue = null;
|
|
2891
|
+
_isUnloading = false;
|
|
2892
|
+
_internalLogsEventName = null;
|
|
2893
|
+
_evtNamespace = createUniqueNamespace("AIBaseCore", true);
|
|
2894
|
+
_unloadHandlers = createUnloadHandlerContainer();
|
|
2895
|
+
}
|
|
2896
|
+
function _createTelCtx() {
|
|
2897
|
+
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
2898
|
+
}
|
|
2899
|
+
function _initPluginChain(config, updateState) {
|
|
2900
|
+
var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
|
|
2901
|
+
_coreExtensions = theExtensions.core;
|
|
2902
|
+
_pluginChain = null;
|
|
2903
|
+
var allExtensions = theExtensions.all;
|
|
2904
|
+
_channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, config, _self));
|
|
2905
|
+
if (_channelControl) {
|
|
2906
|
+
var idx = allExtensions.indexOf(_channelControl);
|
|
2907
|
+
if (idx !== -1) {
|
|
2908
|
+
allExtensions.splice(idx, 1);
|
|
2909
|
+
}
|
|
2910
|
+
idx = _coreExtensions.indexOf(_channelControl);
|
|
2911
|
+
if (idx !== -1) {
|
|
2912
|
+
_coreExtensions.splice(idx, 1);
|
|
2913
|
+
}
|
|
2914
|
+
_channelControl._setQueue(_channelQueue);
|
|
2915
|
+
}
|
|
2916
|
+
else {
|
|
2917
|
+
_channelControl = createChannelControllerPlugin(_channelQueue, _self);
|
|
2918
|
+
}
|
|
2919
|
+
allExtensions.push(_channelControl);
|
|
2920
|
+
_coreExtensions.push(_channelControl);
|
|
2921
|
+
_self._extensions = sortPlugins(allExtensions);
|
|
2922
|
+
_channelControl.initialize(config, _self, allExtensions);
|
|
2923
|
+
initializePlugins(_createTelCtx(), allExtensions);
|
|
2924
|
+
_self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
|
|
2925
|
+
if (updateState) {
|
|
2926
|
+
_doUpdate(updateState);
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
function _getPlugin(pluginIdentifier) {
|
|
2930
|
+
var theExt = null;
|
|
2931
|
+
var thePlugin = null;
|
|
2932
|
+
arrForEach(_self._extensions, function (ext) {
|
|
2933
|
+
if (ext.identifier === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
|
|
2934
|
+
thePlugin = ext;
|
|
2935
|
+
return -1;
|
|
2936
|
+
}
|
|
2937
|
+
});
|
|
2938
|
+
if (!thePlugin && _channelControl) {
|
|
2939
|
+
thePlugin = _channelControl.getChannel(pluginIdentifier);
|
|
2940
|
+
}
|
|
2941
|
+
if (thePlugin) {
|
|
2942
|
+
theExt = {
|
|
2943
|
+
plugin: thePlugin,
|
|
2944
|
+
setEnabled: function (enabled) {
|
|
2945
|
+
_getPluginState(thePlugin)[strDisabled] = !enabled;
|
|
2946
|
+
},
|
|
2947
|
+
isEnabled: function () {
|
|
2948
|
+
var pluginState = _getPluginState(thePlugin);
|
|
2949
|
+
return !pluginState[strTeardown] && !pluginState[strDisabled];
|
|
2950
|
+
},
|
|
2951
|
+
remove: function (isAsync, removeCb) {
|
|
2952
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
2953
|
+
var pluginsToRemove = [thePlugin];
|
|
2954
|
+
var unloadState = {
|
|
2955
|
+
reason: 1 ,
|
|
2956
|
+
isAsync: isAsync
|
|
2957
|
+
};
|
|
2958
|
+
_removePlugins(pluginsToRemove, unloadState, function (removed) {
|
|
2959
|
+
if (removed) {
|
|
2960
|
+
_initPluginChain(_self.config, {
|
|
2961
|
+
reason: 32 ,
|
|
2962
|
+
removed: pluginsToRemove
|
|
2963
|
+
});
|
|
2964
|
+
}
|
|
2965
|
+
removeCb && removeCb(removed);
|
|
2966
|
+
});
|
|
2967
|
+
}
|
|
2968
|
+
};
|
|
2969
|
+
}
|
|
2970
|
+
return theExt;
|
|
2971
|
+
}
|
|
2972
|
+
function _getPluginChain() {
|
|
2973
|
+
if (!_pluginChain) {
|
|
2974
|
+
var extensions = (_coreExtensions || []).slice();
|
|
2975
|
+
if (extensions.indexOf(_telemetryInitializerPlugin) === -1) {
|
|
2976
|
+
extensions.push(_telemetryInitializerPlugin);
|
|
2977
|
+
}
|
|
2978
|
+
_pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _self.config, _self);
|
|
2979
|
+
}
|
|
2980
|
+
return _pluginChain;
|
|
2981
|
+
}
|
|
2982
|
+
function _removePlugins(thePlugins, unloadState, removeComplete) {
|
|
2983
|
+
if (thePlugins && thePlugins.length > 0) {
|
|
2984
|
+
var unloadChain = createTelemetryProxyChain(thePlugins, _self.config, _self);
|
|
2985
|
+
var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self.config, _self);
|
|
2986
|
+
unloadCtx.onComplete(function () {
|
|
2987
|
+
var removed = false;
|
|
2988
|
+
var newConfigExtensions = [];
|
|
2989
|
+
arrForEach(_configExtensions, function (plugin, idx) {
|
|
2990
|
+
if (!_isPluginPresent(plugin, thePlugins)) {
|
|
2991
|
+
newConfigExtensions.push(plugin);
|
|
2992
|
+
}
|
|
2993
|
+
else {
|
|
2994
|
+
removed = true;
|
|
2995
|
+
}
|
|
2996
|
+
});
|
|
2997
|
+
_configExtensions = newConfigExtensions;
|
|
2998
|
+
var newChannelConfig = [];
|
|
2999
|
+
if (_channelConfig) {
|
|
3000
|
+
arrForEach(_channelConfig, function (queue, idx) {
|
|
3001
|
+
var newQueue = [];
|
|
3002
|
+
arrForEach(queue, function (channel) {
|
|
3003
|
+
if (!_isPluginPresent(channel, thePlugins)) {
|
|
3004
|
+
newQueue.push(channel);
|
|
3005
|
+
}
|
|
3006
|
+
else {
|
|
3007
|
+
removed = true;
|
|
3008
|
+
}
|
|
3009
|
+
});
|
|
3010
|
+
newChannelConfig.push(newQueue);
|
|
3011
|
+
});
|
|
3012
|
+
_channelConfig = newChannelConfig;
|
|
3013
|
+
}
|
|
3014
|
+
removeComplete && removeComplete(removed);
|
|
3015
|
+
});
|
|
3016
|
+
unloadCtx.processNext(unloadState);
|
|
3017
|
+
}
|
|
3018
|
+
else {
|
|
3019
|
+
removeComplete(false);
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
function _flushInternalLogs() {
|
|
3023
|
+
var queue = _self.logger ? _self.logger.queue : [];
|
|
3024
|
+
if (queue) {
|
|
3025
|
+
arrForEach(queue, function (logMessage) {
|
|
3026
|
+
var item = {
|
|
3027
|
+
name: _internalLogsEventName ? _internalLogsEventName : "InternalMessageId: " + logMessage.messageId,
|
|
3028
|
+
iKey: _self.config.instrumentationKey,
|
|
3029
|
+
time: toISOString(new Date()),
|
|
3030
|
+
baseType: _InternalLogMessage.dataType,
|
|
3031
|
+
baseData: { message: logMessage.message }
|
|
3032
|
+
};
|
|
3033
|
+
_self.track(item);
|
|
3034
|
+
});
|
|
3035
|
+
queue.length = 0;
|
|
3036
|
+
}
|
|
3037
|
+
}
|
|
3038
|
+
function _flushChannels(isAsync, callBack, sendReason, cbTimeout) {
|
|
3039
|
+
if (_channelControl) {
|
|
3040
|
+
return _channelControl.flush(isAsync, callBack, sendReason || 6 , cbTimeout);
|
|
3041
|
+
}
|
|
3042
|
+
callBack && callBack(false);
|
|
3043
|
+
return true;
|
|
3044
|
+
}
|
|
3045
|
+
function _initDebugListener(config) {
|
|
3046
|
+
if (config.disableDbgExt === true && _debugListener) {
|
|
3047
|
+
_notificationManager[strRemoveNotificationListener](_debugListener);
|
|
3048
|
+
_debugListener = null;
|
|
3049
|
+
}
|
|
3050
|
+
if (_notificationManager && !_debugListener && config.disableDbgExt !== true) {
|
|
3051
|
+
_debugListener = getDebugListener(config);
|
|
3052
|
+
_notificationManager[strAddNotificationListener](_debugListener);
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
function _initPerfManager(config) {
|
|
3056
|
+
if (!config.enablePerfMgr && _cfgPerfManager) {
|
|
3057
|
+
_cfgPerfManager = null;
|
|
3058
|
+
}
|
|
3059
|
+
if (config.enablePerfMgr) {
|
|
3060
|
+
setValue(_self.config, "createPerfMgr", _createPerfManager);
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
function _initExtConfig(config) {
|
|
3064
|
+
var extConfig = getSetValue(config, strExtensionConfig);
|
|
3065
|
+
extConfig.NotificationManager = _notificationManager;
|
|
3066
|
+
}
|
|
3067
|
+
function _doUpdate(updateState) {
|
|
3068
|
+
var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self.config, _self);
|
|
3069
|
+
if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) {
|
|
3070
|
+
updateCtx.processNext(updateState);
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
function _logOrThrowError(message) {
|
|
3074
|
+
var logger = _self.logger;
|
|
3075
|
+
if (logger) {
|
|
3076
|
+
_throwInternal(logger, 2 , 73 , message);
|
|
2055
3077
|
}
|
|
2056
|
-
|
|
3078
|
+
else {
|
|
3079
|
+
throwError(message);
|
|
3080
|
+
}
|
|
3081
|
+
}
|
|
2057
3082
|
});
|
|
2058
3083
|
}
|
|
2059
3084
|
return BaseCore;
|
|
2060
3085
|
}());
|
|
2061
3086
|
|
|
3087
|
+
function _runListeners(listeners, name, isAsync, callback) {
|
|
3088
|
+
arrForEach(listeners, function (listener) {
|
|
3089
|
+
if (listener && listener[name]) {
|
|
3090
|
+
if (isAsync) {
|
|
3091
|
+
setTimeout(function () { return callback(listener); }, 0);
|
|
3092
|
+
}
|
|
3093
|
+
else {
|
|
3094
|
+
try {
|
|
3095
|
+
callback(listener);
|
|
3096
|
+
}
|
|
3097
|
+
catch (e) {
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
});
|
|
3102
|
+
}
|
|
2062
3103
|
var NotificationManager = /** @class */ (function () {
|
|
2063
3104
|
function NotificationManager(config) {
|
|
2064
3105
|
this.listeners = [];
|
|
2065
3106
|
var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;
|
|
2066
3107
|
dynamicProto(NotificationManager, this, function (_self) {
|
|
2067
|
-
_self
|
|
3108
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2068
3109
|
_self.listeners.push(listener);
|
|
2069
3110
|
};
|
|
2070
|
-
_self
|
|
3111
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2071
3112
|
var index = arrIndexOf(_self.listeners, listener);
|
|
2072
3113
|
while (index > -1) {
|
|
2073
3114
|
_self.listeners.splice(index, 1);
|
|
2074
3115
|
index = arrIndexOf(_self.listeners, listener);
|
|
2075
3116
|
}
|
|
2076
3117
|
};
|
|
2077
|
-
_self
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
setTimeout(function () { return listener.eventsSent(events); }, 0);
|
|
2081
|
-
}
|
|
3118
|
+
_self[strEventsSent] = function (events) {
|
|
3119
|
+
_runListeners(_self.listeners, strEventsSent, true, function (listener) {
|
|
3120
|
+
listener[strEventsSent](events);
|
|
2082
3121
|
});
|
|
2083
3122
|
};
|
|
2084
|
-
_self
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
setTimeout(function () { return listener.eventsDiscarded(events, reason); }, 0);
|
|
2088
|
-
}
|
|
3123
|
+
_self[strEventsDiscarded] = function (events, reason) {
|
|
3124
|
+
_runListeners(_self.listeners, strEventsDiscarded, true, function (listener) {
|
|
3125
|
+
listener[strEventsDiscarded](events, reason);
|
|
2089
3126
|
});
|
|
2090
3127
|
};
|
|
2091
|
-
_self
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
if (isAsync) {
|
|
2095
|
-
setTimeout(function () { return listener.eventsSendRequest(sendReason, isAsync); }, 0);
|
|
2096
|
-
}
|
|
2097
|
-
else {
|
|
2098
|
-
try {
|
|
2099
|
-
listener.eventsSendRequest(sendReason, isAsync);
|
|
2100
|
-
}
|
|
2101
|
-
catch (e) {
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
}
|
|
3128
|
+
_self[strEventsSendRequest] = function (sendReason, isAsync) {
|
|
3129
|
+
_runListeners(_self.listeners, strEventsSendRequest, isAsync, function (listener) {
|
|
3130
|
+
listener[strEventsSendRequest](sendReason, isAsync);
|
|
2105
3131
|
});
|
|
2106
3132
|
};
|
|
2107
|
-
_self
|
|
3133
|
+
_self[strPerfEvent] = function (perfEvent) {
|
|
2108
3134
|
if (perfEvent) {
|
|
2109
3135
|
if (perfEvtsSendAll || !perfEvent.isChildEvt()) {
|
|
2110
|
-
|
|
2111
|
-
if (
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
try {
|
|
2117
|
-
listener.perfEvent(perfEvent);
|
|
2118
|
-
}
|
|
2119
|
-
catch (e) {
|
|
2120
|
-
}
|
|
2121
|
-
}
|
|
3136
|
+
_runListeners(_self.listeners, strPerfEvent, false, function (listener) {
|
|
3137
|
+
if (perfEvent.isAsync) {
|
|
3138
|
+
setTimeout(function () { return listener[strPerfEvent](perfEvent); }, 0);
|
|
3139
|
+
}
|
|
3140
|
+
else {
|
|
3141
|
+
listener[strPerfEvent](perfEvent);
|
|
2122
3142
|
}
|
|
2123
3143
|
});
|
|
2124
3144
|
}
|
|
@@ -2133,7 +3153,6 @@
|
|
|
2133
3153
|
__extendsFn(AppInsightsCore, _super);
|
|
2134
3154
|
function AppInsightsCore() {
|
|
2135
3155
|
var _this = _super.call(this) || this;
|
|
2136
|
-
var _internalLogPoller = 0;
|
|
2137
3156
|
dynamicProto(AppInsightsCore, _this, function (_self, _base) {
|
|
2138
3157
|
_self.initialize = function (config, extensions, logger, notificationManager) {
|
|
2139
3158
|
_base.initialize(config, extensions, logger || new DiagnosticLogger(config), notificationManager || new NotificationManager(config));
|
|
@@ -2148,48 +3167,6 @@
|
|
|
2148
3167
|
_base.track(telemetryItem);
|
|
2149
3168
|
}, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));
|
|
2150
3169
|
};
|
|
2151
|
-
_self.addNotificationListener = function (listener) {
|
|
2152
|
-
var manager = _self.getNotifyMgr();
|
|
2153
|
-
if (manager) {
|
|
2154
|
-
manager.addNotificationListener(listener);
|
|
2155
|
-
}
|
|
2156
|
-
};
|
|
2157
|
-
_self.removeNotificationListener = function (listener) {
|
|
2158
|
-
var manager = _self.getNotifyMgr();
|
|
2159
|
-
if (manager) {
|
|
2160
|
-
manager.removeNotificationListener(listener);
|
|
2161
|
-
}
|
|
2162
|
-
};
|
|
2163
|
-
_self.pollInternalLogs = function (eventName) {
|
|
2164
|
-
var interval = _self.config.diagnosticLogInterval;
|
|
2165
|
-
if (!interval || !(interval > 0)) {
|
|
2166
|
-
interval = 10000;
|
|
2167
|
-
}
|
|
2168
|
-
if (_internalLogPoller) {
|
|
2169
|
-
_self.stopPollingInternalLogs();
|
|
2170
|
-
}
|
|
2171
|
-
_internalLogPoller = setInterval(function () {
|
|
2172
|
-
var queue = _self.logger ? _self.logger.queue : [];
|
|
2173
|
-
arrForEach(queue, function (logMessage) {
|
|
2174
|
-
var item = {
|
|
2175
|
-
name: eventName ? eventName : "InternalMessageId: " + logMessage.messageId,
|
|
2176
|
-
iKey: _self.config.instrumentationKey,
|
|
2177
|
-
time: toISOString(new Date()),
|
|
2178
|
-
baseType: _InternalLogMessage.dataType,
|
|
2179
|
-
baseData: { message: logMessage.message }
|
|
2180
|
-
};
|
|
2181
|
-
_self.track(item);
|
|
2182
|
-
});
|
|
2183
|
-
queue.length = 0;
|
|
2184
|
-
}, interval);
|
|
2185
|
-
return _internalLogPoller;
|
|
2186
|
-
};
|
|
2187
|
-
_self.stopPollingInternalLogs = function () {
|
|
2188
|
-
if (!_internalLogPoller)
|
|
2189
|
-
return;
|
|
2190
|
-
clearInterval(_internalLogPoller);
|
|
2191
|
-
_internalLogPoller = 0;
|
|
2192
|
-
};
|
|
2193
3170
|
function _validateTelemetryItem(telemetryItem) {
|
|
2194
3171
|
if (isNullOrUndefined(telemetryItem.name)) {
|
|
2195
3172
|
_notifyInvalidEvent(telemetryItem);
|
|
@@ -2208,86 +3185,192 @@
|
|
|
2208
3185
|
return AppInsightsCore;
|
|
2209
3186
|
}(BaseCore));
|
|
2210
3187
|
|
|
2211
|
-
var
|
|
2212
|
-
var
|
|
2213
|
-
var
|
|
2214
|
-
var
|
|
2215
|
-
var
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
3188
|
+
var strOnPrefix = "on";
|
|
3189
|
+
var strAttachEvent = "attachEvent";
|
|
3190
|
+
var strAddEventHelper = "addEventListener";
|
|
3191
|
+
var strDetachEvent = "detachEvent";
|
|
3192
|
+
var strRemoveEventListener = "removeEventListener";
|
|
3193
|
+
var strEvents = "events";
|
|
3194
|
+
createUniqueNamespace("aiEvtPageHide");
|
|
3195
|
+
createUniqueNamespace("aiEvtPageShow");
|
|
3196
|
+
var rRemoveEmptyNs = /\.[\.]+/g;
|
|
3197
|
+
var rRemoveTrailingEmptyNs = /[\.]+$/;
|
|
3198
|
+
var _guid = 1;
|
|
3199
|
+
var elmNodeData = createElmNodeData("events");
|
|
3200
|
+
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
3201
|
+
function _normalizeNamespace(name) {
|
|
3202
|
+
if (name && name.replace) {
|
|
3203
|
+
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
3204
|
+
}
|
|
3205
|
+
return name;
|
|
3206
|
+
}
|
|
3207
|
+
function _getEvtNamespace(eventName, evtNamespace) {
|
|
3208
|
+
if (evtNamespace) {
|
|
3209
|
+
var theNamespace_1 = "";
|
|
3210
|
+
if (isArray(evtNamespace)) {
|
|
3211
|
+
theNamespace_1 = "";
|
|
3212
|
+
arrForEach(evtNamespace, function (name) {
|
|
3213
|
+
name = _normalizeNamespace(name);
|
|
3214
|
+
if (name) {
|
|
3215
|
+
if (name[0] !== ".") {
|
|
3216
|
+
name = "." + name;
|
|
3217
|
+
}
|
|
3218
|
+
theNamespace_1 += name;
|
|
3219
|
+
}
|
|
3220
|
+
});
|
|
3221
|
+
}
|
|
3222
|
+
else {
|
|
3223
|
+
theNamespace_1 = _normalizeNamespace(evtNamespace);
|
|
3224
|
+
}
|
|
3225
|
+
if (theNamespace_1) {
|
|
3226
|
+
if (theNamespace_1[0] !== ".") {
|
|
3227
|
+
theNamespace_1 = "." + theNamespace_1;
|
|
3228
|
+
}
|
|
3229
|
+
eventName = (eventName || "") + theNamespace_1;
|
|
3230
|
+
}
|
|
2219
3231
|
}
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
3232
|
+
var parsedEvent = (eventNamespace.exec(eventName || "") || []);
|
|
3233
|
+
return {
|
|
3234
|
+
type: parsedEvent[1],
|
|
3235
|
+
ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
|
|
3236
|
+
};
|
|
2223
3237
|
}
|
|
2224
|
-
function
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
3238
|
+
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
3239
|
+
if (addDefault === void 0) { addDefault = true; }
|
|
3240
|
+
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
3241
|
+
var registeredEvents = aiEvts[evtName];
|
|
3242
|
+
if (!registeredEvents) {
|
|
3243
|
+
registeredEvents = aiEvts[evtName] = [];
|
|
2230
3244
|
}
|
|
3245
|
+
return registeredEvents;
|
|
2231
3246
|
}
|
|
2232
|
-
function
|
|
2233
|
-
if (
|
|
2234
|
-
|
|
3247
|
+
function _doDetach(obj, evtName, handlerRef, useCapture) {
|
|
3248
|
+
if (obj && evtName && evtName.type) {
|
|
3249
|
+
if (obj[strRemoveEventListener]) {
|
|
3250
|
+
obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);
|
|
3251
|
+
}
|
|
3252
|
+
else if (obj[strDetachEvent]) {
|
|
3253
|
+
obj[strDetachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
3254
|
+
}
|
|
2235
3255
|
}
|
|
2236
|
-
return 0;
|
|
2237
3256
|
}
|
|
2238
|
-
function
|
|
2239
|
-
var
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
3257
|
+
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
3258
|
+
var result = false;
|
|
3259
|
+
if (obj && evtName && evtName.type && handlerRef) {
|
|
3260
|
+
if (obj[strAddEventHelper]) {
|
|
3261
|
+
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
3262
|
+
result = true;
|
|
3263
|
+
}
|
|
3264
|
+
else if (obj[strAttachEvent]) {
|
|
3265
|
+
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
3266
|
+
result = true;
|
|
3267
|
+
}
|
|
2243
3268
|
}
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
3269
|
+
return result;
|
|
3270
|
+
}
|
|
3271
|
+
function _doUnregister(target, events, evtName, unRegFn) {
|
|
3272
|
+
var idx = events.length;
|
|
3273
|
+
while (idx--) {
|
|
3274
|
+
var theEvent = events[idx];
|
|
3275
|
+
if (theEvent) {
|
|
3276
|
+
if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {
|
|
3277
|
+
if (!unRegFn || unRegFn(theEvent)) {
|
|
3278
|
+
_doDetach(target, theEvent.evtName, theEvent.handler, theEvent.capture);
|
|
3279
|
+
events.splice(idx, 1);
|
|
3280
|
+
}
|
|
3281
|
+
}
|
|
2247
3282
|
}
|
|
2248
|
-
value = mwcRandom32() & MaxUInt32;
|
|
2249
3283
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
3284
|
+
}
|
|
3285
|
+
function _unregisterEvents(target, evtName, unRegFn) {
|
|
3286
|
+
if (evtName.type) {
|
|
3287
|
+
_doUnregister(target, _getRegisteredEvents(target, evtName.type), evtName, unRegFn);
|
|
2252
3288
|
}
|
|
2253
|
-
|
|
2254
|
-
|
|
3289
|
+
else {
|
|
3290
|
+
var eventCache = elmNodeData.get(target, strEvents, {});
|
|
3291
|
+
objForEachKey(eventCache, function (evtType, events) {
|
|
3292
|
+
_doUnregister(target, events, evtName, unRegFn);
|
|
3293
|
+
});
|
|
3294
|
+
if (objKeys(eventCache).length === 0) {
|
|
3295
|
+
elmNodeData.kill(target, strEvents);
|
|
3296
|
+
}
|
|
2255
3297
|
}
|
|
2256
|
-
return value;
|
|
2257
3298
|
}
|
|
2258
|
-
function
|
|
2259
|
-
|
|
2260
|
-
|
|
3299
|
+
function mergeEvtNamespace(theNamespace, namespaces) {
|
|
3300
|
+
var newNamespaces;
|
|
3301
|
+
if (namespaces) {
|
|
3302
|
+
if (isArray(namespaces)) {
|
|
3303
|
+
newNamespaces = [theNamespace].concat(namespaces);
|
|
3304
|
+
}
|
|
3305
|
+
else {
|
|
3306
|
+
newNamespaces = [theNamespace, namespaces];
|
|
3307
|
+
}
|
|
3308
|
+
newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
|
|
2261
3309
|
}
|
|
2262
3310
|
else {
|
|
2263
|
-
|
|
3311
|
+
newNamespaces = theNamespace;
|
|
2264
3312
|
}
|
|
3313
|
+
return newNamespaces;
|
|
2265
3314
|
}
|
|
2266
|
-
function
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
3315
|
+
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
3316
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3317
|
+
var result = false;
|
|
3318
|
+
if (target) {
|
|
3319
|
+
try {
|
|
3320
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
3321
|
+
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
3322
|
+
if (result && elmNodeData.accept(target)) {
|
|
3323
|
+
var registeredEvent = {
|
|
3324
|
+
guid: _guid++,
|
|
3325
|
+
evtName: evtName,
|
|
3326
|
+
handler: handlerRef,
|
|
3327
|
+
capture: useCapture
|
|
3328
|
+
};
|
|
3329
|
+
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
catch (e) {
|
|
3333
|
+
}
|
|
2272
3334
|
}
|
|
2273
|
-
return
|
|
3335
|
+
return result;
|
|
2274
3336
|
}
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
3337
|
+
function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
3338
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3339
|
+
if (target) {
|
|
3340
|
+
try {
|
|
3341
|
+
var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
|
|
3342
|
+
var found_1 = false;
|
|
3343
|
+
_unregisterEvents(target, evtName_1, function (regEvent) {
|
|
3344
|
+
if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {
|
|
3345
|
+
found_1 = true;
|
|
3346
|
+
return true;
|
|
3347
|
+
}
|
|
3348
|
+
return false;
|
|
3349
|
+
});
|
|
3350
|
+
if (!found_1) {
|
|
3351
|
+
_doDetach(target, evtName_1, handlerRef, useCapture);
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
catch (e) {
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3358
|
+
function addEventHandler(eventName, callback, evtNamespace) {
|
|
2279
3359
|
var result = false;
|
|
2280
3360
|
var w = getWindow();
|
|
2281
3361
|
if (w) {
|
|
2282
|
-
result =
|
|
2283
|
-
result =
|
|
3362
|
+
result = eventOn(w, eventName, callback, evtNamespace);
|
|
3363
|
+
result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
|
|
2284
3364
|
}
|
|
2285
3365
|
var doc = getDocument();
|
|
2286
3366
|
if (doc) {
|
|
2287
|
-
result =
|
|
3367
|
+
result = eventOn(doc, eventName, callback, evtNamespace) || result;
|
|
2288
3368
|
}
|
|
2289
3369
|
return result;
|
|
2290
3370
|
}
|
|
3371
|
+
|
|
3372
|
+
var _cookieMgrs = null;
|
|
3373
|
+
var _canUseCookies;
|
|
2291
3374
|
function newGuid() {
|
|
2292
3375
|
function randomHexDigit() {
|
|
2293
3376
|
return randomValue(15);
|
|
@@ -2304,26 +3387,9 @@
|
|
|
2304
3387
|
}
|
|
2305
3388
|
return dateNow();
|
|
2306
3389
|
}
|
|
2307
|
-
function newId(maxLength) {
|
|
2308
|
-
if (maxLength === void 0) { maxLength = 22; }
|
|
2309
|
-
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
2310
|
-
var number = random32() >>> 0;
|
|
2311
|
-
var chars = 0;
|
|
2312
|
-
var result = "";
|
|
2313
|
-
while (result.length < maxLength) {
|
|
2314
|
-
chars++;
|
|
2315
|
-
result += base64chars.charAt(number & 0x3F);
|
|
2316
|
-
number >>>= 6;
|
|
2317
|
-
if (chars === 5) {
|
|
2318
|
-
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
2319
|
-
chars = 0;
|
|
2320
|
-
}
|
|
2321
|
-
}
|
|
2322
|
-
return result;
|
|
2323
|
-
}
|
|
2324
3390
|
function generateW3CId() {
|
|
2325
3391
|
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
2326
|
-
var oct =
|
|
3392
|
+
var oct = strEmpty$1, tmp;
|
|
2327
3393
|
for (var a = 0; a < 4; a++) {
|
|
2328
3394
|
tmp = random32();
|
|
2329
3395
|
oct +=
|
|
@@ -2406,6 +3472,95 @@
|
|
|
2406
3472
|
_legacyCookieMgr().setEnabled(false);
|
|
2407
3473
|
}
|
|
2408
3474
|
|
|
3475
|
+
var LoggingSeverity = createEnumStyle({
|
|
3476
|
+
CRITICAL: 1 ,
|
|
3477
|
+
WARNING: 2
|
|
3478
|
+
});
|
|
3479
|
+
var _InternalMessageId = createEnumStyle({
|
|
3480
|
+
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
3481
|
+
BrowserCannotReadLocalStorage: 1 ,
|
|
3482
|
+
BrowserCannotReadSessionStorage: 2 ,
|
|
3483
|
+
BrowserCannotWriteLocalStorage: 3 ,
|
|
3484
|
+
BrowserCannotWriteSessionStorage: 4 ,
|
|
3485
|
+
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
3486
|
+
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
3487
|
+
CannotSendEmptyTelemetry: 7 ,
|
|
3488
|
+
ClientPerformanceMathError: 8 ,
|
|
3489
|
+
ErrorParsingAISessionCookie: 9 ,
|
|
3490
|
+
ErrorPVCalc: 10 ,
|
|
3491
|
+
ExceptionWhileLoggingError: 11 ,
|
|
3492
|
+
FailedAddingTelemetryToBuffer: 12 ,
|
|
3493
|
+
FailedMonitorAjaxAbort: 13 ,
|
|
3494
|
+
FailedMonitorAjaxDur: 14 ,
|
|
3495
|
+
FailedMonitorAjaxOpen: 15 ,
|
|
3496
|
+
FailedMonitorAjaxRSC: 16 ,
|
|
3497
|
+
FailedMonitorAjaxSend: 17 ,
|
|
3498
|
+
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
3499
|
+
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
3500
|
+
FailedToSendQueuedTelemetry: 20 ,
|
|
3501
|
+
FailedToReportDataLoss: 21 ,
|
|
3502
|
+
FlushFailed: 22 ,
|
|
3503
|
+
MessageLimitPerPVExceeded: 23 ,
|
|
3504
|
+
MissingRequiredFieldSpecification: 24 ,
|
|
3505
|
+
NavigationTimingNotSupported: 25 ,
|
|
3506
|
+
OnError: 26 ,
|
|
3507
|
+
SessionRenewalDateIsZero: 27 ,
|
|
3508
|
+
SenderNotInitialized: 28 ,
|
|
3509
|
+
StartTrackEventFailed: 29 ,
|
|
3510
|
+
StopTrackEventFailed: 30 ,
|
|
3511
|
+
StartTrackFailed: 31 ,
|
|
3512
|
+
StopTrackFailed: 32 ,
|
|
3513
|
+
TelemetrySampledAndNotSent: 33 ,
|
|
3514
|
+
TrackEventFailed: 34 ,
|
|
3515
|
+
TrackExceptionFailed: 35 ,
|
|
3516
|
+
TrackMetricFailed: 36 ,
|
|
3517
|
+
TrackPVFailed: 37 ,
|
|
3518
|
+
TrackPVFailedCalc: 38 ,
|
|
3519
|
+
TrackTraceFailed: 39 ,
|
|
3520
|
+
TransmissionFailed: 40 ,
|
|
3521
|
+
FailedToSetStorageBuffer: 41 ,
|
|
3522
|
+
FailedToRestoreStorageBuffer: 42 ,
|
|
3523
|
+
InvalidBackendResponse: 43 ,
|
|
3524
|
+
FailedToFixDepricatedValues: 44 ,
|
|
3525
|
+
InvalidDurationValue: 45 ,
|
|
3526
|
+
TelemetryEnvelopeInvalid: 46 ,
|
|
3527
|
+
CreateEnvelopeError: 47 ,
|
|
3528
|
+
CannotSerializeObject: 48 ,
|
|
3529
|
+
CannotSerializeObjectNonSerializable: 49 ,
|
|
3530
|
+
CircularReferenceDetected: 50 ,
|
|
3531
|
+
ClearAuthContextFailed: 51 ,
|
|
3532
|
+
ExceptionTruncated: 52 ,
|
|
3533
|
+
IllegalCharsInName: 53 ,
|
|
3534
|
+
ItemNotInArray: 54 ,
|
|
3535
|
+
MaxAjaxPerPVExceeded: 55 ,
|
|
3536
|
+
MessageTruncated: 56 ,
|
|
3537
|
+
NameTooLong: 57 ,
|
|
3538
|
+
SampleRateOutOfRange: 58 ,
|
|
3539
|
+
SetAuthContextFailed: 59 ,
|
|
3540
|
+
SetAuthContextFailedAccountName: 60 ,
|
|
3541
|
+
StringValueTooLong: 61 ,
|
|
3542
|
+
StartCalledMoreThanOnce: 62 ,
|
|
3543
|
+
StopCalledWithoutStart: 63 ,
|
|
3544
|
+
TelemetryInitializerFailed: 64 ,
|
|
3545
|
+
TrackArgumentsNotSpecified: 65 ,
|
|
3546
|
+
UrlTooLong: 66 ,
|
|
3547
|
+
SessionStorageBufferFull: 67 ,
|
|
3548
|
+
CannotAccessCookie: 68 ,
|
|
3549
|
+
IdTooLong: 69 ,
|
|
3550
|
+
InvalidEvent: 70 ,
|
|
3551
|
+
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
3552
|
+
SendBrowserInfoOnUserInit: 72 ,
|
|
3553
|
+
PluginException: 73 ,
|
|
3554
|
+
NotificationException: 74 ,
|
|
3555
|
+
SnippetScriptLoadFailure: 99 ,
|
|
3556
|
+
InvalidInstrumentationKey: 100 ,
|
|
3557
|
+
CannotParseAiBlobValue: 101 ,
|
|
3558
|
+
InvalidContentBlob: 102 ,
|
|
3559
|
+
TrackPageActionEventFailed: 103 ,
|
|
3560
|
+
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
3561
|
+
InMemoryStorageBufferFull: 105
|
|
3562
|
+
});
|
|
3563
|
+
|
|
2409
3564
|
var RequestHeaders = {
|
|
2410
3565
|
requestContextHeader: "Request-Context",
|
|
2411
3566
|
requestContextTargetKey: "appId",
|
|
@@ -2438,7 +3593,7 @@
|
|
|
2438
3593
|
name = strTrim(name.toString());
|
|
2439
3594
|
if (name.length > 150 ) {
|
|
2440
3595
|
nameTrunc = name.substring(0, 150 );
|
|
2441
|
-
logger
|
|
3596
|
+
_throwInternal(logger, 2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
|
|
2442
3597
|
}
|
|
2443
3598
|
}
|
|
2444
3599
|
return nameTrunc || name;
|
|
@@ -2451,7 +3606,7 @@
|
|
|
2451
3606
|
value = strTrim(value);
|
|
2452
3607
|
if (value.toString().length > maxLength) {
|
|
2453
3608
|
valueTrunc = value.toString().substring(0, maxLength);
|
|
2454
|
-
logger
|
|
3609
|
+
_throwInternal(logger, 2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
|
|
2455
3610
|
}
|
|
2456
3611
|
}
|
|
2457
3612
|
return valueTrunc || value;
|
|
@@ -2464,7 +3619,7 @@
|
|
|
2464
3619
|
if (message) {
|
|
2465
3620
|
if (message.length > 32768 ) {
|
|
2466
3621
|
messageTrunc = message.substring(0, 32768 );
|
|
2467
|
-
logger
|
|
3622
|
+
_throwInternal(logger, 2 , _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
|
|
2468
3623
|
}
|
|
2469
3624
|
}
|
|
2470
3625
|
return messageTrunc || message;
|
|
@@ -2475,7 +3630,7 @@
|
|
|
2475
3630
|
var value = "" + exception;
|
|
2476
3631
|
if (value.length > 32768 ) {
|
|
2477
3632
|
exceptionTrunc = value.substring(0, 32768 );
|
|
2478
|
-
logger
|
|
3633
|
+
_throwInternal(logger, 2 , _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
|
|
2479
3634
|
}
|
|
2480
3635
|
}
|
|
2481
3636
|
return exceptionTrunc || exception;
|
|
@@ -2489,7 +3644,7 @@
|
|
|
2489
3644
|
value = getJSON().stringify(value);
|
|
2490
3645
|
}
|
|
2491
3646
|
catch (e) {
|
|
2492
|
-
logger
|
|
3647
|
+
_throwInternal(logger, 2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
|
|
2493
3648
|
}
|
|
2494
3649
|
}
|
|
2495
3650
|
value = dataSanitizeString(logger, value, 8192 );
|
|
@@ -2520,7 +3675,7 @@
|
|
|
2520
3675
|
input = strTrim(input);
|
|
2521
3676
|
if (input.length > maxLength) {
|
|
2522
3677
|
inputTrunc = input.substring(0, maxLength);
|
|
2523
|
-
logger
|
|
3678
|
+
_throwInternal(logger, 2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
|
|
2524
3679
|
}
|
|
2525
3680
|
}
|
|
2526
3681
|
return inputTrunc || input;
|
|
@@ -2530,21 +3685,22 @@
|
|
|
2530
3685
|
return s.substr(s.length - 3);
|
|
2531
3686
|
}
|
|
2532
3687
|
|
|
3688
|
+
var strEmpty = "";
|
|
2533
3689
|
function msToTimeSpan(totalms) {
|
|
2534
3690
|
if (isNaN(totalms) || totalms < 0) {
|
|
2535
3691
|
totalms = 0;
|
|
2536
3692
|
}
|
|
2537
3693
|
totalms = Math.round(totalms);
|
|
2538
|
-
var ms =
|
|
2539
|
-
var sec =
|
|
2540
|
-
var min =
|
|
2541
|
-
var hour =
|
|
3694
|
+
var ms = strEmpty + totalms % 1000;
|
|
3695
|
+
var sec = strEmpty + Math.floor(totalms / 1000) % 60;
|
|
3696
|
+
var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
|
|
3697
|
+
var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
|
|
2542
3698
|
var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
|
|
2543
3699
|
ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
|
|
2544
3700
|
sec = sec.length < 2 ? "0" + sec : sec;
|
|
2545
3701
|
min = min.length < 2 ? "0" + min : min;
|
|
2546
3702
|
hour = hour.length < 2 ? "0" + hour : hour;
|
|
2547
|
-
return (days > 0 ? days + "." :
|
|
3703
|
+
return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
|
|
2548
3704
|
}
|
|
2549
3705
|
|
|
2550
3706
|
var DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
|
|
@@ -2553,17 +3709,15 @@
|
|
|
2553
3709
|
var HttpMethod = "http.method";
|
|
2554
3710
|
var strNotSpecified = "not_specified";
|
|
2555
3711
|
|
|
2556
|
-
var StorageType
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
|
|
2566
|
-
})(DistributedTracingModes || (DistributedTracingModes = {}));
|
|
3712
|
+
var StorageType = createEnumStyle({
|
|
3713
|
+
LocalStorage: 0 ,
|
|
3714
|
+
SessionStorage: 1
|
|
3715
|
+
});
|
|
3716
|
+
createEnumStyle({
|
|
3717
|
+
AI: 0 ,
|
|
3718
|
+
AI_AND_W3C: 1 ,
|
|
3719
|
+
W3C: 2
|
|
3720
|
+
});
|
|
2567
3721
|
|
|
2568
3722
|
var _canUseSessionStorage = undefined;
|
|
2569
3723
|
function _getVerifiedStorageObject(storageType) {
|
|
@@ -2590,8 +3744,8 @@
|
|
|
2590
3744
|
}
|
|
2591
3745
|
return null;
|
|
2592
3746
|
}
|
|
2593
|
-
function utlCanUseSessionStorage() {
|
|
2594
|
-
if (_canUseSessionStorage === undefined) {
|
|
3747
|
+
function utlCanUseSessionStorage(reset) {
|
|
3748
|
+
if (reset || _canUseSessionStorage === undefined) {
|
|
2595
3749
|
_canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage);
|
|
2596
3750
|
}
|
|
2597
3751
|
return _canUseSessionStorage;
|
|
@@ -2604,7 +3758,7 @@
|
|
|
2604
3758
|
}
|
|
2605
3759
|
catch (e) {
|
|
2606
3760
|
_canUseSessionStorage = false;
|
|
2607
|
-
logger
|
|
3761
|
+
_throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2608
3762
|
}
|
|
2609
3763
|
}
|
|
2610
3764
|
return null;
|
|
@@ -2618,7 +3772,7 @@
|
|
|
2618
3772
|
}
|
|
2619
3773
|
catch (e) {
|
|
2620
3774
|
_canUseSessionStorage = false;
|
|
2621
|
-
logger
|
|
3775
|
+
_throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2622
3776
|
}
|
|
2623
3777
|
}
|
|
2624
3778
|
return false;
|
|
@@ -3904,7 +5058,7 @@
|
|
|
3904
5058
|
}
|
|
3905
5059
|
}
|
|
3906
5060
|
var EnvelopeCreator = {
|
|
3907
|
-
Version: "2.7.5-nightly.2203-
|
|
5061
|
+
Version: "2.7.5-nightly.2203-03"
|
|
3908
5062
|
};
|
|
3909
5063
|
function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
|
|
3910
5064
|
EnvelopeCreatorInit(logger, telemetryItem);
|
|
@@ -4199,65 +5353,81 @@
|
|
|
4199
5353
|
return Serializer;
|
|
4200
5354
|
}());
|
|
4201
5355
|
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
target.onoffline = _setOffline;
|
|
4221
|
-
isListening = true;
|
|
4222
|
-
}
|
|
4223
|
-
}
|
|
4224
|
-
if (isListening) {
|
|
4225
|
-
var _navigator = getNavigator();
|
|
4226
|
-
if (_navigator && !isNullOrUndefined(_navigator.onLine)) {
|
|
4227
|
-
_onlineStatus = _navigator.onLine;
|
|
4228
|
-
}
|
|
5356
|
+
function _disableEvents(target, evtNamespace) {
|
|
5357
|
+
eventOff(target, null, null, evtNamespace);
|
|
5358
|
+
}
|
|
5359
|
+
function createOfflineListener(parentEvtNamespace) {
|
|
5360
|
+
var _document = getDocument();
|
|
5361
|
+
var _navigator = getNavigator();
|
|
5362
|
+
var _isListening = false;
|
|
5363
|
+
var _onlineStatus = true;
|
|
5364
|
+
var _evtNamespace = mergeEvtNamespace(createUniqueNamespace("OfflineListener"), parentEvtNamespace);
|
|
5365
|
+
try {
|
|
5366
|
+
if (_enableEvents(getWindow())) {
|
|
5367
|
+
_isListening = true;
|
|
5368
|
+
}
|
|
5369
|
+
if (_document) {
|
|
5370
|
+
var target = _document.body || _document;
|
|
5371
|
+
if (target.ononline) {
|
|
5372
|
+
if (_enableEvents(target)) {
|
|
5373
|
+
_isListening = true;
|
|
4229
5374
|
}
|
|
4230
5375
|
}
|
|
4231
|
-
|
|
4232
|
-
|
|
5376
|
+
}
|
|
5377
|
+
if (_isListening) {
|
|
5378
|
+
if (_navigator && !isNullOrUndefined(_navigator.onLine)) {
|
|
5379
|
+
_onlineStatus = _navigator.onLine;
|
|
4233
5380
|
}
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
};
|
|
4246
|
-
_self.isOffline = function () {
|
|
4247
|
-
return !_self.isOnline();
|
|
4248
|
-
};
|
|
4249
|
-
function _setOnline() {
|
|
4250
|
-
_onlineStatus = true;
|
|
5381
|
+
}
|
|
5382
|
+
}
|
|
5383
|
+
catch (e) {
|
|
5384
|
+
_isListening = false;
|
|
5385
|
+
}
|
|
5386
|
+
function _enableEvents(target) {
|
|
5387
|
+
var enabled = false;
|
|
5388
|
+
if (target) {
|
|
5389
|
+
enabled = eventOn(target, "online", _setOnline, _evtNamespace);
|
|
5390
|
+
if (enabled) {
|
|
5391
|
+
eventOn(target, "offline", _setOffline, _evtNamespace);
|
|
4251
5392
|
}
|
|
4252
|
-
|
|
4253
|
-
|
|
5393
|
+
}
|
|
5394
|
+
return enabled;
|
|
5395
|
+
}
|
|
5396
|
+
function _setOnline() {
|
|
5397
|
+
_onlineStatus = true;
|
|
5398
|
+
}
|
|
5399
|
+
function _setOffline() {
|
|
5400
|
+
_onlineStatus = false;
|
|
5401
|
+
}
|
|
5402
|
+
function _isOnline() {
|
|
5403
|
+
var result = true;
|
|
5404
|
+
if (_isListening) {
|
|
5405
|
+
result = _onlineStatus;
|
|
5406
|
+
}
|
|
5407
|
+
else if (_navigator && !isNullOrUndefined(_navigator.onLine)) {
|
|
5408
|
+
result = _navigator.onLine;
|
|
5409
|
+
}
|
|
5410
|
+
return result;
|
|
5411
|
+
}
|
|
5412
|
+
function _unload() {
|
|
5413
|
+
var win = getWindow();
|
|
5414
|
+
if (win && _isListening) {
|
|
5415
|
+
_disableEvents(win, _evtNamespace);
|
|
5416
|
+
if (_document) {
|
|
5417
|
+
var target = _document.body || _document;
|
|
5418
|
+
if (!isUndefined(target.ononline)) {
|
|
5419
|
+
_disableEvents(target, _evtNamespace);
|
|
5420
|
+
}
|
|
4254
5421
|
}
|
|
4255
|
-
|
|
5422
|
+
_isListening = false;
|
|
5423
|
+
}
|
|
4256
5424
|
}
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
5425
|
+
return {
|
|
5426
|
+
isOnline: _isOnline,
|
|
5427
|
+
isListening: function () { return _isListening; },
|
|
5428
|
+
unload: _unload
|
|
5429
|
+
};
|
|
5430
|
+
}
|
|
4261
5431
|
|
|
4262
5432
|
var MIN_INPUT_LENGTH = 8;
|
|
4263
5433
|
var HashCodeScoreGenerator = /** @class */ (function () {
|
|
@@ -4385,22 +5555,22 @@
|
|
|
4385
5555
|
var _this = _super.call(this) || this;
|
|
4386
5556
|
_this.priority = 1001;
|
|
4387
5557
|
_this.identifier = BreezeChannelIdentifier;
|
|
5558
|
+
_this._senderConfig = _getDefaultAppInsightsChannelConfig();
|
|
4388
5559
|
var _consecutiveErrors;
|
|
4389
5560
|
var _retryAt;
|
|
4390
5561
|
var _lastSend;
|
|
4391
|
-
var _paused
|
|
5562
|
+
var _paused;
|
|
4392
5563
|
var _timeoutHandle;
|
|
4393
5564
|
var _serializer;
|
|
4394
5565
|
var _stamp_specific_redirects;
|
|
4395
|
-
var _headers
|
|
5566
|
+
var _headers;
|
|
4396
5567
|
var _syncFetchPayload = 0;
|
|
4397
5568
|
var _fallbackSender;
|
|
4398
5569
|
var _syncUnloadSender;
|
|
4399
|
-
|
|
5570
|
+
var _offlineListener;
|
|
5571
|
+
var _evtNamespace;
|
|
4400
5572
|
dynamicProto(Sender, _this, function (_self, _base) {
|
|
4401
|
-
|
|
4402
|
-
throwError("Method not implemented.");
|
|
4403
|
-
}
|
|
5573
|
+
_initDefaults();
|
|
4404
5574
|
_self.pause = function () {
|
|
4405
5575
|
_clearScheduledTimer();
|
|
4406
5576
|
_paused = true;
|
|
@@ -4415,14 +5585,15 @@
|
|
|
4415
5585
|
_setupTimer();
|
|
4416
5586
|
}
|
|
4417
5587
|
};
|
|
4418
|
-
_self.flush = function () {
|
|
5588
|
+
_self.flush = function (isAsync, callBack, sendReason) {
|
|
5589
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
4419
5590
|
if (!_paused) {
|
|
4420
5591
|
_clearScheduledTimer();
|
|
4421
5592
|
try {
|
|
4422
|
-
_self.triggerSend(
|
|
5593
|
+
_self.triggerSend(isAsync, null, sendReason || 1 );
|
|
4423
5594
|
}
|
|
4424
5595
|
catch (e) {
|
|
4425
|
-
_self.diagLog()
|
|
5596
|
+
_throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.FlushFailed, "flush failed, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
4426
5597
|
}
|
|
4427
5598
|
}
|
|
4428
5599
|
};
|
|
@@ -4433,7 +5604,7 @@
|
|
|
4433
5604
|
_self.triggerSend(true, _doUnloadSend, 2 );
|
|
4434
5605
|
}
|
|
4435
5606
|
catch (e) {
|
|
4436
|
-
_self.diagLog()
|
|
5607
|
+
_throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.FailedToSendQueuedTelemetry, "failed to flush with beacon sender on page unload, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
4437
5608
|
}
|
|
4438
5609
|
}
|
|
4439
5610
|
else {
|
|
@@ -4441,11 +5612,13 @@
|
|
|
4441
5612
|
}
|
|
4442
5613
|
}
|
|
4443
5614
|
};
|
|
4444
|
-
_self.teardown = _notImplemented;
|
|
4445
5615
|
_self.addHeader = function (name, value) {
|
|
4446
5616
|
_headers[name] = value;
|
|
4447
5617
|
};
|
|
4448
5618
|
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
5619
|
+
if (_self.isInitialized()) {
|
|
5620
|
+
_throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, "Sender is already initialized");
|
|
5621
|
+
}
|
|
4449
5622
|
_base.initialize(config, core, extensions, pluginChain);
|
|
4450
5623
|
var ctx = _self._getTelCtx();
|
|
4451
5624
|
var identifier = _self.identifier;
|
|
@@ -4456,6 +5629,8 @@
|
|
|
4456
5629
|
_self._sender = null;
|
|
4457
5630
|
_stamp_specific_redirects = 0;
|
|
4458
5631
|
var diagLog = _self.diagLog();
|
|
5632
|
+
_evtNamespace = mergeEvtNamespace(createUniqueNamespace("Sender"), core.evtNamespace && core.evtNamespace());
|
|
5633
|
+
_offlineListener = createOfflineListener(_evtNamespace);
|
|
4459
5634
|
var defaultConfig = _getDefaultAppInsightsChannelConfig();
|
|
4460
5635
|
objForEachKey(defaultConfig, function (field, value) {
|
|
4461
5636
|
_self._senderConfig[field] = function () { return ctx.getConfig(identifier, field, value()); };
|
|
@@ -4464,7 +5639,7 @@
|
|
|
4464
5639
|
? new SessionStorageSendBuffer(diagLog, _self._senderConfig) : new ArraySendBuffer(diagLog, _self._senderConfig);
|
|
4465
5640
|
_self._sample = new Sample(_self._senderConfig.samplingPercentage(), diagLog);
|
|
4466
5641
|
if (!_validateInstrumentationKey(config)) {
|
|
4467
|
-
diagLog
|
|
5642
|
+
_throwInternal(diagLog, LoggingSeverity.CRITICAL, _InternalMessageId.InvalidInstrumentationKey, "Invalid Instrumentation key " + config.instrumentationKey);
|
|
4468
5643
|
}
|
|
4469
5644
|
if (!isInternalApplicationInsightsEndpoint(_self._senderConfig.endpointUrl()) && _self._senderConfig.customHeaders() && _self._senderConfig.customHeaders().length > 0) {
|
|
4470
5645
|
arrForEach(_self._senderConfig.customHeaders(), function (customHeader) {
|
|
@@ -4510,22 +5685,22 @@
|
|
|
4510
5685
|
return;
|
|
4511
5686
|
}
|
|
4512
5687
|
if (!telemetryItem) {
|
|
4513
|
-
itemCtx.diagLog()
|
|
5688
|
+
_throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.CannotSendEmptyTelemetry, "Cannot send empty telemetry");
|
|
4514
5689
|
return;
|
|
4515
5690
|
}
|
|
4516
5691
|
if (telemetryItem.baseData && !telemetryItem.baseType) {
|
|
4517
|
-
itemCtx.diagLog()
|
|
5692
|
+
_throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.InvalidEvent, "Cannot send telemetry without baseData and baseType");
|
|
4518
5693
|
return;
|
|
4519
5694
|
}
|
|
4520
5695
|
if (!telemetryItem.baseType) {
|
|
4521
5696
|
telemetryItem.baseType = "EventData";
|
|
4522
5697
|
}
|
|
4523
5698
|
if (!_self._sender) {
|
|
4524
|
-
itemCtx.diagLog()
|
|
5699
|
+
_throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, "Sender was not initialized");
|
|
4525
5700
|
return;
|
|
4526
5701
|
}
|
|
4527
5702
|
if (!_isSampledIn(telemetryItem)) {
|
|
4528
|
-
itemCtx.diagLog()
|
|
5703
|
+
_throwInternal(itemCtx.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TelemetrySampledAndNotSent, "Telemetry item was sampled out and not sent", { SampleRate: _self._sample.sampleRate });
|
|
4529
5704
|
return;
|
|
4530
5705
|
}
|
|
4531
5706
|
else {
|
|
@@ -4535,7 +5710,7 @@
|
|
|
4535
5710
|
var defaultEnvelopeIkey = telemetryItem.iKey || _self._senderConfig.instrumentationKey();
|
|
4536
5711
|
var aiEnvelope_1 = Sender.constructEnvelope(telemetryItem, defaultEnvelopeIkey, itemCtx.diagLog(), convertUndefined);
|
|
4537
5712
|
if (!aiEnvelope_1) {
|
|
4538
|
-
itemCtx.diagLog()
|
|
5713
|
+
_throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.CreateEnvelopeError, "Unable to create an AppInsights envelope");
|
|
4539
5714
|
return;
|
|
4540
5715
|
}
|
|
4541
5716
|
var doNotSendItem_1 = false;
|
|
@@ -4548,7 +5723,7 @@
|
|
|
4548
5723
|
}
|
|
4549
5724
|
}
|
|
4550
5725
|
catch (e) {
|
|
4551
|
-
itemCtx.diagLog()
|
|
5726
|
+
_throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
|
|
4552
5727
|
}
|
|
4553
5728
|
});
|
|
4554
5729
|
delete telemetryItem.tags[ProcessLegacy];
|
|
@@ -4566,7 +5741,7 @@
|
|
|
4566
5741
|
_setupTimer();
|
|
4567
5742
|
}
|
|
4568
5743
|
catch (e) {
|
|
4569
|
-
itemCtx.diagLog()
|
|
5744
|
+
_throwInternal(itemCtx.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.FailedAddingTelemetryToBuffer, "Failed adding telemetry to the sender's buffer, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
4570
5745
|
}
|
|
4571
5746
|
_self.processNext(telemetryItem, itemCtx);
|
|
4572
5747
|
};
|
|
@@ -4601,13 +5776,18 @@
|
|
|
4601
5776
|
catch (e) {
|
|
4602
5777
|
var ieVer = getIEVersion();
|
|
4603
5778
|
if (!ieVer || ieVer > 9) {
|
|
4604
|
-
_self.diagLog()
|
|
5779
|
+
_throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.TransmissionFailed, "Telemetry transmission failed, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
4605
5780
|
}
|
|
4606
5781
|
}
|
|
4607
5782
|
}
|
|
4608
5783
|
};
|
|
5784
|
+
_self._doTeardown = function (unloadCtx, unloadState) {
|
|
5785
|
+
_self.onunloadFlush();
|
|
5786
|
+
_offlineListener.unload();
|
|
5787
|
+
_initDefaults();
|
|
5788
|
+
};
|
|
4609
5789
|
_self._onError = function (payload, message, event) {
|
|
4610
|
-
_self.diagLog()
|
|
5790
|
+
_throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.OnError, "Failed to send telemetry.", { message: message });
|
|
4611
5791
|
_self._buffer.clearSent(payload);
|
|
4612
5792
|
};
|
|
4613
5793
|
_self._onPartialSuccess = function (payload, results) {
|
|
@@ -4632,7 +5812,7 @@
|
|
|
4632
5812
|
}
|
|
4633
5813
|
if (retry.length > 0) {
|
|
4634
5814
|
_resendPayload(retry);
|
|
4635
|
-
_self.diagLog()
|
|
5815
|
+
_throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, "Partial success. " +
|
|
4636
5816
|
"Delivered: " + payload.length + ", Failed: " + failed.length +
|
|
4637
5817
|
". Will retry to send " + retry.length + " our of " + results.itemsReceived + " items");
|
|
4638
5818
|
}
|
|
@@ -4677,18 +5857,18 @@
|
|
|
4677
5857
|
}
|
|
4678
5858
|
if (!_self._senderConfig.isRetryDisabled() && _isRetriable(status)) {
|
|
4679
5859
|
_resendPayload(payload);
|
|
4680
|
-
_self.diagLog()
|
|
5860
|
+
_throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
|
|
4681
5861
|
"Response code " + status + ". Will retry to send " + payload.length + " items.");
|
|
4682
5862
|
}
|
|
4683
5863
|
else {
|
|
4684
5864
|
_self._onError(payload, errorMessage);
|
|
4685
5865
|
}
|
|
4686
5866
|
}
|
|
4687
|
-
else if (
|
|
5867
|
+
else if (_offlineListener && !_offlineListener.isOnline()) {
|
|
4688
5868
|
if (!_self._senderConfig.isRetryDisabled()) {
|
|
4689
5869
|
var offlineBackOffMultiplier = 10;
|
|
4690
5870
|
_resendPayload(payload, offlineBackOffMultiplier);
|
|
4691
|
-
_self.diagLog()
|
|
5871
|
+
_throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". Offline - Response Code: ".concat(status, ". Offline status: ").concat(!_offlineListener.isOnline(), ". Will retry to send ").concat(payload.length, " items."));
|
|
4692
5872
|
}
|
|
4693
5873
|
}
|
|
4694
5874
|
else {
|
|
@@ -4755,8 +5935,8 @@
|
|
|
4755
5935
|
}
|
|
4756
5936
|
}
|
|
4757
5937
|
if (droppedPayload.length > 0) {
|
|
4758
|
-
_fallbackSender(droppedPayload, true);
|
|
4759
|
-
_self.diagLog()
|
|
5938
|
+
_fallbackSender && _fallbackSender(droppedPayload, true);
|
|
5939
|
+
_throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with normal sender.");
|
|
4760
5940
|
}
|
|
4761
5941
|
}
|
|
4762
5942
|
}
|
|
@@ -4797,7 +5977,7 @@
|
|
|
4797
5977
|
}
|
|
4798
5978
|
else {
|
|
4799
5979
|
_fallbackSender && _fallbackSender(payload, true);
|
|
4800
|
-
_self.diagLog()
|
|
5980
|
+
_throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with xhrSender.");
|
|
4801
5981
|
}
|
|
4802
5982
|
}
|
|
4803
5983
|
}
|
|
@@ -4888,7 +6068,7 @@
|
|
|
4888
6068
|
}
|
|
4889
6069
|
}
|
|
4890
6070
|
catch (e) {
|
|
4891
|
-
_self.diagLog()
|
|
6071
|
+
_throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.InvalidBackendResponse, "Cannot parse the response. " + getExceptionName(e), {
|
|
4892
6072
|
response: response
|
|
4893
6073
|
});
|
|
4894
6074
|
}
|
|
@@ -4959,7 +6139,7 @@
|
|
|
4959
6139
|
xdr.onerror = function (event) { return _self._onError(payload, _formatErrorMessageXdr(xdr), event); };
|
|
4960
6140
|
var hostingProtocol = _window && _window.location && _window.location.protocol || "";
|
|
4961
6141
|
if (_self._senderConfig.endpointUrl().lastIndexOf(hostingProtocol, 0) !== 0) {
|
|
4962
|
-
_self.diagLog()
|
|
6142
|
+
_throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
|
|
4963
6143
|
"Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.");
|
|
4964
6144
|
buffer.clear();
|
|
4965
6145
|
return;
|
|
@@ -4990,7 +6170,7 @@
|
|
|
4990
6170
|
manager.eventsSendRequest(sendRequest, isAsync);
|
|
4991
6171
|
}
|
|
4992
6172
|
catch (e) {
|
|
4993
|
-
_self.diagLog()
|
|
6173
|
+
_throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.NotificationException, "send request notification failed: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
4994
6174
|
}
|
|
4995
6175
|
}
|
|
4996
6176
|
}
|
|
@@ -5003,6 +6183,25 @@
|
|
|
5003
6183
|
var regexp = new RegExp(UUID_Regex);
|
|
5004
6184
|
return regexp.test(config.instrumentationKey);
|
|
5005
6185
|
}
|
|
6186
|
+
function _initDefaults() {
|
|
6187
|
+
_self._sender = null;
|
|
6188
|
+
_self._buffer = null;
|
|
6189
|
+
_self._appId = null;
|
|
6190
|
+
_self._sample = null;
|
|
6191
|
+
_headers = {};
|
|
6192
|
+
_offlineListener = null;
|
|
6193
|
+
_consecutiveErrors = 0;
|
|
6194
|
+
_retryAt = null;
|
|
6195
|
+
_lastSend = null;
|
|
6196
|
+
_paused = false;
|
|
6197
|
+
_timeoutHandle = null;
|
|
6198
|
+
_serializer = null;
|
|
6199
|
+
_stamp_specific_redirects = 0;
|
|
6200
|
+
_syncFetchPayload = 0;
|
|
6201
|
+
_fallbackSender = null;
|
|
6202
|
+
_syncUnloadSender = null;
|
|
6203
|
+
_evtNamespace = null;
|
|
6204
|
+
}
|
|
5006
6205
|
});
|
|
5007
6206
|
return _this;
|
|
5008
6207
|
}
|
|
@@ -5022,46 +6221,41 @@
|
|
|
5022
6221
|
|
|
5023
6222
|
var ApplicationInsights = /** @class */ (function () {
|
|
5024
6223
|
function ApplicationInsights(config) {
|
|
6224
|
+
var core = new AppInsightsCore();
|
|
5025
6225
|
if (isNullOrUndefined(config) ||
|
|
5026
6226
|
isNullOrUndefined(config.instrumentationKey)) {
|
|
5027
6227
|
throwError("Invalid input configuration");
|
|
5028
6228
|
}
|
|
5029
|
-
this
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
6229
|
+
dynamicProto(ApplicationInsights, this, function (_self) {
|
|
6230
|
+
_self.config = config;
|
|
6231
|
+
_self.getSKUDefaults();
|
|
6232
|
+
_initialize();
|
|
6233
|
+
_self.initialize = _initialize;
|
|
6234
|
+
_self.getSKUDefaults = function () {
|
|
6235
|
+
_self.config.diagnosticLogInterval =
|
|
6236
|
+
_self.config.diagnosticLogInterval && _self.config.diagnosticLogInterval > 0 ? _self.config.diagnosticLogInterval : 10000;
|
|
6237
|
+
};
|
|
6238
|
+
proxyFunctions(_self, core, [
|
|
6239
|
+
"track",
|
|
6240
|
+
"flush",
|
|
6241
|
+
"pollInternalLogs",
|
|
6242
|
+
"stopPollingInternalLogs",
|
|
6243
|
+
"unload",
|
|
6244
|
+
"getPlugin",
|
|
6245
|
+
"addPlugin",
|
|
6246
|
+
"evtNamespace",
|
|
6247
|
+
"addUnloadCb"
|
|
6248
|
+
]);
|
|
6249
|
+
function _initialize() {
|
|
6250
|
+
var extensions = [];
|
|
6251
|
+
var appInsightsChannel = new Sender();
|
|
6252
|
+
extensions.push(appInsightsChannel);
|
|
6253
|
+
core.initialize(this.config, extensions);
|
|
6254
|
+
appInsightsChannel.initialize(this.config, core, extensions);
|
|
6255
|
+
core.pollInternalLogs();
|
|
6256
|
+
}
|
|
5053
6257
|
});
|
|
5054
|
-
}
|
|
5055
|
-
ApplicationInsights.prototype.pollInternalLogs = function () {
|
|
5056
|
-
this.core.pollInternalLogs();
|
|
5057
|
-
};
|
|
5058
|
-
ApplicationInsights.prototype.stopPollingInternalLogs = function () {
|
|
5059
|
-
this.core.stopPollingInternalLogs();
|
|
5060
|
-
};
|
|
5061
|
-
ApplicationInsights.prototype.getSKUDefaults = function () {
|
|
5062
|
-
this.config.diagnosticLogInterval =
|
|
5063
|
-
this.config.diagnosticLogInterval && this.config.diagnosticLogInterval > 0 ? this.config.diagnosticLogInterval : 10000;
|
|
5064
|
-
};
|
|
6258
|
+
}
|
|
5065
6259
|
return ApplicationInsights;
|
|
5066
6260
|
}());
|
|
5067
6261
|
|
|
@@ -5069,8 +6263,13 @@
|
|
|
5069
6263
|
exports.ApplicationInsights = ApplicationInsights;
|
|
5070
6264
|
exports.CoreUtils = CoreUtils;
|
|
5071
6265
|
exports.Sender = Sender;
|
|
6266
|
+
exports._InternalMessageId = _InternalMessageId;
|
|
6267
|
+
exports.arrForEach = arrForEach;
|
|
6268
|
+
exports.isNullOrUndefined = isNullOrUndefined;
|
|
6269
|
+
exports.proxyFunctions = proxyFunctions;
|
|
6270
|
+
exports.throwError = throwError;
|
|
5072
6271
|
|
|
5073
6272
|
(function(obj, prop, descriptor) { /* ai_es3_polyfil defineProperty */ var func = Object["defineProperty"]; if (func) { try { return func(obj, prop, descriptor); } catch(e) { /* IE8 defines defineProperty, but will throw */ } } if (descriptor && typeof descriptor.value !== undefined) { obj[prop] = descriptor.value; } return obj; })(exports, '__esModule', { value: true });
|
|
5074
6273
|
|
|
5075
6274
|
}));
|
|
5076
|
-
//# sourceMappingURL=aib.2.7.5-nightly.2203-
|
|
6275
|
+
//# sourceMappingURL=aib.2.7.5-nightly.2203-03.js.map
|