@glacislabs/stablegenie-zerodelta 3.0.0 → 3.0.1

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.
@@ -683,6 +683,10 @@ var WIDGET_CSS = `
683
683
  .sg-tile-sym{font-size:16px;font-weight:700;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
684
684
  .sg-tile-chain{font-size:11px;color:var(--sg-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
685
685
  .sg-tile-empty{color:var(--sg-text-muted);font-size:15px;font-weight:600}
686
+ .sg-funding-glyphs{display:flex;align-items:center;flex:0 0 auto;padding-right:2px}
687
+ .sg-funding-glyphs .sg-tok{box-shadow:0 0 0 2px var(--sg-surface);border-radius:999px}
688
+ .sg-funding-glyphs .sg-tok+.sg-tok{margin-left:-8px}
689
+ .sg-funding-copy{display:flex;flex-direction:column;min-width:0}
686
690
  .sg-ft-arrow{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:30px;height:30px;border-radius:999px;background:var(--sg-bg);border:1px solid var(--sg-border);display:flex;align-items:center;justify-content:center;color:var(--sg-text-muted);z-index:1;pointer-events:none}
687
691
 
688
692
  /* token identity: logo circle + tiny chain badge, with a letters fallback */
@@ -1319,6 +1323,31 @@ function TokenTile(props) {
1319
1323
  /* @__PURE__ */ jsx("span", { className: "sg-tile-main", children: glyph })
1320
1324
  ] });
1321
1325
  }
1326
+ function FundingTile(props) {
1327
+ const symbols = props.assets.map((asset) => asset.symbol);
1328
+ const summary = props.loading ? "Checking wallet assets\u2026" : symbols.length ? symbols.join(", ") : "No payable balance";
1329
+ const detail = props.loading ? "Finding what you can pay with" : symbols.length ? `${symbols.length} wallet asset${symbols.length === 1 ? "" : "s"} available` : "Open to review funding options";
1330
+ const ariaLabel = `${props.label}: ${props.loading ? "checking wallet assets" : symbols.length ? symbols.join(", ") : "no payable balance"}`;
1331
+ const glyphs = props.loading ? /* @__PURE__ */ jsx("span", { className: "sg-tok", children: /* @__PURE__ */ jsx("span", { className: "sg-tok-fb", children: "\u2026" }) }) : symbols.length ? /* @__PURE__ */ jsx("span", { className: "sg-funding-glyphs", "aria-hidden": "true", children: props.assets.slice(0, 3).map((asset) => /* @__PURE__ */ jsx(TokenGlyph, { symbol: asset.symbol, logoUrl: asset.logoUrl, size: "sm" }, asset.symbol)) }) : /* @__PURE__ */ jsx("span", { className: "sg-tok", children: /* @__PURE__ */ jsx("span", { className: "sg-tok-fb", children: "?" }) });
1332
+ const main = /* @__PURE__ */ jsxs(Fragment, { children: [
1333
+ glyphs,
1334
+ /* @__PURE__ */ jsxs("span", { className: "sg-funding-copy", children: [
1335
+ /* @__PURE__ */ jsx("span", { className: "sg-tile-sym", children: summary }),
1336
+ /* @__PURE__ */ jsx("span", { className: "sg-tile-chain", children: detail })
1337
+ ] })
1338
+ ] });
1339
+ if (props.row) {
1340
+ return /* @__PURE__ */ jsxs("button", { type: "button", ref: props.btnRef, className: "sg-tile sg-tile--row", disabled: props.disabled, onClick: props.onClick, "aria-label": ariaLabel, children: [
1341
+ /* @__PURE__ */ jsx("span", { className: "sg-tile-label", children: props.label }),
1342
+ /* @__PURE__ */ jsx("span", { className: "sg-tile-rowmain", children: main }),
1343
+ /* @__PURE__ */ jsx("span", { className: "sg-tile-chev", children: /* @__PURE__ */ jsx(ChevronGlyph, {}) })
1344
+ ] });
1345
+ }
1346
+ return /* @__PURE__ */ jsxs("button", { type: "button", ref: props.btnRef, className: "sg-tile", disabled: props.disabled, onClick: props.onClick, "aria-label": ariaLabel, children: [
1347
+ /* @__PURE__ */ jsx("span", { className: "sg-tile-label", children: props.label }),
1348
+ /* @__PURE__ */ jsx("span", { className: "sg-tile-main", children: main })
1349
+ ] });
1350
+ }
1322
1351
  function ChainChip(props) {
1323
1352
  const [broken, setBroken] = useState(false);
1324
1353
  const logo = props.chain?.logoUrl;
@@ -1962,6 +1991,18 @@ function PaymentIsland(props) {
1962
1991
  const ids = new Set(fundingTokens.map((t) => Number(t.chainId)));
1963
1992
  return chains.filter((c) => ids.has(Number(c.chainId)));
1964
1993
  }, [chains, fundingTokens]);
1994
+ const payableAssets = useMemo(() => {
1995
+ const seen = /* @__PURE__ */ new Set();
1996
+ const list = [];
1997
+ for (const { route } of held) {
1998
+ const symbol = symbolKey(route.source.asset);
1999
+ if (seen.has(symbol)) continue;
2000
+ seen.add(symbol);
2001
+ const token = registryTokens.find((t) => Number(t.chainId) === route.source.chainId && addrEq(t.address, route.source.tokenAddress));
2002
+ list.push({ symbol: route.source.asset, logoUrl: token?.logoUrl });
2003
+ }
2004
+ return list;
2005
+ }, [held, registryTokens]);
1965
2006
  const userPicked = useRef(false);
1966
2007
  const selectRoute = useCallback(
1967
2008
  (id) => {
@@ -2064,8 +2105,6 @@ function PaymentIsland(props) {
2064
2105
  const submitting = flow.status === "submitting";
2065
2106
  const sel = flow.selected;
2066
2107
  const selectedVisible = Boolean(sel && visibleRoutes.some((r) => r.id === sel.id));
2067
- const selPick = sel && selectedVisible ? { chainId: sel.source.chainId, symbol: sel.source.asset } : null;
2068
- const selToken = sel ? registryTokens.find((t) => Number(t.chainId) === sel.source.chainId && addrEq(t.address, sel.source.tokenAddress)) ?? null : null;
2069
2108
  const selBal = sel ? holdings.balances[balanceKey(sel.source.chainId, sel.source.tokenAddress)] : void 0;
2070
2109
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
2071
2110
  const mismatch = flow.status === "error" && flow.verdict?.status === "mismatch";
@@ -2289,7 +2328,18 @@ function PaymentIsland(props) {
2289
2328
  /* @__PURE__ */ jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsx(Button, { disabled: true, children: method === "card" ? "Card \u2014 coming soon" : "Bank \u2014 coming soon" }) })
2290
2329
  ] })
2291
2330
  ) : /* @__PURE__ */ jsxs(Fragment, { children: [
2292
- isPay ? /* @__PURE__ */ jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsx(TokenTile, { row: true, label: "Pay with", pick: selPick, token: selToken, disabled: submitting || !visibleRoutes.length, btnRef: methodRowRef, onClick: () => setView("select") }) }) : null,
2331
+ isPay ? /* @__PURE__ */ jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsx(
2332
+ FundingTile,
2333
+ {
2334
+ row: true,
2335
+ label: "Pay with",
2336
+ assets: payableAssets,
2337
+ loading: flow.status === "loading" || holdings.loading,
2338
+ disabled: submitting || !visibleRoutes.length,
2339
+ btnRef: methodRowRef,
2340
+ onClick: () => setView("select")
2341
+ }
2342
+ ) }) : null,
2293
2343
  loading ? /* @__PURE__ */ jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
2294
2344
  /* @__PURE__ */ jsx("div", { className: "sg-skel" }),
2295
2345
  /* @__PURE__ */ jsxs("div", { className: "sg-muted", style: { fontSize: 13 }, children: [
@@ -2464,6 +2514,18 @@ function StableGeniePay(props) {
2464
2514
  const ids = new Set(fundingTokens.map((t) => Number(t.chainId)));
2465
2515
  return chains.filter((c) => ids.has(Number(c.chainId)));
2466
2516
  }, [chains, fundingTokens]);
2517
+ const payableAssets = useMemo(() => {
2518
+ const seen = /* @__PURE__ */ new Set();
2519
+ const list = [];
2520
+ for (const { route } of held) {
2521
+ const symbol = symbolKey(route.source.asset);
2522
+ if (seen.has(symbol)) continue;
2523
+ seen.add(symbol);
2524
+ const token = registryTokens.find((t) => Number(t.chainId) === route.source.chainId && addrEq2(t.address, route.source.tokenAddress));
2525
+ list.push({ symbol: route.source.asset, logoUrl: token?.logoUrl });
2526
+ }
2527
+ return list;
2528
+ }, [held, registryTokens]);
2467
2529
  const userPicked = useRef(false);
2468
2530
  const selectRoute = useCallback(
2469
2531
  (id) => {
@@ -2511,8 +2573,6 @@ function StableGeniePay(props) {
2511
2573
  const submitting = flow.status === "submitting";
2512
2574
  const sel = flow.selected;
2513
2575
  const selectedVisible = Boolean(sel && visibleRoutes.some((r) => r.id === sel.id));
2514
- const selPick = sel && selectedVisible ? { chainId: sel.source.chainId, symbol: sel.source.asset } : null;
2515
- const selToken = sel ? registryTokens.find((t) => Number(t.chainId) === sel.source.chainId && addrEq2(t.address, sel.source.tokenAddress)) ?? null : null;
2516
2576
  const selBal = sel ? holdings.balances[balanceKey(sel.source.chainId, sel.source.tokenAddress)] : void 0;
2517
2577
  const why = parked ? "" : sel && selectedVisible ? sel.state === "DIRECT" ? `Direct ${sel.source.asset} transfer on ${CHAIN_LABELS[sel.source.chainId] || sel.source.chainName} \xB7 lowest cost` : (
2518
2578
  // Deliberately does NOT restate the destination amount — that is merchant config, not a payer fact.
@@ -2550,11 +2610,11 @@ function StableGeniePay(props) {
2550
2610
  /* @__PURE__ */ jsx(MethodTabs, { value: method, onChange: setMethod }),
2551
2611
  parked ? /* @__PURE__ */ jsx(StatusPanel, { children: comingSoon }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2552
2612
  /* @__PURE__ */ jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsx(
2553
- TokenTile,
2613
+ FundingTile,
2554
2614
  {
2555
2615
  label: "Pay with",
2556
- pick: selPick,
2557
- token: selToken,
2616
+ assets: payableAssets,
2617
+ loading: flow.status === "loading" || holdings.loading,
2558
2618
  disabled: submitting || !visibleRoutes.length,
2559
2619
  btnRef: payTileRef,
2560
2620
  onClick: () => setView("select")
package/dist/index.cjs CHANGED
@@ -2060,6 +2060,10 @@ var WIDGET_CSS = `
2060
2060
  .sg-tile-sym{font-size:16px;font-weight:700;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
2061
2061
  .sg-tile-chain{font-size:11px;color:var(--sg-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
2062
2062
  .sg-tile-empty{color:var(--sg-text-muted);font-size:15px;font-weight:600}
2063
+ .sg-funding-glyphs{display:flex;align-items:center;flex:0 0 auto;padding-right:2px}
2064
+ .sg-funding-glyphs .sg-tok{box-shadow:0 0 0 2px var(--sg-surface);border-radius:999px}
2065
+ .sg-funding-glyphs .sg-tok+.sg-tok{margin-left:-8px}
2066
+ .sg-funding-copy{display:flex;flex-direction:column;min-width:0}
2063
2067
  .sg-ft-arrow{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:30px;height:30px;border-radius:999px;background:var(--sg-bg);border:1px solid var(--sg-border);display:flex;align-items:center;justify-content:center;color:var(--sg-text-muted);z-index:1;pointer-events:none}
2064
2068
 
2065
2069
  /* token identity: logo circle + tiny chain badge, with a letters fallback */
@@ -2696,6 +2700,31 @@ function TokenTile(props) {
2696
2700
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-main", children: glyph })
2697
2701
  ] });
2698
2702
  }
