@microsoft/applicationinsights-core-js 2.7.1-nightly.202110-03 → 2.7.1-nightly.202110-07

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 (59) hide show
  1. package/browser/applicationinsights-core-js.integrity.json +9 -9
  2. package/browser/applicationinsights-core-js.js +71 -2
  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 +300 -1
  7. package/dist/applicationinsights-core-js.api.md +15 -0
  8. package/dist/applicationinsights-core-js.d.ts +52 -1
  9. package/dist/applicationinsights-core-js.js +71 -2
  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 +52 -1
  14. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
  15. package/dist-esm/JavaScriptSDK/BaseCore.js +1 -1
  16. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
  17. package/dist-esm/JavaScriptSDK/ChannelController.js +1 -1
  18. package/dist-esm/JavaScriptSDK/Constants.js +1 -1
  19. package/dist-esm/JavaScriptSDK/CookieMgr.js +1 -1
  20. package/dist-esm/JavaScriptSDK/CoreUtils.js +100 -1
  21. package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
  22. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +1 -1
  23. package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
  24. package/dist-esm/JavaScriptSDK/HelperFuncs.js +1 -1
  25. package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -1
  26. package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
  27. package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
  28. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +1 -1
  29. package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
  30. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +1 -1
  31. package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js +1 -1
  32. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
  33. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +3 -2
  34. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
  35. package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  36. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
  37. package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  38. package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
  39. package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
  40. package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
  41. package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
  42. package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
  43. package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
  44. package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
  45. package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
  46. package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
  47. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  48. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  49. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
  50. package/dist-esm/applicationinsights-core-js.js +2 -2
  51. package/dist-esm/applicationinsights-core-js.js.map +1 -1
  52. package/package.json +1 -1
  53. package/src/JavaScriptSDK/CoreUtils.ts +116 -0
  54. package/src/JavaScriptSDK.Enums/LoggingEnums.ts +2 -1
  55. package/src/JavaScriptSDK.Interfaces/IConfiguration.ts +14 -0
  56. package/types/JavaScriptSDK/CoreUtils.d.ts +34 -0
  57. package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +1 -0
  58. package/types/JavaScriptSDK.Interfaces/IConfiguration.d.ts +12 -0
  59. package/types/applicationinsights-core-js.d.ts +1 -1
@@ -385,7 +385,7 @@
385
385
  },
