@openrails/billing-ui 0.255.0 → 0.256.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/README.md +6 -5
- package/dist/account/cancel-dialog.d.ts +2 -2
- package/dist/account/subscriptions-panel.d.ts +1 -2
- package/dist/admin/lib/api/types.d.ts +1 -1
- package/dist/admin/messages.d.ts +8 -5
- package/dist/admin/pages/catalog/price-format.d.ts +3 -1
- package/dist/admin/pages/catalog/psp-links.d.ts +1 -1
- package/dist/{admin-catalog-rrFZd5N8.js → admin-catalog-C0QRANp7.js} +8 -11
- package/dist/{admin-catalog-rrFZd5N8.js.map → admin-catalog-C0QRANp7.js.map} +1 -1
- package/dist/{admin-detail-Cq59e14B.js → admin-detail-qetSqVDt.js} +2 -2
- package/dist/{admin-detail-Cq59e14B.js.map → admin-detail-qetSqVDt.js.map} +1 -1
- package/dist/{admin-price-detail-Bwk9PXHP.js → admin-price-detail-C9CJwLeM.js} +101 -128
- package/dist/admin-price-detail-C9CJwLeM.js.map +1 -0
- package/dist/{admin-price-format-DM1qORWI.js → admin-price-format-BVUpDoSC.js} +5 -1
- package/dist/admin-price-format-BVUpDoSC.js.map +1 -0
- package/dist/{admin-price-wizard-ByD7j8mB.js → admin-price-wizard-DAkDGWkH.js} +123 -124
- package/dist/admin-price-wizard-DAkDGWkH.js.map +1 -0
- package/dist/admin.css +1 -1
- package/dist/admin.js +13 -10
- package/dist/admin.js.map +1 -1
- package/dist/client/client.d.ts +4 -4
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/routes.d.ts +29 -12
- package/dist/client/generated/wire.d.ts +62 -21
- package/dist/client/types.d.ts +119 -20
- package/dist/{client-B301IAQD.js → client-Bs2YY-PV.js} +19 -3
- package/dist/client-Bs2YY-PV.js.map +1 -0
- package/dist/client.js +1 -1
- package/dist/{hooks-DARbMTwv.js → hooks-CCA-6uEa.js} +134 -123
- package/dist/{hooks-DARbMTwv.js.map → hooks-CCA-6uEa.js.map} +1 -1
- package/dist/index.js +729 -716
- package/dist/index.js.map +1 -1
- package/dist/locales/de.js +1 -0
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.d.ts +1 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +1 -0
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +1 -0
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +1 -0
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +1 -0
- package/dist/locales/zh.js.map +1 -1
- package/dist/react/hooks.d.ts +3 -4
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/admin-price-detail-Bwk9PXHP.js.map +0 -1
- package/dist/admin-price-format-DM1qORWI.js.map +0 -1
- package/dist/admin-price-wizard-ByD7j8mB.js.map +0 -1
- package/dist/client-B301IAQD.js.map +0 -1
|
@@ -5,9 +5,9 @@ import { o as c, u as l } from "./admin-format-DoohJ7Fg.js";
|
|
|
5
5
|
import { n as u } from "./admin-confirm-katGq0Qo.js";
|
|
6
6
|
import { a as d, n as f, o as p, r as m, s as h, t as g } from "./admin-table-CWhiCb9d.js";
|
|
7
7
|
import { t as _ } from "./admin-badge-VCGbnfiN.js";
|
|
8
|
-
import { n as v, t as y } from "./admin-price-format-
|
|
8
|
+
import { n as v, t as y } from "./admin-price-format-BVUpDoSC.js";
|
|
9
9
|
import { a as b, i as x, o as S, r as C, t as w } from "./admin-card-DGbi6ZHZ.js";
|
|
10
|
-
import { t as T } from "./admin-price-wizard-
|
|
10
|
+
import { t as T } from "./admin-price-wizard-DAkDGWkH.js";
|
|
11
11
|
import { t as E } from "./admin-fact-card-D6mZgxpN.js";
|
|
12
12
|
import * as D from "react";
|
|
13
13
|
import { useMutation as O, useQuery as k, useQueryClient as A } from "@tanstack/react-query";
|
|
@@ -20,7 +20,10 @@ var I = {
|
|
|
20
20
|
ambiguous_selector: "More than one provider on this rail is set up. Name the provider rather than the rail.",
|
|
21
21
|
not_armed: "This provider is not set up here, or it was archived.",
|
|
22
22
|
credentials_missing: "The provider is set up, but the credentials it needs are missing.",
|
|
23
|
-
link_missing: "This
|
|
23
|
+
link_missing: "This provider has nothing to sell this price on: a CCBill FlexForm, or a published Solana plan.",
|
|
24
|
+
not_sold_via: "The price is not sold this way: its sell_via leaves this method out.",
|
|
25
|
+
not_a_charge_psp: "New card charges go to the merchant's charge PSPs; this provider is not one.",
|
|
26
|
+
provider_price: "A provider price sells only through its own provider, and only CCBill still sells new ones.",
|
|
24
27
|
mode_unsupported: "This provider cannot take this kind of payment (one-off or recurring).",
|
|
25
28
|
posture_disarmed: "The provider's credentials failed their test-mode check, so it is switched off.",
|
|
26
29
|
service_unavailable: "The connection to this provider is not running.",
|
|
@@ -30,7 +33,10 @@ var I = {
|
|
|
30
33
|
ambiguous_selector: "more than one match",
|
|
31
34
|
not_armed: "not set up",
|
|
32
35
|
credentials_missing: "credentials missing",
|
|
33
|
-
link_missing: "
|
|
36
|
+
link_missing: "nothing to sell on",
|
|
37
|
+
not_sold_via: "not sold this way",
|
|
38
|
+
not_a_charge_psp: "not a charge PSP",
|
|
39
|
+
provider_price: "provider's price",
|
|
34
40
|
mode_unsupported: "cannot take this payment",
|
|
35
41
|
posture_disarmed: "credentials failed check",
|
|
36
42
|
service_unavailable: "connection not running",
|
|
@@ -44,147 +50,114 @@ function z(e) {
|
|
|
44
50
|
}
|
|
45
51
|
var B = "bg-settled-surface text-settled", V = "bg-held-surface text-held", H = "bg-failed-surface text-failed";
|
|
46
52
|
function U(e) {
|
|
47
|
-
return e === "linked" ? B : e === "error" ? H : V;
|
|
48
|
-
}
|
|
49
|
-
function W(e) {
|
|
50
53
|
switch (e) {
|
|
51
54
|
case "in_sync": return B;
|
|
52
55
|
case "drifted":
|
|
53
56
|
case "missing": return H;
|
|
54
|
-
case "never_synced":
|
|
55
57
|
case "sync_disabled": return V;
|
|
56
58
|
default: return "";
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
|
-
var
|
|
61
|
+
var W = [
|
|
62
|
+
"plan_id",
|
|
60
63
|
"price_id",
|
|
61
64
|
"product_id",
|
|
62
|
-
"plan_id",
|
|
63
65
|
"flex_id",
|
|
64
|
-
"recurring_billing_option_id"
|
|
65
|
-
"lookup_key",
|
|
66
|
-
"provider"
|
|
66
|
+
"recurring_billing_option_id"
|
|
67
67
|
];
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}), t;
|
|
68
|
+
function G(e) {
|
|
69
|
+
return Object.entries(e ?? {}).filter(([, e]) => e !== "").sort(([e], [t]) => {
|
|
70
|
+
let n = W.indexOf(e), r = W.indexOf(t);
|
|
71
|
+
return (n < 0 ? W.length : n) - (r < 0 ? W.length : r) || e.localeCompare(t);
|
|
72
|
+
});
|
|
74
73
|
}
|
|
75
|
-
function
|
|
76
|
-
let i =
|
|
77
|
-
return /* @__PURE__ */ N(w, { children: [/* @__PURE__ */ N(b, {
|
|
74
|
+
function K({ price: e, verifying: t, verified: n, onVerify: r }) {
|
|
75
|
+
let i = e.provider;
|
|
76
|
+
return i ? /* @__PURE__ */ N(w, { children: [/* @__PURE__ */ N(b, {
|
|
78
77
|
className: "flex flex-row items-start justify-between gap-2",
|
|
79
78
|
children: [/* @__PURE__ */ N("div", {
|
|
80
79
|
className: "grid gap-1",
|
|
81
80
|
children: [/* @__PURE__ */ M(S, {
|
|
82
81
|
className: "text-sm",
|
|
83
|
-
children: /* @__PURE__ */ M(a, { id: "
|
|
84
|
-
}), /* @__PURE__ */ M(x, { children: /* @__PURE__ */ M(a, { id: "
|
|
82
|
+
children: /* @__PURE__ */ M(a, { id: "Owned by its provider" })
|
|
83
|
+
}), /* @__PURE__ */ M(x, { children: /* @__PURE__ */ M(a, { id: "The provider owns and runs this price; OpenRails read its terms and never writes it. Verify asks the provider what it holds now, and changes nothing." }) })]
|
|
85
84
|
}), /* @__PURE__ */ M(o, {
|
|
86
85
|
variant: "outline",
|
|
87
86
|
size: "sm",
|
|
88
|
-
disabled: t
|
|
87
|
+
disabled: t,
|
|
89
88
|
onClick: r,
|
|
90
89
|
children: t ? "Verifying…" : "Verify"
|
|
91
90
|
})]
|
|
92
|
-
}), /* @__PURE__ */
|
|
93
|
-
className: "
|
|
94
|
-
children: [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
className: "
|
|
99
|
-
children:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
children: /* @__PURE__ */ M(a, { id: "Their reference" })
|
|
119
|
-
})
|
|
120
|
-
]
|
|
121
|
-
}) }), /* @__PURE__ */ M(f, { children: i.map(([e, t]) => /* @__PURE__ */ N(h, { children: [
|
|
122
|
-
/* @__PURE__ */ M(m, {
|
|
123
|
-
className: "font-mono text-xs",
|
|
124
|
-
children: e
|
|
125
|
-
}),
|
|
126
|
-
/* @__PURE__ */ M(m, {
|
|
127
|
-
className: "text-xs",
|
|
128
|
-
children: t.ids?.rail ?? "—"
|
|
129
|
-
}),
|
|
130
|
-
/* @__PURE__ */ N(m, { children: [/* @__PURE__ */ M(_, {
|
|
131
|
-
variant: "secondary",
|
|
132
|
-
className: U(t.status),
|
|
133
|
-
children: t.status
|
|
134
|
-
}), t.message && /* @__PURE__ */ M("p", {
|
|
135
|
-
className: "mt-1 max-w-xs text-xs text-muted-foreground",
|
|
136
|
-
children: t.message
|
|
137
|
-
})] }),
|
|
138
|
-
/* @__PURE__ */ N(m, { children: [/* @__PURE__ */ M(_, {
|
|
139
|
-
variant: "secondary",
|
|
140
|
-
className: W(t.sync_status),
|
|
141
|
-
children: t.sync_status ?? "unknown"
|
|
142
|
-
}), t.drift?.map((e) => /* @__PURE__ */ N("p", {
|
|
143
|
-
className: "mt-1 text-xs text-muted-foreground",
|
|
144
|
-
children: [
|
|
145
|
-
e.field,
|
|
146
|
-
/* @__PURE__ */ M(a, { id: ": yours " }),
|
|
147
|
-
e.openrails_value,
|
|
148
|
-
/* @__PURE__ */ M(a, { id: " · theirs" }),
|
|
149
|
-
" ",
|
|
150
|
-
e.remote_value
|
|
151
|
-
]
|
|
152
|
-
}, e.field))] }),
|
|
153
|
-
/* @__PURE__ */ M(m, {
|
|
154
|
-
className: "font-mono text-xs",
|
|
155
|
-
children: K(t.ids).length ? /* @__PURE__ */ M("div", {
|
|
156
|
-
className: "grid gap-0.5",
|
|
157
|
-
children: K(t.ids).map(([e, t]) => /* @__PURE__ */ N("span", { children: [
|
|
158
|
-
e,
|
|
159
|
-
"=",
|
|
160
|
-
t
|
|
161
|
-
] }, e))
|
|
162
|
-
}) : "—"
|
|
163
|
-
})
|
|
164
|
-
] }, e)) })] })
|
|
165
|
-
}) : /* @__PURE__ */ M("p", {
|
|
166
|
-
className: "text-sm text-muted-foreground",
|
|
167
|
-
children: /* @__PURE__ */ M(a, { id: "This price has not been sent to any provider, so nobody can be charged for it yet." })
|
|
91
|
+
}), /* @__PURE__ */ M(C, {
|
|
92
|
+
className: "overflow-x-auto",
|
|
93
|
+
children: /* @__PURE__ */ N(g, { children: [/* @__PURE__ */ M(p, { children: /* @__PURE__ */ N(h, {
|
|
94
|
+
className: "hover:bg-transparent",
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ M(d, {
|
|
97
|
+
className: "text-muted-foreground",
|
|
98
|
+
children: /* @__PURE__ */ M(a, { id: "Provider" })
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ M(d, {
|
|
101
|
+
className: "text-muted-foreground",
|
|
102
|
+
children: /* @__PURE__ */ M(a, { id: "Rail" })
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ M(d, {
|
|
105
|
+
className: "text-muted-foreground",
|
|
106
|
+
children: /* @__PURE__ */ M(a, { id: "Still matches" })
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ M(d, {
|
|
109
|
+
className: "text-muted-foreground",
|
|
110
|
+
children: /* @__PURE__ */ M(a, { id: "Their reference" })
|
|
111
|
+
})
|
|
112
|
+
]
|
|
113
|
+
}) }), /* @__PURE__ */ M(f, { children: /* @__PURE__ */ N(h, { children: [
|
|
114
|
+
/* @__PURE__ */ M(m, {
|
|
115
|
+
className: "font-mono text-xs",
|
|
116
|
+
children: i.psp
|
|
168
117
|
}),
|
|
169
|
-
|
|
170
|
-
className: "
|
|
171
|
-
children:
|
|
172
|
-
/* @__PURE__ */ M("span", {
|
|
173
|
-
className: "font-mono",
|
|
174
|
-
children: e.psp
|
|
175
|
-
}),
|
|
176
|
-
": ",
|
|
177
|
-
e.hint || e.action
|
|
178
|
-
] }, `${e.psp}-${e.action}`))
|
|
118
|
+
/* @__PURE__ */ M(m, {
|
|
119
|
+
className: "text-xs",
|
|
120
|
+
children: i.rail
|
|
179
121
|
}),
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
122
|
+
/* @__PURE__ */ N(m, { children: [/* @__PURE__ */ M(_, {
|
|
123
|
+
variant: "secondary",
|
|
124
|
+
className: U(i.sync_status),
|
|
125
|
+
children: n ? i.sync_status : "unknown"
|
|
126
|
+
}), i.drift?.map((e) => /* @__PURE__ */ N("p", {
|
|
127
|
+
className: "mt-1 text-xs text-muted-foreground",
|
|
128
|
+
children: [
|
|
129
|
+
e.field,
|
|
130
|
+
/* @__PURE__ */ M(a, { id: ": yours " }),
|
|
131
|
+
e.openrails_value,
|
|
132
|
+
/* @__PURE__ */ M(a, { id: " · theirs" }),
|
|
133
|
+
" ",
|
|
134
|
+
e.remote_value
|
|
135
|
+
]
|
|
136
|
+
}, e.field))] }),
|
|
137
|
+
/* @__PURE__ */ M(m, {
|
|
138
|
+
className: "font-mono text-xs",
|
|
139
|
+
children: /* @__PURE__ */ M("div", {
|
|
140
|
+
className: "grid gap-0.5",
|
|
141
|
+
children: G(i.ids).map(([e, t]) => /* @__PURE__ */ N("span", { children: [
|
|
142
|
+
e,
|
|
143
|
+
"=",
|
|
144
|
+
t
|
|
145
|
+
] }, e))
|
|
146
|
+
})
|
|
183
147
|
})
|
|
184
|
-
]
|
|
148
|
+
] }) })] })
|
|
149
|
+
})] }) : /* @__PURE__ */ N(w, { children: [/* @__PURE__ */ N(b, { children: [/* @__PURE__ */ M(S, {
|
|
150
|
+
className: "text-sm",
|
|
151
|
+
children: /* @__PURE__ */ M(a, { id: "Sold by OpenRails" })
|
|
152
|
+
}), /* @__PURE__ */ M(x, { children: /* @__PURE__ */ M(a, { id: "OpenRails bills this price through your card vault and charge PSPs, and on Solana. Provider catalogs are not synchronized. Hosted one-time Stripe payments use inline checkout objects." }) })] }), /* @__PURE__ */ N(C, {
|
|
153
|
+
className: "grid gap-1 text-sm",
|
|
154
|
+
children: [/* @__PURE__ */ N("p", { children: [/* @__PURE__ */ M(a, { id: "Sold via: " }), e.sell_via?.length ? e.sell_via.join(", ") : /* @__PURE__ */ M(a, { id: "every method you have" })] }), e.solana_plan && /* @__PURE__ */ N("p", {
|
|
155
|
+
className: "font-mono text-xs",
|
|
156
|
+
children: [/* @__PURE__ */ M(a, { id: "Solana plan " }), e.solana_plan]
|
|
157
|
+
})]
|
|
185
158
|
})] });
|
|
186
159
|
}
|
|
187
|
-
function
|
|
160
|
+
function q({ price: e }) {
|
|
188
161
|
let { adminQueries: t } = n(), { data: r, isFetching: i, refetch: s } = k(t.pspRouting(e.id)), c = r?.candidates.filter((e) => !e.skip) ?? [];
|
|
189
162
|
return /* @__PURE__ */ N(w, { children: [/* @__PURE__ */ N(b, {
|
|
190
163
|
className: "flex flex-row items-start justify-between gap-2",
|
|
@@ -281,7 +254,7 @@ function J({ price: e }) {
|
|
|
281
254
|
}
|
|
282
255
|
//#endregion
|
|
283
256
|
//#region src/admin/pages/catalog/price-detail.tsx
|
|
284
|
-
function
|
|
257
|
+
function J(e) {
|
|
285
258
|
let t = e.replace(/\/+$/, "").split("/").at(-1) ?? "";
|
|
286
259
|
try {
|
|
287
260
|
return decodeURIComponent(t);
|
|
@@ -289,8 +262,8 @@ function Y(e) {
|
|
|
289
262
|
return "";
|
|
290
263
|
}
|
|
291
264
|
}
|
|
292
|
-
function
|
|
293
|
-
let { text: u } = e(), { adminQueries: x } = n(), O =
|
|
265
|
+
function Y() {
|
|
266
|
+
let { text: u } = e(), { adminQueries: x } = n(), O = J(t().pathname), A = s(), j = i(), [I, L] = D.useState(!1), { data: R, isPending: z, isFetching: B, refetch: V } = k(x.price(O, {
|
|
294
267
|
verify: I,
|
|
295
268
|
errorAction: "Load price"
|
|
296
269
|
})), { data: H } = k(x.product(R?.product_id)), { data: U } = k(x.priceHistory(R?.id)), { data: W } = k(x.priceMigrations(H?.key, R?.key)), G = W?.data?.[0];
|
|
@@ -303,7 +276,7 @@ function X() {
|
|
|
303
276
|
className: "text-sm text-muted-foreground",
|
|
304
277
|
children: z ? "Loading…" : "Price not found."
|
|
305
278
|
});
|
|
306
|
-
let
|
|
279
|
+
let Y = !!G && G.scheduled > 0;
|
|
307
280
|
return /* @__PURE__ */ N("div", {
|
|
308
281
|
className: "flex flex-col gap-4",
|
|
309
282
|
children: [
|
|
@@ -332,7 +305,7 @@ function X() {
|
|
|
332
305
|
})] }),
|
|
333
306
|
/* @__PURE__ */ M("div", {
|
|
334
307
|
className: "ml-auto",
|
|
335
|
-
children: A && /* @__PURE__ */ M(T, {
|
|
308
|
+
children: A && !R.provider && /* @__PURE__ */ M(T, {
|
|
336
309
|
price: R,
|
|
337
310
|
productName: H?.display_name ?? "…",
|
|
338
311
|
productKey: H?.key
|
|
@@ -369,13 +342,13 @@ function X() {
|
|
|
369
342
|
})
|
|
370
343
|
]
|
|
371
344
|
}),
|
|
372
|
-
/* @__PURE__ */ M(
|
|
345
|
+
/* @__PURE__ */ M(K, {
|
|
373
346
|
price: R,
|
|
374
347
|
verifying: I && B,
|
|
375
348
|
verified: I,
|
|
376
349
|
onVerify: () => I ? void V() : L(!0)
|
|
377
350
|
}),
|
|
378
|
-
/* @__PURE__ */ M(
|
|
351
|
+
/* @__PURE__ */ M(q, { price: R }),
|
|
379
352
|
/* @__PURE__ */ N(w, { children: [/* @__PURE__ */ M(b, { children: /* @__PURE__ */ M(S, {
|
|
380
353
|
className: "text-sm",
|
|
381
354
|
children: /* @__PURE__ */ M(a, { id: "Price history" })
|
|
@@ -423,8 +396,8 @@ function X() {
|
|
|
423
396
|
className: "flex flex-row items-center justify-between gap-2",
|
|
424
397
|
children: [/* @__PURE__ */ M(S, {
|
|
425
398
|
className: "text-sm",
|
|
426
|
-
children:
|
|
427
|
-
}),
|
|
399
|
+
children: Y ? "Moving customers to the new price" : "Last move to a new price"
|
|
400
|
+
}), Y && /* @__PURE__ */ M(X, { migrationId: G.id })]
|
|
428
401
|
}), /* @__PURE__ */ N(C, {
|
|
429
402
|
className: "flex flex-col gap-2 text-sm",
|
|
430
403
|
children: [/* @__PURE__ */ N("p", { children: [
|
|
@@ -450,7 +423,7 @@ function X() {
|
|
|
450
423
|
]
|
|
451
424
|
});
|
|
452
425
|
}
|
|
453
|
-
function
|
|
426
|
+
function X({ migrationId: e }) {
|
|
454
427
|
let { toast: t, toastApiError: r, adminMutations: i } = n(), a = A(), s = O(i.cancelPriceMigration(a)), c = u();
|
|
455
428
|
return /* @__PURE__ */ M(o, {
|
|
456
429
|
variant: "destructive",
|
|
@@ -476,6 +449,6 @@ function Z({ migrationId: e }) {
|
|
|
476
449
|
});
|
|
477
450
|
}
|
|
478
451
|
//#endregion
|
|
479
|
-
export {
|
|
452
|
+
export { Y as PriceDetailPage };
|
|
480
453
|
|
|
481
|
-
//# sourceMappingURL=admin-price-detail-
|
|
454
|
+
//# sourceMappingURL=admin-price-detail-C9CJwLeM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-price-detail-C9CJwLeM.js","names":[],"sources":["../src/admin/pages/catalog/psp-links.tsx","../src/admin/pages/catalog/price-detail.tsx"],"sourcesContent":["import { AdminMessage } from \"#orck/admin/ui-context\"\nimport { useAdminServices } from \"#orck/admin/context\"\nimport { useQuery } from \"@tanstack/react-query\"\n\nimport { Badge } from \"#orck/admin/components/ui/badge\"\nimport { Button } from \"#orck/admin/components/ui/button\"\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from \"#orck/admin/components/ui/card\"\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"#orck/admin/components/ui/table\"\nimport type { PSPRoutingSkip } from \"#orck/admin/lib/api/types\"\nimport type { Price } from \"#orck/client/generated/wire\"\n\n// A price is ours (OpenRails bills it, by card through the merchant's card\n// vault and charge PSPs, and on Solana) or a provider's (the provider owns\n// and runs it; OpenRails reads its terms). This surface reports which, and\n// never edits a provider. It answers two questions:\n// - Ownership (`price.provider`): who runs the billing, and does a provider\n// price's provider still state the same terms?\n// - Purchase readiness (the routing preview): would a real purchase land\n// here now?\n\n// SKIP_LABELS renders the routing skip vocabulary for operators. Keep the keys\n// in lockstep with internal/db/models/order_attempt.go.\nconst SKIP_LABELS: Record<PSPRoutingSkip, string> = {\n unknown_selector: \"That name matches no provider you have set up.\",\n ambiguous_selector:\n \"More than one provider on this rail is set up. Name the provider rather than the rail.\",\n not_armed: \"This provider is not set up here, or it was archived.\",\n credentials_missing:\n \"The provider is set up, but the credentials it needs are missing.\",\n link_missing:\n \"This provider has nothing to sell this price on: a CCBill FlexForm, or a published Solana plan.\",\n not_sold_via: \"The price is not sold this way: its sell_via leaves this method out.\",\n not_a_charge_psp:\n \"New card charges go to the merchant's charge PSPs; this provider is not one.\",\n provider_price:\n \"A provider price sells only through its own provider, and only CCBill still sells new ones.\",\n mode_unsupported:\n \"This provider cannot take this kind of payment (one-off or recurring).\",\n posture_disarmed:\n \"The provider's credentials failed their test-mode check, so it is switched off.\",\n service_unavailable: \"The connection to this provider is not running.\",\n resolve_failed: \"The provider could not be worked out at the time of asking.\",\n}\n\n// The engine names each outcome for its own logs. These are the same outcomes\n// as a sentence you can act on.\nconst SKIP_HEADLINES: Record<PSPRoutingSkip, string> = {\n unknown_selector: \"unknown provider\",\n ambiguous_selector: \"more than one match\",\n not_armed: \"not set up\",\n credentials_missing: \"credentials missing\",\n link_missing: \"nothing to sell on\",\n not_sold_via: \"not sold this way\",\n not_a_charge_psp: \"not a charge PSP\",\n provider_price: \"provider's price\",\n mode_unsupported: \"cannot take this payment\",\n posture_disarmed: \"credentials failed check\",\n service_unavailable: \"connection not running\",\n resolve_failed: \"could not be worked out\",\n}\n\nfunction skipHeadline(skip?: string | null): string {\n if (!skip) return \"ready\"\n return SKIP_HEADLINES[skip as PSPRoutingSkip] ?? skip\n}\n\nfunction skipLabel(skip?: string | null) {\n if (!skip) return \"\"\n return SKIP_LABELS[skip as PSPRoutingSkip] ?? skip\n}\n\nconst OK_BADGE = \"bg-settled-surface text-settled\"\nconst WARN_BADGE = \"bg-held-surface text-held\"\nconst BAD_BADGE = \"bg-failed-surface text-failed\"\n\n// syncStatusClass leaves \"unknown\" neutral, not a warning: nobody has checked\n// yet.\nfunction syncStatusClass(sync?: string) {\n switch (sync) {\n case \"in_sync\":\n return OK_BADGE\n case \"drifted\":\n case \"missing\":\n return BAD_BADGE\n case \"sync_disabled\":\n return WARN_BADGE\n default:\n return \"\"\n }\n}\n\nconst ID_ORDER = [\n \"plan_id\",\n \"price_id\",\n \"product_id\",\n \"flex_id\",\n \"recurring_billing_option_id\",\n]\n\nfunction providerIDs(ids?: Record<string, string> | null) {\n return Object.entries(ids ?? {})\n .filter(([, v]) => v !== \"\")\n .sort(([a], [b]) => {\n const ia = ID_ORDER.indexOf(a)\n const ib = ID_ORDER.indexOf(b)\n return (\n (ia < 0 ? ID_ORDER.length : ia) - (ib < 0 ? ID_ORDER.length : ib) ||\n a.localeCompare(b)\n )\n })\n}\n\n// PriceOwnerCard shows who runs the price's billing: OpenRails, through the\n// methods it sells by, or the provider that owns it, whose terms Verify reads\n// again.\nexport function PriceOwnerCard({\n price,\n verifying,\n verified,\n onVerify,\n}: {\n price: Price\n verifying: boolean\n verified: boolean\n onVerify: () => void\n}) {\n const provider = price.provider\n if (!provider)\n return (\n <Card>\n <CardHeader>\n <CardTitle className=\"text-sm\">\n <AdminMessage id={\"Sold by OpenRails\"} />\n </CardTitle>\n <CardDescription>\n <AdminMessage\n id={\n \"OpenRails bills this price through your card vault and charge PSPs, and on Solana. Provider catalogs are not synchronized. Hosted one-time Stripe payments use inline checkout objects.\"\n }\n />\n </CardDescription>\n </CardHeader>\n <CardContent className=\"grid gap-1 text-sm\">\n <p>\n <AdminMessage id={\"Sold via: \"} />\n {price.sell_via?.length ? (\n price.sell_via.join(\", \")\n ) : (\n <AdminMessage id={\"every method you have\"} />\n )}\n </p>\n {price.solana_plan && (\n <p className=\"font-mono text-xs\">\n <AdminMessage id={\"Solana plan \"} />\n {price.solana_plan}\n </p>\n )}\n </CardContent>\n </Card>\n )\n return (\n <Card>\n <CardHeader className=\"flex flex-row items-start justify-between gap-2\">\n <div className=\"grid gap-1\">\n <CardTitle className=\"text-sm\">\n <AdminMessage id={\"Owned by its provider\"} />\n </CardTitle>\n <CardDescription>\n <AdminMessage\n id={\n \"The provider owns and runs this price; OpenRails read its terms and never writes it. Verify asks the provider what it holds now, and changes nothing.\"\n }\n />\n </CardDescription>\n </div>\n <Button variant=\"outline\" size=\"sm\" disabled={verifying} onClick={onVerify}>\n {verifying ? \"Verifying…\" : \"Verify\"}\n </Button>\n </CardHeader>\n <CardContent className=\"overflow-x-auto\">\n <Table>\n <TableHeader>\n <TableRow className=\"hover:bg-transparent\">\n <TableHead className=\"text-muted-foreground\">\n <AdminMessage id={\"Provider\"} />\n </TableHead>\n <TableHead className=\"text-muted-foreground\">\n <AdminMessage id={\"Rail\"} />\n </TableHead>\n <TableHead className=\"text-muted-foreground\">\n <AdminMessage id={\"Still matches\"} />\n </TableHead>\n <TableHead className=\"text-muted-foreground\">\n <AdminMessage id={\"Their reference\"} />\n </TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>\n <TableRow>\n <TableCell className=\"font-mono text-xs\">{provider.psp}</TableCell>\n <TableCell className=\"text-xs\">{provider.rail}</TableCell>\n <TableCell>\n <Badge\n variant=\"secondary\"\n className={syncStatusClass(provider.sync_status)}\n >\n {verified ? provider.sync_status : \"unknown\"}\n </Badge>\n {provider.drift?.map((d) => (\n <p key={d.field} className=\"mt-1 text-xs text-muted-foreground\">\n {d.field}\n <AdminMessage id={\": yours \"} />\n {d.openrails_value}\n <AdminMessage id={\" · theirs\"} /> {d.remote_value}\n </p>\n ))}\n </TableCell>\n <TableCell className=\"font-mono text-xs\">\n <div className=\"grid gap-0.5\">\n {providerIDs(provider.ids).map(([k, v]) => (\n <span key={k}>\n {k}={v}\n </span>\n ))}\n </div>\n </TableCell>\n </TableRow>\n </TableBody>\n </Table>\n </CardContent>\n </Card>\n )\n}\n\n// PSPReadinessCard answers \"can someone buy this right now, and if not,\n// why?\" with the routing preview, so the console and purchase never disagree.\nexport function PSPReadinessCard({ price }: { price: Price }) {\n const { adminQueries } = useAdminServices()\n\n const {\n data: decision,\n isFetching: busy,\n refetch: reload,\n } = useQuery(adminQueries.pspRouting(price.id))\n\n const eligible = decision?.candidates.filter((c) => !c.skip) ?? []\n\n return (\n <Card>\n <CardHeader className=\"flex flex-row items-start justify-between gap-2\">\n <div className=\"grid gap-1\">\n <CardTitle className=\"text-sm\">\n <AdminMessage id={\"Can this be bought?\"} />\n </CardTitle>\n <CardDescription>\n <AdminMessage\n id={\n \"Which provider would take the money if someone bought this right now, and why the others were passed over. This asks the same question a real purchase asks, without starting one.\"\n }\n />\n </CardDescription>\n </div>\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={busy}\n onClick={() => void reload()}\n >\n {busy ? \"Checking…\" : \"Re-check\"}\n </Button>\n </CardHeader>\n <CardContent className=\"flex flex-col gap-3\">\n {!decision ? (\n <p className=\"text-sm text-muted-foreground\">\n {busy ? \"Checking…\" : \"This check could not be run.\"}\n </p>\n ) : (\n <>\n <p className=\"text-sm\">\n {decision.psp ? (\n <>\n <AdminMessage id={\"Money for this price would go to\"} />{\" \"}\n <span className=\"font-medium\">{decision.psp}</span>\n {decision.rail && (\n <>\n <AdminMessage id={\" on \"} />\n {decision.rail}\n </>\n )}\n .\n </>\n ) : (\n <span className=\"text-held\">\n <AdminMessage\n id={\n \"No provider can take this payment, so nobody can buy this price yet.\"\n }\n />\n </span>\n )}\n </p>\n {!decision.candidates.length ? (\n <p className=\"text-sm text-muted-foreground\">\n <AdminMessage id={\"There were no providers to consider.\"} />\n </p>\n ) : (\n <div className=\"overflow-x-auto\">\n <Table>\n <TableHeader>\n <TableRow className=\"hover:bg-transparent\">\n <TableHead className=\"text-muted-foreground\">\n <AdminMessage id={\"Provider\"} />\n </TableHead>\n <TableHead className=\"text-muted-foreground\">\n <AdminMessage id={\"Rail\"} />\n </TableHead>\n <TableHead className=\"text-muted-foreground\">\n <AdminMessage id={\"Outcome\"} />\n </TableHead>\n <TableHead className=\"text-muted-foreground\">\n <AdminMessage id={\"Why\"} />\n </TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>\n {decision.candidates.map((c) => (\n <TableRow key={c.psp}>\n <TableCell className=\"font-mono text-xs\">\n {c.psp}\n {c.psp === decision.psp && (\n <Badge\n variant=\"secondary\"\n className={`ml-2 ${OK_BADGE}`}\n >\n <AdminMessage id={\"selected\"} />\n </Badge>\n )}\n </TableCell>\n <TableCell className=\"text-xs\">\n {c.rail || \"—\"}\n </TableCell>\n <TableCell>\n <Badge\n variant=\"secondary\"\n className={c.skip ? WARN_BADGE : OK_BADGE}\n >\n {skipHeadline(c.skip)}\n </Badge>\n </TableCell>\n <TableCell className=\"text-xs text-muted-foreground\">\n {skipLabel(c.skip)}\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </div>\n )}\n {!!decision.candidates.length && eligible.length === 0 && (\n <p className=\"text-xs text-muted-foreground\">\n <AdminMessage\n id={\n '\"Not sent to provider\" is fixed by publishing the catalog. Everything else is fixed under Settings, Payment providers.'\n }\n />\n </p>\n )}\n </>\n )}\n </CardContent>\n </Card>\n )\n}\n","import { AdminMessage, useAdminUI } from \"#orck/admin/ui-context\"\nimport { useAdminServices } from \"#orck/admin/context\"\nimport { HugeiconsIcon } from \"@hugeicons/react\"\nimport { ArrowLeft01Icon } from \"@hugeicons/core-free-icons\"\nimport * as React from \"react\"\nimport { Link, useLocation, useNavigate } from \"#orck/admin/router\"\n\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\"\n\nimport { Fact } from \"#orck/admin/components/fact-card\"\nimport { Badge } from \"#orck/admin/components/ui/badge\"\nimport { useConfirm } from \"#orck/admin/lib/confirm\"\nimport { Button } from \"#orck/admin/components/ui/button\"\nimport {\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n} from \"#orck/admin/components/ui/card\"\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"#orck/admin/components/ui/table\"\nimport { formatDate, shortId } from \"#orck/admin/lib/format\"\n\nimport {\n priceAmountLabel,\n priceIntervalLabel,\n} from \"#orck/admin/pages/catalog/price-format\"\nimport { PriceChangeWizard } from \"#orck/admin/pages/catalog/price-wizard\"\nimport {\n PSPReadinessCard,\n PriceOwnerCard,\n} from \"#orck/admin/pages/catalog/psp-links\"\nimport { useCatalogWrites } from \"#orck/admin/lib/capabilities\"\n\n// A price ID can contain its own percent-encoded key bytes. Router params\n// decode an inner %2F again; decode the original URL segment exactly once.\nfunction priceIDFromPath(pathname: string): string {\n const segment = pathname.replace(/\\/+$/, \"\").split(\"/\").at(-1) ?? \"\"\n try {\n return decodeURIComponent(segment)\n } catch {\n return \"\"\n }\n}\n\n// PriceDetailPage (#777): the version chain (from the #774 pointer-movement\n// log, with dates) and any pending scheduled migration (progress + cancel)\n// for one price key — the wizard's Step 1 entry point (\"Change price\") also\n// lives here alongside the catalog list row.\nexport function PriceDetailPage() {\n const { text: adminText } = useAdminUI()\n\n const { adminQueries } = useAdminServices()\n\n const id = priceIDFromPath(useLocation().pathname)\n const writesAllowed = useCatalogWrites()\n const navigate = useNavigate()\n // verify is opt-in: it makes GET price read a provider price's terms at its\n // provider again, a network round trip.\n const [verify, setVerify] = React.useState(false)\n const {\n data: price,\n isPending: loading,\n isFetching,\n refetch: reload,\n } = useQuery(adminQueries.price(id, { verify, errorAction: \"Load price\" }))\n const { data: product } = useQuery(adminQueries.product(price?.product_id))\n const { data: history } = useQuery(adminQueries.priceHistory(price?.id))\n const { data: migrations } = useQuery(\n adminQueries.priceMigrations(product?.key, price?.key)\n )\n const latestBatch = migrations?.data?.[0]\n\n if (!id)\n return (\n <p role=\"alert\" className=\"text-sm text-muted-foreground\">\n Invalid price URL.\n </p>\n )\n\n // Only the FIRST load blanks the page; a verify refetch keeps the rendered\n // price in place so the button can show its own in-flight state.\n if (!price)\n return (\n <p className=\"text-sm text-muted-foreground\">\n {loading ? \"Loading…\" : \"Price not found.\"}\n </p>\n )\n\n const isPending = !!latestBatch && latestBatch.scheduled > 0\n\n return (\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center gap-3\">\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => navigate(-1)}\n aria-label={adminText(\"Back\")}\n >\n <HugeiconsIcon icon={ArrowLeft01Icon} className=\"size-4\" />\n </Button>\n <div>\n <h2 className=\"flex items-center gap-2 text-sm\">\n {price.id}\n {price.archived && (\n <Badge variant=\"secondary\">\n <AdminMessage id={\"archived\"} />\n </Badge>\n )}\n </h2>\n <p className=\"text-xs text-muted-foreground\">\n {product?.display_name}\n </p>\n </div>\n <div className=\"ml-auto\">\n {writesAllowed && !price.provider && (\n <PriceChangeWizard\n price={price}\n productName={product?.display_name ?? \"…\"}\n productKey={product?.key}\n />\n )}\n </div>\n </div>\n\n <div className=\"grid gap-3 sm:grid-cols-2 lg:grid-cols-4\">\n <Fact label={adminText(\"Product\")}>\n <Link className=\"underline-offset-2 hover:underline\" to={`/catalog`}>\n {product?.display_name ?? shortId(price.product_id, 13)}\n </Link>\n </Fact>\n <Fact label={adminText(\"Amount\")}>{priceAmountLabel(price)}</Fact>\n <Fact label={adminText(\"Renews\")}>\n {price.currency.toUpperCase()} · {priceIntervalLabel(price)}\n </Fact>\n <Fact label={adminText(\"Created\")}>{formatDate(price.created_at)}</Fact>\n </div>\n\n <PriceOwnerCard\n price={price}\n verifying={verify && isFetching}\n verified={verify}\n onVerify={() => (verify ? void reload() : setVerify(true))}\n />\n\n <PSPReadinessCard price={price} />\n\n <Card>\n <CardHeader>\n <CardTitle className=\"text-sm\">\n <AdminMessage id={\"Price history\"} />\n </CardTitle>\n </CardHeader>\n <CardContent>\n {!history?.data?.length ? (\n <p className=\"text-sm text-muted-foreground\">\n <AdminMessage id={\"No history yet.\"} />\n </p>\n ) : (\n <Table>\n <TableHeader>\n <TableRow className=\"hover:bg-transparent\">\n <TableHead className=\"text-muted-foreground\">\n <AdminMessage id={\"Amount\"} />\n </TableHead>\n <TableHead className=\"text-muted-foreground\">\n <AdminMessage id={\"Since\"} />\n </TableHead>\n <TableHead className=\"text-muted-foreground\">\n <AdminMessage id={\"State\"} />\n </TableHead>\n <TableHead className=\"text-muted-foreground\">\n <AdminMessage id={\"Price\"} />\n </TableHead>\n </TableRow>\n </TableHeader>\n <TableBody>\n {history.data.map((entry) => (\n <TableRow key={`${entry.price.id}-${entry.effective_at}`}>\n <TableCell>{priceAmountLabel(entry.price)}</TableCell>\n <TableCell>{formatDate(entry.effective_at)}</TableCell>\n <TableCell>\n {entry.archived ? (\n <Badge variant=\"secondary\">\n <AdminMessage id={\"retired\"} />\n </Badge>\n ) : (\n <Badge className=\"bg-settled-surface text-settled\">\n <AdminMessage id={\"offered\"} />\n </Badge>\n )}\n </TableCell>\n <TableCell>\n <Link\n className=\"text-xs underline-offset-2 hover:underline\"\n to={`/catalog/prices/${encodeURIComponent(entry.price.id)}`}\n title={entry.price.id}\n >\n {entry.price.id}\n </Link>\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n )}\n </CardContent>\n </Card>\n\n {latestBatch && (\n <Card>\n <CardHeader className=\"flex flex-row items-center justify-between gap-2\">\n <CardTitle className=\"text-sm\">\n {isPending\n ? \"Moving customers to the new price\"\n : \"Last move to a new price\"}\n </CardTitle>\n {isPending && (\n <CancelMigrationButton migrationId={latestBatch.id} />\n )}\n </CardHeader>\n <CardContent className=\"flex flex-col gap-2 text-sm\">\n <p>\n {latestBatch.applied}\n <AdminMessage id={\" of\"} />{\" \"}\n {latestBatch.applied +\n latestBatch.scheduled +\n latestBatch.canceled}{\" \"}\n <AdminMessage id={\"moved\"} />\n {latestBatch.scheduled > 0 &&\n ` · ${latestBatch.scheduled} still scheduled`}\n {\" · effective\"}\n {formatDate(latestBatch.effective_at)}\n </p>\n {latestBatch.skipped > 0 && (\n <p className=\"text-xs text-muted-foreground\">\n {latestBatch.skipped}\n <AdminMessage id={\" subscription\"} />\n {latestBatch.skipped === 1 ? \" was\" : \"s were\"}\n <AdminMessage\n id={\n \" left alone because another change was already scheduled for them.\"\n }\n />\n </p>\n )}\n </CardContent>\n </Card>\n )}\n </div>\n )\n}\n\nfunction CancelMigrationButton({ migrationId }: { migrationId: string }) {\n const { toast, toastApiError, adminMutations } = useAdminServices()\n\n const queryClient = useQueryClient()\n const cancelBatch = useMutation(\n adminMutations.cancelPriceMigration(queryClient)\n )\n const confirm = useConfirm()\n return (\n <Button\n variant=\"destructive\"\n size=\"sm\"\n disabled={cancelBatch.isPending}\n onClick={async () => {\n const canceling = await confirm({\n title: \"Cancel this migration?\",\n description:\n \"Subscribers not yet moved stay on their current price. Those already moved stay moved.\",\n confirmLabel: \"Cancel migration\",\n cancelLabel: \"Keep migrating\",\n tone: \"destructive\",\n })\n if (!canceling) return\n try {\n const result = await cancelBatch.mutateAsync(migrationId)\n toast.success(\n `Canceled ${result.canceled} pending move${result.canceled === 1 ? \"\" : \"s\"}. Already-migrated subscribers stay migrated.`\n )\n const release = result.rail_release_required.length\n if (release > 0)\n toast.warning(\n `${release} Stripe subscription${release === 1 ? \" still carries\" : \"s still carry\"} the move as a Stripe subscription schedule: release it in Stripe, or the price changes at period end.`\n )\n } catch (err) {\n toastApiError(err, \"Cancel migration\")\n }\n }}\n >\n {cancelBatch.isPending ? \"Canceling…\" : \"Cancel migration\"}\n </Button>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmCA,IAAM,IAA8C;CAClD,kBAAkB;CAClB,oBACE;CACF,WAAW;CACX,qBACE;CACF,cACE;CACF,cAAc;CACd,kBACE;CACF,gBACE;CACF,kBACE;CACF,kBACE;CACF,qBAAqB;CACrB,gBAAgB;AAClB,GAIM,IAAiD;CACrD,kBAAkB;CAClB,oBAAoB;CACpB,WAAW;CACX,qBAAqB;CACrB,cAAc;CACd,cAAc;CACd,kBAAkB;CAClB,gBAAgB;CAChB,kBAAkB;CAClB,kBAAkB;CAClB,qBAAqB;CACrB,gBAAgB;AAClB;AAEA,SAAS,EAAa,GAA8B;CAElD,OADK,IACE,EAAe,MAA2B,IAD/B;AAEpB;AAEA,SAAS,EAAU,GAAsB;CAEvC,OADK,IACE,EAAY,MAA2B,IAD5B;AAEpB;AAEA,IAAM,IAAW,mCACX,IAAa,6BACb,IAAY;AAIlB,SAAS,EAAgB,GAAe;CACtC,QAAQ,GAAR;EACE,KAAK,WACH,OAAO;EACT,KAAK;EACL,KAAK,WACH,OAAO;EACT,KAAK,iBACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAEA,IAAM,IAAW;CACf;CACA;CACA;CACA;CACA;AACF;AAEA,SAAS,EAAY,GAAqC;CACxD,OAAO,OAAO,QAAQ,KAAO,CAAC,CAAC,CAAC,CAC7B,QAAQ,GAAG,OAAO,MAAM,EAAE,CAAC,CAC3B,MAAM,CAAC,IAAI,CAAC,OAAO;EAClB,IAAM,IAAK,EAAS,QAAQ,CA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,gBAAkB,CAAA;MACnC,EAAY,YAAY,IAAI,SAAS;MACtC,kBAAC,GAAD,EACE,IACE,qEAEH,CAAA;KACA;IAEM,CAAA,CAAA;GACT,CAAA,CAAA,EAAA,CAAA;EAEL;;AAET;AAEA,SAAS,EAAsB,EAAE,kBAAwC;CACvE,IAAM,EAAE,UAAO,kBAAe,sBAAmB,EAAiB,GAE5D,IAAc,EAAe,GAC7B,IAAc,EAClB,EAAe,qBAAqB,CAAW,CACjD,GACM,IAAU,EAAW;CAC3B,OACE,kBAAC,GAAD;EACE,SAAQ;EACR,MAAK;EACL,UAAU,EAAY;EACtB,SAAS,YAAY;GASd,UARmB,EAAQ;IAC9B,OAAO;IACP,aACE;IACF,cAAc;IACd,aAAa;IACb,MAAM;GACR,CAAC,GAED,IAAI;IACF,IAAM,IAAS,MAAM,EAAY,YAAY,CAAW;IACxD,EAAM,QACJ,YAAY,EAAO,SAAS,eAAe,EAAO,aAAa,IAAI,KAAK,IAAI,8CAC9E;IACA,IAAM,IAAU,EAAO,sBAAsB;IAC7C,AAAI,IAAU,KACZ,EAAM,QACJ,GAAG,EAAQ,sBAAsB,MAAY,IAAI,mBAAmB,gBAAgB,uGACtF;GACJ,SAAS,GAAK;IACZ,EAAc,GAAK,kBAAkB;GACvC;EACF;EAEC,UAAA,EAAY,YAAY,eAAe;CAClC,CAAA;AAEZ"}
|
|
@@ -32,6 +32,10 @@ function o(e) {
|
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/admin/pages/catalog/price-format.ts
|
|
34
34
|
function s(e) {
|
|
35
|
+
if (e.billing_interval_months) {
|
|
36
|
+
let t = e.billing_interval_months;
|
|
37
|
+
return `every ${t} calendar ${t === 1 ? "month" : "months"}`;
|
|
38
|
+
}
|
|
35
39
|
return e.billing_interval_hours ? `every ${i(e.billing_interval_hours)}` : e.access_duration_hours ? `${i(e.access_duration_hours)} once` : "one-time";
|
|
36
40
|
}
|
|
37
41
|
function c(t) {
|
|
@@ -41,4 +45,4 @@ function c(t) {
|
|
|
41
45
|
//#endregion
|
|
42
46
|
export { o as i, s as n, i as r, c as t };
|
|
43
47
|
|
|
44
|
-
//# sourceMappingURL=admin-price-format-
|
|
48
|
+
//# sourceMappingURL=admin-price-format-BVUpDoSC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-price-format-BVUpDoSC.js","names":[],"sources":["../src/admin/lib/duration.ts","../src/admin/pages/catalog/price-format.ts"],"sourcesContent":["// Durations travel as exact hours or seconds; people read and type them in\n// words. A value is shown in the largest whole unit that divides it.\nconst UNITS: [seconds: number, name: string][] = [\n [604_800, \"week\"],\n [86_400, \"day\"],\n [3_600, \"hour\"],\n [60, \"minute\"],\n [1, \"second\"],\n]\n\nfunction counted(count: number, name: string): string {\n return `${count} ${name}${count === 1 ? \"\" : \"s\"}`\n}\n\n// formatSeconds renders \"1 week\", \"30 days\", \"36 hours\", \"90 minutes\".\nexport function formatSeconds(seconds: number): string {\n if (!Number.isSafeInteger(seconds) || seconds <= 0)\n return counted(seconds, \"second\")\n const [size, name] = UNITS.find(([size]) => seconds % size === 0) ?? UNITS[4]\n return counted(seconds / size, name)\n}\n\nexport function formatHours(hours: number): string {\n return formatSeconds(hours * 3_600)\n}\n\nconst HOURS_PER_UNIT: Record<string, number> = { h: 1, d: 24, w: 168 }\n\n// parseHours reads what the catalog YAML accepts — \"30 days\", \"1 week\",\n// \"12 hours\", or the short \"30d\" — as whole hours; anything else is null.\nexport function parseHours(text: string): number | null {\n const match = /^\\s*(\\d+)\\s*(h|hours?|d|days?|w|weeks?)\\s*$/i.exec(text)\n if (!match) return null\n const hours = Number(match[1]) * HOURS_PER_UNIT[match[2][0].toLowerCase()]\n return Number.isSafeInteger(hours) && hours > 0 ? hours : null\n}\n\n","import type { Price } from \"#orck/client/generated/wire\"\nimport { formatHours } from \"#orck/admin/lib/duration\"\nimport { formatNativeAmount } from \"#orck/admin/lib/format\"\n\n// priceIntervalLabel renders a price's renewal cadence, shared by the catalog\n// list and the price-change wizard.\nexport function priceIntervalLabel(\n price: Pick<Price, \"billing_interval_hours\" | \"access_duration_hours\"> & { billing_interval_months?: number | null }\n): string {\n if (price.billing_interval_months) {\n const months = price.billing_interval_months\n return `every ${months} calendar ${months === 1 ? \"month\" : \"months\"}`\n }\n if (price.billing_interval_hours) {\n return `every ${formatHours(price.billing_interval_hours)}`\n }\n if (price.access_duration_hours) {\n return `${formatHours(price.access_duration_hours)} once`\n }\n return \"one-time\"\n}\n\n// A deposit descriptor has no fixed amount: zero is not its purchase price.\nexport function priceAmountLabel(\n price: Pick<Price, \"unit_amount\" | \"currency\" | \"customer_amount\">\n): string {\n const range = price.customer_amount\n if (!range) return formatNativeAmount(price.unit_amount, price.currency)\n return `Customer chooses ${formatNativeAmount(range.min_amount, price.currency)}–${formatNativeAmount(range.max_amount, price.currency)}`\n}\n"],"mappings":";;AAEA,IAAM,IAA2C;CAC/C,CAAC,QAAS,MAAM;CAChB,CAAC,OAAQ,KAAK;CACd,CAAC,MAAO,MAAM;CACd,CAAC,IAAI,QAAQ;CACb,CAAC,GAAG,QAAQ;AACd;AAEA,SAAS,EAAQ,GAAe,GAAsB;CACpD,OAAO,GAAG,EAAM,GAAG,IAAO,MAAU,IAAI,KAAK;AAC/C;AAGA,SAAgB,EAAc,GAAyB;CACrD,IAAI,CAAC,OAAO,cAAc,CAAO,KAAK,KAAW,GAC/C,OAAO,EAAQ,GAAS,QAAQ;CAClC,IAAM,CAAC,GAAM,KAAQ,EAAM,MAAM,CAAC,OAAU,IAAU,MAAS,CAAC,KAAK,EAAM;CAC3E,OAAO,EAAQ,IAAU,GAAM,CAAI;AACrC;AAEA,SAAgB,EAAY,GAAuB;CACjD,OAAO,EAAc,IAAQ,IAAK;AACpC;AAEA,IAAM,IAAyC;CAAE,GAAG;CAAG,GAAG;CAAI,GAAG;AAAI;AAIrE,SAAgB,EAAW,GAA6B;CACtD,IAAM,IAAQ,+CAA+C,KAAK,CAAI;CACtE,IAAI,CAAC,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