@cedros/pay-react 1.1.28 → 1.1.30

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 (181) hide show
  1. package/README.md +8 -0
  2. package/dist/{AISettingsSection-BlIv3CzS.mjs → AISettingsSection-BMh3hAb5.mjs} +6 -4
  3. package/dist/{AISettingsSection-DELur7D2.js → AISettingsSection-C0zqPbd6.js} +2 -2
  4. package/dist/{AutosaveIndicator-Bed0-ekg.mjs → AutosaveIndicator-3ctAnz8Y.mjs} +1 -1
  5. package/dist/{AutosaveIndicator-Dn_qA2hK.js → AutosaveIndicator-DXRPr4P7.js} +1 -1
  6. package/dist/CedrosContext-5Gjveoba.mjs +2555 -0
  7. package/dist/CedrosContext-CCakH2SZ.js +3 -0
  8. package/dist/CedrosPayAdminDashboard-DaJ9JoGn.mjs +250 -0
  9. package/dist/CedrosPayAdminDashboard-Uvyh9p7A.js +1 -0
  10. package/dist/{ChatLogsSection-v4zwzCTC.mjs → ChatLogsSection-BtJixYAp.mjs} +19 -17
  11. package/dist/ChatLogsSection-FC3O536G.js +1 -0
  12. package/dist/{ComplianceSection-CemgfDrL.mjs → ComplianceSection-BMnb1p4w.mjs} +18 -15
  13. package/dist/ComplianceSection-BioTKm7k.js +1 -0
  14. package/dist/{CryptoButton-BV9owVe2.mjs → CryptoButton-Cl2kZbOP.mjs} +26 -24
  15. package/dist/CryptoButton-DxFCYDlJ.js +1 -0
  16. package/dist/{CustomersSection-D_j7OrfS.mjs → CustomersSection-dmwoBhcf.mjs} +21 -19
  17. package/dist/CustomersSection-z6ARxuex.js +1 -0
  18. package/dist/DisputesSection-BjHHQAi7.js +1 -0
  19. package/dist/{DisputesSection-BcAbXp3K.mjs → DisputesSection-CHyLne76.mjs} +19 -17
  20. package/dist/Dropdown-BRSZlhik.mjs +111 -0
  21. package/dist/Dropdown-j8o0OO5L.js +1 -0
  22. package/dist/ErrorBanner-CAgPnj62.js +1 -0
  23. package/dist/ErrorBanner-lZJhCmDX.mjs +22 -0
  24. package/dist/{FAQSection-Dn38OhB_.mjs → FAQSection-Di2xE9Sm.mjs} +8 -6
  25. package/dist/FAQSection-b34DMzgV.js +1 -0
  26. package/dist/{ImagesSection-Ctw9Icym.mjs → ImagesSection-D63PEjR6.mjs} +6 -4
  27. package/dist/ImagesSection-DGBA7iKY.js +1 -0
  28. package/dist/{InventorySection-DmhjUlRZ.mjs → InventorySection-Dp5Yu4TA.mjs} +25 -23
  29. package/dist/InventorySection-bVCECzX5.js +1 -0
  30. package/dist/LazyCedrosPayAdminDashboard-BqJDNrDI.mjs +9 -0
  31. package/dist/LazyCedrosPayAdminDashboard-CpfTtOBc.js +1 -0
  32. package/dist/{MessagingSection-B1FaGxkp.mjs → MessagingSection-BLCnCpEv.mjs} +5 -4
  33. package/dist/MessagingSection-DU0dYNMy.js +1 -0
  34. package/dist/{OrdersSection-Bj8bPdg8.mjs → OrdersSection-Bd56F3cj.mjs} +27 -24
  35. package/dist/OrdersSection-FOFEAgs1.js +1 -0
  36. package/dist/PaymentSettingsSection-52iw47Su.mjs +648 -0
  37. package/dist/PaymentSettingsSection-B5J56VAk.js +1 -0
  38. package/dist/ReturnsSection-BjpIVFfN.js +1 -0
  39. package/dist/{ReturnsSection-BC0L8r2e.mjs → ReturnsSection-DUVeKrCd.mjs} +11 -9
  40. package/dist/{SettingsSection-vdYFSNxB.js → SettingsSection-DKkHykaC.js} +1 -1
  41. package/dist/{SettingsSection-KYdEizq_.mjs → SettingsSection-vK9WIwXE.mjs} +1 -1
  42. package/dist/ShippingSection-B5lk7zpS.js +1 -0
  43. package/dist/{ShippingSection-BOgto6_9.mjs → ShippingSection-CZRrXrlh.mjs} +5 -3
  44. package/dist/{SingleCategorySettings-suJ8z9d8.mjs → SingleCategorySettings-C8xJ47_T.mjs} +143 -140
  45. package/dist/SingleCategorySettings-g7D-9lG1.js +3 -0
  46. package/dist/StatsBar-CWXw2ZT3.js +1 -0
  47. package/dist/StatsBar-D4cOKG2e.mjs +25 -0
  48. package/dist/StorefrontSection-BWnMB9k-.js +1 -0
  49. package/dist/{StorefrontSection-BRvIGBEJ.mjs → StorefrontSection-uXSVbEAa.mjs} +121 -119
  50. package/dist/{SubscriptionsSection-D60qrX9a.mjs → SubscriptionsSection-Ci_AZrWA.mjs} +11 -9
  51. package/dist/SubscriptionsSection-DQfXkuDv.js +1 -0
  52. package/dist/{TaxSection-C7-pv-Rl.mjs → TaxSection-BTukS_cU.mjs} +23 -21
  53. package/dist/TaxSection-cuPQISxZ.js +1 -0
  54. package/dist/ThemeContext-CFXyYx7A.js +1 -0
  55. package/dist/ThemeContext-l0bqcOGW.mjs +126 -0
  56. package/dist/Token22Section-CCfkDm8W.js +1 -0
  57. package/dist/{Token22Section-CrHLQ0EB.mjs → Token22Section-DRsPJuTq.mjs} +7 -6
  58. package/dist/{WalletManager-BIwH8Dw_.mjs → WalletManager-D-eoqUDy.mjs} +21 -19
  59. package/dist/WalletManager-DXChB9LA.js +1 -0
  60. package/dist/{WebhooksSection-COPW4Ec0.mjs → WebhooksSection-A8Y4ZGcj.mjs} +40 -38
  61. package/dist/WebhooksSection-CnEmaGH1.js +1 -0
  62. package/dist/admin.d.ts +2 -0
  63. package/dist/admin.js +1 -0
  64. package/dist/admin.mjs +7 -0
  65. package/dist/configApi-BS5UJfzm.js +1 -0
  66. package/dist/{configApi-6XhAJGKX.mjs → configApi-BUXZOMWK.mjs} +57 -3
  67. package/dist/crypto-only.js +1 -1
  68. package/dist/crypto-only.mjs +215 -202
  69. package/dist/dateHelpers-BKW_lGND.js +1 -0
  70. package/dist/dateHelpers-yvPkofYQ.mjs +6 -0
  71. package/dist/fetchWithTimeout-CG0EKbhf.js +1 -0
  72. package/dist/fetchWithTimeout-DmMOwL0Q.mjs +195 -0
  73. package/dist/icons-C3yDMnKE.mjs +235 -0
  74. package/dist/icons-Cjgd9YVo.js +1 -0
  75. package/dist/index-9QF_UfSN.mjs +18668 -0
  76. package/dist/index-Cq9ya93W.js +84 -0
  77. package/dist/index.js +1 -1
  78. package/dist/index.mjs +74 -63
  79. package/dist/safeHref-DqJPLPl5.mjs +12 -0
  80. package/dist/safeHref-DyHIpVjY.js +1 -0
  81. package/dist/sectionIds-D46-_-h-.js +1 -0
  82. package/dist/sectionIds-YktNxmRt.mjs +124 -0
  83. package/dist/sections-511_XBh4.js +1 -0
  84. package/dist/sections-CRaMa8ZB.mjs +9 -0
  85. package/dist/sections-more-Cgw2qJlA.js +1 -0
  86. package/dist/sections-more-Ixw6mM6R.mjs +3082 -0
  87. package/dist/src/admin/index.d.ts +3 -3
  88. package/dist/src/admin/index.d.ts.map +1 -1
  89. package/dist/src/admin/plugin.d.ts.map +1 -1
  90. package/dist/src/admin/types.d.ts +2 -6
  91. package/dist/src/admin/types.d.ts.map +1 -1
  92. package/dist/src/admin.d.ts +9 -0
  93. package/dist/src/admin.d.ts.map +1 -0
  94. package/dist/src/components/admin/LazyCedrosPayAdminDashboard.d.ts +4 -0
  95. package/dist/src/components/admin/LazyCedrosPayAdminDashboard.d.ts.map +1 -0
  96. package/dist/src/components/admin/PaymentReadinessChecklist.d.ts +9 -0
  97. package/dist/src/components/admin/PaymentReadinessChecklist.d.ts.map +1 -0
  98. package/dist/src/components/admin/PaymentSettingsSection.d.ts.map +1 -1
  99. package/dist/src/components/admin/PaymentSetupGuide.d.ts +6 -0
  100. package/dist/src/components/admin/PaymentSetupGuide.d.ts.map +1 -0
  101. package/dist/src/components/admin/ProductsSection.d.ts.map +1 -1
  102. package/dist/src/components/admin/configApi.d.ts +1 -1
  103. package/dist/src/components/admin/configApi.d.ts.map +1 -1
  104. package/dist/src/components/admin/icons.d.ts +3 -50
  105. package/dist/src/components/admin/icons.d.ts.map +1 -1
  106. package/dist/src/components/admin/index.d.ts +1 -1
  107. package/dist/src/components/admin/index.d.ts.map +1 -1
  108. package/dist/src/components/admin/types.d.ts +43 -0
  109. package/dist/src/components/admin/types.d.ts.map +1 -1
  110. package/dist/src/context/CedrosContext.d.ts +2 -0
  111. package/dist/src/context/CedrosContext.d.ts.map +1 -1
  112. package/dist/src/ecommerce/__tests__/featureFlags.test.d.ts +2 -0
  113. package/dist/src/ecommerce/__tests__/featureFlags.test.d.ts.map +1 -0
  114. package/dist/src/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -1
  115. package/dist/src/ecommerce/components/general/ErrorBoundary.d.ts +1 -1
  116. package/dist/src/ecommerce/components/ui/button.d.ts +1 -1
  117. package/dist/src/ecommerce/components/ui/sheet.d.ts +1 -1
  118. package/dist/src/ecommerce/config/context.d.ts +2 -0
  119. package/dist/src/ecommerce/config/context.d.ts.map +1 -1
  120. package/dist/src/ecommerce/config/types.d.ts +2 -0
  121. package/dist/src/ecommerce/config/types.d.ts.map +1 -1
  122. package/dist/src/ecommerce/index.d.ts +2 -0
  123. package/dist/src/ecommerce/index.d.ts.map +1 -1
  124. package/dist/src/featureFlags.d.ts +41 -0
  125. package/dist/src/featureFlags.d.ts.map +1 -0
  126. package/dist/src/index.d.ts +4 -2
  127. package/dist/src/index.d.ts.map +1 -1
  128. package/dist/src/managers/StripeManager.d.ts.map +1 -1
  129. package/dist/src/managers/SubscriptionManager.d.ts +1 -0
  130. package/dist/src/managers/SubscriptionManager.d.ts.map +1 -1
  131. package/dist/src/standalone-admin.d.ts +8 -0
  132. package/dist/src/standalone-admin.d.ts.map +1 -0
  133. package/dist/src/types/index.d.ts +14 -1
  134. package/dist/src/types/index.d.ts.map +1 -1
  135. package/dist/src/types/subscription.d.ts +47 -1
  136. package/dist/src/types/subscription.d.ts.map +1 -1
  137. package/dist/src/utils/validateConfig.d.ts.map +1 -1
  138. package/dist/standalone-admin.d.ts +2 -0
  139. package/dist/standalone-admin.js +1 -0
  140. package/dist/standalone-admin.mjs +4 -0
  141. package/dist/stripe-only.js +1 -1
  142. package/dist/stripe-only.mjs +35 -33
  143. package/dist/styles--fxb3lCl.js +1 -0
  144. package/dist/{styles-D4SQkuV3.mjs → styles-DGagylUj.mjs} +53 -51
  145. package/dist/testing/index.js +1 -1
  146. package/dist/testing/index.mjs +1 -1
  147. package/dist/tokenMintValidator-DAjQld0r.mjs +98 -0
  148. package/dist/tokenMintValidator-DNBhoefh.js +4 -0
  149. package/dist/{walletPool-DE-t1wSW.mjs → walletPool-9MylB2QK.mjs} +1 -1
  150. package/dist/walletPool-BjTXX6Vn.js +1 -0
  151. package/package.json +9 -3
  152. package/dist/CedrosContext-C2RjHLaQ.js +0 -6
  153. package/dist/CedrosContext-CY6zvjvJ.mjs +0 -2801
  154. package/dist/ChatLogsSection-BH5tLA4T.js +0 -1
  155. package/dist/ComplianceSection-DP2a9-S0.js +0 -1
  156. package/dist/CryptoButton-DpiCnyXE.js +0 -1
  157. package/dist/CustomersSection-CBwy_waO.js +0 -1
  158. package/dist/DisputesSection-BLjIk60n.js +0 -1
  159. package/dist/FAQSection-wNeH0i6Q.js +0 -1
  160. package/dist/ImagesSection-0ZzKlzMJ.js +0 -1
  161. package/dist/InventorySection-zV6lTmue.js +0 -1
  162. package/dist/MessagingSection-B_wdFR0j.js +0 -1
  163. package/dist/OrdersSection-Dw2FX-1d.js +0 -1
  164. package/dist/PaymentSettingsSection-BYF4D-GR.js +0 -1
  165. package/dist/PaymentSettingsSection-EnMxeWjv.mjs +0 -94
  166. package/dist/ReturnsSection-D_pJVxuG.js +0 -1
  167. package/dist/ShippingSection-1DRSTu49.js +0 -1
  168. package/dist/SingleCategorySettings-DwCnBdRf.js +0 -3
  169. package/dist/StorefrontSection-RumGkb3C.js +0 -1
  170. package/dist/SubscriptionsSection-C2aLLn7L.js +0 -1
  171. package/dist/TaxSection-Dt1DnM51.js +0 -1
  172. package/dist/Token22Section-DY3mUwTY.js +0 -1
  173. package/dist/WalletManager-B3UdQ5pQ.js +0 -1
  174. package/dist/WebhooksSection-CKeiJ7Py.js +0 -1
  175. package/dist/configApi-DkduMQg1.js +0 -1
  176. package/dist/index-C0g-JxJk.js +0 -84
  177. package/dist/index-DXnuQp5x.mjs +0 -22128
  178. package/dist/sections-C1NpK7hk.mjs +0 -9
  179. package/dist/sections-DVVSZBhW.js +0 -1
  180. package/dist/styles-BT4bhFey.js +0 -1
  181. package/dist/walletPool-IS7R3MR1.js +0 -1