386
386
  {
387
387
  "kind": "Content",
388
- "text": "{\n BrowserDoesNotSupportLocalStorage: number;\n BrowserCannotReadLocalStorage: number;\n BrowserCannotReadSessionStorage: number;\n BrowserCannotWriteLocalStorage: number;\n BrowserCannotWriteSessionStorage: number;\n BrowserFailedRemovalFromLocalStorage: number;\n BrowserFailedRemovalFromSessionStorage: number;\n CannotSendEmptyTelemetry: number;\n ClientPerformanceMathError: number;\n ErrorParsingAISessionCookie: number;\n ErrorPVCalc: number;\n ExceptionWhileLoggingError: number;\n FailedAddingTelemetryToBuffer: number;\n FailedMonitorAjaxAbort: number;\n FailedMonitorAjaxDur: number;\n FailedMonitorAjaxOpen: number;\n FailedMonitorAjaxRSC: number;\n FailedMonitorAjaxSend: number;\n FailedMonitorAjaxGetCorrelationHeader: number;\n FailedToAddHandlerForOnBeforeUnload: number;\n FailedToSendQueuedTelemetry: number;\n FailedToReportDataLoss: number;\n FlushFailed: number;\n MessageLimitPerPVExceeded: number;\n MissingRequiredFieldSpecification: number;\n NavigationTimingNotSupported: number;\n OnError: number;\n SessionRenewalDateIsZero: number;\n SenderNotInitialized: number;\n StartTrackEventFailed: number;\n StopTrackEventFailed: number;\n StartTrackFailed: number;\n StopTrackFailed: number;\n TelemetrySampledAndNotSent: number;\n TrackEventFailed: number;\n TrackExceptionFailed: number;\n TrackMetricFailed: number;\n TrackPVFailed: number;\n TrackPVFailedCalc: number;\n TrackTraceFailed: number;\n TransmissionFailed: number;\n FailedToSetStorageBuffer: number;\n FailedToRestoreStorageBuffer: number;\n InvalidBackendResponse: number;\n FailedToFixDepricatedValues: number;\n InvalidDurationValue: number;\n TelemetryEnvelopeInvalid: number;\n CreateEnvelopeError: number;\n CannotSerializeObject: number;\n CannotSerializeObjectNonSerializable: number;\n CircularReferenceDetected: number;\n ClearAuthContextFailed: number;\n ExceptionTruncated: number;\n IllegalCharsInName: number;\n ItemNotInArray: number;\n MaxAjaxPerPVExceeded: number;\n MessageTruncated: number;\n NameTooLong: number;\n SampleRateOutOfRange: number;\n SetAuthContextFailed: number;\n SetAuthContextFailedAccountName: number;\n StringValueTooLong: number;\n StartCalledMoreThanOnce: number;\n StopCalledWithoutStart: number;\n TelemetryInitializerFailed: number;\n TrackArgumentsNotSpecified: number;\n UrlTooLong: number;\n SessionStorageBufferFull: number;\n CannotAccessCookie: number;\n IdTooLong: number;\n InvalidEvent: number;\n FailedMonitorAjaxSetRequestHeader: number;\n SendBrowserInfoOnUserInit: number;\n PluginException: number;\n NotificationException: number;\n SnippetScriptLoadFailure: number;\n InvalidInstrumentationKey: number;\n CannotParseAiBlobValue: number;\n InvalidContentBlob: number;\n TrackPageActionEventFailed: number;\n FailedAddingCustomDefinedRequestContext: number;\n}"
388
+ "text": "{\n BrowserDoesNotSupportLocalStorage: number;\n BrowserCannotReadLocalStorage: number;\n BrowserCannotReadSessionStorage: number;\n BrowserCannotWriteLocalStorage: number;\n BrowserCannotWriteSessionStorage: number;\n BrowserFailedRemovalFromLocalStorage: number;\n BrowserFailedRemovalFromSessionStorage: number;\n CannotSendEmptyTelemetry: number;\n ClientPerformanceMathError: number;\n ErrorParsingAISessionCookie: number;\n ErrorPVCalc: number;\n ExceptionWhileLoggingError: number;\n FailedAddingTelemetryToBuffer: number;\n FailedMonitorAjaxAbort: number;\n FailedMonitorAjaxDur: number;\n FailedMonitorAjaxOpen: number;\n FailedMonitorAjaxRSC: number;\n FailedMonitorAjaxSend: number;\n FailedMonitorAjaxGetCorrelationHeader: number;\n FailedToAddHandlerForOnBeforeUnload: number;\n FailedToSendQueuedTelemetry: number;\n FailedToReportDataLoss: number;\n FlushFailed: number;\n MessageLimitPerPVExceeded: number;\n MissingRequiredFieldSpecification: number;\n NavigationTimingNotSupported: number;\n OnError: number;\n SessionRenewalDateIsZero: number;\n SenderNotInitialized: number;\n StartTrackEventFailed: number;\n StopTrackEventFailed: number;\n StartTrackFailed: number;\n StopTrackFailed: number;\n TelemetrySampledAndNotSent: number;\n TrackEventFailed: number;\n TrackExceptionFailed: number;\n TrackMetricFailed: number;\n TrackPVFailed: number;\n TrackPVFailedCalc: number;\n TrackTraceFailed: number;\n TransmissionFailed: number;\n FailedToSetStorageBuffer: number;\n FailedToRestoreStorageBuffer: number;\n InvalidBackendResponse: number;\n FailedToFixDepricatedValues: number;\n InvalidDurationValue: number;\n TelemetryEnvelopeInvalid: number;\n CreateEnvelopeError: number;\n CannotSerializeObject: number;\n CannotSerializeObjectNonSerializable: number;\n CircularReferenceDetected: number;\n ClearAuthContextFailed: number;\n ExceptionTruncated: number;\n IllegalCharsInName: number;\n ItemNotInArray: number;\n MaxAjaxPerPVExceeded: number;\n MessageTruncated: number;\n NameTooLong: number;\n SampleRateOutOfRange: number;\n SetAuthContextFailed: number;\n SetAuthContextFailedAccountName: number;\n StringValueTooLong: number;\n StartCalledMoreThanOnce: number;\n StopCalledWithoutStart: number;\n TelemetryInitializerFailed: number;\n TrackArgumentsNotSpecified: number;\n UrlTooLong: number;\n SessionStorageBufferFull: number;\n CannotAccessCookie: number;\n IdTooLong: number;\n InvalidEvent: number;\n FailedMonitorAjaxSetRequestHeader: number;\n SendBrowserInfoOnUserInit: number;\n PluginException: number;\n NotificationException: number;\n SnippetScriptLoadFailure: number;\n InvalidInstrumentationKey: number;\n CannotParseAiBlobValue: number;\n InvalidContentBlob: number;\n TrackPageActionEventFailed: number;\n FailedAddingCustomDefinedRequestContext: number;\n InMemoryStorageBufferFull: number;\n}"
389
389
  }
