@openrails/billing-ui 0.281.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 (221) hide show
  1. package/README.md +108 -364
  2. package/dist/account/format.d.ts +6 -2
  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/duration.d.ts +4 -0
  9. package/dist/admin/lib/format.d.ts +29 -1
  10. package/dist/admin/lib/mutations.d.ts +0 -10
  11. package/dist/admin/lib/queries.d.ts +16 -10
  12. package/dist/admin/messages.d.ts +61 -20
  13. package/dist/admin/pages/catalog/price-wizard-logic.d.ts +2 -0
  14. package/dist/admin/pages/catalog/price-wizard.d.ts +1 -3
  15. package/dist/admin/pages/customers/credits.d.ts +4 -1
  16. package/dist/admin/pages/dashboard/levels.d.ts +8 -0
  17. package/dist/admin/pages/dashboard/lib.d.ts +16 -7
  18. package/dist/admin/pages/dashboard/programs.d.ts +3 -0
  19. package/dist/admin/pages/dashboard/query-builder.d.ts +20 -0
  20. package/dist/admin/pages/dashboard/range.d.ts +8 -2
  21. package/dist/admin/pages/dashboard/registry.d.ts +14 -0
  22. package/dist/admin/pages/dashboard/reports-model.d.ts +8 -4
  23. package/dist/admin/pages/dashboard/reports.d.ts +1 -1
  24. package/dist/admin/pages/dashboard/units.d.ts +5 -0
  25. package/dist/admin/pages/dashboard/use-range.d.ts +5 -1
  26. package/dist/admin/pages/dashboard/widget-editor.d.ts +7 -2
  27. package/dist/admin/pages/dashboard/widget-tile.d.ts +10 -4
  28. package/dist/admin/pages/dashboard/widget-viz.d.ts +10 -5
  29. package/dist/admin/pages/ops/signals.d.ts +4 -0
  30. package/dist/admin/pages/payments/attempts.d.ts +2 -2
  31. package/dist/admin/pages/payments/health-model.d.ts +20 -20
  32. package/dist/admin/pages/subscriptions/views.d.ts +4 -0
  33. package/dist/admin-attempts-CRkxeVfQ.js +417 -0
  34. package/dist/admin-attempts-CRkxeVfQ.js.map +1 -0
  35. package/dist/{admin-auth-BUUdvmqC.js → admin-auth-C0pBH3kp.js} +2 -2
  36. package/dist/{admin-auth-BUUdvmqC.js.map → admin-auth-C0pBH3kp.js.map} +1 -1
  37. package/dist/{admin-badge-CAlUmS2s.js → admin-badge-C_-j7ANF.js} +2 -2
  38. package/dist/{admin-badge-CAlUmS2s.js.map → admin-badge-C_-j7ANF.js.map} +1 -1
  39. package/dist/{admin-button-Bn4otsuw.js → admin-button-BV5MAL2H.js} +2 -2
  40. package/dist/{admin-button-Bn4otsuw.js.map → admin-button-BV5MAL2H.js.map} +1 -1
  41. package/dist/{admin-capabilities-DS-X-__V.js → admin-capabilities-B3ZfkA49.js} +21 -13
  42. package/dist/admin-capabilities-B3ZfkA49.js.map +1 -0
  43. package/dist/{admin-card-BHKW1dfB.js → admin-card-DQ61c-kV.js} +2 -2
  44. package/dist/{admin-card-BHKW1dfB.js.map → admin-card-DQ61c-kV.js.map} +1 -1
  45. package/dist/admin-catalog-DAnsClai.js +867 -0
  46. package/dist/admin-catalog-DAnsClai.js.map +1 -0
  47. package/dist/{admin-cursor-pager-Qo9Sq6lN.js → admin-cursor-pager-dkNj-gb6.js} +22 -22
  48. package/dist/{admin-cursor-pager-Qo9Sq6lN.js.map → admin-cursor-pager-dkNj-gb6.js.map} +1 -1
  49. package/dist/admin-customer-search-DDMn_5Us.js +115 -0
  50. package/dist/admin-customer-search-DDMn_5Us.js.map +1 -0
  51. package/dist/{admin-customers-BZP6Jv-i.js → admin-customers-BMaugwpg.js} +24 -25
  52. package/dist/admin-customers-BMaugwpg.js.map +1 -0
  53. package/dist/admin-dashboard-DbbfrIOq.js +510 -0
  54. package/dist/admin-dashboard-DbbfrIOq.js.map +1 -0
  55. package/dist/{admin-data-table-BiFmcf0Z.js → admin-data-table-BjA8cBsr.js} +5 -5
  56. package/dist/{admin-data-table-BiFmcf0Z.js.map → admin-data-table-BjA8cBsr.js.map} +1 -1
  57. package/dist/admin-detail-BVJcnTO-.js +1361 -0
  58. package/dist/admin-detail-BVJcnTO-.js.map +1 -0
  59. package/dist/{admin-detail-cijme9Lc.js → admin-detail-DO9wd12I.js} +130 -107
  60. package/dist/admin-detail-DO9wd12I.js.map +1 -0
  61. package/dist/{admin-detail-CQws8363.js → admin-detail-M7YFYOGN.js} +211 -210
  62. package/dist/{admin-detail-CQws8363.js.map → admin-detail-M7YFYOGN.js.map} +1 -1
  63. package/dist/admin-detail-sOLj-K-Y.js +336 -0
  64. package/dist/{admin-detail-NApy5bio.js.map → admin-detail-sOLj-K-Y.js.map} +1 -1
  65. package/dist/admin-detail-uZ-eR2TT.js +292 -0
  66. package/dist/{admin-detail-C6VH3i2v.js.map → admin-detail-uZ-eR2TT.js.map} +1 -1
  67. package/dist/{admin-dialog-CgYGInHi.js → admin-dialog-BxRcYcQM.js} +3 -3
  68. package/dist/{admin-dialog-CgYGInHi.js.map → admin-dialog-BxRcYcQM.js.map} +1 -1
  69. package/dist/{admin-dropdown-menu-CU9RxoEJ.js → admin-dropdown-menu-DlyaKwyU.js} +2 -2
  70. package/dist/{admin-dropdown-menu-CU9RxoEJ.js.map → admin-dropdown-menu-DlyaKwyU.js.map} +1 -1
  71. package/dist/{admin-dunning-D8lAP7OA.js → admin-dunning-CDy6aMAj.js} +2 -2
  72. package/dist/{admin-dunning-D8lAP7OA.js.map → admin-dunning-CDy6aMAj.js.map} +1 -1
  73. package/dist/{admin-fact-card-lN-MsuSp.js → admin-fact-card-2DujC_r3.js} +2 -2
  74. package/dist/{admin-fact-card-lN-MsuSp.js.map → admin-fact-card-2DujC_r3.js.map} +1 -1
  75. package/dist/{admin-utils-CX097OR7.js → admin-format-Bc4NWK0F.js} +495 -328
  76. package/dist/admin-format-Bc4NWK0F.js.map +1 -0
  77. package/dist/{admin-health-CnagC763.js → admin-health-DePsyIlc.js} +217 -196
  78. package/dist/admin-health-DePsyIlc.js.map +1 -0
  79. package/dist/{admin-imports-SM_fKKgW.js → admin-imports-BrQH3u9M.js} +85 -86
  80. package/dist/{admin-imports-SM_fKKgW.js.map → admin-imports-BrQH3u9M.js.map} +1 -1
  81. package/dist/{admin-input-B_EUzCAE.js → admin-input-BZ2ExV_5.js} +2 -2
  82. package/dist/{admin-input-B_EUzCAE.js.map → admin-input-BZ2ExV_5.js.map} +1 -1
  83. package/dist/{admin-label-DQsOkp1p.js → admin-label-DecDO0oV.js} +2 -2
  84. package/dist/{admin-label-DQsOkp1p.js.map → admin-label-DecDO0oV.js.map} +1 -1
  85. package/dist/{admin-linked-table-row-BFsgc9tz.js → admin-linked-table-row-ChxhVptQ.js} +3 -3
  86. package/dist/{admin-linked-table-row-BFsgc9tz.js.map → admin-linked-table-row-ChxhVptQ.js.map} +1 -1
  87. package/dist/{admin-map-dialog-Dt3gTuTD.js → admin-map-dialog-CQmGOBMw.js} +12 -12
  88. package/dist/{admin-map-dialog-Dt3gTuTD.js.map → admin-map-dialog-CQmGOBMw.js.map} +1 -1
  89. package/dist/admin-metering-OXGOVQ7e.js +1716 -0
  90. package/dist/{admin-metering-DM4KhjOq.js.map → admin-metering-OXGOVQ7e.js.map} +1 -1
  91. package/dist/{admin-missing-record-G2Jz-VUn.js → admin-missing-record-B_9LpSIW.js} +4 -4
  92. package/dist/{admin-missing-record-G2Jz-VUn.js.map → admin-missing-record-B_9LpSIW.js.map} +1 -1
  93. package/dist/admin-ops-BTSunx1i.js +357 -0
  94. package/dist/{admin-ops-mwzj-jpg.js.map → admin-ops-BTSunx1i.js.map} +1 -1
  95. package/dist/{admin-orders-D_aqV66h.js → admin-orders-LqlpQVFo.js} +59 -60
  96. package/dist/{admin-orders-D_aqV66h.js.map → admin-orders-LqlpQVFo.js.map} +1 -1
  97. package/dist/{admin-parked-2FjIfyMg.js → admin-parked-Ch6mlS5f.js} +61 -62
  98. package/dist/{admin-parked-2FjIfyMg.js.map → admin-parked-Ch6mlS5f.js.map} +1 -1
  99. package/dist/{admin-payments-B4hh31PR.js → admin-payments-yNntF4i4.js} +42 -42
  100. package/dist/{admin-payments-B4hh31PR.js.map → admin-payments-yNntF4i4.js.map} +1 -1
  101. package/dist/{admin-price-detail--5Bovz20.js → admin-price-detail-DvmcYr8B.js} +131 -132
  102. package/dist/admin-price-detail-DvmcYr8B.js.map +1 -0
  103. package/dist/{admin-price-format-C-pus9FL.js → admin-price-format-Btdg11-J.js} +14 -5
  104. package/dist/admin-price-format-Btdg11-J.js.map +1 -0
  105. package/dist/admin-price-wizard-EFO3nBV8.js +376 -0
  106. package/dist/admin-price-wizard-EFO3nBV8.js.map +1 -0
  107. package/dist/{admin-proposals-DPRFoWel.js → admin-proposals-CO0LKHM8.js} +119 -120
  108. package/dist/{admin-proposals-DPRFoWel.js.map → admin-proposals-CO0LKHM8.js.map} +1 -1
  109. package/dist/admin-provider-prices-ZjQeEV1n.js +239 -0
  110. package/dist/{admin-provider-prices-B8Oc86dP.js.map → admin-provider-prices-ZjQeEV1n.js.map} +1 -1
  111. package/dist/admin-query-builder-DedekYUU.js +252 -0
  112. package/dist/admin-query-builder-DedekYUU.js.map +1 -0
  113. package/dist/{admin-range-picker-CSWcCYkg.js → admin-range-picker-1WGFlYYw.js} +46 -24
  114. package/dist/admin-range-picker-1WGFlYYw.js.map +1 -0
  115. package/dist/admin-records-A2R52prt.js +389 -0
  116. package/dist/{admin-records-CWbfqyT8.js.map → admin-records-A2R52prt.js.map} +1 -1
  117. package/dist/admin-reports-ySY9v463.js +420 -0
  118. package/dist/admin-reports-ySY9v463.js.map +1 -0
  119. package/dist/{admin-select-DSGCZFiZ.js → admin-select-CgZq2j0G.js} +2 -2
  120. package/dist/{admin-select-DSGCZFiZ.js.map → admin-select-CgZq2j0G.js.map} +1 -1
  121. package/dist/admin-settings-kOW1nPGB.js +1818 -0
  122. package/dist/admin-settings-kOW1nPGB.js.map +1 -0
  123. package/dist/{admin-shared-DdN2hyaR.js → admin-shared-DoBOSwkv.js} +33 -34
  124. package/dist/{admin-shared-DdN2hyaR.js.map → admin-shared-DoBOSwkv.js.map} +1 -1
  125. package/dist/admin-signals-D_iWk2r5.js +124 -0
  126. package/dist/admin-signals-D_iWk2r5.js.map +1 -0
  127. package/dist/{admin-skeleton-DOfsDIu0.js → admin-skeleton-DdqwXcr4.js} +2 -2
  128. package/dist/{admin-skeleton-DOfsDIu0.js.map → admin-skeleton-DdqwXcr4.js.map} +1 -1
  129. package/dist/{admin-status-badge-BLEGt2Fw.js → admin-status-badge-B8rjk6QR.js} +5 -3
  130. package/dist/admin-status-badge-B8rjk6QR.js.map +1 -0
  131. package/dist/{admin-subscriptions-PL5G3f0O.js → admin-subscriptions-CjYPSPs-.js} +43 -38
  132. package/dist/admin-subscriptions-CjYPSPs-.js.map +1 -0
  133. package/dist/{admin-switch-aOiQQzST.js → admin-switch-CyYmt8wi.js} +2 -2
  134. package/dist/{admin-switch-aOiQQzST.js.map → admin-switch-CyYmt8wi.js.map} +1 -1
  135. package/dist/{admin-table-DIKl2rpV.js → admin-table-ByPfWNq8.js} +2 -2
  136. package/dist/{admin-table-DIKl2rpV.js.map → admin-table-ByPfWNq8.js.map} +1 -1
  137. package/dist/admin-tabs-DKa6QljL.js +45 -0
  138. package/dist/admin-tabs-DKa6QljL.js.map +1 -0
  139. package/dist/{admin-textarea-W52-l_0n.js → admin-textarea-CQg__KGc.js} +2 -2
  140. package/dist/{admin-textarea-W52-l_0n.js.map → admin-textarea-CQg__KGc.js.map} +1 -1
  141. package/dist/{admin-typed-confirm-dialog-B_00EHlT.js → admin-typed-confirm-dialog-BvAYEh3H.js} +6 -6
  142. package/dist/{admin-typed-confirm-dialog-B_00EHlT.js.map → admin-typed-confirm-dialog-BvAYEh3H.js.map} +1 -1
  143. package/dist/admin-widget-tile-DDI3eaRy.js +290 -0
  144. package/dist/admin-widget-tile-DDI3eaRy.js.map +1 -0
  145. package/dist/admin-widget-viz-Db9CQ2Sx.js +1084 -0
  146. package/dist/admin-widget-viz-Db9CQ2Sx.js.map +1 -0
  147. package/dist/admin.css +1 -1
  148. package/dist/admin.js +660 -609
  149. package/dist/admin.js.map +1 -1
  150. package/dist/buy-button.d.ts +4 -2
  151. package/dist/cart.d.ts +4 -2
  152. package/dist/client/client.d.ts +16 -3
  153. package/dist/client/generated/error-codes.d.ts +1 -1
  154. package/dist/client/generated/routes.d.ts +296 -181
  155. package/dist/client/generated/wire.d.ts +514 -277
  156. package/dist/client/index.d.ts +1 -1
  157. package/dist/client/types.d.ts +76 -8
  158. package/dist/{client-DwsFGm4M.js → client-D8qT6xjo.js} +86 -44
  159. package/dist/client-D8qT6xjo.js.map +1 -0
  160. package/dist/client.js +1 -1
  161. package/dist/components/billing-fields.d.ts +5 -3
  162. package/dist/components/platform-card-form.d.ts +3 -1
  163. package/dist/{hooks-C-MhXjQh.js → hooks-CX09fAJA.js} +86 -60
  164. package/dist/hooks-CX09fAJA.js.map +1 -0
  165. package/dist/index.d.ts +1 -1
  166. package/dist/index.js +847 -779
  167. package/dist/index.js.map +1 -1
  168. package/dist/lib/billing-fields.d.ts +15 -0
  169. package/dist/lib/billing.d.ts +23 -5
  170. package/dist/lib/price-label.d.ts +1 -1
  171. package/dist/locales/en.d.ts +4 -0
  172. package/dist/locales/en.js +4 -0
  173. package/dist/locales/en.js.map +1 -1
  174. package/dist/product-list.d.ts +4 -2
  175. package/dist/react/config.d.ts +10 -2
  176. package/dist/react/index.d.ts +1 -1
  177. package/dist/react.js +1 -1
  178. package/dist/styles.css +1 -1
  179. package/dist/tokenized-card-form.d.ts +10 -2
  180. package/docs/payment-form-contract.md +6 -15
  181. package/package.json +6 -6
  182. package/dist/admin/lib/api/copilot.d.ts +0 -6
  183. package/dist/admin/pages/catalog/copilot-panel.d.ts +0 -4
  184. package/dist/admin-attempts-DjgBAbx9.js +0 -418
  185. package/dist/admin-attempts-DjgBAbx9.js.map +0 -1
  186. package/dist/admin-capabilities-DS-X-__V.js.map +0 -1
  187. package/dist/admin-catalog-BdLDhr8R.js +0 -1096
  188. package/dist/admin-catalog-BdLDhr8R.js.map +0 -1
  189. package/dist/admin-customers-BZP6Jv-i.js.map +0 -1
  190. package/dist/admin-dashboard-BJSonknv.js +0 -461
  191. package/dist/admin-dashboard-BJSonknv.js.map +0 -1
  192. package/dist/admin-detail-C03O0R6e.js +0 -1351
  193. package/dist/admin-detail-C03O0R6e.js.map +0 -1
  194. package/dist/admin-detail-C6VH3i2v.js +0 -293
  195. package/dist/admin-detail-NApy5bio.js +0 -337
  196. package/dist/admin-detail-cijme9Lc.js.map +0 -1
  197. package/dist/admin-format-D9Ablh0P.js +0 -169
  198. package/dist/admin-format-D9Ablh0P.js.map +0 -1
  199. package/dist/admin-health-CnagC763.js.map +0 -1
  200. package/dist/admin-metering-DM4KhjOq.js +0 -1717
  201. package/dist/admin-ops-mwzj-jpg.js +0 -358
  202. package/dist/admin-price-detail--5Bovz20.js.map +0 -1
  203. package/dist/admin-price-format-C-pus9FL.js.map +0 -1
  204. package/dist/admin-price-wizard-Cj_Bgh-V.js +0 -354
  205. package/dist/admin-price-wizard-Cj_Bgh-V.js.map +0 -1
  206. package/dist/admin-provider-prices-B8Oc86dP.js +0 -240
  207. package/dist/admin-range-picker-CSWcCYkg.js.map +0 -1
  208. package/dist/admin-records-CWbfqyT8.js +0 -390
  209. package/dist/admin-reports-CAHWO_d6.js +0 -319
  210. package/dist/admin-reports-CAHWO_d6.js.map +0 -1
  211. package/dist/admin-settings-BrvNTJlM.js +0 -1818
  212. package/dist/admin-settings-BrvNTJlM.js.map +0 -1
  213. package/dist/admin-status-badge-BLEGt2Fw.js.map +0 -1
  214. package/dist/admin-subscriptions-PL5G3f0O.js.map +0 -1
  215. package/dist/admin-tabs-DR74xX0-.js +0 -156
  216. package/dist/admin-tabs-DR74xX0-.js.map +0 -1
  217. package/dist/admin-utils-CX097OR7.js.map +0 -1
  218. package/dist/admin-widget-viz-DVV9aTQp.js +0 -643
  219. package/dist/admin-widget-viz-DVV9aTQp.js.map +0 -1
  220. package/dist/client-DwsFGm4M.js.map +0 -1
  221. package/dist/hooks-C-MhXjQh.js.map +0 -1
