@microsoft/applicationinsights-core-js 2.8.0-beta.2203-06 → 2.8.0-beta.2203-09

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 (73) hide show
  1. package/browser/applicationinsights-core-js.integrity.json +9 -9
  2. package/browser/applicationinsights-core-js.js +23 -9
  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 +260 -12
  7. package/dist/applicationinsights-core-js.api.md +8 -4
  8. package/dist/applicationinsights-core-js.d.ts +47 -5
  9. package/dist/applicationinsights-core-js.js +23 -9
  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 +47 -5
  14. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
  15. package/dist-esm/JavaScriptSDK/BaseCore.js +13 -8
  16. package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
  17. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +2 -2
  18. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
  19. package/dist-esm/JavaScriptSDK/ChannelController.js +2 -1
  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 +1 -1
  23. package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
  24. package/dist-esm/JavaScriptSDK/DataCacheHelper.js +1 -1
  25. package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  26. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +1 -1
  27. package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
  28. package/dist-esm/JavaScriptSDK/EventHelpers.js +6 -2
  29. package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -1
  30. package/dist-esm/JavaScriptSDK/HelperFuncs.js +1 -1
  31. package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -1
  32. package/dist-esm/JavaScriptSDK/InternalConstants.js +1 -1
  33. package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
  34. package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
  35. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +1 -1
  36. package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
  37. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +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/applicationinsights-core-js.js +2 -2
  64. package/dist-esm/applicationinsights-core-js.js.map +1 -1
  65. package/package.json +1 -1
  66. package/src/JavaScriptSDK/BaseCore.ts +38 -8
  67. package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +1 -1
  68. package/src/JavaScriptSDK/ChannelController.ts +2 -0
  69. package/src/JavaScriptSDK/EventHelpers.ts +7 -1
  70. package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +22 -5
  71. package/types/JavaScriptSDK/BaseCore.d.ts +21 -1
  72. package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +20 -4
  73. package/types/applicationinsights-core-js.d.ts +1 -1
