@cedros/pay-react 1.1.25 → 1.1.26

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 (94) hide show
  1. package/dist/{AISettingsSection-Dg1kazTI.mjs → AISettingsSection-BlIv3CzS.mjs} +2 -2
  2. package/dist/{AISettingsSection-BvSSiK2G.js → AISettingsSection-DELur7D2.js} +1 -1
  3. package/dist/{AutosaveIndicator-BHfkV59p.mjs → AutosaveIndicator-Bed0-ekg.mjs} +1 -1
  4. package/dist/{AutosaveIndicator-D2l7U8R1.js → AutosaveIndicator-Dn_qA2hK.js} +1 -1
  5. package/dist/ChatLogsSection-BH5tLA4T.js +1 -0
  6. package/dist/ChatLogsSection-v4zwzCTC.mjs +201 -0
  7. package/dist/{ComplianceSection-BSE2f3Wo.mjs → ComplianceSection-CemgfDrL.mjs} +282 -166
  8. package/dist/ComplianceSection-DP2a9-S0.js +1 -0
  9. package/dist/CustomersSection-CBwy_waO.js +1 -0
  10. package/dist/CustomersSection-D_j7OrfS.mjs +207 -0
  11. package/dist/DisputesSection-BLjIk60n.js +1 -0
  12. package/dist/DisputesSection-BcAbXp3K.mjs +230 -0
  13. package/dist/{FAQSection-uZG5V3pJ.mjs → FAQSection-Dn38OhB_.mjs} +1 -1
  14. package/dist/{FAQSection-6nGI0FK9.js → FAQSection-wNeH0i6Q.js} +1 -1
  15. package/dist/ImagesSection-0ZzKlzMJ.js +1 -0
  16. package/dist/ImagesSection-Ctw9Icym.mjs +216 -0
  17. package/dist/InventorySection-DmhjUlRZ.mjs +150 -0
  18. package/dist/InventorySection-zV6lTmue.js +1 -0
  19. package/dist/{MessagingSection-M0lj5yo4.mjs → MessagingSection-B1FaGxkp.mjs} +2 -2
  20. package/dist/{MessagingSection-DrXb578q.js → MessagingSection-B_wdFR0j.js} +1 -1
  21. package/dist/{OrdersSection-DteItv_O.mjs → OrdersSection-Bj8bPdg8.mjs} +1 -1
  22. package/dist/{OrdersSection-_-rIw6XW.js → OrdersSection-Dw2FX-1d.js} +1 -1
  23. package/dist/{PaymentSettingsSection-enTbUI95.js → PaymentSettingsSection-BYF4D-GR.js} +1 -1
  24. package/dist/{PaymentSettingsSection-CdtdLFTg.mjs → PaymentSettingsSection-EnMxeWjv.mjs} +1 -1
  25. package/dist/ReturnsSection-BC0L8r2e.mjs +267 -0
  26. package/dist/ReturnsSection-D_pJVxuG.js +1 -0
  27. package/dist/{SettingsSection-mcT4LEhO.mjs → SettingsSection-KYdEizq_.mjs} +1 -1
  28. package/dist/{SettingsSection-DUTEd6uV.js → SettingsSection-vdYFSNxB.js} +1 -1
  29. package/dist/ShippingSection-1DRSTu49.js +1 -0
  30. package/dist/ShippingSection-BOgto6_9.mjs +434 -0
  31. package/dist/{SingleCategorySettings-D2LVM5mn.js → SingleCategorySettings-DwCnBdRf.js} +1 -1
  32. package/dist/{SingleCategorySettings-BvHBVfSe.mjs → SingleCategorySettings-suJ8z9d8.mjs} +2 -2
  33. package/dist/{StorefrontSection-BqQ36JIS.mjs → StorefrontSection-BRvIGBEJ.mjs} +2 -2
  34. package/dist/{StorefrontSection-Du7hV2Gc.js → StorefrontSection-RumGkb3C.js} +1 -1
  35. package/dist/{SubscriptionsSection-C4BRN1dP.js → SubscriptionsSection-C2aLLn7L.js} +1 -1
  36. package/dist/{SubscriptionsSection-BYiCBwKZ.mjs → SubscriptionsSection-D60qrX9a.mjs} +1 -1
  37. package/dist/TaxSection-C7-pv-Rl.mjs +294 -0
  38. package/dist/TaxSection-Dt1DnM51.js +1 -0
  39. package/dist/{Token22Section-BHvOhz5d.mjs → Token22Section-CrHLQ0EB.mjs} +1 -1
  40. package/dist/{Token22Section-0c22NM5G.js → Token22Section-DY3mUwTY.js} +1 -1
  41. package/dist/WebhooksSection-CKeiJ7Py.js +1 -0
  42. package/dist/WebhooksSection-COPW4Ec0.mjs +223 -0
  43. package/dist/crypto-only.js +1 -1
  44. package/dist/crypto-only.mjs +1 -1
  45. package/dist/index-C0g-JxJk.js +84 -0
  46. package/dist/{index-BkDimQDF.mjs → index-DXnuQp5x.mjs} +7068 -6768
  47. package/dist/index.js +1 -1
  48. package/dist/index.mjs +1 -1
  49. package/dist/{sections-By4H1baL.mjs → sections-C1NpK7hk.mjs} +2 -2
  50. package/dist/{sections-5jO2aHAo.js → sections-DVVSZBhW.js} +1 -1
  51. package/dist/src/components/ComplianceGatePage.d.ts +3 -1
  52. package/dist/src/components/ComplianceGatePage.d.ts.map +1 -1
  53. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts +1 -1
  54. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts.map +1 -1
  55. package/dist/src/components/admin/ChatLogsSection.d.ts +3 -0
  56. package/dist/src/components/admin/ChatLogsSection.d.ts.map +1 -0
  57. package/dist/src/components/admin/ComplianceKycTab.d.ts +3 -0
  58. package/dist/src/components/admin/ComplianceKycTab.d.ts.map +1 -0
  59. package/dist/src/components/admin/ComplianceRequirementsEditor.d.ts +8 -0
  60. package/dist/src/components/admin/ComplianceRequirementsEditor.d.ts.map +1 -0
  61. package/dist/src/components/admin/ComplianceSection.d.ts.map +1 -1
  62. package/dist/src/components/admin/CustomersSection.d.ts +3 -0
  63. package/dist/src/components/admin/CustomersSection.d.ts.map +1 -0
  64. package/dist/src/components/admin/DisputesSection.d.ts +3 -0
  65. package/dist/src/components/admin/DisputesSection.d.ts.map +1 -0
  66. package/dist/src/components/admin/ImagesSection.d.ts +3 -0
  67. package/dist/src/components/admin/ImagesSection.d.ts.map +1 -0
  68. package/dist/src/components/admin/InventorySection.d.ts +3 -0
  69. package/dist/src/components/admin/InventorySection.d.ts.map +1 -0
  70. package/dist/src/components/admin/NftMetadataPreview.d.ts +20 -0
  71. package/dist/src/components/admin/NftMetadataPreview.d.ts.map +1 -0
  72. package/dist/src/components/admin/ProductsSection.d.ts.map +1 -1
  73. package/dist/src/components/admin/ReturnsSection.d.ts +3 -0
  74. package/dist/src/components/admin/ReturnsSection.d.ts.map +1 -0
  75. package/dist/src/components/admin/ShippingSection.d.ts +3 -0
  76. package/dist/src/components/admin/ShippingSection.d.ts.map +1 -0
  77. package/dist/src/components/admin/TaxSection.d.ts +3 -0
  78. package/dist/src/components/admin/TaxSection.d.ts.map +1 -0
  79. package/dist/src/components/admin/WebhooksSection.d.ts +3 -0
  80. package/dist/src/components/admin/WebhooksSection.d.ts.map +1 -0
  81. package/dist/src/components/admin/complianceTypes.d.ts +15 -1
  82. package/dist/src/components/admin/complianceTypes.d.ts.map +1 -1
  83. package/dist/src/ecommerce/adapters/CommerceAdapter.d.ts +36 -0
  84. package/dist/src/ecommerce/adapters/CommerceAdapter.d.ts.map +1 -1
  85. package/dist/src/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -1
  86. package/dist/src/ecommerce/components/chat/ShopChatPanel.d.ts +8 -5
  87. package/dist/src/ecommerce/components/chat/ShopChatPanel.d.ts.map +1 -1
  88. package/dist/src/ecommerce/index.d.ts +2 -2
  89. package/dist/src/ecommerce/index.d.ts.map +1 -1
  90. package/dist/src/hooks/useComplianceCheck.d.ts +1 -1
  91. package/dist/src/hooks/useComplianceCheck.d.ts.map +1 -1
  92. package/package.json +1 -1
  93. package/dist/ComplianceSection-D6ETKG6b.js +0 -1
  94. package/dist/index-C7MWL6O8.js +0 -84
