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