@openrails/billing-ui 0.281.0 → 0.282.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.
- package/dist/account/format.d.ts +1 -1
- package/dist/admin/lib/duration.d.ts +4 -0
- package/dist/{admin-attempts-DjgBAbx9.js → admin-attempts-Cs2u-BLY.js} +8 -8
- package/dist/{admin-attempts-DjgBAbx9.js.map → admin-attempts-Cs2u-BLY.js.map} +1 -1
- package/dist/{admin-auth-BUUdvmqC.js → admin-auth-CTLBqp7N.js} +2 -2
- package/dist/{admin-auth-BUUdvmqC.js.map → admin-auth-CTLBqp7N.js.map} +1 -1
- package/dist/{admin-badge-CAlUmS2s.js → admin-badge-3zABrSBc.js} +2 -2
- package/dist/{admin-badge-CAlUmS2s.js.map → admin-badge-3zABrSBc.js.map} +1 -1
- package/dist/{admin-button-Bn4otsuw.js → admin-button-FRNl7_Yf.js} +2 -2
- package/dist/{admin-button-Bn4otsuw.js.map → admin-button-FRNl7_Yf.js.map} +1 -1
- package/dist/{admin-capabilities-DS-X-__V.js → admin-capabilities-uSi2Pb2h.js} +2 -2
- package/dist/{admin-capabilities-DS-X-__V.js.map → admin-capabilities-uSi2Pb2h.js.map} +1 -1
- package/dist/{admin-card-BHKW1dfB.js → admin-card-YKPGmx5w.js} +2 -2
- package/dist/{admin-card-BHKW1dfB.js.map → admin-card-YKPGmx5w.js.map} +1 -1
- package/dist/{admin-catalog-BdLDhr8R.js → admin-catalog-DB5lr46V.js} +308 -308
- package/dist/admin-catalog-DB5lr46V.js.map +1 -0
- package/dist/{admin-cursor-pager-Qo9Sq6lN.js → admin-cursor-pager-BGgOOq7s.js} +4 -4
- package/dist/{admin-cursor-pager-Qo9Sq6lN.js.map → admin-cursor-pager-BGgOOq7s.js.map} +1 -1
- package/dist/{admin-customers-BZP6Jv-i.js → admin-customers-DFQ75ZBi.js} +6 -6
- package/dist/{admin-customers-BZP6Jv-i.js.map → admin-customers-DFQ75ZBi.js.map} +1 -1
- package/dist/{admin-dashboard-BJSonknv.js → admin-dashboard-Q_4-OFsE.js} +14 -14
- package/dist/{admin-dashboard-BJSonknv.js.map → admin-dashboard-Q_4-OFsE.js.map} +1 -1
- package/dist/{admin-data-table-BiFmcf0Z.js → admin-data-table-DyYm4h_Y.js} +5 -5
- package/dist/{admin-data-table-BiFmcf0Z.js.map → admin-data-table-DyYm4h_Y.js.map} +1 -1
- package/dist/{admin-detail-C6VH3i2v.js → admin-detail-BytmF-e3.js} +10 -10
- package/dist/{admin-detail-C6VH3i2v.js.map → admin-detail-BytmF-e3.js.map} +1 -1
- package/dist/{admin-detail-cijme9Lc.js → admin-detail-CG3kLIDS.js} +12 -12
- package/dist/{admin-detail-cijme9Lc.js.map → admin-detail-CG3kLIDS.js.map} +1 -1
- package/dist/{admin-detail-C03O0R6e.js → admin-detail-RS0o4-Cq.js} +16 -16
- package/dist/{admin-detail-C03O0R6e.js.map → admin-detail-RS0o4-Cq.js.map} +1 -1
- package/dist/{admin-detail-CQws8363.js → admin-detail-SLijWf4F.js} +16 -16
- package/dist/{admin-detail-CQws8363.js.map → admin-detail-SLijWf4F.js.map} +1 -1
- package/dist/{admin-detail-NApy5bio.js → admin-detail-wttCvrxI.js} +13 -13
- package/dist/{admin-detail-NApy5bio.js.map → admin-detail-wttCvrxI.js.map} +1 -1
- package/dist/{admin-dialog-CgYGInHi.js → admin-dialog-BVx92baz.js} +3 -3
- package/dist/{admin-dialog-CgYGInHi.js.map → admin-dialog-BVx92baz.js.map} +1 -1
- package/dist/{admin-dropdown-menu-CU9RxoEJ.js → admin-dropdown-menu-BV7vxYr9.js} +2 -2
- package/dist/{admin-dropdown-menu-CU9RxoEJ.js.map → admin-dropdown-menu-BV7vxYr9.js.map} +1 -1
- package/dist/{admin-fact-card-lN-MsuSp.js → admin-fact-card-CTQyFmQY.js} +2 -2
- package/dist/{admin-fact-card-lN-MsuSp.js.map → admin-fact-card-CTQyFmQY.js.map} +1 -1
- package/dist/{admin-health-CnagC763.js → admin-health-DWpONa-7.js} +9 -9
- package/dist/{admin-health-CnagC763.js.map → admin-health-DWpONa-7.js.map} +1 -1
- package/dist/{admin-imports-SM_fKKgW.js → admin-imports-Dsd5QmAe.js} +11 -11
- package/dist/{admin-imports-SM_fKKgW.js.map → admin-imports-Dsd5QmAe.js.map} +1 -1
- package/dist/{admin-input-B_EUzCAE.js → admin-input-DhYEd7Yp.js} +2 -2
- package/dist/{admin-input-B_EUzCAE.js.map → admin-input-DhYEd7Yp.js.map} +1 -1
- package/dist/{admin-label-DQsOkp1p.js → admin-label-DwUfUVm6.js} +2 -2
- package/dist/{admin-label-DQsOkp1p.js.map → admin-label-DwUfUVm6.js.map} +1 -1
- package/dist/{admin-linked-table-row-BFsgc9tz.js → admin-linked-table-row-CqG_aCwd.js} +3 -3
- package/dist/{admin-linked-table-row-BFsgc9tz.js.map → admin-linked-table-row-CqG_aCwd.js.map} +1 -1
- package/dist/{admin-map-dialog-Dt3gTuTD.js → admin-map-dialog-DZuPq4UA.js} +8 -8
- package/dist/{admin-map-dialog-Dt3gTuTD.js.map → admin-map-dialog-DZuPq4UA.js.map} +1 -1
- package/dist/{admin-metering-DM4KhjOq.js → admin-metering-kGrQIiEX.js} +14 -14
- package/dist/{admin-metering-DM4KhjOq.js.map → admin-metering-kGrQIiEX.js.map} +1 -1
- package/dist/{admin-missing-record-G2Jz-VUn.js → admin-missing-record-CjIQEv9L.js} +2 -2
- package/dist/{admin-missing-record-G2Jz-VUn.js.map → admin-missing-record-CjIQEv9L.js.map} +1 -1
- package/dist/{admin-ops-mwzj-jpg.js → admin-ops-B1Gwrsq6.js} +11 -11
- package/dist/{admin-ops-mwzj-jpg.js.map → admin-ops-B1Gwrsq6.js.map} +1 -1
- package/dist/{admin-orders-D_aqV66h.js → admin-orders-DRpUMK7N.js} +8 -8
- package/dist/{admin-orders-D_aqV66h.js.map → admin-orders-DRpUMK7N.js.map} +1 -1
- package/dist/{admin-parked-2FjIfyMg.js → admin-parked-uH5dSPjL.js} +11 -11
- package/dist/{admin-parked-2FjIfyMg.js.map → admin-parked-uH5dSPjL.js.map} +1 -1
- package/dist/{admin-payments-B4hh31PR.js → admin-payments-DFW5O19Q.js} +8 -8
- package/dist/{admin-payments-B4hh31PR.js.map → admin-payments-DFW5O19Q.js.map} +1 -1
- package/dist/{admin-price-detail--5Bovz20.js → admin-price-detail-CaUekDWP.js} +10 -10
- package/dist/{admin-price-detail--5Bovz20.js.map → admin-price-detail-CaUekDWP.js.map} +1 -1
- package/dist/{admin-price-format-C-pus9FL.js → admin-price-format-BrXm8J1w.js} +13 -4
- package/dist/admin-price-format-BrXm8J1w.js.map +1 -0
- package/dist/{admin-price-wizard-Cj_Bgh-V.js → admin-price-wizard-CCejN6lZ.js} +9 -8
- package/dist/admin-price-wizard-CCejN6lZ.js.map +1 -0
- package/dist/{admin-proposals-DPRFoWel.js → admin-proposals-BuPBTbX7.js} +12 -12
- package/dist/{admin-proposals-DPRFoWel.js.map → admin-proposals-BuPBTbX7.js.map} +1 -1
- package/dist/{admin-provider-prices-B8Oc86dP.js → admin-provider-prices-BtyrGlSd.js} +12 -12
- package/dist/{admin-provider-prices-B8Oc86dP.js.map → admin-provider-prices-BtyrGlSd.js.map} +1 -1
- package/dist/{admin-range-picker-CSWcCYkg.js → admin-range-picker-B1C1R9Yh.js} +5 -5
- package/dist/{admin-range-picker-CSWcCYkg.js.map → admin-range-picker-B1C1R9Yh.js.map} +1 -1
- package/dist/{admin-records-CWbfqyT8.js → admin-records-CZ_Q1j7i.js} +10 -10
- package/dist/{admin-records-CWbfqyT8.js.map → admin-records-CZ_Q1j7i.js.map} +1 -1
- package/dist/{admin-reports-CAHWO_d6.js → admin-reports-ZDEVF7aC.js} +8 -8
- package/dist/{admin-reports-CAHWO_d6.js.map → admin-reports-ZDEVF7aC.js.map} +1 -1
- package/dist/{admin-select-DSGCZFiZ.js → admin-select-CCliJ9d-.js} +2 -2
- package/dist/{admin-select-DSGCZFiZ.js.map → admin-select-CCliJ9d-.js.map} +1 -1
- package/dist/{admin-settings-BrvNTJlM.js → admin-settings-HBiilJTI.js} +13 -13
- package/dist/{admin-settings-BrvNTJlM.js.map → admin-settings-HBiilJTI.js.map} +1 -1
- package/dist/{admin-shared-DdN2hyaR.js → admin-shared-Bozlh9cy.js} +6 -6
- package/dist/{admin-shared-DdN2hyaR.js.map → admin-shared-Bozlh9cy.js.map} +1 -1
- package/dist/{admin-skeleton-DOfsDIu0.js → admin-skeleton-CKxohm-g.js} +2 -2
- package/dist/{admin-skeleton-DOfsDIu0.js.map → admin-skeleton-CKxohm-g.js.map} +1 -1
- package/dist/{admin-status-badge-BLEGt2Fw.js → admin-status-badge-BhHyBG8J.js} +3 -3
- package/dist/{admin-status-badge-BLEGt2Fw.js.map → admin-status-badge-BhHyBG8J.js.map} +1 -1
- package/dist/{admin-subscriptions-PL5G3f0O.js → admin-subscriptions-VwEbVACW.js} +8 -8
- package/dist/{admin-subscriptions-PL5G3f0O.js.map → admin-subscriptions-VwEbVACW.js.map} +1 -1
- package/dist/{admin-switch-aOiQQzST.js → admin-switch-CE0N-HwZ.js} +2 -2
- package/dist/{admin-switch-aOiQQzST.js.map → admin-switch-CE0N-HwZ.js.map} +1 -1
- package/dist/{admin-table-DIKl2rpV.js → admin-table-Ce6xyiwJ.js} +2 -2
- package/dist/{admin-table-DIKl2rpV.js.map → admin-table-Ce6xyiwJ.js.map} +1 -1
- package/dist/{admin-tabs-DR74xX0-.js → admin-tabs-BPfOyBa6.js} +5 -5
- package/dist/{admin-tabs-DR74xX0-.js.map → admin-tabs-BPfOyBa6.js.map} +1 -1
- package/dist/{admin-textarea-W52-l_0n.js → admin-textarea-CBAshts8.js} +2 -2
- package/dist/{admin-textarea-W52-l_0n.js.map → admin-textarea-CBAshts8.js.map} +1 -1
- package/dist/{admin-typed-confirm-dialog-B_00EHlT.js → admin-typed-confirm-dialog-C1kHdYgH.js} +6 -6
- package/dist/{admin-typed-confirm-dialog-B_00EHlT.js.map → admin-typed-confirm-dialog-C1kHdYgH.js.map} +1 -1
- package/dist/{admin-utils-CX097OR7.js → admin-utils-CuwG3SAt.js} +5 -1
- package/dist/admin-utils-CuwG3SAt.js.map +1 -0
- package/dist/{admin-widget-viz-DVV9aTQp.js → admin-widget-viz-Dd1Fjd_j.js} +4 -4
- package/dist/{admin-widget-viz-DVV9aTQp.js.map → admin-widget-viz-Dd1Fjd_j.js.map} +1 -1
- package/dist/admin.js +34 -34
- package/dist/client/generated/wire.d.ts +5 -0
- package/dist/client/types.d.ts +6 -2
- package/dist/{client-DwsFGm4M.js → client-BrURpRWz.js} +3 -1
- package/dist/client-BrURpRWz.js.map +1 -0
- package/dist/client.js +1 -1
- package/dist/{hooks-C-MhXjQh.js → hooks-Bbp1RWgw.js} +2 -2
- package/dist/{hooks-C-MhXjQh.js.map → hooks-Bbp1RWgw.js.map} +1 -1
- package/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/price-label.d.ts +1 -1
- package/dist/locales/en.d.ts +4 -0
- package/dist/locales/en.js +4 -0
- package/dist/locales/en.js.map +1 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/admin-catalog-BdLDhr8R.js.map +0 -1
- package/dist/admin-price-format-C-pus9FL.js.map +0 -1
- package/dist/admin-price-wizard-Cj_Bgh-V.js.map +0 -1
- package/dist/admin-utils-CX097OR7.js.map +0 -1
- package/dist/client-DwsFGm4M.js.map +0 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { E as e, O as t, p as n, r, w as i } from "./admin-utils-
|
|
1
|
+
import { E as e, O as t, p as n, r, w as i } from "./admin-utils-CuwG3SAt.js";
|
|
2
2
|
import { t as a } from "./admin-form-field-errors-Cuhy38F1.js";
|
|
3
|
-
import { n as o, t as s } from "./admin-cursor-pager-
|
|
4
|
-
import { t as c } from "./admin-linked-table-row-
|
|
5
|
-
import { t as l } from "./admin-status-badge-
|
|
6
|
-
import { t as u } from "./admin-badge-
|
|
7
|
-
import { t as d } from "./admin-button-
|
|
8
|
-
import { a as f, i as p, n as m, o as h, r as g, s as _, t as v } from "./admin-dialog-
|
|
9
|
-
import { t as y } from "./admin-input-
|
|
10
|
-
import { t as b } from "./admin-label-
|
|
11
|
-
import { a as x, i as S, n as C, r as w, t as T } from "./admin-select-
|
|
12
|
-
import { t as E } from "./admin-skeleton-
|
|
13
|
-
import { t as D } from "./admin-switch-
|
|
14
|
-
import { a as O, n as k, o as A, r as j, s as M, t as N } from "./admin-table-
|
|
3
|
+
import { n as o, t as s } from "./admin-cursor-pager-BGgOOq7s.js";
|
|
4
|
+
import { t as c } from "./admin-linked-table-row-CqG_aCwd.js";
|
|
5
|
+
import { t as l } from "./admin-status-badge-BhHyBG8J.js";
|
|
6
|
+
import { t as u } from "./admin-badge-3zABrSBc.js";
|
|
7
|
+
import { t as d } from "./admin-button-FRNl7_Yf.js";
|
|
8
|
+
import { a as f, i as p, n as m, o as h, r as g, s as _, t as v } from "./admin-dialog-BVx92baz.js";
|
|
9
|
+
import { t as y } from "./admin-input-DhYEd7Yp.js";
|
|
10
|
+
import { t as b } from "./admin-label-DwUfUVm6.js";
|
|
11
|
+
import { a as x, i as S, n as C, r as w, t as T } from "./admin-select-CCliJ9d-.js";
|
|
12
|
+
import { t as E } from "./admin-skeleton-CKxohm-g.js";
|
|
13
|
+
import { t as D } from "./admin-switch-CE0N-HwZ.js";
|
|
14
|
+
import { a as O, n as k, o as A, r as j, s as M, t as N } from "./admin-table-Ce6xyiwJ.js";
|
|
15
15
|
import { i as ee, r as P } from "./admin-dialog-width-C_WFpow0.js";
|
|
16
16
|
import { c as F, d as I, f as L, n as te, o as ne, s as R } from "./admin-format-D9Ablh0P.js";
|
|
17
|
-
import {
|
|
18
|
-
import { t as
|
|
19
|
-
import { r as
|
|
20
|
-
import { c as
|
|
21
|
-
import { t as
|
|
22
|
-
import * as
|
|
23
|
-
import { useMutation as
|
|
24
|
-
import { Fragment as
|
|
25
|
-
import { HugeiconsIcon as
|
|
26
|
-
import { Add01Icon as
|
|
27
|
-
import { useForm as
|
|
17
|
+
import { a as z, i as re, n as ie, r as ae, t as oe } from "./admin-price-format-BrXm8J1w.js";
|
|
18
|
+
import { t as se } from "./admin-textarea-CBAshts8.js";
|
|
19
|
+
import { r as ce, t as le } from "./admin-card-YKPGmx5w.js";
|
|
20
|
+
import { c as ue, r as de } from "./admin-capabilities-uSi2Pb2h.js";
|
|
21
|
+
import { t as fe } from "./admin-price-wizard-CCejN6lZ.js";
|
|
22
|
+
import * as B from "react";
|
|
23
|
+
import { useMutation as V, useQuery as H, useQueryClient as U } from "@tanstack/react-query";
|
|
24
|
+
import { Fragment as W, jsx as G, jsxs as K } from "react/jsx-runtime";
|
|
25
|
+
import { HugeiconsIcon as q } from "@hugeicons/react";
|
|
26
|
+
import { Add01Icon as J, BubbleChatQuestionIcon as pe, Cancel01Icon as me, Loading02Icon as he, SparklesIcon as Y } from "@hugeicons/core-free-icons";
|
|
27
|
+
import { useForm as X } from "@tanstack/react-form";
|
|
28
28
|
// src/admin/pages/catalog/application-dialog.tsx
|
|
29
29
|
function ge() {
|
|
30
|
-
let { toast: r, toastApiError: a, selectedMerchant: o, adminMutations: s } = n(), { id: c, text: l } = t(), [u, y] =
|
|
30
|
+
let { toast: r, toastApiError: a, selectedMerchant: o, adminMutations: s } = n(), { id: c, text: l } = t(), [u, y] = B.useState(!1), [x, S] = B.useState(""), [C, w] = B.useState(!1), [T, E] = B.useState(), [D, O] = B.useState(), [k, A] = B.useState(""), [j, M] = B.useState(!1), [N, P] = B.useState(), F = V(s.applyCatalog(U())), I = () => {
|
|
31
31
|
P(o()), S(JSON.stringify({
|
|
32
32
|
schema_version: 1,
|
|
33
33
|
prune: !1,
|
|
@@ -53,27 +53,27 @@ function ge() {
|
|
|
53
53
|
M(t), A(t ? "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."), a(e, "Apply catalog");
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ K(v, {
|
|
57
57
|
open: u,
|
|
58
58
|
onOpenChange: (e) => {
|
|
59
59
|
F.isPending || (y(e), e && !x && I());
|
|
60
60
|
},
|
|
61
|
-
children: [/* @__PURE__ */
|
|
61
|
+
children: [/* @__PURE__ */ G(_, { render: /* @__PURE__ */ G(d, {
|
|
62
62
|
variant: "outline",
|
|
63
63
|
size: "sm",
|
|
64
|
-
children: /* @__PURE__ */
|
|
65
|
-
}) }), /* @__PURE__ */
|
|
64
|
+
children: /* @__PURE__ */ G(e, { id: "Apply catalog" })
|
|
65
|
+
}) }), /* @__PURE__ */ K(m, {
|
|
66
66
|
className: ee,
|
|
67
67
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ K(f, { children: [/* @__PURE__ */ G(h, { children: /* @__PURE__ */ G(e, { id: "Apply catalog changes" }) }), /* @__PURE__ */ G(g, { children: /* @__PURE__ */ G(e, { 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__ */ K("div", {
|
|
70
70
|
className: "grid gap-3",
|
|
71
71
|
children: [
|
|
72
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ G(b, {
|
|
73
73
|
htmlFor: c("catalog-application"),
|
|
74
|
-
children: /* @__PURE__ */
|
|
74
|
+
children: /* @__PURE__ */ G(e, { id: "Catalog document" })
|
|
75
75
|
}),
|
|
76
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ G(se, {
|
|
77
77
|
id: c("catalog-application"),
|
|
78
78
|
className: "max-h-80 min-h-48 font-mono text-xs",
|
|
79
79
|
spellCheck: !1,
|
|
@@ -83,49 +83,49 @@ function ge() {
|
|
|
83
83
|
S(e.target.value), w(!1);
|
|
84
84
|
}
|
|
85
85
|
}),
|
|
86
|
-
C && !T && /* @__PURE__ */
|
|
86
|
+
C && !T && /* @__PURE__ */ G("p", {
|
|
87
87
|
className: "text-sm",
|
|
88
|
-
children: /* @__PURE__ */
|
|
88
|
+
children: /* @__PURE__ */ G(e, { id: "Review complete. Applying sends this exact document; this is not a database diff." })
|
|
89
89
|
}),
|
|
90
|
-
k && /* @__PURE__ */
|
|
90
|
+
k && /* @__PURE__ */ G("p", {
|
|
91
91
|
role: "status",
|
|
92
92
|
className: "text-sm",
|
|
93
93
|
children: k
|
|
94
94
|
}),
|
|
95
|
-
D && D.conflicts.length > 0 && /* @__PURE__ */
|
|
96
|
-
D && /* @__PURE__ */
|
|
95
|
+
D && D.conflicts.length > 0 && /* @__PURE__ */ G(_e, { conflicts: D.conflicts }),
|
|
96
|
+
D && /* @__PURE__ */ G("pre", {
|
|
97
97
|
"aria-label": l("Batch receipt"),
|
|
98
98
|
className: "max-h-48 overflow-auto rounded-md border p-3 text-xs",
|
|
99
99
|
children: JSON.stringify(D, null, 2)
|
|
100
100
|
})
|
|
101
101
|
]
|
|
102
102
|
}),
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
j && /* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ K(p, { children: [
|
|
104
|
+
j && /* @__PURE__ */ G(d, {
|
|
105
105
|
variant: "outline",
|
|
106
106
|
onClick: () => {
|
|
107
107
|
E(void 0), w(!1), M(!1), A("");
|
|
108
108
|
},
|
|
109
|
-
children: /* @__PURE__ */
|
|
109
|
+
children: /* @__PURE__ */ G(e, { id: "Edit batch" })
|
|
110
110
|
}),
|
|
111
|
-
D && D.conflicts.length > 0 && /* @__PURE__ */
|
|
111
|
+
D && D.conflicts.length > 0 && /* @__PURE__ */ G(d, {
|
|
112
112
|
variant: "destructive",
|
|
113
113
|
disabled: F.isPending,
|
|
114
114
|
onClick: () => void L(!0),
|
|
115
|
-
children: /* @__PURE__ */
|
|
115
|
+
children: /* @__PURE__ */ G(e, { id: "Overwrite edits" })
|
|
116
116
|
}),
|
|
117
|
-
D ? /* @__PURE__ */
|
|
117
|
+
D ? /* @__PURE__ */ G(d, {
|
|
118
118
|
onClick: () => I(),
|
|
119
|
-
children: /* @__PURE__ */
|
|
120
|
-
}) : T === void 0 ? C ? /* @__PURE__ */
|
|
119
|
+
children: /* @__PURE__ */ G(e, { id: "New batch" })
|
|
120
|
+
}) : T === void 0 ? C ? /* @__PURE__ */ G(d, {
|
|
121
121
|
disabled: !x.trim(),
|
|
122
122
|
onClick: () => void L(),
|
|
123
|
-
children: /* @__PURE__ */
|
|
124
|
-
}) : /* @__PURE__ */
|
|
123
|
+
children: /* @__PURE__ */ G(e, { id: "Apply reviewed batch" })
|
|
124
|
+
}) : /* @__PURE__ */ G(d, {
|
|
125
125
|
disabled: !x.trim(),
|
|
126
126
|
onClick: () => w(!0),
|
|
127
|
-
children: /* @__PURE__ */
|
|
128
|
-
}) : /* @__PURE__ */
|
|
127
|
+
children: /* @__PURE__ */ G(e, { id: "Review batch" })
|
|
128
|
+
}) : /* @__PURE__ */ G(d, {
|
|
129
129
|
disabled: F.isPending || j,
|
|
130
130
|
onClick: () => void L(),
|
|
131
131
|
children: F.isPending ? "Applying…" : "Retry exact batch"
|
|
@@ -137,28 +137,28 @@ function ge() {
|
|
|
137
137
|
}
|
|
138
138
|
function _e({ conflicts: n }) {
|
|
139
139
|
let { text: r } = t();
|
|
140
|
-
return /* @__PURE__ */
|
|
140
|
+
return /* @__PURE__ */ G("ul", {
|
|
141
141
|
"aria-label": r("Skipped objects"),
|
|
142
142
|
className: "grid gap-2 text-sm",
|
|
143
|
-
children: n.map((t) => /* @__PURE__ */
|
|
143
|
+
children: n.map((t) => /* @__PURE__ */ K("li", {
|
|
144
144
|
className: "rounded-md border p-2",
|
|
145
|
-
children: [/* @__PURE__ */
|
|
145
|
+
children: [/* @__PURE__ */ K("p", {
|
|
146
146
|
className: "font-medium",
|
|
147
147
|
children: [
|
|
148
148
|
t.product_key ? `Price ${t.key} of product ${t.product_key}` : `${t.object === "meter" ? "Meter" : "Product"} ${t.key}`,
|
|
149
149
|
" ",
|
|
150
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ G(e, { id: "skipped" })
|
|
151
151
|
]
|
|
152
|
-
}), /* @__PURE__ */
|
|
152
|
+
}), /* @__PURE__ */ G("ul", {
|
|
153
153
|
className: "mt-1 grid gap-1 text-xs text-muted-foreground",
|
|
154
|
-
children: t.fields.map((n) => /* @__PURE__ */
|
|
154
|
+
children: t.fields.map((n) => /* @__PURE__ */ K("li", { children: [
|
|
155
155
|
n.field,
|
|
156
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ G(e, { id: ": the batch says" }),
|
|
157
157
|
" ",
|
|
158
|
-
|
|
159
|
-
/* @__PURE__ */
|
|
158
|
+
Z(n, n.file_value, t.currency),
|
|
159
|
+
/* @__PURE__ */ G(e, { id: ", an edit set" }),
|
|
160
160
|
" ",
|
|
161
|
-
|
|
161
|
+
Z(n, n.live_value, t.currency),
|
|
162
162
|
" (",
|
|
163
163
|
n.set_by,
|
|
164
164
|
", ",
|
|
@@ -169,12 +169,12 @@ function _e({ conflicts: n }) {
|
|
|
169
169
|
}, `${t.object}:${t.product_key ?? ""}:${t.key}`))
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
return t == null ? "none" : (e.field === "unit_amount" || e.field === "trial_unit_amount") && typeof t == "string" && n ? R(t, n) : e.field.endsWith("_hours") && typeof t == "number" ?
|
|
172
|
+
function Z(e, t, n) {
|
|
173
|
+
return t == null ? "none" : (e.field === "unit_amount" || e.field === "trial_unit_amount") && typeof t == "string" && n ? R(t, n) : e.field.endsWith("_hours") && typeof t == "number" ? ae(t) : JSON.stringify(t);
|
|
174
174
|
}
|
|
175
175
|
// src/admin/pages/catalog/copilot-panel.tsx
|
|
176
|
-
function
|
|
177
|
-
let { text: o } = t(), { adminMutations: s } = n(), c =
|
|
176
|
+
function ve({ enabled: r, draftingEnabled: a }) {
|
|
177
|
+
let { text: o } = t(), { adminMutations: s } = n(), c = V(s.askCatalogCopilot()), l = X({
|
|
178
178
|
defaultValues: { question: "" },
|
|
179
179
|
onSubmit: async ({ value: e }) => {
|
|
180
180
|
let t = e.question.trim();
|
|
@@ -186,22 +186,22 @@ function ye({ enabled: r, draftingEnabled: a }) {
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
}), u = c.data, f = c.error ? c.error instanceof i ? c.error.message : "ask failed" : null;
|
|
189
|
-
return r ? /* @__PURE__ */
|
|
189
|
+
return r ? /* @__PURE__ */ G(le, { children: /* @__PURE__ */ K(ce, {
|
|
190
190
|
className: "flex flex-col gap-3",
|
|
191
191
|
children: [
|
|
192
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ K("form", {
|
|
193
193
|
className: "flex items-center gap-2",
|
|
194
194
|
onSubmit: (e) => {
|
|
195
195
|
e.preventDefault(), e.stopPropagation(), l.handleSubmit();
|
|
196
196
|
},
|
|
197
197
|
children: [
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
icon:
|
|
198
|
+
/* @__PURE__ */ G(q, {
|
|
199
|
+
icon: pe,
|
|
200
200
|
className: "size-4 shrink-0 text-muted-foreground"
|
|
201
201
|
}),
|
|
202
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ G(l.Field, {
|
|
203
203
|
name: "question",
|
|
204
|
-
children: (e) => /* @__PURE__ */
|
|
204
|
+
children: (e) => /* @__PURE__ */ G(y, {
|
|
205
205
|
value: e.state.value,
|
|
206
206
|
onBlur: e.handleBlur,
|
|
207
207
|
onChange: (t) => e.handleChange(t.target.value),
|
|
@@ -209,38 +209,38 @@ function ye({ enabled: r, draftingEnabled: a }) {
|
|
|
209
209
|
className: "flex-1"
|
|
210
210
|
})
|
|
211
211
|
}),
|
|
212
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ G(l.Subscribe, {
|
|
213
213
|
selector: (e) => [e.values.question, e.isSubmitting],
|
|
214
|
-
children: ([t, n]) => /* @__PURE__ */
|
|
214
|
+
children: ([t, n]) => /* @__PURE__ */ K(d, {
|
|
215
215
|
type: "submit",
|
|
216
216
|
size: "sm",
|
|
217
217
|
disabled: n || !t.trim(),
|
|
218
|
-
children: [n ? /* @__PURE__ */
|
|
219
|
-
icon:
|
|
218
|
+
children: [n ? /* @__PURE__ */ G(q, {
|
|
219
|
+
icon: he,
|
|
220
220
|
className: "size-3.5 animate-spin"
|
|
221
|
-
}) : null, /* @__PURE__ */
|
|
221
|
+
}) : null, /* @__PURE__ */ G(e, { id: "Ask" })]
|
|
222
222
|
})
|
|
223
223
|
})
|
|
224
224
|
]
|
|
225
225
|
}),
|
|
226
|
-
c.isPending ? /* @__PURE__ */
|
|
226
|
+
c.isPending ? /* @__PURE__ */ G("p", {
|
|
227
227
|
className: "text-xs text-muted-foreground",
|
|
228
|
-
children: /* @__PURE__ */
|
|
228
|
+
children: /* @__PURE__ */ G(e, { id: "Checking your catalog…" })
|
|
229
229
|
}) : null,
|
|
230
|
-
f ? /* @__PURE__ */
|
|
230
|
+
f ? /* @__PURE__ */ G("p", {
|
|
231
231
|
className: "text-xs whitespace-pre-wrap text-destructive",
|
|
232
232
|
role: "alert",
|
|
233
233
|
children: f
|
|
234
234
|
}) : null,
|
|
235
|
-
u ? /* @__PURE__ */
|
|
235
|
+
u ? /* @__PURE__ */ K("div", {
|
|
236
236
|
className: "flex flex-col gap-3",
|
|
237
237
|
children: [
|
|
238
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ K("div", {
|
|
239
239
|
className: "flex items-start justify-between gap-2",
|
|
240
|
-
children: [/* @__PURE__ */
|
|
240
|
+
children: [/* @__PURE__ */ G("p", {
|
|
241
241
|
className: "text-sm whitespace-pre-wrap",
|
|
242
242
|
children: u.answer
|
|
243
|
-
}), /* @__PURE__ */
|
|
243
|
+
}), /* @__PURE__ */ G(d, {
|
|
244
244
|
variant: "ghost",
|
|
245
245
|
size: "icon",
|
|
246
246
|
className: "size-6 shrink-0",
|
|
@@ -248,26 +248,26 @@ function ye({ enabled: r, draftingEnabled: a }) {
|
|
|
248
248
|
onClick: () => {
|
|
249
249
|
c.reset();
|
|
250
250
|
},
|
|
251
|
-
children: /* @__PURE__ */
|
|
252
|
-
icon:
|
|
251
|
+
children: /* @__PURE__ */ G(q, {
|
|
252
|
+
icon: me,
|
|
253
253
|
className: "size-3.5"
|
|
254
254
|
})
|
|
255
255
|
})]
|
|
256
256
|
}),
|
|
257
|
-
u.evidence.length > 0 && /* @__PURE__ */
|
|
257
|
+
u.evidence.length > 0 && /* @__PURE__ */ G("div", {
|
|
258
258
|
className: "flex flex-col gap-2",
|
|
259
|
-
children: u.evidence.map((e, t) => /* @__PURE__ */
|
|
259
|
+
children: u.evidence.map((e, t) => /* @__PURE__ */ K("div", {
|
|
260
260
|
className: "rounded-lg border bg-muted/30 p-2",
|
|
261
|
-
children: [/* @__PURE__ */
|
|
261
|
+
children: [/* @__PURE__ */ G("span", {
|
|
262
262
|
className: "mb-1 block text-xs font-medium text-muted-foreground uppercase",
|
|
263
263
|
children: e.tool
|
|
264
|
-
}), /* @__PURE__ */
|
|
264
|
+
}), /* @__PURE__ */ G("pre", {
|
|
265
265
|
className: "max-h-48 overflow-auto text-xs whitespace-pre-wrap",
|
|
266
266
|
children: e.summary
|
|
267
267
|
})]
|
|
268
268
|
}, t))
|
|
269
269
|
}),
|
|
270
|
-
u.drafts?.map((e, t) => /* @__PURE__ */
|
|
270
|
+
u.drafts?.map((e, t) => /* @__PURE__ */ G(ye, {
|
|
271
271
|
draft: e,
|
|
272
272
|
draftingEnabled: a
|
|
273
273
|
}, t))
|
|
@@ -276,59 +276,59 @@ function ye({ enabled: r, draftingEnabled: a }) {
|
|
|
276
276
|
]
|
|
277
277
|
}) }) : null;
|
|
278
278
|
}
|
|
279
|
-
function
|
|
280
|
-
let r =
|
|
281
|
-
return t.kind === "refused" && t.refusal ? /* @__PURE__ */
|
|
279
|
+
function ye({ draft: t, draftingEnabled: n }) {
|
|
280
|
+
let r = ue() && n;
|
|
281
|
+
return t.kind === "refused" && t.refusal ? /* @__PURE__ */ K("div", {
|
|
282
282
|
className: "rounded-lg border border-dashed p-3 text-xs",
|
|
283
283
|
children: [
|
|
284
|
-
/* @__PURE__ */
|
|
284
|
+
/* @__PURE__ */ G("p", {
|
|
285
285
|
className: "mb-1 flex items-center gap-2 font-medium",
|
|
286
|
-
children: /* @__PURE__ */
|
|
286
|
+
children: /* @__PURE__ */ K(u, {
|
|
287
287
|
variant: "secondary",
|
|
288
|
-
children: [/* @__PURE__ */
|
|
288
|
+
children: [/* @__PURE__ */ G(e, { id: "refused: " }), t.refusal.code]
|
|
289
289
|
})
|
|
290
290
|
}),
|
|
291
|
-
/* @__PURE__ */
|
|
291
|
+
/* @__PURE__ */ G("p", {
|
|
292
292
|
className: "text-muted-foreground",
|
|
293
293
|
children: t.refusal.reason
|
|
294
294
|
}),
|
|
295
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ G("p", {
|
|
296
296
|
className: "mt-1",
|
|
297
297
|
children: t.refusal.workaround
|
|
298
298
|
})
|
|
299
299
|
]
|
|
300
|
-
}) : t.kind === "price_change" && t.price_change ? /* @__PURE__ */
|
|
300
|
+
}) : t.kind === "price_change" && t.price_change ? /* @__PURE__ */ G(be, {
|
|
301
301
|
draft: t.price_change,
|
|
302
302
|
canApply: r
|
|
303
|
-
}) : t.kind === "new_price" && t.new_price ? /* @__PURE__ */
|
|
303
|
+
}) : t.kind === "new_price" && t.new_price ? /* @__PURE__ */ G(xe, {
|
|
304
304
|
draft: t.new_price,
|
|
305
305
|
canApply: r
|
|
306
306
|
}) : null;
|
|
307
307
|
}
|
|
308
|
-
function
|
|
309
|
-
let { toastApiError: i, adminMutations: a } = n(), o =
|
|
310
|
-
return /* @__PURE__ */
|
|
308
|
+
function be({ draft: t, canApply: r }) {
|
|
309
|
+
let { toastApiError: i, adminMutations: a } = n(), o = V(a.loadCatalogPriceDraft());
|
|
310
|
+
return /* @__PURE__ */ K("div", {
|
|
311
311
|
className: "rounded-lg border bg-muted/30 p-3 text-sm",
|
|
312
312
|
children: [
|
|
313
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ K("div", {
|
|
314
314
|
className: "mb-1 flex items-center gap-2",
|
|
315
315
|
children: [
|
|
316
|
-
/* @__PURE__ */
|
|
317
|
-
icon:
|
|
316
|
+
/* @__PURE__ */ G(q, {
|
|
317
|
+
icon: Y,
|
|
318
318
|
className: "size-3.5 text-muted-foreground"
|
|
319
319
|
}),
|
|
320
|
-
/* @__PURE__ */
|
|
320
|
+
/* @__PURE__ */ G("span", {
|
|
321
321
|
className: "text-xs font-medium text-muted-foreground uppercase",
|
|
322
|
-
children: /* @__PURE__ */
|
|
322
|
+
children: /* @__PURE__ */ G(e, { id: "Draft: price change" })
|
|
323
323
|
}),
|
|
324
|
-
/* @__PURE__ */
|
|
324
|
+
/* @__PURE__ */ G(u, {
|
|
325
325
|
variant: "secondary",
|
|
326
326
|
children: BigInt(t.new_amount) > BigInt(t.current_amount) ? "increase" : "decrease"
|
|
327
327
|
})
|
|
328
328
|
]
|
|
329
329
|
}),
|
|
330
|
-
/* @__PURE__ */
|
|
331
|
-
/* @__PURE__ */
|
|
330
|
+
/* @__PURE__ */ G("p", { children: t.review_text }),
|
|
331
|
+
/* @__PURE__ */ K("p", {
|
|
332
332
|
className: "mt-1 text-xs text-muted-foreground",
|
|
333
333
|
children: [
|
|
334
334
|
R(t.current_amount, t.currency),
|
|
@@ -338,16 +338,16 @@ function xe({ draft: t, canApply: r }) {
|
|
|
338
338
|
" ·",
|
|
339
339
|
" ",
|
|
340
340
|
t.affected_count.toLocaleString(),
|
|
341
|
-
/* @__PURE__ */
|
|
341
|
+
/* @__PURE__ */ G(e, { id: " affected · requires human confirm" })
|
|
342
342
|
]
|
|
343
343
|
}),
|
|
344
|
-
r && (o.data ? /* @__PURE__ */
|
|
344
|
+
r && (o.data ? /* @__PURE__ */ G(fe, {
|
|
345
345
|
price: o.data.price,
|
|
346
346
|
productName: o.data.productName,
|
|
347
347
|
productKey: o.data.productKey,
|
|
348
348
|
draft: t,
|
|
349
349
|
onDone: () => o.reset()
|
|
350
|
-
}) : /* @__PURE__ */
|
|
350
|
+
}) : /* @__PURE__ */ G(d, {
|
|
351
351
|
size: "sm",
|
|
352
352
|
className: "mt-2",
|
|
353
353
|
disabled: o.isPending,
|
|
@@ -366,33 +366,33 @@ function xe({ draft: t, canApply: r }) {
|
|
|
366
366
|
]
|
|
367
367
|
});
|
|
368
368
|
}
|
|
369
|
-
function
|
|
370
|
-
let { toastApiError: i, adminMutations: a } = n(), o =
|
|
371
|
-
return /* @__PURE__ */
|
|
369
|
+
function xe({ draft: t, canApply: r }) {
|
|
370
|
+
let { toastApiError: i, adminMutations: a } = n(), o = U(), s = V(a.createCatalogDraftPrice(o));
|
|
371
|
+
return /* @__PURE__ */ K("div", {
|
|
372
372
|
className: "rounded-lg border bg-muted/30 p-3 text-sm",
|
|
373
373
|
children: [
|
|
374
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ K("div", {
|
|
375
375
|
className: "mb-1 flex items-center gap-2",
|
|
376
|
-
children: [/* @__PURE__ */
|
|
377
|
-
icon:
|
|
376
|
+
children: [/* @__PURE__ */ G(q, {
|
|
377
|
+
icon: Y,
|
|
378
378
|
className: "size-3.5 text-muted-foreground"
|
|
379
|
-
}), /* @__PURE__ */
|
|
379
|
+
}), /* @__PURE__ */ G("span", {
|
|
380
380
|
className: "text-xs font-medium text-muted-foreground uppercase",
|
|
381
|
-
children: /* @__PURE__ */
|
|
381
|
+
children: /* @__PURE__ */ G(e, { id: "Draft: new price" })
|
|
382
382
|
})]
|
|
383
383
|
}),
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
/* @__PURE__ */
|
|
384
|
+
/* @__PURE__ */ G("p", { children: t.review_text }),
|
|
385
|
+
/* @__PURE__ */ K("p", {
|
|
386
386
|
className: "mt-1 text-xs text-muted-foreground",
|
|
387
387
|
children: [
|
|
388
|
-
/* @__PURE__ */
|
|
388
|
+
/* @__PURE__ */ G(e, { id: "key: " }),
|
|
389
389
|
t.create_price.key,
|
|
390
390
|
" ·",
|
|
391
391
|
" ",
|
|
392
392
|
R(t.create_price.unit_amount, t.create_price.currency)
|
|
393
393
|
]
|
|
394
394
|
}),
|
|
395
|
-
r && /* @__PURE__ */
|
|
395
|
+
r && /* @__PURE__ */ G(d, {
|
|
396
396
|
size: "sm",
|
|
397
397
|
className: "mt-2",
|
|
398
398
|
disabled: s.isPending || s.isSuccess,
|
|
@@ -409,25 +409,25 @@ function Se({ draft: t, canApply: r }) {
|
|
|
409
409
|
});
|
|
410
410
|
}
|
|
411
411
|
// src/admin/pages/catalog/index.tsx
|
|
412
|
-
var
|
|
413
|
-
function
|
|
414
|
-
let r =
|
|
415
|
-
return /* @__PURE__ */
|
|
412
|
+
var Q = B.createContext(!1);
|
|
413
|
+
function Se({ title: t, children: n }) {
|
|
414
|
+
let r = de()?.assistants, i = ue();
|
|
415
|
+
return /* @__PURE__ */ G(Q.Provider, {
|
|
416
416
|
value: i,
|
|
417
|
-
children: /* @__PURE__ */
|
|
417
|
+
children: /* @__PURE__ */ K("div", {
|
|
418
418
|
className: "flex flex-col gap-4",
|
|
419
419
|
children: [
|
|
420
|
-
/* @__PURE__ */
|
|
420
|
+
/* @__PURE__ */ G("h1", {
|
|
421
421
|
className: "text-2xl font-semibold tracking-tight",
|
|
422
422
|
children: t
|
|
423
423
|
}),
|
|
424
|
-
/* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ G(ve, {
|
|
425
425
|
enabled: r?.catalog_copilot ?? !1,
|
|
426
426
|
draftingEnabled: i && (r?.catalog_drafting ?? !1)
|
|
427
427
|
}),
|
|
428
|
-
!i && /* @__PURE__ */
|
|
428
|
+
!i && /* @__PURE__ */ G("p", {
|
|
429
429
|
className: "text-sm text-muted-foreground",
|
|
430
|
-
children: /* @__PURE__ */
|
|
430
|
+
children: /* @__PURE__ */ G(e, { id: "Catalog updates are unavailable. You can still browse products and prices." })
|
|
431
431
|
}),
|
|
432
432
|
n
|
|
433
433
|
]
|
|
@@ -436,69 +436,69 @@ function Z({ title: t, children: n }) {
|
|
|
436
436
|
}
|
|
437
437
|
function Ce() {
|
|
438
438
|
let { text: e } = t();
|
|
439
|
-
return /* @__PURE__ */
|
|
439
|
+
return /* @__PURE__ */ G(Se, {
|
|
440
440
|
title: e("Products"),
|
|
441
|
-
children: /* @__PURE__ */
|
|
441
|
+
children: /* @__PURE__ */ G(Ee, {})
|
|
442
442
|
});
|
|
443
443
|
}
|
|
444
444
|
function we() {
|
|
445
445
|
let { text: e } = t();
|
|
446
|
-
return /* @__PURE__ */
|
|
446
|
+
return /* @__PURE__ */ G(Se, {
|
|
447
447
|
title: e("Prices"),
|
|
448
|
-
children: /* @__PURE__ */
|
|
448
|
+
children: /* @__PURE__ */ G(Ae, {})
|
|
449
449
|
});
|
|
450
450
|
}
|
|
451
451
|
var Te = 100;
|
|
452
452
|
function Ee() {
|
|
453
|
-
let { adminQueries: t } = n(), r =
|
|
453
|
+
let { adminQueries: t } = n(), r = B.useContext(Q), i = o("", Te), { data: a, isPending: c, isFetching: l } = H(t.products({
|
|
454
454
|
limit: i.size,
|
|
455
455
|
cursor: i.cursor,
|
|
456
456
|
errorAction: "Load products"
|
|
457
457
|
}));
|
|
458
|
-
return /* @__PURE__ */
|
|
458
|
+
return /* @__PURE__ */ K("div", {
|
|
459
459
|
className: "flex flex-col gap-3",
|
|
460
460
|
children: [
|
|
461
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ G("div", {
|
|
462
462
|
className: "flex justify-end gap-2",
|
|
463
|
-
children: r && /* @__PURE__ */
|
|
463
|
+
children: r && /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(ge, {}), /* @__PURE__ */ G(ke, {})] })
|
|
464
464
|
}),
|
|
465
|
-
c ? /* @__PURE__ */
|
|
465
|
+
c ? /* @__PURE__ */ G("div", {
|
|
466
466
|
className: "flex flex-col gap-3 py-2",
|
|
467
|
-
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */
|
|
468
|
-
}) : /* @__PURE__ */
|
|
467
|
+
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ G(E, { className: "h-6 w-full" }, t))
|
|
468
|
+
}) : /* @__PURE__ */ G("div", {
|
|
469
469
|
className: "overflow-x-auto",
|
|
470
|
-
children: /* @__PURE__ */
|
|
470
|
+
children: /* @__PURE__ */ K(N, { children: [/* @__PURE__ */ G(A, { children: /* @__PURE__ */ K(M, {
|
|
471
471
|
className: "hover:bg-transparent",
|
|
472
472
|
children: [
|
|
473
|
-
/* @__PURE__ */
|
|
473
|
+
/* @__PURE__ */ G(O, {
|
|
474
474
|
className: "text-muted-foreground",
|
|
475
|
-
children: /* @__PURE__ */
|
|
475
|
+
children: /* @__PURE__ */ G(e, { id: "Product" })
|
|
476
476
|
}),
|
|
477
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ G(O, {
|
|
478
478
|
className: "text-muted-foreground",
|
|
479
|
-
children: /* @__PURE__ */
|
|
479
|
+
children: /* @__PURE__ */ G(e, { id: "Key" })
|
|
480
480
|
}),
|
|
481
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ G(O, {
|
|
482
482
|
className: "text-muted-foreground",
|
|
483
|
-
children: /* @__PURE__ */
|
|
483
|
+
children: /* @__PURE__ */ G(e, { id: "Tier" })
|
|
484
484
|
}),
|
|
485
|
-
/* @__PURE__ */
|
|
485
|
+
/* @__PURE__ */ G(O, {
|
|
486
486
|
className: "text-muted-foreground",
|
|
487
|
-
children: /* @__PURE__ */
|
|
487
|
+
children: /* @__PURE__ */ G(e, { id: "Entitlements" })
|
|
488
488
|
}),
|
|
489
|
-
/* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ G(O, {
|
|
490
490
|
className: "text-muted-foreground",
|
|
491
|
-
children: /* @__PURE__ */
|
|
491
|
+
children: /* @__PURE__ */ G(e, { id: "State" })
|
|
492
492
|
}),
|
|
493
|
-
/* @__PURE__ */
|
|
493
|
+
/* @__PURE__ */ G(O, {})
|
|
494
494
|
]
|
|
495
|
-
}) }), /* @__PURE__ */
|
|
495
|
+
}) }), /* @__PURE__ */ K(k, { children: [(a?.data ?? []).map((e) => /* @__PURE__ */ G(De, { product: e }, e.id)), !a?.data?.length && /* @__PURE__ */ G(M, { children: /* @__PURE__ */ G(j, {
|
|
496
496
|
colSpan: 6,
|
|
497
497
|
className: "h-24 text-center text-muted-foreground",
|
|
498
|
-
children: /* @__PURE__ */
|
|
498
|
+
children: /* @__PURE__ */ G(e, { id: "No products yet." })
|
|
499
499
|
}) })] })] })
|
|
500
500
|
}),
|
|
501
|
-
/* @__PURE__ */
|
|
501
|
+
/* @__PURE__ */ G(s, {
|
|
502
502
|
pages: i,
|
|
503
503
|
rows: a?.data?.length ?? 0,
|
|
504
504
|
nextCursor: a?.next_cursor,
|
|
@@ -513,36 +513,36 @@ function Ee() {
|
|
|
513
513
|
});
|
|
514
514
|
}
|
|
515
515
|
function De({ product: t }) {
|
|
516
|
-
let { toast: r, toastApiError: i, adminMutations: a } = n(), o =
|
|
517
|
-
return /* @__PURE__ */
|
|
516
|
+
let { toast: r, toastApiError: i, adminMutations: a } = n(), o = B.useContext(Q), s = U(), c = V(a.setProductActive(s));
|
|
517
|
+
return /* @__PURE__ */ K(M, {
|
|
518
518
|
className: t.archived ? "opacity-60" : void 0,
|
|
519
519
|
children: [
|
|
520
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ G(j, {
|
|
521
521
|
className: "font-medium",
|
|
522
522
|
children: t.display_name
|
|
523
523
|
}),
|
|
524
|
-
/* @__PURE__ */
|
|
524
|
+
/* @__PURE__ */ G(j, {
|
|
525
525
|
className: "text-xs text-muted-foreground",
|
|
526
526
|
children: t.key
|
|
527
527
|
}),
|
|
528
|
-
/* @__PURE__ */
|
|
529
|
-
/* @__PURE__ */
|
|
528
|
+
/* @__PURE__ */ G(j, { children: t.tier_group ? `${t.tier_group} #${t.tier_rank}` : "—" }),
|
|
529
|
+
/* @__PURE__ */ G(j, { children: /* @__PURE__ */ G("span", {
|
|
530
530
|
className: "flex flex-wrap gap-1",
|
|
531
|
-
children: t.entitlements.map((e) => /* @__PURE__ */
|
|
531
|
+
children: t.entitlements.map((e) => /* @__PURE__ */ G(u, {
|
|
532
532
|
variant: "secondary",
|
|
533
533
|
className: "text-[10px]",
|
|
534
534
|
children: e
|
|
535
535
|
}, e))
|
|
536
536
|
}) }),
|
|
537
|
-
/* @__PURE__ */
|
|
537
|
+
/* @__PURE__ */ G(j, { children: t.archived ? /* @__PURE__ */ G(u, {
|
|
538
538
|
variant: "secondary",
|
|
539
|
-
children: /* @__PURE__ */
|
|
540
|
-
}) : /* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */
|
|
539
|
+
children: /* @__PURE__ */ G(e, { id: "archived" })
|
|
540
|
+
}) : /* @__PURE__ */ G(l, { status: "active" }) }),
|
|
541
|
+
/* @__PURE__ */ G(j, {
|
|
542
542
|
className: "text-right",
|
|
543
|
-
children: o && /* @__PURE__ */
|
|
543
|
+
children: o && /* @__PURE__ */ K("div", {
|
|
544
544
|
className: "flex justify-end gap-2",
|
|
545
|
-
children: [o && /* @__PURE__ */
|
|
545
|
+
children: [o && /* @__PURE__ */ G(ke, { product: t }), /* @__PURE__ */ G(d, {
|
|
546
546
|
variant: "outline",
|
|
547
547
|
size: "sm",
|
|
548
548
|
disabled: !o || c.isPending,
|
|
@@ -575,7 +575,7 @@ function Oe(e) {
|
|
|
575
575
|
};
|
|
576
576
|
}
|
|
577
577
|
function ke({ product: r }) {
|
|
578
|
-
let { toast: i, toastApiError: o, adminMutations: s } = n(), { text: c, id: l } = t(), [u, b] =
|
|
578
|
+
let { toast: i, toastApiError: o, adminMutations: s } = n(), { text: c, id: l } = t(), [u, b] = B.useState(!1), x = U(), S = V(s.createProduct(x)), C = V(s.updateProduct(x)), w = X({
|
|
579
579
|
defaultValues: Oe(r),
|
|
580
580
|
onSubmit: async ({ value: e }) => {
|
|
581
581
|
let t = e.entitlements.split(",").map((e) => e.trim()).filter(Boolean);
|
|
@@ -603,70 +603,70 @@ function ke({ product: r }) {
|
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
});
|
|
606
|
-
return /* @__PURE__ */
|
|
606
|
+
return /* @__PURE__ */ K(v, {
|
|
607
607
|
open: u,
|
|
608
608
|
onOpenChange: (e) => {
|
|
609
609
|
e && w.reset(Oe(r)), b(e);
|
|
610
610
|
},
|
|
611
|
-
children: [/* @__PURE__ */
|
|
611
|
+
children: [/* @__PURE__ */ G(_, { render: r ? /* @__PURE__ */ G(d, {
|
|
612
612
|
variant: "outline",
|
|
613
613
|
size: "sm",
|
|
614
|
-
children: /* @__PURE__ */
|
|
615
|
-
}) : /* @__PURE__ */
|
|
614
|
+
children: /* @__PURE__ */ G(e, { id: "Edit" })
|
|
615
|
+
}) : /* @__PURE__ */ K(d, {
|
|
616
616
|
size: "sm",
|
|
617
|
-
children: [/* @__PURE__ */
|
|
618
|
-
icon:
|
|
617
|
+
children: [/* @__PURE__ */ G(q, {
|
|
618
|
+
icon: J,
|
|
619
619
|
className: "size-4"
|
|
620
|
-
}), /* @__PURE__ */
|
|
621
|
-
}) }), /* @__PURE__ */
|
|
620
|
+
}), /* @__PURE__ */ G(e, { id: " Product" })]
|
|
621
|
+
}) }), /* @__PURE__ */ K(m, {
|
|
622
622
|
className: P,
|
|
623
|
-
children: [/* @__PURE__ */
|
|
623
|
+
children: [/* @__PURE__ */ K(f, { children: [/* @__PURE__ */ G(h, { children: r ? "Edit product" : "New product" }), /* @__PURE__ */ G(g, { children: /* @__PURE__ */ G(e, { id: "A product is the thing a customer gets. You set what it costs afterwards, by adding a price to it." }) })] }), /* @__PURE__ */ K("form", {
|
|
624
624
|
onSubmit: (e) => {
|
|
625
625
|
e.preventDefault(), e.stopPropagation(), w.handleSubmit();
|
|
626
626
|
},
|
|
627
627
|
className: "grid gap-4",
|
|
628
|
-
children: [/* @__PURE__ */
|
|
628
|
+
children: [/* @__PURE__ */ K("div", {
|
|
629
629
|
className: "grid gap-3",
|
|
630
630
|
children: [
|
|
631
|
-
!r && /* @__PURE__ */
|
|
631
|
+
!r && /* @__PURE__ */ G(w.Field, {
|
|
632
632
|
name: "key",
|
|
633
633
|
validators: { onBlur: ({ value: e }) => e.trim() ? void 0 : "Enter a product key" },
|
|
634
|
-
children: (e) => /* @__PURE__ */
|
|
634
|
+
children: (e) => /* @__PURE__ */ K($, {
|
|
635
635
|
label: c("Key"),
|
|
636
636
|
id: "p-key",
|
|
637
637
|
hint: "A short name you use in your own code. It cannot be changed later.",
|
|
638
|
-
children: [/* @__PURE__ */
|
|
638
|
+
children: [/* @__PURE__ */ G(y, {
|
|
639
639
|
id: l("p-key"),
|
|
640
640
|
value: e.state.value,
|
|
641
641
|
onBlur: e.handleBlur,
|
|
642
642
|
onChange: (t) => e.handleChange(t.target.value),
|
|
643
643
|
placeholder: c("premium-monthly"),
|
|
644
644
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
645
|
-
}), /* @__PURE__ */
|
|
645
|
+
}), /* @__PURE__ */ G(a, { errors: e.state.meta.errors })]
|
|
646
646
|
})
|
|
647
647
|
}),
|
|
648
|
-
/* @__PURE__ */
|
|
648
|
+
/* @__PURE__ */ G(w.Field, {
|
|
649
649
|
name: "name",
|
|
650
650
|
validators: { onBlur: ({ value: e }) => e.trim() ? void 0 : "Enter a display name" },
|
|
651
|
-
children: (e) => /* @__PURE__ */
|
|
651
|
+
children: (e) => /* @__PURE__ */ K($, {
|
|
652
652
|
label: c("Display name"),
|
|
653
653
|
id: "p-name",
|
|
654
654
|
hint: "What customers see on purchase and invoices.",
|
|
655
|
-
children: [/* @__PURE__ */
|
|
655
|
+
children: [/* @__PURE__ */ G(y, {
|
|
656
656
|
id: l("p-name"),
|
|
657
657
|
value: e.state.value,
|
|
658
658
|
onBlur: e.handleBlur,
|
|
659
659
|
onChange: (t) => e.handleChange(t.target.value),
|
|
660
660
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
661
|
-
}), /* @__PURE__ */
|
|
661
|
+
}), /* @__PURE__ */ G(a, { errors: e.state.meta.errors })]
|
|
662
662
|
})
|
|
663
663
|
}),
|
|
664
|
-
/* @__PURE__ */
|
|
664
|
+
/* @__PURE__ */ G(w.Field, {
|
|
665
665
|
name: "description",
|
|
666
|
-
children: (e) => /* @__PURE__ */
|
|
666
|
+
children: (e) => /* @__PURE__ */ G($, {
|
|
667
667
|
label: c("Description"),
|
|
668
668
|
id: "p-desc",
|
|
669
|
-
children: /* @__PURE__ */
|
|
669
|
+
children: /* @__PURE__ */ G(y, {
|
|
670
670
|
id: l("p-desc"),
|
|
671
671
|
value: e.state.value,
|
|
672
672
|
onBlur: e.handleBlur,
|
|
@@ -674,28 +674,28 @@ function ke({ product: r }) {
|
|
|
674
674
|
})
|
|
675
675
|
})
|
|
676
676
|
}),
|
|
677
|
-
/* @__PURE__ */
|
|
677
|
+
/* @__PURE__ */ K("div", {
|
|
678
678
|
className: "grid grid-cols-2 gap-3",
|
|
679
|
-
children: [/* @__PURE__ */
|
|
679
|
+
children: [/* @__PURE__ */ G(w.Field, {
|
|
680
680
|
name: "tierGroup",
|
|
681
|
-
children: (e) => /* @__PURE__ */
|
|
681
|
+
children: (e) => /* @__PURE__ */ G($, {
|
|
682
682
|
label: c("Tier group"),
|
|
683
683
|
id: "p-tg",
|
|
684
684
|
hint: "Products in one group are upgrades of each other. Leave empty if this stands alone.",
|
|
685
|
-
children: /* @__PURE__ */
|
|
685
|
+
children: /* @__PURE__ */ G(y, {
|
|
686
686
|
id: l("p-tg"),
|
|
687
687
|
value: e.state.value,
|
|
688
688
|
onBlur: e.handleBlur,
|
|
689
689
|
onChange: (t) => e.handleChange(t.target.value)
|
|
690
690
|
})
|
|
691
691
|
})
|
|
692
|
-
}), /* @__PURE__ */
|
|
692
|
+
}), /* @__PURE__ */ G(w.Field, {
|
|
693
693
|
name: "tierRank",
|
|
694
|
-
children: (e) => /* @__PURE__ */
|
|
694
|
+
children: (e) => /* @__PURE__ */ G($, {
|
|
695
695
|
label: c("Tier rank"),
|
|
696
696
|
id: "p-tr",
|
|
697
697
|
hint: "Higher rank means a higher tier in the group.",
|
|
698
|
-
children: /* @__PURE__ */
|
|
698
|
+
children: /* @__PURE__ */ G(y, {
|
|
699
699
|
id: l("p-tr"),
|
|
700
700
|
type: "number",
|
|
701
701
|
value: e.state.value,
|
|
@@ -705,13 +705,13 @@ function ke({ product: r }) {
|
|
|
705
705
|
})
|
|
706
706
|
})]
|
|
707
707
|
}),
|
|
708
|
-
/* @__PURE__ */
|
|
708
|
+
/* @__PURE__ */ G(w.Field, {
|
|
709
709
|
name: "entitlements",
|
|
710
|
-
children: (e) => /* @__PURE__ */
|
|
710
|
+
children: (e) => /* @__PURE__ */ G($, {
|
|
711
711
|
label: c("Entitlements"),
|
|
712
712
|
id: "p-ents",
|
|
713
713
|
hint: "The access names your product checks. Separate several with commas.",
|
|
714
|
-
children: /* @__PURE__ */
|
|
714
|
+
children: /* @__PURE__ */ G(y, {
|
|
715
715
|
id: l("p-ents"),
|
|
716
716
|
value: e.state.value,
|
|
717
717
|
onBlur: e.handleBlur,
|
|
@@ -721,19 +721,19 @@ function ke({ product: r }) {
|
|
|
721
721
|
})
|
|
722
722
|
})
|
|
723
723
|
]
|
|
724
|
-
}), /* @__PURE__ */
|
|
724
|
+
}), /* @__PURE__ */ G(p, { children: /* @__PURE__ */ G(w.Subscribe, {
|
|
725
725
|
selector: (e) => [
|
|
726
726
|
e.values.key,
|
|
727
727
|
e.values.name,
|
|
728
728
|
e.isSubmitting
|
|
729
729
|
],
|
|
730
|
-
children: ([t, n, i]) => /* @__PURE__ */
|
|
730
|
+
children: ([t, n, i]) => /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(d, {
|
|
731
731
|
type: "button",
|
|
732
732
|
variant: "outline",
|
|
733
733
|
disabled: i,
|
|
734
734
|
onClick: () => b(!1),
|
|
735
|
-
children: /* @__PURE__ */
|
|
736
|
-
}), /* @__PURE__ */
|
|
735
|
+
children: /* @__PURE__ */ G(e, { id: "Cancel" })
|
|
736
|
+
}), /* @__PURE__ */ G(d, {
|
|
737
737
|
type: "submit",
|
|
738
738
|
disabled: i || !n.trim() || !r && !t.trim(),
|
|
739
739
|
children: i ? "Saving…" : "Save product"
|
|
@@ -744,62 +744,62 @@ function ke({ product: r }) {
|
|
|
744
744
|
});
|
|
745
745
|
}
|
|
746
746
|
function Ae() {
|
|
747
|
-
let { adminQueries: t } = n(), r =
|
|
747
|
+
let { adminQueries: t } = n(), r = B.useContext(Q), i = o("", Te), { data: a } = H(t.allProducts({ errorAction: "Load products" })), { data: c, isPending: l, isFetching: u } = H(t.prices({
|
|
748
748
|
limit: i.size,
|
|
749
749
|
cursor: i.cursor,
|
|
750
750
|
errorAction: "Load prices"
|
|
751
751
|
}));
|
|
752
|
-
return /* @__PURE__ */
|
|
752
|
+
return /* @__PURE__ */ K("div", {
|
|
753
753
|
className: "flex flex-col gap-3",
|
|
754
754
|
children: [
|
|
755
|
-
/* @__PURE__ */
|
|
755
|
+
/* @__PURE__ */ G("div", {
|
|
756
756
|
className: "flex justify-end",
|
|
757
|
-
children: r && /* @__PURE__ */
|
|
757
|
+
children: r && /* @__PURE__ */ G(Pe, { products: a?.data ?? [] })
|
|
758
758
|
}),
|
|
759
|
-
l ? /* @__PURE__ */
|
|
759
|
+
l ? /* @__PURE__ */ G("div", {
|
|
760
760
|
className: "flex flex-col gap-3 py-2",
|
|
761
|
-
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */
|
|
762
|
-
}) : /* @__PURE__ */
|
|
761
|
+
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ G(E, { className: "h-6 w-full" }, t))
|
|
762
|
+
}) : /* @__PURE__ */ G("div", {
|
|
763
763
|
className: "overflow-x-auto",
|
|
764
|
-
children: /* @__PURE__ */
|
|
764
|
+
children: /* @__PURE__ */ K(N, { children: [/* @__PURE__ */ G(A, { children: /* @__PURE__ */ K(M, {
|
|
765
765
|
className: "hover:bg-transparent",
|
|
766
766
|
children: [
|
|
767
|
-
/* @__PURE__ */
|
|
767
|
+
/* @__PURE__ */ G(O, {
|
|
768
768
|
className: "text-muted-foreground",
|
|
769
|
-
children: /* @__PURE__ */
|
|
769
|
+
children: /* @__PURE__ */ G(e, { id: "Price" })
|
|
770
770
|
}),
|
|
771
|
-
/* @__PURE__ */
|
|
771
|
+
/* @__PURE__ */ G(O, {
|
|
772
772
|
className: "text-muted-foreground",
|
|
773
|
-
children: /* @__PURE__ */
|
|
773
|
+
children: /* @__PURE__ */ G(e, { id: "Product" })
|
|
774
774
|
}),
|
|
775
|
-
/* @__PURE__ */
|
|
775
|
+
/* @__PURE__ */ G(O, {
|
|
776
776
|
className: "text-muted-foreground",
|
|
777
|
-
children: /* @__PURE__ */
|
|
777
|
+
children: /* @__PURE__ */ G(e, { id: "Amount" })
|
|
778
778
|
}),
|
|
779
|
-
/* @__PURE__ */
|
|
779
|
+
/* @__PURE__ */ G(O, {
|
|
780
780
|
className: "text-muted-foreground",
|
|
781
|
-
children: /* @__PURE__ */
|
|
781
|
+
children: /* @__PURE__ */ G(e, { id: "Renews" })
|
|
782
782
|
}),
|
|
783
|
-
/* @__PURE__ */
|
|
783
|
+
/* @__PURE__ */ G(O, {
|
|
784
784
|
className: "text-muted-foreground",
|
|
785
|
-
children: /* @__PURE__ */
|
|
785
|
+
children: /* @__PURE__ */ G(e, { id: "Providers" })
|
|
786
786
|
}),
|
|
787
|
-
/* @__PURE__ */
|
|
787
|
+
/* @__PURE__ */ G(O, {
|
|
788
788
|
className: "text-muted-foreground",
|
|
789
|
-
children: /* @__PURE__ */
|
|
789
|
+
children: /* @__PURE__ */ G(e, { id: "State" })
|
|
790
790
|
}),
|
|
791
|
-
/* @__PURE__ */
|
|
791
|
+
/* @__PURE__ */ G(O, {})
|
|
792
792
|
]
|
|
793
|
-
}) }), /* @__PURE__ */
|
|
793
|
+
}) }), /* @__PURE__ */ K(k, { children: [(c?.data ?? []).map((e) => /* @__PURE__ */ G(je, {
|
|
794
794
|
price: e,
|
|
795
795
|
product: a?.data.find((t) => t.id === e.product_id)
|
|
796
|
-
}, e.id)), !c?.data?.length && /* @__PURE__ */
|
|
796
|
+
}, e.id)), !c?.data?.length && /* @__PURE__ */ G(M, { children: /* @__PURE__ */ G(j, {
|
|
797
797
|
colSpan: 7,
|
|
798
798
|
className: "h-24 text-center text-muted-foreground",
|
|
799
|
-
children: /* @__PURE__ */
|
|
799
|
+
children: /* @__PURE__ */ G(e, { id: "No prices yet." })
|
|
800
800
|
}) })] })] })
|
|
801
801
|
}),
|
|
802
|
-
/* @__PURE__ */
|
|
802
|
+
/* @__PURE__ */ G(s, {
|
|
803
803
|
pages: i,
|
|
804
804
|
rows: c?.data?.length ?? 0,
|
|
805
805
|
nextCursor: c?.next_cursor,
|
|
@@ -814,51 +814,51 @@ function Ae() {
|
|
|
814
814
|
});
|
|
815
815
|
}
|
|
816
816
|
function je({ price: t, product: i }) {
|
|
817
|
-
let { toast: a, toastApiError: o, adminMutations: s } = n(), f = i?.display_name ?? I(t.product_id, 13), p =
|
|
818
|
-
return /* @__PURE__ */
|
|
817
|
+
let { toast: a, toastApiError: o, adminMutations: s } = n(), f = i?.display_name ?? I(t.product_id, 13), p = B.useContext(Q), m = U(), h = V(s.setPriceActive(m));
|
|
818
|
+
return /* @__PURE__ */ K(c, {
|
|
819
819
|
to: `/catalog/prices/${encodeURIComponent(t.id)}`,
|
|
820
820
|
className: t.archived ? "opacity-60" : void 0,
|
|
821
821
|
children: [
|
|
822
|
-
/* @__PURE__ */
|
|
822
|
+
/* @__PURE__ */ G(j, {
|
|
823
823
|
className: "text-xs text-muted-foreground",
|
|
824
|
-
children: /* @__PURE__ */
|
|
824
|
+
children: /* @__PURE__ */ G(r, {
|
|
825
825
|
className: "underline-offset-2 hover:underline",
|
|
826
826
|
to: `/catalog/prices/${encodeURIComponent(t.id)}`,
|
|
827
827
|
children: t.id
|
|
828
828
|
})
|
|
829
829
|
}),
|
|
830
|
-
/* @__PURE__ */
|
|
830
|
+
/* @__PURE__ */ G(j, {
|
|
831
831
|
className: "font-medium",
|
|
832
832
|
children: f
|
|
833
833
|
}),
|
|
834
|
-
/* @__PURE__ */
|
|
834
|
+
/* @__PURE__ */ G(j, {
|
|
835
835
|
className: "tabular-nums",
|
|
836
|
-
children:
|
|
836
|
+
children: oe(t)
|
|
837
837
|
}),
|
|
838
|
-
/* @__PURE__ */
|
|
839
|
-
/* @__PURE__ */
|
|
838
|
+
/* @__PURE__ */ G(j, { children: ie(t) }),
|
|
839
|
+
/* @__PURE__ */ G(j, { children: /* @__PURE__ */ G("span", {
|
|
840
840
|
className: "flex flex-wrap gap-1",
|
|
841
|
-
children: t.provider ? /* @__PURE__ */
|
|
841
|
+
children: t.provider ? /* @__PURE__ */ K(u, {
|
|
842
842
|
variant: "secondary",
|
|
843
|
-
children: [t.provider.psp, /* @__PURE__ */
|
|
844
|
-
}) : (t.sell_via ?? []).map((e) => /* @__PURE__ */
|
|
843
|
+
children: [t.provider.psp, /* @__PURE__ */ G(e, { id: "'s price" })]
|
|
844
|
+
}) : (t.sell_via ?? []).map((e) => /* @__PURE__ */ G(u, {
|
|
845
845
|
variant: "secondary",
|
|
846
846
|
children: e
|
|
847
847
|
}, e))
|
|
848
848
|
}) }),
|
|
849
|
-
/* @__PURE__ */
|
|
849
|
+
/* @__PURE__ */ G(j, { children: t.archived ? /* @__PURE__ */ G(u, {
|
|
850
850
|
variant: "secondary",
|
|
851
|
-
children: /* @__PURE__ */
|
|
852
|
-
}) : /* @__PURE__ */
|
|
853
|
-
/* @__PURE__ */
|
|
851
|
+
children: /* @__PURE__ */ G(e, { id: "archived" })
|
|
852
|
+
}) : /* @__PURE__ */ G(l, { status: "active" }) }),
|
|
853
|
+
/* @__PURE__ */ G(j, {
|
|
854
854
|
className: "text-right",
|
|
855
|
-
children: p && /* @__PURE__ */
|
|
855
|
+
children: p && /* @__PURE__ */ K("div", {
|
|
856
856
|
className: "flex justify-end gap-2",
|
|
857
|
-
children: [p && /* @__PURE__ */
|
|
857
|
+
children: [p && /* @__PURE__ */ G(fe, {
|
|
858
858
|
price: t,
|
|
859
859
|
productName: f,
|
|
860
860
|
productKey: i?.key
|
|
861
|
-
}), /* @__PURE__ */
|
|
861
|
+
}), /* @__PURE__ */ G(d, {
|
|
862
862
|
variant: "outline",
|
|
863
863
|
size: "sm",
|
|
864
864
|
disabled: !p || h.isPending,
|
|
@@ -880,9 +880,9 @@ function je({ price: t, product: i }) {
|
|
|
880
880
|
]
|
|
881
881
|
});
|
|
882
882
|
}
|
|
883
|
-
var
|
|
884
|
-
function
|
|
885
|
-
let { toast: i, toastApiError: o, adminMutations: s } = n(), { text: c, id: l } = t(), [u, E] =
|
|
883
|
+
var Me = ({ value: e }) => !e || z(e) ? void 0 : "Use hours, days or weeks, such as 30 days", Ne = ({ value: e }) => !e || re(e) ? void 0 : "Use a fixed interval, such as 30 days, or a calendar interval, such as 1 month";
|
|
884
|
+
function Pe({ products: r }) {
|
|
885
|
+
let { toast: i, toastApiError: o, adminMutations: s } = n(), { text: c, id: l } = t(), [u, E] = B.useState(!1), O = U(), k = V(s.createPrice(O)), A = X({
|
|
886
886
|
defaultValues: {
|
|
887
887
|
productId: "",
|
|
888
888
|
amount: "",
|
|
@@ -893,14 +893,14 @@ function Me({ products: r }) {
|
|
|
893
893
|
onSubmit: async ({ value: e }) => {
|
|
894
894
|
let t = F(e.amount, e.currency);
|
|
895
895
|
if (t === null || BigInt(t) <= 0n) return;
|
|
896
|
-
let n = z(e.accessDuration), r =
|
|
896
|
+
let n = z(e.accessDuration), r = re(e.billingInterval);
|
|
897
897
|
if (!(e.accessDuration && !n || e.billingInterval && !r)) try {
|
|
898
898
|
await k.mutateAsync({
|
|
899
899
|
product_id: e.productId,
|
|
900
900
|
unit_amount: t,
|
|
901
901
|
currency: e.currency,
|
|
902
902
|
...n ? { access_duration_hours: n } : {},
|
|
903
|
-
...r
|
|
903
|
+
...r
|
|
904
904
|
}), A.reset(), i.success("Price created"), E(!1);
|
|
905
905
|
} catch (e) {
|
|
906
906
|
o(e, "Create price");
|
|
@@ -909,42 +909,42 @@ function Me({ products: r }) {
|
|
|
909
909
|
}), j = (e) => {
|
|
910
910
|
e && A.reset(), E(e);
|
|
911
911
|
};
|
|
912
|
-
return /* @__PURE__ */
|
|
912
|
+
return /* @__PURE__ */ K(v, {
|
|
913
913
|
open: u,
|
|
914
914
|
onOpenChange: j,
|
|
915
|
-
children: [/* @__PURE__ */
|
|
915
|
+
children: [/* @__PURE__ */ G(_, { render: /* @__PURE__ */ K(d, {
|
|
916
916
|
size: "sm",
|
|
917
|
-
children: [/* @__PURE__ */
|
|
918
|
-
icon:
|
|
917
|
+
children: [/* @__PURE__ */ G(q, {
|
|
918
|
+
icon: J,
|
|
919
919
|
className: "size-4"
|
|
920
|
-
}), /* @__PURE__ */
|
|
921
|
-
}) }), /* @__PURE__ */
|
|
920
|
+
}), /* @__PURE__ */ G(e, { id: " Price" })]
|
|
921
|
+
}) }), /* @__PURE__ */ K(m, {
|
|
922
922
|
className: P,
|
|
923
|
-
children: [/* @__PURE__ */
|
|
923
|
+
children: [/* @__PURE__ */ K(f, { children: [/* @__PURE__ */ G(h, { children: /* @__PURE__ */ G(e, { id: "New price" }) }), /* @__PURE__ */ G(g, { children: /* @__PURE__ */ G(e, { id: "These terms cannot be changed later. To charge a different amount, create another price and deactivate this one." }) })] }), /* @__PURE__ */ K("form", {
|
|
924
924
|
onSubmit: (e) => {
|
|
925
925
|
e.preventDefault(), e.stopPropagation(), A.handleSubmit();
|
|
926
926
|
},
|
|
927
927
|
className: "grid gap-4",
|
|
928
|
-
children: [/* @__PURE__ */
|
|
928
|
+
children: [/* @__PURE__ */ K("div", {
|
|
929
929
|
className: "grid gap-3",
|
|
930
930
|
children: [
|
|
931
|
-
/* @__PURE__ */
|
|
931
|
+
/* @__PURE__ */ G(A.Field, {
|
|
932
932
|
name: "productId",
|
|
933
|
-
children: (e) => /* @__PURE__ */
|
|
933
|
+
children: (e) => /* @__PURE__ */ G($, {
|
|
934
934
|
label: c("Product"),
|
|
935
935
|
id: "pr-prod",
|
|
936
|
-
children: /* @__PURE__ */
|
|
936
|
+
children: /* @__PURE__ */ K(T, {
|
|
937
937
|
items: r.map((e) => ({
|
|
938
938
|
value: e.id,
|
|
939
939
|
label: `${e.display_name} (${e.key})`
|
|
940
940
|
})),
|
|
941
941
|
value: e.state.value || null,
|
|
942
942
|
onValueChange: (t) => e.handleChange(t ?? ""),
|
|
943
|
-
children: [/* @__PURE__ */
|
|
943
|
+
children: [/* @__PURE__ */ G(S, {
|
|
944
944
|
id: l("pr-prod"),
|
|
945
945
|
className: "w-full",
|
|
946
|
-
children: /* @__PURE__ */
|
|
947
|
-
}), /* @__PURE__ */
|
|
946
|
+
children: /* @__PURE__ */ G(x, { placeholder: c("Pick a product…") })
|
|
947
|
+
}), /* @__PURE__ */ G(C, { children: r.map((e) => /* @__PURE__ */ K(w, {
|
|
948
948
|
value: e.id,
|
|
949
949
|
children: [
|
|
950
950
|
e.display_name,
|
|
@@ -956,21 +956,21 @@ function Me({ products: r }) {
|
|
|
956
956
|
})
|
|
957
957
|
})
|
|
958
958
|
}),
|
|
959
|
-
/* @__PURE__ */
|
|
959
|
+
/* @__PURE__ */ G($, {
|
|
960
960
|
label: c("Amount"),
|
|
961
961
|
id: "pr-amount",
|
|
962
962
|
hint: "Enter it the way you would write it, such as 19.90.",
|
|
963
|
-
children: /* @__PURE__ */
|
|
963
|
+
children: /* @__PURE__ */ K("div", {
|
|
964
964
|
className: "flex gap-2",
|
|
965
|
-
children: [/* @__PURE__ */
|
|
965
|
+
children: [/* @__PURE__ */ G(A.Field, {
|
|
966
966
|
name: "amount",
|
|
967
967
|
validators: {
|
|
968
968
|
onBlurListenTo: ["currency"],
|
|
969
969
|
onBlur: ({ value: e, fieldApi: t }) => BigInt(F(e, t.form.getFieldValue("currency")) ?? "0") > 0n ? void 0 : "Enter an amount greater than zero"
|
|
970
970
|
},
|
|
971
|
-
children: (e) => /* @__PURE__ */
|
|
971
|
+
children: (e) => /* @__PURE__ */ K("div", {
|
|
972
972
|
className: "flex-1",
|
|
973
|
-
children: [/* @__PURE__ */
|
|
973
|
+
children: [/* @__PURE__ */ G(y, {
|
|
974
974
|
id: l("pr-amount"),
|
|
975
975
|
type: "number",
|
|
976
976
|
step: "any",
|
|
@@ -979,12 +979,12 @@ function Me({ products: r }) {
|
|
|
979
979
|
onBlur: e.handleBlur,
|
|
980
980
|
onChange: (t) => e.handleChange(t.target.value),
|
|
981
981
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
982
|
-
}), /* @__PURE__ */
|
|
982
|
+
}), /* @__PURE__ */ G(a, { errors: e.state.meta.errors })]
|
|
983
983
|
})
|
|
984
|
-
}), /* @__PURE__ */
|
|
984
|
+
}), /* @__PURE__ */ G(A.Field, {
|
|
985
985
|
name: "currency",
|
|
986
986
|
validators: { onChange: ({ value: e }) => te(e) === void 0 ? `Use ${L.join(", ")}` : void 0 },
|
|
987
|
-
children: (e) => /* @__PURE__ */
|
|
987
|
+
children: (e) => /* @__PURE__ */ G(y, {
|
|
988
988
|
id: l("pr-cur"),
|
|
989
989
|
"aria-label": c("Currency"),
|
|
990
990
|
className: "w-24",
|
|
@@ -999,63 +999,63 @@ function Me({ products: r }) {
|
|
|
999
999
|
})]
|
|
1000
1000
|
})
|
|
1001
1001
|
}),
|
|
1002
|
-
/* @__PURE__ */
|
|
1002
|
+
/* @__PURE__ */ G(A.Field, {
|
|
1003
1003
|
name: "accessDuration",
|
|
1004
|
-
validators: { onBlur:
|
|
1005
|
-
children: (e) => /* @__PURE__ */
|
|
1004
|
+
validators: { onBlur: Me },
|
|
1005
|
+
children: (e) => /* @__PURE__ */ K($, {
|
|
1006
1006
|
label: c("Access duration"),
|
|
1007
1007
|
id: "pr-dur",
|
|
1008
1008
|
hint: "Such as 30 days, 1 week or 12 hours. Leave it empty for access that never expires.",
|
|
1009
|
-
children: [/* @__PURE__ */
|
|
1009
|
+
children: [/* @__PURE__ */ G(y, {
|
|
1010
1010
|
id: l("pr-dur"),
|
|
1011
1011
|
placeholder: c("Never expires"),
|
|
1012
1012
|
value: e.state.value,
|
|
1013
1013
|
onBlur: e.handleBlur,
|
|
1014
1014
|
onChange: (t) => e.handleChange(t.target.value),
|
|
1015
1015
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
1016
|
-
}), /* @__PURE__ */
|
|
1016
|
+
}), /* @__PURE__ */ G(a, { errors: e.state.meta.errors })]
|
|
1017
1017
|
})
|
|
1018
1018
|
}),
|
|
1019
|
-
/* @__PURE__ */
|
|
1019
|
+
/* @__PURE__ */ G(A.Field, {
|
|
1020
1020
|
name: "billingInterval",
|
|
1021
|
-
validators: { onBlur:
|
|
1022
|
-
children: (t) => /* @__PURE__ */
|
|
1021
|
+
validators: { onBlur: Ne },
|
|
1022
|
+
children: (t) => /* @__PURE__ */ K("div", {
|
|
1023
1023
|
className: "grid gap-3 rounded-md border p-3",
|
|
1024
|
-
children: [/* @__PURE__ */
|
|
1024
|
+
children: [/* @__PURE__ */ K("div", {
|
|
1025
1025
|
className: "flex items-center justify-between gap-4",
|
|
1026
|
-
children: [/* @__PURE__ */
|
|
1026
|
+
children: [/* @__PURE__ */ G(b, {
|
|
1027
1027
|
htmlFor: l("pr-renew"),
|
|
1028
|
-
children: /* @__PURE__ */
|
|
1029
|
-
}), /* @__PURE__ */
|
|
1028
|
+
children: /* @__PURE__ */ G(e, { id: "Recurring billing" })
|
|
1029
|
+
}), /* @__PURE__ */ G(D, {
|
|
1030
1030
|
id: l("pr-renew"),
|
|
1031
1031
|
checked: !!t.state.value,
|
|
1032
1032
|
onCheckedChange: (e) => t.handleChange(e ? "30 days" : "")
|
|
1033
1033
|
})]
|
|
1034
|
-
}), t.state.value ? /* @__PURE__ */
|
|
1034
|
+
}), t.state.value ? /* @__PURE__ */ K($, {
|
|
1035
1035
|
label: c("Billing interval"),
|
|
1036
1036
|
id: "pr-billing",
|
|
1037
|
-
hint: "
|
|
1038
|
-
children: [/* @__PURE__ */
|
|
1037
|
+
hint: "Use 30 days for a fixed interval, or 1 month to keep the original billing day (UTC).",
|
|
1038
|
+
children: [/* @__PURE__ */ G(y, {
|
|
1039
1039
|
id: l("pr-billing"),
|
|
1040
1040
|
required: !0,
|
|
1041
1041
|
value: t.state.value,
|
|
1042
1042
|
onBlur: t.handleBlur,
|
|
1043
1043
|
onChange: (e) => t.handleChange(e.target.value),
|
|
1044
1044
|
"aria-invalid": t.state.meta.errors.length > 0
|
|
1045
|
-
}), /* @__PURE__ */
|
|
1046
|
-
}) : /* @__PURE__ */
|
|
1045
|
+
}), /* @__PURE__ */ G(a, { errors: t.state.meta.errors })]
|
|
1046
|
+
}) : /* @__PURE__ */ G("p", {
|
|
1047
1047
|
className: "text-xs text-muted-foreground",
|
|
1048
|
-
children: /* @__PURE__ */
|
|
1048
|
+
children: /* @__PURE__ */ G(e, { id: "One-time payment." })
|
|
1049
1049
|
})]
|
|
1050
1050
|
})
|
|
1051
1051
|
})
|
|
1052
1052
|
]
|
|
1053
|
-
}), /* @__PURE__ */
|
|
1053
|
+
}), /* @__PURE__ */ K(p, { children: [/* @__PURE__ */ G(d, {
|
|
1054
1054
|
type: "button",
|
|
1055
1055
|
variant: "outline",
|
|
1056
1056
|
onClick: () => j(!1),
|
|
1057
|
-
children: /* @__PURE__ */
|
|
1058
|
-
}), /* @__PURE__ */
|
|
1057
|
+
children: /* @__PURE__ */ G(e, { id: "Cancel" })
|
|
1058
|
+
}), /* @__PURE__ */ G(A.Subscribe, {
|
|
1059
1059
|
selector: (e) => [
|
|
1060
1060
|
e.values.productId,
|
|
1061
1061
|
e.values.amount,
|
|
@@ -1064,9 +1064,9 @@ function Me({ products: r }) {
|
|
|
1064
1064
|
e.values.billingInterval,
|
|
1065
1065
|
e.isSubmitting
|
|
1066
1066
|
],
|
|
1067
|
-
children: ([e, t, n, r, i, a]) => /* @__PURE__ */
|
|
1067
|
+
children: ([e, t, n, r, i, a]) => /* @__PURE__ */ G(d, {
|
|
1068
1068
|
type: "submit",
|
|
1069
|
-
disabled: a || !e || BigInt(F(t, n) ?? "0") <= 0n ||
|
|
1069
|
+
disabled: a || !e || BigInt(F(t, n) ?? "0") <= 0n || Me({ value: r }) !== void 0 || Ne({ value: i }) !== void 0,
|
|
1070
1070
|
children: a ? "Creating…" : "Create price"
|
|
1071
1071
|
})
|
|
1072
1072
|
})] })]
|
|
@@ -1076,14 +1076,14 @@ function Me({ products: r }) {
|
|
|
1076
1076
|
}
|
|
1077
1077
|
function $({ label: e, id: n, hint: r, children: i }) {
|
|
1078
1078
|
let { id: a } = t();
|
|
1079
|
-
return /* @__PURE__ */
|
|
1079
|
+
return /* @__PURE__ */ K("div", {
|
|
1080
1080
|
className: "grid gap-1.5",
|
|
1081
1081
|
children: [
|
|
1082
|
-
/* @__PURE__ */
|
|
1082
|
+
/* @__PURE__ */ G(b, {
|
|
1083
1083
|
htmlFor: a(n),
|
|
1084
1084
|
children: e
|
|
1085
1085
|
}),
|
|
1086
|
-
r ? /* @__PURE__ */
|
|
1086
|
+
r ? /* @__PURE__ */ G("p", {
|
|
1087
1087
|
className: "text-[13px] text-muted-foreground",
|
|
1088
1088
|
children: r
|
|
1089
1089
|
}) : null,
|
|
@@ -1093,4 +1093,4 @@ function $({ label: e, id: n, hint: r, children: i }) {
|
|
|
1093
1093
|
}
|
|
1094
1094
|
export { we as CatalogPricesPage, Ce as CatalogProductsPage };
|
|
1095
1095
|
|
|
1096
|
-
//# sourceMappingURL=admin-catalog-
|
|
1096
|
+
//# sourceMappingURL=admin-catalog-DB5lr46V.js.map
|