@microsoft/applicationinsights-core-js 3.4.0-nightlybeta3.2504-05 → 3.4.0-nightlybeta3.2504-17

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 (109) hide show
  1. package/browser/es5/applicationinsights-core-js.cjs.js +393 -281
  2. package/browser/es5/applicationinsights-core-js.cjs.js.map +1 -1
  3. package/browser/es5/applicationinsights-core-js.cjs.min.js +2 -2
  4. package/browser/es5/applicationinsights-core-js.cjs.min.js.map +1 -1
  5. package/browser/es5/applicationinsights-core-js.gbl.js +395 -283
  6. package/browser/es5/applicationinsights-core-js.gbl.js.map +1 -1
  7. package/browser/es5/applicationinsights-core-js.gbl.min.js +2 -2
  8. package/browser/es5/applicationinsights-core-js.gbl.min.js.map +1 -1
  9. package/browser/es5/applicationinsights-core-js.integrity.json +25 -25
  10. package/browser/es5/applicationinsights-core-js.js +395 -283
  11. package/browser/es5/applicationinsights-core-js.js.map +1 -1
  12. package/browser/es5/applicationinsights-core-js.min.js +2 -2
  13. package/browser/es5/applicationinsights-core-js.min.js.map +1 -1
  14. package/dist/es5/applicationinsights-core-js.js +393 -281
  15. package/dist/es5/applicationinsights-core-js.js.map +1 -1
  16. package/dist/es5/applicationinsights-core-js.min.js +2 -2
  17. package/dist/es5/applicationinsights-core-js.min.js.map +1 -1
  18. package/dist-es5/Config/ConfigDefaultHelpers.js +1 -1
  19. package/dist-es5/Config/ConfigDefaults.js +1 -1
  20. package/dist-es5/Config/DynamicConfig.js +1 -1
  21. package/dist-es5/Config/DynamicProperty.js +1 -1
  22. package/dist-es5/Config/DynamicState.js +1 -1
  23. package/dist-es5/Config/DynamicSupport.js +1 -1
  24. package/dist-es5/Config/IConfigDefaults.js +1 -1
  25. package/dist-es5/Config/IDynamicConfigHandler.js +1 -1
  26. package/dist-es5/Config/IDynamicPropertyHandler.js +1 -1
  27. package/dist-es5/Config/IDynamicWatcher.js +1 -1
  28. package/dist-es5/Config/_IDynamicConfigHandlerState.js +1 -1
  29. package/dist-es5/JavaScriptSDK/AggregationError.js +1 -1
  30. package/dist-es5/JavaScriptSDK/AppInsightsCore.js +132 -99
  31. package/dist-es5/JavaScriptSDK/AppInsightsCore.js.map +1 -1
  32. package/dist-es5/JavaScriptSDK/AsyncUtils.js +1 -1
  33. package/dist-es5/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
  34. package/dist-es5/JavaScriptSDK/Constants.js +1 -1
  35. package/dist-es5/JavaScriptSDK/CookieMgr.js +1 -1
  36. package/dist-es5/JavaScriptSDK/CoreUtils.js +1 -1
  37. package/dist-es5/JavaScriptSDK/DataCacheHelper.js +2 -2
  38. package/dist-es5/JavaScriptSDK/DataCacheHelper.js.map +1 -1
  39. package/dist-es5/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  40. package/dist-es5/JavaScriptSDK/DiagnosticLogger.js +1 -1
  41. package/dist-es5/JavaScriptSDK/EnvUtils.js +1 -1
  42. package/dist-es5/JavaScriptSDK/EventHelpers.js +1 -1
  43. package/dist-es5/JavaScriptSDK/HelperFuncs.js +3 -3
  44. package/dist-es5/JavaScriptSDK/HelperFuncs.js.map +1 -1
  45. package/dist-es5/JavaScriptSDK/InstrumentHooks.js +1 -1
  46. package/dist-es5/JavaScriptSDK/InternalConstants.js +1 -1
  47. package/dist-es5/JavaScriptSDK/NetworkStatsbeat.js +20 -0
  48. package/dist-es5/JavaScriptSDK/NetworkStatsbeat.js.map +1 -0
  49. package/dist-es5/JavaScriptSDK/NotificationManager.js +1 -1
  50. package/dist-es5/JavaScriptSDK/PerfManager.js +1 -1
  51. package/dist-es5/JavaScriptSDK/ProcessTelemetryContext.js +1 -1
  52. package/dist-es5/JavaScriptSDK/RandomHelper.js +1 -1
  53. package/dist-es5/JavaScriptSDK/ResponseHelpers.js +1 -1
  54. package/dist-es5/JavaScriptSDK/SenderPostManager.js +23 -8
  55. package/dist-es5/JavaScriptSDK/SenderPostManager.js.map +1 -1
  56. package/dist-es5/JavaScriptSDK/StatsBeat.js +176 -0
  57. package/dist-es5/JavaScriptSDK/StatsBeat.js.map +1 -0
  58. package/dist-es5/JavaScriptSDK/TelemetryHelpers.js +1 -1
  59. package/dist-es5/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
  60. package/dist-es5/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
  61. package/dist-es5/JavaScriptSDK/UnloadHookContainer.js +1 -1
  62. package/dist-es5/JavaScriptSDK/W3cTraceParent.js +3 -3
  63. package/dist-es5/JavaScriptSDK/W3cTraceParent.js.map +1 -1
  64. package/dist-es5/JavaScriptSDK.Enums/EnumHelperFuncs.js +1 -1
  65. package/dist-es5/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
  66. package/dist-es5/JavaScriptSDK.Enums/FeatureOptInEnums.js +1 -1
  67. package/dist-es5/JavaScriptSDK.Enums/InitActiveStatusEnum.js +1 -1
  68. package/dist-es5/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
  69. package/dist-es5/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  70. package/dist-es5/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
  71. package/dist-es5/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
  72. package/dist-es5/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
  73. package/dist-es5/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  74. package/dist-es5/JavaScriptSDK.Interfaces/IChannelControlsHost.js +1 -1
  75. package/dist-es5/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
  76. package/dist-es5/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
  77. package/dist-es5/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
  78. package/dist-es5/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
  79. package/dist-es5/JavaScriptSDK.Interfaces/IDistributedTraceContext.js +1 -1
  80. package/dist-es5/JavaScriptSDK.Interfaces/IExceptionConfig.js +1 -1
  81. package/dist-es5/JavaScriptSDK.Interfaces/IFeatureOptIn.js +1 -1
  82. package/dist-es5/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
  83. package/dist-es5/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
  84. package/dist-es5/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
  85. package/dist-es5/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
  86. package/dist-es5/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
  87. package/dist-es5/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
  88. package/dist-es5/JavaScriptSDK.Interfaces/ISenderPostManager.js +1 -1
  89. package/dist-es5/JavaScriptSDK.Interfaces/IStatsBeat.js +6 -0
  90. package/dist-es5/JavaScriptSDK.Interfaces/IStatsBeat.js.map +1 -0
  91. package/dist-es5/JavaScriptSDK.Interfaces/IStatsBeatEvent.js +8 -0
  92. package/dist-es5/JavaScriptSDK.Interfaces/IStatsBeatEvent.js.map +1 -0
  93. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
  94. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  95. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  96. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
  97. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
  98. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
  99. package/dist-es5/JavaScriptSDK.Interfaces/ITraceParent.js +1 -1
  100. package/dist-es5/JavaScriptSDK.Interfaces/IUnloadHook.js +1 -1
  101. package/dist-es5/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
  102. package/dist-es5/JavaScriptSDK.Interfaces/IXDomainRequest.js +1 -1
  103. package/dist-es5/JavaScriptSDK.Interfaces/IXHROverride.js +1 -1
  104. package/dist-es5/__DynamicConstants.js +13 -7
  105. package/dist-es5/__DynamicConstants.js.map +1 -1
  106. package/dist-es5/applicationinsights-core-js.js +1 -1
  107. package/package.json +1 -1
  108. package/types/applicationinsights-core-js.d.ts +42 -1
  109. package/types/applicationinsights-core-js.namespaced.d.ts +68 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-05
