@microsoft/applicationinsights-core-js 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.
Files changed (122) hide show
  1. package/browser/applicationinsights-core-js.integrity.json +9 -9
  2. package/browser/applicationinsights-core-js.js +945 -479
  3. package/browser/applicationinsights-core-js.js.map +1 -1
  4. package/browser/applicationinsights-core-js.min.js +2 -2
  5. package/browser/applicationinsights-core-js.min.js.map +1 -1
  6. package/dist/applicationinsights-core-js.api.json +3904 -877
  7. package/dist/applicationinsights-core-js.api.md +264 -30
  8. package/dist/applicationinsights-core-js.d.ts +410 -89
  9. package/dist/applicationinsights-core-js.js +945 -479
  10. package/dist/applicationinsights-core-js.js.map +1 -1
  11. package/dist/applicationinsights-core-js.min.js +2 -2
  12. package/dist/applicationinsights-core-js.min.js.map +1 -1
  13. package/dist/applicationinsights-core-js.rollup.d.ts +410 -89
  14. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
  15. package/dist-esm/JavaScriptSDK/BaseCore.js +66 -23
  16. package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
  17. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +44 -5
  18. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
  19. package/dist-esm/JavaScriptSDK/ChannelController.js +105 -73
  20. package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
  21. package/dist-esm/JavaScriptSDK/Constants.js +1 -1
  22. package/dist-esm/JavaScriptSDK/CookieMgr.js +3 -4
  23. package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
  24. package/dist-esm/JavaScriptSDK/CoreUtils.js +6 -122
  25. package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
  26. package/dist-esm/JavaScriptSDK/DataCacheHelper.js +93 -0
  27. package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -0
  28. package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  29. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +12 -12
  30. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
  31. package/dist-esm/JavaScriptSDK/EnvUtils.js +8 -7
  32. package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
  33. package/dist-esm/JavaScriptSDK/EventHelpers.js +472 -0
  34. package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -0
  35. package/dist-esm/JavaScriptSDK/HelperFuncs.js +32 -59
  36. package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
  37. package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -1
  38. package/dist-esm/JavaScriptSDK/InternalConstants.js +28 -0
  39. package/dist-esm/JavaScriptSDK/InternalConstants.js.map +1 -0
  40. package/dist-esm/JavaScriptSDK/NotificationManager.js +8 -11
  41. package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
  42. package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
  43. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +184 -110
  44. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
  45. package/dist-esm/JavaScriptSDK/RandomHelper.js +3 -2
  46. package/dist-esm/JavaScriptSDK/RandomHelper.js.map +1 -1
  47. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +32 -13
  48. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
  49. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +4 -6
  50. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -1
  51. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
  52. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +90 -96
  53. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
  54. package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  55. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +8 -0
  56. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js.map +1 -0
  57. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
  58. package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  59. package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
  60. package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
  61. package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
  62. package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
  63. package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
  64. package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
  65. package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
  66. package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
  67. package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
  68. package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
  69. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
  70. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  71. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  72. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -2
  73. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js.map +1 -1
  74. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +8 -0
  75. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js.map +1 -0
  76. package/dist-esm/applicationinsights-core-js.js +8 -4
  77. package/dist-esm/applicationinsights-core-js.js.map +1 -1
  78. package/package.json +1 -1
  79. package/src/JavaScriptSDK/BaseCore.ts +80 -24
  80. package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +76 -5
  81. package/src/JavaScriptSDK/ChannelController.ts +107 -61
  82. package/src/JavaScriptSDK/CookieMgr.ts +4 -4
  83. package/src/JavaScriptSDK/CoreUtils.ts +6 -143
  84. package/src/JavaScriptSDK/DataCacheHelper.ts +106 -0
  85. package/src/JavaScriptSDK/DiagnosticLogger.ts +12 -11
  86. package/src/JavaScriptSDK/EnvUtils.ts +7 -6
  87. package/src/JavaScriptSDK/EventHelpers.ts +542 -0
  88. package/src/JavaScriptSDK/HelperFuncs.ts +35 -54
  89. package/src/JavaScriptSDK/InternalConstants.ts +26 -0
  90. package/src/JavaScriptSDK/NotificationManager.ts +7 -11
  91. package/src/JavaScriptSDK/ProcessTelemetryContext.ts +237 -124
  92. package/src/JavaScriptSDK/RandomHelper.ts +2 -1
  93. package/src/JavaScriptSDK/TelemetryHelpers.ts +47 -15
  94. package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +5 -15
  95. package/src/JavaScriptSDK.Enums/LoggingEnums.ts +184 -87
  96. package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +27 -0
  97. package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +20 -0
  98. package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +9 -2
  99. package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +55 -16
  100. package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +16 -9
  101. package/src/JavaScriptSDK.Interfaces/ITelemetryPluginChain.ts +9 -11
  102. package/src/JavaScriptSDK.Interfaces/ITelemetryUnloadState.ts +10 -0
  103. package/types/JavaScriptSDK/BaseCore.d.ts +4 -0
  104. package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +20 -1
  105. package/types/JavaScriptSDK/ChannelController.d.ts +4 -0
  106. package/types/JavaScriptSDK/CoreUtils.d.ts +1 -42
  107. package/types/JavaScriptSDK/DataCacheHelper.d.ts +13 -0
  108. package/types/JavaScriptSDK/EventHelpers.d.ts +152 -0
  109. package/types/JavaScriptSDK/HelperFuncs.d.ts +8 -17
  110. package/types/JavaScriptSDK/InternalConstants.d.ts +20 -0
  111. package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +10 -3
  112. package/types/JavaScriptSDK/TelemetryHelpers.d.ts +8 -0
  113. package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +0 -7
  114. package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +91 -2
  115. package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +9 -0
  116. package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +17 -0
  117. package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +9 -2
  118. package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +49 -14
  119. package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +15 -8
  120. package/types/JavaScriptSDK.Interfaces/ITelemetryPluginChain.d.ts +9 -10
  121. package/types/JavaScriptSDK.Interfaces/ITelemetryUnloadState.d.ts +6 -0
  122. package/types/applicationinsights-core-js.d.ts +6 -3
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-01
2
+ * Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -20,39 +20,59 @@ import { strShimObject as strObject } from '@microsoft/applicationinsights-shims
20
20
  import { strShimPrototype as strPrototype } from '@microsoft/applicationinsights-shims';
