@openrails/billing-ui 0.272.0 → 0.274.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/components/customer-search.d.ts +5 -0
- package/dist/admin/components/missing-record.d.ts +6 -0
- package/dist/admin/components/status-badge.d.ts +1 -0
- package/dist/admin/context.d.ts +20 -2
- package/dist/admin/lib/api/endpoints.d.ts +3 -1
- package/dist/admin/lib/api/index.d.ts +2 -0
- package/dist/admin/lib/api/types.d.ts +2 -0
- package/dist/admin/lib/capabilities.d.ts +4 -0
- package/dist/admin/lib/dialog-width.d.ts +4 -3
- package/dist/admin/lib/error-text.d.ts +4 -0
- package/dist/admin/lib/mutations.d.ts +6 -1
- package/dist/admin/lib/queries.d.ts +3 -0
- package/dist/admin/lib/tile-grids.d.ts +6 -0
- package/dist/admin/messages.d.ts +89 -0
- package/dist/admin/pages/payments/index.d.ts +1 -2
- package/dist/admin/pages/subscriptions/index.d.ts +1 -2
- package/dist/{admin-attempts-DyDDt-qw.js → admin-attempts-Dzipkstg.js} +145 -144
- package/dist/admin-attempts-Dzipkstg.js.map +1 -0
- package/dist/{admin-auth-1aZIgXiS.js → admin-auth-BCl_Tv3t.js} +2 -2
- package/dist/{admin-auth-1aZIgXiS.js.map → admin-auth-BCl_Tv3t.js.map} +1 -1
- package/dist/{admin-badge-pgG6D9-a.js → admin-badge-kmYQM9Ge.js} +2 -2
- package/dist/{admin-badge-pgG6D9-a.js.map → admin-badge-kmYQM9Ge.js.map} +1 -1
- package/dist/{admin-button-CrcYk5r0.js → admin-button-Cq9ZfX4R.js} +2 -2
- package/dist/{admin-button-CrcYk5r0.js.map → admin-button-Cq9ZfX4R.js.map} +1 -1
- package/dist/{admin-capabilities-BDcZeHL_.js → admin-capabilities-k5fQZhN9.js} +35 -14
- package/dist/admin-capabilities-k5fQZhN9.js.map +1 -0
- package/dist/{admin-card-DvTMc5Se.js → admin-card-C8k67jJv.js} +2 -2
- package/dist/{admin-card-DvTMc5Se.js.map → admin-card-C8k67jJv.js.map} +1 -1
- package/dist/{admin-catalog-BlF5mnu4.js → admin-catalog-CON-GwKL.js} +286 -286
- package/dist/{admin-catalog-BlF5mnu4.js.map → admin-catalog-CON-GwKL.js.map} +1 -1
- package/dist/{admin-cursor-pager-CIb3Jw2F.js → admin-cursor-pager-DqFruoNu.js} +6 -6
- package/dist/{admin-cursor-pager-CIb3Jw2F.js.map → admin-cursor-pager-DqFruoNu.js.map} +1 -1
- package/dist/admin-customer-search-CJHB80rg.js +117 -0
- package/dist/admin-customer-search-CJHB80rg.js.map +1 -0
- package/dist/{admin-customers-EpfoWDh-.js → admin-customers-CWWOrcVR.js} +18 -17
- package/dist/{admin-customers-EpfoWDh-.js.map → admin-customers-CWWOrcVR.js.map} +1 -1
- package/dist/admin-dashboard-BiShWFk2.js +456 -0
- package/dist/admin-dashboard-BiShWFk2.js.map +1 -0
- package/dist/admin-data-table-CdsjYJh5.js +107 -0
- package/dist/admin-data-table-CdsjYJh5.js.map +1 -0
- package/dist/admin-detail-BWSC1aCH.js +338 -0
- package/dist/admin-detail-BWSC1aCH.js.map +1 -0
- package/dist/admin-detail-CKRtK43V.js +728 -0
- package/dist/admin-detail-CKRtK43V.js.map +1 -0
- package/dist/admin-detail-CMmhZQ2A.js +346 -0
- package/dist/admin-detail-CMmhZQ2A.js.map +1 -0
- package/dist/admin-detail-CiONe1Pt.js +1357 -0
- package/dist/admin-detail-CiONe1Pt.js.map +1 -0
- package/dist/{admin-detail-3wFIDPNB.js → admin-detail-Cyuf_i9U.js} +62 -62
- package/dist/{admin-detail-3wFIDPNB.js.map → admin-detail-Cyuf_i9U.js.map} +1 -1
- package/dist/{admin-dialog-BSRf9Zre.js → admin-dialog-Ch7rTOCr.js} +3 -3
- package/dist/{admin-dialog-BSRf9Zre.js.map → admin-dialog-Ch7rTOCr.js.map} +1 -1
- package/dist/admin-dialog-width-CC7QHT1p.js +6 -0
- package/dist/admin-dialog-width-CC7QHT1p.js.map +1 -0
- package/dist/{admin-dropdown-menu-D0E5rwmn.js → admin-dropdown-menu-Bah3f8AZ.js} +2 -2
- package/dist/{admin-dropdown-menu-D0E5rwmn.js.map → admin-dropdown-menu-Bah3f8AZ.js.map} +1 -1
- package/dist/{admin-fact-card-BPSVhS15.js → admin-fact-card-Bt__Cd_U.js} +2 -2
- package/dist/{admin-fact-card-BPSVhS15.js.map → admin-fact-card-Bt__Cd_U.js.map} +1 -1
- package/dist/{admin-health-D0L5Kig7.js → admin-health-pzTO6_0v.js} +249 -248
- package/dist/admin-health-pzTO6_0v.js.map +1 -0
- package/dist/{admin-imports-CgZB5JAV.js → admin-imports-tT5et8-V.js} +62 -62
- package/dist/{admin-imports-CgZB5JAV.js.map → admin-imports-tT5et8-V.js.map} +1 -1
- package/dist/{admin-input-DJAK9nmk.js → admin-input-DvRZy_2a.js} +2 -2
- package/dist/{admin-input-DJAK9nmk.js.map → admin-input-DvRZy_2a.js.map} +1 -1
- package/dist/{admin-label-aviN9Gng.js → admin-label-QZtWJGH-.js} +2 -2
- package/dist/{admin-label-aviN9Gng.js.map → admin-label-QZtWJGH-.js.map} +1 -1
- package/dist/{admin-linked-table-row-BGr7JXeM.js → admin-linked-table-row-6jkCKwMn.js} +4 -4
- package/dist/{admin-linked-table-row-BGr7JXeM.js.map → admin-linked-table-row-6jkCKwMn.js.map} +1 -1
- package/dist/{admin-map-dialog-DS2Wz6G3.js → admin-map-dialog-BV54mvMQ.js} +22 -22
- package/dist/{admin-map-dialog-DS2Wz6G3.js.map → admin-map-dialog-BV54mvMQ.js.map} +1 -1
- package/dist/{admin-metering-D-e-37Jn.js → admin-metering-Bv5EcX6M.js} +306 -306
- package/dist/{admin-metering-D-e-37Jn.js.map → admin-metering-Bv5EcX6M.js.map} +1 -1
- package/dist/admin-missing-record-BXqGFDt3.js +42 -0
- package/dist/admin-missing-record-BXqGFDt3.js.map +1 -0
- package/dist/admin-ops-h3RjpcNu.js +356 -0
- package/dist/admin-ops-h3RjpcNu.js.map +1 -0
- package/dist/admin-orders-DYxPiuTl.js +192 -0
- package/dist/admin-orders-DYxPiuTl.js.map +1 -0
- package/dist/{admin-parked-B8xHkV2e.js → admin-parked-ClKA60d5.js} +51 -51
- package/dist/{admin-parked-B8xHkV2e.js.map → admin-parked-ClKA60d5.js.map} +1 -1
- package/dist/admin-payments-BlIuy3wL.js +220 -0
- package/dist/admin-payments-BlIuy3wL.js.map +1 -0
- package/dist/{admin-price-detail-CSI5oKdb.js → admin-price-detail-BjWYU5A-.js} +98 -98
- package/dist/{admin-price-detail-CSI5oKdb.js.map → admin-price-detail-BjWYU5A-.js.map} +1 -1
- package/dist/{admin-price-wizard-CBEcNGvP.js → admin-price-wizard-CTbkbmYc.js} +61 -61
- package/dist/{admin-price-wizard-CBEcNGvP.js.map → admin-price-wizard-CTbkbmYc.js.map} +1 -1
- package/dist/{admin-proposals-Cuj7tvaM.js → admin-proposals-Ci9Q8j7Y.js} +64 -64
- package/dist/{admin-proposals-Cuj7tvaM.js.map → admin-proposals-Ci9Q8j7Y.js.map} +1 -1
- package/dist/{admin-provider-prices-B6vwnVPi.js → admin-provider-prices-B6Ayq-eN.js} +66 -66
- package/dist/{admin-provider-prices-B6vwnVPi.js.map → admin-provider-prices-B6Ayq-eN.js.map} +1 -1
- package/dist/{admin-range-picker-De36L-AP.js → admin-range-picker-nfflPp21.js} +9 -9
- package/dist/{admin-range-picker-De36L-AP.js.map → admin-range-picker-nfflPp21.js.map} +1 -1
- package/dist/{admin-records-H0MlhEVY.js → admin-records-CrTCorWH.js} +43 -43
- package/dist/{admin-records-H0MlhEVY.js.map → admin-records-CrTCorWH.js.map} +1 -1
- package/dist/{admin-reports-BFGS_PWf.js → admin-reports-BO6wrvtw.js} +50 -50
- package/dist/{admin-reports-BFGS_PWf.js.map → admin-reports-BO6wrvtw.js.map} +1 -1
- package/dist/{admin-select-BUcEU5Rg.js → admin-select-DvfJ80Rg.js} +2 -2
- package/dist/{admin-select-BUcEU5Rg.js.map → admin-select-DvfJ80Rg.js.map} +1 -1
- package/dist/{admin-settings-DYC-c7mJ.js → admin-settings-BOoTzhyf.js} +332 -332
- package/dist/admin-settings-BOoTzhyf.js.map +1 -0
- package/dist/{admin-shared-lfIUEbPY.js → admin-shared-BbGT_qTo.js} +21 -21
- package/dist/{admin-shared-lfIUEbPY.js.map → admin-shared-BbGT_qTo.js.map} +1 -1
- package/dist/{admin-skeleton-B0yzYY_X.js → admin-skeleton-B2a4ScVE.js} +2 -2
- package/dist/{admin-skeleton-B0yzYY_X.js.map → admin-skeleton-B2a4ScVE.js.map} +1 -1
- package/dist/admin-status-badge-Bp6cssXY.js +51 -0
- package/dist/admin-status-badge-Bp6cssXY.js.map +1 -0
- package/dist/admin-subscriptions-D9JmoicC.js +275 -0
- package/dist/admin-subscriptions-D9JmoicC.js.map +1 -0
- package/dist/{admin-switch-DDorugaw.js → admin-switch-DBBxJRZP.js} +2 -2
- package/dist/{admin-switch-DDorugaw.js.map → admin-switch-DBBxJRZP.js.map} +1 -1
- package/dist/{admin-table-BU6Tie69.js → admin-table-CPDoVfK4.js} +2 -2
- package/dist/{admin-table-BU6Tie69.js.map → admin-table-CPDoVfK4.js.map} +1 -1
- package/dist/{admin-tabs-D5lqdVcC.js → admin-tabs-DDUv3kiu.js} +2 -2
- package/dist/{admin-tabs-D5lqdVcC.js.map → admin-tabs-DDUv3kiu.js.map} +1 -1
- package/dist/{admin-textarea-Dc6lnEub.js → admin-textarea-d3fu_waS.js} +2 -2
- package/dist/{admin-textarea-Dc6lnEub.js.map → admin-textarea-d3fu_waS.js.map} +1 -1
- package/dist/admin-tile-grids-CzGpidd9.js +6 -0
- package/dist/admin-tile-grids-CzGpidd9.js.map +1 -0
- package/dist/{admin-typed-confirm-dialog-Bk6XxmPb.js → admin-typed-confirm-dialog-BVklYjFo.js} +11 -11
- package/dist/{admin-typed-confirm-dialog-Bk6XxmPb.js.map → admin-typed-confirm-dialog-BVklYjFo.js.map} +1 -1
- package/dist/{admin-utils-B9eEBNsR.js → admin-utils-DTT53IpS.js} +266 -223
- package/dist/admin-utils-DTT53IpS.js.map +1 -0
- package/dist/{admin-widget-viz-8aukE3v_.js → admin-widget-viz-Exsqz3Dw.js} +165 -128
- package/dist/admin-widget-viz-Exsqz3Dw.js.map +1 -0
- package/dist/admin.css +1 -1
- package/dist/admin.js +531 -405
- package/dist/admin.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/admin-attempts-DyDDt-qw.js.map +0 -1
- package/dist/admin-capabilities-BDcZeHL_.js.map +0 -1
- package/dist/admin-dashboard-CJE63yz4.js +0 -420
- package/dist/admin-dashboard-CJE63yz4.js.map +0 -1
- package/dist/admin-data-table-hvFcJepL.js +0 -96
- package/dist/admin-data-table-hvFcJepL.js.map +0 -1
- package/dist/admin-detail-BRP6pL7t.js +0 -328
- package/dist/admin-detail-BRP6pL7t.js.map +0 -1
- package/dist/admin-detail-CRzFb_pa.js +0 -1331
- package/dist/admin-detail-CRzFb_pa.js.map +0 -1
- package/dist/admin-detail-QLxU8r-5.js +0 -344
- package/dist/admin-detail-QLxU8r-5.js.map +0 -1
- package/dist/admin-detail-pPC8Q9l-.js +0 -710
- package/dist/admin-detail-pPC8Q9l-.js.map +0 -1
- package/dist/admin-dialog-width-BPrgdYlj.js +0 -6
- package/dist/admin-dialog-width-BPrgdYlj.js.map +0 -1
- package/dist/admin-health-D0L5Kig7.js.map +0 -1
- package/dist/admin-ops-CQP4TzWM.js +0 -235
- package/dist/admin-ops-CQP4TzWM.js.map +0 -1
- package/dist/admin-orders-BJ7W5S8P.js +0 -192
- package/dist/admin-orders-BJ7W5S8P.js.map +0 -1
- package/dist/admin-payments-CzkzqYA1.js +0 -246
- package/dist/admin-payments-CzkzqYA1.js.map +0 -1
- package/dist/admin-settings-DYC-c7mJ.js.map +0 -1
- package/dist/admin-status-badge-0-K37EfN.js +0 -43
- package/dist/admin-status-badge-0-K37EfN.js.map +0 -1
- package/dist/admin-subscriptions-CvW-YFs0.js +0 -301
- package/dist/admin-subscriptions-CvW-YFs0.js.map +0 -1
- package/dist/admin-utils-B9eEBNsR.js.map +0 -1
- package/dist/admin-widget-viz-8aukE3v_.js.map +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as o } from "./admin-button-
|
|
3
|
-
import { t as s } from "./admin-input-
|
|
4
|
-
import { a as c,
|
|
1
|
+
import { E as e, O as t, f as n, l as r, p as i, w as a } from "./admin-utils-DTT53IpS.js";
|
|
2
|
+
import { t as o } from "./admin-button-Cq9ZfX4R.js";
|
|
3
|
+
import { t as s } from "./admin-input-DvRZy_2a.js";
|
|
4
|
+
import { a as c, d as l, i as u, n as d, u as f } from "./admin-capabilities-k5fQZhN9.js";
|
|
5
5
|
import { n as p, o as m, s as h, t as g } from "./admin-format-DoohJ7Fg.js";
|
|
6
6
|
import { n as _ } from "./admin-confirm-katGq0Qo.js";
|
|
7
|
-
import { t as v } from "./admin-
|
|
8
|
-
import {
|
|
9
|
-
import { a as
|
|
10
|
-
import {
|
|
11
|
-
import { a as O, i as k, n as A, o as j, r as M, s as N, t as P } from "./admin-dialog-
|
|
12
|
-
import { t as F } from "./admin-label-
|
|
13
|
-
import { t as re } from "./admin-switch-
|
|
14
|
-
import {
|
|
15
|
-
import { t as ie } from "./admin-typed-confirm-dialog-
|
|
16
|
-
import { i as L, n as R, r as ae, t as oe } from "./admin-tabs-
|
|
7
|
+
import { t as v } from "./admin-badge-kmYQM9Ge.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-DvfJ80Rg.js";
|
|
10
|
+
import { a as T, n as ee, o as te, r as E, s as D, t as ne } from "./admin-table-CPDoVfK4.js";
|
|
11
|
+
import { a as O, i as k, n as A, o as j, r as M, s as N, t as P } from "./admin-dialog-Ch7rTOCr.js";
|
|
12
|
+
import { t as F } from "./admin-label-QZtWJGH-.js";
|
|
13
|
+
import { t as re } from "./admin-switch-DBBxJRZP.js";
|
|
14
|
+
import { r as I } from "./admin-dialog-width-CC7QHT1p.js";
|
|
15
|
+
import { t as ie } from "./admin-typed-confirm-dialog-BVklYjFo.js";
|
|
16
|
+
import { i as L, n as R, r as ae, t as oe } from "./admin-tabs-DDUv3kiu.js";
|
|
17
17
|
import * as z from "react";
|
|
18
18
|
import { useMutation as B, useQuery as V, useQueryClient as H } from "@tanstack/react-query";
|
|
19
19
|
import { Fragment as U, jsx as W, jsxs as G } from "react/jsx-runtime";
|
|
@@ -21,26 +21,26 @@ import { HugeiconsIcon as se } from "@hugeicons/react";
|
|
|
21
21
|
import { Add01Icon as ce, Delete02Icon as le } from "@hugeicons/core-free-icons";
|
|
22
22
|
import { useForm as K } from "@tanstack/react-form";
|
|
23
23
|
//#region src/admin/pages/settings/configuration-edit.ts
|
|
24
|
-
function q(
|
|
25
|
-
let { toast:
|
|
24
|
+
function q(e) {
|
|
25
|
+
let { toast: t, toastApiError: n, toastStaleEdit: r, adminMutations: o } = i(), [s, c] = z.useState(null), l = H(), u = B(o.updateMerchantConfiguration(l));
|
|
26
26
|
return {
|
|
27
27
|
editing: s !== null,
|
|
28
28
|
open: () => {
|
|
29
|
-
|
|
29
|
+
e && c(e.revision);
|
|
30
30
|
},
|
|
31
31
|
close: () => c(null),
|
|
32
|
-
save: async (
|
|
32
|
+
save: async (e, i, o) => {
|
|
33
33
|
if (s !== null) try {
|
|
34
34
|
await u.mutateAsync({
|
|
35
|
-
...
|
|
35
|
+
...e,
|
|
36
36
|
expected_revision: s
|
|
37
|
-
}),
|
|
38
|
-
} catch (
|
|
39
|
-
if (
|
|
40
|
-
|
|
37
|
+
}), t.success(i), c(null);
|
|
38
|
+
} catch (e) {
|
|
39
|
+
if (e instanceof a && e.revisionMismatch) {
|
|
40
|
+
r("The configuration"), c(null);
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
n(e, o), e instanceof a && e.merchantConfigReadOnly && c(null);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
};
|
|
@@ -48,14 +48,14 @@ function q(t) {
|
|
|
48
48
|
//#endregion
|
|
49
49
|
//#region src/admin/pages/settings/setting-fields.tsx
|
|
50
50
|
function J() {
|
|
51
|
-
let { adminQueries:
|
|
52
|
-
return !
|
|
51
|
+
let { adminQueries: t } = i(), { data: n } = V(t.config());
|
|
52
|
+
return !n || n.capabilities.features?.merchant_config_edits ? null : /* @__PURE__ */ W("p", {
|
|
53
53
|
className: "rounded-md border px-3 py-2 text-sm text-muted-foreground",
|
|
54
|
-
children: /* @__PURE__ */ W(
|
|
54
|
+
children: /* @__PURE__ */ W(e, { id: "Read-only: this merchant's configuration comes from a file. Change it there." })
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
function Y({ edits:
|
|
58
|
-
return
|
|
57
|
+
function Y({ edits: t, editing: n, form: r, saving: i, canSave: a = !0, onEdit: s, onCancel: c }) {
|
|
58
|
+
return t ? n ? /* @__PURE__ */ G("div", {
|
|
59
59
|
className: "flex items-center gap-2",
|
|
60
60
|
children: [/* @__PURE__ */ W(o, {
|
|
61
61
|
type: "button",
|
|
@@ -63,7 +63,7 @@ function Y({ edits: e, editing: t, form: r, saving: i, canSave: a = !0, onEdit:
|
|
|
63
63
|
size: "sm",
|
|
64
64
|
disabled: i,
|
|
65
65
|
onClick: c,
|
|
66
|
-
children: /* @__PURE__ */ W(
|
|
66
|
+
children: /* @__PURE__ */ W(e, { id: "Cancel" })
|
|
67
67
|
}), /* @__PURE__ */ W(o, {
|
|
68
68
|
type: "submit",
|
|
69
69
|
size: "sm",
|
|
@@ -76,7 +76,7 @@ function Y({ edits: e, editing: t, form: r, saving: i, canSave: a = !0, onEdit:
|
|
|
76
76
|
variant: "outline",
|
|
77
77
|
size: "sm",
|
|
78
78
|
onClick: s,
|
|
79
|
-
children: /* @__PURE__ */ W(
|
|
79
|
+
children: /* @__PURE__ */ W(e, { id: "Edit" })
|
|
80
80
|
}) : null;
|
|
81
81
|
}
|
|
82
82
|
function X({ label: e, value: t }) {
|
|
@@ -107,28 +107,28 @@ function Z({ label: e, id: n, children: r }) {
|
|
|
107
107
|
//#endregion
|
|
108
108
|
//#region src/admin/pages/settings/notifications.tsx
|
|
109
109
|
function ue() {
|
|
110
|
-
let { adminQueries:
|
|
110
|
+
let { adminQueries: t } = i(), n = V(t.merchantConfiguration("Load settings")), r = V(t.webhooks()), a = l(), o = r.data?.data ?? [];
|
|
111
111
|
return /* @__PURE__ */ G("div", {
|
|
112
112
|
className: "flex flex-col gap-10",
|
|
113
113
|
children: [
|
|
114
114
|
/* @__PURE__ */ W(J, {}),
|
|
115
|
-
|
|
116
|
-
configuration:
|
|
117
|
-
edits:
|
|
115
|
+
n.data ? /* @__PURE__ */ W(de, {
|
|
116
|
+
configuration: n.data,
|
|
117
|
+
edits: a
|
|
118
118
|
}) : /* @__PURE__ */ W("p", {
|
|
119
119
|
className: "text-sm text-muted-foreground",
|
|
120
|
-
children: /* @__PURE__ */ W(
|
|
120
|
+
children: /* @__PURE__ */ W(e, { id: "Loading…" })
|
|
121
121
|
}),
|
|
122
122
|
/* @__PURE__ */ W(pe, {
|
|
123
123
|
webhooks: o,
|
|
124
124
|
loading: r.isPending,
|
|
125
|
-
edits:
|
|
125
|
+
edits: a
|
|
126
126
|
})
|
|
127
127
|
]
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
function de({ configuration:
|
|
131
|
-
let { id: i, text: a } = t(), o =
|
|
130
|
+
function de({ configuration: n, edits: r }) {
|
|
131
|
+
let { id: i, text: a } = t(), o = n.alert_email ?? "", c = q(n), l = K({
|
|
132
132
|
defaultValues: { email: o },
|
|
133
133
|
onSubmit: ({ value: e }) => c.save({ alert_email: e.email.trim() }, e.email.trim() ? "Alert email saved" : "Alert email cleared", "Save alert email")
|
|
134
134
|
});
|
|
@@ -140,10 +140,10 @@ function de({ configuration: e, edits: r }) {
|
|
|
140
140
|
className: "grid gap-1",
|
|
141
141
|
children: [/* @__PURE__ */ W("h2", {
|
|
142
142
|
className: "text-base font-semibold",
|
|
143
|
-
children: /* @__PURE__ */ W(
|
|
143
|
+
children: /* @__PURE__ */ W(e, { id: "Email delivery" })
|
|
144
144
|
}), /* @__PURE__ */ W("p", {
|
|
145
145
|
className: "text-sm text-muted-foreground",
|
|
146
|
-
children: /* @__PURE__ */ W(
|
|
146
|
+
children: /* @__PURE__ */ W(e, { id: "Send email alerts to this address." })
|
|
147
147
|
})]
|
|
148
148
|
}), /* @__PURE__ */ W(l.Subscribe, {
|
|
149
149
|
selector: (e) => e.isSubmitting,
|
|
@@ -198,7 +198,7 @@ var fe = [
|
|
|
198
198
|
label: "Slack"
|
|
199
199
|
}
|
|
200
200
|
];
|
|
201
|
-
function pe({ webhooks:
|
|
201
|
+
function pe({ webhooks: t, loading: n, edits: r }) {
|
|
202
202
|
return /* @__PURE__ */ G("section", {
|
|
203
203
|
className: "grid gap-5",
|
|
204
204
|
children: [/* @__PURE__ */ G("div", {
|
|
@@ -207,80 +207,80 @@ function pe({ webhooks: e, loading: t, edits: r }) {
|
|
|
207
207
|
className: "grid max-w-2xl gap-1",
|
|
208
208
|
children: [/* @__PURE__ */ W("h2", {
|
|
209
209
|
className: "text-base font-semibold",
|
|
210
|
-
children: /* @__PURE__ */ W(
|
|
210
|
+
children: /* @__PURE__ */ W(e, { id: "Webhooks" })
|
|
211
211
|
}), /* @__PURE__ */ W("p", {
|
|
212
212
|
className: "text-sm text-pretty text-muted-foreground",
|
|
213
|
-
children: /* @__PURE__ */ W(
|
|
213
|
+
children: /* @__PURE__ */ W(e, { id: "Send alerts to Discord, Slack, or your own endpoint." })
|
|
214
214
|
})]
|
|
215
215
|
}), r && /* @__PURE__ */ W(he, {})]
|
|
216
|
-
}),
|
|
216
|
+
}), n ? /* @__PURE__ */ W("p", {
|
|
217
217
|
className: "text-sm text-muted-foreground",
|
|
218
|
-
children: /* @__PURE__ */ W(
|
|
219
|
-
}) :
|
|
218
|
+
children: /* @__PURE__ */ W(e, { id: "Loading…" })
|
|
219
|
+
}) : t.length === 0 ? /* @__PURE__ */ W("p", {
|
|
220
220
|
className: "py-2 text-sm text-muted-foreground",
|
|
221
|
-
children: /* @__PURE__ */ W(
|
|
221
|
+
children: /* @__PURE__ */ W(e, { id: "No webhooks configured." })
|
|
222
222
|
}) : /* @__PURE__ */ G(ne, {
|
|
223
223
|
className: "min-w-[36rem]",
|
|
224
|
-
children: [/* @__PURE__ */ W(te, { children: /* @__PURE__ */ G(
|
|
224
|
+
children: [/* @__PURE__ */ W(te, { children: /* @__PURE__ */ G(D, {
|
|
225
225
|
className: "hover:bg-transparent",
|
|
226
226
|
children: [
|
|
227
|
-
/* @__PURE__ */ W(
|
|
227
|
+
/* @__PURE__ */ W(T, {
|
|
228
228
|
className: "text-muted-foreground",
|
|
229
|
-
children: /* @__PURE__ */ W(
|
|
229
|
+
children: /* @__PURE__ */ W(e, { id: "Name" })
|
|
230
230
|
}),
|
|
231
|
-
/* @__PURE__ */ W(
|
|
231
|
+
/* @__PURE__ */ W(T, {
|
|
232
232
|
className: "text-muted-foreground",
|
|
233
|
-
children: /* @__PURE__ */ W(
|
|
233
|
+
children: /* @__PURE__ */ W(e, { id: "Format" })
|
|
234
234
|
}),
|
|
235
|
-
/* @__PURE__ */ W(
|
|
235
|
+
/* @__PURE__ */ W(T, {
|
|
236
236
|
className: "text-muted-foreground",
|
|
237
237
|
children: "URL"
|
|
238
238
|
}),
|
|
239
|
-
r && /* @__PURE__ */ W(
|
|
239
|
+
r && /* @__PURE__ */ W(T, {
|
|
240
240
|
className: "text-right text-muted-foreground",
|
|
241
|
-
children: /* @__PURE__ */ W(
|
|
241
|
+
children: /* @__PURE__ */ W(e, { id: "Action" })
|
|
242
242
|
})
|
|
243
243
|
]
|
|
244
|
-
}) }), /* @__PURE__ */ W(ee, { children:
|
|
244
|
+
}) }), /* @__PURE__ */ W(ee, { children: t.map((e) => /* @__PURE__ */ W(me, {
|
|
245
245
|
webhook: e,
|
|
246
246
|
edits: r
|
|
247
247
|
}, e.id)) })]
|
|
248
248
|
})]
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
|
-
function me({ webhook:
|
|
252
|
-
let { toast:
|
|
253
|
-
return /* @__PURE__ */ G(
|
|
254
|
-
className:
|
|
251
|
+
function me({ webhook: n, edits: r }) {
|
|
252
|
+
let { toast: a, toastApiError: s, adminMutations: c } = i(), { text: l } = t(), [u, d] = z.useState(!1), f = H(), p = B(c.deleteWebhook(f)), m = n.name ?? n.destination_host;
|
|
253
|
+
return /* @__PURE__ */ G(D, {
|
|
254
|
+
className: n.enabled ? void 0 : "opacity-60",
|
|
255
255
|
children: [
|
|
256
|
-
/* @__PURE__ */ W(
|
|
256
|
+
/* @__PURE__ */ W(E, {
|
|
257
257
|
className: "py-3 font-medium",
|
|
258
258
|
children: m
|
|
259
259
|
}),
|
|
260
|
-
/* @__PURE__ */ W(
|
|
260
|
+
/* @__PURE__ */ W(E, {
|
|
261
261
|
className: "py-3",
|
|
262
262
|
children: /* @__PURE__ */ G("span", {
|
|
263
263
|
className: "flex flex-wrap gap-1",
|
|
264
|
-
children: [/* @__PURE__ */ W(
|
|
264
|
+
children: [/* @__PURE__ */ W(v, {
|
|
265
265
|
variant: "secondary",
|
|
266
|
-
children:
|
|
267
|
-
}), !
|
|
266
|
+
children: n.format
|
|
267
|
+
}), !n.enabled && /* @__PURE__ */ W(v, {
|
|
268
268
|
variant: "outline",
|
|
269
|
-
children: /* @__PURE__ */ W(
|
|
269
|
+
children: /* @__PURE__ */ W(e, { id: "disabled" })
|
|
270
270
|
})]
|
|
271
271
|
})
|
|
272
272
|
}),
|
|
273
|
-
/* @__PURE__ */ W(
|
|
273
|
+
/* @__PURE__ */ W(E, {
|
|
274
274
|
className: "max-w-[22rem] truncate py-3 text-xs text-muted-foreground",
|
|
275
|
-
title:
|
|
276
|
-
children:
|
|
275
|
+
title: n.destination_host,
|
|
276
|
+
children: n.destination_host
|
|
277
277
|
}),
|
|
278
|
-
r && /* @__PURE__ */ W(
|
|
278
|
+
r && /* @__PURE__ */ W(E, {
|
|
279
279
|
className: "py-3 text-right",
|
|
280
280
|
children: /* @__PURE__ */ G("div", {
|
|
281
281
|
className: "flex justify-end gap-1",
|
|
282
282
|
children: [
|
|
283
|
-
/* @__PURE__ */ W(he, { webhook:
|
|
283
|
+
/* @__PURE__ */ W(he, { webhook: n }),
|
|
284
284
|
/* @__PURE__ */ W(o, {
|
|
285
285
|
variant: "ghost",
|
|
286
286
|
size: "icon",
|
|
@@ -300,7 +300,7 @@ function me({ webhook: e, edits: r }) {
|
|
|
300
300
|
actionLabel: "Delete webhook",
|
|
301
301
|
onConfirm: async () => {
|
|
302
302
|
try {
|
|
303
|
-
await p.mutateAsync(
|
|
303
|
+
await p.mutateAsync(n.id), a.success("Webhook deleted");
|
|
304
304
|
} catch (e) {
|
|
305
305
|
s(e, "Delete webhook");
|
|
306
306
|
}
|
|
@@ -312,54 +312,54 @@ function me({ webhook: e, edits: r }) {
|
|
|
312
312
|
]
|
|
313
313
|
});
|
|
314
314
|
}
|
|
315
|
-
function he({ webhook:
|
|
316
|
-
let { toast: r, toastApiError:
|
|
317
|
-
name:
|
|
315
|
+
function he({ webhook: n }) {
|
|
316
|
+
let { toast: r, toastApiError: a, adminMutations: c } = i(), { id: l, text: u } = t(), [d, f] = z.useState(!1), p = H(), m = B(c.createWebhook(p)), h = B(c.updateWebhook(p)), g = () => ({
|
|
317
|
+
name: n?.name ?? "",
|
|
318
318
|
url: "",
|
|
319
|
-
format:
|
|
320
|
-
enabled:
|
|
319
|
+
format: n?.format ?? "generic",
|
|
320
|
+
enabled: n?.enabled ?? !0
|
|
321
321
|
}), _ = K({
|
|
322
322
|
defaultValues: g(),
|
|
323
|
-
onSubmit: async ({ value:
|
|
324
|
-
let
|
|
323
|
+
onSubmit: async ({ value: e }) => {
|
|
324
|
+
let t = e.url.trim();
|
|
325
325
|
try {
|
|
326
|
-
|
|
327
|
-
id:
|
|
326
|
+
n ? await h.mutateAsync({
|
|
327
|
+
id: n.id,
|
|
328
328
|
webhook: {
|
|
329
|
-
name:
|
|
330
|
-
format:
|
|
331
|
-
enabled:
|
|
332
|
-
...
|
|
329
|
+
name: e.name.trim() || null,
|
|
330
|
+
format: e.format,
|
|
331
|
+
enabled: e.enabled,
|
|
332
|
+
...t ? { url: t } : {}
|
|
333
333
|
}
|
|
334
334
|
}) : await m.mutateAsync({
|
|
335
|
-
name:
|
|
336
|
-
url:
|
|
337
|
-
format:
|
|
338
|
-
}), r.success(
|
|
339
|
-
} catch (
|
|
340
|
-
|
|
335
|
+
name: e.name.trim(),
|
|
336
|
+
url: t,
|
|
337
|
+
format: e.format
|
|
338
|
+
}), r.success(n ? "Webhook saved" : "Webhook added"), v(!1);
|
|
339
|
+
} catch (e) {
|
|
340
|
+
a(e, n ? "Save webhook" : "Add webhook");
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
}),
|
|
343
|
+
}), v = (e) => {
|
|
344
344
|
e ? _.reset(g()) : _.reset(), f(e);
|
|
345
345
|
};
|
|
346
346
|
return /* @__PURE__ */ G(P, {
|
|
347
347
|
open: d,
|
|
348
|
-
onOpenChange:
|
|
348
|
+
onOpenChange: v,
|
|
349
349
|
children: [/* @__PURE__ */ W(N, { render: /* @__PURE__ */ G(o, {
|
|
350
350
|
size: "sm",
|
|
351
351
|
variant: "outline",
|
|
352
352
|
children: [
|
|
353
|
-
!
|
|
353
|
+
!n && /* @__PURE__ */ W(se, {
|
|
354
354
|
icon: ce,
|
|
355
355
|
className: "size-4"
|
|
356
356
|
}),
|
|
357
357
|
" ",
|
|
358
|
-
|
|
358
|
+
n ? "Edit" : "Add webhook"
|
|
359
359
|
]
|
|
360
360
|
}) }), /* @__PURE__ */ G(A, {
|
|
361
361
|
className: I,
|
|
362
|
-
children: [/* @__PURE__ */ G(O, { children: [/* @__PURE__ */ W(j, { children:
|
|
362
|
+
children: [/* @__PURE__ */ G(O, { children: [/* @__PURE__ */ W(j, { children: n ? `Edit ${n.name ?? n.destination_host}` : "Add webhook" }), /* @__PURE__ */ W(M, { children: n ? "The current URL is never shown. Paste a new one to replace it, or leave it blank to keep it." : "Paste a webhook address from Discord, Slack, or your own alert receiver." })] }), /* @__PURE__ */ G("form", {
|
|
363
363
|
onSubmit: (e) => {
|
|
364
364
|
e.preventDefault(), e.stopPropagation(), _.handleSubmit();
|
|
365
365
|
},
|
|
@@ -369,41 +369,41 @@ function he({ webhook: e }) {
|
|
|
369
369
|
children: [
|
|
370
370
|
/* @__PURE__ */ W(_.Field, {
|
|
371
371
|
name: "name",
|
|
372
|
-
validators: { onChange: ({ value:
|
|
373
|
-
children: (
|
|
372
|
+
validators: { onChange: ({ value: e }) => n || e.trim() ? void 0 : "Enter a webhook name" },
|
|
373
|
+
children: (t) => /* @__PURE__ */ G("div", {
|
|
374
374
|
className: "grid gap-1.5",
|
|
375
375
|
children: [
|
|
376
376
|
/* @__PURE__ */ W(F, {
|
|
377
377
|
htmlFor: l("wh-name"),
|
|
378
|
-
children: /* @__PURE__ */ W(
|
|
378
|
+
children: /* @__PURE__ */ W(e, { id: "Name" })
|
|
379
379
|
}),
|
|
380
380
|
/* @__PURE__ */ W(s, {
|
|
381
381
|
id: l("wh-name"),
|
|
382
382
|
placeholder: u("e.g. #billing-alerts"),
|
|
383
|
-
value:
|
|
384
|
-
onBlur:
|
|
385
|
-
onChange: (
|
|
386
|
-
"aria-invalid":
|
|
383
|
+
value: t.state.value,
|
|
384
|
+
onBlur: t.handleBlur,
|
|
385
|
+
onChange: (e) => t.handleChange(e.target.value),
|
|
386
|
+
"aria-invalid": t.state.meta.errors.length > 0
|
|
387
387
|
}),
|
|
388
|
-
/* @__PURE__ */ W(
|
|
388
|
+
/* @__PURE__ */ W(y, { errors: t.state.meta.errors })
|
|
389
389
|
]
|
|
390
390
|
})
|
|
391
391
|
}),
|
|
392
392
|
/* @__PURE__ */ W(_.Field, {
|
|
393
393
|
name: "format",
|
|
394
|
-
children: (
|
|
394
|
+
children: (t) => /* @__PURE__ */ G("div", {
|
|
395
395
|
className: "grid gap-1.5",
|
|
396
396
|
children: [/* @__PURE__ */ W(F, {
|
|
397
397
|
htmlFor: l("wh-format"),
|
|
398
|
-
children: /* @__PURE__ */ W(
|
|
399
|
-
}), /* @__PURE__ */ G(
|
|
400
|
-
value:
|
|
401
|
-
onValueChange: (
|
|
402
|
-
children: [/* @__PURE__ */ W(
|
|
398
|
+
children: /* @__PURE__ */ W(e, { id: "Format" })
|
|
399
|
+
}), /* @__PURE__ */ G(w, {
|
|
400
|
+
value: t.state.value,
|
|
401
|
+
onValueChange: (e) => t.handleChange(e),
|
|
402
|
+
children: [/* @__PURE__ */ W(x, {
|
|
403
403
|
id: l("wh-format"),
|
|
404
404
|
className: "w-full",
|
|
405
|
-
children: /* @__PURE__ */ W(
|
|
406
|
-
}), /* @__PURE__ */ W(
|
|
405
|
+
children: /* @__PURE__ */ W(b, {})
|
|
406
|
+
}), /* @__PURE__ */ W(S, { children: fe.map((e) => /* @__PURE__ */ W(C, {
|
|
407
407
|
value: e.value,
|
|
408
408
|
children: e.label
|
|
409
409
|
}, e.value)) })]
|
|
@@ -412,10 +412,10 @@ function he({ webhook: e }) {
|
|
|
412
412
|
}),
|
|
413
413
|
/* @__PURE__ */ W(_.Field, {
|
|
414
414
|
name: "url",
|
|
415
|
-
validators: { onChange: ({ value:
|
|
416
|
-
if (!
|
|
415
|
+
validators: { onChange: ({ value: e }) => {
|
|
416
|
+
if (!e.trim()) return n ? void 0 : "Enter a webhook URL";
|
|
417
417
|
try {
|
|
418
|
-
new URL(
|
|
418
|
+
new URL(e);
|
|
419
419
|
return;
|
|
420
420
|
} catch {
|
|
421
421
|
return "Enter a valid webhook URL";
|
|
@@ -426,34 +426,34 @@ function he({ webhook: e }) {
|
|
|
426
426
|
children: [
|
|
427
427
|
/* @__PURE__ */ W(F, {
|
|
428
428
|
htmlFor: l("wh-url"),
|
|
429
|
-
children: /* @__PURE__ */ W(
|
|
429
|
+
children: /* @__PURE__ */ W(e, { id: "Webhook URL" })
|
|
430
430
|
}),
|
|
431
431
|
/* @__PURE__ */ W(s, {
|
|
432
432
|
id: l("wh-url"),
|
|
433
433
|
type: "url",
|
|
434
434
|
autoComplete: "off",
|
|
435
435
|
className: "text-xs",
|
|
436
|
-
placeholder:
|
|
436
|
+
placeholder: n ? "unchanged" : "https://discord.com/api/webhooks/…",
|
|
437
437
|
value: t.state.value,
|
|
438
438
|
onBlur: t.handleBlur,
|
|
439
439
|
onChange: (e) => t.handleChange(e.target.value),
|
|
440
440
|
"aria-invalid": t.state.meta.errors.length > 0
|
|
441
441
|
}),
|
|
442
|
-
/* @__PURE__ */ W(
|
|
442
|
+
/* @__PURE__ */ W(y, { errors: t.state.meta.errors })
|
|
443
443
|
]
|
|
444
444
|
})
|
|
445
445
|
}),
|
|
446
|
-
|
|
446
|
+
n && /* @__PURE__ */ W(_.Field, {
|
|
447
447
|
name: "enabled",
|
|
448
|
-
children: (
|
|
448
|
+
children: (t) => /* @__PURE__ */ G("div", {
|
|
449
449
|
className: "flex items-center gap-2",
|
|
450
450
|
children: [/* @__PURE__ */ W(re, {
|
|
451
451
|
id: l("wh-enabled"),
|
|
452
|
-
checked:
|
|
453
|
-
onCheckedChange:
|
|
452
|
+
checked: t.state.value,
|
|
453
|
+
onCheckedChange: t.handleChange
|
|
454
454
|
}), /* @__PURE__ */ W(F, {
|
|
455
455
|
htmlFor: l("wh-enabled"),
|
|
456
|
-
children: /* @__PURE__ */ W(
|
|
456
|
+
children: /* @__PURE__ */ W(e, { id: "Enabled" })
|
|
457
457
|
})]
|
|
458
458
|
})
|
|
459
459
|
})
|
|
@@ -466,10 +466,10 @@ function he({ webhook: e }) {
|
|
|
466
466
|
e.canSubmit,
|
|
467
467
|
e.isSubmitting
|
|
468
468
|
],
|
|
469
|
-
children: ([
|
|
469
|
+
children: ([e, t, r, i, a]) => /* @__PURE__ */ W(o, {
|
|
470
470
|
type: "submit",
|
|
471
|
-
disabled: (
|
|
472
|
-
children: a ? "Saving…" :
|
|
471
|
+
disabled: (n ? !r : !e.trim() || !t.trim()) || !i || a,
|
|
472
|
+
children: a ? "Saving…" : n ? "Save" : "Add webhook"
|
|
473
473
|
})
|
|
474
474
|
}) })]
|
|
475
475
|
})]
|
|
@@ -479,13 +479,13 @@ function he({ webhook: e }) {
|
|
|
479
479
|
//#endregion
|
|
480
480
|
//#region src/admin/pages/settings/custody.tsx
|
|
481
481
|
function ge() {
|
|
482
|
-
let e =
|
|
482
|
+
let e = i(), t = H(), n = l(), r = V(e.adminQueries.merchantConfiguration()), a = V(e.adminQueries.psps()), s = [...e.queryKeys.settings(), "custodians"], c = V({
|
|
483
483
|
queryKey: s,
|
|
484
484
|
queryFn: ({ signal: t }) => e.listCustodians(t)
|
|
485
|
-
}), [
|
|
485
|
+
}), [u, d] = z.useState(null), [f] = z.useState(() => e.selectedMerchant()), p = () => t.invalidateQueries({ queryKey: e.queryKeys.settings() }), m = B({
|
|
486
486
|
mutationFn: async ({ psp: t, custody: n }) => {
|
|
487
|
-
if (
|
|
488
|
-
let r =
|
|
487
|
+
if (f !== e.selectedMerchant()) throw Error("Merchant changed; reopen settings");
|
|
488
|
+
let r = a.data?.data.find((e) => e.id === t);
|
|
489
489
|
if (!r) throw Error("PSP is no longer available");
|
|
490
490
|
return e.updatePSP(t, {
|
|
491
491
|
expected_revision: r.revision,
|
|
@@ -496,7 +496,7 @@ function ge() {
|
|
|
496
496
|
onError: (t) => e.toastApiError(t, "Change card custody")
|
|
497
497
|
}), h = B({
|
|
498
498
|
mutationFn: async (t) => {
|
|
499
|
-
if (!r.data ||
|
|
499
|
+
if (!r.data || f !== e.selectedMerchant()) throw Error("Merchant changed; reopen settings");
|
|
500
500
|
return e.updateMerchantConfiguration({
|
|
501
501
|
expected_revision: r.data.revision,
|
|
502
502
|
card_vault: String(t.get("card_vault") ?? ""),
|
|
@@ -506,8 +506,8 @@ function ge() {
|
|
|
506
506
|
onSuccess: p,
|
|
507
507
|
onError: (t) => e.toastApiError(t, "Save card routing")
|
|
508
508
|
});
|
|
509
|
-
if (!r.data || !
|
|
510
|
-
let g =
|
|
509
|
+
if (!r.data || !a.data || !c.data) return null;
|
|
510
|
+
let g = a.data.data.filter((e) => !e.archived && (e.rail === "nmi" || e.rail === "stripe"));
|
|
511
511
|
return /* @__PURE__ */ G("section", {
|
|
512
512
|
className: "grid gap-5",
|
|
513
513
|
"aria-label": "Card vaults",
|
|
@@ -540,7 +540,7 @@ function ge() {
|
|
|
540
540
|
] }), n && !e.archived && /* @__PURE__ */ W(o, {
|
|
541
541
|
size: "sm",
|
|
542
542
|
variant: "outline",
|
|
543
|
-
onClick: () =>
|
|
543
|
+
onClick: () => d(e),
|
|
544
544
|
children: "Edit vault"
|
|
545
545
|
})]
|
|
546
546
|
}, e.key))
|
|
@@ -548,14 +548,14 @@ function ge() {
|
|
|
548
548
|
n && /* @__PURE__ */ W(o, {
|
|
549
549
|
className: "justify-self-start",
|
|
550
550
|
variant: "outline",
|
|
551
|
-
onClick: () =>
|
|
551
|
+
onClick: () => d("new"),
|
|
552
552
|
children: "Add Basis Theory vault"
|
|
553
553
|
}),
|
|
554
|
-
|
|
555
|
-
current:
|
|
556
|
-
close: () =>
|
|
554
|
+
u && /* @__PURE__ */ W(_e, {
|
|
555
|
+
current: u === "new" ? void 0 : u,
|
|
556
|
+
close: () => d(null),
|
|
557
557
|
saved: p
|
|
558
|
-
},
|
|
558
|
+
}, u === "new" ? "new" : `${u.key}:${u.revision}`),
|
|
559
559
|
g.filter((e) => e.rail === "nmi").map((e) => /* @__PURE__ */ G(F, {
|
|
560
560
|
className: "grid gap-2",
|
|
561
561
|
children: [
|
|
@@ -649,9 +649,9 @@ function ge() {
|
|
|
649
649
|
});
|
|
650
650
|
}
|
|
651
651
|
function _e({ current: e, close: t, saved: n }) {
|
|
652
|
-
let r =
|
|
652
|
+
let r = i(), [a] = z.useState(() => r.selectedMerchant()), c = B({
|
|
653
653
|
mutationFn: async (t) => {
|
|
654
|
-
if (
|
|
654
|
+
if (a !== r.selectedMerchant()) throw Error("Merchant changed; reopen this form");
|
|
655
655
|
let n = String(t.get("private_key") ?? "").trim();
|
|
656
656
|
return r.putCustodian(e?.key ?? String(t.get("key") ?? "").trim(), {
|
|
657
657
|
expected_revision: e?.revision ?? 0,
|
|
@@ -750,14 +750,14 @@ function _e({ current: e, close: t, saved: n }) {
|
|
|
750
750
|
}
|
|
751
751
|
//#endregion
|
|
752
752
|
//#region src/admin/pages/settings/index.tsx
|
|
753
|
-
var Q = "flex-none px-0 after:
|
|
753
|
+
var Q = "h-8 flex-none px-0 after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-primary pointer-coarse:h-10";
|
|
754
754
|
function ve() {
|
|
755
|
-
let [
|
|
755
|
+
let [t, i] = r(), a = f(), o = u(), s = n().props.settingsTabs ?? [], c = s.map((e) => e.value), l = d(null, a, o, c), p = d(t.get("tab"), a, o, c);
|
|
756
756
|
return /* @__PURE__ */ G(oe, {
|
|
757
757
|
value: p,
|
|
758
|
-
onValueChange: (
|
|
759
|
-
let
|
|
760
|
-
!
|
|
758
|
+
onValueChange: (e) => {
|
|
759
|
+
let n = new URLSearchParams(t);
|
|
760
|
+
!e || e === l ? n.delete("tab") : n.set("tab", e), i(n);
|
|
761
761
|
},
|
|
762
762
|
className: "flex flex-col gap-4",
|
|
763
763
|
children: [
|
|
@@ -770,22 +770,22 @@ function ve() {
|
|
|
770
770
|
a && /* @__PURE__ */ W(L, {
|
|
771
771
|
value: "merchant",
|
|
772
772
|
className: Q,
|
|
773
|
-
children: /* @__PURE__ */ W(
|
|
773
|
+
children: /* @__PURE__ */ W(e, { id: "Merchant" })
|
|
774
774
|
}),
|
|
775
775
|
a && /* @__PURE__ */ W(L, {
|
|
776
776
|
value: "notifications",
|
|
777
777
|
className: Q,
|
|
778
|
-
children: /* @__PURE__ */ W(
|
|
778
|
+
children: /* @__PURE__ */ W(e, { id: "Notifications" })
|
|
779
779
|
}),
|
|
780
780
|
a && /* @__PURE__ */ W(L, {
|
|
781
781
|
value: "psps",
|
|
782
782
|
className: Q,
|
|
783
|
-
children: /* @__PURE__ */ W(
|
|
783
|
+
children: /* @__PURE__ */ W(e, { id: "PSPs" })
|
|
784
784
|
}),
|
|
785
785
|
o && /* @__PURE__ */ W(L, {
|
|
786
786
|
value: "customer-controls",
|
|
787
787
|
className: Q,
|
|
788
|
-
children: /* @__PURE__ */ W(
|
|
788
|
+
children: /* @__PURE__ */ W(e, { id: "Customer controls" })
|
|
789
789
|
}),
|
|
790
790
|
s.map((e) => /* @__PURE__ */ W(L, {
|
|
791
791
|
value: e.value,
|
|
@@ -819,34 +819,34 @@ function ve() {
|
|
|
819
819
|
});
|
|
820
820
|
}
|
|
821
821
|
function ye() {
|
|
822
|
-
let { adminQueries:
|
|
823
|
-
return
|
|
822
|
+
let { adminQueries: t } = i(), { data: n } = V(t.merchantConfiguration("Load settings")), r = l();
|
|
823
|
+
return n ? /* @__PURE__ */ G("div", {
|
|
824
824
|
className: "grid gap-10",
|
|
825
825
|
children: [
|
|
826
826
|
/* @__PURE__ */ W(J, {}),
|
|
827
827
|
/* @__PURE__ */ W(be, {
|
|
828
|
-
configuration:
|
|
828
|
+
configuration: n,
|
|
829
829
|
edits: r
|
|
830
830
|
}),
|
|
831
831
|
/* @__PURE__ */ W(xe, {
|
|
832
|
-
configuration:
|
|
832
|
+
configuration: n,
|
|
833
833
|
edits: r
|
|
834
834
|
})
|
|
835
835
|
]
|
|
836
836
|
}) : /* @__PURE__ */ W("p", {
|
|
837
837
|
className: "text-sm text-muted-foreground",
|
|
838
|
-
children: /* @__PURE__ */ W(
|
|
838
|
+
children: /* @__PURE__ */ W(e, { id: "Loading…" })
|
|
839
839
|
});
|
|
840
840
|
}
|
|
841
|
-
function be({ configuration:
|
|
842
|
-
let { id: i, text: a } = t(), o =
|
|
843
|
-
displayName:
|
|
841
|
+
function be({ configuration: n, edits: r }) {
|
|
842
|
+
let { id: i, text: a } = t(), o = n.profile, c = () => ({
|
|
843
|
+
displayName: n.display_name,
|
|
844
844
|
fromEmail: o?.from_email ?? "",
|
|
845
845
|
supportURL: o?.support_url ?? "",
|
|
846
846
|
subscribeURL: o?.subscribe_url ?? "",
|
|
847
847
|
billingURL: o?.billing_url ?? "",
|
|
848
848
|
logoURL: o?.logo_url ?? ""
|
|
849
|
-
}), l = q(
|
|
849
|
+
}), l = q(n), u = K({
|
|
850
850
|
defaultValues: c(),
|
|
851
851
|
onSubmit: ({ value: e }) => l.save({
|
|
852
852
|
display_name: e.displayName.trim(),
|
|
@@ -867,10 +867,10 @@ function be({ configuration: e, edits: r }) {
|
|
|
867
867
|
className: "grid gap-1",
|
|
868
868
|
children: [/* @__PURE__ */ W("h2", {
|
|
869
869
|
className: "text-base font-semibold",
|
|
870
|
-
children: /* @__PURE__ */ W(
|
|
870
|
+
children: /* @__PURE__ */ W(e, { id: "Merchant profile" })
|
|
871
871
|
}), /* @__PURE__ */ W("p", {
|
|
872
872
|
className: "text-sm text-pretty text-muted-foreground",
|
|
873
|
-
children: /* @__PURE__ */ W(
|
|
873
|
+
children: /* @__PURE__ */ W(e, { id: "Customer-facing merchant details used on invoices and emails." })
|
|
874
874
|
})]
|
|
875
875
|
}), /* @__PURE__ */ W(u.Subscribe, {
|
|
876
876
|
selector: (e) => [e.canSubmit, e.isSubmitting],
|
|
@@ -908,7 +908,7 @@ function be({ configuration: e, edits: r }) {
|
|
|
908
908
|
onChange: (t) => e.handleChange(t.target.value),
|
|
909
909
|
autoComplete: "organization",
|
|
910
910
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
911
|
-
}), /* @__PURE__ */ W(
|
|
911
|
+
}), /* @__PURE__ */ W(y, { errors: e.state.meta.errors })]
|
|
912
912
|
})
|
|
913
913
|
})
|
|
914
914
|
}),
|
|
@@ -993,7 +993,7 @@ function be({ configuration: e, edits: r }) {
|
|
|
993
993
|
children: [
|
|
994
994
|
/* @__PURE__ */ W(X, {
|
|
995
995
|
label: a("Display name"),
|
|
996
|
-
value:
|
|
996
|
+
value: n.display_name
|
|
997
997
|
}),
|
|
998
998
|
/* @__PURE__ */ W(X, {
|
|
999
999
|
label: a("From email"),
|
|
@@ -1019,8 +1019,8 @@ function be({ configuration: e, edits: r }) {
|
|
|
1019
1019
|
})]
|
|
1020
1020
|
});
|
|
1021
1021
|
}
|
|
1022
|
-
function xe({ configuration:
|
|
1023
|
-
let { id: i, text: a } = t(), o =
|
|
1022
|
+
function xe({ configuration: n, edits: r }) {
|
|
1023
|
+
let { id: i, text: a } = t(), o = n.reprice_notice_window_days ?? 30, c = q(n), l = K({
|
|
1024
1024
|
defaultValues: { days: String(o) },
|
|
1025
1025
|
onSubmit: ({ value: e }) => c.save({ reprice_notice_window_days: Number(e.days) }, "Notice window saved", "Save notice window")
|
|
1026
1026
|
});
|
|
@@ -1032,10 +1032,10 @@ function xe({ configuration: e, edits: r }) {
|
|
|
1032
1032
|
className: "grid max-w-2xl gap-1",
|
|
1033
1033
|
children: [/* @__PURE__ */ W("h2", {
|
|
1034
1034
|
className: "text-base font-semibold",
|
|
1035
|
-
children: /* @__PURE__ */ W(
|
|
1035
|
+
children: /* @__PURE__ */ W(e, { id: "Pricing policies" })
|
|
1036
1036
|
}), /* @__PURE__ */ W("p", {
|
|
1037
1037
|
className: "text-sm text-pretty text-muted-foreground",
|
|
1038
|
-
children: /* @__PURE__ */ W(
|
|
1038
|
+
children: /* @__PURE__ */ W(e, { id: "Set how much notice customers receive before a price increase." })
|
|
1039
1039
|
})]
|
|
1040
1040
|
}), /* @__PURE__ */ W(l.Subscribe, {
|
|
1041
1041
|
selector: (e) => [e.canSubmit, e.isSubmitting],
|
|
@@ -1076,7 +1076,7 @@ function xe({ configuration: e, edits: r }) {
|
|
|
1076
1076
|
onBlur: e.handleBlur,
|
|
1077
1077
|
onChange: (t) => e.handleChange(t.target.value),
|
|
1078
1078
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
1079
|
-
}), /* @__PURE__ */ W(
|
|
1079
|
+
}), /* @__PURE__ */ W(y, { errors: e.state.meta.errors })]
|
|
1080
1080
|
})
|
|
1081
1081
|
})
|
|
1082
1082
|
})
|
|
@@ -1087,12 +1087,12 @@ function xe({ configuration: e, edits: r }) {
|
|
|
1087
1087
|
});
|
|
1088
1088
|
}
|
|
1089
1089
|
function Se() {
|
|
1090
|
-
let { selectedMerchant:
|
|
1091
|
-
if (r.isPending ||
|
|
1090
|
+
let { selectedMerchant: t, adminQueries: n } = i(), r = V(n.psps()), a = V(n.rails()), o = l();
|
|
1091
|
+
if (r.isPending || a.isPending) return /* @__PURE__ */ W("p", {
|
|
1092
1092
|
className: "text-sm text-muted-foreground",
|
|
1093
|
-
children: /* @__PURE__ */ W(
|
|
1093
|
+
children: /* @__PURE__ */ W(e, { id: "Loading…" })
|
|
1094
1094
|
});
|
|
1095
|
-
let s =
|
|
1095
|
+
let s = a.data ?? [];
|
|
1096
1096
|
return /* @__PURE__ */ G("div", {
|
|
1097
1097
|
className: "grid gap-6",
|
|
1098
1098
|
children: [
|
|
@@ -1105,36 +1105,36 @@ function Se() {
|
|
|
1105
1105
|
className: "grid gap-1",
|
|
1106
1106
|
children: [/* @__PURE__ */ W("h2", {
|
|
1107
1107
|
className: "text-base font-semibold",
|
|
1108
|
-
children: /* @__PURE__ */ W(
|
|
1108
|
+
children: /* @__PURE__ */ W(e, { id: "PSPs" })
|
|
1109
1109
|
}), /* @__PURE__ */ W("p", {
|
|
1110
1110
|
className: "text-sm text-muted-foreground",
|
|
1111
|
-
children: /* @__PURE__ */ W(
|
|
1111
|
+
children: /* @__PURE__ */ W(e, { id: "The accounts this merchant takes payments through, one or more per rail." })
|
|
1112
1112
|
})]
|
|
1113
|
-
}), o && /* @__PURE__ */ W(Ne, { railDefinitions: s },
|
|
1113
|
+
}), o && /* @__PURE__ */ W(Ne, { railDefinitions: s }, t() ?? "")]
|
|
1114
1114
|
}), r.data?.data?.length ? /* @__PURE__ */ G(ne, {
|
|
1115
1115
|
className: "min-w-[44rem]",
|
|
1116
|
-
children: [/* @__PURE__ */ W(te, { children: /* @__PURE__ */ G(
|
|
1116
|
+
children: [/* @__PURE__ */ W(te, { children: /* @__PURE__ */ G(D, {
|
|
1117
1117
|
className: "hover:bg-transparent",
|
|
1118
1118
|
children: [
|
|
1119
|
-
/* @__PURE__ */ W(
|
|
1119
|
+
/* @__PURE__ */ W(T, {
|
|
1120
1120
|
className: "text-muted-foreground",
|
|
1121
1121
|
children: "PSP"
|
|
1122
1122
|
}),
|
|
1123
|
-
/* @__PURE__ */ W(
|
|
1123
|
+
/* @__PURE__ */ W(T, {
|
|
1124
1124
|
className: "text-muted-foreground",
|
|
1125
|
-
children: /* @__PURE__ */ W(
|
|
1125
|
+
children: /* @__PURE__ */ W(e, { id: "Environment" })
|
|
1126
1126
|
}),
|
|
1127
|
-
/* @__PURE__ */ W(
|
|
1127
|
+
/* @__PURE__ */ W(T, {
|
|
1128
1128
|
className: "text-muted-foreground",
|
|
1129
|
-
children: /* @__PURE__ */ W(
|
|
1129
|
+
children: /* @__PURE__ */ W(e, { id: "Credentials" })
|
|
1130
1130
|
}),
|
|
1131
|
-
/* @__PURE__ */ W(
|
|
1131
|
+
/* @__PURE__ */ W(T, {
|
|
1132
1132
|
className: "text-muted-foreground",
|
|
1133
|
-
children: /* @__PURE__ */ W(
|
|
1133
|
+
children: /* @__PURE__ */ W(e, { id: "State" })
|
|
1134
1134
|
}),
|
|
1135
|
-
o && /* @__PURE__ */ W(
|
|
1135
|
+
o && /* @__PURE__ */ W(T, {
|
|
1136
1136
|
className: "text-right text-muted-foreground",
|
|
1137
|
-
children: /* @__PURE__ */ W(
|
|
1137
|
+
children: /* @__PURE__ */ W(e, { id: "Action" })
|
|
1138
1138
|
})
|
|
1139
1139
|
]
|
|
1140
1140
|
}) }), /* @__PURE__ */ W(ee, { children: r.data.data.map((e) => /* @__PURE__ */ W(we, {
|
|
@@ -1144,7 +1144,7 @@ function Se() {
|
|
|
1144
1144
|
}, e.id)) })]
|
|
1145
1145
|
}) : /* @__PURE__ */ W("p", {
|
|
1146
1146
|
className: "py-2 text-sm text-muted-foreground",
|
|
1147
|
-
children: /* @__PURE__ */ W(
|
|
1147
|
+
children: /* @__PURE__ */ W(e, { id: "No PSPs configured." })
|
|
1148
1148
|
})]
|
|
1149
1149
|
}),
|
|
1150
1150
|
/* @__PURE__ */ W(ge, {})
|
|
@@ -1154,62 +1154,62 @@ function Se() {
|
|
|
1154
1154
|
function Ce(e) {
|
|
1155
1155
|
return e.validated_at ? `Validated ${m(e.validated_at)}` : e.configured ? "Configured" : "Not configured";
|
|
1156
1156
|
}
|
|
1157
|
-
function we({ psp:
|
|
1158
|
-
let { toast: c, toastApiError: l, toastStaleEdit: u, adminMutations: d, selectedMerchant: f } =
|
|
1159
|
-
if (!(!
|
|
1160
|
-
title: `Archive ${
|
|
1157
|
+
function we({ psp: n, railDefinitions: r, edits: s }) {
|
|
1158
|
+
let { toast: c, toastApiError: l, toastStaleEdit: u, adminMutations: d, selectedMerchant: f } = i(), { text: p } = t(), m = H(), h = B(d.updatePSP(m)), [g, y] = z.useState(!1), b = _(), x = r.find((e) => e.rail === n.rail), S = x?.display_name ?? n.rail, C = n.credentials ?? {}, w = async (e) => {
|
|
1159
|
+
if (!(!e && !await b({
|
|
1160
|
+
title: `Archive ${n.key}?`,
|
|
1161
1161
|
description: "New purchase stops routing to it. Existing subscriptions, refunds and webhooks keep using it.",
|
|
1162
1162
|
confirmLabel: "Archive PSP"
|
|
1163
1163
|
}))) try {
|
|
1164
1164
|
await h.mutateAsync({
|
|
1165
|
-
id:
|
|
1165
|
+
id: n.id,
|
|
1166
1166
|
psp: {
|
|
1167
1167
|
archived: !0,
|
|
1168
|
-
expected_revision:
|
|
1169
|
-
...
|
|
1168
|
+
expected_revision: n.revision,
|
|
1169
|
+
...e ? { allow_last: !0 } : {}
|
|
1170
1170
|
}
|
|
1171
1171
|
}), c.success("PSP archived");
|
|
1172
|
-
} catch (
|
|
1173
|
-
if (
|
|
1174
|
-
|
|
1172
|
+
} catch (t) {
|
|
1173
|
+
if (t instanceof a && t.code === "psp_last_active") {
|
|
1174
|
+
e ? l(t, "Archive PSP") : y(!0);
|
|
1175
1175
|
return;
|
|
1176
1176
|
}
|
|
1177
|
-
if (
|
|
1178
|
-
u(`PSP ${
|
|
1177
|
+
if (t instanceof a && t.revisionMismatch) {
|
|
1178
|
+
u(`PSP ${n.key}`);
|
|
1179
1179
|
return;
|
|
1180
1180
|
}
|
|
1181
|
-
l(
|
|
1181
|
+
l(t, "Archive PSP");
|
|
1182
1182
|
}
|
|
1183
1183
|
};
|
|
1184
|
-
return /* @__PURE__ */ G(
|
|
1185
|
-
className:
|
|
1184
|
+
return /* @__PURE__ */ G(D, {
|
|
1185
|
+
className: n.archived ? "opacity-60" : void 0,
|
|
1186
1186
|
children: [
|
|
1187
|
-
/* @__PURE__ */ W(
|
|
1187
|
+
/* @__PURE__ */ W(E, {
|
|
1188
1188
|
className: "py-3",
|
|
1189
1189
|
children: /* @__PURE__ */ G("div", {
|
|
1190
1190
|
className: "grid min-w-0 leading-tight",
|
|
1191
1191
|
children: [/* @__PURE__ */ W("span", {
|
|
1192
1192
|
className: "font-medium",
|
|
1193
|
-
children:
|
|
1193
|
+
children: n.key
|
|
1194
1194
|
}), /* @__PURE__ */ G("span", {
|
|
1195
1195
|
className: "truncate text-xs text-muted-foreground",
|
|
1196
1196
|
children: [
|
|
1197
|
-
|
|
1197
|
+
S,
|
|
1198
1198
|
" · ",
|
|
1199
|
-
De(
|
|
1199
|
+
De(n)
|
|
1200
1200
|
]
|
|
1201
1201
|
})]
|
|
1202
1202
|
})
|
|
1203
1203
|
}),
|
|
1204
|
-
/* @__PURE__ */ W(
|
|
1204
|
+
/* @__PURE__ */ W(E, {
|
|
1205
1205
|
className: "py-3 capitalize",
|
|
1206
|
-
children:
|
|
1206
|
+
children: n.environment
|
|
1207
1207
|
}),
|
|
1208
|
-
/* @__PURE__ */ W(
|
|
1208
|
+
/* @__PURE__ */ W(E, {
|
|
1209
1209
|
className: "py-3",
|
|
1210
|
-
children: Object.keys(
|
|
1210
|
+
children: Object.keys(C).length > 0 ? /* @__PURE__ */ W("span", {
|
|
1211
1211
|
className: "flex flex-wrap gap-1",
|
|
1212
|
-
children: Object.entries(
|
|
1212
|
+
children: Object.entries(C).map(([e, t]) => /* @__PURE__ */ W(v, {
|
|
1213
1213
|
variant: "secondary",
|
|
1214
1214
|
className: t.configured ? "" : "bg-held-surface text-held",
|
|
1215
1215
|
title: Ce(t),
|
|
@@ -1217,52 +1217,52 @@ function we({ psp: r, railDefinitions: i, edits: s }) {
|
|
|
1217
1217
|
}, e))
|
|
1218
1218
|
}) : /* @__PURE__ */ W("span", {
|
|
1219
1219
|
className: "text-sm text-muted-foreground",
|
|
1220
|
-
children: /* @__PURE__ */ W(
|
|
1220
|
+
children: /* @__PURE__ */ W(e, { id: "None required" })
|
|
1221
1221
|
})
|
|
1222
1222
|
}),
|
|
1223
|
-
/* @__PURE__ */ W(
|
|
1223
|
+
/* @__PURE__ */ W(E, {
|
|
1224
1224
|
className: "py-3",
|
|
1225
|
-
children:
|
|
1225
|
+
children: n.archived && n.open_obligations === 0 ? /* @__PURE__ */ W(v, {
|
|
1226
1226
|
variant: "secondary",
|
|
1227
|
-
children: /* @__PURE__ */ W(
|
|
1228
|
-
}) :
|
|
1227
|
+
children: /* @__PURE__ */ W(e, { id: "archived" })
|
|
1228
|
+
}) : n.archived ? /* @__PURE__ */ G(v, {
|
|
1229
1229
|
variant: "secondary",
|
|
1230
1230
|
className: "bg-held-surface text-held",
|
|
1231
1231
|
children: [
|
|
1232
|
-
/* @__PURE__ */ W(
|
|
1233
|
-
|
|
1232
|
+
/* @__PURE__ */ W(e, { id: "draining (" }),
|
|
1233
|
+
n.open_obligations,
|
|
1234
1234
|
")"
|
|
1235
1235
|
]
|
|
1236
|
-
}) : /* @__PURE__ */ W(
|
|
1236
|
+
}) : /* @__PURE__ */ W(v, {
|
|
1237
1237
|
variant: "secondary",
|
|
1238
1238
|
className: "bg-settled-surface text-settled",
|
|
1239
|
-
children: /* @__PURE__ */ W(
|
|
1239
|
+
children: /* @__PURE__ */ W(e, { id: "active" })
|
|
1240
1240
|
})
|
|
1241
1241
|
}),
|
|
1242
|
-
s && /* @__PURE__ */ W(
|
|
1242
|
+
s && /* @__PURE__ */ W(E, {
|
|
1243
1243
|
className: "py-3 text-right",
|
|
1244
|
-
children: !
|
|
1244
|
+
children: !n.archived && /* @__PURE__ */ G("div", {
|
|
1245
1245
|
className: "flex justify-end gap-2",
|
|
1246
1246
|
children: [
|
|
1247
1247
|
/* @__PURE__ */ W(Te, {
|
|
1248
|
-
psp:
|
|
1249
|
-
credentialKeys:
|
|
1250
|
-
}, `${f() ?? ""}:${
|
|
1248
|
+
psp: n,
|
|
1249
|
+
credentialKeys: x?.credential_keys ?? Object.keys(C)
|
|
1250
|
+
}, `${f() ?? ""}:${n.id}`),
|
|
1251
1251
|
/* @__PURE__ */ W(o, {
|
|
1252
1252
|
variant: "outline",
|
|
1253
1253
|
size: "sm",
|
|
1254
1254
|
disabled: h.isPending,
|
|
1255
|
-
onClick: () =>
|
|
1256
|
-
children: /* @__PURE__ */ W(
|
|
1255
|
+
onClick: () => w(!1),
|
|
1256
|
+
children: /* @__PURE__ */ W(e, { id: "Archive" })
|
|
1257
1257
|
}),
|
|
1258
1258
|
/* @__PURE__ */ W(ie, {
|
|
1259
1259
|
open: g,
|
|
1260
|
-
onOpenChange:
|
|
1261
|
-
title: `Archive the last active ${
|
|
1260
|
+
onOpenChange: y,
|
|
1261
|
+
title: `Archive the last active ${S} PSP?`,
|
|
1262
1262
|
description: p("New purchase on this rail is refused until another PSP is armed. Existing subscriptions, refunds and webhooks keep using this one."),
|
|
1263
1263
|
confirmationWord: "ARCHIVE",
|
|
1264
1264
|
actionLabel: "Archive PSP",
|
|
1265
|
-
onConfirm: () =>
|
|
1265
|
+
onConfirm: () => w(!0)
|
|
1266
1266
|
})
|
|
1267
1267
|
]
|
|
1268
1268
|
})
|
|
@@ -1270,32 +1270,32 @@ function we({ psp: r, railDefinitions: i, edits: s }) {
|
|
|
1270
1270
|
]
|
|
1271
1271
|
});
|
|
1272
1272
|
}
|
|
1273
|
-
function Te({ psp:
|
|
1274
|
-
let { toast: c, toastApiError: l, toastStaleEdit: u, adminMutations: d, selectedMerchant: f } =
|
|
1273
|
+
function Te({ psp: n, credentialKeys: r }) {
|
|
1274
|
+
let { toast: c, toastApiError: l, toastStaleEdit: u, adminMutations: d, selectedMerchant: f } = i(), { id: p } = t(), [h, g] = z.useState(!1), [_] = z.useState(() => f() ?? ""), v = z.useRef(n.revision), y = H(), b = B(d.updatePSP(y)), x = n.credentials ?? {}, S = K({
|
|
1275
1275
|
defaultValues: { credentials: {} },
|
|
1276
|
-
onSubmit: async ({ value:
|
|
1277
|
-
let
|
|
1276
|
+
onSubmit: async ({ value: e }) => {
|
|
1277
|
+
let t = Object.fromEntries(Object.entries(e.credentials).filter(([, e]) => e.trim()));
|
|
1278
1278
|
try {
|
|
1279
1279
|
if ((f() ?? "") !== _) throw Error("Merchant changed; reopen this form");
|
|
1280
1280
|
await b.mutateAsync({
|
|
1281
|
-
id:
|
|
1281
|
+
id: n.id,
|
|
1282
1282
|
psp: {
|
|
1283
1283
|
expected_revision: v.current,
|
|
1284
|
-
credentials:
|
|
1284
|
+
credentials: t
|
|
1285
1285
|
}
|
|
1286
|
-
}), c.success(`${
|
|
1287
|
-
} catch (
|
|
1288
|
-
if (
|
|
1289
|
-
u(`PSP ${
|
|
1286
|
+
}), c.success(`${n.key} credentials validated and rotated`), C(!1);
|
|
1287
|
+
} catch (e) {
|
|
1288
|
+
if (e instanceof a && e.revisionMismatch) {
|
|
1289
|
+
u(`PSP ${n.key}`), C(!1);
|
|
1290
1290
|
return;
|
|
1291
1291
|
}
|
|
1292
|
-
l(
|
|
1292
|
+
l(e, "Rotate credentials");
|
|
1293
1293
|
} finally {
|
|
1294
1294
|
b.reset();
|
|
1295
1295
|
}
|
|
1296
1296
|
}
|
|
1297
1297
|
}), C = (e) => {
|
|
1298
|
-
e || S.reset(), e && (v.current =
|
|
1298
|
+
e || S.reset(), e && (v.current = n.revision), g(e);
|
|
1299
1299
|
};
|
|
1300
1300
|
return /* @__PURE__ */ G(P, {
|
|
1301
1301
|
open: h,
|
|
@@ -1303,46 +1303,46 @@ function Te({ psp: r, credentialKeys: i }) {
|
|
|
1303
1303
|
children: [/* @__PURE__ */ W(N, { render: /* @__PURE__ */ W(o, {
|
|
1304
1304
|
variant: "outline",
|
|
1305
1305
|
size: "sm",
|
|
1306
|
-
children: /* @__PURE__ */ W(
|
|
1306
|
+
children: /* @__PURE__ */ W(e, { id: "Rotate" })
|
|
1307
1307
|
}) }), /* @__PURE__ */ G(A, {
|
|
1308
1308
|
className: I,
|
|
1309
1309
|
children: [/* @__PURE__ */ G(O, { children: [/* @__PURE__ */ G(j, { children: [
|
|
1310
|
-
/* @__PURE__ */ W(
|
|
1311
|
-
|
|
1312
|
-
/* @__PURE__ */ W(
|
|
1313
|
-
De(
|
|
1314
|
-
] }), /* @__PURE__ */ W(M, { children: /* @__PURE__ */ W(
|
|
1310
|
+
/* @__PURE__ */ W(e, { id: "Rotate " }),
|
|
1311
|
+
n.key,
|
|
1312
|
+
/* @__PURE__ */ W(e, { id: " credentials · " }),
|
|
1313
|
+
De(n)
|
|
1314
|
+
] }), /* @__PURE__ */ W(M, { children: /* @__PURE__ */ W(e, { id: "Current credentials are never shown. A new one is validated against the live provider before it is stored; if that check fails, nothing is written. Leave a field blank to keep the credential it holds now." }) })] }), /* @__PURE__ */ G("form", {
|
|
1315
1315
|
onSubmit: (e) => {
|
|
1316
1316
|
e.preventDefault(), e.stopPropagation(), S.handleSubmit();
|
|
1317
1317
|
},
|
|
1318
1318
|
className: "grid gap-4",
|
|
1319
1319
|
children: [/* @__PURE__ */ W(S.Field, {
|
|
1320
1320
|
name: "credentials",
|
|
1321
|
-
children: (
|
|
1321
|
+
children: (t) => /* @__PURE__ */ G("div", {
|
|
1322
1322
|
className: "grid gap-3",
|
|
1323
|
-
children: [
|
|
1324
|
-
let i = x[
|
|
1323
|
+
children: [r.map((r) => {
|
|
1324
|
+
let i = x[r];
|
|
1325
1325
|
return /* @__PURE__ */ G($, {
|
|
1326
|
-
label:
|
|
1327
|
-
id: `rot-${
|
|
1326
|
+
label: r,
|
|
1327
|
+
id: `rot-${n.id}-${r}`,
|
|
1328
1328
|
children: [/* @__PURE__ */ W(s, {
|
|
1329
|
-
id: p(`rot-${
|
|
1329
|
+
id: p(`rot-${n.id}-${r}`),
|
|
1330
1330
|
type: "password",
|
|
1331
1331
|
autoComplete: "new-password",
|
|
1332
1332
|
placeholder: i?.configured ? "unchanged" : "not configured",
|
|
1333
|
-
value:
|
|
1334
|
-
onChange: (
|
|
1335
|
-
...
|
|
1336
|
-
[
|
|
1333
|
+
value: t.state.value[r] ?? "",
|
|
1334
|
+
onChange: (e) => t.handleChange({
|
|
1335
|
+
...t.state.value,
|
|
1336
|
+
[r]: e.target.value
|
|
1337
1337
|
})
|
|
1338
1338
|
}), i?.validated_at && /* @__PURE__ */ G("p", {
|
|
1339
1339
|
className: "text-xs text-muted-foreground",
|
|
1340
|
-
children: [/* @__PURE__ */ W(
|
|
1340
|
+
children: [/* @__PURE__ */ W(e, { id: "Last validated " }), m(i.validated_at)]
|
|
1341
1341
|
})]
|
|
1342
|
-
},
|
|
1342
|
+
}, r);
|
|
1343
1343
|
}), /* @__PURE__ */ W("p", {
|
|
1344
1344
|
className: "text-xs text-muted-foreground",
|
|
1345
|
-
children: /* @__PURE__ */ W(
|
|
1345
|
+
children: /* @__PURE__ */ W(e, { id: "Once this succeeds, the new credential is used for the next charge and every one after it. Previous webhook signing secrets remain accepted while their required overlap is active." })
|
|
1346
1346
|
})]
|
|
1347
1347
|
})
|
|
1348
1348
|
}), /* @__PURE__ */ W(k, { children: /* @__PURE__ */ W(S.Subscribe, {
|
|
@@ -1407,8 +1407,8 @@ var je = {
|
|
|
1407
1407
|
function Me(e) {
|
|
1408
1408
|
return e.split(/[_-]+/).filter(Boolean).map((e, t) => je[e.toLowerCase()] || (t > 0 ? e.toLowerCase() : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase())).join(" ");
|
|
1409
1409
|
}
|
|
1410
|
-
function Ne({ railDefinitions:
|
|
1411
|
-
let { toast: r, toastApiError:
|
|
1410
|
+
function Ne({ railDefinitions: n }) {
|
|
1411
|
+
let { toast: r, toastApiError: a, adminMutations: c, selectedMerchant: l } = i(), { text: u, id: d } = t(), [f, p] = z.useState(!1), [m] = z.useState(() => l() ?? ""), h = H(), g = B(c.createPSP(h)), _ = K({
|
|
1412
1412
|
defaultValues: {
|
|
1413
1413
|
rail: "",
|
|
1414
1414
|
environment: "",
|
|
@@ -1416,36 +1416,36 @@ function Ne({ railDefinitions: e }) {
|
|
|
1416
1416
|
account: {},
|
|
1417
1417
|
credentials: {}
|
|
1418
1418
|
},
|
|
1419
|
-
onSubmit: async ({ value:
|
|
1420
|
-
let
|
|
1419
|
+
onSubmit: async ({ value: e }) => {
|
|
1420
|
+
let t = Object.fromEntries(Object.entries(e.credentials).filter(([, e]) => e !== ""));
|
|
1421
1421
|
try {
|
|
1422
1422
|
if ((l() ?? "") !== m) throw Error("Merchant changed; reopen this form");
|
|
1423
|
-
let i =
|
|
1423
|
+
let i = n.find((t) => t.rail === e.rail);
|
|
1424
1424
|
await g.mutateAsync({
|
|
1425
|
-
key:
|
|
1426
|
-
rail:
|
|
1427
|
-
environment:
|
|
1428
|
-
...Object.fromEntries((i?.account_fields ?? []).map((
|
|
1429
|
-
...Object.keys(
|
|
1425
|
+
key: e.key.trim().toLowerCase(),
|
|
1426
|
+
rail: e.rail,
|
|
1427
|
+
environment: e.environment,
|
|
1428
|
+
...Object.fromEntries((i?.account_fields ?? []).map((t) => [t, (e.account[t] ?? "").trim()])),
|
|
1429
|
+
...Object.keys(t).length ? { credentials: t } : {}
|
|
1430
1430
|
}), _.reset(), r.success("PSP added"), p(!1);
|
|
1431
1431
|
} catch (e) {
|
|
1432
|
-
|
|
1432
|
+
a(e, "Add PSP");
|
|
1433
1433
|
} finally {
|
|
1434
1434
|
g.reset();
|
|
1435
1435
|
}
|
|
1436
1436
|
}
|
|
1437
|
-
}),
|
|
1437
|
+
}), v = (e) => {
|
|
1438
1438
|
e || _.reset(), p(e);
|
|
1439
1439
|
};
|
|
1440
1440
|
return /* @__PURE__ */ G(P, {
|
|
1441
1441
|
open: f,
|
|
1442
|
-
onOpenChange:
|
|
1442
|
+
onOpenChange: v,
|
|
1443
1443
|
children: [/* @__PURE__ */ W(N, { render: /* @__PURE__ */ W(o, {
|
|
1444
1444
|
size: "sm",
|
|
1445
|
-
children: /* @__PURE__ */ W(
|
|
1445
|
+
children: /* @__PURE__ */ W(e, { id: "Add PSP" })
|
|
1446
1446
|
}) }), /* @__PURE__ */ G(A, {
|
|
1447
1447
|
className: I,
|
|
1448
|
-
children: [/* @__PURE__ */ G(O, { children: [/* @__PURE__ */ W(j, { children: /* @__PURE__ */ W(
|
|
1448
|
+
children: [/* @__PURE__ */ G(O, { children: [/* @__PURE__ */ W(j, { children: /* @__PURE__ */ W(e, { id: "Add a PSP" }) }), /* @__PURE__ */ W(M, { children: /* @__PURE__ */ W(e, { id: "Connect the account that will take money for you. Credentials go straight into the secret store and are never shown again." }) })] }), /* @__PURE__ */ G("form", {
|
|
1449
1449
|
onSubmit: (e) => {
|
|
1450
1450
|
e.preventDefault(), e.stopPropagation(), _.handleSubmit();
|
|
1451
1451
|
},
|
|
@@ -1456,59 +1456,59 @@ function Ne({ railDefinitions: e }) {
|
|
|
1456
1456
|
/* @__PURE__ */ W(_.Field, {
|
|
1457
1457
|
name: "rail",
|
|
1458
1458
|
validators: { onChange: ({ value: e }) => e ? void 0 : "Choose a payment rail" },
|
|
1459
|
-
children: (
|
|
1459
|
+
children: (e) => /* @__PURE__ */ G($, {
|
|
1460
1460
|
label: u("Payment rail"),
|
|
1461
1461
|
id: "pv-rail",
|
|
1462
|
-
children: [/* @__PURE__ */ G(
|
|
1463
|
-
items:
|
|
1462
|
+
children: [/* @__PURE__ */ G(w, {
|
|
1463
|
+
items: n.map((e) => ({
|
|
1464
1464
|
value: e.rail,
|
|
1465
1465
|
label: Ae(e.rail, e.display_name)
|
|
1466
1466
|
})),
|
|
1467
|
-
value:
|
|
1468
|
-
onValueChange: (
|
|
1469
|
-
|
|
1467
|
+
value: e.state.value || null,
|
|
1468
|
+
onValueChange: (t) => {
|
|
1469
|
+
e.handleChange(t ?? ""), _.setFieldValue("account", {}), _.setFieldValue("credentials", {}), _.setFieldValue("environment", n.find((e) => e.rail === t)?.environments[0] ?? "");
|
|
1470
1470
|
},
|
|
1471
|
-
children: [/* @__PURE__ */ W(
|
|
1471
|
+
children: [/* @__PURE__ */ W(x, {
|
|
1472
1472
|
id: d("pv-rail"),
|
|
1473
1473
|
className: "w-full",
|
|
1474
|
-
"aria-invalid":
|
|
1475
|
-
children: /* @__PURE__ */ W(
|
|
1476
|
-
}), /* @__PURE__ */ W(
|
|
1474
|
+
"aria-invalid": e.state.meta.errors.length > 0,
|
|
1475
|
+
children: /* @__PURE__ */ W(b, { placeholder: u("Pick a rail…") })
|
|
1476
|
+
}), /* @__PURE__ */ W(S, { children: n.map((e) => /* @__PURE__ */ W(C, {
|
|
1477
1477
|
value: e.rail,
|
|
1478
1478
|
children: Ae(e.rail, e.display_name)
|
|
1479
1479
|
}, e.rail)) })]
|
|
1480
|
-
}), /* @__PURE__ */ W(
|
|
1480
|
+
}), /* @__PURE__ */ W(y, { errors: e.state.meta.errors })]
|
|
1481
1481
|
})
|
|
1482
1482
|
}),
|
|
1483
1483
|
/* @__PURE__ */ W(_.Subscribe, {
|
|
1484
1484
|
selector: (e) => e.values.rail,
|
|
1485
|
-
children: (
|
|
1486
|
-
let
|
|
1485
|
+
children: (e) => {
|
|
1486
|
+
let t = n.find((t) => t.rail === e)?.environments ?? [];
|
|
1487
1487
|
return /* @__PURE__ */ W(_.Field, {
|
|
1488
1488
|
name: "environment",
|
|
1489
1489
|
validators: { onChange: ({ value: e }) => e ? void 0 : "Choose whether it moves real money" },
|
|
1490
|
-
children: (
|
|
1490
|
+
children: (n) => /* @__PURE__ */ G($, {
|
|
1491
1491
|
label: u("Environment"),
|
|
1492
1492
|
id: "pv-environment",
|
|
1493
1493
|
hint: "Whether this PSP moves real money. It is checked with the provider before the PSP is used.",
|
|
1494
|
-
children: [/* @__PURE__ */ G(
|
|
1495
|
-
items:
|
|
1494
|
+
children: [/* @__PURE__ */ G(w, {
|
|
1495
|
+
items: t.map((e) => ({
|
|
1496
1496
|
value: e,
|
|
1497
1497
|
label: u(Oe[e] ?? e)
|
|
1498
1498
|
})),
|
|
1499
|
-
value:
|
|
1500
|
-
onValueChange: (
|
|
1501
|
-
children: [/* @__PURE__ */ W(
|
|
1499
|
+
value: n.state.value || null,
|
|
1500
|
+
onValueChange: (e) => n.handleChange(e ?? ""),
|
|
1501
|
+
children: [/* @__PURE__ */ W(x, {
|
|
1502
1502
|
id: d("pv-environment"),
|
|
1503
1503
|
className: "w-full",
|
|
1504
|
-
disabled: !
|
|
1505
|
-
"aria-invalid":
|
|
1506
|
-
children: /* @__PURE__ */ W(
|
|
1507
|
-
}), /* @__PURE__ */ W(
|
|
1504
|
+
disabled: !e,
|
|
1505
|
+
"aria-invalid": n.state.meta.errors.length > 0,
|
|
1506
|
+
children: /* @__PURE__ */ W(b, { placeholder: u("Pick an environment…") })
|
|
1507
|
+
}), /* @__PURE__ */ W(S, { children: t.map((e) => /* @__PURE__ */ W(C, {
|
|
1508
1508
|
value: e,
|
|
1509
1509
|
children: u(Oe[e] ?? e)
|
|
1510
1510
|
}, e)) })]
|
|
1511
|
-
}), /* @__PURE__ */ W(
|
|
1511
|
+
}), /* @__PURE__ */ W(y, { errors: n.state.meta.errors })]
|
|
1512
1512
|
})
|
|
1513
1513
|
});
|
|
1514
1514
|
}
|
|
@@ -1526,24 +1526,24 @@ function Ne({ railDefinitions: e }) {
|
|
|
1526
1526
|
onBlur: e.handleBlur,
|
|
1527
1527
|
onChange: (t) => e.handleChange(t.target.value),
|
|
1528
1528
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
1529
|
-
}), /* @__PURE__ */ W(
|
|
1529
|
+
}), /* @__PURE__ */ W(y, { errors: e.state.meta.errors })]
|
|
1530
1530
|
})
|
|
1531
1531
|
}),
|
|
1532
1532
|
/* @__PURE__ */ W(_.Subscribe, {
|
|
1533
1533
|
selector: (e) => e.values.rail,
|
|
1534
|
-
children: (
|
|
1534
|
+
children: (e) => /* @__PURE__ */ W(_.Field, {
|
|
1535
1535
|
name: "account",
|
|
1536
|
-
children: (
|
|
1536
|
+
children: (t) => /* @__PURE__ */ W(U, { children: n.find((t) => t.rail === e)?.account_fields.map((e) => /* @__PURE__ */ W($, {
|
|
1537
1537
|
label: u(Ee[e]?.label ?? Me(e)),
|
|
1538
1538
|
id: `pv-account-${e}`,
|
|
1539
1539
|
hint: Ee[e]?.hint,
|
|
1540
1540
|
children: /* @__PURE__ */ W(s, {
|
|
1541
1541
|
id: d(`pv-account-${e}`),
|
|
1542
|
-
value:
|
|
1543
|
-
onBlur:
|
|
1544
|
-
onChange: (
|
|
1545
|
-
...
|
|
1546
|
-
[e]:
|
|
1542
|
+
value: t.state.value[e] ?? "",
|
|
1543
|
+
onBlur: t.handleBlur,
|
|
1544
|
+
onChange: (n) => t.handleChange({
|
|
1545
|
+
...t.state.value,
|
|
1546
|
+
[e]: n.target.value
|
|
1547
1547
|
})
|
|
1548
1548
|
})
|
|
1549
1549
|
}, e)) })
|
|
@@ -1551,11 +1551,11 @@ function Ne({ railDefinitions: e }) {
|
|
|
1551
1551
|
}),
|
|
1552
1552
|
/* @__PURE__ */ W(_.Subscribe, {
|
|
1553
1553
|
selector: (e) => e.values.rail,
|
|
1554
|
-
children: (
|
|
1555
|
-
let
|
|
1554
|
+
children: (e) => {
|
|
1555
|
+
let t = n.find((t) => t.rail === e);
|
|
1556
1556
|
return /* @__PURE__ */ W(_.Field, {
|
|
1557
1557
|
name: "credentials",
|
|
1558
|
-
children: (e) => /* @__PURE__ */ W(U, { children:
|
|
1558
|
+
children: (e) => /* @__PURE__ */ W(U, { children: t?.credential_keys.map((t) => /* @__PURE__ */ W($, {
|
|
1559
1559
|
label: Me(t),
|
|
1560
1560
|
id: `pv-credential-${t}`,
|
|
1561
1561
|
children: /* @__PURE__ */ W(s, {
|
|
@@ -1585,11 +1585,11 @@ function Ne({ railDefinitions: e }) {
|
|
|
1585
1585
|
children: ([t, r, i, a, s, c]) => /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(o, {
|
|
1586
1586
|
type: "button",
|
|
1587
1587
|
variant: "outline",
|
|
1588
|
-
onClick: () =>
|
|
1589
|
-
children: /* @__PURE__ */ W(
|
|
1588
|
+
onClick: () => v(!1),
|
|
1589
|
+
children: /* @__PURE__ */ W(e, { id: "Cancel" })
|
|
1590
1590
|
}), /* @__PURE__ */ W(o, {
|
|
1591
1591
|
type: "submit",
|
|
1592
|
-
disabled: !t || !r || !i.trim() || !
|
|
1592
|
+
disabled: !t || !r || !i.trim() || !n.find((e) => e.rail === t)?.account_fields.every((e) => (a[e] ?? "").trim()) || !s || c,
|
|
1593
1593
|
children: c ? "Saving…" : "Add PSP"
|
|
1594
1594
|
})] })
|
|
1595
1595
|
}) })]
|
|
@@ -1598,11 +1598,11 @@ function Ne({ railDefinitions: e }) {
|
|
|
1598
1598
|
});
|
|
1599
1599
|
}
|
|
1600
1600
|
function Pe() {
|
|
1601
|
-
let { toast:
|
|
1601
|
+
let { toast: n, toastApiError: r, adminMutations: a } = i(), { text: l, id: u } = t(), [d, f] = z.useState(), m = B(a.lookupCustomerControls()), _ = B(a.setCreditLimit()), v = c(), b = K({
|
|
1602
1602
|
defaultValues: { newLimit: "" },
|
|
1603
|
-
onSubmit: async ({ value:
|
|
1603
|
+
onSubmit: async ({ value: e }) => {
|
|
1604
1604
|
if (!d) return;
|
|
1605
|
-
let
|
|
1605
|
+
let t = p(d.currency), i = t === void 0 ? null : g(e.newLimit, t);
|
|
1606
1606
|
if (!(i === null || i.startsWith("-"))) try {
|
|
1607
1607
|
await _.mutateAsync({
|
|
1608
1608
|
customerId: d.customerID,
|
|
@@ -1611,7 +1611,7 @@ function Pe() {
|
|
|
1611
1611
|
}), f((e) => e && {
|
|
1612
1612
|
...e,
|
|
1613
1613
|
creditLimit: i
|
|
1614
|
-
}), b.reset(),
|
|
1614
|
+
}), b.reset(), n.success("Credit limit updated");
|
|
1615
1615
|
} catch (e) {
|
|
1616
1616
|
r(e, "Set credit limit");
|
|
1617
1617
|
}
|
|
@@ -1645,10 +1645,10 @@ function Pe() {
|
|
|
1645
1645
|
className: "grid gap-1",
|
|
1646
1646
|
children: [/* @__PURE__ */ W("h2", {
|
|
1647
1647
|
className: "text-base font-semibold",
|
|
1648
|
-
children: /* @__PURE__ */ W(
|
|
1648
|
+
children: /* @__PURE__ */ W(e, { id: "Customer lookup" })
|
|
1649
1649
|
}), /* @__PURE__ */ W("p", {
|
|
1650
1650
|
className: "text-sm text-muted-foreground",
|
|
1651
|
-
children: /* @__PURE__ */ W(
|
|
1651
|
+
children: /* @__PURE__ */ W(e, { id: "Find a customer by ID and currency." })
|
|
1652
1652
|
})]
|
|
1653
1653
|
}), /* @__PURE__ */ G("form", {
|
|
1654
1654
|
onSubmit: (e) => {
|
|
@@ -1669,7 +1669,7 @@ function Pe() {
|
|
|
1669
1669
|
onBlur: e.handleBlur,
|
|
1670
1670
|
onChange: (t) => e.handleChange(t.target.value),
|
|
1671
1671
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
1672
|
-
}), /* @__PURE__ */ W(
|
|
1672
|
+
}), /* @__PURE__ */ W(y, { errors: e.state.meta.errors })]
|
|
1673
1673
|
})
|
|
1674
1674
|
}),
|
|
1675
1675
|
/* @__PURE__ */ W(x.Field, {
|
|
@@ -1685,7 +1685,7 @@ function Pe() {
|
|
|
1685
1685
|
onBlur: e.handleBlur,
|
|
1686
1686
|
onChange: (t) => e.handleChange(t.target.value),
|
|
1687
1687
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
1688
|
-
}), /* @__PURE__ */ W(
|
|
1688
|
+
}), /* @__PURE__ */ W(y, { errors: e.state.meta.errors })]
|
|
1689
1689
|
})
|
|
1690
1690
|
}),
|
|
1691
1691
|
/* @__PURE__ */ W(x.Subscribe, {
|
|
@@ -1711,7 +1711,7 @@ function Pe() {
|
|
|
1711
1711
|
className: "grid gap-1",
|
|
1712
1712
|
children: [/* @__PURE__ */ W("h2", {
|
|
1713
1713
|
className: "text-base font-semibold",
|
|
1714
|
-
children: /* @__PURE__ */ W(
|
|
1714
|
+
children: /* @__PURE__ */ W(e, { id: "Credit and trust" })
|
|
1715
1715
|
}), /* @__PURE__ */ G("p", {
|
|
1716
1716
|
className: "text-sm text-muted-foreground",
|
|
1717
1717
|
children: [
|
|
@@ -1735,7 +1735,7 @@ function Pe() {
|
|
|
1735
1735
|
value: d.creditLimit === "0" ? "Off" : h(d.creditLimit, d.currency)
|
|
1736
1736
|
})]
|
|
1737
1737
|
}),
|
|
1738
|
-
|
|
1738
|
+
v && /* @__PURE__ */ W("form", {
|
|
1739
1739
|
onSubmit: (e) => {
|
|
1740
1740
|
e.preventDefault(), e.stopPropagation(), b.handleSubmit();
|
|
1741
1741
|
},
|
|
@@ -1748,7 +1748,7 @@ function Pe() {
|
|
|
1748
1748
|
let t = p(d.currency), n = t === void 0 ? null : g(e, t);
|
|
1749
1749
|
return e !== "" && n !== null && !n.startsWith("-") ? void 0 : "Enter a valid amount";
|
|
1750
1750
|
} },
|
|
1751
|
-
children: (
|
|
1751
|
+
children: (t) => /* @__PURE__ */ G("div", {
|
|
1752
1752
|
className: "grid gap-1.5",
|
|
1753
1753
|
children: [
|
|
1754
1754
|
/* @__PURE__ */ G("div", {
|
|
@@ -1759,10 +1759,10 @@ function Pe() {
|
|
|
1759
1759
|
type: "number",
|
|
1760
1760
|
step: "any",
|
|
1761
1761
|
min: "0",
|
|
1762
|
-
value:
|
|
1763
|
-
onBlur:
|
|
1764
|
-
onChange: (
|
|
1765
|
-
"aria-invalid":
|
|
1762
|
+
value: t.state.value,
|
|
1763
|
+
onBlur: t.handleBlur,
|
|
1764
|
+
onChange: (e) => t.handleChange(e.target.value),
|
|
1765
|
+
"aria-invalid": t.state.meta.errors.length > 0
|
|
1766
1766
|
}), /* @__PURE__ */ W(b.Subscribe, {
|
|
1767
1767
|
selector: (e) => [
|
|
1768
1768
|
e.values.newLimit,
|
|
@@ -1776,10 +1776,10 @@ function Pe() {
|
|
|
1776
1776
|
})
|
|
1777
1777
|
})]
|
|
1778
1778
|
}),
|
|
1779
|
-
/* @__PURE__ */ W(
|
|
1779
|
+
/* @__PURE__ */ W(y, { errors: t.state.meta.errors }),
|
|
1780
1780
|
/* @__PURE__ */ W("p", {
|
|
1781
1781
|
className: "text-xs text-muted-foreground",
|
|
1782
|
-
children: /* @__PURE__ */ W(
|
|
1782
|
+
children: /* @__PURE__ */ W(e, { id: "Enter 0 to turn credit off." })
|
|
1783
1783
|
})
|
|
1784
1784
|
]
|
|
1785
1785
|
})
|
|
@@ -1810,4 +1810,4 @@ function $({ label: e, id: n, hint: r, children: i }) {
|
|
|
1810
1810
|
//#endregion
|
|
1811
1811
|
export { ve as SettingsPage };
|
|
1812
1812
|
|
|
1813
|
-
//# sourceMappingURL=admin-settings-
|
|
1813
|
+
//# sourceMappingURL=admin-settings-BOoTzhyf.js.map
|