@microsoft/applicationinsights-web 2.8.0-beta.2203-03 → 2.8.0-beta.2203-06

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/browser/{ai.2.8.0-beta.2203-03.cjs.js → ai.2.8.0-beta.2203-06.cjs.js} +639 -356
  2. package/browser/ai.2.8.0-beta.2203-06.cjs.js.map +1 -0
  3. package/browser/ai.2.8.0-beta.2203-06.cjs.min.js +6 -0
  4. package/browser/ai.2.8.0-beta.2203-06.cjs.min.js.map +1 -0
  5. package/browser/{ai.2.8.0-beta.2203-03.gbl.js → ai.2.8.0-beta.2203-06.gbl.js} +639 -356
  6. package/browser/ai.2.8.0-beta.2203-06.gbl.js.map +1 -0
  7. package/browser/ai.2.8.0-beta.2203-06.gbl.min.js +6 -0
  8. package/browser/ai.2.8.0-beta.2203-06.gbl.min.js.map +1 -0
  9. package/browser/ai.2.8.0-beta.2203-06.integrity.json +66 -0
  10. package/browser/{ai.2.8.0-beta.2203-03.js → ai.2.8.0-beta.2203-06.js} +639 -356
  11. package/browser/ai.2.8.0-beta.2203-06.js.map +1 -0
  12. package/browser/ai.2.8.0-beta.2203-06.min.js +6 -0
  13. package/browser/ai.2.8.0-beta.2203-06.min.js.map +1 -0
  14. package/browser/ai.2.cjs.js +638 -355
  15. package/browser/ai.2.cjs.js.map +1 -1
  16. package/browser/ai.2.cjs.min.js +2 -2
  17. package/browser/ai.2.cjs.min.js.map +1 -1
  18. package/browser/ai.2.gbl.js +638 -355
  19. package/browser/ai.2.gbl.js.map +1 -1
  20. package/browser/ai.2.gbl.min.js +2 -2
  21. package/browser/ai.2.gbl.min.js.map +1 -1
  22. package/browser/ai.2.js +638 -355
  23. package/browser/ai.2.js.map +1 -1
  24. package/browser/ai.2.min.js +2 -2
  25. package/browser/ai.2.min.js.map +1 -1
  26. package/dist/applicationinsights-web.api.json +227 -164
  27. package/dist/applicationinsights-web.api.md +14 -20
  28. package/dist/applicationinsights-web.d.ts +108 -106
  29. package/dist/applicationinsights-web.js +639 -356
  30. package/dist/applicationinsights-web.js.map +1 -1
  31. package/dist/applicationinsights-web.min.js +2 -2
  32. package/dist/applicationinsights-web.min.js.map +1 -1
  33. package/dist/applicationinsights-web.rollup.d.ts +108 -106
  34. package/dist-esm/ApplicationInsightsContainer.js +1 -1
  35. package/dist-esm/ApplicationInsightsDeprecated.js +1 -1
  36. package/dist-esm/Init.js +1 -1
  37. package/dist-esm/Initialization.js +1 -1
  38. package/dist-esm/applicationinsights-web.js +1 -1
  39. package/package.json +7 -7
  40. package/types/Initialization.d.ts +1 -1
  41. package/browser/ai.2.8.0-beta.2203-03.cjs.js.map +0 -1
  42. package/browser/ai.2.8.0-beta.2203-03.cjs.min.js +0 -6
  43. package/browser/ai.2.8.0-beta.2203-03.cjs.min.js.map +0 -1
  44. package/browser/ai.2.8.0-beta.2203-03.gbl.js.map +0 -1
  45. package/browser/ai.2.8.0-beta.2203-03.gbl.min.js +0 -6
  46. package/browser/ai.2.8.0-beta.2203-03.gbl.min.js.map +0 -1
  47. package/browser/ai.2.8.0-beta.2203-03.integrity.json +0 -66
  48. package/browser/ai.2.8.0-beta.2203-03.js.map +0 -1
  49. package/browser/ai.2.8.0-beta.2203-03.min.js +0 -6
  50. package/browser/ai.2.8.0-beta.2203-03.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft.ApplicationInsights, 2.8.0-beta.2203-03