@@ -3731,7 +3731,7 @@
3731
3731
  {
3732
3732
  "kind": "Method",
3733
3733
  "canonicalReference": "@microsoft/applicationinsights-core-js!BaseCore#addPlugin:member(1)",
3734
- "docComment": "",
3734
+ "docComment": "/**\n * Add a new plugin to the installation\n *\n * @param plugin - The new plugin to add\n *\n * @param replaceExisting - should any existing plugin be replaced, default is false\n *\n * @param doAsync - Should the add be performed asynchronously\n *\n * @param addCb - [Optional] callback to call after the plugin has been added\n */\n",
3735
3735
  "excerptTokens": [
3736
3736
  {
3737
3737
  "kind": "Content",
@@ -3765,7 +3765,7 @@
3765
3765
  },
3766
3766
  {
3767
3767
  "kind": "Content",
3768
- "text": ", replaceExisting: "
3768
+ "text": ", replaceExisting?: "
3769
3769
  },
3770
3770
  {
3771
3771
  "kind": "Content",
@@ -3773,7 +3773,7 @@
3773
3773
  },
3774
3774
  {
3775
3775
  "kind": "Content",
3776
- "text": ", doAsync: "
3776
+ "text": ", doAsync?: "
3777
3777
  },
3778
3778
  {
3779
3779
  "kind": "Content",
@@ -4064,6 +4064,82 @@
4064
4064
  "parameters": [],
4065
4065
  "name": "evtNamespace"
4066
4066
  },
4067
+ {
4068
+ "kind": "Method",
4069
+ "canonicalReference": "@microsoft/applicationinsights-core-js!BaseCore#flush:member(1)",
4070
+ "docComment": "/**\n * Flush and send any batched / cached data immediately\n *\n * @param async - send data asynchronously when true (defaults to true)\n *\n * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called. If the caller doesn't return true the caller should assume that it may never be called.\n *\n * @param sendReason - specify the reason that you are calling \"flush\" defaults to ManualFlush (1) if not specified\n *\n * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called\n */\n",
4071
+ "excerptTokens": [
4072
+ {
4073
+ "kind": "Content",
4074
+ "text": "flush(isAsync?: "
4075
+ },
4076
+ {
4077
+ "kind": "Content",
4078
+ "text": "boolean"
4079
+ },
4080
+ {
4081
+ "kind": "Content",
4082
+ "text": ", callBack?: "
4083
+ },
4084
+ {
4085
+ "kind": "Content",
4086
+ "text": "(flushComplete?: boolean) => void"
4087
+ },
4088
+ {
4089
+ "kind": "Content",
4090
+ "text": ", sendReason?: "
4091
+ },
4092
+ {
4093
+ "kind": "Reference",
4094
+ "text": "SendRequestReason",
4095
+ "canonicalReference": "@microsoft/applicationinsights-core-js!SendRequestReason:enum"
4096
+ },
4097
+ {
4098
+ "kind": "Content",
4099
+ "text": "): "
4100
+ },
4101
+ {
4102
+ "kind": "Content",
4103
+ "text": "void"
4104
+ },
4105
+ {
4106
+ "kind": "Content",
4107
+ "text": ";"
4108
+ }
4109
+ ],
4110
+ "isOptional": false,
4111
+ "isStatic": false,
4112
+ "returnTypeTokenRange": {
4113
+ "startIndex": 7,
4114
+ "endIndex": 8
4115
+ },
4116
+ "releaseTag": "Public",
4117
+ "overloadIndex": 1,
4118
+ "parameters": [
4119
+ {
4120
+ "parameterName": "isAsync",
4121
+ "parameterTypeTokenRange": {
4122
+ "startIndex": 1,
4123
+ "endIndex": 2
4124
+ }
4125
+ },
4126
+ {
4127
+ "parameterName": "callBack",
4128
+ "parameterTypeTokenRange": {
4129
+ "startIndex": 3,
4130
+ "endIndex": 4
4131
+ }
4132
+ },
4133
+ {
4134
+ "parameterName": "sendReason",
4135
+ "parameterTypeTokenRange": {
4136
+ "startIndex": 5,
4137
+ "endIndex": 6
4138
+ }
4139
+ }
4140
+ ],
4141
+ "name": "flush"
4142
+ },
4067
4143
  {
4068
4144
  "kind": "Method",
4069
4145
  "canonicalReference": "@microsoft/applicationinsights-core-js!BaseCore#getCookieMgr:member(1)",
@@ -4746,7 +4822,7 @@
4746
4822
  {
4747
4823
  "kind": "Method",
4748
4824
  "canonicalReference": "@microsoft/applicationinsights-core-js!BaseCore#unload:member(1)",
4749
- "docComment": "/**\n * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous unload call return `true` stating that all plugins reported that they also unloaded, the recommended approach is to create a new instance and initialize that instance. This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable to successfully remove any global references or they may just be completing the unload process asynchronously.\n */\n",
4825
+ "docComment": "/**\n * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous unload call return `true` stating that all plugins reported that they also unloaded, the recommended approach is to create a new instance and initialize that instance. This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable to successfully remove any global references or they may just be completing the unload process asynchronously.\n *\n * @param isAsync - Can the unload be performed asynchronously (default)\n *\n * @param unloadComplete - An optional callback that will be called once the unload has completed\n *\n * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.\n */\n",
4750
4826
  "excerptTokens": [
4751
4827
  {
4752
4828
  "kind": "Content",
@@ -8501,7 +8577,7 @@
8501
8577
  {
8502
8578
  "kind": "MethodSignature",
8503
8579
  "canonicalReference": "@microsoft/applicationinsights-core-js!IAppInsightsCore#addPlugin:member(1)",
8504
- "docComment": "/**\n * Add a new plugin to the installation\n *\n * @param plugin - The new plugin to add\n *\n * @param replaceExisting - should any existing plugin be replaced\n *\n * @param doAsync - Should the add be performed asynchronously\n */\n",
8580
+ "docComment": "/**\n * Add a new plugin to the installation\n *\n * @param plugin - The new plugin to add\n *\n * @param replaceExisting - should any existing plugin be replaced, default is false\n *\n * @param doAsync - Should the add be performed asynchronously\n *\n * @param addCb - [Optional] callback to call after the plugin has been added\n */\n",
8505
8581
  "excerptTokens": [
8506
8582
  {
8507
8583
  "kind": "Content",
@@ -8535,7 +8611,7 @@
8535
8611
  },
8536
8612
  {
8537
8613
  "kind": "Content",
8538
- "text": ", replaceExisting: "
8614
+ "text": ", replaceExisting?: "
8539
8615
  },
8540
8616
  {
8541
8617
  "kind": "Content",
@@ -8543,7 +8619,7 @@
8543
8619
  },
8544
8620
  {
8545
8621
  "kind": "Content",
8546
- "text": ", doAsync: "
8622
+ "text": ", doAsync?: "
8547
8623
  },
8548
8624
  {
8549
8625
  "kind": "Content",
@@ -8772,6 +8848,96 @@
8772
8848
  "parameters": [],
8773
8849
  "name": "evtNamespace"
8774
8850
  },
8851
+ {
8852
+ "kind": "MethodSignature",
8853
+ "canonicalReference": "@microsoft/applicationinsights-core-js!IAppInsightsCore#flush:member(1)",
8854
+ "docComment": "/**\n * Flush and send any batched / cached data immediately\n *\n * @param async - send data asynchronously when true (defaults to true)\n *\n * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called. If the caller doesn't return true the caller should assume that it may never be called.\n *\n * @param sendReason - specify the reason that you are calling \"flush\" defaults to ManualFlush (1) if not specified\n *\n * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.\n *\n * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called\n */\n",
8855
+ "excerptTokens": [
8856
+ {
8857
+ "kind": "Content",
8858
+ "text": "flush(isAsync?: "
8859
+ },
8860
+ {
8861
+ "kind": "Content",
8862
+ "text": "boolean"
8863
+ },
8864
+ {
8865
+ "kind": "Content",
8866
+ "text": ", callBack?: "
8867
+ },
8868
+ {
8869
+ "kind": "Content",
8870
+ "text": "(flushComplete?: boolean) => void"
8871
+ },
8872
+ {
8873
+ "kind": "Content",
8874
+ "text": ", sendReason?: "
8875
+ },
8876
+ {
8877
+ "kind": "Reference",
8878
+ "text": "SendRequestReason",
8879
+ "canonicalReference": "@microsoft/applicationinsights-core-js!SendRequestReason:enum"
8880
+ },
8881
+ {
8882
+ "kind": "Content",
8883
+ "text": ", cbTimeout?: "
8884
+ },
8885
+ {
8886
+ "kind": "Content",
8887
+ "text": "number"
8888
+ },
8889
+ {
8890
+ "kind": "Content",
8891
+ "text": "): "
8892
+ },
8893
+ {
8894
+ "kind": "Content",
8895
+ "text": "boolean | void"
8896
+ },
8897
+ {
8898
+ "kind": "Content",
8899
+ "text": ";"
8900
+ }
8901
+ ],
8902
+ "isOptional": false,
8903
+ "returnTypeTokenRange": {
8904
+ "startIndex": 9,
8905
+ "endIndex": 10
8906
+ },
8907
+ "releaseTag": "Public",
8908
+ "overloadIndex": 1,
8909
+ "parameters": [
8910
+ {
8911
+ "parameterName": "isAsync",
8912
+ "parameterTypeTokenRange": {
8913
+ "startIndex": 1,
8914
+ "endIndex": 2
8915
+ }
8916
+ },
8917
+ {
8918
+ "parameterName": "callBack",
8919
+ "parameterTypeTokenRange": {
8920
+ "startIndex": 3,
8921
+ "endIndex": 4
8922
+ }
8923
+ },
8924
+ {
8925
+ "parameterName": "sendReason",
8926
+ "parameterTypeTokenRange": {
8927
+ "startIndex": 5,
8928
+ "endIndex": 6
8929
+ }
8930
+ },
8931
+ {
8932
+ "parameterName": "cbTimeout",
8933
+ "parameterTypeTokenRange": {
8934
+ "startIndex": 7,
8935
+ "endIndex": 8
8936
+ }
8937
+ }
8938
+ ],
8939
+ "name": "flush"
8940
+ },
8775
8941
  {
8776
8942
  "kind": "MethodSignature",
8777
8943
  "canonicalReference": "@microsoft/applicationinsights-core-js!IAppInsightsCore#getCookieMgr:member(1)",
@@ -9336,7 +9502,7 @@
9336
9502
  {
9337
9503
  "kind": "MethodSignature",
9338
9504
  "canonicalReference": "@microsoft/applicationinsights-core-js!IAppInsightsCore#unload:member(1)",
9339
- "docComment": "/**\n * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous unload call return `true` stating that all plugins reported that they also unloaded, the recommended approach is to create a new instance and initialize that instance. This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable to successfully remove any global references or they may just be completing the unload process asynchronously.\n */\n",
9505
+ "docComment": "/**\n * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous unload call return `true` stating that all plugins reported that they also unloaded, the recommended approach is to create a new instance and initialize that instance. This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable to successfully remove any global references or they may just be completing the unload process asynchronously.\n *\n * @param isAsync - Can the unload be performed asynchronously (default)\n *\n * @param unloadComplete - An optional callback that will be called once the unload has completed\n *\n * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.\n */\n",
9340
9506
  "excerptTokens": [
9341
9507
  {
9342
9508
  "kind": "Content",
@@ -9352,7 +9518,24 @@
9352
9518
  },
9353
9519
  {
9354
9520
  "kind": "Content",
9355
- "text": "() => void"
9521
+ "text": "(unloadState: "
9522
+ },
9523
+ {
9524
+ "kind": "Reference",
9525
+ "text": "ITelemetryUnloadState",
9526
+ "canonicalReference": "@microsoft/applicationinsights-core-js!ITelemetryUnloadState:interface"
9527
+ },
9528
+ {
9529
+ "kind": "Content",
9530
+ "text": ") => void"
9531
+ },
9532
+ {
9533
+ "kind": "Content",
9534
+ "text": ", cbTimeout?: "
9535
+ },
9536
+ {
9537
+ "kind": "Content",
9538
+ "text": "number"
9356
9539
  },
9357
9540
  {
9358
9541
  "kind": "Content",
@@ -9369,8 +9552,8 @@
9369
9552
  ],
9370
9553
  "isOptional": false,
9371
9554
  "returnTypeTokenRange": {
9372
- "startIndex": 5,
9373
- "endIndex": 6
9555
+ "startIndex": 9,
9556
+ "endIndex": 10
9374
9557
  },
9375
9558
  "releaseTag": "Public",
9376
9559
  "overloadIndex": 1,
@@ -9386,7 +9569,14 @@
9386
9569
  "parameterName": "unloadComplete",
9387
9570
  "parameterTypeTokenRange": {
9388
9571
  "startIndex": 3,
9389
- "endIndex": 4
9572
+ "endIndex": 6
9573
+ }
9574
+ },
9575
+ {
9576
+ "parameterName": "cbTimeout",
9577
+ "parameterTypeTokenRange": {
9578
+ "startIndex": 7,
9579
+ "endIndex": 8
9390
9580
  }
9391
9581
  }
9392
9582
  ],
@@ -20897,6 +21087,64 @@
20897
21087
  ],
20898
21088
  "name": "removePageHideEventListener"
20899
21089
  },
21090
+ {
21091
+ "kind": "Function",
21092
+ "canonicalReference": "@microsoft/applicationinsights-core-js!removePageShowEventListener:function(1)",
21093
+ "docComment": "/**\n * Removes the pageShow event listeners added by addPageShowEventListener, because the 'visibilitychange' uses an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.\n *\n * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')\n *\n * @param evtNamespace - The unique namespace used when calling addPageShowEventListener\n */\n",
21094
+ "excerptTokens": [
21095
+ {
21096
+ "kind": "Content",
21097
+ "text": "export declare function removePageShowEventListener(listener: "
21098
+ },
21099
+ {
21100
+ "kind": "Content",
21101
+ "text": "any"
21102
+ },
21103
+ {
21104
+ "kind": "Content",
21105
+ "text": ", evtNamespace?: "
21106
+ },
21107
+ {
21108
+ "kind": "Content",
21109
+ "text": "string | string[]"
21110
+ },
21111
+ {
21112
+ "kind": "Content",
21113
+ "text": "): "
21114
+ },
21115
+ {
21116
+ "kind": "Content",
21117
+ "text": "void"
21118
+ },
21119
+ {
21120
+ "kind": "Content",
21121
+ "text": ";"
21122
+ }
21123
+ ],
21124
+ "returnTypeTokenRange": {
21125
+ "startIndex": 5,
21126
+ "endIndex": 6
21127
+ },
21128
+ "releaseTag": "Public",
21129
+ "overloadIndex": 1,
21130
+ "parameters": [
21131
+ {
21132
+ "parameterName": "listener",
21133
+ "parameterTypeTokenRange": {
21134
+ "startIndex": 1,
21135
+ "endIndex": 2
21136
+ }
21137
+ },
21138
+ {
21139
+ "parameterName": "evtNamespace",
21140
+ "parameterTypeTokenRange": {
21141
+ "startIndex": 3,
21142
+ "endIndex": 4
21143
+ }
21144
+ }
21145
+ ],
21146
+ "name": "removePageShowEventListener"
21147
+ },
20900
21148
  {
20901
21149
  "kind": "Function",
20902
21150
  "canonicalReference": "@microsoft/applicationinsights-core-js!removePageUnloadEventListener:function(1)",
@@ -60,8 +60,7 @@ export function attachEvent(obj: any, eventNameWithoutOn: string, handlerRef: an
60
60
  export class BaseCore implements IAppInsightsCore {
61
61
  constructor();
62
62
  addNotificationListener(listener: INotificationListener): void;
63
- // (undocumented)
64
- addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
63
+ addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
65
64
  addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
66
65
  addUnloadCb(handler: UnloadHandler): void;
67
66
  // (undocumented)
@@ -73,6 +72,7 @@ export class BaseCore implements IAppInsightsCore {
73
72
  evtNamespace(): string;
74
73
  // (undocumented)
75
74
  _extensions: IPlugin[];
75
+ flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
76
76
  getCookieMgr(): ICookieMgr;
77
77
  // (undocumented)
78
78
  getNotifyMgr(): INotificationManager;
@@ -479,12 +479,13 @@ export function hasWindow(): boolean;
479
479
  // @public (undocumented)
480
480
  export interface IAppInsightsCore extends IPerfManagerProvider {
481
481
  addNotificationListener?(listener: INotificationListener): void;
482
- addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
482
+ addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
483
483
  addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
484
484
  addUnloadCb(handler: UnloadHandler): void;
485
485
  // (undocumented)
486
486
  config: IConfiguration;
487
487
  evtNamespace(): string;
488
+ flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
488
489
  getCookieMgr(): ICookieMgr;
489
490
  getNotifyMgr(): INotificationManager;
490
491
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
@@ -504,7 +505,7 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
504
505
  stopPollingInternalLogs?(): void;
505
506
  // (undocumented)
506
507
  track(telemetryItem: ITelemetryItem): void;
507
- unload(isAsync?: boolean, unloadComplete?: () => void): void;
508
+ unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
508
509
  }
509
510
 
510
511
  // @public (undocumented)
@@ -1199,6 +1200,9 @@ export function removeEventListeners(events: string[], listener: any, evtNamespa
1199
1200
  // @public
1200
1201
  export function removePageHideEventListener(listener: any, evtNamespace?: string | string[]): void;
1201
1202
 
1203
+ // @public
1204
+ export function removePageShowEventListener(listener: any, evtNamespace?: string | string[]): void;
1205
+
1202
1206
  // @public
1203
1207
  export function removePageUnloadEventListener(listener: any, evtNamespace?: string | string[]): void;
1204
1208
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-06
2
+ * Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2203-09
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -198,10 +198,20 @@ declare namespace ApplicationInsights {
198
198
  * approach is to create a new instance and initialize that instance.
199
199
  * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
200
200
  * to successfully remove any global references or they may just be completing the unload process asynchronously.
201
+ * @param isAsync - Can the unload be performed asynchronously (default)
202
+ * @param unloadComplete - An optional callback that will be called once the unload has completed
203
+ * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
201
204
  */
202
205
  unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
203
206
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
204
- addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
207
+ /**
208
+ * Add a new plugin to the installation
209
+ * @param plugin - The new plugin to add
210
+ * @param replaceExisting - should any existing plugin be replaced, default is false
211
+ * @param doAsync - Should the add be performed asynchronously
212
+ * @param addCb - [Optional] callback to call after the plugin has been added
213
+ */
214
+ addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
205
215
  /**
206
216
  * Returns the unique event namespace that should be used
207
217
  */
@@ -211,6 +221,15 @@ declare namespace ApplicationInsights {
211
221
  * @param handler - the handler
212
222
  */
213
223
  addUnloadCb(handler: UnloadHandler): void;
224
+ /**
225
+ * Flush and send any batched / cached data immediately
226
+ * @param async - send data asynchronously when true (defaults to true)
227
+ * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
228
+ * If the caller doesn't return true the caller should assume that it may never be called.
229
+ * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
230
+ * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
231
+ */
232
+ flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
214
233
  protected releaseQueue(): void;
215
234
  /**
216
235
  * Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
@@ -838,8 +857,11 @@ declare namespace ApplicationInsights {
838
857
  * approach is to create a new instance and initialize that instance.
839
858
  * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
840
859
  * to successfully remove any global references or they may just be completing the unload process asynchronously.
860
+ * @param isAsync - Can the unload be performed asynchronously (default)
861
+ * @param unloadComplete - An optional callback that will be called once the unload has completed
862
+ * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
841
863
  */
842
- unload(isAsync?: boolean, unloadComplete?: () => void): void;
864
+ unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
843
865
  /**
844
866
  * Find and return the (first) plugin with the specified identifier if present
845
867
  * @param pluginIdentifier
@@ -848,10 +870,11 @@ declare namespace ApplicationInsights {
848
870
  /**
849
871
  * Add a new plugin to the installation
850
872
  * @param plugin - The new plugin to add
851
- * @param replaceExisting - should any existing plugin be replaced
873
+ * @param replaceExisting - should any existing plugin be replaced, default is false
852
874
  * @param doAsync - Should the add be performed asynchronously
875
+ * @param addCb - [Optional] callback to call after the plugin has been added
853
876
  */
854
- addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
877
+ addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
855
878
  /**
856
879
  * Returns the unique event namespace that should be used when registering events
857
880
  */
@@ -861,6 +884,16 @@ declare namespace ApplicationInsights {
861
884
  * @param handler - the handler
862
885
  */
863
886
  addUnloadCb(handler: UnloadHandler): void;
887
+ /**
888
+ * Flush and send any batched / cached data immediately
889
+ * @param async - send data asynchronously when true (defaults to true)
890
+ * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
891
+ * If the caller doesn't return true the caller should assume that it may never be called.
892
+ * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
893
+ * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
894
+ * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
895
+ */
896
+ flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
864
897
  }
865
898
 
866
899
  interface IBaseProcessingContext {
@@ -2605,6 +2638,15 @@ declare namespace ApplicationInsights {
2605
2638
  */
2606
2639
  function removePageHideEventListener(listener: any, evtNamespace?: string | string[]): void;
2607
2640
 
2641
+ /**
2642
+ * Removes the pageShow event listeners added by addPageShowEventListener, because the 'visibilitychange' uses
2643
+ * an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageShowEventListener
2644
+ * as the remove ignores the listener argument for the 'visibilitychange' event.
2645
+ * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')
2646
+ * @param evtNamespace - The unique namespace used when calling addPageShowEventListener
2647
+ */
2648
+ function removePageShowEventListener(listener: any, evtNamespace?: string | string[]): void;
2649
+
2608
2650
  /**
2609
2651
  * Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,
2610
2652
  * addEventListeners, addPageUnloadEventListener or addPageHideEventListener.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Core, 2.8.0-beta.2203-06
2
+ * Application Insights JavaScript SDK - Core, 2.8.0-beta.2203-09
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -2437,6 +2437,7 @@
2437
2437
  doneIterating = true;
2438
2438
  doCallback();
2439
2439
  });
2440
+ return true;
2440
2441
  },
2441
2442
  _a._setQueue = function (queue) {
2442
2443
  channelQueue = queue;
@@ -2793,7 +2794,7 @@
2793
2794
  _configExtensions.push.apply(_configExtensions, __spreadArrayFn(__spreadArrayFn([], extensions, false), config.extensions));
2794
2795
  _channelConfig = (config || {}).channels;
2795
2796
  _initPluginChain(config, null);
2796
- if (_self.getTransmissionControls().length === 0) {
2797
+ if (!_channelQueue || _channelQueue.length === 0) {
2797
2798
  throwError("No channels available");
2798
2799
  }
2799
2800
  _isInitialized = true;
@@ -2914,16 +2915,12 @@
2914
2915
  _self.stopPollingInternalLogs();
2915
2916
  processUnloadCtx.processNext(unloadState);
2916
2917
  }
2917
- if (_channelControl) {
2918
- _channelControl.flush(isAsync, _doUnload, 6 , cbTimeout);
2919
- }
2920
- else {
2921
- _doUnload(true);
2918
+ if (!_flushChannels(isAsync, _doUnload, 6 , cbTimeout)) {
2919
+ _doUnload(false);
2922
2920
  }
2923
2921
  };
2924
2922
  _self.getPlugin = _getPlugin;
2925
2923
  _self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {
2926
- if (isAsync === void 0) { isAsync = true; }
2927
2924
  if (!plugin) {
2928
2925
  addCb && addCb(false);
2929
2926
  _logOrThrowError(strValidationError);
@@ -2968,6 +2965,7 @@
2968
2965
  _self.evtNamespace = function () {
2969
2966
  return _evtNamespace;
2970
2967
  };
2968
+ _self.flush = _flushChannels;
2971
2969
  proxyFunctionAs(_self, "addUnloadCb", function () { return _unloadHandlers; }, "add");
2972
2970
  function _initDefaults() {
2973
2971
  _isInitialized = false;
@@ -3133,6 +3131,13 @@
3133
3131
  queue.length = 0;
3134
3132
  }
3135
3133
  }
3134
+ function _flushChannels(isAsync, callBack, sendReason, cbTimeout) {
3135
+ if (_channelControl) {
3136
+ return _channelControl.flush(isAsync, callBack, sendReason || 6 , cbTimeout);
3137
+ }
3138
+ callBack && callBack(false);
3139
+ return true;
3140
+ }
3136
3141
  function _initDebugListener(config) {
3137
3142
  if (config.disableDbgExt === true && _debugListener) {
3138
3143
  _notificationManager[strRemoveNotificationListener](_debugListener);
@@ -3289,6 +3294,8 @@
3289
3294
  var strBeforeUnload = "beforeunload";
3290
3295
  var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
3291
3296
  var strPageShowNamespace = createUniqueNamespace("aiEvtPageShow");
3297
+ var rRemoveEmptyNs = /\.[\.]+/g;
3298
+ var rRemoveTrailingEmptyNs = /[\.]+$/;
3292
3299
  var _guid = 1;
3293
3300
  var elmNodeData = createElmNodeData("events");
3294
3301
  var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
@@ -3326,7 +3333,7 @@
3326
3333
  var parsedEvent = (eventNamespace.exec(eventName) || []);
3327
3334
  return {
3328
3335
  type: parsedEvent[1],
3329
- ns: ((parsedEvent[2] || "").split(".").sort()).join(".")
3336
+ ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
3330
3337
  };
3331
3338
  }
3332
3339
  function __getRegisteredEvents(target, eventName, evtNamespace) {
@@ -3417,6 +3424,7 @@
3417
3424
  else {
3418
3425
  newNamespaces = [theNamespace, namespaces];
3419
3426
  }
3427
+ newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
3420
3428
  }
3421
3429
  else {
3422
3430
  newNamespaces = theNamespace;
@@ -3573,6 +3581,11 @@
3573
3581
  }
3574
3582
  return pageShowAdded;
3575
3583
  }
3584
+ function removePageShowEventListener(listener, evtNamespace) {
3585
+ var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
3586
+ removeEventListeners([strPageShow], listener, newNamespaces);
3587
+ removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
3588
+ }
3576
3589
 
3577
3590
  var _cookieMgrs = null;
3578
3591
  var _canUseCookies;
@@ -4069,6 +4082,7 @@
4069
4082
  exports.removeEventHandler = removeEventHandler;
4070
4083
  exports.removeEventListeners = removeEventListeners;
4071
4084
  exports.removePageHideEventListener = removePageHideEventListener;
4085
+ exports.removePageShowEventListener = removePageShowEventListener;
4072
4086
  exports.removePageUnloadEventListener = removePageUnloadEventListener;
4073
4087
  exports.safeGetCookieMgr = safeGetCookieMgr;
4074
4088
  exports.safeGetLogger = safeGetLogger;