@@ -0,0 +1,267 @@
1
+ import { jsx as e, jsxs as n, Fragment as U } from "react/jsx-runtime";
2
+ import { useState as l, useCallback as R, useEffect as D } from "react";
3
+ import { E as O, I as $, k as b } from "./index-DXnuQp5x.mjs";
4
+ const C = ["requested", "approved", "rejected", "received", "refunded"], W = (d) => {
5
+ switch (d) {
6
+ case "approved":
7
+ return "success";
8
+ case "refunded":
9
+ return "success";
10
+ case "rejected":
11
+ return "failed";
12
+ case "received":
13
+ return "muted";
14
+ case "requested":
15
+ return "pending";
16
+ default:
17
+ return "muted";
18
+ }
19
+ };
20
+ function q({ returnRequest: d, onBack: m, onStatusUpdated: c, onError: u, fetchWithAuth: s }) {
21
+ const [r, v] = l(d.status), [_, p] = l(!1), o = async () => {
22
+ if (!(!r || r === d.status)) {
23
+ p(!0);
24
+ try {
25
+ const a = await s(
26
+ `/admin/returns/${encodeURIComponent(d.id)}/status`,
27
+ { method: "PUT", body: JSON.stringify({ status: r }) }
28
+ );
29
+ c(a);
30
+ } catch {
31
+ u("Failed to update return status");
32
+ } finally {
33
+ p(!1);
34
+ }
35
+ }
36
+ };
37
+ return /* @__PURE__ */ n("div", { children: [
38
+ /* @__PURE__ */ e(
39
+ "button",
40
+ {
41
+ type: "button",
42
+ className: "cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",
43
+ onClick: m,
44
+ style: { marginBottom: "1rem" },
45
+ children: "← Back to returns"
46
+ }
47
+ ),
48
+ /* @__PURE__ */ e("div", { className: "cedros-admin__section-header", children: /* @__PURE__ */ n("h3", { className: "cedros-admin__section-title", children: [
49
+ "Return ",
50
+ /* @__PURE__ */ e("code", { style: { fontSize: "0.8rem" }, children: d.id.slice(0, 12) }),
51
+ /* @__PURE__ */ e(
52
+ "span",
53
+ {
54
+ className: `cedros-admin__badge cedros-admin__badge--${W(d.status)}`,
55
+ style: { marginLeft: "0.5rem" },
56
+ children: d.status
57
+ }
58
+ )
59
+ ] }) }),
60
+ /* @__PURE__ */ e("div", { className: "cedros-admin__table-container", style: { maxWidth: "500px", marginBottom: "1rem" }, children: /* @__PURE__ */ e("table", { className: "cedros-admin__table", children: /* @__PURE__ */ n("tbody", { children: [
61
+ /* @__PURE__ */ n("tr", { children: [
62
+ /* @__PURE__ */ e("td", { style: { fontWeight: 600, width: "35%" }, children: "Order ID" }),
63
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { children: d.orderId }) })
64
+ ] }),
65
+ d.reason && /* @__PURE__ */ n("tr", { children: [
66
+ /* @__PURE__ */ e("td", { style: { fontWeight: 600 }, children: "Reason" }),
67
+ /* @__PURE__ */ e("td", { children: d.reason })
68
+ ] }),
69
+ /* @__PURE__ */ n("tr", { children: [
70
+ /* @__PURE__ */ e("td", { style: { fontWeight: 600 }, children: "Created" }),
71
+ /* @__PURE__ */ e("td", { children: b(d.createdAt) })
72
+ ] }),
73
+ d.statusUpdatedAt && /* @__PURE__ */ n("tr", { children: [
74
+ /* @__PURE__ */ e("td", { style: { fontWeight: 600 }, children: "Status Updated" }),
75
+ /* @__PURE__ */ e("td", { children: b(d.statusUpdatedAt) })
76
+ ] }),
77
+ d.updatedAt && /* @__PURE__ */ n("tr", { children: [
78
+ /* @__PURE__ */ e("td", { style: { fontWeight: 600 }, children: "Last Updated" }),
79
+ /* @__PURE__ */ e("td", { children: b(d.updatedAt) })
80
+ ] })
81
+ ] }) }) }),
82
+ /* @__PURE__ */ n("h4", { style: { fontSize: "0.85rem", fontWeight: 600, margin: "0 0 0.5rem" }, children: [
83
+ "Items (",
84
+ d.items.length,
85
+ ")"
86
+ ] }),
87
+ /* @__PURE__ */ e("div", { className: "cedros-admin__table-container", style: { maxWidth: "500px", marginBottom: "1.25rem" }, children: /* @__PURE__ */ n("table", { className: "cedros-admin__table", children: [
88
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
89
+ /* @__PURE__ */ e("th", { children: "Product ID" }),
90
+ /* @__PURE__ */ e("th", { children: "Variant ID" }),
91
+ /* @__PURE__ */ e("th", { children: "Qty" })
92
+ ] }) }),
93
+ /* @__PURE__ */ e("tbody", { children: d.items.map((a, h) => /* @__PURE__ */ n("tr", { children: [
94
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { style: { fontSize: "0.75rem" }, children: a.productId }) }),
95
+ /* @__PURE__ */ e("td", { children: a.variantId ? /* @__PURE__ */ e("code", { style: { fontSize: "0.75rem" }, children: a.variantId }) : /* @__PURE__ */ e("span", { style: { color: "var(--cedros-admin-text-muted, #888)" }, children: "—" }) }),
96
+ /* @__PURE__ */ e("td", { children: a.quantity })
97
+ ] }, h)) })
98
+ ] }) }),
99
+ Object.keys(d.metadata).length > 0 && /* @__PURE__ */ n(U, { children: [
100
+ /* @__PURE__ */ e("h4", { style: { fontSize: "0.85rem", fontWeight: 600, margin: "0 0 0.5rem" }, children: "Metadata" }),
101
+ /* @__PURE__ */ e("div", { className: "cedros-admin__table-container", style: { maxWidth: "500px", marginBottom: "1.25rem" }, children: /* @__PURE__ */ e("table", { className: "cedros-admin__table", children: /* @__PURE__ */ e("tbody", { children: Object.entries(d.metadata).map(([a, h]) => /* @__PURE__ */ n("tr", { children: [
102
+ /* @__PURE__ */ e("td", { style: { fontWeight: 600, width: "40%" }, children: a }),
103
+ /* @__PURE__ */ e("td", { children: h })
104
+ ] }, a)) }) }) })
105
+ ] }),
106
+ /* @__PURE__ */ n("div", { style: { display: "flex", gap: "0.5rem", alignItems: "flex-end", maxWidth: "400px" }, children: [
107
+ /* @__PURE__ */ n("div", { className: "cedros-admin__field", style: { flex: 1 }, children: [
108
+ /* @__PURE__ */ e("label", { className: "cedros-admin__field-label", children: "Update Status" }),
109
+ /* @__PURE__ */ e(
110
+ "select",
111
+ {
112
+ className: "cedros-admin__input",
113
+ value: r,
114
+ onChange: (a) => v(a.target.value),
115
+ children: C.map((a) => /* @__PURE__ */ e("option", { value: a, children: a }, a))
116
+ }
117
+ )
118
+ ] }),
119
+ /* @__PURE__ */ e(
120
+ "button",
121
+ {
122
+ type: "button",
123
+ className: "cedros-admin__button cedros-admin__button--primary",
124
+ onClick: o,
125
+ disabled: _ || r === d.status,
126
+ children: _ ? "Updating..." : "Update"
127
+ }
128
+ )
129
+ ] })
130
+ ] });
131
+ }
132
+ function T({ serverUrl: d, apiKey: m, pageSize: c = 20, authManager: u }) {
133
+ const [s, r] = l([]), [v, _] = l(!0), [p, o] = l(null), [a, h] = l(0), [g, A] = l("all"), [x, N] = l(null), [k, I] = l(!1), y = R(async (t, i) => {
134
+ if (u?.isAuthenticated())
135
+ return u.fetchWithAuth(t, i);
136
+ const f = { "Content-Type": "application/json" };
137
+ m && (f["X-API-Key"] = m);
138
+ const S = await fetch(`${d}${t}`, { ...i, headers: { ...f, ...i?.headers } });
139
+ if (!S.ok) throw new Error(`Request failed: ${S.status}`);
140
+ return S.json();
141
+ }, [d, m, u]), w = R(async () => {
142
+ _(!0), o(null);
143
+ try {
144
+ const t = new URLSearchParams();
145
+ t.set("limit", String(c)), t.set("offset", String(a)), g !== "all" && t.set("status", g);
146
+ const i = await y(`/admin/returns?${t.toString()}`);
147
+ r(i.returns ?? []);
148
+ } catch {
149
+ o("Failed to load returns"), r([]);
150
+ } finally {
151
+ _(!1);
152
+ }
153
+ }, [y, c, a, g]);
154
+ D(() => {
155
+ w();
156
+ }, [w]);
157
+ const j = async (t) => {
158
+ I(!0), o(null);
159
+ try {
160
+ const i = await y(`/admin/returns/${encodeURIComponent(t)}`);
161
+ N(i);
162
+ } catch {
163
+ o("Failed to load return details");
164
+ } finally {
165
+ I(!1);
166
+ }
167
+ }, B = (t) => {
168
+ N(t), r((i) => i.map((f) => f.id === t.id ? t : f));
169
+ };
170
+ return x ? /* @__PURE__ */ e(
171
+ q,
172
+ {
173
+ returnRequest: x,
174
+ onBack: () => N(null),
175
+ onStatusUpdated: B,
176
+ onError: o,
177
+ fetchWithAuth: y
178
+ }
179
+ ) : /* @__PURE__ */ n("div", { children: [
180
+ /* @__PURE__ */ e("div", { className: "cedros-admin__section-header", children: /* @__PURE__ */ e("h3", { className: "cedros-admin__section-title", children: "Returns" }) }),
181
+ /* @__PURE__ */ e(O, { message: p }),
182
+ /* @__PURE__ */ n("div", { style: { display: "flex", gap: "0.5rem", marginBottom: "1rem", alignItems: "center" }, children: [
183
+ /* @__PURE__ */ n(
184
+ "select",
185
+ {
186
+ className: "cedros-admin__input",
187
+ value: g,
188
+ onChange: (t) => {
189
+ A(t.target.value), h(0);
190
+ },
191
+ style: { width: "auto", fontSize: "0.85rem" },
192
+ children: [
193
+ /* @__PURE__ */ e("option", { value: "all", children: "All statuses" }),
194
+ C.map((t) => /* @__PURE__ */ e("option", { value: t, children: t.charAt(0).toUpperCase() + t.slice(1) }, t))
195
+ ]
196
+ }
197
+ ),
198
+ /* @__PURE__ */ n("span", { style: { fontSize: "0.85rem", color: "var(--cedros-admin-text-muted, #888)" }, children: [
199
+ s.length,
200
+ " result",
201
+ s.length !== 1 ? "s" : ""
202
+ ] })
203
+ ] }),
204
+ v || k ? /* @__PURE__ */ n("div", { className: "cedros-admin__loading", children: [
205
+ $.loading,
206
+ " Loading returns..."
207
+ ] }) : s.length === 0 ? /* @__PURE__ */ e("div", { className: "cedros-admin__empty", children: "No returns found." }) : /* @__PURE__ */ n(U, { children: [
208
+ /* @__PURE__ */ e("div", { className: "cedros-admin__table-container", children: /* @__PURE__ */ n("table", { className: "cedros-admin__table", children: [
209
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
210
+ /* @__PURE__ */ e("th", { children: "Order ID" }),
211
+ /* @__PURE__ */ e("th", { children: "Items" }),
212
+ /* @__PURE__ */ e("th", { children: "Status" }),
213
+ /* @__PURE__ */ e("th", { children: "Reason" }),
214
+ /* @__PURE__ */ e("th", { children: "Created" }),
215
+ /* @__PURE__ */ e("th", {})
216
+ ] }) }),
217
+ /* @__PURE__ */ e("tbody", { children: s.map((t) => /* @__PURE__ */ n("tr", { children: [
218
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { style: { fontSize: "0.75rem" }, children: t.orderId }) }),
219
+ /* @__PURE__ */ e("td", { children: t.items.length }),
220
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: `cedros-admin__badge cedros-admin__badge--${W(t.status)}`, children: t.status }) }),
221
+ /* @__PURE__ */ e("td", { style: { maxWidth: "180px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: t.reason ?? /* @__PURE__ */ e("span", { style: { color: "var(--cedros-admin-text-muted, #888)" }, children: "—" }) }),
222
+ /* @__PURE__ */ e("td", { children: b(t.createdAt) }),
223
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
224
+ "button",
225
+ {
226
+ type: "button",
227
+ className: "cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",
228
+ onClick: () => j(t.id),
229
+ children: "View"
230
+ }
231
+ ) })
232
+ ] }, t.id)) })
233
+ ] }) }),
234
+ /* @__PURE__ */ n("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginTop: "0.75rem", fontSize: "0.85rem" }, children: [
235
+ /* @__PURE__ */ e(
236
+ "button",
237
+ {
238
+ type: "button",
239
+ className: "cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",
240
+ disabled: a === 0,
241
+ onClick: () => h(Math.max(0, a - c)),
242
+ children: "Previous"
243
+ }
244
+ ),
245
+ /* @__PURE__ */ n("span", { children: [
246
+ "Showing ",
247
+ s.length,
248
+ " return",
249
+ s.length !== 1 ? "s" : ""
250
+ ] }),
251
+ /* @__PURE__ */ e(
252
+ "button",
253
+ {
254
+ type: "button",
255
+ className: "cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",
256
+ disabled: s.length < c,
257
+ onClick: () => h(a + c),
258
+ children: "Next"
259
+ }
260
+ )
261
+ ] })
262
+ ] })
263
+ ] });
264
+ }
265
+ export {
266
+ T as ReturnsSection
267
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),h=require("./index-C0g-JxJk.js"),w=["requested","approved","rejected","received","refunded"],I=s=>{switch(s){case"approved":return"success";case"refunded":return"success";case"rejected":return"failed";case"received":return"muted";case"requested":return"pending";default:return"muted"}};function A({returnRequest:s,onBack:u,onStatusUpdated:l,onError:m,fetchWithAuth:a}){const[r,p]=d.useState(s.status),[x,_]=d.useState(!1),c=async()=>{if(!(!r||r===s.status)){_(!0);try{const n=await a(`/admin/returns/${encodeURIComponent(s.id)}/status`,{method:"PUT",body:JSON.stringify({status:r})});l(n)}catch{m("Failed to update return status")}finally{_(!1)}}};return e.jsxs("div",{children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:u,style:{marginBottom:"1rem"},children:"← Back to returns"}),e.jsx("div",{className:"cedros-admin__section-header",children:e.jsxs("h3",{className:"cedros-admin__section-title",children:["Return ",e.jsx("code",{style:{fontSize:"0.8rem"},children:s.id.slice(0,12)}),e.jsx("span",{className:`cedros-admin__badge cedros-admin__badge--${I(s.status)}`,style:{marginLeft:"0.5rem"},children:s.status})]})}),e.jsx("div",{className:"cedros-admin__table-container",style:{maxWidth:"500px",marginBottom:"1rem"},children:e.jsx("table",{className:"cedros-admin__table",children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600,width:"35%"},children:"Order ID"}),e.jsx("td",{children:e.jsx("code",{children:s.orderId})})]}),s.reason&&e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600},children:"Reason"}),e.jsx("td",{children:s.reason})]}),e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600},children:"Created"}),e.jsx("td",{children:h.formatDateTime(s.createdAt)})]}),s.statusUpdatedAt&&e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600},children:"Status Updated"}),e.jsx("td",{children:h.formatDateTime(s.statusUpdatedAt)})]}),s.updatedAt&&e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600},children:"Last Updated"}),e.jsx("td",{children:h.formatDateTime(s.updatedAt)})]})]})})}),e.jsxs("h4",{style:{fontSize:"0.85rem",fontWeight:600,margin:"0 0 0.5rem"},children:["Items (",s.items.length,")"]}),e.jsx("div",{className:"cedros-admin__table-container",style:{maxWidth:"500px",marginBottom:"1.25rem"},children:e.jsxs("table",{className:"cedros-admin__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Product ID"}),e.jsx("th",{children:"Variant ID"}),e.jsx("th",{children:"Qty"})]})}),e.jsx("tbody",{children:s.items.map((n,o)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{style:{fontSize:"0.75rem"},children:n.productId})}),e.jsx("td",{children:n.variantId?e.jsx("code",{style:{fontSize:"0.75rem"},children:n.variantId}):e.jsx("span",{style:{color:"var(--cedros-admin-text-muted, #888)"},children:"—"})}),e.jsx("td",{children:n.quantity})]},o))})]})}),Object.keys(s.metadata).length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{style:{fontSize:"0.85rem",fontWeight:600,margin:"0 0 0.5rem"},children:"Metadata"}),e.jsx("div",{className:"cedros-admin__table-container",style:{maxWidth:"500px",marginBottom:"1.25rem"},children:e.jsx("table",{className:"cedros-admin__table",children:e.jsx("tbody",{children:Object.entries(s.metadata).map(([n,o])=>e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600,width:"40%"},children:n}),e.jsx("td",{children:o})]},n))})})})]}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"flex-end",maxWidth:"400px"},children:[e.jsxs("div",{className:"cedros-admin__field",style:{flex:1},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Update Status"}),e.jsx("select",{className:"cedros-admin__input",value:r,onChange:n=>p(n.target.value),children:w.map(n=>e.jsx("option",{value:n,children:n},n))})]}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--primary",onClick:c,disabled:x||r===s.status,children:x?"Updating...":"Update"})]})]})}function D({serverUrl:s,apiKey:u,pageSize:l=20,authManager:m}){const[a,r]=d.useState([]),[p,x]=d.useState(!0),[_,c]=d.useState(null),[n,o]=d.useState(0),[f,R]=d.useState("all"),[S,y]=d.useState(null),[C,v]=d.useState(!1),g=d.useCallback(async(t,i)=>{if(m?.isAuthenticated())return m.fetchWithAuth(t,i);const j={"Content-Type":"application/json"};u&&(j["X-API-Key"]=u);const b=await fetch(`${s}${t}`,{...i,headers:{...j,...i?.headers}});if(!b.ok)throw new Error(`Request failed: ${b.status}`);return b.json()},[s,u,m]),N=d.useCallback(async()=>{x(!0),c(null);try{const t=new URLSearchParams;t.set("limit",String(l)),t.set("offset",String(n)),f!=="all"&&t.set("status",f);const i=await g(`/admin/returns?${t.toString()}`);r(i.returns??[])}catch{c("Failed to load returns"),r([])}finally{x(!1)}},[g,l,n,f]);d.useEffect(()=>{N()},[N]);const U=async t=>{v(!0),c(null);try{const i=await g(`/admin/returns/${encodeURIComponent(t)}`);y(i)}catch{c("Failed to load return details")}finally{v(!1)}},W=t=>{y(t),r(i=>i.map(j=>j.id===t.id?t:j))};return S?e.jsx(A,{returnRequest:S,onBack:()=>y(null),onStatusUpdated:W,onError:c,fetchWithAuth:g}):e.jsxs("div",{children:[e.jsx("div",{className:"cedros-admin__section-header",children:e.jsx("h3",{className:"cedros-admin__section-title",children:"Returns"})}),e.jsx(h.ErrorBanner,{message:_}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1rem",alignItems:"center"},children:[e.jsxs("select",{className:"cedros-admin__input",value:f,onChange:t=>{R(t.target.value),o(0)},style:{width:"auto",fontSize:"0.85rem"},children:[e.jsx("option",{value:"all",children:"All statuses"}),w.map(t=>e.jsx("option",{value:t,children:t.charAt(0).toUpperCase()+t.slice(1)},t))]}),e.jsxs("span",{style:{fontSize:"0.85rem",color:"var(--cedros-admin-text-muted, #888)"},children:[a.length," result",a.length!==1?"s":""]})]}),p||C?e.jsxs("div",{className:"cedros-admin__loading",children:[h.Icons.loading," Loading returns..."]}):a.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"No returns 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:"Order ID"}),e.jsx("th",{children:"Items"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Reason"}),e.jsx("th",{children:"Created"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:a.map(t=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("code",{style:{fontSize:"0.75rem"},children:t.orderId})}),e.jsx("td",{children:t.items.length}),e.jsx("td",{children:e.jsx("span",{className:`cedros-admin__badge cedros-admin__badge--${I(t.status)}`,children:t.status})}),e.jsx("td",{style:{maxWidth:"180px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.reason??e.jsx("span",{style:{color:"var(--cedros-admin-text-muted, #888)"},children:"—"})}),e.jsx("td",{children:h.formatDateTime(t.createdAt)}),e.jsx("td",{children:e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>U(t.id),children:"View"})})]},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:n===0,onClick:()=>o(Math.max(0,n-l)),children:"Previous"}),e.jsxs("span",{children:["Showing ",a.length," return",a.length!==1?"s":""]}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",disabled:a.length<l,onClick:()=>o(n+l),children:"Next"})]})]})]})}exports.ReturnsSection=D;
@@ -1,6 +1,6 @@
1
1
  import { jsxs as s, jsx as i } from "react/jsx-runtime";
2
2
  import { useState as g } from "react";
3
- import { S as l } from "./SingleCategorySettings-BvHBVfSe.mjs";
3
+ import { S as l } from "./SingleCategorySettings-suJ8z9d8.mjs";
4
4
  const o = [
5
5
  {
6
6
  id: "logging",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("react"),d=require("./SingleCategorySettings-D2LVM5mn.js"),r=[{id:"logging",label:"Logging",category:"logging",description:"Configure log levels, format, and environment settings."},{id:"metrics",label:"Metrics",category:"metrics",description:"Configure metrics collection and API access for monitoring."},{id:"security",label:"Security",category:"security",description:"Configure CORS, rate limiting, and other security settings."},{id:"storage",label:"Storage",category:"storage",description:"Configure S3-compatible storage for product images."}];function l({serverUrl:n,apiKey:o,authManager:c}){const[s,a]=g.useState("logging"),t=r.find(i=>i.id===s);return e.jsxs("div",{className:"cedros-admin__server-settings",children:[e.jsxs("div",{className:"cedros-admin__page-header",children:[e.jsx("h2",{className:"cedros-admin__page-title",children:"Store Server"}),e.jsx("p",{className:"cedros-admin__page-description",children:"Configure logging, metrics, security, and storage settings."})]}),e.jsx("div",{className:"cedros-admin__tabs cedros-admin__tabs--line",children:r.map(i=>e.jsx("button",{type:"button",className:`cedros-admin__tab ${s===i.id?"cedros-admin__tab--active":""}`,onClick:()=>a(i.id),children:i.label},i.id))}),e.jsx("div",{style:{marginTop:"1rem"},children:e.jsx(d.SingleCategorySettings,{serverUrl:n,apiKey:o,authManager:c,category:t.category,title:`${t.label} Settings`,description:t.description},t.category)})]})}exports.SettingsSection=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("react"),d=require("./SingleCategorySettings-DwCnBdRf.js"),r=[{id:"logging",label:"Logging",category:"logging",description:"Configure log levels, format, and environment settings."},{id:"metrics",label:"Metrics",category:"metrics",description:"Configure metrics collection and API access for monitoring."},{id:"security",label:"Security",category:"security",description:"Configure CORS, rate limiting, and other security settings."},{id:"storage",label:"Storage",category:"storage",description:"Configure S3-compatible storage for product images."}];function l({serverUrl:n,apiKey:o,authManager:c}){const[s,a]=g.useState("logging"),t=r.find(i=>i.id===s);return e.jsxs("div",{className:"cedros-admin__server-settings",children:[e.jsxs("div",{className:"cedros-admin__page-header",children:[e.jsx("h2",{className:"cedros-admin__page-title",children:"Store Server"}),e.jsx("p",{className:"cedros-admin__page-description",children:"Configure logging, metrics, security, and storage settings."})]}),e.jsx("div",{className:"cedros-admin__tabs cedros-admin__tabs--line",children:r.map(i=>e.jsx("button",{type:"button",className:`cedros-admin__tab ${s===i.id?"cedros-admin__tab--active":""}`,onClick:()=>a(i.id),children:i.label},i.id))}),e.jsx("div",{style:{marginTop:"1rem"},children:e.jsx(d.SingleCategorySettings,{serverUrl:n,apiKey:o,authManager:c,category:t.category,title:`${t.label} Settings`,description:t.description},t.category)})]})}exports.SettingsSection=l;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),c=require("./index-C0g-JxJk.js"),z={name:"",description:"",countries:"",active:!0},W={name:"",rateType:"flat",amountAtomic:"",currency:"USD",minSubtotal:"",maxSubtotal:"",active:!0},A=(_,h)=>`${h.toUpperCase()} ${(_/100).toFixed(2)}`;function Z({serverUrl:_,apiKey:h,authManager:S}){const[R,E]=a.useState([]),[q,P]=a.useState(!0),[w,p]=a.useState(null),[I,d]=a.useState(null),[J,f]=a.useState(!1),[b,g]=a.useState(null),[o,m]=a.useState(z),[k,T]=a.useState(!1),[n,F]=a.useState(null),[D,U]=a.useState([]),[M,$]=a.useState(!1),[G,u]=a.useState(!1),[y,x]=a.useState(null),[i,r]=a.useState(W),[L,B]=a.useState(!1),l=a.useCallback(async(t,s)=>{if(S?.isAuthenticated())return S.fetchWithAuth(t,s);const v={"Content-Type":"application/json"};h&&(v["X-API-Key"]=h);const C=await fetch(`${_}${t}`,{...s,headers:{...v,...s?.headers}});if(!C.ok)throw new Error(`Request failed: ${C.status}`);return C.json()},[_,h,S]),j=a.useCallback(async()=>{P(!0),p(null);try{const t=await l("/admin/shipping/profiles?limit=50&offset=0");E(t.profiles??[])}catch{p("Failed to load shipping profiles"),E([])}finally{P(!1)}},[l]);a.useEffect(()=>{j()},[j]);const K=t=>{g(t),m({name:t.name,description:t.description??"",countries:t.countries.join(", "),active:t.active}),f(!0)},X=async t=>{t.preventDefault(),T(!0),d(null);try{const s={name:o.name,description:o.description||void 0,countries:o.countries.split(",").map(v=>v.trim()).filter(Boolean),active:o.active};b?await l(`/admin/shipping/profiles/${encodeURIComponent(b.id)}`,{method:"PUT",body:JSON.stringify(s)}):await l("/admin/shipping/profiles",{method:"POST",body:JSON.stringify(s)}),f(!1),g(null),j()}catch(s){d(s instanceof Error?s.message:"Failed to save profile")}finally{T(!1)}},H=async t=>{if(window.confirm("Delete this shipping profile?")){d(null);try{await l(`/admin/shipping/profiles/${encodeURIComponent(t)}`,{method:"DELETE"}),j()}catch{d("Failed to delete profile")}}},N=a.useCallback(async t=>{$(!0),p(null);try{const s=await l(`/admin/shipping/profiles/${encodeURIComponent(t.id)}/rates?limit=50&offset=0`);U(s.rates??[])}catch{p("Failed to load rates"),U([])}finally{$(!1)}},[l]),O=t=>{F(t),u(!1),x(null),N(t)},Q=t=>{x(t),r({name:t.name,rateType:t.rateType,amountAtomic:String(t.amountAtomic),currency:t.currency,minSubtotal:t.minSubtotal!=null?String(t.minSubtotal):"",maxSubtotal:t.maxSubtotal!=null?String(t.maxSubtotal):"",active:t.active}),u(!0)},V=async t=>{if(t.preventDefault(),!!n){B(!0),d(null);try{const s={name:i.name,rateType:i.rateType,amountAtomic:parseInt(i.amountAtomic,10),currency:i.currency,active:i.active,profileId:n.id,minSubtotal:i.minSubtotal?parseInt(i.minSubtotal,10):void 0,maxSubtotal:i.maxSubtotal?parseInt(i.maxSubtotal,10):void 0};y?await l(`/admin/shipping/rates/${encodeURIComponent(y.id)}`,{method:"PUT",body:JSON.stringify(s)}):await l(`/admin/shipping/profiles/${encodeURIComponent(n.id)}/rates`,{method:"POST",body:JSON.stringify(s)}),u(!1),x(null),N(n)}catch(s){d(s instanceof Error?s.message:"Failed to save rate")}finally{B(!1)}}},Y=async t=>{if(!(!window.confirm("Delete this rate?")||!n)){d(null);try{await l(`/admin/shipping/rates/${encodeURIComponent(t)}`,{method:"DELETE"}),N(n)}catch{d("Failed to delete rate")}}};return n?e.jsxs("div",{children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>{F(null),u(!1),p(null),d(null)},style:{marginBottom:"1rem"},children:"← Back to profiles"}),e.jsxs("div",{className:"cedros-admin__section-header",children:[e.jsxs("h3",{className:"cedros-admin__section-title",children:[n.name,e.jsx("span",{className:`cedros-admin__badge cedros-admin__badge--${n.active?"success":"muted"}`,style:{marginLeft:"0.5rem"},children:n.active?"Active":"Inactive"})]}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--primary",onClick:()=>{x(null),r(W),u(!0)},children:"+ Add Rate"})]}),e.jsx(c.ErrorBanner,{message:w}),e.jsx(c.ErrorBanner,{message:I}),e.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--cedros-admin-text-muted, #888)",margin:"0 0 1rem"},children:[n.description&&e.jsxs(e.Fragment,{children:[n.description," · "]}),"Countries: ",n.countries.length>0?n.countries.join(", "):"All"]}),G&&e.jsxs("form",{onSubmit:V,style:{border:"1px solid var(--cedros-admin-border, #e0e0e0)",borderRadius:"4px",padding:"1rem",marginBottom:"1.5rem",maxWidth:"520px"},children:[e.jsx("h4",{style:{margin:"0 0 0.75rem",fontSize:"0.9rem",fontWeight:600},children:y?"Edit Rate":"New Rate"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Name *"}),e.jsx("input",{type:"text",className:"cedros-admin__input",required:!0,value:i.name,onChange:t=>r(s=>({...s,name:t.target.value})),placeholder:"Standard Shipping"})]}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[e.jsxs("div",{className:"cedros-admin__field",style:{flex:1},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Rate Type *"}),e.jsxs("select",{className:"cedros-admin__input",value:i.rateType,onChange:t=>r(s=>({...s,rateType:t.target.value})),children:[e.jsx("option",{value:"flat",children:"Flat"}),e.jsx("option",{value:"price",children:"Price-based"}),e.jsx("option",{value:"weight",children:"Weight-based"})]})]}),e.jsxs("div",{className:"cedros-admin__field",style:{flex:1},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Amount (atomic) *"}),e.jsx("input",{type:"number",className:"cedros-admin__input",required:!0,min:0,value:i.amountAtomic,onChange:t=>r(s=>({...s,amountAtomic:t.target.value})),placeholder:"500"})]}),e.jsxs("div",{className:"cedros-admin__field",style:{width:"80px"},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Currency"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:i.currency,maxLength:3,onChange:t=>r(s=>({...s,currency:t.target.value.toUpperCase()})),placeholder:"USD"})]})]}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[e.jsxs("div",{className:"cedros-admin__field",style:{flex:1},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Min Subtotal"}),e.jsx("input",{type:"number",className:"cedros-admin__input",min:0,value:i.minSubtotal,onChange:t=>r(s=>({...s,minSubtotal:t.target.value})),placeholder:"0"})]}),e.jsxs("div",{className:"cedros-admin__field",style:{flex:1},children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Max Subtotal"}),e.jsx("input",{type:"number",className:"cedros-admin__input",min:0,value:i.maxSubtotal,onChange:t=>r(s=>({...s,maxSubtotal:t.target.value})),placeholder:"10000"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx("input",{type:"checkbox",id:"rate-active",checked:i.active,onChange:t=>r(s=>({...s,active:t.target.checked}))}),e.jsx("label",{htmlFor:"rate-active",className:"cedros-admin__field-label",style:{margin:0},children:"Active"})]})]}),e.jsxs("div",{style:{marginTop:"0.75rem",display:"flex",gap:"0.5rem"},children:[e.jsx("button",{type:"submit",className:"cedros-admin__button cedros-admin__button--primary",disabled:L,children:L?"Saving...":y?"Update":"Create"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost",onClick:()=>{u(!1),x(null)},children:"Cancel"})]})]}),M?e.jsxs("div",{className:"cedros-admin__loading",children:[c.Icons.loading," Loading rates..."]}):D.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"No rates yet. Add one above."}):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:"Name"}),e.jsx("th",{children:"Type"}),e.jsx("th",{children:"Amount"}),e.jsx("th",{children:"Min / Max Subtotal"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Updated"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:D.map(t=>e.jsxs("tr",{children:[e.jsx("td",{children:t.name}),e.jsx("td",{style:{fontSize:"0.85rem"},children:t.rateType}),e.jsx("td",{style:{fontSize:"0.85rem"},children:A(t.amountAtomic,t.currency)}),e.jsxs("td",{style:{fontSize:"0.8rem",color:"var(--cedros-admin-text-muted, #888)"},children:[t.minSubtotal!=null?A(t.minSubtotal,t.currency):"—"," / ",t.maxSubtotal!=null?A(t.maxSubtotal,t.currency):"—"]}),e.jsx("td",{children:e.jsx("span",{className:`cedros-admin__badge cedros-admin__badge--${t.active?"success":"muted"}`,children:t.active?"Active":"Inactive"})}),e.jsx("td",{style:{fontSize:"0.8rem"},children:c.formatDateTime(t.updatedAt)}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",gap:"0.25rem"},children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>Q(t),children:"Edit"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>Y(t.id),style:{color:"var(--cedros-admin-danger, #c00)"},children:"Delete"})]})})]},t.id))})]})})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"cedros-admin__section-header",children:[e.jsx("h3",{className:"cedros-admin__section-title",children:"Shipping"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--primary",onClick:()=>{g(null),m(z),f(!0)},children:"+ Add Profile"})]}),e.jsx(c.ErrorBanner,{message:w}),e.jsx(c.ErrorBanner,{message:I}),J&&e.jsxs("form",{onSubmit:X,style:{border:"1px solid var(--cedros-admin-border, #e0e0e0)",borderRadius:"4px",padding:"1rem",marginBottom:"1.5rem",maxWidth:"500px"},children:[e.jsx("h4",{style:{margin:"0 0 0.75rem",fontSize:"0.9rem",fontWeight:600},children:b?"Edit Profile":"New Profile"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Name *"}),e.jsx("input",{type:"text",className:"cedros-admin__input",required:!0,value:o.name,onChange:t=>m(s=>({...s,name:t.target.value})),placeholder:"Domestic Shipping"})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Description"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:o.description,onChange:t=>m(s=>({...s,description:t.target.value})),placeholder:"Optional description"})]}),e.jsxs("div",{className:"cedros-admin__field",children:[e.jsx("label",{className:"cedros-admin__field-label",children:"Countries (comma-separated ISO codes)"}),e.jsx("input",{type:"text",className:"cedros-admin__input",value:o.countries,onChange:t=>m(s=>({...s,countries:t.target.value})),placeholder:"US, CA, GB"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx("input",{type:"checkbox",id:"profile-active",checked:o.active,onChange:t=>m(s=>({...s,active:t.target.checked}))}),e.jsx("label",{htmlFor:"profile-active",className:"cedros-admin__field-label",style:{margin:0},children:"Active"})]})]}),e.jsxs("div",{style:{marginTop:"0.75rem",display:"flex",gap:"0.5rem"},children:[e.jsx("button",{type:"submit",className:"cedros-admin__button cedros-admin__button--primary",disabled:k,children:k?"Saving...":b?"Update":"Create"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost",onClick:()=>{f(!1),g(null)},children:"Cancel"})]})]}),q?e.jsxs("div",{className:"cedros-admin__loading",children:[c.Icons.loading," Loading profiles..."]}):R.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"No shipping profiles found."}):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:"Name"}),e.jsx("th",{children:"Countries"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Created"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:R.map(t=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("button",{type:"button",style:{background:"none",border:"none",cursor:"pointer",fontWeight:600,padding:0,color:"var(--cedros-admin-text, #333)",fontSize:"0.9rem"},onClick:()=>O(t),children:t.name})}),e.jsx("td",{style:{fontSize:"0.8rem",color:"var(--cedros-admin-text-muted, #888)",maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.countries.length>0?t.countries.join(", "):"All"}),e.jsx("td",{children:e.jsx("span",{className:`cedros-admin__badge cedros-admin__badge--${t.active?"success":"muted"}`,children:t.active?"Active":"Inactive"})}),e.jsx("td",{style:{fontSize:"0.8rem"},children:c.formatDateTime(t.createdAt)}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",gap:"0.25rem"},children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>O(t),children:"Rates"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>K(t),children:"Edit"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>H(t.id),style:{color:"var(--cedros-admin-danger, #c00)"},children:"Delete"})]})})]},t.id))})]})})]})}exports.ShippingSection=Z;