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