21
21
  import { strShimUndefined as strUndefined } from '@microsoft/applicationinsights-shims';
22
22
 
23
+ /**
24
+ * Get all of the registered events on the target object, this is primarily used for testing cleanup but may also be used by
25
+ * applications to remove their own events
26
+ * @param target - The EventTarget that has registered events
27
+ * @param evtName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)
28
+ */
29
+ export declare function __getRegisteredEvents(target: any, evtName?: string): _IRegisteredEvents[];
30
+
23
31
  /**
24
32
  * Trys to add an event handler for the specified event to the window, body and document
25
33
  * @param eventName {string} - The name of the event
26
34
  * @param callback {any} - The callback function that needs to be executed for the given event
35
+ * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
27
36
  * @return {boolean} - true if the handler was successfully added
28
37
  */
29
- export declare function addEventHandler(eventName: string, callback: any): boolean;
38
+ export declare function addEventHandler(eventName: string, callback: any, evtNamespace?: string | string[]): boolean;
30
39
 
31
40
  /**
32
41
  * Bind the listener to the array of events
33
42
  * @param events An string array of event names to bind the listener to
34
43
  * @param listener The event callback to call when the event is triggered
35
44
  * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
45
+ * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
36
46
  * @returns true - when at least one of the events was registered otherwise false
37
47
  */
