@openrails/billing-ui 0.273.0 → 0.274.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.
- package/dist/admin/components/customer-search.d.ts +5 -0
- package/dist/admin/components/missing-record.d.ts +6 -0
- package/dist/admin/components/status-badge.d.ts +1 -0
- package/dist/admin/context.d.ts +20 -2
- package/dist/admin/lib/api/endpoints.d.ts +3 -1
- package/dist/admin/lib/api/index.d.ts +2 -0
- package/dist/admin/lib/api/types.d.ts +2 -0
- package/dist/admin/lib/capabilities.d.ts +4 -0
- package/dist/admin/lib/dialog-width.d.ts +4 -3
- package/dist/admin/lib/error-text.d.ts +4 -0
- package/dist/admin/lib/mutations.d.ts +6 -1
- package/dist/admin/lib/queries.d.ts +3 -0
- package/dist/admin/lib/tile-grids.d.ts +6 -0
- package/dist/admin/messages.d.ts +89 -0
- package/dist/admin/pages/payments/index.d.ts +1 -2
- package/dist/admin/pages/subscriptions/index.d.ts +1 -2
- package/dist/{admin-attempts-DyDDt-qw.js → admin-attempts-Dzipkstg.js} +145 -144
- package/dist/admin-attempts-Dzipkstg.js.map +1 -0
- package/dist/{admin-auth-1aZIgXiS.js → admin-auth-BCl_Tv3t.js} +2 -2
- package/dist/{admin-auth-1aZIgXiS.js.map → admin-auth-BCl_Tv3t.js.map} +1 -1
- package/dist/{admin-badge-pgG6D9-a.js → admin-badge-kmYQM9Ge.js} +2 -2
- package/dist/{admin-badge-pgG6D9-a.js.map → admin-badge-kmYQM9Ge.js.map} +1 -1
- package/dist/{admin-button-CrcYk5r0.js → admin-button-Cq9ZfX4R.js} +2 -2
- package/dist/{admin-button-CrcYk5r0.js.map → admin-button-Cq9ZfX4R.js.map} +1 -1
- package/dist/{admin-capabilities-BDcZeHL_.js → admin-capabilities-k5fQZhN9.js} +35 -14
- package/dist/admin-capabilities-k5fQZhN9.js.map +1 -0
- package/dist/{admin-card-DvTMc5Se.js → admin-card-C8k67jJv.js} +2 -2
- package/dist/{admin-card-DvTMc5Se.js.map → admin-card-C8k67jJv.js.map} +1 -1
- package/dist/{admin-catalog-BlF5mnu4.js → admin-catalog-CON-GwKL.js} +286 -286
- package/dist/{admin-catalog-BlF5mnu4.js.map → admin-catalog-CON-GwKL.js.map} +1 -1
- package/dist/{admin-cursor-pager-CIb3Jw2F.js → admin-cursor-pager-DqFruoNu.js} +6 -6
- package/dist/{admin-cursor-pager-CIb3Jw2F.js.map → admin-cursor-pager-DqFruoNu.js.map} +1 -1
- package/dist/admin-customer-search-CJHB80rg.js +117 -0
- package/dist/admin-customer-search-CJHB80rg.js.map +1 -0
- package/dist/{admin-customers-EpfoWDh-.js → admin-customers-CWWOrcVR.js} +18 -17
- package/dist/{admin-customers-EpfoWDh-.js.map → admin-customers-CWWOrcVR.js.map} +1 -1
- package/dist/admin-dashboard-BiShWFk2.js +456 -0
- package/dist/admin-dashboard-BiShWFk2.js.map +1 -0
- package/dist/admin-data-table-CdsjYJh5.js +107 -0
- package/dist/admin-data-table-CdsjYJh5.js.map +1 -0
- package/dist/admin-detail-BWSC1aCH.js +338 -0
- package/dist/admin-detail-BWSC1aCH.js.map +1 -0
- package/dist/admin-detail-CKRtK43V.js +728 -0
- package/dist/admin-detail-CKRtK43V.js.map +1 -0
- package/dist/admin-detail-CMmhZQ2A.js +346 -0
- package/dist/admin-detail-CMmhZQ2A.js.map +1 -0
- package/dist/admin-detail-CiONe1Pt.js +1357 -0
- package/dist/admin-detail-CiONe1Pt.js.map +1 -0
- package/dist/{admin-detail-3wFIDPNB.js → admin-detail-Cyuf_i9U.js} +62 -62
- package/dist/{admin-detail-3wFIDPNB.js.map → admin-detail-Cyuf_i9U.js.map} +1 -1
- package/dist/{admin-dialog-BSRf9Zre.js → admin-dialog-Ch7rTOCr.js} +3 -3
- package/dist/{admin-dialog-BSRf9Zre.js.map → admin-dialog-Ch7rTOCr.js.map} +1 -1
- package/dist/admin-dialog-width-CC7QHT1p.js +6 -0
- package/dist/admin-dialog-width-CC7QHT1p.js.map +1 -0
- package/dist/{admin-dropdown-menu-D0E5rwmn.js → admin-dropdown-menu-Bah3f8AZ.js} +2 -2
- package/dist/{admin-dropdown-menu-D0E5rwmn.js.map → admin-dropdown-menu-Bah3f8AZ.js.map} +1 -1
- package/dist/{admin-fact-card-BPSVhS15.js → admin-fact-card-Bt__Cd_U.js} +2 -2
- package/dist/{admin-fact-card-BPSVhS15.js.map → admin-fact-card-Bt__Cd_U.js.map} +1 -1
- package/dist/{admin-health-D0L5Kig7.js → admin-health-pzTO6_0v.js} +249 -248
- package/dist/admin-health-pzTO6_0v.js.map +1 -0
- package/dist/{admin-imports-CgZB5JAV.js → admin-imports-tT5et8-V.js} +62 -62
- package/dist/{admin-imports-CgZB5JAV.js.map → admin-imports-tT5et8-V.js.map} +1 -1
- package/dist/{admin-input-DJAK9nmk.js → admin-input-DvRZy_2a.js} +2 -2
- package/dist/{admin-input-DJAK9nmk.js.map → admin-input-DvRZy_2a.js.map} +1 -1
- package/dist/{admin-label-aviN9Gng.js → admin-label-QZtWJGH-.js} +2 -2
- package/dist/{admin-label-aviN9Gng.js.map → admin-label-QZtWJGH-.js.map} +1 -1
- package/dist/{admin-linked-table-row-BGr7JXeM.js → admin-linked-table-row-6jkCKwMn.js} +4 -4
- package/dist/{admin-linked-table-row-BGr7JXeM.js.map → admin-linked-table-row-6jkCKwMn.js.map} +1 -1
- package/dist/{admin-map-dialog-DS2Wz6G3.js → admin-map-dialog-BV54mvMQ.js} +22 -22
- package/dist/{admin-map-dialog-DS2Wz6G3.js.map → admin-map-dialog-BV54mvMQ.js.map} +1 -1
- package/dist/{admin-metering-D-e-37Jn.js → admin-metering-Bv5EcX6M.js} +306 -306
- package/dist/{admin-metering-D-e-37Jn.js.map → admin-metering-Bv5EcX6M.js.map} +1 -1
- package/dist/admin-missing-record-BXqGFDt3.js +42 -0
- package/dist/admin-missing-record-BXqGFDt3.js.map +1 -0
- package/dist/admin-ops-h3RjpcNu.js +356 -0
- package/dist/admin-ops-h3RjpcNu.js.map +1 -0
- package/dist/admin-orders-DYxPiuTl.js +192 -0
- package/dist/admin-orders-DYxPiuTl.js.map +1 -0
- package/dist/{admin-parked-B8xHkV2e.js → admin-parked-ClKA60d5.js} +51 -51
- package/dist/{admin-parked-B8xHkV2e.js.map → admin-parked-ClKA60d5.js.map} +1 -1
- package/dist/admin-payments-BlIuy3wL.js +220 -0
- package/dist/admin-payments-BlIuy3wL.js.map +1 -0
- package/dist/{admin-price-detail-CSI5oKdb.js → admin-price-detail-BjWYU5A-.js} +98 -98
- package/dist/{admin-price-detail-CSI5oKdb.js.map → admin-price-detail-BjWYU5A-.js.map} +1 -1
- package/dist/{admin-price-wizard-CBEcNGvP.js → admin-price-wizard-CTbkbmYc.js} +61 -61
- package/dist/{admin-price-wizard-CBEcNGvP.js.map → admin-price-wizard-CTbkbmYc.js.map} +1 -1
- package/dist/{admin-proposals-Cuj7tvaM.js → admin-proposals-Ci9Q8j7Y.js} +64 -64
- package/dist/{admin-proposals-Cuj7tvaM.js.map → admin-proposals-Ci9Q8j7Y.js.map} +1 -1
- package/dist/{admin-provider-prices-B6vwnVPi.js → admin-provider-prices-B6Ayq-eN.js} +66 -66
- package/dist/{admin-provider-prices-B6vwnVPi.js.map → admin-provider-prices-B6Ayq-eN.js.map} +1 -1
- package/dist/{admin-range-picker-De36L-AP.js → admin-range-picker-nfflPp21.js} +9 -9
- package/dist/{admin-range-picker-De36L-AP.js.map → admin-range-picker-nfflPp21.js.map} +1 -1
- package/dist/{admin-records-H0MlhEVY.js → admin-records-CrTCorWH.js} +43 -43
- package/dist/{admin-records-H0MlhEVY.js.map → admin-records-CrTCorWH.js.map} +1 -1
- package/dist/{admin-reports-BFGS_PWf.js → admin-reports-BO6wrvtw.js} +50 -50
- package/dist/{admin-reports-BFGS_PWf.js.map → admin-reports-BO6wrvtw.js.map} +1 -1
- package/dist/{admin-select-BUcEU5Rg.js → admin-select-DvfJ80Rg.js} +2 -2
- package/dist/{admin-select-BUcEU5Rg.js.map → admin-select-DvfJ80Rg.js.map} +1 -1
- package/dist/{admin-settings-DYC-c7mJ.js → admin-settings-BOoTzhyf.js} +332 -332
- package/dist/admin-settings-BOoTzhyf.js.map +1 -0
- package/dist/{admin-shared-lfIUEbPY.js → admin-shared-BbGT_qTo.js} +21 -21
- package/dist/{admin-shared-lfIUEbPY.js.map → admin-shared-BbGT_qTo.js.map} +1 -1
- package/dist/{admin-skeleton-B0yzYY_X.js → admin-skeleton-B2a4ScVE.js} +2 -2
- package/dist/{admin-skeleton-B0yzYY_X.js.map → admin-skeleton-B2a4ScVE.js.map} +1 -1
- package/dist/admin-status-badge-Bp6cssXY.js +51 -0
- package/dist/admin-status-badge-Bp6cssXY.js.map +1 -0
- package/dist/admin-subscriptions-D9JmoicC.js +275 -0
- package/dist/admin-subscriptions-D9JmoicC.js.map +1 -0
- package/dist/{admin-switch-DDorugaw.js → admin-switch-DBBxJRZP.js} +2 -2
- package/dist/{admin-switch-DDorugaw.js.map → admin-switch-DBBxJRZP.js.map} +1 -1
- package/dist/{admin-table-BU6Tie69.js → admin-table-CPDoVfK4.js} +2 -2
- package/dist/{admin-table-BU6Tie69.js.map → admin-table-CPDoVfK4.js.map} +1 -1
- package/dist/{admin-tabs-D5lqdVcC.js → admin-tabs-DDUv3kiu.js} +2 -2
- package/dist/{admin-tabs-D5lqdVcC.js.map → admin-tabs-DDUv3kiu.js.map} +1 -1
- package/dist/{admin-textarea-Dc6lnEub.js → admin-textarea-d3fu_waS.js} +2 -2
- package/dist/{admin-textarea-Dc6lnEub.js.map → admin-textarea-d3fu_waS.js.map} +1 -1
- package/dist/admin-tile-grids-CzGpidd9.js +6 -0
- package/dist/admin-tile-grids-CzGpidd9.js.map +1 -0
- package/dist/{admin-typed-confirm-dialog-Bk6XxmPb.js → admin-typed-confirm-dialog-BVklYjFo.js} +11 -11
- package/dist/{admin-typed-confirm-dialog-Bk6XxmPb.js.map → admin-typed-confirm-dialog-BVklYjFo.js.map} +1 -1
- package/dist/{admin-utils-B9eEBNsR.js → admin-utils-DTT53IpS.js} +266 -223
- package/dist/admin-utils-DTT53IpS.js.map +1 -0
- package/dist/{admin-widget-viz-8aukE3v_.js → admin-widget-viz-Exsqz3Dw.js} +165 -128
- package/dist/admin-widget-viz-Exsqz3Dw.js.map +1 -0
- package/dist/admin.css +1 -1
- package/dist/admin.js +531 -405
- package/dist/admin.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/admin-attempts-DyDDt-qw.js.map +0 -1
- package/dist/admin-capabilities-BDcZeHL_.js.map +0 -1
- package/dist/admin-dashboard-CJE63yz4.js +0 -420
- package/dist/admin-dashboard-CJE63yz4.js.map +0 -1
- package/dist/admin-data-table-hvFcJepL.js +0 -96
- package/dist/admin-data-table-hvFcJepL.js.map +0 -1
- package/dist/admin-detail-BRP6pL7t.js +0 -328
- package/dist/admin-detail-BRP6pL7t.js.map +0 -1
- package/dist/admin-detail-CRzFb_pa.js +0 -1331
- package/dist/admin-detail-CRzFb_pa.js.map +0 -1
- package/dist/admin-detail-QLxU8r-5.js +0 -344
- package/dist/admin-detail-QLxU8r-5.js.map +0 -1
- package/dist/admin-detail-pPC8Q9l-.js +0 -710
- package/dist/admin-detail-pPC8Q9l-.js.map +0 -1
- package/dist/admin-dialog-width-BPrgdYlj.js +0 -6
- package/dist/admin-dialog-width-BPrgdYlj.js.map +0 -1
- package/dist/admin-health-D0L5Kig7.js.map +0 -1
- package/dist/admin-ops-CQP4TzWM.js +0 -235
- package/dist/admin-ops-CQP4TzWM.js.map +0 -1
- package/dist/admin-orders-BJ7W5S8P.js +0 -192
- package/dist/admin-orders-BJ7W5S8P.js.map +0 -1
- package/dist/admin-payments-CzkzqYA1.js +0 -246
- package/dist/admin-payments-CzkzqYA1.js.map +0 -1
- package/dist/admin-settings-DYC-c7mJ.js.map +0 -1
- package/dist/admin-status-badge-0-K37EfN.js +0 -43
- package/dist/admin-status-badge-0-K37EfN.js.map +0 -1
- package/dist/admin-subscriptions-CvW-YFs0.js +0 -301
- package/dist/admin-subscriptions-CvW-YFs0.js.map +0 -1
- package/dist/admin-utils-B9eEBNsR.js.map +0 -1
- package/dist/admin-widget-viz-8aukE3v_.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as r } from "./admin-button-
|
|
3
|
-
import { t as i } from "./admin-input-
|
|
1
|
+
import { E as e, O as t, p as n } from "./admin-utils-DTT53IpS.js";
|
|
2
|
+
import { t as r } from "./admin-button-Cq9ZfX4R.js";
|
|
3
|
+
import { t as i } from "./admin-input-DvRZy_2a.js";
|
|
4
4
|
import { c as a, l as o, s } from "./admin-format-DoohJ7Fg.js";
|
|
5
|
-
import { t as c } from "./admin-
|
|
6
|
-
import { t as l } from "./admin-
|
|
7
|
-
import { a as u, i as d, n as f, o as ee, r as p, s as m, t as h } from "./admin-dialog-
|
|
8
|
-
import { t as g } from "./admin-label-
|
|
9
|
-
import {
|
|
5
|
+
import { t as c } from "./admin-badge-kmYQM9Ge.js";
|
|
6
|
+
import { t as l } from "./admin-form-field-errors-hbUMIriS.js";
|
|
7
|
+
import { a as u, i as d, n as f, o as ee, r as p, s as m, t as h } from "./admin-dialog-Ch7rTOCr.js";
|
|
8
|
+
import { t as g } from "./admin-label-QZtWJGH-.js";
|
|
9
|
+
import { r as _ } from "./admin-dialog-width-CC7QHT1p.js";
|
|
10
10
|
import { n as v } from "./admin-price-format-BVUpDoSC.js";
|
|
11
11
|
import * as y from "react";
|
|
12
12
|
import { useMutation as b, useQuery as te, useQueryClient as x } from "@tanstack/react-query";
|
|
@@ -51,7 +51,7 @@ var N = (e) => e.toISOString().slice(0, 10), P = (e, t) => ({
|
|
|
51
51
|
effectiveAt: t?.migration?.effective_at ? N(new Date(t.migration.effective_at)) : ""
|
|
52
52
|
});
|
|
53
53
|
function F({ price: o, productName: j, productKey: F, draft: I, onDone: ne }) {
|
|
54
|
-
let { toast: re, toastApiError: L, adminMutations: R, adminQueries: z } = n(), { id: B } =
|
|
54
|
+
let { toast: re, toastApiError: L, adminMutations: R, adminQueries: z } = n(), { id: B } = t(), V = x(), [H, U] = y.useState(() => !!I), [W, G] = y.useState(() => I ? 3 : 1), K = b(R.previewPriceChange()), q = b(R.changePrice(V)), J = K.data?.matched ?? I?.affected_count ?? null, { data: Y } = te({
|
|
55
55
|
...z.merchantConfiguration(),
|
|
56
56
|
enabled: H
|
|
57
57
|
}), X = Y?.reprice_notice_window_days ?? 30, [Z] = y.useState(() => /* @__PURE__ */ new Date()), Q = T({
|
|
@@ -100,14 +100,14 @@ function F({ price: o, productName: j, productKey: F, draft: I, onDone: ne }) {
|
|
|
100
100
|
size: "sm",
|
|
101
101
|
disabled: !0,
|
|
102
102
|
title: o.customer_amount ? "This price lets customers choose an amount. Change its limits through a catalog application or the client." : o.archived ? "This is an archived version. Change the current price for this key instead." : "Load the product before changing its price.",
|
|
103
|
-
children: /* @__PURE__ */ C(
|
|
103
|
+
children: /* @__PURE__ */ C(e, { id: "Change price" })
|
|
104
104
|
}) : /* @__PURE__ */ w(h, {
|
|
105
105
|
open: H,
|
|
106
106
|
onOpenChange: $,
|
|
107
107
|
children: [!I && /* @__PURE__ */ C(m, { render: /* @__PURE__ */ C(r, {
|
|
108
108
|
variant: "outline",
|
|
109
109
|
size: "sm",
|
|
110
|
-
children: /* @__PURE__ */ C(
|
|
110
|
+
children: /* @__PURE__ */ C(e, { id: "Change price" })
|
|
111
111
|
}) }), /* @__PURE__ */ C(f, {
|
|
112
112
|
className: _,
|
|
113
113
|
children: /* @__PURE__ */ C("form", {
|
|
@@ -117,23 +117,23 @@ function F({ price: o, productName: j, productKey: F, draft: I, onDone: ne }) {
|
|
|
117
117
|
},
|
|
118
118
|
children: /* @__PURE__ */ C(Q.Subscribe, {
|
|
119
119
|
selector: (e) => [e.values, e.isSubmitting],
|
|
120
|
-
children: ([
|
|
121
|
-
let f = a(
|
|
120
|
+
children: ([t, n]) => {
|
|
121
|
+
let f = a(t.amountInput, o.currency) ?? o.unit_amount, m = E(f, o.unit_amount), h = O(m, Z, X), _ = t.mode !== "migrate" || !!t.effectiveAt && A(m, new Date(t.effectiveAt), Z, X);
|
|
122
122
|
return /* @__PURE__ */ w(S, { children: [
|
|
123
123
|
/* @__PURE__ */ w(u, { children: [/* @__PURE__ */ w(ee, {
|
|
124
124
|
className: "flex items-center gap-2",
|
|
125
125
|
children: [
|
|
126
|
-
/* @__PURE__ */ C(
|
|
126
|
+
/* @__PURE__ */ C(e, { id: "Change price for " }),
|
|
127
127
|
j,
|
|
128
|
-
I && /* @__PURE__ */ C(
|
|
128
|
+
I && /* @__PURE__ */ C(c, {
|
|
129
129
|
variant: "secondary",
|
|
130
|
-
children: /* @__PURE__ */ C(
|
|
130
|
+
children: /* @__PURE__ */ C(e, { id: "drafted by copilot" })
|
|
131
131
|
})
|
|
132
132
|
]
|
|
133
133
|
}), /* @__PURE__ */ w(p, { children: [
|
|
134
|
-
/* @__PURE__ */ C(
|
|
134
|
+
/* @__PURE__ */ C(e, { id: "Step " }),
|
|
135
135
|
W,
|
|
136
|
-
/* @__PURE__ */ C(
|
|
136
|
+
/* @__PURE__ */ C(e, { id: " of 3:" }),
|
|
137
137
|
" ",
|
|
138
138
|
W === 1 ? "new amount" : W === 2 ? "migration plan" : "review"
|
|
139
139
|
] })] }),
|
|
@@ -144,13 +144,13 @@ function F({ price: o, productName: j, productKey: F, draft: I, onDone: ne }) {
|
|
|
144
144
|
className: "grid grid-cols-2 gap-3 text-sm",
|
|
145
145
|
children: [/* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
|
|
146
146
|
className: "text-xs text-muted-foreground uppercase",
|
|
147
|
-
children: /* @__PURE__ */ C(
|
|
147
|
+
children: /* @__PURE__ */ C(e, { id: "Current amount" })
|
|
148
148
|
}), /* @__PURE__ */ C("p", {
|
|
149
149
|
className: "font-medium",
|
|
150
150
|
children: s(o.unit_amount, o.currency)
|
|
151
151
|
})] }), /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
|
|
152
152
|
className: "text-xs text-muted-foreground uppercase",
|
|
153
|
-
children: /* @__PURE__ */ C(
|
|
153
|
+
children: /* @__PURE__ */ C(e, { id: "Currency · interval" })
|
|
154
154
|
}), /* @__PURE__ */ w("p", {
|
|
155
155
|
className: "font-medium",
|
|
156
156
|
children: [
|
|
@@ -167,37 +167,37 @@ function F({ price: o, productName: j, productKey: F, draft: I, onDone: ne }) {
|
|
|
167
167
|
let t = a(e, o.currency);
|
|
168
168
|
if (t === null || BigInt(t) <= 0n) return "Enter an amount greater than zero.";
|
|
169
169
|
} },
|
|
170
|
-
children: (
|
|
170
|
+
children: (t) => /* @__PURE__ */ w("div", {
|
|
171
171
|
className: "grid gap-1.5",
|
|
172
172
|
children: [
|
|
173
173
|
/* @__PURE__ */ C(g, {
|
|
174
174
|
htmlFor: B("wiz-amount"),
|
|
175
|
-
children: /* @__PURE__ */ C(
|
|
175
|
+
children: /* @__PURE__ */ C(e, { id: "New amount (major units)" })
|
|
176
176
|
}),
|
|
177
177
|
/* @__PURE__ */ C(i, {
|
|
178
178
|
id: B("wiz-amount"),
|
|
179
179
|
type: "number",
|
|
180
180
|
step: "any",
|
|
181
181
|
min: "0",
|
|
182
|
-
value:
|
|
183
|
-
onBlur:
|
|
184
|
-
onChange: (
|
|
182
|
+
value: t.state.value,
|
|
183
|
+
onBlur: t.handleBlur,
|
|
184
|
+
onChange: (e) => t.handleChange(e.target.value),
|
|
185
185
|
autoFocus: !0
|
|
186
186
|
}),
|
|
187
|
-
/* @__PURE__ */ C(
|
|
187
|
+
/* @__PURE__ */ C(l, { errors: t.state.meta.errors })
|
|
188
188
|
]
|
|
189
189
|
})
|
|
190
190
|
}),
|
|
191
191
|
m !== "unchanged" && /* @__PURE__ */ w("p", {
|
|
192
192
|
className: "text-sm text-muted-foreground",
|
|
193
193
|
children: [
|
|
194
|
-
/* @__PURE__ */ C(
|
|
194
|
+
/* @__PURE__ */ C(e, { id: "This is a price" }),
|
|
195
195
|
" ",
|
|
196
196
|
/* @__PURE__ */ C("span", {
|
|
197
197
|
className: "font-medium text-foreground",
|
|
198
198
|
children: m === "increase" ? "increase" : "decrease"
|
|
199
199
|
}),
|
|
200
|
-
/* @__PURE__ */ C(
|
|
200
|
+
/* @__PURE__ */ C(e, { id: ". Currency and interval stay locked to the current price." })
|
|
201
201
|
]
|
|
202
202
|
})
|
|
203
203
|
]
|
|
@@ -211,89 +211,89 @@ function F({ price: o, productName: j, productKey: F, draft: I, onDone: ne }) {
|
|
|
211
211
|
}),
|
|
212
212
|
/* @__PURE__ */ C(Q.Field, {
|
|
213
213
|
name: "mode",
|
|
214
|
-
children: (
|
|
214
|
+
children: (t) => /* @__PURE__ */ w("div", {
|
|
215
215
|
className: "grid gap-2",
|
|
216
216
|
children: [/* @__PURE__ */ w("label", {
|
|
217
217
|
className: "flex items-start gap-2 rounded-md border p-3 text-sm",
|
|
218
218
|
children: [/* @__PURE__ */ C("input", {
|
|
219
219
|
type: "radio",
|
|
220
|
-
name:
|
|
220
|
+
name: t.name,
|
|
221
221
|
className: "mt-1",
|
|
222
|
-
checked:
|
|
223
|
-
onChange: () =>
|
|
222
|
+
checked: t.state.value === "grandfather",
|
|
223
|
+
onChange: () => t.handleChange("grandfather")
|
|
224
224
|
}), /* @__PURE__ */ w("span", { children: [
|
|
225
225
|
/* @__PURE__ */ C("span", {
|
|
226
226
|
className: "font-medium",
|
|
227
|
-
children: /* @__PURE__ */ C(
|
|
227
|
+
children: /* @__PURE__ */ C(e, { id: "Grandfather." })
|
|
228
228
|
}),
|
|
229
229
|
" ",
|
|
230
|
-
/* @__PURE__ */ C(
|
|
231
|
-
m === "increase" && /* @__PURE__ */ C(
|
|
230
|
+
/* @__PURE__ */ C(e, { id: "Existing subscribers keep the current price." }),
|
|
231
|
+
m === "increase" && /* @__PURE__ */ C(c, {
|
|
232
232
|
variant: "secondary",
|
|
233
233
|
className: "ml-2",
|
|
234
|
-
children: /* @__PURE__ */ C(
|
|
234
|
+
children: /* @__PURE__ */ C(e, { id: "default" })
|
|
235
235
|
})
|
|
236
236
|
] })]
|
|
237
237
|
}), /* @__PURE__ */ w("label", {
|
|
238
238
|
className: "flex items-start gap-2 rounded-md border p-3 text-sm",
|
|
239
239
|
children: [/* @__PURE__ */ C("input", {
|
|
240
240
|
type: "radio",
|
|
241
|
-
name:
|
|
241
|
+
name: t.name,
|
|
242
242
|
className: "mt-1",
|
|
243
|
-
checked:
|
|
244
|
-
onChange: () =>
|
|
243
|
+
checked: t.state.value === "migrate",
|
|
244
|
+
onChange: () => t.handleChange("migrate")
|
|
245
245
|
}), /* @__PURE__ */ w("span", { children: [
|
|
246
246
|
/* @__PURE__ */ C("span", {
|
|
247
247
|
className: "font-medium",
|
|
248
|
-
children: /* @__PURE__ */ C(
|
|
248
|
+
children: /* @__PURE__ */ C(e, { id: "Migrate." })
|
|
249
249
|
}),
|
|
250
250
|
" ",
|
|
251
|
-
/* @__PURE__ */ C(
|
|
252
|
-
m === "decrease" && /* @__PURE__ */ C(
|
|
251
|
+
/* @__PURE__ */ C(e, { id: "Move everyone to the new price at their first renewal on or after a date you choose." }),
|
|
252
|
+
m === "decrease" && /* @__PURE__ */ C(c, {
|
|
253
253
|
variant: "secondary",
|
|
254
254
|
className: "ml-2",
|
|
255
|
-
children: /* @__PURE__ */ C(
|
|
255
|
+
children: /* @__PURE__ */ C(e, { id: "default" })
|
|
256
256
|
})
|
|
257
257
|
] })]
|
|
258
258
|
})]
|
|
259
259
|
})
|
|
260
260
|
}),
|
|
261
|
-
|
|
261
|
+
t.mode === "migrate" && /* @__PURE__ */ C(Q.Field, {
|
|
262
262
|
name: "effectiveAt",
|
|
263
|
-
children: (
|
|
263
|
+
children: (t) => /* @__PURE__ */ w("div", {
|
|
264
264
|
className: "grid gap-1.5",
|
|
265
265
|
children: [
|
|
266
266
|
/* @__PURE__ */ C(g, {
|
|
267
267
|
htmlFor: B("wiz-effective"),
|
|
268
|
-
children: /* @__PURE__ */ C(
|
|
268
|
+
children: /* @__PURE__ */ C(e, { id: "Effective date" })
|
|
269
269
|
}),
|
|
270
270
|
/* @__PURE__ */ C(i, {
|
|
271
271
|
id: B("wiz-effective"),
|
|
272
272
|
type: "date",
|
|
273
|
-
value:
|
|
273
|
+
value: t.state.value,
|
|
274
274
|
min: h ? N(h) : void 0,
|
|
275
|
-
onBlur:
|
|
276
|
-
onChange: (
|
|
275
|
+
onBlur: t.handleBlur,
|
|
276
|
+
onChange: (e) => t.handleChange(e.target.value)
|
|
277
277
|
}),
|
|
278
278
|
m === "increase" ? /* @__PURE__ */ w("p", {
|
|
279
279
|
className: "text-xs text-muted-foreground",
|
|
280
280
|
children: [
|
|
281
|
-
/* @__PURE__ */ C(
|
|
281
|
+
/* @__PURE__ */ C(e, { id: "Must be at least " }),
|
|
282
282
|
X,
|
|
283
|
-
/* @__PURE__ */ C(
|
|
283
|
+
/* @__PURE__ */ C(e, { id: " days away. Card networks require that much notice before a price goes up. You can change the number in Settings." })
|
|
284
284
|
]
|
|
285
285
|
}) : /* @__PURE__ */ C("p", {
|
|
286
286
|
className: "text-xs text-muted-foreground",
|
|
287
|
-
children: /* @__PURE__ */ C(
|
|
287
|
+
children: /* @__PURE__ */ C(e, { id: "A price going down needs no notice, so today is fine." })
|
|
288
288
|
}),
|
|
289
289
|
!_ && /* @__PURE__ */ C("p", {
|
|
290
290
|
className: "text-xs text-destructive",
|
|
291
291
|
role: "alert",
|
|
292
|
-
children: /* @__PURE__ */ C(
|
|
292
|
+
children: /* @__PURE__ */ C(e, { id: "Pick a later date." })
|
|
293
293
|
}),
|
|
294
294
|
/* @__PURE__ */ C("p", {
|
|
295
295
|
className: "text-xs text-muted-foreground",
|
|
296
|
-
children: /* @__PURE__ */ C(
|
|
296
|
+
children: /* @__PURE__ */ C(e, { id: "A reprice_scheduled notice is queued for every affected subscriber as soon as you confirm." })
|
|
297
297
|
})
|
|
298
298
|
]
|
|
299
299
|
})
|
|
@@ -310,8 +310,8 @@ function F({ price: o, productName: j, productKey: F, draft: I, onDone: ne }) {
|
|
|
310
310
|
currency: o.currency,
|
|
311
311
|
affectedCount: J ?? 0,
|
|
312
312
|
plan: {
|
|
313
|
-
mode:
|
|
314
|
-
effectiveAt:
|
|
313
|
+
mode: t.mode,
|
|
314
|
+
effectiveAt: t.mode === "migrate" ? new Date(t.effectiveAt).toISOString() : ""
|
|
315
315
|
},
|
|
316
316
|
now: Z
|
|
317
317
|
})
|
|
@@ -323,19 +323,19 @@ function F({ price: o, productName: j, productKey: F, draft: I, onDone: ne }) {
|
|
|
323
323
|
variant: "outline",
|
|
324
324
|
disabled: n,
|
|
325
325
|
onClick: () => G((e) => e - 1),
|
|
326
|
-
children: /* @__PURE__ */ C(
|
|
326
|
+
children: /* @__PURE__ */ C(e, { id: "Back" })
|
|
327
327
|
}),
|
|
328
328
|
W === 1 && /* @__PURE__ */ C(r, {
|
|
329
329
|
type: "button",
|
|
330
|
-
disabled: !
|
|
330
|
+
disabled: !t.amountInput || m === "unchanged" || BigInt(f) <= 0n,
|
|
331
331
|
onClick: ae,
|
|
332
|
-
children: /* @__PURE__ */ C(
|
|
332
|
+
children: /* @__PURE__ */ C(e, { id: "Next" })
|
|
333
333
|
}),
|
|
334
334
|
W === 2 && /* @__PURE__ */ C(r, {
|
|
335
335
|
type: "button",
|
|
336
336
|
disabled: !_ || K.isPending,
|
|
337
337
|
onClick: () => G(3),
|
|
338
|
-
children: /* @__PURE__ */ C(
|
|
338
|
+
children: /* @__PURE__ */ C(e, { id: "Next" })
|
|
339
339
|
}),
|
|
340
340
|
W === 3 && /* @__PURE__ */ C(r, {
|
|
341
341
|
type: "submit",
|
|
@@ -353,4 +353,4 @@ function F({ price: o, productName: j, productKey: F, draft: I, onDone: ne }) {
|
|
|
353
353
|
//#endregion
|
|
354
354
|
export { F as t };
|
|
355
355
|
|
|
356
|
-
//# sourceMappingURL=admin-price-wizard-
|
|
356
|
+
//# sourceMappingURL=admin-price-wizard-CTbkbmYc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-price-wizard-CBEcNGvP.js","names":[],"sources":["../src/admin/pages/catalog/price-wizard-logic.ts","../src/admin/pages/catalog/price-wizard.tsx"],"sourcesContent":["// Pure logic for the price-change wizard, kept apart from React for unit tests.\nimport { formatNativeAmount } from \"#orck/admin/lib/format\"\n\nexport type PriceDirection = \"increase\" | \"decrease\" | \"unchanged\"\n\nexport function detectDirection(\n newAmount: string,\n currentAmount: string\n): PriceDirection {\n const next = BigInt(newAmount)\n const current = BigInt(currentAmount)\n if (next > current) return \"increase\"\n if (next < current) return \"decrease\"\n return \"unchanged\"\n}\n\nexport type MigrationMode = \"grandfather\" | \"migrate\"\n\n// DEFAULT_NOTICE_WINDOW_DAYS is the fallback until the merchant's\n// reprice_notice_window_days loads; it mirrors\n// subscriptions.DefaultPriceIncreaseNoticeDays so the UI never under-gates.\n// The server enforces the window too (price_increase_notice_too_short).\nexport const DEFAULT_NOTICE_WINDOW_DAYS = 30\n\n// defaultMigrationMode is the direction-aware Step 2 default: an increase\n// grandfathers (no new action), a decrease migrates now (never grandfathered).\nexport function defaultMigrationMode(direction: PriceDirection): MigrationMode {\n return direction === \"decrease\" ? \"migrate\" : \"grandfather\"\n}\n\n// minEffectiveDate is the earliest allowed migration date, or null when there\n// is no minimum (a decrease needs no notice).\nexport function minEffectiveDate(\n direction: PriceDirection,\n now: Date,\n noticeWindowDays: number\n): Date | null {\n if (direction !== \"increase\") return null\n const min = new Date(now)\n min.setUTCDate(min.getUTCDate() + noticeWindowDays)\n return min\n}\n\n// defaultEffectiveDate is Step 2's pre-filled migration date: the notice\n// window's floor for an increase, \"now\" for a decrease.\nexport function defaultEffectiveDate(\n direction: PriceDirection,\n now: Date,\n noticeWindowDays: number\n): Date {\n return minEffectiveDate(direction, now, noticeWindowDays) ?? now\n}\n\n// isEffectiveDateValid enforces the console-side notice-window gate: an\n// increase+migrate plan may not pick a date inside the notice window.\nexport function isEffectiveDateValid(\n direction: PriceDirection,\n effectiveAt: Date,\n now: Date,\n noticeWindowDays: number\n): boolean {\n const min = minEffectiveDate(direction, now, noticeWindowDays)\n return !min || effectiveAt.getTime() >= min.getTime()\n}\n\nexport interface MigrationPlan {\n mode: MigrationMode\n // ISO instant; only meaningful when mode === \"migrate\".\n effectiveAt: string\n}\n\nconst dateLabel = (iso: string) =>\n new Date(iso).toLocaleDateString(undefined, {\n month: \"short\",\n day: \"numeric\",\n year: \"numeric\",\n })\n\n// buildReviewText renders Step 3's plan in words, e.g. \"New subscribers pay $12\n// immediately. 1,204 existing subscribers keep $10 until Sep 1, then move to\n// $12 at their next renewal. Notices go out on confirm.\"\nexport function buildReviewText(params: {\n newAmount: string\n currentAmount: string\n currency: string\n affectedCount: number\n plan: MigrationPlan\n now: Date\n}): string {\n const { newAmount, currentAmount, currency, affectedCount, plan, now } =\n params\n const newLabel = formatNativeAmount(newAmount, currency)\n const oldLabel = formatNativeAmount(currentAmount, currency)\n const lead = `New subscribers pay ${newLabel} immediately.`\n\n if (affectedCount === 0) {\n return `${lead} No existing subscribers are on a prior version of this price.`\n }\n const subj = `${affectedCount.toLocaleString()} existing subscriber${affectedCount === 1 ? \"\" : \"s\"}`\n\n if (plan.mode === \"grandfather\") {\n return `${lead} ${subj} keep ${oldLabel} forever (grandfathered).`\n }\n\n // The engine notifies each affected subscriber at schedule time, however\n // far out effective_at is: always say so.\n const effective = new Date(plan.effectiveAt)\n const immediate = effective.getTime() <= now.getTime()\n if (immediate) {\n return `${lead} ${subj} move to ${newLabel} at their next renewal. Notices go out on confirm.`\n }\n return `${lead} ${subj} keep ${oldLabel} until ${dateLabel(plan.effectiveAt)}, then move to ${newLabel} at their next renewal. Notices go out on confirm.`\n}\n","import { AdminMessage, useAdminUI } from \"#orck/admin/ui-context\"\nimport { useAdminServices } from \"#orck/admin/context\"\nimport * as React from \"react\"\n\nimport { useForm } from \"@tanstack/react-form\"\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\"\n\nimport { FormFieldErrors } from \"#orck/admin/components/form-field-errors\"\nimport { Badge } from \"#orck/admin/components/ui/badge\"\nimport { Button } from \"#orck/admin/components/ui/button\"\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"#orck/admin/components/ui/dialog\"\nimport { Input } from \"#orck/admin/components/ui/input\"\nimport { Label } from \"#orck/admin/components/ui/label\"\nimport type { PriceChangeDraft } from \"#orck/admin/lib/api/copilot\"\nimport { DIALOG_FORM } from \"#orck/admin/lib/dialog-width\"\nimport type { Price } from \"#orck/client/generated/wire\"\nimport {\n formatNativeAmount,\n nativeAmountFromInput,\n nativeAmountToInput,\n} from \"#orck/admin/lib/format\"\n\nimport { priceIntervalLabel } from \"#orck/admin/pages/catalog/price-format\"\nimport {\n buildReviewText,\n defaultEffectiveDate,\n defaultMigrationMode,\n DEFAULT_NOTICE_WINDOW_DAYS,\n detectDirection,\n isEffectiveDateValid,\n minEffectiveDate,\n type MigrationMode,\n} from \"#orck/admin/pages/catalog/price-wizard-logic\"\n\nconst toDateInputValue = (d: Date) => d.toISOString().slice(0, 10)\n\nconst priceChangeFormValues = (price: Price, draft?: PriceChangeDraft) => ({\n amountInput: nativeAmountToInput(\n draft?.new_amount ?? price.unit_amount,\n price.currency\n ),\n mode: (draft?.migration ? \"migrate\" : \"grandfather\") as MigrationMode,\n effectiveAt: draft?.migration?.effective_at\n ? toDateInputValue(new Date(draft.migration.effective_at))\n : \"\",\n})\n\n// PriceChangeWizard is the #777 console price-change wizard — the ONLY\n// amount-edit affordance on a price. Three steps: new amount -> migration\n// plan (direction-aware defaults, live affected-count preview, notice-window\n// gate on increase+migrate) -> review in words, then confirm applies the\n// catalog price update followed (if migrating) by the price migration.\n//\n// draft (#779): when the catalog copilot proposed this change, the dialog\n// opens PRE-FILLED straight at Step 3 (review) — the affected count already\n// rode in the draft, so no extra preview call is needed. Confirm behaves\n// EXACTLY as a hand-typed change (the same create-price and price-migration\n// calls).\nexport function PriceChangeWizard({\n price,\n productName,\n productKey,\n draft,\n onDone,\n}: {\n price: Price\n productName: string\n productKey: string | undefined\n draft?: PriceChangeDraft\n onDone?: () => void\n}) {\n const { toast, toastApiError, adminMutations, adminQueries } =\n useAdminServices()\n\n const { id: adminId } = useAdminUI()\n\n const queryClient = useQueryClient()\n const [open, setOpen] = React.useState(() => !!draft)\n const [step, setStep] = React.useState<1 | 2 | 3>(() => (draft ? 3 : 1))\n const previewPriceChange = useMutation(adminMutations.previewPriceChange())\n const changePrice = useMutation(adminMutations.changePrice(queryClient))\n const affectedCount =\n previewPriceChange.data?.matched ?? draft?.affected_count ?? null\n const { data: configuration } = useQuery({\n ...adminQueries.merchantConfiguration(),\n enabled: open,\n })\n const noticeWindowDays =\n configuration?.reprice_notice_window_days ?? DEFAULT_NOTICE_WINDOW_DAYS\n\n const [now] = React.useState(() => new Date())\n const form = useForm({\n defaultValues: priceChangeFormValues(price, draft),\n onSubmit: async ({ value }) => {\n if (!productKey || price.customer_amount) return\n const newAmount = nativeAmountFromInput(value.amountInput, price.currency)\n if (newAmount === null || BigInt(newAmount) <= 0n) return\n\n try {\n await changePrice.mutateAsync({\n price: {\n product_id: price.product_id,\n unit_amount: newAmount,\n currency: price.currency,\n access_duration_hours: price.access_duration_hours ?? undefined,\n billing_interval_hours: price.billing_interval_hours ?? undefined,\n trial_unit_amount: price.trial_unit_amount ?? undefined,\n trial_duration_hours: price.trial_duration_hours ?? undefined,\n key: price.key,\n sell_via: price.sell_via ?? undefined,\n expected_revision: price.revision,\n },\n migration:\n value.mode === \"migrate\"\n ? {\n productKey,\n priceKey: price.key,\n effectiveAt: new Date(value.effectiveAt).toISOString(),\n }\n : undefined,\n })\n toast.success(\n value.mode === \"migrate\"\n ? \"Price updated and migration scheduled\"\n : \"Price updated\"\n )\n handleOpenChange(false)\n onDone?.()\n } catch (err) {\n toastApiError(err, \"Change price\")\n }\n },\n })\n\n const reset = () => {\n setStep(1)\n form.reset(priceChangeFormValues(price))\n previewPriceChange.reset()\n }\n\n const handleOpenChange = (next: boolean) => {\n if (!next) {\n reset()\n }\n setOpen(next)\n }\n\n const enterStep2 = () => {\n if (!productKey || price.customer_amount) return\n const amount = nativeAmountFromInput(\n form.state.values.amountInput,\n price.currency\n )\n const direction = detectDirection(\n amount ?? price.unit_amount,\n price.unit_amount\n )\n form.setFieldValue(\"mode\", defaultMigrationMode(direction))\n form.setFieldValue(\n \"effectiveAt\",\n toDateInputValue(defaultEffectiveDate(direction, now, noticeWindowDays))\n )\n setStep(2)\n previewPriceChange.reset()\n previewPriceChange.mutate(\n { productKey, priceKey: price.key },\n { onError: (err) => toastApiError(err, \"Preview affected subscribers\") }\n )\n }\n\n // Archived (prior-version) rows are history, not the editable current\n // price. Each product/key pair has exactly one live edit target.\n // Wait for the product before allowing previews or scheduling a migration.\n if (price.archived || !productKey || price.customer_amount) {\n return (\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled\n title={\n price.customer_amount\n ? \"This price lets customers choose an amount. Change its limits through a catalog application or the client.\"\n : price.archived\n ? \"This is an archived version. Change the current price for this key instead.\"\n : \"Load the product before changing its price.\"\n }\n >\n <AdminMessage id={\"Change price\"} />\n </Button>\n )\n }\n\n return (\n <Dialog open={open} onOpenChange={handleOpenChange}>\n {!draft && (\n <DialogTrigger\n render={\n <Button variant=\"outline\" size=\"sm\">\n <AdminMessage id={\"Change price\"} />\n </Button>\n }\n />\n )}\n <DialogContent className={DIALOG_FORM}>\n <form\n className=\"grid gap-4\"\n onSubmit={(event) => {\n event.preventDefault()\n event.stopPropagation()\n if (step !== 3) return\n void form.handleSubmit()\n }}\n >\n <form.Subscribe\n selector={(state) => [state.values, state.isSubmitting] as const}\n >\n {([values, isSubmitting]) => {\n const newAmount =\n nativeAmountFromInput(values.amountInput, price.currency) ??\n price.unit_amount\n const direction = detectDirection(newAmount, price.unit_amount)\n const minDate = minEffectiveDate(direction, now, noticeWindowDays)\n const dateValid =\n values.mode !== \"migrate\" ||\n (!!values.effectiveAt &&\n isEffectiveDateValid(\n direction,\n new Date(values.effectiveAt),\n now,\n noticeWindowDays\n ))\n\n return (\n <>\n <DialogHeader>\n <DialogTitle className=\"flex items-center gap-2\">\n <AdminMessage id={\"Change price for \"} />\n {productName}\n {draft && (\n <Badge variant=\"secondary\">\n <AdminMessage id={\"drafted by copilot\"} />\n </Badge>\n )}\n </DialogTitle>\n <DialogDescription>\n <AdminMessage id={\"Step \"} />\n {step}\n <AdminMessage id={\" of 3:\"} />{\" \"}\n {step === 1\n ? \"new amount\"\n : step === 2\n ? \"migration plan\"\n : \"review\"}\n </DialogDescription>\n </DialogHeader>\n\n {step === 1 && (\n <div className=\"grid gap-3\">\n <div className=\"grid grid-cols-2 gap-3 text-sm\">\n <div>\n <p className=\"text-xs text-muted-foreground uppercase\">\n <AdminMessage id={\"Current amount\"} />\n </p>\n <p className=\"font-medium\">\n {formatNativeAmount(\n price.unit_amount,\n price.currency\n )}\n </p>\n </div>\n <div>\n <p className=\"text-xs text-muted-foreground uppercase\">\n <AdminMessage id={\"Currency · interval\"} />\n </p>\n <p className=\"font-medium\">\n {price.currency.toUpperCase()} ·{\" \"}\n {priceIntervalLabel(price)}\n </p>\n </div>\n </div>\n <form.Field\n name=\"amountInput\"\n validators={{\n onBlur: ({ value }) => {\n const amount = nativeAmountFromInput(\n value,\n price.currency\n )\n if (amount === null || BigInt(amount) <= 0n) {\n return \"Enter an amount greater than zero.\"\n }\n return undefined\n },\n }}\n >\n {(field) => (\n <div className=\"grid gap-1.5\">\n <Label htmlFor={adminId(\"wiz-amount\")}>\n <AdminMessage id={\"New amount (major units)\"} />\n </Label>\n <Input\n id={adminId(\"wiz-amount\")}\n type=\"number\"\n step=\"any\"\n min=\"0\"\n value={field.state.value}\n onBlur={field.handleBlur}\n onChange={(event) =>\n field.handleChange(event.target.value)\n }\n autoFocus\n />\n <FormFieldErrors errors={field.state.meta.errors} />\n </div>\n )}\n </form.Field>\n {direction !== \"unchanged\" && (\n <p className=\"text-sm text-muted-foreground\">\n <AdminMessage id={\"This is a price\"} />{\" \"}\n <span className=\"font-medium text-foreground\">\n {direction === \"increase\" ? \"increase\" : \"decrease\"}\n </span>\n <AdminMessage\n id={\n \". Currency and interval stay locked to the current price.\"\n }\n />\n </p>\n )}\n </div>\n )}\n\n {step === 2 && (\n <div className=\"grid gap-3\">\n <p className=\"text-sm\">\n {affectedCount === null && previewPriceChange.isPending\n ? \"Checking affected subscribers…\"\n : `${(affectedCount ?? 0).toLocaleString()} active subscription${affectedCount === 1 ? \"\" : \"s\"} on prior versions of ${price.key}.`}\n </p>\n <form.Field name=\"mode\">\n {(field) => (\n <div className=\"grid gap-2\">\n <label className=\"flex items-start gap-2 rounded-md border p-3 text-sm\">\n <input\n type=\"radio\"\n name={field.name}\n className=\"mt-1\"\n checked={field.state.value === \"grandfather\"}\n onChange={() =>\n field.handleChange(\"grandfather\")\n }\n />\n <span>\n <span className=\"font-medium\">\n <AdminMessage id={\"Grandfather.\"} />\n </span>{\" \"}\n <AdminMessage\n id={\n \"Existing subscribers keep the current price.\"\n }\n />\n {direction === \"increase\" && (\n <Badge variant=\"secondary\" className=\"ml-2\">\n <AdminMessage id={\"default\"} />\n </Badge>\n )}\n </span>\n </label>\n <label className=\"flex items-start gap-2 rounded-md border p-3 text-sm\">\n <input\n type=\"radio\"\n name={field.name}\n className=\"mt-1\"\n checked={field.state.value === \"migrate\"}\n onChange={() => field.handleChange(\"migrate\")}\n />\n <span>\n <span className=\"font-medium\">\n <AdminMessage id={\"Migrate.\"} />\n </span>{\" \"}\n <AdminMessage\n id={\n \"Move everyone to the new price at their first renewal on or after a date you choose.\"\n }\n />\n {direction === \"decrease\" && (\n <Badge variant=\"secondary\" className=\"ml-2\">\n <AdminMessage id={\"default\"} />\n </Badge>\n )}\n </span>\n </label>\n </div>\n )}\n </form.Field>\n {values.mode === \"migrate\" && (\n <form.Field name=\"effectiveAt\">\n {(field) => (\n <div className=\"grid gap-1.5\">\n <Label htmlFor={adminId(\"wiz-effective\")}>\n <AdminMessage id={\"Effective date\"} />\n </Label>\n <Input\n id={adminId(\"wiz-effective\")}\n type=\"date\"\n value={field.state.value}\n min={\n minDate\n ? toDateInputValue(minDate)\n : undefined\n }\n onBlur={field.handleBlur}\n onChange={(event) =>\n field.handleChange(event.target.value)\n }\n />\n {direction === \"increase\" ? (\n <p className=\"text-xs text-muted-foreground\">\n <AdminMessage id={\"Must be at least \"} />\n {noticeWindowDays}\n <AdminMessage\n id={\n \" days away. Card networks require that much notice before a price goes up. You can change the number in Settings.\"\n }\n />\n </p>\n ) : (\n <p className=\"text-xs text-muted-foreground\">\n <AdminMessage\n id={\n \"A price going down needs no notice, so today is fine.\"\n }\n />\n </p>\n )}\n {!dateValid && (\n <p\n className=\"text-xs text-destructive\"\n role=\"alert\"\n >\n <AdminMessage id={\"Pick a later date.\"} />\n </p>\n )}\n <p className=\"text-xs text-muted-foreground\">\n <AdminMessage\n id={\n \"A reprice_scheduled notice is queued for every affected subscriber as soon as you confirm.\"\n }\n />\n </p>\n </div>\n )}\n </form.Field>\n )}\n </div>\n )}\n\n {step === 3 && (\n <div className=\"grid gap-3\">\n <p className=\"rounded-md border bg-muted/40 p-3 text-sm\">\n {buildReviewText({\n newAmount,\n currentAmount: price.unit_amount,\n currency: price.currency,\n affectedCount: affectedCount ?? 0,\n plan: {\n mode: values.mode,\n effectiveAt:\n values.mode === \"migrate\"\n ? new Date(values.effectiveAt).toISOString()\n : \"\",\n },\n now,\n })}\n </p>\n </div>\n )}\n\n <DialogFooter>\n {step > 1 && (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={isSubmitting}\n onClick={() => setStep((value) => (value - 1) as 1 | 2)}\n >\n <AdminMessage id={\"Back\"} />\n </Button>\n )}\n {step === 1 && (\n <Button\n type=\"button\"\n disabled={\n !values.amountInput ||\n direction === \"unchanged\" ||\n BigInt(newAmount) <= 0n\n }\n onClick={enterStep2}\n >\n <AdminMessage id={\"Next\"} />\n </Button>\n )}\n {step === 2 && (\n <Button\n type=\"button\"\n disabled={!dateValid || previewPriceChange.isPending}\n onClick={() => setStep(3)}\n >\n <AdminMessage id={\"Next\"} />\n </Button>\n )}\n {step === 3 && (\n <Button type=\"submit\" disabled={isSubmitting}>\n {isSubmitting ? \"Working…\" : \"Confirm\"}\n </Button>\n )}\n </DialogFooter>\n </>\n )\n }}\n </form.Subscribe>\n </form>\n </DialogContent>\n </Dialog>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAKA,SAAgB,EACd,GACA,GACgB;CAChB,IAAM,IAAO,OAAO,CAAS,GACvB,IAAU,OAAO,CAAa;CAGpC,OAFI,IAAO,IAAgB,aACvB,IAAO,IAAgB,aACpB;AACT;AAYA,SAAgB,EAAqB,GAA0C;CAC7E,OAAO,MAAc,aAAa,YAAY;AAChD;AAIA,SAAgB,EACd,GACA,GACA,GACa;CACb,IAAI,MAAc,YAAY,OAAO;CACrC,IAAM,IAAM,IAAI,KAAK,CAAG;CAExB,OADA,EAAI,WAAW,EAAI,WAAW,IAAI,CAAgB,GAC3C;AACT;AAIA,SAAgB,EACd,GACA,GACA,GACM;CACN,OAAO,EAAiB,GAAW,GAAK,CAAgB,KAAK;AAC/D;AAIA,SAAgB,EACd,GACA,GACA,GACA,GACS;CACT,IAAM,IAAM,EAAiB,GAAW,GAAK,CAAgB;CAC7D,OAAO,CAAC,KAAO,EAAY,QAAQ,KAAK,EAAI,QAAQ;AACtD;AAQA,IAAM,KAAa,MACjB,IAAI,KAAK,CAAG,CAAC,CAAC,mBAAmB,KAAA,GAAW;CAC1C,OAAO;CACP,KAAK;CACL,MAAM;AACR,CAAC;AAKH,SAAgB,EAAgB,GAOrB;CACT,IAAM,EAAE,cAAW,kBAAe,aAAU,kBAAe,SAAM,WAC/D,GACI,IAAW,EAAmB,GAAW,CAAQ,GACjD,IAAW,EAAmB,GAAe,CAAQ,GACrD,IAAO,uBAAuB,EAAS;CAE7C,IAAI,MAAkB,GACpB,OAAO,GAAG,EAAK;CAEjB,I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names":[],"sources":["../src/admin/pages/catalog/price-wizard-logic.ts","../src/admin/pages/catalog/price-wizard.tsx"],"sourcesContent":["// Pure logic for the price-change wizard, kept apart from React for unit tests.\nimport { formatNativeAmount } from \"#orck/admin/lib/format\"\n\nexport type PriceDirection = \"increase\" | \"decrease\" | \"unchanged\"\n\nexport function detectDirection(\n newAmount: string,\n currentAmount: string\n): PriceDirection {\n const next = BigInt(newAmount)\n const current = BigInt(currentAmount)\n if (next > current) return \"increase\"\n if (next < current) return \"decrease\"\n return \"unchanged\"\n}\n\nexport type MigrationMode = \"grandfather\" | \"migrate\"\n\n// DEFAULT_NOTICE_WINDOW_DAYS is the fallback until the merchant's\n// reprice_notice_window_days loads; it mirrors\n// subscriptions.DefaultPriceIncreaseNoticeDays so the UI never under-gates.\n// The server enforces the window too (price_increase_notice_too_short).\nexport const DEFAULT_NOTICE_WINDOW_DAYS = 30\n\n// defaultMigrationMode is the direction-aware Step 2 default: an increase\n// grandfathers (no new action), a decrease migrates now (never grandfathered).\nexport function defaultMigrationMode(direction: PriceDirection): MigrationMode {\n return direction === \"decrease\" ? \"migrate\" : \"grandfather\"\n}\n\n// minEffectiveDate is the earliest allowed migration date, or null when there\n// is no minimum (a decrease needs no notice).\nexport function minEffectiveDate(\n direction: PriceDirection,\n now: Date,\n noticeWindowDays: number\n): Date | null {\n if (direction !== \"increase\") return null\n const min = new Date(now)\n min.setUTCDate(min.getUTCDate() + noticeWindowDays)\n return min\n}\n\n// defaultEffectiveDate is Step 2's pre-filled migration date: the notice\n// window's floor for an increase, \"now\" for a decrease.\nexport function defaultEffectiveDate(\n direction: PriceDirection,\n now: Date,\n noticeWindowDays: number\n): Date {\n return minEffectiveDate(direction, now, noticeWindowDays) ?? now\n}\n\n// isEffectiveDateValid enforces the console-side notice-window gate: an\n// increase+migrate plan may not pick a date inside the notice window.\nexport function isEffectiveDateValid(\n direction: PriceDirection,\n effectiveAt: Date,\n now: Date,\n noticeWindowDays: number\n): boolean {\n const min = minEffectiveDate(direction, now, noticeWindowDays)\n return !min || effectiveAt.getTime() >= min.getTime()\n}\n\nexport interface MigrationPlan {\n mode: MigrationMode\n // ISO instant; only meaningful when mode === \"migrate\".\n effectiveAt: string\n}\n\nconst dateLabel = (iso: string) =>\n new Date(iso).toLocaleDateString(undefined, {\n month: \"short\",\n day: \"numeric\",\n year: \"numeric\",\n })\n\n// buildReviewText renders Step 3's plan in words, e.g. \"New subscribers pay $12\n// immediately. 1,204 existing subscribers keep $10 until Sep 1, then move to\n// $12 at their next renewal. Notices go out on confirm.\"\nexport function buildReviewText(params: {\n newAmount: string\n currentAmount: string\n currency: string\n affectedCount: number\n plan: MigrationPlan\n now: Date\n}): string {\n const { newAmount, currentAmount, currency, affectedCount, plan, now } =\n params\n const newLabel = formatNativeAmount(newAmount, currency)\n const oldLabel = formatNativeAmount(currentAmount, currency)\n const lead = `New subscribers pay ${newLabel} immediately.`\n\n if (affectedCount === 0) {\n return `${lead} No existing subscribers are on a prior version of this price.`\n }\n const subj = `${affectedCount.toLocaleString()} existing subscriber${affectedCount === 1 ? \"\" : \"s\"}`\n\n if (plan.mode === \"grandfather\") {\n return `${lead} ${subj} keep ${oldLabel} forever (grandfathered).`\n }\n\n // The engine notifies each affected subscriber at schedule time, however\n // far out effective_at is: always say so.\n const effective = new Date(plan.effectiveAt)\n const immediate = effective.getTime() <= now.getTime()\n if (immediate) {\n return `${lead} ${subj} move to ${newLabel} at their next renewal. Notices go out on confirm.`\n }\n return `${lead} ${subj} keep ${oldLabel} until ${dateLabel(plan.effectiveAt)}, then move to ${newLabel} at their next renewal. Notices go out on confirm.`\n}\n","import { AdminMessage, useAdminUI } from \"#orck/admin/ui-context\"\nimport { useAdminServices } from \"#orck/admin/context\"\nimport * as React from \"react\"\n\nimport { useForm } from \"@tanstack/react-form\"\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\"\n\nimport { FormFieldErrors } from \"#orck/admin/components/form-field-errors\"\nimport { Badge } from \"#orck/admin/components/ui/badge\"\nimport { Button } from \"#orck/admin/components/ui/button\"\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"#orck/admin/components/ui/dialog\"\nimport { Input } from \"#orck/admin/components/ui/input\"\nimport { Label } from \"#orck/admin/components/ui/label\"\nimport type { PriceChangeDraft } from \"#orck/admin/lib/api/copilot\"\nimport { DIALOG_FORM } from \"#orck/admin/lib/dialog-width\"\nimport type { Price } from \"#orck/client/generated/wire\"\nimport {\n formatNativeAmount,\n nativeAmountFromInput,\n nativeAmountToInput,\n} from \"#orck/admin/lib/format\"\n\nimport { priceIntervalLabel } from \"#orck/admin/pages/catalog/price-format\"\nimport {\n buildReviewText,\n defaultEffectiveDate,\n defaultMigrationMode,\n DEFAULT_NOTICE_WINDOW_DAYS,\n detectDirection,\n isEffectiveDateValid,\n minEffectiveDate,\n type MigrationMode,\n} from \"#orck/admin/pages/catalog/price-wizard-logic\"\n\nconst toDateInputValue = (d: Date) => d.toISOString().slice(0, 10)\n\nconst priceChangeFormValues = (price: Price, draft?: PriceChangeDraft) => ({\n amountInput: nativeAmountToInput(\n draft?.new_amount ?? price.unit_amount,\n price.currency\n ),\n mode: (draft?.migration ? \"migrate\" : \"grandfather\") as MigrationMode,\n effectiveAt: draft?.migration?.effective_at\n ? toDateInputValue(new Date(draft.migration.effective_at))\n : \"\",\n})\n\n// PriceChangeWizard is the #777 console price-change wizard — the ONLY\n// amount-edit affordance on a price. Three steps: new amount -> migration\n// plan (direction-aware defaults, live affected-count preview, notice-window\n// gate on increase+migrate) -> review in words, then confirm applies the\n// catalog price update followed (if migrating) by the price migration.\n//\n// draft (#779): when the catalog copilot proposed this change, the dialog\n// opens PRE-FILLED straight at Step 3 (review) — the affected count already\n// rode in the draft, so no extra preview call is needed. Confirm behaves\n// EXACTLY as a hand-typed change (the same create-price and price-migration\n// calls).\nexport function PriceChangeWizard({\n price,\n productName,\n productKey,\n draft,\n onDone,\n}: {\n price: Price\n productName: string\n productKey: string | undefined\n draft?: PriceChangeDraft\n onDone?: () => void\n}) {\n const { toast, toastApiError, adminMutations, adminQueries } =\n useAdminServices()\n\n const { id: adminId } = useAdminUI()\n\n const queryClient = useQueryClient()\n const [open, setOpen] = React.useState(() => !!draft)\n const [step, setStep] = React.useState<1 | 2 | 3>(() => (draft ? 3 : 1))\n const previewPriceChange = useMutation(adminMutations.previewPriceChange())\n const changePrice = useMutation(adminMutations.changePrice(queryClient))\n const affectedCount =\n previewPriceChange.data?.matched ?? draft?.affected_count ?? null\n const { data: configuration } = useQuery({\n ...adminQueries.merchantConfiguration(),\n enabled: open,\n })\n const noticeWindowDays =\n configuration?.reprice_notice_window_days ?? DEFAULT_NOTICE_WINDOW_DAYS\n\n const [now] = React.useState(() => new Date())\n const form = useForm({\n defaultValues: priceChangeFormValues(price, draft),\n onSubmit: async ({ value }) => {\n if (!productKey || price.customer_amount) return\n const newAmount = nativeAmountFromInput(value.amountInput, price.currency)\n if (newAmount === null || BigInt(newAmount) <= 0n) return\n\n try {\n await changePrice.mutateAsync({\n price: {\n product_id: price.product_id,\n unit_amount: newAmount,\n currency: price.currency,\n access_duration_hours: price.access_duration_hours ?? undefined,\n billing_interval_hours: price.billing_interval_hours ?? undefined,\n trial_unit_amount: price.trial_unit_amount ?? undefined,\n trial_duration_hours: price.trial_duration_hours ?? undefined,\n key: price.key,\n sell_via: price.sell_via ?? undefined,\n expected_revision: price.revision,\n },\n migration:\n value.mode === \"migrate\"\n ? {\n productKey,\n priceKey: price.key,\n effectiveAt: new Date(value.effectiveAt).toISOString(),\n }\n : undefined,\n })\n toast.success(\n value.mode === \"migrate\"\n ? \"Price updated and migration scheduled\"\n : \"Price updated\"\n )\n handleOpenChange(false)\n onDone?.()\n } catch (err) {\n toastApiError(err, \"Change price\")\n }\n },\n })\n\n const reset = () => {\n setStep(1)\n form.reset(priceChangeFormValues(price))\n previewPriceChange.reset()\n }\n\n const handleOpenChange = (next: boolean) => {\n if (!next) {\n reset()\n }\n setOpen(next)\n }\n\n const enterStep2 = () => {\n if (!productKey || price.customer_amount) return\n const amount = nativeAmountFromInput(\n form.state.values.amountInput,\n price.currency\n )\n const direction = detectDirection(\n amount ?? price.unit_amount,\n price.unit_amount\n )\n form.setFieldValue(\"mode\", defaultMigrationMode(direction))\n form.setFieldValue(\n \"effectiveAt\",\n toDateInputValue(defaultEffectiveDate(direction, now, noticeWindowDays))\n )\n setStep(2)\n previewPriceChange.reset()\n previewPriceChange.mutate(\n { productKey, priceKey: price.key },\n { onError: (err) => toastApiError(err, \"Preview affected subscribers\") }\n )\n }\n\n // Archived (prior-version) rows are history, not the editable current\n // price. Each product/key pair has exactly one live edit target.\n // Wait for the product before allowing previews or scheduling a migration.\n if (price.archived || !productKey || price.customer_amount) {\n return (\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled\n title={\n price.customer_amount\n ? \"This price lets customers choose an amount. Change its limits through a catalog application or the client.\"\n : price.archived\n ? \"This is an archived version. Change the current price for this key instead.\"\n : \"Load the product before changing its price.\"\n }\n >\n <AdminMessage id={\"Change price\"} />\n </Button>\n )\n }\n\n return (\n <Dialog open={open} onOpenChange={handleOpenChange}>\n {!draft && (\n <DialogTrigger\n render={\n <Button variant=\"outline\" size=\"sm\">\n <AdminMessage id={\"Change price\"} />\n </Button>\n }\n />\n )}\n <DialogContent className={DIALOG_FORM}>\n <form\n className=\"grid gap-4\"\n onSubmit={(event) => {\n event.preventDefault()\n event.stopPropagation()\n if (step !== 3) return\n void form.handleSubmit()\n }}\n >\n <form.Subscribe\n selector={(state) => [state.values, state.isSubmitting] as const}\n >\n {([values, isSubmitting]) => {\n const newAmount =\n nativeAmountFromInput(values.amountInput, price.currency) ??\n price.unit_amount\n const direction = detectDirection(newAmount, price.unit_amount)\n const minDate = minEffectiveDate(direction, now, noticeWindowDays)\n const dateValid =\n values.mode !== \"migrate\" ||\n (!!values.effectiveAt &&\n isEffectiveDateValid(\n direction,\n new Date(values.effectiveAt),\n now,\n noticeWindowDays\n ))\n\n return (\n <>\n <DialogHeader>\n <DialogTitle className=\"flex items-center gap-2\">\n <AdminMessage id={\"Change price for \"} />\n {productName}\n {draft && (\n <Badge variant=\"secondary\">\n <AdminMessage id={\"drafted by copilot\"} />\n </Badge>\n )}\n </DialogTitle>\n <DialogDescription>\n <AdminMessage id={\"Step \"} />\n {step}\n <AdminMessage id={\" of 3:\"} />{\" \"}\n {step === 1\n ? \"new amount\"\n : step === 2\n ? \"migration plan\"\n : \"review\"}\n </DialogDescription>\n </DialogHeader>\n\n {step === 1 && (\n <div className=\"grid gap-3\">\n <div className=\"grid grid-cols-2 gap-3 text-sm\">\n <div>\n <p className=\"text-xs text-muted-foreground uppercase\">\n <AdminMessage id={\"Current amount\"} />\n </p>\n <p className=\"font-medium\">\n {formatNativeAmount(\n price.unit_amount,\n price.currency\n )}\n </p>\n </div>\n <div>\n <p className=\"text-xs text-muted-foreground uppercase\">\n <AdminMessage id={\"Currency · interval\"} />\n </p>\n <p className=\"font-medium\">\n {price.currency.toUpperCase()} ·{\" \"}\n {priceIntervalLabel(price)}\n </p>\n </div>\n </div>\n <form.Field\n name=\"amountInput\"\n validators={{\n onBlur: ({ value }) => {\n const amount = nativeAmountFromInput(\n value,\n price.currency\n )\n if (amount === null || BigInt(amount) <= 0n) {\n return \"Enter an amount greater than zero.\"\n }\n return undefined\n },\n }}\n >\n {(field) => (\n <div className=\"grid gap-1.5\">\n <Label htmlFor={adminId(\"wiz-amount\")}>\n <AdminMessage id={\"New amount (major units)\"} />\n </Label>\n <Input\n id={adminId(\"wiz-amount\")}\n type=\"number\"\n step=\"any\"\n min=\"0\"\n value={field.state.value}\n onBlur={field.handleBlur}\n onChange={(event) =>\n field.handleChange(event.target.value)\n }\n autoFocus\n />\n <FormFieldErrors errors={field.state.meta.errors} />\n </div>\n )}\n </form.Field>\n {direction !== \"unchanged\" && (\n <p className=\"text-sm text-muted-foreground\">\n <AdminMessage id={\"This is a price\"} />{\" \"}\n <span className=\"font-medium text-foreground\">\n {direction === \"increase\" ? \"increase\" : \"decrease\"}\n </span>\n <AdminMessage\n id={\n \". Currency and interval stay locked to the current price.\"\n }\n />\n </p>\n )}\n </div>\n )}\n\n {step === 2 && (\n <div className=\"grid gap-3\">\n <p className=\"text-sm\">\n {affectedCount === null && previewPriceChange.isPending\n ? \"Checking affected subscribers…\"\n : `${(affectedCount ?? 0).toLocaleString()} active subscription${affectedCount === 1 ? \"\" : \"s\"} on prior versions of ${price.key}.`}\n </p>\n <form.Field name=\"mode\">\n {(field) => (\n <div className=\"grid gap-2\">\n <label className=\"flex items-start gap-2 rounded-md border p-3 text-sm\">\n <input\n type=\"radio\"\n name={field.name}\n className=\"mt-1\"\n checked={field.state.value === \"grandfather\"}\n onChange={() =>\n field.handleChange(\"grandfather\")\n }\n />\n <span>\n <span className=\"font-medium\">\n <AdminMessage id={\"Grandfather.\"} />\n </span>{\" \"}\n <AdminMessage\n id={\n \"Existing subscribers keep the current price.\"\n }\n />\n {direction === \"increase\" && (\n <Badge variant=\"secondary\" className=\"ml-2\">\n <AdminMessage id={\"default\"} />\n </Badge>\n )}\n </span>\n </label>\n <label className=\"flex items-start gap-2 rounded-md border p-3 text-sm\">\n <input\n type=\"radio\"\n name={field.name}\n className=\"mt-1\"\n checked={field.state.value === \"migrate\"}\n onChange={() => field.handleChange(\"migrate\")}\n />\n <span>\n <span className=\"font-medium\">\n <AdminMessage id={\"Migrate.\"} />\n </span>{\" \"}\n <AdminMessage\n id={\n \"Move everyone to the new price at their first renewal on or after a date you choose.\"\n }\n />\n {direction === \"decrease\" && (\n <Badge variant=\"secondary\" className=\"ml-2\">\n <AdminMessage id={\"default\"} />\n </Badge>\n )}\n </span>\n </label>\n </div>\n )}\n </form.Field>\n {values.mode === \"migrate\" && (\n <form.Field name=\"effectiveAt\">\n {(field) => (\n <div className=\"grid gap-1.5\">\n <Label htmlFor={adminId(\"wiz-effective\")}>\n <AdminMessage id={\"Effective date\"} />\n </Label>\n <Input\n id={adminId(\"wiz-effective\")}\n type=\"date\"\n value={field.state.value}\n min={\n minDate\n ? toDateInputValue(minDate)\n : undefined\n }\n onBlur={field.handleBlur}\n onChange={(event) =>\n field.handleChange(event.target.value)\n }\n />\n {direction === \"increase\" ? (\n <p className=\"text-xs text-muted-foreground\">\n <AdminMessage id={\"Must be at least \"} />\n {noticeWindowDays}\n <AdminMessage\n id={\n \" days away. Card networks require that much notice before a price goes up. You can change the number in Settings.\"\n }\n />\n </p>\n ) : (\n <p className=\"text-xs text-muted-foreground\">\n <AdminMessage\n id={\n \"A price going down needs no notice, so today is fine.\"\n }\n />\n </p>\n )}\n {!dateValid && (\n <p\n className=\"text-xs text-destructive\"\n role=\"alert\"\n >\n <AdminMessage id={\"Pick a later date.\"} />\n </p>\n )}\n <p className=\"text-xs text-muted-foreground\">\n <AdminMessage\n id={\n \"A reprice_scheduled notice is queued for every affected subscriber as soon as you confirm.\"\n }\n />\n </p>\n </div>\n )}\n </form.Field>\n )}\n </div>\n )}\n\n {step === 3 && (\n <div className=\"grid gap-3\">\n <p className=\"rounded-md border bg-muted/40 p-3 text-sm\">\n {buildReviewText({\n newAmount,\n currentAmount: price.unit_amount,\n currency: price.currency,\n affectedCount: affectedCount ?? 0,\n plan: {\n mode: values.mode,\n effectiveAt:\n values.mode === \"migrate\"\n ? new Date(values.effectiveAt).toISOString()\n : \"\",\n },\n now,\n })}\n </p>\n </div>\n )}\n\n <DialogFooter>\n {step > 1 && (\n <Button\n type=\"button\"\n variant=\"outline\"\n disabled={isSubmitting}\n onClick={() => setStep((value) => (value - 1) as 1 | 2)}\n >\n <AdminMessage id={\"Back\"} />\n </Button>\n )}\n {step === 1 && (\n <Button\n type=\"button\"\n disabled={\n !values.amountInput ||\n direction === \"unchanged\" ||\n BigInt(newAmount) <= 0n\n }\n onClick={enterStep2}\n >\n <AdminMessage id={\"Next\"} />\n </Button>\n )}\n {step === 2 && (\n <Button\n type=\"button\"\n disabled={!dateValid || previewPriceChange.isPending}\n onClick={() => setStep(3)}\n >\n <AdminMessage id={\"Next\"} />\n </Button>\n )}\n {step === 3 && (\n <Button type=\"submit\" disabled={isSubmitting}>\n {isSubmitting ? \"Working…\" : \"Confirm\"}\n </Button>\n )}\n </DialogFooter>\n </>\n )\n }}\n </form.Subscribe>\n </form>\n </DialogContent>\n </Dialog>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAKA,SAAgB,EACd,GACA,GACgB;CAChB,IAAM,IAAO,OAAO,CAAS,GACvB,IAAU,OAAO,CAAa;CAGpC,OAFI,IAAO,IAAgB,aACvB,IAAO,IAAgB,aACpB;AACT;AAYA,SAAgB,EAAqB,GAA0C;CAC7E,OAAO,MAAc,aAAa,YAAY;AAChD;AAIA,SAAgB,EACd,GACA,GACA,GACa;CACb,IAAI,MAAc,YAAY,OAAO;CACrC,IAAM,IAAM,IAAI,KAAK,CAAG;CAExB,OADA,EAAI,WAAW,EAAI,WAAW,IAAI,CAAgB,GAC3C;AACT;AAIA,SAAgB,EACd,GACA,GACA,GACM;CACN,OAAO,EAAiB,GAAW,GAAK,CAAgB,KAAK;AAC/D;AAIA,SAAgB,EACd,GACA,GACA,GACA,GACS;CACT,IAAM,IAAM,EAAiB,GAAW,GAAK,CAAgB;CAC7D,OAAO,CAAC,KAAO,EAAY,QAAQ,KAAK,EAAI,QAAQ;AACtD;AAQA,IAAM,KAAa,MACjB,IAAI,KAAK,CAAG,CAAC,CAAC,mBAAmB,KAAA,GAAW;CAC1C,OAAO;CACP,KAAK;CACL,MAAM;AACR,CAAC;AAKH,SAAgB,EAAgB,GAOrB;CACT,IAAM,EAAE,cAAW,kBAAe,aAAU,kBAAe,SAAM,WAC/D,GACI,IAAW,EAAmB,GAAW,CAAQ,GACjD,IAAW,EAAmB,GAAe,CAAQ,GACrD,IAAO,uBAAuB,EAAS;CAE7C,IAAI,MAAkB,GACpB,OAAO,GAAG,EAAK;CAEjB,IAAM,IAAO,GAAG,EAAc,eAAe,EAAE,sBAAsB,MAAkB,IAAI,KAAK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