@swype-org/react-sdk 0.1.202 → 0.1.205

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
@@ -3639,16 +3639,10 @@ function SetupScreen({
3639
3639
  onClick: onAdvanced,
3640
3640
  style: tokenIconButtonStyle(!!onAdvanced),
3641
3641
  children: [
3642
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: tokenIconWrapStyle, children: [
3643
- selectedTokenSymbol && TOKEN_LOGOS[selectedTokenSymbol] ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: TOKEN_LOGOS[selectedTokenSymbol], alt: selectedTokenSymbol, width: 36, height: 36, style: { borderRadius: "50%" } }) : /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", children: [
3644
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#2DB84B" }),
3645
- /* @__PURE__ */ jsxRuntime.jsx("text", { x: "18", y: "23", textAnchor: "middle", fontSize: "18", fill: "#fff", fontWeight: "700", children: "$" })
3646
- ] }),
3647
- /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", style: checkBadgeStyle, children: [
3648
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "8", fill: "#2775CA" }),
3649
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 8l2 2 4-4", stroke: "#fff", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" })
3650
- ] })
3651
- ] }),
3642
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: tokenIconWrapStyle, children: selectedTokenSymbol && TOKEN_LOGOS[selectedTokenSymbol] ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: TOKEN_LOGOS[selectedTokenSymbol], alt: selectedTokenSymbol, width: 36, height: 36, style: { borderRadius: "50%" } }) : /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", children: [
3643
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#2DB84B" }),
3644
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: "18", y: "23", textAnchor: "middle", fontSize: "18", fill: "#fff", fontWeight: "700", children: "$" })
3645
+ ] }) }),
3652
3646
  /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", style: { opacity: 0.5 }, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 9l6 6 6-6", stroke: tokens.textMuted, strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
3653
3647
  ]
3654
3648
  }
@@ -3747,11 +3741,6 @@ var tokenIconWrapStyle = {
3747
3741
  width: 36,
3748
3742
  height: 36
3749
3743
  };
