@openrails/billing-ui 0.266.0 → 0.268.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/admin/context.d.ts +10 -0
  2. package/dist/admin/lib/api/endpoints.d.ts +6 -1
  3. package/dist/admin/lib/api/index.d.ts +5 -0
  4. package/dist/admin/pages/settings/custody.d.ts +2 -0
  5. package/dist/{admin-attempts-Er03x8r3.js → admin-attempts-BLeeKABa.js} +8 -8
  6. package/dist/{admin-attempts-Er03x8r3.js.map → admin-attempts-BLeeKABa.js.map} +1 -1
  7. package/dist/{admin-auth-B0lzGq-I.js → admin-auth-DWVWxDup.js} +2 -2
  8. package/dist/{admin-auth-B0lzGq-I.js.map → admin-auth-DWVWxDup.js.map} +1 -1
  9. package/dist/{admin-badge-D9bk3V0z.js → admin-badge-CrEqD9Ew.js} +2 -2
  10. package/dist/{admin-badge-D9bk3V0z.js.map → admin-badge-CrEqD9Ew.js.map} +1 -1
  11. package/dist/{admin-button-UgWgU33l.js → admin-button-a7bDFgp0.js} +2 -2
  12. package/dist/{admin-button-UgWgU33l.js.map → admin-button-a7bDFgp0.js.map} +1 -1
  13. package/dist/{admin-capabilities-6ztIoqOe.js → admin-capabilities-QYUuJXvG.js} +2 -2
  14. package/dist/{admin-capabilities-6ztIoqOe.js.map → admin-capabilities-QYUuJXvG.js.map} +1 -1
  15. package/dist/{admin-card-T3w9wVwC.js → admin-card-D1tz8Lbh.js} +2 -2
  16. package/dist/{admin-card-T3w9wVwC.js.map → admin-card-D1tz8Lbh.js.map} +1 -1
  17. package/dist/{admin-catalog-BBMTQ4IE.js → admin-catalog-ggiDgWsR.js} +18 -18
  18. package/dist/{admin-catalog-BBMTQ4IE.js.map → admin-catalog-ggiDgWsR.js.map} +1 -1
  19. package/dist/{admin-customers-Cj9lIBFF.js → admin-customers-BVMg-gUv.js} +6 -6
  20. package/dist/{admin-customers-Cj9lIBFF.js.map → admin-customers-BVMg-gUv.js.map} +1 -1
  21. package/dist/{admin-dashboard-rDXWPRMx.js → admin-dashboard-Cc13i8i9.js} +14 -14
  22. package/dist/{admin-dashboard-rDXWPRMx.js.map → admin-dashboard-Cc13i8i9.js.map} +1 -1
  23. package/dist/{admin-data-table-tMoCx6BU.js → admin-data-table-BL84xKKF.js} +6 -6
  24. package/dist/{admin-data-table-tMoCx6BU.js.map → admin-data-table-BL84xKKF.js.map} +1 -1
  25. package/dist/{admin-detail-5tgzwBSQ.js → admin-detail-9YAep3ts.js} +460 -441
  26. package/dist/admin-detail-9YAep3ts.js.map +1 -0
  27. package/dist/{admin-detail-C_A8x02G.js → admin-detail-C8t5jBps.js} +11 -11
  28. package/dist/{admin-detail-C_A8x02G.js.map → admin-detail-C8t5jBps.js.map} +1 -1
  29. package/dist/{admin-detail-C4rto5hb.js → admin-detail-CaEwBdX9.js} +12 -12
  30. package/dist/{admin-detail-C4rto5hb.js.map → admin-detail-CaEwBdX9.js.map} +1 -1
  31. package/dist/{admin-detail-Cy4epidT.js → admin-detail-D2zcz_Xm.js} +15 -15
  32. package/dist/{admin-detail-Cy4epidT.js.map → admin-detail-D2zcz_Xm.js.map} +1 -1
  33. package/dist/{admin-dialog-DSB8NTS8.js → admin-dialog-CiAw5vx-.js} +3 -3
  34. package/dist/{admin-dialog-DSB8NTS8.js.map → admin-dialog-CiAw5vx-.js.map} +1 -1
  35. package/dist/{admin-dom-swaG6h-Z.js → admin-dom-VkcwevWr.js} +4 -4
  36. package/dist/{admin-dom-swaG6h-Z.js.map → admin-dom-VkcwevWr.js.map} +1 -1
  37. package/dist/{admin-dropdown-menu-BiJgFZEK.js → admin-dropdown-menu-CYJbmqK2.js} +2 -2
  38. package/dist/{admin-dropdown-menu-BiJgFZEK.js.map → admin-dropdown-menu-CYJbmqK2.js.map} +1 -1
  39. package/dist/{admin-fact-card-DOmtzhDS.js → admin-fact-card-BHTpDlaX.js} +2 -2
  40. package/dist/{admin-fact-card-DOmtzhDS.js.map → admin-fact-card-BHTpDlaX.js.map} +1 -1
  41. package/dist/{admin-health-Cb_vCGip.js → admin-health-BUnjbvYR.js} +9 -9
  42. package/dist/{admin-health-Cb_vCGip.js.map → admin-health-BUnjbvYR.js.map} +1 -1
  43. package/dist/{admin-input-B6FrJxfC.js → admin-input-C-S_RGGo.js} +2 -2
  44. package/dist/{admin-input-B6FrJxfC.js.map → admin-input-C-S_RGGo.js.map} +1 -1
  45. package/dist/{admin-label-BYiPss0j.js → admin-label-DPVYDdSO.js} +2 -2
  46. package/dist/{admin-label-BYiPss0j.js.map → admin-label-DPVYDdSO.js.map} +1 -1
  47. package/dist/{admin-linked-table-row-g5Q4eMOC.js → admin-linked-table-row-D-gbTT7a.js} +4 -4
  48. package/dist/{admin-linked-table-row-g5Q4eMOC.js.map → admin-linked-table-row-D-gbTT7a.js.map} +1 -1
  49. package/dist/{admin-metering-BznnYhgX.js → admin-metering-BjbL0jjT.js} +14 -14
  50. package/dist/{admin-metering-BznnYhgX.js.map → admin-metering-BjbL0jjT.js.map} +1 -1
  51. package/dist/{admin-ops-DOCIYTjD.js → admin-ops-DT8epiXg.js} +11 -11
  52. package/dist/{admin-ops-DOCIYTjD.js.map → admin-ops-DT8epiXg.js.map} +1 -1
  53. package/dist/{admin-orders-DYbdiO07.js → admin-orders-BVW9-Fs9.js} +8 -8
  54. package/dist/{admin-orders-DYbdiO07.js.map → admin-orders-BVW9-Fs9.js.map} +1 -1
  55. package/dist/{admin-payments-DQgZR7J5.js → admin-payments-C5MsFFmm.js} +9 -9
  56. package/dist/{admin-payments-DQgZR7J5.js.map → admin-payments-C5MsFFmm.js.map} +1 -1
  57. package/dist/{admin-price-detail-BvUo5pVr.js → admin-price-detail-D517JYHB.js} +9 -9
  58. package/dist/{admin-price-detail-BvUo5pVr.js.map → admin-price-detail-D517JYHB.js.map} +1 -1
  59. package/dist/{admin-price-wizard-D8c-vvzV.js → admin-price-wizard-bj36o3ux.js} +7 -7
  60. package/dist/{admin-price-wizard-D8c-vvzV.js.map → admin-price-wizard-bj36o3ux.js.map} +1 -1
  61. package/dist/{admin-range-picker-C2lZ51RS.js → admin-range-picker-D2aFF8IV.js} +5 -5
  62. package/dist/{admin-range-picker-C2lZ51RS.js.map → admin-range-picker-D2aFF8IV.js.map} +1 -1
  63. package/dist/{admin-reports-CYwfX2qK.js → admin-reports-D-ob04d4.js} +8 -8
  64. package/dist/{admin-reports-CYwfX2qK.js.map → admin-reports-D-ob04d4.js.map} +1 -1
  65. package/dist/{admin-select-OMB6gB61.js → admin-select-C8O7nx72.js} +2 -2
  66. package/dist/{admin-select-OMB6gB61.js.map → admin-select-C8O7nx72.js.map} +1 -1
  67. package/dist/{admin-settings-Bw49HU8g.js → admin-settings-Bs6cLcqi.js} +374 -98
  68. package/dist/admin-settings-Bs6cLcqi.js.map +1 -0
  69. package/dist/{admin-skeleton-DeY6aCVy.js → admin-skeleton-wfocg2PJ.js} +2 -2
  70. package/dist/{admin-skeleton-DeY6aCVy.js.map → admin-skeleton-wfocg2PJ.js.map} +1 -1
  71. package/dist/{admin-status-badge-DENiR55N.js → admin-status-badge-D_gDMrht.js} +2 -2
  72. package/dist/{admin-status-badge-DENiR55N.js.map → admin-status-badge-D_gDMrht.js.map} +1 -1
  73. package/dist/{admin-subscriptions-BU3WGg3F.js → admin-subscriptions-DYR1RGMO.js} +9 -9
  74. package/dist/{admin-subscriptions-BU3WGg3F.js.map → admin-subscriptions-DYR1RGMO.js.map} +1 -1
  75. package/dist/{admin-switch-DLdWpESJ.js → admin-switch-F5D0AYjT.js} +2 -2
  76. package/dist/{admin-switch-DLdWpESJ.js.map → admin-switch-F5D0AYjT.js.map} +1 -1
  77. package/dist/{admin-table-BRh16qQu.js → admin-table-nUij5fLc.js} +2 -2
  78. package/dist/{admin-table-BRh16qQu.js.map → admin-table-nUij5fLc.js.map} +1 -1
  79. package/dist/{admin-tabs-BXJWVtU7.js → admin-tabs-C3myjKdr.js} +2 -2
  80. package/dist/{admin-tabs-BXJWVtU7.js.map → admin-tabs-C3myjKdr.js.map} +1 -1
  81. package/dist/{admin-textarea-Dv8Ob7H2.js → admin-textarea-v-L-PXIc.js} +2 -2
  82. package/dist/{admin-textarea-Dv8Ob7H2.js.map → admin-textarea-v-L-PXIc.js.map} +1 -1
  83. package/dist/{admin-typed-confirm-dialog-D0R5nKD0.js → admin-typed-confirm-dialog-BLgpuikW.js} +6 -6
  84. package/dist/{admin-typed-confirm-dialog-D0R5nKD0.js.map → admin-typed-confirm-dialog-BLgpuikW.js.map} +1 -1
  85. package/dist/{admin-utils-BE_Zb14A.js → admin-utils-6yE4YIVI.js} +22 -16
  86. package/dist/admin-utils-6yE4YIVI.js.map +1 -0
  87. package/dist/{admin-widget-viz-BvejlYLH.js → admin-widget-viz-BiEfckd4.js} +3 -3
  88. package/dist/{admin-widget-viz-BvejlYLH.js.map → admin-widget-viz-BiEfckd4.js.map} +1 -1
  89. package/dist/admin.css +1 -1
  90. package/dist/admin.js +30 -30
  91. package/dist/admin.js.map +1 -1
  92. package/dist/client/client.d.ts +4 -14
  93. package/dist/client/generated/error-codes.d.ts +1 -1
  94. package/dist/client/generated/routes.d.ts +82 -270
  95. package/dist/client/generated/wire.d.ts +30 -38
  96. package/dist/client/index.d.ts +1 -1
  97. package/dist/client/types.d.ts +13 -22
  98. package/dist/{client-BzxvN5zw.js → client-BYgnI6_h.js} +59 -76
  99. package/dist/client-BYgnI6_h.js.map +1 -0
  100. package/dist/client.js +1 -1
  101. package/dist/{hooks-Cc95yC4f.js → hooks-t2tSrCpa.js} +2 -2
  102. package/dist/{hooks-Cc95yC4f.js.map → hooks-t2tSrCpa.js.map} +1 -1
  103. package/dist/index.js +3 -3
  104. package/dist/react.js +1 -1
  105. package/dist/styles.css +1 -1
  106. package/package.json +1 -1
  107. package/dist/admin-detail-5tgzwBSQ.js.map +0 -1
  108. package/dist/admin-settings-Bw49HU8g.js.map +0 -1
  109. package/dist/admin-utils-BE_Zb14A.js.map +0 -1
  110. package/dist/client-BzxvN5zw.js.map +0 -1
