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