3750
- var checkBadgeStyle = {
3751
- position: "absolute",
3752
- bottom: -1,
3753
- right: -3
3754
- };
3755
3744
  var presetsRowStyle = {
3756
3745
  display: "flex",
3757
3746
  gap: 10,
@@ -4559,7 +4548,7 @@ function SelectSourceScreen({
4559
4548
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: optionContentStyle, children: [
4560
4549
  /* @__PURE__ */ jsxRuntime.jsxs("span", { style: optionNameStyle(tokens.text), children: [
4561
4550
  chain.chainName,
4562
- isRecommended && /* @__PURE__ */ jsxRuntime.jsx("span", { style: recommendedBadgeStyle(tokens.accent), children: " recommended" })
4551
+ isRecommended && /* @__PURE__ */ jsxRuntime.jsx("span", { style: recommendedBadgeStyle(tokens.textMuted), children: " recommended" })
4563
4552
  ] }),
4564
4553
  /* @__PURE__ */ jsxRuntime.jsxs("span", { style: optionBalanceStyle(tokens.textMuted), children: [
4565
4554
  "$",
@@ -4576,6 +4565,7 @@ function SelectSourceScreen({
4576
4565
  /* @__PURE__ */ jsxRuntime.jsx("label", { style: labelStyle4(tokens.textSecondary), children: "Token" }),
4577
4566
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: optionListStyle, children: tokenChoices.map((token) => {
4578
4567
  const isSelected = token.tokenSymbol === selectedTokenSymbol;
4568
+ const tokenLogo = TOKEN_LOGOS[token.tokenSymbol];
4579
4569
  return /* @__PURE__ */ jsxRuntime.jsxs(
4580
4570
  "button",
4581
4571
  {
@@ -4583,11 +4573,14 @@ function SelectSourceScreen({
4583
4573
  onClick: () => onTokenChange(token.tokenSymbol),
4584
4574
  style: optionButtonStyle(tokens, isSelected),
4585
4575
  children: [
4586
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: optionContentStyle, children: [
4587
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: optionNameStyle(tokens.text), children: token.tokenSymbol }),
4588
- /* @__PURE__ */ jsxRuntime.jsxs("span", { style: optionBalanceStyle(tokens.textMuted), children: [
4589
- "$",
4590
- token.balance.toFixed(2)
4576
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: optionMainStyle, children: [
4577
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: tokenIconCircleStyle(tokens, !!tokenLogo), children: tokenLogo ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: tokenLogo, alt: token.tokenSymbol, style: tokenLogoImgStyle }) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: tokenIconTextStyle(tokens.textMuted), children: "$" }) }),
4578
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: optionContentStyle, children: [
4579
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: optionNameStyle(tokens.text), children: token.tokenSymbol }),
4580
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: optionBalanceStyle(tokens.textMuted), children: [
4581
+ "$",
4582
+ token.balance.toFixed(2)
4583
+ ] })
4591
4584
  ] })
4592
4585
  ] }),
4593
4586
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: radioStyle(tokens, isSelected), children: isSelected && /* @__PURE__ */ jsxRuntime.jsx("div", { style: radioDotStyle(tokens.accent) }) })
@@ -4640,6 +4633,11 @@ var optionContentStyle = {
4640
4633
  flexDirection: "column",
4641
4634
  gap: 2
4642
4635
  };
4636
+ var optionMainStyle = {
4637
+ display: "flex",
4638
+ alignItems: "center",
4639
+ gap: 12
4640
+ };
4643
4641
  var optionNameStyle = (color) => ({
4644
4642
  fontSize: "0.9rem",
4645
4643
  fontWeight: 600,
@@ -4655,6 +4653,28 @@ var optionBalanceStyle = (color) => ({
4655
4653
  fontSize: "0.78rem",
4656
4654
  color
4657
4655
  });
4656
+ var tokenIconCircleStyle = (tokens, hasLogo) => ({
4657
+ width: 36,
4658
+ height: 36,
4659
+ borderRadius: "50%",
4660
+ border: hasLogo ? "none" : `1.5px solid ${tokens.border}`,
4661
+ display: "flex",
4662
+ alignItems: "center",
4663
+ justifyContent: "center",
4664
+ flexShrink: 0,
4665
+ overflow: "hidden"
4666
+ });
4667
+ var tokenLogoImgStyle = {
4668
+ width: 36,
4669
+ height: 36,
4670
+ borderRadius: "50%",
4671
+ objectFit: "cover"
4672
+ };
4673
+ var tokenIconTextStyle = (color) => ({
4674
+ fontSize: "1rem",
4675
+ fontWeight: 700,
4676
+ color
4677
+ });
4658
4678
  var radioStyle = (tokens, selected) => ({
4659
4679
  width: 20,
4660
4680
  height: 20,
@@ -5226,7 +5246,8 @@ function TokenPickerScreen({
5226
5246
  onBack,
5227
5247
  onLogout,
5228
5248
  depositAmount,
5229
- selectedTokenSymbol
5249
+ selectedTokenSymbol,
5250
+ selectedWalletId
5230
5251
  }) {
5231
5252
  const { tokens: t } = useSwypeConfig();
5232
5253
  const entries = [];
@@ -5282,6 +5303,7 @@ function TokenPickerScreen({
5282
5303
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: sectionLabelStyle(t.textMuted), children: "Choose token" }),
5283
5304
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: tokenListStyle2, children: entries.map((entry) => {
5284
5305
  const authorized = entry.status === "AUTHORIZED";
5306
+ const isSelected = entry.walletId === selectedWalletId && entry.tokenSymbol === selectedTokenSymbol;
5285
5307
  return /* @__PURE__ */ jsxRuntime.jsxs(
5286
5308
  "button",
5287
5309
  {
@@ -5289,7 +5311,7 @@ function TokenPickerScreen({
5289
5311
  onClick: () => handleSelect(entry),
5290
5312
  style: tokenRowStyle2(t),
5291
5313
  children: [
5292
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: tokenIconCircleStyle(t, !!TOKEN_LOGOS[entry.tokenSymbol]), children: TOKEN_LOGOS[entry.tokenSymbol] ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: TOKEN_LOGOS[entry.tokenSymbol], alt: entry.tokenSymbol, style: tokenLogoImgStyle }) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: tokenIconTextStyle(t.textMuted), children: "$" }) }),
5314
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: tokenIconCircleStyle2(t, !!TOKEN_LOGOS[entry.tokenSymbol]), children: TOKEN_LOGOS[entry.tokenSymbol] ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: TOKEN_LOGOS[entry.tokenSymbol], alt: entry.tokenSymbol, style: tokenLogoImgStyle2 }) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: tokenIconTextStyle2(t.textMuted), children: "$" }) }),
5293
5315
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: tokenInfoStyle2, children: [
5294
5316
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: tokenNameRowStyle, children: [
5295
5317
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: tokenSymbolTextStyle(t.text), children: entry.tokenSymbol }),
@@ -5304,7 +5326,7 @@ function TokenPickerScreen({
5304
5326
  !authorized && /* @__PURE__ */ jsxRuntime.jsx("span", { style: notAuthorizedStyle(t.textMuted), children: "Not authorized" })
5305
5327
  ] })
5306
5328
  ] }),