@@ -0,0 +1,111 @@
1
+ import { jsxs as a, jsx as r } from "react/jsx-runtime";
2
+ import { useState as v, useRef as b, useEffect as u } from "react";
3
+ import { I as _ } from "./icons-C3yDMnKE.mjs";
4
+ function L({ value: s, onChange: f, options: i, placeholder: h = "Filter", disabled: t }) {
5
+ const [n, c] = v(!1), m = b(null), l = i.find((e) => e.value === s)?.label || h;
6
+ return u(() => {
7
+ const e = (p) => {
8
+ m.current && !m.current.contains(p.target) && c(!1);
9
+ };
10
+ if (n)
11
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
12
+ }, [n]), u(() => {
13
+ const e = (p) => {
14
+ p.key === "Escape" && c(!1);
15
+ };
16
+ if (n)
17
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
18
+ }, [n]), /* @__PURE__ */ a("div", { className: "cedros-admin__dropdown", ref: m, children: [
19
+ /* @__PURE__ */ a(
20
+ "button",
21
+ {
22
+ type: "button",
23
+ className: "cedros-admin__dropdown-trigger",
24
+ onClick: () => !t && c(!n),
25
+ "aria-expanded": n,
26
+ "aria-haspopup": "listbox",
27
+ disabled: t,
28
+ children: [
29
+ /* @__PURE__ */ r("span", { children: l }),
30
+ /* @__PURE__ */ r("span", { className: `cedros-admin__dropdown-chevron ${n ? "cedros-admin__dropdown-chevron--open" : ""}`, children: _.chevronDown })
31
+ ]
32
+ }
33
+ ),
34
+ n && /* @__PURE__ */ r("div", { className: "cedros-admin__dropdown-menu", role: "listbox", children: i.map((e) => /* @__PURE__ */ a(
35
+ "button",
36
+ {
37
+ type: "button",
38
+ className: `cedros-admin__dropdown-item ${e.value === s ? "cedros-admin__dropdown-item--selected" : ""}`,
39
+ onClick: () => {
40
+ e.disabled || (f(e.value), c(!1));
41
+ },
42
+ role: "option",
43
+ "aria-selected": e.value === s,
44
+ disabled: e.disabled,
45
+ children: [
46
+ e.label,
47
+ e.value === s && /* @__PURE__ */ r("span", { className: "cedros-admin__dropdown-check", children: _.check })
48
+ ]
49
+ },
50
+ e.value
51
+ )) })
52
+ ] });
53
+ }
54
+ function O({ value: s, onChange: f, options: i, label: h, description: t, disabled: n, className: c, style: m }) {
55
+ const [o, l] = v(!1), e = b(null), k = i.find((d) => d.value === s)?.label || "Select...";
56
+ return u(() => {
57
+ const d = (w) => {
58
+ e.current && !e.current.contains(w.target) && l(!1);
59
+ };
60
+ if (o)
61
+ return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
62
+ }, [o]), u(() => {
63
+ const d = (w) => {
64
+ w.key === "Escape" && l(!1);
65
+ };
66
+ if (o)
67
+ return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
68
+ }, [o]), /* @__PURE__ */ a("div", { className: `cedros-admin__field ${c || ""}`, style: m, children: [
69
+ /* @__PURE__ */ r("label", { className: "cedros-admin__field-label", children: h }),
70
+ /* @__PURE__ */ a("div", { className: "cedros-admin__dropdown cedros-admin__dropdown--form", ref: e, children: [
71
+ /* @__PURE__ */ a(
72
+ "button",
73
+ {
74
+ type: "button",
75
+ className: "cedros-admin__dropdown-trigger cedros-admin__dropdown-trigger--form",
76
+ onClick: () => !n && l(!o),
77
+ "aria-expanded": o,
78
+ "aria-haspopup": "listbox",
79
+ disabled: n,
80
+ children: [
81
+ /* @__PURE__ */ r("span", { children: k }),
82
+ /* @__PURE__ */ r("span", { className: `cedros-admin__dropdown-chevron ${o ? "cedros-admin__dropdown-chevron--open" : ""}`, children: _.chevronDown })
83
+ ]
84
+ }
85
+ ),
86
+ o && /* @__PURE__ */ r("div", { className: "cedros-admin__dropdown-menu cedros-admin__dropdown-menu--form", role: "listbox", children: i.map((d) => /* @__PURE__ */ a(
87
+ "button",
88
+ {
89
+ type: "button",
90
+ className: `cedros-admin__dropdown-item ${d.value === s ? "cedros-admin__dropdown-item--selected" : ""}`,
91
+ onClick: () => {
92
+ d.disabled || (f(d.value), l(!1));
93
+ },
94
+ role: "option",
95
+ "aria-selected": d.value === s,
96
+ disabled: d.disabled,
97
+ children: [
98
+ d.label,
99
+ d.value === s && /* @__PURE__ */ r("span", { className: "cedros-admin__dropdown-check", children: _.check })
100
+ ]
101
+ },
102
+ d.value
103
+ )) })
104
+ ] }),
105
+ t && /* @__PURE__ */ r("p", { className: "cedros-admin__field-description", children: t })
106
+ ] });
107
+ }
108
+ export {
109
+ O as F,
110
+ L as a
111
+ };
@@ -0,0 +1 @@
1
+ "use strict";const n=require("react/jsx-runtime"),c=require("react"),p=require("./icons-Cjgd9YVo.js");function v({value:r,onChange:_,options:i,placeholder:f="Filter",disabled:l}){const[s,a]=c.useState(!1),m=c.useRef(null),t=i.find(e=>e.value===r)?.label||f;return c.useEffect(()=>{const e=u=>{m.current&&!m.current.contains(u.target)&&a(!1)};if(s)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[s]),c.useEffect(()=>{const e=u=>{u.key==="Escape"&&a(!1)};if(s)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[s]),n.jsxs("div",{className:"cedros-admin__dropdown",ref:m,children:[n.jsxs("button",{type:"button",className:"cedros-admin__dropdown-trigger",onClick:()=>!l&&a(!s),"aria-expanded":s,"aria-haspopup":"listbox",disabled:l,children:[n.jsx("span",{children:t}),n.jsx("span",{className:`cedros-admin__dropdown-chevron ${s?"cedros-admin__dropdown-chevron--open":""}`,children:p.Icons.chevronDown})]}),s&&n.jsx("div",{className:"cedros-admin__dropdown-menu",role:"listbox",children:i.map(e=>n.jsxs("button",{type:"button",className:`cedros-admin__dropdown-item ${e.value===r?"cedros-admin__dropdown-item--selected":""}`,onClick:()=>{e.disabled||(_(e.value),a(!1))},role:"option","aria-selected":e.value===r,disabled:e.disabled,children:[e.label,e.value===r&&n.jsx("span",{className:"cedros-admin__dropdown-check",children:p.Icons.check})]},e.value))})]})}function b({value:r,onChange:_,options:i,label:f,description:l,disabled:s,className:a,style:m}){const[o,t]=c.useState(!1),e=c.useRef(null),h=i.find(d=>d.value===r)?.label||"Select...";return c.useEffect(()=>{const d=w=>{e.current&&!e.current.contains(w.target)&&t(!1)};if(o)return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[o]),c.useEffect(()=>{const d=w=>{w.key==="Escape"&&t(!1)};if(o)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[o]),n.jsxs("div",{className:`cedros-admin__field ${a||""}`,style:m,children:[n.jsx("label",{className:"cedros-admin__field-label",children:f}),n.jsxs("div",{className:"cedros-admin__dropdown cedros-admin__dropdown--form",ref:e,children:[n.jsxs("button",{type:"button",className:"cedros-admin__dropdown-trigger cedros-admin__dropdown-trigger--form",onClick:()=>!s&&t(!o),"aria-expanded":o,"aria-haspopup":"listbox",disabled:s,children:[n.jsx("span",{children:h}),n.jsx("span",{className:`cedros-admin__dropdown-chevron ${o?"cedros-admin__dropdown-chevron--open":""}`,children:p.Icons.chevronDown})]}),o&&n.jsx("div",{className:"cedros-admin__dropdown-menu cedros-admin__dropdown-menu--form",role:"listbox",children:i.map(d=>n.jsxs("button",{type:"button",className:`cedros-admin__dropdown-item ${d.value===r?"cedros-admin__dropdown-item--selected":""}`,onClick:()=>{d.disabled||(_(d.value),t(!1))},role:"option","aria-selected":d.value===r,disabled:d.disabled,children:[d.label,d.value===r&&n.jsx("span",{className:"cedros-admin__dropdown-check",children:p.Icons.check})]},d.value))})]}),l&&n.jsx("p",{className:"cedros-admin__field-description",children:l})]})}exports.FilterDropdown=v;exports.FormDropdown=b;
@@ -0,0 +1 @@
1
+ "use strict";const r=require("react/jsx-runtime"),s=require("./icons-Cjgd9YVo.js");function c({message:n,onRetry:e}){return n?r.jsxs("div",{className:"cedros-admin__error-banner",children:[r.jsx("span",{children:n}),e&&r.jsxs("button",{type:"button",className:"cedros-admin__error-banner-retry",onClick:e,children:[s.Icons.refresh," Retry"]})]}):null}exports.ErrorBanner=c;
@@ -0,0 +1,22 @@
1
+ import { jsxs as e, jsx as o } from "react/jsx-runtime";
2
+ import { I as s } from "./icons-C3yDMnKE.mjs";
3
+ function i({ message: r, onRetry: n }) {
4
+ return r ? /* @__PURE__ */ e("div", { className: "cedros-admin__error-banner", children: [
5
+ /* @__PURE__ */ o("span", { children: r }),
6
+ n && /* @__PURE__ */ e(
7
+ "button",
8
+ {
9
+ type: "button",
10
+ className: "cedros-admin__error-banner-retry",
11
+ onClick: n,
12
+ children: [
13
+ s.refresh,
14
+ " Retry"
15
+ ]
16
+ }
17
+ )
18
+ ] }) : null;
19
+ }
20
+ export {
21
+ i as E
22
+ };
@@ -1,8 +1,10 @@
1
1
  import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
2
  import { useState as r, useCallback as R, useEffect as V, useMemo as G } from "react";
3
- import { E as H, j as Y, I as l } from "./index-DXnuQp5x.mjs";
4
- function M({ serverUrl: u, apiKey: d, pageSize: A = 20, authManager: o }) {
5
- const [_, F] = r([]), [E, C] = r(!0), [S, N] = r(!1), [v, k] = r(null), [Q, I] = r(!1), [y, $] = r(""), [f, x] = r("all"), [q, w] = r(null), [T, b] = r(null), [n, m] = r({
3
+ import { I as l } from "./icons-C3yDMnKE.mjs";
4
+ import { E as H } from "./ErrorBanner-lZJhCmDX.mjs";
5
+ import { S as Y } from "./StatsBar-D4cOKG2e.mjs";
6
+ function te({ serverUrl: u, apiKey: d, pageSize: A = 20, authManager: o }) {
7
+ const [_, F] = r([]), [S, C] = r(!0), [E, N] = r(!1), [v, k] = r(null), [Q, I] = r(!1), [y, $] = r(""), [f, x] = r("all"), [q, w] = r(null), [T, b] = r(null), [n, m] = r({
6
8
  question: "",
7
9
  answer: "",
8
10
  keywordsCsv: "",
@@ -180,7 +182,7 @@ function M({ serverUrl: u, apiKey: d, pageSize: A = 20, authManager: o }) {
180
182
  }
181
183
  )
182
184
  ] }),
183
- S && /* @__PURE__ */ t("div", { className: "cedros-admin__form-container", style: { marginBottom: "1.5rem" }, children: /* @__PURE__ */ a("form", { onSubmit: D, className: "cedros-admin__form", children: [
185
+ E && /* @__PURE__ */ t("div", { className: "cedros-admin__form-container", style: { marginBottom: "1.5rem" }, children: /* @__PURE__ */ a("form", { onSubmit: D, className: "cedros-admin__form", children: [
184
186
  /* @__PURE__ */ a("div", { className: "cedros-admin__form-header", children: [
185
187
  /* @__PURE__ */ t("h4", { children: v ? "Edit FAQ" : "Add New FAQ" }),
186
188
  /* @__PURE__ */ t("button", { type: "button", className: "cedros-admin__button--icon", onClick: g, children: l.close })
@@ -283,7 +285,7 @@ function M({ serverUrl: u, apiKey: d, pageSize: A = 20, authManager: o }) {
283
285
  )
284
286
  ] })
285
287
  ] }) }),
286
- E ? /* @__PURE__ */ a("div", { className: "cedros-admin__loading", children: [
288
+ S ? /* @__PURE__ */ a("div", { className: "cedros-admin__loading", children: [
287
289
  l.loading,
288
290
  /* @__PURE__ */ t("span", { children: "Loading FAQs..." })
289
291
  ] }) : P.length === 0 ? /* @__PURE__ */ t("div", { className: "cedros-admin__empty", children: /* @__PURE__ */ t("p", { children: y || f !== "all" ? "No FAQs match your filters." : "No FAQs yet. Add one to get started." }) }) : /* @__PURE__ */ t("div", { className: "cedros-admin__faq-list", children: P.map((e) => /* @__PURE__ */ a(
@@ -362,5 +364,5 @@ function M({ serverUrl: u, apiKey: d, pageSize: A = 20, authManager: o }) {
362
364
  ] });
363
365
  }
364
366
  export {
365
- M as FAQSection
367
+ te as FAQSection
366
368
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),r=require("./icons-Cjgd9YVo.js"),R=require("./ErrorBanner-CAgPnj62.js"),U=require("./StatsBar-CWXw2ZT3.js");function V({serverUrl:h,apiKey:d,pageSize:g=20,authManager:o}){const[u,N]=c.useState([]),[Q,w]=c.useState(!0),[S,f]=c.useState(!1),[p,A]=c.useState(null),[F,C]=c.useState(!1),[x,P]=c.useState(""),[v,O]=c.useState("all"),[q,b]=c.useState(null),[E,j]=c.useState(null),[n,l]=c.useState({question:"",answer:"",keywordsCsv:"",active:!0,useInChat:!0,displayOnPage:!0}),_=c.useCallback(async()=>{w(!0);try{j(null);let s;const t=`/admin/faqs?limit=${g}`;if(o?.isAuthenticated())s=await o.fetchWithAuth(t);else{const i={"Content-Type":"application/json"};d&&(i["X-API-Key"]=d);const a=await fetch(`${h}${t}`,{headers:i});if(!a.ok)throw new Error(`Failed to fetch FAQs: ${a.status}`);s=await a.json()}N(s.faqs||[])}catch{N([]),j("Failed to load FAQs")}finally{w(!1)}},[h,d,g,o]);c.useEffect(()=>{_()},[_]);const $=async s=>{if(s.preventDefault(),!(!n.question.trim()||!n.answer.trim())){C(!0);try{const t=n.keywordsCsv.split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),i={question:n.question.trim(),answer:n.answer.trim(),keywords:t,active:n.active,useInChat:n.useInChat,displayOnPage:n.displayOnPage};if(p){const a=`/admin/faqs/${p.id}`;if(o?.isAuthenticated())await o.fetchWithAuth(a,{method:"PUT",body:JSON.stringify(i)});else{const m={"Content-Type":"application/json"};d&&(m["X-API-Key"]=d);const I=await fetch(`${h}${a}`,{method:"PUT",headers:m,body:JSON.stringify(i)});if(!I.ok)throw new Error(`Failed to update FAQ: ${I.status}`)}}else if(o?.isAuthenticated())await o.fetchWithAuth("/admin/faqs",{method:"POST",body:JSON.stringify(i)});else{const a={"Content-Type":"application/json"};d&&(a["X-API-Key"]=d);const m=await fetch(`${h}/admin/faqs`,{method:"POST",headers:a,body:JSON.stringify(i)});if(!m.ok)throw new Error(`Failed to create FAQ: ${m.status}`)}y(),_()}catch{j(p?"Failed to update FAQ":"Failed to create FAQ")}finally{C(!1)}}},T=async s=>{try{const t=`/admin/faqs/${s}`;if(o?.isAuthenticated())await o.fetchWithAuth(t,{method:"DELETE"});else{const i={"Content-Type":"application/json"};d&&(i["X-API-Key"]=d);const a=await fetch(`${h}${t}`,{method:"DELETE",headers:i});if(!a.ok)throw new Error(`Failed to delete FAQ: ${a.status}`)}_()}catch{j("Failed to delete FAQ")}b(null)},D=async s=>{try{const t=`/admin/faqs/${s.id}`,i={...s,active:!s.active};if(o?.isAuthenticated())await o.fetchWithAuth(t,{method:"PUT",body:JSON.stringify(i)});else{const a={"Content-Type":"application/json"};d&&(a["X-API-Key"]=d);const m=await fetch(`${h}${t}`,{method:"PUT",headers:a,body:JSON.stringify(i)});if(!m.ok)throw new Error(`Failed to update FAQ: ${m.status}`)}_()}catch{j("Failed to update FAQ status")}},y=()=>{l({question:"",answer:"",keywordsCsv:"",active:!0,useInChat:!0,displayOnPage:!0}),A(null),f(!1)},L=s=>{l({question:s.question,answer:s.answer,keywordsCsv:s.keywords.join(", "),active:s.active,useInChat:s.useInChat??!0,displayOnPage:s.displayOnPage??!0}),A(s),f(!0)},B=u.length,W=u.filter(s=>s.active).length,J=u.filter(s=>s.active&&s.useInChat).length,X=u.filter(s=>s.active&&s.displayOnPage).length,k=c.useMemo(()=>u.filter(s=>{if(v==="active"&&!s.active||v==="inactive"&&s.active)return!1;if(x){const t=x.toLowerCase();return s.question.toLowerCase().includes(t)||s.answer.toLowerCase().includes(t)||s.keywords.some(i=>i.includes(t))}return!0}),[u,v,x]);return e.jsxs("div",{className:"cedros-admin__faqs",children:[e.jsx(R.ErrorBanner,{message:E,onRetry:_}),e.jsx(U.StatsBar,{stats:[{label:"Total FAQs",value:B},{label:"Active",value:W,variant:"success"},{label:"In Chat",value:J},{label:"On Page",value:X}]}),e.jsxs("div",{className:"cedros-admin__section",children:[e.jsxs("div",{className:"cedros-admin__section-header",children:[e.jsxs("div",{className:"cedros-admin__section-header-left",children:[e.jsx("h3",{className:"cedros-admin__section-title",children:"Knowledge Base"}),e.jsx("p",{className:"cedros-admin__section-subtitle",children:"Manage FAQs for the AI chat assistant and public FAQ page."})]}),e.jsx("div",{className:"cedros-admin__section-header-right",children:e.jsxs("button",{className:"cedros-admin__button cedros-admin__button--primary",onClick:()=>{y(),f(!0)},children:[r.Icons.plus," Add FAQ"]})})]}),e.jsxs("div",{className:"cedros-admin__filters",style:{display:"flex",gap:"1rem",marginBottom:"1rem"},children:[e.jsx("input",{type:"text",placeholder:"Search FAQs...",value:x,onChange:s=>P(s.target.value),className:"cedros-admin__input",style:{flex:1,maxWidth:300}}),e.jsxs("select",{value:v,onChange:s=>O(s.target.value),className:"cedros-admin__select",children:[e.jsx("option",{value:"all",children:"All Status"}),e.jsx("option",{value:"active",children:"Active Only"}),e.jsx("option",{value:"inactive",children:"Inactive Only"})]})]}),S&&e.jsx("div",{className:"cedros-admin__form-container",style:{marginBottom:"1.5rem"},children:e.jsxs("form",{onSubmit:$,className:"cedros-admin__form",children:[e.jsxs("div",{className:"cedros-admin__form-header",children:[e.jsx("h4",{children:p?"Edit FAQ":"Add New FAQ"}),e.jsx("button",{type:"button",className:"cedros-admin__button--icon",onClick:y,children:r.Icons.close})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsx("label",{className:"cedros-admin__label",children:"Question *"}),e.jsx("input",{type:"text",value:n.question,onChange:s=>l(t=>({...t,question:s.target.value})),className:"cedros-admin__input",placeholder:"What is your return policy?",required:!0})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsx("label",{className:"cedros-admin__label",children:"Answer *"}),e.jsx("textarea",{value:n.answer,onChange:s=>l(t=>({...t,answer:s.target.value})),className:"cedros-admin__textarea",placeholder:"We accept returns within 30 days...",rows:4,required:!0}),e.jsx("span",{className:"cedros-admin__hint",children:"Supports markdown formatting."})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsx("label",{className:"cedros-admin__label",children:"Keywords"}),e.jsx("input",{type:"text",value:n.keywordsCsv,onChange:s=>l(t=>({...t,keywordsCsv:s.target.value})),className:"cedros-admin__input",placeholder:"returns, refund, policy"}),e.jsx("span",{className:"cedros-admin__hint",children:"Comma-separated keywords to help AI find this FAQ."})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsxs("label",{className:"cedros-admin__checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:n.active,onChange:s=>l(t=>({...t,active:s.target.checked}))}),e.jsx("span",{children:"Active"})]}),e.jsx("span",{className:"cedros-admin__hint",children:"Inactive FAQs won't appear anywhere."})]}),e.jsxs("div",{className:"cedros-admin__form-group",children:[e.jsx("label",{className:"cedros-admin__label",children:"Visibility"}),e.jsxs("div",{className:"cedros-admin__checkbox-group",children:[e.jsxs("label",{className:"cedros-admin__checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:n.useInChat,onChange:s=>l(t=>({...t,useInChat:s.target.checked}))}),e.jsx("span",{children:"Use in AI Chat"})]}),e.jsxs("label",{className:"cedros-admin__checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:n.displayOnPage,onChange:s=>l(t=>({...t,displayOnPage:s.target.checked}))}),e.jsx("span",{children:"Display on FAQ Page"})]})]}),e.jsx("span",{className:"cedros-admin__hint",children:"Choose where this FAQ should appear."})]}),e.jsxs("div",{className:"cedros-admin__form-actions",children:[e.jsx("button",{type:"button",className:"cedros-admin__button",onClick:y,children:"Cancel"}),e.jsx("button",{type:"submit",className:"cedros-admin__button cedros-admin__button--primary",disabled:F||!n.question.trim()||!n.answer.trim(),children:F?r.Icons.loading:p?"Update FAQ":"Create FAQ"})]})]})}),Q?e.jsxs("div",{className:"cedros-admin__loading",children:[r.Icons.loading,e.jsx("span",{children:"Loading FAQs..."})]}):k.length===0?e.jsx("div",{className:"cedros-admin__empty",children:e.jsx("p",{children:x||v!=="all"?"No FAQs match your filters.":"No FAQs yet. Add one to get started."})}):e.jsx("div",{className:"cedros-admin__faq-list",children:k.map(s=>e.jsxs("div",{className:`cedros-admin__faq-item ${s.active?"":"cedros-admin__faq-item--inactive"}`,children:[e.jsxs("div",{className:"cedros-admin__faq-content",children:[e.jsxs("div",{className:"cedros-admin__faq-question",children:[e.jsx("span",{className:`cedros-admin__status-dot ${s.active?"cedros-admin__status-dot--active":"cedros-admin__status-dot--inactive"}`}),s.question]}),e.jsx("div",{className:"cedros-admin__faq-answer",children:s.answer}),e.jsxs("div",{className:"cedros-admin__faq-meta",children:[s.keywords.length>0&&e.jsx("div",{className:"cedros-admin__faq-keywords",children:s.keywords.map(t=>e.jsx("span",{className:"cedros-admin__tag",children:t},t))}),e.jsxs("div",{className:"cedros-admin__faq-visibility",children:[s.useInChat&&e.jsxs("span",{className:"cedros-admin__badge cedros-admin__badge--chat",title:"Used in AI Chat",children:[r.Icons.chat," Chat"]}),s.displayOnPage&&e.jsxs("span",{className:"cedros-admin__badge cedros-admin__badge--page",title:"Displayed on FAQ Page",children:[r.Icons.globe," Page"]})]})]})]}),e.jsxs("div",{className:"cedros-admin__faq-actions",children:[e.jsx("button",{className:"cedros-admin__button--icon",onClick:()=>D(s),title:s.active?"Deactivate":"Activate",children:s.active?r.Icons.eyeOff:r.Icons.eye}),e.jsx("button",{className:"cedros-admin__button--icon",onClick:()=>L(s),title:"Edit",children:r.Icons.edit}),e.jsx("button",{className:"cedros-admin__button--icon cedros-admin__btn--danger",onClick:()=>b(s.id),title:"Delete",children:r.Icons.trash})]}),q===s.id&&e.jsx("div",{className:"cedros-admin__confirm-overlay",children:e.jsxs("div",{className:"cedros-admin__confirm-dialog",children:[e.jsx("p",{children:"Delete this FAQ?"}),e.jsxs("div",{className:"cedros-admin__confirm-actions",children:[e.jsx("button",{className:"cedros-admin__button",onClick:()=>b(null),children:"Cancel"}),e.jsx("button",{className:"cedros-admin__button cedros-admin__button--danger",onClick:()=>T(s.id),children:"Delete"})]})]})})]},s.id))})]})]})}exports.FAQSection=V;
@@ -1,7 +1,9 @@
1
1
  import { jsxs as l, jsx as t, Fragment as R } from "react/jsx-runtime";
2
2
  import { useState as h, useRef as j, useCallback as U } from "react";
3
- import { E as z, I as u, k as B } from "./index-DXnuQp5x.mjs";
4
- import { i as I } from "./CedrosContext-CY6zvjvJ.mjs";
3
+ import { I as u } from "./icons-C3yDMnKE.mjs";
4
+ import { E as z } from "./ErrorBanner-lZJhCmDX.mjs";
5
+ import { f as B } from "./dateHelpers-yvPkofYQ.mjs";
6
+ import { g as I } from "./fetchWithTimeout-DmMOwL0Q.mjs";
5
7
  async function W(r, n, i, c) {
6
8
  const d = new FormData();
7
9
  if (d.append("file", c), i?.isAuthenticated())
@@ -37,7 +39,7 @@ async function P(r, n, i, c) {
37
39
  });
38
40
  if (!s.ok) throw new Error(`Delete failed: ${s.status}`);
39
41
  }
40
- function q({ serverUrl: r, apiKey: n, authManager: i }) {
42
+ function H({ serverUrl: r, apiKey: n, authManager: i }) {
41
43
  const [c, d] = h([]), [o, s] = h(!1), [v, D] = h(null), [S, m] = h(null), [w, C] = h(null), [f, g] = h(!1), [p, y] = h(null), b = j(null), N = U(async (e) => {
42
44
  s(!0), m(null);
43
45
  try {
@@ -212,5 +214,5 @@ function q({ serverUrl: r, apiKey: n, authManager: i }) {
212
214
  ] });
213
215
  }
214
216
  export {
215
- q as ImagesSection
217
+ H as ImagesSection
216
218
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),h=require("./icons-Cjgd9YVo.js"),A=require("./ErrorBanner-CAgPnj62.js"),O=require("./dateHelpers-BKW_lGND.js"),v=require("./fetchWithTimeout-CG0EKbhf.js");async function R(s,n,l,c){const o=new FormData;if(o.append("file",c),l?.isAuthenticated())return l.fetchWithAuth("/admin/images/upload",{method:"POST",body:o,headers:{}});const r={};n&&(r["X-API-Key"]=n);const d=await fetch(`${s}/admin/images/upload`,{method:"POST",headers:r,body:o});if(!d.ok)throw new Error(`Upload failed: ${d.status}`);return d.json()}async function F(s,n,l,c){const o=JSON.stringify({url:c});if(l?.isAuthenticated()){await l.fetchWithAuth("/admin/images",{method:"DELETE",body:o});return}const r={"Content-Type":"application/json"};n&&(r["X-API-Key"]=n);const d=await fetch(`${s}/admin/images`,{method:"DELETE",headers:r,body:o});if(!d.ok)throw new Error(`Delete failed: ${d.status}`)}function z({serverUrl:s,apiKey:n,authManager:l}){const[c,o]=i.useState([]),[r,d]=i.useState(!1),[x,j]=i.useState(null),[D,m]=i.useState(null),[_,S]=i.useState(null),[p,f]=i.useState(!1),[u,g]=i.useState(null),b=i.useRef(null),w=i.useCallback(async t=>{d(!0),m(null);try{const a=await R(s,n,l,t);o(y=>[{url:a.url,thumbUrl:a.thumbUrl,uploadedAt:new Date().toISOString()},...y]),g(null),b.current&&(b.current.value="")}catch(a){v.getLogger().error("[ImagesSection] Upload failed:",a,{serverUrl:s.slice(0,20)+"..."}),m("Upload failed. Check file type and try again.")}finally{d(!1)}},[s,n,l]),C=t=>{const a=t.target.files?.[0]??null;g(a),m(null)},I=()=>{u&&w(u)},U=t=>{t.preventDefault(),f(!0)},N=()=>f(!1),k=t=>{t.preventDefault(),f(!1);const a=t.dataTransfer.files?.[0];a&&a.type.startsWith("image/")?(g(a),m(null)):a&&m("Only image files are accepted.")},T=i.useCallback(async t=>{j(t),m(null);try{await F(s,n,l,t),o(a=>a.filter(y=>y.url!==t))}catch(a){v.getLogger().error("[ImagesSection] Delete failed:",a,{serverUrl:s.slice(0,20)+"..."}),m("Failed to delete image.")}finally{j(null)}},[s,n,l]),E=async t=>{try{await navigator.clipboard.writeText(t),S(t),setTimeout(()=>S(null),2e3)}catch{m("Could not copy to clipboard.")}},L=["cedros-admin__drop-zone",p?"cedros-admin__drop-zone--active":""].filter(Boolean).join(" ");return e.jsxs("div",{className:"cedros-admin__page",children:[e.jsx(A.ErrorBanner,{message:D}),e.jsx("div",{className:"cedros-admin__section-header",children:e.jsx("h3",{className:"cedros-admin__section-title",children:"Image Upload"})}),e.jsxs("div",{className:L,onDragOver:U,onDragLeave:N,onDrop:k,role:"region","aria-label":"Image drop zone",style:{border:"2px dashed",borderColor:p?"var(--cedros-accent, #6366f1)":"var(--cedros-border, #e2e8f0)",borderRadius:"0.5rem",padding:"1.5rem",textAlign:"center",marginBottom:"1rem",transition:"border-color 0.15s",backgroundColor:p?"var(--cedros-accent-subtle, rgba(99,102,241,0.06))":void 0},children:[e.jsx("p",{style:{marginBottom:"0.75rem",fontSize:"0.9rem",opacity:.7},children:"Drag and drop an image here, or select a file below"}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"center",alignItems:"center",flexWrap:"wrap"},children:[e.jsx("input",{ref:b,id:"cedros-image-file-input",type:"file",accept:"image/*",className:"cedros-admin__input",style:{maxWidth:260},onChange:C,"aria-label":"Select image file"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--primary",onClick:I,disabled:!u||r,"aria-busy":r,children:r?e.jsxs(e.Fragment,{children:[h.Icons.loading," Uploading..."]}):"Upload"})]}),u&&!r&&e.jsxs("p",{style:{marginTop:"0.5rem",fontSize:"0.8rem",opacity:.65},children:["Selected: ",u.name," (",(u.size/1024).toFixed(1)," KB)"]})]}),e.jsx("div",{className:"cedros-admin__section-header",children:e.jsxs("h3",{className:"cedros-admin__section-title",children:["Uploaded This Session",c.length>0&&e.jsx("span",{className:"cedros-admin__section-badge",style:{marginLeft:"0.5rem"},children:c.length})]})}),c.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"No images uploaded yet."}):e.jsx("div",{className:"cedros-admin__table-container",children:e.jsxs("table",{className:"cedros-admin__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Preview"}),e.jsx("th",{children:"URL"}),e.jsx("th",{children:"Uploaded"}),e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:c.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{width:72},children:e.jsx("img",{src:t.thumbUrl,alt:"Thumbnail preview",style:{width:56,height:56,objectFit:"cover",borderRadius:"0.25rem",display:"block"}})}),e.jsx("td",{style:{maxWidth:320,wordBreak:"break-all"},children:e.jsx("code",{style:{fontSize:"0.8rem"},children:t.url})}),e.jsx("td",{style:{whiteSpace:"nowrap"},children:O.formatDateTime(t.uploadedAt)}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",gap:"0.4rem"},children:[e.jsxs("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost",onClick:()=>E(t.url),"aria-label":"Copy URL to clipboard",title:"Copy URL",children:[_===t.url?h.Icons.check:h.Icons.eye,_===t.url?"Copied":"Copy URL"]}),e.jsxs("button",{type:"button",className:"cedros-admin__button cedros-admin__button--destructive",onClick:()=>T(t.url),disabled:x===t.url,"aria-label":"Delete image",title:"Delete",children:[x===t.url?h.Icons.loading:h.Icons.trash,"Delete"]})]})})]},t.url))})]})})]})}exports.ImagesSection=z;
@@ -1,56 +1,58 @@
1
1
  import { jsxs as n, jsx as t, Fragment as P } from "react/jsx-runtime";
2
- import { useState as r, useCallback as S, useEffect as w } from "react";
3
- import { E as R, I as j, k as T } from "./index-DXnuQp5x.mjs";
4
- import { i as E } from "./CedrosContext-CY6zvjvJ.mjs";
2
+ import { useState as o, useCallback as S, useEffect as w } from "react";
3
+ import { I as j } from "./icons-C3yDMnKE.mjs";
4
+ import { E as R } from "./ErrorBanner-lZJhCmDX.mjs";
5
+ import { f as T } from "./dateHelpers-yvPkofYQ.mjs";
6
+ import { g as E } from "./fetchWithTimeout-DmMOwL0Q.mjs";
5
7
  const a = 50;
6
- function X({ serverUrl: o, apiKey: h, authManager: f }) {
7
- const [g, I] = r([]), [C, v] = r(!0), [$, b] = r(null), [i, x] = r(""), [c, p] = r([]), [F, N] = r(!1), [L, _] = r(null), [l, y] = r(0), m = S(async (e) => {
8
+ function H({ serverUrl: d, apiKey: h, authManager: f }) {
9
+ const [g, I] = o([]), [C, v] = o(!0), [$, b] = o(null), [i, x] = o(""), [c, p] = o([]), [F, N] = o(!1), [L, _] = o(null), [l, y] = o(0), m = S(async (e) => {
8
10
  if (f?.isAuthenticated())
9
11
  return f.fetchWithAuth(e);
10
12
  const s = { "Content-Type": "application/json" };
11
13
  h && (s["X-API-Key"] = h);
12
- const d = await fetch(`${o}${e}`, { headers: s });
13
- if (!d.ok) throw new Error(`Request failed: ${d.status}`);
14
- return d.json();
15
- }, [o, h, f]);
14
+ const r = await fetch(`${d}${e}`, { headers: s });
15
+ if (!r.ok) throw new Error(`Request failed: ${r.status}`);
16
+ return r.json();
17
+ }, [d, h, f]);
16
18
  w(() => {
17
19
  let e = !1;
18
20
  return v(!0), b(null), m("/admin/products?limit=100&offset=0").then((s) => {
19
21
  if (e) return;
20
- const d = Array.isArray(s) ? s : s.products ?? [];
21
- I(d);
22
+ const r = Array.isArray(s) ? s : s.products ?? [];
23
+ I(r);
22
24
  }).catch((s) => {
23
25
  e || (E().error("[InventorySection] Failed to load products:", s, {
24
- serverUrl: o.slice(0, 20) + "..."
26
+ serverUrl: d.slice(0, 20) + "..."
25
27
  }), b("Failed to load products"));
26
28
  }).finally(() => {
27
29
  e || v(!1);
28
30
  }), () => {
29
31
  e = !0;
30
32
  };
31
- }, [m, o]);
33
+ }, [m, d]);
32
34
  const A = S(async (e, s) => {
33
35
  if (e) {
34
36
  N(!0), _(null);
35
37
  try {
36
- const d = `/admin/products/${encodeURIComponent(e)}/inventory/adjustments?limit=${a}&offset=${s}`, q = await m(d);
38
+ const r = `/admin/products/${encodeURIComponent(e)}/inventory/adjustments?limit=${a}&offset=${s}`, q = await m(r);
37
39
  p(q.adjustments ?? []);
38
- } catch (d) {
39
- E().error("[InventorySection] Failed to load adjustments:", d, {
40
+ } catch (r) {
41
+ E().error("[InventorySection] Failed to load adjustments:", r, {
40
42
  productId: e,
41
- serverUrl: o.slice(0, 20) + "..."
43
+ serverUrl: d.slice(0, 20) + "..."
42
44
  }), _("Failed to load inventory adjustments"), p([]);
43
45
  } finally {
44
46
  N(!1);
45
47
  }
46
48
  }
47
- }, [m, o]);
49
+ }, [m, d]);
48
50
  w(() => {
49
51
  i && A(i, l);
50
52
  }, [A, i, l]);
51
- const k = (e) => {
53
+ const B = (e) => {
52
54
  x(e), y(0), p([]), _(null);
53
- }, B = () => y((e) => Math.max(0, e - a)), D = () => y((e) => e + a), u = g.find((e) => e.id === i);
55
+ }, k = () => y((e) => Math.max(0, e - a)), D = () => y((e) => e + a), u = g.find((e) => e.id === i);
54
56
  return /* @__PURE__ */ n("div", { className: "cedros-admin__page", children: [
55
57
  /* @__PURE__ */ t(R, { message: $ ?? L }),
56
58
  /* @__PURE__ */ t("div", { className: "cedros-admin__section-header", children: /* @__PURE__ */ t("h3", { className: "cedros-admin__section-title", children: "Inventory Adjustments" }) }),
@@ -65,7 +67,7 @@ function X({ serverUrl: o, apiKey: h, authManager: f }) {
65
67
  id: "inventory-product-select",
66
68
  className: "cedros-admin__input",
67
69
  value: i,
68
- onChange: (e) => k(e.target.value),
70
+ onChange: (e) => B(e.target.value),
69
71
  "aria-label": "Select product to view inventory adjustments",
70
72
  children: [
71
73
  /* @__PURE__ */ t("option", { value: "", children: "-- Choose a product --" }),
@@ -118,7 +120,7 @@ function X({ serverUrl: o, apiKey: h, authManager: f }) {
118
120
  type: "button",
119
121
  className: "cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",
120
122
  disabled: l === 0,
121
- onClick: B,
123
+ onClick: k,
122
124
  children: "Previous"
123
125
  }
124
126
  ),
@@ -146,5 +148,5 @@ function X({ serverUrl: o, apiKey: h, authManager: f }) {
146
148
  ] });
147
149
  }
148
150
  export {
149
- X as InventorySection
151
+ H as InventorySection
150
152
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),b=require("./icons-Cjgd9YVo.js"),L=require("./ErrorBanner-CAgPnj62.js"),B=require("./dateHelpers-BKW_lGND.js"),S=require("./fetchWithTimeout-CG0EKbhf.js"),c=50;function k({serverUrl:o,apiKey:m,authManager:h}){const[y,N]=s.useState([]),[A,_]=s.useState(!0),[P,g]=s.useState(null),[d,w]=s.useState(""),[i,j]=s.useState([]),[E,p]=s.useState(!1),[I,f]=s.useState(null),[a,x]=s.useState(0),l=s.useCallback(async t=>{if(h?.isAuthenticated())return h.fetchWithAuth(t);const n={"Content-Type":"application/json"};m&&(n["X-API-Key"]=m);const r=await fetch(`${o}${t}`,{headers:n});if(!r.ok)throw new Error(`Request failed: ${r.status}`);return r.json()},[o,m,h]);s.useEffect(()=>{let t=!1;return _(!0),g(null),l("/admin/products?limit=100&offset=0").then(n=>{if(t)return;const r=Array.isArray(n)?n:n.products??[];N(r)}).catch(n=>{t||(S.getLogger().error("[InventorySection] Failed to load products:",n,{serverUrl:o.slice(0,20)+"..."}),g("Failed to load products"))}).finally(()=>{t||_(!1)}),()=>{t=!0}},[l,o]);const v=s.useCallback(async(t,n)=>{if(t){p(!0),f(null);try{const r=`/admin/products/${encodeURIComponent(t)}/inventory/adjustments?limit=${c}&offset=${n}`,F=await l(r);j(F.adjustments??[])}catch(r){S.getLogger().error("[InventorySection] Failed to load adjustments:",r,{productId:t,serverUrl:o.slice(0,20)+"..."}),f("Failed to load inventory adjustments"),j([])}finally{p(!1)}}},[l,o]);s.useEffect(()=>{d&&v(d,a)},[v,d,a]);const C=t=>{w(t),x(0),j([]),f(null)},q=()=>x(t=>Math.max(0,t-c)),$=()=>x(t=>t+c),u=y.find(t=>t.id===d);return e.jsxs("div",{className:"cedros-admin__page",children:[e.jsx(L.ErrorBanner,{message:P??I}),e.jsx("div",{className:"cedros-admin__section-header",children:e.jsx("h3",{className:"cedros-admin__section-title",children:"Inventory Adjustments"})}),e.jsx("div",{className:"cedros-admin__add-form",style:{marginBottom:"1rem"},children:e.jsx("div",{className:"cedros-admin__form-row",children:e.jsxs("div",{className:"cedros-admin__field",style:{flex:1},children:[e.jsx("label",{htmlFor:"inventory-product-select",className:"cedros-admin__field-label",children:"Select Product"}),A?e.jsxs("div",{className:"cedros-admin__loading",children:[b.Icons.loading," Loading products..."]}):e.jsxs("select",{id:"inventory-product-select",className:"cedros-admin__input",value:d,onChange:t=>C(t.target.value),"aria-label":"Select product to view inventory adjustments",children:[e.jsx("option",{value:"",children:"-- Choose a product --"}),y.map(t=>e.jsx("option",{value:t.id,children:t.title??t.description??t.id},t.id))]})]})})}),d?E?e.jsxs("div",{className:"cedros-admin__loading",children:[b.Icons.loading," Loading adjustments..."]}):e.jsxs(e.Fragment,{children:[u&&e.jsxs("p",{style:{marginBottom:"0.75rem",fontSize:"0.9rem",opacity:.7},children:["Showing adjustments for: ",e.jsx("strong",{children:u.title??u.description??u.id})]}),i.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"No inventory adjustments found."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"cedros-admin__table-container",children:e.jsxs("table",{className:"cedros-admin__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Date"}),e.jsx("th",{children:"Delta"}),e.jsx("th",{children:"Before"}),e.jsx("th",{children:"After"}),e.jsx("th",{children:"Reason"}),e.jsx("th",{children:"Actor"})]})}),e.jsx("tbody",{children:i.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{whiteSpace:"nowrap"},children:B.formatDateTime(t.createdAt)}),e.jsx("td",{children:e.jsx("span",{style:{fontWeight:600,color:t.delta>0?"var(--cedros-success, #16a34a)":t.delta<0?"var(--cedros-danger, #dc2626)":void 0},"aria-label":`Delta: ${t.delta>0?"plus":""}${t.delta}`,children:t.delta>0?`+${t.delta}`:t.delta})}),e.jsx("td",{children:t.quantityBefore}),e.jsx("td",{children:t.quantityAfter}),e.jsx("td",{children:t.reason??e.jsx("span",{style:{opacity:.45},children:"—"})}),e.jsx("td",{children:t.actor??e.jsx("span",{style:{opacity:.45},children:"—"})})]},t.id))})]})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"0.75rem",fontSize:"0.85rem"},children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",disabled:a===0,onClick:q,children:"Previous"}),e.jsxs("span",{children:["Page ",Math.floor(a/c)+1," · ",i.length," record",i.length!==1?"s":""]}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",disabled:i.length<c,onClick:$,children:"Next"})]})]})]}):e.jsx("div",{className:"cedros-admin__empty",children:"Select a product to view its inventory adjustments."})]})}exports.InventorySection=k;
@@ -0,0 +1,9 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { Suspense as r, lazy as d } from "react";
3
+ const n = d(async () => ({ default: (await import("./CedrosPayAdminDashboard-DaJ9JoGn.mjs")).CedrosPayAdminDashboard }));
4
+ function m(a) {
5
+ return /* @__PURE__ */ o(r, { fallback: null, children: /* @__PURE__ */ o(n, { ...a }) });
6
+ }
7
+ export {
8
+ m as C
9
+ };
@@ -0,0 +1 @@
1
+ "use strict";const r=require("react/jsx-runtime"),s=require("react"),a=s.lazy(async()=>({default:(await Promise.resolve().then(()=>require("./CedrosPayAdminDashboard-Uvyh9p7A.js"))).CedrosPayAdminDashboard}));function n(e){return r.jsx(s.Suspense,{fallback:null,children:r.jsx(a,{...e})})}exports.CedrosPayAdminDashboard=n;
@@ -1,9 +1,10 @@
1
1
  import { jsxs as i, jsx as e, Fragment as R } from "react/jsx-runtime";
