@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/index.cjs
CHANGED
|
@@ -39,6 +39,7 @@ var TRADEABLE_RWA_ASSETS = /* @__PURE__ */ new Set([
|
|
|
39
39
|
]);
|
|
40
40
|
var SUPPORTED_ASSETS = /* @__PURE__ */ new Set([...STABLE_ASSETS, ...TRADEABLE_RWA_ASSETS]);
|
|
41
41
|
var API_CACHE_TTL_MS = 6e4;
|
|
42
|
+
var SCREEN_CACHE_TTL_MS = 5 * 6e4;
|
|
42
43
|
var MAX_QUOTE_CANDIDATES = 8;
|
|
43
44
|
var QUOTE_BUFFER_BPS = 50;
|
|
44
45
|
var LZ_FEE_BUFFER_BPS = 1500n;
|
|
@@ -761,6 +762,338 @@ function brokenLaneReason(lane) {
|
|
|
761
762
|
}
|
|
762
763
|
}
|
|
763
764
|
|
|
765
|
+
// src/core/compliance.ts
|
|
766
|
+
var COMPLIANCE_DENY_LABEL = "Compliance check failed";
|
|
767
|
+
function complianceView(compliance, hasQuote = true) {
|
|
768
|
+
if (!hasQuote) {
|
|
769
|
+
return {
|
|
770
|
+
tone: "neutral",
|
|
771
|
+
label: "Compliance checks run with your quote",
|
|
772
|
+
headline: "No compliance decision for this payment yet",
|
|
773
|
+
blocked: false,
|
|
774
|
+
needsAction: false,
|
|
775
|
+
screened: false
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
const decision = compliance?.decision;
|
|
779
|
+
const screened = compliance?.status === "SCREENED";
|
|
780
|
+
if (decision === "DENY") {
|
|
781
|
+
return {
|
|
782
|
+
tone: "blocked",
|
|
783
|
+
label: COMPLIANCE_DENY_LABEL,
|
|
784
|
+
headline: "Blocked by compliance policy",
|
|
785
|
+
blocked: true,
|
|
786
|
+
needsAction: false,
|
|
787
|
+
screened
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
if (decision === "REVIEW" || decision === "REMEDIATE") {
|
|
791
|
+
const word = decision.toLowerCase();
|
|
792
|
+
return {
|
|
793
|
+
tone: "warn",
|
|
794
|
+
label: `Compliance: ${word} required`,
|
|
795
|
+
headline: `Manual ${word} required`,
|
|
796
|
+
blocked: false,
|
|
797
|
+
needsAction: true,
|
|
798
|
+
screened
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
if (decision === "ALLOW") {
|
|
802
|
+
return {
|
|
803
|
+
tone: "ok",
|
|
804
|
+
label: screened ? "Compliance checks passed" : "Allowed \u2014 wallets not screened",
|
|
805
|
+
headline: screened ? "Wallets screened and allowed" : "Allowed \u2014 wallets not screened",
|
|
806
|
+
blocked: false,
|
|
807
|
+
needsAction: false,
|
|
808
|
+
screened
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
return {
|
|
812
|
+
tone: "neutral",
|
|
813
|
+
label: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
|
|
814
|
+
headline: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
|
|
815
|
+
blocked: false,
|
|
816
|
+
needsAction: false,
|
|
817
|
+
screened
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
var CATEGORY_PHRASES = {
|
|
821
|
+
SANCTIONS: "sanctions",
|
|
822
|
+
TERRORISM_FINANCING: "terrorism financing",
|
|
823
|
+
STOLEN_FUNDS: "stolen funds",
|
|
824
|
+
RANSOMWARE: "ransomware",
|
|
825
|
+
SCAM: "scam activity",
|
|
826
|
+
DARKNET: "darknet activity",
|
|
827
|
+
MIXER: "mixer usage",
|
|
828
|
+
HIGH_RISK_ENTITY: "a high-risk entity",
|
|
829
|
+
PEP: "a politically-exposed person",
|
|
830
|
+
INDIRECT_EXPOSURE: "indirect exposure",
|
|
831
|
+
UNCLASSIFIED: "an unrecognized risk",
|
|
832
|
+
UNKNOWN: "an unrecognized risk"
|
|
833
|
+
};
|
|
834
|
+
function categoryLabel(code) {
|
|
835
|
+
const key = code.trim().toUpperCase();
|
|
836
|
+
const LABELS = {
|
|
837
|
+
SANCTIONS: "Sanctions",
|
|
838
|
+
TERRORISM_FINANCING: "Terrorist financing",
|
|
839
|
+
STOLEN_FUNDS: "Stolen funds",
|
|
840
|
+
RANSOMWARE: "Ransomware",
|
|
841
|
+
SCAM: "Scam",
|
|
842
|
+
DARKNET: "Darknet services",
|
|
843
|
+
MIXER: "Mixer",
|
|
844
|
+
HIGH_RISK_ENTITY: "High-risk entity",
|
|
845
|
+
PEP: "Politically exposed person (PEP)",
|
|
846
|
+
INDIRECT_EXPOSURE: "Indirect exposure",
|
|
847
|
+
UNCLASSIFIED: "Unclassified risk",
|
|
848
|
+
UNKNOWN: "Unclassified risk"
|
|
849
|
+
};
|
|
850
|
+
return LABELS[key] ?? key.toLowerCase().replace(/_/g, " ");
|
|
851
|
+
}
|
|
852
|
+
function cleanJurisdiction(code) {
|
|
853
|
+
return code.replace(/^(OFAC|TIER\d+|SANCTIONED)_/i, "").trim();
|
|
854
|
+
}
|
|
855
|
+
function stripBundlePrefix(head) {
|
|
856
|
+
if (head.startsWith("policy_")) return { head: head.slice("policy_".length), source: "policy" };
|
|
857
|
+
if (head.startsWith("legislation_")) return { head: head.slice("legislation_".length), source: "legislation" };
|
|
858
|
+
return { head, source: null };
|
|
859
|
+
}
|
|
860
|
+
function complianceReasonHead(raw) {
|
|
861
|
+
return stripBundlePrefix((raw.split(":")[0] ?? "").trim()).head;
|
|
862
|
+
}
|
|
863
|
+
function usd(raw) {
|
|
864
|
+
const n = Number(raw);
|
|
865
|
+
if (!Number.isFinite(n)) return `$${raw}`;
|
|
866
|
+
return `$${n.toLocaleString("en-US", { maximumFractionDigits: 2 })}`;
|
|
867
|
+
}
|
|
868
|
+
function capFromDetail(detail) {
|
|
869
|
+
const m = detail.match(/>([\d.]+)/);
|
|
870
|
+
return m ? ` (${usd(m[1])})` : "";
|
|
871
|
+
}
|
|
872
|
+
function categoryPhrase(detail) {
|
|
873
|
+
const cat = detail.replace(/\s*\(.*\)$/, "").toUpperCase();
|
|
874
|
+
return CATEGORY_PHRASES[cat] ?? cat.toLowerCase().replace(/_/g, " ");
|
|
875
|
+
}
|
|
876
|
+
function humanizeComplianceReason(raw) {
|
|
877
|
+
const [headRaw, ...restParts] = raw.split(":");
|
|
878
|
+
const detail = restParts.join(":").trim();
|
|
879
|
+
const { head, source } = stripBundlePrefix((headRaw ?? "").trim());
|
|
880
|
+
const scope = source === "legislation" ? "applicable regulations" : "the applicable policy";
|
|
881
|
+
switch (head) {
|
|
882
|
+
case "asset_pair_not_allowed": {
|
|
883
|
+
const m = detail.match(/^(\S+)->(\S+)\s+in\s+(\S+)/);
|
|
884
|
+
if (m) return `${m[1]} \u2192 ${m[2]} isn't available in your region (${cleanJurisdiction(m[3])}).`;
|
|
885
|
+
return "This asset pair isn't available in your region.";
|
|
886
|
+
}
|
|
887
|
+
case "asset_not_allowed": {
|
|
888
|
+
const m = detail.match(/^(\S+?)->(\S+?)(?::|$)/);
|
|
889
|
+
if (m) return `${m[1]} \u2192 ${m[2]} isn't permitted under ${scope}.`;
|
|
890
|
+
return `This asset pair isn't permitted under ${scope}.`;
|
|
891
|
+
}
|
|
892
|
+
case "blocked_jurisdiction":
|
|
893
|
+
return `Your region (${cleanJurisdiction(detail)}) isn't supported.`;
|
|
894
|
+
case "blocked_destination_jurisdiction":
|
|
895
|
+
return `The destination region (${cleanJurisdiction(detail)}) isn't supported.`;
|
|
896
|
+
case "jurisdiction_out_of_scope":
|
|
897
|
+
return `Not covered by ${scope}.`;
|
|
898
|
+
case "ui_block":
|
|
899
|
+
return `Payments aren't available in your region (${cleanJurisdiction(detail)}).`;
|
|
900
|
+
case "blocked_corridor_mode":
|
|
901
|
+
return "This route isn't currently open for payments.";
|
|
902
|
+
case "blocked_category":
|
|
903
|
+
return `Flagged for ${categoryPhrase(detail)}.`;
|
|
904
|
+
case "amount_exceeds_max_order_usd":
|
|
905
|
+
case "amount_exceeds_max":
|
|
906
|
+
return `Amount exceeds the maximum order size${capFromDetail(detail)}.`;
|
|
907
|
+
case "amount_exceeds_actor_cap":
|
|
908
|
+
return `Amount exceeds the limit for your account type${capFromDetail(detail)}.`;
|
|
909
|
+
case "amount_exceeds_jurisdiction_max":
|
|
910
|
+
return `Amount exceeds the limit for your region${capFromDetail(detail)}.`;
|
|
911
|
+
case "source_chain_not_allowed":
|
|
912
|
+
return `The source chain isn't permitted under ${scope}.`;
|
|
913
|
+
case "dest_chain_not_allowed":
|
|
914
|
+
return `The destination chain isn't permitted under ${scope}.`;
|
|
915
|
+
default:
|
|
916
|
+
return detail ? `${head.replace(/_/g, " ")} \u2014 ${detail}` : head.replace(/_/g, " ");
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
var COMPLIANCE_CHECK_ORDER = [
|
|
920
|
+
"location",
|
|
921
|
+
"screening",
|
|
922
|
+
"risk",
|
|
923
|
+
"asset",
|
|
924
|
+
"limits"
|
|
925
|
+
];
|
|
926
|
+
var CHECK_LABELS = {
|
|
927
|
+
location: "Location and corridor permitted",
|
|
928
|
+
screening: "Both wallets screened",
|
|
929
|
+
risk: "Risk policy passed",
|
|
930
|
+
asset: "Asset and amount allowed",
|
|
931
|
+
limits: "Transaction limits verified"
|
|
932
|
+
};
|
|
933
|
+
var CHECK_HEADS = {
|
|
934
|
+
location: [
|
|
935
|
+
"blocked_jurisdiction",
|
|
936
|
+
"blocked_destination_jurisdiction",
|
|
937
|
+
"ui_block",
|
|
938
|
+
"blocked_corridor_mode",
|
|
939
|
+
"jurisdiction_out_of_scope"
|
|
940
|
+
],
|
|
941
|
+
screening: [],
|
|
942
|
+
risk: ["blocked_category"],
|
|
943
|
+
asset: ["asset_pair_not_allowed", "asset_not_allowed", "source_chain_not_allowed", "dest_chain_not_allowed"],
|
|
944
|
+
limits: [
|
|
945
|
+
"amount_exceeds_max_order_usd",
|
|
946
|
+
"amount_exceeds_max",
|
|
947
|
+
"amount_exceeds_actor_cap",
|
|
948
|
+
"amount_exceeds_jurisdiction_max"
|
|
949
|
+
]
|
|
950
|
+
};
|
|
951
|
+
function distinctScreenedWallets(compliance) {
|
|
952
|
+
const seen = /* @__PURE__ */ new Set();
|
|
953
|
+
const wallets = [];
|
|
954
|
+
for (const raw of compliance?.screenedWallets ?? []) {
|
|
955
|
+
const address = raw?.trim();
|
|
956
|
+
if (!address) continue;
|
|
957
|
+
const key = /^0x[0-9a-fA-F]+$/.test(address) ? address.toLowerCase() : address;
|
|
958
|
+
if (seen.has(key)) continue;
|
|
959
|
+
seen.add(key);
|
|
960
|
+
wallets.push(address);
|
|
961
|
+
}
|
|
962
|
+
return wallets;
|
|
963
|
+
}
|
|
964
|
+
function shortAddress(a) {
|
|
965
|
+
return a.length > 12 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
|
|
966
|
+
}
|
|
967
|
+
function screeningLabel(wallets) {
|
|
968
|
+
if (wallets === 1) return "Wallet screened";
|
|
969
|
+
if (wallets === 2) return CHECK_LABELS.screening;
|
|
970
|
+
return "Wallets screened";
|
|
971
|
+
}
|
|
972
|
+
function complianceChecks(compliance, cv = complianceView(compliance)) {
|
|
973
|
+
if (cv.tone === "neutral") return [];
|
|
974
|
+
const byControl = /* @__PURE__ */ new Map();
|
|
975
|
+
for (const raw of compliance?.reasons ?? []) {
|
|
976
|
+
const head = complianceReasonHead(raw);
|
|
977
|
+
const id = COMPLIANCE_CHECK_ORDER.find((c) => CHECK_HEADS[c].includes(head));
|
|
978
|
+
if (!id) continue;
|
|
979
|
+
byControl.set(id, [...byControl.get(id) ?? [], raw]);
|
|
980
|
+
}
|
|
981
|
+
const screenedWallets = distinctScreenedWallets(compliance);
|
|
982
|
+
const wallets = screenedWallets.length;
|
|
983
|
+
const blocking = compliance?.blockingCategories?.length ?? 0;
|
|
984
|
+
return COMPLIANCE_CHECK_ORDER.map((id) => {
|
|
985
|
+
if (id === "screening") {
|
|
986
|
+
const ok2 = cv.screened || wallets > 0;
|
|
987
|
+
const note = wallets === 1 ? shortAddress(screenedWallets[0]) : wallets > 1 ? `${wallets} wallets screened` : void 0;
|
|
988
|
+
return { id, label: ok2 ? screeningLabel(wallets) : "Wallets not screened", ok: ok2, reasons: [], note };
|
|
989
|
+
}
|
|
990
|
+
const reasons = byControl.get(id) ?? [];
|
|
991
|
+
const ok = reasons.length === 0 && !(id === "risk" && blocking > 0);
|
|
992
|
+
return { id, label: CHECK_LABELS[id], ok, reasons };
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
function unattributedComplianceReasons(compliance, cv = complianceView(compliance)) {
|
|
996
|
+
const claimed = new Set(complianceChecks(compliance, cv).flatMap((c) => c.reasons));
|
|
997
|
+
return (compliance?.reasons ?? []).filter((r) => !claimed.has(r));
|
|
998
|
+
}
|
|
999
|
+
function complianceControlsEvaluated(compliance, cv = complianceView(compliance)) {
|
|
1000
|
+
const checks = complianceChecks(compliance, cv);
|
|
1001
|
+
if (checks.length === 0) return 0;
|
|
1002
|
+
const named = /* @__PURE__ */ new Set();
|
|
1003
|
+
for (const raw of [...compliance?.appliedPolicyNames ?? [], ...compliance?.appliedLegislation ?? []]) {
|
|
1004
|
+
const name = raw?.trim();
|
|
1005
|
+
if (name) named.add(name.toLowerCase());
|
|
1006
|
+
}
|
|
1007
|
+
return checks.length + named.size;
|
|
1008
|
+
}
|
|
1009
|
+
function complianceControlsLine(compliance, cv = complianceView(compliance)) {
|
|
1010
|
+
if (cv.blocked || cv.needsAction) return cv.headline;
|
|
1011
|
+
const n = complianceControlsEvaluated(compliance, cv);
|
|
1012
|
+
if (n === 0) return cv.headline;
|
|
1013
|
+
return `${n} compliance control${n === 1 ? "" : "s"} evaluated for this payment`;
|
|
1014
|
+
}
|
|
1015
|
+
function directComplianceFromScreens(screens) {
|
|
1016
|
+
const blockedAny = screens.some((s) => s.blocked);
|
|
1017
|
+
const cats = (pick) => [
|
|
1018
|
+
...new Set(screens.flatMap((s) => pick(s) ?? []))
|
|
1019
|
+
];
|
|
1020
|
+
return {
|
|
1021
|
+
status: "SCREENED",
|
|
1022
|
+
decision: blockedAny ? "DENY" : "ALLOW",
|
|
1023
|
+
screenedWallets: screens.map((s) => s.address),
|
|
1024
|
+
riskCategories: cats((s) => s.riskCategories),
|
|
1025
|
+
flaggedCategories: cats((s) => s.flaggedCategories),
|
|
1026
|
+
blockingCategories: cats((s) => s.blockingCategories),
|
|
1027
|
+
reasons: blockedAny ? cats((s) => s.blockingCategories).map((c) => `blocked_category:${c}`) : []
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
var DIRECT_CHECK_IDS = ["screening", "risk"];
|
|
1031
|
+
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.";
|
|
1032
|
+
var BLOCK_CATEGORY_LABELS = {
|
|
1033
|
+
STOLEN_FUNDS: "flagged as associated with stolen funds",
|
|
1034
|
+
SANCTIONS: "on a sanctions list",
|
|
1035
|
+
SANCTIONED: "on a sanctions list",
|
|
1036
|
+
OFAC: "on a sanctions list",
|
|
1037
|
+
TERRORIST_FINANCING: "flagged for terrorist financing",
|
|
1038
|
+
TERRORISM_FINANCING: "flagged for terrorist financing",
|
|
1039
|
+
FRAUD: "flagged for fraud",
|
|
1040
|
+
SCAM: "flagged as a scam address"
|
|
1041
|
+
};
|
|
1042
|
+
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
1043
|
+
function blockLabelFor(categories) {
|
|
1044
|
+
for (const raw of categories) {
|
|
1045
|
+
const label = BLOCK_CATEGORY_LABELS[String(raw || "").trim().toUpperCase()];
|
|
1046
|
+
if (label) return label;
|
|
1047
|
+
}
|
|
1048
|
+
return BLOCK_LABEL_DEFAULT;
|
|
1049
|
+
}
|
|
1050
|
+
var REASON_TAGS = {
|
|
1051
|
+
blocked_jurisdiction: "Restricted country",
|
|
1052
|
+
ui_block: "Restricted country",
|
|
1053
|
+
blocked_destination_jurisdiction: "Restricted destination",
|
|
1054
|
+
blocked_corridor_mode: "Corridor closed",
|
|
1055
|
+
blocked_category: "Risk flag",
|
|
1056
|
+
amount_exceeds_max_order_usd: "Limit exceeded",
|
|
1057
|
+
amount_exceeds_max: "Limit exceeded",
|
|
1058
|
+
amount_exceeds_actor_cap: "Limit exceeded",
|
|
1059
|
+
amount_exceeds_jurisdiction_max: "Limit exceeded",
|
|
1060
|
+
asset_pair_not_allowed: "Asset not allowed",
|
|
1061
|
+
asset_not_allowed: "Asset not allowed",
|
|
1062
|
+
source_chain_not_allowed: "Chain not allowed",
|
|
1063
|
+
dest_chain_not_allowed: "Chain not allowed",
|
|
1064
|
+
jurisdiction_out_of_scope: "Out of scope"
|
|
1065
|
+
};
|
|
1066
|
+
function complianceReasonTag(raw) {
|
|
1067
|
+
const head = complianceReasonHead(raw);
|
|
1068
|
+
return REASON_TAGS[head] ?? head.replace(/_/g, " ");
|
|
1069
|
+
}
|
|
1070
|
+
function complianceTagOf(compliance) {
|
|
1071
|
+
const first = (compliance?.reasons ?? [])[0];
|
|
1072
|
+
return first ? complianceReasonTag(first) : "";
|
|
1073
|
+
}
|
|
1074
|
+
var FLOOR_CATEGORIES = ["SANCTIONS", "TERRORISM_FINANCING", "STOLEN_FUNDS", "RANSOMWARE"];
|
|
1075
|
+
var TUNABLE_CATEGORIES = ["SCAM", "DARKNET", "MIXER", "HIGH_RISK_ENTITY", "PEP", "INDIRECT_EXPOSURE", "UNCLASSIFIED"];
|
|
1076
|
+
var TUNED_OUTCOMES = {
|
|
1077
|
+
SCAM: "blocked",
|
|
1078
|
+
DARKNET: "blocked",
|
|
1079
|
+
MIXER: "flagged",
|
|
1080
|
+
HIGH_RISK_ENTITY: "flagged",
|
|
1081
|
+
PEP: "flagged",
|
|
1082
|
+
INDIRECT_EXPOSURE: "flagged",
|
|
1083
|
+
UNCLASSIFIED: "flagged"
|
|
1084
|
+
};
|
|
1085
|
+
function screeningOutcomeOf(category) {
|
|
1086
|
+
const key = category.trim().toUpperCase();
|
|
1087
|
+
if (FLOOR_CATEGORIES.includes(key)) return "always-blocked";
|
|
1088
|
+
return TUNED_OUTCOMES[key] ?? null;
|
|
1089
|
+
}
|
|
1090
|
+
var labelsFor = (outcome) => [...FLOOR_CATEGORIES, ...TUNABLE_CATEGORIES].filter((c) => screeningOutcomeOf(c) === outcome).map(categoryLabel);
|
|
1091
|
+
var SCREENING_BUCKETS = [
|
|
1092
|
+
{ outcome: "always-blocked", title: "Always blocked", detail: "Cannot be changed or disabled.", categories: labelsFor("always-blocked") },
|
|
1093
|
+
{ outcome: "blocked", title: "Blocked under this policy", detail: "The current policy stops the order.", categories: labelsFor("blocked") },
|
|
1094
|
+
{ outcome: "flagged", title: "Flagged", detail: "A warning is shown.", categories: labelsFor("flagged") }
|
|
1095
|
+
];
|
|
1096
|
+
|
|
764
1097
|
// src/core/solve.ts
|
|
765
1098
|
async function solveExactOut({ option, destination, destinationToken, payer, fetchQuote }) {
|
|
766
1099
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -997,7 +1330,7 @@ function routeLabelFor(option, destinationToken, result) {
|
|
|
997
1330
|
const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
|
|
998
1331
|
return `Swap ${option.symbol} to ${destinationToken.symbol} and settle on ZeroDelta${bridge}.`;
|
|
999
1332
|
}
|
|
1000
|
-
async function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve = solveExactOut, amountInRaw }) {
|
|
1333
|
+
async function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve = solveExactOut, amountInRaw, compliance }) {
|
|
1001
1334
|
const result = await solve({ option, destination, destinationToken, payer, fetchQuote, amountInRaw });
|
|
1002
1335
|
const quote = result.quote;
|
|
1003
1336
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -1044,7 +1377,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1044
1377
|
bridge: quote.bridge,
|
|
1045
1378
|
feeBps: quote.feeBps,
|
|
1046
1379
|
estimatedDuration: quote.estimatedDuration,
|
|
1047
|
-
iterations: result.iterations
|
|
1380
|
+
iterations: result.iterations,
|
|
1381
|
+
// A direct transfer never reaches /quote (solve.ts short-circuits it), so there is no
|
|
1382
|
+
// gateway decision to carry. The caller screens both parties itself and passes the
|
|
1383
|
+
// synthesized verdict in — see plan.ts and compliance.ts::directComplianceFromScreens.
|
|
1384
|
+
compliance
|
|
1048
1385
|
}
|
|
1049
1386
|
};
|
|
1050
1387
|
}
|
|
@@ -1128,7 +1465,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1128
1465
|
gasCostSource: quote.gasCostSource,
|
|
1129
1466
|
msgValue: valueRaw.toString(),
|
|
1130
1467
|
deadline: order.deadline,
|
|
1131
|
-
iterations: result.iterations
|
|
1468
|
+
iterations: result.iterations,
|
|
1469
|
+
// Carried verbatim from the gateway's decision on THIS wallet pair. The projection used to
|
|
1470
|
+
// drop it, which is why the widget could show a price with no evidence of the control that
|
|
1471
|
+
// produced it.
|
|
1472
|
+
compliance: quote.compliance
|
|
1132
1473
|
}
|
|
1133
1474
|
};
|
|
1134
1475
|
}
|
|
@@ -1164,25 +1505,20 @@ function apiMessage(json, fallback) {
|
|
|
1164
1505
|
}
|
|
1165
1506
|
return sanitizeMessage(err?.message, fallback);
|
|
1166
1507
|
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
TERRORIST_FINANCING: "flagged for terrorist financing",
|
|
1173
|
-
FRAUD: "flagged for fraud",
|
|
1174
|
-
SCAM: "flagged as a scam address"
|
|
1175
|
-
};
|
|
1176
|
-
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
1508
|
+
function isStructuredComplianceBlock(error) {
|
|
1509
|
+
const code = String(error?.code || "").toUpperCase();
|
|
1510
|
+
if (code === "COMPLIANCE_BLOCKED" || code === "COMPLIANCE_BLOCK") return true;
|
|
1511
|
+
return error?.status === 422 && Array.isArray(error?.reasons) && error.reasons.length > 0;
|
|
1512
|
+
}
|
|
1177
1513
|
function classifyQuoteError(error) {
|
|
1178
1514
|
if (!error) return null;
|
|
1179
1515
|
const reasons = Array.isArray(error.reasons) ? error.reasons : [];
|
|
1180
1516
|
const haystack = `${error.message || ""} ${reasons.join(" ")}`;
|
|
1181
1517
|
const catMatch = /blocked_category:\s*([A-Za-z_]+)/i.exec(haystack);
|
|
1182
|
-
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);
|
|
1518
|
+
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);
|
|
1183
1519
|
if (!isBlock) return null;
|
|
1184
1520
|
const category = (catMatch?.[1] || "").toUpperCase() || "COMPLIANCE";
|
|
1185
|
-
const label =
|
|
1521
|
+
const label = blockLabelFor([category]);
|
|
1186
1522
|
return {
|
|
1187
1523
|
blocked: true,
|
|
1188
1524
|
category,
|
|
@@ -1206,6 +1542,8 @@ function createApiClient(cfg) {
|
|
|
1206
1542
|
routes: null,
|
|
1207
1543
|
health: null
|
|
1208
1544
|
};
|
|
1545
|
+
const screenCache = /* @__PURE__ */ new Map();
|
|
1546
|
+
const screenInflight = /* @__PURE__ */ new Map();
|
|
1209
1547
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
1210
1548
|
async function apiRequest(path, init = {}) {
|
|
1211
1549
|
const apiKey = await cfg.getApiKey();
|
|
@@ -1300,7 +1638,32 @@ function createApiClient(cfg) {
|
|
|
1300
1638
|
}
|
|
1301
1639
|
throw lastError;
|
|
1302
1640
|
}
|
|
1303
|
-
|
|
1641
|
+
async function screenWallet(address, chainId) {
|
|
1642
|
+
const addr = String(address || "").trim();
|
|
1643
|
+
if (!addr) throw apiError("An address is required to screen a wallet.", { code: "bad_request" });
|
|
1644
|
+
const key = `${/^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr}|${chainId ?? ""}`;
|
|
1645
|
+
const hit = screenCache.get(key);
|
|
1646
|
+
if (hit && Date.now() - hit.at < SCREEN_CACHE_TTL_MS) return hit.value;
|
|
1647
|
+
const inflight = screenInflight.get(key);
|
|
1648
|
+
if (inflight) return inflight;
|
|
1649
|
+
const request = apiRequest("/screen/wallet", {
|
|
1650
|
+
method: "POST",
|
|
1651
|
+
body: JSON.stringify(chainId == null ? { address: addr } : { address: addr, chainId }),
|
|
1652
|
+
timeoutMs: 12e3
|
|
1653
|
+
}).then((screen) => {
|
|
1654
|
+
if (!screen || typeof screen !== "object" || typeof screen.blocked !== "boolean") {
|
|
1655
|
+
throw apiError("Compliance screening returned an unusable result.", { code: "bad_response" });
|
|
1656
|
+
}
|
|
1657
|
+
const value = { ...screen, address: screen.address || addr };
|
|
1658
|
+
screenCache.set(key, { at: Date.now(), value });
|
|
1659
|
+
return value;
|
|
1660
|
+
}).finally(() => {
|
|
1661
|
+
screenInflight.delete(key);
|
|
1662
|
+
});
|
|
1663
|
+
screenInflight.set(key, request);
|
|
1664
|
+
return request;
|
|
1665
|
+
}
|
|
1666
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchQuote, screenWallet, apiBase };
|
|
1304
1667
|
}
|
|
1305
1668
|
|
|
1306
1669
|
// src/core/plan.ts
|
|
@@ -1368,7 +1731,36 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1368
1731
|
balanceTargets.push({ chainId: option.chainId, tokenAddress: option.address, decimals: option.decimals });
|
|
1369
1732
|
}
|
|
1370
1733
|
const walletBalances = readBalances ? await readBalances(payer, balanceTargets).catch(() => ({})) : {};
|
|
1371
|
-
const
|
|
1734
|
+
const directOptions = options.filter((option) => option.direct);
|
|
1735
|
+
let directCompliance = null;
|
|
1736
|
+
if (directOptions.length) {
|
|
1737
|
+
const parties = [];
|
|
1738
|
+
const seenParty = /* @__PURE__ */ new Set();
|
|
1739
|
+
for (const raw of [payer, destination.address]) {
|
|
1740
|
+
const addr = String(raw || "").trim();
|
|
1741
|
+
if (!addr) continue;
|
|
1742
|
+
const key = /^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr;
|
|
1743
|
+
if (seenParty.has(key)) continue;
|
|
1744
|
+
seenParty.add(key);
|
|
1745
|
+
parties.push(addr);
|
|
1746
|
+
}
|
|
1747
|
+
try {
|
|
1748
|
+
const screens = await Promise.all(parties.map((address) => api.screenWallet(address, destination.chainId)));
|
|
1749
|
+
const blocked = screens.filter((screen) => screen.blocked);
|
|
1750
|
+
if (blocked.length) {
|
|
1751
|
+
const who = blocked.some((s) => s.address.toLowerCase() === payer.toLowerCase()) ? "your wallet" : "the recipient";
|
|
1752
|
+
const categories = [...new Set(blocked.flatMap((s) => s.blockingCategories ?? []))];
|
|
1753
|
+
throw apiError(
|
|
1754
|
+
`This payment was blocked by compliance screening \u2014 ${who} is ${blockLabelFor(categories)}. Choose a different recipient or connect a different wallet.`,
|
|
1755
|
+
{ blocked: true, blockedCategory: categories[0] || "COMPLIANCE", blockedReason: categories.join(", ") }
|
|
1756
|
+
);
|
|
1757
|
+
}
|
|
1758
|
+
directCompliance = directComplianceFromScreens(screens);
|
|
1759
|
+
} catch (error) {
|
|
1760
|
+
if (error?.blocked) throw error;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
const candidates = directCompliance ? directOptions : [];
|
|
1372
1764
|
const heldOptions = options.filter((option) => !option.direct && hasPositiveBalance(option, walletBalances));
|
|
1373
1765
|
const heldKeys = new Set(heldOptions.map(optionBalanceKey));
|
|
1374
1766
|
const seenChains = /* @__PURE__ */ new Set();
|
|
@@ -1388,7 +1780,7 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1388
1780
|
}
|
|
1389
1781
|
const routeErrors = [];
|
|
1390
1782
|
const routePromises = candidates.map(
|
|
1391
|
-
(option) => buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote: api.fetchQuote }).catch((error) => {
|
|
1783
|
+
(option) => buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote: api.fetchQuote, compliance: option.direct ? directCompliance ?? void 0 : void 0 }).catch((error) => {
|
|
1392
1784
|
routeErrors.push(error);
|
|
1393
1785
|
return null;
|
|
1394
1786
|
})
|
|
@@ -2849,6 +3241,98 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
2849
3241
|
.sg-island .sg-spinner{display:none!important}
|
|
2850
3242
|
.sg-island .sg-rm-dot{display:inline-block}
|
|
2851
3243
|
}
|
|
3244
|
+
|
|
3245
|
+
/* \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
|
|
3246
|
+
Mirrors the dApp's compliance row + details dialog. The row is a quiet affordance in the payment
|
|
3247
|
+
summary; the details open a sheet that fills the widget's own card, because a page-level modal
|
|
3248
|
+
inside somebody else's checkout is a z-index fight we would lose.
|
|
3249
|
+
|
|
3250
|
+
Tone note, carried over from the dApp: a PASS reads in body ink, not in green. The shield tick is
|
|
3251
|
+
already green, so colouring the sentence too says the same thing twice and spends the accent on
|
|
3252
|
+
the half that carries no information. A DENY still shouts. */
|
|
3253
|
+
/* NOT positioned. The sheet is inset:0 against the WIDGET CARD, so this wrapper must not become
|
|
3254
|
+
the containing block: when it carried position:relative the sheet collapsed to the height of
|
|
3255
|
+
this one row and drew straight through the CTA beneath it.
|
|
3256
|
+
NB this stylesheet is a JS template literal - never write a backtick in these comments. */
|
|
3257
|
+
.sg-cp{margin-top:10px}
|
|
3258
|
+
.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}
|
|
3259
|
+
.sg-cp-row:hover{border-color:color-mix(in srgb,var(--sg-accent) 40%,var(--sg-border))}
|
|
3260
|
+
.sg-cp-row:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
|
|
3261
|
+
.sg-cp-row-main{display:flex;align-items:center;gap:8px;min-width:0}
|
|
3262
|
+
.sg-cp-row-glyph{display:flex;flex:0 0 auto;color:var(--sg-success)}
|
|
3263
|
+
.sg-cp-row[data-tone="neutral"] .sg-cp-row-glyph{color:var(--sg-text-muted);opacity:.55}
|
|
3264
|
+
.sg-cp-row[data-tone="blocked"] .sg-cp-row-glyph,.sg-cp-row[data-tone="warn"] .sg-cp-row-glyph{color:var(--sg-danger)}
|
|
3265
|
+
.sg-cp-row-label{font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3266
|
+
.sg-cp-row[data-tone="neutral"] .sg-cp-row-label{color:var(--sg-text-muted)}
|
|
3267
|
+
.sg-cp-row[data-tone="blocked"] .sg-cp-row-label,.sg-cp-row[data-tone="warn"] .sg-cp-row-label{color:var(--sg-danger)}
|
|
3268
|
+
.sg-cp-row-chev{display:flex;flex:0 0 auto;color:var(--sg-text-muted)}
|
|
3269
|
+
.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)}
|
|
3270
|
+
|
|
3271
|
+
/* the sheet \u2014 fills the widget card */
|
|
3272
|
+
.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}
|
|
3273
|
+
@keyframes sg-cp-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
|
|
3274
|
+
.sg-cp-sheet:focus{outline:none}
|
|
3275
|
+
.sg-cp-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:0 0 auto}
|
|
3276
|
+
.sg-cp-sheet-title{margin:0;font-size:15px;font-weight:600}
|
|
3277
|
+
.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}
|
|
3278
|
+
.sg-cp-close:hover{background:var(--sg-surface);color:var(--sg-text)}
|
|
3279
|
+
.sg-cp-close:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
|
|
3280
|
+
.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}
|
|
3281
|
+
.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}
|
|
3282
|
+
.sg-cp-tab[data-active="true"]{background:color-mix(in srgb,var(--sg-accent) 10%,transparent);color:var(--sg-accent)}
|
|
3283
|
+
.sg-cp-tab:focus-visible{outline:2px solid var(--sg-accent);outline-offset:-2px}
|
|
3284
|
+
.sg-cp-sheet-body{margin-top:10px}
|
|
3285
|
+
.sg-cp-tabpanel{display:flex;flex-direction:column;gap:8px}
|
|
3286
|
+
|
|
3287
|
+
/* cards */
|
|
3288
|
+
.sg-cp-card{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--sg-border);border-radius:16px}
|
|
3289
|
+
.sg-cp-card-head{display:flex;align-items:center;gap:8px}
|
|
3290
|
+
.sg-cp-card-glyph{display:flex;flex:0 0 auto;color:var(--sg-accent)}
|
|
3291
|
+
.sg-cp-card-title{margin:0;font-size:14px;font-weight:600}
|
|
3292
|
+
.sg-cp-summary{display:flex;flex-direction:column;gap:3px}
|
|
3293
|
+
.sg-cp-summary-head{display:flex;align-items:center;gap:8px;color:var(--sg-success)}
|
|
3294
|
+
.sg-cp-summary-head[data-tone="neutral"]{color:var(--sg-text-muted)}
|
|
3295
|
+
.sg-cp-summary-head[data-tone="blocked"],.sg-cp-summary-head[data-tone="warn"]{color:var(--sg-danger)}
|
|
3296
|
+
.sg-cp-summary-title{font-size:14px;font-weight:600;color:var(--sg-text)}
|
|
3297
|
+
.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)}
|
|
3298
|
+
.sg-cp-summary-sub{margin:0;padding-left:24px;font-size:12px;line-height:1.35;color:var(--sg-text-muted)}
|
|
3299
|
+
|
|
3300
|
+
/* per-control rows */
|
|
3301
|
+
.sg-cp-checks{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:11px}
|
|
3302
|
+
.sg-cp-check-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px}
|
|
3303
|
+
.sg-cp-check-label{display:flex;align-items:center;gap:8px;min-width:0;font-size:13.5px;line-height:1.25}
|
|
3304
|
+
.sg-cp-check[data-ok="false"] .sg-cp-check-label{color:var(--sg-danger)}
|
|
3305
|
+
.sg-cp-check-mark{display:flex;flex:0 0 auto;color:var(--sg-success)}
|
|
3306
|
+
.sg-cp-check-mark[data-ok="false"]{color:var(--sg-danger)}
|
|
3307
|
+
.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}
|
|
3308
|
+
.sg-cp-check-reason{color:var(--sg-danger)}
|
|
3309
|
+
.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}
|
|
3310
|
+
.sg-cp-link:hover{text-decoration:underline}
|
|
3311
|
+
.sg-cp-link:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px;border-radius:4px}
|
|
3312
|
+
.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)}
|
|
3313
|
+
.sg-cp-scope{margin:0;font-size:11.5px;line-height:1.45;color:var(--sg-text-muted)}
|
|
3314
|
+
.sg-cp-flags{margin:0;font-size:13px}
|
|
3315
|
+
|
|
3316
|
+
/* quote details */
|
|
3317
|
+
.sg-cp-facts{margin:0;display:flex;flex-direction:column;gap:9px}
|
|
3318
|
+
.sg-cp-fact{display:grid;grid-template-columns:78px minmax(0,1fr);align-items:center;gap:10px}
|
|
3319
|
+
.sg-cp-fact dt{font-size:12px;color:var(--sg-text-muted)}
|
|
3320
|
+
.sg-cp-fact dd{margin:0;font-size:13px;min-width:0;overflow-wrap:anywhere}
|
|
3321
|
+
|
|
3322
|
+
/* screening policy */
|
|
3323
|
+
.sg-cp-policy-head{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:8px;padding-bottom:2px}
|
|
3324
|
+
.sg-cp-policy-id{font-size:11px;color:var(--sg-text-muted);overflow-wrap:anywhere}
|
|
3325
|
+
.sg-cp-policy-facts{padding:2px 0 8px}
|
|
3326
|
+
.sg-cp-buckets{display:flex;flex-direction:column;gap:8px}
|
|
3327
|
+
.sg-cp-bucket{gap:10px;padding:12px 14px}
|
|
3328
|
+
.sg-cp-bucket-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 10px}
|
|
3329
|
+
.sg-cp-bucket-detail{font-size:11.5px;color:var(--sg-text-muted)}
|
|
3330
|
+
.sg-cp-cats{list-style:none;margin:0;padding:0 0 0 4px;display:flex;flex-direction:column;gap:5px}
|
|
3331
|
+
.sg-cp-cats li{display:flex;align-items:center;gap:10px;font-size:12.5px;line-height:1.35}
|
|
3332
|
+
.sg-cp-dot{flex:0 0 auto;width:4px;height:4px;border-radius:999px;background:var(--sg-accent);opacity:.8}
|
|
3333
|
+
|
|
3334
|
+
/* express (PaymentIsland) trims the card padding, so the sheet follows */
|
|
3335
|
+
@media (prefers-reduced-motion:reduce){.sg-cp-sheet{animation:none}}
|
|
2852
3336
|
`;
|
|
2853
3337
|
var injected = false;
|
|
2854
3338
|
function injectStyles() {
|
|
@@ -3002,7 +3486,7 @@ function WidgetShell(props) {
|
|
|
3002
3486
|
] })
|
|
3003
3487
|
] });
|
|
3004
3488
|
}
|
|
3005
|
-
function
|
|
3489
|
+
function shortAddress2(a) {
|
|
3006
3490
|
if (!a) return "";
|
|
3007
3491
|
return `${a.slice(0, 6)}\u2026${a.slice(-4)}`;
|
|
3008
3492
|
}
|
|
@@ -3214,6 +3698,251 @@ function RouteList(props) {
|
|
|
3214
3698
|
] }) : null
|
|
3215
3699
|
] });
|
|
3216
3700
|
}
|
|
3701
|
+
function ShieldTick({ 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("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" }),
|
|
3704
|
+
/* @__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" }),
|
|
3705
|
+
/* @__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" })
|
|
3706
|
+
] });
|
|
3707
|
+
}
|
|
3708
|
+
function TickCircle({ size = 16 }) {
|
|
3709
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3710
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3711
|
+
/* @__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" })
|
|
3712
|
+
] });
|
|
3713
|
+
}
|
|
3714
|
+
function CloseCircle({ size = 16 }) {
|
|
3715
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3716
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3717
|
+
/* @__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" })
|
|
3718
|
+
] });
|
|
3719
|
+
}
|
|
3720
|
+
function PendingCircle({ size = 16 }) {
|
|
3721
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3722
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "9.2", stroke: "currentColor", strokeWidth: "1.6", strokeDasharray: "3 3" }),
|
|
3723
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 12h7", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
|
|
3724
|
+
] });
|
|
3725
|
+
}
|
|
3726
|
+
function Tick({ size = 12 }) {
|
|
3727
|
+
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" }) });
|
|
3728
|
+
}
|
|
3729
|
+
function Cross({ size = 12 }) {
|
|
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: "m5.5 5.5 13 13M18.5 5.5l-13 13", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round" }) });
|
|
3731
|
+
}
|
|
3732
|
+
function Chevron({ size = 16 }) {
|
|
3733
|
+
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" }) });
|
|
3734
|
+
}
|
|
3735
|
+
function Info({ size = 16 }) {
|
|
3736
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3737
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3738
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 10.6v6", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round" }),
|
|
3739
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "7.6", r: "1.25", fill: "var(--sg-bg)" })
|
|
3740
|
+
] });
|
|
3741
|
+
}
|
|
3742
|
+
function Lock({ size = 16 }) {
|
|
3743
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3744
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "4.5", y: "10.5", width: "15", height: "9.5", rx: "2.2", stroke: "currentColor", strokeWidth: "1.7" }),
|
|
3745
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 10.5V7.8a4 4 0 0 1 8 0v2.7", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" })
|
|
3746
|
+
] });
|
|
3747
|
+
}
|
|
3748
|
+
function ShieldOutline({ size = 16 }) {
|
|
3749
|
+
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" }) });
|
|
3750
|
+
}
|
|
3751
|
+
function WarningFilled({ size = 16 }) {
|
|
3752
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3753
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 3.2 21.4 19.4H2.6L12 3.2Z", fill: "currentColor" }),
|
|
3754
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 9.4v4.3", stroke: "var(--sg-bg)", strokeWidth: "1.9", strokeLinecap: "round" }),
|
|
3755
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "16.4", r: "1.05", fill: "var(--sg-bg)" })
|
|
3756
|
+
] });
|
|
3757
|
+
}
|
|
3758
|
+
function CornerArrow({ size = 12 }) {
|
|
3759
|
+
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" }) });
|
|
3760
|
+
}
|
|
3761
|
+
var POLICY_GLYPH = {
|
|
3762
|
+
"always-blocked": Lock,
|
|
3763
|
+
blocked: ShieldOutline,
|
|
3764
|
+
flagged: WarningFilled
|
|
3765
|
+
};
|
|
3766
|
+
var POLICY_DETAIL = {
|
|
3767
|
+
"always-blocked": "Cannot be changed or disabled",
|
|
3768
|
+
blocked: "Stops the payment",
|
|
3769
|
+
flagged: "Does not automatically block"
|
|
3770
|
+
};
|
|
3771
|
+
function shortAddr(a) {
|
|
3772
|
+
return a.length > 14 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
|
|
3773
|
+
}
|
|
3774
|
+
function TriggerGlyph({ cv }) {
|
|
3775
|
+
if (cv.tone === "blocked" || cv.tone === "warn") return /* @__PURE__ */ jsxRuntime.jsx(CloseCircle, {});
|
|
3776
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ShieldTick, {});
|
|
3777
|
+
}
|
|
3778
|
+
function CheckRow({ check, onViewPolicy }) {
|
|
3779
|
+
const label = check.id === "risk" ? check.ok ? "Risk screening passed" : "Risk screening failed" : check.label;
|
|
3780
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "sg-cp-check", "data-ok": check.ok, children: [
|
|
3781
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-check-head", children: [
|
|
3782
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-check-label", children: [
|
|
3783
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-mark", "data-ok": check.ok, children: check.ok ? /* @__PURE__ */ jsxRuntime.jsx(Tick, {}) : /* @__PURE__ */ jsxRuntime.jsx(Cross, {}) }),
|
|
3784
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
|
|
3785
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sr-only", children: check.ok ? " \u2014 passed" : " \u2014 failed" })
|
|
3786
|
+
] }),
|
|
3787
|
+
check.id === "risk" ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-cp-link", onClick: onViewPolicy, children: [
|
|
3788
|
+
"View policy",
|
|
3789
|
+
/* @__PURE__ */ jsxRuntime.jsx(CornerArrow, {})
|
|
3790
|
+
] }) : null
|
|
3791
|
+
] }),
|
|
3792
|
+
check.note ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-note", children: check.note }) : null,
|
|
3793
|
+
check.reasons.map((reason) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-reason", children: humanizeComplianceReason(reason) }, reason))
|
|
3794
|
+
] });
|
|
3795
|
+
}
|
|
3796
|
+
function QuoteChecks({
|
|
3797
|
+
compliance,
|
|
3798
|
+
cv,
|
|
3799
|
+
checks,
|
|
3800
|
+
direct,
|
|
3801
|
+
onViewPolicy
|
|
3802
|
+
}) {
|
|
3803
|
+
const allPassed = cv.tone === "ok" && checks.length > 0 && checks.every((c) => c.ok);
|
|
3804
|
+
const summary = allPassed ? "All checks passed" : cv.label;
|
|
3805
|
+
const orphans = unattributedComplianceReasons(compliance, cv);
|
|
3806
|
+
const wallets = distinctScreenedWallets(compliance);
|
|
3807
|
+
const jurisdiction = compliance?.sourceJurisdiction?.trim();
|
|
3808
|
+
const hasDetails = Boolean(jurisdiction || wallets.length || compliance?.checkId);
|
|
3809
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Quote checks", children: [
|
|
3810
|
+
/* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
3811
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-summary", children: [
|
|
3812
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-summary-head", "data-tone": cv.tone, children: [
|
|
3813
|
+
cv.tone === "blocked" || cv.tone === "warn" ? /* @__PURE__ */ jsxRuntime.jsx(CloseCircle, {}) : cv.tone === "neutral" ? /* @__PURE__ */ jsxRuntime.jsx(PendingCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(TickCircle, {}),
|
|
3814
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-summary-title", children: summary })
|
|
3815
|
+
] }),
|
|
3816
|
+
checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-cp-summary-sub", children: [
|
|
3817
|
+
checks.length,
|
|
3818
|
+
" check",
|
|
3819
|
+
checks.length === 1 ? " was" : "s were",
|
|
3820
|
+
" completed for this payment"
|
|
3821
|
+
] }) : (
|
|
3822
|
+
// No decision was issued. Listing the controls here would be ticks for a verdict nobody
|
|
3823
|
+
// gave, and an unconfigured gate is not a set of passed checks.
|
|
3824
|
+
/* @__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." })
|
|
3825
|
+
)
|
|
3826
|
+
] }),
|
|
3827
|
+
checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-checks", children: checks.map((check) => /* @__PURE__ */ jsxRuntime.jsx(CheckRow, { check, onViewPolicy }, check.id)) }) : null,
|
|
3828
|
+
orphans.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-orphans", children: orphans.map((reason) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: humanizeComplianceReason(reason) }, reason)) }) : null,
|
|
3829
|
+
direct && checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-scope", children: DIRECT_SCOPE_NOTE }) : null
|
|
3830
|
+
] }),
|
|
3831
|
+
compliance?.flaggedCategories?.length ? /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
3832
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-card-head", children: [
|
|
3833
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(WarningFilled, {}) }),
|
|
3834
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: "Flagged, not blocking" })
|
|
3835
|
+
] }),
|
|
3836
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-flags", children: compliance.flaggedCategories.map(categoryLabel).join(" \xB7 ") }),
|
|
3837
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-scope", children: "The policy records these and still allows the payment. They do not stop settlement." })
|
|
3838
|
+
] }) : null,
|
|
3839
|
+
hasDetails ? /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
3840
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-card-head", children: [
|
|
3841
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(Info, {}) }),
|
|
3842
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: "Quote details" })
|
|
3843
|
+
] }),
|
|
3844
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "sg-cp-facts", children: [
|
|
3845
|
+
jurisdiction ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Jurisdiction", value: jurisdiction }) : null,
|
|
3846
|
+
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)),
|
|
3847
|
+
compliance?.checkId ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Check ID", value: compliance.checkId, mono: true }) : null
|
|
3848
|
+
] })
|
|
3849
|
+
] }) : null
|
|
3850
|
+
] });
|
|
3851
|
+
}
|
|
3852
|
+
function Fact({ label, value, title, mono = false }) {
|
|
3853
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-fact", children: [
|
|
3854
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { children: label }),
|
|
3855
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { title, className: mono ? "sg-mono" : void 0, children: value })
|
|
3856
|
+
] });
|
|
3857
|
+
}
|
|
3858
|
+
function ScreeningPolicy({ compliance }) {
|
|
3859
|
+
const policyId = compliance?.policyVersion?.trim();
|
|
3860
|
+
const applied = Boolean(compliance?.decision || policyId || compliance?.appliedPolicyNames?.length);
|
|
3861
|
+
const names = [...compliance?.appliedPolicyNames ?? [], ...compliance?.appliedLegislation ?? []];
|
|
3862
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Screening policy", children: [
|
|
3863
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-policy-head", children: [
|
|
3864
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-summary", children: [
|
|
3865
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-summary-head", "data-tone": applied ? "ok" : "neutral", children: [
|
|
3866
|
+
applied ? /* @__PURE__ */ jsxRuntime.jsx(TickCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(PendingCircle, {}),
|
|
3867
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-summary-title", children: "Transaction screening policy" })
|
|
3868
|
+
] }),
|
|
3869
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-summary-sub", children: applied ? "Applied to this payment" : "No policy decision was returned" })
|
|
3870
|
+
] }),
|
|
3871
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-policy-id sg-mono", children: policyId ? `Policy ${policyId}` : "Policy ID unavailable" })
|
|
3872
|
+
] }),
|
|
3873
|
+
names.length ? /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "sg-cp-facts sg-cp-policy-facts", children: [
|
|
3874
|
+
compliance?.appliedPolicyNames?.length ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Policy", value: compliance.appliedPolicyNames.join(", ") }) : null,
|
|
3875
|
+
compliance?.appliedLegislation?.length ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Legislation", value: compliance.appliedLegislation.join(", ") }) : null
|
|
3876
|
+
] }) : null,
|
|
3877
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cp-buckets", children: SCREENING_BUCKETS.map((bucket) => {
|
|
3878
|
+
const Glyph = POLICY_GLYPH[bucket.outcome];
|
|
3879
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card sg-cp-bucket", children: [
|
|
3880
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-bucket-head", children: [
|
|
3881
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-card-head", children: [
|
|
3882
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(Glyph, {}) }),
|
|
3883
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: bucket.title })
|
|
3884
|
+
] }),
|
|
3885
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-bucket-detail", children: POLICY_DETAIL[bucket.outcome] })
|
|
3886
|
+
] }),
|
|
3887
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-cats", children: bucket.categories.map((category) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
3888
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-dot", "aria-hidden": "true" }),
|
|
3889
|
+
category
|
|
3890
|
+
] }, category)) })
|
|
3891
|
+
] }, bucket.outcome);
|
|
3892
|
+
}) })
|
|
3893
|
+
] });
|
|
3894
|
+
}
|
|
3895
|
+
function CompliancePanel(props) {
|
|
3896
|
+
const [open, setOpen] = react.useState(false);
|
|
3897
|
+
const [tab, setTab] = react.useState("checks");
|
|
3898
|
+
const triggerRef = react.useRef(null);
|
|
3899
|
+
const sheetRef = react.useRef(null);
|
|
3900
|
+
const compliance = props.compliance ?? null;
|
|
3901
|
+
const cv = complianceView(compliance, props.hasQuote ?? true);
|
|
3902
|
+
const allChecks = complianceChecks(compliance, cv);
|
|
3903
|
+
const checks = props.direct ? allChecks.filter((c) => DIRECT_CHECK_IDS.includes(c.id)) : allChecks;
|
|
3904
|
+
const tag = complianceTagOf(compliance);
|
|
3905
|
+
react.useEffect(() => {
|
|
3906
|
+
if (!open) return;
|
|
3907
|
+
sheetRef.current?.focus();
|
|
3908
|
+
const onKey = (e) => {
|
|
3909
|
+
if (e.key === "Escape") {
|
|
3910
|
+
e.stopPropagation();
|
|
3911
|
+
setOpen(false);
|
|
3912
|
+
triggerRef.current?.focus();
|
|
3913
|
+
}
|
|
3914
|
+
};
|
|
3915
|
+
document.addEventListener("keydown", onKey, true);
|
|
3916
|
+
return () => document.removeEventListener("keydown", onKey, true);
|
|
3917
|
+
}, [open]);
|
|
3918
|
+
const close = () => {
|
|
3919
|
+
setOpen(false);
|
|
3920
|
+
triggerRef.current?.focus();
|
|
3921
|
+
};
|
|
3922
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp", "data-tone": cv.tone, children: [
|
|
3923
|
+
open ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3924
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { ref: triggerRef, type: "button", className: "sg-cp-row", "data-tone": cv.tone, onClick: () => setOpen(true), "aria-haspopup": "dialog", children: [
|
|
3925
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-row-main", children: [
|
|
3926
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(TriggerGlyph, { cv }) }),
|
|
3927
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-label", children: cv.label })
|
|
3928
|
+
] }),
|
|
3929
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-chev", children: /* @__PURE__ */ jsxRuntime.jsx(Chevron, {}) })
|
|
3930
|
+
] }),
|
|
3931
|
+
(cv.blocked || cv.needsAction) && tag ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-tag sg-mono", children: tag }) : null
|
|
3932
|
+
] }),
|
|
3933
|
+
open ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet", role: "dialog", "aria-modal": "true", "aria-label": "Compliance details", ref: sheetRef, tabIndex: -1, children: [
|
|
3934
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet-head", children: [
|
|
3935
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "sg-cp-sheet-title", children: "Compliance details" }),
|
|
3936
|
+
/* @__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" }) }) })
|
|
3937
|
+
] }),
|
|
3938
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabs", role: "tablist", "aria-label": "Compliance details sections", children: [
|
|
3939
|
+
/* @__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" }),
|
|
3940
|
+
/* @__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" })
|
|
3941
|
+
] }),
|
|
3942
|
+
/* @__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 }) })
|
|
3943
|
+
] }) : null
|
|
3944
|
+
] });
|
|
3945
|
+
}
|
|
3217
3946
|
|
|
3218
3947
|
// src/react/ui/chain-logos.ts
|
|
3219
3948
|
var BUNDLED_CHAIN_LOGO = {
|
|
@@ -3580,7 +4309,7 @@ function TxDetail(props) {
|
|
|
3580
4309
|
] }),
|
|
3581
4310
|
e.recipient ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3582
4311
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Recipient" }),
|
|
3583
|
-
/* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", children:
|
|
4312
|
+
/* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", children: shortAddress2(e.recipient) })
|
|
3584
4313
|
] }) : null,
|
|
3585
4314
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3586
4315
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Settlement" }),
|
|
@@ -3894,7 +4623,7 @@ function IdentityLine(props) {
|
|
|
3894
4623
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-link-id", children: [
|
|
3895
4624
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-icon", children: /* @__PURE__ */ jsxRuntime.jsx(WalletGlyph, {}) }),
|
|
3896
4625
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-link-id-text", children: [
|
|
3897
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-primary", children: props.account ?
|
|
4626
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-primary", children: props.account ? shortAddress2(props.account) : "ZeroDelta Link" }),
|
|
3898
4627
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-secondary", children: props.email ? props.email : props.account ? "Connected wallet" : "Connect your wallet to continue" })
|
|
3899
4628
|
] }),
|
|
3900
4629
|
props.account ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }) : null
|
|
@@ -4399,7 +5128,7 @@ function PaymentIsland(props) {
|
|
|
4399
5128
|
] }),
|
|
4400
5129
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-receipt-sub", children: [
|
|
4401
5130
|
confirmed ? "Confirmed on-chain" : "Confirmation pending",
|
|
4402
|
-
isPay && props.recipient ? ` \xB7 ${
|
|
5131
|
+
isPay && props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
4403
5132
|
] })
|
|
4404
5133
|
] }),
|
|
4405
5134
|
!identityMatchesWallet ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-remember", children: [
|
|
@@ -4511,6 +5240,7 @@ function PaymentIsland(props) {
|
|
|
4511
5240
|
chainName(sel.source.chainId)
|
|
4512
5241
|
] })
|
|
4513
5242
|
] }) : null,
|
|
5243
|
+
sel && !loading && !quoteError ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
|
|
4514
5244
|
quoteError ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error || "Couldn't get a price right now." }) : null,
|
|
4515
5245
|
walletError ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error || "The wallet could not complete this payment." }) : null,
|
|
4516
5246
|
submitting || walletError ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { variant: "rich", steps: flow.steps, verdict: flow.verdict }) : null,
|
|
@@ -4804,7 +5534,7 @@ function StableGeniePay(props) {
|
|
|
4804
5534
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
4805
5535
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
4806
5536
|
" \xB7 ",
|
|
4807
|
-
|
|
5537
|
+
shortAddress2(props.recipient)
|
|
4808
5538
|
] })
|
|
4809
5539
|
] }),
|
|
4810
5540
|
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
|
|
@@ -4847,6 +5577,7 @@ function StableGeniePay(props) {
|
|
|
4847
5577
|
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,
|
|
4848
5578
|
flow.status === "ready" && !visibleRoutes.length ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { children: "No funding route matches the accepted assets for this payment." }) : null
|
|
4849
5579
|
] }),
|
|
5580
|
+
sel && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
|
|
4850
5581
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4851
5582
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4852
5583
|
Button,
|
|
@@ -4964,7 +5695,7 @@ function StableGenieSwap(props) {
|
|
|
4964
5695
|
] }),
|
|
4965
5696
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
4966
5697
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
4967
|
-
props.recipient ? ` \xB7 ${
|
|
5698
|
+
props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
4968
5699
|
] })
|
|
4969
5700
|
] }),
|
|
4970
5701
|
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
|
|
@@ -4990,6 +5721,7 @@ function StableGenieSwap(props) {
|
|
|
4990
5721
|
] }),
|
|
4991
5722
|
flow.status === "error" && flow.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error }) : null,
|
|
4992
5723
|
flow.routes.length ? /* @__PURE__ */ jsxRuntime.jsx(RouteList, { routes: flow.routes, selectedId: flow.selected?.id ?? null, onSelect: flow.selectRoute }) : null,
|
|
5724
|
+
flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
|
|
4993
5725
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4994
5726
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
4995
5727
|
!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 }),
|
|
@@ -5188,7 +5920,7 @@ function StableGenieExchange(props) {
|
|
|
5188
5920
|
/* @__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: [
|
|
5189
5921
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
|
|
5190
5922
|
" ",
|
|
5191
|
-
|
|
5923
|
+
shortAddress2(wallet.account)
|
|
5192
5924
|
] }) : wallet.connecting ? "Connecting\u2026" : "Connect wallet" })
|
|
5193
5925
|
] });
|
|
5194
5926
|
const fromTileRef = react.useRef(null);
|
|
@@ -5230,7 +5962,7 @@ function StableGenieExchange(props) {
|
|
|
5230
5962
|
] }),
|
|
5231
5963
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
5232
5964
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
5233
|
-
props.recipient ? ` \xB7 ${
|
|
5965
|
+
props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
5234
5966
|
] })
|
|
5235
5967
|
] }),
|
|
5236
5968
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
@@ -5277,6 +6009,7 @@ function StableGenieExchange(props) {
|
|
|
5277
6009
|
meta.duration ? ` \xB7 ~${meta.duration}s` : ""
|
|
5278
6010
|
] }) : null
|
|
5279
6011
|
] }) : null,
|
|
6012
|
+
connected && flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
|
|
5280
6013
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
5281
6014
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
5282
6015
|
!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 }),
|
|
@@ -5379,6 +6112,7 @@ function mount(el, config) {
|
|
|
5379
6112
|
return () => root.unmount();
|
|
5380
6113
|
}
|
|
5381
6114
|
|
|
6115
|
+
exports.CompliancePanel = CompliancePanel;
|
|
5382
6116
|
exports.EXECUTABLE_STABLE_ASSETS = EXECUTABLE_STABLE_ASSETS;
|
|
5383
6117
|
exports.PaymentIsland = PaymentIsland;
|
|
5384
6118
|
exports.STABLE_ASSETS = STABLE_ASSETS;
|
|
@@ -5392,10 +6126,14 @@ exports.StableGenieSwap = StableGenieSwap;
|
|
|
5392
6126
|
exports.TRADEABLE_RWA_ASSETS = TRADEABLE_RWA_ASSETS;
|
|
5393
6127
|
exports.assetClassOf = assetClassOf;
|
|
5394
6128
|
exports.brokenLaneReason = brokenLaneReason;
|
|
6129
|
+
exports.complianceChecks = complianceChecks;
|
|
6130
|
+
exports.complianceControlsLine = complianceControlsLine;
|
|
6131
|
+
exports.complianceView = complianceView;
|
|
5395
6132
|
exports.counterpartTokens = counterpartTokens;
|
|
5396
6133
|
exports.createEngine = createEngine;
|
|
5397
6134
|
exports.darkTheme = darkTheme;
|
|
5398
6135
|
exports.destinationAvailability = destinationAvailability;
|
|
6136
|
+
exports.humanizeComplianceReason = humanizeComplianceReason;
|
|
5399
6137
|
exports.lightTheme = lightTheme;
|
|
5400
6138
|
exports.mount = mount;
|
|
5401
6139
|
exports.resolveTheme = resolveTheme;
|