@swype-org/react-sdk 0.1.204 → 0.1.206

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.d.cts CHANGED
@@ -807,8 +807,10 @@ interface TokenPickerScreenProps {
807
807
  depositAmount?: number;
808
808
  /** Currently selected token symbol, e.g. "USDC" or "USDT" */
809
809
  selectedTokenSymbol?: string;
810
+ /** Currently selected wallet ID so we can identify the active token across chains */
811
+ selectedWalletId?: string;
810
812
  }
811
- declare function TokenPickerScreen({ account, chains, onSelectAuthorized, onAuthorizeToken, onBack, onLogout, depositAmount, selectedTokenSymbol, }: TokenPickerScreenProps): react_jsx_runtime.JSX.Element;
813
+ declare function TokenPickerScreen({ account, chains, onSelectAuthorized, onAuthorizeToken, onBack, onLogout, depositAmount, selectedTokenSymbol, selectedWalletId, }: TokenPickerScreenProps): react_jsx_runtime.JSX.Element;
812
814
 
813
815
  type FlowPhase = 'link' | 'deposit';
814
816
 
package/dist/index.d.ts CHANGED
@@ -807,8 +807,10 @@ interface TokenPickerScreenProps {
807
807
  depositAmount?: number;
808
808
  /** Currently selected token symbol, e.g. "USDC" or "USDT" */
809
809
  selectedTokenSymbol?: string;
810
+ /** Currently selected wallet ID so we can identify the active token across chains */
811
+ selectedWalletId?: string;
810
812
  }
811
- declare function TokenPickerScreen({ account, chains, onSelectAuthorized, onAuthorizeToken, onBack, onLogout, depositAmount, selectedTokenSymbol, }: TokenPickerScreenProps): react_jsx_runtime.JSX.Element;
813
+ declare function TokenPickerScreen({ account, chains, onSelectAuthorized, onAuthorizeToken, onBack, onLogout, depositAmount, selectedTokenSymbol, selectedWalletId, }: TokenPickerScreenProps): react_jsx_runtime.JSX.Element;
812
814
 
813
815
  type FlowPhase = 'link' | 'deposit';
814
816
 
package/dist/index.js CHANGED
@@ -3888,50 +3888,6 @@ function DepositScreen({
3888
3888
  const isLowBalance = availableBalance < MIN_DEPOSIT;
3889
3889
  const exceedsLimit = remainingLimit != null && amount > remainingLimit && !isLowBalance;
3890
3890
  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
3891
  return /* @__PURE__ */ jsxs(
3936
3892
  ScreenLayout,
3937
3893
  {
@@ -4062,6 +4018,13 @@ function DepositScreen({
4062
4018
  ". Increase your limit to continue."
4063
4019
  ] })
4064
4020
  ] }),
4021
+ !accountPickerOpen && isLowBalance && /* @__PURE__ */ jsxs(WarningBanner, { title: "Not enough funds", children: [
4022
+ "Your wallet balance is $",
4023
+ availableBalance.toFixed(2),
4024
+ " \u2014 you need at least $",
4025
+ MIN_DEPOSIT.toFixed(2),
4026
+ " to deposit via One-Tap."
4027
+ ] }),
4065
4028
  error && /* @__PURE__ */ jsx("div", { style: errorBannerStyle5(tokens), children: error })
4066
4029
  ]
4067
4030
  }
@@ -4265,46 +4228,6 @@ var limitExceededHintStyle = (color) => ({
4265
4228
  margin: "12px 0 2px",
4266
4229
  lineHeight: 1.5
4267
4230
  });
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
4231
  function SuccessScreen({
4309
4232
  amount,
4310
4233
  currency,
@@ -5243,7 +5166,8 @@ function TokenPickerScreen({
5243
5166
  onBack,
5244
5167
  onLogout,
5245
5168
  depositAmount,
5246
- selectedTokenSymbol
5169
+ selectedTokenSymbol,
5170
+ selectedWalletId
5247
5171
  }) {
5248
5172
  const { tokens: t } = useSwypeConfig();
5249
5173
  const entries = [];
@@ -5299,6 +5223,7 @@ function TokenPickerScreen({
5299
5223
  /* @__PURE__ */ jsx("div", { style: sectionLabelStyle(t.textMuted), children: "Choose token" }),
5300
5224
  /* @__PURE__ */ jsx("div", { style: tokenListStyle2, children: entries.map((entry) => {
5301
5225
  const authorized = entry.status === "AUTHORIZED";
5226
+ const isSelected = entry.walletId === selectedWalletId && entry.tokenSymbol === selectedTokenSymbol;
5302
5227
  return /* @__PURE__ */ jsxs(
5303
5228
  "button",
5304
5229
  {
@@ -5321,7 +5246,7 @@ function TokenPickerScreen({
5321
5246
  !authorized && /* @__PURE__ */ jsx("span", { style: notAuthorizedStyle(t.textMuted), children: "Not authorized" })
5322
5247
  ] })
5323
5248
  ] }),
5324
- /* @__PURE__ */ jsx("div", { style: authorized ? selectCircleSelectedStyle(t.accent) : selectCircleStyle(t.border), children: authorized && /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: "#fff" }) }) })
5249
+ /* @__PURE__ */ jsx("div", { style: isSelected ? selectCircleSelectedStyle(t.accent) : selectCircleStyle(t.border), children: isSelected && /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: "#fff" }) }) })
5325
5250
  ]
5326
5251
  },
5327
5252
  `${entry.walletId}-${entry.tokenSymbol}-${entry.chainName}`
@@ -5657,7 +5582,7 @@ function StepRendererContent({
5657
5582
  return /* @__PURE__ */ jsx(
5658
5583
  SetupScreen,
5659
5584
  {
5660
- availableBalance: selectedSource ? selectedSource.balance.available.amount : selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : selectSourceAvailableBalance > 0 ? selectSourceAvailableBalance : maxSourceBalance,
5585
+ availableBalance: selectedSource ? selectedSource.balance.available.amount : selectSourceAvailableBalance > 0 ? selectSourceAvailableBalance : selectedAccount ? selectedAccount.wallets.reduce((sum, w) => sum + w.balance.available.amount, 0) : maxSourceBalance,
5661
5586
  tokenCount: effectiveTokenCount,
5662
5587
  sourceName,
5663
5588
  onSetupOneTap: handlers.onSetupOneTap,
@@ -5730,7 +5655,8 @@ function StepRendererContent({
5730
5655
  onBack: () => handlers.onNavigate(state.previousStep === "setup" ? "setup" : "deposit"),
5731
5656
  onLogout: handlers.onLogout,
5732
5657
  depositAmount: depositAmount ?? void 0,
5733
- selectedTokenSymbol: selectedSource?.token.symbol
5658
+ selectedTokenSymbol: selectedSource?.token.symbol,
5659
+ selectedWalletId: state.selectedWalletId
5734
5660
  }
5735
5661
  );
5736
5662
  }