@openrails/billing-ui 0.268.2 → 0.269.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/context.d.ts +164 -62
- package/dist/admin/lib/api/endpoints.d.ts +3 -7
- package/dist/admin/lib/api/import-endpoints.d.ts +44 -0
- package/dist/admin/lib/api/index.d.ts +17 -7
- package/dist/admin/lib/api/types.d.ts +0 -29
- package/dist/admin/lib/import-queries.d.ts +66 -0
- package/dist/admin/lib/mutations.d.ts +1 -5
- package/dist/admin/lib/queries.d.ts +6 -20
- package/dist/admin/messages.d.ts +176 -6
- package/dist/admin/pages/catalog/index.d.ts +0 -1
- package/dist/admin/pages/imports/detail.d.ts +2 -0
- package/dist/admin/pages/imports/index.d.ts +2 -0
- package/dist/admin/pages/imports/mapping-csv.d.ts +10 -0
- package/dist/admin/pages/imports/progress.d.ts +21 -0
- package/dist/admin/pages/imports/records.d.ts +2 -0
- package/dist/admin/pages/imports/shared.d.ts +22 -0
- package/dist/admin/pages/parked/index.d.ts +2 -0
- package/dist/admin/pages/proposals/grouping.d.ts +13 -0
- package/dist/admin/pages/proposals/index.d.ts +2 -0
- package/dist/admin/pages/provider-prices/index.d.ts +2 -0
- package/dist/admin/pages/provider-prices/map-dialog.d.ts +11 -0
- package/dist/admin/routes.d.ts +1 -1
- package/dist/{admin-attempts-BLeeKABa.js → admin-attempts-DQTg0UzZ.js} +82 -82
- package/dist/{admin-attempts-BLeeKABa.js.map → admin-attempts-DQTg0UzZ.js.map} +1 -1
- package/dist/{admin-auth-DWVWxDup.js → admin-auth-1aZIgXiS.js} +2 -2
- package/dist/{admin-auth-DWVWxDup.js.map → admin-auth-1aZIgXiS.js.map} +1 -1
- package/dist/{admin-badge-CrEqD9Ew.js → admin-badge-pgG6D9-a.js} +2 -2
- package/dist/{admin-badge-CrEqD9Ew.js.map → admin-badge-pgG6D9-a.js.map} +1 -1
- package/dist/{admin-button-a7bDFgp0.js → admin-button-CrcYk5r0.js} +2 -2
- package/dist/{admin-button-a7bDFgp0.js.map → admin-button-CrcYk5r0.js.map} +1 -1
- package/dist/{admin-capabilities-QYUuJXvG.js → admin-capabilities-BDcZeHL_.js} +2 -2
- package/dist/{admin-capabilities-QYUuJXvG.js.map → admin-capabilities-BDcZeHL_.js.map} +1 -1
- package/dist/{admin-card-D1tz8Lbh.js → admin-card-DvTMc5Se.js} +2 -2
- package/dist/{admin-card-D1tz8Lbh.js.map → admin-card-DvTMc5Se.js.map} +1 -1
- package/dist/{admin-catalog-ggiDgWsR.js → admin-catalog-BlF5mnu4.js} +285 -382
- package/dist/admin-catalog-BlF5mnu4.js.map +1 -0
- package/dist/{admin-dom-VkcwevWr.js → admin-cursor-pager-CIb3Jw2F.js} +20 -25
- package/dist/admin-cursor-pager-CIb3Jw2F.js.map +1 -0
- package/dist/{admin-customers-BVMg-gUv.js → admin-customers-EpfoWDh-.js} +13 -13
- package/dist/{admin-customers-BVMg-gUv.js.map → admin-customers-EpfoWDh-.js.map} +1 -1
- package/dist/{admin-dashboard-Cc13i8i9.js → admin-dashboard-CJE63yz4.js} +46 -46
- package/dist/{admin-dashboard-Cc13i8i9.js.map → admin-dashboard-CJE63yz4.js.map} +1 -1
- package/dist/{admin-data-table-BL84xKKF.js → admin-data-table-hvFcJepL.js} +16 -16
- package/dist/{admin-data-table-BL84xKKF.js.map → admin-data-table-hvFcJepL.js.map} +1 -1
- package/dist/{admin-detail-CaEwBdX9.js → admin-detail-BRP6pL7t.js} +51 -51
- package/dist/{admin-detail-CaEwBdX9.js.map → admin-detail-BRP6pL7t.js.map} +1 -1
- package/dist/{admin-detail-9YAep3ts.js → admin-detail-CRzFb_pa.js} +232 -232
- package/dist/{admin-detail-9YAep3ts.js.map → admin-detail-CRzFb_pa.js.map} +1 -1
- package/dist/admin-detail-Ceod8AXy.js +299 -0
- package/dist/admin-detail-Ceod8AXy.js.map +1 -0
- package/dist/{admin-detail-C8t5jBps.js → admin-detail-QLxU8r-5.js} +62 -62
- package/dist/{admin-detail-C8t5jBps.js.map → admin-detail-QLxU8r-5.js.map} +1 -1
- package/dist/admin-detail-pPC8Q9l-.js +710 -0
- package/dist/{admin-detail-D2zcz_Xm.js.map → admin-detail-pPC8Q9l-.js.map} +1 -1
- package/dist/{admin-dialog-CiAw5vx-.js → admin-dialog-BSRf9Zre.js} +24 -24
- package/dist/{admin-dialog-CiAw5vx-.js.map → admin-dialog-BSRf9Zre.js.map} +1 -1
- package/dist/admin-dom-C7Y7A6Wa.js +8 -0
- package/dist/admin-dom-C7Y7A6Wa.js.map +1 -0
- package/dist/{admin-dropdown-menu-CYJbmqK2.js → admin-dropdown-menu-D0E5rwmn.js} +2 -2
- package/dist/{admin-dropdown-menu-CYJbmqK2.js.map → admin-dropdown-menu-D0E5rwmn.js.map} +1 -1
- package/dist/{admin-fact-card-BHTpDlaX.js → admin-fact-card-BPSVhS15.js} +2 -2
- package/dist/{admin-fact-card-BHTpDlaX.js.map → admin-fact-card-BPSVhS15.js.map} +1 -1
- package/dist/{admin-health-BUnjbvYR.js → admin-health-D0L5Kig7.js} +84 -84
- package/dist/{admin-health-BUnjbvYR.js.map → admin-health-D0L5Kig7.js.map} +1 -1
- package/dist/admin-imports-TCOljTgw.js +269 -0
- package/dist/admin-imports-TCOljTgw.js.map +1 -0
- package/dist/{admin-input-C-S_RGGo.js → admin-input-DJAK9nmk.js} +2 -2
- package/dist/{admin-input-C-S_RGGo.js.map → admin-input-DJAK9nmk.js.map} +1 -1
- package/dist/{admin-label-DPVYDdSO.js → admin-label-aviN9Gng.js} +2 -2
- package/dist/{admin-label-DPVYDdSO.js.map → admin-label-aviN9Gng.js.map} +1 -1
- package/dist/{admin-linked-table-row-D-gbTT7a.js → admin-linked-table-row-BGr7JXeM.js} +6 -6
- package/dist/{admin-linked-table-row-D-gbTT7a.js.map → admin-linked-table-row-BGr7JXeM.js.map} +1 -1
- package/dist/admin-map-dialog-DpGaIq52.js +135 -0
- package/dist/admin-map-dialog-DpGaIq52.js.map +1 -0
- package/dist/admin-mapping-csv-FtkyTBmk.js +56 -0
- package/dist/admin-mapping-csv-FtkyTBmk.js.map +1 -0
- package/dist/{admin-metering-BjbL0jjT.js → admin-metering-D-e-37Jn.js} +285 -285
- package/dist/{admin-metering-BjbL0jjT.js.map → admin-metering-D-e-37Jn.js.map} +1 -1
- package/dist/admin-ops-CQP4TzWM.js +235 -0
- package/dist/admin-ops-CQP4TzWM.js.map +1 -0
- package/dist/{admin-orders-BVW9-Fs9.js → admin-orders-BJ7W5S8P.js} +32 -32
- package/dist/{admin-orders-BVW9-Fs9.js.map → admin-orders-BJ7W5S8P.js.map} +1 -1
- package/dist/admin-parked-7HL8mOjw.js +193 -0
- package/dist/admin-parked-7HL8mOjw.js.map +1 -0
- package/dist/{admin-payments-C5MsFFmm.js → admin-payments-CzkzqYA1.js} +17 -17
- package/dist/{admin-payments-C5MsFFmm.js.map → admin-payments-CzkzqYA1.js.map} +1 -1
- package/dist/{admin-price-detail-D517JYHB.js → admin-price-detail-CSI5oKdb.js} +74 -74
- package/dist/{admin-price-detail-D517JYHB.js.map → admin-price-detail-CSI5oKdb.js.map} +1 -1
- package/dist/{admin-price-wizard-bj36o3ux.js → admin-price-wizard-CBEcNGvP.js} +38 -38
- package/dist/{admin-price-wizard-bj36o3ux.js.map → admin-price-wizard-CBEcNGvP.js.map} +1 -1
- package/dist/admin-proposals-dtgijWKz.js +375 -0
- package/dist/admin-proposals-dtgijWKz.js.map +1 -0
- package/dist/admin-provider-prices-ChuponcZ.js +246 -0
- package/dist/admin-provider-prices-ChuponcZ.js.map +1 -0
- package/dist/{admin-range-picker-D2aFF8IV.js → admin-range-picker-De36L-AP.js} +12 -12
- package/dist/{admin-range-picker-D2aFF8IV.js.map → admin-range-picker-De36L-AP.js.map} +1 -1
- package/dist/admin-records-CUHUOXAU.js +391 -0
- package/dist/admin-records-CUHUOXAU.js.map +1 -0
- package/dist/{admin-reports-D-ob04d4.js → admin-reports-BFGS_PWf.js} +45 -45
- package/dist/{admin-reports-D-ob04d4.js.map → admin-reports-BFGS_PWf.js.map} +1 -1
- package/dist/{admin-select-C8O7nx72.js → admin-select-BUcEU5Rg.js} +2 -2
- package/dist/{admin-select-C8O7nx72.js.map → admin-select-BUcEU5Rg.js.map} +1 -1
- package/dist/{admin-settings-Bs6cLcqi.js → admin-settings-DYC-c7mJ.js} +296 -296
- package/dist/{admin-settings-Bs6cLcqi.js.map → admin-settings-DYC-c7mJ.js.map} +1 -1
- package/dist/admin-shared-CzG8Pan3.js +222 -0
- package/dist/admin-shared-CzG8Pan3.js.map +1 -0
- package/dist/{admin-skeleton-wfocg2PJ.js → admin-skeleton-B0yzYY_X.js} +2 -2
- package/dist/{admin-skeleton-wfocg2PJ.js.map → admin-skeleton-B0yzYY_X.js.map} +1 -1
- package/dist/{admin-status-badge-D_gDMrht.js → admin-status-badge-0-K37EfN.js} +7 -2
- package/dist/admin-status-badge-0-K37EfN.js.map +1 -0
- package/dist/{admin-subscriptions-DYR1RGMO.js → admin-subscriptions-CvW-YFs0.js} +74 -74
- package/dist/{admin-subscriptions-DYR1RGMO.js.map → admin-subscriptions-CvW-YFs0.js.map} +1 -1
- package/dist/{admin-switch-F5D0AYjT.js → admin-switch-DDorugaw.js} +2 -2
- package/dist/{admin-switch-F5D0AYjT.js.map → admin-switch-DDorugaw.js.map} +1 -1
- package/dist/{admin-table-nUij5fLc.js → admin-table-BU6Tie69.js} +2 -2
- package/dist/{admin-table-nUij5fLc.js.map → admin-table-BU6Tie69.js.map} +1 -1
- package/dist/{admin-tabs-C3myjKdr.js → admin-tabs-D5lqdVcC.js} +2 -2
- package/dist/{admin-tabs-C3myjKdr.js.map → admin-tabs-D5lqdVcC.js.map} +1 -1
- package/dist/{admin-textarea-v-L-PXIc.js → admin-textarea-Dc6lnEub.js} +2 -2
- package/dist/{admin-textarea-v-L-PXIc.js.map → admin-textarea-Dc6lnEub.js.map} +1 -1
- package/dist/{admin-typed-confirm-dialog-BLgpuikW.js → admin-typed-confirm-dialog-Bk6XxmPb.js} +6 -6
- package/dist/{admin-typed-confirm-dialog-BLgpuikW.js.map → admin-typed-confirm-dialog-Bk6XxmPb.js.map} +1 -1
- package/dist/{admin-utils-6yE4YIVI.js → admin-utils-B9eEBNsR.js} +398 -146
- package/dist/admin-utils-B9eEBNsR.js.map +1 -0
- package/dist/{admin-widget-viz-BiEfckd4.js → admin-widget-viz-8aukE3v_.js} +34 -34
- package/dist/{admin-widget-viz-BiEfckd4.js.map → admin-widget-viz-8aukE3v_.js.map} +1 -1
- package/dist/admin.css +1 -1
- package/dist/admin.js +489 -264
- package/dist/admin.js.map +1 -1
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/routes.d.ts +94 -22
- package/dist/client/generated/wire.d.ts +89 -14
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/dist/admin-catalog-ggiDgWsR.js.map +0 -1
- package/dist/admin-detail-D2zcz_Xm.js +0 -710
- package/dist/admin-dom-VkcwevWr.js.map +0 -1
- package/dist/admin-ops-DT8epiXg.js +0 -217
- package/dist/admin-ops-DT8epiXg.js.map +0 -1
- package/dist/admin-status-badge-D_gDMrht.js.map +0 -1
- package/dist/admin-utils-6yE4YIVI.js.map +0 -1
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as s } from "./admin-button-
|
|
3
|
-
import { t as c } from "./admin-input-
|
|
4
|
-
import { a as l } from "./admin-capabilities-
|
|
5
|
-
import { t as u } from "./admin-auth-
|
|
1
|
+
import { D as e, T as t, c as n, f as r, p as i, r as a, s as o } from "./admin-utils-B9eEBNsR.js";
|
|
2
|
+
import { t as s } from "./admin-button-CrcYk5r0.js";
|
|
3
|
+
import { t as c } from "./admin-input-DJAK9nmk.js";
|
|
4
|
+
import { a as l } from "./admin-capabilities-BDcZeHL_.js";
|
|
5
|
+
import { t as u } from "./admin-auth-1aZIgXiS.js";
|
|
6
6
|
import { a as d, i as f, n as p, o as m, s as h, t as g, u as _ } from "./admin-format-DoohJ7Fg.js";
|
|
7
7
|
import { n as v } from "./admin-confirm-katGq0Qo.js";
|
|
8
8
|
import { t as y } from "./admin-form-field-errors-hbUMIriS.js";
|
|
9
|
-
import { a as b, i as x, n as S, r as C, t as w } from "./admin-select-
|
|
10
|
-
import { n as T,
|
|
11
|
-
import { a as D, n as O, o as k, r as A, s as j, t as M } from "./admin-table-
|
|
12
|
-
import { t as N } from "./admin-linked-table-row-
|
|
13
|
-
import { t as P } from "./admin-badge-
|
|
14
|
-
import { t as F } from "./admin-status-badge-
|
|
15
|
-
import { a as I, i as L, n as R, o as z, r as B, s as ee, t as V } from "./admin-dialog-
|
|
16
|
-
import { t as H } from "./admin-label-
|
|
9
|
+
import { a as b, i as x, n as S, r as C, t as w } from "./admin-select-BUcEU5Rg.js";
|
|
10
|
+
import { n as T, t as E } from "./admin-cursor-pager-CIb3Jw2F.js";
|
|
11
|
+
import { a as D, n as O, o as k, r as A, s as j, t as M } from "./admin-table-BU6Tie69.js";
|
|
12
|
+
import { t as N } from "./admin-linked-table-row-BGr7JXeM.js";
|
|
13
|
+
import { t as P } from "./admin-badge-pgG6D9-a.js";
|
|
14
|
+
import { t as F } from "./admin-status-badge-0-K37EfN.js";
|
|
15
|
+
import { a as I, i as L, n as R, o as z, r as B, s as ee, t as V } from "./admin-dialog-BSRf9Zre.js";
|
|
16
|
+
import { t as H } from "./admin-label-aviN9Gng.js";
|
|
17
17
|
import { n as te } from "./admin-dialog-width-BPrgdYlj.js";
|
|
18
|
-
import { a as U, o as W, r as G, t as K } from "./admin-card-
|
|
18
|
+
import { a as U, o as W, r as G, t as K } from "./admin-card-DvTMc5Se.js";
|
|
19
19
|
import { n as ne, t as re } from "./admin-invoice-profile-model-Cgjy3zV8.js";
|
|
20
20
|
import { t as ie } from "./admin-dunning-B2zgtrOo.js";
|
|
21
21
|
import * as q from "react";
|
|
@@ -27,23 +27,23 @@ import { Add01Icon as ce, ArrowLeft01Icon as le, Delete02Icon as ue } from "@hug
|
|
|
27
27
|
import { useForm as de } from "@tanstack/react-form";
|
|
28
28
|
//#region src/admin/pages/customers/invoice-profile.tsx
|
|
29
29
|
function fe({ customerId: e }) {
|
|
30
|
-
let { orderQueries:
|
|
31
|
-
return /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Z(U, { children: /* @__PURE__ */ Z(W, { children: /* @__PURE__ */ Z(
|
|
30
|
+
let { orderQueries: n } = i(), r = l(), o = Y(n.profile(e));
|
|
31
|
+
return /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Z(U, { children: /* @__PURE__ */ Z(W, { children: /* @__PURE__ */ Z(t, { id: "Invoice profile" }) }) }), /* @__PURE__ */ Q(G, { children: [/* @__PURE__ */ Z(a, {
|
|
32
32
|
className: "text-sm underline",
|
|
33
33
|
to: `/orders?customer_id=${e}&origin=usage`,
|
|
34
|
-
children: /* @__PURE__ */ Z(
|
|
35
|
-
}),
|
|
34
|
+
children: /* @__PURE__ */ Z(t, { id: "View customer usage orders" })
|
|
35
|
+
}), o.isPending ? /* @__PURE__ */ Z("p", { children: /* @__PURE__ */ Z(t, { id: "Loading invoice profile…" }) }) : o.error ? /* @__PURE__ */ Z("p", {
|
|
36
36
|
role: "alert",
|
|
37
37
|
className: "text-destructive",
|
|
38
|
-
children:
|
|
38
|
+
children: o.error.message
|
|
39
39
|
}) : /* @__PURE__ */ Z(pe, {
|
|
40
40
|
customerId: e,
|
|
41
|
-
profile:
|
|
42
|
-
readOnly: !
|
|
41
|
+
profile: o.data,
|
|
42
|
+
readOnly: !r
|
|
43
43
|
}, e)] })] });
|
|
44
44
|
}
|
|
45
|
-
function pe({ customerId:
|
|
46
|
-
let { id:
|
|
45
|
+
function pe({ customerId: n, profile: r, readOnly: a = !1 }) {
|
|
46
|
+
let { id: o, text: l } = e(), { invoiceProfileMutation: u } = i(), [d, f] = ae(() => ne(r)), [p, m] = ae(null), [h, g] = ae(!1), _ = X(), v = J(u(_, n)), y = (e) => {
|
|
47
47
|
f((t) => ({
|
|
48
48
|
...t,
|
|
49
49
|
...e
|
|
@@ -52,7 +52,7 @@ function pe({ customerId: t, profile: n, readOnly: i = !1 }) {
|
|
|
52
52
|
async function b() {
|
|
53
53
|
m(null), g(!1);
|
|
54
54
|
try {
|
|
55
|
-
await v.mutateAsync(re(d,
|
|
55
|
+
await v.mutateAsync(re(d, r)), g(!0);
|
|
56
56
|
} catch (e) {
|
|
57
57
|
m(e instanceof Error ? e.message : "Invoice profile update failed.");
|
|
58
58
|
}
|
|
@@ -65,54 +65,54 @@ function pe({ customerId: t, profile: n, readOnly: i = !1 }) {
|
|
|
65
65
|
children: [
|
|
66
66
|
/* @__PURE__ */ Z("p", {
|
|
67
67
|
className: "text-sm text-muted-foreground",
|
|
68
|
-
children: /* @__PURE__ */ Z(
|
|
68
|
+
children: /* @__PURE__ */ Z(t, { id: "Terms and billing facts for future usage orders. Billed orders keep their original snapshots. Tax details are recorded; no tax is calculated." })
|
|
69
69
|
}),
|
|
70
70
|
/* @__PURE__ */ Q("fieldset", {
|
|
71
|
-
disabled:
|
|
71
|
+
disabled: a || v.isPending,
|
|
72
72
|
className: "space-y-4",
|
|
73
73
|
children: [
|
|
74
74
|
/* @__PURE__ */ Q("div", {
|
|
75
75
|
className: "grid gap-3 sm:grid-cols-2",
|
|
76
76
|
children: [/* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z(H, {
|
|
77
|
-
htmlFor:
|
|
78
|
-
children: /* @__PURE__ */ Z(
|
|
77
|
+
htmlFor: o("invoice-profile-terms"),
|
|
78
|
+
children: /* @__PURE__ */ Z(t, { id: "Payment terms (days)" })
|
|
79
79
|
}), /* @__PURE__ */ Z(c, {
|
|
80
|
-
id:
|
|
80
|
+
id: o("invoice-profile-terms"),
|
|
81
81
|
type: "number",
|
|
82
82
|
min: 0,
|
|
83
83
|
step: 1,
|
|
84
84
|
value: d.terms,
|
|
85
85
|
onChange: (e) => y({ terms: e.target.value })
|
|
86
86
|
})] }), /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z(H, {
|
|
87
|
-
htmlFor:
|
|
88
|
-
children: /* @__PURE__ */ Z(
|
|
87
|
+
htmlFor: o("invoice-profile-method"),
|
|
88
|
+
children: /* @__PURE__ */ Z(t, { id: "Collection method" })
|
|
89
89
|
}), /* @__PURE__ */ Q("select", {
|
|
90
|
-
id:
|
|
90
|
+
id: o("invoice-profile-method"),
|
|
91
91
|
className: "h-9 w-full rounded-md border bg-background px-2",
|
|
92
92
|
value: d.method,
|
|
93
93
|
onChange: (e) => y({ method: e.target.value }),
|
|
94
94
|
children: [/* @__PURE__ */ Z("option", {
|
|
95
95
|
value: "charge_automatically",
|
|
96
|
-
children: /* @__PURE__ */ Z(
|
|
96
|
+
children: /* @__PURE__ */ Z(t, { id: "Saved payment method" })
|
|
97
97
|
}), /* @__PURE__ */ Z("option", {
|
|
98
98
|
value: "send_invoice",
|
|
99
|
-
children: /* @__PURE__ */ Z(
|
|
99
|
+
children: /* @__PURE__ */ Z(t, { id: "Manual remittance" })
|
|
100
100
|
})]
|
|
101
101
|
})] })]
|
|
102
102
|
}),
|
|
103
103
|
/* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z(H, {
|
|
104
|
-
htmlFor:
|
|
105
|
-
children: /* @__PURE__ */ Z(
|
|
104
|
+
htmlFor: o("invoice-profile-po"),
|
|
105
|
+
children: /* @__PURE__ */ Z(t, { id: "Purchase order" })
|
|
106
106
|
}), /* @__PURE__ */ Z(c, {
|
|
107
|
-
id:
|
|
107
|
+
id: o("invoice-profile-po"),
|
|
108
108
|
value: d.po,
|
|
109
109
|
onChange: (e) => y({ po: e.target.value })
|
|
110
110
|
})] }),
|
|
111
111
|
/* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z(H, {
|
|
112
|
-
htmlFor:
|
|
113
|
-
children: /* @__PURE__ */ Z(
|
|
112
|
+
htmlFor: o("invoice-profile-memo"),
|
|
113
|
+
children: /* @__PURE__ */ Z(t, { id: "Invoice memo" })
|
|
114
114
|
}), /* @__PURE__ */ Z(c, {
|
|
115
|
-
id:
|
|
115
|
+
id: o("invoice-profile-memo"),
|
|
116
116
|
value: d.memo,
|
|
117
117
|
onChange: (e) => y({ memo: e.target.value })
|
|
118
118
|
})] }),
|
|
@@ -121,39 +121,39 @@ function pe({ customerId: t, profile: n, readOnly: i = !1 }) {
|
|
|
121
121
|
children: [
|
|
122
122
|
/* @__PURE__ */ Z("p", {
|
|
123
123
|
className: "text-sm font-medium",
|
|
124
|
-
children: /* @__PURE__ */ Z(
|
|
124
|
+
children: /* @__PURE__ */ Z(t, { id: "Billing contacts" })
|
|
125
125
|
}),
|
|
126
|
-
d.contacts.map((e,
|
|
126
|
+
d.contacts.map((e, n) => /* @__PURE__ */ Q("div", {
|
|
127
127
|
className: "flex gap-2",
|
|
128
128
|
children: [
|
|
129
129
|
/* @__PURE__ */ Z(c, {
|
|
130
|
-
"aria-label": `Contact ${
|
|
130
|
+
"aria-label": `Contact ${n + 1} name`,
|
|
131
131
|
placeholder: l("Name"),
|
|
132
132
|
value: e.name,
|
|
133
|
-
onChange: (e) => y({ contacts: d.contacts.map((
|
|
134
|
-
...
|
|
133
|
+
onChange: (e) => y({ contacts: d.contacts.map((t, r) => r === n ? {
|
|
134
|
+
...t,
|
|
135
135
|
name: e.target.value
|
|
136
|
-
} :
|
|
136
|
+
} : t) })
|
|
137
137
|
}),
|
|
138
138
|
/* @__PURE__ */ Z(c, {
|
|
139
|
-
"aria-label": `Contact ${
|
|
139
|
+
"aria-label": `Contact ${n + 1} email`,
|
|
140
140
|
type: "email",
|
|
141
141
|
placeholder: l("Email"),
|
|
142
142
|
value: e.email,
|
|
143
|
-
onChange: (e) => y({ contacts: d.contacts.map((
|
|
144
|
-
...
|
|
143
|
+
onChange: (e) => y({ contacts: d.contacts.map((t, r) => r === n ? {
|
|
144
|
+
...t,
|
|
145
145
|
email: e.target.value
|
|
146
|
-
} :
|
|
146
|
+
} : t) })
|
|
147
147
|
}),
|
|
148
148
|
/* @__PURE__ */ Z(s, {
|
|
149
149
|
type: "button",
|
|
150
150
|
variant: "outline",
|
|
151
|
-
"aria-label": `Remove contact ${
|
|
152
|
-
onClick: () => y({ contacts: d.contacts.filter((e,
|
|
153
|
-
children: /* @__PURE__ */ Z(
|
|
151
|
+
"aria-label": `Remove contact ${n + 1}`,
|
|
152
|
+
onClick: () => y({ contacts: d.contacts.filter((e, t) => t !== n) }),
|
|
153
|
+
children: /* @__PURE__ */ Z(t, { id: "Remove" })
|
|
154
154
|
})
|
|
155
155
|
]
|
|
156
|
-
},
|
|
156
|
+
}, n)),
|
|
157
157
|
/* @__PURE__ */ Z(s, {
|
|
158
158
|
type: "button",
|
|
159
159
|
variant: "outline",
|
|
@@ -161,7 +161,7 @@ function pe({ customerId: t, profile: n, readOnly: i = !1 }) {
|
|
|
161
161
|
name: "",
|
|
162
162
|
email: ""
|
|
163
163
|
}] }),
|
|
164
|
-
children: /* @__PURE__ */ Z(
|
|
164
|
+
children: /* @__PURE__ */ Z(t, { id: "Add contact" })
|
|
165
165
|
})
|
|
166
166
|
]
|
|
167
167
|
}),
|
|
@@ -170,38 +170,38 @@ function pe({ customerId: t, profile: n, readOnly: i = !1 }) {
|
|
|
170
170
|
children: [
|
|
171
171
|
/* @__PURE__ */ Z("p", {
|
|
172
172
|
className: "text-sm font-medium",
|
|
173
|
-
children: /* @__PURE__ */ Z(
|
|
173
|
+
children: /* @__PURE__ */ Z(t, { id: "Tax details" })
|
|
174
174
|
}),
|
|
175
|
-
d.tax.map((e,
|
|
175
|
+
d.tax.map((e, n) => /* @__PURE__ */ Q("div", {
|
|
176
176
|
className: "flex gap-2",
|
|
177
177
|
children: [
|
|
178
178
|
/* @__PURE__ */ Z(c, {
|
|
179
|
-
"aria-label": `Tax detail ${
|
|
179
|
+
"aria-label": `Tax detail ${n + 1} name`,
|
|
180
180
|
placeholder: l("Name, such as tax_id"),
|
|
181
181
|
value: e.key,
|
|
182
|
-
onChange: (e) => y({ tax: d.tax.map((
|
|
183
|
-
...
|
|
182
|
+
onChange: (e) => y({ tax: d.tax.map((t, r) => r === n ? {
|
|
183
|
+
...t,
|
|
184
184
|
key: e.target.value
|
|
185
|
-
} :
|
|
185
|
+
} : t) })
|
|
186
186
|
}),
|
|
187
187
|
/* @__PURE__ */ Z(c, {
|
|
188
|
-
"aria-label": `Tax detail ${
|
|
188
|
+
"aria-label": `Tax detail ${n + 1} value`,
|
|
189
189
|
placeholder: l("Value"),
|
|
190
190
|
value: e.value,
|
|
191
|
-
onChange: (e) => y({ tax: d.tax.map((
|
|
192
|
-
...
|
|
191
|
+
onChange: (e) => y({ tax: d.tax.map((t, r) => r === n ? {
|
|
192
|
+
...t,
|
|
193
193
|
value: e.target.value
|
|
194
|
-
} :
|
|
194
|
+
} : t) })
|
|
195
195
|
}),
|
|
196
196
|
/* @__PURE__ */ Z(s, {
|
|
197
197
|
type: "button",
|
|
198
198
|
variant: "outline",
|
|
199
|
-
"aria-label": `Remove tax detail ${
|
|
200
|
-
onClick: () => y({ tax: d.tax.filter((e,
|
|
201
|
-
children: /* @__PURE__ */ Z(
|
|
199
|
+
"aria-label": `Remove tax detail ${n + 1}`,
|
|
200
|
+
onClick: () => y({ tax: d.tax.filter((e, t) => t !== n) }),
|
|
201
|
+
children: /* @__PURE__ */ Z(t, { id: "Remove" })
|
|
202
202
|
})
|
|
203
203
|
]
|
|
204
|
-
},
|
|
204
|
+
}, n)),
|
|
205
205
|
/* @__PURE__ */ Z(s, {
|
|
206
206
|
type: "button",
|
|
207
207
|
variant: "outline",
|
|
@@ -209,7 +209,7 @@ function pe({ customerId: t, profile: n, readOnly: i = !1 }) {
|
|
|
209
209
|
key: "",
|
|
210
210
|
value: ""
|
|
211
211
|
}] }),
|
|
212
|
-
children: /* @__PURE__ */ Z(
|
|
212
|
+
children: /* @__PURE__ */ Z(t, { id: "Add tax detail" })
|
|
213
213
|
})
|
|
214
214
|
]
|
|
215
215
|
})
|
|
@@ -223,9 +223,9 @@ function pe({ customerId: t, profile: n, readOnly: i = !1 }) {
|
|
|
223
223
|
h && /* @__PURE__ */ Z("p", {
|
|
224
224
|
role: "status",
|
|
225
225
|
className: "text-sm",
|
|
226
|
-
children: /* @__PURE__ */ Z(
|
|
226
|
+
children: /* @__PURE__ */ Z(t, { id: "Invoice profile saved. Billed orders were not changed." })
|
|
227
227
|
}),
|
|
228
|
-
!
|
|
228
|
+
!a && /* @__PURE__ */ Z(s, {
|
|
229
229
|
type: "submit",
|
|
230
230
|
disabled: v.isPending,
|
|
231
231
|
children: v.isPending ? "Saving…" : "Save invoice profile"
|
|
@@ -239,7 +239,7 @@ function me({ currencies: e = [] }) {
|
|
|
239
239
|
return /* @__PURE__ */ Z(oe, { children: e.map((e) => /* @__PURE__ */ Q(P, {
|
|
240
240
|
variant: "secondary",
|
|
241
241
|
className: "mt-1 mr-1",
|
|
242
|
-
children: [/* @__PURE__ */ Z(
|
|
242
|
+
children: [/* @__PURE__ */ Z(t, { id: "Default · " }), e]
|
|
243
243
|
}, e)) });
|
|
244
244
|
}
|
|
245
245
|
//#endregion
|
|
@@ -286,8 +286,8 @@ function ve({ customerId: e, currencies: t }) {
|
|
|
286
286
|
initialCurrency: t[0] ?? "USD"
|
|
287
287
|
}, `${r}:${e}`);
|
|
288
288
|
}
|
|
289
|
-
function ye({ merchant:
|
|
290
|
-
let { id:
|
|
289
|
+
function ye({ merchant: n, customer: r, initialCurrency: a }) {
|
|
290
|
+
let { id: o, text: u } = e(), { creditQueries: d } = i(), f = l(), [g, v] = q.useState(a), [y, b] = q.useState(a), x = T(g, 25), S = T(g, 25), [C, w] = q.useState(!1), [N, P] = q.useState(null), F = Y(d.grants(n, r, g, x.size, x.cursor)), I = Y(d.transactions(n, r, g, S.size, S.cursor)), L = p(g);
|
|
291
291
|
return /* @__PURE__ */ Q(K, { children: [
|
|
292
292
|
/* @__PURE__ */ Q(U, {
|
|
293
293
|
className: "gap-3",
|
|
@@ -296,12 +296,12 @@ function ye({ merchant: t, customer: n, initialCurrency: i }) {
|
|
|
296
296
|
className: "flex items-center justify-between gap-3",
|
|
297
297
|
children: [/* @__PURE__ */ Z(W, {
|
|
298
298
|
className: "text-sm",
|
|
299
|
-
children: /* @__PURE__ */ Z(
|
|
299
|
+
children: /* @__PURE__ */ Z(t, { id: "Credits" })
|
|
300
300
|
}), f && /* @__PURE__ */ Z(s, {
|
|
301
301
|
size: "sm",
|
|
302
302
|
disabled: L === void 0,
|
|
303
303
|
onClick: () => w(!0),
|
|
304
|
-
children: /* @__PURE__ */ Z(
|
|
304
|
+
children: /* @__PURE__ */ Z(t, { id: "Grant credit" })
|
|
305
305
|
})]
|
|
306
306
|
}),
|
|
307
307
|
/* @__PURE__ */ Q("form", {
|
|
@@ -314,10 +314,10 @@ function ye({ merchant: t, customer: n, initialCurrency: i }) {
|
|
|
314
314
|
children: [/* @__PURE__ */ Q("div", {
|
|
315
315
|
className: "grid gap-1",
|
|
316
316
|
children: [/* @__PURE__ */ Z(H, {
|
|
317
|
-
htmlFor:
|
|
318
|
-
children: /* @__PURE__ */ Z(
|
|
317
|
+
htmlFor: o("credit-currency"),
|
|
318
|
+
children: /* @__PURE__ */ Z(t, { id: "Currency" })
|
|
319
319
|
}), /* @__PURE__ */ Z(c, {
|
|
320
|
-
id:
|
|
320
|
+
id: o("credit-currency"),
|
|
321
321
|
value: y,
|
|
322
322
|
onChange: (e) => b(e.target.value),
|
|
323
323
|
placeholder: u("USD")
|
|
@@ -326,12 +326,12 @@ function ye({ merchant: t, customer: n, initialCurrency: i }) {
|
|
|
326
326
|
type: "submit",
|
|
327
327
|
variant: "outline",
|
|
328
328
|
size: "sm",
|
|
329
|
-
children: /* @__PURE__ */ Z(
|
|
329
|
+
children: /* @__PURE__ */ Z(t, { id: "View" })
|
|
330
330
|
})]
|
|
331
331
|
}),
|
|
332
332
|
L === void 0 && /* @__PURE__ */ Q("p", {
|
|
333
333
|
className: "text-xs text-muted-foreground",
|
|
334
|
-
children: [g, /* @__PURE__ */ Z(
|
|
334
|
+
children: [g, /* @__PURE__ */ Z(t, { id: " is not a supported currency." })]
|
|
335
335
|
})
|
|
336
336
|
]
|
|
337
337
|
}),
|
|
@@ -342,11 +342,11 @@ function ye({ merchant: t, customer: n, initialCurrency: i }) {
|
|
|
342
342
|
children: [
|
|
343
343
|
/* @__PURE__ */ Q("h3", {
|
|
344
344
|
className: "mb-2 text-sm font-medium",
|
|
345
|
-
children: [/* @__PURE__ */ Z(
|
|
345
|
+
children: [/* @__PURE__ */ Z(t, { id: "Grants · " }), g]
|
|
346
346
|
}),
|
|
347
347
|
F.isPending ? /* @__PURE__ */ Z("p", {
|
|
348
348
|
className: "text-sm text-muted-foreground",
|
|
349
|
-
children: /* @__PURE__ */ Z(
|
|
349
|
+
children: /* @__PURE__ */ Z(t, { id: "Loading grants…" })
|
|
350
350
|
}) : F.error ? /* @__PURE__ */ Z("p", {
|
|
351
351
|
role: "alert",
|
|
352
352
|
className: "text-sm text-destructive",
|
|
@@ -354,14 +354,14 @@ function ye({ merchant: t, customer: n, initialCurrency: i }) {
|
|
|
354
354
|
}) : F.data?.data.length ? /* @__PURE__ */ Z("div", {
|
|
355
355
|
className: "overflow-x-auto",
|
|
356
356
|
children: /* @__PURE__ */ Q(M, { children: [/* @__PURE__ */ Z(k, { children: /* @__PURE__ */ Q(j, { children: [
|
|
357
|
-
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(
|
|
358
|
-
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(
|
|
359
|
-
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(
|
|
360
|
-
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(
|
|
361
|
-
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(
|
|
362
|
-
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(
|
|
363
|
-
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(
|
|
364
|
-
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(
|
|
357
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(t, { id: "Grant" }) }),
|
|
358
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(t, { id: "Original" }) }),
|
|
359
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(t, { id: "Remaining" }) }),
|
|
360
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(t, { id: "Spent" }) }),
|
|
361
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(t, { id: "Expired" }) }),
|
|
362
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(t, { id: "Revoked" }) }),
|
|
363
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(t, { id: "State" }) }),
|
|
364
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(t, { id: "Expires" }) }),
|
|
365
365
|
/* @__PURE__ */ Z(D, {})
|
|
366
366
|
] }) }), /* @__PURE__ */ Z(O, { children: F.data.data.map((e) => /* @__PURE__ */ Q(j, { children: [
|
|
367
367
|
/* @__PURE__ */ Q(A, { children: [
|
|
@@ -395,14 +395,14 @@ function ye({ merchant: t, customer: n, initialCurrency: i }) {
|
|
|
395
395
|
variant: "outline",
|
|
396
396
|
disabled: !ge(e),
|
|
397
397
|
onClick: () => P(e),
|
|
398
|
-
children: /* @__PURE__ */ Z(
|
|
398
|
+
children: /* @__PURE__ */ Z(t, { id: "Revoke" })
|
|
399
399
|
}) })
|
|
400
400
|
] }, e.id)) })] })
|
|
401
401
|
}) : /* @__PURE__ */ Z("p", {
|
|
402
402
|
className: "text-sm text-muted-foreground",
|
|
403
|
-
children: /* @__PURE__ */ Z(
|
|
403
|
+
children: /* @__PURE__ */ Z(t, { id: "No credit grants in this currency." })
|
|
404
404
|
}),
|
|
405
|
-
/* @__PURE__ */ Z(
|
|
405
|
+
/* @__PURE__ */ Z(E, {
|
|
406
406
|
pages: x,
|
|
407
407
|
rows: F.data?.data?.length ?? 0,
|
|
408
408
|
nextCursor: F.data?.next_cursor,
|
|
@@ -414,20 +414,20 @@ function ye({ merchant: t, customer: n, initialCurrency: i }) {
|
|
|
414
414
|
children: [
|
|
415
415
|
/* @__PURE__ */ Q("h3", {
|
|
416
416
|
className: "mb-2 text-sm font-medium",
|
|
417
|
-
children: [/* @__PURE__ */ Z(
|
|
417
|
+
children: [/* @__PURE__ */ Z(t, { id: "Transaction ledger · " }), g]
|
|
418
418
|
}),
|
|
419
419
|
I.isPending ? /* @__PURE__ */ Z("p", {
|
|
420
420
|
className: "text-sm text-muted-foreground",
|
|
421
|
-
children: /* @__PURE__ */ Z(
|
|
421
|
+
children: /* @__PURE__ */ Z(t, { id: "Loading transactions…" })
|
|
422
422
|
}) : I.error ? /* @__PURE__ */ Z("p", {
|
|
423
423
|
role: "alert",
|
|
424
424
|
className: "text-sm text-destructive",
|
|
425
425
|
children: $(I.error)
|
|
426
426
|
}) : I.data?.data.length ? /* @__PURE__ */ Q(M, { children: [/* @__PURE__ */ Z(k, { children: /* @__PURE__ */ Q(j, { children: [
|
|
427
|
-
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(
|
|
428
|
-
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(
|
|
429
|
-
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(
|
|
430
|
-
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(
|
|
427
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(t, { id: "Date" }) }),
|
|
428
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(t, { id: "Type" }) }),
|
|
429
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(t, { id: "Amount" }) }),
|
|
430
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(t, { id: "Source" }) })
|
|
431
431
|
] }) }), /* @__PURE__ */ Z(O, { children: I.data.data.map((e) => /* @__PURE__ */ Q(j, { children: [
|
|
432
432
|
/* @__PURE__ */ Z(A, {
|
|
433
433
|
title: e.id,
|
|
@@ -441,9 +441,9 @@ function ye({ merchant: t, customer: n, initialCurrency: i }) {
|
|
|
441
441
|
/* @__PURE__ */ Z(A, { children: e.source || "—" })
|
|
442
442
|
] }, e.id)) })] }) : /* @__PURE__ */ Z("p", {
|
|
443
443
|
className: "text-sm text-muted-foreground",
|
|
444
|
-
children: /* @__PURE__ */ Z(
|
|
444
|
+
children: /* @__PURE__ */ Z(t, { id: "No transactions in this currency." })
|
|
445
445
|
}),
|
|
446
|
-
/* @__PURE__ */ Z(
|
|
446
|
+
/* @__PURE__ */ Z(E, {
|
|
447
447
|
pages: S,
|
|
448
448
|
rows: I.data?.data?.length ?? 0,
|
|
449
449
|
nextCursor: I.data?.next_cursor,
|
|
@@ -453,31 +453,31 @@ function ye({ merchant: t, customer: n, initialCurrency: i }) {
|
|
|
453
453
|
})]
|
|
454
454
|
}),
|
|
455
455
|
C && L !== void 0 && /* @__PURE__ */ Z(be, {
|
|
456
|
-
merchant:
|
|
457
|
-
customer:
|
|
456
|
+
merchant: n,
|
|
457
|
+
customer: r,
|
|
458
458
|
currency: g,
|
|
459
459
|
decimals: L,
|
|
460
460
|
onClose: () => w(!1)
|
|
461
461
|
}),
|
|
462
462
|
N && /* @__PURE__ */ Z(xe, {
|
|
463
|
-
merchant:
|
|
464
|
-
customer:
|
|
463
|
+
merchant: n,
|
|
464
|
+
customer: r,
|
|
465
465
|
grant: N,
|
|
466
466
|
onClose: () => P(null)
|
|
467
467
|
})
|
|
468
468
|
] });
|
|
469
469
|
}
|
|
470
|
-
function be({ merchant:
|
|
471
|
-
let { toast: u, creditMutations: d } =
|
|
470
|
+
function be({ merchant: n, customer: r, currency: a, decimals: o, onClose: l }) {
|
|
471
|
+
let { toast: u, creditMutations: d } = i(), { id: f } = e(), p = X(), m = J(d.grant(p, n, r)), [h, g] = q.useState(""), [_, v] = q.useState(""), [y, b] = q.useState(""), [x] = q.useState(() => crypto.randomUUID()), [S, C] = q.useState("");
|
|
472
472
|
return /* @__PURE__ */ Z(V, {
|
|
473
473
|
open: !0,
|
|
474
474
|
onOpenChange: (e) => {
|
|
475
475
|
!e && !m.isPending && l();
|
|
476
476
|
},
|
|
477
|
-
children: /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Q(I, { children: [/* @__PURE__ */ Z(z, { children: /* @__PURE__ */ Z(
|
|
478
|
-
/* @__PURE__ */ Z(
|
|
479
|
-
|
|
480
|
-
/* @__PURE__ */ Z(
|
|
477
|
+
children: /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Q(I, { children: [/* @__PURE__ */ Z(z, { children: /* @__PURE__ */ Z(t, { id: "Grant credit" }) }), /* @__PURE__ */ Q(B, { children: [
|
|
478
|
+
/* @__PURE__ */ Z(t, { id: "Add credit in " }),
|
|
479
|
+
a,
|
|
480
|
+
/* @__PURE__ */ Z(t, { id: " to this customer." })
|
|
481
481
|
] })] }), /* @__PURE__ */ Q("form", {
|
|
482
482
|
className: "grid gap-4",
|
|
483
483
|
onSubmit: async (e) => {
|
|
@@ -485,8 +485,8 @@ function be({ merchant: t, customer: n, currency: i, decimals: a, onClose: l })
|
|
|
485
485
|
try {
|
|
486
486
|
let e = he({
|
|
487
487
|
amount: h,
|
|
488
|
-
currency:
|
|
489
|
-
decimals:
|
|
488
|
+
currency: a,
|
|
489
|
+
decimals: o,
|
|
490
490
|
expires: _,
|
|
491
491
|
description: y,
|
|
492
492
|
sourceID: x
|
|
@@ -502,8 +502,8 @@ function be({ merchant: t, customer: n, currency: i, decimals: a, onClose: l })
|
|
|
502
502
|
children: [/* @__PURE__ */ Q(H, {
|
|
503
503
|
htmlFor: f("grant-amount"),
|
|
504
504
|
children: [
|
|
505
|
-
/* @__PURE__ */ Z(
|
|
506
|
-
|
|
505
|
+
/* @__PURE__ */ Z(t, { id: "Amount (" }),
|
|
506
|
+
a,
|
|
507
507
|
")"
|
|
508
508
|
]
|
|
509
509
|
}), /* @__PURE__ */ Z(c, {
|
|
@@ -518,7 +518,7 @@ function be({ merchant: t, customer: n, currency: i, decimals: a, onClose: l })
|
|
|
518
518
|
className: "grid gap-1",
|
|
519
519
|
children: [/* @__PURE__ */ Z(H, {
|
|
520
520
|
htmlFor: f("grant-expiry"),
|
|
521
|
-
children: /* @__PURE__ */ Z(
|
|
521
|
+
children: /* @__PURE__ */ Z(t, { id: "Expires (optional)" })
|
|
522
522
|
}), /* @__PURE__ */ Z(c, {
|
|
523
523
|
id: f("grant-expiry"),
|
|
524
524
|
type: "datetime-local",
|
|
@@ -530,7 +530,7 @@ function be({ merchant: t, customer: n, currency: i, decimals: a, onClose: l })
|
|
|
530
530
|
className: "grid gap-1",
|
|
531
531
|
children: [/* @__PURE__ */ Z(H, {
|
|
532
532
|
htmlFor: f("grant-description"),
|
|
533
|
-
children: /* @__PURE__ */ Z(
|
|
533
|
+
children: /* @__PURE__ */ Z(t, { id: "Description (optional)" })
|
|
534
534
|
}), /* @__PURE__ */ Z(c, {
|
|
535
535
|
id: f("grant-description"),
|
|
536
536
|
value: y,
|
|
@@ -548,7 +548,7 @@ function be({ merchant: t, customer: n, currency: i, decimals: a, onClose: l })
|
|
|
548
548
|
variant: "outline",
|
|
549
549
|
disabled: m.isPending,
|
|
550
550
|
onClick: l,
|
|
551
|
-
children: /* @__PURE__ */ Z(
|
|
551
|
+
children: /* @__PURE__ */ Z(t, { id: "Cancel" })
|
|
552
552
|
}), /* @__PURE__ */ Z(s, {
|
|
553
553
|
type: "submit",
|
|
554
554
|
disabled: m.isPending,
|
|
@@ -558,25 +558,25 @@ function be({ merchant: t, customer: n, currency: i, decimals: a, onClose: l })
|
|
|
558
558
|
})] })
|
|
559
559
|
});
|
|
560
560
|
}
|
|
561
|
-
function xe({ merchant:
|
|
562
|
-
let { toast: l, creditMutations: u } =
|
|
561
|
+
function xe({ merchant: n, customer: r, grant: a, onClose: o }) {
|
|
562
|
+
let { toast: l, creditMutations: u } = i(), { id: d } = e(), f = X(), p = J(u.revoke(f, n, r)), [m, g] = q.useState(""), [_, v] = q.useState("");
|
|
563
563
|
return /* @__PURE__ */ Z(V, {
|
|
564
564
|
open: !0,
|
|
565
565
|
onOpenChange: (e) => {
|
|
566
|
-
!e && !p.isPending &&
|
|
566
|
+
!e && !p.isPending && o();
|
|
567
567
|
},
|
|
568
|
-
children: /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Q(I, { children: [/* @__PURE__ */ Z(z, { children: /* @__PURE__ */ Z(
|
|
569
|
-
/* @__PURE__ */ Z(
|
|
568
|
+
children: /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Q(I, { children: [/* @__PURE__ */ Z(z, { children: /* @__PURE__ */ Z(t, { id: "Revoke remaining credit" }) }), /* @__PURE__ */ Q(B, { children: [
|
|
569
|
+
/* @__PURE__ */ Z(t, { id: "Revoke the unspent remainder of" }),
|
|
570
570
|
" ",
|
|
571
|
-
h(
|
|
572
|
-
/* @__PURE__ */ Z(
|
|
571
|
+
h(a.remaining_amount, a.currency),
|
|
572
|
+
/* @__PURE__ */ Z(t, { id: ". Active holds may prevent revocation. Payment refunds are managed separately." })
|
|
573
573
|
] })] }), /* @__PURE__ */ Q("form", {
|
|
574
574
|
className: "grid gap-4",
|
|
575
575
|
onSubmit: async (e) => {
|
|
576
576
|
e.preventDefault(), v("");
|
|
577
577
|
try {
|
|
578
|
-
let e = await p.mutateAsync(_e(
|
|
579
|
-
l.success(e.replayed ? "Credit was already revoked" : `${h(e.revoked_amount, e.currency)} revoked`),
|
|
578
|
+
let e = await p.mutateAsync(_e(a, m));
|
|
579
|
+
l.success(e.replayed ? "Credit was already revoked" : `${h(e.revoked_amount, e.currency)} revoked`), o();
|
|
580
580
|
} catch (e) {
|
|
581
581
|
v($(e));
|
|
582
582
|
}
|
|
@@ -586,7 +586,7 @@ function xe({ merchant: t, customer: n, grant: i, onClose: a }) {
|
|
|
586
586
|
className: "grid gap-1",
|
|
587
587
|
children: [/* @__PURE__ */ Z(H, {
|
|
588
588
|
htmlFor: d("revoke-reason"),
|
|
589
|
-
children: /* @__PURE__ */ Z(
|
|
589
|
+
children: /* @__PURE__ */ Z(t, { id: "Reason" })
|
|
590
590
|
}), /* @__PURE__ */ Z(c, {
|
|
591
591
|
id: d("revoke-reason"),
|
|
592
592
|
value: m,
|
|
@@ -604,12 +604,12 @@ function xe({ merchant: t, customer: n, grant: i, onClose: a }) {
|
|
|
604
604
|
type: "button",
|
|
605
605
|
variant: "outline",
|
|
606
606
|
disabled: p.isPending,
|
|
607
|
-
onClick:
|
|
608
|
-
children: /* @__PURE__ */ Z(
|
|
607
|
+
onClick: o,
|
|
608
|
+
children: /* @__PURE__ */ Z(t, { id: "Cancel" })
|
|
609
609
|
}), /* @__PURE__ */ Z(s, {
|
|
610
610
|
type: "submit",
|
|
611
611
|
variant: "destructive",
|
|
612
|
-
disabled: !ge(
|
|
612
|
+
disabled: !ge(a) || p.isPending,
|
|
613
613
|
children: p.isPending ? "Revoking…" : "Revoke credit"
|
|
614
614
|
})] })
|
|
615
615
|
]
|
|
@@ -661,10 +661,10 @@ function we(e, t, n = /* @__PURE__ */ new Date()) {
|
|
|
661
661
|
//#endregion
|
|
662
662
|
//#region src/admin/pages/customers/detail.tsx
|
|
663
663
|
function Te() {
|
|
664
|
-
let { text: c } = e(), { props: u } =
|
|
664
|
+
let { text: c } = e(), { props: u } = r(), { adminQueries: d } = i(), f = l(), { customerId: p = "" } = n(), g = o(), { data: _, isPending: v } = Y(d.customer(p));
|
|
665
665
|
return v ? /* @__PURE__ */ Z("p", {
|
|
666
666
|
className: "text-sm text-muted-foreground",
|
|
667
|
-
children: /* @__PURE__ */ Z(
|
|
667
|
+
children: /* @__PURE__ */ Z(t, { id: "Loading…" })
|
|
668
668
|
}) : _ ? /* @__PURE__ */ Q("div", {
|
|
669
669
|
className: "flex min-w-0 flex-col gap-4",
|
|
670
670
|
children: [
|
|
@@ -690,9 +690,9 @@ function Te() {
|
|
|
690
690
|
className: "truncate text-xs text-muted-foreground",
|
|
691
691
|
children: [
|
|
692
692
|
_.id,
|
|
693
|
-
/* @__PURE__ */ Z(
|
|
693
|
+
/* @__PURE__ */ Z(t, { id: " · since " }),
|
|
694
694
|
m(_.created_at),
|
|
695
|
-
/* @__PURE__ */ Z(
|
|
695
|
+
/* @__PURE__ */ Z(t, { id: " · last seen" }),
|
|
696
696
|
" ",
|
|
697
697
|
m(_.last_seen_at)
|
|
698
698
|
]
|
|
@@ -708,7 +708,7 @@ function Te() {
|
|
|
708
708
|
u.userHref && /* @__PURE__ */ Z("a", {
|
|
709
709
|
className: "underline",
|
|
710
710
|
href: u.userHref(_.id),
|
|
711
|
-
children: /* @__PURE__ */ Z(
|
|
711
|
+
children: /* @__PURE__ */ Z(t, { id: "View user account" })
|
|
712
712
|
}),
|
|
713
713
|
u.customerPanels?.(_),
|
|
714
714
|
_.balances.length > 0 && /* @__PURE__ */ Z("div", {
|
|
@@ -717,7 +717,7 @@ function Te() {
|
|
|
717
717
|
className: "pb-1",
|
|
718
718
|
children: /* @__PURE__ */ Q(W, {
|
|
719
719
|
className: "text-xs font-normal text-muted-foreground uppercase",
|
|
720
|
-
children: [e.currency, /* @__PURE__ */ Z(
|
|
720
|
+
children: [e.currency, /* @__PURE__ */ Z(t, { id: " balance" })]
|
|
721
721
|
})
|
|
722
722
|
}), /* @__PURE__ */ Q(G, { children: [/* @__PURE__ */ Z("p", {
|
|
723
723
|
className: "text-lg font-semibold",
|
|
@@ -725,9 +725,9 @@ function Te() {
|
|
|
725
725
|
}), /* @__PURE__ */ Q("p", {
|
|
726
726
|
className: "text-xs text-muted-foreground",
|
|
727
727
|
children: [
|
|
728
|
-
/* @__PURE__ */ Z(
|
|
728
|
+
/* @__PURE__ */ Z(t, { id: "held " }),
|
|
729
729
|
h(e.held_amount, e.currency),
|
|
730
|
-
/* @__PURE__ */ Z(
|
|
730
|
+
/* @__PURE__ */ Z(t, { id: " · owed" }),
|
|
731
731
|
" ",
|
|
732
732
|
h(e.owed_amount, e.currency)
|
|
733
733
|
]
|
|
@@ -735,10 +735,10 @@ function Te() {
|
|
|
735
735
|
}),
|
|
736
736
|
_.balances.some((e) => BigInt(e.owed_amount) > 0n) && /* @__PURE__ */ Z("p", {
|
|
737
737
|
className: "text-sm",
|
|
738
|
-
children: /* @__PURE__ */ Z(
|
|
738
|
+
children: /* @__PURE__ */ Z(a, {
|
|
739
739
|
className: "underline-offset-2 hover:underline",
|
|
740
740
|
to: `/orders?customer_id=${_.id}&origin=usage&overdue=true`,
|
|
741
|
-
children: /* @__PURE__ */ Z(
|
|
741
|
+
children: /* @__PURE__ */ Z(t, { id: "Overdue usage orders" })
|
|
742
742
|
})
|
|
743
743
|
}),
|
|
744
744
|
/* @__PURE__ */ Z(ve, {
|
|
@@ -763,47 +763,47 @@ function Te() {
|
|
|
763
763
|
]
|
|
764
764
|
}) : /* @__PURE__ */ Z("p", {
|
|
765
765
|
className: "text-sm text-muted-foreground",
|
|
766
|
-
children: /* @__PURE__ */ Z(
|
|
766
|
+
children: /* @__PURE__ */ Z(t, { id: "Customer not found." })
|
|
767
767
|
});
|
|
768
768
|
}
|
|
769
769
|
function Ee({ customerId: e }) {
|
|
770
|
-
let { adminQueries:
|
|
770
|
+
let { adminQueries: n } = i(), r = T(e, 25), { data: o, isFetching: s } = Y(n.customerSubscriptions(e, r.size, r.cursor)), c = o?.data ?? [];
|
|
771
771
|
return /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Z(U, { children: /* @__PURE__ */ Z(W, {
|
|
772
772
|
className: "text-sm",
|
|
773
|
-
children: /* @__PURE__ */ Z(
|
|
773
|
+
children: /* @__PURE__ */ Z(t, { id: "Subscriptions" })
|
|
774
774
|
}) }), /* @__PURE__ */ Q(G, {
|
|
775
775
|
className: "grid gap-3",
|
|
776
776
|
children: [c.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
777
777
|
className: "text-sm text-muted-foreground",
|
|
778
|
-
children: /* @__PURE__ */ Z(
|
|
778
|
+
children: /* @__PURE__ */ Z(t, { id: "No subscriptions." })
|
|
779
779
|
}) : /* @__PURE__ */ Q(M, { children: [/* @__PURE__ */ Z(k, { children: /* @__PURE__ */ Q(j, {
|
|
780
780
|
className: "hover:bg-transparent",
|
|
781
781
|
children: [
|
|
782
782
|
/* @__PURE__ */ Z(D, {
|
|
783
783
|
className: "text-muted-foreground",
|
|
784
|
-
children: /* @__PURE__ */ Z(
|
|
784
|
+
children: /* @__PURE__ */ Z(t, { id: "Subscription" })
|
|
785
785
|
}),
|
|
786
786
|
/* @__PURE__ */ Z(D, {
|
|
787
787
|
className: "text-muted-foreground",
|
|
788
|
-
children: /* @__PURE__ */ Z(
|
|
788
|
+
children: /* @__PURE__ */ Z(t, { id: "Status" })
|
|
789
789
|
}),
|
|
790
790
|
/* @__PURE__ */ Z(D, {
|
|
791
791
|
className: "text-muted-foreground",
|
|
792
|
-
children: /* @__PURE__ */ Z(
|
|
792
|
+
children: /* @__PURE__ */ Z(t, { id: "Rail" })
|
|
793
793
|
}),
|
|
794
794
|
/* @__PURE__ */ Z(D, {
|
|
795
795
|
className: "text-muted-foreground",
|
|
796
|
-
children: /* @__PURE__ */ Z(
|
|
796
|
+
children: /* @__PURE__ */ Z(t, { id: "Period ends" })
|
|
797
797
|
}),
|
|
798
798
|
/* @__PURE__ */ Z(D, {
|
|
799
799
|
className: "text-muted-foreground",
|
|
800
|
-
children: /* @__PURE__ */ Z(
|
|
800
|
+
children: /* @__PURE__ */ Z(t, { id: "Dunning" })
|
|
801
801
|
})
|
|
802
802
|
]
|
|
803
803
|
}) }), /* @__PURE__ */ Z(O, { children: c.map((e) => /* @__PURE__ */ Q(N, {
|
|
804
804
|
to: `/subscriptions/${e.id}`,
|
|
805
805
|
children: [
|
|
806
|
-
/* @__PURE__ */ Z(A, { children: /* @__PURE__ */ Z(
|
|
806
|
+
/* @__PURE__ */ Z(A, { children: /* @__PURE__ */ Z(a, {
|
|
807
807
|
className: "text-xs underline-offset-2 hover:underline",
|
|
808
808
|
to: `/subscriptions/${e.id}`,
|
|
809
809
|
children: _(e.id, 13)
|
|
@@ -819,56 +819,56 @@ function Ee({ customerId: e }) {
|
|
|
819
819
|
children: e.dunning ? ie(e.dunning) : "—"
|
|
820
820
|
})
|
|
821
821
|
]
|
|
822
|
-
}, e.id)) })] }), /* @__PURE__ */ Z(
|
|
823
|
-
pages:
|
|
824
|
-
rows:
|
|
825
|
-
nextCursor:
|
|
822
|
+
}, e.id)) })] }), /* @__PURE__ */ Z(E, {
|
|
823
|
+
pages: r,
|
|
824
|
+
rows: o?.data?.length ?? 0,
|
|
825
|
+
nextCursor: o?.next_cursor,
|
|
826
826
|
busy: s
|
|
827
827
|
})]
|
|
828
828
|
})] });
|
|
829
829
|
}
|
|
830
830
|
function De({ customerId: e }) {
|
|
831
|
-
let { adminQueries:
|
|
831
|
+
let { adminQueries: n } = i(), r = T(e, 25), { data: o, isFetching: s } = Y(n.customerPayments(e, r.size, r.cursor)), c = o?.data ?? [];
|
|
832
832
|
return /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Z(U, { children: /* @__PURE__ */ Z(W, {
|
|
833
833
|
className: "text-sm",
|
|
834
|
-
children: /* @__PURE__ */ Z(
|
|
834
|
+
children: /* @__PURE__ */ Z(t, { id: "Payments" })
|
|
835
835
|
}) }), /* @__PURE__ */ Q(G, {
|
|
836
836
|
className: "grid gap-3",
|
|
837
837
|
children: [c.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
838
838
|
className: "text-sm text-muted-foreground",
|
|
839
|
-
children: /* @__PURE__ */ Z(
|
|
839
|
+
children: /* @__PURE__ */ Z(t, { id: "No payments." })
|
|
840
840
|
}) : /* @__PURE__ */ Q(M, { children: [/* @__PURE__ */ Z(k, { children: /* @__PURE__ */ Q(j, {
|
|
841
841
|
className: "hover:bg-transparent",
|
|
842
842
|
children: [
|
|
843
843
|
/* @__PURE__ */ Z(D, {
|
|
844
844
|
className: "text-muted-foreground",
|
|
845
|
-
children: /* @__PURE__ */ Z(
|
|
845
|
+
children: /* @__PURE__ */ Z(t, { id: "Payment" })
|
|
846
846
|
}),
|
|
847
847
|
/* @__PURE__ */ Z(D, {
|
|
848
848
|
className: "text-muted-foreground",
|
|
849
|
-
children: /* @__PURE__ */ Z(
|
|
849
|
+
children: /* @__PURE__ */ Z(t, { id: "Status" })
|
|
850
850
|
}),
|
|
851
851
|
/* @__PURE__ */ Z(D, {
|
|
852
852
|
className: "text-muted-foreground",
|
|
853
|
-
children: /* @__PURE__ */ Z(
|
|
853
|
+
children: /* @__PURE__ */ Z(t, { id: "Amount" })
|
|
854
854
|
}),
|
|
855
855
|
/* @__PURE__ */ Z(D, {
|
|
856
856
|
className: "text-muted-foreground",
|
|
857
|
-
children: /* @__PURE__ */ Z(
|
|
857
|
+
children: /* @__PURE__ */ Z(t, { id: "Kind" })
|
|
858
858
|
}),
|
|
859
859
|
/* @__PURE__ */ Z(D, {
|
|
860
860
|
className: "text-muted-foreground",
|
|
861
|
-
children: /* @__PURE__ */ Z(
|
|
861
|
+
children: /* @__PURE__ */ Z(t, { id: "Rail" })
|
|
862
862
|
}),
|
|
863
863
|
/* @__PURE__ */ Z(D, {
|
|
864
864
|
className: "text-muted-foreground",
|
|
865
|
-
children: /* @__PURE__ */ Z(
|
|
865
|
+
children: /* @__PURE__ */ Z(t, { id: "Purchased" })
|
|
866
866
|
})
|
|
867
867
|
]
|
|
868
868
|
}) }), /* @__PURE__ */ Z(O, { children: c.map((e) => /* @__PURE__ */ Q(N, {
|
|
869
869
|
to: `/payments/${e.id}`,
|
|
870
870
|
children: [
|
|
871
|
-
/* @__PURE__ */ Z(A, { children: /* @__PURE__ */ Z(
|
|
871
|
+
/* @__PURE__ */ Z(A, { children: /* @__PURE__ */ Z(a, {
|
|
872
872
|
className: "text-xs underline-offset-2 hover:underline",
|
|
873
873
|
to: `/payments/${e.id}`,
|
|
874
874
|
children: _(e.id, 13)
|
|
@@ -885,33 +885,33 @@ function De({ customerId: e }) {
|
|
|
885
885
|
children: m(e.created_at)
|
|
886
886
|
})
|
|
887
887
|
]
|
|
888
|
-
}, e.id)) })] }), /* @__PURE__ */ Z(
|
|
889
|
-
pages:
|
|
890
|
-
rows:
|
|
891
|
-
nextCursor:
|
|
888
|
+
}, e.id)) })] }), /* @__PURE__ */ Z(E, {
|
|
889
|
+
pages: r,
|
|
890
|
+
rows: o?.data?.length ?? 0,
|
|
891
|
+
nextCursor: o?.next_cursor,
|
|
892
892
|
busy: s
|
|
893
893
|
})]
|
|
894
894
|
})] });
|
|
895
895
|
}
|
|
896
896
|
function Oe({ customerId: e }) {
|
|
897
|
-
let { adminQueries:
|
|
898
|
-
mutationFn: (t) =>
|
|
899
|
-
onSuccess: () => p.invalidateQueries({ queryKey: [...
|
|
900
|
-
onError: (e) =>
|
|
901
|
-
}), h =
|
|
897
|
+
let { adminQueries: n, queryKeys: r, deleteCustomerPaymentMethod: a, toastApiError: o } = i(), c = l(), u = v(), p = X(), m = J({
|
|
898
|
+
mutationFn: (t) => a(e, t),
|
|
899
|
+
onSuccess: () => p.invalidateQueries({ queryKey: [...r.customer(e), "payment-methods"] }),
|
|
900
|
+
onError: (e) => o(e, "Remove payment method")
|
|
901
|
+
}), h = T(e, 25), { data: g, isFetching: _ } = Y(n.customerPaymentMethodsPage(e, h.size, h.cursor)), y = g?.data ?? [];
|
|
902
902
|
return /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Q(U, { children: [/* @__PURE__ */ Z(W, {
|
|
903
903
|
className: "text-sm",
|
|
904
|
-
children: /* @__PURE__ */ Z(
|
|
904
|
+
children: /* @__PURE__ */ Z(t, { id: "Payment methods" })
|
|
905
905
|
}), /* @__PURE__ */ Z(s, {
|
|
906
906
|
variant: "ghost",
|
|
907
907
|
size: "sm",
|
|
908
|
-
onClick: () => void p.invalidateQueries({ queryKey: [...
|
|
909
|
-
children: /* @__PURE__ */ Z(
|
|
908
|
+
onClick: () => void p.invalidateQueries({ queryKey: [...r.customer(e), "payment-methods"] }),
|
|
909
|
+
children: /* @__PURE__ */ Z(t, { id: "Refresh payment methods" })
|
|
910
910
|
})] }), /* @__PURE__ */ Q(G, {
|
|
911
911
|
className: "grid gap-3",
|
|
912
912
|
children: [y.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
913
913
|
className: "text-sm text-muted-foreground",
|
|
914
|
-
children: /* @__PURE__ */ Z(
|
|
914
|
+
children: /* @__PURE__ */ Z(t, { id: "No payment methods on file." })
|
|
915
915
|
}) : /* @__PURE__ */ Z("div", {
|
|
916
916
|
className: "flex flex-wrap gap-3",
|
|
917
917
|
children: y.map((e) => /* @__PURE__ */ Q("div", {
|
|
@@ -925,7 +925,7 @@ function Oe({ customerId: e }) {
|
|
|
925
925
|
className: "text-xs text-muted-foreground",
|
|
926
926
|
children: [
|
|
927
927
|
e.rail,
|
|
928
|
-
/* @__PURE__ */ Z(
|
|
928
|
+
/* @__PURE__ */ Z(t, { id: " · exp " }),
|
|
929
929
|
d(e.card)
|
|
930
930
|
]
|
|
931
931
|
}),
|
|
@@ -951,7 +951,7 @@ function Oe({ customerId: e }) {
|
|
|
951
951
|
})
|
|
952
952
|
]
|
|
953
953
|
}, e.id))
|
|
954
|
-
}), /* @__PURE__ */ Z(
|
|
954
|
+
}), /* @__PURE__ */ Z(E, {
|
|
955
955
|
pages: h,
|
|
956
956
|
rows: g?.data?.length ?? 0,
|
|
957
957
|
nextCursor: g?.next_cursor,
|
|
@@ -960,20 +960,20 @@ function Oe({ customerId: e }) {
|
|
|
960
960
|
})] });
|
|
961
961
|
}
|
|
962
962
|
function ke({ customerId: e }) {
|
|
963
|
-
let { adminQueries:
|
|
963
|
+
let { adminQueries: n } = i(), r = T(e, 25), { data: a, isFetching: o } = Y(n.customerEntitlements(e, r.size, r.cursor)), s = a?.data ?? [];
|
|
964
964
|
return /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Z(U, { children: /* @__PURE__ */ Z(W, {
|
|
965
965
|
className: "text-sm",
|
|
966
|
-
children: /* @__PURE__ */ Z(
|
|
966
|
+
children: /* @__PURE__ */ Z(t, { id: "Entitlements" })
|
|
967
967
|
}) }), /* @__PURE__ */ Q(G, {
|
|
968
968
|
className: "grid gap-3",
|
|
969
969
|
children: [
|
|
970
970
|
/* @__PURE__ */ Z("p", {
|
|
971
971
|
className: "text-xs text-muted-foreground",
|
|
972
|
-
children: /* @__PURE__ */ Z(
|
|
972
|
+
children: /* @__PURE__ */ Z(t, { id: "The keys of the products this customer holds now." })
|
|
973
973
|
}),
|
|
974
974
|
s.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
975
975
|
className: "text-sm text-muted-foreground",
|
|
976
|
-
children: /* @__PURE__ */ Z(
|
|
976
|
+
children: /* @__PURE__ */ Z(t, { id: "No entitlements." })
|
|
977
977
|
}) : /* @__PURE__ */ Z("div", {
|
|
978
978
|
className: "flex flex-wrap gap-2",
|
|
979
979
|
children: s.map((e) => /* @__PURE__ */ Z(P, {
|
|
@@ -981,25 +981,25 @@ function ke({ customerId: e }) {
|
|
|
981
981
|
children: e.entitlement
|
|
982
982
|
}, e.entitlement))
|
|
983
983
|
}),
|
|
984
|
-
/* @__PURE__ */ Z(
|
|
985
|
-
pages:
|
|
986
|
-
rows:
|
|
987
|
-
nextCursor:
|
|
988
|
-
busy:
|
|
984
|
+
/* @__PURE__ */ Z(E, {
|
|
985
|
+
pages: r,
|
|
986
|
+
rows: a?.data?.length ?? 0,
|
|
987
|
+
nextCursor: a?.next_cursor,
|
|
988
|
+
busy: o
|
|
989
989
|
})
|
|
990
990
|
]
|
|
991
991
|
})] });
|
|
992
992
|
}
|
|
993
|
-
function Ae({ customerId:
|
|
994
|
-
let { text:
|
|
993
|
+
function Ae({ customerId: n }) {
|
|
994
|
+
let { text: r } = e(), { adminQueries: a } = i(), o = l(), s = T(n, 25), { data: c, isFetching: u } = Y(a.customerProductAccess(n, s.size, s.cursor)), d = c?.data ?? [];
|
|
995
995
|
return /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Z(U, { children: /* @__PURE__ */ Z(W, {
|
|
996
996
|
className: "text-sm",
|
|
997
|
-
children: /* @__PURE__ */ Z(
|
|
997
|
+
children: /* @__PURE__ */ Z(t, { id: "Product access" })
|
|
998
998
|
}) }), /* @__PURE__ */ Q(G, {
|
|
999
999
|
className: "grid gap-3",
|
|
1000
1000
|
children: [d.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
1001
1001
|
className: "text-sm text-muted-foreground",
|
|
1002
|
-
children: /* @__PURE__ */ Z(
|
|
1002
|
+
children: /* @__PURE__ */ Z(t, { id: "No product access." })
|
|
1003
1003
|
}) : /* @__PURE__ */ Z("div", {
|
|
1004
1004
|
className: "grid gap-4",
|
|
1005
1005
|
children: d.map((e) => /* @__PURE__ */ Q("div", {
|
|
@@ -1023,13 +1023,13 @@ function Ae({ customerId: t }) {
|
|
|
1023
1023
|
children: e.ends_at ? `Ends ${m(e.ends_at)}` : "No end date"
|
|
1024
1024
|
})
|
|
1025
1025
|
]
|
|
1026
|
-
}),
|
|
1027
|
-
customerId:
|
|
1026
|
+
}), o && /* @__PURE__ */ Z(je, {
|
|
1027
|
+
customerId: n,
|
|
1028
1028
|
grantId: e.id,
|
|
1029
|
-
label:
|
|
1029
|
+
label: r("Revoke product access")
|
|
1030
1030
|
})]
|
|
1031
1031
|
}, e.id))
|
|
1032
|
-
}), /* @__PURE__ */ Z(
|
|
1032
|
+
}), /* @__PURE__ */ Z(E, {
|
|
1033
1033
|
pages: s,
|
|
1034
1034
|
rows: c?.data?.length ?? 0,
|
|
1035
1035
|
nextCursor: c?.next_cursor,
|
|
@@ -1037,15 +1037,15 @@ function Ae({ customerId: t }) {
|
|
|
1037
1037
|
})]
|
|
1038
1038
|
})] });
|
|
1039
1039
|
}
|
|
1040
|
-
function je({ customerId:
|
|
1041
|
-
let { toast:
|
|
1040
|
+
function je({ customerId: n, grantId: r, label: a }) {
|
|
1041
|
+
let { toast: o, toastApiError: l, adminMutations: u } = i(), { id: d } = e(), f = X(), p = J(u.revokeCustomerProductAccess(f, n)), [m, h] = q.useState(!1), [g, _] = q.useState("");
|
|
1042
1042
|
return /* @__PURE__ */ Q(V, {
|
|
1043
1043
|
open: m,
|
|
1044
1044
|
onOpenChange: h,
|
|
1045
1045
|
children: [/* @__PURE__ */ Z(ee, { render: /* @__PURE__ */ Z(s, {
|
|
1046
1046
|
variant: "ghost",
|
|
1047
1047
|
size: "icon",
|
|
1048
|
-
"aria-label":
|
|
1048
|
+
"aria-label": a,
|
|
1049
1049
|
children: /* @__PURE__ */ Z(se, {
|
|
1050
1050
|
icon: ue,
|
|
1051
1051
|
className: "size-4 text-destructive"
|
|
@@ -1053,12 +1053,12 @@ function je({ customerId: t, grantId: n, label: i }) {
|
|
|
1053
1053
|
}) }), /* @__PURE__ */ Q(R, {
|
|
1054
1054
|
className: te,
|
|
1055
1055
|
children: [
|
|
1056
|
-
/* @__PURE__ */ Q(I, { children: [/* @__PURE__ */ Z(z, { children: /* @__PURE__ */ Z(
|
|
1056
|
+
/* @__PURE__ */ Q(I, { children: [/* @__PURE__ */ Z(z, { children: /* @__PURE__ */ Z(t, { id: "Take the product back" }) }), /* @__PURE__ */ Z(B, { children: /* @__PURE__ */ Z(t, { id: "The customer loses its entitlements now. The grant stays on record with your reason." }) })] }),
|
|
1057
1057
|
/* @__PURE__ */ Q("div", {
|
|
1058
1058
|
className: "flex flex-col gap-1.5",
|
|
1059
1059
|
children: [/* @__PURE__ */ Z(H, {
|
|
1060
1060
|
htmlFor: d("revoke-access-reason"),
|
|
1061
|
-
children: /* @__PURE__ */ Z(
|
|
1061
|
+
children: /* @__PURE__ */ Z(t, { id: "Reason" })
|
|
1062
1062
|
}), /* @__PURE__ */ Z(c, {
|
|
1063
1063
|
id: d("revoke-access-reason"),
|
|
1064
1064
|
value: g,
|
|
@@ -1069,18 +1069,18 @@ function je({ customerId: t, grantId: n, label: i }) {
|
|
|
1069
1069
|
/* @__PURE__ */ Q(L, { children: [/* @__PURE__ */ Z(s, {
|
|
1070
1070
|
variant: "outline",
|
|
1071
1071
|
onClick: () => h(!1),
|
|
1072
|
-
children: /* @__PURE__ */ Z(
|
|
1072
|
+
children: /* @__PURE__ */ Z(t, { id: "Cancel" })
|
|
1073
1073
|
}), /* @__PURE__ */ Z(s, {
|
|
1074
1074
|
variant: "destructive",
|
|
1075
1075
|
disabled: !g.trim() || p.isPending,
|
|
1076
1076
|
onClick: async () => {
|
|
1077
1077
|
try {
|
|
1078
1078
|
await p.mutateAsync({
|
|
1079
|
-
grantId:
|
|
1079
|
+
grantId: r,
|
|
1080
1080
|
reason: g.trim()
|
|
1081
|
-
}),
|
|
1081
|
+
}), o.success("Product access revoked"), h(!1);
|
|
1082
1082
|
} catch (e) {
|
|
1083
|
-
l(e,
|
|
1083
|
+
l(e, a);
|
|
1084
1084
|
}
|
|
1085
1085
|
},
|
|
1086
1086
|
children: p.isPending ? "Revoking…" : "Revoke"
|
|
@@ -1089,8 +1089,8 @@ function je({ customerId: t, grantId: n, label: i }) {
|
|
|
1089
1089
|
})]
|
|
1090
1090
|
});
|
|
1091
1091
|
}
|
|
1092
|
-
function Me({ customerId:
|
|
1093
|
-
let { toast:
|
|
1092
|
+
function Me({ customerId: n }) {
|
|
1093
|
+
let { toast: r, toastApiError: a, adminMutations: o, adminQueries: l } = i(), { id: u, text: d } = e(), [f, p] = q.useState(!1), m = X(), h = J(o.grantCustomerProductAccess(m, n)), { data: g } = Y({
|
|
1094
1094
|
...l.allProducts(),
|
|
1095
1095
|
enabled: f
|
|
1096
1096
|
}), _ = de({
|
|
@@ -1107,9 +1107,9 @@ function Me({ customerId: t }) {
|
|
|
1107
1107
|
productId: e.productId,
|
|
1108
1108
|
...t,
|
|
1109
1109
|
note: e.note.trim() || void 0
|
|
1110
|
-
}),
|
|
1110
|
+
}), r.success("Product access granted"), v(!1);
|
|
1111
1111
|
} catch (e) {
|
|
1112
|
-
|
|
1112
|
+
a(e, "Grant product access");
|
|
1113
1113
|
}
|
|
1114
1114
|
}
|
|
1115
1115
|
}), v = (e) => {
|
|
@@ -1124,10 +1124,10 @@ function Me({ customerId: t }) {
|
|
|
1124
1124
|
children: [/* @__PURE__ */ Z(se, {
|
|
1125
1125
|
icon: ce,
|
|
1126
1126
|
className: "size-4"
|
|
1127
|
-
}), /* @__PURE__ */ Z(
|
|
1127
|
+
}), /* @__PURE__ */ Z(t, { id: " Product access" })]
|
|
1128
1128
|
}) }), /* @__PURE__ */ Q(R, {
|
|
1129
1129
|
className: te,
|
|
1130
|
-
children: [/* @__PURE__ */ Q(I, { children: [/* @__PURE__ */ Z(z, { children: /* @__PURE__ */ Z(
|
|
1130
|
+
children: [/* @__PURE__ */ Q(I, { children: [/* @__PURE__ */ Z(z, { children: /* @__PURE__ */ Z(t, { id: "Grant product access" }) }), /* @__PURE__ */ Z(B, { children: /* @__PURE__ */ Z(t, { id: "Give this customer one of your products without a payment. They hold its keys while the grant lasts, including keys you add to the product later." }) })] }), /* @__PURE__ */ Q("form", {
|
|
1131
1131
|
onSubmit: (e) => {
|
|
1132
1132
|
e.preventDefault(), e.stopPropagation(), _.handleSubmit();
|
|
1133
1133
|
},
|
|
@@ -1143,7 +1143,7 @@ function Me({ customerId: t }) {
|
|
|
1143
1143
|
children: [
|
|
1144
1144
|
/* @__PURE__ */ Z(H, {
|
|
1145
1145
|
htmlFor: u("pa-product"),
|
|
1146
|
-
children: /* @__PURE__ */ Z(
|
|
1146
|
+
children: /* @__PURE__ */ Z(t, { id: "Product" })
|
|
1147
1147
|
}),
|
|
1148
1148
|
/* @__PURE__ */ Q(w, {
|
|
1149
1149
|
value: e.state.value,
|
|
@@ -1174,11 +1174,11 @@ function Me({ customerId: t }) {
|
|
|
1174
1174
|
children: [
|
|
1175
1175
|
/* @__PURE__ */ Z(H, {
|
|
1176
1176
|
htmlFor: u("pa-duration"),
|
|
1177
|
-
children: /* @__PURE__ */ Z(
|
|
1177
|
+
children: /* @__PURE__ */ Z(t, { id: "How long it lasts" })
|
|
1178
1178
|
}),
|
|
1179
1179
|
/* @__PURE__ */ Z("p", {
|
|
1180
1180
|
className: "text-[13px] text-muted-foreground",
|
|
1181
|
-
children: /* @__PURE__ */ Z(
|
|
1181
|
+
children: /* @__PURE__ */ Z(t, { id: "Days are added after any access they already have." })
|
|
1182
1182
|
}),
|
|
1183
1183
|
/* @__PURE__ */ Q(w, {
|
|
1184
1184
|
items: Se.map((e) => ({
|
|
@@ -1211,7 +1211,7 @@ function Me({ customerId: t }) {
|
|
|
1211
1211
|
children: [
|
|
1212
1212
|
/* @__PURE__ */ Z(H, {
|
|
1213
1213
|
htmlFor: u("pa-until"),
|
|
1214
|
-
children: /* @__PURE__ */ Z(
|
|
1214
|
+
children: /* @__PURE__ */ Z(t, { id: "Last day (UTC)" })
|
|
1215
1215
|
}),
|
|
1216
1216
|
/* @__PURE__ */ Z(c, {
|
|
1217
1217
|
id: u("pa-until"),
|
|
@@ -1233,7 +1233,7 @@ function Me({ customerId: t }) {
|
|
|
1233
1233
|
className: "grid gap-1.5",
|
|
1234
1234
|
children: [/* @__PURE__ */ Z(H, {
|
|
1235
1235
|
htmlFor: u("pa-note"),
|
|
1236
|
-
children: /* @__PURE__ */ Z(
|
|
1236
|
+
children: /* @__PURE__ */ Z(t, { id: "Note" })
|
|
1237
1237
|
}), /* @__PURE__ */ Z(c, {
|
|
1238
1238
|
id: u("pa-note"),
|
|
1239
1239
|
value: e.state.value,
|
|
@@ -1251,16 +1251,16 @@ function Me({ customerId: t }) {
|
|
|
1251
1251
|
e.isSubmitting,
|
|
1252
1252
|
we(e.values.duration, e.values.until) !== null
|
|
1253
1253
|
],
|
|
1254
|
-
children: ([e,
|
|
1254
|
+
children: ([e, n, r, i]) => /* @__PURE__ */ Q(oe, { children: [/* @__PURE__ */ Z(s, {
|
|
1255
1255
|
type: "button",
|
|
1256
1256
|
variant: "outline",
|
|
1257
|
-
disabled:
|
|
1257
|
+
disabled: r,
|
|
1258
1258
|
onClick: () => v(!1),
|
|
1259
|
-
children: /* @__PURE__ */ Z(
|
|
1259
|
+
children: /* @__PURE__ */ Z(t, { id: "Cancel" })
|
|
1260
1260
|
}), /* @__PURE__ */ Z(s, {
|
|
1261
1261
|
type: "submit",
|
|
1262
|
-
disabled: !e || !
|
|
1263
|
-
children:
|
|
1262
|
+
disabled: !e || !n || r || !i,
|
|
1263
|
+
children: r ? "Granting…" : "Grant access"
|
|
1264
1264
|
})] })
|
|
1265
1265
|
}) })]
|
|
1266
1266
|
})]
|
|
@@ -1272,7 +1272,7 @@ function Ne({ contact: e }) {
|
|
|
1272
1272
|
className: "pb-1",
|
|
1273
1273
|
children: /* @__PURE__ */ Z(W, {
|
|
1274
1274
|
className: "text-sm",
|
|
1275
|
-
children: /* @__PURE__ */ Z(
|
|
1275
|
+
children: /* @__PURE__ */ Z(t, { id: "Contact" })
|
|
1276
1276
|
})
|
|
1277
1277
|
}), /* @__PURE__ */ Z(G, {
|
|
1278
1278
|
className: "text-sm",
|
|
@@ -1281,7 +1281,7 @@ function Ne({ contact: e }) {
|
|
|
1281
1281
|
children: [
|
|
1282
1282
|
/* @__PURE__ */ Z("dt", {
|
|
1283
1283
|
className: "text-muted-foreground",
|
|
1284
|
-
children: /* @__PURE__ */ Z(
|
|
1284
|
+
children: /* @__PURE__ */ Z(t, { id: "Email" })
|
|
1285
1285
|
}),
|
|
1286
1286
|
/* @__PURE__ */ Z("dd", {
|
|
1287
1287
|
className: "truncate",
|
|
@@ -1289,7 +1289,7 @@ function Ne({ contact: e }) {
|
|
|
1289
1289
|
}),
|
|
1290
1290
|
/* @__PURE__ */ Z("dt", {
|
|
1291
1291
|
className: "text-muted-foreground",
|
|
1292
|
-
children: /* @__PURE__ */ Z(
|
|
1292
|
+
children: /* @__PURE__ */ Z(t, { id: "Name" })
|
|
1293
1293
|
}),
|
|
1294
1294
|
/* @__PURE__ */ Z("dd", {
|
|
1295
1295
|
className: "truncate",
|
|
@@ -1297,7 +1297,7 @@ function Ne({ contact: e }) {
|
|
|
1297
1297
|
}),
|
|
1298
1298
|
/* @__PURE__ */ Z("dt", {
|
|
1299
1299
|
className: "text-muted-foreground",
|
|
1300
|
-
children: /* @__PURE__ */ Z(
|
|
1300
|
+
children: /* @__PURE__ */ Z(t, { id: "Username" })
|
|
1301
1301
|
}),
|
|
1302
1302
|
/* @__PURE__ */ Z("dd", {
|
|
1303
1303
|
className: "truncate",
|
|
@@ -1305,14 +1305,14 @@ function Ne({ contact: e }) {
|
|
|
1305
1305
|
}),
|
|
1306
1306
|
e.active !== null && /* @__PURE__ */ Q(oe, { children: [/* @__PURE__ */ Z("dt", {
|
|
1307
1307
|
className: "text-muted-foreground",
|
|
1308
|
-
children: /* @__PURE__ */ Z(
|
|
1308
|
+
children: /* @__PURE__ */ Z(t, { id: "Directory" })
|
|
1309
1309
|
}), /* @__PURE__ */ Z("dd", { children: /* @__PURE__ */ Z(P, {
|
|
1310
1310
|
variant: e.active ? "secondary" : "outline",
|
|
1311
1311
|
children: e.active ? "Active" : "Deactivated"
|
|
1312
1312
|
}) })] }),
|
|
1313
1313
|
/* @__PURE__ */ Z("dt", {
|
|
1314
1314
|
className: "text-muted-foreground",
|
|
1315
|
-
children: /* @__PURE__ */ Z(
|
|
1315
|
+
children: /* @__PURE__ */ Z(t, { id: "Synced" })
|
|
1316
1316
|
}),
|
|
1317
1317
|
/* @__PURE__ */ Z("dd", {
|
|
1318
1318
|
className: "tabular-nums",
|
|
@@ -1321,11 +1321,11 @@ function Ne({ contact: e }) {
|
|
|
1321
1321
|
]
|
|
1322
1322
|
}) : /* @__PURE__ */ Z("p", {
|
|
1323
1323
|
className: "text-muted-foreground",
|
|
1324
|
-
children: /* @__PURE__ */ Z(
|
|
1324
|
+
children: /* @__PURE__ */ Z(t, { id: "Your directory holds no contact for this customer." })
|
|
1325
1325
|
})
|
|
1326
1326
|
})] });
|
|
1327
1327
|
}
|
|
1328
1328
|
//#endregion
|
|
1329
1329
|
export { Te as CustomerDetailPage };
|
|
1330
1330
|
|
|
1331
|
-
//# sourceMappingURL=admin-detail-
|
|
1331
|
+
//# sourceMappingURL=admin-detail-CRzFb_pa.js.map
|