@microsoft/1ds-core-js 3.1.11 → 3.2.0
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/README.md +1 -1
- package/bundle/{ms.core-3.1.11.gbl.js → ms.core-3.2.0.gbl.js} +2613 -1373
- package/bundle/ms.core-3.2.0.gbl.js.map +1 -0
- package/bundle/ms.core-3.2.0.gbl.min.js +7 -0
- package/bundle/ms.core-3.2.0.gbl.min.js.map +1 -0
- package/bundle/ms.core-3.2.0.integrity.json +46 -0
- package/bundle/{ms.core-3.1.11.js → ms.core-3.2.0.js} +2613 -1373
- package/bundle/ms.core-3.2.0.js.map +1 -0
- package/bundle/ms.core-3.2.0.min.js +7 -0
- package/bundle/ms.core-3.2.0.min.js.map +1 -0
- package/bundle/ms.core.gbl.js +2612 -1372
- package/bundle/ms.core.gbl.js.map +1 -1
- package/bundle/ms.core.gbl.min.js +2 -2
- package/bundle/ms.core.gbl.min.js.map +1 -1
- package/bundle/ms.core.integrity.json +17 -17
- package/bundle/ms.core.js +2612 -1372
- package/bundle/ms.core.js.map +1 -1
- package/bundle/ms.core.min.js +2 -2
- package/bundle/ms.core.min.js.map +1 -1
- package/dist/ms.core.js +92 -55
- package/dist/ms.core.js.map +1 -1
- package/dist/ms.core.min.js +2 -2
- package/dist/ms.core.min.js.map +1 -1
- package/dist-esm/src/AppInsightsCore.js +5 -6
- package/dist-esm/src/AppInsightsCore.js.map +1 -1
- package/dist-esm/src/BaseCore.js +3 -4
- package/dist-esm/src/BaseCore.js.map +1 -1
- package/dist-esm/src/DataModels.js +1 -1
- package/dist-esm/src/ESPromise.js +1 -1
- package/dist-esm/src/ESPromiseScheduler.js +1 -1
- package/dist-esm/src/Enums.d.ts +174 -172
- package/dist-esm/src/Enums.js +63 -103
- package/dist-esm/src/Enums.js.map +1 -1
- package/dist-esm/src/Index.d.ts +4 -3
- package/dist-esm/src/Index.js +4 -6
- package/dist-esm/src/Index.js.map +1 -1
- package/dist-esm/src/Utils.d.ts +2 -2
- package/dist-esm/src/Utils.js +12 -13
- package/dist-esm/src/Utils.js.map +1 -1
- package/dist-esm/src/ValueSanitizer.js +1 -1
- package/package.json +3 -3
- package/src/AppInsightsCore.ts +6 -6
- package/src/BaseCore.ts +5 -5
- package/src/Enums.ts +155 -65
- package/src/Index.ts +14 -7
- package/src/Utils.ts +12 -12
- package/bundle/ms.core-3.1.11.gbl.js.map +0 -1
- package/bundle/ms.core-3.1.11.gbl.min.js +0 -7
- package/bundle/ms.core-3.1.11.gbl.min.js.map +0 -1
- package/bundle/ms.core-3.1.11.integrity.json +0 -46
- package/bundle/ms.core-3.1.11.js.map +0 -1
- package/bundle/ms.core-3.1.11.min.js +0 -7
- package/bundle/ms.core-3.1.11.min.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* 1DS JS SDK Core, 3.
|
|
2
|
+
* 1DS JS SDK Core, 3.2.0
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
* (Microsoft Internal Only)
|
|
5
5
|
*/
|
|
@@ -103,769 +103,793 @@
|
|
|
103
103
|
|
|
104
104
|
var MinChannelPriorty = 100;
|
|
105
105
|
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
106
|
+
var strEmpty = "";
|
|
107
|
+
var strProcessTelemetry = "processTelemetry";
|
|
108
|
+
var strPriority = "priority";
|
|
109
|
+
var strSetNextPlugin = "setNextPlugin";
|
|
110
|
+
var strIsInitialized = "isInitialized";
|
|
111
|
+
var strTeardown = "teardown";
|
|
112
|
+
var strCore = "core";
|
|
113
|
+
var strUpdate = "update";
|
|
114
|
+
var strDisabled = "disabled";
|
|
115
|
+
var strDoTeardown = "_doTeardown";
|
|
116
|
+
var strProcessNext = "processNext";
|
|
117
|
+
var strResume = "resume";
|
|
118
|
+
var strPause = "pause";
|
|
119
|
+
var strNotificationListener = "NotificationListener";
|
|
120
|
+
var strAddNotificationListener = "add" + strNotificationListener;
|
|
121
|
+
var strRemoveNotificationListener = "remove" + strNotificationListener;
|
|
122
|
+
var strEventsSent = "eventsSent";
|
|
123
|
+
var strEventsDiscarded = "eventsDiscarded";
|
|
124
|
+
var strEventsSendRequest = "eventsSendRequest";
|
|
125
|
+
var strPerfEvent = "perfEvent";
|
|
114
126
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
var
|
|
120
|
-
var
|
|
121
|
-
var
|
|
122
|
-
var
|
|
123
|
-
var
|
|
124
|
-
var
|
|
125
|
-
var
|
|
126
|
-
var
|
|
127
|
-
var
|
|
128
|
-
var
|
|
129
|
-
var
|
|
130
|
-
var
|
|
131
|
-
var
|
|
132
|
-
var
|
|
133
|
-
var
|
|
134
|
-
var
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
function _getObjProto(target) {
|
|
127
|
+
var strToISOString = "toISOString";
|
|
128
|
+
var cStrEndsWith = "endsWith";
|
|
129
|
+
var cStrStartsWith = "startsWith";
|
|
130
|
+
var strIndexOf = "indexOf";
|
|
131
|
+
var strMap = "map";
|
|
132
|
+
var strReduce = "reduce";
|
|
133
|
+
var cStrTrim = "trim";
|
|
134
|
+
var strToString = "toString";
|
|
135
|
+
var str__Proto$1 = "__proto__";
|
|
136
|
+
var strConstructor = "constructor";
|
|
137
|
+
var _objDefineProperty$1 = ObjDefineProperty;
|
|
138
|
+
var _objFreeze = ObjClass.freeze;
|
|
139
|
+
var _objSeal = ObjClass.seal;
|
|
140
|
+
var _objKeys = ObjClass.keys;
|
|
141
|
+
var StringProto = String[strShimPrototype];
|
|
142
|
+
var _strTrim = StringProto[cStrTrim];
|
|
143
|
+
var _strEndsWith = StringProto[cStrEndsWith];
|
|
144
|
+
var _strStartsWith = StringProto[cStrStartsWith];
|
|
145
|
+
var DateProto = Date[strShimPrototype];
|
|
146
|
+
var _dataToISOString = DateProto[strToISOString];
|
|
147
|
+
var _isArray = Array.isArray;
|
|
148
|
+
var _objToString = ObjProto[strToString];
|
|
149
|
+
var _fnToString = ObjHasOwnProperty[strToString];
|
|
150
|
+
var _objFunctionString = _fnToString.call(ObjClass);
|
|
151
|
+
var rCamelCase = /-([a-z])/g;
|
|
152
|
+
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
153
|
+
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
154
|
+
var _objGetPrototypeOf$1 = Object["getPrototypeOf"];
|
|
155
|
+
function _getObjProto$1(target) {
|
|
146
156
|
if (target) {
|
|
147
|
-
if (_objGetPrototypeOf) {
|
|
148
|
-
return _objGetPrototypeOf(target);
|
|
157
|
+
if (_objGetPrototypeOf$1) {
|
|
158
|
+
return _objGetPrototypeOf$1(target);
|
|
149
159
|
}
|
|
150
|
-
var newProto = target[str__Proto] || target[
|
|
160
|
+
var newProto = target[str__Proto$1] || target[strShimPrototype] || target[strConstructor];
|
|
151
161
|
if (newProto) {
|
|
152
162
|
return newProto;
|
|
153
163
|
}
|
|
154
164
|
}
|
|
155
165
|
return null;
|
|
156
166
|
}
|
|
157
|
-
function
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
167
|
+
function isTypeof(value, theType) {
|
|
168
|
+
return typeof value === theType;
|
|
169
|
+
}
|
|
170
|
+
function isUndefined(value) {
|
|
171
|
+
return value === undefined || typeof value === strShimUndefined;
|
|
172
|
+
}
|
|
173
|
+
function isNullOrUndefined(value) {
|
|
174
|
+
return (value === null || isUndefined(value));
|
|
175
|
+
}
|
|
176
|
+
function isNotNullOrUndefined(value) {
|
|
177
|
+
return !isNullOrUndefined(value);
|
|
178
|
+
}
|
|
179
|
+
function hasOwnProperty(obj, prop) {
|
|
180
|
+
return !!(obj && ObjHasOwnProperty.call(obj, prop));
|
|
181
|
+
}
|
|
182
|
+
function isObject(value) {
|
|
183
|
+
return !!(value && typeof value === strShimObject);
|
|
184
|
+
}
|
|
185
|
+
function isFunction(value) {
|
|
186
|
+
return !!(value && typeof value === strShimFunction);
|
|
187
|
+
}
|
|
188
|
+
function normalizeJsName(name) {
|
|
189
|
+
var value = name;
|
|
190
|
+
if (value && isString(value)) {
|
|
191
|
+
value = value.replace(rCamelCase, function (_all, letter) {
|
|
192
|
+
return letter.toUpperCase();
|
|
193
|
+
});
|
|
194
|
+
value = value.replace(rNormalizeInvalid, "_");
|
|
195
|
+
value = value.replace(rLeadingNumeric, function (_all, match) {
|
|
196
|
+
return "_" + match;
|
|
197
|
+
});
|
|
162
198
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
199
|
+
return value;
|
|
200
|
+
}
|
|
201
|
+
function objForEachKey(target, callbackfn) {
|
|
202
|
+
if (target) {
|
|
203
|
+
for (var prop in target) {
|
|
204
|
+
if (ObjHasOwnProperty.call(target, prop)) {
|
|
205
|
+
callbackfn.call(target, prop, target[prop]);
|
|
167
206
|
}
|
|
168
207
|
}
|
|
169
208
|
}
|
|
170
|
-
if (props && props.length > 0) {
|
|
171
|
-
for (var lp = 0; lp < props.length; lp++) {
|
|
172
|
-
func(props[lp]);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
function _isDynamicCandidate(target, funcName, skipOwn) {
|
|
177
|
-
return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));
|
|
178
209
|
}
|
|
179
|
-
function
|
|
180
|
-
|
|
210
|
+
function strEndsWith(value, search) {
|
|
211
|
+
var result = false;
|
|
212
|
+
if (value && search && !(result = value === search)) {
|
|
213
|
+
result = _strEndsWith ? value[cStrEndsWith](search) : _strEndsWithPoly(value, search);
|
|
214
|
+
}
|
|
215
|
+
return result;
|
|
181
216
|
}
|
|
182
|
-
function
|
|
183
|
-
var
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
217
|
+
function _strEndsWithPoly(value, search) {
|
|
218
|
+
var result = false;
|
|
219
|
+
var searchLen = search ? search.length : 0;
|
|
220
|
+
var valLen = value ? value.length : 0;
|
|
221
|
+
if (searchLen && valLen && valLen >= searchLen && !(result = value === search)) {
|
|
222
|
+
var pos = valLen - 1;
|
|
223
|
+
for (var lp = searchLen - 1; lp >= 0; lp--) {
|
|
224
|
+
if (value[pos] != search[lp]) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
pos--;
|
|
187
228
|
}
|
|
188
|
-
|
|
189
|
-
|
|
229
|
+
result = true;
|
|
230
|
+
}
|
|
231
|
+
return result;
|
|
190
232
|
}
|
|
191
|
-
function
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
233
|
+
function strStartsWith(value, checkValue) {
|
|
234
|
+
var result = false;
|
|
235
|
+
if (value && checkValue && !(result = value === checkValue)) {
|
|
236
|
+
result = _strStartsWith ? value[cStrStartsWith](checkValue) : _strStartsWithPoly(value, checkValue);
|
|
196
237
|
}
|
|
197
|
-
return
|
|
238
|
+
return result;
|
|
198
239
|
}
|
|
199
|
-
function
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (
|
|
205
|
-
|
|
240
|
+
function _strStartsWithPoly(value, checkValue) {
|
|
241
|
+
var result = false;
|
|
242
|
+
var chkLen = checkValue ? checkValue.length : 0;
|
|
243
|
+
if (value && chkLen && value.length >= chkLen && !(result = value === checkValue)) {
|
|
244
|
+
for (var lp = 0; lp < chkLen; lp++) {
|
|
245
|
+
if (value[lp] !== checkValue[lp]) {
|
|
246
|
+
return false;
|
|
206
247
|
}
|
|
207
248
|
}
|
|
208
|
-
|
|
209
|
-
return theFunc.apply(target, arguments);
|
|
210
|
-
};
|
|
249
|
+
result = true;
|
|
211
250
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
var visited = [];
|
|
218
|
-
while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
|
|
219
|
-
_forEachProp(baseProto, function (name) {
|
|
220
|
-
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
|
|
221
|
-
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
visited.push(baseProto);
|
|
225
|
-
baseProto = _getObjProto(baseProto);
|
|
251
|
+
return result;
|
|
252
|
+
}
|
|
253
|
+
function strContains(value, search) {
|
|
254
|
+
if (value && search) {
|
|
255
|
+
return value.indexOf(search) !== -1;
|
|
226
256
|
}
|
|
227
|
-
return
|
|
257
|
+
return false;
|
|
228
258
|
}
|
|
229
|
-
function
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
259
|
+
function isDate(obj) {
|
|
260
|
+
return !!(obj && _objToString.call(obj) === "[object Date]");
|
|
261
|
+
}
|
|
262
|
+
var isArray = _isArray || _isArrayPoly;
|
|
263
|
+
function _isArrayPoly(obj) {
|
|
264
|
+
return !!(obj && _objToString.call(obj) === "[object Array]");
|
|
265
|
+
}
|
|
266
|
+
function isError(obj) {
|
|
267
|
+
return !!(obj && _objToString.call(obj) === "[object Error]");
|
|
268
|
+
}
|
|
269
|
+
function isString(value) {
|
|
270
|
+
return typeof value === "string";
|
|
271
|
+
}
|
|
272
|
+
function isNumber(value) {
|
|
273
|
+
return typeof value === "number";
|
|
274
|
+
}
|
|
275
|
+
function isBoolean(value) {
|
|
276
|
+
return typeof value === "boolean";
|
|
277
|
+
}
|
|
278
|
+
function isPlainObject(value) {
|
|
279
|
+
var result = false;
|
|
280
|
+
if (value && typeof value === "object") {
|
|
281
|
+
var proto = _objGetPrototypeOf$1 ? _objGetPrototypeOf$1(value) : _getObjProto$1(value);
|
|
282
|
+
if (!proto) {
|
|
283
|
+
result = true;
|
|
236
284
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
var visited = [];
|
|
241
|
-
while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
|
|
242
|
-
var protoFunc = objProto[funcName];
|
|
243
|
-
if (protoFunc) {
|
|
244
|
-
canAddInst = (protoFunc === currentDynProtoProxy);
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
visited.push(objProto);
|
|
248
|
-
objProto = _getObjProto(objProto);
|
|
249
|
-
}
|
|
250
|
-
try {
|
|
251
|
-
if (canAddInst) {
|
|
252
|
-
target[funcName] = instFunc;
|
|
253
|
-
}
|
|
254
|
-
instFunc[DynInstChkTag] = 1;
|
|
255
|
-
}
|
|
256
|
-
catch (e) {
|
|
257
|
-
instFuncTable[DynAllowInstChkTag] = false;
|
|
285
|
+
else {
|
|
286
|
+
if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
|
|
287
|
+
proto = proto[strConstructor];
|
|
258
288
|
}
|
|
289
|
+
result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
|
|
259
290
|
}
|
|
260
291
|
}
|
|
261
|
-
return
|
|
292
|
+
return result;
|
|
262
293
|
}
|
|
263
|
-
function
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
protoFunc = _getObjProto(proto)[funcName];
|
|
267
|
-
}
|
|
268
|
-
if (typeof protoFunc !== strFunction) {
|
|
269
|
-
_throwTypeError("[" + funcName + "] is not a " + strFunction);
|
|
294
|
+
function toISOString(date) {
|
|
295
|
+
if (date) {
|
|
296
|
+
return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
|
|
270
297
|
}
|
|
271
|
-
return protoFunc;
|
|
272
298
|
}
|
|
273
|
-
function
|
|
274
|
-
|
|
275
|
-
var
|
|
276
|
-
var
|
|
277
|
-
|
|
299
|
+
function _toISOStringPoly(date) {
|
|
300
|
+
if (date && date.getUTCFullYear) {
|
|
301
|
+
var pad = function (num) {
|
|
302
|
+
var r = String(num);
|
|
303
|
+
if (r.length === 1) {
|
|
304
|
+
r = "0" + r;
|
|
305
|
+
}
|
|
306
|
+
return r;
|
|
278
307
|
};
|
|
279
|
-
|
|
280
|
-
|
|
308
|
+
return date.getUTCFullYear()
|
|
309
|
+
+ "-" + pad(date.getUTCMonth() + 1)
|
|
310
|
+
+ "-" + pad(date.getUTCDate())
|
|
311
|
+
+ "T" + pad(date.getUTCHours())
|
|
312
|
+
+ ":" + pad(date.getUTCMinutes())
|
|
313
|
+
+ ":" + pad(date.getUTCSeconds())
|
|
314
|
+
+ "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
|
|
315
|
+
+ "Z";
|
|
281
316
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
instFuncs_1[name] = target[name];
|
|
291
|
-
delete target[name];
|
|
292
|
-
if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
|
|
293
|
-
proto[name] = _createDynamicPrototype(proto, name);
|
|
317
|
+
}
|
|
318
|
+
function arrForEach(arr, callbackfn, thisArg) {
|
|
319
|
+
var len = arr.length;
|
|
320
|
+
try {
|
|
321
|
+
for (var idx = 0; idx < len; idx++) {
|
|
322
|
+
if (idx in arr) {
|
|
323
|
+
if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
|
|
324
|
+
break;
|
|
294
325
|
}
|
|
295
326
|
}
|
|
296
|
-
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
catch (e) {
|
|
297
330
|
}
|
|
298
331
|
}
|
|
299
|
-
function
|
|
300
|
-
if (
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
332
|
+
function arrIndexOf(arr, searchElement, fromIndex) {
|
|
333
|
+
if (arr) {
|
|
334
|
+
if (arr[strIndexOf]) {
|
|
335
|
+
return arr[strIndexOf](searchElement, fromIndex);
|
|
336
|
+
}
|
|
337
|
+
var len = arr.length;
|
|
338
|
+
var from = fromIndex || 0;
|
|
339
|
+
try {
|
|
340
|
+
for (var lp = Math.max(from >= 0 ? from : len - Math.abs(from), 0); lp < len; lp++) {
|
|
341
|
+
if (lp in arr && arr[lp] === searchElement) {
|
|
342
|
+
return lp;
|
|
343
|
+
}
|
|
306
344
|
}
|
|
307
|
-
|
|
308
|
-
|
|
345
|
+
}
|
|
346
|
+
catch (e) {
|
|
309
347
|
}
|
|
310
348
|
}
|
|
311
|
-
return
|
|
349
|
+
return -1;
|
|
312
350
|
}
|
|
313
|
-
function
|
|
314
|
-
|
|
315
|
-
|
|
351
|
+
function arrMap(arr, callbackfn, thisArg) {
|
|
352
|
+
var results;
|
|
353
|
+
if (arr) {
|
|
354
|
+
if (arr[strMap]) {
|
|
355
|
+
return arr[strMap](callbackfn, thisArg);
|
|
356
|
+
}
|
|
357
|
+
var len = arr.length;
|
|
358
|
+
var _this = thisArg || arr;
|
|
359
|
+
results = new Array(len);
|
|
360
|
+
try {
|
|
361
|
+
for (var lp = 0; lp < len; lp++) {
|
|
362
|
+
if (lp in arr) {
|
|
363
|
+
results[lp] = callbackfn.call(_this, arr[lp], arr);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
catch (e) {
|
|
368
|
+
}
|
|
316
369
|
}
|
|
317
|
-
return
|
|
370
|
+
return results;
|
|
318
371
|
}
|
|
319
|
-
function
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
372
|
+
function arrReduce(arr, callbackfn, initialValue) {
|
|
373
|
+
var value;
|
|
374
|
+
if (arr) {
|
|
375
|
+
if (arr[strReduce]) {
|
|
376
|
+
return arr[strReduce](callbackfn, initialValue);
|
|
377
|
+
}
|
|
378
|
+
var len = arr.length;
|
|
379
|
+
var lp = 0;
|
|
380
|
+
if (arguments.length >= 3) {
|
|
381
|
+
value = arguments[2];
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
while (lp < len && !(lp in arr)) {
|
|
385
|
+
lp++;
|
|
386
|
+
}
|
|
387
|
+
value = arr[lp++];
|
|
388
|
+
}
|
|
389
|
+
while (lp < len) {
|
|
390
|
+
if (lp in arr) {
|
|
391
|
+
value = callbackfn(value, arr[lp], lp, arr);
|
|
392
|
+
}
|
|
393
|
+
lp++;
|
|
394
|
+
}
|
|
326
395
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
396
|
+
return value;
|
|
397
|
+
}
|
|
398
|
+
function strTrim(str) {
|
|
399
|
+
if (str) {
|
|
400
|
+
str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str.replace ? str.replace(/^\s+|\s+$/g, "") : str);
|
|
330
401
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
402
|
+
return str;
|
|
403
|
+
}
|
|
404
|
+
var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
|
|
405
|
+
var _objKeysDontEnums = [
|
|
406
|
+
"toString",
|
|
407
|
+
"toLocaleString",
|
|
408
|
+
"valueOf",
|
|
409
|
+
"hasOwnProperty",
|
|
410
|
+
"isPrototypeOf",
|
|
411
|
+
"propertyIsEnumerable",
|
|
412
|
+
"constructor"
|
|
413
|
+
];
|
|
414
|
+
function objKeys(obj) {
|
|
415
|
+
var objType = typeof obj;
|
|
416
|
+
if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
|
|
417
|
+
throwTypeError("objKeys called on non-object");
|
|
335
418
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
|
|
339
|
-
useBaseInst = !!options[strUseBaseInst];
|
|
419
|
+
if (!_objKeysHasDontEnumBug && _objKeys) {
|
|
420
|
+
return _objKeys(obj);
|
|
340
421
|
}
|
|
341
|
-
var
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
setInstanceFunc = !!options[strSetInstFuncs];
|
|
422
|
+
var result = [];
|
|
423
|
+
for (var prop in obj) {
|
|
424
|
+
if (obj && ObjHasOwnProperty.call(obj, prop)) {
|
|
425
|
+
result.push(prop);
|
|
426
|
+
}
|
|
347
427
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
};
|
|
354
|
-
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
355
|
-
|
|
356
|
-
exports.LoggingSeverity = void 0;
|
|
357
|
-
(function (LoggingSeverity) {
|
|
358
|
-
LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
|
|
359
|
-
LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
|
|
360
|
-
})(exports.LoggingSeverity || (exports.LoggingSeverity = {}));
|
|
361
|
-
var _InternalMessageId = {
|
|
362
|
-
BrowserDoesNotSupportLocalStorage: 0,
|
|
363
|
-
BrowserCannotReadLocalStorage: 1,
|
|
364
|
-
BrowserCannotReadSessionStorage: 2,
|
|
365
|
-
BrowserCannotWriteLocalStorage: 3,
|
|
366
|
-
BrowserCannotWriteSessionStorage: 4,
|
|
367
|
-
BrowserFailedRemovalFromLocalStorage: 5,
|
|
368
|
-
BrowserFailedRemovalFromSessionStorage: 6,
|
|
369
|
-
CannotSendEmptyTelemetry: 7,
|
|
370
|
-
ClientPerformanceMathError: 8,
|
|
371
|
-
ErrorParsingAISessionCookie: 9,
|
|
372
|
-
ErrorPVCalc: 10,
|
|
373
|
-
ExceptionWhileLoggingError: 11,
|
|
374
|
-
FailedAddingTelemetryToBuffer: 12,
|
|
375
|
-
FailedMonitorAjaxAbort: 13,
|
|
376
|
-
FailedMonitorAjaxDur: 14,
|
|
377
|
-
FailedMonitorAjaxOpen: 15,
|
|
378
|
-
FailedMonitorAjaxRSC: 16,
|
|
379
|
-
FailedMonitorAjaxSend: 17,
|
|
380
|
-
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
381
|
-
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
382
|
-
FailedToSendQueuedTelemetry: 20,
|
|
383
|
-
FailedToReportDataLoss: 21,
|
|
384
|
-
FlushFailed: 22,
|
|
385
|
-
MessageLimitPerPVExceeded: 23,
|
|
386
|
-
MissingRequiredFieldSpecification: 24,
|
|
387
|
-
NavigationTimingNotSupported: 25,
|
|
388
|
-
OnError: 26,
|
|
389
|
-
SessionRenewalDateIsZero: 27,
|
|
390
|
-
SenderNotInitialized: 28,
|
|
391
|
-
StartTrackEventFailed: 29,
|
|
392
|
-
StopTrackEventFailed: 30,
|
|
393
|
-
StartTrackFailed: 31,
|
|
394
|
-
StopTrackFailed: 32,
|
|
395
|
-
TelemetrySampledAndNotSent: 33,
|
|
396
|
-
TrackEventFailed: 34,
|
|
397
|
-
TrackExceptionFailed: 35,
|
|
398
|
-
TrackMetricFailed: 36,
|
|
399
|
-
TrackPVFailed: 37,
|
|
400
|
-
TrackPVFailedCalc: 38,
|
|
401
|
-
TrackTraceFailed: 39,
|
|
402
|
-
TransmissionFailed: 40,
|
|
403
|
-
FailedToSetStorageBuffer: 41,
|
|
404
|
-
FailedToRestoreStorageBuffer: 42,
|
|
405
|
-
InvalidBackendResponse: 43,
|
|
406
|
-
FailedToFixDepricatedValues: 44,
|
|
407
|
-
InvalidDurationValue: 45,
|
|
408
|
-
TelemetryEnvelopeInvalid: 46,
|
|
409
|
-
CreateEnvelopeError: 47,
|
|
410
|
-
CannotSerializeObject: 48,
|
|
411
|
-
CannotSerializeObjectNonSerializable: 49,
|
|
412
|
-
CircularReferenceDetected: 50,
|
|
413
|
-
ClearAuthContextFailed: 51,
|
|
414
|
-
ExceptionTruncated: 52,
|
|
415
|
-
IllegalCharsInName: 53,
|
|
416
|
-
ItemNotInArray: 54,
|
|
417
|
-
MaxAjaxPerPVExceeded: 55,
|
|
418
|
-
MessageTruncated: 56,
|
|
419
|
-
NameTooLong: 57,
|
|
420
|
-
SampleRateOutOfRange: 58,
|
|
421
|
-
SetAuthContextFailed: 59,
|
|
422
|
-
SetAuthContextFailedAccountName: 60,
|
|
423
|
-
StringValueTooLong: 61,
|
|
424
|
-
StartCalledMoreThanOnce: 62,
|
|
425
|
-
StopCalledWithoutStart: 63,
|
|
426
|
-
TelemetryInitializerFailed: 64,
|
|
427
|
-
TrackArgumentsNotSpecified: 65,
|
|
428
|
-
UrlTooLong: 66,
|
|
429
|
-
SessionStorageBufferFull: 67,
|
|
430
|
-
CannotAccessCookie: 68,
|
|
431
|
-
IdTooLong: 69,
|
|
432
|
-
InvalidEvent: 70,
|
|
433
|
-
FailedMonitorAjaxSetRequestHeader: 71,
|
|
434
|
-
SendBrowserInfoOnUserInit: 72,
|
|
435
|
-
PluginException: 73,
|
|
436
|
-
NotificationException: 74,
|
|
437
|
-
SnippetScriptLoadFailure: 99,
|
|
438
|
-
InvalidInstrumentationKey: 100,
|
|
439
|
-
CannotParseAiBlobValue: 101,
|
|
440
|
-
InvalidContentBlob: 102,
|
|
441
|
-
TrackPageActionEventFailed: 103,
|
|
442
|
-
FailedAddingCustomDefinedRequestContext: 104,
|
|
443
|
-
InMemoryStorageBufferFull: 105
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
var strOnPrefix = "on";
|
|
447
|
-
var strAttachEvent = "attachEvent";
|
|
448
|
-
var strAddEventHelper = "addEventListener";
|
|
449
|
-
var strDetachEvent = "detachEvent";
|
|
450
|
-
var strRemoveEventListener = "removeEventListener";
|
|
451
|
-
var strToISOString = "toISOString";
|
|
452
|
-
var cStrEndsWith = "endsWith";
|
|
453
|
-
var cStrStartsWith = "startsWith";
|
|
454
|
-
var strIndexOf = "indexOf";
|
|
455
|
-
var strMap = "map";
|
|
456
|
-
var strReduce = "reduce";
|
|
457
|
-
var cStrTrim = "trim";
|
|
458
|
-
var strToString = "toString";
|
|
459
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
460
|
-
var _objKeys = ObjClass.keys;
|
|
461
|
-
var StringProto = String[strShimPrototype];
|
|
462
|
-
var _strTrim = StringProto[cStrTrim];
|
|
463
|
-
var _strEndsWith = StringProto[cStrEndsWith];
|
|
464
|
-
var _strStartsWith = StringProto[cStrStartsWith];
|
|
465
|
-
var DateProto = Date[strShimPrototype];
|
|
466
|
-
var _dataToISOString = DateProto[strToISOString];
|
|
467
|
-
var _isArray = Array.isArray;
|
|
468
|
-
var _objToString = ObjProto[strToString];
|
|
469
|
-
var _fnToString = ObjHasOwnProperty[strToString];
|
|
470
|
-
_fnToString.call(ObjClass);
|
|
471
|
-
var rCamelCase = /-([a-z])/g;
|
|
472
|
-
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
473
|
-
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
474
|
-
function isTypeof(value, theType) {
|
|
475
|
-
return typeof value === theType;
|
|
476
|
-
}
|
|
477
|
-
function isUndefined(value) {
|
|
478
|
-
return value === undefined || typeof value === strShimUndefined;
|
|
479
|
-
}
|
|
480
|
-
function isNullOrUndefined(value) {
|
|
481
|
-
return (value === null || isUndefined(value));
|
|
482
|
-
}
|
|
483
|
-
function isNotNullOrUndefined(value) {
|
|
484
|
-
return !isNullOrUndefined(value);
|
|
485
|
-
}
|
|
486
|
-
function hasOwnProperty(obj, prop) {
|
|
487
|
-
return !!(obj && ObjHasOwnProperty.call(obj, prop));
|
|
488
|
-
}
|
|
489
|
-
function isObject(value) {
|
|
490
|
-
return !!(value && typeof value === strShimObject);
|
|
491
|
-
}
|
|
492
|
-
function isFunction(value) {
|
|
493
|
-
return !!(value && typeof value === strShimFunction);
|
|
494
|
-
}
|
|
495
|
-
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
496
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
497
|
-
var result = false;
|
|
498
|
-
if (!isNullOrUndefined(obj)) {
|
|
499
|
-
try {
|
|
500
|
-
if (!isNullOrUndefined(obj[strAddEventHelper])) {
|
|
501
|
-
obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
|
|
502
|
-
result = true;
|
|
503
|
-
}
|
|
504
|
-
else if (!isNullOrUndefined(obj[strAttachEvent])) {
|
|
505
|
-
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
506
|
-
result = true;
|
|
428
|
+
if (_objKeysHasDontEnumBug) {
|
|
429
|
+
var dontEnumsLength = _objKeysDontEnums.length;
|
|
430
|
+
for (var lp = 0; lp < dontEnumsLength; lp++) {
|
|
431
|
+
if (obj && ObjHasOwnProperty.call(obj, _objKeysDontEnums[lp])) {
|
|
432
|
+
result.push(_objKeysDontEnums[lp]);
|
|
507
433
|
}
|
|
508
434
|
}
|
|
509
|
-
catch (e) {
|
|
510
|
-
}
|
|
511
435
|
}
|
|
512
436
|
return result;
|
|
513
437
|
}
|
|
514
|
-
function
|
|
515
|
-
if (
|
|
516
|
-
if (!isNullOrUndefined(obj)) {
|
|
438
|
+
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
439
|
+
if (_objDefineProperty$1) {
|
|
517
440
|
try {
|
|
518
|
-
|
|
519
|
-
|
|
441
|
+
var descriptor = {
|
|
442
|
+
enumerable: true,
|
|
443
|
+
configurable: true
|
|
444
|
+
};
|
|
445
|
+
if (getProp) {
|
|
446
|
+
descriptor.get = getProp;
|
|
520
447
|
}
|
|
521
|
-
|
|
522
|
-
|
|
448
|
+
if (setProp) {
|
|
449
|
+
descriptor.set = setProp;
|
|
523
450
|
}
|
|
451
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
452
|
+
return true;
|
|
524
453
|
}
|
|
525
454
|
catch (e) {
|
|
526
455
|
}
|
|
527
456
|
}
|
|
457
|
+
return false;
|
|
528
458
|
}
|
|
529
|
-
function
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
459
|
+
function _doNothing(value) {
|
|
460
|
+
return value;
|
|
461
|
+
}
|
|
462
|
+
function deepFreeze(obj) {
|
|
463
|
+
if (_objFreeze) {
|
|
464
|
+
objForEachKey(obj, function (name, value) {
|
|
465
|
+
if (isArray(value) || isObject(value)) {
|
|
466
|
+
_objFreeze(value);
|
|
467
|
+
}
|
|
538
468
|
});
|
|
539
469
|
}
|
|
540
|
-
return
|
|
470
|
+
return objFreeze(obj);
|
|
541
471
|
}
|
|
542
|
-
|
|
472
|
+
var objFreeze = _objFreeze || _doNothing;
|
|
473
|
+
var objSeal = _objSeal || _doNothing;
|
|
474
|
+
function dateNow() {
|
|
475
|
+
var dt = Date;
|
|
476
|
+
return dt.now ? dt.now() : new dt().getTime();
|
|
477
|
+
}
|
|
478
|
+
function getExceptionName(object) {
|
|
479
|
+
if (isError(object)) {
|
|
480
|
+
return object.name;
|
|
481
|
+
}
|
|
482
|
+
return strEmpty;
|
|
483
|
+
}
|
|
484
|
+
function setValue(target, field, value, valChk, srcChk) {
|
|
485
|
+
var theValue = value;
|
|
543
486
|
if (target) {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
487
|
+
theValue = target[field];
|
|
488
|
+
if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
|
|
489
|
+
theValue = value;
|
|
490
|
+
target[field] = theValue;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return theValue;
|
|
494
|
+
}
|
|
495
|
+
function getSetValue(target, field, defValue) {
|
|
496
|
+
var theValue;
|
|
497
|
+
if (target) {
|
|
498
|
+
theValue = target[field];
|
|
499
|
+
if (!theValue && isNullOrUndefined(theValue)) {
|
|
500
|
+
theValue = !isUndefined(defValue) ? defValue : {};
|
|
501
|
+
target[field] = theValue;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
else {
|
|
505
|
+
theValue = !isUndefined(defValue) ? defValue : {};
|
|
506
|
+
}
|
|
507
|
+
return theValue;
|
|
508
|
+
}
|
|
509
|
+
function isNotTruthy(value) {
|
|
510
|
+
return !value;
|
|
511
|
+
}
|
|
512
|
+
function isTruthy(value) {
|
|
513
|
+
return !!value;
|
|
514
|
+
}
|
|
515
|
+
function throwError(message) {
|
|
516
|
+
throw new Error(message);
|
|
517
|
+
}
|
|
518
|
+
function _createProxyFunction(source, funcName) {
|
|
519
|
+
var srcFunc = null;
|
|
520
|
+
var src = null;
|
|
521
|
+
if (isFunction(source)) {
|
|
522
|
+
srcFunc = source;
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
src = source;
|
|
526
|
+
}
|
|
527
|
+
return function () {
|
|
528
|
+
var originalArguments = arguments;
|
|
529
|
+
if (srcFunc) {
|
|
530
|
+
src = srcFunc();
|
|
531
|
+
}
|
|
532
|
+
if (src) {
|
|
533
|
+
return src[funcName].apply(src, originalArguments);
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
function proxyAssign(target, source, chkSet) {
|
|
538
|
+
if (target && source && isObject(target) && isObject(source)) {
|
|
539
|
+
var _loop_1 = function (field) {
|
|
540
|
+
if (isString(field)) {
|
|
541
|
+
var value = source[field];
|
|
542
|
+
if (isFunction(value)) {
|
|
543
|
+
if (!chkSet || chkSet(field, true, source, target)) {
|
|
544
|
+
target[field] = _createProxyFunction(source, field);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
else if (!chkSet || chkSet(field, false, source, target)) {
|
|
548
|
+
if (hasOwnProperty(target, field)) {
|
|
549
|
+
delete target[field];
|
|
550
|
+
}
|
|
551
|
+
if (!objDefineAccessors(target, field, function () {
|
|
552
|
+
return source[field];
|
|
553
|
+
}, function (theValue) {
|
|
554
|
+
source[field] = theValue;
|
|
555
|
+
})) {
|
|
556
|
+
target[field] = value;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
547
559
|
}
|
|
560
|
+
};
|
|
561
|
+
for (var field in source) {
|
|
562
|
+
_loop_1(field);
|
|
548
563
|
}
|
|
549
564
|
}
|
|
565
|
+
return target;
|
|
550
566
|
}
|
|
551
|
-
function
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
567
|
+
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
568
|
+
if (target && name && source) {
|
|
569
|
+
if (overwriteTarget !== false || isUndefined(target[name])) {
|
|
570
|
+
target[name] = _createProxyFunction(source, theFunc);
|
|
571
|
+
}
|
|
555
572
|
}
|
|
556
|
-
return result;
|
|
557
573
|
}
|
|
558
|
-
function
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
var pos = valLen - 1;
|
|
564
|
-
for (var lp = searchLen - 1; lp >= 0; lp--) {
|
|
565
|
-
if (value[pos] != search[lp]) {
|
|
566
|
-
return false;
|
|
574
|
+
function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {
|
|
575
|
+
if (target && source && isObject(target) && isArray(functionsToProxy)) {
|
|
576
|
+
arrForEach(functionsToProxy, function (theFuncName) {
|
|
577
|
+
if (isString(theFuncName)) {
|
|
578
|
+
proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);
|
|
567
579
|
}
|
|
568
|
-
|
|
569
|
-
}
|
|
570
|
-
result = true;
|
|
580
|
+
});
|
|
571
581
|
}
|
|
572
|
-
return
|
|
582
|
+
return target;
|
|
573
583
|
}
|
|
574
|
-
function
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
result = _strStartsWith ? value[cStrStartsWith](checkValue) : _strStartsWithPoly(value, checkValue);
|
|
584
|
+
function optimizeObject(theObject) {
|
|
585
|
+
if (theObject && ObjAssign) {
|
|
586
|
+
theObject = ObjClass(ObjAssign({}, theObject));
|
|
578
587
|
}
|
|
579
|
-
return
|
|
588
|
+
return theObject;
|
|
580
589
|
}
|
|
581
|
-
function
|
|
582
|
-
var
|
|
583
|
-
var
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
590
|
+
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
591
|
+
var theArgs = arguments;
|
|
592
|
+
var extended = theArgs[0] || {};
|
|
593
|
+
var argLen = theArgs.length;
|
|
594
|
+
var deep = false;
|
|
595
|
+
var idx = 1;
|
|
596
|
+
if (argLen > 0 && isBoolean(extended)) {
|
|
597
|
+
deep = extended;
|
|
598
|
+
extended = theArgs[idx] || {};
|
|
599
|
+
idx++;
|
|
600
|
+
}
|
|
601
|
+
if (!isObject(extended)) {
|
|
602
|
+
extended = {};
|
|
603
|
+
}
|
|
604
|
+
for (; idx < argLen; idx++) {
|
|
605
|
+
var arg = theArgs[idx];
|
|
606
|
+
var isArgArray = isArray(arg);
|
|
607
|
+
var isArgObj = isObject(arg);
|
|
608
|
+
for (var prop in arg) {
|
|
609
|
+
var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
|
|
610
|
+
if (!propOk) {
|
|
611
|
+
continue;
|
|
612
|
+
}
|
|
613
|
+
var newValue = arg[prop];
|
|
614
|
+
var isNewArray = void 0;
|
|
615
|
+
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
616
|
+
var clone = extended[prop];
|
|
617
|
+
if (isNewArray) {
|
|
618
|
+
if (!isArray(clone)) {
|
|
619
|
+
clone = [];
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
else if (!isPlainObject(clone)) {
|
|
623
|
+
clone = {};
|
|
624
|
+
}
|
|
625
|
+
newValue = objExtend(deep, clone, newValue);
|
|
626
|
+
}
|
|
627
|
+
if (newValue !== undefined) {
|
|
628
|
+
extended[prop] = newValue;
|
|
588
629
|
}
|
|
589
630
|
}
|
|
590
|
-
result = true;
|
|
591
|
-
}
|
|
592
|
-
return result;
|
|
593
|
-
}
|
|
594
|
-
function strContains(value, search) {
|
|
595
|
-
if (value && search) {
|
|
596
|
-
return value.indexOf(search) !== -1;
|
|
597
631
|
}
|
|
598
|
-
return
|
|
599
|
-
}
|
|
600
|
-
function isDate(obj) {
|
|
601
|
-
return !!(obj && _objToString.call(obj) === "[object Date]");
|
|
602
|
-
}
|
|
603
|
-
var isArray = _isArray || _isArrayPoly;
|
|
604
|
-
function _isArrayPoly(obj) {
|
|
605
|
-
return !!(obj && _objToString.call(obj) === "[object Array]");
|
|
632
|
+
return extended;
|
|
606
633
|
}
|
|
607
|
-
|
|
608
|
-
|
|
634
|
+
|
|
635
|
+
function createEnumStyle(values) {
|
|
636
|
+
var enumClass = {};
|
|
637
|
+
objForEachKey(values, function (field, value) {
|
|
638
|
+
enumClass[field] = value;
|
|
639
|
+
enumClass[value] = field;
|
|
640
|
+
});
|
|
641
|
+
return deepFreeze(enumClass);
|
|
609
642
|
}
|
|
610
|
-
|
|
611
|
-
|
|
643
|
+
|
|
644
|
+
var EventsDiscardedReason = createEnumStyle({
|
|
645
|
+
Unknown: 0 ,
|
|
646
|
+
NonRetryableStatus: 1 ,
|
|
647
|
+
InvalidEvent: 2 ,
|
|
648
|
+
SizeLimitExceeded: 3 ,
|
|
649
|
+
KillSwitch: 4 ,
|
|
650
|
+
QueueFull: 5
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
/*!
|
|
654
|
+
* Microsoft Dynamic Proto Utility, 1.1.4
|
|
655
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
656
|
+
*/
|
|
657
|
+
var Constructor = 'constructor';
|
|
658
|
+
var Prototype = 'prototype';
|
|
659
|
+
var strFunction = 'function';
|
|
660
|
+
var DynInstFuncTable = '_dynInstFuncs';
|
|
661
|
+
var DynProxyTag = '_isDynProxy';
|
|
662
|
+
var DynClassName = '_dynClass';
|
|
663
|
+
var DynClassNamePrefix = '_dynCls$';
|
|
664
|
+
var DynInstChkTag = '_dynInstChk';
|
|
665
|
+
var DynAllowInstChkTag = DynInstChkTag;
|
|
666
|
+
var DynProtoDefaultOptions = '_dfOpts';
|
|
667
|
+
var UnknownValue = '_unknown_';
|
|
668
|
+
var str__Proto = "__proto__";
|
|
669
|
+
var strUseBaseInst = 'useBaseInst';
|
|
670
|
+
var strSetInstFuncs = 'setInstFuncs';
|
|
671
|
+
var Obj = Object;
|
|
672
|
+
var _objGetPrototypeOf = Obj["getPrototypeOf"];
|
|
673
|
+
var _dynamicNames = 0;
|
|
674
|
+
function _hasOwnProperty(obj, prop) {
|
|
675
|
+
return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
|
|
612
676
|
}
|
|
613
|
-
function
|
|
614
|
-
return
|
|
677
|
+
function _isObjectOrArrayPrototype(target) {
|
|
678
|
+
return target && (target === Obj[Prototype] || target === Array[Prototype]);
|
|
615
679
|
}
|
|
616
|
-
function
|
|
617
|
-
return
|
|
680
|
+
function _isObjectArrayOrFunctionPrototype(target) {
|
|
681
|
+
return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
|
|
618
682
|
}
|
|
619
|
-
function
|
|
620
|
-
if (
|
|
621
|
-
|
|
683
|
+
function _getObjProto(target) {
|
|
684
|
+
if (target) {
|
|
685
|
+
if (_objGetPrototypeOf) {
|
|
686
|
+
return _objGetPrototypeOf(target);
|
|
687
|
+
}
|
|
688
|
+
var newProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
689
|
+
if (newProto) {
|
|
690
|
+
return newProto;
|
|
691
|
+
}
|
|
622
692
|
}
|
|
693
|
+
return null;
|
|
623
694
|
}
|
|
624
|
-
function
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
r = "0" + r;
|
|
630
|
-
}
|
|
631
|
-
return r;
|
|
632
|
-
};
|
|
633
|
-
return date.getUTCFullYear()
|
|
634
|
-
+ "-" + pad(date.getUTCMonth() + 1)
|
|
635
|
-
+ "-" + pad(date.getUTCDate())
|
|
636
|
-
+ "T" + pad(date.getUTCHours())
|
|
637
|
-
+ ":" + pad(date.getUTCMinutes())
|
|
638
|
-
+ ":" + pad(date.getUTCSeconds())
|
|
639
|
-
+ "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
|
|
640
|
-
+ "Z";
|
|
695
|
+
function _forEachProp(target, func) {
|
|
696
|
+
var props = [];
|
|
697
|
+
var getOwnProps = Obj["getOwnPropertyNames"];
|
|
698
|
+
if (getOwnProps) {
|
|
699
|
+
props = getOwnProps(target);
|
|
641
700
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
for (var idx = 0; idx < len; idx++) {
|
|
647
|
-
if (idx in arr) {
|
|
648
|
-
if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
|
|
649
|
-
break;
|
|
650
|
-
}
|
|
701
|
+
else {
|
|
702
|
+
for (var name_1 in target) {
|
|
703
|
+
if (typeof name_1 === "string" && _hasOwnProperty(target, name_1)) {
|
|
704
|
+
props.push(name_1);
|
|
651
705
|
}
|
|
652
706
|
}
|
|
653
707
|
}
|
|
654
|
-
|
|
708
|
+
if (props && props.length > 0) {
|
|
709
|
+
for (var lp = 0; lp < props.length; lp++) {
|
|
710
|
+
func(props[lp]);
|
|
711
|
+
}
|
|
655
712
|
}
|
|
656
713
|
}
|
|
657
|
-
function
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
714
|
+
function _isDynamicCandidate(target, funcName, skipOwn) {
|
|
715
|
+
return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));
|
|
716
|
+
}
|
|
717
|
+
function _throwTypeError(message) {
|
|
718
|
+
throw new TypeError("DynamicProto: " + message);
|
|
719
|
+
}
|
|
720
|
+
function _getInstanceFuncs(thisTarget) {
|
|
721
|
+
var instFuncs = {};
|
|
722
|
+
_forEachProp(thisTarget, function (name) {
|
|
723
|
+
if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {
|
|
724
|
+
instFuncs[name] = thisTarget[name];
|
|
661
725
|
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
}
|
|
726
|
+
});
|
|
727
|
+
return instFuncs;
|
|
728
|
+
}
|
|
729
|
+
function _hasVisited(values, value) {
|
|
730
|
+
for (var lp = values.length - 1; lp >= 0; lp--) {
|
|
731
|
+
if (values[lp] === value) {
|
|
732
|
+
return true;
|
|
670
733
|
}
|
|
671
|
-
|
|
734
|
+
}
|
|
735
|
+
return false;
|
|
736
|
+
}
|
|
737
|
+
function _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {
|
|
738
|
+
function _instFuncProxy(target, funcHost, funcName) {
|
|
739
|
+
var theFunc = funcHost[funcName];
|
|
740
|
+
if (theFunc[DynProxyTag] && useBaseInst) {
|
|
741
|
+
var instFuncTable = target[DynInstFuncTable] || {};
|
|
742
|
+
if (instFuncTable[DynAllowInstChkTag] !== false) {
|
|
743
|
+
theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;
|
|
744
|
+
}
|
|
672
745
|
}
|
|
746
|
+
return function () {
|
|
747
|
+
return theFunc.apply(target, arguments);
|
|
748
|
+
};
|
|
673
749
|
}
|
|
674
|
-
|
|
750
|
+
var baseFuncs = {};
|
|
751
|
+
_forEachProp(instFuncs, function (name) {
|
|
752
|
+
baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
|
|
753
|
+
});
|
|
754
|
+
var baseProto = _getObjProto(classProto);
|
|
755
|
+
var visited = [];
|
|
756
|
+
while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
|
|
757
|
+
_forEachProp(baseProto, function (name) {
|
|
758
|
+
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
|
|
759
|
+
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
visited.push(baseProto);
|
|
763
|
+
baseProto = _getObjProto(baseProto);
|
|
764
|
+
}
|
|
765
|
+
return baseFuncs;
|
|
675
766
|
}
|
|
676
|
-
function
|
|
677
|
-
var
|
|
678
|
-
if (
|
|
679
|
-
|
|
680
|
-
|
|
767
|
+
function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
|
|
768
|
+
var instFunc = null;
|
|
769
|
+
if (target && _hasOwnProperty(proto, DynClassName)) {
|
|
770
|
+
var instFuncTable = target[DynInstFuncTable] || {};
|
|
771
|
+
instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
|
|
772
|
+
if (!instFunc) {
|
|
773
|
+
_throwTypeError("Missing [" + funcName + "] " + strFunction);
|
|
681
774
|
}
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
775
|
+
if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
|
|
776
|
+
var canAddInst = !_hasOwnProperty(target, funcName);
|
|
777
|
+
var objProto = _getObjProto(target);
|
|
778
|
+
var visited = [];
|
|
779
|
+
while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
|
|
780
|
+
var protoFunc = objProto[funcName];
|
|
781
|
+
if (protoFunc) {
|
|
782
|
+
canAddInst = (protoFunc === currentDynProtoProxy);
|
|
783
|
+
break;
|
|
689
784
|
}
|
|
785
|
+
visited.push(objProto);
|
|
786
|
+
objProto = _getObjProto(objProto);
|
|
690
787
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
}
|
|
697
|
-
function arrReduce(arr, callbackfn, initialValue) {
|
|
698
|
-
var value;
|
|
699
|
-
if (arr) {
|
|
700
|
-
if (arr[strReduce]) {
|
|
701
|
-
return arr[strReduce](callbackfn, initialValue);
|
|
702
|
-
}
|
|
703
|
-
var len = arr.length;
|
|
704
|
-
var lp = 0;
|
|
705
|
-
if (arguments.length >= 3) {
|
|
706
|
-
value = arguments[2];
|
|
707
|
-
}
|
|
708
|
-
else {
|
|
709
|
-
while (lp < len && !(lp in arr)) {
|
|
710
|
-
lp++;
|
|
788
|
+
try {
|
|
789
|
+
if (canAddInst) {
|
|
790
|
+
target[funcName] = instFunc;
|
|
791
|
+
}
|
|
792
|
+
instFunc[DynInstChkTag] = 1;
|
|
711
793
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
while (lp < len) {
|
|
715
|
-
if (lp in arr) {
|
|
716
|
-
value = callbackfn(value, arr[lp], lp, arr);
|
|
794
|
+
catch (e) {
|
|
795
|
+
instFuncTable[DynAllowInstChkTag] = false;
|
|
717
796
|
}
|
|
718
|
-
lp++;
|
|
719
797
|
}
|
|
720
798
|
}
|
|
721
|
-
return
|
|
799
|
+
return instFunc;
|
|
722
800
|
}
|
|
723
|
-
function
|
|
724
|
-
|
|
725
|
-
|
|
801
|
+
function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
|
|
802
|
+
var protoFunc = proto[funcName];
|
|
803
|
+
if (protoFunc === currentDynProtoProxy) {
|
|
804
|
+
protoFunc = _getObjProto(proto)[funcName];
|
|
726
805
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
|
|
730
|
-
var _objKeysDontEnums = [
|
|
731
|
-
"toString",
|
|
732
|
-
"toLocaleString",
|
|
733
|
-
"valueOf",
|
|
734
|
-
"hasOwnProperty",
|
|
735
|
-
"isPrototypeOf",
|
|
736
|
-
"propertyIsEnumerable",
|
|
737
|
-
"constructor"
|
|
738
|
-
];
|
|
739
|
-
function objKeys(obj) {
|
|
740
|
-
var objType = typeof obj;
|
|
741
|
-
if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
|
|
742
|
-
throwTypeError("objKeys called on non-object");
|
|
806
|
+
if (typeof protoFunc !== strFunction) {
|
|
807
|
+
_throwTypeError("[" + funcName + "] is not a " + strFunction);
|
|
743
808
|
}
|
|
744
|
-
|
|
745
|
-
|
|
809
|
+
return protoFunc;
|
|
810
|
+
}
|
|
811
|
+
function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
|
|
812
|
+
function _createDynamicPrototype(proto, funcName) {
|
|
813
|
+
var dynProtoProxy = function () {
|
|
814
|
+
var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
|
|
815
|
+
return instFunc.apply(this, arguments);
|
|
816
|
+
};
|
|
817
|
+
dynProtoProxy[DynProxyTag] = 1;
|
|
818
|
+
return dynProtoProxy;
|
|
746
819
|
}
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
820
|
+
if (!_isObjectOrArrayPrototype(proto)) {
|
|
821
|
+
var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
|
|
822
|
+
var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
|
|
823
|
+
if (instFuncTable[DynAllowInstChkTag] !== false) {
|
|
824
|
+
instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
|
|
751
825
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
826
|
+
_forEachProp(target, function (name) {
|
|
827
|
+
if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
|
|
828
|
+
instFuncs_1[name] = target[name];
|
|
829
|
+
delete target[name];
|
|
830
|
+
if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
|
|
831
|
+
proto[name] = _createDynamicPrototype(proto, name);
|
|
832
|
+
}
|
|
758
833
|
}
|
|
759
|
-
}
|
|
834
|
+
});
|
|
760
835
|
}
|
|
761
|
-
return result;
|
|
762
836
|
}
|
|
763
|
-
function
|
|
764
|
-
if (
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
if (getProp) {
|
|
771
|
-
descriptor.get = getProp;
|
|
772
|
-
}
|
|
773
|
-
if (setProp) {
|
|
774
|
-
descriptor.set = setProp;
|
|
837
|
+
function _checkPrototype(classProto, thisTarget) {
|
|
838
|
+
if (_objGetPrototypeOf) {
|
|
839
|
+
var visited = [];
|
|
840
|
+
var thisProto = _getObjProto(thisTarget);
|
|
841
|
+
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
842
|
+
if (thisProto === classProto) {
|
|
843
|
+
return true;
|
|
775
844
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
}
|
|
779
|
-
catch (e) {
|
|
845
|
+
visited.push(thisProto);
|
|
846
|
+
thisProto = _getObjProto(thisProto);
|
|
780
847
|
}
|
|
781
848
|
}
|
|
782
849
|
return false;
|
|
783
850
|
}
|
|
784
|
-
function
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
}
|
|
788
|
-
function getExceptionName(object) {
|
|
789
|
-
if (isError(object)) {
|
|
790
|
-
return object.name;
|
|
851
|
+
function _getObjName(target, unknownValue) {
|
|
852
|
+
if (_hasOwnProperty(target, Prototype)) {
|
|
853
|
+
return target.name || unknownValue || UnknownValue;
|
|
791
854
|
}
|
|
792
|
-
return
|
|
855
|
+
return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
|
|
793
856
|
}
|
|
794
|
-
function
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
theValue = target[field];
|
|
798
|
-
if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
|
|
799
|
-
theValue = value;
|
|
800
|
-
target[field] = theValue;
|
|
801
|
-
}
|
|
857
|
+
function dynamicProto(theClass, target, delegateFunc, options) {
|
|
858
|
+
if (!_hasOwnProperty(theClass, Prototype)) {
|
|
859
|
+
_throwTypeError("theClass is an invalid class definition.");
|
|
802
860
|
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
theValue = !isUndefined(defValue) ? defValue : {};
|
|
811
|
-
target[field] = theValue;
|
|
812
|
-
}
|
|
861
|
+
var classProto = theClass[Prototype];
|
|
862
|
+
if (!_checkPrototype(classProto, target)) {
|
|
863
|
+
_throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
|
|
864
|
+
}
|
|
865
|
+
var className = null;
|
|
866
|
+
if (_hasOwnProperty(classProto, DynClassName)) {
|
|
867
|
+
className = classProto[DynClassName];
|
|
813
868
|
}
|
|
814
869
|
else {
|
|
815
|
-
|
|
870
|
+
className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
|
|
871
|
+
_dynamicNames++;
|
|
872
|
+
classProto[DynClassName] = className;
|
|
816
873
|
}
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
}
|
|
822
|
-
function isTruthy(value) {
|
|
823
|
-
return !!value;
|
|
824
|
-
}
|
|
825
|
-
function throwError(message) {
|
|
826
|
-
throw new Error(message);
|
|
827
|
-
}
|
|
828
|
-
function proxyAssign(target, source, chkSet) {
|
|
829
|
-
if (target && source && target !== source && isObject(target) && isObject(source)) {
|
|
830
|
-
var _loop_1 = function (field) {
|
|
831
|
-
if (isString(field)) {
|
|
832
|
-
var value = source[field];
|
|
833
|
-
if (isFunction(value)) {
|
|
834
|
-
if (!chkSet || chkSet(field, true, source, target)) {
|
|
835
|
-
target[field] = (function (funcName) {
|
|
836
|
-
return function () {
|
|
837
|
-
var originalArguments = arguments;
|
|
838
|
-
return source[funcName].apply(source, originalArguments);
|
|
839
|
-
};
|
|
840
|
-
})(field);
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
else if (!chkSet || chkSet(field, false, source, target)) {
|
|
844
|
-
if (hasOwnProperty(target, field)) {
|
|
845
|
-
delete target[field];
|
|
846
|
-
}
|
|
847
|
-
if (!objDefineAccessors(target, field, function () {
|
|
848
|
-
return source[field];
|
|
849
|
-
}, function (theValue) {
|
|
850
|
-
source[field] = theValue;
|
|
851
|
-
})) {
|
|
852
|
-
target[field] = value;
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
};
|
|
857
|
-
for (var field in source) {
|
|
858
|
-
_loop_1(field);
|
|
859
|
-
}
|
|
874
|
+
var perfOptions = dynamicProto[DynProtoDefaultOptions];
|
|
875
|
+
var useBaseInst = !!perfOptions[strUseBaseInst];
|
|
876
|
+
if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
|
|
877
|
+
useBaseInst = !!options[strUseBaseInst];
|
|
860
878
|
}
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
879
|
+
var instFuncs = _getInstanceFuncs(target);
|
|
880
|
+
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
881
|
+
delegateFunc(target, baseFuncs);
|
|
882
|
+
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
883
|
+
if (setInstanceFunc && options) {
|
|
884
|
+
setInstanceFunc = !!options[strSetInstFuncs];
|
|
866
885
|
}
|
|
867
|
-
|
|
886
|
+
_populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
|
|
868
887
|
}
|
|
888
|
+
var perfDefaults = {
|
|
889
|
+
setInstFuncs: true,
|
|
890
|
+
useBaseInst: true
|
|
891
|
+
};
|
|
892
|
+
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
869
893
|
|
|
870
894
|
var strWindow = "window";
|
|
871
895
|
var strDocument = "document";
|
|
@@ -881,6 +905,7 @@
|
|
|
881
905
|
var strReactNative = "ReactNative";
|
|
882
906
|
var strMsie = "msie";
|
|
883
907
|
var strTrident = "trident/";
|
|
908
|
+
var strXMLHttpRequest = "XMLHttpRequest";
|
|
884
909
|
var _isTrident = null;
|
|
885
910
|
var _navUserAgentCheck = null;
|
|
886
911
|
var _enableMocks = false;
|
|
@@ -1007,7 +1032,7 @@
|
|
|
1007
1032
|
var nav = getNavigator();
|
|
1008
1033
|
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
1009
1034
|
_navUserAgentCheck = nav.userAgent;
|
|
1010
|
-
var userAgent = (_navUserAgentCheck ||
|
|
1035
|
+
var userAgent = (_navUserAgentCheck || strEmpty).toLowerCase();
|
|
1011
1036
|
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
1012
1037
|
}
|
|
1013
1038
|
return _isTrident;
|
|
@@ -1016,9 +1041,9 @@
|
|
|
1016
1041
|
if (userAgentStr === void 0) { userAgentStr = null; }
|
|
1017
1042
|
if (!userAgentStr) {
|
|
1018
1043
|
var navigator_1 = getNavigator() || {};
|
|
1019
|
-
userAgentStr = navigator_1 ? (navigator_1.userAgent ||
|
|
1044
|
+
userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty).toLowerCase() : strEmpty;
|
|
1020
1045
|
}
|
|
1021
|
-
var ua = (userAgentStr ||
|
|
1046
|
+
var ua = (userAgentStr || strEmpty).toLowerCase();
|
|
1022
1047
|
if (strContains(ua, strMsie)) {
|
|
1023
1048
|
var doc = getDocument() || {};
|
|
1024
1049
|
return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
|
|
@@ -1033,7 +1058,7 @@
|
|
|
1033
1058
|
}
|
|
1034
1059
|
function dumpObj(object) {
|
|
1035
1060
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
1036
|
-
var propertyValueDump =
|
|
1061
|
+
var propertyValueDump = strEmpty;
|
|
1037
1062
|
if (objectTypeDump === "[object Error]") {
|
|
1038
1063
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
1039
1064
|
}
|
|
@@ -1051,8 +1076,7 @@
|
|
|
1051
1076
|
function isFetchSupported(withKeepAlive) {
|
|
1052
1077
|
var isSupported = false;
|
|
1053
1078
|
try {
|
|
1054
|
-
|
|
1055
|
-
isSupported = !!fetchApi;
|
|
1079
|
+
isSupported = !!getGlobalInst("fetch");
|
|
1056
1080
|
var request = getGlobalInst("Request");
|
|
1057
1081
|
if (isSupported && withKeepAlive && request) {
|
|
1058
1082
|
isSupported = _hasProperty(request, "keepalive");
|
|
@@ -1064,9 +1088,9 @@
|
|
|
1064
1088
|
}
|
|
1065
1089
|
function useXDomainRequest() {
|
|
1066
1090
|
if (_useXDomainRequest === null) {
|
|
1067
|
-
_useXDomainRequest = (typeof XDomainRequest !==
|
|
1091
|
+
_useXDomainRequest = (typeof XDomainRequest !== strShimUndefined);
|
|
1068
1092
|
if (_useXDomainRequest && isXhrSupported()) {
|
|
1069
|
-
_useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(
|
|
1093
|
+
_useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(strXMLHttpRequest), "withCredentials");
|
|
1070
1094
|
}
|
|
1071
1095
|
}
|
|
1072
1096
|
return _useXDomainRequest;
|
|
@@ -1074,7 +1098,7 @@
|
|
|
1074
1098
|
function isXhrSupported() {
|
|
1075
1099
|
var isSupported = false;
|
|
1076
1100
|
try {
|
|
1077
|
-
var xmlHttpRequest = getGlobalInst(
|
|
1101
|
+
var xmlHttpRequest = getGlobalInst(strXMLHttpRequest);
|
|
1078
1102
|
isSupported = !!xmlHttpRequest;
|
|
1079
1103
|
}
|
|
1080
1104
|
catch (e) {
|
|
@@ -1128,9 +1152,9 @@
|
|
|
1128
1152
|
var strWarnToConsole = "warnToConsole";
|
|
1129
1153
|
function _sanitizeDiagnosticText(text) {
|
|
1130
1154
|
if (text) {
|
|
1131
|
-
return "\"" + text.replace(/\"/g,
|
|
1155
|
+
return "\"" + text.replace(/\"/g, strEmpty) + "\"";
|
|
1132
1156
|
}
|
|
1133
|
-
return
|
|
1157
|
+
return strEmpty;
|
|
1134
1158
|
}
|
|
1135
1159
|
function _logToConsole(func, message) {
|
|
1136
1160
|
var theConsole = getConsole();
|
|
@@ -1152,12 +1176,12 @@
|
|
|
1152
1176
|
_self.message =
|
|
1153
1177
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
1154
1178
|
msgId;
|
|
1155
|
-
var strProps =
|
|
1179
|
+
var strProps = strEmpty;
|
|
1156
1180
|
if (hasJSON()) {
|
|
1157
1181
|
strProps = getJSON().stringify(properties);
|
|
1158
1182
|
}
|
|
1159
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
1160
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
1183
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty) +
|
|
1184
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty);
|
|
1161
1185
|
_self.message += diagnosticText;
|
|
1162
1186
|
}
|
|
1163
1187
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -1187,7 +1211,7 @@
|
|
|
1187
1211
|
throw message;
|
|
1188
1212
|
}
|
|
1189
1213
|
else {
|
|
1190
|
-
var logFunc = severity ===
|
|
1214
|
+
var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
|
|
1191
1215
|
if (!isUndefined(message.message)) {
|
|
1192
1216
|
var logLevel = _self.consoleLoggingLevel();
|
|
1193
1217
|
if (isUserAct) {
|
|
@@ -1205,7 +1229,7 @@
|
|
|
1205
1229
|
_self.logInternalMessage(severity, message);
|
|
1206
1230
|
}
|
|
1207
1231
|
else {
|
|
1208
|
-
_debugExtMsg("throw" + (severity ===
|
|
1232
|
+
_debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
|
|
1209
1233
|
}
|
|
1210
1234
|
}
|
|
1211
1235
|
};
|
|
@@ -1237,13 +1261,13 @@
|
|
|
1237
1261
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
1238
1262
|
_self.queue.push(message);
|
|
1239
1263
|
_messageCount++;
|
|
1240
|
-
_debugExtMsg((severity ===
|
|
1264
|
+
_debugExtMsg((severity === 1 ? "error" : "warn"), message);
|
|
1241
1265
|
}
|
|
1242
1266
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
1243
1267
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
1244
|
-
var throttleMessage = new _InternalLogMessage(
|
|
1268
|
+
var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
|
|
1245
1269
|
_self.queue.push(throttleMessage);
|
|
1246
|
-
if (severity ===
|
|
1270
|
+
if (severity === 1 ) {
|
|
1247
1271
|
_self.errorToConsole(throttleLimitMessage);
|
|
1248
1272
|
}
|
|
1249
1273
|
else {
|
|
@@ -1272,6 +1296,16 @@
|
|
|
1272
1296
|
}
|
|
1273
1297
|
return DiagnosticLogger;
|
|
1274
1298
|
}());
|
|
1299
|
+
function _getLogger(logger) {
|
|
1300
|
+
return (logger || new DiagnosticLogger());
|
|
1301
|
+
}
|
|
1302
|
+
function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
|
|
1303
|
+
if (isUserAct === void 0) { isUserAct = false; }
|
|
1304
|
+
(logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
|
|
1305
|
+
}
|
|
1306
|
+
function _warnToConsole(logger, message) {
|
|
1307
|
+
_getLogger(logger).warnToConsole(message);
|
|
1308
|
+
}
|
|
1275
1309
|
|
|
1276
1310
|
var strExecutionContextKey = "ctx";
|
|
1277
1311
|
var _defaultPerfManager = null;
|
|
@@ -1411,277 +1445,192 @@
|
|
|
1411
1445
|
}
|
|
1412
1446
|
}
|
|
1413
1447
|
}
|
|
1414
|
-
return func();
|
|
1448
|
+
return func();
|
|
1449
|
+
}
|
|
1450
|
+
function getGblPerfMgr() {
|
|
1451
|
+
return _defaultPerfManager;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
var UInt32Mask = 0x100000000;
|
|
1455
|
+
var MaxUInt32 = 0xffffffff;
|
|
1456
|
+
var _mwcSeeded = false;
|
|
1457
|
+
var _mwcW = 123456789;
|
|
1458
|
+
var _mwcZ = 987654321;
|
|
1459
|
+
function _mwcSeed(seedValue) {
|
|
1460
|
+
if (seedValue < 0) {
|
|
1461
|
+
seedValue >>>= 0;
|
|
1462
|
+
}
|
|
1463
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
1464
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
1465
|
+
_mwcSeeded = true;
|
|
1466
|
+
}
|
|
1467
|
+
function _autoSeedMwc() {
|
|
1468
|
+
try {
|
|
1469
|
+
var now = dateNow() & 0x7fffffff;
|
|
1470
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
1471
|
+
}
|
|
1472
|
+
catch (e) {
|
|
1473
|
+
}
|
|
1415
1474
|
}
|
|
1416
|
-
function
|
|
1417
|
-
|
|
1475
|
+
function randomValue(maxValue) {
|
|
1476
|
+
if (maxValue > 0) {
|
|
1477
|
+
return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
|
|
1478
|
+
}
|
|
1479
|
+
return 0;
|
|
1418
1480
|
}
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1425
|
-
var _hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1426
|
-
_self._hasRun = false;
|
|
1427
|
-
_self.getPlugin = function () {
|
|
1428
|
-
return plugin;
|
|
1429
|
-
};
|
|
1430
|
-
_self.getNext = function () {
|
|
1431
|
-
return _nextProxy;
|
|
1432
|
-
};
|
|
1433
|
-
_self.setNext = function (nextPlugin) {
|
|
1434
|
-
_nextProxy = nextPlugin;
|
|
1435
|
-
};
|
|
1436
|
-
_self.processTelemetry = function (env, itemCtx) {
|
|
1437
|
-
if (!itemCtx) {
|
|
1438
|
-
itemCtx = defItemCtx;
|
|
1439
|
-
}
|
|
1440
|
-
var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
|
|
1441
|
-
doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
|
|
1442
|
-
if (plugin && _hasProcessTelemetry) {
|
|
1443
|
-
_self._hasRun = true;
|
|
1444
|
-
try {
|
|
1445
|
-
itemCtx.setNext(_nextProxy);
|
|
1446
|
-
if (_hasSetNext) {
|
|
1447
|
-
plugin.setNextPlugin(_nextProxy);
|
|
1448
|
-
}
|
|
1449
|
-
_nextProxy && (_nextProxy._hasRun = false);
|
|
1450
|
-
plugin.processTelemetry(env, itemCtx);
|
|
1451
|
-
}
|
|
1452
|
-
catch (error) {
|
|
1453
|
-
var hasRun = _nextProxy && _nextProxy._hasRun;
|
|
1454
|
-
if (!_nextProxy || !hasRun) {
|
|
1455
|
-
itemCtx.diagLog().throwInternal(exports.LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
|
|
1456
|
-
}
|
|
1457
|
-
if (_nextProxy && !hasRun) {
|
|
1458
|
-
_nextProxy.processTelemetry(env, itemCtx);
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
else if (_nextProxy) {
|
|
1463
|
-
_self._hasRun = true;
|
|
1464
|
-
_nextProxy.processTelemetry(env, itemCtx);
|
|
1465
|
-
}
|
|
1466
|
-
}, function () { return ({ item: env }); }, !(env.sync));
|
|
1467
|
-
};
|
|
1481
|
+
function random32(signed) {
|
|
1482
|
+
var value = 0;
|
|
1483
|
+
var c = getCrypto() || getMsCrypto();
|
|
1484
|
+
if (c && c.getRandomValues) {
|
|
1485
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1468
1486
|
}
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
function _createProxyChain(plugins, itemCtx) {
|
|
1473
|
-
var proxies = [];
|
|
1474
|
-
if (plugins && plugins.length > 0) {
|
|
1475
|
-
var lastProxy = null;
|
|
1476
|
-
for (var idx = 0; idx < plugins.length; idx++) {
|
|
1477
|
-
var thePlugin = plugins[idx];
|
|
1478
|
-
if (thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1479
|
-
var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
|
|
1480
|
-
proxies.push(newProxy);
|
|
1481
|
-
if (lastProxy) {
|
|
1482
|
-
lastProxy.setNext(newProxy);
|
|
1483
|
-
}
|
|
1484
|
-
lastProxy = newProxy;
|
|
1485
|
-
}
|
|
1487
|
+
if (value === 0 && isIE()) {
|
|
1488
|
+
if (!_mwcSeeded) {
|
|
1489
|
+
_autoSeedMwc();
|
|
1486
1490
|
}
|
|
1491
|
+
value = mwcRandom32() & MaxUInt32;
|
|
1492
|
+
}
|
|
1493
|
+
if (value === 0) {
|
|
1494
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1495
|
+
}
|
|
1496
|
+
if (!signed) {
|
|
1497
|
+
value >>>= 0;
|
|
1487
1498
|
}
|
|
1488
|
-
return
|
|
1499
|
+
return value;
|
|
1489
1500
|
}
|
|
1490
|
-
function
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
if (proxy) {
|
|
1494
|
-
while (proxy) {
|
|
1495
|
-
var thePlugin = proxy.getPlugin();
|
|
1496
|
-
if (add || thePlugin === startAt) {
|
|
1497
|
-
add = true;
|
|
1498
|
-
plugins.push(thePlugin);
|
|
1499
|
-
}
|
|
1500
|
-
proxy = proxy.getNext();
|
|
1501
|
-
}
|
|
1501
|
+
function mwcRandomSeed(value) {
|
|
1502
|
+
if (!value) {
|
|
1503
|
+
_autoSeedMwc();
|
|
1502
1504
|
}
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
+
else {
|
|
1506
|
+
_mwcSeed(value);
|
|
1505
1507
|
}
|
|
1506
|
-
return _createProxyChain(plugins, itemCtx);
|
|
1507
1508
|
}
|
|
1508
|
-
function
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1509
|
+
function mwcRandom32(signed) {
|
|
1510
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1511
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1512
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1513
|
+
if (!signed) {
|
|
1514
|
+
value >>>= 0;
|
|
1515
|
+
}
|
|
1516
|
+
return value;
|
|
1517
|
+
}
|
|
1518
|
+
function newId(maxLength) {
|
|
1519
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1520
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1521
|
+
var number = random32() >>> 0;
|
|
1522
|
+
var chars = 0;
|
|
1523
|
+
var result = strEmpty;
|
|
1524
|
+
while (result.length < maxLength) {
|
|
1525
|
+
chars++;
|
|
1526
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1527
|
+
number >>>= 6;
|
|
1528
|
+
if (chars === 5) {
|
|
1529
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1530
|
+
chars = 0;
|
|
1531
|
+
}
|
|
1519
1532
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1533
|
+
return result;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
1537
|
+
var version = "2.8.0";
|
|
1538
|
+
var instanceName = "." + newId(6);
|
|
1539
|
+
var _dataUid = 0;
|
|
1540
|
+
function _createAccessor(target, prop, value) {
|
|
1541
|
+
if (_objDefineProperty) {
|
|
1542
|
+
try {
|
|
1543
|
+
_objDefineProperty(target, prop, {
|
|
1544
|
+
value: value,
|
|
1545
|
+
enumerable: false,
|
|
1546
|
+
configurable: true
|
|
1547
|
+
});
|
|
1548
|
+
return true;
|
|
1549
|
+
}
|
|
1550
|
+
catch (e) {
|
|
1523
1551
|
}
|
|
1524
|
-
plugins.push(startAt);
|
|
1525
1552
|
}
|
|
1526
|
-
return
|
|
1553
|
+
return false;
|
|
1527
1554
|
}
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
if (
|
|
1538
|
-
|
|
1539
|
-
}
|
|
1540
|
-
else if (isUndefined(startAt)) {
|
|
1541
|
-
_nextProxy = _createProxyChain(plugins, _self);
|
|
1555
|
+
function _canAcceptData(target) {
|
|
1556
|
+
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1557
|
+
}
|
|
1558
|
+
function _getCache(data, target) {
|
|
1559
|
+
var theCache = target[data.id];
|
|
1560
|
+
if (!theCache) {
|
|
1561
|
+
theCache = {};
|
|
1562
|
+
try {
|
|
1563
|
+
if (_canAcceptData(target)) {
|
|
1564
|
+
if (!_createAccessor(target, data.id, theCache)) {
|
|
1565
|
+
target[data.id] = theCache;
|
|
1542
1566
|
}
|
|
1543
1567
|
}
|
|
1544
1568
|
}
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
};
|
|
1548
|
-
_self.diagLog = function () {
|
|
1549
|
-
return safeGetLogger(core, config);
|
|
1550
|
-
};
|
|
1551
|
-
_self.getCfg = function () {
|
|
1552
|
-
return config;
|
|
1553
|
-
};
|
|
1554
|
-
_self.getExtCfg = function (identifier, defaultValue) {
|
|
1555
|
-
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1556
|
-
var theConfig;
|
|
1557
|
-
if (config) {
|
|
1558
|
-
var extConfig = config.extensionConfig;
|
|
1559
|
-
if (extConfig && identifier) {
|
|
1560
|
-
theConfig = extConfig[identifier];
|
|
1561
|
-
}
|
|
1562
|
-
}
|
|
1563
|
-
return (theConfig ? theConfig : defaultValue);
|
|
1564
|
-
};
|
|
1565
|
-
_self.getConfig = function (identifier, field, defaultValue) {
|
|
1566
|
-
if (defaultValue === void 0) { defaultValue = false; }
|
|
1567
|
-
var theValue;
|
|
1568
|
-
var extConfig = _self.getExtCfg(identifier, null);
|
|
1569
|
-
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1570
|
-
theValue = extConfig[field];
|
|
1571
|
-
}
|
|
1572
|
-
else if (config && !isNullOrUndefined(config[field])) {
|
|
1573
|
-
theValue = config[field];
|
|
1574
|
-
}
|
|
1575
|
-
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1576
|
-
};
|
|
1577
|
-
_self.hasNext = function () {
|
|
1578
|
-
return _nextProxy != null;
|
|
1579
|
-
};
|
|
1580
|
-
_self.getNext = function () {
|
|
1581
|
-
return _nextProxy;
|
|
1582
|
-
};
|
|
1583
|
-
_self.setNext = function (nextPlugin) {
|
|
1584
|
-
_nextProxy = nextPlugin;
|
|
1585
|
-
};
|
|
1586
|
-
_self.processNext = function (env) {
|
|
1587
|
-
var nextPlugin = _nextProxy;
|
|
1588
|
-
if (nextPlugin) {
|
|
1589
|
-
_nextProxy = nextPlugin.getNext();
|
|
1590
|
-
nextPlugin.processTelemetry(env, _self);
|
|
1591
|
-
}
|
|
1592
|
-
};
|
|
1593
|
-
_self.createNew = function (plugins, startAt) {
|
|
1594
|
-
if (plugins === void 0) { plugins = null; }
|
|
1595
|
-
return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1596
|
-
};
|
|
1569
|
+
catch (e) {
|
|
1570
|
+
}
|
|
1597
1571
|
}
|
|
1598
|
-
return
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
_self.setInitialized = function (isInitialized) {
|
|
1619
|
-
_isinitialized = isInitialized;
|
|
1620
|
-
};
|
|
1621
|
-
_self.setNextPlugin = function (next) {
|
|
1622
|
-
_nextPlugin = next;
|
|
1623
|
-
};
|
|
1624
|
-
_self.processNext = function (env, itemCtx) {
|
|
1625
|
-
if (itemCtx) {
|
|
1626
|
-
itemCtx.processNext(env);
|
|
1627
|
-
}
|
|
1628
|
-
else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
|
|
1629
|
-
_nextPlugin.processTelemetry(env, null);
|
|
1572
|
+
return theCache;
|
|
1573
|
+
}
|
|
1574
|
+
function createUniqueNamespace(name, includeVersion) {
|
|
1575
|
+
if (includeVersion === void 0) { includeVersion = false; }
|
|
1576
|
+
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1577
|
+
}
|
|
1578
|
+
function createElmNodeData(name) {
|
|
1579
|
+
var data = {
|
|
1580
|
+
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1581
|
+
accept: function (target) {
|
|
1582
|
+
return _canAcceptData(target);
|
|
1583
|
+
},
|
|
1584
|
+
get: function (target, name, defValue, addDefault) {
|
|
1585
|
+
var theCache = target[data.id];
|
|
1586
|
+
if (!theCache) {
|
|
1587
|
+
if (addDefault) {
|
|
1588
|
+
theCache = _getCache(data, target);
|
|
1589
|
+
theCache[normalizeJsName(name)] = defValue;
|
|
1590
|
+
}
|
|
1591
|
+
return defValue;
|
|
1630
1592
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1638
|
-
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
1593
|
+
return theCache[normalizeJsName(name)];
|
|
1594
|
+
},
|
|
1595
|
+
kill: function (target, name) {
|
|
1596
|
+
if (target && target[name]) {
|
|
1597
|
+
try {
|
|
1598
|
+
delete target[name];
|
|
1639
1599
|
}
|
|
1640
|
-
|
|
1641
|
-
itemCtx = rootCtx.createNew(null, _nextPlugin);
|
|
1600
|
+
catch (e) {
|
|
1642
1601
|
}
|
|
1643
1602
|
}
|
|
1644
|
-
|
|
1645
|
-
};
|
|
1646
|
-
_self._baseTelInit = function (config, core, extensions, pluginChain) {
|
|
1647
|
-
if (config) {
|
|
1648
|
-
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
1649
|
-
}
|
|
1650
|
-
if (!pluginChain && core) {
|
|
1651
|
-
pluginChain = core.getProcessTelContext().getNext();
|
|
1652
|
-
}
|
|
1653
|
-
var nextPlugin = _nextPlugin;
|
|
1654
|
-
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1655
|
-
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
1656
|
-
}
|
|
1657
|
-
_self.core = core;
|
|
1658
|
-
_rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
1659
|
-
_isinitialized = true;
|
|
1660
|
-
};
|
|
1661
|
-
}
|
|
1662
|
-
BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
|
|
1663
|
-
this._baseTelInit(config, core, extensions, pluginChain);
|
|
1603
|
+
}
|
|
1664
1604
|
};
|
|
1665
|
-
return
|
|
1666
|
-
}
|
|
1605
|
+
return data;
|
|
1606
|
+
}
|
|
1667
1607
|
|
|
1668
|
-
var
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1608
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1609
|
+
function _getPluginState(plugin) {
|
|
1610
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1611
|
+
}
|
|
1672
1612
|
function initializePlugins(processContext, extensions) {
|
|
1673
1613
|
var initPlugins = [];
|
|
1674
1614
|
var lastPlugin = null;
|
|
1675
1615
|
var proxy = processContext.getNext();
|
|
1616
|
+
var pluginState;
|
|
1676
1617
|
while (proxy) {
|
|
1677
1618
|
var thePlugin = proxy.getPlugin();
|
|
1678
1619
|
if (thePlugin) {
|
|
1679
1620
|
if (lastPlugin &&
|
|
1680
|
-
isFunction(lastPlugin[
|
|
1681
|
-
isFunction(thePlugin[
|
|
1682
|
-
lastPlugin[
|
|
1621
|
+
isFunction(lastPlugin[strSetNextPlugin]) &&
|
|
1622
|
+
isFunction(thePlugin[strProcessTelemetry])) {
|
|
1623
|
+
lastPlugin[strSetNextPlugin](thePlugin);
|
|
1683
1624
|
}
|
|
1684
|
-
|
|
1625
|
+
var isInitialized = false;
|
|
1626
|
+
if (isFunction(thePlugin[strIsInitialized])) {
|
|
1627
|
+
isInitialized = thePlugin[strIsInitialized]();
|
|
1628
|
+
}
|
|
1629
|
+
else {
|
|
1630
|
+
pluginState = _getPluginState(thePlugin);
|
|
1631
|
+
isInitialized = pluginState[strIsInitialized];
|
|
1632
|
+
}
|
|
1633
|
+
if (!isInitialized) {
|
|
1685
1634
|
initPlugins.push(thePlugin);
|
|
1686
1635
|
}
|
|
1687
1636
|
lastPlugin = thePlugin;
|
|
@@ -1689,15 +1638,22 @@
|
|
|
1689
1638
|
}
|
|
1690
1639
|
}
|
|
1691
1640
|
arrForEach(initPlugins, function (thePlugin) {
|
|
1692
|
-
|
|
1641
|
+
var core = processContext.core();
|
|
1642
|
+
thePlugin.initialize(processContext.getCfg(), core, extensions, processContext.getNext());
|
|
1643
|
+
pluginState = _getPluginState(thePlugin);
|
|
1644
|
+
if (!thePlugin[strCore] && !pluginState[strCore]) {
|
|
1645
|
+
pluginState[strCore] = core;
|
|
1646
|
+
}
|
|
1647
|
+
pluginState[strIsInitialized] = true;
|
|
1648
|
+
delete pluginState[strTeardown];
|
|
1693
1649
|
});
|
|
1694
1650
|
}
|
|
1695
1651
|
function sortPlugins(plugins) {
|
|
1696
1652
|
return plugins.sort(function (extA, extB) {
|
|
1697
1653
|
var result = 0;
|
|
1698
|
-
var bHasProcess = isFunction(extB[
|
|
1699
|
-
if (isFunction(extA[
|
|
1700
|
-
result = bHasProcess ? extA[
|
|
1654
|
+
var bHasProcess = isFunction(extB[strProcessTelemetry]);
|
|
1655
|
+
if (isFunction(extA[strProcessTelemetry])) {
|
|
1656
|
+
result = bHasProcess ? extA[strPriority] - extB[strPriority] : 1;
|
|
1701
1657
|
}
|
|
1702
1658
|
else if (bHasProcess) {
|
|
1703
1659
|
result = -1;
|
|
@@ -1706,80 +1662,361 @@
|
|
|
1706
1662
|
});
|
|
1707
1663
|
}
|
|
1708
1664
|
|
|
1709
|
-
var
|
|
1710
|
-
var
|
|
1711
|
-
var
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1665
|
+
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1666
|
+
var strHasRunFlags = "_hasRun";
|
|
1667
|
+
var strGetTelCtx = "_getTelCtx";
|
|
1668
|
+
var _chainId = 0;
|
|
1669
|
+
function _getNextProxyStart(proxy, core, startAt) {
|
|
1670
|
+
while (proxy) {
|
|
1671
|
+
if (proxy.getPlugin() === startAt) {
|
|
1672
|
+
return proxy;
|
|
1673
|
+
}
|
|
1674
|
+
proxy = proxy.getNext();
|
|
1675
|
+
}
|
|
1676
|
+
return createTelemetryProxyChain([startAt], core.config || {}, core);
|
|
1677
|
+
}
|
|
1678
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1679
|
+
var _nextProxy = null;
|
|
1680
|
+
var _onComplete = [];
|
|
1681
|
+
if (startAt !== null) {
|
|
1682
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;
|
|
1683
|
+
}
|
|
1684
|
+
var context = {
|
|
1685
|
+
_next: _moveNext,
|
|
1686
|
+
ctx: {
|
|
1687
|
+
core: function () {
|
|
1688
|
+
return core;
|
|
1689
|
+
},
|
|
1690
|
+
diagLog: function () {
|
|
1691
|
+
return safeGetLogger(core, config);
|
|
1692
|
+
},
|
|
1693
|
+
getCfg: function () {
|
|
1694
|
+
return config;
|
|
1695
|
+
},
|
|
1696
|
+
getExtCfg: _getExtCfg,
|
|
1697
|
+
getConfig: _getConfig,
|
|
1698
|
+
hasNext: function () {
|
|
1699
|
+
return !!_nextProxy;
|
|
1700
|
+
},
|
|
1701
|
+
getNext: function () {
|
|
1702
|
+
return _nextProxy;
|
|
1703
|
+
},
|
|
1704
|
+
setNext: function (nextPlugin) {
|
|
1705
|
+
_nextProxy = nextPlugin;
|
|
1706
|
+
},
|
|
1707
|
+
iterate: _iterateChain,
|
|
1708
|
+
onComplete: _addOnComplete
|
|
1709
|
+
}
|
|
1710
|
+
};
|
|
1711
|
+
function _addOnComplete(onComplete, that) {
|
|
1712
|
+
var args = [];
|
|
1713
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1714
|
+
args[_i - 2] = arguments[_i];
|
|
1715
|
+
}
|
|
1716
|
+
if (onComplete) {
|
|
1717
|
+
_onComplete.push({
|
|
1718
|
+
func: onComplete,
|
|
1719
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1720
|
+
args: args
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
function _moveNext() {
|
|
1725
|
+
var nextProxy = _nextProxy;
|
|
1726
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1727
|
+
if (!nextProxy) {
|
|
1728
|
+
var onComplete = _onComplete;
|
|
1729
|
+
if (onComplete && onComplete.length > 0) {
|
|
1730
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
1731
|
+
try {
|
|
1732
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1733
|
+
}
|
|
1734
|
+
catch (e) {
|
|
1735
|
+
_throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1736
|
+
}
|
|
1737
|
+
});
|
|
1738
|
+
_onComplete = [];
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
return nextProxy;
|
|
1742
|
+
}
|
|
1743
|
+
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1744
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1745
|
+
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
1746
|
+
var theConfig;
|
|
1747
|
+
if (config) {
|
|
1748
|
+
var extConfig = config.extensionConfig;
|
|
1749
|
+
if (extConfig && identifier) {
|
|
1750
|
+
theConfig = extConfig[identifier];
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
if (!theConfig) {
|
|
1754
|
+
theConfig = defaultValue;
|
|
1755
|
+
}
|
|
1756
|
+
else if (isObject(defaultValue)) {
|
|
1757
|
+
if (mergeDefault !== 0 ) {
|
|
1758
|
+
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1759
|
+
if (config && mergeDefault === 2 ) {
|
|
1760
|
+
objForEachKey(defaultValue, function (field) {
|
|
1761
|
+
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1762
|
+
var cfgValue = config[field];
|
|
1763
|
+
if (!isNullOrUndefined(cfgValue)) {
|
|
1764
|
+
newConfig_1[field] = cfgValue;
|
|
1765
|
+
}
|
|
1727
1766
|
}
|
|
1728
1767
|
});
|
|
1729
1768
|
}
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1769
|
+
theConfig = newConfig_1;
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
return theConfig;
|
|
1773
|
+
}
|
|
1774
|
+
function _getConfig(identifier, field, defaultValue) {
|
|
1775
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
1776
|
+
var theValue;
|
|
1777
|
+
var extConfig = _getExtCfg(identifier, null);
|
|
1778
|
+
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1779
|
+
theValue = extConfig[field];
|
|
1780
|
+
}
|
|
1781
|
+
else if (config && !isNullOrUndefined(config[field])) {
|
|
1782
|
+
theValue = config[field];
|
|
1783
|
+
}
|
|
1784
|
+
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1785
|
+
}
|
|
1786
|
+
function _iterateChain(cb) {
|
|
1787
|
+
var nextPlugin;
|
|
1788
|
+
while (!!(nextPlugin = context._next())) {
|
|
1789
|
+
var plugin = nextPlugin.getPlugin();
|
|
1790
|
+
if (plugin) {
|
|
1791
|
+
cb(plugin);
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
return context;
|
|
1796
|
+
}
|
|
1797
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1798
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1799
|
+
var context = internalContext.ctx;
|
|
1800
|
+
function _processNext(env) {
|
|
1801
|
+
var nextPlugin = internalContext._next();
|
|
1802
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1803
|
+
return !nextPlugin;
|
|
1804
|
+
}
|
|
1805
|
+
function _createNew(plugins, startAt) {
|
|
1806
|
+
if (plugins === void 0) { plugins = null; }
|
|
1807
|
+
if (isArray(plugins)) {
|
|
1808
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1809
|
+
}
|
|
1810
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1811
|
+
}
|
|
1812
|
+
context.processNext = _processNext;
|
|
1813
|
+
context.createNew = _createNew;
|
|
1814
|
+
return context;
|
|
1815
|
+
}
|
|
1816
|
+
function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {
|
|
1817
|
+
var config = core.config || {};
|
|
1818
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1819
|
+
var context = internalContext.ctx;
|
|
1820
|
+
function _processNext(unloadState) {
|
|
1821
|
+
var nextPlugin = internalContext._next();
|
|
1822
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1823
|
+
return !nextPlugin;
|
|
1824
|
+
}
|
|
1825
|
+
function _createNew(plugins, startAt) {
|
|
1826
|
+
if (plugins === void 0) { plugins = null; }
|
|
1827
|
+
if (isArray(plugins)) {
|
|
1828
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1829
|
+
}
|
|
1830
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), core, startAt);
|
|
1831
|
+
}
|
|
1832
|
+
context.processNext = _processNext;
|
|
1833
|
+
context.createNew = _createNew;
|
|
1834
|
+
return context;
|
|
1835
|
+
}
|
|
1836
|
+
function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {
|
|
1837
|
+
var config = core.config || {};
|
|
1838
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1839
|
+
var context = internalContext.ctx;
|
|
1840
|
+
function _processNext(updateState) {
|
|
1841
|
+
return context.iterate(function (plugin) {
|
|
1842
|
+
if (isFunction(plugin.update)) {
|
|
1843
|
+
plugin.update(context, updateState);
|
|
1844
|
+
}
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
function _createNew(plugins, startAt) {
|
|
1848
|
+
if (plugins === void 0) { plugins = null; }
|
|
1849
|
+
if (isArray(plugins)) {
|
|
1850
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1851
|
+
}
|
|
1852
|
+
return createProcessTelemetryUpdateContext(plugins || context.getNext(), core, startAt);
|
|
1853
|
+
}
|
|
1854
|
+
context.processNext = _processNext;
|
|
1855
|
+
context.createNew = _createNew;
|
|
1856
|
+
return context;
|
|
1857
|
+
}
|
|
1858
|
+
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
1859
|
+
var firstProxy = null;
|
|
1860
|
+
var add = startAt ? false : true;
|
|
1861
|
+
if (isArray(plugins) && plugins.length > 0) {
|
|
1862
|
+
var lastProxy_1 = null;
|
|
1863
|
+
arrForEach(plugins, function (thePlugin) {
|
|
1864
|
+
if (!add && startAt === thePlugin) {
|
|
1865
|
+
add = true;
|
|
1866
|
+
}
|
|
1867
|
+
if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1868
|
+
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
1869
|
+
if (!firstProxy) {
|
|
1870
|
+
firstProxy = newProxy;
|
|
1737
1871
|
}
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1872
|
+
if (lastProxy_1) {
|
|
1873
|
+
lastProxy_1._setNext(newProxy);
|
|
1874
|
+
}
|
|
1875
|
+
lastProxy_1 = newProxy;
|
|
1876
|
+
}
|
|
1742
1877
|
});
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1878
|
+
}
|
|
1879
|
+
if (startAt && !firstProxy) {
|
|
1880
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1881
|
+
}
|
|
1882
|
+
return firstProxy;
|
|
1883
|
+
}
|
|
1884
|
+
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1885
|
+
var nextProxy = null;
|
|
1886
|
+
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1887
|
+
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1888
|
+
var chainId;
|
|
1889
|
+
if (plugin) {
|
|
1890
|
+
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1891
|
+
}
|
|
1892
|
+
else {
|
|
1893
|
+
chainId = "Unknown-0-" + _chainId++;
|
|
1894
|
+
}
|
|
1895
|
+
var proxyChain = {
|
|
1896
|
+
getPlugin: function () {
|
|
1897
|
+
return plugin;
|
|
1898
|
+
},
|
|
1899
|
+
getNext: function () {
|
|
1900
|
+
return nextProxy;
|
|
1901
|
+
},
|
|
1902
|
+
processTelemetry: _processTelemetry,
|
|
1903
|
+
unload: _unloadPlugin,
|
|
1904
|
+
update: _updatePlugin,
|
|
1905
|
+
_id: chainId,
|
|
1906
|
+
_setNext: function (nextPlugin) {
|
|
1907
|
+
nextProxy = nextPlugin;
|
|
1908
|
+
}
|
|
1909
|
+
};
|
|
1910
|
+
function _getTelCtx() {
|
|
1911
|
+
var itemCtx;
|
|
1912
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1913
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1914
|
+
}
|
|
1915
|
+
if (!itemCtx) {
|
|
1916
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1917
|
+
}
|
|
1918
|
+
return itemCtx;
|
|
1919
|
+
}
|
|
1920
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1921
|
+
var hasRun = false;
|
|
1922
|
+
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1923
|
+
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1924
|
+
if (!hasRunContext) {
|
|
1925
|
+
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1926
|
+
}
|
|
1927
|
+
itemCtx.setNext(nextProxy);
|
|
1928
|
+
if (plugin) {
|
|
1929
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1930
|
+
hasRunContext[chainId] = true;
|
|
1931
|
+
try {
|
|
1932
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty;
|
|
1933
|
+
if (nextId) {
|
|
1934
|
+
hasRunContext[nextId] = false;
|
|
1935
|
+
}
|
|
1936
|
+
hasRun = processPluginFn(itemCtx);
|
|
1747
1937
|
}
|
|
1748
|
-
|
|
1938
|
+
catch (error) {
|
|
1939
|
+
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1940
|
+
if (hasNextRun) {
|
|
1941
|
+
hasRun = true;
|
|
1942
|
+
}
|
|
1943
|
+
if (!nextProxy || !hasNextRun) {
|
|
1944
|
+
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
}, details, isAsync);
|
|
1749
1948
|
}
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1949
|
+
return hasRun;
|
|
1950
|
+
}
|
|
1951
|
+
function _processTelemetry(env, itemCtx) {
|
|
1952
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
1953
|
+
function _callProcessTelemetry(itemCtx) {
|
|
1954
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
1955
|
+
return false;
|
|
1757
1956
|
}
|
|
1957
|
+
var pluginState = _getPluginState(plugin);
|
|
1958
|
+
if (pluginState.teardown || pluginState[strDisabled]) {
|
|
1959
|
+
return false;
|
|
1960
|
+
}
|
|
1961
|
+
if (hasSetNext) {
|
|
1962
|
+
plugin.setNextPlugin(nextProxy);
|
|
1963
|
+
}
|
|
1964
|
+
plugin.processTelemetry(env, itemCtx);
|
|
1965
|
+
return true;
|
|
1758
1966
|
}
|
|
1759
|
-
function
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1967
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1968
|
+
itemCtx.processNext(env);
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1972
|
+
function _callTeardown() {
|
|
1973
|
+
var hasRun = false;
|
|
1974
|
+
if (plugin) {
|
|
1975
|
+
var pluginState = _getPluginState(plugin);
|
|
1976
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1977
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1978
|
+
pluginState[strCore] = null;
|
|
1979
|
+
pluginState[strTeardown] = true;
|
|
1980
|
+
pluginState[strIsInitialized] = false;
|
|
1981
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1982
|
+
hasRun = true;
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1763
1985
|
}
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1986
|
+
return hasRun;
|
|
1987
|
+
}
|
|
1988
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1989
|
+
unloadCtx.processNext(unloadState);
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
function _updatePlugin(updateCtx, updateState) {
|
|
1993
|
+
function _callUpdate() {
|
|
1994
|
+
var hasRun = false;
|
|
1995
|
+
if (plugin) {
|
|
1996
|
+
var pluginState = _getPluginState(plugin);
|
|
1997
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1998
|
+
if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1999
|
+
if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
|
|
2000
|
+
hasRun = true;
|
|
1769
2001
|
}
|
|
1770
|
-
}
|
|
1771
|
-
_addChannelQueue(extensionQueue_1);
|
|
2002
|
+
}
|
|
1772
2003
|
}
|
|
2004
|
+
return hasRun;
|
|
2005
|
+
}
|
|
2006
|
+
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
2007
|
+
updateCtx.processNext(updateState);
|
|
1773
2008
|
}
|
|
1774
|
-
return _this;
|
|
1775
2009
|
}
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
2010
|
+
return objFreeze(proxyChain);
|
|
2011
|
+
}
|
|
2012
|
+
var ProcessTelemetryContext = /** @class */ (function () {
|
|
2013
|
+
function ProcessTelemetryContext(pluginChain, config, core, startAt) {
|
|
2014
|
+
var _self = this;
|
|
2015
|
+
var context = createProcessTelemetryContext(pluginChain, config, core, startAt);
|
|
2016
|
+
proxyFunctions(_self, context, objKeys(context));
|
|
2017
|
+
}
|
|
2018
|
+
return ProcessTelemetryContext;
|
|
2019
|
+
}());
|
|
1783
2020
|
|
|
1784
2021
|
var strToGMTString = "toGMTString";
|
|
1785
2022
|
var strToUTCString = "toUTCString";
|
|
@@ -1789,7 +2026,6 @@
|
|
|
1789
2026
|
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
1790
2027
|
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
1791
2028
|
var strConfigCookieMgr = "_ckMgr";
|
|
1792
|
-
var strEmpty = "";
|
|
1793
2029
|
var _supportsCookies = null;
|
|
1794
2030
|
var _allowUaSameSite = null;
|
|
1795
2031
|
var _parsedCookieValue = null;
|
|
@@ -1934,119 +2170,617 @@
|
|
|
1934
2170
|
delCookie(name, _formatCookieValue(strEmpty, values));
|
|
1935
2171
|
result = true;
|
|
1936
2172
|
}
|
|
1937
|
-
return result;
|
|
1938
|
-
}
|
|
1939
|
-
};
|
|
1940
|
-
cookieMgr[strConfigCookieMgr] = cookieMgr;
|
|
1941
|
-
return cookieMgr;
|
|
1942
|
-
}
|
|
1943
|
-
function areCookiesSupported(logger) {
|
|
1944
|
-
if (_supportsCookies === null) {
|
|
1945
|
-
_supportsCookies = false;
|
|
1946
|
-
try {
|
|
1947
|
-
var doc = _doc || {};
|
|
1948
|
-
_supportsCookies = doc[strCookie] !== undefined;
|
|
2173
|
+
return result;
|
|
2174
|
+
}
|
|
2175
|
+
};
|
|
2176
|
+
cookieMgr[strConfigCookieMgr] = cookieMgr;
|
|
2177
|
+
return cookieMgr;
|
|
2178
|
+
}
|
|
2179
|
+
function areCookiesSupported(logger) {
|
|
2180
|
+
if (_supportsCookies === null) {
|
|
2181
|
+
_supportsCookies = false;
|
|
2182
|
+
try {
|
|
2183
|
+
var doc = _doc || {};
|
|
2184
|
+
_supportsCookies = doc[strCookie] !== undefined;
|
|
2185
|
+
}
|
|
2186
|
+
catch (e) {
|
|
2187
|
+
_throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
return _supportsCookies;
|
|
2191
|
+
}
|
|
2192
|
+
function _extractParts(theValue) {
|
|
2193
|
+
var values = {};
|
|
2194
|
+
if (theValue && theValue.length) {
|
|
2195
|
+
var parts = strTrim(theValue).split(";");
|
|
2196
|
+
arrForEach(parts, function (thePart) {
|
|
2197
|
+
thePart = strTrim(thePart || strEmpty);
|
|
2198
|
+
if (thePart) {
|
|
2199
|
+
var idx = thePart.indexOf("=");
|
|
2200
|
+
if (idx === -1) {
|
|
2201
|
+
values[thePart] = null;
|
|
2202
|
+
}
|
|
2203
|
+
else {
|
|
2204
|
+
values[strTrim(thePart.substring(0, idx))] = strTrim(thePart.substring(idx + 1));
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
});
|
|
2208
|
+
}
|
|
2209
|
+
return values;
|
|
2210
|
+
}
|
|
2211
|
+
function _formatDate(theDate, func) {
|
|
2212
|
+
if (isFunction(theDate[func])) {
|
|
2213
|
+
return theDate[func]();
|
|
2214
|
+
}
|
|
2215
|
+
return null;
|
|
2216
|
+
}
|
|
2217
|
+
function _formatCookieValue(value, values) {
|
|
2218
|
+
var cookieValue = value || strEmpty;
|
|
2219
|
+
objForEachKey(values, function (name, theValue) {
|
|
2220
|
+
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
|
|
2221
|
+
});
|
|
2222
|
+
return cookieValue;
|
|
2223
|
+
}
|
|
2224
|
+
function _getCookieValue(name) {
|
|
2225
|
+
var cookieValue = strEmpty;
|
|
2226
|
+
if (_doc) {
|
|
2227
|
+
var theCookie = _doc[strCookie] || strEmpty;
|
|
2228
|
+
if (_parsedCookieValue !== theCookie) {
|
|
2229
|
+
_cookieCache = _extractParts(theCookie);
|
|
2230
|
+
_parsedCookieValue = theCookie;
|
|
2231
|
+
}
|
|
2232
|
+
cookieValue = strTrim(_cookieCache[name] || strEmpty);
|
|
2233
|
+
}
|
|
2234
|
+
return cookieValue;
|
|
2235
|
+
}
|
|
2236
|
+
function _setCookieValue(name, cookieValue) {
|
|
2237
|
+
if (_doc) {
|
|
2238
|
+
_doc[strCookie] = name + "=" + cookieValue;
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
function uaDisallowsSameSiteNone(userAgent) {
|
|
2242
|
+
if (!isString(userAgent)) {
|
|
2243
|
+
return false;
|
|
2244
|
+
}
|
|
2245
|
+
if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
|
|
2246
|
+
return true;
|
|
2247
|
+
}
|
|
2248
|
+
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
|
|
2249
|
+
return true;
|
|
2250
|
+
}
|
|
2251
|
+
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
|
|
2252
|
+
return true;
|
|
2253
|
+
}
|
|
2254
|
+
if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
|
|
2255
|
+
return true;
|
|
2256
|
+
}
|
|
2257
|
+
if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
|
|
2258
|
+
return true;
|
|
2259
|
+
}
|
|
2260
|
+
if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
|
|
2261
|
+
return true;
|
|
2262
|
+
}
|
|
2263
|
+
return false;
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
var strIKey = "iKey";
|
|
2267
|
+
var strExtensionConfig = "extensionConfig";
|
|
2268
|
+
|
|
2269
|
+
var ChannelControllerPriority = 500;
|
|
2270
|
+
var ChannelValidationMessage = "Channel has invalid priority - ";
|
|
2271
|
+
function _addChannelQueue(channelQueue, queue, config, core) {
|
|
2272
|
+
if (queue && isArray(queue) && queue.length > 0) {
|
|
2273
|
+
queue = queue.sort(function (a, b) {
|
|
2274
|
+
return a.priority - b.priority;
|
|
2275
|
+
});
|
|
2276
|
+
arrForEach(queue, function (queueItem) {
|
|
2277
|
+
if (queueItem.priority < ChannelControllerPriority) {
|
|
2278
|
+
throwError(ChannelValidationMessage + queueItem.identifier);
|
|
2279
|
+
}
|
|
2280
|
+
});
|
|
2281
|
+
channelQueue.push({
|
|
2282
|
+
queue: objFreeze(queue),
|
|
2283
|
+
chain: createTelemetryProxyChain(queue, config, core)
|
|
2284
|
+
});
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
function createChannelControllerPlugin(channelQueue, core) {
|
|
2288
|
+
var _a;
|
|
2289
|
+
function _getTelCtx() {
|
|
2290
|
+
return createProcessTelemetryContext(null, core.config, core, null);
|
|
2291
|
+
}
|
|
2292
|
+
function _processChannelQueue(theChannels, itemCtx, processFn, onComplete) {
|
|
2293
|
+
var waiting = theChannels ? (theChannels.length + 1) : 1;
|
|
2294
|
+
function _runChainOnComplete() {
|
|
2295
|
+
waiting--;
|
|
2296
|
+
if (waiting === 0) {
|
|
2297
|
+
onComplete && onComplete();
|
|
2298
|
+
onComplete = null;
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
if (waiting > 0) {
|
|
2302
|
+
arrForEach(theChannels, function (channels) {
|
|
2303
|
+
if (channels && channels.queue.length > 0) {
|
|
2304
|
+
var channelChain = channels.chain;
|
|
2305
|
+
var chainCtx = itemCtx.createNew(channelChain);
|
|
2306
|
+
chainCtx.onComplete(_runChainOnComplete);
|
|
2307
|
+
processFn(chainCtx);
|
|
2308
|
+
}
|
|
2309
|
+
else {
|
|
2310
|
+
waiting--;
|
|
2311
|
+
}
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
_runChainOnComplete();
|
|
2315
|
+
}
|
|
2316
|
+
function _doUpdate(updateCtx, updateState) {
|
|
2317
|
+
var theUpdateState = updateState || {
|
|
2318
|
+
reason: 0
|
|
2319
|
+
};
|
|
2320
|
+
_processChannelQueue(channelQueue, updateCtx, function (chainCtx) {
|
|
2321
|
+
chainCtx[strProcessNext](theUpdateState);
|
|
2322
|
+
}, function () {
|
|
2323
|
+
updateCtx[strProcessNext](theUpdateState);
|
|
2324
|
+
});
|
|
2325
|
+
return true;
|
|
2326
|
+
}
|
|
2327
|
+
function _doTeardown(unloadCtx, unloadState) {
|
|
2328
|
+
var theUnloadState = unloadState || {
|
|
2329
|
+
reason: 0 ,
|
|
2330
|
+
isAsync: false
|
|
2331
|
+
};
|
|
2332
|
+
_processChannelQueue(channelQueue, unloadCtx, function (chainCtx) {
|
|
2333
|
+
chainCtx[strProcessNext](theUnloadState);
|
|
2334
|
+
}, function () {
|
|
2335
|
+
unloadCtx[strProcessNext](theUnloadState);
|
|
2336
|
+
isInitialized = false;
|
|
2337
|
+
});
|
|
2338
|
+
return true;
|
|
2339
|
+
}
|
|
2340
|
+
function _getChannel(pluginIdentifier) {
|
|
2341
|
+
var thePlugin = null;
|
|
2342
|
+
if (channelQueue && channelQueue.length > 0) {
|
|
2343
|
+
arrForEach(channelQueue, function (channels) {
|
|
2344
|
+
if (channels && channels.queue.length > 0) {
|
|
2345
|
+
arrForEach(channels.queue, function (ext) {
|
|
2346
|
+
if (ext.identifier === pluginIdentifier) {
|
|
2347
|
+
thePlugin = ext;
|
|
2348
|
+
return -1;
|
|
2349
|
+
}
|
|
2350
|
+
});
|
|
2351
|
+
if (thePlugin) {
|
|
2352
|
+
return -1;
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
});
|
|
2356
|
+
}
|
|
2357
|
+
return thePlugin;
|
|
2358
|
+
}
|
|
2359
|
+
var isInitialized = false;
|
|
2360
|
+
var channelController = (_a = {
|
|
2361
|
+
identifier: "ChannelControllerPlugin",
|
|
2362
|
+
priority: ChannelControllerPriority,
|
|
2363
|
+
initialize: function (config, core, extensions, pluginChain) {
|
|
2364
|
+
isInitialized = true;
|
|
2365
|
+
arrForEach(channelQueue, function (channels) {
|
|
2366
|
+
if (channels && channels.queue.length > 0) {
|
|
2367
|
+
initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);
|
|
2368
|
+
}
|
|
2369
|
+
});
|
|
2370
|
+
},
|
|
2371
|
+
isInitialized: function () {
|
|
2372
|
+
return isInitialized;
|
|
2373
|
+
},
|
|
2374
|
+
processTelemetry: function (item, itemCtx) {
|
|
2375
|
+
_processChannelQueue(channelQueue, itemCtx || _getTelCtx(), function (chainCtx) {
|
|
2376
|
+
chainCtx[strProcessNext](item);
|
|
2377
|
+
}, function () {
|
|
2378
|
+
itemCtx[strProcessNext](item);
|
|
2379
|
+
});
|
|
2380
|
+
},
|
|
2381
|
+
update: _doUpdate
|
|
2382
|
+
},
|
|
2383
|
+
_a[strPause] = function () {
|
|
2384
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2385
|
+
chainCtx.iterate(function (plugin) {
|
|
2386
|
+
plugin[strPause] && plugin[strPause]();
|
|
2387
|
+
});
|
|
2388
|
+
}, null);
|
|
2389
|
+
},
|
|
2390
|
+
_a[strResume] = function () {
|
|
2391
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2392
|
+
chainCtx.iterate(function (plugin) {
|
|
2393
|
+
plugin[strResume] && plugin[strResume]();
|
|
2394
|
+
});
|
|
2395
|
+
}, null);
|
|
2396
|
+
},
|
|
2397
|
+
_a[strTeardown] = _doTeardown,
|
|
2398
|
+
_a.getChannel = _getChannel,
|
|
2399
|
+
_a.flush = function (isAsync, callBack, sendReason, cbTimeout) {
|
|
2400
|
+
var waiting = 1;
|
|
2401
|
+
var doneIterating = false;
|
|
2402
|
+
var cbTimer = null;
|
|
2403
|
+
cbTimeout = cbTimeout || 5000;
|
|
2404
|
+
function doCallback() {
|
|
2405
|
+
waiting--;
|
|
2406
|
+
if (doneIterating && waiting === 0) {
|
|
2407
|
+
if (cbTimer) {
|
|
2408
|
+
clearTimeout(cbTimer);
|
|
2409
|
+
cbTimer = null;
|
|
2410
|
+
}
|
|
2411
|
+
callBack && callBack(doneIterating);
|
|
2412
|
+
callBack = null;
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2416
|
+
chainCtx.iterate(function (plugin) {
|
|
2417
|
+
if (plugin.flush) {
|
|
2418
|
+
waiting++;
|
|
2419
|
+
var handled_1 = false;
|
|
2420
|
+
if (!plugin.flush(isAsync, function () {
|
|
2421
|
+
handled_1 = true;
|
|
2422
|
+
doCallback();
|
|
2423
|
+
}, sendReason)) {
|
|
2424
|
+
if (!handled_1) {
|
|
2425
|
+
if (isAsync && cbTimer == null) {
|
|
2426
|
+
cbTimer = setTimeout(function () {
|
|
2427
|
+
cbTimer = null;
|
|
2428
|
+
doCallback();
|
|
2429
|
+
}, cbTimeout);
|
|
2430
|
+
}
|
|
2431
|
+
else {
|
|
2432
|
+
doCallback();
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
});
|
|
2438
|
+
}, function () {
|
|
2439
|
+
doneIterating = true;
|
|
2440
|
+
doCallback();
|
|
2441
|
+
});
|
|
2442
|
+
return true;
|
|
2443
|
+
},
|
|
2444
|
+
_a._setQueue = function (queue) {
|
|
2445
|
+
channelQueue = queue;
|
|
2446
|
+
},
|
|
2447
|
+
_a);
|
|
2448
|
+
return channelController;
|
|
2449
|
+
}
|
|
2450
|
+
function createChannelQueues(channels, extensions, config, core) {
|
|
2451
|
+
var channelQueue = [];
|
|
2452
|
+
if (channels) {
|
|
2453
|
+
arrForEach(channels, function (queue) { return _addChannelQueue(channelQueue, queue, config, core); });
|
|
2454
|
+
}
|
|
2455
|
+
if (extensions) {
|
|
2456
|
+
var extensionQueue_1 = [];
|
|
2457
|
+
arrForEach(extensions, function (plugin) {
|
|
2458
|
+
if (plugin.priority > ChannelControllerPriority) {
|
|
2459
|
+
extensionQueue_1.push(plugin);
|
|
2460
|
+
}
|
|
2461
|
+
});
|
|
2462
|
+
_addChannelQueue(channelQueue, extensionQueue_1, config, core);
|
|
2463
|
+
}
|
|
2464
|
+
return channelQueue;
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
function createUnloadHandlerContainer() {
|
|
2468
|
+
var handlers = [];
|
|
2469
|
+
function _addHandler(handler) {
|
|
2470
|
+
if (handler) {
|
|
2471
|
+
handlers.push(handler);
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
2475
|
+
arrForEach(handlers, function (handler) {
|
|
2476
|
+
try {
|
|
2477
|
+
handler(unloadCtx, unloadState);
|
|
2478
|
+
}
|
|
2479
|
+
catch (e) {
|
|
2480
|
+
_throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
2481
|
+
}
|
|
2482
|
+
});
|
|
2483
|
+
handlers = [];
|
|
2484
|
+
}
|
|
2485
|
+
return {
|
|
2486
|
+
add: _addHandler,
|
|
2487
|
+
run: _runHandlers
|
|
2488
|
+
};
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
var strGetPlugin = "getPlugin";
|
|
2492
|
+
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
2493
|
+
function BaseTelemetryPlugin() {
|
|
2494
|
+
var _self = this;
|
|
2495
|
+
var _isinitialized;
|
|
2496
|
+
var _rootCtx;
|
|
2497
|
+
var _nextPlugin;
|
|
2498
|
+
var _unloadHandlerContainer;
|
|
2499
|
+
var _hooks;
|
|
2500
|
+
_initDefaults();
|
|
2501
|
+
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
2502
|
+
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
2503
|
+
_setDefaults(config, core, pluginChain);
|
|
2504
|
+
_isinitialized = true;
|
|
2505
|
+
};
|
|
2506
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
2507
|
+
var core = _self.core;
|
|
2508
|
+
if (!core || (unloadCtx && core !== unloadCtx.core())) {
|
|
2509
|
+
return;
|
|
2510
|
+
}
|
|
2511
|
+
var result;
|
|
2512
|
+
var unloadDone = false;
|
|
2513
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
2514
|
+
var theUnloadState = unloadState || {
|
|
2515
|
+
reason: 0 ,
|
|
2516
|
+
isAsync: false
|
|
2517
|
+
};
|
|
2518
|
+
function _unloadCallback() {
|
|
2519
|
+
if (!unloadDone) {
|
|
2520
|
+
unloadDone = true;
|
|
2521
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
2522
|
+
arrForEach(_hooks, function (fn) {
|
|
2523
|
+
fn.rm();
|
|
2524
|
+
});
|
|
2525
|
+
_hooks = [];
|
|
2526
|
+
if (result === true) {
|
|
2527
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
2528
|
+
}
|
|
2529
|
+
_initDefaults();
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
2533
|
+
_unloadCallback();
|
|
2534
|
+
}
|
|
2535
|
+
else {
|
|
2536
|
+
result = true;
|
|
2537
|
+
}
|
|
2538
|
+
return result;
|
|
2539
|
+
};
|
|
2540
|
+
_self.update = function (updateCtx, updateState) {
|
|
2541
|
+
var core = _self.core;
|
|
2542
|
+
if (!core || (updateCtx && core !== updateCtx.core())) {
|
|
2543
|
+
return;
|
|
2544
|
+
}
|
|
2545
|
+
var result;
|
|
2546
|
+
var updateDone = false;
|
|
2547
|
+
var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
2548
|
+
var theUpdateState = updateState || {
|
|
2549
|
+
reason: 0
|
|
2550
|
+
};
|
|
2551
|
+
function _updateCallback() {
|
|
2552
|
+
if (!updateDone) {
|
|
2553
|
+
updateDone = true;
|
|
2554
|
+
_setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
|
|
2558
|
+
_updateCallback();
|
|
2559
|
+
}
|
|
2560
|
+
else {
|
|
2561
|
+
result = true;
|
|
2562
|
+
}
|
|
2563
|
+
return result;
|
|
2564
|
+
};
|
|
2565
|
+
_self._addHook = function (hooks) {
|
|
2566
|
+
if (hooks) {
|
|
2567
|
+
if (isArray(hooks)) {
|
|
2568
|
+
_hooks = _hooks.concat(hooks);
|
|
2569
|
+
}
|
|
2570
|
+
else {
|
|
2571
|
+
_hooks.push(hooks);
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
};
|
|
2575
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
2576
|
+
});
|
|
2577
|
+
_self.diagLog = function (itemCtx) {
|
|
2578
|
+
return _getTelCtx(itemCtx).diagLog();
|
|
2579
|
+
};
|
|
2580
|
+
_self[strIsInitialized] = function () {
|
|
2581
|
+
return _isinitialized;
|
|
2582
|
+
};
|
|
2583
|
+
_self.setInitialized = function (isInitialized) {
|
|
2584
|
+
_isinitialized = isInitialized;
|
|
2585
|
+
};
|
|
2586
|
+
_self[strSetNextPlugin] = function (next) {
|
|
2587
|
+
_nextPlugin = next;
|
|
2588
|
+
};
|
|
2589
|
+
_self.processNext = function (env, itemCtx) {
|
|
2590
|
+
if (itemCtx) {
|
|
2591
|
+
itemCtx.processNext(env);
|
|
2592
|
+
}
|
|
2593
|
+
else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
|
|
2594
|
+
_nextPlugin.processTelemetry(env, null);
|
|
2595
|
+
}
|
|
2596
|
+
};
|
|
2597
|
+
_self._getTelCtx = _getTelCtx;
|
|
2598
|
+
function _getTelCtx(currentCtx) {
|
|
2599
|
+
if (currentCtx === void 0) { currentCtx = null; }
|
|
2600
|
+
var itemCtx = currentCtx;
|
|
2601
|
+
if (!itemCtx) {
|
|
2602
|
+
var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
|
|
2603
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
2604
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
2605
|
+
}
|
|
2606
|
+
else {
|
|
2607
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin);
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
return itemCtx;
|
|
2611
|
+
}
|
|
2612
|
+
function _setDefaults(config, core, pluginChain) {
|
|
2613
|
+
if (config) {
|
|
2614
|
+
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
2615
|
+
}
|
|
2616
|
+
if (!pluginChain && core) {
|
|
2617
|
+
pluginChain = core.getProcessTelContext().getNext();
|
|
2618
|
+
}
|
|
2619
|
+
var nextPlugin = _nextPlugin;
|
|
2620
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
2621
|
+
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
2622
|
+
}
|
|
2623
|
+
_self.core = core;
|
|
2624
|
+
_rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
1949
2625
|
}
|
|
1950
|
-
|
|
1951
|
-
|
|
2626
|
+
function _initDefaults() {
|
|
2627
|
+
_isinitialized = false;
|
|
2628
|
+
_self.core = null;
|
|
2629
|
+
_rootCtx = null;
|
|
2630
|
+
_nextPlugin = null;
|
|
2631
|
+
_hooks = [];
|
|
2632
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
1952
2633
|
}
|
|
1953
2634
|
}
|
|
1954
|
-
return
|
|
1955
|
-
}
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
2635
|
+
return BaseTelemetryPlugin;
|
|
2636
|
+
}());
|
|
2637
|
+
|
|
2638
|
+
var TelemetryInitializerPlugin = /** @class */ (function (_super) {
|
|
2639
|
+
__extendsFn(TelemetryInitializerPlugin, _super);
|
|
2640
|
+
function TelemetryInitializerPlugin() {
|
|
2641
|
+
var _this = _super.call(this) || this;
|
|
2642
|
+
_this.identifier = "TelemetryInitializerPlugin";
|
|
2643
|
+
_this.priority = 199;
|
|
2644
|
+
var _id;
|
|
2645
|
+
var _initializers;
|
|
2646
|
+
_initDefaults();
|
|
2647
|
+
dynamicProto(TelemetryInitializerPlugin, _this, function (_self, _base) {
|
|
2648
|
+
_self.addTelemetryInitializer = function (telemetryInitializer) {
|
|
2649
|
+
var theInitializer = {
|
|
2650
|
+
id: _id++,
|
|
2651
|
+
fn: telemetryInitializer
|
|
2652
|
+
};
|
|
2653
|
+
_initializers.push(theInitializer);
|
|
2654
|
+
var handler = {
|
|
2655
|
+
remove: function () {
|
|
2656
|
+
arrForEach(_initializers, function (initializer, idx) {
|
|
2657
|
+
if (initializer.id === theInitializer.id) {
|
|
2658
|
+
_initializers.splice(idx, 1);
|
|
2659
|
+
return -1;
|
|
2660
|
+
}
|
|
2661
|
+
});
|
|
2662
|
+
}
|
|
2663
|
+
};
|
|
2664
|
+
return handler;
|
|
2665
|
+
};
|
|
2666
|
+
_self.processTelemetry = function (item, itemCtx) {
|
|
2667
|
+
var doNotSendItem = false;
|
|
2668
|
+
var telemetryInitializersCount = _initializers.length;
|
|
2669
|
+
for (var i = 0; i < telemetryInitializersCount; ++i) {
|
|
2670
|
+
var telemetryInitializer = _initializers[i];
|
|
2671
|
+
if (telemetryInitializer) {
|
|
2672
|
+
try {
|
|
2673
|
+
if (telemetryInitializer.fn.apply(null, [item]) === false) {
|
|
2674
|
+
doNotSendItem = true;
|
|
2675
|
+
break;
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
catch (e) {
|
|
2679
|
+
_throwInternal(itemCtx.diagLog(), 1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
1966
2682
|
}
|
|
1967
|
-
|
|
1968
|
-
|
|
2683
|
+
if (!doNotSendItem) {
|
|
2684
|
+
_self.processNext(item, itemCtx);
|
|
1969
2685
|
}
|
|
1970
|
-
}
|
|
2686
|
+
};
|
|
2687
|
+
_self[strDoTeardown] = function () {
|
|
2688
|
+
_initDefaults();
|
|
2689
|
+
};
|
|
1971
2690
|
});
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
function _formatDate(theDate, func) {
|
|
1976
|
-
if (isFunction(theDate[func])) {
|
|
1977
|
-
return theDate[func]();
|
|
1978
|
-
}
|
|
1979
|
-
return null;
|
|
1980
|
-
}
|
|
1981
|
-
function _formatCookieValue(value, values) {
|
|
1982
|
-
var cookieValue = value || strEmpty;
|
|
1983
|
-
objForEachKey(values, function (name, theValue) {
|
|
1984
|
-
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
|
|
1985
|
-
});
|
|
1986
|
-
return cookieValue;
|
|
1987
|
-
}
|
|
1988
|
-
function _getCookieValue(name) {
|
|
1989
|
-
var cookieValue = strEmpty;
|
|
1990
|
-
if (_doc) {
|
|
1991
|
-
var theCookie = _doc[strCookie] || strEmpty;
|
|
1992
|
-
if (_parsedCookieValue !== theCookie) {
|
|
1993
|
-
_cookieCache = _extractParts(theCookie);
|
|
1994
|
-
_parsedCookieValue = theCookie;
|
|
2691
|
+
function _initDefaults() {
|
|
2692
|
+
_id = 0;
|
|
2693
|
+
_initializers = [];
|
|
1995
2694
|
}
|
|
1996
|
-
|
|
1997
|
-
}
|
|
1998
|
-
return cookieValue;
|
|
1999
|
-
}
|
|
2000
|
-
function _setCookieValue(name, cookieValue) {
|
|
2001
|
-
if (_doc) {
|
|
2002
|
-
_doc[strCookie] = name + "=" + cookieValue;
|
|
2003
|
-
}
|
|
2004
|
-
}
|
|
2005
|
-
function uaDisallowsSameSiteNone(userAgent) {
|
|
2006
|
-
if (!isString(userAgent)) {
|
|
2007
|
-
return false;
|
|
2008
|
-
}
|
|
2009
|
-
if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
|
|
2010
|
-
return true;
|
|
2011
|
-
}
|
|
2012
|
-
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
|
|
2013
|
-
return true;
|
|
2014
|
-
}
|
|
2015
|
-
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
|
|
2016
|
-
return true;
|
|
2017
|
-
}
|
|
2018
|
-
if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
|
|
2019
|
-
return true;
|
|
2020
|
-
}
|
|
2021
|
-
if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
|
|
2022
|
-
return true;
|
|
2023
|
-
}
|
|
2024
|
-
if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
|
|
2025
|
-
return true;
|
|
2695
|
+
return _this;
|
|
2026
2696
|
}
|
|
2027
|
-
return
|
|
2028
|
-
}
|
|
2697
|
+
return TelemetryInitializerPlugin;
|
|
2698
|
+
}(BaseTelemetryPlugin));
|
|
2029
2699
|
|
|
2030
|
-
var
|
|
2700
|
+
var strValidationError = "Plugins must provide initialize method";
|
|
2031
2701
|
var strNotificationManager = "_notificationManager";
|
|
2702
|
+
var strSdkUnloadingError = "SDK is still unloading...";
|
|
2703
|
+
var strSdkNotInitialized = "SDK is not initialized";
|
|
2704
|
+
var defaultInitConfig = {
|
|
2705
|
+
loggingLevelConsole: 1
|
|
2706
|
+
};
|
|
2032
2707
|
function _createPerfManager(core, notificationMgr) {
|
|
2033
2708
|
return new PerfManager(notificationMgr);
|
|
2034
2709
|
}
|
|
2710
|
+
function _validateExtensions(logger, channelPriority, allExtensions) {
|
|
2711
|
+
var coreExtensions = [];
|
|
2712
|
+
var extPriorities = {};
|
|
2713
|
+
arrForEach(allExtensions, function (ext) {
|
|
2714
|
+
if (isNullOrUndefined(ext) || isNullOrUndefined(ext.initialize)) {
|
|
2715
|
+
throwError(strValidationError);
|
|
2716
|
+
}
|
|
2717
|
+
var extPriority = ext.priority;
|
|
2718
|
+
var identifier = ext.identifier;
|
|
2719
|
+
if (ext && extPriority) {
|
|
2720
|
+
if (!isNullOrUndefined(extPriorities[extPriority])) {
|
|
2721
|
+
_warnToConsole(logger, "Two extensions have same priority #" + extPriority + " - " + extPriorities[extPriority] + ", " + identifier);
|
|
2722
|
+
}
|
|
2723
|
+
else {
|
|
2724
|
+
extPriorities[extPriority] = identifier;
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
if (!extPriority || extPriority < channelPriority) {
|
|
2728
|
+
coreExtensions.push(ext);
|
|
2729
|
+
}
|
|
2730
|
+
});
|
|
2731
|
+
return {
|
|
2732
|
+
all: allExtensions,
|
|
2733
|
+
core: coreExtensions
|
|
2734
|
+
};
|
|
2735
|
+
}
|
|
2736
|
+
function _isPluginPresent(thePlugin, plugins) {
|
|
2737
|
+
var exists = false;
|
|
2738
|
+
arrForEach(plugins, function (plugin) {
|
|
2739
|
+
if (plugin === thePlugin) {
|
|
2740
|
+
exists = true;
|
|
2741
|
+
return -1;
|
|
2742
|
+
}
|
|
2743
|
+
});
|
|
2744
|
+
return exists;
|
|
2745
|
+
}
|
|
2746
|
+
function _createDummyNotificationManager() {
|
|
2747
|
+
var _a;
|
|
2748
|
+
return objCreateFn((_a = {},
|
|
2749
|
+
_a[strAddNotificationListener] = function (listener) { },
|
|
2750
|
+
_a[strRemoveNotificationListener] = function (listener) { },
|
|
2751
|
+
_a[strEventsSent] = function (events) { },
|
|
2752
|
+
_a[strEventsDiscarded] = function (events, reason) { },
|
|
2753
|
+
_a[strEventsSendRequest] = function (sendReason, isAsync) { },
|
|
2754
|
+
_a));
|
|
2755
|
+
}
|
|
2035
2756
|
var BaseCore$2 = /** @class */ (function () {
|
|
2036
2757
|
function BaseCore() {
|
|
2037
|
-
var _isInitialized
|
|
2758
|
+
var _isInitialized;
|
|
2038
2759
|
var _eventQueue;
|
|
2039
|
-
var _channelController;
|
|
2040
2760
|
var _notificationManager;
|
|
2041
2761
|
var _perfManager;
|
|
2762
|
+
var _cfgPerfManager;
|
|
2042
2763
|
var _cookieManager;
|
|
2764
|
+
var _pluginChain;
|
|
2765
|
+
var _configExtensions;
|
|
2766
|
+
var _coreExtensions;
|
|
2767
|
+
var _channelControl;
|
|
2768
|
+
var _channelConfig;
|
|
2769
|
+
var _channelQueue;
|
|
2770
|
+
var _isUnloading;
|
|
2771
|
+
var _telemetryInitializerPlugin;
|
|
2772
|
+
var _internalLogsEventName;
|
|
2773
|
+
var _evtNamespace;
|
|
2774
|
+
var _unloadHandlers;
|
|
2775
|
+
var _debugListener;
|
|
2776
|
+
var _internalLogPoller = 0;
|
|
2043
2777
|
dynamicProto(BaseCore, this, function (_self) {
|
|
2044
|
-
|
|
2045
|
-
_channelController = new ChannelController();
|
|
2046
|
-
_self.logger = new DiagnosticLogger({ loggingLevelConsole: exports.LoggingSeverity.CRITICAL });
|
|
2047
|
-
_eventQueue = [];
|
|
2778
|
+
_initDefaults();
|
|
2048
2779
|
_self.isInitialized = function () { return _isInitialized; };
|
|
2049
2780
|
_self.initialize = function (config, extensions, logger, notificationManager) {
|
|
2781
|
+
if (_isUnloading) {
|
|
2782
|
+
throwError(strSdkUnloadingError);
|
|
2783
|
+
}
|
|
2050
2784
|
if (_self.isInitialized()) {
|
|
2051
2785
|
throwError("Core should not be initialized more than once");
|
|
2052
2786
|
}
|
|
@@ -2056,185 +2790,460 @@
|
|
|
2056
2790
|
_notificationManager = notificationManager;
|
|
2057
2791
|
_self[strNotificationManager] = notificationManager;
|
|
2058
2792
|
_self.config = config || {};
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
}
|
|
2062
|
-
if (_self.config.enablePerfMgr) {
|
|
2063
|
-
setValue(_self.config, "createPerfMgr", _createPerfManager);
|
|
2064
|
-
}
|
|
2793
|
+
_initDebugListener(config);
|
|
2794
|
+
_initPerfManager(config);
|
|
2065
2795
|
config.extensions = isNullOrUndefined(config.extensions) ? [] : config.extensions;
|
|
2066
|
-
|
|
2067
|
-
extConfig.NotificationManager = notificationManager;
|
|
2796
|
+
_initExtConfig(config);
|
|
2068
2797
|
if (logger) {
|
|
2069
2798
|
_self.logger = logger;
|
|
2070
2799
|
}
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
arrForEach(allExtensions, function (ext) {
|
|
2077
|
-
if (isNullOrUndefined(ext) || isNullOrUndefined(ext.initialize)) {
|
|
2078
|
-
throwError(validationError);
|
|
2079
|
-
}
|
|
2080
|
-
var extPriority = ext.priority;
|
|
2081
|
-
var identifier = ext.identifier;
|
|
2082
|
-
if (ext && extPriority) {
|
|
2083
|
-
if (!isNullOrUndefined(extPriorities[extPriority])) {
|
|
2084
|
-
logger.warnToConsole("Two extensions have same priority #" + extPriority + " - " + extPriorities[extPriority] + ", " + identifier);
|
|
2085
|
-
}
|
|
2086
|
-
else {
|
|
2087
|
-
extPriorities[extPriority] = identifier;
|
|
2088
|
-
}
|
|
2089
|
-
}
|
|
2090
|
-
if (!extPriority || extPriority < _channelController.priority) {
|
|
2091
|
-
coreExtensions.push(ext);
|
|
2092
|
-
}
|
|
2093
|
-
});
|
|
2094
|
-
allExtensions.push(_channelController);
|
|
2095
|
-
coreExtensions.push(_channelController);
|
|
2096
|
-
allExtensions = sortPlugins(allExtensions);
|
|
2097
|
-
_self._extensions = allExtensions;
|
|
2098
|
-
initializePlugins(new ProcessTelemetryContext([_channelController], config, _self), allExtensions);
|
|
2099
|
-
initializePlugins(new ProcessTelemetryContext(coreExtensions, config, _self), allExtensions);
|
|
2100
|
-
_self._extensions = coreExtensions;
|
|
2101
|
-
if (_self.getTransmissionControls().length === 0) {
|
|
2800
|
+
_configExtensions = [];
|
|
2801
|
+
_configExtensions.push.apply(_configExtensions, __spreadArrayFn(__spreadArrayFn([], extensions, false), config.extensions));
|
|
2802
|
+
_channelConfig = (config || {}).channels;
|
|
2803
|
+
_initPluginChain(config, null);
|
|
2804
|
+
if (!_channelQueue || _channelQueue.length === 0) {
|
|
2102
2805
|
throwError("No channels available");
|
|
2103
2806
|
}
|
|
2104
2807
|
_isInitialized = true;
|
|
2105
2808
|
_self.releaseQueue();
|
|
2106
2809
|
};
|
|
2107
2810
|
_self.getTransmissionControls = function () {
|
|
2108
|
-
|
|
2811
|
+
var controls = [];
|
|
2812
|
+
if (_channelQueue) {
|
|
2813
|
+
arrForEach(_channelQueue, function (channels) {
|
|
2814
|
+
controls.push(channels.queue);
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
return objFreeze(controls);
|
|
2109
2818
|
};
|
|
2110
2819
|
_self.track = function (telemetryItem) {
|
|
2111
2820
|
setValue(telemetryItem, strIKey, _self.config.instrumentationKey, null, isNotTruthy);
|
|
2112
2821
|
setValue(telemetryItem, "time", toISOString(new Date()), null, isNotTruthy);
|
|
2113
2822
|
setValue(telemetryItem, "ver", "4.0", null, isNullOrUndefined);
|
|
2114
|
-
if (_self.isInitialized()) {
|
|
2115
|
-
|
|
2823
|
+
if (!_isUnloading && _self.isInitialized()) {
|
|
2824
|
+
_createTelCtx().processNext(telemetryItem);
|
|
2116
2825
|
}
|
|
2117
2826
|
else {
|
|
2118
2827
|
_eventQueue.push(telemetryItem);
|
|
2119
2828
|
}
|
|
2120
2829
|
};
|
|
2121
|
-
_self.getProcessTelContext =
|
|
2122
|
-
var extensions = _self._extensions;
|
|
2123
|
-
var thePlugins = extensions;
|
|
2124
|
-
if (!extensions || extensions.length === 0) {
|
|
2125
|
-
thePlugins = [_channelController];
|
|
2126
|
-
}
|
|
2127
|
-
return new ProcessTelemetryContext(thePlugins, _self.config, _self);
|
|
2128
|
-
};
|
|
2830
|
+
_self.getProcessTelContext = _createTelCtx;
|
|
2129
2831
|
_self.getNotifyMgr = function () {
|
|
2130
2832
|
if (!_notificationManager) {
|
|
2131
|
-
_notificationManager =
|
|
2132
|
-
addNotificationListener: function (listener) { },
|
|
2133
|
-
removeNotificationListener: function (listener) { },
|
|
2134
|
-
eventsSent: function (events) { },
|
|
2135
|
-
eventsDiscarded: function (events, reason) { },
|
|
2136
|
-
eventsSendRequest: function (sendReason, isAsync) { }
|
|
2137
|
-
});
|
|
2833
|
+
_notificationManager = _createDummyNotificationManager();
|
|
2138
2834
|
_self[strNotificationManager] = _notificationManager;
|
|
2139
2835
|
}
|
|
2140
2836
|
return _notificationManager;
|
|
2141
2837
|
};
|
|
2838
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2839
|
+
if (_notificationManager) {
|
|
2840
|
+
_notificationManager[strAddNotificationListener](listener);
|
|
2841
|
+
}
|
|
2842
|
+
};
|
|
2843
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2844
|
+
if (_notificationManager) {
|
|
2845
|
+
_notificationManager[strRemoveNotificationListener](listener);
|
|
2846
|
+
}
|
|
2847
|
+
};
|
|
2142
2848
|
_self.getCookieMgr = function () {
|
|
2143
2849
|
if (!_cookieManager) {
|
|
2144
2850
|
_cookieManager = createCookieMgr(_self.config, _self.logger);
|
|
2145
2851
|
}
|
|
2146
|
-
return _cookieManager;
|
|
2147
|
-
};
|
|
2148
|
-
_self.setCookieMgr = function (cookieMgr) {
|
|
2149
|
-
_cookieManager = cookieMgr;
|
|
2150
|
-
};
|
|
2151
|
-
_self.getPerfMgr = function () {
|
|
2152
|
-
if (!_perfManager) {
|
|
2153
|
-
if (_self.config && _self.config.enablePerfMgr && isFunction(_self.config.createPerfMgr)) {
|
|
2154
|
-
|
|
2155
|
-
}
|
|
2852
|
+
return _cookieManager;
|
|
2853
|
+
};
|
|
2854
|
+
_self.setCookieMgr = function (cookieMgr) {
|
|
2855
|
+
_cookieManager = cookieMgr;
|
|
2856
|
+
};
|
|
2857
|
+
_self.getPerfMgr = function () {
|
|
2858
|
+
if (!_perfManager && !_cfgPerfManager) {
|
|
2859
|
+
if (_self.config && _self.config.enablePerfMgr && isFunction(_self.config.createPerfMgr)) {
|
|
2860
|
+
_cfgPerfManager = _self.config.createPerfMgr(_self, _self.getNotifyMgr());
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
return _perfManager || _cfgPerfManager || getGblPerfMgr();
|
|
2864
|
+
};
|
|
2865
|
+
_self.setPerfMgr = function (perfMgr) {
|
|
2866
|
+
_perfManager = perfMgr;
|
|
2867
|
+
};
|
|
2868
|
+
_self.eventCnt = function () {
|
|
2869
|
+
return _eventQueue.length;
|
|
2870
|
+
};
|
|
2871
|
+
_self.releaseQueue = function () {
|
|
2872
|
+
if (_isInitialized && _eventQueue.length > 0) {
|
|
2873
|
+
var eventQueue = _eventQueue;
|
|
2874
|
+
_eventQueue = [];
|
|
2875
|
+
arrForEach(eventQueue, function (event) {
|
|
2876
|
+
_createTelCtx().processNext(event);
|
|
2877
|
+
});
|
|
2878
|
+
}
|
|
2879
|
+
};
|
|
2880
|
+
_self.pollInternalLogs = function (eventName) {
|
|
2881
|
+
_internalLogsEventName = eventName || null;
|
|
2882
|
+
var interval = _self.config.diagnosticLogInterval;
|
|
2883
|
+
if (!interval || !(interval > 0)) {
|
|
2884
|
+
interval = 10000;
|
|
2885
|
+
}
|
|
2886
|
+
if (_internalLogPoller) {
|
|
2887
|
+
clearInterval(_internalLogPoller);
|
|
2888
|
+
}
|
|
2889
|
+
_internalLogPoller = setInterval(function () {
|
|
2890
|
+
_flushInternalLogs();
|
|
2891
|
+
}, interval);
|
|
2892
|
+
return _internalLogPoller;
|
|
2893
|
+
};
|
|
2894
|
+
_self.stopPollingInternalLogs = function () {
|
|
2895
|
+
if (_internalLogPoller) {
|
|
2896
|
+
clearInterval(_internalLogPoller);
|
|
2897
|
+
_internalLogPoller = 0;
|
|
2898
|
+
_flushInternalLogs();
|
|
2899
|
+
}
|
|
2900
|
+
};
|
|
2901
|
+
proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, ["addTelemetryInitializer"]);
|
|
2902
|
+
_self.unload = function (isAsync, unloadComplete, cbTimeout) {
|
|
2903
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
2904
|
+
if (!_isInitialized) {
|
|
2905
|
+
throwError(strSdkNotInitialized);
|
|
2906
|
+
}
|
|
2907
|
+
if (_isUnloading) {
|
|
2908
|
+
throwError(strSdkUnloadingError);
|
|
2909
|
+
}
|
|
2910
|
+
var unloadState = {
|
|
2911
|
+
reason: 50 ,
|
|
2912
|
+
isAsync: isAsync,
|
|
2913
|
+
flushComplete: false
|
|
2914
|
+
};
|
|
2915
|
+
var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self);
|
|
2916
|
+
processUnloadCtx.onComplete(function () {
|
|
2917
|
+
_initDefaults();
|
|
2918
|
+
unloadComplete && unloadComplete(unloadState);
|
|
2919
|
+
}, _self);
|
|
2920
|
+
function _doUnload(flushComplete) {
|
|
2921
|
+
unloadState.flushComplete = flushComplete;
|
|
2922
|
+
_isUnloading = true;
|
|
2923
|
+
_unloadHandlers.run(processUnloadCtx, unloadState);
|
|
2924
|
+
_self.stopPollingInternalLogs();
|
|
2925
|
+
processUnloadCtx.processNext(unloadState);
|
|
2926
|
+
}
|
|
2927
|
+
if (!_flushChannels(isAsync, _doUnload, 6 , cbTimeout)) {
|
|
2928
|
+
_doUnload(false);
|
|
2929
|
+
}
|
|
2930
|
+
};
|
|
2931
|
+
_self.getPlugin = _getPlugin;
|
|
2932
|
+
_self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {
|
|
2933
|
+
if (!plugin) {
|
|
2934
|
+
addCb && addCb(false);
|
|
2935
|
+
_logOrThrowError(strValidationError);
|
|
2936
|
+
return;
|
|
2937
|
+
}
|
|
2938
|
+
var existingPlugin = _getPlugin(plugin.identifier);
|
|
2939
|
+
if (existingPlugin && !replaceExisting) {
|
|
2940
|
+
addCb && addCb(false);
|
|
2941
|
+
_logOrThrowError("Plugin [" + plugin.identifier + "] is already loaded!");
|
|
2942
|
+
return;
|
|
2943
|
+
}
|
|
2944
|
+
var updateState = {
|
|
2945
|
+
reason: 16
|
|
2946
|
+
};
|
|
2947
|
+
function _addPlugin(removed) {
|
|
2948
|
+
_configExtensions.push(plugin);
|
|
2949
|
+
updateState.added = [plugin];
|
|
2950
|
+
_initPluginChain(_self.config, updateState);
|
|
2951
|
+
addCb && addCb(true);
|
|
2952
|
+
}
|
|
2953
|
+
if (existingPlugin) {
|
|
2954
|
+
var removedPlugins_1 = [existingPlugin.plugin];
|
|
2955
|
+
var unloadState = {
|
|
2956
|
+
reason: 2 ,
|
|
2957
|
+
isAsync: !!isAsync
|
|
2958
|
+
};
|
|
2959
|
+
_removePlugins(removedPlugins_1, unloadState, function (removed) {
|
|
2960
|
+
if (!removed) {
|
|
2961
|
+
addCb && addCb(false);
|
|
2962
|
+
}
|
|
2963
|
+
else {
|
|
2964
|
+
updateState.removed = removedPlugins_1;
|
|
2965
|
+
updateState.reason |= 32 ;
|
|
2966
|
+
_addPlugin();
|
|
2967
|
+
}
|
|
2968
|
+
});
|
|
2969
|
+
}
|
|
2970
|
+
else {
|
|
2971
|
+
_addPlugin();
|
|
2972
|
+
}
|
|
2973
|
+
};
|
|
2974
|
+
_self.evtNamespace = function () {
|
|
2975
|
+
return _evtNamespace;
|
|
2976
|
+
};
|
|
2977
|
+
_self.flush = _flushChannels;
|
|
2978
|
+
proxyFunctionAs(_self, "addUnloadCb", function () { return _unloadHandlers; }, "add");
|
|
2979
|
+
function _initDefaults() {
|
|
2980
|
+
_isInitialized = false;
|
|
2981
|
+
_self.config = objExtend(true, {}, defaultInitConfig);
|
|
2982
|
+
_self.logger = new DiagnosticLogger(_self.config);
|
|
2983
|
+
_self._extensions = [];
|
|
2984
|
+
_telemetryInitializerPlugin = new TelemetryInitializerPlugin();
|
|
2985
|
+
_eventQueue = [];
|
|
2986
|
+
_notificationManager = null;
|
|
2987
|
+
_perfManager = null;
|
|
2988
|
+
_cfgPerfManager = null;
|
|
2989
|
+
_cookieManager = null;
|
|
2990
|
+
_pluginChain = null;
|
|
2991
|
+
_coreExtensions = null;
|
|
2992
|
+
_configExtensions = [];
|
|
2993
|
+
_channelControl = null;
|
|
2994
|
+
_channelConfig = null;
|
|
2995
|
+
_channelQueue = null;
|
|
2996
|
+
_isUnloading = false;
|
|
2997
|
+
_internalLogsEventName = null;
|
|
2998
|
+
_evtNamespace = createUniqueNamespace("AIBaseCore", true);
|
|
2999
|
+
_unloadHandlers = createUnloadHandlerContainer();
|
|
3000
|
+
}
|
|
3001
|
+
function _createTelCtx() {
|
|
3002
|
+
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
3003
|
+
}
|
|
3004
|
+
function _initPluginChain(config, updateState) {
|
|
3005
|
+
var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
|
|
3006
|
+
_coreExtensions = theExtensions.core;
|
|
3007
|
+
_pluginChain = null;
|
|
3008
|
+
var allExtensions = theExtensions.all;
|
|
3009
|
+
_channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, config, _self));
|
|
3010
|
+
if (_channelControl) {
|
|
3011
|
+
var idx = allExtensions.indexOf(_channelControl);
|
|
3012
|
+
if (idx !== -1) {
|
|
3013
|
+
allExtensions.splice(idx, 1);
|
|
3014
|
+
}
|
|
3015
|
+
idx = _coreExtensions.indexOf(_channelControl);
|
|
3016
|
+
if (idx !== -1) {
|
|
3017
|
+
_coreExtensions.splice(idx, 1);
|
|
3018
|
+
}
|
|
3019
|
+
_channelControl._setQueue(_channelQueue);
|
|
3020
|
+
}
|
|
3021
|
+
else {
|
|
3022
|
+
_channelControl = createChannelControllerPlugin(_channelQueue, _self);
|
|
3023
|
+
}
|
|
3024
|
+
allExtensions.push(_channelControl);
|
|
3025
|
+
_coreExtensions.push(_channelControl);
|
|
3026
|
+
_self._extensions = sortPlugins(allExtensions);
|
|
3027
|
+
_channelControl.initialize(config, _self, allExtensions);
|
|
3028
|
+
initializePlugins(_createTelCtx(), allExtensions);
|
|
3029
|
+
_self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
|
|
3030
|
+
if (updateState) {
|
|
3031
|
+
_doUpdate(updateState);
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
function _getPlugin(pluginIdentifier) {
|
|
3035
|
+
var theExt = null;
|
|
3036
|
+
var thePlugin = null;
|
|
3037
|
+
arrForEach(_self._extensions, function (ext) {
|
|
3038
|
+
if (ext.identifier === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
|
|
3039
|
+
thePlugin = ext;
|
|
3040
|
+
return -1;
|
|
3041
|
+
}
|
|
3042
|
+
});
|
|
3043
|
+
if (!thePlugin && _channelControl) {
|
|
3044
|
+
thePlugin = _channelControl.getChannel(pluginIdentifier);
|
|
3045
|
+
}
|
|
3046
|
+
if (thePlugin) {
|
|
3047
|
+
theExt = {
|
|
3048
|
+
plugin: thePlugin,
|
|
3049
|
+
setEnabled: function (enabled) {
|
|
3050
|
+
_getPluginState(thePlugin)[strDisabled] = !enabled;
|
|
3051
|
+
},
|
|
3052
|
+
isEnabled: function () {
|
|
3053
|
+
var pluginState = _getPluginState(thePlugin);
|
|
3054
|
+
return !pluginState[strTeardown] && !pluginState[strDisabled];
|
|
3055
|
+
},
|
|
3056
|
+
remove: function (isAsync, removeCb) {
|
|
3057
|
+
if (isAsync === void 0) { isAsync = true; }
|
|
3058
|
+
var pluginsToRemove = [thePlugin];
|
|
3059
|
+
var unloadState = {
|
|
3060
|
+
reason: 1 ,
|
|
3061
|
+
isAsync: isAsync
|
|
3062
|
+
};
|
|
3063
|
+
_removePlugins(pluginsToRemove, unloadState, function (removed) {
|
|
3064
|
+
if (removed) {
|
|
3065
|
+
_initPluginChain(_self.config, {
|
|
3066
|
+
reason: 32 ,
|
|
3067
|
+
removed: pluginsToRemove
|
|
3068
|
+
});
|
|
3069
|
+
}
|
|
3070
|
+
removeCb && removeCb(removed);
|
|
3071
|
+
});
|
|
3072
|
+
}
|
|
3073
|
+
};
|
|
3074
|
+
}
|
|
3075
|
+
return theExt;
|
|
3076
|
+
}
|
|
3077
|
+
function _getPluginChain() {
|
|
3078
|
+
if (!_pluginChain) {
|
|
3079
|
+
var extensions = (_coreExtensions || []).slice();
|
|
3080
|
+
if (extensions.indexOf(_telemetryInitializerPlugin) === -1) {
|
|
3081
|
+
extensions.push(_telemetryInitializerPlugin);
|
|
3082
|
+
}
|
|
3083
|
+
_pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _self.config, _self);
|
|
3084
|
+
}
|
|
3085
|
+
return _pluginChain;
|
|
3086
|
+
}
|
|
3087
|
+
function _removePlugins(thePlugins, unloadState, removeComplete) {
|
|
3088
|
+
if (thePlugins && thePlugins.length > 0) {
|
|
3089
|
+
var unloadChain = createTelemetryProxyChain(thePlugins, _self.config, _self);
|
|
3090
|
+
var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self);
|
|
3091
|
+
unloadCtx.onComplete(function () {
|
|
3092
|
+
var removed = false;
|
|
3093
|
+
var newConfigExtensions = [];
|
|
3094
|
+
arrForEach(_configExtensions, function (plugin, idx) {
|
|
3095
|
+
if (!_isPluginPresent(plugin, thePlugins)) {
|
|
3096
|
+
newConfigExtensions.push(plugin);
|
|
3097
|
+
}
|
|
3098
|
+
else {
|
|
3099
|
+
removed = true;
|
|
3100
|
+
}
|
|
3101
|
+
});
|
|
3102
|
+
_configExtensions = newConfigExtensions;
|
|
3103
|
+
var newChannelConfig = [];
|
|
3104
|
+
if (_channelConfig) {
|
|
3105
|
+
arrForEach(_channelConfig, function (queue, idx) {
|
|
3106
|
+
var newQueue = [];
|
|
3107
|
+
arrForEach(queue, function (channel) {
|
|
3108
|
+
if (!_isPluginPresent(channel, thePlugins)) {
|
|
3109
|
+
newQueue.push(channel);
|
|
3110
|
+
}
|
|
3111
|
+
else {
|
|
3112
|
+
removed = true;
|
|
3113
|
+
}
|
|
3114
|
+
});
|
|
3115
|
+
newChannelConfig.push(newQueue);
|
|
3116
|
+
});
|
|
3117
|
+
_channelConfig = newChannelConfig;
|
|
3118
|
+
}
|
|
3119
|
+
removeComplete && removeComplete(removed);
|
|
3120
|
+
});
|
|
3121
|
+
unloadCtx.processNext(unloadState);
|
|
3122
|
+
}
|
|
3123
|
+
else {
|
|
3124
|
+
removeComplete(false);
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
function _flushInternalLogs() {
|
|
3128
|
+
var queue = _self.logger ? _self.logger.queue : [];
|
|
3129
|
+
if (queue) {
|
|
3130
|
+
arrForEach(queue, function (logMessage) {
|
|
3131
|
+
var item = {
|
|
3132
|
+
name: _internalLogsEventName ? _internalLogsEventName : "InternalMessageId: " + logMessage.messageId,
|
|
3133
|
+
iKey: _self.config.instrumentationKey,
|
|
3134
|
+
time: toISOString(new Date()),
|
|
3135
|
+
baseType: _InternalLogMessage.dataType,
|
|
3136
|
+
baseData: { message: logMessage.message }
|
|
3137
|
+
};
|
|
3138
|
+
_self.track(item);
|
|
3139
|
+
});
|
|
3140
|
+
queue.length = 0;
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
function _flushChannels(isAsync, callBack, sendReason, cbTimeout) {
|
|
3144
|
+
if (_channelControl) {
|
|
3145
|
+
return _channelControl.flush(isAsync, callBack, sendReason || 6 , cbTimeout);
|
|
3146
|
+
}
|
|
3147
|
+
callBack && callBack(false);
|
|
3148
|
+
return true;
|
|
3149
|
+
}
|
|
3150
|
+
function _initDebugListener(config) {
|
|
3151
|
+
if (config.disableDbgExt === true && _debugListener) {
|
|
3152
|
+
_notificationManager[strRemoveNotificationListener](_debugListener);
|
|
3153
|
+
_debugListener = null;
|
|
3154
|
+
}
|
|
3155
|
+
if (_notificationManager && !_debugListener && config.disableDbgExt !== true) {
|
|
3156
|
+
_debugListener = getDebugListener(config);
|
|
3157
|
+
_notificationManager[strAddNotificationListener](_debugListener);
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
function _initPerfManager(config) {
|
|
3161
|
+
if (!config.enablePerfMgr && _cfgPerfManager) {
|
|
3162
|
+
_cfgPerfManager = null;
|
|
3163
|
+
}
|
|
3164
|
+
if (config.enablePerfMgr) {
|
|
3165
|
+
setValue(_self.config, "createPerfMgr", _createPerfManager);
|
|
2156
3166
|
}
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
}
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
if (_eventQueue.length > 0) {
|
|
2167
|
-
arrForEach(_eventQueue, function (event) {
|
|
2168
|
-
_self.getProcessTelContext().processNext(event);
|
|
2169
|
-
});
|
|
2170
|
-
_eventQueue = [];
|
|
3167
|
+
}
|
|
3168
|
+
function _initExtConfig(config) {
|
|
3169
|
+
var extConfig = getSetValue(config, strExtensionConfig);
|
|
3170
|
+
extConfig.NotificationManager = _notificationManager;
|
|
3171
|
+
}
|
|
3172
|
+
function _doUpdate(updateState) {
|
|
3173
|
+
var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self);
|
|
3174
|
+
if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) {
|
|
3175
|
+
updateCtx.processNext(updateState);
|
|
2171
3176
|
}
|
|
2172
|
-
}
|
|
3177
|
+
}
|
|
3178
|
+
function _logOrThrowError(message) {
|
|
3179
|
+
var logger = _self.logger;
|
|
3180
|
+
if (logger) {
|
|
3181
|
+
_throwInternal(logger, 2 , 73 , message);
|
|
3182
|
+
}
|
|
3183
|
+
else {
|
|
3184
|
+
throwError(message);
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
2173
3187
|
});
|
|
2174
3188
|
}
|
|
2175
3189
|
return BaseCore;
|
|
2176
3190
|
}());
|
|
2177
3191
|
|
|
3192
|
+
function _runListeners(listeners, name, isAsync, callback) {
|
|
3193
|
+
arrForEach(listeners, function (listener) {
|
|
3194
|
+
if (listener && listener[name]) {
|
|
3195
|
+
if (isAsync) {
|
|
3196
|
+
setTimeout(function () { return callback(listener); }, 0);
|
|
3197
|
+
}
|
|
3198
|
+
else {
|
|
3199
|
+
try {
|
|
3200
|
+
callback(listener);
|
|
3201
|
+
}
|
|
3202
|
+
catch (e) {
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3205
|
+
}
|
|
3206
|
+
});
|
|
3207
|
+
}
|
|
2178
3208
|
var NotificationManager = /** @class */ (function () {
|
|
2179
3209
|
function NotificationManager(config) {
|
|
2180
3210
|
this.listeners = [];
|
|
2181
3211
|
var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;
|
|
2182
3212
|
dynamicProto(NotificationManager, this, function (_self) {
|
|
2183
|
-
_self
|
|
3213
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2184
3214
|
_self.listeners.push(listener);
|
|
2185
3215
|
};
|
|
2186
|
-
_self
|
|
3216
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2187
3217
|
var index = arrIndexOf(_self.listeners, listener);
|
|
2188
3218
|
while (index > -1) {
|
|
2189
3219
|
_self.listeners.splice(index, 1);
|
|
2190
3220
|
index = arrIndexOf(_self.listeners, listener);
|
|
2191
3221
|
}
|
|
2192
3222
|
};
|
|
2193
|
-
_self
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
setTimeout(function () { return listener.eventsSent(events); }, 0);
|
|
2197
|
-
}
|
|
3223
|
+
_self[strEventsSent] = function (events) {
|
|
3224
|
+
_runListeners(_self.listeners, strEventsSent, true, function (listener) {
|
|
3225
|
+
listener[strEventsSent](events);
|
|
2198
3226
|
});
|
|
2199
3227
|
};
|
|
2200
|
-
_self
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
setTimeout(function () { return listener.eventsDiscarded(events, reason); }, 0);
|
|
2204
|
-
}
|
|
3228
|
+
_self[strEventsDiscarded] = function (events, reason) {
|
|
3229
|
+
_runListeners(_self.listeners, strEventsDiscarded, true, function (listener) {
|
|
3230
|
+
listener[strEventsDiscarded](events, reason);
|
|
2205
3231
|
});
|
|
2206
3232
|
};
|
|
2207
|
-
_self
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
if (isAsync) {
|
|
2211
|
-
setTimeout(function () { return listener.eventsSendRequest(sendReason, isAsync); }, 0);
|
|
2212
|
-
}
|
|
2213
|
-
else {
|
|
2214
|
-
try {
|
|
2215
|
-
listener.eventsSendRequest(sendReason, isAsync);
|
|
2216
|
-
}
|
|
2217
|
-
catch (e) {
|
|
2218
|
-
}
|
|
2219
|
-
}
|
|
2220
|
-
}
|
|
3233
|
+
_self[strEventsSendRequest] = function (sendReason, isAsync) {
|
|
3234
|
+
_runListeners(_self.listeners, strEventsSendRequest, isAsync, function (listener) {
|
|
3235
|
+
listener[strEventsSendRequest](sendReason, isAsync);
|
|
2221
3236
|
});
|
|
2222
3237
|
};
|
|
2223
|
-
_self
|
|
3238
|
+
_self[strPerfEvent] = function (perfEvent) {
|
|
2224
3239
|
if (perfEvent) {
|
|
2225
3240
|
if (perfEvtsSendAll || !perfEvent.isChildEvt()) {
|
|
2226
|
-
|
|
2227
|
-
if (
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
try {
|
|
2233
|
-
listener.perfEvent(perfEvent);
|
|
2234
|
-
}
|
|
2235
|
-
catch (e) {
|
|
2236
|
-
}
|
|
2237
|
-
}
|
|
3241
|
+
_runListeners(_self.listeners, strPerfEvent, false, function (listener) {
|
|
3242
|
+
if (perfEvent.isAsync) {
|
|
3243
|
+
setTimeout(function () { return listener[strPerfEvent](perfEvent); }, 0);
|
|
3244
|
+
}
|
|
3245
|
+
else {
|
|
3246
|
+
listener[strPerfEvent](perfEvent);
|
|
2238
3247
|
}
|
|
2239
3248
|
});
|
|
2240
3249
|
}
|
|
@@ -2249,7 +3258,6 @@
|
|
|
2249
3258
|
__extendsFn(AppInsightsCore, _super);
|
|
2250
3259
|
function AppInsightsCore() {
|
|
2251
3260
|
var _this = _super.call(this) || this;
|
|
2252
|
-
var _internalLogPoller = 0;
|
|
2253
3261
|
dynamicProto(AppInsightsCore, _this, function (_self, _base) {
|
|
2254
3262
|
_self.initialize = function (config, extensions, logger, notificationManager) {
|
|
2255
3263
|
_base.initialize(config, extensions, logger || new DiagnosticLogger(config), notificationManager || new NotificationManager(config));
|
|
@@ -2264,58 +3272,16 @@
|
|
|
2264
3272
|
_base.track(telemetryItem);
|
|
2265
3273
|
}, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));
|
|
2266
3274
|
};
|
|
2267
|
-
_self.addNotificationListener = function (listener) {
|
|
2268
|
-
var manager = _self.getNotifyMgr();
|
|
2269
|
-
if (manager) {
|
|
2270
|
-
manager.addNotificationListener(listener);
|
|
2271
|
-
}
|
|
2272
|
-
};
|
|
2273
|
-
_self.removeNotificationListener = function (listener) {
|
|
2274
|
-
var manager = _self.getNotifyMgr();
|
|
2275
|
-
if (manager) {
|
|
2276
|
-
manager.removeNotificationListener(listener);
|
|
2277
|
-
}
|
|
2278
|
-
};
|
|
2279
|
-
_self.pollInternalLogs = function (eventName) {
|
|
2280
|
-
var interval = _self.config.diagnosticLogInterval;
|
|
2281
|
-
if (!interval || !(interval > 0)) {
|
|
2282
|
-
interval = 10000;
|
|
2283
|
-
}
|
|
2284
|
-
if (_internalLogPoller) {
|
|
2285
|
-
_self.stopPollingInternalLogs();
|
|
2286
|
-
}
|
|
2287
|
-
_internalLogPoller = setInterval(function () {
|
|
2288
|
-
var queue = _self.logger ? _self.logger.queue : [];
|
|
2289
|
-
arrForEach(queue, function (logMessage) {
|
|
2290
|
-
var item = {
|
|
2291
|
-
name: eventName ? eventName : "InternalMessageId: " + logMessage.messageId,
|
|
2292
|
-
iKey: _self.config.instrumentationKey,
|
|
2293
|
-
time: toISOString(new Date()),
|
|
2294
|
-
baseType: _InternalLogMessage.dataType,
|
|
2295
|
-
baseData: { message: logMessage.message }
|
|
2296
|
-
};
|
|
2297
|
-
_self.track(item);
|
|
2298
|
-
});
|
|
2299
|
-
queue.length = 0;
|
|
2300
|
-
}, interval);
|
|
2301
|
-
return _internalLogPoller;
|
|
2302
|
-
};
|
|
2303
|
-
_self.stopPollingInternalLogs = function () {
|
|
2304
|
-
if (!_internalLogPoller)
|
|
2305
|
-
return;
|
|
2306
|
-
clearInterval(_internalLogPoller);
|
|
2307
|
-
_internalLogPoller = 0;
|
|
2308
|
-
};
|
|
2309
3275
|
function _validateTelemetryItem(telemetryItem) {
|
|
2310
3276
|
if (isNullOrUndefined(telemetryItem.name)) {
|
|
2311
3277
|
_notifyInvalidEvent(telemetryItem);
|
|
2312
|
-
|
|
3278
|
+
throwError("telemetry name required");
|
|
2313
3279
|
}
|
|
2314
3280
|
}
|
|
2315
3281
|
function _notifyInvalidEvent(telemetryItem) {
|
|
2316
3282
|
var manager = _self.getNotifyMgr();
|
|
2317
3283
|
if (manager) {
|
|
2318
|
-
manager.eventsDiscarded([telemetryItem],
|
|
3284
|
+
manager.eventsDiscarded([telemetryItem], 2 );
|
|
2319
3285
|
}
|
|
2320
3286
|
}
|
|
2321
3287
|
});
|
|
@@ -2324,148 +3290,312 @@
|
|
|
2324
3290
|
return AppInsightsCore;
|
|
2325
3291
|
}(BaseCore$2));
|
|
2326
3292
|
|
|
2327
|
-
var
|
|
2328
|
-
var
|
|
2329
|
-
var
|
|
2330
|
-
var
|
|
2331
|
-
var
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
3293
|
+
var strOnPrefix = "on";
|
|
3294
|
+
var strAttachEvent = "attachEvent";
|
|
3295
|
+
var strAddEventHelper = "addEventListener";
|
|
3296
|
+
var strDetachEvent = "detachEvent";
|
|
3297
|
+
var strRemoveEventListener = "removeEventListener";
|
|
3298
|
+
var strEvents = "events";
|
|
3299
|
+
var strVisibilityChangeEvt = "visibilitychange";
|
|
3300
|
+
var strPageHide = "pagehide";
|
|
3301
|
+
var strPageShow = "pageshow";
|
|
3302
|
+
var strUnload = "unload";
|
|
3303
|
+
var strBeforeUnload = "beforeunload";
|
|
3304
|
+
var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
|
|
3305
|
+
var strPageShowNamespace = createUniqueNamespace("aiEvtPageShow");
|
|
3306
|
+
var rRemoveEmptyNs = /\.[\.]+/g;
|
|
3307
|
+
var rRemoveTrailingEmptyNs = /[\.]+$/;
|
|
3308
|
+
var _guid = 1;
|
|
3309
|
+
var elmNodeData = createElmNodeData("events");
|
|
3310
|
+
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
3311
|
+
function _normalizeNamespace(name) {
|
|
3312
|
+
if (name && name.replace) {
|
|
3313
|
+
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
3314
|
+
}
|
|
3315
|
+
return name;
|
|
3316
|
+
}
|
|
3317
|
+
function _getEvtNamespace(eventName, evtNamespace) {
|
|
3318
|
+
if (evtNamespace) {
|
|
3319
|
+
var theNamespace_1 = "";
|
|
3320
|
+
if (isArray(evtNamespace)) {
|
|
3321
|
+
theNamespace_1 = "";
|
|
3322
|
+
arrForEach(evtNamespace, function (name) {
|
|
3323
|
+
name = _normalizeNamespace(name);
|
|
3324
|
+
if (name) {
|
|
3325
|
+
if (name[0] !== ".") {
|
|
3326
|
+
name = "." + name;
|
|
3327
|
+
}
|
|
3328
|
+
theNamespace_1 += name;
|
|
3329
|
+
}
|
|
3330
|
+
});
|
|
3331
|
+
}
|
|
3332
|
+
else {
|
|
3333
|
+
theNamespace_1 = _normalizeNamespace(evtNamespace);
|
|
3334
|
+
}
|
|
3335
|
+
if (theNamespace_1) {
|
|
3336
|
+
if (theNamespace_1[0] !== ".") {
|
|
3337
|
+
theNamespace_1 = "." + theNamespace_1;
|
|
3338
|
+
}
|
|
3339
|
+
eventName = (eventName || "") + theNamespace_1;
|
|
3340
|
+
}
|
|
2335
3341
|
}
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
3342
|
+
var parsedEvent = (eventNamespace.exec(eventName || "") || []);
|
|
3343
|
+
return {
|
|
3344
|
+
type: parsedEvent[1],
|
|
3345
|
+
ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
|
|
3346
|
+
};
|
|
2339
3347
|
}
|
|
2340
|
-
function
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
3348
|
+
function __getRegisteredEvents(target, eventName, evtNamespace) {
|
|
3349
|
+
var theEvents = [];
|
|
3350
|
+
var eventCache = elmNodeData.get(target, strEvents, {}, false);
|
|
3351
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
3352
|
+
objForEachKey(eventCache, function (evtType, registeredEvents) {
|
|
3353
|
+
arrForEach(registeredEvents, function (value) {
|
|
3354
|
+
if (!evtName.type || evtName.type === value.evtName.type) {
|
|
3355
|
+
if (!evtName.ns || evtName.ns === evtName.ns) {
|
|
3356
|
+
theEvents.push({
|
|
3357
|
+
name: value.evtName.type + (value.evtName.ns ? "." + value.evtName.ns : ""),
|
|
3358
|
+
handler: value.handler
|
|
3359
|
+
});
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
});
|
|
3363
|
+
});
|
|
3364
|
+
return theEvents;
|
|
3365
|
+
}
|
|
3366
|
+
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
3367
|
+
if (addDefault === void 0) { addDefault = true; }
|
|
3368
|
+
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
3369
|
+
var registeredEvents = aiEvts[evtName];
|
|
3370
|
+
if (!registeredEvents) {
|
|
3371
|
+
registeredEvents = aiEvts[evtName] = [];
|
|
2346
3372
|
}
|
|
3373
|
+
return registeredEvents;
|
|
2347
3374
|
}
|
|
2348
|
-
function
|
|
2349
|
-
if (
|
|
2350
|
-
|
|
3375
|
+
function _doDetach(obj, evtName, handlerRef, useCapture) {
|
|
3376
|
+
if (obj && evtName && evtName.type) {
|
|
3377
|
+
if (obj[strRemoveEventListener]) {
|
|
3378
|
+
obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);
|
|
3379
|
+
}
|
|
3380
|
+
else if (obj[strDetachEvent]) {
|
|
3381
|
+
obj[strDetachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
3382
|
+
}
|
|
2351
3383
|
}
|
|
2352
|
-
return 0;
|
|
2353
3384
|
}
|
|
2354
|
-
function
|
|
2355
|
-
var
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
3385
|
+
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
3386
|
+
var result = false;
|
|
3387
|
+
if (obj && evtName && evtName.type && handlerRef) {
|
|
3388
|
+
if (obj[strAddEventHelper]) {
|
|
3389
|
+
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
3390
|
+
result = true;
|
|
3391
|
+
}
|
|
3392
|
+
else if (obj[strAttachEvent]) {
|
|
3393
|
+
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
3394
|
+
result = true;
|
|
3395
|
+
}
|
|
2359
3396
|
}
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
3397
|
+
return result;
|
|
3398
|
+
}
|
|
3399
|
+
function _doUnregister(target, events, evtName, unRegFn) {
|
|
3400
|
+
var idx = events.length;
|
|
3401
|
+
while (idx--) {
|
|
3402
|
+
var theEvent = events[idx];
|
|
3403
|
+
if (theEvent) {
|
|
3404
|
+
if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {
|
|
3405
|
+
if (!unRegFn || unRegFn(theEvent)) {
|
|
3406
|
+
_doDetach(target, theEvent.evtName, theEvent.handler, theEvent.capture);
|
|
3407
|
+
events.splice(idx, 1);
|
|
3408
|
+
}
|
|
3409
|
+
}
|
|
2363
3410
|
}
|
|
2364
|
-
value = mwcRandom32() & MaxUInt32;
|
|
2365
3411
|
}
|
|
2366
|
-
|
|
2367
|
-
|
|
3412
|
+
}
|
|
3413
|
+
function _unregisterEvents(target, evtName, unRegFn) {
|
|
3414
|
+
if (evtName.type) {
|
|
3415
|
+
_doUnregister(target, _getRegisteredEvents(target, evtName.type), evtName, unRegFn);
|
|
2368
3416
|
}
|
|
2369
|
-
|
|
2370
|
-
|
|
3417
|
+
else {
|
|
3418
|
+
var eventCache = elmNodeData.get(target, strEvents, {});
|
|
3419
|
+
objForEachKey(eventCache, function (evtType, events) {
|
|
3420
|
+
_doUnregister(target, events, evtName, unRegFn);
|
|
3421
|
+
});
|
|
3422
|
+
if (objKeys(eventCache).length === 0) {
|
|
3423
|
+
elmNodeData.kill(target, strEvents);
|
|
3424
|
+
}
|
|
2371
3425
|
}
|
|
2372
|
-
return value;
|
|
2373
3426
|
}
|
|
2374
|
-
function
|
|
2375
|
-
|
|
2376
|
-
|
|
3427
|
+
function mergeEvtNamespace(theNamespace, namespaces) {
|
|
3428
|
+
var newNamespaces;
|
|
3429
|
+
if (namespaces) {
|
|
3430
|
+
if (isArray(namespaces)) {
|
|
3431
|
+
newNamespaces = [theNamespace].concat(namespaces);
|
|
3432
|
+
}
|
|
3433
|
+
else {
|
|
3434
|
+
newNamespaces = [theNamespace, namespaces];
|
|
3435
|
+
}
|
|
3436
|
+
newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
|
|
2377
3437
|
}
|
|
2378
3438
|
else {
|
|
2379
|
-
|
|
3439
|
+
newNamespaces = theNamespace;
|
|
2380
3440
|
}
|
|
3441
|
+
return newNamespaces;
|
|
2381
3442
|
}
|
|
2382
|
-
function
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
3443
|
+
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
3444
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3445
|
+
var result = false;
|
|
3446
|
+
if (target) {
|
|
3447
|
+
try {
|
|
3448
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
3449
|
+
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
3450
|
+
if (result && elmNodeData.accept(target)) {
|
|
3451
|
+
var registeredEvent = {
|
|
3452
|
+
guid: _guid++,
|
|
3453
|
+
evtName: evtName,
|
|
3454
|
+
handler: handlerRef,
|
|
3455
|
+
capture: useCapture
|
|
3456
|
+
};
|
|
3457
|
+
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
3458
|
+
}
|
|
3459
|
+
}
|
|
3460
|
+
catch (e) {
|
|
3461
|
+
}
|
|
2388
3462
|
}
|
|
2389
|
-
return
|
|
3463
|
+
return result;
|
|
2390
3464
|
}
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
3465
|
+
function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
3466
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3467
|
+
if (target) {
|
|
3468
|
+
try {
|
|
3469
|
+
var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
|
|
3470
|
+
var found_1 = false;
|
|
3471
|
+
_unregisterEvents(target, evtName_1, function (regEvent) {
|
|
3472
|
+
if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {
|
|
3473
|
+
found_1 = true;
|
|
3474
|
+
return true;
|
|
3475
|
+
}
|
|
3476
|
+
return false;
|
|
3477
|
+
});
|
|
3478
|
+
if (!found_1) {
|
|
3479
|
+
_doDetach(target, evtName_1, handlerRef, useCapture);
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
catch (e) {
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3486
|
+
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
3487
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3488
|
+
return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
|
|
3489
|
+
}
|
|
3490
|
+
function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
3491
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3492
|
+
eventOff(obj, eventNameWithoutOn, handlerRef, null, useCapture);
|
|
3493
|
+
}
|
|
3494
|
+
function addEventHandler(eventName, callback, evtNamespace) {
|
|
2396
3495
|
var result = false;
|
|
2397
3496
|
var w = getWindow();
|
|
2398
3497
|
if (w) {
|
|
2399
|
-
result =
|
|
2400
|
-
result =
|
|
3498
|
+
result = eventOn(w, eventName, callback, evtNamespace);
|
|
3499
|
+
result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
|
|
2401
3500
|
}
|
|
2402
3501
|
var doc = getDocument();
|
|
2403
3502
|
if (doc) {
|
|
2404
|
-
result =
|
|
3503
|
+
result = eventOn(doc, eventName, callback, evtNamespace) || result;
|
|
2405
3504
|
}
|
|
2406
3505
|
return result;
|
|
2407
3506
|
}
|
|
2408
|
-
function
|
|
3507
|
+
function removeEventHandler(eventName, callback, evtNamespace) {
|
|
3508
|
+
var w = getWindow();
|
|
3509
|
+
if (w) {
|
|
3510
|
+
eventOff(w, eventName, callback, evtNamespace);
|
|
3511
|
+
eventOff(w["body"], eventName, callback, evtNamespace);
|
|
3512
|
+
}
|
|
3513
|
+
var doc = getDocument();
|
|
3514
|
+
if (doc) {
|
|
3515
|
+
eventOff(doc, eventName, callback, evtNamespace);
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3518
|
+
function _addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
2409
3519
|
var added = false;
|
|
2410
|
-
if (listener && events &&
|
|
2411
|
-
var excluded_1 = [];
|
|
3520
|
+
if (listener && events && events.length > 0) {
|
|
2412
3521
|
arrForEach(events, function (name) {
|
|
2413
|
-
if (
|
|
3522
|
+
if (name) {
|
|
2414
3523
|
if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {
|
|
2415
|
-
added = addEventHandler(name, listener) || added;
|
|
2416
|
-
}
|
|
2417
|
-
else {
|
|
2418
|
-
excluded_1.push(name);
|
|
3524
|
+
added = addEventHandler(name, listener, evtNamespace) || added;
|
|
2419
3525
|
}
|
|
2420
3526
|
}
|
|
2421
3527
|
});
|
|
2422
|
-
|
|
2423
|
-
|
|
3528
|
+
}
|
|
3529
|
+
return added;
|
|
3530
|
+
}
|
|
3531
|
+
function addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
3532
|
+
var added = false;
|
|
3533
|
+
if (listener && events && isArray(events)) {
|
|
3534
|
+
added = _addEventListeners(events, listener, excludeEvents, evtNamespace);
|
|
3535
|
+
if (!added && excludeEvents && excludeEvents.length > 0) {
|
|
3536
|
+
added = _addEventListeners(events, listener, null, evtNamespace);
|
|
2424
3537
|
}
|
|
2425
3538
|
}
|
|
2426
3539
|
return added;
|
|
2427
3540
|
}
|
|
2428
|
-
function
|
|
2429
|
-
|
|
3541
|
+
function removeEventListeners(events, listener, evtNamespace) {
|
|
3542
|
+
if (events && isArray(events)) {
|
|
3543
|
+
arrForEach(events, function (name) {
|
|
3544
|
+
if (name) {
|
|
3545
|
+
removeEventHandler(name, listener, evtNamespace);
|
|
3546
|
+
}
|
|
3547
|
+
});
|
|
3548
|
+
}
|
|
3549
|
+
}
|
|
3550
|
+
function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {
|
|
3551
|
+
return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);
|
|
3552
|
+
}
|
|
3553
|
+
function removePageUnloadEventListener(listener, evtNamespace) {
|
|
3554
|
+
removeEventListeners([strBeforeUnload, strUnload, strPageHide], listener, evtNamespace);
|
|
2430
3555
|
}
|
|
2431
|
-
function addPageHideEventListener(listener, excludeEvents) {
|
|
3556
|
+
function addPageHideEventListener(listener, excludeEvents, evtNamespace) {
|
|
2432
3557
|
function _handlePageVisibility(evt) {
|
|
2433
3558
|
var doc = getDocument();
|
|
2434
3559
|
if (listener && doc && doc.visibilityState === "hidden") {
|
|
2435
3560
|
listener(evt);
|
|
2436
3561
|
}
|
|
2437
3562
|
}
|
|
2438
|
-
var
|
|
2439
|
-
|
|
2440
|
-
pageUnloadAdded = addEventHandler(strPageHide, listener);
|
|
2441
|
-
}
|
|
3563
|
+
var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
|
|
3564
|
+
var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);
|
|
2442
3565
|
if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
|
|
2443
|
-
pageUnloadAdded =
|
|
3566
|
+
pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;
|
|
2444
3567
|
}
|
|
2445
3568
|
if (!pageUnloadAdded && excludeEvents) {
|
|
2446
|
-
pageUnloadAdded = addPageHideEventListener(listener);
|
|
3569
|
+
pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);
|
|
2447
3570
|
}
|
|
2448
3571
|
return pageUnloadAdded;
|
|
2449
3572
|
}
|
|
2450
|
-
function
|
|
3573
|
+
function removePageHideEventListener(listener, evtNamespace) {
|
|
3574
|
+
var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
|
|
3575
|
+
removeEventListeners([strPageHide], listener, newNamespaces);
|
|
3576
|
+
removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
|
|
3577
|
+
}
|
|
3578
|
+
function addPageShowEventListener(listener, excludeEvents, evtNamespace) {
|
|
2451
3579
|
function _handlePageVisibility(evt) {
|
|
2452
3580
|
var doc = getDocument();
|
|
2453
3581
|
if (listener && doc && doc.visibilityState === "visible") {
|
|
2454
3582
|
listener(evt);
|
|
2455
3583
|
}
|
|
2456
3584
|
}
|
|
2457
|
-
var
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
}
|
|
2461
|
-
if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
|
|
2462
|
-
pageShowAdded = addEventHandler(strVisibilityChangeEvt, _handlePageVisibility) || pageShowAdded;
|
|
2463
|
-
}
|
|
3585
|
+
var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
|
|
3586
|
+
var pageShowAdded = _addEventListeners([strPageShow], listener, excludeEvents, newNamespaces);
|
|
3587
|
+
pageShowAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageShowAdded;
|
|
2464
3588
|
if (!pageShowAdded && excludeEvents) {
|
|
2465
|
-
pageShowAdded = addPageShowEventListener(listener);
|
|
3589
|
+
pageShowAdded = addPageShowEventListener(listener, null, evtNamespace);
|
|
2466
3590
|
}
|
|
2467
3591
|
return pageShowAdded;
|
|
2468
3592
|
}
|
|
3593
|
+
function removePageShowEventListener(listener, evtNamespace) {
|
|
3594
|
+
var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
|
|
3595
|
+
removeEventListeners([strPageShow], listener, newNamespaces);
|
|
3596
|
+
removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
|
|
3597
|
+
}
|
|
3598
|
+
|
|
2469
3599
|
function newGuid() {
|
|
2470
3600
|
function randomHexDigit() {
|
|
2471
3601
|
return randomValue(15);
|
|
@@ -2482,26 +3612,9 @@
|
|
|
2482
3612
|
}
|
|
2483
3613
|
return dateNow();
|
|
2484
3614
|
}
|
|
2485
|
-
function newId(maxLength) {
|
|
2486
|
-
if (maxLength === void 0) { maxLength = 22; }
|
|
2487
|
-
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
2488
|
-
var number = random32() >>> 0;
|
|
2489
|
-
var chars = 0;
|
|
2490
|
-
var result = "";
|
|
2491
|
-
while (result.length < maxLength) {
|
|
2492
|
-
chars++;
|
|
2493
|
-
result += base64chars.charAt(number & 0x3F);
|
|
2494
|
-
number >>>= 6;
|
|
2495
|
-
if (chars === 5) {
|
|
2496
|
-
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
2497
|
-
chars = 0;
|
|
2498
|
-
}
|
|
2499
|
-
}
|
|
2500
|
-
return result;
|
|
2501
|
-
}
|
|
2502
3615
|
function generateW3CId() {
|
|
2503
3616
|
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
2504
|
-
var oct =
|
|
3617
|
+
var oct = strEmpty, tmp;
|
|
2505
3618
|
for (var a = 0; a < 4; a++) {
|
|
2506
3619
|
tmp = random32();
|
|
2507
3620
|
oct +=
|
|
@@ -2525,67 +3638,177 @@
|
|
|
2525
3638
|
DetachEvent: detachEvent
|
|
2526
3639
|
};
|
|
2527
3640
|
|
|
2528
|
-
var
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
3641
|
+
var LoggingSeverity = createEnumStyle({
|
|
3642
|
+
CRITICAL: 1 ,
|
|
3643
|
+
WARNING: 2
|
|
3644
|
+
});
|
|
3645
|
+
var _InternalMessageId = createEnumStyle({
|
|
3646
|
+
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
3647
|
+
BrowserCannotReadLocalStorage: 1 ,
|
|
3648
|
+
BrowserCannotReadSessionStorage: 2 ,
|
|
3649
|
+
BrowserCannotWriteLocalStorage: 3 ,
|
|
3650
|
+
BrowserCannotWriteSessionStorage: 4 ,
|
|
3651
|
+
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
3652
|
+
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
3653
|
+
CannotSendEmptyTelemetry: 7 ,
|
|
3654
|
+
ClientPerformanceMathError: 8 ,
|
|
3655
|
+
ErrorParsingAISessionCookie: 9 ,
|
|
3656
|
+
ErrorPVCalc: 10 ,
|
|
3657
|
+
ExceptionWhileLoggingError: 11 ,
|
|
3658
|
+
FailedAddingTelemetryToBuffer: 12 ,
|
|
3659
|
+
FailedMonitorAjaxAbort: 13 ,
|
|
3660
|
+
FailedMonitorAjaxDur: 14 ,
|
|
3661
|
+
FailedMonitorAjaxOpen: 15 ,
|
|
3662
|
+
FailedMonitorAjaxRSC: 16 ,
|
|
3663
|
+
FailedMonitorAjaxSend: 17 ,
|
|
3664
|
+
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
3665
|
+
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
3666
|
+
FailedToSendQueuedTelemetry: 20 ,
|
|
3667
|
+
FailedToReportDataLoss: 21 ,
|
|
3668
|
+
FlushFailed: 22 ,
|
|
3669
|
+
MessageLimitPerPVExceeded: 23 ,
|
|
3670
|
+
MissingRequiredFieldSpecification: 24 ,
|
|
3671
|
+
NavigationTimingNotSupported: 25 ,
|
|
3672
|
+
OnError: 26 ,
|
|
3673
|
+
SessionRenewalDateIsZero: 27 ,
|
|
3674
|
+
SenderNotInitialized: 28 ,
|
|
3675
|
+
StartTrackEventFailed: 29 ,
|
|
3676
|
+
StopTrackEventFailed: 30 ,
|
|
3677
|
+
StartTrackFailed: 31 ,
|
|
3678
|
+
StopTrackFailed: 32 ,
|
|
3679
|
+
TelemetrySampledAndNotSent: 33 ,
|
|
3680
|
+
TrackEventFailed: 34 ,
|
|
3681
|
+
TrackExceptionFailed: 35 ,
|
|
3682
|
+
TrackMetricFailed: 36 ,
|
|
3683
|
+
TrackPVFailed: 37 ,
|
|
3684
|
+
TrackPVFailedCalc: 38 ,
|
|
3685
|
+
TrackTraceFailed: 39 ,
|
|
3686
|
+
TransmissionFailed: 40 ,
|
|
3687
|
+
FailedToSetStorageBuffer: 41 ,
|
|
3688
|
+
FailedToRestoreStorageBuffer: 42 ,
|
|
3689
|
+
InvalidBackendResponse: 43 ,
|
|
3690
|
+
FailedToFixDepricatedValues: 44 ,
|
|
3691
|
+
InvalidDurationValue: 45 ,
|
|
3692
|
+
TelemetryEnvelopeInvalid: 46 ,
|
|
3693
|
+
CreateEnvelopeError: 47 ,
|
|
3694
|
+
CannotSerializeObject: 48 ,
|
|
3695
|
+
CannotSerializeObjectNonSerializable: 49 ,
|
|
3696
|
+
CircularReferenceDetected: 50 ,
|
|
3697
|
+
ClearAuthContextFailed: 51 ,
|
|
3698
|
+
ExceptionTruncated: 52 ,
|
|
3699
|
+
IllegalCharsInName: 53 ,
|
|
3700
|
+
ItemNotInArray: 54 ,
|
|
3701
|
+
MaxAjaxPerPVExceeded: 55 ,
|
|
3702
|
+
MessageTruncated: 56 ,
|
|
3703
|
+
NameTooLong: 57 ,
|
|
3704
|
+
SampleRateOutOfRange: 58 ,
|
|
3705
|
+
SetAuthContextFailed: 59 ,
|
|
3706
|
+
SetAuthContextFailedAccountName: 60 ,
|
|
3707
|
+
StringValueTooLong: 61 ,
|
|
3708
|
+
StartCalledMoreThanOnce: 62 ,
|
|
3709
|
+
StopCalledWithoutStart: 63 ,
|
|
3710
|
+
TelemetryInitializerFailed: 64 ,
|
|
3711
|
+
TrackArgumentsNotSpecified: 65 ,
|
|
3712
|
+
UrlTooLong: 66 ,
|
|
3713
|
+
SessionStorageBufferFull: 67 ,
|
|
3714
|
+
CannotAccessCookie: 68 ,
|
|
3715
|
+
IdTooLong: 69 ,
|
|
3716
|
+
InvalidEvent: 70 ,
|
|
3717
|
+
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
3718
|
+
SendBrowserInfoOnUserInit: 72 ,
|
|
3719
|
+
PluginException: 73 ,
|
|
3720
|
+
NotificationException: 74 ,
|
|
3721
|
+
SnippetScriptLoadFailure: 99 ,
|
|
3722
|
+
InvalidInstrumentationKey: 100 ,
|
|
3723
|
+
CannotParseAiBlobValue: 101 ,
|
|
3724
|
+
InvalidContentBlob: 102 ,
|
|
3725
|
+
TrackPageActionEventFailed: 103 ,
|
|
3726
|
+
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
3727
|
+
InMemoryStorageBufferFull: 105
|
|
3728
|
+
});
|
|
3729
|
+
|
|
3730
|
+
var ValueKind = createEnumStyle({
|
|
3731
|
+
NotSet: 0 ,
|
|
3732
|
+
Pii_DistinguishedName: 1 ,
|
|
3733
|
+
Pii_GenericData: 2 ,
|
|
3734
|
+
Pii_IPV4Address: 3 ,
|
|
3735
|
+
Pii_IPv6Address: 4 ,
|
|
3736
|
+
Pii_MailSubject: 5 ,
|
|
3737
|
+
Pii_PhoneNumber: 6 ,
|
|
3738
|
+
Pii_QueryString: 7 ,
|
|
3739
|
+
Pii_SipAddress: 8 ,
|
|
3740
|
+
Pii_SmtpAddress: 9 ,
|
|
3741
|
+
Pii_Identity: 10 ,
|
|
3742
|
+
Pii_Uri: 11 ,
|
|
3743
|
+
Pii_Fqdn: 12 ,
|
|
3744
|
+
Pii_IPV4AddressLegacy: 13 ,
|
|
2543
3745
|
CustomerContent_GenericContent: 32
|
|
2544
|
-
};
|
|
2545
|
-
var EventLatency = {
|
|
3746
|
+
});
|
|
3747
|
+
var EventLatency = createEnumStyle({
|
|
2546
3748
|
Normal: 1 ,
|
|
2547
3749
|
CostDeferred: 2 ,
|
|
2548
3750
|
RealTime: 3 ,
|
|
2549
3751
|
Immediate: 4
|
|
2550
|
-
};
|
|
2551
|
-
var EventPropertyType = {
|
|
2552
|
-
Unspecified: 0,
|
|
2553
|
-
String: 1,
|
|
2554
|
-
Int32: 2,
|
|
2555
|
-
UInt32: 3,
|
|
2556
|
-
Int64: 4,
|
|
2557
|
-
UInt64: 5,
|
|
2558
|
-
Double: 6,
|
|
2559
|
-
Bool: 7,
|
|
2560
|
-
Guid: 8,
|
|
3752
|
+
});
|
|
3753
|
+
var EventPropertyType = createEnumStyle({
|
|
3754
|
+
Unspecified: 0 ,
|
|
3755
|
+
String: 1 ,
|
|
3756
|
+
Int32: 2 ,
|
|
3757
|
+
UInt32: 3 ,
|
|
3758
|
+
Int64: 4 ,
|
|
3759
|
+
UInt64: 5 ,
|
|
3760
|
+
Double: 6 ,
|
|
3761
|
+
Bool: 7 ,
|
|
3762
|
+
Guid: 8 ,
|
|
2561
3763
|
DateTime: 9
|
|
2562
|
-
};
|
|
2563
|
-
var EventPersistence = {
|
|
3764
|
+
});
|
|
3765
|
+
var EventPersistence = createEnumStyle({
|
|
2564
3766
|
Normal: 1 ,
|
|
2565
3767
|
Critical: 2
|
|
2566
|
-
};
|
|
2567
|
-
var TraceLevel = {
|
|
2568
|
-
NONE: 0,
|
|
2569
|
-
ERROR: 1,
|
|
2570
|
-
WARNING: 2,
|
|
3768
|
+
});
|
|
3769
|
+
var TraceLevel = createEnumStyle({
|
|
3770
|
+
NONE: 0 ,
|
|
3771
|
+
ERROR: 1 ,
|
|
3772
|
+
WARNING: 2 ,
|
|
2571
3773
|
INFORMATION: 3
|
|
2572
|
-
};
|
|
2573
|
-
var _ExtendedInternalMessageId = __assignFn(__assignFn({}, _InternalMessageId), {
|
|
3774
|
+
});
|
|
3775
|
+
var _ExtendedInternalMessageId = objFreeze(__assignFn(__assignFn({}, _InternalMessageId), createEnumStyle({
|
|
3776
|
+
AuthHandShakeError: 501 ,
|
|
3777
|
+
AuthRedirectFail: 502 ,
|
|
3778
|
+
BrowserCannotReadLocalStorage: 503 ,
|
|
3779
|
+
BrowserCannotWriteLocalStorage: 504 ,
|
|
3780
|
+
BrowserDoesNotSupportLocalStorage: 505 ,
|
|
3781
|
+
CannotParseBiBlobValue: 506 ,
|
|
3782
|
+
CannotParseDataAttribute: 507 ,
|
|
3783
|
+
CVPluginNotAvailable: 508 ,
|
|
3784
|
+
DroppedEvent: 509 ,
|
|
3785
|
+
ErrorParsingAISessionCookie: 510 ,
|
|
3786
|
+
ErrorProvidedChannels: 511 ,
|
|
3787
|
+
FailedToGetCookies: 512 ,
|
|
3788
|
+
FailedToInitializeCorrelationVector: 513 ,
|
|
3789
|
+
FailedToInitializeSDK: 514 ,
|
|
3790
|
+
InvalidContentBlob: 515 ,
|
|
3791
|
+
InvalidCorrelationValue: 516 ,
|
|
3792
|
+
SessionRenewalDateIsZero: 517 ,
|
|
3793
|
+
SendPostOnCompleteFailure: 518 ,
|
|
3794
|
+
PostResponseHandler: 519 ,
|
|
3795
|
+
SDKNotInitialized: 520
|
|
3796
|
+
})));
|
|
2574
3797
|
|
|
2575
3798
|
var _a;
|
|
2576
|
-
var Version = '3.
|
|
3799
|
+
var Version = '3.2.0';
|
|
2577
3800
|
var FullVersionString = "1DS-Web-JS-" + Version;
|
|
2578
3801
|
var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
|
|
2579
3802
|
var strWithCredentials = "withCredentials";
|
|
2580
3803
|
var strTimeout = "timeout";
|
|
2581
3804
|
var _fieldTypeEventPropMap = (_a = {},
|
|
2582
|
-
_a[0 ] =
|
|
2583
|
-
_a[2 ] =
|
|
2584
|
-
_a[1 ] =
|
|
2585
|
-
_a[3 ] =
|
|
2586
|
-
_a[4096 | 2 ] =
|
|
2587
|
-
_a[4096 | 1 ] =
|
|
2588
|
-
_a[4096 | 3 ] =
|
|
3805
|
+
_a[0 ] = 0 ,
|
|
3806
|
+
_a[2 ] = 6 ,
|
|
3807
|
+
_a[1 ] = 1 ,
|
|
3808
|
+
_a[3 ] = 7 ,
|
|
3809
|
+
_a[4096 | 2 ] = 6 ,
|
|
3810
|
+
_a[4096 | 1 ] = 1 ,
|
|
3811
|
+
_a[4096 | 3 ] = 7 ,
|
|
2589
3812
|
_a);
|
|
2590
3813
|
var uInt8ArraySupported = null;
|
|
2591
3814
|
var isDocumentObjectAvailable = Boolean(getDocument());
|
|
@@ -2609,7 +3832,7 @@
|
|
|
2609
3832
|
return uInt8ArraySupported;
|
|
2610
3833
|
}
|
|
2611
3834
|
function isLatency(value) {
|
|
2612
|
-
if (value && isNumber(value) && value >=
|
|
3835
|
+
if (value && isNumber(value) && value >= 1 && value <= 4 ) {
|
|
2613
3836
|
return true;
|
|
2614
3837
|
}
|
|
2615
3838
|
return false;
|
|
@@ -2665,7 +3888,7 @@
|
|
|
2665
3888
|
if (encodedTypeValue !== -1 && propType !== -1) {
|
|
2666
3889
|
encodedTypeValue |= propType;
|
|
2667
3890
|
}
|
|
2668
|
-
else if (propType ===
|
|
3891
|
+
else if (propType === 6 ) {
|
|
2669
3892
|
encodedTypeValue = propType;
|
|
2670
3893
|
}
|
|
2671
3894
|
}
|
|
@@ -2755,7 +3978,7 @@
|
|
|
2755
3978
|
}
|
|
2756
3979
|
var getTime = perfNow;
|
|
2757
3980
|
function isValueKind(value) {
|
|
2758
|
-
if (value ===
|
|
3981
|
+
if (value === 0 || ((value > 0 && value <= 13 ) || value === 32 )) {
|
|
2759
3982
|
return true;
|
|
2760
3983
|
}
|
|
2761
3984
|
return false;
|
|
@@ -2938,7 +4161,7 @@
|
|
|
2938
4161
|
_this.pluginVersionString = "";
|
|
2939
4162
|
dynamicProto(AppInsightsCore, _this, function (_self, _base) {
|
|
2940
4163
|
if (!_self.logger || !_self.logger.queue) {
|
|
2941
|
-
_self.logger = new DiagnosticLogger({ loggingLevelConsole:
|
|
4164
|
+
_self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 });
|
|
2942
4165
|
}
|
|
2943
4166
|
_self.initialize = function (config, extensions, logger, notificationManager) {
|
|
2944
4167
|
doPerf(_self, function () { return "AppInsightsCore.initialize"; }, function () {
|
|
@@ -2985,7 +4208,7 @@
|
|
|
2985
4208
|
if (message.indexOf("channels") !== -1) {
|
|
2986
4209
|
message += "\n - Channels must be provided through config.channels only!";
|
|
2987
4210
|
}
|
|
2988
|
-
logger_1.throwInternal(
|
|
4211
|
+
logger_1.throwInternal(1 , 514 , "SDK Initialization Failed - no telemetry will be sent: " + message);
|
|
2989
4212
|
}
|
|
2990
4213
|
}, function () { return ({ config: config, extensions: extensions, logger: logger, notificationManager: notificationManager }); });
|
|
2991
4214
|
};
|
|
@@ -2996,7 +4219,7 @@
|
|
|
2996
4219
|
telemetryItem.timings = telemetryItem.timings || {};
|
|
2997
4220
|
telemetryItem.timings.trackStart = getTime();
|
|
2998
4221
|
if (!isLatency(telemetryItem.latency)) {
|
|
2999
|
-
telemetryItem.latency =
|
|
4222
|
+
telemetryItem.latency = 1 ;
|
|
3000
4223
|
}
|
|
3001
4224
|
var itemExt = telemetryItem.ext = telemetryItem.ext || {};
|
|
3002
4225
|
itemExt.sdk = itemExt.sdk || {};
|
|
@@ -3039,7 +4262,7 @@
|
|
|
3039
4262
|
_base.initialize(config, extensions, logger, notificationManager);
|
|
3040
4263
|
}
|
|
3041
4264
|
catch (e) {
|
|
3042
|
-
_self.logger
|
|
4265
|
+
_throwInternal(_self.logger, 1 , 514 , "Initialization Failed: " + dumpObj(e) + "\n - Note: Channels must be provided through config.channels only");
|
|
3043
4266
|
}
|
|
3044
4267
|
};
|
|
3045
4268
|
_self.track = function (item) {
|
|
@@ -3643,6 +4866,7 @@
|
|
|
3643
4866
|
exports.FullVersionString = FullVersionString;
|
|
3644
4867
|
exports.InternalAppInsightsCore = AppInsightsCore$2;
|
|
3645
4868
|
exports.InternalBaseCore = BaseCore$2;
|
|
4869
|
+
exports.LoggingSeverity = LoggingSeverity;
|
|
3646
4870
|
exports.MinChannelPriorty = MinChannelPriorty;
|
|
3647
4871
|
exports.NotificationManager = NotificationManager;
|
|
3648
4872
|
exports.PerfEvent = PerfEvent;
|
|
@@ -3657,6 +4881,8 @@
|
|
|
3657
4881
|
exports._ExtendedInternalMessageId = _ExtendedInternalMessageId;
|
|
3658
4882
|
exports._InternalLogMessage = _InternalLogMessage;
|
|
3659
4883
|
exports._InternalMessageId = _InternalMessageId;
|
|
4884
|
+
exports.__getRegisteredEvents = __getRegisteredEvents;
|
|
4885
|
+
exports._throwInternal = _throwInternal;
|
|
3660
4886
|
exports.addEventHandler = addEventHandler;
|
|
3661
4887
|
exports.addEventListeners = addEventListeners;
|
|
3662
4888
|
exports.addPageHideEventListener = addPageHideEventListener;
|
|
@@ -3670,7 +4896,11 @@
|
|
|
3670
4896
|
exports.attachEvent = attachEvent;
|
|
3671
4897
|
exports.cookieAvailable = areCookiesSupported;
|
|
3672
4898
|
exports.createCookieMgr = createCookieMgr;
|
|
4899
|
+
exports.createEnumStyle = createEnumStyle;
|
|
3673
4900
|
exports.createGuid = createGuid;
|
|
4901
|
+
exports.createProcessTelemetryContext = createProcessTelemetryContext;
|
|
4902
|
+
exports.createUniqueNamespace = createUniqueNamespace;
|
|
4903
|
+
exports.createUnloadHandlerContainer = createUnloadHandlerContainer;
|
|
3674
4904
|
exports.dateNow = dateNow;
|
|
3675
4905
|
exports.deleteCookie = deleteCookie;
|
|
3676
4906
|
exports.detachEvent = detachEvent;
|
|
@@ -3678,6 +4908,8 @@
|
|
|
3678
4908
|
exports.disallowsSameSiteNone = uaDisallowsSameSiteNone;
|
|
3679
4909
|
exports.doPerf = doPerf;
|
|
3680
4910
|
exports.dumpObj = dumpObj;
|
|
4911
|
+
exports.eventOff = eventOff;
|
|
4912
|
+
exports.eventOn = eventOn;
|
|
3681
4913
|
exports.extend = extend;
|
|
3682
4914
|
exports.generateW3CId = generateW3CId;
|
|
3683
4915
|
exports.getCommonSchemaMetaData = getCommonSchemaMetaData;
|
|
@@ -3734,19 +4966,29 @@
|
|
|
3734
4966
|
exports.isValueKind = isValueKind;
|
|
3735
4967
|
exports.isWindowObjectAvailable = isWindowObjectAvailable;
|
|
3736
4968
|
exports.isXhrSupported = isXhrSupported;
|
|
4969
|
+
exports.mergeEvtNamespace = mergeEvtNamespace;
|
|
3737
4970
|
exports.newGuid = newGuid;
|
|
3738
4971
|
exports.newId = newId;
|
|
3739
4972
|
exports.normalizeJsName = normalizeJsName;
|
|
3740
4973
|
exports.objCreate = objCreateFn;
|
|
3741
4974
|
exports.objDefineAccessors = objDefineAccessors;
|
|
3742
4975
|
exports.objForEachKey = objForEachKey;
|
|
4976
|
+
exports.objFreeze = objFreeze;
|
|
3743
4977
|
exports.objKeys = objKeys;
|
|
4978
|
+
exports.objSeal = objSeal;
|
|
3744
4979
|
exports.openXhr = openXhr;
|
|
3745
4980
|
exports.optimizeObject = optimizeObject;
|
|
3746
4981
|
exports.perfNow = perfNow;
|
|
3747
4982
|
exports.proxyAssign = proxyAssign;
|
|
4983
|
+
exports.proxyFunctionAs = proxyFunctionAs;
|
|
4984
|
+
exports.proxyFunctions = proxyFunctions;
|
|
3748
4985
|
exports.random32 = random32;
|
|
3749
4986
|
exports.randomValue = randomValue;
|
|
4987
|
+
exports.removeEventHandler = removeEventHandler;
|
|
4988
|
+
exports.removeEventListeners = removeEventListeners;
|
|
4989
|
+
exports.removePageHideEventListener = removePageHideEventListener;
|
|
4990
|
+
exports.removePageShowEventListener = removePageShowEventListener;
|
|
4991
|
+
exports.removePageUnloadEventListener = removePageUnloadEventListener;
|
|
3750
4992
|
exports.safeGetCookieMgr = safeGetCookieMgr;
|
|
3751
4993
|
exports.safeGetLogger = safeGetLogger;
|
|
3752
4994
|
exports.sanitizeProperty = sanitizeProperty;
|
|
@@ -3756,9 +4998,7 @@
|
|
|
3756
4998
|
exports.setValue = setValue;
|
|
3757
4999
|
exports.strContains = strContains;
|
|
3758
5000
|
exports.strEndsWith = strEndsWith;
|
|
3759
|
-
exports.strExtensionConfig = strExtensionConfig;
|
|
3760
5001
|
exports.strFunction = strShimFunction;
|
|
3761
|
-
exports.strIKey = strIKey;
|
|
3762
5002
|
exports.strObject = strShimObject;
|
|
3763
5003
|
exports.strPrototype = strShimPrototype;
|
|
3764
5004
|
exports.strStartsWith = strStartsWith;
|
|
@@ -3771,4 +5011,4 @@
|
|
|
3771
5011
|
(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 });
|
|
3772
5012
|
|
|
3773
5013
|
}));
|
|
3774
|
-
//# sourceMappingURL=ms.core-3.
|
|
5014
|
+
//# sourceMappingURL=ms.core-3.2.0.js.map
|