@@ -1,19 +1,19 @@
1
- import { E as e, S as t, f as n, l as r, p as i, w as a } from "./admin-utils-BE_Zb14A.js";
2
- import { t as o } from "./admin-button-UgWgU33l.js";
3
- import { t as s } from "./admin-input-B6FrJxfC.js";
4
- import { a as c, i as l, l as u, n as d, u as f } from "./admin-capabilities-6ztIoqOe.js";
1
+ import { E as e, S as t, f as n, l as r, p as i, w as a } from "./admin-utils-6yE4YIVI.js";
2
+ import { t as o } from "./admin-button-a7bDFgp0.js";
3
+ import { t as s } from "./admin-input-C-S_RGGo.js";
4
+ import { a as c, i as l, l as u, n as d, u as f } from "./admin-capabilities-QYUuJXvG.js";
5
5
  import { n as p, o as m, s as h, t as g } from "./admin-format-DoohJ7Fg.js";
6
6
  import { n as _ } from "./admin-confirm-katGq0Qo.js";
7
7
  import { t as v } from "./admin-form-field-errors-hbUMIriS.js";
8
- import { a as y, i as b, n as x, r as S, t as C } from "./admin-select-OMB6gB61.js";
9
- import { a as w, n as ee, o as te, r as T, s as E, t as ne } from "./admin-table-BRh16qQu.js";
10
- import { t as D } from "./admin-badge-D9bk3V0z.js";
11
- import { a as O, i as k, n as A, o as j, r as M, s as N, t as P } from "./admin-dialog-DSB8NTS8.js";
12
- import { t as F } from "./admin-label-BYiPss0j.js";
13
- import { t as re } from "./admin-switch-DLdWpESJ.js";
8
+ import { a as y, i as b, n as x, r as S, t as C } from "./admin-select-C8O7nx72.js";
9
+ import { a as w, n as ee, o as te, r as T, s as E, t as ne } from "./admin-table-nUij5fLc.js";
10
+ import { t as D } from "./admin-badge-CrEqD9Ew.js";
11
+ import { a as O, i as k, n as A, o as j, r as M, s as N, t as P } from "./admin-dialog-CiAw5vx-.js";
12
+ import { t as F } from "./admin-label-DPVYDdSO.js";
13
+ import { t as re } from "./admin-switch-F5D0AYjT.js";
14
14
  import { n as I } from "./admin-dialog-width-BPrgdYlj.js";