2
2
  import { useState as _, useCallback as k, useEffect as U } from "react";
3
- import { I as $, E as q } from "./index-DXnuQp5x.mjs";
3
+ import { I as $ } from "./icons-C3yDMnKE.mjs";
4
+ import { E as q } from "./ErrorBanner-lZJhCmDX.mjs";
4
5
  import { T as C } from "./Toggle-DAxIdpY4.mjs";
5
6
  import { u as F } from "./useAutosave-YwMqRzqy.mjs";
6
- import { A as j } from "./AutosaveIndicator-Bed0-ekg.mjs";
7
+ import { A as j } from "./AutosaveIndicator-3ctAnz8Y.mjs";
7
8
  const u = {
8
9
  mailgun: { label: "Mailgun", host: "smtp.mailgun.org", username: "", credentialLabel: "SMTP Password", showUsername: !0, usernameEqualsPassword: !1 },
9
10
  sendgrid: { label: "SendGrid", host: "smtp.sendgrid.net", username: "apikey", credentialLabel: "API Key", showUsername: !1, usernameEqualsPassword: !1 },
@@ -32,7 +33,7 @@ const y = {
32
33
  webhook_secret: "",
33
34
  webhook_timeout: 30
34
35
  };
35
- function V({ serverUrl: m, apiKey: l, authManager: d }) {
36
+ function Y({ serverUrl: m, apiKey: l, authManager: d }) {
36
37
  const [c, f] = _("messages"), [s, h] = _(y), [E, P] = _(!0), [x, T] = _(!0), [A, g] = _(null), [b, S] = _(/* @__PURE__ */ new Set()), v = k(async () => {
37
38
  try {
38
39
  g(null);
@@ -390,5 +391,5 @@ function V({ serverUrl: m, apiKey: l, authManager: d }) {
390
391
  ] });
391
392
  }
392
393
  export {
393
- V as MessagingSection
394
+ Y as MessagingSection
394
395
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),q=require("./icons-Cjgd9YVo.js"),M=require("./ErrorBanner-CAgPnj62.js"),y=require("./Toggle-CsPSF8Dr.js"),z=require("./useAutosave-B2p6iwh8.js"),R=require("./AutosaveIndicator-DXRPr4P7.js"),p={mailgun:{label:"Mailgun",host:"smtp.mailgun.org",username:"",credentialLabel:"SMTP Password",showUsername:!0,usernameEqualsPassword:!1},sendgrid:{label:"SendGrid",host:"smtp.sendgrid.net",username:"apikey",credentialLabel:"API Key",showUsername:!1,usernameEqualsPassword:!1},postmark:{label:"Postmark",host:"smtp.postmarkapp.com",username:"",credentialLabel:"Server API Token",showUsername:!1,usernameEqualsPassword:!0},ses:{label:"AWS SES",host:"email-smtp.us-east-1.amazonaws.com",username:"",credentialLabel:"SMTP Password",showUsername:!0,usernameEqualsPassword:!1},resend:{label:"Resend",host:"smtp.resend.com",username:"resend",credentialLabel:"API Key",showUsername:!1,usernameEqualsPassword:!1},custom:{label:"Custom SMTP",host:"",username:"",credentialLabel:"SMTP Password",showUsername:!0,usernameEqualsPassword:!1}};function W(c){if(!c)return"custom";for(const[d,n]of Object.entries(p))if(n.host&&c===n.host)return d;return"custom"}const v={email_enabled:!1,email_provider:"custom",smtp_host:"",smtp_port:587,smtp_username:"",smtp_password:"",from_email:"",from_name:"",webhook_enabled:!1,webhook_url:"",webhook_secret:"",webhook_timeout:30};function U({serverUrl:c,apiKey:d,authManager:n}){const[m,b]=l.useState("messages"),[a,h]=l.useState(v),[S,N]=l.useState(!0),[k,C]=l.useState(!0),[E,f]=l.useState(null),[_,j]=l.useState(new Set),g=l.useCallback(async()=>{try{f(null);let s;const t="/admin/config/messaging";if(n?.isAuthenticated())s=await n.fetchWithAuth(t);else{const o={"Content-Type":"application/json"};d&&(o["X-API-Key"]=d);const u=await fetch(`${c}${t}`,{headers:o});if(!u.ok)throw new Error(`Failed to fetch: ${u.status}`);s=await u.json()}const i={...v,...s.config};i.email_provider||(i.email_provider=W(i.smtp_host)),h(i)}catch{h(v),f("Could not load saved settings. Showing defaults.")}finally{N(!1),setTimeout(()=>C(!1),100)}},[c,d,n]);l.useEffect(()=>{g()},[g]);const P=l.useCallback(async s=>{const t="/admin/config/messaging",i={...s};_.has("smtp_password")||delete i.smtp_password,_.has("webhook_secret")||delete i.webhook_secret;const o=JSON.stringify({config:i});try{if(n?.isAuthenticated())await n.fetchWithAuth(t,{method:"PUT",body:o});else{const u={"Content-Type":"application/json"};d&&(u["X-API-Key"]=d);const w=await fetch(`${c}${t}`,{method:"PUT",headers:u,body:o});if(!w.ok)throw new Error(`Failed to save: ${w.status}`)}}catch{throw f("Failed to save messaging settings"),new Error("Save failed")}},[c,d,n,_]),{status:T,error:A}=z.useAutosave({data:a,onSave:P,debounceMs:1500,enabled:!k}),r=(s,t)=>{(s==="smtp_password"||s==="webhook_secret")&&j(i=>new Set(i).add(s)),h(i=>({...i,[s]:t}))},I=s=>{const t=p[s];h(i=>({...i,email_provider:s,smtp_host:t.host||i.smtp_host,smtp_port:587,smtp_username:t.username||(t.showUsername?i.smtp_username:"")}))},L=s=>{const t=a.email_provider||"custom",i=p[t];j(o=>new Set(o).add("smtp_password")),i.usernameEqualsPassword?h(o=>({...o,smtp_password:s,smtp_username:s})):h(o=>({...o,smtp_password:s}))},x=p[a.email_provider||"custom"]??p.custom;return S?e.jsxs("div",{className:"cedros-admin__messaging-settings",children:[e.jsxs("div",{className:"cedros-admin__page-header",children:[e.jsx("h2",{className:"cedros-admin__page-title",children:"Store Messages"}),e.jsx("p",{className:"cedros-admin__page-description",children:"Configure email delivery and webhook notifications."})]}),e.jsxs("div",{className:"cedros-admin__loading",style:{marginTop:"1rem"},children:[q.Icons.loading," Loading message settings..."]})]}):e.jsxs("div",{className:"cedros-admin__messaging-settings",children:[e.jsxs("div",{className:"cedros-admin__page-header",children:[e.jsx("h2",{className:"cedros-admin__page-title",children:"Store Messages"}),e.jsx("p",{className:"cedros-admin__page-description",children:"Configure email delivery and webhook notifications."})]}),e.jsxs("div",{className:"cedros-admin__tabs cedros-admin__tabs--line",children:[e.jsx("button",{type:"button",className:`cedros-admin__tab ${m==="messages"?"cedros-admin__tab--active":""}`,onClick:()=>b("messages"),children:"Messages"}),e.jsx("button",{type:"button",className:`cedros-admin__tab ${m==="email"?"cedros-admin__tab--active":""}`,onClick:()=>b("email"),children:"Email"}),e.jsx("button",{type:"button",className:`cedros-admin__tab ${m==="webhooks"?"cedros-admin__tab--active":""}`,onClick:()=>b("webhooks"),children:"Webhooks"}),e.jsx("div",{style:{flex:1}}),e.jsx(R.AutosaveIndicator,{status:T,error:A})]}),e.jsx(M.ErrorBanner,{message:E,onRetry:g}),e.jsxs("div",{className:"cedros-admin__tab-content",style:{marginTop:"1rem"},children:[m==="messages"&&e.jsxs("div",{className:"cedros-admin__section",children:[e.jsx("p",{style:{marginBottom:"1.5rem",fontSize:"0.875rem",opacity:.7},children:"Enable or disable notification types. Configure the delivery settings in the Email or Webhooks tab."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"1rem",padding:"1rem",border:"1px solid var(--cedros-admin-border, #e5e5e5)",borderRadius:"0.5rem"},children:[e.jsx(y.Toggle,{checked:a.email_enabled,onChange:s=>r("email_enabled",s)}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:"Email Confirmation"}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:"0.8125rem",opacity:.6},children:"Send order confirmation emails to customers after successful purchase."}),e.jsx("p",{style:{margin:"0.5rem 0 0",fontSize:"0.75rem",opacity:.5},children:"Requires Email configuration"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"1rem",padding:"1rem",border:"1px solid var(--cedros-admin-border, #e5e5e5)",borderRadius:"0.5rem"},children:[e.jsx(y.Toggle,{checked:a.webhook_enabled,onChange:s=>r("webhook_enabled",s)}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:"Admin Purchase Notification"}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:"0.8125rem",opacity:.6},children:"Send webhook notifications to your server when a purchase is completed."}),e.jsx("p",{style:{margin:"0.5rem 0 0",fontSize:"0.75rem",opacity:.5},children:"Requires Webhook configuration"})]})]})]})]}),m==="email"&&e.jsxs("div",{className:"cedros-admin__section",children:[e.jsx("p",{style:{marginBottom:"1.5rem",fontSize:"0.875rem",opacity:.7},children:"Select your email service provider for automatic configuration."}),!a.email_enabled&&e.jsx("div",{style:{padding:"1rem",marginBottom:"1.5rem",background:"var(--cedros-admin-bg-accent, #fef3c7)",borderRadius:"0.5rem",border:"1px solid var(--cedros-admin-warning, #f59e0b)",fontSize:"0.875rem"},children:"Email notifications are disabled. Enable them in the Messages tab."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",opacity:a.email_enabled?1:.5},children:[e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Email Provider"}),e.jsx("select",{className:"cedros-admin__input",value:a.email_provider||"custom",onChange:s=>I(s.target.value),disabled:!a.email_enabled,children:Object.entries(p).map(([s,{label:t}])=>e.jsx("option",{value:s,children:t},s))})]}),a.email_provider==="custom"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"SMTP Host"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:a.smtp_host,onChange:s=>r("smtp_host",s.target.value),placeholder:"smtp.example.com",disabled:!a.email_enabled})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"SMTP Port"}),e.jsx("input",{type:"number",className:"cedros-admin__input",value:a.smtp_port,onChange:s=>r("smtp_port",parseInt(s.target.value)||587),placeholder:"587",disabled:!a.email_enabled,style:{maxWidth:120}}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:"0.75rem",opacity:.6},children:"Common: 587 (TLS), 465 (SSL), 25 (unencrypted)."})]})]}),x.showUsername&&e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"SMTP Username"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:a.smtp_username,onChange:s=>r("smtp_username",s.target.value),placeholder:a.email_provider==="mailgun"?"postmaster@your-domain.com":"username",disabled:!a.email_enabled})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:x.credentialLabel}),e.jsx("input",{type:"password",className:"cedros-admin__input",value:_.has("smtp_password")?a.smtp_password:"",onChange:s=>L(s.target.value),placeholder:a.smtp_password?"••••••••":`Enter ${x.credentialLabel.toLowerCase()}`,disabled:!a.email_enabled})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"From Email"}),e.jsx("input",{type:"email",className:"cedros-admin__input",value:a.from_email,onChange:s=>r("from_email",s.target.value),placeholder:"noreply@example.com",disabled:!a.email_enabled}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:"0.75rem",opacity:.6},children:"Default sender email address."})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"From Name"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:a.from_name,onChange:s=>r("from_name",s.target.value),placeholder:"Your Store",disabled:!a.email_enabled}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:"0.75rem",opacity:.6},children:"Default sender display name."})]})]})]}),m==="webhooks"&&e.jsxs("div",{className:"cedros-admin__section",children:[e.jsx("p",{style:{marginBottom:"1.5rem",fontSize:"0.875rem",opacity:.7},children:"Configure webhook endpoint for receiving purchase notifications."}),!a.webhook_enabled&&e.jsx("div",{style:{padding:"1rem",marginBottom:"1.5rem",background:"var(--cedros-admin-bg-accent, #fef3c7)",borderRadius:"0.5rem",border:"1px solid var(--cedros-admin-warning, #f59e0b)",fontSize:"0.875rem"},children:"Webhook notifications are disabled. Enable them in the Messages tab."}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",opacity:a.webhook_enabled?1:.5},children:[e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Webhook URL"}),e.jsx("input",{type:"url",className:"cedros-admin__input",value:a.webhook_url,onChange:s=>r("webhook_url",s.target.value),placeholder:"https://api.yoursite.com/webhooks/orders",disabled:!a.webhook_enabled})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Webhook Secret"}),e.jsx("input",{type:"password",className:"cedros-admin__input",value:_.has("webhook_secret")?a.webhook_secret:"",onChange:s=>r("webhook_secret",s.target.value),placeholder:a.webhook_secret?"••••••••":"Enter secret for HMAC-SHA256",disabled:!a.webhook_enabled}),e.jsx("p",{style:{margin:"0.25rem 0 0",fontSize:"0.75rem",opacity:.6},children:"Used for HMAC-SHA256 signature verification"})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Timeout (seconds)"}),e.jsx("input",{type:"number",className:"cedros-admin__input",value:a.webhook_timeout,onChange:s=>r("webhook_timeout",parseInt(s.target.value)||30),placeholder:"30",disabled:!a.webhook_enabled,style:{maxWidth:120}})]})]})]})]})]})}exports.MessagingSection=U;
@@ -1,25 +1,28 @@
1
1
  import { jsxs as i, jsx as e, Fragment as $ } from "react/jsx-runtime";
