@microsoft/applicationinsights-debugplugin-js 2.7.4-nightly.2202-09 → 2.8.0-beta.2202-07

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.
Files changed (51) hide show
  1. package/browser/{ai.dbg.2.7.4-nightly.2202-09.cjs.js → ai.dbg.2.8.0-beta.2202-07.cjs.js} +381 -240
  2. package/browser/ai.dbg.2.8.0-beta.2202-07.cjs.js.map +1 -0
  3. package/browser/ai.dbg.2.8.0-beta.2202-07.cjs.min.js +6 -0
  4. package/browser/ai.dbg.2.8.0-beta.2202-07.cjs.min.js.map +1 -0
  5. package/browser/{ai.dbg.2.7.4-nightly.2202-09.gbl.js → ai.dbg.2.8.0-beta.2202-07.gbl.js} +381 -240
  6. package/browser/ai.dbg.2.8.0-beta.2202-07.gbl.js.map +1 -0
  7. package/browser/ai.dbg.2.8.0-beta.2202-07.gbl.min.js +6 -0
  8. package/browser/ai.dbg.2.8.0-beta.2202-07.gbl.min.js.map +1 -0
  9. package/browser/ai.dbg.2.8.0-beta.2202-07.integrity.json +66 -0
  10. package/browser/{ai.dbg.2.7.4-nightly.2202-09.js → ai.dbg.2.8.0-beta.2202-07.js} +381 -240
  11. package/browser/ai.dbg.2.8.0-beta.2202-07.js.map +1 -0
  12. package/browser/ai.dbg.2.8.0-beta.2202-07.min.js +6 -0
  13. package/browser/ai.dbg.2.8.0-beta.2202-07.min.js.map +1 -0
  14. package/browser/ai.dbg.2.cjs.js +380 -239
  15. package/browser/ai.dbg.2.cjs.js.map +1 -1
  16. package/browser/ai.dbg.2.cjs.min.js +2 -2
  17. package/browser/ai.dbg.2.cjs.min.js.map +1 -1
  18. package/browser/ai.dbg.2.gbl.js +380 -239
  19. package/browser/ai.dbg.2.gbl.js.map +1 -1
  20. package/browser/ai.dbg.2.gbl.min.js +2 -2
  21. package/browser/ai.dbg.2.gbl.min.js.map +1 -1
  22. package/browser/ai.dbg.2.js +380 -239
  23. package/browser/ai.dbg.2.js.map +1 -1
  24. package/browser/ai.dbg.2.min.js +2 -2
  25. package/browser/ai.dbg.2.min.js.map +1 -1
  26. package/dist/applicationinsights-debugplugin-js.d.ts +1 -1
  27. package/dist/applicationinsights-debugplugin-js.js +380 -239
  28. package/dist/applicationinsights-debugplugin-js.js.map +1 -1
  29. package/dist/applicationinsights-debugplugin-js.min.js +2 -2
  30. package/dist/applicationinsights-debugplugin-js.min.js.map +1 -1
  31. package/dist/applicationinsights-debugplugin-js.rollup.d.ts +1 -1
  32. package/dist-esm/DebugPlugin.js +1 -1
  33. package/dist-esm/applicationinsights-debugplugin-js.js +1 -1
  34. package/dist-esm/components/Dashboard.js +1 -1
  35. package/dist-esm/components/LogEntry.js +1 -1
  36. package/dist-esm/components/debugBins.js +1 -1
  37. package/dist-esm/components/filterList.js +1 -1
  38. package/dist-esm/components/helpers.js +1 -1
  39. package/dist-esm/components/styleNodeSrc.js +1 -1
  40. package/dist-esm/interfaces/IDebugPluginConfig.js +1 -1
  41. package/package.json +4 -4
  42. package/browser/ai.dbg.2.7.4-nightly.2202-09.cjs.js.map +0 -1
  43. package/browser/ai.dbg.2.7.4-nightly.2202-09.cjs.min.js +0 -6
  44. package/browser/ai.dbg.2.7.4-nightly.2202-09.cjs.min.js.map +0 -1
  45. package/browser/ai.dbg.2.7.4-nightly.2202-09.gbl.js.map +0 -1
  46. package/browser/ai.dbg.2.7.4-nightly.2202-09.gbl.min.js +0 -6
  47. package/browser/ai.dbg.2.7.4-nightly.2202-09.gbl.min.js.map +0 -1
  48. package/browser/ai.dbg.2.7.4-nightly.2202-09.integrity.json +0 -66
  49. package/browser/ai.dbg.2.7.4-nightly.2202-09.js.map +0 -1
  50. package/browser/ai.dbg.2.7.4-nightly.2202-09.min.js +0 -6
  51. package/browser/ai.dbg.2.7.4-nightly.2202-09.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Debug Plugin, 2.7.4-nightly.2202-09