38
- export declare function addEventListeners(events: string[], listener: any, excludeEvents?: string[]): boolean;
48
+ export declare function addEventListeners(events: string[], listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
39
49
 
40
50
  /**
41
- * Listen to the pagehide and visibility changing to 'hidden' events
51
+ * Listen to the pagehide and visibility changing to 'hidden' events, because the 'visibilitychange' uses
52
+ * an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
53
+ * removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
42
54
  * @param listener - The event callback to call when a page hide event is triggered
43
55
  * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
56
+ * @param evtNamespace - [Optional] A Namespace to append to the event listeners so they can be uniquely identified and removed
57
+ * based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
58
+ * so that only the matching "removePageHideEventListener" can remove these events.
44
59
  * Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide
45
60
  * @returns true - when at least one of the events was registered otherwise false
46
61
  */
47
- export declare function addPageHideEventListener(listener: any, excludeEvents?: string[]): boolean;
62
+ export declare function addPageHideEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
48
63
 
49
64
  /**
50
- * Listen to the pageshow and visibility changing to 'visible' events
65
+ * Listen to the pageshow and visibility changing to 'visible' events, because the 'visibilitychange' uses
66
+ * an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call
67
+ * removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.
51
68
  * @param listener - The event callback to call when a page is show event is triggered
52
69
  * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
70
+ * @param evtNamespace - [Optional/Recommended] A Namespace to append to the event listeners so they can be uniquely
71
+ * identified and removed based on this namespace. This call also adds an additional unique "pageshow" namespace to the events
72
+ * so that only the matching "removePageShowEventListener" can remove these events.
53
73
  * @returns true - when at least one of the events was registered otherwise false
54
74
  */
55
- export declare function addPageShowEventListener(listener: any, excludeEvents?: string[]): boolean;
75
+ export declare function addPageShowEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
56
76
 
57
77
  /**
58
78
  * Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,
@@ -62,9 +82,10 @@ export declare function addPageShowEventListener(listener: any, excludeEvents?:
62
82
  * need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.
63
83
  * @param listener - The event callback to call when a page unload event is triggered
64
84
  * @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.
85
+ * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
65
86
  * @returns true - when at least one of the events was registered otherwise false
66
87
  */
67
- export declare function addPageUnloadEventListener(listener: any, excludeEvents?: string[]): boolean;
88
+ export declare function addPageUnloadEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
68
89
 
69
90
  export declare class AppInsightsCore extends BaseCore implements IAppInsightsCore {
70
91
  constructor();
@@ -117,7 +138,7 @@ export declare function arrReduce<T, R>(arr: T[], callbackfn: (previousValue: T
117
138
  /**
118
139
  * Binds the specified function to an event, so that the function gets called whenever the event fires on the object
119
140
  * @param obj Object to add the event too.
120
- * @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix
141
+ * @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix and optional (dot "." prefixed) namespaces "click" "click.mynamespace".
121
142
  * @param handlerRef Pointer that specifies the function to call when event fires
122
143
  * @param useCapture [Optional] Defaults to false
123
144
  * @returns True if the function was bound successfully to the event, otherwise false
@@ -175,6 +196,10 @@ export declare class BaseCore implements IAppInsightsCore {
175
196
  */
176
197
  addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
177
198
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
199
+ /**
200
+ * Returns the unique event namespace that should be used
201
+ */
202
+ evtNamespace(): string;
178
203
  protected releaseQueue(): void;
179
204
  }
180
205
 
@@ -223,8 +248,26 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
223
248
  * Internal helper to allow setting of the internal initialized setting for inherited instances and unit testing
224
249
  */
225
250
  protected setInitialized: (isInitialized: boolean) => void;
251
+ /**
252
+ * Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
253
+ * finishes it's removal.
254
+ * @param unloadCtx - This is the context that should be used during unloading.
255
+ * @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.
256
+ * @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.
257
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
258
+ */
259
+ protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
226
260
  constructor();
227
261
  initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
262
+ /**
263
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
264
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
265
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
266
+ * @param unloadCtx - This is the context that should be used during unloading.
267
+ * @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.
268
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
269
+ */
270
+ teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
228
271
  abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
229
272
  /**
230
273
  * Add this hook so that it is automatically removed during unloading
@@ -256,6 +299,13 @@ export declare function createClassFromInterface<T>(defaults?: T): new () => T;
256
299
 
257
300
  export declare function createCookieMgr(rootConfig?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
258
301
 
302
+ /**
303
+ * Create an enum style object which has both the key => value and value => key mappings
304
+ * @param values - The values to populate on the new object
305
+ * @returns
306
+ */
307
+ export declare function createEnumStyle<T>(values: T): T;
308
+
259
309
  /**
260
310
  * Creates a new Telemetry Item context with the current config, core and plugin execution chain
261
311
  * @param plugins - The plugin instances that will be executed
@@ -264,6 +314,8 @@ export declare function createCookieMgr(rootConfig?: IConfiguration, logger?: ID
264
314
  */
265
315
  export declare function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
266
316
 
317
+ export declare function createUniqueNamespace(name: string, includeVersion?: boolean): string;
318
+
267
319
  /**
268
320
  * 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)
269
321
  * https://caniuse.com/#search=Date.now
@@ -280,8 +332,11 @@ export declare function deleteCookie(logger: IDiagnosticLogger, name: string): b
280
332
  /**
281
333
  * Removes an event handler for the specified event
282
334
  * @param Object to remove the event from
283
- * @param eventNameWithoutOn {string} - The name of the event
284
- * @param handlerRef {any} - The callback function that needs to be executed for the given event
335
+ * @param eventNameWithoutOn {string} - The name of the event, with optional namespaces or just the namespaces,
336
+ * such as "click", "click.mynamespace" or ".mynamespace"
337
+ * @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
338
+ * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
339
+ * otherwise this will only remove events with this specific handler.
285
340
  * @param useCapture [Optional] Defaults to false
286
341
  */
287
342
  export declare function detachEvent(obj: any, eventNameWithoutOn: string, handlerRef: any, useCapture?: boolean): void;
@@ -362,8 +417,131 @@ export declare function doPerf<T>(mgrSource: IPerfManagerProvider | IPerfManager
362
417
  */
363
418
  export declare function dumpObj(object: any): string;
364
419
 
420
+ export declare const enum _eInternalMessageId {
421
+ BrowserDoesNotSupportLocalStorage = 0,
422
+ BrowserCannotReadLocalStorage = 1,
423
+ BrowserCannotReadSessionStorage = 2,
424
+ BrowserCannotWriteLocalStorage = 3,
425
+ BrowserCannotWriteSessionStorage = 4,
426
+ BrowserFailedRemovalFromLocalStorage = 5,
427
+ BrowserFailedRemovalFromSessionStorage = 6,
428
+ CannotSendEmptyTelemetry = 7,
429
+ ClientPerformanceMathError = 8,
430
+ ErrorParsingAISessionCookie = 9,
431
+ ErrorPVCalc = 10,
432
+ ExceptionWhileLoggingError = 11,
433
+ FailedAddingTelemetryToBuffer = 12,
434
+ FailedMonitorAjaxAbort = 13,
435
+ FailedMonitorAjaxDur = 14,
436
+ FailedMonitorAjaxOpen = 15,
437
+ FailedMonitorAjaxRSC = 16,
438
+ FailedMonitorAjaxSend = 17,
439
+ FailedMonitorAjaxGetCorrelationHeader = 18,
440
+ FailedToAddHandlerForOnBeforeUnload = 19,
441
+ FailedToSendQueuedTelemetry = 20,
442
+ FailedToReportDataLoss = 21,
443
+ FlushFailed = 22,
444
+ MessageLimitPerPVExceeded = 23,
445
+ MissingRequiredFieldSpecification = 24,
446
+ NavigationTimingNotSupported = 25,
447
+ OnError = 26,
448
+ SessionRenewalDateIsZero = 27,
449
+ SenderNotInitialized = 28,
450
+ StartTrackEventFailed = 29,
451
+ StopTrackEventFailed = 30,
452
+ StartTrackFailed = 31,
453
+ StopTrackFailed = 32,
454
+ TelemetrySampledAndNotSent = 33,
455
+ TrackEventFailed = 34,
456
+ TrackExceptionFailed = 35,
457
+ TrackMetricFailed = 36,
458
+ TrackPVFailed = 37,
459
+ TrackPVFailedCalc = 38,
460
+ TrackTraceFailed = 39,
461
+ TransmissionFailed = 40,
462
+ FailedToSetStorageBuffer = 41,
463
+ FailedToRestoreStorageBuffer = 42,
464
+ InvalidBackendResponse = 43,
465
+ FailedToFixDepricatedValues = 44,
466
+ InvalidDurationValue = 45,
467
+ TelemetryEnvelopeInvalid = 46,
468
+ CreateEnvelopeError = 47,
469
+ CannotSerializeObject = 48,
470
+ CannotSerializeObjectNonSerializable = 49,
471
+ CircularReferenceDetected = 50,
472
+ ClearAuthContextFailed = 51,
473
+ ExceptionTruncated = 52,
474
+ IllegalCharsInName = 53,
475
+ ItemNotInArray = 54,
476
+ MaxAjaxPerPVExceeded = 55,
477
+ MessageTruncated = 56,
478
+ NameTooLong = 57,
479
+ SampleRateOutOfRange = 58,
480
+ SetAuthContextFailed = 59,
481
+ SetAuthContextFailedAccountName = 60,
482
+ StringValueTooLong = 61,
483
+ StartCalledMoreThanOnce = 62,
484
+ StopCalledWithoutStart = 63,
485
+ TelemetryInitializerFailed = 64,
486
+ TrackArgumentsNotSpecified = 65,
487
+ UrlTooLong = 66,
488
+ SessionStorageBufferFull = 67,
489
+ CannotAccessCookie = 68,
490
+ IdTooLong = 69,
491
+ InvalidEvent = 70,
492
+ FailedMonitorAjaxSetRequestHeader = 71,
493
+ SendBrowserInfoOnUserInit = 72,
494
+ PluginException = 73,
495
+ NotificationException = 74,
496
+ SnippetScriptLoadFailure = 99,
497
+ InvalidInstrumentationKey = 100,
498
+ CannotParseAiBlobValue = 101,
499
+ InvalidContentBlob = 102,
500
+ TrackPageActionEventFailed = 103,
501
+ FailedAddingCustomDefinedRequestContext = 104,
502
+ InMemoryStorageBufferFull = 105
503
+ }
504
+
505
+ export declare const enum eLoggingSeverity {
506
+ /**
507
+ * Error will be sent as internal telemetry
508
+ */
509
+ CRITICAL = 1,
510
+ /**
511
+ * Error will NOT be sent as internal telemetry, and will only be shown in browser console
512
+ */
513
+ WARNING = 2
514
+ }
515
+
365
516
  export declare const EventHelper: IEventHelper;
366
517
 
518
+ /**
519
+ * Removes an event handler for the specified event
520
+ * @param Object to remove the event from
521
+ * @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
522
+ * such as "click", "click.mynamespace" or ".mynamespace"
523
+ * @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a
524
+ * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
525
+ * otherwise this will only remove events with this specific handler.
526
+ * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
527
+ * if the eventName also includes a namespace the namespace(s) are merged into a single namespace
528
+ * @param useCapture [Optional] Defaults to false
529
+ */
530
+ export declare function eventOff<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[], useCapture?: boolean): void;
531
+
532
+ /**
533
+ * Binds the specified function to an event, so that the function gets called whenever the event fires on the object
534
+ * @param obj Object to add the event too.
535
+ * @param eventName String that specifies any of the standard DHTML Events without "on" prefix, if may also include an optional (dot "." prefixed)
536
+ * namespaces "click" "click.mynamespace" in addition to specific namespaces.
537
+ * @param handlerRef Pointer that specifies the function to call when event fires
538
+ * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,
539
+ * if the eventName also includes a namespace the namespace(s) are merged into a single namespace
540
+ * @param useCapture [Optional] Defaults to false
541
+ * @returns True if the function was bound successfully to the event, otherwise false
542
+ */
543
+ export declare function eventOn<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[], useCapture?: boolean): boolean;
544
+
367
545
  /**
368
546
  * The EventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.
369
547
  */
@@ -614,6 +792,71 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
614
792
  * @param pluginIdentifier
615
793
  */
616
794
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
795
+ /**
796
+ * Returns the unique event namespace that should be used when registering events
797
+ */
798
+ evtNamespace(): string;
799
+ }
800
+
801
+ declare interface IBaseProcessingContext {
802
+ /**
803
+ * The current core instance for the request
804
+ */
805
+ core: () => IAppInsightsCore;
806
+ /**
807
+ * THe current diagnostic logger for the request
808
+ */
809
+ diagLog: () => IDiagnosticLogger;
810
+ /**
811
+ * Gets the current core config instance
812
+ */
813
+ getCfg: () => IConfiguration;
814
+ /**
815
+ * Gets the named extension config
816
+ */
817
+ getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
818
+ /**
819
+ * Gets the named config from either the named identifier extension or core config if neither exist then the
820
+ * default value is returned
821
+ * @param identifier The named extension identifier
822
+ * @param field The config field name
823
+ * @param defaultValue The default value to return if no defined config exists
824
+ */
825
+ getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
826
+ /**
827
+ * Helper to allow plugins to check and possibly shortcut executing code only
828
+ * required if there is a nextPlugin
829
+ */
830
+ hasNext: () => boolean;
831
+ /**
832
+ * Returns the next configured plugin proxy
833
+ */
834
+ getNext: () => ITelemetryPluginChain;
835
+ /**
836
+ * Helper to set the next plugin proxy
837
+ */
838
+ setNext: (nextCtx: ITelemetryPluginChain) => void;
839
+ /**
840
+ * Synchronously iterate over the context chain running the callback for each plugin, once
841
+ * every plugin has been executed via the callback, any associated onComplete will be called.
842
+ * @param callback - The function call for each plugin in the context chain
843
+ */
844
+ iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
845
+ /**
846
+ * Set the function to call when the current chain has executed all processNext or unloadNext items.
847
+ * @param onComplete - The onComplete to call
848
+ * @param that - The "this" value to use for the onComplete call, if not provided or undefined defaults to the current context
849
+ * @param args - Any additional arguments to pass to the onComplete function
850
+ */
851
+ onComplete: (onComplete: Function, that?: any, ...args: any[]) => void;
852
+ /**
853
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
854
+ * @param plugins - The execution order to process the plugins, if null or not supplied
855
+ * then the current execution order will be copied.
856
+ * @param startAt - The plugin to start processing from, if missing from the execution
857
+ * order then the next plugin will be NOT set.
858
+ */
859
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IBaseProcessingContext;
617
860
  }
618
861
 
619
862
  /**
@@ -629,9 +872,14 @@ export declare interface IChannelControls extends ITelemetryPlugin {
629
872
  */
630
873
  resume(): void;
631
874
  /**
632
- * Tear down transmission pipeline
875
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
876
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
877
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
878
+ * @param unloadCtx - This is the context that should be used during unloading.
879
+ * @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.
880
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
633
881
  */
634
- teardown(): void;
882
+ teardown: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
635
883
  /**
636
884
  * Flush to send data immediately; channel should default to sending data asynchronously
637
885
  * @param async - send data asynchronously when true
@@ -1000,7 +1248,7 @@ export declare interface ICoreUtils {
1000
1248
  * @param callback {any} - The callback function that needs to be executed for the given event
1001
1249
  * @return {boolean} - true if the handler was successfully added
1002
1250
  */
1003
- addEventHandler: (eventName: string, callback: any) => boolean;
1251
+ addEventHandler: (eventName: string, callback: any, evtNamespace?: string | string[]) => boolean;
1004
1252
  /**
1005
1253
  * 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)
1006
1254
  * https://caniuse.com/#search=Date.now
@@ -1236,6 +1484,19 @@ export declare interface IInstrumentHooksCallbacks {
1236
1484
 
1237
1485
  declare interface ILoadedPlugin<T extends IPlugin> {
1238
1486
  plugin: T;
1487
+ /**
1488
+ * Identifies whether the plugin is enabled and can process events. This is slightly different from isInitialized as the plugin may be initialized but disabled
1489
+ * via the setEnabled() or it may be a shared plugin which has had it's teardown function called from another instance..
1490
+ * @returns boolean = true if the plugin is in a state where it is operational.
1491
+ */
1492
+ isEnabled: () => boolean;
1493
+ /**
1494
+ * You can optionally enable / disable a plugin from processing events.
1495
+ * Setting enabled to true will not necessarily cause the `isEnabled()` to also return true
1496
+ * as the plugin must also have been successfully initialized and not had it's `teardown` method called
1497
+ * (unless it's also been re-initialized)
1498
+ */
1499
+ setEnabled: (isEnabled: boolean) => void;
1239
1500
  }
