@cedros/pay-react 1.1.22 → 1.1.24
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-p3iikbSw.mjs → AISettingsSection-Dw0ZlxMf.mjs} +2 -2
- package/dist/{AISettingsSection-BtOxEweU.js → AISettingsSection-IXS1Wt_1.js} +1 -1
- package/dist/{AutosaveIndicator-CWbb-VXf.mjs → AutosaveIndicator-BJsg_kFZ.mjs} +1 -1
- package/dist/{AutosaveIndicator-C-CH-obR.js → AutosaveIndicator-CY_YHM1D.js} +1 -1
- package/dist/{CedrosContext-D-lnoEkR.js → CedrosContext-7dwmEeUY.js} +2 -2
- package/dist/{CedrosContext-BE6P5PQ0.mjs → CedrosContext-DQUbL8yP.mjs} +105 -88
- package/dist/{CryptoButton-Dy-g3bR0.js → CryptoButton-C1AAOOfj.js} +1 -1
- package/dist/{CryptoButton-CksMkZjL.mjs → CryptoButton-D1BCZBk4.mjs} +51 -51
- package/dist/{FAQSection-DQpF7hVx.js → FAQSection-BmgmzDN5.js} +1 -1
- package/dist/{FAQSection-byh7zfqI.mjs → FAQSection-C78MnK4k.mjs} +1 -1
- package/dist/{MessagingSection-B6EHvjDw.js → MessagingSection-CWLZcg11.js} +1 -1
- package/dist/{MessagingSection-CK208brx.mjs → MessagingSection-De3t8bSI.mjs} +2 -2
- package/dist/OrdersSection-BKOxsZw0.js +1 -0
- package/dist/OrdersSection-_xKVzjSZ.mjs +233 -0
- package/dist/{PaymentSettingsSection-Cmmuhmd4.js → PaymentSettingsSection-BTEn9Dxb.js} +1 -1
- package/dist/{PaymentSettingsSection-B9H253x1.mjs → PaymentSettingsSection-KjU_dN_d.mjs} +1 -1
- package/dist/{SettingsSection-DDLMaEPo.mjs → SettingsSection-8QHZB59k.mjs} +1 -1
- package/dist/{SettingsSection-DrzGdvHH.js → SettingsSection-cKF0tLnS.js} +1 -1
- package/dist/SingleCategorySettings--LK0TZW0.mjs +1006 -0
- package/dist/SingleCategorySettings-CRXTMTo5.js +3 -0
- package/dist/{StorefrontSection-DTpZ_GgO.js → StorefrontSection-C9DzCmOf.js} +1 -1
- package/dist/{StorefrontSection-Dr2ciBVg.mjs → StorefrontSection-CeCpr8hn.mjs} +2 -2
- package/dist/{SubscriptionsSection-CU3Ce8r9.mjs → SubscriptionsSection-C2xk8ApF.mjs} +1 -1
- package/dist/{SubscriptionsSection-CYJpArJ8.js → SubscriptionsSection-Dn5SY6S_.js} +1 -1
- package/dist/Token22Section-DUUl59dZ.js +1 -0
- package/dist/Token22Section-HygkDNtL.mjs +1685 -0
- package/dist/{WalletManager-QcfgQmap.js → WalletManager-Bwk3rgr1.js} +1 -1
- package/dist/{WalletManager-D78miaJ2.mjs → WalletManager-CXvQ0Zu9.mjs} +1 -1
- package/dist/bn-Bv2sKQMU.mjs +1185 -0
- package/dist/bn-CHyy7EgJ.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-CufXF9Yd.mjs → index-BHF82XBB.mjs} +6687 -5866
- package/dist/index-OaWkrl0G.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-CR7NRsjq.js → sections-8e5Y3ukY.js} +1 -1
- package/dist/sections-C1rb9YRh.mjs +9 -0
- 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-Ag-7ZvAB.mjs} +46 -46
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.mjs +1 -1
- package/dist/{walletPool-DShNjCQ6.mjs → walletPool-C_0P4mTw.mjs} +1 -1
- package/dist/{walletPool-BqNfOhB0.js → walletPool-Ddv33tej.js} +1 -1
- package/package.json +10 -1
- package/dist/SingleCategorySettings-BU98SRFV.mjs +0 -1418
- package/dist/SingleCategorySettings-DqcXe-q4.js +0 -3
- package/dist/index-IZ4WcMd7.js +0 -84
- package/dist/sections-Bc6ARlND.mjs +0 -8
|
@@ -1,1418 +0,0 @@
|
|
|
1
|
-
import { jsxs as o, jsx as t, Fragment as U } from "react/jsx-runtime";
|
|
2
|
-
import { useState as k, useEffect as H, useMemo as V, useCallback as I } from "react";
|
|
3
|
-
import { I as T, F as Z, E as Q, g as ee } from "./index-CufXF9Yd.mjs";
|
|
4
|
-
import { u as te } from "./useAutosave-YwMqRzqy.mjs";
|
|
5
|
-
import { A as re } from "./AutosaveIndicator-CWbb-VXf.mjs";
|
|
6
|
-
import { S as O } from "./CedrosContext-BE6P5PQ0.mjs";
|
|
7
|
-
class ie {
|
|
8
|
-
constructor(s, d, n) {
|
|
9
|
-
this._serverUrl = s, this.auth = d, this.authManager = n;
|
|
10
|
-
}
|
|
11
|
-
/** Server URL passed at construction (retained for API compatibility). */
|
|
12
|
-
get serverUrl() {
|
|
13
|
-
return this._serverUrl;
|
|
14
|
-
}
|
|
15
|
-
async fetch(s, d = {}) {
|
|
16
|
-
if (this.authManager?.isAuthenticated())
|
|
17
|
-
return this.authManager.fetchWithAuth(s, d);
|
|
18
|
-
throw this.auth ? new Error(
|
|
19
|
-
"Legacy AdminAuth is no longer supported due to replay vulnerability. Use IAdminAuthManager instead."
|
|
20
|
-
) : new Error(
|
|
21
|
-
"Admin authentication required. Provide an IAdminAuthManager to ConfigApi."
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
/** List all config categories */
|
|
25
|
-
async listCategories(s = 100) {
|
|
26
|
-
return this.fetch(`/admin/config?limit=${s}`);
|
|
27
|
-
}
|
|
28
|
-
/** Get config for a category */
|
|
29
|
-
async getConfig(s, d = !0) {
|
|
30
|
-
return this.fetch(`/admin/config/${s}?redact_secrets=${d}`);
|
|
31
|
-
}
|
|
32
|
-
/** Full update - replace entire category config */
|
|
33
|
-
async updateConfig(s, d, n) {
|
|
34
|
-
await this.fetch(`/admin/config/${s}`, {
|
|
35
|
-
method: "PUT",
|
|
36
|
-
body: JSON.stringify({ config: d, description: n })
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
/** Partial update - update specific keys */
|
|
40
|
-
async patchConfig(s, d, n) {
|
|
41
|
-
await this.fetch(`/admin/config/${s}`, {
|
|
42
|
-
method: "PATCH",
|
|
43
|
-
body: JSON.stringify({ updates: d, description: n })
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
/** Batch update multiple categories */
|
|
47
|
-
async batchUpdate(s) {
|
|
48
|
-
await this.fetch("/admin/config/batch", {
|
|
49
|
-
method: "POST",
|
|
50
|
-
body: JSON.stringify({ updates: s })
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
/** Validate config before saving */
|
|
54
|
-
async validateConfig(s, d) {
|
|
55
|
-
return this.fetch("/admin/config/validate", {
|
|
56
|
-
method: "POST",
|
|
57
|
-
body: JSON.stringify({ category: s, config: d })
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
/** Get config change history */
|
|
61
|
-
async getHistory(s, d = 50) {
|
|
62
|
-
const n = new URLSearchParams({ limit: d.toString() });
|
|
63
|
-
return s && n.set("category", s), this.fetch(`/admin/config/history?${n}`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
const F = {
|
|
67
|
-
server: {
|
|
68
|
-
label: "Server",
|
|
69
|
-
secrets: [],
|
|
70
|
-
icon: "🖥️",
|
|
71
|
-
fields: {
|
|
72
|
-
admin_metrics_api_key: { hidden: !0 },
|
|
73
|
-
// Moved to metrics tab
|
|
74
|
-
cors_allowed_origins: { hidden: !0 }
|
|
75
|
-
// Moved to security tab
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
security: {
|
|
79
|
-
label: "Security",
|
|
80
|
-
description: "Configure CORS, rate limiting, and other security settings",
|
|
81
|
-
secrets: [],
|
|
82
|
-
icon: "🔒",
|
|
83
|
-
fields: {
|
|
84
|
-
cors_allowed_origins: {
|
|
85
|
-
description: 'List of allowed origins for CORS requests. Use ["*"] to allow all origins (not recommended for production).'
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
metrics: {
|
|
90
|
-
label: "Metrics",
|
|
91
|
-
description: "Configure metrics collection and API access",
|
|
92
|
-
secrets: ["admin_metrics_api_key"],
|
|
93
|
-
icon: "📊",
|
|
94
|
-
fields: {
|
|
95
|
-
admin_metrics_api_key: {
|
|
96
|
-
description: "API key for accessing the admin metrics endpoint. Keep this secret."
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
logging: {
|
|
101
|
-
label: "Logging",
|
|
102
|
-
secrets: [],
|
|
103
|
-
icon: "📝",
|
|
104
|
-
fields: {
|
|
105
|
-
level: { type: "dropdown", options: ["trace", "debug", "info", "warn", "error"] },
|
|
106
|
-
format: { hidden: !0 },
|
|
107
|
-
// Developer setting
|
|
108
|
-
environment: { hidden: !0 }
|
|
109
|
-
// Developer setting
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
stripe: {
|
|
113
|
-
label: "Stripe",
|
|
114
|
-
secrets: ["secret_key", "webhook_secret"],
|
|
115
|
-
icon: "💳",
|
|
116
|
-
fields: {
|
|
117
|
-
enabled: { hidden: !0 },
|
|
118
|
-
// Shown in header toggle
|
|
119
|
-
secret_key: {
|
|
120
|
-
description: "Stripe Dashboard → Developers → API keys → Secret key. Use the test key (sk_test_...) for testing, or the live key (sk_live_...) for production."
|
|
121
|
-
},
|
|
122
|
-
publishable_key: {
|
|
123
|
-
description: "Stripe Dashboard → Developers → API keys → Publishable key. Starts with pk_test_... or pk_live_..."
|
|
124
|
-
},
|
|
125
|
-
mode: {
|
|
126
|
-
type: "dropdown",
|
|
127
|
-
options: ["test", "live"],
|
|
128
|
-
description: 'Use "test" mode with test API keys during development, then switch to "live" with live keys for real payments.'
|
|
129
|
-
},
|
|
130
|
-
webhook_url: {
|
|
131
|
-
description: "The full URL Stripe sends webhook events to. Default is your server URL + /webhook/stripe (e.g. https://example.com/webhook/stripe). Only change this if you've customized the route in your cedros-pay server."
|
|
132
|
-
},
|
|
133
|
-
webhook_secret: {
|
|
134
|
-
description: `Stripe Dashboard → Developers → Webhooks → "Create an event destination" → select events: checkout.session.completed, customer.subscription.created, customer.subscription.updated, customer.subscription.deleted, invoice.paid, invoice.payment_failed → Continue → choose "Webhook endpoint" → enter your server's webhook endpoint, e.g. https://example.com/webhook/stripe (your server URL + /webhook/stripe) → after creating, click the endpoint and "Click to reveal" the signing secret. Starts with whsec_...`
|
|
135
|
-
},
|
|
136
|
-
tax_rate_id: {
|
|
137
|
-
description: `Stripe Dashboard → More → Product catalog → Tax rates → "+ New" → set the percentage, region, and whether tax is inclusive or exclusive → Save → copy the tax rate ID from the detail page (starts with txr_...). Leave empty if you don't collect tax.`
|
|
138
|
-
},
|
|
139
|
-
success_url: { hidden: !0 },
|
|
140
|
-
// Library provides default pages
|
|
141
|
-
cancel_url: { hidden: !0 }
|
|
142
|
-
// Library provides default pages
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
x402: {
|
|
146
|
-
label: "X402 (Crypto)",
|
|
147
|
-
secrets: ["server_wallets"],
|
|
148
|
-
icon: "⚡",
|
|
149
|
-
fields: {
|
|
150
|
-
enabled: { hidden: !0 },
|
|
151
|
-
// Shown in header toggle
|
|
152
|
-
payment_address: {
|
|
153
|
-
type: "solana_address",
|
|
154
|
-
description: "The Solana wallet address where payments are received. This is where customer funds are sent."
|
|
155
|
-
},
|
|
156
|
-
token_mint: {
|
|
157
|
-
type: "token_mint",
|
|
158
|
-
description: "The SPL token used for payments. Most commonly USDC."
|
|
159
|
-
},
|
|
160
|
-
token_decimals: {
|
|
161
|
-
type: "number",
|
|
162
|
-
description: "Number of decimal places for the token (e.g., USDC has 6 decimals).",
|
|
163
|
-
hidden: !0
|
|
164
|
-
// Managed by token_mint selector
|
|
165
|
-
},
|
|
166
|
-
custom_token_symbol: {
|
|
167
|
-
description: 'Display symbol for your custom token (e.g., "MYTOKEN").',
|
|
168
|
-
hidden: !0
|
|
169
|
-
// Managed by token_mint selector
|
|
170
|
-
},
|
|
171
|
-
custom_token_icon: {
|
|
172
|
-
description: "URL to your token's icon image.",
|
|
173
|
-
hidden: !0
|
|
174
|
-
// Managed by token_mint selector
|
|
175
|
-
},
|
|
176
|
-
rpc_url: {
|
|
177
|
-
description: "Solana RPC endpoint URL. Required for crypto payment verification (e.g., from Helius, QuickNode, or Alchemy)."
|
|
178
|
-
},
|
|
179
|
-
gasless_enabled: {
|
|
180
|
-
type: "toggle",
|
|
181
|
-
description: "When enabled, your server pays transaction fees so customers don't need SOL."
|
|
182
|
-
},
|
|
183
|
-
server_wallets: {
|
|
184
|
-
type: "secret_array",
|
|
185
|
-
description: "Server keypair(s) used to sign and pay for transactions. Required for gasless payments.",
|
|
186
|
-
showWhen: "gasless_enabled"
|
|
187
|
-
},
|
|
188
|
-
rounding_mode: {
|
|
189
|
-
type: "dropdown",
|
|
190
|
-
options: ["nearest", "up", "down"],
|
|
191
|
-
description: "How to round fractional token amounts: nearest (default), up (always round up), or down (always round down)."
|
|
192
|
-
},
|
|
193
|
-
network: { hidden: !0 },
|
|
194
|
-
ws_url: { hidden: !0 },
|
|
195
|
-
// Derived from rpc_url
|
|
196
|
-
skip_preflight: { hidden: !0 },
|
|
197
|
-
// Always false; not a user decision
|
|
198
|
-
commitment: { hidden: !0 },
|
|
199
|
-
// Internal Solana parameter
|
|
200
|
-
compute_unit_limit: { hidden: !0 },
|
|
201
|
-
// Internal Solana parameter
|
|
202
|
-
compute_unit_price: { hidden: !0 }
|
|
203
|
-
// Internal Solana parameter
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
paywall: {
|
|
207
|
-
label: "Paywall",
|
|
208
|
-
secrets: [],
|
|
209
|
-
icon: "🚪",
|
|
210
|
-
fields: {
|
|
211
|
-
product_cache_ttl: { type: "number", unit: "seconds" }
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
coupons: {
|
|
215
|
-
label: "Coupons",
|
|
216
|
-
secrets: [],
|
|
217
|
-
icon: "🎟️",
|
|
218
|
-
fields: {
|
|
219
|
-
cache_ttl: { type: "number", unit: "seconds" }
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
subscriptions: {
|
|
223
|
-
label: "Subscriptions",
|
|
224
|
-
secrets: [],
|
|
225
|
-
icon: "🔄",
|
|
226
|
-
fields: {
|
|
227
|
-
grace_period_hours: { type: "number", unit: "hours" }
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
callbacks: {
|
|
231
|
-
label: "Callbacks",
|
|
232
|
-
secrets: ["hmac_secret"],
|
|
233
|
-
icon: "🔔"
|
|
234
|
-
},
|
|
235
|
-
email: {
|
|
236
|
-
label: "Email",
|
|
237
|
-
description: "Email receipts for customers after purchase",
|
|
238
|
-
secrets: ["smtp_password"],
|
|
239
|
-
icon: "📧",
|
|
240
|
-
fields: {
|
|
241
|
-
enabled: { hidden: !0 },
|
|
242
|
-
// Shown in header toggle
|
|
243
|
-
provider: {
|
|
244
|
-
type: "dropdown",
|
|
245
|
-
options: ["sendgrid", "mailgun", "postmark", "ses", "resend", "custom"],
|
|
246
|
-
description: "Email service provider."
|
|
247
|
-
},
|
|
248
|
-
smtp_host: {
|
|
249
|
-
description: "SMTP server hostname.",
|
|
250
|
-
showWhen: "provider"
|
|
251
|
-
},
|
|
252
|
-
smtp_port: {
|
|
253
|
-
type: "number",
|
|
254
|
-
description: "SMTP server port (typically 587 for TLS).",
|
|
255
|
-
showWhen: "provider"
|
|
256
|
-
},
|
|
257
|
-
smtp_user: {
|
|
258
|
-
description: "SMTP authentication username or API key name.",
|
|
259
|
-
showWhen: "provider"
|
|
260
|
-
},
|
|
261
|
-
smtp_password: {
|
|
262
|
-
description: "SMTP password or API key.",
|
|
263
|
-
showWhen: "provider"
|
|
264
|
-
},
|
|
265
|
-
from_address: {
|
|
266
|
-
description: "Sender email address (e.g., orders@yourstore.com)."
|
|
267
|
-
},
|
|
268
|
-
from_name: {
|
|
269
|
-
description: 'Sender display name (e.g., "Your Store").'
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
webhook: {
|
|
274
|
-
label: "Webhook",
|
|
275
|
-
description: "HTTP notifications when purchases occur",
|
|
276
|
-
secrets: ["secret"],
|
|
277
|
-
icon: "🔔",
|
|
278
|
-
fields: {
|
|
279
|
-
enabled: { hidden: !0 },
|
|
280
|
-
// Shown in header toggle
|
|
281
|
-
url: {
|
|
282
|
-
description: "URL to receive POST notifications (e.g., https://api.yoursite.com/webhooks/orders)."
|
|
283
|
-
},
|
|
284
|
-
secret: {
|
|
285
|
-
description: "Shared secret for HMAC-SHA256 signature verification."
|
|
286
|
-
},
|
|
287
|
-
retry_attempts: {
|
|
288
|
-
type: "number",
|
|
289
|
-
description: "Number of retry attempts on failure (default: 3)."
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
messaging: {
|
|
294
|
-
label: "Messaging",
|
|
295
|
-
description: "Email and webhook notifications for purchases",
|
|
296
|
-
secrets: ["smtp_password", "webhook_secret"],
|
|
297
|
-
icon: "📬",
|
|
298
|
-
fields: {
|
|
299
|
-
// Email settings
|
|
300
|
-
email_enabled: {
|
|
301
|
-
type: "boolean",
|
|
302
|
-
description: "Send order confirmation emails to customers."
|
|
303
|
-
},
|
|
304
|
-
email_provider: {
|
|
305
|
-
description: "Email service provider (mailgun, sendgrid, postmark, ses, resend, custom).",
|
|
306
|
-
showWhen: "email_enabled"
|
|
307
|
-
},
|
|
308
|
-
smtp_host: {
|
|
309
|
-
description: "SMTP server hostname.",
|
|
310
|
-
showWhen: "email_enabled"
|
|
311
|
-
},
|
|
312
|
-
smtp_port: {
|
|
313
|
-
type: "number",
|
|
314
|
-
description: "SMTP server port (typically 587 for TLS).",
|
|
315
|
-
showWhen: "email_enabled"
|
|
316
|
-
},
|
|
317
|
-
smtp_username: {
|
|
318
|
-
description: "SMTP authentication username or API key.",
|
|
319
|
-
showWhen: "email_enabled"
|
|
320
|
-
},
|
|
321
|
-
smtp_password: {
|
|
322
|
-
description: "SMTP password or API key.",
|
|
323
|
-
showWhen: "email_enabled"
|
|
324
|
-
},
|
|
325
|
-
from_email: {
|
|
326
|
-
description: "Sender email address (e.g., orders@yourstore.com).",
|
|
327
|
-
showWhen: "email_enabled"
|
|
328
|
-
},
|
|
329
|
-
from_name: {
|
|
330
|
-
description: 'Sender display name (e.g., "Your Store").',
|
|
331
|
-
showWhen: "email_enabled"
|
|
332
|
-
},
|
|
333
|
-
// Webhook settings
|
|
334
|
-
webhook_enabled: {
|
|
335
|
-
type: "boolean",
|
|
336
|
-
description: "Send webhook notifications when purchases complete."
|
|
337
|
-
},
|
|
338
|
-
webhook_url: {
|
|
339
|
-
description: "URL to receive POST notifications.",
|
|
340
|
-
showWhen: "webhook_enabled"
|
|
341
|
-
},
|
|
342
|
-
webhook_secret: {
|
|
343
|
-
description: "Shared secret for HMAC-SHA256 signature verification.",
|
|
344
|
-
showWhen: "webhook_enabled"
|
|
345
|
-
},
|
|
346
|
-
webhook_timeout: {
|
|
347
|
-
type: "number",
|
|
348
|
-
description: "Request timeout in seconds (default: 30).",
|
|
349
|
-
showWhen: "webhook_enabled"
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
|
-
monitoring: {
|
|
354
|
-
label: "Monitoring",
|
|
355
|
-
secrets: [],
|
|
356
|
-
icon: "📊",
|
|
357
|
-
fields: {
|
|
358
|
-
check_interval: { type: "number", unit: "seconds" },
|
|
359
|
-
low_balance_threshold: { type: "number", unit: "SOL" }
|
|
360
|
-
}
|
|
361
|
-
},
|
|
362
|
-
rate_limit: {
|
|
363
|
-
label: "Rate Limiting",
|
|
364
|
-
secrets: [],
|
|
365
|
-
icon: "⏱️"
|
|
366
|
-
},
|
|
367
|
-
circuit_breaker: {
|
|
368
|
-
label: "Circuit Breaker",
|
|
369
|
-
secrets: [],
|
|
370
|
-
icon: "🔌"
|
|
371
|
-
},
|
|
372
|
-
admin: {
|
|
373
|
-
label: "Admin Keys",
|
|
374
|
-
secrets: [],
|
|
375
|
-
icon: "👤"
|
|
376
|
-
},
|
|
377
|
-
api_keys: {
|
|
378
|
-
label: "API Keys",
|
|
379
|
-
secrets: [],
|
|
380
|
-
icon: "🔐"
|
|
381
|
-
},
|
|
382
|
-
cedros_login: {
|
|
383
|
-
label: "Cedros Login",
|
|
384
|
-
secrets: ["api_key"],
|
|
385
|
-
icon: "🔑",
|
|
386
|
-
fields: {
|
|
387
|
-
enabled: { hidden: !0 },
|
|
388
|
-
// Shown in header toggle
|
|
389
|
-
credits_enabled: { hidden: !0 },
|
|
390
|
-
// Shown in header toggle when relevant
|
|
391
|
-
base_url: { hidden: !0 },
|
|
392
|
-
// Deployment setting
|
|
393
|
-
timeout: { hidden: !0 },
|
|
394
|
-
// Developer setting
|
|
395
|
-
jwt_issuer: { hidden: !0 },
|
|
396
|
-
// Internal auth config
|
|
397
|
-
jwt_audience: { hidden: !0 }
|
|
398
|
-
// Internal auth config
|
|
399
|
-
}
|
|
400
|
-
},
|
|
401
|
-
shop: {
|
|
402
|
-
label: "Storefront",
|
|
403
|
-
description: "Product pages & display settings",
|
|
404
|
-
secrets: [],
|
|
405
|
-
icon: "🏪",
|
|
406
|
-
fields: {
|
|
407
|
-
enabled: { hidden: !0 },
|
|
408
|
-
// Shown in StorefrontSection header toggle
|
|
409
|
-
"relatedProducts.mode": {
|
|
410
|
-
type: "dropdown",
|
|
411
|
-
options: ["most_recent", "by_category", "manual", "ai"]
|
|
412
|
-
},
|
|
413
|
-
"relatedProducts.maxItems": { type: "number" }
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
function G(b, s) {
|
|
418
|
-
return F[b]?.secrets.includes(s) ?? !1;
|
|
419
|
-
}
|
|
420
|
-
const z = "[REDACTED]", ne = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
421
|
-
function B(b) {
|
|
422
|
-
return !b || b.trim() === "" ? { valid: !0 } : ne.test(b.trim()) ? { valid: !0 } : { valid: !1, error: "Invalid Solana address" };
|
|
423
|
-
}
|
|
424
|
-
function oe({
|
|
425
|
-
label: b,
|
|
426
|
-
value: s,
|
|
427
|
-
onChange: d,
|
|
428
|
-
decimals: n,
|
|
429
|
-
onDecimalsChange: S,
|
|
430
|
-
disabled: c = !1,
|
|
431
|
-
description: l,
|
|
432
|
-
customSymbol: m = "",
|
|
433
|
-
customIcon: h = "",
|
|
434
|
-
onCustomSymbolChange: p,
|
|
435
|
-
onCustomIconChange: y
|
|
436
|
-
}) {
|
|
437
|
-
const [w, A] = k(!1), f = Object.entries(O), _ = !!O[s], x = w || !!s && !_, C = (e) => {
|
|
438
|
-
if (e === "custom")
|
|
439
|
-
A(!0), _ && d("");
|
|
440
|
-
else {
|
|
441
|
-
A(!1), d(e);
|
|
442
|
-
const i = O[e];
|
|
443
|
-
i && S && S(i.decimals), p && p(""), y && y("");
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
return /* @__PURE__ */ o("div", { className: "cedros-admin__field", children: [
|
|
447
|
-
/* @__PURE__ */ t("label", { className: "cedros-admin__field-label", children: b }),
|
|
448
|
-
/* @__PURE__ */ o("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
|
|
449
|
-
/* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: [
|
|
450
|
-
f.map(([e, i]) => /* @__PURE__ */ o(
|
|
451
|
-
"button",
|
|
452
|
-
{
|
|
453
|
-
type: "button",
|
|
454
|
-
onClick: () => C(e),
|
|
455
|
-
disabled: c,
|
|
456
|
-
style: {
|
|
457
|
-
display: "flex",
|
|
458
|
-
alignItems: "center",
|
|
459
|
-
gap: "0.5rem",
|
|
460
|
-
padding: "0.5rem 0.75rem",
|
|
461
|
-
border: s === e ? "2px solid var(--cedros-admin-primary, #171717)" : "1px solid var(--cedros-admin-border, #d4d4d4)",
|
|
462
|
-
borderRadius: "0.5rem",
|
|
463
|
-
background: s === e ? "var(--cedros-admin-primary-bg, #f5f5f5)" : "var(--cedros-admin-bg, #fff)",
|
|
464
|
-
cursor: c ? "not-allowed" : "pointer",
|
|
465
|
-
opacity: c ? 0.5 : 1,
|
|
466
|
-
fontWeight: s === e ? 600 : 400
|
|
467
|
-
},
|
|
468
|
-
children: [
|
|
469
|
-
/* @__PURE__ */ t(
|
|
470
|
-
"img",
|
|
471
|
-
{
|
|
472
|
-
src: i.icon,
|
|
473
|
-
alt: i.symbol,
|
|
474
|
-
style: { width: 20, height: 20, borderRadius: "50%" },
|
|
475
|
-
onError: (r) => {
|
|
476
|
-
r.target.style.display = "none";
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
),
|
|
480
|
-
/* @__PURE__ */ t("span", { children: i.symbol })
|
|
481
|
-
]
|
|
482
|
-
},
|
|
483
|
-
e
|
|
484
|
-
)),
|
|
485
|
-
/* @__PURE__ */ o(
|
|
486
|
-
"button",
|
|
487
|
-
{
|
|
488
|
-
type: "button",
|
|
489
|
-
onClick: () => C("custom"),
|
|
490
|
-
disabled: c,
|
|
491
|
-
style: {
|
|
492
|
-
display: "flex",
|
|
493
|
-
alignItems: "center",
|
|
494
|
-
gap: "0.5rem",
|
|
495
|
-
padding: "0.5rem 0.75rem",
|
|
496
|
-
border: x ? "2px solid var(--cedros-admin-primary, #171717)" : "1px solid var(--cedros-admin-border, #d4d4d4)",
|
|
497
|
-
borderRadius: "0.5rem",
|
|
498
|
-
background: x ? "var(--cedros-admin-primary-bg, #f5f5f5)" : "var(--cedros-admin-bg, #fff)",
|
|
499
|
-
cursor: c ? "not-allowed" : "pointer",
|
|
500
|
-
opacity: c ? 0.5 : 1,
|
|
501
|
-
fontWeight: x ? 600 : 400
|
|
502
|
-
},
|
|
503
|
-
children: [
|
|
504
|
-
/* @__PURE__ */ t("span", { style: { fontSize: "1rem" }, children: "+" }),
|
|
505
|
-
/* @__PURE__ */ t("span", { children: "Custom" })
|
|
506
|
-
]
|
|
507
|
-
}
|
|
508
|
-
)
|
|
509
|
-
] }),
|
|
510
|
-
x && /* @__PURE__ */ o("div", { style: {
|
|
511
|
-
display: "flex",
|
|
512
|
-
flexDirection: "column",
|
|
513
|
-
gap: "0.75rem",
|
|
514
|
-
padding: "1rem",
|
|
515
|
-
background: "var(--cedros-admin-bg-muted, #f9fafb)",
|
|
516
|
-
borderRadius: "0.5rem",
|
|
517
|
-
border: "1px solid var(--cedros-admin-border, #e5e7eb)"
|
|
518
|
-
}, children: [
|
|
519
|
-
/* @__PURE__ */ o("div", { children: [
|
|
520
|
-
/* @__PURE__ */ t("label", { style: {
|
|
521
|
-
display: "block",
|
|
522
|
-
fontSize: "0.75rem",
|
|
523
|
-
fontWeight: 500,
|
|
524
|
-
marginBottom: "0.25rem",
|
|
525
|
-
color: "var(--cedros-admin-text-muted, #64748b)"
|
|
526
|
-
}, children: "Token Mint Address" }),
|
|
527
|
-
(() => {
|
|
528
|
-
const e = B(s);
|
|
529
|
-
return /* @__PURE__ */ o(U, { children: [
|
|
530
|
-
/* @__PURE__ */ t(
|
|
531
|
-
"input",
|
|
532
|
-
{
|
|
533
|
-
type: "text",
|
|
534
|
-
className: `cedros-admin__input ${e.valid ? "" : "cedros-admin__input--error"}`,
|
|
535
|
-
value: s,
|
|
536
|
-
onChange: (i) => d(i.target.value),
|
|
537
|
-
placeholder: "e.g., EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
538
|
-
disabled: c,
|
|
539
|
-
style: {
|
|
540
|
-
fontFamily: "monospace",
|
|
541
|
-
fontSize: "0.875rem",
|
|
542
|
-
borderColor: e.valid ? void 0 : "var(--cedros-admin-error, #dc2626)"
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
),
|
|
546
|
-
!e.valid && /* @__PURE__ */ t("span", { style: { color: "var(--cedros-admin-error, #dc2626)", fontSize: "0.75rem", marginTop: "0.25rem", display: "block" }, children: e.error })
|
|
547
|
-
] });
|
|
548
|
-
})()
|
|
549
|
-
] }),
|
|
550
|
-
/* @__PURE__ */ o("div", { children: [
|
|
551
|
-
/* @__PURE__ */ t("label", { style: {
|
|
552
|
-
display: "block",
|
|
553
|
-
fontSize: "0.75rem",
|
|
554
|
-
fontWeight: 500,
|
|
555
|
-
marginBottom: "0.25rem",
|
|
556
|
-
color: "var(--cedros-admin-text-muted, #64748b)"
|
|
557
|
-
}, children: "Token Symbol" }),
|
|
558
|
-
/* @__PURE__ */ t(
|
|
559
|
-
"input",
|
|
560
|
-
{
|
|
561
|
-
type: "text",
|
|
562
|
-
className: "cedros-admin__input",
|
|
563
|
-
value: m,
|
|
564
|
-
onChange: (e) => p?.(e.target.value),
|
|
565
|
-
placeholder: "e.g., MYTOKEN",
|
|
566
|
-
disabled: c,
|
|
567
|
-
style: { textTransform: "uppercase" }
|
|
568
|
-
}
|
|
569
|
-
)
|
|
570
|
-
] }),
|
|
571
|
-
/* @__PURE__ */ o("div", { children: [
|
|
572
|
-
/* @__PURE__ */ t("label", { style: {
|
|
573
|
-
display: "block",
|
|
574
|
-
fontSize: "0.75rem",
|
|
575
|
-
fontWeight: 500,
|
|
576
|
-
marginBottom: "0.25rem",
|
|
577
|
-
color: "var(--cedros-admin-text-muted, #64748b)"
|
|
578
|
-
}, children: "Token Icon URL" }),
|
|
579
|
-
/* @__PURE__ */ o("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center" }, children: [
|
|
580
|
-
/* @__PURE__ */ t(
|
|
581
|
-
"input",
|
|
582
|
-
{
|
|
583
|
-
type: "text",
|
|
584
|
-
className: "cedros-admin__input",
|
|
585
|
-
value: h,
|
|
586
|
-
onChange: (e) => y?.(e.target.value),
|
|
587
|
-
placeholder: "https://example.com/token-logo.png",
|
|
588
|
-
disabled: c,
|
|
589
|
-
style: { flex: 1 }
|
|
590
|
-
}
|
|
591
|
-
),
|
|
592
|
-
h && /* @__PURE__ */ t(
|
|
593
|
-
"img",
|
|
594
|
-
{
|
|
595
|
-
src: h,
|
|
596
|
-
alt: "Token icon preview",
|
|
597
|
-
style: {
|
|
598
|
-
width: 32,
|
|
599
|
-
height: 32,
|
|
600
|
-
borderRadius: "50%",
|
|
601
|
-
border: "1px solid var(--cedros-admin-border, #e5e7eb)",
|
|
602
|
-
objectFit: "cover"
|
|
603
|
-
},
|
|
604
|
-
onError: (e) => {
|
|
605
|
-
e.target.style.display = "none";
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
)
|
|
609
|
-
] }),
|
|
610
|
-
/* @__PURE__ */ t("div", { style: {
|
|
611
|
-
fontSize: "0.7rem",
|
|
612
|
-
color: "var(--cedros-admin-text-muted, #94a3b8)",
|
|
613
|
-
marginTop: "0.25rem"
|
|
614
|
-
}, children: "Shown to customers during checkout" })
|
|
615
|
-
] }),
|
|
616
|
-
/* @__PURE__ */ o("div", { children: [
|
|
617
|
-
/* @__PURE__ */ t("label", { style: {
|
|
618
|
-
display: "block",
|
|
619
|
-
fontSize: "0.75rem",
|
|
620
|
-
fontWeight: 500,
|
|
621
|
-
marginBottom: "0.25rem",
|
|
622
|
-
color: "var(--cedros-admin-text-muted, #64748b)"
|
|
623
|
-
}, children: "Token Decimals" }),
|
|
624
|
-
/* @__PURE__ */ t(
|
|
625
|
-
"input",
|
|
626
|
-
{
|
|
627
|
-
type: "number",
|
|
628
|
-
className: "cedros-admin__input",
|
|
629
|
-
value: n ?? 6,
|
|
630
|
-
onChange: (e) => S?.(parseInt(e.target.value, 10) || 0),
|
|
631
|
-
min: 0,
|
|
632
|
-
max: 18,
|
|
633
|
-
disabled: c,
|
|
634
|
-
style: { width: "100px" }
|
|
635
|
-
}
|
|
636
|
-
),
|
|
637
|
-
/* @__PURE__ */ t("div", { style: {
|
|
638
|
-
fontSize: "0.7rem",
|
|
639
|
-
color: "var(--cedros-admin-text-muted, #94a3b8)",
|
|
640
|
-
marginTop: "0.25rem"
|
|
641
|
-
}, children: "Most SPL tokens use 6 decimals (like USDC)" })
|
|
642
|
-
] })
|
|
643
|
-
] }),
|
|
644
|
-
s && _ && /* @__PURE__ */ t("div", { style: {
|
|
645
|
-
fontSize: "0.75rem",
|
|
646
|
-
color: "var(--cedros-admin-text-muted, #64748b)",
|
|
647
|
-
fontFamily: "monospace",
|
|
648
|
-
wordBreak: "break-all"
|
|
649
|
-
}, children: s }),
|
|
650
|
-
l && /* @__PURE__ */ t("div", { style: {
|
|
651
|
-
fontSize: "0.75rem",
|
|
652
|
-
color: "var(--cedros-admin-text-muted, #64748b)",
|
|
653
|
-
marginTop: "0.25rem"
|
|
654
|
-
}, children: l })
|
|
655
|
-
] })
|
|
656
|
-
] });
|
|
657
|
-
}
|
|
658
|
-
function se({
|
|
659
|
-
label: b,
|
|
660
|
-
value: s,
|
|
661
|
-
onChange: d,
|
|
662
|
-
disabled: n = !1,
|
|
663
|
-
description: S
|
|
664
|
-
}) {
|
|
665
|
-
const [c, l] = k(/* @__PURE__ */ new Set()), [m, h] = k(null), [p, y] = k(""), w = Array.isArray(s) ? s : [], A = (e) => {
|
|
666
|
-
l((i) => {
|
|
667
|
-
const r = new Set(i);
|
|
668
|
-
return r.has(e) ? r.delete(e) : r.add(e), r;
|
|
669
|
-
});
|
|
670
|
-
}, f = () => {
|
|
671
|
-
d([...w, ""]), h(w.length), y("");
|
|
672
|
-
}, M = (e, i) => {
|
|
673
|
-
const r = [...w];
|
|
674
|
-
r[e] = i, d(r);
|
|
675
|
-
}, _ = (e) => {
|
|
676
|
-
const i = w.filter((r, g) => g !== e);
|
|
677
|
-
d(i), l((r) => {
|
|
678
|
-
const g = /* @__PURE__ */ new Set();
|
|
679
|
-
return r.forEach((v) => {
|
|
680
|
-
v < e ? g.add(v) : v > e && g.add(v - 1);
|
|
681
|
-
}), g;
|
|
682
|
-
});
|
|
683
|
-
}, R = (e) => {
|
|
684
|
-
h(e), y(w[e] || "");
|
|
685
|
-
}, x = () => {
|
|
686
|
-
m !== null && (M(m, p), h(null), y(""));
|
|
687
|
-
}, C = () => {
|
|
688
|
-
m !== null && w[m] === "" && _(m), h(null), y("");
|
|
689
|
-
};
|
|
690
|
-
return /* @__PURE__ */ o("div", { className: "cedros-admin__field", children: [
|
|
691
|
-
/* @__PURE__ */ o("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "0.5rem" }, children: [
|
|
692
|
-
/* @__PURE__ */ t("label", { className: "cedros-admin__field-label", style: { marginBottom: 0 }, children: b }),
|
|
693
|
-
/* @__PURE__ */ o(
|
|
694
|
-
"button",
|
|
695
|
-
{
|
|
696
|
-
type: "button",
|
|
697
|
-
onClick: f,
|
|
698
|
-
disabled: n,
|
|
699
|
-
style: {
|
|
700
|
-
display: "flex",
|
|
701
|
-
alignItems: "center",
|
|
702
|
-
gap: "0.25rem",
|
|
703
|
-
padding: "0.25rem 0.5rem",
|
|
704
|
-
fontSize: "0.75rem",
|
|
705
|
-
border: "1px solid var(--cedros-admin-border, #d4d4d4)",
|
|
706
|
-
borderRadius: "0.375rem",
|
|
707
|
-
background: "var(--cedros-admin-bg, #fff)",
|
|
708
|
-
cursor: n ? "not-allowed" : "pointer",
|
|
709
|
-
opacity: n ? 0.5 : 1
|
|
710
|
-
},
|
|
711
|
-
children: [
|
|
712
|
-
T.plus,
|
|
713
|
-
"Add"
|
|
714
|
-
]
|
|
715
|
-
}
|
|
716
|
-
)
|
|
717
|
-
] }),
|
|
718
|
-
/* @__PURE__ */ o("div", { style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
|
|
719
|
-
w.length === 0 && /* @__PURE__ */ t("div", { style: {
|
|
720
|
-
padding: "1rem",
|
|
721
|
-
textAlign: "center",
|
|
722
|
-
color: "var(--cedros-admin-text-muted, #64748b)",
|
|
723
|
-
fontSize: "0.875rem",
|
|
724
|
-
border: "1px dashed var(--cedros-admin-border, #d4d4d4)",
|
|
725
|
-
borderRadius: "0.5rem"
|
|
726
|
-
}, children: 'No items. Click "Add" to create one.' }),
|
|
727
|
-
w.map((e, i) => {
|
|
728
|
-
const r = c.has(i), g = m === i, v = e === z;
|
|
729
|
-
return /* @__PURE__ */ t(
|
|
730
|
-
"div",
|
|
731
|
-
{
|
|
732
|
-
style: {
|
|
733
|
-
display: "flex",
|
|
734
|
-
alignItems: "center",
|
|
735
|
-
gap: "0.5rem",
|
|
736
|
-
padding: "0.5rem",
|
|
737
|
-
background: "var(--cedros-admin-bg-muted, #f9fafb)",
|
|
738
|
-
borderRadius: "0.375rem",
|
|
739
|
-
border: "1px solid var(--cedros-admin-border, #e5e7eb)"
|
|
740
|
-
},
|
|
741
|
-
children: g ? /* @__PURE__ */ o(U, { children: [
|
|
742
|
-
/* @__PURE__ */ t(
|
|
743
|
-
"input",
|
|
744
|
-
{
|
|
745
|
-
type: "text",
|
|
746
|
-
className: "cedros-admin__input",
|
|
747
|
-
value: p,
|
|
748
|
-
onChange: (a) => y(a.target.value),
|
|
749
|
-
placeholder: "Enter wallet keypair...",
|
|
750
|
-
autoFocus: !0,
|
|
751
|
-
style: { flex: 1, fontFamily: "monospace", fontSize: "0.75rem" },
|
|
752
|
-
onKeyDown: (a) => {
|
|
753
|
-
a.key === "Enter" && x(), a.key === "Escape" && C();
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
),
|
|
757
|
-
/* @__PURE__ */ t(
|
|
758
|
-
"button",
|
|
759
|
-
{
|
|
760
|
-
type: "button",
|
|
761
|
-
onClick: x,
|
|
762
|
-
style: {
|
|
763
|
-
padding: "0.375rem",
|
|
764
|
-
border: "none",
|
|
765
|
-
background: "var(--cedros-admin-success, #22c55e)",
|
|
766
|
-
color: "#fff",
|
|
767
|
-
borderRadius: "0.25rem",
|
|
768
|
-
cursor: "pointer"
|
|
769
|
-
},
|
|
770
|
-
title: "Save",
|
|
771
|
-
children: T.check
|
|
772
|
-
}
|
|
773
|
-
),
|
|
774
|
-
/* @__PURE__ */ t(
|
|
775
|
-
"button",
|
|
776
|
-
{
|
|
777
|
-
type: "button",
|
|
778
|
-
onClick: C,
|
|
779
|
-
style: {
|
|
780
|
-
padding: "0.375rem",
|
|
781
|
-
border: "none",
|
|
782
|
-
background: "var(--cedros-admin-text-muted, #64748b)",
|
|
783
|
-
color: "#fff",
|
|
784
|
-
borderRadius: "0.25rem",
|
|
785
|
-
cursor: "pointer"
|
|
786
|
-
},
|
|
787
|
-
title: "Cancel",
|
|
788
|
-
children: T.close
|
|
789
|
-
}
|
|
790
|
-
)
|
|
791
|
-
] }) : /* @__PURE__ */ o(U, { children: [
|
|
792
|
-
/* @__PURE__ */ t("div", { style: {
|
|
793
|
-
flex: 1,
|
|
794
|
-
fontFamily: "monospace",
|
|
795
|
-
fontSize: "0.75rem",
|
|
796
|
-
overflow: "hidden",
|
|
797
|
-
textOverflow: "ellipsis",
|
|
798
|
-
whiteSpace: "nowrap"
|
|
799
|
-
}, children: r && !v ? e : v ? "[REDACTED]" : "••••••••••••••••••••" }),
|
|
800
|
-
/* @__PURE__ */ t(
|
|
801
|
-
"button",
|
|
802
|
-
{
|
|
803
|
-
type: "button",
|
|
804
|
-
onClick: () => A(i),
|
|
805
|
-
disabled: n || v,
|
|
806
|
-
style: {
|
|
807
|
-
padding: "0.375rem",
|
|
808
|
-
border: "none",
|
|
809
|
-
background: "transparent",
|
|
810
|
-
cursor: n || v ? "not-allowed" : "pointer",
|
|
811
|
-
opacity: n || v ? 0.5 : 1,
|
|
812
|
-
color: "var(--cedros-admin-text-muted, #64748b)"
|
|
813
|
-
},
|
|
814
|
-
title: r ? "Hide" : "Show",
|
|
815
|
-
children: r ? T.eyeOff : T.eye
|
|
816
|
-
}
|
|
817
|
-
),
|
|
818
|
-
/* @__PURE__ */ t(
|
|
819
|
-
"button",
|
|
820
|
-
{
|
|
821
|
-
type: "button",
|
|
822
|
-
onClick: () => R(i),
|
|
823
|
-
disabled: n,
|
|
824
|
-
style: {
|
|
825
|
-
padding: "0.375rem",
|
|
826
|
-
border: "none",
|
|
827
|
-
background: "transparent",
|
|
828
|
-
cursor: n ? "not-allowed" : "pointer",
|
|
829
|
-
opacity: n ? 0.5 : 1,
|
|
830
|
-
color: "var(--cedros-admin-text-muted, #64748b)"
|
|
831
|
-
},
|
|
832
|
-
title: "Edit",
|
|
833
|
-
children: T.settings
|
|
834
|
-
}
|
|
835
|
-
),
|
|
836
|
-
/* @__PURE__ */ t(
|
|
837
|
-
"button",
|
|
838
|
-
{
|
|
839
|
-
type: "button",
|
|
840
|
-
onClick: () => _(i),
|
|
841
|
-
disabled: n,
|
|
842
|
-
style: {
|
|
843
|
-
padding: "0.375rem",
|
|
844
|
-
border: "none",
|
|
845
|
-
background: "transparent",
|
|
846
|
-
cursor: n ? "not-allowed" : "pointer",
|
|
847
|
-
opacity: n ? 0.5 : 1,
|
|
848
|
-
color: "var(--cedros-admin-error, #ef4444)"
|
|
849
|
-
},
|
|
850
|
-
title: "Delete",
|
|
851
|
-
children: T.trash
|
|
852
|
-
}
|
|
853
|
-
)
|
|
854
|
-
] })
|
|
855
|
-
},
|
|
856
|
-
i
|
|
857
|
-
);
|
|
858
|
-
})
|
|
859
|
-
] }),
|
|
860
|
-
S && /* @__PURE__ */ t("div", { style: {
|
|
861
|
-
fontSize: "0.75rem",
|
|
862
|
-
color: "var(--cedros-admin-text-muted, #64748b)",
|
|
863
|
-
marginTop: "0.5rem"
|
|
864
|
-
}, children: S })
|
|
865
|
-
] });
|
|
866
|
-
}
|
|
867
|
-
function J(b, s, d) {
|
|
868
|
-
const n = G(b, s), S = s.replace(/_/g, " ").replace(/\b\w/g, (h) => h.toUpperCase()), l = F[b]?.fields?.[s], m = {
|
|
869
|
-
isSecret: n,
|
|
870
|
-
label: S,
|
|
871
|
-
description: l?.description,
|
|
872
|
-
hidden: l?.hidden,
|
|
873
|
-
showWhen: l?.showWhen
|
|
874
|
-
};
|
|
875
|
-
return l?.type === "dropdown" && l.options ? { ...m, type: "dropdown", options: l.options } : l?.type === "token_mint" ? { ...m, type: "token_mint" } : l?.type === "toggle" ? { ...m, type: "toggle" } : l?.type === "secret_array" ? { ...m, type: "secret_array", isSecret: !0 } : l?.type === "solana_address" ? { ...m, type: "solana_address" } : l?.type === "number" ? { ...m, type: "number", unit: l.unit } : typeof d == "boolean" ? { ...m, type: "boolean" } : typeof d == "number" ? { ...m, type: "number", unit: l?.unit } : Array.isArray(d) ? { ...m, type: "array" } : typeof d == "object" && d !== null ? { ...m, type: "object" } : { ...m, type: "string" };
|
|
876
|
-
}
|
|
877
|
-
function ae({
|
|
878
|
-
category: b,
|
|
879
|
-
config: s,
|
|
880
|
-
originalConfig: d,
|
|
881
|
-
isLoading: n = !1,
|
|
882
|
-
onSave: S
|
|
883
|
-
}) {
|
|
884
|
-
const [c, l] = k(s), [m, h] = k(/* @__PURE__ */ new Set());
|
|
885
|
-
H(() => {
|
|
886
|
-
l(s);
|
|
887
|
-
}, [s]);
|
|
888
|
-
const p = V(() => {
|
|
889
|
-
const e = { ...c };
|
|
890
|
-
for (const i of Object.keys(e))
|
|
891
|
-
if (G(b, i)) {
|
|
892
|
-
const r = d[i], g = e[i];
|
|
893
|
-
(g === z || g === r) && (e[i] = z);
|
|
894
|
-
}
|
|
895
|
-
return e;
|
|
896
|
-
}, [c, d, b]), y = V(() => {
|
|
897
|
-
const e = c.token_mint;
|
|
898
|
-
return typeof e != "string" || !e ? !1 : !B(e).valid;
|
|
899
|
-
}, [c]), { status: w, error: A } = te({
|
|
900
|
-
data: p,
|
|
901
|
-
onSave: S,
|
|
902
|
-
debounceMs: 1500,
|
|
903
|
-
enabled: !y
|
|
904
|
-
}), f = I((e, i) => {
|
|
905
|
-
l((r) => ({ ...r, [e]: i }));
|
|
906
|
-
}, []), M = I((e) => {
|
|
907
|
-
h((i) => {
|
|
908
|
-
const r = new Set(i);
|
|
909
|
-
return r.has(e) ? r.delete(e) : r.add(e), r;
|
|
910
|
-
});
|
|
911
|
-
}, []), _ = (e) => e ? /* @__PURE__ */ t("div", { style: {
|
|
912
|
-
fontSize: "0.75rem",
|
|
913
|
-
color: "var(--cedros-admin-text-muted, #64748b)",
|
|
914
|
-
marginTop: "0.25rem"
|
|
915
|
-
}, children: e }) : null, R = (e, i) => {
|
|
916
|
-
const r = J(b, e, d[e] ?? i);
|
|
917
|
-
if (r.type === "dropdown" && r.options)
|
|
918
|
-
return /* @__PURE__ */ t(
|
|
919
|
-
Z,
|
|
920
|
-
{
|
|
921
|
-
value: i,
|
|
922
|
-
onChange: (a) => f(e, a),
|
|
923
|
-
options: r.options.map((a) => ({ value: a, label: a })),
|
|
924
|
-
label: r.label,
|
|
925
|
-
description: r.description,
|
|
926
|
-
disabled: n
|
|
927
|
-
}
|
|
928
|
-
);
|
|
929
|
-
if (r.type === "token_mint")
|
|
930
|
-
return /* @__PURE__ */ t(
|
|
931
|
-
oe,
|
|
932
|
-
{
|
|
933
|
-
label: r.label,
|
|
934
|
-
value: i,
|
|
935
|
-
onChange: (a) => f(e, a),
|
|
936
|
-
decimals: c.token_decimals ?? 6,
|
|
937
|
-
onDecimalsChange: (a) => f("token_decimals", a),
|
|
938
|
-
disabled: n,
|
|
939
|
-
description: r.description,
|
|
940
|
-
customSymbol: c.custom_token_symbol || "",
|
|
941
|
-
customIcon: c.custom_token_icon || "",
|
|
942
|
-
onCustomSymbolChange: (a) => f("custom_token_symbol", a),
|
|
943
|
-
onCustomIconChange: (a) => f("custom_token_icon", a)
|
|
944
|
-
}
|
|
945
|
-
);
|
|
946
|
-
if (r.type === "toggle")
|
|
947
|
-
return /* @__PURE__ */ o("div", { className: "cedros-admin__field", children: [
|
|
948
|
-
/* @__PURE__ */ o("div", { style: { display: "flex", alignItems: "center", gap: "0.75rem" }, children: [
|
|
949
|
-
/* @__PURE__ */ t(
|
|
950
|
-
"button",
|
|
951
|
-
{
|
|
952
|
-
type: "button",
|
|
953
|
-
role: "switch",
|
|
954
|
-
"aria-checked": i,
|
|
955
|
-
onClick: () => f(e, !i),
|
|
956
|
-
disabled: n,
|
|
957
|
-
style: {
|
|
958
|
-
width: 44,
|
|
959
|
-
height: 24,
|
|
960
|
-
borderRadius: 12,
|
|
961
|
-
border: "none",
|
|
962
|
-
backgroundColor: i ? "var(--cedros-admin-primary, #171717)" : "var(--cedros-admin-border, #d4d4d4)",
|
|
963
|
-
cursor: n ? "not-allowed" : "pointer",
|
|
964
|
-
position: "relative",
|
|
965
|
-
transition: "background-color 0.2s",
|
|
966
|
-
opacity: n ? 0.5 : 1,
|
|
967
|
-
flexShrink: 0
|
|
968
|
-
},
|
|
969
|
-
children: /* @__PURE__ */ t(
|
|
970
|
-
"span",
|
|
971
|
-
{
|
|
972
|
-
style: {
|
|
973
|
-
position: "absolute",
|
|
974
|
-
top: 2,
|
|
975
|
-
left: i ? 22 : 2,
|
|
976
|
-
width: 20,
|
|
977
|
-
height: 20,
|
|
978
|
-
borderRadius: "50%",
|
|
979
|
-
backgroundColor: "#fff",
|
|
980
|
-
transition: "left 0.2s",
|
|
981
|
-
boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
)
|
|
985
|
-
}
|
|
986
|
-
),
|
|
987
|
-
/* @__PURE__ */ t("span", { className: "cedros-admin__field-label", style: { marginBottom: 0 }, children: r.label })
|
|
988
|
-
] }),
|
|
989
|
-
_(r.description)
|
|
990
|
-
] });
|
|
991
|
-
if (r.type === "solana_address") {
|
|
992
|
-
const a = i || "", N = B(a);
|
|
993
|
-
return /* @__PURE__ */ o("div", { className: "cedros-admin__field", children: [
|
|
994
|
-
/* @__PURE__ */ t("label", { className: "cedros-admin__field-label", children: r.label }),
|
|
995
|
-
/* @__PURE__ */ o("div", { style: { position: "relative" }, children: [
|
|
996
|
-
/* @__PURE__ */ t(
|
|
997
|
-
"input",
|
|
998
|
-
{
|
|
999
|
-
type: "text",
|
|
1000
|
-
className: `cedros-admin__input ${N.valid ? "" : "cedros-admin__input--error"}`,
|
|
1001
|
-
value: a,
|
|
1002
|
-
onChange: (D) => f(e, D.target.value),
|
|
1003
|
-
disabled: n,
|
|
1004
|
-
placeholder: "e.g. 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
|
|
1005
|
-
style: {
|
|
1006
|
-
width: "100%",
|
|
1007
|
-
fontFamily: "monospace",
|
|
1008
|
-
fontSize: "0.875rem",
|
|
1009
|
-
borderColor: N.valid ? void 0 : "var(--cedros-admin-error, #dc2626)",
|
|
1010
|
-
paddingRight: a && N.valid ? "2rem" : void 0
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
),
|
|
1014
|
-
a && N.valid && /* @__PURE__ */ t(
|
|
1015
|
-
"span",
|
|
1016
|
-
{
|
|
1017
|
-
style: {
|
|
1018
|
-
position: "absolute",
|
|
1019
|
-
right: 10,
|
|
1020
|
-
top: "50%",
|
|
1021
|
-
transform: "translateY(-50%)",
|
|
1022
|
-
color: "var(--cedros-admin-success, #16a34a)",
|
|
1023
|
-
fontSize: "1rem"
|
|
1024
|
-
},
|
|
1025
|
-
title: "Valid Solana address",
|
|
1026
|
-
children: "✓"
|
|
1027
|
-
}
|
|
1028
|
-
)
|
|
1029
|
-
] }),
|
|
1030
|
-
!N.valid && /* @__PURE__ */ t("span", { style: { color: "var(--cedros-admin-error, #dc2626)", fontSize: "0.75rem", marginTop: "0.25rem", display: "block" }, children: N.error }),
|
|
1031
|
-
_(r.description)
|
|
1032
|
-
] });
|
|
1033
|
-
}
|
|
1034
|
-
if (r.type === "boolean")
|
|
1035
|
-
return /* @__PURE__ */ o("div", { className: "cedros-admin__field", children: [
|
|
1036
|
-
/* @__PURE__ */ o("label", { className: "cedros-admin__checkbox", children: [
|
|
1037
|
-
/* @__PURE__ */ t(
|
|
1038
|
-
"input",
|
|
1039
|
-
{
|
|
1040
|
-
type: "checkbox",
|
|
1041
|
-
checked: i,
|
|
1042
|
-
onChange: (a) => f(e, a.target.checked),
|
|
1043
|
-
disabled: n
|
|
1044
|
-
}
|
|
1045
|
-
),
|
|
1046
|
-
r.label
|
|
1047
|
-
] }),
|
|
1048
|
-
_(r.description)
|
|
1049
|
-
] });
|
|
1050
|
-
if (r.type === "number")
|
|
1051
|
-
return /* @__PURE__ */ o("div", { className: "cedros-admin__field", children: [
|
|
1052
|
-
/* @__PURE__ */ o("label", { className: "cedros-admin__field-label", children: [
|
|
1053
|
-
r.label,
|
|
1054
|
-
r.unit && /* @__PURE__ */ o("span", { className: "cedros-admin__field-unit", children: [
|
|
1055
|
-
" (",
|
|
1056
|
-
r.unit,
|
|
1057
|
-
")"
|
|
1058
|
-
] })
|
|
1059
|
-
] }),
|
|
1060
|
-
/* @__PURE__ */ t(
|
|
1061
|
-
"input",
|
|
1062
|
-
{
|
|
1063
|
-
type: "number",
|
|
1064
|
-
className: "cedros-admin__input",
|
|
1065
|
-
value: i,
|
|
1066
|
-
onChange: (a) => f(e, parseFloat(a.target.value) || 0),
|
|
1067
|
-
disabled: n
|
|
1068
|
-
}
|
|
1069
|
-
),
|
|
1070
|
-
_(r.description)
|
|
1071
|
-
] });
|
|
1072
|
-
if (r.type === "secret_array")
|
|
1073
|
-
return /* @__PURE__ */ t(
|
|
1074
|
-
se,
|
|
1075
|
-
{
|
|
1076
|
-
label: r.label,
|
|
1077
|
-
value: i,
|
|
1078
|
-
onChange: (a) => f(e, a),
|
|
1079
|
-
disabled: n,
|
|
1080
|
-
description: r.description
|
|
1081
|
-
}
|
|
1082
|
-
);
|
|
1083
|
-
if (r.type === "array") {
|
|
1084
|
-
const a = i;
|
|
1085
|
-
return /* @__PURE__ */ o("div", { className: "cedros-admin__field", children: [
|
|
1086
|
-
/* @__PURE__ */ t("label", { className: "cedros-admin__field-label", children: r.label }),
|
|
1087
|
-
/* @__PURE__ */ t(
|
|
1088
|
-
"textarea",
|
|
1089
|
-
{
|
|
1090
|
-
className: "cedros-admin__textarea",
|
|
1091
|
-
value: a.join(`
|
|
1092
|
-
`),
|
|
1093
|
-
onChange: (N) => f(e, N.target.value.split(`
|
|
1094
|
-
`).filter(Boolean)),
|
|
1095
|
-
placeholder: "One item per line",
|
|
1096
|
-
rows: 3,
|
|
1097
|
-
disabled: n
|
|
1098
|
-
}
|
|
1099
|
-
),
|
|
1100
|
-
_(r.description)
|
|
1101
|
-
] });
|
|
1102
|
-
}
|
|
1103
|
-
if (r.type === "object")
|
|
1104
|
-
return /* @__PURE__ */ o("div", { className: "cedros-admin__field", children: [
|
|
1105
|
-
/* @__PURE__ */ t("label", { className: "cedros-admin__field-label", children: r.label }),
|
|
1106
|
-
/* @__PURE__ */ t(
|
|
1107
|
-
"textarea",
|
|
1108
|
-
{
|
|
1109
|
-
className: "cedros-admin__textarea cedros-admin__textarea--mono",
|
|
1110
|
-
value: JSON.stringify(i, null, 2),
|
|
1111
|
-
onChange: (a) => {
|
|
1112
|
-
try {
|
|
1113
|
-
f(e, JSON.parse(a.target.value));
|
|
1114
|
-
} catch {
|
|
1115
|
-
}
|
|
1116
|
-
},
|
|
1117
|
-
rows: 5,
|
|
1118
|
-
disabled: n
|
|
1119
|
-
}
|
|
1120
|
-
),
|
|
1121
|
-
_(r.description)
|
|
1122
|
-
] });
|
|
1123
|
-
const g = m.has(e), v = r.isSecret && !g && i === z ? z : i;
|
|
1124
|
-
return /* @__PURE__ */ o("div", { className: "cedros-admin__field", children: [
|
|
1125
|
-
/* @__PURE__ */ o("label", { className: "cedros-admin__field-label", children: [
|
|
1126
|
-
r.label,
|
|
1127
|
-
r.isSecret && /* @__PURE__ */ t("span", { className: "cedros-admin__field-secret", children: " (secret)" })
|
|
1128
|
-
] }),
|
|
1129
|
-
/* @__PURE__ */ o("div", { className: "cedros-admin__input-group", children: [
|
|
1130
|
-
/* @__PURE__ */ t(
|
|
1131
|
-
"input",
|
|
1132
|
-
{
|
|
1133
|
-
type: r.isSecret && !g ? "password" : "text",
|
|
1134
|
-
className: "cedros-admin__input",
|
|
1135
|
-
value: v,
|
|
1136
|
-
onChange: (a) => f(e, a.target.value),
|
|
1137
|
-
disabled: n,
|
|
1138
|
-
placeholder: r.isSecret ? "••••••••" : ""
|
|
1139
|
-
}
|
|
1140
|
-
),
|
|
1141
|
-
r.isSecret && /* @__PURE__ */ t(
|
|
1142
|
-
"button",
|
|
1143
|
-
{
|
|
1144
|
-
type: "button",
|
|
1145
|
-
className: "cedros-admin__button cedros-admin__button--ghost",
|
|
1146
|
-
onClick: () => M(e),
|
|
1147
|
-
style: { padding: "0.5rem", minWidth: "auto" },
|
|
1148
|
-
title: g ? "Hide" : "Show",
|
|
1149
|
-
children: g ? T.eyeOff : T.eye
|
|
1150
|
-
}
|
|
1151
|
-
)
|
|
1152
|
-
] }),
|
|
1153
|
-
_(r.description)
|
|
1154
|
-
] });
|
|
1155
|
-
}, x = Object.keys(c), C = (e) => {
|
|
1156
|
-
const i = J(b, e, d[e] ?? c[e]);
|
|
1157
|
-
if (i.hidden || i.showWhen && !c[i.showWhen])
|
|
1158
|
-
return !1;
|
|
1159
|
-
if (e === "token_decimals") {
|
|
1160
|
-
const r = c.token_mint;
|
|
1161
|
-
if (r && O[r])
|
|
1162
|
-
return !1;
|
|
1163
|
-
}
|
|
1164
|
-
return !0;
|
|
1165
|
-
};
|
|
1166
|
-
return /* @__PURE__ */ o("div", { className: "cedros-admin__config-editor", children: [
|
|
1167
|
-
/* @__PURE__ */ t("div", { className: "cedros-admin__config-fields", children: x.filter(C).map((e) => /* @__PURE__ */ t("div", { className: "cedros-admin__config-field", children: R(e, c[e]) }, e)) }),
|
|
1168
|
-
/* @__PURE__ */ t("div", { className: "cedros-admin__config-actions", children: /* @__PURE__ */ t("div", { className: "cedros-admin__autosave-status", children: /* @__PURE__ */ t(re, { status: w, error: A }) }) })
|
|
1169
|
-
] });
|
|
1170
|
-
}
|
|
1171
|
-
function he({
|
|
1172
|
-
serverUrl: b,
|
|
1173
|
-
apiKey: s,
|
|
1174
|
-
authManager: d,
|
|
1175
|
-
category: n,
|
|
1176
|
-
title: S,
|
|
1177
|
-
description: c,
|
|
1178
|
-
enabledField: l = "enabled",
|
|
1179
|
-
showEnabledToggle: m = !1
|
|
1180
|
-
}) {
|
|
1181
|
-
const h = V(
|
|
1182
|
-
() => new ie(b, void 0, d),
|
|
1183
|
-
[b, d]
|
|
1184
|
-
), [p, y] = k(null), [w, A] = k([]), [f, M] = k(!1), [_, R] = k(!0), [x, C] = k(null), [e, i] = k(null), [r, g] = k(!1), v = F[n] || { label: n, icon: "⚙️" }, a = S || v.label, N = c || v.description, D = I(async () => {
|
|
1185
|
-
R(!0), C(null);
|
|
1186
|
-
try {
|
|
1187
|
-
const u = await h.getConfig(n, !0);
|
|
1188
|
-
y(u);
|
|
1189
|
-
} catch {
|
|
1190
|
-
y(null), C("Failed to load settings");
|
|
1191
|
-
} finally {
|
|
1192
|
-
R(!1);
|
|
1193
|
-
}
|
|
1194
|
-
}, [h, n]);
|
|
1195
|
-
H(() => {
|
|
1196
|
-
D();
|
|
1197
|
-
}, [D]);
|
|
1198
|
-
const L = I(async () => {
|
|
1199
|
-
try {
|
|
1200
|
-
const u = await h.getHistory(n, 20);
|
|
1201
|
-
A(u.history);
|
|
1202
|
-
} catch {
|
|
1203
|
-
A([]);
|
|
1204
|
-
}
|
|
1205
|
-
}, [h, n]);
|
|
1206
|
-
H(() => {
|
|
1207
|
-
f && L();
|
|
1208
|
-
}, [f, L]);
|
|
1209
|
-
const Y = I(async (u) => {
|
|
1210
|
-
await h.updateConfig(n, u, "Updated via admin dashboard");
|
|
1211
|
-
}, [h, n]), j = I(async (u) => h.validateConfig(n, u), [h, n]), [W, $] = k(!1), X = I(async () => {
|
|
1212
|
-
if (!p || W) return;
|
|
1213
|
-
const u = !!p.config[l], P = !u, K = { ...p.config, [l]: P };
|
|
1214
|
-
$(!0), y({ ...p, config: K });
|
|
1215
|
-
try {
|
|
1216
|
-
await h.updateConfig(n, K, `${P ? "Enabled" : "Disabled"} via admin dashboard`);
|
|
1217
|
-
} catch (q) {
|
|
1218
|
-
y({ ...p, config: { ...p.config, [l]: u } }), C(q instanceof Error ? q.message : "Failed to save enabled state");
|
|
1219
|
-
} finally {
|
|
1220
|
-
$(!1);
|
|
1221
|
-
}
|
|
1222
|
-
}, [p, h, n, l, W]), E = !!p?.config[l];
|
|
1223
|
-
return _ && !p ? /* @__PURE__ */ t("div", { className: "cedros-admin__section", children: /* @__PURE__ */ o("div", { className: "cedros-admin__loading", children: [
|
|
1224
|
-
T.loading,
|
|
1225
|
-
" Loading ",
|
|
1226
|
-
a,
|
|
1227
|
-
" settings..."
|
|
1228
|
-
] }) }) : /* @__PURE__ */ o("div", { className: "cedros-admin__section", children: [
|
|
1229
|
-
/* @__PURE__ */ t(Q, { message: x, onRetry: D }),
|
|
1230
|
-
/* @__PURE__ */ o("div", { className: "cedros-admin__section-header", children: [
|
|
1231
|
-
/* @__PURE__ */ o("div", { children: [
|
|
1232
|
-
/* @__PURE__ */ o("h3", { className: "cedros-admin__section-title", children: [
|
|
1233
|
-
/* @__PURE__ */ t("span", { style: { marginRight: "0.5rem" }, children: v.icon }),
|
|
1234
|
-
a
|
|
1235
|
-
] }),
|
|
1236
|
-
N && /* @__PURE__ */ t("p", { className: "cedros-admin__text-muted", style: { marginTop: "0.25rem" }, children: N })
|
|
1237
|
-
] }),
|
|
1238
|
-
m && p && /* @__PURE__ */ o("div", { style: { display: "flex", alignItems: "center", gap: "0.75rem" }, children: [
|
|
1239
|
-
/* @__PURE__ */ t("span", { style: { fontSize: "0.875rem", color: E ? "var(--cedros-admin-text, #171717)" : "var(--cedros-admin-muted, #737373)" }, children: E ? "Enabled" : "Disabled" }),
|
|
1240
|
-
/* @__PURE__ */ t(
|
|
1241
|
-
"button",
|
|
1242
|
-
{
|
|
1243
|
-
type: "button",
|
|
1244
|
-
role: "switch",
|
|
1245
|
-
"aria-checked": E,
|
|
1246
|
-
onClick: X,
|
|
1247
|
-
disabled: W,
|
|
1248
|
-
style: {
|
|
1249
|
-
width: 44,
|
|
1250
|
-
height: 24,
|
|
1251
|
-
borderRadius: 12,
|
|
1252
|
-
border: "none",
|
|
1253
|
-
backgroundColor: E ? "var(--cedros-admin-primary, #171717)" : "var(--cedros-admin-border, #d4d4d4)",
|
|
1254
|
-
cursor: W ? "wait" : "pointer",
|
|
1255
|
-
position: "relative",
|
|
1256
|
-
transition: "background-color 0.2s",
|
|
1257
|
-
flexShrink: 0,
|
|
1258
|
-
opacity: W ? 0.6 : 1
|
|
1259
|
-
},
|
|
1260
|
-
children: /* @__PURE__ */ t(
|
|
1261
|
-
"span",
|
|
1262
|
-
{
|
|
1263
|
-
style: {
|
|
1264
|
-
position: "absolute",
|
|
1265
|
-
top: 2,
|
|
1266
|
-
left: E ? 22 : 2,
|
|
1267
|
-
width: 20,
|
|
1268
|
-
height: 20,
|
|
1269
|
-
borderRadius: "50%",
|
|
1270
|
-
backgroundColor: "#fff",
|
|
1271
|
-
transition: "left 0.2s",
|
|
1272
|
-
boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
)
|
|
1276
|
-
}
|
|
1277
|
-
)
|
|
1278
|
-
] })
|
|
1279
|
-
] }),
|
|
1280
|
-
p && /* @__PURE__ */ o(
|
|
1281
|
-
"div",
|
|
1282
|
-
{
|
|
1283
|
-
className: "cedros-admin__settings-editor",
|
|
1284
|
-
style: {
|
|
1285
|
-
marginTop: "1rem",
|
|
1286
|
-
opacity: m && !E ? 0.6 : 1,
|
|
1287
|
-
pointerEvents: m && !E ? "none" : "auto"
|
|
1288
|
-
},
|
|
1289
|
-
children: [
|
|
1290
|
-
m && !E && /* @__PURE__ */ t(
|
|
1291
|
-
"div",
|
|
1292
|
-
{
|
|
1293
|
-
style: {
|
|
1294
|
-
padding: "0.75rem 1rem",
|
|
1295
|
-
marginBottom: "1rem",
|
|
1296
|
-
backgroundColor: "var(--cedros-admin-warning-bg, #fef3c7)",
|
|
1297
|
-
border: "1px solid var(--cedros-admin-warning-border, #f59e0b)",
|
|
1298
|
-
borderRadius: "0.375rem",
|
|
1299
|
-
fontSize: "0.875rem",
|
|
1300
|
-
color: "var(--cedros-admin-warning-text, #92400e)",
|
|
1301
|
-
pointerEvents: "auto"
|
|
1302
|
-
},
|
|
1303
|
-
children: "This payment method is disabled. Enable it using the toggle above to accept payments."
|
|
1304
|
-
}
|
|
1305
|
-
),
|
|
1306
|
-
/* @__PURE__ */ t(
|
|
1307
|
-
ae,
|
|
1308
|
-
{
|
|
1309
|
-
category: p.category,
|
|
1310
|
-
config: p.config,
|
|
1311
|
-
originalConfig: p.config,
|
|
1312
|
-
onSave: Y,
|
|
1313
|
-
onValidate: j
|
|
1314
|
-
}
|
|
1315
|
-
)
|
|
1316
|
-
]
|
|
1317
|
-
}
|
|
1318
|
-
),
|
|
1319
|
-
f && /* @__PURE__ */ o("div", { className: "cedros-admin__settings-history", style: { marginTop: "1.5rem" }, children: [
|
|
1320
|
-
/* @__PURE__ */ t("h4", { style: { marginBottom: "0.75rem", fontWeight: 600 }, children: "Change History" }),
|
|
1321
|
-
w.length === 0 ? /* @__PURE__ */ t("p", { className: "cedros-admin__text-muted", children: "No history entries found." }) : /* @__PURE__ */ t("div", { className: "cedros-admin__settings-timeline", children: w.map((u) => /* @__PURE__ */ o("div", { className: "cedros-admin__settings-timeline-item", children: [
|
|
1322
|
-
/* @__PURE__ */ t("div", { className: "cedros-admin__settings-timeline-dot" }),
|
|
1323
|
-
/* @__PURE__ */ o("div", { className: "cedros-admin__settings-timeline-content", children: [
|
|
1324
|
-
/* @__PURE__ */ o("div", { className: "cedros-admin__settings-timeline-header", children: [
|
|
1325
|
-
/* @__PURE__ */ t("code", { children: u.configKey }),
|
|
1326
|
-
/* @__PURE__ */ t("span", { className: `cedros-admin__badge cedros-admin__badge--${u.action.toLowerCase()}`, children: u.action })
|
|
1327
|
-
] }),
|
|
1328
|
-
/* @__PURE__ */ o("div", { className: "cedros-admin__settings-timeline-meta", children: [
|
|
1329
|
-
ee(u.changedAt),
|
|
1330
|
-
" by ",
|
|
1331
|
-
u.changedBy
|
|
1332
|
-
] })
|
|
1333
|
-
] })
|
|
1334
|
-
] }, u.id)) })
|
|
1335
|
-
] }),
|
|
1336
|
-
e && /* @__PURE__ */ t(
|
|
1337
|
-
"div",
|
|
1338
|
-
{
|
|
1339
|
-
style: {
|
|
1340
|
-
marginTop: "1rem",
|
|
1341
|
-
padding: "0.75rem 1rem",
|
|
1342
|
-
borderRadius: "0.375rem",
|
|
1343
|
-
backgroundColor: e.valid ? "var(--cedros-admin-success-bg, #dcfce7)" : "var(--cedros-admin-error-bg, #fef2f2)",
|
|
1344
|
-
border: `1px solid ${e.valid ? "var(--cedros-admin-success-border, #86efac)" : "var(--cedros-admin-error-border, #fecaca)"}`
|
|
1345
|
-
},
|
|
1346
|
-
children: /* @__PURE__ */ o("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start" }, children: [
|
|
1347
|
-
/* @__PURE__ */ o("div", { style: { flex: 1 }, children: [
|
|
1348
|
-
/* @__PURE__ */ t("div", { style: {
|
|
1349
|
-
fontWeight: 600,
|
|
1350
|
-
color: e.valid ? "var(--cedros-admin-success, #16a34a)" : "var(--cedros-admin-error, #dc2626)",
|
|
1351
|
-
marginBottom: e.errors.length > 0 || e.warnings.length > 0 ? "0.5rem" : 0
|
|
1352
|
-
}, children: e.valid ? "✓ Configuration is valid" : "✗ Validation failed" }),
|
|
1353
|
-
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((u, P) => /* @__PURE__ */ t("li", { children: u }, P)) }),
|
|
1354
|
-
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((u, P) => /* @__PURE__ */ t("li", { children: u }, P)) })
|
|
1355
|
-
] }),
|
|
1356
|
-
/* @__PURE__ */ t(
|
|
1357
|
-
"button",
|
|
1358
|
-
{
|
|
1359
|
-
type: "button",
|
|
1360
|
-
onClick: () => i(null),
|
|
1361
|
-
style: {
|
|
1362
|
-
background: "none",
|
|
1363
|
-
border: "none",
|
|
1364
|
-
cursor: "pointer",
|
|
1365
|
-
padding: "0.25rem",
|
|
1366
|
-
color: "var(--cedros-admin-text-muted, #64748b)",
|
|
1367
|
-
fontSize: "1.25rem",
|
|
1368
|
-
lineHeight: 1
|
|
1369
|
-
},
|
|
1370
|
-
title: "Dismiss",
|
|
1371
|
-
children: "×"
|
|
1372
|
-
}
|
|
1373
|
-
)
|
|
1374
|
-
] })
|
|
1375
|
-
}
|
|
1376
|
-
),
|
|
1377
|
-
/* @__PURE__ */ o("div", { style: { marginTop: "1.5rem", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
1378
|
-
/* @__PURE__ */ t(
|
|
1379
|
-
"button",
|
|
1380
|
-
{
|
|
1381
|
-
type: "button",
|
|
1382
|
-
className: "cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",
|
|
1383
|
-
onClick: () => M(!f),
|
|
1384
|
-
children: f ? "Hide History" : "History"
|
|
1385
|
-
}
|
|
1386
|
-
),
|
|
1387
|
-
/* @__PURE__ */ t(
|
|
1388
|
-
"button",
|
|
1389
|
-
{
|
|
1390
|
-
type: "button",
|
|
1391
|
-
className: "cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",
|
|
1392
|
-
disabled: r || !p,
|
|
1393
|
-
onClick: async () => {
|
|
1394
|
-
if (p) {
|
|
1395
|
-
g(!0), i(null);
|
|
1396
|
-
try {
|
|
1397
|
-
const u = await j(p.config);
|
|
1398
|
-
i(u);
|
|
1399
|
-
} catch (u) {
|
|
1400
|
-
i({
|
|
1401
|
-
valid: !1,
|
|
1402
|
-
errors: [u instanceof Error ? u.message : "Validation failed"],
|
|
1403
|
-
warnings: []
|
|
1404
|
-
});
|
|
1405
|
-
} finally {
|
|
1406
|
-
g(!1);
|
|
1407
|
-
}
|
|
1408
|
-
}
|
|
1409
|
-
},
|
|
1410
|
-
children: r ? "Validating..." : "Validate"
|
|
1411
|
-
}
|
|
1412
|
-
)
|
|
1413
|
-
] })
|
|
1414
|
-
] });
|
|
1415
|
-
}
|
|
1416
|
-
export {
|
|
1417
|
-
he as S
|
|
1418
|
-
};
|