15
- import { i as L, n as R, r as ie, t as ae } from "./admin-tabs-BXJWVtU7.js";
16
- import { t as oe } from "./admin-typed-confirm-dialog-D0R5nKD0.js";
15
+ import { i as L, n as R, r as ie, t as ae } from "./admin-tabs-C3myjKdr.js";
16
+ import { t as oe } from "./admin-typed-confirm-dialog-BLgpuikW.js";
17
17
  import * as z from "react";
18
18
  import { useMutation as B, useQuery as V, useQueryClient as H } from "@tanstack/react-query";
19
19
  import { Fragment as U, jsx as W, jsxs as G } from "react/jsx-runtime";
@@ -477,9 +477,281 @@ function he({ webhook: t }) {
477
477
  });
478
478
  }
479
479
  //#endregion
480
+ //#region src/admin/pages/settings/custody.tsx
481
+ function ge() {
482
+ let e = i(), t = H(), n = f(), r = V(e.adminQueries.merchantConfiguration()), a = V(e.adminQueries.psps()), s = [...e.queryKeys.settings(), "custodians"], c = V({
483
+ queryKey: s,
484
+ queryFn: ({ signal: t }) => e.listCustodians(t)
485
+ }), [l, u] = z.useState(null), [d] = z.useState(() => e.selectedMerchant()), p = () => t.invalidateQueries({ queryKey: e.queryKeys.settings() }), m = B({
486
+ mutationFn: async ({ psp: t, custody: n }) => {
487
+ if (d !== e.selectedMerchant()) throw Error("Merchant changed; reopen settings");
488
+ let r = a.data?.data.find((e) => e.id === t);
489
+ if (!r) throw Error("PSP is no longer available");
490
+ return e.updatePSP(t, {
491
+ expected_revision: r.revision,
492
+ custodian: n
493
+ });
494
+ },
495
+ onSuccess: p,
496
+ onError: (t) => e.toastApiError(t, "Change card custody")
497
+ }), h = B({
498
+ mutationFn: async (t) => {
499
+ if (!r.data || d !== e.selectedMerchant()) throw Error("Merchant changed; reopen settings");
500
+ return e.updateMerchantConfiguration({
501
+ expected_revision: r.data.revision,
502
+ card_vault: String(t.get("card_vault") ?? ""),
503
+ charge_psps: t.getAll("charge_psps").map(String)
504
+ });
505
+ },
506
+ onSuccess: p,
507
+ onError: (t) => e.toastApiError(t, "Save card routing")
508
+ });
509
+ if (!r.data || !a.data || !c.data) return null;
510
+ let g = a.data.data.filter((e) => !e.archived && (e.rail === "nmi" || e.rail === "stripe"));
511
+ return /* @__PURE__ */ G("section", {
512
+ className: "grid gap-5",
513
+ "aria-label": "Card vaults",
514
+ children: [
515
+ /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("h2", {
516
+ className: "text-base font-semibold",
517
+ children: "Card vaults"
518
+ }), /* @__PURE__ */ W("p", {
519
+ className: "text-sm text-muted-foreground",
520
+ children: "Choose where new cards are stored and which accounts charge them. Existing cards and subscriptions keep their accepted custody."
521
+ })] }),
522
+ /* @__PURE__ */ W("ul", {
523
+ className: "grid gap-2",
524
+ children: c.data.data.map((e) => /* @__PURE__ */ G("li", {
525
+ className: "flex flex-wrap items-center justify-between gap-3 rounded border p-3",
526
+ children: [/* @__PURE__ */ G("div", { children: [
527
+ /* @__PURE__ */ W("strong", { children: e.key }),
528
+ " · Basis Theory · ",
529
+ e.environment,
530
+ /* @__PURE__ */ W("br", {}),
531
+ /* @__PURE__ */ G("span", {
532
+ className: "text-sm text-muted-foreground",
533
+ children: [
534
+ e.account_id,
535
+ " ·",
536
+ " ",
537
+ e.credentials?.api_key?.configured ? "Credential configured" : "Credential missing"
538
+ ]
539
+ })
540
+ ] }), n && !e.archived && /* @__PURE__ */ W(o, {
541
+ size: "sm",
542
+ variant: "outline",
543
+ onClick: () => u(e),
544
+ children: "Edit vault"
545
+ })]
546
+ }, e.key))
547
+ }),
548
+ n && /* @__PURE__ */ W(o, {
549
+ className: "justify-self-start",
550
+ variant: "outline",
551
+ onClick: () => u("new"),
552
+ children: "Add Basis Theory vault"
553
+ }),
554
+ l && /* @__PURE__ */ W(_e, {
555
+ current: l === "new" ? void 0 : l,
556
+ close: () => u(null),
557
+ saved: p
558
+ }, l === "new" ? "new" : `${l.key}:${l.revision}`),
559
+ g.filter((e) => e.rail === "nmi").map((e) => /* @__PURE__ */ G(F, {
560
+ className: "grid gap-2",
561
+ children: [
562
+ e.key,
563
+ ": card storage",
564
+ /* @__PURE__ */ G("select", {
565
+ className: "rounded border bg-background p-2",
566
+ "aria-label": `${e.key} card storage`,
567
+ disabled: !n || m.isPending,
568
+ value: e.custodian ?? "",
569
+ onChange: (t) => m.mutate({
570
+ psp: e.id,
571
+ custody: t.target.value
572
+ }),
573
+ children: [/* @__PURE__ */ W("option", {
574
+ value: "",
575
+ children: "NMI customer vault"
576
+ }), c.data.data.filter((t) => !t.archived && t.environment === e.environment).map((e) => /* @__PURE__ */ G("option", {
577
+ value: e.key,
578
+ children: [e.key, " · Basis Theory"]
579
+ }, e.key))]
580
+ })
581
+ ]
582
+ }, e.id)),
583
+ /* @__PURE__ */ G("form", {
584
+ className: "grid gap-3",
585
+ onSubmit: (e) => {
586
+ e.preventDefault(), h.mutate(new FormData(e.currentTarget));
587
+ },
588
+ children: [
589
+ /* @__PURE__ */ G(F, {
590
+ className: "grid gap-2",
591
+ children: ["Vault for new cards", /* @__PURE__ */ G("select", {
592
+ name: "card_vault",
593
+ className: "rounded border bg-background p-2",
594
+ defaultValue: r.data.card_vault ?? "",
595
+ disabled: !n,
596
+ children: [
597
+ /* @__PURE__ */ W("option", {
598
+ value: "",
599
+ children: "No card vault selected"
600
+ }),
601
+ r.data.platform_vault.available && /* @__PURE__ */ W("option", {
602
+ value: "platform",
603
+ children: "Hosted vault · isolated to this merchant"
604
+ }),
605
+ g.map((e) => /* @__PURE__ */ G("option", {
606
+ value: e.key,
607
+ children: [
608
+ e.key,
609
+ " ·",
610
+ " ",
611
+ e.custodian ? "Basis Theory" : e.rail === "stripe" ? "Stripe" : "NMI customer vault"
612
+ ]
613
+ }, e.id))
614
+ ]
615
+ })]
616
+ }),
617
+ /* @__PURE__ */ G("fieldset", {
618
+ className: "grid gap-2",
619
+ disabled: !n,
620
+ children: [
621
+ /* @__PURE__ */ W("legend", {
622
+ className: "mb-2 font-medium",
623
+ children: "Charge PSPs"
624
+ }),
625
+ /* @__PURE__ */ W("p", {
626
+ className: "text-sm text-muted-foreground",
627
+ children: "Select the accounts allowed for new charges. With none selected, routing considers all eligible accounts."
628
+ }),
629
+ g.map((e) => /* @__PURE__ */ G(F, {
630
+ className: "flex gap-2",
631
+ children: [/* @__PURE__ */ W("input", {
632
+ type: "checkbox",
633
+ name: "charge_psps",
634
+ value: e.key,
635
+ defaultChecked: r.data?.charge_psps?.includes(e.key) ?? !1
636
+ }), e.key]
637
+ }, e.id))
638
+ ]
639
+ }),
640
+ n && /* @__PURE__ */ W(o, {
641
+ className: "justify-self-start",
642
+ disabled: h.isPending,
643
+ type: "submit",
644
+ children: "Save card routing"
645
+ })
646
+ ]
647
+ }, `routing:${r.data.revision}`)
648
+ ]
649
+ });
650
+ }
651
+ function _e({ current: e, close: t, saved: n }) {
652
+ let r = i(), [a] = z.useState(() => r.selectedMerchant()), c = B({
653
+ mutationFn: async (t) => {
654
+ if (a !== r.selectedMerchant()) throw Error("Merchant changed; reopen this form");
655
+ let n = String(t.get("private_key") ?? "").trim();
656
+ return r.putCustodian(e?.key ?? String(t.get("key") ?? "").trim(), {
657
+ expected_revision: e?.revision ?? 0,
658
+ kind: "basis_theory",
659
+ environment: e?.environment ?? String(t.get("environment") ?? "test"),
660
+ account_id: e?.account_id ?? String(t.get("account_id") ?? "").trim(),
661
+ settings: {
662
+ ...e?.settings ?? {},
663
+ public_api_key: String(t.get("public_key") ?? "").trim()
664
+ },
665
+ ...n ? { credentials: { api_key: n } } : {}
666
+ });
667
+ },
668
+ onSuccess: async () => {
669
+ await n(), t();
670
+ },
671
+ onError: (e) => r.toastApiError(e, "Configure vault")
672
+ });
673
+ return /* @__PURE__ */ G("form", {
674
+ className: "grid gap-3 rounded border p-4",
675
+ onSubmit: (e) => {
676
+ e.preventDefault(), c.mutate(new FormData(e.currentTarget));
677
+ },
678
+ children: [
679
+ /* @__PURE__ */ W("h3", {
680
+ className: "font-medium",
681
+ children: e ? `Edit ${e.key}` : "Add Basis Theory vault"
682
+ }),
683
+ !e && /* @__PURE__ */ G(U, { children: [
684
+ /* @__PURE__ */ G(F, {
685
+ className: "grid gap-1",
686
+ children: ["Vault key", /* @__PURE__ */ W(s, {
687
+ name: "key",
688
+ required: !0,
689
+ pattern: "[a-z0-9_-]{1,63}"
690
+ })]
691
+ }),
692
+ /* @__PURE__ */ G(F, {
693
+ className: "grid gap-1",
694
+ children: ["Environment", /* @__PURE__ */ G("select", {
695
+ name: "environment",
696
+ className: "rounded border bg-background p-2",
697
+ children: [/* @__PURE__ */ W("option", {
698
+ value: "test",
699
+ children: "Test"
700
+ }), /* @__PURE__ */ W("option", {
701
+ value: "live",
702
+ children: "Live"
703
+ })]
704
+ })]
705
+ }),
706
+ /* @__PURE__ */ G(F, {
707
+ className: "grid gap-1",
708
+ children: ["Basis Theory tenant ID", /* @__PURE__ */ W(s, {
709
+ name: "account_id",
710
+ required: !0
711
+ })]
712
+ })
713
+ ] }),
714
+ /* @__PURE__ */ G(F, {
715
+ className: "grid gap-1",
716
+ children: ["Public collection key", /* @__PURE__ */ W(s, {
717
+ name: "public_key",
718
+ required: !0,
719
+ defaultValue: String(e?.settings?.public_api_key ?? "")
720
+ })]
721
+ }),
722
+ /* @__PURE__ */ G(F, {
723
+ className: "grid gap-1",
724
+ children: ["Private API key", /* @__PURE__ */ W(s, {
725
+ type: "password",
726
+ name: "private_key",
727
+ autoComplete: "new-password",
728
+ required: !e
729
+ })]
730
+ }),
731
+ /* @__PURE__ */ W("p", {
732
+ className: "text-sm text-muted-foreground",
733
+ 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
+ }),
735
+ /* @__PURE__ */ G("div", {
736
+ className: "flex gap-2",
737
+ children: [/* @__PURE__ */ W(o, {
738
+ type: "submit",
739
+ disabled: c.isPending,
740
+ children: "Validate and save vault"
741
+ }), /* @__PURE__ */ W(o, {
742
+ type: "button",
743
+ variant: "outline",
744
+ onClick: t,
745
+ children: "Cancel"
746
+ })]
747
+ })
748
+ ]
749
+ });
750
+ }
751
+ //#endregion
480
752
  //#region src/admin/pages/settings/index.tsx
