@swype-org/react-sdk 0.1.35 → 0.1.38

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
@@ -4,6 +4,7 @@ var react = require('react');
4
4
  var reactAuth = require('@privy-io/react-auth');
5
5
  var wagmi = require('wagmi');
6
6
  var chains = require('wagmi/chains');
7
+ var connectors = require('wagmi/connectors');
7
8
  var reactQuery = require('@tanstack/react-query');
8
9
  var jsxRuntime = require('react/jsx-runtime');
9
10
  var viem = require('viem');
@@ -77,6 +78,7 @@ function getTheme(mode) {
77
78
  var SWYPE_PRIVY_APP_ID = "cmlil87uv004n0ck0blwumwek";
78
79
  var wagmiConfig = wagmi.createConfig({
79
80
  chains: [chains.mainnet, chains.arbitrum, chains.base],
81
+ connectors: [connectors.injected()],
80
82
  transports: {
81
83
  [chains.mainnet.id]: wagmi.http(),
82
84
  [chains.arbitrum.id]: wagmi.http(),
@@ -1781,10 +1783,12 @@ function OtpInput({ value, onChange, length = 6, disabled }) {
1781
1783
  var containerStyle5 = {
1782
1784
  display: "flex",
1783
1785
  gap: 8,
1784
- justifyContent: "center"
1786
+ justifyContent: "center",
1787
+ width: "100%"
1785
1788
  };
1786
1789
  var inputStyle = (tokens, filled) => ({
1787
1790
  width: 44,
1791
+ maxWidth: "calc((100% - 40px) / 6)",
1788
1792
  height: 52,
1789
1793
  borderRadius: 12,
1790
1794
  border: `1.5px solid ${filled ? tokens.borderFocus : tokens.border}`,
@@ -1796,7 +1800,8 @@ var inputStyle = (tokens, filled) => ({
1796
1800
  textAlign: "center",
1797
1801
  outline: "none",
1798
1802
  caretColor: tokens.borderFocus,
1799
- transition: "border-color 0.15s ease"
1803
+ transition: "border-color 0.15s ease",
1804
+ flexShrink: 0
1800
1805
  });
1801
1806
  function LimitSlider({
1802
1807
  value,
@@ -1915,11 +1920,61 @@ var sliderThumbCss = (accent) => `
1915
1920
  cursor: pointer;
1916
1921
  }
1917
1922
  `;
1923
+
1924
+ // src/assets/logos.ts
1925
+ function svgToDataUri(svg) {
1926
+ return `data:image/svg+xml,${encodeURIComponent(svg)}`;
1927
+ }
1928
+ var BASE_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 111 111" fill="none">
1929
+ <path d="M54.921 110.034C85.359 110.034 110.034 85.402 110.034 55.017C110.034 24.6319 85.359 0 54.921 0C26.0432 0 2.35281 22.1714 0 50.3923H72.8467V59.6416H0C2.35281 87.8625 26.0432 110.034 54.921 110.034Z" fill="#0052FF"/>
1930
+ </svg>`;
1931
+ var METAMASK_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 318.6 318.6">
1932
+ <polygon fill="#E2761B" stroke="#E2761B" stroke-linecap="round" stroke-linejoin="round" points="274.1,35.5 174.6,109.4 193,65.8"/>
1933
+ <polygon fill="#E4761B" stroke="#E4761B" stroke-linecap="round" stroke-linejoin="round" points="44.4,35.5 143.1,110.1 125.6,65.8"/>
1934
+ <polygon fill="#D7C1B3" stroke="#D7C1B3" stroke-linecap="round" stroke-linejoin="round" points="238.3,206.8 211.8,247.4 268.5,263.2 285.8,207.7"/>
1935
+ <polygon fill="#D7C1B3" stroke="#D7C1B3" stroke-linecap="round" stroke-linejoin="round" points="33.9,207.7 51.1,263.2 107.8,247.4 81.3,206.8"/>
1936
+ <polygon fill="#233447" stroke="#233447" stroke-linecap="round" stroke-linejoin="round" points="103.6,138.2 87.8,162.1 143.1,164.6 141.1,104.1"/>
1937
+ <polygon fill="#233447" stroke="#233447" stroke-linecap="round" stroke-linejoin="round" points="214.9,138.2 175.9,103.4 174.6,164.6 230.8,162.1"/>
1938
+ <polygon fill="#CD6116" stroke="#CD6116" stroke-linecap="round" stroke-linejoin="round" points="107.8,247.4 140.6,230.9 111.4,208.1"/>
1939
+ <polygon fill="#CD6116" stroke="#CD6116" stroke-linecap="round" stroke-linejoin="round" points="177.9,230.9 211.8,247.4 207.1,208.1"/>
1940
+ <polygon fill="#E4761B" stroke="#E4761B" stroke-linecap="round" stroke-linejoin="round" points="211.8,247.4 177.9,230.9 180.6,253 180.3,262.3"/>
1941
+ <polygon fill="#E4761B" stroke="#E4761B" stroke-linecap="round" stroke-linejoin="round" points="107.8,247.4 138.3,262.3 138.1,253 140.6,230.9"/>
1942
+ <polygon fill="#763D16" stroke="#763D16" stroke-linecap="round" stroke-linejoin="round" points="138.8,193.5 110.6,185.2 130.5,176.1"/>
1943
+ <polygon fill="#763D16" stroke="#763D16" stroke-linecap="round" stroke-linejoin="round" points="179.7,193.5 188,176.1 208,185.2"/>
1944
+ <polygon fill="#F6851B" stroke="#F6851B" stroke-linecap="round" stroke-linejoin="round" points="107.8,247.4 111.6,206.8 81.3,207.7"/>
1945
+ <polygon fill="#F6851B" stroke="#F6851B" stroke-linecap="round" stroke-linejoin="round" points="207,206.8 211.8,247.4 238.3,207.7"/>
1946
+ <polygon fill="#F6851B" stroke="#F6851B" stroke-linecap="round" stroke-linejoin="round" points="230.8,162.1 174.6,164.6 179.8,193.5 188.1,176.1 208.1,185.2"/>
1947
+ <polygon fill="#F6851B" stroke="#F6851B" stroke-linecap="round" stroke-linejoin="round" points="110.6,185.2 130.6,176.1 138.8,193.5 143.1,164.6 87.8,162.1"/>
1948
+ <polygon fill="#E4751F" stroke="#E4751F" stroke-linecap="round" stroke-linejoin="round" points="87.8,162.1 111.4,208.1 110.6,185.2"/>
1949
+ <polygon fill="#E4751F" stroke="#E4751F" stroke-linecap="round" stroke-linejoin="round" points="208.1,185.2 207.1,208.1 230.8,162.1"/>
1950
+ <polygon fill="#E4751F" stroke="#E4751F" stroke-linecap="round" stroke-linejoin="round" points="143.1,164.6 138.8,193.5 144.1,218.9 145.3,182.8"/>
1951
+ <polygon fill="#E4751F" stroke="#E4751F" stroke-linecap="round" stroke-linejoin="round" points="174.6,164.6 173.1,182.6 174.4,218.9 179.8,193.5"/>
1952
+ <polygon fill="#F6851B" stroke="#F6851B" stroke-linecap="round" stroke-linejoin="round" points="179.8,193.5 174.4,218.9 177.9,230.9 207.1,208.1 208.1,185.2"/>
1953
+ <polygon fill="#F6851B" stroke="#F6851B" stroke-linecap="round" stroke-linejoin="round" points="110.6,185.2 111.4,208.1 140.6,230.9 144.1,218.9 138.8,193.5"/>
1954
+ <polygon fill="#C0AD9E" stroke="#C0AD9E" stroke-linecap="round" stroke-linejoin="round" points="180.3,262.3 180.6,253 178.1,250.8 140.4,250.8 138.1,253 138.3,262.3 107.8,247.4 117.8,255.1 140.1,271.9 178.4,271.9 200.8,255.1 211.8,247.4"/>
1955
+ <polygon fill="#161616" stroke="#161616" stroke-linecap="round" stroke-linejoin="round" points="177.9,230.9 174.4,218.9 178.1,250.8 180.6,253"/>
1956
+ <polygon fill="#161616" stroke="#161616" stroke-linecap="round" stroke-linejoin="round" points="140.6,230.9 138.1,253 140.4,250.8 144.1,218.9"/>
1957
+ <polygon fill="#763D16" stroke="#763D16" stroke-linecap="round" stroke-linejoin="round" points="278.3,114.2 286.8,73.7 274.1,35.5 174.6,109.4 214.9,138.2 267.2,153.5 278.8,140 273.8,136.4 281.8,129.1 275.4,124.1 283.4,118"/>
1958
+ <polygon fill="#763D16" stroke="#763D16" stroke-linecap="round" stroke-linejoin="round" points="31.8,73.7 40.3,114.2 35.5,118 43.5,124.1 36.8,129.1 44.8,136.4 39.8,140 51.3,153.5 103.6,138.2 143.1,110.1 44.4,35.5"/>
1959
+ </svg>`;
1960
+ var BASE_LOGO = svgToDataUri(BASE_SVG);
1961
+ var METAMASK_LOGO = svgToDataUri(METAMASK_SVG);
1962
+ var KNOWN_LOGOS = {
1963
+ metamask: METAMASK_LOGO,
1964
+ base: BASE_LOGO
1965
+ };
1918
1966
  function SourceCard({ name, address, verified, onChangeSource }) {
1919
1967
  const { tokens } = useSwypeConfig();
1920
1968
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: containerStyle6(tokens), children: [
1921
1969
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: leftStyle, children: [
1922
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: iconStyle3(tokens.textMuted), children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
1970
+ KNOWN_LOGOS[name.toLowerCase()] ? /* @__PURE__ */ jsxRuntime.jsx(
1971
+ "img",
1972
+ {
1973
+ src: KNOWN_LOGOS[name.toLowerCase()],
1974
+ alt: name,
1975
+ style: logoImgStyle
1976
+ }
1977
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: iconStyle3(tokens.textMuted), children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
1923
1978
  "path",
1924
1979
  {
1925
1980
  d: "M21 7H3c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2zm0 8H3V9h18v6z",
@@ -1951,6 +2006,12 @@ var leftStyle = {
1951
2006
  alignItems: "center",
1952
2007
  gap: 10
1953
2008
  };
2009
+ var logoImgStyle = {
2010
+ width: 20,
2011
+ height: 20,
2012
+ borderRadius: "50%",
2013
+ objectFit: "contain"
2014
+ };
1954
2015
  var iconStyle3 = (color) => ({
1955
2016
  color,
1956
2017
  display: "flex",
@@ -2160,7 +2221,7 @@ function LoginScreen({
2160
2221
  ] }),
2161
2222
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: walletSectionStyle, children: [
2162
2223
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: walletLabelStyle(tokens.textMuted), children: "Works with" }),
2163
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: walletLogosStyle, children: walletIcons.map(({ key, emoji }) => /* @__PURE__ */ jsxRuntime.jsx("span", { style: walletEmojiStyle, children: emoji }, key)) })
2224
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: walletLogosStyle, children: walletIcons.map(({ key, emoji, logo }) => logo ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logo, alt: key, style: walletLogoImgStyle }, key) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: walletEmojiStyle, children: emoji }, key)) })
2164
2225
  ] }),
2165
2226
  /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
2166
2227
  ] }),