2
- import { useState as r, useCallback as N, useEffect as U } from "react";
3
- import { I as z, E as G, k as F, s as L } from "./index-DXnuQp5x.mjs";
4
- function J({ serverUrl: a, apiKey: s, pageSize: m = 20, authManager: l }) {
5
- const [c, t] = r([]), [o, y] = r(0), [R, x] = r(!0), [S, C] = r(null), [h, k] = r(null), [D, v] = r(null), [E, b] = r([]), [O, w] = r(!1), [f, T] = r(""), g = N(async (n, d) => {
2
+ import { useState as s, useCallback as N, useEffect as U } from "react";
3
+ import { I as z } from "./icons-C3yDMnKE.mjs";
4
+ import { E as G } from "./ErrorBanner-lZJhCmDX.mjs";
5
+ import { f as F } from "./dateHelpers-yvPkofYQ.mjs";
6
+ import { s as k } from "./safeHref-DqJPLPl5.mjs";
7
+ function Y({ serverUrl: a, apiKey: r, pageSize: m = 20, authManager: l }) {
8
+ const [c, t] = s([]), [o, y] = s(0), [R, x] = s(!0), [S, C] = s(null), [h, w] = s(null), [D, v] = s(null), [E, b] = s([]), [O, L] = s(!1), [g, T] = s(""), f = N(async (n, d) => {
6
9
  if (l?.isAuthenticated())
7
10
  return l.fetchWithAuth(n, d);
8
11
  const _ = { "Content-Type": "application/json" };
9
- s && (_["X-API-Key"] = s);
12
+ r && (_["X-API-Key"] = r);
10
13
  const u = await fetch(`${a}${n}`, { ...d, headers: { ..._, ...d?.headers } });
11
14
  if (!u.ok) {
12
15
  const P = await u.text().catch(() => `HTTP ${u.status}`);
13
16
  throw new Error(P);
14
17
  }
15
18
  return u.json();
16
- }, [a, s, l]), p = N(async () => {
19
+ }, [a, r, l]), p = N(async () => {
17
20
  x(!0);
18
21
  try {
19
22
  C(null);
20
23
  const n = new URLSearchParams({ limit: String(m) });
21
- f && n.set("status", f);
22
- const d = await g(
24
+ g && n.set("status", g);
25
+ const d = await f(
23
26
  `/admin/orders?${n}`
24
27
  );
25
28
  t(d.orders), y(d.total);
@@ -28,25 +31,25 @@ function J({ serverUrl: a, apiKey: s, pageSize: m = 20, authManager: l }) {
28
31
  } finally {
29
32
  x(!1);
30
33
  }
31
- }, [g, m, f]);
34
+ }, [f, m, g]);
32
35
  U(() => {
33
36
  p();
34
37
  }, [p]);
35
38
  const A = N(async (n) => {
36
- w(!0);
39
+ L(!0);
37
40
  try {
38
41
  const [d, _] = await Promise.all([
39
- g(`/admin/orders/${encodeURIComponent(n)}`),
40
- g("/admin/gift-card-redemptions?limit=50").catch(() => [])
42
+ f(`/admin/orders/${encodeURIComponent(n)}`),
43
+ f("/admin/gift-card-redemptions?limit=50").catch(() => [])
41
44
  ]);
42
45
  v(d), b(_.filter((u) => u.orderId === n));
43
46
  } catch {
44
47
  v(null), b([]);
45
48
  } finally {
46
- w(!1);
49
+ L(!1);
47
50
  }
48
- }, [g]), j = (n) => {
49
- h === n ? (k(null), v(null), b([])) : (k(n), A(n));
51
+ }, [f]), j = (n) => {
52
+ h === n ? (w(null), v(null), b([])) : (w(n), A(n));
50
53
  }, B = (n, d) => d === "USD" || d === "usd" ? `$${(n / 100).toFixed(2)}` : `${n} ${d}`;
51
54
  return /* @__PURE__ */ i("div", { className: "cedros-admin__section", children: [
52
55
  /* @__PURE__ */ i("div", { className: "cedros-admin__section-header", children: [
@@ -57,7 +60,7 @@ function J({ serverUrl: a, apiKey: s, pageSize: m = 20, authManager: l }) {
57
60
  {
58
61
  className: "cedros-admin__input",
59
62
  style: { width: "auto", minWidth: "120px" },
60
- value: f,
63
+ value: g,
61
64
  onChange: (n) => T(n.target.value),
62
65
  children: [
63
66
  /* @__PURE__ */ e("option", { value: "", children: "All statuses" }),
@@ -113,7 +116,7 @@ function J({ serverUrl: a, apiKey: s, pageSize: m = 20, authManager: l }) {
113
116
  }
114
117
  function H({
115
118
  order: a,
116
- expanded: s,
119
+ expanded: r,
117
120
  detail: m,
118
121
  redemptions: l,
119
122
  detailLoading: c,
@@ -127,7 +130,7 @@ function H({
127
130
  {
128
131
  onClick: t,
129
132
  style: { cursor: "pointer" },
130
- className: s ? "cedros-admin__table-row--active" : "",
133
+ className: r ? "cedros-admin__table-row--active" : "",
131
134
  children: [
132
135
  /* @__PURE__ */ i("td", { children: [
133
136
  /* @__PURE__ */ i("span", { className: "cedros-admin__mono", children: [
@@ -144,7 +147,7 @@ function H({
144
147
  ]
145
148
  }
146
149
  ),
147
- s ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 6, style: { padding: 0 }, children: /* @__PURE__ */ e(
150
+ r ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 6, style: { padding: 0 }, children: /* @__PURE__ */ e(
148
151
  W,
149
152
  {
150
153
  detail: m,
@@ -158,7 +161,7 @@ function H({
158
161
  }
159
162
  function W({
160
163
  detail: a,
161
- redemptions: s,
164
+ redemptions: r,
162
165
  loading: m,
163
166
  formatAmount: l,
164
167
  metadata: c
@@ -171,9 +174,9 @@ function W({
171
174
  /* @__PURE__ */ e("span", { children: o })
172
175
  ] }, t)) })
173
176
  ] }) : null,
174
- s.length > 0 ? /* @__PURE__ */ i("div", { style: { marginBottom: "1rem" }, children: [
177
+ r.length > 0 ? /* @__PURE__ */ i("div", { style: { marginBottom: "1rem" }, children: [
175
178
  /* @__PURE__ */ e("div", { className: "cedros-admin__label", children: "Gift Card Fulfillment" }),
176
- s.map((t) => /* @__PURE__ */ i("div", { style: { fontSize: "0.8125rem", padding: "0.5rem", border: "1px solid var(--cedros-admin-border)", borderRadius: "0.5rem", marginBottom: "0.5rem" }, children: [
179
+ r.map((t) => /* @__PURE__ */ i("div", { style: { fontSize: "0.8125rem", padding: "0.5rem", border: "1px solid var(--cedros-admin-border)", borderRadius: "0.5rem", marginBottom: "0.5rem" }, children: [
177
180
  /* @__PURE__ */ i("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
178
181
  /* @__PURE__ */ i("span", { children: [
179
182
  "Face value: ",
@@ -193,7 +196,7 @@ function W({
193
196
  a.fulfillments.map((t) => /* @__PURE__ */ i("div", { style: { fontSize: "0.8125rem", marginBottom: "0.25rem" }, children: [
194
197
  /* @__PURE__ */ e("span", { className: `cedros-admin__badge cedros-admin__badge--${I(t.status)}`, children: t.status }),
195
198
  t.carrier ? /* @__PURE__ */ e("span", { style: { marginLeft: "0.5rem" }, children: t.carrier }) : null,
196
- t.trackingNumber ? L(t.trackingUrl) ? /* @__PURE__ */ e("a", { href: L(t.trackingUrl), target: "_blank", rel: "noreferrer", style: { marginLeft: "0.5rem" }, children: t.trackingNumber }) : /* @__PURE__ */ e("span", { style: { marginLeft: "0.5rem" }, children: t.trackingNumber }) : null
199
+ t.trackingNumber ? k(t.trackingUrl) ? /* @__PURE__ */ e("a", { href: k(t.trackingUrl), target: "_blank", rel: "noreferrer", style: { marginLeft: "0.5rem" }, children: t.trackingNumber }) : /* @__PURE__ */ e("span", { style: { marginLeft: "0.5rem" }, children: t.trackingNumber }) : null
197
200
  ] }, t.id))
198
201
  ] }) : null,
199
202
  a?.history && a.history.length > 0 ? /* @__PURE__ */ i("div", { children: [
@@ -229,5 +232,5 @@ function I(a) {
229
232
  }
230
233
  }
231
234
  export {
232
- J as OrdersSection
235
+ Y as OrdersSection
233
236
  };