@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.cjs
CHANGED
|
@@ -2169,7 +2169,7 @@ function paymentReducer(state, action) {
|
|
|
2169
2169
|
};
|
|
2170
2170
|
// ── Navigation & error ───────────────────────────────────────
|
|
2171
2171
|
case "NAVIGATE":
|
|
2172
|
-
return { ...state, step: action.step };
|
|
2172
|
+
return { ...state, step: action.step, error: null };
|
|
2173
2173
|
case "SET_ERROR":
|
|
2174
2174
|
return { ...state, error: action.error };
|
|
2175
2175
|
// ── Lifecycle ────────────────────────────────────────────────
|
|
@@ -5576,6 +5576,7 @@ function StepRenderer({
|
|
|
5576
5576
|
maxSourceBalance,
|
|
5577
5577
|
tokenCount,
|
|
5578
5578
|
selectedAccount,
|
|
5579
|
+
selectedSource,
|
|
5579
5580
|
selectSourceChoices,
|
|
5580
5581
|
selectSourceRecommended,
|
|
5581
5582
|
authInput,
|
|
@@ -5685,7 +5686,7 @@ function StepRenderer({
|
|
|
5685
5686
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5686
5687
|
SetupScreen,
|
|
5687
5688
|
{
|
|
5688
|
-
availableBalance: selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
|
|
5689
|
+
availableBalance: selectedSource ? selectedSource.balance.available.amount : selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
|
|
5689
5690
|
tokenCount,
|
|
5690
5691
|
sourceName,
|
|
5691
5692
|
onSetupOneTap: handlers.onSetupOneTap,
|
|
@@ -5721,8 +5722,8 @@ function StepRenderer({
|
|
|
5721
5722
|
sourceName,
|
|
5722
5723
|
sourceAddress,
|
|
5723
5724
|
sourceVerified,
|
|
5724
|
-
availableBalance: selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
|
|
5725
|
-
remainingLimit: selectedAccount?.remainingAllowance ?? state.oneTapLimit,
|
|
5725
|
+
availableBalance: selectedSource ? selectedSource.balance.available.amount : selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
|
|
5726
|
+
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? state.oneTapLimit,
|
|
5726
5727
|
tokenCount,
|
|
5727
5728
|
initialAmount: parsedAmt,
|
|
5728
5729
|
processing: state.creatingTransfer,
|
|
@@ -5798,7 +5799,7 @@ function StepRenderer({
|
|
|
5798
5799
|
merchantName,
|
|
5799
5800
|
sourceName,
|
|
5800
5801
|
remainingLimit: succeeded ? (() => {
|
|
5801
|
-
const limit = selectedAccount?.remainingAllowance ?? state.oneTapLimit;
|
|
5802
|
+
const limit = selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? state.oneTapLimit;
|
|
5802
5803
|
return limit > displayAmount ? limit - displayAmount : 0;
|
|
5803
5804
|
})() : void 0,
|
|
5804
5805
|
onDone: onDismiss ?? handlers.onNewPayment,
|
|
@@ -5816,7 +5817,7 @@ function StepRenderer({
|
|
|
5816
5817
|
sourceAddress,
|
|
5817
5818
|
sourceVerified,
|
|
5818
5819
|
availableBalance: 0,
|
|
5819
|
-
remainingLimit: selectedAccount?.remainingAllowance ?? state.oneTapLimit,
|
|
5820
|
+
remainingLimit: selectedSource?.remainingAllowance ?? selectedAccount?.remainingAllowance ?? state.oneTapLimit,
|
|
5820
5821
|
tokenCount,
|
|
5821
5822
|
initialAmount: depositAmount ?? 5,
|
|
5822
5823
|
processing: false,
|
|
@@ -5975,6 +5976,15 @@ function SwypePaymentInner({
|
|
|
5975
5976
|
const selectedWallet = selectedAccount?.wallets.find(
|
|
5976
5977
|
(w) => w.id === state.selectedWalletId
|
|
5977
5978
|
);
|
|
5979
|
+
const selectedSource = react.useMemo(() => {
|
|
5980
|
+
if (!selectedWallet) return null;
|
|
5981
|
+
if (state.selectedTokenSymbol) {
|
|
5982
|
+
return selectedWallet.sources.find(
|
|
5983
|
+
(s) => s.token.symbol === state.selectedTokenSymbol
|
|
5984
|
+
) ?? null;
|
|
5985
|
+
}
|
|
5986
|
+
return selectedWallet.sources.find((s) => s.token.status === "AUTHORIZED") ?? selectedWallet.sources[0] ?? null;
|
|
5987
|
+
}, [selectedWallet, state.selectedTokenSymbol]);
|
|
5978
5988
|
const sourceName = selectedAccount?.name ?? selectedWallet?.chain.name ?? "Wallet";
|
|
5979
5989
|
const sourceAddress = selectedWallet ? `${selectedWallet.name.slice(0, 6)}...${selectedWallet.name.slice(-4)}` : void 0;
|
|
5980
5990
|
const sourceVerified = selectedWallet?.status === "ACTIVE";
|
|
@@ -6653,11 +6663,11 @@ function SwypePaymentInner({
|
|
|
6653
6663
|
}
|
|
6654
6664
|
}, [depositAmount]);
|
|
6655
6665
|
react.useEffect(() => {
|
|
6656
|
-
if (authenticated) return;
|
|
6666
|
+
if (authenticated || state.step !== "otp-verify") return;
|
|
6657
6667
|
if (activeOtpErrorMessage) dispatch({ type: "SET_ERROR", error: activeOtpErrorMessage });
|
|
6658
|
-
}, [activeOtpErrorMessage, authenticated]);
|
|
6668
|
+
}, [activeOtpErrorMessage, authenticated, state.step]);
|
|
6659
6669
|
react.useEffect(() => {
|
|
6660
|
-
if (state.step === "otp-verify" && /^\d{6}$/.test(otpCode.trim()) && activeOtpStatus
|
|
6670
|
+
if (state.step === "otp-verify" && /^\d{6}$/.test(otpCode.trim()) && activeOtpStatus === "awaiting-code-input") {
|
|
6661
6671
|
handleVerifyLoginCode();
|
|
6662
6672
|
}
|
|
6663
6673
|
}, [otpCode, state.step, activeOtpStatus, handleVerifyLoginCode]);
|
|
@@ -7138,6 +7148,7 @@ function SwypePaymentInner({
|
|
|
7138
7148
|
maxSourceBalance,
|
|
7139
7149
|
tokenCount,
|
|
7140
7150
|
selectedAccount,
|
|
7151
|
+
selectedSource,
|
|
7141
7152
|
selectSourceChoices,
|
|
7142
7153
|
selectSourceRecommended,
|
|
7143
7154
|
authInput,
|