2703
+ function FundingTile(props) {
2704
+ const symbols = props.assets.map((asset) => asset.symbol);
2705
+ const summary = props.loading ? "Checking wallet assets\u2026" : symbols.length ? symbols.join(", ") : "No payable balance";
2706
+ const detail = props.loading ? "Finding what you can pay with" : symbols.length ? `${symbols.length} wallet asset${symbols.length === 1 ? "" : "s"} available` : "Open to review funding options";
2707
+ const ariaLabel = `${props.label}: ${props.loading ? "checking wallet assets" : symbols.length ? symbols.join(", ") : "no payable balance"}`;
2708
+ const glyphs = props.loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok-fb", children: "\u2026" }) }) : symbols.length ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-funding-glyphs", "aria-hidden": "true", children: props.assets.slice(0, 3).map((asset) => /* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: asset.symbol, logoUrl: asset.logoUrl, size: "sm" }, asset.symbol)) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok-fb", children: "?" }) });
2709
+ const main = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2710
+ glyphs,
2711
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-funding-copy", children: [
2712
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children: summary }),
2713
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chain", children: detail })
2714
+ ] })
2715
+ ] });
2716
+ if (props.row) {
2717
+ return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", ref: props.btnRef, className: "sg-tile sg-tile--row", disabled: props.disabled, onClick: props.onClick, "aria-label": ariaLabel, children: [
2718
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-label", children: props.label }),
2719
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-rowmain", children: main }),
2720
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chev", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronGlyph, {}) })
2721
+ ] });
2722
+ }
2723
+ return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", ref: props.btnRef, className: "sg-tile", disabled: props.disabled, onClick: props.onClick, "aria-label": ariaLabel, children: [
2724
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-label", children: props.label }),
2725
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-main", children: main })
2726
+ ] });
2727
+ }
2699
2728
  function ChainChip(props) {
2700
2729
  const [broken, setBroken] = react.useState(false);
2701
2730
  const logo = props.chain?.logoUrl;
@@ -3339,6 +3368,18 @@ function PaymentIsland(props) {
3339
3368
  const ids = new Set(fundingTokens.map((t) => Number(t.chainId)));
3340
3369
  return chains.filter((c) => ids.has(Number(c.chainId)));
3341
3370
  }, [chains, fundingTokens]);
3371
+ const payableAssets = react.useMemo(() => {
3372
+ const seen = /* @__PURE__ */ new Set();
3373
+ const list = [];
3374
+ for (const { route } of held) {
3375
+ const symbol = symbolKey(route.source.asset);
3376
+ if (seen.has(symbol)) continue;
3377
+ seen.add(symbol);
3378
+ const token = registryTokens.find((t) => Number(t.chainId) === route.source.chainId && addrEq(t.address, route.source.tokenAddress));
3379
+ list.push({ symbol: route.source.asset, logoUrl: token?.logoUrl });
3380
+ }
3381
+ return list;
3382
+ }, [held, registryTokens]);
3342
3383
  const userPicked = react.useRef(false);
