@swype-org/react-sdk 0.1.89 → 0.1.91

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 CHANGED
@@ -5431,16 +5431,31 @@ function SwypePaymentInner({
5431
5431
  reportPasskeyActivity(apiBaseUrl, token, matched).catch(() => {
5432
5432
  });
5433
5433
  }
5434
- dispatch({ type: "NAVIGATE", step: "login" });
5434
+ const resolved = resolvePostAuthStep({
5435
+ hasPasskey: true,
5436
+ accounts: state.accounts,
5437
+ persistedMobileFlow: loadMobileFlowState(),
5438
+ mobileSetupInProgress: mobileSetupFlowRef.current,
5439
+ connectingNewAccount: state.connectingNewAccount
5440
+ });
5441
+ if (resolved.clearPersistedFlow) clearMobileFlowState();
5442
+ dispatch({ type: "NAVIGATE", step: resolved.step });
5435
5443
  } else {
5436
- dispatch({ type: "NAVIGATE", step: "create-passkey" });
5444
+ dispatch({
5445
+ type: "SET_ERROR",
5446
+ error: "Passkey verification was not completed. Please try again."
5447
+ });
5437
5448
  }
5438
- } catch {
5439
- dispatch({ type: "NAVIGATE", step: "create-passkey" });
5449
+ } catch (err) {
5450
+ captureException(err);
5451
+ dispatch({
5452
+ type: "SET_ERROR",
5453
+ error: err instanceof Error ? err.message : "Passkey verification failed. Please try again."
5454
+ });
5440
5455
  } finally {
5441
5456
  dispatch({ type: "SET_VERIFYING_PASSKEY", value: false });
5442
5457
  }
5443
- }, [state.knownCredentialIds, getAccessToken, apiBaseUrl]);
5458
+ }, [state.knownCredentialIds, getAccessToken, apiBaseUrl, state.accounts, state.connectingNewAccount]);
5444
5459
  const reloadAccounts = react.useCallback(async () => {
5445
5460
  const token = await getAccessToken();
5446
5461
  if (!token || !state.activeCredentialId) return;
@@ -5892,8 +5907,17 @@ function SwypePaymentInner({
5892
5907
  };
5893
5908
  const checkPasskey = async () => {
5894
5909
  try {
5895
- const token = await getAccessToken();
5896
- if (!token || cancelled) return;
5910
+ let token = null;
5911
+ for (let attempt = 0; attempt < 3; attempt++) {
5912
+ token = await getAccessToken();
5913
+ if (token || cancelled) break;
5914
+ await new Promise((r) => setTimeout(r, 1e3));
5915
+ }
5916
+ if (!token) {
5917
+ if (!cancelled) dispatch({ type: "NAVIGATE", step: "create-passkey" });
5918
+ return;
5919
+ }
5920
+ if (cancelled) return;
5897
5921
  const { config } = await fetchUserConfig(apiBaseUrl, token);
5898
5922
  if (cancelled) return;
5899
5923
  const allPasskeys = config.passkeys ?? (config.passkey ? [config.passkey] : []);