@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.js CHANGED
@@ -712,6 +712,7 @@ function isSafari() {
712
712
  }
713
713
  var POPUP_RESULT_TIMEOUT_MS = 12e4;
714
714
  var POPUP_CLOSED_POLL_MS = 500;
715
+ var POPUP_CLOSED_GRACE_MS = 1e3;
715
716
  function createPasskeyViaPopup(options) {
716
717
  return new Promise((resolve, reject) => {
717
718
  const channelId = `swype-pk-${Date.now()}-${Math.random().toString(36).slice(2)}`;
@@ -729,10 +730,16 @@ function createPasskeyViaPopup(options) {
729
730
  cleanup();
730
731
  reject(new Error("Passkey creation timed out. Please try again."));
731
732
  }, POPUP_RESULT_TIMEOUT_MS);
733
+ let closedGraceTimer = null;
732
734
  const closedPoll = setInterval(() => {
733
735
  if (popup.closed) {
734
- cleanup();
735
- reject(new Error("Passkey setup window was closed before completing."));
736
+ clearInterval(closedPoll);
737
+ closedGraceTimer = setTimeout(() => {
738
+ if (!settled) {
739
+ cleanup();
740
+ reject(new Error("Passkey setup window was closed before completing."));
741
+ }
742
+ }, POPUP_CLOSED_GRACE_MS);
736
743
  }
737
744
  }, POPUP_CLOSED_POLL_MS);
738
745
  function handleResult(data) {
@@ -760,6 +767,7 @@ function createPasskeyViaPopup(options) {
760
767
  function cleanup() {
761
768
  clearTimeout(timer);
762
769
  clearInterval(closedPoll);
770
+ if (closedGraceTimer) clearTimeout(closedGraceTimer);
763
771
  window.removeEventListener("message", postMessageHandler);
764
772
  channel?.close();
765
773
  }