@@ -1,23 +1,22 @@
1
- import { E as e, O as t, _ as n, c as r, p as i, r as a, s as o, w as s } from "./admin-utils-CX097OR7.js";
2
- import { t as c } from "./admin-tile-grids-Gc67MtA6.js";
3
- import { t as l } from "./admin-fact-card-lN-MsuSp.js";
4
- import { t as u } from "./admin-missing-record-G2Jz-VUn.js";
5
- import { t as d } from "./admin-form-field-errors-Cuhy38F1.js";
6
- import { t as f } from "./admin-status-badge-BLEGt2Fw.js";
7
- import { t as p } from "./admin-typed-confirm-dialog-B_00EHlT.js";
8
- import { t as m } from "./admin-badge-CAlUmS2s.js";
9
- import { t as h } from "./admin-button-Bn4otsuw.js";
10
- import { a as g, o as _, r as v, t as y } from "./admin-card-BHKW1dfB.js";
11
- import { a as b, i as x, n as S, o as ee, r as te, s as C, t as ne } from "./admin-dialog-CgYGInHi.js";
12
- import { t as w } from "./admin-input-B_EUzCAE.js";
13
- import { t as T } from "./admin-label-DQsOkp1p.js";
14
- import { a as re, i as ie, n as ae, r as E, t as oe } from "./admin-select-DSGCZFiZ.js";
15
- import { a as D, n as se, o as ce, r as O, s as k, t as A } from "./admin-table-DIKl2rpV.js";
16
- import { i as le, r as ue } from "./admin-dialog-width-C_WFpow0.js";
17
- import { d as j, i as M, o as N, r as P, s as F } from "./admin-format-D9Ablh0P.js";
18
- import { n as I } from "./admin-price-format-C-pus9FL.js";
19
- import { t as de } from "./admin-dunning-D8lAP7OA.js";
20
- import { a as L } from "./admin-capabilities-DS-X-__V.js";
1
+ import { J as e, K as t, O as n, P as r, R as i, X as a, c as o, g as s, k as c, l, o as u, r as d, w as f } from "./admin-format-Bc4NWK0F.js";
2
+ import { t as p } from "./admin-tile-grids-Gc67MtA6.js";
3
+ import { t as m } from "./admin-fact-card-2DujC_r3.js";
4
+ import { t as h } from "./admin-missing-record-B_9LpSIW.js";
5
+ import { t as g } from "./admin-form-field-errors-Cuhy38F1.js";
6
+ import { t as _ } from "./admin-status-badge-B8rjk6QR.js";
7
+ import { t as v } from "./admin-typed-confirm-dialog-BvAYEh3H.js";
8
+ import { t as y } from "./admin-badge-C_-j7ANF.js";
9
+ import { t as b } from "./admin-button-BV5MAL2H.js";
10
+ import { a as x, o as S, r as ee, t as te } from "./admin-card-DQ61c-kV.js";
11
+ import { a as C, i as ne, n as re, o as ie, r as w, s as T, t as ae } from "./admin-dialog-BxRcYcQM.js";
12
+ import { t as E } from "./admin-input-BZ2ExV_5.js";
13
+ import { t as D } from "./admin-label-DecDO0oV.js";
14
+ import { a as oe, i as O, n as k, r as se, t as ce } from "./admin-select-CgZq2j0G.js";
15
+ import { a as A, n as j, o as M, r as N, s as le, t as P } from "./admin-table-ByPfWNq8.js";
16
+ import { i as ue, r as F } from "./admin-dialog-width-C_WFpow0.js";
17
+ import { n as I } from "./admin-price-format-Btdg11-J.js";
18
+ import { t as de } from "./admin-dunning-CDy6aMAj.js";
19
+ import { a as L } from "./admin-capabilities-B3ZfkA49.js";
21
20
  import * as R from "react";
