@swype-org/react-sdk 0.1.121 → 0.1.124

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.d.cts CHANGED
@@ -582,6 +582,10 @@ interface UseAuthorizationExecutorResult {
582
582
  pendingSelectSource: AuthorizationAction | null;
583
583
  /** Call this from the UI to provide the user's chain+token choice. */
584
584
  resolveSelectSource: (selection: SourceSelection) => void;
585
+ /** The SIGN_PERMIT2 action when paused for One-Tap limit setup, null otherwise. */
586
+ pendingOneTapSetup: AuthorizationAction | null;
587
+ /** Call this from the UI after the user has set their One-Tap limit. */
588
+ resolveOneTapSetup: () => void;
585
589
  /** Execute authorization by session id. */
586
590
  executeSessionById: (sessionId: string) => Promise<void>;
587
591
  }
@@ -714,7 +718,7 @@ declare function Spinner({ size, label }: SpinnerProps): react_jsx_runtime.JSX.E
714
718
 
715
719
  declare function SwypeLoadingScreen(): react_jsx_runtime.JSX.Element;
716
720
 
717
- interface CreatePasskeyScreenProps {
721
+ interface PasskeyScreenProps {
718
722
  onCreatePasskey: () => void;
719
723
  onBack?: () => void;
720
724
  creating: boolean;
@@ -724,7 +728,7 @@ interface CreatePasskeyScreenProps {
724
728
  /** Opens a pop-up window on the Swype domain for passkey registration. */
725
729
  onCreatePasskeyViaPopup?: () => void;
726
730
  }
727
- declare function CreatePasskeyScreen({ onCreatePasskey, onBack, creating, error, popupFallback, onCreatePasskeyViaPopup, }: CreatePasskeyScreenProps): react_jsx_runtime.JSX.Element;
731
+ declare function PasskeyScreen({ onCreatePasskey, onBack, creating, error, popupFallback, onCreatePasskeyViaPopup, }: PasskeyScreenProps): react_jsx_runtime.JSX.Element;
728
732
 
729
733
  interface SetupScreenProps {
730
734
  availableBalance: number;
@@ -797,4 +801,4 @@ interface TokenPickerScreenProps {
797
801
  }
798
802
  declare function TokenPickerScreen({ account, chains, onSelectAuthorized, onAuthorizeToken, onBack, }: TokenPickerScreenProps): react_jsx_runtime.JSX.Element;
799
803
 
800
- export { type Account, type ActionExecutionResult, type AdvancedSettings, AdvancedSourceScreen, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain, CreatePasskeyScreen, type Destination, type ErrorResponse, IconCircle, InfoBanner, type ListResponse, type MerchantAuthorization, type MerchantPublicKey, OutlineButton, PasskeyIframeBlockedError, type PaymentStep, PoweredByFooter, PrimaryButton, type Provider, ScreenHeader, ScreenLayout, SelectSourceScreen, SettingsMenu, SetupScreen, type SourceOption, type SourceSelection, type SourceType, Spinner, type StepItem, StepList, SwypeLoadingScreen, SwypePayment, type SwypePaymentProps, SwypeProvider, type SwypeProviderProps, type ThemeMode, type ThemeTokens, type TokenBalance, TokenPickerScreen, type Transfer, type TransferDestination, type UserConfig, type Wallet, type WalletSource, type WalletToken, buildPasskeyPopupOptions, createPasskeyCredential, createPasskeyViaPopup, darkTheme, deviceHasPasskey, findDevicePasskey, findDevicePasskeyViaPopup, getTheme, lightTheme, resolvePasskeyRpId, api as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
804
+ export { type Account, type ActionExecutionResult, type AdvancedSettings, AdvancedSourceScreen, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain, type Destination, type ErrorResponse, IconCircle, InfoBanner, type ListResponse, type MerchantAuthorization, type MerchantPublicKey, OutlineButton, PasskeyIframeBlockedError, PasskeyScreen, type PaymentStep, PoweredByFooter, PrimaryButton, type Provider, ScreenHeader, ScreenLayout, SelectSourceScreen, SettingsMenu, SetupScreen, type SourceOption, type SourceSelection, type SourceType, Spinner, type StepItem, StepList, SwypeLoadingScreen, SwypePayment, type SwypePaymentProps, SwypeProvider, type SwypeProviderProps, type ThemeMode, type ThemeTokens, type TokenBalance, TokenPickerScreen, type Transfer, type TransferDestination, type UserConfig, type Wallet, type WalletSource, type WalletToken, buildPasskeyPopupOptions, createPasskeyCredential, createPasskeyViaPopup, darkTheme, deviceHasPasskey, findDevicePasskey, findDevicePasskeyViaPopup, getTheme, lightTheme, resolvePasskeyRpId, api as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
package/dist/index.d.ts CHANGED
@@ -582,6 +582,10 @@ interface UseAuthorizationExecutorResult {
582
582
  pendingSelectSource: AuthorizationAction | null;
583
583
  /** Call this from the UI to provide the user's chain+token choice. */
584
584
  resolveSelectSource: (selection: SourceSelection) => void;
585
+ /** The SIGN_PERMIT2 action when paused for One-Tap limit setup, null otherwise. */
586
+ pendingOneTapSetup: AuthorizationAction | null;
587
+ /** Call this from the UI after the user has set their One-Tap limit. */
588
+ resolveOneTapSetup: () => void;
585
589
  /** Execute authorization by session id. */
586
590
  executeSessionById: (sessionId: string) => Promise<void>;
587
591
  }
@@ -714,7 +718,7 @@ declare function Spinner({ size, label }: SpinnerProps): react_jsx_runtime.JSX.E
714
718
 
715
719
  declare function SwypeLoadingScreen(): react_jsx_runtime.JSX.Element;
716
720
 
717
- interface CreatePasskeyScreenProps {
721
+ interface PasskeyScreenProps {
718
722
  onCreatePasskey: () => void;
719
723
  onBack?: () => void;
720
724
  creating: boolean;
@@ -724,7 +728,7 @@ interface CreatePasskeyScreenProps {
724
728
  /** Opens a pop-up window on the Swype domain for passkey registration. */
725
729
  onCreatePasskeyViaPopup?: () => void;
726
730
  }
727
- declare function CreatePasskeyScreen({ onCreatePasskey, onBack, creating, error, popupFallback, onCreatePasskeyViaPopup, }: CreatePasskeyScreenProps): react_jsx_runtime.JSX.Element;
731
+ declare function PasskeyScreen({ onCreatePasskey, onBack, creating, error, popupFallback, onCreatePasskeyViaPopup, }: PasskeyScreenProps): react_jsx_runtime.JSX.Element;
728
732
 
729
733
  interface SetupScreenProps {
730
734
  availableBalance: number;
@@ -797,4 +801,4 @@ interface TokenPickerScreenProps {
797
801
  }
798
802
  declare function TokenPickerScreen({ account, chains, onSelectAuthorized, onAuthorizeToken, onBack, }: TokenPickerScreenProps): react_jsx_runtime.JSX.Element;
799
803
 
800
- export { type Account, type ActionExecutionResult, type AdvancedSettings, AdvancedSourceScreen, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain, CreatePasskeyScreen, type Destination, type ErrorResponse, IconCircle, InfoBanner, type ListResponse, type MerchantAuthorization, type MerchantPublicKey, OutlineButton, PasskeyIframeBlockedError, type PaymentStep, PoweredByFooter, PrimaryButton, type Provider, ScreenHeader, ScreenLayout, SelectSourceScreen, SettingsMenu, SetupScreen, type SourceOption, type SourceSelection, type SourceType, Spinner, type StepItem, StepList, SwypeLoadingScreen, SwypePayment, type SwypePaymentProps, SwypeProvider, type SwypeProviderProps, type ThemeMode, type ThemeTokens, type TokenBalance, TokenPickerScreen, type Transfer, type TransferDestination, type UserConfig, type Wallet, type WalletSource, type WalletToken, buildPasskeyPopupOptions, createPasskeyCredential, createPasskeyViaPopup, darkTheme, deviceHasPasskey, findDevicePasskey, findDevicePasskeyViaPopup, getTheme, lightTheme, resolvePasskeyRpId, api as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
804
+ export { type Account, type ActionExecutionResult, type AdvancedSettings, AdvancedSourceScreen, type Amount, type AuthorizationAction, type AuthorizationSession, type AuthorizationSessionDetail, type Chain, type Destination, type ErrorResponse, IconCircle, InfoBanner, type ListResponse, type MerchantAuthorization, type MerchantPublicKey, OutlineButton, PasskeyIframeBlockedError, PasskeyScreen, type PaymentStep, PoweredByFooter, PrimaryButton, type Provider, ScreenHeader, ScreenLayout, SelectSourceScreen, SettingsMenu, SetupScreen, type SourceOption, type SourceSelection, type SourceType, Spinner, type StepItem, StepList, SwypeLoadingScreen, SwypePayment, type SwypePaymentProps, SwypeProvider, type SwypeProviderProps, type ThemeMode, type ThemeTokens, type TokenBalance, TokenPickerScreen, type Transfer, type TransferDestination, type UserConfig, type Wallet, type WalletSource, type WalletToken, buildPasskeyPopupOptions, createPasskeyCredential, createPasskeyViaPopup, darkTheme, deviceHasPasskey, findDevicePasskey, findDevicePasskeyViaPopup, getTheme, lightTheme, resolvePasskeyRpId, api as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
package/dist/index.js CHANGED
@@ -808,10 +808,10 @@ function createPasskeyViaPopup(options) {
808
808
  if (result) {
809
809
  resolve(result);
810
810
  } else {
811
- reject(new Error("Passkey setup window was closed before completing."));
811
+ reject(new Error("Passkey window was closed before completing."));
812
812
  }
813
813
  }).catch(() => {
814
- reject(new Error("Passkey setup window was closed before completing."));
814
+ reject(new Error("Passkey window was closed before completing."));
815
815
  });
816
816
  }
817
817
  }, POPUP_CLOSED_GRACE_MS);
@@ -1433,6 +1433,22 @@ function useAuthorizationExecutor(options) {
1433
1433
  }),
1434
1434
  []
1435
1435
  );
1436
+ const [pendingOneTapSetup, setPendingOneTapSetup] = useState(null);
1437
+ const oneTapSetupResolverRef = useRef(null);
1438
+ const resolveOneTapSetup = useCallback(() => {
1439
+ if (oneTapSetupResolverRef.current) {
1440
+ oneTapSetupResolverRef.current();
1441
+ oneTapSetupResolverRef.current = null;
1442
+ setPendingOneTapSetup(null);
1443
+ }
1444
+ }, []);
1445
+ const waitForOneTapSetup = useCallback(
1446
+ (action) => new Promise((resolve) => {
1447
+ oneTapSetupResolverRef.current = resolve;
1448
+ setPendingOneTapSetup(action);
1449
+ }),
1450
+ []
1451
+ );
1436
1452
  const dispatchAction = useCallback(
1437
1453
  async (action) => {
1438
1454
  setCurrentAction(action);
@@ -1447,13 +1463,23 @@ function useAuthorizationExecutor(options) {
1447
1463
  return executeApprovePermit2(action, wagmiConfig2);
1448
1464
  case "DEPLOY_SMART_ACCOUNT":
1449
1465
  return actionSuccess(action, "Smart account deployment acknowledged.");
1450
- case "SIGN_PERMIT2":
1451
- return executeSignPermit2(action, wagmiConfig2, apiBaseUrl ?? "", sessionIdRef.current);
1466
+ case "SIGN_PERMIT2": {
1467
+ let resolvedAction = action;
1468
+ if (action.metadata?.awaitingLimit) {
1469
+ await waitForOneTapSetup(action);
1470
+ if (apiBaseUrl && sessionIdRef.current) {
1471
+ const session = await fetchAuthorizationSession(apiBaseUrl, sessionIdRef.current);
1472
+ const refreshed = session.actions.find((a) => a.id === action.id);
1473
+ if (refreshed) resolvedAction = refreshed;
1474
+ }
1475
+ }
1476
+ return executeSignPermit2(resolvedAction, wagmiConfig2, apiBaseUrl ?? "", sessionIdRef.current);
1477
+ }
1452
1478
  default:
1453
1479
  return actionError(action, `Unsupported action type: ${action.type}`);
1454
1480
  }
1455
1481
  },
1456
- [wagmiConfig2, connectors, connectAsync, switchChainAsync, apiBaseUrl, waitForSelection]
1482
+ [wagmiConfig2, connectors, connectAsync, switchChainAsync, apiBaseUrl, waitForSelection, waitForOneTapSetup]
1457
1483
  );
1458
1484
  const executeSessionById = useCallback(
1459
1485
  async (sessionId) => {
@@ -1524,6 +1550,8 @@ function useAuthorizationExecutor(options) {
1524
1550
  currentAction,
1525
1551
  pendingSelectSource,
1526
1552
  resolveSelectSource,
1553
+ pendingOneTapSetup,
1554
+ resolveOneTapSetup,
1527
1555
  executeSessionById
1528
1556
  };
1529
1557
  }
@@ -1737,6 +1765,9 @@ function resolvePostAuthStep(state) {
1737
1765
  return { step: "create-passkey", clearPersistedFlow: false };
1738
1766
  }
1739
1767
  if (state.persistedMobileFlow) {
1768
+ if (state.persistedMobileFlow.isReauthorization) {
1769
+ return { step: "open-wallet", clearPersistedFlow: false };
1770
+ }
1740
1771
  if (state.persistedMobileFlow.isSetup && hasActiveWallet(state.accounts)) {
1741
1772
  return { step: "deposit", clearPersistedFlow: true };
1742
1773
  }
@@ -3469,7 +3500,7 @@ var hintStyle = (color) => ({
3469
3500
  color,
3470
3501
  margin: "12px 0 0"
3471
3502
  });
3472
- function CreatePasskeyScreen({
3503
+ function PasskeyScreen({
3473
3504
  onCreatePasskey,
3474
3505
  onBack,
3475
3506
  creating,
@@ -3479,7 +3510,7 @@ function CreatePasskeyScreen({
3479
3510
  }) {
3480
3511
  const { tokens } = useSwypeConfig();
3481
3512
  const handleCreate = popupFallback && onCreatePasskeyViaPopup ? onCreatePasskeyViaPopup : onCreatePasskey;
3482
- const buttonLabel = popupFallback ? "Open passkey setup" : "Set up passkey";
3513
+ const buttonLabel = popupFallback ? "Open passkey window" : "Create or verify passkey";
3483
3514
  return /* @__PURE__ */ jsxs(
3484
3515
  ScreenLayout,
3485
3516
  {
@@ -3496,8 +3527,8 @@ function CreatePasskeyScreen({
3496
3527
  /* @__PURE__ */ jsx("circle", { cx: "15", cy: "10", r: "1", fill: tokens.accent }),
3497
3528
  /* @__PURE__ */ jsx("path", { d: "M9 14c0 1.5 1.34 2.5 3 2.5s3-1 3-2.5", stroke: tokens.accent, strokeWidth: "1.2", strokeLinecap: "round" })
3498
3529
  ] }) }),
3499
- /* @__PURE__ */ jsx("h2", { style: headingStyle3(tokens.text), children: "Set up your passkey" }),
3500
- /* @__PURE__ */ jsx("p", { style: subtitleStyle3(tokens.textSecondary), children: popupFallback ? "Your browser requires a separate window for passkey setup. Tap the button below to continue." : "Use Face ID to sign in instantly \u2014 no passwords, no codes." }),
3530
+ /* @__PURE__ */ jsx("h2", { style: headingStyle3(tokens.text), children: "Create or verify your passkey" }),
3531
+ /* @__PURE__ */ jsx("p", { style: subtitleStyle3(tokens.textSecondary), children: popupFallback ? "Your browser requires a separate window to continue. Tap the button below to continue." : "Use Face ID to sign in instantly \u2014 no passwords, no codes." }),
3501
3532
  error && /* @__PURE__ */ jsx("div", { style: errorBannerStyle2(tokens), children: error }),
3502
3533
  /* @__PURE__ */ jsx(InfoBanner, { children: "Your passkey is stored securely on your device. Swype never sees your biometric data." })
3503
3534
  ] })
@@ -5629,7 +5660,7 @@ function StepRenderer({
5629
5660
  }
5630
5661
  if (step === "create-passkey") {
5631
5662
  return /* @__PURE__ */ jsx(
5632
- CreatePasskeyScreen,
5663
+ PasskeyScreen,
5633
5664
  {
5634
5665
  onCreatePasskey: handlers.onRegisterPasskey,
5635
5666
  onBack: handlers.onLogout,
@@ -5642,7 +5673,7 @@ function StepRenderer({
5642
5673
  }
5643
5674
  if (step === "verify-passkey") {
5644
5675
  return /* @__PURE__ */ jsx(
5645
- CreatePasskeyScreen,
5676
+ PasskeyScreen,
5646
5677
  {
5647
5678
  onCreatePasskey: handlers.onRegisterPasskey,
5648
5679
  onBack: handlers.onLogout,
@@ -5967,6 +5998,8 @@ function SwypePaymentInner({
5967
5998
  const initializedSelectSourceActionRef = useRef(null);
5968
5999
  const preSelectSourceStepRef = useRef(null);
5969
6000
  const pendingTokenAuthRef = useRef(null);
6001
+ const reauthSessionIdRef = useRef(null);
6002
+ const reauthTokenRef = useRef(null);
5970
6003
  const checkingPasskeyRef = useRef(false);
5971
6004
  const onCompleteRef = useRef(onComplete);
5972
6005
  onCompleteRef.current = onComplete;
@@ -6260,7 +6293,7 @@ function SwypePaymentInner({
6260
6293
  return;
6261
6294
  }
6262
6295
  if (!state.activeCredentialId) {
6263
- dispatch({ type: "SET_ERROR", error: "Set up a passkey on this device before continuing." });
6296
+ dispatch({ type: "SET_ERROR", error: "Create or verify a passkey on this device before continuing." });
6264
6297
  dispatch({ type: "NAVIGATE", step: "create-passkey" });
6265
6298
  return;
6266
6299
  }
@@ -6341,7 +6374,7 @@ function SwypePaymentInner({
6341
6374
  return;
6342
6375
  }
6343
6376
  if (!state.activeCredentialId) {
6344
- dispatch({ type: "SET_ERROR", error: "Set up a passkey on this device before continuing." });
6377
+ dispatch({ type: "SET_ERROR", error: "Create or verify a passkey on this device before continuing." });
6345
6378
  dispatch({ type: "NAVIGATE", step: "create-passkey" });
6346
6379
  return;
6347
6380
  }
@@ -6369,12 +6402,15 @@ function SwypePaymentInner({
6369
6402
  handlingMobileReturnRef.current = false;
6370
6403
  mobileSetupFlowRef.current = true;
6371
6404
  setupAccountIdRef.current = state.selectedAccountId;
6405
+ reauthSessionIdRef.current = session.id;
6406
+ reauthTokenRef.current = null;
6372
6407
  persistMobileFlowState({
6373
6408
  accountId: state.selectedAccountId,
6374
6409
  sessionId: session.id,
6375
6410
  deeplinkUri: session.uri,
6376
6411
  providerId: matchedProvider?.id ?? null,
6377
- isSetup: true
6412
+ isSetup: true,
6413
+ isReauthorization: true
6378
6414
  });
6379
6415
  dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: session.uri });
6380
6416
  triggerDeeplink(session.uri);
@@ -6415,7 +6451,7 @@ function SwypePaymentInner({
6415
6451
  return;
6416
6452
  }
6417
6453
  if (!state.activeCredentialId) {
6418
- dispatch({ type: "SET_ERROR", error: "Set up a passkey on this device before continuing." });
6454
+ dispatch({ type: "SET_ERROR", error: "Create or verify a passkey on this device before continuing." });
6419
6455
  dispatch({ type: "NAVIGATE", step: "create-passkey" });
6420
6456
  return;
6421
6457
  }
@@ -6445,12 +6481,16 @@ function SwypePaymentInner({
6445
6481
  handlingMobileReturnRef.current = false;
6446
6482
  mobileSetupFlowRef.current = true;
6447
6483
  setupAccountIdRef.current = state.selectedAccountId;
6484
+ reauthSessionIdRef.current = session.id;
6485
+ reauthTokenRef.current = { walletId: _walletId, tokenSymbol };
6448
6486
  persistMobileFlowState({
6449
6487
  accountId: state.selectedAccountId,
6450
6488
  sessionId: session.id,
6451
6489
  deeplinkUri: session.uri,
6452
6490
  providerId: matchedProvider?.id ?? null,
6453
- isSetup: true
6491
+ isSetup: true,
6492
+ isReauthorization: true,
6493
+ reauthorizationToken: { walletId: _walletId, tokenSymbol }
6454
6494
  });
6455
6495
  dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: session.uri });
6456
6496
  triggerDeeplink(session.uri);
@@ -6512,7 +6552,7 @@ function SwypePaymentInner({
6512
6552
  const handleSelectProvider = useCallback(async (providerId) => {
6513
6553
  dispatch({ type: "SELECT_PROVIDER", providerId });
6514
6554
  if (!state.activeCredentialId) {
6515
- dispatch({ type: "SET_ERROR", error: "Set up a passkey on this device before continuing." });
6555
+ dispatch({ type: "SET_ERROR", error: "Create or verify a passkey on this device before continuing." });
6516
6556
  dispatch({ type: "NAVIGATE", step: "create-passkey" });
6517
6557
  return;
6518
6558
  }
@@ -6556,7 +6596,7 @@ function SwypePaymentInner({
6556
6596
  } else {
6557
6597
  await authExecutor.executeSessionById(session.id);
6558
6598
  await reloadAccounts();
6559
- dispatch({ type: "NAVIGATE", step: "setup" });
6599
+ dispatch({ type: "NAVIGATE", step: "deposit" });
6560
6600
  }
6561
6601
  } catch (err) {
6562
6602
  captureException(err);
@@ -6605,7 +6645,11 @@ function SwypePaymentInner({
6605
6645
  const token = await getAccessToken();
6606
6646
  if (!token) throw new Error("Not authenticated");
6607
6647
  await updateUserConfig(apiBaseUrl, token, { defaultAllowance: limit });
6608
- dispatch({ type: "NAVIGATE", step: "deposit" });
6648
+ if (authExecutor.pendingOneTapSetup) {
6649
+ authExecutor.resolveOneTapSetup();
6650
+ } else {
6651
+ dispatch({ type: "NAVIGATE", step: "deposit" });
6652
+ }
6609
6653
  } catch (err) {
6610
6654
  captureException(err);
6611
6655
  dispatch({
@@ -6613,7 +6657,7 @@ function SwypePaymentInner({
6613
6657
  error: err instanceof Error ? err.message : "Failed to save One-Tap limit"
6614
6658
  });
6615
6659
  }
6616
- }, [getAccessToken, apiBaseUrl]);
6660
+ }, [getAccessToken, apiBaseUrl, authExecutor]);
6617
6661
  const handleNewPayment = useCallback(() => {
6618
6662
  clearMobileFlowState();
6619
6663
  processingStartedAtRef.current = null;
@@ -6723,6 +6767,31 @@ function SwypePaymentInner({
6723
6767
  } catch {
6724
6768
  }
6725
6769
  }
6770
+ if (resolved.step === "open-wallet" && persisted && persisted.isReauthorization && persisted.sessionId) {
6771
+ try {
6772
+ const session = await fetchAuthorizationSession(apiBaseUrl, persisted.sessionId);
6773
+ if (cancelled) return;
6774
+ if (session.status === "AUTHORIZED") {
6775
+ clearMobileFlowState();
6776
+ dispatch({ type: "NAVIGATE", step: "deposit" });
6777
+ if (persisted.reauthorizationToken) {
6778
+ dispatch({ type: "SELECT_TOKEN", walletId: persisted.reauthorizationToken.walletId, tokenSymbol: persisted.reauthorizationToken.tokenSymbol });
6779
+ }
6780
+ return;
6781
+ }
6782
+ } catch {
6783
+ }
6784
+ reauthSessionIdRef.current = persisted.sessionId;
6785
+ reauthTokenRef.current = persisted.reauthorizationToken ?? null;
6786
+ mobileSetupFlowRef.current = true;
6787
+ setupAccountIdRef.current = persisted.accountId ?? null;
6788
+ dispatch({
6789
+ type: "ENTER_MOBILE_FLOW",
6790
+ deeplinkUri: persisted.deeplinkUri,
6791
+ providerId: persisted.providerId
6792
+ });
6793
+ return;
6794
+ }
6726
6795
  if (resolved.step === "open-wallet" && persisted && persisted.accountId && !persisted.transferId) {
6727
6796
  clearMobileFlowState();
6728
6797
  dispatch({ type: "NAVIGATE", step: "deposit" });
@@ -6992,9 +7061,36 @@ function SwypePaymentInner({
6992
7061
  if (!state.activeCredentialId || !setupAccountIdRef.current) return;
6993
7062
  const accountId = setupAccountIdRef.current;
6994
7063
  const credentialId = state.activeCredentialId;
7064
+ const isReauth = !!reauthSessionIdRef.current;
7065
+ const sessionId = reauthSessionIdRef.current;
7066
+ const tokenSelection = reauthTokenRef.current;
6995
7067
  let cancelled = false;
6996
7068
  const POLL_INTERVAL_MS = 3e3;
6997
- const poll = async () => {
7069
+ const pollReauthorization = async () => {
7070
+ try {
7071
+ if (!sessionId || cancelled) return;
7072
+ const session = await fetchAuthorizationSession(apiBaseUrl, sessionId);
7073
+ if (cancelled) return;
7074
+ if (session.status === "AUTHORIZED") {
7075
+ cancelled = true;
7076
+ mobileSetupFlowRef.current = false;
7077
+ setupAccountIdRef.current = null;
7078
+ reauthSessionIdRef.current = null;
7079
+ reauthTokenRef.current = null;
7080
+ clearMobileFlowState();
7081
+ try {
7082
+ await reloadAccounts();
7083
+ } catch {
7084
+ }
7085
+ dispatch({ type: "MOBILE_SETUP_COMPLETE" });
7086
+ if (tokenSelection) {
7087
+ dispatch({ type: "SELECT_TOKEN", walletId: tokenSelection.walletId, tokenSymbol: tokenSelection.tokenSymbol });
7088
+ }
7089
+ }
7090
+ } catch {
7091
+ }
7092
+ };
7093
+ const pollWalletActive = async () => {
6998
7094
  try {
6999
7095
  const token = await getAccessTokenRef.current();
7000
7096
  if (!token || cancelled) return;
@@ -7015,6 +7111,7 @@ function SwypePaymentInner({
7015
7111
  } catch {
7016
7112
  }
7017
7113
  };
7114
+ const poll = isReauth ? pollReauthorization : pollWalletActive;
7018
7115
  poll();
7019
7116
  const intervalId = window.setInterval(poll, POLL_INTERVAL_MS);
7020
7117
  const handleVisibility = () => {
@@ -7090,6 +7187,17 @@ function SwypePaymentInner({
7090
7187
  });
7091
7188
  }
7092
7189
  }, [pendingSelectSourceAction, authExecutor]);
7190
+ const pendingOneTapSetupAction = authExecutor.pendingOneTapSetup;
7191
+ const preOneTapSetupStepRef = useRef(null);
7192
+ useEffect(() => {
7193
+ if (pendingOneTapSetupAction && state.step === "setup-status") {
7194
+ preOneTapSetupStepRef.current = state.step;
7195
+ dispatch({ type: "NAVIGATE", step: "setup" });
7196
+ } else if (!pendingOneTapSetupAction && state.step === "setup" && preOneTapSetupStepRef.current) {
7197
+ dispatch({ type: "NAVIGATE", step: preOneTapSetupStepRef.current });
7198
+ preOneTapSetupStepRef.current = null;
7199
+ }
7200
+ }, [pendingOneTapSetupAction, state.step]);
7093
7201
  const handlers = useMemo(() => ({
7094
7202
  onSendLoginCode: handleSendLoginCode,
7095
7203
  onVerifyLoginCode: handleVerifyLoginCode,
@@ -7183,6 +7291,6 @@ function SwypePaymentInner({
7183
7291
  );
7184
7292
  }
7185
7293
 
7186
- export { AdvancedSourceScreen, CreatePasskeyScreen, IconCircle, InfoBanner, OutlineButton, PasskeyIframeBlockedError, PoweredByFooter, PrimaryButton, ScreenHeader, ScreenLayout, SelectSourceScreen, SettingsMenu, SetupScreen, Spinner, StepList, SwypeLoadingScreen, SwypePayment, SwypeProvider, TokenPickerScreen, buildPasskeyPopupOptions, createPasskeyCredential, createPasskeyViaPopup, darkTheme, deviceHasPasskey, findDevicePasskey, findDevicePasskeyViaPopup, getTheme, lightTheme, resolvePasskeyRpId, api_exports as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
7294
+ export { AdvancedSourceScreen, IconCircle, InfoBanner, OutlineButton, PasskeyIframeBlockedError, PasskeyScreen, PoweredByFooter, PrimaryButton, ScreenHeader, ScreenLayout, SelectSourceScreen, SettingsMenu, SetupScreen, Spinner, StepList, SwypeLoadingScreen, SwypePayment, SwypeProvider, TokenPickerScreen, buildPasskeyPopupOptions, createPasskeyCredential, createPasskeyViaPopup, darkTheme, deviceHasPasskey, findDevicePasskey, findDevicePasskeyViaPopup, getTheme, lightTheme, resolvePasskeyRpId, api_exports as swypeApi, useAuthorizationExecutor, useSwypeConfig, useSwypeDepositAmount, useTransferPolling, useTransferSigning };
7187
7295
  //# sourceMappingURL=index.js.map
7188
7296
  //# sourceMappingURL=index.js.map