@@ -2199,11 +2260,11 @@ function LoginScreen({
2199
2260
  );
2200
2261
  }
2201
2262
  var walletIcons = [
2202
- { key: "metamask", emoji: "\u{1F98A}" },
2263
+ { key: "metamask", emoji: "\u{1F98A}", logo: KNOWN_LOGOS["metamask"] },
2203
2264
  { key: "rabby", emoji: "\u{1F430}" },
2204
2265
  { key: "phantom", emoji: "\u25C6" },
2205
2266
  { key: "rainbow", emoji: "\u{1F439}" },
2206
- { key: "coinbase", emoji: "\u{1F535}" }
2267
+ { key: "coinbase", emoji: "\u{1F535}", logo: KNOWN_LOGOS["base"] }
2207
2268
  ];
2208
2269
  function socialLabel(provider) {
2209
2270
  switch (provider) {
@@ -2327,6 +2388,11 @@ var walletEmojiStyle = {
2327
2388
  fontSize: "1.4rem",
2328
2389
  lineHeight: 1
2329
2390
  };
2391
+ var walletLogoImgStyle = {
2392
+ width: 24,
2393
+ height: 24,
2394
+ objectFit: "contain"
2395
+ };
2330
2396
  var avatarStyle = (tokens) => ({
2331
2397
  width: 28,
2332
2398
  height: 28,
@@ -2384,50 +2450,43 @@ function OtpVerifyScreen({
2384
2450
  });
2385
2451
  }, 1e3);
2386
2452
  }, [cooldown, onResend]);