3343
3384
  const selectRoute = react.useCallback(
3344
3385
  (id) => {
@@ -3441,8 +3482,6 @@ function PaymentIsland(props) {
3441
3482
  const submitting = flow.status === "submitting";
3442
3483
  const sel = flow.selected;
3443
3484
  const selectedVisible = Boolean(sel && visibleRoutes.some((r) => r.id === sel.id));
3444
- const selPick = sel && selectedVisible ? { chainId: sel.source.chainId, symbol: sel.source.asset } : null;
3445
- const selToken = sel ? registryTokens.find((t) => Number(t.chainId) === sel.source.chainId && addrEq(t.address, sel.source.tokenAddress)) ?? null : null;
3446
3485
  const selBal = sel ? holdings.balances[balanceKey(sel.source.chainId, sel.source.tokenAddress)] : void 0;
3447
3486
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
3448
3487
  const mismatch = flow.status === "error" && flow.verdict?.status === "mismatch";
@@ -3666,7 +3705,18 @@ function PaymentIsland(props) {
3666
3705
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { disabled: true, children: method === "card" ? "Card \u2014 coming soon" : "Bank \u2014 coming soon" }) })
3667
3706
  ] })
3668
3707
  ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3669
- isPay ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(TokenTile, { row: true, label: "Pay with", pick: selPick, token: selToken, disabled: submitting || !visibleRoutes.length, btnRef: methodRowRef, onClick: () => setView("select") }) }) : null,
3708
+ isPay ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
3709
+ FundingTile,
3710
+ {
3711
+ row: true,
3712
+ label: "Pay with",
3713
+ assets: payableAssets,
3714
+ loading: flow.status === "loading" || holdings.loading,
3715
+ disabled: submitting || !visibleRoutes.length,
3716
+ btnRef: methodRowRef,
3717
+ onClick: () => setView("select")
3718
+ }
3719
+ ) }) : null,
3670
3720
  loading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
