@swype-org/react-sdk 0.1.280 → 0.1.285

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
@@ -830,7 +830,7 @@ interface NormalizedAuthIdentifier {
830
830
  value: string;
831
831
  }
832
832
 
833
- type ScreenName = 'loading' | 'login' | 'otp-verify' | 'create-passkey' | 'verify-passkey' | 'success' | 'processing' | 'confirm-sign' | 'select-source' | 'setup' | 'open-wallet' | 'setup-status' | 'guest-token-picker' | 'wallet-picker' | 'token-picker' | 'deposit' | 'guest-setup-complete';
833
+ type ScreenName = 'loading' | 'login' | 'otp-verify' | 'create-passkey' | 'verify-passkey' | 'success' | 'processing' | 'confirm-sign' | 'select-source' | 'setup' | 'open-wallet' | 'setup-status' | 'guest-token-picker' | 'wallet-picker' | 'token-picker' | 'deposit' | 'guest-setup-complete' | 'guest-preauth-linking';
834
834
  interface MobileFlowState {
835
835
  deeplinkUri: string;
836
836
  providerId: string | null;
@@ -886,6 +886,8 @@ type PaymentPhase = {
886
886
  error: string;
887
887
  } | {
888
888
  step: 'guest-setup-complete';
889
+ } | {
890
+ step: 'guest-preauth-linking';
889
891
  };
890
892
  declare function screenForPhase(phase: PaymentPhase): ScreenName;
891
893
 
@@ -928,10 +930,12 @@ interface SelectSourceScreenProps {
928
930
  onChainChange: (chainName: string) => void;
929
931
  onTokenChange: (tokenSymbol: string) => void;
930
932
  onConfirm: () => void;
933
+ /** Primary footer button label (default: "Confirm source"). */
934
+ confirmLabel?: string;
931
935
  onBack?: () => void;
932
936
  onLogout: () => void;
933
937
  }
934
- declare function SelectSourceScreen({ choices, selectedChainName, selectedTokenSymbol, recommended, onChainChange, onTokenChange, onConfirm, onBack, onLogout, }: SelectSourceScreenProps): react_jsx_runtime.JSX.Element;
938
+ declare function SelectSourceScreen({ choices, selectedChainName, selectedTokenSymbol, recommended, onChainChange, onTokenChange, onConfirm, confirmLabel, onBack, onLogout, }: SelectSourceScreenProps): react_jsx_runtime.JSX.Element;
935
939
 
936
940
  interface ChainChoice {
937
941
  chainName: string;
package/dist/index.d.ts CHANGED
@@ -830,7 +830,7 @@ interface NormalizedAuthIdentifier {
830
830
  value: string;
831
831
  }
832
832
 
833
- type ScreenName = 'loading' | 'login' | 'otp-verify' | 'create-passkey' | 'verify-passkey' | 'success' | 'processing' | 'confirm-sign' | 'select-source' | 'setup' | 'open-wallet' | 'setup-status' | 'guest-token-picker' | 'wallet-picker' | 'token-picker' | 'deposit' | 'guest-setup-complete';
833
+ type ScreenName = 'loading' | 'login' | 'otp-verify' | 'create-passkey' | 'verify-passkey' | 'success' | 'processing' | 'confirm-sign' | 'select-source' | 'setup' | 'open-wallet' | 'setup-status' | 'guest-token-picker' | 'wallet-picker' | 'token-picker' | 'deposit' | 'guest-setup-complete' | 'guest-preauth-linking';
834
834
  interface MobileFlowState {
835
835
  deeplinkUri: string;
836
836
  providerId: string | null;
@@ -886,6 +886,8 @@ type PaymentPhase = {
886
886
  error: string;
887
887
  } | {
888
888
  step: 'guest-setup-complete';
889
+ } | {
890
+ step: 'guest-preauth-linking';
889
891
  };
890
892
  declare function screenForPhase(phase: PaymentPhase): ScreenName;
891
893
 
@@ -928,10 +930,12 @@ interface SelectSourceScreenProps {
928
930
  onChainChange: (chainName: string) => void;
929
931
  onTokenChange: (tokenSymbol: string) => void;
930
932
  onConfirm: () => void;
933
+ /** Primary footer button label (default: "Confirm source"). */
934
+ confirmLabel?: string;
931
935
  onBack?: () => void;
932
936
  onLogout: () => void;
933
937
  }
934
- declare function SelectSourceScreen({ choices, selectedChainName, selectedTokenSymbol, recommended, onChainChange, onTokenChange, onConfirm, onBack, onLogout, }: SelectSourceScreenProps): react_jsx_runtime.JSX.Element;
938
+ declare function SelectSourceScreen({ choices, selectedChainName, selectedTokenSymbol, recommended, onChainChange, onTokenChange, onConfirm, confirmLabel, onBack, onLogout, }: SelectSourceScreenProps): react_jsx_runtime.JSX.Element;
935
939
 
936
940
  interface ChainChoice {
937
941
  chainName: string;
package/dist/index.js CHANGED
@@ -796,9 +796,9 @@ async function fetchGuestTransferBalances(apiBaseUrl, transferId, guestSessionTo
796
796
  async function fetchGuestAccount(apiBaseUrl, guestToken) {
797
797
  const params = new URLSearchParams({ guestToken });
798
798
  const res = await fetch(`${apiBaseUrl}/v1/accounts?${params.toString()}`);
799
- if (res.status === 404) return null;
800
799
  if (!res.ok) await throwApiError(res);
801
- return await res.json();
800
+ const data = await res.json();
801
+ return data.items[0] ?? null;
802
802
  }
803
803
  async function createGuestAccount(apiBaseUrl, guestSessionToken, providerId, name) {
804
804
  const res = await fetch(`${apiBaseUrl}/v1/accounts`, {
@@ -2090,19 +2090,21 @@ function resolvePhase(state) {
2090
2090
  const branchProcessing = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && (state.creatingTransfer || isTransferAwaitingCompletion(state.transfer));
2091
2091
  const branchKeepFundingSubflow = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && isFundingSourceSubflow;
2092
2092
  const branchMobileWalletSetup = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && state.mobileFlow && state.deeplinkUri != null;
2093
- const branchKeepGuestWalletSetup = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && currentPhase.step === "wallet-setup" && currentPhase.mobile == null && state.guestPreauthorizing;
2094
- const branchGuestTokenPicker = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && guestTokenPickerEligible;
2095
- const branchKeepWalletPickerSwitch = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && walletPickerSwitchEligible;
2096
- const branchInitializingPrivy = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !state.privyReady;
2097
- const branchInitializingPasskeyConfig = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && state.privyAuthenticated && !state.activeCredentialId && !state.passkeyConfigLoaded;
2098
- const branchOtpVerify = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && state.verificationTarget != null && !state.privyAuthenticated;
2099
- const branchLoginRequested = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && state.loginRequested;
2100
- const branchPasskeyVerify = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && shouldPromptPasskeyVerification;
2101
- const branchPasskeyCreate = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && missingActivePasskeyCredential;
2102
- const branchDataLoading = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && state.loadingData && state.activeCredentialId != null && hasActiveWallet(state.accounts);
2103
- const branchWalletPickerLink = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && !branchDataLoading && state.activeCredentialId != null && !hasActiveWallet(state.accounts) && !state.mobileFlow;
2104
- const branchDeposit = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && !branchDataLoading && !branchWalletPickerLink && state.activeCredentialId != null && hasActiveWallet(state.accounts) && !state.loadingData;
2105
- const branchWalletPickerGuestEntry = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && !branchDataLoading && !branchWalletPickerLink && !branchDeposit && state.isGuestFlow;
2093
+ const branchKeepGuestPreauthDesktopOpenWallet = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && currentPhase.step === "wallet-setup" && currentPhase.mobile == null && currentPhase.guestDesktopExtension === true && state.guestPreauthorizing && !state.privyAuthenticated && !state.loginRequested;
2094
+ const branchKeepGuestWalletSetup = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && currentPhase.step === "wallet-setup" && currentPhase.mobile == null && state.guestPreauthorizing && state.privyAuthenticated && state.activeCredentialId != null;
2095
+ const branchGuestTokenPicker = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && guestTokenPickerEligible;
2096
+ const branchKeepWalletPickerSwitch = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && walletPickerSwitchEligible;
2097
+ const branchInitializingPrivy = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !state.privyReady;
2098
+ const branchInitializingPasskeyConfig = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && state.privyAuthenticated && !state.activeCredentialId && !state.passkeyConfigLoaded;
2099
+ const branchOtpVerify = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && state.verificationTarget != null && !state.privyAuthenticated;
2100
+ const branchLoginRequested = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && state.loginRequested;
2101
+ const branchPasskeyVerify = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && shouldPromptPasskeyVerification;
2102
+ const branchPasskeyCreate = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && missingActivePasskeyCredential;
2103
+ const branchGuestPreauthClaiming = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && state.guestPreauthAccountId != null && state.guestSessionToken != null && state.privyAuthenticated && state.activeCredentialId != null && !state.guestPreauthSetupCompletePending && !state.error;
2104
+ const branchDataLoading = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && !branchGuestPreauthClaiming && state.loadingData && state.activeCredentialId != null && hasActiveWallet(state.accounts);
2105
+ const branchWalletPickerLink = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && !branchGuestPreauthClaiming && !branchDataLoading && state.activeCredentialId != null && !hasActiveWallet(state.accounts) && !state.mobileFlow;
2106
+ const branchDeposit = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && !branchGuestPreauthClaiming && !branchDataLoading && !branchWalletPickerLink && state.activeCredentialId != null && hasActiveWallet(state.accounts) && !state.loadingData;
2107
+ const branchWalletPickerGuestEntry = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestPreauthDesktopOpenWallet && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && !branchGuestPreauthClaiming && !branchDataLoading && !branchWalletPickerLink && !branchDeposit && state.isGuestFlow;
2106
2108
  const exclusiveBranchFlags = [
2107
2109
  branchGuestSetupComplete,
2108
2110
  branchKeepGuestPreauthPin,
@@ -2112,6 +2114,7 @@ function resolvePhase(state) {
2112
2114
  branchProcessing,
2113
2115
  branchKeepFundingSubflow,
2114
2116
  branchMobileWalletSetup,
2117
+ branchKeepGuestPreauthDesktopOpenWallet,
2115
2118
  branchKeepGuestWalletSetup,
2116
2119
  branchGuestTokenPicker,
2117
2120
  branchKeepWalletPickerSwitch,
@@ -2121,6 +2124,7 @@ function resolvePhase(state) {
2121
2124
  branchLoginRequested,
2122
2125
  branchPasskeyVerify,
2123
2126
  branchPasskeyCreate,
2127
+ branchGuestPreauthClaiming,
2124
2128
  branchDataLoading,
2125
2129
  branchWalletPickerLink,
2126
2130
  branchDeposit,
@@ -2138,6 +2142,7 @@ function resolvePhase(state) {
2138
2142
  branchProcessing,
2139
2143
  branchKeepFundingSubflow,
2140
2144
  branchMobileWalletSetup,
2145
+ branchKeepGuestPreauthDesktopOpenWallet,
2141
2146
  branchKeepGuestWalletSetup,
2142
2147
  branchGuestTokenPicker,
2143
2148
  branchKeepWalletPickerSwitch,
@@ -2147,6 +2152,7 @@ function resolvePhase(state) {
2147
2152
  branchLoginRequested,
2148
2153
  branchPasskeyVerify,
2149
2154
  branchPasskeyCreate,
2155
+ branchGuestPreauthClaiming,
2150
2156
  branchDataLoading,
2151
2157
  branchWalletPickerLink,
2152
2158
  branchDeposit,
@@ -2179,6 +2185,8 @@ function resolvePhase(state) {
2179
2185
  mobile: { deeplinkUri: state.deeplinkUri, providerId: state.selectedProviderId },
2180
2186
  accountId: null
2181
2187
  };
2188
+ } else if (branchKeepGuestPreauthDesktopOpenWallet) {
2189
+ nextPhase = currentPhase;
2182
2190
  } else if (branchKeepGuestWalletSetup) {
2183
2191
  nextPhase = currentPhase;
2184
2192
  } else if (branchGuestTokenPicker) {
@@ -2197,6 +2205,8 @@ function resolvePhase(state) {
2197
2205
  nextPhase = { step: "passkey-verify" };
2198
2206
  } else if (branchPasskeyCreate) {
2199
2207
  nextPhase = { step: "passkey-create", popupFallback: state.passkeyPopupNeeded };
2208
+ } else if (branchGuestPreauthClaiming) {
2209
+ nextPhase = { step: "guest-preauth-linking" };
2200
2210
  } else if (branchDataLoading) {
2201
2211
  nextPhase = { step: "data-loading" };
2202
2212
  } else if (branchWalletPickerLink) {
@@ -2644,6 +2654,12 @@ function applyAction(state, action) {
2644
2654
  // ── User intent & error ──────────────────────────────────────
2645
2655
  case "SET_USER_INTENT":
2646
2656
  return { ...state, phase: action.intent };
2657
+ case "GUEST_PREAUTH_CLEAR_TRANSFER":
2658
+ return {
2659
+ ...state,
2660
+ transfer: null,
2661
+ creatingTransfer: false
2662
+ };
2647
2663
  case "REQUEST_LOGIN":
2648
2664
  return {
2649
2665
  ...state,
@@ -2784,6 +2800,8 @@ function screenForPhase(phase) {
2784
2800
  return "success";
2785
2801
  case "guest-setup-complete":
2786
2802
  return "guest-setup-complete";
2803
+ case "guest-preauth-linking":
2804
+ return "guest-preauth-linking";
2787
2805
  }
2788
2806
  }
2789
2807
  var MUTED = "#7fa4b0";
@@ -4969,14 +4987,10 @@ function SuccessScreen({
4969
4987
  ScreenLayout,
4970
4988
  {
4971
4989
  footer: /* @__PURE__ */ jsxs(Fragment, { children: [
4972
- /* @__PURE__ */ jsx(PrimaryButton, { onClick: onDone, children: succeeded ? "Done" : "Try again" }),
4973
- succeeded && onPreauthorize && /* @__PURE__ */ jsx(
4974
- PrimaryButton,
4975
- {
4976
- onClick: onPreauthorize,
4977
- children: "Preauthorize future transfers"
4978
- }
4979
- ),
4990
+ succeeded && onPreauthorize ? /* @__PURE__ */ jsxs(Fragment, { children: [
4991
+ /* @__PURE__ */ jsx(PrimaryButton, { onClick: onPreauthorize, children: "Preauthorize future transfers" }),
4992
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: onDone, style: skipButtonStyle(tokens.textMuted), children: "Skip this time" })
4993
+ ] }) : /* @__PURE__ */ jsx(PrimaryButton, { onClick: onDone, children: succeeded ? "Done" : "Try again" }),
4980
4994
  onManageAccount && /* @__PURE__ */ jsx("button", { type: "button", onClick: onManageAccount, style: manageStyle(tokens.textMuted), children: "Manage Blink account \u2192" }),
4981
4995
  /* @__PURE__ */ jsx(PoweredByFooter, {})
4982
4996
  ] }),
@@ -5114,6 +5128,17 @@ var manageStyle = (color) => ({
5114
5128
  textAlign: "center",
5115
5129
  padding: "12px 0 0"
5116
5130
  });
5131
+ var skipButtonStyle = (color) => ({
5132
+ background: "none",
5133
+ border: "none",
5134
+ color,
5135
+ fontSize: "0.85rem",
5136
+ cursor: "pointer",
5137
+ padding: "8px 16px",
5138
+ textDecoration: "underline",
5139
+ fontFamily: "inherit",
5140
+ width: "100%"
5141
+ });
5117
5142
  function SelectSourceScreen({
5118
5143
  choices,
5119
5144
  selectedChainName,
@@ -5122,6 +5147,7 @@ function SelectSourceScreen({
5122
5147
  onChainChange,
5123
5148
  onTokenChange,
5124
5149
  onConfirm,
5150
+ confirmLabel = "Confirm source",
5125
5151
  onBack,
5126
5152
  onLogout
5127
5153
  }) {
@@ -5133,7 +5159,7 @@ function SelectSourceScreen({
5133
5159
  ScreenLayout,
5134
5160
  {
5135
5161
  footer: /* @__PURE__ */ jsxs(Fragment, { children: [
5136
- /* @__PURE__ */ jsx(PrimaryButton, { onClick: onConfirm, disabled: !canConfirm, children: "Confirm source" }),
5162
+ /* @__PURE__ */ jsx(PrimaryButton, { onClick: onConfirm, disabled: !canConfirm, children: confirmLabel }),
5137
5163
  /* @__PURE__ */ jsx(PoweredByFooter, {})
5138
5164
  ] }),
5139
5165
  children: [
@@ -6292,6 +6318,44 @@ function subtitleStyle10(color) {
6292
6318
  maxWidth: 320
6293
6319
  };
6294
6320
  }
6321
+ function GuestPreauthLinkingScreen({ onLogout }) {
6322
+ const { tokens } = useBlinkConfig();
6323
+ return /* @__PURE__ */ jsxs(ScreenLayout, { children: [
6324
+ /* @__PURE__ */ jsx(ScreenHeader, { onLogout }),
6325
+ /* @__PURE__ */ jsxs("div", { style: contentStyle10, children: [
6326
+ /* @__PURE__ */ jsx(Spinner, { size: 48 }),
6327
+ /* @__PURE__ */ jsx("h2", { style: headingStyle13(tokens.text), children: "Setting up your account..." }),
6328
+ /* @__PURE__ */ jsx("p", { style: subtitleStyle11(tokens.textSecondary), children: "Linking your wallet to your Blink account. This usually takes a few seconds." })
6329
+ ] })
6330
+ ] });
6331
+ }
6332
+ var contentStyle10 = {
6333
+ flex: 1,
6334
+ display: "flex",
6335
+ flexDirection: "column",
6336
+ alignItems: "center",
6337
+ justifyContent: "center",
6338
+ textAlign: "center",
6339
+ padding: "0 24px 32px"
6340
+ };
6341
+ function headingStyle13(color) {
6342
+ return {
6343
+ margin: "20px 0 8px",
6344
+ fontSize: "1.45rem",
6345
+ fontWeight: 700,
6346
+ letterSpacing: "-0.02em",
6347
+ color
6348
+ };
6349
+ }
6350
+ function subtitleStyle11(color) {
6351
+ return {
6352
+ margin: 0,
6353
+ fontSize: "0.9rem",
6354
+ lineHeight: 1.5,
6355
+ color,
6356
+ maxWidth: 280
6357
+ };
6358
+ }
6295
6359
  var LINK_SCREENS = /* @__PURE__ */ new Set([
6296
6360
  "create-passkey",
6297
6361
  "verify-passkey",
@@ -6374,6 +6438,8 @@ function StepRendererContent({
6374
6438
  switch (screen) {
6375
6439
  case "loading":
6376
6440
  return /* @__PURE__ */ jsx(BlinkLoadingScreen, {});
6441
+ case "guest-preauth-linking":
6442
+ return /* @__PURE__ */ jsx(GuestPreauthLinkingScreen, { onLogout: handlers.onLogout });
6377
6443
  case "login":
6378
6444
  return /* @__PURE__ */ jsx(
6379
6445
  LoginScreen,
@@ -6557,7 +6623,12 @@ function StepRendererContent({
6557
6623
  recommended: selectSourceRecommended,
6558
6624
  onChainChange: handlers.onSelectSourceChainChange,
6559
6625
  onTokenChange: handlers.onSetSelectSourceTokenSymbol,
6560
- onConfirm: handlers.onConfirmSelectSource,
6626
+ onConfirm: isDesktop ? () => handlers.onSetPhase({
6627
+ step: "select-source",
6628
+ action: pendingSelectSource,
6629
+ isDesktop
6630
+ }) : handlers.onConfirmSelectSource,
6631
+ confirmLabel: isDesktop ? "Done" : void 0,
6561
6632
  onBack: () => handlers.onSetPhase({
6562
6633
  step: "select-source",
6563
6634
  action: pendingSelectSource,
@@ -6650,7 +6721,7 @@ function StepRendererContent({
6650
6721
  return limit > displayAmount ? limit - displayAmount : 0;
6651
6722
  })() : void 0,
6652
6723
  onDone: onDismiss ?? handlers.onNewPayment,
6653
- onLogout: handlers.onLogout,
6724
+ onLogout: authenticated ? handlers.onLogout : void 0,
6654
6725
  onPreauthorize: state.isGuestFlow ? handlers.onPreauthorize : void 0
6655
6726
  }
6656
6727
  );
@@ -6698,7 +6769,7 @@ var PaymentErrorBoundary = class extends Component {
6698
6769
  /* @__PURE__ */ jsx("path", { d: "M12 8v5", stroke: "#ef4444", strokeWidth: "1.5", strokeLinecap: "round" }),
6699
6770
  /* @__PURE__ */ jsx("circle", { cx: "12", cy: "16", r: "0.75", fill: "#ef4444" })
6700
6771
  ] }) }),
6701
- /* @__PURE__ */ jsx("h2", { style: headingStyle13, children: "Something went wrong" }),
6772
+ /* @__PURE__ */ jsx("h2", { style: headingStyle14, children: "Something went wrong" }),
6702
6773
  /* @__PURE__ */ jsx("p", { style: messageStyle, children: "An unexpected error occurred. Please try again." }),
6703
6774
  /* @__PURE__ */ jsx("button", { type: "button", onClick: this.handleReset, style: buttonStyle3, children: "Try again" })
6704
6775
  ] });
@@ -6718,7 +6789,7 @@ var containerStyle9 = {
6718
6789
  var iconStyle3 = {
6719
6790
  marginBottom: 20
6720
6791
  };
6721
- var headingStyle13 = {
6792
+ var headingStyle14 = {
6722
6793
  fontSize: "1.25rem",
6723
6794
  fontWeight: 700,
6724
6795
  color: "#1a1a1a",
@@ -7221,15 +7292,10 @@ function useSourceSelectionHandlers(dispatch, authExecutor, options) {
7221
7292
  const handleConfirmSelectSource = useCallback(() => {
7222
7293
  const guestPostPayPreauth = !!options?.guestPreauthSessionId && !!options?.isGuestFlow || !!options?.guestPreauthorizing && !!options?.isDesktop;
7223
7294
  if (guestPostPayPreauth) {
7224
- dispatch({ type: "REQUEST_LOGIN" });
7225
- if (options?.guestPreauthAccountId != null) {
7226
- const intent = {
7227
- step: "wallet-setup",
7228
- mobile: null,
7229
- accountId: options.guestPreauthAccountId,
7230
- guestDesktopExtension: true
7231
- };
7232
- dispatch({ type: "SET_USER_INTENT", intent });
7295
+ if (options?.guestPreauthorizing && options?.isDesktop) {
7296
+ dispatch({ type: "GUEST_PREAUTH_CLEAR_TRANSFER" });
7297
+ } else {
7298
+ dispatch({ type: "REQUEST_LOGIN" });
7233
7299
  }
7234
7300
  }
7235
7301
  authExecutor.resolveSelectSource({
@@ -7240,7 +7306,6 @@ function useSourceSelectionHandlers(dispatch, authExecutor, options) {
7240
7306
  authExecutor,
7241
7307
  dispatch,
7242
7308
  options?.guestPreauthSessionId,
7243
- options?.guestPreauthAccountId,
7244
7309
  options?.guestPreauthorizing,
7245
7310
  options?.isDesktop,
7246
7311
  options?.isGuestFlow,
@@ -8123,7 +8188,7 @@ function useOneTapSetupHandlers(deps) {
8123
8188
  selectSourceTokenSymbol,
8124
8189
  authorizationSessionIdForGuest,
8125
8190
  guestPostPayPreauth,
8126
- guestPreauthAccountId
8191
+ deferGuestPreauthLogin = false
8127
8192
  } = deps;
8128
8193
  const [savingOneTapLimit, setSavingOneTapLimit] = useState(false);
8129
8194
  const handleSetupOneTap = useCallback(async (limit) => {
@@ -8142,15 +8207,10 @@ function useOneTapSetupHandlers(deps) {
8142
8207
  }
8143
8208
  const willResolveSession = authExecutor.pendingSelectSource != null || authExecutor.pendingOneTapSetup != null;
8144
8209
  if (guestPostPayPreauth && willResolveSession) {
8145
- dispatch({ type: "REQUEST_LOGIN" });
8146
- if (guestPreauthAccountId != null) {
8147
- const intent = {
8148
- step: "wallet-setup",
8149
- mobile: null,
8150
- accountId: guestPreauthAccountId,
8151
- guestDesktopExtension: true
8152
- };
8153
- dispatch({ type: "SET_USER_INTENT", intent });
8210
+ if (deferGuestPreauthLogin) {
8211
+ dispatch({ type: "GUEST_PREAUTH_CLEAR_TRANSFER" });
8212
+ } else {
8213
+ dispatch({ type: "REQUEST_LOGIN" });
8154
8214
  }
8155
8215
  }
8156
8216
  if (authExecutor.pendingSelectSource) {
@@ -8193,7 +8253,7 @@ function useOneTapSetupHandlers(deps) {
8193
8253
  selectSourceTokenSymbol,
8194
8254
  authorizationSessionIdForGuest,
8195
8255
  guestPostPayPreauth,
8196
- guestPreauthAccountId
8256
+ deferGuestPreauthLogin
8197
8257
  ]);
8198
8258
  return {
8199
8259
  handleSetupOneTap,
@@ -9168,7 +9228,7 @@ function useGuestPreauthEffect(deps) {
9168
9228
  ]);
9169
9229
  }
9170
9230
  function useGuestDesktopPreauthSessionEffect(deps) {
9171
- const { state, authExecutor, reloadAccounts, dispatch, desktopGuestPreauth } = deps;
9231
+ const { state, authExecutor, reloadAccounts, dispatch, desktopGuestPreauth, privyAuthenticatedRef } = deps;
9172
9232
  const preauthExecutingRef = useRef(false);
9173
9233
  useEffect(() => {
9174
9234
  if (!desktopGuestPreauth) return;
@@ -9183,6 +9243,9 @@ function useGuestDesktopPreauthSessionEffect(deps) {
9183
9243
  } finally {
9184
9244
  preauthExecutingRef.current = false;
9185
9245
  dispatch({ type: "GUEST_PREAUTH_END" });
9246
+ if (!privyAuthenticatedRef.current) {
9247
+ dispatch({ type: "REQUEST_LOGIN" });
9248
+ }
9186
9249
  }
9187
9250
  };
9188
9251
  void runPreauthSession();
@@ -9192,11 +9255,12 @@ function useGuestDesktopPreauthSessionEffect(deps) {
9192
9255
  state.guestPreauthSessionId,
9193
9256
  authExecutor,
9194
9257
  reloadAccounts,
9195
- dispatch
9258
+ dispatch,
9259
+ privyAuthenticatedRef
9196
9260
  ]);
9197
9261
  }
9198
9262
  function useGuestPreauthPhaseSyncEffect(deps) {
9199
- const { state, dispatch, authExecutor, isDesktop } = deps;
9263
+ const { state, dispatch, authExecutor, isDesktop, privyAuthenticated } = deps;
9200
9264
  useEffect(() => {
9201
9265
  if (!state.guestPreauthorizing || !isDesktop) return;
9202
9266
  const pending = authExecutor.pendingSelectSource;
@@ -9215,6 +9279,30 @@ function useGuestPreauthPhaseSyncEffect(deps) {
9215
9279
  dispatch({ type: "SET_USER_INTENT", intent });
9216
9280
  return;
9217
9281
  }
9282
+ if (authExecutor.pendingOneTapSetup) {
9283
+ if (state.phase.step === "one-tap-setup") {
9284
+ return;
9285
+ }
9286
+ dispatch({ type: "SET_USER_INTENT", intent: { step: "one-tap-setup", action: null } });
9287
+ return;
9288
+ }
9289
+ if (!privyAuthenticated && authExecutor.executing && state.guestPreauthAccountId) {
9290
+ const accountId = state.guestPreauthAccountId;
9291
+ const p = state.phase;
9292
+ if (p.step === "wallet-setup" && p.mobile == null && p.guestDesktopExtension && p.accountId === accountId) {
9293
+ return;
9294
+ }
9295
+ dispatch({
9296
+ type: "SET_USER_INTENT",
9297
+ intent: {
9298
+ step: "wallet-setup",
9299
+ mobile: null,
9300
+ accountId,
9301
+ guestDesktopExtension: true
9302
+ }
9303
+ });
9304
+ return;
9305
+ }
9218
9306
  if (state.phase.step === "select-source") {
9219
9307
  dispatch({ type: "SET_USER_INTENT", intent: { step: "one-tap-setup", action: null } });
9220
9308
  return;
@@ -9225,8 +9313,12 @@ function useGuestPreauthPhaseSyncEffect(deps) {
9225
9313
  }, [
9226
9314
  state.guestPreauthorizing,
9227
9315
  state.phase,
9316
+ state.guestPreauthAccountId,
9228
9317
  isDesktop,
9318
+ privyAuthenticated,
9229
9319
  authExecutor.pendingSelectSource,
9320
+ authExecutor.pendingOneTapSetup,
9321
+ authExecutor.executing,
9230
9322
  dispatch
9231
9323
  ]);
9232
9324
  }
@@ -9235,6 +9327,7 @@ function useGuestPreauthWalletSetupEffect(deps) {
9235
9327
  useEffect(() => {
9236
9328
  if (!isDesktop || !state.guestPreauthorizing || !state.guestPreauthSessionId) return;
9237
9329
  if (!state.guestPreauthAccountId) return;
9330
+ if (!state.privyAuthenticated || state.activeCredentialId == null) return;
9238
9331
  if (!authExecutor.executing || authExecutor.pendingSelectSource) return;
9239
9332
  if (state.verificationTarget) return;
9240
9333
  const p = state.phase;
@@ -9255,6 +9348,8 @@ function useGuestPreauthWalletSetupEffect(deps) {
9255
9348
  state.guestPreauthorizing,
9256
9349
  state.guestPreauthSessionId,
9257
9350
  state.guestPreauthAccountId,
9351
+ state.privyAuthenticated,
9352
+ state.activeCredentialId,
9258
9353
  state.verificationTarget,
9259
9354
  state.phase,
9260
9355
  authExecutor.executing,
@@ -9427,6 +9522,8 @@ function BlinkPaymentInner({
9427
9522
  const { apiBaseUrl, depositAmount } = useBlinkConfig();
9428
9523
  const { ready, authenticated, logout, getAccessToken } = usePrivy();
9429
9524
  useLoginWithOAuth();
9525
+ const privyAuthenticatedRef = useRef(false);
9526
+ privyAuthenticatedRef.current = authenticated;
9430
9527
  const isDesktop = shouldUseWalletConnector({
9431
9528
  useWalletConnector: useWalletConnectorProp,
9432
9529
  userAgent: typeof navigator === "undefined" ? void 0 : navigator.userAgent
@@ -9497,7 +9594,6 @@ function BlinkPaymentInner({
9497
9594
  );
9498
9595
  const sourceSelection = useSourceSelectionHandlers(dispatch, authExecutor, {
9499
9596
  guestPreauthSessionId: state.guestPreauthSessionId,
9500
- guestPreauthAccountId: state.guestPreauthAccountId,
9501
9597
  isGuestFlow: state.isGuestFlow,
9502
9598
  guestPreauthorizing: state.guestPreauthorizing,
9503
9599
  isDesktop
@@ -9540,6 +9636,7 @@ function BlinkPaymentInner({
9540
9636
  isDesktop
9541
9637
  ]
9542
9638
  );
9639
+ const deferGuestPreauthLogin = state.guestPreauthorizing && isDesktop;
9543
9640
  const oneTapSetup = useOneTapSetupHandlers({
9544
9641
  dispatch,
9545
9642
  getAccessToken,
@@ -9549,7 +9646,7 @@ function BlinkPaymentInner({
9549
9646
  selectSourceTokenSymbol: sourceSelection.selectSourceTokenSymbol,
9550
9647
  authorizationSessionIdForGuest: state.guestPreauthSessionId,
9551
9648
  guestPostPayPreauth,
9552
- guestPreauthAccountId: state.guestPreauthAccountId
9649
+ deferGuestPreauthLogin
9553
9650
  });
9554
9651
  const guestTransfer = useGuestTransferHandlers({
9555
9652
  dispatch,
@@ -9742,14 +9839,16 @@ function BlinkPaymentInner({
9742
9839
  state,
9743
9840
  dispatch,
9744
9841
  authExecutor,
9745
- isDesktop
9842
+ isDesktop,
9843
+ privyAuthenticated: authenticated
9746
9844
  });
9747
9845
  useGuestDesktopPreauthSessionEffect({
9748
9846
  state,
9749
9847
  authExecutor,
9750
9848
  reloadAccounts: transfer.reloadAccounts,
9751
9849
  dispatch,
9752
- desktopGuestPreauth: isDesktop
9850
+ desktopGuestPreauth: isDesktop,
9851
+ privyAuthenticatedRef
9753
9852
  });
9754
9853
  useGuestPreauthWalletSetupEffect({
9755
9854
  state,