1240
1501
 
1241
1502
  /**
@@ -1454,7 +1715,7 @@ export declare const _InternalMessageId: {
1454
1715
  InMemoryStorageBufferFull: number;
1455
1716
  };
1456
1717
 
1457
- export declare type _InternalMessageId = number | typeof _InternalMessageId;
1718
+ export declare type _InternalMessageId = number | _eInternalMessageId;
1458
1719
 
1459
1720
  /**
1460
1721
  * This interface identifies the details of an internal performance event - it does not represent an outgoing reported event
@@ -1575,10 +1836,14 @@ export declare interface IPlugin {
1575
1836
  */
1576
1837
  isInitialized?: () => boolean;
1577
1838
  /**
1578
- * Tear down the plugin and remove any hooked value, the plugin should remove that it is no longer initialized and
1579
- * therefore can be re-initialized after being torn down.
1839
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
1840
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
1841
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
1842
+ * @param unloadCtx - This is the context that should be used during unloading.
1843
+ * @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.
1844
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
1580
1845
  */
1581
- teardown?: () => void;
1846
+ teardown?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
1582
1847
  /**
1583
1848
  * Extension name
1584
1849
  */
@@ -1593,67 +1858,47 @@ export declare interface IPlugin {
1593
1858
  * The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
1594
1859
  * between multiple AppInsights instances
1595
1860
  */
1596
- export declare interface IProcessTelemetryContext {
1597
- /**
1598
- * The current core instance for the request
1599
- */
1600
- core: () => IAppInsightsCore;
1601
- /**
1602
- * THe current diagnostic logger for the request
1603
- */
1604
- diagLog: () => IDiagnosticLogger;
1605
- /**
1606
- * Gets the current core config instance
1607
- */
1608
- getCfg: () => IConfiguration;
1609
- /**
1610
- * Gets the named extension config
1611
- */
1612
- getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
1613
- /**
1614
- * Gets the named config from either the named identifier extension or core config if neither exist then the
1615
- * default value is returned
1616
- * @param identifier The named extension identifier
1617
- * @param field The config field name
1618
- * @param defaultValue The default value to return if no defined config exists
1619
- */
1620
- getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
1621
- /**
1622
- * Helper to allow plugins to check and possibly shortcut executing code only
1623
- * required if there is a nextPlugin
1624
- */
1625
- hasNext: () => boolean;
1626
- /**
1627
- * Returns the next configured plugin proxy
1628
- */
1629
- getNext: () => ITelemetryPluginChain;
1630
- /**
1631
- * Helper to set the next plugin proxy
1632
- */
1633
- setNext: (nextCtx: ITelemetryPluginChain) => void;
1861
+ export declare interface IProcessTelemetryContext extends IBaseProcessingContext {
1634
1862
  /**
1635
1863
  * Call back for telemetry processing before it it is sent
1636
1864
  * @param env - This is the current event being reported
1865
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
1637
1866
  */
1638
- processNext: (env: ITelemetryItem) => void;
1867
+ processNext: (env: ITelemetryItem) => boolean | void;
1639
1868
  /**
1640
- * Synchronously iterate over the context chain running the callback for each plugin, once
1641
- * every plugin has been executed via the callback, any associated onComplete will be called.
1642
- * @param callback - The function call for each plugin in the context chain
1643
- */
1644
- iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
1645
- /**
1646
- * Create a new context using the core and config from the current instance
1869
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
1647
1870
  * @param plugins - The execution order to process the plugins, if null or not supplied
1648
1871
  * then the current execution order will be copied.
1649
1872
  * @param startAt - The plugin to start processing from, if missing from the execution
1650
1873
  * order then the next plugin will be NOT set.
1651
1874
  */
1652
1875
  createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
1876
+ }
1877
+
1878
+ /**
1879
+ * The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
1880
+ * between multiple AppInsights instances
1881
+ */
1882
+ declare interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
1653
1883
  /**
1654
- * Set the function to call when the current chain has executed all processNext or unloadNext items.
1884
+ * This Plugin has finished unloading, so unload the next one
1885
+ * @param uploadState - The state of the unload process
1886
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
1655
1887
  */
1656
- onComplete: (onComplete: () => void) => void;
1888
+ processNext: (unloadState: ITelemetryUnloadState) => boolean | void;
1889
+ /**
1890
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
1891
+ * @param plugins - The execution order to process the plugins, if null or not supplied
1892
+ * then the current execution order will be copied.
1893
+ * @param startAt - The plugin to start processing from, if missing from the execution
1894
+ * order then the next plugin will be NOT set.
1895
+ */
1896
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
1897
+ }
1898
+
1899
+ export declare interface _IRegisteredEvents {
1900
+ name: string;
1901
+ handler: any;
1657
1902
  }
1658
1903
 
1659
1904
  /**
@@ -1812,15 +2057,7 @@ export declare interface ITelemetryItem {
1812
2057
  /**
1813
2058
  * Configuration provided to SDK core
1814
2059
  */
1815
- export declare interface ITelemetryPlugin extends IPlugin {
1816
- /**
1817
- * Call back for telemetry processing before it it is sent
1818
- * @param env - This is the current event being reported
1819
- * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
1820
- * can optionally use this to access the current core instance or define / pass additional information
1821
- * to later plugins (vs appending items to the telemetry item)
1822
- */
1823
- processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
2060
+ export declare interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
1824
2061
  /**
1825
2062
  * Set next extension for telemetry processing, this is not optional as plugins should use the
1826
2063
  * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
@@ -1836,7 +2073,7 @@ export declare interface ITelemetryPlugin extends IPlugin {
1836
2073
  /**
1837
2074
  * Configuration provided to SDK core
1838
2075
  */
1839
- export declare interface ITelemetryPluginChain {
2076
+ export declare interface ITelemetryPluginChain extends ITelemetryProcessor {
1840
2077
  /**
1841
2078
  * Returns the underlying plugin that is being proxied for the processTelemetry call
1842
2079
  */
@@ -1845,6 +2082,16 @@ export declare interface ITelemetryPluginChain {
1845
2082
  * Returns the next plugin
1846
2083
  */
1847
2084
  getNext: () => ITelemetryPluginChain;
2085
+ /**
2086
+ * This plugin is being unloaded and should remove any hooked events and cleanup any global/scoped values, after this
2087
+ * call the plugin will be removed from the telemetry processing chain and will no longer receive any events..
2088
+ * @param unloadCtx - The unload context to use for this call.
2089
+ * @param unloadState - The details of the unload operation
2090
+ */
2091
+ unload?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2092
+ }
2093
+
2094
+ declare interface ITelemetryProcessor {
1848
2095
  /**
1849
2096
  * Call back for telemetry processing before it it is sent
1850
2097
  * @param env - This is the current event being reported
@@ -1852,7 +2099,13 @@ export declare interface ITelemetryPluginChain {
1852
2099
  * can optionally use this to access the current core instance or define / pass additional information
1853
2100
  * to later plugins (vs appending items to the telemetry item)
1854
2101
  */
1855
- processTelemetry: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
2102
+ processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
2103
+ }
2104
+
2105
+ export declare interface ITelemetryUnloadState {
2106
+ reason: TelemetryUnloadReason;
2107
+ isAsync: boolean;
2108
+ flushComplete?: boolean;
1856
2109
  }
1857
2110
 
1858
2111
  /**
@@ -1867,16 +2120,14 @@ export declare interface ITelemetryPluginChain {
1867
2120
  */
1868
2121
  export declare function _legacyCookieMgr(config?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
1869
2122
 
1870
- export declare enum LoggingSeverity {
1871
- /**
1872
- * Error will be sent as internal telemetry
1873
- */
1874
- CRITICAL = 1,
1875
- /**
1876
- * Error will NOT be sent as internal telemetry, and will only be shown in browser console
1877
- */
1878
- WARNING = 2
1879
- }
2123
+ export declare const LoggingSeverity: {
2124
+ CRITICAL: number;
2125
+ WARNING: number;
2126
+ };
2127
+
2128
+ export declare type LoggingSeverity = number | eLoggingSeverity;
2129
+
2130
+ export declare function mergeEvtNamespace(theNamespace: string, namespaces: string | string[]): string | string[];
1880
2131
 
1881
2132
  export declare const MinChannelPriorty: number;
1882
2133
 
@@ -1968,6 +2219,18 @@ export { objCreate }
1968
2219
  */
1969
2220
  export declare function objDefineAccessors<T>(target: any, prop: string, getProp?: () => T, setProp?: (v: T) => void): boolean;
1970
2221
 
2222
+ /**
2223
+ * Pass in the objects to merge as arguments, this will only "merge" (extend) properties that are owned by the object.
2224
+ * It will NOT merge inherited or non-enumerable properties.
2225
+ * @param obj1 - object to merge. Set this argument to 'true' for a deep extend.
2226
+ * @param obj2 - object to merge.
2227
+ * @param obj3 - object to merge.
2228
+ * @param obj4 - object to merge.
2229
+ * @param obj5 - object to merge.
2230
+ * @returns The extended first object.
2231
+ */
2232
+ export declare function objExtend<T1, T2, T3, T4, T5, T6>(obj?: boolean | T1, obj2?: T2, obj3?: T3, obj4?: T4, obj5?: T5, obj6?: T6): T1 & T2 & T3 & T4 & T5 & T6;
2233
+
1971
2234
  /**
1972
2235
  * This is a helper function for the equivalent of arForEach(objKeys(target), callbackFn), this is a
1973
2236
  * performance optimization to avoid the creation of a new array for large objects
@@ -2114,8 +2377,9 @@ export declare class ProcessTelemetryContext implements IProcessTelemetryContext
2114
2377
  * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
2115
2378
  * can optionally use this to access the current core instance or define / pass additional information
2116
2379
  * to later plugins (vs appending items to the telemetry item)
2380
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
2117
2381
  */
2118
- processNext: (env: ITelemetryItem) => void;
2382
+ processNext: (env: ITelemetryItem) => boolean | void;
2119
2383
  /**
2120
2384
  * Synchronously iterate over the context chain running the callback for each plugin, once
2121
2385
  * every plugin has been executed via the callback, any associated onComplete will be called.
@@ -2123,7 +2387,6 @@ export declare class ProcessTelemetryContext implements IProcessTelemetryContext
2123
2387
  */
2124
2388
  iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
2125
2389
  /**
2126
- /**
2127
2390
  * Create a new context using the core and config from the current instance
2128
2391
  * @param plugins - The execution order to process the plugins, if null or not supplied
2129
2392
  * then the current execution order will be copied.
@@ -2161,6 +2424,17 @@ export declare class ProcessTelemetryContext implements IProcessTelemetryContext
2161
2424
  */
2162
2425
  export declare function proxyAssign<T, S>(target: T, source: S, chkSet?: (name: string, isFunc?: boolean, source?: S, target?: T) => boolean): T;
2163
2426
 
2427
+ export declare function proxyFunctionAs<T, S>(target: T, name: string, source: S | (() => S), theFunc: (keyof S), overwriteTarget?: boolean): void;
2428
+
2429
+ /**
2430
+ * Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.
2431
+ *
2432
+ * @param target - The target object to be assigned with the source properties and functions
2433
+ * @param source - The source object which will be assigned / called by setting / calling the targets proxies
2434
+ * @param functionsToProxy - An array of function names that will be proxied on the target
2435
+ */
2436
+ export declare function proxyFunctions<T, S>(target: T, source: S | (() => S), functionsToProxy: (keyof S)[], overwriteTarget?: boolean): T;
2437
+
2164
2438
  /**
2165
2439
  * generate a random 32-bit number (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), defaults un-unsigned.
2166
2440
  * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)
@@ -2174,6 +2448,43 @@ export declare function random32(signed?: boolean): number;
2174
2448
  */
2175
2449
  export declare function randomValue(maxValue: number): number;
2176
2450
 
2451
+ /**
2452
+ * Trys to remove event handler(s) for the specified event/namespace to the window, body and document
2453
+ * @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,
2454
+ * such as "click", "click.mynamespace" or ".mynamespace"
2455
+ * @param callback {any} - - The callback function that needs to be removed from the given event, when using a
2456
+ * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers
2457
+ * otherwise this will only remove events with this specific handler.
2458
+ * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
2459
+ */
2460
+ export declare function removeEventHandler(eventName: string, callback: any, evtNamespace?: string | string[]): void;
2461
+
2462
+ /**
2463
+ * Remove the listener from the array of events
2464
+ * @param events An string array of event names to bind the listener to
2465
+ * @param listener The event callback to call when the event is triggered
2466
+ * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
2467
+ */
2468
+ export declare function removeEventListeners(events: string[], listener: any, evtNamespace?: string | string[]): void;
2469
+
2470
+ /**
2471
+ * Removes the pageHide event listeners added by addPageHideEventListener, because the 'visibilitychange' uses
2472
+ * an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageHideEventListener
2473
+ * as the remove ignores the listener argument for the 'visibilitychange' event.
2474
+ * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
2475
+ * @param evtNamespace - The unique namespace used when calling addPageShowEventListener
2476
+ */
2477
+ export declare function removePageHideEventListener(listener: any, evtNamespace?: string | string[]): void;
2478
+
2479
+ /**
2480
+ * Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,
2481
+ * addEventListeners, addPageUnloadEventListener or addPageHideEventListener.
2482
+ * @param listener - The specific event callback to to be removed
2483
+ * @param evtNamespace - [Optional] Namespace(s) uniquely identified and removed based on this namespace.
2484
+ * @returns true - when at least one of the events was registered otherwise false
2485
+ */
2486
+ export declare function removePageUnloadEventListener(listener: any, evtNamespace?: string | string[]): void;
2487
+
2177
2488
  /**
2178
2489
  * Helper to return the ICookieMgr from the core (if not null/undefined) or a default implementation
2179
2490
  * associated with the configuration or a legacy default.
@@ -2305,6 +2616,16 @@ export declare interface Tags {
2305
2616
 
2306
2617
  export declare type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
2307
2618
 
2619
+ /**
2620
+ * The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
2621
+ */
2622
+ declare const enum TelemetryUnloadReason {
2623
+ /**
2624
+ * Teardown has been called without any context.
2625
+ */
2626
+ ManualTeardown = 0
2627
+ }
2628
+
2308
2629
  export declare function throwError(message: string): never;
2309
2630
 
2310
2631
  /**