@cedros/pay-react 1.1.21 → 1.1.23

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.
Files changed (114) hide show
  1. package/dist/{AISettingsSection-BXWZcMQT.js → AISettingsSection-DAztmwnN.js} +1 -1
  2. package/dist/{AISettingsSection-8eDaxYp8.mjs → AISettingsSection-DpMIk431.mjs} +2 -2
  3. package/dist/{AutosaveIndicator-3S7EvXip.mjs → AutosaveIndicator-BRCqAWqP.mjs} +1 -1
  4. package/dist/{AutosaveIndicator-DW4IPbZ5.js → AutosaveIndicator-BnQkKxzr.js} +1 -1
  5. package/dist/{CedrosContext-D-lnoEkR.js → CedrosContext-7dwmEeUY.js} +2 -2
  6. package/dist/{CedrosContext-BE6P5PQ0.mjs → CedrosContext-BlArEF7k.mjs} +95 -78
  7. package/dist/{CryptoButton-Dy-g3bR0.js → CryptoButton-C1AAOOfj.js} +1 -1
  8. package/dist/{CryptoButton-CksMkZjL.mjs → CryptoButton-CREryx1l.mjs} +2 -2
  9. package/dist/{FAQSection-Dg-I7Z-N.mjs → FAQSection-Ruzs7a-0.mjs} +1 -1
  10. package/dist/{FAQSection-r6eKjfdO.js → FAQSection-yw64HLy3.js} +1 -1
  11. package/dist/{MessagingSection-D39EuOLN.mjs → MessagingSection-BLRjfBQT.mjs} +2 -2
  12. package/dist/{MessagingSection-Cld5Q7ZM.js → MessagingSection-Dp_SaXsv.js} +1 -1
  13. package/dist/OrdersSection-C2dyWqrR.js +1 -0
  14. package/dist/OrdersSection-l-MtP9EN.mjs +233 -0
  15. package/dist/{PaymentSettingsSection-CEGHN6VI.mjs → PaymentSettingsSection-Bbq93UtC.mjs} +1 -1
  16. package/dist/{PaymentSettingsSection-B-MRsh1K.js → PaymentSettingsSection-C5bhLgU7.js} +1 -1
  17. package/dist/{SettingsSection-ZrzfLBlS.js → SettingsSection-D_pKPRrP.js} +1 -1
  18. package/dist/{SettingsSection-CPFOuoZG.mjs → SettingsSection-DorqCFXE.mjs} +1 -1
  19. package/dist/SingleCategorySettings-BAND8Zkw.mjs +1006 -0
  20. package/dist/SingleCategorySettings-Cg-zuJfr.js +3 -0
  21. package/dist/{StorefrontSection-f54ySA6i.mjs → StorefrontSection-FSOxBclu.mjs} +2 -2
  22. package/dist/{StorefrontSection-DGVcJu1T.js → StorefrontSection-QZPEZ6Lz.js} +1 -1
  23. package/dist/{SubscriptionsSection-F2IiU2jv.mjs → SubscriptionsSection-C4TDXCX2.mjs} +1 -1
  24. package/dist/{SubscriptionsSection-fzbL5DGC.js → SubscriptionsSection-DYr99VzB.js} +1 -1
  25. package/dist/Token22Section-Cmn2lKcd.mjs +1685 -0
  26. package/dist/Token22Section-D3nnUyim.js +1 -0
  27. package/dist/{WalletManager-QcfgQmap.js → WalletManager-Bwk3rgr1.js} +1 -1
  28. package/dist/{WalletManager-D78miaJ2.mjs → WalletManager-peBN6RDH.mjs} +1 -1
  29. package/dist/bn-CHdpZHQm.mjs +1185 -0
  30. package/dist/bn-RbgIlcHc.js +1 -0
  31. package/dist/configApi-Ch0Rr7TD.mjs +554 -0
  32. package/dist/configApi-CxEbCAgG.js +1 -0
  33. package/dist/crypto-only.js +1 -1
  34. package/dist/crypto-only.mjs +54 -52
  35. package/dist/{index-bqhsxBTY.mjs → index-CKNB7XsA.mjs} +6709 -5888
  36. package/dist/index-vEe2Y39x.js +84 -0
  37. package/dist/index.js +1 -1
  38. package/dist/index.mjs +34 -32
  39. package/dist/pay-react_false-CPX8Vyp9.mjs +5 -0
  40. package/dist/pay-react_false-DaeIe3_l.js +1 -0
  41. package/dist/{sections-Dh0qFSUW.js → sections-Cklkxd85.js} +1 -1
  42. package/dist/{sections-CiAMjlPd.mjs → sections-Dt6vxDU4.mjs} +1 -1
  43. package/dist/src/components/CreditsBalance.d.ts +24 -0
  44. package/dist/src/components/CreditsBalance.d.ts.map +1 -0
  45. package/dist/src/components/admin/AssetClassesTab.d.ts +20 -0
  46. package/dist/src/components/admin/AssetClassesTab.d.ts.map +1 -0
  47. package/dist/src/components/admin/AssetRedemptionManager.d.ts +21 -0
  48. package/dist/src/components/admin/AssetRedemptionManager.d.ts.map +1 -0
  49. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts +1 -1
  50. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts.map +1 -1
  51. package/dist/src/components/admin/GiftCardComplianceTab.d.ts +3 -0
  52. package/dist/src/components/admin/GiftCardComplianceTab.d.ts.map +1 -0
  53. package/dist/src/components/admin/LiquidityPoolTab.d.ts +11 -0
  54. package/dist/src/components/admin/LiquidityPoolTab.d.ts.map +1 -0
  55. package/dist/src/components/admin/OrdersSection.d.ts +3 -0
  56. package/dist/src/components/admin/OrdersSection.d.ts.map +1 -0
  57. package/dist/src/components/admin/ProductsSection.d.ts.map +1 -1
  58. package/dist/src/components/admin/RedemptionFormBuilder.d.ts +25 -0
  59. package/dist/src/components/admin/RedemptionFormBuilder.d.ts.map +1 -0
  60. package/dist/src/components/admin/Token22Section.d.ts +3 -0
  61. package/dist/src/components/admin/Token22Section.d.ts.map +1 -0
  62. package/dist/src/components/admin/configApi.d.ts.map +1 -1
  63. package/dist/src/components/admin/index.d.ts +3 -0
  64. package/dist/src/components/admin/index.d.ts.map +1 -1
  65. package/dist/src/ecommerce/adapters/mock/mockAdapter.d.ts.map +1 -1
  66. package/dist/src/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -1
  67. package/dist/src/ecommerce/components/catalog/AssetBadge.d.ts +13 -0
  68. package/dist/src/ecommerce/components/catalog/AssetBadge.d.ts.map +1 -0
  69. package/dist/src/ecommerce/components/catalog/ProductCard.d.ts.map +1 -1
  70. package/dist/src/ecommerce/components/checkout/CheckoutForm.d.ts.map +1 -1
  71. package/dist/src/ecommerce/components/checkout/CheckoutReceipt.d.ts +9 -2
  72. package/dist/src/ecommerce/components/checkout/CheckoutReceipt.d.ts.map +1 -1
  73. package/dist/src/ecommerce/components/checkout/CheckoutSuccessPage.d.ts +7 -1
  74. package/dist/src/ecommerce/components/checkout/CheckoutSuccessPage.d.ts.map +1 -1
  75. package/dist/src/ecommerce/components/checkout/RedemptionForm.d.ts +22 -0
  76. package/dist/src/ecommerce/components/checkout/RedemptionForm.d.ts.map +1 -0
  77. package/dist/src/ecommerce/components/gift-cards/GiftCardRedemptionPage.d.ts +36 -0
  78. package/dist/src/ecommerce/components/gift-cards/GiftCardRedemptionPage.d.ts.map +1 -0
  79. package/dist/src/ecommerce/components/orders/OrderCard.d.ts.map +1 -1
  80. package/dist/src/ecommerce/components/orders/OrderDetails.d.ts +5 -1
  81. package/dist/src/ecommerce/components/orders/OrderDetails.d.ts.map +1 -1
  82. package/dist/src/ecommerce/index.d.ts +6 -0
  83. package/dist/src/ecommerce/index.d.ts.map +1 -1
  84. package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts +1 -0
  85. package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts.map +1 -1
  86. package/dist/src/ecommerce/state/checkout/useCheckout.d.ts.map +1 -1
  87. package/dist/src/ecommerce/templates/ProductTemplate.d.ts.map +1 -1
  88. package/dist/src/ecommerce/templates/PurchaseHistoryTemplate.d.ts +5 -1
  89. package/dist/src/ecommerce/templates/PurchaseHistoryTemplate.d.ts.map +1 -1
  90. package/dist/src/ecommerce/types.d.ts +20 -0
  91. package/dist/src/ecommerce/types.d.ts.map +1 -1
  92. package/dist/src/ecommerce/utils/cartItemMetadata.d.ts.map +1 -1
  93. package/dist/src/ecommerce/utils/safeHref.d.ts +9 -0
  94. package/dist/src/ecommerce/utils/safeHref.d.ts.map +1 -0
  95. package/dist/src/hooks/useCreditsBalance.d.ts +32 -0
  96. package/dist/src/hooks/useCreditsBalance.d.ts.map +1 -0
  97. package/dist/src/index.d.ts +4 -0
  98. package/dist/src/index.d.ts.map +1 -1
  99. package/dist/src/managers/CreditsManager.d.ts +15 -0
  100. package/dist/src/managers/CreditsManager.d.ts.map +1 -1
  101. package/dist/src/managers/MeteoraPoolManager.d.ts +86 -0
  102. package/dist/src/managers/MeteoraPoolManager.d.ts.map +1 -0
  103. package/dist/stripe-only.js +1 -1
  104. package/dist/stripe-only.mjs +2 -2
  105. package/dist/{styles-BWrLnaUW.js → styles-21F1-oqx.js} +1 -1
  106. package/dist/{styles--eKKnfdj.mjs → styles-2VMpwuaI.mjs} +3 -3
  107. package/dist/testing/index.js +1 -1
  108. package/dist/testing/index.mjs +1 -1
  109. package/dist/{walletPool-BqNfOhB0.js → walletPool-Ddv33tej.js} +1 -1
  110. package/dist/{walletPool-DShNjCQ6.mjs → walletPool-DgQsh7Se.mjs} +1 -1
  111. package/package.json +5 -1
  112. package/dist/SingleCategorySettings-DhHGIGwB.mjs +0 -1418
  113. package/dist/SingleCategorySettings-DxjCafCk.js +0 -3
  114. package/dist/index-7YUxR4u5.js +0 -84
