@swype-org/react-sdk 0.1.114 → 0.1.116
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 +20 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -30,6 +30,8 @@ interface WalletSource {
|
|
|
30
30
|
address: string;
|
|
31
31
|
token: WalletToken;
|
|
32
32
|
balance: TokenBalance;
|
|
33
|
+
/** Remaining One-Tap allowance in USD for this token on this chain, or null when not configured. */
|
|
34
|
+
remainingAllowance?: number | null;
|
|
33
35
|
}
|
|
34
36
|
/** Full wallet with chain, balance, and token sources */
|
|
35
37
|
interface Wallet {
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ interface WalletSource {
|
|
|
30
30
|
address: string;
|
|
31
31
|
token: WalletToken;
|
|
32
32
|
balance: TokenBalance;
|
|
33
|
+
/** Remaining One-Tap allowance in USD for this token on this chain, or null when not configured. */
|
|
34
|
+
remainingAllowance?: number | null;
|
|
33
35
|
}
|
|
34
36
|
/** Full wallet with chain, balance, and token sources */
|
|
35
37
|
interface Wallet {
|
package/dist/index.js
CHANGED
|
@@ -2166,7 +2166,7 @@ function paymentReducer(state, action) {
|
|
|
2166
2166
|
};
|
|
2167
2167
|
// ── Navigation & error ───────────────────────────────────────
|
|
2168
2168
|
case "NAVIGATE":
|
|
2169
|
-
return { ...state, step: action.step };
|
|
2169
|
+
return { ...state, step: action.step, error: null };
|
|
2170
2170
|
case "SET_ERROR":
|
|
2171
2171
|
return { ...state, error: action.error };
|
|
2172
2172
|
// ── Lifecycle ────────────────────────────────────────────────
|
|
@@ -5573,6 +5573,7 @@ function StepRenderer({
|
|
|
5573
5573
|
maxSourceBalance,
|
|
5574
5574
|
tokenCount,
|
|
5575
5575
|
selectedAccount,
|
|
5576
|
+
selectedSource,
|
|
5576
5577
|
selectSourceChoices,
|
|
5577
5578
|
selectSourceRecommended,
|
|
5578
5579
|
authInput,
|
|
@@ -5682,7 +5683,7 @@ function StepRenderer({
|
|
|
5682
5683
|
return /* @__PURE__ */ jsx(
|
|
5683
5684
|
SetupScreen,
|
|
5684
5685
|
{
|
|
5685
|
-
availableBalance: selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
|
|
5686
|
+
availableBalance: selectedSource ? selectedSource.balance.available.amount : selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
|
|
5686
5687
|
tokenCount,
|
|
5687
5688
|
sourceName,
|
|
5688
5689
|
onSetupOneTap: handlers.onSetupOneTap,
|
|
@@ -5718,8 +5719,8 @@ function StepRenderer({
|
|
|
5718
5719
|
sourceName,
|
|
5719
5720
|
sourceAddress,
|
|
5720
5721
|
sourceVerified,
|
|
5721
|
-
availableBalance: selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
|
|
5722
|
-
remainingLimit: selectedAccount?.remainingAllowance ?? state.oneTapLimit,
|
|
5722
|
+
availableBalance: selectedSource ? selectedSource.balance.available.amount : selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
|
|
5723
|
+
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? state.oneTapLimit,
|
|
5723
5724
|
tokenCount,
|
|
5724
5725
|
initialAmount: parsedAmt,
|
|
5725
5726
|
processing: state.creatingTransfer,
|
|
@@ -5795,7 +5796,7 @@ function StepRenderer({
|
|
|
5795
5796
|
merchantName,
|
|
5796
5797
|
sourceName,
|
|
5797
5798
|
remainingLimit: succeeded ? (() => {
|
|
5798
|
-
const limit = selectedAccount?.remainingAllowance ?? state.oneTapLimit;
|
|
5799
|
+
const limit = selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? state.oneTapLimit;
|
|
5799
5800
|
return limit > displayAmount ? limit - displayAmount : 0;
|
|
5800
5801
|
})() : void 0,
|
|
5801
5802
|
onDone: onDismiss ?? handlers.onNewPayment,
|
|
@@ -5813,7 +5814,7 @@ function StepRenderer({
|
|
|
5813
5814
|
sourceAddress,
|
|
5814
5815
|
sourceVerified,
|
|
5815
5816
|
availableBalance: 0,
|
|
5816
|
-
remainingLimit: selectedAccount?.remainingAllowance ?? state.oneTapLimit,
|
|
5817
|
+
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? state.oneTapLimit,
|
|
5817
5818
|
tokenCount,
|
|
5818
5819
|
initialAmount: depositAmount ?? 5,
|
|
5819
5820
|
processing: false,
|
|
@@ -5972,6 +5973,15 @@ function SwypePaymentInner({
|
|
|
5972
5973
|
const selectedWallet = selectedAccount?.wallets.find(
|
|
5973
5974
|
(w) => w.id === state.selectedWalletId
|
|
5974
5975
|
);
|
|
5976
|
+
const selectedSource = useMemo(() => {
|
|
5977
|
+
if (!selectedWallet) return null;
|
|
5978
|
+
if (state.selectedTokenSymbol) {
|
|
5979
|
+
return selectedWallet.sources.find(
|
|
5980
|
+
(s) => s.token.symbol === state.selectedTokenSymbol
|
|
5981
|
+
) ?? null;
|
|
5982
|
+
}
|
|
5983
|
+
return selectedWallet.sources.find((s) => s.token.status === "AUTHORIZED") ?? selectedWallet.sources[0] ?? null;
|
|
5984
|
+
}, [selectedWallet, state.selectedTokenSymbol]);
|
|
5975
5985
|
const sourceName = selectedAccount?.name ?? selectedWallet?.chain.name ?? "Wallet";
|
|
5976
5986
|
const sourceAddress = selectedWallet ? `${selectedWallet.name.slice(0, 6)}...${selectedWallet.name.slice(-4)}` : void 0;
|
|
5977
5987
|
const sourceVerified = selectedWallet?.status === "ACTIVE";
|
|
@@ -6650,11 +6660,11 @@ function SwypePaymentInner({
|
|
|
6650
6660
|
}
|
|
6651
6661
|
}, [depositAmount]);
|
|
6652
6662
|
useEffect(() => {
|
|
6653
|
-
if (authenticated) return;
|
|
6663
|
+
if (authenticated || state.step !== "otp-verify") return;
|
|
6654
6664
|
if (activeOtpErrorMessage) dispatch({ type: "SET_ERROR", error: activeOtpErrorMessage });
|
|
6655
|
-
}, [activeOtpErrorMessage, authenticated]);
|
|
6665
|
+
}, [activeOtpErrorMessage, authenticated, state.step]);
|
|
6656
6666
|
useEffect(() => {
|
|
6657
|
-
if (state.step === "otp-verify" && /^\d{6}$/.test(otpCode.trim()) && activeOtpStatus
|
|
6667
|
+
if (state.step === "otp-verify" && /^\d{6}$/.test(otpCode.trim()) && activeOtpStatus === "awaiting-code-input") {
|
|
6658
6668
|
handleVerifyLoginCode();
|
|
6659
6669
|
}
|
|
6660
6670
|
}, [otpCode, state.step, activeOtpStatus, handleVerifyLoginCode]);
|
|
@@ -7135,6 +7145,7 @@ function SwypePaymentInner({
|
|
|
7135
7145
|
maxSourceBalance,
|
|
7136
7146
|
tokenCount,
|
|
7137
7147
|
selectedAccount,
|
|
7148
|
+
selectedSource,
|
|
7138
7149
|
selectSourceChoices,
|
|
7139
7150
|
selectSourceRecommended,
|
|
7140
7151
|
authInput,
|