@glacislabs/stablegenie-zerodelta 3.4.0 → 4.0.0

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.
@@ -1,5 +1,5 @@
1
- import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, symbolKey, normalizeDecimalText, parseUnitsDecimal, assetDecimals, findToken, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, SUPPORTED_CHAIN_IDS, formatUnits, createEngine, routeNativeValue, checkNativeFee, nativeFeeShortLabel, nativeSymbol, nativeFeeShortMessage, allowanceCovers, validatePlannedTransaction, BUNDLED_RPC } from './chunk-TYQF2L5C.js';
2
- import { createContext, useMemo, useState, useEffect, useRef, useCallback, useId, createElement, useContext } from 'react';
1
+ import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceChecks, DIRECT_CHECK_IDS, complianceTagOf, symbolKey, normalizeDecimalText, parseUnitsDecimal, assetDecimals, findToken, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, SUPPORTED_CHAIN_IDS, formatUnits, unattributedComplianceReasons, distinctScreenedWallets, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, createEngine, routeNativeValue, checkNativeFee, nativeFeeShortLabel, nativeSymbol, nativeFeeShortMessage, allowanceCovers, validatePlannedTransaction, BUNDLED_RPC } from './chunk-FJQQLB2K.js';
2
+ import { createContext, useState, useRef, useEffect, useMemo, useCallback, useId, createElement, useContext } from 'react';
3
3
  import { createRoot } from 'react-dom/client';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
 
@@ -936,6 +936,98 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
936
936
  .sg-island .sg-spinner{display:none!important}
937
937
  .sg-island .sg-rm-dot{display:inline-block}
938
938
  }
