@cedros/login-react 0.0.42 → 0.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +216 -0
  2. package/dist/{AuthenticationSettings-JxHsBst9.cjs → AuthenticationSettings-BlYOmaEG.cjs} +1 -1
  3. package/dist/{AuthenticationSettings-JxHsBst9.cjs.map → AuthenticationSettings-BlYOmaEG.cjs.map} +1 -1
  4. package/dist/{AuthenticationSettings-DwSxgjbH.js → AuthenticationSettings-BsuwWKbT.js} +1 -1
  5. package/dist/{AuthenticationSettings-DwSxgjbH.js.map → AuthenticationSettings-BsuwWKbT.js.map} +1 -1
  6. package/dist/{AuthenticationSettings-CheE3j7w.js → AuthenticationSettings-DrHqtD7p.js} +1 -1
  7. package/dist/{AuthenticationSettings-CheE3j7w.js.map → AuthenticationSettings-DrHqtD7p.js.map} +1 -1
  8. package/dist/{AuthenticationSettings-Dl41GbJL.cjs → AuthenticationSettings-bNQiNQ9g.cjs} +1 -1
  9. package/dist/{AuthenticationSettings-Dl41GbJL.cjs.map → AuthenticationSettings-bNQiNQ9g.cjs.map} +1 -1
  10. package/dist/{AutosaveStatus-BMXjH1XN.cjs → AutosaveStatus-CZSwtgrL.cjs} +1 -1
  11. package/dist/AutosaveStatus-CZSwtgrL.cjs.map +1 -0
  12. package/dist/{AutosaveStatus-DNuCl59W.js → AutosaveStatus-D-roPsRx.js} +331 -296
  13. package/dist/AutosaveStatus-D-roPsRx.js.map +1 -0
  14. package/dist/{CreditSystemSettings-LvA8rb17.cjs → CreditSystemSettings-3R6crxvW.cjs} +1 -1
  15. package/dist/{CreditSystemSettings-LvA8rb17.cjs.map → CreditSystemSettings-3R6crxvW.cjs.map} +1 -1
  16. package/dist/{CreditSystemSettings-HSdF2_CY.js → CreditSystemSettings-BTqZFn4K.js} +1 -1
  17. package/dist/{CreditSystemSettings-HSdF2_CY.js.map → CreditSystemSettings-BTqZFn4K.js.map} +1 -1
  18. package/dist/{CreditSystemSettings-BVgl6uUg.cjs → CreditSystemSettings-BskW_NKx.cjs} +1 -1
  19. package/dist/{CreditSystemSettings-BVgl6uUg.cjs.map → CreditSystemSettings-BskW_NKx.cjs.map} +1 -1
  20. package/dist/{CreditSystemSettings-C-ksysSx.js → CreditSystemSettings-SL45GRH3.js} +1 -1
  21. package/dist/{CreditSystemSettings-C-ksysSx.js.map → CreditSystemSettings-SL45GRH3.js.map} +1 -1
  22. package/dist/{EmailSettings-hIhJzux0.js → EmailSettings-BUAQji4I.js} +1 -1
  23. package/dist/{EmailSettings-hIhJzux0.js.map → EmailSettings-BUAQji4I.js.map} +1 -1
  24. package/dist/{EmailSettings-DC_zT4nI.cjs → EmailSettings-CEC1rhrm.cjs} +1 -1
  25. package/dist/{EmailSettings-DC_zT4nI.cjs.map → EmailSettings-CEC1rhrm.cjs.map} +1 -1
  26. package/dist/{EmailSettings-QBMzpbxv.cjs → EmailSettings-CihElRkc.cjs} +1 -1
  27. package/dist/{EmailSettings-QBMzpbxv.cjs.map → EmailSettings-CihElRkc.cjs.map} +1 -1
  28. package/dist/{EmailSettings-Cy1cuVUq.js → EmailSettings-XETM8FdS.js} +1 -1
  29. package/dist/{EmailSettings-Cy1cuVUq.js.map → EmailSettings-XETM8FdS.js.map} +1 -1
  30. package/dist/{EmbeddedWalletSettings-CvvTnRvt.js → EmbeddedWalletSettings-B-083zu6.js} +1 -1
  31. package/dist/{EmbeddedWalletSettings-CvvTnRvt.js.map → EmbeddedWalletSettings-B-083zu6.js.map} +1 -1
  32. package/dist/{EmbeddedWalletSettings-Cwiug0vR.js → EmbeddedWalletSettings-CCT9DwmL.js} +1 -1
  33. package/dist/{EmbeddedWalletSettings-Cwiug0vR.js.map → EmbeddedWalletSettings-CCT9DwmL.js.map} +1 -1
  34. package/dist/{EmbeddedWalletSettings-C81QQMWz.cjs → EmbeddedWalletSettings-DXIjansC.cjs} +1 -1
  35. package/dist/{EmbeddedWalletSettings-C81QQMWz.cjs.map → EmbeddedWalletSettings-DXIjansC.cjs.map} +1 -1
  36. package/dist/{EmbeddedWalletSettings-4qC9KBwh.cjs → EmbeddedWalletSettings-MtwR81WH.cjs} +1 -1
  37. package/dist/{EmbeddedWalletSettings-4qC9KBwh.cjs.map → EmbeddedWalletSettings-MtwR81WH.cjs.map} +1 -1
  38. package/dist/{PermissionsSection-CSB_Ikj9.cjs → PermissionsSection-4zcE9Zs9.cjs} +1 -1
  39. package/dist/PermissionsSection-4zcE9Zs9.cjs.map +1 -0
  40. package/dist/{PermissionsSection-BDDiEfho.js → PermissionsSection-mm9hfp-u.js} +94 -74
  41. package/dist/PermissionsSection-mm9hfp-u.js.map +1 -0
  42. package/dist/{ServerSettings-DPqHtsgV.js → ServerSettings-24DA_BOI.js} +1 -1
  43. package/dist/{ServerSettings-DPqHtsgV.js.map → ServerSettings-24DA_BOI.js.map} +1 -1
  44. package/dist/{ServerSettings-BV0SipW1.cjs → ServerSettings-BNc4LEs4.cjs} +1 -1
  45. package/dist/{ServerSettings-BV0SipW1.cjs.map → ServerSettings-BNc4LEs4.cjs.map} +1 -1
  46. package/dist/{ServerSettings-Bf7gFE8r.cjs → ServerSettings-BTEuzdrf.cjs} +1 -1
  47. package/dist/{ServerSettings-Bf7gFE8r.cjs.map → ServerSettings-BTEuzdrf.cjs.map} +1 -1
  48. package/dist/{ServerSettings-Sfr0CG6K.js → ServerSettings-DBpbRihl.js} +1 -1
  49. package/dist/{ServerSettings-Sfr0CG6K.js.map → ServerSettings-DBpbRihl.js.map} +1 -1
  50. package/dist/{TeamSection-BhsBEckR.js → TeamSection-C_eODdLU.js} +1 -1
  51. package/dist/{TeamSection-BhsBEckR.js.map → TeamSection-C_eODdLU.js.map} +1 -1
  52. package/dist/{TeamSection-DLxtRmta.cjs → TeamSection-Km7EwLWD.cjs} +1 -1
  53. package/dist/{TeamSection-DLxtRmta.cjs.map → TeamSection-Km7EwLWD.cjs.map} +1 -1
  54. package/dist/{UsersSection-BEKfbhQ4.cjs → UsersSection-C1Tt0ePx.cjs} +1 -1
  55. package/dist/{UsersSection-BEKfbhQ4.cjs.map → UsersSection-C1Tt0ePx.cjs.map} +1 -1
  56. package/dist/{UsersSection-DbGkmxty.js → UsersSection-Ct_E-MBF.js} +1 -1
  57. package/dist/{UsersSection-DbGkmxty.js.map → UsersSection-Ct_E-MBF.js.map} +1 -1
  58. package/dist/{WebhookSettings-CMROMCFT.js → WebhookSettings-BhIwucKb.js} +1 -1
  59. package/dist/{WebhookSettings-CMROMCFT.js.map → WebhookSettings-BhIwucKb.js.map} +1 -1
  60. package/dist/{WebhookSettings-BPCKv5Or.cjs → WebhookSettings-C6X_JJcD.cjs} +1 -1
  61. package/dist/{WebhookSettings-BPCKv5Or.cjs.map → WebhookSettings-C6X_JJcD.cjs.map} +1 -1
  62. package/dist/{WebhookSettings-D4mKAWAg.js → WebhookSettings-D9IsXZJN.js} +1 -1
  63. package/dist/{WebhookSettings-D4mKAWAg.js.map → WebhookSettings-D9IsXZJN.js.map} +1 -1
  64. package/dist/{WebhookSettings-Cj-iELGa.cjs → WebhookSettings-H1x6IKOj.cjs} +1 -1
  65. package/dist/{WebhookSettings-Cj-iELGa.cjs.map → WebhookSettings-H1x6IKOj.cjs.map} +1 -1
  66. package/dist/admin-only.cjs +1 -1
  67. package/dist/admin-only.js +1 -1
  68. package/dist/index.cjs +12 -12
  69. package/dist/index.cjs.map +1 -1
  70. package/dist/index.d.ts +217 -22
  71. package/dist/index.js +7551 -6310
  72. package/dist/index.js.map +1 -1
  73. package/dist/{plugin-BHGg7ius.cjs → plugin-BwwJh2cY.cjs} +1 -1
  74. package/dist/{plugin-BHGg7ius.cjs.map → plugin-BwwJh2cY.cjs.map} +1 -1
  75. package/dist/{plugin-CK2d7aP5.js → plugin-CetHtdLq.js} +1 -1
  76. package/dist/{plugin-CK2d7aP5.js.map → plugin-CetHtdLq.js.map} +1 -1
  77. package/dist/useUsersStatsSummary-BGeh3RnI.js +2025 -0
  78. package/dist/useUsersStatsSummary-BGeh3RnI.js.map +1 -0
  79. package/dist/useUsersStatsSummary-DnsYtFGX.cjs +1 -0
  80. package/dist/useUsersStatsSummary-DnsYtFGX.cjs.map +1 -0
  81. package/package.json +1 -1
  82. package/dist/AutosaveStatus-BMXjH1XN.cjs.map +0 -1
  83. package/dist/AutosaveStatus-DNuCl59W.js.map +0 -1
  84. package/dist/PermissionsSection-BDDiEfho.js.map +0 -1
  85. package/dist/PermissionsSection-CSB_Ikj9.cjs.map +0 -1
  86. package/dist/useUsersStatsSummary-9HQDKBU5.js +0 -1879
  87. package/dist/useUsersStatsSummary-9HQDKBU5.js.map +0 -1
  88. package/dist/useUsersStatsSummary-DiRC8sGs.cjs +0 -1
  89. package/dist/useUsersStatsSummary-DiRC8sGs.cjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { jsx as e, jsxs as d, Fragment as T } from "react/jsx-runtime";
