@microsoft/applicationinsights-core-js 2.8.0-beta.2203-10 → 2.8.0-beta.2203-11

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 (88) hide show
  1. package/browser/applicationinsights-core-js.integrity.json +9 -9
  2. package/browser/applicationinsights-core-js.js +35 -10
  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 +493 -58
  7. package/dist/applicationinsights-core-js.api.md +42 -23
  8. package/dist/applicationinsights-core-js.d.ts +47 -22
  9. package/dist/applicationinsights-core-js.js +35 -10
  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 +48 -23
  14. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
  15. package/dist-esm/JavaScriptSDK/BaseCore.js +11 -9
  16. package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
  17. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
  18. package/dist-esm/JavaScriptSDK/ChannelController.js +1 -1
  19. package/dist-esm/JavaScriptSDK/Constants.js +1 -1
  20. package/dist-esm/JavaScriptSDK/CookieMgr.js +1 -1
  21. package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
  22. package/dist-esm/JavaScriptSDK/DataCacheHelper.js +2 -2
  23. package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -1
  24. package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  25. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +1 -1
  26. package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
  27. package/dist-esm/JavaScriptSDK/EventHelpers.js +2 -6
  28. package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -1
  29. package/dist-esm/JavaScriptSDK/HelperFuncs.js +1 -1
  30. package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -1
  31. package/dist-esm/JavaScriptSDK/InternalConstants.js +1 -1
  32. package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
  33. package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
  34. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +1 -1
  35. package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
  36. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +29 -2
  37. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
  38. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
  39. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
  40. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
  41. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
  42. package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  43. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
  44. package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
  45. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
  46. package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  47. package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
  48. package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
  49. package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
  50. package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
  51. package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
  52. package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
  53. package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
  54. package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
  55. package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
  56. package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
  57. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
  58. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  59. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  60. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
  61. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
  62. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
  63. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +6 -0
  64. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js.map +1 -0
  65. package/dist-esm/applicationinsights-core-js.js +3 -3
  66. package/dist-esm/applicationinsights-core-js.js.map +1 -1
  67. package/package.json +2 -2
  68. package/src/JavaScriptSDK/BaseCore.ts +22 -20
  69. package/src/JavaScriptSDK/ChannelController.ts +1 -1
  70. package/src/JavaScriptSDK/DataCacheHelper.ts +1 -1
  71. package/src/JavaScriptSDK/EventHelpers.ts +13 -17
  72. package/src/JavaScriptSDK/HelperFuncs.ts +7 -7
  73. package/src/JavaScriptSDK/InstrumentHooks.ts +1 -1
  74. package/src/JavaScriptSDK/PerfManager.ts +1 -1
  75. package/src/JavaScriptSDK/ProcessTelemetryContext.ts +6 -6
  76. package/src/JavaScriptSDK/TelemetryHelpers.ts +34 -2
  77. package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +1 -1
  78. package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +1 -1
  79. package/src/JavaScriptSDK.Interfaces/IUnloadableComponent.ts +17 -0
  80. package/types/JavaScriptSDK/EventHelpers.d.ts +10 -10
  81. package/types/JavaScriptSDK/HelperFuncs.d.ts +7 -7
  82. package/types/JavaScriptSDK/PerfManager.d.ts +1 -1
  83. package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +2 -2
  84. package/types/JavaScriptSDK/TelemetryHelpers.d.ts +13 -1
  85. package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +1 -1
  86. package/types/JavaScriptSDK.Interfaces/IUnloadableComponent.d.ts +13 -0
  87. package/types/applicationinsights-core-js.d.ts +4 -3
  88. package/types/tsdoc-metadata.json +1 -1
@@ -15,19 +15,19 @@ import { strShimUndefined as strUndefined } from '@microsoft/applicationinsights
15
15
  export function __getRegisteredEvents(target: any, eventName?: string, evtNamespace?: string | string[]): _IRegisteredEvents[];
16
16
 
17
17
  // @public