390
390
  ],
391
391
  "releaseTag": "Public",
@@ -514,6 +514,253 @@
514
514
  ],
515
515
  "name": "addEventHandler"
516
516
  },
517
+ {
518
+ "kind": "Function",
519
+ "canonicalReference": "@microsoft/applicationinsights-core-js!addEventListeners:function(1)",
520
+ "docComment": "/**\n * Bind the listener to the array of events\n *\n * @param events - An string array of event names to bind the listener to\n *\n * @param listener - The event callback to call when the event is triggered\n *\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\n *\n * @returns true - when at least one of the events was registered otherwise false\n */\n",
521
+ "excerptTokens": [
522
+ {
523
+ "kind": "Content",
524
+ "text": "export declare function addEventListeners(events: "
525
+ },
526
+ {
527
+ "kind": "Content",
528
+ "text": "string[]"
529
+ },
530
+ {
531
+ "kind": "Content",
532
+ "text": ", listener: "
533
+ },
534
+ {
535
+ "kind": "Content",
536
+ "text": "any"
537
+ },
538
+ {
539
+ "kind": "Content",
540
+ "text": ", excludeEvents?: "
541
+ },
542
+ {
543
+ "kind": "Content",
544
+ "text": "string[]"
545
+ },
546
+ {
547
+ "kind": "Content",
548
+ "text": "): "
549
+ },
550
+ {
551
+ "kind": "Content",
552
+ "text": "boolean"
553
+ },
554
+ {
555
+ "kind": "Content",
556
+ "text": ";"
557
+ }
558
+ ],
559
+ "returnTypeTokenRange": {
560
+ "startIndex": 7,
561
+ "endIndex": 8
562
+ },
563
+ "releaseTag": "Public",
564
+ "overloadIndex": 1,
565
+ "parameters": [
566
+ {
567
+ "parameterName": "events",
568
+ "parameterTypeTokenRange": {
569
+ "startIndex": 1,
570
+ "endIndex": 2
571
+ }
572
+ },
573
+ {
574
+ "parameterName": "listener",
575
+ "parameterTypeTokenRange": {
576
+ "startIndex": 3,
577
+ "endIndex": 4
578
+ }
579
+ },
580
+ {
581
+ "parameterName": "excludeEvents",
582
+ "parameterTypeTokenRange": {
583
+ "startIndex": 5,
584
+ "endIndex": 6
585
+ }
586
+ }
587
+ ],
588
+ "name": "addEventListeners"
589
+ },
590
+ {
591
+ "kind": "Function",
592
+ "canonicalReference": "@microsoft/applicationinsights-core-js!addPageHideEventListener:function(1)",
593
+ "docComment": "/**\n * Listen to the pagehide and visibility changing to 'hidden' events\n *\n * @param listener - The event callback to call when a page hide event is triggered\n *\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be. Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide\n *\n * @returns true - when at least one of the events was registered otherwise false\n */\n",
594
+ "excerptTokens": [
595
+ {
596
+ "kind": "Content",
597
+ "text": "export declare function addPageHideEventListener(listener: "
598
+ },
599
+ {
600
+ "kind": "Content",
601
+ "text": "any"
602
+ },
603
+ {
604
+ "kind": "Content",
605
+ "text": ", excludeEvents?: "
606
+ },
607
+ {
608
+ "kind": "Content",
609
+ "text": "string[]"
610
+ },
611
+ {
612
+ "kind": "Content",
613
+ "text": "): "
614
+ },
615
+ {
616
+ "kind": "Content",
617
+ "text": "boolean"
618
+ },
619
+ {
620
+ "kind": "Content",
621
+ "text": ";"
622
+ }
623
+ ],
624
+ "returnTypeTokenRange": {
625
+ "startIndex": 5,
626
+ "endIndex": 6
627
+ },
628
+ "releaseTag": "Public",
629
+ "overloadIndex": 1,
630
+ "parameters": [
631
+ {
632
+ "parameterName": "listener",
633
+ "parameterTypeTokenRange": {
634
+ "startIndex": 1,
635
+ "endIndex": 2
636
+ }
637
+ },
638
+ {
639
+ "parameterName": "excludeEvents",
640
+ "parameterTypeTokenRange": {
641
+ "startIndex": 3,
642
+ "endIndex": 4
643
+ }
644
+ }
645
+ ],
646
+ "name": "addPageHideEventListener"
647
+ },
648
+ {
649
+ "kind": "Function",
650
+ "canonicalReference": "@microsoft/applicationinsights-core-js!addPageShowEventListener:function(1)",
651
+ "docComment": "/**\n * Listen to the pageshow and visibility changing to 'visible' events\n *\n * @param listener - The event callback to call when a page is show event is triggered\n *\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\n *\n * @returns true - when at least one of the events was registered otherwise false\n */\n",
652
+ "excerptTokens": [
653
+ {
654
+ "kind": "Content",
655
+ "text": "export declare function addPageShowEventListener(listener: "
656
+ },
657
+ {
658
+ "kind": "Content",
659
+ "text": "any"
660
+ },
661
+ {
662
+ "kind": "Content",
663
+ "text": ", excludeEvents?: "
664
+ },
665
+ {
666
+ "kind": "Content",
667
+ "text": "string[]"
668
+ },
669
+ {
670
+ "kind": "Content",
671
+ "text": "): "
672
+ },
673
+ {
674
+ "kind": "Content",
675
+ "text": "boolean"
676
+ },
677
+ {
678
+ "kind": "Content",
679
+ "text": ";"
680
+ }
681
+ ],
682
+ "returnTypeTokenRange": {
683
+ "startIndex": 5,
684
+ "endIndex": 6
685
+ },
686
+ "releaseTag": "Public",
687
+ "overloadIndex": 1,
688
+ "parameters": [
689
+ {
690
+ "parameterName": "listener",
691
+ "parameterTypeTokenRange": {
692
+ "startIndex": 1,
693
+ "endIndex": 2
694
+ }
695
+ },
696
+ {
697
+ "parameterName": "excludeEvents",
698
+ "parameterTypeTokenRange": {
699
+ "startIndex": 3,
700
+ "endIndex": 4
701
+ }
702
+ }
703
+ ],
704
+ "name": "addPageShowEventListener"
705
+ },
706
+ {
707
+ "kind": "Function",
708
+ "canonicalReference": "@microsoft/applicationinsights-core-js!addPageUnloadEventListener:function(1)",
709
+ "docComment": "/**\n * Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring, this does NOT listen to the 'visibilitychange' event as while it does indicate that the page is being hidden it does not *necessarily* mean that the page is being completely unloaded, it can mean that the user is just navigating to a different Tab and may come back (without unloading the page). As such you may also need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.\n *\n * @param listener - The event callback to call when a page unload event is triggered\n *\n * @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.\n *\n * @returns true - when at least one of the events was registered otherwise false\n */\n",
710
+ "excerptTokens": [
711
+ {
712
+ "kind": "Content",
713
+ "text": "export declare function addPageUnloadEventListener(listener: "
714
+ },
715
+ {
716
+ "kind": "Content",
717
+ "text": "any"
718
+ },
719
+ {
720
+ "kind": "Content",
721
+ "text": ", excludeEvents?: "
722
+ },
723
+ {
724
+ "kind": "Content",
725
+ "text": "string[]"
726
+ },
727
+ {
728
+ "kind": "Content",
729
+ "text": "): "
730
+ },
731
+ {
732
+ "kind": "Content",
733
+ "text": "boolean"
734
+ },
735
+ {
736
+ "kind": "Content",
737
+ "text": ";"
738
+ }
739
+ ],
740
+ "returnTypeTokenRange": {
741
+ "startIndex": 5,
742
+ "endIndex": 6
743
+ },
744
+ "releaseTag": "Public",
745
+ "overloadIndex": 1,
746
+ "parameters": [
747
+ {
748
+ "parameterName": "listener",
749
+ "parameterTypeTokenRange": {
750
+ "startIndex": 1,
751
+ "endIndex": 2
752
+ }
753
+ },
754
+ {
755
+ "parameterName": "excludeEvents",
756
+ "parameterTypeTokenRange": {
757
+ "startIndex": 3,
758
+ "endIndex": 4
759
+ }
760
+ }
761
+ ],
762
+ "name": "addPageUnloadEventListener"
763
+ },
517
764
  {
518
765
  "kind": "Class",
519
766
  "canonicalReference": "@microsoft/applicationinsights-core-js!AppInsightsCore:class",
@@ -5560,6 +5807,58 @@
5560
5807
  "endIndex": 2
5561
5808
  }
