@microsoft/applicationinsights-web 2.8.0-beta.2203-04 → 2.8.0-beta.2203-05

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 (50) hide show
  1. package/browser/{ai.2.8.0-beta.2203-04.cjs.js → ai.2.8.0-beta.2203-05.cjs.js} +639 -356
  2. package/browser/ai.2.8.0-beta.2203-05.cjs.js.map +1 -0
  3. package/browser/ai.2.8.0-beta.2203-05.cjs.min.js +6 -0
  4. package/browser/ai.2.8.0-beta.2203-05.cjs.min.js.map +1 -0
  5. package/browser/{ai.2.8.0-beta.2203-04.gbl.js → ai.2.8.0-beta.2203-05.gbl.js} +639 -356
  6. package/browser/ai.2.8.0-beta.2203-05.gbl.js.map +1 -0
  7. package/browser/ai.2.8.0-beta.2203-05.gbl.min.js +6 -0
  8. package/browser/ai.2.8.0-beta.2203-05.gbl.min.js.map +1 -0
  9. package/browser/ai.2.8.0-beta.2203-05.integrity.json +66 -0
  10. package/browser/{ai.2.8.0-beta.2203-04.js → ai.2.8.0-beta.2203-05.js} +639 -356
  11. package/browser/ai.2.8.0-beta.2203-05.js.map +1 -0
  12. package/browser/ai.2.8.0-beta.2203-05.min.js +6 -0
  13. package/browser/ai.2.8.0-beta.2203-05.min.js.map +1 -0
  14. package/browser/ai.2.cjs.js +638 -355
  15. package/browser/ai.2.cjs.js.map +1 -1
  16. package/browser/ai.2.cjs.min.js +2 -2
  17. package/browser/ai.2.cjs.min.js.map +1 -1
  18. package/browser/ai.2.gbl.js +638 -355
  19. package/browser/ai.2.gbl.js.map +1 -1
  20. package/browser/ai.2.gbl.min.js +2 -2
  21. package/browser/ai.2.gbl.min.js.map +1 -1
  22. package/browser/ai.2.js +638 -355
  23. package/browser/ai.2.js.map +1 -1
  24. package/browser/ai.2.min.js +2 -2
  25. package/browser/ai.2.min.js.map +1 -1
  26. package/dist/applicationinsights-web.api.json +227 -164
  27. package/dist/applicationinsights-web.api.md +14 -20
  28. package/dist/applicationinsights-web.d.ts +108 -106
  29. package/dist/applicationinsights-web.js +639 -356
  30. package/dist/applicationinsights-web.js.map +1 -1
  31. package/dist/applicationinsights-web.min.js +2 -2
  32. package/dist/applicationinsights-web.min.js.map +1 -1
  33. package/dist/applicationinsights-web.rollup.d.ts +108 -106
  34. package/dist-esm/ApplicationInsightsContainer.js +1 -1
  35. package/dist-esm/ApplicationInsightsDeprecated.js +1 -1
  36. package/dist-esm/Init.js +1 -1
  37. package/dist-esm/Initialization.js +1 -1
  38. package/dist-esm/applicationinsights-web.js +1 -1
  39. package/package.json +7 -7
  40. package/types/Initialization.d.ts +1 -1
  41. package/browser/ai.2.8.0-beta.2203-04.cjs.js.map +0 -1
  42. package/browser/ai.2.8.0-beta.2203-04.cjs.min.js +0 -6
  43. package/browser/ai.2.8.0-beta.2203-04.cjs.min.js.map +0 -1
  44. package/browser/ai.2.8.0-beta.2203-04.gbl.js.map +0 -1
  45. package/browser/ai.2.8.0-beta.2203-04.gbl.min.js +0 -6
  46. package/browser/ai.2.8.0-beta.2203-04.gbl.min.js.map +0 -1
  47. package/browser/ai.2.8.0-beta.2203-04.integrity.json +0 -66
  48. package/browser/ai.2.8.0-beta.2203-04.js.map +0 -1
  49. package/browser/ai.2.8.0-beta.2203-04.min.js +0 -6
  50. package/browser/ai.2.8.0-beta.2203-04.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-04
2
+ * Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-05
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  'use strict';
@@ -355,6 +355,7 @@ var strSetNextPlugin = "setNextPlugin";
355
355
  var strIsInitialized = "isInitialized";
356
356
  var strTeardown = "teardown";
357
357
  var strCore = "core";
358
+ var strUpdate = "update";
358
359
  var strDisabled = "disabled";
359
360
  var strDoTeardown = "_doTeardown";
360
361
  var strProcessNext = "processNext";
@@ -823,7 +824,7 @@ function optimizeObject(theObject) {
823
824
  }
824
825
  return theObject;
825
826
  }
826
- function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
827
+ function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
827
828
  var theArgs = arguments;
828
829
  var extended = theArgs[0] || {};
829
830
  var argLen = theArgs.length;
@@ -1270,6 +1271,10 @@ var DiagnosticLogger = /** @class */ (function () {
1270
1271
  }
1271
1272
  return DiagnosticLogger;
1272
1273
  }());
1274
+ function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
1275
+ if (isUserAct === void 0) { isUserAct = false; }
1276
+ (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
1277
+ }
1273
1278
 
1274
1279
  var strExecutionContextKey = "ctx";
1275
1280
  var _defaultPerfManager = null;
@@ -1694,7 +1699,7 @@ function _createInternalContext(telemetryChain, config, core, startAt) {
1694
1699
  completeDetails.func.call(completeDetails.self, completeDetails.args);
1695
1700
  }
1696
1701
  catch (e) {
1697
- core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1702
+ _throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1698
1703
  }
1699
1704
  });
1700
1705
  _onComplete = [];
@@ -1793,6 +1798,27 @@ function createProcessTelemetryUnloadContext(telemetryChain, config, core, start
1793
1798
  context.createNew = _createNew;
1794
1799
  return context;
1795
1800
  }
1801
+ function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
1802
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1803
+ var context = internalContext.ctx;
1804
+ function _processNext(updateState) {
1805
+ return context.iterate(function (plugin) {
1806
+ if (isFunction(plugin[strUpdate])) {
1807
+ plugin[strUpdate](context, updateState);
1808
+ }
1809
+ });
1810
+ }
1811
+ function _createNew(plugins, startAt) {
1812
+ if (plugins === void 0) { plugins = null; }
1813
+ if (isArray(plugins)) {
1814
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1815
+ }
1816
+ return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
1817
+ }
1818
+ context.processNext = _processNext;
1819
+ context.createNew = _createNew;
1820
+ return context;
1821
+ }
1796
1822
  function createTelemetryProxyChain(plugins, config, core, startAt) {
1797
1823
  var firstProxy = null;
1798
1824
  var add = startAt ? false : true;
@@ -1839,6 +1865,7 @@ function createTelemetryPluginProxy(plugin, config, core) {
1839
1865
  },
1840
1866
  processTelemetry: _processTelemetry,
1841
1867
  unload: _unloadPlugin,
1868
+ update: _updatePlugin,
1842
1869
  _id: chainId,
1843
1870
  _setNext: function (nextPlugin) {
1844
1871
  nextProxy = nextPlugin;
@@ -1878,7 +1905,7 @@ function createTelemetryPluginProxy(plugin, config, core) {
1878
1905
  hasRun = true;
1879
1906
  }
1880
1907
  if (!nextProxy || !hasNextRun) {
1881
- itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1908
+ _throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1882
1909
  }
1883
1910
  }
1884
1911
  }, details, isAsync);
@@ -1926,6 +1953,24 @@ function createTelemetryPluginProxy(plugin, config, core) {
1926
1953
  unloadCtx.processNext(unloadState);
1927
1954
  }
1928
1955
  }
1956
+ function _updatePlugin(updateCtx, updateState) {
1957
+ function _callUpdate() {
1958
+ var hasRun = false;
1959
+ if (plugin) {
1960
+ var pluginState = _getPluginState(plugin);
1961
+ var pluginCore = plugin[strCore] || pluginState.core;
1962
+ if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
1963
+ if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
1964
+ hasRun = true;
1965
+ }
1966
+ }
1967
+ }
1968
+ return hasRun;
1969
+ }
1970
+ if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
1971
+ updateCtx.processNext(updateState);
1972
+ }
1973
+ }
1929
1974
  return objFreeze(proxyChain);
1930
1975
  }
1931
1976
 
@@ -2095,7 +2140,7 @@ function areCookiesSupported(logger) {
2095
2140
  _supportsCookies = doc[strCookie] !== undefined;
2096
2141
  }
2097
2142
  catch (e) {
2098
- logger && logger.throwInternal(2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
2143
+ _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
2099
2144
  }
2100
2145
  }
2101
2146
  return _supportsCookies;
@@ -2224,6 +2269,17 @@ function createChannelControllerPlugin(channelQueue, core) {
2224
2269
  }
2225
2270
  _runChainOnComplete();
2226
2271
  }
2272
+ function _doUpdate(updateCtx, updateState) {
2273
+ var theUpdateState = updateState || {
2274
+ reason: 0
2275
+ };
2276
+ _processChannelQueue(channelQueue, updateCtx, function (chainCtx) {
2277
+ chainCtx[strProcessNext](theUpdateState);
2278
+ }, function () {
2279
+ updateCtx[strProcessNext](theUpdateState);
2280
+ });
2281
+ return true;
2282
+ }
2227
2283
  function _doTeardown(unloadCtx, unloadState) {
2228
2284
  var theUnloadState = unloadState || {
2229
2285
  reason: 0 ,
@@ -2275,7 +2331,8 @@ function createChannelControllerPlugin(channelQueue, core) {
2275
2331
  }, function () {
2276
2332
  itemCtx[strProcessNext](item);
2277
2333
  });
2278
- }
2334
+ },
2335
+ update: _doUpdate
2279
2336
  },
2280
2337
  _a[strPause] = function () {
2281
2338
  _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
@@ -2373,7 +2430,7 @@ function createUnloadHandlerContainer() {
2373
2430
  handler(unloadCtx, unloadState);
2374
2431
  }
2375
2432
  catch (e) {
2376
- unloadCtx.diagLog().throwInternal(2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
2433
+ _throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
2377
2434
  }
2378
2435
  });
2379
2436
  handlers = [];
@@ -2432,6 +2489,30 @@ var BaseTelemetryPlugin = /** @class */ (function () {
2432
2489
  }
2433
2490
  return result;
2434
2491
  };
