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