22
21
  import { useMutation as z, useQuery as B, useQueryClient as V } from "@tanstack/react-query";
23
22
  import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
@@ -26,7 +25,7 @@ import { ArrowLeft01Icon as K } from "@hugeicons/core-free-icons";
26
25
  import { useForm as q, useStore as J } from "@tanstack/react-form";
27
26
  // src/admin/pages/subscriptions/subscription-change-options.ts
28
27
  function fe(e) {
29
- let t = e.price, n = `${F(t.unit_amount, t.currency)}${t.quantity ? " per seat" : ""}`;
28
+ let t = e.price, n = `${l(t.unit_amount, t.currency)}${t.quantity ? " per seat" : ""}`;
30
29
  return [
31
30
  e.product.display_name,
32
31
  e.direction,
@@ -51,63 +50,63 @@ function me({ product: e, price: t, scheduledChange: n, targets: r }) {
51
50
  }
52
51
  // src/admin/pages/subscriptions/change-subscription-dialog.tsx
53
52
  function Y(e) {
54
- let { selectedMerchant: t } = i();
53
+ let { selectedMerchant: t } = r();
55
54
  return /* @__PURE__ */ U(he, { ...e }, `${t() ?? ""}:${e.subscriptionId}`);
56
55
  }
57
- function he({ subscriptionId: r, customerId: a, product: o, price: c, quantity: l, scheduledChange: u }) {
58
- let { toast: d, toastApiError: f, adminMutations: p, adminQueries: g } = i(), { id: _, text: v } = t(), [y, D] = R.useState(!1), [se, ce] = R.useState(""), [O, k] = R.useState(""), [A, ue] = R.useState(""), [j, M] = R.useState(""), P = R.useRef(/* @__PURE__ */ new Map()), I = R.useRef(0);
56
+ function he({ subscriptionId: n, customerId: s, product: c, price: u, quantity: d, scheduledChange: f }) {
57
+ let { toast: p, toastApiError: m, adminMutations: h, adminQueries: g } = r(), { id: _, text: v } = a(), [x, S] = R.useState(!1), [ee, te] = R.useState(""), [A, j] = R.useState(""), [M, N] = R.useState(""), [le, P] = R.useState(""), F = R.useRef(/* @__PURE__ */ new Map()), I = R.useRef(0);
59
58
  R.useEffect(() => () => {
60
59
  I.current++;
61
60
  }, []);
62
- let de = V(), L = z(p.previewSubscriptionChange(r)), H = z(p.changeSubscription(de, r, a)), G = B(g.subscriptionChangeOptions(r)), K = me({
63
- product: o,
64
- price: c,
65
- scheduledChange: u,
61
+ let de = V(), L = z(h.previewSubscriptionChange(n)), H = z(h.changeSubscription(de, n, s)), G = B(g.subscriptionChangeOptions(n)), K = me({
62
+ product: c,
63
+ price: u,
64
+ scheduledChange: f,
66
65
  targets: G.data?.data ?? []
67
- }), q = K.find((e) => e.price.id === se), J = q?.price.quantity, Y = Number(O), he = !J || Number.isInteger(Y) && Y >= J.min && Y <= J.max, X = q && he ? {
66
+ }), q = K.find((e) => e.price.id === ee), J = q?.price.quantity, Y = Number(A), he = !J || Number.isInteger(Y) && Y >= J.min && Y <= J.max, X = q && he ? {
68
67
  price_id: q.price.id,
69
68
  ...J ? { quantity: Y } : {}
70
- } : void 0, ge = q?.direction === "current" && !u && (!J || Y === l), Z = X ? JSON.stringify(X) : "", Q = Z && j === Z ? L.data : void 0, _e = G.isPending ? v("Loading plans…") : G.isError ? n(G.error).text : K.length === 0 ? v("No eligible recurring plans share this tier group and currency.") : void 0, $ = (e) => {
71
- I.current++, D(e);
69
+ } : void 0, ge = q?.direction === "current" && !f && (!J || Y === d), Z = X ? JSON.stringify(X) : "", Q = Z && le === Z ? L.data : void 0, _e = G.isPending ? v("Loading plans…") : G.isError ? i(G.error).text : K.length === 0 ? v("No eligible recurring plans share this tier group and currency.") : void 0, $ = (e) => {
70
+ I.current++, S(e);
72
71
  }, ve = (e) => {
73
72
  I.current++;
74
73
  let t = K.find((t) => t.price.id === e)?.price;
75
- ce(e ?? ""), k(String(t ? pe(t, l) ?? "" : "")), M(""), L.reset(), H.reset();
74
+ te(e ?? ""), j(String(t ? pe(t, d) ?? "" : "")), P(""), L.reset(), H.reset();
76
75
  }, ye = (e) => {
77
- I.current++, k(e), M(""), L.reset(), H.reset();
76
+ I.current++, j(e), P(""), L.reset(), H.reset();
78
77
  }, be = L.error instanceof Error ? L.error.message : "", xe = H.error instanceof Error ? H.error.message : "", Se = H.data?.message, Ce = H.data?.next_action?.url ?? void 0;
79
- return /* @__PURE__ */ W(ne, {
80
- open: y,
78
+ return /* @__PURE__ */ W(ae, {
79
+ open: x,
81
80
  onOpenChange: $,
82
- children: [/* @__PURE__ */ U(C, { render: /* @__PURE__ */ U(h, {
81
+ children: [/* @__PURE__ */ U(T, { render: /* @__PURE__ */ U(b, {
83
82
  variant: "outline",
84
83
  size: "sm",
85
84
  disabled: !!_e && !H.variables,
86
85
  title: _e,
87
86
  children: /* @__PURE__ */ U(e, { id: "Change subscription" })
88
- }) }), /* @__PURE__ */ W(S, {
89
- className: le,
87
+ }) }), /* @__PURE__ */ W(re, {
88
+ className: ue,
90
89
  children: [
91
- /* @__PURE__ */ W(b, { children: [/* @__PURE__ */ U(ee, { children: /* @__PURE__ */ U(e, { id: "Change subscription" }) }), /* @__PURE__ */ U(te, { children: /* @__PURE__ */ U(e, { id: "Schedule the customer's plan or seats for the next renewal. No card is charged now. Choosing the current plan and seats clears a pending change. The customer is told." }) })] }),
90
+ /* @__PURE__ */ W(C, { children: [/* @__PURE__ */ U(ie, { children: /* @__PURE__ */ U(e, { id: "Change subscription" }) }), /* @__PURE__ */ U(w, { children: /* @__PURE__ */ U(e, { id: "Schedule the customer's plan or seats for the next renewal. No card is charged now. Choosing the current plan and seats clears a pending change. The customer is told." }) })] }),
92
91
  /* @__PURE__ */ W("div", {
93
92
  className: "grid gap-5",
94
93
  children: [
95
94
  /* @__PURE__ */ W("div", {
96
95
  className: "grid gap-1.5",
97
96
  children: [
98
- /* @__PURE__ */ U(T, {
97
+ /* @__PURE__ */ U(D, {
99
98
  htmlFor: _("subscription-tier"),
100
99
  children: /* @__PURE__ */ U(e, { id: "New plan" })
101
100
  }),
102
- /* @__PURE__ */ W(oe, {
103
- value: se,
101
+ /* @__PURE__ */ W(ce, {
102
+ value: ee,
104
103
  onValueChange: ve,
105
- children: [/* @__PURE__ */ U(ie, {
104
+ children: [/* @__PURE__ */ U(O, {
106
105
  id: _("subscription-tier"),
107
106
  className: "w-full",
108
107
  disabled: G.isPending,
109
- children: /* @__PURE__ */ U(re, { placeholder: G.isPending ? "Loading plans…" : "Choose a plan" })
110
- }), /* @__PURE__ */ U(ae, { children: K.map((e) => /* @__PURE__ */ U(E, {
108
+ children: /* @__PURE__ */ U(oe, { placeholder: G.isPending ? "Loading plans…" : "Choose a plan" })
109
+ }), /* @__PURE__ */ U(k, { children: K.map((e) => /* @__PURE__ */ U(se, {
111
110
  value: e.price.id,
112
111
  children: fe(e)
113
112
  }, e.price.id)) })]
@@ -126,17 +125,17 @@ function he({ subscriptionId: r, customerId: a, product: o, price: c, quantity:
126
125
  J && /* @__PURE__ */ W("div", {
127
126
  className: "grid gap-1.5",
128
127
  children: [
129
- /* @__PURE__ */ U(T, {
128
+ /* @__PURE__ */ U(D, {
130
129
  htmlFor: _("subscription-seats"),
131
130
  children: /* @__PURE__ */ U(e, { id: "Seats" })
132
131
  }),
133
- /* @__PURE__ */ U(w, {
132
+ /* @__PURE__ */ U(E, {
134
133
  id: _("subscription-seats"),
135
134
  type: "number",
136
135
  inputMode: "numeric",
137
136
  min: J.min,
138
137
  max: J.max,
139
- value: O,
138
+ value: A,
140
139
  onChange: (e) => ye(e.target.value)
141
140
  }),
142
141
  /* @__PURE__ */ W("p", {
@@ -153,16 +152,16 @@ function he({ subscriptionId: r, customerId: a, product: o, price: c, quantity:
153
152
  /* @__PURE__ */ W("div", {
154
153
  className: "grid gap-1.5",
155
154
  children: [
156
- /* @__PURE__ */ U(T, {
155
+ /* @__PURE__ */ U(D, {
157
156
  htmlFor: _("subscription-change-reason"),
158
157
  children: /* @__PURE__ */ U(e, { id: "Reason" })
159
158
  }),
160
- /* @__PURE__ */ U(w, {
159
+ /* @__PURE__ */ U(E, {
161
160
  id: _("subscription-change-reason"),
162
- value: A,
161
+ value: M,
163
162
  maxLength: 500,
164
163
  placeholder: v("What the customer asked for"),
165
- onChange: (e) => ue(e.target.value)
164
+ onChange: (e) => N(e.target.value)
166
165
  }),
167
166
  /* @__PURE__ */ U("p", {
168
167
  className: "text-xs text-muted-foreground",
@@ -179,7 +178,7 @@ function he({ subscriptionId: r, customerId: a, product: o, price: c, quantity:
179
178
  children: [/* @__PURE__ */ U("span", {
180
179
  className: "text-sm font-medium",
181
180
  children: /* @__PURE__ */ U(e, { id: "Review" })
182
- }), /* @__PURE__ */ U(m, {
181
+ }), /* @__PURE__ */ U(y, {
183
182
  variant: "secondary",
184
183
  children: Q.effective === "now" ? "Immediate" : "At renewal"
185
184
  })]
@@ -204,7 +203,7 @@ function he({ subscriptionId: r, customerId: a, product: o, price: c, quantity:
204
203
  children: /* @__PURE__ */ U(e, { id: "Due now" })
205
204
  }), /* @__PURE__ */ U("dd", {
206
205
  className: "font-medium tabular-nums",
207
- children: F(Q.amount_due_now, Q.currency)
206
+ children: l(Q.amount_due_now, Q.currency)
208
207
  })]
209
208
  }),
210
209
  /* @__PURE__ */ W("div", {
@@ -214,7 +213,7 @@ function he({ subscriptionId: r, customerId: a, product: o, price: c, quantity:
214
213
  children: /* @__PURE__ */ U(e, { id: "Next charge" })
215
214
  }), /* @__PURE__ */ U("dd", {
216
215
  className: "font-medium tabular-nums",
217
- children: F(Q.next_charge_amount, Q.currency)
216
+ children: l(Q.next_charge_amount, Q.currency)
218
217
  })]
219
218
  }),
220
219
  /* @__PURE__ */ W("div", {
@@ -224,7 +223,7 @@ function he({ subscriptionId: r, customerId: a, product: o, price: c, quantity:
224
223
  children: /* @__PURE__ */ U(e, { id: "Effective" })
225
224
  }), /* @__PURE__ */ U("dd", {
226
225
  className: "font-medium",
227
- children: Q.effective === "now" ? "Immediately" : N(Q.next_charge_date)
226
+ children: Q.effective === "now" ? "Immediately" : o(Q.next_charge_date)
228
227
  })]
229
228
  }),
230
229
  /* @__PURE__ */ W("div", {
@@ -234,7 +233,7 @@ function he({ subscriptionId: r, customerId: a, product: o, price: c, quantity:
234
233
  children: /* @__PURE__ */ U(e, { id: "Next billing date" })
235
234
  }), /* @__PURE__ */ U("dd", {
236
235
  className: "font-medium tabular-nums",
237
- children: N(Q.next_charge_date)
236
+ children: o(Q.next_charge_date)
238
237
  })]
239
238
  })
240
239
  ]
@@ -263,37 +262,37 @@ function he({ subscriptionId: r, customerId: a, product: o, price: c, quantity:
263
262
  })
264
263
  ]
265
264
  }),
266
- /* @__PURE__ */ W(x, { children: [/* @__PURE__ */ U(h, {
265
+ /* @__PURE__ */ W(ne, { children: [/* @__PURE__ */ U(b, {
267
266
  type: "button",
268
267
  variant: "outline",
269
268
  onClick: () => $(!1),
270
269
  children: /* @__PURE__ */ U(e, { id: "Cancel" })
271
- }), Q ? /* @__PURE__ */ U(h, {
270
+ }), Q ? /* @__PURE__ */ U(b, {
272
271
  type: "button",
273
- disabled: H.isPending || !A.trim() || !!H.data && H.data?.status !== "processing",
272
+ disabled: H.isPending || !M.trim() || !!H.data && H.data?.status !== "processing",
274
273
  onClick: async () => {
275
274
  if (!X) return;
276
- let e = I.current, t = P.current.get(Z) ?? crypto.randomUUID();
277
- P.current.set(Z, t);
278
- let n = () => {
279
- P.current.get(Z) === t && P.current.delete(Z);
275
+ let e = I.current, n = F.current.get(Z) ?? crypto.randomUUID();
276
+ F.current.set(Z, n);
277
+ let r = () => {
278
+ F.current.get(Z) === n && F.current.delete(Z);
280
279
  };
281
280
  try {
282
- let r = await H.mutateAsync({
281
+ let t = await H.mutateAsync({
283
282
  change: {
284
283
  ...X,
285
- reason: A.trim()
284
+ reason: M.trim()
286
285
  },
287
- idempotencyKey: t
286
+ idempotencyKey: n
288
287
  });
289
- if ((r.status === "succeeded" || r.status === "blocked") && n(), I.current !== e) return;
290
- r.status === "succeeded" && (d.success(r.effective === "now" ? "Subscription changed" : "Change scheduled for the next renewal"), $(!1), ce(""), k(""), ue(""), M(""), L.reset(), H.reset()), r.status === "processing" && d.info("The provider is still confirming this change. Check again to read the result.");
291
- } catch (t) {
292
- t instanceof s && (t.status === 402 || t.status === 409 && (t.code === "subscription_change_refused" || t.code === "subscription_change_idempotency_conflict")) && n(), I.current === e && f(t, "Change subscription");
288
+ if ((t.status === "succeeded" || t.status === "blocked") && r(), I.current !== e) return;
289
+ t.status === "succeeded" && (p.success(t.effective === "now" ? "Subscription changed" : "Change scheduled for the next renewal"), $(!1), te(""), j(""), N(""), P(""), L.reset(), H.reset()), t.status === "processing" && p.info("The provider is still confirming this change. Check again to read the result.");
290
+ } catch (n) {
291
+ n instanceof t && (n.status === 402 || n.status === 409 && (n.code === "subscription_change_refused" || n.code === "subscription_change_idempotency_conflict")) && r(), I.current === e && m(n, "Change subscription");
293
292
  }
294
293
  },
295
294
  children: H.isPending ? "Applying…" : H.data ? H.data.status === "processing" ? "Check result" : H.data.status === "blocked" ? "Change blocked" : "Action required" : "Confirm change"
296
- }) : /* @__PURE__ */ U(h, {
295
+ }) : /* @__PURE__ */ U(b, {
297
296
  type: "button",
298
297
  disabled: !X || ge || L.isPending,
299
298
  onClick: async () => {
@@ -301,9 +300,9 @@ function he({ subscriptionId: r, customerId: a, product: o, price: c, quantity:
301
300
  let e = I.current;
302
301
  try {
303
302
  if (await L.mutateAsync(X), I.current !== e) return;
304
- M(Z);
303
+ P(Z);
305
304
  } catch (t) {
306
- I.current === e && f(t, "Preview subscription change");
305
+ I.current === e && m(t, "Preview subscription change");
307
306
  }
308
307
  },
309
308
  children: L.isPending ? "Reviewing…" : "Review change"
@@ -315,29 +314,29 @@ function he({ subscriptionId: r, customerId: a, product: o, price: c, quantity:
315
314
  // src/admin/pages/subscriptions/detail.tsx
316
315
  var X = (e) => new Date(e).toLocaleDateString(void 0, { dateStyle: "medium" });
317
316
  function ge() {
318
- let { text: n } = t(), { adminQueries: s } = i(), d = L(), { id: p = "" } = r(), b = o(), { data: x, isPending: S, error: ee } = B(s.subscription(p)), { data: te } = B(s.payments({ subscription_id: p }, 20)), C = te?.data ?? [], { data: ne } = B(s.customer(x?.customer_id ?? ""));
319
- if (S) return /* @__PURE__ */ U("p", {
317
+ let { text: t } = a(), { adminQueries: i } = r(), u = L(), { id: g = "" } = c(), v = n(), { data: C, isPending: ne, error: re } = B(i.subscription(g)), { data: ie } = B(i.payments({ subscription_id: g }, 20)), w = ie?.data ?? [], { data: T } = B(i.customer(C?.customer_id ?? ""));
318
+ if (ne) return /* @__PURE__ */ U("p", {
320
319
  className: "text-sm text-muted-foreground",
321
320
  children: /* @__PURE__ */ U(e, { id: "Loading…" })
322
321
  });
323
- if (!x) return /* @__PURE__ */ U(u, {
322
+ if (!C) return /* @__PURE__ */ U(h, {
324
323
  title: "Subscription not found",
325
- error: ee,
324
+ error: re,
326
325
  back: "/subscriptions",
327
326
  backLabel: "Subscriptions"
328
327
  });
329
- let w = x.status === "active" || x.status === "past_due" || x.status === "awaiting_method" || x.status === "unverified", T = x.status === "active" || x.status === "past_due", re = T || x.status === "awaiting_method", ie = x.collection_policy === "engine" ? (x.rail === "nmi" || x.rail === "stripe") && (re || x.resumable) : x.rail === "nmi" && re, ae = ne ? P(ne) : void 0, E = x.product?.display_name;
328
+ let ae = C.status === "active" || C.status === "past_due" || C.status === "awaiting_method" || C.status === "unverified", E = C.status === "active" || C.status === "past_due", D = E || C.status === "awaiting_method", oe = C.collection_policy === "engine" ? (C.rail === "nmi" || C.rail === "stripe") && (D || C.resumable) : C.rail === "nmi" && D, O = T ? d(T) : void 0, k = C.product?.display_name;
330
329
  return /* @__PURE__ */ W("div", {
331
330
  className: "flex flex-col gap-4",
332
331
  children: [
333
332
  /* @__PURE__ */ W("div", {
334
333
  className: "flex flex-wrap items-center gap-3",
335
334
  children: [
336
- /* @__PURE__ */ U(h, {
335
+ /* @__PURE__ */ U(b, {
337
336
  variant: "ghost",
338
337
  size: "icon",
339
- onClick: () => b(-1),
340
- "aria-label": n("Back"),
338
+ onClick: () => v(-1),
339
+ "aria-label": t("Back"),
341
340
  children: /* @__PURE__ */ U(G, {
342
341
  icon: K,
343
342
  className: "size-4"
@@ -347,168 +346,168 @@ function ge() {
347
346
  className: "min-w-0",
348
347
  children: [/* @__PURE__ */ W("h1", {
349
348
  className: "flex flex-wrap items-center gap-2 text-2xl font-semibold tracking-tight",
350
- children: [E ?? n("Subscription"), /* @__PURE__ */ U(f, { status: x.status })]
349
+ children: [k ?? t("Subscription"), /* @__PURE__ */ U(_, { status: C.status })]
351
350
  }), /* @__PURE__ */ W("p", {
352
351
  className: "text-xs [overflow-wrap:anywhere] text-muted-foreground",
353
352
  children: [
354
- x.id,
353
+ C.id,
355
354
  " · ",
356
- x.rail,
357
- x.rail_subscription_id ? ` · ${x.rail_subscription_id}` : ""
355
+ C.rail,
356
+ C.rail_subscription_id ? ` · ${C.rail_subscription_id}` : ""
358
357
  ]
359
358
  })]
360
359
  }),
361
360
  /* @__PURE__ */ W("div", {
362
361
  className: "flex flex-wrap gap-2 sm:ml-auto",
363
362
  children: [
364
- d && x.resumable && /* @__PURE__ */ U(_e, {
365
- id: x.id,
366
- customerId: x.customer_id
363
+ u && C.resumable && /* @__PURE__ */ U(_e, {
364
+ id: C.id,
365
+ customerId: C.customer_id
367
366
  }),
368
- d && T && /* @__PURE__ */ U(Y, {
369
- subscriptionId: x.id,
370
- customerId: x.customer_id,
371
- product: x.product,
372
- price: x.price,
373
- quantity: x.quantity,
374
- scheduledChange: x.scheduled_change
367
+ u && E && /* @__PURE__ */ U(Y, {
368
+ subscriptionId: C.id,
369
+ customerId: C.customer_id,
370
+ product: C.product,
371
+ price: C.price,
372
+ quantity: C.quantity,
373
+ scheduledChange: C.scheduled_change
375
374
  }),
376
- d && ie && /* @__PURE__ */ U(ve, {
377
- subscriptionId: x.id,
378
- customerId: x.customer_id,
379
- rail: x.rail
375
+ u && oe && /* @__PURE__ */ U(ve, {
376
+ subscriptionId: C.id,
377
+ customerId: C.customer_id,
378
+ rail: C.rail
380
379
  }),
381
- d && w && /* @__PURE__ */ U(Q, {
382
- id: x.id,
383
- customerId: x.customer_id,
384
- customer: ae,
385
- plan: E,
386
- periodEnd: x.current_period_ends_at
380
+ u && ae && /* @__PURE__ */ U(Q, {
381
+ id: C.id,
382
+ customerId: C.customer_id,
383
+ customer: O,
384
+ plan: k,
385
+ periodEnd: C.current_period_ends_at
387
386
  })
388
387
  ]
389
388
  })
390
389
  ]
391
390
  }),
392
391
  /* @__PURE__ */ W("div", {
393
- className: c,
392
+ className: p,
394
393
  children: [
395
- /* @__PURE__ */ U(l, {
396
- label: n("Customer"),
397
- children: x.customer_id ? /* @__PURE__ */ U(a, {
394
+ /* @__PURE__ */ U(m, {
395
+ label: t("Customer"),
396
+ children: C.customer_id ? /* @__PURE__ */ U(f, {
398
397
  className: "text-xs underline-offset-2 hover:underline",
399
- to: `/customers/${x.customer_id}`,
400
- children: ae ?? j(x.customer_id, 13)
398
+ to: `/customers/${C.customer_id}`,
399
+ children: O ?? s(C.customer_id, 13)
401
400
  }) : "—"
402
401
  }),
403
- /* @__PURE__ */ U(l, {
404
- label: n("Started"),
405
- children: N(x.started_at)
402
+ /* @__PURE__ */ U(m, {
403
+ label: t("Started"),
404
+ children: o(C.started_at)
406
405
  }),
407
- /* @__PURE__ */ W(l, {
408
- label: n("Current period"),
406
+ /* @__PURE__ */ W(m, {
407
+ label: t("Current period"),
409
408
  children: [
410
- N(x.current_period_starts_at),
409
+ o(C.current_period_starts_at),
411
410
  " →",
412
411
  " ",
413
- N(x.current_period_ends_at)
412
+ o(C.current_period_ends_at)
414
413
  ]
415
414
  }),
416
- /* @__PURE__ */ U(l, {
417
- label: n("Price"),
415
+ /* @__PURE__ */ U(m, {
416
+ label: t("Price"),
418
417
  children: /* @__PURE__ */ W("div", {
419
418
  className: "flex flex-col gap-1",
420
419
  children: [
421
420
  /* @__PURE__ */ W("span", {
422
421
  className: "flex items-center gap-2",
423
- children: [x.price?.unit_amount !== void 0 && x.price?.currency ? /* @__PURE__ */ U(a, {
422
+ children: [C.price?.unit_amount !== void 0 && C.price?.currency ? /* @__PURE__ */ U(f, {
424
423
  className: "underline-offset-2 hover:underline",
425
- to: `/catalog/prices/${encodeURIComponent(x.price_id)}`,
426
- children: F(x.price.unit_amount, x.price.currency)
427
- }) : /* @__PURE__ */ U(a, {
424
+ to: `/catalog/prices/${encodeURIComponent(C.price_id)}`,
425
+ children: l(C.price.unit_amount, C.price.currency)
426
+ }) : /* @__PURE__ */ U(f, {
428
427
  className: "text-xs underline-offset-2 hover:underline",
429
- to: `/catalog/prices/${encodeURIComponent(x.price_id)}`,
430
- children: j(x.price_id ?? "—", 13)
431
- }), x.price?.archived && /* @__PURE__ */ U(m, {
428
+ to: `/catalog/prices/${encodeURIComponent(C.price_id)}`,
429
+ children: s(C.price_id ?? "—", 13)
430
+ }), C.price?.archived && /* @__PURE__ */ U(y, {
432
431
  variant: "secondary",
433
- title: n("Pinned to an archived (prior) version"),
432
+ title: t("Pinned to an archived (prior) version"),
434
433
  children: /* @__PURE__ */ U(e, { id: "prior version" })
435
434
  })]
436
435
  }),
437
- x.price?.key && /* @__PURE__ */ U("span", {
436
+ C.price?.key && /* @__PURE__ */ U("span", {
438
437
  className: "text-xs text-muted-foreground",
439
- children: x.price.key
438
+ children: C.price.key
440
439
  }),
441
- x.scheduled_change && /* @__PURE__ */ U(ye, { change: x.scheduled_change })
440
+ C.scheduled_change && /* @__PURE__ */ U(ye, { change: C.scheduled_change })
442
441
  ]
443
442
  })
444
443
  }),
445
- x.quantity !== null && /* @__PURE__ */ W(l, {
446
- label: n("Seats"),
447
- children: [x.quantity, x.scheduled_change?.quantity != null && ` → ${x.scheduled_change.quantity} at renewal`]
444
+ C.quantity !== null && /* @__PURE__ */ W(m, {
445
+ label: t("Seats"),
446
+ children: [C.quantity, C.scheduled_change?.quantity != null && ` → ${C.scheduled_change.quantity} at renewal`]
448
447
  }),
449
- /* @__PURE__ */ U(l, {
450
- label: n("Dunning"),
451
- children: x.dunning ? de(x.dunning) : "—"
448
+ /* @__PURE__ */ U(m, {
449
+ label: t("Dunning"),
450
+ children: C.dunning ? de(C.dunning) : "—"
452
451
  }),
453
- /* @__PURE__ */ U(l, {
454
- label: x.dunning?.waiting_for_new_card ? "Card deadline" : "Final retry",
455
- children: N(x.dunning?.final_retry_at)
452
+ /* @__PURE__ */ U(m, {
453
+ label: C.dunning?.waiting_for_new_card ? "Card deadline" : "Final retry",
454
+ children: o(C.dunning?.final_retry_at)
456
455
  }),
457
- /* @__PURE__ */ U(l, {
458
- label: n("Last decline"),
459
- children: x.dunning?.last_failure_reason ?? "—"
456
+ /* @__PURE__ */ U(m, {
457
+ label: t("Last decline"),
458
+ children: C.dunning?.last_failure_reason ?? "—"
460
459
  }),
461
- /* @__PURE__ */ U(l, {
462
- label: n("Canceled"),
463
- children: x.canceled_at ? /* @__PURE__ */ W(H, { children: [N(x.canceled_at), x.cancel_type && /* @__PURE__ */ U("span", {
460
+ /* @__PURE__ */ U(m, {
461
+ label: t("Canceled"),
462
+ children: C.canceled_at ? /* @__PURE__ */ W(H, { children: [o(C.canceled_at), C.cancel_type && /* @__PURE__ */ U("span", {
464
463
  className: "block text-xs text-muted-foreground",
465
- children: n(Z[x.cancel_type] ?? x.cancel_type)
464
+ children: t(Z[C.cancel_type] ?? C.cancel_type)
466
465
  })] }) : "—"
467
466
  })
468
467
  ]
469
468
  }),
470
- /* @__PURE__ */ W(y, { children: [/* @__PURE__ */ U(g, { children: /* @__PURE__ */ U(_, {
469
+ /* @__PURE__ */ W(te, { children: [/* @__PURE__ */ U(x, { children: /* @__PURE__ */ U(S, {
471
470
  className: "text-sm",
472
471
  children: /* @__PURE__ */ U(e, { id: "Payments" })
473
- }) }), /* @__PURE__ */ U(v, { children: C.length ? /* @__PURE__ */ W(A, { children: [/* @__PURE__ */ U(ce, { children: /* @__PURE__ */ W(k, {
472
+ }) }), /* @__PURE__ */ U(ee, { children: w.length ? /* @__PURE__ */ W(P, { children: [/* @__PURE__ */ U(M, { children: /* @__PURE__ */ W(le, {
474
473
  className: "hover:bg-transparent",
475
474
  children: [
476
- /* @__PURE__ */ U(D, {
475
+ /* @__PURE__ */ U(A, {
477
476
  className: "text-muted-foreground",
478
477
  children: /* @__PURE__ */ U(e, { id: "Payment" })
479
478
  }),
480
- /* @__PURE__ */ U(D, {
479
+ /* @__PURE__ */ U(A, {
481
480
  className: "text-muted-foreground",
482
481
  children: /* @__PURE__ */ U(e, { id: "Status" })
483
482
  }),
484
- /* @__PURE__ */ U(D, {
483
+ /* @__PURE__ */ U(A, {
485
484
  className: "text-muted-foreground @max-[36rem]/page:hidden",
486
485
  children: /* @__PURE__ */ U(e, { id: "Kind" })
487
486
  }),
488
- /* @__PURE__ */ U(D, {
487
+ /* @__PURE__ */ U(A, {
489
488
  className: "text-muted-foreground",
490
489
  children: /* @__PURE__ */ U(e, { id: "Amount" })
491
490
  }),
492
- /* @__PURE__ */ U(D, {
491
+ /* @__PURE__ */ U(A, {
493
492
  className: "text-muted-foreground @max-[36rem]/page:hidden",
494
493
  children: /* @__PURE__ */ U(e, { id: "Created" })
495
494
  })
496
495
  ]
497
- }) }), /* @__PURE__ */ U(se, { children: C.map((e) => /* @__PURE__ */ W(k, { children: [
498
- /* @__PURE__ */ U(O, { children: /* @__PURE__ */ U(a, {
496
+ }) }), /* @__PURE__ */ U(j, { children: w.map((e) => /* @__PURE__ */ W(le, { children: [
497
+ /* @__PURE__ */ U(N, { children: /* @__PURE__ */ U(f, {
499
498
  className: "text-xs underline-offset-2 hover:underline",
500
499
  to: `/payments/${e.id}`,
501
- children: j(e.id, 13)
500
+ children: s(e.id, 13)
502
501
  }) }),
503
- /* @__PURE__ */ U(O, { children: /* @__PURE__ */ U(f, { status: e.status }) }),
504
- /* @__PURE__ */ U(O, {
502
+ /* @__PURE__ */ U(N, { children: /* @__PURE__ */ U(_, { status: e.status }) }),
503
+ /* @__PURE__ */ U(N, {
505
504
  className: "@max-[36rem]/page:hidden",
506
505
  children: e.kind
507
506
  }),
508
- /* @__PURE__ */ U(O, { children: F(e.amount, e.currency) }),
509
- /* @__PURE__ */ U(O, {
507
+ /* @__PURE__ */ U(N, { children: l(e.amount, e.currency) }),
508
+ /* @__PURE__ */ U(N, {
510
509
  className: "@max-[36rem]/page:hidden",
511
- children: N(e.created_at)
510
+ children: o(e.created_at)
512
511
  })
513
512
  ] }, e.id)) })] }) : /* @__PURE__ */ U("p", {
514
513
  className: "text-sm text-muted-foreground",
@@ -520,46 +519,48 @@ function ge() {
520
519
  var Z = {
521
520
  user: "By the customer",
522
521
  merchant: "By staff",
523
- expired: "Renewal payment failed",
522
+ expired: "Not renewed",
524
523
  chargeback: "After a chargeback",
525
- upgrade: "Replaced by an upgrade"
524
+ upgrade: "Replaced by an upgrade",
525
+ provider: "Ended by the provider",
526
+ abandoned: "First payment never completed"
526
527
  };
527
- function Q({ id: n, customerId: r, customer: a, plan: o, periodEnd: s }) {
528
- let { toast: c, toastApiError: l, adminMutations: u } = i(), { text: d, id: f } = t(), [m, g] = R.useState(!1), _ = V(), v = z(u.cancelSubscription(_, n, r)), y = q({ defaultValues: {
528
+ function Q({ id: t, customerId: n, customer: i, plan: o, periodEnd: s }) {
529
+ let { toast: c, toastApiError: l, adminMutations: u } = r(), { text: d, id: f } = a(), [p, m] = R.useState(!1), h = V(), g = z(u.cancelSubscription(h, t, n)), _ = q({ defaultValues: {
529
530
  reason: "",
530
531
  revokeAccess: !1
531
- } }), b = J(y.store, (e) => e.values.revokeAccess), x = a ?? d("The customer"), S = o ?? d("their access");
532
- return /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(h, {
532
+ } }), y = J(_.store, (e) => e.values.revokeAccess), x = i ?? d("The customer"), S = o ?? d("their access");
533
+ return /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(b, {
533
534
  variant: "destructive",
534
535
  size: "sm",
535
- onClick: () => g(!0),
536
+ onClick: () => m(!0),
536
537
  children: /* @__PURE__ */ U(e, { id: "Cancel membership" })
537
- }), /* @__PURE__ */ U(p, {
538
- open: m,
538
+ }), /* @__PURE__ */ U(v, {
539
+ open: p,
539
540
  onOpenChange: (e) => {
540
- g(e), e || (y.reset(), v.reset());
541
+ m(e), e || (_.reset(), g.reset());
541
542
  },
542
543
  title: d("Cancel this membership?"),
543
- description: `${d("Renewal stops now and can't be restarted from here.")} ${b ? `${x} ${d("loses")} ${S} ${d("now. No refund is made.")}` : `${x} ${d("keeps")} ${S} ${s ? `${d("until")} ${X(s)}.` : d("until the current period ends.")}`}`,
544
+ description: `${d("Renewal stops now and can't be restarted from here.")} ${y ? `${x} ${d("loses")} ${S} ${d("now. No refund is made.")}` : `${x} ${d("keeps")} ${S} ${s ? `${d("until")} ${X(s)}.` : d("until the current period ends.")}`}`,
544
545
  confirmationWord: "CANCEL",
545
546
  actionLabel: d("Cancel membership"),
546
547
  onConfirm: async () => {
547
548
  try {
548
- await v.mutateAsync(y.state.values), c.success("Subscription canceled");
549
+ await g.mutateAsync(_.state.values), c.success("Subscription canceled");
549
550
  } catch (e) {
550
551
  throw l(e, "Cancel subscription"), e;
551
552
  }
552
553
  },
553
554
  children: /* @__PURE__ */ W("div", {
554
555
  className: "grid gap-3",
555
- children: [/* @__PURE__ */ U(y.Field, {
556
+ children: [/* @__PURE__ */ U(_.Field, {
556
557
  name: "reason",
557
558
  children: (t) => /* @__PURE__ */ W("div", {
558
559
  className: "grid gap-1.5",
559
- children: [/* @__PURE__ */ U(T, {
560
+ children: [/* @__PURE__ */ U(D, {
560
561
  htmlFor: f("cancel-reason"),
561
562
  children: /* @__PURE__ */ U(e, { id: "Reason" })
562
- }), /* @__PURE__ */ U(w, {
563
+ }), /* @__PURE__ */ U(E, {
563
564
  id: f("cancel-reason"),
564
565
  value: t.state.value,
565
566
  onBlur: t.handleBlur,
@@ -567,9 +568,9 @@ function Q({ id: n, customerId: r, customer: a, plan: o, periodEnd: s }) {
567
568
  placeholder: d("why is this being canceled?")
568
569
  })]
569
570
  })
570
- }), /* @__PURE__ */ U(y.Field, {
571
+ }), /* @__PURE__ */ U(_.Field, {
571
572
  name: "revokeAccess",
572
- children: (t) => /* @__PURE__ */ W(T, {
573
+ children: (t) => /* @__PURE__ */ W(D, {
573
574
  className: "flex min-h-10 items-center gap-2 font-normal",
574
575
  children: [/* @__PURE__ */ U("input", {
575
576
  type: "checkbox",
@@ -583,8 +584,8 @@ function Q({ id: n, customerId: r, customer: a, plan: o, periodEnd: s }) {
583
584
  })] });
584
585
  }
585
586
  function _e({ id: e, customerId: t }) {
586
- let { toast: n, toastApiError: r, adminMutations: a } = i(), o = V(), s = z(a.resumeSubscription(o, e, t));
587
- return /* @__PURE__ */ U(h, {
587
+ let { toast: n, toastApiError: i, adminMutations: a } = r(), o = V(), s = z(a.resumeSubscription(o, e, t));
588
+ return /* @__PURE__ */ U(b, {
588
589
  variant: "outline",
589
590
  size: "sm",
590
591
  disabled: s.isPending,
@@ -592,36 +593,36 @@ function _e({ id: e, customerId: t }) {
592
593
  try {
593
594
  await s.mutateAsync(), n.success("Resume queued");
594
595
  } catch (e) {
595
- r(e, "Resume subscription");
596
+ i(e, "Resume subscription");
596
597
  }
597
598
  },
598
599
  children: s.isPending ? "Queuing…" : "Resume"
599
600
  });
600
601
  }
601
602
  var $ = "default";
602
- function ve({ subscriptionId: n, customerId: r, rail: a }) {
603
- let { toast: o, toastApiError: s, adminMutations: c, adminQueries: l } = i(), { id: u, text: f } = t(), [p, m] = R.useState(!1), g = V(), _ = z(c.changeSubscriptionPaymentMethod(g, n, r)), { data: v } = B(l.customerPaymentMethods(p ? r : void 0)), y = q({
603
+ function ve({ subscriptionId: t, customerId: n, rail: i }) {
604
+ let { toast: o, toastApiError: s, adminMutations: c, adminQueries: l } = r(), { id: d, text: f } = a(), [p, m] = R.useState(!1), h = V(), _ = z(c.changeSubscriptionPaymentMethod(h, t, n)), { data: v } = B(l.customerPaymentMethods(p ? n : void 0)), y = q({
604
605
  defaultValues: { paymentMethodId: "" },
605
606
  onSubmit: async ({ value: e }) => {
606
607
  try {
607
- await _.mutateAsync(e.paymentMethodId === $ ? null : e.paymentMethodId), o.success("Payment method updated"), w(!1);
608
+ await _.mutateAsync(e.paymentMethodId === $ ? null : e.paymentMethodId), o.success("Payment method updated"), x(!1);
608
609
  } catch (e) {
609
610
  s(e, "Change payment method");
610
611
  }
611
612
  }
612
- }), w = (e) => {
613
+ }), x = (e) => {
613
614
  m(e), e || (y.reset(), _.reset());
614
615
  };
615
- return /* @__PURE__ */ W(ne, {
616
+ return /* @__PURE__ */ W(ae, {
616
617
  open: p,
617
- onOpenChange: w,
618
- children: [/* @__PURE__ */ U(C, { render: /* @__PURE__ */ U(h, {
618
+ onOpenChange: x,
619
+ children: [/* @__PURE__ */ U(T, { render: /* @__PURE__ */ U(b, {
619
620
  variant: "outline",
620
621
  size: "sm",
621
622
  children: /* @__PURE__ */ U(e, { id: "Change payment method" })
622
- }) }), /* @__PURE__ */ W(S, {
623
- className: ue,
624
- children: [/* @__PURE__ */ W(b, { children: [/* @__PURE__ */ U(ee, { children: /* @__PURE__ */ U(e, { id: "Change payment method" }) }), /* @__PURE__ */ U(te, { children: /* @__PURE__ */ U(e, { id: "Points future renewals of this subscription at another of the customer's stored cards (same rail), or back at their default card for its currency." }) })] }), /* @__PURE__ */ W("form", {
623
+ }) }), /* @__PURE__ */ W(re, {
624
+ className: F,
625
+ children: [/* @__PURE__ */ W(C, { children: [/* @__PURE__ */ U(ie, { children: /* @__PURE__ */ U(e, { id: "Change payment method" }) }), /* @__PURE__ */ U(w, { children: /* @__PURE__ */ U(e, { id: "Points future renewals of this subscription at another of the customer's stored cards (same rail), or back at their default card for its currency." }) })] }), /* @__PURE__ */ W("form", {
625
626
  onSubmit: (e) => {
626
627
  e.preventDefault(), e.stopPropagation(), y.handleSubmit();
627
628
  },
@@ -632,41 +633,41 @@ function ve({ subscriptionId: n, customerId: r, rail: a }) {
632
633
  children: (t) => /* @__PURE__ */ W("div", {
633
634
  className: "grid gap-1.5",
634
635
  children: [
635
- /* @__PURE__ */ U(T, {
636
- htmlFor: u("subscription-payment-method"),
636
+ /* @__PURE__ */ U(D, {
637
+ htmlFor: d("subscription-payment-method"),
637
638
  children: /* @__PURE__ */ U(e, { id: "Payment method" })
638
639
  }),
639
- /* @__PURE__ */ W(oe, {
640
+ /* @__PURE__ */ W(ce, {
640
641
  value: t.state.value,
641
642
  onValueChange: (e) => t.handleChange(e ?? ""),
642
- children: [/* @__PURE__ */ U(ie, {
643
+ children: [/* @__PURE__ */ U(O, {
643
644
  className: "w-full",
644
- id: u("subscription-payment-method"),
645
+ id: d("subscription-payment-method"),
645
646
  "aria-invalid": t.state.meta.errors.length > 0,
646
- children: /* @__PURE__ */ U(re, { placeholder: f("Pick a stored payment method") })
647
- }), /* @__PURE__ */ W(ae, { children: [/* @__PURE__ */ U(E, {
647
+ children: /* @__PURE__ */ U(oe, { placeholder: f("Pick a stored payment method") })
648
+ }), /* @__PURE__ */ W(k, { children: [/* @__PURE__ */ U(se, {
648
649
  value: $,
649
650
  children: /* @__PURE__ */ U(e, { id: "The customer's default card" })
650
- }), (v ?? []).filter((e) => e.rail === a).map((e) => /* @__PURE__ */ W(E, {
651
+ }), (v ?? []).filter((e) => e.rail === i).map((e) => /* @__PURE__ */ W(se, {
651
652
  value: e.id,
652
653
  children: [
653
- M(e.card),
654
+ u(e.card),
654
655
  " (",
655
656
  e.rail,
656
657
  ")"
657
658
  ]
658
659
  }, e.id))] })]
659
660
  }),
660
- /* @__PURE__ */ U(d, { errors: t.state.meta.errors })
661
+ /* @__PURE__ */ U(g, { errors: t.state.meta.errors })
661
662
  ]
662
663
  })
663
- }), /* @__PURE__ */ U(x, { children: /* @__PURE__ */ U(y.Subscribe, {
664
+ }), /* @__PURE__ */ U(ne, { children: /* @__PURE__ */ U(y.Subscribe, {
664
665
  selector: (e) => [
665
666
  e.values.paymentMethodId,
666
667
  e.canSubmit,
667
668
  e.isSubmitting
668
669
  ],
669
- children: ([e, t, n]) => /* @__PURE__ */ U(h, {
670
+ children: ([e, t, n]) => /* @__PURE__ */ U(b, {
670
671
  type: "submit",
671
672
  disabled: !e || !t || n,
672
673
  children: n ? "Updating…" : "Update"
@@ -677,20 +678,20 @@ function ve({ subscriptionId: n, customerId: r, rail: a }) {
677
678
  });
678
679
  }
679
680
  function ye({ change: t }) {
680
- let { adminQueries: n } = i(), { data: r } = B(n.price(t.price_id));
681
- return /* @__PURE__ */ W(m, {
681
+ let { adminQueries: n } = r(), { data: i } = B(n.price(t.price_id));
682
+ return /* @__PURE__ */ W(y, {
682
683
  className: "bg-held-surface text-held",
683
684
  children: [
684
685
  t.source === "migration" ? "migrates" : "changes",
685
686
  /* @__PURE__ */ U(e, { id: " to" }),
686
687
  " ",
687
- r ? F(r.unit_amount, r.currency) : j(t.price_id, 9),
688
+ i ? l(i.unit_amount, i.currency) : s(t.price_id, 9),
688
689
  " ",
689
690
  /* @__PURE__ */ U(e, { id: "at the first renewal from " }),
690
- N(t.effective_at)
691
+ o(t.effective_at)
691
692
  ]
692
693
  });
693
694
  }
694
695
  export { ge as SubscriptionDetailPage };
695
696
 
696
- //# sourceMappingURL=admin-detail-CQws8363.js.map
697
+ //# sourceMappingURL=admin-detail-M7YFYOGN.js.map