@microsoft/applicationinsights-react-js 3.2.4-nightly.2202-09 → 3.3.0-beta.2202-06
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-react-js.js +411 -256
- package/browser/applicationinsights-react-js.js.map +1 -1
- package/browser/applicationinsights-react-js.min.js +2 -2
- package/browser/applicationinsights-react-js.min.js.map +1 -1
- package/dist/applicationinsights-react-js.d.ts +1 -1
- package/dist/applicationinsights-react-js.js +411 -256
- package/dist/applicationinsights-react-js.js.map +1 -1
- package/dist/applicationinsights-react-js.min.js +2 -2
- package/dist/applicationinsights-react-js.min.js.map +1 -1
- package/dist/applicationinsights-react-js.rollup.d.ts +1 -1
- package/dist-esm/AppInsightsContext.js +1 -1
- package/dist-esm/AppInsightsErrorBoundary.js +1 -1
- package/dist-esm/Interfaces/IReactExtensionConfig.js +1 -1
- package/dist-esm/ReactPlugin.js +1 -1
- package/dist-esm/applicationinsights-react-js.js +1 -1
- package/dist-esm/useTrackEvent.js +1 -1
- package/dist-esm/useTrackMetric.js +1 -1
- package/dist-esm/withAITracking.js +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - React Plugin, 3.
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 3.3.0-beta.2202-06
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -132,11 +132,11 @@
|
|
|
132
132
|
var DynAllowInstChkTag = DynInstChkTag;
|
|
133
133
|
var DynProtoDefaultOptions = '_dfOpts';
|
|
134
134
|
var UnknownValue = '_unknown_';
|
|
135
|
-
var str__Proto = "__proto__";
|
|
135
|
+
var str__Proto$1 = "__proto__";
|
|
136
136
|
var strUseBaseInst = 'useBaseInst';
|
|
137
137
|
var strSetInstFuncs = 'setInstFuncs';
|
|
138
138
|
var Obj = Object;
|
|
139
|
-
var _objGetPrototypeOf = Obj["getPrototypeOf"];
|
|
139
|
+
var _objGetPrototypeOf$1 = Obj["getPrototypeOf"];
|
|
140
140
|
var _dynamicNames = 0;
|
|
141
141
|
function _hasOwnProperty(obj, prop) {
|
|
142
142
|
return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
|
|
@@ -147,12 +147,12 @@
|
|
|
147
147
|
function _isObjectArrayOrFunctionPrototype(target) {
|
|
148
148
|
return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
|
|
149
149
|
}
|
|
150
|
-
function _getObjProto(target) {
|
|
150
|
+
function _getObjProto$1(target) {
|
|
151
151
|
if (target) {
|
|
152
|
-
if (_objGetPrototypeOf) {
|
|
153
|
-
return _objGetPrototypeOf(target);
|
|
152
|
+
if (_objGetPrototypeOf$1) {
|
|
153
|
+
return _objGetPrototypeOf$1(target);
|
|
154
154
|
}
|
|
155
|
-
var newProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
155
|
+
var newProto = target[str__Proto$1] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
156
156
|
if (newProto) {
|
|
157
157
|
return newProto;
|
|
158
158
|
}
|
|
@@ -218,16 +218,16 @@
|
|
|
218
218
|
_forEachProp(instFuncs, function (name) {
|
|
219
219
|
baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
|
|
220
220
|
});
|
|
221
|
-
var baseProto = _getObjProto(classProto);
|
|
221
|
+
var baseProto = _getObjProto$1(classProto);
|
|
222
222
|
var visited = [];
|
|
223
223
|
while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
|
|
224
224
|
_forEachProp(baseProto, function (name) {
|
|
225
|
-
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
|
|
225
|
+
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf$1)) {
|
|
226
226
|
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
229
|
visited.push(baseProto);
|
|
230
|
-
baseProto = _getObjProto(baseProto);
|
|
230
|
+
baseProto = _getObjProto$1(baseProto);
|
|
231
231
|
}
|
|
232
232
|
return baseFuncs;
|
|
233
233
|
}
|
|
@@ -241,7 +241,7 @@
|
|
|
241
241
|
}
|
|
242
242
|
if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
|
|
243
243
|
var canAddInst = !_hasOwnProperty(target, funcName);
|
|
244
|
-
var objProto = _getObjProto(target);
|
|
244
|
+
var objProto = _getObjProto$1(target);
|
|
245
245
|
var visited = [];
|
|
246
246
|
while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
|
|
247
247
|
var protoFunc = objProto[funcName];
|
|
@@ -250,7 +250,7 @@
|
|
|
250
250
|
break;
|
|
251
251
|
}
|
|
252
252
|
visited.push(objProto);
|
|
253
|
-
objProto = _getObjProto(objProto);
|
|
253
|
+
objProto = _getObjProto$1(objProto);
|
|
254
254
|
}
|
|
255
255
|
try {
|
|
256
256
|
if (canAddInst) {
|
|
@@ -268,7 +268,7 @@
|
|
|
268
268
|
function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
|
|
269
269
|
var protoFunc = proto[funcName];
|
|
270
270
|
if (protoFunc === currentDynProtoProxy) {
|
|
271
|
-
protoFunc = _getObjProto(proto)[funcName];
|
|
271
|
+
protoFunc = _getObjProto$1(proto)[funcName];
|
|
272
272
|
}
|
|
273
273
|
if (typeof protoFunc !== strFunction) {
|
|
274
274
|
_throwTypeError("[" + funcName + "] is not a " + strFunction);
|
|
@@ -302,15 +302,15 @@
|
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
function _checkPrototype(classProto, thisTarget) {
|
|
305
|
-
if (_objGetPrototypeOf) {
|
|
305
|
+
if (_objGetPrototypeOf$1) {
|
|
306
306
|
var visited = [];
|
|
307
|
-
var thisProto = _getObjProto(thisTarget);
|
|
307
|
+
var thisProto = _getObjProto$1(thisTarget);
|
|
308
308
|
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
309
309
|
if (thisProto === classProto) {
|
|
310
310
|
return true;
|
|
311
311
|
}
|
|
312
312
|
visited.push(thisProto);
|
|
313
|
-
thisProto = _getObjProto(thisProto);
|
|
313
|
+
thisProto = _getObjProto$1(thisProto);
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
return false;
|
|
@@ -346,7 +346,7 @@
|
|
|
346
346
|
var instFuncs = _getInstanceFuncs(target);
|
|
347
347
|
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
348
348
|
delegateFunc(target, baseFuncs);
|
|
349
|
-
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
349
|
+
var setInstanceFunc = !!_objGetPrototypeOf$1 && !!perfOptions[strSetInstFuncs];
|
|
350
350
|
if (setInstanceFunc && options) {
|
|
351
351
|
setInstanceFunc = !!options[strSetInstFuncs];
|
|
352
352
|
}
|
|
@@ -458,7 +458,10 @@
|
|
|
458
458
|
var strReduce = "reduce";
|
|
459
459
|
var cStrTrim = "trim";
|
|
460
460
|
var strToString = "toString";
|
|
461
|
+
var str__Proto = "__proto__";
|
|
462
|
+
var strConstructor = "constructor";
|
|
461
463
|
var _objDefineProperty = ObjDefineProperty;
|
|
464
|
+
var _objFreeze = ObjClass.freeze;
|
|
462
465
|
var _objKeys = ObjClass.keys;
|
|
463
466
|
var StringProto = String[strShimPrototype];
|
|
464
467
|
var _strTrim = StringProto[cStrTrim];
|
|
@@ -468,7 +471,20 @@
|
|
|
468
471
|
var _isArray = Array.isArray;
|
|
469
472
|
var _objToString = ObjProto[strToString];
|
|
470
473
|
var _fnToString = ObjHasOwnProperty[strToString];
|
|
471
|
-
_fnToString.call(ObjClass);
|
|
474
|
+
var _objFunctionString = _fnToString.call(ObjClass);
|
|
475
|
+
var _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
476
|
+
function _getObjProto(target) {
|
|
477
|
+
if (target) {
|
|
478
|
+
if (_objGetPrototypeOf) {
|
|
479
|
+
return _objGetPrototypeOf(target);
|
|
480
|
+
}
|
|
481
|
+
var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
|
|
482
|
+
if (newProto) {
|
|
483
|
+
return newProto;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return null;
|
|
487
|
+
}
|
|
472
488
|
function isTypeof(value, theType) {
|
|
473
489
|
return typeof value === theType;
|
|
474
490
|
}
|
|
@@ -566,6 +582,22 @@
|
|
|
566
582
|
function isBoolean(value) {
|
|
567
583
|
return typeof value === "boolean";
|
|
568
584
|
}
|
|
585
|
+
function isPlainObject(value) {
|
|
586
|
+
var result = false;
|
|
587
|
+
if (value && typeof value === "object") {
|
|
588
|
+
var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
|
|
589
|
+
if (!proto) {
|
|
590
|
+
result = true;
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
|
|
594
|
+
proto = proto[strConstructor];
|
|
595
|
+
}
|
|
596
|
+
result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
return result;
|
|
600
|
+
}
|
|
569
601
|
function toISOString(date) {
|
|
570
602
|
if (date) {
|
|
571
603
|
return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
|
|
@@ -731,6 +763,10 @@
|
|
|
731
763
|
}
|
|
732
764
|
return false;
|
|
733
765
|
}
|
|
766
|
+
function _doNothing(value) {
|
|
767
|
+
return value;
|
|
768
|
+
}
|
|
769
|
+
var objFreeze = _objFreeze || _doNothing;
|
|
734
770
|
function dateNow() {
|
|
735
771
|
var dt = Date;
|
|
736
772
|
return dt.now ? dt.now() : new dt().getTime();
|
|
@@ -755,6 +791,50 @@
|
|
|
755
791
|
function isTruthy(value) {
|
|
756
792
|
return !!value;
|
|
757
793
|
}
|
|
794
|
+
function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
|
|
795
|
+
var theArgs = arguments;
|
|
796
|
+
var extended = theArgs[0] || {};
|
|
797
|
+
var argLen = theArgs.length;
|
|
798
|
+
var deep = false;
|
|
799
|
+
var idx = 1;
|
|
800
|
+
if (argLen > 0 && isBoolean(extended)) {
|
|
801
|
+
deep = extended;
|
|
802
|
+
extended = theArgs[idx] || {};
|
|
803
|
+
idx++;
|
|
804
|
+
}
|
|
805
|
+
if (!isObject(extended)) {
|
|
806
|
+
extended = {};
|
|
807
|
+
}
|
|
808
|
+
for (; idx < argLen; idx++) {
|
|
809
|
+
var arg = theArgs[idx];
|
|
810
|
+
var isArgArray = isArray(arg);
|
|
811
|
+
var isArgObj = isObject(arg);
|
|
812
|
+
for (var prop in arg) {
|
|
813
|
+
var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
|
|
814
|
+
if (!propOk) {
|
|
815
|
+
continue;
|
|
816
|
+
}
|
|
817
|
+
var newValue = arg[prop];
|
|
818
|
+
var isNewArray = void 0;
|
|
819
|
+
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
820
|
+
var clone = extended[prop];
|
|
821
|
+
if (isNewArray) {
|
|
822
|
+
if (!isArray(clone)) {
|
|
823
|
+
clone = [];
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
else if (!isPlainObject(clone)) {
|
|
827
|
+
clone = {};
|
|
828
|
+
}
|
|
829
|
+
newValue = objExtend(deep, clone, newValue);
|
|
830
|
+
}
|
|
831
|
+
if (newValue !== undefined) {
|
|
832
|
+
extended[prop] = newValue;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
return extended;
|
|
837
|
+
}
|
|
758
838
|
|
|
759
839
|
var strWindow = "window";
|
|
760
840
|
var strDocument = "document";
|
|
@@ -1144,252 +1224,240 @@
|
|
|
1144
1224
|
return func();
|
|
1145
1225
|
}
|
|
1146
1226
|
|
|
1147
|
-
var
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1227
|
+
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1228
|
+
var strHasRunFlags = "_hasRun";
|
|
1229
|
+
var strGetTelCtx = "_getTelCtx";
|
|
1230
|
+
var _chainId = 0;
|
|
1231
|
+
function _getNextProxyStart(proxy, config, core, startAt) {
|
|
1232
|
+
while (proxy) {
|
|
1233
|
+
if (proxy.getPlugin() === startAt) {
|
|
1234
|
+
return proxy;
|
|
1235
|
+
}
|
|
1236
|
+
proxy = proxy.getNext();
|
|
1237
|
+
}
|
|
1238
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1239
|
+
}
|
|
1240
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1241
|
+
var _nextProxy = null;
|
|
1242
|
+
var _onComplete = null;
|
|
1243
|
+
if (startAt) {
|
|
1244
|
+
_nextProxy = _getNextProxyStart(telemetryChain, config, core, startAt);
|
|
1245
|
+
}
|
|
1246
|
+
else {
|
|
1247
|
+
_nextProxy = telemetryChain;
|
|
1248
|
+
}
|
|
1249
|
+
var context = {
|
|
1250
|
+
core: function () {
|
|
1251
|
+
return core;
|
|
1252
|
+
},
|
|
1253
|
+
diagLog: function () {
|
|
1254
|
+
return safeGetLogger(core, config);
|
|
1255
|
+
},
|
|
1256
|
+
getCfg: function () {
|
|
1257
|
+
return config;
|
|
1258
|
+
},
|
|
1259
|
+
getExtCfg: _getExtCfg,
|
|
1260
|
+
getConfig: _getConfig,
|
|
1261
|
+
hasNext: function () {
|
|
1262
|
+
return _nextProxy != null;
|
|
1263
|
+
},
|
|
1264
|
+
getNext: function () {
|
|
1158
1265
|
return _nextProxy;
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1266
|
+
},
|
|
1267
|
+
setNext: function (nextPlugin) {
|
|
1161
1268
|
_nextProxy = nextPlugin;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1269
|
+
},
|
|
1270
|
+
processNext: function (env) {
|
|
1271
|
+
_processChain(function (nextPlugin) {
|
|
1272
|
+
nextPlugin.processTelemetry(env, context);
|
|
1273
|
+
});
|
|
1274
|
+
},
|
|
1275
|
+
iterate: _iterateChain,
|
|
1276
|
+
createNew: function (plugins, startAt) {
|
|
1277
|
+
if (plugins === void 0) { plugins = null; }
|
|
1278
|
+
if (isArray(plugins)) {
|
|
1279
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1280
|
+
}
|
|
1281
|
+
return createProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1282
|
+
},
|
|
1283
|
+
onComplete: function (onComplete) {
|
|
1284
|
+
_onComplete = onComplete;
|
|
1285
|
+
}
|
|
1286
|
+
};
|
|
1287
|
+
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1288
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1289
|
+
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
1290
|
+
var theConfig;
|
|
1291
|
+
if (config) {
|
|
1292
|
+
var extConfig = config.extensionConfig;
|
|
1293
|
+
if (extConfig && identifier) {
|
|
1294
|
+
theConfig = extConfig[identifier];
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
if (!theConfig) {
|
|
1298
|
+
theConfig = defaultValue;
|
|
1299
|
+
}
|
|
1300
|
+
else if (isObject(defaultValue)) {
|
|
1301
|
+
if (mergeDefault !== 0 ) {
|
|
1302
|
+
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1303
|
+
if (config && mergeDefault === 2 ) {
|
|
1304
|
+
objForEachKey(defaultValue, function (field) {
|
|
1305
|
+
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1306
|
+
var cfgValue = config[field];
|
|
1307
|
+
if (!isNullOrUndefined(cfgValue)) {
|
|
1308
|
+
newConfig_1[field] = cfgValue;
|
|
1309
|
+
}
|
|
1186
1310
|
}
|
|
1187
|
-
}
|
|
1311
|
+
});
|
|
1188
1312
|
}
|
|
1189
|
-
else if (_nextProxy) {
|
|
1190
|
-
_self._hasRun = true;
|
|
1191
|
-
_nextProxy.processTelemetry(env, itemCtx);
|
|
1192
|
-
}
|
|
1193
|
-
}, function () { return ({ item: env }); }, !(env.sync));
|
|
1194
|
-
};
|
|
1195
|
-
}
|
|
1196
|
-
return TelemetryPluginChain;
|
|
1197
|
-
}());
|
|
1198
|
-
|
|
1199
|
-
function _createProxyChain(plugins, itemCtx) {
|
|
1200
|
-
var proxies = [];
|
|
1201
|
-
if (plugins && plugins.length > 0) {
|
|
1202
|
-
var lastProxy = null;
|
|
1203
|
-
for (var idx = 0; idx < plugins.length; idx++) {
|
|
1204
|
-
var thePlugin = plugins[idx];
|
|
1205
|
-
if (thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1206
|
-
var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
|
|
1207
|
-
proxies.push(newProxy);
|
|
1208
|
-
if (lastProxy) {
|
|
1209
|
-
lastProxy.setNext(newProxy);
|
|
1210
|
-
}
|
|
1211
|
-
lastProxy = newProxy;
|
|
1212
1313
|
}
|
|
1213
1314
|
}
|
|
1315
|
+
return theConfig;
|
|
1214
1316
|
}
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
while (proxy) {
|
|
1222
|
-
var thePlugin = proxy.getPlugin();
|
|
1223
|
-
if (add || thePlugin === startAt) {
|
|
1224
|
-
add = true;
|
|
1225
|
-
plugins.push(thePlugin);
|
|
1226
|
-
}
|
|
1227
|
-
proxy = proxy.getNext();
|
|
1317
|
+
function _getConfig(identifier, field, defaultValue) {
|
|
1318
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
1319
|
+
var theValue;
|
|
1320
|
+
var extConfig = _getExtCfg(identifier, null);
|
|
1321
|
+
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1322
|
+
theValue = extConfig[field];
|
|
1228
1323
|
}
|
|
1324
|
+
else if (config && !isNullOrUndefined(config[field])) {
|
|
1325
|
+
theValue = config[field];
|
|
1326
|
+
}
|
|
1327
|
+
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1229
1328
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
arrForEach(srcPlugins, function (thePlugin) {
|
|
1241
|
-
if (add || thePlugin === startAt) {
|
|
1242
|
-
add = true;
|
|
1243
|
-
plugins.push(thePlugin);
|
|
1329
|
+
function _processChain(cb) {
|
|
1330
|
+
var nextPlugin = _nextProxy;
|
|
1331
|
+
if (nextPlugin) {
|
|
1332
|
+
_nextProxy = nextPlugin.getNext();
|
|
1333
|
+
cb(nextPlugin);
|
|
1334
|
+
}
|
|
1335
|
+
else {
|
|
1336
|
+
if (_onComplete) {
|
|
1337
|
+
_onComplete();
|
|
1338
|
+
_onComplete = null;
|
|
1244
1339
|
}
|
|
1245
|
-
}
|
|
1340
|
+
}
|
|
1246
1341
|
}
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1342
|
+
function _iterateChain(cb) {
|
|
1343
|
+
while (_nextProxy) {
|
|
1344
|
+
_processChain(function (nextPlugin) {
|
|
1345
|
+
var plugin = nextPlugin.getPlugin();
|
|
1346
|
+
if (plugin) {
|
|
1347
|
+
cb(plugin);
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1250
1350
|
}
|
|
1251
|
-
plugins.push(startAt);
|
|
1252
1351
|
}
|
|
1253
|
-
return
|
|
1352
|
+
return context;
|
|
1254
1353
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1354
|
+
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
1355
|
+
var firstProxy = null;
|
|
1356
|
+
var add = startAt ? false : true;
|
|
1357
|
+
if (isArray(plugins) && plugins.length > 0) {
|
|
1358
|
+
var lastProxy_1 = null;
|
|
1359
|
+
arrForEach(plugins, function (thePlugin) {
|
|
1360
|
+
if (!add && startAt === thePlugin) {
|
|
1361
|
+
add = true;
|
|
1262
1362
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1363
|
+
if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1364
|
+
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
1365
|
+
if (!firstProxy) {
|
|
1366
|
+
firstProxy = newProxy;
|
|
1266
1367
|
}
|
|
1267
|
-
|
|
1268
|
-
|
|
1368
|
+
if (lastProxy_1) {
|
|
1369
|
+
lastProxy_1._setNext(newProxy);
|
|
1269
1370
|
}
|
|
1371
|
+
lastProxy_1 = newProxy;
|
|
1270
1372
|
}
|
|
1271
|
-
}
|
|
1272
|
-
_self.core = function () {
|
|
1273
|
-
return core;
|
|
1274
|
-
};
|
|
1275
|
-
_self.diagLog = function () {
|
|
1276
|
-
return safeGetLogger(core, config);
|
|
1277
|
-
};
|
|
1278
|
-
_self.getCfg = function () {
|
|
1279
|
-
return config;
|
|
1280
|
-
};
|
|
1281
|
-
_self.getExtCfg = function (identifier, defaultValue) {
|
|
1282
|
-
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1283
|
-
var theConfig;
|
|
1284
|
-
if (config) {
|
|
1285
|
-
var extConfig = config.extensionConfig;
|
|
1286
|
-
if (extConfig && identifier) {
|
|
1287
|
-
theConfig = extConfig[identifier];
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
return (theConfig ? theConfig : defaultValue);
|
|
1291
|
-
};
|
|
1292
|
-
_self.getConfig = function (identifier, field, defaultValue) {
|
|
1293
|
-
if (defaultValue === void 0) { defaultValue = false; }
|
|
1294
|
-
var theValue;
|
|
1295
|
-
var extConfig = _self.getExtCfg(identifier, null);
|
|
1296
|
-
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1297
|
-
theValue = extConfig[field];
|
|
1298
|
-
}
|
|
1299
|
-
else if (config && !isNullOrUndefined(config[field])) {
|
|
1300
|
-
theValue = config[field];
|
|
1301
|
-
}
|
|
1302
|
-
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1303
|
-
};
|
|
1304
|
-
_self.hasNext = function () {
|
|
1305
|
-
return _nextProxy != null;
|
|
1306
|
-
};
|
|
1307
|
-
_self.getNext = function () {
|
|
1308
|
-
return _nextProxy;
|
|
1309
|
-
};
|
|
1310
|
-
_self.setNext = function (nextPlugin) {
|
|
1311
|
-
_nextProxy = nextPlugin;
|
|
1312
|
-
};
|
|
1313
|
-
_self.processNext = function (env) {
|
|
1314
|
-
var nextPlugin = _nextProxy;
|
|
1315
|
-
if (nextPlugin) {
|
|
1316
|
-
_nextProxy = nextPlugin.getNext();
|
|
1317
|
-
nextPlugin.processTelemetry(env, _self);
|
|
1318
|
-
}
|
|
1319
|
-
};
|
|
1320
|
-
_self.createNew = function (plugins, startAt) {
|
|
1321
|
-
if (plugins === void 0) { plugins = null; }
|
|
1322
|
-
return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1323
|
-
};
|
|
1373
|
+
});
|
|
1324
1374
|
}
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1375
|
+
if (startAt && !firstProxy) {
|
|
1376
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1377
|
+
}
|
|
1378
|
+
return firstProxy;
|
|
1379
|
+
}
|
|
1380
|
+
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1381
|
+
var nextProxy = null;
|
|
1382
|
+
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1383
|
+
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1384
|
+
var chainId;
|
|
1385
|
+
if (plugin) {
|
|
1386
|
+
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1387
|
+
}
|
|
1388
|
+
else {
|
|
1389
|
+
chainId = "Unknown-0-" + _chainId++;
|
|
1390
|
+
}
|
|
1391
|
+
var proxyChain = {
|
|
1392
|
+
getPlugin: function () {
|
|
1393
|
+
return plugin;
|
|
1394
|
+
},
|
|
1395
|
+
getNext: function () {
|
|
1396
|
+
return nextProxy;
|
|
1397
|
+
},
|
|
1398
|
+
processTelemetry: _processTelemetry,
|
|
1399
|
+
_id: chainId,
|
|
1400
|
+
_setNext: function (nextPlugin) {
|
|
1401
|
+
nextProxy = nextPlugin;
|
|
1402
|
+
}
|
|
1403
|
+
};
|
|
1404
|
+
function _processChain(itemCtx, processPluginFn, processProxyFn, name, details, isAsync) {
|
|
1405
|
+
if (!itemCtx) {
|
|
1406
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1407
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1356
1408
|
}
|
|
1357
|
-
};
|
|
1358
|
-
_self._getTelCtx = function (currentCtx) {
|
|
1359
|
-
if (currentCtx === void 0) { currentCtx = null; }
|
|
1360
|
-
var itemCtx = currentCtx;
|
|
1361
1409
|
if (!itemCtx) {
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1410
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1414
|
+
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1415
|
+
if (!hasRunContext) {
|
|
1416
|
+
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1417
|
+
}
|
|
1418
|
+
doPerf(itemCtx.core(), function () { return identifier + ":" + name; }, function () {
|
|
1419
|
+
hasRunContext[chainId] = true;
|
|
1420
|
+
var hasRun = false;
|
|
1421
|
+
itemCtx.setNext(nextProxy);
|
|
1422
|
+
if (plugin) {
|
|
1423
|
+
try {
|
|
1424
|
+
var nextId = nextProxy ? nextProxy._id : "";
|
|
1425
|
+
if (nextId) {
|
|
1426
|
+
hasRunContext[nextId] = false;
|
|
1427
|
+
}
|
|
1428
|
+
hasRun = processPluginFn(itemCtx);
|
|
1365
1429
|
}
|
|
1366
|
-
|
|
1367
|
-
|
|
1430
|
+
catch (error) {
|
|
1431
|
+
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1432
|
+
if (hasNextRun) {
|
|
1433
|
+
hasRun = true;
|
|
1434
|
+
}
|
|
1435
|
+
if (!nextProxy || !hasNextRun) {
|
|
1436
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1437
|
+
}
|
|
1368
1438
|
}
|
|
1369
1439
|
}
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
_self._baseTelInit = function (config, core, extensions, pluginChain) {
|
|
1373
|
-
if (config) {
|
|
1374
|
-
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
1440
|
+
if (nextProxy && !hasRun) {
|
|
1441
|
+
processProxyFn(itemCtx);
|
|
1375
1442
|
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1443
|
+
}, details, isAsync);
|
|
1444
|
+
}
|
|
1445
|
+
function _processTelemetry(env, itemCtx) {
|
|
1446
|
+
_processChain(itemCtx, function (itemCtx) {
|
|
1447
|
+
if (!hasProcessTelemetry) {
|
|
1448
|
+
return false;
|
|
1378
1449
|
}
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
1450
|
+
if (hasSetNext) {
|
|
1451
|
+
plugin.setNextPlugin(nextProxy);
|
|
1382
1452
|
}
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1453
|
+
plugin.processTelemetry(env, itemCtx);
|
|
1454
|
+
return true;
|
|
1455
|
+
}, function (itemCtx) {
|
|
1456
|
+
nextProxy.processTelemetry(env, itemCtx);
|
|
1457
|
+
}, "processTelemetry", function () { return ({ item: env }); }, !(env.sync));
|
|
1387
1458
|
}
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
};
|
|
1391
|
-
return BaseTelemetryPlugin;
|
|
1392
|
-
}());
|
|
1459
|
+
return objFreeze(proxyChain);
|
|
1460
|
+
}
|
|
1393
1461
|
|
|
1394
1462
|
var strToGMTString = "toGMTString";
|
|
1395
1463
|
var strToUTCString = "toUTCString";
|
|
@@ -1637,6 +1705,93 @@
|
|
|
1637
1705
|
return false;
|
|
1638
1706
|
}
|
|
1639
1707
|
|
|
1708
|
+
var strExtensionConfig = "extensionConfig";
|
|
1709
|
+
|
|
1710
|
+
var strGetPlugin = "getPlugin";
|
|
1711
|
+
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
1712
|
+
function BaseTelemetryPlugin() {
|
|
1713
|
+
var _self = this;
|
|
1714
|
+
var _isinitialized;
|
|
1715
|
+
var _rootCtx;
|
|
1716
|
+
var _nextPlugin;
|
|
1717
|
+
var _hooks;
|
|
1718
|
+
_initDefaults();
|
|
1719
|
+
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
1720
|
+
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
1721
|
+
_setDefaults(config, core, pluginChain);
|
|
1722
|
+
_isinitialized = true;
|
|
1723
|
+
};
|
|
1724
|
+
_self._addHook = function (hooks) {
|
|
1725
|
+
if (hooks) {
|
|
1726
|
+
if (isArray(hooks)) {
|
|
1727
|
+
_hooks = _hooks.concat(hooks);
|
|
1728
|
+
}
|
|
1729
|
+
else {
|
|
1730
|
+
_hooks.push(hooks);
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
};
|
|
1734
|
+
});
|
|
1735
|
+
_self.diagLog = function (itemCtx) {
|
|
1736
|
+
return _getTelCtx(itemCtx).diagLog();
|
|
1737
|
+
};
|
|
1738
|
+
_self.isInitialized = function () {
|
|
1739
|
+
return _isinitialized;
|
|
1740
|
+
};
|
|
1741
|
+
_self.setInitialized = function (isInitialized) {
|
|
1742
|
+
_isinitialized = isInitialized;
|
|
1743
|
+
};
|
|
1744
|
+
_self.setNextPlugin = function (next) {
|
|
1745
|
+
_nextPlugin = next;
|
|
1746
|
+
};
|
|
1747
|
+
_self.processNext = function (env, itemCtx) {
|
|
1748
|
+
if (itemCtx) {
|
|
1749
|
+
itemCtx.processNext(env);
|
|
1750
|
+
}
|
|
1751
|
+
else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
|
|
1752
|
+
_nextPlugin.processTelemetry(env, null);
|
|
1753
|
+
}
|
|
1754
|
+
};
|
|
1755
|
+
_self._getTelCtx = _getTelCtx;
|
|
1756
|
+
function _getTelCtx(currentCtx) {
|
|
1757
|
+
if (currentCtx === void 0) { currentCtx = null; }
|
|
1758
|
+
var itemCtx = currentCtx;
|
|
1759
|
+
if (!itemCtx) {
|
|
1760
|
+
var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
|
|
1761
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1762
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
1763
|
+
}
|
|
1764
|
+
else {
|
|
1765
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin);
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
return itemCtx;
|
|
1769
|
+
}
|
|
1770
|
+
function _setDefaults(config, core, pluginChain) {
|
|
1771
|
+
if (config) {
|
|
1772
|
+
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
1773
|
+
}
|
|
1774
|
+
if (!pluginChain && core) {
|
|
1775
|
+
pluginChain = core.getProcessTelContext().getNext();
|
|
1776
|
+
}
|
|
1777
|
+
var nextPlugin = _nextPlugin;
|
|
1778
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1779
|
+
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
1780
|
+
}
|
|
1781
|
+
_self.core = core;
|
|
1782
|
+
_rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
1783
|
+
}
|
|
1784
|
+
function _initDefaults() {
|
|
1785
|
+
_isinitialized = false;
|
|
1786
|
+
_self.core = null;
|
|
1787
|
+
_rootCtx = null;
|
|
1788
|
+
_nextPlugin = null;
|
|
1789
|
+
_hooks = [];
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
return BaseTelemetryPlugin;
|
|
1793
|
+
}());
|
|
1794
|
+
|
|
1640
1795
|
var UInt32Mask = 0x100000000;
|
|
1641
1796
|
var MaxUInt32 = 0xffffffff;
|
|
1642
1797
|
var _mwcSeeded = false;
|
|
@@ -1665,18 +1820,18 @@
|
|
|
1665
1820
|
return 0;
|
|
1666
1821
|
}
|
|
1667
1822
|
function random32(signed) {
|
|
1668
|
-
var value;
|
|
1823
|
+
var value = 0;
|
|
1669
1824
|
var c = getCrypto() || getMsCrypto();
|
|
1670
1825
|
if (c && c.getRandomValues) {
|
|
1671
1826
|
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1672
1827
|
}
|
|
1673
|
-
|
|
1828
|
+
if (value === 0 && isIE()) {
|
|
1674
1829
|
if (!_mwcSeeded) {
|
|
1675
1830
|
_autoSeedMwc();
|
|
1676
1831
|
}
|
|
1677
1832
|
value = mwcRandom32() & MaxUInt32;
|
|
1678
1833
|
}
|
|
1679
|
-
|
|
1834
|
+
if (value === 0) {
|
|
1680
1835
|
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1681
1836
|
}
|
|
1682
1837
|
if (!signed) {
|
|
@@ -1701,6 +1856,23 @@
|
|
|
1701
1856
|
}
|
|
1702
1857
|
return value;
|
|
1703
1858
|
}
|
|
1859
|
+
function newId(maxLength) {
|
|
1860
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1861
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1862
|
+
var number = random32() >>> 0;
|
|
1863
|
+
var chars = 0;
|
|
1864
|
+
var result = "";
|
|
1865
|
+
while (result.length < maxLength) {
|
|
1866
|
+
chars++;
|
|
1867
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1868
|
+
number >>>= 6;
|
|
1869
|
+
if (chars === 5) {
|
|
1870
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1871
|
+
chars = 0;
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
return result;
|
|
1875
|
+
}
|
|
1704
1876
|
|
|
1705
1877
|
var _cookieMgrs = null;
|
|
1706
1878
|
var _canUseCookies;
|
|
@@ -1733,23 +1905,6 @@
|
|
|
1733
1905
|
}
|
|
1734
1906
|
return dateNow();
|
|
1735
1907
|
}
|
|
1736
|
-
function newId(maxLength) {
|
|
1737
|
-
if (maxLength === void 0) { maxLength = 22; }
|
|
1738
|
-
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1739
|
-
var number = random32() >>> 0;
|
|
1740
|
-
var chars = 0;
|
|
1741
|
-
var result = "";
|
|
1742
|
-
while (result.length < maxLength) {
|
|
1743
|
-
chars++;
|
|
1744
|
-
result += base64chars.charAt(number & 0x3F);
|
|
1745
|
-
number >>>= 6;
|
|
1746
|
-
if (chars === 5) {
|
|
1747
|
-
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1748
|
-
chars = 0;
|
|
1749
|
-
}
|
|
1750
|
-
}
|
|
1751
|
-
return result;
|
|
1752
|
-
}
|
|
1753
1908
|
function generateW3CId() {
|
|
1754
1909
|
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
1755
1910
|
var oct = "", tmp;
|