2
+ * Microsoft.ApplicationInsights, 2.8.0-beta.2203-06
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -48,16 +48,12 @@ declare namespace ApplicationInsights {
48
48
 
49
49
  class ApplicationAnalytics extends BaseTelemetryPlugin implements IAppInsights, IAppInsightsInternal {
50
50
  static Version: string;
51
- static getDefaultConfig(config?: IConfig): IConfig;
51
+ static getDefaultConfig: typeof _getDefaultConfig;
52
52
  identifier: string;
53
53
  priority: number;
54
54
  config: IConfig;
55
55
  queue: Array<() => void>;
56
56
  autoRoutePVDelay: number;
57
- protected _telemetryInitializers: Array<(envelope: ITelemetryItem) => boolean | void>;
58
- protected _pageViewManager: PageViewManager;
59
- protected _pageViewPerformanceManager: PageViewPerformanceManager;
60
- protected _pageVisitTimeManager: PageVisitTimeManager;
61
57
  constructor();
62
58
  /**
63
59
  * Get the current cookie manager for this instance
@@ -181,7 +177,7 @@ declare namespace ApplicationInsights {
181
177
  * @memberof ApplicationInsights
182
178
  */
183
179
  _onerror(exception: IAutoExceptionTelemetry): void;
184
- addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void): void;
180
+ addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void): ITelemetryInitializerHandler | void;
185
181
  initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
186
182
  }
187
183
 
@@ -292,7 +288,7 @@ declare namespace ApplicationInsights {
292
288
  }, measurements?: {
293
289
  [key: string]: number;
294
290
  }): void;
295
- addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void): void;
291
+ addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void): void | ITelemetryInitializerHandler;
296
292
  /**
297
293
  * Set the authenticated user id and the account id. Used for identifying a specific signed-in user. Parameters must not contain whitespace or ,;=|
298
294
  *
@@ -425,7 +421,7 @@ declare namespace ApplicationInsights {
425
421
  * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
426
422
  * to successfully remove any global references or they may just be completing the unload process asynchronously.
427
423
  */
428
- unload(isAsync?: boolean, unloadComplete?: () => void): void;
424
+ unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
429
425
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
430
426
  addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
431
427
  /**
@@ -438,6 +434,13 @@ declare namespace ApplicationInsights {
438
434
  */
439
435
  addUnloadCb(handler: UnloadHandler): void;
440
436
  protected releaseQueue(): void;
437
+ /**
438
+ * Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
439
+ * @param updateCtx - The plugin update context
440
+ * @param updateState - The Update State
441
+ * @returns boolean - True means the extension class will call updateState otherwise the Core will
442
+ */
443
+ protected _updateHook?(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
441
444
  }
442
445
 
443
446
  /**
@@ -494,6 +497,14 @@ declare namespace ApplicationInsights {
494
497
  * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
495
498
  */
496
499
  protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
500
+ /**
501
+ * Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal
502
+ * @param updateCtx - This is the context that should be used during updating.
503
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
504
+ * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async update operations.
505
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
506
+ */
507
+ protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
497
508
  constructor();
498
509
  initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
499
510
  /**
@@ -506,6 +517,13 @@ declare namespace ApplicationInsights {
506
517
  */
507
518
  teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
508
519
  abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