1
+ import { jsxs as d, jsx as e, Fragment as T } from "react/jsx-runtime";
2
2
  import { useMemo as N, useCallback as m, useState as f, useRef as P, useEffect as I } from "react";
3
3
  import { u as U } from "./useCedrosLogin-CFfID-0i.js";
4
4
  import { u as O } from "./useSystemSettings-rgskaDqP.js";
@@ -1308,6 +1308,36 @@ const W = {
1308
1308
  inputType: "text",
1309
1309
  unit: "USD",
1310
1310
  placeholder: "1000000"
1311
+ },
1312
+ // ============= Token Gating =============
1313
+ token_gating_enabled: {
1314
+ key: "token_gating_enabled",
1315
+ label: "Enable Token Gating",
1316
+ description: "Require Solana wallet holdings for access.",
1317
+ inputType: "boolean"
1318
+ },
1319
+ token_gating_rpc_url: {
1320
+ key: "token_gating_rpc_url",
1321
+ label: "Solana RPC/DAS URL",
1322
+ description: "RPC endpoint that supports DAS API for NFT queries.",
1323
+ inputType: "secret",
1324
+ placeholder: "https://mainnet.helius-rpc.com/?api-key=..."
1325
+ },
1326
+ token_gating_rules: {
1327
+ key: "token_gating_rules",
1328
+ label: "Token Gate Rules",
1329
+ description: "JSON array of gate rules. Managed via admin API.",
1330
+ inputType: "text",
1331
+ multiline: !0,
1332
+ placeholder: "[]"
1333
+ },
1334
+ token_gating_cache_ttl_secs: {
1335
+ key: "token_gating_cache_ttl_secs",
1336
+ label: "Cache TTL",
1337
+ description: "How long to cache wallet holdings (seconds).",
1338
+ inputType: "text",
1339
+ unit: "seconds",
1340
+ placeholder: "60"
1311
1341
  }