2492
+ _self.update = function (updateCtx, updateState) {
2493
+ if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
2494
+ return;
2495
+ }
2496
+ var result;
2497
+ var updateDone = false;
2498
+ var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
2499
+ var theUpdateState = updateState || {
2500
+ reason: 0
2501
+ };
2502
+ function _updateCallback() {
2503
+ if (!updateDone) {
2504
+ updateDone = true;
2505
+ _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
2506
+ }
2507
+ }
2508
+ if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
2509
+ _updateCallback();
2510
+ }
2511
+ else {
2512
+ result = true;
2513
+ }
2514
+ return result;
2515
+ };
2435
2516
  _self._addHook = function (hooks) {
2436
2517
  if (hooks) {
2437
2518
  if (isArray(hooks)) {
@@ -2546,7 +2627,7 @@ var TelemetryInitializerPlugin = /** @class */ (function (_super) {
2546
2627
  }
2547
2628
  }
2548
2629
  catch (e) {
2549
- itemCtx.diagLog().throwInternal(1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
2630
+ _throwInternal(itemCtx.diagLog(), 1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
2550
2631
  }
2551
2632
  }
2552
2633
  }
@@ -2667,7 +2748,7 @@ var BaseCore = /** @class */ (function () {
2667
2748
  _configExtensions = [];
2668
2749
  _configExtensions.push.apply(_configExtensions, __spreadArrayFn(__spreadArrayFn([], extensions, false), config.extensions));
2669
2750
  _channelConfig = (config || {}).channels;
2670
- _initPluginChain(config);
2751
+ _initPluginChain(config, null);
2671
2752
  if (_self.getTransmissionControls().length === 0) {
2672
2753
  throwError("No channels available");
2673
2754
  }
@@ -2810,22 +2891,28 @@ var BaseCore = /** @class */ (function () {
2810
2891
  _logOrThrowError("Plugin [" + plugin.identifier + "] is already loaded!");
2811
2892
  return;
2812
2893
  }
2894
+ var updateState = {
2895
+ reason: 16
2896
+ };
2813
2897
  function _addPlugin(removed) {
2814
2898
  _configExtensions.push(plugin);
2815
- _initPluginChain(_self.config);
2899
+ updateState.added = [plugin];
2900
+ _initPluginChain(_self.config, updateState);
2816
2901
  addCb && addCb(true);
2817
2902
  }
2818
2903
  if (existingPlugin) {
2819
- var removedPlugins = [existingPlugin.plugin];
2904
+ var removedPlugins_1 = [existingPlugin.plugin];
2820
2905
  var unloadState = {
2821
2906
  reason: 2 ,
2822
2907
  isAsync: isAsync
2823
2908
  };
2824
- _removePlugins(removedPlugins, unloadState, function (removed) {
2909
+ _removePlugins(removedPlugins_1, unloadState, function (removed) {
2825
2910
  if (!removed) {
2826
2911
  addCb && addCb(false);
2827
2912
  }
2828
2913
  else {
2914
+ updateState.removed = removedPlugins_1;
2915
+ updateState.reason |= 32 ;
2829
2916
  _addPlugin();
2830
2917
  }
2831
2918
  });
@@ -2863,7 +2950,7 @@ var BaseCore = /** @class */ (function () {
2863
2950
  function _createTelCtx() {
2864
2951
  return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
2865
2952
  }
2866
- function _initPluginChain(config) {
2953
+ function _initPluginChain(config, updateState) {
2867
2954
  var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
2868
2955
  _coreExtensions = theExtensions.core;
2869
2956
  _pluginChain = null;
@@ -2889,6 +2976,9 @@ var BaseCore = /** @class */ (function () {
2889
2976
  _channelControl.initialize(config, _self, allExtensions);
2890
2977
  initializePlugins(_createTelCtx(), allExtensions);
2891
2978
  _self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
2979
+ if (updateState) {
2980
+ _doUpdate(updateState);
2981
+ }
2892
2982
  }
2893
2983
  function _getPlugin(pluginIdentifier) {
2894
2984
  var theExt = null;
@@ -2921,7 +3011,10 @@ var BaseCore = /** @class */ (function () {
2921
3011
  };
2922
3012
  _removePlugins(pluginsToRemove, unloadState, function (removed) {
2923
3013
  if (removed) {
2924
- _initPluginChain(_self.config);
3014
+ _initPluginChain(_self.config, {
3015
+ reason: 32 ,
3016
+ removed: pluginsToRemove
3017
+ });
2925
3018
  }
2926
3019
  removeCb && removeCb(removed);
2927
3020
  });
@@ -3018,10 +3111,16 @@ var BaseCore = /** @class */ (function () {
3018
3111
  var extConfig = getSetValue(config, strExtensionConfig);
3019
3112
  extConfig.NotificationManager = _notificationManager;
3020
3113
  }
3114
+ function _doUpdate(updateState) {
3115
+ var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self.config, _self);
3116
+ if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) {
3117
+ updateCtx.processNext(updateState);
3118
+ }
3119
+ }
3021
3120
  function _logOrThrowError(message) {
3022
3121
  var logger = _self.logger;
3023
3122
  if (logger) {
3024
- logger.throwInternal(2 , 73 , message);
3123
+ _throwInternal(logger, 2 , 73 , message);
3025
3124
  }
3026
3125
  else {
3027
3126
  throwError(message);
@@ -3136,6 +3235,8 @@ var AppInsightsCore = /** @class */ (function (_super) {
3136
3235
  var strOnPrefix = "on";
3137
3236
  var strAttachEvent = "attachEvent";
3138
3237
  var strAddEventHelper = "addEventListener";
3238
+ var strDetachEvent = "detachEvent";
3239
+ var strRemoveEventListener = "removeEventListener";
3139
3240
  var strEvents = "events";
3140
3241
  var strVisibilityChangeEvt = "visibilitychange";
3141
3242
  var strPageHide = "pagehide";
@@ -3152,12 +3253,12 @@ function _normalizeNamespace(name) {
3152
3253
  }
3153
3254
  return name;
3154
3255
  }
3155
- function _getEvtNamespace(eventName, namespaces) {
3156
- if (namespaces) {
3256
+ function _getEvtNamespace(eventName, evtNamespace) {
3257
+ if (evtNamespace) {
3157
3258
  var theNamespace_1 = "";
3158
- if (isArray(namespaces)) {
3259
+ if (isArray(evtNamespace)) {
3159
3260
  theNamespace_1 = "";
3160
- arrForEach(namespaces, function (name) {
3261
+ arrForEach(evtNamespace, function (name) {
3161
3262
  name = _normalizeNamespace(name);
3162
3263
  if (name) {
3163
3264
  if (name[0] !== ".") {
@@ -3168,7 +3269,7 @@ function _getEvtNamespace(eventName, namespaces) {
3168
3269
  });
3169
3270
  }
3170
3271
  else {
3171
- theNamespace_1 = _normalizeNamespace(namespaces);
3272
+ theNamespace_1 = _normalizeNamespace(evtNamespace);
3172
3273
  }
3173
3274
  if (theNamespace_1) {
3174
3275
  if (theNamespace_1[0] !== ".") {
@@ -3192,6 +3293,16 @@ function _getRegisteredEvents(target, evtName, addDefault) {
3192
3293
  }
3193
3294
  return registeredEvents;
3194
3295
  }
3296
+ function _doDetach(obj, evtName, handlerRef, useCapture) {
3297
+ if (obj && evtName && evtName.type) {
3298
+ if (obj[strRemoveEventListener]) {
3299
+ obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);
3300
+ }
3301
+ else if (obj[strDetachEvent]) {
3302
+ obj[strDetachEvent](strOnPrefix + evtName.type, handlerRef);
3303
+ }
3304
+ }
3305
+ }
3195
3306
  function _doAttach(obj, evtName, handlerRef, useCapture) {
3196
3307
  var result = false;
3197
3308
  if (obj && evtName && evtName.type && handlerRef) {
@@ -3206,6 +3317,34 @@ function _doAttach(obj, evtName, handlerRef, useCapture) {
3206
3317
  }
3207
3318
  return result;
3208
3319
  }
3320
+ function _doUnregister(target, events, evtName, unRegFn) {
3321
+ var idx = events.length;
3322
+ while (idx--) {
3323
+ var theEvent = events[idx];
3324
+ if (theEvent) {
3325
+ if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {
3326
+ if (!unRegFn || unRegFn(theEvent)) {
3327
+ _doDetach(target, theEvent.evtName, theEvent.handler, theEvent.capture);
3328
+ events.splice(idx, 1);
3329
+ }
3330
+ }
3331
+ }
3332
+ }
3333
+ }
3334
+ function _unregisterEvents(target, evtName, unRegFn) {
3335
+ if (evtName.type) {
3336
+ _doUnregister(target, _getRegisteredEvents(target, evtName.type), evtName, unRegFn);
3337
+ }
3338
+ else {
3339
+ var eventCache = elmNodeData.get(target, strEvents, {});
3340
+ objForEachKey(eventCache, function (evtType, events) {
3341
+ _doUnregister(target, events, evtName, unRegFn);
3342
+ });
3343
+ if (objKeys(eventCache).length === 0) {
3344
+ elmNodeData.kill(target, strEvents);
3345
+ }
3346
+ }
3347
+ }
3209
3348
  function mergeEvtNamespace(theNamespace, namespaces) {
3210
3349
  var newNamespaces;
3211
3350
  if (namespaces) {
@@ -3243,6 +3382,27 @@ function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
3243
3382
  }
3244
3383
  return result;
3245
3384
  }
3385
+ function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
3386
+ if (useCapture === void 0) { useCapture = false; }
3387
+ if (target) {
3388
+ try {
3389
+ var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
3390
+ var found_1 = false;
3391
+ _unregisterEvents(target, evtName_1, function (regEvent) {
3392
+ if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {
3393
+ found_1 = true;
3394
+ return true;
3395
+ }
3396
+ return false;
3397
+ });
3398
+ if (!found_1) {
3399
+ _doDetach(target, evtName_1, handlerRef, useCapture);
3400
+ }
3401
+ }
3402
+ catch (e) {
3403
+ }
3404
+ }
3405
+ }
3246
3406
  function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
3247
3407
  if (useCapture === void 0) { useCapture = false; }
3248
3408
  return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
@@ -3683,7 +3843,7 @@ function dataSanitizeKey(logger, name) {
3683
3843
  name = strTrim(name.toString());
3684
3844
  if (name.length > 150 ) {
3685
3845
  nameTrunc = name.substring(0, 150 );
3686
- logger && logger.throwInternal(2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
3846
+ _throwInternal(logger, 2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
3687
3847
  }
3688
3848
  }
3689
3849
  return nameTrunc || name;
@@ -3696,7 +3856,7 @@ function dataSanitizeString(logger, value, maxLength) {
3696
3856
  value = strTrim(value);
3697
3857
  if (value.toString().length > maxLength) {
3698
3858
  valueTrunc = value.toString().substring(0, maxLength);
3699
- logger && logger.throwInternal(2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
3859
+ _throwInternal(logger, 2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
3700
3860
  }
3701
3861
  }
3702
3862
  return valueTrunc || value;
@@ -3709,7 +3869,7 @@ function dataSanitizeMessage(logger, message) {
3709
3869
  if (message) {
3710
3870
  if (message.length > 32768 ) {
3711
3871
  messageTrunc = message.substring(0, 32768 );
3712
- logger && logger.throwInternal(2 , _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
3872
+ _throwInternal(logger, 2 , _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
3713
3873
  }
3714
3874
  }
3715
3875
  return messageTrunc || message;
@@ -3720,7 +3880,7 @@ function dataSanitizeException(logger, exception) {
3720
3880
  var value = "" + exception;
3721
3881
  if (value.length > 32768 ) {
3722
3882
  exceptionTrunc = value.substring(0, 32768 );
3723
- logger && logger.throwInternal(2 , _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
3883
+ _throwInternal(logger, 2 , _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
3724
3884
  }
3725
3885
  }
3726
3886
  return exceptionTrunc || exception;
@@ -3734,7 +3894,7 @@ function dataSanitizeProperties(logger, properties) {
3734
3894
  value = getJSON().stringify(value);
3735
3895
  }
3736
3896
  catch (e) {
3737
- logger && logger.throwInternal(2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
3897
+ _throwInternal(logger, 2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
3738
3898
  }
3739
3899
  }
3740
3900
  value = dataSanitizeString(logger, value, 8192 );
@@ -3765,7 +3925,7 @@ function dataSanitizeInput(logger, input, maxLength, _msgId) {
3765
3925
  input = strTrim(input);
3766
3926
  if (input.length > maxLength) {
3767
3927
  inputTrunc = input.substring(0, maxLength);
3768
- logger && logger.throwInternal(2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
3928
+ _throwInternal(logger, 2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
3769
3929
  }
3770
3930
  }
3771
3931
  return inputTrunc || input;
@@ -3903,8 +4063,12 @@ function utlDisableStorage() {
3903
4063
  _canUseLocalStorage = false;
3904
4064
  _canUseSessionStorage = false;
3905
4065
  }
3906
- function utlCanUseLocalStorage() {
3907
- if (_canUseLocalStorage === undefined) {
4066
+ function utlEnableStorage() {
4067
+ _canUseLocalStorage = utlCanUseLocalStorage(true);
4068
+ _canUseSessionStorage = utlCanUseSessionStorage(true);
4069
+ }
4070
+ function utlCanUseLocalStorage(reset) {
4071
+ if (reset || _canUseLocalStorage === undefined) {
3908
4072
  _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
3909
4073
  }
3910
4074
  return _canUseLocalStorage;
@@ -3917,7 +4081,7 @@ function utlGetLocalStorage(logger, name) {
3917
4081
  }
3918
4082
  catch (e) {
3919
4083
  _canUseLocalStorage = false;
3920
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
4084
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
3921
4085
  }
3922
4086
  }
3923
4087
  return null;
@@ -3931,7 +4095,7 @@ function utlSetLocalStorage(logger, name, data) {
3931
4095
  }
3932
4096
  catch (e) {
3933
4097
  _canUseLocalStorage = false;
3934
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
4098
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
3935
4099
  }
3936
4100
  }
3937
4101
  return false;
@@ -3945,13 +4109,13 @@ function utlRemoveStorage(logger, name) {
3945
4109
  }
3946
4110
  catch (e) {
3947
4111
  _canUseLocalStorage = false;
3948
- logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
4112
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
3949
4113
  }
3950
4114
  }
3951
4115
  return false;
3952
4116
  }
3953
- function utlCanUseSessionStorage() {
3954
- if (_canUseSessionStorage === undefined) {
4117
+ function utlCanUseSessionStorage(reset) {
4118
+ if (reset || _canUseSessionStorage === undefined) {
3955
4119
  _canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage);
3956
4120
  }
3957
4121
  return _canUseSessionStorage;
@@ -3973,7 +4137,7 @@ function utlGetSessionStorage(logger, name) {
3973
4137
  }
3974
4138
  catch (e) {
3975
4139
  _canUseSessionStorage = false;
3976
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
4140
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
3977
4141
  }
3978
4142
  }
3979
4143
  return null;
@@ -3987,7 +4151,7 @@ function utlSetSessionStorage(logger, name, data) {
3987
4151
  }
3988
4152
  catch (e) {
3989
4153
  _canUseSessionStorage = false;
3990
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
4154
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
3991
4155
  }
3992
4156
  }
3993
4157
  return false;
@@ -4001,7 +4165,7 @@ function utlRemoveSessionStorage(logger, name) {
4001
4165
  }
4002
4166
  catch (e) {
4003
4167
  _canUseSessionStorage = false;
4004
- logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
4168
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
4005
4169
  }
4006
4170
  }
4007
4171
  return false;
@@ -5736,6 +5900,33 @@ var PageViewPerformanceManager = /** @class */ (function () {
5736
5900
  return PageViewPerformanceManager;
5737
5901
  }());
5738
5902
 
5903
+ var Timing = /** @class */ (function () {
5904
+ function Timing(logger, name) {
5905
+ var _self = this;
5906
+ var _events = {};
5907
+ _self.start = function (name) {
5908
+ if (typeof _events[name] !== "undefined") {
5909
+ _throwInternal(logger, LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.", { name: name, key: name }, true);
5910
+ }
5911
+ _events[name] = +new Date;
5912
+ };
5913
+ _self.stop = function (name, url, properties, measurements) {
5914
+ var start = _events[name];
5915
+ if (isNaN(start)) {
5916
+ _throwInternal(logger, LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.", { name: name, key: name }, true);
5917
+ }
5918
+ else {
5919
+ var end = +new Date;
5920
+ var duration = dateTimeUtilsDuration(start, end);
5921
+ _self.action(name, url, duration, properties, measurements);
5922
+ }
5923
+ delete _events[name];
5924
+ _events[name] = undefined;
5925
+ };
5926
+ }
5927
+ return Timing;
5928
+ }());
5929
+
5739
5930
  var durationProperty = "duration";
5740
5931
  var strEvent = "event";
5741
5932
  function _dispatchEvent(target, evnt) {
@@ -5753,47 +5944,78 @@ function _getReason(error) {
5753
5944
  }
5754
5945
  return error || "";
5755
5946
  }
5756
- var ApplicationInsights = /** @class */ (function (_super) {
5757
- __extendsFn(ApplicationInsights, _super);
5758
- function ApplicationInsights() {
5947
+ var MinMilliSeconds = 60000;
5948
+ function _configMilliseconds(value, defValue) {
5949
+ value = value || defValue;
5950
+ if (value < MinMilliSeconds) {
5951
+ value = MinMilliSeconds;
5952
+ }
5953
+ return value;
5954
+ }
5955
+ function _getDefaultConfig(config) {
5956
+ if (!config) {
5957
+ config = {};
5958
+ }
5959
+ config.sessionRenewalMs = _configMilliseconds(config.sessionRenewalMs, 30 * 60 * 1000);
5960
+ config.sessionExpirationMs = _configMilliseconds(config.sessionExpirationMs, 24 * 60 * 60 * 1000);
5961
+ config.disableExceptionTracking = stringToBoolOrDefault(config.disableExceptionTracking);
5962
+ config.autoTrackPageVisitTime = stringToBoolOrDefault(config.autoTrackPageVisitTime);
5963
+ config.overridePageViewDuration = stringToBoolOrDefault(config.overridePageViewDuration);
5964
+ config.enableUnhandledPromiseRejectionTracking = stringToBoolOrDefault(config.enableUnhandledPromiseRejectionTracking);
5965
+ if (isNaN(config.samplingPercentage) || config.samplingPercentage <= 0 || config.samplingPercentage >= 100) {
5966
+ config.samplingPercentage = 100;
5967
+ }
5968
+ config.isStorageUseDisabled = stringToBoolOrDefault(config.isStorageUseDisabled);
5969
+ config.isBrowserLinkTrackingEnabled = stringToBoolOrDefault(config.isBrowserLinkTrackingEnabled);
5970
+ config.enableAutoRouteTracking = stringToBoolOrDefault(config.enableAutoRouteTracking);
5971
+ config.namePrefix = config.namePrefix || "";
5972
+ config.enableDebug = stringToBoolOrDefault(config.enableDebug);
5973
+ config.disableFlushOnBeforeUnload = stringToBoolOrDefault(config.disableFlushOnBeforeUnload);
5974
+ config.disableFlushOnUnload = stringToBoolOrDefault(config.disableFlushOnUnload, config.disableFlushOnBeforeUnload);
5975
+ return config;
5976
+ }
5977
+ function _updateStorageUsage(extConfig) {
5978
+ if (!isUndefined(extConfig.isStorageUseDisabled)) {
5979
+ if (extConfig.isStorageUseDisabled) {
5980
+ utlDisableStorage();
5981
+ }
5982
+ else {
5983
+ utlEnableStorage();
5984
+ }
5985
+ }
5986
+ }
5987
+ var AnalyticsPlugin = /** @class */ (function (_super) {
5988
+ __extendsFn(AnalyticsPlugin, _super);
5989
+ function AnalyticsPlugin() {
5759
5990
  var _this = _super.call(this) || this;
5760
5991
  _this.identifier = AnalyticsPluginIdentifier;
5761
5992
  _this.priority = 180;
5762
5993
  _this.autoRoutePVDelay = 500;
5763
5994
  var _eventTracking;
5764
5995
  var _pageTracking;
5765
- var _properties;
5996
+ var _pageViewManager;
5997
+ var _pageViewPerformanceManager;
5998
+ var _pageVisitTimeManager;
5999
+ var _preInitTelemetryInitializers;
6000
+ var _isBrowserLinkTrackingEnabled;
6001
+ var _browserLinkInitializerAdded;
6002
+ var _enableAutoRouteTracking;
6003
+ var _historyListenerAdded;
6004
+ var _disableExceptionTracking;
6005
+ var _autoExceptionInstrumented;
6006
+ var _enableUnhandledPromiseRejectionTracking;
6007
+ var _autoUnhandledPromiseInstrumented;
5766
6008
  var _prevUri;
5767
6009
  var _currUri;
5768
- dynamicProto(ApplicationInsights, _this, function (_self, _base) {
5769
- var location = getLocation(true);
5770
- _prevUri = location && location.href || "";
6010
+ var _evtNamespace;
6011
+ dynamicProto(AnalyticsPlugin, _this, function (_self, _base) {
6012
+ var _addHook = _base._addHook;
6013
+ _initDefaults();
5771
6014
  _self.getCookieMgr = function () {
5772
6015
  return safeGetCookieMgr(_self.core);
5773
6016
  };
5774
6017
  _self.processTelemetry = function (env, itemCtx) {
5775
- doPerf(_self.core, function () { return _self.identifier + ":processTelemetry"; }, function () {
5776
- var doNotSendItem = false;
5777
- var telemetryInitializersCount = _self._telemetryInitializers.length;
5778
- itemCtx = _self._getTelCtx(itemCtx);
5779
- for (var i = 0; i < telemetryInitializersCount; ++i) {
5780
- var telemetryInitializer = _self._telemetryInitializers[i];
5781
- if (telemetryInitializer) {
5782
- try {
5783
- if (telemetryInitializer.apply(null, [env]) === false) {
5784
- doNotSendItem = true;
5785
- break;
5786
- }
5787
- }
5788
- catch (e) {
5789
- itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
5790
- }
5791
- }
5792
- }
5793
- if (!doNotSendItem) {
5794
- _self.processNext(env, itemCtx);
5795
- }
5796
- }, function () { return ({ item: env }); }, !(env.sync));
6018
+ _self.processNext(env, itemCtx);
5797
6019
  };
5798
6020
  _self.trackEvent = function (event, customProperties) {
5799
6021
  try {
@@ -5801,7 +6023,7 @@ var ApplicationInsights = /** @class */ (function (_super) {
5801
6023
  _self.core.track(telemetryItem);
5802
6024
  }
5803
6025
  catch (e) {
5804
- _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6026
+ _throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5805
6027
  }
5806
6028
  };
5807
6029
  _self.startTrackEvent = function (name) {
@@ -5809,7 +6031,7 @@ var ApplicationInsights = /** @class */ (function (_super) {
5809
6031
  _eventTracking.start(name);
5810
6032
  }
5811
6033
  catch (e) {
5812
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackEventFailed, "startTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6034
+ _throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackEventFailed, "startTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5813
6035
  }
5814
6036
  };
5815
6037
  _self.stopTrackEvent = function (name, properties, measurements) {
@@ -5817,7 +6039,7 @@ var ApplicationInsights = /** @class */ (function (_super) {
5817
6039
  _eventTracking.stop(name, undefined, properties);
5818
6040
  }
5819
6041
  catch (e) {
5820
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackEventFailed, "stopTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6042
+ _throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackEventFailed, "stopTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5821
6043
  }
5822
6044
  };
5823
6045
  _self.trackTrace = function (trace, customProperties) {
@@ -5826,7 +6048,7 @@ var ApplicationInsights = /** @class */ (function (_super) {
5826
6048
  _self.core.track(telemetryItem);
5827
6049
  }
5828
6050
  catch (e) {
5829
- _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6051
+ _throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5830
6052
  }
5831
6053
  };
5832
6054
  _self.trackMetric = function (metric, customProperties) {
@@ -5835,19 +6057,19 @@ var ApplicationInsights = /** @class */ (function (_super) {
5835
6057
  _self.core.track(telemetryItem);
5836
6058
  }
5837
6059
  catch (e) {
5838
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackMetricFailed, "trackMetric failed, metric will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6060
+ _throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackMetricFailed, "trackMetric failed, metric will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5839
6061
  }
5840
6062
  };
5841
6063
  _self.trackPageView = function (pageView, customProperties) {
5842
6064
  try {
5843
6065
  var inPv = pageView || {};
5844
- _self._pageViewManager.trackPageView(inPv, __assignFn(__assignFn(__assignFn({}, inPv.properties), inPv.measurements), customProperties));
6066
+ _pageViewManager.trackPageView(inPv, __assignFn(__assignFn(__assignFn({}, inPv.properties), inPv.measurements), customProperties));
5845
6067
  if (_self.config.autoTrackPageVisitTime) {
5846
- _self._pageVisitTimeManager.trackPreviousPageVisit(inPv.name, inPv.uri);
6068
+ _pageVisitTimeManager.trackPreviousPageVisit(inPv.name, inPv.uri);
5847
6069
  }
5848
6070
  }
5849
6071
  catch (e) {
5850
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, "trackPageView failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6072
+ _throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, "trackPageView failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5851
6073
  }
5852
6074
  };
5853
6075
  _self.sendPageViewInternal = function (pageView, properties, systemProperties) {
@@ -5863,12 +6085,13 @@ var ApplicationInsights = /** @class */ (function (_super) {
5863
6085
  _self.core.track(telemetryItem);
5864
6086
  };
5865
6087
  _self.trackPageViewPerformance = function (pageViewPerformance, customProperties) {
6088
+ var inPvp = pageViewPerformance || {};
5866
6089
  try {
5867
- _self._pageViewPerformanceManager.populatePageViewPerformanceEvent(pageViewPerformance);
5868
- _self.sendPageViewPerformanceInternal(pageViewPerformance, customProperties);
6090
+ _pageViewPerformanceManager.populatePageViewPerformanceEvent(inPvp);
6091
+ _self.sendPageViewPerformanceInternal(inPvp, customProperties);
5869
6092
  }
5870
6093
  catch (e) {
5871
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, "trackPageViewPerformance failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6094
+ _throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackPVFailed, "trackPageViewPerformance failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5872
6095
  }
5873
6096
  };
5874
6097
  _self.startTrackPage = function (name) {
@@ -5880,7 +6103,7 @@ var ApplicationInsights = /** @class */ (function (_super) {
5880
6103
  _pageTracking.start(name);
5881
6104
  }
5882
6105
  catch (e) {
5883
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackFailed, "startTrackPage failed, page view may not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6106
+ _throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StartTrackFailed, "startTrackPage failed, page view may not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5884
6107
  }
5885
6108
  };
5886
6109
  _self.stopTrackPage = function (name, url, properties, measurement) {
@@ -5895,11 +6118,11 @@ var ApplicationInsights = /** @class */ (function (_super) {
5895
6118
  }
5896
6119
  _pageTracking.stop(name, url, properties, measurement);
5897
6120
  if (_self.config.autoTrackPageVisitTime) {
5898
- _self._pageVisitTimeManager.trackPreviousPageVisit(name, url);
6121
+ _pageVisitTimeManager.trackPreviousPageVisit(name, url);
5899
6122
  }
5900
6123
  }
5901
6124
  catch (e) {
5902
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackFailed, "stopTrackPage failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6125
+ _throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.StopTrackFailed, "stopTrackPage failed, page view will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5903
6126
  }
5904
6127
  };
5905
6128
  _self.sendExceptionInternal = function (exception, customProperties, systemProperties) {
@@ -5909,11 +6132,14 @@ var ApplicationInsights = /** @class */ (function (_super) {
5909
6132
  _self.core.track(telemetryItem);
5910
6133
  };
5911
6134
  _self.trackException = function (exception, customProperties) {
6135
+ if (exception && !exception.exception && exception.error) {
6136
+ exception.exception = exception.error;
6137
+ }
5912
6138
  try {
5913
6139
  _self.sendExceptionInternal(exception, customProperties);
5914
6140
  }
5915
6141
  catch (e) {
5916
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackExceptionFailed, "trackException failed, exception will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6142
+ _throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TrackExceptionFailed, "trackException failed, exception will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
5917
6143
  }
5918
6144
  };
5919
6145
  _self._onerror = function (exception) {
@@ -5947,158 +6173,97 @@ var ApplicationInsights = /** @class */ (function (_super) {
5947
6173
  }
5948
6174
  catch (e) {
5949
6175
  var errorString = error ? (error.name + ", " + error.message) : "null";
5950
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ExceptionWhileLoggingError, "_onError threw exception while logging error, error will not be collected: "
6176
+ _throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ExceptionWhileLoggingError, "_onError threw exception while logging error, error will not be collected: "
5951
6177
  + getExceptionName(e), { exception: dumpObj(e), errorString: errorString });
5952
6178
  }
5953
6179
  };
5954
6180
  _self.addTelemetryInitializer = function (telemetryInitializer) {
5955
- _self._telemetryInitializers.push(telemetryInitializer);
6181
+ if (_self.core) {
6182
+ return _self.core.addTelemetryInitializer(telemetryInitializer);
6183
+ }
6184
+ if (!_preInitTelemetryInitializers) {
6185
+ _preInitTelemetryInitializers = [];
6186
+ }
6187
+ _preInitTelemetryInitializers.push(telemetryInitializer);
5956
6188
  };
5957
6189
  _self.initialize = function (config, core, extensions, pluginChain) {
5958
6190
  if (_self.isInitialized()) {
5959
6191
  return;
5960
6192
  }
5961
6193
  if (isNullOrUndefined(core)) {
5962
- throw Error("Error initializing");
6194
+ throwError("Error initializing");
5963
6195
  }
5964
6196
  _base.initialize(config, core, extensions, pluginChain);
5965
- _self.setInitialized(false);
5966
- var ctx = _self._getTelCtx();
5967
- var identifier = _self.identifier;
5968
- _self.config = ctx.getExtCfg(identifier);
5969
- var defaults = ApplicationInsights.getDefaultConfig(config);
5970
- if (defaults !== undefined) {
5971
- objForEachKey(defaults, function (field, value) {
5972
- _self.config[field] = ctx.getConfig(identifier, field, value);
5973
- if (_self.config[field] === undefined) {
5974
- _self.config[field] = value;
5975
- }
5976
- });
5977
- }
5978
- if (_self.config.isStorageUseDisabled) {
5979
- utlDisableStorage();
5980
- }
5981
- var configGetters = {
5982
- instrumentationKey: function () { return config.instrumentationKey; },
5983
- accountId: function () { return _self.config.accountId || config.accountId; },
5984
- sessionRenewalMs: function () { return _self.config.sessionRenewalMs || config.sessionRenewalMs; },
5985
- sessionExpirationMs: function () { return _self.config.sessionExpirationMs || config.sessionExpirationMs; },
5986
- sampleRate: function () { return _self.config.samplingPercentage || config.samplingPercentage; },
5987
- sdkExtension: function () { return _self.config.sdkExtension || config.sdkExtension; },
5988
- isBrowserLinkTrackingEnabled: function () { return _self.config.isBrowserLinkTrackingEnabled || config.isBrowserLinkTrackingEnabled; },
5989
- appId: function () { return _self.config.appId || config.appId; }
5990
- };
5991
- _self._pageViewPerformanceManager = new PageViewPerformanceManager(_self.core);
5992
- _self._pageViewManager = new PageViewManager(_this, _self.config.overridePageViewDuration, _self.core, _self._pageViewPerformanceManager);
5993
- _self._pageVisitTimeManager = new PageVisitTimeManager(_self.diagLog(), function (pageName, pageUrl, pageVisitTime) { return trackPageVisitTime(pageName, pageUrl, pageVisitTime); });
5994
- _self._telemetryInitializers = _self._telemetryInitializers || [];
5995
- _addDefaultTelemetryInitializers(configGetters);
5996
- _eventTracking = new Timing(_self.diagLog(), "trackEvent");
5997
- _eventTracking.action =
5998
- function (name, url, duration, properties) {
5999
- if (!properties) {
6197
+ try {
6198
+ _evtNamespace = mergeEvtNamespace(createUniqueNamespace("AnalyticsPlugin"), core.evtNamespace && core.evtNamespace());
6199
+ if (_preInitTelemetryInitializers) {
6200
+ arrForEach(_preInitTelemetryInitializers, function (initializer) {
6201
+ core.addTelemetryInitializer(initializer);
6202
+ });
6203
+ _preInitTelemetryInitializers = null;
6204
+ }
6205
+ var extConfig = _populateDefaults(config);
6206
+ _updateStorageUsage(extConfig);
6207
+ _pageViewPerformanceManager = new PageViewPerformanceManager(_self.core);
6208
+ _pageViewManager = new PageViewManager(_this, extConfig.overridePageViewDuration, _self.core, _pageViewPerformanceManager);
6209
+ _pageVisitTimeManager = new PageVisitTimeManager(_self.diagLog(), function (pageName, pageUrl, pageVisitTime) { return trackPageVisitTime(pageName, pageUrl, pageVisitTime); });
6210
+ _updateBrowserLinkTracking(extConfig, config);
6211
+ _eventTracking = new Timing(_self.diagLog(), "trackEvent");
6212
+ _eventTracking.action =
6213
+ function (name, url, duration, properties) {
6214
+ if (!properties) {
6215
+ properties = {};
6216
+ }
6217
+ properties[durationProperty] = duration.toString();
6218
+ _self.trackEvent({ name: name, properties: properties });
6219
+ };
6220
+ _pageTracking = new Timing(_self.diagLog(), "trackPageView");
6221
+ _pageTracking.action = function (name, url, duration, properties, measurements) {
6222
+ if (isNullOrUndefined(properties)) {
6000
6223
  properties = {};
6001
6224
  }
6002
6225
  properties[durationProperty] = duration.toString();
6003
- _self.trackEvent({ name: name, properties: properties });
6004
- };
6005
- _pageTracking = new Timing(_self.diagLog(), "trackPageView");
6006
- _pageTracking.action = function (name, url, duration, properties, measurements) {
6007
- if (isNullOrUndefined(properties)) {
6008
- properties = {};
6009
- }
6010
- properties[durationProperty] = duration.toString();
6011
- var pageViewItem = {
6012
- name: name,
6013
- uri: url,
6014
- properties: properties,
6015
- measurements: measurements
6016
- };
6017
- _self.sendPageViewInternal(pageViewItem, properties);
6018
- };
6019
- var _window = getWindow();
6020
- var _history = getHistory();
6021
- var _location = getLocation(true);
6022
- var instance = _this;
6023
- if (_self.config.disableExceptionTracking === false &&
6024
- !_self.config.autoExceptionInstrumented && _window) {
6025
- var onerror_1 = "onerror";
6026
- var originalOnError_1 = _window[onerror_1];
6027
- _window.onerror = function (message, url, lineNumber, columnNumber, error) {
6028
- var evt = _window[strEvent];
6029
- var handled = originalOnError_1 && originalOnError_1(message, url, lineNumber, columnNumber, error);
6030
- if (handled !== true) {
6031
- instance._onerror(Exception.CreateAutoException(message, url, lineNumber, columnNumber, error, evt));
6032
- }
6033
- return handled;
6034
- };
6035
- _self.config.autoExceptionInstrumented = true;
6036
- }
6037
- if (_self.config.disableExceptionTracking === false &&
6038
- _self.config.enableUnhandledPromiseRejectionTracking === true &&
6039
- !_self.config.autoUnhandledPromiseInstrumented && _window) {
6040
- var onunhandledrejection_1 = "onunhandledrejection";
6041
- var originalOnUnhandledRejection_1 = _window[onunhandledrejection_1];
6042
- _window[onunhandledrejection_1] = function (error) {
6043
- var evt = _window[strEvent];
6044
- var handled = originalOnUnhandledRejection_1 && originalOnUnhandledRejection_1.call(_window, error);
6045
- if (handled !== true) {
6046
- instance._onerror(Exception.CreateAutoException(_getReason(error), _location ? _location.href : "", 0, 0, error, evt));
6047
- }
6048
- return handled;
6226
+ var pageViewItem = {
6227
+ name: name,
6228
+ uri: url,
6229
+ properties: properties,
6230
+ measurements: measurements
6231
+ };
6232
+ _self.sendPageViewInternal(pageViewItem, properties);
6049
6233
  };
6050
- _self.config.autoUnhandledPromiseInstrumented = true;
6051
- }
6052
- if (_self.config.enableAutoRouteTracking === true
6053
- && _history && isFunction(_history.pushState) && isFunction(_history.replaceState)
6054
- && _window
6055
- && typeof Event !== "undefined") {
6056
- var _self_1 = _this;
6057
- arrForEach(extensions, function (extension) {
6058
- if (extension.identifier === PropertiesPluginIdentifier) {
6059
- _properties = extension;
6060
- }
6061
- });
6062
- _history.pushState = (function (f) { return function pushState() {
6063
- var ret = f.apply(this, arguments);
6064
- _dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "pushState"));
6065
- _dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "locationchange"));
6066
- return ret;
6067
- }; })(_history.pushState);
6068
- _history.replaceState = (function (f) { return function replaceState() {
6069
- var ret = f.apply(this, arguments);
6070
- _dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "replaceState"));
6071
- _dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "locationchange"));
6072
- return ret;
6073
- }; })(_history.replaceState);
6074
- if (_window.addEventListener) {
6075
- _window.addEventListener(_self_1.config.namePrefix + "popstate", function () {
6076
- _dispatchEvent(_window, createDomEvent(_self_1.config.namePrefix + "locationchange"));
6077
- });
6078
- _window.addEventListener(_self_1.config.namePrefix + "locationchange", function () {
6079
- if (_properties && _properties.context && _properties.context.telemetryTrace) {
6080
- _properties.context.telemetryTrace.traceID = generateW3CId();
6081
- var traceLocationName = "_unknown_";
6082
- if (_location && _location.pathname) {
6083
- traceLocationName = _location.pathname + (_location.hash || "");
6084
- }
6085
- _properties.context.telemetryTrace.name = dataSanitizeString(_self_1.diagLog(), traceLocationName);
6086
- }
6087
- if (_currUri) {
6088
- _prevUri = _currUri;
6089
- _currUri = _location && _location.href || "";
6090
- }
6091
- else {
6092
- _currUri = _location && _location.href || "";
6093
- }
6094
- setTimeout((function (uri) {
6095
- _self_1.trackPageView({ refUri: uri, properties: { duration: 0 } });
6096
- }).bind(_this, _prevUri), _self_1.autoRoutePVDelay);
6097
- });
6234
+ if (hasWindow()) {
6235
+ _updateExceptionTracking(extConfig);
6236
+ _updateLocationChange(extConfig);
6098
6237
  }
6099
6238
  }
6100
- _self.setInitialized(true);
6239
+ catch (e) {
6240
+ _self.setInitialized(false);
6241
+ throw e;
6242
+ }
6243
+ };
6244
+ _self._doTeardown = function (unloadCtx, unloadState) {
6245
+ eventOff(window, null, null, _evtNamespace);
6246
+ _initDefaults();
6101
6247
  };
6248
+ function _populateDefaults(config) {
6249
+ var ctx = createProcessTelemetryContext(null, config, _self.core);
6250
+ var identifier = _self.identifier;
6251
+ var defaults = _getDefaultConfig(config);
6252
+ var extConfig = _self.config = ctx.getExtCfg(identifier);
6253
+ if (defaults !== undefined) {
6254
+ objForEachKey(defaults, function (field, value) {
6255
+ extConfig[field] = ctx.getConfig(identifier, field, value);
6256
+ if (extConfig[field] === undefined) {
6257
+ extConfig = value;
6258
+ }
6259
+ });
6260
+ }
6261
+ return extConfig;
6262
+ }
6263
+ function _updateBrowserLinkTracking(extConfig, config) {
6264
+ _isBrowserLinkTrackingEnabled = extConfig.isBrowserLinkTrackingEnabled || config.isBrowserLinkTrackingEnabled;
6265
+ _addDefaultTelemetryInitializers();
6266
+ }
6102
6267
  function trackPageVisitTime(pageName, pageUrl, pageVisitTime) {
6103
6268
  var properties = { PageName: pageName, PageUrl: pageUrl };
6104
6269
  _self.trackMetric({
@@ -6109,11 +6274,11 @@ var ApplicationInsights = /** @class */ (function (_super) {
6109
6274
  sampleCount: 1
6110
6275
  }, properties);
6111
6276
  }
6112
- function _addDefaultTelemetryInitializers(configGetters) {
6113
- if (!configGetters.isBrowserLinkTrackingEnabled()) {
6277
+ function _addDefaultTelemetryInitializers() {
6278
+ if (!_browserLinkInitializerAdded && _isBrowserLinkTrackingEnabled) {
6114
6279
  var browserLinkPaths_1 = ["/browserLinkSignalR/", "/__browserLink/"];
6115
6280
  var dropBrowserLinkRequests = function (envelope) {
6116
- if (envelope.baseType === RemoteDependencyData.dataType) {
6281
+ if (_isBrowserLinkTrackingEnabled && envelope.baseType === RemoteDependencyData.dataType) {
6117
6282
  var remoteData = envelope.baseData;
6118
6283
  if (remoteData) {
6119
6284
  for (var i = 0; i < browserLinkPaths_1.length; i++) {
@@ -6125,70 +6290,147 @@ var ApplicationInsights = /** @class */ (function (_super) {
6125
6290
  }
6126
6291
  return true;
6127
6292
  };
6128
- _addTelemetryInitializer(dropBrowserLinkRequests);
6293
+ _self.addTelemetryInitializer(dropBrowserLinkRequests);
6294
+ _browserLinkInitializerAdded = true;
6129
6295
  }
6130
6296
  }
6131
- function _addTelemetryInitializer(telemetryInitializer) {
6132
- _self._telemetryInitializers.push(telemetryInitializer);
6133
- }
6134
6297
  function _sendCORSException(exception, properties) {
6135
6298
  var telemetryItem = TelemetryItemCreator.create(exception, Exception.dataType, Exception.envelopeType, _self.diagLog(), properties);
6136
6299
  _self.core.track(telemetryItem);
6137
6300
  }
6138
- });
6139
- return _this;
6140
- }
6141
- ApplicationInsights.getDefaultConfig = function (config) {
6142
- if (!config) {
6143
- config = {};
6144
- }
6145
- config.sessionRenewalMs = 30 * 60 * 1000;
6146
- config.sessionExpirationMs = 24 * 60 * 60 * 1000;
6147
- config.disableExceptionTracking = stringToBoolOrDefault(config.disableExceptionTracking);
6148
- config.autoTrackPageVisitTime = stringToBoolOrDefault(config.autoTrackPageVisitTime);
6149
- config.overridePageViewDuration = stringToBoolOrDefault(config.overridePageViewDuration);
6150
- config.enableUnhandledPromiseRejectionTracking = stringToBoolOrDefault(config.enableUnhandledPromiseRejectionTracking);
6151
- if (isNaN(config.samplingPercentage) || config.samplingPercentage <= 0 || config.samplingPercentage >= 100) {
6152
- config.samplingPercentage = 100;
6153
- }
6154
- config.isStorageUseDisabled = stringToBoolOrDefault(config.isStorageUseDisabled);
6155
- config.isBrowserLinkTrackingEnabled = stringToBoolOrDefault(config.isBrowserLinkTrackingEnabled);
6156
- config.enableAutoRouteTracking = stringToBoolOrDefault(config.enableAutoRouteTracking);
6157
- config.namePrefix = config.namePrefix || "";
6158
- config.enableDebug = stringToBoolOrDefault(config.enableDebug);
6159
- config.disableFlushOnBeforeUnload = stringToBoolOrDefault(config.disableFlushOnBeforeUnload);
6160
- config.disableFlushOnUnload = stringToBoolOrDefault(config.disableFlushOnUnload, config.disableFlushOnBeforeUnload);
6161
- return config;
6162
- };
6163
- ApplicationInsights.Version = "2.8.0-beta.2203-04";
6164
- return ApplicationInsights;
6165
- }(BaseTelemetryPlugin));
6166
- var Timing = /** @class */ (function () {
6167
- function Timing(logger, name) {
6168
- var _self = this;
6169
- var _events = {};
6170
- _self.start = function (name) {
6171
- if (typeof _events[name] !== "undefined") {
6172
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.", { name: name, key: name }, true);
6301
+ function _updateExceptionTracking(extConfig) {
6302
+ var _window = getWindow();
6303
+ var locn = getLocation(true);
6304
+ _disableExceptionTracking = extConfig.disableExceptionTracking;
6305
+ if (!_disableExceptionTracking && !_autoExceptionInstrumented && !extConfig.autoExceptionInstrumented) {
6306
+ _addHook(InstrumentFunc(_window, "onerror", {
6307
+ ns: _evtNamespace,
6308
+ rsp: function (callDetails, message, url, lineNumber, columnNumber, error) {
6309
+ if (!_disableExceptionTracking && callDetails.rslt !== true) {
6310
+ _self._onerror(Exception.CreateAutoException(message, url, lineNumber, columnNumber, error, callDetails.evt));
6311
+ }
6312
+ }
6313
+ }));
6314
+ _autoExceptionInstrumented = true;
6315
+ }
6316
+ _addUnhandledPromiseRejectionTracking(extConfig, _window, locn);
6173
6317
  }
6174
- _events[name] = +new Date;
6175
- };
6176
- _self.stop = function (name, url, properties, measurements) {
6177
- var start = _events[name];
6178
- if (isNaN(start)) {
6179
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.", { name: name, key: name }, true);
6318
+ function _updateLocationChange(extConfig) {
6319
+ var win = getWindow();
6320
+ var locn = getLocation(true);
6321
+ _enableAutoRouteTracking = extConfig.enableAutoRouteTracking === true;
6322
+ if (win && _enableAutoRouteTracking && hasHistory()) {
6323
+ var _history = getHistory();
6324
+ if (isFunction(_history.pushState) && isFunction(_history.replaceState) && typeof Event !== strShimUndefined) {
6325
+ _addHistoryListener(extConfig, win, _history, locn);
6326
+ }
6327
+ }
6180
6328
  }
6181
- else {
6182
- var end = +new Date;
6183
- var duration = dateTimeUtilsDuration(start, end);
6184
- _self.action(name, url, duration, properties, measurements);
6329
+ function _addHistoryListener(extConfig, win, history, locn) {
6330
+ function _popstateHandler() {
6331
+ if (_enableAutoRouteTracking) {
6332
+ _dispatchEvent(win, createDomEvent(extConfig.namePrefix + "locationchange"));
6333
+ }
6334
+ }
6335
+ function _locationChangeHandler() {
6336
+ if (_currUri) {
6337
+ _prevUri = _currUri;
6338
+ _currUri = locn && locn.href || "";
6339
+ }
6340
+ else {
6341
+ _currUri = locn && locn.href || "";
6342
+ }
6343
+ if (_enableAutoRouteTracking) {
6344
+ var properties = _self.core.getPlugin(PropertiesPluginIdentifier);
6345
+ if (properties) {
6346
+ var context = properties.plugin.context;
6347
+ if (context && context.telemetryTrace) {
6348
+ context.telemetryTrace.traceID = generateW3CId();
6349
+ var traceLocationName = "_unknown_";
6350
+ if (locn && locn.pathname) {
6351
+ traceLocationName = locn.pathname + (locn.hash || "");
6352
+ }
6353
+ context.telemetryTrace.name = dataSanitizeString(_self.diagLog(), traceLocationName);
6354
+ }
6355
+ }
6356
+ setTimeout((function (uri) {
6357
+ _self.trackPageView({ refUri: uri, properties: { duration: 0 } });
6358
+ }).bind(this, _prevUri), _self.autoRoutePVDelay);
6359
+ }
6360
+ }
6361
+ if (!_historyListenerAdded) {
6362
+ _addHook(InstrumentFunc(history, "pushState", {
6363
+ ns: _evtNamespace,
6364
+ rsp: function () {
6365
+ if (_enableAutoRouteTracking) {
6366
+ _dispatchEvent(win, createDomEvent(extConfig.namePrefix + "pushState"));
6367
+ _dispatchEvent(win, createDomEvent(extConfig.namePrefix + "locationchange"));
6368
+ }
6369
+ }
6370
+ }));
6371
+ _addHook(InstrumentFunc(history, "replaceState", {
6372
+ ns: _evtNamespace,
6373
+ rsp: function () {
6374
+ if (_enableAutoRouteTracking) {
6375
+ _dispatchEvent(win, createDomEvent(extConfig.namePrefix + "replaceState"));
6376
+ _dispatchEvent(win, createDomEvent(extConfig.namePrefix + "locationchange"));
6377
+ }
6378
+ }
6379
+ }));
6380
+ eventOn(win, extConfig.namePrefix + "popstate", _popstateHandler, _evtNamespace);
6381
+ eventOn(win, extConfig.namePrefix + "locationchange", _locationChangeHandler, _evtNamespace);
6382
+ _historyListenerAdded = true;
6383
+ }
6384
+ }
6385
+ function _addUnhandledPromiseRejectionTracking(extConfig, _window, _location) {
6386
+ _enableUnhandledPromiseRejectionTracking = extConfig.enableUnhandledPromiseRejectionTracking === true;
6387
+ if (_enableUnhandledPromiseRejectionTracking && !_autoUnhandledPromiseInstrumented) {
6388
+ _addHook(InstrumentFunc(_window, "onunhandledrejection", {
6389
+ ns: _evtNamespace,
6390
+ rsp: function (callDetails, error) {
6391
+ if (_enableUnhandledPromiseRejectionTracking && callDetails.rslt !== true) {
6392
+ _self._onerror(Exception.CreateAutoException(_getReason(error), _location ? _location.href : "", 0, 0, error, callDetails.evt));
6393
+ }
6394
+ }
6395
+ }));
6396
+ _autoUnhandledPromiseInstrumented = true;
6397
+ extConfig.autoUnhandledPromiseInstrumented = _autoUnhandledPromiseInstrumented;
6398
+ }
6185
6399
  }
6186
- delete _events[name];
6187
- _events[name] = undefined;
6188
- };
6400
+ function _throwInternal(severity, msgId, msg, properties, isUserAct) {
6401
+ _self.diagLog().throwInternal(severity, msgId, msg, properties, isUserAct);
6402
+ }
6403
+ function _initDefaults() {
6404
+ _eventTracking = null;
6405
+ _pageTracking = null;
6406
+ _pageViewManager = null;
6407
+ _pageViewPerformanceManager = null;
6408
+ _pageVisitTimeManager = null;
6409
+ _preInitTelemetryInitializers = null;
6410
+ _isBrowserLinkTrackingEnabled = false;
6411
+ _browserLinkInitializerAdded = false;
6412
+ _enableAutoRouteTracking = false;
6413
+ _historyListenerAdded = false;
6414
+ _disableExceptionTracking = false;
6415
+ _autoExceptionInstrumented = false;
6416
+ _enableUnhandledPromiseRejectionTracking = false;
6417
+ _autoUnhandledPromiseInstrumented = false;
6418
+ var location = getLocation(true);
6419
+ _prevUri = location && location.href || "";
6420
+ _currUri = null;
6421
+ _evtNamespace = null;
6422
+ }
6423
+ objDefineAccessors(_self, "_pageViewManager", function () { return _pageViewManager; });
6424
+ objDefineAccessors(_self, "_pageViewPerformanceManager", function () { return _pageViewPerformanceManager; });
6425
+ objDefineAccessors(_self, "_pageVisitTimeManager", function () { return _pageVisitTimeManager; });
6426
+ objDefineAccessors(_self, "_evtNamespace", function () { return "." + _evtNamespace; });
6427
+ });
6428
+ return _this;
6189
6429
  }
6190
- return Timing;
6191
- }());
6430
+ AnalyticsPlugin.Version = "2.8.0-beta.2203-05";
6431
+ AnalyticsPlugin.getDefaultConfig = _getDefaultConfig;
6432
+ return AnalyticsPlugin;
6433
+ }(BaseTelemetryPlugin));
6192
6434
 
6193
6435
  var BaseSendBuffer = /** @class */ (function () {
6194
6436
  function BaseSendBuffer(logger, config) {
@@ -6467,7 +6709,7 @@ function EnvelopeCreatorInit(logger, telemetryItem) {
6467
6709
  }
6468
6710
  }
6469
6711
  var EnvelopeCreator = {
6470
- Version: "2.8.0-beta.2203-04"
6712
+ Version: "2.8.0-beta.2203-05"
6471
6713
  };
6472
6714
  function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
6473
6715
  EnvelopeCreatorInit(logger, telemetryItem);
@@ -6762,65 +7004,81 @@ var Serializer = /** @class */ (function () {
6762
7004
  return Serializer;
6763
7005
  }());
6764
7006
 
6765
- var OfflineListener = /** @class */ (function () {
6766
- function OfflineListener() {
6767
- var _window = getWindow();
6768
- var _document = getDocument();
6769
- var isListening = false;
6770
- var _onlineStatus = true;
6771
- dynamicProto(OfflineListener, this, function (_self) {
6772
- try {
6773
- if (_window) {
6774
- if (attachEvent(_window, "online", _setOnline)) {
6775
- attachEvent(_window, "offline", _setOffline);
6776
- isListening = true;
6777
- }
6778
- }
6779
- if (_document) {
6780
- var target = _document.body || _document;
6781
- if (!isUndefined(target.ononline)) {
6782
- target.ononline = _setOnline;
6783
- target.onoffline = _setOffline;
6784
- isListening = true;
6785
- }
6786
- }
6787
- if (isListening) {
6788
- var _navigator = getNavigator();
6789
- if (_navigator && !isNullOrUndefined(_navigator.onLine)) {
6790
- _onlineStatus = _navigator.onLine;
6791
- }
7007
+ function _disableEvents(target, evtNamespace) {
7008
+ eventOff(target, null, null, evtNamespace);
7009
+ }
7010
+ function createOfflineListener(parentEvtNamespace) {
7011
+ var _document = getDocument();
7012
+ var _navigator = getNavigator();
7013
+ var _isListening = false;
7014
+ var _onlineStatus = true;
7015
+ var _evtNamespace = mergeEvtNamespace(createUniqueNamespace("OfflineListener"), parentEvtNamespace);
7016
+ try {
7017
+ if (_enableEvents(getWindow())) {
7018
+ _isListening = true;
7019
+ }
7020
+ if (_document) {
7021
+ var target = _document.body || _document;
7022
+ if (target.ononline) {
7023
+ if (_enableEvents(target)) {
7024
+ _isListening = true;
6792
7025
  }
6793
7026
  }
6794
- catch (e) {
6795
- isListening = false;
7027
+ }
7028
+ if (_isListening) {
7029
+ if (_navigator && !isNullOrUndefined(_navigator.onLine)) {
7030
+ _onlineStatus = _navigator.onLine;
6796
7031
  }
6797
- _self.isListening = isListening;
6798
- _self.isOnline = function () {
6799
- var result = true;
6800
- var _navigator = getNavigator();
6801
- if (isListening) {
6802
- result = _onlineStatus;
6803
- }
6804
- else if (_navigator && !isNullOrUndefined(_navigator.onLine)) {
6805
- result = _navigator.onLine;
6806
- }
6807
- return result;
6808
- };
6809
- _self.isOffline = function () {
6810
- return !_self.isOnline();
6811
- };
6812
- function _setOnline() {
6813
- _onlineStatus = true;
7032
+ }
7033
+ }
7034
+ catch (e) {
7035
+ _isListening = false;
7036
+ }
7037
+ function _enableEvents(target) {
7038
+ var enabled = false;
7039
+ if (target) {
7040
+ enabled = eventOn(target, "online", _setOnline, _evtNamespace);
7041
+ if (enabled) {
7042
+ eventOn(target, "offline", _setOffline, _evtNamespace);
6814
7043
  }
6815
- function _setOffline() {
6816
- _onlineStatus = false;
7044
+ }
7045
+ return enabled;
7046
+ }
7047
+ function _setOnline() {
7048
+ _onlineStatus = true;
7049
+ }
7050
+ function _setOffline() {
7051
+ _onlineStatus = false;
7052
+ }
7053
+ function _isOnline() {
7054
+ var result = true;
7055
+ if (_isListening) {
7056
+ result = _onlineStatus;
7057
+ }
7058
+ else if (_navigator && !isNullOrUndefined(_navigator.onLine)) {
7059
+ result = _navigator.onLine;
7060
+ }
7061
+ return result;
7062
+ }
7063
+ function _unload() {
7064
+ var win = getWindow();
7065
+ if (win && _isListening) {
7066
+ _disableEvents(win, _evtNamespace);
7067
+ if (_document) {
7068
+ var target = _document.body || _document;
7069
+ if (!isUndefined(target.ononline)) {
7070
+ _disableEvents(target, _evtNamespace);
7071
+ }
6817
7072
  }
6818
- });
7073
+ _isListening = false;
7074
+ }
6819
7075
  }
6820
- OfflineListener.Offline = new OfflineListener;
6821
- return OfflineListener;
6822
- }());
6823
- var Offline = OfflineListener.Offline;
7076
+ return {
7077
+ isOnline: _isOnline,
7078
+ isListening: function () { return _isListening; },
7079
+ unload: _unload
7080
+ };
7081
+ }
6824
7082
 
6825
7083
  var MIN_INPUT_LENGTH = 8;
6826
7084
  var HashCodeScoreGenerator = /** @class */ (function () {
@@ -6948,22 +7206,22 @@ var Sender = /** @class */ (function (_super) {
6948
7206
  var _this = _super.call(this) || this;
6949
7207
  _this.priority = 1001;
6950
7208
  _this.identifier = BreezeChannelIdentifier;
7209
+ _this._senderConfig = _getDefaultAppInsightsChannelConfig();
6951
7210
  var _consecutiveErrors;
6952
7211
  var _retryAt;
6953
7212
  var _lastSend;
6954
- var _paused = false;
7213
+ var _paused;
6955
7214
  var _timeoutHandle;
6956
7215
  var _serializer;
6957
7216
  var _stamp_specific_redirects;
6958
- var _headers = {};
7217
+ var _headers;
6959
7218
  var _syncFetchPayload = 0;
6960
7219
  var _fallbackSender;
6961
7220
  var _syncUnloadSender;
6962
- _this._senderConfig = _getDefaultAppInsightsChannelConfig();
7221
+ var _offlineListener;
7222
+ var _evtNamespace;
6963
7223
  dynamicProto(Sender, _this, function (_self, _base) {
6964
- function _notImplemented() {
6965
- throwError("Method not implemented.");
6966
- }
7224
+ _initDefaults();
6967
7225
  _self.pause = function () {
6968
7226
  _clearScheduledTimer();
6969
7227
  _paused = true;
@@ -6986,7 +7244,7 @@ var Sender = /** @class */ (function (_super) {
6986
7244
  _self.triggerSend(isAsync, null, sendReason || 1 );
6987
7245
  }
6988
7246
  catch (e) {
6989
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FlushFailed, "flush failed, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
7247
+ _throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.FlushFailed, "flush failed, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
6990
7248
  }
6991
7249
  }
6992
7250
  };
@@ -6997,7 +7255,7 @@ var Sender = /** @class */ (function (_super) {
6997
7255
  _self.triggerSend(true, _doUnloadSend, 2 );
6998
7256
  }
6999
7257
  catch (e) {
7000
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.FailedToSendQueuedTelemetry, "failed to flush with beacon sender on page unload, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
7258
+ _throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.FailedToSendQueuedTelemetry, "failed to flush with beacon sender on page unload, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
7001
7259
  }
7002
7260
  }
7003
7261
  else {
@@ -7005,7 +7263,6 @@ var Sender = /** @class */ (function (_super) {
7005
7263
  }
7006
7264
  }
7007
7265
  };
7008
- _self.teardown = _notImplemented;
7009
7266
  _self.addHeader = function (name, value) {
7010
7267
  _headers[name] = value;
7011
7268
  };
@@ -7020,6 +7277,8 @@ var Sender = /** @class */ (function (_super) {
7020
7277
  _self._sender = null;
7021
7278
  _stamp_specific_redirects = 0;
7022
7279
  var diagLog = _self.diagLog();
7280
+ _evtNamespace = mergeEvtNamespace(createUniqueNamespace("Sender"), core.evtNamespace && core.evtNamespace());
7281
+ _offlineListener = createOfflineListener(_evtNamespace);
7023
7282
  var defaultConfig = _getDefaultAppInsightsChannelConfig();
7024
7283
  objForEachKey(defaultConfig, function (field, value) {
7025
7284
  _self._senderConfig[field] = function () { return ctx.getConfig(identifier, field, value()); };
@@ -7028,7 +7287,7 @@ var Sender = /** @class */ (function (_super) {
7028
7287
  ? new SessionStorageSendBuffer(diagLog, _self._senderConfig) : new ArraySendBuffer(diagLog, _self._senderConfig);
7029
7288
  _self._sample = new Sample(_self._senderConfig.samplingPercentage(), diagLog);
7030
7289
  if (!_validateInstrumentationKey(config)) {
7031
- diagLog.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidInstrumentationKey, "Invalid Instrumentation key " + config.instrumentationKey);
7290
+ _throwInternal(diagLog, LoggingSeverity.CRITICAL, _InternalMessageId.InvalidInstrumentationKey, "Invalid Instrumentation key " + config.instrumentationKey);
7032
7291
  }
7033
7292
  if (!isInternalApplicationInsightsEndpoint(_self._senderConfig.endpointUrl()) && _self._senderConfig.customHeaders() && _self._senderConfig.customHeaders().length > 0) {
7034
7293
  arrForEach(_self._senderConfig.customHeaders(), function (customHeader) {
@@ -7074,22 +7333,22 @@ var Sender = /** @class */ (function (_super) {
7074
7333
  return;
7075
7334
  }
7076
7335
  if (!telemetryItem) {
7077
- itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CannotSendEmptyTelemetry, "Cannot send empty telemetry");
7336
+ _throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.CannotSendEmptyTelemetry, "Cannot send empty telemetry");
7078
7337
  return;
7079
7338
  }
7080
7339
  if (telemetryItem.baseData && !telemetryItem.baseType) {
7081
- itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidEvent, "Cannot send telemetry without baseData and baseType");
7340
+ _throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.InvalidEvent, "Cannot send telemetry without baseData and baseType");
7082
7341
  return;
7083
7342
  }
7084
7343
  if (!telemetryItem.baseType) {
7085
7344
  telemetryItem.baseType = "EventData";
7086
7345
  }
7087
7346
  if (!_self._sender) {
7088
- itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, "Sender was not initialized");
7347
+ _throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.SenderNotInitialized, "Sender was not initialized");
7089
7348
  return;
7090
7349
  }
7091
7350
  if (!_isSampledIn(telemetryItem)) {
7092
- itemCtx.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TelemetrySampledAndNotSent, "Telemetry item was sampled out and not sent", { SampleRate: _self._sample.sampleRate });
7351
+ _throwInternal(itemCtx.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TelemetrySampledAndNotSent, "Telemetry item was sampled out and not sent", { SampleRate: _self._sample.sampleRate });
7093
7352
  return;
7094
7353
  }
7095
7354
  else {
@@ -7099,7 +7358,7 @@ var Sender = /** @class */ (function (_super) {
7099
7358
  var defaultEnvelopeIkey = telemetryItem.iKey || _self._senderConfig.instrumentationKey();
7100
7359
  var aiEnvelope_1 = Sender.constructEnvelope(telemetryItem, defaultEnvelopeIkey, itemCtx.diagLog(), convertUndefined);
7101
7360
  if (!aiEnvelope_1) {
7102
- itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.CreateEnvelopeError, "Unable to create an AppInsights envelope");
7361
+ _throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.CreateEnvelopeError, "Unable to create an AppInsights envelope");
7103
7362
  return;
7104
7363
  }
7105
7364
  var doNotSendItem_1 = false;
@@ -7112,7 +7371,7 @@ var Sender = /** @class */ (function (_super) {
7112
7371
  }
7113
7372
  }
7114
7373
  catch (e) {
7115
- itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
7374
+ _throwInternal(itemCtx.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
7116
7375
  }
7117
7376
  });
7118
7377
  delete telemetryItem.tags[ProcessLegacy];
@@ -7130,7 +7389,7 @@ var Sender = /** @class */ (function (_super) {
7130
7389
  _setupTimer();
7131
7390
  }
7132
7391
  catch (e) {
7133
- itemCtx.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.FailedAddingTelemetryToBuffer, "Failed adding telemetry to the sender's buffer, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
7392
+ _throwInternal(itemCtx.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.FailedAddingTelemetryToBuffer, "Failed adding telemetry to the sender's buffer, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
7134
7393
  }
7135
7394
  _self.processNext(telemetryItem, itemCtx);
7136
7395
  };
@@ -7165,13 +7424,18 @@ var Sender = /** @class */ (function (_super) {
7165
7424
  catch (e) {
7166
7425
  var ieVer = getIEVersion();
7167
7426
  if (!ieVer || ieVer > 9) {
7168
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TransmissionFailed, "Telemetry transmission failed, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
7427
+ _throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.TransmissionFailed, "Telemetry transmission failed, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
7169
7428
  }
7170
7429
  }
7171
7430
  }
7172
7431
  };
7432
+ _self._doTeardown = function (unloadCtx, unloadState) {
7433
+ _self.onunloadFlush();
7434
+ _offlineListener.unload();
7435
+ _initDefaults();
7436
+ };
7173
7437
  _self._onError = function (payload, message, event) {
7174
- _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.OnError, "Failed to send telemetry.", { message: message });
7438
+ _throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.OnError, "Failed to send telemetry.", { message: message });
7175
7439
  _self._buffer.clearSent(payload);
7176
7440
  };
7177
7441
  _self._onPartialSuccess = function (payload, results) {
@@ -7196,7 +7460,7 @@ var Sender = /** @class */ (function (_super) {
7196
7460
  }
7197
7461
  if (retry.length > 0) {
7198
7462
  _resendPayload(retry);
7199
- _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, "Partial success. " +
7463
+ _throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, "Partial success. " +
7200
7464
  "Delivered: " + payload.length + ", Failed: " + failed.length +
7201
7465
  ". Will retry to send " + retry.length + " our of " + results.itemsReceived + " items");
7202
7466
  }
@@ -7241,18 +7505,18 @@ var Sender = /** @class */ (function (_super) {
7241
7505
  }
7242
7506
  if (!_self._senderConfig.isRetryDisabled() && _isRetriable(status)) {
7243
7507
  _resendPayload(payload);
7244
- _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
7508
+ _throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
7245
7509
  "Response code " + status + ". Will retry to send " + payload.length + " items.");
7246
7510
  }
7247
7511
  else {
7248
7512
  _self._onError(payload, errorMessage);
7249
7513
  }
7250
7514
  }
7251
- else if (Offline.isOffline()) {
7515
+ else if (_offlineListener && !_offlineListener.isOnline()) {
7252
7516
  if (!_self._senderConfig.isRetryDisabled()) {
7253
7517
  var offlineBackOffMultiplier = 10;
7254
7518
  _resendPayload(payload, offlineBackOffMultiplier);
7255
- _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". Offline - Response Code: ".concat(status, ". Offline status: ").concat(Offline.isOffline(), ". Will retry to send ").concat(payload.length, " items."));
7519
+ _throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". Offline - Response Code: ".concat(status, ". Offline status: ").concat(!_offlineListener.isOnline(), ". Will retry to send ").concat(payload.length, " items."));
7256
7520
  }
7257
7521
  }
7258
7522
  else {
@@ -7319,8 +7583,8 @@ var Sender = /** @class */ (function (_super) {
7319
7583
  }
7320
7584
  }
7321
7585
  if (droppedPayload.length > 0) {
7322
- _fallbackSender(droppedPayload, true);
7323
- _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with normal sender.");
7586
+ _fallbackSender && _fallbackSender(droppedPayload, true);
7587
+ _throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with normal sender.");
7324
7588
  }
7325
7589
  }
7326
7590
  }
@@ -7361,7 +7625,7 @@ var Sender = /** @class */ (function (_super) {
7361
7625
  }
7362
7626
  else {
7363
7627
  _fallbackSender && _fallbackSender(payload, true);
7364
- _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with xhrSender.");
7628
+ _throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API, retried with xhrSender.");
7365
7629
  }
7366
7630
  }
7367
7631
  }
@@ -7452,7 +7716,7 @@ var Sender = /** @class */ (function (_super) {
7452
7716
  }
7453
7717
  }
7454
7718
  catch (e) {
7455
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.InvalidBackendResponse, "Cannot parse the response. " + getExceptionName(e), {
7719
+ _throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.InvalidBackendResponse, "Cannot parse the response. " + getExceptionName(e), {
7456
7720
  response: response
7457
7721
  });
7458
7722
  }
@@ -7523,7 +7787,7 @@ var Sender = /** @class */ (function (_super) {
7523
7787
  xdr.onerror = function (event) { return _self._onError(payload, _formatErrorMessageXdr(xdr), event); };
7524
7788
  var hostingProtocol = _window && _window.location && _window.location.protocol || "";
7525
7789
  if (_self._senderConfig.endpointUrl().lastIndexOf(hostingProtocol, 0) !== 0) {
7526
- _self.diagLog().throwInternal(LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
7790
+ _throwInternal(_self.diagLog(), LoggingSeverity.WARNING, _InternalMessageId.TransmissionFailed, ". " +
7527
7791
  "Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.");
7528
7792
  buffer.clear();
7529
7793
  return;
@@ -7554,7 +7818,7 @@ var Sender = /** @class */ (function (_super) {
7554
7818
  manager.eventsSendRequest(sendRequest, isAsync);
7555
7819
  }
7556
7820
  catch (e) {
7557
- _self.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.NotificationException, "send request notification failed: " + getExceptionName(e), { exception: dumpObj(e) });
7821
+ _throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _InternalMessageId.NotificationException, "send request notification failed: " + getExceptionName(e), { exception: dumpObj(e) });
7558
7822
  }
7559
7823
  }
7560
7824
  }
@@ -7567,6 +7831,25 @@ var Sender = /** @class */ (function (_super) {
7567
7831
  var regexp = new RegExp(UUID_Regex);
7568
7832
  return regexp.test(config.instrumentationKey);
7569
7833
  }
7834
+ function _initDefaults() {
7835
+ _self._sender = null;
7836
+ _self._buffer = null;
7837
+ _self._appId = null;
7838
+ _self._sample = null;
7839
+ _headers = {};
7840
+ _offlineListener = null;
7841
+ _consecutiveErrors = 0;
7842
+ _retryAt = null;
7843
+ _lastSend = null;
7844
+ _paused = false;
7845
+ _timeoutHandle = null;
7846
+ _serializer = null;
7847
+ _stamp_specific_redirects = 0;
7848
+ _syncFetchPayload = 0;
7849
+ _fallbackSender = null;
7850
+ _syncUnloadSender = null;
7851
+ _evtNamespace = null;
7852
+ }
7570
7853
  });
7571
7854
  return _this;
7572
7855
  }
@@ -7736,7 +8019,7 @@ var Device = /** @class */ (function () {
7736
8019
  return Device;
7737
8020
  }());
7738
8021
 
7739
- var Version = "2.8.0-beta.2203-04";
8022
+ var Version = "2.8.0-beta.2203-05";
7740
8023
  var Internal = /** @class */ (function () {
7741
8024
  function Internal(config) {
7742
8025
  this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + Version;
@@ -9159,7 +9442,7 @@ var Initialization = /** @class */ (function () {
9159
9442
  config.endpointUrl = ingest ? "".concat(ingest, "/v2/track") : config.endpointUrl;
9160
9443
  config.instrumentationKey = cs.instrumentationkey || config.instrumentationKey;
9161
9444
  }
9162
- _self.appInsights = new ApplicationInsights();
9445
+ _self.appInsights = new AnalyticsPlugin();
9163
9446
  _self.properties = new PropertiesPlugin$1();
9164
9447
  _self.dependencies = new AjaxMonitor();
9165
9448
  _self.core = new AppInsightsCore();
@@ -9459,4 +9742,4 @@ catch (e) {
9459
9742
 
9460
9743
  exports.ApplicationInsights = Initialization;
9461
9744
  exports.Telemetry = Telemetry;
9462
- //# sourceMappingURL=ai.2.8.0-beta.2203-04.cjs.js.map
9745
+ //# sourceMappingURL=ai.2.8.0-beta.2203-05.cjs.js.map