@microsoft/applicationinsights-web-basic 2.8.0-beta.2203-01 → 2.8.0-beta.2203-02

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.
@@ -782,6 +782,34 @@
782
782
  "endIndex": 2
783
783
  }
784
784
  },
785
+ {
786
+ "kind": "MethodSignature",
787
+ "canonicalReference": "@microsoft/applicationinsights-web-basic!IAppInsightsCore#evtNamespace:member(1)",
788
+ "docComment": "/**\n * Returns the unique event namespace that should be used when registering events\n */\n",
789
+ "excerptTokens": [
790
+ {
791
+ "kind": "Content",
792
+ "text": "evtNamespace(): "
793
+ },
794
+ {
795
+ "kind": "Content",
796
+ "text": "string"
797
+ },
798
+ {
799
+ "kind": "Content",
800
+ "text": ";"
801
+ }
802
+ ],
803
+ "isOptional": false,
804
+ "returnTypeTokenRange": {
805
+ "startIndex": 1,
806
+ "endIndex": 2
807
+ },
808
+ "releaseTag": "Public",
809
+ "overloadIndex": 1,
810
+ "parameters": [],
811
+ "name": "evtNamespace"
812
+ },
785
813
  {
786
814
  "kind": "MethodSignature",
787
815
  "canonicalReference": "@microsoft/applicationinsights-web-basic!IAppInsightsCore#getCookieMgr:member(1)",
@@ -49,6 +49,7 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
49
49
  addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
50
50
  // (undocumented)
51
51
  config: IConfiguration;
52
+ evtNamespace(): string;
52
53
  // Warning: (ae-forgotten-export) The symbol "ICookieMgr" needs to be exported by the entry point index.d.ts
53
54
  getCookieMgr(): ICookieMgr;
54
55
  getNotifyMgr(): INotificationManager;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft.ApplicationInsights, 2.8.0-beta.2203-01
2
+ * Microsoft.ApplicationInsights, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -101,6 +101,10 @@ declare namespace ApplicationInsights {
101
101
  */
102
102
  addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
103
103
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
104
+ /**
105
+ * Returns the unique event namespace that should be used
106
+ */
107
+ evtNamespace(): string;
104
108
  protected releaseQueue(): void;
105
109
  }
106
110
 
@@ -149,8 +153,26 @@ declare namespace ApplicationInsights {
149
153
  * Internal helper to allow setting of the internal initialized setting for inherited instances and unit testing
150
154
  */
151
155
  protected setInitialized: (isInitialized: boolean) => void;
156
+ /**
157
+ * Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
158
+ * finishes it's removal.
159
+ * @param unloadCtx - This is the context that should be used during unloading.
160
+ * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
161
+ * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.
162
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
163
+ */
164
+ protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
152
165
  constructor();
153
166
  initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
167
+ /**
168
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
169
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
170
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
171
+ * @param unloadCtx - This is the context that should be used during unloading.
172
+ * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
173
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
174
+ */
175
+ teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
154
176
  abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
155
177
  /**
156
178
  * Add this hook so that it is automatically removed during unloading
@@ -167,7 +189,15 @@ declare namespace ApplicationInsights {
167
189
  */
168
190
  const CoreUtils: ICoreUtils;
169
191
 
170
- enum DistributedTracingModes {
192
+ const DistributedTracingModes: {
193
+ AI: number;
194
+ AI_AND_W3C: number;
195
+ W3C: number;
196
+ };
197
+
198
+ type DistributedTracingModes = number | eDistributedTracingModes;
199
+
200
+ const enum eDistributedTracingModes {
171
201
  /**
172
202
  * (Default) Send Application Insights correlation headers
173
203
  */
@@ -182,6 +212,102 @@ declare namespace ApplicationInsights {
182
212
  W3C = 2
183
213
  }
184
214
 
215
+ const enum _eInternalMessageId {
216
+ BrowserDoesNotSupportLocalStorage = 0,
217
+ BrowserCannotReadLocalStorage = 1,
218
+ BrowserCannotReadSessionStorage = 2,
219
+ BrowserCannotWriteLocalStorage = 3,
220
+ BrowserCannotWriteSessionStorage = 4,
221
+ BrowserFailedRemovalFromLocalStorage = 5,
222
+ BrowserFailedRemovalFromSessionStorage = 6,
223
+ CannotSendEmptyTelemetry = 7,
224
+ ClientPerformanceMathError = 8,
225
+ ErrorParsingAISessionCookie = 9,
226
+ ErrorPVCalc = 10,
227
+ ExceptionWhileLoggingError = 11,
228
+ FailedAddingTelemetryToBuffer = 12,
229
+ FailedMonitorAjaxAbort = 13,
230
+ FailedMonitorAjaxDur = 14,
231
+ FailedMonitorAjaxOpen = 15,
232
+ FailedMonitorAjaxRSC = 16,
233
+ FailedMonitorAjaxSend = 17,
234
+ FailedMonitorAjaxGetCorrelationHeader = 18,
235
+ FailedToAddHandlerForOnBeforeUnload = 19,
236
+ FailedToSendQueuedTelemetry = 20,
237
+ FailedToReportDataLoss = 21,
238
+ FlushFailed = 22,
239
+ MessageLimitPerPVExceeded = 23,
240
+ MissingRequiredFieldSpecification = 24,
241
+ NavigationTimingNotSupported = 25,
242
+ OnError = 26,
243
+ SessionRenewalDateIsZero = 27,
244
+ SenderNotInitialized = 28,
245
+ StartTrackEventFailed = 29,
246
+ StopTrackEventFailed = 30,
247
+ StartTrackFailed = 31,
248
+ StopTrackFailed = 32,
249
+ TelemetrySampledAndNotSent = 33,
250
+ TrackEventFailed = 34,
251
+ TrackExceptionFailed = 35,
252
+ TrackMetricFailed = 36,
253
+ TrackPVFailed = 37,
254
+ TrackPVFailedCalc = 38,
255
+ TrackTraceFailed = 39,
256
+ TransmissionFailed = 40,
257
+ FailedToSetStorageBuffer = 41,
258
+ FailedToRestoreStorageBuffer = 42,
259
+ InvalidBackendResponse = 43,
260
+ FailedToFixDepricatedValues = 44,
261
+ InvalidDurationValue = 45,
262
+ TelemetryEnvelopeInvalid = 46,
263
+ CreateEnvelopeError = 47,
264
+ CannotSerializeObject = 48,
265
+ CannotSerializeObjectNonSerializable = 49,
266
+ CircularReferenceDetected = 50,
267
+ ClearAuthContextFailed = 51,
268
+ ExceptionTruncated = 52,
269
+ IllegalCharsInName = 53,
270
+ ItemNotInArray = 54,
271
+ MaxAjaxPerPVExceeded = 55,
272
+ MessageTruncated = 56,
273
+ NameTooLong = 57,
274
+ SampleRateOutOfRange = 58,
275
+ SetAuthContextFailed = 59,
276
+ SetAuthContextFailedAccountName = 60,
277
+ StringValueTooLong = 61,
278
+ StartCalledMoreThanOnce = 62,
279
+ StopCalledWithoutStart = 63,
280
+ TelemetryInitializerFailed = 64,
281
+ TrackArgumentsNotSpecified = 65,
282
+ UrlTooLong = 66,
283
+ SessionStorageBufferFull = 67,
284
+ CannotAccessCookie = 68,
285
+ IdTooLong = 69,
286
+ InvalidEvent = 70,
287
+ FailedMonitorAjaxSetRequestHeader = 71,
288
+ SendBrowserInfoOnUserInit = 72,
289
+ PluginException = 73,
290
+ NotificationException = 74,
291
+ SnippetScriptLoadFailure = 99,
292
+ InvalidInstrumentationKey = 100,
293
+ CannotParseAiBlobValue = 101,
294
+ InvalidContentBlob = 102,
295
+ TrackPageActionEventFailed = 103,
296
+ FailedAddingCustomDefinedRequestContext = 104,
297
+ InMemoryStorageBufferFull = 105
298
+ }
299
+
300
+ const enum eLoggingSeverity {
301
+ /**
302
+ * Error will be sent as internal telemetry
303
+ */
304
+ CRITICAL = 1,
305
+ /**
306
+ * Error will NOT be sent as internal telemetry, and will only be shown in browser console
307
+ */
308
+ WARNING = 2
309
+ }
310
+
185
311
  const enum GetExtCfgMergeType {
186
312
  None = 0,
187
313
  MergeDefaultOnly = 1,
@@ -240,6 +366,10 @@ declare namespace ApplicationInsights {
240
366
  * @param pluginIdentifier
241
367
  */
242
368
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
369
+ /**
370
+ * Returns the unique event namespace that should be used when registering events
371
+ */
372
+ evtNamespace(): string;
243
373
  }
244
374
 
245
375
  /**
@@ -323,6 +453,67 @@ declare namespace ApplicationInsights {
323
453
  readonly appId?: string;
324
454
  }
325
455
 
456
+ interface IBaseProcessingContext {
457
+ /**
458
+ * The current core instance for the request
459
+ */
460
+ core: () => IAppInsightsCore;
461
+ /**
462
+ * THe current diagnostic logger for the request
463
+ */
464
+ diagLog: () => IDiagnosticLogger;
465
+ /**
466
+ * Gets the current core config instance
467
+ */
468
+ getCfg: () => IConfiguration;
469
+ /**
470
+ * Gets the named extension config
471
+ */
472
+ getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
473
+ /**
474
+ * Gets the named config from either the named identifier extension or core config if neither exist then the
475
+ * default value is returned
476
+ * @param identifier The named extension identifier
477
+ * @param field The config field name
478
+ * @param defaultValue The default value to return if no defined config exists
479
+ */
480
+ getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
481
+ /**
482
+ * Helper to allow plugins to check and possibly shortcut executing code only
483
+ * required if there is a nextPlugin
484
+ */
485
+ hasNext: () => boolean;
486
+ /**
487
+ * Returns the next configured plugin proxy
488
+ */
489
+ getNext: () => ITelemetryPluginChain;
490
+ /**
491
+ * Helper to set the next plugin proxy
492
+ */
493
+ setNext: (nextCtx: ITelemetryPluginChain) => void;
494
+ /**
495
+ * Synchronously iterate over the context chain running the callback for each plugin, once
496
+ * every plugin has been executed via the callback, any associated onComplete will be called.
497
+ * @param callback - The function call for each plugin in the context chain
498
+ */
499
+ iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
500
+ /**
501
+ * Set the function to call when the current chain has executed all processNext or unloadNext items.
502
+ * @param onComplete - The onComplete to call
503
+ * @param that - The "this" value to use for the onComplete call, if not provided or undefined defaults to the current context
504
+ * @param args - Any additional arguments to pass to the onComplete function
505
+ */
506
+ onComplete: (onComplete: Function, that?: any, ...args: any[]) => void;
507
+ /**
508
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
509
+ * @param plugins - The execution order to process the plugins, if null or not supplied
510
+ * then the current execution order will be copied.
511
+ * @param startAt - The plugin to start processing from, if missing from the execution
512
+ * order then the next plugin will be NOT set.
513
+ */
514
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IBaseProcessingContext;
515
+ }
516
+
326
517
  /**
327
518
  * Provides data transmission capabilities
328
519
  */
@@ -336,9 +527,14 @@ declare namespace ApplicationInsights {
336
527
  */
337
528
  resume(): void;
338
529
  /**
339
- * Tear down transmission pipeline
530
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
531
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
532
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
533
+ * @param unloadCtx - This is the context that should be used during unloading.
534
+ * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
535
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
340
536
  */
341
- teardown(): void;
537
+ teardown: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
342
538
  /**
343
539
  * Flush to send data immediately; channel should default to sending data asynchronously
344
540
  * @param async - send data asynchronously when true
@@ -1022,7 +1218,7 @@ declare namespace ApplicationInsights {
1022
1218
  * @param callback {any} - The callback function that needs to be executed for the given event
1023
1219
  * @return {boolean} - true if the handler was successfully added
1024
1220
  */
1025
- addEventHandler: (eventName: string, callback: any) => boolean;
1221
+ addEventHandler: (eventName: string, callback: any, evtNamespace?: string | string[]) => boolean;
1026
1222
  /**
1027
1223
  * Return the current time via the Date now() function (if available) and falls back to (new Date()).getTime() if now() is unavailable (IE8 or less)
1028
1224
  * https://caniuse.com/#search=Date.now
@@ -1251,6 +1447,19 @@ declare namespace ApplicationInsights {
1251
1447
 
1252
1448
  interface ILoadedPlugin<T extends IPlugin> {
1253
1449
  plugin: T;
1450
+ /**
1451
+ * Identifies whether the plugin is enabled and can process events. This is slightly different from isInitialized as the plugin may be initialized but disabled
1452
+ * via the setEnabled() or it may be a shared plugin which has had it's teardown function called from another instance..
1453
+ * @returns boolean = true if the plugin is in a state where it is operational.
1454
+ */
1455
+ isEnabled: () => boolean;
1456
+ /**
1457
+ * You can optionally enable / disable a plugin from processing events.
1458
+ * Setting enabled to true will not necessarily cause the `isEnabled()` to also return true
1459
+ * as the plugin must also have been successfully initialized and not had it's `teardown` method called
1460
+ * (unless it's also been re-initialized)
1461
+ */
1462
+ setEnabled: (isEnabled: boolean) => void;
1254
1463
  }
1255
1464
 
1256
1465
  interface IMetricTelemetry extends IPartC {
@@ -1472,7 +1681,7 @@ declare namespace ApplicationInsights {
1472
1681
  InMemoryStorageBufferFull: number;
1473
1682
  };
1474
1683
 
1475
- type _InternalMessageId = number | typeof _InternalMessageId;
1684
+ type _InternalMessageId = number | _eInternalMessageId;
1476
1685
 
1477
1686
  interface IPageViewPerformanceTelemetry extends IPartC {
1478
1687
  /**
@@ -1687,10 +1896,14 @@ declare namespace ApplicationInsights {
1687
1896
  */
1688
1897
  isInitialized?: () => boolean;
1689
1898
  /**
1690
- * Tear down the plugin and remove any hooked value, the plugin should remove that it is no longer initialized and
1691
- * therefore can be re-initialized after being torn down.
1899
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
1900
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
1901
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
1902
+ * @param unloadCtx - This is the context that should be used during unloading.
1903
+ * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.
1904
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
1692
1905
  */
1693
- teardown?: () => void;
1906
+ teardown?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
1694
1907
  /**
1695
1908
  * Extension name
1696
1909
  */
@@ -1705,67 +1918,42 @@ declare namespace ApplicationInsights {
1705
1918
  * The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
1706
1919
  * between multiple AppInsights instances
1707
1920
  */
1708
- interface IProcessTelemetryContext {
1709
- /**
1710
- * The current core instance for the request
1711
- */
1712
- core: () => IAppInsightsCore;
1713
- /**
1714
- * THe current diagnostic logger for the request
1715
- */
1716
- diagLog: () => IDiagnosticLogger;
1717
- /**
1718
- * Gets the current core config instance
1719
- */
1720
- getCfg: () => IConfiguration;
1721
- /**
1722
- * Gets the named extension config
1723
- */
1724
- getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
1725
- /**
1726
- * Gets the named config from either the named identifier extension or core config if neither exist then the
1727
- * default value is returned
1728
- * @param identifier The named extension identifier
1729
- * @param field The config field name
1730
- * @param defaultValue The default value to return if no defined config exists
1731
- */
1732
- getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
1733
- /**
1734
- * Helper to allow plugins to check and possibly shortcut executing code only
1735
- * required if there is a nextPlugin
1736
- */
1737
- hasNext: () => boolean;
1738
- /**
1739
- * Returns the next configured plugin proxy
1740
- */
1741
- getNext: () => ITelemetryPluginChain;
1742
- /**
1743
- * Helper to set the next plugin proxy
1744
- */
1745
- setNext: (nextCtx: ITelemetryPluginChain) => void;
1921
+ interface IProcessTelemetryContext extends IBaseProcessingContext {
1746
1922
  /**
1747
1923
  * Call back for telemetry processing before it it is sent
1748
1924
  * @param env - This is the current event being reported
1925
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
1749
1926
  */
1750
- processNext: (env: ITelemetryItem) => void;
1927
+ processNext: (env: ITelemetryItem) => boolean | void;
1751
1928
  /**
1752
- * Synchronously iterate over the context chain running the callback for each plugin, once
1753
- * every plugin has been executed via the callback, any associated onComplete will be called.
1754
- * @param callback - The function call for each plugin in the context chain
1755
- */
1756
- iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
1757
- /**
1758
- * Create a new context using the core and config from the current instance
1929
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
1759
1930
  * @param plugins - The execution order to process the plugins, if null or not supplied
1760
1931
  * then the current execution order will be copied.
1761
1932
  * @param startAt - The plugin to start processing from, if missing from the execution
1762
1933
  * order then the next plugin will be NOT set.
1763
1934
  */
1764
1935
  createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
1936
+ }
1937
+
1938
+ /**
1939
+ * The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
1940
+ * between multiple AppInsights instances
1941
+ */
1942
+ interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
1765
1943
  /**
1766
- * Set the function to call when the current chain has executed all processNext or unloadNext items.
1944
+ * This Plugin has finished unloading, so unload the next one
1945
+ * @param uploadState - The state of the unload process
1946
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
1767
1947
  */
1768
- onComplete: (onComplete: () => void) => void;
1948
+ processNext: (unloadState: ITelemetryUnloadState) => boolean | void;
1949
+ /**
1950
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
1951
+ * @param plugins - The execution order to process the plugins, if null or not supplied
1952
+ * then the current execution order will be copied.
1953
+ * @param startAt - The plugin to start processing from, if missing from the execution
1954
+ * order then the next plugin will be NOT set.
1955
+ */
1956
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
1769
1957
  }
1770
1958
 
1771
1959
  interface IRequestContext {
@@ -1960,15 +2148,7 @@ declare namespace ApplicationInsights {
1960
2148
  /**
1961
2149
  * Configuration provided to SDK core
1962
2150
  */
1963
- interface ITelemetryPlugin extends IPlugin {
1964
- /**
1965
- * Call back for telemetry processing before it it is sent
1966
- * @param env - This is the current event being reported
1967
- * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
1968
- * can optionally use this to access the current core instance or define / pass additional information
1969
- * to later plugins (vs appending items to the telemetry item)
1970
- */
1971
- processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
2151
+ interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
1972
2152
  /**
1973
2153
  * Set next extension for telemetry processing, this is not optional as plugins should use the
1974
2154
  * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
@@ -1984,7 +2164,7 @@ declare namespace ApplicationInsights {
1984
2164
  /**
1985
2165
  * Configuration provided to SDK core
1986
2166
  */
1987
- interface ITelemetryPluginChain {
2167
+ interface ITelemetryPluginChain extends ITelemetryProcessor {
1988
2168
  /**
1989
2169
  * Returns the underlying plugin that is being proxied for the processTelemetry call
1990
2170
  */
@@ -1993,6 +2173,16 @@ declare namespace ApplicationInsights {
1993
2173
  * Returns the next plugin
1994
2174
  */
1995
2175
  getNext: () => ITelemetryPluginChain;
2176
+ /**
2177
+ * This plugin is being unloaded and should remove any hooked events and cleanup any global/scoped values, after this
2178
+ * call the plugin will be removed from the telemetry processing chain and will no longer receive any events..
2179
+ * @param unloadCtx - The unload context to use for this call.
2180
+ * @param unloadState - The details of the unload operation
2181
+ */
2182
+ unload?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2183
+ }
2184
+
2185
+ interface ITelemetryProcessor {
1996
2186
  /**
1997
2187
  * Call back for telemetry processing before it it is sent
1998
2188
  * @param env - This is the current event being reported
@@ -2000,7 +2190,13 @@ declare namespace ApplicationInsights {
2000
2190
  * can optionally use this to access the current core instance or define / pass additional information
2001
2191
  * to later plugins (vs appending items to the telemetry item)
2002
2192
  */
2003
- processTelemetry: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
2193
+ processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
2194
+ }
2195
+
2196
+ interface ITelemetryUnloadState {
2197
+ reason: TelemetryUnloadReason;
2198
+ isAsync: boolean;
2199
+ flushComplete?: boolean;
2004
2200
  }
2005
2201
 
2006
2202
  interface ITraceTelemetry extends IPartC {
@@ -2024,16 +2220,12 @@ declare namespace ApplicationInsights {
2024
2220
  iKey?: string;
2025
2221
  }
2026
2222
 
2027
- enum LoggingSeverity {
2028
- /**
2029
- * Error will be sent as internal telemetry
2030
- */
2031
- CRITICAL = 1,
2032
- /**
2033
- * Error will NOT be sent as internal telemetry, and will only be shown in browser console
2034
- */
2035
- WARNING = 2
2036
- }
2223
+ const LoggingSeverity: {
2224
+ CRITICAL: number;
2225
+ WARNING: number;
2226
+ };
2227
+
2228
+ type LoggingSeverity = number | eLoggingSeverity;
2037
2229
 
2038
2230
  class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
2039
2231
  static constructEnvelope(orig: ITelemetryItem, iKey: string, logger: IDiagnosticLogger, convertUndefined?: any): IEnvelope;
@@ -2177,6 +2369,16 @@ declare namespace ApplicationInsights {
2177
2369
 
2178
2370
  type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
2179
2371
 
2372
+ /**
2373
+ * The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
2374
+ */
2375
+ const enum TelemetryUnloadReason {
2376
+ /**
2377
+ * Teardown has been called without any context.
2378
+ */
2379
+ ManualTeardown = 0
2380
+ }
2381
+
2180
2382
  interface XDomainRequest extends XMLHttpRequestEventTarget {
2181
2383
  readonly responseText: string;
2182
2384
  send(payload: string): void;