2
+ * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-05
2
+ * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-05
2
+ * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-05
2
+ * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-05
2
+ * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-05
2
+ * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-05
2
+ * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-05
2
+ * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-05
2
+ * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-05
2
+ * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-05
2
+ * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  export {};
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-05
2
+ * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-05
2
+ * Application Insights JavaScript SDK - Core, 3.4.0-nightlybeta3.2504-17
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -10,6 +10,7 @@ import { __spreadArrayFn as __spreadArray } from "@microsoft/applicationinsights
10
10
  import dynamicProto from "@microsoft/dynamicproto-js";
11
11
  import { createPromise, createSyncAllSettledPromise, doAwaitResponse } from "@nevware21/ts-async";
12
12
  import { arrAppend, arrForEach, arrIndexOf, createTimeout, deepExtend, hasDocument, isFunction, isNullOrUndefined, isPlainObject, isPromiseLike, objDeepFreeze, objDefine, objForEachKey, objFreeze, objHasOwn, scheduleTimeout, throwError } from "@nevware21/ts-utils";
13
+ import { cfgDfMerge } from "../Config/ConfigDefaultHelpers";
13
14
  import { createDynamicConfig, onConfigChange } from "../Config/DynamicConfig";
14
15
  import { ActiveStatus } from "../JavaScriptSDK.Enums/InitActiveStatusEnum";
