@openrails/billing-ui 0.253.0 → 0.254.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 (42) hide show
  1. package/dist/admin/lib/api/types.d.ts +1 -1
  2. package/dist/admin/messages.d.ts +10 -0
  3. package/dist/{admin-catalog-Bsxo2gyS.js → admin-catalog-rrFZd5N8.js} +2 -2
  4. package/dist/{admin-catalog-Bsxo2gyS.js.map → admin-catalog-rrFZd5N8.js.map} +1 -1
  5. package/dist/{admin-price-detail-ByCmrx_W.js → admin-price-detail-Bwk9PXHP.js} +2 -2
  6. package/dist/{admin-price-detail-ByCmrx_W.js.map → admin-price-detail-Bwk9PXHP.js.map} +1 -1
  7. package/dist/{admin-price-wizard-m7Qjhq6W.js → admin-price-wizard-ByD7j8mB.js} +2 -2
  8. package/dist/admin-price-wizard-ByD7j8mB.js.map +1 -0
  9. package/dist/{admin-settings-BIUgvclv.js → admin-settings-D_8L1Hho.js} +101 -76
  10. package/dist/admin-settings-D_8L1Hho.js.map +1 -0
  11. package/dist/admin.js +15 -5
  12. package/dist/admin.js.map +1 -1
  13. package/dist/client/generated/error-codes.d.ts +1 -1
  14. package/dist/client/generated/wire.d.ts +51 -20
  15. package/dist/{client-Di2a3HGM.js → client-B301IAQD.js} +3 -3
  16. package/dist/client-B301IAQD.js.map +1 -0
  17. package/dist/client.js +1 -1
  18. package/dist/components/platform-card-form.d.ts +3 -1
  19. package/dist/{hooks-Bx0aLyvy.js → hooks-DARbMTwv.js} +69 -59
  20. package/dist/hooks-DARbMTwv.js.map +1 -0
  21. package/dist/index.js +302 -270
  22. package/dist/index.js.map +1 -1
  23. package/dist/locales/de.js +1 -0
  24. package/dist/locales/de.js.map +1 -1
  25. package/dist/locales/en.d.ts +1 -0
  26. package/dist/locales/en.js +1 -0
  27. package/dist/locales/en.js.map +1 -1
  28. package/dist/locales/es.js +1 -0
  29. package/dist/locales/es.js.map +1 -1
  30. package/dist/locales/ja.js +1 -0
  31. package/dist/locales/ja.js.map +1 -1
  32. package/dist/locales/ko.js +1 -0
  33. package/dist/locales/ko.js.map +1 -1
  34. package/dist/locales/zh.js +1 -0
  35. package/dist/locales/zh.js.map +1 -1
  36. package/dist/psp.d.ts +1 -1
  37. package/dist/react.js +1 -1
  38. package/package.json +1 -1
  39. package/dist/admin-price-wizard-m7Qjhq6W.js.map +0 -1
  40. package/dist/admin-settings-BIUgvclv.js.map +0 -1
  41. package/dist/client-Di2a3HGM.js.map +0 -1
  42. package/dist/hooks-Bx0aLyvy.js.map +0 -1
@@ -13,16 +13,16 @@ import { t as F } from "./admin-label-BzJpr3lg.js";
13
13
  import { t as re } from "./admin-switch-S4g_ppaU.js";
14
14
  import { n as I } from "./admin-dialog-width-BPrgdYlj.js";
15
15
  import { i as L, n as R, r as ie, t as ae } from "./admin-tabs-Cjm5a6UJ.js";
16
- import { t as z } from "./admin-typed-confirm-dialog-BloZvFPA.js";
17
- import * as B from "react";
18
- import { useMutation as V, useQuery as H, useQueryClient as U } from "@tanstack/react-query";
19
- import { Fragment as oe, jsx as W, jsxs as G } from "react/jsx-runtime";
16
+ import { t as oe } from "./admin-typed-confirm-dialog-BloZvFPA.js";
17
+ import * as z from "react";
18
+ import { useMutation as B, useQuery as V, useQueryClient as H } from "@tanstack/react-query";
19
+ import { Fragment as U, jsx as W, jsxs as G } from "react/jsx-runtime";
20
20
  import { HugeiconsIcon as se } from "@hugeicons/react";