481
753
  var Q = "flex-none px-0 after:bg-primary group-data-horizontal/tabs:after:bottom-[-1px]";
482
- function ge() {
754
+ function ve() {
483
755
  let [e, t] = r(), i = u(), o = l(), s = n().props.settingsTabs ?? [], c = s.map((e) => e.value), f = d(null, i, o, c), p = d(e.get("tab"), i, o, c);
484
756
  return /* @__PURE__ */ G(ae, {
485
757
  value: p,
@@ -525,7 +797,7 @@ function ge() {
525
797
  }),
526
798
  i && /* @__PURE__ */ W(R, {
527
799
  value: "merchant",
528
- children: /* @__PURE__ */ W(_e, {})
800
+ children: /* @__PURE__ */ W(ye, {})
529
801
  }),
530
802
  i && /* @__PURE__ */ W(R, {
531
803
  value: "notifications",
@@ -533,11 +805,11 @@ function ge() {
533
805
  }),
534
806
  i && /* @__PURE__ */ W(R, {
535
807
  value: "psps",
536
- children: /* @__PURE__ */ W(be, {})
808
+ children: /* @__PURE__ */ W(Se, {})
537
809
  }),
538
810
  o && /* @__PURE__ */ W(R, {
539
811
  value: "customer-controls",
540
- children: /* @__PURE__ */ W(Me, {})
812
+ children: /* @__PURE__ */ W(Pe, {})
541
813
  }),
542
814
  s.map((e) => /* @__PURE__ */ W(R, {
543
815
  value: e.value,
@@ -546,17 +818,17 @@ function ge() {
546
818
  ]
547
819
  });
548
820
  }
549
- function _e() {
821
+ function ye() {
550
822
  let { adminQueries: e } = i(), { data: t } = V(e.merchantConfiguration("Load settings")), n = f();
551
823
  return t ? /* @__PURE__ */ G("div", {
552
824
  className: "grid gap-10",
553
825
  children: [
554
826
  /* @__PURE__ */ W(J, {}),
555
- /* @__PURE__ */ W(ve, {
827
+ /* @__PURE__ */ W(be, {
556
828
  configuration: t,
557
829
  edits: n
558
830
  }),
559
- /* @__PURE__ */ W(ye, {
831
+ /* @__PURE__ */ W(xe, {
560
832
  configuration: t,
561
833
  edits: n
562
834
  })
@@ -566,7 +838,7 @@ function _e() {
566
838
  children: /* @__PURE__ */ W(a, { id: "Loading…" })
567
839
  });
568
840
  }
569
- function ve({ configuration: t, edits: n }) {
841
+ function be({ configuration: t, edits: n }) {
570
842
  let { id: r, text: i } = e(), o = t.profile, c = () => ({
571
843
  displayName: t.display_name,
572
844
  fromEmail: o?.from_email ?? "",
@@ -747,7 +1019,7 @@ function ve({ configuration: t, edits: n }) {
747
1019
  })]
748
1020
  });
749
1021
  }
750
- function ye({ configuration: t, edits: n }) {
1022
+ function xe({ configuration: t, edits: n }) {
751
1023
  let { id: r, text: i } = e(), o = t.reprice_notice_window_days ?? 30, c = q(t), l = K({
752
1024
  defaultValues: { days: String(o) },
753
1025
  onSubmit: ({ value: e }) => c.save({ reprice_notice_window_days: Number(e.days) }, "Notice window saved", "Save notice window")
@@ -814,7 +1086,7 @@ function ye({ configuration: t, edits: n }) {
814
1086
  }) })]
815
1087
  });
816
1088
  }
817
- function be() {
1089
+ function Se() {
818
1090
  let { selectedMerchant: e, adminQueries: t } = i(), n = V(t.psps()), r = V(t.rails()), o = f();
819
1091
  if (n.isPending || r.isPending) return /* @__PURE__ */ W("p", {
820
1092
  className: "text-sm text-muted-foreground",
@@ -823,62 +1095,66 @@ function be() {
823
1095
  let s = r.data ?? [];
824
1096
  return /* @__PURE__ */ G("div", {
825
1097
  className: "grid gap-6",
826
- children: [/* @__PURE__ */ W(J, {}), /* @__PURE__ */ G("section", {
827
- className: "grid gap-5",
828
- children: [/* @__PURE__ */ G("div", {
829
- className: "flex flex-wrap items-start justify-between gap-4",
1098
+ children: [
1099
+ /* @__PURE__ */ W(J, {}),
1100
+ /* @__PURE__ */ G("section", {
1101
+ className: "grid gap-5",
830
1102
  children: [/* @__PURE__ */ G("div", {
831
- className: "grid gap-1",
832
- children: [/* @__PURE__ */ W("h2", {
833
- className: "text-base font-semibold",
834
- children: /* @__PURE__ */ W(a, { id: "PSPs" })
835
- }), /* @__PURE__ */ W("p", {
836
- className: "text-sm text-muted-foreground",
837
- children: /* @__PURE__ */ W(a, { id: "The accounts this merchant takes payments through, one or more per rail." })
838
- })]
839
- }), o && /* @__PURE__ */ W(je, { railDefinitions: s }, e() ?? "")]
840
- }), n.data?.data?.length ? /* @__PURE__ */ G(ne, {
841
- className: "min-w-[44rem]",
842
- children: [/* @__PURE__ */ W(te, { children: /* @__PURE__ */ G(E, {
843
- className: "hover:bg-transparent",
844
- children: [
845
- /* @__PURE__ */ W(w, {
846
- className: "text-muted-foreground",
847
- children: "PSP"
848
- }),
849
- /* @__PURE__ */ W(w, {
850
- className: "text-muted-foreground",
851
- children: /* @__PURE__ */ W(a, { id: "Environment" })
852
- }),
853
- /* @__PURE__ */ W(w, {
854
- className: "text-muted-foreground",
855
- children: /* @__PURE__ */ W(a, { id: "Credentials" })
856
- }),
857
- /* @__PURE__ */ W(w, {
858
- className: "text-muted-foreground",
859
- children: /* @__PURE__ */ W(a, { id: "State" })
860
- }),
861
- o && /* @__PURE__ */ W(w, {
862
- className: "text-right text-muted-foreground",
863
- children: /* @__PURE__ */ W(a, { id: "Action" })
864
- })
865
- ]
866
- }) }), /* @__PURE__ */ W(ee, { children: n.data.data.map((e) => /* @__PURE__ */ W(Se, {
867
- psp: e,
868
- railDefinitions: s,
869
- edits: o
870
- }, e.id)) })]
871
- }) : /* @__PURE__ */ W("p", {
872
- className: "py-2 text-sm text-muted-foreground",
873
- children: /* @__PURE__ */ W(a, { id: "No PSPs configured." })
874
- })]
875
- })]
1103
+ className: "flex flex-wrap items-start justify-between gap-4",
1104
+ children: [/* @__PURE__ */ G("div", {
1105
+ className: "grid gap-1",
1106
+ children: [/* @__PURE__ */ W("h2", {
1107
+ className: "text-base font-semibold",
1108
+ children: /* @__PURE__ */ W(a, { id: "PSPs" })
1109
+ }), /* @__PURE__ */ W("p", {
1110
+ className: "text-sm text-muted-foreground",
1111
+ children: /* @__PURE__ */ W(a, { id: "The accounts this merchant takes payments through, one or more per rail." })
1112
+ })]
1113
+ }), o && /* @__PURE__ */ W(Ne, { railDefinitions: s }, e() ?? "")]
1114
+ }), n.data?.data?.length ? /* @__PURE__ */ G(ne, {
1115
+ className: "min-w-[44rem]",
1116
+ children: [/* @__PURE__ */ W(te, { children: /* @__PURE__ */ G(E, {
1117
+ className: "hover:bg-transparent",
1118
+ children: [
1119
+ /* @__PURE__ */ W(w, {
1120
+ className: "text-muted-foreground",
1121
+ children: "PSP"
1122
+ }),
1123
+ /* @__PURE__ */ W(w, {
1124
+ className: "text-muted-foreground",
1125
+ children: /* @__PURE__ */ W(a, { id: "Environment" })
1126
+ }),
1127
+ /* @__PURE__ */ W(w, {
1128
+ className: "text-muted-foreground",
1129
+ children: /* @__PURE__ */ W(a, { id: "Credentials" })
1130
+ }),
1131
+ /* @__PURE__ */ W(w, {
1132
+ className: "text-muted-foreground",
1133
+ children: /* @__PURE__ */ W(a, { id: "State" })
1134
+ }),
1135
+ o && /* @__PURE__ */ W(w, {
1136
+ className: "text-right text-muted-foreground",
1137
+ children: /* @__PURE__ */ W(a, { id: "Action" })
1138
+ })
1139
+ ]
1140
+ }) }), /* @__PURE__ */ W(ee, { children: n.data.data.map((e) => /* @__PURE__ */ W(we, {
1141
+ psp: e,
1142
+ railDefinitions: s,
1143
+ edits: o
1144
+ }, e.id)) })]
1145
+ }) : /* @__PURE__ */ W("p", {
1146
+ className: "py-2 text-sm text-muted-foreground",
1147
+ children: /* @__PURE__ */ W(a, { id: "No PSPs configured." })
1148
+ })]
1149
+ }),
1150
+ /* @__PURE__ */ W(ge, {})
1151
+ ]
876
1152
  });
877
1153
  }
878
- function xe(e) {
1154
+ function Ce(e) {
879
1155
  return e.validated_at ? `Validated ${m(e.validated_at)}` : e.configured ? "Configured" : "Not configured";
880
1156
  }
881
- function Se({ psp: n, railDefinitions: r, edits: s }) {
1157
+ function we({ psp: n, railDefinitions: r, edits: s }) {
882
1158
  let { toast: c, toastApiError: l, toastStaleEdit: u, adminMutations: d, selectedMerchant: f } = i(), { text: p } = e(), m = H(), h = B(d.updatePSP(m)), [g, v] = z.useState(!1), y = _(), b = r.find((e) => e.rail === n.rail), x = b?.display_name ?? n.rail, S = n.credentials ?? {}, C = async (e) => {
883
1159
  if (!(!e && !await y({
884
1160
  title: `Archive ${n.key}?`,
@@ -920,7 +1196,7 @@ function Se({ psp: n, railDefinitions: r, edits: s }) {
920
1196
  children: [
921
1197
  x,
922
1198
  " · ",
923
- Te(n)
1199
+ De(n)
924
1200
  ]
925
1201
  })]
926
1202
  })
@@ -936,7 +1212,7 @@ function Se({ psp: n, railDefinitions: r, edits: s }) {
936
1212
  children: Object.entries(S).map(([e, t]) => /* @__PURE__ */ W(D, {
937
1213
  variant: "secondary",
938
1214
  className: t.configured ? "" : "bg-held-surface text-held",
939
- title: xe(t),
1215
+ title: Ce(t),
940
1216
  children: e
941
1217
  }, e))
942
1218
  }) : /* @__PURE__ */ W("span", {
@@ -968,7 +1244,7 @@ function Se({ psp: n, railDefinitions: r, edits: s }) {
968
1244
  children: !n.archived && /* @__PURE__ */ G("div", {
969
1245
  className: "flex justify-end gap-2",
970
1246
  children: [
971
- /* @__PURE__ */ W(Ce, {
1247
+ /* @__PURE__ */ W(Te, {
972
1248
  psp: n,
973
1249
  credentialKeys: b?.credential_keys ?? Object.keys(S)
974
1250
  }, `${f() ?? ""}:${n.id}`),
@@ -994,7 +1270,7 @@ function Se({ psp: n, railDefinitions: r, edits: s }) {
994
1270
  ]
995
1271
  });
996
1272
  }
997
- function Ce({ psp: n, credentialKeys: r }) {
1273
+ function Te({ psp: n, credentialKeys: r }) {
998
1274
  let { toast: c, toastApiError: l, toastStaleEdit: u, adminMutations: d, selectedMerchant: f } = i(), { id: p } = e(), [h, g] = z.useState(!1), [_] = z.useState(() => f() ?? ""), v = z.useRef(n.revision), y = H(), b = B(d.updatePSP(y)), x = n.credentials ?? {}, S = K({
999
1275
  defaultValues: { credentials: {} },
1000
1276
  onSubmit: async ({ value: e }) => {
@@ -1034,7 +1310,7 @@ function Ce({ psp: n, credentialKeys: r }) {
1034
1310
  /* @__PURE__ */ W(a, { id: "Rotate " }),
1035
1311
  n.key,
1036
1312
  /* @__PURE__ */ W(a, { id: " credentials · " }),
1037
- Te(n)
1313
+ De(n)
1038
1314
  ] }), /* @__PURE__ */ W(M, { children: /* @__PURE__ */ W(a, { id: "Current credentials are never shown. A new one is validated against the live provider before it is stored; if that check fails, nothing is written. Leave a field blank to keep the credential it holds now." }) })] }), /* @__PURE__ */ G("form", {
1039
1315
  onSubmit: (e) => {
1040
1316
  e.preventDefault(), e.stopPropagation(), S.handleSubmit();
@@ -1081,7 +1357,7 @@ function Ce({ psp: n, credentialKeys: r }) {
1081
1357
  })]
1082
1358
  });
1083
1359
  }
1084
- var we = {
1360
+ var Ee = {
1085
1361
  gateway_id: {
1086
1362
  label: "Gateway ID",
1087
1363
  hint: "The Gateway ID shown in your NMI dashboard."
@@ -1103,35 +1379,35 @@ var we = {
1103
1379
  hint: "The Solana address your payments land in."
1104
1380
  }
1105
1381
  };
1106
- function Te(e) {
1382
+ function De(e) {
1107
1383
  return e.client_accnum ? `${e.client_accnum}-${e.client_subacc ?? ""}` : e.gateway_id ?? e.account_id ?? e.treasury ?? "";
1108
1384
  }
1109
- var Ee = {
1385
+ var Oe = {
1110
1386
  live: "Live: real money",
1111
1387
  test: "Test: the provider's own system, no money moves",
1112
1388
  sandbox: "Sandbox: the provider's separate sandbox",
1113
1389
  mainnet: "Mainnet: real money",
1114
1390
  devnet: "Devnet: Solana's development network",
1115
1391
  testnet: "Testnet: Solana's test network"
1116
- }, De = {
1392
+ }, ke = {
1117
1393
  nmi: "NMI",
1118
1394
  ccbill: "CCBill",
1119
1395
  stripe: "Stripe",
1120
1396
  solana: "Solana"
1121
1397
  };
1122
- function Oe(e, t) {
1123
- let n = De[e] ?? e;
1398
+ function Ae(e, t) {
1399
+ let n = ke[e] ?? e;
1124
1400
  return !t || t.toLowerCase() === n.toLowerCase() ? n : `${t} (${n})`;
1125
1401
  }
1126
- var ke = {
1402
+ var je = {
1127
1403
  api: "API",
1128
1404
  id: "ID",
1129
1405
  url: "URL"
1130
1406
  };
1131
- function Ae(e) {
1132
- return e.split(/[_-]+/).filter(Boolean).map((e, t) => ke[e.toLowerCase()] || (t > 0 ? e.toLowerCase() : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase())).join(" ");
1407
+ function Me(e) {
1408
+ return e.split(/[_-]+/).filter(Boolean).map((e, t) => je[e.toLowerCase()] || (t > 0 ? e.toLowerCase() : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase())).join(" ");
1133
1409
  }
1134
- function je({ railDefinitions: t }) {
1410
+ function Ne({ railDefinitions: t }) {
1135
1411
  let { toast: n, toastApiError: r, adminMutations: c, selectedMerchant: l } = i(), { text: u, id: d } = e(), [f, p] = z.useState(!1), [m] = z.useState(() => l() ?? ""), h = H(), g = B(c.createPSP(h)), _ = K({
1136
1412
  defaultValues: {
1137
1413
  rail: "",
@@ -1186,7 +1462,7 @@ function je({ railDefinitions: t }) {
1186
1462
  children: [/* @__PURE__ */ G(C, {
1187
1463
  items: t.map((e) => ({
1188
1464
  value: e.rail,
1189
- label: Oe(e.rail, e.display_name)
1465
+ label: Ae(e.rail, e.display_name)
1190
1466
  })),
1191
1467
  value: e.state.value || null,
1192
1468
  onValueChange: (n) => {
@@ -1199,7 +1475,7 @@ function je({ railDefinitions: t }) {
1199
1475
  children: /* @__PURE__ */ W(y, { placeholder: u("Pick a rail…") })
1200
1476
  }), /* @__PURE__ */ W(x, { children: t.map((e) => /* @__PURE__ */ W(S, {
1201
1477
  value: e.rail,
1202
- children: Oe(e.rail, e.display_name)
1478
+ children: Ae(e.rail, e.display_name)
1203
1479
  }, e.rail)) })]
1204
1480
  }), /* @__PURE__ */ W(v, { errors: e.state.meta.errors })]
1205
1481
  })
@@ -1218,7 +1494,7 @@ function je({ railDefinitions: t }) {
1218
1494
  children: [/* @__PURE__ */ G(C, {
1219
1495
  items: n.map((e) => ({
1220
1496
  value: e,
1221
- label: u(Ee[e] ?? e)
1497
+ label: u(Oe[e] ?? e)
1222
1498
  })),
1223
1499
  value: t.state.value || null,
1224
1500
  onValueChange: (e) => t.handleChange(e ?? ""),
@@ -1230,7 +1506,7 @@ function je({ railDefinitions: t }) {
1230
1506
  children: /* @__PURE__ */ W(y, { placeholder: u("Pick an environment…") })
1231
1507
  }), /* @__PURE__ */ W(x, { children: n.map((e) => /* @__PURE__ */ W(S, {
1232
1508
  value: e,
1233
- children: u(Ee[e] ?? e)
1509
+ children: u(Oe[e] ?? e)
1234
1510
  }, e)) })]
1235
1511
  }), /* @__PURE__ */ W(v, { errors: t.state.meta.errors })]
1236
1512
  })
@@ -1258,9 +1534,9 @@ function je({ railDefinitions: t }) {
1258
1534
  children: (e) => /* @__PURE__ */ W(_.Field, {
1259
1535
  name: "account",
1260
1536
  children: (n) => /* @__PURE__ */ W(U, { children: t.find((t) => t.rail === e)?.account_fields.map((e) => /* @__PURE__ */ W($, {
1261
- label: u(we[e]?.label ?? Ae(e)),
1537
+ label: u(Ee[e]?.label ?? Me(e)),
1262
1538
  id: `pv-account-${e}`,
1263
- hint: we[e]?.hint,
1539
+ hint: Ee[e]?.hint,
1264
1540
  children: /* @__PURE__ */ W(s, {
1265
1541
  id: d(`pv-account-${e}`),
1266
1542
  value: n.state.value[e] ?? "",
@@ -1280,7 +1556,7 @@ function je({ railDefinitions: t }) {
1280
1556
  return /* @__PURE__ */ W(_.Field, {
1281
1557
  name: "credentials",
1282
1558
  children: (e) => /* @__PURE__ */ W(U, { children: n?.credential_keys.map((t) => /* @__PURE__ */ W($, {
1283
- label: Ae(t),
1559
+ label: Me(t),
1284
1560
  id: `pv-credential-${t}`,
1285
1561
  children: /* @__PURE__ */ W(s, {
1286
1562
  id: d(`pv-credential-${t}`),
@@ -1321,7 +1597,7 @@ function je({ railDefinitions: t }) {
1321
1597
  })]
1322
1598
  });
1323
1599
  }
1324
- function Me() {
1600
+ function Pe() {
1325
1601
  let { toast: t, toastApiError: n, adminMutations: r } = i(), { text: l, id: u } = e(), [d, f] = z.useState(), m = B(r.lookupCustomerControls()), _ = B(r.setCreditLimit()), y = c(), b = K({
1326
1602
  defaultValues: { newLimit: "" },
1327
1603
  onSubmit: async ({ value: e }) => {
@@ -1532,6 +1808,6 @@ function $({ label: t, id: n, hint: r, children: i }) {
1532
1808
  });
1533
1809
  }
1534
1810
  //#endregion
1535
- export { ge as SettingsPage };
1811
+ export { ve as SettingsPage };
1536
1812
 
1537
- //# sourceMappingURL=admin-settings-Bw49HU8g.js.map
1813
+ //# sourceMappingURL=admin-settings-Bs6cLcqi.js.map