@openrails/billing-ui 0.274.0 → 0.275.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 +14 -0
- package/dist/admin/lib/api/endpoints.d.ts +2 -1
- package/dist/admin/lib/api/index.d.ts +1 -0
- package/dist/admin/lib/api/order-endpoints.d.ts +1 -0
- package/dist/admin/lib/api/types.d.ts +2 -12
- package/dist/admin/lib/format.d.ts +5 -1
- package/dist/admin/lib/order-queries.d.ts +3 -0
- package/dist/admin/lib/queries.d.ts +3 -0
- package/dist/admin/messages.d.ts +13 -8
- package/dist/admin/pages/dashboard/lib.d.ts +1 -0
- package/dist/admin/pages/imports/shared.d.ts +1 -0
- package/dist/admin/pages/subscriptions/change-subscription-dialog.d.ts +4 -7
- package/dist/admin/pages/subscriptions/subscription-change-options.d.ts +6 -15
- package/dist/{admin-attempts-Dzipkstg.js → admin-attempts-CP5CWyNR.js} +28 -28
- package/dist/{admin-attempts-Dzipkstg.js.map → admin-attempts-CP5CWyNR.js.map} +1 -1
- package/dist/{admin-auth-BCl_Tv3t.js → admin-auth-DlIOmwPo.js} +2 -2
- package/dist/{admin-auth-BCl_Tv3t.js.map → admin-auth-DlIOmwPo.js.map} +1 -1
- package/dist/{admin-badge-kmYQM9Ge.js → admin-badge-DR_8AhdC.js} +2 -2
- package/dist/{admin-badge-kmYQM9Ge.js.map → admin-badge-DR_8AhdC.js.map} +1 -1
- package/dist/{admin-button-Cq9ZfX4R.js → admin-button-DBzTD6By.js} +2 -2
- package/dist/{admin-button-Cq9ZfX4R.js.map → admin-button-DBzTD6By.js.map} +1 -1
- package/dist/{admin-capabilities-k5fQZhN9.js → admin-capabilities-CZdT1Pxe.js} +2 -2
- package/dist/{admin-capabilities-k5fQZhN9.js.map → admin-capabilities-CZdT1Pxe.js.map} +1 -1
- package/dist/{admin-card-C8k67jJv.js → admin-card-mZl4-s5d.js} +2 -2
- package/dist/{admin-card-C8k67jJv.js.map → admin-card-mZl4-s5d.js.map} +1 -1
- package/dist/{admin-catalog-CON-GwKL.js → admin-catalog-DpTjS0Yo.js} +38 -38
- package/dist/{admin-catalog-CON-GwKL.js.map → admin-catalog-DpTjS0Yo.js.map} +1 -1
- package/dist/{admin-cursor-pager-DqFruoNu.js → admin-cursor-pager-C-KjCIy9.js} +4 -4
- package/dist/{admin-cursor-pager-DqFruoNu.js.map → admin-cursor-pager-C-KjCIy9.js.map} +1 -1
- package/dist/{admin-customers-CWWOrcVR.js → admin-customers-BE3N839X.js} +12 -12
- package/dist/{admin-customers-CWWOrcVR.js.map → admin-customers-BE3N839X.js.map} +1 -1
- package/dist/{admin-dashboard-BiShWFk2.js → admin-dashboard-BxjkV15J.js} +25 -17
- package/dist/admin-dashboard-BxjkV15J.js.map +1 -0
- package/dist/{admin-data-table-CdsjYJh5.js → admin-data-table-D89AwWz_.js} +5 -5
- package/dist/{admin-data-table-CdsjYJh5.js.map → admin-data-table-D89AwWz_.js.map} +1 -1
- package/dist/{admin-detail-BWSC1aCH.js → admin-detail-BKe9xqPd.js} +41 -41
- package/dist/{admin-detail-BWSC1aCH.js.map → admin-detail-BKe9xqPd.js.map} +1 -1
- package/dist/admin-detail-C8lD7U2t.js +699 -0
- package/dist/admin-detail-C8lD7U2t.js.map +1 -0
- package/dist/{admin-detail-CMmhZQ2A.js → admin-detail-D6zD085K.js} +45 -37
- package/dist/admin-detail-D6zD085K.js.map +1 -0
- package/dist/{admin-detail-Cyuf_i9U.js → admin-detail-Ln56otK0.js} +40 -40
- package/dist/{admin-detail-Cyuf_i9U.js.map → admin-detail-Ln56otK0.js.map} +1 -1
- package/dist/{admin-detail-CiONe1Pt.js → admin-detail-P-UnNvXJ.js} +171 -171
- package/dist/admin-detail-P-UnNvXJ.js.map +1 -0
- package/dist/{admin-dialog-Ch7rTOCr.js → admin-dialog-Dn2FRJu4.js} +3 -3
- package/dist/{admin-dialog-Ch7rTOCr.js.map → admin-dialog-Dn2FRJu4.js.map} +1 -1
- package/dist/{admin-dropdown-menu-Bah3f8AZ.js → admin-dropdown-menu-DLUn6Uj3.js} +2 -2
- package/dist/{admin-dropdown-menu-Bah3f8AZ.js.map → admin-dropdown-menu-DLUn6Uj3.js.map} +1 -1
- package/dist/{admin-dunning-B2zgtrOo.js → admin-dunning-COaHzrmN.js} +2 -2
- package/dist/{admin-dunning-B2zgtrOo.js.map → admin-dunning-COaHzrmN.js.map} +1 -1
- package/dist/{admin-fact-card-Bt__Cd_U.js → admin-fact-card-DKvBnUXB.js} +2 -2
- package/dist/{admin-fact-card-Bt__Cd_U.js.map → admin-fact-card-DKvBnUXB.js.map} +1 -1
- package/dist/admin-format-BbiTCqUG.js +171 -0
- package/dist/admin-format-BbiTCqUG.js.map +1 -0
- package/dist/{admin-health-pzTO6_0v.js → admin-health-DmnI4e8K.js} +10 -10
- package/dist/{admin-health-pzTO6_0v.js.map → admin-health-DmnI4e8K.js.map} +1 -1
- package/dist/{admin-imports-tT5et8-V.js → admin-imports-C0aMP6sj.js} +18 -18
- package/dist/{admin-imports-tT5et8-V.js.map → admin-imports-C0aMP6sj.js.map} +1 -1
- package/dist/{admin-input-DvRZy_2a.js → admin-input-JKrQIGfD.js} +2 -2
- package/dist/{admin-input-DvRZy_2a.js.map → admin-input-JKrQIGfD.js.map} +1 -1
- package/dist/{admin-label-QZtWJGH-.js → admin-label-CHWsVIZC.js} +2 -2
- package/dist/{admin-label-QZtWJGH-.js.map → admin-label-CHWsVIZC.js.map} +1 -1
- package/dist/{admin-linked-table-row-6jkCKwMn.js → admin-linked-table-row-BMZYYsuk.js} +3 -3
- package/dist/{admin-linked-table-row-6jkCKwMn.js.map → admin-linked-table-row-BMZYYsuk.js.map} +1 -1
- package/dist/{admin-map-dialog-BV54mvMQ.js → admin-map-dialog-BHUGdCcv.js} +10 -10
- package/dist/{admin-map-dialog-BV54mvMQ.js.map → admin-map-dialog-BHUGdCcv.js.map} +1 -1
- package/dist/{admin-metering-Bv5EcX6M.js → admin-metering-CDqueHUh.js} +15 -15
- package/dist/{admin-metering-Bv5EcX6M.js.map → admin-metering-CDqueHUh.js.map} +1 -1
- package/dist/{admin-missing-record-BXqGFDt3.js → admin-missing-record-BPFs3MmO.js} +2 -2
- package/dist/{admin-missing-record-BXqGFDt3.js.map → admin-missing-record-BPFs3MmO.js.map} +1 -1
- package/dist/{admin-ops-h3RjpcNu.js → admin-ops-CL2kjDwi.js} +18 -15
- package/dist/admin-ops-CL2kjDwi.js.map +1 -0
- package/dist/admin-orders-C1Sf2qhc.js +192 -0
- package/dist/admin-orders-C1Sf2qhc.js.map +1 -0
- package/dist/admin-parked-a0tB5bhG.js +193 -0
- package/dist/admin-parked-a0tB5bhG.js.map +1 -0
- package/dist/admin-payments-DJcjwRA4.js +221 -0
- package/dist/admin-payments-DJcjwRA4.js.map +1 -0
- package/dist/{admin-price-detail-BjWYU5A-.js → admin-price-detail-BOmeWw15.js} +15 -15
- package/dist/{admin-price-detail-BjWYU5A-.js.map → admin-price-detail-BOmeWw15.js.map} +1 -1
- package/dist/{admin-price-format-BVUpDoSC.js → admin-price-format-CqOmHrIn.js} +2 -2
- package/dist/{admin-price-format-BVUpDoSC.js.map → admin-price-format-CqOmHrIn.js.map} +1 -1
- package/dist/{admin-price-wizard-CTbkbmYc.js → admin-price-wizard-B6s5OJeO.js} +9 -9
- package/dist/{admin-price-wizard-CTbkbmYc.js.map → admin-price-wizard-B6s5OJeO.js.map} +1 -1
- package/dist/{admin-proposals-Ci9Q8j7Y.js → admin-proposals-DVrl-ym4.js} +20 -20
- package/dist/{admin-proposals-Ci9Q8j7Y.js.map → admin-proposals-DVrl-ym4.js.map} +1 -1
- package/dist/admin-provider-prices-BVVogH7Q.js +241 -0
- package/dist/admin-provider-prices-BVVogH7Q.js.map +1 -0
- package/dist/{admin-range-picker-nfflPp21.js → admin-range-picker-C6BtSm2B.js} +5 -5
- package/dist/{admin-range-picker-nfflPp21.js.map → admin-range-picker-C6BtSm2B.js.map} +1 -1
- package/dist/{admin-records-CrTCorWH.js → admin-records-DKtcgN11.js} +19 -19
- package/dist/{admin-records-CrTCorWH.js.map → admin-records-DKtcgN11.js.map} +1 -1
- package/dist/{admin-reports-BO6wrvtw.js → admin-reports-CtPoiceH.js} +8 -8
- package/dist/{admin-reports-BO6wrvtw.js.map → admin-reports-CtPoiceH.js.map} +1 -1
- package/dist/{admin-select-DvfJ80Rg.js → admin-select-6Yuh5M1Q.js} +2 -2
- package/dist/{admin-select-DvfJ80Rg.js.map → admin-select-6Yuh5M1Q.js.map} +1 -1
- package/dist/{admin-settings-BOoTzhyf.js → admin-settings-DscHu4ww.js} +560 -550
- package/dist/admin-settings-DscHu4ww.js.map +1 -0
- package/dist/{admin-shared-BbGT_qTo.js → admin-shared-BywM-MMp.js} +13 -9
- package/dist/{admin-shared-BbGT_qTo.js.map → admin-shared-BywM-MMp.js.map} +1 -1
- package/dist/{admin-skeleton-B2a4ScVE.js → admin-skeleton-lndmw89u.js} +2 -2
- package/dist/{admin-skeleton-B2a4ScVE.js.map → admin-skeleton-lndmw89u.js.map} +1 -1
- package/dist/{admin-status-badge-Bp6cssXY.js → admin-status-badge-IL8ofZ_6.js} +3 -3
- package/dist/{admin-status-badge-Bp6cssXY.js.map → admin-status-badge-IL8ofZ_6.js.map} +1 -1
- package/dist/{admin-subscriptions-D9JmoicC.js → admin-subscriptions-Cd5CGrue.js} +83 -87
- package/dist/admin-subscriptions-Cd5CGrue.js.map +1 -0
- package/dist/{admin-switch-DBBxJRZP.js → admin-switch-DpwQSzEm.js} +2 -2
- package/dist/{admin-switch-DBBxJRZP.js.map → admin-switch-DpwQSzEm.js.map} +1 -1
- package/dist/{admin-table-CPDoVfK4.js → admin-table-D-GdGM1m.js} +2 -2
- package/dist/{admin-table-CPDoVfK4.js.map → admin-table-D-GdGM1m.js.map} +1 -1
- package/dist/admin-tabs-B--1flzO.js +158 -0
- package/dist/admin-tabs-B--1flzO.js.map +1 -0
- package/dist/{admin-textarea-d3fu_waS.js → admin-textarea-xsp5V9xM.js} +2 -2
- package/dist/{admin-textarea-d3fu_waS.js.map → admin-textarea-xsp5V9xM.js.map} +1 -1
- package/dist/{admin-typed-confirm-dialog-BVklYjFo.js → admin-typed-confirm-dialog-NiEDwX_0.js} +6 -6
- package/dist/{admin-typed-confirm-dialog-BVklYjFo.js.map → admin-typed-confirm-dialog-NiEDwX_0.js.map} +1 -1
- package/dist/{admin-utils-DTT53IpS.js → admin-utils-wuPUD0uh.js} +152 -137
- package/dist/admin-utils-wuPUD0uh.js.map +1 -0
- package/dist/{admin-widget-viz-Exsqz3Dw.js → admin-widget-viz-kHHVmDEx.js} +215 -187
- package/dist/admin-widget-viz-kHHVmDEx.js.map +1 -0
- package/dist/admin.css +1 -1
- package/dist/admin.js +49 -44
- package/dist/admin.js.map +1 -1
- package/dist/client/generated/routes.d.ts +17 -0
- package/dist/client/generated/wire.d.ts +4 -0
- package/dist/client/types.d.ts +6 -0
- package/dist/{client-BYgnI6_h.js → client-ctrbivyN.js} +3 -2
- package/dist/client-ctrbivyN.js.map +1 -0
- package/dist/client.js +1 -1
- package/dist/{hooks-t2tSrCpa.js → hooks-KpTetx6F.js} +2 -2
- package/dist/{hooks-t2tSrCpa.js.map → hooks-KpTetx6F.js.map} +1 -1
- package/dist/index.js +750 -711
- package/dist/index.js.map +1 -1
- package/dist/lib/card-brands.d.ts +1 -0
- package/dist/locales/de.js +3 -0
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.d.ts +3 -0
- package/dist/locales/en.js +3 -0
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +3 -0
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +3 -0
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +3 -0
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +3 -0
- package/dist/locales/zh.js.map +1 -1
- package/dist/react.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/admin-customer-search-CJHB80rg.js +0 -117
- package/dist/admin-customer-search-CJHB80rg.js.map +0 -1
- package/dist/admin-dashboard-BiShWFk2.js.map +0 -1
- package/dist/admin-detail-CKRtK43V.js +0 -728
- package/dist/admin-detail-CKRtK43V.js.map +0 -1
- package/dist/admin-detail-CMmhZQ2A.js.map +0 -1
- package/dist/admin-detail-CiONe1Pt.js.map +0 -1
- package/dist/admin-format-DoohJ7Fg.js +0 -136
- package/dist/admin-format-DoohJ7Fg.js.map +0 -1
- package/dist/admin-ops-h3RjpcNu.js.map +0 -1
- package/dist/admin-orders-DYxPiuTl.js +0 -192
- package/dist/admin-orders-DYxPiuTl.js.map +0 -1
- package/dist/admin-parked-ClKA60d5.js +0 -193
- package/dist/admin-parked-ClKA60d5.js.map +0 -1
- package/dist/admin-payments-BlIuy3wL.js +0 -220
- package/dist/admin-payments-BlIuy3wL.js.map +0 -1
- package/dist/admin-provider-prices-B6Ayq-eN.js +0 -246
- package/dist/admin-provider-prices-B6Ayq-eN.js.map +0 -1
- package/dist/admin-settings-BOoTzhyf.js.map +0 -1
- package/dist/admin-subscriptions-D9JmoicC.js.map +0 -1
- package/dist/admin-tabs-DDUv3kiu.js +0 -46
- package/dist/admin-tabs-DDUv3kiu.js.map +0 -1
- package/dist/admin-utils-DTT53IpS.js.map +0 -1
- package/dist/admin-widget-viz-Exsqz3Dw.js.map +0 -1
- package/dist/client-BYgnI6_h.js.map +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { E as e, O as t, _ as n, c as r, f as i, p as a, r as o, s, t as c } from "./admin-utils-
|
|
2
|
-
import { t as l } from "./admin-button-
|
|
3
|
-
import { t as u } from "./admin-input-
|
|
4
|
-
import { a as d, s as f } from "./admin-capabilities-
|
|
5
|
-
import { t as p } from "./admin-auth-
|
|
6
|
-
import { a as m,
|
|
1
|
+
import { E as e, O as t, _ as n, c as r, f as i, p as a, r as o, s, t as c } from "./admin-utils-wuPUD0uh.js";
|
|
2
|
+
import { t as l } from "./admin-button-DBzTD6By.js";
|
|
3
|
+
import { t as u } from "./admin-input-JKrQIGfD.js";
|
|
4
|
+
import { a as d, s as f } from "./admin-capabilities-CZdT1Pxe.js";
|
|
5
|
+
import { t as p } from "./admin-auth-DlIOmwPo.js";
|
|
6
|
+
import { a as m, d as h, i as g, n as _, o as v, s as y, t as b } from "./admin-format-BbiTCqUG.js";
|
|
7
7
|
import { n as x } from "./admin-confirm-katGq0Qo.js";
|
|
8
|
-
import { t as S } from "./admin-badge-
|
|
9
|
-
import { t as C } from "./admin-status-badge-
|
|
8
|
+
import { t as S } from "./admin-badge-DR_8AhdC.js";
|
|
9
|
+
import { t as C } from "./admin-status-badge-IL8ofZ_6.js";
|
|
10
10
|
import { t as w } from "./admin-form-field-errors-hbUMIriS.js";
|
|
11
|
-
import { a as T, i as E, n as
|
|
12
|
-
import { n as
|
|
13
|
-
import { a as
|
|
14
|
-
import { t as
|
|
15
|
-
import { a as
|
|
16
|
-
import { t as U } from "./admin-label-
|
|
11
|
+
import { a as T, i as E, n as D, r as O, t as k } from "./admin-select-6Yuh5M1Q.js";
|
|
12
|
+
import { n as A, t as j } from "./admin-cursor-pager-C-KjCIy9.js";
|
|
13
|
+
import { a as M, n as N, o as P, r as F, s as I, t as L } from "./admin-table-D-GdGM1m.js";
|
|
14
|
+
import { t as R } from "./admin-linked-table-row-BMZYYsuk.js";
|
|
15
|
+
import { a as z, i as B, n as V, o as H, r as ee, s as te, t as ne } from "./admin-dialog-Dn2FRJu4.js";
|
|
16
|
+
import { t as U } from "./admin-label-CHWsVIZC.js";
|
|
17
17
|
import { n as re, r as ie } from "./admin-dialog-width-CC7QHT1p.js";
|
|
18
|
-
import { a as W, o as G, r as K, t as q } from "./admin-card-
|
|
18
|
+
import { a as W, o as G, r as K, t as q } from "./admin-card-mZl4-s5d.js";
|
|
19
19
|
import "./admin-tile-grids-CzGpidd9.js";
|
|
20
20
|
import { n as ae, t as oe } from "./admin-invoice-profile-model-Cgjy3zV8.js";
|
|
21
|
-
import { t as se } from "./admin-dunning-
|
|
22
|
-
import { t as ce } from "./admin-missing-record-
|
|
21
|
+
import { t as se } from "./admin-dunning-COaHzrmN.js";
|
|
22
|
+
import { t as ce } from "./admin-missing-record-BPFs3MmO.js";
|
|
23
23
|
import * as J from "react";
|
|
24
24
|
import { useState as le } from "react";
|
|
25
25
|
import { useMutation as Y, useQuery as X, useQueryClient as Z } from "@tanstack/react-query";
|
|
@@ -247,7 +247,7 @@ function ye({ currencies: t = [] }) {
|
|
|
247
247
|
//#endregion
|
|
248
248
|
//#region src/admin/pages/customers/credit-form.ts
|
|
249
249
|
function be(e, t = Date.now()) {
|
|
250
|
-
let n =
|
|
250
|
+
let n = b(e.amount, e.decimals);
|
|
251
251
|
if (n === null || BigInt(n) <= 0n) throw Error(`Enter a positive amount with at most ${e.decimals} decimal places, within the supported range.`);
|
|
252
252
|
let r = e.currency.trim();
|
|
253
253
|
if (!r) throw Error("Select a currency.");
|
|
@@ -288,7 +288,7 @@ function Ce({ customerId: e, currencies: t }) {
|
|
|
288
288
|
}, `${r}:${e}`);
|
|
289
289
|
}
|
|
290
290
|
function we({ merchant: r, customer: i, initialCurrency: o }) {
|
|
291
|
-
let { id: s, text: c } = t(), { creditQueries: f } = a(), p = d(), [m,
|
|
291
|
+
let { id: s, text: c } = t(), { creditQueries: f } = a(), p = d(), [m, g] = J.useState(o), [b, x] = J.useState(o), S = A(m, 25), C = A(m, 25), [w, T] = J.useState(!1), [E, D] = J.useState(null), O = X(f.grants(r, i, m, S.size, S.cursor)), k = X(f.transactions(r, i, m, C.size, C.cursor)), R = _(m);
|
|
292
292
|
return /* @__PURE__ */ $(q, { children: [
|
|
293
293
|
/* @__PURE__ */ $(W, {
|
|
294
294
|
className: "gap-3",
|
|
@@ -301,7 +301,7 @@ function we({ merchant: r, customer: i, initialCurrency: o }) {
|
|
|
301
301
|
}), p && /* @__PURE__ */ Q(l, {
|
|
302
302
|
variant: "outline",
|
|
303
303
|
size: "sm",
|
|
304
|
-
disabled:
|
|
304
|
+
disabled: R === void 0,
|
|
305
305
|
onClick: () => T(!0),
|
|
306
306
|
children: /* @__PURE__ */ Q(e, { id: "Grant credit" })
|
|
307
307
|
})]
|
|
@@ -310,8 +310,8 @@ function we({ merchant: r, customer: i, initialCurrency: o }) {
|
|
|
310
310
|
className: "flex max-w-sm items-end gap-2",
|
|
311
311
|
onSubmit: (e) => {
|
|
312
312
|
e.preventDefault();
|
|
313
|
-
let t =
|
|
314
|
-
t &&
|
|
313
|
+
let t = b.trim();
|
|
314
|
+
t && g(t.toUpperCase());
|
|
315
315
|
},
|
|
316
316
|
children: [/* @__PURE__ */ $("div", {
|
|
317
317
|
className: "grid gap-1",
|
|
@@ -320,7 +320,7 @@ function we({ merchant: r, customer: i, initialCurrency: o }) {
|
|
|
320
320
|
children: /* @__PURE__ */ Q(e, { id: "Currency" })
|
|
321
321
|
}), /* @__PURE__ */ Q(u, {
|
|
322
322
|
id: s("credit-currency"),
|
|
323
|
-
value:
|
|
323
|
+
value: b,
|
|
324
324
|
onChange: (e) => x(e.target.value),
|
|
325
325
|
placeholder: c("USD")
|
|
326
326
|
})]
|
|
@@ -331,7 +331,7 @@ function we({ merchant: r, customer: i, initialCurrency: o }) {
|
|
|
331
331
|
children: /* @__PURE__ */ Q(e, { id: "View" })
|
|
332
332
|
})]
|
|
333
333
|
}),
|
|
334
|
-
|
|
334
|
+
R === void 0 && /* @__PURE__ */ $("p", {
|
|
335
335
|
className: "text-xs text-muted-foreground",
|
|
336
336
|
children: [m, /* @__PURE__ */ Q(e, { id: " is not a supported currency." })]
|
|
337
337
|
})
|
|
@@ -346,34 +346,34 @@ function we({ merchant: r, customer: i, initialCurrency: o }) {
|
|
|
346
346
|
className: "mb-2 text-sm font-medium",
|
|
347
347
|
children: [/* @__PURE__ */ Q(e, { id: "Grants · " }), m]
|
|
348
348
|
}),
|
|
349
|
-
|
|
349
|
+
O.isLoading ? /* @__PURE__ */ Q("p", {
|
|
350
350
|
className: "text-sm text-muted-foreground",
|
|
351
351
|
children: /* @__PURE__ */ Q(e, { id: "Loading grants…" })
|
|
352
|
-
}) :
|
|
352
|
+
}) : O.error ? /* @__PURE__ */ Q("p", {
|
|
353
353
|
role: "alert",
|
|
354
354
|
className: "text-sm text-destructive",
|
|
355
|
-
children: n(
|
|
356
|
-
}) :
|
|
355
|
+
children: n(O.error).text
|
|
356
|
+
}) : O.data?.data.length ? /* @__PURE__ */ Q("div", {
|
|
357
357
|
className: "overflow-x-auto",
|
|
358
|
-
children: /* @__PURE__ */ $(
|
|
359
|
-
/* @__PURE__ */ Q(
|
|
360
|
-
/* @__PURE__ */ Q(
|
|
361
|
-
/* @__PURE__ */ Q(
|
|
362
|
-
/* @__PURE__ */ Q(
|
|
363
|
-
/* @__PURE__ */ Q(
|
|
364
|
-
/* @__PURE__ */ Q(
|
|
365
|
-
/* @__PURE__ */ Q(
|
|
366
|
-
/* @__PURE__ */ Q(
|
|
367
|
-
/* @__PURE__ */ Q(
|
|
368
|
-
] }) }), /* @__PURE__ */ Q(
|
|
369
|
-
/* @__PURE__ */ $(
|
|
358
|
+
children: /* @__PURE__ */ $(L, { children: [/* @__PURE__ */ Q(P, { children: /* @__PURE__ */ $(I, { children: [
|
|
359
|
+
/* @__PURE__ */ Q(M, { children: /* @__PURE__ */ Q(e, { id: "Grant" }) }),
|
|
360
|
+
/* @__PURE__ */ Q(M, { children: /* @__PURE__ */ Q(e, { id: "Original" }) }),
|
|
361
|
+
/* @__PURE__ */ Q(M, { children: /* @__PURE__ */ Q(e, { id: "Remaining" }) }),
|
|
362
|
+
/* @__PURE__ */ Q(M, { children: /* @__PURE__ */ Q(e, { id: "Spent" }) }),
|
|
363
|
+
/* @__PURE__ */ Q(M, { children: /* @__PURE__ */ Q(e, { id: "Expired" }) }),
|
|
364
|
+
/* @__PURE__ */ Q(M, { children: /* @__PURE__ */ Q(e, { id: "Revoked" }) }),
|
|
365
|
+
/* @__PURE__ */ Q(M, { children: /* @__PURE__ */ Q(e, { id: "State" }) }),
|
|
366
|
+
/* @__PURE__ */ Q(M, { children: /* @__PURE__ */ Q(e, { id: "Expires" }) }),
|
|
367
|
+
/* @__PURE__ */ Q(M, {})
|
|
368
|
+
] }) }), /* @__PURE__ */ Q(N, { children: O.data.data.map((t) => /* @__PURE__ */ $(I, { children: [
|
|
369
|
+
/* @__PURE__ */ $(F, { children: [
|
|
370
370
|
/* @__PURE__ */ Q("span", {
|
|
371
371
|
title: t.id,
|
|
372
|
-
children:
|
|
372
|
+
children: h(t.id)
|
|
373
373
|
}),
|
|
374
374
|
/* @__PURE__ */ Q("div", {
|
|
375
375
|
className: "text-xs text-muted-foreground",
|
|
376
|
-
children:
|
|
376
|
+
children: v(t.created_at)
|
|
377
377
|
}),
|
|
378
378
|
/* @__PURE__ */ Q("div", {
|
|
379
379
|
className: "text-xs text-muted-foreground",
|
|
@@ -386,17 +386,17 @@ function we({ merchant: r, customer: i, initialCurrency: o }) {
|
|
|
386
386
|
t.spent_amount,
|
|
387
387
|
t.expired_amount,
|
|
388
388
|
t.revoked_amount
|
|
389
|
-
].map((e, n) => /* @__PURE__ */ Q(
|
|
389
|
+
].map((e, n) => /* @__PURE__ */ Q(F, {
|
|
390
390
|
className: "tabular-nums",
|
|
391
|
-
children:
|
|
391
|
+
children: y(e, t.currency)
|
|
392
392
|
}, n)),
|
|
393
|
-
/* @__PURE__ */ Q(
|
|
394
|
-
/* @__PURE__ */ Q(
|
|
395
|
-
/* @__PURE__ */ Q(
|
|
393
|
+
/* @__PURE__ */ Q(F, { children: t.state }),
|
|
394
|
+
/* @__PURE__ */ Q(F, { children: t.expires_at ? v(t.expires_at) : "No expiry" }),
|
|
395
|
+
/* @__PURE__ */ Q(F, { children: p && /* @__PURE__ */ Q(l, {
|
|
396
396
|
size: "sm",
|
|
397
397
|
variant: "outline",
|
|
398
398
|
disabled: !xe(t),
|
|
399
|
-
onClick: () =>
|
|
399
|
+
onClick: () => D(t),
|
|
400
400
|
children: /* @__PURE__ */ Q(e, { id: "Revoke" })
|
|
401
401
|
}) })
|
|
402
402
|
] }, t.id)) })] })
|
|
@@ -404,11 +404,11 @@ function we({ merchant: r, customer: i, initialCurrency: o }) {
|
|
|
404
404
|
className: "text-sm text-muted-foreground",
|
|
405
405
|
children: /* @__PURE__ */ Q(e, { id: "No credit grants in this currency." })
|
|
406
406
|
}),
|
|
407
|
-
/* @__PURE__ */ Q(
|
|
407
|
+
/* @__PURE__ */ Q(j, {
|
|
408
408
|
pages: S,
|
|
409
|
-
rows:
|
|
410
|
-
nextCursor:
|
|
411
|
-
busy:
|
|
409
|
+
rows: O.data?.data?.length ?? 0,
|
|
410
|
+
nextCursor: O.data?.next_cursor,
|
|
411
|
+
busy: O.isFetching
|
|
412
412
|
})
|
|
413
413
|
]
|
|
414
414
|
}), /* @__PURE__ */ $("section", {
|
|
@@ -418,67 +418,67 @@ function we({ merchant: r, customer: i, initialCurrency: o }) {
|
|
|
418
418
|
className: "mb-2 text-sm font-medium",
|
|
419
419
|
children: [/* @__PURE__ */ Q(e, { id: "Transaction ledger · " }), m]
|
|
420
420
|
}),
|
|
421
|
-
|
|
421
|
+
k.isLoading ? /* @__PURE__ */ Q("p", {
|
|
422
422
|
className: "text-sm text-muted-foreground",
|
|
423
423
|
children: /* @__PURE__ */ Q(e, { id: "Loading transactions…" })
|
|
424
|
-
}) :
|
|
424
|
+
}) : k.error ? /* @__PURE__ */ Q("p", {
|
|
425
425
|
role: "alert",
|
|
426
426
|
className: "text-sm text-destructive",
|
|
427
|
-
children: n(
|
|
428
|
-
}) :
|
|
429
|
-
/* @__PURE__ */ Q(
|
|
430
|
-
/* @__PURE__ */ Q(
|
|
431
|
-
/* @__PURE__ */ Q(
|
|
432
|
-
/* @__PURE__ */ Q(
|
|
433
|
-
] }) }), /* @__PURE__ */ Q(
|
|
434
|
-
/* @__PURE__ */ Q(
|
|
427
|
+
children: n(k.error).text
|
|
428
|
+
}) : k.data?.data.length ? /* @__PURE__ */ $(L, { children: [/* @__PURE__ */ Q(P, { children: /* @__PURE__ */ $(I, { children: [
|
|
429
|
+
/* @__PURE__ */ Q(M, { children: /* @__PURE__ */ Q(e, { id: "Date" }) }),
|
|
430
|
+
/* @__PURE__ */ Q(M, { children: /* @__PURE__ */ Q(e, { id: "Type" }) }),
|
|
431
|
+
/* @__PURE__ */ Q(M, { children: /* @__PURE__ */ Q(e, { id: "Amount" }) }),
|
|
432
|
+
/* @__PURE__ */ Q(M, { children: /* @__PURE__ */ Q(e, { id: "Source" }) })
|
|
433
|
+
] }) }), /* @__PURE__ */ Q(N, { children: k.data.data.map((e) => /* @__PURE__ */ $(I, { children: [
|
|
434
|
+
/* @__PURE__ */ Q(F, {
|
|
435
435
|
title: e.id,
|
|
436
|
-
children:
|
|
436
|
+
children: v(e.created_at)
|
|
437
437
|
}),
|
|
438
|
-
/* @__PURE__ */ Q(
|
|
439
|
-
/* @__PURE__ */ Q(
|
|
438
|
+
/* @__PURE__ */ Q(F, { children: e.type.replaceAll("_", " ") }),
|
|
439
|
+
/* @__PURE__ */ Q(F, {
|
|
440
440
|
className: "tabular-nums",
|
|
441
|
-
children:
|
|
441
|
+
children: y(e.amount, e.currency)
|
|
442
442
|
}),
|
|
443
|
-
/* @__PURE__ */ Q(
|
|
443
|
+
/* @__PURE__ */ Q(F, { children: e.source || "—" })
|
|
444
444
|
] }, e.id)) })] }) : /* @__PURE__ */ Q("p", {
|
|
445
445
|
className: "text-sm text-muted-foreground",
|
|
446
446
|
children: /* @__PURE__ */ Q(e, { id: "No transactions in this currency." })
|
|
447
447
|
}),
|
|
448
|
-
/* @__PURE__ */ Q(
|
|
448
|
+
/* @__PURE__ */ Q(j, {
|
|
449
449
|
pages: C,
|
|
450
|
-
rows:
|
|
451
|
-
nextCursor:
|
|
452
|
-
busy:
|
|
450
|
+
rows: k.data?.data?.length ?? 0,
|
|
451
|
+
nextCursor: k.data?.next_cursor,
|
|
452
|
+
busy: k.isFetching
|
|
453
453
|
})
|
|
454
454
|
]
|
|
455
455
|
})]
|
|
456
456
|
}),
|
|
457
|
-
w &&
|
|
457
|
+
w && R !== void 0 && /* @__PURE__ */ Q(Te, {
|
|
458
458
|
merchant: r,
|
|
459
459
|
customer: i,
|
|
460
460
|
currency: m,
|
|
461
|
-
decimals:
|
|
461
|
+
decimals: R,
|
|
462
462
|
onClose: () => T(!1)
|
|
463
463
|
}),
|
|
464
464
|
E && /* @__PURE__ */ Q(Ee, {
|
|
465
465
|
merchant: r,
|
|
466
466
|
customer: i,
|
|
467
467
|
grant: E,
|
|
468
|
-
onClose: () =>
|
|
468
|
+
onClose: () => D(null)
|
|
469
469
|
})
|
|
470
470
|
] });
|
|
471
471
|
}
|
|
472
472
|
function Te({ merchant: r, customer: i, currency: o, decimals: s, onClose: c }) {
|
|
473
473
|
let { toast: d, creditMutations: f } = a(), { id: p } = t(), m = Z(), h = Y(f.grant(m, r, i)), [g, _] = J.useState(""), [v, y] = J.useState(""), [b, x] = J.useState(""), [S] = J.useState(() => crypto.randomUUID()), [C, w] = J.useState("");
|
|
474
|
-
return /* @__PURE__ */ Q(
|
|
474
|
+
return /* @__PURE__ */ Q(ne, {
|
|
475
475
|
open: !0,
|
|
476
476
|
onOpenChange: (e) => {
|
|
477
477
|
!e && !h.isPending && c();
|
|
478
478
|
},
|
|
479
|
-
children: /* @__PURE__ */ $(
|
|
479
|
+
children: /* @__PURE__ */ $(V, {
|
|
480
480
|
className: re,
|
|
481
|
-
children: [/* @__PURE__ */ $(
|
|
481
|
+
children: [/* @__PURE__ */ $(z, { children: [/* @__PURE__ */ Q(H, { children: /* @__PURE__ */ Q(e, { id: "Grant credit" }) }), /* @__PURE__ */ $(ee, { children: [
|
|
482
482
|
/* @__PURE__ */ Q(e, { id: "Add credit in " }),
|
|
483
483
|
o,
|
|
484
484
|
/* @__PURE__ */ Q(e, { id: " to this customer." })
|
|
@@ -547,7 +547,7 @@ function Te({ merchant: r, customer: i, currency: o, decimals: s, onClose: c })
|
|
|
547
547
|
className: "text-sm text-destructive",
|
|
548
548
|
children: C
|
|
549
549
|
}),
|
|
550
|
-
/* @__PURE__ */ $(
|
|
550
|
+
/* @__PURE__ */ $(B, { children: [/* @__PURE__ */ Q(l, {
|
|
551
551
|
type: "button",
|
|
552
552
|
variant: "outline",
|
|
553
553
|
disabled: h.isPending,
|
|
@@ -564,28 +564,28 @@ function Te({ merchant: r, customer: i, currency: o, decimals: s, onClose: c })
|
|
|
564
564
|
});
|
|
565
565
|
}
|
|
566
566
|
function Ee({ merchant: r, customer: i, grant: o, onClose: s }) {
|
|
567
|
-
let { toast: c, creditMutations: d } = a(), { id: f } = t(), p = Z(), m = Y(d.revoke(p, r, i)), [h, g] = J.useState(""), [_,
|
|
568
|
-
return /* @__PURE__ */ Q(
|
|
567
|
+
let { toast: c, creditMutations: d } = a(), { id: f } = t(), p = Z(), m = Y(d.revoke(p, r, i)), [h, g] = J.useState(""), [_, v] = J.useState("");
|
|
568
|
+
return /* @__PURE__ */ Q(ne, {
|
|
569
569
|
open: !0,
|
|
570
570
|
onOpenChange: (e) => {
|
|
571
571
|
!e && !m.isPending && s();
|
|
572
572
|
},
|
|
573
|
-
children: /* @__PURE__ */ $(
|
|
573
|
+
children: /* @__PURE__ */ $(V, {
|
|
574
574
|
className: re,
|
|
575
|
-
children: [/* @__PURE__ */ $(
|
|
575
|
+
children: [/* @__PURE__ */ $(z, { children: [/* @__PURE__ */ Q(H, { children: /* @__PURE__ */ Q(e, { id: "Revoke remaining credit" }) }), /* @__PURE__ */ $(ee, { children: [
|
|
576
576
|
/* @__PURE__ */ Q(e, { id: "Revoke the unspent remainder of" }),
|
|
577
577
|
" ",
|
|
578
|
-
|
|
578
|
+
y(o.remaining_amount, o.currency),
|
|
579
579
|
/* @__PURE__ */ Q(e, { id: ". Active holds may prevent revocation. Payment refunds are managed separately." })
|
|
580
580
|
] })] }), /* @__PURE__ */ $("form", {
|
|
581
581
|
className: "grid gap-4",
|
|
582
582
|
onSubmit: async (e) => {
|
|
583
|
-
e.preventDefault(),
|
|
583
|
+
e.preventDefault(), v("");
|
|
584
584
|
try {
|
|
585
585
|
let e = await m.mutateAsync(Se(o, h));
|
|
586
|
-
c.success(e.replayed ? "Credit was already revoked" : `${
|
|
586
|
+
c.success(e.replayed ? "Credit was already revoked" : `${y(e.revoked_amount, e.currency)} revoked`), s();
|
|
587
587
|
} catch (e) {
|
|
588
|
-
|
|
588
|
+
v(n(e).text);
|
|
589
589
|
}
|
|
590
590
|
},
|
|
591
591
|
children: [
|
|
@@ -607,7 +607,7 @@ function Ee({ merchant: r, customer: i, grant: o, onClose: s }) {
|
|
|
607
607
|
className: "text-sm text-destructive",
|
|
608
608
|
children: _
|
|
609
609
|
}),
|
|
610
|
-
/* @__PURE__ */ $(
|
|
610
|
+
/* @__PURE__ */ $(B, { children: [/* @__PURE__ */ Q(l, {
|
|
611
611
|
type: "button",
|
|
612
612
|
variant: "outline",
|
|
613
613
|
disabled: m.isPending,
|
|
@@ -669,11 +669,11 @@ function ke(e, t, n = /* @__PURE__ */ new Date()) {
|
|
|
669
669
|
//#endregion
|
|
670
670
|
//#region src/admin/pages/customers/detail.tsx
|
|
671
671
|
function Ae() {
|
|
672
|
-
let { text: n } = t(), { props: c } = i(), { adminQueries: u } = a(), p = d(), m = f(), { customerId: h = "" } = r(), g = s(), { data:
|
|
672
|
+
let { text: n } = t(), { props: c } = i(), { adminQueries: u } = a(), p = d(), m = f(), { customerId: h = "" } = r(), g = s(), { data: _, isPending: b, error: x } = X(u.customer(h));
|
|
673
673
|
return b ? /* @__PURE__ */ Q("p", {
|
|
674
674
|
className: "text-sm text-muted-foreground",
|
|
675
675
|
children: /* @__PURE__ */ Q(e, { id: "Loading…" })
|
|
676
|
-
}) :
|
|
676
|
+
}) : _ ? /* @__PURE__ */ $("div", {
|
|
677
677
|
className: "flex min-w-0 flex-col gap-4",
|
|
678
678
|
children: [
|
|
679
679
|
/* @__PURE__ */ $("div", {
|
|
@@ -693,16 +693,16 @@ function Ae() {
|
|
|
693
693
|
className: "min-w-0 flex-1",
|
|
694
694
|
children: [/* @__PURE__ */ Q("h1", {
|
|
695
695
|
className: "text-2xl font-semibold tracking-tight [overflow-wrap:anywhere]",
|
|
696
|
-
children:
|
|
696
|
+
children: _.contact?.name || _.contact?.email || "Customer"
|
|
697
697
|
}), /* @__PURE__ */ $("p", {
|
|
698
698
|
className: "text-xs [overflow-wrap:anywhere] text-muted-foreground",
|
|
699
699
|
children: [
|
|
700
|
-
|
|
700
|
+
_.id,
|
|
701
701
|
/* @__PURE__ */ Q(e, { id: " · since " }),
|
|
702
|
-
_
|
|
702
|
+
v(_.created_at),
|
|
703
703
|
/* @__PURE__ */ Q(e, { id: " · last seen" }),
|
|
704
704
|
" ",
|
|
705
|
-
_
|
|
705
|
+
v(_.last_seen_at)
|
|
706
706
|
]
|
|
707
707
|
})]
|
|
708
708
|
}),
|
|
@@ -712,16 +712,16 @@ function Ae() {
|
|
|
712
712
|
})
|
|
713
713
|
]
|
|
714
714
|
}),
|
|
715
|
-
/* @__PURE__ */ Q(Re, { contact:
|
|
715
|
+
/* @__PURE__ */ Q(Re, { contact: _.contact }),
|
|
716
716
|
c.userHref && /* @__PURE__ */ Q("a", {
|
|
717
717
|
className: "underline",
|
|
718
|
-
href: c.userHref(
|
|
718
|
+
href: c.userHref(_.id),
|
|
719
719
|
children: /* @__PURE__ */ Q(e, { id: "View user account" })
|
|
720
720
|
}),
|
|
721
|
-
c.customerPanels?.(
|
|
722
|
-
|
|
721
|
+
c.customerPanels?.(_),
|
|
722
|
+
_.balances.length > 0 && /* @__PURE__ */ Q("div", {
|
|
723
723
|
className: "grid gap-3 grid-cols-[minmax(0,1fr)] @min-[20.75rem]/page:grid-cols-2 @min-[42.25rem]/page:grid-cols-4",
|
|
724
|
-
children:
|
|
724
|
+
children: _.balances.map((t) => /* @__PURE__ */ $(q, { children: [/* @__PURE__ */ Q(W, {
|
|
725
725
|
className: "pb-1",
|
|
726
726
|
children: /* @__PURE__ */ $(G, {
|
|
727
727
|
className: "text-xs font-normal text-muted-foreground uppercase",
|
|
@@ -729,29 +729,29 @@ function Ae() {
|
|
|
729
729
|
})
|
|
730
730
|
}), /* @__PURE__ */ $(K, { children: [/* @__PURE__ */ Q("p", {
|
|
731
731
|
className: "text-lg font-semibold",
|
|
732
|
-
children:
|
|
732
|
+
children: y(t.balance_amount, t.currency)
|
|
733
733
|
}), /* @__PURE__ */ $("p", {
|
|
734
734
|
className: "text-xs text-muted-foreground",
|
|
735
735
|
children: [
|
|
736
736
|
/* @__PURE__ */ Q(e, { id: "held " }),
|
|
737
|
-
|
|
737
|
+
y(t.held_amount, t.currency),
|
|
738
738
|
/* @__PURE__ */ Q(e, { id: " · owed" }),
|
|
739
739
|
" ",
|
|
740
|
-
|
|
740
|
+
y(t.owed_amount, t.currency)
|
|
741
741
|
]
|
|
742
742
|
})] })] }, t.currency))
|
|
743
743
|
}),
|
|
744
|
-
|
|
744
|
+
_.balances.some((e) => BigInt(e.owed_amount) > 0n) && /* @__PURE__ */ Q("p", {
|
|
745
745
|
className: "text-sm",
|
|
746
746
|
children: /* @__PURE__ */ Q(o, {
|
|
747
747
|
className: "underline-offset-2 hover:underline",
|
|
748
|
-
to: `/orders?customer_id=${
|
|
748
|
+
to: `/orders?customer_id=${_.id}&origin=usage&overdue=true`,
|
|
749
749
|
children: /* @__PURE__ */ Q(e, { id: "Overdue usage orders" })
|
|
750
750
|
})
|
|
751
751
|
}),
|
|
752
752
|
m?.credit && /* @__PURE__ */ Q(Ce, {
|
|
753
753
|
customerId: h,
|
|
754
|
-
currencies:
|
|
754
|
+
currencies: _.balances.map((e) => e.currency)
|
|
755
755
|
}),
|
|
756
756
|
m?.usage && /* @__PURE__ */ Q(_e, { customerId: h }),
|
|
757
757
|
/* @__PURE__ */ $("div", {
|
|
@@ -777,7 +777,7 @@ function Ae() {
|
|
|
777
777
|
});
|
|
778
778
|
}
|
|
779
779
|
function je({ customerId: t }) {
|
|
780
|
-
let { adminQueries: n } = a(), r =
|
|
780
|
+
let { adminQueries: n } = a(), r = A(t, 25), { data: i, isFetching: s } = X(n.customerSubscriptions(t, r.size, r.cursor)), c = i?.data ?? [];
|
|
781
781
|
return /* @__PURE__ */ $(q, { children: [/* @__PURE__ */ Q(W, { children: /* @__PURE__ */ Q(G, {
|
|
782
782
|
className: "text-sm",
|
|
783
783
|
children: /* @__PURE__ */ Q(e, { id: "Subscriptions" })
|
|
@@ -786,53 +786,53 @@ function je({ customerId: t }) {
|
|
|
786
786
|
children: [c.length === 0 ? /* @__PURE__ */ Q("p", {
|
|
787
787
|
className: "text-sm text-muted-foreground",
|
|
788
788
|
children: /* @__PURE__ */ Q(e, { id: "No subscriptions." })
|
|
789
|
-
}) : /* @__PURE__ */ $(
|
|
789
|
+
}) : /* @__PURE__ */ $(L, { children: [/* @__PURE__ */ Q(P, { children: /* @__PURE__ */ $(I, {
|
|
790
790
|
className: "hover:bg-transparent",
|
|
791
791
|
children: [
|
|
792
|
-
/* @__PURE__ */ Q(
|
|
792
|
+
/* @__PURE__ */ Q(M, {
|
|
793
793
|
className: "text-muted-foreground",
|
|
794
794
|
children: /* @__PURE__ */ Q(e, { id: "Subscription" })
|
|
795
795
|
}),
|
|
796
|
-
/* @__PURE__ */ Q(
|
|
796
|
+
/* @__PURE__ */ Q(M, {
|
|
797
797
|
className: "text-muted-foreground",
|
|
798
798
|
children: /* @__PURE__ */ Q(e, { id: "Status" })
|
|
799
799
|
}),
|
|
800
|
-
/* @__PURE__ */ Q(
|
|
800
|
+
/* @__PURE__ */ Q(M, {
|
|
801
801
|
className: "text-muted-foreground @max-[36rem]/page:hidden",
|
|
802
802
|
children: /* @__PURE__ */ Q(e, { id: "Rail" })
|
|
803
803
|
}),
|
|
804
|
-
/* @__PURE__ */ Q(
|
|
804
|
+
/* @__PURE__ */ Q(M, {
|
|
805
805
|
className: "text-muted-foreground",
|
|
806
806
|
children: /* @__PURE__ */ Q(e, { id: "Period ends" })
|
|
807
807
|
}),
|
|
808
|
-
/* @__PURE__ */ Q(
|
|
808
|
+
/* @__PURE__ */ Q(M, {
|
|
809
809
|
className: "text-muted-foreground @max-[36rem]/page:hidden",
|
|
810
810
|
children: /* @__PURE__ */ Q(e, { id: "Dunning" })
|
|
811
811
|
})
|
|
812
812
|
]
|
|
813
|
-
}) }), /* @__PURE__ */ Q(
|
|
813
|
+
}) }), /* @__PURE__ */ Q(N, { children: c.map((e) => /* @__PURE__ */ $(R, {
|
|
814
814
|
to: `/subscriptions/${e.id}`,
|
|
815
815
|
children: [
|
|
816
|
-
/* @__PURE__ */ Q(
|
|
816
|
+
/* @__PURE__ */ Q(F, { children: /* @__PURE__ */ Q(o, {
|
|
817
817
|
className: "text-xs underline-offset-2 hover:underline",
|
|
818
818
|
to: `/subscriptions/${e.id}`,
|
|
819
|
-
children:
|
|
819
|
+
children: e.product?.display_name ?? h(e.id, 13)
|
|
820
820
|
}) }),
|
|
821
|
-
/* @__PURE__ */ Q(
|
|
822
|
-
/* @__PURE__ */ Q(
|
|
821
|
+
/* @__PURE__ */ Q(F, { children: /* @__PURE__ */ Q(C, { status: e.status }) }),
|
|
822
|
+
/* @__PURE__ */ Q(F, {
|
|
823
823
|
className: "@max-[36rem]/page:hidden",
|
|
824
824
|
children: e.rail
|
|
825
825
|
}),
|
|
826
|
-
/* @__PURE__ */ Q(
|
|
826
|
+
/* @__PURE__ */ Q(F, {
|
|
827
827
|
className: "tabular-nums @max-[36rem]/page:whitespace-normal",
|
|
828
|
-
children:
|
|
828
|
+
children: v(e.current_period_ends_at)
|
|
829
829
|
}),
|
|
830
|
-
/* @__PURE__ */ Q(
|
|
830
|
+
/* @__PURE__ */ Q(F, {
|
|
831
831
|
className: "text-xs @max-[36rem]/page:hidden",
|
|
832
832
|
children: e.dunning ? se(e.dunning) : "—"
|
|
833
833
|
})
|
|
834
834
|
]
|
|
835
|
-
}, e.id)) })] }), /* @__PURE__ */ Q(
|
|
835
|
+
}, e.id)) })] }), /* @__PURE__ */ Q(j, {
|
|
836
836
|
pages: r,
|
|
837
837
|
rows: i?.data?.length ?? 0,
|
|
838
838
|
nextCursor: i?.next_cursor,
|
|
@@ -841,83 +841,83 @@ function je({ customerId: t }) {
|
|
|
841
841
|
})] });
|
|
842
842
|
}
|
|
843
843
|
function Me({ customerId: t }) {
|
|
844
|
-
let { adminQueries: n } = a(),
|
|
844
|
+
let { adminQueries: n, orderQueries: r } = a(), i = A(t, 25), { data: s, isFetching: c } = X(n.customerPayments(t, i.size, i.cursor)), l = s?.data ?? [], u = [...new Set(l.flatMap((e) => e.order_id ? [e.order_id] : []))], { data: d } = X(r.byIds(u)), f = new Map((d?.data ?? []).map((e) => [e.id, e.lines[0]?.description]));
|
|
845
845
|
return /* @__PURE__ */ $(q, { children: [/* @__PURE__ */ Q(W, { children: /* @__PURE__ */ Q(G, {
|
|
846
846
|
className: "text-sm",
|
|
847
847
|
children: /* @__PURE__ */ Q(e, { id: "Payments" })
|
|
848
848
|
}) }), /* @__PURE__ */ $(K, {
|
|
849
849
|
className: "grid gap-3",
|
|
850
|
-
children: [
|
|
850
|
+
children: [l.length === 0 ? /* @__PURE__ */ Q("p", {
|
|
851
851
|
className: "text-sm text-muted-foreground",
|
|
852
852
|
children: /* @__PURE__ */ Q(e, { id: "No payments." })
|
|
853
|
-
}) : /* @__PURE__ */ $(
|
|
853
|
+
}) : /* @__PURE__ */ $(L, { children: [/* @__PURE__ */ Q(P, { children: /* @__PURE__ */ $(I, {
|
|
854
854
|
className: "hover:bg-transparent",
|
|
855
855
|
children: [
|
|
856
|
-
/* @__PURE__ */ Q(
|
|
856
|
+
/* @__PURE__ */ Q(M, {
|
|
857
857
|
className: "text-muted-foreground",
|
|
858
858
|
children: /* @__PURE__ */ Q(e, { id: "Payment" })
|
|
859
859
|
}),
|
|
860
|
-
/* @__PURE__ */ Q(
|
|
860
|
+
/* @__PURE__ */ Q(M, {
|
|
861
861
|
className: "text-muted-foreground",
|
|
862
862
|
children: /* @__PURE__ */ Q(e, { id: "Status" })
|
|
863
863
|
}),
|
|
864
|
-
/* @__PURE__ */ Q(
|
|
864
|
+
/* @__PURE__ */ Q(M, {
|
|
865
865
|
className: "text-muted-foreground",
|
|
866
866
|
children: /* @__PURE__ */ Q(e, { id: "Amount" })
|
|
867
867
|
}),
|
|
868
|
-
/* @__PURE__ */ Q(
|
|
868
|
+
/* @__PURE__ */ Q(M, {
|
|
869
869
|
className: "text-muted-foreground @max-[36rem]/page:hidden",
|
|
870
870
|
children: /* @__PURE__ */ Q(e, { id: "Kind" })
|
|
871
871
|
}),
|
|
872
|
-
/* @__PURE__ */ Q(
|
|
872
|
+
/* @__PURE__ */ Q(M, {
|
|
873
873
|
className: "text-muted-foreground @max-[36rem]/page:hidden",
|
|
874
874
|
children: /* @__PURE__ */ Q(e, { id: "Rail" })
|
|
875
875
|
}),
|
|
876
|
-
/* @__PURE__ */ Q(
|
|
876
|
+
/* @__PURE__ */ Q(M, {
|
|
877
877
|
className: "text-muted-foreground @max-[36rem]/page:hidden",
|
|
878
878
|
children: /* @__PURE__ */ Q(e, { id: "Purchased" })
|
|
879
879
|
})
|
|
880
880
|
]
|
|
881
|
-
}) }), /* @__PURE__ */ Q(
|
|
881
|
+
}) }), /* @__PURE__ */ Q(N, { children: l.map((e) => /* @__PURE__ */ $(R, {
|
|
882
882
|
to: `/payments/${e.id}`,
|
|
883
883
|
children: [
|
|
884
|
-
/* @__PURE__ */ Q(
|
|
884
|
+
/* @__PURE__ */ Q(F, { children: /* @__PURE__ */ Q(o, {
|
|
885
885
|
className: "text-xs underline-offset-2 hover:underline",
|
|
886
886
|
to: `/payments/${e.id}`,
|
|
887
|
-
children:
|
|
887
|
+
children: e.order_id && f.get(e.order_id) || h(e.id, 13)
|
|
888
888
|
}) }),
|
|
889
|
-
/* @__PURE__ */ Q(
|
|
890
|
-
/* @__PURE__ */ Q(
|
|
889
|
+
/* @__PURE__ */ Q(F, { children: /* @__PURE__ */ Q(C, { status: e.status }) }),
|
|
890
|
+
/* @__PURE__ */ Q(F, {
|
|
891
891
|
className: "tabular-nums",
|
|
892
|
-
children:
|
|
892
|
+
children: y(e.amount, e.currency)
|
|
893
893
|
}),
|
|
894
|
-
/* @__PURE__ */ Q(
|
|
894
|
+
/* @__PURE__ */ Q(F, {
|
|
895
895
|
className: "@max-[36rem]/page:hidden",
|
|
896
896
|
children: e.kind
|
|
897
897
|
}),
|
|
898
|
-
/* @__PURE__ */ Q(
|
|
898
|
+
/* @__PURE__ */ Q(F, {
|
|
899
899
|
className: "@max-[36rem]/page:hidden",
|
|
900
900
|
children: e.rail ?? e.channel
|
|
901
901
|
}),
|
|
902
|
-
/* @__PURE__ */ Q(
|
|
902
|
+
/* @__PURE__ */ Q(F, {
|
|
903
903
|
className: "tabular-nums @max-[36rem]/page:hidden",
|
|
904
|
-
children:
|
|
904
|
+
children: v(e.created_at)
|
|
905
905
|
})
|
|
906
906
|
]
|
|
907
|
-
}, e.id)) })] }), /* @__PURE__ */ Q(
|
|
908
|
-
pages:
|
|
909
|
-
rows:
|
|
910
|
-
nextCursor:
|
|
911
|
-
busy:
|
|
907
|
+
}, e.id)) })] }), /* @__PURE__ */ Q(j, {
|
|
908
|
+
pages: i,
|
|
909
|
+
rows: s?.data?.length ?? 0,
|
|
910
|
+
nextCursor: s?.next_cursor,
|
|
911
|
+
busy: c
|
|
912
912
|
})]
|
|
913
913
|
})] });
|
|
914
914
|
}
|
|
915
915
|
function Ne({ customerId: n }) {
|
|
916
|
-
let { adminQueries: r, queryKeys: i, deleteCustomerPaymentMethod: o, toast: s, toastApiError: u } = a(), { text: f } = t(), p = d(),
|
|
916
|
+
let { adminQueries: r, queryKeys: i, deleteCustomerPaymentMethod: o, toast: s, toastApiError: u } = a(), { text: f } = t(), p = d(), h = x(), _ = Z(), v = Y({
|
|
917
917
|
mutationFn: (e) => o(n, e),
|
|
918
918
|
onSuccess: () => _.invalidateQueries({ queryKey: [...i.customer(n), "payment-methods"] }),
|
|
919
919
|
onError: (e) => u(e, "Remove payment method")
|
|
920
|
-
}), y =
|
|
920
|
+
}), y = A(n, 25), { data: b, isFetching: C } = X(r.customerPaymentMethodsPage(n, y.size, y.cursor)), w = b?.data ?? [];
|
|
921
921
|
return /* @__PURE__ */ $(q, { children: [/* @__PURE__ */ $(W, { children: [/* @__PURE__ */ Q(G, {
|
|
922
922
|
className: "text-sm",
|
|
923
923
|
children: /* @__PURE__ */ Q(e, { id: "Payment methods" })
|
|
@@ -944,7 +944,7 @@ function Ne({ customerId: n }) {
|
|
|
944
944
|
children: [
|
|
945
945
|
/* @__PURE__ */ Q("p", {
|
|
946
946
|
className: "font-medium",
|
|
947
|
-
children:
|
|
947
|
+
children: g(t.card)
|
|
948
948
|
}),
|
|
949
949
|
/* @__PURE__ */ $("p", {
|
|
950
950
|
className: "text-xs text-muted-foreground",
|
|
@@ -961,7 +961,7 @@ function Ne({ customerId: n }) {
|
|
|
961
961
|
className: "mt-2",
|
|
962
962
|
disabled: v.isPending,
|
|
963
963
|
onClick: async () => {
|
|
964
|
-
await
|
|
964
|
+
await h({
|
|
965
965
|
title: "Remove this saved card?",
|
|
966
966
|
description: "The vault will remove the card once no active subscription or payment uses it. Transaction history remains.",
|
|
967
967
|
confirmLabel: "Remove saved card"
|
|
@@ -976,7 +976,7 @@ function Ne({ customerId: n }) {
|
|
|
976
976
|
})
|
|
977
977
|
]
|
|
978
978
|
}, t.id))
|
|
979
|
-
}), /* @__PURE__ */ Q(
|
|
979
|
+
}), /* @__PURE__ */ Q(j, {
|
|
980
980
|
pages: y,
|
|
981
981
|
rows: b?.data?.length ?? 0,
|
|
982
982
|
nextCursor: b?.next_cursor,
|
|
@@ -985,7 +985,7 @@ function Ne({ customerId: n }) {
|
|
|
985
985
|
})] });
|
|
986
986
|
}
|
|
987
987
|
function Pe({ customerId: t }) {
|
|
988
|
-
let { adminQueries: n } = a(), r =
|
|
988
|
+
let { adminQueries: n } = a(), r = A(t, 25), { data: i, isFetching: o } = X(n.customerEntitlements(t, r.size, r.cursor)), s = i?.data ?? [];
|
|
989
989
|
return /* @__PURE__ */ $(q, { children: [/* @__PURE__ */ Q(W, { children: /* @__PURE__ */ Q(G, {
|
|
990
990
|
className: "text-sm",
|
|
991
991
|
children: /* @__PURE__ */ Q(e, { id: "Entitlements" })
|
|
@@ -1006,7 +1006,7 @@ function Pe({ customerId: t }) {
|
|
|
1006
1006
|
children: e.entitlement
|
|
1007
1007
|
}, e.entitlement))
|
|
1008
1008
|
}),
|
|
1009
|
-
/* @__PURE__ */ Q(
|
|
1009
|
+
/* @__PURE__ */ Q(j, {
|
|
1010
1010
|
pages: r,
|
|
1011
1011
|
rows: i?.data?.length ?? 0,
|
|
1012
1012
|
nextCursor: i?.next_cursor,
|
|
@@ -1016,7 +1016,7 @@ function Pe({ customerId: t }) {
|
|
|
1016
1016
|
})] });
|
|
1017
1017
|
}
|
|
1018
1018
|
function Fe({ customerId: n }) {
|
|
1019
|
-
let { text: r } = t(), { adminQueries: i } = a(), o = d(), s =
|
|
1019
|
+
let { text: r } = t(), { adminQueries: i } = a(), o = d(), s = A(n, 25), { data: c, isFetching: l } = X(i.customerProductAccess(n, s.size, s.cursor)), u = c?.data ?? [];
|
|
1020
1020
|
return /* @__PURE__ */ $(q, { children: [/* @__PURE__ */ Q(W, { children: /* @__PURE__ */ Q(G, {
|
|
1021
1021
|
className: "text-sm",
|
|
1022
1022
|
children: /* @__PURE__ */ Q(e, { id: "Product access" })
|
|
@@ -1036,7 +1036,7 @@ function Fe({ customerId: n }) {
|
|
|
1036
1036
|
className: "flex min-w-0 items-center gap-2",
|
|
1037
1037
|
children: [/* @__PURE__ */ Q("p", {
|
|
1038
1038
|
className: "truncate text-sm font-medium",
|
|
1039
|
-
children: e.product_name ||
|
|
1039
|
+
children: e.product_name || h(e.product_id, 13)
|
|
1040
1040
|
}), /* @__PURE__ */ Q(C, { status: e.status })]
|
|
1041
1041
|
}),
|
|
1042
1042
|
/* @__PURE__ */ Q("p", {
|
|
@@ -1045,7 +1045,7 @@ function Fe({ customerId: n }) {
|
|
|
1045
1045
|
}),
|
|
1046
1046
|
/* @__PURE__ */ Q("p", {
|
|
1047
1047
|
className: "text-xs text-muted-foreground tabular-nums",
|
|
1048
|
-
children: e.ends_at ? `Ends ${
|
|
1048
|
+
children: e.ends_at ? `Ends ${v(e.ends_at)}` : "No end date"
|
|
1049
1049
|
})
|
|
1050
1050
|
]
|
|
1051
1051
|
}), o && /* @__PURE__ */ Q(Ie, {
|
|
@@ -1054,7 +1054,7 @@ function Fe({ customerId: n }) {
|
|
|
1054
1054
|
label: r("Revoke product access")
|
|
1055
1055
|
})]
|
|
1056
1056
|
}, e.id))
|
|
1057
|
-
}), /* @__PURE__ */ Q(
|
|
1057
|
+
}), /* @__PURE__ */ Q(j, {
|
|
1058
1058
|
pages: s,
|
|
1059
1059
|
rows: c?.data?.length ?? 0,
|
|
1060
1060
|
nextCursor: c?.next_cursor,
|
|
@@ -1064,10 +1064,10 @@ function Fe({ customerId: n }) {
|
|
|
1064
1064
|
}
|
|
1065
1065
|
function Ie({ customerId: n, grantId: r, label: i }) {
|
|
1066
1066
|
let { toast: o, toastApiError: s, adminMutations: c } = a(), { id: d } = t(), f = Z(), p = Y(c.revokeCustomerProductAccess(f, n)), [m, h] = J.useState(!1), [g, _] = J.useState("");
|
|
1067
|
-
return /* @__PURE__ */ $(
|
|
1067
|
+
return /* @__PURE__ */ $(ne, {
|
|
1068
1068
|
open: m,
|
|
1069
1069
|
onOpenChange: h,
|
|
1070
|
-
children: [/* @__PURE__ */ Q(
|
|
1070
|
+
children: [/* @__PURE__ */ Q(te, { render: /* @__PURE__ */ Q(l, {
|
|
1071
1071
|
variant: "ghost",
|
|
1072
1072
|
size: "icon",
|
|
1073
1073
|
"aria-label": i,
|
|
@@ -1075,10 +1075,10 @@ function Ie({ customerId: n, grantId: r, label: i }) {
|
|
|
1075
1075
|
icon: me,
|
|
1076
1076
|
className: "size-4 text-destructive"
|
|
1077
1077
|
})
|
|
1078
|
-
}) }), /* @__PURE__ */ $(
|
|
1078
|
+
}) }), /* @__PURE__ */ $(V, {
|
|
1079
1079
|
className: ie,
|
|
1080
1080
|
children: [
|
|
1081
|
-
/* @__PURE__ */ $(
|
|
1081
|
+
/* @__PURE__ */ $(z, { children: [/* @__PURE__ */ Q(H, { children: /* @__PURE__ */ Q(e, { id: "Take the product back" }) }), /* @__PURE__ */ Q(ee, { children: /* @__PURE__ */ Q(e, { id: "The customer loses its entitlements now. The grant stays on record with your reason." }) })] }),
|
|
1082
1082
|
/* @__PURE__ */ $("div", {
|
|
1083
1083
|
className: "flex flex-col gap-1.5",
|
|
1084
1084
|
children: [/* @__PURE__ */ Q(U, {
|
|
@@ -1091,7 +1091,7 @@ function Ie({ customerId: n, grantId: r, label: i }) {
|
|
|
1091
1091
|
maxLength: 500
|
|
1092
1092
|
})]
|
|
1093
1093
|
}),
|
|
1094
|
-
/* @__PURE__ */ $(
|
|
1094
|
+
/* @__PURE__ */ $(B, { children: [/* @__PURE__ */ Q(l, {
|
|
1095
1095
|
variant: "outline",
|
|
1096
1096
|
onClick: () => h(!1),
|
|
1097
1097
|
children: /* @__PURE__ */ Q(e, { id: "Cancel" })
|
|
@@ -1140,19 +1140,19 @@ function Le({ customerId: n }) {
|
|
|
1140
1140
|
}), v = (e) => {
|
|
1141
1141
|
p(e), e || (_.reset(), h.reset());
|
|
1142
1142
|
};
|
|
1143
|
-
return /* @__PURE__ */ $(
|
|
1143
|
+
return /* @__PURE__ */ $(ne, {
|
|
1144
1144
|
open: f,
|
|
1145
1145
|
onOpenChange: v,
|
|
1146
|
-
children: [/* @__PURE__ */ Q(
|
|
1146
|
+
children: [/* @__PURE__ */ Q(te, { render: /* @__PURE__ */ $(l, {
|
|
1147
1147
|
variant: "outline",
|
|
1148
1148
|
size: "sm",
|
|
1149
1149
|
children: [/* @__PURE__ */ Q(de, {
|
|
1150
1150
|
icon: fe,
|
|
1151
1151
|
className: "size-4"
|
|
1152
1152
|
}), /* @__PURE__ */ Q(e, { id: " Product access" })]
|
|
1153
|
-
}) }), /* @__PURE__ */ $(
|
|
1153
|
+
}) }), /* @__PURE__ */ $(V, {
|
|
1154
1154
|
className: ie,
|
|
1155
|
-
children: [/* @__PURE__ */ $(
|
|
1155
|
+
children: [/* @__PURE__ */ $(z, { children: [/* @__PURE__ */ Q(H, { children: /* @__PURE__ */ Q(e, { id: "Grant product access" }) }), /* @__PURE__ */ Q(ee, { children: /* @__PURE__ */ Q(e, { 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__ */ $("form", {
|
|
1156
1156
|
onSubmit: (e) => {
|
|
1157
1157
|
e.preventDefault(), e.stopPropagation(), _.handleSubmit();
|
|
1158
1158
|
},
|
|
@@ -1170,7 +1170,7 @@ function Le({ customerId: n }) {
|
|
|
1170
1170
|
htmlFor: c("pa-product"),
|
|
1171
1171
|
children: /* @__PURE__ */ Q(e, { id: "Product" })
|
|
1172
1172
|
}),
|
|
1173
|
-
/* @__PURE__ */ $(
|
|
1173
|
+
/* @__PURE__ */ $(k, {
|
|
1174
1174
|
value: t.state.value,
|
|
1175
1175
|
onValueChange: (e) => t.handleChange(e ?? ""),
|
|
1176
1176
|
children: [/* @__PURE__ */ Q(E, {
|
|
@@ -1178,7 +1178,7 @@ function Le({ customerId: n }) {
|
|
|
1178
1178
|
id: c("pa-product"),
|
|
1179
1179
|
"aria-invalid": t.state.meta.errors.length > 0,
|
|
1180
1180
|
children: /* @__PURE__ */ Q(T, { placeholder: d("Pick a product") })
|
|
1181
|
-
}), /* @__PURE__ */ Q(
|
|
1181
|
+
}), /* @__PURE__ */ Q(D, { children: (g?.data ?? []).map((e) => /* @__PURE__ */ $(O, {
|
|
1182
1182
|
value: e.id,
|
|
1183
1183
|
children: [
|
|
1184
1184
|
e.display_name,
|
|
@@ -1205,7 +1205,7 @@ function Le({ customerId: n }) {
|
|
|
1205
1205
|
className: "text-[13px] text-muted-foreground",
|
|
1206
1206
|
children: /* @__PURE__ */ Q(e, { id: "Days are added after any access they already have." })
|
|
1207
1207
|
}),
|
|
1208
|
-
/* @__PURE__ */ $(
|
|
1208
|
+
/* @__PURE__ */ $(k, {
|
|
1209
1209
|
items: De.map((e) => ({
|
|
1210
1210
|
value: e.value,
|
|
1211
1211
|
label: e.label
|
|
@@ -1218,7 +1218,7 @@ function Le({ customerId: n }) {
|
|
|
1218
1218
|
className: "w-full",
|
|
1219
1219
|
id: c("pa-duration"),
|
|
1220
1220
|
children: /* @__PURE__ */ Q(T, {})
|
|
1221
|
-
}), /* @__PURE__ */ Q(
|
|
1221
|
+
}), /* @__PURE__ */ Q(D, { children: De.map((e) => /* @__PURE__ */ Q(O, {
|
|
1222
1222
|
value: e.value,
|
|
1223
1223
|
children: e.label
|
|
1224
1224
|
}, e.value)) })]
|
|
@@ -1269,7 +1269,7 @@ function Le({ customerId: n }) {
|
|
|
1269
1269
|
})
|
|
1270
1270
|
})
|
|
1271
1271
|
]
|
|
1272
|
-
}), /* @__PURE__ */ Q(
|
|
1272
|
+
}), /* @__PURE__ */ Q(B, { children: /* @__PURE__ */ Q(_.Subscribe, {
|
|
1273
1273
|
selector: (e) => [
|
|
1274
1274
|
e.values.productId,
|
|
1275
1275
|
e.canSubmit,
|
|
@@ -1342,7 +1342,7 @@ function Re({ contact: n }) {
|
|
|
1342
1342
|
}),
|
|
1343
1343
|
/* @__PURE__ */ Q("dd", {
|
|
1344
1344
|
className: "tabular-nums",
|
|
1345
|
-
children: n.synced_at ?
|
|
1345
|
+
children: n.synced_at ? v(n.synced_at) : r("Current, read from your directory")
|
|
1346
1346
|
})
|
|
1347
1347
|
]
|
|
1348
1348
|
}) : /* @__PURE__ */ Q("p", {
|
|
@@ -1354,4 +1354,4 @@ function Re({ contact: n }) {
|
|
|
1354
1354
|
//#endregion
|
|
1355
1355
|
export { Ae as CustomerDetailPage };
|
|
1356
1356
|
|
|
1357
|
-
//# sourceMappingURL=admin-detail-
|
|
1357
|
+
//# sourceMappingURL=admin-detail-P-UnNvXJ.js.map
|