@@ -0,0 +1,1685 @@
1
+ import { jsxs as t, jsx as e, Fragment as O } from "react/jsx-runtime";
2
+ import { useState as y, useCallback as D, useEffect as J, useRef as we } from "react";
3
+ import { E as ke, I as Te } from "./index-CKNB7XsA.mjs";
4
+ import { a as de } from "./configApi-Ch0Rr7TD.mjs";
5
+ const _e = [
6
+ { value: "text", label: "Short Text" },
7
+ { value: "email", label: "Email" },
8
+ { value: "phone", label: "Phone" },
9
+ { value: "address", label: "Address" },
10
+ { value: "textarea", label: "Long Text" },
11
+ { value: "dropdown", label: "Dropdown" },
12
+ { value: "file_upload", label: "File Upload" }
13
+ ], ge = { fields: [], requiresApproval: !0 }, W = { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem", boxSizing: "border-box" }, Y = { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, H = { padding: "0.4rem 1rem", borderRadius: 6, border: "1px solid rgba(0,0,0,0.2)", background: "white", cursor: "pointer", fontSize: "0.85rem" };
14
+ function Ae() {
15
+ return { id: Math.random().toString(36).slice(2), label: "", fieldType: "text", required: !1, options: [], placeholder: "" };
16
+ }
17
+ function ye({ field: n, onSave: i, onCancel: r }) {
18
+ const [a, l] = y(n), [s, m] = y(""), u = (d) => l((h) => ({ ...h, ...d })), f = () => {
19
+ const d = s.trim();
20
+ d && (u({ options: [...a.options, d] }), m(""));
21
+ };
22
+ return /* @__PURE__ */ t("div", { style: { padding: "0.75rem", border: "1px solid rgba(37,99,235,0.3)", borderRadius: 6, background: "#eff6ff", marginTop: 6 }, children: [
23
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.6rem", marginBottom: "0.6rem" }, children: [
24
+ /* @__PURE__ */ t("div", { children: [
25
+ /* @__PURE__ */ e("label", { style: Y, children: "Label *" }),
26
+ /* @__PURE__ */ e("input", { style: W, value: a.label, onChange: (d) => u({ label: d.target.value }), placeholder: "e.g., Full Name" })
27
+ ] }),
28
+ /* @__PURE__ */ t("div", { children: [
29
+ /* @__PURE__ */ e("label", { style: Y, children: "Field Type" }),
30
+ /* @__PURE__ */ e("select", { style: W, value: a.fieldType, onChange: (d) => u({ fieldType: d.target.value, options: [] }), children: _e.map((d) => /* @__PURE__ */ e("option", { value: d.value, children: d.label }, d.value)) })
31
+ ] })
32
+ ] }),
33
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr auto", gap: "0.6rem", alignItems: "end", marginBottom: "0.6rem" }, children: [
34
+ /* @__PURE__ */ t("div", { children: [
35
+ /* @__PURE__ */ e("label", { style: Y, children: "Placeholder" }),
36
+ /* @__PURE__ */ e("input", { style: W, value: a.placeholder ?? "", onChange: (d) => u({ placeholder: d.target.value }), placeholder: "Optional hint text" })
37
+ ] }),
38
+ /* @__PURE__ */ t("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: "0.85rem", cursor: "pointer", paddingBottom: 2 }, children: [
39
+ /* @__PURE__ */ e("input", { type: "checkbox", checked: a.required, onChange: (d) => u({ required: d.target.checked }) }),
40
+ " Required"
41
+ ] })
42
+ ] }),
43
+ a.fieldType === "dropdown" && /* @__PURE__ */ t("div", { style: { marginBottom: "0.6rem" }, children: [
44
+ /* @__PURE__ */ e("label", { style: Y, children: "Options" }),
45
+ a.options.map((d, h) => /* @__PURE__ */ t("div", { style: { display: "flex", gap: 6, marginBottom: 4 }, children: [
46
+ /* @__PURE__ */ e("span", { style: { flex: 1, fontSize: "0.85rem", padding: "0.25rem 0.5rem", background: "white", border: "1px solid rgba(0,0,0,0.15)", borderRadius: 4 }, children: d }),
47
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => u({ options: a.options.filter((v, x) => x !== h) }), style: { padding: "0.2rem 0.5rem", borderRadius: 4, border: "1px solid rgba(0,0,0,0.2)", background: "white", cursor: "pointer", fontSize: "0.8rem", color: "#dc2626" }, children: "x" })
48
+ ] }, h)),
49
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: 6 }, children: [
50
+ /* @__PURE__ */ e("input", { style: { ...W, flex: 1 }, value: s, onChange: (d) => m(d.target.value), onKeyDown: (d) => d.key === "Enter" && (d.preventDefault(), f()), placeholder: "Add option..." }),
51
+ /* @__PURE__ */ e("button", { type: "button", onClick: f, style: H, children: "Add" })
52
+ ] })
53
+ ] }),
54
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: 6 }, children: [
55
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => i(a), disabled: !a.label.trim(), style: { padding: "0.35rem 1rem", borderRadius: 6, border: "none", background: "#2563eb", color: "white", cursor: a.label.trim() ? "pointer" : "not-allowed", fontSize: "0.85rem", opacity: a.label.trim() ? 1 : 0.5 }, children: "Save Field" }),
56
+ /* @__PURE__ */ e("button", { type: "button", onClick: r, style: H, children: "Cancel" })
57
+ ] })
58
+ ] });
59
+ }
60
+ function Ne({ fields: n, instructions: i }) {
61
+ const r = { ...W, fontSize: "0.85rem", background: "white", opacity: 0.6 };
62
+ return /* @__PURE__ */ t("div", { style: { padding: "1rem", border: "1px solid rgba(0,0,0,0.1)", borderRadius: 8, background: "rgba(0,0,0,0.02)" }, children: [
63
+ /* @__PURE__ */ e("div", { style: { fontSize: "0.75rem", fontWeight: 600, color: "rgba(0,0,0,0.4)", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: "0.75rem" }, children: "Preview — Redeemer View" }),
64
+ i && /* @__PURE__ */ e("div", { style: { padding: "0.6rem 0.75rem", background: "#fffbeb", border: "1px solid #fcd34d", borderRadius: 6, fontSize: "0.85rem", marginBottom: "0.75rem", color: "#92400e" }, children: i }),
65
+ n.length === 0 && /* @__PURE__ */ e("div", { style: { fontSize: "0.85rem", color: "rgba(0,0,0,0.35)", fontStyle: "italic" }, children: "No fields added yet." }),
66
+ n.map((a) => /* @__PURE__ */ t("div", { style: { marginBottom: "0.6rem" }, children: [
67
+ /* @__PURE__ */ t("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: [
68
+ a.label || "Unlabelled field",
69
+ a.required && /* @__PURE__ */ e("span", { style: { color: "#dc2626", marginLeft: 2 }, children: "*" })
70
+ ] }),
71
+ a.fieldType === "textarea" && /* @__PURE__ */ e("textarea", { disabled: !0, rows: 2, placeholder: a.placeholder ?? "", style: { ...r, resize: "none" } }),
72
+ a.fieldType === "file_upload" && /* @__PURE__ */ e("div", { style: { padding: "0.5rem", border: "1px dashed rgba(0,0,0,0.25)", borderRadius: 4, fontSize: "0.8rem", color: "rgba(0,0,0,0.4)", textAlign: "center" }, children: "File upload" }),
73
+ a.fieldType === "dropdown" && /* @__PURE__ */ t("select", { disabled: !0, style: r, children: [
74
+ /* @__PURE__ */ e("option", { children: a.placeholder || "Select..." }),
75
+ a.options.map((l, s) => /* @__PURE__ */ e("option", { children: l }, s))
76
+ ] }),
77
+ !["textarea", "file_upload", "dropdown"].includes(a.fieldType) && /* @__PURE__ */ e("input", { disabled: !0, type: a.fieldType === "email" ? "email" : a.fieldType === "phone" ? "tel" : "text", placeholder: a.placeholder ?? "", style: r })
78
+ ] }, a.id))
79
+ ] });
80
+ }
81
+ function ze({ value: n, onChange: i }) {
82
+ const r = n !== null, a = n ?? ge, [l, s] = y(null), [m, u] = y(null), [f, d] = y(!1), h = (p) => i({ ...a, ...p }), v = () => {
83
+ s(null), u(null);
84
+ }, x = (p) => {
85
+ i(p ? { ...ge } : null), v();
86
+ }, _ = () => {
87
+ const p = Ae();
88
+ u(p), s("new");
89
+ }, g = (p) => {
90
+ u({ ...p }), s(p.id);
91
+ }, S = (p) => {
92
+ h({ fields: l === "new" ? [...a.fields, p] : a.fields.map((k) => k.id === p.id ? p : k) }), v();
93
+ }, T = (p) => {
94
+ l === p && v(), h({ fields: a.fields.filter((k) => k.id !== p) });
95
+ };
96
+ return /* @__PURE__ */ t("div", { children: [
97
+ /* @__PURE__ */ t("label", { style: { display: "flex", alignItems: "center", gap: 8, cursor: "pointer", marginBottom: r ? "1rem" : 4, fontSize: "0.9rem", fontWeight: 500 }, children: [
98
+ /* @__PURE__ */ e("input", { type: "checkbox", checked: r, onChange: (p) => x(p.target.checked) }),
99
+ "Enable Redemption Form"
100
+ ] }),
101
+ !r && /* @__PURE__ */ e("div", { style: { fontSize: "0.8rem", color: "rgba(0,0,0,0.4)" }, children: "No redemption form — token holders cannot request physical redemption." }),
102
+ r && /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
103
+ /* @__PURE__ */ t("div", { children: [
104
+ /* @__PURE__ */ e("label", { style: Y, children: "Instructions shown to redeemer" }),
105
+ /* @__PURE__ */ e("textarea", { value: a.instructions ?? "", onChange: (p) => h({ instructions: p.target.value || void 0 }), placeholder: "Describe requirements, turnaround times, etc.", rows: 3, style: { ...W, resize: "vertical" } })
106
+ ] }),
107
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "auto 1fr", gap: "1rem", alignItems: "center", padding: "0.6rem 0.75rem", border: "1px solid rgba(0,0,0,0.1)", borderRadius: 6, background: "rgba(0,0,0,0.02)" }, children: [
108
+ /* @__PURE__ */ t("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: "0.85rem", cursor: "pointer", whiteSpace: "nowrap" }, children: [
109
+ /* @__PURE__ */ e("input", { type: "checkbox", checked: a.requiresApproval, onChange: (p) => h({ requiresApproval: p.target.checked }) }),
110
+ " Requires admin approval"
111
+ ] }),
112
+ /* @__PURE__ */ t("div", { children: [
113
+ /* @__PURE__ */ e("label", { style: Y, children: "Estimated processing days" }),
114
+ /* @__PURE__ */ e("input", { type: "number", min: 0, value: a.estimatedProcessingDays ?? "", onChange: (p) => h({ estimatedProcessingDays: p.target.value ? Number(p.target.value) : void 0 }), placeholder: "e.g., 5", style: { ...W, maxWidth: 120 } })
115
+ ] })
116
+ ] }),
117
+ /* @__PURE__ */ t("div", { children: [
118
+ /* @__PURE__ */ t("div", { style: { fontSize: "0.8rem", fontWeight: 500, marginBottom: "0.5rem" }, children: [
119
+ "Form Fields (",
120
+ a.fields.length,
121
+ ")"
122
+ ] }),
123
+ a.fields.length === 0 && l !== "new" && /* @__PURE__ */ e("div", { style: { fontSize: "0.85rem", color: "rgba(0,0,0,0.35)", fontStyle: "italic", marginBottom: "0.5rem" }, children: "No fields yet. Add fields below." }),
124
+ /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "0.4rem" }, children: [
125
+ a.fields.map((p) => /* @__PURE__ */ t("div", { children: [
126
+ /* @__PURE__ */ t("div", { style: { padding: "0.5rem 0.75rem", border: "1px solid rgba(0,0,0,0.1)", borderRadius: 6, background: "white", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
127
+ /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
128
+ /* @__PURE__ */ e("span", { style: { fontSize: "0.9rem" }, children: p.label || /* @__PURE__ */ e("em", { style: { color: "rgba(0,0,0,0.35)" }, children: "Unlabelled" }) }),
129
+ /* @__PURE__ */ e("span", { style: { padding: "2px 8px", borderRadius: 10, background: "#dbeafe", color: "#1d4ed8", fontSize: "0.75rem" }, children: _e.find((k) => k.value === p.fieldType)?.label ?? p.fieldType }),
130
+ p.required && /* @__PURE__ */ e("span", { style: { padding: "2px 8px", borderRadius: 10, background: "#fef3c7", color: "#92400e", fontSize: "0.75rem" }, children: "required" })
131
+ ] }),
132
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: 4 }, children: [
133
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => g(p), style: { ...H, padding: "0.25rem 0.6rem", fontSize: "0.8rem" }, children: "Edit" }),
134
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => T(p.id), style: { padding: "0.25rem 0.6rem", borderRadius: 4, border: "1px solid rgba(220,38,38,0.3)", background: "white", cursor: "pointer", fontSize: "0.8rem", color: "#dc2626" }, children: "Delete" })
135
+ ] })
136
+ ] }),
137
+ l === p.id && m && /* @__PURE__ */ e(ye, { field: m, onSave: S, onCancel: v })
138
+ ] }, p.id)),
139
+ l === "new" && m && /* @__PURE__ */ e(ye, { field: m, onSave: S, onCancel: v })
140
+ ] }),
141
+ l === null && /* @__PURE__ */ e("button", { type: "button", onClick: _, style: { ...H, marginTop: "0.5rem" }, children: "+ Add Field" })
142
+ ] }),
143
+ /* @__PURE__ */ t("div", { children: [
144
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => d((p) => !p), style: { ...H, background: f ? "rgba(0,0,0,0.05)" : "white" }, children: f ? "Hide Preview" : "Show Preview" }),
145
+ f && /* @__PURE__ */ e("div", { style: { marginTop: "0.75rem" }, children: /* @__PURE__ */ e(Ne, { fields: a.fields, instructions: a.instructions }) })
146
+ ] })
147
+ ] })
148
+ ] });
149
+ }
150
+ const Be = [
151
+ { value: "securities", label: "Securities (fungible)" },
152
+ { value: "commodities", label: "Commodities (fungible)" },
153
+ { value: "property", label: "Property (non-fungible)" },
154
+ { value: "collectibles", label: "Collectibles (non-fungible)" }
155
+ ], Pe = (n) => n === "securities" || n === "commodities";
156
+ function De({ c: n, onDeployPool: i, onEdit: r, onDelete: a }) {
157
+ const l = n.tokenizationConfig, s = Pe(l.assetClass);
158
+ return /* @__PURE__ */ t("div", { style: { padding: "0.75rem 1rem", border: "1px solid rgba(0,0,0,0.1)", borderRadius: 8, background: "white" }, children: [
159
+ /* @__PURE__ */ t("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
160
+ /* @__PURE__ */ t("div", { children: [
161
+ /* @__PURE__ */ e("strong", { children: n.name }),
162
+ /* @__PURE__ */ e("span", { style: { marginLeft: 8, fontSize: "0.8rem", padding: "2px 8px", borderRadius: 10, background: s ? "#dbeafe" : "#fef3c7", color: s ? "#1d4ed8" : "#92400e" }, children: l.assetClass }),
163
+ l.tokenSymbol && /* @__PURE__ */ e("span", { style: { marginLeft: 6, fontSize: "0.8rem", color: "rgba(0,0,0,0.5)" }, children: l.tokenSymbol })
164
+ ] }),
165
+ /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: 8, fontSize: "0.8rem" }, children: [
166
+ l.mintAddress ? /* @__PURE__ */ e("span", { style: { color: "#16a34a" }, children: "Mint initialized" }) : /* @__PURE__ */ e("span", { style: { color: "rgba(0,0,0,0.4)" }, children: "No mint" }),
167
+ s && l.mintAddress && (l.liquidityPoolAddress ? /* @__PURE__ */ t("span", { style: { padding: "2px 8px", borderRadius: 10, background: "#dcfce7", color: "#15803d", fontSize: "0.75rem" }, children: [
168
+ "Pool Active · ",
169
+ l.liquidityPoolAddress.slice(0, 4),
170
+ "...",
171
+ l.liquidityPoolAddress.slice(-4)
172
+ ] }) : /* @__PURE__ */ e(
173
+ "button",
174
+ {
175
+ type: "button",
176
+ onClick: i,
177
+ style: { padding: 0, border: "none", background: "none", color: "#2563eb", cursor: "pointer", fontSize: "0.8rem", textDecoration: "underline" },
178
+ children: "Deploy Pool"
179
+ }
180
+ ))
181
+ ] })
182
+ ] }),
183
+ n.description && /* @__PURE__ */ e("div", { style: { fontSize: "0.85rem", color: "rgba(0,0,0,0.5)", marginTop: 4 }, children: n.description }),
184
+ /* @__PURE__ */ t("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginTop: 6 }, children: [
185
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: "1rem", flexWrap: "wrap", fontSize: "0.8rem", color: "rgba(0,0,0,0.4)" }, children: [
186
+ /* @__PURE__ */ t("span", { children: [
187
+ "Fee: ",
188
+ l.transferFeeBps,
189
+ " bps"
190
+ ] }),
191
+ l.treasuryAddress && /* @__PURE__ */ t("span", { children: [
192
+ "Treasury: ",
193
+ l.treasuryAddress.slice(0, 8),
194
+ "..."
195
+ ] }),
196
+ l.allowedJurisdictions?.length > 0 && /* @__PURE__ */ t("span", { style: { padding: "1px 7px", borderRadius: 10, background: "#f3f4f6", color: "rgba(0,0,0,0.55)" }, children: [
197
+ l.allowedJurisdictions.length,
198
+ " jurisdiction",
199
+ l.allowedJurisdictions.length !== 1 ? "s" : "",
200
+ ": ",
201
+ l.allowedJurisdictions.join(", ")
202
+ ] })
203
+ ] }),
204
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: 6 }, children: [
205
+ r && /* @__PURE__ */ e("button", { type: "button", onClick: r, style: { padding: "2px 10px", border: "1px solid rgba(0,0,0,0.15)", borderRadius: 4, background: "white", cursor: "pointer", fontSize: "0.75rem", color: "#2563eb" }, children: "Edit" }),
206
+ a && /* @__PURE__ */ e("button", { type: "button", onClick: a, style: { padding: "2px 10px", border: "1px solid rgba(0,0,0,0.15)", borderRadius: 4, background: "white", cursor: "pointer", fontSize: "0.75rem", color: "#dc2626" }, children: "Delete" })
207
+ ] })
208
+ ] })
209
+ ] });
210
+ }
211
+ const le = {
212
+ name: "",
213
+ description: "",
214
+ assetClass: "securities",
215
+ tokenSymbol: "",
216
+ tokenDecimals: 2,
217
+ transferFeeBps: 250,
218
+ maxTransferFee: 500,
219
+ treasuryAddress: "",
220
+ regulatoryNotice: "",
221
+ jurisdictions: "",
222
+ redemptionConfig: null
223
+ };
224
+ function Me({ serverUrl: n, apiKey: i, authManager: r, onNavigateToLiquidity: a }) {
225
+ const [l, s] = y([]), [m, u] = y(!0), [f, d] = y(null), [h, v] = y(!1), [x, _] = y(!1), [g, S] = y(le), [T, p] = y(null), k = D(async (c, b) => {
226
+ if (r?.isAuthenticated())
227
+ return r.fetchWithAuth(c, b);
228
+ const F = { "Content-Type": "application/json" };
229
+ i && (F["X-API-Key"] = i);
230
+ const C = await fetch(`${n}${c}`, { ...b, headers: { ...F, ...b?.headers } });
231
+ if (!C.ok) {
232
+ const B = await C.text().catch(() => `HTTP ${C.status}`);
233
+ throw new Error(B);
234
+ }
235
+ return C.json();
236
+ }, [n, i, r]), A = D(async () => {
237
+ try {
238
+ u(!0), d(null);
239
+ const c = await k("/admin/collections");
240
+ s((c.collections || []).filter((b) => b.tokenizationConfig));
241
+ } catch (c) {
242
+ d(c instanceof Error ? c.message : "Failed to load asset classes");
243
+ } finally {
244
+ u(!1);
245
+ }
246
+ }, [k]);
247
+ J(() => {
248
+ A();
249
+ }, [A]);
250
+ const o = () => ({
251
+ name: g.name.trim(),
252
+ description: g.description || void 0,
253
+ active: !0,
254
+ productIds: [],
255
+ tokenizationConfig: {
256
+ assetClass: g.assetClass,
257
+ tokenSymbol: g.tokenSymbol || void 0,
258
+ tokenDecimals: g.tokenDecimals,
259
+ transferFeeBps: g.transferFeeBps,
260
+ maxTransferFee: g.maxTransferFee,
261
+ treasuryAddress: g.treasuryAddress || void 0,
262
+ regulatoryNotice: g.regulatoryNotice || void 0,
263
+ allowedJurisdictions: g.jurisdictions ? g.jurisdictions.split(",").map((c) => c.trim().toUpperCase()).filter(Boolean) : [],
264
+ redemptionConfig: g.redemptionConfig || void 0
265
+ }
266
+ }), w = async () => {
267
+ if (g.name.trim()) {
268
+ _(!0), d(null);
269
+ try {
270
+ T ? await k(`/admin/collections/${encodeURIComponent(T)}`, {
271
+ method: "PUT",
272
+ body: JSON.stringify(o())
273
+ }) : await k("/admin/collections", {
274
+ method: "POST",
275
+ body: JSON.stringify(o())
276
+ }), S(le), v(!1), p(null), await A();
277
+ } catch (c) {
278
+ d(c instanceof Error ? c.message : `Failed to ${T ? "update" : "create"} asset class`);
279
+ } finally {
280
+ _(!1);
281
+ }
282
+ }
283
+ }, z = (c) => {
284
+ const b = c.tokenizationConfig;
285
+ S({
286
+ name: c.name,
287
+ description: c.description ?? "",
288
+ assetClass: b.assetClass,
289
+ tokenSymbol: b.tokenSymbol ?? "",
290
+ tokenDecimals: b.tokenDecimals,
291
+ transferFeeBps: b.transferFeeBps,
292
+ maxTransferFee: b.maxTransferFee,
293
+ treasuryAddress: b.treasuryAddress ?? "",
294
+ regulatoryNotice: b.regulatoryNotice ?? "",
295
+ jurisdictions: b.allowedJurisdictions.join(", "),
296
+ redemptionConfig: null
297
+ }), p(c.id), v(!0);
298
+ }, N = async (c) => {
299
+ if (window.confirm(`Delete asset class "${c.name}"? This cannot be undone.`)) {
300
+ d(null);
301
+ try {
302
+ await k(`/admin/collections/${encodeURIComponent(c.id)}`, { method: "DELETE" }), await A();
303
+ } catch (b) {
304
+ d(b instanceof Error ? b.message : "Failed to delete asset class");
305
+ }
306
+ }
307
+ };
308
+ return m ? /* @__PURE__ */ e("div", { style: { padding: "1rem 0", color: "rgba(0,0,0,0.5)" }, children: "Loading asset classes..." }) : /* @__PURE__ */ t("div", { children: [
309
+ f && /* @__PURE__ */ e("div", { style: { padding: "0.75rem 1rem", background: "#fef2f2", border: "1px solid #fecaca", borderRadius: 6, color: "#dc2626", marginBottom: "1rem", fontSize: "0.9rem" }, children: f }),
310
+ /* @__PURE__ */ t("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "1rem" }, children: [
311
+ /* @__PURE__ */ t("h4", { style: { margin: 0 }, children: [
312
+ "Asset Classes (",
313
+ l.length,
314
+ ")"
315
+ ] }),
316
+ /* @__PURE__ */ e(
317
+ "button",
318
+ {
319
+ type: "button",
320
+ onClick: () => {
321
+ v(!h), h && (p(null), S(le));
322
+ },
323
+ style: { padding: "0.4rem 1rem", borderRadius: 6, border: "1px solid rgba(0,0,0,0.2)", background: h ? "rgba(0,0,0,0.05)" : "white", cursor: "pointer", fontSize: "0.85rem" },
324
+ children: h ? "Cancel" : "+ New Asset Class"
325
+ }
326
+ )
327
+ ] }),
328
+ h && /* @__PURE__ */ t("div", { style: { padding: "1rem", border: "1px solid rgba(0,0,0,0.1)", borderRadius: 8, marginBottom: "1rem", background: "rgba(0,0,0,0.02)" }, children: [
329
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.75rem", marginBottom: "0.75rem" }, children: [
330
+ /* @__PURE__ */ t("div", { children: [
331
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Name *" }),
332
+ /* @__PURE__ */ e(
333
+ "input",
334
+ {
335
+ type: "text",
336
+ value: g.name,
337
+ onChange: (c) => S((b) => ({ ...b, name: c.target.value })),
338
+ placeholder: "e.g., Gold Tokens",
339
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem" }
340
+ }
341
+ )
342
+ ] }),
343
+ /* @__PURE__ */ t("div", { children: [
344
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Asset Class *" }),
345
+ /* @__PURE__ */ e(
346
+ "select",
347
+ {
348
+ value: g.assetClass,
349
+ onChange: (c) => S((b) => ({ ...b, assetClass: c.target.value })),
350
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem" },
351
+ children: Be.map((c) => /* @__PURE__ */ e("option", { value: c.value, children: c.label }, c.value))
352
+ }
353
+ )
354
+ ] })
355
+ ] }),
356
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: "0.75rem", marginBottom: "0.75rem" }, children: [
357
+ /* @__PURE__ */ t("div", { children: [
358
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Token Symbol" }),
359
+ /* @__PURE__ */ e(
360
+ "input",
361
+ {
362
+ type: "text",
363
+ value: g.tokenSymbol,
364
+ onChange: (c) => S((b) => ({ ...b, tokenSymbol: c.target.value })),
365
+ placeholder: "e.g., GOLD",
366
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem" }
367
+ }
368
+ )
369
+ ] }),
370
+ /* @__PURE__ */ t("div", { children: [
371
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Transfer Fee (bps)" }),
372
+ /* @__PURE__ */ e(
373
+ "input",
374
+ {
375
+ type: "number",
376
+ value: g.transferFeeBps,
377
+ onChange: (c) => S((b) => ({ ...b, transferFeeBps: Number(c.target.value) })),
378
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem" }
379
+ }
380
+ )
381
+ ] }),
382
+ /* @__PURE__ */ t("div", { children: [
383
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Treasury Address" }),
384
+ /* @__PURE__ */ e(
385
+ "input",
386
+ {
387
+ type: "text",
388
+ value: g.treasuryAddress,
389
+ onChange: (c) => S((b) => ({ ...b, treasuryAddress: c.target.value })),
390
+ placeholder: "Solana address",
391
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem" }
392
+ }
393
+ )
394
+ ] })
395
+ ] }),
396
+ /* @__PURE__ */ t("div", { style: { marginBottom: "0.75rem" }, children: [
397
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Allowed Jurisdictions" }),
398
+ /* @__PURE__ */ e(
399
+ "input",
400
+ {
401
+ type: "text",
402
+ value: g.jurisdictions,
403
+ onChange: (c) => S((b) => ({ ...b, jurisdictions: c.target.value })),
404
+ placeholder: "US, CA, GB (comma-separated, leave empty for all)",
405
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem" }
406
+ }
407
+ )
408
+ ] }),
409
+ /* @__PURE__ */ t("div", { style: { marginBottom: "0.75rem" }, children: [
410
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Regulatory Notice" }),
411
+ /* @__PURE__ */ e(
412
+ "textarea",
413
+ {
414
+ value: g.regulatoryNotice,
415
+ onChange: (c) => S((b) => ({ ...b, regulatoryNotice: c.target.value })),
416
+ placeholder: "Shown to buyers before purchase",
417
+ rows: 2,
418
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem", resize: "vertical" }
419
+ }
420
+ )
421
+ ] }),
422
+ /* @__PURE__ */ t("div", { style: { marginBottom: "0.75rem" }, children: [
423
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 600, marginBottom: 8 }, children: "Redemption Form" }),
424
+ /* @__PURE__ */ e(
425
+ ze,
426
+ {
427
+ value: g.redemptionConfig,
428
+ onChange: (c) => S((b) => ({ ...b, redemptionConfig: c }))
429
+ }
430
+ )
431
+ ] }),
432
+ /* @__PURE__ */ e(
433
+ "button",
434
+ {
435
+ type: "button",
436
+ onClick: w,
437
+ disabled: x || !g.name.trim(),
438
+ style: { padding: "0.5rem 1.5rem", borderRadius: 6, border: "none", background: "#2563eb", color: "white", cursor: x ? "wait" : "pointer", fontSize: "0.9rem", opacity: x ? 0.6 : 1 },
439
+ children: x ? "Saving..." : T ? "Save Changes" : "Create Asset Class"
440
+ }
441
+ )
442
+ ] }),
443
+ l.length === 0 ? /* @__PURE__ */ e("div", { style: { padding: "2rem", textAlign: "center", color: "rgba(0,0,0,0.4)", fontSize: "0.9rem" }, children: "No asset classes configured. Create one to start tokenizing off-chain assets." }) : /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: l.map((c) => /* @__PURE__ */ e(
444
+ De,
445
+ {
446
+ c,
447
+ onDeployPool: a,
448
+ onEdit: () => z(c),
449
+ onDelete: () => N(c)
450
+ },
451
+ c.id
452
+ )) })
453
+ ] });
454
+ }
455
+ const Ie = [
456
+ { value: "", label: "All statuses" },
457
+ { value: "pending_info", label: "Pending Info" },
458
+ { value: "info_submitted", label: "Info Submitted" },
459
+ { value: "under_review", label: "Under Review" },
460
+ { value: "approved", label: "Approved" },
461
+ { value: "completed", label: "Completed" },
462
+ { value: "rejected", label: "Rejected" }
463
+ ];
464
+ function Re(n) {
465
+ switch (n) {
466
+ case "pending_info":
467
+ return "cedros-admin__badge cedros-admin__badge--muted";
468
+ case "info_submitted":
469
+ return "cedros-admin__badge cedros-admin__badge--info";
470
+ case "under_review":
471
+ return "cedros-admin__badge cedros-admin__badge--warning";
472
+ case "approved":
473
+ return "cedros-admin__badge cedros-admin__badge--success";
474
+ case "completed":
475
+ return "cedros-admin__badge cedros-admin__badge--success";
476
+ case "rejected":
477
+ return "cedros-admin__badge cedros-admin__badge--failed";
478
+ default:
479
+ return "cedros-admin__badge cedros-admin__badge--muted";
480
+ }
481
+ }
482
+ function Fe(n) {
483
+ return n.replace(/_/g, " ").replace(/\b\w/g, (i) => i.toUpperCase());
484
+ }
485
+ function Le(n) {
486
+ return new Date(n).toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
487
+ }
488
+ function U(n) {
489
+ return n.length > 12 ? `${n.slice(0, 8)}…` : n;
490
+ }
491
+ function fe(n) {
492
+ return `https://solscan.io/tx/${n}`;
493
+ }
494
+ function Ee({ redemption: n, onAction: i, onComplete: r, actionBusy: a }) {
495
+ const [l, s] = y(n.adminNotes ?? ""), m = Object.entries(n.formData ?? {});
496
+ return /* @__PURE__ */ e("div", { style: { padding: "1rem 1.25rem", background: "rgba(0,0,0,0.02)", borderTop: "1px solid rgba(0,0,0,0.08)" }, children: /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "1.5rem" }, children: [
497
+ /* @__PURE__ */ t("div", { children: [
498
+ /* @__PURE__ */ e("div", { style: { fontWeight: 600, fontSize: "0.8rem", marginBottom: 8, textTransform: "uppercase", letterSpacing: "0.05em", opacity: 0.6 }, children: "Form Data" }),
499
+ m.length === 0 ? /* @__PURE__ */ e("div", { style: { fontSize: "0.85rem", opacity: 0.5 }, children: "No form data submitted." }) : /* @__PURE__ */ e("dl", { style: { margin: 0, display: "grid", gridTemplateColumns: "auto 1fr", gap: "4px 12px", fontSize: "0.85rem" }, children: m.map(([u, f]) => /* @__PURE__ */ t(O, { children: [
500
+ /* @__PURE__ */ e("dt", { style: { fontWeight: 500, color: "rgba(0,0,0,0.6)", whiteSpace: "nowrap" }, children: u }, `k-${u}`),
501
+ /* @__PURE__ */ e("dd", { style: { margin: 0, wordBreak: "break-word" }, children: String(f ?? "—") }, `v-${u}`)
502
+ ] })) }),
503
+ (n.tokenMintSignature || n.tokenBurnSignature) && /* @__PURE__ */ t("div", { style: { marginTop: 12, fontSize: "0.8rem" }, children: [
504
+ /* @__PURE__ */ e("div", { style: { fontWeight: 600, marginBottom: 4, opacity: 0.6, textTransform: "uppercase", letterSpacing: "0.05em" }, children: "Signatures" }),
505
+ n.tokenMintSignature && /* @__PURE__ */ t("div", { children: [
506
+ "Mint:",
507
+ " ",
508
+ /* @__PURE__ */ e("a", { href: fe(n.tokenMintSignature), target: "_blank", rel: "noopener noreferrer", style: { fontFamily: "monospace", fontSize: "0.75rem" }, children: U(n.tokenMintSignature) })
509
+ ] }),
510
+ n.tokenBurnSignature && /* @__PURE__ */ t("div", { children: [
511
+ "Burn:",
512
+ " ",
513
+ /* @__PURE__ */ e("a", { href: fe(n.tokenBurnSignature), target: "_blank", rel: "noopener noreferrer", style: { fontFamily: "monospace", fontSize: "0.75rem" }, children: U(n.tokenBurnSignature) })
514
+ ] })
515
+ ] })
516
+ ] }),
517
+ /* @__PURE__ */ t("div", { children: [
518
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Admin Notes" }),
519
+ /* @__PURE__ */ e(
520
+ "textarea",
521
+ {
522
+ value: l,
523
+ onChange: (u) => s(u.target.value),
524
+ rows: 4,
525
+ style: { width: "100%", padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.85rem", resize: "vertical", boxSizing: "border-box" },
526
+ placeholder: "Internal notes (not shown to user)..."
527
+ }
528
+ ),
529
+ /* @__PURE__ */ t("div", { style: { display: "flex", gap: "0.5rem", marginTop: 8, flexWrap: "wrap" }, children: [
530
+ n.status === "info_submitted" && /* @__PURE__ */ e(
531
+ "button",
532
+ {
533
+ className: "cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",
534
+ disabled: a,
535
+ onClick: () => i(n.id, "under_review", l),
536
+ children: a ? "Saving..." : "Mark Under Review"
537
+ }
538
+ ),
539
+ n.status === "under_review" && /* @__PURE__ */ t(O, { children: [
540
+ /* @__PURE__ */ e(
541
+ "button",
542
+ {
543
+ className: "cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",
544
+ disabled: a,
545
+ onClick: () => i(n.id, "approved", l),
546
+ children: a ? "Saving..." : "Approve"
547
+ }
548
+ ),
549
+ /* @__PURE__ */ e(
550
+ "button",
551
+ {
552
+ className: "cedros-admin__button cedros-admin__button--outline cedros-admin__button--danger cedros-admin__button--sm",
553
+ disabled: a,
554
+ onClick: () => i(n.id, "rejected", l),
555
+ children: a ? "Saving..." : "Reject"
556
+ }
557
+ )
558
+ ] }),
559
+ n.status === "approved" && /* @__PURE__ */ e(
560
+ "button",
561
+ {
562
+ className: "cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",
563
+ disabled: a,
564
+ onClick: () => r(n.id),
565
+ children: a ? "Processing..." : "Complete"
566
+ }
567
+ )
568
+ ] })
569
+ ] })
570
+ ] }) });
571
+ }
572
+ function Oe({ serverUrl: n, apiKey: i, authManager: r }) {
573
+ const [a, l] = y([]), [s, m] = y(!0), [u, f] = y(null), [d, h] = y(""), [v, x] = y(null), [_, g] = y(null), S = D(async (o, w) => {
574
+ if (r?.isAuthenticated())
575
+ return r.fetchWithAuth(o, w);
576
+ const z = { "Content-Type": "application/json" };
577
+ i && (z["X-API-Key"] = i);
578
+ const N = await fetch(`${n}${o}`, { ...w, headers: { ...z, ...w?.headers } });
579
+ if (!N.ok) {
580
+ const c = await N.text().catch(() => `HTTP ${N.status}`);
581
+ throw new Error(c);
582
+ }
583
+ return N.json();
584
+ }, [n, i, r]), T = D(async () => {
585
+ m(!0), f(null);
586
+ try {
587
+ const o = d ? `?status=${encodeURIComponent(d)}&limit=50&offset=0` : "?limit=50&offset=0", w = await S(`/admin/asset-redemptions${o}`);
588
+ l(w.redemptions ?? []);
589
+ } catch (o) {
590
+ f(o instanceof Error ? o.message : "Failed to load redemptions");
591
+ } finally {
592
+ m(!1);
593
+ }
594
+ }, [S, d]);
595
+ J(() => {
596
+ T();
597
+ }, [T]);
598
+ const p = D(async (o, w, z) => {
599
+ g(o), f(null);
600
+ try {
601
+ await S(`/admin/asset-redemptions/${o}/status`, {
602
+ method: "PATCH",
603
+ body: JSON.stringify({ status: w, adminNotes: z })
604
+ }), x(null), await T();
605
+ } catch (N) {
606
+ f(N instanceof Error ? N.message : "Failed to update status");
607
+ } finally {
608
+ g(null);
609
+ }
610
+ }, [S, T]), k = D(async (o) => {
611
+ g(o), f(null);
612
+ try {
613
+ await S(`/admin/asset-redemptions/${o}/complete`, { method: "POST" }), x(null), await T();
614
+ } catch (w) {
615
+ f(w instanceof Error ? w.message : "Failed to complete redemption");
616
+ } finally {
617
+ g(null);
618
+ }
619
+ }, [S, T]), A = (o) => {
620
+ x((w) => w === o ? null : o);
621
+ };
622
+ return /* @__PURE__ */ t("div", { className: "cedros-admin__page", children: [
623
+ /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: "0.75rem", marginBottom: "1rem", flexWrap: "wrap" }, children: [
624
+ /* @__PURE__ */ t("div", { children: [
625
+ /* @__PURE__ */ e("label", { style: { display: "block", fontSize: "0.8rem", fontWeight: 500, marginBottom: 4 }, children: "Status" }),
626
+ /* @__PURE__ */ e(
627
+ "select",
628
+ {
629
+ value: d,
630
+ onChange: (o) => {
631
+ h(o.target.value), x(null);
632
+ },
633
+ style: { padding: "0.4rem 0.6rem", border: "1px solid rgba(0,0,0,0.2)", borderRadius: 4, fontSize: "0.9rem", minWidth: 160 },
634
+ children: Ie.map((o) => /* @__PURE__ */ e("option", { value: o.value, children: o.label }, o.value))
635
+ }
636
+ )
637
+ ] }),
638
+ /* @__PURE__ */ e("div", { style: { alignSelf: "flex-end" }, children: /* @__PURE__ */ e(
639
+ "button",
640
+ {
641
+ className: "cedros-admin__button cedros-admin__button--outline",
642
+ onClick: T,
643
+ disabled: s,
644
+ children: s ? "Loading..." : "Refresh"
645
+ }
646
+ ) })
647
+ ] }),
648
+ u && /* @__PURE__ */ e("div", { style: { padding: "0.75rem 1rem", background: "#fef2f2", border: "1px solid #fecaca", borderRadius: 6, color: "#dc2626", marginBottom: "1rem", fontSize: "0.9rem" }, children: u }),
649
+ s ? /* @__PURE__ */ e("div", { className: "cedros-admin__loading", children: "Loading redemptions..." }) : a.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-admin__empty", children: "No redemption requests found." }) : /* @__PURE__ */ e("div", { className: "cedros-admin__table-container", children: /* @__PURE__ */ t("table", { className: "cedros-admin__table", children: [
650
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
651
+ /* @__PURE__ */ e("th", { children: "Date" }),
652
+ /* @__PURE__ */ e("th", { children: "Order" }),
653
+ /* @__PURE__ */ e("th", { children: "Product" }),
654
+ /* @__PURE__ */ e("th", { children: "Collection" }),
655
+ /* @__PURE__ */ e("th", { children: "User" }),
656
+ /* @__PURE__ */ e("th", { children: "Status" }),
657
+ /* @__PURE__ */ e("th", { children: "Actions" })
658
+ ] }) }),
659
+ /* @__PURE__ */ e("tbody", { children: a.map((o) => /* @__PURE__ */ t(O, { children: [
660
+ /* @__PURE__ */ t("tr", { style: { cursor: "pointer" }, onClick: () => A(o.id), children: [
661
+ /* @__PURE__ */ e("td", { children: Le(o.createdAt) }),
662
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { title: o.orderId, children: U(o.orderId) }) }),
663
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { title: o.productId, children: U(o.productId) }) }),
664
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { title: o.collectionId, children: U(o.collectionId) }) }),
665
+ /* @__PURE__ */ e("td", { children: o.userId ? /* @__PURE__ */ e("code", { title: o.userId, children: U(o.userId) }) : /* @__PURE__ */ e("span", { style: { opacity: 0.4 }, children: "—" }) }),
666
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: Re(o.status), children: Fe(o.status) }) }),
667
+ /* @__PURE__ */ e("td", { onClick: (w) => w.stopPropagation(), children: /* @__PURE__ */ t("div", { style: { display: "flex", gap: "0.4rem", flexWrap: "wrap" }, children: [
668
+ (o.status === "info_submitted" || o.status === "under_review" || o.status === "approved") && /* @__PURE__ */ e(
669
+ "button",
670
+ {
671
+ className: "cedros-admin__button cedros-admin__button--outline cedros-admin__button--sm",
672
+ onClick: () => A(o.id),
673
+ children: v === o.id ? "Close" : "Review"
674
+ }
675
+ ),
676
+ o.status === "under_review" && /* @__PURE__ */ t(O, { children: [
677
+ /* @__PURE__ */ e(
678
+ "button",
679
+ {
680
+ className: "cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",
681
+ disabled: _ === o.id,
682
+ onClick: () => p(o.id, "approved", o.adminNotes ?? ""),
683
+ children: "Approve"
684
+ }
685
+ ),
686
+ /* @__PURE__ */ e(
687
+ "button",
688
+ {
689
+ className: "cedros-admin__button cedros-admin__button--outline cedros-admin__button--danger cedros-admin__button--sm",
690
+ disabled: _ === o.id,
691
+ onClick: () => p(o.id, "rejected", o.adminNotes ?? ""),
692
+ children: "Reject"
693
+ }
694
+ )
695
+ ] }),
696
+ o.status === "approved" && /* @__PURE__ */ e(
697
+ "button",
698
+ {
699
+ className: "cedros-admin__button cedros-admin__button--primary cedros-admin__button--sm",
700
+ disabled: _ === o.id,
701
+ onClick: () => k(o.id),
702
+ children: _ === o.id ? "Processing..." : "Complete"
703
+ }
704
+ )
705
+ ] }) })
706
+ ] }, o.id),
707
+ v === o.id && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 7, style: { padding: 0 }, children: /* @__PURE__ */ e(
708
+ Ee,
709
+ {
710
+ redemption: o,
711
+ onAction: p,
712
+ onComplete: k,
713
+ actionBusy: _ === o.id
714
+ }
715
+ ) }) }, `${o.id}-detail`)
716
+ ] })) })
717
+ ] }) })
718
+ ] });
719
+ }
720
+ const qe = {
721
+ CA: { cashOutCents: 1500, expirationProhibited: !0, escheatmentYears: 3, notes: "Cash-out threshold increases to $15 on April 1, 2026." },
722
+ CO: { cashOutCents: 500, escheatmentYears: 5 },
723
+ CT: { cashOutCents: 300, escheatmentYears: 3 },
724
+ FL: { expirationProhibited: !0, escheatmentYears: 5 },
725
+ ME: { cashOutCents: 500, escheatmentYears: 3 },
726
+ MA: { cashOutCents: 500, escheatmentYears: 3, notes: "Cash-out also required when 90% of value is used." },
727
+ MT: { cashOutCents: 500, escheatmentYears: 5 },
728
+ NJ: { cashOutCents: 500, escheatmentYears: 3 },
729
+ OR: { cashOutCents: 500, escheatmentYears: 3, notes: "May require at least one prior transaction." },
730
+ RI: { cashOutCents: 100, escheatmentYears: 3 },
731
+ TX: { cashOutCents: 250, escheatmentYears: 3 },
732
+ VT: { cashOutCents: 100, escheatmentYears: 3 },
733
+ WA: { cashOutCents: 500, escheatmentYears: 5 },
734
+ PR: { cashOutCents: 500, escheatmentYears: 5 }
735
+ }, ce = {
736
+ escheatmentYears: 5
737
+ }, ee = 1e6, $e = {
738
+ AL: "Alabama",
739
+ AK: "Alaska",
740
+ AZ: "Arizona",
741
+ AR: "Arkansas",
742
+ CA: "California",
743
+ CO: "Colorado",
744
+ CT: "Connecticut",
745
+ DE: "Delaware",
746
+ FL: "Florida",
747
+ GA: "Georgia",
748
+ HI: "Hawaii",
749
+ ID: "Idaho",
750
+ IL: "Illinois",
751
+ IN: "Indiana",
752
+ IA: "Iowa",
753
+ KS: "Kansas",
754
+ KY: "Kentucky",
755
+ LA: "Louisiana",
756
+ ME: "Maine",
757
+ MD: "Maryland",
758
+ MA: "Massachusetts",
759
+ MI: "Michigan",
760
+ MN: "Minnesota",
761
+ MS: "Mississippi",
762
+ MO: "Missouri",
763
+ MT: "Montana",
764
+ NE: "Nebraska",
765
+ NV: "Nevada",
766
+ NH: "New Hampshire",
767
+ NJ: "New Jersey",
768
+ NM: "New Mexico",
769
+ NY: "New York",
770
+ NC: "North Carolina",
771
+ ND: "North Dakota",
772
+ OH: "Ohio",
773
+ OK: "Oklahoma",
774
+ OR: "Oregon",
775
+ PA: "Pennsylvania",
776
+ RI: "Rhode Island",
777
+ SC: "South Carolina",
778
+ SD: "South Dakota",
779
+ TN: "Tennessee",
780
+ TX: "Texas",
781
+ UT: "Utah",
782
+ VT: "Vermont",
783
+ VA: "Virginia",
784
+ WA: "Washington",
785
+ WV: "West Virginia",
786
+ WI: "Wisconsin",
787
+ WY: "Wyoming",
788
+ DC: "District of Columbia",
789
+ PR: "Puerto Rico"
790
+ };
791
+ function We({ serverUrl: n, authManager: i }) {
792
+ const [r, a] = y(null), [l, s] = y(null), [m, u] = y(null), [f, d] = y(!0), h = D(async () => {
793
+ try {
794
+ const S = (await new de(n, void 0, i).getConfig("gift_cards")).config ?? {};
795
+ a(S.business_state || null), s(S.min_gift_card_value_cents != null ? Number(S.min_gift_card_value_cents) : null), u(S.max_gift_card_value_cents != null ? Number(S.max_gift_card_value_cents) : null);
796
+ } catch {
797
+ } finally {
798
+ d(!1);
799
+ }
800
+ }, [n, i]);
801
+ if (J(() => {
802
+ h();
803
+ }, [h]), f)
804
+ return /* @__PURE__ */ e("div", { style: { padding: "2rem", textAlign: "center", opacity: 0.6 }, children: "Loading compliance data..." });
805
+ const v = r ? qe[r] ?? ce : null, x = r ? $e[r] ?? r : null;
806
+ return /* @__PURE__ */ e("div", { children: r ? /* @__PURE__ */ t(O, { children: [
807
+ /* @__PURE__ */ t("h3", { className: "cedros-admin__section-title", style: { marginBottom: "1rem" }, children: [
808
+ "Compliance Guidance — ",
809
+ x
810
+ ] }),
811
+ /* @__PURE__ */ t("div", { style: { display: "grid", gap: "1rem", maxWidth: 720 }, children: [
812
+ /* @__PURE__ */ e(Ue, { reg: v, minValueCents: l }),
813
+ /* @__PURE__ */ e(je, { reg: v }),
814
+ /* @__PURE__ */ e(Ke, { reg: v }),
815
+ /* @__PURE__ */ e(He, { maxValueCents: m })
816
+ ] }),
817
+ /* @__PURE__ */ e(Ge, { reg: v, minValueCents: l, maxValueCents: m })
818
+ ] }) : /* @__PURE__ */ e(Ye, {}) });
819
+ }
820
+ function Ye() {
821
+ return /* @__PURE__ */ t("div", { style: { padding: "2rem", textAlign: "center" }, children: [
822
+ /* @__PURE__ */ e("p", { style: { fontSize: 15, opacity: 0.7, marginBottom: "0.5rem" }, children: "No business state configured." }),
823
+ /* @__PURE__ */ t("p", { style: { fontSize: 13, opacity: 0.5 }, children: [
824
+ "Set your ",
825
+ /* @__PURE__ */ e("strong", { children: "business_state" }),
826
+ " in the Gift Cards config category to see state-specific compliance guidance."
827
+ ] })
828
+ ] });
829
+ }
830
+ function G({ title: n, children: i }) {
831
+ return /* @__PURE__ */ t("div", { style: {
832
+ border: "1px solid rgba(0,0,0,0.1)",
833
+ borderRadius: 8,
834
+ padding: "1rem 1.25rem"
835
+ }, children: [
836
+ /* @__PURE__ */ e("h4", { style: { margin: "0 0 0.5rem", fontSize: 14, fontWeight: 600 }, children: n }),
837
+ /* @__PURE__ */ e("div", { style: { fontSize: 13, lineHeight: 1.6 }, children: i })
838
+ ] });
839
+ }
840
+ function Ue({ reg: n, minValueCents: i }) {
841
+ if (!n.cashOutCents)
842
+ return /* @__PURE__ */ e(G, { title: "Cash-Out Threshold", children: /* @__PURE__ */ e("p", { style: { margin: 0 }, children: "Your state does not have a specific cash-out threshold for gift cards. Federal law does not require cash redemption." }) });
843
+ const r = (n.cashOutCents / 100).toFixed(2), a = i != null && i > n.cashOutCents;
844
+ return /* @__PURE__ */ t(G, { title: "Cash-Out Threshold", children: [
845
+ /* @__PURE__ */ t("p", { style: { margin: "0 0 0.5rem" }, children: [
846
+ "Your state requires cash redemption for gift cards with a remaining balance of ",
847
+ /* @__PURE__ */ t("strong", { children: [
848
+ "$",
849
+ r
850
+ ] }),
851
+ " or less."
852
+ ] }),
853
+ /* @__PURE__ */ t("p", { style: { margin: "0 0 0.5rem" }, children: [
854
+ "Since this system uses ",
855
+ /* @__PURE__ */ e("strong", { children: "one-shot full redemption" }),
856
+ " (entire gift card value is converted to credits at once), cash-out is avoided by setting the minimum gift card face value above the threshold."
857
+ ] }),
858
+ a ? /* @__PURE__ */ t(te, { ok: !0, children: [
859
+ "Min value ($",
860
+ ((i ?? 0) / 100).toFixed(2),
861
+ ") exceeds threshold"
862
+ ] }) : /* @__PURE__ */ t(te, { ok: !1, children: [
863
+ "Set ",
864
+ /* @__PURE__ */ e("code", { children: "min_gift_card_value_cents" }),
865
+ " above ",
866
+ n.cashOutCents,
867
+ " to avoid cash-out obligations"
868
+ ] }),
869
+ n.notes && /* @__PURE__ */ e("p", { style: { margin: "0.5rem 0 0", opacity: 0.7, fontStyle: "italic" }, children: n.notes })
870
+ ] });
871
+ }
872
+ function je({ reg: n }) {
873
+ return /* @__PURE__ */ e(G, { title: "Expiration Rules", children: n.expirationProhibited ? /* @__PURE__ */ t("p", { style: { margin: 0 }, children: [
874
+ "Your state ",
875
+ /* @__PURE__ */ e("strong", { children: "prohibits" }),
876
+ " gift card expiration. Do not set expiration dates on gift cards."
877
+ ] }) : /* @__PURE__ */ t("p", { style: { margin: 0 }, children: [
878
+ "Federal law (CARD Act) requires gift cards to remain valid for at least ",
879
+ /* @__PURE__ */ e("strong", { children: "5 years" }),
880
+ " from purchase or last reload. Your state follows the federal minimum."
881
+ ] }) });
882
+ }
883
+ function Ke({ reg: n }) {
884
+ const i = n.escheatmentYears ?? ce.escheatmentYears;
885
+ return /* @__PURE__ */ t(G, { title: "Escheatment (Unclaimed Property)", children: [
886
+ /* @__PURE__ */ t("p", { style: { margin: "0 0 0.5rem" }, children: [
887
+ "Gift card balances unredeemed for ",
888
+ /* @__PURE__ */ t("strong", { children: [
889
+ i,
890
+ " years"
891
+ ] }),
892
+ " may need to be reported and remitted to the state as unclaimed property."
893
+ ] }),
894
+ /* @__PURE__ */ t("p", { style: { margin: 0, opacity: 0.7 }, children: [
895
+ "The system tracks ",
896
+ /* @__PURE__ */ e("code", { children: "last_activity_at" }),
897
+ " on gift card redemptions to help identify dormant balances approaching the escheatment window."
898
+ ] })
899
+ ] });
900
+ }
901
+ function He({ maxValueCents: n }) {
902
+ const i = n ?? ee, r = i <= ee;
903
+ return /* @__PURE__ */ t(G, { title: "Anti-Money Laundering (AML)", children: [
904
+ /* @__PURE__ */ t("p", { style: { margin: "0 0 0.5rem" }, children: [
905
+ "FinCEN requires closed-loop prepaid cards to stay at or below ",
906
+ /* @__PURE__ */ e("strong", { children: "$10,000" }),
907
+ " per card. The server enforces this cap on product creation."
908
+ ] }),
909
+ r ? /* @__PURE__ */ t(te, { ok: !0, children: [
910
+ "Max value ($",
911
+ (i / 100).toFixed(2),
912
+ ") within AML limit"
913
+ ] }) : /* @__PURE__ */ t(te, { ok: !1, children: [
914
+ /* @__PURE__ */ e("code", { children: "max_gift_card_value_cents" }),
915
+ " exceeds $10,000 AML cap"
916
+ ] })
917
+ ] });
918
+ }
919
+ function te({ ok: n, children: i }) {
920
+ return /* @__PURE__ */ t("div", { style: {
921
+ display: "inline-flex",
922
+ alignItems: "center",
923
+ gap: 6,
924
+ padding: "4px 10px",
925
+ borderRadius: 6,
926
+ fontSize: 13,
927
+ fontWeight: 500,
928
+ background: n ? "rgba(34,197,94,0.1)" : "rgba(234,179,8,0.15)",
929
+ color: n ? "#16a34a" : "#a16207"
930
+ }, children: [
931
+ /* @__PURE__ */ e("span", { children: n ? "✓" : "⚠" }),
932
+ i
933
+ ] });
934
+ }
935
+ function Ge({
936
+ reg: n,
937
+ minValueCents: i,
938
+ maxValueCents: r
939
+ }) {
940
+ const l = [
941
+ {
942
+ label: "AML: Max card value ≤ $10,000",
943
+ ok: (r ?? ee) <= ee
944
+ },
945
+ ...n.cashOutCents ? [{
946
+ label: `Cash-out: Min value > $${(n.cashOutCents / 100).toFixed(2)} threshold`,
947
+ ok: i != null && i > n.cashOutCents
948
+ }] : [],
949
+ {
950
+ label: n.expirationProhibited ? "Expiration: State prohibits expiration (no action needed)" : "Expiration: Federal 5-year minimum applies",
951
+ ok: !0
952
+ },
953
+ {
954
+ label: `Escheatment: ${n.escheatmentYears ?? ce.escheatmentYears}-year dormancy tracking enabled`,
955
+ ok: !0
956
+ }
957
+ ];
958
+ return /* @__PURE__ */ t("div", { style: { marginTop: "1.5rem" }, children: [
959
+ /* @__PURE__ */ e("h4", { style: { fontSize: 14, fontWeight: 600, marginBottom: "0.75rem" }, children: "Compliance Checklist" }),
960
+ /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: l.map((s, m) => /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: 8, fontSize: 13 }, children: [
961
+ /* @__PURE__ */ e("span", { style: { color: s.ok ? "#16a34a" : "#d97706", fontWeight: 600 }, children: s.ok ? "✓" : "⚠" }),
962
+ /* @__PURE__ */ e("span", { children: s.label })
963
+ ] }, m)) })
964
+ ] });
965
+ }
966
+ const Je = 0;
967
+ class Ve {
968
+ dlmmModule = null;
969
+ bnClass = null;
970
+ keypairClass = null;
971
+ /** Dynamic import of @meteora-ag/dlmm. Throws descriptive error if not installed. */
972
+ async loadDLMM() {
973
+ if (this.dlmmModule) return this.dlmmModule;
974
+ try {
975
+ const i = await import("./pay-react_false-CPX8Vyp9.mjs");
976
+ return this.dlmmModule = i.default ?? i, this.dlmmModule;
977
+ } catch {
978
+ throw new Error(
979
+ "Install @meteora-ag/dlmm to enable pool deployment: npm install @meteora-ag/dlmm"
980
+ );
981
+ }
982
+ }
983
+ /** Dynamic import of BN.js (bundled with @solana/web3.js) */
984
+ async loadBN() {
985
+ if (this.bnClass) return this.bnClass;
986
+ const i = await import("./bn-CHdpZHQm.mjs").then((r) => r.b);
987
+ return this.bnClass = i.default ?? i, this.bnClass;
988
+ }
989
+ /** Dynamic import of Keypair */
990
+ async loadKeypair() {
991
+ if (this.keypairClass) return this.keypairClass;
992
+ const { Keypair: i } = await import("@solana/web3.js");
993
+ return this.keypairClass = i, this.keypairClass;
994
+ }
995
+ /**
996
+ * Compute the DLMM bin ID for a given buyback price.
997
+ *
998
+ * @param buybackPrice - Price per gift card token in USDC (e.g., 0.80)
999
+ * @param giftCardDecimals - Decimals of the gift card token (e.g., 2)
1000
+ * @param usdcDecimals - Decimals of USDC (typically 6)
1001
+ * @param binStep - Pool bin step (default 1 = finest granularity)
1002
+ * @returns bin ID
1003
+ */
1004
+ async computeBinId(i, r, a, l = 1) {
1005
+ const s = await this.loadDLMM(), m = s.getPricePerLamport(r, a, i);
1006
+ return s.getBinIdFromPrice(m, l, !0);
1007
+ }
1008
+ /**
1009
+ * Find a suitable PresetParameter2 account for the desired bin step.
1010
+ *
1011
+ * @returns The preset parameter public key to use with createLbPair2
1012
+ */
1013
+ async findPresetParameter(i, r, a) {
1014
+ const l = await this.loadDLMM(), s = a ? { cluster: a } : void 0, { presetParameter2: m } = await l.getAllPresetParameters(i, s), u = m.find((f) => f.account.binStep === r);
1015
+ if (!u)
1016
+ throw new Error(
1017
+ `No PresetParameter2 found for binStep=${r}. Available: ${m.map((f) => f.account.binStep).join(", ")}`
1018
+ );
1019
+ return u.publicKey;
1020
+ }
1021
+ /**
1022
+ * Build transaction to create a new DLMM pool.
1023
+ *
1024
+ * @param connection - Solana RPC connection
1025
+ * @param funder - Admin wallet public key (pays for account creation)
1026
+ * @param giftCardMint - Token-22 gift card mint address
1027
+ * @param usdcMint - USDC mint address
1028
+ * @param activeBinId - Bin ID representing the initial price ($1.00 face value)
1029
+ * @param binStep - Pool bin step (default 1)
1030
+ * @param cluster - Solana cluster name
1031
+ * @returns Transaction to sign and pool address
1032
+ */
1033
+ async createPool(i, r, a, l, s, m = 1, u) {
1034
+ const f = await this.loadDLMM(), d = await this.loadBN(), h = u ? { cluster: u } : void 0, v = await this.findPresetParameter(i, m, u), x = await f.createLbPair2(
1035
+ i,
1036
+ r,
1037
+ a,
1038
+ l,
1039
+ v,
1040
+ new d(s),
1041
+ h
1042
+ ), _ = x.instructions[0]?.keys?.[1]?.pubkey;
1043
+ if (!_)
1044
+ throw new Error("Failed to extract pool address from transaction");
1045
+ return { transaction: x, poolAddress: _ };
1046
+ }
1047
+ /**
1048
+ * Build transaction to add one-sided USDC liquidity at the buyback price.
1049
+ *
1050
+ * @param connection - Solana RPC connection
1051
+ * @param user - Admin wallet public key
1052
+ * @param poolAddress - DLMM pool address from createPool
1053
+ * @param usdcAmountLamports - Amount of USDC in lamports (e.g., 250_000_000 for $250)
1054
+ * @param buybackBinId - Bin ID for the buyback price
1055
+ * @param cluster - Solana cluster name
1056
+ * @returns Transaction and position keypair (must be included as signer)
1057
+ */
1058
+ async addBuybackLiquidity(i, r, a, l, s, m) {
1059
+ const u = await this.loadDLMM(), f = await this.loadBN(), d = await this.loadKeypair(), h = m ? { cluster: m } : void 0, v = await u.create(i, a, h), x = d.generate(), _ = s - 1, g = s;
1060
+ return {
1061
+ transaction: await v.initializePositionAndAddLiquidityByStrategy({
1062
+ positionPubKey: x.publicKey,
1063
+ totalXAmount: new f(0),
1064
+ // No gift card tokens (buy-side only)
1065
+ totalYAmount: new f(l),
1066
+ // Admin's USDC
1067
+ strategy: {
1068
+ maxBinId: g,
1069
+ minBinId: _,
1070
+ strategyType: Je
1071
+ },
1072
+ user: r,
1073
+ slippage: 1
1074
+ // 1% slippage tolerance
1075
+ }),
1076
+ positionKeypair: x
1077
+ };
1078
+ }
1079
+ /**
1080
+ * Fetch on-chain pool status for display.
1081
+ *
1082
+ * @returns Pool status or null if pool doesn't exist
1083
+ */
1084
+ async getPoolStatus(i, r, a) {
1085
+ const l = await this.loadDLMM(), s = a ? { cluster: a } : void 0, m = await l.create(i, r, s), u = await m.getActiveBin();
1086
+ return {
1087
+ address: r.toBase58(),
1088
+ activeBinId: u.binId,
1089
+ activeBinPrice: u.price,
1090
+ binStep: m.lbPair.binStep
1091
+ };
1092
+ }
1093
+ }
1094
+ const K = 6, se = 1, Xe = "https://solscan.io/account", Ze = "https://app.meteora.ag/dlmm";
1095
+ function Qe({
1096
+ serverUrl: n,
1097
+ authManager: i,
1098
+ mintConfigured: r,
1099
+ mintAddress: a,
1100
+ tokenDecimals: l = 2
1101
+ }) {
1102
+ const [s, m] = y({
1103
+ liquidityPoolAddress: null,
1104
+ buybackRateBps: null,
1105
+ rpcUrl: null,
1106
+ usdcMint: null,
1107
+ usdcAmount: null,
1108
+ deployedAt: null
1109
+ }), [u, f] = y(!0), [d, h] = y(80), [v, x] = y(250), [_, g] = y("idle"), [S, T] = y(null), [p, k] = y(null), [A, o] = y(null), w = we(new Ve()), z = D(async () => {
1110
+ try {
1111
+ const P = new de(n, void 0, i), [L, q] = await Promise.all([
1112
+ P.getConfig("gift_cards"),
1113
+ P.getConfig("x402")
1114
+ ]), M = L.config ?? {}, I = q.config ?? {}, R = M.liquidity_pool_address || null;
1115
+ m({
1116
+ liquidityPoolAddress: R,
1117
+ buybackRateBps: M.buyback_rate_bps != null ? Number(M.buyback_rate_bps) : null,
1118
+ rpcUrl: I.rpc_url || null,
1119
+ usdcMint: I.token_mint || null,
1120
+ usdcAmount: M.liquidity_usdc_amount != null ? Number(M.liquidity_usdc_amount) : null,
1121
+ deployedAt: M.liquidity_deployed_at || null
1122
+ }), R && k(R), M.buyback_rate_bps != null && h(Number(M.buyback_rate_bps) / 100);
1123
+ } catch {
1124
+ } finally {
1125
+ f(!1);
1126
+ }
1127
+ }, [n, i]);
1128
+ J(() => {
1129
+ z();
1130
+ }, [z]);
1131
+ const N = typeof window < "u" && !!window.solana?.publicKey, c = !!s.rpcUrl, b = !!s.usdcMint, F = r && N && c && b && _ === "idle", C = async (P) => {
1132
+ if (!(!a || !s.rpcUrl || !s.usdcMint)) {
1133
+ g(P), T(null), o(null);
1134
+ try {
1135
+ const { Connection: L, PublicKey: q, Keypair: M } = await import("@solana/web3.js"), I = new L(s.rpcUrl, "confirmed"), R = window.solana;
1136
+ if (!R?.publicKey || !R.signTransaction)
1137
+ throw new Error("Wallet not connected");
1138
+ const X = w.current, me = new q(R.publicKey.toBase58()), Se = d / 100, Ce = await X.computeBinId(Se, l, K, se);
1139
+ let $ = p;
1140
+ if (P === "creating_pool") {
1141
+ const j = new q(a), ne = new q(s.usdcMint), Z = await X.computeBinId(1, l, K, se), { transaction: ie, poolAddress: re } = await X.createPool(
1142
+ I,
1143
+ me,
1144
+ j,
1145
+ ne,
1146
+ Z,
1147
+ se
1148
+ ), ae = await R.signTransaction(ie), oe = await I.sendRawTransaction(ae.serialize());
1149
+ await I.confirmTransaction(oe, "confirmed"), $ = re.toBase58(), k($);
1150
+ }
1151
+ if (P === "creating_pool" || P === "adding_liquidity") {
1152
+ if (g("adding_liquidity"), !$) throw new Error("Pool address not available");
1153
+ const j = new q($), ne = Math.round(v * 10 ** K), { transaction: Z, positionKeypair: ie } = await X.addBuybackLiquidity(
1154
+ I,
1155
+ me,
1156
+ j,
1157
+ ne,
1158
+ Ce
1159
+ ), re = M.fromSecretKey(ie.secretKey);
1160
+ Z.partialSign(re);
1161
+ const ae = await R.signTransaction(Z), oe = await I.sendRawTransaction(ae.serialize());
1162
+ await I.confirmTransaction(oe, "confirmed");
1163
+ }
1164
+ if (g("saving_config"), !$) throw new Error("Pool address not available");
1165
+ const xe = new de(n, void 0, i), ue = Math.round(d * 100), pe = Math.round(v * 10 ** K), he = (/* @__PURE__ */ new Date()).toISOString();
1166
+ await xe.patchConfig("gift_cards", {
1167
+ liquidity_pool_address: $,
1168
+ buyback_rate_bps: ue,
1169
+ liquidity_usdc_amount: pe,
1170
+ liquidity_deployed_at: he
1171
+ }, "Meteora DLMM pool deployed for gift card buyback"), m((j) => ({
1172
+ ...j,
1173
+ liquidityPoolAddress: $,
1174
+ buybackRateBps: ue,
1175
+ usdcAmount: pe,
1176
+ deployedAt: he
1177
+ })), g("done");
1178
+ } catch (L) {
1179
+ o(_ === "idle" ? P : _), T(L instanceof Error ? L.message : "Deployment failed"), g("error");
1180
+ }
1181
+ }
1182
+ }, B = () => {
1183
+ F && C("creating_pool");
1184
+ }, V = () => {
1185
+ !A || A === "idle" || A === "done" || A === "error" || C(A);
1186
+ };
1187
+ return u ? /* @__PURE__ */ e("div", { style: { padding: "2rem", textAlign: "center", opacity: 0.6 }, children: "Loading pool configuration..." }) : s.liquidityPoolAddress ? /* @__PURE__ */ e(
1188
+ nt,
1189
+ {
1190
+ poolAddress: s.liquidityPoolAddress,
1191
+ buybackRateBps: s.buybackRateBps,
1192
+ usdcAmount: s.usdcAmount,
1193
+ deployedAt: s.deployedAt
1194
+ }
1195
+ ) : _ !== "idle" && _ !== "error" ? /* @__PURE__ */ e(tt, { step: _, poolAddress: p }) : /* @__PURE__ */ e(
1196
+ et,
1197
+ {
1198
+ buybackCents: d,
1199
+ setBuybackCents: h,
1200
+ usdcAmount: v,
1201
+ setUsdcAmount: x,
1202
+ mintConfigured: r,
1203
+ walletConnected: N,
1204
+ hasRpcUrl: c,
1205
+ hasUsdcMint: b,
1206
+ canDeploy: F,
1207
+ onDeploy: B,
1208
+ errorMessage: S,
1209
+ canRetry: !!A && A !== "creating_pool",
1210
+ onRetry: V
1211
+ }
1212
+ );
1213
+ }
1214
+ function et({
1215
+ buybackCents: n,
1216
+ setBuybackCents: i,
1217
+ usdcAmount: r,
1218
+ setUsdcAmount: a,
1219
+ mintConfigured: l,
1220
+ walletConnected: s,
1221
+ hasRpcUrl: m,
1222
+ hasUsdcMint: u,
1223
+ canDeploy: f,
1224
+ onDeploy: d,
1225
+ errorMessage: h,
1226
+ canRetry: v,
1227
+ onRetry: x
1228
+ }) {
1229
+ const _ = ((100 - n) / 100).toFixed(2);
1230
+ return /* @__PURE__ */ t("div", { children: [
1231
+ /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", style: { marginBottom: "0.5rem" }, children: "Deploy Buyback Liquidity Pool" }),
1232
+ /* @__PURE__ */ e("p", { style: { opacity: 0.7, marginBottom: "1rem", fontSize: 14 }, children: "Create a Meteora DLMM pool to buy back gift card tokens at a discount. You earn the spread when tokens are resold at face value." }),
1233
+ /* @__PURE__ */ t("div", { className: "cedros-admin__form-row", children: [
1234
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1235
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Buyback rate (cents per $1.00)" }),
1236
+ /* @__PURE__ */ e(
1237
+ "input",
1238
+ {
1239
+ type: "number",
1240
+ className: "cedros-admin__input",
1241
+ value: n,
1242
+ onChange: (g) => i(Math.max(1, Math.min(99, parseInt(g.target.value) || 80))),
1243
+ min: "1",
1244
+ max: "99"
1245
+ }
1246
+ ),
1247
+ /* @__PURE__ */ t("div", { style: { marginTop: 4, fontSize: 12, opacity: 0.75 }, children: [
1248
+ "You earn $",
1249
+ _,
1250
+ " profit per gift card redeemed"
1251
+ ] })
1252
+ ] }),
1253
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1254
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "USDC amount" }),
1255
+ /* @__PURE__ */ e(
1256
+ "input",
1257
+ {
1258
+ type: "number",
1259
+ className: "cedros-admin__input",
1260
+ value: r,
1261
+ onChange: (g) => a(Math.max(1, parseFloat(g.target.value) || 250)),
1262
+ min: "1",
1263
+ step: "1"
1264
+ }
1265
+ ),
1266
+ /* @__PURE__ */ e("div", { style: { marginTop: 4, fontSize: 12, opacity: 0.75 }, children: "Minimum recommended: $250" })
1267
+ ] })
1268
+ ] }),
1269
+ /* @__PURE__ */ t("div", { style: { margin: "1rem 0", display: "flex", flexDirection: "column", gap: 6 }, children: [
1270
+ /* @__PURE__ */ e(Q, { label: "Token-22 mint initialized", met: l }),
1271
+ /* @__PURE__ */ e(Q, { label: "Wallet connected", met: s }),
1272
+ /* @__PURE__ */ e(Q, { label: "RPC URL configured", met: m }),
1273
+ /* @__PURE__ */ e(Q, { label: "USDC mint configured", met: u })
1274
+ ] }),
1275
+ h && /* @__PURE__ */ e("div", { style: {
1276
+ padding: "0.5rem 0.75rem",
1277
+ marginBottom: "0.75rem",
1278
+ borderRadius: 6,
1279
+ background: "rgba(239,68,68,0.1)",
1280
+ color: "#dc2626",
1281
+ fontSize: 13
1282
+ }, children: h }),
1283
+ /* @__PURE__ */ e("div", { style: { display: "flex", gap: "0.75rem", alignItems: "center" }, children: v ? /* @__PURE__ */ e(
1284
+ "button",
1285
+ {
1286
+ className: "cedros-admin__button cedros-admin__button--primary",
1287
+ onClick: x,
1288
+ children: "Retry (Resume from Failed Step)"
1289
+ }
1290
+ ) : /* @__PURE__ */ e(
1291
+ "button",
1292
+ {
1293
+ className: "cedros-admin__button cedros-admin__button--primary",
1294
+ onClick: d,
1295
+ disabled: !f,
1296
+ children: "Deploy Liquidity Pool"
1297
+ }
1298
+ ) })
1299
+ ] });
1300
+ }
1301
+ const be = [
1302
+ { key: "creating_pool", label: "Creating DLMM pool..." },
1303
+ { key: "adding_liquidity", label: "Depositing USDC liquidity..." },
1304
+ { key: "saving_config", label: "Saving configuration..." },
1305
+ { key: "done", label: "Complete" }
1306
+ ];
1307
+ function tt({ step: n, poolAddress: i }) {
1308
+ return /* @__PURE__ */ t("div", { children: [
1309
+ /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", style: { marginBottom: "1rem" }, children: "Deploying Pool..." }),
1310
+ /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: be.map((r, a) => {
1311
+ const l = be.findIndex((f) => f.key === n), s = a, m = s < l || n === "done", u = s === l && n !== "done";
1312
+ return /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: 8, fontSize: 14 }, children: [
1313
+ /* @__PURE__ */ e("span", { style: { width: 20, textAlign: "center", fontWeight: 600 }, children: m ? "✓" : u ? "▶" : "○" }),
1314
+ /* @__PURE__ */ e("span", { style: { opacity: m || u ? 1 : 0.4 }, children: r.label })
1315
+ ] }, r.key);
1316
+ }) }),
1317
+ i && /* @__PURE__ */ t("div", { style: { marginTop: "1rem", fontSize: 13, opacity: 0.7 }, children: [
1318
+ "Pool: ",
1319
+ /* @__PURE__ */ e("code", { style: { fontSize: 12 }, children: i })
1320
+ ] })
1321
+ ] });
1322
+ }
1323
+ function nt({ poolAddress: n, buybackRateBps: i, usdcAmount: r, deployedAt: a }) {
1324
+ const l = i != null ? `$${(i / 1e4).toFixed(2)}` : "Unknown", s = r != null ? `$${(r / 10 ** K).toFixed(2)}` : null, m = a ? new Date(a).toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" }) : null, u = n.length > 16 ? `${n.slice(0, 8)}...${n.slice(-8)}` : n;
1325
+ return /* @__PURE__ */ t("div", { children: [
1326
+ /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", style: { marginBottom: "1rem" }, children: "Liquidity Pool Active" }),
1327
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.75rem", maxWidth: 600 }, children: [
1328
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500, fontSize: 13 }, children: "Pool Address" }),
1329
+ /* @__PURE__ */ t("div", { style: { fontSize: 13, fontFamily: "monospace", wordBreak: "break-all" }, children: [
1330
+ u,
1331
+ /* @__PURE__ */ t("span", { style: { marginLeft: 8, display: "inline-flex", gap: 6 }, children: [
1332
+ /* @__PURE__ */ e(it, { text: n }),
1333
+ /* @__PURE__ */ e(ve, { href: `${Xe}/${n}`, label: "Solscan" }),
1334
+ /* @__PURE__ */ e(ve, { href: `${Ze}/${n}`, label: "Meteora" })
1335
+ ] })
1336
+ ] }),
1337
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500, fontSize: 13 }, children: "Buyback Rate" }),
1338
+ /* @__PURE__ */ t("div", { style: { fontSize: 13 }, children: [
1339
+ l,
1340
+ " per $1.00"
1341
+ ] }),
1342
+ s && /* @__PURE__ */ t(O, { children: [
1343
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500, fontSize: 13 }, children: "USDC Deposited" }),
1344
+ /* @__PURE__ */ e("div", { style: { fontSize: 13 }, children: s })
1345
+ ] }),
1346
+ m && /* @__PURE__ */ t(O, { children: [
1347
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500, fontSize: 13 }, children: "Deployed" }),
1348
+ /* @__PURE__ */ e("div", { style: { fontSize: 13 }, children: m })
1349
+ ] })
1350
+ ] })
1351
+ ] });
1352
+ }
1353
+ function Q({ label: n, met: i }) {
1354
+ return /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: 8, fontSize: 13 }, children: [
1355
+ /* @__PURE__ */ e("span", { style: { color: i ? "#16a34a" : "#dc2626", fontWeight: 600 }, children: i ? "✓" : "✗" }),
1356
+ /* @__PURE__ */ e("span", { style: { opacity: i ? 0.8 : 0.5 }, children: n })
1357
+ ] });
1358
+ }
1359
+ function it({ text: n }) {
1360
+ const [i, r] = y(!1);
1361
+ return /* @__PURE__ */ e(
1362
+ "button",
1363
+ {
1364
+ type: "button",
1365
+ onClick: () => {
1366
+ navigator.clipboard.writeText(n).then(() => {
1367
+ r(!0), setTimeout(() => r(!1), 1500);
1368
+ });
1369
+ },
1370
+ style: { background: "none", border: "none", cursor: "pointer", fontSize: 12, opacity: 0.7, padding: 0 },
1371
+ children: i ? "Copied" : "Copy"
1372
+ }
1373
+ );
1374
+ }
1375
+ function ve({ href: n, label: i }) {
1376
+ return /* @__PURE__ */ e(
1377
+ "a",
1378
+ {
1379
+ href: n,
1380
+ target: "_blank",
1381
+ rel: "noopener noreferrer",
1382
+ style: { fontSize: 12, opacity: 0.7 },
1383
+ children: i
1384
+ }
1385
+ );
1386
+ }
1387
+ function ct({ serverUrl: n, apiKey: i, authManager: r }) {
1388
+ const [a, l] = y(null), [s, m] = y([]), [u, f] = y(!0), [d, h] = y(null), [v, x] = y("mint"), [_, g] = y({
1389
+ treasuryAddress: "",
1390
+ tokenSymbol: "storeUSD",
1391
+ tokenDecimals: 2,
1392
+ transferFeeBps: 250,
1393
+ maxTransferFee: 500
1394
+ }), [S, T] = y(!1), [p, k] = y(!1), [A, o] = y(null), w = D(async (C, B) => {
1395
+ if (r?.isAuthenticated())
1396
+ return r.fetchWithAuth(C, B);
1397
+ const V = { "Content-Type": "application/json" };
1398
+ i && (V["X-API-Key"] = i);
1399
+ const P = await fetch(`${n}${C}`, { ...B, headers: { ...V, ...B?.headers } });
1400
+ if (!P.ok) {
1401
+ const L = await P.text().catch(() => `HTTP ${P.status}`);
1402
+ throw new Error(L);
1403
+ }
1404
+ return P.json();
1405
+ }, [n, i, r]), z = D(async () => {
1406
+ try {
1407
+ h(null);
1408
+ const C = await w("/admin/token22/status");
1409
+ l(C);
1410
+ } catch {
1411
+ h("Failed to load Token-22 status");
1412
+ } finally {
1413
+ f(!1);
1414
+ }
1415
+ }, [w]), N = D(async () => {
1416
+ try {
1417
+ const C = await w("/admin/gift-card-redemptions?limit=50");
1418
+ m(C.redemptions || []);
1419
+ } catch {
1420
+ m([]);
1421
+ }
1422
+ }, [w]);
1423
+ J(() => {
1424
+ z(), N();
1425
+ }, [z, N]);
1426
+ const c = async (C) => {
1427
+ if (C.preventDefault(), !!_.treasuryAddress) {
1428
+ T(!0), o(null);
1429
+ try {
1430
+ const B = await w("/admin/token22/initialize", {
1431
+ method: "POST",
1432
+ body: JSON.stringify({
1433
+ treasuryAddress: _.treasuryAddress,
1434
+ tokenSymbol: _.tokenSymbol,
1435
+ tokenDecimals: _.tokenDecimals,
1436
+ transferFeeBps: _.transferFeeBps,
1437
+ maxTransferFee: _.maxTransferFee
1438
+ })
1439
+ });
1440
+ o(`Mint created: ${B.mintAddress}`), z();
1441
+ } catch (B) {
1442
+ o(`Error: ${B instanceof Error ? B.message : "Failed to initialize"}`);
1443
+ } finally {
1444
+ T(!1);
1445
+ }
1446
+ }
1447
+ }, b = async () => {
1448
+ k(!0), o(null);
1449
+ try {
1450
+ const C = await w("/admin/token22/harvest-fees", {
1451
+ method: "POST"
1452
+ });
1453
+ o(C.message);
1454
+ } catch (C) {
1455
+ o(`Error: ${C instanceof Error ? C.message : "Failed to harvest"}`);
1456
+ } finally {
1457
+ k(!1);
1458
+ }
1459
+ }, F = (C) => {
1460
+ try {
1461
+ return new Date(C).toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric", hour: "2-digit", minute: "2-digit" });
1462
+ } catch {
1463
+ return C;
1464
+ }
1465
+ };
1466
+ return /* @__PURE__ */ t("div", { className: "cedros-admin__page", children: [
1467
+ /* @__PURE__ */ e(ke, { message: d, onRetry: z }),
1468
+ /* @__PURE__ */ e("div", { style: { display: "flex", gap: 0, borderBottom: "1px solid rgba(0,0,0,0.1)", marginBottom: "1rem" }, children: ["mint", "redemptions", "compliance", "liquidity", "asset-classes", "asset-redemptions"].map((C) => /* @__PURE__ */ e(
1469
+ "button",
1470
+ {
1471
+ type: "button",
1472
+ onClick: () => x(C),
1473
+ style: {
1474
+ padding: "0.5rem 1rem",
1475
+ background: "none",
1476
+ border: "none",
1477
+ borderBottom: v === C ? "2px solid currentColor" : "2px solid transparent",
1478
+ fontWeight: v === C ? 600 : 400,
1479
+ cursor: "pointer",
1480
+ opacity: v === C ? 1 : 0.6
1481
+ },
1482
+ children: { mint: "Token-22 Mint", redemptions: "Gift Card Redemptions", compliance: "Compliance", liquidity: "Liquidity", "asset-classes": "Asset Classes", "asset-redemptions": "Asset Redemptions" }[C]
1483
+ },
1484
+ C
1485
+ )) }),
1486
+ u ? /* @__PURE__ */ t("div", { className: "cedros-admin__loading", children: [
1487
+ Te.loading,
1488
+ " Loading..."
1489
+ ] }) : v === "mint" ? /* @__PURE__ */ e(
1490
+ rt,
1491
+ {
1492
+ mintStatus: a,
1493
+ initForm: _,
1494
+ setInitForm: g,
1495
+ isInitializing: S,
1496
+ isHarvesting: p,
1497
+ actionMessage: A,
1498
+ onInitialize: c,
1499
+ onHarvestFees: b,
1500
+ formatDate: F
1501
+ }
1502
+ ) : v === "redemptions" ? /* @__PURE__ */ e(at, { redemptions: s, formatDate: F }) : v === "compliance" ? /* @__PURE__ */ e(We, { serverUrl: n, apiKey: i, authManager: r }) : v === "liquidity" ? /* @__PURE__ */ e(
1503
+ Qe,
1504
+ {
1505
+ serverUrl: n,
1506
+ authManager: r,
1507
+ mintConfigured: !!a?.configured,
1508
+ mintAddress: a?.mintAddress,
1509
+ tokenDecimals: a?.tokenDecimals
1510
+ }
1511
+ ) : v === "asset-classes" ? /* @__PURE__ */ e(Me, { serverUrl: n, apiKey: i, authManager: r, onNavigateToLiquidity: () => x("liquidity") }) : /* @__PURE__ */ e(Oe, { serverUrl: n, apiKey: i, authManager: r })
1512
+ ] });
1513
+ }
1514
+ function rt({
1515
+ mintStatus: n,
1516
+ initForm: i,
1517
+ setInitForm: r,
1518
+ isInitializing: a,
1519
+ isHarvesting: l,
1520
+ actionMessage: s,
1521
+ onInitialize: m,
1522
+ onHarvestFees: u,
1523
+ formatDate: f
1524
+ }) {
1525
+ return n?.configured ? /* @__PURE__ */ t("div", { children: [
1526
+ /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", style: { marginBottom: "1rem" }, children: "Token-22 Mint Status" }),
1527
+ /* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "0.75rem", maxWidth: 600 }, children: [
1528
+ /* @__PURE__ */ e(E, { label: "Mint Address", value: n.mintAddress, mono: !0 }),
1529
+ /* @__PURE__ */ e(E, { label: "Token Symbol", value: n.tokenSymbol }),
1530
+ /* @__PURE__ */ e(E, { label: "Decimals", value: String(n.tokenDecimals) }),
1531
+ /* @__PURE__ */ e(E, { label: "Transfer Fee", value: `${n.transferFeeBps} bps (${((n.transferFeeBps ?? 0) / 100).toFixed(2)}%)` }),
1532
+ /* @__PURE__ */ e(E, { label: "Max Transfer Fee", value: String(n.maxTransferFee) }),
1533
+ /* @__PURE__ */ e(E, { label: "Treasury", value: n.treasuryAddress, mono: !0 }),
1534
+ /* @__PURE__ */ e(E, { label: "Authority", value: n.mintAuthority, mono: !0 }),
1535
+ /* @__PURE__ */ e(E, { label: "Created", value: n.createdAt ? f(n.createdAt) : "—" })
1536
+ ] }),
1537
+ /* @__PURE__ */ t("div", { style: { marginTop: "1.5rem", display: "flex", gap: "0.75rem", alignItems: "center" }, children: [
1538
+ /* @__PURE__ */ e(
1539
+ "button",
1540
+ {
1541
+ className: "cedros-admin__button cedros-admin__button--primary",
1542
+ onClick: u,
1543
+ disabled: l,
1544
+ children: l ? "Harvesting..." : "Harvest Transfer Fees"
1545
+ }
1546
+ ),
1547
+ s && /* @__PURE__ */ e("span", { style: { fontSize: 13, opacity: 0.8 }, children: s })
1548
+ ] })
1549
+ ] }) : /* @__PURE__ */ t("div", { children: [
1550
+ /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", style: { marginBottom: "0.5rem" }, children: "Initialize Token-22 Mint" }),
1551
+ /* @__PURE__ */ e("p", { style: { opacity: 0.7, marginBottom: "1rem", fontSize: 14 }, children: "Create a Token-22 mint with transfer fee extension for the secondary market. This is a one-time operation per tenant." }),
1552
+ /* @__PURE__ */ t("form", { onSubmit: m, children: [
1553
+ /* @__PURE__ */ t("div", { className: "cedros-admin__form-row", children: [
1554
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1555
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Treasury address (Solana)" }),
1556
+ /* @__PURE__ */ e(
1557
+ "input",
1558
+ {
1559
+ type: "text",
1560
+ className: "cedros-admin__input",
1561
+ value: i.treasuryAddress,
1562
+ onChange: (d) => r((h) => ({ ...h, treasuryAddress: d.target.value })),
1563
+ placeholder: "e.g., 7xKX...",
1564
+ required: !0
1565
+ }
1566
+ )
1567
+ ] }),
1568
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1569
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Token symbol" }),
1570
+ /* @__PURE__ */ e(
1571
+ "input",
1572
+ {
1573
+ type: "text",
1574
+ className: "cedros-admin__input",
1575
+ value: i.tokenSymbol,
1576
+ onChange: (d) => r((h) => ({ ...h, tokenSymbol: d.target.value })),
1577
+ placeholder: "storeUSD"
1578
+ }
1579
+ )
1580
+ ] })
1581
+ ] }),
1582
+ /* @__PURE__ */ t("div", { className: "cedros-admin__form-row", children: [
1583
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1584
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Token decimals" }),
1585
+ /* @__PURE__ */ e(
1586
+ "input",
1587
+ {
1588
+ type: "number",
1589
+ className: "cedros-admin__input",
1590
+ value: i.tokenDecimals,
1591
+ onChange: (d) => r((h) => ({ ...h, tokenDecimals: parseInt(d.target.value) || 2 })),
1592
+ min: "0",
1593
+ max: "9"
1594
+ }
1595
+ )
1596
+ ] }),
1597
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1598
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Transfer fee (basis points)" }),
1599
+ /* @__PURE__ */ e(
1600
+ "input",
1601
+ {
1602
+ type: "number",
1603
+ className: "cedros-admin__input",
1604
+ value: i.transferFeeBps,
1605
+ onChange: (d) => r((h) => ({ ...h, transferFeeBps: parseInt(d.target.value) || 0 })),
1606
+ min: "0",
1607
+ max: "10000"
1608
+ }
1609
+ ),
1610
+ /* @__PURE__ */ e("div", { style: { marginTop: 4, fontSize: 12, opacity: 0.75 }, children: "e.g., 250 = 2.5% fee on secondary market transfers" })
1611
+ ] }),
1612
+ /* @__PURE__ */ t("div", { className: "cedros-admin__field", children: [
1613
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Max transfer fee (atomic)" }),
1614
+ /* @__PURE__ */ e(
1615
+ "input",
1616
+ {
1617
+ type: "number",
1618
+ className: "cedros-admin__input",
1619
+ value: i.maxTransferFee,
1620
+ onChange: (d) => r((h) => ({ ...h, maxTransferFee: parseInt(d.target.value) || 0 })),
1621
+ min: "0"
1622
+ }
1623
+ )
1624
+ ] })
1625
+ ] }),
1626
+ /* @__PURE__ */ t("div", { className: "cedros-admin__form-actions", style: { marginTop: "1rem" }, children: [
1627
+ /* @__PURE__ */ e("button", { type: "submit", className: "cedros-admin__button cedros-admin__button--primary", disabled: a, children: a ? "Creating Mint..." : "Initialize Mint" }),
1628
+ s && /* @__PURE__ */ e("span", { style: { marginLeft: "0.75rem", fontSize: 13, opacity: 0.8 }, children: s })
1629
+ ] })
1630
+ ] })
1631
+ ] });
1632
+ }
1633
+ function E({ label: n, value: i, mono: r }) {
1634
+ return /* @__PURE__ */ t(O, { children: [
1635
+ /* @__PURE__ */ e("div", { style: { fontWeight: 500, fontSize: 13 }, children: n }),
1636
+ /* @__PURE__ */ e("div", { style: {
1637
+ fontSize: 13,
1638
+ fontFamily: r ? "monospace" : "inherit",
1639
+ wordBreak: r ? "break-all" : "normal",
1640
+ opacity: i ? 1 : 0.5
1641
+ }, children: i || "—" })
1642
+ ] });
1643
+ }
1644
+ function at({
1645
+ redemptions: n,
1646
+ formatDate: i
1647
+ }) {
1648
+ return n.length ? /* @__PURE__ */ e("div", { className: "cedros-admin__table-container", children: /* @__PURE__ */ t("table", { className: "cedros-admin__table", children: [
1649
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
1650
+ /* @__PURE__ */ e("th", { children: "Date" }),
1651
+ /* @__PURE__ */ e("th", { children: "Order" }),
1652
+ /* @__PURE__ */ e("th", { children: "Product" }),
1653
+ /* @__PURE__ */ e("th", { children: "Buyer" }),
1654
+ /* @__PURE__ */ e("th", { children: "Recipient" }),
1655
+ /* @__PURE__ */ e("th", { children: "Value" }),
1656
+ /* @__PURE__ */ e("th", { children: "Token Minted" })
1657
+ ] }) }),
1658
+ /* @__PURE__ */ e("tbody", { children: n.map((r) => /* @__PURE__ */ t("tr", { children: [
1659
+ /* @__PURE__ */ e("td", { style: { whiteSpace: "nowrap" }, children: i(r.createdAt) }),
1660
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ t("code", { style: { fontSize: 12 }, children: [
1661
+ r.orderId.slice(0, 8),
1662
+ "..."
1663
+ ] }) }),
1664
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { style: { fontSize: 12 }, children: r.productId }) }),
1665
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ t("code", { style: { fontSize: 12 }, children: [
1666
+ r.buyerUserId.slice(0, 8),
1667
+ "..."
1668
+ ] }) }),
1669
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ t("code", { style: { fontSize: 12 }, children: [
1670
+ r.recipientUserId.slice(0, 8),
1671
+ "..."
1672
+ ] }) }),
1673
+ /* @__PURE__ */ t("td", { children: [
1674
+ "$",
1675
+ (r.faceValueCents / 100).toFixed(2),
1676
+ " ",
1677
+ r.currency.toUpperCase()
1678
+ ] }),
1679
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: `cedros-admin__badge ${r.tokenMinted ? "cedros-admin__badge--success" : "cedros-admin__badge--muted"}`, children: r.tokenMinted ? "Yes" : "No" }) })
1680
+ ] }, r.id)) })
1681
+ ] }) }) : /* @__PURE__ */ e("div", { style: { padding: "2rem", textAlign: "center", opacity: 0.6 }, children: "No gift card redemptions yet." });
1682
+ }
1683
+ export {
1684
+ ct as Token22Section
1685
+ };