18
- export function addEventHandler(eventName: string, callback: any, evtNamespace?: string | string[]): boolean;
18
+ export function addEventHandler(eventName: string, callback: any, evtNamespace?: string | string[] | null): boolean;
19
19
 
20
20
  // @public
21
21
  export function addEventListeners(events: string[], listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
22
22
 
23
23
  // @public
24
- export function addPageHideEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
24
+ export function addPageHideEventListener(listener: any, excludeEvents?: string[] | null, evtNamespace?: string | string[] | null): boolean;
25
25
 
26
26
  // @public
27
- export function addPageShowEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
27
+ export function addPageShowEventListener(listener: any, excludeEvents?: string[] | null, evtNamespace?: string | string[] | null): boolean;
28
28
 
29
29
  // @public
30
- export function addPageUnloadEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
30
+ export function addPageUnloadEventListener(listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
31
31
 
32
32
  // @public (undocumented)
33
33
  export class AppInsightsCore extends BaseCore implements IAppInsightsCore {
@@ -42,7 +42,7 @@ export class AppInsightsCore extends BaseCore implements IAppInsightsCore {
42
42
  export function areCookiesSupported(logger?: IDiagnosticLogger): any;
43
43
 
44
44
  // @public
45
- export function arrForEach<T = any>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => void | number, thisArg?: any): void;
45
+ export function arrForEach<T = any>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => undefined | void | number, thisArg?: any): void;
46
46
 
47
47
  // @public
48
48
  export function arrIndexOf<T>(arr: T[], searchElement: T, fromIndex?: number): number;
@@ -78,8 +78,6 @@ export class BaseCore implements IAppInsightsCore {
78
78
  getNotifyMgr(): INotificationManager;
79
79
  // (undocumented)
80
80
  getPerfMgr(): IPerfManager;
81
- // Warning: (ae-forgotten-export) The symbol "ILoadedPlugin" needs to be exported by the entry point applicationinsights-core-js.d.ts
82
- //
83
81
  // (undocumented)
84
82
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
85
83
  // (undocumented)
@@ -150,7 +148,7 @@ export function createCookieMgr(rootConfig?: IConfiguration, logger?: IDiagnosti
150
148
  export function createEnumStyle<T>(values: T): T;
151
149
 
152
150
  // @public
153
- export function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
151
+ export function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain | null, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
154
152
 
155
153
  // @public (undocumented)
156
154
  export function createUniqueNamespace(name: string, includeVersion?: boolean): string;
@@ -374,10 +372,10 @@ export const enum eLoggingSeverity {
374
372
  export const EventHelper: IEventHelper;
375
373
 
376
374
  // @public
377
- export function eventOff<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[], useCapture?: boolean): void;
375
+ export function eventOff<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): void;
378
376
 
379
377
  // @public
380
- export function eventOn<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[], useCapture?: boolean): boolean;
378
+ export function eventOn<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): boolean;
381
379
 
382
380
  // @public
383
381
  export const EventsDiscardedReason: {
@@ -519,7 +517,7 @@ export interface IBaseProcessingContext {
519
517
  getNext: () => ITelemetryPluginChain;
520
518
  hasNext: () => boolean;
521
519
  iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
522
- onComplete: (onComplete: Function, that?: any, ...args: any[]) => void;
520
+ onComplete: (onComplete: () => void, that?: any, ...args: any[]) => void;
523
521
  setNext: (nextCtx: ITelemetryPluginChain) => void;
524
522
  }
525
523
 
@@ -714,6 +712,16 @@ export interface IInstrumentHooksCallbacks {
714
712
  rsp?: InstrumentorHooksCallback;
715
713
  }
716
714
 
715
+ // @public (undocumented)
716
+ export interface ILoadedPlugin<T extends IPlugin> {
717
+ isEnabled: () => boolean;
718
+ // (undocumented)
719
+ plugin: T;
720
+ // (undocumented)
721
+ remove: (isAsync?: boolean, removeCb?: (removed?: boolean) => void) => void;
722
+ setEnabled: (isEnabled: boolean) => void;
723
+ }
724
+
717
725
  // @public
718
726
  export function initializePlugins(processContext: IProcessTelemetryContext, extensions: IPlugin[]): void;
719
727
 
@@ -942,22 +950,22 @@ export function isFunction(value: any): value is Function;
942
950
  export function isIE(): boolean;
943
951
 
944
952
  // @public (undocumented)
945
- export function isNotNullOrUndefined(value: any): boolean;
953
+ export function isNotNullOrUndefined<T>(value: T): value is T;
946
954
 
947
955
  // @public (undocumented)
948
956
  export function isNotTruthy(value: any): boolean;
949
957
 
950
958
  // @public (undocumented)
951
- export function isNotUndefined(value: any): boolean;
959
+ export function isNotUndefined<T>(value: T): value is T;
952
960
 
953
961
  // @public (undocumented)
954
- export function isNullOrUndefined(value: any): boolean;
962
+ export function isNullOrUndefined(value: any): value is null | undefined;
955
963
 
956
964
  // @public
957
965
  export function isNumber(value: any): value is number;
958
966
 
959
967
  // @public (undocumented)
960
- export function isObject(value: any): boolean;
968
+ export function isObject<T>(value: T): value is T;
961
969
 
962
970
  // @public
963
971
  export function isReactNative(): boolean;
@@ -978,7 +986,7 @@ export function isTruthy(value: any): boolean;
978
986
  export function isTypeof(value: any, theType: string): boolean;
979
987
 
980
988
  // @public (undocumented)
981
- export function isUndefined(value: any): boolean;
989
+ export function isUndefined(value: any): value is undefined;
982
990
 
983
991
  // @public
984
992
  export function isXhrSupported(): boolean;
@@ -1043,6 +1051,11 @@ export interface ITelemetryUpdateState {
1043
1051
  removed?: IPlugin[];
1044
1052
  }
1045
1053
 
1054
+ // @public (undocumented)
1055
+ export interface IUnloadableComponent {
1056
+ _doUnload?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
1057
+ }
1058
+
1046
1059
  // @public (undocumented)
1047
1060
  export interface IUnloadHandlerContainer {
1048
1061
  // (undocumented)
@@ -1064,7 +1077,7 @@ export const LoggingSeverity: {
1064
1077
  export type LoggingSeverity = number | eLoggingSeverity;
1065
1078
 
1066
1079
  // @public (undocumented)
1067
- export function mergeEvtNamespace(theNamespace: string, namespaces: string | string[]): string | string[];
1080
+ export function mergeEvtNamespace(theNamespace: string, namespaces?: string | string[] | null): string | string[];
1068
1081
 
1069
1082
  // @public (undocumented)
1070
1083
  export const MinChannelPriorty: number;
@@ -1120,6 +1133,9 @@ export function objKeys(obj: {}): string[];
1120
1133
  // @public (undocumented)
1121
1134
  export const objSeal: <T>(value: T) => T;
1122
1135
 
1136
+ // @public (undocumented)
1137
+ export function objToString(obj: any): any;
1138
+
1123
1139
  // @public
1124
1140
  export function optimizeObject<T>(theObject: T): T;
1125
1141
 
@@ -1147,7 +1163,7 @@ export class PerfEvent implements IPerfEvent {
1147
1163
 
1148
1164
  // @public (undocumented)
1149
1165
  export class PerfManager implements IPerfManager {
1150
- constructor(manager: INotificationManager);
1166
+ constructor(manager?: INotificationManager);
1151
1167
  create(src: string, payload?: any, isAsync?: boolean): IPerfEvent | null | undefined;
1152
1168
  fire(perfEvent: IPerfEvent): void;
1153
1169
  getCtx(key: string): any;
@@ -1165,7 +1181,7 @@ export class ProcessTelemetryContext implements IProcessTelemetryContext {
1165
1181
  diagLog: () => IDiagnosticLogger;
1166
1182
  getCfg: () => IConfiguration;
1167
1183
  // (undocumented)
1168
- getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean) => number | string | boolean;
1184
+ getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
1169
1185
  // (undocumented)
1170
1186
  getExtCfg: <T>(identifier: string, defaultValue?: T | any) => T;
1171
1187
  getNext: () => ITelemetryPluginChain;
@@ -1192,16 +1208,16 @@ export function random32(signed?: boolean): number;
1192
1208
  export function randomValue(maxValue: number): number;
1193
1209
 
1194
1210
  // @public
1195
- export function removeEventHandler(eventName: string, callback: any, evtNamespace?: string | string[]): void;
1211
+ export function removeEventHandler(eventName: string, callback: any, evtNamespace?: string | string[] | null): void;
1196
1212
 
1197
1213
  // @public
1198
1214
  export function removeEventListeners(events: string[], listener: any, evtNamespace?: string | string[]): void;
1199
1215
 
1200
1216
  // @public
1201
- export function removePageHideEventListener(listener: any, evtNamespace?: string | string[]): void;
1217
+ export function removePageHideEventListener(listener: any, evtNamespace?: string | string[] | null): void;
1202
1218
 
1203
1219
  // @public
1204
- export function removePageShowEventListener(listener: any, evtNamespace?: string | string[]): void;
1220
+ export function removePageShowEventListener(listener: any, evtNamespace?: string | string[] | null): void;
1205
1221
 
1206
1222
  // @public
1207
1223
  export function removePageUnloadEventListener(listener: any, evtNamespace?: string | string[]): void;
@@ -1236,7 +1252,7 @@ export function setEnableEnvMocks(enabled: boolean): void;
1236
1252
  export function setGblPerfMgr(perfManager: IPerfManager): void;
1237
1253
 
1238
1254
  // @public
1239
- export function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: (value: T[K]) => boolean, srcChk?: (value: T[K]) => boolean): T[K];
1255
+ export function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: ((value: T[K]) => boolean) | null, srcChk?: ((value: T[K]) => boolean) | null): T[K];
1240
1256
 
1241
1257
  // @public (undocumented)
1242
1258
  export function sortPlugins<T = IPlugin>(plugins: T[]): T[];
@@ -1306,6 +1322,9 @@ export function uaDisallowsSameSiteNone(userAgent: string): boolean;
1306
1322
  // @public (undocumented)
1307
1323
  export const Undefined = "undefined";
1308
1324
 
1325
+ // @public
1326
+ export function unloadComponents(components: any | IUnloadableComponent[], unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void): void | boolean;
1327
+
1309
1328
  // @public (undocumented)
1310
1329
  export type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
1311
1330
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-10
2
+ * Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-11
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -31,7 +31,7 @@ declare namespace ApplicationInsights {
31
31
  * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
32
32
  * @return {boolean} - true if the handler was successfully added
33
33
  */
34
- function addEventHandler(eventName: string, callback: any, evtNamespace?: string | string[]): boolean;
34
+ function addEventHandler(eventName: string, callback: any, evtNamespace?: string | string[] | null): boolean;
35
35
 
36
36
  /**
37
37
  * Bind the listener to the array of events
@@ -55,7 +55,7 @@ declare namespace ApplicationInsights {
55
55
  * Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide
56
56
  * @returns true - when at least one of the events was registered otherwise false
57
57
  */
58
- function addPageHideEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
58
+ function addPageHideEventListener(listener: any, excludeEvents?: string[] | null, evtNamespace?: string | string[] | null): boolean;
59
59
 
60
60
  /**
61
61
  * Listen to the pageshow and visibility changing to 'visible' events, because the 'visibilitychange' uses
@@ -68,7 +68,7 @@ declare namespace ApplicationInsights {
68
68
  * so that only the matching "removePageShowEventListener" can remove these events.
69
69
  * @returns true - when at least one of the events was registered otherwise false
70
70
  */
71
- function addPageShowEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
71
+ function addPageShowEventListener(listener: any, excludeEvents?: string[] | null, evtNamespace?: string | string[] | null): boolean;
72
72
 
73
73
  /**
74
74
  * Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,
@@ -81,7 +81,7 @@ declare namespace ApplicationInsights {
81
81
  * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
82
82
  * @returns true - when at least one of the events was registered otherwise false
83
83
  */
84
- function addPageUnloadEventListener(listener: any, excludeEvents: string[], evtNamespace?: string | string[]): boolean;
84
+ function addPageUnloadEventListener(listener: any, excludeEvents?: string[], evtNamespace?: string | string[]): boolean;
85
85
 
86
86
  class AppInsightsCore extends BaseCore implements IAppInsightsCore {
87
87
  constructor();
@@ -99,7 +99,7 @@ declare namespace ApplicationInsights {
99
99
  * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. It can return -1 to break out of the loop
100
100
  * @param thisArg [Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
101
101
  */
102
- function arrForEach<T = any>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => void | number, thisArg?: any): void;
102
+ function arrForEach<T = any>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => undefined | void | number, thisArg?: any): void;
103
103
 
104
104
  /**
105
105
  * Returns the index of the first occurrence of a value in an array. This helper exists to avoid adding a polyfil for older browsers
@@ -370,7 +370,7 @@ declare namespace ApplicationInsights {
370
370
  * @param core - The current core instance
371
371
  * @param startAt - Identifies the next plugin to execute, if null there is no "next" plugin and if undefined it should assume the start of the chain
372
372
  */
373
- function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
373
+ function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain | null, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
374
374
 
375
375
  function createUniqueNamespace(name: string, includeVersion?: boolean): string;
376
376
 
@@ -590,7 +590,7 @@ declare namespace ApplicationInsights {
590
590
  * if the eventName also includes a namespace the namespace(s) are merged into a single namespace
591
591
  * @param useCapture [Optional] Defaults to false
592
592
  */
593
- function eventOff<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[], useCapture?: boolean): void;
593
+ function eventOff<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): void;
594
594
 
595
595
  /**
596
596
  * Binds the specified function to an event, so that the function gets called whenever the event fires on the object
@@ -603,7 +603,7 @@ declare namespace ApplicationInsights {
603
603
  * @param useCapture [Optional] Defaults to false
604
604
  * @returns True if the function was bound successfully to the event, otherwise false
605
605
  */
606
- function eventOn<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[], useCapture?: boolean): boolean;
606
+ function eventOn<T>(target: T, eventName: string, handlerRef: any, evtNamespace?: string | string[] | null, useCapture?: boolean): boolean;
607
607
 
608
608
  /**
609
609
  * The EventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.
@@ -946,7 +946,7 @@ declare namespace ApplicationInsights {
946
946
  * @param that - The "this" value to use for the onComplete call, if not provided or undefined defaults to the current context
947
947
  * @param args - Any additional arguments to pass to the onComplete function
948
948
  */
949
- onComplete: (onComplete: Function, that?: any, ...args: any[]) => void;
949
+ onComplete: (onComplete: () => void, that?: any, ...args: any[]) => void;
950
950
  /**
951
951
  * Create a new context using the core and config from the current instance, returns a new instance of the same type
952
952
  * @param plugins - The execution order to process the plugins, if null or not supplied
@@ -2069,13 +2069,13 @@ declare namespace ApplicationInsights {
2069
2069
  */
2070
2070
  function isIE(): boolean;
2071
2071
 
2072
- function isNotNullOrUndefined(value: any): boolean;
2072
+ function isNotNullOrUndefined<T>(value: T): value is T;
2073
2073
 
2074
2074
  function isNotTruthy(value: any): boolean;
2075
2075
 
2076
- function isNotUndefined(value: any): boolean;
2076
+ function isNotUndefined<T>(value: T): value is T;
2077
2077
 
2078
- function isNullOrUndefined(value: any): boolean;
2078
+ function isNullOrUndefined(value: any): value is null | undefined;
2079
2079
 
2080
2080
  /**
2081
2081
  * Checks if the type of value is a number.
@@ -2084,7 +2084,7 @@ declare namespace ApplicationInsights {
2084
2084
  */
2085
2085
  function isNumber(value: any): value is number;
2086
2086
 
2087
- function isObject(value: any): boolean;
2087
+ function isObject<T>(value: T): value is T;
2088
2088
 
2089
2089
  /**
2090
2090
  * Returns whether the environment is reporting that we are running in a React Native Environment
@@ -2112,7 +2112,7 @@ declare namespace ApplicationInsights {
2112
2112
 
2113
2113
  function isTypeof(value: any, theType: string): boolean;
2114
2114
 
2115
- function isUndefined(value: any): boolean;
2115
+ function isUndefined(value: any): value is undefined;
2116
2116
 
2117
2117
  /**
2118
2118
  * Checks if XMLHttpRequest is supported
@@ -2263,6 +2263,18 @@ declare namespace ApplicationInsights {
2263
2263
  removed?: IPlugin[];
2264
2264
  }
2265
2265
 
2266
+ interface IUnloadableComponent {
2267
+ /**
2268
+ * Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
2269
+ * finishes it's removal.
2270
+ * @param unloadCtx - This is the context that should be used during unloading.
2271
+ * @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.
2272
+ * @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.
2273
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
2274
+ */
2275
+ _doUnload?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
2276
+ }
2277
+
2266
2278
  interface IUnloadHandlerContainer {
2267
2279
  add: (handler: UnloadHandler) => void;
2268
2280
  run: (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
@@ -2287,7 +2299,7 @@ declare namespace ApplicationInsights {
2287
2299
 
2288
2300
  type LoggingSeverity = number | eLoggingSeverity;
2289
2301
 
2290
- function mergeEvtNamespace(theNamespace: string, namespaces: string | string[]): string | string[];
2302
+ function mergeEvtNamespace(theNamespace: string, namespaces?: string | string[] | null): string | string[];
2291
2303
 
2292
2304
  const MinChannelPriorty: number;
2293
2305
 
@@ -2413,6 +2425,8 @@ declare namespace ApplicationInsights {
2413
2425
 
2414
2426
  const objSeal: <T>(value: T) => T;
2415
2427
 
2428
+ function objToString(obj: any): any;
2429
+
2416
2430
  /**
2417
2431
  * A helper function to assist with JIT performance for objects that have properties added / removed dynamically
2418
2432
  * this is primarily for chromium based browsers and has limited effects on Firefox and none of IE. Only call this
@@ -2468,7 +2482,7 @@ declare namespace ApplicationInsights {
2468
2482
  * Defined as private so it can be visualized via the DebugPlugin
2469
2483
  */
2470
2484
  private ctx;
2471
- constructor(manager: INotificationManager);
2485
+ constructor(manager?: INotificationManager);
2472
2486
  /**
2473
2487
  * Create a new event and start timing, the manager may return null/undefined to indicate that it does not
2474
2488
  * want to monitor this source event.
@@ -2511,7 +2525,7 @@ declare namespace ApplicationInsights {
2511
2525
  */
2512
2526
  getCfg: () => IConfiguration;
2513
2527
  getExtCfg: <T>(identifier: string, defaultValue?: T | any) => T;
2514
- getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean) => number | string | boolean;
2528
+ getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
2515
2529
  /**
2516
2530
  * Returns the IAppInsightsCore instance for the current request
2517
2531
  */
@@ -2619,7 +2633,7 @@ declare namespace ApplicationInsights {
2619
2633
  * otherwise this will only remove events with this specific handler.
2620
2634
  * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
2621
2635
  */
2622
- function removeEventHandler(eventName: string, callback: any, evtNamespace?: string | string[]): void;
2636
+ function removeEventHandler(eventName: string, callback: any, evtNamespace?: string | string[] | null): void;
2623
2637
 
2624
2638
  /**
2625
2639
  * Remove the listener from the array of events
@@ -2636,7 +2650,7 @@ declare namespace ApplicationInsights {
2636
2650
  * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
2637
2651
  * @param evtNamespace - The unique namespace used when calling addPageShowEventListener
2638
2652
  */
2639
- function removePageHideEventListener(listener: any, evtNamespace?: string | string[]): void;
2653
+ function removePageHideEventListener(listener: any, evtNamespace?: string | string[] | null): void;
2640
2654
 
2641
2655
  /**
2642
2656
  * Removes the pageShow event listeners added by addPageShowEventListener, because the 'visibilitychange' uses
@@ -2645,7 +2659,7 @@ declare namespace ApplicationInsights {
2645
2659
  * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
2646
2660
  * @param evtNamespace - The unique namespace used when calling addPageShowEventListener
2647
2661
  */
2648
- function removePageShowEventListener(listener: any, evtNamespace?: string | string[]): void;
2662
+ function removePageShowEventListener(listener: any, evtNamespace?: string | string[] | null): void;
2649
2663
 
2650
2664
  /**
2651
2665
  * Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,
@@ -2741,7 +2755,7 @@ declare namespace ApplicationInsights {
2741
2755
  * @param srcChk - [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)
2742
2756
  * @returns The existing or new value, depending what was set
2743
2757
  */
2744
- function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: (value: T[K]) => boolean, srcChk?: (value: T[K]) => boolean): T[K];
2758
+ function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: ((value: T[K]) => boolean) | null, srcChk?: ((value: T[K]) => boolean) | null): T[K];
2745
2759
 
2746
2760
  function sortPlugins<T = IPlugin>(plugins: T[]): T[];
2747
2761
 
@@ -2856,6 +2870,17 @@ declare namespace ApplicationInsights {
2856
2870
 
2857
2871
  const Undefined = "undefined";
2858
2872
 
2873
+ /**
2874
+ * Teardown / Unload helper to perform teardown/unloading operations for the provided components synchronously or asynchronously, this will call any
2875
+ * _doTeardown() or _doUnload() functions on the provided components to allow them to finish removal.
2876
+ * @param components - The components you want to unload
2877
+ * @param unloadCtx - This is the context that should be used during unloading.
2878
+ * @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.
2879
+ * @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.
2880
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
2881
+ */
2882
+ function unloadComponents(components: any | IUnloadableComponent[], unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void): void | boolean;
2883
+
2859
2884
  type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2860
2885
 
2861
2886
  function useXDomainRequest(): boolean | undefined;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Core, 2.8.0-beta.2203-10
2
+ * Application Insights JavaScript SDK - Core, 2.8.0-beta.2203-11
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -405,6 +405,9 @@
405
405
  }
406
406
  return null;
407
407
  }
408
+ function objToString(obj) {
409
+ return _objToString.call(obj);
410
+ }
408
411
  function isTypeof(value, theType) {
409
412
  return typeof value === theType;
410
413
  }
@@ -1543,7 +1546,7 @@
1543
1546
  }
1544
1547
 
1545
1548
  var _objDefineProperty = ObjDefineProperty;
1546
- var version = "2.7.3";
1549
+ var version = "2.8.0-beta.2203-11";
1547
1550
  var instanceName = "." + newId(6);
1548
1551
  var _dataUid = 0;
1549
1552
  function _createAccessor(target, prop, value) {
@@ -1614,6 +1617,7 @@
1614
1617
  return data;
1615
1618
  }
1616
1619
 
1620
+ var strDoUnload = "_doUnload";
1617
1621
  var pluginStateData = createElmNodeData("plugin");
1618
1622
  function _getPluginState(plugin) {
1619
1623
  return pluginStateData.get(plugin, "state", {}, true);
@@ -1670,6 +1674,23 @@
1670
1674
  return result;
1671
1675
  });
1672
1676
  }
1677
+ function unloadComponents(components, unloadCtx, unloadState, asyncCallback) {
1678
+ var idx = 0;
1679
+ function _doUnload() {
1680
+ while (idx < components.length) {
1681
+ var component = components[idx++];
1682
+ if (component) {
1683
+ var func = component[strDoUnload] || component[strDoTeardown];
1684
+ if (isFunction(func)) {
1685
+ if (func.call(component, unloadCtx, unloadState, _doUnload) === true) {
1686
+ return true;
1687
+ }
1688
+ }
1689
+ }
1690
+ }
1691
+ }
1692
+ return _doUnload();
1693
+ }
1673
1694
 
1674
1695
  var strTelemetryPluginChain = "TelemetryPluginChain";
1675
1696
  var strHasRunFlags = "_hasRun";
@@ -2810,9 +2831,11 @@
2810
2831
  };