2387
- return /* @__PURE__ */ jsxRuntime.jsxs(
2388
- ScreenLayout,
2389
- {
2390
- footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2391
- /* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onVerify, disabled, loading: verifying, children: "Verify" }),
2392
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: hintStyle(tokens.textMuted), children: "Didn't get the code? Check your spam folder" }),
2393
- /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
2453
+ return /* @__PURE__ */ jsxRuntime.jsxs(ScreenLayout, { footer: /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {}), children: [
2454
+ /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack }),
2455
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle2, children: [
2456
+ /* @__PURE__ */ jsxRuntime.jsx(IconCircle, { variant: "accent", size: 56, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
2457
+ "path",
2458
+ {
2459
+ d: "M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4z",
2460
+ fill: tokens.accent
2461
+ }
2462
+ ) }) }),
2463
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle2(tokens.text), children: "Check your email" }),
2464
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { style: subtitleStyle2(tokens.textSecondary), children: [
2465
+ "We sent a 6-digit code to",
2466
+ "\n",
2467
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: maskedIdentifier })
2394
2468
  ] }),
2395
- children: [
2396
- /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack }),
2397
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle2, children: [
2398
- /* @__PURE__ */ jsxRuntime.jsx(IconCircle, { variant: "accent", size: 56, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
2399
- "path",
2400
- {
2401
- d: "M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4z",
2402
- fill: tokens.accent
2403
- }
2404
- ) }) }),
2405
- /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle2(tokens.text), children: "Check your email" }),
2406
- /* @__PURE__ */ jsxRuntime.jsxs("p", { style: subtitleStyle2(tokens.textSecondary), children: [
2407
- "We sent a 6-digit code to",
2408
- "\n",
2409
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: maskedIdentifier })
2410
- ] }),
2411
- error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle(tokens), children: error }),
2412
- /* @__PURE__ */ jsxRuntime.jsx(OtpInput, { value: otpCode, onChange: onOtpChange, disabled: verifying }),
2413
- /* @__PURE__ */ jsxRuntime.jsx(
2414
- "button",
2415
- {
2416
- type: "button",
2417
- onClick: handleResend,
2418
- disabled: cooldown > 0,
2419
- style: resendStyle(tokens.textMuted, cooldown > 0),
2420
- children: cooldown > 0 ? `Resend code in ${cooldown}s` : "Resend code"
2421
- }
2422
- )
2423
- ] })
2424
- ]
2425
- }
2426
- );
2469
+ error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle(tokens), children: error }),
2470
+ /* @__PURE__ */ jsxRuntime.jsx(OtpInput, { value: otpCode, onChange: onOtpChange, disabled: verifying }),
2471
+ /* @__PURE__ */ jsxRuntime.jsx(
2472
+ "button",
2473
+ {
2474
+ type: "button",
2475
+ onClick: handleResend,
2476
+ disabled: cooldown > 0,
2477
+ style: resendStyle(tokens.textMuted, cooldown > 0),
2478
+ children: cooldown > 0 ? `Resend code in ${cooldown}s` : "Resend code"
2479
+ }
2480
+ ),
2481
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: actionStyle, children: [
2482
+ /* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onClick: onVerify, disabled, loading: verifying, children: "Verify" }),
2483
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: hintStyle(tokens.textMuted), children: "Didn't get the code? Check your spam folder" })
2484
+ ] })
2485
+ ] })
2486
+ ] });
2427
2487
  }
2428
2488
  var contentStyle2 = {
2429
2489
  textAlign: "center",
2430
- flex: 1,
2431
2490
  display: "flex",
2432
2491
  flexDirection: "column",
2433
2492
  alignItems: "center",
@@ -2470,6 +2529,10 @@ var resendStyle = (color, disabled) => ({
2470
2529
  padding: 0,
2471
2530
  opacity: disabled ? 0.6 : 1
2472
2531
  });
2532
+ var actionStyle = {
2533
+ width: "100%",
2534
+ marginTop: 32
2535
+ };
2473
2536
  var hintStyle = (color) => ({
2474
2537
  textAlign: "center",
2475
2538
  fontSize: "0.78rem",
@@ -2558,18 +2621,24 @@ var skipStyle = (color) => ({
2558
2621
  padding: "12px 0 0"
2559
2622
  });
2560
2623
  var WALLET_EMOJIS = {
2561
- metamask: "\u{1F98A}",
2562
2624
  rabby: "\u{1F430}",
2563
2625
  ora: "\u2666\uFE0F",
2564
2626
  phantom: "\u{1F47B}"
2565
2627
  };
2628
+ function truncateAddress(address) {
2629
+ if (address.length <= 10) return address;
2630
+ return `${address.slice(0, 6)}...${address.slice(-4)}`;
2631
+ }
2566
2632
  function WalletPickerScreen({
2567
2633
  providers,
2634
+ pendingConnections,
2568
2635
  onSelectProvider,
2636
+ onContinueConnection,
2569
2637
  onBack
2570
2638
  }) {
2571
2639
  const { tokens } = useSwypeConfig();
2572
2640
  const [hoveredId, setHoveredId] = react.useState(null);
2641
+ const hasPending = pendingConnections != null && pendingConnections.length > 0;
2573
2642
  const displayProviders = providers.length > 0 ? providers : [
2574
2643
  { id: "metamask", name: "MetaMask" },
2575
2644
  { id: "rabby", name: "Rabby" },
@@ -2585,10 +2654,54 @@ function WalletPickerScreen({
2585
2654
  ] }),
2586
2655
  children: [
2587
2656
  /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: "Set up Swype", onBack }),
2588
- /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle4(tokens.text), children: "Where are your stablecoins?" }),
2589
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle4(tokens.textSecondary), children: "Select the wallet you want to deposit from" }),
2657
+ hasPending && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2658
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle4(tokens.text), children: "Continue where you left off" }),
2659
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle4(tokens.textSecondary), children: "You have a wallet that still needs setup" }),
2660
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: pendingListStyle, children: pendingConnections.map((acct) => {
2661
+ const wallet = acct.wallets[0];
2662
+ const address = wallet ? truncateAddress(wallet.name) : void 0;
2663
+ const isHovered = hoveredId === `pending-${acct.id}`;
2664
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2665
+ "button",
2666
+ {
2667
+ onClick: () => onContinueConnection?.(acct.id),
2668
+ onMouseEnter: () => setHoveredId(`pending-${acct.id}`),
2669
+ onMouseLeave: () => setHoveredId(null),
2670
+ style: pendingCardStyle(tokens, isHovered),
2671
+ children: [
2672
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: pendingCardContentStyle, children: [
2673
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: pendingIconStyle, children: KNOWN_LOGOS[acct.name.toLowerCase()] ? /* @__PURE__ */ jsxRuntime.jsx(
2674
+ "img",
2675
+ {
2676
+ src: KNOWN_LOGOS[acct.name.toLowerCase()],
2677
+ alt: acct.name,
2678
+ style: logoImgStyle2
2679
+ }
2680
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: emojiStyle, children: WALLET_EMOJIS[acct.name.toLowerCase()] ?? acct.name.charAt(0) }) }),
2681
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: pendingInfoStyle, children: [
2682
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: pendingNameStyle(tokens.text), children: acct.name }),
2683
+ address && /* @__PURE__ */ jsxRuntime.jsx("span", { style: pendingAddressStyle(tokens.textMuted), children: address })
2684
+ ] }),
2685
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: pendingBadgeStyle(tokens), children: "Setup incomplete" })
2686
+ ] }),
2687
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: continueRowStyle(tokens), children: [
2688
+ "Continue setup",
2689
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z", fill: "currentColor" }) })
2690
+ ] })
2691
+ ]
2692
+ },
2693
+ acct.id
2694
+ );
2695
+ }) }),
2696
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: dividerStyle2(tokens.border), children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: dividerTextStyle(tokens.textMuted), children: "Or connect a new wallet" }) })
2697
+ ] }),
2698
+ !hasPending && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2699
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle4(tokens.text), children: "Where are your stablecoins?" }),
2700
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle4(tokens.textSecondary), children: "Select the wallet you want to deposit from" })
2701
+ ] }),
2590
2702
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: gridStyle, children: [
2591
2703
  displayProviders.map((p) => {
2704
+ const logoSrc = "logoURI" in p && p.logoURI || KNOWN_LOGOS[p.name.toLowerCase()];
2592
2705
  const emoji = WALLET_EMOJIS[p.name.toLowerCase()] ?? p.name.charAt(0);
2593
2706
  const isHovered = hoveredId === p.id;
2594
2707
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2599,12 +2712,12 @@ function WalletPickerScreen({
2599
2712
  onMouseLeave: () => setHoveredId(null),
2600
2713
  style: cardStyle(tokens, isHovered),
2601
2714
  children: [
2602
- "logoURI" in p && p.logoURI ? /* @__PURE__ */ jsxRuntime.jsx(
2715
+ logoSrc ? /* @__PURE__ */ jsxRuntime.jsx(
2603
2716
  "img",
2604
2717
  {
2605
- src: p.logoURI,
2718
+ src: logoSrc,
2606
2719
  alt: p.name,
2607
- style: logoImgStyle
2720
+ style: logoImgStyle2
2608
2721
  }
2609
2722
  ) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: emojiStyle, children: emoji }),
2610
2723
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: nameStyle2(tokens.text), children: p.name })
@@ -2673,7 +2786,7 @@ var emojiStyle = {
2673
2786
  fontSize: "1.75rem",
2674
2787
  lineHeight: 1
2675
2788
  };
2676
- var logoImgStyle = {
2789
+ var logoImgStyle2 = {
2677
2790
  width: 32,
2678
2791
  height: 32,
2679
2792
  borderRadius: 8,
@@ -2690,6 +2803,86 @@ var hintStyle2 = (color) => ({
2690
2803
  color,
2691
2804
  margin: "0 0 4px"
2692
2805
  });
2806
+ var pendingListStyle = {
2807
+ display: "flex",
2808
+ flexDirection: "column",
2809
+ gap: 10,
2810
+ marginBottom: 20
2811
+ };
2812
+ var pendingCardStyle = (tokens, hovered) => ({
2813
+ display: "flex",
2814
+ flexDirection: "column",
2815
+ gap: 0,
2816
+ padding: 0,
2817
+ background: hovered ? tokens.bgHover : tokens.bgInput,
2818
+ border: `1.5px solid ${tokens.warning}44`,
2819
+ borderRadius: 16,
2820
+ cursor: "pointer",
2821
+ fontFamily: "inherit",
2822
+ transition: "background 0.15s ease",
2823
+ outline: "none",
2824
+ overflow: "hidden",
2825
+ textAlign: "left"
2826
+ });
2827
+ var pendingCardContentStyle = {
2828
+ display: "flex",
2829
+ alignItems: "center",
2830
+ gap: 12,
2831
+ padding: "14px 16px"
2832
+ };
2833
+ var pendingIconStyle = {
2834
+ flexShrink: 0
2835
+ };
2836
+ var pendingInfoStyle = {
2837
+ display: "flex",
2838
+ flexDirection: "column",
2839
+ gap: 2,
2840
+ flex: 1,
2841
+ minWidth: 0
2842
+ };
2843
+ var pendingNameStyle = (color) => ({
2844
+ fontSize: "0.92rem",
2845
+ fontWeight: 600,
2846
+ color
2847
+ });
2848
+ var pendingAddressStyle = (color) => ({
2849
+ fontSize: "0.78rem",
2850
+ color,
2851
+ fontFamily: "monospace"
2852
+ });
2853
+ var pendingBadgeStyle = (tokens) => ({
2854
+ fontSize: "0.72rem",
2855
+ fontWeight: 600,
2856
+ color: tokens.warningText ?? tokens.warning,
2857
+ background: tokens.warningBg ?? `${tokens.warning}1a`,
2858
+ padding: "3px 8px",
2859
+ borderRadius: 6,
2860
+ whiteSpace: "nowrap",
2861
+ flexShrink: 0
2862
+ });
2863
+ var continueRowStyle = (tokens) => ({
2864
+ display: "flex",
2865
+ alignItems: "center",
2866
+ justifyContent: "center",
2867
+ gap: 4,
2868
+ padding: "10px 16px",
2869
+ fontSize: "0.84rem",
2870
+ fontWeight: 600,
2871
+ color: tokens.accent,
2872
+ background: `${tokens.accent}0d`,
2873
+ borderTop: `1px solid ${tokens.accent}22`
2874
+ });
2875
+ var dividerStyle2 = (borderColor) => ({
2876
+ display: "flex",
2877
+ alignItems: "center",
2878
+ gap: 12,
2879
+ margin: "4px 0 16px"
2880
+ });
2881
+ var dividerTextStyle = (color) => ({
2882
+ fontSize: "0.82rem",
2883
+ color,
2884
+ whiteSpace: "nowrap"
2885
+ });
2693
2886
  var DEFAULT_MAX = 500;
2694
2887
  var ABSOLUTE_MIN = 1;
2695
2888
  function buildTicks(min, max) {
@@ -2736,7 +2929,7 @@ function SetupScreen({
2736
2929
  /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
2737
2930
  ] }),
2738
2931
  children: [
2739
- /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: "Swype Setup", badge: "Simple", onBack, right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout }) }),
2932
+ /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: "Swype Setup", onBack, right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout }) }),
2740
2933
  /* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle5(tokens.text), children: "Set up One-Tap deposits" }),
2741
2934
  /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle5(tokens.textSecondary), children: "Set your limit for instant deposits. Like a contactless card \u2014 you choose the max." }),
2742
2935
  error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle3(tokens), children: error }),
@@ -2891,7 +3084,6 @@ function SetupStatusScreen({
2891
3084
  complete,
2892
3085
  limit,
2893
3086
  tokensApproved,
2894
- currentStepLabel,
2895
3087
  merchantName,
2896
3088
  onContinue,
2897
3089
  onLogout,
@@ -2907,7 +3099,7 @@ function SetupStatusScreen({
2907
3099
  { label: "Done", status: "complete" }
2908
3100
  ] : [
2909
3101
  {
2910
- label: currentStepLabel ?? "Approving tokens",
3102
+ label: "Setting up Wallet",
2911
3103
  status: "active"
2912
3104
  },
2913
3105
  { label: "Done", status: "pending" }
@@ -2945,7 +3137,7 @@ var contentStyle4 = {
2945
3137
  alignItems: "center",
2946
3138
  justifyContent: "center",
2947
3139
  textAlign: "center",
2948
- padding: "0 24px"
3140
+ padding: "0 24px 32px"
2949
3141
  };
2950
3142
  var headingStyle6 = (color) => ({
2951
3143
  fontSize: "1.45rem",
@@ -3085,7 +3277,7 @@ function DepositScreen({
3085
3277
  /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
3086
3278
  ] }),
3087
3279
  children: [
3088
- /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: headerTitle, badge: "Simple", onBack, right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout }) }),
3280
+ /* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { title: headerTitle, onBack, right: /* @__PURE__ */ jsxRuntime.jsx(SettingsMenu, { onLogout }) }),
3089
3281
  /* @__PURE__ */ jsxRuntime.jsx(
3090
3282
  SourceCard,
3091
3283
  {
@@ -3777,6 +3969,7 @@ function SwypePayment({
3777
3969
  const [setupComplete, setSetupComplete] = react.useState(false);
3778
3970
  const [setupStepLabel, setSetupStepLabel] = react.useState(void 0);
3779
3971
  const [mobileFlow, setMobileFlow] = react.useState(false);
3972
+ const [mobileSetupFlow, setMobileSetupFlow] = react.useState(false);
3780
3973
  const pollingTransferIdRef = react.useRef(null);
3781
3974
  const mobileSigningTransferIdRef = react.useRef(null);
3782
3975
  const processingStartedAtRef = react.useRef(null);
@@ -3789,6 +3982,23 @@ function SwypePayment({
3789
3982
  const transferSigning = useTransferSigning();
3790
3983
  const sourceType = connectingNewAccount ? "providerId" : selectedWalletId ? "walletId" : selectedAccountId ? "accountId" : "providerId";
3791
3984
  const sourceId = connectingNewAccount ? selectedProviderId ?? "" : selectedWalletId ? selectedWalletId : selectedAccountId ? selectedAccountId : selectedProviderId ?? "";
3985
+ const reloadAccounts = react.useCallback(async () => {
3986
+ const token = await getAccessToken();
3987
+ if (!token || !activeCredentialId) return;
3988
+ const [accts, prov] = await Promise.all([
3989
+ fetchAccounts(apiBaseUrl, token, activeCredentialId),
3990
+ fetchProviders(apiBaseUrl, token)
3991
+ ]);
3992
+ setAccounts(accts);
3993
+ setProviders(prov);
3994
+ const parsedAmt = depositAmount != null ? depositAmount : 0;
3995
+ const defaults = computeSmartDefaults(accts, parsedAmt);
3996
+ if (defaults) {
3997
+ setSelectedAccountId(defaults.accountId);
3998
+ setSelectedWalletId(defaults.walletId);
3999
+ setConnectingNewAccount(false);
4000
+ }
4001
+ }, [getAccessToken, activeCredentialId, apiBaseUrl, depositAmount]);
3792
4002
  react.useEffect(() => {
3793
4003
  if (depositAmount != null) {
3794
4004
  setAmount(depositAmount.toString());
@@ -3938,7 +4148,10 @@ function SwypePayment({
3938
4148
  } else if (prov.length > 0) {
3939
4149
  setSelectedProviderId(prov[0].id);
3940
4150
  }
3941
- if (accts.length === 0 && step === "deposit") {
4151
+ const hasActiveWallet = accts.some(
4152
+ (a) => a.wallets.some((w) => w.status === "ACTIVE")
4153
+ );
4154
+ if ((accts.length === 0 || !hasActiveWallet) && step === "deposit") {
3942
4155
  setStep("wallet-picker");
3943
4156
  }
3944
4157
  } catch (err) {
@@ -3997,7 +4210,24 @@ function SwypePayment({
3997
4210
  return () => window.clearTimeout(timeoutId);
3998
4211
  }, [step, polling.transfer, transfer, polling.stopPolling, onError]);
3999
4212
  react.useEffect(() => {
4000
- if (!mobileFlow) return;
4213
+ if (!mobileSetupFlow) return;
4214
+ const polledTransfer = polling.transfer;
4215
+ if (!polledTransfer) return;
4216
+ if (polledTransfer.status !== "AUTHORIZED" && polledTransfer.status !== "COMPLETED") return;
4217
+ polling.stopPolling();
4218
+ setMobileFlow(false);
4219
+ setMobileSetupFlow(false);
4220
+ const finishSetup = async () => {
4221
+ try {
4222
+ await reloadAccounts();
4223
+ } catch {
4224
+ }
4225
+ setStep("deposit");
4226
+ };
4227
+ void finishSetup();
4228
+ }, [mobileSetupFlow, polling, reloadAccounts]);
4229
+ react.useEffect(() => {
4230
+ if (!mobileFlow || mobileSetupFlow) return;
4001
4231
  const polledTransfer = polling.transfer;
4002
4232
  if (!polledTransfer || polledTransfer.status !== "AUTHORIZED") return;
4003
4233
  if (transferSigning.signing) return;
@@ -4015,7 +4245,7 @@ function SwypePayment({
4015
4245
  }
4016
4246
  };
4017
4247
  void sign();
4018
- }, [mobileFlow, polling.transfer, transferSigning, onError]);
4248
+ }, [mobileFlow, mobileSetupFlow, polling.transfer, transferSigning, onError]);
4019
4249
  react.useEffect(() => {
4020
4250
  if (!mobileFlow) return;
4021
4251
  const transferIdToResume = pollingTransferIdRef.current ?? transfer?.id;
@@ -4100,6 +4330,12 @@ function SwypePayment({
4100
4330
  },
4101
4331
  [selectSourceChoices, selectSourceRecommended]
4102
4332
  );
4333
+ const pendingConnections = react.useMemo(
4334
+ () => accounts.filter(
4335
+ (a) => a.wallets.length > 0 && !a.wallets.some((w) => w.status === "ACTIVE")
4336
+ ),
4337
+ [accounts]
4338
+ );
4103
4339
  const selectedAccount = accounts.find((a) => a.id === selectedAccountId);
4104
4340
  const selectedWallet = selectedAccount?.wallets.find((w) => w.id === selectedWalletId);
4105
4341
  const sourceName = selectedAccount?.name ?? selectedWallet?.chain.name ?? "Wallet";
@@ -4243,7 +4479,10 @@ function SwypePayment({
4243
4479
  await registerPasskey(apiBaseUrl, token, credentialId, publicKey);
4244
4480
  setActiveCredentialId(credentialId);
4245
4481
  window.localStorage.setItem(ACTIVE_CREDENTIAL_STORAGE_KEY, credentialId);
4246
- if (accounts.length === 0) {
4482
+ const hasActiveWallet = accounts.some(
4483
+ (a) => a.wallets.some((w) => w.status === "ACTIVE")
4484
+ );
4485
+ if (accounts.length === 0 || !hasActiveWallet) {
4247
4486
  setStep("wallet-picker");
4248
4487
  } else {
4249
4488
  setStep("deposit");
@@ -4253,14 +4492,17 @@ function SwypePayment({
4253
4492
  } finally {
4254
4493
  setRegisteringPasskey(false);
4255
4494
  }
4256
- }, [getAccessToken, user, apiBaseUrl, accounts.length]);
4495
+ }, [getAccessToken, user, apiBaseUrl, accounts]);
4257
4496
  const handleSkipPasskey = react.useCallback(() => {
4258
- if (accounts.length === 0) {
4497
+ const hasActiveWallet = accounts.some(
4498
+ (a) => a.wallets.some((w) => w.status === "ACTIVE")
4499
+ );
4500
+ if (accounts.length === 0 || !hasActiveWallet) {
4259
4501
  setStep("wallet-picker");
4260
4502
  } else {
4261
4503
  setStep("deposit");
4262
4504
  }
4263
- }, [accounts.length]);
4505
+ }, [accounts]);
4264
4506
  const handleSetupOneTap = react.useCallback(async (limit) => {
4265
4507
  setOneTapLimit(limit);
4266
4508
  setStep("setup-status");
@@ -4273,6 +4515,7 @@ function SwypePayment({
4273
4515
  if (!sourceId) {
4274
4516
  throw new Error("No wallet selected for setup.");
4275
4517
  }
4518
+ await updateUserConfig(apiBaseUrl, token, { defaultAllowance: limit });
4276
4519
  const setupAmount = depositAmount ?? MIN_SEND_AMOUNT_USD;
4277
4520
  const t = await createTransfer(apiBaseUrl, token, {
4278
4521
  id: idempotencyKey,
@@ -4290,11 +4533,16 @@ function SwypePayment({
4290
4533
  });
4291
4534
  if (!shouldUseConnector) {
4292
4535
  setMobileFlow(true);
4536
+ setMobileSetupFlow(true);
4537
+ pollingTransferIdRef.current = t.id;
4538
+ polling.startPolling(t.id);
4293
4539
  window.location.href = t.authorizationSessions[0].uri;
4540
+ return;
4294
4541
  } else {
4295
4542
  await authExecutor.executeSession(t);
4296
4543
  }
4297
4544
  }
4545
+ await reloadAccounts();
4298
4546
  setSetupStepLabel(void 0);
4299
4547
  setSetupComplete(true);
4300
4548
  } catch (err) {
@@ -4313,8 +4561,10 @@ function SwypePayment({
4313
4561
  merchantAuthorization,
4314
4562
  useWalletConnector,
4315
4563
  authExecutor,
4564
+ polling,
4316
4565
  onError,
4317
- depositAmount
4566
+ depositAmount,
4567
+ reloadAccounts
4318
4568
  ]);
4319
4569
  const handleSelectProvider = react.useCallback((providerId) => {
4320
4570
  setSelectedProviderId(providerId);
@@ -4322,12 +4572,23 @@ function SwypePayment({
4322
4572
  setConnectingNewAccount(true);
4323
4573
  setStep("setup");
4324
4574
  }, []);
4575
+ const handleContinueConnection = react.useCallback(
4576
+ (accountId) => {
4577
+ const acct = accounts.find((a) => a.id === accountId);
4578
+ setSelectedAccountId(accountId);
4579
+ setSelectedWalletId(acct?.wallets[0]?.id ?? null);
4580
+ setConnectingNewAccount(false);
4581
+ setStep("setup");
4582
+ },
4583
+ [accounts]
4584
+ );
4325
4585
  const handleNewPayment = react.useCallback(() => {
4326
4586
  setStep("deposit");
4327
4587
  setTransfer(null);
4328
4588
  setError(null);
4329
4589
  setAmount(depositAmount != null ? depositAmount.toString() : "");
4330
4590
  setMobileFlow(false);
4591
+ setMobileSetupFlow(false);
4331
4592
  processingStartedAtRef.current = null;
4332
4593
  pollingTransferIdRef.current = null;
4333
4594
  mobileSigningTransferIdRef.current = null;
@@ -4360,6 +4621,7 @@ function SwypePayment({
4360
4621
  setConnectingNewAccount(false);
4361
4622
  setAmount(depositAmount != null ? depositAmount.toString() : "");
4362
4623
  setMobileFlow(false);
4624
+ setMobileSetupFlow(false);
4363
4625
  setSetupComplete(false);
4364
4626
  resetHeadlessLogin();
4365
4627
  }, [logout, polling, depositAmount, resetHeadlessLogin]);
@@ -4423,7 +4685,9 @@ function SwypePayment({
4423
4685
  WalletPickerScreen,
4424
4686
  {
4425
4687
  providers,
4688
+ pendingConnections,
4426
4689
  onSelectProvider: handleSelectProvider,
4690
+ onContinueConnection: handleContinueConnection,
4427
4691
  onBack: () => setStep("create-passkey")
4428
4692
  }
4429
4693
  );
@@ -4450,7 +4714,6 @@ function SwypePayment({
4450
4714
  complete: setupComplete,
4451
4715
  limit: oneTapLimit,
4452
4716
  tokensApproved: tokenCount,
4453
- currentStepLabel: setupStepLabel,
4454
4717
  merchantName,
4455
4718
  onContinue: () => setStep("deposit"),
4456
4719
  onLogout: handleLogout,
@@ -4562,6 +4825,16 @@ function SwypePayment({
4562
4825
  return null;
4563
4826
  }
4564
4827
 
4828
+ exports.IconCircle = IconCircle;
4829
+ exports.OutlineButton = OutlineButton;
4830
+ exports.PoweredByFooter = PoweredByFooter;
4831
+ exports.PrimaryButton = PrimaryButton;
4832
+ exports.ScreenHeader = ScreenHeader;
4833
+ exports.ScreenLayout = ScreenLayout;
4834
+ exports.SelectSourceScreen = SelectSourceScreen;
4835
+ exports.SettingsMenu = SettingsMenu;
4836
+ exports.Spinner = Spinner;
4837
+ exports.StepList = StepList;
4565
4838
  exports.SwypePayment = SwypePayment;
4566
4839
  exports.SwypeProvider = SwypeProvider;
4567
4840
  exports.createPasskeyCredential = createPasskeyCredential;