2
+ * Application Insights JavaScript SDK - Debug Plugin, 2.8.0-beta.2202-07
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  'use strict';
@@ -423,6 +423,7 @@ var strToString = "toString";
423
423
  var str__Proto = "__proto__";
424
424
  var strConstructor$1 = "constructor";
425
425
  var _objDefineProperty = ObjDefineProperty;
426
+ var _objFreeze = ObjClass.freeze;
426
427
  var _objKeys = ObjClass.keys;
427
428
  var StringProto = String[strShimPrototype];
428
429
  var _strTrim = StringProto[cStrTrim];
@@ -432,7 +433,7 @@ var _dataToISOString = DateProto[strToISOString];
432
433
  var _isArray = Array.isArray;
433
434
  var _objToString = ObjProto[strToString];
434
435
  var _fnToString = ObjHasOwnProperty[strToString];
435
- _fnToString.call(ObjClass);
436
+ var _objFunctionString = _fnToString.call(ObjClass);
436
437
  var _objGetPrototypeOf = Object["getPrototypeOf"];
437
438
  function _getObjProto(target) {
438
439
  if (target) {
@@ -546,6 +547,22 @@ function isBoolean(value) {
546
547
  function isSymbol(value) {
547
548
  return typeof value === "symbol";
548
549
  }
550
+ function isPlainObject(value) {
551
+ var result = false;
552
+ if (value && typeof value === "object") {
553
+ var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
554
+ if (!proto) {
555
+ result = true;
556
+ }
557
+ else {
558
+ if (proto[strConstructor$1] && ObjHasOwnProperty.call(proto, strConstructor$1)) {
559
+ proto = proto[strConstructor$1];
560
+ }
561
+ result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
562
+ }
563
+ }
564
+ return result;
565
+ }
549
566
  function toISOString(date) {
550
567
  if (date) {
551
568
  return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
@@ -711,6 +728,10 @@ function objDefineAccessors(target, prop, getProp, setProp) {
711
728
  }
712
729
  return false;
713
730
  }
731
+ function _doNothing(value) {
732
+ return value;
733
+ }
734
+ var objFreeze = _objFreeze || _doNothing;
714
735
  function dateNow() {
715
736
  var dt = Date;
716
737
  return dt.now ? dt.now() : new dt().getTime();
@@ -735,6 +756,50 @@ function setValue(target, field, value, valChk, srcChk) {
735
756
  function isTruthy(value) {
736
757
  return !!value;
737
758
  }
759
+ function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
760
+ var theArgs = arguments;
761
+ var extended = theArgs[0] || {};
762
+ var argLen = theArgs.length;
763
+ var deep = false;
764
+ var idx = 1;
765
+ if (argLen > 0 && isBoolean(extended)) {
766
+ deep = extended;
767
+ extended = theArgs[idx] || {};
768
+ idx++;
769
+ }
770
+ if (!isObject(extended)) {
771
+ extended = {};
772
+ }
773
+ for (; idx < argLen; idx++) {
774
+ var arg = theArgs[idx];
775
+ var isArgArray = isArray(arg);
776
+ var isArgObj = isObject(arg);
777
+ for (var prop in arg) {
778
+ var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
779
+ if (!propOk) {
780
+ continue;
781
+ }
782
+ var newValue = arg[prop];
783
+ var isNewArray = void 0;
784
+ if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
785
+ var clone = extended[prop];
786
+ if (isNewArray) {
787
+ if (!isArray(clone)) {
788
+ clone = [];
789
+ }
790
+ }
791
+ else if (!isPlainObject(clone)) {
792
+ clone = {};
793
+ }
794
+ newValue = objExtend(deep, clone, newValue);
795
+ }
796
+ if (newValue !== undefined) {
797
+ extended[prop] = newValue;
798
+ }
799
+ }
800
+ }
801
+ return extended;
802
+ }
738
803
 
739
804
  var strWindow = "window";
740
805
  var strDocument = "document";
@@ -1151,252 +1216,240 @@ function doPerf(mgrSource, getSource, func, details, isAsync) {
1151
1216
  return func();
1152
1217
  }
1153
1218
 
1154
- var TelemetryPluginChain = /** @class */ (function () {
1155
- function TelemetryPluginChain(plugin, defItemCtx) {
1156
- var _self = this;
1157
- var _nextProxy = null;
1158
- var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
1159
- var _hasSetNext = isFunction(plugin.setNextPlugin);
1160
- _self._hasRun = false;
1161
- _self.getPlugin = function () {
1162
- return plugin;
1163
- };
1164
- _self.getNext = function () {
1219
+ var strTelemetryPluginChain = "TelemetryPluginChain";
1220
+ var strHasRunFlags = "_hasRun";
1221
+ var strGetTelCtx = "_getTelCtx";
1222
+ var _chainId = 0;
1223
+ function _getNextProxyStart(proxy, config, core, startAt) {
1224
+ while (proxy) {
1225
+ if (proxy.getPlugin() === startAt) {
1226
+ return proxy;
1227
+ }
1228
+ proxy = proxy.getNext();
1229
+ }
1230
+ return createTelemetryProxyChain([startAt], config, core);
1231
+ }
1232
+ function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
1233
+ var _nextProxy = null;
1234
+ var _onComplete = null;
1235
+ if (startAt) {
1236
+ _nextProxy = _getNextProxyStart(telemetryChain, config, core, startAt);
1237
+ }
1238
+ else {
1239
+ _nextProxy = telemetryChain;
1240
+ }
1241
+ var context = {
1242
+ core: function () {
1243
+ return core;
1244
+ },
1245
+ diagLog: function () {
1246
+ return safeGetLogger(core, config);
1247
+ },
1248
+ getCfg: function () {
1249
+ return config;
1250
+ },
1251
+ getExtCfg: _getExtCfg,
1252
+ getConfig: _getConfig,
1253
+ hasNext: function () {
1254
+ return _nextProxy != null;
1255
+ },
1256
+ getNext: function () {
1165
1257
  return _nextProxy;
1166
- };
1167
- _self.setNext = function (nextPlugin) {
1258
+ },
1259
+ setNext: function (nextPlugin) {
1168
1260
  _nextProxy = nextPlugin;
1169
- };
1170
- _self.processTelemetry = function (env, itemCtx) {
1171
- if (!itemCtx) {
1172
- itemCtx = defItemCtx;
1261
+ },
1262
+ processNext: function (env) {
1263
+ _processChain(function (nextPlugin) {
1264
+ nextPlugin.processTelemetry(env, context);
1265
+ });
1266
+ },
1267
+ iterate: _iterateChain,
1268
+ createNew: function (plugins, startAt) {
1269
+ if (plugins === void 0) { plugins = null; }
1270
+ if (isArray(plugins)) {
1271
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1173
1272
  }
1174
- var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
1175
- doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
1176
- if (plugin && _hasProcessTelemetry) {
1177
- _self._hasRun = true;
1178
- try {
1179
- itemCtx.setNext(_nextProxy);
1180
- if (_hasSetNext) {
1181
- plugin.setNextPlugin(_nextProxy);
1182
- }
1183
- _nextProxy && (_nextProxy._hasRun = false);
1184
- plugin.processTelemetry(env, itemCtx);
1185
- }
1186
- catch (error) {
1187
- var hasRun = _nextProxy && _nextProxy._hasRun;
1188
- if (!_nextProxy || !hasRun) {
1189
- itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
1190
- }
1191
- if (_nextProxy && !hasRun) {
1192
- _nextProxy.processTelemetry(env, itemCtx);
1273
+ return createProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
1274
+ },
1275
+ onComplete: function (onComplete) {
1276
+ _onComplete = onComplete;
1277
+ }
1278
+ };
1279
+ function _getExtCfg(identifier, defaultValue, mergeDefault) {
1280
+ if (defaultValue === void 0) { defaultValue = {}; }
1281
+ if (mergeDefault === void 0) { mergeDefault = 0 ; }
1282
+ var theConfig;
1283
+ if (config) {
1284
+ var extConfig = config.extensionConfig;
1285
+ if (extConfig && identifier) {
1286
+ theConfig = extConfig[identifier];
1287
+ }
1288
+ }
1289
+ if (!theConfig) {
1290
+ theConfig = defaultValue;
1291
+ }
1292
+ else if (isObject(defaultValue)) {
1293
+ if (mergeDefault !== 0 ) {
1294
+ var newConfig_1 = objExtend(true, defaultValue, theConfig);
1295
+ if (config && mergeDefault === 2 ) {
1296
+ objForEachKey(defaultValue, function (field) {
1297
+ if (isNullOrUndefined(newConfig_1[field])) {
1298
+ var cfgValue = config[field];
1299
+ if (!isNullOrUndefined(cfgValue)) {
1300
+ newConfig_1[field] = cfgValue;
1301
+ }
1193
1302
  }
1194
- }
1195
- }
1196
- else if (_nextProxy) {
1197
- _self._hasRun = true;
1198
- _nextProxy.processTelemetry(env, itemCtx);
1199
- }
1200
- }, function () { return ({ item: env }); }, !(env.sync));
1201
- };
1202
- }
1203
- return TelemetryPluginChain;
1204
- }());
1205
-
1206
- function _createProxyChain(plugins, itemCtx) {
1207
- var proxies = [];
1208
- if (plugins && plugins.length > 0) {
1209
- var lastProxy = null;
1210
- for (var idx = 0; idx < plugins.length; idx++) {
1211
- var thePlugin = plugins[idx];
1212
- if (thePlugin && isFunction(thePlugin.processTelemetry)) {
1213
- var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
1214
- proxies.push(newProxy);
1215
- if (lastProxy) {
1216
- lastProxy.setNext(newProxy);
1303
+ });
1217
1304
  }
1218
- lastProxy = newProxy;
1219
1305
  }
1220
1306
  }
1307
+ return theConfig;
1221
1308
  }
1222
- return proxies.length > 0 ? proxies[0] : null;
1223
- }
1224
- function _copyProxyChain(proxy, itemCtx, startAt) {
1225
- var plugins = [];
1226
- var add = startAt ? false : true;
1227
- if (proxy) {
1228
- while (proxy) {
1229
- var thePlugin = proxy.getPlugin();
1230
- if (add || thePlugin === startAt) {
1231
- add = true;
1232
- plugins.push(thePlugin);
1233
- }
1234
- proxy = proxy.getNext();
1309
+ function _getConfig(identifier, field, defaultValue) {
1310
+ if (defaultValue === void 0) { defaultValue = false; }
1311
+ var theValue;
1312
+ var extConfig = _getExtCfg(identifier, null);
1313
+ if (extConfig && !isNullOrUndefined(extConfig[field])) {
1314
+ theValue = extConfig[field];
1235
1315
  }
1316
+ else if (config && !isNullOrUndefined(config[field])) {
1317
+ theValue = config[field];
1318
+ }
1319
+ return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1236
1320
  }
1237
- if (!add) {
1238
- plugins.push(startAt);
1239
- }
1240
- return _createProxyChain(plugins, itemCtx);
1241
- }
1242
- function _copyPluginChain(srcPlugins, itemCtx, startAt) {
1243
- var plugins = srcPlugins;
1244
- var add = false;
1245
- if (startAt && srcPlugins) {
1246
- plugins = [];
1247
- arrForEach(srcPlugins, function (thePlugin) {
1248
- if (add || thePlugin === startAt) {
1249
- add = true;
1250
- plugins.push(thePlugin);
1321
+ function _processChain(cb) {
1322
+ var nextPlugin = _nextProxy;
1323
+ if (nextPlugin) {
1324
+ _nextProxy = nextPlugin.getNext();
1325
+ cb(nextPlugin);
1326
+ }
1327
+ else {
1328
+ if (_onComplete) {
1329
+ _onComplete();
1330
+ _onComplete = null;
1251
1331
  }
1252
- });
1332
+ }
1253
1333
  }
1254
- if (startAt && !add) {
1255
- if (!plugins) {
1256
- plugins = [];
1334
+ function _iterateChain(cb) {
1335
+ while (_nextProxy) {
1336
+ _processChain(function (nextPlugin) {
1337
+ var plugin = nextPlugin.getPlugin();
1338
+ if (plugin) {
1339
+ cb(plugin);
1340
+ }
1341
+ });
1257
1342
  }
1258
- plugins.push(startAt);
1259
1343
  }
1260
- return _createProxyChain(plugins, itemCtx);
1344
+ return context;
1261
1345
  }
1262
- var ProcessTelemetryContext = /** @class */ (function () {
1263
- function ProcessTelemetryContext(plugins, config, core, startAt) {
1264
- var _self = this;
1265
- var _nextProxy = null;
1266
- if (startAt !== null) {
1267
- if (plugins && isFunction(plugins.getPlugin)) {
1268
- _nextProxy = _copyProxyChain(plugins, _self, startAt || plugins.getPlugin());
1346
+ function createTelemetryProxyChain(plugins, config, core, startAt) {
1347
+ var firstProxy = null;
1348
+ var add = startAt ? false : true;
1349
+ if (isArray(plugins) && plugins.length > 0) {
1350
+ var lastProxy_1 = null;
1351
+ arrForEach(plugins, function (thePlugin) {
1352
+ if (!add && startAt === thePlugin) {
1353
+ add = true;
1269
1354
  }
1270
- else {
1271
- if (startAt) {
1272
- _nextProxy = _copyPluginChain(plugins, _self, startAt);
1273
- }
1274
- else if (isUndefined(startAt)) {
1275
- _nextProxy = _createProxyChain(plugins, _self);
1355
+ if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
1356
+ var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
1357
+ if (!firstProxy) {
1358
+ firstProxy = newProxy;
1276
1359
  }
1277
- }
1278
- }
1279
- _self.core = function () {
1280
- return core;
1281
- };
1282
- _self.diagLog = function () {
1283
- return safeGetLogger(core, config);
1284
- };
1285
- _self.getCfg = function () {
1286
- return config;
1287
- };
1288
- _self.getExtCfg = function (identifier, defaultValue) {
1289
- if (defaultValue === void 0) { defaultValue = {}; }
1290
- var theConfig;
1291
- if (config) {
1292
- var extConfig = config.extensionConfig;
1293
- if (extConfig && identifier) {
1294
- theConfig = extConfig[identifier];
1360
+ if (lastProxy_1) {
1361
+ lastProxy_1._setNext(newProxy);
1295
1362
  }
1363
+ lastProxy_1 = newProxy;
1296
1364
  }
1297
- return (theConfig ? theConfig : defaultValue);
1298
- };
1299
- _self.getConfig = function (identifier, field, defaultValue) {
1300
- if (defaultValue === void 0) { defaultValue = false; }
1301
- var theValue;
1302
- var extConfig = _self.getExtCfg(identifier, null);
1303
- if (extConfig && !isNullOrUndefined(extConfig[field])) {
1304
- theValue = extConfig[field];
1305
- }
1306
- else if (config && !isNullOrUndefined(config[field])) {
1307
- theValue = config[field];
1308
- }
1309
- return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1310
- };
1311
- _self.hasNext = function () {
1312
- return _nextProxy != null;
1313
- };
1314
- _self.getNext = function () {
1315
- return _nextProxy;
1316
- };
1317
- _self.setNext = function (nextPlugin) {
1318
- _nextProxy = nextPlugin;
1319
- };
1320
- _self.processNext = function (env) {
1321
- var nextPlugin = _nextProxy;
1322
- if (nextPlugin) {
1323
- _nextProxy = nextPlugin.getNext();
1324
- nextPlugin.processTelemetry(env, _self);
1325
- }
1326
- };
1327
- _self.createNew = function (plugins, startAt) {
1328
- if (plugins === void 0) { plugins = null; }
1329
- return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
1330
- };
1365
+ });
1331
1366
  }
1332
- return ProcessTelemetryContext;
1333
- }());
1334
-
1335
- var strExtensionConfig = "extensionConfig";
1336
-
1337
- var strGetPlugin = "getPlugin";
1338
- var BaseTelemetryPlugin = /** @class */ (function () {
1339
- function BaseTelemetryPlugin() {
1340
- var _self = this;
1341
- var _isinitialized = false;
1342
- var _rootCtx = null;
1343
- var _nextPlugin = null;
1344
- _self.core = null;
1345
- _self.diagLog = function (itemCtx) {
1346
- return _self._getTelCtx(itemCtx).diagLog();
1347
- };
1348
- _self.isInitialized = function () {
1349
- return _isinitialized;
1350
- };
1351
- _self.setInitialized = function (isInitialized) {
1352
- _isinitialized = isInitialized;
1353
- };
1354
- _self.setNextPlugin = function (next) {
1355
- _nextPlugin = next;
1356
- };
1357
- _self.processNext = function (env, itemCtx) {
1358
- if (itemCtx) {
1359
- itemCtx.processNext(env);
1360
- }
1361
- else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
1362
- _nextPlugin.processTelemetry(env, null);
1367
+ if (startAt && !firstProxy) {
1368
+ return createTelemetryProxyChain([startAt], config, core);
1369
+ }
1370
+ return firstProxy;
1371
+ }
1372
+ function createTelemetryPluginProxy(plugin, config, core) {
1373
+ var nextProxy = null;
1374
+ var hasProcessTelemetry = isFunction(plugin.processTelemetry);
1375
+ var hasSetNext = isFunction(plugin.setNextPlugin);
1376
+ var chainId;
1377
+ if (plugin) {
1378
+ chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
1379
+ }
1380
+ else {
1381
+ chainId = "Unknown-0-" + _chainId++;
1382
+ }
1383
+ var proxyChain = {
1384
+ getPlugin: function () {
1385
+ return plugin;
1386
+ },
1387
+ getNext: function () {
1388
+ return nextProxy;
1389
+ },
1390
+ processTelemetry: _processTelemetry,
1391
+ _id: chainId,
1392
+ _setNext: function (nextPlugin) {
1393
+ nextProxy = nextPlugin;
1394
+ }
1395
+ };
1396
+ function _processChain(itemCtx, processPluginFn, processProxyFn, name, details, isAsync) {
1397
+ if (!itemCtx) {
1398
+ if (plugin && isFunction(plugin[strGetTelCtx])) {
1399
+ itemCtx = plugin[strGetTelCtx]();
1363
1400
  }
1364
- };
1365
- _self._getTelCtx = function (currentCtx) {
1366
- if (currentCtx === void 0) { currentCtx = null; }
1367
- var itemCtx = currentCtx;
1368
1401
  if (!itemCtx) {
1369
- var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);
1370
- if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1371
- itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
1402
+ itemCtx = createProcessTelemetryContext(proxyChain, config, core);
1403
+ }
1404
+ }
1405
+ var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
1406
+ var hasRunContext = itemCtx[strHasRunFlags];
1407
+ if (!hasRunContext) {
1408
+ hasRunContext = itemCtx[strHasRunFlags] = {};
1409
+ }
1410
+ doPerf(itemCtx.core(), function () { return identifier + ":" + name; }, function () {
1411
+ hasRunContext[chainId] = true;
1412
+ var hasRun = false;
1413
+ itemCtx.setNext(nextProxy);
1414
+ if (plugin) {
1415
+ try {
1416
+ var nextId = nextProxy ? nextProxy._id : "";
1417
+ if (nextId) {
1418
+ hasRunContext[nextId] = false;
1419
+ }
1420
+ hasRun = processPluginFn(itemCtx);
1372
1421
  }
1373
- else {
1374
- itemCtx = rootCtx.createNew(null, _nextPlugin);
1422
+ catch (error) {
1423
+ var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
1424
+ if (hasNextRun) {
1425
+ hasRun = true;
1426
+ }
1427
+ if (!nextProxy || !hasNextRun) {
1428
+ itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1429
+ }
1375
1430
  }
1376
1431
  }
1377
- return itemCtx;
1378
- };
1379
- _self._baseTelInit = function (config, core, extensions, pluginChain) {
1380
- if (config) {
1381
- setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
1432
+ if (nextProxy && !hasRun) {
1433
+ processProxyFn(itemCtx);
1382
1434
  }
1383
- if (!pluginChain && core) {
1384
- pluginChain = core.getProcessTelContext().getNext();
1435
+ }, details, isAsync);
1436
+ }
1437
+ function _processTelemetry(env, itemCtx) {
1438
+ _processChain(itemCtx, function (itemCtx) {
1439
+ if (!hasProcessTelemetry) {
1440
+ return false;
1385
1441
  }
1386
- var nextPlugin = _nextPlugin;
1387
- if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1388
- nextPlugin = _nextPlugin[strGetPlugin]();
1442
+ if (hasSetNext) {
1443
+ plugin.setNextPlugin(nextProxy);
1389
1444
  }
1390
- _self.core = core;
1391
- _rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
1392
- _isinitialized = true;
1393
- };
1445
+ plugin.processTelemetry(env, itemCtx);
1446
+ return true;
1447
+ }, function (itemCtx) {
1448
+ nextProxy.processTelemetry(env, itemCtx);
1449
+ }, "processTelemetry", function () { return ({ item: env }); }, !(env.sync));
1394
1450
  }
1395
- BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
1396
- this._baseTelInit(config, core, extensions, pluginChain);
1397
- };
1398
- return BaseTelemetryPlugin;
1399
- }());
1451
+ return objFreeze(proxyChain);
1452
+ }
1400
1453
 
1401
1454
  var strToGMTString = "toGMTString";
1402
1455
  var strToUTCString = "toUTCString";
@@ -1625,6 +1678,93 @@ function uaDisallowsSameSiteNone(userAgent) {
1625
1678
  return false;
1626
1679
  }
1627
1680
 
1681
+ var strExtensionConfig = "extensionConfig";
1682
+
1683
+ var strGetPlugin = "getPlugin";
1684
+ var BaseTelemetryPlugin = /** @class */ (function () {
1685
+ function BaseTelemetryPlugin() {
1686
+ var _self = this;
1687
+ var _isinitialized;
1688
+ var _rootCtx;
1689
+ var _nextPlugin;
1690
+ var _hooks;
1691
+ _initDefaults();
1692
+ dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
1693
+ _self.initialize = function (config, core, extensions, pluginChain) {
1694
+ _setDefaults(config, core, pluginChain);
1695
+ _isinitialized = true;
1696
+ };
1697
+ _self._addHook = function (hooks) {
1698
+ if (hooks) {
1699
+ if (isArray(hooks)) {
1700
+ _hooks = _hooks.concat(hooks);
1701
+ }
1702
+ else {
1703
+ _hooks.push(hooks);
1704
+ }
1705
+ }
1706
+ };
1707
+ });
1708
+ _self.diagLog = function (itemCtx) {
1709
+ return _getTelCtx(itemCtx).diagLog();
1710
+ };
1711
+ _self.isInitialized = function () {
1712
+ return _isinitialized;
1713
+ };
1714
+ _self.setInitialized = function (isInitialized) {
1715
+ _isinitialized = isInitialized;
1716
+ };
1717
+ _self.setNextPlugin = function (next) {
1718
+ _nextPlugin = next;
1719
+ };
1720
+ _self.processNext = function (env, itemCtx) {
1721
+ if (itemCtx) {
1722
+ itemCtx.processNext(env);
1723
+ }
1724
+ else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
1725
+ _nextPlugin.processTelemetry(env, null);
1726
+ }
1727
+ };
1728
+ _self._getTelCtx = _getTelCtx;
1729
+ function _getTelCtx(currentCtx) {
1730
+ if (currentCtx === void 0) { currentCtx = null; }
1731
+ var itemCtx = currentCtx;
1732
+ if (!itemCtx) {
1733
+ var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
1734
+ if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1735
+ itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
1736
+ }
1737
+ else {
1738
+ itemCtx = rootCtx.createNew(null, _nextPlugin);
1739
+ }
1740
+ }
1741
+ return itemCtx;
1742
+ }
1743
+ function _setDefaults(config, core, pluginChain) {
1744
+ if (config) {
1745
+ setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
1746
+ }
1747
+ if (!pluginChain && core) {
1748
+ pluginChain = core.getProcessTelContext().getNext();
1749
+ }
1750
+ var nextPlugin = _nextPlugin;
1751
+ if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1752
+ nextPlugin = _nextPlugin[strGetPlugin]();
1753
+ }
1754
+ _self.core = core;
1755
+ _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
1756
+ }
1757
+ function _initDefaults() {
1758
+ _isinitialized = false;
1759
+ _self.core = null;
1760
+ _rootCtx = null;
1761
+ _nextPlugin = null;
1762
+ _hooks = [];
1763
+ }
1764
+ }
1765
+ return BaseTelemetryPlugin;
1766
+ }());
1767
+
1628
1768
  var UInt32Mask = 0x100000000;
1629
1769
  var MaxUInt32 = 0xffffffff;
1630
1770
  var _mwcSeeded = false;
@@ -1653,18 +1793,18 @@ function randomValue(maxValue) {
1653
1793
  return 0;
1654
1794
  }
1655
1795
  function random32(signed) {
1656
- var value;
1796
+ var value = 0;
1657
1797
  var c = getCrypto() || getMsCrypto();
1658
1798
  if (c && c.getRandomValues) {
1659
1799
  value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1660
1800
  }
1661
- else if (isIE()) {
1801
+ if (value === 0 && isIE()) {
1662
1802
  if (!_mwcSeeded) {
1663
1803
  _autoSeedMwc();
1664
1804
  }
1665
1805
  value = mwcRandom32() & MaxUInt32;
1666
1806
  }
1667
- else {
1807
+ if (value === 0) {
1668
1808
  value = Math.floor((UInt32Mask * Math.random()) | 0);
1669
1809
  }
1670
1810
  if (!signed) {
@@ -1689,6 +1829,23 @@ function mwcRandom32(signed) {
1689
1829
  }
1690
1830
  return value;
1691
1831
  }
1832
+ function newId(maxLength) {
1833
+ if (maxLength === void 0) { maxLength = 22; }
1834
+ var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1835
+ var number = random32() >>> 0;
1836
+ var chars = 0;
1837
+ var result = "";
1838
+ while (result.length < maxLength) {
1839
+ chars++;
1840
+ result += base64chars.charAt(number & 0x3F);
1841
+ number >>>= 6;
1842
+ if (chars === 5) {
1843
+ number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1844
+ chars = 0;
1845
+ }
1846
+ }
1847
+ return result;
1848
+ }
1692
1849
 
1693
1850
  var _cookieMgrs = null;
1694
1851
  var _canUseCookies;
@@ -1721,23 +1878,6 @@ function perfNow() {
1721
1878
  }
1722
1879
  return dateNow();
1723
1880
  }
1724
- function newId(maxLength) {
1725
- if (maxLength === void 0) { maxLength = 22; }
1726
- var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1727
- var number = random32() >>> 0;
1728
- var chars = 0;
1729
- var result = "";
1730
- while (result.length < maxLength) {
1731
- chars++;
1732
- result += base64chars.charAt(number & 0x3F);
1733
- number >>>= 6;
1734
- if (chars === 5) {
1735
- number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1736
- chars = 0;
1737
- }
1738
- }
1739
- return result;
1740
- }
1741
1881
  function generateW3CId() {
1742
1882
  var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
1743
1883
  var oct = "", tmp;
@@ -1893,6 +2033,7 @@ function _createFunctionHook(aiHook) {
1893
2033
  };
1894
2034
  var hookCtx = [];
1895
2035
  var cbArgs = _createArgs([funcArgs], orgArgs);
2036
+ funcArgs.evt = getGlobalInst("event");
1896
2037
  function _createArgs(target, theArgs) {
1897
2038
  _arrLoop(theArgs, function (arg) {
1898
2039
  target.push(arg);
@@ -3406,4 +3547,4 @@ var DebugPlugin = /** @class */ (function (_super) {
3406
3547
  var DebugPlugin$1 = DebugPlugin;
3407
3548
 
3408
3549
  exports.DebugPlugin = DebugPlugin$1;
3409
- //# sourceMappingURL=ai.dbg.2.7.4-nightly.2202-09.cjs.js.map
3550
+ //# sourceMappingURL=ai.dbg.2.8.0-beta.2202-07.cjs.js.map