15
16
  import { _DYN_ADD_NOTIFICATION_LIS1, _DYN_CANCEL, _DYN_CREATE_NEW, _DYN_ENABLED, _DYN_GET_NOTIFY_MGR, _DYN_GET_PLUGIN, _DYN_GET_PROCESS_TEL_CONT2, _DYN_IDENTIFIER, _DYN_INITIALIZE, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_LOGGER, _DYN_LOGGING_LEVEL_CONSOL4, _DYN_MESSAGE, _DYN_MESSAGE_ID, _DYN_NAME, _DYN_ON_COMPLETE, _DYN_PROCESS_NEXT, _DYN_PUSH, _DYN_REMOVE_NOTIFICATION_0, _DYN_SPLICE, _DYN_STOP_POLLING_INTERNA3, _DYN_TEARDOWN, _DYN_UNLOAD, _DYN_VALUE, _DYN_VERSION, _DYN_WATCH } from "../__DynamicConstants";
@@ -49,6 +50,9 @@ var defaultConfig = objDeepFreeze((_a = {
49
50
  _a[STR_CREATE_PERF_MGR] = UNDEFINED_VALUE,
50
51
  _a.loggingLevelConsole = 0 /* eLoggingSeverity.DISABLED */,
51
52
  _a.diagnosticLogInterval = UNDEFINED_VALUE,
53
+ _a._sdk = cfgDfMerge({
54
+ stats: false
55
+ }),
52
56
  _a));
53
57
  /**
54
58
  * Helper to create the default performance manager
@@ -202,6 +206,7 @@ var AppInsightsCore = /** @class */ (function () {
202
206
  var _logger;
203
207
  var _eventQueue;
204
208
  var _notificationManager;
209
+ var _statsBeat;
205
210
  var _perfManager;
206
211
  var _cfgPerfManager;
207
212
  var _cookieManager;
@@ -263,105 +268,14 @@ var AppInsightsCore = /** @class */ (function () {
263
268
  // This will be "re-run" if the referenced config properties are changed
264
269
  _addUnloadHook(_configHandler[_DYN_WATCH /* @min:%2ewatch */](function (details) {
265
270
  var rootCfg = details.cfg;
266
- var isPending = _activeStatus === 3 /* eActiveStatus.PENDING */;
267
- if (isPending) {
268
- // means waiting for previous promises to be resolved, won't apply new changes
269
- return;
270
- }
271
271
  _initInMemoMaxSize = rootCfg.initInMemoMaxSize || maxInitQueueSize;
272
- // app Insights core only handle ikey and endpointurl, aisku will handle cs
273
- var ikey = rootCfg.instrumentationKey;
274
- var endpointUrl = rootCfg.endpointUrl; // do not need to validate endpoint url, if it is null, default one will be set by sender
275
- if (isNullOrUndefined(ikey)) {
276
- _instrumentationKey = null;
277
- // if new ikey is null, set status to be inactive, all new events will be saved in memory or dropped
278
- _activeStatus = ActiveStatus.INACTIVE;
279
- var msg = "Please provide instrumentation key";
280
- if (!_isInitialized) {
281
- // only throw error during initialization
282
- throwError(msg);
283
- }
284
- else {
285
- _throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 100 /* _eInternalMessageId.InvalidInstrumentationKey */, msg);
286
- _releaseQueues();
287
- }
288
- return;
289
- }
290
- var promises = [];
291
- if (isPromiseLike(ikey)) {
292
- promises[_DYN_PUSH /* @min:%2epush */](ikey);
293
- _instrumentationKey = null; // reset current local ikey variable (otherwise it will always be the previous ikeys if timeout is called before promise cb)
294
- }
295
- else {
296
- // string
297
- _instrumentationKey = ikey;
298
- }
299
- if (isPromiseLike(endpointUrl)) {
300
- promises[_DYN_PUSH /* @min:%2epush */](endpointUrl);
301
- _endpoint = null; // reset current local endpoint variable (otherwise it will always be the previous urls if timeout is called before promise cb)
302
- }
303
- else {
304
- // string or null
305
- _endpoint = endpointUrl;
306
- }
307
- // at least have one promise
308
- if (promises[_DYN_LENGTH /* @min:%2elength */]) {
309
- // reset to false for new dynamic changes
310
- _isStatusSet = false;
311
- _activeStatus = 3 /* eActiveStatus.PENDING */;
312
- var initTimeout = isNotNullOrUndefined(rootCfg.initTimeOut) ? rootCfg.initTimeOut : maxInitTimeout; // rootCfg.initTimeOut could be 0
313
- var allPromises = createSyncAllSettledPromise(promises);
314
- _initTimer = scheduleTimeout(function () {
315
- // set _isStatusSet to true
316
- // set active status
317
- // release queues
318
- _initTimer = null;
319
- if (!_isStatusSet) {
320
- _setStatus();
321
- }
322
- }, initTimeout);
323
- doAwaitResponse(allPromises, function (response) {
324
- try {
325
- if (_isStatusSet) {
326
- // promises take too long to resolve, ignore them
327
- // active status should be set by timeout already
328
- return;
329
- }
330
- if (!response.rejected) {
331
- var values = response[_DYN_VALUE /* @min:%2evalue */];
332
- if (values && values[_DYN_LENGTH /* @min:%2elength */]) {
333
- // ikey
334
- var ikeyRes = values[0];
335
- _instrumentationKey = ikeyRes && ikeyRes[_DYN_VALUE /* @min:%2evalue */];
336
- // endpoint
337
- if (values[_DYN_LENGTH /* @min:%2elength */] > 1) {
338
- var endpointRes = values[1];
339
- _endpoint = endpointRes && endpointRes[_DYN_VALUE /* @min:%2evalue */];
340
- }
341
- }
342
- if (_instrumentationKey) {
343
- // if ikey is null, no need to trigger extra dynamic changes for extensions
344
- config.instrumentationKey = _instrumentationKey; // set config.instrumentationKey for extensions to consume
345
- config.endpointUrl = _endpoint; // set config.endpointUrl for extensions to consume
346
- }
347
- }
348
- // set _isStatusSet to true
349
- // set active status
350
- // release queues
351
- _setStatus();
352
- }
353
- catch (e) {
354
- if (!_isStatusSet) {
355
- _setStatus();
356
- }
357
- }
358
- });
359
- }
360
- else {
361
- // means no promises
362
- _setStatus();
363
- }
364
- //_instrumentationKey = details.cfg.instrumentationKey;
272
+ // uncomment this until throttle is implemented
273
+ // if (config._sdk.stats === true){
274
+ // _statsBeat = _statsBeat || new Statsbeat();
275
+ // } else {
276
+ // _statsBeat = null;
277
+ // }
278
+ _handleIKeyEndpointPromises(rootCfg);
365
279
  // Mark the extensionConfig and all first level keys as referenced
366
280
  // This is so that calls to getExtCfg() will always return the same object
367
281
  // Even when a user may "re-assign" the plugin properties (or it's unloaded/reloaded)
@@ -479,6 +393,16 @@ var AppInsightsCore = /** @class */ (function () {
479
393
  _self[STR_GET_PERF_MGR /* @min:%2egetPerfMgr */] = function () {
480
394
  return _perfManager || _cfgPerfManager || getGblPerfMgr();
481
395
  };
396
+ _self.getStatsBeat = function (statsBeatConfig) {
397
+ // create a new statsbeat if not initialize yet or the endpoint is different
398
+ // otherwise, return the existing one, or null
399
+ // uncomment this until throttle is implemented
400
+ // if (statsBeatConfig && this.config._sdk.stats === true && _statsBeat && _statsBeat.getEndpoint() !== statsBeatConfig.endpoint) {
401
+ // _statsBeat = new Statsbeat();
402
+ // _statsBeat.initialize(this, statsBeatConfig);
403
+ // }
404
+ return _statsBeat;
405
+ };
482
406
  _self.setPerfMgr = function (perfMgr) {
483
407
  _perfManager = perfMgr;
484
408
  };
@@ -507,6 +431,113 @@ var AppInsightsCore = /** @class */ (function () {
507
431
  _internalLogPoller && _internalLogPoller[_DYN_CANCEL /* @min:%2ecancel */]();
508
432
  return _startLogPoller(true);
509
433
  };
434
+ function _handleIKeyEndpointPromises(theConfig) {
435
+ // app Insights core only handle ikey and endpointurl, aisku will handle cs
436
+ // But we want to reference these config values so that if any future changes are made
437
+ // this will trigger the re-run of the watch function
438
+ // and the ikey and endpointUrl will be set to the new values
439
+ var ikey = theConfig.instrumentationKey;
440
+ var endpointUrl = theConfig.endpointUrl; // do not need to validate endpoint url, if it is null, default one will be set by sender
441
+ // Check if we are waiting for previous promises to be resolved, won't apply new changes
442
+ if (_activeStatus !== 3 /* eActiveStatus.PENDING */) {
443
+ if (isNullOrUndefined(ikey)) {
444
+ _instrumentationKey = null;
445
+ // if new ikey is null, set status to be inactive, all new events will be saved in memory or dropped
446
+ _activeStatus = ActiveStatus.INACTIVE;
447
+ var msg = "Please provide instrumentation key";
448
+ if (!_isInitialized) {
449
+ // only throw error during initialization
450
+ throwError(msg);
451
+ }
452
+ else {
453
+ _throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 100 /* _eInternalMessageId.InvalidInstrumentationKey */, msg);
454
+ _releaseQueues();
455
+ }
456
+ return;
457
+ }
458
+ var promises = [];
459
+ if (isPromiseLike(ikey)) {
460
+ promises[_DYN_PUSH /* @min:%2epush */](ikey);
461
+ _instrumentationKey = null; // reset current local ikey variable (otherwise it will always be the previous ikeys if timeout is called before promise cb)
462
+ }
463
+ else {
464
+ // string
465
+ _instrumentationKey = ikey;
466
+ }
467
+ if (isPromiseLike(endpointUrl)) {
468
+ promises[_DYN_PUSH /* @min:%2epush */](endpointUrl);
469
+ _endpoint = null; // reset current local endpoint variable (otherwise it will always be the previous urls if timeout is called before promise cb)
470
+ }
471
+ else {
472
+ // string or null
473
+ _endpoint = endpointUrl;
474
+ }
475
+ // at least have one promise
476
+ if (promises[_DYN_LENGTH /* @min:%2elength */]) {
477
+ _waitForInitPromises(theConfig, promises);
478
+ }
479
+ else {
480
+ // means no promises
481
+ _setStatus();
482
+ }
483
+ }
484
+ }
485
+ function _waitForInitPromises(theConfig, promises) {
486
+ // reset to false for new dynamic changes
487
+ _isStatusSet = false;
488
+ _activeStatus = 3 /* eActiveStatus.PENDING */;
489
+ var initTimeout = isNotNullOrUndefined(theConfig.initTimeOut) ? theConfig.initTimeOut : maxInitTimeout; // theConfig.initTimeOut could be 0
490
+ var allPromises = createSyncAllSettledPromise(promises);
491
+ if (_initTimer) {
492
+ // Stop any previous timer
493
+ _initTimer[_DYN_CANCEL /* @min:%2ecancel */]();
494
+ }
495
+ _initTimer = scheduleTimeout(function () {
496
+ // set _isStatusSet to true
497
+ // set active status
498
+ // release queues
499
+ _initTimer = null;
500
+ if (!_isStatusSet) {
501
+ _setStatus();
502
+ }
503
+ }, initTimeout);
504
+ doAwaitResponse(allPromises, function (response) {
505
+ try {
506
+ if (_isStatusSet) {
507
+ // promises take too long to resolve, ignore them
508
+ // active status should be set by timeout already
509
+ return;
510
+ }
511
+ if (!response.rejected) {
512
+ var values = response[_DYN_VALUE /* @min:%2evalue */];
513
+ if (values && values[_DYN_LENGTH /* @min:%2elength */]) {
514
+ // ikey
515
+ var ikeyRes = values[0];
516
+ _instrumentationKey = ikeyRes && ikeyRes[_DYN_VALUE /* @min:%2evalue */];
517
+ // endpoint
518
+ if (values[_DYN_LENGTH /* @min:%2elength */] > 1) {
519
+ var endpointRes = values[1];
520
+ _endpoint = endpointRes && endpointRes[_DYN_VALUE /* @min:%2evalue */];
521
+ }
522
+ }
523
+ if (_instrumentationKey) {
524
+ // if ikey is null, no need to trigger extra dynamic changes for extensions
525
+ theConfig.instrumentationKey = _instrumentationKey; // set config.instrumentationKey for extensions to consume
526
+ theConfig.endpointUrl = _endpoint; // set config.endpointUrl for extensions to consume
527
+ }
528
+ }
529
+ // set _isStatusSet to true
530
+ // set active status
531
+ // release queues
532
+ _setStatus();
533
+ }
534
+ catch (e) {
535
+ if (!_isStatusSet) {
536
+ _setStatus();
537
+ }
538
+ }
539
+ });
540
+ }
510
541
  function _setStatus() {
511
542
  _isStatusSet = true;
512
543
  if (isNullOrUndefined(_instrumentationKey)) {
@@ -807,6 +838,7 @@ var AppInsightsCore = /** @class */ (function () {
807
838
  runTargetUnload(_notificationManager, false);
808
839
  _notificationManager = null;
809
840
  _perfManager = null;
841
+ _statsBeat = null;
810
842
  _cfgPerfManager = null;
811
843
  runTargetUnload(_cookieManager, false);
812
844
  _cookieManager = null;
@@ -1117,6 +1149,7 @@ var AppInsightsCore = /** @class */ (function () {
1117
1149
  // Removed Stub for AppInsightsCore.prototype.getCookieMgr.
1118
1150
  // Removed Stub for AppInsightsCore.prototype.setCookieMgr.
1119
1151
  // Removed Stub for AppInsightsCore.prototype.getPerfMgr.
1152
+ // Removed Stub for AppInsightsCore.prototype.getStatsBeat.
1120
1153
  // Removed Stub for AppInsightsCore.prototype.setPerfMgr.
1121
1154
  // Removed Stub for AppInsightsCore.prototype.eventCnt.
1122
1155
  // Removed Stub for AppInsightsCore.prototype.pollInternalLogs.