5562
5809
  },
5810
+ {
5811
+ "kind": "PropertySignature",
5812
+ "canonicalReference": "@microsoft/applicationinsights-core-js!IConfiguration#disablePageShowEvents:member",
5813
+ "docComment": "/**\n * [Optional] An array of page show events that you would like to be ignored, special note there must be at lease one valid show event hooked, if you list all or the runtime environment only supports a listed (disabled) event it will STILL be hooked, if required by the SDK. Page Show events include \"pageshow\" and \"visibilitychange\" (with 'visible' state)\n */\n",
5814
+ "excerptTokens": [
5815
+ {
5816
+ "kind": "Content",
5817
+ "text": "disablePageShowEvents?: "
5818
+ },
5819
+ {
5820
+ "kind": "Content",
5821
+ "text": "string[]"
5822
+ },
5823
+ {
5824
+ "kind": "Content",
5825
+ "text": ";"
5826
+ }
5827
+ ],
5828
+ "isOptional": true,
5829
+ "releaseTag": "Public",
5830
+ "name": "disablePageShowEvents",
5831
+ "propertyTypeTokenRange": {
5832
+ "startIndex": 1,
5833
+ "endIndex": 2
5834
+ }
5835
+ },
5836
+ {
5837
+ "kind": "PropertySignature",
5838
+ "canonicalReference": "@microsoft/applicationinsights-core-js!IConfiguration#disablePageUnloadEvents:member",
5839
+ "docComment": "/**\n * [Optional] An array of the page unload events that you would like to be ignored, special note there must be at least one valid unload event hooked, if you list all or the runtime environment only supports a listed \"disabled\" event it will still be hooked, if required by the SDK. Unload events include \"beforeunload\", \"unload\", \"visibilitychange\" (with 'hidden' state) and \"pagehide\"\n */\n",
5840
+ "excerptTokens": [
5841
+ {
5842
+ "kind": "Content",
5843
+ "text": "disablePageUnloadEvents?: "
5844
+ },
5845
+ {
5846
+ "kind": "Content",
5847
+ "text": "string[]"
5848
+ },
5849
+ {
5850
+ "kind": "Content",
5851
+ "text": ";"
5852
+ }
5853
+ ],
5854
+ "isOptional": true,
5855
+ "releaseTag": "Public",
5856
+ "name": "disablePageUnloadEvents",
5857
+ "propertyTypeTokenRange": {
5858
+ "startIndex": 1,
5859
+ "endIndex": 2
5860
+ }
5861
+ },
5563
5862
  {
5564
5863
  "kind": "PropertySignature",
5565
5864
  "canonicalReference": "@microsoft/applicationinsights-core-js!IConfiguration#enableDebugExceptions:member",
@@ -14,6 +14,18 @@ import { strShimUndefined as strUndefined } from '@microsoft/applicationinsights
14
14
  // @public
15
15
  export function addEventHandler(eventName: string, callback: any): boolean;
16
16
 
17
+ // @public
18
+ export function addEventListeners(events: string[], listener: any, excludeEvents?: string[]): boolean;
19
+
20
+ // @public
21
+ export function addPageHideEventListener(listener: any, excludeEvents?: string[]): boolean;
22
+
23
+ // @public
24
+ export function addPageShowEventListener(listener: any, excludeEvents?: string[]): boolean;
25
+
26
+ // @public
27
+ export function addPageUnloadEventListener(listener: any, excludeEvents?: string[]): boolean;
28
+
17
29
  // @public (undocumented)
18
30
  export class AppInsightsCore extends BaseCore implements IAppInsightsCore {
19
31
  constructor();
@@ -276,6 +288,8 @@ export interface IConfiguration {
276
288
  diagnosticLogInterval?: number;
277
289
  disableCookiesUsage?: boolean;
278
290
  disableInstrumentationKeyValidation?: boolean;
291
+ disablePageShowEvents?: string[];
292
+ disablePageUnloadEvents?: string[];
279
293
  enableDebugExceptions?: boolean;
280
294
  enablePerfMgr?: boolean;
281
295
  endpointUrl?: string;
@@ -556,6 +570,7 @@ export const _InternalMessageId: {
556
570
  InvalidContentBlob: number;
557
571
  TrackPageActionEventFailed: number;
558
572
  FailedAddingCustomDefinedRequestContext: number;
573
+ InMemoryStorageBufferFull: number;
559
574
  };
560
575
 
561
576
  // @public (undocumented)
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights Core Javascript SDK, 2.7.1-nightly.202110-03
2
+ * Microsoft Application Insights Core Javascript SDK, 2.7.1-nightly.202110-07
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -22,6 +22,44 @@ declare namespace ApplicationInsights {
22
22
  */
23
23
  function addEventHandler(eventName: string, callback: any): boolean;
24
24
 
25
+ /**
26
+ * Bind the listener to the array of events
27
+ * @param events An string array of event names to bind the listener to
28
+ * @param listener The event callback to call when the event is triggered
29
+ * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
30
+ * @returns true - when at least one of the events was registered otherwise false
31
+ */
32
+ function addEventListeners(events: string[], listener: any, excludeEvents?: string[]): boolean;
33
+
34
+ /**
35
+ * Listen to the pagehide and visibility changing to 'hidden' events
36
+ * @param listener - The event callback to call when a page hide event is triggered
37
+ * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
38
+ * Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide
39
+ * @returns true - when at least one of the events was registered otherwise false
40
+ */
41
+ function addPageHideEventListener(listener: any, excludeEvents?: string[]): boolean;
42
+
43
+ /**
44
+ * Listen to the pageshow and visibility changing to 'visible' events
45
+ * @param listener - The event callback to call when a page is show event is triggered
46
+ * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.
47
+ * @returns true - when at least one of the events was registered otherwise false
48
+ */
49
+ function addPageShowEventListener(listener: any, excludeEvents?: string[]): boolean;
50
+
51
+ /**
52
+ * Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,
53
+ * this does NOT listen to the 'visibilitychange' event as while it does indicate that the page is being hidden
54
+ * it does not *necessarily* mean that the page is being completely unloaded, it can mean that the user is
55
+ * just navigating to a different Tab and may come back (without unloading the page). As such you may also
56
+ * need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.
57
+ * @param listener - The event callback to call when a page unload event is triggered
58
+ * @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.
59
+ * @returns true - when at least one of the events was registered otherwise false
60
+ */
61
+ function addPageUnloadEventListener(listener: any, excludeEvents?: string[]): boolean;
62
+
25
63
  class AppInsightsCore extends BaseCore implements IAppInsightsCore {
26
64
  constructor();
27
65
  initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
@@ -678,6 +716,18 @@ declare namespace ApplicationInsights {
678
716
  * cookieDomain and disableCookiesUsage values.
679
717
  */
680
718
  cookieCfg?: ICookieMgrConfig;
719
+ /**
720
+ * [Optional] An array of the page unload events that you would like to be ignored, special note there must be at least one valid unload
721
+ * event hooked, if you list all or the runtime environment only supports a listed "disabled" event it will still be hooked, if required by the SDK.
722
+ * Unload events include "beforeunload", "unload", "visibilitychange" (with 'hidden' state) and "pagehide"
723
+ */
724
+ disablePageUnloadEvents?: string[];
725
+ /**
726
+ * [Optional] An array of page show events that you would like to be ignored, special note there must be at lease one valid show event
727
+ * hooked, if you list all or the runtime environment only supports a listed (disabled) event it will STILL be hooked, if required by the SDK.
728
+ * Page Show events include "pageshow" and "visibilitychange" (with 'visible' state)
729
+ */
730
+ disablePageShowEvents?: string[];
681
731
  }
682
732
 
683
733
  interface ICookieMgr {
@@ -1320,6 +1370,7 @@ declare namespace ApplicationInsights {
1320
1370
  InvalidContentBlob: number;
1321
1371
  TrackPageActionEventFailed: number;
1322
1372
  FailedAddingCustomDefinedRequestContext: number;
1373
+ InMemoryStorageBufferFull: number;
1323
1374
  };
1324
1375
 
1325
1376
  type _InternalMessageId = number | typeof _InternalMessageId;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Core, 2.7.1-nightly.202110-03
2
+ * Application Insights JavaScript SDK - Core, 2.7.1-nightly.202110-07
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -422,7 +422,8 @@
422
422
  CannotParseAiBlobValue: 101,
423
423
  InvalidContentBlob: 102,
424
424
  TrackPageActionEventFailed: 103,
425
- FailedAddingCustomDefinedRequestContext: 104
425
+ FailedAddingCustomDefinedRequestContext: 104,
426
+ InMemoryStorageBufferFull: 105
426
427
  };
427
428
 
428
429
  var strOnPrefix = "on";
@@ -2299,6 +2300,9 @@
2299
2300
  return value;
2300
2301
  }
2301
2302
 
2303
+ var strVisibilityChangeEvt = "visibilitychange";
2304
+ var strPageHide = "pagehide";
2305
+ var strPageShow = "pageshow";
2302
2306
  var _cookieMgrs = null;
2303
2307
  var _canUseCookies;
2304
2308
  var Undefined = strShimUndefined;
@@ -2315,6 +2319,67 @@
2315
2319
  }
2316
2320
  return result;
2317
2321
  }
2322
+ function addEventListeners(events, listener, excludeEvents) {
2323
+ var added = false;
2324
+ if (listener && events && isArray(events)) {
2325
+ var excluded_1 = [];
2326
+ arrForEach(events, function (name) {
2327
+ if (isString(name)) {
2328
+ if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {
2329
+ added = addEventHandler(name, listener) || added;
2330
+ }
2331
+ else {
2332
+ excluded_1.push(name);
2333
+ }
2334
+ }
2335
+ });
2336
+ if (!added && excluded_1.length > 0) {
2337
+ added = addEventListeners(excluded_1, listener);
2338
+ }
2339
+ }
2340
+ return added;
2341
+ }
2342
+ function addPageUnloadEventListener(listener, excludeEvents) {
2343
+ return addEventListeners(["beforeunload", "unload", "pagehide"], listener, excludeEvents);
2344
+ }
2345
+ function addPageHideEventListener(listener, excludeEvents) {
2346
+ function _handlePageVisibility(evt) {
2347
+ var doc = getDocument();
2348
+ if (listener && doc && doc.visibilityState === 'hidden') {
2349
+ listener(evt);
2350
+ }
2351
+ }
2352
+ var pageUnloadAdded = false;
2353
+ if (!excludeEvents || arrIndexOf(excludeEvents, strPageHide) === -1) {
2354
+ pageUnloadAdded = addEventHandler(strPageHide, listener);
2355
+ }
2356
+ if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
2357
+ pageUnloadAdded = addEventHandler(strVisibilityChangeEvt, _handlePageVisibility) || pageUnloadAdded;
2358
+ }
2359
+ if (!pageUnloadAdded && excludeEvents) {
2360
+ pageUnloadAdded = addPageHideEventListener(listener);
2361
+ }
2362
+ return pageUnloadAdded;
2363
+ }
2364
+ function addPageShowEventListener(listener, excludeEvents) {
2365
+ function _handlePageVisibility(evt) {
2366
+ var doc = getDocument();
2367
+ if (listener && doc && doc.visibilityState === 'visible') {
2368
+ listener(evt);
2369
+ }
2370
+ }
2371
+ var pageShowAdded = false;
2372
+ if (!excludeEvents || arrIndexOf(excludeEvents, strPageShow) === -1) {
2373
+ pageShowAdded = addEventHandler(strPageShow, listener);
2374
+ }
2375
+ if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
2376
+ pageShowAdded = addEventHandler(strVisibilityChangeEvt, _handlePageVisibility) || pageShowAdded;
2377
+ }
2378
+ if (!pageShowAdded && excludeEvents) {
2379
+ pageShowAdded = addPageShowEventListener(listener);
2380
+ }
2381
+ return pageShowAdded;
2382
+ }
2318
2383
  function newGuid() {
2319
2384
  function randomHexDigit() {
2320
2385
  return randomValue(15);
@@ -2649,6 +2714,10 @@
2649
2714
  exports._InternalMessageId = _InternalMessageId;
2650
2715
  exports._legacyCookieMgr = _legacyCookieMgr;
2651
2716
  exports.addEventHandler = addEventHandler;
2717
+ exports.addEventListeners = addEventListeners;
2718
+ exports.addPageHideEventListener = addPageHideEventListener;
2719
+ exports.addPageShowEventListener = addPageShowEventListener;
2720
+ exports.addPageUnloadEventListener = addPageUnloadEventListener;
2652
2721
  exports.areCookiesSupported = areCookiesSupported;
2653
2722
  exports.arrForEach = arrForEach;
2654
2723
  exports.arrIndexOf = arrIndexOf;