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.
- package/dist/cjs/index.js +34 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/AppWrapper.d.ts +1 -1
- package/dist/esm/index.js +34 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/AppWrapper.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/AppWrapper.tsx +15 -2
- package/src/helpers/visitServerEndpoint.tsx +38 -0
package/dist/cjs/index.js
CHANGED
|
@@ -670,6 +670,36 @@ var LogLevel;
|
|
|
670
670
|
})(LogLevel || (LogLevel = {}));
|
|
671
671
|
var LogLevel$1 = LogLevel;
|
|
672
672
|
|
|
673
|
+
/*------------------------------------------------------------------------*/
|
|
674
|
+
/* --------------------------- Static Helpers --------------------------- */
|
|
675
|
+
/*------------------------------------------------------------------------*/
|
|
676
|
+
// Timestamp after initialization when helpers should be available
|
|
677
|
+
const timestampWhenHelpersShouldBeAvailable$1 = Date.now() + 2000;
|
|
678
|
+
/**
|
|
679
|
+
* Wait for a little while for a helper to exist
|
|
680
|
+
* @author Gabe Abrams
|
|
681
|
+
* @param checkForHelper a function that returns true if the helper exists
|
|
682
|
+
* @returns true if the helper exists, false if the process timed out
|
|
683
|
+
*/
|
|
684
|
+
const waitForHelper$1 = (checkForHelper) => __awaiter(void 0, void 0, void 0, function* () {
|
|
685
|
+
// Wait for helper to exist
|
|
686
|
+
while (!checkForHelper()) {
|
|
687
|
+
// Check if we should stop waiting
|
|
688
|
+
if (Date.now() > timestampWhenHelpersShouldBeAvailable$1) {
|
|
689
|
+
// Stop waiting
|
|
690
|
+
return false;
|
|
691
|
+
}
|
|
692
|
+
// Wait a little while
|
|
693
|
+
yield waitMs(10);
|
|
694
|
+
}
|
|
695
|
+
// Helper exists
|
|
696
|
+
return true;
|
|
697
|
+
});
|
|
698
|
+
/*------------------------------------------------------------------------*/
|
|
699
|
+
/* Listener */
|
|
700
|
+
/*------------------------------------------------------------------------*/
|
|
701
|
+
// Handler for session expiry
|
|
702
|
+
let sessionExpiryHandler;
|
|
673
703
|
// Keep track of whether or not session expiry has already been handled
|
|
674
704
|
let sessionAlreadyExpired = false;
|
|
675
705
|
/*------------------------------------------------------------------------*/
|
|
@@ -762,6 +792,10 @@ const visitServerEndpoint = (opts) => __awaiter(void 0, void 0, void 0, function
|
|
|
762
792
|
});
|
|
763
793
|
}
|
|
764
794
|
sessionAlreadyExpired = true;
|
|
795
|
+
// Wait for helper to exist
|
|
796
|
+
yield waitForHelper$1(() => {
|
|
797
|
+
return !!sessionExpiryHandler;
|
|
798
|
+
});
|
|
765
799
|
// Show session expiration message
|
|
766
800
|
{
|
|
767
801
|
// Fallback to alert
|