@openrails/billing-ui 0.272.0 → 0.274.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/admin/components/customer-search.d.ts +5 -0
- package/dist/admin/components/missing-record.d.ts +6 -0
- package/dist/admin/components/status-badge.d.ts +1 -0
- package/dist/admin/context.d.ts +20 -2
- package/dist/admin/lib/api/endpoints.d.ts +3 -1
- package/dist/admin/lib/api/index.d.ts +2 -0
- package/dist/admin/lib/api/types.d.ts +2 -0
- package/dist/admin/lib/capabilities.d.ts +4 -0
- package/dist/admin/lib/dialog-width.d.ts +4 -3
- package/dist/admin/lib/error-text.d.ts +4 -0
- package/dist/admin/lib/mutations.d.ts +6 -1
- package/dist/admin/lib/queries.d.ts +3 -0
- package/dist/admin/lib/tile-grids.d.ts +6 -0
- package/dist/admin/messages.d.ts +89 -0
- package/dist/admin/pages/payments/index.d.ts +1 -2
- package/dist/admin/pages/subscriptions/index.d.ts +1 -2
- package/dist/{admin-attempts-DyDDt-qw.js → admin-attempts-Dzipkstg.js} +145 -144
- package/dist/admin-attempts-Dzipkstg.js.map +1 -0
- package/dist/{admin-auth-1aZIgXiS.js → admin-auth-BCl_Tv3t.js} +2 -2
- package/dist/{admin-auth-1aZIgXiS.js.map → admin-auth-BCl_Tv3t.js.map} +1 -1
- package/dist/{admin-badge-pgG6D9-a.js → admin-badge-kmYQM9Ge.js} +2 -2
- package/dist/{admin-badge-pgG6D9-a.js.map → admin-badge-kmYQM9Ge.js.map} +1 -1
- package/dist/{admin-button-CrcYk5r0.js → admin-button-Cq9ZfX4R.js} +2 -2
- package/dist/{admin-button-CrcYk5r0.js.map → admin-button-Cq9ZfX4R.js.map} +1 -1
- package/dist/{admin-capabilities-BDcZeHL_.js → admin-capabilities-k5fQZhN9.js} +35 -14
- package/dist/admin-capabilities-k5fQZhN9.js.map +1 -0
- package/dist/{admin-card-DvTMc5Se.js → admin-card-C8k67jJv.js} +2 -2
- package/dist/{admin-card-DvTMc5Se.js.map → admin-card-C8k67jJv.js.map} +1 -1
- package/dist/{admin-catalog-BlF5mnu4.js → admin-catalog-CON-GwKL.js} +286 -286
- package/dist/{admin-catalog-BlF5mnu4.js.map → admin-catalog-CON-GwKL.js.map} +1 -1
- package/dist/{admin-cursor-pager-CIb3Jw2F.js → admin-cursor-pager-DqFruoNu.js} +6 -6
- package/dist/{admin-cursor-pager-CIb3Jw2F.js.map → admin-cursor-pager-DqFruoNu.js.map} +1 -1
- package/dist/admin-customer-search-CJHB80rg.js +117 -0
- package/dist/admin-customer-search-CJHB80rg.js.map +1 -0
- package/dist/{admin-customers-EpfoWDh-.js → admin-customers-CWWOrcVR.js} +18 -17
- package/dist/{admin-customers-EpfoWDh-.js.map → admin-customers-CWWOrcVR.js.map} +1 -1
- package/dist/admin-dashboard-BiShWFk2.js +456 -0
- package/dist/admin-dashboard-BiShWFk2.js.map +1 -0
- package/dist/admin-data-table-CdsjYJh5.js +107 -0
- package/dist/admin-data-table-CdsjYJh5.js.map +1 -0
- package/dist/admin-detail-BWSC1aCH.js +338 -0
- package/dist/admin-detail-BWSC1aCH.js.map +1 -0
- package/dist/admin-detail-CKRtK43V.js +728 -0
- package/dist/admin-detail-CKRtK43V.js.map +1 -0
- package/dist/admin-detail-CMmhZQ2A.js +346 -0
- package/dist/admin-detail-CMmhZQ2A.js.map +1 -0
- package/dist/admin-detail-CiONe1Pt.js +1357 -0
- package/dist/admin-detail-CiONe1Pt.js.map +1 -0
- package/dist/{admin-detail-3wFIDPNB.js → admin-detail-Cyuf_i9U.js} +62 -62
- package/dist/{admin-detail-3wFIDPNB.js.map → admin-detail-Cyuf_i9U.js.map} +1 -1
- package/dist/{admin-dialog-BSRf9Zre.js → admin-dialog-Ch7rTOCr.js} +3 -3
- package/dist/{admin-dialog-BSRf9Zre.js.map → admin-dialog-Ch7rTOCr.js.map} +1 -1
- package/dist/admin-dialog-width-CC7QHT1p.js +6 -0
- package/dist/admin-dialog-width-CC7QHT1p.js.map +1 -0
- package/dist/{admin-dropdown-menu-D0E5rwmn.js → admin-dropdown-menu-Bah3f8AZ.js} +2 -2
- package/dist/{admin-dropdown-menu-D0E5rwmn.js.map → admin-dropdown-menu-Bah3f8AZ.js.map} +1 -1
- package/dist/{admin-fact-card-BPSVhS15.js → admin-fact-card-Bt__Cd_U.js} +2 -2
- package/dist/{admin-fact-card-BPSVhS15.js.map → admin-fact-card-Bt__Cd_U.js.map} +1 -1
- package/dist/{admin-health-D0L5Kig7.js → admin-health-pzTO6_0v.js} +249 -248
- package/dist/admin-health-pzTO6_0v.js.map +1 -0
- package/dist/{admin-imports-CgZB5JAV.js → admin-imports-tT5et8-V.js} +62 -62
- package/dist/{admin-imports-CgZB5JAV.js.map → admin-imports-tT5et8-V.js.map} +1 -1
- package/dist/{admin-input-DJAK9nmk.js → admin-input-DvRZy_2a.js} +2 -2
- package/dist/{admin-input-DJAK9nmk.js.map → admin-input-DvRZy_2a.js.map} +1 -1
- package/dist/{admin-label-aviN9Gng.js → admin-label-QZtWJGH-.js} +2 -2
- package/dist/{admin-label-aviN9Gng.js.map → admin-label-QZtWJGH-.js.map} +1 -1
- package/dist/{admin-linked-table-row-BGr7JXeM.js → admin-linked-table-row-6jkCKwMn.js} +4 -4
- package/dist/{admin-linked-table-row-BGr7JXeM.js.map → admin-linked-table-row-6jkCKwMn.js.map} +1 -1
- package/dist/{admin-map-dialog-DS2Wz6G3.js → admin-map-dialog-BV54mvMQ.js} +22 -22
- package/dist/{admin-map-dialog-DS2Wz6G3.js.map → admin-map-dialog-BV54mvMQ.js.map} +1 -1
- package/dist/{admin-metering-D-e-37Jn.js → admin-metering-Bv5EcX6M.js} +306 -306
- package/dist/{admin-metering-D-e-37Jn.js.map → admin-metering-Bv5EcX6M.js.map} +1 -1
- package/dist/admin-missing-record-BXqGFDt3.js +42 -0
- package/dist/admin-missing-record-BXqGFDt3.js.map +1 -0
- package/dist/admin-ops-h3RjpcNu.js +356 -0
- package/dist/admin-ops-h3RjpcNu.js.map +1 -0
- package/dist/admin-orders-DYxPiuTl.js +192 -0
- package/dist/admin-orders-DYxPiuTl.js.map +1 -0
- package/dist/{admin-parked-B8xHkV2e.js → admin-parked-ClKA60d5.js} +51 -51
- package/dist/{admin-parked-B8xHkV2e.js.map → admin-parked-ClKA60d5.js.map} +1 -1
- package/dist/admin-payments-BlIuy3wL.js +220 -0
- package/dist/admin-payments-BlIuy3wL.js.map +1 -0
- package/dist/{admin-price-detail-CSI5oKdb.js → admin-price-detail-BjWYU5A-.js} +98 -98
- package/dist/{admin-price-detail-CSI5oKdb.js.map → admin-price-detail-BjWYU5A-.js.map} +1 -1
- package/dist/{admin-price-wizard-CBEcNGvP.js → admin-price-wizard-CTbkbmYc.js} +61 -61
- package/dist/{admin-price-wizard-CBEcNGvP.js.map → admin-price-wizard-CTbkbmYc.js.map} +1 -1
- package/dist/{admin-proposals-Cuj7tvaM.js → admin-proposals-Ci9Q8j7Y.js} +64 -64
- package/dist/{admin-proposals-Cuj7tvaM.js.map → admin-proposals-Ci9Q8j7Y.js.map} +1 -1
- package/dist/{admin-provider-prices-B6vwnVPi.js → admin-provider-prices-B6Ayq-eN.js} +66 -66
- package/dist/{admin-provider-prices-B6vwnVPi.js.map → admin-provider-prices-B6Ayq-eN.js.map} +1 -1
- package/dist/{admin-range-picker-De36L-AP.js → admin-range-picker-nfflPp21.js} +9 -9
- package/dist/{admin-range-picker-De36L-AP.js.map → admin-range-picker-nfflPp21.js.map} +1 -1
- package/dist/{admin-records-H0MlhEVY.js → admin-records-CrTCorWH.js} +43 -43
- package/dist/{admin-records-H0MlhEVY.js.map → admin-records-CrTCorWH.js.map} +1 -1
- package/dist/{admin-reports-BFGS_PWf.js → admin-reports-BO6wrvtw.js} +50 -50
- package/dist/{admin-reports-BFGS_PWf.js.map → admin-reports-BO6wrvtw.js.map} +1 -1
- package/dist/{admin-select-BUcEU5Rg.js → admin-select-DvfJ80Rg.js} +2 -2
- package/dist/{admin-select-BUcEU5Rg.js.map → admin-select-DvfJ80Rg.js.map} +1 -1
- package/dist/{admin-settings-DYC-c7mJ.js → admin-settings-BOoTzhyf.js} +332 -332
- package/dist/admin-settings-BOoTzhyf.js.map +1 -0
- package/dist/{admin-shared-lfIUEbPY.js → admin-shared-BbGT_qTo.js} +21 -21
- package/dist/{admin-shared-lfIUEbPY.js.map → admin-shared-BbGT_qTo.js.map} +1 -1
- package/dist/{admin-skeleton-B0yzYY_X.js → admin-skeleton-B2a4ScVE.js} +2 -2
- package/dist/{admin-skeleton-B0yzYY_X.js.map → admin-skeleton-B2a4ScVE.js.map} +1 -1
- package/dist/admin-status-badge-Bp6cssXY.js +51 -0
- package/dist/admin-status-badge-Bp6cssXY.js.map +1 -0
- package/dist/admin-subscriptions-D9JmoicC.js +275 -0
- package/dist/admin-subscriptions-D9JmoicC.js.map +1 -0
- package/dist/{admin-switch-DDorugaw.js → admin-switch-DBBxJRZP.js} +2 -2
- package/dist/{admin-switch-DDorugaw.js.map → admin-switch-DBBxJRZP.js.map} +1 -1
- package/dist/{admin-table-BU6Tie69.js → admin-table-CPDoVfK4.js} +2 -2
- package/dist/{admin-table-BU6Tie69.js.map → admin-table-CPDoVfK4.js.map} +1 -1
- package/dist/{admin-tabs-D5lqdVcC.js → admin-tabs-DDUv3kiu.js} +2 -2
- package/dist/{admin-tabs-D5lqdVcC.js.map → admin-tabs-DDUv3kiu.js.map} +1 -1
- package/dist/{admin-textarea-Dc6lnEub.js → admin-textarea-d3fu_waS.js} +2 -2
- package/dist/{admin-textarea-Dc6lnEub.js.map → admin-textarea-d3fu_waS.js.map} +1 -1
- package/dist/admin-tile-grids-CzGpidd9.js +6 -0
- package/dist/admin-tile-grids-CzGpidd9.js.map +1 -0
- package/dist/{admin-typed-confirm-dialog-Bk6XxmPb.js → admin-typed-confirm-dialog-BVklYjFo.js} +11 -11
- package/dist/{admin-typed-confirm-dialog-Bk6XxmPb.js.map → admin-typed-confirm-dialog-BVklYjFo.js.map} +1 -1
- package/dist/{admin-utils-B9eEBNsR.js → admin-utils-DTT53IpS.js} +266 -223
- package/dist/admin-utils-DTT53IpS.js.map +1 -0
- package/dist/{admin-widget-viz-8aukE3v_.js → admin-widget-viz-Exsqz3Dw.js} +165 -128
- package/dist/admin-widget-viz-Exsqz3Dw.js.map +1 -0
- package/dist/admin.css +1 -1
- package/dist/admin.js +531 -405
- package/dist/admin.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/admin-attempts-DyDDt-qw.js.map +0 -1
- package/dist/admin-capabilities-BDcZeHL_.js.map +0 -1
- package/dist/admin-dashboard-CJE63yz4.js +0 -420
- package/dist/admin-dashboard-CJE63yz4.js.map +0 -1
- package/dist/admin-data-table-hvFcJepL.js +0 -96
- package/dist/admin-data-table-hvFcJepL.js.map +0 -1
- package/dist/admin-detail-BRP6pL7t.js +0 -328
- package/dist/admin-detail-BRP6pL7t.js.map +0 -1
- package/dist/admin-detail-CRzFb_pa.js +0 -1331
- package/dist/admin-detail-CRzFb_pa.js.map +0 -1
- package/dist/admin-detail-QLxU8r-5.js +0 -344
- package/dist/admin-detail-QLxU8r-5.js.map +0 -1
- package/dist/admin-detail-pPC8Q9l-.js +0 -710
- package/dist/admin-detail-pPC8Q9l-.js.map +0 -1
- package/dist/admin-dialog-width-BPrgdYlj.js +0 -6
- package/dist/admin-dialog-width-BPrgdYlj.js.map +0 -1
- package/dist/admin-health-D0L5Kig7.js.map +0 -1
- package/dist/admin-ops-CQP4TzWM.js +0 -235
- package/dist/admin-ops-CQP4TzWM.js.map +0 -1
- package/dist/admin-orders-BJ7W5S8P.js +0 -192
- package/dist/admin-orders-BJ7W5S8P.js.map +0 -1
- package/dist/admin-payments-CzkzqYA1.js +0 -246
- package/dist/admin-payments-CzkzqYA1.js.map +0 -1
- package/dist/admin-settings-DYC-c7mJ.js.map +0 -1
- package/dist/admin-status-badge-0-K37EfN.js +0 -43
- package/dist/admin-status-badge-0-K37EfN.js.map +0 -1
- package/dist/admin-subscriptions-CvW-YFs0.js +0 -301
- package/dist/admin-subscriptions-CvW-YFs0.js.map +0 -1
- package/dist/admin-utils-B9eEBNsR.js.map +0 -1
- package/dist/admin-widget-viz-8aukE3v_.js.map +0 -1
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as a } from "./admin-button-
|
|
3
|
-
import { t as o } from "./admin-input-
|
|
4
|
-
import { t as s } from "./admin-skeleton-
|
|
5
|
-
import {
|
|
1
|
+
import { E as e, O as t, p as n, r, w as i } from "./admin-utils-DTT53IpS.js";
|
|
2
|
+
import { t as a } from "./admin-button-Cq9ZfX4R.js";
|
|
3
|
+
import { t as o } from "./admin-input-DvRZy_2a.js";
|
|
4
|
+
import { t as s } from "./admin-skeleton-B2a4ScVE.js";
|
|
5
|
+
import { c, r as l } from "./admin-capabilities-k5fQZhN9.js";
|
|
6
6
|
import { c as u, d, n as f, o as p, s as m, u as h } from "./admin-format-DoohJ7Fg.js";
|
|
7
|
-
import { t as g } from "./admin-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { a as
|
|
11
|
-
import { t as
|
|
12
|
-
import {
|
|
13
|
-
import { t as
|
|
14
|
-
import { a as
|
|
15
|
-
import { t as
|
|
16
|
-
import { t as
|
|
17
|
-
import {
|
|
18
|
-
import { i as
|
|
19
|
-
import { t as
|
|
20
|
-
import { r as
|
|
21
|
-
import { t as
|
|
22
|
-
import * as
|
|
23
|
-
import { useMutation as
|
|
24
|
-
import { Fragment as
|
|
7
|
+
import { t as g } from "./admin-badge-kmYQM9Ge.js";
|
|
8
|
+
import { t as _ } from "./admin-status-badge-Bp6cssXY.js";
|
|
9
|
+
import { t as v } from "./admin-form-field-errors-hbUMIriS.js";
|
|
10
|
+
import { a as y, i as b, n as x, r as S, t as C } from "./admin-select-DvfJ80Rg.js";
|
|
11
|
+
import { n as w, t as T } from "./admin-cursor-pager-DqFruoNu.js";
|
|
12
|
+
import { a as E, n as D, o as O, r as k, s as A, t as j } from "./admin-table-CPDoVfK4.js";
|
|
13
|
+
import { t as ee } from "./admin-linked-table-row-6jkCKwMn.js";
|
|
14
|
+
import { a as M, i as N, n as P, o as F, r as I, s as L, t as R } from "./admin-dialog-Ch7rTOCr.js";
|
|
15
|
+
import { t as z } from "./admin-label-QZtWJGH-.js";
|
|
16
|
+
import { t as te } from "./admin-switch-DBBxJRZP.js";
|
|
17
|
+
import { i as ne, r as B } from "./admin-dialog-width-CC7QHT1p.js";
|
|
18
|
+
import { i as V, n as re, r as ie, t as ae } from "./admin-price-format-BVUpDoSC.js";
|
|
19
|
+
import { t as oe } from "./admin-textarea-d3fu_waS.js";
|
|
20
|
+
import { r as se, t as ce } from "./admin-card-C8k67jJv.js";
|
|
21
|
+
import { t as le } from "./admin-price-wizard-CTbkbmYc.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 ue, jsx as K, jsxs as q } from "react/jsx-runtime";
|
|
25
25
|
import { HugeiconsIcon as J } from "@hugeicons/react";
|
|
26
26
|
import { Add01Icon as de, BubbleChatQuestionIcon as fe, Cancel01Icon as pe, Loading02Icon as me, SparklesIcon as he } from "@hugeicons/core-free-icons";
|
|
27
27
|
import { useForm as Y } from "@tanstack/react-form";
|
|
28
28
|
//#region src/admin/pages/catalog/application-dialog.tsx
|
|
29
29
|
function ge() {
|
|
30
|
-
let { toast:
|
|
30
|
+
let { toast: r, toastApiError: o, selectedMerchant: s, adminMutations: c } = n(), { id: l, text: u } = t(), [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
31
|
E(s()), m(JSON.stringify({
|
|
32
32
|
schema_version: 1,
|
|
33
33
|
prune: !1,
|
|
34
34
|
products: {}
|
|
35
35
|
}, null, 2)), v(void 0), b(void 0), g(!1), w(!1), S("");
|
|
36
|
-
}, k = async (
|
|
36
|
+
}, k = async (e = !1) => {
|
|
37
37
|
if (s() !== T) {
|
|
38
38
|
S("This draft belongs to another selected merchant. Return to that merchant before applying it.");
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
let
|
|
42
|
-
v(
|
|
41
|
+
let t = _ ?? p;
|
|
42
|
+
v(t), w(!1), S("");
|
|
43
43
|
try {
|
|
44
|
-
let
|
|
45
|
-
document:
|
|
46
|
-
force:
|
|
44
|
+
let n = await D.mutateAsync({
|
|
45
|
+
document: t,
|
|
46
|
+
force: e
|
|
47
47
|
});
|
|
48
|
-
b(
|
|
49
|
-
let
|
|
50
|
-
S(
|
|
51
|
-
} catch (
|
|
52
|
-
let
|
|
53
|
-
w(
|
|
48
|
+
b(n);
|
|
49
|
+
let i = n.conflicts?.length ?? 0;
|
|
50
|
+
S(n.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(n.replayed ? "Original batch receipt returned" : "Catalog batch applied");
|
|
51
|
+
} catch (e) {
|
|
52
|
+
let t = e instanceof i && e.status >= 400 && e.status < 500 && e.status !== 408;
|
|
53
|
+
w(t), S(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."), o(e, "Apply catalog");
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
return /* @__PURE__ */ q(
|
|
56
|
+
return /* @__PURE__ */ q(R, {
|
|
57
57
|
open: d,
|
|
58
58
|
onOpenChange: (e) => {
|
|
59
59
|
D.isPending || (f(e), e && !p && O());
|
|
60
60
|
},
|
|
61
|
-
children: [/* @__PURE__ */ K(
|
|
61
|
+
children: [/* @__PURE__ */ K(L, { render: /* @__PURE__ */ K(a, {
|
|
62
62
|
variant: "outline",
|
|
63
63
|
size: "sm",
|
|
64
|
-
children: /* @__PURE__ */ K(
|
|
65
|
-
}) }), /* @__PURE__ */ q(
|
|
66
|
-
className:
|
|
64
|
+
children: /* @__PURE__ */ K(e, { id: "Apply catalog" })
|
|
65
|
+
}) }), /* @__PURE__ */ q(P, {
|
|
66
|
+
className: ne,
|
|
67
67
|
children: [
|
|
68
|
-
/* @__PURE__ */ q(
|
|
68
|
+
/* @__PURE__ */ q(M, { children: [/* @__PURE__ */ K(F, { children: /* @__PURE__ */ K(e, { id: "Apply catalog changes" }) }), /* @__PURE__ */ K(I, { children: /* @__PURE__ */ K(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
69
|
/* @__PURE__ */ q("div", {
|
|
70
70
|
className: "grid gap-3",
|
|
71
71
|
children: [
|
|
72
|
-
/* @__PURE__ */ K(
|
|
72
|
+
/* @__PURE__ */ K(z, {
|
|
73
73
|
htmlFor: l("catalog-application"),
|
|
74
|
-
children: /* @__PURE__ */ K(
|
|
74
|
+
children: /* @__PURE__ */ K(e, { id: "Catalog document" })
|
|
75
75
|
}),
|
|
76
|
-
/* @__PURE__ */ K(
|
|
76
|
+
/* @__PURE__ */ K(oe, {
|
|
77
77
|
id: l("catalog-application"),
|
|
78
78
|
className: "max-h-80 min-h-48 font-mono text-xs",
|
|
79
79
|
spellCheck: !1,
|
|
@@ -85,7 +85,7 @@ function ge() {
|
|
|
85
85
|
}),
|
|
86
86
|
h && !_ && /* @__PURE__ */ K("p", {
|
|
87
87
|
className: "text-sm",
|
|
88
|
-
children: /* @__PURE__ */ K(
|
|
88
|
+
children: /* @__PURE__ */ K(e, { id: "Review complete. Applying sends this exact document; this is not a database diff." })
|
|
89
89
|
}),
|
|
90
90
|
x && /* @__PURE__ */ K("p", {
|
|
91
91
|
role: "status",
|
|
@@ -100,31 +100,31 @@ function ge() {
|
|
|
100
100
|
})
|
|
101
101
|
]
|
|
102
102
|
}),
|
|
103
|
-
/* @__PURE__ */ q(
|
|
103
|
+
/* @__PURE__ */ q(N, { children: [
|
|
104
104
|
C && /* @__PURE__ */ K(a, {
|
|
105
105
|
variant: "outline",
|
|
106
106
|
onClick: () => {
|
|
107
107
|
v(void 0), g(!1), w(!1), S("");
|
|
108
108
|
},
|
|
109
|
-
children: /* @__PURE__ */ K(
|
|
109
|
+
children: /* @__PURE__ */ K(e, { id: "Edit batch" })
|
|
110
110
|
}),
|
|
111
111
|
y && y.conflicts.length > 0 && /* @__PURE__ */ K(a, {
|
|
112
112
|
variant: "destructive",
|
|
113
113
|
disabled: D.isPending,
|
|
114
114
|
onClick: () => void k(!0),
|
|
115
|
-
children: /* @__PURE__ */ K(
|
|
115
|
+
children: /* @__PURE__ */ K(e, { id: "Overwrite edits" })
|
|
116
116
|
}),
|
|
117
117
|
y ? /* @__PURE__ */ K(a, {
|
|
118
118
|
onClick: () => O(),
|
|
119
|
-
children: /* @__PURE__ */ K(
|
|
119
|
+
children: /* @__PURE__ */ K(e, { id: "New batch" })
|
|
120
120
|
}) : _ === void 0 ? h ? /* @__PURE__ */ K(a, {
|
|
121
121
|
disabled: !p.trim(),
|
|
122
122
|
onClick: () => void k(),
|
|
123
|
-
children: /* @__PURE__ */ K(
|
|
123
|
+
children: /* @__PURE__ */ K(e, { id: "Apply reviewed batch" })
|
|
124
124
|
}) : /* @__PURE__ */ K(a, {
|
|
125
125
|
disabled: !p.trim(),
|
|
126
126
|
onClick: () => g(!0),
|
|
127
|
-
children: /* @__PURE__ */ K(
|
|
127
|
+
children: /* @__PURE__ */ K(e, { id: "Review batch" })
|
|
128
128
|
}) : /* @__PURE__ */ K(a, {
|
|
129
129
|
disabled: D.isPending || C,
|
|
130
130
|
onClick: () => void k(),
|
|
@@ -135,47 +135,47 @@ function ge() {
|
|
|
135
135
|
})]
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
-
function _e({ conflicts:
|
|
138
|
+
function _e({ conflicts: n }) {
|
|
139
139
|
let { text: r } = t();
|
|
140
140
|
return /* @__PURE__ */ K("ul", {
|
|
141
141
|
"aria-label": r("Skipped objects"),
|
|
142
142
|
className: "grid gap-2 text-sm",
|
|
143
|
-
children:
|
|
143
|
+
children: n.map((t) => /* @__PURE__ */ q("li", {
|
|
144
144
|
className: "rounded-md border p-2",
|
|
145
145
|
children: [/* @__PURE__ */ q("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__ */ K(
|
|
150
|
+
/* @__PURE__ */ K(e, { id: "skipped" })
|
|
151
151
|
]
|
|
152
152
|
}), /* @__PURE__ */ K("ul", {
|
|
153
153
|
className: "mt-1 grid gap-1 text-xs text-muted-foreground",
|
|
154
|
-
children:
|
|
155
|
-
|
|
156
|
-
/* @__PURE__ */ K(
|
|
154
|
+
children: t.fields.map((n) => /* @__PURE__ */ q("li", { children: [
|
|
155
|
+
n.field,
|
|
156
|
+
/* @__PURE__ */ K(e, { id: ": the batch says" }),
|
|
157
157
|
" ",
|
|
158
|
-
ve(
|
|
159
|
-
/* @__PURE__ */ K(
|
|
158
|
+
ve(n, n.file_value, t.currency),
|
|
159
|
+
/* @__PURE__ */ K(e, { id: ", an edit set" }),
|
|
160
160
|
" ",
|
|
161
|
-
ve(
|
|
161
|
+
ve(n, n.live_value, t.currency),
|
|
162
162
|
" (",
|
|
163
|
-
|
|
163
|
+
n.set_by,
|
|
164
164
|
", ",
|
|
165
|
-
p(
|
|
165
|
+
p(n.set_at),
|
|
166
166
|
")"
|
|
167
|
-
] },
|
|
167
|
+
] }, n.field))
|
|
168
168
|
})]
|
|
169
|
-
}, `${
|
|
169
|
+
}, `${t.object}:${t.product_key ?? ""}:${t.key}`))
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
function ve(e, t, n) {
|
|
173
|
-
return t == null ? "none" : (e.field === "unit_amount" || e.field === "trial_unit_amount") && typeof t == "string" && n ? m(t, n) : e.field.endsWith("_hours") && typeof t == "number" ?
|
|
173
|
+
return t == null ? "none" : (e.field === "unit_amount" || e.field === "trial_unit_amount") && typeof t == "string" && n ? m(t, n) : e.field.endsWith("_hours") && typeof t == "number" ? ie(t) : JSON.stringify(t);
|
|
174
174
|
}
|
|
175
175
|
//#endregion
|
|
176
176
|
//#region src/admin/pages/catalog/copilot-panel.tsx
|
|
177
|
-
function ye({ enabled:
|
|
178
|
-
let { text: c } = t(), { adminMutations: l } =
|
|
177
|
+
function ye({ enabled: r, draftingEnabled: s }) {
|
|
178
|
+
let { text: c } = t(), { adminMutations: l } = n(), u = U(l.askCatalogCopilot()), d = Y({
|
|
179
179
|
defaultValues: { question: "" },
|
|
180
180
|
onSubmit: async ({ value: e }) => {
|
|
181
181
|
let t = e.question.trim();
|
|
@@ -186,8 +186,8 @@ function ye({ enabled: i, draftingEnabled: s }) {
|
|
|
186
186
|
} catch {}
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
}), f = u.data, p = u.error ? u.error instanceof
|
|
190
|
-
return
|
|
189
|
+
}), f = u.data, p = u.error ? u.error instanceof i ? u.error.message : "ask failed" : null;
|
|
190
|
+
return r ? /* @__PURE__ */ K(ce, { children: /* @__PURE__ */ q(se, {
|
|
191
191
|
className: "flex flex-col gap-3",
|
|
192
192
|
children: [
|
|
193
193
|
/* @__PURE__ */ q("form", {
|
|
@@ -212,21 +212,21 @@ function ye({ enabled: i, draftingEnabled: s }) {
|
|
|
212
212
|
}),
|
|
213
213
|
/* @__PURE__ */ K(d.Subscribe, {
|
|
214
214
|
selector: (e) => [e.values.question, e.isSubmitting],
|
|
215
|
-
children: ([
|
|
215
|
+
children: ([t, n]) => /* @__PURE__ */ q(a, {
|
|
216
216
|
type: "submit",
|
|
217
217
|
size: "sm",
|
|
218
|
-
disabled:
|
|
219
|
-
children: [
|
|
218
|
+
disabled: n || !t.trim(),
|
|
219
|
+
children: [n ? /* @__PURE__ */ K(J, {
|
|
220
220
|
icon: me,
|
|
221
221
|
className: "size-3.5 animate-spin"
|
|
222
|
-
}) : null, /* @__PURE__ */ K(
|
|
222
|
+
}) : null, /* @__PURE__ */ K(e, { id: "Ask" })]
|
|
223
223
|
})
|
|
224
224
|
})
|
|
225
225
|
]
|
|
226
226
|
}),
|
|
227
227
|
u.isPending ? /* @__PURE__ */ K("p", {
|
|
228
228
|
className: "text-xs text-muted-foreground",
|
|
229
|
-
children: /* @__PURE__ */ K(
|
|
229
|
+
children: /* @__PURE__ */ K(e, { id: "Checking your catalog…" })
|
|
230
230
|
}) : null,
|
|
231
231
|
p ? /* @__PURE__ */ K("p", {
|
|
232
232
|
className: "text-xs whitespace-pre-wrap text-destructive",
|
|
@@ -277,37 +277,37 @@ function ye({ enabled: i, draftingEnabled: s }) {
|
|
|
277
277
|
]
|
|
278
278
|
}) }) : null;
|
|
279
279
|
}
|
|
280
|
-
function be({ draft:
|
|
281
|
-
let r =
|
|
282
|
-
return
|
|
280
|
+
function be({ draft: t, draftingEnabled: n }) {
|
|
281
|
+
let r = c() && n;
|
|
282
|
+
return t.kind === "refused" && t.refusal ? /* @__PURE__ */ q("div", {
|
|
283
283
|
className: "rounded-lg border border-dashed p-3 text-xs",
|
|
284
284
|
children: [
|
|
285
285
|
/* @__PURE__ */ K("p", {
|
|
286
286
|
className: "mb-1 flex items-center gap-2 font-medium",
|
|
287
|
-
children: /* @__PURE__ */ q(
|
|
287
|
+
children: /* @__PURE__ */ q(g, {
|
|
288
288
|
variant: "secondary",
|
|
289
|
-
children: [/* @__PURE__ */ K(
|
|
289
|
+
children: [/* @__PURE__ */ K(e, { id: "refused: " }), t.refusal.code]
|
|
290
290
|
})
|
|
291
291
|
}),
|
|
292
292
|
/* @__PURE__ */ K("p", {
|
|
293
293
|
className: "text-muted-foreground",
|
|
294
|
-
children:
|
|
294
|
+
children: t.refusal.reason
|
|
295
295
|
}),
|
|
296
296
|
/* @__PURE__ */ K("p", {
|
|
297
297
|
className: "mt-1",
|
|
298
|
-
children:
|
|
298
|
+
children: t.refusal.workaround
|
|
299
299
|
})
|
|
300
300
|
]
|
|
301
|
-
}) :
|
|
302
|
-
draft:
|
|
301
|
+
}) : t.kind === "price_change" && t.price_change ? /* @__PURE__ */ K(xe, {
|
|
302
|
+
draft: t.price_change,
|
|
303
303
|
canApply: r
|
|
304
|
-
}) :
|
|
305
|
-
draft:
|
|
304
|
+
}) : t.kind === "new_price" && t.new_price ? /* @__PURE__ */ K(Se, {
|
|
305
|
+
draft: t.new_price,
|
|
306
306
|
canApply: r
|
|
307
307
|
}) : null;
|
|
308
308
|
}
|
|
309
|
-
function xe({ draft:
|
|
310
|
-
let { toastApiError: i, adminMutations: o } =
|
|
309
|
+
function xe({ draft: t, canApply: r }) {
|
|
310
|
+
let { toastApiError: i, adminMutations: o } = n(), s = U(o.loadCatalogPriceDraft());
|
|
311
311
|
return /* @__PURE__ */ q("div", {
|
|
312
312
|
className: "rounded-lg border bg-muted/30 p-3 text-sm",
|
|
313
313
|
children: [
|
|
@@ -320,43 +320,43 @@ function xe({ draft: e, canApply: t }) {
|
|
|
320
320
|
}),
|
|
321
321
|
/* @__PURE__ */ K("span", {
|
|
322
322
|
className: "text-xs font-medium text-muted-foreground uppercase",
|
|
323
|
-
children: /* @__PURE__ */ K(
|
|
323
|
+
children: /* @__PURE__ */ K(e, { id: "Draft: price change" })
|
|
324
324
|
}),
|
|
325
|
-
/* @__PURE__ */ K(
|
|
325
|
+
/* @__PURE__ */ K(g, {
|
|
326
326
|
variant: "secondary",
|
|
327
|
-
children: BigInt(
|
|
327
|
+
children: BigInt(t.new_amount) > BigInt(t.current_amount) ? "increase" : "decrease"
|
|
328
328
|
})
|
|
329
329
|
]
|
|
330
330
|
}),
|
|
331
|
-
/* @__PURE__ */ K("p", { children:
|
|
331
|
+
/* @__PURE__ */ K("p", { children: t.review_text }),
|
|
332
332
|
/* @__PURE__ */ q("p", {
|
|
333
333
|
className: "mt-1 text-xs text-muted-foreground",
|
|
334
334
|
children: [
|
|
335
|
-
m(
|
|
335
|
+
m(t.current_amount, t.currency),
|
|
336
336
|
" →",
|
|
337
337
|
" ",
|
|
338
|
-
m(
|
|
338
|
+
m(t.new_amount, t.currency),
|
|
339
339
|
" ·",
|
|
340
340
|
" ",
|
|
341
|
-
|
|
342
|
-
/* @__PURE__ */ K(
|
|
341
|
+
t.affected_count.toLocaleString(),
|
|
342
|
+
/* @__PURE__ */ K(e, { id: " affected · requires human confirm" })
|
|
343
343
|
]
|
|
344
344
|
}),
|
|
345
|
-
|
|
345
|
+
r && (s.data ? /* @__PURE__ */ K(le, {
|
|
346
346
|
price: s.data.price,
|
|
347
347
|
productName: s.data.productName,
|
|
348
348
|
productKey: s.data.productKey,
|
|
349
|
-
draft:
|
|
349
|
+
draft: t,
|
|
350
350
|
onDone: () => s.reset()
|
|
351
351
|
}) : /* @__PURE__ */ K(a, {
|
|
352
352
|
size: "sm",
|
|
353
353
|
className: "mt-2",
|
|
354
354
|
disabled: s.isPending,
|
|
355
355
|
onClick: async () => {
|
|
356
|
-
if (
|
|
356
|
+
if (r) try {
|
|
357
357
|
await s.mutateAsync({
|
|
358
|
-
productKey:
|
|
359
|
-
priceKey:
|
|
358
|
+
productKey: t.product_key,
|
|
359
|
+
priceKey: t.price_key
|
|
360
360
|
});
|
|
361
361
|
} catch (e) {
|
|
362
362
|
i(e, "Load draft for review");
|
|
@@ -367,8 +367,8 @@ function xe({ draft: e, canApply: t }) {
|
|
|
367
367
|
]
|
|
368
368
|
});
|
|
369
369
|
}
|
|
370
|
-
function Se({ draft:
|
|
371
|
-
let { toastApiError: i, adminMutations: o } =
|
|
370
|
+
function Se({ draft: t, canApply: r }) {
|
|
371
|
+
let { toastApiError: i, adminMutations: o } = n(), s = G(), c = U(o.createCatalogDraftPrice(s));
|
|
372
372
|
return /* @__PURE__ */ q("div", {
|
|
373
373
|
className: "rounded-lg border bg-muted/30 p-3 text-sm",
|
|
374
374
|
children: [
|
|
@@ -379,27 +379,27 @@ function Se({ draft: e, canApply: t }) {
|
|
|
379
379
|
className: "size-3.5 text-muted-foreground"
|
|
380
380
|
}), /* @__PURE__ */ K("span", {
|
|
381
381
|
className: "text-xs font-medium text-muted-foreground uppercase",
|
|
382
|
-
children: /* @__PURE__ */ K(
|
|
382
|
+
children: /* @__PURE__ */ K(e, { id: "Draft: new price" })
|
|
383
383
|
})]
|
|
384
384
|
}),
|
|
385
|
-
/* @__PURE__ */ K("p", { children:
|
|
385
|
+
/* @__PURE__ */ K("p", { children: t.review_text }),
|
|
386
386
|
/* @__PURE__ */ q("p", {
|
|
387
387
|
className: "mt-1 text-xs text-muted-foreground",
|
|
388
388
|
children: [
|
|
389
|
-
/* @__PURE__ */ K(
|
|
390
|
-
|
|
389
|
+
/* @__PURE__ */ K(e, { id: "key: " }),
|
|
390
|
+
t.create_price.key,
|
|
391
391
|
" ·",
|
|
392
392
|
" ",
|
|
393
|
-
m(
|
|
393
|
+
m(t.create_price.unit_amount, t.create_price.currency)
|
|
394
394
|
]
|
|
395
395
|
}),
|
|
396
|
-
|
|
396
|
+
r && /* @__PURE__ */ K(a, {
|
|
397
397
|
size: "sm",
|
|
398
398
|
className: "mt-2",
|
|
399
399
|
disabled: c.isPending || c.isSuccess,
|
|
400
400
|
onClick: async () => {
|
|
401
|
-
if (
|
|
402
|
-
await c.mutateAsync(
|
|
401
|
+
if (r) try {
|
|
402
|
+
await c.mutateAsync(t.create_price);
|
|
403
403
|
} catch (e) {
|
|
404
404
|
i(e, "Create drafted price");
|
|
405
405
|
}
|
|
@@ -411,9 +411,9 @@ function Se({ draft: e, canApply: t }) {
|
|
|
411
411
|
}
|
|
412
412
|
//#endregion
|
|
413
413
|
//#region src/admin/pages/catalog/index.tsx
|
|
414
|
-
var X =
|
|
415
|
-
function Ce({ title:
|
|
416
|
-
let r =
|
|
414
|
+
var X = H.createContext(!1);
|
|
415
|
+
function Ce({ title: t, children: n }) {
|
|
416
|
+
let r = l()?.assistants, i = c();
|
|
417
417
|
return /* @__PURE__ */ K(X.Provider, {
|
|
418
418
|
value: i,
|
|
419
419
|
children: /* @__PURE__ */ q("div", {
|
|
@@ -421,7 +421,7 @@ function Ce({ title: e, children: t }) {
|
|
|
421
421
|
children: [
|
|
422
422
|
/* @__PURE__ */ K("h1", {
|
|
423
423
|
className: "text-2xl font-semibold tracking-tight",
|
|
424
|
-
children:
|
|
424
|
+
children: t
|
|
425
425
|
}),
|
|
426
426
|
/* @__PURE__ */ K(ye, {
|
|
427
427
|
enabled: r?.catalog_copilot ?? !1,
|
|
@@ -429,9 +429,9 @@ function Ce({ title: e, children: t }) {
|
|
|
429
429
|
}),
|
|
430
430
|
!i && /* @__PURE__ */ K("p", {
|
|
431
431
|
className: "text-sm text-muted-foreground",
|
|
432
|
-
children: /* @__PURE__ */ K(
|
|
432
|
+
children: /* @__PURE__ */ K(e, { id: "Catalog updates are unavailable. You can still browse products and prices." })
|
|
433
433
|
}),
|
|
434
|
-
|
|
434
|
+
n
|
|
435
435
|
]
|
|
436
436
|
})
|
|
437
437
|
});
|
|
@@ -452,7 +452,7 @@ function Te() {
|
|
|
452
452
|
}
|
|
453
453
|
var Ee = 100;
|
|
454
454
|
function De() {
|
|
455
|
-
let { adminQueries:
|
|
455
|
+
let { adminQueries: t } = n(), r = H.useContext(X), i = w("", Ee), { data: a, isPending: o, isFetching: c } = W(t.products({
|
|
456
456
|
limit: i.size,
|
|
457
457
|
cursor: i.cursor,
|
|
458
458
|
errorAction: "Load products"
|
|
@@ -462,45 +462,45 @@ function De() {
|
|
|
462
462
|
children: [
|
|
463
463
|
/* @__PURE__ */ K("div", {
|
|
464
464
|
className: "flex justify-end gap-2",
|
|
465
|
-
children:
|
|
465
|
+
children: r && /* @__PURE__ */ q(ue, { children: [/* @__PURE__ */ K(ge, {}), /* @__PURE__ */ K(ke, {})] })
|
|
466
466
|
}),
|
|
467
467
|
o ? /* @__PURE__ */ K("div", {
|
|
468
468
|
className: "flex flex-col gap-3 py-2",
|
|
469
469
|
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ K(s, { className: "h-6 w-full" }, t))
|
|
470
470
|
}) : /* @__PURE__ */ K("div", {
|
|
471
471
|
className: "overflow-x-auto",
|
|
472
|
-
children: /* @__PURE__ */ q(
|
|
472
|
+
children: /* @__PURE__ */ q(j, { children: [/* @__PURE__ */ K(O, { children: /* @__PURE__ */ q(A, {
|
|
473
473
|
className: "hover:bg-transparent",
|
|
474
474
|
children: [
|
|
475
|
-
/* @__PURE__ */ K(
|
|
475
|
+
/* @__PURE__ */ K(E, {
|
|
476
476
|
className: "text-muted-foreground",
|
|
477
|
-
children: /* @__PURE__ */ K(
|
|
477
|
+
children: /* @__PURE__ */ K(e, { id: "Product" })
|
|
478
478
|
}),
|
|
479
|
-
/* @__PURE__ */ K(
|
|
479
|
+
/* @__PURE__ */ K(E, {
|
|
480
480
|
className: "text-muted-foreground",
|
|
481
|
-
children: /* @__PURE__ */ K(
|
|
481
|
+
children: /* @__PURE__ */ K(e, { id: "Key" })
|
|
482
482
|
}),
|
|
483
|
-
/* @__PURE__ */ K(
|
|
483
|
+
/* @__PURE__ */ K(E, {
|
|
484
484
|
className: "text-muted-foreground",
|
|
485
|
-
children: /* @__PURE__ */ K(
|
|
485
|
+
children: /* @__PURE__ */ K(e, { id: "Tier" })
|
|
486
486
|
}),
|
|
487
|
-
/* @__PURE__ */ K(
|
|
487
|
+
/* @__PURE__ */ K(E, {
|
|
488
488
|
className: "text-muted-foreground",
|
|
489
|
-
children: /* @__PURE__ */ K(
|
|
489
|
+
children: /* @__PURE__ */ K(e, { id: "Entitlements" })
|
|
490
490
|
}),
|
|
491
|
-
/* @__PURE__ */ K(
|
|
491
|
+
/* @__PURE__ */ K(E, {
|
|
492
492
|
className: "text-muted-foreground",
|
|
493
|
-
children: /* @__PURE__ */ K(
|
|
493
|
+
children: /* @__PURE__ */ K(e, { id: "State" })
|
|
494
494
|
}),
|
|
495
|
-
/* @__PURE__ */ K(
|
|
495
|
+
/* @__PURE__ */ K(E, {})
|
|
496
496
|
]
|
|
497
|
-
}) }), /* @__PURE__ */ q(
|
|
497
|
+
}) }), /* @__PURE__ */ q(D, { children: [(a?.data ?? []).map((e) => /* @__PURE__ */ K(Oe, { product: e }, e.id)), !a?.data?.length && /* @__PURE__ */ K(A, { children: /* @__PURE__ */ K(k, {
|
|
498
498
|
colSpan: 6,
|
|
499
499
|
className: "h-24 text-center text-muted-foreground",
|
|
500
|
-
children: /* @__PURE__ */ K(
|
|
500
|
+
children: /* @__PURE__ */ K(e, { id: "No products yet." })
|
|
501
501
|
}) })] })] })
|
|
502
502
|
}),
|
|
503
|
-
/* @__PURE__ */ K(
|
|
503
|
+
/* @__PURE__ */ K(T, {
|
|
504
504
|
pages: i,
|
|
505
505
|
rows: a?.data?.length ?? 0,
|
|
506
506
|
nextCursor: a?.next_cursor,
|
|
@@ -514,52 +514,52 @@ function De() {
|
|
|
514
514
|
]
|
|
515
515
|
});
|
|
516
516
|
}
|
|
517
|
-
function Oe({ product:
|
|
518
|
-
let { toast:
|
|
519
|
-
return /* @__PURE__ */ q(
|
|
520
|
-
className:
|
|
517
|
+
function Oe({ product: t }) {
|
|
518
|
+
let { toast: r, toastApiError: i, adminMutations: o } = n(), s = H.useContext(X), c = G(), l = U(o.setProductActive(c));
|
|
519
|
+
return /* @__PURE__ */ q(A, {
|
|
520
|
+
className: t.archived ? "opacity-60" : void 0,
|
|
521
521
|
children: [
|
|
522
|
-
/* @__PURE__ */ K(
|
|
522
|
+
/* @__PURE__ */ K(k, {
|
|
523
523
|
className: "font-medium",
|
|
524
|
-
children:
|
|
524
|
+
children: t.display_name
|
|
525
525
|
}),
|
|
526
|
-
/* @__PURE__ */ K(
|
|
526
|
+
/* @__PURE__ */ K(k, {
|
|
527
527
|
className: "text-xs text-muted-foreground",
|
|
528
|
-
children:
|
|
528
|
+
children: t.key
|
|
529
529
|
}),
|
|
530
|
-
/* @__PURE__ */ K(
|
|
531
|
-
/* @__PURE__ */ K(
|
|
530
|
+
/* @__PURE__ */ K(k, { children: t.tier_group ? `${t.tier_group} #${t.tier_rank}` : "—" }),
|
|
531
|
+
/* @__PURE__ */ K(k, { children: /* @__PURE__ */ K("span", {
|
|
532
532
|
className: "flex flex-wrap gap-1",
|
|
533
|
-
children:
|
|
533
|
+
children: t.entitlements.map((e) => /* @__PURE__ */ K(g, {
|
|
534
534
|
variant: "secondary",
|
|
535
535
|
className: "text-[10px]",
|
|
536
536
|
children: e
|
|
537
537
|
}, e))
|
|
538
538
|
}) }),
|
|
539
|
-
/* @__PURE__ */ K(
|
|
539
|
+
/* @__PURE__ */ K(k, { children: t.archived ? /* @__PURE__ */ K(g, {
|
|
540
540
|
variant: "secondary",
|
|
541
|
-
children: /* @__PURE__ */ K(
|
|
542
|
-
}) : /* @__PURE__ */ K(
|
|
543
|
-
/* @__PURE__ */ K(
|
|
541
|
+
children: /* @__PURE__ */ K(e, { id: "archived" })
|
|
542
|
+
}) : /* @__PURE__ */ K(_, { status: "active" }) }),
|
|
543
|
+
/* @__PURE__ */ K(k, {
|
|
544
544
|
className: "text-right",
|
|
545
545
|
children: s && /* @__PURE__ */ q("div", {
|
|
546
546
|
className: "flex justify-end gap-2",
|
|
547
|
-
children: [s && /* @__PURE__ */ K(ke, { product:
|
|
547
|
+
children: [s && /* @__PURE__ */ K(ke, { product: t }), /* @__PURE__ */ K(a, {
|
|
548
548
|
variant: "outline",
|
|
549
549
|
size: "sm",
|
|
550
550
|
disabled: !s || l.isPending,
|
|
551
551
|
onClick: async () => {
|
|
552
552
|
try {
|
|
553
553
|
await l.mutateAsync({
|
|
554
|
-
id:
|
|
555
|
-
active:
|
|
556
|
-
revision:
|
|
557
|
-
}),
|
|
554
|
+
id: t.id,
|
|
555
|
+
active: t.archived,
|
|
556
|
+
revision: t.revision
|
|
557
|
+
}), r.success(t.archived ? "Product activated" : "Product deactivated");
|
|
558
558
|
} catch (e) {
|
|
559
559
|
i(e, "Toggle product");
|
|
560
560
|
}
|
|
561
561
|
},
|
|
562
|
-
children:
|
|
562
|
+
children: t.archived ? "Activate" : "Deactivate"
|
|
563
563
|
})]
|
|
564
564
|
})
|
|
565
565
|
})
|
|
@@ -576,61 +576,61 @@ function Z(e) {
|
|
|
576
576
|
entitlements: (e?.entitlements ?? []).join(",")
|
|
577
577
|
};
|
|
578
578
|
}
|
|
579
|
-
function ke({ product:
|
|
580
|
-
let { toast: i, toastApiError: s, adminMutations: c } =
|
|
581
|
-
defaultValues: Z(
|
|
582
|
-
onSubmit: async ({ value:
|
|
583
|
-
let
|
|
579
|
+
function ke({ product: r }) {
|
|
580
|
+
let { toast: i, toastApiError: s, adminMutations: c } = n(), { text: l, id: u } = t(), [d, f] = H.useState(!1), p = G(), m = U(c.createProduct(p)), h = U(c.updateProduct(p)), g = Y({
|
|
581
|
+
defaultValues: Z(r),
|
|
582
|
+
onSubmit: async ({ value: e }) => {
|
|
583
|
+
let t = e.entitlements.split(",").map((e) => e.trim()).filter(Boolean);
|
|
584
584
|
try {
|
|
585
|
-
|
|
586
|
-
id:
|
|
585
|
+
r ? (await h.mutateAsync({
|
|
586
|
+
id: r.id,
|
|
587
587
|
product: {
|
|
588
|
-
display_name:
|
|
589
|
-
description:
|
|
590
|
-
tier_group:
|
|
591
|
-
tier_rank: Number(
|
|
592
|
-
entitlements:
|
|
593
|
-
expected_revision:
|
|
588
|
+
display_name: e.name,
|
|
589
|
+
description: e.description,
|
|
590
|
+
tier_group: e.tierGroup || null,
|
|
591
|
+
tier_rank: Number(e.tierRank) || 0,
|
|
592
|
+
entitlements: t,
|
|
593
|
+
expected_revision: r.revision
|
|
594
594
|
}
|
|
595
595
|
}), i.success("Product updated")) : (await m.mutateAsync({
|
|
596
|
-
key:
|
|
597
|
-
display_name:
|
|
598
|
-
description:
|
|
599
|
-
tier_group:
|
|
600
|
-
tier_rank: Number(
|
|
601
|
-
entitlements:
|
|
602
|
-
}), i.success("Product created")),
|
|
603
|
-
} catch (
|
|
604
|
-
s(
|
|
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: t
|
|
602
|
+
}), i.success("Product created")), g.reset(e), f(!1);
|
|
603
|
+
} catch (e) {
|
|
604
|
+
s(e, r ? "Update product" : "Create product");
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
607
|
});
|
|
608
|
-
return /* @__PURE__ */ q(
|
|
608
|
+
return /* @__PURE__ */ q(R, {
|
|
609
609
|
open: d,
|
|
610
|
-
onOpenChange: (
|
|
611
|
-
|
|
610
|
+
onOpenChange: (e) => {
|
|
611
|
+
e && g.reset(Z(r)), f(e);
|
|
612
612
|
},
|
|
613
|
-
children: [/* @__PURE__ */ K(
|
|
613
|
+
children: [/* @__PURE__ */ K(L, { render: r ? /* @__PURE__ */ K(a, {
|
|
614
614
|
variant: "outline",
|
|
615
615
|
size: "sm",
|
|
616
|
-
children: /* @__PURE__ */ K(
|
|
616
|
+
children: /* @__PURE__ */ K(e, { id: "Edit" })
|
|
617
617
|
}) : /* @__PURE__ */ q(a, {
|
|
618
618
|
size: "sm",
|
|
619
619
|
children: [/* @__PURE__ */ K(J, {
|
|
620
620
|
icon: de,
|
|
621
621
|
className: "size-4"
|
|
622
|
-
}), /* @__PURE__ */ K(
|
|
623
|
-
}) }), /* @__PURE__ */ q(
|
|
624
|
-
className:
|
|
625
|
-
children: [/* @__PURE__ */ q(
|
|
622
|
+
}), /* @__PURE__ */ K(e, { id: " Product" })]
|
|
623
|
+
}) }), /* @__PURE__ */ q(P, {
|
|
624
|
+
className: B,
|
|
625
|
+
children: [/* @__PURE__ */ q(M, { children: [/* @__PURE__ */ K(F, { children: r ? "Edit product" : "New product" }), /* @__PURE__ */ K(I, { children: /* @__PURE__ */ K(e, { 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
626
|
onSubmit: (e) => {
|
|
627
|
-
e.preventDefault(), e.stopPropagation(),
|
|
627
|
+
e.preventDefault(), e.stopPropagation(), g.handleSubmit();
|
|
628
628
|
},
|
|
629
629
|
className: "grid gap-4",
|
|
630
630
|
children: [/* @__PURE__ */ q("div", {
|
|
631
631
|
className: "grid gap-3",
|
|
632
632
|
children: [
|
|
633
|
-
!
|
|
633
|
+
!r && /* @__PURE__ */ K(g.Field, {
|
|
634
634
|
name: "key",
|
|
635
635
|
validators: { onBlur: ({ value: e }) => e.trim() ? void 0 : "Enter a product key" },
|
|
636
636
|
children: (e) => /* @__PURE__ */ q($, {
|
|
@@ -644,10 +644,10 @@ function ke({ product: e }) {
|
|
|
644
644
|
onChange: (t) => e.handleChange(t.target.value),
|
|
645
645
|
placeholder: l("premium-monthly"),
|
|
646
646
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
647
|
-
}), /* @__PURE__ */ K(
|
|
647
|
+
}), /* @__PURE__ */ K(v, { errors: e.state.meta.errors })]
|
|
648
648
|
})
|
|
649
649
|
}),
|
|
650
|
-
/* @__PURE__ */ K(
|
|
650
|
+
/* @__PURE__ */ K(g.Field, {
|
|
651
651
|
name: "name",
|
|
652
652
|
validators: { onBlur: ({ value: e }) => e.trim() ? void 0 : "Enter a display name" },
|
|
653
653
|
children: (e) => /* @__PURE__ */ q($, {
|
|
@@ -660,10 +660,10 @@ function ke({ product: e }) {
|
|
|
660
660
|
onBlur: e.handleBlur,
|
|
661
661
|
onChange: (t) => e.handleChange(t.target.value),
|
|
662
662
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
663
|
-
}), /* @__PURE__ */ K(
|
|
663
|
+
}), /* @__PURE__ */ K(v, { errors: e.state.meta.errors })]
|
|
664
664
|
})
|
|
665
665
|
}),
|
|
666
|
-
/* @__PURE__ */ K(
|
|
666
|
+
/* @__PURE__ */ K(g.Field, {
|
|
667
667
|
name: "description",
|
|
668
668
|
children: (e) => /* @__PURE__ */ K($, {
|
|
669
669
|
label: l("Description"),
|
|
@@ -678,7 +678,7 @@ function ke({ product: e }) {
|
|
|
678
678
|
}),
|
|
679
679
|
/* @__PURE__ */ q("div", {
|
|
680
680
|
className: "grid grid-cols-2 gap-3",
|
|
681
|
-
children: [/* @__PURE__ */ K(
|
|
681
|
+
children: [/* @__PURE__ */ K(g.Field, {
|
|
682
682
|
name: "tierGroup",
|
|
683
683
|
children: (e) => /* @__PURE__ */ K($, {
|
|
684
684
|
label: l("Tier group"),
|
|
@@ -691,7 +691,7 @@ function ke({ product: e }) {
|
|
|
691
691
|
onChange: (t) => e.handleChange(t.target.value)
|
|
692
692
|
})
|
|
693
693
|
})
|
|
694
|
-
}), /* @__PURE__ */ K(
|
|
694
|
+
}), /* @__PURE__ */ K(g.Field, {
|
|
695
695
|
name: "tierRank",
|
|
696
696
|
children: (e) => /* @__PURE__ */ K($, {
|
|
697
697
|
label: l("Tier rank"),
|
|
@@ -707,7 +707,7 @@ function ke({ product: e }) {
|
|
|
707
707
|
})
|
|
708
708
|
})]
|
|
709
709
|
}),
|
|
710
|
-
/* @__PURE__ */ K(
|
|
710
|
+
/* @__PURE__ */ K(g.Field, {
|
|
711
711
|
name: "entitlements",
|
|
712
712
|
children: (e) => /* @__PURE__ */ K($, {
|
|
713
713
|
label: l("Entitlements"),
|
|
@@ -723,21 +723,21 @@ function ke({ product: e }) {
|
|
|
723
723
|
})
|
|
724
724
|
})
|
|
725
725
|
]
|
|
726
|
-
}), /* @__PURE__ */ K(
|
|
726
|
+
}), /* @__PURE__ */ K(N, { children: /* @__PURE__ */ K(g.Subscribe, {
|
|
727
727
|
selector: (e) => [
|
|
728
728
|
e.values.key,
|
|
729
729
|
e.values.name,
|
|
730
730
|
e.isSubmitting
|
|
731
731
|
],
|
|
732
|
-
children: ([t,
|
|
732
|
+
children: ([t, n, i]) => /* @__PURE__ */ q(ue, { children: [/* @__PURE__ */ K(a, {
|
|
733
733
|
type: "button",
|
|
734
734
|
variant: "outline",
|
|
735
735
|
disabled: i,
|
|
736
736
|
onClick: () => f(!1),
|
|
737
|
-
children: /* @__PURE__ */ K(
|
|
737
|
+
children: /* @__PURE__ */ K(e, { id: "Cancel" })
|
|
738
738
|
}), /* @__PURE__ */ K(a, {
|
|
739
739
|
type: "submit",
|
|
740
|
-
disabled: i || !
|
|
740
|
+
disabled: i || !n.trim() || !r && !t.trim(),
|
|
741
741
|
children: i ? "Saving…" : "Save product"
|
|
742
742
|
})] })
|
|
743
743
|
}) })]
|
|
@@ -746,7 +746,7 @@ function ke({ product: e }) {
|
|
|
746
746
|
});
|
|
747
747
|
}
|
|
748
748
|
function Ae() {
|
|
749
|
-
let { adminQueries:
|
|
749
|
+
let { adminQueries: t } = n(), r = H.useContext(X), i = w("", Ee), { data: a } = W(t.allProducts({ errorAction: "Load products" })), { data: o, isPending: c, isFetching: l } = W(t.prices({
|
|
750
750
|
limit: i.size,
|
|
751
751
|
cursor: i.cursor,
|
|
752
752
|
errorAction: "Load prices"
|
|
@@ -756,52 +756,52 @@ function Ae() {
|
|
|
756
756
|
children: [
|
|
757
757
|
/* @__PURE__ */ K("div", {
|
|
758
758
|
className: "flex justify-end",
|
|
759
|
-
children:
|
|
759
|
+
children: r && /* @__PURE__ */ K(Me, { products: a?.data ?? [] })
|
|
760
760
|
}),
|
|
761
761
|
c ? /* @__PURE__ */ K("div", {
|
|
762
762
|
className: "flex flex-col gap-3 py-2",
|
|
763
763
|
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ K(s, { className: "h-6 w-full" }, t))
|
|
764
764
|
}) : /* @__PURE__ */ K("div", {
|
|
765
765
|
className: "overflow-x-auto",
|
|
766
|
-
children: /* @__PURE__ */ q(
|
|
766
|
+
children: /* @__PURE__ */ q(j, { children: [/* @__PURE__ */ K(O, { children: /* @__PURE__ */ q(A, {
|
|
767
767
|
className: "hover:bg-transparent",
|
|
768
768
|
children: [
|
|
769
|
-
/* @__PURE__ */ K(
|
|
769
|
+
/* @__PURE__ */ K(E, {
|
|
770
770
|
className: "text-muted-foreground",
|
|
771
|
-
children: /* @__PURE__ */ K(
|
|
771
|
+
children: /* @__PURE__ */ K(e, { id: "Price" })
|
|
772
772
|
}),
|
|
773
|
-
/* @__PURE__ */ K(
|
|
773
|
+
/* @__PURE__ */ K(E, {
|
|
774
774
|
className: "text-muted-foreground",
|
|
775
|
-
children: /* @__PURE__ */ K(
|
|
775
|
+
children: /* @__PURE__ */ K(e, { id: "Product" })
|
|
776
776
|
}),
|
|
777
|
-
/* @__PURE__ */ K(
|
|
777
|
+
/* @__PURE__ */ K(E, {
|
|
778
778
|
className: "text-muted-foreground",
|
|
779
|
-
children: /* @__PURE__ */ K(
|
|
779
|
+
children: /* @__PURE__ */ K(e, { id: "Amount" })
|
|
780
780
|
}),
|
|
781
|
-
/* @__PURE__ */ K(
|
|
781
|
+
/* @__PURE__ */ K(E, {
|
|
782
782
|
className: "text-muted-foreground",
|
|
783
|
-
children: /* @__PURE__ */ K(
|
|
783
|
+
children: /* @__PURE__ */ K(e, { id: "Renews" })
|
|
784
784
|
}),
|
|
785
|
-
/* @__PURE__ */ K(
|
|
785
|
+
/* @__PURE__ */ K(E, {
|
|
786
786
|
className: "text-muted-foreground",
|
|
787
|
-
children: /* @__PURE__ */ K(
|
|
787
|
+
children: /* @__PURE__ */ K(e, { id: "Providers" })
|
|
788
788
|
}),
|
|
789
|
-
/* @__PURE__ */ K(
|
|
789
|
+
/* @__PURE__ */ K(E, {
|
|
790
790
|
className: "text-muted-foreground",
|
|
791
|
-
children: /* @__PURE__ */ K(
|
|
791
|
+
children: /* @__PURE__ */ K(e, { id: "State" })
|
|
792
792
|
}),
|
|
793
|
-
/* @__PURE__ */ K(
|
|
793
|
+
/* @__PURE__ */ K(E, {})
|
|
794
794
|
]
|
|
795
|
-
}) }), /* @__PURE__ */ q(
|
|
795
|
+
}) }), /* @__PURE__ */ q(D, { children: [(o?.data ?? []).map((e) => /* @__PURE__ */ K(je, {
|
|
796
796
|
price: e,
|
|
797
797
|
product: a?.data.find((t) => t.id === e.product_id)
|
|
798
|
-
}, e.id)), !o?.data?.length && /* @__PURE__ */ K(
|
|
798
|
+
}, e.id)), !o?.data?.length && /* @__PURE__ */ K(A, { children: /* @__PURE__ */ K(k, {
|
|
799
799
|
colSpan: 7,
|
|
800
800
|
className: "h-24 text-center text-muted-foreground",
|
|
801
|
-
children: /* @__PURE__ */ K(
|
|
801
|
+
children: /* @__PURE__ */ K(e, { id: "No prices yet." })
|
|
802
802
|
}) })] })] })
|
|
803
803
|
}),
|
|
804
|
-
/* @__PURE__ */ K(
|
|
804
|
+
/* @__PURE__ */ K(T, {
|
|
805
805
|
pages: i,
|
|
806
806
|
rows: o?.data?.length ?? 0,
|
|
807
807
|
nextCursor: o?.next_cursor,
|
|
@@ -815,51 +815,51 @@ function Ae() {
|
|
|
815
815
|
]
|
|
816
816
|
});
|
|
817
817
|
}
|
|
818
|
-
function je({ price:
|
|
819
|
-
let { toast: o, toastApiError: s, adminMutations: c } =
|
|
818
|
+
function je({ price: t, product: i }) {
|
|
819
|
+
let { toast: o, toastApiError: s, adminMutations: c } = n(), l = i?.display_name ?? h(t.product_id, 13), u = H.useContext(X), d = G(), f = U(c.setPriceActive(d));
|
|
820
820
|
return /* @__PURE__ */ q(ee, {
|
|
821
|
-
to: `/catalog/prices/${encodeURIComponent(
|
|
822
|
-
className:
|
|
821
|
+
to: `/catalog/prices/${encodeURIComponent(t.id)}`,
|
|
822
|
+
className: t.archived ? "opacity-60" : void 0,
|
|
823
823
|
children: [
|
|
824
|
-
/* @__PURE__ */ K(
|
|
824
|
+
/* @__PURE__ */ K(k, {
|
|
825
825
|
className: "text-xs text-muted-foreground",
|
|
826
|
-
children: /* @__PURE__ */ K(
|
|
826
|
+
children: /* @__PURE__ */ K(r, {
|
|
827
827
|
className: "underline-offset-2 hover:underline",
|
|
828
|
-
to: `/catalog/prices/${encodeURIComponent(
|
|
829
|
-
children:
|
|
828
|
+
to: `/catalog/prices/${encodeURIComponent(t.id)}`,
|
|
829
|
+
children: t.id
|
|
830
830
|
})
|
|
831
831
|
}),
|
|
832
|
-
/* @__PURE__ */ K(
|
|
832
|
+
/* @__PURE__ */ K(k, {
|
|
833
833
|
className: "font-medium",
|
|
834
834
|
children: l
|
|
835
835
|
}),
|
|
836
|
-
/* @__PURE__ */ K(
|
|
836
|
+
/* @__PURE__ */ K(k, {
|
|
837
837
|
className: "tabular-nums",
|
|
838
|
-
children:
|
|
838
|
+
children: ae(t)
|
|
839
839
|
}),
|
|
840
|
-
/* @__PURE__ */ K(
|
|
841
|
-
/* @__PURE__ */ K(
|
|
840
|
+
/* @__PURE__ */ K(k, { children: re(t) }),
|
|
841
|
+
/* @__PURE__ */ K(k, { children: /* @__PURE__ */ K("span", {
|
|
842
842
|
className: "flex flex-wrap gap-1",
|
|
843
|
-
children:
|
|
843
|
+
children: t.provider ? /* @__PURE__ */ q(g, {
|
|
844
844
|
variant: "secondary",
|
|
845
|
-
children: [
|
|
846
|
-
}) : (
|
|
845
|
+
children: [t.provider.psp, /* @__PURE__ */ K(e, { id: "'s price" })]
|
|
846
|
+
}) : (t.sell_via ?? []).map((e) => /* @__PURE__ */ K(g, {
|
|
847
847
|
variant: "secondary",
|
|
848
848
|
children: e
|
|
849
849
|
}, e))
|
|
850
850
|
}) }),
|
|
851
|
-
/* @__PURE__ */ K(
|
|
851
|
+
/* @__PURE__ */ K(k, { children: t.archived ? /* @__PURE__ */ K(g, {
|
|
852
852
|
variant: "secondary",
|
|
853
|
-
children: /* @__PURE__ */ K(
|
|
854
|
-
}) : /* @__PURE__ */ K(
|
|
855
|
-
/* @__PURE__ */ K(
|
|
853
|
+
children: /* @__PURE__ */ K(e, { id: "archived" })
|
|
854
|
+
}) : /* @__PURE__ */ K(_, { status: "active" }) }),
|
|
855
|
+
/* @__PURE__ */ K(k, {
|
|
856
856
|
className: "text-right",
|
|
857
857
|
children: u && /* @__PURE__ */ q("div", {
|
|
858
858
|
className: "flex justify-end gap-2",
|
|
859
|
-
children: [u && /* @__PURE__ */ K(
|
|
860
|
-
price:
|
|
859
|
+
children: [u && /* @__PURE__ */ K(le, {
|
|
860
|
+
price: t,
|
|
861
861
|
productName: l,
|
|
862
|
-
productKey:
|
|
862
|
+
productKey: i?.key
|
|
863
863
|
}), /* @__PURE__ */ K(a, {
|
|
864
864
|
variant: "outline",
|
|
865
865
|
size: "sm",
|
|
@@ -867,24 +867,24 @@ function je({ price: e, product: t }) {
|
|
|
867
867
|
onClick: async () => {
|
|
868
868
|
try {
|
|
869
869
|
await f.mutateAsync({
|
|
870
|
-
id:
|
|
871
|
-
active:
|
|
872
|
-
revision:
|
|
873
|
-
}), o.success(
|
|
870
|
+
id: t.id,
|
|
871
|
+
active: t.archived,
|
|
872
|
+
revision: t.revision
|
|
873
|
+
}), o.success(t.archived ? "Price activated" : "Price deactivated");
|
|
874
874
|
} catch (e) {
|
|
875
875
|
s(e, "Toggle price");
|
|
876
876
|
}
|
|
877
877
|
},
|
|
878
|
-
children:
|
|
878
|
+
children: t.archived ? "Activate" : "Deactivate"
|
|
879
879
|
})]
|
|
880
880
|
})
|
|
881
881
|
})
|
|
882
882
|
]
|
|
883
883
|
});
|
|
884
884
|
}
|
|
885
|
-
var Q = ({ value: e }) => !e ||
|
|
886
|
-
function Me({ products:
|
|
887
|
-
let { toast: i, toastApiError: s, adminMutations: c } =
|
|
885
|
+
var Q = ({ value: e }) => !e || V(e) ? void 0 : "Use hours, days or weeks, such as 30 days";
|
|
886
|
+
function Me({ products: r }) {
|
|
887
|
+
let { toast: i, toastApiError: s, adminMutations: c } = n(), { text: l, id: p } = t(), [m, h] = H.useState(!1), g = G(), _ = U(c.createPrice(g)), w = Y({
|
|
888
888
|
defaultValues: {
|
|
889
889
|
productId: "",
|
|
890
890
|
amount: "",
|
|
@@ -895,9 +895,9 @@ function Me({ products: e }) {
|
|
|
895
895
|
onSubmit: async ({ value: e }) => {
|
|
896
896
|
let t = u(e.amount, e.currency);
|
|
897
897
|
if (t === null || BigInt(t) <= 0n) return;
|
|
898
|
-
let n =
|
|
898
|
+
let n = V(e.accessDuration), r = V(e.billingInterval);
|
|
899
899
|
if (!(e.accessDuration && !n || e.billingInterval && !r)) try {
|
|
900
|
-
await
|
|
900
|
+
await _.mutateAsync({
|
|
901
901
|
product_id: e.productId,
|
|
902
902
|
unit_amount: t,
|
|
903
903
|
currency: e.currency,
|
|
@@ -911,18 +911,18 @@ function Me({ products: e }) {
|
|
|
911
911
|
}), T = (e) => {
|
|
912
912
|
e && w.reset(), h(e);
|
|
913
913
|
};
|
|
914
|
-
return /* @__PURE__ */ q(
|
|
914
|
+
return /* @__PURE__ */ q(R, {
|
|
915
915
|
open: m,
|
|
916
916
|
onOpenChange: T,
|
|
917
|
-
children: [/* @__PURE__ */ K(
|
|
917
|
+
children: [/* @__PURE__ */ K(L, { render: /* @__PURE__ */ q(a, {
|
|
918
918
|
size: "sm",
|
|
919
919
|
children: [/* @__PURE__ */ K(J, {
|
|
920
920
|
icon: de,
|
|
921
921
|
className: "size-4"
|
|
922
|
-
}), /* @__PURE__ */ K(
|
|
923
|
-
}) }), /* @__PURE__ */ q(
|
|
924
|
-
className:
|
|
925
|
-
children: [/* @__PURE__ */ q(
|
|
922
|
+
}), /* @__PURE__ */ K(e, { id: " Price" })]
|
|
923
|
+
}) }), /* @__PURE__ */ q(P, {
|
|
924
|
+
className: B,
|
|
925
|
+
children: [/* @__PURE__ */ q(M, { children: [/* @__PURE__ */ K(F, { children: /* @__PURE__ */ K(e, { id: "New price" }) }), /* @__PURE__ */ K(I, { children: /* @__PURE__ */ K(e, { id: "These terms cannot be changed later. To charge a different amount, create another price and deactivate this one." }) })] }), /* @__PURE__ */ q("form", {
|
|
926
926
|
onSubmit: (e) => {
|
|
927
927
|
e.preventDefault(), e.stopPropagation(), w.handleSubmit();
|
|
928
928
|
},
|
|
@@ -932,21 +932,21 @@ function Me({ products: e }) {
|
|
|
932
932
|
children: [
|
|
933
933
|
/* @__PURE__ */ K(w.Field, {
|
|
934
934
|
name: "productId",
|
|
935
|
-
children: (
|
|
935
|
+
children: (e) => /* @__PURE__ */ K($, {
|
|
936
936
|
label: l("Product"),
|
|
937
937
|
id: "pr-prod",
|
|
938
|
-
children: /* @__PURE__ */ q(
|
|
939
|
-
items:
|
|
938
|
+
children: /* @__PURE__ */ q(C, {
|
|
939
|
+
items: r.map((e) => ({
|
|
940
940
|
value: e.id,
|
|
941
941
|
label: `${e.display_name} (${e.key})`
|
|
942
942
|
})),
|
|
943
|
-
value:
|
|
944
|
-
onValueChange: (
|
|
945
|
-
children: [/* @__PURE__ */ K(
|
|
943
|
+
value: e.state.value || null,
|
|
944
|
+
onValueChange: (t) => e.handleChange(t ?? ""),
|
|
945
|
+
children: [/* @__PURE__ */ K(b, {
|
|
946
946
|
id: p("pr-prod"),
|
|
947
947
|
className: "w-full",
|
|
948
|
-
children: /* @__PURE__ */ K(
|
|
949
|
-
}), /* @__PURE__ */ K(
|
|
948
|
+
children: /* @__PURE__ */ K(y, { placeholder: l("Pick a product…") })
|
|
949
|
+
}), /* @__PURE__ */ K(x, { children: r.map((e) => /* @__PURE__ */ q(S, {
|
|
950
950
|
value: e.id,
|
|
951
951
|
children: [
|
|
952
952
|
e.display_name,
|
|
@@ -981,7 +981,7 @@ function Me({ products: e }) {
|
|
|
981
981
|
onBlur: e.handleBlur,
|
|
982
982
|
onChange: (t) => e.handleChange(t.target.value),
|
|
983
983
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
984
|
-
}), /* @__PURE__ */ K(
|
|
984
|
+
}), /* @__PURE__ */ K(v, { errors: e.state.meta.errors })]
|
|
985
985
|
})
|
|
986
986
|
}), /* @__PURE__ */ K(w.Field, {
|
|
987
987
|
name: "currency",
|
|
@@ -1015,48 +1015,48 @@ function Me({ products: e }) {
|
|
|
1015
1015
|
onBlur: e.handleBlur,
|
|
1016
1016
|
onChange: (t) => e.handleChange(t.target.value),
|
|
1017
1017
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
1018
|
-
}), /* @__PURE__ */ K(
|
|
1018
|
+
}), /* @__PURE__ */ K(v, { errors: e.state.meta.errors })]
|
|
1019
1019
|
})
|
|
1020
1020
|
}),
|
|
1021
1021
|
/* @__PURE__ */ K(w.Field, {
|
|
1022
1022
|
name: "billingInterval",
|
|
1023
1023
|
validators: { onBlur: Q },
|
|
1024
|
-
children: (
|
|
1024
|
+
children: (t) => /* @__PURE__ */ q("div", {
|
|
1025
1025
|
className: "grid gap-3 rounded-md border p-3",
|
|
1026
1026
|
children: [/* @__PURE__ */ q("div", {
|
|
1027
1027
|
className: "flex items-center justify-between gap-4",
|
|
1028
|
-
children: [/* @__PURE__ */ K(
|
|
1028
|
+
children: [/* @__PURE__ */ K(z, {
|
|
1029
1029
|
htmlFor: p("pr-renew"),
|
|
1030
|
-
children: /* @__PURE__ */ K(
|
|
1031
|
-
}), /* @__PURE__ */ K(
|
|
1030
|
+
children: /* @__PURE__ */ K(e, { id: "Recurring billing" })
|
|
1031
|
+
}), /* @__PURE__ */ K(te, {
|
|
1032
1032
|
id: p("pr-renew"),
|
|
1033
|
-
checked: !!
|
|
1034
|
-
onCheckedChange: (
|
|
1033
|
+
checked: !!t.state.value,
|
|
1034
|
+
onCheckedChange: (e) => t.handleChange(e ? "30 days" : "")
|
|
1035
1035
|
})]
|
|
1036
|
-
}),
|
|
1036
|
+
}), t.state.value ? /* @__PURE__ */ q($, {
|
|
1037
1037
|
label: l("Billing interval"),
|
|
1038
1038
|
id: "pr-billing",
|
|
1039
1039
|
hint: "Time between payments, such as 30 days, until the customer cancels.",
|
|
1040
1040
|
children: [/* @__PURE__ */ K(o, {
|
|
1041
1041
|
id: p("pr-billing"),
|
|
1042
1042
|
required: !0,
|
|
1043
|
-
value:
|
|
1044
|
-
onBlur:
|
|
1045
|
-
onChange: (
|
|
1046
|
-
"aria-invalid":
|
|
1047
|
-
}), /* @__PURE__ */ K(
|
|
1043
|
+
value: t.state.value,
|
|
1044
|
+
onBlur: t.handleBlur,
|
|
1045
|
+
onChange: (e) => t.handleChange(e.target.value),
|
|
1046
|
+
"aria-invalid": t.state.meta.errors.length > 0
|
|
1047
|
+
}), /* @__PURE__ */ K(v, { errors: t.state.meta.errors })]
|
|
1048
1048
|
}) : /* @__PURE__ */ K("p", {
|
|
1049
1049
|
className: "text-xs text-muted-foreground",
|
|
1050
|
-
children: /* @__PURE__ */ K(
|
|
1050
|
+
children: /* @__PURE__ */ K(e, { id: "One-time payment." })
|
|
1051
1051
|
})]
|
|
1052
1052
|
})
|
|
1053
1053
|
})
|
|
1054
1054
|
]
|
|
1055
|
-
}), /* @__PURE__ */ q(
|
|
1055
|
+
}), /* @__PURE__ */ q(N, { children: [/* @__PURE__ */ K(a, {
|
|
1056
1056
|
type: "button",
|
|
1057
1057
|
variant: "outline",
|
|
1058
1058
|
onClick: () => T(!1),
|
|
1059
|
-
children: /* @__PURE__ */ K(
|
|
1059
|
+
children: /* @__PURE__ */ K(e, { id: "Cancel" })
|
|
1060
1060
|
}), /* @__PURE__ */ K(w.Subscribe, {
|
|
1061
1061
|
selector: (e) => [
|
|
1062
1062
|
e.values.productId,
|
|
@@ -1081,7 +1081,7 @@ function $({ label: e, id: n, hint: r, children: i }) {
|
|
|
1081
1081
|
return /* @__PURE__ */ q("div", {
|
|
1082
1082
|
className: "grid gap-1.5",
|
|
1083
1083
|
children: [
|
|
1084
|
-
/* @__PURE__ */ K(
|
|
1084
|
+
/* @__PURE__ */ K(z, {
|
|
1085
1085
|
htmlFor: a(n),
|
|
1086
1086
|
children: e
|
|
1087
1087
|
}),
|
|
@@ -1096,4 +1096,4 @@ function $({ label: e, id: n, hint: r, children: i }) {
|
|
|
1096
1096
|
//#endregion
|
|
1097
1097
|
export { Te as CatalogPricesPage, we as CatalogProductsPage };
|
|
1098
1098
|
|
|
1099
|
-
//# sourceMappingURL=admin-catalog-
|
|
1099
|
+
//# sourceMappingURL=admin-catalog-CON-GwKL.js.map
|