@microsoft/applicationinsights-analytics-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-06
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-analytics-js.integrity.json +9 -9
- package/browser/applicationinsights-analytics-js.js +1917 -1142
- package/browser/applicationinsights-analytics-js.js.map +1 -1
- package/browser/applicationinsights-analytics-js.min.js +2 -2
- package/browser/applicationinsights-analytics-js.min.js.map +1 -1
- package/dist/applicationinsights-analytics-js.api.json +138 -229
- package/dist/applicationinsights-analytics-js.api.md +8 -18
- package/dist/applicationinsights-analytics-js.d.ts +9 -104
- package/dist/applicationinsights-analytics-js.js +1917 -1142
- package/dist/applicationinsights-analytics-js.js.map +1 -1
- package/dist/applicationinsights-analytics-js.min.js +2 -2
- package/dist/applicationinsights-analytics-js.min.js.map +1 -1
- package/dist/applicationinsights-analytics-js.rollup.d.ts +9 -104
- package/dist-esm/JavaScriptSDK/AnalyticsPlugin.js +674 -0
- package/dist-esm/JavaScriptSDK/AnalyticsPlugin.js.map +1 -0
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js +24 -11
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js +15 -14
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js +10 -10
- package/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Timing.js +39 -0
- package/dist-esm/JavaScriptSDK/Timing.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryConfig.js +1 -1
- package/dist-esm/applicationinsights-analytics-js.js +2 -2
- package/dist-esm/applicationinsights-analytics-js.js.map +1 -1
- package/package.json +6 -6
- package/src/JavaScriptSDK/{ApplicationInsights.ts → AnalyticsPlugin.ts} +420 -342
- package/src/JavaScriptSDK/Telemetry/PageViewManager.ts +39 -20
- package/src/JavaScriptSDK/Telemetry/PageViewPerformanceManager.ts +19 -17
- package/src/JavaScriptSDK/Telemetry/PageVisitTimeManager.ts +6 -6
- package/src/JavaScriptSDK/Timing.ts +46 -0
- package/src/applicationinsights-analytics-js.ts +1 -1
- package/types/JavaScriptSDK/{ApplicationInsights.d.ts → AnalyticsPlugin.d.ts} +12 -16
- package/types/JavaScriptSDK/Telemetry/PageViewManager.d.ts +2 -1
- package/types/JavaScriptSDK/Telemetry/PageViewPerformanceManager.d.ts +9 -9
- package/types/JavaScriptSDK/Telemetry/PageVisitTimeManager.d.ts +4 -4
- package/types/JavaScriptSDK/Timing.d.ts +18 -0
- package/types/applicationinsights-analytics-js.d.ts +1 -1
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/JavaScriptSDK/ApplicationInsights.js +0 -606
- package/dist-esm/JavaScriptSDK/ApplicationInsights.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Web Analytics, 2.8.0-nightly.
|
|
2
|
+
* Application Insights JavaScript SDK - Web Analytics, 2.8.0-nightly.2204-06
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -75,7 +75,9 @@
|
|
|
75
75
|
var __assignFn = ObjAssign || __objAssignFnImpl;
|
|
76
76
|
var extendStaticsFn = function (d, b) {
|
|
77
77
|
extendStaticsFn = ObjClass["setPrototypeOf"] ||
|
|
78
|
-
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
78
|
+
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
79
|
+
d.__proto__ = b;
|
|
80
|
+
}) ||
|
|
79
81
|
function (d, b) {
|
|
80
82
|
for (var p in b) {
|
|
81
83
|
if (b[strShimHasOwnProperty](p)) {
|
|
@@ -90,10 +92,395 @@
|
|
|
90
92
|
throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
91
93
|
}
|
|
92
94
|
extendStaticsFn(d, b);
|
|
93
|
-
function __() {
|
|
95
|
+
function __() {
|
|
96
|
+
this.constructor = d;
|
|
97
|
+
}
|
|
94
98
|
d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
|
|
95
99
|
}
|
|
96
100
|
|
|
101
|
+
var strEmpty$1 = "";
|
|
102
|
+
var strSetNextPlugin = "setNextPlugin";
|
|
103
|
+
var strIsInitialized = "isInitialized";
|
|
104
|
+
var strTeardown = "teardown";
|
|
105
|
+
var strCore = "core";
|
|
106
|
+
var strUpdate = "update";
|
|
107
|
+
var strDisabled = "disabled";
|
|
108
|
+
var strDoTeardown = "_doTeardown";
|
|
109
|
+
|
|
110
|
+
var strToISOString = "toISOString";
|
|
111
|
+
var cStrEndsWith = "endsWith";
|
|
112
|
+
var strMap = "map";
|
|
113
|
+
var cStrTrim = "trim";
|
|
114
|
+
var strToString = "toString";
|
|
115
|
+
var str__Proto$1 = "__proto__";
|
|
116
|
+
var strConstructor = "constructor";
|
|
117
|
+
var _objDefineProperty$1 = ObjDefineProperty;
|
|
118
|
+
var _objFreeze = ObjClass.freeze;
|
|
119
|
+
var _objKeys = ObjClass.keys;
|
|
120
|
+
var StringProto = String[strShimPrototype];
|
|
121
|
+
var _strTrim = StringProto[cStrTrim];
|
|
122
|
+
var _strEndsWith = StringProto[cStrEndsWith];
|
|
123
|
+
var DateProto = Date[strShimPrototype];
|
|
124
|
+
var _dataToISOString = DateProto[strToISOString];
|
|
125
|
+
var _isArray = Array.isArray;
|
|
126
|
+
var _objToString = ObjProto[strToString];
|
|
127
|
+
var _fnToString = ObjHasOwnProperty[strToString];
|
|
128
|
+
var _objFunctionString = _fnToString.call(ObjClass);
|
|
129
|
+
var rCamelCase = /-([a-z])/g;
|
|
130
|
+
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
131
|
+
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
132
|
+
var _objGetPrototypeOf$1 = Object["getPrototypeOf"];
|
|
133
|
+
function _getObjProto$1(target) {
|
|
134
|
+
if (target) {
|
|
135
|
+
if (_objGetPrototypeOf$1) {
|
|
136
|
+
return _objGetPrototypeOf$1(target);
|
|
137
|
+
}
|
|
138
|
+
var newProto = target[str__Proto$1] || target[strShimPrototype] || target[strConstructor];
|
|
139
|
+
if (newProto) {
|
|
140
|
+
return newProto;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
function isUndefined(value) {
|
|
146
|
+
return value === undefined || typeof value === strShimUndefined;
|
|
147
|
+
}
|
|
148
|
+
function isNullOrUndefined(value) {
|
|
149
|
+
return (value === null || isUndefined(value));
|
|
150
|
+
}
|
|
151
|
+
function isNotNullOrUndefined(value) {
|
|
152
|
+
return !isNullOrUndefined(value);
|
|
153
|
+
}
|
|
154
|
+
function hasOwnProperty(obj, prop) {
|
|
155
|
+
return !!(obj && ObjHasOwnProperty.call(obj, prop));
|
|
156
|
+
}
|
|
157
|
+
function isObject(value) {
|
|
158
|
+
return !!(value && typeof value === strShimObject);
|
|
159
|
+
}
|
|
160
|
+
function isFunction(value) {
|
|
161
|
+
return !!(value && typeof value === strShimFunction);
|
|
162
|
+
}
|
|
163
|
+
function normalizeJsName(name) {
|
|
164
|
+
var value = name;
|
|
165
|
+
if (value && isString(value)) {
|
|
166
|
+
value = value.replace(rCamelCase, function (_all, letter) {
|
|
167
|
+
return letter.toUpperCase();
|
|
168
|
+
});
|
|
169
|
+
value = value.replace(rNormalizeInvalid, "_");
|
|
170
|
+
value = value.replace(rLeadingNumeric, function (_all, match) {
|
|
171
|
+
return "_" + match;
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return value;
|
|
175
|
+
}
|
|
176
|
+
function objForEachKey(target, callbackfn) {
|
|
177
|
+
if (target) {
|
|
178
|
+
for (var prop in target) {
|
|
179
|
+
if (ObjHasOwnProperty.call(target, prop)) {
|
|
180
|
+
callbackfn.call(target, prop, target[prop]);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function strEndsWith(value, search) {
|
|
186
|
+
var result = false;
|
|
187
|
+
if (value && search && !(result = value === search)) {
|
|
188
|
+
result = _strEndsWith ? value[cStrEndsWith](search) : _strEndsWithPoly(value, search);
|
|
189
|
+
}
|
|
190
|
+
return result;
|
|
191
|
+
}
|
|
192
|
+
function _strEndsWithPoly(value, search) {
|
|
193
|
+
var result = false;
|
|
194
|
+
var searchLen = search ? search.length : 0;
|
|
195
|
+
var valLen = value ? value.length : 0;
|
|
196
|
+
if (searchLen && valLen && valLen >= searchLen && !(result = value === search)) {
|
|
197
|
+
var pos = valLen - 1;
|
|
198
|
+
for (var lp = searchLen - 1; lp >= 0; lp--) {
|
|
199
|
+
if (value[pos] != search[lp]) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
pos--;
|
|
203
|
+
}
|
|
204
|
+
result = true;
|
|
205
|
+
}
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
function strContains(value, search) {
|
|
209
|
+
if (value && search) {
|
|
210
|
+
return value.indexOf(search) !== -1;
|
|
211
|
+
}
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
var isArray = _isArray || _isArrayPoly;
|
|
215
|
+
function _isArrayPoly(obj) {
|
|
216
|
+
return !!(obj && _objToString.call(obj) === "[object Array]");
|
|
217
|
+
}
|
|
218
|
+
function isError(obj) {
|
|
219
|
+
return !!(obj && _objToString.call(obj) === "[object Error]");
|
|
220
|
+
}
|
|
221
|
+
function isString(value) {
|
|
222
|
+
return typeof value === "string";
|
|
223
|
+
}
|
|
224
|
+
function isBoolean(value) {
|
|
225
|
+
return typeof value === "boolean";
|
|
226
|
+
}
|
|
227
|
+
function isPlainObject(value) {
|
|
228
|
+
var result = false;
|
|
229
|
+
if (value && typeof value === "object") {
|
|
230
|
+
var proto = _objGetPrototypeOf$1 ? _objGetPrototypeOf$1(value) : _getObjProto$1(value);
|
|
231
|
+
if (!proto) {
|
|
232
|
+
result = true;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
|
|
236
|
+
proto = proto[strConstructor];
|
|
237
|
+
}
|
|
238
|
+
result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return result;
|
|
242
|
+
}
|
|
243
|
+
function toISOString(date) {
|
|
244
|
+
if (date) {
|
|
245
|
+
return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function _toISOStringPoly(date) {
|
|
249
|
+
if (date && date.getUTCFullYear) {
|
|
250
|
+
var pad = function (num) {
|
|
251
|
+
var r = String(num);
|
|
252
|
+
if (r.length === 1) {
|
|
253
|
+
r = "0" + r;
|
|
254
|
+
}
|
|
255
|
+
return r;
|
|
256
|
+
};
|
|
257
|
+
return date.getUTCFullYear()
|
|
258
|
+
+ "-" + pad(date.getUTCMonth() + 1)
|
|
259
|
+
+ "-" + pad(date.getUTCDate())
|
|
260
|
+
+ "T" + pad(date.getUTCHours())
|
|
261
|
+
+ ":" + pad(date.getUTCMinutes())
|
|
262
|
+
+ ":" + pad(date.getUTCSeconds())
|
|
263
|
+
+ "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
|
|
264
|
+
+ "Z";
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
function arrForEach(arr, callbackfn, thisArg) {
|
|
268
|
+
var len = arr.length;
|
|
269
|
+
try {
|
|
270
|
+
for (var idx = 0; idx < len; idx++) {
|
|
271
|
+
if (idx in arr) {
|
|
272
|
+
if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
catch (e) {
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function arrMap(arr, callbackfn, thisArg) {
|
|
282
|
+
var results;
|
|
283
|
+
if (arr) {
|
|
284
|
+
if (arr[strMap]) {
|
|
285
|
+
return arr[strMap](callbackfn, thisArg);
|
|
286
|
+
}
|
|
287
|
+
var len = arr.length;
|
|
288
|
+
var _this = thisArg || arr;
|
|
289
|
+
results = new Array(len);
|
|
290
|
+
try {
|
|
291
|
+
for (var lp = 0; lp < len; lp++) {
|
|
292
|
+
if (lp in arr) {
|
|
293
|
+
results[lp] = callbackfn.call(_this, arr[lp], arr);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
catch (e) {
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return results;
|
|
301
|
+
}
|
|
302
|
+
function strTrim(str) {
|
|
303
|
+
if (str) {
|
|
304
|
+
str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str.replace ? str.replace(/^\s+|\s+$/g, "") : str);
|
|
305
|
+
}
|
|
306
|
+
return str;
|
|
307
|
+
}
|
|
308
|
+
var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
|
|
309
|
+
var _objKeysDontEnums = [
|
|
310
|
+
"toString",
|
|
311
|
+
"toLocaleString",
|
|
312
|
+
"valueOf",
|
|
313
|
+
"hasOwnProperty",
|
|
314
|
+
"isPrototypeOf",
|
|
315
|
+
"propertyIsEnumerable",
|
|
316
|
+
"constructor"
|
|
317
|
+
];
|
|
318
|
+
function objKeys(obj) {
|
|
319
|
+
var objType = typeof obj;
|
|
320
|
+
if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
|
|
321
|
+
throwTypeError("objKeys called on non-object");
|
|
322
|
+
}
|
|
323
|
+
if (!_objKeysHasDontEnumBug && _objKeys) {
|
|
324
|
+
return _objKeys(obj);
|
|
325
|
+
}
|
|
326
|
+
var result = [];
|
|
327
|
+
for (var prop in obj) {
|
|
328
|
+
if (obj && ObjHasOwnProperty.call(obj, prop)) {
|
|
329
|
+
result.push(prop);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
if (_objKeysHasDontEnumBug) {
|
|
333
|
+
var dontEnumsLength = _objKeysDontEnums.length;
|
|
334
|
+
for (var lp = 0; lp < dontEnumsLength; lp++) {
|
|
335
|
+
if (obj && ObjHasOwnProperty.call(obj, _objKeysDontEnums[lp])) {
|
|
336
|
+
result.push(_objKeysDontEnums[lp]);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return result;
|
|
341
|
+
}
|
|
342
|
+
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
343
|
+
if (_objDefineProperty$1) {
|
|
344
|
+
try {
|
|
345
|
+
var descriptor = {
|
|
346
|
+
enumerable: true,
|
|
347
|
+
configurable: true
|
|
348
|
+
};
|
|
349
|
+
if (getProp) {
|
|
350
|
+
descriptor.get = getProp;
|
|
351
|
+
}
|
|
352
|
+
if (setProp) {
|
|
353
|
+
descriptor.set = setProp;
|
|
354
|
+
}
|
|
355
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
catch (e) {
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
function _doNothing(value) {
|
|
364
|
+
return value;
|
|
365
|
+
}
|
|
366
|
+
function deepFreeze(obj) {
|
|
367
|
+
if (_objFreeze) {
|
|
368
|
+
objForEachKey(obj, function (name, value) {
|
|
369
|
+
if (isArray(value) || isObject(value)) {
|
|
370
|
+
_objFreeze(value);
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
return objFreeze(obj);
|
|
375
|
+
}
|
|
376
|
+
var objFreeze = _objFreeze || _doNothing;
|
|
377
|
+
function dateNow() {
|
|
378
|
+
var dt = Date;
|
|
379
|
+
return dt.now ? dt.now() : new dt().getTime();
|
|
380
|
+
}
|
|
381
|
+
function getExceptionName(object) {
|
|
382
|
+
if (isError(object)) {
|
|
383
|
+
return object.name;
|
|
384
|
+
}
|
|
385
|
+
return strEmpty$1;
|
|
386
|
+
}
|
|
387
|
+
function setValue(target, field, value, valChk, srcChk) {
|
|
388
|
+
var theValue = value;
|
|
389
|
+
if (target) {
|
|
390
|
+
theValue = target[field];
|
|
391
|
+
if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
|
|
392
|
+
theValue = value;
|
|
393
|
+
target[field] = theValue;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return theValue;
|
|
397
|
+
}
|
|
398
|
+
function isTruthy(value) {
|
|
399
|
+
return !!value;
|
|
400
|
+
}
|
|
401
|
+
function throwError(message) {
|
|
402
|
+
throw new Error(message);
|
|
403
|
+
}
|
|
404
|
+
function _createProxyFunction(source, funcName) {
|
|
405
|
+
var srcFunc = null;
|
|
406
|
+
var src = null;
|
|
407
|
+
if (isFunction(source)) {
|
|
408
|
+
srcFunc = source;
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
src = source;
|
|
412
|
+
}
|
|
413
|
+
return function () {
|
|
414
|
+
var originalArguments = arguments;
|
|
415
|
+
if (srcFunc) {
|
|
416
|
+
src = srcFunc();
|
|
417
|
+
}
|
|
418
|
+
if (src) {
|
|
419
|
+
return src[funcName].apply(src, originalArguments);
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
424
|
+
if (target && name && source) {
|
|
425
|
+
if (overwriteTarget !== false || isUndefined(target[name])) {
|
|
426
|
+
target[name] = _createProxyFunction(source, theFunc);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
431
|
+
var theArgs = arguments;
|
|
432
|
+
var extended = theArgs[0] || {};
|
|
433
|
+
var argLen = theArgs.length;
|
|
434
|
+
var deep = false;
|
|
435
|
+
var idx = 1;
|
|
436
|
+
if (argLen > 0 && isBoolean(extended)) {
|
|
437
|
+
deep = extended;
|
|
438
|
+
extended = theArgs[idx] || {};
|
|
439
|
+
idx++;
|
|
440
|
+
}
|
|
441
|
+
if (!isObject(extended)) {
|
|
442
|
+
extended = {};
|
|
443
|
+
}
|
|
444
|
+
for (; idx < argLen; idx++) {
|
|
445
|
+
var arg = theArgs[idx];
|
|
446
|
+
var isArgArray = isArray(arg);
|
|
447
|
+
var isArgObj = isObject(arg);
|
|
448
|
+
for (var prop in arg) {
|
|
449
|
+
var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
|
|
450
|
+
if (!propOk) {
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
var newValue = arg[prop];
|
|
454
|
+
var isNewArray = void 0;
|
|
455
|
+
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
456
|
+
var clone = extended[prop];
|
|
457
|
+
if (isNewArray) {
|
|
458
|
+
if (!isArray(clone)) {
|
|
459
|
+
clone = [];
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
else if (!isPlainObject(clone)) {
|
|
463
|
+
clone = {};
|
|
464
|
+
}
|
|
465
|
+
newValue = objExtend(deep, clone, newValue);
|
|
466
|
+
}
|
|
467
|
+
if (newValue !== undefined) {
|
|
468
|
+
extended[prop] = newValue;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return extended;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
function createEnumStyle(values) {
|
|
476
|
+
var enumClass = {};
|
|
477
|
+
objForEachKey(values, function (field, value) {
|
|
478
|
+
enumClass[field] = value;
|
|
479
|
+
enumClass[value] = field;
|
|
480
|
+
});
|
|
481
|
+
return deepFreeze(enumClass);
|
|
482
|
+
}
|
|
483
|
+
|
|
97
484
|
/*!
|
|
98
485
|
* Microsoft Dynamic Proto Utility, 1.1.4
|
|
99
486
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
@@ -272,350 +659,68 @@
|
|
|
272
659
|
instFuncs_1[name] = target[name];
|
|
273
660
|
delete target[name];
|
|
274
661
|
if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
|
|
275
|
-
proto[name] = _createDynamicPrototype(proto, name);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
function _checkPrototype(classProto, thisTarget) {
|
|
282
|
-
if (_objGetPrototypeOf) {
|
|
283
|
-
var visited = [];
|
|
284
|
-
var thisProto = _getObjProto(thisTarget);
|
|
285
|
-
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
286
|
-
if (thisProto === classProto) {
|
|
287
|
-
return true;
|
|
288
|
-
}
|
|
289
|
-
visited.push(thisProto);
|
|
290
|
-
thisProto = _getObjProto(thisProto);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return false;
|
|
294
|
-
}
|
|
295
|
-
function _getObjName(target, unknownValue) {
|
|
296
|
-
if (_hasOwnProperty(target, Prototype)) {
|
|
297
|
-
return target.name || unknownValue || UnknownValue;
|
|
298
|
-
}
|
|
299
|
-
return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
|
|
300
|
-
}
|
|
301
|
-
function dynamicProto(theClass, target, delegateFunc, options) {
|
|
302
|
-
if (!_hasOwnProperty(theClass, Prototype)) {
|
|
303
|
-
_throwTypeError("theClass is an invalid class definition.");
|
|
304
|
-
}
|
|
305
|
-
var classProto = theClass[Prototype];
|
|
306
|
-
if (!_checkPrototype(classProto, target)) {
|
|
307
|
-
_throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
|
|
308
|
-
}
|
|
309
|
-
var className = null;
|
|
310
|
-
if (_hasOwnProperty(classProto, DynClassName)) {
|
|
311
|
-
className = classProto[DynClassName];
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
|
|
315
|
-
_dynamicNames++;
|
|
316
|
-
classProto[DynClassName] = className;
|
|
317
|
-
}
|
|
318
|
-
var perfOptions = dynamicProto[DynProtoDefaultOptions];
|
|
319
|
-
var useBaseInst = !!perfOptions[strUseBaseInst];
|
|
320
|
-
if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
|
|
321
|
-
useBaseInst = !!options[strUseBaseInst];
|
|
322
|
-
}
|
|
323
|
-
var instFuncs = _getInstanceFuncs(target);
|
|
324
|
-
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
325
|
-
delegateFunc(target, baseFuncs);
|
|
326
|
-
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
327
|
-
if (setInstanceFunc && options) {
|
|
328
|
-
setInstanceFunc = !!options[strSetInstFuncs];
|
|
329
|
-
}
|
|
330
|
-
_populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
|
|
331
|
-
}
|
|
332
|
-
var perfDefaults = {
|
|
333
|
-
setInstFuncs: true,
|
|
334
|
-
useBaseInst: true
|
|
335
|
-
};
|
|
336
|
-
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
337
|
-
|
|
338
|
-
var LoggingSeverity;
|
|
339
|
-
(function (LoggingSeverity) {
|
|
340
|
-
LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
|
|
341
|
-
LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
|
|
342
|
-
})(LoggingSeverity || (LoggingSeverity = {}));
|
|
343
|
-
var _InternalMessageId = {
|
|
344
|
-
BrowserDoesNotSupportLocalStorage: 0,
|
|
345
|
-
BrowserCannotReadLocalStorage: 1,
|
|
346
|
-
BrowserCannotReadSessionStorage: 2,
|
|
347
|
-
BrowserCannotWriteLocalStorage: 3,
|
|
348
|
-
BrowserCannotWriteSessionStorage: 4,
|
|
349
|
-
BrowserFailedRemovalFromLocalStorage: 5,
|
|
350
|
-
BrowserFailedRemovalFromSessionStorage: 6,
|
|
351
|
-
CannotSendEmptyTelemetry: 7,
|
|
352
|
-
ClientPerformanceMathError: 8,
|
|
353
|
-
ErrorParsingAISessionCookie: 9,
|
|
354
|
-
ErrorPVCalc: 10,
|
|
355
|
-
ExceptionWhileLoggingError: 11,
|
|
356
|
-
FailedAddingTelemetryToBuffer: 12,
|
|
357
|
-
FailedMonitorAjaxAbort: 13,
|
|
358
|
-
FailedMonitorAjaxDur: 14,
|
|
359
|
-
FailedMonitorAjaxOpen: 15,
|
|
360
|
-
FailedMonitorAjaxRSC: 16,
|
|
361
|
-
FailedMonitorAjaxSend: 17,
|
|
362
|
-
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
363
|
-
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
364
|
-
FailedToSendQueuedTelemetry: 20,
|
|
365
|
-
FailedToReportDataLoss: 21,
|
|
366
|
-
FlushFailed: 22,
|
|
367
|
-
MessageLimitPerPVExceeded: 23,
|
|
368
|
-
MissingRequiredFieldSpecification: 24,
|
|
369
|
-
NavigationTimingNotSupported: 25,
|
|
370
|
-
OnError: 26,
|
|
371
|
-
SessionRenewalDateIsZero: 27,
|
|
372
|
-
SenderNotInitialized: 28,
|
|
373
|
-
StartTrackEventFailed: 29,
|
|
374
|
-
StopTrackEventFailed: 30,
|
|
375
|
-
StartTrackFailed: 31,
|
|
376
|
-
StopTrackFailed: 32,
|
|
377
|
-
TelemetrySampledAndNotSent: 33,
|
|
378
|
-
TrackEventFailed: 34,
|
|
379
|
-
TrackExceptionFailed: 35,
|
|
380
|
-
TrackMetricFailed: 36,
|
|
381
|
-
TrackPVFailed: 37,
|
|
382
|
-
TrackPVFailedCalc: 38,
|
|
383
|
-
TrackTraceFailed: 39,
|
|
384
|
-
TransmissionFailed: 40,
|
|
385
|
-
FailedToSetStorageBuffer: 41,
|
|
386
|
-
FailedToRestoreStorageBuffer: 42,
|
|
387
|
-
InvalidBackendResponse: 43,
|
|
388
|
-
FailedToFixDepricatedValues: 44,
|
|
389
|
-
InvalidDurationValue: 45,
|
|
390
|
-
TelemetryEnvelopeInvalid: 46,
|
|
391
|
-
CreateEnvelopeError: 47,
|
|
392
|
-
CannotSerializeObject: 48,
|
|
393
|
-
CannotSerializeObjectNonSerializable: 49,
|
|
394
|
-
CircularReferenceDetected: 50,
|
|
395
|
-
ClearAuthContextFailed: 51,
|
|
396
|
-
ExceptionTruncated: 52,
|
|
397
|
-
IllegalCharsInName: 53,
|
|
398
|
-
ItemNotInArray: 54,
|
|
399
|
-
MaxAjaxPerPVExceeded: 55,
|
|
400
|
-
MessageTruncated: 56,
|
|
401
|
-
NameTooLong: 57,
|
|
402
|
-
SampleRateOutOfRange: 58,
|
|
403
|
-
SetAuthContextFailed: 59,
|
|
404
|
-
SetAuthContextFailedAccountName: 60,
|
|
405
|
-
StringValueTooLong: 61,
|
|
406
|
-
StartCalledMoreThanOnce: 62,
|
|
407
|
-
StopCalledWithoutStart: 63,
|
|
408
|
-
TelemetryInitializerFailed: 64,
|
|
409
|
-
TrackArgumentsNotSpecified: 65,
|
|
410
|
-
UrlTooLong: 66,
|
|
411
|
-
SessionStorageBufferFull: 67,
|
|
412
|
-
CannotAccessCookie: 68,
|
|
413
|
-
IdTooLong: 69,
|
|
414
|
-
InvalidEvent: 70,
|
|
415
|
-
FailedMonitorAjaxSetRequestHeader: 71,
|
|
416
|
-
SendBrowserInfoOnUserInit: 72,
|
|
417
|
-
PluginException: 73,
|
|
418
|
-
NotificationException: 74,
|
|
419
|
-
SnippetScriptLoadFailure: 99,
|
|
420
|
-
InvalidInstrumentationKey: 100,
|
|
421
|
-
CannotParseAiBlobValue: 101,
|
|
422
|
-
InvalidContentBlob: 102,
|
|
423
|
-
TrackPageActionEventFailed: 103,
|
|
424
|
-
FailedAddingCustomDefinedRequestContext: 104,
|
|
425
|
-
InMemoryStorageBufferFull: 105
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
var strToISOString = "toISOString";
|
|
429
|
-
var cStrEndsWith = "endsWith";
|
|
430
|
-
var strMap = "map";
|
|
431
|
-
var cStrTrim = "trim";
|
|
432
|
-
var strToString = "toString";
|
|
433
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
434
|
-
var StringProto = String[strShimPrototype];
|
|
435
|
-
var _strTrim = StringProto[cStrTrim];
|
|
436
|
-
var _strEndsWith = StringProto[cStrEndsWith];
|
|
437
|
-
var DateProto = Date[strShimPrototype];
|
|
438
|
-
var _dataToISOString = DateProto[strToISOString];
|
|
439
|
-
var _isArray = Array.isArray;
|
|
440
|
-
var _objToString = ObjProto[strToString];
|
|
441
|
-
var _fnToString = ObjHasOwnProperty[strToString];
|
|
442
|
-
_fnToString.call(ObjClass);
|
|
443
|
-
function isUndefined(value) {
|
|
444
|
-
return value === undefined || typeof value === strShimUndefined;
|
|
445
|
-
}
|
|
446
|
-
function isNullOrUndefined(value) {
|
|
447
|
-
return (value === null || isUndefined(value));
|
|
448
|
-
}
|
|
449
|
-
function isNotNullOrUndefined(value) {
|
|
450
|
-
return !isNullOrUndefined(value);
|
|
451
|
-
}
|
|
452
|
-
function isObject(value) {
|
|
453
|
-
return !!(value && typeof value === strShimObject);
|
|
454
|
-
}
|
|
455
|
-
function isFunction(value) {
|
|
456
|
-
return !!(value && typeof value === strShimFunction);
|
|
457
|
-
}
|
|
458
|
-
function objForEachKey(target, callbackfn) {
|
|
459
|
-
if (target) {
|
|
460
|
-
for (var prop in target) {
|
|
461
|
-
if (ObjHasOwnProperty.call(target, prop)) {
|
|
462
|
-
callbackfn.call(target, prop, target[prop]);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
function strEndsWith(value, search) {
|
|
468
|
-
var result = false;
|
|
469
|
-
if (value && search && !(result = value === search)) {
|
|
470
|
-
result = _strEndsWith ? value[cStrEndsWith](search) : _strEndsWithPoly(value, search);
|
|
471
|
-
}
|
|
472
|
-
return result;
|
|
473
|
-
}
|
|
474
|
-
function _strEndsWithPoly(value, search) {
|
|
475
|
-
var result = false;
|
|
476
|
-
var searchLen = search ? search.length : 0;
|
|
477
|
-
var valLen = value ? value.length : 0;
|
|
478
|
-
if (searchLen && valLen && valLen >= searchLen && !(result = value === search)) {
|
|
479
|
-
var pos = valLen - 1;
|
|
480
|
-
for (var lp = searchLen - 1; lp >= 0; lp--) {
|
|
481
|
-
if (value[pos] != search[lp]) {
|
|
482
|
-
return false;
|
|
483
|
-
}
|
|
484
|
-
pos--;
|
|
485
|
-
}
|
|
486
|
-
result = true;
|
|
487
|
-
}
|
|
488
|
-
return result;
|
|
489
|
-
}
|
|
490
|
-
function strContains(value, search) {
|
|
491
|
-
if (value && search) {
|
|
492
|
-
return value.indexOf(search) !== -1;
|
|
493
|
-
}
|
|
494
|
-
return false;
|
|
495
|
-
}
|
|
496
|
-
var isArray = _isArray || _isArrayPoly;
|
|
497
|
-
function _isArrayPoly(obj) {
|
|
498
|
-
return !!(obj && _objToString.call(obj) === "[object Array]");
|
|
499
|
-
}
|
|
500
|
-
function isError(obj) {
|
|
501
|
-
return !!(obj && _objToString.call(obj) === "[object Error]");
|
|
502
|
-
}
|
|
503
|
-
function isString(value) {
|
|
504
|
-
return typeof value === "string";
|
|
505
|
-
}
|
|
506
|
-
function toISOString(date) {
|
|
507
|
-
if (date) {
|
|
508
|
-
return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
function _toISOStringPoly(date) {
|
|
512
|
-
if (date && date.getUTCFullYear) {
|
|
513
|
-
var pad = function (num) {
|
|
514
|
-
var r = String(num);
|
|
515
|
-
if (r.length === 1) {
|
|
516
|
-
r = "0" + r;
|
|
517
|
-
}
|
|
518
|
-
return r;
|
|
519
|
-
};
|
|
520
|
-
return date.getUTCFullYear()
|
|
521
|
-
+ "-" + pad(date.getUTCMonth() + 1)
|
|
522
|
-
+ "-" + pad(date.getUTCDate())
|
|
523
|
-
+ "T" + pad(date.getUTCHours())
|
|
524
|
-
+ ":" + pad(date.getUTCMinutes())
|
|
525
|
-
+ ":" + pad(date.getUTCSeconds())
|
|
526
|
-
+ "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
|
|
527
|
-
+ "Z";
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
function arrForEach(arr, callbackfn, thisArg) {
|
|
531
|
-
var len = arr.length;
|
|
532
|
-
try {
|
|
533
|
-
for (var idx = 0; idx < len; idx++) {
|
|
534
|
-
if (idx in arr) {
|
|
535
|
-
if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
|
|
536
|
-
break;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
catch (e) {
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
function arrMap(arr, callbackfn, thisArg) {
|
|
545
|
-
var results;
|
|
546
|
-
if (arr) {
|
|
547
|
-
if (arr[strMap]) {
|
|
548
|
-
return arr[strMap](callbackfn, thisArg);
|
|
549
|
-
}
|
|
550
|
-
var len = arr.length;
|
|
551
|
-
var _this = thisArg || arr;
|
|
552
|
-
results = new Array(len);
|
|
553
|
-
try {
|
|
554
|
-
for (var lp = 0; lp < len; lp++) {
|
|
555
|
-
if (lp in arr) {
|
|
556
|
-
results[lp] = callbackfn.call(_this, arr[lp], arr);
|
|
662
|
+
proto[name] = _createDynamicPrototype(proto, name);
|
|
557
663
|
}
|
|
558
664
|
}
|
|
559
|
-
}
|
|
560
|
-
catch (e) {
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
return results;
|
|
564
|
-
}
|
|
565
|
-
function strTrim(str) {
|
|
566
|
-
if (str) {
|
|
567
|
-
str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str.replace ? str.replace(/^\s+|\s+$/g, "") : str);
|
|
665
|
+
});
|
|
568
666
|
}
|
|
569
|
-
return str;
|
|
570
667
|
}
|
|
571
|
-
function
|
|
572
|
-
if (
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
if (getProp) {
|
|
579
|
-
descriptor.get = getProp;
|
|
580
|
-
}
|
|
581
|
-
if (setProp) {
|
|
582
|
-
descriptor.set = setProp;
|
|
668
|
+
function _checkPrototype(classProto, thisTarget) {
|
|
669
|
+
if (_objGetPrototypeOf) {
|
|
670
|
+
var visited = [];
|
|
671
|
+
var thisProto = _getObjProto(thisTarget);
|
|
672
|
+
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
673
|
+
if (thisProto === classProto) {
|
|
674
|
+
return true;
|
|
583
675
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
catch (e) {
|
|
676
|
+
visited.push(thisProto);
|
|
677
|
+
thisProto = _getObjProto(thisProto);
|
|
588
678
|
}
|
|
589
679
|
}
|
|
590
680
|
return false;
|
|
591
681
|
}
|
|
592
|
-
function
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
}
|
|
596
|
-
function getExceptionName(object) {
|
|
597
|
-
if (isError(object)) {
|
|
598
|
-
return object.name;
|
|
682
|
+
function _getObjName(target, unknownValue) {
|
|
683
|
+
if (_hasOwnProperty(target, Prototype)) {
|
|
684
|
+
return target.name || unknownValue || UnknownValue;
|
|
599
685
|
}
|
|
600
|
-
return
|
|
686
|
+
return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
|
|
601
687
|
}
|
|
602
|
-
function
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
theValue = target[field];
|
|
606
|
-
if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
|
|
607
|
-
theValue = value;
|
|
608
|
-
target[field] = theValue;
|
|
609
|
-
}
|
|
688
|
+
function dynamicProto(theClass, target, delegateFunc, options) {
|
|
689
|
+
if (!_hasOwnProperty(theClass, Prototype)) {
|
|
690
|
+
_throwTypeError("theClass is an invalid class definition.");
|
|
610
691
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
692
|
+
var classProto = theClass[Prototype];
|
|
693
|
+
if (!_checkPrototype(classProto, target)) {
|
|
694
|
+
_throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
|
|
695
|
+
}
|
|
696
|
+
var className = null;
|
|
697
|
+
if (_hasOwnProperty(classProto, DynClassName)) {
|
|
698
|
+
className = classProto[DynClassName];
|
|
699
|
+
}
|
|
700
|
+
else {
|
|
701
|
+
className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
|
|
702
|
+
_dynamicNames++;
|
|
703
|
+
classProto[DynClassName] = className;
|
|
704
|
+
}
|
|
705
|
+
var perfOptions = dynamicProto[DynProtoDefaultOptions];
|
|
706
|
+
var useBaseInst = !!perfOptions[strUseBaseInst];
|
|
707
|
+
if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
|
|
708
|
+
useBaseInst = !!options[strUseBaseInst];
|
|
709
|
+
}
|
|
710
|
+
var instFuncs = _getInstanceFuncs(target);
|
|
711
|
+
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
712
|
+
delegateFunc(target, baseFuncs);
|
|
713
|
+
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
714
|
+
if (setInstanceFunc && options) {
|
|
715
|
+
setInstanceFunc = !!options[strSetInstFuncs];
|
|
716
|
+
}
|
|
717
|
+
_populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
|
|
618
718
|
}
|
|
719
|
+
var perfDefaults = {
|
|
720
|
+
setInstFuncs: true,
|
|
721
|
+
useBaseInst: true
|
|
722
|
+
};
|
|
723
|
+
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
619
724
|
|
|
620
725
|
var strWindow = "window";
|
|
621
726
|
var strDocument = "document";
|
|
@@ -718,14 +823,14 @@
|
|
|
718
823
|
var nav = getNavigator();
|
|
719
824
|
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
720
825
|
_navUserAgentCheck = nav.userAgent;
|
|
721
|
-
var userAgent = (_navUserAgentCheck ||
|
|
826
|
+
var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
|
|
722
827
|
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
723
828
|
}
|
|
724
829
|
return _isTrident;
|
|
725
830
|
}
|
|
726
831
|
function dumpObj(object) {
|
|
727
832
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
728
|
-
var propertyValueDump =
|
|
833
|
+
var propertyValueDump = strEmpty$1;
|
|
729
834
|
if (objectTypeDump === "[object Error]") {
|
|
730
835
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
731
836
|
}
|
|
@@ -758,9 +863,9 @@
|
|
|
758
863
|
var strWarnToConsole = "warnToConsole";
|
|
759
864
|
function _sanitizeDiagnosticText(text) {
|
|
760
865
|
if (text) {
|
|
761
|
-
return "\"" + text.replace(/\"/g,
|
|
866
|
+
return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
|
|
762
867
|
}
|
|
763
|
-
return
|
|
868
|
+
return strEmpty$1;
|
|
764
869
|
}
|
|
765
870
|
function _logToConsole(func, message) {
|
|
766
871
|
var theConsole = getConsole();
|
|
@@ -782,12 +887,12 @@
|
|
|
782
887
|
_self.message =
|
|
783
888
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
784
889
|
msgId;
|
|
785
|
-
var strProps =
|
|
890
|
+
var strProps = strEmpty$1;
|
|
786
891
|
if (hasJSON()) {
|
|
787
892
|
strProps = getJSON().stringify(properties);
|
|
788
893
|
}
|
|
789
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
790
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
894
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
|
|
895
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
|
|
791
896
|
_self.message += diagnosticText;
|
|
792
897
|
}
|
|
793
898
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -817,7 +922,7 @@
|
|
|
817
922
|
throw message;
|
|
818
923
|
}
|
|
819
924
|
else {
|
|
820
|
-
var logFunc = severity ===
|
|
925
|
+
var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
|
|
821
926
|
if (!isUndefined(message.message)) {
|
|
822
927
|
var logLevel = _self.consoleLoggingLevel();
|
|
823
928
|
if (isUserAct) {
|
|
@@ -835,7 +940,7 @@
|
|
|
835
940
|
_self.logInternalMessage(severity, message);
|
|
836
941
|
}
|
|
837
942
|
else {
|
|
838
|
-
_debugExtMsg("throw" + (severity ===
|
|
943
|
+
_debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
|
|
839
944
|
}
|
|
840
945
|
}
|
|
841
946
|
};
|
|
@@ -867,13 +972,13 @@
|
|
|
867
972
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
868
973
|
_self.queue.push(message);
|
|
869
974
|
_messageCount++;
|
|
870
|
-
_debugExtMsg((severity ===
|
|
975
|
+
_debugExtMsg((severity === 1 ? "error" : "warn"), message);
|
|
871
976
|
}
|
|
872
977
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
873
978
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
874
|
-
var throttleMessage = new _InternalLogMessage(
|
|
979
|
+
var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
|
|
875
980
|
_self.queue.push(throttleMessage);
|
|
876
|
-
if (severity ===
|
|
981
|
+
if (severity === 1 ) {
|
|
877
982
|
_self.errorToConsole(throttleLimitMessage);
|
|
878
983
|
}
|
|
879
984
|
else {
|
|
@@ -902,6 +1007,16 @@
|
|
|
902
1007
|
}
|
|
903
1008
|
return DiagnosticLogger;
|
|
904
1009
|
}());
|
|
1010
|
+
function _getLogger(logger) {
|
|
1011
|
+
return (logger || new DiagnosticLogger());
|
|
1012
|
+
}
|
|
1013
|
+
function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
|
|
1014
|
+
if (isUserAct === void 0) { isUserAct = false; }
|
|
1015
|
+
(logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
|
|
1016
|
+
}
|
|
1017
|
+
function _warnToConsole(logger, message) {
|
|
1018
|
+
_getLogger(logger).warnToConsole(message);
|
|
1019
|
+
}
|
|
905
1020
|
|
|
906
1021
|
var strExecutionContextKey = "ctx";
|
|
907
1022
|
var PerfEvent = /** @class */ (function () {
|
|
@@ -1015,252 +1130,495 @@
|
|
|
1015
1130
|
return func();
|
|
1016
1131
|
}
|
|
1017
1132
|
|
|
1018
|
-
var
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
return plugin;
|
|
1027
|
-
};
|
|
1028
|
-
_self.getNext = function () {
|
|
1029
|
-
return _nextProxy;
|
|
1030
|
-
};
|
|
1031
|
-
_self.setNext = function (nextPlugin) {
|
|
1032
|
-
_nextProxy = nextPlugin;
|
|
1033
|
-
};
|
|
1034
|
-
_self.processTelemetry = function (env, itemCtx) {
|
|
1035
|
-
if (!itemCtx) {
|
|
1036
|
-
itemCtx = defItemCtx;
|
|
1037
|
-
}
|
|
1038
|
-
var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
|
|
1039
|
-
doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
|
|
1040
|
-
if (plugin && _hasProcessTelemetry) {
|
|
1041
|
-
_self._hasRun = true;
|
|
1042
|
-
try {
|
|
1043
|
-
itemCtx.setNext(_nextProxy);
|
|
1044
|
-
if (_hasSetNext) {
|
|
1045
|
-
plugin.setNextPlugin(_nextProxy);
|
|
1046
|
-
}
|
|
1047
|
-
_nextProxy && (_nextProxy._hasRun = false);
|
|
1048
|
-
plugin.processTelemetry(env, itemCtx);
|
|
1049
|
-
}
|
|
1050
|
-
catch (error) {
|
|
1051
|
-
var hasRun = _nextProxy && _nextProxy._hasRun;
|
|
1052
|
-
if (!_nextProxy || !hasRun) {
|
|
1053
|
-
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
|
|
1054
|
-
}
|
|
1055
|
-
if (_nextProxy && !hasRun) {
|
|
1056
|
-
_nextProxy.processTelemetry(env, itemCtx);
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
else if (_nextProxy) {
|
|
1061
|
-
_self._hasRun = true;
|
|
1062
|
-
_nextProxy.processTelemetry(env, itemCtx);
|
|
1063
|
-
}
|
|
1064
|
-
}, function () { return ({ item: env }); }, !(env.sync));
|
|
1065
|
-
};
|
|
1133
|
+
var UInt32Mask = 0x100000000;
|
|
1134
|
+
var MaxUInt32 = 0xffffffff;
|
|
1135
|
+
var _mwcSeeded = false;
|
|
1136
|
+
var _mwcW = 123456789;
|
|
1137
|
+
var _mwcZ = 987654321;
|
|
1138
|
+
function _mwcSeed(seedValue) {
|
|
1139
|
+
if (seedValue < 0) {
|
|
1140
|
+
seedValue >>>= 0;
|
|
1066
1141
|
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
var
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1142
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
1143
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
1144
|
+
_mwcSeeded = true;
|
|
1145
|
+
}
|
|
1146
|
+
function _autoSeedMwc() {
|
|
1147
|
+
try {
|
|
1148
|
+
var now = dateNow() & 0x7fffffff;
|
|
1149
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
1150
|
+
}
|
|
1151
|
+
catch (e) {
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
function random32(signed) {
|
|
1155
|
+
var value = 0;
|
|
1156
|
+
var c = getCrypto() || getMsCrypto();
|
|
1157
|
+
if (c && c.getRandomValues) {
|
|
1158
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1159
|
+
}
|
|
1160
|
+
if (value === 0 && isIE()) {
|
|
1161
|
+
if (!_mwcSeeded) {
|
|
1162
|
+
_autoSeedMwc();
|
|
1084
1163
|
}
|
|
1164
|
+
value = mwcRandom32() & MaxUInt32;
|
|
1165
|
+
}
|
|
1166
|
+
if (value === 0) {
|
|
1167
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1168
|
+
}
|
|
1169
|
+
if (!signed) {
|
|
1170
|
+
value >>>= 0;
|
|
1085
1171
|
}
|
|
1086
|
-
return
|
|
1172
|
+
return value;
|
|
1087
1173
|
}
|
|
1088
|
-
function
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1174
|
+
function mwcRandom32(signed) {
|
|
1175
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1176
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1177
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1178
|
+
if (!signed) {
|
|
1179
|
+
value >>>= 0;
|
|
1180
|
+
}
|
|
1181
|
+
return value;
|
|
1182
|
+
}
|
|
1183
|
+
function newId(maxLength) {
|
|
1184
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1185
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1186
|
+
var number = random32() >>> 0;
|
|
1187
|
+
var chars = 0;
|
|
1188
|
+
var result = strEmpty$1;
|
|
1189
|
+
while (result.length < maxLength) {
|
|
1190
|
+
chars++;
|
|
1191
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1192
|
+
number >>>= 6;
|
|
1193
|
+
if (chars === 5) {
|
|
1194
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1195
|
+
chars = 0;
|
|
1099
1196
|
}
|
|
1100
1197
|
}
|
|
1101
|
-
|
|
1102
|
-
|
|
1198
|
+
return result;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
1202
|
+
var version = "2.8.0-nightly.2204-06";
|
|
1203
|
+
var instanceName = "." + newId(6);
|
|
1204
|
+
var _dataUid = 0;
|
|
1205
|
+
function _createAccessor(target, prop, value) {
|
|
1206
|
+
if (_objDefineProperty) {
|
|
1207
|
+
try {
|
|
1208
|
+
_objDefineProperty(target, prop, {
|
|
1209
|
+
value: value,
|
|
1210
|
+
enumerable: false,
|
|
1211
|
+
configurable: true
|
|
1212
|
+
});
|
|
1213
|
+
return true;
|
|
1214
|
+
}
|
|
1215
|
+
catch (e) {
|
|
1216
|
+
}
|
|
1103
1217
|
}
|
|
1104
|
-
return
|
|
1218
|
+
return false;
|
|
1105
1219
|
}
|
|
1106
|
-
function
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1220
|
+
function _canAcceptData(target) {
|
|
1221
|
+
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1222
|
+
}
|
|
1223
|
+
function _getCache(data, target) {
|
|
1224
|
+
var theCache = target[data.id];
|
|
1225
|
+
if (!theCache) {
|
|
1226
|
+
theCache = {};
|
|
1227
|
+
try {
|
|
1228
|
+
if (_canAcceptData(target)) {
|
|
1229
|
+
if (!_createAccessor(target, data.id, theCache)) {
|
|
1230
|
+
target[data.id] = theCache;
|
|
1231
|
+
}
|
|
1115
1232
|
}
|
|
1116
|
-
});
|
|
1117
|
-
}
|
|
1118
|
-
if (startAt && !add) {
|
|
1119
|
-
if (!plugins) {
|
|
1120
|
-
plugins = [];
|
|
1121
1233
|
}
|
|
1122
|
-
|
|
1234
|
+
catch (e) {
|
|
1235
|
+
}
|
|
1123
1236
|
}
|
|
1124
|
-
return
|
|
1237
|
+
return theCache;
|
|
1125
1238
|
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1239
|
+
function createUniqueNamespace(name, includeVersion) {
|
|
1240
|
+
if (includeVersion === void 0) { includeVersion = false; }
|
|
1241
|
+
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1242
|
+
}
|
|
1243
|
+
function createElmNodeData(name) {
|
|
1244
|
+
var data = {
|
|
1245
|
+
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1246
|
+
accept: function (target) {
|
|
1247
|
+
return _canAcceptData(target);
|
|
1248
|
+
},
|
|
1249
|
+
get: function (target, name, defValue, addDefault) {
|
|
1250
|
+
var theCache = target[data.id];
|
|
1251
|
+
if (!theCache) {
|
|
1252
|
+
if (addDefault) {
|
|
1253
|
+
theCache = _getCache(data, target);
|
|
1254
|
+
theCache[normalizeJsName(name)] = defValue;
|
|
1255
|
+
}
|
|
1256
|
+
return defValue;
|
|
1133
1257
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1258
|
+
return theCache[normalizeJsName(name)];
|
|
1259
|
+
},
|
|
1260
|
+
kill: function (target, name) {
|
|
1261
|
+
if (target && target[name]) {
|
|
1262
|
+
try {
|
|
1263
|
+
delete target[name];
|
|
1137
1264
|
}
|
|
1138
|
-
|
|
1139
|
-
_nextProxy = _createProxyChain(plugins, _self);
|
|
1265
|
+
catch (e) {
|
|
1140
1266
|
}
|
|
1141
1267
|
}
|
|
1142
1268
|
}
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1269
|
+
};
|
|
1270
|
+
return data;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1274
|
+
function _getPluginState(plugin) {
|
|
1275
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1279
|
+
var strHasRunFlags = "_hasRun";
|
|
1280
|
+
var strGetTelCtx = "_getTelCtx";
|
|
1281
|
+
var _chainId = 0;
|
|
1282
|
+
function _getNextProxyStart(proxy, config, core, startAt) {
|
|
1283
|
+
while (proxy) {
|
|
1284
|
+
if (proxy.getPlugin() === startAt) {
|
|
1285
|
+
return proxy;
|
|
1286
|
+
}
|
|
1287
|
+
proxy = proxy.getNext();
|
|
1288
|
+
}
|
|
1289
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1290
|
+
}
|
|
1291
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1292
|
+
var _nextProxy = null;
|
|
1293
|
+
var _onComplete = [];
|
|
1294
|
+
if (startAt !== null) {
|
|
1295
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1296
|
+
}
|
|
1297
|
+
var context = {
|
|
1298
|
+
_next: _moveNext,
|
|
1299
|
+
ctx: {
|
|
1300
|
+
core: function () {
|
|
1301
|
+
return core;
|
|
1302
|
+
},
|
|
1303
|
+
diagLog: function () {
|
|
1304
|
+
return safeGetLogger(core, config);
|
|
1305
|
+
},
|
|
1306
|
+
getCfg: function () {
|
|
1307
|
+
return config;
|
|
1308
|
+
},
|
|
1309
|
+
getExtCfg: _getExtCfg,
|
|
1310
|
+
getConfig: _getConfig,
|
|
1311
|
+
hasNext: function () {
|
|
1312
|
+
return !!_nextProxy;
|
|
1313
|
+
},
|
|
1314
|
+
getNext: function () {
|
|
1315
|
+
return _nextProxy;
|
|
1316
|
+
},
|
|
1317
|
+
setNext: function (nextPlugin) {
|
|
1318
|
+
_nextProxy = nextPlugin;
|
|
1319
|
+
},
|
|
1320
|
+
iterate: _iterateChain,
|
|
1321
|
+
onComplete: _addOnComplete
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
function _addOnComplete(onComplete, that) {
|
|
1325
|
+
var args = [];
|
|
1326
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1327
|
+
args[_i - 2] = arguments[_i];
|
|
1328
|
+
}
|
|
1329
|
+
if (onComplete) {
|
|
1330
|
+
_onComplete.push({
|
|
1331
|
+
func: onComplete,
|
|
1332
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1333
|
+
args: args
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
function _moveNext() {
|
|
1338
|
+
var nextProxy = _nextProxy;
|
|
1339
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1340
|
+
if (!nextProxy) {
|
|
1341
|
+
var onComplete = _onComplete;
|
|
1342
|
+
if (onComplete && onComplete.length > 0) {
|
|
1343
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
1344
|
+
try {
|
|
1345
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1346
|
+
}
|
|
1347
|
+
catch (e) {
|
|
1348
|
+
_throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1349
|
+
}
|
|
1350
|
+
});
|
|
1351
|
+
_onComplete = [];
|
|
1160
1352
|
}
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1353
|
+
}
|
|
1354
|
+
return nextProxy;
|
|
1355
|
+
}
|
|
1356
|
+
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1357
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1358
|
+
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
1359
|
+
var theConfig;
|
|
1360
|
+
if (config) {
|
|
1361
|
+
var extConfig = config.extensionConfig;
|
|
1362
|
+
if (extConfig && identifier) {
|
|
1363
|
+
theConfig = extConfig[identifier];
|
|
1169
1364
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1365
|
+
}
|
|
1366
|
+
if (!theConfig) {
|
|
1367
|
+
theConfig = defaultValue;
|
|
1368
|
+
}
|
|
1369
|
+
else if (isObject(defaultValue)) {
|
|
1370
|
+
if (mergeDefault !== 0 ) {
|
|
1371
|
+
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1372
|
+
if (config && mergeDefault === 2 ) {
|
|
1373
|
+
objForEachKey(defaultValue, function (field) {
|
|
1374
|
+
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1375
|
+
var cfgValue = config[field];
|
|
1376
|
+
if (!isNullOrUndefined(cfgValue)) {
|
|
1377
|
+
newConfig_1[field] = cfgValue;
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1172
1382
|
}
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1383
|
+
}
|
|
1384
|
+
return theConfig;
|
|
1385
|
+
}
|
|
1386
|
+
function _getConfig(identifier, field, defaultValue) {
|
|
1387
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
1388
|
+
var theValue;
|
|
1389
|
+
var extConfig = _getExtCfg(identifier, null);
|
|
1390
|
+
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1391
|
+
theValue = extConfig[field];
|
|
1392
|
+
}
|
|
1393
|
+
else if (config && !isNullOrUndefined(config[field])) {
|
|
1394
|
+
theValue = config[field];
|
|
1395
|
+
}
|
|
1396
|
+
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1397
|
+
}
|
|
1398
|
+
function _iterateChain(cb) {
|
|
1399
|
+
var nextPlugin;
|
|
1400
|
+
while (!!(nextPlugin = context._next())) {
|
|
1401
|
+
var plugin = nextPlugin.getPlugin();
|
|
1402
|
+
if (plugin) {
|
|
1403
|
+
cb(plugin);
|
|
1189
1404
|
}
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
return context;
|
|
1408
|
+
}
|
|
1409
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1410
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1411
|
+
var context = internalContext.ctx;
|
|
1412
|
+
function _processNext(env) {
|
|
1413
|
+
var nextPlugin = internalContext._next();
|
|
1414
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1415
|
+
return !nextPlugin;
|
|
1416
|
+
}
|
|
1417
|
+
function _createNew(plugins, startAt) {
|
|
1418
|
+
if (plugins === void 0) { plugins = null; }
|
|
1419
|
+
if (isArray(plugins)) {
|
|
1420
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1421
|
+
}
|
|
1422
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1423
|
+
}
|
|
1424
|
+
context.processNext = _processNext;
|
|
1425
|
+
context.createNew = _createNew;
|
|
1426
|
+
return context;
|
|
1427
|
+
}
|
|
1428
|
+
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1429
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1430
|
+
var context = internalContext.ctx;
|
|
1431
|
+
function _processNext(unloadState) {
|
|
1432
|
+
var nextPlugin = internalContext._next();
|
|
1433
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1434
|
+
return !nextPlugin;
|
|
1435
|
+
}
|
|
1436
|
+
function _createNew(plugins, startAt) {
|
|
1437
|
+
if (plugins === void 0) { plugins = null; }
|
|
1438
|
+
if (isArray(plugins)) {
|
|
1439
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1440
|
+
}
|
|
1441
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1442
|
+
}
|
|
1443
|
+
context.processNext = _processNext;
|
|
1444
|
+
context.createNew = _createNew;
|
|
1445
|
+
return context;
|
|
1446
|
+
}
|
|
1447
|
+
function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
|
|
1448
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1449
|
+
var context = internalContext.ctx;
|
|
1450
|
+
function _processNext(updateState) {
|
|
1451
|
+
return context.iterate(function (plugin) {
|
|
1452
|
+
if (isFunction(plugin[strUpdate])) {
|
|
1453
|
+
plugin[strUpdate](context, updateState);
|
|
1224
1454
|
}
|
|
1225
|
-
|
|
1226
|
-
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1457
|
+
function _createNew(plugins, startAt) {
|
|
1458
|
+
if (plugins === void 0) { plugins = null; }
|
|
1459
|
+
if (isArray(plugins)) {
|
|
1460
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1461
|
+
}
|
|
1462
|
+
return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
|
|
1463
|
+
}
|
|
1464
|
+
context.processNext = _processNext;
|
|
1465
|
+
context.createNew = _createNew;
|
|
1466
|
+
return context;
|
|
1467
|
+
}
|
|
1468
|
+
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
1469
|
+
var firstProxy = null;
|
|
1470
|
+
var add = startAt ? false : true;
|
|
1471
|
+
if (isArray(plugins) && plugins.length > 0) {
|
|
1472
|
+
var lastProxy_1 = null;
|
|
1473
|
+
arrForEach(plugins, function (thePlugin) {
|
|
1474
|
+
if (!add && startAt === thePlugin) {
|
|
1475
|
+
add = true;
|
|
1227
1476
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
if (!itemCtx) {
|
|
1233
|
-
var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);
|
|
1234
|
-
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1235
|
-
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
1477
|
+
if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1478
|
+
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
1479
|
+
if (!firstProxy) {
|
|
1480
|
+
firstProxy = newProxy;
|
|
1236
1481
|
}
|
|
1237
|
-
|
|
1238
|
-
|
|
1482
|
+
if (lastProxy_1) {
|
|
1483
|
+
lastProxy_1._setNext(newProxy);
|
|
1239
1484
|
}
|
|
1485
|
+
lastProxy_1 = newProxy;
|
|
1240
1486
|
}
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
if (startAt && !firstProxy) {
|
|
1490
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1491
|
+
}
|
|
1492
|
+
return firstProxy;
|
|
1493
|
+
}
|
|
1494
|
+
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1495
|
+
var nextProxy = null;
|
|
1496
|
+
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1497
|
+
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1498
|
+
var chainId;
|
|
1499
|
+
if (plugin) {
|
|
1500
|
+
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1501
|
+
}
|
|
1502
|
+
else {
|
|
1503
|
+
chainId = "Unknown-0-" + _chainId++;
|
|
1504
|
+
}
|
|
1505
|
+
var proxyChain = {
|
|
1506
|
+
getPlugin: function () {
|
|
1507
|
+
return plugin;
|
|
1508
|
+
},
|
|
1509
|
+
getNext: function () {
|
|
1510
|
+
return nextProxy;
|
|
1511
|
+
},
|
|
1512
|
+
processTelemetry: _processTelemetry,
|
|
1513
|
+
unload: _unloadPlugin,
|
|
1514
|
+
update: _updatePlugin,
|
|
1515
|
+
_id: chainId,
|
|
1516
|
+
_setNext: function (nextPlugin) {
|
|
1517
|
+
nextProxy = nextPlugin;
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
function _getTelCtx() {
|
|
1521
|
+
var itemCtx;
|
|
1522
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1523
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1524
|
+
}
|
|
1525
|
+
if (!itemCtx) {
|
|
1526
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1527
|
+
}
|
|
1528
|
+
return itemCtx;
|
|
1529
|
+
}
|
|
1530
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1531
|
+
var hasRun = false;
|
|
1532
|
+
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1533
|
+
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1534
|
+
if (!hasRunContext) {
|
|
1535
|
+
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1536
|
+
}
|
|
1537
|
+
itemCtx.setNext(nextProxy);
|
|
1538
|
+
if (plugin) {
|
|
1539
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1540
|
+
hasRunContext[chainId] = true;
|
|
1541
|
+
try {
|
|
1542
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty$1;
|
|
1543
|
+
if (nextId) {
|
|
1544
|
+
hasRunContext[nextId] = false;
|
|
1545
|
+
}
|
|
1546
|
+
hasRun = processPluginFn(itemCtx);
|
|
1547
|
+
}
|
|
1548
|
+
catch (error) {
|
|
1549
|
+
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1550
|
+
if (hasNextRun) {
|
|
1551
|
+
hasRun = true;
|
|
1552
|
+
}
|
|
1553
|
+
if (!nextProxy || !hasNextRun) {
|
|
1554
|
+
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
}, details, isAsync);
|
|
1558
|
+
}
|
|
1559
|
+
return hasRun;
|
|
1560
|
+
}
|
|
1561
|
+
function _processTelemetry(env, itemCtx) {
|
|
1562
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
1563
|
+
function _callProcessTelemetry(itemCtx) {
|
|
1564
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
1565
|
+
return false;
|
|
1246
1566
|
}
|
|
1247
|
-
|
|
1248
|
-
|
|
1567
|
+
var pluginState = _getPluginState(plugin);
|
|
1568
|
+
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
1569
|
+
return false;
|
|
1249
1570
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
1571
|
+
if (hasSetNext) {
|
|
1572
|
+
plugin.setNextPlugin(nextProxy);
|
|
1253
1573
|
}
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
};
|
|
1574
|
+
plugin.processTelemetry(env, itemCtx);
|
|
1575
|
+
return true;
|
|
1576
|
+
}
|
|
1577
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1578
|
+
itemCtx.processNext(env);
|
|
1579
|
+
}
|
|
1258
1580
|
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1581
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1582
|
+
function _callTeardown() {
|
|
1583
|
+
var hasRun = false;
|
|
1584
|
+
if (plugin) {
|
|
1585
|
+
var pluginState = _getPluginState(plugin);
|
|
1586
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1587
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1588
|
+
pluginState[strCore] = null;
|
|
1589
|
+
pluginState[strTeardown] = true;
|
|
1590
|
+
pluginState[strIsInitialized] = false;
|
|
1591
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1592
|
+
hasRun = true;
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
return hasRun;
|
|
1597
|
+
}
|
|
1598
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1599
|
+
unloadCtx.processNext(unloadState);
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
function _updatePlugin(updateCtx, updateState) {
|
|
1603
|
+
function _callUpdate() {
|
|
1604
|
+
var hasRun = false;
|
|
1605
|
+
if (plugin) {
|
|
1606
|
+
var pluginState = _getPluginState(plugin);
|
|
1607
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1608
|
+
if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1609
|
+
if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
|
|
1610
|
+
hasRun = true;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
return hasRun;
|
|
1615
|
+
}
|
|
1616
|
+
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
1617
|
+
updateCtx.processNext(updateState);
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
return objFreeze(proxyChain);
|
|
1621
|
+
}
|
|
1264
1622
|
|
|
1265
1623
|
var strToGMTString = "toGMTString";
|
|
1266
1624
|
var strToUTCString = "toUTCString";
|
|
@@ -1270,7 +1628,6 @@
|
|
|
1270
1628
|
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
1271
1629
|
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
1272
1630
|
var strConfigCookieMgr = "_ckMgr";
|
|
1273
|
-
var strEmpty = "";
|
|
1274
1631
|
var _supportsCookies = null;
|
|
1275
1632
|
var _allowUaSameSite = null;
|
|
1276
1633
|
var _parsedCookieValue = null;
|
|
@@ -1347,7 +1704,7 @@
|
|
|
1347
1704
|
var result = false;
|
|
1348
1705
|
if (_isMgrEnabled(cookieMgr)) {
|
|
1349
1706
|
var values = {};
|
|
1350
|
-
var theValue = strTrim(value || strEmpty);
|
|
1707
|
+
var theValue = strTrim(value || strEmpty$1);
|
|
1351
1708
|
var idx = theValue.indexOf(";");
|
|
1352
1709
|
if (idx !== -1) {
|
|
1353
1710
|
theValue = strTrim(value.substring(0, idx));
|
|
@@ -1362,11 +1719,11 @@
|
|
|
1362
1719
|
if (expireMs > 0) {
|
|
1363
1720
|
var expiry = new Date();
|
|
1364
1721
|
expiry.setTime(expireMs);
|
|
1365
|
-
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
|
|
1722
|
+
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty$1, isTruthy);
|
|
1366
1723
|
}
|
|
1367
1724
|
}
|
|
1368
1725
|
if (!_isIE) {
|
|
1369
|
-
setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
|
|
1726
|
+
setValue(values, "max-age", strEmpty$1 + maxAgeSec, null, isUndefined);
|
|
1370
1727
|
}
|
|
1371
1728
|
}
|
|
1372
1729
|
var location_1 = getLocation();
|
|
@@ -1387,7 +1744,7 @@
|
|
|
1387
1744
|
return result;
|
|
1388
1745
|
},
|
|
1389
1746
|
get: function (name) {
|
|
1390
|
-
var value = strEmpty;
|
|
1747
|
+
var value = strEmpty$1;
|
|
1391
1748
|
if (_isMgrEnabled(cookieMgr)) {
|
|
1392
1749
|
value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
|
|
1393
1750
|
}
|
|
@@ -1412,7 +1769,7 @@
|
|
|
1412
1769
|
values["max-age"] = "0";
|
|
1413
1770
|
}
|
|
1414
1771
|
var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
|
|
1415
|
-
delCookie(name, _formatCookieValue(strEmpty, values));
|
|
1772
|
+
delCookie(name, _formatCookieValue(strEmpty$1, values));
|
|
1416
1773
|
result = true;
|
|
1417
1774
|
}
|
|
1418
1775
|
return result;
|
|
@@ -1429,7 +1786,7 @@
|
|
|
1429
1786
|
_supportsCookies = doc[strCookie] !== undefined;
|
|
1430
1787
|
}
|
|
1431
1788
|
catch (e) {
|
|
1432
|
-
logger
|
|
1789
|
+
_throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1433
1790
|
}
|
|
1434
1791
|
}
|
|
1435
1792
|
return _supportsCookies;
|
|
@@ -1439,7 +1796,7 @@
|
|
|
1439
1796
|
if (theValue && theValue.length) {
|
|
1440
1797
|
var parts = strTrim(theValue).split(";");
|
|
1441
1798
|
arrForEach(parts, function (thePart) {
|
|
1442
|
-
thePart = strTrim(thePart || strEmpty);
|
|
1799
|
+
thePart = strTrim(thePart || strEmpty$1);
|
|
1443
1800
|
if (thePart) {
|
|
1444
1801
|
var idx = thePart.indexOf("=");
|
|
1445
1802
|
if (idx === -1) {
|
|
@@ -1460,21 +1817,21 @@
|
|
|
1460
1817
|
return null;
|
|
1461
1818
|
}
|
|
1462
1819
|
function _formatCookieValue(value, values) {
|
|
1463
|
-
var cookieValue = value || strEmpty;
|
|
1820
|
+
var cookieValue = value || strEmpty$1;
|
|
1464
1821
|
objForEachKey(values, function (name, theValue) {
|
|
1465
|
-
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
|
|
1822
|
+
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty$1);
|
|
1466
1823
|
});
|
|
1467
1824
|
return cookieValue;
|
|
1468
1825
|
}
|
|
1469
1826
|
function _getCookieValue(name) {
|
|
1470
|
-
var cookieValue = strEmpty;
|
|
1827
|
+
var cookieValue = strEmpty$1;
|
|
1471
1828
|
if (_doc) {
|
|
1472
|
-
var theCookie = _doc[strCookie] || strEmpty;
|
|
1829
|
+
var theCookie = _doc[strCookie] || strEmpty$1;
|
|
1473
1830
|
if (_parsedCookieValue !== theCookie) {
|
|
1474
1831
|
_cookieCache = _extractParts(theCookie);
|
|
1475
1832
|
_parsedCookieValue = theCookie;
|
|
1476
1833
|
}
|
|
1477
|
-
cookieValue = strTrim(_cookieCache[name] || strEmpty);
|
|
1834
|
+
cookieValue = strTrim(_cookieCache[name] || strEmpty$1);
|
|
1478
1835
|
}
|
|
1479
1836
|
return cookieValue;
|
|
1480
1837
|
}
|
|
@@ -1508,60 +1865,351 @@
|
|
|
1508
1865
|
return false;
|
|
1509
1866
|
}
|
|
1510
1867
|
|
|
1511
|
-
var
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1868
|
+
var strExtensionConfig = "extensionConfig";
|
|
1869
|
+
|
|
1870
|
+
function createUnloadHandlerContainer() {
|
|
1871
|
+
var handlers = [];
|
|
1872
|
+
function _addHandler(handler) {
|
|
1873
|
+
if (handler) {
|
|
1874
|
+
handlers.push(handler);
|
|
1875
|
+
}
|
|
1519
1876
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1877
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
1878
|
+
arrForEach(handlers, function (handler) {
|
|
1879
|
+
try {
|
|
1880
|
+
handler(unloadCtx, unloadState);
|
|
1881
|
+
}
|
|
1882
|
+
catch (e) {
|
|
1883
|
+
_throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
1884
|
+
}
|
|
1885
|
+
});
|
|
1886
|
+
handlers = [];
|
|
1887
|
+
}
|
|
1888
|
+
return {
|
|
1889
|
+
add: _addHandler,
|
|
1890
|
+
run: _runHandlers
|
|
1891
|
+
};
|
|
1523
1892
|
}
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1893
|
+
|
|
1894
|
+
var strGetPlugin = "getPlugin";
|
|
1895
|
+
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
1896
|
+
function BaseTelemetryPlugin() {
|
|
1897
|
+
var _self = this;
|
|
1898
|
+
var _isinitialized;
|
|
1899
|
+
var _rootCtx;
|
|
1900
|
+
var _nextPlugin;
|
|
1901
|
+
var _unloadHandlerContainer;
|
|
1902
|
+
var _hooks;
|
|
1903
|
+
_initDefaults();
|
|
1904
|
+
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
1905
|
+
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
1906
|
+
_setDefaults(config, core, pluginChain);
|
|
1907
|
+
_isinitialized = true;
|
|
1908
|
+
};
|
|
1909
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
1910
|
+
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
1911
|
+
return;
|
|
1912
|
+
}
|
|
1913
|
+
var result;
|
|
1914
|
+
var unloadDone = false;
|
|
1915
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1916
|
+
var theUnloadState = unloadState || {
|
|
1917
|
+
reason: 0 ,
|
|
1918
|
+
isAsync: false
|
|
1919
|
+
};
|
|
1920
|
+
function _unloadCallback() {
|
|
1921
|
+
if (!unloadDone) {
|
|
1922
|
+
unloadDone = true;
|
|
1923
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
1924
|
+
arrForEach(_hooks, function (fn) {
|
|
1925
|
+
fn.rm();
|
|
1926
|
+
});
|
|
1927
|
+
_hooks = [];
|
|
1928
|
+
if (result === true) {
|
|
1929
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
1930
|
+
}
|
|
1931
|
+
_initDefaults();
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
1935
|
+
_unloadCallback();
|
|
1936
|
+
}
|
|
1937
|
+
else {
|
|
1938
|
+
result = true;
|
|
1939
|
+
}
|
|
1940
|
+
return result;
|
|
1941
|
+
};
|
|
1942
|
+
_self.update = function (updateCtx, updateState) {
|
|
1943
|
+
if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
|
|
1944
|
+
return;
|
|
1945
|
+
}
|
|
1946
|
+
var result;
|
|
1947
|
+
var updateDone = false;
|
|
1948
|
+
var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1949
|
+
var theUpdateState = updateState || {
|
|
1950
|
+
reason: 0
|
|
1951
|
+
};
|
|
1952
|
+
function _updateCallback() {
|
|
1953
|
+
if (!updateDone) {
|
|
1954
|
+
updateDone = true;
|
|
1955
|
+
_setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
|
|
1959
|
+
_updateCallback();
|
|
1960
|
+
}
|
|
1961
|
+
else {
|
|
1962
|
+
result = true;
|
|
1963
|
+
}
|
|
1964
|
+
return result;
|
|
1965
|
+
};
|
|
1966
|
+
_self._addHook = function (hooks) {
|
|
1967
|
+
if (hooks) {
|
|
1968
|
+
if (isArray(hooks)) {
|
|
1969
|
+
_hooks = _hooks.concat(hooks);
|
|
1970
|
+
}
|
|
1971
|
+
else {
|
|
1972
|
+
_hooks.push(hooks);
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
};
|
|
1976
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
1977
|
+
});
|
|
1978
|
+
_self.diagLog = function (itemCtx) {
|
|
1979
|
+
return _getTelCtx(itemCtx).diagLog();
|
|
1980
|
+
};
|
|
1981
|
+
_self[strIsInitialized] = function () {
|
|
1982
|
+
return _isinitialized;
|
|
1983
|
+
};
|
|
1984
|
+
_self.setInitialized = function (isInitialized) {
|
|
1985
|
+
_isinitialized = isInitialized;
|
|
1986
|
+
};
|
|
1987
|
+
_self[strSetNextPlugin] = function (next) {
|
|
1988
|
+
_nextPlugin = next;
|
|
1989
|
+
};
|
|
1990
|
+
_self.processNext = function (env, itemCtx) {
|
|
1991
|
+
if (itemCtx) {
|
|
1992
|
+
itemCtx.processNext(env);
|
|
1993
|
+
}
|
|
1994
|
+
else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
|
|
1995
|
+
_nextPlugin.processTelemetry(env, null);
|
|
1996
|
+
}
|
|
1997
|
+
};
|
|
1998
|
+
_self._getTelCtx = _getTelCtx;
|
|
1999
|
+
function _getTelCtx(currentCtx) {
|
|
2000
|
+
if (currentCtx === void 0) { currentCtx = null; }
|
|
2001
|
+
var itemCtx = currentCtx;
|
|
2002
|
+
if (!itemCtx) {
|
|
2003
|
+
var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
|
|
2004
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
2005
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
2006
|
+
}
|
|
2007
|
+
else {
|
|
2008
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin);
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
return itemCtx;
|
|
2012
|
+
}
|
|
2013
|
+
function _setDefaults(config, core, pluginChain) {
|
|
2014
|
+
if (config) {
|
|
2015
|
+
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
2016
|
+
}
|
|
2017
|
+
if (!pluginChain && core) {
|
|
2018
|
+
pluginChain = core.getProcessTelContext().getNext();
|
|
2019
|
+
}
|
|
2020
|
+
var nextPlugin = _nextPlugin;
|
|
2021
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
2022
|
+
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
2023
|
+
}
|
|
2024
|
+
_self.core = core;
|
|
2025
|
+
_rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
2026
|
+
}
|
|
2027
|
+
function _initDefaults() {
|
|
2028
|
+
_isinitialized = false;
|
|
2029
|
+
_self.core = null;
|
|
2030
|
+
_rootCtx = null;
|
|
2031
|
+
_nextPlugin = null;
|
|
2032
|
+
_hooks = [];
|
|
2033
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
2034
|
+
}
|
|
1528
2035
|
}
|
|
1529
|
-
|
|
2036
|
+
return BaseTelemetryPlugin;
|
|
2037
|
+
}());
|
|
2038
|
+
|
|
2039
|
+
var strOnPrefix = "on";
|
|
2040
|
+
var strAttachEvent = "attachEvent";
|
|
2041
|
+
var strAddEventHelper = "addEventListener";
|
|
2042
|
+
var strDetachEvent = "detachEvent";
|
|
2043
|
+
var strRemoveEventListener = "removeEventListener";
|
|
2044
|
+
var strEvents = "events";
|
|
2045
|
+
createUniqueNamespace("aiEvtPageHide");
|
|
2046
|
+
createUniqueNamespace("aiEvtPageShow");
|
|
2047
|
+
var rRemoveEmptyNs = /\.[\.]+/g;
|
|
2048
|
+
var rRemoveTrailingEmptyNs = /[\.]+$/;
|
|
2049
|
+
var _guid = 1;
|
|
2050
|
+
var elmNodeData = createElmNodeData("events");
|
|
2051
|
+
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
2052
|
+
function _normalizeNamespace(name) {
|
|
2053
|
+
if (name && name.replace) {
|
|
2054
|
+
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
2055
|
+
}
|
|
2056
|
+
return name;
|
|
2057
|
+
}
|
|
2058
|
+
function _getEvtNamespace(eventName, evtNamespace) {
|
|
2059
|
+
if (evtNamespace) {
|
|
2060
|
+
var theNamespace_1 = "";
|
|
2061
|
+
if (isArray(evtNamespace)) {
|
|
2062
|
+
theNamespace_1 = "";
|
|
2063
|
+
arrForEach(evtNamespace, function (name) {
|
|
2064
|
+
name = _normalizeNamespace(name);
|
|
2065
|
+
if (name) {
|
|
2066
|
+
if (name[0] !== ".") {
|
|
2067
|
+
name = "." + name;
|
|
2068
|
+
}
|
|
2069
|
+
theNamespace_1 += name;
|
|
2070
|
+
}
|
|
2071
|
+
});
|
|
2072
|
+
}
|
|
2073
|
+
else {
|
|
2074
|
+
theNamespace_1 = _normalizeNamespace(evtNamespace);
|
|
2075
|
+
}
|
|
2076
|
+
if (theNamespace_1) {
|
|
2077
|
+
if (theNamespace_1[0] !== ".") {
|
|
2078
|
+
theNamespace_1 = "." + theNamespace_1;
|
|
2079
|
+
}
|
|
2080
|
+
eventName = (eventName || "") + theNamespace_1;
|
|
2081
|
+
}
|
|
1530
2082
|
}
|
|
2083
|
+
var parsedEvent = (eventNamespace.exec(eventName || "") || []);
|
|
2084
|
+
return {
|
|
2085
|
+
type: parsedEvent[1],
|
|
2086
|
+
ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
|
|
2087
|
+
};
|
|
1531
2088
|
}
|
|
1532
|
-
function
|
|
1533
|
-
|
|
1534
|
-
var
|
|
1535
|
-
|
|
1536
|
-
|
|
2089
|
+
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
2090
|
+
if (addDefault === void 0) { addDefault = true; }
|
|
2091
|
+
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
2092
|
+
var registeredEvents = aiEvts[evtName];
|
|
2093
|
+
if (!registeredEvents) {
|
|
2094
|
+
registeredEvents = aiEvts[evtName] = [];
|
|
1537
2095
|
}
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
2096
|
+
return registeredEvents;
|
|
2097
|
+
}
|
|
2098
|
+
function _doDetach(obj, evtName, handlerRef, useCapture) {
|
|
2099
|
+
if (obj && evtName && evtName.type) {
|
|
2100
|
+
if (obj[strRemoveEventListener]) {
|
|
2101
|
+
obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);
|
|
1541
2102
|
}
|
|
1542
|
-
|
|
2103
|
+
else if (obj[strDetachEvent]) {
|
|
2104
|
+
obj[strDetachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
2109
|
+
var result = false;
|
|
2110
|
+
if (obj && evtName && evtName.type && handlerRef) {
|
|
2111
|
+
if (obj[strAddEventHelper]) {
|
|
2112
|
+
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
2113
|
+
result = true;
|
|
2114
|
+
}
|
|
2115
|
+
else if (obj[strAttachEvent]) {
|
|
2116
|
+
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
2117
|
+
result = true;
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
return result;
|
|
2121
|
+
}
|
|
2122
|
+
function _doUnregister(target, events, evtName, unRegFn) {
|
|
2123
|
+
var idx = events.length;
|
|
2124
|
+
while (idx--) {
|
|
2125
|
+
var theEvent = events[idx];
|
|
2126
|
+
if (theEvent) {
|
|
2127
|
+
if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {
|
|
2128
|
+
if (!unRegFn || unRegFn(theEvent)) {
|
|
2129
|
+
_doDetach(target, theEvent.evtName, theEvent.handler, theEvent.capture);
|
|
2130
|
+
events.splice(idx, 1);
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
function _unregisterEvents(target, evtName, unRegFn) {
|
|
2137
|
+
if (evtName.type) {
|
|
2138
|
+
_doUnregister(target, _getRegisteredEvents(target, evtName.type), evtName, unRegFn);
|
|
1543
2139
|
}
|
|
1544
2140
|
else {
|
|
1545
|
-
|
|
2141
|
+
var eventCache = elmNodeData.get(target, strEvents, {});
|
|
2142
|
+
objForEachKey(eventCache, function (evtType, events) {
|
|
2143
|
+
_doUnregister(target, events, evtName, unRegFn);
|
|
2144
|
+
});
|
|
2145
|
+
if (objKeys(eventCache).length === 0) {
|
|
2146
|
+
elmNodeData.kill(target, strEvents);
|
|
2147
|
+
}
|
|
1546
2148
|
}
|
|
1547
|
-
|
|
1548
|
-
|
|
2149
|
+
}
|
|
2150
|
+
function mergeEvtNamespace(theNamespace, namespaces) {
|
|
2151
|
+
var newNamespaces;
|
|
2152
|
+
if (namespaces) {
|
|
2153
|
+
if (isArray(namespaces)) {
|
|
2154
|
+
newNamespaces = [theNamespace].concat(namespaces);
|
|
2155
|
+
}
|
|
2156
|
+
else {
|
|
2157
|
+
newNamespaces = [theNamespace, namespaces];
|
|
2158
|
+
}
|
|
2159
|
+
newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
|
|
1549
2160
|
}
|
|
1550
|
-
|
|
2161
|
+
else {
|
|
2162
|
+
newNamespaces = theNamespace;
|
|
2163
|
+
}
|
|
2164
|
+
return newNamespaces;
|
|
1551
2165
|
}
|
|
1552
|
-
function
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
2166
|
+
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
2167
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
2168
|
+
var result = false;
|
|
2169
|
+
if (target) {
|
|
2170
|
+
try {
|
|
2171
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
2172
|
+
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
2173
|
+
if (result && elmNodeData.accept(target)) {
|
|
2174
|
+
var registeredEvent = {
|
|
2175
|
+
guid: _guid++,
|
|
2176
|
+
evtName: evtName,
|
|
2177
|
+
handler: handlerRef,
|
|
2178
|
+
capture: useCapture
|
|
2179
|
+
};
|
|
2180
|
+
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
catch (e) {
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
return result;
|
|
2187
|
+
}
|
|
2188
|
+
function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
2189
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
2190
|
+
if (target) {
|
|
2191
|
+
try {
|
|
2192
|
+
var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
|
|
2193
|
+
var found_1 = false;
|
|
2194
|
+
_unregisterEvents(target, evtName_1, function (regEvent) {
|
|
2195
|
+
if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {
|
|
2196
|
+
found_1 = true;
|
|
2197
|
+
return true;
|
|
2198
|
+
}
|
|
2199
|
+
return false;
|
|
2200
|
+
});
|
|
2201
|
+
if (!found_1) {
|
|
2202
|
+
_doDetach(target, evtName_1, handlerRef, useCapture);
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
catch (e) {
|
|
2206
|
+
}
|
|
1558
2207
|
}
|
|
1559
|
-
return value;
|
|
1560
2208
|
}
|
|
1561
2209
|
|
|
1562
2210
|
function generateW3CId() {
|
|
1563
2211
|
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
1564
|
-
var oct =
|
|
2212
|
+
var oct = strEmpty$1, tmp;
|
|
1565
2213
|
for (var a = 0; a < 4; a++) {
|
|
1566
2214
|
tmp = random32();
|
|
1567
2215
|
oct +=
|
|
@@ -1578,6 +2226,143 @@
|
|
|
1578
2226
|
return oct.substr(0, 8) + oct.substr(9, 4) + "4" + oct.substr(13, 3) + clockSequenceHi + oct.substr(16, 3) + oct.substr(19, 12);
|
|
1579
2227
|
}
|
|
1580
2228
|
|
|
2229
|
+
var aiInstrumentHooks = "_aiHooks";
|
|
2230
|
+
var cbNames = [
|
|
2231
|
+
"req", "rsp", "hkErr", "fnErr"
|
|
2232
|
+
];
|
|
2233
|
+
function _arrLoop(arr, fn) {
|
|
2234
|
+
if (arr) {
|
|
2235
|
+
for (var lp = 0; lp < arr.length; lp++) {
|
|
2236
|
+
if (fn(arr[lp], lp)) {
|
|
2237
|
+
break;
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
function _doCallbacks(hooks, callDetails, cbArgs, hookCtx, type) {
|
|
2243
|
+
if (type >= 0 && type <= 2 ) {
|
|
2244
|
+
_arrLoop(hooks, function (hook, idx) {
|
|
2245
|
+
var cbks = hook.cbks;
|
|
2246
|
+
var cb = cbks[cbNames[type]];
|
|
2247
|
+
if (cb) {
|
|
2248
|
+
callDetails.ctx = function () {
|
|
2249
|
+
var ctx = hookCtx[idx] = (hookCtx[idx] || {});
|
|
2250
|
+
return ctx;
|
|
2251
|
+
};
|
|
2252
|
+
try {
|
|
2253
|
+
cb.apply(callDetails.inst, cbArgs);
|
|
2254
|
+
}
|
|
2255
|
+
catch (err) {
|
|
2256
|
+
var orgEx = callDetails.err;
|
|
2257
|
+
try {
|
|
2258
|
+
var hookErrorCb = cbks[cbNames[2 ]];
|
|
2259
|
+
if (hookErrorCb) {
|
|
2260
|
+
callDetails.err = err;
|
|
2261
|
+
hookErrorCb.apply(callDetails.inst, cbArgs);
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
catch (e) {
|
|
2265
|
+
}
|
|
2266
|
+
finally {
|
|
2267
|
+
callDetails.err = orgEx;
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
});
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
function _createFunctionHook(aiHook) {
|
|
2275
|
+
return function () {
|
|
2276
|
+
var funcThis = this;
|
|
2277
|
+
var orgArgs = arguments;
|
|
2278
|
+
var hooks = aiHook.h;
|
|
2279
|
+
var funcArgs = {
|
|
2280
|
+
name: aiHook.n,
|
|
2281
|
+
inst: funcThis,
|
|
2282
|
+
ctx: null,
|
|
2283
|
+
set: _replaceArg
|
|
2284
|
+
};
|
|
2285
|
+
var hookCtx = [];
|
|
2286
|
+
var cbArgs = _createArgs([funcArgs], orgArgs);
|
|
2287
|
+
funcArgs.evt = getGlobalInst("event");
|
|
2288
|
+
function _createArgs(target, theArgs) {
|
|
2289
|
+
_arrLoop(theArgs, function (arg) {
|
|
2290
|
+
target.push(arg);
|
|
2291
|
+
});
|
|
2292
|
+
return target;
|
|
2293
|
+
}
|
|
2294
|
+
function _replaceArg(idx, value) {
|
|
2295
|
+
orgArgs = _createArgs([], orgArgs);
|
|
2296
|
+
orgArgs[idx] = value;
|
|
2297
|
+
cbArgs = _createArgs([funcArgs], orgArgs);
|
|
2298
|
+
}
|
|
2299
|
+
_doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 0 );
|
|
2300
|
+
var theFunc = aiHook.f;
|
|
2301
|
+
try {
|
|
2302
|
+
funcArgs.rslt = theFunc.apply(funcThis, orgArgs);
|
|
2303
|
+
}
|
|
2304
|
+
catch (err) {
|
|
2305
|
+
funcArgs.err = err;
|
|
2306
|
+
_doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 3 );
|
|
2307
|
+
throw err;
|
|
2308
|
+
}
|
|
2309
|
+
_doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 1 );
|
|
2310
|
+
return funcArgs.rslt;
|
|
2311
|
+
};
|
|
2312
|
+
}
|
|
2313
|
+
function _getOwner(target, name, checkPrototype) {
|
|
2314
|
+
var owner = null;
|
|
2315
|
+
if (target) {
|
|
2316
|
+
if (hasOwnProperty(target, name)) {
|
|
2317
|
+
owner = target;
|
|
2318
|
+
}
|
|
2319
|
+
else if (checkPrototype) {
|
|
2320
|
+
owner = _getOwner(_getObjProto$1(target), name, false);
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
return owner;
|
|
2324
|
+
}
|
|
2325
|
+
function InstrumentFunc(target, funcName, callbacks, checkPrototype) {
|
|
2326
|
+
if (checkPrototype === void 0) { checkPrototype = true; }
|
|
2327
|
+
if (target && funcName && callbacks) {
|
|
2328
|
+
var owner = _getOwner(target, funcName, checkPrototype);
|
|
2329
|
+
if (owner) {
|
|
2330
|
+
var fn = owner[funcName];
|
|
2331
|
+
if (typeof fn === strShimFunction) {
|
|
2332
|
+
var aiHook_1 = fn[aiInstrumentHooks];
|
|
2333
|
+
if (!aiHook_1) {
|
|
2334
|
+
aiHook_1 = {
|
|
2335
|
+
i: 0,
|
|
2336
|
+
n: funcName,
|
|
2337
|
+
f: fn,
|
|
2338
|
+
h: []
|
|
2339
|
+
};
|
|
2340
|
+
var newFunc = _createFunctionHook(aiHook_1);
|
|
2341
|
+
newFunc[aiInstrumentHooks] = aiHook_1;
|
|
2342
|
+
owner[funcName] = newFunc;
|
|
2343
|
+
}
|
|
2344
|
+
var theHook = {
|
|
2345
|
+
id: aiHook_1.i,
|
|
2346
|
+
cbks: callbacks,
|
|
2347
|
+
rm: function () {
|
|
2348
|
+
var id = this.id;
|
|
2349
|
+
_arrLoop(aiHook_1.h, function (hook, idx) {
|
|
2350
|
+
if (hook.id === id) {
|
|
2351
|
+
aiHook_1.h.splice(idx, 1);
|
|
2352
|
+
return 1;
|
|
2353
|
+
}
|
|
2354
|
+
});
|
|
2355
|
+
}
|
|
2356
|
+
};
|
|
2357
|
+
aiHook_1.i++;
|
|
2358
|
+
aiHook_1.h.push(theHook);
|
|
2359
|
+
return theHook;
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
return null;
|
|
2364
|
+
}
|
|
2365
|
+
|
|
1581
2366
|
function dataSanitizeKeyAndAddUniqueness(logger, key, map) {
|
|
1582
2367
|
var origLength = key.length;
|
|
1583
2368
|
var field = dataSanitizeKey(logger, key);
|
|
@@ -1598,7 +2383,7 @@
|
|
|
1598
2383
|
name = strTrim(name.toString());
|
|
1599
2384
|
if (name.length > 150 ) {
|
|
1600
2385
|
nameTrunc = name.substring(0, 150 );
|
|
1601
|
-
logger
|
|
2386
|
+
_throwInternal(logger, 2 , 57 , "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
|
|
1602
2387
|
}
|
|
1603
2388
|
}
|
|
1604
2389
|
return nameTrunc || name;
|
|
@@ -1611,20 +2396,20 @@
|
|
|
1611
2396
|
value = strTrim(value);
|
|
1612
2397
|
if (value.toString().length > maxLength) {
|
|
1613
2398
|
valueTrunc = value.toString().substring(0, maxLength);
|
|
1614
|
-
logger
|
|
2399
|
+
_throwInternal(logger, 2 , 61 , "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
|
|
1615
2400
|
}
|
|
1616
2401
|
}
|
|
1617
2402
|
return valueTrunc || value;
|
|
1618
2403
|
}
|
|
1619
2404
|
function dataSanitizeUrl(logger, url) {
|
|
1620
|
-
return dataSanitizeInput(logger, url, 2048 ,
|
|
2405
|
+
return dataSanitizeInput(logger, url, 2048 , 66 );
|
|
1621
2406
|
}
|
|
1622
2407
|
function dataSanitizeMessage(logger, message) {
|
|
1623
2408
|
var messageTrunc;
|
|
1624
2409
|
if (message) {
|
|
1625
2410
|
if (message.length > 32768 ) {
|
|
1626
2411
|
messageTrunc = message.substring(0, 32768 );
|
|
1627
|
-
logger
|
|
2412
|
+
_throwInternal(logger, 2 , 56 , "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
|
|
1628
2413
|
}
|
|
1629
2414
|
}
|
|
1630
2415
|
return messageTrunc || message;
|
|
@@ -1635,7 +2420,7 @@
|
|
|
1635
2420
|
var value = "" + exception;
|
|
1636
2421
|
if (value.length > 32768 ) {
|
|
1637
2422
|
exceptionTrunc = value.substring(0, 32768 );
|
|
1638
|
-
logger
|
|
2423
|
+
_throwInternal(logger, 2 , 52 , "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
|
|
1639
2424
|
}
|
|
1640
2425
|
}
|
|
1641
2426
|
return exceptionTrunc || exception;
|
|
@@ -1649,7 +2434,7 @@
|
|
|
1649
2434
|
value = getJSON().stringify(value);
|
|
1650
2435
|
}
|
|
1651
2436
|
catch (e) {
|
|
1652
|
-
logger
|
|
2437
|
+
_throwInternal(logger, 2 , 49 , "custom property is not valid", { exception: e }, true);
|
|
1653
2438
|
}
|
|
1654
2439
|
}
|
|
1655
2440
|
value = dataSanitizeString(logger, value, 8192 );
|
|
@@ -1672,7 +2457,7 @@
|
|
|
1672
2457
|
return measurements;
|
|
1673
2458
|
}
|
|
1674
2459
|
function dataSanitizeId(logger, id) {
|
|
1675
|
-
return id ? dataSanitizeInput(logger, id, 128 ,
|
|
2460
|
+
return id ? dataSanitizeInput(logger, id, 128 , 69 ).toString() : id;
|
|
1676
2461
|
}
|
|
1677
2462
|
function dataSanitizeInput(logger, input, maxLength, _msgId) {
|
|
1678
2463
|
var inputTrunc;
|
|
@@ -1680,7 +2465,7 @@
|
|
|
1680
2465
|
input = strTrim(input);
|
|
1681
2466
|
if (input.length > maxLength) {
|
|
1682
2467
|
inputTrunc = input.substring(0, maxLength);
|
|
1683
|
-
logger
|
|
2468
|
+
_throwInternal(logger, 2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
|
|
1684
2469
|
}
|
|
1685
2470
|
}
|
|
1686
2471
|
return inputTrunc || input;
|
|
@@ -1705,6 +2490,7 @@
|
|
|
1705
2490
|
return event;
|
|
1706
2491
|
}
|
|
1707
2492
|
|
|
2493
|
+
var strEmpty = "";
|
|
1708
2494
|
function stringToBoolOrDefault(str, defaultValue) {
|
|
1709
2495
|
if (defaultValue === void 0) { defaultValue = false; }
|
|
1710
2496
|
if (str === undefined || str === null) {
|
|
@@ -1717,16 +2503,16 @@
|
|
|
1717
2503
|
totalms = 0;
|
|
1718
2504
|
}
|
|
1719
2505
|
totalms = Math.round(totalms);
|
|
1720
|
-
var ms =
|
|
1721
|
-
var sec =
|
|
1722
|
-
var min =
|
|
1723
|
-
var hour =
|
|
2506
|
+
var ms = strEmpty + totalms % 1000;
|
|
2507
|
+
var sec = strEmpty + Math.floor(totalms / 1000) % 60;
|
|
2508
|
+
var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
|
|
2509
|
+
var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
|
|
1724
2510
|
var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
|
|
1725
2511
|
ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
|
|
1726
2512
|
sec = sec.length < 2 ? "0" + sec : sec;
|
|
1727
2513
|
min = min.length < 2 ? "0" + min : min;
|
|
1728
2514
|
hour = hour.length < 2 ? "0" + hour : hour;
|
|
1729
|
-
return (days > 0 ? days + "." :
|
|
2515
|
+
return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
|
|
1730
2516
|
}
|
|
1731
2517
|
function isCrossOriginError(message, url, lineNumber, columnNumber, error) {
|
|
1732
2518
|
return !error && isString(message) && (message === "Script error." || message === "Script error");
|
|
@@ -1735,18 +2521,17 @@
|
|
|
1735
2521
|
var strNotSpecified = "not_specified";
|
|
1736
2522
|
var strIkey = "iKey";
|
|
1737
2523
|
|
|
1738
|
-
var StorageType
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
|
|
1748
|
-
})(DistributedTracingModes || (DistributedTracingModes = {}));
|
|
2524
|
+
var StorageType = createEnumStyle({
|
|
2525
|
+
LocalStorage: 0 ,
|
|
2526
|
+
SessionStorage: 1
|
|
2527
|
+
});
|
|
2528
|
+
createEnumStyle({
|
|
2529
|
+
AI: 0 ,
|
|
2530
|
+
AI_AND_W3C: 1 ,
|
|
2531
|
+
W3C: 2
|
|
2532
|
+
});
|
|
1749
2533
|
|
|
2534
|
+
var _canUseLocalStorage = undefined;
|
|
1750
2535
|
var _canUseSessionStorage = undefined;
|
|
1751
2536
|
function _getVerifiedStorageObject(storageType) {
|
|
1752
2537
|
try {
|
|
@@ -1773,10 +2558,21 @@
|
|
|
1773
2558
|
return null;
|
|
1774
2559
|
}
|
|
1775
2560
|
function utlDisableStorage() {
|
|
2561
|
+
_canUseLocalStorage = false;
|
|
1776
2562
|
_canUseSessionStorage = false;
|
|
1777
2563
|
}
|
|
1778
|
-
function
|
|
1779
|
-
|
|
2564
|
+
function utlEnableStorage() {
|
|
2565
|
+
_canUseLocalStorage = utlCanUseLocalStorage(true);
|
|
2566
|
+
_canUseSessionStorage = utlCanUseSessionStorage(true);
|
|
2567
|
+
}
|
|
2568
|
+
function utlCanUseLocalStorage(reset) {
|
|
2569
|
+
if (reset || _canUseLocalStorage === undefined) {
|
|
2570
|
+
_canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
|
|
2571
|
+
}
|
|
2572
|
+
return _canUseLocalStorage;
|
|
2573
|
+
}
|
|
2574
|
+
function utlCanUseSessionStorage(reset) {
|
|
2575
|
+
if (reset || _canUseSessionStorage === undefined) {
|
|
1780
2576
|
_canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage);
|
|
1781
2577
|
}
|
|
1782
2578
|
return _canUseSessionStorage;
|
|
@@ -1789,7 +2585,7 @@
|
|
|
1789
2585
|
}
|
|
1790
2586
|
catch (e) {
|
|
1791
2587
|
_canUseSessionStorage = false;
|
|
1792
|
-
logger
|
|
2588
|
+
_throwInternal(logger, 2 , 2 , "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1793
2589
|
}
|
|
1794
2590
|
}
|
|
1795
2591
|
return null;
|
|
@@ -1803,7 +2599,7 @@
|
|
|
1803
2599
|
}
|
|
1804
2600
|
catch (e) {
|
|
1805
2601
|
_canUseSessionStorage = false;
|
|
1806
|
-
logger
|
|
2602
|
+
_throwInternal(logger, 2 , 4 , "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1807
2603
|
}
|
|
1808
2604
|
}
|
|
1809
2605
|
return false;
|
|
@@ -1817,7 +2613,7 @@
|
|
|
1817
2613
|
}
|
|
1818
2614
|
catch (e) {
|
|
1819
2615
|
_canUseSessionStorage = false;
|
|
1820
|
-
logger
|
|
2616
|
+
_throwInternal(logger, 2 , 6 , "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
|
|
1821
2617
|
}
|
|
1822
2618
|
}
|
|
1823
2619
|
return false;
|
|
@@ -1913,57 +2709,23 @@
|
|
|
1913
2709
|
return result;
|
|
1914
2710
|
}
|
|
1915
2711
|
|
|
1916
|
-
var
|
|
1917
|
-
function EventData() {
|
|
1918
|
-
this.ver = 2;
|
|
1919
|
-
this.properties = {};
|
|
1920
|
-
this.measurements = {};
|
|
1921
|
-
}
|
|
1922
|
-
return EventData;
|
|
1923
|
-
}());
|
|
1924
|
-
|
|
1925
|
-
var Event$1 = /** @class */ (function (_super) {
|
|
1926
|
-
__extendsFn(Event, _super);
|
|
2712
|
+
var Event$1 = /** @class */ (function () {
|
|
1927
2713
|
function Event(logger, name, properties, measurements) {
|
|
1928
|
-
|
|
1929
|
-
_this.aiDataContract = {
|
|
2714
|
+
this.aiDataContract = {
|
|
1930
2715
|
ver: 1 ,
|
|
1931
2716
|
name: 1 ,
|
|
1932
2717
|
properties: 0 ,
|
|
1933
2718
|
measurements: 0
|
|
1934
2719
|
};
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
2720
|
+
var _self = this;
|
|
2721
|
+
_self.ver = 2;
|
|
2722
|
+
_self.name = dataSanitizeString(logger, name) || strNotSpecified;
|
|
2723
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
2724
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
1939
2725
|
}
|
|
1940
2726
|
Event.envelopeType = "Microsoft.ApplicationInsights.{0}.Event";
|
|
1941
2727
|
Event.dataType = "EventData";
|
|
1942
2728
|
return Event;
|
|
1943
|
-
}(EventData));
|
|
1944
|
-
|
|
1945
|
-
var StackFrame = /** @class */ (function () {
|
|
1946
|
-
function StackFrame() {
|
|
1947
|
-
}
|
|
1948
|
-
return StackFrame;
|
|
1949
|
-
}());
|
|
1950
|
-
|
|
1951
|
-
var ExceptionData = /** @class */ (function () {
|
|
1952
|
-
function ExceptionData() {
|
|
1953
|
-
this.ver = 2;
|
|
1954
|
-
this.exceptions = [];
|
|
1955
|
-
this.properties = {};
|
|
1956
|
-
this.measurements = {};
|
|
1957
|
-
}
|
|
1958
|
-
return ExceptionData;
|
|
1959
|
-
}());
|
|
1960
|
-
|
|
1961
|
-
var ExceptionDetails = /** @class */ (function () {
|
|
1962
|
-
function ExceptionDetails() {
|
|
1963
|
-
this.hasFullStack = true;
|
|
1964
|
-
this.parsedStack = [];
|
|
1965
|
-
}
|
|
1966
|
-
return ExceptionDetails;
|
|
1967
2729
|
}());
|
|
1968
2730
|
|
|
1969
2731
|
var NoMethod = "<no_method>";
|
|
@@ -2207,50 +2969,48 @@
|
|
|
2207
2969
|
}
|
|
2208
2970
|
return "" + (errorObj || "");
|
|
2209
2971
|
}
|
|
2210
|
-
var Exception = /** @class */ (function (
|
|
2211
|
-
__extendsFn(Exception, _super);
|
|
2972
|
+
var Exception = /** @class */ (function () {
|
|
2212
2973
|
function Exception(logger, exception, properties, measurements, severityLevel, id) {
|
|
2213
|
-
|
|
2214
|
-
_this.aiDataContract = {
|
|
2974
|
+
this.aiDataContract = {
|
|
2215
2975
|
ver: 1 ,
|
|
2216
2976
|
exceptions: 1 ,
|
|
2217
2977
|
severityLevel: 0 ,
|
|
2218
2978
|
properties: 0 ,
|
|
2219
2979
|
measurements: 0
|
|
2220
2980
|
};
|
|
2981
|
+
var _self = this;
|
|
2982
|
+
_self.ver = 2;
|
|
2221
2983
|
if (!_isExceptionInternal(exception)) {
|
|
2222
2984
|
if (!properties) {
|
|
2223
2985
|
properties = {};
|
|
2224
2986
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2987
|
+
_self.exceptions = [new _ExceptionDetails(logger, exception, properties)];
|
|
2988
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
2989
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
2228
2990
|
if (severityLevel) {
|
|
2229
|
-
|
|
2991
|
+
_self.severityLevel = severityLevel;
|
|
2230
2992
|
}
|
|
2231
2993
|
if (id) {
|
|
2232
|
-
|
|
2994
|
+
_self.id = id;
|
|
2233
2995
|
}
|
|
2234
2996
|
}
|
|
2235
2997
|
else {
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2998
|
+
_self.exceptions = exception.exceptions || [];
|
|
2999
|
+
_self.properties = exception.properties;
|
|
3000
|
+
_self.measurements = exception.measurements;
|
|
2239
3001
|
if (exception.severityLevel) {
|
|
2240
|
-
|
|
3002
|
+
_self.severityLevel = exception.severityLevel;
|
|
2241
3003
|
}
|
|
2242
3004
|
if (exception.id) {
|
|
2243
|
-
|
|
3005
|
+
_self.id = exception.id;
|
|
2244
3006
|
}
|
|
2245
3007
|
if (exception.problemGroup) {
|
|
2246
|
-
|
|
3008
|
+
_self.problemGroup = exception.problemGroup;
|
|
2247
3009
|
}
|
|
2248
|
-
_this.ver = 2;
|
|
2249
3010
|
if (!isNullOrUndefined(exception.isManual)) {
|
|
2250
|
-
|
|
3011
|
+
_self.isManual = exception.isManual;
|
|
2251
3012
|
}
|
|
2252
3013
|
}
|
|
2253
|
-
return _this;
|
|
2254
3014
|
}
|
|
2255
3015
|
Exception.CreateAutoException = function (message, url, lineNumber, columnNumber, error, evt, stack, errorSrc) {
|
|
2256
3016
|
var errorType = _getErrorType(error || evt || message);
|
|
@@ -2304,12 +3064,10 @@
|
|
|
2304
3064
|
Exception.dataType = "ExceptionData";
|
|
2305
3065
|
Exception.formatError = _formatErrorCode;
|
|
2306
3066
|
return Exception;
|
|
2307
|
-
}(
|
|
2308
|
-
var _ExceptionDetails = /** @class */ (function (
|
|
2309
|
-
__extendsFn(_ExceptionDetails, _super);
|
|
3067
|
+
}());
|
|
3068
|
+
var _ExceptionDetails = /** @class */ (function () {
|
|
2310
3069
|
function _ExceptionDetails(logger, exception, properties) {
|
|
2311
|
-
|
|
2312
|
-
_this.aiDataContract = {
|
|
3070
|
+
this.aiDataContract = {
|
|
2313
3071
|
id: 0 ,
|
|
2314
3072
|
outerId: 0 ,
|
|
2315
3073
|
typeName: 1 ,
|
|
@@ -2318,41 +3076,42 @@
|
|
|
2318
3076
|
stack: 0 ,
|
|
2319
3077
|
parsedStack: 2
|
|
2320
3078
|
};
|
|
3079
|
+
var _self = this;
|
|
2321
3080
|
if (!_isExceptionDetailsInternal(exception)) {
|
|
2322
3081
|
var error = exception;
|
|
2323
3082
|
var evt = error && error.evt;
|
|
2324
3083
|
if (!isError(error)) {
|
|
2325
3084
|
error = error[strError] || evt || error;
|
|
2326
3085
|
}
|
|
2327
|
-
|
|
2328
|
-
|
|
3086
|
+
_self.typeName = dataSanitizeString(logger, _getErrorType(error)) || strNotSpecified;
|
|
3087
|
+
_self.message = dataSanitizeMessage(logger, _formatMessage(exception || error, _self.typeName)) || strNotSpecified;
|
|
2329
3088
|
var stack = exception[strStackDetails] || _getStackFromErrorObj(exception);
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
3089
|
+
_self.parsedStack = _parseStack(stack);
|
|
3090
|
+
_self[strStack] = dataSanitizeException(logger, _formatStackTrace(stack));
|
|
3091
|
+
_self.hasFullStack = isArray(_self.parsedStack) && _self.parsedStack.length > 0;
|
|
2333
3092
|
if (properties) {
|
|
2334
|
-
properties.typeName = properties.typeName ||
|
|
3093
|
+
properties.typeName = properties.typeName || _self.typeName;
|
|
2335
3094
|
}
|
|
2336
3095
|
}
|
|
2337
3096
|
else {
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
3097
|
+
_self.typeName = exception.typeName;
|
|
3098
|
+
_self.message = exception.message;
|
|
3099
|
+
_self[strStack] = exception[strStack];
|
|
3100
|
+
_self.parsedStack = exception.parsedStack || [];
|
|
3101
|
+
_self.hasFullStack = exception.hasFullStack;
|
|
2343
3102
|
}
|
|
2344
|
-
return _this;
|
|
2345
3103
|
}
|
|
2346
3104
|
_ExceptionDetails.prototype.toInterface = function () {
|
|
2347
|
-
var
|
|
2348
|
-
|
|
3105
|
+
var _self = this;
|
|
3106
|
+
var parsedStack = _self.parsedStack instanceof Array
|
|
3107
|
+
&& arrMap(_self.parsedStack, function (frame) { return frame.toInterface(); });
|
|
2349
3108
|
var exceptionDetailsInterface = {
|
|
2350
|
-
id:
|
|
2351
|
-
outerId:
|
|
2352
|
-
typeName:
|
|
2353
|
-
message:
|
|
2354
|
-
hasFullStack:
|
|
2355
|
-
stack:
|
|
3109
|
+
id: _self.id,
|
|
3110
|
+
outerId: _self.outerId,
|
|
3111
|
+
typeName: _self.typeName,
|
|
3112
|
+
message: _self.message,
|
|
3113
|
+
hasFullStack: _self.hasFullStack,
|
|
3114
|
+
stack: _self[strStack],
|
|
2356
3115
|
parsedStack: parsedStack || undefined
|
|
2357
3116
|
};
|
|
2358
3117
|
return exceptionDetailsInterface;
|
|
@@ -2365,94 +3124,68 @@
|
|
|
2365
3124
|
return exceptionDetails;
|
|
2366
3125
|
};
|
|
2367
3126
|
return _ExceptionDetails;
|
|
2368
|
-
}(
|
|
2369
|
-
var _StackFrame = /** @class */ (function (
|
|
2370
|
-
__extendsFn(_StackFrame, _super);
|
|
3127
|
+
}());
|
|
3128
|
+
var _StackFrame = /** @class */ (function () {
|
|
2371
3129
|
function _StackFrame(sourceFrame, level) {
|
|
2372
|
-
|
|
2373
|
-
_this.sizeInBytes = 0;
|
|
2374
|
-
_this.aiDataContract = {
|
|
3130
|
+
this.aiDataContract = {
|
|
2375
3131
|
level: 1 ,
|
|
2376
3132
|
method: 1 ,
|
|
2377
3133
|
assembly: 0 ,
|
|
2378
3134
|
fileName: 0 ,
|
|
2379
3135
|
line: 0
|
|
2380
3136
|
};
|
|
3137
|
+
var _self = this;
|
|
3138
|
+
_self.sizeInBytes = 0;
|
|
2381
3139
|
if (typeof sourceFrame === "string") {
|
|
2382
3140
|
var frame = sourceFrame;
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
3141
|
+
_self.level = level;
|
|
3142
|
+
_self.method = NoMethod;
|
|
3143
|
+
_self.assembly = strTrim(frame);
|
|
3144
|
+
_self.fileName = "";
|
|
3145
|
+
_self.line = 0;
|
|
2388
3146
|
var matches = frame.match(_StackFrame.regex);
|
|
2389
3147
|
if (matches && matches.length >= 5) {
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
3148
|
+
_self.method = strTrim(matches[2]) || _self.method;
|
|
3149
|
+
_self.fileName = strTrim(matches[4]);
|
|
3150
|
+
_self.line = parseInt(matches[5]) || 0;
|
|
2393
3151
|
}
|
|
2394
3152
|
}
|
|
2395
3153
|
else {
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
return _this;
|
|
3154
|
+
_self.level = sourceFrame.level;
|
|
3155
|
+
_self.method = sourceFrame.method;
|
|
3156
|
+
_self.assembly = sourceFrame.assembly;
|
|
3157
|
+
_self.fileName = sourceFrame.fileName;
|
|
3158
|
+
_self.line = sourceFrame.line;
|
|
3159
|
+
_self.sizeInBytes = 0;
|
|
3160
|
+
}
|
|
3161
|
+
_self.sizeInBytes += _self.method.length;
|
|
3162
|
+
_self.sizeInBytes += _self.fileName.length;
|
|
3163
|
+
_self.sizeInBytes += _self.assembly.length;
|
|
3164
|
+
_self.sizeInBytes += _StackFrame.baseSize;
|
|
3165
|
+
_self.sizeInBytes += _self.level.toString().length;
|
|
3166
|
+
_self.sizeInBytes += _self.line.toString().length;
|
|
2410
3167
|
}
|
|
2411
3168
|
_StackFrame.CreateFromInterface = function (frame) {
|
|
2412
3169
|
return new _StackFrame(frame, null );
|
|
2413
3170
|
};
|
|
2414
3171
|
_StackFrame.prototype.toInterface = function () {
|
|
3172
|
+
var _self = this;
|
|
2415
3173
|
return {
|
|
2416
|
-
level:
|
|
2417
|
-
method:
|
|
2418
|
-
assembly:
|
|
2419
|
-
fileName:
|
|
2420
|
-
line:
|
|
3174
|
+
level: _self.level,
|
|
3175
|
+
method: _self.method,
|
|
3176
|
+
assembly: _self.assembly,
|
|
3177
|
+
fileName: _self.fileName,
|
|
3178
|
+
line: _self.line
|
|
2421
3179
|
};
|
|
2422
3180
|
};
|
|
2423
3181
|
_StackFrame.regex = /^([\s]+at)?[\s]{0,50}([^\@\()]+?)[\s]{0,50}(\@|\()([^\(\n]+):([0-9]+):([0-9]+)(\)?)$/;
|
|
2424
3182
|
_StackFrame.baseSize = 58;
|
|
2425
3183
|
return _StackFrame;
|
|
2426
|
-
}(StackFrame));
|
|
2427
|
-
|
|
2428
|
-
var MetricData = /** @class */ (function () {
|
|
2429
|
-
function MetricData() {
|
|
2430
|
-
this.ver = 2;
|
|
2431
|
-
this.metrics = [];
|
|
2432
|
-
this.properties = {};
|
|
2433
|
-
this.measurements = {};
|
|
2434
|
-
}
|
|
2435
|
-
return MetricData;
|
|
2436
|
-
}());
|
|
2437
|
-
|
|
2438
|
-
var DataPointType;
|
|
2439
|
-
(function (DataPointType) {
|
|
2440
|
-
DataPointType[DataPointType["Measurement"] = 0] = "Measurement";
|
|
2441
|
-
DataPointType[DataPointType["Aggregation"] = 1] = "Aggregation";
|
|
2442
|
-
})(DataPointType || (DataPointType = {}));
|
|
2443
|
-
|
|
2444
|
-
var DataPoint$1 = /** @class */ (function () {
|
|
2445
|
-
function DataPoint() {
|
|
2446
|
-
this.kind = DataPointType.Measurement;
|
|
2447
|
-
}
|
|
2448
|
-
return DataPoint;
|
|
2449
3184
|
}());
|
|
2450
3185
|
|
|
2451
|
-
var DataPoint = /** @class */ (function (
|
|
2452
|
-
__extendsFn(DataPoint, _super);
|
|
3186
|
+
var DataPoint = /** @class */ (function () {
|
|
2453
3187
|
function DataPoint() {
|
|
2454
|
-
|
|
2455
|
-
_this.aiDataContract = {
|
|
3188
|
+
this.aiDataContract = {
|
|
2456
3189
|
name: 1 ,
|
|
2457
3190
|
kind: 0 ,
|
|
2458
3191
|
value: 1 ,
|
|
@@ -2461,20 +3194,20 @@
|
|
|
2461
3194
|
max: 0 ,
|
|
2462
3195
|
stdDev: 0
|
|
2463
3196
|
};
|
|
2464
|
-
|
|
3197
|
+
this.kind = 0 ;
|
|
2465
3198
|
}
|
|
2466
3199
|
return DataPoint;
|
|
2467
|
-
}(
|
|
3200
|
+
}());
|
|
2468
3201
|
|
|
2469
|
-
var Metric = /** @class */ (function (
|
|
2470
|
-
__extendsFn(Metric, _super);
|
|
3202
|
+
var Metric = /** @class */ (function () {
|
|
2471
3203
|
function Metric(logger, name, value, count, min, max, stdDev, properties, measurements) {
|
|
2472
|
-
|
|
2473
|
-
_this.aiDataContract = {
|
|
3204
|
+
this.aiDataContract = {
|
|
2474
3205
|
ver: 1 ,
|
|
2475
3206
|
metrics: 1 ,
|
|
2476
3207
|
properties: 0
|
|
2477
3208
|
};
|
|
3209
|
+
var _self = this;
|
|
3210
|
+
_self.ver = 2;
|
|
2478
3211
|
var dataPoint = new DataPoint();
|
|
2479
3212
|
dataPoint.count = count > 0 ? count : undefined;
|
|
2480
3213
|
dataPoint.max = isNaN(max) || max === null ? undefined : max;
|
|
@@ -2482,33 +3215,18 @@
|
|
|
2482
3215
|
dataPoint.name = dataSanitizeString(logger, name) || strNotSpecified;
|
|
2483
3216
|
dataPoint.value = value;
|
|
2484
3217
|
dataPoint.stdDev = isNaN(stdDev) || stdDev === null ? undefined : stdDev;
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
return _this;
|
|
3218
|
+
_self.metrics = [dataPoint];
|
|
3219
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
3220
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
2489
3221
|
}
|
|
2490
3222
|
Metric.envelopeType = "Microsoft.ApplicationInsights.{0}.Metric";
|
|
2491
3223
|
Metric.dataType = "MetricData";
|
|
2492
3224
|
return Metric;
|
|
2493
|
-
}(
|
|
2494
|
-
|
|
2495
|
-
var PageViewData = /** @class */ (function (_super) {
|
|
2496
|
-
__extendsFn(PageViewData, _super);
|
|
2497
|
-
function PageViewData() {
|
|
2498
|
-
var _this = _super.call(this) || this;
|
|
2499
|
-
_this.ver = 2;
|
|
2500
|
-
_this.properties = {};
|
|
2501
|
-
_this.measurements = {};
|
|
2502
|
-
return _this;
|
|
2503
|
-
}
|
|
2504
|
-
return PageViewData;
|
|
2505
|
-
}(EventData));
|
|
3225
|
+
}());
|
|
2506
3226
|
|
|
2507
|
-
var PageView = /** @class */ (function (
|
|
2508
|
-
__extendsFn(PageView, _super);
|
|
3227
|
+
var PageView = /** @class */ (function () {
|
|
2509
3228
|
function PageView(logger, name, url, durationMs, properties, measurements, id) {
|
|
2510
|
-
|
|
2511
|
-
_this.aiDataContract = {
|
|
3229
|
+
this.aiDataContract = {
|
|
2512
3230
|
ver: 1 ,
|
|
2513
3231
|
name: 0 ,
|
|
2514
3232
|
url: 0 ,
|
|
@@ -2517,37 +3235,26 @@
|
|
|
2517
3235
|
measurements: 0 ,
|
|
2518
3236
|
id: 0
|
|
2519
3237
|
};
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
3238
|
+
var _self = this;
|
|
3239
|
+
_self.ver = 2;
|
|
3240
|
+
_self.id = dataSanitizeId(logger, id);
|
|
3241
|
+
_self.url = dataSanitizeUrl(logger, url);
|
|
3242
|
+
_self.name = dataSanitizeString(logger, name) || strNotSpecified;
|
|
2523
3243
|
if (!isNaN(durationMs)) {
|
|
2524
|
-
|
|
3244
|
+
_self.duration = msToTimeSpan(durationMs);
|
|
2525
3245
|
}
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
return _this;
|
|
3246
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
3247
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
2529
3248
|
}
|
|
2530
3249
|
PageView.envelopeType = "Microsoft.ApplicationInsights.{0}.Pageview";
|
|
2531
3250
|
PageView.dataType = "PageviewData";
|
|
2532
3251
|
return PageView;
|
|
2533
|
-
}(PageViewData));
|
|
2534
|
-
|
|
2535
|
-
var RemoteDependencyData$1 = /** @class */ (function () {
|
|
2536
|
-
function RemoteDependencyData() {
|
|
2537
|
-
this.ver = 2;
|
|
2538
|
-
this.success = true;
|
|
2539
|
-
this.properties = {};
|
|
2540
|
-
this.measurements = {};
|
|
2541
|
-
}
|
|
2542
|
-
return RemoteDependencyData;
|
|
2543
3252
|
}());
|
|
2544
3253
|
|
|
2545
|
-
var RemoteDependencyData = /** @class */ (function (
|
|
2546
|
-
__extendsFn(RemoteDependencyData, _super);
|
|
3254
|
+
var RemoteDependencyData = /** @class */ (function () {
|
|
2547
3255
|
function RemoteDependencyData(logger, id, absoluteUrl, commandName, value, success, resultCode, method, requestAPI, correlationContext, properties, measurements) {
|
|
2548
3256
|
if (requestAPI === void 0) { requestAPI = "Ajax"; }
|
|
2549
|
-
|
|
2550
|
-
_this.aiDataContract = {
|
|
3257
|
+
this.aiDataContract = {
|
|
2551
3258
|
id: 1 ,
|
|
2552
3259
|
ver: 1 ,
|
|
2553
3260
|
name: 0 ,
|
|
@@ -2570,77 +3277,54 @@
|
|
|
2570
3277
|
commandName: 0 ,
|
|
2571
3278
|
dependencyTypeName: 0
|
|
2572
3279
|
};
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
3280
|
+
var _self = this;
|
|
3281
|
+
_self.ver = 2;
|
|
3282
|
+
_self.id = id;
|
|
3283
|
+
_self.duration = msToTimeSpan(value);
|
|
3284
|
+
_self.success = success;
|
|
3285
|
+
_self.resultCode = resultCode + "";
|
|
3286
|
+
_self.type = dataSanitizeString(logger, requestAPI);
|
|
2578
3287
|
var dependencyFields = AjaxHelperParseDependencyPath(logger, absoluteUrl, method, commandName);
|
|
2579
|
-
|
|
2580
|
-
|
|
3288
|
+
_self.data = dataSanitizeUrl(logger, commandName) || dependencyFields.data;
|
|
3289
|
+
_self.target = dataSanitizeString(logger, dependencyFields.target);
|
|
2581
3290
|
if (correlationContext) {
|
|
2582
|
-
|
|
3291
|
+
_self.target = "".concat(_self.target, " | ").concat(correlationContext);
|
|
2583
3292
|
}
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
return _this;
|
|
3293
|
+
_self.name = dataSanitizeString(logger, dependencyFields.name);
|
|
3294
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
3295
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
2588
3296
|
}
|
|
2589
3297
|
RemoteDependencyData.envelopeType = "Microsoft.ApplicationInsights.{0}.RemoteDependency";
|
|
2590
3298
|
RemoteDependencyData.dataType = "RemoteDependencyData";
|
|
2591
3299
|
return RemoteDependencyData;
|
|
2592
|
-
}(RemoteDependencyData$1));
|
|
2593
|
-
|
|
2594
|
-
var MessageData = /** @class */ (function () {
|
|
2595
|
-
function MessageData() {
|
|
2596
|
-
this.ver = 2;
|
|
2597
|
-
this.properties = {};
|
|
2598
|
-
this.measurements = {};
|
|
2599
|
-
}
|
|
2600
|
-
return MessageData;
|
|
2601
3300
|
}());
|
|
2602
3301
|
|
|
2603
|
-
var Trace = /** @class */ (function (
|
|
2604
|
-
__extendsFn(Trace, _super);
|
|
3302
|
+
var Trace = /** @class */ (function () {
|
|
2605
3303
|
function Trace(logger, message, severityLevel, properties, measurements) {
|
|
2606
|
-
|
|
2607
|
-
_this.aiDataContract = {
|
|
3304
|
+
this.aiDataContract = {
|
|
2608
3305
|
ver: 1 ,
|
|
2609
3306
|
message: 1 ,
|
|
2610
3307
|
severityLevel: 0 ,
|
|
2611
3308
|
properties: 0
|
|
2612
3309
|
};
|
|
3310
|
+
var _self = this;
|
|
3311
|
+
_self.ver = 2;
|
|
2613
3312
|
message = message || strNotSpecified;
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
3313
|
+
_self.message = dataSanitizeMessage(logger, message);
|
|
3314
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
3315
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
2617
3316
|
if (severityLevel) {
|
|
2618
|
-
|
|
3317
|
+
_self.severityLevel = severityLevel;
|
|
2619
3318
|
}
|
|
2620
|
-
return _this;
|
|
2621
3319
|
}
|
|
2622
3320
|
Trace.envelopeType = "Microsoft.ApplicationInsights.{0}.Message";
|
|
2623
3321
|
Trace.dataType = "MessageData";
|
|
2624
3322
|
return Trace;
|
|
2625
|
-
}(
|
|
2626
|
-
|
|
2627
|
-
var PageViewPerfData = /** @class */ (function (_super) {
|
|
2628
|
-
__extendsFn(PageViewPerfData, _super);
|
|
2629
|
-
function PageViewPerfData() {
|
|
2630
|
-
var _this = _super.call(this) || this;
|
|
2631
|
-
_this.ver = 2;
|
|
2632
|
-
_this.properties = {};
|
|
2633
|
-
_this.measurements = {};
|
|
2634
|
-
return _this;
|
|
2635
|
-
}
|
|
2636
|
-
return PageViewPerfData;
|
|
2637
|
-
}(PageViewData));
|
|
3323
|
+
}());
|
|
2638
3324
|
|
|
2639
|
-
var PageViewPerformance = /** @class */ (function (
|
|
2640
|
-
__extendsFn(PageViewPerformance, _super);
|
|
3325
|
+
var PageViewPerformance = /** @class */ (function () {
|
|
2641
3326
|
function PageViewPerformance(logger, name, url, unused, properties, measurements, cs4BaseData) {
|
|
2642
|
-
|
|
2643
|
-
_this.aiDataContract = {
|
|
3327
|
+
this.aiDataContract = {
|
|
2644
3328
|
ver: 1 ,
|
|
2645
3329
|
name: 0 ,
|
|
2646
3330
|
url: 0 ,
|
|
@@ -2653,24 +3337,25 @@
|
|
|
2653
3337
|
properties: 0 ,
|
|
2654
3338
|
measurements: 0
|
|
2655
3339
|
};
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
3340
|
+
var _self = this;
|
|
3341
|
+
_self.ver = 2;
|
|
3342
|
+
_self.url = dataSanitizeUrl(logger, url);
|
|
3343
|
+
_self.name = dataSanitizeString(logger, name) || strNotSpecified;
|
|
3344
|
+
_self.properties = dataSanitizeProperties(logger, properties);
|
|
3345
|
+
_self.measurements = dataSanitizeMeasurements(logger, measurements);
|
|
2660
3346
|
if (cs4BaseData) {
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
3347
|
+
_self.domProcessing = cs4BaseData.domProcessing;
|
|
3348
|
+
_self.duration = cs4BaseData.duration;
|
|
3349
|
+
_self.networkConnect = cs4BaseData.networkConnect;
|
|
3350
|
+
_self.perfTotal = cs4BaseData.perfTotal;
|
|
3351
|
+
_self.receivedResponse = cs4BaseData.receivedResponse;
|
|
3352
|
+
_self.sentRequest = cs4BaseData.sentRequest;
|
|
2667
3353
|
}
|
|
2668
|
-
return _this;
|
|
2669
3354
|
}
|
|
2670
3355
|
PageViewPerformance.envelopeType = "Microsoft.ApplicationInsights.{0}.PageviewPerformance";
|
|
2671
3356
|
PageViewPerformance.dataType = "PageviewPerformanceData";
|
|
2672
3357
|
return PageViewPerformance;
|
|
2673
|
-
}(
|
|
3358
|
+
}());
|
|
2674
3359
|
|
|
2675
3360
|
var SeverityLevel;
|
|
2676
3361
|
(function (SeverityLevel) {
|
|
@@ -2729,11 +3414,9 @@
|
|
|
2729
3414
|
if (core) {
|
|
2730
3415
|
_logger = core.logger;
|
|
2731
3416
|
}
|
|
2732
|
-
function _flushChannels() {
|
|
3417
|
+
function _flushChannels(isAsync) {
|
|
2733
3418
|
if (core) {
|
|
2734
|
-
|
|
2735
|
-
arrForEach(queues, function (q) { return q.flush(true); });
|
|
2736
|
-
});
|
|
3419
|
+
core.flush(isAsync);
|
|
2737
3420
|
}
|
|
2738
3421
|
}
|
|
2739
3422
|
function _addQueue(cb) {
|
|
@@ -2756,7 +3439,7 @@
|
|
|
2756
3439
|
intervalHandle = null;
|
|
2757
3440
|
}
|
|
2758
3441
|
if (doFlush) {
|
|
2759
|
-
_flushChannels();
|
|
3442
|
+
_flushChannels(true);
|
|
2760
3443
|
}
|
|
2761
3444
|
}), 100);
|
|
2762
3445
|
}
|
|
@@ -2774,8 +3457,8 @@
|
|
|
2774
3457
|
}
|
|
2775
3458
|
if (!pageViewPerformanceManager.isPerformanceTimingSupported()) {
|
|
2776
3459
|
appInsights.sendPageViewInternal(pageView, customProperties);
|
|
2777
|
-
_flushChannels();
|
|
2778
|
-
_logger
|
|
3460
|
+
_flushChannels(true);
|
|
3461
|
+
_throwInternal(_logger, 2 , 25 , "trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");
|
|
2779
3462
|
return;
|
|
2780
3463
|
}
|
|
2781
3464
|
var pageViewSent = false;
|
|
@@ -2800,7 +3483,7 @@
|
|
|
2800
3483
|
customProperties["duration"] = customDuration;
|
|
2801
3484
|
}
|
|
2802
3485
|
appInsights.sendPageViewInternal(pageView, customProperties);
|
|
2803
|
-
_flushChannels();
|
|
3486
|
+
_flushChannels(true);
|
|
2804
3487
|
pageViewSent = true;
|
|
2805
3488
|
}
|
|
2806
3489
|
var maxDurationLimit = 60000;
|
|
@@ -2841,11 +3524,22 @@
|
|
|
2841
3524
|
}
|
|
2842
3525
|
}
|
|
2843
3526
|
catch (e) {
|
|
2844
|
-
_logger
|
|
3527
|
+
_throwInternal(_logger, 1 , 38 , "trackPageView failed on page load calculation: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2845
3528
|
}
|
|
2846
3529
|
return processed;
|
|
2847
3530
|
});
|
|
2848
3531
|
};
|
|
3532
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
3533
|
+
if (intervalHandle) {
|
|
3534
|
+
clearInterval(intervalHandle);
|
|
3535
|
+
intervalHandle = null;
|
|
3536
|
+
var allItems = itemQueue.slice(0);
|
|
3537
|
+
itemQueue = [];
|
|
3538
|
+
arrForEach(allItems, function (item) {
|
|
3539
|
+
if (item()) ;
|
|
3540
|
+
});
|
|
3541
|
+
}
|
|
3542
|
+
};
|
|
2849
3543
|
});
|
|
2850
3544
|
}
|
|
2851
3545
|
return PageViewManager;
|
|
@@ -2865,7 +3559,7 @@
|
|
|
2865
3559
|
}
|
|
2866
3560
|
}
|
|
2867
3561
|
catch (e) {
|
|
2868
|
-
this._logger
|
|
3562
|
+
_warnToConsole(this._logger, "Auto track page visit time failed, metric will not be collected: " + dumpObj(e));
|
|
2869
3563
|
}
|
|
2870
3564
|
};
|
|
2871
3565
|
PageVisitTimeManager.prototype.restartPageVisitTimer = function (pageName, pageUrl) {
|
|
@@ -2875,7 +3569,7 @@
|
|
|
2875
3569
|
return prevPageVisitData;
|
|
2876
3570
|
}
|
|
2877
3571
|
catch (e) {
|
|
2878
|
-
this._logger
|
|
3572
|
+
_warnToConsole(this._logger, "Call to restart failed: " + dumpObj(e));
|
|
2879
3573
|
return null;
|
|
2880
3574
|
}
|
|
2881
3575
|
};
|
|
@@ -2891,7 +3585,7 @@
|
|
|
2891
3585
|
}
|
|
2892
3586
|
}
|
|
2893
3587
|
catch (e) {
|
|
2894
|
-
this._logger
|
|
3588
|
+
_warnToConsole(this._logger, "Call to start failed: " + dumpObj(e));
|
|
2895
3589
|
}
|
|
2896
3590
|
};
|
|
2897
3591
|
PageVisitTimeManager.prototype.stopPageVisitTimer = function () {
|
|
@@ -2912,7 +3606,7 @@
|
|
|
2912
3606
|
return null;
|
|
2913
3607
|
}
|
|
2914
3608
|
catch (e) {
|
|
2915
|
-
this._logger
|
|
3609
|
+
_warnToConsole(this._logger, "Stop page visit timer failed: " + dumpObj(e));
|
|
2916
3610
|
return null;
|
|
2917
3611
|
}
|
|
2918
3612
|
};
|
|
@@ -2958,14 +3652,15 @@
|
|
|
2958
3652
|
response = dateTimeUtilsDuration(timing.responseStart, timing.responseEnd);
|
|
2959
3653
|
dom = dateTimeUtilsDuration(timing.responseEnd, timing.loadEventEnd);
|
|
2960
3654
|
}
|
|
3655
|
+
var logger = this._logger;
|
|
2961
3656
|
if (total === 0) {
|
|
2962
|
-
|
|
3657
|
+
_throwInternal(logger, 2 , 10 , "error calculating page view performance.", { total: total, network: network, request: request, response: response, dom: dom });
|
|
2963
3658
|
}
|
|
2964
3659
|
else if (!this.shouldCollectDuration(total, network, request, response, dom)) {
|
|
2965
|
-
|
|
3660
|
+
_throwInternal(logger, 2 , 45 , "Invalid page load duration value. Browser perf data won't be sent.", { total: total, network: network, request: request, response: response, dom: dom });
|
|
2966
3661
|
}
|
|
2967
3662
|
else if (total < Math.floor(network) + Math.floor(request) + Math.floor(response) + Math.floor(dom)) {
|
|
2968
|
-
|
|
3663
|
+
_throwInternal(logger, 2 , 8 , "client performance math error.", { total: total, network: network, request: request, response: response, dom: dom });
|
|
2969
3664
|
}
|
|
2970
3665
|
else {
|
|
2971
3666
|
pageViewPerformance.durationMs = total;
|
|
@@ -3040,6 +3735,33 @@
|
|
|
3040
3735
|
return PageViewPerformanceManager;
|
|
3041
3736
|
}());
|
|
3042
3737
|
|
|
3738
|
+
var Timing = /** @class */ (function () {
|
|
3739
|
+
function Timing(logger, name) {
|
|
3740
|
+
var _self = this;
|
|
3741
|
+
var _events = {};
|
|
3742
|
+
_self.start = function (name) {
|
|
3743
|
+
if (typeof _events[name] !== "undefined") {
|
|
3744
|
+
_throwInternal(logger, 2 , 62 , "start was called more than once for this event without calling stop.", { name: name, key: name }, true);
|
|
3745
|
+
}
|
|
3746
|
+
_events[name] = +new Date;
|
|
3747
|
+
};
|
|
3748
|
+
_self.stop = function (name, url, properties, measurements) {
|
|
3749
|
+
var start = _events[name];
|
|
3750
|
+
if (isNaN(start)) {
|
|
3751
|
+
_throwInternal(logger, 2 , 63 , "stop was called without a corresponding start.", { name: name, key: name }, true);
|
|
3752
|
+
}
|
|
3753
|
+
else {
|
|
3754
|
+
var end = +new Date;
|
|
3755
|
+
var duration = dateTimeUtilsDuration(start, end);
|
|
3756
|
+
_self.action(name, url, duration, properties, measurements);
|
|
3757
|
+
}
|
|
3758
|
+
delete _events[name];
|
|
3759
|
+
_events[name] = undefined;
|
|
3760
|
+
};
|
|
3761
|
+
}
|
|
3762
|
+
return Timing;
|
|
3763
|
+
}());
|
|
3764
|
+
|
|
3043
3765
|
var durationProperty = "duration";
|
|
3044
3766
|
var strEvent = "event";
|
|
3045
3767
|
function _dispatchEvent(target, evnt) {
|
|
@@ -3057,47 +3779,78 @@
|
|
|
3057
3779
|
}
|
|
3058
3780
|
return error || "";
|
|
3059
3781
|
}
|
|
3060
|
-
var
|
|
3061
|
-
|
|
3062
|
-
|
|
3782
|
+
var MinMilliSeconds = 60000;
|
|
3783
|
+
function _configMilliseconds(value, defValue) {
|
|
3784
|
+
value = value || defValue;
|
|
3785
|
+
if (value < MinMilliSeconds) {
|
|
3786
|
+
value = MinMilliSeconds;
|
|
3787
|
+
}
|
|
3788
|
+
return value;
|
|
3789
|
+
}
|
|
3790
|
+
function _getDefaultConfig(config) {
|
|
3791
|
+
if (!config) {
|
|
3792
|
+
config = {};
|
|
3793
|
+
}
|
|
3794
|
+
config.sessionRenewalMs = _configMilliseconds(config.sessionRenewalMs, 30 * 60 * 1000);
|
|
3795
|
+
config.sessionExpirationMs = _configMilliseconds(config.sessionExpirationMs, 24 * 60 * 60 * 1000);
|
|
3796
|
+
config.disableExceptionTracking = stringToBoolOrDefault(config.disableExceptionTracking);
|
|
3797
|
+
config.autoTrackPageVisitTime = stringToBoolOrDefault(config.autoTrackPageVisitTime);
|
|
3798
|
+
config.overridePageViewDuration = stringToBoolOrDefault(config.overridePageViewDuration);
|
|
3799
|
+
config.enableUnhandledPromiseRejectionTracking = stringToBoolOrDefault(config.enableUnhandledPromiseRejectionTracking);
|
|
3800
|
+
if (isNaN(config.samplingPercentage) || config.samplingPercentage <= 0 || config.samplingPercentage >= 100) {
|
|
3801
|
+
config.samplingPercentage = 100;
|
|
3802
|
+
}
|
|
3803
|
+
config.isStorageUseDisabled = stringToBoolOrDefault(config.isStorageUseDisabled);
|
|
3804
|
+
config.isBrowserLinkTrackingEnabled = stringToBoolOrDefault(config.isBrowserLinkTrackingEnabled);
|
|
3805
|
+
config.enableAutoRouteTracking = stringToBoolOrDefault(config.enableAutoRouteTracking);
|
|
3806
|
+
config.namePrefix = config.namePrefix || "";
|
|
3807
|
+
config.enableDebug = stringToBoolOrDefault(config.enableDebug);
|
|
3808
|
+
config.disableFlushOnBeforeUnload = stringToBoolOrDefault(config.disableFlushOnBeforeUnload);
|
|
3809
|
+
config.disableFlushOnUnload = stringToBoolOrDefault(config.disableFlushOnUnload, config.disableFlushOnBeforeUnload);
|
|
3810
|
+
return config;
|
|
3811
|
+
}
|
|
3812
|
+
function _updateStorageUsage(extConfig) {
|
|
3813
|
+
if (!isUndefined(extConfig.isStorageUseDisabled)) {
|
|
3814
|
+
if (extConfig.isStorageUseDisabled) {
|
|
3815
|
+
utlDisableStorage();
|
|
3816
|
+
}
|
|
3817
|
+
else {
|
|
3818
|
+
utlEnableStorage();
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
}
|
|
3822
|
+
var AnalyticsPlugin = /** @class */ (function (_super) {
|
|
3823
|
+
__extendsFn(AnalyticsPlugin, _super);
|
|
3824
|
+
function AnalyticsPlugin() {
|
|
3063
3825
|
var _this = _super.call(this) || this;
|
|
3064
3826
|
_this.identifier = AnalyticsPluginIdentifier;
|
|
3065
3827
|
_this.priority = 180;
|
|
3066
3828
|
_this.autoRoutePVDelay = 500;
|
|
3067
3829
|
var _eventTracking;
|
|
3068
3830
|
var _pageTracking;
|
|
3069
|
-
var
|
|
3831
|
+
var _pageViewManager;
|
|
3832
|
+
var _pageViewPerformanceManager;
|
|
3833
|
+
var _pageVisitTimeManager;
|
|
3834
|
+
var _preInitTelemetryInitializers;
|
|
3835
|
+
var _isBrowserLinkTrackingEnabled;
|
|
3836
|
+
var _browserLinkInitializerAdded;
|
|
3837
|
+
var _enableAutoRouteTracking;
|
|
3838
|
+
var _historyListenerAdded;
|
|
3839
|
+
var _disableExceptionTracking;
|
|
3840
|
+
var _autoExceptionInstrumented;
|
|
3841
|
+
var _enableUnhandledPromiseRejectionTracking;
|
|
3842
|
+
var _autoUnhandledPromiseInstrumented;
|
|
3070
3843
|
var _prevUri;
|
|
3071
3844
|
var _currUri;
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3845
|
+
var _evtNamespace;
|
|
3846
|
+
dynamicProto(AnalyticsPlugin, _this, function (_self, _base) {
|
|
3847
|
+
var _addHook = _base._addHook;
|
|
3848
|
+
_initDefaults();
|
|
3075
3849
|
_self.getCookieMgr = function () {
|
|
3076
3850
|
return safeGetCookieMgr(_self.core);
|
|
3077
3851
|
};
|
|
3078
3852
|
_self.processTelemetry = function (env, itemCtx) {
|
|
3079
|
-
|
|
3080
|
-
var doNotSendItem = false;
|
|
3081
|
-
var telemetryInitializersCount = _self._telemetryInitializers.length;
|
|
3082
|
-
itemCtx = _self._getTelCtx(itemCtx);
|
|
3083
|
-
for (var i = 0; i < telemetryInitializersCount; ++i) {
|
|
3084
|
-
var telemetryInitializer = _self._telemetryInitializers[i];
|
|
3085
|
-
if (telemetryInitializer) {
|
|
3086
|
-
try {
|
|
3087
|
-
if (telemetryInitializer.apply(null, [env]) === false) {
|
|
3088
|
-
doNotSendItem = true;
|
|
3089
|
-
break;
|
|
3090
|
-
}
|
|
3091
|
-
}
|
|
3092
|
-
catch (e) {
|
|
3093
|
-
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
|
|
3094
|
-
}
|
|
3095
|
-
}
|
|
3096
|
-
}
|
|
3097
|
-
if (!doNotSendItem) {
|
|
3098
|
-
_self.processNext(env, itemCtx);
|
|
3099
|
-
}
|
|
3100
|
-
}, function () { return ({ item: env }); }, !(env.sync));
|
|
3853
|
+
_self.processNext(env, itemCtx);
|
|
3101
3854
|
};
|
|
3102
3855
|
_self.trackEvent = function (event, customProperties) {
|
|
3103
3856
|
try {
|
|
@@ -3105,7 +3858,7 @@
|
|
|
3105
3858
|
_self.core.track(telemetryItem);
|
|
3106
3859
|
}
|
|
3107
3860
|
catch (e) {
|
|
3108
|
-
|
|
3861
|
+
_throwInternal(2 , 39 , "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3109
3862
|
}
|
|
3110
3863
|
};
|
|
3111
3864
|
_self.startTrackEvent = function (name) {
|
|
@@ -3113,7 +3866,7 @@
|
|
|
3113
3866
|
_eventTracking.start(name);
|
|
3114
3867
|
}
|
|
3115
3868
|
catch (e) {
|
|
3116
|
-
|
|
3869
|
+
_throwInternal(1 , 29 , "startTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3117
3870
|
}
|
|
3118
3871
|
};
|
|
3119
3872
|
_self.stopTrackEvent = function (name, properties, measurements) {
|
|
@@ -3121,7 +3874,7 @@
|
|
|
3121
3874
|
_eventTracking.stop(name, undefined, properties);
|
|
3122
3875
|
}
|
|
3123
3876
|
catch (e) {
|
|
3124
|
-
|
|
3877
|
+
_throwInternal(1 , 30 , "stopTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3125
3878
|
}
|
|
3126
3879
|
};
|
|
3127
3880
|
_self.trackTrace = function (trace, customProperties) {
|
|
@@ -3130,7 +3883,7 @@
|
|
|
3130
3883
|
_self.core.track(telemetryItem);
|
|
3131
3884
|
}
|
|
3132
3885
|
catch (e) {
|
|
3133
|
-
|
|
3886
|
+
_throwInternal(2 , 39 , "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3134
3887
|
}
|
|
3135
3888
|
};
|
|
3136
3889
|
_self.trackMetric = function (metric, customProperties) {
|
|
@@ -3139,19 +3892,19 @@
|
|
|
3139
3892
|
_self.core.track(telemetryItem);
|
|
3140
3893
|
}
|
|
3141
3894
|
catch (e) {
|
|
3142
|
-
|
|
3895
|
+
_throwInternal(1 , 36 , "trackMetric failed, metric will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3143
3896
|
}
|
|
3144
3897
|
};
|
|
3145
3898
|
_self.trackPageView = function (pageView, customProperties) {
|
|
3146
3899
|
try {
|
|
3147
3900
|
var inPv = pageView || {};
|
|
3148
|
-
|
|
3901
|
+
_pageViewManager.trackPageView(inPv, __assignFn(__assignFn(__assignFn({}, inPv.properties), inPv.measurements), customProperties));
|
|
3149
3902
|
if (_self.config.autoTrackPageVisitTime) {
|
|
3150
|
-
|
|
3903
|
+
_pageVisitTimeManager.trackPreviousPageVisit(inPv.name, inPv.uri);
|
|
3151
3904
|
}
|
|
3152
3905
|
}
|
|
3153
3906
|
catch (e) {
|
|
3154
|
-
|
|
3907
|
+
_throwInternal(1 , 37 , "trackPageView failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3155
3908
|
}
|
|
3156
3909
|
};
|
|
3157
3910
|
_self.sendPageViewInternal = function (pageView, properties, systemProperties) {
|
|
@@ -3167,12 +3920,13 @@
|
|
|
3167
3920
|
_self.core.track(telemetryItem);
|
|
3168
3921
|
};
|
|
3169
3922
|
_self.trackPageViewPerformance = function (pageViewPerformance, customProperties) {
|
|
3923
|
+
var inPvp = pageViewPerformance || {};
|
|
3170
3924
|
try {
|
|
3171
|
-
|
|
3172
|
-
_self.sendPageViewPerformanceInternal(
|
|
3925
|
+
_pageViewPerformanceManager.populatePageViewPerformanceEvent(inPvp);
|
|
3926
|
+
_self.sendPageViewPerformanceInternal(inPvp, customProperties);
|
|
3173
3927
|
}
|
|
3174
3928
|
catch (e) {
|
|
3175
|
-
|
|
3929
|
+
_throwInternal(1 , 37 , "trackPageViewPerformance failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3176
3930
|
}
|
|
3177
3931
|
};
|
|
3178
3932
|
_self.startTrackPage = function (name) {
|
|
@@ -3184,7 +3938,7 @@
|
|
|
3184
3938
|
_pageTracking.start(name);
|
|
3185
3939
|
}
|
|
3186
3940
|
catch (e) {
|
|
3187
|
-
|
|
3941
|
+
_throwInternal(1 , 31 , "startTrackPage failed, page view may not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3188
3942
|
}
|
|
3189
3943
|
};
|
|
3190
3944
|
_self.stopTrackPage = function (name, url, properties, measurement) {
|
|
@@ -3199,11 +3953,11 @@
|
|
|
3199
3953
|
}
|
|
3200
3954
|
_pageTracking.stop(name, url, properties, measurement);
|
|
3201
3955
|
if (_self.config.autoTrackPageVisitTime) {
|
|
3202
|
-
|
|
3956
|
+
_pageVisitTimeManager.trackPreviousPageVisit(name, url);
|
|
3203
3957
|
}
|
|
3204
3958
|
}
|
|
3205
3959
|
catch (e) {
|
|
3206
|
-
|
|
3960
|
+
_throwInternal(1 , 32 , "stopTrackPage failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3207
3961
|
}
|
|
3208
3962
|
};
|
|
3209
3963
|
_self.sendExceptionInternal = function (exception, customProperties, systemProperties) {
|
|
@@ -3213,11 +3967,14 @@
|
|
|
3213
3967
|
_self.core.track(telemetryItem);
|
|
3214
3968
|
};
|
|
3215
3969
|
_self.trackException = function (exception, customProperties) {
|
|
3970
|
+
if (exception && !exception.exception && exception.error) {
|
|
3971
|
+
exception.exception = exception.error;
|
|
3972
|
+
}
|
|
3216
3973
|
try {
|
|
3217
3974
|
_self.sendExceptionInternal(exception, customProperties);
|
|
3218
3975
|
}
|
|
3219
3976
|
catch (e) {
|
|
3220
|
-
|
|
3977
|
+
_throwInternal(1 , 35 , "trackException failed, exception will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
3221
3978
|
}
|
|
3222
3979
|
};
|
|
3223
3980
|
_self._onerror = function (exception) {
|
|
@@ -3251,158 +4008,98 @@
|
|
|
3251
4008
|
}
|
|
3252
4009
|
catch (e) {
|
|
3253
4010
|
var errorString = error ? (error.name + ", " + error.message) : "null";
|
|
3254
|
-
|
|
4011
|
+
_throwInternal(1 , 11 , "_onError threw exception while logging error, error will not be collected: "
|
|
3255
4012
|
+ getExceptionName(e), { exception: dumpObj(e), errorString: errorString });
|
|
3256
4013
|
}
|
|
3257
4014
|
};
|
|
3258
4015
|
_self.addTelemetryInitializer = function (telemetryInitializer) {
|
|
3259
|
-
_self.
|
|
4016
|
+
if (_self.core) {
|
|
4017
|
+
return _self.core.addTelemetryInitializer(telemetryInitializer);
|
|
4018
|
+
}
|
|
4019
|
+
if (!_preInitTelemetryInitializers) {
|
|
4020
|
+
_preInitTelemetryInitializers = [];
|
|
4021
|
+
}
|
|
4022
|
+
_preInitTelemetryInitializers.push(telemetryInitializer);
|
|
3260
4023
|
};
|
|
3261
4024
|
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
3262
4025
|
if (_self.isInitialized()) {
|
|
3263
4026
|
return;
|
|
3264
4027
|
}
|
|
3265
4028
|
if (isNullOrUndefined(core)) {
|
|
3266
|
-
|
|
4029
|
+
throwError("Error initializing");
|
|
3267
4030
|
}
|
|
3268
4031
|
_base.initialize(config, core, extensions, pluginChain);
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
_self._pageViewPerformanceManager = new PageViewPerformanceManager(_self.core);
|
|
3296
|
-
_self._pageViewManager = new PageViewManager(_this, _self.config.overridePageViewDuration, _self.core, _self._pageViewPerformanceManager);
|
|
3297
|
-
_self._pageVisitTimeManager = new PageVisitTimeManager(_self.diagLog(), function (pageName, pageUrl, pageVisitTime) { return trackPageVisitTime(pageName, pageUrl, pageVisitTime); });
|
|
3298
|
-
_self._telemetryInitializers = _self._telemetryInitializers || [];
|
|
3299
|
-
_addDefaultTelemetryInitializers(configGetters);
|
|
3300
|
-
_eventTracking = new Timing(_self.diagLog(), "trackEvent");
|
|
3301
|
-
_eventTracking.action =
|
|
3302
|
-
function (name, url, duration, properties) {
|
|
3303
|
-
if (!properties) {
|
|
4032
|
+
try {
|
|
4033
|
+
_evtNamespace = mergeEvtNamespace(createUniqueNamespace(_self.identifier), core.evtNamespace && core.evtNamespace());
|
|
4034
|
+
if (_preInitTelemetryInitializers) {
|
|
4035
|
+
arrForEach(_preInitTelemetryInitializers, function (initializer) {
|
|
4036
|
+
core.addTelemetryInitializer(initializer);
|
|
4037
|
+
});
|
|
4038
|
+
_preInitTelemetryInitializers = null;
|
|
4039
|
+
}
|
|
4040
|
+
var extConfig = _populateDefaults(config);
|
|
4041
|
+
_updateStorageUsage(extConfig);
|
|
4042
|
+
_pageViewPerformanceManager = new PageViewPerformanceManager(_self.core);
|
|
4043
|
+
_pageViewManager = new PageViewManager(_this, extConfig.overridePageViewDuration, _self.core, _pageViewPerformanceManager);
|
|
4044
|
+
_pageVisitTimeManager = new PageVisitTimeManager(_self.diagLog(), function (pageName, pageUrl, pageVisitTime) { return trackPageVisitTime(pageName, pageUrl, pageVisitTime); });
|
|
4045
|
+
_updateBrowserLinkTracking(extConfig, config);
|
|
4046
|
+
_eventTracking = new Timing(_self.diagLog(), "trackEvent");
|
|
4047
|
+
_eventTracking.action =
|
|
4048
|
+
function (name, url, duration, properties) {
|
|
4049
|
+
if (!properties) {
|
|
4050
|
+
properties = {};
|
|
4051
|
+
}
|
|
4052
|
+
properties[durationProperty] = duration.toString();
|
|
4053
|
+
_self.trackEvent({ name: name, properties: properties });
|
|
4054
|
+
};
|
|
4055
|
+
_pageTracking = new Timing(_self.diagLog(), "trackPageView");
|
|
4056
|
+
_pageTracking.action = function (name, url, duration, properties, measurements) {
|
|
4057
|
+
if (isNullOrUndefined(properties)) {
|
|
3304
4058
|
properties = {};
|
|
3305
4059
|
}
|
|
3306
4060
|
properties[durationProperty] = duration.toString();
|
|
3307
|
-
|
|
4061
|
+
var pageViewItem = {
|
|
4062
|
+
name: name,
|
|
4063
|
+
uri: url,
|
|
4064
|
+
properties: properties,
|
|
4065
|
+
measurements: measurements
|
|
4066
|
+
};
|
|
4067
|
+
_self.sendPageViewInternal(pageViewItem, properties);
|
|
3308
4068
|
};
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
properties = {};
|
|
4069
|
+
if (hasWindow()) {
|
|
4070
|
+
_updateExceptionTracking(extConfig);
|
|
4071
|
+
_updateLocationChange(extConfig);
|
|
3313
4072
|
}
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
var
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
instance._onerror(Exception.CreateAutoException(message, url, lineNumber, columnNumber, error, evt));
|
|
3336
|
-
}
|
|
3337
|
-
return handled;
|
|
3338
|
-
};
|
|
3339
|
-
_self.config.autoExceptionInstrumented = true;
|
|
3340
|
-
}
|
|
3341
|
-
if (_self.config.disableExceptionTracking === false &&
|
|
3342
|
-
_self.config.enableUnhandledPromiseRejectionTracking === true &&
|
|
3343
|
-
!_self.config.autoUnhandledPromiseInstrumented && _window) {
|
|
3344
|
-
var onunhandledrejection_1 = "onunhandledrejection";
|
|
3345
|
-
var originalOnUnhandledRejection_1 = _window[onunhandledrejection_1];
|
|
3346
|
-
_window[onunhandledrejection_1] = function (error) {
|
|
3347
|
-
var evt = _window[strEvent];
|
|
3348
|
-
var handled = originalOnUnhandledRejection_1 && originalOnUnhandledRejection_1.call(_window, error);
|
|
3349
|
-
if (handled !== true) {
|
|
3350
|
-
instance._onerror(Exception.CreateAutoException(_getReason(error), _location ? _location.href : "", 0, 0, error, evt));
|
|
3351
|
-
}
|
|
3352
|
-
return handled;
|
|
3353
|
-
};
|
|
3354
|
-
_self.config.autoUnhandledPromiseInstrumented = true;
|
|
3355
|
-
}
|
|
3356
|
-
if (_self.config.enableAutoRouteTracking === true
|
|
3357
|
-
&& _history && isFunction(_history.pushState) && isFunction(_history.replaceState)
|
|
3358
|
-
&& _window
|
|
3359
|
-
&& typeof Event !== "undefined") {
|
|
3360
|
-
var _self_1 = _this;
|
|
3361
|
-
arrForEach(extensions, function (extension) {
|
|
3362
|
-
if (extension.identifier === PropertiesPluginIdentifier) {
|
|
3363
|
-
_properties = extension;
|
|
4073
|
+
}
|
|
4074
|
+
catch (e) {
|
|
4075
|
+
_self.setInitialized(false);
|
|
4076
|
+
throw e;
|
|
4077
|
+
}
|
|
4078
|
+
};
|
|
4079
|
+
_self._doTeardown = function (unloadCtx, unloadState) {
|
|
4080
|
+
_pageViewManager && _pageViewManager.teardown(unloadCtx, unloadState);
|
|
4081
|
+
eventOff(window, null, null, _evtNamespace);
|
|
4082
|
+
_initDefaults();
|
|
4083
|
+
};
|
|
4084
|
+
function _populateDefaults(config) {
|
|
4085
|
+
var ctx = createProcessTelemetryContext(null, config, _self.core);
|
|
4086
|
+
var identifier = _self.identifier;
|
|
4087
|
+
var defaults = _getDefaultConfig(config);
|
|
4088
|
+
var extConfig = _self.config = ctx.getExtCfg(identifier);
|
|
4089
|
+
if (defaults !== undefined) {
|
|
4090
|
+
objForEachKey(defaults, function (field, value) {
|
|
4091
|
+
extConfig[field] = ctx.getConfig(identifier, field, value);
|
|
4092
|
+
if (extConfig[field] === undefined) {
|
|
4093
|
+
extConfig = value;
|
|
3364
4094
|
}
|
|
3365
4095
|
});
|
|
3366
|
-
_history.pushState = (function (f) { return function pushState() {
|
|
3367
|
-
var ret = f.apply(this, arguments);
|
|
3368
|
-
_dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "pushState"));
|
|
3369
|
-
_dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "locationchange"));
|
|
3370
|
-
return ret;
|
|
3371
|
-
}; })(_history.pushState);
|
|
3372
|
-
_history.replaceState = (function (f) { return function replaceState() {
|
|
3373
|
-
var ret = f.apply(this, arguments);
|
|
3374
|
-
_dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "replaceState"));
|
|
3375
|
-
_dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "locationchange"));
|
|
3376
|
-
return ret;
|
|
3377
|
-
}; })(_history.replaceState);
|
|
3378
|
-
if (_window.addEventListener) {
|
|
3379
|
-
_window.addEventListener(_self_1.config.namePrefix + "popstate", function () {
|
|
3380
|
-
_dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "locationchange"));
|
|
3381
|
-
});
|
|
3382
|
-
_window.addEventListener(_self_1.config.namePrefix + "locationchange", function () {
|
|
3383
|
-
if (_properties && _properties.context && _properties.context.telemetryTrace) {
|
|
3384
|
-
_properties.context.telemetryTrace.traceID = generateW3CId();
|
|
3385
|
-
var traceLocationName = "_unknown_";
|
|
3386
|
-
if (_location && _location.pathname) {
|
|
3387
|
-
traceLocationName = _location.pathname + (_location.hash || "");
|
|
3388
|
-
}
|
|
3389
|
-
_properties.context.telemetryTrace.name = dataSanitizeString(_self_1.diagLog(), traceLocationName);
|
|
3390
|
-
}
|
|
3391
|
-
if (_currUri) {
|
|
3392
|
-
_prevUri = _currUri;
|
|
3393
|
-
_currUri = _location && _location.href || "";
|
|
3394
|
-
}
|
|
3395
|
-
else {
|
|
3396
|
-
_currUri = _location && _location.href || "";
|
|
3397
|
-
}
|
|
3398
|
-
setTimeout((function (uri) {
|
|
3399
|
-
_self_1.trackPageView({ refUri: uri, properties: { duration: 0 } });
|
|
3400
|
-
}).bind(_this, _prevUri), _self_1.autoRoutePVDelay);
|
|
3401
|
-
});
|
|
3402
|
-
}
|
|
3403
4096
|
}
|
|
3404
|
-
|
|
3405
|
-
}
|
|
4097
|
+
return extConfig;
|
|
4098
|
+
}
|
|
4099
|
+
function _updateBrowserLinkTracking(extConfig, config) {
|
|
4100
|
+
_isBrowserLinkTrackingEnabled = extConfig.isBrowserLinkTrackingEnabled || config.isBrowserLinkTrackingEnabled;
|
|
4101
|
+
_addDefaultTelemetryInitializers();
|
|
4102
|
+
}
|
|
3406
4103
|
function trackPageVisitTime(pageName, pageUrl, pageVisitTime) {
|
|
3407
4104
|
var properties = { PageName: pageName, PageUrl: pageUrl };
|
|
3408
4105
|
_self.trackMetric({
|
|
@@ -3413,11 +4110,11 @@
|
|
|
3413
4110
|
sampleCount: 1
|
|
3414
4111
|
}, properties);
|
|
3415
4112
|
}
|
|
3416
|
-
function _addDefaultTelemetryInitializers(
|
|
3417
|
-
if (!
|
|
4113
|
+
function _addDefaultTelemetryInitializers() {
|
|
4114
|
+
if (!_browserLinkInitializerAdded && _isBrowserLinkTrackingEnabled) {
|
|
3418
4115
|
var browserLinkPaths_1 = ["/browserLinkSignalR/", "/__browserLink/"];
|
|
3419
4116
|
var dropBrowserLinkRequests = function (envelope) {
|
|
3420
|
-
if (envelope.baseType === RemoteDependencyData.dataType) {
|
|
4117
|
+
if (_isBrowserLinkTrackingEnabled && envelope.baseType === RemoteDependencyData.dataType) {
|
|
3421
4118
|
var remoteData = envelope.baseData;
|
|
3422
4119
|
if (remoteData) {
|
|
3423
4120
|
for (var i = 0; i < browserLinkPaths_1.length; i++) {
|
|
@@ -3429,72 +4126,150 @@
|
|
|
3429
4126
|
}
|
|
3430
4127
|
return true;
|
|
3431
4128
|
};
|
|
3432
|
-
|
|
4129
|
+
_self.addTelemetryInitializer(dropBrowserLinkRequests);
|
|
4130
|
+
_browserLinkInitializerAdded = true;
|
|
3433
4131
|
}
|
|
3434
4132
|
}
|
|
3435
|
-
function _addTelemetryInitializer(telemetryInitializer) {
|
|
3436
|
-
_self._telemetryInitializers.push(telemetryInitializer);
|
|
3437
|
-
}
|
|
3438
4133
|
function _sendCORSException(exception, properties) {
|
|
3439
4134
|
var telemetryItem = TelemetryItemCreator.create(exception, Exception.dataType, Exception.envelopeType, _self.diagLog(), properties);
|
|
3440
4135
|
_self.core.track(telemetryItem);
|
|
3441
4136
|
}
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
config.isStorageUseDisabled = stringToBoolOrDefault(config.isStorageUseDisabled);
|
|
3459
|
-
config.isBrowserLinkTrackingEnabled = stringToBoolOrDefault(config.isBrowserLinkTrackingEnabled);
|
|
3460
|
-
config.enableAutoRouteTracking = stringToBoolOrDefault(config.enableAutoRouteTracking);
|
|
3461
|
-
config.namePrefix = config.namePrefix || "";
|
|
3462
|
-
config.enableDebug = stringToBoolOrDefault(config.enableDebug);
|
|
3463
|
-
config.disableFlushOnBeforeUnload = stringToBoolOrDefault(config.disableFlushOnBeforeUnload);
|
|
3464
|
-
config.disableFlushOnUnload = stringToBoolOrDefault(config.disableFlushOnUnload, config.disableFlushOnBeforeUnload);
|
|
3465
|
-
return config;
|
|
3466
|
-
};
|
|
3467
|
-
ApplicationInsights.Version = "2.8.0-nightly.2202-06";
|
|
3468
|
-
return ApplicationInsights;
|
|
3469
|
-
}(BaseTelemetryPlugin));
|
|
3470
|
-
var Timing = /** @class */ (function () {
|
|
3471
|
-
function Timing(logger, name) {
|
|
3472
|
-
var _self = this;
|
|
3473
|
-
var _events = {};
|
|
3474
|
-
_self.start = function (name) {
|
|
3475
|
-
if (typeof _events[name] !== "undefined") {
|
|
3476
|
-
logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.", { name: name, key: name }, true);
|
|
4137
|
+
function _updateExceptionTracking(extConfig) {
|
|
4138
|
+
var _window = getWindow();
|
|
4139
|
+
var locn = getLocation(true);
|
|
4140
|
+
_disableExceptionTracking = extConfig.disableExceptionTracking;
|
|
4141
|
+
if (!_disableExceptionTracking && !_autoExceptionInstrumented && !extConfig.autoExceptionInstrumented) {
|
|
4142
|
+
_addHook(InstrumentFunc(_window, "onerror", {
|
|
4143
|
+
ns: _evtNamespace,
|
|
4144
|
+
rsp: function (callDetails, message, url, lineNumber, columnNumber, error) {
|
|
4145
|
+
if (!_disableExceptionTracking && callDetails.rslt !== true) {
|
|
4146
|
+
_self._onerror(Exception.CreateAutoException(message, url, lineNumber, columnNumber, error, callDetails.evt));
|
|
4147
|
+
}
|
|
4148
|
+
}
|
|
4149
|
+
}));
|
|
4150
|
+
_autoExceptionInstrumented = true;
|
|
4151
|
+
}
|
|
4152
|
+
_addUnhandledPromiseRejectionTracking(extConfig, _window, locn);
|
|
3477
4153
|
}
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
4154
|
+
function _updateLocationChange(extConfig) {
|
|
4155
|
+
var win = getWindow();
|
|
4156
|
+
var locn = getLocation(true);
|
|
4157
|
+
_enableAutoRouteTracking = extConfig.enableAutoRouteTracking === true;
|
|
4158
|
+
if (win && _enableAutoRouteTracking && hasHistory()) {
|
|
4159
|
+
var _history = getHistory();
|
|
4160
|
+
if (isFunction(_history.pushState) && isFunction(_history.replaceState) && typeof Event !== strShimUndefined) {
|
|
4161
|
+
_addHistoryListener(extConfig, win, _history, locn);
|
|
4162
|
+
}
|
|
4163
|
+
}
|
|
3484
4164
|
}
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
4165
|
+
function _addHistoryListener(extConfig, win, history, locn) {
|
|
4166
|
+
function _popstateHandler() {
|
|
4167
|
+
if (_enableAutoRouteTracking) {
|
|
4168
|
+
_dispatchEvent(win, createDomEvent(extConfig.namePrefix + "locationchange"));
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
4171
|
+
function _locationChangeHandler() {
|
|
4172
|
+
if (_currUri) {
|
|
4173
|
+
_prevUri = _currUri;
|
|
4174
|
+
_currUri = locn && locn.href || "";
|
|
4175
|
+
}
|
|
4176
|
+
else {
|
|
4177
|
+
_currUri = locn && locn.href || "";
|
|
4178
|
+
}
|
|
4179
|
+
if (_enableAutoRouteTracking) {
|
|
4180
|
+
var properties = _self.core.getPlugin(PropertiesPluginIdentifier);
|
|
4181
|
+
if (properties) {
|
|
4182
|
+
var context = properties.plugin.context;
|
|
4183
|
+
if (context && context.telemetryTrace) {
|
|
4184
|
+
context.telemetryTrace.traceID = generateW3CId();
|
|
4185
|
+
var traceLocationName = "_unknown_";
|
|
4186
|
+
if (locn && locn.pathname) {
|
|
4187
|
+
traceLocationName = locn.pathname + (locn.hash || "");
|
|
4188
|
+
}
|
|
4189
|
+
context.telemetryTrace.name = dataSanitizeString(_self.diagLog(), traceLocationName);
|
|
4190
|
+
}
|
|
4191
|
+
}
|
|
4192
|
+
setTimeout((function (uri) {
|
|
4193
|
+
_self.trackPageView({ refUri: uri, properties: { duration: 0 } });
|
|
4194
|
+
}).bind(this, _prevUri), _self.autoRoutePVDelay);
|
|
4195
|
+
}
|
|
4196
|
+
}
|
|
4197
|
+
if (!_historyListenerAdded) {
|
|
4198
|
+
_addHook(InstrumentFunc(history, "pushState", {
|
|
4199
|
+
ns: _evtNamespace,
|
|
4200
|
+
rsp: function () {
|
|
4201
|
+
if (_enableAutoRouteTracking) {
|
|
4202
|
+
_dispatchEvent(win, createDomEvent(extConfig.namePrefix + "pushState"));
|
|
4203
|
+
_dispatchEvent(win, createDomEvent(extConfig.namePrefix + "locationchange"));
|
|
4204
|
+
}
|
|
4205
|
+
}
|
|
4206
|
+
}));
|
|
4207
|
+
_addHook(InstrumentFunc(history, "replaceState", {
|
|
4208
|
+
ns: _evtNamespace,
|
|
4209
|
+
rsp: function () {
|
|
4210
|
+
if (_enableAutoRouteTracking) {
|
|
4211
|
+
_dispatchEvent(win, createDomEvent(extConfig.namePrefix + "replaceState"));
|
|
4212
|
+
_dispatchEvent(win, createDomEvent(extConfig.namePrefix + "locationchange"));
|
|
4213
|
+
}
|
|
4214
|
+
}
|
|
4215
|
+
}));
|
|
4216
|
+
eventOn(win, extConfig.namePrefix + "popstate", _popstateHandler, _evtNamespace);
|
|
4217
|
+
eventOn(win, extConfig.namePrefix + "locationchange", _locationChangeHandler, _evtNamespace);
|
|
4218
|
+
_historyListenerAdded = true;
|
|
4219
|
+
}
|
|
3489
4220
|
}
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
4221
|
+
function _addUnhandledPromiseRejectionTracking(extConfig, _window, _location) {
|
|
4222
|
+
_enableUnhandledPromiseRejectionTracking = extConfig.enableUnhandledPromiseRejectionTracking === true;
|
|
4223
|
+
if (_enableUnhandledPromiseRejectionTracking && !_autoUnhandledPromiseInstrumented) {
|
|
4224
|
+
_addHook(InstrumentFunc(_window, "onunhandledrejection", {
|
|
4225
|
+
ns: _evtNamespace,
|
|
4226
|
+
rsp: function (callDetails, error) {
|
|
4227
|
+
if (_enableUnhandledPromiseRejectionTracking && callDetails.rslt !== true) {
|
|
4228
|
+
_self._onerror(Exception.CreateAutoException(_getReason(error), _location ? _location.href : "", 0, 0, error, callDetails.evt));
|
|
4229
|
+
}
|
|
4230
|
+
}
|
|
4231
|
+
}));
|
|
4232
|
+
_autoUnhandledPromiseInstrumented = true;
|
|
4233
|
+
extConfig.autoUnhandledPromiseInstrumented = _autoUnhandledPromiseInstrumented;
|
|
4234
|
+
}
|
|
4235
|
+
}
|
|
4236
|
+
function _throwInternal(severity, msgId, msg, properties, isUserAct) {
|
|
4237
|
+
_self.diagLog().throwInternal(severity, msgId, msg, properties, isUserAct);
|
|
4238
|
+
}
|
|
4239
|
+
function _initDefaults() {
|
|
4240
|
+
_eventTracking = null;
|
|
4241
|
+
_pageTracking = null;
|
|
4242
|
+
_pageViewManager = null;
|
|
4243
|
+
_pageViewPerformanceManager = null;
|
|
4244
|
+
_pageVisitTimeManager = null;
|
|
4245
|
+
_preInitTelemetryInitializers = null;
|
|
4246
|
+
_isBrowserLinkTrackingEnabled = false;
|
|
4247
|
+
_browserLinkInitializerAdded = false;
|
|
4248
|
+
_enableAutoRouteTracking = false;
|
|
4249
|
+
_historyListenerAdded = false;
|
|
4250
|
+
_disableExceptionTracking = false;
|
|
4251
|
+
_autoExceptionInstrumented = false;
|
|
4252
|
+
_enableUnhandledPromiseRejectionTracking = false;
|
|
4253
|
+
_autoUnhandledPromiseInstrumented = false;
|
|
4254
|
+
var location = getLocation(true);
|
|
4255
|
+
_prevUri = location && location.href || "";
|
|
4256
|
+
_currUri = null;
|
|
4257
|
+
_evtNamespace = null;
|
|
4258
|
+
}
|
|
4259
|
+
objDefineAccessors(_self, "_pageViewManager", function () { return _pageViewManager; });
|
|
4260
|
+
objDefineAccessors(_self, "_pageViewPerformanceManager", function () { return _pageViewPerformanceManager; });
|
|
4261
|
+
objDefineAccessors(_self, "_pageVisitTimeManager", function () { return _pageVisitTimeManager; });
|
|
4262
|
+
objDefineAccessors(_self, "_evtNamespace", function () { return "." + _evtNamespace; });
|
|
4263
|
+
});
|
|
4264
|
+
return _this;
|
|
3493
4265
|
}
|
|
3494
|
-
|
|
3495
|
-
|
|
4266
|
+
AnalyticsPlugin.Version = "2.8.0-nightly.2204-06";
|
|
4267
|
+
AnalyticsPlugin.getDefaultConfig = _getDefaultConfig;
|
|
4268
|
+
return AnalyticsPlugin;
|
|
4269
|
+
}(BaseTelemetryPlugin));
|
|
3496
4270
|
|
|
3497
|
-
exports.
|
|
4271
|
+
exports.AnalyticsPlugin = AnalyticsPlugin;
|
|
4272
|
+
exports.ApplicationInsights = AnalyticsPlugin;
|
|
3498
4273
|
|
|
3499
4274
|
(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 });
|
|
3500
4275
|
|