3671
3721
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-skel" }),
3672
3722
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-muted", style: { fontSize: 13 }, children: [
@@ -3841,6 +3891,18 @@ function StableGeniePay(props) {
3841
3891
  const ids = new Set(fundingTokens.map((t) => Number(t.chainId)));
3842
3892
  return chains.filter((c) => ids.has(Number(c.chainId)));
3843
3893
  }, [chains, fundingTokens]);
3894
+ const payableAssets = react.useMemo(() => {
3895
+ const seen = /* @__PURE__ */ new Set();
3896
+ const list = [];
3897
+ for (const { route } of held) {
3898
+ const symbol = symbolKey(route.source.asset);
3899
+ if (seen.has(symbol)) continue;
3900
+ seen.add(symbol);
3901
+ const token = registryTokens.find((t) => Number(t.chainId) === route.source.chainId && addrEq2(t.address, route.source.tokenAddress));
3902
+ list.push({ symbol: route.source.asset, logoUrl: token?.logoUrl });
3903
+ }
3904
+ return list;
3905
+ }, [held, registryTokens]);
3844
3906
  const userPicked = react.useRef(false);
3845
3907
  const selectRoute = react.useCallback(
3846
3908
  (id) => {
@@ -3888,8 +3950,6 @@ function StableGeniePay(props) {
3888
3950
  const submitting = flow.status === "submitting";
3889
3951
  const sel = flow.selected;
3890
3952
  const selectedVisible = Boolean(sel && visibleRoutes.some((r) => r.id === sel.id));
3891
- const selPick = sel && selectedVisible ? { chainId: sel.source.chainId, symbol: sel.source.asset } : null;
3892
- const selToken = sel ? registryTokens.find((t) => Number(t.chainId) === sel.source.chainId && addrEq2(t.address, sel.source.tokenAddress)) ?? null : null;
3893
3953
  const selBal = sel ? holdings.balances[balanceKey(sel.source.chainId, sel.source.tokenAddress)] : void 0;
3894
3954
  const why = parked ? "" : sel && selectedVisible ? sel.state === "DIRECT" ? `Direct ${sel.source.asset} transfer on ${CHAIN_LABELS[sel.source.chainId] || sel.source.chainName} \xB7 lowest cost` : (
3895
3955
  // Deliberately does NOT restate the destination amount — that is merchant config, not a payer fact.
@@ -3927,11 +3987,11 @@ function StableGeniePay(props) {
3927
3987
  /* @__PURE__ */ jsxRuntime.jsx(MethodTabs, { value: method, onChange: setMethod }),
3928
3988
  parked ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { children: comingSoon }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3929
3989
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
3930
- TokenTile,
3990
+ FundingTile,
3931
3991
  {
3932
3992
  label: "Pay with",
3933
- pick: selPick,
3934
- token: selToken,
3993
+ assets: payableAssets,
3994
+ loading: flow.status === "loading" || holdings.loading,
3935
3995
  disabled: submitting || !visibleRoutes.length,
3936
3996
  btnRef: payTileRef,
3937
3997
  onClick: () => setView("select")
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme } from './chunk-6FPSGLRR.js';
1
+ export { PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme } from './chunk-DH7QYQG4.js';
2
2
  export { createEngine } from './chunk-VL5MWEY2.js';
package/dist/mount.cjs CHANGED
@@ -2057,6 +2057,10 @@ var WIDGET_CSS = `
2057
2057
  .sg-tile-sym{font-size:16px;font-weight:700;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
2058
2058
  .sg-tile-chain{font-size:11px;color:var(--sg-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
2059
2059
  .sg-tile-empty{color:var(--sg-text-muted);font-size:15px;font-weight:600}
2060
+ .sg-funding-glyphs{display:flex;align-items:center;flex:0 0 auto;padding-right:2px}
2061
+ .sg-funding-glyphs .sg-tok{box-shadow:0 0 0 2px var(--sg-surface);border-radius:999px}
2062
+ .sg-funding-glyphs .sg-tok+.sg-tok{margin-left:-8px}
2063
+ .sg-funding-copy{display:flex;flex-direction:column;min-width:0}
2060
2064
  .sg-ft-arrow{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:30px;height:30px;border-radius:999px;background:var(--sg-bg);border:1px solid var(--sg-border);display:flex;align-items:center;justify-content:center;color:var(--sg-text-muted);z-index:1;pointer-events:none}
2061
2065
 
2062
2066
  /* token identity: logo circle + tiny chain badge, with a letters fallback */
@@ -2693,6 +2697,31 @@ function TokenTile(props) {
2693
2697
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-main", children: glyph })
2694
2698
  ] });
2695
2699
  }
2700
+ function FundingTile(props) {
2701
+ const symbols = props.assets.map((asset) => asset.symbol);
2702
+ const summary = props.loading ? "Checking wallet assets\u2026" : symbols.length ? symbols.join(", ") : "No payable balance";
2703
+ const detail = props.loading ? "Finding what you can pay with" : symbols.length ? `${symbols.length} wallet asset${symbols.length === 1 ? "" : "s"} available` : "Open to review funding options";
2704
+ const ariaLabel = `${props.label}: ${props.loading ? "checking wallet assets" : symbols.length ? symbols.join(", ") : "no payable balance"}`;
2705
+ const glyphs = props.loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok-fb", children: "\u2026" }) }) : symbols.length ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-funding-glyphs", "aria-hidden": "true", children: props.assets.slice(0, 3).map((asset) => /* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: asset.symbol, logoUrl: asset.logoUrl, size: "sm" }, asset.symbol)) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok-fb", children: "?" }) });
2706
+ const main = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2707
+ glyphs,
2708
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-funding-copy", children: [
2709
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children: summary }),
2710
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chain", children: detail })
2711
+ ] })
2712
+ ] });
2713
+ if (props.row) {
2714
+ return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", ref: props.btnRef, className: "sg-tile sg-tile--row", disabled: props.disabled, onClick: props.onClick, "aria-label": ariaLabel, children: [
2715
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-label", children: props.label }),
2716
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-rowmain", children: main }),
2717
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chev", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronGlyph, {}) })
2718
+ ] });
2719
+ }
2720
+ return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", ref: props.btnRef, className: "sg-tile", disabled: props.disabled, onClick: props.onClick, "aria-label": ariaLabel, children: [
2721
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-label", children: props.label }),
2722
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-main", children: main })
2723
+ ] });
2724
+ }
2696
2725
  function ChainChip(props) {
2697
2726
  const [broken, setBroken] = react.useState(false);
2698
2727
  const logo = props.chain?.logoUrl;
@@ -3336,6 +3365,18 @@ function PaymentIsland(props) {
3336
3365
  const ids = new Set(fundingTokens.map((t) => Number(t.chainId)));
3337
3366
  return chains.filter((c) => ids.has(Number(c.chainId)));
3338
3367
  }, [chains, fundingTokens]);
3368
+ const payableAssets = react.useMemo(() => {
3369
+ const seen = /* @__PURE__ */ new Set();
3370
+ const list = [];
3371
+ for (const { route } of held) {
3372
+ const symbol = symbolKey(route.source.asset);
3373
+ if (seen.has(symbol)) continue;
3374
+ seen.add(symbol);
3375
+ const token = registryTokens.find((t) => Number(t.chainId) === route.source.chainId && addrEq(t.address, route.source.tokenAddress));
3376
+ list.push({ symbol: route.source.asset, logoUrl: token?.logoUrl });
3377
+ }
3378
+ return list;
3379
+ }, [held, registryTokens]);
3339
3380
  const userPicked = react.useRef(false);
3340
3381
  const selectRoute = react.useCallback(
3341
3382
  (id) => {
@@ -3438,8 +3479,6 @@ function PaymentIsland(props) {
3438
3479
  const submitting = flow.status === "submitting";
3439
3480
  const sel = flow.selected;
3440
3481
  const selectedVisible = Boolean(sel && visibleRoutes.some((r) => r.id === sel.id));
3441
- const selPick = sel && selectedVisible ? { chainId: sel.source.chainId, symbol: sel.source.asset } : null;
3442
- const selToken = sel ? registryTokens.find((t) => Number(t.chainId) === sel.source.chainId && addrEq(t.address, sel.source.tokenAddress)) ?? null : null;
3443
3482
  const selBal = sel ? holdings.balances[balanceKey(sel.source.chainId, sel.source.tokenAddress)] : void 0;
3444
3483
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
3445
3484
  const mismatch = flow.status === "error" && flow.verdict?.status === "mismatch";
@@ -3663,7 +3702,18 @@ function PaymentIsland(props) {
3663
3702
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { disabled: true, children: method === "card" ? "Card \u2014 coming soon" : "Bank \u2014 coming soon" }) })
3664
3703
  ] })
3665
3704
  ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3666
- isPay ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(TokenTile, { row: true, label: "Pay with", pick: selPick, token: selToken, disabled: submitting || !visibleRoutes.length, btnRef: methodRowRef, onClick: () => setView("select") }) }) : null,
3705
+ isPay ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
3706
+ FundingTile,
3707
+ {
3708
+ row: true,
3709
+ label: "Pay with",
3710
+ assets: payableAssets,
3711
+ loading: flow.status === "loading" || holdings.loading,
3712
+ disabled: submitting || !visibleRoutes.length,
3713
+ btnRef: methodRowRef,
3714
+ onClick: () => setView("select")
3715
+ }
3716
+ ) }) : null,
3667
3717
  loading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
3668
3718
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-skel" }),
3669
3719
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-muted", style: { fontSize: 13 }, children: [
@@ -3838,6 +3888,18 @@ function StableGeniePay(props) {
3838
3888
  const ids = new Set(fundingTokens.map((t) => Number(t.chainId)));
3839
3889
  return chains.filter((c) => ids.has(Number(c.chainId)));
3840
3890
  }, [chains, fundingTokens]);
3891
+ const payableAssets = react.useMemo(() => {
3892
+ const seen = /* @__PURE__ */ new Set();
3893
+ const list = [];
3894
+ for (const { route } of held) {
3895
+ const symbol = symbolKey(route.source.asset);
3896
+ if (seen.has(symbol)) continue;
3897
+ seen.add(symbol);
3898
+ const token = registryTokens.find((t) => Number(t.chainId) === route.source.chainId && addrEq2(t.address, route.source.tokenAddress));
3899
+ list.push({ symbol: route.source.asset, logoUrl: token?.logoUrl });
3900
+ }
3901
+ return list;
3902
+ }, [held, registryTokens]);
3841
3903
  const userPicked = react.useRef(false);
3842
3904
  const selectRoute = react.useCallback(
3843
3905
  (id) => {
@@ -3885,8 +3947,6 @@ function StableGeniePay(props) {
3885
3947
  const submitting = flow.status === "submitting";
3886
3948
  const sel = flow.selected;
3887
3949
  const selectedVisible = Boolean(sel && visibleRoutes.some((r) => r.id === sel.id));
3888
- const selPick = sel && selectedVisible ? { chainId: sel.source.chainId, symbol: sel.source.asset } : null;
3889
- const selToken = sel ? registryTokens.find((t) => Number(t.chainId) === sel.source.chainId && addrEq2(t.address, sel.source.tokenAddress)) ?? null : null;
3890
3950
  const selBal = sel ? holdings.balances[balanceKey(sel.source.chainId, sel.source.tokenAddress)] : void 0;
3891
3951
  const why = parked ? "" : sel && selectedVisible ? sel.state === "DIRECT" ? `Direct ${sel.source.asset} transfer on ${CHAIN_LABELS[sel.source.chainId] || sel.source.chainName} \xB7 lowest cost` : (
3892
3952
  // Deliberately does NOT restate the destination amount — that is merchant config, not a payer fact.
@@ -3924,11 +3984,11 @@ function StableGeniePay(props) {
3924
3984
  /* @__PURE__ */ jsxRuntime.jsx(MethodTabs, { value: method, onChange: setMethod }),
3925
3985
  parked ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { children: comingSoon }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3926
3986
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
3927
- TokenTile,
3987
+ FundingTile,
3928
3988
  {
3929
3989
  label: "Pay with",
3930
- pick: selPick,
3931
- token: selToken,
3990
+ assets: payableAssets,
3991
+ loading: flow.status === "loading" || holdings.loading,
3932
3992
  disabled: submitting || !visibleRoutes.length,
3933
3993
  btnRef: payTileRef,
3934
3994
  onClick: () => setView("select")
package/dist/mount.js CHANGED
@@ -1,2 +1,2 @@
1
- export { mount } from './chunk-6FPSGLRR.js';
1
+ export { mount } from './chunk-DH7QYQG4.js';
2
2
  import './chunk-VL5MWEY2.js';