520
+ /**
521
+ * The the plugin should re-evaluate configuration and update any cached configuration settings.
522
+ * @param updateCtx - This is the context that should be used during updating.
523
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
524
+ * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
525
+ */
526
+ update(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
509
527
  /**
510
528
  * Add an unload handler that will be called when the SDK is being unloaded
511
529
  * @param handler - the handler
@@ -977,6 +995,8 @@ declare namespace ApplicationInsights {
977
995
  */
978
996
  function _formatErrorCode(errorObj: any): any;
979
997
 
998
+ function _getDefaultConfig(config?: IConfig): IConfig;
999
+
980
1000
  const enum GetExtCfgMergeType {
981
1001
  None = 0,
982
1002
  MergeDefaultOnly = 1,
@@ -2719,6 +2739,11 @@ declare namespace ApplicationInsights {
2719
2739
  * You must always supply the error callback
2720
2740
  */
2721
2741
  interface IInstrumentHooksCallbacks {
2742
+ /**
2743
+ * [Optional] Namespace details (same as the namespace used for events), useful for debugging and testing to
2744
+ * identify the source of the instrumented hooks
2745
+ */
2746
+ ns?: string | string[];
2722
2747
  /**
2723
2748
  * The hook callback to call before the original function is called
2724
2749
  */
@@ -3299,8 +3324,8 @@ declare namespace ApplicationInsights {
3299
3324
  }
3300
3325
 
3301
3326
  /**
3302
- * The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
3303
- * between multiple AppInsights instances
3327
+ * The current context for the current call to teardown() implementations, used to support when plugins are being removed
3328
+ * or the SDK is being unloaded.
3304
3329
  */
3305
3330
  interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
3306
3331
  /**
@@ -3319,6 +3344,27 @@ declare namespace ApplicationInsights {
3319
3344
  createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
3320
3345
  }
3321
3346
 
3347
+ /**
3348
+ * The current context for the current call to the plugin update() implementations, used to support the notifications
3349
+ * for when plugins are added, removed or the configuration was changed.
3350
+ */
3351
+ interface IProcessTelemetryUpdateContext extends IBaseProcessingContext {
3352
+ /**
3353
+ * This Plugin has finished unloading, so unload the next one
3354
+ * @param updateState - The update State
3355
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
3356
+ */
3357
+ processNext: (updateState: ITelemetryUpdateState) => boolean | void;
3358
+ /**
3359
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
3360
+ * @param plugins - The execution order to process the plugins, if null or not supplied
3361
+ * then the current execution order will be copied.
3362
+ * @param startAt - The plugin to start processing from, if missing from the execution
3363
+ * order then the next plugin will be NOT set.
3364
+ */
3365
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUpdateContext;
3366
+ }
3367
+
3322
3368
  interface IPropertiesPlugin {
3323
3369
  readonly context: ITelemetryContext;
3324
3370
  }
@@ -3715,6 +3761,15 @@ declare namespace ApplicationInsights {
3715
3761
  * to later plugins (vs appending items to the telemetry item)
3716
3762
  */
3717
3763
  processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
3764
+ /**
3765
+ * The the plugin should re-evaluate configuration and update any cached configuration settings or
3766
+ * plugins. If implemented this method will be called whenever a plugin is added or removed and if
3767
+ * the configuration has bee updated.
3768
+ * @param updateCtx - This is the context that should be used during updating.
3769
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
3770
+ * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
3771
+ */
3772
+ update?: (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => void | boolean;
3718
3773
  }
3719
3774
 
3720
3775
  interface ITelemetryTrace {
@@ -3742,6 +3797,27 @@ declare namespace ApplicationInsights {
3742
3797
  flushComplete?: boolean;
3743
3798
  }
3744
3799
 
3800
+ interface ITelemetryUpdateState {
3801
+ /**
3802
+ * Identifies the reason for the update notification, this is a bitwise numeric value
3803
+ */
3804
+ reason: TelemetryUpdateReason;
3805
+ /**
3806
+ * If this is a configuration update this was the previous configuration that was used
3807
+ */
3808
+ /**
3809
+ * If this is a configuration update is the new configuration that is being used
3810
+ */
3811
+ /**
3812
+ * This holds a collection of plugins that have been added (if the reason identifies that one or more plugins have been added)
3813
+ */
3814
+ added?: IPlugin[];
3815
+ /**
3816
+ * This holds a collection of plugins that have been removed (if the reason identifies that one or more plugins have been removed)
3817
+ */
3818
+ removed?: IPlugin[];
3819
+ }
3820
+
3745
3821
  interface ITraceState {
3746
3822
  }
3747
3823
 
@@ -4187,26 +4263,6 @@ declare namespace ApplicationInsights {
4187
4263
  constructor();
4188
4264
  }
4189
4265
 
4190
- /**
4191
- * Class encapsulates sending page views and page view performance telemetry.
4192
- */
4193
- class PageViewManager {
4194
- constructor(appInsights: IAppInsightsInternal, overridePageViewDuration: boolean, core: IAppInsightsCore, pageViewPerformanceManager: PageViewPerformanceManager);
4195
- /**
4196
- * Currently supported cases:
4197
- * 1) (default case) track page view called with default parameters, overridePageViewDuration = false. Page view is sent with page view performance when navigation timing data is available.
4198
- * a. If navigation timing is not supported then page view is sent right away with undefined duration. Page view performance is not sent.
4199
- * 2) overridePageViewDuration = true, custom duration provided. Custom duration is used, page view sends right away.
4200
- * 3) overridePageViewDuration = true, custom duration NOT provided. Page view is sent right away, duration is time spent from page load till now (or undefined if navigation timing is not supported).
4201
- * 4) overridePageViewDuration = false, custom duration is provided. Page view is sent right away with custom duration.
4202
- *
4203
- * In all cases page view performance is sent once (only for the 1st call of trackPageView), or not sent if navigation timing is not supported.
4204
- */
4205
- trackPageView(pageView: IPageViewTelemetry, customProperties?: {
4206
- [key: string]: any;
4207
- }): void;
4208
- }
4209
-
4210
4266
  /**
4211
4267
  * An instance of PageViewPerf represents: a page view with no performance data, a page view with performance data, or just the performance data of an earlier page request.
4212
4268
  */
@@ -4284,81 +4340,6 @@ declare namespace ApplicationInsights {
4284
4340
  }, cs4BaseData?: IPageViewPerformanceTelemetry);
4285
4341
  }
4286
4342
 
4287
- /**
4288
- * Class encapsulates sending page view performance telemetry.
4289
- */
4290
- class PageViewPerformanceManager {
4291
- private _logger;
4292
- private MAX_DURATION_ALLOWED;
4293
- constructor(core: IAppInsightsCore);
4294
- populatePageViewPerformanceEvent(pageViewPerformance: IPageViewPerformanceTelemetryInternal): void;
4295
- getPerformanceTiming(): PerformanceTiming | null;
4296
- getPerformanceNavigationTiming(): PerformanceNavigationTiming | null;
4297
- /**
4298
- * Returns true is window PerformanceNavigationTiming API is supported, false otherwise.
4299
- */
4300
- isPerformanceNavigationTimingSupported(): boolean;
4301
- /**
4302
- * Returns true is window performance timing API is supported, false otherwise.
4303
- */
4304
- isPerformanceTimingSupported(): PerformanceTiming;
4305
- /**
4306
- * As page loads different parts of performance timing numbers get set. When all of them are set we can report it.
4307
- * Returns true if ready, false otherwise.
4308
- */
4309
- isPerformanceTimingDataReady(): boolean;
4310
- /**
4311
- * This method tells if given durations should be excluded from collection.
4312
- */
4313
- shouldCollectDuration(...durations: number[]): boolean;
4314
- }
4315
-
4316
- class PageVisitData {
4317
- pageName: string;
4318
- pageUrl: string;
4319
- pageVisitStartTime: number;
4320
- pageVisitTime: number;
4321
- constructor(pageName: string, pageUrl: string);
4322
- }
4323
-
4324
- /**
4325
- * Used to track page visit durations
4326
- */
4327
- class PageVisitTimeManager {
4328
- private prevPageVisitDataKeyName;
4329
- private pageVisitTimeTrackingHandler;
4330
- private _logger;
4331
- /**
4332
- * Creates a new instance of PageVisitTimeManager
4333
- * @param pageVisitTimeTrackingHandler Delegate that will be called to send telemetry data to AI (when trackPreviousPageVisit is called)
4334
- * @returns {}
4335
- */
4336
- constructor(logger: IDiagnosticLogger, pageVisitTimeTrackingHandler: (pageName: string, pageUrl: string, pageVisitTime: number) => void);
4337
- /**
4338
- * Tracks the previous page visit time telemetry (if exists) and starts timing of new page visit time
4339
- * @param currentPageName Name of page to begin timing for visit duration
4340
- * @param currentPageUrl Url of page to begin timing for visit duration
4341
- */
4342
- trackPreviousPageVisit(currentPageName: string, currentPageUrl: string): void;
4343
- /**
4344
- * Stops timing of current page (if exists) and starts timing for duration of visit to pageName
4345
- * @param pageName Name of page to begin timing visit duration
4346
- * @returns {PageVisitData} Page visit data (including duration) of pageName from last call to start or restart, if exists. Null if not.
4347
- */
4348
- restartPageVisitTimer(pageName: string, pageUrl: string): PageVisitData;
4349
- /**
4350
- * Starts timing visit duration of pageName
4351
- * @param pageName
4352
- * @returns {}
4353
- */
4354
- startPageVisitTimer(pageName: string, pageUrl: string): void;
4355
- /**
4356
- * Stops timing of current page, if exists.
4357
- * @returns {PageVisitData} Page visit data (including duration) of pageName from call to start, if exists. Null if not.
4358
- */
4359
- stopPageVisitTimer(): PageVisitData;
4360
- }
4361
-
4362
4343
  function parseConnectionString(connectionString?: string): ConnectionString;
4363
4344
 
4364
4345
  class PerfEvent implements IPerfEvent {
@@ -4850,6 +4831,27 @@ declare namespace ApplicationInsights {
4850
4831
  SdkUnload = 50
4851
4832
  }
4852
4833
 
4834
+ /**
4835
+ * The TelemetryUpdateReason enumeration contains a set of bit-wise values that specify the reason for update request.
4836
+ */
4837
+ const enum TelemetryUpdateReason {
4838
+ /**
4839
+ * Unknown.
4840
+ */
4841
+ Unknown = 0,
4842
+ /**
4843
+ * The configuration has ben updated or changed
4844
+ */
4845
+ /**
4846
+ * One or more plugins have been added
4847
+ */
4848
+ PluginAdded = 16,
4849
+ /**
4850
+ * One or more plugins have been removed
4851
+ */
4852
+ PluginRemoved = 32
4853
+ }
4854
+
4853
4855
  class Trace extends MessageData implements ISerializable {
4854
4856
  static envelopeType: string;
4855
4857
  static dataType: string;