@openrails/billing-ui 0.268.2 → 0.269.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 (142) hide show
  1. package/dist/admin/context.d.ts +164 -62
  2. package/dist/admin/lib/api/endpoints.d.ts +3 -7
  3. package/dist/admin/lib/api/import-endpoints.d.ts +44 -0
  4. package/dist/admin/lib/api/index.d.ts +17 -7
  5. package/dist/admin/lib/api/types.d.ts +0 -29
  6. package/dist/admin/lib/import-queries.d.ts +66 -0
  7. package/dist/admin/lib/mutations.d.ts +1 -5
  8. package/dist/admin/lib/queries.d.ts +6 -20
  9. package/dist/admin/messages.d.ts +176 -6
  10. package/dist/admin/pages/catalog/index.d.ts +0 -1
  11. package/dist/admin/pages/imports/detail.d.ts +2 -0
  12. package/dist/admin/pages/imports/index.d.ts +2 -0
  13. package/dist/admin/pages/imports/mapping-csv.d.ts +10 -0
  14. package/dist/admin/pages/imports/progress.d.ts +21 -0
  15. package/dist/admin/pages/imports/records.d.ts +2 -0
  16. package/dist/admin/pages/imports/shared.d.ts +22 -0
  17. package/dist/admin/pages/parked/index.d.ts +2 -0
  18. package/dist/admin/pages/proposals/grouping.d.ts +13 -0
  19. package/dist/admin/pages/proposals/index.d.ts +2 -0
  20. package/dist/admin/pages/provider-prices/index.d.ts +2 -0
  21. package/dist/admin/pages/provider-prices/map-dialog.d.ts +11 -0
  22. package/dist/admin/routes.d.ts +1 -1
  23. package/dist/{admin-attempts-BLeeKABa.js → admin-attempts-DQTg0UzZ.js} +82 -82
  24. package/dist/{admin-attempts-BLeeKABa.js.map → admin-attempts-DQTg0UzZ.js.map} +1 -1
  25. package/dist/{admin-auth-DWVWxDup.js → admin-auth-1aZIgXiS.js} +2 -2
  26. package/dist/{admin-auth-DWVWxDup.js.map → admin-auth-1aZIgXiS.js.map} +1 -1
  27. package/dist/{admin-badge-CrEqD9Ew.js → admin-badge-pgG6D9-a.js} +2 -2
  28. package/dist/{admin-badge-CrEqD9Ew.js.map → admin-badge-pgG6D9-a.js.map} +1 -1
  29. package/dist/{admin-button-a7bDFgp0.js → admin-button-CrcYk5r0.js} +2 -2
  30. package/dist/{admin-button-a7bDFgp0.js.map → admin-button-CrcYk5r0.js.map} +1 -1
  31. package/dist/{admin-capabilities-QYUuJXvG.js → admin-capabilities-BDcZeHL_.js} +2 -2
  32. package/dist/{admin-capabilities-QYUuJXvG.js.map → admin-capabilities-BDcZeHL_.js.map} +1 -1
  33. package/dist/{admin-card-D1tz8Lbh.js → admin-card-DvTMc5Se.js} +2 -2
  34. package/dist/{admin-card-D1tz8Lbh.js.map → admin-card-DvTMc5Se.js.map} +1 -1
  35. package/dist/{admin-catalog-ggiDgWsR.js → admin-catalog-BlF5mnu4.js} +285 -382
  36. package/dist/admin-catalog-BlF5mnu4.js.map +1 -0
  37. package/dist/{admin-dom-VkcwevWr.js → admin-cursor-pager-CIb3Jw2F.js} +20 -25
  38. package/dist/admin-cursor-pager-CIb3Jw2F.js.map +1 -0
  39. package/dist/{admin-customers-BVMg-gUv.js → admin-customers-EpfoWDh-.js} +13 -13
  40. package/dist/{admin-customers-BVMg-gUv.js.map → admin-customers-EpfoWDh-.js.map} +1 -1
  41. package/dist/{admin-dashboard-Cc13i8i9.js → admin-dashboard-CJE63yz4.js} +46 -46
  42. package/dist/{admin-dashboard-Cc13i8i9.js.map → admin-dashboard-CJE63yz4.js.map} +1 -1
  43. package/dist/{admin-data-table-BL84xKKF.js → admin-data-table-hvFcJepL.js} +16 -16
  44. package/dist/{admin-data-table-BL84xKKF.js.map → admin-data-table-hvFcJepL.js.map} +1 -1
  45. package/dist/{admin-detail-CaEwBdX9.js → admin-detail-BRP6pL7t.js} +51 -51
  46. package/dist/{admin-detail-CaEwBdX9.js.map → admin-detail-BRP6pL7t.js.map} +1 -1
  47. package/dist/{admin-detail-9YAep3ts.js → admin-detail-CRzFb_pa.js} +232 -232
  48. package/dist/{admin-detail-9YAep3ts.js.map → admin-detail-CRzFb_pa.js.map} +1 -1
  49. package/dist/admin-detail-Ceod8AXy.js +299 -0
  50. package/dist/admin-detail-Ceod8AXy.js.map +1 -0
  51. package/dist/{admin-detail-C8t5jBps.js → admin-detail-QLxU8r-5.js} +62 -62
  52. package/dist/{admin-detail-C8t5jBps.js.map → admin-detail-QLxU8r-5.js.map} +1 -1
  53. package/dist/admin-detail-pPC8Q9l-.js +710 -0
  54. package/dist/{admin-detail-D2zcz_Xm.js.map → admin-detail-pPC8Q9l-.js.map} +1 -1
  55. package/dist/{admin-dialog-CiAw5vx-.js → admin-dialog-BSRf9Zre.js} +24 -24
  56. package/dist/{admin-dialog-CiAw5vx-.js.map → admin-dialog-BSRf9Zre.js.map} +1 -1
  57. package/dist/admin-dom-C7Y7A6Wa.js +8 -0
  58. package/dist/admin-dom-C7Y7A6Wa.js.map +1 -0
  59. package/dist/{admin-dropdown-menu-CYJbmqK2.js → admin-dropdown-menu-D0E5rwmn.js} +2 -2
  60. package/dist/{admin-dropdown-menu-CYJbmqK2.js.map → admin-dropdown-menu-D0E5rwmn.js.map} +1 -1
  61. package/dist/{admin-fact-card-BHTpDlaX.js → admin-fact-card-BPSVhS15.js} +2 -2
  62. package/dist/{admin-fact-card-BHTpDlaX.js.map → admin-fact-card-BPSVhS15.js.map} +1 -1
  63. package/dist/{admin-health-BUnjbvYR.js → admin-health-D0L5Kig7.js} +84 -84
  64. package/dist/{admin-health-BUnjbvYR.js.map → admin-health-D0L5Kig7.js.map} +1 -1
  65. package/dist/admin-imports-TCOljTgw.js +269 -0
  66. package/dist/admin-imports-TCOljTgw.js.map +1 -0
  67. package/dist/{admin-input-C-S_RGGo.js → admin-input-DJAK9nmk.js} +2 -2
  68. package/dist/{admin-input-C-S_RGGo.js.map → admin-input-DJAK9nmk.js.map} +1 -1
  69. package/dist/{admin-label-DPVYDdSO.js → admin-label-aviN9Gng.js} +2 -2
  70. package/dist/{admin-label-DPVYDdSO.js.map → admin-label-aviN9Gng.js.map} +1 -1
  71. package/dist/{admin-linked-table-row-D-gbTT7a.js → admin-linked-table-row-BGr7JXeM.js} +6 -6
  72. package/dist/{admin-linked-table-row-D-gbTT7a.js.map → admin-linked-table-row-BGr7JXeM.js.map} +1 -1
  73. package/dist/admin-map-dialog-DpGaIq52.js +135 -0
  74. package/dist/admin-map-dialog-DpGaIq52.js.map +1 -0
  75. package/dist/admin-mapping-csv-FtkyTBmk.js +56 -0
  76. package/dist/admin-mapping-csv-FtkyTBmk.js.map +1 -0
  77. package/dist/{admin-metering-BjbL0jjT.js → admin-metering-D-e-37Jn.js} +285 -285
  78. package/dist/{admin-metering-BjbL0jjT.js.map → admin-metering-D-e-37Jn.js.map} +1 -1
  79. package/dist/admin-ops-CQP4TzWM.js +235 -0
  80. package/dist/admin-ops-CQP4TzWM.js.map +1 -0
  81. package/dist/{admin-orders-BVW9-Fs9.js → admin-orders-BJ7W5S8P.js} +32 -32
  82. package/dist/{admin-orders-BVW9-Fs9.js.map → admin-orders-BJ7W5S8P.js.map} +1 -1
  83. package/dist/admin-parked-7HL8mOjw.js +193 -0
  84. package/dist/admin-parked-7HL8mOjw.js.map +1 -0
  85. package/dist/{admin-payments-C5MsFFmm.js → admin-payments-CzkzqYA1.js} +17 -17
  86. package/dist/{admin-payments-C5MsFFmm.js.map → admin-payments-CzkzqYA1.js.map} +1 -1
  87. package/dist/{admin-price-detail-D517JYHB.js → admin-price-detail-CSI5oKdb.js} +74 -74
  88. package/dist/{admin-price-detail-D517JYHB.js.map → admin-price-detail-CSI5oKdb.js.map} +1 -1
  89. package/dist/{admin-price-wizard-bj36o3ux.js → admin-price-wizard-CBEcNGvP.js} +38 -38
  90. package/dist/{admin-price-wizard-bj36o3ux.js.map → admin-price-wizard-CBEcNGvP.js.map} +1 -1
  91. package/dist/admin-proposals-dtgijWKz.js +375 -0
  92. package/dist/admin-proposals-dtgijWKz.js.map +1 -0
  93. package/dist/admin-provider-prices-ChuponcZ.js +246 -0
  94. package/dist/admin-provider-prices-ChuponcZ.js.map +1 -0
  95. package/dist/{admin-range-picker-D2aFF8IV.js → admin-range-picker-De36L-AP.js} +12 -12
  96. package/dist/{admin-range-picker-D2aFF8IV.js.map → admin-range-picker-De36L-AP.js.map} +1 -1
  97. package/dist/admin-records-CUHUOXAU.js +391 -0
  98. package/dist/admin-records-CUHUOXAU.js.map +1 -0
  99. package/dist/{admin-reports-D-ob04d4.js → admin-reports-BFGS_PWf.js} +45 -45
  100. package/dist/{admin-reports-D-ob04d4.js.map → admin-reports-BFGS_PWf.js.map} +1 -1
  101. package/dist/{admin-select-C8O7nx72.js → admin-select-BUcEU5Rg.js} +2 -2
  102. package/dist/{admin-select-C8O7nx72.js.map → admin-select-BUcEU5Rg.js.map} +1 -1
  103. package/dist/{admin-settings-Bs6cLcqi.js → admin-settings-DYC-c7mJ.js} +296 -296
  104. package/dist/{admin-settings-Bs6cLcqi.js.map → admin-settings-DYC-c7mJ.js.map} +1 -1
  105. package/dist/admin-shared-CzG8Pan3.js +222 -0
  106. package/dist/admin-shared-CzG8Pan3.js.map +1 -0
  107. package/dist/{admin-skeleton-wfocg2PJ.js → admin-skeleton-B0yzYY_X.js} +2 -2
  108. package/dist/{admin-skeleton-wfocg2PJ.js.map → admin-skeleton-B0yzYY_X.js.map} +1 -1
  109. package/dist/{admin-status-badge-D_gDMrht.js → admin-status-badge-0-K37EfN.js} +7 -2
  110. package/dist/admin-status-badge-0-K37EfN.js.map +1 -0
  111. package/dist/{admin-subscriptions-DYR1RGMO.js → admin-subscriptions-CvW-YFs0.js} +74 -74
  112. package/dist/{admin-subscriptions-DYR1RGMO.js.map → admin-subscriptions-CvW-YFs0.js.map} +1 -1
  113. package/dist/{admin-switch-F5D0AYjT.js → admin-switch-DDorugaw.js} +2 -2
  114. package/dist/{admin-switch-F5D0AYjT.js.map → admin-switch-DDorugaw.js.map} +1 -1
  115. package/dist/{admin-table-nUij5fLc.js → admin-table-BU6Tie69.js} +2 -2
  116. package/dist/{admin-table-nUij5fLc.js.map → admin-table-BU6Tie69.js.map} +1 -1
  117. package/dist/{admin-tabs-C3myjKdr.js → admin-tabs-D5lqdVcC.js} +2 -2
  118. package/dist/{admin-tabs-C3myjKdr.js.map → admin-tabs-D5lqdVcC.js.map} +1 -1
  119. package/dist/{admin-textarea-v-L-PXIc.js → admin-textarea-Dc6lnEub.js} +2 -2
  120. package/dist/{admin-textarea-v-L-PXIc.js.map → admin-textarea-Dc6lnEub.js.map} +1 -1
  121. package/dist/{admin-typed-confirm-dialog-BLgpuikW.js → admin-typed-confirm-dialog-Bk6XxmPb.js} +6 -6
  122. package/dist/{admin-typed-confirm-dialog-BLgpuikW.js.map → admin-typed-confirm-dialog-Bk6XxmPb.js.map} +1 -1
  123. package/dist/{admin-utils-6yE4YIVI.js → admin-utils-B9eEBNsR.js} +398 -146
  124. package/dist/admin-utils-B9eEBNsR.js.map +1 -0
  125. package/dist/{admin-widget-viz-BiEfckd4.js → admin-widget-viz-8aukE3v_.js} +34 -34
  126. package/dist/{admin-widget-viz-BiEfckd4.js.map → admin-widget-viz-8aukE3v_.js.map} +1 -1
  127. package/dist/admin.css +1 -1
  128. package/dist/admin.js +489 -264
  129. package/dist/admin.js.map +1 -1
  130. package/dist/client/generated/error-codes.d.ts +1 -1
  131. package/dist/client/generated/routes.d.ts +94 -22
  132. package/dist/client/generated/wire.d.ts +89 -14
  133. package/dist/index.js +1 -1
  134. package/dist/styles.css +1 -1
  135. package/package.json +2 -2
  136. package/dist/admin-catalog-ggiDgWsR.js.map +0 -1
  137. package/dist/admin-detail-D2zcz_Xm.js +0 -710
  138. package/dist/admin-dom-VkcwevWr.js.map +0 -1
  139. package/dist/admin-ops-DT8epiXg.js +0 -217
  140. package/dist/admin-ops-DT8epiXg.js.map +0 -1
  141. package/dist/admin-status-badge-D_gDMrht.js.map +0 -1
  142. package/dist/admin-utils-6yE4YIVI.js.map +0 -1
