@swype-org/react-sdk 0.1.82 → 0.1.83
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/index.cjs +10 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -715,6 +715,7 @@ function isSafari() {
|
|
|
715
715
|
}
|
|
716
716
|
var POPUP_RESULT_TIMEOUT_MS = 12e4;
|
|
717
717
|
var POPUP_CLOSED_POLL_MS = 500;
|
|
718
|
+
var POPUP_CLOSED_GRACE_MS = 1e3;
|
|
718
719
|
function createPasskeyViaPopup(options) {
|
|
719
720
|
return new Promise((resolve, reject) => {
|
|
720
721
|
const channelId = `swype-pk-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
@@ -732,10 +733,16 @@ function createPasskeyViaPopup(options) {
|
|
|
732
733
|
cleanup();
|
|
733
734
|
reject(new Error("Passkey creation timed out. Please try again."));
|
|
734
735
|
}, POPUP_RESULT_TIMEOUT_MS);
|
|
736
|
+
let closedGraceTimer = null;
|
|
735
737
|
const closedPoll = setInterval(() => {
|
|
736
738
|
if (popup.closed) {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
+
clearInterval(closedPoll);
|
|
740
|
+
closedGraceTimer = setTimeout(() => {
|
|
741
|
+
if (!settled) {
|
|
742
|
+
cleanup();
|
|
743
|
+
reject(new Error("Passkey setup window was closed before completing."));
|
|
744
|
+
}
|
|
745
|
+
}, POPUP_CLOSED_GRACE_MS);
|
|
739
746
|
}
|
|
740
747
|
}, POPUP_CLOSED_POLL_MS);
|
|
741
748
|
function handleResult(data) {
|
|
@@ -763,6 +770,7 @@ function createPasskeyViaPopup(options) {
|
|
|
763
770
|
function cleanup() {
|
|
764
771
|
clearTimeout(timer);
|
|
765
772
|
clearInterval(closedPoll);
|
|
773
|
+
if (closedGraceTimer) clearTimeout(closedGraceTimer);
|
|
766
774
|
window.removeEventListener("message", postMessageHandler);
|
|
767
775
|
channel?.close();
|
|
768
776
|
}
|