@swype-org/react-sdk 0.1.259 → 0.1.260
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 +118 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +118 -118
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2057,143 +2057,143 @@ function isGuestPreauthCompletedTransferPinPhase(phase) {
|
|
|
2057
2057
|
}
|
|
2058
2058
|
}
|
|
2059
2059
|
function resolvePhase(state) {
|
|
2060
|
-
const
|
|
2060
|
+
const currentPhase = state.phase;
|
|
2061
2061
|
const transferCompleted = state.transfer?.status === "COMPLETED";
|
|
2062
2062
|
const needsPasskeyBootstrap = state.privyAuthenticated && !state.activeCredentialId;
|
|
2063
|
-
const
|
|
2063
|
+
const guestPreauthPinsCurrentPhase = transferCompleted && state.guestPreauthorizing && !state.verificationTarget && isGuestPreauthCompletedTransferPinPhase(currentPhase);
|
|
2064
2064
|
const guestPostPayLogin = transferCompleted && state.isGuestFlow && state.guestPreauthSessionId != null && !state.guestPreauthorizing && !state.verificationTarget && !state.privyAuthenticated;
|
|
2065
|
-
const
|
|
2066
|
-
const
|
|
2067
|
-
const
|
|
2068
|
-
const
|
|
2069
|
-
const
|
|
2070
|
-
const
|
|
2071
|
-
const
|
|
2072
|
-
const
|
|
2073
|
-
const
|
|
2074
|
-
const
|
|
2075
|
-
const
|
|
2076
|
-
const
|
|
2077
|
-
const
|
|
2078
|
-
const
|
|
2079
|
-
const
|
|
2080
|
-
const
|
|
2081
|
-
const
|
|
2082
|
-
const
|
|
2083
|
-
const
|
|
2084
|
-
const
|
|
2085
|
-
const
|
|
2086
|
-
const
|
|
2087
|
-
const
|
|
2088
|
-
const
|
|
2089
|
-
const
|
|
2090
|
-
const
|
|
2091
|
-
const
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2065
|
+
const isFundingSourceSubflow = !state.loginRequested && (currentPhase.step === "token-picker" || currentPhase.step === "one-tap-setup" || currentPhase.step === "select-source" || currentPhase.step === "confirm-sign" || currentPhase.step === "guest-token-picker");
|
|
2066
|
+
const guestTokenPickerEligible = state.isGuestFlow && state.selectedProviderId != null && !state.transfer && !state.guestPreauthAccountId;
|
|
2067
|
+
const walletPickerSwitchEligible = currentPhase.step === "wallet-picker" && currentPhase.reason === "switch" && !state.creatingTransfer && !(state.mobileFlow && state.deeplinkUri);
|
|
2068
|
+
const missingActivePasskeyCredential = state.passkeyConfigLoaded && !state.activeCredentialId;
|
|
2069
|
+
const shouldPromptPasskeyVerification = missingActivePasskeyCredential && state.knownCredentialIds.length > 0 && state.passkeyPopupNeeded;
|
|
2070
|
+
const branchGuestSetupComplete = state.guestPreauthSetupCompletePending && state.privyReady && state.privyAuthenticated;
|
|
2071
|
+
const branchKeepGuestPreauthPin = !branchGuestSetupComplete && guestPreauthPinsCurrentPhase;
|
|
2072
|
+
const branchGuestPostPayLogin = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && guestPostPayLogin;
|
|
2073
|
+
const branchCompleted = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && transferCompleted && !state.verificationTarget && !needsPasskeyBootstrap;
|
|
2074
|
+
const branchFailed = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && state.transfer?.status === "FAILED";
|
|
2075
|
+
const branchProcessing = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && (state.creatingTransfer || isTransferAwaitingCompletion(state.transfer));
|
|
2076
|
+
const branchKeepFundingSubflow = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && isFundingSourceSubflow;
|
|
2077
|
+
const branchMobileWalletSetup = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && state.mobileFlow && state.deeplinkUri != null;
|
|
2078
|
+
const branchKeepGuestWalletSetup = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && currentPhase.step === "wallet-setup" && currentPhase.mobile == null && state.guestPreauthorizing;
|
|
2079
|
+
const branchGuestTokenPicker = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && guestTokenPickerEligible;
|
|
2080
|
+
const branchKeepWalletPickerSwitch = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && walletPickerSwitchEligible;
|
|
2081
|
+
const branchInitializingPrivy = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !state.privyReady;
|
|
2082
|
+
const branchInitializingPasskeyConfig = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && state.privyAuthenticated && !state.activeCredentialId && !state.passkeyConfigLoaded;
|
|
2083
|
+
const branchOtpVerify = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && state.verificationTarget != null && !state.privyAuthenticated;
|
|
2084
|
+
const branchLoginRequested = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && state.loginRequested;
|
|
2085
|
+
const branchPasskeyVerify = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && shouldPromptPasskeyVerification;
|
|
2086
|
+
const branchPasskeyCreate = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && missingActivePasskeyCredential;
|
|
2087
|
+
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);
|
|
2088
|
+
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;
|
|
2089
|
+
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;
|
|
2090
|
+
const branchWalletPickerGuestEntry = !branchGuestSetupComplete && !branchKeepGuestPreauthPin && !branchGuestPostPayLogin && !branchCompleted && !branchFailed && !branchProcessing && !branchKeepFundingSubflow && !branchMobileWalletSetup && !branchKeepGuestWalletSetup && !branchGuestTokenPicker && !branchKeepWalletPickerSwitch && !branchInitializingPrivy && !branchInitializingPasskeyConfig && !branchOtpVerify && !branchLoginRequested && !branchPasskeyVerify && !branchPasskeyCreate && !branchDataLoading && !branchWalletPickerLink && !branchDeposit && state.isGuestFlow;
|
|
2091
|
+
const exclusiveBranchFlags = [
|
|
2092
|
+
branchGuestSetupComplete,
|
|
2093
|
+
branchKeepGuestPreauthPin,
|
|
2094
|
+
branchGuestPostPayLogin,
|
|
2095
|
+
branchCompleted,
|
|
2096
|
+
branchFailed,
|
|
2097
|
+
branchProcessing,
|
|
2098
|
+
branchKeepFundingSubflow,
|
|
2099
|
+
branchMobileWalletSetup,
|
|
2100
|
+
branchKeepGuestWalletSetup,
|
|
2101
|
+
branchGuestTokenPicker,
|
|
2102
|
+
branchKeepWalletPickerSwitch,
|
|
2103
|
+
branchInitializingPrivy,
|
|
2104
|
+
branchInitializingPasskeyConfig,
|
|
2105
|
+
branchOtpVerify,
|
|
2106
|
+
branchLoginRequested,
|
|
2107
|
+
branchPasskeyVerify,
|
|
2108
|
+
branchPasskeyCreate,
|
|
2109
|
+
branchDataLoading,
|
|
2110
|
+
branchWalletPickerLink,
|
|
2111
|
+
branchDeposit,
|
|
2112
|
+
branchWalletPickerGuestEntry
|
|
2113
2113
|
];
|
|
2114
|
-
const matchCount =
|
|
2114
|
+
const matchCount = exclusiveBranchFlags.filter(Boolean).length;
|
|
2115
2115
|
if (matchCount > 1) {
|
|
2116
2116
|
console.error("resolvePhase: multiple exclusive branches matched", {
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2117
|
+
branches: {
|
|
2118
|
+
branchGuestSetupComplete,
|
|
2119
|
+
branchKeepGuestPreauthPin,
|
|
2120
|
+
branchGuestPostPayLogin,
|
|
2121
|
+
branchCompleted,
|
|
2122
|
+
branchFailed,
|
|
2123
|
+
branchProcessing,
|
|
2124
|
+
branchKeepFundingSubflow,
|
|
2125
|
+
branchMobileWalletSetup,
|
|
2126
|
+
branchKeepGuestWalletSetup,
|
|
2127
|
+
branchGuestTokenPicker,
|
|
2128
|
+
branchKeepWalletPickerSwitch,
|
|
2129
|
+
branchInitializingPrivy,
|
|
2130
|
+
branchInitializingPasskeyConfig,
|
|
2131
|
+
branchOtpVerify,
|
|
2132
|
+
branchLoginRequested,
|
|
2133
|
+
branchPasskeyVerify,
|
|
2134
|
+
branchPasskeyCreate,
|
|
2135
|
+
branchDataLoading,
|
|
2136
|
+
branchWalletPickerLink,
|
|
2137
|
+
branchDeposit,
|
|
2138
|
+
branchWalletPickerGuestEntry
|
|
2139
2139
|
}
|
|
2140
2140
|
});
|
|
2141
2141
|
}
|
|
2142
|
-
let
|
|
2143
|
-
if (
|
|
2144
|
-
|
|
2145
|
-
} else if (
|
|
2146
|
-
|
|
2147
|
-
} else if (
|
|
2148
|
-
|
|
2149
|
-
} else if (
|
|
2150
|
-
|
|
2151
|
-
} else if (
|
|
2152
|
-
|
|
2142
|
+
let nextPhase;
|
|
2143
|
+
if (branchGuestSetupComplete) {
|
|
2144
|
+
nextPhase = { step: "guest-setup-complete" };
|
|
2145
|
+
} else if (branchKeepGuestPreauthPin) {
|
|
2146
|
+
nextPhase = currentPhase;
|
|
2147
|
+
} else if (branchGuestPostPayLogin) {
|
|
2148
|
+
nextPhase = { step: "login" };
|
|
2149
|
+
} else if (branchCompleted) {
|
|
2150
|
+
nextPhase = { step: "completed", transfer: state.transfer };
|
|
2151
|
+
} else if (branchFailed) {
|
|
2152
|
+
nextPhase = {
|
|
2153
2153
|
step: "failed",
|
|
2154
2154
|
transfer: state.transfer,
|
|
2155
2155
|
error: state.error ?? "Transfer failed."
|
|
2156
2156
|
};
|
|
2157
|
-
} else if (
|
|
2158
|
-
|
|
2159
|
-
} else if (
|
|
2160
|
-
|
|
2161
|
-
} else if (
|
|
2162
|
-
|
|
2157
|
+
} else if (branchProcessing) {
|
|
2158
|
+
nextPhase = { step: "processing", transfer: state.transfer };
|
|
2159
|
+
} else if (branchKeepFundingSubflow) {
|
|
2160
|
+
nextPhase = currentPhase;
|
|
2161
|
+
} else if (branchMobileWalletSetup) {
|
|
2162
|
+
nextPhase = {
|
|
2163
2163
|
step: "wallet-setup",
|
|
2164
2164
|
mobile: { deeplinkUri: state.deeplinkUri, providerId: state.selectedProviderId },
|
|
2165
2165
|
accountId: null
|
|
2166
2166
|
};
|
|
2167
|
-
} else if (
|
|
2168
|
-
|
|
2169
|
-
} else if (
|
|
2170
|
-
|
|
2171
|
-
} else if (
|
|
2172
|
-
|
|
2173
|
-
} else if (
|
|
2174
|
-
|
|
2175
|
-
} else if (
|
|
2176
|
-
|
|
2177
|
-
} else if (
|
|
2178
|
-
|
|
2179
|
-
} else if (
|
|
2180
|
-
|
|
2181
|
-
} else if (
|
|
2182
|
-
|
|
2183
|
-
} else if (
|
|
2184
|
-
|
|
2185
|
-
} else if (
|
|
2186
|
-
|
|
2187
|
-
} else if (
|
|
2188
|
-
|
|
2189
|
-
} else if (
|
|
2190
|
-
|
|
2191
|
-
} else if (
|
|
2192
|
-
|
|
2167
|
+
} else if (branchKeepGuestWalletSetup) {
|
|
2168
|
+
nextPhase = currentPhase;
|
|
2169
|
+
} else if (branchGuestTokenPicker) {
|
|
2170
|
+
nextPhase = { step: "guest-token-picker" };
|
|
2171
|
+
} else if (branchKeepWalletPickerSwitch) {
|
|
2172
|
+
nextPhase = currentPhase;
|
|
2173
|
+
} else if (branchInitializingPrivy) {
|
|
2174
|
+
nextPhase = { step: "initializing" };
|
|
2175
|
+
} else if (branchInitializingPasskeyConfig) {
|
|
2176
|
+
nextPhase = { step: "initializing" };
|
|
2177
|
+
} else if (branchOtpVerify) {
|
|
2178
|
+
nextPhase = { step: "otp-verify", target: state.verificationTarget };
|
|
2179
|
+
} else if (branchLoginRequested) {
|
|
2180
|
+
nextPhase = { step: "login" };
|
|
2181
|
+
} else if (branchPasskeyVerify) {
|
|
2182
|
+
nextPhase = { step: "passkey-verify" };
|
|
2183
|
+
} else if (branchPasskeyCreate) {
|
|
2184
|
+
nextPhase = { step: "passkey-create", popupFallback: state.passkeyPopupNeeded };
|
|
2185
|
+
} else if (branchDataLoading) {
|
|
2186
|
+
nextPhase = { step: "data-loading" };
|
|
2187
|
+
} else if (branchWalletPickerLink) {
|
|
2188
|
+
nextPhase = { step: "wallet-picker", reason: "link" };
|
|
2189
|
+
} else if (branchDeposit) {
|
|
2190
|
+
nextPhase = { step: "deposit" };
|
|
2191
|
+
} else if (branchWalletPickerGuestEntry) {
|
|
2192
|
+
nextPhase = { step: "wallet-picker", reason: "guest-entry" };
|
|
2193
2193
|
} else {
|
|
2194
|
-
|
|
2194
|
+
nextPhase = { step: "wallet-picker", reason: "entry" };
|
|
2195
2195
|
}
|
|
2196
|
-
return
|
|
2196
|
+
return nextPhase;
|
|
2197
2197
|
}
|
|
2198
2198
|
|
|
2199
2199
|
// src/paymentReducer.ts
|