dce-reactkit 3.6.2 → 3.6.3

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.
@@ -60,6 +60,6 @@ export declare const addFatalErrorHandler: (handler: () => void) => void;
60
60
  * Show the "session expired" message
61
61
  * @author Gabe Abrams
62
62
  */
63
- export declare const showSessionExpiredMessage: () => void;
63
+ export declare const showSessionExpiredMessage: () => Promise<void>;
64
64
  declare const AppWrapper: React.FC<Props>;
65
65
  export default AppWrapper;
package/dist/esm/index.js CHANGED
@@ -644,6 +644,36 @@ var LogLevel;
644
644
  })(LogLevel || (LogLevel = {}));
645
645
  var LogLevel$1 = LogLevel;
646
646
 
647
+ /*------------------------------------------------------------------------*/
648
+ /* --------------------------- Static Helpers --------------------------- */
649
+ /*------------------------------------------------------------------------*/
650
+ // Timestamp after initialization when helpers should be available
651
+ const timestampWhenHelpersShouldBeAvailable$1 = Date.now() + 2000;
652
+ /**
653
+ * Wait for a little while for a helper to exist
654
+ * @author Gabe Abrams
655
+ * @param checkForHelper a function that returns true if the helper exists
656
+ * @returns true if the helper exists, false if the process timed out
657
+ */
658
+ const waitForHelper$1 = (checkForHelper) => __awaiter(void 0, void 0, void 0, function* () {
659
+ // Wait for helper to exist
660
+ while (!checkForHelper()) {
661
+ // Check if we should stop waiting
662
+ if (Date.now() > timestampWhenHelpersShouldBeAvailable$1) {
663
+ // Stop waiting
664
+ return false;
665
+ }
666
+ // Wait a little while
667
+ yield waitMs(10);
668
+ }
669
+ // Helper exists
670
+ return true;
671
+ });
672
+ /*------------------------------------------------------------------------*/
673
+ /* Listener */
674
+ /*------------------------------------------------------------------------*/
675
+ // Handler for session expiry
676
+ let sessionExpiryHandler;
647
677
  // Keep track of whether or not session expiry has already been handled
648
678
  let sessionAlreadyExpired = false;
649
679
  /*------------------------------------------------------------------------*/
@@ -736,6 +766,10 @@ const visitServerEndpoint = (opts) => __awaiter(void 0, void 0, void 0, function
736
766
  });
737
767
  }
738
768
  sessionAlreadyExpired = true;
769
+ // Wait for helper to exist
770
+ yield waitForHelper$1(() => {
771
+ return !!sessionExpiryHandler;
772
+ });
739
773
  // Show session expiration message
740
774
  {
741
775
  // Fallback to alert