@openrails/billing-ui 0.242.0 → 0.243.0

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 (260) hide show
  1. package/CHANGELOG.md +27 -11
  2. package/README.md +41 -8
  3. package/dist/admin/billing-admin.d.ts +3 -0
  4. package/dist/admin/components/app-sidebar.d.ts +1 -0
  5. package/dist/admin/components/confirm.d.ts +4 -0
  6. package/dist/admin/components/cursor-pager.d.ts +8 -0
  7. package/dist/admin/components/data-table.d.ts +14 -0
  8. package/dist/admin/components/fact-card.d.ts +5 -0
  9. package/dist/admin/components/form-field-errors.d.ts +3 -0
  10. package/dist/admin/components/linked-table-row.d.ts +5 -0
  11. package/dist/admin/components/logo.d.ts +3 -0
  12. package/dist/admin/components/no-access.d.ts +3 -0
  13. package/dist/admin/components/no-merchants.d.ts +1 -0
  14. package/dist/admin/components/notification-bell.d.ts +2 -0
  15. package/dist/admin/components/route-error.d.ts +3 -0
  16. package/dist/admin/components/site-header.d.ts +9 -0
  17. package/dist/admin/components/status-badge.d.ts +3 -0
  18. package/dist/admin/components/typed-confirm-dialog.d.ts +11 -0
  19. package/dist/admin/components/ui/alert-dialog.d.ts +18 -0
  20. package/dist/admin/components/ui/avatar.d.ts +11 -0
  21. package/dist/admin/components/ui/badge.d.ts +7 -0
  22. package/dist/admin/components/ui/breadcrumb.d.ts +10 -0
  23. package/dist/admin/components/ui/button.d.ts +8 -0
  24. package/dist/admin/components/ui/card.d.ts +11 -0
  25. package/dist/admin/components/ui/chart.d.ts +44 -0
  26. package/dist/admin/components/ui/dialog.d.ts +17 -0
  27. package/dist/admin/components/ui/dropdown-menu.d.ts +29 -0
  28. package/dist/admin/components/ui/input.d.ts +3 -0
  29. package/dist/admin/components/ui/label.d.ts +3 -0
  30. package/dist/admin/components/ui/select.d.ts +15 -0
  31. package/dist/admin/components/ui/separator.d.ts +3 -0
  32. package/dist/admin/components/ui/sheet.d.ts +14 -0
  33. package/dist/admin/components/ui/sidebar.d.ts +63 -0
  34. package/dist/admin/components/ui/skeleton.d.ts +2 -0
  35. package/dist/admin/components/ui/sonner.d.ts +3 -0
  36. package/dist/admin/components/ui/switch.d.ts +5 -0
  37. package/dist/admin/components/ui/table.d.ts +10 -0
  38. package/dist/admin/components/ui/tabs.d.ts +10 -0
  39. package/dist/admin/components/ui/textarea.d.ts +3 -0
  40. package/dist/admin/components/ui/tooltip.d.ts +6 -0
  41. package/dist/admin/context.d.ts +1193 -0
  42. package/dist/admin/hooks/use-mobile.d.ts +1 -0
  43. package/dist/admin/index.d.ts +5 -0
  44. package/dist/admin/layouts/app-layout.d.ts +4 -0
  45. package/dist/admin/lib/api/client.d.ts +64 -0
  46. package/dist/admin/lib/api/copilot.d.ts +6 -0
  47. package/dist/admin/lib/api/credit-endpoints.d.ts +8 -0
  48. package/dist/admin/lib/api/credit-types.d.ts +9 -0
  49. package/dist/admin/lib/api/endpoints.d.ts +133 -0
  50. package/dist/admin/lib/api/index.d.ts +89 -0
  51. package/dist/admin/lib/api/invoice-profile-endpoints.d.ts +6 -0
  52. package/dist/admin/lib/api/metrics.d.ts +68 -0
  53. package/dist/admin/lib/api/order-endpoints.d.ts +21 -0
  54. package/dist/admin/lib/api/types.d.ts +122 -0
  55. package/dist/admin/lib/auth.d.ts +6 -0
  56. package/dist/admin/lib/capabilities.d.ts +13 -0
  57. package/dist/admin/lib/chunk-error.d.ts +1 -0
  58. package/dist/admin/lib/confirm.d.ts +11 -0
  59. package/dist/admin/lib/credit-queries.d.ts +23 -0
  60. package/dist/admin/lib/csv.d.ts +3 -0
  61. package/dist/admin/lib/cursor-pages.d.ts +13 -0
  62. package/dist/admin/lib/dialog-width.d.ts +6 -0
  63. package/dist/admin/lib/dom.d.ts +1 -0
  64. package/dist/admin/lib/duration.d.ts +3 -0
  65. package/dist/admin/lib/format.d.ts +23 -0
  66. package/dist/admin/lib/mount.d.ts +6 -0
  67. package/dist/admin/lib/mutations.d.ts +125 -0
  68. package/dist/admin/lib/order-queries.d.ts +29 -0
  69. package/dist/admin/lib/queries.d.ts +369 -0
  70. package/dist/admin/lib/query-client.d.ts +3 -0
  71. package/dist/admin/lib/toast.d.ts +10 -0
  72. package/dist/admin/lib/utils.d.ts +2 -0
  73. package/dist/admin/messages.d.ts +670 -0
  74. package/dist/admin/navigation.d.ts +14 -0
  75. package/dist/admin/pages/catalog/application-dialog.d.ts +2 -0
  76. package/dist/admin/pages/catalog/copilot-panel.d.ts +4 -0
  77. package/dist/admin/pages/catalog/index.d.ts +4 -0
  78. package/dist/admin/pages/catalog/meter-form.d.ts +6 -0
  79. package/dist/admin/pages/catalog/metering-model.d.ts +67 -0
  80. package/dist/admin/pages/catalog/metering.d.ts +3 -0
  81. package/dist/admin/pages/catalog/price-detail.d.ts +2 -0
  82. package/dist/admin/pages/catalog/price-format.d.ts +3 -0
  83. package/dist/admin/pages/catalog/price-wizard-logic.d.ts +20 -0
  84. package/dist/admin/pages/catalog/price-wizard.d.ts +10 -0
  85. package/dist/admin/pages/catalog/psp-links.d.ts +10 -0
  86. package/dist/admin/pages/catalog/rate-card-editor.d.ts +10 -0
  87. package/dist/admin/pages/customers/credit-form.d.ts +14 -0
  88. package/dist/admin/pages/customers/credits.d.ts +5 -0
  89. package/dist/admin/pages/customers/default-card-badges.d.ts +3 -0
  90. package/dist/admin/pages/customers/detail.d.ts +5 -0
  91. package/dist/admin/pages/customers/grant-duration.d.ts +32 -0
  92. package/dist/admin/pages/customers/index.d.ts +2 -0
  93. package/dist/admin/pages/customers/invoice-profile-model.d.ts +18 -0
  94. package/dist/admin/pages/customers/invoice-profile.d.ts +9 -0
  95. package/dist/admin/pages/dashboard/index.d.ts +2 -0
  96. package/dist/admin/pages/dashboard/lib.d.ts +48 -0
  97. package/dist/admin/pages/dashboard/range-picker.d.ts +1 -0
  98. package/dist/admin/pages/dashboard/range.d.ts +34 -0
  99. package/dist/admin/pages/dashboard/reports-model.d.ts +29 -0
  100. package/dist/admin/pages/dashboard/reports.d.ts +2 -0
  101. package/dist/admin/pages/dashboard/use-range.d.ts +5 -0
  102. package/dist/admin/pages/dashboard/widget-editor.d.ts +8 -0
  103. package/dist/admin/pages/dashboard/widget-tile.d.ts +9 -0
  104. package/dist/admin/pages/dashboard/widget-viz.d.ts +12 -0
  105. package/dist/admin/pages/ops/index.d.ts +2 -0
  106. package/dist/admin/pages/orders/detail.d.ts +5 -0
  107. package/dist/admin/pages/orders/index.d.ts +1 -0
  108. package/dist/admin/pages/orders/model.d.ts +7 -0
  109. package/dist/admin/pages/payments/attempts.d.ts +7 -0
  110. package/dist/admin/pages/payments/detail.d.ts +2 -0
  111. package/dist/admin/pages/payments/health-model.d.ts +149 -0
  112. package/dist/admin/pages/payments/health.d.ts +2 -0
  113. package/dist/admin/pages/payments/index.d.ts +2 -0
  114. package/dist/admin/pages/settings/configuration-edit.d.ts +9 -0
  115. package/dist/admin/pages/settings/index.d.ts +9 -0
  116. package/dist/admin/pages/settings/notifications.d.ts +2 -0
  117. package/dist/admin/pages/settings/setting-fields.d.ts +20 -0
  118. package/dist/admin/pages/subscriptions/change-subscription-dialog.d.ts +16 -0
  119. package/dist/admin/pages/subscriptions/detail.d.ts +2 -0
  120. package/dist/admin/pages/subscriptions/dunning.d.ts +2 -0
  121. package/dist/admin/pages/subscriptions/index.d.ts +2 -0
  122. package/dist/admin/pages/subscriptions/subscription-change-options.d.ts +23 -0
  123. package/dist/admin/pages/subscriptions/views.d.ts +15 -0
  124. package/dist/admin/router.d.ts +32 -0
  125. package/dist/admin/routes.d.ts +5 -0
  126. package/dist/admin/summary.d.ts +27 -0
  127. package/dist/admin/theme.d.ts +2 -0
  128. package/dist/admin/types.d.ts +56 -0
  129. package/dist/admin/ui-context.d.ts +14 -0
  130. package/dist/admin-attempts-lAoW-Urd.js +419 -0
  131. package/dist/admin-attempts-lAoW-Urd.js.map +1 -0
  132. package/dist/admin-auth-DQGHtt0j.js +14 -0
  133. package/dist/admin-auth-DQGHtt0j.js.map +1 -0
  134. package/dist/admin-badge-DR5-1qd8.js +31 -0
  135. package/dist/admin-badge-DR5-1qd8.js.map +1 -0
  136. package/dist/admin-button-CTL3DgOt.js +46 -0
  137. package/dist/admin-button-CTL3DgOt.js.map +1 -0
  138. package/dist/admin-capabilities-BuigAgtm.js +59 -0
  139. package/dist/admin-capabilities-BuigAgtm.js.map +1 -0
  140. package/dist/admin-card-bzAks3-3.js +51 -0
  141. package/dist/admin-card-bzAks3-3.js.map +1 -0
  142. package/dist/admin-catalog-CC7I4n0_.js +1189 -0
  143. package/dist/admin-catalog-CC7I4n0_.js.map +1 -0
  144. package/dist/admin-confirm-katGq0Qo.js +12 -0
  145. package/dist/admin-confirm-katGq0Qo.js.map +1 -0
  146. package/dist/admin-csv-CPoNZj2D.js +16 -0
  147. package/dist/admin-csv-CPoNZj2D.js.map +1 -0
  148. package/dist/admin-customers-D8u5gq3M.js +160 -0
  149. package/dist/admin-customers-D8u5gq3M.js.map +1 -0
  150. package/dist/admin-dashboard-DqqFjOzq.js +420 -0
  151. package/dist/admin-dashboard-DqqFjOzq.js.map +1 -0
  152. package/dist/admin-data-table-qfXLOFmN.js +96 -0
  153. package/dist/admin-data-table-qfXLOFmN.js.map +1 -0
  154. package/dist/admin-detail-5aNNvrc0.js +324 -0
  155. package/dist/admin-detail-5aNNvrc0.js.map +1 -0
  156. package/dist/admin-detail-7p684Uyc.js +342 -0
  157. package/dist/admin-detail-7p684Uyc.js.map +1 -0
  158. package/dist/admin-detail-CGOyqs7s.js +1312 -0
  159. package/dist/admin-detail-CGOyqs7s.js.map +1 -0
  160. package/dist/admin-detail-DUAJQg8G.js +710 -0
  161. package/dist/admin-detail-DUAJQg8G.js.map +1 -0
  162. package/dist/admin-dialog-BjuKI5Hp.js +88 -0
  163. package/dist/admin-dialog-BjuKI5Hp.js.map +1 -0
  164. package/dist/admin-dialog-width-BPrgdYlj.js +6 -0
  165. package/dist/admin-dialog-width-BPrgdYlj.js.map +1 -0
  166. package/dist/admin-dom-uMmZzRvU.js +149 -0
  167. package/dist/admin-dom-uMmZzRvU.js.map +1 -0
  168. package/dist/admin-dropdown-menu-BW1D_h6s.js +69 -0
  169. package/dist/admin-dropdown-menu-BW1D_h6s.js.map +1 -0
  170. package/dist/admin-dunning-B2zgtrOo.js +10 -0
  171. package/dist/admin-dunning-B2zgtrOo.js.map +1 -0
  172. package/dist/admin-fact-card-DO_fHosg.js +20 -0
  173. package/dist/admin-fact-card-DO_fHosg.js.map +1 -0
  174. package/dist/admin-form-field-errors-hbUMIriS.js +14 -0
  175. package/dist/admin-form-field-errors-hbUMIriS.js.map +1 -0
  176. package/dist/admin-format-DoohJ7Fg.js +136 -0
  177. package/dist/admin-format-DoohJ7Fg.js.map +1 -0
  178. package/dist/admin-health-B4jN2LwR.js +983 -0
  179. package/dist/admin-health-B4jN2LwR.js.map +1 -0
  180. package/dist/admin-input-CcfQfJFN.js +17 -0
  181. package/dist/admin-input-CcfQfJFN.js.map +1 -0
  182. package/dist/admin-invoice-profile-model-Cgjy3zV8.js +53 -0
  183. package/dist/admin-invoice-profile-model-Cgjy3zV8.js.map +1 -0
  184. package/dist/admin-label-BiEN5cjb.js +15 -0
  185. package/dist/admin-label-BiEN5cjb.js.map +1 -0
  186. package/dist/admin-linked-table-row-BsaUruCN.js +26 -0
  187. package/dist/admin-linked-table-row-BsaUruCN.js.map +1 -0
  188. package/dist/admin-metering-BGAXbT23.js +1702 -0
  189. package/dist/admin-metering-BGAXbT23.js.map +1 -0
  190. package/dist/admin-ops-B3mcr76u.js +217 -0
  191. package/dist/admin-ops-B3mcr76u.js.map +1 -0
  192. package/dist/admin-orders-dxC99Idl.js +192 -0
  193. package/dist/admin-orders-dxC99Idl.js.map +1 -0
  194. package/dist/admin-payments-Bs7HSfP0.js +246 -0
  195. package/dist/admin-payments-Bs7HSfP0.js.map +1 -0
  196. package/dist/admin-price-detail-DRquxpA9.js +482 -0
  197. package/dist/admin-price-detail-DRquxpA9.js.map +1 -0
  198. package/dist/admin-price-format-DM1qORWI.js +44 -0
  199. package/dist/admin-price-format-DM1qORWI.js.map +1 -0
  200. package/dist/admin-price-wizard-CI7K-2Nz.js +357 -0
  201. package/dist/admin-price-wizard-CI7K-2Nz.js.map +1 -0
  202. package/dist/admin-range-picker-Dr2M1EZr.js +192 -0
  203. package/dist/admin-range-picker-Dr2M1EZr.js.map +1 -0
  204. package/dist/admin-reports-CywKLiSA.js +320 -0
  205. package/dist/admin-reports-CywKLiSA.js.map +1 -0
  206. package/dist/admin-select-DBgprVW6.js +81 -0
  207. package/dist/admin-select-DBgprVW6.js.map +1 -0
  208. package/dist/admin-settings-Bmoy95uO.js +1434 -0
  209. package/dist/admin-settings-Bmoy95uO.js.map +1 -0
  210. package/dist/admin-skeleton-DsM7crYi.js +14 -0
  211. package/dist/admin-skeleton-DsM7crYi.js.map +1 -0
  212. package/dist/admin-status-badge-BFPgo71d.js +38 -0
  213. package/dist/admin-status-badge-BFPgo71d.js.map +1 -0
  214. package/dist/admin-subscriptions-CLYc_HEV.js +301 -0
  215. package/dist/admin-subscriptions-CLYc_HEV.js.map +1 -0
  216. package/dist/admin-switch-BJUxLCsa.js +20 -0
  217. package/dist/admin-switch-BJUxLCsa.js.map +1 -0
  218. package/dist/admin-table-CH9TrXJf.js +61 -0
  219. package/dist/admin-table-CH9TrXJf.js.map +1 -0
  220. package/dist/admin-tabs-528FJMjt.js +46 -0
  221. package/dist/admin-tabs-528FJMjt.js.map +1 -0
  222. package/dist/admin-textarea-DEz38RaI.js +15 -0
  223. package/dist/admin-textarea-DEz38RaI.js.map +1 -0
  224. package/dist/admin-typed-confirm-dialog-DU7m9-O7.js +66 -0
  225. package/dist/admin-typed-confirm-dialog-DU7m9-O7.js.map +1 -0
  226. package/dist/admin-utils-BK4Vh1o_.js +1809 -0
  227. package/dist/admin-utils-BK4Vh1o_.js.map +1 -0
  228. package/dist/admin-widget-viz-Da48c-Zf.js +581 -0
  229. package/dist/admin-widget-viz-Da48c-Zf.js.map +1 -0
  230. package/dist/admin.css +3 -0
  231. package/dist/admin.js +2164 -0
  232. package/dist/admin.js.map +1 -0
  233. package/dist/appearance.d.ts +1 -1
  234. package/dist/client/generated/error-codes.d.ts +1 -1
  235. package/dist/client/generated/routes.d.ts +2171 -176
  236. package/dist/client/generated/wire.d.ts +1273 -0
  237. package/dist/{hooks-Uiw-zW3H.js → hooks-Ckd8F2JF.js} +7 -7
  238. package/dist/hooks-Ckd8F2JF.js.map +1 -0
  239. package/dist/index.d.ts +1 -1
  240. package/dist/index.js +11 -11
  241. package/dist/index.js.map +1 -1
  242. package/dist/lib/{offer-label.d.ts → price-label.d.ts} +1 -1
  243. package/dist/locales/de.js +1 -1
  244. package/dist/locales/de.js.map +1 -1
  245. package/dist/locales/en.d.ts +1 -1
  246. package/dist/locales/en.js +1 -1
  247. package/dist/locales/en.js.map +1 -1
  248. package/dist/locales/es.js +1 -1
  249. package/dist/locales/es.js.map +1 -1
  250. package/dist/locales/ja.js +1 -1
  251. package/dist/locales/ja.js.map +1 -1
  252. package/dist/locales/ko.js +1 -1
  253. package/dist/locales/ko.js.map +1 -1
  254. package/dist/locales/zh.js +1 -1
  255. package/dist/locales/zh.js.map +1 -1
  256. package/dist/{offers.d.ts → product-list.d.ts} +5 -5
  257. package/dist/react.js +1 -1
  258. package/dist/styles.css +1 -1
  259. package/package.json +28 -6
  260. package/dist/hooks-Uiw-zW3H.js.map +0 -1
