@swype-org/react-sdk 0.1.205 → 0.1.207
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 +11 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -86
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1902,6 +1902,7 @@ function paymentReducer(state, action) {
|
|
|
1902
1902
|
...state,
|
|
1903
1903
|
selectedAccountId: action.accountId,
|
|
1904
1904
|
selectedWalletId: action.walletId,
|
|
1905
|
+
selectedTokenSymbol: null,
|
|
1905
1906
|
step: "deposit"
|
|
1906
1907
|
};
|
|
1907
1908
|
case "SELECT_TOKEN":
|
|
@@ -3885,53 +3886,10 @@ function DepositScreen({
|
|
|
3885
3886
|
const selectedAccount = accounts?.find((a) => a.id === selectedAccountId);
|
|
3886
3887
|
const selectedProviderName = selectedAccount?.name ?? "Wallet";
|
|
3887
3888
|
const selectedProviderLogo = KNOWN_LOGOS[selectedProviderName.toLowerCase()];
|
|
3889
|
+
const totalAccountBalance = selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : availableBalance;
|
|
3888
3890
|
const isLowBalance = availableBalance < MIN_DEPOSIT;
|
|
3889
3891
|
const exceedsLimit = remainingLimit != null && amount > remainingLimit && !isLowBalance;
|
|
3890
3892
|
const canDeposit = amount >= MIN_DEPOSIT && !exceedsLimit && !isLowBalance && !processing;
|
|
3891
|
-
const headerTitle = merchantName ? `Deposit to ${merchantName}` : "Deposit";
|
|
3892
|
-
if (isLowBalance) {
|
|
3893
|
-
return /* @__PURE__ */ jsxs(
|
|
3894
|
-
ScreenLayout,
|
|
3895
|
-
{
|
|
3896
|
-
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3897
|
-
/* @__PURE__ */ jsx(PrimaryButton, { onClick: onSwitchWallet, children: "Switch wallet" }),
|
|
3898
|
-
/* @__PURE__ */ jsx("p", { style: switchHintStyle(tokens.textMuted), children: "Use a different wallet with more balance" }),
|
|
3899
|
-
/* @__PURE__ */ jsx("div", { style: outlineBtnWrapStyle, children: /* @__PURE__ */ jsx(OutlineButton, { onClick: onBack, children: "Back to deposit options" }) }),
|
|
3900
|
-
/* @__PURE__ */ jsx(PoweredByFooter, {})
|
|
3901
|
-
] }),
|
|
3902
|
-
children: [
|
|
3903
|
-
/* @__PURE__ */ jsx(ScreenHeader, { title: headerTitle, onBack, onLogout }),
|
|
3904
|
-
/* @__PURE__ */ jsx("div", { style: lowBalanceAmountDisplayStyle, children: /* @__PURE__ */ jsxs("span", { style: lowBalanceAmountStyle, children: [
|
|
3905
|
-
"$",
|
|
3906
|
-
amount.toFixed(2)
|
|
3907
|
-
] }) }),
|
|
3908
|
-
/* @__PURE__ */ jsxs("div", { style: lowBalanceRowStyle, children: [
|
|
3909
|
-
/* @__PURE__ */ jsxs("div", { style: lowBalanceLeftStyle, children: [
|
|
3910
|
-
/* @__PURE__ */ jsx("div", { style: lowBalanceCoinStyle(tokens.warning), children: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: [
|
|
3911
|
-
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3912
|
-
/* @__PURE__ */ jsx("text", { x: "12", y: "16", textAnchor: "middle", fontSize: "12", fill: "#fff", fontWeight: "700", children: "$" })
|
|
3913
|
-
] }) }),
|
|
3914
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
3915
|
-
/* @__PURE__ */ jsx("div", { style: lowBalanceLabelStyle(tokens.textMuted), children: selectedSourceLabel ?? "Available" }),
|
|
3916
|
-
/* @__PURE__ */ jsxs("div", { style: { fontSize: "1rem", fontWeight: 700, color: tokens.warning }, children: [
|
|
3917
|
-
"$",
|
|
3918
|
-
availableBalance.toFixed(2)
|
|
3919
|
-
] })
|
|
3920
|
-
] })
|
|
3921
|
-
] }),
|
|
3922
|
-
/* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z", fill: tokens.warning }) })
|
|
3923
|
-
] }),
|
|
3924
|
-
/* @__PURE__ */ jsxs(WarningBanner, { title: "Not enough funds", children: [
|
|
3925
|
-
"Your wallet balance is $",
|
|
3926
|
-
availableBalance.toFixed(2),
|
|
3927
|
-
" \u2014 you need at least $",
|
|
3928
|
-
MIN_DEPOSIT.toFixed(2),
|
|
3929
|
-
" to deposit via One-Tap."
|
|
3930
|
-
] })
|
|
3931
|
-
]
|
|
3932
|
-
}
|
|
3933
|
-
);
|
|
3934
|
-
}
|
|
3935
3893
|
return /* @__PURE__ */ jsxs(
|
|
3936
3894
|
ScreenLayout,
|
|
3937
3895
|
{
|
|
@@ -3975,7 +3933,7 @@ function DepositScreen({
|
|
|
3975
3933
|
selectedProviderLogo ? /* @__PURE__ */ jsx("img", { src: selectedProviderLogo, alt: selectedProviderName, style: providerLogoStyle }) : /* @__PURE__ */ jsx("div", { style: providerFallbackStyle(tokens.textMuted), children: selectedProviderName.charAt(0) }),
|
|
3976
3934
|
/* @__PURE__ */ jsxs("span", { style: walletBalanceStyle(tokens.text), children: [
|
|
3977
3935
|
"$",
|
|
3978
|
-
|
|
3936
|
+
totalAccountBalance.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
|
3979
3937
|
] }),
|
|
3980
3938
|
/* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", style: { opacity: 0.4 }, children: /* @__PURE__ */ jsx("path", { d: "M7 10l5-5 5 5M7 14l5 5 5-5", stroke: tokens.textMuted, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
3981
3939
|
]
|
|
@@ -4062,6 +4020,13 @@ function DepositScreen({
|
|
|
4062
4020
|
". Increase your limit to continue."
|
|
4063
4021
|
] })
|
|
4064
4022
|
] }),
|
|
4023
|
+
!accountPickerOpen && isLowBalance && /* @__PURE__ */ jsxs(WarningBanner, { title: "Not enough funds", children: [
|
|
4024
|
+
"Your wallet balance is $",
|
|
4025
|
+
availableBalance.toFixed(2),
|
|
4026
|
+
" \u2014 you need at least $",
|
|
4027
|
+
MIN_DEPOSIT.toFixed(2),
|
|
4028
|
+
" to deposit via One-Tap."
|
|
4029
|
+
] }),
|
|
4065
4030
|
error && /* @__PURE__ */ jsx("div", { style: errorBannerStyle5(tokens), children: error })
|
|
4066
4031
|
]
|
|
4067
4032
|
}
|
|
@@ -4265,46 +4230,6 @@ var limitExceededHintStyle = (color) => ({
|
|
|
4265
4230
|
margin: "12px 0 2px",
|
|
4266
4231
|
lineHeight: 1.5
|
|
4267
4232
|
});
|
|
4268
|
-
var switchHintStyle = (color) => ({
|
|
4269
|
-
textAlign: "center",
|
|
4270
|
-
fontSize: "0.8rem",
|
|
4271
|
-
color,
|
|
4272
|
-
margin: "10px 0"
|
|
4273
|
-
});
|
|
4274
|
-
var outlineBtnWrapStyle = {
|
|
4275
|
-
marginBottom: 8
|
|
4276
|
-
};
|
|
4277
|
-
var lowBalanceAmountDisplayStyle = {
|
|
4278
|
-
textAlign: "center",
|
|
4279
|
-
padding: "20px 0 8px"
|
|
4280
|
-
};
|
|
4281
|
-
var lowBalanceAmountStyle = {
|
|
4282
|
-
fontSize: "2.5rem",
|
|
4283
|
-
fontWeight: 700,
|
|
4284
|
-
color: "#ccc",
|
|
4285
|
-
letterSpacing: "-0.02em"
|
|
4286
|
-
};
|
|
4287
|
-
var lowBalanceRowStyle = {
|
|
4288
|
-
display: "flex",
|
|
4289
|
-
alignItems: "center",
|
|
4290
|
-
justifyContent: "space-between",
|
|
4291
|
-
marginBottom: 16
|
|
4292
|
-
};
|
|
4293
|
-
var lowBalanceLeftStyle = {
|
|
4294
|
-
display: "flex",
|
|
4295
|
-
alignItems: "center",
|
|
4296
|
-
gap: 10
|
|
4297
|
-
};
|
|
4298
|
-
var lowBalanceCoinStyle = (color) => ({
|
|
4299
|
-
color,
|
|
4300
|
-
display: "flex",
|
|
4301
|
-
alignItems: "center"
|
|
4302
|
-
});
|
|
4303
|
-
var lowBalanceLabelStyle = (color) => ({
|
|
4304
|
-
fontSize: "0.72rem",
|
|
4305
|
-
color,
|
|
4306
|
-
fontWeight: 500
|
|
4307
|
-
});
|
|
4308
4233
|
function SuccessScreen({
|
|
4309
4234
|
amount,
|
|
4310
4235
|
currency,
|
|
@@ -5659,7 +5584,7 @@ function StepRendererContent({
|
|
|
5659
5584
|
return /* @__PURE__ */ jsx(
|
|
5660
5585
|
SetupScreen,
|
|
5661
5586
|
{
|
|
5662
|
-
availableBalance: selectedSource ? selectedSource.balance.available.amount : selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) :
|
|
5587
|
+
availableBalance: selectedSource ? selectedSource.balance.available.amount : selectSourceAvailableBalance > 0 ? selectSourceAvailableBalance : selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
|
|
5663
5588
|
tokenCount: effectiveTokenCount,
|
|
5664
5589
|
sourceName,
|
|
5665
5590
|
onSetupOneTap: handlers.onSetupOneTap,
|