939
+
940
+ /* \u2500\u2500 compliance disclosure \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
941
+ Mirrors the dApp's compliance row + details dialog. The row is a quiet affordance in the payment
942
+ summary; the details open a sheet that fills the widget's own card, because a page-level modal
943
+ inside somebody else's checkout is a z-index fight we would lose.
944
+
945
+ Tone note, carried over from the dApp: a PASS reads in body ink, not in green. The shield tick is
946
+ already green, so colouring the sentence too says the same thing twice and spends the accent on
947
+ the half that carries no information. A DENY still shouts. */
948
+ /* NOT positioned. The sheet is inset:0 against the WIDGET CARD, so this wrapper must not become
949
+ the containing block: when it carried position:relative the sheet collapsed to the height of
950
+ this one row and drew straight through the CTA beneath it.
951
+ NB this stylesheet is a JS template literal - never write a backtick in these comments. */
952
+ .sg-cp{margin-top:10px}
953
+ .sg-cp-row{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:9px 12px;border:1px solid var(--sg-border);border-radius:var(--sg-radius-control);background:var(--sg-surface);color:inherit;font:inherit;text-align:left;cursor:pointer;transition:border-color 120ms ease,background 120ms ease}
954
+ .sg-cp-row:hover{border-color:color-mix(in srgb,var(--sg-accent) 40%,var(--sg-border))}
955
+ .sg-cp-row:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
956
+ .sg-cp-row-main{display:flex;align-items:center;gap:8px;min-width:0}
957
+ .sg-cp-row-glyph{display:flex;flex:0 0 auto;color:var(--sg-success)}
958
+ .sg-cp-row[data-tone="neutral"] .sg-cp-row-glyph{color:var(--sg-text-muted);opacity:.55}
959
+ .sg-cp-row[data-tone="blocked"] .sg-cp-row-glyph,.sg-cp-row[data-tone="warn"] .sg-cp-row-glyph{color:var(--sg-danger)}
960
+ .sg-cp-row-label{font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
961
+ .sg-cp-row[data-tone="neutral"] .sg-cp-row-label{color:var(--sg-text-muted)}
962
+ .sg-cp-row[data-tone="blocked"] .sg-cp-row-label,.sg-cp-row[data-tone="warn"] .sg-cp-row-label{color:var(--sg-danger)}
963
+ .sg-cp-row-chev{display:flex;flex:0 0 auto;color:var(--sg-text-muted)}
964
+ .sg-cp-row-tag{display:block;margin:4px 0 0 32px;font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--sg-text-muted)}
965
+
966
+ /* the sheet \u2014 fills the widget card */
967
+ .sg-cp-sheet{display:flex;flex-direction:column;padding:14px;background:var(--sg-bg);border:1px solid var(--sg-border);border-radius:var(--sg-radius-control);animation:sg-cp-in var(--sg-motion-fast) var(--sg-ease-out-soft) both}
968
+ @keyframes sg-cp-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
969
+ .sg-cp-sheet:focus{outline:none}
970
+ .sg-cp-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:0 0 auto}
971
+ .sg-cp-sheet-title{margin:0;font-size:15px;font-weight:600}
972
+ .sg-cp-close{display:flex;align-items:center;justify-content:center;width:28px;height:28px;flex:0 0 auto;border:0;border-radius:8px;background:transparent;color:var(--sg-text-muted);cursor:pointer;transition:background 120ms ease,color 120ms ease}
973
+ .sg-cp-close:hover{background:var(--sg-surface);color:var(--sg-text)}
974
+ .sg-cp-close:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
975
+ .sg-cp-tabs{display:flex;align-items:center;gap:4px;flex:0 0 auto;margin-top:10px;padding:4px;border:1px solid var(--sg-border);border-radius:14px}
976
+ .sg-cp-tab{flex:1 1 0;min-width:0;padding:7px 8px;border:0;border-radius:11px;background:transparent;color:var(--sg-text-muted);font:inherit;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;cursor:pointer;transition:background 120ms ease,color 120ms ease}
977
+ .sg-cp-tab[data-active="true"]{background:color-mix(in srgb,var(--sg-accent) 10%,transparent);color:var(--sg-accent)}
978
+ .sg-cp-tab:focus-visible{outline:2px solid var(--sg-accent);outline-offset:-2px}
979
+ .sg-cp-sheet-body{margin-top:10px}
980
+ .sg-cp-tabpanel{display:flex;flex-direction:column;gap:8px}
981
+
982
+ /* cards */
983
+ .sg-cp-card{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--sg-border);border-radius:16px}
984
+ .sg-cp-card-head{display:flex;align-items:center;gap:8px}
985
+ .sg-cp-card-glyph{display:flex;flex:0 0 auto;color:var(--sg-accent)}
986
+ .sg-cp-card-title{margin:0;font-size:14px;font-weight:600}
987
+ .sg-cp-summary{display:flex;flex-direction:column;gap:3px}
988
+ .sg-cp-summary-head{display:flex;align-items:center;gap:8px;color:var(--sg-success)}
989
+ .sg-cp-summary-head[data-tone="neutral"]{color:var(--sg-text-muted)}
990
+ .sg-cp-summary-head[data-tone="blocked"],.sg-cp-summary-head[data-tone="warn"]{color:var(--sg-danger)}
991
+ .sg-cp-summary-title{font-size:14px;font-weight:600;color:var(--sg-text)}
992
+ .sg-cp-summary-head[data-tone="blocked"] .sg-cp-summary-title,.sg-cp-summary-head[data-tone="warn"] .sg-cp-summary-title{color:var(--sg-danger)}
993
+ .sg-cp-summary-sub{margin:0;padding-left:24px;font-size:12px;line-height:1.35;color:var(--sg-text-muted)}
994
+
995
+ /* per-control rows */
996
+ .sg-cp-checks{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:11px}
997
+ .sg-cp-check-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px}
998
+ .sg-cp-check-label{display:flex;align-items:center;gap:8px;min-width:0;font-size:13.5px;line-height:1.25}
999
+ .sg-cp-check[data-ok="false"] .sg-cp-check-label{color:var(--sg-danger)}
1000
+ .sg-cp-check-mark{display:flex;flex:0 0 auto;color:var(--sg-success)}
1001
+ .sg-cp-check-mark[data-ok="false"]{color:var(--sg-danger)}
1002
+ .sg-cp-check-note,.sg-cp-check-reason{display:block;padding-left:20px;margin-top:3px;font-size:11.5px;line-height:1.4;color:var(--sg-text-muted);overflow-wrap:anywhere}
1003
+ .sg-cp-check-reason{color:var(--sg-danger)}
1004
+ .sg-cp-link{display:inline-flex;align-items:center;gap:5px;padding:0;border:0;background:transparent;color:var(--sg-accent);font:inherit;font-size:12px;font-weight:500;cursor:pointer}
1005
+ .sg-cp-link:hover{text-decoration:underline}
1006
+ .sg-cp-link:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px;border-radius:4px}
1007
+ .sg-cp-orphans{list-style:none;margin:0;padding:0 0 0 20px;display:flex;flex-direction:column;gap:3px;font-size:11.5px;line-height:1.4;color:var(--sg-danger)}
1008
+ .sg-cp-scope{margin:0;font-size:11.5px;line-height:1.45;color:var(--sg-text-muted)}
1009
+ .sg-cp-flags{margin:0;font-size:13px}
1010
+
1011
+ /* quote details */
1012
+ .sg-cp-facts{margin:0;display:flex;flex-direction:column;gap:9px}
1013
+ .sg-cp-fact{display:grid;grid-template-columns:78px minmax(0,1fr);align-items:center;gap:10px}
1014
+ .sg-cp-fact dt{font-size:12px;color:var(--sg-text-muted)}
1015
+ .sg-cp-fact dd{margin:0;font-size:13px;min-width:0;overflow-wrap:anywhere}
1016
+
1017
+ /* screening policy */
1018
+ .sg-cp-policy-head{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:8px;padding-bottom:2px}
1019
+ .sg-cp-policy-id{font-size:11px;color:var(--sg-text-muted);overflow-wrap:anywhere}
1020
+ .sg-cp-policy-facts{padding:2px 0 8px}
1021
+ .sg-cp-buckets{display:flex;flex-direction:column;gap:8px}
1022
+ .sg-cp-bucket{gap:10px;padding:12px 14px}
1023
+ .sg-cp-bucket-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 10px}
1024
+ .sg-cp-bucket-detail{font-size:11.5px;color:var(--sg-text-muted)}
1025
+ .sg-cp-cats{list-style:none;margin:0;padding:0 0 0 4px;display:flex;flex-direction:column;gap:5px}
1026
+ .sg-cp-cats li{display:flex;align-items:center;gap:10px;font-size:12.5px;line-height:1.35}
1027
+ .sg-cp-dot{flex:0 0 auto;width:4px;height:4px;border-radius:999px;background:var(--sg-accent);opacity:.8}
1028
+
1029
+ /* express (PaymentIsland) trims the card padding, so the sheet follows */
1030
+ @media (prefers-reduced-motion:reduce){.sg-cp-sheet{animation:none}}
939
1031
  `;
940
1032
  var injected = false;
941
1033
  function injectStyles() {
@@ -1301,6 +1393,251 @@ function RouteList(props) {
1301
1393
  ] }) : null
1302
1394
  ] });
1303
1395
  }
1396
+ function ShieldTick({ size = 16 }) {
1397
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1398
+ /* @__PURE__ */ jsx("path", { d: "M12 2.5 4.5 5.5v6c0 4.4 3.1 8.5 7.5 10 4.4-1.5 7.5-5.6 7.5-10v-6L12 2.5Z", fill: "currentColor", opacity: ".14" }),
1399
+ /* @__PURE__ */ jsx("path", { d: "M12 2.5 4.5 5.5v6c0 4.4 3.1 8.5 7.5 10 4.4-1.5 7.5-5.6 7.5-10v-6L12 2.5Z", stroke: "currentColor", strokeWidth: "1.6", strokeLinejoin: "round" }),
1400
+ /* @__PURE__ */ jsx("path", { d: "m8.6 11.9 2.3 2.3 4.5-4.5", stroke: "currentColor", strokeWidth: "1.9", strokeLinecap: "round", strokeLinejoin: "round" })
1401
+ ] });
1402
+ }
1403
+ function TickCircle({ size = 16 }) {
1404
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1405
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
1406
+ /* @__PURE__ */ jsx("path", { d: "m7.8 12.2 2.7 2.7 5.7-5.8", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round", strokeLinejoin: "round" })
1407
+ ] });
1408
+ }
1409
+ function CloseCircle({ size = 16 }) {
1410
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1411
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
1412
+ /* @__PURE__ */ jsx("path", { d: "m8.7 8.7 6.6 6.6M15.3 8.7l-6.6 6.6", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round" })
1413
+ ] });
1414
+ }
1415
+ function PendingCircle({ size = 16 }) {
1416
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1417
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9.2", stroke: "currentColor", strokeWidth: "1.6", strokeDasharray: "3 3" }),
1418
+ /* @__PURE__ */ jsx("path", { d: "M8.5 12h7", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
1419
+ ] });
1420
+ }
1421
+ function Tick({ size = 12 }) {
1422
+ return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m4.5 12.8 5 5L19.5 6.5", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }) });
1423
+ }
1424
+ function Cross({ size = 12 }) {
1425
+ return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m5.5 5.5 13 13M18.5 5.5l-13 13", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round" }) });
1426
+ }
1427
+ function Chevron({ size = 16 }) {
1428
+ return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m9 5 7 7-7 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
1429
+ }
1430
+ function Info({ size = 16 }) {
1431
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1432
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
1433
+ /* @__PURE__ */ jsx("path", { d: "M12 10.6v6", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round" }),
1434
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "7.6", r: "1.25", fill: "var(--sg-bg)" })
1435
+ ] });
1436
+ }
1437
+ function Lock({ size = 16 }) {
1438
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1439
+ /* @__PURE__ */ jsx("rect", { x: "4.5", y: "10.5", width: "15", height: "9.5", rx: "2.2", stroke: "currentColor", strokeWidth: "1.7" }),
1440
+ /* @__PURE__ */ jsx("path", { d: "M8 10.5V7.8a4 4 0 0 1 8 0v2.7", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" })
1441
+ ] });
1442
+ }
1443
+ function ShieldOutline({ size = 16 }) {
1444
+ return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M12 2.5 4.5 5.5v6c0 4.4 3.1 8.5 7.5 10 4.4-1.5 7.5-5.6 7.5-10v-6L12 2.5Z", stroke: "currentColor", strokeWidth: "1.7", strokeLinejoin: "round" }) });
1445
+ }
1446
+ function WarningFilled({ size = 16 }) {
1447
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1448
+ /* @__PURE__ */ jsx("path", { d: "M12 3.2 21.4 19.4H2.6L12 3.2Z", fill: "currentColor" }),
1449
+ /* @__PURE__ */ jsx("path", { d: "M12 9.4v4.3", stroke: "var(--sg-bg)", strokeWidth: "1.9", strokeLinecap: "round" }),
1450
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "16.4", r: "1.05", fill: "var(--sg-bg)" })
1451
+ ] });
1452
+ }
1453
+ function CornerArrow({ size = 12 }) {
1454
+ return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M7 17 17 7M9 7h8v8", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round" }) });
1455
+ }
1456
+ var POLICY_GLYPH = {
1457
+ "always-blocked": Lock,
1458
+ blocked: ShieldOutline,
1459
+ flagged: WarningFilled
1460
+ };
1461
+ var POLICY_DETAIL = {
1462
+ "always-blocked": "Cannot be changed or disabled",
1463
+ blocked: "Stops the payment",
1464
+ flagged: "Does not automatically block"
1465
+ };
1466
+ function shortAddr(a) {
1467
+ return a.length > 14 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
1468
+ }
1469
+ function TriggerGlyph({ cv }) {
1470
+ if (cv.tone === "blocked" || cv.tone === "warn") return /* @__PURE__ */ jsx(CloseCircle, {});
1471
+ return /* @__PURE__ */ jsx(ShieldTick, {});
1472
+ }
1473
+ function CheckRow({ check, onViewPolicy }) {
1474
+ const label = check.id === "risk" ? check.ok ? "Risk screening passed" : "Risk screening failed" : check.label;
1475
+ return /* @__PURE__ */ jsxs("li", { className: "sg-cp-check", "data-ok": check.ok, children: [
1476
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-check-head", children: [
1477
+ /* @__PURE__ */ jsxs("span", { className: "sg-cp-check-label", children: [
1478
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-check-mark", "data-ok": check.ok, children: check.ok ? /* @__PURE__ */ jsx(Tick, {}) : /* @__PURE__ */ jsx(Cross, {}) }),
1479
+ /* @__PURE__ */ jsx("span", { children: label }),
1480
+ /* @__PURE__ */ jsx("span", { className: "sg-sr-only", children: check.ok ? " \u2014 passed" : " \u2014 failed" })
1481
+ ] }),
1482
+ check.id === "risk" ? /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-cp-link", onClick: onViewPolicy, children: [
1483
+ "View policy",
1484
+ /* @__PURE__ */ jsx(CornerArrow, {})
1485
+ ] }) : null
1486
+ ] }),
1487
+ check.note ? /* @__PURE__ */ jsx("span", { className: "sg-cp-check-note", children: check.note }) : null,
1488
+ check.reasons.map((reason) => /* @__PURE__ */ jsx("span", { className: "sg-cp-check-reason", children: humanizeComplianceReason(reason) }, reason))
1489
+ ] });
1490
+ }
1491
+ function QuoteChecks({
1492
+ compliance,
1493
+ cv,
1494
+ checks,
1495
+ direct,
1496
+ onViewPolicy
1497
+ }) {
1498
+ const allPassed = cv.tone === "ok" && checks.length > 0 && checks.every((c) => c.ok);
1499
+ const summary = allPassed ? "All checks passed" : cv.label;
1500
+ const orphans = unattributedComplianceReasons(compliance, cv);
1501
+ const wallets = distinctScreenedWallets(compliance);
1502
+ const jurisdiction = compliance?.sourceJurisdiction?.trim();
1503
+ const hasDetails = Boolean(jurisdiction || wallets.length || compliance?.checkId);
1504
+ return /* @__PURE__ */ jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Quote checks", children: [
1505
+ /* @__PURE__ */ jsxs("section", { className: "sg-cp-card", children: [
1506
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-summary", children: [
1507
+ /* @__PURE__ */ jsxs("span", { className: "sg-cp-summary-head", "data-tone": cv.tone, children: [
1508
+ cv.tone === "blocked" || cv.tone === "warn" ? /* @__PURE__ */ jsx(CloseCircle, {}) : cv.tone === "neutral" ? /* @__PURE__ */ jsx(PendingCircle, {}) : /* @__PURE__ */ jsx(TickCircle, {}),
1509
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-summary-title", children: summary })
1510
+ ] }),
1511
+ checks.length > 0 ? /* @__PURE__ */ jsxs("p", { className: "sg-cp-summary-sub", children: [
1512
+ checks.length,
1513
+ " check",
1514
+ checks.length === 1 ? " was" : "s were",
1515
+ " completed for this payment"
1516
+ ] }) : (
1517
+ // No decision was issued. Listing the controls here would be ticks for a verdict nobody
1518
+ // gave, and an unconfigured gate is not a set of passed checks.
1519
+ /* @__PURE__ */ jsx("p", { className: "sg-cp-summary-sub", children: "The gateway returned no compliance decision for this quote, so there is nothing to show. It is not a failed check." })
1520
+ )
1521
+ ] }),
1522
+ checks.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "sg-cp-checks", children: checks.map((check) => /* @__PURE__ */ jsx(CheckRow, { check, onViewPolicy }, check.id)) }) : null,
1523
+ orphans.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "sg-cp-orphans", children: orphans.map((reason) => /* @__PURE__ */ jsx("li", { children: humanizeComplianceReason(reason) }, reason)) }) : null,
1524
+ direct && checks.length > 0 ? /* @__PURE__ */ jsx("p", { className: "sg-cp-scope", children: DIRECT_SCOPE_NOTE }) : null
1525
+ ] }),
1526
+ compliance?.flaggedCategories?.length ? /* @__PURE__ */ jsxs("section", { className: "sg-cp-card", children: [
1527
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-card-head", children: [
1528
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsx(WarningFilled, {}) }),
1529
+ /* @__PURE__ */ jsx("h5", { className: "sg-cp-card-title", children: "Flagged, not blocking" })
1530
+ ] }),
1531
+ /* @__PURE__ */ jsx("p", { className: "sg-cp-flags", children: compliance.flaggedCategories.map(categoryLabel).join(" \xB7 ") }),
1532
+ /* @__PURE__ */ jsx("p", { className: "sg-cp-scope", children: "The policy records these and still allows the payment. They do not stop settlement." })
1533
+ ] }) : null,
1534
+ hasDetails ? /* @__PURE__ */ jsxs("section", { className: "sg-cp-card", children: [
1535
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-card-head", children: [
1536
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsx(Info, {}) }),
1537
+ /* @__PURE__ */ jsx("h5", { className: "sg-cp-card-title", children: "Quote details" })
1538
+ ] }),
1539
+ /* @__PURE__ */ jsxs("dl", { className: "sg-cp-facts", children: [
1540
+ jurisdiction ? /* @__PURE__ */ jsx(Fact, { label: "Jurisdiction", value: jurisdiction }) : null,
1541
+ wallets.map((w, i) => /* @__PURE__ */ jsx(Fact, { label: wallets.length > 1 ? i === 0 ? "Payer" : "Recipient" : "Wallet", value: shortAddr(w), title: w, mono: true }, w)),
1542
+ compliance?.checkId ? /* @__PURE__ */ jsx(Fact, { label: "Check ID", value: compliance.checkId, mono: true }) : null
1543
+ ] })
1544
+ ] }) : null
1545
+ ] });
1546
+ }
1547
+ function Fact({ label, value, title, mono = false }) {
1548
+ return /* @__PURE__ */ jsxs("div", { className: "sg-cp-fact", children: [
1549
+ /* @__PURE__ */ jsx("dt", { children: label }),
1550
+ /* @__PURE__ */ jsx("dd", { title, className: mono ? "sg-mono" : void 0, children: value })
1551
+ ] });
1552
+ }
1553
+ function ScreeningPolicy({ compliance }) {
1554
+ const policyId = compliance?.policyVersion?.trim();
1555
+ const applied = Boolean(compliance?.decision || policyId || compliance?.appliedPolicyNames?.length);
1556
+ const names = [...compliance?.appliedPolicyNames ?? [], ...compliance?.appliedLegislation ?? []];
1557
+ return /* @__PURE__ */ jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Screening policy", children: [
1558
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-policy-head", children: [
1559
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-summary", children: [
1560
+ /* @__PURE__ */ jsxs("span", { className: "sg-cp-summary-head", "data-tone": applied ? "ok" : "neutral", children: [
1561
+ applied ? /* @__PURE__ */ jsx(TickCircle, {}) : /* @__PURE__ */ jsx(PendingCircle, {}),
1562
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-summary-title", children: "Transaction screening policy" })
1563
+ ] }),
1564
+ /* @__PURE__ */ jsx("p", { className: "sg-cp-summary-sub", children: applied ? "Applied to this payment" : "No policy decision was returned" })
1565
+ ] }),
1566
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-policy-id sg-mono", children: policyId ? `Policy ${policyId}` : "Policy ID unavailable" })
1567
+ ] }),
1568
+ names.length ? /* @__PURE__ */ jsxs("dl", { className: "sg-cp-facts sg-cp-policy-facts", children: [
1569
+ compliance?.appliedPolicyNames?.length ? /* @__PURE__ */ jsx(Fact, { label: "Policy", value: compliance.appliedPolicyNames.join(", ") }) : null,
1570
+ compliance?.appliedLegislation?.length ? /* @__PURE__ */ jsx(Fact, { label: "Legislation", value: compliance.appliedLegislation.join(", ") }) : null
1571
+ ] }) : null,
1572
+ /* @__PURE__ */ jsx("div", { className: "sg-cp-buckets", children: SCREENING_BUCKETS.map((bucket) => {
1573
+ const Glyph = POLICY_GLYPH[bucket.outcome];
1574
+ return /* @__PURE__ */ jsxs("section", { className: "sg-cp-card sg-cp-bucket", children: [
1575
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-bucket-head", children: [
1576
+ /* @__PURE__ */ jsxs("span", { className: "sg-cp-card-head", children: [
1577
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsx(Glyph, {}) }),
1578
+ /* @__PURE__ */ jsx("h5", { className: "sg-cp-card-title", children: bucket.title })
1579
+ ] }),
1580
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-bucket-detail", children: POLICY_DETAIL[bucket.outcome] })
1581
+ ] }),
1582
+ /* @__PURE__ */ jsx("ul", { className: "sg-cp-cats", children: bucket.categories.map((category) => /* @__PURE__ */ jsxs("li", { children: [
1583
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-dot", "aria-hidden": "true" }),
1584
+ category
1585
+ ] }, category)) })
1586
+ ] }, bucket.outcome);
1587
+ }) })
1588
+ ] });
1589
+ }
1590
+ function CompliancePanel(props) {
1591
+ const [open, setOpen] = useState(false);
1592
+ const [tab, setTab] = useState("checks");
1593
+ const triggerRef = useRef(null);
1594
+ const sheetRef = useRef(null);
1595
+ const compliance = props.compliance ?? null;
1596
+ const cv = complianceView(compliance, props.hasQuote ?? true);
1597
+ const allChecks = complianceChecks(compliance, cv);
1598
+ const checks = props.direct ? allChecks.filter((c) => DIRECT_CHECK_IDS.includes(c.id)) : allChecks;
1599
+ const tag = complianceTagOf(compliance);
1600
+ useEffect(() => {
1601
+ if (!open) return;
1602
+ sheetRef.current?.focus();
1603
+ const onKey = (e) => {
1604
+ if (e.key === "Escape") {
1605
+ e.stopPropagation();
1606
+ setOpen(false);
1607
+ triggerRef.current?.focus();
1608
+ }
1609
+ };
1610
+ document.addEventListener("keydown", onKey, true);
1611
+ return () => document.removeEventListener("keydown", onKey, true);
1612
+ }, [open]);
1613
+ const close = () => {
1614
+ setOpen(false);
1615
+ triggerRef.current?.focus();
1616
+ };
1617
+ return /* @__PURE__ */ jsxs("div", { className: "sg-cp", "data-tone": cv.tone, children: [
1618
+ open ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
1619
+ /* @__PURE__ */ jsxs("button", { ref: triggerRef, type: "button", className: "sg-cp-row", "data-tone": cv.tone, onClick: () => setOpen(true), "aria-haspopup": "dialog", children: [
1620
+ /* @__PURE__ */ jsxs("span", { className: "sg-cp-row-main", children: [
1621
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-row-glyph", children: /* @__PURE__ */ jsx(TriggerGlyph, { cv }) }),
1622
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-row-label", children: cv.label })
1623
+ ] }),
1624
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-row-chev", children: /* @__PURE__ */ jsx(Chevron, {}) })
1625
+ ] }),
1626
+ (cv.blocked || cv.needsAction) && tag ? /* @__PURE__ */ jsx("span", { className: "sg-cp-row-tag sg-mono", children: tag }) : null
1627
+ ] }),
1628
+ open ? /* @__PURE__ */ jsxs("div", { className: "sg-cp-sheet", role: "dialog", "aria-modal": "true", "aria-label": "Compliance details", ref: sheetRef, tabIndex: -1, children: [
1629
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-sheet-head", children: [
1630
+ /* @__PURE__ */ jsx("h4", { className: "sg-cp-sheet-title", children: "Compliance details" }),
1631
+ /* @__PURE__ */ jsx("button", { type: "button", className: "sg-cp-close", onClick: close, "aria-label": "Close compliance details", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m6 6 12 12M18 6 6 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
1632
+ ] }),
1633
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-tabs", role: "tablist", "aria-label": "Compliance details sections", children: [
1634
+ /* @__PURE__ */ jsx("button", { type: "button", role: "tab", "aria-selected": tab === "checks", "data-active": tab === "checks", className: "sg-cp-tab", onClick: () => setTab("checks"), children: "Quote checks" }),
1635
+ /* @__PURE__ */ jsx("button", { type: "button", role: "tab", "aria-selected": tab === "policy", "data-active": tab === "policy", className: "sg-cp-tab", onClick: () => setTab("policy"), children: "Screening policy" })
1636
+ ] }),
1637
+ /* @__PURE__ */ jsx("div", { className: "sg-cp-sheet-body", children: tab === "checks" ? /* @__PURE__ */ jsx(QuoteChecks, { compliance, cv, checks, direct: !!props.direct, onViewPolicy: () => setTab("policy") }) : /* @__PURE__ */ jsx(ScreeningPolicy, { compliance }) })
1638
+ ] }) : null
1639
+ ] });
1640
+ }
1304
1641
 
1305
1642
  // src/react/ui/chain-logos.ts
1306
1643
  var BUNDLED_CHAIN_LOGO = {
@@ -2598,6 +2935,7 @@ function PaymentIsland(props) {
2598
2935
  chainName(sel.source.chainId)
2599
2936
  ] })
2600
2937
  ] }) : null,
2938
+ sel && !loading && !quoteError ? /* @__PURE__ */ jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
2601
2939
  quoteError ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: flow.error || "Couldn't get a price right now." }) : null,
2602
2940
  walletError ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: flow.error || "The wallet could not complete this payment." }) : null,
2603
2941
  submitting || walletError ? /* @__PURE__ */ jsx(StepList, { variant: "rich", steps: flow.steps, verdict: flow.verdict }) : null,
@@ -2934,6 +3272,7 @@ function StableGeniePay(props) {
2934
3272
  scannedEmpty ? /* @__PURE__ */ jsx("div", { className: "sg-note", children: "None of your balances can cover this yet \u2014 pick a different asset to fund with." }) : null,
2935
3273
  flow.status === "ready" && !visibleRoutes.length ? /* @__PURE__ */ jsx(StatusPanel, { children: "No funding route matches the accepted assets for this payment." }) : null
2936
3274
  ] }),
3275
+ sel && flow.status !== "loading" ? /* @__PURE__ */ jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
2937
3276
  submitting ? /* @__PURE__ */ jsx(StepList, { steps: flow.steps }) : null,
2938
3277
  /* @__PURE__ */ jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsx(
2939
3278
  Button,
@@ -3077,6 +3416,7 @@ function StableGenieSwap(props) {
3077
3416
  ] }),
3078
3417
  flow.status === "error" && flow.error ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: flow.error }) : null,
3079
3418
  flow.routes.length ? /* @__PURE__ */ jsx(RouteList, { routes: flow.routes, selectedId: flow.selected?.id ?? null, onSelect: flow.selectRoute }) : null,
3419
+ flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
3080
3420
  submitting ? /* @__PURE__ */ jsx(StepList, { steps: flow.steps }) : null,
3081
3421
  /* @__PURE__ */ jsxs("div", { className: "sg-cta-wrap", children: [
3082
3422
  !wallet.account ? /* @__PURE__ */ jsx(Button, { onClick: wallet.connect, busy: wallet.connecting, children: "Connect wallet" }) : /* @__PURE__ */ jsx(Button, { onClick: flow.submit, busy: submitting, disabled: !flow.selected || flow.insufficient || !!flow.nativeShortfall || !enabled || flow.status === "loading", children: swapLabel }),
@@ -3364,6 +3704,7 @@ function StableGenieExchange(props) {
3364
3704
  meta.duration ? ` \xB7 ~${meta.duration}s` : ""
3365
3705
  ] }) : null
3366
3706
  ] }) : null,
3707
+ connected && flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
3367
3708
  submitting ? /* @__PURE__ */ jsx(StepList, { steps: flow.steps }) : null,
3368
3709
  /* @__PURE__ */ jsxs("div", { className: "sg-cta-wrap", children: [
3369
3710
  !connected && !rampMode ? /* @__PURE__ */ jsx(Button, { onClick: wallet.connect, busy: wallet.connecting, children: "Connect wallet" }) : /* @__PURE__ */ jsx(Button, { onClick: rampMode ? void 0 : flow.submit, busy: submitting, disabled: rampMode || !quotable || !cryptoReady || connected && (!flow.selected || flow.insufficient || !!flow.nativeShortfall || flow.status === "loading"), children: ctaLabel }),
@@ -3468,4 +3809,4 @@ function mount(el, config) {
3468
3809
  return () => root.unmount();
3469
3810
  }
3470
3811
 
3471
- export { PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieRwaExchange, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme };
3812
+ export { CompliancePanel, PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieRwaExchange, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme };