@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.
- package/dist/{AISettingsSection-BXWZcMQT.js → AISettingsSection-DAztmwnN.js} +1 -1
- package/dist/{AISettingsSection-8eDaxYp8.mjs → AISettingsSection-DpMIk431.mjs} +2 -2
- package/dist/{AutosaveIndicator-3S7EvXip.mjs → AutosaveIndicator-BRCqAWqP.mjs} +1 -1
- package/dist/{AutosaveIndicator-DW4IPbZ5.js → AutosaveIndicator-BnQkKxzr.js} +1 -1
- package/dist/{CedrosContext-D-lnoEkR.js → CedrosContext-7dwmEeUY.js} +2 -2
- package/dist/{CedrosContext-BE6P5PQ0.mjs → CedrosContext-BlArEF7k.mjs} +95 -78
- package/dist/{CryptoButton-Dy-g3bR0.js → CryptoButton-C1AAOOfj.js} +1 -1
- package/dist/{CryptoButton-CksMkZjL.mjs → CryptoButton-CREryx1l.mjs} +2 -2
- package/dist/{FAQSection-Dg-I7Z-N.mjs → FAQSection-Ruzs7a-0.mjs} +1 -1
- package/dist/{FAQSection-r6eKjfdO.js → FAQSection-yw64HLy3.js} +1 -1
- package/dist/{MessagingSection-D39EuOLN.mjs → MessagingSection-BLRjfBQT.mjs} +2 -2
- package/dist/{MessagingSection-Cld5Q7ZM.js → MessagingSection-Dp_SaXsv.js} +1 -1
- package/dist/OrdersSection-C2dyWqrR.js +1 -0
- package/dist/OrdersSection-l-MtP9EN.mjs +233 -0
- package/dist/{PaymentSettingsSection-CEGHN6VI.mjs → PaymentSettingsSection-Bbq93UtC.mjs} +1 -1
- package/dist/{PaymentSettingsSection-B-MRsh1K.js → PaymentSettingsSection-C5bhLgU7.js} +1 -1
- package/dist/{SettingsSection-ZrzfLBlS.js → SettingsSection-D_pKPRrP.js} +1 -1
- package/dist/{SettingsSection-CPFOuoZG.mjs → SettingsSection-DorqCFXE.mjs} +1 -1
- package/dist/SingleCategorySettings-BAND8Zkw.mjs +1006 -0
- package/dist/SingleCategorySettings-Cg-zuJfr.js +3 -0
- package/dist/{StorefrontSection-f54ySA6i.mjs → StorefrontSection-FSOxBclu.mjs} +2 -2
- package/dist/{StorefrontSection-DGVcJu1T.js → StorefrontSection-QZPEZ6Lz.js} +1 -1
- package/dist/{SubscriptionsSection-F2IiU2jv.mjs → SubscriptionsSection-C4TDXCX2.mjs} +1 -1
- package/dist/{SubscriptionsSection-fzbL5DGC.js → SubscriptionsSection-DYr99VzB.js} +1 -1
- package/dist/Token22Section-Cmn2lKcd.mjs +1685 -0
- package/dist/Token22Section-D3nnUyim.js +1 -0
- package/dist/{WalletManager-QcfgQmap.js → WalletManager-Bwk3rgr1.js} +1 -1
- package/dist/{WalletManager-D78miaJ2.mjs → WalletManager-peBN6RDH.mjs} +1 -1
- package/dist/bn-CHdpZHQm.mjs +1185 -0
- package/dist/bn-RbgIlcHc.js +1 -0
- package/dist/configApi-Ch0Rr7TD.mjs +554 -0
- package/dist/configApi-CxEbCAgG.js +1 -0
- package/dist/crypto-only.js +1 -1
- package/dist/crypto-only.mjs +54 -52
- package/dist/{index-bqhsxBTY.mjs → index-CKNB7XsA.mjs} +6709 -5888
- package/dist/index-vEe2Y39x.js +84 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +34 -32
- package/dist/pay-react_false-CPX8Vyp9.mjs +5 -0
- package/dist/pay-react_false-DaeIe3_l.js +1 -0
- package/dist/{sections-Dh0qFSUW.js → sections-Cklkxd85.js} +1 -1
- package/dist/{sections-CiAMjlPd.mjs → sections-Dt6vxDU4.mjs} +1 -1
- package/dist/src/components/CreditsBalance.d.ts +24 -0
- package/dist/src/components/CreditsBalance.d.ts.map +1 -0
- package/dist/src/components/admin/AssetClassesTab.d.ts +20 -0
- package/dist/src/components/admin/AssetClassesTab.d.ts.map +1 -0
- package/dist/src/components/admin/AssetRedemptionManager.d.ts +21 -0
- package/dist/src/components/admin/AssetRedemptionManager.d.ts.map +1 -0
- package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts +1 -1
- package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts.map +1 -1
- package/dist/src/components/admin/GiftCardComplianceTab.d.ts +3 -0
- package/dist/src/components/admin/GiftCardComplianceTab.d.ts.map +1 -0
- package/dist/src/components/admin/LiquidityPoolTab.d.ts +11 -0
- package/dist/src/components/admin/LiquidityPoolTab.d.ts.map +1 -0
- package/dist/src/components/admin/OrdersSection.d.ts +3 -0
- package/dist/src/components/admin/OrdersSection.d.ts.map +1 -0
- package/dist/src/components/admin/ProductsSection.d.ts.map +1 -1
- package/dist/src/components/admin/RedemptionFormBuilder.d.ts +25 -0
- package/dist/src/components/admin/RedemptionFormBuilder.d.ts.map +1 -0
- package/dist/src/components/admin/Token22Section.d.ts +3 -0
- package/dist/src/components/admin/Token22Section.d.ts.map +1 -0
- package/dist/src/components/admin/configApi.d.ts.map +1 -1
- package/dist/src/components/admin/index.d.ts +3 -0
- package/dist/src/components/admin/index.d.ts.map +1 -1
- package/dist/src/ecommerce/adapters/mock/mockAdapter.d.ts.map +1 -1
- package/dist/src/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -1
- package/dist/src/ecommerce/components/catalog/AssetBadge.d.ts +13 -0
- package/dist/src/ecommerce/components/catalog/AssetBadge.d.ts.map +1 -0
- package/dist/src/ecommerce/components/catalog/ProductCard.d.ts.map +1 -1
- package/dist/src/ecommerce/components/checkout/CheckoutForm.d.ts.map +1 -1
- package/dist/src/ecommerce/components/checkout/CheckoutReceipt.d.ts +9 -2
- package/dist/src/ecommerce/components/checkout/CheckoutReceipt.d.ts.map +1 -1
- package/dist/src/ecommerce/components/checkout/CheckoutSuccessPage.d.ts +7 -1
- package/dist/src/ecommerce/components/checkout/CheckoutSuccessPage.d.ts.map +1 -1
- package/dist/src/ecommerce/components/checkout/RedemptionForm.d.ts +22 -0
- package/dist/src/ecommerce/components/checkout/RedemptionForm.d.ts.map +1 -0
- package/dist/src/ecommerce/components/gift-cards/GiftCardRedemptionPage.d.ts +36 -0
- package/dist/src/ecommerce/components/gift-cards/GiftCardRedemptionPage.d.ts.map +1 -0
- package/dist/src/ecommerce/components/orders/OrderCard.d.ts.map +1 -1
- package/dist/src/ecommerce/components/orders/OrderDetails.d.ts +5 -1
- package/dist/src/ecommerce/components/orders/OrderDetails.d.ts.map +1 -1
- package/dist/src/ecommerce/index.d.ts +6 -0
- package/dist/src/ecommerce/index.d.ts.map +1 -1
- package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts +1 -0
- package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts.map +1 -1
- package/dist/src/ecommerce/state/checkout/useCheckout.d.ts.map +1 -1
- package/dist/src/ecommerce/templates/ProductTemplate.d.ts.map +1 -1
- package/dist/src/ecommerce/templates/PurchaseHistoryTemplate.d.ts +5 -1
- package/dist/src/ecommerce/templates/PurchaseHistoryTemplate.d.ts.map +1 -1
- package/dist/src/ecommerce/types.d.ts +20 -0
- package/dist/src/ecommerce/types.d.ts.map +1 -1
- package/dist/src/ecommerce/utils/cartItemMetadata.d.ts.map +1 -1
- package/dist/src/ecommerce/utils/safeHref.d.ts +9 -0
- package/dist/src/ecommerce/utils/safeHref.d.ts.map +1 -0
- package/dist/src/hooks/useCreditsBalance.d.ts +32 -0
- package/dist/src/hooks/useCreditsBalance.d.ts.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/managers/CreditsManager.d.ts +15 -0
- package/dist/src/managers/CreditsManager.d.ts.map +1 -1
- package/dist/src/managers/MeteoraPoolManager.d.ts +86 -0
- package/dist/src/managers/MeteoraPoolManager.d.ts.map +1 -0
- package/dist/stripe-only.js +1 -1
- package/dist/stripe-only.mjs +2 -2
- package/dist/{styles-BWrLnaUW.js → styles-21F1-oqx.js} +1 -1
- package/dist/{styles--eKKnfdj.mjs → styles-2VMpwuaI.mjs} +3 -3
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.mjs +1 -1
- package/dist/{walletPool-BqNfOhB0.js → walletPool-Ddv33tej.js} +1 -1
- package/dist/{walletPool-DShNjCQ6.mjs → walletPool-DgQsh7Se.mjs} +1 -1
- package/package.json +5 -1
- package/dist/SingleCategorySettings-DhHGIGwB.mjs +0 -1418
- package/dist/SingleCategorySettings-DxjCafCk.js +0 -3
- package/dist/index-7YUxR4u5.js +0 -84
|
@@ -0,0 +1,1006 @@
|
|
|
1
|
+
import { jsxs as i, jsx as t, Fragment as W } from "react/jsx-runtime";
|
|
2
|
+
import { useState as S, useEffect as j, useMemo as H, useCallback as z } from "react";
|
|
3
|
+
import { I as E, F as Q, E as L, h as ee } from "./index-CKNB7XsA.mjs";
|
|
4
|
+
import { R as B, i as P, C as Z, a as te } from "./configApi-Ch0Rr7TD.mjs";
|
|
5
|
+
import { u as re } from "./useAutosave-YwMqRzqy.mjs";
|
|
6
|
+
import { A as ne } from "./AutosaveIndicator-BRCqAWqP.mjs";
|
|
7
|
+
import { S as F } from "./CedrosContext-BlArEF7k.mjs";
|
|
8
|
+
const ie = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
9
|
+
function O(b) {
|
|
10
|
+
return !b || b.trim() === "" ? { valid: !0 } : ie.test(b.trim()) ? { valid: !0 } : { valid: !1, error: "Invalid Solana address" };
|
|
11
|
+
}
|
|
12
|
+
function oe({
|
|
13
|
+
label: b,
|
|
14
|
+
value: f,
|
|
15
|
+
onChange: h,
|
|
16
|
+
decimals: o,
|
|
17
|
+
onDecimalsChange: w,
|
|
18
|
+
disabled: d = !1,
|
|
19
|
+
description: s,
|
|
20
|
+
customSymbol: l = "",
|
|
21
|
+
customIcon: p = "",
|
|
22
|
+
onCustomSymbolChange: c,
|
|
23
|
+
onCustomIconChange: y
|
|
24
|
+
}) {
|
|
25
|
+
const [x, R] = S(!1), u = Object.entries(F), v = !!F[f], k = x || !!f && !v, N = (e) => {
|
|
26
|
+
if (e === "custom")
|
|
27
|
+
R(!0), v && h("");
|
|
28
|
+
else {
|
|
29
|
+
R(!1), h(e);
|
|
30
|
+
const n = F[e];
|
|
31
|
+
n && w && w(n.decimals), c && c(""), y && y("");
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
|
|
35
|
+
/* @__PURE__ */ t("label", { className: "cedros-admin__field-label", children: b }),
|
|
36
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
|
|
37
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: [
|
|
38
|
+
u.map(([e, n]) => /* @__PURE__ */ i(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
type: "button",
|
|
42
|
+
onClick: () => N(e),
|
|
43
|
+
disabled: d,
|
|
44
|
+
style: {
|
|
45
|
+
display: "flex",
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
gap: "0.5rem",
|
|
48
|
+
padding: "0.5rem 0.75rem",
|
|
49
|
+
border: f === e ? "2px solid var(--cedros-admin-primary, #171717)" : "1px solid var(--cedros-admin-border, #d4d4d4)",
|
|
50
|
+
borderRadius: "0.5rem",
|
|
51
|
+
background: f === e ? "var(--cedros-admin-primary-bg, #f5f5f5)" : "var(--cedros-admin-bg, #fff)",
|
|
52
|
+
cursor: d ? "not-allowed" : "pointer",
|
|
53
|
+
opacity: d ? 0.5 : 1,
|
|
54
|
+
fontWeight: f === e ? 600 : 400
|
|
55
|
+
},
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ t(
|
|
58
|
+
"img",
|
|
59
|
+
{
|
|
60
|
+
src: n.icon,
|
|
61
|
+
alt: n.symbol,
|
|
62
|
+
style: { width: 20, height: 20, borderRadius: "50%" },
|
|
63
|
+
onError: (r) => {
|
|
64
|
+
r.target.style.display = "none";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ t("span", { children: n.symbol })
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
e
|
|
72
|
+
)),
|
|
73
|
+
/* @__PURE__ */ i(
|
|
74
|
+
"button",
|
|
75
|
+
{
|
|
76
|
+
type: "button",
|
|
77
|
+
onClick: () => N("custom"),
|
|
78
|
+
disabled: d,
|
|
79
|
+
style: {
|
|
80
|
+
display: "flex",
|
|
81
|
+
alignItems: "center",
|
|
82
|
+
gap: "0.5rem",
|
|
83
|
+
padding: "0.5rem 0.75rem",
|
|
84
|
+
border: k ? "2px solid var(--cedros-admin-primary, #171717)" : "1px solid var(--cedros-admin-border, #d4d4d4)",
|
|
85
|
+
borderRadius: "0.5rem",
|
|
86
|
+
background: k ? "var(--cedros-admin-primary-bg, #f5f5f5)" : "var(--cedros-admin-bg, #fff)",
|
|
87
|
+
cursor: d ? "not-allowed" : "pointer",
|
|
88
|
+
opacity: d ? 0.5 : 1,
|
|
89
|
+
fontWeight: k ? 600 : 400
|
|
90
|
+
},
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ t("span", { style: { fontSize: "1rem" }, children: "+" }),
|
|
93
|
+
/* @__PURE__ */ t("span", { children: "Custom" })
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
] }),
|
|
98
|
+
k && /* @__PURE__ */ i("div", { style: {
|
|
99
|
+
display: "flex",
|
|
100
|
+
flexDirection: "column",
|
|
101
|
+
gap: "0.75rem",
|
|
102
|
+
padding: "1rem",
|
|
103
|
+
background: "var(--cedros-admin-bg-muted, #f9fafb)",
|
|
104
|
+
borderRadius: "0.5rem",
|
|
105
|
+
border: "1px solid var(--cedros-admin-border, #e5e7eb)"
|
|
106
|
+
}, children: [
|
|
107
|
+
/* @__PURE__ */ i("div", { children: [
|
|
108
|
+
/* @__PURE__ */ t("label", { style: {
|
|
109
|
+
display: "block",
|
|
110
|
+
fontSize: "0.75rem",
|
|
111
|
+
fontWeight: 500,
|
|
112
|
+
marginBottom: "0.25rem",
|
|
113
|
+
color: "var(--cedros-admin-text-muted, #64748b)"
|
|
114
|
+
}, children: "Token Mint Address" }),
|
|
115
|
+
(() => {
|
|
116
|
+
const e = O(f);
|
|
117
|
+
return /* @__PURE__ */ i(W, { children: [
|
|
118
|
+
/* @__PURE__ */ t(
|
|
119
|
+
"input",
|
|
120
|
+
{
|
|
121
|
+
type: "text",
|
|
122
|
+
className: `cedros-admin__input ${e.valid ? "" : "cedros-admin__input--error"}`,
|
|
123
|
+
value: f,
|
|
124
|
+
onChange: (n) => h(n.target.value),
|
|
125
|
+
placeholder: "e.g., EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
126
|
+
disabled: d,
|
|
127
|
+
style: {
|
|
128
|
+
fontFamily: "monospace",
|
|
129
|
+
fontSize: "0.875rem",
|
|
130
|
+
borderColor: e.valid ? void 0 : "var(--cedros-admin-error, #dc2626)"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
!e.valid && /* @__PURE__ */ t("span", { style: { color: "var(--cedros-admin-error, #dc2626)", fontSize: "0.75rem", marginTop: "0.25rem", display: "block" }, children: e.error })
|
|
135
|
+
] });
|
|
136
|
+
})()
|
|
137
|
+
] }),
|
|
138
|
+
/* @__PURE__ */ i("div", { children: [
|
|
139
|
+
/* @__PURE__ */ t("label", { style: {
|
|
140
|
+
display: "block",
|
|
141
|
+
fontSize: "0.75rem",
|
|
142
|
+
fontWeight: 500,
|
|
143
|
+
marginBottom: "0.25rem",
|
|
144
|
+
color: "var(--cedros-admin-text-muted, #64748b)"
|
|
145
|
+
}, children: "Token Symbol" }),
|
|
146
|
+
/* @__PURE__ */ t(
|
|
147
|
+
"input",
|
|
148
|
+
{
|
|
149
|
+
type: "text",
|
|
150
|
+
className: "cedros-admin__input",
|
|
151
|
+
value: l,
|
|
152
|
+
onChange: (e) => c?.(e.target.value),
|
|
153
|
+
placeholder: "e.g., MYTOKEN",
|
|
154
|
+
disabled: d,
|
|
155
|
+
style: { textTransform: "uppercase" }
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
] }),
|
|
159
|
+
/* @__PURE__ */ i("div", { children: [
|
|
160
|
+
/* @__PURE__ */ t("label", { style: {
|
|
161
|
+
display: "block",
|
|
162
|
+
fontSize: "0.75rem",
|
|
163
|
+
fontWeight: 500,
|
|
164
|
+
marginBottom: "0.25rem",
|
|
165
|
+
color: "var(--cedros-admin-text-muted, #64748b)"
|
|
166
|
+
}, children: "Token Icon URL" }),
|
|
167
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center" }, children: [
|
|
168
|
+
/* @__PURE__ */ t(
|
|
169
|
+
"input",
|
|
170
|
+
{
|
|
171
|
+
type: "text",
|
|
172
|
+
className: "cedros-admin__input",
|
|
173
|
+
value: p,
|
|
174
|
+
onChange: (e) => y?.(e.target.value),
|
|
175
|
+
placeholder: "https://example.com/token-logo.png",
|
|
176
|
+
disabled: d,
|
|
177
|
+
style: { flex: 1 }
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
p && /* @__PURE__ */ t(
|
|
181
|
+
"img",
|
|
182
|
+
{
|
|
183
|
+
src: p,
|
|
184
|
+
alt: "Token icon preview",
|
|
185
|
+
style: {
|
|
186
|
+
width: 32,
|
|
187
|
+
height: 32,
|
|
188
|
+
borderRadius: "50%",
|
|
189
|
+
border: "1px solid var(--cedros-admin-border, #e5e7eb)",
|
|
190
|
+
objectFit: "cover"
|
|
191
|
+
},
|
|
192
|
+
onError: (e) => {
|
|
193
|
+
e.target.style.display = "none";
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
] }),
|
|
198
|
+
/* @__PURE__ */ t("div", { style: {
|
|
199
|
+
fontSize: "0.7rem",
|
|
200
|
+
color: "var(--cedros-admin-text-muted, #94a3b8)",
|
|
201
|
+
marginTop: "0.25rem"
|
|
202
|
+
}, children: "Shown to customers during checkout" })
|
|
203
|
+
] }),
|
|
204
|
+
/* @__PURE__ */ i("div", { children: [
|
|
205
|
+
/* @__PURE__ */ t("label", { style: {
|
|
206
|
+
display: "block",
|
|
207
|
+
fontSize: "0.75rem",
|
|
208
|
+
fontWeight: 500,
|
|
209
|
+
marginBottom: "0.25rem",
|
|
210
|
+
color: "var(--cedros-admin-text-muted, #64748b)"
|
|
211
|
+
}, children: "Token Decimals" }),
|
|
212
|
+
/* @__PURE__ */ t(
|
|
213
|
+
"input",
|
|
214
|
+
{
|
|
215
|
+
type: "number",
|
|
216
|
+
className: "cedros-admin__input",
|
|
217
|
+
value: o ?? 6,
|
|
218
|
+
onChange: (e) => w?.(parseInt(e.target.value, 10) || 0),
|
|
219
|
+
min: 0,
|
|
220
|
+
max: 18,
|
|
221
|
+
disabled: d,
|
|
222
|
+
style: { width: "100px" }
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
/* @__PURE__ */ t("div", { style: {
|
|
226
|
+
fontSize: "0.7rem",
|
|
227
|
+
color: "var(--cedros-admin-text-muted, #94a3b8)",
|
|
228
|
+
marginTop: "0.25rem"
|
|
229
|
+
}, children: "Most SPL tokens use 6 decimals (like USDC)" })
|
|
230
|
+
] })
|
|
231
|
+
] }),
|
|
232
|
+
f && v && /* @__PURE__ */ t("div", { style: {
|
|
233
|
+
fontSize: "0.75rem",
|
|
234
|
+
color: "var(--cedros-admin-text-muted, #64748b)",
|
|
235
|
+
fontFamily: "monospace",
|
|
236
|
+
wordBreak: "break-all"
|
|
237
|
+
}, children: f }),
|
|
238
|
+
s && /* @__PURE__ */ t("div", { style: {
|
|
239
|
+
fontSize: "0.75rem",
|
|
240
|
+
color: "var(--cedros-admin-text-muted, #64748b)",
|
|
241
|
+
marginTop: "0.25rem"
|
|
242
|
+
}, children: s })
|
|
243
|
+
] })
|
|
244
|
+
] });
|
|
245
|
+
}
|
|
246
|
+
function ae({
|
|
247
|
+
label: b,
|
|
248
|
+
value: f,
|
|
249
|
+
onChange: h,
|
|
250
|
+
disabled: o = !1,
|
|
251
|
+
description: w
|
|
252
|
+
}) {
|
|
253
|
+
const [d, s] = S(/* @__PURE__ */ new Set()), [l, p] = S(null), [c, y] = S(""), x = Array.isArray(f) ? f : [], R = (e) => {
|
|
254
|
+
s((n) => {
|
|
255
|
+
const r = new Set(n);
|
|
256
|
+
return r.has(e) ? r.delete(e) : r.add(e), r;
|
|
257
|
+
});
|
|
258
|
+
}, u = () => {
|
|
259
|
+
h([...x, ""]), p(x.length), y("");
|
|
260
|
+
}, I = (e, n) => {
|
|
261
|
+
const r = [...x];
|
|
262
|
+
r[e] = n, h(r);
|
|
263
|
+
}, v = (e) => {
|
|
264
|
+
const n = x.filter((r, g) => g !== e);
|
|
265
|
+
h(n), s((r) => {
|
|
266
|
+
const g = /* @__PURE__ */ new Set();
|
|
267
|
+
return r.forEach((_) => {
|
|
268
|
+
_ < e ? g.add(_) : _ > e && g.add(_ - 1);
|
|
269
|
+
}), g;
|
|
270
|
+
});
|
|
271
|
+
}, A = (e) => {
|
|
272
|
+
p(e), y(x[e] || "");
|
|
273
|
+
}, k = () => {
|
|
274
|
+
l !== null && (I(l, c), p(null), y(""));
|
|
275
|
+
}, N = () => {
|
|
276
|
+
l !== null && x[l] === "" && v(l), p(null), y("");
|
|
277
|
+
};
|
|
278
|
+
return /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
|
|
279
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "0.5rem" }, children: [
|
|
280
|
+
/* @__PURE__ */ t("label", { className: "cedros-admin__field-label", style: { marginBottom: 0 }, children: b }),
|
|
281
|
+
/* @__PURE__ */ i(
|
|
282
|
+
"button",
|
|
283
|
+
{
|
|
284
|
+
type: "button",
|
|
285
|
+
onClick: u,
|
|
286
|
+
disabled: o,
|
|
287
|
+
style: {
|
|
288
|
+
display: "flex",
|
|
289
|
+
alignItems: "center",
|
|
290
|
+
gap: "0.25rem",
|
|
291
|
+
padding: "0.25rem 0.5rem",
|
|
292
|
+
fontSize: "0.75rem",
|
|
293
|
+
border: "1px solid var(--cedros-admin-border, #d4d4d4)",
|
|
294
|
+
borderRadius: "0.375rem",
|
|
295
|
+
background: "var(--cedros-admin-bg, #fff)",
|
|
296
|
+
cursor: o ? "not-allowed" : "pointer",
|
|
297
|
+
opacity: o ? 0.5 : 1
|
|
298
|
+
},
|
|
299
|
+
children: [
|
|
300
|
+
E.plus,
|
|
301
|
+
"Add"
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
)
|
|
305
|
+
] }),
|
|
306
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
|
|
307
|
+
x.length === 0 && /* @__PURE__ */ t("div", { style: {
|
|
308
|
+
padding: "1rem",
|
|
309
|
+
textAlign: "center",
|
|
310
|
+
color: "var(--cedros-admin-text-muted, #64748b)",
|
|
311
|
+
fontSize: "0.875rem",
|
|
312
|
+
border: "1px dashed var(--cedros-admin-border, #d4d4d4)",
|
|
313
|
+
borderRadius: "0.5rem"
|
|
314
|
+
}, children: 'No items. Click "Add" to create one.' }),
|
|
315
|
+
x.map((e, n) => {
|
|
316
|
+
const r = d.has(n), g = l === n, _ = e === B;
|
|
317
|
+
return /* @__PURE__ */ t(
|
|
318
|
+
"div",
|
|
319
|
+
{
|
|
320
|
+
style: {
|
|
321
|
+
display: "flex",
|
|
322
|
+
alignItems: "center",
|
|
323
|
+
gap: "0.5rem",
|
|
324
|
+
padding: "0.5rem",
|
|
325
|
+
background: "var(--cedros-admin-bg-muted, #f9fafb)",
|
|
326
|
+
borderRadius: "0.375rem",
|
|
327
|
+
border: "1px solid var(--cedros-admin-border, #e5e7eb)"
|
|
328
|
+
},
|
|
329
|
+
children: g ? /* @__PURE__ */ i(W, { children: [
|
|
330
|
+
/* @__PURE__ */ t(
|
|
331
|
+
"input",
|
|
332
|
+
{
|
|
333
|
+
type: "text",
|
|
334
|
+
className: "cedros-admin__input",
|
|
335
|
+
value: c,
|
|
336
|
+
onChange: (a) => y(a.target.value),
|
|
337
|
+
placeholder: "Enter wallet keypair...",
|
|
338
|
+
autoFocus: !0,
|
|
339
|
+
style: { flex: 1, fontFamily: "monospace", fontSize: "0.75rem" },
|
|
340
|
+
onKeyDown: (a) => {
|
|
341
|
+
a.key === "Enter" && k(), a.key === "Escape" && N();
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
),
|
|
345
|
+
/* @__PURE__ */ t(
|
|
346
|
+
"button",
|
|
347
|
+
{
|
|
348
|
+
type: "button",
|
|
349
|
+
onClick: k,
|
|
350
|
+
style: {
|
|
351
|
+
padding: "0.375rem",
|
|
352
|
+
border: "none",
|
|
353
|
+
background: "var(--cedros-admin-success, #22c55e)",
|
|
354
|
+
color: "#fff",
|
|
355
|
+
borderRadius: "0.25rem",
|
|
356
|
+
cursor: "pointer"
|
|
357
|
+
},
|
|
358
|
+
title: "Save",
|
|
359
|
+
children: E.check
|
|
360
|
+
}
|
|
361
|
+
),
|
|
362
|
+
/* @__PURE__ */ t(
|
|
363
|
+
"button",
|
|
364
|
+
{
|
|
365
|
+
type: "button",
|
|
366
|
+
onClick: N,
|
|
367
|
+
style: {
|
|
368
|
+
padding: "0.375rem",
|
|
369
|
+
border: "none",
|
|
370
|
+
background: "var(--cedros-admin-text-muted, #64748b)",
|
|
371
|
+
color: "#fff",
|
|
372
|
+
borderRadius: "0.25rem",
|
|
373
|
+
cursor: "pointer"
|
|
374
|
+
},
|
|
375
|
+
title: "Cancel",
|
|
376
|
+
children: E.close
|
|
377
|
+
}
|
|
378
|
+
)
|
|
379
|
+
] }) : /* @__PURE__ */ i(W, { children: [
|
|
380
|
+
/* @__PURE__ */ t("div", { style: {
|
|
381
|
+
flex: 1,
|
|
382
|
+
fontFamily: "monospace",
|
|
383
|
+
fontSize: "0.75rem",
|
|
384
|
+
overflow: "hidden",
|
|
385
|
+
textOverflow: "ellipsis",
|
|
386
|
+
whiteSpace: "nowrap"
|
|
387
|
+
}, children: r && !_ ? e : _ ? "[REDACTED]" : "••••••••••••••••••••" }),
|
|
388
|
+
/* @__PURE__ */ t(
|
|
389
|
+
"button",
|
|
390
|
+
{
|
|
391
|
+
type: "button",
|
|
392
|
+
onClick: () => R(n),
|
|
393
|
+
disabled: o || _,
|
|
394
|
+
style: {
|
|
395
|
+
padding: "0.375rem",
|
|
396
|
+
border: "none",
|
|
397
|
+
background: "transparent",
|
|
398
|
+
cursor: o || _ ? "not-allowed" : "pointer",
|
|
399
|
+
opacity: o || _ ? 0.5 : 1,
|
|
400
|
+
color: "var(--cedros-admin-text-muted, #64748b)"
|
|
401
|
+
},
|
|
402
|
+
title: r ? "Hide" : "Show",
|
|
403
|
+
children: r ? E.eyeOff : E.eye
|
|
404
|
+
}
|
|
405
|
+
),
|
|
406
|
+
/* @__PURE__ */ t(
|
|
407
|
+
"button",
|
|
408
|
+
{
|
|
409
|
+
type: "button",
|
|
410
|
+
onClick: () => A(n),
|
|
411
|
+
disabled: o,
|
|
412
|
+
style: {
|
|
413
|
+
padding: "0.375rem",
|
|
414
|
+
border: "none",
|
|
415
|
+
background: "transparent",
|
|
416
|
+
cursor: o ? "not-allowed" : "pointer",
|
|
417
|
+
opacity: o ? 0.5 : 1,
|
|
418
|
+
color: "var(--cedros-admin-text-muted, #64748b)"
|
|
419
|
+
},
|
|
420
|
+
title: "Edit",
|
|
421
|
+
children: E.settings
|
|
422
|
+
}
|
|
423
|
+
),
|
|
424
|
+
/* @__PURE__ */ t(
|
|
425
|
+
"button",
|
|
426
|
+
{
|
|
427
|
+
type: "button",
|
|
428
|
+
onClick: () => v(n),
|
|
429
|
+
disabled: o,
|
|
430
|
+
style: {
|
|
431
|
+
padding: "0.375rem",
|
|
432
|
+
border: "none",
|
|
433
|
+
background: "transparent",
|
|
434
|
+
cursor: o ? "not-allowed" : "pointer",
|
|
435
|
+
opacity: o ? 0.5 : 1,
|
|
436
|
+
color: "var(--cedros-admin-error, #ef4444)"
|
|
437
|
+
},
|
|
438
|
+
title: "Delete",
|
|
439
|
+
children: E.trash
|
|
440
|
+
}
|
|
441
|
+
)
|
|
442
|
+
] })
|
|
443
|
+
},
|
|
444
|
+
n
|
|
445
|
+
);
|
|
446
|
+
})
|
|
447
|
+
] }),
|
|
448
|
+
w && /* @__PURE__ */ t("div", { style: {
|
|
449
|
+
fontSize: "0.75rem",
|
|
450
|
+
color: "var(--cedros-admin-text-muted, #64748b)",
|
|
451
|
+
marginTop: "0.5rem"
|
|
452
|
+
}, children: w })
|
|
453
|
+
] });
|
|
454
|
+
}
|
|
455
|
+
function q(b, f, h) {
|
|
456
|
+
const o = P(b, f), w = f.replace(/_/g, " ").replace(/\b\w/g, (p) => p.toUpperCase()), s = Z[b]?.fields?.[f], l = {
|
|
457
|
+
isSecret: o,
|
|
458
|
+
label: w,
|
|
459
|
+
description: s?.description,
|
|
460
|
+
hidden: s?.hidden,
|
|
461
|
+
showWhen: s?.showWhen
|
|
462
|
+
};
|
|
463
|
+
return s?.type === "dropdown" && s.options ? { ...l, type: "dropdown", options: s.options } : s?.type === "token_mint" ? { ...l, type: "token_mint" } : s?.type === "toggle" ? { ...l, type: "toggle" } : s?.type === "secret_array" ? { ...l, type: "secret_array", isSecret: !0 } : s?.type === "solana_address" ? { ...l, type: "solana_address" } : s?.type === "number" ? { ...l, type: "number", unit: s.unit } : typeof h == "boolean" ? { ...l, type: "boolean" } : typeof h == "number" ? { ...l, type: "number", unit: s?.unit } : Array.isArray(h) ? { ...l, type: "array" } : typeof h == "object" && h !== null ? { ...l, type: "object" } : { ...l, type: "string" };
|
|
464
|
+
}
|
|
465
|
+
function de({
|
|
466
|
+
category: b,
|
|
467
|
+
config: f,
|
|
468
|
+
originalConfig: h,
|
|
469
|
+
isLoading: o = !1,
|
|
470
|
+
onSave: w
|
|
471
|
+
}) {
|
|
472
|
+
const [d, s] = S(f), [l, p] = S(/* @__PURE__ */ new Set());
|
|
473
|
+
j(() => {
|
|
474
|
+
s(f);
|
|
475
|
+
}, [f]);
|
|
476
|
+
const c = H(() => {
|
|
477
|
+
const e = { ...d };
|
|
478
|
+
for (const n of Object.keys(e))
|
|
479
|
+
if (P(b, n)) {
|
|
480
|
+
const r = h[n], g = e[n];
|
|
481
|
+
(g === B || g === r) && (e[n] = B);
|
|
482
|
+
}
|
|
483
|
+
return e;
|
|
484
|
+
}, [d, h, b]), y = H(() => {
|
|
485
|
+
const e = d.token_mint;
|
|
486
|
+
return typeof e != "string" || !e ? !1 : !O(e).valid;
|
|
487
|
+
}, [d]), { status: x, error: R } = re({
|
|
488
|
+
data: c,
|
|
489
|
+
onSave: w,
|
|
490
|
+
debounceMs: 1500,
|
|
491
|
+
enabled: !y
|
|
492
|
+
}), u = z((e, n) => {
|
|
493
|
+
s((r) => ({ ...r, [e]: n }));
|
|
494
|
+
}, []), I = z((e) => {
|
|
495
|
+
p((n) => {
|
|
496
|
+
const r = new Set(n);
|
|
497
|
+
return r.has(e) ? r.delete(e) : r.add(e), r;
|
|
498
|
+
});
|
|
499
|
+
}, []), v = (e) => e ? /* @__PURE__ */ t("div", { style: {
|
|
500
|
+
fontSize: "0.75rem",
|
|
501
|
+
color: "var(--cedros-admin-text-muted, #64748b)",
|
|
502
|
+
marginTop: "0.25rem"
|
|
503
|
+
}, children: e }) : null, A = (e, n) => {
|
|
504
|
+
const r = q(b, e, h[e] ?? n);
|
|
505
|
+
if (r.type === "dropdown" && r.options)
|
|
506
|
+
return /* @__PURE__ */ t(
|
|
507
|
+
Q,
|
|
508
|
+
{
|
|
509
|
+
value: n,
|
|
510
|
+
onChange: (a) => u(e, a),
|
|
511
|
+
options: r.options.map((a) => ({ value: a, label: a })),
|
|
512
|
+
label: r.label,
|
|
513
|
+
description: r.description,
|
|
514
|
+
disabled: o
|
|
515
|
+
}
|
|
516
|
+
);
|
|
517
|
+
if (r.type === "token_mint")
|
|
518
|
+
return /* @__PURE__ */ t(
|
|
519
|
+
oe,
|
|
520
|
+
{
|
|
521
|
+
label: r.label,
|
|
522
|
+
value: n,
|
|
523
|
+
onChange: (a) => u(e, a),
|
|
524
|
+
decimals: d.token_decimals ?? 6,
|
|
525
|
+
onDecimalsChange: (a) => u("token_decimals", a),
|
|
526
|
+
disabled: o,
|
|
527
|
+
description: r.description,
|
|
528
|
+
customSymbol: d.custom_token_symbol || "",
|
|
529
|
+
customIcon: d.custom_token_icon || "",
|
|
530
|
+
onCustomSymbolChange: (a) => u("custom_token_symbol", a),
|
|
531
|
+
onCustomIconChange: (a) => u("custom_token_icon", a)
|
|
532
|
+
}
|
|
533
|
+
);
|
|
534
|
+
if (r.type === "toggle")
|
|
535
|
+
return /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
|
|
536
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", alignItems: "center", gap: "0.75rem" }, children: [
|
|
537
|
+
/* @__PURE__ */ t(
|
|
538
|
+
"button",
|
|
539
|
+
{
|
|
540
|
+
type: "button",
|
|
541
|
+
role: "switch",
|
|
542
|
+
"aria-checked": n,
|
|
543
|
+
onClick: () => u(e, !n),
|
|
544
|
+
disabled: o,
|
|
545
|
+
style: {
|
|
546
|
+
width: 44,
|
|
547
|
+
height: 24,
|
|
548
|
+
borderRadius: 12,
|
|
549
|
+
border: "none",
|
|
550
|
+
backgroundColor: n ? "var(--cedros-admin-primary, #171717)" : "var(--cedros-admin-border, #d4d4d4)",
|
|
551
|
+
cursor: o ? "not-allowed" : "pointer",
|
|
552
|
+
position: "relative",
|
|
553
|
+
transition: "background-color 0.2s",
|
|
554
|
+
opacity: o ? 0.5 : 1,
|
|
555
|
+
flexShrink: 0
|
|
556
|
+
},
|
|
557
|
+
children: /* @__PURE__ */ t(
|
|
558
|
+
"span",
|
|
559
|
+
{
|
|
560
|
+
style: {
|
|
561
|
+
position: "absolute",
|
|
562
|
+
top: 2,
|
|
563
|
+
left: n ? 22 : 2,
|
|
564
|
+
width: 20,
|
|
565
|
+
height: 20,
|
|
566
|
+
borderRadius: "50%",
|
|
567
|
+
backgroundColor: "#fff",
|
|
568
|
+
transition: "left 0.2s",
|
|
569
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
)
|
|
573
|
+
}
|
|
574
|
+
),
|
|
575
|
+
/* @__PURE__ */ t("span", { className: "cedros-admin__field-label", style: { marginBottom: 0 }, children: r.label })
|
|
576
|
+
] }),
|
|
577
|
+
v(r.description)
|
|
578
|
+
] });
|
|
579
|
+
if (r.type === "solana_address") {
|
|
580
|
+
const a = n || "", C = O(a);
|
|
581
|
+
return /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
|
|
582
|
+
/* @__PURE__ */ t("label", { className: "cedros-admin__field-label", children: r.label }),
|
|
583
|
+
/* @__PURE__ */ i("div", { style: { position: "relative" }, children: [
|
|
584
|
+
/* @__PURE__ */ t(
|
|
585
|
+
"input",
|
|
586
|
+
{
|
|
587
|
+
type: "text",
|
|
588
|
+
className: `cedros-admin__input ${C.valid ? "" : "cedros-admin__input--error"}`,
|
|
589
|
+
value: a,
|
|
590
|
+
onChange: (V) => u(e, V.target.value),
|
|
591
|
+
disabled: o,
|
|
592
|
+
placeholder: "e.g. 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
|
|
593
|
+
style: {
|
|
594
|
+
width: "100%",
|
|
595
|
+
fontFamily: "monospace",
|
|
596
|
+
fontSize: "0.875rem",
|
|
597
|
+
borderColor: C.valid ? void 0 : "var(--cedros-admin-error, #dc2626)",
|
|
598
|
+
paddingRight: a && C.valid ? "2rem" : void 0
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
),
|
|
602
|
+
a && C.valid && /* @__PURE__ */ t(
|
|
603
|
+
"span",
|
|
604
|
+
{
|
|
605
|
+
style: {
|
|
606
|
+
position: "absolute",
|
|
607
|
+
right: 10,
|
|
608
|
+
top: "50%",
|
|
609
|
+
transform: "translateY(-50%)",
|
|
610
|
+
color: "var(--cedros-admin-success, #16a34a)",
|
|
611
|
+
fontSize: "1rem"
|
|
612
|
+
},
|
|
613
|
+
title: "Valid Solana address",
|
|
614
|
+
children: "✓"
|
|
615
|
+
}
|
|
616
|
+
)
|
|
617
|
+
] }),
|
|
618
|
+
!C.valid && /* @__PURE__ */ t("span", { style: { color: "var(--cedros-admin-error, #dc2626)", fontSize: "0.75rem", marginTop: "0.25rem", display: "block" }, children: C.error }),
|
|
619
|
+
v(r.description)
|
|
620
|
+
] });
|
|
621
|
+
}
|
|
622
|
+
if (r.type === "boolean")
|
|
623
|
+
return /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
|
|
624
|
+
/* @__PURE__ */ i("label", { className: "cedros-admin__checkbox", children: [
|
|
625
|
+
/* @__PURE__ */ t(
|
|
626
|
+
"input",
|
|
627
|
+
{
|
|
628
|
+
type: "checkbox",
|
|
629
|
+
checked: n,
|
|
630
|
+
onChange: (a) => u(e, a.target.checked),
|
|
631
|
+
disabled: o
|
|
632
|
+
}
|
|
633
|
+
),
|
|
634
|
+
r.label
|
|
635
|
+
] }),
|
|
636
|
+
v(r.description)
|
|
637
|
+
] });
|
|
638
|
+
if (r.type === "number")
|
|
639
|
+
return /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
|
|
640
|
+
/* @__PURE__ */ i("label", { className: "cedros-admin__field-label", children: [
|
|
641
|
+
r.label,
|
|
642
|
+
r.unit && /* @__PURE__ */ i("span", { className: "cedros-admin__field-unit", children: [
|
|
643
|
+
" (",
|
|
644
|
+
r.unit,
|
|
645
|
+
")"
|
|
646
|
+
] })
|
|
647
|
+
] }),
|
|
648
|
+
/* @__PURE__ */ t(
|
|
649
|
+
"input",
|
|
650
|
+
{
|
|
651
|
+
type: "number",
|
|
652
|
+
className: "cedros-admin__input",
|
|
653
|
+
value: n,
|
|
654
|
+
onChange: (a) => u(e, parseFloat(a.target.value) || 0),
|
|
655
|
+
disabled: o
|
|
656
|
+
}
|
|
657
|
+
),
|
|
658
|
+
v(r.description)
|
|
659
|
+
] });
|
|
660
|
+
if (r.type === "secret_array")
|
|
661
|
+
return /* @__PURE__ */ t(
|
|
662
|
+
ae,
|
|
663
|
+
{
|
|
664
|
+
label: r.label,
|
|
665
|
+
value: n,
|
|
666
|
+
onChange: (a) => u(e, a),
|
|
667
|
+
disabled: o,
|
|
668
|
+
description: r.description
|
|
669
|
+
}
|
|
670
|
+
);
|
|
671
|
+
if (r.type === "array") {
|
|
672
|
+
const a = n;
|
|
673
|
+
return /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
|
|
674
|
+
/* @__PURE__ */ t("label", { className: "cedros-admin__field-label", children: r.label }),
|
|
675
|
+
/* @__PURE__ */ t(
|
|
676
|
+
"textarea",
|
|
677
|
+
{
|
|
678
|
+
className: "cedros-admin__textarea",
|
|
679
|
+
value: a.join(`
|
|
680
|
+
`),
|
|
681
|
+
onChange: (C) => u(e, C.target.value.split(`
|
|
682
|
+
`).filter(Boolean)),
|
|
683
|
+
placeholder: "One item per line",
|
|
684
|
+
rows: 3,
|
|
685
|
+
disabled: o
|
|
686
|
+
}
|
|
687
|
+
),
|
|
688
|
+
v(r.description)
|
|
689
|
+
] });
|
|
690
|
+
}
|
|
691
|
+
if (r.type === "object")
|
|
692
|
+
return /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
|
|
693
|
+
/* @__PURE__ */ t("label", { className: "cedros-admin__field-label", children: r.label }),
|
|
694
|
+
/* @__PURE__ */ t(
|
|
695
|
+
"textarea",
|
|
696
|
+
{
|
|
697
|
+
className: "cedros-admin__textarea cedros-admin__textarea--mono",
|
|
698
|
+
value: JSON.stringify(n, null, 2),
|
|
699
|
+
onChange: (a) => {
|
|
700
|
+
try {
|
|
701
|
+
u(e, JSON.parse(a.target.value));
|
|
702
|
+
} catch {
|
|
703
|
+
}
|
|
704
|
+
},
|
|
705
|
+
rows: 5,
|
|
706
|
+
disabled: o
|
|
707
|
+
}
|
|
708
|
+
),
|
|
709
|
+
v(r.description)
|
|
710
|
+
] });
|
|
711
|
+
const g = l.has(e), _ = r.isSecret && !g && n === B ? B : n;
|
|
712
|
+
return /* @__PURE__ */ i("div", { className: "cedros-admin__field", children: [
|
|
713
|
+
/* @__PURE__ */ i("label", { className: "cedros-admin__field-label", children: [
|
|
714
|
+
r.label,
|
|
715
|
+
r.isSecret && /* @__PURE__ */ t("span", { className: "cedros-admin__field-secret", children: " (secret)" })
|
|
716
|
+
] }),
|
|
717
|
+
/* @__PURE__ */ i("div", { className: "cedros-admin__input-group", children: [
|
|
718
|
+
/* @__PURE__ */ t(
|
|
719
|
+
"input",
|
|
720
|
+
{
|
|
721
|
+
type: r.isSecret && !g ? "password" : "text",
|
|
722
|
+
className: "cedros-admin__input",
|
|
723
|
+
value: _,
|
|
724
|
+
onChange: (a) => u(e, a.target.value),
|
|
725
|
+
disabled: o,
|
|
726
|
+
placeholder: r.isSecret ? "••••••••" : ""
|
|
727
|
+
}
|
|
728
|
+
),
|
|
729
|
+
r.isSecret && /* @__PURE__ */ t(
|
|
730
|
+
"button",
|
|
731
|
+
{
|
|
732
|
+
type: "button",
|
|
733
|
+
className: "cedros-admin__button cedros-admin__button--ghost",
|
|
734
|
+
onClick: () => I(e),
|
|
735
|
+
style: { padding: "0.5rem", minWidth: "auto" },
|
|
736
|
+
title: g ? "Hide" : "Show",
|
|
737
|
+
children: g ? E.eyeOff : E.eye
|
|
738
|
+
}
|
|
739
|
+
)
|
|
740
|
+
] }),
|
|
741
|
+
v(r.description)
|
|
742
|
+
] });
|
|
743
|
+
}, k = Object.keys(d), N = (e) => {
|
|
744
|
+
const n = q(b, e, h[e] ?? d[e]);
|
|
745
|
+
if (n.hidden || n.showWhen && !d[n.showWhen])
|
|
746
|
+
return !1;
|
|
747
|
+
if (e === "token_decimals") {
|
|
748
|
+
const r = d.token_mint;
|
|
749
|
+
if (r && F[r])
|
|
750
|
+
return !1;
|
|
751
|
+
}
|
|
752
|
+
return !0;
|
|
753
|
+
};
|
|
754
|
+
return /* @__PURE__ */ i("div", { className: "cedros-admin__config-editor", children: [
|
|
755
|
+
/* @__PURE__ */ t("div", { className: "cedros-admin__config-fields", children: k.filter(N).map((e) => /* @__PURE__ */ t("div", { className: "cedros-admin__config-field", children: A(e, d[e]) }, e)) }),
|
|
756
|
+
/* @__PURE__ */ t("div", { className: "cedros-admin__config-actions", children: /* @__PURE__ */ t("div", { className: "cedros-admin__autosave-status", children: /* @__PURE__ */ t(ne, { status: x, error: R }) }) })
|
|
757
|
+
] });
|
|
758
|
+
}
|
|
759
|
+
function he({
|
|
760
|
+
serverUrl: b,
|
|
761
|
+
apiKey: f,
|
|
762
|
+
authManager: h,
|
|
763
|
+
category: o,
|
|
764
|
+
title: w,
|
|
765
|
+
description: d,
|
|
766
|
+
enabledField: s = "enabled",
|
|
767
|
+
showEnabledToggle: l = !1
|
|
768
|
+
}) {
|
|
769
|
+
const p = H(
|
|
770
|
+
() => new te(b, void 0, h),
|
|
771
|
+
[b, h]
|
|
772
|
+
), [c, y] = S(null), [x, R] = S([]), [u, I] = S(!1), [v, A] = S(!0), [k, N] = S(null), [e, n] = S(null), [r, g] = S(!1), _ = Z[o] || { label: o, icon: "⚙️" }, a = w || _.label, C = d || _.description, V = z(async () => {
|
|
773
|
+
A(!0), N(null);
|
|
774
|
+
try {
|
|
775
|
+
const m = await p.getConfig(o, !0);
|
|
776
|
+
y(m);
|
|
777
|
+
} catch {
|
|
778
|
+
y(null), N("Failed to load settings");
|
|
779
|
+
} finally {
|
|
780
|
+
A(!1);
|
|
781
|
+
}
|
|
782
|
+
}, [p, o]);
|
|
783
|
+
j(() => {
|
|
784
|
+
V();
|
|
785
|
+
}, [V]);
|
|
786
|
+
const K = z(async () => {
|
|
787
|
+
try {
|
|
788
|
+
const m = await p.getHistory(o, 20);
|
|
789
|
+
R(m.history);
|
|
790
|
+
} catch {
|
|
791
|
+
R([]);
|
|
792
|
+
}
|
|
793
|
+
}, [p, o]);
|
|
794
|
+
j(() => {
|
|
795
|
+
u && K();
|
|
796
|
+
}, [u, K]);
|
|
797
|
+
const X = z(async (m) => {
|
|
798
|
+
await p.updateConfig(o, m, "Updated via admin dashboard");
|
|
799
|
+
}, [p, o]), $ = z(async (m) => p.validateConfig(o, m), [p, o]), [M, G] = S(!1), Y = z(async () => {
|
|
800
|
+
if (!c || M) return;
|
|
801
|
+
const m = !!c.config[s], D = !m, J = { ...c.config, [s]: D };
|
|
802
|
+
G(!0), y({ ...c, config: J });
|
|
803
|
+
try {
|
|
804
|
+
await p.updateConfig(o, J, `${D ? "Enabled" : "Disabled"} via admin dashboard`);
|
|
805
|
+
} catch (U) {
|
|
806
|
+
y({ ...c, config: { ...c.config, [s]: m } }), N(U instanceof Error ? U.message : "Failed to save enabled state");
|
|
807
|
+
} finally {
|
|
808
|
+
G(!1);
|
|
809
|
+
}
|
|
810
|
+
}, [c, p, o, s, M]), T = !!c?.config[s];
|
|
811
|
+
return v && !c ? /* @__PURE__ */ t("div", { className: "cedros-admin__section", children: /* @__PURE__ */ i("div", { className: "cedros-admin__loading", children: [
|
|
812
|
+
E.loading,
|
|
813
|
+
" Loading ",
|
|
814
|
+
a,
|
|
815
|
+
" settings..."
|
|
816
|
+
] }) }) : /* @__PURE__ */ i("div", { className: "cedros-admin__section", children: [
|
|
817
|
+
/* @__PURE__ */ t(L, { message: k, onRetry: V }),
|
|
818
|
+
/* @__PURE__ */ i("div", { className: "cedros-admin__section-header", children: [
|
|
819
|
+
/* @__PURE__ */ i("div", { children: [
|
|
820
|
+
/* @__PURE__ */ i("h3", { className: "cedros-admin__section-title", children: [
|
|
821
|
+
/* @__PURE__ */ t("span", { style: { marginRight: "0.5rem" }, children: _.icon }),
|
|
822
|
+
a
|
|
823
|
+
] }),
|
|
824
|
+
C && /* @__PURE__ */ t("p", { className: "cedros-admin__text-muted", style: { marginTop: "0.25rem" }, children: C })
|
|
825
|
+
] }),
|
|
826
|
+
l && c && /* @__PURE__ */ i("div", { style: { display: "flex", alignItems: "center", gap: "0.75rem" }, children: [
|
|
827
|
+
/* @__PURE__ */ t("span", { style: { fontSize: "0.875rem", color: T ? "var(--cedros-admin-text, #171717)" : "var(--cedros-admin-muted, #737373)" }, children: T ? "Enabled" : "Disabled" }),
|
|
828
|
+
/* @__PURE__ */ t(
|
|
829
|
+
"button",
|
|
830
|
+
{
|
|
831
|
+
type: "button",
|
|
832
|
+
role: "switch",
|
|
833
|
+
"aria-checked": T,
|
|
834
|
+
onClick: Y,
|
|
835
|
+
disabled: M,
|
|
836
|
+
style: {
|
|
837
|
+
width: 44,
|
|
838
|
+
height: 24,
|
|
839
|
+
borderRadius: 12,
|
|
840
|
+
border: "none",
|
|
841
|
+
backgroundColor: T ? "var(--cedros-admin-primary, #171717)" : "var(--cedros-admin-border, #d4d4d4)",
|
|
842
|
+
cursor: M ? "wait" : "pointer",
|
|
843
|
+
position: "relative",
|
|
844
|
+
transition: "background-color 0.2s",
|
|
845
|
+
flexShrink: 0,
|
|
846
|
+
opacity: M ? 0.6 : 1
|
|
847
|
+
},
|
|
848
|
+
children: /* @__PURE__ */ t(
|
|
849
|
+
"span",
|
|
850
|
+
{
|
|
851
|
+
style: {
|
|
852
|
+
position: "absolute",
|
|
853
|
+
top: 2,
|
|
854
|
+
left: T ? 22 : 2,
|
|
855
|
+
width: 20,
|
|
856
|
+
height: 20,
|
|
857
|
+
borderRadius: "50%",
|
|
858
|
+
backgroundColor: "#fff",
|
|
859
|
+
transition: "left 0.2s",
|
|
860
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
)
|
|
864
|
+
}
|
|
865
|
+
)
|
|
866
|
+
] })
|
|
867
|
+
] }),
|
|
868
|
+
c && /* @__PURE__ */ i(
|
|
869
|
+
"div",
|
|
870
|
+
{
|
|
871
|
+
className: "cedros-admin__settings-editor",
|
|
872
|
+
style: {
|
|
873
|
+
marginTop: "1rem",
|
|
874
|
+
opacity: l && !T ? 0.6 : 1,
|
|
875
|
+
pointerEvents: l && !T ? "none" : "auto"
|
|
876
|
+
},
|
|
877
|
+
children: [
|
|
878
|
+
l && !T && /* @__PURE__ */ t(
|
|
879
|
+
"div",
|
|
880
|
+
{
|
|
881
|
+
style: {
|
|
882
|
+
padding: "0.75rem 1rem",
|
|
883
|
+
marginBottom: "1rem",
|
|
884
|
+
backgroundColor: "var(--cedros-admin-warning-bg, #fef3c7)",
|
|
885
|
+
border: "1px solid var(--cedros-admin-warning-border, #f59e0b)",
|
|
886
|
+
borderRadius: "0.375rem",
|
|
887
|
+
fontSize: "0.875rem",
|
|
888
|
+
color: "var(--cedros-admin-warning-text, #92400e)",
|
|
889
|
+
pointerEvents: "auto"
|
|
890
|
+
},
|
|
891
|
+
children: "This payment method is disabled. Enable it using the toggle above to accept payments."
|
|
892
|
+
}
|
|
893
|
+
),
|
|
894
|
+
/* @__PURE__ */ t(
|
|
895
|
+
de,
|
|
896
|
+
{
|
|
897
|
+
category: c.category,
|
|
898
|
+
config: c.config,
|
|
899
|
+
originalConfig: c.config,
|
|
900
|
+
onSave: X,
|
|
901
|
+
onValidate: $
|
|
902
|
+
}
|
|
903
|
+
)
|
|
904
|
+
]
|
|
905
|
+
}
|
|
906
|
+
),
|
|
907
|
+
u && /* @__PURE__ */ i("div", { className: "cedros-admin__settings-history", style: { marginTop: "1.5rem" }, children: [
|
|
908
|
+
/* @__PURE__ */ t("h4", { style: { marginBottom: "0.75rem", fontWeight: 600 }, children: "Change History" }),
|
|
909
|
+
x.length === 0 ? /* @__PURE__ */ t("p", { className: "cedros-admin__text-muted", children: "No history entries found." }) : /* @__PURE__ */ t("div", { className: "cedros-admin__settings-timeline", children: x.map((m) => /* @__PURE__ */ i("div", { className: "cedros-admin__settings-timeline-item", children: [
|
|
910
|
+
/* @__PURE__ */ t("div", { className: "cedros-admin__settings-timeline-dot" }),
|
|
911
|
+
/* @__PURE__ */ i("div", { className: "cedros-admin__settings-timeline-content", children: [
|
|
912
|
+
/* @__PURE__ */ i("div", { className: "cedros-admin__settings-timeline-header", children: [
|
|
913
|
+
/* @__PURE__ */ t("code", { children: m.configKey }),
|
|
914
|
+
/* @__PURE__ */ t("span", { className: `cedros-admin__badge cedros-admin__badge--${m.action.toLowerCase()}`, children: m.action })
|
|
915
|
+
] }),
|
|
916
|
+
/* @__PURE__ */ i("div", { className: "cedros-admin__settings-timeline-meta", children: [
|
|
917
|
+
ee(m.changedAt),
|
|
918
|
+
" by ",
|
|
919
|
+
m.changedBy
|
|
920
|
+
] })
|
|
921
|
+
] })
|
|
922
|
+
] }, m.id)) })
|
|
923
|
+
] }),
|
|
924
|
+
e && /* @__PURE__ */ t(
|
|
925
|
+
"div",
|
|
926
|
+
{
|
|
927
|
+
style: {
|
|
928
|
+
marginTop: "1rem",
|
|
929
|
+
padding: "0.75rem 1rem",
|
|
930
|
+
borderRadius: "0.375rem",
|
|
931
|
+
backgroundColor: e.valid ? "var(--cedros-admin-success-bg, #dcfce7)" : "var(--cedros-admin-error-bg, #fef2f2)",
|
|
932
|
+
border: `1px solid ${e.valid ? "var(--cedros-admin-success-border, #86efac)" : "var(--cedros-admin-error-border, #fecaca)"}`
|
|
933
|
+
},
|
|
934
|
+
children: /* @__PURE__ */ i("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start" }, children: [
|
|
935
|
+
/* @__PURE__ */ i("div", { style: { flex: 1 }, children: [
|
|
936
|
+
/* @__PURE__ */ t("div", { style: {
|
|
937
|
+
fontWeight: 600,
|
|
938
|
+
color: e.valid ? "var(--cedros-admin-success, #16a34a)" : "var(--cedros-admin-error, #dc2626)",
|
|
939
|
+
marginBottom: e.errors.length > 0 || e.warnings.length > 0 ? "0.5rem" : 0
|
|
940
|
+
}, children: e.valid ? "✓ Configuration is valid" : "✗ Validation failed" }),
|
|
941
|
+
e.errors.length > 0 && /* @__PURE__ */ t("ul", { style: { margin: 0, paddingLeft: "1.25rem", color: "var(--cedros-admin-error, #dc2626)", fontSize: "0.875rem" }, children: e.errors.map((m, D) => /* @__PURE__ */ t("li", { children: m }, D)) }),
|
|
942
|
+
e.warnings.length > 0 && /* @__PURE__ */ t("ul", { style: { margin: e.errors.length > 0 ? "0.5rem 0 0" : 0, paddingLeft: "1.25rem", color: "var(--cedros-admin-warning, #ca8a04)", fontSize: "0.875rem" }, children: e.warnings.map((m, D) => /* @__PURE__ */ t("li", { children: m }, D)) })
|
|
943
|
+
] }),
|
|
944
|
+
/* @__PURE__ */ t(
|
|
945
|
+
"button",
|
|
946
|
+
{
|
|
947
|
+
type: "button",
|
|
948
|
+
onClick: () => n(null),
|
|
949
|
+
style: {
|
|
950
|
+
background: "none",
|
|
951
|
+
border: "none",
|
|
952
|
+
cursor: "pointer",
|
|
953
|
+
padding: "0.25rem",
|
|
954
|
+
color: "var(--cedros-admin-text-muted, #64748b)",
|
|
955
|
+
fontSize: "1.25rem",
|
|
956
|
+
lineHeight: 1
|
|
957
|
+
},
|
|
958
|
+
title: "Dismiss",
|
|
959
|
+
children: "×"
|
|
960
|
+
}
|
|
961
|
+
)
|
|
962
|
+
] })
|
|
963
|
+
}
|
|
964
|
+
),
|
|
965
|
+
/* @__PURE__ */ i("div", { style: { marginTop: "1.5rem", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
966
|
+
/* @__PURE__ */ t(
|
|
967
|
+
"button",
|
|
968
|
+
{
|
|
969
|
+
type: "button",
|
|
970
|
+
className: "cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",
|
|
971
|
+
onClick: () => I(!u),
|
|
972
|
+
children: u ? "Hide History" : "History"
|
|
973
|
+
}
|
|
974
|
+
),
|
|
975
|
+
/* @__PURE__ */ t(
|
|
976
|
+
"button",
|
|
977
|
+
{
|
|
978
|
+
type: "button",
|
|
979
|
+
className: "cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",
|
|
980
|
+
disabled: r || !c,
|
|
981
|
+
onClick: async () => {
|
|
982
|
+
if (c) {
|
|
983
|
+
g(!0), n(null);
|
|
984
|
+
try {
|
|
985
|
+
const m = await $(c.config);
|
|
986
|
+
n(m);
|
|
987
|
+
} catch (m) {
|
|
988
|
+
n({
|
|
989
|
+
valid: !1,
|
|
990
|
+
errors: [m instanceof Error ? m.message : "Validation failed"],
|
|
991
|
+
warnings: []
|
|
992
|
+
});
|
|
993
|
+
} finally {
|
|
994
|
+
g(!1);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
},
|
|
998
|
+
children: r ? "Validating..." : "Validate"
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
] })
|
|
1002
|
+
] });
|
|
1003
|
+
}
|
|
1004
|
+
export {
|
|
1005
|
+
he as S
|
|
1006
|
+
};
|