@@ -0,0 +1,710 @@
1
+ import { C as e, D as t, T as n, c as r, p as i, r as a, s as o } from "./admin-utils-B9eEBNsR.js";
2
+ import { t as s } from "./admin-button-CrcYk5r0.js";
3
+ import { t as c } from "./admin-input-DJAK9nmk.js";
4
+ import { a as l } from "./admin-capabilities-BDcZeHL_.js";
5
+ import { i as u, o as d, s as f, u as p } from "./admin-format-DoohJ7Fg.js";
6
+ import { t as m } from "./admin-form-field-errors-hbUMIriS.js";
7
+ import { a as h, i as g, n as _, r as v, t as y } from "./admin-select-BUcEU5Rg.js";
8
+ import { a as b, n as x, o as ee, r as S, s as C, t as w } from "./admin-table-BU6Tie69.js";
9
+ import { t as T } from "./admin-badge-pgG6D9-a.js";
10
+ import { t as E } from "./admin-status-badge-0-K37EfN.js";
11
+ import { a as te, i as ne, n as re, o as ie, r as ae, s as oe, t as se } from "./admin-dialog-BSRf9Zre.js";
12
+ import { t as D } from "./admin-label-aviN9Gng.js";
13
+ import { t as O } from "./admin-switch-DDorugaw.js";
14
+ import { n as ce, r as le } from "./admin-dialog-width-BPrgdYlj.js";
15
+ import { n as k } from "./admin-price-format-BVUpDoSC.js";
16
+ import { a as ue, o as de, r as fe, t as pe } from "./admin-card-DvTMc5Se.js";
17
+ import { t as A } from "./admin-fact-card-BPSVhS15.js";
18
+ import { t as j } from "./admin-dunning-B2zgtrOo.js";
19
+ import { t as me } from "./admin-typed-confirm-dialog-Bk6XxmPb.js";
20
+ import * as M from "react";
21
+ import { useMutation as N, useQuery as P, useQueryClient as F } from "@tanstack/react-query";
22
+ import { Fragment as he, jsx as I, jsxs as L } from "react/jsx-runtime";
23
+ import { HugeiconsIcon as R } from "@hugeicons/react";
24
+ import { ArrowLeft01Icon as z } from "@hugeicons/core-free-icons";
25
+ import { useForm as B } from "@tanstack/react-form";
26
+ //#region src/admin/pages/subscriptions/subscription-change-options.ts
27
+ function ge(e) {
28
+ let t = e.price, n = `${f(t.unit_amount, t.currency)}${t.quantity ? " per seat" : ""}`;
29
+ return [
30
+ e.product.display_name,
31
+ e.direction,
32
+ `${n} ${k(t)}`,
33
+ t.key
34
+ ].join(" · ");
35
+ }
36
+ function _e(e, t) {
37
+ let n = e.quantity;
38
+ return n ? t !== null && t >= n.min && t <= n.max ? t : n.min : null;
39
+ }
40
+ function ve({ rail: e, status: t, collectionPolicy: n, scheduledChange: r }) {
41
+ if (t !== "active" && t !== "past_due") return "Only active or past-due subscriptions can change";
42
+ if (r && n !== "engine") return "Its provider already bills a scheduled change";
43
+ if (e === "ccbill") return "CCBill changes require customer self-service";
44
+ if (e === "solana") return "Solana changes require the customer's wallet signature";
45
+ }
46
+ function ye({ currentProduct: e, currentPrice: t, currentCurrency: n, products: r, prices: i, scheduledChange: a }) {
47
+ let o = e && t && (t.quantity || a) ? [{
48
+ direction: "current",
49
+ price: t,
50
+ product: e
51
+ }] : [], s = e?.tier_group?.trim(), c = n?.trim().toLowerCase();
52
+ if (!e || !s || !c || a?.source === "migration") return o;
53
+ let l = new Map(r.filter((t) => !t.archived && t.id !== e.id && t.tier_group?.trim() === s).map((e) => [e.id, e]));
54
+ return o.concat(i.flatMap((t) => {
55
+ let n = l.get(t.product_id);
56
+ return !n || t.archived || !t.billing_interval_hours || t.currency.trim().toLowerCase() !== c ? [] : [{
57
+ direction: n.tier_rank < e.tier_rank ? "downgrade" : "upgrade",
58
+ price: t,
59
+ product: n
60
+ }];
61
+ }).sort((e, t) => e.product.tier_rank - t.product.tier_rank || e.product.display_name.localeCompare(t.product.display_name) || e.price.id.localeCompare(t.price.id)));
62
+ }
63
+ //#endregion
64
+ //#region src/admin/pages/subscriptions/change-subscription-dialog.tsx
65
+ function be(e) {
66
+ let { selectedMerchant: t } = i();
67
+ return /* @__PURE__ */ I(V, { ...e }, `${t() ?? ""}:${e.subscriptionId}`);
68
+ }
69
+ function V({ subscriptionId: r, customerId: a, productId: o, priceId: l, quantity: u, currency: p, collectionPolicy: m, scheduledChange: b, rail: x, status: ee }) {
70
+ let { toast: S, toastApiError: C, adminMutations: w, adminQueries: E } = i(), { id: O, text: ce } = t(), [k, ue] = M.useState(!1), [de, fe] = M.useState(""), [pe, A] = M.useState(""), [j, me] = M.useState(""), [he, R] = M.useState(""), z = M.useRef(/* @__PURE__ */ new Map()), B = M.useRef(0);
71
+ M.useEffect(() => () => {
72
+ B.current++;
73
+ }, []);
74
+ let be = F(), V = N(w.previewSubscriptionChange(r)), H = N(w.changeSubscription(be, r, a)), U = P({
75
+ ...E.allProducts({ errorAction: "Load subscription plans" }),
76
+ enabled: k
77
+ }), W = P({
78
+ ...E.allPrices({ errorAction: "Load subscription prices" }),
79
+ enabled: k
80
+ }), G = U.data?.data ?? [], xe = W.data?.data ?? [], Se = G.find((e) => e.id === o), Ce = xe.find((e) => e.id === l), K = ye({
81
+ currentProduct: Se,
82
+ currentPrice: Ce,
83
+ currentCurrency: p ?? Ce?.currency,
84
+ products: G,
85
+ prices: xe,
86
+ scheduledChange: b
87
+ }), q = K.find((e) => e.price.id === de), J = q?.price.quantity, Y = Number(pe), we = !J || Number.isInteger(Y) && Y >= J.min && Y <= J.max, X = q && we ? {
88
+ price_id: q.price.id,
89
+ ...J ? { quantity: Y } : {}
90
+ } : void 0, Te = q?.direction === "current" && !b && (!J || Y === u), Z = X ? JSON.stringify(X) : "", Q = Z && he === Z ? V.data : void 0, Ee = ve({
91
+ rail: x,
92
+ status: ee,
93
+ collectionPolicy: m,
94
+ scheduledChange: b
95
+ }), $ = (e) => {
96
+ B.current++, ue(e);
97
+ }, De = (e) => {
98
+ B.current++;
99
+ let t = K.find((t) => t.price.id === e)?.price;
100
+ fe(e ?? ""), A(String(t ? _e(t, u) ?? "" : "")), R(""), V.reset(), H.reset();
101
+ }, Oe = (e) => {
102
+ B.current++, A(e), R(""), V.reset(), H.reset();
103
+ }, ke = V.error instanceof Error ? V.error.message : "", Ae = H.error instanceof Error ? H.error.message : "", je = H.data?.message, Me = H.data?.next_action?.url ?? void 0;
104
+ return /* @__PURE__ */ L(se, {
105
+ open: k,
106
+ onOpenChange: $,
107
+ children: [/* @__PURE__ */ I(oe, { render: /* @__PURE__ */ I(s, {
108
+ variant: "outline",
109
+ size: "sm",
110
+ disabled: !!Ee && !H.variables,
111
+ title: Ee,
112
+ children: /* @__PURE__ */ I(n, { id: "Change subscription" })
113
+ }) }), /* @__PURE__ */ L(re, {
114
+ className: le,
115
+ children: [
116
+ /* @__PURE__ */ L(te, { children: [/* @__PURE__ */ I(ie, { children: /* @__PURE__ */ I(n, { id: "Change subscription" }) }), /* @__PURE__ */ I(ae, { children: /* @__PURE__ */ I(n, { 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." }) })] }),
117
+ /* @__PURE__ */ L("div", {
118
+ className: "grid gap-5",
119
+ children: [
120
+ /* @__PURE__ */ L("div", {
121
+ className: "grid gap-1.5",
122
+ children: [
123
+ /* @__PURE__ */ I(D, {
124
+ htmlFor: O("subscription-tier"),
125
+ children: /* @__PURE__ */ I(n, { id: "New plan" })
126
+ }),
127
+ /* @__PURE__ */ L(y, {
128
+ value: de,
129
+ onValueChange: De,
130
+ children: [/* @__PURE__ */ I(g, {
131
+ id: O("subscription-tier"),
132
+ className: "w-full",
133
+ disabled: U.isPending || W.isPending,
134
+ children: /* @__PURE__ */ I(h, { placeholder: U.isPending || W.isPending ? "Loading plans…" : "Choose a plan" })
135
+ }), /* @__PURE__ */ I(_, { children: K.map((e) => /* @__PURE__ */ I(v, {
136
+ value: e.price.id,
137
+ children: ge(e)
138
+ }, e.price.id)) })]
139
+ }),
140
+ !U.isPending && !W.isPending && !U.isError && !W.isError && K.length === 0 && /* @__PURE__ */ I("p", {
141
+ className: "text-xs text-muted-foreground",
142
+ children: /* @__PURE__ */ I(n, { id: "No eligible recurring plans share this tier group and currency." })
143
+ }),
144
+ (U.isError || W.isError) && /* @__PURE__ */ I("p", {
145
+ className: "text-xs text-destructive",
146
+ role: "alert",
147
+ children: /* @__PURE__ */ I(n, { id: "Could not load the available plans." })
148
+ })
149
+ ]
150
+ }),
151
+ J && /* @__PURE__ */ L("div", {
152
+ className: "grid gap-1.5",
153
+ children: [
154
+ /* @__PURE__ */ I(D, {
155
+ htmlFor: O("subscription-seats"),
156
+ children: /* @__PURE__ */ I(n, { id: "Seats" })
157
+ }),
158
+ /* @__PURE__ */ I(c, {
159
+ id: O("subscription-seats"),
160
+ type: "number",
161
+ inputMode: "numeric",
162
+ min: J.min,
163
+ max: J.max,
164
+ value: pe,
165
+ onChange: (e) => Oe(e.target.value)
166
+ }),
167
+ /* @__PURE__ */ L("p", {
168
+ className: "text-xs text-muted-foreground",
169
+ children: [
170
+ J.min,
171
+ /* @__PURE__ */ I(n, { id: " to " }),
172
+ J.max,
173
+ /* @__PURE__ */ I(n, { id: " seats." })
174
+ ]
175
+ })
176
+ ]
177
+ }),
178
+ /* @__PURE__ */ L("div", {
179
+ className: "grid gap-1.5",
180
+ children: [
181
+ /* @__PURE__ */ I(D, {
182
+ htmlFor: O("subscription-change-reason"),
183
+ children: /* @__PURE__ */ I(n, { id: "Reason" })
184
+ }),
185
+ /* @__PURE__ */ I(c, {
186
+ id: O("subscription-change-reason"),
187
+ value: j,
188
+ maxLength: 500,
189
+ placeholder: ce("What the customer asked for"),
190
+ onChange: (e) => me(e.target.value)
191
+ }),
192
+ /* @__PURE__ */ I("p", {
193
+ className: "text-xs text-muted-foreground",
194
+ children: /* @__PURE__ */ I(n, { id: "Kept with the scheduled change." })
195
+ })
196
+ ]
197
+ }),
198
+ Q && q && /* @__PURE__ */ L("div", {
199
+ className: "grid gap-3",
200
+ "aria-live": "polite",
201
+ children: [
202
+ /* @__PURE__ */ L("div", {
203
+ className: "flex items-center justify-between gap-4",
204
+ children: [/* @__PURE__ */ I("span", {
205
+ className: "text-sm font-medium",
206
+ children: /* @__PURE__ */ I(n, { id: "Review" })
207
+ }), /* @__PURE__ */ I(T, {
208
+ variant: "secondary",
209
+ children: Q.effective === "now" ? "Immediate" : "At renewal"
210
+ })]
211
+ }),
212
+ /* @__PURE__ */ L("dl", {
213
+ className: "grid grid-cols-2 gap-x-8 gap-y-3 border-y py-4 text-sm",
214
+ children: [
215
+ Q.quantity !== null && /* @__PURE__ */ L("div", {
216
+ className: "grid gap-1",
217
+ children: [/* @__PURE__ */ I("dt", {
218
+ className: "text-xs text-muted-foreground",
219
+ children: /* @__PURE__ */ I(n, { id: "Seats" })
220
+ }), /* @__PURE__ */ I("dd", {
221
+ className: "font-medium tabular-nums",
222
+ children: Q.quantity
223
+ })]
224
+ }),
225
+ /* @__PURE__ */ L("div", {
226
+ className: "grid gap-1",
227
+ children: [/* @__PURE__ */ I("dt", {
228
+ className: "text-xs text-muted-foreground",
229
+ children: /* @__PURE__ */ I(n, { id: "Due now" })
230
+ }), /* @__PURE__ */ I("dd", {
231
+ className: "font-medium tabular-nums",
232
+ children: f(Q.amount_due_now, Q.currency)
233
+ })]
234
+ }),
235
+ /* @__PURE__ */ L("div", {
236
+ className: "grid gap-1",
237
+ children: [/* @__PURE__ */ I("dt", {
238
+ className: "text-xs text-muted-foreground",
239
+ children: /* @__PURE__ */ I(n, { id: "Next charge" })
240
+ }), /* @__PURE__ */ I("dd", {
241
+ className: "font-medium tabular-nums",
242
+ children: f(Q.next_charge_amount, Q.currency)
243
+ })]
244
+ }),
245
+ /* @__PURE__ */ L("div", {
246
+ className: "grid gap-1",
247
+ children: [/* @__PURE__ */ I("dt", {
248
+ className: "text-xs text-muted-foreground",
249
+ children: /* @__PURE__ */ I(n, { id: "Effective" })
250
+ }), /* @__PURE__ */ I("dd", {
251
+ className: "font-medium",
252
+ children: Q.effective === "now" ? "Immediately" : d(Q.next_charge_date)
253
+ })]
254
+ }),
255
+ /* @__PURE__ */ L("div", {
256
+ className: "grid gap-1",
257
+ children: [/* @__PURE__ */ I("dt", {
258
+ className: "text-xs text-muted-foreground",
259
+ children: /* @__PURE__ */ I(n, { id: "Next billing date" })
260
+ }), /* @__PURE__ */ I("dd", {
261
+ className: "font-medium tabular-nums",
262
+ children: d(Q.next_charge_date)
263
+ })]
264
+ })
265
+ ]
266
+ }),
267
+ Q.is_estimate && /* @__PURE__ */ I("p", {
268
+ className: "text-xs text-muted-foreground",
269
+ children: /* @__PURE__ */ I(n, { id: "The payment provider calculates the final prorated amount." })
270
+ })
271
+ ]
272
+ }),
273
+ (ke || Ae) && /* @__PURE__ */ I("p", {
274
+ className: "text-sm text-destructive",
275
+ role: "alert",
276
+ children: Ae || ke
277
+ }),
278
+ H.data && H.data.status !== "succeeded" && /* @__PURE__ */ L("div", {
279
+ className: "grid gap-2 rounded-lg bg-muted px-3 py-2.5 text-sm",
280
+ "aria-live": "polite",
281
+ children: [/* @__PURE__ */ I("p", { children: je ?? "This change needs another step." }), Me && /* @__PURE__ */ I("a", {
282
+ href: Me,
283
+ target: "_blank",
284
+ rel: "noreferrer",
285
+ className: "w-fit font-medium text-primary underline underline-offset-4",
286
+ children: /* @__PURE__ */ I(n, { id: "Continue with payment provider" })
287
+ })]
288
+ })
289
+ ]
290
+ }),
291
+ /* @__PURE__ */ L(ne, { children: [/* @__PURE__ */ I(s, {
292
+ type: "button",
293
+ variant: "outline",
294
+ onClick: () => $(!1),
295
+ children: /* @__PURE__ */ I(n, { id: "Cancel" })
296
+ }), Q ? /* @__PURE__ */ I(s, {
297
+ type: "button",
298
+ disabled: H.isPending || !j.trim() || !!H.data && H.data?.status !== "processing",
299
+ onClick: async () => {
300
+ if (!X) return;
301
+ let t = B.current, n = z.current.get(Z) ?? crypto.randomUUID();
302
+ z.current.set(Z, n);
303
+ let r = () => {
304
+ z.current.get(Z) === n && z.current.delete(Z);
305
+ };
306
+ try {
307
+ let e = await H.mutateAsync({
308
+ change: {
309
+ ...X,
310
+ reason: j.trim()
311
+ },
312
+ idempotencyKey: n
313
+ });
314
+ if ((e.status === "succeeded" || e.status === "blocked") && r(), B.current !== t) return;
315
+ e.status === "succeeded" && (S.success(e.effective === "now" ? "Subscription changed" : "Change scheduled for the next renewal"), $(!1), fe(""), A(""), me(""), R(""), V.reset(), H.reset()), e.status === "processing" && S.info("The provider is still confirming this change. Check again to read the result.");
316
+ } catch (n) {
317
+ n instanceof e && (n.status === 402 || n.status === 409 && (n.code === "subscription_change_refused" || n.code === "subscription_change_idempotency_conflict")) && r(), B.current === t && C(n, "Change subscription");
318
+ }
319
+ },
320
+ children: H.isPending ? "Applying…" : H.data ? H.data.status === "processing" ? "Check result" : H.data.status === "blocked" ? "Change blocked" : "Action required" : "Confirm change"
321
+ }) : /* @__PURE__ */ I(s, {
322
+ type: "button",
323
+ disabled: !X || Te || V.isPending,
324
+ onClick: async () => {
325
+ if (!X) return;
326
+ let e = B.current;
327
+ try {
328
+ if (await V.mutateAsync(X), B.current !== e) return;
329
+ R(Z);
330
+ } catch (t) {
331
+ B.current === e && C(t, "Preview subscription change");
332
+ }
333
+ },
334
+ children: V.isPending ? "Reviewing…" : "Review change"
335
+ })] })
336
+ ]
337
+ })]
338
+ });
339
+ }
340
+ //#endregion
341
+ //#region src/admin/pages/subscriptions/detail.tsx
342
+ function H() {
343
+ let { text: e } = t(), { adminQueries: c } = i(), u = l(), { id: m = "" } = r(), h = o(), { data: g, isPending: _ } = P(c.subscription(m)), { data: v } = P(c.payments({ subscription_id: m }, 20)), y = v?.data ?? [];
344
+ if (_) return /* @__PURE__ */ I("p", {
345
+ className: "text-sm text-muted-foreground",
346
+ children: /* @__PURE__ */ I(n, { id: "Loading…" })
347
+ });
348
+ if (!g) return /* @__PURE__ */ I("p", {
349
+ className: "text-sm text-muted-foreground",
350
+ children: /* @__PURE__ */ I(n, { id: "Subscription not found." })
351
+ });
352
+ let te = g.status === "active" || g.status === "past_due" || g.status === "awaiting_method" || g.status === "unverified", ne = g.status === "canceled" || g.status === "past_due";
353
+ return /* @__PURE__ */ L("div", {
354
+ className: "flex flex-col gap-4",
355
+ children: [
356
+ /* @__PURE__ */ L("div", {
357
+ className: "flex items-center gap-3",
358
+ children: [
359
+ /* @__PURE__ */ I(s, {
360
+ variant: "ghost",
361
+ size: "icon",
362
+ onClick: () => h(-1),
363
+ "aria-label": e("Back"),
364
+ children: /* @__PURE__ */ I(R, {
365
+ icon: z,
366
+ className: "size-4"
367
+ })
368
+ }),
369
+ /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ L("h2", {
370
+ className: "flex items-center gap-2 text-sm",
371
+ children: [
372
+ g.id,
373
+ " ",
374
+ /* @__PURE__ */ I(E, { status: g.status })
375
+ ]
376
+ }), /* @__PURE__ */ L("p", {
377
+ className: "text-xs text-muted-foreground",
378
+ children: [
379
+ g.rail,
380
+ " · ",
381
+ g.rail_subscription_id || "no rail id"
382
+ ]
383
+ })] }),
384
+ /* @__PURE__ */ L("div", {
385
+ className: "ml-auto flex gap-2",
386
+ children: [
387
+ u && ne && /* @__PURE__ */ I(W, {
388
+ id: g.id,
389
+ customerId: g.customer_id
390
+ }),
391
+ u && /* @__PURE__ */ I(be, {
392
+ subscriptionId: g.id,
393
+ customerId: g.customer_id,
394
+ productId: g.product_id,
395
+ priceId: g.price_id,
396
+ quantity: g.quantity,
397
+ currency: g.price?.currency,
398
+ collectionPolicy: g.collection_policy,
399
+ scheduledChange: g.scheduled_change,
400
+ rail: g.rail,
401
+ status: g.status
402
+ }),
403
+ u && /* @__PURE__ */ I(xe, {
404
+ subscriptionId: g.id,
405
+ customerId: g.customer_id,
406
+ rail: g.rail,
407
+ collectionPolicy: g.collection_policy
408
+ }),
409
+ u && te && /* @__PURE__ */ I(U, {
410
+ id: g.id,
411
+ customerId: g.customer_id
412
+ })
413
+ ]
414
+ })
415
+ ]
416
+ }),
417
+ /* @__PURE__ */ L("div", {
418
+ className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-4",
419
+ children: [
420
+ /* @__PURE__ */ I(A, {
421
+ label: e("Customer"),
422
+ children: g.customer_id ? /* @__PURE__ */ I(a, {
423
+ className: "text-xs underline-offset-2 hover:underline",
424
+ to: `/customers/${g.customer_id}`,
425
+ children: p(g.customer_id, 13)
426
+ }) : "—"
427
+ }),
428
+ /* @__PURE__ */ I(A, {
429
+ label: e("Started"),
430
+ children: d(g.started_at)
431
+ }),
432
+ /* @__PURE__ */ L(A, {
433
+ label: e("Current period"),
434
+ children: [
435
+ d(g.current_period_starts_at),
436
+ " →",
437
+ " ",
438
+ d(g.current_period_ends_at)
439
+ ]
440
+ }),
441
+ /* @__PURE__ */ I(A, {
442
+ label: e("Price"),
443
+ children: /* @__PURE__ */ L("div", {
444
+ className: "flex flex-col gap-1",
445
+ children: [
446
+ /* @__PURE__ */ L("span", {
447
+ className: "flex items-center gap-2",
448
+ children: [g.price?.unit_amount !== void 0 && g.price?.currency ? /* @__PURE__ */ I(a, {
449
+ className: "underline-offset-2 hover:underline",
450
+ to: `/catalog/prices/${encodeURIComponent(g.price_id)}`,
451
+ children: f(g.price.unit_amount, g.price.currency)
452
+ }) : /* @__PURE__ */ I(a, {
453
+ className: "text-xs underline-offset-2 hover:underline",
454
+ to: `/catalog/prices/${encodeURIComponent(g.price_id)}`,
455
+ children: p(g.price_id ?? "—", 13)
456
+ }), g.price?.archived && /* @__PURE__ */ I(T, {
457
+ variant: "secondary",
458
+ title: e("Pinned to an archived (prior) version"),
459
+ children: /* @__PURE__ */ I(n, { id: "prior version" })
460
+ })]
461
+ }),
462
+ g.price?.key && /* @__PURE__ */ I("span", {
463
+ className: "text-xs text-muted-foreground",
464
+ children: g.price.key
465
+ }),
466
+ g.scheduled_change && /* @__PURE__ */ I(Se, { change: g.scheduled_change })
467
+ ]
468
+ })
469
+ }),
470
+ g.quantity !== null && /* @__PURE__ */ L(A, {
471
+ label: e("Seats"),
472
+ children: [g.quantity, g.scheduled_change?.quantity != null && ` → ${g.scheduled_change.quantity} at renewal`]
473
+ }),
474
+ /* @__PURE__ */ I(A, {
475
+ label: e("Dunning"),
476
+ children: g.dunning ? j(g.dunning) : "—"
477
+ }),
478
+ /* @__PURE__ */ I(A, {
479
+ label: g.dunning?.waiting_for_new_card ? "Card deadline" : "Final retry",
480
+ children: d(g.dunning?.final_retry_at)
481
+ }),
482
+ /* @__PURE__ */ I(A, {
483
+ label: e("Last decline"),
484
+ children: g.dunning?.last_failure_reason ?? "—"
485
+ }),
486
+ /* @__PURE__ */ I(A, {
487
+ label: e("Canceled"),
488
+ children: g.canceled_at ? `${d(g.canceled_at)} (${g.cancel_type ?? "?"})` : "—"
489
+ })
490
+ ]
491
+ }),
492
+ /* @__PURE__ */ L(pe, { children: [/* @__PURE__ */ I(ue, { children: /* @__PURE__ */ I(de, {
493
+ className: "text-sm",
494
+ children: /* @__PURE__ */ I(n, { id: "Payments" })
495
+ }) }), /* @__PURE__ */ I(fe, { children: y.length ? /* @__PURE__ */ L(w, { children: [/* @__PURE__ */ I(ee, { children: /* @__PURE__ */ L(C, {
496
+ className: "hover:bg-transparent",
497
+ children: [
498
+ /* @__PURE__ */ I(b, {
499
+ className: "text-muted-foreground",
500
+ children: /* @__PURE__ */ I(n, { id: "Payment" })
501
+ }),
502
+ /* @__PURE__ */ I(b, {
503
+ className: "text-muted-foreground",
504
+ children: /* @__PURE__ */ I(n, { id: "Status" })
505
+ }),
506
+ /* @__PURE__ */ I(b, {
507
+ className: "text-muted-foreground",
508
+ children: /* @__PURE__ */ I(n, { id: "Kind" })
509
+ }),
510
+ /* @__PURE__ */ I(b, {
511
+ className: "text-muted-foreground",
512
+ children: /* @__PURE__ */ I(n, { id: "Amount" })
513
+ }),
514
+ /* @__PURE__ */ I(b, {
515
+ className: "text-muted-foreground",
516
+ children: /* @__PURE__ */ I(n, { id: "Created" })
517
+ })
518
+ ]
519
+ }) }), /* @__PURE__ */ I(x, { children: y.map((e) => /* @__PURE__ */ L(C, { children: [
520
+ /* @__PURE__ */ I(S, { children: /* @__PURE__ */ I(a, {
521
+ className: "text-xs underline-offset-2 hover:underline",
522
+ to: `/payments/${e.id}`,
523
+ children: p(e.id, 13)
524
+ }) }),
525
+ /* @__PURE__ */ I(S, { children: /* @__PURE__ */ I(E, { status: e.status }) }),
526
+ /* @__PURE__ */ I(S, { children: e.kind }),
527
+ /* @__PURE__ */ I(S, { children: f(e.amount, e.currency) }),
528
+ /* @__PURE__ */ I(S, { children: d(e.created_at) })
529
+ ] }, e.id)) })] }) : /* @__PURE__ */ I("p", {
530
+ className: "text-sm text-muted-foreground",
531
+ children: /* @__PURE__ */ I(n, { id: "No payments recorded." })
532
+ }) })] })
533
+ ]
534
+ });
535
+ }
536
+ function U({ id: e, customerId: r }) {
537
+ let { toast: a, toastApiError: o, adminMutations: l } = i(), { text: u, id: d } = t(), [f, p] = M.useState(!1), m = F(), h = N(l.cancelSubscription(m, e, r)), g = B({ defaultValues: {
538
+ reason: "",
539
+ revokeAccess: !1
540
+ } });
541
+ return /* @__PURE__ */ L(he, { children: [/* @__PURE__ */ I(s, {
542
+ variant: "destructive",
543
+ size: "sm",
544
+ onClick: () => p(!0),
545
+ children: /* @__PURE__ */ I(n, { id: "Cancel subscription" })
546
+ }), /* @__PURE__ */ I(me, {
547
+ open: f,
548
+ onOpenChange: (e) => {
549
+ p(e), e || (g.reset(), h.reset());
550
+ },
551
+ title: u("Cancel subscription"),
552
+ description: u("Terminal cancellation at the payment rail. This is a last resort. Dunning parks subscriptions as past_due without losing entitlements."),
553
+ confirmationWord: "CANCEL",
554
+ actionLabel: "Cancel subscription",
555
+ onConfirm: async () => {
556
+ try {
557
+ await h.mutateAsync(g.state.values), a.success("Subscription canceled");
558
+ } catch (e) {
559
+ throw o(e, "Cancel subscription"), e;
560
+ }
561
+ },
562
+ children: /* @__PURE__ */ L("div", {
563
+ className: "grid gap-3",
564
+ children: [/* @__PURE__ */ I(g.Field, {
565
+ name: "reason",
566
+ children: (e) => /* @__PURE__ */ L("div", {
567
+ className: "grid gap-1.5",
568
+ children: [/* @__PURE__ */ I(D, {
569
+ htmlFor: d("cancel-reason"),
570
+ children: /* @__PURE__ */ I(n, { id: "Reason" })
571
+ }), /* @__PURE__ */ I(c, {
572
+ id: d("cancel-reason"),
573
+ value: e.state.value,
574
+ onBlur: e.handleBlur,
575
+ onChange: (t) => e.handleChange(t.target.value),
576
+ placeholder: u("why is this being canceled?")
577
+ })]
578
+ })
579
+ }), /* @__PURE__ */ I(g.Field, {
580
+ name: "revokeAccess",
581
+ children: (e) => /* @__PURE__ */ L("div", {
582
+ className: "flex items-center gap-2",
583
+ children: [/* @__PURE__ */ I(O, {
584
+ id: d("cancel-revoke"),
585
+ checked: e.state.value,
586
+ onCheckedChange: e.handleChange
587
+ }), /* @__PURE__ */ I(D, {
588
+ htmlFor: d("cancel-revoke"),
589
+ children: /* @__PURE__ */ I(n, { id: "Also revoke access immediately" })
590
+ })]
591
+ })
592
+ })]
593
+ })
594
+ })] });
595
+ }
596
+ function W({ id: e, customerId: t }) {
597
+ let { toast: n, toastApiError: r, adminMutations: a } = i(), o = F(), c = N(a.resumeSubscription(o, e, t));
598
+ return /* @__PURE__ */ I(s, {
599
+ variant: "outline",
600
+ size: "sm",
601
+ disabled: c.isPending,
602
+ onClick: async () => {
603
+ try {
604
+ await c.mutateAsync(), n.success("Resume queued");
605
+ } catch (e) {
606
+ r(e, "Resume subscription");
607
+ }
608
+ },
609
+ children: c.isPending ? "Queuing…" : "Resume"
610
+ });
611
+ }
612
+ var G = "default";
613
+ function xe({ subscriptionId: e, customerId: r, rail: a, collectionPolicy: o }) {
614
+ let { toast: c, toastApiError: l, adminMutations: d, adminQueries: f } = i(), { id: p, text: b } = t(), [x, ee] = M.useState(!1), S = F(), C = N(d.changeSubscriptionPaymentMethod(S, e, r)), { data: w } = P(f.customerPaymentMethods(x ? r : void 0)), T = B({
615
+ defaultValues: { paymentMethodId: "" },
616
+ onSubmit: async ({ value: e }) => {
617
+ try {
618
+ await C.mutateAsync(e.paymentMethodId === G ? null : e.paymentMethodId), c.success("Payment method updated"), E(!1);
619
+ } catch (e) {
620
+ l(e, "Change payment method");
621
+ }
622
+ }
623
+ }), E = (e) => {
624
+ ee(e), e || (T.reset(), C.reset());
625
+ }, O = a !== "solana" && (o === "engine" || o === "nmi_schedule");
626
+ return /* @__PURE__ */ L(se, {
627
+ open: x,
628
+ onOpenChange: E,
629
+ children: [/* @__PURE__ */ I(oe, { render: /* @__PURE__ */ I(s, {
630
+ variant: "outline",
631
+ size: "sm",
632
+ disabled: !O,
633
+ title: O ? void 0 : `Payment-method change is not supported on ${a}`,
634
+ children: /* @__PURE__ */ I(n, { id: "Change payment method" })
635
+ }) }), /* @__PURE__ */ L(re, {
636
+ className: ce,
637
+ children: [/* @__PURE__ */ L(te, { children: [/* @__PURE__ */ I(ie, { children: /* @__PURE__ */ I(n, { id: "Change payment method" }) }), /* @__PURE__ */ I(ae, { children: /* @__PURE__ */ I(n, { id: "Points future renewals of this subscription at another of the customer&apos;s stored cards (same rail), or back at their default card for its currency." }) })] }), /* @__PURE__ */ L("form", {
638
+ onSubmit: (e) => {
639
+ e.preventDefault(), e.stopPropagation(), T.handleSubmit();
640
+ },
641
+ className: "grid gap-4",
642
+ children: [/* @__PURE__ */ I(T.Field, {
643
+ name: "paymentMethodId",
644
+ validators: { onChange: ({ value: e }) => e ? void 0 : "Pick a stored payment method" },
645
+ children: (e) => /* @__PURE__ */ L("div", {
646
+ className: "grid gap-1.5",
647
+ children: [
648
+ /* @__PURE__ */ I(D, {
649
+ htmlFor: p("subscription-payment-method"),
650
+ children: /* @__PURE__ */ I(n, { id: "Payment method" })
651
+ }),
652
+ /* @__PURE__ */ L(y, {
653
+ value: e.state.value,
654
+ onValueChange: (t) => e.handleChange(t ?? ""),
655
+ children: [/* @__PURE__ */ I(g, {
656
+ className: "w-full",
657
+ id: p("subscription-payment-method"),
658
+ "aria-invalid": e.state.meta.errors.length > 0,
659
+ children: /* @__PURE__ */ I(h, { placeholder: b("Pick a stored payment method") })
660
+ }), /* @__PURE__ */ L(_, { children: [/* @__PURE__ */ I(v, {
661
+ value: G,
662
+ children: /* @__PURE__ */ I(n, { id: "The customer&apos;s default card" })
663
+ }), (w ?? []).filter((e) => e.rail === a).map((e) => /* @__PURE__ */ L(v, {
664
+ value: e.id,
665
+ children: [
666
+ u(e.card),
667
+ " (",
668
+ e.rail,
669
+ ")"
670
+ ]
671
+ }, e.id))] })]
672
+ }),
673
+ /* @__PURE__ */ I(m, { errors: e.state.meta.errors })
674
+ ]
675
+ })
676
+ }), /* @__PURE__ */ I(ne, { children: /* @__PURE__ */ I(T.Subscribe, {
677
+ selector: (e) => [
678
+ e.values.paymentMethodId,
679
+ e.canSubmit,
680
+ e.isSubmitting
681
+ ],
682
+ children: ([e, t, n]) => /* @__PURE__ */ I(s, {
683
+ type: "submit",
684
+ disabled: !e || !t || n,
685
+ children: n ? "Updating…" : "Update"
686
+ })
687
+ }) })]
688
+ })]
689
+ })]
690
+ });
691
+ }
692
+ function Se({ change: e }) {
693
+ let { adminQueries: t } = i(), { data: r } = P(t.price(e.price_id));
694
+ return /* @__PURE__ */ L(T, {
695
+ className: "bg-held-surface text-held",
696
+ children: [
697
+ e.source === "migration" ? "migrates" : "changes",
698
+ /* @__PURE__ */ I(n, { id: " to" }),
699
+ " ",
700
+ r ? f(r.unit_amount, r.currency) : p(e.price_id, 9),
701
+ " ",
702
+ /* @__PURE__ */ I(n, { id: "at the first renewal from " }),
703
+ d(e.effective_at)
704
+ ]
705
+ });
706
+ }
707
+ //#endregion
708
+ export { H as SubscriptionDetailPage };
709
+
710
+ //# sourceMappingURL=admin-detail-pPC8Q9l-.js.map