5307
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: authorized ? selectCircleSelectedStyle(t.accent) : selectCircleStyle(t.border), children: authorized && /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: "#fff" }) }) })
5329
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: isSelected ? selectCircleSelectedStyle(t.accent) : selectCircleStyle(t.border), children: isSelected && /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: "#fff" }) }) })
5308
5330
  ]
5309
5331
  },
5310
5332
  `${entry.walletId}-${entry.tokenSymbol}-${entry.chainName}`
@@ -5369,7 +5391,7 @@ var tokenRowStyle2 = (tokens) => ({
5369
5391
  textAlign: "left",
5370
5392
  width: "100%"
5371
5393
  });
5372
- var tokenIconCircleStyle = (tokens, hasLogo) => ({
5394
+ var tokenIconCircleStyle2 = (tokens, hasLogo) => ({
5373
5395
  width: 36,
5374
5396
  height: 36,
5375
5397
  borderRadius: "50%",
@@ -5380,13 +5402,13 @@ var tokenIconCircleStyle = (tokens, hasLogo) => ({
5380
5402
  flexShrink: 0,
5381
5403
  overflow: "hidden"
5382
5404
  });
5383
- var tokenLogoImgStyle = {
5405
+ var tokenLogoImgStyle2 = {
5384
5406
  width: 36,
5385
5407
  height: 36,
5386
5408
  borderRadius: "50%",
5387
5409
  objectFit: "cover"
5388
5410
  };
5389
- var tokenIconTextStyle = (color) => ({
5411
+ var tokenIconTextStyle2 = (color) => ({
5390
5412
  fontSize: "1rem",
5391
5413
  fontWeight: 700,
5392
5414
  color
@@ -5650,7 +5672,7 @@ function StepRendererContent({
5650
5672
  selectedSourceLabel: effectiveSourceLabel,
5651
5673
  loading: savingOneTapLimit,
5652
5674
  error: state.error,
5653
- selectedTokenSymbol: selectedSource?.token.symbol
5675
+ selectedTokenSymbol: selectedSource?.token.symbol ?? selectSourceTokenSymbol
5654
5676
  }
5655
5677
  );
5656
5678
  }
@@ -5713,7 +5735,8 @@ function StepRendererContent({
5713
5735
  onBack: () => handlers.onNavigate(state.previousStep === "setup" ? "setup" : "deposit"),
5714
5736
  onLogout: handlers.onLogout,
5715
5737
  depositAmount: depositAmount ?? void 0,
5716
- selectedTokenSymbol: selectedSource?.token.symbol
5738
+ selectedTokenSymbol: selectedSource?.token.symbol,
5739
+ selectedWalletId: state.selectedWalletId
5717
5740
  }
5718
5741
  );
5719
5742
  }
@@ -7283,7 +7306,7 @@ function usePaymentEffects(deps) {
7283
7306
  accounts: accts,
7284
7307
  chains: chn,
7285
7308
  defaults,
7286
- resolvedStep: correctableSteps.includes(state.step) ? resolved.step : void 0,
7309
+ resolvedStep: correctableSteps.includes(state.step) && !state.creatingTransfer ? resolved.step : void 0,
7287
7310
  clearMobileState: resolved.clearPersistedFlow
7288
7311
  });
7289
7312
  if (resolved.clearPersistedFlow) clearMobileFlowState();