@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.
- package/dist/{chunk-Q3YSX4D5.js → chunk-ABI6ZH7O.js} +344 -3
- package/dist/{chunk-TYQF2L5C.js → chunk-FJQQLB2K.js} +411 -19
- package/dist/core/index.cjs +433 -18
- package/dist/core/index.d.cts +21 -4
- package/dist/core/index.d.ts +21 -4
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +764 -26
- package/dist/index.d.cts +22 -3
- package/dist/index.d.ts +22 -3
- package/dist/index.js +2 -2
- package/dist/{mount-BT2NejVt.d.ts → mount-D5k_u92L.d.ts} +1 -1
- package/dist/{mount-D8NmWtqV.d.cts → mount-mcyZAzZc.d.cts} +1 -1
- package/dist/mount.cjs +743 -26
- package/dist/mount.d.cts +2 -2
- package/dist/mount.d.ts +2 -2
- package/dist/mount.js +2 -2
- package/dist/standalone.global.js +99 -7
- package/dist/{verify-34voZYj1.d.cts → verify-C9vzpm4T.d.cts} +225 -1
- package/dist/{verify-34voZYj1.d.ts → verify-C9vzpm4T.d.ts} +225 -1
- package/package.json +1 -1
package/dist/mount.cjs
CHANGED
|
@@ -36,6 +36,7 @@ var TRADEABLE_RWA_ASSETS = /* @__PURE__ */ new Set([
|
|
|
36
36
|
]);
|
|
37
37
|
var SUPPORTED_ASSETS = /* @__PURE__ */ new Set([...STABLE_ASSETS, ...TRADEABLE_RWA_ASSETS]);
|
|
38
38
|
var API_CACHE_TTL_MS = 6e4;
|
|
39
|
+
var SCREEN_CACHE_TTL_MS = 5 * 6e4;
|
|
39
40
|
var MAX_QUOTE_CANDIDATES = 8;
|
|
40
41
|
var QUOTE_BUFFER_BPS = 50;
|
|
41
42
|
var LZ_FEE_BUFFER_BPS = 1500n;
|
|
@@ -758,6 +759,322 @@ function brokenLaneReason(lane) {
|
|
|
758
759
|
}
|
|
759
760
|
}
|
|
760
761
|
|
|
762
|
+
// src/core/compliance.ts
|
|
763
|
+
var COMPLIANCE_DENY_LABEL = "Compliance check failed";
|
|
764
|
+
function complianceView(compliance, hasQuote = true) {
|
|
765
|
+
if (!hasQuote) {
|
|
766
|
+
return {
|
|
767
|
+
tone: "neutral",
|
|
768
|
+
label: "Compliance checks run with your quote",
|
|
769
|
+
headline: "No compliance decision for this payment yet",
|
|
770
|
+
blocked: false,
|
|
771
|
+
needsAction: false,
|
|
772
|
+
screened: false
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
const decision = compliance?.decision;
|
|
776
|
+
const screened = compliance?.status === "SCREENED";
|
|
777
|
+
if (decision === "DENY") {
|
|
778
|
+
return {
|
|
779
|
+
tone: "blocked",
|
|
780
|
+
label: COMPLIANCE_DENY_LABEL,
|
|
781
|
+
headline: "Blocked by compliance policy",
|
|
782
|
+
blocked: true,
|
|
783
|
+
needsAction: false,
|
|
784
|
+
screened
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
if (decision === "REVIEW" || decision === "REMEDIATE") {
|
|
788
|
+
const word = decision.toLowerCase();
|
|
789
|
+
return {
|
|
790
|
+
tone: "warn",
|
|
791
|
+
label: `Compliance: ${word} required`,
|
|
792
|
+
headline: `Manual ${word} required`,
|
|
793
|
+
blocked: false,
|
|
794
|
+
needsAction: true,
|
|
795
|
+
screened
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
if (decision === "ALLOW") {
|
|
799
|
+
return {
|
|
800
|
+
tone: "ok",
|
|
801
|
+
label: screened ? "Compliance checks passed" : "Allowed \u2014 wallets not screened",
|
|
802
|
+
headline: screened ? "Wallets screened and allowed" : "Allowed \u2014 wallets not screened",
|
|
803
|
+
blocked: false,
|
|
804
|
+
needsAction: false,
|
|
805
|
+
screened
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
return {
|
|
809
|
+
tone: "neutral",
|
|
810
|
+
label: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
|
|
811
|
+
headline: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
|
|
812
|
+
blocked: false,
|
|
813
|
+
needsAction: false,
|
|
814
|
+
screened
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
var CATEGORY_PHRASES = {
|
|
818
|
+
SANCTIONS: "sanctions",
|
|
819
|
+
TERRORISM_FINANCING: "terrorism financing",
|
|
820
|
+
STOLEN_FUNDS: "stolen funds",
|
|
821
|
+
RANSOMWARE: "ransomware",
|
|
822
|
+
SCAM: "scam activity",
|
|
823
|
+
DARKNET: "darknet activity",
|
|
824
|
+
MIXER: "mixer usage",
|
|
825
|
+
HIGH_RISK_ENTITY: "a high-risk entity",
|
|
826
|
+
PEP: "a politically-exposed person",
|
|
827
|
+
INDIRECT_EXPOSURE: "indirect exposure",
|
|
828
|
+
UNCLASSIFIED: "an unrecognized risk",
|
|
829
|
+
UNKNOWN: "an unrecognized risk"
|
|
830
|
+
};
|
|
831
|
+
function categoryLabel(code) {
|
|
832
|
+
const key = code.trim().toUpperCase();
|
|
833
|
+
const LABELS = {
|
|
834
|
+
SANCTIONS: "Sanctions",
|
|
835
|
+
TERRORISM_FINANCING: "Terrorist financing",
|
|
836
|
+
STOLEN_FUNDS: "Stolen funds",
|
|
837
|
+
RANSOMWARE: "Ransomware",
|
|
838
|
+
SCAM: "Scam",
|
|
839
|
+
DARKNET: "Darknet services",
|
|
840
|
+
MIXER: "Mixer",
|
|
841
|
+
HIGH_RISK_ENTITY: "High-risk entity",
|
|
842
|
+
PEP: "Politically exposed person (PEP)",
|
|
843
|
+
INDIRECT_EXPOSURE: "Indirect exposure",
|
|
844
|
+
UNCLASSIFIED: "Unclassified risk",
|
|
845
|
+
UNKNOWN: "Unclassified risk"
|
|
846
|
+
};
|
|
847
|
+
return LABELS[key] ?? key.toLowerCase().replace(/_/g, " ");
|
|
848
|
+
}
|
|
849
|
+
function cleanJurisdiction(code) {
|
|
850
|
+
return code.replace(/^(OFAC|TIER\d+|SANCTIONED)_/i, "").trim();
|
|
851
|
+
}
|
|
852
|
+
function stripBundlePrefix(head) {
|
|
853
|
+
if (head.startsWith("policy_")) return { head: head.slice("policy_".length), source: "policy" };
|
|
854
|
+
if (head.startsWith("legislation_")) return { head: head.slice("legislation_".length), source: "legislation" };
|
|
855
|
+
return { head, source: null };
|
|
856
|
+
}
|
|
857
|
+
function complianceReasonHead(raw) {
|
|
858
|
+
return stripBundlePrefix((raw.split(":")[0] ?? "").trim()).head;
|
|
859
|
+
}
|
|
860
|
+
function usd(raw) {
|
|
861
|
+
const n = Number(raw);
|
|
862
|
+
if (!Number.isFinite(n)) return `$${raw}`;
|
|
863
|
+
return `$${n.toLocaleString("en-US", { maximumFractionDigits: 2 })}`;
|
|
864
|
+
}
|
|
865
|
+
function capFromDetail(detail) {
|
|
866
|
+
const m = detail.match(/>([\d.]+)/);
|
|
867
|
+
return m ? ` (${usd(m[1])})` : "";
|
|
868
|
+
}
|
|
869
|
+
function categoryPhrase(detail) {
|
|
870
|
+
const cat = detail.replace(/\s*\(.*\)$/, "").toUpperCase();
|
|
871
|
+
return CATEGORY_PHRASES[cat] ?? cat.toLowerCase().replace(/_/g, " ");
|
|
872
|
+
}
|
|
873
|
+
function humanizeComplianceReason(raw) {
|
|
874
|
+
const [headRaw, ...restParts] = raw.split(":");
|
|
875
|
+
const detail = restParts.join(":").trim();
|
|
876
|
+
const { head, source } = stripBundlePrefix((headRaw ?? "").trim());
|
|
877
|
+
const scope = source === "legislation" ? "applicable regulations" : "the applicable policy";
|
|
878
|
+
switch (head) {
|
|
879
|
+
case "asset_pair_not_allowed": {
|
|
880
|
+
const m = detail.match(/^(\S+)->(\S+)\s+in\s+(\S+)/);
|
|
881
|
+
if (m) return `${m[1]} \u2192 ${m[2]} isn't available in your region (${cleanJurisdiction(m[3])}).`;
|
|
882
|
+
return "This asset pair isn't available in your region.";
|
|
883
|
+
}
|
|
884
|
+
case "asset_not_allowed": {
|
|
885
|
+
const m = detail.match(/^(\S+?)->(\S+?)(?::|$)/);
|
|
886
|
+
if (m) return `${m[1]} \u2192 ${m[2]} isn't permitted under ${scope}.`;
|
|
887
|
+
return `This asset pair isn't permitted under ${scope}.`;
|
|
888
|
+
}
|
|
889
|
+
case "blocked_jurisdiction":
|
|
890
|
+
return `Your region (${cleanJurisdiction(detail)}) isn't supported.`;
|
|
891
|
+
case "blocked_destination_jurisdiction":
|
|
892
|
+
return `The destination region (${cleanJurisdiction(detail)}) isn't supported.`;
|
|
893
|
+
case "jurisdiction_out_of_scope":
|
|
894
|
+
return `Not covered by ${scope}.`;
|
|
895
|
+
case "ui_block":
|
|
896
|
+
return `Payments aren't available in your region (${cleanJurisdiction(detail)}).`;
|
|
897
|
+
case "blocked_corridor_mode":
|
|
898
|
+
return "This route isn't currently open for payments.";
|
|
899
|
+
case "blocked_category":
|
|
900
|
+
return `Flagged for ${categoryPhrase(detail)}.`;
|
|
901
|
+
case "amount_exceeds_max_order_usd":
|
|
902
|
+
case "amount_exceeds_max":
|
|
903
|
+
return `Amount exceeds the maximum order size${capFromDetail(detail)}.`;
|
|
904
|
+
case "amount_exceeds_actor_cap":
|
|
905
|
+
return `Amount exceeds the limit for your account type${capFromDetail(detail)}.`;
|
|
906
|
+
case "amount_exceeds_jurisdiction_max":
|
|
907
|
+
return `Amount exceeds the limit for your region${capFromDetail(detail)}.`;
|
|
908
|
+
case "source_chain_not_allowed":
|
|
909
|
+
return `The source chain isn't permitted under ${scope}.`;
|
|
910
|
+
case "dest_chain_not_allowed":
|
|
911
|
+
return `The destination chain isn't permitted under ${scope}.`;
|
|
912
|
+
default:
|
|
913
|
+
return detail ? `${head.replace(/_/g, " ")} \u2014 ${detail}` : head.replace(/_/g, " ");
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
var COMPLIANCE_CHECK_ORDER = [
|
|
917
|
+
"location",
|
|
918
|
+
"screening",
|
|
919
|
+
"risk",
|
|
920
|
+
"asset",
|
|
921
|
+
"limits"
|
|
922
|
+
];
|
|
923
|
+
var CHECK_LABELS = {
|
|
924
|
+
location: "Location and corridor permitted",
|
|
925
|
+
screening: "Both wallets screened",
|
|
926
|
+
risk: "Risk policy passed",
|
|
927
|
+
asset: "Asset and amount allowed",
|
|
928
|
+
limits: "Transaction limits verified"
|
|
929
|
+
};
|
|
930
|
+
var CHECK_HEADS = {
|
|
931
|
+
location: [
|
|
932
|
+
"blocked_jurisdiction",
|
|
933
|
+
"blocked_destination_jurisdiction",
|
|
934
|
+
"ui_block",
|
|
935
|
+
"blocked_corridor_mode",
|
|
936
|
+
"jurisdiction_out_of_scope"
|
|
937
|
+
],
|
|
938
|
+
screening: [],
|
|
939
|
+
risk: ["blocked_category"],
|
|
940
|
+
asset: ["asset_pair_not_allowed", "asset_not_allowed", "source_chain_not_allowed", "dest_chain_not_allowed"],
|
|
941
|
+
limits: [
|
|
942
|
+
"amount_exceeds_max_order_usd",
|
|
943
|
+
"amount_exceeds_max",
|
|
944
|
+
"amount_exceeds_actor_cap",
|
|
945
|
+
"amount_exceeds_jurisdiction_max"
|
|
946
|
+
]
|
|
947
|
+
};
|
|
948
|
+
function distinctScreenedWallets(compliance) {
|
|
949
|
+
const seen = /* @__PURE__ */ new Set();
|
|
950
|
+
const wallets = [];
|
|
951
|
+
for (const raw of compliance?.screenedWallets ?? []) {
|
|
952
|
+
const address = raw?.trim();
|
|
953
|
+
if (!address) continue;
|
|
954
|
+
const key = /^0x[0-9a-fA-F]+$/.test(address) ? address.toLowerCase() : address;
|
|
955
|
+
if (seen.has(key)) continue;
|
|
956
|
+
seen.add(key);
|
|
957
|
+
wallets.push(address);
|
|
958
|
+
}
|
|
959
|
+
return wallets;
|
|
960
|
+
}
|
|
961
|
+
function shortAddress(a) {
|
|
962
|
+
return a.length > 12 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
|
|
963
|
+
}
|
|
964
|
+
function screeningLabel(wallets) {
|
|
965
|
+
if (wallets === 1) return "Wallet screened";
|
|
966
|
+
if (wallets === 2) return CHECK_LABELS.screening;
|
|
967
|
+
return "Wallets screened";
|
|
968
|
+
}
|
|
969
|
+
function complianceChecks(compliance, cv = complianceView(compliance)) {
|
|
970
|
+
if (cv.tone === "neutral") return [];
|
|
971
|
+
const byControl = /* @__PURE__ */ new Map();
|
|
972
|
+
for (const raw of compliance?.reasons ?? []) {
|
|
973
|
+
const head = complianceReasonHead(raw);
|
|
974
|
+
const id = COMPLIANCE_CHECK_ORDER.find((c) => CHECK_HEADS[c].includes(head));
|
|
975
|
+
if (!id) continue;
|
|
976
|
+
byControl.set(id, [...byControl.get(id) ?? [], raw]);
|
|
977
|
+
}
|
|
978
|
+
const screenedWallets = distinctScreenedWallets(compliance);
|
|
979
|
+
const wallets = screenedWallets.length;
|
|
980
|
+
const blocking = compliance?.blockingCategories?.length ?? 0;
|
|
981
|
+
return COMPLIANCE_CHECK_ORDER.map((id) => {
|
|
982
|
+
if (id === "screening") {
|
|
983
|
+
const ok2 = cv.screened || wallets > 0;
|
|
984
|
+
const note = wallets === 1 ? shortAddress(screenedWallets[0]) : wallets > 1 ? `${wallets} wallets screened` : void 0;
|
|
985
|
+
return { id, label: ok2 ? screeningLabel(wallets) : "Wallets not screened", ok: ok2, reasons: [], note };
|
|
986
|
+
}
|
|
987
|
+
const reasons = byControl.get(id) ?? [];
|
|
988
|
+
const ok = reasons.length === 0 && !(id === "risk" && blocking > 0);
|
|
989
|
+
return { id, label: CHECK_LABELS[id], ok, reasons };
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
function unattributedComplianceReasons(compliance, cv = complianceView(compliance)) {
|
|
993
|
+
const claimed = new Set(complianceChecks(compliance, cv).flatMap((c) => c.reasons));
|
|
994
|
+
return (compliance?.reasons ?? []).filter((r) => !claimed.has(r));
|
|
995
|
+
}
|
|
996
|
+
function directComplianceFromScreens(screens) {
|
|
997
|
+
const blockedAny = screens.some((s) => s.blocked);
|
|
998
|
+
const cats = (pick) => [
|
|
999
|
+
...new Set(screens.flatMap((s) => pick(s) ?? []))
|
|
1000
|
+
];
|
|
1001
|
+
return {
|
|
1002
|
+
status: "SCREENED",
|
|
1003
|
+
decision: blockedAny ? "DENY" : "ALLOW",
|
|
1004
|
+
screenedWallets: screens.map((s) => s.address),
|
|
1005
|
+
riskCategories: cats((s) => s.riskCategories),
|
|
1006
|
+
flaggedCategories: cats((s) => s.flaggedCategories),
|
|
1007
|
+
blockingCategories: cats((s) => s.blockingCategories),
|
|
1008
|
+
reasons: blockedAny ? cats((s) => s.blockingCategories).map((c) => `blocked_category:${c}`) : []
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
var DIRECT_CHECK_IDS = ["screening", "risk"];
|
|
1012
|
+
var DIRECT_SCOPE_NOTE = "Direct settlement moves your funds straight to the recipient, so wallet screening applies. Jurisdiction, corridor and amount policy are evaluated on routed payments.";
|
|
1013
|
+
var BLOCK_CATEGORY_LABELS = {
|
|
1014
|
+
STOLEN_FUNDS: "flagged as associated with stolen funds",
|
|
1015
|
+
SANCTIONS: "on a sanctions list",
|
|
1016
|
+
SANCTIONED: "on a sanctions list",
|
|
1017
|
+
OFAC: "on a sanctions list",
|
|
1018
|
+
TERRORIST_FINANCING: "flagged for terrorist financing",
|
|
1019
|
+
TERRORISM_FINANCING: "flagged for terrorist financing",
|
|
1020
|
+
FRAUD: "flagged for fraud",
|
|
1021
|
+
SCAM: "flagged as a scam address"
|
|
1022
|
+
};
|
|
1023
|
+
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
1024
|
+
function blockLabelFor(categories) {
|
|
1025
|
+
for (const raw of categories) {
|
|
1026
|
+
const label = BLOCK_CATEGORY_LABELS[String(raw || "").trim().toUpperCase()];
|
|
1027
|
+
if (label) return label;
|
|
1028
|
+
}
|
|
1029
|
+
return BLOCK_LABEL_DEFAULT;
|
|
1030
|
+
}
|
|
1031
|
+
var REASON_TAGS = {
|
|
1032
|
+
blocked_jurisdiction: "Restricted country",
|
|
1033
|
+
ui_block: "Restricted country",
|
|
1034
|
+
blocked_destination_jurisdiction: "Restricted destination",
|
|
1035
|
+
blocked_corridor_mode: "Corridor closed",
|
|
1036
|
+
blocked_category: "Risk flag",
|
|
1037
|
+
amount_exceeds_max_order_usd: "Limit exceeded",
|
|
1038
|
+
amount_exceeds_max: "Limit exceeded",
|
|
1039
|
+
amount_exceeds_actor_cap: "Limit exceeded",
|
|
1040
|
+
amount_exceeds_jurisdiction_max: "Limit exceeded",
|
|
1041
|
+
asset_pair_not_allowed: "Asset not allowed",
|
|
1042
|
+
asset_not_allowed: "Asset not allowed",
|
|
1043
|
+
source_chain_not_allowed: "Chain not allowed",
|
|
1044
|
+
dest_chain_not_allowed: "Chain not allowed",
|
|
1045
|
+
jurisdiction_out_of_scope: "Out of scope"
|
|
1046
|
+
};
|
|
1047
|
+
function complianceReasonTag(raw) {
|
|
1048
|
+
const head = complianceReasonHead(raw);
|
|
1049
|
+
return REASON_TAGS[head] ?? head.replace(/_/g, " ");
|
|
1050
|
+
}
|
|
1051
|
+
function complianceTagOf(compliance) {
|
|
1052
|
+
const first = (compliance?.reasons ?? [])[0];
|
|
1053
|
+
return first ? complianceReasonTag(first) : "";
|
|
1054
|
+
}
|
|
1055
|
+
var FLOOR_CATEGORIES = ["SANCTIONS", "TERRORISM_FINANCING", "STOLEN_FUNDS", "RANSOMWARE"];
|
|
1056
|
+
var TUNABLE_CATEGORIES = ["SCAM", "DARKNET", "MIXER", "HIGH_RISK_ENTITY", "PEP", "INDIRECT_EXPOSURE", "UNCLASSIFIED"];
|
|
1057
|
+
var TUNED_OUTCOMES = {
|
|
1058
|
+
SCAM: "blocked",
|
|
1059
|
+
DARKNET: "blocked",
|
|
1060
|
+
MIXER: "flagged",
|
|
1061
|
+
HIGH_RISK_ENTITY: "flagged",
|
|
1062
|
+
PEP: "flagged",
|
|
1063
|
+
INDIRECT_EXPOSURE: "flagged",
|
|
1064
|
+
UNCLASSIFIED: "flagged"
|
|
1065
|
+
};
|
|
1066
|
+
function screeningOutcomeOf(category) {
|
|
1067
|
+
const key = category.trim().toUpperCase();
|
|
1068
|
+
if (FLOOR_CATEGORIES.includes(key)) return "always-blocked";
|
|
1069
|
+
return TUNED_OUTCOMES[key] ?? null;
|
|
1070
|
+
}
|
|
1071
|
+
var labelsFor = (outcome) => [...FLOOR_CATEGORIES, ...TUNABLE_CATEGORIES].filter((c) => screeningOutcomeOf(c) === outcome).map(categoryLabel);
|
|
1072
|
+
var SCREENING_BUCKETS = [
|
|
1073
|
+
{ outcome: "always-blocked", title: "Always blocked", detail: "Cannot be changed or disabled.", categories: labelsFor("always-blocked") },
|
|
1074
|
+
{ outcome: "blocked", title: "Blocked under this policy", detail: "The current policy stops the order.", categories: labelsFor("blocked") },
|
|
1075
|
+
{ outcome: "flagged", title: "Flagged", detail: "A warning is shown.", categories: labelsFor("flagged") }
|
|
1076
|
+
];
|
|
1077
|
+
|
|
761
1078
|
// src/core/solve.ts
|
|
762
1079
|
async function solveExactOut({ option, destination, destinationToken, payer, fetchQuote }) {
|
|
763
1080
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -994,7 +1311,7 @@ function routeLabelFor(option, destinationToken, result) {
|
|
|
994
1311
|
const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
|
|
995
1312
|
return `Swap ${option.symbol} to ${destinationToken.symbol} and settle on ZeroDelta${bridge}.`;
|
|
996
1313
|
}
|
|
997
|
-
async function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve = solveExactOut, amountInRaw }) {
|
|
1314
|
+
async function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve = solveExactOut, amountInRaw, compliance }) {
|
|
998
1315
|
const result = await solve({ option, destination, destinationToken, payer, fetchQuote, amountInRaw });
|
|
999
1316
|
const quote = result.quote;
|
|
1000
1317
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -1041,7 +1358,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1041
1358
|
bridge: quote.bridge,
|
|
1042
1359
|
feeBps: quote.feeBps,
|
|
1043
1360
|
estimatedDuration: quote.estimatedDuration,
|
|
1044
|
-
iterations: result.iterations
|
|
1361
|
+
iterations: result.iterations,
|
|
1362
|
+
// A direct transfer never reaches /quote (solve.ts short-circuits it), so there is no
|
|
1363
|
+
// gateway decision to carry. The caller screens both parties itself and passes the
|
|
1364
|
+
// synthesized verdict in — see plan.ts and compliance.ts::directComplianceFromScreens.
|
|
1365
|
+
compliance
|
|
1045
1366
|
}
|
|
1046
1367
|
};
|
|
1047
1368
|
}
|
|
@@ -1125,7 +1446,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1125
1446
|
gasCostSource: quote.gasCostSource,
|
|
1126
1447
|
msgValue: valueRaw.toString(),
|
|
1127
1448
|
deadline: order.deadline,
|
|
1128
|
-
iterations: result.iterations
|
|
1449
|
+
iterations: result.iterations,
|
|
1450
|
+
// Carried verbatim from the gateway's decision on THIS wallet pair. The projection used to
|
|
1451
|
+
// drop it, which is why the widget could show a price with no evidence of the control that
|
|
1452
|
+
// produced it.
|
|
1453
|
+
compliance: quote.compliance
|
|
1129
1454
|
}
|
|
1130
1455
|
};
|
|
1131
1456
|
}
|
|
@@ -1161,25 +1486,20 @@ function apiMessage(json, fallback) {
|
|
|
1161
1486
|
}
|
|
1162
1487
|
return sanitizeMessage(err?.message, fallback);
|
|
1163
1488
|
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
TERRORIST_FINANCING: "flagged for terrorist financing",
|
|
1170
|
-
FRAUD: "flagged for fraud",
|
|
1171
|
-
SCAM: "flagged as a scam address"
|
|
1172
|
-
};
|
|
1173
|
-
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
1489
|
+
function isStructuredComplianceBlock(error) {
|
|
1490
|
+
const code = String(error?.code || "").toUpperCase();
|
|
1491
|
+
if (code === "COMPLIANCE_BLOCKED" || code === "COMPLIANCE_BLOCK") return true;
|
|
1492
|
+
return error?.status === 422 && Array.isArray(error?.reasons) && error.reasons.length > 0;
|
|
1493
|
+
}
|
|
1174
1494
|
function classifyQuoteError(error) {
|
|
1175
1495
|
if (!error) return null;
|
|
1176
1496
|
const reasons = Array.isArray(error.reasons) ? error.reasons : [];
|
|
1177
1497
|
const haystack = `${error.message || ""} ${reasons.join(" ")}`;
|
|
1178
1498
|
const catMatch = /blocked_category:\s*([A-Za-z_]+)/i.exec(haystack);
|
|
1179
|
-
const isBlock = !!catMatch || error.code === "blocked" || error.code === "compliance_block" || /\b(stolen|sanction(?:s|ed|ing)?|block(?:ed|list)|screen(?:ed|ing)?|compliance|ofac|denylist|blacklist)\b/i.test(haystack);
|
|
1499
|
+
const isBlock = isStructuredComplianceBlock(error) || !!catMatch || error.code === "blocked" || error.code === "compliance_block" || /\b(stolen|sanction(?:s|ed|ing)?|block(?:ed|list)|screen(?:ed|ing)?|compliance|ofac|denylist|blacklist)\b/i.test(haystack);
|
|
1180
1500
|
if (!isBlock) return null;
|
|
1181
1501
|
const category = (catMatch?.[1] || "").toUpperCase() || "COMPLIANCE";
|
|
1182
|
-
const label =
|
|
1502
|
+
const label = blockLabelFor([category]);
|
|
1183
1503
|
return {
|
|
1184
1504
|
blocked: true,
|
|
1185
1505
|
category,
|
|
@@ -1203,6 +1523,8 @@ function createApiClient(cfg) {
|
|
|
1203
1523
|
routes: null,
|
|
1204
1524
|
health: null
|
|
1205
1525
|
};
|
|
1526
|
+
const screenCache = /* @__PURE__ */ new Map();
|
|
1527
|
+
const screenInflight = /* @__PURE__ */ new Map();
|
|
1206
1528
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
1207
1529
|
async function apiRequest(path, init = {}) {
|
|
1208
1530
|
const apiKey = await cfg.getApiKey();
|
|
@@ -1297,7 +1619,32 @@ function createApiClient(cfg) {
|
|
|
1297
1619
|
}
|
|
1298
1620
|
throw lastError;
|
|
1299
1621
|
}
|
|
1300
|
-
|
|
1622
|
+
async function screenWallet(address, chainId) {
|
|
1623
|
+
const addr = String(address || "").trim();
|
|
1624
|
+
if (!addr) throw apiError("An address is required to screen a wallet.", { code: "bad_request" });
|
|
1625
|
+
const key = `${/^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr}|${chainId ?? ""}`;
|
|
1626
|
+
const hit = screenCache.get(key);
|
|
1627
|
+
if (hit && Date.now() - hit.at < SCREEN_CACHE_TTL_MS) return hit.value;
|
|
1628
|
+
const inflight = screenInflight.get(key);
|
|
1629
|
+
if (inflight) return inflight;
|
|
1630
|
+
const request = apiRequest("/screen/wallet", {
|
|
1631
|
+
method: "POST",
|
|
1632
|
+
body: JSON.stringify(chainId == null ? { address: addr } : { address: addr, chainId }),
|
|
1633
|
+
timeoutMs: 12e3
|
|
1634
|
+
}).then((screen) => {
|
|
1635
|
+
if (!screen || typeof screen !== "object" || typeof screen.blocked !== "boolean") {
|
|
1636
|
+
throw apiError("Compliance screening returned an unusable result.", { code: "bad_response" });
|
|
1637
|
+
}
|
|
1638
|
+
const value = { ...screen, address: screen.address || addr };
|
|
1639
|
+
screenCache.set(key, { at: Date.now(), value });
|
|
1640
|
+
return value;
|
|
1641
|
+
}).finally(() => {
|
|
1642
|
+
screenInflight.delete(key);
|
|
1643
|
+
});
|
|
1644
|
+
screenInflight.set(key, request);
|
|
1645
|
+
return request;
|
|
1646
|
+
}
|
|
1647
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchQuote, screenWallet, apiBase };
|
|
1301
1648
|
}
|
|
1302
1649
|
|
|
1303
1650
|
// src/core/plan.ts
|
|
@@ -1365,7 +1712,36 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1365
1712
|
balanceTargets.push({ chainId: option.chainId, tokenAddress: option.address, decimals: option.decimals });
|
|
1366
1713
|
}
|
|
1367
1714
|
const walletBalances = readBalances ? await readBalances(payer, balanceTargets).catch(() => ({})) : {};
|
|
1368
|
-
const
|
|
1715
|
+
const directOptions = options.filter((option) => option.direct);
|
|
1716
|
+
let directCompliance = null;
|
|
1717
|
+
if (directOptions.length) {
|
|
1718
|
+
const parties = [];
|
|
1719
|
+
const seenParty = /* @__PURE__ */ new Set();
|
|
1720
|
+
for (const raw of [payer, destination.address]) {
|
|
1721
|
+
const addr = String(raw || "").trim();
|
|
1722
|
+
if (!addr) continue;
|
|
1723
|
+
const key = /^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr;
|
|
1724
|
+
if (seenParty.has(key)) continue;
|
|
1725
|
+
seenParty.add(key);
|
|
1726
|
+
parties.push(addr);
|
|
1727
|
+
}
|
|
1728
|
+
try {
|
|
1729
|
+
const screens = await Promise.all(parties.map((address) => api.screenWallet(address, destination.chainId)));
|
|
1730
|
+
const blocked = screens.filter((screen) => screen.blocked);
|
|
1731
|
+
if (blocked.length) {
|
|
1732
|
+
const who = blocked.some((s) => s.address.toLowerCase() === payer.toLowerCase()) ? "your wallet" : "the recipient";
|
|
1733
|
+
const categories = [...new Set(blocked.flatMap((s) => s.blockingCategories ?? []))];
|
|
1734
|
+
throw apiError(
|
|
1735
|
+
`This payment was blocked by compliance screening \u2014 ${who} is ${blockLabelFor(categories)}. Choose a different recipient or connect a different wallet.`,
|
|
1736
|
+
{ blocked: true, blockedCategory: categories[0] || "COMPLIANCE", blockedReason: categories.join(", ") }
|
|
1737
|
+
);
|
|
1738
|
+
}
|
|
1739
|
+
directCompliance = directComplianceFromScreens(screens);
|
|
1740
|
+
} catch (error) {
|
|
1741
|
+
if (error?.blocked) throw error;
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
const candidates = directCompliance ? directOptions : [];
|
|
1369
1745
|
const heldOptions = options.filter((option) => !option.direct && hasPositiveBalance(option, walletBalances));
|
|
1370
1746
|
const heldKeys = new Set(heldOptions.map(optionBalanceKey));
|
|
1371
1747
|
const seenChains = /* @__PURE__ */ new Set();
|
|
@@ -1385,7 +1761,7 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1385
1761
|
}
|
|
1386
1762
|
const routeErrors = [];
|
|
1387
1763
|
const routePromises = candidates.map(
|
|
1388
|
-
(option) => buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote: api.fetchQuote }).catch((error) => {
|
|
1764
|
+
(option) => buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote: api.fetchQuote, compliance: option.direct ? directCompliance ?? void 0 : void 0 }).catch((error) => {
|
|
1389
1765
|
routeErrors.push(error);
|
|
1390
1766
|
return null;
|
|
1391
1767
|
})
|
|
@@ -2846,6 +3222,98 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
2846
3222
|
.sg-island .sg-spinner{display:none!important}
|
|
2847
3223
|
.sg-island .sg-rm-dot{display:inline-block}
|
|
2848
3224
|
}
|
|
3225
|
+
|
|
3226
|
+
/* \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
|
|
3227
|
+
Mirrors the dApp's compliance row + details dialog. The row is a quiet affordance in the payment
|
|
3228
|
+
summary; the details open a sheet that fills the widget's own card, because a page-level modal
|
|
3229
|
+
inside somebody else's checkout is a z-index fight we would lose.
|
|
3230
|
+
|
|
3231
|
+
Tone note, carried over from the dApp: a PASS reads in body ink, not in green. The shield tick is
|
|
3232
|
+
already green, so colouring the sentence too says the same thing twice and spends the accent on
|
|
3233
|
+
the half that carries no information. A DENY still shouts. */
|
|
3234
|
+
/* NOT positioned. The sheet is inset:0 against the WIDGET CARD, so this wrapper must not become
|
|
3235
|
+
the containing block: when it carried position:relative the sheet collapsed to the height of
|
|
3236
|
+
this one row and drew straight through the CTA beneath it.
|
|
3237
|
+
NB this stylesheet is a JS template literal - never write a backtick in these comments. */
|
|
3238
|
+
.sg-cp{margin-top:10px}
|
|
3239
|
+
.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}
|
|
3240
|
+
.sg-cp-row:hover{border-color:color-mix(in srgb,var(--sg-accent) 40%,var(--sg-border))}
|
|
3241
|
+
.sg-cp-row:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
|
|
3242
|
+
.sg-cp-row-main{display:flex;align-items:center;gap:8px;min-width:0}
|
|
3243
|
+
.sg-cp-row-glyph{display:flex;flex:0 0 auto;color:var(--sg-success)}
|
|
3244
|
+
.sg-cp-row[data-tone="neutral"] .sg-cp-row-glyph{color:var(--sg-text-muted);opacity:.55}
|
|
3245
|
+
.sg-cp-row[data-tone="blocked"] .sg-cp-row-glyph,.sg-cp-row[data-tone="warn"] .sg-cp-row-glyph{color:var(--sg-danger)}
|
|
3246
|
+
.sg-cp-row-label{font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3247
|
+
.sg-cp-row[data-tone="neutral"] .sg-cp-row-label{color:var(--sg-text-muted)}
|
|
3248
|
+
.sg-cp-row[data-tone="blocked"] .sg-cp-row-label,.sg-cp-row[data-tone="warn"] .sg-cp-row-label{color:var(--sg-danger)}
|
|
3249
|
+
.sg-cp-row-chev{display:flex;flex:0 0 auto;color:var(--sg-text-muted)}
|
|
3250
|
+
.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)}
|
|
3251
|
+
|
|
3252
|
+
/* the sheet \u2014 fills the widget card */
|
|
3253
|
+
.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}
|
|
3254
|
+
@keyframes sg-cp-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
|
|
3255
|
+
.sg-cp-sheet:focus{outline:none}
|
|
3256
|
+
.sg-cp-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:0 0 auto}
|
|
3257
|
+
.sg-cp-sheet-title{margin:0;font-size:15px;font-weight:600}
|
|
3258
|
+
.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}
|
|
3259
|
+
.sg-cp-close:hover{background:var(--sg-surface);color:var(--sg-text)}
|
|
3260
|
+
.sg-cp-close:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
|
|
3261
|
+
.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}
|
|
3262
|
+
.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}
|
|
3263
|
+
.sg-cp-tab[data-active="true"]{background:color-mix(in srgb,var(--sg-accent) 10%,transparent);color:var(--sg-accent)}
|
|
3264
|
+
.sg-cp-tab:focus-visible{outline:2px solid var(--sg-accent);outline-offset:-2px}
|
|
3265
|
+
.sg-cp-sheet-body{margin-top:10px}
|
|
3266
|
+
.sg-cp-tabpanel{display:flex;flex-direction:column;gap:8px}
|
|
3267
|
+
|
|
3268
|
+
/* cards */
|
|
3269
|
+
.sg-cp-card{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--sg-border);border-radius:16px}
|
|
3270
|
+
.sg-cp-card-head{display:flex;align-items:center;gap:8px}
|
|
3271
|
+
.sg-cp-card-glyph{display:flex;flex:0 0 auto;color:var(--sg-accent)}
|
|
3272
|
+
.sg-cp-card-title{margin:0;font-size:14px;font-weight:600}
|
|
3273
|
+
.sg-cp-summary{display:flex;flex-direction:column;gap:3px}
|
|
3274
|
+
.sg-cp-summary-head{display:flex;align-items:center;gap:8px;color:var(--sg-success)}
|
|
3275
|
+
.sg-cp-summary-head[data-tone="neutral"]{color:var(--sg-text-muted)}
|
|
3276
|
+
.sg-cp-summary-head[data-tone="blocked"],.sg-cp-summary-head[data-tone="warn"]{color:var(--sg-danger)}
|
|
3277
|
+
.sg-cp-summary-title{font-size:14px;font-weight:600;color:var(--sg-text)}
|
|
3278
|
+
.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)}
|
|
3279
|
+
.sg-cp-summary-sub{margin:0;padding-left:24px;font-size:12px;line-height:1.35;color:var(--sg-text-muted)}
|
|
3280
|
+
|
|
3281
|
+
/* per-control rows */
|
|
3282
|
+
.sg-cp-checks{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:11px}
|
|
3283
|
+
.sg-cp-check-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px}
|
|
3284
|
+
.sg-cp-check-label{display:flex;align-items:center;gap:8px;min-width:0;font-size:13.5px;line-height:1.25}
|
|
3285
|
+
.sg-cp-check[data-ok="false"] .sg-cp-check-label{color:var(--sg-danger)}
|
|
3286
|
+
.sg-cp-check-mark{display:flex;flex:0 0 auto;color:var(--sg-success)}
|
|
3287
|
+
.sg-cp-check-mark[data-ok="false"]{color:var(--sg-danger)}
|
|
3288
|
+
.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}
|
|
3289
|
+
.sg-cp-check-reason{color:var(--sg-danger)}
|
|
3290
|
+
.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}
|
|
3291
|
+
.sg-cp-link:hover{text-decoration:underline}
|
|
3292
|
+
.sg-cp-link:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px;border-radius:4px}
|
|
3293
|
+
.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)}
|
|
3294
|
+
.sg-cp-scope{margin:0;font-size:11.5px;line-height:1.45;color:var(--sg-text-muted)}
|
|
3295
|
+
.sg-cp-flags{margin:0;font-size:13px}
|
|
3296
|
+
|
|
3297
|
+
/* quote details */
|
|
3298
|
+
.sg-cp-facts{margin:0;display:flex;flex-direction:column;gap:9px}
|
|
3299
|
+
.sg-cp-fact{display:grid;grid-template-columns:78px minmax(0,1fr);align-items:center;gap:10px}
|
|
3300
|
+
.sg-cp-fact dt{font-size:12px;color:var(--sg-text-muted)}
|
|
3301
|
+
.sg-cp-fact dd{margin:0;font-size:13px;min-width:0;overflow-wrap:anywhere}
|
|
3302
|
+
|
|
3303
|
+
/* screening policy */
|
|
3304
|
+
.sg-cp-policy-head{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:8px;padding-bottom:2px}
|
|
3305
|
+
.sg-cp-policy-id{font-size:11px;color:var(--sg-text-muted);overflow-wrap:anywhere}
|
|
3306
|
+
.sg-cp-policy-facts{padding:2px 0 8px}
|
|
3307
|
+
.sg-cp-buckets{display:flex;flex-direction:column;gap:8px}
|
|
3308
|
+
.sg-cp-bucket{gap:10px;padding:12px 14px}
|
|
3309
|
+
.sg-cp-bucket-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 10px}
|
|
3310
|
+
.sg-cp-bucket-detail{font-size:11.5px;color:var(--sg-text-muted)}
|
|
3311
|
+
.sg-cp-cats{list-style:none;margin:0;padding:0 0 0 4px;display:flex;flex-direction:column;gap:5px}
|
|
3312
|
+
.sg-cp-cats li{display:flex;align-items:center;gap:10px;font-size:12.5px;line-height:1.35}
|
|
3313
|
+
.sg-cp-dot{flex:0 0 auto;width:4px;height:4px;border-radius:999px;background:var(--sg-accent);opacity:.8}
|
|
3314
|
+
|
|
3315
|
+
/* express (PaymentIsland) trims the card padding, so the sheet follows */
|
|
3316
|
+
@media (prefers-reduced-motion:reduce){.sg-cp-sheet{animation:none}}
|
|
2849
3317
|
`;
|
|
2850
3318
|
var injected = false;
|
|
2851
3319
|
function injectStyles() {
|
|
@@ -2999,7 +3467,7 @@ function WidgetShell(props) {
|
|
|
2999
3467
|
] })
|
|
3000
3468
|
] });
|
|
3001
3469
|
}
|
|
3002
|
-
function
|
|
3470
|
+
function shortAddress2(a) {
|
|
3003
3471
|
if (!a) return "";
|
|
3004
3472
|
return `${a.slice(0, 6)}\u2026${a.slice(-4)}`;
|
|
3005
3473
|
}
|
|
@@ -3211,6 +3679,251 @@ function RouteList(props) {
|
|
|
3211
3679
|
] }) : null
|
|
3212
3680
|
] });
|
|
3213
3681
|
}
|
|
3682
|
+
function ShieldTick({ size = 16 }) {
|
|
3683
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3684
|
+
/* @__PURE__ */ jsxRuntime.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" }),
|
|
3685
|
+
/* @__PURE__ */ jsxRuntime.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" }),
|
|
3686
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m8.6 11.9 2.3 2.3 4.5-4.5", stroke: "currentColor", strokeWidth: "1.9", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
3687
|
+
] });
|
|
3688
|
+
}
|
|
3689
|
+
function TickCircle({ size = 16 }) {
|
|
3690
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3691
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3692
|
+
/* @__PURE__ */ jsxRuntime.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" })
|
|
3693
|
+
] });
|
|
3694
|
+
}
|
|
3695
|
+
function CloseCircle({ size = 16 }) {
|
|
3696
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3697
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3698
|
+
/* @__PURE__ */ jsxRuntime.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" })
|
|
3699
|
+
] });
|
|
3700
|
+
}
|
|
3701
|
+
function PendingCircle({ size = 16 }) {
|
|
3702
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3703
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "9.2", stroke: "currentColor", strokeWidth: "1.6", strokeDasharray: "3 3" }),
|
|
3704
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 12h7", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
|
|
3705
|
+
] });
|
|
3706
|
+
}
|
|
3707
|
+
function Tick({ size = 12 }) {
|
|
3708
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m4.5 12.8 5 5L19.5 6.5", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3709
|
+
}
|
|
3710
|
+
function Cross({ size = 12 }) {
|
|
3711
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m5.5 5.5 13 13M18.5 5.5l-13 13", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round" }) });
|
|
3712
|
+
}
|
|
3713
|
+
function Chevron({ size = 16 }) {
|
|
3714
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m9 5 7 7-7 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3715
|
+
}
|
|
3716
|
+
function Info({ size = 16 }) {
|
|
3717
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3718
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3719
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 10.6v6", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round" }),
|
|
3720
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "7.6", r: "1.25", fill: "var(--sg-bg)" })
|
|
3721
|
+
] });
|
|
3722
|
+
}
|
|
3723
|
+
function Lock({ size = 16 }) {
|
|
3724
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3725
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "4.5", y: "10.5", width: "15", height: "9.5", rx: "2.2", stroke: "currentColor", strokeWidth: "1.7" }),
|
|
3726
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 10.5V7.8a4 4 0 0 1 8 0v2.7", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" })
|
|
3727
|
+
] });
|
|
3728
|
+
}
|
|
3729
|
+
function ShieldOutline({ size = 16 }) {
|
|
3730
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.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" }) });
|
|
3731
|
+
}
|
|
3732
|
+
function WarningFilled({ size = 16 }) {
|
|
3733
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3734
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 3.2 21.4 19.4H2.6L12 3.2Z", fill: "currentColor" }),
|
|
3735
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 9.4v4.3", stroke: "var(--sg-bg)", strokeWidth: "1.9", strokeLinecap: "round" }),
|
|
3736
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "16.4", r: "1.05", fill: "var(--sg-bg)" })
|
|
3737
|
+
] });
|
|
3738
|
+
}
|
|
3739
|
+
function CornerArrow({ size = 12 }) {
|
|
3740
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7 17 17 7M9 7h8v8", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3741
|
+
}
|
|
3742
|
+
var POLICY_GLYPH = {
|
|
3743
|
+
"always-blocked": Lock,
|
|
3744
|
+
blocked: ShieldOutline,
|
|
3745
|
+
flagged: WarningFilled
|
|
3746
|
+
};
|
|
3747
|
+
var POLICY_DETAIL = {
|
|
3748
|
+
"always-blocked": "Cannot be changed or disabled",
|
|
3749
|
+
blocked: "Stops the payment",
|
|
3750
|
+
flagged: "Does not automatically block"
|
|
3751
|
+
};
|
|
3752
|
+
function shortAddr(a) {
|
|
3753
|
+
return a.length > 14 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
|
|
3754
|
+
}
|
|
3755
|
+
function TriggerGlyph({ cv }) {
|
|
3756
|
+
if (cv.tone === "blocked" || cv.tone === "warn") return /* @__PURE__ */ jsxRuntime.jsx(CloseCircle, {});
|
|
3757
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ShieldTick, {});
|
|
3758
|
+
}
|
|
3759
|
+
function CheckRow({ check, onViewPolicy }) {
|
|
3760
|
+
const label = check.id === "risk" ? check.ok ? "Risk screening passed" : "Risk screening failed" : check.label;
|
|
3761
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "sg-cp-check", "data-ok": check.ok, children: [
|
|
3762
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-check-head", children: [
|
|
3763
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-check-label", children: [
|
|
3764
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-mark", "data-ok": check.ok, children: check.ok ? /* @__PURE__ */ jsxRuntime.jsx(Tick, {}) : /* @__PURE__ */ jsxRuntime.jsx(Cross, {}) }),
|
|
3765
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
|
|
3766
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sr-only", children: check.ok ? " \u2014 passed" : " \u2014 failed" })
|
|
3767
|
+
] }),
|
|
3768
|
+
check.id === "risk" ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-cp-link", onClick: onViewPolicy, children: [
|
|
3769
|
+
"View policy",
|
|
3770
|
+
/* @__PURE__ */ jsxRuntime.jsx(CornerArrow, {})
|
|
3771
|
+
] }) : null
|
|
3772
|
+
] }),
|
|
3773
|
+
check.note ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-note", children: check.note }) : null,
|
|
3774
|
+
check.reasons.map((reason) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-reason", children: humanizeComplianceReason(reason) }, reason))
|
|
3775
|
+
] });
|
|
3776
|
+
}
|
|
3777
|
+
function QuoteChecks({
|
|
3778
|
+
compliance,
|
|
3779
|
+
cv,
|
|
3780
|
+
checks,
|
|
3781
|
+
direct,
|
|
3782
|
+
onViewPolicy
|
|
3783
|
+
}) {
|
|
3784
|
+
const allPassed = cv.tone === "ok" && checks.length > 0 && checks.every((c) => c.ok);
|
|
3785
|
+
const summary = allPassed ? "All checks passed" : cv.label;
|
|
3786
|
+
const orphans = unattributedComplianceReasons(compliance, cv);
|
|
3787
|
+
const wallets = distinctScreenedWallets(compliance);
|
|
3788
|
+
const jurisdiction = compliance?.sourceJurisdiction?.trim();
|
|
3789
|
+
const hasDetails = Boolean(jurisdiction || wallets.length || compliance?.checkId);
|
|
3790
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Quote checks", children: [
|
|
3791
|
+
/* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
3792
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-summary", children: [
|
|
3793
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-summary-head", "data-tone": cv.tone, children: [
|
|
3794
|
+
cv.tone === "blocked" || cv.tone === "warn" ? /* @__PURE__ */ jsxRuntime.jsx(CloseCircle, {}) : cv.tone === "neutral" ? /* @__PURE__ */ jsxRuntime.jsx(PendingCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(TickCircle, {}),
|
|
3795
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-summary-title", children: summary })
|
|
3796
|
+
] }),
|
|
3797
|
+
checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-cp-summary-sub", children: [
|
|
3798
|
+
checks.length,
|
|
3799
|
+
" check",
|
|
3800
|
+
checks.length === 1 ? " was" : "s were",
|
|
3801
|
+
" completed for this payment"
|
|
3802
|
+
] }) : (
|
|
3803
|
+
// No decision was issued. Listing the controls here would be ticks for a verdict nobody
|
|
3804
|
+
// gave, and an unconfigured gate is not a set of passed checks.
|
|
3805
|
+
/* @__PURE__ */ jsxRuntime.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." })
|
|
3806
|
+
)
|
|
3807
|
+
] }),
|
|
3808
|
+
checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-checks", children: checks.map((check) => /* @__PURE__ */ jsxRuntime.jsx(CheckRow, { check, onViewPolicy }, check.id)) }) : null,
|
|
3809
|
+
orphans.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-orphans", children: orphans.map((reason) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: humanizeComplianceReason(reason) }, reason)) }) : null,
|
|
3810
|
+
direct && checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-scope", children: DIRECT_SCOPE_NOTE }) : null
|
|
3811
|
+
] }),
|
|
3812
|
+
compliance?.flaggedCategories?.length ? /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
3813
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-card-head", children: [
|
|
3814
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(WarningFilled, {}) }),
|
|
3815
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: "Flagged, not blocking" })
|
|
3816
|
+
] }),
|
|
3817
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-flags", children: compliance.flaggedCategories.map(categoryLabel).join(" \xB7 ") }),
|
|
3818
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-scope", children: "The policy records these and still allows the payment. They do not stop settlement." })
|
|
3819
|
+
] }) : null,
|
|
3820
|
+
hasDetails ? /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
3821
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-card-head", children: [
|
|
3822
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(Info, {}) }),
|
|
3823
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: "Quote details" })
|
|
3824
|
+
] }),
|
|
3825
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "sg-cp-facts", children: [
|
|
3826
|
+
jurisdiction ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Jurisdiction", value: jurisdiction }) : null,
|
|
3827
|
+
wallets.map((w, i) => /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: wallets.length > 1 ? i === 0 ? "Payer" : "Recipient" : "Wallet", value: shortAddr(w), title: w, mono: true }, w)),
|
|
3828
|
+
compliance?.checkId ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Check ID", value: compliance.checkId, mono: true }) : null
|
|
3829
|
+
] })
|
|
3830
|
+
] }) : null
|
|
3831
|
+
] });
|
|
3832
|
+
}
|
|
3833
|
+
function Fact({ label, value, title, mono = false }) {
|
|
3834
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-fact", children: [
|
|
3835
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { children: label }),
|
|
3836
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { title, className: mono ? "sg-mono" : void 0, children: value })
|
|
3837
|
+
] });
|
|
3838
|
+
}
|
|
3839
|
+
function ScreeningPolicy({ compliance }) {
|
|
3840
|
+
const policyId = compliance?.policyVersion?.trim();
|
|
3841
|
+
const applied = Boolean(compliance?.decision || policyId || compliance?.appliedPolicyNames?.length);
|
|
3842
|
+
const names = [...compliance?.appliedPolicyNames ?? [], ...compliance?.appliedLegislation ?? []];
|
|
3843
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Screening policy", children: [
|
|
3844
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-policy-head", children: [
|
|
3845
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-summary", children: [
|
|
3846
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-summary-head", "data-tone": applied ? "ok" : "neutral", children: [
|
|
3847
|
+
applied ? /* @__PURE__ */ jsxRuntime.jsx(TickCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(PendingCircle, {}),
|
|
3848
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-summary-title", children: "Transaction screening policy" })
|
|
3849
|
+
] }),
|
|
3850
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-summary-sub", children: applied ? "Applied to this payment" : "No policy decision was returned" })
|
|
3851
|
+
] }),
|
|
3852
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-policy-id sg-mono", children: policyId ? `Policy ${policyId}` : "Policy ID unavailable" })
|
|
3853
|
+
] }),
|
|
3854
|
+
names.length ? /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "sg-cp-facts sg-cp-policy-facts", children: [
|
|
3855
|
+
compliance?.appliedPolicyNames?.length ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Policy", value: compliance.appliedPolicyNames.join(", ") }) : null,
|
|
3856
|
+
compliance?.appliedLegislation?.length ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Legislation", value: compliance.appliedLegislation.join(", ") }) : null
|
|
3857
|
+
] }) : null,
|
|
3858
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cp-buckets", children: SCREENING_BUCKETS.map((bucket) => {
|
|
3859
|
+
const Glyph = POLICY_GLYPH[bucket.outcome];
|
|
3860
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card sg-cp-bucket", children: [
|
|
3861
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-bucket-head", children: [
|
|
3862
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-card-head", children: [
|
|
3863
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(Glyph, {}) }),
|
|
3864
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: bucket.title })
|
|
3865
|
+
] }),
|
|
3866
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-bucket-detail", children: POLICY_DETAIL[bucket.outcome] })
|
|
3867
|
+
] }),
|
|
3868
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-cats", children: bucket.categories.map((category) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
3869
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-dot", "aria-hidden": "true" }),
|
|
3870
|
+
category
|
|
3871
|
+
] }, category)) })
|
|
3872
|
+
] }, bucket.outcome);
|
|
3873
|
+
}) })
|
|
3874
|
+
] });
|
|
3875
|
+
}
|
|
3876
|
+
function CompliancePanel(props) {
|
|
3877
|
+
const [open, setOpen] = react.useState(false);
|
|
3878
|
+
const [tab, setTab] = react.useState("checks");
|
|
3879
|
+
const triggerRef = react.useRef(null);
|
|
3880
|
+
const sheetRef = react.useRef(null);
|
|
3881
|
+
const compliance = props.compliance ?? null;
|
|
3882
|
+
const cv = complianceView(compliance, props.hasQuote ?? true);
|
|
3883
|
+
const allChecks = complianceChecks(compliance, cv);
|
|
3884
|
+
const checks = props.direct ? allChecks.filter((c) => DIRECT_CHECK_IDS.includes(c.id)) : allChecks;
|
|
3885
|
+
const tag = complianceTagOf(compliance);
|
|
3886
|
+
react.useEffect(() => {
|
|
3887
|
+
if (!open) return;
|
|
3888
|
+
sheetRef.current?.focus();
|
|
3889
|
+
const onKey = (e) => {
|
|
3890
|
+
if (e.key === "Escape") {
|
|
3891
|
+
e.stopPropagation();
|
|
3892
|
+
setOpen(false);
|
|
3893
|
+
triggerRef.current?.focus();
|
|
3894
|
+
}
|
|
3895
|
+
};
|
|
3896
|
+
document.addEventListener("keydown", onKey, true);
|
|
3897
|
+
return () => document.removeEventListener("keydown", onKey, true);
|
|
3898
|
+
}, [open]);
|
|
3899
|
+
const close = () => {
|
|
3900
|
+
setOpen(false);
|
|
3901
|
+
triggerRef.current?.focus();
|
|
3902
|
+
};
|
|
3903
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp", "data-tone": cv.tone, children: [
|
|
3904
|
+
open ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3905
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { ref: triggerRef, type: "button", className: "sg-cp-row", "data-tone": cv.tone, onClick: () => setOpen(true), "aria-haspopup": "dialog", children: [
|
|
3906
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-row-main", children: [
|
|
3907
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(TriggerGlyph, { cv }) }),
|
|
3908
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-label", children: cv.label })
|
|
3909
|
+
] }),
|
|
3910
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-chev", children: /* @__PURE__ */ jsxRuntime.jsx(Chevron, {}) })
|
|
3911
|
+
] }),
|
|
3912
|
+
(cv.blocked || cv.needsAction) && tag ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-tag sg-mono", children: tag }) : null
|
|
3913
|
+
] }),
|
|
3914
|
+
open ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet", role: "dialog", "aria-modal": "true", "aria-label": "Compliance details", ref: sheetRef, tabIndex: -1, children: [
|
|
3915
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet-head", children: [
|
|
3916
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "sg-cp-sheet-title", children: "Compliance details" }),
|
|
3917
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-cp-close", onClick: close, "aria-label": "Close compliance details", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 6 12 12M18 6 6 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
|
|
3918
|
+
] }),
|
|
3919
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabs", role: "tablist", "aria-label": "Compliance details sections", children: [
|
|
3920
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", role: "tab", "aria-selected": tab === "checks", "data-active": tab === "checks", className: "sg-cp-tab", onClick: () => setTab("checks"), children: "Quote checks" }),
|
|
3921
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", role: "tab", "aria-selected": tab === "policy", "data-active": tab === "policy", className: "sg-cp-tab", onClick: () => setTab("policy"), children: "Screening policy" })
|
|
3922
|
+
] }),
|
|
3923
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cp-sheet-body", children: tab === "checks" ? /* @__PURE__ */ jsxRuntime.jsx(QuoteChecks, { compliance, cv, checks, direct: !!props.direct, onViewPolicy: () => setTab("policy") }) : /* @__PURE__ */ jsxRuntime.jsx(ScreeningPolicy, { compliance }) })
|
|
3924
|
+
] }) : null
|
|
3925
|
+
] });
|
|
3926
|
+
}
|
|
3214
3927
|
|
|
3215
3928
|
// src/react/ui/chain-logos.ts
|
|
3216
3929
|
var BUNDLED_CHAIN_LOGO = {
|
|
@@ -3577,7 +4290,7 @@ function TxDetail(props) {
|
|
|
3577
4290
|
] }),
|
|
3578
4291
|
e.recipient ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3579
4292
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Recipient" }),
|
|
3580
|
-
/* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", children:
|
|
4293
|
+
/* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", children: shortAddress2(e.recipient) })
|
|
3581
4294
|
] }) : null,
|
|
3582
4295
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3583
4296
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Settlement" }),
|
|
@@ -3891,7 +4604,7 @@ function IdentityLine(props) {
|
|
|
3891
4604
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-link-id", children: [
|
|
3892
4605
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-icon", children: /* @__PURE__ */ jsxRuntime.jsx(WalletGlyph, {}) }),
|
|
3893
4606
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-link-id-text", children: [
|
|
3894
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-primary", children: props.account ?
|
|
4607
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-primary", children: props.account ? shortAddress2(props.account) : "ZeroDelta Link" }),
|
|
3895
4608
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-secondary", children: props.email ? props.email : props.account ? "Connected wallet" : "Connect your wallet to continue" })
|
|
3896
4609
|
] }),
|
|
3897
4610
|
props.account ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }) : null
|
|
@@ -4396,7 +5109,7 @@ function PaymentIsland(props) {
|
|
|
4396
5109
|
] }),
|
|
4397
5110
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-receipt-sub", children: [
|
|
4398
5111
|
confirmed ? "Confirmed on-chain" : "Confirmation pending",
|
|
4399
|
-
isPay && props.recipient ? ` \xB7 ${
|
|
5112
|
+
isPay && props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
4400
5113
|
] })
|
|
4401
5114
|
] }),
|
|
4402
5115
|
!identityMatchesWallet ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-remember", children: [
|
|
@@ -4508,6 +5221,7 @@ function PaymentIsland(props) {
|
|
|
4508
5221
|
chainName(sel.source.chainId)
|
|
4509
5222
|
] })
|
|
4510
5223
|
] }) : null,
|
|
5224
|
+
sel && !loading && !quoteError ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
|
|
4511
5225
|
quoteError ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error || "Couldn't get a price right now." }) : null,
|
|
4512
5226
|
walletError ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error || "The wallet could not complete this payment." }) : null,
|
|
4513
5227
|
submitting || walletError ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { variant: "rich", steps: flow.steps, verdict: flow.verdict }) : null,
|
|
@@ -4801,7 +5515,7 @@ function StableGeniePay(props) {
|
|
|
4801
5515
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
4802
5516
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
4803
5517
|
" \xB7 ",
|
|
4804
|
-
|
|
5518
|
+
shortAddress2(props.recipient)
|
|
4805
5519
|
] })
|
|
4806
5520
|
] }),
|
|
4807
5521
|
lastTxOwned ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
|
|
@@ -4844,6 +5558,7 @@ function StableGeniePay(props) {
|
|
|
4844
5558
|
scannedEmpty ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-note", children: "None of your balances can cover this yet \u2014 pick a different asset to fund with." }) : null,
|
|
4845
5559
|
flow.status === "ready" && !visibleRoutes.length ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { children: "No funding route matches the accepted assets for this payment." }) : null
|
|
4846
5560
|
] }),
|
|
5561
|
+
sel && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
|
|
4847
5562
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4848
5563
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4849
5564
|
Button,
|
|
@@ -4961,7 +5676,7 @@ function StableGenieSwap(props) {
|
|
|
4961
5676
|
] }),
|
|
4962
5677
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
4963
5678
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
4964
|
-
props.recipient ? ` \xB7 ${
|
|
5679
|
+
props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
4965
5680
|
] })
|
|
4966
5681
|
] }),
|
|
4967
5682
|
lastTxOwned ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
|
|
@@ -4987,6 +5702,7 @@ function StableGenieSwap(props) {
|
|
|
4987
5702
|
] }),
|
|
4988
5703
|
flow.status === "error" && flow.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error }) : null,
|
|
4989
5704
|
flow.routes.length ? /* @__PURE__ */ jsxRuntime.jsx(RouteList, { routes: flow.routes, selectedId: flow.selected?.id ?? null, onSelect: flow.selectRoute }) : null,
|
|
5705
|
+
flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
|
|
4990
5706
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4991
5707
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
4992
5708
|
!wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: wallet.connect, busy: wallet.connecting, children: "Connect wallet" }) : /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: flow.submit, busy: submitting, disabled: !flow.selected || flow.insufficient || !!flow.nativeShortfall || !enabled || flow.status === "loading", children: swapLabel }),
|
|
@@ -5185,7 +5901,7 @@ function StableGenieExchange(props) {
|
|
|
5185
5901
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-wallet", "data-connected": connected || void 0, onClick: connected ? void 0 : wallet.connect, disabled: wallet.connecting, children: connected ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5186
5902
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
|
|
5187
5903
|
" ",
|
|
5188
|
-
|
|
5904
|
+
shortAddress2(wallet.account)
|
|
5189
5905
|
] }) : wallet.connecting ? "Connecting\u2026" : "Connect wallet" })
|
|
5190
5906
|
] });
|
|
5191
5907
|
const fromTileRef = react.useRef(null);
|
|
@@ -5227,7 +5943,7 @@ function StableGenieExchange(props) {
|
|
|
5227
5943
|
] }),
|
|
5228
5944
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
5229
5945
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
5230
|
-
props.recipient ? ` \xB7 ${
|
|
5946
|
+
props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
5231
5947
|
] })
|
|
5232
5948
|
] }),
|
|
5233
5949
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
@@ -5274,6 +5990,7 @@ function StableGenieExchange(props) {
|
|
|
5274
5990
|
meta.duration ? ` \xB7 ~${meta.duration}s` : ""
|
|
5275
5991
|
] }) : null
|
|
5276
5992
|
] }) : null,
|
|
5993
|
+
connected && flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
|
|
5277
5994
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
5278
5995
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
5279
5996
|
!connected && !rampMode ? /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: wallet.connect, busy: wallet.connecting, children: "Connect wallet" }) : /* @__PURE__ */ jsxRuntime.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 }),
|