@openrails/billing-ui 0.279.0 → 0.281.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-attempts-CP5CWyNR.js → admin-attempts-DjgBAbx9.js} +71 -72
- package/dist/admin-attempts-DjgBAbx9.js.map +1 -0
- package/dist/{admin-auth-DlIOmwPo.js → admin-auth-BUUdvmqC.js} +3 -4
- package/dist/admin-auth-BUUdvmqC.js.map +1 -0
- package/dist/{admin-badge-DR_8AhdC.js → admin-badge-CAlUmS2s.js} +3 -4
- package/dist/admin-badge-CAlUmS2s.js.map +1 -0
- package/dist/{admin-button-DBzTD6By.js → admin-button-Bn4otsuw.js} +3 -4
- package/dist/admin-button-Bn4otsuw.js.map +1 -0
- package/dist/{admin-capabilities-CZdT1Pxe.js → admin-capabilities-DS-X-__V.js} +3 -4
- package/dist/admin-capabilities-DS-X-__V.js.map +1 -0
- package/dist/{admin-card-mZl4-s5d.js → admin-card-BHKW1dfB.js} +3 -4
- package/dist/admin-card-BHKW1dfB.js.map +1 -0
- package/dist/{admin-catalog-DpTjS0Yo.js → admin-catalog-BdLDhr8R.js} +309 -312
- package/dist/admin-catalog-BdLDhr8R.js.map +1 -0
- package/dist/{admin-confirm-katGq0Qo.js → admin-confirm-DWq-edDC.js} +2 -3
- package/dist/admin-confirm-DWq-edDC.js.map +1 -0
- package/dist/{admin-csv-CPoNZj2D.js → admin-csv-CRrmaR6a.js} +2 -3
- package/dist/admin-csv-CRrmaR6a.js.map +1 -0
- package/dist/{admin-cursor-pager-C-KjCIy9.js → admin-cursor-pager-Qo9Sq6lN.js} +6 -8
- package/dist/admin-cursor-pager-Qo9Sq6lN.js.map +1 -0
- package/dist/{admin-customers-BE3N839X.js → admin-customers-BZP6Jv-i.js} +21 -22
- package/dist/admin-customers-BZP6Jv-i.js.map +1 -0
- package/dist/{admin-dashboard-BxjkV15J.js → admin-dashboard-BJSonknv.js} +150 -153
- package/dist/admin-dashboard-BJSonknv.js.map +1 -0
- package/dist/{admin-data-table-D89AwWz_.js → admin-data-table-BiFmcf0Z.js} +19 -26
- package/dist/admin-data-table-BiFmcf0Z.js.map +1 -0
- package/dist/admin-detail-C03O0R6e.js +1351 -0
- package/dist/{admin-detail-P-UnNvXJ.js.map → admin-detail-C03O0R6e.js.map} +1 -1
- package/dist/{admin-detail-Ln56otK0.js → admin-detail-C6VH3i2v.js} +74 -75
- package/dist/admin-detail-C6VH3i2v.js.map +1 -0
- package/dist/{admin-detail-C8lD7U2t.js → admin-detail-CQws8363.js} +199 -202
- package/dist/admin-detail-CQws8363.js.map +1 -0
- package/dist/admin-detail-NApy5bio.js +337 -0
- package/dist/admin-detail-NApy5bio.js.map +1 -0
- package/dist/{admin-detail-D6zD085K.js → admin-detail-cijme9Lc.js} +92 -94
- package/dist/admin-detail-cijme9Lc.js.map +1 -0
- package/dist/{admin-dialog-Dn2FRJu4.js → admin-dialog-CgYGInHi.js} +4 -5
- package/dist/admin-dialog-CgYGInHi.js.map +1 -0
- package/dist/{admin-dialog-width-CC7QHT1p.js → admin-dialog-width-C_WFpow0.js} +2 -3
- package/dist/admin-dialog-width-C_WFpow0.js.map +1 -0
- package/dist/{admin-dom-C7Y7A6Wa.js → admin-dom-BP9QROfy.js} +2 -3
- package/dist/admin-dom-BP9QROfy.js.map +1 -0
- package/dist/{admin-dropdown-menu-DLUn6Uj3.js → admin-dropdown-menu-CU9RxoEJ.js} +3 -4
- package/dist/admin-dropdown-menu-CU9RxoEJ.js.map +1 -0
- package/dist/{admin-dunning-COaHzrmN.js → admin-dunning-D8lAP7OA.js} +3 -4
- package/dist/admin-dunning-D8lAP7OA.js.map +1 -0
- package/dist/{admin-fact-card-DKvBnUXB.js → admin-fact-card-lN-MsuSp.js} +3 -4
- package/dist/admin-fact-card-lN-MsuSp.js.map +1 -0
- package/dist/{admin-form-field-errors-hbUMIriS.js → admin-form-field-errors-Cuhy38F1.js} +2 -3
- package/dist/admin-form-field-errors-Cuhy38F1.js.map +1 -0
- package/dist/{admin-format-BbiTCqUG.js → admin-format-D9Ablh0P.js} +3 -5
- package/dist/admin-format-D9Ablh0P.js.map +1 -0
- package/dist/{admin-health-DmnI4e8K.js → admin-health-CnagC763.js} +91 -93
- package/dist/admin-health-CnagC763.js.map +1 -0
- package/dist/{admin-imports-C0aMP6sj.js → admin-imports-SM_fKKgW.js} +92 -93
- package/dist/admin-imports-SM_fKKgW.js.map +1 -0
- package/dist/{admin-input-JKrQIGfD.js → admin-input-B_EUzCAE.js} +3 -4
- package/dist/admin-input-B_EUzCAE.js.map +1 -0
- package/dist/{admin-invoice-profile-model-Cgjy3zV8.js → admin-invoice-profile-model-CNsvK89v.js} +2 -3
- package/dist/admin-invoice-profile-model-CNsvK89v.js.map +1 -0
- package/dist/{admin-label-CHWsVIZC.js → admin-label-DQsOkp1p.js} +3 -4
- package/dist/admin-label-DQsOkp1p.js.map +1 -0
- package/dist/{admin-linked-table-row-BMZYYsuk.js → admin-linked-table-row-BFsgc9tz.js} +5 -6
- package/dist/admin-linked-table-row-BFsgc9tz.js.map +1 -0
- package/dist/{admin-map-dialog-BHUGdCcv.js → admin-map-dialog-Dt3gTuTD.js} +26 -27
- package/dist/admin-map-dialog-Dt3gTuTD.js.map +1 -0
- package/dist/{admin-mapping-csv-FtkyTBmk.js → admin-mapping-csv-DzpB9HQn.js} +1 -2
- package/dist/admin-mapping-csv-DzpB9HQn.js.map +1 -0
- package/dist/admin-metering-DM4KhjOq.js +1717 -0
- package/dist/admin-metering-DM4KhjOq.js.map +1 -0
- package/dist/{admin-missing-record-BPFs3MmO.js → admin-missing-record-G2Jz-VUn.js} +3 -4
- package/dist/admin-missing-record-G2Jz-VUn.js.map +1 -0
- package/dist/{admin-ops-CL2kjDwi.js → admin-ops-mwzj-jpg.js} +99 -100
- package/dist/admin-ops-mwzj-jpg.js.map +1 -0
- package/dist/{admin-orders-C1Sf2qhc.js → admin-orders-D_aqV66h.js} +41 -42
- package/dist/admin-orders-D_aqV66h.js.map +1 -0
- package/dist/{admin-parked-a0tB5bhG.js → admin-parked-2FjIfyMg.js} +47 -48
- package/dist/admin-parked-2FjIfyMg.js.map +1 -0
- package/dist/{admin-payments-DJcjwRA4.js → admin-payments-B4hh31PR.js} +36 -37
- package/dist/admin-payments-B4hh31PR.js.map +1 -0
- package/dist/{admin-price-detail-BOmeWw15.js → admin-price-detail--5Bovz20.js} +88 -90
- package/dist/admin-price-detail--5Bovz20.js.map +1 -0
- package/dist/{admin-price-format-CqOmHrIn.js → admin-price-format-C-pus9FL.js} +4 -6
- package/dist/admin-price-format-C-pus9FL.js.map +1 -0
- package/dist/admin-price-wizard-Cj_Bgh-V.js +354 -0
- package/dist/admin-price-wizard-Cj_Bgh-V.js.map +1 -0
- package/dist/{admin-proposals-DVrl-ym4.js → admin-proposals-DPRFoWel.js} +114 -116
- package/dist/admin-proposals-DPRFoWel.js.map +1 -0
- package/dist/{admin-provider-prices-BVVogH7Q.js → admin-provider-prices-B8Oc86dP.js} +74 -75
- package/dist/admin-provider-prices-B8Oc86dP.js.map +1 -0
- package/dist/{admin-range-picker-C6BtSm2B.js → admin-range-picker-CSWcCYkg.js} +8 -11
- package/dist/admin-range-picker-CSWcCYkg.js.map +1 -0
- package/dist/admin-records-CWbfqyT8.js +390 -0
- package/dist/admin-records-CWbfqyT8.js.map +1 -0
- package/dist/{admin-reports-CtPoiceH.js → admin-reports-CAHWO_d6.js} +59 -60
- package/dist/admin-reports-CAHWO_d6.js.map +1 -0
- package/dist/{admin-select-6Yuh5M1Q.js → admin-select-DSGCZFiZ.js} +3 -4
- package/dist/admin-select-DSGCZFiZ.js.map +1 -0
- package/dist/{admin-settings-DscHu4ww.js → admin-settings-BrvNTJlM.js} +640 -645
- package/dist/admin-settings-BrvNTJlM.js.map +1 -0
- package/dist/{admin-shared-BywM-MMp.js → admin-shared-DdN2hyaR.js} +23 -25
- package/dist/admin-shared-DdN2hyaR.js.map +1 -0
- package/dist/{admin-skeleton-lndmw89u.js → admin-skeleton-DOfsDIu0.js} +3 -4
- package/dist/admin-skeleton-DOfsDIu0.js.map +1 -0
- package/dist/{admin-status-badge-IL8ofZ_6.js → admin-status-badge-BLEGt2Fw.js} +6 -7
- package/dist/{admin-status-badge-IL8ofZ_6.js.map → admin-status-badge-BLEGt2Fw.js.map} +1 -1
- package/dist/{admin-subscriptions-Cd5CGrue.js → admin-subscriptions-PL5G3f0O.js} +38 -39
- package/dist/admin-subscriptions-PL5G3f0O.js.map +1 -0
- package/dist/{admin-switch-DpwQSzEm.js → admin-switch-aOiQQzST.js} +3 -4
- package/dist/admin-switch-aOiQQzST.js.map +1 -0
- package/dist/{admin-table-D-GdGM1m.js → admin-table-DIKl2rpV.js} +3 -4
- package/dist/admin-table-DIKl2rpV.js.map +1 -0
- package/dist/{admin-tabs-B--1flzO.js → admin-tabs-DR74xX0-.js} +8 -10
- package/dist/admin-tabs-DR74xX0-.js.map +1 -0
- package/dist/{admin-textarea-xsp5V9xM.js → admin-textarea-W52-l_0n.js} +3 -4
- package/dist/admin-textarea-W52-l_0n.js.map +1 -0
- package/dist/{admin-tile-grids-CzGpidd9.js → admin-tile-grids-Gc67MtA6.js} +2 -3
- package/dist/admin-tile-grids-Gc67MtA6.js.map +1 -0
- package/dist/{admin-typed-confirm-dialog-NiEDwX_0.js → admin-typed-confirm-dialog-B_00EHlT.js} +13 -14
- package/dist/admin-typed-confirm-dialog-B_00EHlT.js.map +1 -0
- package/dist/{admin-utils-wuPUD0uh.js → admin-utils-CX097OR7.js} +23 -47
- package/dist/{admin-utils-wuPUD0uh.js.map → admin-utils-CX097OR7.js.map} +1 -1
- package/dist/{admin-widget-viz-kHHVmDEx.js → admin-widget-viz-DVV9aTQp.js} +21 -24
- package/dist/admin-widget-viz-DVV9aTQp.js.map +1 -0
- package/dist/admin.js +60 -84
- package/dist/admin.js.map +1 -1
- package/dist/client/generated/routes.d.ts +1 -1
- package/dist/client/generated/wire.d.ts +1 -0
- package/dist/{client-ctrbivyN.js → client-DwsFGm4M.js} +6 -11
- package/dist/client-DwsFGm4M.js.map +1 -0
- package/dist/client.js +1 -2
- package/dist/{create-card-BEILS1VB-DeyyfyFD.js → create-card-BEILS1VB-B1MQg0iK.js} +3 -4
- package/dist/create-card-BEILS1VB-B1MQg0iK.js.map +1 -0
- package/dist/{create-card-display-Dv5pcpzc-BWB6vzo2.js → create-card-display-Dv5pcpzc-DotrmqWH.js} +5 -9
- package/dist/create-card-display-Dv5pcpzc-DotrmqWH.js.map +1 -0
- package/dist/{create-copy-button-CAYmfugS-qNapojfj.js → create-copy-button-CAYmfugS-CAgco7FO.js} +3 -4
- package/dist/create-copy-button-CAYmfugS-CAgco7FO.js.map +1 -0
- package/dist/{dist-CslWupfi.js → dist-BPWQ2tCx.js} +6 -7
- package/dist/dist-BPWQ2tCx.js.map +1 -0
- package/dist/{hooks-KpTetx6F.js → hooks-C-MhXjQh.js} +13 -22
- package/dist/hooks-C-MhXjQh.js.map +1 -0
- package/dist/{index-rGw83t5v-BE6naeQR.js → index-rGw83t5v-ydBZxXI_.js} +10 -24
- package/dist/index-rGw83t5v-ydBZxXI_.js.map +1 -0
- package/dist/index.js +67 -124
- package/dist/index.js.map +1 -1
- package/dist/locales/de.js +1 -2
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.js +1 -2
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +1 -2
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +1 -2
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +1 -2
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +1 -2
- package/dist/locales/zh.js.map +1 -1
- package/dist/react.js +1 -2
- package/package.json +2 -3
- package/CHANGELOG.md +0 -758
- package/dist/admin-attempts-CP5CWyNR.js.map +0 -1
- package/dist/admin-auth-DlIOmwPo.js.map +0 -1
- package/dist/admin-badge-DR_8AhdC.js.map +0 -1
- package/dist/admin-button-DBzTD6By.js.map +0 -1
- package/dist/admin-capabilities-CZdT1Pxe.js.map +0 -1
- package/dist/admin-card-mZl4-s5d.js.map +0 -1
- package/dist/admin-catalog-DpTjS0Yo.js.map +0 -1
- package/dist/admin-confirm-katGq0Qo.js.map +0 -1
- package/dist/admin-csv-CPoNZj2D.js.map +0 -1
- package/dist/admin-cursor-pager-C-KjCIy9.js.map +0 -1
- package/dist/admin-customers-BE3N839X.js.map +0 -1
- package/dist/admin-dashboard-BxjkV15J.js.map +0 -1
- package/dist/admin-data-table-D89AwWz_.js.map +0 -1
- package/dist/admin-detail-BKe9xqPd.js +0 -338
- package/dist/admin-detail-BKe9xqPd.js.map +0 -1
- package/dist/admin-detail-C8lD7U2t.js.map +0 -1
- package/dist/admin-detail-D6zD085K.js.map +0 -1
- package/dist/admin-detail-Ln56otK0.js.map +0 -1
- package/dist/admin-detail-P-UnNvXJ.js +0 -1357
- package/dist/admin-dialog-Dn2FRJu4.js.map +0 -1
- package/dist/admin-dialog-width-CC7QHT1p.js.map +0 -1
- package/dist/admin-dom-C7Y7A6Wa.js.map +0 -1
- package/dist/admin-dropdown-menu-DLUn6Uj3.js.map +0 -1
- package/dist/admin-dunning-COaHzrmN.js.map +0 -1
- package/dist/admin-fact-card-DKvBnUXB.js.map +0 -1
- package/dist/admin-form-field-errors-hbUMIriS.js.map +0 -1
- package/dist/admin-format-BbiTCqUG.js.map +0 -1
- package/dist/admin-health-DmnI4e8K.js.map +0 -1
- package/dist/admin-imports-C0aMP6sj.js.map +0 -1
- package/dist/admin-input-JKrQIGfD.js.map +0 -1
- package/dist/admin-invoice-profile-model-Cgjy3zV8.js.map +0 -1
- package/dist/admin-label-CHWsVIZC.js.map +0 -1
- package/dist/admin-linked-table-row-BMZYYsuk.js.map +0 -1
- package/dist/admin-map-dialog-BHUGdCcv.js.map +0 -1
- package/dist/admin-mapping-csv-FtkyTBmk.js.map +0 -1
- package/dist/admin-metering-CDqueHUh.js +0 -1721
- package/dist/admin-metering-CDqueHUh.js.map +0 -1
- package/dist/admin-missing-record-BPFs3MmO.js.map +0 -1
- package/dist/admin-ops-CL2kjDwi.js.map +0 -1
- package/dist/admin-orders-C1Sf2qhc.js.map +0 -1
- package/dist/admin-parked-a0tB5bhG.js.map +0 -1
- package/dist/admin-payments-DJcjwRA4.js.map +0 -1
- package/dist/admin-price-detail-BOmeWw15.js.map +0 -1
- package/dist/admin-price-format-CqOmHrIn.js.map +0 -1
- package/dist/admin-price-wizard-B6s5OJeO.js +0 -356
- package/dist/admin-price-wizard-B6s5OJeO.js.map +0 -1
- package/dist/admin-proposals-DVrl-ym4.js.map +0 -1
- package/dist/admin-provider-prices-BVVogH7Q.js.map +0 -1
- package/dist/admin-range-picker-C6BtSm2B.js.map +0 -1
- package/dist/admin-records-DKtcgN11.js +0 -391
- package/dist/admin-records-DKtcgN11.js.map +0 -1
- package/dist/admin-reports-CtPoiceH.js.map +0 -1
- package/dist/admin-select-6Yuh5M1Q.js.map +0 -1
- package/dist/admin-settings-DscHu4ww.js.map +0 -1
- package/dist/admin-shared-BywM-MMp.js.map +0 -1
- package/dist/admin-skeleton-lndmw89u.js.map +0 -1
- package/dist/admin-subscriptions-Cd5CGrue.js.map +0 -1
- package/dist/admin-switch-DpwQSzEm.js.map +0 -1
- package/dist/admin-table-D-GdGM1m.js.map +0 -1
- package/dist/admin-tabs-B--1flzO.js.map +0 -1
- package/dist/admin-textarea-xsp5V9xM.js.map +0 -1
- package/dist/admin-tile-grids-CzGpidd9.js.map +0 -1
- package/dist/admin-typed-confirm-dialog-NiEDwX_0.js.map +0 -1
- package/dist/admin-widget-viz-kHHVmDEx.js.map +0 -1
- package/dist/client-ctrbivyN.js.map +0 -1
- package/dist/create-card-BEILS1VB-DeyyfyFD.js.map +0 -1
- package/dist/create-card-display-Dv5pcpzc-BWB6vzo2.js.map +0 -1
- package/dist/create-copy-button-CAYmfugS-qNapojfj.js.map +0 -1
- package/dist/dist-CslWupfi.js.map +0 -1
- package/dist/hooks-KpTetx6F.js.map +0 -1
- package/dist/index-rGw83t5v-BE6naeQR.js.map +0 -1
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { E as e, O as t, f as n, l as r, p as i, w as a } from "./admin-utils-
|
|
2
|
-
import { t as o } from "./admin-
|
|
3
|
-
import { t as s } from "./admin-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as
|
|
9
|
-
import {
|
|
10
|
-
import { a as
|
|
11
|
-
import { a as
|
|
12
|
-
import { t as
|
|
13
|
-
import {
|
|
14
|
-
import { r as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import * as
|
|
18
|
-
import { useMutation as
|
|
19
|
-
import { Fragment as
|
|
20
|
-
import { HugeiconsIcon as
|
|
21
|
-
import { Add01Icon as
|
|
22
|
-
import { useForm as
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
let { toast: t, toastApiError: n, toastStaleEdit: r, adminMutations: o } = i(), [s, c] =
|
|
1
|
+
import { E as e, O as t, f as n, l as r, p as i, w as a } from "./admin-utils-CX097OR7.js";
|
|
2
|
+
import { t as o } from "./admin-badge-CAlUmS2s.js";
|
|
3
|
+
import { t as s } from "./admin-typed-confirm-dialog-B_00EHlT.js";
|
|
4
|
+
import { t as c } from "./admin-form-field-errors-Cuhy38F1.js";
|
|
5
|
+
import { n as l } from "./admin-confirm-DWq-edDC.js";
|
|
6
|
+
import { t as u } from "./admin-button-Bn4otsuw.js";
|
|
7
|
+
import { a as d, i as f, n as p, o as m, r as h, s as g, t as _ } from "./admin-dialog-CgYGInHi.js";
|
|
8
|
+
import { t as v } from "./admin-input-B_EUzCAE.js";
|
|
9
|
+
import { t as y } from "./admin-label-DQsOkp1p.js";
|
|
10
|
+
import { a as b, i as x, n as S, r as C, t as w } from "./admin-select-DSGCZFiZ.js";
|
|
11
|
+
import { a as T, n as E, o as D, r as O, s as k, t as A } from "./admin-table-DIKl2rpV.js";
|
|
12
|
+
import { a as j, i as M, n as N, r as ee, t as te } from "./admin-tabs-DR74xX0-.js";
|
|
13
|
+
import { h as ne, n as P, o as re, r as ie, s as ae, t as oe } from "./admin-format-D9Ablh0P.js";
|
|
14
|
+
import { r as F } from "./admin-dialog-width-C_WFpow0.js";
|
|
15
|
+
import { a as se, d as I, i as ce, n as le, u as ue } from "./admin-capabilities-DS-X-__V.js";
|
|
16
|
+
import { t as de } from "./admin-switch-aOiQQzST.js";
|
|
17
|
+
import * as L from "react";
|
|
18
|
+
import { useMutation as R, useQuery as z, useQueryClient as B } from "@tanstack/react-query";
|
|
19
|
+
import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
|
|
20
|
+
import { HugeiconsIcon as W } from "@hugeicons/react";
|
|
21
|
+
import { Add01Icon as fe, Cancel01Icon as pe, Delete02Icon as me } from "@hugeicons/core-free-icons";
|
|
22
|
+
import { useForm as G } from "@tanstack/react-form";
|
|
23
|
+
// src/admin/pages/settings/configuration-edit.ts
|
|
24
|
+
function K(e) {
|
|
25
|
+
let { toast: t, toastApiError: n, toastStaleEdit: r, adminMutations: o } = i(), [s, c] = L.useState(null), l = B(), u = R(o.updateMerchantConfiguration(l));
|
|
26
26
|
return {
|
|
27
27
|
editing: s !== null,
|
|
28
28
|
open: () => {
|
|
@@ -45,81 +45,79 @@ function Y(e) {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return !n || n.capabilities.features?.merchant_config_edits ? null : /* @__PURE__ */ G("p", {
|
|
48
|
+
// src/admin/pages/settings/setting-fields.tsx
|
|
49
|
+
function q() {
|
|
50
|
+
let { adminQueries: t } = i(), { data: n } = z(t.config());
|
|
51
|
+
return !n || n.capabilities.features?.merchant_config_edits ? null : /* @__PURE__ */ H("p", {
|
|
53
52
|
className: "rounded-md border px-3 py-2 text-sm text-muted-foreground",
|
|
54
|
-
children: /* @__PURE__ */
|
|
53
|
+
children: /* @__PURE__ */ H(e, { id: "Read-only: this merchant's configuration comes from a file. Change it there." })
|
|
55
54
|
});
|
|
56
55
|
}
|
|
57
|
-
function
|
|
58
|
-
return t ? n ? /* @__PURE__ */
|
|
56
|
+
function J({ edits: t, editing: n, form: r, saving: i, canSave: a = !0, onEdit: o, onCancel: s }) {
|
|
57
|
+
return t ? n ? /* @__PURE__ */ U("div", {
|
|
59
58
|
className: "flex items-center gap-2",
|
|
60
|
-
children: [/* @__PURE__ */
|
|
59
|
+
children: [/* @__PURE__ */ H(u, {
|
|
61
60
|
type: "button",
|
|
62
61
|
variant: "outline",
|
|
63
62
|
size: "sm",
|
|
64
63
|
disabled: i,
|
|
65
|
-
onClick:
|
|
66
|
-
children: /* @__PURE__ */
|
|
67
|
-
}), /* @__PURE__ */
|
|
64
|
+
onClick: s,
|
|
65
|
+
children: /* @__PURE__ */ H(e, { id: "Cancel" })
|
|
66
|
+
}), /* @__PURE__ */ H(u, {
|
|
68
67
|
type: "submit",
|
|
69
68
|
size: "sm",
|
|
70
69
|
form: r,
|
|
71
70
|
disabled: !a || i,
|
|
72
71
|
children: i ? "Saving…" : "Save"
|
|
73
72
|
})]
|
|
74
|
-
}) : /* @__PURE__ */
|
|
73
|
+
}) : /* @__PURE__ */ H(u, {
|
|
75
74
|
type: "button",
|
|
76
75
|
variant: "outline",
|
|
77
76
|
size: "sm",
|
|
78
|
-
onClick:
|
|
79
|
-
children: /* @__PURE__ */
|
|
77
|
+
onClick: o,
|
|
78
|
+
children: /* @__PURE__ */ H(e, { id: "Edit" })
|
|
80
79
|
}) : null;
|
|
81
80
|
}
|
|
82
|
-
function
|
|
83
|
-
return /* @__PURE__ */
|
|
81
|
+
function Y({ label: e, value: t }) {
|
|
82
|
+
return /* @__PURE__ */ U("div", {
|
|
84
83
|
className: "grid gap-1.5 md:grid-cols-[11rem_minmax(0,1fr)] md:gap-6",
|
|
85
|
-
children: [/* @__PURE__ */
|
|
84
|
+
children: [/* @__PURE__ */ H("dt", {
|
|
86
85
|
className: "text-sm text-muted-foreground",
|
|
87
86
|
children: e
|
|
88
|
-
}), /* @__PURE__ */
|
|
87
|
+
}), /* @__PURE__ */ H("dd", {
|
|
89
88
|
className: t ? "min-w-0 text-sm break-words" : "text-sm text-muted-foreground",
|
|
90
89
|
children: t || "Not set"
|
|
91
90
|
})]
|
|
92
91
|
});
|
|
93
92
|
}
|
|
94
|
-
function
|
|
93
|
+
function X({ label: e, id: n, children: r }) {
|
|
95
94
|
let { id: i } = t();
|
|
96
|
-
return /* @__PURE__ */
|
|
95
|
+
return /* @__PURE__ */ U("div", {
|
|
97
96
|
className: "grid gap-2 md:grid-cols-[11rem_minmax(0,1fr)] md:items-center md:gap-6",
|
|
98
|
-
children: [/* @__PURE__ */
|
|
97
|
+
children: [/* @__PURE__ */ H(y, {
|
|
99
98
|
htmlFor: i(n),
|
|
100
99
|
children: e
|
|
101
|
-
}), /* @__PURE__ */
|
|
100
|
+
}), /* @__PURE__ */ H("div", {
|
|
102
101
|
className: "min-w-0",
|
|
103
102
|
children: r
|
|
104
103
|
})]
|
|
105
104
|
});
|
|
106
105
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return /* @__PURE__ */ K("div", {
|
|
106
|
+
// src/admin/pages/settings/notifications.tsx
|
|
107
|
+
function he() {
|
|
108
|
+
let { adminQueries: t } = i(), n = z(t.merchantConfiguration("Load settings")), r = z(t.webhooks()), a = I(), o = r.data?.data ?? [];
|
|
109
|
+
return /* @__PURE__ */ U("div", {
|
|
112
110
|
className: "flex flex-col gap-10",
|
|
113
111
|
children: [
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
n.data ? /* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ H(q, {}),
|
|
113
|
+
n.data ? /* @__PURE__ */ H(ge, {
|
|
116
114
|
configuration: n.data,
|
|
117
115
|
edits: a
|
|
118
|
-
}) : /* @__PURE__ */
|
|
116
|
+
}) : /* @__PURE__ */ H("p", {
|
|
119
117
|
className: "text-sm text-muted-foreground",
|
|
120
|
-
children: /* @__PURE__ */
|
|
118
|
+
children: /* @__PURE__ */ H(e, { id: "Loading…" })
|
|
121
119
|
}),
|
|
122
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ H(ve, {
|
|
123
121
|
webhooks: o,
|
|
124
122
|
loading: r.isPending,
|
|
125
123
|
edits: a
|
|
@@ -127,48 +125,48 @@ function me() {
|
|
|
127
125
|
]
|
|
128
126
|
});
|
|
129
127
|
}
|
|
130
|
-
function
|
|
131
|
-
let { id: i, text: a } = t(), o = n.alert_email ?? "",
|
|
128
|
+
function ge({ configuration: n, edits: r }) {
|
|
129
|
+
let { id: i, text: a } = t(), o = n.alert_email ?? "", s = K(n), c = G({
|
|
132
130
|
defaultValues: { email: o },
|
|
133
|
-
onSubmit: ({ value: e }) =>
|
|
131
|
+
onSubmit: ({ value: e }) => s.save({ alert_email: e.email.trim() }, e.email.trim() ? "Alert email saved" : "Alert email cleared", "Save alert email")
|
|
134
132
|
});
|
|
135
|
-
return /* @__PURE__ */
|
|
133
|
+
return /* @__PURE__ */ U("section", {
|
|
136
134
|
className: "grid gap-5",
|
|
137
|
-
children: [/* @__PURE__ */
|
|
135
|
+
children: [/* @__PURE__ */ U("div", {
|
|
138
136
|
className: "flex flex-wrap items-start justify-between gap-4",
|
|
139
|
-
children: [/* @__PURE__ */
|
|
137
|
+
children: [/* @__PURE__ */ U("div", {
|
|
140
138
|
className: "grid gap-1",
|
|
141
|
-
children: [/* @__PURE__ */
|
|
139
|
+
children: [/* @__PURE__ */ H("h2", {
|
|
142
140
|
className: "text-base font-semibold",
|
|
143
|
-
children: /* @__PURE__ */
|
|
144
|
-
}), /* @__PURE__ */
|
|
141
|
+
children: /* @__PURE__ */ H(e, { id: "Email delivery" })
|
|
142
|
+
}), /* @__PURE__ */ H("p", {
|
|
145
143
|
className: "text-sm text-muted-foreground",
|
|
146
|
-
children: /* @__PURE__ */
|
|
144
|
+
children: /* @__PURE__ */ H(e, { id: "Send email alerts to this address." })
|
|
147
145
|
})]
|
|
148
|
-
}), /* @__PURE__ */
|
|
146
|
+
}), /* @__PURE__ */ H(c.Subscribe, {
|
|
149
147
|
selector: (e) => e.isSubmitting,
|
|
150
|
-
children: (e) => /* @__PURE__ */
|
|
148
|
+
children: (e) => /* @__PURE__ */ H(J, {
|
|
151
149
|
edits: r,
|
|
152
|
-
editing:
|
|
150
|
+
editing: s.editing,
|
|
153
151
|
form: "alert-email-form",
|
|
154
152
|
saving: e,
|
|
155
153
|
onEdit: () => {
|
|
156
|
-
|
|
154
|
+
c.reset({ email: o }), s.open();
|
|
157
155
|
},
|
|
158
|
-
onCancel:
|
|
156
|
+
onCancel: s.close
|
|
159
157
|
})
|
|
160
158
|
})]
|
|
161
|
-
}),
|
|
159
|
+
}), s.editing ? /* @__PURE__ */ H("form", {
|
|
162
160
|
id: i("alert-email-form"),
|
|
163
161
|
onSubmit: (e) => {
|
|
164
|
-
e.preventDefault(), e.stopPropagation(),
|
|
162
|
+
e.preventDefault(), e.stopPropagation(), c.handleSubmit();
|
|
165
163
|
},
|
|
166
|
-
children: /* @__PURE__ */
|
|
164
|
+
children: /* @__PURE__ */ H(c.Field, {
|
|
167
165
|
name: "email",
|
|
168
|
-
children: (e) => /* @__PURE__ */
|
|
166
|
+
children: (e) => /* @__PURE__ */ H(X, {
|
|
169
167
|
label: a("Alert email"),
|
|
170
168
|
id: "alert-email",
|
|
171
|
-
children: /* @__PURE__ */
|
|
169
|
+
children: /* @__PURE__ */ H(v, {
|
|
172
170
|
id: i("alert-email"),
|
|
173
171
|
type: "email",
|
|
174
172
|
placeholder: a("alerts@example.com"),
|
|
@@ -178,13 +176,13 @@ function he({ configuration: n, edits: r }) {
|
|
|
178
176
|
})
|
|
179
177
|
})
|
|
180
178
|
})
|
|
181
|
-
}) : /* @__PURE__ */
|
|
179
|
+
}) : /* @__PURE__ */ H("dl", { children: /* @__PURE__ */ H(Y, {
|
|
182
180
|
label: a("Alert email"),
|
|
183
181
|
value: o
|
|
184
182
|
}) })]
|
|
185
183
|
});
|
|
186
184
|
}
|
|
187
|
-
var
|
|
185
|
+
var _e = [
|
|
188
186
|
{
|
|
189
187
|
value: "generic",
|
|
190
188
|
label: "Generic (your own receiver)"
|
|
@@ -198,111 +196,111 @@ var ge = [
|
|
|
198
196
|
label: "Slack"
|
|
199
197
|
}
|
|
200
198
|
];
|
|
201
|
-
function
|
|
202
|
-
return /* @__PURE__ */
|
|
199
|
+
function ve({ webhooks: t, loading: n, edits: r }) {
|
|
200
|
+
return /* @__PURE__ */ U("section", {
|
|
203
201
|
className: "grid gap-5",
|
|
204
|
-
children: [/* @__PURE__ */
|
|
202
|
+
children: [/* @__PURE__ */ U("div", {
|
|
205
203
|
className: "flex flex-wrap items-start justify-between gap-4",
|
|
206
|
-
children: [/* @__PURE__ */
|
|
204
|
+
children: [/* @__PURE__ */ U("div", {
|
|
207
205
|
className: "grid max-w-2xl gap-1",
|
|
208
|
-
children: [/* @__PURE__ */
|
|
206
|
+
children: [/* @__PURE__ */ H("h2", {
|
|
209
207
|
className: "text-base font-semibold",
|
|
210
|
-
children: /* @__PURE__ */
|
|
211
|
-
}), /* @__PURE__ */
|
|
208
|
+
children: /* @__PURE__ */ H(e, { id: "Webhooks" })
|
|
209
|
+
}), /* @__PURE__ */ H("p", {
|
|
212
210
|
className: "text-sm text-pretty text-muted-foreground",
|
|
213
|
-
children: /* @__PURE__ */
|
|
211
|
+
children: /* @__PURE__ */ H(e, { id: "Send alerts to Discord, Slack, or your own endpoint." })
|
|
214
212
|
})]
|
|
215
|
-
}), r && /* @__PURE__ */
|
|
216
|
-
}), n ? /* @__PURE__ */
|
|
213
|
+
}), r && /* @__PURE__ */ H(be, {})]
|
|
214
|
+
}), n ? /* @__PURE__ */ H("p", {
|
|
217
215
|
className: "text-sm text-muted-foreground",
|
|
218
|
-
children: /* @__PURE__ */
|
|
219
|
-
}) : t.length === 0 ? /* @__PURE__ */
|
|
216
|
+
children: /* @__PURE__ */ H(e, { id: "Loading…" })
|
|
217
|
+
}) : t.length === 0 ? /* @__PURE__ */ H("p", {
|
|
220
218
|
className: "py-2 text-sm text-muted-foreground",
|
|
221
|
-
children: /* @__PURE__ */
|
|
222
|
-
}) : /* @__PURE__ */
|
|
219
|
+
children: /* @__PURE__ */ H(e, { id: "No webhooks configured." })
|
|
220
|
+
}) : /* @__PURE__ */ U(A, {
|
|
223
221
|
className: "min-w-[36rem]",
|
|
224
|
-
children: [/* @__PURE__ */
|
|
222
|
+
children: [/* @__PURE__ */ H(D, { children: /* @__PURE__ */ U(k, {
|
|
225
223
|
className: "hover:bg-transparent",
|
|
226
224
|
children: [
|
|
227
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ H(T, {
|
|
228
226
|
className: "text-muted-foreground",
|
|
229
|
-
children: /* @__PURE__ */
|
|
227
|
+
children: /* @__PURE__ */ H(e, { id: "Name" })
|
|
230
228
|
}),
|
|
231
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ H(T, {
|
|
232
230
|
className: "text-muted-foreground",
|
|
233
|
-
children: /* @__PURE__ */
|
|
231
|
+
children: /* @__PURE__ */ H(e, { id: "Format" })
|
|
234
232
|
}),
|
|
235
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ H(T, {
|
|
236
234
|
className: "text-muted-foreground",
|
|
237
235
|
children: "URL"
|
|
238
236
|
}),
|
|
239
|
-
r && /* @__PURE__ */
|
|
237
|
+
r && /* @__PURE__ */ H(T, {
|
|
240
238
|
className: "text-right text-muted-foreground",
|
|
241
|
-
children: /* @__PURE__ */
|
|
239
|
+
children: /* @__PURE__ */ H(e, { id: "Action" })
|
|
242
240
|
})
|
|
243
241
|
]
|
|
244
|
-
}) }), /* @__PURE__ */
|
|
242
|
+
}) }), /* @__PURE__ */ H(E, { children: t.map((e) => /* @__PURE__ */ H(ye, {
|
|
245
243
|
webhook: e,
|
|
246
244
|
edits: r
|
|
247
245
|
}, e.id)) })]
|
|
248
246
|
})]
|
|
249
247
|
});
|
|
250
248
|
}
|
|
251
|
-
function
|
|
252
|
-
let { toast: a, toastApiError:
|
|
253
|
-
return /* @__PURE__ */
|
|
249
|
+
function ye({ webhook: n, edits: r }) {
|
|
250
|
+
let { toast: a, toastApiError: c, adminMutations: l } = i(), { text: d } = t(), [f, p] = L.useState(!1), m = B(), h = R(l.deleteWebhook(m)), g = n.name ?? n.destination_host;
|
|
251
|
+
return /* @__PURE__ */ U(k, {
|
|
254
252
|
className: n.enabled ? void 0 : "opacity-60",
|
|
255
253
|
children: [
|
|
256
|
-
/* @__PURE__ */
|
|
254
|
+
/* @__PURE__ */ H(O, {
|
|
257
255
|
className: "py-3 font-medium",
|
|
258
|
-
children:
|
|
256
|
+
children: g
|
|
259
257
|
}),
|
|
260
|
-
/* @__PURE__ */
|
|
258
|
+
/* @__PURE__ */ H(O, {
|
|
261
259
|
className: "py-3",
|
|
262
|
-
children: /* @__PURE__ */
|
|
260
|
+
children: /* @__PURE__ */ U("span", {
|
|
263
261
|
className: "flex flex-wrap gap-1",
|
|
264
|
-
children: [/* @__PURE__ */
|
|
262
|
+
children: [/* @__PURE__ */ H(o, {
|
|
265
263
|
variant: "secondary",
|
|
266
264
|
children: n.format
|
|
267
|
-
}), !n.enabled && /* @__PURE__ */
|
|
265
|
+
}), !n.enabled && /* @__PURE__ */ H(o, {
|
|
268
266
|
variant: "outline",
|
|
269
|
-
children: /* @__PURE__ */
|
|
267
|
+
children: /* @__PURE__ */ H(e, { id: "disabled" })
|
|
270
268
|
})]
|
|
271
269
|
})
|
|
272
270
|
}),
|
|
273
|
-
/* @__PURE__ */
|
|
271
|
+
/* @__PURE__ */ H(O, {
|
|
274
272
|
className: "max-w-[22rem] truncate py-3 text-xs text-muted-foreground",
|
|
275
273
|
title: n.destination_host,
|
|
276
274
|
children: n.destination_host
|
|
277
275
|
}),
|
|
278
|
-
r && /* @__PURE__ */
|
|
276
|
+
r && /* @__PURE__ */ H(O, {
|
|
279
277
|
className: "py-3 text-right",
|
|
280
|
-
children: /* @__PURE__ */
|
|
278
|
+
children: /* @__PURE__ */ U("div", {
|
|
281
279
|
className: "flex justify-end gap-1",
|
|
282
280
|
children: [
|
|
283
|
-
/* @__PURE__ */
|
|
284
|
-
/* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ H(be, { webhook: n }),
|
|
282
|
+
/* @__PURE__ */ H(u, {
|
|
285
283
|
variant: "ghost",
|
|
286
284
|
size: "icon",
|
|
287
|
-
"aria-label":
|
|
288
|
-
onClick: () =>
|
|
289
|
-
children: /* @__PURE__ */
|
|
290
|
-
icon:
|
|
285
|
+
"aria-label": d("Delete webhook"),
|
|
286
|
+
onClick: () => p(!0),
|
|
287
|
+
children: /* @__PURE__ */ H(W, {
|
|
288
|
+
icon: me,
|
|
291
289
|
className: "size-4 text-muted-foreground"
|
|
292
290
|
})
|
|
293
291
|
}),
|
|
294
|
-
/* @__PURE__ */
|
|
295
|
-
open:
|
|
296
|
-
onOpenChange:
|
|
297
|
-
title: `Delete "${
|
|
298
|
-
description:
|
|
292
|
+
/* @__PURE__ */ H(s, {
|
|
293
|
+
open: f,
|
|
294
|
+
onOpenChange: p,
|
|
295
|
+
title: `Delete "${g}"?`,
|
|
296
|
+
description: d("Operational notifications will stop delivering to this webhook. This cannot be undone."),
|
|
299
297
|
confirmationWord: "DELETE",
|
|
300
298
|
actionLabel: "Delete webhook",
|
|
301
299
|
onConfirm: async () => {
|
|
302
300
|
try {
|
|
303
|
-
await
|
|
301
|
+
await h.mutateAsync(n.id), a.success("Webhook deleted");
|
|
304
302
|
} catch (e) {
|
|
305
|
-
|
|
303
|
+
c(e, "Delete webhook");
|
|
306
304
|
}
|
|
307
305
|
}
|
|
308
306
|
})
|
|
@@ -312,18 +310,18 @@ function ve({ webhook: n, edits: r }) {
|
|
|
312
310
|
]
|
|
313
311
|
});
|
|
314
312
|
}
|
|
315
|
-
function
|
|
316
|
-
let { toast: r, toastApiError: a, adminMutations:
|
|
313
|
+
function be({ webhook: n }) {
|
|
314
|
+
let { toast: r, toastApiError: a, adminMutations: o } = i(), { id: s, text: l } = t(), [T, E] = L.useState(!1), D = B(), O = R(o.createWebhook(D)), k = R(o.updateWebhook(D)), A = () => ({
|
|
317
315
|
name: n?.name ?? "",
|
|
318
316
|
url: "",
|
|
319
317
|
format: n?.format ?? "generic",
|
|
320
318
|
enabled: n?.enabled ?? !0
|
|
321
|
-
}),
|
|
322
|
-
defaultValues:
|
|
319
|
+
}), j = G({
|
|
320
|
+
defaultValues: A(),
|
|
323
321
|
onSubmit: async ({ value: e }) => {
|
|
324
322
|
let t = e.url.trim();
|
|
325
323
|
try {
|
|
326
|
-
n ? await
|
|
324
|
+
n ? await k.mutateAsync({
|
|
327
325
|
id: n.id,
|
|
328
326
|
webhook: {
|
|
329
327
|
name: e.name.trim() || null,
|
|
@@ -331,86 +329,86 @@ function ye({ webhook: n }) {
|
|
|
331
329
|
enabled: e.enabled,
|
|
332
330
|
...t ? { url: t } : {}
|
|
333
331
|
}
|
|
334
|
-
}) : await
|
|
332
|
+
}) : await O.mutateAsync({
|
|
335
333
|
name: e.name.trim(),
|
|
336
334
|
url: t,
|
|
337
335
|
format: e.format
|
|
338
|
-
}), r.success(n ? "Webhook saved" : "Webhook added"),
|
|
336
|
+
}), r.success(n ? "Webhook saved" : "Webhook added"), M(!1);
|
|
339
337
|
} catch (e) {
|
|
340
338
|
a(e, n ? "Save webhook" : "Add webhook");
|
|
341
339
|
}
|
|
342
340
|
}
|
|
343
|
-
}),
|
|
344
|
-
e ?
|
|
341
|
+
}), M = (e) => {
|
|
342
|
+
e ? j.reset(A()) : j.reset(), E(e);
|
|
345
343
|
};
|
|
346
|
-
return /* @__PURE__ */
|
|
347
|
-
open:
|
|
348
|
-
onOpenChange:
|
|
349
|
-
children: [/* @__PURE__ */
|
|
344
|
+
return /* @__PURE__ */ U(_, {
|
|
345
|
+
open: T,
|
|
346
|
+
onOpenChange: M,
|
|
347
|
+
children: [/* @__PURE__ */ H(g, { render: /* @__PURE__ */ U(u, {
|
|
350
348
|
size: "sm",
|
|
351
349
|
variant: "outline",
|
|
352
350
|
children: [
|
|
353
|
-
!n && /* @__PURE__ */
|
|
354
|
-
icon:
|
|
351
|
+
!n && /* @__PURE__ */ H(W, {
|
|
352
|
+
icon: fe,
|
|
355
353
|
className: "size-4"
|
|
356
354
|
}),
|
|
357
355
|
" ",
|
|
358
356
|
n ? "Edit" : "Add webhook"
|
|
359
357
|
]
|
|
360
|
-
}) }), /* @__PURE__ */
|
|
361
|
-
className:
|
|
362
|
-
children: [/* @__PURE__ */
|
|
358
|
+
}) }), /* @__PURE__ */ U(p, {
|
|
359
|
+
className: F,
|
|
360
|
+
children: [/* @__PURE__ */ U(d, { children: [/* @__PURE__ */ H(m, { children: n ? `Edit ${n.name ?? n.destination_host}` : "Add webhook" }), /* @__PURE__ */ H(h, { 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__ */ U("form", {
|
|
363
361
|
onSubmit: (e) => {
|
|
364
|
-
e.preventDefault(), e.stopPropagation(),
|
|
362
|
+
e.preventDefault(), e.stopPropagation(), j.handleSubmit();
|
|
365
363
|
},
|
|
366
364
|
className: "grid gap-4",
|
|
367
|
-
children: [/* @__PURE__ */
|
|
365
|
+
children: [/* @__PURE__ */ U("div", {
|
|
368
366
|
className: "grid gap-3",
|
|
369
367
|
children: [
|
|
370
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ H(j.Field, {
|
|
371
369
|
name: "name",
|
|
372
370
|
validators: { onChange: ({ value: e }) => n || e.trim() ? void 0 : "Enter a webhook name" },
|
|
373
|
-
children: (t) => /* @__PURE__ */
|
|
371
|
+
children: (t) => /* @__PURE__ */ U("div", {
|
|
374
372
|
className: "grid gap-1.5",
|
|
375
373
|
children: [
|
|
376
|
-
/* @__PURE__ */
|
|
377
|
-
htmlFor:
|
|
378
|
-
children: /* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ H(y, {
|
|
375
|
+
htmlFor: s("wh-name"),
|
|
376
|
+
children: /* @__PURE__ */ H(e, { id: "Name" })
|
|
379
377
|
}),
|
|
380
|
-
/* @__PURE__ */
|
|
381
|
-
id:
|
|
382
|
-
placeholder:
|
|
378
|
+
/* @__PURE__ */ H(v, {
|
|
379
|
+
id: s("wh-name"),
|
|
380
|
+
placeholder: l("e.g. #billing-alerts"),
|
|
383
381
|
value: t.state.value,
|
|
384
382
|
onBlur: t.handleBlur,
|
|
385
383
|
onChange: (e) => t.handleChange(e.target.value),
|
|
386
384
|
"aria-invalid": t.state.meta.errors.length > 0
|
|
387
385
|
}),
|
|
388
|
-
/* @__PURE__ */
|
|
386
|
+
/* @__PURE__ */ H(c, { errors: t.state.meta.errors })
|
|
389
387
|
]
|
|
390
388
|
})
|
|
391
389
|
}),
|
|
392
|
-
/* @__PURE__ */
|
|
390
|
+
/* @__PURE__ */ H(j.Field, {
|
|
393
391
|
name: "format",
|
|
394
|
-
children: (t) => /* @__PURE__ */
|
|
392
|
+
children: (t) => /* @__PURE__ */ U("div", {
|
|
395
393
|
className: "grid gap-1.5",
|
|
396
|
-
children: [/* @__PURE__ */
|
|
397
|
-
htmlFor:
|
|
398
|
-
children: /* @__PURE__ */
|
|
399
|
-
}), /* @__PURE__ */
|
|
394
|
+
children: [/* @__PURE__ */ H(y, {
|
|
395
|
+
htmlFor: s("wh-format"),
|
|
396
|
+
children: /* @__PURE__ */ H(e, { id: "Format" })
|
|
397
|
+
}), /* @__PURE__ */ U(w, {
|
|
400
398
|
value: t.state.value,
|
|
401
399
|
onValueChange: (e) => t.handleChange(e),
|
|
402
|
-
children: [/* @__PURE__ */
|
|
403
|
-
id:
|
|
400
|
+
children: [/* @__PURE__ */ H(x, {
|
|
401
|
+
id: s("wh-format"),
|
|
404
402
|
className: "w-full",
|
|
405
|
-
children: /* @__PURE__ */
|
|
406
|
-
}), /* @__PURE__ */
|
|
403
|
+
children: /* @__PURE__ */ H(b, {})
|
|
404
|
+
}), /* @__PURE__ */ H(S, { children: _e.map((e) => /* @__PURE__ */ H(C, {
|
|
407
405
|
value: e.value,
|
|
408
406
|
children: e.label
|
|
409
407
|
}, e.value)) })]
|
|
410
408
|
})]
|
|
411
409
|
})
|
|
412
410
|
}),
|
|
413
|
-
/* @__PURE__ */
|
|
411
|
+
/* @__PURE__ */ H(j.Field, {
|
|
414
412
|
name: "url",
|
|
415
413
|
validators: { onChange: ({ value: e }) => {
|
|
416
414
|
if (!e.trim()) return n ? void 0 : "Enter a webhook URL";
|
|
@@ -421,15 +419,15 @@ function ye({ webhook: n }) {
|
|
|
421
419
|
return "Enter a valid webhook URL";
|
|
422
420
|
}
|
|
423
421
|
} },
|
|
424
|
-
children: (t) => /* @__PURE__ */
|
|
422
|
+
children: (t) => /* @__PURE__ */ U("div", {
|
|
425
423
|
className: "grid gap-1.5",
|
|
426
424
|
children: [
|
|
427
|
-
/* @__PURE__ */
|
|
428
|
-
htmlFor:
|
|
429
|
-
children: /* @__PURE__ */
|
|
425
|
+
/* @__PURE__ */ H(y, {
|
|
426
|
+
htmlFor: s("wh-url"),
|
|
427
|
+
children: /* @__PURE__ */ H(e, { id: "Webhook URL" })
|
|
430
428
|
}),
|
|
431
|
-
/* @__PURE__ */
|
|
432
|
-
id:
|
|
429
|
+
/* @__PURE__ */ H(v, {
|
|
430
|
+
id: s("wh-url"),
|
|
433
431
|
type: "url",
|
|
434
432
|
autoComplete: "off",
|
|
435
433
|
className: "text-xs",
|
|
@@ -439,26 +437,26 @@ function ye({ webhook: n }) {
|
|
|
439
437
|
onChange: (e) => t.handleChange(e.target.value),
|
|
440
438
|
"aria-invalid": t.state.meta.errors.length > 0
|
|
441
439
|
}),
|
|
442
|
-
/* @__PURE__ */
|
|
440
|
+
/* @__PURE__ */ H(c, { errors: t.state.meta.errors })
|
|
443
441
|
]
|
|
444
442
|
})
|
|
445
443
|
}),
|
|
446
|
-
n && /* @__PURE__ */
|
|
444
|
+
n && /* @__PURE__ */ H(j.Field, {
|
|
447
445
|
name: "enabled",
|
|
448
|
-
children: (t) => /* @__PURE__ */
|
|
446
|
+
children: (t) => /* @__PURE__ */ U("div", {
|
|
449
447
|
className: "flex items-center gap-2",
|
|
450
|
-
children: [/* @__PURE__ */
|
|
451
|
-
id:
|
|
448
|
+
children: [/* @__PURE__ */ H(de, {
|
|
449
|
+
id: s("wh-enabled"),
|
|
452
450
|
checked: t.state.value,
|
|
453
451
|
onCheckedChange: t.handleChange
|
|
454
|
-
}), /* @__PURE__ */
|
|
455
|
-
htmlFor:
|
|
456
|
-
children: /* @__PURE__ */
|
|
452
|
+
}), /* @__PURE__ */ H(y, {
|
|
453
|
+
htmlFor: s("wh-enabled"),
|
|
454
|
+
children: /* @__PURE__ */ H(e, { id: "Enabled" })
|
|
457
455
|
})]
|
|
458
456
|
})
|
|
459
457
|
})
|
|
460
458
|
]
|
|
461
|
-
}), /* @__PURE__ */
|
|
459
|
+
}), /* @__PURE__ */ H(f, { children: /* @__PURE__ */ H(j.Subscribe, {
|
|
462
460
|
selector: (e) => [
|
|
463
461
|
e.values.name,
|
|
464
462
|
e.values.url,
|
|
@@ -466,7 +464,7 @@ function ye({ webhook: n }) {
|
|
|
466
464
|
e.canSubmit,
|
|
467
465
|
e.isSubmitting
|
|
468
466
|
],
|
|
469
|
-
children: ([e, t, r, i, a]) => /* @__PURE__ */
|
|
467
|
+
children: ([e, t, r, i, a]) => /* @__PURE__ */ H(u, {
|
|
470
468
|
type: "submit",
|
|
471
469
|
disabled: (n ? !r : !e.trim() || !t.trim()) || !i || a,
|
|
472
470
|
children: a ? "Saving…" : n ? "Save" : "Add webhook"
|
|
@@ -476,15 +474,14 @@ function ye({ webhook: n }) {
|
|
|
476
474
|
})]
|
|
477
475
|
});
|
|
478
476
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
queryKey: s,
|
|
477
|
+
// src/admin/pages/settings/custody.tsx
|
|
478
|
+
function xe() {
|
|
479
|
+
let e = i(), t = B(), n = I(), r = z(e.adminQueries.merchantConfiguration()), a = z(e.adminQueries.psps()), o = [...e.queryKeys.settings(), "custodians"], s = z({
|
|
480
|
+
queryKey: o,
|
|
484
481
|
queryFn: ({ signal: t }) => e.listCustodians(t)
|
|
485
|
-
}), [
|
|
482
|
+
}), [c, l] = L.useState(null), [d] = L.useState(() => e.selectedMerchant()), f = () => t.invalidateQueries({ queryKey: e.queryKeys.settings() }), p = R({
|
|
486
483
|
mutationFn: async ({ psp: t, custody: n }) => {
|
|
487
|
-
if (
|
|
484
|
+
if (d !== e.selectedMerchant()) throw Error("Merchant changed; reopen settings");
|
|
488
485
|
let r = a.data?.data.find((e) => e.id === t);
|
|
489
486
|
if (!r) throw Error("PSP is no longer available");
|
|
490
487
|
return e.updatePSP(t, {
|
|
@@ -492,43 +489,43 @@ function be() {
|
|
|
492
489
|
custodian: n
|
|
493
490
|
});
|
|
494
491
|
},
|
|
495
|
-
onSuccess:
|
|
492
|
+
onSuccess: f,
|
|
496
493
|
onError: (t) => e.toastApiError(t, "Change card custody")
|
|
497
|
-
}),
|
|
494
|
+
}), m = R({
|
|
498
495
|
mutationFn: async (t) => {
|
|
499
|
-
if (!r.data ||
|
|
496
|
+
if (!r.data || d !== e.selectedMerchant()) throw Error("Merchant changed; reopen settings");
|
|
500
497
|
return e.updateMerchantConfiguration({
|
|
501
498
|
expected_revision: r.data.revision,
|
|
502
499
|
card_vault: String(t.get("card_vault") ?? ""),
|
|
503
500
|
charge_psps: t.getAll("charge_psps").map(String)
|
|
504
501
|
});
|
|
505
502
|
},
|
|
506
|
-
onSuccess:
|
|
503
|
+
onSuccess: f,
|
|
507
504
|
onError: (t) => e.toastApiError(t, "Save card routing")
|
|
508
505
|
});
|
|
509
|
-
if (!r.data || !a.data || !
|
|
510
|
-
let
|
|
511
|
-
return /* @__PURE__ */
|
|
506
|
+
if (!r.data || !a.data || !s.data) return null;
|
|
507
|
+
let h = a.data.data.filter((e) => !e.archived && (e.rail === "nmi" || e.rail === "stripe"));
|
|
508
|
+
return /* @__PURE__ */ U("section", {
|
|
512
509
|
className: "grid gap-5",
|
|
513
510
|
"aria-label": "Card vaults",
|
|
514
511
|
children: [
|
|
515
|
-
/* @__PURE__ */
|
|
512
|
+
/* @__PURE__ */ U("div", { children: [/* @__PURE__ */ H("h2", {
|
|
516
513
|
className: "text-base font-semibold",
|
|
517
514
|
children: "Card vaults"
|
|
518
|
-
}), /* @__PURE__ */
|
|
515
|
+
}), /* @__PURE__ */ H("p", {
|
|
519
516
|
className: "text-sm text-muted-foreground",
|
|
520
517
|
children: "Choose where new cards are stored and which accounts charge them. Existing cards and subscriptions keep their accepted custody."
|
|
521
518
|
})] }),
|
|
522
|
-
/* @__PURE__ */
|
|
519
|
+
/* @__PURE__ */ H("ul", {
|
|
523
520
|
className: "grid gap-2",
|
|
524
|
-
children:
|
|
521
|
+
children: s.data.data.map((e) => /* @__PURE__ */ U("li", {
|
|
525
522
|
className: "flex flex-wrap items-center justify-between gap-3 rounded border p-3",
|
|
526
|
-
children: [/* @__PURE__ */
|
|
527
|
-
/* @__PURE__ */
|
|
523
|
+
children: [/* @__PURE__ */ U("div", { children: [
|
|
524
|
+
/* @__PURE__ */ H("strong", { children: e.key }),
|
|
528
525
|
" · Basis Theory · ",
|
|
529
526
|
e.environment,
|
|
530
|
-
/* @__PURE__ */
|
|
531
|
-
/* @__PURE__ */
|
|
527
|
+
/* @__PURE__ */ H("br", {}),
|
|
528
|
+
/* @__PURE__ */ U("span", {
|
|
532
529
|
className: "text-sm text-muted-foreground",
|
|
533
530
|
children: [
|
|
534
531
|
e.account_id,
|
|
@@ -537,72 +534,72 @@ function be() {
|
|
|
537
534
|
e.credentials?.api_key?.configured ? "Credential configured" : "Credential missing"
|
|
538
535
|
]
|
|
539
536
|
})
|
|
540
|
-
] }), n && !e.archived && /* @__PURE__ */
|
|
537
|
+
] }), n && !e.archived && /* @__PURE__ */ H(u, {
|
|
541
538
|
size: "sm",
|
|
542
539
|
variant: "outline",
|
|
543
|
-
onClick: () =>
|
|
540
|
+
onClick: () => l(e),
|
|
544
541
|
children: "Edit vault"
|
|
545
542
|
})]
|
|
546
543
|
}, e.key))
|
|
547
544
|
}),
|
|
548
|
-
n && /* @__PURE__ */
|
|
545
|
+
n && /* @__PURE__ */ H(u, {
|
|
549
546
|
className: "justify-self-start",
|
|
550
547
|
variant: "outline",
|
|
551
|
-
onClick: () =>
|
|
548
|
+
onClick: () => l("new"),
|
|
552
549
|
children: "Add Basis Theory vault"
|
|
553
550
|
}),
|
|
554
|
-
|
|
555
|
-
current:
|
|
556
|
-
close: () =>
|
|
557
|
-
saved:
|
|
558
|
-
},
|
|
559
|
-
|
|
551
|
+
c && /* @__PURE__ */ H(Se, {
|
|
552
|
+
current: c === "new" ? void 0 : c,
|
|
553
|
+
close: () => l(null),
|
|
554
|
+
saved: f
|
|
555
|
+
}, c === "new" ? "new" : `${c.key}:${c.revision}`),
|
|
556
|
+
h.filter((e) => e.rail === "nmi").map((e) => /* @__PURE__ */ U(y, {
|
|
560
557
|
className: "grid gap-2",
|
|
561
558
|
children: [
|
|
562
559
|
e.key,
|
|
563
560
|
": card storage",
|
|
564
|
-
/* @__PURE__ */
|
|
561
|
+
/* @__PURE__ */ U("select", {
|
|
565
562
|
className: "rounded border bg-background p-2",
|
|
566
563
|
"aria-label": `${e.key} card storage`,
|
|
567
|
-
disabled: !n ||
|
|
564
|
+
disabled: !n || p.isPending,
|
|
568
565
|
value: e.custodian ?? "",
|
|
569
|
-
onChange: (t) =>
|
|
566
|
+
onChange: (t) => p.mutate({
|
|
570
567
|
psp: e.id,
|
|
571
568
|
custody: t.target.value
|
|
572
569
|
}),
|
|
573
|
-
children: [/* @__PURE__ */
|
|
570
|
+
children: [/* @__PURE__ */ H("option", {
|
|
574
571
|
value: "",
|
|
575
572
|
children: "NMI customer vault"
|
|
576
|
-
}),
|
|
573
|
+
}), s.data.data.filter((t) => !t.archived && t.environment === e.environment).map((e) => /* @__PURE__ */ U("option", {
|
|
577
574
|
value: e.key,
|
|
578
575
|
children: [e.key, " · Basis Theory"]
|
|
579
576
|
}, e.key))]
|
|
580
577
|
})
|
|
581
578
|
]
|
|
582
579
|
}, e.id)),
|
|
583
|
-
/* @__PURE__ */
|
|
580
|
+
/* @__PURE__ */ U("form", {
|
|
584
581
|
className: "grid gap-3",
|
|
585
582
|
onSubmit: (e) => {
|
|
586
|
-
e.preventDefault(),
|
|
583
|
+
e.preventDefault(), m.mutate(new FormData(e.currentTarget));
|
|
587
584
|
},
|
|
588
585
|
children: [
|
|
589
|
-
/* @__PURE__ */
|
|
586
|
+
/* @__PURE__ */ U(y, {
|
|
590
587
|
className: "grid gap-2",
|
|
591
|
-
children: ["Vault for new cards", /* @__PURE__ */
|
|
588
|
+
children: ["Vault for new cards", /* @__PURE__ */ U("select", {
|
|
592
589
|
name: "card_vault",
|
|
593
590
|
className: "rounded border bg-background p-2",
|
|
594
591
|
defaultValue: r.data.card_vault ?? "",
|
|
595
592
|
disabled: !n,
|
|
596
593
|
children: [
|
|
597
|
-
/* @__PURE__ */
|
|
594
|
+
/* @__PURE__ */ H("option", {
|
|
598
595
|
value: "",
|
|
599
596
|
children: "No card vault selected"
|
|
600
597
|
}),
|
|
601
|
-
r.data.platform_vault.available && /* @__PURE__ */
|
|
598
|
+
r.data.platform_vault.available && /* @__PURE__ */ H("option", {
|
|
602
599
|
value: "platform",
|
|
603
600
|
children: "Hosted vault · isolated to this merchant"
|
|
604
601
|
}),
|
|
605
|
-
|
|
602
|
+
h.map((e) => /* @__PURE__ */ U("option", {
|
|
606
603
|
value: e.key,
|
|
607
604
|
children: [
|
|
608
605
|
e.key,
|
|
@@ -614,21 +611,21 @@ function be() {
|
|
|
614
611
|
]
|
|
615
612
|
})]
|
|
616
613
|
}),
|
|
617
|
-
/* @__PURE__ */
|
|
614
|
+
/* @__PURE__ */ U("fieldset", {
|
|
618
615
|
className: "grid gap-2",
|
|
619
616
|
disabled: !n,
|
|
620
617
|
children: [
|
|
621
|
-
/* @__PURE__ */
|
|
618
|
+
/* @__PURE__ */ H("legend", {
|
|
622
619
|
className: "mb-2 font-medium",
|
|
623
620
|
children: "Charge PSPs"
|
|
624
621
|
}),
|
|
625
|
-
/* @__PURE__ */
|
|
622
|
+
/* @__PURE__ */ H("p", {
|
|
626
623
|
className: "text-sm text-muted-foreground",
|
|
627
624
|
children: "Select the accounts allowed for new charges. With none selected, routing considers all eligible accounts."
|
|
628
625
|
}),
|
|
629
|
-
|
|
626
|
+
h.map((e) => /* @__PURE__ */ U(y, {
|
|
630
627
|
className: "flex gap-2",
|
|
631
|
-
children: [/* @__PURE__ */
|
|
628
|
+
children: [/* @__PURE__ */ H("input", {
|
|
632
629
|
type: "checkbox",
|
|
633
630
|
name: "charge_psps",
|
|
634
631
|
value: e.key,
|
|
@@ -637,9 +634,9 @@ function be() {
|
|
|
637
634
|
}, e.id))
|
|
638
635
|
]
|
|
639
636
|
}),
|
|
640
|
-
n && /* @__PURE__ */
|
|
637
|
+
n && /* @__PURE__ */ H(u, {
|
|
641
638
|
className: "justify-self-start",
|
|
642
|
-
disabled:
|
|
639
|
+
disabled: m.isPending,
|
|
643
640
|
type: "submit",
|
|
644
641
|
children: "Save card routing"
|
|
645
642
|
})
|
|
@@ -648,8 +645,8 @@ function be() {
|
|
|
648
645
|
]
|
|
649
646
|
});
|
|
650
647
|
}
|
|
651
|
-
function
|
|
652
|
-
let r = i(), [a] =
|
|
648
|
+
function Se({ current: e, close: t, saved: n }) {
|
|
649
|
+
let r = i(), [a] = L.useState(() => r.selectedMerchant()), o = R({
|
|
653
650
|
mutationFn: async (t) => {
|
|
654
651
|
if (a !== r.selectedMerchant()) throw Error("Merchant changed; reopen this form");
|
|
655
652
|
let n = String(t.get("private_key") ?? "").trim();
|
|
@@ -670,75 +667,75 @@ function xe({ current: e, close: t, saved: n }) {
|
|
|
670
667
|
},
|
|
671
668
|
onError: (e) => r.toastApiError(e, "Configure vault")
|
|
672
669
|
});
|
|
673
|
-
return /* @__PURE__ */
|
|
670
|
+
return /* @__PURE__ */ U("form", {
|
|
674
671
|
className: "grid gap-3 rounded border p-4",
|
|
675
672
|
onSubmit: (e) => {
|
|
676
|
-
e.preventDefault(),
|
|
673
|
+
e.preventDefault(), o.mutate(new FormData(e.currentTarget));
|
|
677
674
|
},
|
|
678
675
|
children: [
|
|
679
|
-
/* @__PURE__ */
|
|
676
|
+
/* @__PURE__ */ H("h3", {
|
|
680
677
|
className: "font-medium",
|
|
681
678
|
children: e ? `Edit ${e.key}` : "Add Basis Theory vault"
|
|
682
679
|
}),
|
|
683
|
-
!e && /* @__PURE__ */
|
|
684
|
-
/* @__PURE__ */
|
|
680
|
+
!e && /* @__PURE__ */ U(V, { children: [
|
|
681
|
+
/* @__PURE__ */ U(y, {
|
|
685
682
|
className: "grid gap-1",
|
|
686
|
-
children: ["Vault key", /* @__PURE__ */
|
|
683
|
+
children: ["Vault key", /* @__PURE__ */ H(v, {
|
|
687
684
|
name: "key",
|
|
688
685
|
required: !0,
|
|
689
686
|
pattern: "[a-z0-9_-]{1,63}"
|
|
690
687
|
})]
|
|
691
688
|
}),
|
|
692
|
-
/* @__PURE__ */
|
|
689
|
+
/* @__PURE__ */ U(y, {
|
|
693
690
|
className: "grid gap-1",
|
|
694
|
-
children: ["Environment", /* @__PURE__ */
|
|
691
|
+
children: ["Environment", /* @__PURE__ */ U("select", {
|
|
695
692
|
name: "environment",
|
|
696
693
|
className: "rounded border bg-background p-2",
|
|
697
|
-
children: [/* @__PURE__ */
|
|
694
|
+
children: [/* @__PURE__ */ H("option", {
|
|
698
695
|
value: "test",
|
|
699
696
|
children: "Test"
|
|
700
|
-
}), /* @__PURE__ */
|
|
697
|
+
}), /* @__PURE__ */ H("option", {
|
|
701
698
|
value: "live",
|
|
702
699
|
children: "Live"
|
|
703
700
|
})]
|
|
704
701
|
})]
|
|
705
702
|
}),
|
|
706
|
-
/* @__PURE__ */
|
|
703
|
+
/* @__PURE__ */ U(y, {
|
|
707
704
|
className: "grid gap-1",
|
|
708
|
-
children: ["Basis Theory tenant ID", /* @__PURE__ */
|
|
705
|
+
children: ["Basis Theory tenant ID", /* @__PURE__ */ H(v, {
|
|
709
706
|
name: "account_id",
|
|
710
707
|
required: !0
|
|
711
708
|
})]
|
|
712
709
|
})
|
|
713
710
|
] }),
|
|
714
|
-
/* @__PURE__ */
|
|
711
|
+
/* @__PURE__ */ U(y, {
|
|
715
712
|
className: "grid gap-1",
|
|
716
|
-
children: ["Public collection key", /* @__PURE__ */
|
|
713
|
+
children: ["Public collection key", /* @__PURE__ */ H(v, {
|
|
717
714
|
name: "public_key",
|
|
718
715
|
required: !0,
|
|
719
716
|
defaultValue: String(e?.settings?.public_api_key ?? "")
|
|
720
717
|
})]
|
|
721
718
|
}),
|
|
722
|
-
/* @__PURE__ */
|
|
719
|
+
/* @__PURE__ */ U(y, {
|
|
723
720
|
className: "grid gap-1",
|
|
724
|
-
children: ["Private API key", /* @__PURE__ */
|
|
721
|
+
children: ["Private API key", /* @__PURE__ */ H(v, {
|
|
725
722
|
type: "password",
|
|
726
723
|
name: "private_key",
|
|
727
724
|
autoComplete: "new-password",
|
|
728
725
|
required: !e
|
|
729
726
|
})]
|
|
730
727
|
}),
|
|
731
|
-
/* @__PURE__ */
|
|
728
|
+
/* @__PURE__ */ H("p", {
|
|
732
729
|
className: "text-sm text-muted-foreground",
|
|
733
730
|
children: "Use a key that can read its application, manage the merchant’s card tokens and invoke the proxy. Existing credentials stay unchanged when left blank."
|
|
734
731
|
}),
|
|
735
|
-
/* @__PURE__ */
|
|
732
|
+
/* @__PURE__ */ U("div", {
|
|
736
733
|
className: "flex gap-2",
|
|
737
|
-
children: [/* @__PURE__ */
|
|
734
|
+
children: [/* @__PURE__ */ H(u, {
|
|
738
735
|
type: "submit",
|
|
739
|
-
disabled:
|
|
736
|
+
disabled: o.isPending,
|
|
740
737
|
children: "Validate and save vault"
|
|
741
|
-
}), /* @__PURE__ */
|
|
738
|
+
}), /* @__PURE__ */ H(u, {
|
|
742
739
|
type: "button",
|
|
743
740
|
variant: "outline",
|
|
744
741
|
onClick: t,
|
|
@@ -748,106 +745,105 @@ function xe({ current: e, close: t, saved: n }) {
|
|
|
748
745
|
]
|
|
749
746
|
});
|
|
750
747
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
value: p,
|
|
748
|
+
// src/admin/pages/settings/index.tsx
|
|
749
|
+
var Z = "h-8 flex-none px-0 after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-primary pointer-coarse:h-10";
|
|
750
|
+
function Ce() {
|
|
751
|
+
let [t, i] = r(), a = ue(), o = ce(), s = n().props.settingsTabs ?? [], c = s.map((e) => e.value), l = le(null, a, o, c), u = le(t.get("tab"), a, o, c);
|
|
752
|
+
return /* @__PURE__ */ U(te, {
|
|
753
|
+
value: u,
|
|
758
754
|
onValueChange: (e) => {
|
|
759
755
|
let n = new URLSearchParams(t);
|
|
760
756
|
!e || e === l ? n.delete("tab") : n.set("tab", e), i(n);
|
|
761
757
|
},
|
|
762
758
|
className: "flex flex-col gap-4",
|
|
763
759
|
children: [
|
|
764
|
-
/* @__PURE__ */
|
|
760
|
+
/* @__PURE__ */ H("div", {
|
|
765
761
|
className: "overflow-x-auto",
|
|
766
|
-
children: /* @__PURE__ */
|
|
762
|
+
children: /* @__PURE__ */ U(ee, {
|
|
767
763
|
variant: "line",
|
|
768
764
|
className: "w-max min-w-full justify-start gap-6 rounded-none p-0",
|
|
769
765
|
children: [
|
|
770
|
-
a && /* @__PURE__ */
|
|
766
|
+
a && /* @__PURE__ */ H(M, {
|
|
771
767
|
value: "merchant",
|
|
772
|
-
className:
|
|
773
|
-
children: /* @__PURE__ */
|
|
768
|
+
className: Z,
|
|
769
|
+
children: /* @__PURE__ */ H(e, { id: "Merchant" })
|
|
774
770
|
}),
|
|
775
|
-
a && /* @__PURE__ */
|
|
771
|
+
a && /* @__PURE__ */ H(M, {
|
|
776
772
|
value: "notifications",
|
|
777
|
-
className:
|
|
778
|
-
children: /* @__PURE__ */
|
|
773
|
+
className: Z,
|
|
774
|
+
children: /* @__PURE__ */ H(e, { id: "Notifications" })
|
|
779
775
|
}),
|
|
780
|
-
a && /* @__PURE__ */
|
|
776
|
+
a && /* @__PURE__ */ H(M, {
|
|
781
777
|
value: "psps",
|
|
782
|
-
className:
|
|
783
|
-
children: /* @__PURE__ */
|
|
778
|
+
className: Z,
|
|
779
|
+
children: /* @__PURE__ */ H(e, { id: "PSPs" })
|
|
784
780
|
}),
|
|
785
|
-
o && /* @__PURE__ */
|
|
781
|
+
o && /* @__PURE__ */ H(M, {
|
|
786
782
|
value: "customer-controls",
|
|
787
|
-
className:
|
|
788
|
-
children: /* @__PURE__ */
|
|
783
|
+
className: Z,
|
|
784
|
+
children: /* @__PURE__ */ H(e, { id: "Customer controls" })
|
|
789
785
|
}),
|
|
790
|
-
s.map((e) => /* @__PURE__ */
|
|
786
|
+
s.map((e) => /* @__PURE__ */ H(M, {
|
|
791
787
|
value: e.value,
|
|
792
|
-
className:
|
|
788
|
+
className: Z,
|
|
793
789
|
children: e.title
|
|
794
790
|
}, e.value))
|
|
795
791
|
]
|
|
796
792
|
})
|
|
797
793
|
}),
|
|
798
|
-
a && /* @__PURE__ */
|
|
794
|
+
a && /* @__PURE__ */ H(N, {
|
|
799
795
|
value: "merchant",
|
|
800
|
-
children: /* @__PURE__ */
|
|
796
|
+
children: /* @__PURE__ */ H(we, {})
|
|
801
797
|
}),
|
|
802
|
-
a && /* @__PURE__ */
|
|
798
|
+
a && /* @__PURE__ */ H(N, {
|
|
803
799
|
value: "notifications",
|
|
804
|
-
children: /* @__PURE__ */
|
|
800
|
+
children: /* @__PURE__ */ H(he, {})
|
|
805
801
|
}),
|
|
806
|
-
a && /* @__PURE__ */
|
|
802
|
+
a && /* @__PURE__ */ H(N, {
|
|
807
803
|
value: "psps",
|
|
808
|
-
children: /* @__PURE__ */
|
|
804
|
+
children: /* @__PURE__ */ H(De, {})
|
|
809
805
|
}),
|
|
810
|
-
o && /* @__PURE__ */
|
|
806
|
+
o && /* @__PURE__ */ H(N, {
|
|
811
807
|
value: "customer-controls",
|
|
812
|
-
children: /* @__PURE__ */
|
|
808
|
+
children: /* @__PURE__ */ H(Re, {})
|
|
813
809
|
}),
|
|
814
|
-
s.map((e) => /* @__PURE__ */
|
|
810
|
+
s.map((e) => /* @__PURE__ */ H(N, {
|
|
815
811
|
value: e.value,
|
|
816
812
|
children: e.element
|
|
817
813
|
}, e.value))
|
|
818
814
|
]
|
|
819
815
|
});
|
|
820
816
|
}
|
|
821
|
-
function
|
|
822
|
-
let { adminQueries: t } = i(), { data: n } =
|
|
823
|
-
return n ? /* @__PURE__ */
|
|
817
|
+
function we() {
|
|
818
|
+
let { adminQueries: t } = i(), { data: n } = z(t.merchantConfiguration("Load settings")), r = I();
|
|
819
|
+
return n ? /* @__PURE__ */ U("div", {
|
|
824
820
|
className: "grid gap-10",
|
|
825
821
|
children: [
|
|
826
|
-
/* @__PURE__ */
|
|
827
|
-
/* @__PURE__ */
|
|
822
|
+
/* @__PURE__ */ H(q, {}),
|
|
823
|
+
/* @__PURE__ */ H(Te, {
|
|
828
824
|
configuration: n,
|
|
829
825
|
edits: r
|
|
830
826
|
}),
|
|
831
|
-
/* @__PURE__ */
|
|
827
|
+
/* @__PURE__ */ H(Ee, {
|
|
832
828
|
configuration: n,
|
|
833
829
|
edits: r
|
|
834
830
|
})
|
|
835
831
|
]
|
|
836
|
-
}) : /* @__PURE__ */
|
|
832
|
+
}) : /* @__PURE__ */ H("p", {
|
|
837
833
|
className: "text-sm text-muted-foreground",
|
|
838
|
-
children: /* @__PURE__ */
|
|
834
|
+
children: /* @__PURE__ */ H(e, { id: "Loading…" })
|
|
839
835
|
});
|
|
840
836
|
}
|
|
841
|
-
function
|
|
842
|
-
let { id: i, text: a } = t(), o = n.profile,
|
|
837
|
+
function Te({ configuration: n, edits: r }) {
|
|
838
|
+
let { id: i, text: a } = t(), o = n.profile, s = () => ({
|
|
843
839
|
displayName: n.display_name,
|
|
844
840
|
fromEmail: o?.from_email ?? "",
|
|
845
841
|
supportURL: o?.support_url ?? "",
|
|
846
842
|
subscribeURL: o?.subscribe_url ?? "",
|
|
847
843
|
billingURL: o?.billing_url ?? "",
|
|
848
844
|
logoURL: o?.logo_url ?? ""
|
|
849
|
-
}), l =
|
|
850
|
-
defaultValues:
|
|
845
|
+
}), l = K(n), u = G({
|
|
846
|
+
defaultValues: s(),
|
|
851
847
|
onSubmit: ({ value: e }) => l.save({
|
|
852
848
|
display_name: e.displayName.trim(),
|
|
853
849
|
profile: {
|
|
@@ -859,65 +855,65 @@ function we({ configuration: n, edits: r }) {
|
|
|
859
855
|
}
|
|
860
856
|
}, "Profile saved", "Save profile")
|
|
861
857
|
});
|
|
862
|
-
return /* @__PURE__ */
|
|
858
|
+
return /* @__PURE__ */ U("section", {
|
|
863
859
|
className: "grid gap-5",
|
|
864
|
-
children: [/* @__PURE__ */
|
|
860
|
+
children: [/* @__PURE__ */ U("div", {
|
|
865
861
|
className: "flex flex-wrap items-start justify-between gap-4",
|
|
866
|
-
children: [/* @__PURE__ */
|
|
862
|
+
children: [/* @__PURE__ */ U("div", {
|
|
867
863
|
className: "grid gap-1",
|
|
868
|
-
children: [/* @__PURE__ */
|
|
864
|
+
children: [/* @__PURE__ */ H("h2", {
|
|
869
865
|
className: "text-base font-semibold",
|
|
870
|
-
children: /* @__PURE__ */
|
|
871
|
-
}), /* @__PURE__ */
|
|
866
|
+
children: /* @__PURE__ */ H(e, { id: "Merchant profile" })
|
|
867
|
+
}), /* @__PURE__ */ H("p", {
|
|
872
868
|
className: "text-sm text-pretty text-muted-foreground",
|
|
873
|
-
children: /* @__PURE__ */
|
|
869
|
+
children: /* @__PURE__ */ H(e, { id: "Customer-facing merchant details used on invoices and emails." })
|
|
874
870
|
})]
|
|
875
|
-
}), /* @__PURE__ */
|
|
871
|
+
}), /* @__PURE__ */ H(u.Subscribe, {
|
|
876
872
|
selector: (e) => [e.canSubmit, e.isSubmitting],
|
|
877
|
-
children: ([e, t]) => /* @__PURE__ */
|
|
873
|
+
children: ([e, t]) => /* @__PURE__ */ H(J, {
|
|
878
874
|
edits: r,
|
|
879
875
|
editing: l.editing,
|
|
880
876
|
form: "merchant-profile-form",
|
|
881
877
|
saving: t,
|
|
882
878
|
canSave: e,
|
|
883
879
|
onEdit: () => {
|
|
884
|
-
u.reset(
|
|
880
|
+
u.reset(s()), l.open();
|
|
885
881
|
},
|
|
886
882
|
onCancel: l.close
|
|
887
883
|
})
|
|
888
884
|
})]
|
|
889
|
-
}), l.editing ? /* @__PURE__ */
|
|
885
|
+
}), l.editing ? /* @__PURE__ */ U("form", {
|
|
890
886
|
id: i("merchant-profile-form"),
|
|
891
887
|
onSubmit: (e) => {
|
|
892
888
|
e.preventDefault(), e.stopPropagation(), u.handleSubmit();
|
|
893
889
|
},
|
|
894
890
|
className: "grid gap-4",
|
|
895
891
|
children: [
|
|
896
|
-
/* @__PURE__ */
|
|
892
|
+
/* @__PURE__ */ H(u.Field, {
|
|
897
893
|
name: "displayName",
|
|
898
894
|
validators: { onChange: ({ value: e }) => e.trim() ? void 0 : "Enter the merchant's name" },
|
|
899
|
-
children: (e) => /* @__PURE__ */
|
|
895
|
+
children: (e) => /* @__PURE__ */ H(X, {
|
|
900
896
|
label: a("Display name"),
|
|
901
897
|
id: "s-name",
|
|
902
|
-
children: /* @__PURE__ */
|
|
898
|
+
children: /* @__PURE__ */ U("div", {
|
|
903
899
|
className: "grid gap-1.5",
|
|
904
|
-
children: [/* @__PURE__ */
|
|
900
|
+
children: [/* @__PURE__ */ H(v, {
|
|
905
901
|
id: i("s-name"),
|
|
906
902
|
value: e.state.value,
|
|
907
903
|
onBlur: e.handleBlur,
|
|
908
904
|
onChange: (t) => e.handleChange(t.target.value),
|
|
909
905
|
autoComplete: "organization",
|
|
910
906
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
911
|
-
}), /* @__PURE__ */
|
|
907
|
+
}), /* @__PURE__ */ H(c, { errors: e.state.meta.errors })]
|
|
912
908
|
})
|
|
913
909
|
})
|
|
914
910
|
}),
|
|
915
|
-
/* @__PURE__ */
|
|
911
|
+
/* @__PURE__ */ H(u.Field, {
|
|
916
912
|
name: "fromEmail",
|
|
917
|
-
children: (e) => /* @__PURE__ */
|
|
913
|
+
children: (e) => /* @__PURE__ */ H(X, {
|
|
918
914
|
label: a("From email"),
|
|
919
915
|
id: "s-email",
|
|
920
|
-
children: /* @__PURE__ */
|
|
916
|
+
children: /* @__PURE__ */ H(v, {
|
|
921
917
|
id: i("s-email"),
|
|
922
918
|
type: "email",
|
|
923
919
|
value: e.state.value,
|
|
@@ -927,12 +923,12 @@ function we({ configuration: n, edits: r }) {
|
|
|
927
923
|
})
|
|
928
924
|
})
|
|
929
925
|
}),
|
|
930
|
-
/* @__PURE__ */
|
|
926
|
+
/* @__PURE__ */ H(u.Field, {
|
|
931
927
|
name: "supportURL",
|
|
932
|
-
children: (e) => /* @__PURE__ */
|
|
928
|
+
children: (e) => /* @__PURE__ */ H(X, {
|
|
933
929
|
label: a("Support URL"),
|
|
934
930
|
id: "s-support",
|
|
935
|
-
children: /* @__PURE__ */
|
|
931
|
+
children: /* @__PURE__ */ H(v, {
|
|
936
932
|
id: i("s-support"),
|
|
937
933
|
type: "url",
|
|
938
934
|
value: e.state.value,
|
|
@@ -942,12 +938,12 @@ function we({ configuration: n, edits: r }) {
|
|
|
942
938
|
})
|
|
943
939
|
})
|
|
944
940
|
}),
|
|
945
|
-
/* @__PURE__ */
|
|
941
|
+
/* @__PURE__ */ H(u.Field, {
|
|
946
942
|
name: "subscribeURL",
|
|
947
|
-
children: (e) => /* @__PURE__ */
|
|
943
|
+
children: (e) => /* @__PURE__ */ H(X, {
|
|
948
944
|
label: a("Subscribe URL"),
|
|
949
945
|
id: "s-subscribe",
|
|
950
|
-
children: /* @__PURE__ */
|
|
946
|
+
children: /* @__PURE__ */ H(v, {
|
|
951
947
|
id: i("s-subscribe"),
|
|
952
948
|
type: "url",
|
|
953
949
|
value: e.state.value,
|
|
@@ -957,12 +953,12 @@ function we({ configuration: n, edits: r }) {
|
|
|
957
953
|
})
|
|
958
954
|
})
|
|
959
955
|
}),
|
|
960
|
-
/* @__PURE__ */
|
|
956
|
+
/* @__PURE__ */ H(u.Field, {
|
|
961
957
|
name: "billingURL",
|
|
962
|
-
children: (e) => /* @__PURE__ */
|
|
958
|
+
children: (e) => /* @__PURE__ */ H(X, {
|
|
963
959
|
label: a("Billing URL"),
|
|
964
960
|
id: "s-billing",
|
|
965
|
-
children: /* @__PURE__ */
|
|
961
|
+
children: /* @__PURE__ */ H(v, {
|
|
966
962
|
id: i("s-billing"),
|
|
967
963
|
type: "url",
|
|
968
964
|
value: e.state.value,
|
|
@@ -972,12 +968,12 @@ function we({ configuration: n, edits: r }) {
|
|
|
972
968
|
})
|
|
973
969
|
})
|
|
974
970
|
}),
|
|
975
|
-
/* @__PURE__ */
|
|
971
|
+
/* @__PURE__ */ H(u.Field, {
|
|
976
972
|
name: "logoURL",
|
|
977
|
-
children: (e) => /* @__PURE__ */
|
|
973
|
+
children: (e) => /* @__PURE__ */ H(X, {
|
|
978
974
|
label: a("Logo URL"),
|
|
979
975
|
id: "s-logo",
|
|
980
|
-
children: /* @__PURE__ */
|
|
976
|
+
children: /* @__PURE__ */ H(v, {
|
|
981
977
|
id: i("s-logo"),
|
|
982
978
|
type: "url",
|
|
983
979
|
value: e.state.value,
|
|
@@ -988,30 +984,30 @@ function we({ configuration: n, edits: r }) {
|
|
|
988
984
|
})
|
|
989
985
|
})
|
|
990
986
|
]
|
|
991
|
-
}) : /* @__PURE__ */
|
|
987
|
+
}) : /* @__PURE__ */ U("dl", {
|
|
992
988
|
className: "grid gap-4",
|
|
993
989
|
children: [
|
|
994
|
-
/* @__PURE__ */
|
|
990
|
+
/* @__PURE__ */ H(Y, {
|
|
995
991
|
label: a("Display name"),
|
|
996
992
|
value: n.display_name
|
|
997
993
|
}),
|
|
998
|
-
/* @__PURE__ */
|
|
994
|
+
/* @__PURE__ */ H(Y, {
|
|
999
995
|
label: a("From email"),
|
|
1000
996
|
value: o?.from_email
|
|
1001
997
|
}),
|
|
1002
|
-
/* @__PURE__ */
|
|
998
|
+
/* @__PURE__ */ H(Y, {
|
|
1003
999
|
label: a("Support URL"),
|
|
1004
1000
|
value: o?.support_url
|
|
1005
1001
|
}),
|
|
1006
|
-
/* @__PURE__ */
|
|
1002
|
+
/* @__PURE__ */ H(Y, {
|
|
1007
1003
|
label: a("Subscribe URL"),
|
|
1008
1004
|
value: o?.subscribe_url
|
|
1009
1005
|
}),
|
|
1010
|
-
/* @__PURE__ */
|
|
1006
|
+
/* @__PURE__ */ H(Y, {
|
|
1011
1007
|
label: a("Billing URL"),
|
|
1012
1008
|
value: o?.billing_url
|
|
1013
1009
|
}),
|
|
1014
|
-
/* @__PURE__ */
|
|
1010
|
+
/* @__PURE__ */ H(Y, {
|
|
1015
1011
|
label: a("Logo URL"),
|
|
1016
1012
|
value: o?.logo_url
|
|
1017
1013
|
})
|
|
@@ -1019,55 +1015,55 @@ function we({ configuration: n, edits: r }) {
|
|
|
1019
1015
|
})]
|
|
1020
1016
|
});
|
|
1021
1017
|
}
|
|
1022
|
-
function
|
|
1023
|
-
let { id: i, text: a } = t(), o = n.reprice_notice_window_days ?? 30,
|
|
1018
|
+
function Ee({ configuration: n, edits: r }) {
|
|
1019
|
+
let { id: i, text: a } = t(), o = n.reprice_notice_window_days ?? 30, s = K(n), l = G({
|
|
1024
1020
|
defaultValues: { days: String(o) },
|
|
1025
|
-
onSubmit: ({ value: e }) =>
|
|
1021
|
+
onSubmit: ({ value: e }) => s.save({ reprice_notice_window_days: Number(e.days) }, "Notice window saved", "Save notice window")
|
|
1026
1022
|
});
|
|
1027
|
-
return /* @__PURE__ */
|
|
1023
|
+
return /* @__PURE__ */ U("section", {
|
|
1028
1024
|
className: "grid gap-5",
|
|
1029
|
-
children: [/* @__PURE__ */
|
|
1025
|
+
children: [/* @__PURE__ */ U("div", {
|
|
1030
1026
|
className: "flex flex-wrap items-start justify-between gap-4",
|
|
1031
|
-
children: [/* @__PURE__ */
|
|
1027
|
+
children: [/* @__PURE__ */ U("div", {
|
|
1032
1028
|
className: "grid max-w-2xl gap-1",
|
|
1033
|
-
children: [/* @__PURE__ */
|
|
1029
|
+
children: [/* @__PURE__ */ H("h2", {
|
|
1034
1030
|
className: "text-base font-semibold",
|
|
1035
|
-
children: /* @__PURE__ */
|
|
1036
|
-
}), /* @__PURE__ */
|
|
1031
|
+
children: /* @__PURE__ */ H(e, { id: "Pricing policies" })
|
|
1032
|
+
}), /* @__PURE__ */ H("p", {
|
|
1037
1033
|
className: "text-sm text-pretty text-muted-foreground",
|
|
1038
|
-
children: /* @__PURE__ */
|
|
1034
|
+
children: /* @__PURE__ */ H(e, { id: "Set how much notice customers receive before a price increase." })
|
|
1039
1035
|
})]
|
|
1040
|
-
}), /* @__PURE__ */
|
|
1036
|
+
}), /* @__PURE__ */ H(l.Subscribe, {
|
|
1041
1037
|
selector: (e) => [e.canSubmit, e.isSubmitting],
|
|
1042
|
-
children: ([e, t]) => /* @__PURE__ */
|
|
1038
|
+
children: ([e, t]) => /* @__PURE__ */ H(J, {
|
|
1043
1039
|
edits: r,
|
|
1044
|
-
editing:
|
|
1040
|
+
editing: s.editing,
|
|
1045
1041
|
form: "notice-window-form",
|
|
1046
1042
|
saving: t,
|
|
1047
1043
|
canSave: e,
|
|
1048
1044
|
onEdit: () => {
|
|
1049
|
-
l.reset({ days: String(o) }),
|
|
1045
|
+
l.reset({ days: String(o) }), s.open();
|
|
1050
1046
|
},
|
|
1051
|
-
onCancel:
|
|
1047
|
+
onCancel: s.close
|
|
1052
1048
|
})
|
|
1053
1049
|
})]
|
|
1054
|
-
}),
|
|
1050
|
+
}), s.editing ? /* @__PURE__ */ H("form", {
|
|
1055
1051
|
id: i("notice-window-form"),
|
|
1056
1052
|
onSubmit: (e) => {
|
|
1057
1053
|
e.preventDefault(), e.stopPropagation(), l.handleSubmit();
|
|
1058
1054
|
},
|
|
1059
|
-
children: /* @__PURE__ */
|
|
1055
|
+
children: /* @__PURE__ */ H(l.Field, {
|
|
1060
1056
|
name: "days",
|
|
1061
1057
|
validators: { onChange: ({ value: e }) => {
|
|
1062
1058
|
let t = Number(e);
|
|
1063
1059
|
return e.trim() && Number.isInteger(t) && t >= 0 ? void 0 : "Enter a whole number of days";
|
|
1064
1060
|
} },
|
|
1065
|
-
children: (e) => /* @__PURE__ */
|
|
1061
|
+
children: (e) => /* @__PURE__ */ H(X, {
|
|
1066
1062
|
label: a("Notice period (days)"),
|
|
1067
1063
|
id: "s-notice-window",
|
|
1068
|
-
children: /* @__PURE__ */
|
|
1064
|
+
children: /* @__PURE__ */ U("div", {
|
|
1069
1065
|
className: "grid gap-1.5",
|
|
1070
|
-
children: [/* @__PURE__ */
|
|
1066
|
+
children: [/* @__PURE__ */ H(v, {
|
|
1071
1067
|
id: i("s-notice-window"),
|
|
1072
1068
|
type: "number",
|
|
1073
1069
|
step: "1",
|
|
@@ -1076,193 +1072,193 @@ function Te({ configuration: n, edits: r }) {
|
|
|
1076
1072
|
onBlur: e.handleBlur,
|
|
1077
1073
|
onChange: (t) => e.handleChange(t.target.value),
|
|
1078
1074
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
1079
|
-
}), /* @__PURE__ */
|
|
1075
|
+
}), /* @__PURE__ */ H(c, { errors: e.state.meta.errors })]
|
|
1080
1076
|
})
|
|
1081
1077
|
})
|
|
1082
1078
|
})
|
|
1083
|
-
}) : /* @__PURE__ */
|
|
1079
|
+
}) : /* @__PURE__ */ H("dl", { children: /* @__PURE__ */ H(Y, {
|
|
1084
1080
|
label: a("Notice period"),
|
|
1085
1081
|
value: `${o} ${o === 1 ? "day" : "days"}`
|
|
1086
1082
|
}) })]
|
|
1087
1083
|
});
|
|
1088
1084
|
}
|
|
1089
|
-
function
|
|
1090
|
-
let { selectedMerchant: t, adminQueries: n } = i(), r =
|
|
1091
|
-
if (r.isPending || a.isPending) return /* @__PURE__ */
|
|
1085
|
+
function De() {
|
|
1086
|
+
let { selectedMerchant: t, adminQueries: n } = i(), r = z(n.psps()), a = z(n.rails()), o = I();
|
|
1087
|
+
if (r.isPending || a.isPending) return /* @__PURE__ */ H("p", {
|
|
1092
1088
|
className: "text-sm text-muted-foreground",
|
|
1093
|
-
children: /* @__PURE__ */
|
|
1089
|
+
children: /* @__PURE__ */ H(e, { id: "Loading…" })
|
|
1094
1090
|
});
|
|
1095
1091
|
let s = a.data ?? [];
|
|
1096
|
-
return /* @__PURE__ */
|
|
1092
|
+
return /* @__PURE__ */ U("div", {
|
|
1097
1093
|
className: "grid gap-6",
|
|
1098
1094
|
children: [
|
|
1099
|
-
/* @__PURE__ */
|
|
1100
|
-
/* @__PURE__ */
|
|
1095
|
+
/* @__PURE__ */ H(q, {}),
|
|
1096
|
+
/* @__PURE__ */ U("section", {
|
|
1101
1097
|
className: "grid gap-5",
|
|
1102
|
-
children: [/* @__PURE__ */
|
|
1098
|
+
children: [/* @__PURE__ */ U("div", {
|
|
1103
1099
|
className: "flex flex-wrap items-start justify-between gap-4",
|
|
1104
|
-
children: [/* @__PURE__ */
|
|
1100
|
+
children: [/* @__PURE__ */ U("div", {
|
|
1105
1101
|
className: "grid gap-1",
|
|
1106
|
-
children: [/* @__PURE__ */
|
|
1102
|
+
children: [/* @__PURE__ */ H("h2", {
|
|
1107
1103
|
className: "text-base font-semibold",
|
|
1108
|
-
children: /* @__PURE__ */
|
|
1109
|
-
}), /* @__PURE__ */
|
|
1104
|
+
children: /* @__PURE__ */ H(e, { id: "PSPs" })
|
|
1105
|
+
}), /* @__PURE__ */ H("p", {
|
|
1110
1106
|
className: "text-sm text-muted-foreground",
|
|
1111
|
-
children: /* @__PURE__ */
|
|
1107
|
+
children: /* @__PURE__ */ H(e, { id: "The accounts this merchant takes payments through, one or more per rail." })
|
|
1112
1108
|
})]
|
|
1113
|
-
}), o && /* @__PURE__ */
|
|
1114
|
-
}), r.data?.data?.length ? /* @__PURE__ */
|
|
1109
|
+
}), o && /* @__PURE__ */ H(Le, { railDefinitions: s }, t() ?? "")]
|
|
1110
|
+
}), r.data?.data?.length ? /* @__PURE__ */ U(A, {
|
|
1115
1111
|
className: "min-w-[44rem]",
|
|
1116
|
-
children: [/* @__PURE__ */
|
|
1112
|
+
children: [/* @__PURE__ */ H(D, { children: /* @__PURE__ */ U(k, {
|
|
1117
1113
|
className: "hover:bg-transparent",
|
|
1118
1114
|
children: [
|
|
1119
|
-
/* @__PURE__ */
|
|
1115
|
+
/* @__PURE__ */ H(T, {
|
|
1120
1116
|
className: "text-muted-foreground",
|
|
1121
1117
|
children: "PSP"
|
|
1122
1118
|
}),
|
|
1123
|
-
/* @__PURE__ */
|
|
1119
|
+
/* @__PURE__ */ H(T, {
|
|
1124
1120
|
className: "text-muted-foreground",
|
|
1125
|
-
children: /* @__PURE__ */
|
|
1121
|
+
children: /* @__PURE__ */ H(e, { id: "Environment" })
|
|
1126
1122
|
}),
|
|
1127
|
-
/* @__PURE__ */
|
|
1123
|
+
/* @__PURE__ */ H(T, {
|
|
1128
1124
|
className: "text-muted-foreground",
|
|
1129
|
-
children: /* @__PURE__ */
|
|
1125
|
+
children: /* @__PURE__ */ H(e, { id: "Credentials" })
|
|
1130
1126
|
}),
|
|
1131
|
-
/* @__PURE__ */
|
|
1127
|
+
/* @__PURE__ */ H(T, {
|
|
1132
1128
|
className: "text-muted-foreground",
|
|
1133
|
-
children: /* @__PURE__ */
|
|
1129
|
+
children: /* @__PURE__ */ H(e, { id: "State" })
|
|
1134
1130
|
}),
|
|
1135
|
-
o && /* @__PURE__ */
|
|
1131
|
+
o && /* @__PURE__ */ H(T, {
|
|
1136
1132
|
className: "text-right text-muted-foreground",
|
|
1137
|
-
children: /* @__PURE__ */
|
|
1133
|
+
children: /* @__PURE__ */ H(e, { id: "Action" })
|
|
1138
1134
|
})
|
|
1139
1135
|
]
|
|
1140
|
-
}) }), /* @__PURE__ */
|
|
1136
|
+
}) }), /* @__PURE__ */ H(E, { children: r.data.data.map((e) => /* @__PURE__ */ H(ke, {
|
|
1141
1137
|
psp: e,
|
|
1142
1138
|
railDefinitions: s,
|
|
1143
1139
|
edits: o
|
|
1144
1140
|
}, e.id)) })]
|
|
1145
|
-
}) : /* @__PURE__ */
|
|
1141
|
+
}) : /* @__PURE__ */ H("p", {
|
|
1146
1142
|
className: "py-2 text-sm text-muted-foreground",
|
|
1147
|
-
children: /* @__PURE__ */
|
|
1143
|
+
children: /* @__PURE__ */ H(e, { id: "No PSPs configured." })
|
|
1148
1144
|
})]
|
|
1149
1145
|
}),
|
|
1150
|
-
/* @__PURE__ */
|
|
1146
|
+
/* @__PURE__ */ H(xe, {})
|
|
1151
1147
|
]
|
|
1152
1148
|
});
|
|
1153
1149
|
}
|
|
1154
|
-
function
|
|
1155
|
-
return e.validated_at ? `Validated ${
|
|
1150
|
+
function Oe(e) {
|
|
1151
|
+
return e.validated_at ? `Validated ${re(e.validated_at)}` : e.configured ? "Configured" : "Not configured";
|
|
1156
1152
|
}
|
|
1157
|
-
function
|
|
1158
|
-
let { toast:
|
|
1159
|
-
if (
|
|
1153
|
+
function ke({ psp: n, railDefinitions: r, edits: c }) {
|
|
1154
|
+
let { toast: d, toastApiError: f, toastStaleEdit: p, adminMutations: m, selectedMerchant: h } = i(), { text: g } = t(), _ = B(), v = R(m.updatePSP(_)), [y, b] = L.useState(!1), x = l(), S = r.find((e) => e.rail === n.rail), C = S?.display_name ?? n.rail, w = n.credentials ?? {}, T = async (e) => {
|
|
1155
|
+
if (e || await x({
|
|
1160
1156
|
title: `Archive ${n.key}?`,
|
|
1161
1157
|
description: "New purchase stops routing to it. Existing subscriptions, refunds and webhooks keep using it.",
|
|
1162
1158
|
confirmLabel: "Archive PSP"
|
|
1163
|
-
}))
|
|
1164
|
-
await
|
|
1159
|
+
})) try {
|
|
1160
|
+
await v.mutateAsync({
|
|
1165
1161
|
id: n.id,
|
|
1166
1162
|
psp: {
|
|
1167
1163
|
archived: !0,
|
|
1168
1164
|
expected_revision: n.revision,
|
|
1169
1165
|
...e ? { allow_last: !0 } : {}
|
|
1170
1166
|
}
|
|
1171
|
-
}),
|
|
1167
|
+
}), d.success("PSP archived");
|
|
1172
1168
|
} catch (t) {
|
|
1173
1169
|
if (t instanceof a && t.code === "psp_last_active") {
|
|
1174
|
-
e ?
|
|
1170
|
+
e ? f(t, "Archive PSP") : b(!0);
|
|
1175
1171
|
return;
|
|
1176
1172
|
}
|
|
1177
1173
|
if (t instanceof a && t.revisionMismatch) {
|
|
1178
|
-
|
|
1174
|
+
p(`PSP ${n.key}`);
|
|
1179
1175
|
return;
|
|
1180
1176
|
}
|
|
1181
|
-
|
|
1177
|
+
f(t, "Archive PSP");
|
|
1182
1178
|
}
|
|
1183
1179
|
};
|
|
1184
|
-
return /* @__PURE__ */
|
|
1180
|
+
return /* @__PURE__ */ U(k, {
|
|
1185
1181
|
className: n.archived ? "opacity-60" : void 0,
|
|
1186
1182
|
children: [
|
|
1187
|
-
/* @__PURE__ */
|
|
1183
|
+
/* @__PURE__ */ H(O, {
|
|
1188
1184
|
className: "py-3",
|
|
1189
|
-
children: /* @__PURE__ */
|
|
1185
|
+
children: /* @__PURE__ */ U("div", {
|
|
1190
1186
|
className: "grid min-w-0 leading-tight",
|
|
1191
|
-
children: [/* @__PURE__ */
|
|
1187
|
+
children: [/* @__PURE__ */ H("span", {
|
|
1192
1188
|
className: "font-medium",
|
|
1193
1189
|
children: n.key
|
|
1194
|
-
}), /* @__PURE__ */
|
|
1190
|
+
}), /* @__PURE__ */ U("span", {
|
|
1195
1191
|
className: "truncate text-xs text-muted-foreground",
|
|
1196
1192
|
children: [
|
|
1197
|
-
|
|
1193
|
+
C,
|
|
1198
1194
|
" · ",
|
|
1199
|
-
|
|
1195
|
+
Me(n)
|
|
1200
1196
|
]
|
|
1201
1197
|
})]
|
|
1202
1198
|
})
|
|
1203
1199
|
}),
|
|
1204
|
-
/* @__PURE__ */
|
|
1200
|
+
/* @__PURE__ */ H(O, {
|
|
1205
1201
|
className: "py-3 capitalize",
|
|
1206
1202
|
children: n.environment
|
|
1207
1203
|
}),
|
|
1208
|
-
/* @__PURE__ */
|
|
1204
|
+
/* @__PURE__ */ H(O, {
|
|
1209
1205
|
className: "py-3",
|
|
1210
|
-
children: Object.keys(
|
|
1206
|
+
children: Object.keys(w).length > 0 ? /* @__PURE__ */ H("span", {
|
|
1211
1207
|
className: "flex flex-wrap gap-1",
|
|
1212
|
-
children: Object.entries(
|
|
1208
|
+
children: Object.entries(w).map(([e, t]) => /* @__PURE__ */ H(o, {
|
|
1213
1209
|
variant: "secondary",
|
|
1214
1210
|
className: t.configured ? "" : "bg-held-surface text-held",
|
|
1215
|
-
title:
|
|
1211
|
+
title: Oe(t),
|
|
1216
1212
|
children: e
|
|
1217
1213
|
}, e))
|
|
1218
|
-
}) : /* @__PURE__ */
|
|
1214
|
+
}) : /* @__PURE__ */ H("span", {
|
|
1219
1215
|
className: "text-sm text-muted-foreground",
|
|
1220
|
-
children: /* @__PURE__ */
|
|
1216
|
+
children: /* @__PURE__ */ H(e, { id: "None required" })
|
|
1221
1217
|
})
|
|
1222
1218
|
}),
|
|
1223
|
-
/* @__PURE__ */
|
|
1219
|
+
/* @__PURE__ */ H(O, {
|
|
1224
1220
|
className: "py-3",
|
|
1225
|
-
children: n.archived && n.open_obligations === 0 ? /* @__PURE__ */
|
|
1221
|
+
children: n.archived && n.open_obligations === 0 ? /* @__PURE__ */ H(o, {
|
|
1226
1222
|
variant: "secondary",
|
|
1227
|
-
children: /* @__PURE__ */
|
|
1228
|
-
}) : n.archived ? /* @__PURE__ */
|
|
1223
|
+
children: /* @__PURE__ */ H(e, { id: "archived" })
|
|
1224
|
+
}) : n.archived ? /* @__PURE__ */ U(o, {
|
|
1229
1225
|
variant: "secondary",
|
|
1230
1226
|
className: "bg-held-surface text-held",
|
|
1231
1227
|
children: [
|
|
1232
|
-
/* @__PURE__ */
|
|
1228
|
+
/* @__PURE__ */ H(e, { id: "draining (" }),
|
|
1233
1229
|
n.open_obligations,
|
|
1234
1230
|
")"
|
|
1235
1231
|
]
|
|
1236
|
-
}) : /* @__PURE__ */
|
|
1232
|
+
}) : /* @__PURE__ */ H(o, {
|
|
1237
1233
|
variant: "secondary",
|
|
1238
1234
|
className: "bg-settled-surface text-settled",
|
|
1239
|
-
children: /* @__PURE__ */
|
|
1235
|
+
children: /* @__PURE__ */ H(e, { id: "active" })
|
|
1240
1236
|
})
|
|
1241
1237
|
}),
|
|
1242
|
-
|
|
1238
|
+
c && /* @__PURE__ */ H(O, {
|
|
1243
1239
|
className: "py-3 text-right",
|
|
1244
|
-
children: !n.archived && /* @__PURE__ */
|
|
1240
|
+
children: !n.archived && /* @__PURE__ */ U("div", {
|
|
1245
1241
|
className: "flex justify-end gap-2",
|
|
1246
1242
|
children: [
|
|
1247
|
-
/* @__PURE__ */
|
|
1243
|
+
/* @__PURE__ */ H(Ae, {
|
|
1248
1244
|
psp: n,
|
|
1249
|
-
credentialKeys:
|
|
1250
|
-
}, `${
|
|
1251
|
-
/* @__PURE__ */
|
|
1245
|
+
credentialKeys: S?.credential_keys ?? Object.keys(w)
|
|
1246
|
+
}, `${h() ?? ""}:${n.id}`),
|
|
1247
|
+
/* @__PURE__ */ H(u, {
|
|
1252
1248
|
variant: "outline",
|
|
1253
1249
|
size: "sm",
|
|
1254
|
-
disabled:
|
|
1255
|
-
onClick: () =>
|
|
1256
|
-
children: /* @__PURE__ */
|
|
1250
|
+
disabled: v.isPending,
|
|
1251
|
+
onClick: () => T(!1),
|
|
1252
|
+
children: /* @__PURE__ */ H(e, { id: "Archive" })
|
|
1257
1253
|
}),
|
|
1258
|
-
/* @__PURE__ */
|
|
1259
|
-
open:
|
|
1260
|
-
onOpenChange:
|
|
1261
|
-
title: `Archive the last active ${
|
|
1262
|
-
description:
|
|
1254
|
+
/* @__PURE__ */ H(s, {
|
|
1255
|
+
open: y,
|
|
1256
|
+
onOpenChange: b,
|
|
1257
|
+
title: `Archive the last active ${C} PSP?`,
|
|
1258
|
+
description: g("New purchase on this rail is refused until another PSP is armed. Existing subscriptions, refunds and webhooks keep using this one."),
|
|
1263
1259
|
confirmationWord: "ARCHIVE",
|
|
1264
1260
|
actionLabel: "Archive PSP",
|
|
1265
|
-
onConfirm: () =>
|
|
1261
|
+
onConfirm: () => T(!0)
|
|
1266
1262
|
})
|
|
1267
1263
|
]
|
|
1268
1264
|
})
|
|
@@ -1270,63 +1266,63 @@ function Oe({ psp: n, railDefinitions: r, edits: s }) {
|
|
|
1270
1266
|
]
|
|
1271
1267
|
});
|
|
1272
1268
|
}
|
|
1273
|
-
function
|
|
1274
|
-
let { toast:
|
|
1269
|
+
function Ae({ psp: n, credentialKeys: r }) {
|
|
1270
|
+
let { toast: o, toastApiError: s, toastStaleEdit: c, adminMutations: l, selectedMerchant: y } = i(), { id: b } = t(), [x, S] = L.useState(!1), [C] = L.useState(() => y() ?? ""), w = L.useRef(n.revision), T = B(), E = R(l.updatePSP(T)), D = n.credentials ?? {}, O = G({
|
|
1275
1271
|
defaultValues: { credentials: {} },
|
|
1276
1272
|
onSubmit: async ({ value: e }) => {
|
|
1277
1273
|
let t = Object.fromEntries(Object.entries(e.credentials).filter(([, e]) => e.trim()));
|
|
1278
1274
|
try {
|
|
1279
|
-
if ((
|
|
1280
|
-
await
|
|
1275
|
+
if ((y() ?? "") !== C) throw Error("Merchant changed; reopen this form");
|
|
1276
|
+
await E.mutateAsync({
|
|
1281
1277
|
id: n.id,
|
|
1282
1278
|
psp: {
|
|
1283
|
-
expected_revision:
|
|
1279
|
+
expected_revision: w.current,
|
|
1284
1280
|
credentials: t
|
|
1285
1281
|
}
|
|
1286
|
-
}),
|
|
1282
|
+
}), o.success(`${n.key} credentials validated and rotated`), k(!1);
|
|
1287
1283
|
} catch (e) {
|
|
1288
1284
|
if (e instanceof a && e.revisionMismatch) {
|
|
1289
|
-
|
|
1285
|
+
c(`PSP ${n.key}`), k(!1);
|
|
1290
1286
|
return;
|
|
1291
1287
|
}
|
|
1292
|
-
|
|
1288
|
+
s(e, "Rotate credentials");
|
|
1293
1289
|
} finally {
|
|
1294
|
-
|
|
1290
|
+
E.reset();
|
|
1295
1291
|
}
|
|
1296
1292
|
}
|
|
1297
|
-
}),
|
|
1298
|
-
e ||
|
|
1293
|
+
}), k = (e) => {
|
|
1294
|
+
e || O.reset(), e && (w.current = n.revision), S(e);
|
|
1299
1295
|
};
|
|
1300
|
-
return /* @__PURE__ */
|
|
1301
|
-
open:
|
|
1302
|
-
onOpenChange:
|
|
1303
|
-
children: [/* @__PURE__ */
|
|
1296
|
+
return /* @__PURE__ */ U(_, {
|
|
1297
|
+
open: x,
|
|
1298
|
+
onOpenChange: k,
|
|
1299
|
+
children: [/* @__PURE__ */ H(g, { render: /* @__PURE__ */ H(u, {
|
|
1304
1300
|
variant: "outline",
|
|
1305
1301
|
size: "sm",
|
|
1306
|
-
children: /* @__PURE__ */
|
|
1307
|
-
}) }), /* @__PURE__ */
|
|
1308
|
-
className:
|
|
1309
|
-
children: [/* @__PURE__ */
|
|
1310
|
-
/* @__PURE__ */
|
|
1302
|
+
children: /* @__PURE__ */ H(e, { id: "Rotate" })
|
|
1303
|
+
}) }), /* @__PURE__ */ U(p, {
|
|
1304
|
+
className: F,
|
|
1305
|
+
children: [/* @__PURE__ */ U(d, { children: [/* @__PURE__ */ U(m, { children: [
|
|
1306
|
+
/* @__PURE__ */ H(e, { id: "Rotate " }),
|
|
1311
1307
|
n.key,
|
|
1312
|
-
/* @__PURE__ */
|
|
1313
|
-
|
|
1314
|
-
] }), /* @__PURE__ */
|
|
1308
|
+
/* @__PURE__ */ H(e, { id: " credentials · " }),
|
|
1309
|
+
Me(n)
|
|
1310
|
+
] }), /* @__PURE__ */ H(h, { children: /* @__PURE__ */ H(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__ */ U("form", {
|
|
1315
1311
|
onSubmit: (e) => {
|
|
1316
|
-
e.preventDefault(), e.stopPropagation(),
|
|
1312
|
+
e.preventDefault(), e.stopPropagation(), O.handleSubmit();
|
|
1317
1313
|
},
|
|
1318
1314
|
className: "grid gap-4",
|
|
1319
|
-
children: [/* @__PURE__ */
|
|
1315
|
+
children: [/* @__PURE__ */ H(O.Field, {
|
|
1320
1316
|
name: "credentials",
|
|
1321
|
-
children: (t) => /* @__PURE__ */
|
|
1317
|
+
children: (t) => /* @__PURE__ */ U("div", {
|
|
1322
1318
|
className: "grid gap-3",
|
|
1323
1319
|
children: [r.map((r) => {
|
|
1324
|
-
let i =
|
|
1325
|
-
return /* @__PURE__ */
|
|
1320
|
+
let i = D[r];
|
|
1321
|
+
return /* @__PURE__ */ U($, {
|
|
1326
1322
|
label: r,
|
|
1327
1323
|
id: `rot-${n.id}-${r}`,
|
|
1328
|
-
children: [/* @__PURE__ */
|
|
1329
|
-
id:
|
|
1324
|
+
children: [/* @__PURE__ */ H(v, {
|
|
1325
|
+
id: b(`rot-${n.id}-${r}`),
|
|
1330
1326
|
type: "password",
|
|
1331
1327
|
autoComplete: "new-password",
|
|
1332
1328
|
placeholder: i?.configured ? "unchanged" : "not configured",
|
|
@@ -1335,19 +1331,19 @@ function ke({ psp: n, credentialKeys: r }) {
|
|
|
1335
1331
|
...t.state.value,
|
|
1336
1332
|
[r]: e.target.value
|
|
1337
1333
|
})
|
|
1338
|
-
}), i?.validated_at && /* @__PURE__ */
|
|
1334
|
+
}), i?.validated_at && /* @__PURE__ */ U("p", {
|
|
1339
1335
|
className: "text-xs text-muted-foreground",
|
|
1340
|
-
children: [/* @__PURE__ */
|
|
1336
|
+
children: [/* @__PURE__ */ H(e, { id: "Last validated " }), re(i.validated_at)]
|
|
1341
1337
|
})]
|
|
1342
1338
|
}, r);
|
|
1343
|
-
}), /* @__PURE__ */
|
|
1339
|
+
}), /* @__PURE__ */ H("p", {
|
|
1344
1340
|
className: "text-xs text-muted-foreground",
|
|
1345
|
-
children: /* @__PURE__ */
|
|
1341
|
+
children: /* @__PURE__ */ H(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
1342
|
})]
|
|
1347
1343
|
})
|
|
1348
|
-
}), /* @__PURE__ */
|
|
1344
|
+
}), /* @__PURE__ */ H(f, { children: /* @__PURE__ */ H(O.Subscribe, {
|
|
1349
1345
|
selector: (e) => [e.values.credentials, e.isSubmitting],
|
|
1350
|
-
children: ([e, t]) => /* @__PURE__ */
|
|
1346
|
+
children: ([e, t]) => /* @__PURE__ */ H(u, {
|
|
1351
1347
|
type: "submit",
|
|
1352
1348
|
disabled: t || !Object.values(e).some((e) => e.trim()),
|
|
1353
1349
|
children: t ? "Validating…" : "Validate & rotate"
|
|
@@ -1357,7 +1353,7 @@ function ke({ psp: n, credentialKeys: r }) {
|
|
|
1357
1353
|
})]
|
|
1358
1354
|
});
|
|
1359
1355
|
}
|
|
1360
|
-
var
|
|
1356
|
+
var je = {
|
|
1361
1357
|
gateway_id: {
|
|
1362
1358
|
label: "Gateway ID",
|
|
1363
1359
|
hint: "The Gateway ID shown in your NMI dashboard."
|
|
@@ -1379,36 +1375,36 @@ var Ae = {
|
|
|
1379
1375
|
hint: "The Solana address your payments land in."
|
|
1380
1376
|
}
|
|
1381
1377
|
};
|
|
1382
|
-
function
|
|
1378
|
+
function Me(e) {
|
|
1383
1379
|
return e.client_accnum ? `${e.client_accnum}-${e.client_subacc ?? ""}` : e.gateway_id ?? e.account_id ?? e.treasury ?? "";
|
|
1384
1380
|
}
|
|
1385
|
-
var
|
|
1381
|
+
var Ne = {
|
|
1386
1382
|
live: "Live: real money",
|
|
1387
1383
|
test: "Test: the provider's own system, no money moves",
|
|
1388
1384
|
sandbox: "Sandbox: the provider's separate sandbox",
|
|
1389
1385
|
mainnet: "Mainnet: real money",
|
|
1390
1386
|
devnet: "Devnet: Solana's development network",
|
|
1391
1387
|
testnet: "Testnet: Solana's test network"
|
|
1392
|
-
},
|
|
1388
|
+
}, Pe = {
|
|
1393
1389
|
nmi: "NMI",
|
|
1394
1390
|
ccbill: "CCBill",
|
|
1395
1391
|
stripe: "Stripe",
|
|
1396
1392
|
solana: "Solana"
|
|
1397
1393
|
};
|
|
1398
|
-
function
|
|
1399
|
-
let n =
|
|
1394
|
+
function Fe(e, t) {
|
|
1395
|
+
let n = Pe[e] ?? e;
|
|
1400
1396
|
return !t || t.toLowerCase() === n.toLowerCase() ? n : `${t} (${n})`;
|
|
1401
1397
|
}
|
|
1402
|
-
var
|
|
1398
|
+
var Ie = {
|
|
1403
1399
|
api: "API",
|
|
1404
1400
|
id: "ID",
|
|
1405
1401
|
url: "URL"
|
|
1406
1402
|
};
|
|
1407
|
-
function
|
|
1408
|
-
return e.split(/[_-]+/).filter(Boolean).map((e, t) =>
|
|
1403
|
+
function Q(e) {
|
|
1404
|
+
return e.split(/[_-]+/).filter(Boolean).map((e, t) => Ie[e.toLowerCase()] || (t > 0 ? e.toLowerCase() : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase())).join(" ");
|
|
1409
1405
|
}
|
|
1410
1406
|
function Le({ railDefinitions: n }) {
|
|
1411
|
-
let { toast: r, toastApiError: a, adminMutations:
|
|
1407
|
+
let { toast: r, toastApiError: a, adminMutations: o, selectedMerchant: s } = i(), { text: l, id: y } = t(), [T, E] = L.useState(!1), [D] = L.useState(() => s() ?? ""), O = B(), k = R(o.createPSP(O)), A = G({
|
|
1412
1408
|
defaultValues: {
|
|
1413
1409
|
rail: "",
|
|
1414
1410
|
environment: "",
|
|
@@ -1419,126 +1415,126 @@ function Le({ railDefinitions: n }) {
|
|
|
1419
1415
|
onSubmit: async ({ value: e }) => {
|
|
1420
1416
|
let t = Object.fromEntries(Object.entries(e.credentials).filter(([, e]) => e !== ""));
|
|
1421
1417
|
try {
|
|
1422
|
-
if ((
|
|
1418
|
+
if ((s() ?? "") !== D) throw Error("Merchant changed; reopen this form");
|
|
1423
1419
|
let i = n.find((t) => t.rail === e.rail);
|
|
1424
|
-
await
|
|
1420
|
+
await k.mutateAsync({
|
|
1425
1421
|
key: e.key.trim().toLowerCase(),
|
|
1426
1422
|
rail: e.rail,
|
|
1427
1423
|
environment: e.environment,
|
|
1428
1424
|
...Object.fromEntries((i?.account_fields ?? []).map((t) => [t, (e.account[t] ?? "").trim()])),
|
|
1429
1425
|
...Object.keys(t).length ? { credentials: t } : {}
|
|
1430
|
-
}),
|
|
1426
|
+
}), A.reset(), r.success("PSP added"), E(!1);
|
|
1431
1427
|
} catch (e) {
|
|
1432
1428
|
a(e, "Add PSP");
|
|
1433
1429
|
} finally {
|
|
1434
|
-
|
|
1430
|
+
k.reset();
|
|
1435
1431
|
}
|
|
1436
1432
|
}
|
|
1437
|
-
}),
|
|
1438
|
-
e ||
|
|
1433
|
+
}), j = (e) => {
|
|
1434
|
+
e || A.reset(), E(e);
|
|
1439
1435
|
};
|
|
1440
|
-
return /* @__PURE__ */
|
|
1441
|
-
open:
|
|
1442
|
-
onOpenChange:
|
|
1443
|
-
children: [/* @__PURE__ */
|
|
1436
|
+
return /* @__PURE__ */ U(_, {
|
|
1437
|
+
open: T,
|
|
1438
|
+
onOpenChange: j,
|
|
1439
|
+
children: [/* @__PURE__ */ H(g, { render: /* @__PURE__ */ H(u, {
|
|
1444
1440
|
size: "sm",
|
|
1445
|
-
children: /* @__PURE__ */
|
|
1446
|
-
}) }), /* @__PURE__ */
|
|
1447
|
-
className:
|
|
1448
|
-
children: [/* @__PURE__ */
|
|
1441
|
+
children: /* @__PURE__ */ H(e, { id: "Add PSP" })
|
|
1442
|
+
}) }), /* @__PURE__ */ U(p, {
|
|
1443
|
+
className: F,
|
|
1444
|
+
children: [/* @__PURE__ */ U(d, { children: [/* @__PURE__ */ H(m, { children: /* @__PURE__ */ H(e, { id: "Add a PSP" }) }), /* @__PURE__ */ H(h, { children: /* @__PURE__ */ H(e, { id: "Connect the account that will take money for you. Credentials go straight into the secret store and are never shown again." }) })] }), /* @__PURE__ */ U("form", {
|
|
1449
1445
|
onSubmit: (e) => {
|
|
1450
|
-
e.preventDefault(), e.stopPropagation(),
|
|
1446
|
+
e.preventDefault(), e.stopPropagation(), A.handleSubmit();
|
|
1451
1447
|
},
|
|
1452
1448
|
className: "grid gap-4",
|
|
1453
|
-
children: [/* @__PURE__ */
|
|
1449
|
+
children: [/* @__PURE__ */ U("div", {
|
|
1454
1450
|
className: "grid gap-3",
|
|
1455
1451
|
children: [
|
|
1456
|
-
/* @__PURE__ */
|
|
1452
|
+
/* @__PURE__ */ H(A.Field, {
|
|
1457
1453
|
name: "rail",
|
|
1458
1454
|
validators: { onChange: ({ value: e }) => e ? void 0 : "Choose a payment rail" },
|
|
1459
|
-
children: (e) => /* @__PURE__ */
|
|
1460
|
-
label:
|
|
1455
|
+
children: (e) => /* @__PURE__ */ U($, {
|
|
1456
|
+
label: l("Payment rail"),
|
|
1461
1457
|
id: "pv-rail",
|
|
1462
|
-
children: [/* @__PURE__ */
|
|
1458
|
+
children: [/* @__PURE__ */ U(w, {
|
|
1463
1459
|
items: n.map((e) => ({
|
|
1464
1460
|
value: e.rail,
|
|
1465
|
-
label:
|
|
1461
|
+
label: Fe(e.rail, e.display_name)
|
|
1466
1462
|
})),
|
|
1467
1463
|
value: e.state.value || null,
|
|
1468
1464
|
onValueChange: (t) => {
|
|
1469
|
-
e.handleChange(t ?? ""),
|
|
1465
|
+
e.handleChange(t ?? ""), A.setFieldValue("account", {}), A.setFieldValue("credentials", {}), A.setFieldValue("environment", n.find((e) => e.rail === t)?.environments[0] ?? "");
|
|
1470
1466
|
},
|
|
1471
|
-
children: [/* @__PURE__ */
|
|
1472
|
-
id:
|
|
1467
|
+
children: [/* @__PURE__ */ H(x, {
|
|
1468
|
+
id: y("pv-rail"),
|
|
1473
1469
|
className: "w-full",
|
|
1474
1470
|
"aria-invalid": e.state.meta.errors.length > 0,
|
|
1475
|
-
children: /* @__PURE__ */
|
|
1476
|
-
}), /* @__PURE__ */
|
|
1471
|
+
children: /* @__PURE__ */ H(b, { placeholder: l("Pick a rail…") })
|
|
1472
|
+
}), /* @__PURE__ */ H(S, { children: n.map((e) => /* @__PURE__ */ H(C, {
|
|
1477
1473
|
value: e.rail,
|
|
1478
|
-
children:
|
|
1474
|
+
children: Fe(e.rail, e.display_name)
|
|
1479
1475
|
}, e.rail)) })]
|
|
1480
|
-
}), /* @__PURE__ */
|
|
1476
|
+
}), /* @__PURE__ */ H(c, { errors: e.state.meta.errors })]
|
|
1481
1477
|
})
|
|
1482
1478
|
}),
|
|
1483
|
-
/* @__PURE__ */
|
|
1479
|
+
/* @__PURE__ */ H(A.Subscribe, {
|
|
1484
1480
|
selector: (e) => e.values.rail,
|
|
1485
1481
|
children: (e) => {
|
|
1486
1482
|
let t = n.find((t) => t.rail === e)?.environments ?? [];
|
|
1487
|
-
return /* @__PURE__ */
|
|
1483
|
+
return /* @__PURE__ */ H(A.Field, {
|
|
1488
1484
|
name: "environment",
|
|
1489
1485
|
validators: { onChange: ({ value: e }) => e ? void 0 : "Choose whether it moves real money" },
|
|
1490
|
-
children: (n) => /* @__PURE__ */
|
|
1491
|
-
label:
|
|
1486
|
+
children: (n) => /* @__PURE__ */ U($, {
|
|
1487
|
+
label: l("Environment"),
|
|
1492
1488
|
id: "pv-environment",
|
|
1493
1489
|
hint: "Whether this PSP moves real money. It is checked with the provider before the PSP is used.",
|
|
1494
|
-
children: [/* @__PURE__ */
|
|
1490
|
+
children: [/* @__PURE__ */ U(w, {
|
|
1495
1491
|
items: t.map((e) => ({
|
|
1496
1492
|
value: e,
|
|
1497
|
-
label:
|
|
1493
|
+
label: l(Ne[e] ?? e)
|
|
1498
1494
|
})),
|
|
1499
1495
|
value: n.state.value || null,
|
|
1500
1496
|
onValueChange: (e) => n.handleChange(e ?? ""),
|
|
1501
|
-
children: [/* @__PURE__ */
|
|
1502
|
-
id:
|
|
1497
|
+
children: [/* @__PURE__ */ H(x, {
|
|
1498
|
+
id: y("pv-environment"),
|
|
1503
1499
|
className: "w-full",
|
|
1504
1500
|
disabled: !e,
|
|
1505
1501
|
"aria-invalid": n.state.meta.errors.length > 0,
|
|
1506
|
-
children: /* @__PURE__ */
|
|
1507
|
-
}), /* @__PURE__ */
|
|
1502
|
+
children: /* @__PURE__ */ H(b, { placeholder: l("Pick an environment…") })
|
|
1503
|
+
}), /* @__PURE__ */ H(S, { children: t.map((e) => /* @__PURE__ */ H(C, {
|
|
1508
1504
|
value: e,
|
|
1509
|
-
children:
|
|
1505
|
+
children: l(Ne[e] ?? e)
|
|
1510
1506
|
}, e)) })]
|
|
1511
|
-
}), /* @__PURE__ */
|
|
1507
|
+
}), /* @__PURE__ */ H(c, { errors: n.state.meta.errors })]
|
|
1512
1508
|
})
|
|
1513
1509
|
});
|
|
1514
1510
|
}
|
|
1515
1511
|
}),
|
|
1516
|
-
/* @__PURE__ */
|
|
1512
|
+
/* @__PURE__ */ H(A.Field, {
|
|
1517
1513
|
name: "key",
|
|
1518
1514
|
validators: { onChange: ({ value: e }) => /^[a-z0-9][a-z0-9_-]{0,62}$/.test(e.trim().toLowerCase()) ? void 0 : "Lowercase letters, digits, - or _" },
|
|
1519
|
-
children: (e) => /* @__PURE__ */
|
|
1520
|
-
label:
|
|
1515
|
+
children: (e) => /* @__PURE__ */ U($, {
|
|
1516
|
+
label: l("Key"),
|
|
1521
1517
|
id: "pv-key",
|
|
1522
1518
|
hint: "Your name for this PSP, such as mobius. Prices and purchase name it by this key.",
|
|
1523
|
-
children: [/* @__PURE__ */
|
|
1524
|
-
id:
|
|
1519
|
+
children: [/* @__PURE__ */ H(v, {
|
|
1520
|
+
id: y("pv-key"),
|
|
1525
1521
|
value: e.state.value,
|
|
1526
1522
|
onBlur: e.handleBlur,
|
|
1527
1523
|
onChange: (t) => e.handleChange(t.target.value),
|
|
1528
1524
|
"aria-invalid": e.state.meta.errors.length > 0
|
|
1529
|
-
}), /* @__PURE__ */
|
|
1525
|
+
}), /* @__PURE__ */ H(c, { errors: e.state.meta.errors })]
|
|
1530
1526
|
})
|
|
1531
1527
|
}),
|
|
1532
|
-
/* @__PURE__ */
|
|
1528
|
+
/* @__PURE__ */ H(A.Subscribe, {
|
|
1533
1529
|
selector: (e) => e.values.rail,
|
|
1534
|
-
children: (e) => /* @__PURE__ */
|
|
1530
|
+
children: (e) => /* @__PURE__ */ H(A.Field, {
|
|
1535
1531
|
name: "account",
|
|
1536
|
-
children: (t) => /* @__PURE__ */
|
|
1537
|
-
label:
|
|
1532
|
+
children: (t) => /* @__PURE__ */ H(V, { children: n.find((t) => t.rail === e)?.account_fields.map((e) => /* @__PURE__ */ H($, {
|
|
1533
|
+
label: l(je[e]?.label ?? Q(e)),
|
|
1538
1534
|
id: `pv-account-${e}`,
|
|
1539
|
-
hint:
|
|
1540
|
-
children: /* @__PURE__ */
|
|
1541
|
-
id:
|
|
1535
|
+
hint: je[e]?.hint,
|
|
1536
|
+
children: /* @__PURE__ */ H(v, {
|
|
1537
|
+
id: y(`pv-account-${e}`),
|
|
1542
1538
|
value: t.state.value[e] ?? "",
|
|
1543
1539
|
onBlur: t.handleBlur,
|
|
1544
1540
|
onChange: (n) => t.handleChange({
|
|
@@ -1549,17 +1545,17 @@ function Le({ railDefinitions: n }) {
|
|
|
1549
1545
|
}, e)) })
|
|
1550
1546
|
})
|
|
1551
1547
|
}),
|
|
1552
|
-
/* @__PURE__ */
|
|
1548
|
+
/* @__PURE__ */ H(A.Subscribe, {
|
|
1553
1549
|
selector: (e) => e.values.rail,
|
|
1554
1550
|
children: (e) => {
|
|
1555
1551
|
let t = n.find((t) => t.rail === e);
|
|
1556
|
-
return /* @__PURE__ */
|
|
1552
|
+
return /* @__PURE__ */ H(A.Field, {
|
|
1557
1553
|
name: "credentials",
|
|
1558
|
-
children: (e) => /* @__PURE__ */
|
|
1559
|
-
label:
|
|
1554
|
+
children: (e) => /* @__PURE__ */ H(V, { children: t?.credential_keys.map((t) => /* @__PURE__ */ H($, {
|
|
1555
|
+
label: Q(t),
|
|
1560
1556
|
id: `pv-credential-${t}`,
|
|
1561
|
-
children: /* @__PURE__ */
|
|
1562
|
-
id:
|
|
1557
|
+
children: /* @__PURE__ */ H(v, {
|
|
1558
|
+
id: y(`pv-credential-${t}`),
|
|
1563
1559
|
type: "password",
|
|
1564
1560
|
autoComplete: "new-password",
|
|
1565
1561
|
value: e.state.value[t] ?? "",
|
|
@@ -1573,7 +1569,7 @@ function Le({ railDefinitions: n }) {
|
|
|
1573
1569
|
}
|
|
1574
1570
|
})
|
|
1575
1571
|
]
|
|
1576
|
-
}), /* @__PURE__ */
|
|
1572
|
+
}), /* @__PURE__ */ H(f, { children: /* @__PURE__ */ H(A.Subscribe, {
|
|
1577
1573
|
selector: (e) => [
|
|
1578
1574
|
e.values.rail,
|
|
1579
1575
|
e.values.environment,
|
|
@@ -1582,15 +1578,15 @@ function Le({ railDefinitions: n }) {
|
|
|
1582
1578
|
e.canSubmit,
|
|
1583
1579
|
e.isSubmitting
|
|
1584
1580
|
],
|
|
1585
|
-
children: ([t, r, i, a,
|
|
1581
|
+
children: ([t, r, i, a, o, s]) => /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(u, {
|
|
1586
1582
|
type: "button",
|
|
1587
1583
|
variant: "outline",
|
|
1588
|
-
onClick: () =>
|
|
1589
|
-
children: /* @__PURE__ */
|
|
1590
|
-
}), /* @__PURE__ */
|
|
1584
|
+
onClick: () => j(!1),
|
|
1585
|
+
children: /* @__PURE__ */ H(e, { id: "Cancel" })
|
|
1586
|
+
}), /* @__PURE__ */ H(u, {
|
|
1591
1587
|
type: "submit",
|
|
1592
|
-
disabled: !t || !r || !i.trim() || !n.find((e) => e.rail === t)?.account_fields.every((e) => (a[e] ?? "").trim()) || !
|
|
1593
|
-
children:
|
|
1588
|
+
disabled: !t || !r || !i.trim() || !n.find((e) => e.rail === t)?.account_fields.every((e) => (a[e] ?? "").trim()) || !o || s,
|
|
1589
|
+
children: s ? "Saving…" : "Add PSP"
|
|
1594
1590
|
})] })
|
|
1595
1591
|
}) })]
|
|
1596
1592
|
})]
|
|
@@ -1598,173 +1594,173 @@ function Le({ railDefinitions: n }) {
|
|
|
1598
1594
|
});
|
|
1599
1595
|
}
|
|
1600
1596
|
function Re() {
|
|
1601
|
-
let { toast: n, toastApiError: r, adminMutations: a, adminQueries:
|
|
1597
|
+
let { toast: n, toastApiError: r, adminMutations: a, adminQueries: o } = i(), { text: s, id: l } = t(), [d, f] = L.useState(), p = R(a.lookupCustomerControls()), m = R(a.setCreditLimit()), h = se(), g = G({
|
|
1602
1598
|
defaultValues: { newLimit: "" },
|
|
1603
1599
|
onSubmit: async ({ value: e }) => {
|
|
1604
|
-
if (!
|
|
1605
|
-
let t =
|
|
1600
|
+
if (!d) return;
|
|
1601
|
+
let t = P(d.currency), i = t === void 0 ? null : oe(e.newLimit, t);
|
|
1606
1602
|
if (!(i === null || i.startsWith("-"))) try {
|
|
1607
|
-
await
|
|
1608
|
-
customerId:
|
|
1609
|
-
currency:
|
|
1603
|
+
await m.mutateAsync({
|
|
1604
|
+
customerId: d.customerID,
|
|
1605
|
+
currency: d.currency,
|
|
1610
1606
|
amount: i
|
|
1611
|
-
}),
|
|
1607
|
+
}), f((e) => e && {
|
|
1612
1608
|
...e,
|
|
1613
1609
|
creditLimit: i
|
|
1614
|
-
}),
|
|
1610
|
+
}), g.reset(), n.success("Credit limit updated");
|
|
1615
1611
|
} catch (e) {
|
|
1616
1612
|
r(e, "Set credit limit");
|
|
1617
1613
|
}
|
|
1618
1614
|
}
|
|
1619
|
-
}), [
|
|
1620
|
-
...
|
|
1621
|
-
...
|
|
1622
|
-
...
|
|
1623
|
-
...
|
|
1624
|
-
].map((e) => e.currency.toUpperCase()))].sort(),
|
|
1615
|
+
}), [_, T] = L.useState(), { data: E } = z(o.merchantConfiguration()), D = [...new Set([
|
|
1616
|
+
...E?.usage_billing?.currencies ?? [],
|
|
1617
|
+
..._?.balances ?? [],
|
|
1618
|
+
..._?.settings.credit_limits ?? [],
|
|
1619
|
+
..._?.settings.trust_levels ?? []
|
|
1620
|
+
].map((e) => e.currency.toUpperCase()))].sort(), O = D.length ? D : Object.keys(ne).sort(), k = G({
|
|
1625
1621
|
defaultValues: { currency: "" },
|
|
1626
1622
|
onSubmit: async ({ value: e }) => {
|
|
1627
|
-
let t = e.currency ||
|
|
1628
|
-
if (
|
|
1629
|
-
let e = await
|
|
1630
|
-
customerId:
|
|
1623
|
+
let t = e.currency || O[0];
|
|
1624
|
+
if (_ && t) try {
|
|
1625
|
+
let e = await p.mutateAsync({
|
|
1626
|
+
customerId: _.id,
|
|
1631
1627
|
currency: t
|
|
1632
1628
|
});
|
|
1633
|
-
|
|
1634
|
-
customerID:
|
|
1629
|
+
f({
|
|
1630
|
+
customerID: _.id,
|
|
1635
1631
|
...e
|
|
1636
|
-
}),
|
|
1632
|
+
}), g.reset();
|
|
1637
1633
|
} catch (e) {
|
|
1638
|
-
r(e, "Lookup customer controls"),
|
|
1634
|
+
r(e, "Lookup customer controls"), f(void 0);
|
|
1639
1635
|
}
|
|
1640
1636
|
}
|
|
1641
|
-
}),
|
|
1642
|
-
|
|
1637
|
+
}), A = (e) => {
|
|
1638
|
+
T(e), f(void 0), k.reset();
|
|
1643
1639
|
};
|
|
1644
|
-
return /* @__PURE__ */
|
|
1640
|
+
return /* @__PURE__ */ U("div", {
|
|
1645
1641
|
className: "grid gap-10",
|
|
1646
|
-
children: [/* @__PURE__ */
|
|
1642
|
+
children: [/* @__PURE__ */ U("section", {
|
|
1647
1643
|
className: "grid gap-5",
|
|
1648
|
-
children: [/* @__PURE__ */
|
|
1644
|
+
children: [/* @__PURE__ */ U("div", {
|
|
1649
1645
|
className: "grid gap-1",
|
|
1650
|
-
children: [/* @__PURE__ */
|
|
1646
|
+
children: [/* @__PURE__ */ H("h2", {
|
|
1651
1647
|
className: "text-base font-semibold",
|
|
1652
|
-
children: /* @__PURE__ */
|
|
1653
|
-
}), /* @__PURE__ */
|
|
1648
|
+
children: /* @__PURE__ */ H(e, { id: "Customer lookup" })
|
|
1649
|
+
}), /* @__PURE__ */ H("p", {
|
|
1654
1650
|
className: "text-sm text-muted-foreground",
|
|
1655
|
-
children: /* @__PURE__ */
|
|
1651
|
+
children: /* @__PURE__ */ H(e, { id: "Find a customer by name or email, then pick a currency." })
|
|
1656
1652
|
})]
|
|
1657
|
-
}), /* @__PURE__ */
|
|
1653
|
+
}), /* @__PURE__ */ U("div", {
|
|
1658
1654
|
className: "grid gap-4 md:grid-cols-[minmax(0,1fr)_10rem_auto] md:items-end",
|
|
1659
|
-
children: [/* @__PURE__ */
|
|
1655
|
+
children: [/* @__PURE__ */ U("div", {
|
|
1660
1656
|
className: "grid gap-1.5",
|
|
1661
|
-
children: [/* @__PURE__ */
|
|
1657
|
+
children: [/* @__PURE__ */ H(y, { children: /* @__PURE__ */ H(e, { id: "Customer" }) }), _ ? /* @__PURE__ */ U("span", {
|
|
1662
1658
|
className: "inline-flex h-8 w-fit max-w-full items-center gap-1 rounded-md bg-muted pr-1 pl-2 text-sm font-medium",
|
|
1663
|
-
children: [/* @__PURE__ */
|
|
1659
|
+
children: [/* @__PURE__ */ H("span", {
|
|
1664
1660
|
className: "truncate",
|
|
1665
|
-
children:
|
|
1666
|
-
}), /* @__PURE__ */
|
|
1661
|
+
children: ie(_)
|
|
1662
|
+
}), /* @__PURE__ */ H(u, {
|
|
1667
1663
|
variant: "ghost",
|
|
1668
1664
|
size: "icon",
|
|
1669
1665
|
className: "size-5",
|
|
1670
|
-
"aria-label":
|
|
1671
|
-
onClick: () =>
|
|
1672
|
-
children: /* @__PURE__ */
|
|
1673
|
-
icon:
|
|
1666
|
+
"aria-label": s("Clear customer"),
|
|
1667
|
+
onClick: () => A(void 0),
|
|
1668
|
+
children: /* @__PURE__ */ H(W, {
|
|
1669
|
+
icon: pe,
|
|
1674
1670
|
className: "size-3"
|
|
1675
1671
|
})
|
|
1676
1672
|
})]
|
|
1677
|
-
}) : /* @__PURE__ */
|
|
1678
|
-
}), /* @__PURE__ */
|
|
1673
|
+
}) : /* @__PURE__ */ H(j, { onPick: A })]
|
|
1674
|
+
}), /* @__PURE__ */ U("form", {
|
|
1679
1675
|
onSubmit: (e) => {
|
|
1680
|
-
e.preventDefault(), e.stopPropagation(),
|
|
1676
|
+
e.preventDefault(), e.stopPropagation(), k.handleSubmit();
|
|
1681
1677
|
},
|
|
1682
1678
|
className: "contents",
|
|
1683
|
-
children: [/* @__PURE__ */
|
|
1679
|
+
children: [/* @__PURE__ */ H(k.Field, {
|
|
1684
1680
|
name: "currency",
|
|
1685
|
-
children: (e) => /* @__PURE__ */
|
|
1686
|
-
label:
|
|
1681
|
+
children: (e) => /* @__PURE__ */ H($, {
|
|
1682
|
+
label: s("Currency"),
|
|
1687
1683
|
id: "customer-controls-currency",
|
|
1688
|
-
children: /* @__PURE__ */
|
|
1689
|
-
items:
|
|
1684
|
+
children: /* @__PURE__ */ U(w, {
|
|
1685
|
+
items: O.map((e) => ({
|
|
1690
1686
|
value: e,
|
|
1691
1687
|
label: e
|
|
1692
1688
|
})),
|
|
1693
|
-
value: e.state.value ||
|
|
1689
|
+
value: e.state.value || O[0] || null,
|
|
1694
1690
|
onValueChange: (t) => e.handleChange(t ?? ""),
|
|
1695
|
-
children: [/* @__PURE__ */
|
|
1696
|
-
id:
|
|
1691
|
+
children: [/* @__PURE__ */ H(x, {
|
|
1692
|
+
id: l("customer-controls-currency"),
|
|
1697
1693
|
className: "w-full",
|
|
1698
|
-
disabled:
|
|
1699
|
-
children: /* @__PURE__ */
|
|
1700
|
-
}), /* @__PURE__ */
|
|
1694
|
+
disabled: O.length === 0,
|
|
1695
|
+
children: /* @__PURE__ */ H(b, { placeholder: s(_ ? "No currency yet" : "Pick a customer first") })
|
|
1696
|
+
}), /* @__PURE__ */ H(S, { children: O.map((e) => /* @__PURE__ */ H(C, {
|
|
1701
1697
|
value: e,
|
|
1702
1698
|
children: e
|
|
1703
1699
|
}, e)) })]
|
|
1704
1700
|
})
|
|
1705
1701
|
})
|
|
1706
|
-
}), /* @__PURE__ */
|
|
1702
|
+
}), /* @__PURE__ */ H(k.Subscribe, {
|
|
1707
1703
|
selector: (e) => e.isSubmitting,
|
|
1708
|
-
children: (e) => /* @__PURE__ */
|
|
1704
|
+
children: (e) => /* @__PURE__ */ H(u, {
|
|
1709
1705
|
type: "submit",
|
|
1710
1706
|
variant: "outline",
|
|
1711
|
-
disabled: !
|
|
1707
|
+
disabled: !_ || !O.length || e,
|
|
1712
1708
|
children: e ? "Looking up…" : "Look up"
|
|
1713
1709
|
})
|
|
1714
1710
|
})]
|
|
1715
1711
|
})]
|
|
1716
1712
|
})]
|
|
1717
|
-
}),
|
|
1713
|
+
}), d && /* @__PURE__ */ U("section", {
|
|
1718
1714
|
className: "grid gap-5",
|
|
1719
1715
|
children: [
|
|
1720
|
-
/* @__PURE__ */
|
|
1716
|
+
/* @__PURE__ */ U("div", {
|
|
1721
1717
|
className: "grid gap-1",
|
|
1722
|
-
children: [/* @__PURE__ */
|
|
1718
|
+
children: [/* @__PURE__ */ H("h2", {
|
|
1723
1719
|
className: "text-base font-semibold",
|
|
1724
|
-
children: /* @__PURE__ */
|
|
1725
|
-
}), /* @__PURE__ */
|
|
1720
|
+
children: /* @__PURE__ */ H(e, { id: "Credit and trust" })
|
|
1721
|
+
}), /* @__PURE__ */ U("p", {
|
|
1726
1722
|
className: "text-sm text-muted-foreground",
|
|
1727
1723
|
children: [
|
|
1728
|
-
/* @__PURE__ */
|
|
1724
|
+
/* @__PURE__ */ H("span", {
|
|
1729
1725
|
className: "font-mono text-xs break-all text-foreground",
|
|
1730
|
-
children:
|
|
1726
|
+
children: d.customerID
|
|
1731
1727
|
}),
|
|
1732
1728
|
" ",
|
|
1733
1729
|
"· ",
|
|
1734
|
-
|
|
1730
|
+
d.currency.toUpperCase()
|
|
1735
1731
|
]
|
|
1736
1732
|
})]
|
|
1737
1733
|
}),
|
|
1738
|
-
/* @__PURE__ */
|
|
1734
|
+
/* @__PURE__ */ U("dl", {
|
|
1739
1735
|
className: "grid gap-4",
|
|
1740
|
-
children: [/* @__PURE__ */
|
|
1741
|
-
label:
|
|
1742
|
-
value:
|
|
1743
|
-
}), /* @__PURE__ */
|
|
1744
|
-
label:
|
|
1745
|
-
value:
|
|
1736
|
+
children: [/* @__PURE__ */ H(Y, {
|
|
1737
|
+
label: s("Trust level"),
|
|
1738
|
+
value: d.trustLevel || "Default"
|
|
1739
|
+
}), /* @__PURE__ */ H(Y, {
|
|
1740
|
+
label: s("Credit limit"),
|
|
1741
|
+
value: d.creditLimit === "0" ? "Off" : ae(d.creditLimit, d.currency)
|
|
1746
1742
|
})]
|
|
1747
1743
|
}),
|
|
1748
|
-
|
|
1744
|
+
h && /* @__PURE__ */ H("form", {
|
|
1749
1745
|
onSubmit: (e) => {
|
|
1750
|
-
e.preventDefault(), e.stopPropagation(),
|
|
1746
|
+
e.preventDefault(), e.stopPropagation(), g.handleSubmit();
|
|
1751
1747
|
},
|
|
1752
|
-
children: /* @__PURE__ */
|
|
1753
|
-
label: `New limit (${
|
|
1748
|
+
children: /* @__PURE__ */ H(X, {
|
|
1749
|
+
label: `New limit (${d.currency.toUpperCase()})`,
|
|
1754
1750
|
id: "customer-controls-limit",
|
|
1755
|
-
children: /* @__PURE__ */
|
|
1751
|
+
children: /* @__PURE__ */ H(g.Field, {
|
|
1756
1752
|
name: "newLimit",
|
|
1757
1753
|
validators: { onChange: ({ value: e }) => {
|
|
1758
|
-
let t =
|
|
1754
|
+
let t = P(d.currency), n = t === void 0 ? null : oe(e, t);
|
|
1759
1755
|
return e !== "" && n !== null && !n.startsWith("-") ? void 0 : "Enter a valid amount";
|
|
1760
1756
|
} },
|
|
1761
|
-
children: (t) => /* @__PURE__ */
|
|
1757
|
+
children: (t) => /* @__PURE__ */ U("div", {
|
|
1762
1758
|
className: "grid gap-1.5",
|
|
1763
1759
|
children: [
|
|
1764
|
-
/* @__PURE__ */
|
|
1760
|
+
/* @__PURE__ */ U("div", {
|
|
1765
1761
|
className: "flex gap-2",
|
|
1766
|
-
children: [/* @__PURE__ */
|
|
1767
|
-
id:
|
|
1762
|
+
children: [/* @__PURE__ */ H(v, {
|
|
1763
|
+
id: l("customer-controls-limit"),
|
|
1768
1764
|
placeholder: "0.00",
|
|
1769
1765
|
type: "number",
|
|
1770
1766
|
step: "any",
|
|
@@ -1773,23 +1769,23 @@ function Re() {
|
|
|
1773
1769
|
onBlur: t.handleBlur,
|
|
1774
1770
|
onChange: (e) => t.handleChange(e.target.value),
|
|
1775
1771
|
"aria-invalid": t.state.meta.errors.length > 0
|
|
1776
|
-
}), /* @__PURE__ */
|
|
1772
|
+
}), /* @__PURE__ */ H(g.Subscribe, {
|
|
1777
1773
|
selector: (e) => [
|
|
1778
1774
|
e.values.newLimit,
|
|
1779
1775
|
e.canSubmit,
|
|
1780
1776
|
e.isSubmitting
|
|
1781
1777
|
],
|
|
1782
|
-
children: ([e, t, n]) => /* @__PURE__ */
|
|
1778
|
+
children: ([e, t, n]) => /* @__PURE__ */ H(u, {
|
|
1783
1779
|
type: "submit",
|
|
1784
1780
|
disabled: !e || !t || n,
|
|
1785
1781
|
children: n ? "Updating…" : "Update"
|
|
1786
1782
|
})
|
|
1787
1783
|
})]
|
|
1788
1784
|
}),
|
|
1789
|
-
/* @__PURE__ */
|
|
1790
|
-
/* @__PURE__ */
|
|
1785
|
+
/* @__PURE__ */ H(c, { errors: t.state.meta.errors }),
|
|
1786
|
+
/* @__PURE__ */ H("p", {
|
|
1791
1787
|
className: "text-xs text-muted-foreground",
|
|
1792
|
-
children: /* @__PURE__ */
|
|
1788
|
+
children: /* @__PURE__ */ H(e, { id: "Enter 0 to turn credit off." })
|
|
1793
1789
|
})
|
|
1794
1790
|
]
|
|
1795
1791
|
})
|
|
@@ -1802,14 +1798,14 @@ function Re() {
|
|
|
1802
1798
|
}
|
|
1803
1799
|
function $({ label: e, id: n, hint: r, children: i }) {
|
|
1804
1800
|
let { id: a } = t();
|
|
1805
|
-
return /* @__PURE__ */
|
|
1801
|
+
return /* @__PURE__ */ U("div", {
|
|
1806
1802
|
className: "grid gap-1.5",
|
|
1807
1803
|
children: [
|
|
1808
|
-
/* @__PURE__ */
|
|
1804
|
+
/* @__PURE__ */ H(y, {
|
|
1809
1805
|
htmlFor: a(n),
|
|
1810
1806
|
children: e
|
|
1811
1807
|
}),
|
|
1812
|
-
r ? /* @__PURE__ */
|
|
1808
|
+
r ? /* @__PURE__ */ H("p", {
|
|
1813
1809
|
className: "text-[13px] text-muted-foreground",
|
|
1814
1810
|
children: r
|
|
1815
1811
|
}) : null,
|
|
@@ -1817,7 +1813,6 @@ function $({ label: e, id: n, hint: r, children: i }) {
|
|
|
1817
1813
|
]
|
|
1818
1814
|
});
|
|
1819
1815
|
}
|
|
1820
|
-
|
|
1821
|
-
export { Se as SettingsPage };
|
|
1816
|
+
export { Ce as SettingsPage };
|
|
1822
1817
|
|
|
1823
|
-
//# sourceMappingURL=admin-settings-
|
|
1818
|
+
//# sourceMappingURL=admin-settings-BrvNTJlM.js.map
|