@@ -0,0 +1,1189 @@
1
+ import { E as e, S as t, p as n, r, w as i } from "./admin-utils-BK4Vh1o_.js";
2
+ import { t as a } from "./admin-button-CTL3DgOt.js";
3
+ import { t as o } from "./admin-input-CcfQfJFN.js";
4
+ import { t as s } from "./admin-skeleton-DsM7crYi.js";
5
+ import { d as c, l, r as u, s as d } from "./admin-capabilities-BuigAgtm.js";
6
+ import { c as f, d as p, n as m, o as h, s as g, u as _ } from "./admin-format-DoohJ7Fg.js";
7
+ import { t as v } from "./admin-form-field-errors-hbUMIriS.js";
8
+ import { a as y, i as b, n as x, r as S, t as C } from "./admin-select-DBgprVW6.js";
9
+ import { n as w, r as T } from "./admin-dom-uMmZzRvU.js";
10
+ import { a as E, n as D, o as O, r as k, s as A, t as j } from "./admin-table-CH9TrXJf.js";
11
+ import { t as ee } from "./admin-linked-table-row-BsaUruCN.js";
12
+ import { t as M } from "./admin-badge-DR5-1qd8.js";
13
+ import { t as te } from "./admin-status-badge-BFPgo71d.js";
14
+ import { a as N, i as P, n as F, o as I, r as L, s as R, t as z } from "./admin-dialog-BjuKI5Hp.js";
15
+ import { t as B } from "./admin-label-BiEN5cjb.js";
16
+ import { t as ne } from "./admin-switch-BJUxLCsa.js";
17
+ import { n as re, r as ie } from "./admin-dialog-width-BPrgdYlj.js";
18
+ import { i as V, n as ae, r as oe, t as se } from "./admin-price-format-DM1qORWI.js";
19
+ import { t as ce } from "./admin-textarea-DEz38RaI.js";
20
+ import { r as le, t as ue } from "./admin-card-bzAks3-3.js";
21
+ import { t as de } from "./admin-price-wizard-CI7K-2Nz.js";
22
+ import * as H from "react";
23
+ import { useMutation as U, useQuery as W, useQueryClient as G } from "@tanstack/react-query";
24
+ import { Fragment as fe, jsx as K, jsxs as q } from "react/jsx-runtime";
25
+ import { HugeiconsIcon as J } from "@hugeicons/react";
26
+ import { Add01Icon as pe, BubbleChatQuestionIcon as me, Cancel01Icon as he, Loading02Icon as ge, Refresh01Icon as _e, SparklesIcon as ve } from "@hugeicons/core-free-icons";
27
+ import { useForm as Y } from "@tanstack/react-form";
28
+ //#region src/admin/pages/catalog/application-dialog.tsx
29
+ function ye() {
30
+ let { toast: r, toastApiError: o, selectedMerchant: s, adminMutations: c } = n(), { id: l, text: u } = e(), [d, f] = H.useState(!1), [p, m] = H.useState(""), [h, g] = H.useState(!1), [_, v] = H.useState(), [y, b] = H.useState(), [x, S] = H.useState(""), [C, w] = H.useState(!1), [T, E] = H.useState(), D = U(c.applyCatalog(G())), O = () => {
31
+ E(s()), m(JSON.stringify({
32
+ schema_version: 1,
33
+ prune: !1,
34
+ products: {}
35
+ }, null, 2)), v(void 0), b(void 0), g(!1), w(!1), S("");
36
+ }, k = async (e = !1) => {
37
+ if (s() !== T) {
38
+ S("This draft belongs to another selected merchant. Return to that merchant before applying it.");
39
+ return;
40
+ }
41
+ let n = _ ?? p;
42
+ v(n), w(!1), S("");
43
+ try {
44
+ let t = await D.mutateAsync({
45
+ document: n,
46
+ force: e
47
+ });
48
+ b(t);
49
+ let i = t.conflicts?.length ?? 0;
50
+ S(t.replayed ? "This batch was already applied. No changes were repeated, and later catalog edits were preserved." : i > 0 ? `Applied everything no edit changed. ${i} ${i === 1 ? "object was" : "objects were"} skipped because an edit set ${i === 1 ? "its" : "their"} fields differently: change the batch to agree, remove those fields, or overwrite the edits.` : "Batch applied. Review the current catalog before preparing another batch."), i > 0 ? r.warning(`Catalog batch applied; ${i} skipped`) : r.success(t.replayed ? "Original batch receipt returned" : "Catalog batch applied");
51
+ } catch (e) {
52
+ let n = e instanceof t && e.status >= 400 && e.status < 500 && e.status !== 408;
53
+ w(n), S(n ? "Batch refused. Review the error and edit the document before trying again." : "The outcome could not be confirmed. Retry this exact document to retrieve its receipt without repeating changes."), o(e, "Apply catalog");
54
+ }
55
+ };
56
+ return /* @__PURE__ */ q(z, {
57
+ open: d,
58
+ onOpenChange: (e) => {
59
+ D.isPending || (f(e), e && !p && O());
60
+ },
61
+ children: [/* @__PURE__ */ K(R, { render: /* @__PURE__ */ K(a, {
62
+ variant: "outline",
63
+ size: "sm",
64
+ children: /* @__PURE__ */ K(i, { id: "Apply catalog" })
65
+ }) }), /* @__PURE__ */ q(F, {
66
+ className: ie,
67
+ children: [
68
+ /* @__PURE__ */ q(N, { children: [/* @__PURE__ */ K(I, { children: /* @__PURE__ */ K(i, { id: "Apply catalog changes" }) }), /* @__PURE__ */ K(L, { children: /* @__PURE__ */ K(i, { id: "Paste a JSON or YAML catalog batch; products, prices and meters are maps keyed by their key. Each product, price and meter applies whole, unless a field it names was set differently by an edit: it is skipped and listed, and the rest applies. A batch that applied whole is remembered; retries preserve later catalog edits. Omitted records stay unchanged unless prune is true, which archives the omitted ones only batches set." }) })] }),
69
+ /* @__PURE__ */ q("div", {
70
+ className: "grid gap-3",
71
+ children: [
72
+ /* @__PURE__ */ K(B, {
73
+ htmlFor: l("catalog-application"),
74
+ children: /* @__PURE__ */ K(i, { id: "Catalog document" })
75
+ }),
76
+ /* @__PURE__ */ K(ce, {
77
+ id: l("catalog-application"),
78
+ className: "max-h-80 min-h-48 font-mono text-xs",
79
+ spellCheck: !1,
80
+ value: p,
81
+ disabled: _ !== void 0,
82
+ onChange: (e) => {
83
+ m(e.target.value), g(!1);
84
+ }
85
+ }),
86
+ h && !_ && /* @__PURE__ */ K("p", {
87
+ className: "text-sm",
88
+ children: /* @__PURE__ */ K(i, { id: "Review complete. Applying sends this exact document; this is not a database diff." })
89
+ }),
90
+ x && /* @__PURE__ */ K("p", {
91
+ role: "status",
92
+ className: "text-sm",
93
+ children: x
94
+ }),
95
+ y && y.conflicts.length > 0 && /* @__PURE__ */ K(be, { conflicts: y.conflicts }),
96
+ y && /* @__PURE__ */ K("pre", {
97
+ "aria-label": u("Batch receipt"),
98
+ className: "max-h-48 overflow-auto rounded-md border p-3 text-xs",
99
+ children: JSON.stringify(y, null, 2)
100
+ })
101
+ ]
102
+ }),
103
+ /* @__PURE__ */ q(P, { children: [
104
+ C && /* @__PURE__ */ K(a, {
105
+ variant: "outline",
106
+ onClick: () => {
107
+ v(void 0), g(!1), w(!1), S("");
108
+ },
109
+ children: /* @__PURE__ */ K(i, { id: "Edit batch" })
110
+ }),
111
+ y && y.conflicts.length > 0 && /* @__PURE__ */ K(a, {
112
+ variant: "destructive",
113
+ disabled: D.isPending,
114
+ onClick: () => void k(!0),
115
+ children: /* @__PURE__ */ K(i, { id: "Overwrite edits" })
116
+ }),
117
+ y ? /* @__PURE__ */ K(a, {
118
+ onClick: () => O(),
119
+ children: /* @__PURE__ */ K(i, { id: "New batch" })
120
+ }) : _ === void 0 ? h ? /* @__PURE__ */ K(a, {
121
+ disabled: !p.trim(),
122
+ onClick: () => void k(),
123
+ children: /* @__PURE__ */ K(i, { id: "Apply reviewed batch" })
124
+ }) : /* @__PURE__ */ K(a, {
125
+ disabled: !p.trim(),
126
+ onClick: () => g(!0),
127
+ children: /* @__PURE__ */ K(i, { id: "Review batch" })
128
+ }) : /* @__PURE__ */ K(a, {
129
+ disabled: D.isPending || C,
130
+ onClick: () => void k(),
131
+ children: D.isPending ? "Applying…" : "Retry exact batch"
132
+ })
133
+ ] })
134
+ ]
135
+ })]
136
+ });
137
+ }
138
+ function be({ conflicts: t }) {
139
+ let { text: n } = e();
140
+ return /* @__PURE__ */ K("ul", {
141
+ "aria-label": n("Skipped objects"),
142
+ className: "grid gap-2 text-sm",
143
+ children: t.map((e) => /* @__PURE__ */ q("li", {
144
+ className: "rounded-md border p-2",
145
+ children: [/* @__PURE__ */ q("p", {
146
+ className: "font-medium",
147
+ children: [
148
+ e.product_key ? `Price ${e.key} of product ${e.product_key}` : `${e.object === "meter" ? "Meter" : "Product"} ${e.key}`,
149
+ " ",
150
+ /* @__PURE__ */ K(i, { id: "skipped" })
151
+ ]
152
+ }), /* @__PURE__ */ K("ul", {
153
+ className: "mt-1 grid gap-1 text-xs text-muted-foreground",
154
+ children: e.fields.map((t) => /* @__PURE__ */ q("li", { children: [
155
+ t.field,
156
+ /* @__PURE__ */ K(i, { id: ": the batch says" }),
157
+ " ",
158
+ xe(t, t.file_value, e.currency),
159
+ /* @__PURE__ */ K(i, { id: ", an edit set" }),
160
+ " ",
161
+ xe(t, t.live_value, e.currency),
162
+ " (",
163
+ t.set_by,
164
+ ", ",
165
+ h(t.set_at),
166
+ ")"
167
+ ] }, t.field))
168
+ })]
169
+ }, `${e.object}:${e.product_key ?? ""}:${e.key}`))
170
+ });
171
+ }
172
+ function xe(e, t, n) {
173
+ return t == null ? "none" : (e.field === "unit_amount" || e.field === "trial_unit_amount") && typeof t == "string" && n ? g(t, n) : e.field.endsWith("_hours") && typeof t == "number" ? oe(t) : JSON.stringify(t);
174
+ }
175
+ //#endregion
176
+ //#region src/admin/pages/catalog/copilot-panel.tsx
177
+ function Se({ enabled: r, draftingEnabled: s }) {
178
+ let { text: c } = e(), { adminMutations: l } = n(), u = U(l.askCatalogCopilot()), d = Y({
179
+ defaultValues: { question: "" },
180
+ onSubmit: async ({ value: e }) => {
181
+ let t = e.question.trim();
182
+ if (t) {
183
+ u.reset();
184
+ try {
185
+ await u.mutateAsync(t);
186
+ } catch {}
187
+ }
188
+ }
189
+ }), f = u.data, p = u.error ? u.error instanceof t ? u.error.message : "ask failed" : null;
190
+ return r ? /* @__PURE__ */ K(ue, { children: /* @__PURE__ */ q(le, {
191
+ className: "flex flex-col gap-3",
192
+ children: [
193
+ /* @__PURE__ */ q("form", {
194
+ className: "flex items-center gap-2",
195
+ onSubmit: (e) => {
196
+ e.preventDefault(), e.stopPropagation(), d.handleSubmit();
197
+ },
198
+ children: [
199
+ /* @__PURE__ */ K(J, {
200
+ icon: me,
201
+ className: "size-4 shrink-0 text-muted-foreground"
202
+ }),
203
+ /* @__PURE__ */ K(d.Field, {
204
+ name: "question",
205
+ children: (e) => /* @__PURE__ */ K(o, {
206
+ value: e.state.value,
207
+ onBlur: e.handleBlur,
208
+ onChange: (t) => e.handleChange(t.target.value),
209
+ placeholder: s ? "Ask about your catalog, or ask for a change — e.g. \"who is still on the old premium price?\" or \"raise premium to $12\"" : "Ask about your catalog — e.g. \"what do we sell?\" or \"who is still on the old premium price?\"",
210
+ className: "flex-1"
211
+ })
212
+ }),
213
+ /* @__PURE__ */ K(d.Subscribe, {
214
+ selector: (e) => [e.values.question, e.isSubmitting],
215
+ children: ([e, t]) => /* @__PURE__ */ q(a, {
216
+ type: "submit",
217
+ size: "sm",
218
+ disabled: t || !e.trim(),
219
+ children: [t ? /* @__PURE__ */ K(J, {
220
+ icon: ge,
221
+ className: "size-3.5 animate-spin"
222
+ }) : null, /* @__PURE__ */ K(i, { id: "Ask" })]
223
+ })
224
+ })
225
+ ]
226
+ }),
227
+ u.isPending ? /* @__PURE__ */ K("p", {
228
+ className: "text-xs text-muted-foreground",
229
+ children: /* @__PURE__ */ K(i, { id: "Checking your catalog…" })
230
+ }) : null,
231
+ p ? /* @__PURE__ */ K("p", {
232
+ className: "text-xs whitespace-pre-wrap text-destructive",
233
+ role: "alert",
234
+ children: p
235
+ }) : null,
236
+ f ? /* @__PURE__ */ q("div", {
237
+ className: "flex flex-col gap-3",
238
+ children: [
239
+ /* @__PURE__ */ q("div", {
240
+ className: "flex items-start justify-between gap-2",
241
+ children: [/* @__PURE__ */ K("p", {
242
+ className: "text-sm whitespace-pre-wrap",
243
+ children: f.answer
244
+ }), /* @__PURE__ */ K(a, {
245
+ variant: "ghost",
246
+ size: "icon",
247
+ className: "size-6 shrink-0",
248
+ "aria-label": c("Dismiss answer"),
249
+ onClick: () => {
250
+ u.reset();
251
+ },
252
+ children: /* @__PURE__ */ K(J, {
253
+ icon: he,
254
+ className: "size-3.5"
255
+ })
256
+ })]
257
+ }),
258
+ f.evidence.length > 0 && /* @__PURE__ */ K("div", {
259
+ className: "flex flex-col gap-2",
260
+ children: f.evidence.map((e, t) => /* @__PURE__ */ q("div", {
261
+ className: "rounded-lg border bg-muted/30 p-2",
262
+ children: [/* @__PURE__ */ K("span", {
263
+ className: "mb-1 block text-xs font-medium text-muted-foreground uppercase",
264
+ children: e.tool
265
+ }), /* @__PURE__ */ K("pre", {
266
+ className: "max-h-48 overflow-auto text-xs whitespace-pre-wrap",
267
+ children: e.summary
268
+ })]
269
+ }, t))
270
+ }),
271
+ f.drafts?.map((e, t) => /* @__PURE__ */ K(Ce, { draft: e }, t))
272
+ ]
273
+ }) : null
274
+ ]
275
+ }) }) : null;
276
+ }
277
+ function Ce({ draft: e }) {
278
+ return e.kind === "refused" && e.refusal ? /* @__PURE__ */ q("div", {
279
+ className: "rounded-lg border border-dashed p-3 text-xs",
280
+ children: [
281
+ /* @__PURE__ */ K("p", {
282
+ className: "mb-1 flex items-center gap-2 font-medium",
283
+ children: /* @__PURE__ */ q(M, {
284
+ variant: "secondary",
285
+ children: [/* @__PURE__ */ K(i, { id: "refused: " }), e.refusal.code]
286
+ })
287
+ }),
288
+ /* @__PURE__ */ K("p", {
289
+ className: "text-muted-foreground",
290
+ children: e.refusal.reason
291
+ }),
292
+ /* @__PURE__ */ K("p", {
293
+ className: "mt-1",
294
+ children: e.refusal.workaround
295
+ })
296
+ ]
297
+ }) : e.kind === "price_change" && e.price_change ? /* @__PURE__ */ K(we, { draft: e.price_change }) : e.kind === "new_price" && e.new_price ? /* @__PURE__ */ K(Te, { draft: e.new_price }) : null;
298
+ }
299
+ function we({ draft: e }) {
300
+ let { toastApiError: t, adminMutations: r } = n(), o = U(r.loadCatalogPriceDraft());
301
+ return /* @__PURE__ */ q("div", {
302
+ className: "rounded-lg border bg-muted/30 p-3 text-sm",
303
+ children: [
304
+ /* @__PURE__ */ q("div", {
305
+ className: "mb-1 flex items-center gap-2",
306
+ children: [
307
+ /* @__PURE__ */ K(J, {
308
+ icon: ve,
309
+ className: "size-3.5 text-muted-foreground"
310
+ }),
311
+ /* @__PURE__ */ K("span", {
312
+ className: "text-xs font-medium text-muted-foreground uppercase",
313
+ children: /* @__PURE__ */ K(i, { id: "Draft: price change" })
314
+ }),
315
+ /* @__PURE__ */ K(M, {
316
+ variant: "secondary",
317
+ children: BigInt(e.new_amount) > BigInt(e.current_amount) ? "increase" : "decrease"
318
+ })
319
+ ]
320
+ }),
321
+ /* @__PURE__ */ K("p", { children: e.review_text }),
322
+ /* @__PURE__ */ q("p", {
323
+ className: "mt-1 text-xs text-muted-foreground",
324
+ children: [
325
+ g(e.current_amount, e.currency),
326
+ " →",
327
+ " ",
328
+ g(e.new_amount, e.currency),
329
+ " ·",
330
+ " ",
331
+ e.affected_count.toLocaleString(),
332
+ /* @__PURE__ */ K(i, { id: " affected · requires human confirm" })
333
+ ]
334
+ }),
335
+ o.data ? /* @__PURE__ */ K(de, {
336
+ price: o.data.price,
337
+ productName: o.data.productName,
338
+ productKey: o.data.productKey,
339
+ draft: e,
340
+ onDone: () => o.reset()
341
+ }) : /* @__PURE__ */ K(a, {
342
+ size: "sm",
343
+ className: "mt-2",
344
+ disabled: o.isPending,
345
+ onClick: async () => {
346
+ try {
347
+ await o.mutateAsync({
348
+ productKey: e.product_key,
349
+ priceKey: e.price_key
350
+ });
351
+ } catch (e) {
352
+ t(e, "Load draft for review");
353
+ }
354
+ },
355
+ children: o.isPending ? "Loading…" : "Review in wizard"
356
+ })
357
+ ]
358
+ });
359
+ }
360
+ function Te({ draft: e }) {
361
+ let { toastApiError: t, adminMutations: r } = n(), o = G(), s = U(r.createCatalogDraftPrice(o));
362
+ return /* @__PURE__ */ q("div", {
363
+ className: "rounded-lg border bg-muted/30 p-3 text-sm",
364
+ children: [
365
+ /* @__PURE__ */ q("div", {
366
+ className: "mb-1 flex items-center gap-2",
367
+ children: [/* @__PURE__ */ K(J, {
368
+ icon: ve,
369
+ className: "size-3.5 text-muted-foreground"
370
+ }), /* @__PURE__ */ K("span", {
371
+ className: "text-xs font-medium text-muted-foreground uppercase",
372
+ children: /* @__PURE__ */ K(i, { id: "Draft: new price" })
373
+ })]
374
+ }),
375
+ /* @__PURE__ */ K("p", { children: e.review_text }),
376
+ /* @__PURE__ */ q("p", {
377
+ className: "mt-1 text-xs text-muted-foreground",
378
+ children: [
379
+ /* @__PURE__ */ K(i, { id: "key: " }),
380
+ e.create_price.key,
381
+ " ·",
382
+ " ",
383
+ g(e.create_price.unit_amount, e.create_price.currency)
384
+ ]
385
+ }),
386
+ /* @__PURE__ */ K(a, {
387
+ size: "sm",
388
+ className: "mt-2",
389
+ disabled: s.isPending || s.isSuccess,
390
+ onClick: async () => {
391
+ try {
392
+ await s.mutateAsync(e.create_price);
393
+ } catch (e) {
394
+ t(e, "Create drafted price");
395
+ }
396
+ },
397
+ children: s.isSuccess ? "Created" : s.isPending ? "Creating…" : "Create this price"
398
+ })
399
+ ]
400
+ });
401
+ }
402
+ //#endregion
403
+ //#region src/admin/pages/catalog/index.tsx
404
+ var X = H.createContext(!1);
405
+ function Ee({ title: e, children: t }) {
406
+ let n = u()?.assistants, r = d();
407
+ return /* @__PURE__ */ K(X.Provider, {
408
+ value: r,
409
+ children: /* @__PURE__ */ q("div", {
410
+ className: "flex flex-col gap-4",
411
+ children: [
412
+ /* @__PURE__ */ K("h1", {
413
+ className: "text-2xl font-semibold tracking-tight",
414
+ children: e
415
+ }),
416
+ /* @__PURE__ */ K(Se, {
417
+ enabled: n?.catalog_copilot ?? !1,
418
+ draftingEnabled: r && (n?.catalog_drafting ?? !1)
419
+ }),
420
+ !r && /* @__PURE__ */ K("p", {
421
+ className: "text-sm text-muted-foreground",
422
+ children: /* @__PURE__ */ K(i, { id: "Catalog updates are unavailable. You can still browse products and prices." })
423
+ }),
424
+ t
425
+ ]
426
+ })
427
+ });
428
+ }
429
+ function De() {
430
+ let { text: t } = e();
431
+ return /* @__PURE__ */ K(Ee, {
432
+ title: t("Products"),
433
+ children: /* @__PURE__ */ K(Ae, {})
434
+ });
435
+ }
436
+ function Oe() {
437
+ let { text: t } = e();
438
+ return /* @__PURE__ */ K(Ee, {
439
+ title: t("Prices"),
440
+ children: /* @__PURE__ */ K(Pe, {})
441
+ });
442
+ }
443
+ function ke() {
444
+ let { text: t } = e();
445
+ return l() ? /* @__PURE__ */ q("div", {
446
+ className: "flex flex-col gap-4",
447
+ children: [/* @__PURE__ */ K("h1", {
448
+ className: "text-2xl font-semibold tracking-tight",
449
+ children: t("Drift")
450
+ }), /* @__PURE__ */ K(Le, {})]
451
+ }) : null;
452
+ }
453
+ var Z = 100;
454
+ function Ae() {
455
+ let { adminQueries: e } = n(), t = H.useContext(X), r = T("", Z), { data: a, isPending: o, isFetching: c } = W(e.products({
456
+ limit: r.size,
457
+ cursor: r.cursor,
458
+ errorAction: "Load products"
459
+ }));
460
+ return /* @__PURE__ */ q("div", {
461
+ className: "flex flex-col gap-3",
462
+ children: [
463
+ /* @__PURE__ */ K("div", {
464
+ className: "flex justify-end gap-2",
465
+ children: t && /* @__PURE__ */ q(fe, { children: [/* @__PURE__ */ K(ye, {}), /* @__PURE__ */ K(Ne, {})] })
466
+ }),
467
+ o ? /* @__PURE__ */ K("div", {
468
+ className: "flex flex-col gap-3 py-2",
469
+ children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ K(s, { className: "h-6 w-full" }, t))
470
+ }) : /* @__PURE__ */ K("div", {
471
+ className: "overflow-x-auto",
472
+ children: /* @__PURE__ */ q(j, { children: [/* @__PURE__ */ K(O, { children: /* @__PURE__ */ q(A, {
473
+ className: "hover:bg-transparent",
474
+ children: [
475
+ /* @__PURE__ */ K(E, {
476
+ className: "text-muted-foreground",
477
+ children: /* @__PURE__ */ K(i, { id: "Product" })
478
+ }),
479
+ /* @__PURE__ */ K(E, {
480
+ className: "text-muted-foreground",
481
+ children: /* @__PURE__ */ K(i, { id: "Key" })
482
+ }),
483
+ /* @__PURE__ */ K(E, {
484
+ className: "text-muted-foreground",
485
+ children: /* @__PURE__ */ K(i, { id: "Tier" })
486
+ }),
487
+ /* @__PURE__ */ K(E, {
488
+ className: "text-muted-foreground",
489
+ children: /* @__PURE__ */ K(i, { id: "Entitlements" })
490
+ }),
491
+ /* @__PURE__ */ K(E, {
492
+ className: "text-muted-foreground",
493
+ children: /* @__PURE__ */ K(i, { id: "State" })
494
+ }),
495
+ /* @__PURE__ */ K(E, {})
496
+ ]
497
+ }) }), /* @__PURE__ */ q(D, { children: [(a?.data ?? []).map((e) => /* @__PURE__ */ K(je, { product: e }, e.id)), !a?.data?.length && /* @__PURE__ */ K(A, { children: /* @__PURE__ */ K(k, {
498
+ colSpan: 6,
499
+ className: "h-24 text-center text-muted-foreground",
500
+ children: /* @__PURE__ */ K(i, { id: "No products yet." })
501
+ }) })] })] })
502
+ }),
503
+ /* @__PURE__ */ K(w, {
504
+ pages: r,
505
+ rows: a?.data?.length ?? 0,
506
+ nextCursor: a?.next_cursor,
507
+ busy: c,
508
+ sizes: [
509
+ 50,
510
+ 100,
511
+ 200
512
+ ]
513
+ })
514
+ ]
515
+ });
516
+ }
517
+ function je({ product: e }) {
518
+ let { toast: t, toastApiError: r, adminMutations: o } = n(), s = H.useContext(X), c = G(), l = U(o.setProductActive(c));
519
+ return /* @__PURE__ */ q(A, {
520
+ className: e.archived ? "opacity-60" : void 0,
521
+ children: [
522
+ /* @__PURE__ */ K(k, {
523
+ className: "font-medium",
524
+ children: e.display_name
525
+ }),
526
+ /* @__PURE__ */ K(k, {
527
+ className: "text-xs text-muted-foreground",
528
+ children: e.key
529
+ }),
530
+ /* @__PURE__ */ K(k, { children: e.tier_group ? `${e.tier_group} #${e.tier_rank}` : "—" }),
531
+ /* @__PURE__ */ K(k, { children: /* @__PURE__ */ K("span", {
532
+ className: "flex flex-wrap gap-1",
533
+ children: e.entitlements.map((e) => /* @__PURE__ */ K(M, {
534
+ variant: "secondary",
535
+ className: "text-[10px]",
536
+ children: e
537
+ }, e))
538
+ }) }),
539
+ /* @__PURE__ */ K(k, { children: e.archived ? /* @__PURE__ */ K(M, {
540
+ variant: "secondary",
541
+ children: /* @__PURE__ */ K(i, { id: "archived" })
542
+ }) : /* @__PURE__ */ K(te, { status: "active" }) }),
543
+ /* @__PURE__ */ K(k, {
544
+ className: "text-right",
545
+ children: s && /* @__PURE__ */ q("div", {
546
+ className: "flex justify-end gap-2",
547
+ children: [s && /* @__PURE__ */ K(Ne, { product: e }), /* @__PURE__ */ K(a, {
548
+ variant: "outline",
549
+ size: "sm",
550
+ disabled: !s || l.isPending,
551
+ onClick: async () => {
552
+ try {
553
+ await l.mutateAsync({
554
+ id: e.id,
555
+ active: e.archived,
556
+ revision: e.revision
557
+ }), t.success(e.archived ? "Product activated" : "Product deactivated");
558
+ } catch (e) {
559
+ r(e, "Toggle product");
560
+ }
561
+ },
562
+ children: e.archived ? "Activate" : "Deactivate"
563
+ })]
564
+ })
565
+ })
566
+ ]
567
+ });
568
+ }
569
+ function Me(e) {
570
+ return {
571
+ key: e?.key ?? "",
572
+ name: e?.display_name ?? "",
573
+ description: e?.description ?? "",
574
+ tierGroup: e?.tier_group ?? "",
575
+ tierRank: String(e?.tier_rank ?? 0),
576
+ entitlements: (e?.entitlements ?? []).join(",")
577
+ };
578
+ }
579
+ function Ne({ product: t }) {
580
+ let { toast: r, toastApiError: s, adminMutations: c } = n(), { text: l, id: u } = e(), [d, f] = H.useState(!1), p = G(), m = U(c.createProduct(p)), h = U(c.updateProduct(p)), g = Y({
581
+ defaultValues: Me(t),
582
+ onSubmit: async ({ value: e }) => {
583
+ let n = e.entitlements.split(",").map((e) => e.trim()).filter(Boolean);
584
+ try {
585
+ t ? (await h.mutateAsync({
586
+ id: t.id,
587
+ product: {
588
+ display_name: e.name,
589
+ description: e.description,
590
+ tier_group: e.tierGroup || null,
591
+ tier_rank: Number(e.tierRank) || 0,
592
+ entitlements: n,
593
+ expected_revision: t.revision
594
+ }
595
+ }), r.success("Product updated")) : (await m.mutateAsync({
596
+ key: e.key,
597
+ display_name: e.name,
598
+ description: e.description,
599
+ tier_group: e.tierGroup || void 0,
600
+ tier_rank: Number(e.tierRank) || 0,
601
+ entitlements: n
602
+ }), r.success("Product created")), g.reset(e), f(!1);
603
+ } catch (e) {
604
+ s(e, t ? "Update product" : "Create product");
605
+ }
606
+ }
607
+ });
608
+ return /* @__PURE__ */ q(z, {
609
+ open: d,
610
+ onOpenChange: (e) => {
611
+ e && g.reset(Me(t)), f(e);
612
+ },
613
+ children: [/* @__PURE__ */ K(R, { render: t ? /* @__PURE__ */ K(a, {
614
+ variant: "outline",
615
+ size: "sm",
616
+ children: /* @__PURE__ */ K(i, { id: "Edit" })
617
+ }) : /* @__PURE__ */ q(a, {
618
+ size: "sm",
619
+ children: [/* @__PURE__ */ K(J, {
620
+ icon: pe,
621
+ className: "size-4"
622
+ }), /* @__PURE__ */ K(i, { id: " Product" })]
623
+ }) }), /* @__PURE__ */ q(F, {
624
+ className: re,
625
+ children: [/* @__PURE__ */ q(N, { children: [/* @__PURE__ */ K(I, { children: t ? "Edit product" : "New product" }), /* @__PURE__ */ K(L, { children: /* @__PURE__ */ K(i, { id: "A product is the thing a customer gets. You set what it costs afterwards, by adding a price to it." }) })] }), /* @__PURE__ */ q("form", {
626
+ onSubmit: (e) => {
627
+ e.preventDefault(), e.stopPropagation(), g.handleSubmit();
628
+ },
629
+ className: "grid gap-4",
630
+ children: [/* @__PURE__ */ q("div", {
631
+ className: "grid gap-3",
632
+ children: [
633
+ !t && /* @__PURE__ */ K(g.Field, {
634
+ name: "key",
635
+ validators: { onBlur: ({ value: e }) => e.trim() ? void 0 : "Enter a product key" },
636
+ children: (e) => /* @__PURE__ */ q($, {
637
+ label: l("Key"),
638
+ id: "p-key",
639
+ hint: "A short name you use in your own code. It cannot be changed later.",
640
+ children: [/* @__PURE__ */ K(o, {
641
+ id: u("p-key"),
642
+ value: e.state.value,
643
+ onBlur: e.handleBlur,
644
+ onChange: (t) => e.handleChange(t.target.value),
645
+ placeholder: l("premium-monthly"),
646
+ "aria-invalid": e.state.meta.errors.length > 0
647
+ }), /* @__PURE__ */ K(v, { errors: e.state.meta.errors })]
648
+ })
649
+ }),
650
+ /* @__PURE__ */ K(g.Field, {
651
+ name: "name",
652
+ validators: { onBlur: ({ value: e }) => e.trim() ? void 0 : "Enter a display name" },
653
+ children: (e) => /* @__PURE__ */ q($, {
654
+ label: l("Display name"),
655
+ id: "p-name",
656
+ hint: "What customers see on checkout and invoices.",
657
+ children: [/* @__PURE__ */ K(o, {
658
+ id: u("p-name"),
659
+ value: e.state.value,
660
+ onBlur: e.handleBlur,
661
+ onChange: (t) => e.handleChange(t.target.value),
662
+ "aria-invalid": e.state.meta.errors.length > 0
663
+ }), /* @__PURE__ */ K(v, { errors: e.state.meta.errors })]
664
+ })
665
+ }),
666
+ /* @__PURE__ */ K(g.Field, {
667
+ name: "description",
668
+ children: (e) => /* @__PURE__ */ K($, {
669
+ label: l("Description"),
670
+ id: "p-desc",
671
+ children: /* @__PURE__ */ K(o, {
672
+ id: u("p-desc"),
673
+ value: e.state.value,
674
+ onBlur: e.handleBlur,
675
+ onChange: (t) => e.handleChange(t.target.value)
676
+ })
677
+ })
678
+ }),
679
+ /* @__PURE__ */ q("div", {
680
+ className: "grid grid-cols-2 gap-3",
681
+ children: [/* @__PURE__ */ K(g.Field, {
682
+ name: "tierGroup",
683
+ children: (e) => /* @__PURE__ */ K($, {
684
+ label: l("Tier group"),
685
+ id: "p-tg",
686
+ hint: "Products in one group are upgrades of each other. Leave empty if this stands alone.",
687
+ children: /* @__PURE__ */ K(o, {
688
+ id: u("p-tg"),
689
+ value: e.state.value,
690
+ onBlur: e.handleBlur,
691
+ onChange: (t) => e.handleChange(t.target.value)
692
+ })
693
+ })
694
+ }), /* @__PURE__ */ K(g.Field, {
695
+ name: "tierRank",
696
+ children: (e) => /* @__PURE__ */ K($, {
697
+ label: l("Tier rank"),
698
+ id: "p-tr",
699
+ hint: "Higher rank means a higher tier in the group.",
700
+ children: /* @__PURE__ */ K(o, {
701
+ id: u("p-tr"),
702
+ type: "number",
703
+ value: e.state.value,
704
+ onBlur: e.handleBlur,
705
+ onChange: (t) => e.handleChange(t.target.value)
706
+ })
707
+ })
708
+ })]
709
+ }),
710
+ /* @__PURE__ */ K(g.Field, {
711
+ name: "entitlements",
712
+ children: (e) => /* @__PURE__ */ K($, {
713
+ label: l("Entitlements"),
714
+ id: "p-ents",
715
+ hint: "The access names your product checks. Separate several with commas.",
716
+ children: /* @__PURE__ */ K(o, {
717
+ id: u("p-ents"),
718
+ value: e.state.value,
719
+ onBlur: e.handleBlur,
720
+ onChange: (t) => e.handleChange(t.target.value),
721
+ placeholder: l("premium, downloads")
722
+ })
723
+ })
724
+ })
725
+ ]
726
+ }), /* @__PURE__ */ K(P, { children: /* @__PURE__ */ K(g.Subscribe, {
727
+ selector: (e) => [
728
+ e.values.key,
729
+ e.values.name,
730
+ e.isSubmitting
731
+ ],
732
+ children: ([e, n, r]) => /* @__PURE__ */ q(fe, { children: [/* @__PURE__ */ K(a, {
733
+ type: "button",
734
+ variant: "outline",
735
+ disabled: r,
736
+ onClick: () => f(!1),
737
+ children: /* @__PURE__ */ K(i, { id: "Cancel" })
738
+ }), /* @__PURE__ */ K(a, {
739
+ type: "submit",
740
+ disabled: r || !n.trim() || !t && !e.trim(),
741
+ children: r ? "Saving…" : "Save product"
742
+ })] })
743
+ }) })]
744
+ })]
745
+ })]
746
+ });
747
+ }
748
+ function Pe() {
749
+ let { adminQueries: e } = n(), t = H.useContext(X), r = T("", Z), { data: a } = W(e.allProducts({ errorAction: "Load products" })), { data: o, isPending: c, isFetching: l } = W(e.prices({
750
+ limit: r.size,
751
+ cursor: r.cursor,
752
+ errorAction: "Load prices"
753
+ }));
754
+ return /* @__PURE__ */ q("div", {
755
+ className: "flex flex-col gap-3",
756
+ children: [
757
+ /* @__PURE__ */ K("div", {
758
+ className: "flex justify-end",
759
+ children: t && /* @__PURE__ */ K(Ie, { products: a?.data ?? [] })
760
+ }),
761
+ c ? /* @__PURE__ */ K("div", {
762
+ className: "flex flex-col gap-3 py-2",
763
+ children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ K(s, { className: "h-6 w-full" }, t))
764
+ }) : /* @__PURE__ */ K("div", {
765
+ className: "overflow-x-auto",
766
+ children: /* @__PURE__ */ q(j, { children: [/* @__PURE__ */ K(O, { children: /* @__PURE__ */ q(A, {
767
+ className: "hover:bg-transparent",
768
+ children: [
769
+ /* @__PURE__ */ K(E, {
770
+ className: "text-muted-foreground",
771
+ children: /* @__PURE__ */ K(i, { id: "Price" })
772
+ }),
773
+ /* @__PURE__ */ K(E, {
774
+ className: "text-muted-foreground",
775
+ children: /* @__PURE__ */ K(i, { id: "Product" })
776
+ }),
777
+ /* @__PURE__ */ K(E, {
778
+ className: "text-muted-foreground",
779
+ children: /* @__PURE__ */ K(i, { id: "Amount" })
780
+ }),
781
+ /* @__PURE__ */ K(E, {
782
+ className: "text-muted-foreground",
783
+ children: /* @__PURE__ */ K(i, { id: "Renews" })
784
+ }),
785
+ /* @__PURE__ */ K(E, {
786
+ className: "text-muted-foreground",
787
+ children: /* @__PURE__ */ K(i, { id: "Providers" })
788
+ }),
789
+ /* @__PURE__ */ K(E, {
790
+ className: "text-muted-foreground",
791
+ children: /* @__PURE__ */ K(i, { id: "State" })
792
+ }),
793
+ /* @__PURE__ */ K(E, {})
794
+ ]
795
+ }) }), /* @__PURE__ */ q(D, { children: [(o?.data ?? []).map((e) => /* @__PURE__ */ K(Fe, {
796
+ price: e,
797
+ product: a?.data.find((t) => t.id === e.product_id)
798
+ }, e.id)), !o?.data?.length && /* @__PURE__ */ K(A, { children: /* @__PURE__ */ K(k, {
799
+ colSpan: 7,
800
+ className: "h-24 text-center text-muted-foreground",
801
+ children: /* @__PURE__ */ K(i, { id: "No prices yet." })
802
+ }) })] })] })
803
+ }),
804
+ /* @__PURE__ */ K(w, {
805
+ pages: r,
806
+ rows: o?.data?.length ?? 0,
807
+ nextCursor: o?.next_cursor,
808
+ busy: l,
809
+ sizes: [
810
+ 50,
811
+ 100,
812
+ 200
813
+ ]
814
+ })
815
+ ]
816
+ });
817
+ }
818
+ function Fe({ price: e, product: t }) {
819
+ let { toast: o, toastApiError: s, adminMutations: c } = n(), l = t?.display_name ?? _(e.product_id, 13), u = H.useContext(X), d = G(), f = U(c.setPriceActive(d));
820
+ return /* @__PURE__ */ q(ee, {
821
+ to: `/catalog/prices/${encodeURIComponent(e.id)}`,
822
+ className: e.archived ? "opacity-60" : void 0,
823
+ children: [
824
+ /* @__PURE__ */ K(k, {
825
+ className: "text-xs text-muted-foreground",
826
+ children: /* @__PURE__ */ K(r, {
827
+ className: "underline-offset-2 hover:underline",
828
+ to: `/catalog/prices/${encodeURIComponent(e.id)}`,
829
+ children: e.id
830
+ })
831
+ }),
832
+ /* @__PURE__ */ K(k, {
833
+ className: "font-medium",
834
+ children: l
835
+ }),
836
+ /* @__PURE__ */ K(k, {
837
+ className: "tabular-nums",
838
+ children: se(e)
839
+ }),
840
+ /* @__PURE__ */ K(k, { children: ae(e) }),
841
+ /* @__PURE__ */ K(k, { children: /* @__PURE__ */ K("span", {
842
+ className: "flex flex-wrap gap-1",
843
+ children: Object.entries(e.psps ?? {}).map(([e, t]) => /* @__PURE__ */ q(M, {
844
+ variant: "secondary",
845
+ className: t.status === "linked" ? "" : "bg-held-surface text-held",
846
+ title: t.message || void 0,
847
+ children: [
848
+ e,
849
+ ": ",
850
+ t.status
851
+ ]
852
+ }, e))
853
+ }) }),
854
+ /* @__PURE__ */ K(k, { children: e.archived ? /* @__PURE__ */ K(M, {
855
+ variant: "secondary",
856
+ children: /* @__PURE__ */ K(i, { id: "archived" })
857
+ }) : /* @__PURE__ */ K(te, { status: "active" }) }),
858
+ /* @__PURE__ */ K(k, {
859
+ className: "text-right",
860
+ children: u && /* @__PURE__ */ q("div", {
861
+ className: "flex justify-end gap-2",
862
+ children: [u && /* @__PURE__ */ K(de, {
863
+ price: e,
864
+ productName: l,
865
+ productKey: t?.key
866
+ }), /* @__PURE__ */ K(a, {
867
+ variant: "outline",
868
+ size: "sm",
869
+ disabled: !u || f.isPending,
870
+ onClick: async () => {
871
+ try {
872
+ await f.mutateAsync({
873
+ id: e.id,
874
+ active: e.archived,
875
+ revision: e.revision
876
+ }), o.success(e.archived ? "Price activated" : "Price deactivated");
877
+ } catch (e) {
878
+ s(e, "Toggle price");
879
+ }
880
+ },
881
+ children: e.archived ? "Activate" : "Deactivate"
882
+ })]
883
+ })
884
+ })
885
+ ]
886
+ });
887
+ }
888
+ var Q = ({ value: e }) => !e || V(e) ? void 0 : "Use hours, days or weeks, such as 30 days";
889
+ function Ie({ products: t }) {
890
+ let { toast: r, toastApiError: s, adminMutations: c } = n(), { text: l, id: u } = e(), [d, h] = H.useState(!1), g = G(), _ = U(c.createPrice(g)), w = Y({
891
+ defaultValues: {
892
+ productId: "",
893
+ amount: "",
894
+ currency: "USD",
895
+ accessDuration: "",
896
+ billingInterval: ""
897
+ },
898
+ onSubmit: async ({ value: e }) => {
899
+ let t = f(e.amount, e.currency);
900
+ if (t === null || BigInt(t) <= 0n) return;
901
+ let n = V(e.accessDuration), i = V(e.billingInterval);
902
+ if (!(e.accessDuration && !n || e.billingInterval && !i)) try {
903
+ await _.mutateAsync({
904
+ product_id: e.productId,
905
+ unit_amount: t,
906
+ currency: e.currency,
907
+ ...n ? { access_duration_hours: n } : {},
908
+ ...i ? { billing_interval_hours: i } : {}
909
+ }), w.reset(), r.success("Price created"), h(!1);
910
+ } catch (e) {
911
+ s(e, "Create price");
912
+ }
913
+ }
914
+ }), T = (e) => {
915
+ e && w.reset(), h(e);
916
+ };
917
+ return /* @__PURE__ */ q(z, {
918
+ open: d,
919
+ onOpenChange: T,
920
+ children: [/* @__PURE__ */ K(R, { render: /* @__PURE__ */ q(a, {
921
+ size: "sm",
922
+ children: [/* @__PURE__ */ K(J, {
923
+ icon: pe,
924
+ className: "size-4"
925
+ }), /* @__PURE__ */ K(i, { id: " Price" })]
926
+ }) }), /* @__PURE__ */ q(F, {
927
+ className: re,
928
+ children: [/* @__PURE__ */ q(N, { children: [/* @__PURE__ */ K(I, { children: /* @__PURE__ */ K(i, { id: "New price" }) }), /* @__PURE__ */ K(L, { children: /* @__PURE__ */ K(i, { id: "These terms cannot be changed later. To charge a different amount, create another price and deactivate this one." }) })] }), /* @__PURE__ */ q("form", {
929
+ onSubmit: (e) => {
930
+ e.preventDefault(), e.stopPropagation(), w.handleSubmit();
931
+ },
932
+ className: "grid gap-4",
933
+ children: [/* @__PURE__ */ q("div", {
934
+ className: "grid gap-3",
935
+ children: [
936
+ /* @__PURE__ */ K(w.Field, {
937
+ name: "productId",
938
+ children: (e) => /* @__PURE__ */ K($, {
939
+ label: l("Product"),
940
+ id: "pr-prod",
941
+ children: /* @__PURE__ */ q(C, {
942
+ items: t.map((e) => ({
943
+ value: e.id,
944
+ label: `${e.display_name} (${e.key})`
945
+ })),
946
+ value: e.state.value || null,
947
+ onValueChange: (t) => e.handleChange(t ?? ""),
948
+ children: [/* @__PURE__ */ K(b, {
949
+ id: u("pr-prod"),
950
+ className: "w-full",
951
+ children: /* @__PURE__ */ K(y, { placeholder: l("Pick a product…") })
952
+ }), /* @__PURE__ */ K(x, { children: t.map((e) => /* @__PURE__ */ q(S, {
953
+ value: e.id,
954
+ children: [
955
+ e.display_name,
956
+ " (",
957
+ e.key,
958
+ ")"
959
+ ]
960
+ }, e.id)) })]
961
+ })
962
+ })
963
+ }),
964
+ /* @__PURE__ */ K($, {
965
+ label: l("Amount"),
966
+ id: "pr-amount",
967
+ hint: "Enter it the way you would write it, such as 19.90.",
968
+ children: /* @__PURE__ */ q("div", {
969
+ className: "flex gap-2",
970
+ children: [/* @__PURE__ */ K(w.Field, {
971
+ name: "amount",
972
+ validators: {
973
+ onBlurListenTo: ["currency"],
974
+ onBlur: ({ value: e, fieldApi: t }) => BigInt(f(e, t.form.getFieldValue("currency")) ?? "0") > 0n ? void 0 : "Enter an amount greater than zero"
975
+ },
976
+ children: (e) => /* @__PURE__ */ q("div", {
977
+ className: "flex-1",
978
+ children: [/* @__PURE__ */ K(o, {
979
+ id: u("pr-amount"),
980
+ type: "number",
981
+ step: "any",
982
+ min: "0",
983
+ value: e.state.value,
984
+ onBlur: e.handleBlur,
985
+ onChange: (t) => e.handleChange(t.target.value),
986
+ "aria-invalid": e.state.meta.errors.length > 0
987
+ }), /* @__PURE__ */ K(v, { errors: e.state.meta.errors })]
988
+ })
989
+ }), /* @__PURE__ */ K(w.Field, {
990
+ name: "currency",
991
+ validators: { onChange: ({ value: e }) => m(e) === void 0 ? `Use ${p.join(", ")}` : void 0 },
992
+ children: (e) => /* @__PURE__ */ K(o, {
993
+ id: u("pr-cur"),
994
+ "aria-label": l("Currency"),
995
+ className: "w-24",
996
+ value: e.state.value,
997
+ maxLength: Math.max(...p.map((e) => e.length)),
998
+ autoCapitalize: "characters",
999
+ spellCheck: !1,
1000
+ placeholder: l("USD"),
1001
+ onBlur: e.handleBlur,
1002
+ onChange: (t) => e.handleChange(t.target.value.toUpperCase())
1003
+ })
1004
+ })]
1005
+ })
1006
+ }),
1007
+ /* @__PURE__ */ K(w.Field, {
1008
+ name: "accessDuration",
1009
+ validators: { onBlur: Q },
1010
+ children: (e) => /* @__PURE__ */ q($, {
1011
+ label: l("Access duration"),
1012
+ id: "pr-dur",
1013
+ hint: "Such as 30 days, 1 week or 12 hours. Leave it empty for access that never expires.",
1014
+ children: [/* @__PURE__ */ K(o, {
1015
+ id: u("pr-dur"),
1016
+ placeholder: l("Never expires"),
1017
+ value: e.state.value,
1018
+ onBlur: e.handleBlur,
1019
+ onChange: (t) => e.handleChange(t.target.value),
1020
+ "aria-invalid": e.state.meta.errors.length > 0
1021
+ }), /* @__PURE__ */ K(v, { errors: e.state.meta.errors })]
1022
+ })
1023
+ }),
1024
+ /* @__PURE__ */ K(w.Field, {
1025
+ name: "billingInterval",
1026
+ validators: { onBlur: Q },
1027
+ children: (e) => /* @__PURE__ */ q("div", {
1028
+ className: "grid gap-3 rounded-md border p-3",
1029
+ children: [/* @__PURE__ */ q("div", {
1030
+ className: "flex items-center justify-between gap-4",
1031
+ children: [/* @__PURE__ */ K(B, {
1032
+ htmlFor: u("pr-renew"),
1033
+ children: /* @__PURE__ */ K(i, { id: "Recurring billing" })
1034
+ }), /* @__PURE__ */ K(ne, {
1035
+ id: u("pr-renew"),
1036
+ checked: !!e.state.value,
1037
+ onCheckedChange: (t) => e.handleChange(t ? "30 days" : "")
1038
+ })]
1039
+ }), e.state.value ? /* @__PURE__ */ q($, {
1040
+ label: l("Billing interval"),
1041
+ id: "pr-billing",
1042
+ hint: "Time between payments, such as 30 days, until the customer cancels.",
1043
+ children: [/* @__PURE__ */ K(o, {
1044
+ id: u("pr-billing"),
1045
+ required: !0,
1046
+ value: e.state.value,
1047
+ onBlur: e.handleBlur,
1048
+ onChange: (t) => e.handleChange(t.target.value),
1049
+ "aria-invalid": e.state.meta.errors.length > 0
1050
+ }), /* @__PURE__ */ K(v, { errors: e.state.meta.errors })]
1051
+ }) : /* @__PURE__ */ K("p", {
1052
+ className: "text-xs text-muted-foreground",
1053
+ children: /* @__PURE__ */ K(i, { id: "One-time payment." })
1054
+ })]
1055
+ })
1056
+ })
1057
+ ]
1058
+ }), /* @__PURE__ */ q(P, { children: [/* @__PURE__ */ K(a, {
1059
+ type: "button",
1060
+ variant: "outline",
1061
+ onClick: () => T(!1),
1062
+ children: /* @__PURE__ */ K(i, { id: "Cancel" })
1063
+ }), /* @__PURE__ */ K(w.Subscribe, {
1064
+ selector: (e) => [
1065
+ e.values.productId,
1066
+ e.values.amount,
1067
+ e.values.currency,
1068
+ e.values.accessDuration,
1069
+ e.values.billingInterval,
1070
+ e.isSubmitting
1071
+ ],
1072
+ children: ([e, t, n, r, i, o]) => /* @__PURE__ */ K(a, {
1073
+ type: "submit",
1074
+ disabled: o || !e || BigInt(f(t, n) ?? "0") <= 0n || Q({ value: r }) !== void 0 || Q({ value: i }) !== void 0,
1075
+ children: o ? "Creating…" : "Create price"
1076
+ })
1077
+ })] })]
1078
+ })]
1079
+ })]
1080
+ });
1081
+ }
1082
+ function Le() {
1083
+ let { toast: e, toastApiError: t, adminMutations: r, adminQueries: o } = n(), u = G(), d = l(), f = c(), { data: p, isPending: m } = W(o.catalogDrift(d)), g = U(r.refreshPSPs(u));
1084
+ return /* @__PURE__ */ q("div", {
1085
+ className: "flex flex-col gap-3",
1086
+ children: [/* @__PURE__ */ K("div", {
1087
+ className: "flex justify-end",
1088
+ children: f && /* @__PURE__ */ q(a, {
1089
+ variant: "outline",
1090
+ size: "sm",
1091
+ disabled: g.isPending,
1092
+ onClick: async () => {
1093
+ try {
1094
+ await g.mutateAsync(), e.success("Re-reading every PSP: new drift appears here as it is found");
1095
+ } catch (e) {
1096
+ t(e, "Refresh drift");
1097
+ }
1098
+ },
1099
+ children: [/* @__PURE__ */ K(J, {
1100
+ icon: _e,
1101
+ className: g.isPending ? "size-4 animate-spin" : "size-4"
1102
+ }), /* @__PURE__ */ K(i, { id: "Refresh scan" })]
1103
+ })
1104
+ }), m ? /* @__PURE__ */ K("div", {
1105
+ className: "flex flex-col gap-3 py-2",
1106
+ children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ K(s, { className: "h-6 w-full" }, t))
1107
+ }) : p?.data?.length ? /* @__PURE__ */ K("div", {
1108
+ className: "overflow-x-auto",
1109
+ children: /* @__PURE__ */ q(j, { children: [/* @__PURE__ */ K(O, { children: /* @__PURE__ */ q(A, {
1110
+ className: "hover:bg-transparent",
1111
+ children: [
1112
+ /* @__PURE__ */ K(E, {
1113
+ className: "text-muted-foreground",
1114
+ children: /* @__PURE__ */ K(i, { id: "Provider" })
1115
+ }),
1116
+ /* @__PURE__ */ K(E, {
1117
+ className: "text-muted-foreground",
1118
+ children: /* @__PURE__ */ K(i, { id: "Kind" })
1119
+ }),
1120
+ /* @__PURE__ */ K(E, {
1121
+ className: "text-muted-foreground",
1122
+ children: /* @__PURE__ */ K(i, { id: "Resource" })
1123
+ }),
1124
+ /* @__PURE__ */ K(E, {
1125
+ className: "text-muted-foreground",
1126
+ children: /* @__PURE__ */ K(i, { id: "Field" })
1127
+ }),
1128
+ /* @__PURE__ */ K(E, {
1129
+ className: "text-muted-foreground",
1130
+ children: /* @__PURE__ */ K(i, { id: "OpenRails" })
1131
+ }),
1132
+ /* @__PURE__ */ K(E, {
1133
+ className: "text-muted-foreground",
1134
+ children: /* @__PURE__ */ K(i, { id: "Remote" })
1135
+ }),
1136
+ /* @__PURE__ */ K(E, {
1137
+ className: "text-muted-foreground",
1138
+ children: /* @__PURE__ */ K(i, { id: "Detected" })
1139
+ })
1140
+ ]
1141
+ }) }), /* @__PURE__ */ K(D, { children: p.data.map((e) => /* @__PURE__ */ q(A, { children: [
1142
+ /* @__PURE__ */ K(k, { children: e.provider ?? "—" }),
1143
+ /* @__PURE__ */ K(k, { children: e.finding_type.replace(/^catalog\./, "") }),
1144
+ /* @__PURE__ */ q(k, {
1145
+ className: "text-xs",
1146
+ children: [
1147
+ e.resource_type,
1148
+ " ",
1149
+ _(e.resource_id || e.external_resource_id || "", 13)
1150
+ ]
1151
+ }),
1152
+ /* @__PURE__ */ K(k, { children: e.field || "—" }),
1153
+ /* @__PURE__ */ K(k, {
1154
+ className: "max-w-40 truncate",
1155
+ children: e.openrails_value || "—"
1156
+ }),
1157
+ /* @__PURE__ */ K(k, {
1158
+ className: "max-w-40 truncate",
1159
+ children: e.external_value || "—"
1160
+ }),
1161
+ /* @__PURE__ */ K(k, { children: h(e.created_at) })
1162
+ ] }, e.id)) })] })
1163
+ }) : /* @__PURE__ */ K("p", {
1164
+ className: "text-sm text-muted-foreground",
1165
+ children: /* @__PURE__ */ K(i, { id: "No open drift events. Catalog is in sync." })
1166
+ })]
1167
+ });
1168
+ }
1169
+ function $({ label: t, id: n, hint: r, children: i }) {
1170
+ let { id: a } = e();
1171
+ return /* @__PURE__ */ q("div", {
1172
+ className: "grid gap-1.5",
1173
+ children: [
1174
+ /* @__PURE__ */ K(B, {
1175
+ htmlFor: a(n),
1176
+ children: t
1177
+ }),
1178
+ r ? /* @__PURE__ */ K("p", {
1179
+ className: "text-[13px] text-muted-foreground",
1180
+ children: r
1181
+ }) : null,
1182
+ i
1183
+ ]
1184
+ });
1185
+ }
1186
+ //#endregion
1187
+ export { ke as CatalogDriftPage, Oe as CatalogPricesPage, De as CatalogProductsPage };
1188
+
1189
+ //# sourceMappingURL=admin-catalog-CC7I4n0_.js.map