@openrails/billing-ui 0.267.0 → 0.268.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 +10 -0
- package/dist/admin/lib/api/endpoints.d.ts +6 -1
- package/dist/admin/lib/api/index.d.ts +5 -0
- package/dist/admin/pages/settings/custody.d.ts +2 -0
- package/dist/{admin-attempts-Er03x8r3.js → admin-attempts-BLeeKABa.js} +8 -8
- package/dist/{admin-attempts-Er03x8r3.js.map → admin-attempts-BLeeKABa.js.map} +1 -1
- package/dist/{admin-auth-B0lzGq-I.js → admin-auth-DWVWxDup.js} +2 -2
- package/dist/{admin-auth-B0lzGq-I.js.map → admin-auth-DWVWxDup.js.map} +1 -1
- package/dist/{admin-badge-D9bk3V0z.js → admin-badge-CrEqD9Ew.js} +2 -2
- package/dist/{admin-badge-D9bk3V0z.js.map → admin-badge-CrEqD9Ew.js.map} +1 -1
- package/dist/{admin-button-UgWgU33l.js → admin-button-a7bDFgp0.js} +2 -2
- package/dist/{admin-button-UgWgU33l.js.map → admin-button-a7bDFgp0.js.map} +1 -1
- package/dist/{admin-capabilities-6ztIoqOe.js → admin-capabilities-QYUuJXvG.js} +2 -2
- package/dist/{admin-capabilities-6ztIoqOe.js.map → admin-capabilities-QYUuJXvG.js.map} +1 -1
- package/dist/{admin-card-T3w9wVwC.js → admin-card-D1tz8Lbh.js} +2 -2
- package/dist/{admin-card-T3w9wVwC.js.map → admin-card-D1tz8Lbh.js.map} +1 -1
- package/dist/{admin-catalog-BBMTQ4IE.js → admin-catalog-ggiDgWsR.js} +18 -18
- package/dist/{admin-catalog-BBMTQ4IE.js.map → admin-catalog-ggiDgWsR.js.map} +1 -1
- package/dist/{admin-customers-Cj9lIBFF.js → admin-customers-BVMg-gUv.js} +6 -6
- package/dist/{admin-customers-Cj9lIBFF.js.map → admin-customers-BVMg-gUv.js.map} +1 -1
- package/dist/{admin-dashboard-rDXWPRMx.js → admin-dashboard-Cc13i8i9.js} +14 -14
- package/dist/{admin-dashboard-rDXWPRMx.js.map → admin-dashboard-Cc13i8i9.js.map} +1 -1
- package/dist/{admin-data-table-tMoCx6BU.js → admin-data-table-BL84xKKF.js} +6 -6
- package/dist/{admin-data-table-tMoCx6BU.js.map → admin-data-table-BL84xKKF.js.map} +1 -1
- package/dist/{admin-detail-5tgzwBSQ.js → admin-detail-9YAep3ts.js} +460 -441
- package/dist/admin-detail-9YAep3ts.js.map +1 -0
- package/dist/{admin-detail-C_A8x02G.js → admin-detail-C8t5jBps.js} +11 -11
- package/dist/{admin-detail-C_A8x02G.js.map → admin-detail-C8t5jBps.js.map} +1 -1
- package/dist/{admin-detail-C4rto5hb.js → admin-detail-CaEwBdX9.js} +12 -12
- package/dist/{admin-detail-C4rto5hb.js.map → admin-detail-CaEwBdX9.js.map} +1 -1
- package/dist/{admin-detail-Cy4epidT.js → admin-detail-D2zcz_Xm.js} +15 -15
- package/dist/{admin-detail-Cy4epidT.js.map → admin-detail-D2zcz_Xm.js.map} +1 -1
- package/dist/{admin-dialog-DSB8NTS8.js → admin-dialog-CiAw5vx-.js} +3 -3
- package/dist/{admin-dialog-DSB8NTS8.js.map → admin-dialog-CiAw5vx-.js.map} +1 -1
- package/dist/{admin-dom-swaG6h-Z.js → admin-dom-VkcwevWr.js} +4 -4
- package/dist/{admin-dom-swaG6h-Z.js.map → admin-dom-VkcwevWr.js.map} +1 -1
- package/dist/{admin-dropdown-menu-BiJgFZEK.js → admin-dropdown-menu-CYJbmqK2.js} +2 -2
- package/dist/{admin-dropdown-menu-BiJgFZEK.js.map → admin-dropdown-menu-CYJbmqK2.js.map} +1 -1
- package/dist/{admin-fact-card-DOmtzhDS.js → admin-fact-card-BHTpDlaX.js} +2 -2
- package/dist/{admin-fact-card-DOmtzhDS.js.map → admin-fact-card-BHTpDlaX.js.map} +1 -1
- package/dist/{admin-health-Cb_vCGip.js → admin-health-BUnjbvYR.js} +9 -9
- package/dist/{admin-health-Cb_vCGip.js.map → admin-health-BUnjbvYR.js.map} +1 -1
- package/dist/{admin-input-B6FrJxfC.js → admin-input-C-S_RGGo.js} +2 -2
- package/dist/{admin-input-B6FrJxfC.js.map → admin-input-C-S_RGGo.js.map} +1 -1
- package/dist/{admin-label-BYiPss0j.js → admin-label-DPVYDdSO.js} +2 -2
- package/dist/{admin-label-BYiPss0j.js.map → admin-label-DPVYDdSO.js.map} +1 -1
- package/dist/{admin-linked-table-row-g5Q4eMOC.js → admin-linked-table-row-D-gbTT7a.js} +4 -4
- package/dist/{admin-linked-table-row-g5Q4eMOC.js.map → admin-linked-table-row-D-gbTT7a.js.map} +1 -1
- package/dist/{admin-metering-BznnYhgX.js → admin-metering-BjbL0jjT.js} +14 -14
- package/dist/{admin-metering-BznnYhgX.js.map → admin-metering-BjbL0jjT.js.map} +1 -1
- package/dist/{admin-ops-DOCIYTjD.js → admin-ops-DT8epiXg.js} +11 -11
- package/dist/{admin-ops-DOCIYTjD.js.map → admin-ops-DT8epiXg.js.map} +1 -1
- package/dist/{admin-orders-DYbdiO07.js → admin-orders-BVW9-Fs9.js} +8 -8
- package/dist/{admin-orders-DYbdiO07.js.map → admin-orders-BVW9-Fs9.js.map} +1 -1
- package/dist/{admin-payments-DQgZR7J5.js → admin-payments-C5MsFFmm.js} +9 -9
- package/dist/{admin-payments-DQgZR7J5.js.map → admin-payments-C5MsFFmm.js.map} +1 -1
- package/dist/{admin-price-detail-BvUo5pVr.js → admin-price-detail-D517JYHB.js} +9 -9
- package/dist/{admin-price-detail-BvUo5pVr.js.map → admin-price-detail-D517JYHB.js.map} +1 -1
- package/dist/{admin-price-wizard-D8c-vvzV.js → admin-price-wizard-bj36o3ux.js} +7 -7
- package/dist/{admin-price-wizard-D8c-vvzV.js.map → admin-price-wizard-bj36o3ux.js.map} +1 -1
- package/dist/{admin-range-picker-C2lZ51RS.js → admin-range-picker-D2aFF8IV.js} +5 -5
- package/dist/{admin-range-picker-C2lZ51RS.js.map → admin-range-picker-D2aFF8IV.js.map} +1 -1
- package/dist/{admin-reports-CYwfX2qK.js → admin-reports-D-ob04d4.js} +8 -8
- package/dist/{admin-reports-CYwfX2qK.js.map → admin-reports-D-ob04d4.js.map} +1 -1
- package/dist/{admin-select-OMB6gB61.js → admin-select-C8O7nx72.js} +2 -2
- package/dist/{admin-select-OMB6gB61.js.map → admin-select-C8O7nx72.js.map} +1 -1
- package/dist/{admin-settings-Bw49HU8g.js → admin-settings-Bs6cLcqi.js} +374 -98
- package/dist/admin-settings-Bs6cLcqi.js.map +1 -0
- package/dist/{admin-skeleton-DeY6aCVy.js → admin-skeleton-wfocg2PJ.js} +2 -2
- package/dist/{admin-skeleton-DeY6aCVy.js.map → admin-skeleton-wfocg2PJ.js.map} +1 -1
- package/dist/{admin-status-badge-DENiR55N.js → admin-status-badge-D_gDMrht.js} +2 -2
- package/dist/{admin-status-badge-DENiR55N.js.map → admin-status-badge-D_gDMrht.js.map} +1 -1
- package/dist/{admin-subscriptions-BU3WGg3F.js → admin-subscriptions-DYR1RGMO.js} +9 -9
- package/dist/{admin-subscriptions-BU3WGg3F.js.map → admin-subscriptions-DYR1RGMO.js.map} +1 -1
- package/dist/{admin-switch-DLdWpESJ.js → admin-switch-F5D0AYjT.js} +2 -2
- package/dist/{admin-switch-DLdWpESJ.js.map → admin-switch-F5D0AYjT.js.map} +1 -1
- package/dist/{admin-table-BRh16qQu.js → admin-table-nUij5fLc.js} +2 -2
- package/dist/{admin-table-BRh16qQu.js.map → admin-table-nUij5fLc.js.map} +1 -1
- package/dist/{admin-tabs-BXJWVtU7.js → admin-tabs-C3myjKdr.js} +2 -2
- package/dist/{admin-tabs-BXJWVtU7.js.map → admin-tabs-C3myjKdr.js.map} +1 -1
- package/dist/{admin-textarea-Dv8Ob7H2.js → admin-textarea-v-L-PXIc.js} +2 -2
- package/dist/{admin-textarea-Dv8Ob7H2.js.map → admin-textarea-v-L-PXIc.js.map} +1 -1
- package/dist/{admin-typed-confirm-dialog-D0R5nKD0.js → admin-typed-confirm-dialog-BLgpuikW.js} +6 -6
- package/dist/{admin-typed-confirm-dialog-D0R5nKD0.js.map → admin-typed-confirm-dialog-BLgpuikW.js.map} +1 -1
- package/dist/{admin-utils-BE_Zb14A.js → admin-utils-6yE4YIVI.js} +22 -16
- package/dist/admin-utils-6yE4YIVI.js.map +1 -0
- package/dist/{admin-widget-viz-BvejlYLH.js → admin-widget-viz-BiEfckd4.js} +3 -3
- package/dist/{admin-widget-viz-BvejlYLH.js.map → admin-widget-viz-BiEfckd4.js.map} +1 -1
- package/dist/admin.css +1 -1
- package/dist/admin.js +30 -30
- package/dist/admin.js.map +1 -1
- package/dist/client/client.d.ts +4 -14
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/routes.d.ts +82 -270
- package/dist/client/generated/wire.d.ts +30 -38
- package/dist/client/index.d.ts +1 -1
- package/dist/client/types.d.ts +13 -22
- package/dist/{client-BzxvN5zw.js → client-BYgnI6_h.js} +59 -76
- package/dist/client-BYgnI6_h.js.map +1 -0
- package/dist/client.js +1 -1
- package/dist/{hooks-Cc95yC4f.js → hooks-t2tSrCpa.js} +2 -2
- package/dist/{hooks-Cc95yC4f.js.map → hooks-t2tSrCpa.js.map} +1 -1
- package/dist/index.js +3 -3
- package/dist/react.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/admin-detail-5tgzwBSQ.js.map +0 -1
- package/dist/admin-settings-Bw49HU8g.js.map +0 -1
- package/dist/admin-utils-BE_Zb14A.js.map +0 -1
- package/dist/client-BzxvN5zw.js.map +0 -1
|
@@ -1,48 +1,49 @@
|
|
|
1
|
-
import { E as e, c as t, f as n, p as r, r as i, s as a, w as o } from "./admin-utils-
|
|
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 { E as e, c as t, f as n, p as r, r as i, s as a, w as o } from "./admin-utils-6yE4YIVI.js";
|
|
2
|
+
import { t as s } from "./admin-button-a7bDFgp0.js";
|
|
3
|
+
import { t as c } from "./admin-input-C-S_RGGo.js";
|
|
4
|
+
import { a as l } from "./admin-capabilities-QYUuJXvG.js";
|
|
5
|
+
import { t as u } from "./admin-auth-DWVWxDup.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
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { n as
|
|
10
|
-
import {
|
|
11
|
-
import { t as M } from "./admin-
|
|
12
|
-
import { t as N } from "./admin-
|
|
13
|
-
import { t as P } from "./admin-
|
|
14
|
-
import {
|
|
15
|
-
import { t as V } from "./admin-
|
|
7
|
+
import { n as v } from "./admin-confirm-katGq0Qo.js";
|
|
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-C8O7nx72.js";
|
|
10
|
+
import { n as T, r as E } from "./admin-dom-VkcwevWr.js";
|
|
11
|
+
import { a as D, n as O, o as k, r as A, s as j, t as M } from "./admin-table-nUij5fLc.js";
|
|
12
|
+
import { t as N } from "./admin-linked-table-row-D-gbTT7a.js";
|
|
13
|
+
import { t as P } from "./admin-badge-CrEqD9Ew.js";
|
|
14
|
+
import { t as F } from "./admin-status-badge-D_gDMrht.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-CiAw5vx-.js";
|
|
16
|
+
import { t as H } from "./admin-label-DPVYDdSO.js";
|
|
16
17
|
import { n as te } from "./admin-dialog-width-BPrgdYlj.js";
|
|
17
|
-
import { a as
|
|
18
|
+
import { a as U, o as W, r as G, t as K } from "./admin-card-D1tz8Lbh.js";
|
|
18
19
|
import { n as ne, t as re } from "./admin-invoice-profile-model-Cgjy3zV8.js";
|
|
19
20
|
import { t as ie } from "./admin-dunning-B2zgtrOo.js";
|
|
20
|
-
import * as
|
|
21
|
+
import * as q from "react";
|
|
21
22
|
import { useState as ae } from "react";
|
|
22
|
-
import { useMutation as
|
|
23
|
-
import { Fragment as oe, jsx as
|
|
24
|
-
import { HugeiconsIcon as
|
|
25
|
-
import { Add01Icon as
|
|
26
|
-
import { useForm as
|
|
23
|
+
import { useMutation as J, useQuery as Y, useQueryClient as X } from "@tanstack/react-query";
|
|
24
|
+
import { Fragment as oe, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
25
|
+
import { HugeiconsIcon as se } from "@hugeicons/react";
|
|
26
|
+
import { Add01Icon as ce, ArrowLeft01Icon as le, Delete02Icon as ue } from "@hugeicons/core-free-icons";
|
|
27
|
+
import { useForm as de } from "@tanstack/react-form";
|
|
27
28
|
//#region src/admin/pages/customers/invoice-profile.tsx
|
|
28
|
-
function
|
|
29
|
-
let { orderQueries: t } = r(), n = l(), a =
|
|
30
|
-
return /* @__PURE__ */
|
|
29
|
+
function fe({ customerId: e }) {
|
|
30
|
+
let { orderQueries: t } = r(), n = l(), a = Y(t.profile(e));
|
|
31
|
+
return /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Z(U, { children: /* @__PURE__ */ Z(W, { children: /* @__PURE__ */ Z(o, { id: "Invoice profile" }) }) }), /* @__PURE__ */ Q(G, { children: [/* @__PURE__ */ Z(i, {
|
|
31
32
|
className: "text-sm underline",
|
|
32
33
|
to: `/orders?customer_id=${e}&origin=usage`,
|
|
33
|
-
children: /* @__PURE__ */
|
|
34
|
-
}), a.isPending ? /* @__PURE__ */
|
|
34
|
+
children: /* @__PURE__ */ Z(o, { id: "View customer usage orders" })
|
|
35
|
+
}), a.isPending ? /* @__PURE__ */ Z("p", { children: /* @__PURE__ */ Z(o, { id: "Loading invoice profile…" }) }) : a.error ? /* @__PURE__ */ Z("p", {
|
|
35
36
|
role: "alert",
|
|
36
37
|
className: "text-destructive",
|
|
37
38
|
children: a.error.message
|
|
38
|
-
}) : /* @__PURE__ */
|
|
39
|
+
}) : /* @__PURE__ */ Z(pe, {
|
|
39
40
|
customerId: e,
|
|
40
41
|
profile: a.data,
|
|
41
42
|
readOnly: !n
|
|
42
43
|
}, e)] })] });
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
-
let { id: a, text: l } = e(), { invoiceProfileMutation: u } = r(), [d, f] = ae(() => ne(n)), [p, m] = ae(null), [h, g] = ae(!1), _ =
|
|
45
|
+
function pe({ customerId: t, profile: n, readOnly: i = !1 }) {
|
|
46
|
+
let { id: a, text: l } = e(), { invoiceProfileMutation: u } = r(), [d, f] = ae(() => ne(n)), [p, m] = ae(null), [h, g] = ae(!1), _ = X(), v = J(u(_, t)), y = (e) => {
|
|
46
47
|
f((t) => ({
|
|
47
48
|
...t,
|
|
48
49
|
...e
|
|
@@ -56,76 +57,76 @@ function fe({ customerId: t, profile: n, readOnly: i = !1 }) {
|
|
|
56
57
|
m(e instanceof Error ? e.message : "Invoice profile update failed.");
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
+
return /* @__PURE__ */ Q("form", {
|
|
60
61
|
className: "mt-4 space-y-4",
|
|
61
62
|
onSubmit: (e) => {
|
|
62
63
|
e.preventDefault(), v.isPending || b();
|
|
63
64
|
},
|
|
64
65
|
children: [
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ Z("p", {
|
|
66
67
|
className: "text-sm text-muted-foreground",
|
|
67
|
-
children: /* @__PURE__ */
|
|
68
|
+
children: /* @__PURE__ */ Z(o, { id: "Terms and billing facts for future usage orders. Billed orders keep their original snapshots. Tax details are recorded; no tax is calculated." })
|
|
68
69
|
}),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ Q("fieldset", {
|
|
70
71
|
disabled: i || v.isPending,
|
|
71
72
|
className: "space-y-4",
|
|
72
73
|
children: [
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ Q("div", {
|
|
74
75
|
className: "grid gap-3 sm:grid-cols-2",
|
|
75
|
-
children: [/* @__PURE__ */
|
|
76
|
+
children: [/* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z(H, {
|
|
76
77
|
htmlFor: a("invoice-profile-terms"),
|
|
77
|
-
children: /* @__PURE__ */
|
|
78
|
-
}), /* @__PURE__ */
|
|
78
|
+
children: /* @__PURE__ */ Z(o, { id: "Payment terms (days)" })
|
|
79
|
+
}), /* @__PURE__ */ Z(c, {
|
|
79
80
|
id: a("invoice-profile-terms"),
|
|
80
81
|
type: "number",
|
|
81
82
|
min: 0,
|
|
82
83
|
step: 1,
|
|
83
84
|
value: d.terms,
|
|
84
85
|
onChange: (e) => y({ terms: e.target.value })
|
|
85
|
-
})] }), /* @__PURE__ */
|
|
86
|
+
})] }), /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z(H, {
|
|
86
87
|
htmlFor: a("invoice-profile-method"),
|
|
87
|
-
children: /* @__PURE__ */
|
|
88
|
-
}), /* @__PURE__ */
|
|
88
|
+
children: /* @__PURE__ */ Z(o, { id: "Collection method" })
|
|
89
|
+
}), /* @__PURE__ */ Q("select", {
|
|
89
90
|
id: a("invoice-profile-method"),
|
|
90
91
|
className: "h-9 w-full rounded-md border bg-background px-2",
|
|
91
92
|
value: d.method,
|
|
92
93
|
onChange: (e) => y({ method: e.target.value }),
|
|
93
|
-
children: [/* @__PURE__ */
|
|
94
|
+
children: [/* @__PURE__ */ Z("option", {
|
|
94
95
|
value: "charge_automatically",
|
|
95
|
-
children: /* @__PURE__ */
|
|
96
|
-
}), /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ Z(o, { id: "Saved payment method" })
|
|
97
|
+
}), /* @__PURE__ */ Z("option", {
|
|
97
98
|
value: "send_invoice",
|
|
98
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ Z(o, { id: "Manual remittance" })
|
|
99
100
|
})]
|
|
100
101
|
})] })]
|
|
101
102
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z(H, {
|
|
103
104
|
htmlFor: a("invoice-profile-po"),
|
|
104
|
-
children: /* @__PURE__ */
|
|
105
|
-
}), /* @__PURE__ */
|
|
105
|
+
children: /* @__PURE__ */ Z(o, { id: "Purchase order" })
|
|
106
|
+
}), /* @__PURE__ */ Z(c, {
|
|
106
107
|
id: a("invoice-profile-po"),
|
|
107
108
|
value: d.po,
|
|
108
109
|
onChange: (e) => y({ po: e.target.value })
|
|
109
110
|
})] }),
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z(H, {
|
|
111
112
|
htmlFor: a("invoice-profile-memo"),
|
|
112
|
-
children: /* @__PURE__ */
|
|
113
|
-
}), /* @__PURE__ */
|
|
113
|
+
children: /* @__PURE__ */ Z(o, { id: "Invoice memo" })
|
|
114
|
+
}), /* @__PURE__ */ Z(c, {
|
|
114
115
|
id: a("invoice-profile-memo"),
|
|
115
116
|
value: d.memo,
|
|
116
117
|
onChange: (e) => y({ memo: e.target.value })
|
|
117
118
|
})] }),
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ Q("div", {
|
|
119
120
|
className: "space-y-2",
|
|
120
121
|
children: [
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ Z("p", {
|
|
122
123
|
className: "text-sm font-medium",
|
|
123
|
-
children: /* @__PURE__ */
|
|
124
|
+
children: /* @__PURE__ */ Z(o, { id: "Billing contacts" })
|
|
124
125
|
}),
|
|
125
|
-
d.contacts.map((e, t) => /* @__PURE__ */
|
|
126
|
+
d.contacts.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
126
127
|
className: "flex gap-2",
|
|
127
128
|
children: [
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ Z(c, {
|
|
129
130
|
"aria-label": `Contact ${t + 1} name`,
|
|
130
131
|
placeholder: l("Name"),
|
|
131
132
|
value: e.name,
|
|
@@ -134,7 +135,7 @@ function fe({ customerId: t, profile: n, readOnly: i = !1 }) {
|
|
|
134
135
|
name: e.target.value
|
|
135
136
|
} : n) })
|
|
136
137
|
}),
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ Z(c, {
|
|
138
139
|
"aria-label": `Contact ${t + 1} email`,
|
|
139
140
|
type: "email",
|
|
140
141
|
placeholder: l("Email"),
|
|
@@ -144,37 +145,37 @@ function fe({ customerId: t, profile: n, readOnly: i = !1 }) {
|
|
|
144
145
|
email: e.target.value
|
|
145
146
|
} : n) })
|
|
146
147
|
}),
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ Z(s, {
|
|
148
149
|
type: "button",
|
|
149
150
|
variant: "outline",
|
|
150
151
|
"aria-label": `Remove contact ${t + 1}`,
|
|
151
152
|
onClick: () => y({ contacts: d.contacts.filter((e, n) => n !== t) }),
|
|
152
|
-
children: /* @__PURE__ */
|
|
153
|
+
children: /* @__PURE__ */ Z(o, { id: "Remove" })
|
|
153
154
|
})
|
|
154
155
|
]
|
|
155
156
|
}, t)),
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
+
/* @__PURE__ */ Z(s, {
|
|
157
158
|
type: "button",
|
|
158
159
|
variant: "outline",
|
|
159
160
|
onClick: () => y({ contacts: [...d.contacts, {
|
|
160
161
|
name: "",
|
|
161
162
|
email: ""
|
|
162
163
|
}] }),
|
|
163
|
-
children: /* @__PURE__ */
|
|
164
|
+
children: /* @__PURE__ */ Z(o, { id: "Add contact" })
|
|
164
165
|
})
|
|
165
166
|
]
|
|
166
167
|
}),
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ Q("div", {
|
|
168
169
|
className: "space-y-2",
|
|
169
170
|
children: [
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ Z("p", {
|
|
171
172
|
className: "text-sm font-medium",
|
|
172
|
-
children: /* @__PURE__ */
|
|
173
|
+
children: /* @__PURE__ */ Z(o, { id: "Tax details" })
|
|
173
174
|
}),
|
|
174
|
-
d.tax.map((e, t) => /* @__PURE__ */
|
|
175
|
+
d.tax.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
175
176
|
className: "flex gap-2",
|
|
176
177
|
children: [
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
+
/* @__PURE__ */ Z(c, {
|
|
178
179
|
"aria-label": `Tax detail ${t + 1} name`,
|
|
179
180
|
placeholder: l("Name, such as tax_id"),
|
|
180
181
|
value: e.key,
|
|
@@ -183,7 +184,7 @@ function fe({ customerId: t, profile: n, readOnly: i = !1 }) {
|
|
|
183
184
|
key: e.target.value
|
|
184
185
|
} : n) })
|
|
185
186
|
}),
|
|
186
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ Z(c, {
|
|
187
188
|
"aria-label": `Tax detail ${t + 1} value`,
|
|
188
189
|
placeholder: l("Value"),
|
|
189
190
|
value: e.value,
|
|
@@ -192,39 +193,39 @@ function fe({ customerId: t, profile: n, readOnly: i = !1 }) {
|
|
|
192
193
|
value: e.target.value
|
|
193
194
|
} : n) })
|
|
194
195
|
}),
|
|
195
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ Z(s, {
|
|
196
197
|
type: "button",
|
|
197
198
|
variant: "outline",
|
|
198
199
|
"aria-label": `Remove tax detail ${t + 1}`,
|
|
199
200
|
onClick: () => y({ tax: d.tax.filter((e, n) => n !== t) }),
|
|
200
|
-
children: /* @__PURE__ */
|
|
201
|
+
children: /* @__PURE__ */ Z(o, { id: "Remove" })
|
|
201
202
|
})
|
|
202
203
|
]
|
|
203
204
|
}, t)),
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ Z(s, {
|
|
205
206
|
type: "button",
|
|
206
207
|
variant: "outline",
|
|
207
208
|
onClick: () => y({ tax: [...d.tax, {
|
|
208
209
|
key: "",
|
|
209
210
|
value: ""
|
|
210
211
|
}] }),
|
|
211
|
-
children: /* @__PURE__ */
|
|
212
|
+
children: /* @__PURE__ */ Z(o, { id: "Add tax detail" })
|
|
212
213
|
})
|
|
213
214
|
]
|
|
214
215
|
})
|
|
215
216
|
]
|
|
216
217
|
}),
|
|
217
|
-
p && /* @__PURE__ */
|
|
218
|
+
p && /* @__PURE__ */ Z("p", {
|
|
218
219
|
role: "alert",
|
|
219
220
|
className: "text-destructive",
|
|
220
221
|
children: p
|
|
221
222
|
}),
|
|
222
|
-
h && /* @__PURE__ */
|
|
223
|
+
h && /* @__PURE__ */ Z("p", {
|
|
223
224
|
role: "status",
|
|
224
225
|
className: "text-sm",
|
|
225
|
-
children: /* @__PURE__ */
|
|
226
|
+
children: /* @__PURE__ */ Z(o, { id: "Invoice profile saved. Billed orders were not changed." })
|
|
226
227
|
}),
|
|
227
|
-
!i && /* @__PURE__ */
|
|
228
|
+
!i && /* @__PURE__ */ Z(s, {
|
|
228
229
|
type: "submit",
|
|
229
230
|
disabled: v.isPending,
|
|
230
231
|
children: v.isPending ? "Saving…" : "Save invoice profile"
|
|
@@ -234,16 +235,16 @@ function fe({ customerId: t, profile: n, readOnly: i = !1 }) {
|
|
|
234
235
|
}
|
|
235
236
|
//#endregion
|
|
236
237
|
//#region src/admin/pages/customers/default-card-badges.tsx
|
|
237
|
-
function
|
|
238
|
-
return /* @__PURE__ */
|
|
238
|
+
function me({ currencies: e = [] }) {
|
|
239
|
+
return /* @__PURE__ */ Z(oe, { children: e.map((e) => /* @__PURE__ */ Q(P, {
|
|
239
240
|
variant: "secondary",
|
|
240
241
|
className: "mt-1 mr-1",
|
|
241
|
-
children: [/* @__PURE__ */
|
|
242
|
+
children: [/* @__PURE__ */ Z(o, { id: "Default · " }), e]
|
|
242
243
|
}, e)) });
|
|
243
244
|
}
|
|
244
245
|
//#endregion
|
|
245
246
|
//#region src/admin/pages/customers/credit-form.ts
|
|
246
|
-
function
|
|
247
|
+
function he(e, t = Date.now()) {
|
|
247
248
|
let n = g(e.amount, e.decimals);
|
|
248
249
|
if (n === null || BigInt(n) <= 0n) throw Error(`Enter a positive amount with at most ${e.decimals} decimal places, within the supported range.`);
|
|
249
250
|
let r = e.currency.trim();
|
|
@@ -263,11 +264,11 @@ function me(e, t = Date.now()) {
|
|
|
263
264
|
description: e.description.trim() || void 0
|
|
264
265
|
};
|
|
265
266
|
}
|
|
266
|
-
function
|
|
267
|
+
function ge(e) {
|
|
267
268
|
return (e.state === "active" || e.state === "scheduled") && /^\d+$/.test(e.remaining_amount) && BigInt(e.remaining_amount) > 0n;
|
|
268
269
|
}
|
|
269
|
-
function
|
|
270
|
-
if (!
|
|
270
|
+
function _e(e, t) {
|
|
271
|
+
if (!ge(e)) throw Error("This grant has no remaining credit to revoke.");
|
|
271
272
|
if (t = t.trim(), !t || t.length > 500) throw Error("Enter a reason of up to 500 characters.");
|
|
272
273
|
return {
|
|
273
274
|
grant: e.id,
|
|
@@ -277,102 +278,102 @@ function ge(e, t) {
|
|
|
277
278
|
//#endregion
|
|
278
279
|
//#region src/admin/pages/customers/credits.tsx
|
|
279
280
|
var $ = (e) => e instanceof Error ? e.message : "The request failed. Try again.";
|
|
280
|
-
function
|
|
281
|
+
function ve({ customerId: e, currencies: t }) {
|
|
281
282
|
let { activeMerchant: n } = u(), r = n?.slug ?? "";
|
|
282
|
-
return /* @__PURE__ */
|
|
283
|
+
return /* @__PURE__ */ Z(ye, {
|
|
283
284
|
merchant: r,
|
|
284
285
|
customer: e,
|
|
285
286
|
initialCurrency: t[0] ?? "USD"
|
|
286
287
|
}, `${r}:${e}`);
|
|
287
288
|
}
|
|
288
|
-
function
|
|
289
|
-
let { id: a, text: u } = e(), { creditQueries: d } = r(), f = l(), [g, v] =
|
|
290
|
-
return /* @__PURE__ */
|
|
291
|
-
/* @__PURE__ */
|
|
289
|
+
function ye({ merchant: t, customer: n, initialCurrency: i }) {
|
|
290
|
+
let { id: a, text: u } = e(), { creditQueries: d } = r(), f = l(), [g, v] = q.useState(i), [y, b] = q.useState(i), x = E(g, 25), S = E(g, 25), [C, w] = q.useState(!1), [N, P] = q.useState(null), F = Y(d.grants(t, n, g, x.size, x.cursor)), I = Y(d.transactions(t, n, g, S.size, S.cursor)), L = p(g);
|
|
291
|
+
return /* @__PURE__ */ Q(K, { children: [
|
|
292
|
+
/* @__PURE__ */ Q(U, {
|
|
292
293
|
className: "gap-3",
|
|
293
294
|
children: [
|
|
294
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ Q("div", {
|
|
295
296
|
className: "flex items-center justify-between gap-3",
|
|
296
|
-
children: [/* @__PURE__ */
|
|
297
|
+
children: [/* @__PURE__ */ Z(W, {
|
|
297
298
|
className: "text-sm",
|
|
298
|
-
children: /* @__PURE__ */
|
|
299
|
-
}), f && /* @__PURE__ */
|
|
299
|
+
children: /* @__PURE__ */ Z(o, { id: "Credits" })
|
|
300
|
+
}), f && /* @__PURE__ */ Z(s, {
|
|
300
301
|
size: "sm",
|
|
301
302
|
disabled: L === void 0,
|
|
302
|
-
onClick: () =>
|
|
303
|
-
children: /* @__PURE__ */
|
|
303
|
+
onClick: () => w(!0),
|
|
304
|
+
children: /* @__PURE__ */ Z(o, { id: "Grant credit" })
|
|
304
305
|
})]
|
|
305
306
|
}),
|
|
306
|
-
/* @__PURE__ */
|
|
307
|
+
/* @__PURE__ */ Q("form", {
|
|
307
308
|
className: "flex max-w-sm items-end gap-2",
|
|
308
309
|
onSubmit: (e) => {
|
|
309
310
|
e.preventDefault();
|
|
310
311
|
let t = y.trim();
|
|
311
312
|
t && v(t.toUpperCase());
|
|
312
313
|
},
|
|
313
|
-
children: [/* @__PURE__ */
|
|
314
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
314
315
|
className: "grid gap-1",
|
|
315
|
-
children: [/* @__PURE__ */
|
|
316
|
+
children: [/* @__PURE__ */ Z(H, {
|
|
316
317
|
htmlFor: a("credit-currency"),
|
|
317
|
-
children: /* @__PURE__ */
|
|
318
|
-
}), /* @__PURE__ */
|
|
318
|
+
children: /* @__PURE__ */ Z(o, { id: "Currency" })
|
|
319
|
+
}), /* @__PURE__ */ Z(c, {
|
|
319
320
|
id: a("credit-currency"),
|
|
320
321
|
value: y,
|
|
321
322
|
onChange: (e) => b(e.target.value),
|
|
322
323
|
placeholder: u("USD")
|
|
323
324
|
})]
|
|
324
|
-
}), /* @__PURE__ */
|
|
325
|
+
}), /* @__PURE__ */ Z(s, {
|
|
325
326
|
type: "submit",
|
|
326
327
|
variant: "outline",
|
|
327
328
|
size: "sm",
|
|
328
|
-
children: /* @__PURE__ */
|
|
329
|
+
children: /* @__PURE__ */ Z(o, { id: "View" })
|
|
329
330
|
})]
|
|
330
331
|
}),
|
|
331
|
-
L === void 0 && /* @__PURE__ */
|
|
332
|
+
L === void 0 && /* @__PURE__ */ Q("p", {
|
|
332
333
|
className: "text-xs text-muted-foreground",
|
|
333
|
-
children: [g, /* @__PURE__ */
|
|
334
|
+
children: [g, /* @__PURE__ */ Z(o, { id: " is not a supported currency." })]
|
|
334
335
|
})
|
|
335
336
|
]
|
|
336
337
|
}),
|
|
337
|
-
/* @__PURE__ */
|
|
338
|
+
/* @__PURE__ */ Q(G, {
|
|
338
339
|
className: "grid gap-6",
|
|
339
|
-
children: [/* @__PURE__ */
|
|
340
|
+
children: [/* @__PURE__ */ Q("section", {
|
|
340
341
|
"aria-label": u("Credit grants"),
|
|
341
342
|
children: [
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
+
/* @__PURE__ */ Q("h3", {
|
|
343
344
|
className: "mb-2 text-sm font-medium",
|
|
344
|
-
children: [/* @__PURE__ */
|
|
345
|
+
children: [/* @__PURE__ */ Z(o, { id: "Grants · " }), g]
|
|
345
346
|
}),
|
|
346
|
-
F.isPending ? /* @__PURE__ */
|
|
347
|
+
F.isPending ? /* @__PURE__ */ Z("p", {
|
|
347
348
|
className: "text-sm text-muted-foreground",
|
|
348
|
-
children: /* @__PURE__ */
|
|
349
|
-
}) : F.error ? /* @__PURE__ */
|
|
349
|
+
children: /* @__PURE__ */ Z(o, { id: "Loading grants…" })
|
|
350
|
+
}) : F.error ? /* @__PURE__ */ Z("p", {
|
|
350
351
|
role: "alert",
|
|
351
352
|
className: "text-sm text-destructive",
|
|
352
353
|
children: $(F.error)
|
|
353
|
-
}) : F.data?.data.length ? /* @__PURE__ */
|
|
354
|
+
}) : F.data?.data.length ? /* @__PURE__ */ Z("div", {
|
|
354
355
|
className: "overflow-x-auto",
|
|
355
|
-
children: /* @__PURE__ */
|
|
356
|
-
/* @__PURE__ */
|
|
357
|
-
/* @__PURE__ */
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
-
/* @__PURE__ */
|
|
361
|
-
/* @__PURE__ */
|
|
362
|
-
/* @__PURE__ */
|
|
363
|
-
/* @__PURE__ */
|
|
364
|
-
/* @__PURE__ */
|
|
365
|
-
] }) }), /* @__PURE__ */
|
|
366
|
-
/* @__PURE__ */
|
|
367
|
-
/* @__PURE__ */
|
|
356
|
+
children: /* @__PURE__ */ Q(M, { children: [/* @__PURE__ */ Z(k, { children: /* @__PURE__ */ Q(j, { children: [
|
|
357
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(o, { id: "Grant" }) }),
|
|
358
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(o, { id: "Original" }) }),
|
|
359
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(o, { id: "Remaining" }) }),
|
|
360
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(o, { id: "Spent" }) }),
|
|
361
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(o, { id: "Expired" }) }),
|
|
362
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(o, { id: "Revoked" }) }),
|
|
363
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(o, { id: "State" }) }),
|
|
364
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(o, { id: "Expires" }) }),
|
|
365
|
+
/* @__PURE__ */ Z(D, {})
|
|
366
|
+
] }) }), /* @__PURE__ */ Z(O, { children: F.data.data.map((e) => /* @__PURE__ */ Q(j, { children: [
|
|
367
|
+
/* @__PURE__ */ Q(A, { children: [
|
|
368
|
+
/* @__PURE__ */ Z("span", {
|
|
368
369
|
title: e.id,
|
|
369
370
|
children: _(e.id)
|
|
370
371
|
}),
|
|
371
|
-
/* @__PURE__ */
|
|
372
|
+
/* @__PURE__ */ Z("div", {
|
|
372
373
|
className: "text-xs text-muted-foreground",
|
|
373
374
|
children: m(e.created_at)
|
|
374
375
|
}),
|
|
375
|
-
/* @__PURE__ */
|
|
376
|
+
/* @__PURE__ */ Z("div", {
|
|
376
377
|
className: "text-xs text-muted-foreground",
|
|
377
378
|
children: e.description ?? e.source_type
|
|
378
379
|
})
|
|
@@ -383,66 +384,66 @@ function ve({ merchant: t, customer: n, initialCurrency: i }) {
|
|
|
383
384
|
e.spent_amount,
|
|
384
385
|
e.expired_amount,
|
|
385
386
|
e.revoked_amount
|
|
386
|
-
].map((t, n) => /* @__PURE__ */
|
|
387
|
+
].map((t, n) => /* @__PURE__ */ Z(A, {
|
|
387
388
|
className: "tabular-nums",
|
|
388
389
|
children: h(t, e.currency)
|
|
389
390
|
}, n)),
|
|
390
|
-
/* @__PURE__ */
|
|
391
|
-
/* @__PURE__ */
|
|
392
|
-
/* @__PURE__ */
|
|
391
|
+
/* @__PURE__ */ Z(A, { children: e.state }),
|
|
392
|
+
/* @__PURE__ */ Z(A, { children: e.expires_at ? m(e.expires_at) : "No expiry" }),
|
|
393
|
+
/* @__PURE__ */ Z(A, { children: f && /* @__PURE__ */ Z(s, {
|
|
393
394
|
size: "sm",
|
|
394
395
|
variant: "outline",
|
|
395
|
-
disabled: !
|
|
396
|
+
disabled: !ge(e),
|
|
396
397
|
onClick: () => P(e),
|
|
397
|
-
children: /* @__PURE__ */
|
|
398
|
+
children: /* @__PURE__ */ Z(o, { id: "Revoke" })
|
|
398
399
|
}) })
|
|
399
400
|
] }, e.id)) })] })
|
|
400
|
-
}) : /* @__PURE__ */
|
|
401
|
+
}) : /* @__PURE__ */ Z("p", {
|
|
401
402
|
className: "text-sm text-muted-foreground",
|
|
402
|
-
children: /* @__PURE__ */
|
|
403
|
+
children: /* @__PURE__ */ Z(o, { id: "No credit grants in this currency." })
|
|
403
404
|
}),
|
|
404
|
-
/* @__PURE__ */
|
|
405
|
+
/* @__PURE__ */ Z(T, {
|
|
405
406
|
pages: x,
|
|
406
407
|
rows: F.data?.data?.length ?? 0,
|
|
407
408
|
nextCursor: F.data?.next_cursor,
|
|
408
409
|
busy: F.isFetching
|
|
409
410
|
})
|
|
410
411
|
]
|
|
411
|
-
}), /* @__PURE__ */
|
|
412
|
+
}), /* @__PURE__ */ Q("section", {
|
|
412
413
|
"aria-label": u("Credit transaction ledger"),
|
|
413
414
|
children: [
|
|
414
|
-
/* @__PURE__ */
|
|
415
|
+
/* @__PURE__ */ Q("h3", {
|
|
415
416
|
className: "mb-2 text-sm font-medium",
|
|
416
|
-
children: [/* @__PURE__ */
|
|
417
|
+
children: [/* @__PURE__ */ Z(o, { id: "Transaction ledger · " }), g]
|
|
417
418
|
}),
|
|
418
|
-
I.isPending ? /* @__PURE__ */
|
|
419
|
+
I.isPending ? /* @__PURE__ */ Z("p", {
|
|
419
420
|
className: "text-sm text-muted-foreground",
|
|
420
|
-
children: /* @__PURE__ */
|
|
421
|
-
}) : I.error ? /* @__PURE__ */
|
|
421
|
+
children: /* @__PURE__ */ Z(o, { id: "Loading transactions…" })
|
|
422
|
+
}) : I.error ? /* @__PURE__ */ Z("p", {
|
|
422
423
|
role: "alert",
|
|
423
424
|
className: "text-sm text-destructive",
|
|
424
425
|
children: $(I.error)
|
|
425
|
-
}) : I.data?.data.length ? /* @__PURE__ */
|
|
426
|
-
/* @__PURE__ */
|
|
427
|
-
/* @__PURE__ */
|
|
428
|
-
/* @__PURE__ */
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
] }) }), /* @__PURE__ */
|
|
431
|
-
/* @__PURE__ */
|
|
426
|
+
}) : I.data?.data.length ? /* @__PURE__ */ Q(M, { children: [/* @__PURE__ */ Z(k, { children: /* @__PURE__ */ Q(j, { children: [
|
|
427
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(o, { id: "Date" }) }),
|
|
428
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(o, { id: "Type" }) }),
|
|
429
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(o, { id: "Amount" }) }),
|
|
430
|
+
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(o, { id: "Source" }) })
|
|
431
|
+
] }) }), /* @__PURE__ */ Z(O, { children: I.data.data.map((e) => /* @__PURE__ */ Q(j, { children: [
|
|
432
|
+
/* @__PURE__ */ Z(A, {
|
|
432
433
|
title: e.id,
|
|
433
434
|
children: m(e.created_at)
|
|
434
435
|
}),
|
|
435
|
-
/* @__PURE__ */
|
|
436
|
-
/* @__PURE__ */
|
|
436
|
+
/* @__PURE__ */ Z(A, { children: e.type.replaceAll("_", " ") }),
|
|
437
|
+
/* @__PURE__ */ Z(A, {
|
|
437
438
|
className: "tabular-nums",
|
|
438
439
|
children: h(e.amount, e.currency)
|
|
439
440
|
}),
|
|
440
|
-
/* @__PURE__ */
|
|
441
|
-
] }, e.id)) })] }) : /* @__PURE__ */
|
|
441
|
+
/* @__PURE__ */ Z(A, { children: e.source || "—" })
|
|
442
|
+
] }, e.id)) })] }) : /* @__PURE__ */ Z("p", {
|
|
442
443
|
className: "text-sm text-muted-foreground",
|
|
443
|
-
children: /* @__PURE__ */
|
|
444
|
+
children: /* @__PURE__ */ Z(o, { id: "No transactions in this currency." })
|
|
444
445
|
}),
|
|
445
|
-
/* @__PURE__ */
|
|
446
|
+
/* @__PURE__ */ Z(T, {
|
|
446
447
|
pages: S,
|
|
447
448
|
rows: I.data?.data?.length ?? 0,
|
|
448
449
|
nextCursor: I.data?.next_cursor,
|
|
@@ -451,14 +452,14 @@ function ve({ merchant: t, customer: n, initialCurrency: i }) {
|
|
|
451
452
|
]
|
|
452
453
|
})]
|
|
453
454
|
}),
|
|
454
|
-
C && L !== void 0 && /* @__PURE__ */
|
|
455
|
+
C && L !== void 0 && /* @__PURE__ */ Z(be, {
|
|
455
456
|
merchant: t,
|
|
456
457
|
customer: n,
|
|
457
458
|
currency: g,
|
|
458
459
|
decimals: L,
|
|
459
|
-
onClose: () =>
|
|
460
|
+
onClose: () => w(!1)
|
|
460
461
|
}),
|
|
461
|
-
N && /* @__PURE__ */
|
|
462
|
+
N && /* @__PURE__ */ Z(xe, {
|
|
462
463
|
merchant: t,
|
|
463
464
|
customer: n,
|
|
464
465
|
grant: N,
|
|
@@ -466,23 +467,23 @@ function ve({ merchant: t, customer: n, initialCurrency: i }) {
|
|
|
466
467
|
})
|
|
467
468
|
] });
|
|
468
469
|
}
|
|
469
|
-
function
|
|
470
|
-
let { toast: u, creditMutations: d } = r(), { id: f } = e(), p =
|
|
471
|
-
return /* @__PURE__ */
|
|
470
|
+
function be({ merchant: t, customer: n, currency: i, decimals: a, onClose: l }) {
|
|
471
|
+
let { toast: u, creditMutations: d } = r(), { id: f } = e(), p = X(), m = J(d.grant(p, t, n)), [h, g] = q.useState(""), [_, v] = q.useState(""), [y, b] = q.useState(""), [x] = q.useState(() => crypto.randomUUID()), [S, C] = q.useState("");
|
|
472
|
+
return /* @__PURE__ */ Z(V, {
|
|
472
473
|
open: !0,
|
|
473
474
|
onOpenChange: (e) => {
|
|
474
475
|
!e && !m.isPending && l();
|
|
475
476
|
},
|
|
476
|
-
children: /* @__PURE__ */
|
|
477
|
-
/* @__PURE__ */
|
|
477
|
+
children: /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Q(I, { children: [/* @__PURE__ */ Z(z, { children: /* @__PURE__ */ Z(o, { id: "Grant credit" }) }), /* @__PURE__ */ Q(B, { children: [
|
|
478
|
+
/* @__PURE__ */ Z(o, { id: "Add credit in " }),
|
|
478
479
|
i,
|
|
479
|
-
/* @__PURE__ */
|
|
480
|
-
] })] }), /* @__PURE__ */
|
|
480
|
+
/* @__PURE__ */ Z(o, { id: " to this customer." })
|
|
481
|
+
] })] }), /* @__PURE__ */ Q("form", {
|
|
481
482
|
className: "grid gap-4",
|
|
482
483
|
onSubmit: async (e) => {
|
|
483
484
|
e.preventDefault(), C("");
|
|
484
485
|
try {
|
|
485
|
-
let e =
|
|
486
|
+
let e = he({
|
|
486
487
|
amount: h,
|
|
487
488
|
currency: i,
|
|
488
489
|
decimals: a,
|
|
@@ -496,16 +497,16 @@ function ye({ merchant: t, customer: n, currency: i, decimals: a, onClose: l })
|
|
|
496
497
|
}
|
|
497
498
|
},
|
|
498
499
|
children: [
|
|
499
|
-
/* @__PURE__ */
|
|
500
|
+
/* @__PURE__ */ Q("div", {
|
|
500
501
|
className: "grid gap-1",
|
|
501
|
-
children: [/* @__PURE__ */
|
|
502
|
+
children: [/* @__PURE__ */ Q(H, {
|
|
502
503
|
htmlFor: f("grant-amount"),
|
|
503
504
|
children: [
|
|
504
|
-
/* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ Z(o, { id: "Amount (" }),
|
|
505
506
|
i,
|
|
506
507
|
")"
|
|
507
508
|
]
|
|
508
|
-
}), /* @__PURE__ */
|
|
509
|
+
}), /* @__PURE__ */ Z(c, {
|
|
509
510
|
id: f("grant-amount"),
|
|
510
511
|
inputMode: "decimal",
|
|
511
512
|
value: h,
|
|
@@ -513,42 +514,42 @@ function ye({ merchant: t, customer: n, currency: i, decimals: a, onClose: l })
|
|
|
513
514
|
autoFocus: !0
|
|
514
515
|
})]
|
|
515
516
|
}),
|
|
516
|
-
/* @__PURE__ */
|
|
517
|
+
/* @__PURE__ */ Q("div", {
|
|
517
518
|
className: "grid gap-1",
|
|
518
|
-
children: [/* @__PURE__ */
|
|
519
|
+
children: [/* @__PURE__ */ Z(H, {
|
|
519
520
|
htmlFor: f("grant-expiry"),
|
|
520
|
-
children: /* @__PURE__ */
|
|
521
|
-
}), /* @__PURE__ */
|
|
521
|
+
children: /* @__PURE__ */ Z(o, { id: "Expires (optional)" })
|
|
522
|
+
}), /* @__PURE__ */ Z(c, {
|
|
522
523
|
id: f("grant-expiry"),
|
|
523
524
|
type: "datetime-local",
|
|
524
525
|
value: _,
|
|
525
526
|
onChange: (e) => v(e.target.value)
|
|
526
527
|
})]
|
|
527
528
|
}),
|
|
528
|
-
/* @__PURE__ */
|
|
529
|
+
/* @__PURE__ */ Q("div", {
|
|
529
530
|
className: "grid gap-1",
|
|
530
|
-
children: [/* @__PURE__ */
|
|
531
|
+
children: [/* @__PURE__ */ Z(H, {
|
|
531
532
|
htmlFor: f("grant-description"),
|
|
532
|
-
children: /* @__PURE__ */
|
|
533
|
-
}), /* @__PURE__ */
|
|
533
|
+
children: /* @__PURE__ */ Z(o, { id: "Description (optional)" })
|
|
534
|
+
}), /* @__PURE__ */ Z(c, {
|
|
534
535
|
id: f("grant-description"),
|
|
535
536
|
value: y,
|
|
536
537
|
onChange: (e) => b(e.target.value),
|
|
537
538
|
maxLength: 500
|
|
538
539
|
})]
|
|
539
540
|
}),
|
|
540
|
-
S && /* @__PURE__ */
|
|
541
|
+
S && /* @__PURE__ */ Z("p", {
|
|
541
542
|
role: "alert",
|
|
542
543
|
className: "text-sm text-destructive",
|
|
543
544
|
children: S
|
|
544
545
|
}),
|
|
545
|
-
/* @__PURE__ */
|
|
546
|
+
/* @__PURE__ */ Q(L, { children: [/* @__PURE__ */ Z(s, {
|
|
546
547
|
type: "button",
|
|
547
548
|
variant: "outline",
|
|
548
549
|
disabled: m.isPending,
|
|
549
550
|
onClick: l,
|
|
550
|
-
children: /* @__PURE__ */
|
|
551
|
-
}), /* @__PURE__ */
|
|
551
|
+
children: /* @__PURE__ */ Z(o, { id: "Cancel" })
|
|
552
|
+
}), /* @__PURE__ */ Z(s, {
|
|
552
553
|
type: "submit",
|
|
553
554
|
disabled: m.isPending,
|
|
554
555
|
children: m.isPending ? "Granting…" : "Grant credit"
|
|
@@ -557,36 +558,36 @@ function ye({ merchant: t, customer: n, currency: i, decimals: a, onClose: l })
|
|
|
557
558
|
})] })
|
|
558
559
|
});
|
|
559
560
|
}
|
|
560
|
-
function
|
|
561
|
-
let { toast: l, creditMutations: u } = r(), { id: d } = e(), f =
|
|
562
|
-
return /* @__PURE__ */
|
|
561
|
+
function xe({ merchant: t, customer: n, grant: i, onClose: a }) {
|
|
562
|
+
let { toast: l, creditMutations: u } = r(), { id: d } = e(), f = X(), p = J(u.revoke(f, t, n)), [m, g] = q.useState(""), [_, v] = q.useState("");
|
|
563
|
+
return /* @__PURE__ */ Z(V, {
|
|
563
564
|
open: !0,
|
|
564
565
|
onOpenChange: (e) => {
|
|
565
566
|
!e && !p.isPending && a();
|
|
566
567
|
},
|
|
567
|
-
children: /* @__PURE__ */
|
|
568
|
-
/* @__PURE__ */
|
|
568
|
+
children: /* @__PURE__ */ Q(R, { children: [/* @__PURE__ */ Q(I, { children: [/* @__PURE__ */ Z(z, { children: /* @__PURE__ */ Z(o, { id: "Revoke remaining credit" }) }), /* @__PURE__ */ Q(B, { children: [
|
|
569
|
+
/* @__PURE__ */ Z(o, { id: "Revoke the unspent remainder of" }),
|
|
569
570
|
" ",
|
|
570
571
|
h(i.remaining_amount, i.currency),
|
|
571
|
-
/* @__PURE__ */
|
|
572
|
-
] })] }), /* @__PURE__ */
|
|
572
|
+
/* @__PURE__ */ Z(o, { id: ". Active holds may prevent revocation. Payment refunds are managed separately." })
|
|
573
|
+
] })] }), /* @__PURE__ */ Q("form", {
|
|
573
574
|
className: "grid gap-4",
|
|
574
575
|
onSubmit: async (e) => {
|
|
575
576
|
e.preventDefault(), v("");
|
|
576
577
|
try {
|
|
577
|
-
let e = await p.mutateAsync(
|
|
578
|
+
let e = await p.mutateAsync(_e(i, m));
|
|
578
579
|
l.success(e.replayed ? "Credit was already revoked" : `${h(e.revoked_amount, e.currency)} revoked`), a();
|
|
579
580
|
} catch (e) {
|
|
580
581
|
v($(e));
|
|
581
582
|
}
|
|
582
583
|
},
|
|
583
584
|
children: [
|
|
584
|
-
/* @__PURE__ */
|
|
585
|
+
/* @__PURE__ */ Q("div", {
|
|
585
586
|
className: "grid gap-1",
|
|
586
|
-
children: [/* @__PURE__ */
|
|
587
|
+
children: [/* @__PURE__ */ Z(H, {
|
|
587
588
|
htmlFor: d("revoke-reason"),
|
|
588
|
-
children: /* @__PURE__ */
|
|
589
|
-
}), /* @__PURE__ */
|
|
589
|
+
children: /* @__PURE__ */ Z(o, { id: "Reason" })
|
|
590
|
+
}), /* @__PURE__ */ Z(c, {
|
|
590
591
|
id: d("revoke-reason"),
|
|
591
592
|
value: m,
|
|
592
593
|
onChange: (e) => g(e.target.value),
|
|
@@ -594,21 +595,21 @@ function be({ merchant: t, customer: n, grant: i, onClose: a }) {
|
|
|
594
595
|
autoFocus: !0
|
|
595
596
|
})]
|
|
596
597
|
}),
|
|
597
|
-
_ && /* @__PURE__ */
|
|
598
|
+
_ && /* @__PURE__ */ Z("p", {
|
|
598
599
|
role: "alert",
|
|
599
600
|
className: "text-sm text-destructive",
|
|
600
601
|
children: _
|
|
601
602
|
}),
|
|
602
|
-
/* @__PURE__ */
|
|
603
|
+
/* @__PURE__ */ Q(L, { children: [/* @__PURE__ */ Z(s, {
|
|
603
604
|
type: "button",
|
|
604
605
|
variant: "outline",
|
|
605
606
|
disabled: p.isPending,
|
|
606
607
|
onClick: a,
|
|
607
|
-
children: /* @__PURE__ */
|
|
608
|
-
}), /* @__PURE__ */
|
|
608
|
+
children: /* @__PURE__ */ Z(o, { id: "Cancel" })
|
|
609
|
+
}), /* @__PURE__ */ Z(s, {
|
|
609
610
|
type: "submit",
|
|
610
611
|
variant: "destructive",
|
|
611
|
-
disabled: !
|
|
612
|
+
disabled: !ge(i) || p.isPending,
|
|
612
613
|
children: p.isPending ? "Revoking…" : "Revoke credit"
|
|
613
614
|
})] })
|
|
614
615
|
]
|
|
@@ -617,7 +618,7 @@ function be({ merchant: t, customer: n, grant: i, onClose: a }) {
|
|
|
617
618
|
}
|
|
618
619
|
//#endregion
|
|
619
620
|
//#region src/admin/pages/customers/grant-duration.ts
|
|
620
|
-
var
|
|
621
|
+
var Se = [
|
|
621
622
|
{
|
|
622
623
|
value: "1",
|
|
623
624
|
label: "1 day",
|
|
@@ -646,179 +647,179 @@ var xe = [
|
|
|
646
647
|
value: "never",
|
|
647
648
|
label: "Never expires"
|
|
648
649
|
}
|
|
649
|
-
],
|
|
650
|
-
function
|
|
650
|
+
], Ce = (e) => e.toISOString().slice(0, 10);
|
|
651
|
+
function we(e, t, n = /* @__PURE__ */ new Date()) {
|
|
651
652
|
if (e === "never") return {};
|
|
652
653
|
if (e === "until") {
|
|
653
|
-
if (!/^\d{4}-\d{2}-\d{2}$/.test(t) || t <
|
|
654
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(t) || t < Ce(n)) return null;
|
|
654
655
|
let e = /* @__PURE__ */ new Date(`${t}T00:00:00Z`);
|
|
655
656
|
return e.setUTCDate(e.getUTCDate() + 1), { endsAt: e.toISOString() };
|
|
656
657
|
}
|
|
657
|
-
let r =
|
|
658
|
+
let r = Se.find((t) => t.value === e);
|
|
658
659
|
return r && "days" in r ? { hours: r.days * 24 } : null;
|
|
659
660
|
}
|
|
660
661
|
//#endregion
|
|
661
662
|
//#region src/admin/pages/customers/detail.tsx
|
|
662
|
-
function
|
|
663
|
-
let { text: c } = e(), { props: u } = n(), { adminQueries: d } = r(), f = l(), { customerId: p = "" } = t(), g = a(), { data: _, isPending: v } =
|
|
664
|
-
return v ? /* @__PURE__ */
|
|
663
|
+
function Te() {
|
|
664
|
+
let { text: c } = e(), { props: u } = n(), { adminQueries: d } = r(), f = l(), { customerId: p = "" } = t(), g = a(), { data: _, isPending: v } = Y(d.customer(p));
|
|
665
|
+
return v ? /* @__PURE__ */ Z("p", {
|
|
665
666
|
className: "text-sm text-muted-foreground",
|
|
666
|
-
children: /* @__PURE__ */
|
|
667
|
-
}) : _ ? /* @__PURE__ */
|
|
667
|
+
children: /* @__PURE__ */ Z(o, { id: "Loading…" })
|
|
668
|
+
}) : _ ? /* @__PURE__ */ Q("div", {
|
|
668
669
|
className: "flex min-w-0 flex-col gap-4",
|
|
669
670
|
children: [
|
|
670
|
-
/* @__PURE__ */
|
|
671
|
+
/* @__PURE__ */ Q("div", {
|
|
671
672
|
className: "flex items-center gap-3",
|
|
672
673
|
children: [
|
|
673
|
-
/* @__PURE__ */
|
|
674
|
+
/* @__PURE__ */ Z(s, {
|
|
674
675
|
variant: "ghost",
|
|
675
676
|
size: "icon",
|
|
676
677
|
onClick: () => g(-1),
|
|
677
678
|
"aria-label": c("Back"),
|
|
678
|
-
children: /* @__PURE__ */
|
|
679
|
-
icon:
|
|
679
|
+
children: /* @__PURE__ */ Z(se, {
|
|
680
|
+
icon: le,
|
|
680
681
|
className: "size-4"
|
|
681
682
|
})
|
|
682
683
|
}),
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
+
/* @__PURE__ */ Q("div", {
|
|
684
685
|
className: "min-w-0",
|
|
685
|
-
children: [/* @__PURE__ */
|
|
686
|
+
children: [/* @__PURE__ */ Z("h2", {
|
|
686
687
|
className: "truncate text-base font-semibold",
|
|
687
688
|
children: _.contact?.name || _.contact?.email || "Customer"
|
|
688
|
-
}), /* @__PURE__ */
|
|
689
|
+
}), /* @__PURE__ */ Q("p", {
|
|
689
690
|
className: "truncate text-xs text-muted-foreground",
|
|
690
691
|
children: [
|
|
691
692
|
_.id,
|
|
692
|
-
/* @__PURE__ */
|
|
693
|
+
/* @__PURE__ */ Z(o, { id: " · since " }),
|
|
693
694
|
m(_.created_at),
|
|
694
|
-
/* @__PURE__ */
|
|
695
|
+
/* @__PURE__ */ Z(o, { id: " · last seen" }),
|
|
695
696
|
" ",
|
|
696
697
|
m(_.last_seen_at)
|
|
697
698
|
]
|
|
698
699
|
})]
|
|
699
700
|
}),
|
|
700
|
-
f && /* @__PURE__ */
|
|
701
|
+
f && /* @__PURE__ */ Z("div", {
|
|
701
702
|
className: "ml-auto flex gap-2",
|
|
702
|
-
children: /* @__PURE__ */
|
|
703
|
+
children: /* @__PURE__ */ Z(Me, { customerId: p })
|
|
703
704
|
})
|
|
704
705
|
]
|
|
705
706
|
}),
|
|
706
|
-
/* @__PURE__ */
|
|
707
|
-
u.userHref && /* @__PURE__ */
|
|
707
|
+
/* @__PURE__ */ Z(Ne, { contact: _.contact }),
|
|
708
|
+
u.userHref && /* @__PURE__ */ Z("a", {
|
|
708
709
|
className: "underline",
|
|
709
710
|
href: u.userHref(_.id),
|
|
710
|
-
children: /* @__PURE__ */
|
|
711
|
+
children: /* @__PURE__ */ Z(o, { id: "View user account" })
|
|
711
712
|
}),
|
|
712
713
|
u.customerPanels?.(_),
|
|
713
|
-
_.balances.length > 0 && /* @__PURE__ */
|
|
714
|
+
_.balances.length > 0 && /* @__PURE__ */ Z("div", {
|
|
714
715
|
className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-4",
|
|
715
|
-
children: _.balances.map((e) => /* @__PURE__ */
|
|
716
|
+
children: _.balances.map((e) => /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Z(U, {
|
|
716
717
|
className: "pb-1",
|
|
717
|
-
children: /* @__PURE__ */
|
|
718
|
+
children: /* @__PURE__ */ Q(W, {
|
|
718
719
|
className: "text-xs font-normal text-muted-foreground uppercase",
|
|
719
|
-
children: [e.currency, /* @__PURE__ */
|
|
720
|
+
children: [e.currency, /* @__PURE__ */ Z(o, { id: " balance" })]
|
|
720
721
|
})
|
|
721
|
-
}), /* @__PURE__ */
|
|
722
|
+
}), /* @__PURE__ */ Q(G, { children: [/* @__PURE__ */ Z("p", {
|
|
722
723
|
className: "text-lg font-semibold",
|
|
723
724
|
children: h(e.balance_amount, e.currency)
|
|
724
|
-
}), /* @__PURE__ */
|
|
725
|
+
}), /* @__PURE__ */ Q("p", {
|
|
725
726
|
className: "text-xs text-muted-foreground",
|
|
726
727
|
children: [
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
+
/* @__PURE__ */ Z(o, { id: "held " }),
|
|
728
729
|
h(e.held_amount, e.currency),
|
|
729
|
-
/* @__PURE__ */
|
|
730
|
+
/* @__PURE__ */ Z(o, { id: " · owed" }),
|
|
730
731
|
" ",
|
|
731
732
|
h(e.owed_amount, e.currency)
|
|
732
733
|
]
|
|
733
734
|
})] })] }, e.currency))
|
|
734
735
|
}),
|
|
735
|
-
_.balances.some((e) => BigInt(e.owed_amount) > 0n) && /* @__PURE__ */
|
|
736
|
+
_.balances.some((e) => BigInt(e.owed_amount) > 0n) && /* @__PURE__ */ Z("p", {
|
|
736
737
|
className: "text-sm",
|
|
737
|
-
children: /* @__PURE__ */
|
|
738
|
+
children: /* @__PURE__ */ Z(i, {
|
|
738
739
|
className: "underline-offset-2 hover:underline",
|
|
739
740
|
to: `/orders?customer_id=${_.id}&origin=usage&overdue=true`,
|
|
740
|
-
children: /* @__PURE__ */
|
|
741
|
+
children: /* @__PURE__ */ Z(o, { id: "Overdue usage orders" })
|
|
741
742
|
})
|
|
742
743
|
}),
|
|
743
|
-
/* @__PURE__ */
|
|
744
|
+
/* @__PURE__ */ Z(ve, {
|
|
744
745
|
customerId: p,
|
|
745
746
|
currencies: _.balances.map((e) => e.currency)
|
|
746
747
|
}),
|
|
747
|
-
/* @__PURE__ */
|
|
748
|
-
/* @__PURE__ */
|
|
748
|
+
/* @__PURE__ */ Z(fe, { customerId: p }),
|
|
749
|
+
/* @__PURE__ */ Q("div", {
|
|
749
750
|
className: "grid gap-4 lg:grid-cols-3 lg:items-start",
|
|
750
|
-
children: [/* @__PURE__ */
|
|
751
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
751
752
|
className: "grid gap-4 lg:col-span-2",
|
|
752
753
|
children: [
|
|
753
|
-
/* @__PURE__ */
|
|
754
|
-
/* @__PURE__ */
|
|
755
|
-
/* @__PURE__ */
|
|
754
|
+
/* @__PURE__ */ Z(Ee, { customerId: p }),
|
|
755
|
+
/* @__PURE__ */ Z(De, { customerId: p }),
|
|
756
|
+
/* @__PURE__ */ Z(Oe, { customerId: p })
|
|
756
757
|
]
|
|
757
|
-
}), /* @__PURE__ */
|
|
758
|
+
}), /* @__PURE__ */ Q("div", {
|
|
758
759
|
className: "grid gap-4",
|
|
759
|
-
children: [/* @__PURE__ */
|
|
760
|
+
children: [/* @__PURE__ */ Z(ke, { customerId: p }), /* @__PURE__ */ Z(Ae, { customerId: p })]
|
|
760
761
|
})]
|
|
761
762
|
})
|
|
762
763
|
]
|
|
763
|
-
}) : /* @__PURE__ */
|
|
764
|
+
}) : /* @__PURE__ */ Z("p", {
|
|
764
765
|
className: "text-sm text-muted-foreground",
|
|
765
|
-
children: /* @__PURE__ */
|
|
766
|
+
children: /* @__PURE__ */ Z(o, { id: "Customer not found." })
|
|
766
767
|
});
|
|
767
768
|
}
|
|
768
|
-
function
|
|
769
|
-
let { adminQueries: t } = r(), n =
|
|
770
|
-
return /* @__PURE__ */
|
|
769
|
+
function Ee({ customerId: e }) {
|
|
770
|
+
let { adminQueries: t } = r(), n = E(e, 25), { data: a, isFetching: s } = Y(t.customerSubscriptions(e, n.size, n.cursor)), c = a?.data ?? [];
|
|
771
|
+
return /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Z(U, { children: /* @__PURE__ */ Z(W, {
|
|
771
772
|
className: "text-sm",
|
|
772
|
-
children: /* @__PURE__ */
|
|
773
|
-
}) }), /* @__PURE__ */
|
|
773
|
+
children: /* @__PURE__ */ Z(o, { id: "Subscriptions" })
|
|
774
|
+
}) }), /* @__PURE__ */ Q(G, {
|
|
774
775
|
className: "grid gap-3",
|
|
775
|
-
children: [c.length === 0 ? /* @__PURE__ */
|
|
776
|
+
children: [c.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
776
777
|
className: "text-sm text-muted-foreground",
|
|
777
|
-
children: /* @__PURE__ */
|
|
778
|
-
}) : /* @__PURE__ */
|
|
778
|
+
children: /* @__PURE__ */ Z(o, { id: "No subscriptions." })
|
|
779
|
+
}) : /* @__PURE__ */ Q(M, { children: [/* @__PURE__ */ Z(k, { children: /* @__PURE__ */ Q(j, {
|
|
779
780
|
className: "hover:bg-transparent",
|
|
780
781
|
children: [
|
|
781
|
-
/* @__PURE__ */
|
|
782
|
+
/* @__PURE__ */ Z(D, {
|
|
782
783
|
className: "text-muted-foreground",
|
|
783
|
-
children: /* @__PURE__ */
|
|
784
|
+
children: /* @__PURE__ */ Z(o, { id: "Subscription" })
|
|
784
785
|
}),
|
|
785
|
-
/* @__PURE__ */
|
|
786
|
+
/* @__PURE__ */ Z(D, {
|
|
786
787
|
className: "text-muted-foreground",
|
|
787
|
-
children: /* @__PURE__ */
|
|
788
|
+
children: /* @__PURE__ */ Z(o, { id: "Status" })
|
|
788
789
|
}),
|
|
789
|
-
/* @__PURE__ */
|
|
790
|
+
/* @__PURE__ */ Z(D, {
|
|
790
791
|
className: "text-muted-foreground",
|
|
791
|
-
children: /* @__PURE__ */
|
|
792
|
+
children: /* @__PURE__ */ Z(o, { id: "Rail" })
|
|
792
793
|
}),
|
|
793
|
-
/* @__PURE__ */
|
|
794
|
+
/* @__PURE__ */ Z(D, {
|
|
794
795
|
className: "text-muted-foreground",
|
|
795
|
-
children: /* @__PURE__ */
|
|
796
|
+
children: /* @__PURE__ */ Z(o, { id: "Period ends" })
|
|
796
797
|
}),
|
|
797
|
-
/* @__PURE__ */
|
|
798
|
+
/* @__PURE__ */ Z(D, {
|
|
798
799
|
className: "text-muted-foreground",
|
|
799
|
-
children: /* @__PURE__ */
|
|
800
|
+
children: /* @__PURE__ */ Z(o, { id: "Dunning" })
|
|
800
801
|
})
|
|
801
802
|
]
|
|
802
|
-
}) }), /* @__PURE__ */
|
|
803
|
+
}) }), /* @__PURE__ */ Z(O, { children: c.map((e) => /* @__PURE__ */ Q(N, {
|
|
803
804
|
to: `/subscriptions/${e.id}`,
|
|
804
805
|
children: [
|
|
805
|
-
/* @__PURE__ */
|
|
806
|
+
/* @__PURE__ */ Z(A, { children: /* @__PURE__ */ Z(i, {
|
|
806
807
|
className: "text-xs underline-offset-2 hover:underline",
|
|
807
808
|
to: `/subscriptions/${e.id}`,
|
|
808
809
|
children: _(e.id, 13)
|
|
809
810
|
}) }),
|
|
810
|
-
/* @__PURE__ */
|
|
811
|
-
/* @__PURE__ */
|
|
812
|
-
/* @__PURE__ */
|
|
811
|
+
/* @__PURE__ */ Z(A, { children: /* @__PURE__ */ Z(F, { status: e.status }) }),
|
|
812
|
+
/* @__PURE__ */ Z(A, { children: e.rail }),
|
|
813
|
+
/* @__PURE__ */ Z(A, {
|
|
813
814
|
className: "tabular-nums",
|
|
814
815
|
children: m(e.current_period_ends_at)
|
|
815
816
|
}),
|
|
816
|
-
/* @__PURE__ */
|
|
817
|
+
/* @__PURE__ */ Z(A, {
|
|
817
818
|
className: "text-xs",
|
|
818
819
|
children: e.dunning ? ie(e.dunning) : "—"
|
|
819
820
|
})
|
|
820
821
|
]
|
|
821
|
-
}, e.id)) })] }), /* @__PURE__ */
|
|
822
|
+
}, e.id)) })] }), /* @__PURE__ */ Z(T, {
|
|
822
823
|
pages: n,
|
|
823
824
|
rows: a?.data?.length ?? 0,
|
|
824
825
|
nextCursor: a?.next_cursor,
|
|
@@ -826,65 +827,65 @@ function Te({ customerId: e }) {
|
|
|
826
827
|
})]
|
|
827
828
|
})] });
|
|
828
829
|
}
|
|
829
|
-
function
|
|
830
|
-
let { adminQueries: t } = r(), n =
|
|
831
|
-
return /* @__PURE__ */
|
|
830
|
+
function De({ customerId: e }) {
|
|
831
|
+
let { adminQueries: t } = r(), n = E(e, 25), { data: a, isFetching: s } = Y(t.customerPayments(e, n.size, n.cursor)), c = a?.data ?? [];
|
|
832
|
+
return /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Z(U, { children: /* @__PURE__ */ Z(W, {
|
|
832
833
|
className: "text-sm",
|
|
833
|
-
children: /* @__PURE__ */
|
|
834
|
-
}) }), /* @__PURE__ */
|
|
834
|
+
children: /* @__PURE__ */ Z(o, { id: "Payments" })
|
|
835
|
+
}) }), /* @__PURE__ */ Q(G, {
|
|
835
836
|
className: "grid gap-3",
|
|
836
|
-
children: [c.length === 0 ? /* @__PURE__ */
|
|
837
|
+
children: [c.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
837
838
|
className: "text-sm text-muted-foreground",
|
|
838
|
-
children: /* @__PURE__ */
|
|
839
|
-
}) : /* @__PURE__ */
|
|
839
|
+
children: /* @__PURE__ */ Z(o, { id: "No payments." })
|
|
840
|
+
}) : /* @__PURE__ */ Q(M, { children: [/* @__PURE__ */ Z(k, { children: /* @__PURE__ */ Q(j, {
|
|
840
841
|
className: "hover:bg-transparent",
|
|
841
842
|
children: [
|
|
842
|
-
/* @__PURE__ */
|
|
843
|
+
/* @__PURE__ */ Z(D, {
|
|
843
844
|
className: "text-muted-foreground",
|
|
844
|
-
children: /* @__PURE__ */
|
|
845
|
+
children: /* @__PURE__ */ Z(o, { id: "Payment" })
|
|
845
846
|
}),
|
|
846
|
-
/* @__PURE__ */
|
|
847
|
+
/* @__PURE__ */ Z(D, {
|
|
847
848
|
className: "text-muted-foreground",
|
|
848
|
-
children: /* @__PURE__ */
|
|
849
|
+
children: /* @__PURE__ */ Z(o, { id: "Status" })
|
|
849
850
|
}),
|
|
850
|
-
/* @__PURE__ */
|
|
851
|
+
/* @__PURE__ */ Z(D, {
|
|
851
852
|
className: "text-muted-foreground",
|
|
852
|
-
children: /* @__PURE__ */
|
|
853
|
+
children: /* @__PURE__ */ Z(o, { id: "Amount" })
|
|
853
854
|
}),
|
|
854
|
-
/* @__PURE__ */
|
|
855
|
+
/* @__PURE__ */ Z(D, {
|
|
855
856
|
className: "text-muted-foreground",
|
|
856
|
-
children: /* @__PURE__ */
|
|
857
|
+
children: /* @__PURE__ */ Z(o, { id: "Kind" })
|
|
857
858
|
}),
|
|
858
|
-
/* @__PURE__ */
|
|
859
|
+
/* @__PURE__ */ Z(D, {
|
|
859
860
|
className: "text-muted-foreground",
|
|
860
|
-
children: /* @__PURE__ */
|
|
861
|
+
children: /* @__PURE__ */ Z(o, { id: "Rail" })
|
|
861
862
|
}),
|
|
862
|
-
/* @__PURE__ */
|
|
863
|
+
/* @__PURE__ */ Z(D, {
|
|
863
864
|
className: "text-muted-foreground",
|
|
864
|
-
children: /* @__PURE__ */
|
|
865
|
+
children: /* @__PURE__ */ Z(o, { id: "Purchased" })
|
|
865
866
|
})
|
|
866
867
|
]
|
|
867
|
-
}) }), /* @__PURE__ */
|
|
868
|
+
}) }), /* @__PURE__ */ Z(O, { children: c.map((e) => /* @__PURE__ */ Q(N, {
|
|
868
869
|
to: `/payments/${e.id}`,
|
|
869
870
|
children: [
|
|
870
|
-
/* @__PURE__ */
|
|
871
|
+
/* @__PURE__ */ Z(A, { children: /* @__PURE__ */ Z(i, {
|
|
871
872
|
className: "text-xs underline-offset-2 hover:underline",
|
|
872
873
|
to: `/payments/${e.id}`,
|
|
873
874
|
children: _(e.id, 13)
|
|
874
875
|
}) }),
|
|
875
|
-
/* @__PURE__ */
|
|
876
|
-
/* @__PURE__ */
|
|
876
|
+
/* @__PURE__ */ Z(A, { children: /* @__PURE__ */ Z(F, { status: e.status }) }),
|
|
877
|
+
/* @__PURE__ */ Z(A, {
|
|
877
878
|
className: "tabular-nums",
|
|
878
879
|
children: h(e.amount, e.currency)
|
|
879
880
|
}),
|
|
880
|
-
/* @__PURE__ */
|
|
881
|
-
/* @__PURE__ */
|
|
882
|
-
/* @__PURE__ */
|
|
881
|
+
/* @__PURE__ */ Z(A, { children: e.kind }),
|
|
882
|
+
/* @__PURE__ */ Z(A, { children: e.rail ?? e.channel }),
|
|
883
|
+
/* @__PURE__ */ Z(A, {
|
|
883
884
|
className: "tabular-nums",
|
|
884
885
|
children: m(e.created_at)
|
|
885
886
|
})
|
|
886
887
|
]
|
|
887
|
-
}, e.id)) })] }), /* @__PURE__ */
|
|
888
|
+
}, e.id)) })] }), /* @__PURE__ */ Z(T, {
|
|
888
889
|
pages: n,
|
|
889
890
|
rows: a?.data?.length ?? 0,
|
|
890
891
|
nextCursor: a?.next_cursor,
|
|
@@ -892,77 +893,95 @@ function Ee({ customerId: e }) {
|
|
|
892
893
|
})]
|
|
893
894
|
})] });
|
|
894
895
|
}
|
|
895
|
-
function
|
|
896
|
-
let { adminQueries: t, queryKeys: n } = r(),
|
|
897
|
-
|
|
896
|
+
function Oe({ customerId: e }) {
|
|
897
|
+
let { adminQueries: t, queryKeys: n, deleteCustomerPaymentMethod: i, toastApiError: a } = r(), c = l(), u = v(), p = X(), m = J({
|
|
898
|
+
mutationFn: (t) => i(e, t),
|
|
899
|
+
onSuccess: () => p.invalidateQueries({ queryKey: [...n.customer(e), "payment-methods"] }),
|
|
900
|
+
onError: (e) => a(e, "Remove payment method")
|
|
901
|
+
}), h = E(e, 25), { data: g, isFetching: _ } = Y(t.customerPaymentMethodsPage(e, h.size, h.cursor)), y = g?.data ?? [];
|
|
902
|
+
return /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Q(U, { children: [/* @__PURE__ */ Z(W, {
|
|
898
903
|
className: "text-sm",
|
|
899
|
-
children: /* @__PURE__ */
|
|
900
|
-
}), /* @__PURE__ */
|
|
904
|
+
children: /* @__PURE__ */ Z(o, { id: "Payment methods" })
|
|
905
|
+
}), /* @__PURE__ */ Z(s, {
|
|
901
906
|
variant: "ghost",
|
|
902
907
|
size: "sm",
|
|
903
|
-
onClick: () => void
|
|
904
|
-
children: /* @__PURE__ */
|
|
905
|
-
})] }), /* @__PURE__ */
|
|
908
|
+
onClick: () => void p.invalidateQueries({ queryKey: [...n.customer(e), "payment-methods"] }),
|
|
909
|
+
children: /* @__PURE__ */ Z(o, { id: "Refresh payment methods" })
|
|
910
|
+
})] }), /* @__PURE__ */ Q(G, {
|
|
906
911
|
className: "grid gap-3",
|
|
907
|
-
children: [
|
|
912
|
+
children: [y.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
908
913
|
className: "text-sm text-muted-foreground",
|
|
909
|
-
children: /* @__PURE__ */
|
|
910
|
-
}) : /* @__PURE__ */
|
|
914
|
+
children: /* @__PURE__ */ Z(o, { id: "No payment methods on file." })
|
|
915
|
+
}) : /* @__PURE__ */ Z("div", {
|
|
911
916
|
className: "flex flex-wrap gap-3",
|
|
912
|
-
children:
|
|
917
|
+
children: y.map((e) => /* @__PURE__ */ Q("div", {
|
|
913
918
|
className: "rounded-md border p-3 text-sm",
|
|
914
919
|
children: [
|
|
915
|
-
/* @__PURE__ */
|
|
920
|
+
/* @__PURE__ */ Z("p", {
|
|
916
921
|
className: "font-medium",
|
|
917
922
|
children: f(e.card)
|
|
918
923
|
}),
|
|
919
|
-
/* @__PURE__ */
|
|
924
|
+
/* @__PURE__ */ Q("p", {
|
|
920
925
|
className: "text-xs text-muted-foreground",
|
|
921
926
|
children: [
|
|
922
927
|
e.rail,
|
|
923
|
-
/* @__PURE__ */
|
|
928
|
+
/* @__PURE__ */ Z(o, { id: " · exp " }),
|
|
924
929
|
d(e.card)
|
|
925
930
|
]
|
|
926
931
|
}),
|
|
927
|
-
/* @__PURE__ */
|
|
928
|
-
e.
|
|
932
|
+
/* @__PURE__ */ Z(me, { currencies: e.default_currencies ?? [] }),
|
|
933
|
+
c && e.rail === "nmi" && e.status !== "removed" && /* @__PURE__ */ Z(s, {
|
|
934
|
+
size: "sm",
|
|
935
|
+
variant: "outline",
|
|
936
|
+
className: "mt-2",
|
|
937
|
+
disabled: m.isPending,
|
|
938
|
+
onClick: async () => {
|
|
939
|
+
await u({
|
|
940
|
+
title: "Remove this saved card?",
|
|
941
|
+
description: "The vault will remove the card once no active subscription or payment uses it. Transaction history remains.",
|
|
942
|
+
confirmLabel: "Remove saved card"
|
|
943
|
+
}) && m.mutate(e.id);
|
|
944
|
+
},
|
|
945
|
+
children: "Remove saved card"
|
|
946
|
+
}),
|
|
947
|
+
e.health.expiry_status && e.health.expiry_status !== "valid" && /* @__PURE__ */ Z(P, {
|
|
929
948
|
variant: "secondary",
|
|
930
949
|
className: "bg-held-surface text-held mt-1",
|
|
931
950
|
children: e.health.expiry_status
|
|
932
951
|
})
|
|
933
952
|
]
|
|
934
953
|
}, e.id))
|
|
935
|
-
}), /* @__PURE__ */
|
|
936
|
-
pages:
|
|
937
|
-
rows:
|
|
938
|
-
nextCursor:
|
|
939
|
-
busy:
|
|
954
|
+
}), /* @__PURE__ */ Z(T, {
|
|
955
|
+
pages: h,
|
|
956
|
+
rows: g?.data?.length ?? 0,
|
|
957
|
+
nextCursor: g?.next_cursor,
|
|
958
|
+
busy: _
|
|
940
959
|
})]
|
|
941
960
|
})] });
|
|
942
961
|
}
|
|
943
|
-
function
|
|
944
|
-
let { adminQueries: t } = r(), n =
|
|
945
|
-
return /* @__PURE__ */
|
|
962
|
+
function ke({ customerId: e }) {
|
|
963
|
+
let { adminQueries: t } = r(), n = E(e, 25), { data: i, isFetching: a } = Y(t.customerEntitlements(e, n.size, n.cursor)), s = i?.data ?? [];
|
|
964
|
+
return /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Z(U, { children: /* @__PURE__ */ Z(W, {
|
|
946
965
|
className: "text-sm",
|
|
947
|
-
children: /* @__PURE__ */
|
|
948
|
-
}) }), /* @__PURE__ */
|
|
966
|
+
children: /* @__PURE__ */ Z(o, { id: "Entitlements" })
|
|
967
|
+
}) }), /* @__PURE__ */ Q(G, {
|
|
949
968
|
className: "grid gap-3",
|
|
950
969
|
children: [
|
|
951
|
-
/* @__PURE__ */
|
|
970
|
+
/* @__PURE__ */ Z("p", {
|
|
952
971
|
className: "text-xs text-muted-foreground",
|
|
953
|
-
children: /* @__PURE__ */
|
|
972
|
+
children: /* @__PURE__ */ Z(o, { id: "The keys of the products this customer holds now." })
|
|
954
973
|
}),
|
|
955
|
-
s.length === 0 ? /* @__PURE__ */
|
|
974
|
+
s.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
956
975
|
className: "text-sm text-muted-foreground",
|
|
957
|
-
children: /* @__PURE__ */
|
|
958
|
-
}) : /* @__PURE__ */
|
|
976
|
+
children: /* @__PURE__ */ Z(o, { id: "No entitlements." })
|
|
977
|
+
}) : /* @__PURE__ */ Z("div", {
|
|
959
978
|
className: "flex flex-wrap gap-2",
|
|
960
|
-
children: s.map((e) => /* @__PURE__ */
|
|
979
|
+
children: s.map((e) => /* @__PURE__ */ Z(P, {
|
|
961
980
|
variant: "secondary",
|
|
962
981
|
children: e.entitlement
|
|
963
982
|
}, e.entitlement))
|
|
964
983
|
}),
|
|
965
|
-
/* @__PURE__ */
|
|
984
|
+
/* @__PURE__ */ Z(T, {
|
|
966
985
|
pages: n,
|
|
967
986
|
rows: i?.data?.length ?? 0,
|
|
968
987
|
nextCursor: i?.next_cursor,
|
|
@@ -971,46 +990,46 @@ function Oe({ customerId: e }) {
|
|
|
971
990
|
]
|
|
972
991
|
})] });
|
|
973
992
|
}
|
|
974
|
-
function
|
|
975
|
-
let { text: n } = e(), { adminQueries: i } = r(), a = l(), s =
|
|
976
|
-
return /* @__PURE__ */
|
|
993
|
+
function Ae({ customerId: t }) {
|
|
994
|
+
let { text: n } = e(), { adminQueries: i } = r(), a = l(), s = E(t, 25), { data: c, isFetching: u } = Y(i.customerProductAccess(t, s.size, s.cursor)), d = c?.data ?? [];
|
|
995
|
+
return /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Z(U, { children: /* @__PURE__ */ Z(W, {
|
|
977
996
|
className: "text-sm",
|
|
978
|
-
children: /* @__PURE__ */
|
|
979
|
-
}) }), /* @__PURE__ */
|
|
997
|
+
children: /* @__PURE__ */ Z(o, { id: "Product access" })
|
|
998
|
+
}) }), /* @__PURE__ */ Q(G, {
|
|
980
999
|
className: "grid gap-3",
|
|
981
|
-
children: [d.length === 0 ? /* @__PURE__ */
|
|
1000
|
+
children: [d.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
982
1001
|
className: "text-sm text-muted-foreground",
|
|
983
|
-
children: /* @__PURE__ */
|
|
984
|
-
}) : /* @__PURE__ */
|
|
1002
|
+
children: /* @__PURE__ */ Z(o, { id: "No product access." })
|
|
1003
|
+
}) : /* @__PURE__ */ Z("div", {
|
|
985
1004
|
className: "grid gap-4",
|
|
986
|
-
children: d.map((e) => /* @__PURE__ */
|
|
1005
|
+
children: d.map((e) => /* @__PURE__ */ Q("div", {
|
|
987
1006
|
className: "flex min-w-0 items-start gap-3",
|
|
988
|
-
children: [/* @__PURE__ */
|
|
1007
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
989
1008
|
className: "min-w-0 flex-1",
|
|
990
1009
|
children: [
|
|
991
|
-
/* @__PURE__ */
|
|
1010
|
+
/* @__PURE__ */ Q("div", {
|
|
992
1011
|
className: "flex min-w-0 items-center gap-2",
|
|
993
|
-
children: [/* @__PURE__ */
|
|
1012
|
+
children: [/* @__PURE__ */ Z("p", {
|
|
994
1013
|
className: "truncate text-sm font-medium",
|
|
995
1014
|
children: e.product_name || _(e.product_id, 13)
|
|
996
|
-
}), /* @__PURE__ */
|
|
1015
|
+
}), /* @__PURE__ */ Z(F, { status: e.status })]
|
|
997
1016
|
}),
|
|
998
|
-
/* @__PURE__ */
|
|
1017
|
+
/* @__PURE__ */ Z("p", {
|
|
999
1018
|
className: "mt-1 text-xs text-muted-foreground",
|
|
1000
1019
|
children: e.source_type === "grant" ? `Granted (${e.grant_reason ?? "staff"})${e.note ? `: ${e.note}` : ""}` : e.source_type
|
|
1001
1020
|
}),
|
|
1002
|
-
/* @__PURE__ */
|
|
1021
|
+
/* @__PURE__ */ Z("p", {
|
|
1003
1022
|
className: "text-xs text-muted-foreground tabular-nums",
|
|
1004
1023
|
children: e.ends_at ? `Ends ${m(e.ends_at)}` : "No end date"
|
|
1005
1024
|
})
|
|
1006
1025
|
]
|
|
1007
|
-
}), a && /* @__PURE__ */
|
|
1026
|
+
}), a && /* @__PURE__ */ Z(je, {
|
|
1008
1027
|
customerId: t,
|
|
1009
1028
|
grantId: e.id,
|
|
1010
1029
|
label: n("Revoke product access")
|
|
1011
1030
|
})]
|
|
1012
1031
|
}, e.id))
|
|
1013
|
-
}), /* @__PURE__ */
|
|
1032
|
+
}), /* @__PURE__ */ Z(T, {
|
|
1014
1033
|
pages: s,
|
|
1015
1034
|
rows: c?.data?.length ?? 0,
|
|
1016
1035
|
nextCursor: c?.next_cursor,
|
|
@@ -1018,40 +1037,40 @@ function ke({ customerId: t }) {
|
|
|
1018
1037
|
})]
|
|
1019
1038
|
})] });
|
|
1020
1039
|
}
|
|
1021
|
-
function
|
|
1022
|
-
let { toast: a, toastApiError: l, adminMutations: u } = r(), { id: d } = e(), f =
|
|
1023
|
-
return /* @__PURE__ */
|
|
1040
|
+
function je({ customerId: t, grantId: n, label: i }) {
|
|
1041
|
+
let { toast: a, toastApiError: l, adminMutations: u } = r(), { id: d } = e(), f = X(), p = J(u.revokeCustomerProductAccess(f, t)), [m, h] = q.useState(!1), [g, _] = q.useState("");
|
|
1042
|
+
return /* @__PURE__ */ Q(V, {
|
|
1024
1043
|
open: m,
|
|
1025
1044
|
onOpenChange: h,
|
|
1026
|
-
children: [/* @__PURE__ */
|
|
1045
|
+
children: [/* @__PURE__ */ Z(ee, { render: /* @__PURE__ */ Z(s, {
|
|
1027
1046
|
variant: "ghost",
|
|
1028
1047
|
size: "icon",
|
|
1029
1048
|
"aria-label": i,
|
|
1030
|
-
children: /* @__PURE__ */
|
|
1031
|
-
icon:
|
|
1049
|
+
children: /* @__PURE__ */ Z(se, {
|
|
1050
|
+
icon: ue,
|
|
1032
1051
|
className: "size-4 text-destructive"
|
|
1033
1052
|
})
|
|
1034
|
-
}) }), /* @__PURE__ */
|
|
1053
|
+
}) }), /* @__PURE__ */ Q(R, {
|
|
1035
1054
|
className: te,
|
|
1036
1055
|
children: [
|
|
1037
|
-
/* @__PURE__ */
|
|
1038
|
-
/* @__PURE__ */
|
|
1056
|
+
/* @__PURE__ */ Q(I, { children: [/* @__PURE__ */ Z(z, { children: /* @__PURE__ */ Z(o, { id: "Take the product back" }) }), /* @__PURE__ */ Z(B, { children: /* @__PURE__ */ Z(o, { id: "The customer loses its entitlements now. The grant stays on record with your reason." }) })] }),
|
|
1057
|
+
/* @__PURE__ */ Q("div", {
|
|
1039
1058
|
className: "flex flex-col gap-1.5",
|
|
1040
|
-
children: [/* @__PURE__ */
|
|
1059
|
+
children: [/* @__PURE__ */ Z(H, {
|
|
1041
1060
|
htmlFor: d("revoke-access-reason"),
|
|
1042
|
-
children: /* @__PURE__ */
|
|
1043
|
-
}), /* @__PURE__ */
|
|
1061
|
+
children: /* @__PURE__ */ Z(o, { id: "Reason" })
|
|
1062
|
+
}), /* @__PURE__ */ Z(c, {
|
|
1044
1063
|
id: d("revoke-access-reason"),
|
|
1045
1064
|
value: g,
|
|
1046
1065
|
onChange: (e) => _(e.target.value),
|
|
1047
1066
|
maxLength: 500
|
|
1048
1067
|
})]
|
|
1049
1068
|
}),
|
|
1050
|
-
/* @__PURE__ */
|
|
1069
|
+
/* @__PURE__ */ Q(L, { children: [/* @__PURE__ */ Z(s, {
|
|
1051
1070
|
variant: "outline",
|
|
1052
1071
|
onClick: () => h(!1),
|
|
1053
|
-
children: /* @__PURE__ */
|
|
1054
|
-
}), /* @__PURE__ */
|
|
1072
|
+
children: /* @__PURE__ */ Z(o, { id: "Cancel" })
|
|
1073
|
+
}), /* @__PURE__ */ Z(s, {
|
|
1055
1074
|
variant: "destructive",
|
|
1056
1075
|
disabled: !g.trim() || p.isPending,
|
|
1057
1076
|
onClick: async () => {
|
|
@@ -1070,11 +1089,11 @@ function Ae({ customerId: t, grantId: n, label: i }) {
|
|
|
1070
1089
|
})]
|
|
1071
1090
|
});
|
|
1072
1091
|
}
|
|
1073
|
-
function
|
|
1074
|
-
let { toast: n, toastApiError: i, adminMutations: a, adminQueries: l } = r(), { id: u, text: d } = e(), [f, p] =
|
|
1092
|
+
function Me({ customerId: t }) {
|
|
1093
|
+
let { toast: n, toastApiError: i, adminMutations: a, adminQueries: l } = r(), { id: u, text: d } = e(), [f, p] = q.useState(!1), m = X(), h = J(a.grantCustomerProductAccess(m, t)), { data: g } = Y({
|
|
1075
1094
|
...l.allProducts(),
|
|
1076
1095
|
enabled: f
|
|
1077
|
-
}), _ =
|
|
1096
|
+
}), _ = de({
|
|
1078
1097
|
defaultValues: {
|
|
1079
1098
|
productId: "",
|
|
1080
1099
|
duration: "30",
|
|
@@ -1082,59 +1101,59 @@ function je({ customerId: t }) {
|
|
|
1082
1101
|
note: ""
|
|
1083
1102
|
},
|
|
1084
1103
|
onSubmit: async ({ value: e }) => {
|
|
1085
|
-
let t =
|
|
1104
|
+
let t = we(e.duration, e.until);
|
|
1086
1105
|
if (t) try {
|
|
1087
1106
|
await h.mutateAsync({
|
|
1088
1107
|
productId: e.productId,
|
|
1089
1108
|
...t,
|
|
1090
1109
|
note: e.note.trim() || void 0
|
|
1091
|
-
}), n.success("Product access granted"),
|
|
1110
|
+
}), n.success("Product access granted"), v(!1);
|
|
1092
1111
|
} catch (e) {
|
|
1093
1112
|
i(e, "Grant product access");
|
|
1094
1113
|
}
|
|
1095
1114
|
}
|
|
1096
|
-
}),
|
|
1115
|
+
}), v = (e) => {
|
|
1097
1116
|
p(e), e || (_.reset(), h.reset());
|
|
1098
1117
|
};
|
|
1099
|
-
return /* @__PURE__ */
|
|
1118
|
+
return /* @__PURE__ */ Q(V, {
|
|
1100
1119
|
open: f,
|
|
1101
|
-
onOpenChange:
|
|
1102
|
-
children: [/* @__PURE__ */
|
|
1120
|
+
onOpenChange: v,
|
|
1121
|
+
children: [/* @__PURE__ */ Z(ee, { render: /* @__PURE__ */ Q(s, {
|
|
1103
1122
|
variant: "outline",
|
|
1104
1123
|
size: "sm",
|
|
1105
|
-
children: [/* @__PURE__ */
|
|
1106
|
-
icon:
|
|
1124
|
+
children: [/* @__PURE__ */ Z(se, {
|
|
1125
|
+
icon: ce,
|
|
1107
1126
|
className: "size-4"
|
|
1108
|
-
}), /* @__PURE__ */
|
|
1109
|
-
}) }), /* @__PURE__ */
|
|
1127
|
+
}), /* @__PURE__ */ Z(o, { id: " Product access" })]
|
|
1128
|
+
}) }), /* @__PURE__ */ Q(R, {
|
|
1110
1129
|
className: te,
|
|
1111
|
-
children: [/* @__PURE__ */
|
|
1130
|
+
children: [/* @__PURE__ */ Q(I, { children: [/* @__PURE__ */ Z(z, { children: /* @__PURE__ */ Z(o, { id: "Grant product access" }) }), /* @__PURE__ */ Z(B, { children: /* @__PURE__ */ Z(o, { 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", {
|
|
1112
1131
|
onSubmit: (e) => {
|
|
1113
1132
|
e.preventDefault(), e.stopPropagation(), _.handleSubmit();
|
|
1114
1133
|
},
|
|
1115
1134
|
className: "grid gap-4",
|
|
1116
|
-
children: [/* @__PURE__ */
|
|
1135
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
1117
1136
|
className: "grid gap-3",
|
|
1118
1137
|
children: [
|
|
1119
|
-
/* @__PURE__ */
|
|
1138
|
+
/* @__PURE__ */ Z(_.Field, {
|
|
1120
1139
|
name: "productId",
|
|
1121
1140
|
validators: { onChange: ({ value: e }) => e ? void 0 : "Pick a product" },
|
|
1122
|
-
children: (e) => /* @__PURE__ */
|
|
1141
|
+
children: (e) => /* @__PURE__ */ Q("div", {
|
|
1123
1142
|
className: "grid gap-1.5",
|
|
1124
1143
|
children: [
|
|
1125
|
-
/* @__PURE__ */
|
|
1144
|
+
/* @__PURE__ */ Z(H, {
|
|
1126
1145
|
htmlFor: u("pa-product"),
|
|
1127
|
-
children: /* @__PURE__ */
|
|
1146
|
+
children: /* @__PURE__ */ Z(o, { id: "Product" })
|
|
1128
1147
|
}),
|
|
1129
|
-
/* @__PURE__ */
|
|
1148
|
+
/* @__PURE__ */ Q(w, {
|
|
1130
1149
|
value: e.state.value,
|
|
1131
1150
|
onValueChange: (t) => e.handleChange(t ?? ""),
|
|
1132
|
-
children: [/* @__PURE__ */
|
|
1151
|
+
children: [/* @__PURE__ */ Z(x, {
|
|
1133
1152
|
className: "w-full",
|
|
1134
1153
|
id: u("pa-product"),
|
|
1135
1154
|
"aria-invalid": e.state.meta.errors.length > 0,
|
|
1136
|
-
children: /* @__PURE__ */
|
|
1137
|
-
}), /* @__PURE__ */
|
|
1155
|
+
children: /* @__PURE__ */ Z(b, { placeholder: d("Pick a product") })
|
|
1156
|
+
}), /* @__PURE__ */ Z(S, { children: (g?.data ?? []).map((e) => /* @__PURE__ */ Q(C, {
|
|
1138
1157
|
value: e.id,
|
|
1139
1158
|
children: [
|
|
1140
1159
|
e.display_name,
|
|
@@ -1144,25 +1163,25 @@ function je({ customerId: t }) {
|
|
|
1144
1163
|
]
|
|
1145
1164
|
}, e.id)) })]
|
|
1146
1165
|
}),
|
|
1147
|
-
/* @__PURE__ */
|
|
1166
|
+
/* @__PURE__ */ Z(y, { errors: e.state.meta.errors })
|
|
1148
1167
|
]
|
|
1149
1168
|
})
|
|
1150
1169
|
}),
|
|
1151
|
-
/* @__PURE__ */
|
|
1170
|
+
/* @__PURE__ */ Z(_.Field, {
|
|
1152
1171
|
name: "duration",
|
|
1153
|
-
children: (e) => /* @__PURE__ */
|
|
1172
|
+
children: (e) => /* @__PURE__ */ Q("div", {
|
|
1154
1173
|
className: "grid gap-1.5",
|
|
1155
1174
|
children: [
|
|
1156
|
-
/* @__PURE__ */
|
|
1175
|
+
/* @__PURE__ */ Z(H, {
|
|
1157
1176
|
htmlFor: u("pa-duration"),
|
|
1158
|
-
children: /* @__PURE__ */
|
|
1177
|
+
children: /* @__PURE__ */ Z(o, { id: "How long it lasts" })
|
|
1159
1178
|
}),
|
|
1160
|
-
/* @__PURE__ */
|
|
1179
|
+
/* @__PURE__ */ Z("p", {
|
|
1161
1180
|
className: "text-[13px] text-muted-foreground",
|
|
1162
|
-
children: /* @__PURE__ */
|
|
1181
|
+
children: /* @__PURE__ */ Z(o, { id: "Days are added after any access they already have." })
|
|
1163
1182
|
}),
|
|
1164
|
-
/* @__PURE__ */
|
|
1165
|
-
items:
|
|
1183
|
+
/* @__PURE__ */ Q(w, {
|
|
1184
|
+
items: Se.map((e) => ({
|
|
1166
1185
|
value: e.value,
|
|
1167
1186
|
label: e.label
|
|
1168
1187
|
})),
|
|
@@ -1170,11 +1189,11 @@ function je({ customerId: t }) {
|
|
|
1170
1189
|
onValueChange: (t) => {
|
|
1171
1190
|
t && e.handleChange(t);
|
|
1172
1191
|
},
|
|
1173
|
-
children: [/* @__PURE__ */
|
|
1192
|
+
children: [/* @__PURE__ */ Z(x, {
|
|
1174
1193
|
className: "w-full",
|
|
1175
1194
|
id: u("pa-duration"),
|
|
1176
|
-
children: /* @__PURE__ */
|
|
1177
|
-
}), /* @__PURE__ */
|
|
1195
|
+
children: /* @__PURE__ */ Z(b, {})
|
|
1196
|
+
}), /* @__PURE__ */ Z(S, { children: Se.map((e) => /* @__PURE__ */ Z(C, {
|
|
1178
1197
|
value: e.value,
|
|
1179
1198
|
children: e.label
|
|
1180
1199
|
}, e.value)) })]
|
|
@@ -1182,19 +1201,19 @@ function je({ customerId: t }) {
|
|
|
1182
1201
|
]
|
|
1183
1202
|
})
|
|
1184
1203
|
}),
|
|
1185
|
-
/* @__PURE__ */
|
|
1204
|
+
/* @__PURE__ */ Z(_.Subscribe, {
|
|
1186
1205
|
selector: (e) => e.values.duration,
|
|
1187
|
-
children: (e) => e === "until" ? /* @__PURE__ */
|
|
1206
|
+
children: (e) => e === "until" ? /* @__PURE__ */ Z(_.Field, {
|
|
1188
1207
|
name: "until",
|
|
1189
|
-
validators: { onChange: ({ value: e }) =>
|
|
1190
|
-
children: (e) => /* @__PURE__ */
|
|
1208
|
+
validators: { onChange: ({ value: e }) => we("until", e) ? void 0 : "Pick today or a later date" },
|
|
1209
|
+
children: (e) => /* @__PURE__ */ Q("div", {
|
|
1191
1210
|
className: "grid gap-1.5",
|
|
1192
1211
|
children: [
|
|
1193
|
-
/* @__PURE__ */
|
|
1212
|
+
/* @__PURE__ */ Z(H, {
|
|
1194
1213
|
htmlFor: u("pa-until"),
|
|
1195
|
-
children: /* @__PURE__ */
|
|
1214
|
+
children: /* @__PURE__ */ Z(o, { id: "Last day (UTC)" })
|
|
1196
1215
|
}),
|
|
1197
|
-
/* @__PURE__ */
|
|
1216
|
+
/* @__PURE__ */ Z(c, {
|
|
1198
1217
|
id: u("pa-until"),
|
|
1199
1218
|
type: "date",
|
|
1200
1219
|
min: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
@@ -1203,19 +1222,19 @@ function je({ customerId: t }) {
|
|
|
1203
1222
|
onChange: (t) => e.handleChange(t.target.value),
|
|
1204
1223
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
1205
1224
|
}),
|
|
1206
|
-
/* @__PURE__ */
|
|
1225
|
+
/* @__PURE__ */ Z(y, { errors: e.state.meta.errors })
|
|
1207
1226
|
]
|
|
1208
1227
|
})
|
|
1209
1228
|
}) : null
|
|
1210
1229
|
}),
|
|
1211
|
-
/* @__PURE__ */
|
|
1230
|
+
/* @__PURE__ */ Z(_.Field, {
|
|
1212
1231
|
name: "note",
|
|
1213
|
-
children: (e) => /* @__PURE__ */
|
|
1232
|
+
children: (e) => /* @__PURE__ */ Q("div", {
|
|
1214
1233
|
className: "grid gap-1.5",
|
|
1215
|
-
children: [/* @__PURE__ */
|
|
1234
|
+
children: [/* @__PURE__ */ Z(H, {
|
|
1216
1235
|
htmlFor: u("pa-note"),
|
|
1217
|
-
children: /* @__PURE__ */
|
|
1218
|
-
}), /* @__PURE__ */
|
|
1236
|
+
children: /* @__PURE__ */ Z(o, { id: "Note" })
|
|
1237
|
+
}), /* @__PURE__ */ Z(c, {
|
|
1219
1238
|
id: u("pa-note"),
|
|
1220
1239
|
value: e.state.value,
|
|
1221
1240
|
onBlur: e.handleBlur,
|
|
@@ -1225,20 +1244,20 @@ function je({ customerId: t }) {
|
|
|
1225
1244
|
})
|
|
1226
1245
|
})
|
|
1227
1246
|
]
|
|
1228
|
-
}), /* @__PURE__ */
|
|
1247
|
+
}), /* @__PURE__ */ Z(L, { children: /* @__PURE__ */ Z(_.Subscribe, {
|
|
1229
1248
|
selector: (e) => [
|
|
1230
1249
|
e.values.productId,
|
|
1231
1250
|
e.canSubmit,
|
|
1232
1251
|
e.isSubmitting,
|
|
1233
|
-
|
|
1252
|
+
we(e.values.duration, e.values.until) !== null
|
|
1234
1253
|
],
|
|
1235
|
-
children: ([e, t, n, r]) => /* @__PURE__ */
|
|
1254
|
+
children: ([e, t, n, r]) => /* @__PURE__ */ Q(oe, { children: [/* @__PURE__ */ Z(s, {
|
|
1236
1255
|
type: "button",
|
|
1237
1256
|
variant: "outline",
|
|
1238
1257
|
disabled: n,
|
|
1239
|
-
onClick: () =>
|
|
1240
|
-
children: /* @__PURE__ */
|
|
1241
|
-
}), /* @__PURE__ */
|
|
1258
|
+
onClick: () => v(!1),
|
|
1259
|
+
children: /* @__PURE__ */ Z(o, { id: "Cancel" })
|
|
1260
|
+
}), /* @__PURE__ */ Z(s, {
|
|
1242
1261
|
type: "submit",
|
|
1243
1262
|
disabled: !e || !t || n || !r,
|
|
1244
1263
|
children: n ? "Granting…" : "Grant access"
|
|
@@ -1248,65 +1267,65 @@ function je({ customerId: t }) {
|
|
|
1248
1267
|
})]
|
|
1249
1268
|
});
|
|
1250
1269
|
}
|
|
1251
|
-
function
|
|
1252
|
-
return /* @__PURE__ */
|
|
1270
|
+
function Ne({ contact: e }) {
|
|
1271
|
+
return /* @__PURE__ */ Q(K, { children: [/* @__PURE__ */ Z(U, {
|
|
1253
1272
|
className: "pb-1",
|
|
1254
|
-
children: /* @__PURE__ */
|
|
1273
|
+
children: /* @__PURE__ */ Z(W, {
|
|
1255
1274
|
className: "text-sm",
|
|
1256
|
-
children: /* @__PURE__ */
|
|
1275
|
+
children: /* @__PURE__ */ Z(o, { id: "Contact" })
|
|
1257
1276
|
})
|
|
1258
|
-
}), /* @__PURE__ */
|
|
1277
|
+
}), /* @__PURE__ */ Z(G, {
|
|
1259
1278
|
className: "text-sm",
|
|
1260
|
-
children: e ? /* @__PURE__ */
|
|
1279
|
+
children: e ? /* @__PURE__ */ Q("dl", {
|
|
1261
1280
|
className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1",
|
|
1262
1281
|
children: [
|
|
1263
|
-
/* @__PURE__ */
|
|
1282
|
+
/* @__PURE__ */ Z("dt", {
|
|
1264
1283
|
className: "text-muted-foreground",
|
|
1265
|
-
children: /* @__PURE__ */
|
|
1284
|
+
children: /* @__PURE__ */ Z(o, { id: "Email" })
|
|
1266
1285
|
}),
|
|
1267
|
-
/* @__PURE__ */
|
|
1286
|
+
/* @__PURE__ */ Z("dd", {
|
|
1268
1287
|
className: "truncate",
|
|
1269
1288
|
children: e.email ?? "—"
|
|
1270
1289
|
}),
|
|
1271
|
-
/* @__PURE__ */
|
|
1290
|
+
/* @__PURE__ */ Z("dt", {
|
|
1272
1291
|
className: "text-muted-foreground",
|
|
1273
|
-
children: /* @__PURE__ */
|
|
1292
|
+
children: /* @__PURE__ */ Z(o, { id: "Name" })
|
|
1274
1293
|
}),
|
|
1275
|
-
/* @__PURE__ */
|
|
1294
|
+
/* @__PURE__ */ Z("dd", {
|
|
1276
1295
|
className: "truncate",
|
|
1277
1296
|
children: e.name ?? "—"
|
|
1278
1297
|
}),
|
|
1279
|
-
/* @__PURE__ */
|
|
1298
|
+
/* @__PURE__ */ Z("dt", {
|
|
1280
1299
|
className: "text-muted-foreground",
|
|
1281
|
-
children: /* @__PURE__ */
|
|
1300
|
+
children: /* @__PURE__ */ Z(o, { id: "Username" })
|
|
1282
1301
|
}),
|
|
1283
|
-
/* @__PURE__ */
|
|
1302
|
+
/* @__PURE__ */ Z("dd", {
|
|
1284
1303
|
className: "truncate",
|
|
1285
1304
|
children: e.username ?? "—"
|
|
1286
1305
|
}),
|
|
1287
|
-
e.active !== null && /* @__PURE__ */
|
|
1306
|
+
e.active !== null && /* @__PURE__ */ Q(oe, { children: [/* @__PURE__ */ Z("dt", {
|
|
1288
1307
|
className: "text-muted-foreground",
|
|
1289
|
-
children: /* @__PURE__ */
|
|
1290
|
-
}), /* @__PURE__ */
|
|
1308
|
+
children: /* @__PURE__ */ Z(o, { id: "Directory" })
|
|
1309
|
+
}), /* @__PURE__ */ Z("dd", { children: /* @__PURE__ */ Z(P, {
|
|
1291
1310
|
variant: e.active ? "secondary" : "outline",
|
|
1292
1311
|
children: e.active ? "Active" : "Deactivated"
|
|
1293
1312
|
}) })] }),
|
|
1294
|
-
/* @__PURE__ */
|
|
1313
|
+
/* @__PURE__ */ Z("dt", {
|
|
1295
1314
|
className: "text-muted-foreground",
|
|
1296
|
-
children: /* @__PURE__ */
|
|
1315
|
+
children: /* @__PURE__ */ Z(o, { id: "Synced" })
|
|
1297
1316
|
}),
|
|
1298
|
-
/* @__PURE__ */
|
|
1317
|
+
/* @__PURE__ */ Z("dd", {
|
|
1299
1318
|
className: "tabular-nums",
|
|
1300
1319
|
children: e.synced_at ? m(e.synced_at) : "Live"
|
|
1301
1320
|
})
|
|
1302
1321
|
]
|
|
1303
|
-
}) : /* @__PURE__ */
|
|
1322
|
+
}) : /* @__PURE__ */ Z("p", {
|
|
1304
1323
|
className: "text-muted-foreground",
|
|
1305
|
-
children: /* @__PURE__ */
|
|
1324
|
+
children: /* @__PURE__ */ Z(o, { id: "Your directory holds no contact for this customer." })
|
|
1306
1325
|
})
|
|
1307
1326
|
})] });
|
|
1308
1327
|
}
|
|
1309
1328
|
//#endregion
|
|
1310
|
-
export {
|
|
1329
|
+
export { Te as CustomerDetailPage };
|
|
1311
1330
|
|
|
1312
|
-
//# sourceMappingURL=admin-detail-
|
|
1331
|
+
//# sourceMappingURL=admin-detail-9YAep3ts.js.map
|