1312
1342
  }, ae = {
1313
1343
  // Auth providers (sorted alphabetically by subcategory)
@@ -1391,11 +1421,6 @@ const W = {
1391
1421
  description: "Control the privacy period for deposits. Longer periods provide better timing privacy but delay fund availability.",
1392
1422
  icon: ""
1393
1423
  },
1394
- referral: {
1395
- label: "Referral & Payouts",
1396
- description: "Configure referral rewards, payout triggers, and the automated payout worker.",
1397
- icon: ""
1398
- },
1399
1424
  rate_limit: {
1400
1425
  label: "Rate Limiting",
1401
1426
  description: "Protect the system from abuse by limiting request rates. Balance security with user experience.",
@@ -1440,8 +1465,18 @@ const W = {
1440
1465
  label: "Accredited Investor Verification",
1441
1466
  description: "Configure accredited investor verification requirements and thresholds per SEC Regulation D.",
1442
1467
  icon: ""
1468
+ },
1469
+ token_gating: {
1470
+ label: "Token Gating",
1471
+ description: "Configure Solana wallet holdings requirements for gated access.",
1472
+ icon: ""
1473
+ },
1474
+ referral: {
1475
+ label: "Referrals & Rewards",
1476
+ description: "Configure referral reward types, amounts, triggers, caps, and payout worker settings.",
1477
+ icon: ""
1443
1478
  }
1444
- }, R = [
1479
+ }, L = [
1445
1480
  "SOL",
1446
1481
  "USDC",
1447
1482
  "USDT",
@@ -1453,7 +1488,265 @@ const W = {
1453
1488
  "BONK",
1454
1489
  "ORE"
1455
1490
  ];
1456
- function A(t) {
1491
+ function j({ value: t, onChange: i, multiline: a }) {
1492
+ const [n, r] = f(!1), [s, p] = f(!1), l = t && t.length > 0, o = m(() => {
1493
+ r(!0), p(!0);
1494
+ }, []), c = m(() => {
1495
+ r(!1), p(!1);
1496
+ }, []), y = m(
1497
+ (b) => {
1498
+ i(b.target.value);
1499
+ },
1500
+ [i]
1501
+ );
1502
+ return !n && l ? /* @__PURE__ */ d("div", { className: "cedros-secret-input cedros-secret-input-masked", children: [
1503
+ /* @__PURE__ */ e("span", { className: "cedros-secret-masked", children: "•".repeat(Math.min(t.length, 20)) }),
1504
+ /* @__PURE__ */ e("button", { type: "button", className: "cedros-secret-edit-btn", onClick: o, children: "Edit" })
1505
+ ] }) : /* @__PURE__ */ d("div", { className: "cedros-secret-input", children: [
1506
+ a ? /* @__PURE__ */ e(
1507
+ "textarea",
1508
+ {
1509
+ value: t,
1510
+ onChange: y,
1511
+ className: "cedros-setting-input cedros-setting-textarea",
1512
+ placeholder: "Enter secret value...",
1513
+ rows: 4
1514
+ }
1515
+ ) : /* @__PURE__ */ e(
1516
+ "input",
1517
+ {
1518
+ type: s ? "text" : "password",
1519
+ value: t,
1520
+ onChange: y,
1521
+ className: "cedros-setting-input",
1522
+ placeholder: "Enter secret value..."
1523
+ }
1524
+ ),
1525
+ /* @__PURE__ */ d("div", { className: "cedros-secret-actions", children: [
1526
+ !a && /* @__PURE__ */ e(
1527
+ "button",
1528
+ {
1529
+ type: "button",
1530
+ className: "cedros-secret-toggle-btn",
1531
+ onClick: () => p(!s),
1532
+ children: s ? "Hide" : "Show"
1533
+ }
1534
+ ),
1535
+ n && /* @__PURE__ */ e("button", { type: "button", className: "cedros-secret-done-btn", onClick: c, children: "Done" })
1536
+ ] })
1537
+ ] });
1538
+ }
1539
+ function F({ settingKey: t, value: i }) {
1540
+ const [a, n] = f(null), [r, s] = f(!1), [p, l] = f(!1), [o, c] = f(null), [y, b] = f(!1), { config: _, _internal: w } = U(), g = a ?? i, x = g && g.length > 0, C = x && !a, h = m(async () => {
1541
+ if (g)
1542
+ try {
1543
+ await navigator.clipboard.writeText(g), s(!0), setTimeout(() => s(!1), 2e3);
1544
+ } catch {
1545
+ const u = document.createElement("textarea");
1546
+ u.value = g, document.body.appendChild(u), u.select(), document.execCommand("copy"), document.body.removeChild(u), s(!0), setTimeout(() => s(!1), 2e3);
1547
+ }
1548
+ }, [g]), k = m(async () => {
1549
+ l(!0), c(null);
1550
+ try {
1551
+ const u = w?.getAccessToken?.(), v = { "Content-Type": "application/json" };
1552
+ u && (v.Authorization = `Bearer ${u}`);
1553
+ const S = await fetch(
1554
+ `${_.serverUrl}/auth/admin/settings/regenerate/${t}`,
1555
+ { method: "POST", headers: v, credentials: "include" }
1556
+ );
1557
+ if (!S.ok) {
1558
+ const A = await S.json().catch(() => null);
1559
+ throw new Error(A?.message || A?.error || `Regenerate failed (${S.status})`);
1560
+ }
1561
+ const E = await S.json();
1562
+ n(E.value), b(!1);
1563
+ } catch (u) {
1564
+ c(u instanceof Error ? u.message : "Failed to regenerate");
1565
+ } finally {
1566
+ l(!1);
1567
+ }
1568
+ }, [_.serverUrl, w, t]);
1569
+ return /* @__PURE__ */ d("div", { className: "cedros-readonly-secret", children: [
1570
+ /* @__PURE__ */ e("div", { className: "cedros-readonly-secret-value", children: C ? /* @__PURE__ */ e("span", { className: "cedros-secret-masked", children: "•".repeat(20) }) : x ? /* @__PURE__ */ e("code", { className: "cedros-readonly-secret-code", children: g }) : /* @__PURE__ */ e("span", { className: "cedros-readonly-secret-empty", children: "Not generated yet" }) }),
1571
+ /* @__PURE__ */ d("div", { className: "cedros-readonly-secret-actions", children: [
1572
+ x && /* @__PURE__ */ e("button", { type: "button", className: "cedros-secret-action-btn", onClick: h, children: r ? "Copied!" : "Copy" }),
1573
+ y ? /* @__PURE__ */ d("span", { className: "cedros-readonly-secret-confirm", children: [
1574
+ /* @__PURE__ */ e("span", { className: "cedros-readonly-secret-confirm-text", children: "Update deploy secret too?" }),
1575
+ /* @__PURE__ */ e(
1576
+ "button",
1577
+ {
1578
+ type: "button",
1579
+ className: "cedros-secret-action-btn cedros-secret-action-btn--danger",
1580
+ onClick: k,
1581
+ disabled: p,
1582
+ children: p ? "Regenerating..." : "Confirm"
1583
+ }
1584
+ ),
1585
+ /* @__PURE__ */ e(
1586
+ "button",
1587
+ {
1588
+ type: "button",
1589
+ className: "cedros-secret-action-btn",
1590
+ onClick: () => b(!1),
1591
+ disabled: p,
1592
+ children: "Cancel"
1593
+ }
1594
+ )
1595
+ ] }) : /* @__PURE__ */ e(
1596
+ "button",
1597
+ {
1598
+ type: "button",
1599
+ className: "cedros-secret-action-btn cedros-secret-action-btn--danger",
1600
+ onClick: () => b(!0),
1601
+ disabled: p,
1602
+ children: "Regenerate"
1603
+ }
1604
+ )
1605
+ ] }),
1606
+ o && /* @__PURE__ */ e("p", { className: "cedros-readonly-secret-error", children: o })
1607
+ ] });
1608
+ }
1609
+ function $({ value: t, onChange: i }) {
1610
+ const a = N(() => {
1611
+ try {
1612
+ return JSON.parse(t || "[]");
1613
+ } catch {
1614
+ return [];
1615
+ }
1616
+ }, [t]), n = m(
1617
+ (l) => {
1618
+ i(JSON.stringify(l));
1619
+ },
1620
+ [i]
1621
+ ), r = m(() => {
1622
+ n([...a, { symbol: "", mint: "", decimals: 6 }]);
1623
+ }, [a, n]), s = m(
1624
+ (l, o, c) => {
1625
+ const y = [...a];
1626
+ y[l] = { ...y[l], [o]: c }, n(y);
1627
+ },
1628
+ [a, n]
1629
+ ), p = m(
1630
+ (l) => {
1631
+ n(a.filter((o, c) => c !== l));
1632
+ },
1633
+ [a, n]
1634
+ );
1635
+ return /* @__PURE__ */ d("div", { className: "cedros-token-list-input", children: [
1636
+ /* @__PURE__ */ d("div", { className: "cedros-token-presets", children: [
1637
+ /* @__PURE__ */ e("span", { className: "cedros-token-presets-label", children: "Built-in tokens:" }),
1638
+ /* @__PURE__ */ e("div", { className: "cedros-token-presets-list", children: L.map((l) => /* @__PURE__ */ e("span", { className: "cedros-token-preset-chip", children: l }, l)) })
1639
+ ] }),
1640
+ a.length === 0 && /* @__PURE__ */ e("p", { className: "cedros-token-list-empty", children: "No custom tokens added. Use the built-in tokens above or add your own." }),
1641
+ a.map((l, o) => /* @__PURE__ */ d("div", { className: "cedros-token-row", children: [
1642
+ /* @__PURE__ */ d("div", { className: "cedros-token-row-fields", children: [
1643
+ /* @__PURE__ */ e(
1644
+ "input",
1645
+ {
1646
+ type: "text",
1647
+ placeholder: "Symbol",
1648
+ value: l.symbol,
1649
+ onChange: (c) => s(o, "symbol", c.target.value.toUpperCase()),
1650
+ className: "cedros-setting-input cedros-token-input-symbol",
1651
+ maxLength: 10
1652
+ }
1653
+ ),
1654
+ /* @__PURE__ */ e(
1655
+ "input",
1656
+ {
1657
+ type: "text",
1658
+ placeholder: "Mint address",
1659
+ value: l.mint,
1660
+ onChange: (c) => s(o, "mint", c.target.value),
1661
+ className: "cedros-setting-input cedros-token-input-mint"
1662
+ }
1663
+ ),
1664
+ /* @__PURE__ */ e(
1665
+ "input",
1666
+ {
1667
+ type: "number",
1668
+ placeholder: "Decimals",
1669
+ value: l.decimals,
1670
+ onChange: (c) => s(o, "decimals", parseInt(c.target.value, 10) || 0),
1671
+ className: "cedros-setting-input cedros-token-input-decimals",
1672
+ min: 0,
1673
+ max: 18
1674
+ }
1675
+ ),
1676
+ /* @__PURE__ */ e(
1677
+ "input",
1678
+ {
1679
+ type: "text",
1680
+ placeholder: "Logo URL (optional)",
1681
+ value: l.logoUrl || "",
1682
+ onChange: (c) => s(o, "logoUrl", c.target.value || void 0),
1683
+ className: "cedros-setting-input cedros-token-input-logo"
1684
+ }
1685
+ )
1686
+ ] }),
1687
+ /* @__PURE__ */ e(
1688
+ "button",
1689
+ {
1690
+ type: "button",
1691
+ className: "cedros-token-remove-btn",
1692
+ onClick: () => p(o),
1693
+ title: "Remove token",
1694
+ children: "×"
1695
+ }
1696
+ )
1697
+ ] }, o)),
1698
+ /* @__PURE__ */ e("button", { type: "button", className: "cedros-token-add-btn", onClick: r, children: "+ Add Token" })
1699
+ ] });
1700
+ }
1701
+ function V({ value: t, onChange: i }) {
1702
+ const a = N(() => t.split(",").map((s) => s.trim()).filter(Boolean), [t]), n = m(
1703
+ (s) => {
1704
+ if (!s || a.includes(s)) return;
1705
+ const p = [...a, s].join(", ");
1706
+ i(p);
1707
+ },
1708
+ [a, i]
1709
+ ), r = m(
1710
+ (s) => {
1711
+ const p = a.filter((l) => l !== s).join(", ");
1712
+ i(p);
1713
+ },
1714
+ [a, i]
1715
+ );
1716
+ return /* @__PURE__ */ d("div", { className: "cedros-token-symbol-list-input", children: [
1717
+ /* @__PURE__ */ d("div", { className: "cedros-token-presets", children: [
1718
+ /* @__PURE__ */ e("span", { className: "cedros-token-presets-label", children: "Click to add:" }),
1719
+ /* @__PURE__ */ e("div", { className: "cedros-token-presets-list", children: L.map((s) => {
1720
+ const p = a.includes(s);
1721
+ return /* @__PURE__ */ d(
1722
+ "button",
1723
+ {
1724
+ type: "button",
1725
+ className: `cedros-token-preset-chip ${p ? "cedros-token-preset-chip-selected" : ""}`,
1726
+ onClick: () => p ? r(s) : n(s),
1727
+ title: p ? `Remove ${s}` : `Add ${s}`,
1728
+ children: [
1729
+ s,
1730
+ p && /* @__PURE__ */ e("span", { className: "cedros-token-chip-check", children: "✓" })
1731
+ ]
1732
+ },
1733
+ s
1734
+ );
1735
+ }) })
1736
+ ] }),
1737
+ /* @__PURE__ */ e(
1738
+ "input",
1739
+ {
1740
+ type: "text",
1741
+ value: t,
1742
+ onChange: (s) => i(s.target.value),
1743
+ className: "cedros-setting-input",
1744
+ placeholder: "USDC, SOL, BONK..."
1745
+ }
1746
+ )
1747
+ ] });
1748
+ }
1749
+ function D(t) {
1457
1750
  const i = t.split(/(<a\s[^>]*>.*?<\/a>)/g);
1458
1751
  return i.length === 1 ? t : i.map((a, n) => {
1459
1752
  const r = a.match(/^<a\s+href="([^"]+)"[^>]*>([^<]+)<\/a>$/);
@@ -1467,7 +1760,7 @@ function ie({
1467
1760
  externalWarnings: n
1468
1761
  }) {
1469
1762
  return /* @__PURE__ */ e("div", { className: "cedros-settings-grid", children: t.map((r) => /* @__PURE__ */ e(
1470
- j,
1763
+ B,
1471
1764
  {
1472
1765
  setting: r,
1473
1766
  editValue: i[r.key],
@@ -1477,7 +1770,7 @@ function ie({
1477
1770
  r.key
1478
1771
  )) });
1479
1772
  }
1480
- function j({ setting: t, editValue: i, onChange: a, externalWarning: n }) {
1773
+ function B({ setting: t, editValue: i, onChange: a, externalWarning: n }) {
1481
1774
  const r = W[t.key], s = i ?? t.value, p = i !== void 0 && i !== t.value, l = r?.inputType === "boolean", o = N(() => {
1482
1775
  if (n) return n;
1483
1776
  if (!r?.warningThreshold) return null;
@@ -1493,7 +1786,7 @@ function j({ setting: t, editValue: i, onChange: a, externalWarning: n }) {
1493
1786
  children: l ? /* @__PURE__ */ d(T, { children: [
1494
1787
  /* @__PURE__ */ d("div", { className: "cedros-setting-control cedros-setting-control-toggle", children: [
1495
1788
  /* @__PURE__ */ e(
1496
- L,
1789
+ R,
1497
1790
  {
1498
1791
  meta: r,
1499
1792
  value: s,
@@ -1504,16 +1797,16 @@ function j({ setting: t, editValue: i, onChange: a, externalWarning: n }) {
1504
1797
  ] }),
1505
1798
  /* @__PURE__ */ d("div", { className: "cedros-setting-label", children: [
1506
1799
  /* @__PURE__ */ e("span", { className: "cedros-setting-name", children: r.label }),
1507
- /* @__PURE__ */ e("span", { className: "cedros-setting-description", children: A(r.description) })
1800
+ /* @__PURE__ */ e("span", { className: "cedros-setting-description", children: D(r.description) })
1508
1801
  ] })
1509
1802
  ] }) : /* @__PURE__ */ d(T, { children: [
1510
1803
  /* @__PURE__ */ d("div", { className: "cedros-setting-label", children: [
1511
1804
  /* @__PURE__ */ e("span", { className: "cedros-setting-name", children: r.label }),
1512
- /* @__PURE__ */ e("span", { className: "cedros-setting-description", children: A(r.description) })
1805
+ /* @__PURE__ */ e("span", { className: "cedros-setting-description", children: D(r.description) })
1513
1806
  ] }),
1514
1807
  /* @__PURE__ */ d("div", { className: "cedros-setting-control", children: [
1515
1808
  /* @__PURE__ */ e(
1516
- L,
1809
+ R,
1517
1810
  {
1518
1811
  meta: r,
1519
1812
  value: s,
@@ -1540,13 +1833,13 @@ function j({ setting: t, editValue: i, onChange: a, externalWarning: n }) {
1540
1833
  ) })
1541
1834
  ] });
1542
1835
  }
1543
- function L({ meta: t, value: i, onChange: a }) {
1836
+ function R({ meta: t, value: i, onChange: a }) {
1544
1837
  switch (t.inputType) {
1545
1838
  case "duration":
1546
- return /* @__PURE__ */ e(F, { value: i, onChange: a, presets: t.presets, min: t.min });
1839
+ return /* @__PURE__ */ e(H, { value: i, onChange: a, presets: t.presets, min: t.min });
1547
1840
  case "percentage":
1548
1841
  return /* @__PURE__ */ e(
1549
- $,
1842
+ G,
1550
1843
  {
1551
1844
  value: i,
1552
1845
  onChange: a,
@@ -1558,7 +1851,7 @@ function L({ meta: t, value: i, onChange: a }) {
1558
1851
  );
1559
1852
  case "select":
1560
1853
  return /* @__PURE__ */ e(
1561
- V,
1854
+ K,
1562
1855
  {
1563
1856
  value: i,
1564
1857
  onChange: a,
@@ -1568,7 +1861,7 @@ function L({ meta: t, value: i, onChange: a }) {
1568
1861
  );
1569
1862
  case "number":
1570
1863
  return /* @__PURE__ */ e(
1571
- B,
1864
+ J,
1572
1865
  {
1573
1866
  value: i,
1574
1867
  onChange: a,
@@ -1578,7 +1871,7 @@ function L({ meta: t, value: i, onChange: a }) {
1578
1871
  }
1579
1872
  );
1580
1873
  case "tokenList":
1581
- return /* @__PURE__ */ e(J, { value: i, onChange: a });
1874
+ return /* @__PURE__ */ e($, { value: i, onChange: a });
1582
1875
  case "text":
1583
1876
  return /* @__PURE__ */ e(
1584
1877
  "input",
@@ -1591,13 +1884,13 @@ function L({ meta: t, value: i, onChange: a }) {
1591
1884
  }
1592
1885
  );
1593
1886
  case "boolean":
1594
- return /* @__PURE__ */ e(H, { value: i, onChange: a });
1887
+ return /* @__PURE__ */ e(z, { value: i, onChange: a });
1595
1888
  case "secret":
1596
- return /* @__PURE__ */ e(K, { value: i, onChange: a, multiline: t.multiline });
1889
+ return /* @__PURE__ */ e(j, { value: i, onChange: a, multiline: t.multiline });
1597
1890
  case "readonlySecret":
1598
- return /* @__PURE__ */ e(G, { settingKey: t.key, value: i });
1891
+ return /* @__PURE__ */ e(F, { settingKey: t.key, value: i });
1599
1892
  case "tokenSymbolList":
1600
- return /* @__PURE__ */ e(z, { value: i, onChange: a });
1893
+ return /* @__PURE__ */ e(V, { value: i, onChange: a });
1601
1894
  default:
1602
1895
  return /* @__PURE__ */ e(
1603
1896
  "input",
@@ -1610,7 +1903,7 @@ function L({ meta: t, value: i, onChange: a }) {
1610
1903
  );
1611
1904
  }
1612
1905
  }
1613
- function F({ value: t, onChange: i, presets: a, min: n = 0 }) {
1906
+ function H({ value: t, onChange: i, presets: a, min: n = 0 }) {
1614
1907
  const r = parseInt(t, 10) || 0, s = q(r), p = m(
1615
1908
  (o) => {
1616
1909
  o.target.value && i(o.target.value);
@@ -1655,7 +1948,7 @@ function F({ value: t, onChange: i, presets: a, min: n = 0 }) {
1655
1948
  ] })
1656
1949
  ] });
1657
1950
  }
1658
- function $({
1951
+ function G({
1659
1952
  value: t,
1660
1953
  onChange: i,
1661
1954
  min: a,
@@ -1705,7 +1998,7 @@ function $({
1705
1998
  )) })
1706
1999
  ] });
1707
2000
  }
1708
- function V({ value: t, onChange: i, presets: a, unit: n }) {
2001
+ function K({ value: t, onChange: i, presets: a, unit: n }) {
1709
2002
  const r = !a.some((l) => l.value === t), s = m(
1710
2003
  (l) => {
1711
2004
  l.target.value !== "__custom__" && i(l.target.value);
@@ -1744,7 +2037,7 @@ function V({ value: t, onChange: i, presets: a, unit: n }) {
1744
2037
  ] })
1745
2038
  ] });
1746
2039
  }
1747
- function B({ value: t, onChange: i, min: a, max: n, unit: r }) {
2040
+ function J({ value: t, onChange: i, min: a, max: n, unit: r }) {
1748
2041
  const s = m(
1749
2042
  (p) => {
1750
2043
  i(p.target.value);
@@ -1766,7 +2059,7 @@ function B({ value: t, onChange: i, min: a, max: n, unit: r }) {
1766
2059
  r && /* @__PURE__ */ e("span", { className: "cedros-setting-unit", children: r })
1767
2060
  ] });
1768
2061
  }
1769
- function H({ value: t, onChange: i }) {
2062
+ function z({ value: t, onChange: i }) {
1770
2063
  const a = t === "true", n = m(() => {
1771
2064
  i(a ? "false" : "true");
1772
2065
  }, [a, i]);
@@ -1785,287 +2078,29 @@ function H({ value: t, onChange: i }) {
1785
2078
  }
1786
2079
  );
1787
2080
  }
1788
- function K({ value: t, onChange: i, multiline: a }) {
1789
- const [n, r] = f(!1), [s, p] = f(!1), l = t && t.length > 0, o = m(() => {
1790
- r(!0), p(!0);
1791
- }, []), c = m(() => {
1792
- r(!1), p(!1);
1793
- }, []), y = m(
1794
- (b) => {
1795
- i(b.target.value);
1796
- },
1797
- [i]
1798
- );
1799
- return !n && l ? /* @__PURE__ */ d("div", { className: "cedros-secret-input cedros-secret-input-masked", children: [
1800
- /* @__PURE__ */ e("span", { className: "cedros-secret-masked", children: "•".repeat(Math.min(t.length, 20)) }),
1801
- /* @__PURE__ */ e("button", { type: "button", className: "cedros-secret-edit-btn", onClick: o, children: "Edit" })
1802
- ] }) : /* @__PURE__ */ d("div", { className: "cedros-secret-input", children: [
1803
- a ? /* @__PURE__ */ e(
1804
- "textarea",
1805
- {
1806
- value: t,
1807
- onChange: y,
1808
- className: "cedros-setting-input cedros-setting-textarea",
1809
- placeholder: "Enter secret value...",
1810
- rows: 4
1811
- }
1812
- ) : /* @__PURE__ */ e(
1813
- "input",
1814
- {
1815
- type: s ? "text" : "password",
1816
- value: t,
1817
- onChange: y,
1818
- className: "cedros-setting-input",
1819
- placeholder: "Enter secret value..."
1820
- }
1821
- ),
1822
- /* @__PURE__ */ d("div", { className: "cedros-secret-actions", children: [
1823
- !a && /* @__PURE__ */ e(
1824
- "button",
1825
- {
1826
- type: "button",
1827
- className: "cedros-secret-toggle-btn",
1828
- onClick: () => p(!s),
1829
- children: s ? "Hide" : "Show"
1830
- }
1831
- ),
1832
- n && /* @__PURE__ */ e("button", { type: "button", className: "cedros-secret-done-btn", onClick: c, children: "Done" })
1833
- ] })
1834
- ] });
1835
- }
1836
- function G({ settingKey: t, value: i }) {
1837
- const [a, n] = f(null), [r, s] = f(!1), [p, l] = f(!1), [o, c] = f(null), [y, b] = f(!1), { config: _, _internal: w } = U(), v = a ?? i, x = v && v.length > 0, C = x && !a, h = m(async () => {
1838
- if (v)
1839
- try {
1840
- await navigator.clipboard.writeText(v), s(!0), setTimeout(() => s(!1), 2e3);
1841
- } catch {
1842
- const u = document.createElement("textarea");
1843
- u.value = v, document.body.appendChild(u), u.select(), document.execCommand("copy"), document.body.removeChild(u), s(!0), setTimeout(() => s(!1), 2e3);
1844
- }
1845
- }, [v]), k = m(async () => {
1846
- l(!0), c(null);
1847
- try {
1848
- const u = w?.getAccessToken?.(), g = { "Content-Type": "application/json" };
1849
- u && (g.Authorization = `Bearer ${u}`);
1850
- const S = await fetch(
1851
- `${_.serverUrl}/auth/admin/settings/regenerate/${t}`,
1852
- { method: "POST", headers: g, credentials: "include" }
1853
- );
1854
- if (!S.ok) {
1855
- const D = await S.json().catch(() => null);
1856
- throw new Error(D?.message || D?.error || `Regenerate failed (${S.status})`);
1857
- }
1858
- const E = await S.json();
1859
- n(E.value), b(!1);
1860
- } catch (u) {
1861
- c(u instanceof Error ? u.message : "Failed to regenerate");
1862
- } finally {
1863
- l(!1);
1864
- }
1865
- }, [_.serverUrl, w, t]);
1866
- return /* @__PURE__ */ d("div", { className: "cedros-readonly-secret", children: [
1867
- /* @__PURE__ */ e("div", { className: "cedros-readonly-secret-value", children: C ? /* @__PURE__ */ e("span", { className: "cedros-secret-masked", children: "•".repeat(20) }) : x ? /* @__PURE__ */ e("code", { className: "cedros-readonly-secret-code", children: v }) : /* @__PURE__ */ e("span", { className: "cedros-readonly-secret-empty", children: "Not generated yet" }) }),
1868
- /* @__PURE__ */ d("div", { className: "cedros-readonly-secret-actions", children: [
1869
- x && /* @__PURE__ */ e("button", { type: "button", className: "cedros-secret-action-btn", onClick: h, children: r ? "Copied!" : "Copy" }),
1870
- y ? /* @__PURE__ */ d("span", { className: "cedros-readonly-secret-confirm", children: [
1871
- /* @__PURE__ */ e("span", { className: "cedros-readonly-secret-confirm-text", children: "Update deploy secret too?" }),
1872
- /* @__PURE__ */ e(
1873
- "button",
1874
- {
1875
- type: "button",
1876
- className: "cedros-secret-action-btn cedros-secret-action-btn--danger",
1877
- onClick: k,
1878
- disabled: p,
1879
- children: p ? "Regenerating..." : "Confirm"
1880
- }
1881
- ),
1882
- /* @__PURE__ */ e(
1883
- "button",
1884
- {
1885
- type: "button",
1886
- className: "cedros-secret-action-btn",
1887
- onClick: () => b(!1),
1888
- disabled: p,
1889
- children: "Cancel"
1890
- }
1891
- )
1892
- ] }) : /* @__PURE__ */ e(
1893
- "button",
1894
- {
1895
- type: "button",
1896
- className: "cedros-secret-action-btn cedros-secret-action-btn--danger",
1897
- onClick: () => b(!0),
1898
- disabled: p,
1899
- children: "Regenerate"
1900
- }
1901
- )
1902
- ] }),
1903
- o && /* @__PURE__ */ e("p", { className: "cedros-readonly-secret-error", children: o })
1904
- ] });
1905
- }
1906
- function J({ value: t, onChange: i }) {
1907
- const a = N(() => {
1908
- try {
1909
- return JSON.parse(t || "[]");
1910
- } catch {
1911
- return [];
1912
- }
1913
- }, [t]), n = m(
1914
- (l) => {
1915
- i(JSON.stringify(l));
1916
- },
1917
- [i]
1918
- ), r = m(() => {
1919
- n([...a, { symbol: "", mint: "", decimals: 6 }]);
1920
- }, [a, n]), s = m(
1921
- (l, o, c) => {
1922
- const y = [...a];
1923
- y[l] = { ...y[l], [o]: c }, n(y);
1924
- },
1925
- [a, n]
1926
- ), p = m(
1927
- (l) => {
1928
- n(a.filter((o, c) => c !== l));
1929
- },
1930
- [a, n]
1931
- );
1932
- return /* @__PURE__ */ d("div", { className: "cedros-token-list-input", children: [
1933
- /* @__PURE__ */ d("div", { className: "cedros-token-presets", children: [
1934
- /* @__PURE__ */ e("span", { className: "cedros-token-presets-label", children: "Built-in tokens:" }),
1935
- /* @__PURE__ */ e("div", { className: "cedros-token-presets-list", children: R.map((l) => /* @__PURE__ */ e("span", { className: "cedros-token-preset-chip", children: l }, l)) })
1936
- ] }),
1937
- a.length === 0 && /* @__PURE__ */ e("p", { className: "cedros-token-list-empty", children: "No custom tokens added. Use the built-in tokens above or add your own." }),
1938
- a.map((l, o) => /* @__PURE__ */ d("div", { className: "cedros-token-row", children: [
1939
- /* @__PURE__ */ d("div", { className: "cedros-token-row-fields", children: [
1940
- /* @__PURE__ */ e(
1941
- "input",
1942
- {
1943
- type: "text",
1944
- placeholder: "Symbol",
1945
- value: l.symbol,
1946
- onChange: (c) => s(o, "symbol", c.target.value.toUpperCase()),
1947
- className: "cedros-setting-input cedros-token-input-symbol",
1948
- maxLength: 10
1949
- }
1950
- ),
1951
- /* @__PURE__ */ e(
1952
- "input",
1953
- {
1954
- type: "text",
1955
- placeholder: "Mint address",
1956
- value: l.mint,
1957
- onChange: (c) => s(o, "mint", c.target.value),
1958
- className: "cedros-setting-input cedros-token-input-mint"
1959
- }
1960
- ),
1961
- /* @__PURE__ */ e(
1962
- "input",
1963
- {
1964
- type: "number",
1965
- placeholder: "Decimals",
1966
- value: l.decimals,
1967
- onChange: (c) => s(o, "decimals", parseInt(c.target.value, 10) || 0),
1968
- className: "cedros-setting-input cedros-token-input-decimals",
1969
- min: 0,
1970
- max: 18
1971
- }
1972
- ),
1973
- /* @__PURE__ */ e(
1974
- "input",
1975
- {
1976
- type: "text",
1977
- placeholder: "Logo URL (optional)",
1978
- value: l.logoUrl || "",
1979
- onChange: (c) => s(o, "logoUrl", c.target.value || void 0),
1980
- className: "cedros-setting-input cedros-token-input-logo"
1981
- }
1982
- )
1983
- ] }),
1984
- /* @__PURE__ */ e(
1985
- "button",
1986
- {
1987
- type: "button",
1988
- className: "cedros-token-remove-btn",
1989
- onClick: () => p(o),
1990
- title: "Remove token",
1991
- children: "×"
1992
- }
1993
- )
1994
- ] }, o)),
1995
- /* @__PURE__ */ e("button", { type: "button", className: "cedros-token-add-btn", onClick: r, children: "+ Add Token" })
1996
- ] });
1997
- }
1998
- function z({ value: t, onChange: i }) {
1999
- const a = N(() => t.split(",").map((s) => s.trim()).filter(Boolean), [t]), n = m(
2000
- (s) => {
2001
- if (!s || a.includes(s)) return;
2002
- const p = [...a, s].join(", ");
2003
- i(p);
2004
- },
2005
- [a, i]
2006
- ), r = m(
2007
- (s) => {
2008
- const p = a.filter((l) => l !== s).join(", ");
2009
- i(p);
2010
- },
2011
- [a, i]
2012
- );
2013
- return /* @__PURE__ */ d("div", { className: "cedros-token-symbol-list-input", children: [
2014
- /* @__PURE__ */ d("div", { className: "cedros-token-presets", children: [
2015
- /* @__PURE__ */ e("span", { className: "cedros-token-presets-label", children: "Click to add:" }),
2016
- /* @__PURE__ */ e("div", { className: "cedros-token-presets-list", children: R.map((s) => {
2017
- const p = a.includes(s);
2018
- return /* @__PURE__ */ d(
2019
- "button",
2020
- {
2021
- type: "button",
2022
- className: `cedros-token-preset-chip ${p ? "cedros-token-preset-chip-selected" : ""}`,
2023
- onClick: () => p ? r(s) : n(s),
2024
- title: p ? `Remove ${s}` : `Add ${s}`,
2025
- children: [
2026
- s,
2027
- p && /* @__PURE__ */ e("span", { className: "cedros-token-chip-check", children: "✓" })
2028
- ]
2029
- },
2030
- s
2031
- );
2032
- }) })
2033
- ] }),
2034
- /* @__PURE__ */ e(
2035
- "input",
2036
- {
2037
- type: "text",
2038
- value: t,
2039
- onChange: (s) => i(s.target.value),
2040
- className: "cedros-setting-input",
2041
- placeholder: "USDC, SOL, BONK..."
2042
- }
2043
- )
2044
- ] });
2045
- }
2046
2081
  const Y = 800, X = 2e3;
2047
2082
  function re() {
2048
2083
  const { settings: t, isLoading: i, error: a, fetchSettings: n, updateSettings: r } = O(), [s, p] = f({}), [l, o] = f("idle"), [c, y] = f(null), b = P(null), _ = P(null), w = P({});
2049
2084
  I(() => () => {
2050
2085
  b.current && clearTimeout(b.current), _.current && clearTimeout(_.current);
2051
2086
  }, []);
2052
- const v = m(async () => {
2087
+ const g = m(async () => {
2053
2088
  const h = { ...w.current };
2054
2089
  if (Object.keys(h).length === 0) {
2055
2090
  o("idle");
2056
2091
  return;
2057
2092
  }
2058
2093
  o("saving"), y(null);
2059
- const k = Object.entries(h).map(([u, g]) => ({
2094
+ const k = Object.entries(h).map(([u, v]) => ({
2060
2095
  key: u,
2061
- value: g
2096
+ value: v
2062
2097
  }));
2063
2098
  try {
2064
2099
  await r(k), p((u) => {
2065
- const g = { ...u };
2100
+ const v = { ...u };
2066
2101
  for (const S of Object.keys(h))
2067
- delete g[S];
2068
- return g;
2102
+ delete v[S];
2103
+ return v;
2069
2104
  });
2070
2105
  for (const u of Object.keys(h))
2071
2106
  delete w.current[u];
@@ -2078,15 +2113,15 @@ function re() {
2078
2113
  }, [r]), x = m(
2079
2114
  (h, k) => {
2080
2115
  p((u) => ({ ...u, [h]: k })), w.current[h] = k, y(null), o("pending"), b.current && clearTimeout(b.current), b.current = setTimeout(() => {
2081
- v();
2116
+ g();
2082
2117
  }, Y);
2083
2118
  },
2084
- [v]
2119
+ [g]
2085
2120
  ), C = m(
2086
2121
  (h) => {
2087
2122
  if (s[h] !== void 0) return s[h];
2088
2123
  for (const k of Object.values(t)) {
2089
- const u = k.find((g) => g.key === h);
2124
+ const u = k.find((v) => v.key === h);
2090
2125
  if (u) return u.value;
2091
2126
  }
2092
2127
  return "";