2811
2832
  _self.getTransmissionControls = function () {
2812
2833
  var controls = [];
2813
- arrForEach(_channelQueue, function (channels) {
2814
- controls.push(channels.queue);
2815
- });
2834
+ if (_channelQueue) {
2835
+ arrForEach(_channelQueue, function (channels) {
2836
+ controls.push(channels.queue);
2837
+ });
2838
+ }
2816
2839
  return objFreeze(controls);
2817
2840
  };
2818
2841
  _self.track = function (telemetryItem) {
@@ -2877,7 +2900,7 @@
2877
2900
  }
2878
2901
  };
2879
2902
  _self.pollInternalLogs = function (eventName) {
2880
- _internalLogsEventName = eventName;
2903
+ _internalLogsEventName = eventName || null;
2881
2904
  var interval = _self.config.diagnosticLogInterval;
2882
2905
  if (!interval || !(interval > 0)) {
2883
2906
  interval = 10000;
@@ -2953,7 +2976,7 @@
2953
2976
  var removedPlugins_1 = [existingPlugin.plugin];
2954
2977
  var unloadState = {
2955
2978
  reason: 2 ,
2956
- isAsync: isAsync
2979
+ isAsync: !!isAsync
2957
2980
  };
2958
2981
  _removePlugins(removedPlugins_1, unloadState, function (removed) {
2959
2982
  if (!removed) {
@@ -2978,7 +3001,7 @@
2978
3001
  function _initDefaults() {
2979
3002
  _isInitialized = false;
2980
3003
  _self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 });
2981
- _self.config = null;
3004
+ _self.config = {};
2982
3005
  _self._extensions = [];
2983
3006
  _telemetryInitializerPlugin = new TelemetryInitializerPlugin();
2984
3007
  _eventQueue = [];
@@ -2988,7 +3011,7 @@
2988
3011
  _cookieManager = null;
2989
3012
  _pluginChain = null;
2990
3013
  _coreExtensions = null;
2991
- _configExtensions = null;
3014
+ _configExtensions = [];
2992
3015
  _channelControl = null;
2993
3016
  _channelConfig = null;
2994
3017
  _channelQueue = null;
@@ -3338,7 +3361,7 @@
3338
3361
  eventName = (eventName || "") + theNamespace_1;
3339
3362
  }
3340
3363
  }
3341
- var parsedEvent = (eventNamespace.exec(eventName) || []);
3364
+ var parsedEvent = (eventNamespace.exec(eventName || "") || []);
3342
3365
  return {
3343
3366
  type: parsedEvent[1],
3344
3367
  ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
@@ -4080,6 +4103,7 @@
4080
4103
  exports.objFreeze = objFreeze;
4081
4104
  exports.objKeys = objKeys;
4082
4105
  exports.objSeal = objSeal;
4106
+ exports.objToString = objToString;
4083
4107
  exports.optimizeObject = optimizeObject;
4084
4108
  exports.perfNow = perfNow;
4085
4109
  exports.proxyAssign = proxyAssign;
@@ -4112,6 +4136,7 @@
4112
4136
  exports.throwError = throwError;
4113
4137
  exports.toISOString = toISOString;
4114
4138
  exports.uaDisallowsSameSiteNone = uaDisallowsSameSiteNone;
4139
+ exports.unloadComponents = unloadComponents;
4115
4140
  exports.useXDomainRequest = useXDomainRequest;
4116
4141
 
4117
4142
  (function(obj, prop, descriptor) { /* ai_es3_polyfil defineProperty */ var func = Object["defineProperty"]; if (func) { try { return func(obj, prop, descriptor); } catch(e) { /* IE8 defines defineProperty, but will throw */ } } if (descriptor && typeof descriptor.value !== undefined) { obj[prop] = descriptor.value; } return obj; })(exports, '__esModule', { value: true });