21
21
  import { Add01Icon as ce, Delete02Icon as le } from "@hugeicons/core-free-icons";
22
22
  import { useForm as K } from "@tanstack/react-form";
23
23
  //#region src/admin/pages/settings/configuration-edit.ts
24
24
  function q(e) {
25
- let { toast: n, toastApiError: r, toastStaleEdit: a, adminMutations: o } = i(), [s, c] = B.useState(null), l = U(), u = V(o.updateMerchantConfiguration(l));
25
+ let { toast: n, toastApiError: r, toastStaleEdit: a, adminMutations: o } = i(), [s, c] = z.useState(null), l = H(), u = B(o.updateMerchantConfiguration(l));
26
26
  return {
27
27
  editing: s !== null,
28
28
  open: () => {
@@ -48,7 +48,7 @@ function q(e) {
48
48
  //#endregion
49
49
  //#region src/admin/pages/settings/setting-fields.tsx
50
50
  function J() {
51
- let { adminQueries: e } = i(), { data: t } = H(e.config());
51
+ let { adminQueries: e } = i(), { data: t } = V(e.config());
52
52
  return !t || t.capabilities.features?.merchant_config_edits ? null : /* @__PURE__ */ W("p", {
53
53
  className: "rounded-md border px-3 py-2 text-sm text-muted-foreground",
54
54
  children: /* @__PURE__ */ W(a, { id: "Read-only: this merchant's configuration comes from a file. Change it there." })
@@ -107,7 +107,7 @@ function Z({ label: t, id: n, children: r }) {
107
107
  //#endregion
108
108
  //#region src/admin/pages/settings/notifications.tsx
109
109
  function ue() {
110
- let { adminQueries: e } = i(), t = H(e.merchantConfiguration("Load settings")), n = H(e.webhooks()), r = f(), o = n.data?.data ?? [];
110
+ let { adminQueries: e } = i(), t = V(e.merchantConfiguration("Load settings")), n = V(e.webhooks()), r = f(), o = n.data?.data ?? [];
111
111
  return /* @__PURE__ */ G("div", {
112
112
  className: "flex flex-col gap-10",
113
113
  children: [
@@ -128,9 +128,9 @@ function ue() {
128
128
  });
129
129
  }
130
130
  function de({ configuration: t, edits: n }) {
131
- let { id: r, text: i } = e(), o = t.settings.alert_email ?? "", c = q(t), l = K({
131
+ let { id: r, text: i } = e(), o = t.alert_email ?? "", c = q(t), l = K({
132
132
  defaultValues: { email: o },
133
- onSubmit: ({ value: e }) => c.save({ settings: { alert_email: e.email.trim() } }, e.email.trim() ? "Alert email saved" : "Alert email cleared", "Save alert email")
133
+ onSubmit: ({ value: e }) => c.save({ alert_email: e.email.trim() }, e.email.trim() ? "Alert email saved" : "Alert email cleared", "Save alert email")
134
134
  });
135
135
  return /* @__PURE__ */ G("section", {
136
136
  className: "grid gap-5",
@@ -249,7 +249,7 @@ function pe({ webhooks: e, loading: t, edits: n }) {
249
249
  });
250
250
  }
251
251
  function me({ webhook: t, edits: n }) {
252
- let { toast: r, toastApiError: s, adminMutations: c } = i(), { text: l } = e(), [u, d] = B.useState(!1), f = U(), p = V(c.deleteWebhook(f)), m = t.name ?? t.destination_host;
252
+ let { toast: r, toastApiError: s, adminMutations: c } = i(), { text: l } = e(), [u, d] = z.useState(!1), f = H(), p = B(c.deleteWebhook(f)), m = t.name ?? t.destination_host;
253
253
  return /* @__PURE__ */ G(E, {
254
254
  className: t.enabled ? void 0 : "opacity-60",
255
255
  children: [
@@ -291,7 +291,7 @@ function me({ webhook: t, edits: n }) {
291
291
  className: "size-4 text-muted-foreground"
292
292
  })
293
293
  }),
294
- /* @__PURE__ */ W(z, {
294
+ /* @__PURE__ */ W(oe, {
295
295
  open: u,
296
296
  onOpenChange: d,
297
297
  title: `Delete "${m}"?`,
@@ -313,7 +313,7 @@ function me({ webhook: t, edits: n }) {
313
313
  });
314
314
  }
315
315
  function he({ webhook: t }) {
316
- let { toast: n, toastApiError: r, adminMutations: c } = i(), { id: l, text: u } = e(), [d, f] = B.useState(!1), p = U(), m = V(c.createWebhook(p)), h = V(c.updateWebhook(p)), g = () => ({
316
+ let { toast: n, toastApiError: r, adminMutations: c } = i(), { id: l, text: u } = e(), [d, f] = z.useState(!1), p = H(), m = B(c.createWebhook(p)), h = B(c.updateWebhook(p)), g = () => ({
317
317
  name: t?.name ?? "",
318
318
  url: "",
319
319
  format: t?.format ?? "generic",
@@ -537,7 +537,7 @@ function ge() {
537
537
  }),
538
538
  o && /* @__PURE__ */ W(R, {
539
539
  value: "customer-controls",
540
- children: /* @__PURE__ */ W(je, {})
540
+ children: /* @__PURE__ */ W(Me, {})
541
541
  }),
542
542
  s.map((e) => /* @__PURE__ */ W(R, {
543
543
  value: e.value,
@@ -547,7 +547,7 @@ function ge() {
547
547
  });
548
548
  }
549
549
  function _e() {
550
- let { adminQueries: e } = i(), { data: t } = H(e.merchantConfiguration("Load settings")), n = f();
550
+ let { adminQueries: e } = i(), { data: t } = V(e.merchantConfiguration("Load settings")), n = f();
551
551
  return t ? /* @__PURE__ */ G("div", {
552
552
  className: "grid gap-10",
553
553
  children: [
@@ -567,7 +567,7 @@ function _e() {
567
567
  });
568
568
  }
569
569
  function ve({ configuration: t, edits: n }) {
570
- let { id: r, text: i } = e(), o = t.settings.profile, c = () => ({
570
+ let { id: r, text: i } = e(), o = t.profile, c = () => ({
571
571
  displayName: t.display_name,
572
572
  fromEmail: o?.from_email ?? "",
573
573
  supportURL: o?.support_url ?? "",
@@ -578,13 +578,13 @@ function ve({ configuration: t, edits: n }) {
578
578
  defaultValues: c(),
579
579
  onSubmit: ({ value: e }) => l.save({
580
580
  display_name: e.displayName.trim(),
581
- settings: { profile: {
581
+ profile: {
582
582
  from_email: e.fromEmail || void 0,
583
583
  support_url: e.supportURL || void 0,
584
584
  subscribe_url: e.subscribeURL || void 0,
585
585
  billing_url: e.billingURL || void 0,
586
586
  logo_url: e.logoURL || void 0
587
- } }
587
+ }
588
588
  }, "Profile saved", "Save profile")
589
589
  });
590
590
  return /* @__PURE__ */ G("section", {
@@ -723,6 +723,10 @@ function ve({ configuration: t, edits: n }) {
723
723
  label: i("Display name"),
724
724
  value: t.display_name
725
725
  }),
726
+ /* @__PURE__ */ W(X, {
727
+ label: i("Money"),
728
+ value: i(t.sandbox ? "Sandbox: its PSPs move no money" : "Live: its PSPs move real money")
729
+ }),
726
730
  /* @__PURE__ */ W(X, {
727
731
  label: i("From email"),
728
732
  value: o?.from_email
@@ -748,9 +752,9 @@ function ve({ configuration: t, edits: n }) {
748
752
  });
749
753
  }
750
754
  function ye({ configuration: t, edits: n }) {
751
- let { id: r, text: i } = e(), o = t.settings.reprice_notice_window_days ?? 30, c = q(t), l = K({
755
+ let { id: r, text: i } = e(), o = t.reprice_notice_window_days ?? 30, c = q(t), l = K({
752
756
  defaultValues: { days: String(o) },
753
- onSubmit: ({ value: e }) => c.save({ settings: { reprice_notice_window_days: Number(e.days) } }, "Notice window saved", "Save notice window")
757
+ onSubmit: ({ value: e }) => c.save({ reprice_notice_window_days: Number(e.days) }, "Notice window saved", "Save notice window")
754
758
  });
755
759
  return /* @__PURE__ */ G("section", {
756
760
  className: "grid gap-5",
@@ -815,7 +819,7 @@ function ye({ configuration: t, edits: n }) {
815
819
  });
816
820
  }
817
821
  function be() {
818
- let { selectedMerchant: e, adminQueries: t } = i(), n = H(t.psps()), r = H(t.rails()), o = f();
822
+ let { selectedMerchant: e, adminQueries: t } = i(), n = V(t.psps()), r = V(t.rails()), o = f();
819
823
  if (n.isPending || r.isPending) return /* @__PURE__ */ W("p", {
820
824
  className: "text-sm text-muted-foreground",
821
825
  children: /* @__PURE__ */ W(a, { id: "Loading…" })
@@ -836,7 +840,7 @@ function be() {
836
840
  className: "text-sm text-muted-foreground",
837
841
  children: /* @__PURE__ */ W(a, { id: "The accounts this merchant takes payments through, one or more per rail." })
838
842
  })]
839
- }), o && /* @__PURE__ */ W(Ae, { railDefinitions: s }, e() ?? "")]
843
+ }), o && /* @__PURE__ */ W(je, { railDefinitions: s }, e() ?? "")]
840
844
  }), n.data?.data?.length ? /* @__PURE__ */ G(ne, {
841
845
  className: "min-w-[44rem]",
842
846
  children: [/* @__PURE__ */ W(te, { children: /* @__PURE__ */ G(E, {
@@ -879,7 +883,7 @@ function xe(e) {
879
883
  return e.validated_at ? `Validated ${m(e.validated_at)}` : e.configured ? "Configured" : "Not configured";
880
884
  }
881
885
  function Se({ psp: n, railDefinitions: r, edits: s }) {
882
- let { toast: c, toastApiError: l, toastStaleEdit: u, adminMutations: d, selectedMerchant: f } = i(), { text: p } = e(), m = U(), h = V(d.updatePSP(m)), [g, v] = B.useState(!1), y = _(), b = r.find((e) => e.rail === n.rail), x = b?.display_name ?? n.rail, S = n.credentials ?? {}, C = async (e) => {
886
+ 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
887
  if (!(!e && !await y({
884
888
  title: `Archive ${n.key}?`,
885
889
  description: "New purchase stops routing to it. Existing subscriptions, refunds and webhooks keep using it.",
@@ -920,7 +924,7 @@ function Se({ psp: n, railDefinitions: r, edits: s }) {
920
924
  children: [
921
925
  x,
922
926
  " · ",
923
- n.account_id
927
+ Te(n)
924
928
  ]
925
929
  })]
926
930
  })
@@ -979,7 +983,7 @@ function Se({ psp: n, railDefinitions: r, edits: s }) {
979
983
  onClick: () => C(!1),
980
984
  children: /* @__PURE__ */ W(a, { id: "Archive" })
981
985
  }),
982
- /* @__PURE__ */ W(z, {
986
+ /* @__PURE__ */ W(oe, {
983
987
  open: g,
984
988
  onOpenChange: v,
985
989
  title: `Archive the last active ${x} PSP?`,
@@ -995,7 +999,7 @@ function Se({ psp: n, railDefinitions: r, edits: s }) {
995
999
  });
996
1000
  }
997
1001
  function Ce({ psp: n, credentialKeys: r }) {
998
- let { toast: c, toastApiError: l, toastStaleEdit: u, adminMutations: d, selectedMerchant: f } = i(), { id: p } = e(), [h, g] = B.useState(!1), [_] = B.useState(() => f() ?? ""), v = B.useRef(n.revision), y = U(), b = V(d.updatePSP(y)), x = n.credentials ?? {}, S = K({
1002
+ 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
1003
  defaultValues: { credentials: {} },
1000
1004
  onSubmit: async ({ value: e }) => {
1001
1005
  let r = Object.fromEntries(Object.entries(e.credentials).filter(([, e]) => e.trim()));
@@ -1034,7 +1038,7 @@ function Ce({ psp: n, credentialKeys: r }) {
1034
1038
  /* @__PURE__ */ W(a, { id: "Rotate " }),
1035
1039
  n.key,
1036
1040
  /* @__PURE__ */ W(a, { id: " credentials · " }),
1037
- n.account_id
1041
+ Te(n)
1038
1042
  ] }), /* @__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
1043
  onSubmit: (e) => {
1040
1044
  e.preventDefault(), e.stopPropagation(), S.handleSubmit();
@@ -1081,56 +1085,76 @@ function Ce({ psp: n, credentialKeys: r }) {
1081
1085
  })]
1082
1086
  });
1083
1087
  }
1084
- function we(e) {
1085
- switch (e) {
1086
- case "nmi": return "The Gateway ID shown in your NMI dashboard.";
1087
- case "stripe": return "Your Stripe account ID. It starts with acct_.";
1088
- case "ccbill": return "Your account and sub-account joined with a dash, such as 999999-0000.";
1089
- case "solana": return "Taken from your signing key, so whatever you enter here is ignored.";
1090
- default: return;
1088
+ var we = {
1089
+ gateway_id: {
1090
+ label: "Gateway ID",
1091
+ hint: "The Gateway ID shown in your NMI dashboard."
1092
+ },
1093
+ account_id: {
1094
+ label: "Account ID",
1095
+ hint: "Your Stripe account ID. It starts with acct_."
1096
+ },
1097
+ client_accnum: {
1098
+ label: "Client account number",
1099
+ hint: "Your CCBill account number, such as 945280."
1100
+ },
1101
+ client_subacc: {
1102
+ label: "Client subaccount",
1103
+ hint: "Your CCBill subaccount number, such as 0000."
1104
+ },
1105
+ treasury: {
1106
+ label: "Treasury",
1107
+ hint: "The Solana address your payments land in."
1091
1108
  }
1109
+ };
1110
+ function Te(e) {
1111
+ return e.client_accnum ? `${e.client_accnum}-${e.client_subacc ?? ""}` : e.gateway_id ?? e.account_id ?? e.treasury ?? "";
1092
1112
  }
1093
- var Te = {
1113
+ var Ee = {
1094
1114
  live: "Live: real money",
1095
1115
  test: "Test: the provider's own system, no money moves",
1096
- sandbox: "Sandbox: the provider's separate sandbox"
1097
- }, Ee = {
1116
+ sandbox: "Sandbox: the provider's separate sandbox",
1117
+ mainnet: "Mainnet: real money",
1118
+ devnet: "Devnet: Solana's development network",
1119
+ testnet: "Testnet: Solana's test network"
1120
+ }, De = {
1098
1121
  nmi: "NMI",
1099
1122
  ccbill: "CCBill",
1100
1123
  stripe: "Stripe",
1101
1124
  solana: "Solana"
1102
1125
  };
1103
- function De(e, t) {
1104
- let n = Ee[e] ?? e;
1126
+ function Oe(e, t) {
1127
+ let n = De[e] ?? e;
1105
1128
  return !t || t.toLowerCase() === n.toLowerCase() ? n : `${t} (${n})`;
1106
1129
  }
1107
- var Oe = {
1130
+ var ke = {
1108
1131
  api: "API",
1109
1132
  id: "ID",
1110
1133
  url: "URL"
1111
1134
  };
1112
- function ke(e) {
1113
- return e.split(/[_-]+/).filter(Boolean).map((e, t) => Oe[e.toLowerCase()] || (t > 0 ? e.toLowerCase() : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase())).join(" ");
1135
+ function Ae(e) {
1136
+ return e.split(/[_-]+/).filter(Boolean).map((e, t) => ke[e.toLowerCase()] || (t > 0 ? e.toLowerCase() : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase())).join(" ");
1114
1137
  }
1115
- function Ae({ railDefinitions: t }) {
1116
- let { toast: n, toastApiError: r, adminMutations: c, selectedMerchant: l } = i(), { text: u, id: d } = e(), [f, p] = B.useState(!1), [m] = B.useState(() => l() ?? ""), h = U(), g = V(c.createPSP(h)), _ = K({
1138
+ function je({ railDefinitions: t }) {
1139
+ 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({
1117
1140
  defaultValues: {
1118
1141
  rail: "",
1119
1142
  environment: "",
1120
1143
  key: "",
1121
- accountID: "",
1144
+ account: {},
1122
1145
  credentials: {}
1123
1146
  },
1124
1147
  onSubmit: async ({ value: e }) => {
1125
- let t = Object.fromEntries(Object.entries(e.credentials).filter(([, e]) => e !== ""));
1148
+ let i = Object.fromEntries(Object.entries(e.credentials).filter(([, e]) => e !== ""));
1126
1149
  try {
1127
1150
  if ((l() ?? "") !== m) throw Error("Merchant changed; reopen this form");
1151
+ let r = t.find((t) => t.rail === e.rail);
1128
1152
  await g.mutateAsync({
1129
1153
  key: e.key.trim().toLowerCase(),
1130
1154
  rail: e.rail,
1131
1155
  environment: e.environment,
1132
- account_id: e.accountID.trim(),
1133
- ...Object.keys(t).length ? { credentials: t } : {}
1156
+ ...Object.fromEntries((r?.account_fields ?? []).map((t) => [t, (e.account[t] ?? "").trim()])),
1157
+ ...Object.keys(i).length ? { credentials: i } : {}
1134
1158
  }), _.reset(), n.success("PSP added"), p(!1);
1135
1159
  } catch (e) {
1136
1160
  r(e, "Add PSP");
@@ -1166,11 +1190,11 @@ function Ae({ railDefinitions: t }) {
1166
1190
  children: [/* @__PURE__ */ G(C, {
1167
1191
  items: t.map((e) => ({
1168
1192
  value: e.rail,
1169
- label: De(e.rail, e.display_name)
1193
+ label: Oe(e.rail, e.display_name)
1170
1194
  })),
1171
1195
  value: e.state.value || null,
1172
- onValueChange: (t) => {
1173
- e.handleChange(t ?? ""), _.setFieldValue("credentials", {}), _.setFieldValue("environment", "");
1196
+ onValueChange: (n) => {
1197
+ e.handleChange(n ?? ""), _.setFieldValue("account", {}), _.setFieldValue("credentials", {}), _.setFieldValue("environment", t.find((e) => e.rail === n)?.environments[0] ?? "");
1174
1198
  },
1175
1199
  children: [/* @__PURE__ */ W(b, {
1176
1200
  id: d("pv-rail"),
@@ -1179,7 +1203,7 @@ function Ae({ railDefinitions: t }) {
1179
1203
  children: /* @__PURE__ */ W(y, { placeholder: u("Pick a rail…") })
1180
1204
  }), /* @__PURE__ */ W(x, { children: t.map((e) => /* @__PURE__ */ W(S, {
1181
1205
  value: e.rail,
1182
- children: De(e.rail, e.display_name)
1206
+ children: Oe(e.rail, e.display_name)
1183
1207
  }, e.rail)) })]
1184
1208
  }), /* @__PURE__ */ W(v, { errors: e.state.meta.errors })]
1185
1209
  })
@@ -1198,7 +1222,7 @@ function Ae({ railDefinitions: t }) {
1198
1222
  children: [/* @__PURE__ */ G(C, {
1199
1223
  items: n.map((e) => ({
1200
1224
  value: e,
1201
- label: u(Te[e] ?? e)
1225
+ label: u(Ee[e] ?? e)
1202
1226
  })),
1203
1227
  value: t.state.value || null,
1204
1228
  onValueChange: (e) => t.handleChange(e ?? ""),
@@ -1210,7 +1234,7 @@ function Ae({ railDefinitions: t }) {
1210
1234
  children: /* @__PURE__ */ W(y, { placeholder: u("Pick an environment…") })
1211
1235
  }), /* @__PURE__ */ W(x, { children: n.map((e) => /* @__PURE__ */ W(S, {
1212
1236
  value: e,
1213
- children: u(Te[e] ?? e)
1237
+ children: u(Ee[e] ?? e)
1214
1238
  }, e)) })]
1215
1239
  }), /* @__PURE__ */ W(v, { errors: t.state.meta.errors })]
1216
1240
  })
@@ -1236,20 +1260,21 @@ function Ae({ railDefinitions: t }) {
1236
1260
  /* @__PURE__ */ W(_.Subscribe, {
1237
1261
  selector: (e) => e.values.rail,
1238
1262
  children: (e) => /* @__PURE__ */ W(_.Field, {
1239
- name: "accountID",
1240
- validators: { onChange: ({ value: e }) => e.trim() ? void 0 : "Enter the provider account ID" },
1241
- children: (t) => /* @__PURE__ */ G($, {
1242
- label: u("Account ID"),
1243
- id: "pv-acct",
1244
- hint: we(e),
1245
- children: [/* @__PURE__ */ W(s, {
1246
- id: d("pv-acct"),
1247
- value: t.state.value,
1248
- onBlur: t.handleBlur,
1249
- onChange: (e) => t.handleChange(e.target.value),
1250
- "aria-invalid": t.state.meta.errors.length > 0
1251
- }), /* @__PURE__ */ W(v, { errors: t.state.meta.errors })]
1252
- })
1263
+ name: "account",
1264
+ children: (n) => /* @__PURE__ */ W(U, { children: t.find((t) => t.rail === e)?.account_fields.map((e) => /* @__PURE__ */ W($, {
1265
+ label: u(we[e]?.label ?? Ae(e)),
1266
+ id: `pv-account-${e}`,
1267
+ hint: we[e]?.hint,
1268
+ children: /* @__PURE__ */ W(s, {
1269
+ id: d(`pv-account-${e}`),
1270
+ value: n.state.value[e] ?? "",
1271
+ onBlur: n.handleBlur,
1272
+ onChange: (t) => n.handleChange({
1273
+ ...n.state.value,
1274
+ [e]: t.target.value
1275
+ })
1276
+ })
1277
+ }, e)) })
1253
1278
  })
1254
1279
  }),
1255
1280
  /* @__PURE__ */ W(_.Subscribe, {
@@ -1258,8 +1283,8 @@ function Ae({ railDefinitions: t }) {
1258
1283
  let n = t.find((t) => t.rail === e);
1259
1284
  return /* @__PURE__ */ W(_.Field, {
1260
1285
  name: "credentials",
1261
- children: (e) => /* @__PURE__ */ W(oe, { children: n?.credential_keys.map((t) => /* @__PURE__ */ W($, {
1262
- label: ke(t),
1286
+ children: (e) => /* @__PURE__ */ W(U, { children: n?.credential_keys.map((t) => /* @__PURE__ */ W($, {
1287
+ label: Ae(t),
1263
1288
  id: `pv-credential-${t}`,
1264
1289
  children: /* @__PURE__ */ W(s, {
1265
1290
  id: d(`pv-credential-${t}`),
@@ -1281,27 +1306,27 @@ function Ae({ railDefinitions: t }) {
1281
1306
  e.values.rail,
1282
1307
  e.values.environment,
1283
1308
  e.values.key,
1284
- e.values.accountID,
1309
+ e.values.account,
1285
1310
  e.canSubmit,
1286
1311
  e.isSubmitting
1287
1312
  ],
1288
- children: ([e, t, n, r, i, s]) => /* @__PURE__ */ G(oe, { children: [/* @__PURE__ */ W(o, {
1313
+ children: ([e, n, r, i, s, c]) => /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(o, {
1289
1314
  type: "button",
1290
1315
  variant: "outline",
1291
1316
  onClick: () => w(!1),
1292
1317
  children: /* @__PURE__ */ W(a, { id: "Cancel" })
1293
1318
  }), /* @__PURE__ */ W(o, {
1294
1319
  type: "submit",
1295
- disabled: !e || !t || !n.trim() || !r.trim() || !i || s,
1296
- children: s ? "Saving…" : "Add PSP"
1320
+ disabled: !e || !n || !r.trim() || !t.find((t) => t.rail === e)?.account_fields.every((e) => (i[e] ?? "").trim()) || !s || c,
1321
+ children: c ? "Saving…" : "Add PSP"
1297
1322
  })] })
1298
1323
  }) })]
1299
1324
  })]
1300
1325
  })]
1301
1326
  });
1302
1327
  }
1303
- function je() {
1304
- let { toast: t, toastApiError: n, adminMutations: r } = i(), { text: l, id: u } = e(), [d, f] = B.useState(), m = V(r.lookupCustomerControls()), _ = V(r.setCreditLimit()), y = c(), b = K({
1328
+ function Me() {
1329
+ 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({
1305
1330
  defaultValues: { newLimit: "" },
1306
1331
  onSubmit: async ({ value: e }) => {
1307
1332
  if (!d) return;
@@ -1513,4 +1538,4 @@ function $({ label: t, id: n, hint: r, children: i }) {
1513
1538
  //#endregion
1514
1539
  export { ge as SettingsPage };
1515
1540
 
1516
- //# sourceMappingURL=admin-settings-BIUgvclv.js.map
1541
+ //# sourceMappingURL=admin-settings-D_8L1Hho.js.map