@openrails/billing-ui 0.254.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
package/dist/index.js
CHANGED
|
@@ -11,30 +11,30 @@ if (typeof document !== "undefined") {
|
|
|
11
11
|
if (__orckStyle.textContent !== __orckCss) __orckStyle.textContent = __orckCss;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
import { A as e, C as t, E as n, O as r, S as i, _ as a, a as o, b as s, d as c, f as l, g as u, h as d, p as f, s as p, v as m, w as h, x as g, y as _ } from "./client-
|
|
15
|
-
import { _ as v, a as y, b, f as x, g as S, h as C, i as w, l as T, m as E, n as D, o as O, p as
|
|
16
|
-
import { t as
|
|
17
|
-
import { z as
|
|
18
|
-
import * as
|
|
19
|
-
import { Fragment as
|
|
20
|
-
import { cn as
|
|
21
|
-
import { Button as
|
|
22
|
-
import { cva as
|
|
23
|
-
import { mergeProps as
|
|
24
|
-
import { useRender as
|
|
25
|
-
import { HugeiconsIcon as
|
|
26
|
-
import { Add01Icon as
|
|
27
|
-
import { AlertDialog as
|
|
28
|
-
import { Dialog as
|
|
29
|
-
import { Input as
|
|
30
|
-
import { Radio as
|
|
31
|
-
import { RadioGroup as
|
|
14
|
+
import { A as e, C as t, E as n, O as r, S as i, _ as a, a as o, b as s, d as c, f as l, g as u, h as d, p as f, s as p, v as m, w as h, x as g, y as _ } from "./client-Bs2YY-PV.js";
|
|
15
|
+
import { _ as v, a as y, b, f as x, g as S, h as C, i as w, l as T, m as E, n as D, o as O, p as ee, r as k, s as te, t as ne, v as re, x as ie, y as A } from "./hooks-CCA-6uEa.js";
|
|
16
|
+
import { t as j } from "./index-rGw83t5v-BE6naeQR.js";
|
|
17
|
+
import { z as M } from "zod";
|
|
18
|
+
import * as N from "react";
|
|
19
|
+
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
20
|
+
import { cn as L } from "cn";
|
|
21
|
+
import { Button as ae } from "@base-ui/react/button";
|
|
22
|
+
import { cva as R } from "class-variance-authority";
|
|
23
|
+
import { mergeProps as oe } from "@base-ui/react/merge-props";
|
|
24
|
+
import { useRender as se } from "@base-ui/react/use-render";
|
|
25
|
+
import { HugeiconsIcon as ce } from "@hugeicons/react";
|
|
26
|
+
import { Add01Icon as le, ArrowUpRight01Icon as ue, Cancel01Icon as de, Delete02Icon as fe, Loading03Icon as pe } from "@hugeicons/core-free-icons";
|
|
27
|
+
import { AlertDialog as z } from "@base-ui/react/alert-dialog";
|
|
28
|
+
import { Dialog as B } from "@base-ui/react/dialog";
|
|
29
|
+
import { Input as me } from "@base-ui/react/input";
|
|
30
|
+
import { Radio as V } from "@base-ui/react/radio";
|
|
31
|
+
import { RadioGroup as he } from "@base-ui/react/radio-group";
|
|
32
32
|
//#region src/scope.tsx
|
|
33
|
-
function
|
|
33
|
+
function H({ appearance: e, className: t, style: n, ...r }) {
|
|
34
34
|
let i = x(e);
|
|
35
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ F("div", {
|
|
36
36
|
"data-orck-theme": i["data-orck-theme"],
|
|
37
|
-
className:
|
|
37
|
+
className: L(i.className, t),
|
|
38
38
|
style: {
|
|
39
39
|
...i.style,
|
|
40
40
|
...n
|
|
@@ -44,7 +44,7 @@ function he({ appearance: e, className: t, style: n, ...r }) {
|
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region src/components/ui/button.tsx
|
|
47
|
-
var ge =
|
|
47
|
+
var ge = R("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
48
48
|
variants: {
|
|
49
49
|
variant: {
|
|
50
50
|
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
@@ -71,9 +71,9 @@ var ge = z("group/button inline-flex shrink-0 items-center justify-center rounde
|
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
function U({ className: e, variant: t = "default", size: n = "default", ...r }) {
|
|
74
|
-
return /* @__PURE__ */
|
|
74
|
+
return /* @__PURE__ */ F(ae, {
|
|
75
75
|
"data-slot": "button",
|
|
76
|
-
className:
|
|
76
|
+
className: L(ge({
|
|
77
77
|
variant: t,
|
|
78
78
|
size: n,
|
|
79
79
|
className: e
|
|
@@ -155,7 +155,7 @@ var De = /* @__PURE__ */ new Set([
|
|
|
155
155
|
"past_due",
|
|
156
156
|
"awaiting_method",
|
|
157
157
|
"unverified"
|
|
158
|
-
]), Oe = (e) => !!e && new Date(e).getTime() > Date.now(),
|
|
158
|
+
]), Oe = (e) => !!e && new Date(e).getTime() > Date.now(), ke = (e) => De.has(e.status) || e.status === "canceled" && !!e.access && (!e.access.ends_at || Oe(e.access.ends_at)), G = (e) => ke(e) && (!!e.cancel_scheduled || e.status === "canceled"), Ae = {
|
|
159
159
|
active: "success",
|
|
160
160
|
succeeded: "success",
|
|
161
161
|
paid: "success",
|
|
@@ -171,83 +171,83 @@ var De = /* @__PURE__ */ new Set([
|
|
|
171
171
|
expired: "destructive",
|
|
172
172
|
canceled: "neutral",
|
|
173
173
|
refunded: "neutral"
|
|
174
|
-
}, je = (e) => Ae[e] ?? "neutral",
|
|
174
|
+
}, je = (e) => Ae[e] ?? "neutral", Me = "[&_h2]:m-0 [&_p]:m-0 [&_ul]:m-0 [&_ul]:list-none [&_ul]:p-0 [&_table]:border-spacing-0";
|
|
175
175
|
//#endregion
|
|
176
176
|
//#region src/components/ui/card.tsx
|
|
177
|
-
function
|
|
178
|
-
return /* @__PURE__ */
|
|
177
|
+
function Ne({ className: e, size: t = "default", ...n }) {
|
|
178
|
+
return /* @__PURE__ */ F("div", {
|
|
179
179
|
"data-slot": "card",
|
|
180
180
|
"data-size": t,
|
|
181
|
-
className:
|
|
181
|
+
className: L("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl", e),
|
|
182
182
|
...n
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
|
-
function
|
|
186
|
-
return /* @__PURE__ */
|
|
185
|
+
function K({ className: e, ...t }) {
|
|
186
|
+
return /* @__PURE__ */ F("div", {
|
|
187
187
|
"data-slot": "card-header",
|
|
188
|
-
className:
|
|
188
|
+
className: L("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)", e),
|
|
189
189
|
...t
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
return /* @__PURE__ */
|
|
192
|
+
function q({ className: e, ...t }) {
|
|
193
|
+
return /* @__PURE__ */ F("div", {
|
|
194
194
|
"data-slot": "card-title",
|
|
195
|
-
className:
|
|
195
|
+
className: L("text-base leading-normal font-medium group-data-[size=sm]/card:text-sm", e),
|
|
196
196
|
...t
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
199
|
function Pe({ className: e, ...t }) {
|
|
200
|
-
return /* @__PURE__ */
|
|
200
|
+
return /* @__PURE__ */ F("div", {
|
|
201
201
|
"data-slot": "card-description",
|
|
202
|
-
className:
|
|
202
|
+
className: L("text-sm text-muted-foreground", e),
|
|
203
203
|
...t
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
function Fe({ className: e, ...t }) {
|
|
207
|
-
return /* @__PURE__ */
|
|
207
|
+
return /* @__PURE__ */ F("div", {
|
|
208
208
|
"data-slot": "card-action",
|
|
209
|
-
className:
|
|
209
|
+
className: L("col-start-2 row-span-2 row-start-1 self-start justify-self-end", e),
|
|
210
210
|
...t
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
function Ie({ className: e, ...t }) {
|
|
214
|
-
return /* @__PURE__ */
|
|
214
|
+
return /* @__PURE__ */ F("div", {
|
|
215
215
|
"data-slot": "card-content",
|
|
216
|
-
className:
|
|
216
|
+
className: L("flex flex-col gap-3 px-(--card-spacing)", e),
|
|
217
217
|
...t
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
220
|
//#endregion
|
|
221
221
|
//#region src/components/ui/skeleton.tsx
|
|
222
222
|
function J({ className: e, ...t }) {
|
|
223
|
-
return /* @__PURE__ */
|
|
223
|
+
return /* @__PURE__ */ F("div", {
|
|
224
224
|
"data-slot": "skeleton",
|
|
225
|
-
className:
|
|
225
|
+
className: L("animate-pulse rounded-md bg-muted", e),
|
|
226
226
|
...t
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
229
|
//#endregion
|
|
230
230
|
//#region src/account/section.tsx
|
|
231
231
|
function Le({ title: e, description: t, action: n, appearance: r, className: i, children: a, ...o }) {
|
|
232
|
-
let s = x(r), c =
|
|
233
|
-
return /* @__PURE__ */
|
|
232
|
+
let s = x(r), c = N.useId();
|
|
233
|
+
return /* @__PURE__ */ F("section", {
|
|
234
234
|
"aria-labelledby": c,
|
|
235
|
-
className:
|
|
235
|
+
className: L(s.className, Me, "block", i),
|
|
236
236
|
"data-orck-theme": s["data-orck-theme"],
|
|
237
237
|
style: s.style,
|
|
238
238
|
"data-testid": o["data-testid"],
|
|
239
|
-
children: /* @__PURE__ */
|
|
239
|
+
children: /* @__PURE__ */ I(Ne, {
|
|
240
240
|
className: "gap-4 bg-card text-card-foreground",
|
|
241
|
-
children: [/* @__PURE__ */
|
|
242
|
-
/* @__PURE__ */
|
|
241
|
+
children: [/* @__PURE__ */ I(K, { children: [
|
|
242
|
+
/* @__PURE__ */ F(q, {
|
|
243
243
|
id: c,
|
|
244
244
|
role: "heading",
|
|
245
245
|
"aria-level": 2,
|
|
246
246
|
children: e
|
|
247
247
|
}),
|
|
248
|
-
t ? /* @__PURE__ */
|
|
249
|
-
n ? /* @__PURE__ */
|
|
250
|
-
] }), /* @__PURE__ */
|
|
248
|
+
t ? /* @__PURE__ */ F(Pe, { children: t }) : null,
|
|
249
|
+
n ? /* @__PURE__ */ F(Fe, { children: n }) : null
|
|
250
|
+
] }), /* @__PURE__ */ F(Ie, {
|
|
251
251
|
className: "gap-0",
|
|
252
252
|
children: a
|
|
253
253
|
})]
|
|
@@ -255,35 +255,35 @@ function Le({ title: e, description: t, action: n, appearance: r, className: i,
|
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
257
|
function Re({ rows: e = 2 }) {
|
|
258
|
-
return /* @__PURE__ */
|
|
258
|
+
return /* @__PURE__ */ F("div", {
|
|
259
259
|
className: "grid gap-4 py-2",
|
|
260
260
|
"aria-hidden": !0,
|
|
261
|
-
children: Array.from({ length: e }, (e, t) => /* @__PURE__ */
|
|
261
|
+
children: Array.from({ length: e }, (e, t) => /* @__PURE__ */ I("div", {
|
|
262
262
|
className: "flex items-center gap-3",
|
|
263
263
|
children: [
|
|
264
|
-
/* @__PURE__ */
|
|
265
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ F(J, { className: "h-7 w-11 rounded-md" }),
|
|
265
|
+
/* @__PURE__ */ I("div", {
|
|
266
266
|
className: "grid flex-1 gap-2",
|
|
267
|
-
children: [/* @__PURE__ */
|
|
267
|
+
children: [/* @__PURE__ */ F(J, { className: "h-3.5 w-40" }), /* @__PURE__ */ F(J, { className: "h-3 w-28" })]
|
|
268
268
|
}),
|
|
269
|
-
/* @__PURE__ */
|
|
269
|
+
/* @__PURE__ */ F(J, { className: "h-3.5 w-14" })
|
|
270
270
|
]
|
|
271
271
|
}, t))
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
274
|
function ze({ title: e, description: t, action: n }) {
|
|
275
|
-
return /* @__PURE__ */
|
|
275
|
+
return /* @__PURE__ */ I("div", {
|
|
276
276
|
className: "grid justify-items-center gap-1 rounded-lg border border-dashed px-4 py-8 text-center",
|
|
277
277
|
children: [
|
|
278
|
-
/* @__PURE__ */
|
|
278
|
+
/* @__PURE__ */ F("p", {
|
|
279
279
|
className: "text-sm font-medium",
|
|
280
280
|
children: e
|
|
281
281
|
}),
|
|
282
|
-
t ? /* @__PURE__ */
|
|
282
|
+
t ? /* @__PURE__ */ F("p", {
|
|
283
283
|
className: "text-sm text-muted-foreground",
|
|
284
284
|
children: t
|
|
285
285
|
}) : null,
|
|
286
|
-
n ? /* @__PURE__ */
|
|
286
|
+
n ? /* @__PURE__ */ F("div", {
|
|
287
287
|
className: "mt-3",
|
|
288
288
|
children: n
|
|
289
289
|
}) : null
|
|
@@ -292,13 +292,13 @@ function ze({ title: e, description: t, action: n }) {
|
|
|
292
292
|
}
|
|
293
293
|
function Y({ error: e, message: t, onRetry: n }) {
|
|
294
294
|
let r = S();
|
|
295
|
-
return /* @__PURE__ */
|
|
295
|
+
return /* @__PURE__ */ I("div", {
|
|
296
296
|
role: "alert",
|
|
297
297
|
className: "flex flex-wrap items-center justify-between gap-3 rounded-lg bg-destructive/5 px-4 py-3",
|
|
298
|
-
children: [/* @__PURE__ */
|
|
298
|
+
children: [/* @__PURE__ */ F("p", {
|
|
299
299
|
className: "text-sm text-destructive",
|
|
300
300
|
children: t ?? r.error(e)
|
|
301
|
-
}), /* @__PURE__ */
|
|
301
|
+
}), /* @__PURE__ */ F(U, {
|
|
302
302
|
variant: "outline",
|
|
303
303
|
size: "sm",
|
|
304
304
|
onClick: n,
|
|
@@ -308,7 +308,7 @@ function Y({ error: e, message: t, onRetry: n }) {
|
|
|
308
308
|
}
|
|
309
309
|
//#endregion
|
|
310
310
|
//#region src/components/ui/badge.tsx
|
|
311
|
-
var Be =
|
|
311
|
+
var Be = R("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
|
|
312
312
|
variants: { variant: {
|
|
313
313
|
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
314
314
|
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
@@ -320,9 +320,9 @@ var Be = z("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-cent
|
|
|
320
320
|
defaultVariants: { variant: "default" }
|
|
321
321
|
});
|
|
322
322
|
function Ve({ className: e, variant: t = "default", render: n, ...r }) {
|
|
323
|
-
return
|
|
323
|
+
return se({
|
|
324
324
|
defaultTagName: "span",
|
|
325
|
-
props:
|
|
325
|
+
props: oe({ className: L(Be({ variant: t }), e) }, r),
|
|
326
326
|
render: n,
|
|
327
327
|
state: {
|
|
328
328
|
slot: "badge",
|
|
@@ -340,9 +340,9 @@ var He = {
|
|
|
340
340
|
};
|
|
341
341
|
function Ue({ status: e, label: t, className: n }) {
|
|
342
342
|
let { t: r, messages: i } = S(), a = e, o = t ?? (a in i.status ? r(`status.${a}`) : e.replace(/_/g, " "));
|
|
343
|
-
return /* @__PURE__ */
|
|
343
|
+
return /* @__PURE__ */ F(Ve, {
|
|
344
344
|
"data-status": e,
|
|
345
|
-
className:
|
|
345
|
+
className: L(He[je(e)], "font-medium", n),
|
|
346
346
|
children: o
|
|
347
347
|
});
|
|
348
348
|
}
|
|
@@ -354,78 +354,78 @@ function We(e, t) {
|
|
|
354
354
|
return n in t.messages.history.rail ? t.t(`history.rail.${n}`) : n || t.t("common.notAvailable");
|
|
355
355
|
}
|
|
356
356
|
function Ge({ appearance: e, className: t, ...n }) {
|
|
357
|
-
let r = S(), { t: i } = r, { locale: a } =
|
|
358
|
-
c = l === null && o.error ? /* @__PURE__ */
|
|
357
|
+
let r = S(), { t: i } = r, { locale: a } = ee(), o = D(n), s = O(), c, l = o.payments;
|
|
358
|
+
c = l === null && o.error ? /* @__PURE__ */ F(Y, {
|
|
359
359
|
error: o.error,
|
|
360
360
|
onRetry: o.refetch
|
|
361
|
-
}) : l === null ? /* @__PURE__ */
|
|
361
|
+
}) : l === null ? /* @__PURE__ */ F(Re, { rows: 3 }) : l.length === 0 && o.page === 0 ? /* @__PURE__ */ F(ze, {
|
|
362
362
|
title: i("history.empty"),
|
|
363
363
|
description: i("history.emptyDescription")
|
|
364
|
-
}) : /* @__PURE__ */
|
|
364
|
+
}) : /* @__PURE__ */ F("div", {
|
|
365
365
|
className: "-mx-1 overflow-x-auto px-1",
|
|
366
|
-
children: /* @__PURE__ */
|
|
367
|
-
className:
|
|
366
|
+
children: /* @__PURE__ */ I("table", {
|
|
367
|
+
className: L("w-full border-collapse text-sm", o.loading && "opacity-60 transition-opacity"),
|
|
368
368
|
"aria-busy": o.loading || void 0,
|
|
369
|
-
children: [/* @__PURE__ */
|
|
369
|
+
children: [/* @__PURE__ */ F("thead", { children: /* @__PURE__ */ I("tr", {
|
|
370
370
|
className: "border-b text-left text-xs text-muted-foreground",
|
|
371
371
|
children: [
|
|
372
|
-
/* @__PURE__ */
|
|
372
|
+
/* @__PURE__ */ F("th", {
|
|
373
373
|
scope: "col",
|
|
374
374
|
className: "hidden py-2 pr-3 font-medium @md:table-cell",
|
|
375
375
|
children: i("history.date")
|
|
376
376
|
}),
|
|
377
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ F("th", {
|
|
378
378
|
scope: "col",
|
|
379
379
|
className: "py-2 pr-3 font-medium",
|
|
380
380
|
children: i("history.item")
|
|
381
381
|
}),
|
|
382
|
-
/* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ F("th", {
|
|
383
383
|
scope: "col",
|
|
384
384
|
className: "hidden py-2 pr-3 font-medium @md:table-cell",
|
|
385
385
|
children: i("history.method")
|
|
386
386
|
}),
|
|
387
|
-
/* @__PURE__ */
|
|
387
|
+
/* @__PURE__ */ F("th", {
|
|
388
388
|
scope: "col",
|
|
389
389
|
className: "py-2 pr-3 font-medium",
|
|
390
390
|
children: i("history.status")
|
|
391
391
|
}),
|
|
392
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ F("th", {
|
|
393
393
|
scope: "col",
|
|
394
394
|
className: "py-2 text-right font-medium",
|
|
395
395
|
children: i("history.amount")
|
|
396
396
|
})
|
|
397
397
|
]
|
|
398
|
-
}) }), /* @__PURE__ */
|
|
398
|
+
}) }), /* @__PURE__ */ F("tbody", {
|
|
399
399
|
className: "divide-y divide-border",
|
|
400
400
|
children: l.map((e) => {
|
|
401
401
|
let t = e.kind === "refund", n = e.status || (t ? "refunded" : "unknown"), c = be(e.amount, e.currency, s, a), l = !t && e.amount_refunded && e.amount_refunded !== "0" ? be(e.amount_refunded, e.currency, s, a) : null, u = ye(e.created_at, a) ?? i("common.notAvailable"), d = Ce(e, e.order_id ? o.orders[e.order_id] : void 0, r);
|
|
402
|
-
return /* @__PURE__ */
|
|
402
|
+
return /* @__PURE__ */ I("tr", {
|
|
403
403
|
"data-testid": "payment-row",
|
|
404
404
|
"data-payment-id": e.id,
|
|
405
405
|
children: [
|
|
406
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ F("td", {
|
|
407
407
|
className: "hidden py-3 pr-3 align-top whitespace-nowrap tabular-nums @md:table-cell",
|
|
408
408
|
children: u
|
|
409
409
|
}),
|
|
410
|
-
/* @__PURE__ */
|
|
410
|
+
/* @__PURE__ */ I("td", {
|
|
411
411
|
className: "py-3 pr-3 align-top",
|
|
412
412
|
children: [
|
|
413
|
-
/* @__PURE__ */
|
|
413
|
+
/* @__PURE__ */ F("div", {
|
|
414
414
|
"data-testid": "payment-item",
|
|
415
415
|
className: "font-medium",
|
|
416
416
|
children: d.name
|
|
417
417
|
}),
|
|
418
|
-
e.status === "failed" && e.failure?.message ? /* @__PURE__ */
|
|
418
|
+
e.status === "failed" && e.failure?.message ? /* @__PURE__ */ F("div", {
|
|
419
419
|
"data-testid": "payment-failure",
|
|
420
420
|
className: "text-xs text-destructive",
|
|
421
421
|
children: e.failure.message
|
|
422
422
|
}) : null,
|
|
423
|
-
d.detail ? /* @__PURE__ */
|
|
423
|
+
d.detail ? /* @__PURE__ */ F("div", {
|
|
424
424
|
"data-testid": "payment-period",
|
|
425
425
|
className: "text-xs text-muted-foreground",
|
|
426
426
|
children: d.detail
|
|
427
427
|
}) : null,
|
|
428
|
-
/* @__PURE__ */
|
|
428
|
+
/* @__PURE__ */ I("div", {
|
|
429
429
|
className: "text-xs text-muted-foreground tabular-nums @md:hidden",
|
|
430
430
|
children: [
|
|
431
431
|
u,
|
|
@@ -435,20 +435,20 @@ function Ge({ appearance: e, className: t, ...n }) {
|
|
|
435
435
|
})
|
|
436
436
|
]
|
|
437
437
|
}),
|
|
438
|
-
/* @__PURE__ */
|
|
438
|
+
/* @__PURE__ */ F("td", {
|
|
439
439
|
className: "hidden py-3 pr-3 align-top text-muted-foreground tabular-nums @md:table-cell",
|
|
440
440
|
children: We(e, r)
|
|
441
441
|
}),
|
|
442
|
-
/* @__PURE__ */
|
|
442
|
+
/* @__PURE__ */ F("td", {
|
|
443
443
|
className: "py-3 pr-3 align-top",
|
|
444
|
-
children: /* @__PURE__ */
|
|
444
|
+
children: /* @__PURE__ */ F(Ue, {
|
|
445
445
|
status: n,
|
|
446
446
|
label: t ? i("history.refund") : void 0
|
|
447
447
|
})
|
|
448
448
|
}),
|
|
449
|
-
/* @__PURE__ */
|
|
449
|
+
/* @__PURE__ */ I("td", {
|
|
450
450
|
className: "py-3 text-right align-top font-medium whitespace-nowrap tabular-nums",
|
|
451
|
-
children: [c ?? i("common.notAvailable"), l ? /* @__PURE__ */
|
|
451
|
+
children: [c ?? i("common.notAvailable"), l ? /* @__PURE__ */ F("div", {
|
|
452
452
|
className: "text-xs font-normal text-muted-foreground",
|
|
453
453
|
children: i("history.refundedAmount", { amount: l })
|
|
454
454
|
}) : null]
|
|
@@ -460,7 +460,7 @@ function Ge({ appearance: e, className: t, ...n }) {
|
|
|
460
460
|
})
|
|
461
461
|
});
|
|
462
462
|
let u = o.page > 0 || o.hasMore;
|
|
463
|
-
return /* @__PURE__ */
|
|
463
|
+
return /* @__PURE__ */ I(Le, {
|
|
464
464
|
title: i("history.title"),
|
|
465
465
|
description: i("history.description"),
|
|
466
466
|
appearance: e,
|
|
@@ -468,28 +468,28 @@ function Ge({ appearance: e, className: t, ...n }) {
|
|
|
468
468
|
"data-testid": "payment-history",
|
|
469
469
|
children: [
|
|
470
470
|
c,
|
|
471
|
-
l !== null && o.error ? /* @__PURE__ */
|
|
471
|
+
l !== null && o.error ? /* @__PURE__ */ F("div", {
|
|
472
472
|
className: "pt-3",
|
|
473
|
-
children: /* @__PURE__ */
|
|
473
|
+
children: /* @__PURE__ */ F(Y, {
|
|
474
474
|
error: o.error,
|
|
475
475
|
onRetry: o.refetch
|
|
476
476
|
})
|
|
477
477
|
}) : null,
|
|
478
|
-
u ? /* @__PURE__ */
|
|
478
|
+
u ? /* @__PURE__ */ I("nav", {
|
|
479
479
|
"aria-label": i("history.title"),
|
|
480
480
|
className: "flex items-center justify-between gap-3 pt-4",
|
|
481
|
-
children: [/* @__PURE__ */
|
|
481
|
+
children: [/* @__PURE__ */ F("span", {
|
|
482
482
|
className: "text-xs text-muted-foreground tabular-nums",
|
|
483
483
|
children: i("history.page", { page: o.page + 1 })
|
|
484
|
-
}), /* @__PURE__ */
|
|
484
|
+
}), /* @__PURE__ */ I("div", {
|
|
485
485
|
className: "flex gap-2",
|
|
486
|
-
children: [/* @__PURE__ */
|
|
486
|
+
children: [/* @__PURE__ */ F(U, {
|
|
487
487
|
variant: "outline",
|
|
488
488
|
size: "sm",
|
|
489
489
|
disabled: o.page === 0 || o.loading,
|
|
490
490
|
onClick: o.previous,
|
|
491
491
|
children: i("common.previous")
|
|
492
|
-
}), /* @__PURE__ */
|
|
492
|
+
}), /* @__PURE__ */ F(U, {
|
|
493
493
|
variant: "outline",
|
|
494
494
|
size: "sm",
|
|
495
495
|
disabled: !o.hasMore || o.loading,
|
|
@@ -519,39 +519,39 @@ function qe(e) {
|
|
|
519
519
|
//#endregion
|
|
520
520
|
//#region src/components/card-brands.tsx
|
|
521
521
|
function Je() {
|
|
522
|
-
return /* @__PURE__ */
|
|
522
|
+
return /* @__PURE__ */ F("svg", {
|
|
523
523
|
viewBox: "0 0 1000 324.68",
|
|
524
524
|
className: "h-2.5 w-auto",
|
|
525
525
|
role: "presentation",
|
|
526
|
-
children: /* @__PURE__ */
|
|
526
|
+
children: /* @__PURE__ */ F("path", {
|
|
527
527
|
fill: "#1434cb",
|
|
528
528
|
d: "m651.19.5c-70.93,0-134.32,36.77-134.32,104.69,0,77.9,112.42,83.28,112.42,122.42,0,16.48-18.88,31.23-51.14,31.23-45.77,0-79.98-20.61-79.98-20.61l-14.64,68.55s39.41,17.41,91.73,17.41c77.55,0,138.58-38.57,138.58-107.66,0-82.32-112.89-87.54-112.89-123.86,0-12.91,15.5-27.05,47.66-27.05,36.29,0,65.89,14.99,65.89,14.99l14.33-66.2S696.61.5,651.18.5h0ZM2.22,5.5L.5,15.49s29.84,5.46,56.72,16.36c34.61,12.49,37.07,19.77,42.9,42.35l63.51,244.83h85.14L379.93,5.5h-84.94l-84.28,213.17-34.39-180.7c-3.15-20.68-19.13-32.48-38.68-32.48,0,0-135.41,0-135.41,0Zm411.87,0l-66.63,313.53h81L494.85,5.5h-80.76Zm451.76,0c-19.53,0-29.88,10.46-37.47,28.73l-118.67,284.8h84.94l16.43-47.47h103.48l9.99,47.47h74.95L934.12,5.5h-68.27Zm11.05,84.71l25.18,117.65h-67.45l42.28-117.65h0Z"
|
|
529
529
|
})
|
|
530
530
|
});
|
|
531
531
|
}
|
|
532
532
|
function Ye() {
|
|
533
|
-
return /* @__PURE__ */
|
|
533
|
+
return /* @__PURE__ */ F("svg", {
|
|
534
534
|
viewBox: "0 0 152.4 108",
|
|
535
535
|
className: "h-4 w-auto",
|
|
536
536
|
role: "presentation",
|
|
537
|
-
children: /* @__PURE__ */
|
|
537
|
+
children: /* @__PURE__ */ I("g", { children: [/* @__PURE__ */ F("rect", {
|
|
538
538
|
y: "0",
|
|
539
539
|
fill: "none",
|
|
540
540
|
width: "152.4",
|
|
541
541
|
height: "108"
|
|
542
|
-
}), /* @__PURE__ */
|
|
543
|
-
/* @__PURE__ */
|
|
542
|
+
}), /* @__PURE__ */ I("g", { children: [
|
|
543
|
+
/* @__PURE__ */ F("rect", {
|
|
544
544
|
x: "60.4",
|
|
545
545
|
y: "25.7",
|
|
546
546
|
fill: "#FF5F00",
|
|
547
547
|
width: "31.5",
|
|
548
548
|
height: "56.6"
|
|
549
549
|
}),
|
|
550
|
-
/* @__PURE__ */
|
|
550
|
+
/* @__PURE__ */ F("path", {
|
|
551
551
|
fill: "#EB001B",
|
|
552
552
|
d: "M62.4,54c0-11,5.1-21.5,13.7-28.3c-15.6-12.3-38.3-9.6-50.6,6.1C13.3,47.4,16,70,31.7,82.3\n c13.1,10.3,31.4,10.3,44.5,0C67.5,75.5,62.4,65,62.4,54z"
|
|
553
553
|
}),
|
|
554
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__PURE__ */ F("path", {
|
|
555
555
|
fill: "#F79E1B",
|
|
556
556
|
d: "M134.4,54c0,19.9-16.1,36-36,36c-8.1,0-15.9-2.7-22.2-7.7c15.6-12.3,18.3-34.9,6-50.6c-1.8-2.2-3.8-4.3-6-6\n c15.6-12.3,38.3-9.6,50.5,6.1C131.7,38.1,134.4,45.9,134.4,54z"
|
|
557
557
|
})
|
|
@@ -559,63 +559,63 @@ function Ye() {
|
|
|
559
559
|
});
|
|
560
560
|
}
|
|
561
561
|
function Xe() {
|
|
562
|
-
let e = `orck-amex-${
|
|
563
|
-
return /* @__PURE__ */
|
|
562
|
+
let e = `orck-amex-${N.useId().replace(/[^a-zA-Z0-9-]/g, "")}`;
|
|
563
|
+
return /* @__PURE__ */ I("svg", {
|
|
564
564
|
viewBox: "0 0 300 300",
|
|
565
565
|
className: "h-full w-auto",
|
|
566
566
|
role: "presentation",
|
|
567
567
|
children: [
|
|
568
|
-
/* @__PURE__ */
|
|
568
|
+
/* @__PURE__ */ I("radialGradient", {
|
|
569
569
|
id: e,
|
|
570
570
|
cx: "57.3882",
|
|
571
571
|
cy: "57.021",
|
|
572
572
|
r: "264.5797",
|
|
573
573
|
gradientUnits: "userSpaceOnUse",
|
|
574
574
|
children: [
|
|
575
|
-
/* @__PURE__ */
|
|
575
|
+
/* @__PURE__ */ F("stop", {
|
|
576
576
|
offset: "0",
|
|
577
577
|
stopColor: "#9DD5F6"
|
|
578
578
|
}),
|
|
579
|
-
/* @__PURE__ */
|
|
579
|
+
/* @__PURE__ */ F("stop", {
|
|
580
580
|
offset: "0.0711",
|
|
581
581
|
stopColor: "#98D3F5"
|
|
582
582
|
}),
|
|
583
|
-
/* @__PURE__ */
|
|
583
|
+
/* @__PURE__ */ F("stop", {
|
|
584
584
|
offset: "0.1575",
|
|
585
585
|
stopColor: "#89CEF3"
|
|
586
586
|
}),
|
|
587
|
-
/* @__PURE__ */
|
|
587
|
+
/* @__PURE__ */ F("stop", {
|
|
588
588
|
offset: "0.2516",
|
|
589
589
|
stopColor: "#70C6EF"
|
|
590
590
|
}),
|
|
591
|
-
/* @__PURE__ */
|
|
591
|
+
/* @__PURE__ */ F("stop", {
|
|
592
592
|
offset: "0.3514",
|
|
593
593
|
stopColor: "#4EBBEA"
|
|
594
594
|
}),
|
|
595
|
-
/* @__PURE__ */
|
|
595
|
+
/* @__PURE__ */ F("stop", {
|
|
596
596
|
offset: "0.4546",
|
|
597
597
|
stopColor: "#23ADE3"
|
|
598
598
|
}),
|
|
599
|
-
/* @__PURE__ */
|
|
599
|
+
/* @__PURE__ */ F("stop", {
|
|
600
600
|
offset: "0.5",
|
|
601
601
|
stopColor: "#0DA6E0"
|
|
602
602
|
}),
|
|
603
|
-
/* @__PURE__ */
|
|
603
|
+
/* @__PURE__ */ F("stop", {
|
|
604
604
|
offset: "1",
|
|
605
605
|
stopColor: "#2E77BC"
|
|
606
606
|
})
|
|
607
607
|
]
|
|
608
608
|
}),
|
|
609
|
-
/* @__PURE__ */
|
|
609
|
+
/* @__PURE__ */ F("path", {
|
|
610
610
|
fill: `url(#${e})`,
|
|
611
611
|
d: "M289.584,7.598H7.639v282.966h281.945v-93.386c1.12-1.619,1.673-3.69,1.673-6.222\n c0-2.898-0.553-4.693-1.673-6.205"
|
|
612
612
|
}),
|
|
613
|
-
/* @__PURE__ */
|
|
614
|
-
/* @__PURE__ */
|
|
613
|
+
/* @__PURE__ */ F("g", {}),
|
|
614
|
+
/* @__PURE__ */ F("path", {
|
|
615
615
|
fill: "#FFFFFF",
|
|
616
616
|
d: "M33.053,130.042l-5.424-13.217l-5.393,13.217 M152.543,124.779c-1.089,0.661-2.377,0.683-3.92,0.683h-9.627\n v-7.364h9.758c1.381,0,2.822,0.062,3.758,0.598c1.028,0.483,1.664,1.511,1.664,2.931\n C154.176,123.076,153.571,124.242,152.543,124.779z M221.221,130.042l-5.484-13.217l-5.454,13.217H221.221z M93.201,144.348h-8.124\n l-0.03-25.966l-11.491,25.966h-6.958l-11.521-25.989v25.989H38.959l-3.045-7.395h-16.5l-3.076,7.395H7.731l14.191-33.154h11.774\n l13.478,31.39v-31.39h12.934l10.371,22.491l9.527-22.491h13.194V144.348z M125.58,144.348H99.107v-33.154h26.473v6.904h-18.548\n v5.976h18.103v6.796h-18.103v6.621h18.548V144.348z M162.906,120.123c0,5.286-3.528,8.017-5.584,8.837\n c1.734,0.66,3.215,1.826,3.92,2.792c1.119,1.649,1.312,3.122,1.312,6.083v6.513h-7.993l-0.03-4.181c0-1.995,0.191-4.864-1.251-6.459\n c-1.158-1.166-2.923-1.419-5.776-1.419h-8.507v12.059h-7.924v-33.154h18.227c4.05,0,7.034,0.107,9.596,1.588\n C161.403,114.263,162.906,116.425,162.906,120.123z M175.588,144.348h-8.086v-33.154h8.086V144.348z M269.396,144.348h-11.23\n l-15.021-24.884v24.884h-16.139l-3.084-7.395H207.46l-2.992,7.395h-9.273c-3.852,0-8.729-0.852-11.491-3.667\n c-2.785-2.815-4.234-6.628-4.234-12.657c0-4.917,0.866-9.412,4.272-12.964c2.562-2.646,6.574-3.866,12.035-3.866h7.672v7.104h-7.511\n c-2.892,0-4.525,0.43-6.098,1.964c-1.351,1.396-2.278,4.035-2.278,7.51c0,3.552,0.706,6.113,2.179,7.786\n c1.22,1.312,3.437,1.71,5.523,1.71h3.559l11.169-26.073h11.874l13.417,31.359v-31.359h12.066l13.93,23.09v-23.09h8.117V144.348z\n M7.639,150.86h13.54l3.053-7.364h6.835l3.045,7.364h26.641v-5.63l2.378,5.654h13.83l2.378-5.738v5.714h66.208l-0.031-12.088h1.281\n c0.897,0.031,1.159,0.114,1.159,1.595v10.493h34.243v-2.814c2.762,1.48,7.058,2.814,12.711,2.814h14.406l3.083-7.364h6.835\n l3.015,7.364h27.761v-6.995l4.204,6.995h22.246v-46.24h-22.016v5.461l-3.083-5.461H228.77v5.461l-2.831-5.461h-30.515\n c-5.108,0-9.598,0.713-13.225,2.7v-2.7h-21.058v2.7c-2.308-2.048-5.453-2.7-8.95-2.7H75.258l-5.162,11.943l-5.301-11.943H40.563\n v5.461l-2.662-5.461H17.235l-9.597,21.985V150.86z"
|
|
617
617
|
}),
|
|
618
|
-
/* @__PURE__ */
|
|
618
|
+
/* @__PURE__ */ F("path", {
|
|
619
619
|
fill: "#FFFFFF",
|
|
620
620
|
d: "M289.584,175.315h-14.443c-1.442,0-2.4,0.054-3.207,0.599c-0.836,0.537-1.158,1.334-1.158,2.386\n c0,1.251,0.706,2.102,1.733,2.47c0.836,0.291,1.734,0.376,3.054,0.376l4.295,0.115c4.334,0.107,7.227,0.852,8.991,2.669\n c0.321,0.253,0.514,0.537,0.735,0.821 M289.584,197.178c-1.925,2.815-5.676,4.242-10.754,4.242h-15.304v-7.111h15.242\n c1.512,0,2.57-0.199,3.207-0.821c0.552-0.513,0.937-1.258,0.937-2.163c0-0.966-0.385-1.733-0.968-2.193\n c-0.575-0.506-1.412-0.736-2.792-0.736c-7.441-0.253-16.724,0.23-16.724-10.264c0-4.81,3.054-9.873,11.37-9.873h15.785v-6.598\n h-14.666c-4.426,0-7.641,1.06-9.918,2.708v-2.708h-21.693c-3.469,0-7.541,0.86-9.467,2.708v-2.708h-38.738v2.708\n c-3.083-2.224-8.285-2.708-10.686-2.708h-25.552v2.708c-2.439-2.362-7.863-2.708-11.169-2.708h-28.597l-6.544,7.082l-6.129-7.082\n H63.706v46.272h41.914l6.743-7.194l6.352,7.194l25.836,0.023v-10.885h2.54c3.428,0.053,7.471-0.085,11.038-1.627v12.488h21.31\n v-12.06h1.028c1.312,0,1.441,0.054,1.441,1.365v10.694h64.736c4.11,0,8.406-1.052,10.785-2.961v2.961h20.534\n c4.273,0,8.446-0.599,11.621-2.133V197.178z M257.973,183.93c1.543,1.597,2.37,3.613,2.37,7.026c0,7.134-4.457,10.464-12.449,10.464\n h-15.435v-7.111h15.373c1.503,0,2.569-0.199,3.237-0.821c0.545-0.513,0.936-1.258,0.936-2.163c0-0.966-0.423-1.733-0.967-2.193\n c-0.606-0.506-1.442-0.736-2.822-0.736c-7.411-0.253-16.692,0.23-16.692-10.264c0-4.81,3.022-9.873,11.33-9.873h15.887v7.058\n h-14.537c-1.441,0-2.378,0.054-3.175,0.599c-0.868,0.537-1.19,1.334-1.19,2.386c0,1.251,0.737,2.102,1.734,2.47\n c0.836,0.291,1.734,0.376,3.084,0.376l4.266,0.115C253.225,181.368,256.178,182.112,257.973,183.93z M186.465,181.882\n c-1.06,0.629-2.371,0.683-3.913,0.683h-9.627v-7.448h9.758c1.411,0,2.823,0.03,3.782,0.599c1.027,0.537,1.641,1.564,1.641,2.983\n S187.492,181.261,186.465,181.882z M191.251,186.009c1.764,0.651,3.206,1.818,3.882,2.784c1.119,1.619,1.281,3.13,1.313,6.053v6.574\n h-7.956v-4.149c0-1.995,0.192-4.949-1.281-6.491c-1.158-1.188-2.923-1.472-5.814-1.472h-8.469v12.112h-7.963v-33.162h18.296\n c4.012,0,6.934,0.177,9.535,1.565c2.501,1.511,4.074,3.581,4.074,7.364C196.867,182.48,193.337,185.181,191.251,186.009z\n M201.262,168.258h26.449v6.858h-18.557v6.029h18.104v6.766h-18.104v6.598l18.557,0.03v6.881h-26.449V168.258z M147.795,183.562\n h-10.241v-8.445h10.333c2.861,0,4.847,1.166,4.847,4.066C152.734,182.051,150.84,183.562,147.795,183.562z M129.661,198.404\n l-12.167-13.508l12.167-13.079V198.404z M98.24,194.509H78.756v-6.598h17.398v-6.766H78.756v-6.029h19.868l8.668,9.664\n L98.24,194.509z M161.242,179.183c0,9.212-6.873,11.114-13.8,11.114h-9.888v11.123h-15.403l-9.758-10.978l-10.141,10.978h-31.39\n v-33.162h31.873l9.75,10.87l10.08-10.87h25.322C154.176,168.258,161.242,169.999,161.242,179.183z"
|
|
621
621
|
})
|
|
@@ -624,74 +624,74 @@ function Xe() {
|
|
|
624
624
|
}
|
|
625
625
|
function Ze({ brand: e, fallback: t, className: n }) {
|
|
626
626
|
let r = qe(e);
|
|
627
|
-
return /* @__PURE__ */
|
|
627
|
+
return /* @__PURE__ */ F("span", {
|
|
628
628
|
"aria-hidden": !0,
|
|
629
|
-
className:
|
|
630
|
-
children: r === "visa" ? /* @__PURE__ */
|
|
629
|
+
className: L("grid h-7 w-11 shrink-0 place-items-center overflow-hidden rounded-md", r ? "bg-white" : "bg-muted text-[10px] font-semibold tracking-wide text-muted-foreground uppercase", n),
|
|
630
|
+
children: r === "visa" ? /* @__PURE__ */ F(Je, {}) : r === "mastercard" ? /* @__PURE__ */ F(Ye, {}) : r === "amex" ? /* @__PURE__ */ F(Xe, {}) : t
|
|
631
631
|
});
|
|
632
632
|
}
|
|
633
633
|
//#endregion
|
|
634
634
|
//#region src/components/ui/alert-dialog.tsx
|
|
635
635
|
function Qe({ ...e }) {
|
|
636
|
-
return /* @__PURE__ */
|
|
636
|
+
return /* @__PURE__ */ F(z.Root, {
|
|
637
637
|
"data-slot": "alert-dialog",
|
|
638
638
|
...e
|
|
639
639
|
});
|
|
640
640
|
}
|
|
641
641
|
function $e({ ...e }) {
|
|
642
|
-
return /* @__PURE__ */
|
|
642
|
+
return /* @__PURE__ */ F(z.Portal, {
|
|
643
643
|
"data-slot": "alert-dialog-portal",
|
|
644
644
|
...e
|
|
645
645
|
});
|
|
646
646
|
}
|
|
647
647
|
function et({ className: e, ...t }) {
|
|
648
|
-
return /* @__PURE__ */
|
|
648
|
+
return /* @__PURE__ */ F(z.Backdrop, {
|
|
649
649
|
"data-slot": "alert-dialog-overlay",
|
|
650
|
-
className:
|
|
650
|
+
className: L("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", e),
|
|
651
651
|
...t
|
|
652
652
|
});
|
|
653
653
|
}
|
|
654
654
|
function tt({ className: e, size: t = "default", ...n }) {
|
|
655
|
-
return /* @__PURE__ */
|
|
655
|
+
return /* @__PURE__ */ I($e, { children: [/* @__PURE__ */ F(et, {}), /* @__PURE__ */ F(z.Popup, {
|
|
656
656
|
"data-slot": "alert-dialog-content",
|
|
657
657
|
"data-size": t,
|
|
658
|
-
className:
|
|
658
|
+
className: L("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", e),
|
|
659
659
|
...n
|
|
660
660
|
})] });
|
|
661
661
|
}
|
|
662
662
|
function nt({ className: e, ...t }) {
|
|
663
|
-
return /* @__PURE__ */
|
|
663
|
+
return /* @__PURE__ */ F("div", {
|
|
664
664
|
"data-slot": "alert-dialog-header",
|
|
665
|
-
className:
|
|
665
|
+
className: L("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]", e),
|
|
666
666
|
...t
|
|
667
667
|
});
|
|
668
668
|
}
|
|
669
669
|
function rt({ className: e, ...t }) {
|
|
670
|
-
return /* @__PURE__ */
|
|
670
|
+
return /* @__PURE__ */ F("div", {
|
|
671
671
|
"data-slot": "alert-dialog-footer",
|
|
672
|
-
className:
|
|
672
|
+
className: L("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end", e),
|
|
673
673
|
...t
|
|
674
674
|
});
|
|
675
675
|
}
|
|
676
676
|
function it({ className: e, ...t }) {
|
|
677
|
-
return /* @__PURE__ */
|
|
677
|
+
return /* @__PURE__ */ F(z.Title, {
|
|
678
678
|
"data-slot": "alert-dialog-title",
|
|
679
|
-
className:
|
|
679
|
+
className: L("text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2", e),
|
|
680
680
|
...t
|
|
681
681
|
});
|
|
682
682
|
}
|
|
683
683
|
function at({ className: e, ...t }) {
|
|
684
|
-
return /* @__PURE__ */
|
|
684
|
+
return /* @__PURE__ */ F(z.Description, {
|
|
685
685
|
"data-slot": "alert-dialog-description",
|
|
686
|
-
className:
|
|
686
|
+
className: L("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", e),
|
|
687
687
|
...t
|
|
688
688
|
});
|
|
689
689
|
}
|
|
690
690
|
function ot({ className: e, variant: t = "outline", size: n = "default", ...r }) {
|
|
691
|
-
return /* @__PURE__ */
|
|
691
|
+
return /* @__PURE__ */ F(z.Close, {
|
|
692
692
|
"data-slot": "alert-dialog-cancel",
|
|
693
|
-
className:
|
|
694
|
-
render: /* @__PURE__ */
|
|
693
|
+
className: L(e),
|
|
694
|
+
render: /* @__PURE__ */ F(U, {
|
|
695
695
|
variant: t,
|
|
696
696
|
size: n
|
|
697
697
|
}),
|
|
@@ -701,40 +701,40 @@ function ot({ className: e, variant: t = "outline", size: n = "default", ...r })
|
|
|
701
701
|
//#endregion
|
|
702
702
|
//#region src/components/ui/dialog.tsx
|
|
703
703
|
function st({ ...e }) {
|
|
704
|
-
return /* @__PURE__ */
|
|
704
|
+
return /* @__PURE__ */ F(B.Root, {
|
|
705
705
|
"data-slot": "dialog",
|
|
706
706
|
...e
|
|
707
707
|
});
|
|
708
708
|
}
|
|
709
709
|
function ct({ ...e }) {
|
|
710
|
-
return /* @__PURE__ */
|
|
710
|
+
return /* @__PURE__ */ F(B.Portal, {
|
|
711
711
|
"data-slot": "dialog-portal",
|
|
712
712
|
...e
|
|
713
713
|
});
|
|
714
714
|
}
|
|
715
715
|
function lt({ className: e, ...t }) {
|
|
716
|
-
return /* @__PURE__ */
|
|
716
|
+
return /* @__PURE__ */ F(B.Backdrop, {
|
|
717
717
|
"data-slot": "dialog-overlay",
|
|
718
|
-
className:
|
|
718
|
+
className: L("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", e),
|
|
719
719
|
...t
|
|
720
720
|
});
|
|
721
721
|
}
|
|
722
722
|
function ut({ className: e, children: t, showCloseButton: n = !0, ...r }) {
|
|
723
|
-
return /* @__PURE__ */
|
|
723
|
+
return /* @__PURE__ */ I(ct, { children: [/* @__PURE__ */ F(lt, {}), /* @__PURE__ */ I(B.Popup, {
|
|
724
724
|
"data-slot": "dialog-content",
|
|
725
|
-
className:
|
|
725
|
+
className: L("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", e),
|
|
726
726
|
...r,
|
|
727
|
-
children: [t, n && /* @__PURE__ */
|
|
727
|
+
children: [t, n && /* @__PURE__ */ I(B.Close, {
|
|
728
728
|
"data-slot": "dialog-close",
|
|
729
|
-
render: /* @__PURE__ */
|
|
729
|
+
render: /* @__PURE__ */ F(U, {
|
|
730
730
|
variant: "ghost",
|
|
731
731
|
className: "absolute top-4 right-4",
|
|
732
732
|
size: "icon-sm"
|
|
733
733
|
}),
|
|
734
|
-
children: [/* @__PURE__ */
|
|
735
|
-
icon:
|
|
734
|
+
children: [/* @__PURE__ */ F(ce, {
|
|
735
|
+
icon: de,
|
|
736
736
|
strokeWidth: 2
|
|
737
|
-
}), /* @__PURE__ */
|
|
737
|
+
}), /* @__PURE__ */ F("span", {
|
|
738
738
|
className: "sr-only",
|
|
739
739
|
children: "Close"
|
|
740
740
|
})]
|
|
@@ -742,34 +742,34 @@ function ut({ className: e, children: t, showCloseButton: n = !0, ...r }) {
|
|
|
742
742
|
})] });
|
|
743
743
|
}
|
|
744
744
|
function dt({ className: e, ...t }) {
|
|
745
|
-
return /* @__PURE__ */
|
|
745
|
+
return /* @__PURE__ */ F("div", {
|
|
746
746
|
"data-slot": "dialog-header",
|
|
747
|
-
className:
|
|
747
|
+
className: L("flex flex-col gap-2", e),
|
|
748
748
|
...t
|
|
749
749
|
});
|
|
750
750
|
}
|
|
751
751
|
function ft({ className: e, showCloseButton: t = !1, children: n, ...r }) {
|
|
752
|
-
return /* @__PURE__ */
|
|
752
|
+
return /* @__PURE__ */ I("div", {
|
|
753
753
|
"data-slot": "dialog-footer",
|
|
754
|
-
className:
|
|
754
|
+
className: L("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", e),
|
|
755
755
|
...r,
|
|
756
|
-
children: [n, t && /* @__PURE__ */
|
|
757
|
-
render: /* @__PURE__ */
|
|
756
|
+
children: [n, t && /* @__PURE__ */ F(B.Close, {
|
|
757
|
+
render: /* @__PURE__ */ F(U, { variant: "outline" }),
|
|
758
758
|
children: "Close"
|
|
759
759
|
})]
|
|
760
760
|
});
|
|
761
761
|
}
|
|
762
762
|
function pt({ className: e, ...t }) {
|
|
763
|
-
return /* @__PURE__ */
|
|
763
|
+
return /* @__PURE__ */ F(B.Title, {
|
|
764
764
|
"data-slot": "dialog-title",
|
|
765
|
-
className:
|
|
765
|
+
className: L("leading-none font-medium", e),
|
|
766
766
|
...t
|
|
767
767
|
});
|
|
768
768
|
}
|
|
769
769
|
function mt({ className: e, ...t }) {
|
|
770
|
-
return /* @__PURE__ */
|
|
770
|
+
return /* @__PURE__ */ F(B.Description, {
|
|
771
771
|
"data-slot": "dialog-description",
|
|
772
|
-
className:
|
|
772
|
+
className: L("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", e),
|
|
773
773
|
...t
|
|
774
774
|
});
|
|
775
775
|
}
|
|
@@ -777,32 +777,32 @@ function mt({ className: e, ...t }) {
|
|
|
777
777
|
//#region src/components/ui/spinner.tsx
|
|
778
778
|
function X({ className: e, ...t }) {
|
|
779
779
|
let { t: n } = S();
|
|
780
|
-
return /* @__PURE__ */
|
|
781
|
-
icon:
|
|
780
|
+
return /* @__PURE__ */ F(ce, {
|
|
781
|
+
icon: pe,
|
|
782
782
|
strokeWidth: 2,
|
|
783
783
|
"data-slot": "spinner",
|
|
784
784
|
role: "status",
|
|
785
785
|
"aria-label": n("common.loading"),
|
|
786
|
-
className:
|
|
786
|
+
className: L("size-4 animate-spin", e),
|
|
787
787
|
...t
|
|
788
788
|
});
|
|
789
789
|
}
|
|
790
790
|
//#endregion
|
|
791
791
|
//#region src/components/ui/input.tsx
|
|
792
792
|
function ht({ className: e, type: t, ...n }) {
|
|
793
|
-
return /* @__PURE__ */
|
|
793
|
+
return /* @__PURE__ */ F(me, {
|
|
794
794
|
type: t,
|
|
795
795
|
"data-slot": "input",
|
|
796
|
-
className:
|
|
796
|
+
className: L("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", e),
|
|
797
797
|
...n
|
|
798
798
|
});
|
|
799
799
|
}
|
|
800
800
|
//#endregion
|
|
801
801
|
//#region src/components/ui/label.tsx
|
|
802
802
|
function Z({ className: e, ...t }) {
|
|
803
|
-
return /* @__PURE__ */
|
|
803
|
+
return /* @__PURE__ */ F("label", {
|
|
804
804
|
"data-slot": "label",
|
|
805
|
-
className:
|
|
805
|
+
className: L("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", e),
|
|
806
806
|
...t
|
|
807
807
|
});
|
|
808
808
|
}
|
|
@@ -825,7 +825,7 @@ var gt = "AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH B
|
|
|
825
825
|
}, yt = new Intl.DisplayNames(["en"], { type: "region" }), bt = gt.map((e) => ({
|
|
826
826
|
code: e,
|
|
827
827
|
name: yt.of(e) ?? e
|
|
828
|
-
})).sort((e, t) => e.name.localeCompare(t.name)), xt =
|
|
828
|
+
})).sort((e, t) => e.name.localeCompare(t.name)), xt = M.string().trim().min(1, "Name on card is required").max(200, "Name on card is too long"), St = M.string().trim().regex(/^[A-Za-z]{2}$/, "Select a country").transform((e) => e.toUpperCase());
|
|
829
829
|
function Ct(e) {
|
|
830
830
|
let t = e.trim().toUpperCase();
|
|
831
831
|
return t === "" || !_t.has(t);
|
|
@@ -839,10 +839,10 @@ function wt(e, t) {
|
|
|
839
839
|
pattern: n === "US" ? "[0-9]{5}(?:-[0-9]{4})?" : void 0
|
|
840
840
|
};
|
|
841
841
|
}
|
|
842
|
-
var Tt =
|
|
842
|
+
var Tt = M.object({
|
|
843
843
|
name_on_card: xt,
|
|
844
844
|
country: St,
|
|
845
|
-
zip:
|
|
845
|
+
zip: M.string().trim().max(32, "Postal code is too long")
|
|
846
846
|
}).superRefine((e, t) => {
|
|
847
847
|
Ct(e.country) && !e.zip && t.addIssue({
|
|
848
848
|
code: "custom",
|
|
@@ -889,13 +889,13 @@ function kt(e) {
|
|
|
889
889
|
//#region src/components/billing-fields.tsx
|
|
890
890
|
var At = "text-[13px] font-medium text-foreground", jt = "h-[38px] rounded-[9px] border border-input bg-card text-sm text-foreground", Mt = `${jt} px-2.5`;
|
|
891
891
|
function Nt({ id: e, name: t, label: n, value: r, onChange: i, autoComplete: a, placeholder: o, disabled: s, maxLength: c, required: l, type: u, inputMode: d, pattern: f }) {
|
|
892
|
-
return /* @__PURE__ */
|
|
892
|
+
return /* @__PURE__ */ I("div", {
|
|
893
893
|
className: "grid gap-1.5",
|
|
894
|
-
children: [/* @__PURE__ */
|
|
894
|
+
children: [/* @__PURE__ */ F(Z, {
|
|
895
895
|
htmlFor: e,
|
|
896
896
|
className: At,
|
|
897
897
|
children: n
|
|
898
|
-
}), /* @__PURE__ */
|
|
898
|
+
}), /* @__PURE__ */ F(ht, {
|
|
899
899
|
id: e,
|
|
900
900
|
name: t,
|
|
901
901
|
type: u,
|
|
@@ -913,13 +913,13 @@ function Nt({ id: e, name: t, label: n, value: r, onChange: i, autoComplete: a,
|
|
|
913
913
|
});
|
|
914
914
|
}
|
|
915
915
|
function Pt({ id: e, value: t, onChange: n, disabled: r }) {
|
|
916
|
-
return /* @__PURE__ */
|
|
916
|
+
return /* @__PURE__ */ I("div", {
|
|
917
917
|
className: "grid gap-1.5",
|
|
918
|
-
children: [/* @__PURE__ */
|
|
918
|
+
children: [/* @__PURE__ */ F(Z, {
|
|
919
919
|
htmlFor: e,
|
|
920
920
|
className: At,
|
|
921
921
|
children: "Country"
|
|
922
|
-
}), /* @__PURE__ */
|
|
922
|
+
}), /* @__PURE__ */ I("select", {
|
|
923
923
|
id: e,
|
|
924
924
|
name: "country",
|
|
925
925
|
className: `${jt} w-full px-2.5`,
|
|
@@ -928,10 +928,10 @@ function Pt({ id: e, value: t, onChange: n, disabled: r }) {
|
|
|
928
928
|
disabled: r,
|
|
929
929
|
required: !0,
|
|
930
930
|
onChange: (e) => n(e.target.value),
|
|
931
|
-
children: [/* @__PURE__ */
|
|
931
|
+
children: [/* @__PURE__ */ F("option", {
|
|
932
932
|
value: "",
|
|
933
933
|
children: "Select country"
|
|
934
|
-
}), bt.map((e) => /* @__PURE__ */
|
|
934
|
+
}), bt.map((e) => /* @__PURE__ */ F("option", {
|
|
935
935
|
value: e.code,
|
|
936
936
|
children: e.name
|
|
937
937
|
}, e.code))]
|
|
@@ -940,9 +940,9 @@ function Pt({ id: e, value: t, onChange: n, disabled: r }) {
|
|
|
940
940
|
}
|
|
941
941
|
function Ft({ id: e, value: t, country: n, onChange: r, disabled: i, required: a, error: o }) {
|
|
942
942
|
let s = wt(n, a);
|
|
943
|
-
return /* @__PURE__ */
|
|
943
|
+
return /* @__PURE__ */ I("div", {
|
|
944
944
|
className: "grid gap-1.5",
|
|
945
|
-
children: [/* @__PURE__ */
|
|
945
|
+
children: [/* @__PURE__ */ F(Nt, {
|
|
946
946
|
id: e,
|
|
947
947
|
name: "zip",
|
|
948
948
|
label: s.label,
|
|
@@ -955,7 +955,7 @@ function Ft({ id: e, value: t, country: n, onChange: r, disabled: i, required: a
|
|
|
955
955
|
required: a,
|
|
956
956
|
inputMode: s.inputMode,
|
|
957
957
|
pattern: s.pattern
|
|
958
|
-
}), o ? /* @__PURE__ */
|
|
958
|
+
}), o ? /* @__PURE__ */ F("p", {
|
|
959
959
|
className: "text-[12.5px] text-destructive",
|
|
960
960
|
role: "alert",
|
|
961
961
|
children: o
|
|
@@ -967,9 +967,9 @@ function It({ idPrefix: e, value: t, onChange: n, disabled: r, postalError: i })
|
|
|
967
967
|
...t,
|
|
968
968
|
[e]: r
|
|
969
969
|
}), o = Ct(t.country);
|
|
970
|
-
return /* @__PURE__ */
|
|
970
|
+
return /* @__PURE__ */ I("div", {
|
|
971
971
|
className: "grid gap-3",
|
|
972
|
-
children: [/* @__PURE__ */
|
|
972
|
+
children: [/* @__PURE__ */ F(Nt, {
|
|
973
973
|
id: `${e}-name-on-card`,
|
|
974
974
|
name: "name_on_card",
|
|
975
975
|
label: "Name on card",
|
|
@@ -980,14 +980,14 @@ function It({ idPrefix: e, value: t, onChange: n, disabled: r, postalError: i })
|
|
|
980
980
|
disabled: r,
|
|
981
981
|
maxLength: 200,
|
|
982
982
|
required: !0
|
|
983
|
-
}), /* @__PURE__ */
|
|
983
|
+
}), /* @__PURE__ */ I("div", {
|
|
984
984
|
className: "grid grid-cols-2 gap-3",
|
|
985
|
-
children: [/* @__PURE__ */
|
|
985
|
+
children: [/* @__PURE__ */ F(Pt, {
|
|
986
986
|
id: `${e}-country`,
|
|
987
987
|
value: t.country,
|
|
988
988
|
onChange: a("country"),
|
|
989
989
|
disabled: r
|
|
990
|
-
}), /* @__PURE__ */
|
|
990
|
+
}), /* @__PURE__ */ F(Ft, {
|
|
991
991
|
id: `${e}-postal-code`,
|
|
992
992
|
value: t.zip,
|
|
993
993
|
country: t.country,
|
|
@@ -1002,7 +1002,7 @@ function It({ idPrefix: e, value: t, onChange: n, disabled: r, postalError: i })
|
|
|
1002
1002
|
//#endregion
|
|
1003
1003
|
//#region src/components/card-fields.tsx
|
|
1004
1004
|
function Lt({ id: e, message: t }) {
|
|
1005
|
-
return t ? /* @__PURE__ */
|
|
1005
|
+
return t ? /* @__PURE__ */ F("p", {
|
|
1006
1006
|
id: e,
|
|
1007
1007
|
className: "text-[12.5px] text-destructive",
|
|
1008
1008
|
role: "alert",
|
|
@@ -1011,80 +1011,80 @@ function Lt({ id: e, message: t }) {
|
|
|
1011
1011
|
}
|
|
1012
1012
|
var Rt = "orck-collect-field h-[38px] overflow-hidden rounded-[9px] border border-[color:var(--border)] bg-card px-[3px]", zt = "flex h-[38px] items-center rounded-[9px] border border-[color:var(--border)] bg-card px-[11px] text-sm text-[color:var(--orck-faint)] tabular-nums";
|
|
1013
1013
|
function Bt({ ids: e, preview: t, error: n, fieldErrors: r = {}, hidden: i }) {
|
|
1014
|
-
return /* @__PURE__ */
|
|
1015
|
-
className:
|
|
1014
|
+
return /* @__PURE__ */ I("div", {
|
|
1015
|
+
className: L("grid gap-3", i && "hidden"),
|
|
1016
1016
|
"aria-hidden": i || void 0,
|
|
1017
1017
|
children: [
|
|
1018
|
-
/* @__PURE__ */
|
|
1018
|
+
/* @__PURE__ */ I("div", {
|
|
1019
1019
|
className: "grid gap-1.5",
|
|
1020
1020
|
children: [
|
|
1021
|
-
/* @__PURE__ */
|
|
1021
|
+
/* @__PURE__ */ F(Z, {
|
|
1022
1022
|
htmlFor: e.number,
|
|
1023
1023
|
className: "text-[13px] font-medium text-foreground",
|
|
1024
1024
|
children: "Card number"
|
|
1025
1025
|
}),
|
|
1026
|
-
t ? /* @__PURE__ */
|
|
1026
|
+
t ? /* @__PURE__ */ F("div", {
|
|
1027
1027
|
id: e.number,
|
|
1028
1028
|
className: zt,
|
|
1029
1029
|
children: "1234 1234 1234 1234"
|
|
1030
|
-
}) : /* @__PURE__ */
|
|
1030
|
+
}) : /* @__PURE__ */ F("div", {
|
|
1031
1031
|
id: e.number,
|
|
1032
|
-
className:
|
|
1032
|
+
className: L(Rt, r.number && "border-destructive")
|
|
1033
1033
|
}),
|
|
1034
|
-
/* @__PURE__ */
|
|
1034
|
+
/* @__PURE__ */ F(Lt, {
|
|
1035
1035
|
id: `${e.number}-error`,
|
|
1036
1036
|
message: r.number
|
|
1037
1037
|
})
|
|
1038
1038
|
]
|
|
1039
1039
|
}),
|
|
1040
|
-
/* @__PURE__ */
|
|
1040
|
+
/* @__PURE__ */ I("div", {
|
|
1041
1041
|
className: "grid grid-cols-2 gap-3",
|
|
1042
|
-
children: [/* @__PURE__ */
|
|
1042
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1043
1043
|
className: "grid gap-1.5",
|
|
1044
1044
|
children: [
|
|
1045
|
-
/* @__PURE__ */
|
|
1045
|
+
/* @__PURE__ */ F(Z, {
|
|
1046
1046
|
htmlFor: e.expiry,
|
|
1047
1047
|
className: "text-[13px] font-medium text-foreground",
|
|
1048
1048
|
children: "Expiry"
|
|
1049
1049
|
}),
|
|
1050
|
-
t ? /* @__PURE__ */
|
|
1050
|
+
t ? /* @__PURE__ */ F("div", {
|
|
1051
1051
|
id: e.expiry,
|
|
1052
1052
|
className: zt,
|
|
1053
1053
|
children: "MM / YY"
|
|
1054
|
-
}) : /* @__PURE__ */
|
|
1054
|
+
}) : /* @__PURE__ */ F("div", {
|
|
1055
1055
|
id: e.expiry,
|
|
1056
|
-
className:
|
|
1056
|
+
className: L(Rt, r.expiry && "border-destructive")
|
|
1057
1057
|
}),
|
|
1058
|
-
/* @__PURE__ */
|
|
1058
|
+
/* @__PURE__ */ F(Lt, {
|
|
1059
1059
|
id: `${e.expiry}-error`,
|
|
1060
1060
|
message: r.expiry
|
|
1061
1061
|
})
|
|
1062
1062
|
]
|
|
1063
|
-
}), /* @__PURE__ */
|
|
1063
|
+
}), /* @__PURE__ */ I("div", {
|
|
1064
1064
|
className: "grid gap-1.5",
|
|
1065
1065
|
children: [
|
|
1066
|
-
/* @__PURE__ */
|
|
1066
|
+
/* @__PURE__ */ F(Z, {
|
|
1067
1067
|
htmlFor: e.cvv,
|
|
1068
1068
|
className: "text-[13px] font-medium text-foreground",
|
|
1069
1069
|
children: "CVC"
|
|
1070
1070
|
}),
|
|
1071
|
-
t ? /* @__PURE__ */
|
|
1071
|
+
t ? /* @__PURE__ */ F("div", {
|
|
1072
1072
|
id: e.cvv,
|
|
1073
1073
|
className: zt,
|
|
1074
1074
|
children: "CVC"
|
|
1075
|
-
}) : /* @__PURE__ */
|
|
1075
|
+
}) : /* @__PURE__ */ F("div", {
|
|
1076
1076
|
id: e.cvv,
|
|
1077
|
-
className:
|
|
1077
|
+
className: L(Rt, r.cvv && "border-destructive")
|
|
1078
1078
|
}),
|
|
1079
|
-
/* @__PURE__ */
|
|
1079
|
+
/* @__PURE__ */ F(Lt, {
|
|
1080
1080
|
id: `${e.cvv}-error`,
|
|
1081
1081
|
message: r.cvv
|
|
1082
1082
|
})
|
|
1083
1083
|
]
|
|
1084
1084
|
})]
|
|
1085
1085
|
}),
|
|
1086
|
-
n ? /* @__PURE__ */
|
|
1087
|
-
className:
|
|
1086
|
+
n ? /* @__PURE__ */ F("p", {
|
|
1087
|
+
className: L("text-[13px] text-destructive"),
|
|
1088
1088
|
role: "alert",
|
|
1089
1089
|
children: n
|
|
1090
1090
|
}) : null
|
|
@@ -1096,10 +1096,10 @@ function Ht({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1096
1096
|
let a = {
|
|
1097
1097
|
...t.fieldErrors,
|
|
1098
1098
|
...n
|
|
1099
|
-
}, o = (e, n, i, a) => /* @__PURE__ */
|
|
1099
|
+
}, o = (e, n, i, a) => /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("input", {
|
|
1100
1100
|
id: e,
|
|
1101
1101
|
name: `card-${n}`,
|
|
1102
|
-
className:
|
|
1102
|
+
className: L(Vt, i && "border-destructive"),
|
|
1103
1103
|
value: t.input[n],
|
|
1104
1104
|
onChange: (e) => t.change(n, e.target.value),
|
|
1105
1105
|
onBlur: () => t.leave(n),
|
|
@@ -1110,16 +1110,16 @@ function Ht({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1110
1110
|
"aria-invalid": i ? !0 : void 0,
|
|
1111
1111
|
"aria-describedby": i ? `${e}-error` : void 0,
|
|
1112
1112
|
...a
|
|
1113
|
-
}), /* @__PURE__ */
|
|
1113
|
+
}), /* @__PURE__ */ F(Lt, {
|
|
1114
1114
|
id: `${e}-error`,
|
|
1115
1115
|
message: i
|
|
1116
1116
|
})] });
|
|
1117
|
-
return /* @__PURE__ */
|
|
1118
|
-
className:
|
|
1117
|
+
return /* @__PURE__ */ I("div", {
|
|
1118
|
+
className: L("grid gap-3", i && "hidden"),
|
|
1119
1119
|
"aria-hidden": i || void 0,
|
|
1120
|
-
children: [/* @__PURE__ */
|
|
1120
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1121
1121
|
className: "grid gap-1.5",
|
|
1122
|
-
children: [/* @__PURE__ */
|
|
1122
|
+
children: [/* @__PURE__ */ F(Z, {
|
|
1123
1123
|
htmlFor: e.number,
|
|
1124
1124
|
className: "text-[13px] font-medium text-foreground",
|
|
1125
1125
|
children: "Card number"
|
|
@@ -1128,11 +1128,11 @@ function Ht({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1128
1128
|
placeholder: "1234 1234 1234 1234",
|
|
1129
1129
|
maxLength: 23
|
|
1130
1130
|
})]
|
|
1131
|
-
}), /* @__PURE__ */
|
|
1131
|
+
}), /* @__PURE__ */ I("div", {
|
|
1132
1132
|
className: "grid grid-cols-2 gap-3",
|
|
1133
|
-
children: [/* @__PURE__ */
|
|
1133
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1134
1134
|
className: "grid gap-1.5",
|
|
1135
|
-
children: [/* @__PURE__ */
|
|
1135
|
+
children: [/* @__PURE__ */ F(Z, {
|
|
1136
1136
|
htmlFor: e.expiry,
|
|
1137
1137
|
className: "text-[13px] font-medium text-foreground",
|
|
1138
1138
|
children: "Expiry"
|
|
@@ -1141,9 +1141,9 @@ function Ht({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1141
1141
|
placeholder: "MM / YY",
|
|
1142
1142
|
maxLength: 7
|
|
1143
1143
|
})]
|
|
1144
|
-
}), /* @__PURE__ */
|
|
1144
|
+
}), /* @__PURE__ */ I("div", {
|
|
1145
1145
|
className: "grid gap-1.5",
|
|
1146
|
-
children: [/* @__PURE__ */
|
|
1146
|
+
children: [/* @__PURE__ */ F(Z, {
|
|
1147
1147
|
htmlFor: e.cvv,
|
|
1148
1148
|
className: "text-[13px] font-medium text-foreground",
|
|
1149
1149
|
children: "CVC"
|
|
@@ -1159,49 +1159,49 @@ function Ht({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1159
1159
|
//#endregion
|
|
1160
1160
|
//#region src/components/pay-button.tsx
|
|
1161
1161
|
function Q({ label: e, processing: t, disabled: n }) {
|
|
1162
|
-
return /* @__PURE__ */
|
|
1162
|
+
return /* @__PURE__ */ F(U, {
|
|
1163
1163
|
type: "submit",
|
|
1164
|
-
className:
|
|
1164
|
+
className: L("h-[42px] w-full rounded-[10px] text-sm font-semibold tabular-nums", t && "opacity-75"),
|
|
1165
1165
|
disabled: n || t,
|
|
1166
|
-
children: t ? /* @__PURE__ */
|
|
1166
|
+
children: t ? /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("span", {
|
|
1167
1167
|
"aria-hidden": !0,
|
|
1168
1168
|
className: "size-3.5 animate-spin rounded-full border-2 border-[color:var(--primary-foreground)]/35 border-t-[color:var(--primary-foreground)] motion-reduce:animate-none"
|
|
1169
1169
|
}), "Processing…"] }) : e
|
|
1170
1170
|
});
|
|
1171
1171
|
}
|
|
1172
1172
|
function Ut() {
|
|
1173
|
-
return /* @__PURE__ */
|
|
1173
|
+
return /* @__PURE__ */ I("div", {
|
|
1174
1174
|
className: "-mt-1 flex items-center justify-center gap-1.5 text-xs text-[color:var(--orck-faint)]",
|
|
1175
|
-
children: [/* @__PURE__ */
|
|
1175
|
+
children: [/* @__PURE__ */ F("svg", {
|
|
1176
1176
|
viewBox: "0 0 16 16",
|
|
1177
1177
|
fill: "currentColor",
|
|
1178
1178
|
"aria-hidden": !0,
|
|
1179
1179
|
className: "size-[11px]",
|
|
1180
|
-
children: /* @__PURE__ */
|
|
1180
|
+
children: /* @__PURE__ */ F("path", { d: "M8 1a3.5 3.5 0 0 0-3.5 3.5V6H4a1.5 1.5 0 0 0-1.5 1.5v5A1.5 1.5 0 0 0 4 14h8a1.5 1.5 0 0 0 1.5-1.5v-5A1.5 1.5 0 0 0 12 6h-.5V4.5A3.5 3.5 0 0 0 8 1Zm2 5H6V4.5a2 2 0 1 1 4 0V6Z" })
|
|
1181
1181
|
}), "Secured by OpenRails"]
|
|
1182
1182
|
});
|
|
1183
1183
|
}
|
|
1184
1184
|
//#endregion
|
|
1185
1185
|
//#region src/components/platform-card-form.tsx
|
|
1186
1186
|
function Wt({ publicKey: e, submitLabel: t, disabled: n, onTokenized: r, purpose: i = "payment", defaultCountry: a }) {
|
|
1187
|
-
let o =
|
|
1187
|
+
let o = N.useId().replace(/[^a-zA-Z0-9-]/g, ""), s = N.useMemo(() => ({
|
|
1188
1188
|
number: `bt-${o}-number`,
|
|
1189
1189
|
expiry: `bt-${o}-expiry`,
|
|
1190
1190
|
cvv: `bt-${o}-cvv`
|
|
1191
|
-
}), [o]), [c, l] =
|
|
1191
|
+
}), [o]), [c, l] = N.useState(() => ({
|
|
1192
1192
|
...Dt,
|
|
1193
1193
|
country: kt(a)
|
|
1194
|
-
})), [u, d] =
|
|
1194
|
+
})), [u, d] = N.useState(!1), [f, p] = N.useState(!1), [m, h] = N.useState(!1), [g, _] = N.useState(!1), [v, y] = N.useState(), b = N.useRef(void 0), x = N.useRef(void 0), S = N.useRef(!1), C = N.useRef({
|
|
1195
1195
|
generation: 0,
|
|
1196
1196
|
disabled: n
|
|
1197
1197
|
});
|
|
1198
|
-
|
|
1198
|
+
N.useLayoutEffect(() => {
|
|
1199
1199
|
C.current = {
|
|
1200
1200
|
generation: C.current.generation + 1,
|
|
1201
1201
|
disabled: n
|
|
1202
1202
|
};
|
|
1203
|
-
}, [e, n]),
|
|
1204
|
-
let t = !0, n =
|
|
1203
|
+
}, [e, n]), N.useEffect(() => {
|
|
1204
|
+
let t = !0, n = j(e), r = n.createElement("cardNumber"), i = n.createElement("expiry"), a = n.createElement("cvv");
|
|
1205
1205
|
return Promise.all([
|
|
1206
1206
|
r.mount(`#${s.number}`),
|
|
1207
1207
|
i.mount(`#${s.expiry}`),
|
|
@@ -1245,32 +1245,32 @@ function Wt({ publicKey: e, submitLabel: t, disabled: n, onTokenized: r, purpose
|
|
|
1245
1245
|
S.current = !1, p(!1);
|
|
1246
1246
|
}
|
|
1247
1247
|
};
|
|
1248
|
-
return /* @__PURE__ */
|
|
1248
|
+
return /* @__PURE__ */ I("form", {
|
|
1249
1249
|
"aria-label": i === "setup" ? "Secure platform card setup" : "Secure platform card payment",
|
|
1250
1250
|
className: "grid gap-4",
|
|
1251
1251
|
onSubmit: (e) => void E(e),
|
|
1252
1252
|
children: [
|
|
1253
|
-
/* @__PURE__ */
|
|
1253
|
+
/* @__PURE__ */ F(It, {
|
|
1254
1254
|
idPrefix: `bt-${o}`,
|
|
1255
1255
|
value: c,
|
|
1256
1256
|
onChange: l,
|
|
1257
1257
|
disabled: n || f || g || m
|
|
1258
1258
|
}),
|
|
1259
|
-
/* @__PURE__ */
|
|
1259
|
+
/* @__PURE__ */ F(Bt, {
|
|
1260
1260
|
ids: s,
|
|
1261
1261
|
preview: !1
|
|
1262
1262
|
}),
|
|
1263
|
-
v ? /* @__PURE__ */
|
|
1263
|
+
v ? /* @__PURE__ */ F("p", {
|
|
1264
1264
|
role: "alert",
|
|
1265
1265
|
className: "text-sm text-destructive",
|
|
1266
1266
|
children: v
|
|
1267
1267
|
}) : null,
|
|
1268
|
-
/* @__PURE__ */
|
|
1268
|
+
/* @__PURE__ */ F(Q, {
|
|
1269
1269
|
label: g ? w : t,
|
|
1270
1270
|
processing: f,
|
|
1271
1271
|
disabled: n || m || !u
|
|
1272
1272
|
}),
|
|
1273
|
-
/* @__PURE__ */
|
|
1273
|
+
/* @__PURE__ */ F(Ut, {})
|
|
1274
1274
|
]
|
|
1275
1275
|
});
|
|
1276
1276
|
}
|
|
@@ -1331,8 +1331,8 @@ var en = {
|
|
|
1331
1331
|
cvv: "Enter a valid security code"
|
|
1332
1332
|
};
|
|
1333
1333
|
function nn(e) {
|
|
1334
|
-
let t = e.enabled && $t(e.tokenizationKey), [n, r] =
|
|
1335
|
-
|
|
1334
|
+
let t = e.enabled && $t(e.tokenizationKey), [n, r] = N.useState(!1), [i, a] = N.useState(), [o, s] = N.useState({}), c = N.useRef(void 0), l = N.useRef(void 0), { number: u, expiry: d, cvv: f } = e.selectors;
|
|
1335
|
+
N.useEffect(() => {
|
|
1336
1336
|
if (!e.enabled || t || !e.tokenizationKey || !e.scriptURL || typeof document > "u") return;
|
|
1337
1337
|
let n = Xt(e.scriptURL);
|
|
1338
1338
|
if (!n) {
|
|
@@ -1451,7 +1451,7 @@ function nn(e) {
|
|
|
1451
1451
|
d,
|
|
1452
1452
|
f
|
|
1453
1453
|
]);
|
|
1454
|
-
let p =
|
|
1454
|
+
let p = N.useCallback(() => new Promise((e, r) => {
|
|
1455
1455
|
if (t) {
|
|
1456
1456
|
e({
|
|
1457
1457
|
token: "preview_payment_token",
|
|
@@ -1549,13 +1549,13 @@ function an(e) {
|
|
|
1549
1549
|
}
|
|
1550
1550
|
//#endregion
|
|
1551
1551
|
//#region src/components/stripe-card.tsx
|
|
1552
|
-
var on =
|
|
1553
|
-
let [s, c] =
|
|
1554
|
-
|
|
1552
|
+
var on = N.forwardRef(function({ psp: e, client: t, defaultCountry: n, onCompleteChange: r, unavailableMessage: i, verificationPendingMessage: a }, o) {
|
|
1553
|
+
let [s, c] = N.useState(), l = N.useRef(null), u = N.useRef(null), d = N.useRef(r);
|
|
1554
|
+
N.useEffect(() => {
|
|
1555
1555
|
d.current = r;
|
|
1556
1556
|
});
|
|
1557
1557
|
let f = e.config?.publishable_key;
|
|
1558
|
-
return
|
|
1558
|
+
return N.useEffect(() => {
|
|
1559
1559
|
if (!f || !l.current) return;
|
|
1560
1560
|
let e = !1, t;
|
|
1561
1561
|
return Kt(f).then((r) => {
|
|
@@ -1588,7 +1588,7 @@ var on = P.forwardRef(function({ psp: e, client: t, defaultCountry: n, onComplet
|
|
|
1588
1588
|
f,
|
|
1589
1589
|
n,
|
|
1590
1590
|
i
|
|
1591
|
-
]),
|
|
1591
|
+
]), N.useImperativeHandle(o, () => {
|
|
1592
1592
|
let n = async () => {
|
|
1593
1593
|
let e = u.current;
|
|
1594
1594
|
if (!e) throw Error(i);
|
|
@@ -1621,12 +1621,12 @@ var on = P.forwardRef(function({ psp: e, client: t, defaultCountry: n, onComplet
|
|
|
1621
1621
|
e.psp_id,
|
|
1622
1622
|
i,
|
|
1623
1623
|
a
|
|
1624
|
-
]), /* @__PURE__ */
|
|
1624
|
+
]), /* @__PURE__ */ I("div", {
|
|
1625
1625
|
className: "grid gap-2",
|
|
1626
|
-
children: [/* @__PURE__ */
|
|
1626
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1627
1627
|
ref: l,
|
|
1628
1628
|
"data-testid": "stripe-card-entry"
|
|
1629
|
-
}), s ? /* @__PURE__ */
|
|
1629
|
+
}), s ? /* @__PURE__ */ F("p", {
|
|
1630
1630
|
role: "alert",
|
|
1631
1631
|
className: "text-[13px] text-destructive",
|
|
1632
1632
|
children: s
|
|
@@ -1692,9 +1692,9 @@ var hn = {
|
|
|
1692
1692
|
cvc: ""
|
|
1693
1693
|
};
|
|
1694
1694
|
function gn() {
|
|
1695
|
-
let [e, t] =
|
|
1695
|
+
let [e, t] = N.useState(hn), [n, r] = N.useState({}), i = pn(e), a = {};
|
|
1696
1696
|
n.number && i.number && (a.number = i.number), n.expiry && i.expiry && (a.expiry = i.expiry), n.cvc && i.cvv && (a.cvv = i.cvv);
|
|
1697
|
-
let o =
|
|
1697
|
+
let o = N.useCallback(() => {
|
|
1698
1698
|
t(hn), r({});
|
|
1699
1699
|
}, []);
|
|
1700
1700
|
return {
|
|
@@ -1723,18 +1723,18 @@ function gn() {
|
|
|
1723
1723
|
//#endregion
|
|
1724
1724
|
//#region src/tokenized-card-form.tsx
|
|
1725
1725
|
function _n({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabel: r = "Save card", disabled: i = !1, defaultCountry: a, appearance: o, className: s }) {
|
|
1726
|
-
let c =
|
|
1726
|
+
let c = N.useId().replace(/[^a-zA-Z0-9-]/g, ""), l = N.useMemo(() => ({
|
|
1727
1727
|
number: `orck-save-${c}-number`,
|
|
1728
1728
|
expiry: `orck-save-${c}-expiry`,
|
|
1729
1729
|
cvv: `orck-save-${c}-cvv`
|
|
1730
|
-
}), [c]), [u, d] =
|
|
1730
|
+
}), [c]), [u, d] = N.useState(() => ({
|
|
1731
1731
|
...Dt,
|
|
1732
1732
|
country: kt(a)
|
|
1733
|
-
})), [f, p] =
|
|
1733
|
+
})), [f, p] = N.useState(!1), [m, h] = N.useState(!1), [g, _] = N.useState(), v = N.useRef({
|
|
1734
1734
|
generation: 0,
|
|
1735
1735
|
disabled: i
|
|
1736
1736
|
});
|
|
1737
|
-
|
|
1737
|
+
N.useLayoutEffect(() => {
|
|
1738
1738
|
v.current = {
|
|
1739
1739
|
generation: v.current.generation + 1,
|
|
1740
1740
|
disabled: i
|
|
@@ -1744,8 +1744,8 @@ function _n({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1744
1744
|
t,
|
|
1745
1745
|
i
|
|
1746
1746
|
]);
|
|
1747
|
-
let y =
|
|
1748
|
-
|
|
1747
|
+
let y = N.useRef(!0);
|
|
1748
|
+
N.useEffect(() => (y.current = !0, () => {
|
|
1749
1749
|
y.current = !1;
|
|
1750
1750
|
}), []);
|
|
1751
1751
|
let b = nn({
|
|
@@ -1781,39 +1781,39 @@ function _n({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1781
1781
|
y.current && p(!1);
|
|
1782
1782
|
}
|
|
1783
1783
|
};
|
|
1784
|
-
return /* @__PURE__ */
|
|
1785
|
-
className:
|
|
1784
|
+
return /* @__PURE__ */ F("div", {
|
|
1785
|
+
className: L("orck", s),
|
|
1786
1786
|
"data-orck-theme": C(o),
|
|
1787
1787
|
style: E(o),
|
|
1788
|
-
children: /* @__PURE__ */
|
|
1788
|
+
children: /* @__PURE__ */ I("form", {
|
|
1789
1789
|
"aria-label": "Secure card setup",
|
|
1790
1790
|
autoComplete: "on",
|
|
1791
1791
|
className: "grid gap-4",
|
|
1792
1792
|
onSubmit: (e) => void x(e),
|
|
1793
1793
|
children: [
|
|
1794
|
-
/* @__PURE__ */
|
|
1794
|
+
/* @__PURE__ */ F(It, {
|
|
1795
1795
|
idPrefix: `orck-save-${c}`,
|
|
1796
1796
|
value: u,
|
|
1797
1797
|
onChange: d,
|
|
1798
1798
|
disabled: i || f || m
|
|
1799
1799
|
}),
|
|
1800
|
-
/* @__PURE__ */
|
|
1800
|
+
/* @__PURE__ */ F(Bt, {
|
|
1801
1801
|
ids: l,
|
|
1802
1802
|
preview: b.preview,
|
|
1803
1803
|
error: b.loadError,
|
|
1804
1804
|
fieldErrors: b.fieldErrors
|
|
1805
1805
|
}),
|
|
1806
|
-
g ? /* @__PURE__ */
|
|
1806
|
+
g ? /* @__PURE__ */ F("p", {
|
|
1807
1807
|
role: "alert",
|
|
1808
1808
|
className: "text-sm text-destructive",
|
|
1809
1809
|
children: g
|
|
1810
1810
|
}) : null,
|
|
1811
|
-
/* @__PURE__ */
|
|
1811
|
+
/* @__PURE__ */ F(Q, {
|
|
1812
1812
|
label: r,
|
|
1813
1813
|
processing: f,
|
|
1814
1814
|
disabled: i || m || !b.ready || !b.valid || !!b.loadError
|
|
1815
1815
|
}),
|
|
1816
|
-
/* @__PURE__ */
|
|
1816
|
+
/* @__PURE__ */ F(Ut, {})
|
|
1817
1817
|
]
|
|
1818
1818
|
})
|
|
1819
1819
|
});
|
|
@@ -1822,15 +1822,15 @@ function _n({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1822
1822
|
//#region src/save-payment-method.tsx
|
|
1823
1823
|
function vn(e) {
|
|
1824
1824
|
let { t } = S(), n = s(e.psp);
|
|
1825
|
-
return n ? /* @__PURE__ */
|
|
1826
|
-
className:
|
|
1825
|
+
return n ? /* @__PURE__ */ I("div", {
|
|
1826
|
+
className: L("orck grid gap-4", e.className),
|
|
1827
1827
|
"data-orck-theme": C(e.appearance),
|
|
1828
1828
|
style: E(e.appearance),
|
|
1829
|
-
children: [/* @__PURE__ */
|
|
1829
|
+
children: [/* @__PURE__ */ F("p", {
|
|
1830
1830
|
className: "text-sm text-muted-foreground",
|
|
1831
1831
|
children: t("paymentMethods.saveNotice")
|
|
1832
|
-
}),
|
|
1833
|
-
}) : /* @__PURE__ */
|
|
1832
|
+
}), F(n === "platform" ? Cn : n === "collect_js" ? bn : n === "card" ? xn : Sn, { ...e })]
|
|
1833
|
+
}) : /* @__PURE__ */ F("p", {
|
|
1834
1834
|
role: "alert",
|
|
1835
1835
|
className: "text-sm text-destructive",
|
|
1836
1836
|
children: t("paymentMethods.unavailable")
|
|
@@ -1838,12 +1838,12 @@ function vn(e) {
|
|
|
1838
1838
|
}
|
|
1839
1839
|
var yn = (e, t) => !n(t) && t instanceof Error && t.message ? t.message : e.error(t);
|
|
1840
1840
|
function bn({ psp: e, onSaved: t, submitLabel: n, appearance: r, defaultCountry: i }) {
|
|
1841
|
-
let a = S(), { client: o, notify: s } = T(), [c, l] =
|
|
1842
|
-
return /* @__PURE__ */
|
|
1841
|
+
let a = S(), { client: o, notify: s } = T(), [c, l] = N.useState(0), [u, d] = N.useState();
|
|
1842
|
+
return /* @__PURE__ */ I(P, { children: [u ? /* @__PURE__ */ F("p", {
|
|
1843
1843
|
role: "alert",
|
|
1844
1844
|
className: "text-sm text-destructive",
|
|
1845
1845
|
children: u
|
|
1846
|
-
}) : null, /* @__PURE__ */
|
|
1846
|
+
}) : null, /* @__PURE__ */ F(_n, {
|
|
1847
1847
|
tokenizationKey: e.config.tokenization_key,
|
|
1848
1848
|
tokenizationURL: e.config.tokenization_url,
|
|
1849
1849
|
onTokenized: async (n) => {
|
|
@@ -1870,14 +1870,14 @@ function bn({ psp: e, onSaved: t, submitLabel: n, appearance: r, defaultCountry:
|
|
|
1870
1870
|
}, c)] });
|
|
1871
1871
|
}
|
|
1872
1872
|
function xn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
1873
|
-
let i = S(), { client: a, notify: o } = T(), s =
|
|
1873
|
+
let i = S(), { client: a, notify: o } = T(), s = N.useId().replace(/[^a-zA-Z0-9-]/g, ""), c = N.useMemo(() => ({
|
|
1874
1874
|
number: `orck-save-${s}-number`,
|
|
1875
1875
|
expiry: `orck-save-${s}-expiry`,
|
|
1876
1876
|
cvv: `orck-save-${s}-cvv`
|
|
1877
|
-
}), [s]), l = gn(), [u, d] =
|
|
1877
|
+
}), [s]), l = gn(), [u, d] = N.useState(() => ({
|
|
1878
1878
|
...Dt,
|
|
1879
1879
|
country: kt(r)
|
|
1880
|
-
})), [f, p] =
|
|
1880
|
+
})), [f, p] = N.useState(!1), [m, h] = N.useState(), g = async (n) => {
|
|
1881
1881
|
if (n.preventDefault(), f) return;
|
|
1882
1882
|
let r = Tt.safeParse(u);
|
|
1883
1883
|
if (!r.success) {
|
|
@@ -1904,40 +1904,40 @@ function xn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
1904
1904
|
}
|
|
1905
1905
|
}
|
|
1906
1906
|
};
|
|
1907
|
-
return /* @__PURE__ */
|
|
1907
|
+
return /* @__PURE__ */ I("form", {
|
|
1908
1908
|
"aria-label": "Secure card setup",
|
|
1909
1909
|
autoComplete: "on",
|
|
1910
1910
|
className: "grid gap-4",
|
|
1911
1911
|
noValidate: !0,
|
|
1912
1912
|
onSubmit: (e) => void g(e),
|
|
1913
1913
|
children: [
|
|
1914
|
-
/* @__PURE__ */
|
|
1914
|
+
/* @__PURE__ */ F(It, {
|
|
1915
1915
|
idPrefix: `orck-save-${s}`,
|
|
1916
1916
|
value: u,
|
|
1917
1917
|
onChange: d,
|
|
1918
1918
|
disabled: f
|
|
1919
1919
|
}),
|
|
1920
|
-
/* @__PURE__ */
|
|
1920
|
+
/* @__PURE__ */ F(Ht, {
|
|
1921
1921
|
ids: c,
|
|
1922
1922
|
card: l,
|
|
1923
1923
|
disabled: f
|
|
1924
1924
|
}),
|
|
1925
|
-
m ? /* @__PURE__ */
|
|
1925
|
+
m ? /* @__PURE__ */ F("p", {
|
|
1926
1926
|
role: "alert",
|
|
1927
1927
|
className: "text-sm text-destructive",
|
|
1928
1928
|
children: m
|
|
1929
1929
|
}) : null,
|
|
1930
|
-
/* @__PURE__ */
|
|
1930
|
+
/* @__PURE__ */ F(Q, {
|
|
1931
1931
|
label: n ?? i.t("paymentMethods.save"),
|
|
1932
1932
|
processing: f,
|
|
1933
1933
|
disabled: !l.valid
|
|
1934
1934
|
}),
|
|
1935
|
-
/* @__PURE__ */
|
|
1935
|
+
/* @__PURE__ */ F(Ut, {})
|
|
1936
1936
|
]
|
|
1937
1937
|
});
|
|
1938
1938
|
}
|
|
1939
1939
|
function Sn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
1940
|
-
let i = S(), { t: a } = i, { client: o, notify: s } = T(), c =
|
|
1940
|
+
let i = S(), { t: a } = i, { client: o, notify: s } = T(), c = N.useRef(null), [l, u] = N.useState(!1), [d, f] = N.useState(!1), [p, m] = N.useState(), h = N.useMemo(() => kt(r), [r]), g = async (e) => {
|
|
1941
1941
|
if (e.preventDefault(), !(!c.current || d)) {
|
|
1942
1942
|
f(!0), m(void 0);
|
|
1943
1943
|
try {
|
|
@@ -1953,11 +1953,11 @@ function Sn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
1953
1953
|
}
|
|
1954
1954
|
}
|
|
1955
1955
|
};
|
|
1956
|
-
return /* @__PURE__ */
|
|
1956
|
+
return /* @__PURE__ */ I("form", {
|
|
1957
1957
|
className: "grid gap-4",
|
|
1958
1958
|
onSubmit: (e) => void g(e),
|
|
1959
1959
|
children: [
|
|
1960
|
-
/* @__PURE__ */
|
|
1960
|
+
/* @__PURE__ */ F(on, {
|
|
1961
1961
|
ref: c,
|
|
1962
1962
|
psp: e,
|
|
1963
1963
|
client: o,
|
|
@@ -1966,27 +1966,27 @@ function Sn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
1966
1966
|
unavailableMessage: a("paymentMethods.unavailable"),
|
|
1967
1967
|
verificationPendingMessage: a("paymentMethods.verificationPending")
|
|
1968
1968
|
}),
|
|
1969
|
-
p ? /* @__PURE__ */
|
|
1969
|
+
p ? /* @__PURE__ */ F("p", {
|
|
1970
1970
|
role: "alert",
|
|
1971
1971
|
className: "text-sm text-destructive",
|
|
1972
1972
|
children: p
|
|
1973
1973
|
}) : null,
|
|
1974
|
-
/* @__PURE__ */
|
|
1974
|
+
/* @__PURE__ */ F(Q, {
|
|
1975
1975
|
label: n ?? a("paymentMethods.save"),
|
|
1976
1976
|
processing: d,
|
|
1977
1977
|
disabled: !l
|
|
1978
1978
|
}),
|
|
1979
|
-
/* @__PURE__ */
|
|
1979
|
+
/* @__PURE__ */ F(Ut, {})
|
|
1980
1980
|
]
|
|
1981
1981
|
});
|
|
1982
1982
|
}
|
|
1983
1983
|
function Cn({ psp: e, onSaved: t, submitLabel: r, defaultCountry: i }) {
|
|
1984
|
-
let a = S(), { client: o, notify: s } = T(), [c, l] =
|
|
1985
|
-
return /* @__PURE__ */
|
|
1984
|
+
let a = S(), { client: o, notify: s } = T(), [c, l] = N.useState();
|
|
1985
|
+
return /* @__PURE__ */ I(P, { children: [c ? /* @__PURE__ */ F("p", {
|
|
1986
1986
|
role: "alert",
|
|
1987
1987
|
className: "text-sm text-destructive",
|
|
1988
1988
|
children: c
|
|
1989
|
-
}) : null, /* @__PURE__ */
|
|
1989
|
+
}) : null, /* @__PURE__ */ F(Wt, {
|
|
1990
1990
|
publicKey: e.config.public_api_key,
|
|
1991
1991
|
purpose: "setup",
|
|
1992
1992
|
defaultCountry: i,
|
|
@@ -2015,15 +2015,15 @@ function Cn({ psp: e, onSaved: t, submitLabel: r, defaultCountry: i }) {
|
|
|
2015
2015
|
//#endregion
|
|
2016
2016
|
//#region src/account/notice.tsx
|
|
2017
2017
|
function wn() {
|
|
2018
|
-
let [e, t] =
|
|
2019
|
-
return
|
|
2018
|
+
let [e, t] = N.useState(null);
|
|
2019
|
+
return N.useEffect(() => {
|
|
2020
2020
|
if (!e) return;
|
|
2021
2021
|
let n = setTimeout(() => t(null), 6e3);
|
|
2022
2022
|
return () => clearTimeout(n);
|
|
2023
|
-
}, [e]), [/* @__PURE__ */
|
|
2023
|
+
}, [e]), [/* @__PURE__ */ F("p", {
|
|
2024
2024
|
role: "status",
|
|
2025
2025
|
"aria-live": "polite",
|
|
2026
|
-
className:
|
|
2026
|
+
className: L("text-sm text-muted-foreground", e ? "pt-3" : "sr-only"),
|
|
2027
2027
|
children: e
|
|
2028
2028
|
}), t];
|
|
2029
2029
|
}
|
|
@@ -2036,8 +2036,8 @@ function En(e, t) {
|
|
|
2036
2036
|
return e.status === 409 && e.code === "resource_conflict" ? t.t("paymentMethods.inUse") : t.error(e);
|
|
2037
2037
|
}
|
|
2038
2038
|
function Dn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r }) {
|
|
2039
|
-
let a = S(), { t: o } = a, s = x(n), c =
|
|
2040
|
-
|
|
2039
|
+
let a = S(), { t: o } = a, s = x(n), c = ne(), [l, u] = N.useState(null), [d, f] = N.useState(null), [p, h] = N.useState(null), [g, v] = N.useState(!1), y = te(), b = i(y.config?.payment.psps ?? []), C = b.filter(m), w = C.length > 0 ? null : _(b), { refetch: T } = y;
|
|
2040
|
+
N.useEffect(() => {
|
|
2041
2041
|
if (w === null) return;
|
|
2042
2042
|
let e = setTimeout(T, w * 1e3);
|
|
2043
2043
|
return () => clearTimeout(e);
|
|
@@ -2046,7 +2046,7 @@ function Dn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2046
2046
|
T,
|
|
2047
2047
|
y.config
|
|
2048
2048
|
]);
|
|
2049
|
-
let [E, D] =
|
|
2049
|
+
let [E, D] = N.useState(), O = C.find((e) => e.psp_id === E) ?? C[0], [ee, k] = wn(), re = e?.toUpperCase(), ie = async () => {
|
|
2050
2050
|
if (!l) return;
|
|
2051
2051
|
f(null);
|
|
2052
2052
|
let e = await c.remove(l.id);
|
|
@@ -2054,73 +2054,73 @@ function Dn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2054
2054
|
f(En(e, a));
|
|
2055
2055
|
return;
|
|
2056
2056
|
}
|
|
2057
|
-
u(null),
|
|
2058
|
-
},
|
|
2059
|
-
if (!
|
|
2057
|
+
u(null), k(o("paymentMethods.removed"));
|
|
2058
|
+
}, A = async (e) => {
|
|
2059
|
+
if (!re) return;
|
|
2060
2060
|
h(null);
|
|
2061
|
-
let t = await c.setDefault(e.id,
|
|
2061
|
+
let t = await c.setDefault(e.id, re);
|
|
2062
2062
|
t ? h({
|
|
2063
2063
|
id: e.id,
|
|
2064
2064
|
message: a.error(t)
|
|
2065
|
-
}) :
|
|
2066
|
-
},
|
|
2067
|
-
|
|
2065
|
+
}) : k(o("paymentMethods.defaultUpdated"));
|
|
2066
|
+
}, j, M = c.methods;
|
|
2067
|
+
j = M === null && c.error ? /* @__PURE__ */ F(Y, {
|
|
2068
2068
|
error: c.error,
|
|
2069
2069
|
onRetry: c.refetch
|
|
2070
|
-
}) :
|
|
2070
|
+
}) : M === null ? /* @__PURE__ */ F(Re, {}) : M.length === 0 ? /* @__PURE__ */ F(ze, {
|
|
2071
2071
|
title: o("paymentMethods.empty"),
|
|
2072
2072
|
description: o("paymentMethods.emptyDescription")
|
|
2073
|
-
}) : /* @__PURE__ */
|
|
2073
|
+
}) : /* @__PURE__ */ F("ul", {
|
|
2074
2074
|
className: "-my-1 divide-y divide-border",
|
|
2075
|
-
children:
|
|
2075
|
+
children: M.map((e) => {
|
|
2076
2076
|
let t = Tn(e, a), n = (e.subscriptions ?? []).map((e) => e.display_name).filter(Boolean), r = e.health?.expiry_status, i = e.default_currencies ?? [], s = c.pending[e.id], l = [n.length > 0 && o("paymentMethods.usedBy", { names: n.join(", ") })].filter(Boolean);
|
|
2077
|
-
return /* @__PURE__ */
|
|
2077
|
+
return /* @__PURE__ */ I("li", {
|
|
2078
2078
|
"data-testid": "payment-method-row",
|
|
2079
2079
|
"data-payment-method-id": e.id,
|
|
2080
2080
|
className: "flex flex-wrap items-center gap-x-3 gap-y-2 py-3.5",
|
|
2081
2081
|
children: [
|
|
2082
|
-
/* @__PURE__ */
|
|
2082
|
+
/* @__PURE__ */ F(Ze, {
|
|
2083
2083
|
brand: e.card?.brand ?? void 0,
|
|
2084
2084
|
fallback: (e.card?.brand ?? "card").slice(0, 4)
|
|
2085
2085
|
}),
|
|
2086
|
-
/* @__PURE__ */
|
|
2086
|
+
/* @__PURE__ */ I("div", {
|
|
2087
2087
|
className: "grid min-w-40 flex-1 gap-0.5",
|
|
2088
2088
|
children: [
|
|
2089
|
-
/* @__PURE__ */
|
|
2089
|
+
/* @__PURE__ */ I("div", {
|
|
2090
2090
|
className: "flex flex-wrap items-center gap-x-2 gap-y-1",
|
|
2091
2091
|
children: [
|
|
2092
|
-
/* @__PURE__ */
|
|
2092
|
+
/* @__PURE__ */ F("span", {
|
|
2093
2093
|
className: "text-sm font-medium tabular-nums",
|
|
2094
2094
|
children: t
|
|
2095
2095
|
}),
|
|
2096
|
-
r === "expired" || r === "expiring_soon" ? /* @__PURE__ */
|
|
2097
|
-
i.length > 0 ? /* @__PURE__ */
|
|
2096
|
+
r === "expired" || r === "expiring_soon" ? /* @__PURE__ */ F(Ue, { status: r }) : e.health?.active === !1 ? /* @__PURE__ */ F(Ue, { status: "needs_attention" }) : null,
|
|
2097
|
+
i.length > 0 ? /* @__PURE__ */ F(Ue, {
|
|
2098
2098
|
status: "default",
|
|
2099
2099
|
label: o("paymentMethods.defaultFor", { currencies: i.join(", ") })
|
|
2100
2100
|
}) : null
|
|
2101
2101
|
]
|
|
2102
2102
|
}),
|
|
2103
|
-
l.length > 0 ? /* @__PURE__ */
|
|
2103
|
+
l.length > 0 ? /* @__PURE__ */ F("p", {
|
|
2104
2104
|
className: "text-sm text-muted-foreground tabular-nums",
|
|
2105
2105
|
children: l.join(" · ")
|
|
2106
2106
|
}) : null,
|
|
2107
|
-
p?.id === e.id ? /* @__PURE__ */
|
|
2107
|
+
p?.id === e.id ? /* @__PURE__ */ F("p", {
|
|
2108
2108
|
role: "alert",
|
|
2109
2109
|
className: "text-sm text-destructive",
|
|
2110
2110
|
children: p.message
|
|
2111
2111
|
}) : null
|
|
2112
2112
|
]
|
|
2113
2113
|
}),
|
|
2114
|
-
/* @__PURE__ */
|
|
2114
|
+
/* @__PURE__ */ I("div", {
|
|
2115
2115
|
className: "ml-auto flex items-center gap-1",
|
|
2116
|
-
children: [
|
|
2116
|
+
children: [re && !i.includes(re) ? /* @__PURE__ */ I(U, {
|
|
2117
2117
|
variant: "ghost",
|
|
2118
2118
|
size: "sm",
|
|
2119
2119
|
className: "text-muted-foreground",
|
|
2120
2120
|
disabled: !!s,
|
|
2121
|
-
onClick: () => void
|
|
2122
|
-
children: [s === "default" ? /* @__PURE__ */
|
|
2123
|
-
}) : null, /* @__PURE__ */
|
|
2121
|
+
onClick: () => void A(e),
|
|
2122
|
+
children: [s === "default" ? /* @__PURE__ */ F(X, {}) : null, o("paymentMethods.makeDefault")]
|
|
2123
|
+
}) : null, /* @__PURE__ */ F(U, {
|
|
2124
2124
|
variant: "ghost",
|
|
2125
2125
|
size: "icon-sm",
|
|
2126
2126
|
className: "text-muted-foreground hover:text-destructive",
|
|
@@ -2130,8 +2130,8 @@ function Dn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2130
2130
|
onClick: () => {
|
|
2131
2131
|
f(null), u(e);
|
|
2132
2132
|
},
|
|
2133
|
-
children: s === "remove" ? /* @__PURE__ */
|
|
2134
|
-
icon:
|
|
2133
|
+
children: s === "remove" ? /* @__PURE__ */ F(X, {}) : /* @__PURE__ */ F(ce, {
|
|
2134
|
+
icon: fe,
|
|
2135
2135
|
"aria-hidden": !0
|
|
2136
2136
|
})
|
|
2137
2137
|
})]
|
|
@@ -2140,100 +2140,100 @@ function Dn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2140
2140
|
}, e.id);
|
|
2141
2141
|
})
|
|
2142
2142
|
});
|
|
2143
|
-
let
|
|
2144
|
-
return /* @__PURE__ */
|
|
2143
|
+
let P = l ? c.pending[l.id] === "remove" : !1, L = l ? Tn(l, a) : "";
|
|
2144
|
+
return /* @__PURE__ */ I(Le, {
|
|
2145
2145
|
title: o("paymentMethods.title"),
|
|
2146
2146
|
description: o("paymentMethods.description"),
|
|
2147
2147
|
appearance: n,
|
|
2148
2148
|
className: r,
|
|
2149
2149
|
"data-testid": "payment-methods-panel",
|
|
2150
|
-
action: O ? /* @__PURE__ */
|
|
2150
|
+
action: O ? /* @__PURE__ */ I(U, {
|
|
2151
2151
|
variant: "outline",
|
|
2152
2152
|
size: "sm",
|
|
2153
2153
|
onClick: () => v(!0),
|
|
2154
|
-
children: [/* @__PURE__ */
|
|
2155
|
-
icon:
|
|
2154
|
+
children: [/* @__PURE__ */ F(ce, {
|
|
2155
|
+
icon: le,
|
|
2156
2156
|
"aria-hidden": !0,
|
|
2157
2157
|
"data-icon": "inline-start"
|
|
2158
2158
|
}), o("paymentMethods.add")]
|
|
2159
2159
|
}) : null,
|
|
2160
2160
|
children: [
|
|
2161
|
-
|
|
2162
|
-
|
|
2161
|
+
j,
|
|
2162
|
+
M !== null && c.error ? /* @__PURE__ */ F("div", {
|
|
2163
2163
|
className: "pt-3",
|
|
2164
|
-
children: /* @__PURE__ */
|
|
2164
|
+
children: /* @__PURE__ */ F(Y, {
|
|
2165
2165
|
error: c.error,
|
|
2166
2166
|
onRetry: c.refetch
|
|
2167
2167
|
})
|
|
2168
2168
|
}) : null,
|
|
2169
|
-
y.error ? /* @__PURE__ */
|
|
2169
|
+
y.error ? /* @__PURE__ */ F("div", {
|
|
2170
2170
|
className: "pt-3",
|
|
2171
|
-
children: /* @__PURE__ */
|
|
2171
|
+
children: /* @__PURE__ */ F(Y, {
|
|
2172
2172
|
error: y.error,
|
|
2173
2173
|
message: o("paymentMethods.addUnavailable"),
|
|
2174
2174
|
onRetry: y.refetch
|
|
2175
2175
|
})
|
|
2176
|
-
}) : w === null ? null : /* @__PURE__ */
|
|
2176
|
+
}) : w === null ? null : /* @__PURE__ */ F("p", {
|
|
2177
2177
|
role: "status",
|
|
2178
2178
|
className: "pt-3 text-sm text-muted-foreground",
|
|
2179
2179
|
children: o("paymentMethods.addUnavailable")
|
|
2180
2180
|
}),
|
|
2181
|
-
|
|
2182
|
-
/* @__PURE__ */
|
|
2181
|
+
ee,
|
|
2182
|
+
/* @__PURE__ */ F(Qe, {
|
|
2183
2183
|
open: l !== null,
|
|
2184
2184
|
onOpenChange: (e) => {
|
|
2185
|
-
!e && !
|
|
2185
|
+
!e && !P && u(null);
|
|
2186
2186
|
},
|
|
2187
|
-
children: /* @__PURE__ */
|
|
2188
|
-
className: `${s.className} ${
|
|
2187
|
+
children: /* @__PURE__ */ I(tt, {
|
|
2188
|
+
className: `${s.className} ${Me} bg-popover text-popover-foreground`,
|
|
2189
2189
|
"data-orck-theme": s["data-orck-theme"],
|
|
2190
2190
|
style: s.style,
|
|
2191
2191
|
children: [
|
|
2192
|
-
/* @__PURE__ */
|
|
2193
|
-
d ? /* @__PURE__ */
|
|
2192
|
+
/* @__PURE__ */ I(nt, { children: [/* @__PURE__ */ F(it, { children: o("paymentMethods.removeTitle", { label: L }) }), /* @__PURE__ */ F(at, { children: o("paymentMethods.removeDescription") })] }),
|
|
2193
|
+
d ? /* @__PURE__ */ F("p", {
|
|
2194
2194
|
role: "alert",
|
|
2195
2195
|
className: "text-sm text-destructive",
|
|
2196
2196
|
children: d
|
|
2197
2197
|
}) : null,
|
|
2198
|
-
/* @__PURE__ */
|
|
2199
|
-
disabled:
|
|
2198
|
+
/* @__PURE__ */ I(rt, { children: [/* @__PURE__ */ F(ot, {
|
|
2199
|
+
disabled: P,
|
|
2200
2200
|
children: o("common.cancel")
|
|
2201
|
-
}), /* @__PURE__ */
|
|
2201
|
+
}), /* @__PURE__ */ I(U, {
|
|
2202
2202
|
variant: "destructive",
|
|
2203
|
-
disabled:
|
|
2204
|
-
onClick: () => void
|
|
2205
|
-
children: [
|
|
2203
|
+
disabled: P,
|
|
2204
|
+
onClick: () => void ie(),
|
|
2205
|
+
children: [P ? /* @__PURE__ */ F(X, {}) : null, o("paymentMethods.removeConfirm")]
|
|
2206
2206
|
})] })
|
|
2207
2207
|
]
|
|
2208
2208
|
})
|
|
2209
2209
|
}),
|
|
2210
|
-
O ? /* @__PURE__ */
|
|
2210
|
+
O ? /* @__PURE__ */ F(st, {
|
|
2211
2211
|
open: g,
|
|
2212
2212
|
onOpenChange: v,
|
|
2213
|
-
children: /* @__PURE__ */
|
|
2214
|
-
className: `${s.className} ${
|
|
2213
|
+
children: /* @__PURE__ */ I(ut, {
|
|
2214
|
+
className: `${s.className} ${Me} max-h-[calc(100dvh-2rem)] overflow-y-auto bg-popover text-popover-foreground`,
|
|
2215
2215
|
"data-orck-theme": s["data-orck-theme"],
|
|
2216
2216
|
style: s.style,
|
|
2217
2217
|
children: [
|
|
2218
|
-
/* @__PURE__ */
|
|
2219
|
-
C.length > 1 ? /* @__PURE__ */
|
|
2218
|
+
/* @__PURE__ */ I(dt, { children: [/* @__PURE__ */ F(pt, { children: o("paymentMethods.addTitle") }), /* @__PURE__ */ F(mt, { children: o("paymentMethods.addDescription") })] }),
|
|
2219
|
+
C.length > 1 ? /* @__PURE__ */ I("label", {
|
|
2220
2220
|
className: "grid gap-1.5 text-sm",
|
|
2221
|
-
children: [o("paymentMethods.provider"), /* @__PURE__ */
|
|
2221
|
+
children: [o("paymentMethods.provider"), /* @__PURE__ */ F("select", {
|
|
2222
2222
|
className: "h-9 rounded-md border border-input bg-transparent px-2",
|
|
2223
2223
|
value: O.psp_id,
|
|
2224
2224
|
onChange: (e) => D(e.target.value),
|
|
2225
|
-
children: C.map((e) => /* @__PURE__ */
|
|
2225
|
+
children: C.map((e) => /* @__PURE__ */ F("option", {
|
|
2226
2226
|
value: e.psp_id,
|
|
2227
2227
|
children: e.display_name
|
|
2228
2228
|
}, e.psp_id))
|
|
2229
2229
|
})]
|
|
2230
2230
|
}) : null,
|
|
2231
|
-
/* @__PURE__ */
|
|
2231
|
+
/* @__PURE__ */ F(vn, {
|
|
2232
2232
|
psp: O,
|
|
2233
2233
|
defaultCountry: t,
|
|
2234
2234
|
appearance: n,
|
|
2235
2235
|
onSaved: () => {
|
|
2236
|
-
v(!1),
|
|
2236
|
+
v(!1), k(o("paymentMethods.added"));
|
|
2237
2237
|
}
|
|
2238
2238
|
}, O.psp_id)
|
|
2239
2239
|
]
|
|
@@ -2245,66 +2245,66 @@ function Dn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2245
2245
|
//#endregion
|
|
2246
2246
|
//#region src/components/ui/textarea.tsx
|
|
2247
2247
|
function On({ className: e, ...t }) {
|
|
2248
|
-
return /* @__PURE__ */
|
|
2248
|
+
return /* @__PURE__ */ F("textarea", {
|
|
2249
2249
|
"data-slot": "textarea",
|
|
2250
|
-
className:
|
|
2250
|
+
className: L("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", e),
|
|
2251
2251
|
...t
|
|
2252
2252
|
});
|
|
2253
2253
|
}
|
|
2254
2254
|
//#endregion
|
|
2255
2255
|
//#region src/account/cancel-dialog.tsx
|
|
2256
2256
|
function kn({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, onConfirm: a, appearance: o }) {
|
|
2257
|
-
let s = S(), { t: c } = s, l = x(o), u =
|
|
2258
|
-
if (
|
|
2259
|
-
|
|
2260
|
-
let e = await a(f);
|
|
2261
|
-
e ? p(e) ||
|
|
2262
|
-
},
|
|
2263
|
-
return /* @__PURE__ */
|
|
2257
|
+
let s = S(), { t: c } = s, l = x(o), u = N.useId(), d = N.useId(), [f, m] = N.useState(""), [h, g] = N.useState(!1), [_, v] = N.useState(!1), [y, b] = N.useState(null), C = i !== void 0, w = f.trim().length, T = w < 4, E = async () => {
|
|
2258
|
+
if (v(!0), T || C) return;
|
|
2259
|
+
b(null);
|
|
2260
|
+
let e = await a(f, h);
|
|
2261
|
+
e ? p(e) || b(e) : t(!1);
|
|
2262
|
+
}, D = c(i === "cancel" && h ? "cancel.preparing" : i === "signing" ? "cancel.signing" : i === "confirming" ? "cancel.confirming" : C ? "cancel.working" : h ? "cancel.confirmWallet" : "cancel.confirm");
|
|
2263
|
+
return /* @__PURE__ */ F(Qe, {
|
|
2264
2264
|
open: e,
|
|
2265
2265
|
onOpenChange: (e) => {
|
|
2266
|
-
!e &&
|
|
2266
|
+
!e && C || t(e);
|
|
2267
2267
|
},
|
|
2268
|
-
children: /* @__PURE__ */
|
|
2269
|
-
className: `${l.className} ${
|
|
2268
|
+
children: /* @__PURE__ */ F(tt, {
|
|
2269
|
+
className: `${l.className} ${Me} bg-popover text-popover-foreground`,
|
|
2270
2270
|
"data-orck-theme": l["data-orck-theme"],
|
|
2271
2271
|
style: l.style,
|
|
2272
|
-
children: /* @__PURE__ */
|
|
2272
|
+
children: /* @__PURE__ */ I("form", {
|
|
2273
2273
|
className: "grid gap-5",
|
|
2274
2274
|
noValidate: !0,
|
|
2275
2275
|
onSubmit: (e) => {
|
|
2276
|
-
e.preventDefault(),
|
|
2276
|
+
e.preventDefault(), E();
|
|
2277
2277
|
},
|
|
2278
2278
|
children: [
|
|
2279
|
-
/* @__PURE__ */
|
|
2280
|
-
/* @__PURE__ */
|
|
2279
|
+
/* @__PURE__ */ I(nt, { children: [/* @__PURE__ */ F(it, { children: c("cancel.title", { name: n }) }), /* @__PURE__ */ F(at, { children: c("cancel.description") })] }),
|
|
2280
|
+
/* @__PURE__ */ I("div", {
|
|
2281
2281
|
className: "grid gap-2",
|
|
2282
2282
|
children: [
|
|
2283
|
-
/* @__PURE__ */
|
|
2283
|
+
/* @__PURE__ */ F(Z, {
|
|
2284
2284
|
htmlFor: u,
|
|
2285
2285
|
children: c("cancel.reasonLabel")
|
|
2286
2286
|
}),
|
|
2287
|
-
/* @__PURE__ */
|
|
2287
|
+
/* @__PURE__ */ F(On, {
|
|
2288
2288
|
id: u,
|
|
2289
2289
|
value: f,
|
|
2290
2290
|
maxLength: 500,
|
|
2291
2291
|
placeholder: c("cancel.reasonPlaceholder"),
|
|
2292
2292
|
"aria-describedby": d,
|
|
2293
|
-
"aria-invalid":
|
|
2294
|
-
disabled:
|
|
2293
|
+
"aria-invalid": _ && T ? !0 : void 0,
|
|
2294
|
+
disabled: C,
|
|
2295
2295
|
required: !0,
|
|
2296
2296
|
rows: 3,
|
|
2297
2297
|
className: "[font:inherit]",
|
|
2298
2298
|
onChange: (e) => m(e.target.value),
|
|
2299
|
-
onBlur: () =>
|
|
2299
|
+
onBlur: () => w > 0 && v(!0)
|
|
2300
2300
|
}),
|
|
2301
|
-
/* @__PURE__ */
|
|
2301
|
+
/* @__PURE__ */ I("div", {
|
|
2302
2302
|
id: d,
|
|
2303
2303
|
className: "flex justify-between gap-3 text-xs text-muted-foreground",
|
|
2304
|
-
children: [/* @__PURE__ */
|
|
2305
|
-
className:
|
|
2306
|
-
children:
|
|
2307
|
-
}), /* @__PURE__ */
|
|
2304
|
+
children: [/* @__PURE__ */ F("span", {
|
|
2305
|
+
className: _ && T ? "text-destructive" : "",
|
|
2306
|
+
children: _ && T ? c("cancel.reasonTooShort", { min: 4 }) : ""
|
|
2307
|
+
}), /* @__PURE__ */ F("span", {
|
|
2308
2308
|
className: "tabular-nums",
|
|
2309
2309
|
children: c("cancel.reasonHint", {
|
|
2310
2310
|
count: f.length,
|
|
@@ -2314,19 +2314,28 @@ function kn({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, on
|
|
|
2314
2314
|
})
|
|
2315
2315
|
]
|
|
2316
2316
|
}),
|
|
2317
|
-
|
|
2317
|
+
r ? /* @__PURE__ */ I("label", {
|
|
2318
|
+
className: "flex items-start gap-2 text-sm",
|
|
2319
|
+
children: [/* @__PURE__ */ F("input", {
|
|
2320
|
+
type: "checkbox",
|
|
2321
|
+
checked: h,
|
|
2322
|
+
disabled: C,
|
|
2323
|
+
onChange: (e) => g(e.target.checked)
|
|
2324
|
+
}), /* @__PURE__ */ F("span", { children: c("cancel.revokeOnChain") })]
|
|
2325
|
+
}) : null,
|
|
2326
|
+
y ? /* @__PURE__ */ F("p", {
|
|
2318
2327
|
role: "alert",
|
|
2319
2328
|
className: "text-sm text-destructive",
|
|
2320
|
-
children: s.error(
|
|
2329
|
+
children: s.error(y)
|
|
2321
2330
|
}) : null,
|
|
2322
|
-
/* @__PURE__ */
|
|
2323
|
-
disabled:
|
|
2331
|
+
/* @__PURE__ */ I(rt, { children: [/* @__PURE__ */ F(ot, {
|
|
2332
|
+
disabled: C,
|
|
2324
2333
|
children: c("cancel.keep")
|
|
2325
|
-
}), /* @__PURE__ */
|
|
2334
|
+
}), /* @__PURE__ */ I(U, {
|
|
2326
2335
|
type: "submit",
|
|
2327
2336
|
variant: "destructive",
|
|
2328
|
-
disabled:
|
|
2329
|
-
children: [
|
|
2337
|
+
disabled: C,
|
|
2338
|
+
children: [C ? /* @__PURE__ */ F(X, {}) : null, D]
|
|
2330
2339
|
})] })
|
|
2331
2340
|
]
|
|
2332
2341
|
})
|
|
@@ -2336,21 +2345,21 @@ function kn({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, on
|
|
|
2336
2345
|
//#endregion
|
|
2337
2346
|
//#region src/components/ui/radio-group.tsx
|
|
2338
2347
|
function An({ className: e, ...t }) {
|
|
2339
|
-
return /* @__PURE__ */
|
|
2348
|
+
return /* @__PURE__ */ F(he, {
|
|
2340
2349
|
"data-slot": "radio-group",
|
|
2341
|
-
className:
|
|
2350
|
+
className: L("grid w-full gap-3", e),
|
|
2342
2351
|
...t
|
|
2343
2352
|
});
|
|
2344
2353
|
}
|
|
2345
2354
|
function jn({ className: e, ...t }) {
|
|
2346
|
-
return /* @__PURE__ */
|
|
2355
|
+
return /* @__PURE__ */ F(V.Root, {
|
|
2347
2356
|
"data-slot": "radio-group-item",
|
|
2348
|
-
className:
|
|
2357
|
+
className: L("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary", e),
|
|
2349
2358
|
...t,
|
|
2350
|
-
children: /* @__PURE__ */
|
|
2359
|
+
children: /* @__PURE__ */ F(V.Indicator, {
|
|
2351
2360
|
"data-slot": "radio-group-indicator",
|
|
2352
2361
|
className: "flex size-4 items-center justify-center",
|
|
2353
|
-
children: /* @__PURE__ */
|
|
2362
|
+
children: /* @__PURE__ */ F("span", { className: "absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground" })
|
|
2354
2363
|
})
|
|
2355
2364
|
});
|
|
2356
2365
|
}
|
|
@@ -2362,17 +2371,17 @@ function Nn(e, t) {
|
|
|
2362
2371
|
}
|
|
2363
2372
|
function Pn({ subscription: e, name: t, onOpenChange: n, pending: r, onConfirm: i, appearance: a }) {
|
|
2364
2373
|
let o = x(a);
|
|
2365
|
-
return /* @__PURE__ */
|
|
2374
|
+
return /* @__PURE__ */ F(st, {
|
|
2366
2375
|
open: e !== null,
|
|
2367
2376
|
onOpenChange: (e) => {
|
|
2368
2377
|
!e && r || n(e);
|
|
2369
2378
|
},
|
|
2370
|
-
children: /* @__PURE__ */
|
|
2379
|
+
children: /* @__PURE__ */ F(ut, {
|
|
2371
2380
|
showCloseButton: !1,
|
|
2372
|
-
className: `${o.className} ${
|
|
2381
|
+
className: `${o.className} ${Me} bg-popover text-popover-foreground`,
|
|
2373
2382
|
"data-orck-theme": o["data-orck-theme"],
|
|
2374
2383
|
style: o.style,
|
|
2375
|
-
children: e ? /* @__PURE__ */
|
|
2384
|
+
children: e ? /* @__PURE__ */ F(Fn, {
|
|
2376
2385
|
subscription: e,
|
|
2377
2386
|
name: t,
|
|
2378
2387
|
pending: r,
|
|
@@ -2383,7 +2392,7 @@ function Pn({ subscription: e, name: t, onOpenChange: n, pending: r, onConfirm:
|
|
|
2383
2392
|
});
|
|
2384
2393
|
}
|
|
2385
2394
|
function Fn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i }) {
|
|
2386
|
-
let a = S(), { t: o } = a, s =
|
|
2395
|
+
let a = S(), { t: o } = a, s = N.useId(), c = ne(), l = e.payment_method_id ?? Mn, [u, d] = N.useState(l), [f, p] = N.useState(null), m = c.methods ? Nn(e, c.methods) : null, h = e.price?.currency?.toUpperCase(), g = h ? m?.find((e) => (e.default_currencies ?? []).includes(h)) : void 0, _ = [...g ? [{
|
|
2387
2396
|
id: Mn,
|
|
2388
2397
|
card: g
|
|
2389
2398
|
}] : [], ...(m ?? []).map((e) => ({
|
|
@@ -2395,10 +2404,10 @@ function Fn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i })
|
|
|
2395
2404
|
let e = await i(u === Mn ? null : u);
|
|
2396
2405
|
e && p(e);
|
|
2397
2406
|
}, b;
|
|
2398
|
-
return b = m === null && c.error ? /* @__PURE__ */
|
|
2407
|
+
return b = m === null && c.error ? /* @__PURE__ */ F(Y, {
|
|
2399
2408
|
error: c.error,
|
|
2400
2409
|
onRetry: c.refetch
|
|
2401
|
-
}) : m === null ? /* @__PURE__ */
|
|
2410
|
+
}) : m === null ? /* @__PURE__ */ F(Re, { rows: 2 }) : /* @__PURE__ */ F(An, {
|
|
2402
2411
|
value: u,
|
|
2403
2412
|
onValueChange: (e) => {
|
|
2404
2413
|
typeof e == "string" && e && d(e);
|
|
@@ -2408,54 +2417,54 @@ function Fn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i })
|
|
|
2408
2417
|
className: "grid gap-0",
|
|
2409
2418
|
children: _.map(({ id: e, card: t }) => {
|
|
2410
2419
|
let r = `${s}-${e}`, i = Te(t.card, a);
|
|
2411
|
-
return /* @__PURE__ */
|
|
2420
|
+
return /* @__PURE__ */ I(Z, {
|
|
2412
2421
|
htmlFor: r,
|
|
2413
2422
|
"data-testid": "change-card-option",
|
|
2414
|
-
className:
|
|
2423
|
+
className: L("flex cursor-pointer items-center gap-3 py-1.5 select-none", n && "cursor-default"),
|
|
2415
2424
|
children: [
|
|
2416
|
-
/* @__PURE__ */
|
|
2425
|
+
/* @__PURE__ */ F(jn, {
|
|
2417
2426
|
id: r,
|
|
2418
2427
|
value: e
|
|
2419
2428
|
}),
|
|
2420
|
-
/* @__PURE__ */
|
|
2429
|
+
/* @__PURE__ */ F(Ze, {
|
|
2421
2430
|
brand: t.card?.brand ?? void 0,
|
|
2422
2431
|
fallback: (t.card?.brand ?? "card").slice(0, 4)
|
|
2423
2432
|
}),
|
|
2424
|
-
/* @__PURE__ */
|
|
2433
|
+
/* @__PURE__ */ F("span", {
|
|
2425
2434
|
className: "min-w-0 flex-1 truncate text-sm font-medium tabular-nums",
|
|
2426
2435
|
children: e === Mn ? o("changeCard.useDefault", { card: i }) : i
|
|
2427
2436
|
}),
|
|
2428
|
-
e === l ? /* @__PURE__ */
|
|
2437
|
+
e === l ? /* @__PURE__ */ F("span", {
|
|
2429
2438
|
className: "shrink-0 text-xs text-muted-foreground",
|
|
2430
2439
|
children: o("changeCard.current")
|
|
2431
2440
|
}) : null
|
|
2432
2441
|
]
|
|
2433
2442
|
}, e);
|
|
2434
2443
|
})
|
|
2435
|
-
}), /* @__PURE__ */
|
|
2444
|
+
}), /* @__PURE__ */ I("form", {
|
|
2436
2445
|
className: "grid gap-5",
|
|
2437
2446
|
noValidate: !0,
|
|
2438
2447
|
onSubmit: (e) => {
|
|
2439
2448
|
e.preventDefault(), y();
|
|
2440
2449
|
},
|
|
2441
2450
|
children: [
|
|
2442
|
-
/* @__PURE__ */
|
|
2451
|
+
/* @__PURE__ */ I(dt, { children: [/* @__PURE__ */ F(pt, { children: o("changeCard.title", { name: t }) }), /* @__PURE__ */ F(mt, { children: o(m !== null && !v ? "changeCard.none" : "changeCard.description") })] }),
|
|
2443
2452
|
b,
|
|
2444
|
-
f ? /* @__PURE__ */
|
|
2453
|
+
f ? /* @__PURE__ */ F("p", {
|
|
2445
2454
|
role: "alert",
|
|
2446
2455
|
className: "text-sm text-destructive",
|
|
2447
2456
|
children: a.error(f)
|
|
2448
2457
|
}) : null,
|
|
2449
|
-
/* @__PURE__ */
|
|
2458
|
+
/* @__PURE__ */ I(ft, { children: [/* @__PURE__ */ F(U, {
|
|
2450
2459
|
type: "button",
|
|
2451
2460
|
variant: "outline",
|
|
2452
2461
|
disabled: n,
|
|
2453
2462
|
onClick: r,
|
|
2454
2463
|
children: o("common.cancel")
|
|
2455
|
-
}), /* @__PURE__ */
|
|
2464
|
+
}), /* @__PURE__ */ I(U, {
|
|
2456
2465
|
type: "submit",
|
|
2457
2466
|
disabled: n || !u || u === l,
|
|
2458
|
-
children: [n ? /* @__PURE__ */
|
|
2467
|
+
children: [n ? /* @__PURE__ */ F(X, {}) : null, o("changeCard.confirm")]
|
|
2459
2468
|
})] })
|
|
2460
2469
|
]
|
|
2461
2470
|
});
|
|
@@ -2463,9 +2472,9 @@ function Fn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i })
|
|
|
2463
2472
|
//#endregion
|
|
2464
2473
|
//#region src/account/subscriptions-panel.tsx
|
|
2465
2474
|
function In({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter: n, appearance: r, className: i, ...a }) {
|
|
2466
|
-
let o = S(), { t: s } = o, { locale: c, navigate: l } =
|
|
2475
|
+
let o = S(), { t: s } = o, { locale: c, navigate: l } = ee(), u = k(a), d = O(), [f, p] = N.useState(null), [m, h] = N.useState(null), [g, _] = N.useState(null), [v, y] = wn(), b = N.useMemo(() => {
|
|
2467
2476
|
let e = u.subscriptions ?? [];
|
|
2468
|
-
return [...e.filter(
|
|
2477
|
+
return [...e.filter(ke), ...e.filter((e) => !ke(e))];
|
|
2469
2478
|
}, [u.subscriptions]), x = async (e) => {
|
|
2470
2479
|
_(null);
|
|
2471
2480
|
let t = await u.resume(e.id);
|
|
@@ -2474,13 +2483,13 @@ function In({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2474
2483
|
message: o.error(t)
|
|
2475
2484
|
}) : y(s("subscriptions.resumed"));
|
|
2476
2485
|
}, C = f?.rail === "solana", w;
|
|
2477
|
-
return w = u.subscriptions === null && u.error ? /* @__PURE__ */
|
|
2486
|
+
return w = u.subscriptions === null && u.error ? /* @__PURE__ */ F(Y, {
|
|
2478
2487
|
error: u.error,
|
|
2479
2488
|
onRetry: u.refetch
|
|
2480
|
-
}) : u.subscriptions === null ? /* @__PURE__ */
|
|
2489
|
+
}) : u.subscriptions === null ? /* @__PURE__ */ F(Re, {}) : b.length === 0 ? /* @__PURE__ */ F(ze, {
|
|
2481
2490
|
title: s("subscriptions.empty"),
|
|
2482
2491
|
description: s("subscriptions.emptyDescription"),
|
|
2483
|
-
action: t ? /* @__PURE__ */
|
|
2492
|
+
action: t ? /* @__PURE__ */ F("a", {
|
|
2484
2493
|
href: t,
|
|
2485
2494
|
className: ge({
|
|
2486
2495
|
variant: "outline",
|
|
@@ -2491,108 +2500,108 @@ function In({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2491
2500
|
},
|
|
2492
2501
|
children: s("subscriptions.browsePlans")
|
|
2493
2502
|
}) : null
|
|
2494
|
-
}) : /* @__PURE__ */
|
|
2503
|
+
}) : /* @__PURE__ */ F("ul", {
|
|
2495
2504
|
className: "-my-1 divide-y divide-border",
|
|
2496
|
-
children: b.map((
|
|
2497
|
-
let
|
|
2498
|
-
brand: we(
|
|
2499
|
-
last4:
|
|
2500
|
-
}) : null,
|
|
2501
|
-
return /* @__PURE__ */
|
|
2505
|
+
children: b.map((e) => {
|
|
2506
|
+
let t = ke(e), r = u.pending[e.id], i = Se(e, o), a = e.price ? be(e.price.unit_amount, e.price.currency, d, c) : null, l = xe(e.price, o), f = ye(e.current_period_ends_at, c), m = ye(e.access?.ends_at, c), v = ye(e.ended_at ?? e.canceled_at ?? e.current_period_ends_at, c), y = G(e), b = t && !y && !!e.price?.billing_interval_hours, S = t ? b && f ? s("subscriptions.renews", { date: f }) : m ? s("subscriptions.endsOn", { date: m }) : s("subscriptions.noMorePayments") : e.status === "canceled" ? s("subscriptions.noMorePayments") : v && s("subscriptions.endedOn", { date: v }), C = e.rail === "solana" ? s("subscriptions.wallet") : e.card?.last4 ? s("subscriptions.paidWith", {
|
|
2507
|
+
brand: we(e.card.brand, s("paymentMethods.fallbackBrand")),
|
|
2508
|
+
last4: e.card.last4
|
|
2509
|
+
}) : null, w = t && !y ? e.cancel_portal_url : null, T = De.has(e.status) && !y && !w, E = (e.status === "active" || e.status === "past_due" || e.status === "awaiting_method" || e.status === "unverified") && !y && !w && e.rail !== "solana" && (e.collection_policy === "engine" || e.collection_policy === "nmi_schedule"), D = e.cancel_scheduled ? "cancel_scheduled" : e.status, O = n?.(e);
|
|
2510
|
+
return /* @__PURE__ */ I("li", {
|
|
2502
2511
|
"data-testid": "subscription-row",
|
|
2503
|
-
"data-subscription-id":
|
|
2512
|
+
"data-subscription-id": e.id,
|
|
2504
2513
|
className: "grid gap-3 py-4 @md:grid-cols-[1fr_auto] @md:items-center",
|
|
2505
2514
|
children: [
|
|
2506
|
-
/* @__PURE__ */
|
|
2515
|
+
/* @__PURE__ */ I("div", {
|
|
2507
2516
|
className: "grid min-w-0 gap-1",
|
|
2508
2517
|
children: [
|
|
2509
|
-
/* @__PURE__ */
|
|
2518
|
+
/* @__PURE__ */ I("div", {
|
|
2510
2519
|
className: "flex flex-wrap items-center gap-x-2 gap-y-1",
|
|
2511
|
-
children: [/* @__PURE__ */
|
|
2512
|
-
className:
|
|
2513
|
-
children:
|
|
2514
|
-
}), /* @__PURE__ */
|
|
2520
|
+
children: [/* @__PURE__ */ F("span", {
|
|
2521
|
+
className: L("truncate text-sm font-semibold", !t && "text-muted-foreground"),
|
|
2522
|
+
children: i
|
|
2523
|
+
}), /* @__PURE__ */ F(Ue, { status: D })]
|
|
2515
2524
|
}),
|
|
2516
|
-
/* @__PURE__ */
|
|
2525
|
+
/* @__PURE__ */ F("p", {
|
|
2517
2526
|
className: "text-sm text-muted-foreground tabular-nums",
|
|
2518
|
-
children: [
|
|
2527
|
+
children: [S, C].filter(Boolean).join(" · ") || s("common.notAvailable")
|
|
2519
2528
|
}),
|
|
2520
|
-
|
|
2521
|
-
className:
|
|
2522
|
-
children: [/* @__PURE__ */
|
|
2529
|
+
a ? /* @__PURE__ */ I("p", {
|
|
2530
|
+
className: L("text-sm tabular-nums", !t && "text-muted-foreground"),
|
|
2531
|
+
children: [/* @__PURE__ */ F("span", {
|
|
2523
2532
|
className: "font-medium",
|
|
2524
|
-
children:
|
|
2525
|
-
}),
|
|
2533
|
+
children: a
|
|
2534
|
+
}), l ? /* @__PURE__ */ I("span", {
|
|
2526
2535
|
className: "text-muted-foreground",
|
|
2527
|
-
children: [" ",
|
|
2536
|
+
children: [" ", l]
|
|
2528
2537
|
}) : null]
|
|
2529
2538
|
}) : null,
|
|
2530
|
-
|
|
2539
|
+
e.status === "past_due" || e.status === "awaiting_method" ? /* @__PURE__ */ F("p", {
|
|
2531
2540
|
className: "text-sm text-destructive",
|
|
2532
2541
|
children: s("subscriptions.pastDue")
|
|
2533
2542
|
}) : null,
|
|
2534
|
-
g?.id ===
|
|
2543
|
+
g?.id === e.id ? /* @__PURE__ */ F("p", {
|
|
2535
2544
|
role: "alert",
|
|
2536
2545
|
className: "text-sm text-destructive",
|
|
2537
2546
|
children: g.message
|
|
2538
2547
|
}) : null
|
|
2539
2548
|
]
|
|
2540
2549
|
}),
|
|
2541
|
-
/* @__PURE__ */
|
|
2550
|
+
/* @__PURE__ */ I("div", {
|
|
2542
2551
|
className: "flex flex-wrap gap-2 @md:justify-end",
|
|
2543
2552
|
children: [
|
|
2544
|
-
|
|
2553
|
+
e.resumable ? /* @__PURE__ */ I(U, {
|
|
2545
2554
|
variant: "outline",
|
|
2546
2555
|
size: "sm",
|
|
2547
|
-
disabled: !!
|
|
2548
|
-
onClick: () => void x(
|
|
2549
|
-
children: [
|
|
2556
|
+
disabled: !!r,
|
|
2557
|
+
onClick: () => void x(e),
|
|
2558
|
+
children: [r === "resume" ? /* @__PURE__ */ F(X, {}) : null, s(r === "resume" ? "subscriptions.updating" : "subscriptions.resume")]
|
|
2550
2559
|
}) : null,
|
|
2551
|
-
|
|
2552
|
-
href:
|
|
2560
|
+
w ? /* @__PURE__ */ I("a", {
|
|
2561
|
+
href: w,
|
|
2553
2562
|
target: "_blank",
|
|
2554
2563
|
rel: "noopener noreferrer",
|
|
2555
2564
|
className: ge({
|
|
2556
2565
|
variant: "outline",
|
|
2557
2566
|
size: "sm"
|
|
2558
2567
|
}),
|
|
2559
|
-
children: [s("subscriptions.manageAtProvider"), /* @__PURE__ */
|
|
2560
|
-
icon:
|
|
2568
|
+
children: [s("subscriptions.manageAtProvider"), /* @__PURE__ */ F(ce, {
|
|
2569
|
+
icon: ue,
|
|
2561
2570
|
"aria-hidden": !0
|
|
2562
2571
|
})]
|
|
2563
2572
|
}) : null,
|
|
2564
|
-
|
|
2573
|
+
E ? /* @__PURE__ */ I(U, {
|
|
2565
2574
|
variant: "outline",
|
|
2566
2575
|
size: "sm",
|
|
2567
|
-
disabled: !!
|
|
2568
|
-
"aria-label": s("subscriptions.changeCardLabel", { name:
|
|
2576
|
+
disabled: !!r,
|
|
2577
|
+
"aria-label": s("subscriptions.changeCardLabel", { name: i }),
|
|
2569
2578
|
onClick: () => {
|
|
2570
|
-
_(null), h(
|
|
2579
|
+
_(null), h(e);
|
|
2571
2580
|
},
|
|
2572
|
-
children: [
|
|
2581
|
+
children: [r === "payment_method" ? /* @__PURE__ */ F(X, {}) : null, s("subscriptions.changeCard")]
|
|
2573
2582
|
}) : null,
|
|
2574
|
-
|
|
2583
|
+
T ? /* @__PURE__ */ I(U, {
|
|
2575
2584
|
variant: "ghost",
|
|
2576
2585
|
size: "sm",
|
|
2577
2586
|
className: "text-muted-foreground hover:text-destructive",
|
|
2578
|
-
disabled: !!
|
|
2579
|
-
"aria-label": s("subscriptions.cancelLabel", { name:
|
|
2587
|
+
disabled: !!r,
|
|
2588
|
+
"aria-label": s("subscriptions.cancelLabel", { name: i }),
|
|
2580
2589
|
onClick: () => {
|
|
2581
|
-
_(null), p(
|
|
2590
|
+
_(null), p(e);
|
|
2582
2591
|
},
|
|
2583
|
-
children: [
|
|
2592
|
+
children: [r && r !== "resume" && r !== "payment_method" && r !== "change" ? /* @__PURE__ */ F(X, {}) : null, s("subscriptions.cancel")]
|
|
2584
2593
|
}) : null
|
|
2585
2594
|
]
|
|
2586
2595
|
}),
|
|
2587
|
-
|
|
2596
|
+
O ? /* @__PURE__ */ F("div", {
|
|
2588
2597
|
"data-testid": "subscription-footer",
|
|
2589
2598
|
className: "border-t border-border/60 pt-3 @md:col-span-2",
|
|
2590
|
-
children:
|
|
2599
|
+
children: O
|
|
2591
2600
|
}) : null
|
|
2592
2601
|
]
|
|
2593
|
-
},
|
|
2602
|
+
}, e.id);
|
|
2594
2603
|
})
|
|
2595
|
-
}), /* @__PURE__ */
|
|
2604
|
+
}), /* @__PURE__ */ I(Le, {
|
|
2596
2605
|
title: s("subscriptions.title"),
|
|
2597
2606
|
description: s("subscriptions.description"),
|
|
2598
2607
|
appearance: r,
|
|
@@ -2600,15 +2609,15 @@ function In({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2600
2609
|
"data-testid": "subscriptions-panel",
|
|
2601
2610
|
children: [
|
|
2602
2611
|
w,
|
|
2603
|
-
u.subscriptions !== null && u.error ? /* @__PURE__ */
|
|
2612
|
+
u.subscriptions !== null && u.error ? /* @__PURE__ */ F("div", {
|
|
2604
2613
|
className: "pt-3",
|
|
2605
|
-
children: /* @__PURE__ */
|
|
2614
|
+
children: /* @__PURE__ */ F(Y, {
|
|
2606
2615
|
error: u.error,
|
|
2607
2616
|
onRetry: u.refetch
|
|
2608
2617
|
})
|
|
2609
2618
|
}) : null,
|
|
2610
2619
|
v,
|
|
2611
|
-
/* @__PURE__ */
|
|
2620
|
+
/* @__PURE__ */ F(Pn, {
|
|
2612
2621
|
subscription: m,
|
|
2613
2622
|
name: m ? Se(m, o) : "",
|
|
2614
2623
|
onOpenChange: (e) => !e && h(null),
|
|
@@ -2620,17 +2629,17 @@ function In({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2620
2629
|
return t || (h(null), y(s("changeCard.done"))), t;
|
|
2621
2630
|
}
|
|
2622
2631
|
}, `card-${m?.id ?? "closed"}`),
|
|
2623
|
-
/* @__PURE__ */
|
|
2632
|
+
/* @__PURE__ */ F(kn, {
|
|
2624
2633
|
open: f !== null,
|
|
2625
2634
|
onOpenChange: (e) => !e && p(null),
|
|
2626
2635
|
name: f ? Se(f, o) : "",
|
|
2627
|
-
onChain: C,
|
|
2636
|
+
onChain: C && !!e,
|
|
2628
2637
|
appearance: r,
|
|
2629
2638
|
pending: f ? u.pending[f.id] : void 0,
|
|
2630
|
-
onConfirm: async (t) => {
|
|
2639
|
+
onConfirm: async (t, n) => {
|
|
2631
2640
|
if (!f) return null;
|
|
2632
|
-
let
|
|
2633
|
-
return
|
|
2641
|
+
let r = await u.cancel(f.id, t, e, n);
|
|
2642
|
+
return r || y(s("cancel.done")), r;
|
|
2634
2643
|
}
|
|
2635
2644
|
}, f?.id ?? "closed")
|
|
2636
2645
|
]
|
|
@@ -2639,23 +2648,23 @@ function In({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2639
2648
|
//#endregion
|
|
2640
2649
|
//#region src/account/account-billing.tsx
|
|
2641
2650
|
function Ln({ defaultCurrency: e, defaultCountry: t, sendSolanaTransaction: n, plansHref: r, renderSubscriptionFooter: i, historyPageSize: a, appearance: o, className: s }) {
|
|
2642
|
-
return /* @__PURE__ */
|
|
2651
|
+
return /* @__PURE__ */ I(H, {
|
|
2643
2652
|
appearance: o,
|
|
2644
|
-
className:
|
|
2653
|
+
className: L("grid gap-6", s),
|
|
2645
2654
|
"data-testid": "account-billing",
|
|
2646
2655
|
children: [
|
|
2647
|
-
/* @__PURE__ */
|
|
2656
|
+
/* @__PURE__ */ F(In, {
|
|
2648
2657
|
sendSolanaTransaction: n,
|
|
2649
2658
|
plansHref: r,
|
|
2650
2659
|
renderSubscriptionFooter: i,
|
|
2651
2660
|
appearance: o
|
|
2652
2661
|
}),
|
|
2653
|
-
/* @__PURE__ */
|
|
2662
|
+
/* @__PURE__ */ F(Dn, {
|
|
2654
2663
|
defaultCurrency: e,
|
|
2655
2664
|
defaultCountry: t,
|
|
2656
2665
|
appearance: o
|
|
2657
2666
|
}),
|
|
2658
|
-
/* @__PURE__ */
|
|
2667
|
+
/* @__PURE__ */ F(Ge, {
|
|
2659
2668
|
pageSize: a,
|
|
2660
2669
|
appearance: o
|
|
2661
2670
|
})
|
|
@@ -2666,8 +2675,8 @@ function Ln({ defaultCurrency: e, defaultCountry: t, sendSolanaTransaction: n, p
|
|
|
2666
2675
|
//#region src/components/qr.tsx
|
|
2667
2676
|
var Rn = 208;
|
|
2668
2677
|
function zn({ amountLabel: e, payload: t, statusLine: n }) {
|
|
2669
|
-
let r =
|
|
2670
|
-
return
|
|
2678
|
+
let r = N.useRef(null), [i, a] = N.useState("loading");
|
|
2679
|
+
return N.useEffect(() => {
|
|
2671
2680
|
let e = r.current;
|
|
2672
2681
|
if (!e || !t) return;
|
|
2673
2682
|
let n = !1;
|
|
@@ -2678,12 +2687,12 @@ function zn({ amountLabel: e, payload: t, statusLine: n }) {
|
|
|
2678
2687
|
}), () => {
|
|
2679
2688
|
n = !0, e.replaceChildren();
|
|
2680
2689
|
};
|
|
2681
|
-
}, [t]), /* @__PURE__ */
|
|
2690
|
+
}, [t]), /* @__PURE__ */ I("div", {
|
|
2682
2691
|
className: "grid justify-items-center gap-3 py-1",
|
|
2683
2692
|
children: [
|
|
2684
|
-
/* @__PURE__ */
|
|
2693
|
+
/* @__PURE__ */ F("div", {
|
|
2685
2694
|
className: "grid place-items-center rounded-xl bg-white p-1 shadow-sm ring-1 ring-black/10",
|
|
2686
|
-
children: t ? /* @__PURE__ */
|
|
2695
|
+
children: t ? /* @__PURE__ */ I("div", {
|
|
2687
2696
|
role: "img",
|
|
2688
2697
|
"aria-label": "Solana Pay QR code",
|
|
2689
2698
|
className: "relative overflow-hidden rounded-lg",
|
|
@@ -2692,20 +2701,20 @@ function zn({ amountLabel: e, payload: t, statusLine: n }) {
|
|
|
2692
2701
|
height: Rn
|
|
2693
2702
|
},
|
|
2694
2703
|
children: [
|
|
2695
|
-
/* @__PURE__ */
|
|
2704
|
+
/* @__PURE__ */ F("div", {
|
|
2696
2705
|
ref: r,
|
|
2697
2706
|
className: "absolute inset-0"
|
|
2698
2707
|
}),
|
|
2699
|
-
i === "loading" ? /* @__PURE__ */
|
|
2708
|
+
i === "loading" ? /* @__PURE__ */ F("div", {
|
|
2700
2709
|
"aria-hidden": !0,
|
|
2701
2710
|
className: "absolute inset-0 animate-pulse rounded-lg bg-zinc-100"
|
|
2702
2711
|
}) : null,
|
|
2703
|
-
i === "failed" ? /* @__PURE__ */
|
|
2712
|
+
i === "failed" ? /* @__PURE__ */ F("div", {
|
|
2704
2713
|
className: "absolute inset-0 grid place-items-center text-center text-xs text-zinc-600",
|
|
2705
2714
|
children: "QR code unavailable"
|
|
2706
2715
|
}) : null
|
|
2707
2716
|
]
|
|
2708
|
-
}) : /* @__PURE__ */
|
|
2717
|
+
}) : /* @__PURE__ */ F("div", {
|
|
2709
2718
|
"aria-hidden": !0,
|
|
2710
2719
|
className: "animate-pulse rounded-lg bg-zinc-100",
|
|
2711
2720
|
style: {
|
|
@@ -2714,11 +2723,11 @@ function zn({ amountLabel: e, payload: t, statusLine: n }) {
|
|
|
2714
2723
|
}
|
|
2715
2724
|
})
|
|
2716
2725
|
}),
|
|
2717
|
-
/* @__PURE__ */
|
|
2726
|
+
/* @__PURE__ */ F("div", {
|
|
2718
2727
|
className: "text-[13px] font-medium text-balance",
|
|
2719
2728
|
children: "Scan with a Solana wallet"
|
|
2720
2729
|
}),
|
|
2721
|
-
/* @__PURE__ */
|
|
2730
|
+
/* @__PURE__ */ I("div", {
|
|
2722
2731
|
className: "text-center text-[12.5px] text-pretty text-muted-foreground tabular-nums",
|
|
2723
2732
|
"aria-live": "polite",
|
|
2724
2733
|
children: [
|
|
@@ -2727,9 +2736,9 @@ function zn({ amountLabel: e, payload: t, statusLine: n }) {
|
|
|
2727
2736
|
n
|
|
2728
2737
|
]
|
|
2729
2738
|
}),
|
|
2730
|
-
t ? /* @__PURE__ */
|
|
2739
|
+
t ? /* @__PURE__ */ F("a", {
|
|
2731
2740
|
href: t,
|
|
2732
|
-
className:
|
|
2741
|
+
className: L(ge({ variant: "secondary" }), "h-9 w-full max-w-56"),
|
|
2733
2742
|
children: "Open in wallet"
|
|
2734
2743
|
}) : null
|
|
2735
2744
|
]
|
|
@@ -2755,7 +2764,7 @@ function Un(e) {
|
|
|
2755
2764
|
if (!(!t?.exp_month || !t.exp_year)) return `${String(t.exp_month).padStart(2, "0")}/${String(t.exp_year).slice(-2)}`;
|
|
2756
2765
|
}
|
|
2757
2766
|
function Wn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
2758
|
-
return /* @__PURE__ */
|
|
2767
|
+
return /* @__PURE__ */ I(An, {
|
|
2759
2768
|
value: t,
|
|
2760
2769
|
onValueChange: (e) => {
|
|
2761
2770
|
typeof e == "string" && e && n(e);
|
|
@@ -2765,21 +2774,21 @@ function Wn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2765
2774
|
className: "grid gap-0",
|
|
2766
2775
|
children: [e.map((e) => {
|
|
2767
2776
|
let n = `${i}-${e.id}`, a = t === e.id, o = Un(e), s = e.card?.brand, c = e.card?.last4;
|
|
2768
|
-
return /* @__PURE__ */
|
|
2777
|
+
return /* @__PURE__ */ I(Z, {
|
|
2769
2778
|
htmlFor: n,
|
|
2770
|
-
className:
|
|
2779
|
+
className: L("flex cursor-pointer items-center gap-3 py-1.5 select-none", r && "cursor-default"),
|
|
2771
2780
|
children: [
|
|
2772
|
-
/* @__PURE__ */
|
|
2781
|
+
/* @__PURE__ */ F(jn, {
|
|
2773
2782
|
id: n,
|
|
2774
2783
|
value: e.id
|
|
2775
2784
|
}),
|
|
2776
|
-
/* @__PURE__ */
|
|
2785
|
+
/* @__PURE__ */ F(Ze, {
|
|
2777
2786
|
brand: s ?? void 0,
|
|
2778
2787
|
fallback: Vn(s)
|
|
2779
2788
|
}),
|
|
2780
|
-
/* @__PURE__ */
|
|
2781
|
-
className:
|
|
2782
|
-
children: [/* @__PURE__ */
|
|
2789
|
+
/* @__PURE__ */ I("span", {
|
|
2790
|
+
className: L("min-w-0 flex-1 truncate text-sm font-medium text-muted-foreground tabular-nums transition-colors", a && "font-semibold text-foreground"),
|
|
2791
|
+
children: [/* @__PURE__ */ I("span", {
|
|
2783
2792
|
className: "sr-only",
|
|
2784
2793
|
children: [
|
|
2785
2794
|
Hn(s),
|
|
@@ -2787,13 +2796,13 @@ function Wn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2787
2796
|
c,
|
|
2788
2797
|
o ? `, expires ${o}` : ""
|
|
2789
2798
|
]
|
|
2790
|
-
}), /* @__PURE__ */
|
|
2799
|
+
}), /* @__PURE__ */ I("span", {
|
|
2791
2800
|
"aria-hidden": !0,
|
|
2792
2801
|
children: [
|
|
2793
2802
|
Hn(s),
|
|
2794
2803
|
" •••• ",
|
|
2795
2804
|
c ?? "····",
|
|
2796
|
-
o ? /* @__PURE__ */
|
|
2805
|
+
o ? /* @__PURE__ */ I("span", {
|
|
2797
2806
|
className: "font-normal text-muted-foreground",
|
|
2798
2807
|
children: [
|
|
2799
2808
|
" ",
|
|
@@ -2806,19 +2815,19 @@ function Wn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2806
2815
|
})
|
|
2807
2816
|
]
|
|
2808
2817
|
}, e.id);
|
|
2809
|
-
}), /* @__PURE__ */
|
|
2818
|
+
}), /* @__PURE__ */ I(Z, {
|
|
2810
2819
|
htmlFor: `${i}-new`,
|
|
2811
|
-
className:
|
|
2820
|
+
className: L("flex cursor-pointer items-center gap-3 py-1.5 text-sm font-medium text-muted-foreground select-none", t === "new" && "font-semibold text-foreground", r && "cursor-default"),
|
|
2812
2821
|
children: [
|
|
2813
|
-
/* @__PURE__ */
|
|
2822
|
+
/* @__PURE__ */ F(jn, {
|
|
2814
2823
|
id: `${i}-new`,
|
|
2815
2824
|
value: "new"
|
|
2816
2825
|
}),
|
|
2817
|
-
/* @__PURE__ */
|
|
2826
|
+
/* @__PURE__ */ F("span", {
|
|
2818
2827
|
"aria-hidden": !0,
|
|
2819
|
-
className:
|
|
2820
|
-
children: /* @__PURE__ */
|
|
2821
|
-
icon:
|
|
2828
|
+
className: L("grid h-7 w-11 shrink-0 place-items-center rounded-md border border-dashed border-border text-muted-foreground transition-colors", t === "new" && "border-solid border-transparent bg-foreground text-background"),
|
|
2829
|
+
children: /* @__PURE__ */ F(ce, {
|
|
2830
|
+
icon: le,
|
|
2822
2831
|
className: "size-3.5"
|
|
2823
2832
|
})
|
|
2824
2833
|
}),
|
|
@@ -2830,28 +2839,28 @@ function Wn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2830
2839
|
//#endregion
|
|
2831
2840
|
//#region src/components/states.tsx
|
|
2832
2841
|
function Gn() {
|
|
2833
|
-
return /* @__PURE__ */
|
|
2842
|
+
return /* @__PURE__ */ I("div", {
|
|
2834
2843
|
className: "grid gap-4",
|
|
2835
2844
|
"aria-hidden": !0,
|
|
2836
2845
|
children: [
|
|
2837
|
-
/* @__PURE__ */
|
|
2838
|
-
/* @__PURE__ */
|
|
2839
|
-
/* @__PURE__ */
|
|
2840
|
-
/* @__PURE__ */
|
|
2841
|
-
/* @__PURE__ */
|
|
2842
|
-
/* @__PURE__ */
|
|
2846
|
+
/* @__PURE__ */ F(J, { className: "h-3 w-24" }),
|
|
2847
|
+
/* @__PURE__ */ F(J, { className: "h-6 w-52" }),
|
|
2848
|
+
/* @__PURE__ */ F(J, { className: "mt-1.5 h-11 w-full" }),
|
|
2849
|
+
/* @__PURE__ */ F(J, { className: "h-28 w-full" }),
|
|
2850
|
+
/* @__PURE__ */ F(J, { className: "h-11 w-full" }),
|
|
2851
|
+
/* @__PURE__ */ F(J, { className: "mt-1 h-[42px] w-full" })
|
|
2843
2852
|
]
|
|
2844
2853
|
});
|
|
2845
2854
|
}
|
|
2846
2855
|
//#endregion
|
|
2847
2856
|
//#region src/components/stripe-wallets.tsx
|
|
2848
2857
|
function Kn({ publishableKey: e, amount: t, currency: n, onPaymentMethod: r, onAvailable: i }) {
|
|
2849
|
-
let a =
|
|
2850
|
-
|
|
2858
|
+
let a = N.useRef(null), o = N.useRef(r), s = N.useRef(i);
|
|
2859
|
+
N.useEffect(() => {
|
|
2851
2860
|
o.current = r, s.current = i;
|
|
2852
2861
|
});
|
|
2853
|
-
let [c, l] =
|
|
2854
|
-
return
|
|
2862
|
+
let [c, l] = N.useState(!1);
|
|
2863
|
+
return N.useEffect(() => {
|
|
2855
2864
|
if (!a.current) return;
|
|
2856
2865
|
let r = !1, i, c = (e) => {
|
|
2857
2866
|
r || (l(e), s.current?.(e));
|
|
@@ -2889,7 +2898,7 @@ function Kn({ publishableKey: e, amount: t, currency: n, onPaymentMethod: r, onA
|
|
|
2889
2898
|
e,
|
|
2890
2899
|
t,
|
|
2891
2900
|
n
|
|
2892
|
-
]), /* @__PURE__ */
|
|
2901
|
+
]), /* @__PURE__ */ F("div", {
|
|
2893
2902
|
ref: a,
|
|
2894
2903
|
"data-testid": "stripe-wallets",
|
|
2895
2904
|
style: { visibility: c ? "visible" : "hidden" }
|
|
@@ -2909,9 +2918,9 @@ function qn(e, t, n) {
|
|
|
2909
2918
|
}
|
|
2910
2919
|
return r;
|
|
2911
2920
|
}
|
|
2912
|
-
var Jn = "fallbacks", Yn = 4096, Xn = 1024, Zn = 8, Qn =
|
|
2913
|
-
for:
|
|
2914
|
-
afterFailures:
|
|
2921
|
+
var Jn = "fallbacks", Yn = 4096, Xn = 1024, Zn = 8, Qn = M.string().regex(/^[a-z0-9][a-z0-9_-]{0,62}$/), $n = M.record(Qn, M.strictObject({
|
|
2922
|
+
for: M.array(Qn).min(1).max(Zn),
|
|
2923
|
+
afterFailures: M.number().int().min(1).max(100)
|
|
2915
2924
|
})).refine((e) => {
|
|
2916
2925
|
let t = Object.keys(e).length;
|
|
2917
2926
|
return t >= 1 && t <= Zn;
|
|
@@ -2940,290 +2949,290 @@ function tr(e) {
|
|
|
2940
2949
|
//#region src/order-payment.tsx
|
|
2941
2950
|
var nr = (e) => e.custodian === "platform" && e.rail === "nmi" && e.flow === "tokenize" && !e.status && !!e.config?.public_api_key, rr = (e) => e.status === "complete" || e.status === "processing", ir = 3e3;
|
|
2942
2951
|
function ar({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0, serverCardEntry: a = !0, wallets: o = !1, fallbacks: c, onSettled: l, appearance: u, className: p }) {
|
|
2943
|
-
let m = S(), h = T(), g = t ?? h.client, { config: _ } = y(), { config: v } =
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
}),
|
|
2952
|
+
let m = S(), h = T(), g = t ?? h.client, { config: _ } = y(), { config: v } = te(), b = O(), [x, w] = N.useState(), [D, ee] = N.useState([]), [k, ne] = N.useState("new"), [re, ie] = N.useState(), [A, j] = N.useState(), [M, ae] = N.useState(!1), [R, oe] = N.useState(), [se, ce] = N.useState(!1), [le, ue] = N.useState(() => crypto.randomUUID()), de = N.useRef(null), fe = N.useRef(l);
|
|
2953
|
+
N.useEffect(() => {
|
|
2954
|
+
fe.current = l;
|
|
2955
|
+
}), N.useEffect(() => {
|
|
2947
2956
|
let t = new AbortController();
|
|
2948
2957
|
return g.getOrder(e, t.signal).then(w, (e) => {
|
|
2949
|
-
t.signal.aborted ||
|
|
2958
|
+
t.signal.aborted || j(m.error(e));
|
|
2950
2959
|
}), () => t.abort();
|
|
2951
2960
|
}, [
|
|
2952
2961
|
g,
|
|
2953
2962
|
e,
|
|
2954
2963
|
m
|
|
2955
|
-
]),
|
|
2964
|
+
]), N.useEffect(() => {
|
|
2956
2965
|
if (!i || x?.collection_owner !== "engine") return;
|
|
2957
2966
|
let e = new AbortController();
|
|
2958
|
-
return g.listPaymentMethods({ signal: e.signal }).then((e) =>
|
|
2967
|
+
return g.listPaymentMethods({ signal: e.signal }).then((e) => ee(e.data), () => void 0), () => e.abort();
|
|
2959
2968
|
}, [
|
|
2960
2969
|
g,
|
|
2961
2970
|
i,
|
|
2962
2971
|
x?.collection_owner
|
|
2963
|
-
]),
|
|
2964
|
-
x && rr(x) &&
|
|
2972
|
+
]), N.useEffect(() => {
|
|
2973
|
+
x && rr(x) && fe.current?.(x);
|
|
2965
2974
|
}, [x]);
|
|
2966
|
-
let
|
|
2967
|
-
|
|
2968
|
-
if (!
|
|
2975
|
+
let pe = x?.collection_owner === "engine" && x?.payment.status === "requires_action" && x.payment.next_action?.type === "solana_pay";
|
|
2976
|
+
N.useEffect(() => {
|
|
2977
|
+
if (!pe || !x) return;
|
|
2969
2978
|
let e = window.setInterval(() => {
|
|
2970
2979
|
g.confirmOrder(x.id).then((e) => w(e.order), () => void 0);
|
|
2971
2980
|
}, ir);
|
|
2972
2981
|
return () => window.clearInterval(e);
|
|
2973
2982
|
}, [
|
|
2974
|
-
|
|
2983
|
+
pe,
|
|
2975
2984
|
g,
|
|
2976
2985
|
x
|
|
2977
2986
|
]);
|
|
2978
|
-
let
|
|
2987
|
+
let z = N.useMemo(() => x?.collection_owner === "engine" ? x.payment_options : [], [x]), B = N.useMemo(() => (v?.payment.psps ?? []).filter((e) => z.some((t) => t.psp_id === e.psp_id)), [v, z]), me = qn(c, z, B), V = z.filter((e) => !me.has(e.psp_id)), he = B.filter((e) => !me.has(e.psp_id)), H = he.filter((e) => {
|
|
2979
2988
|
let t = s(e);
|
|
2980
|
-
return (t === "collect_js" || t === "stripe_elements" || nr(e)) &&
|
|
2981
|
-
}), ge =
|
|
2989
|
+
return (t === "collect_js" || t === "stripe_elements" || nr(e)) && V.some((t) => t.psp_id === e.psp_id && t.accepts.includes("new_card"));
|
|
2990
|
+
}), ge = he.filter((e) => a || s(e) !== "card"), U = D.filter((e) => (e.status ?? "active") === "active" && e.reusable !== !1 && e.health?.active !== !1 && ge.some((t) => t.psp_id === e.psp_id || V.some((n) => n.psp_id === t.psp_id && n.saved_payment_method_ids?.includes(e.id)))).map((e) => ({
|
|
2982
2991
|
id: e.id,
|
|
2983
2992
|
psp_id: e.psp_id ?? "",
|
|
2984
2993
|
rail: e.rail ?? "",
|
|
2985
2994
|
card: e.card ?? void 0
|
|
2986
|
-
})), W =
|
|
2987
|
-
if (!x) return
|
|
2995
|
+
})), W = H.find((e) => e.psp_id === re) ?? H[0], _e = V.find((e) => e.accepts.includes("solana_pay")), ve = he.filter((e) => s(e) === null && V.some((t) => t.psp_id === e.psp_id && t.accepts.includes("redirect"))), ye = (e) => !!c && Object.keys(c).some((t) => t.toLowerCase() === e.key.toLowerCase()), be = ve.filter((e) => !ye(e)), xe = ve.filter(ye), Se = x?.lines.some((e) => e.billing_interval_hours !== null) ?? !1, Ce = _e ? (v?.payment.solana?.tokens ?? []).filter((e) => !Se || e.recurring_eligible === !0) : [], we = o ? H.find((e) => s(e) === "stripe_elements" && !!e.config?.publishable_key) : void 0;
|
|
2996
|
+
if (!x) return A ? /* @__PURE__ */ F("p", {
|
|
2988
2997
|
role: "alert",
|
|
2989
2998
|
className: "text-sm text-destructive",
|
|
2990
|
-
children:
|
|
2991
|
-
}) : /* @__PURE__ */
|
|
2992
|
-
let
|
|
2993
|
-
if (w(e.order), e.error) return
|
|
2999
|
+
children: A
|
|
3000
|
+
}) : /* @__PURE__ */ F(Gn, {});
|
|
3001
|
+
let Te = b[x.currency.toUpperCase()] ?? 2, Ee = (e) => d(e, x.currency, Te), De = _?.currencies?.find((e) => e.code.toUpperCase() === x.currency.toUpperCase()), Oe = we && De?.minor_decimals != null ? f(x.total, De.decimals, De.minor_decimals) : null, ke = async (e) => {
|
|
3002
|
+
if (w(e.order), e.error) return j(e.order.payment.last_payment_error?.message ?? e.error.message), ue(crypto.randomUUID()), !1;
|
|
2994
3003
|
let t = e.order.payment.next_action;
|
|
2995
3004
|
if (e.order.collection_owner !== "engine" || e.order.payment.status !== "requires_action" || !t) return !0;
|
|
2996
3005
|
if (t.type === "redirect_to_url" && t.url) return window.location.assign(t.url), !0;
|
|
2997
3006
|
let n = t.payload?.client_secret, r = (v?.payment.psps.find((e) => e.psp_id === t.psp_id))?.config?.publishable_key;
|
|
2998
|
-
if (t.type !== "authenticate" || !n || !r) return
|
|
2999
|
-
if (
|
|
3007
|
+
if (t.type !== "authenticate" || !n || !r) return j(m.t("paymentMethods.unavailable")), !1;
|
|
3008
|
+
if (de.current && t.psp_id === W?.psp_id) await de.current.handleNextAction(n);
|
|
3000
3009
|
else {
|
|
3001
3010
|
let e = await (await Kt(r)).handleNextAction({ clientSecret: n });
|
|
3002
3011
|
if (e.error) throw Error(e.error.message);
|
|
3003
3012
|
}
|
|
3004
|
-
return
|
|
3013
|
+
return ke(await g.confirmOrder(x.id));
|
|
3005
3014
|
}, G = async (e, t = !1) => {
|
|
3006
|
-
if (
|
|
3007
|
-
|
|
3015
|
+
if (M || x.collection_owner !== "engine" || R && !t) return !1;
|
|
3016
|
+
ae(!0), j(void 0);
|
|
3008
3017
|
try {
|
|
3009
|
-
return await
|
|
3018
|
+
return await ke(await g.payOrder(x.id, {
|
|
3010
3019
|
payment: await e(),
|
|
3011
3020
|
expectedTotal: x.total,
|
|
3012
|
-
idempotencyKey:
|
|
3021
|
+
idempotencyKey: le
|
|
3013
3022
|
}));
|
|
3014
3023
|
} catch (e) {
|
|
3015
|
-
|
|
3024
|
+
j(!n(e) && e instanceof Error && e.message ? e.message : m.error(e));
|
|
3016
3025
|
let r = n(e) && e.status === 400 && e.type === "invalid_request_error";
|
|
3017
3026
|
if (t && !r) throw e;
|
|
3018
|
-
return
|
|
3027
|
+
return ue(crypto.randomUUID()), !1;
|
|
3019
3028
|
} finally {
|
|
3020
|
-
|
|
3029
|
+
ae(!1);
|
|
3021
3030
|
}
|
|
3022
|
-
},
|
|
3023
|
-
if (!(
|
|
3024
|
-
|
|
3031
|
+
}, Ae = async () => {
|
|
3032
|
+
if (!(M || x.collection_owner !== "engine")) {
|
|
3033
|
+
ae(!0), j(void 0);
|
|
3025
3034
|
try {
|
|
3026
|
-
await
|
|
3035
|
+
await ke({ order: x });
|
|
3027
3036
|
} catch (e) {
|
|
3028
|
-
|
|
3037
|
+
j(!n(e) && e instanceof Error && e.message ? e.message : m.error(e));
|
|
3029
3038
|
} finally {
|
|
3030
|
-
|
|
3039
|
+
ae(!1);
|
|
3031
3040
|
}
|
|
3032
3041
|
}
|
|
3033
|
-
},
|
|
3034
|
-
return /* @__PURE__ */
|
|
3035
|
-
className:
|
|
3042
|
+
}, je = x.collection_owner === "engine" && x.status === "open" && x.payment.status === "requires_action" && x.payment.next_action?.type === "authenticate", Me = x.collection_owner === "engine" && x.status === "open" && x.payment.status === "requires_action" && x.payment.next_action?.type === "redirect_to_url" && !!x.payment.next_action.url, Ne = v?.payment.psps.find((e) => e.psp_id === x.payment.next_action?.psp_id), K = `Pay ${Ee(x.usage?.amount_due ?? x.total)}`, q = x.collection_owner === "engine" && (x.status === "open" || x.status === "uncollectible" && !!x.usage) && x.payment.status === "requires_payment_method";
|
|
3043
|
+
return /* @__PURE__ */ I("div", {
|
|
3044
|
+
className: L("orck grid gap-5", p),
|
|
3036
3045
|
"data-orck-theme": C(u),
|
|
3037
3046
|
style: E(u),
|
|
3038
|
-
children: [/* @__PURE__ */
|
|
3047
|
+
children: [/* @__PURE__ */ I("div", {
|
|
3039
3048
|
className: "grid",
|
|
3040
3049
|
children: [
|
|
3041
|
-
x.lines.map((e) => /* @__PURE__ */
|
|
3050
|
+
x.lines.map((e) => /* @__PURE__ */ I("div", {
|
|
3042
3051
|
className: "flex items-start justify-between gap-4 py-2 text-[13.5px]",
|
|
3043
|
-
children: [/* @__PURE__ */
|
|
3052
|
+
children: [/* @__PURE__ */ I("span", { children: [e.description, e.quantity && e.quantity > 1 ? ` × ${e.quantity}` : ""] }), /* @__PURE__ */ F("span", {
|
|
3044
3053
|
className: "whitespace-nowrap tabular-nums",
|
|
3045
|
-
children:
|
|
3054
|
+
children: Ee(e.amount)
|
|
3046
3055
|
})]
|
|
3047
3056
|
}, e.id)),
|
|
3048
|
-
/* @__PURE__ */
|
|
3057
|
+
/* @__PURE__ */ I("div", {
|
|
3049
3058
|
className: "flex items-start justify-between gap-4 border-t border-border pt-3 text-[13.5px] font-semibold",
|
|
3050
|
-
children: [/* @__PURE__ */
|
|
3059
|
+
children: [/* @__PURE__ */ F("span", { children: "Total" }), /* @__PURE__ */ F("span", {
|
|
3051
3060
|
className: "whitespace-nowrap tabular-nums",
|
|
3052
|
-
children:
|
|
3061
|
+
children: Ee(x.total)
|
|
3053
3062
|
})]
|
|
3054
3063
|
}),
|
|
3055
|
-
x.usage && x.usage.amount_paid !== "0" && /* @__PURE__ */
|
|
3064
|
+
x.usage && x.usage.amount_paid !== "0" && /* @__PURE__ */ I("div", {
|
|
3056
3065
|
className: "flex items-start justify-between gap-4 pt-1 text-[13.5px]",
|
|
3057
|
-
children: [/* @__PURE__ */
|
|
3066
|
+
children: [/* @__PURE__ */ F("span", { children: "Due" }), /* @__PURE__ */ F("span", {
|
|
3058
3067
|
className: "whitespace-nowrap tabular-nums",
|
|
3059
|
-
children:
|
|
3068
|
+
children: Ee(x.usage.amount_due)
|
|
3060
3069
|
})]
|
|
3061
3070
|
})
|
|
3062
3071
|
]
|
|
3063
|
-
}),
|
|
3072
|
+
}), pe ? /* @__PURE__ */ F(zn, {
|
|
3064
3073
|
amountLabel: `${x.payment.next_action?.payload?.token_amount ?? ""} ${x.payment.next_action?.payload?.token_symbol ?? ""}`.trim(),
|
|
3065
3074
|
payload: x.payment.next_action?.url ?? void 0,
|
|
3066
3075
|
statusLine: "Waiting for your wallet's payment"
|
|
3067
|
-
}) : x.status === "complete" ? /* @__PURE__ */
|
|
3076
|
+
}) : x.status === "complete" ? /* @__PURE__ */ F("p", {
|
|
3068
3077
|
role: "status",
|
|
3069
3078
|
className: "text-sm font-semibold",
|
|
3070
3079
|
children: "Payment complete"
|
|
3071
|
-
}) : x.collection_owner === "engine" ? x.status === "processing" ? /* @__PURE__ */
|
|
3080
|
+
}) : x.collection_owner === "engine" ? x.status === "processing" ? /* @__PURE__ */ F("p", {
|
|
3072
3081
|
role: "status",
|
|
3073
3082
|
className: "text-sm text-muted-foreground",
|
|
3074
3083
|
children: "Your payment is processing."
|
|
3075
|
-
}) : x.status === "open" ?
|
|
3084
|
+
}) : x.status === "open" ? Me ? /* @__PURE__ */ I("form", {
|
|
3076
3085
|
className: "grid gap-4",
|
|
3077
3086
|
onSubmit: (e) => {
|
|
3078
3087
|
e.preventDefault(), window.location.assign(x.payment.next_action.url);
|
|
3079
3088
|
},
|
|
3080
|
-
children: [/* @__PURE__ */
|
|
3089
|
+
children: [/* @__PURE__ */ I("p", {
|
|
3081
3090
|
className: "text-sm text-muted-foreground",
|
|
3082
3091
|
children: [
|
|
3083
3092
|
"Your payment is waiting on",
|
|
3084
3093
|
" ",
|
|
3085
|
-
|
|
3094
|
+
Ne?.display_name ?? "the payment page",
|
|
3086
3095
|
"."
|
|
3087
3096
|
]
|
|
3088
|
-
}), /* @__PURE__ */
|
|
3089
|
-
label: `Continue to ${
|
|
3097
|
+
}), /* @__PURE__ */ F(Q, {
|
|
3098
|
+
label: `Continue to ${Ne?.display_name ?? "the payment page"}`,
|
|
3090
3099
|
processing: !1
|
|
3091
3100
|
})]
|
|
3092
|
-
}) :
|
|
3101
|
+
}) : je ? /* @__PURE__ */ I("form", {
|
|
3093
3102
|
className: "grid gap-4",
|
|
3094
3103
|
onSubmit: (e) => {
|
|
3095
|
-
e.preventDefault(),
|
|
3104
|
+
e.preventDefault(), Ae();
|
|
3096
3105
|
},
|
|
3097
3106
|
children: [
|
|
3098
|
-
/* @__PURE__ */
|
|
3107
|
+
/* @__PURE__ */ F("p", {
|
|
3099
3108
|
className: "text-sm text-muted-foreground",
|
|
3100
3109
|
children: "Your bank asks you to confirm this payment."
|
|
3101
3110
|
}),
|
|
3102
|
-
/* @__PURE__ */
|
|
3111
|
+
/* @__PURE__ */ F(Q, {
|
|
3103
3112
|
label: "Confirm payment",
|
|
3104
|
-
processing:
|
|
3113
|
+
processing: M
|
|
3105
3114
|
}),
|
|
3106
|
-
|
|
3115
|
+
A ? /* @__PURE__ */ F("p", {
|
|
3107
3116
|
role: "alert",
|
|
3108
3117
|
className: "text-sm text-destructive",
|
|
3109
|
-
children:
|
|
3118
|
+
children: A
|
|
3110
3119
|
}) : null
|
|
3111
3120
|
]
|
|
3112
|
-
}) : /* @__PURE__ */
|
|
3121
|
+
}) : /* @__PURE__ */ I("div", {
|
|
3113
3122
|
className: "grid gap-4",
|
|
3114
3123
|
children: [
|
|
3115
|
-
!
|
|
3116
|
-
publishableKey:
|
|
3117
|
-
amount:
|
|
3124
|
+
!R && we && Oe ? /* @__PURE__ */ F(Kn, {
|
|
3125
|
+
publishableKey: we.config.publishable_key,
|
|
3126
|
+
amount: Oe,
|
|
3118
3127
|
currency: x.currency,
|
|
3119
|
-
onAvailable:
|
|
3128
|
+
onAvailable: ce,
|
|
3120
3129
|
onPaymentMethod: (e) => G(async () => ({
|
|
3121
3130
|
token: e,
|
|
3122
|
-
psp_id:
|
|
3131
|
+
psp_id: we.psp_id
|
|
3123
3132
|
}))
|
|
3124
3133
|
}) : null,
|
|
3125
|
-
!
|
|
3134
|
+
!R && se && we && Oe ? /* @__PURE__ */ F("p", {
|
|
3126
3135
|
className: "text-center text-[13px] text-muted-foreground",
|
|
3127
3136
|
children: "or pay another way"
|
|
3128
3137
|
}) : null,
|
|
3129
|
-
U.length > 0 ? /* @__PURE__ */
|
|
3138
|
+
U.length > 0 ? /* @__PURE__ */ F(Wn, {
|
|
3130
3139
|
methods: U,
|
|
3131
|
-
value:
|
|
3132
|
-
onChange:
|
|
3133
|
-
disabled:
|
|
3140
|
+
value: k,
|
|
3141
|
+
onChange: ne,
|
|
3142
|
+
disabled: M || !q || !!R,
|
|
3134
3143
|
idPrefix: `orck-order-${x.id}`
|
|
3135
3144
|
}) : null,
|
|
3136
|
-
|
|
3145
|
+
k === "new" ? W ? /* @__PURE__ */ I(P, { children: [H.length > 1 ? /* @__PURE__ */ F("select", {
|
|
3137
3146
|
"aria-label": "Pay with",
|
|
3138
3147
|
className: "h-9 rounded-md border border-border bg-transparent px-2 text-sm",
|
|
3139
3148
|
value: W.psp_id,
|
|
3140
|
-
onChange: (e) =>
|
|
3141
|
-
children:
|
|
3149
|
+
onChange: (e) => ie(e.target.value),
|
|
3150
|
+
children: H.map((e) => /* @__PURE__ */ F("option", {
|
|
3142
3151
|
value: e.psp_id,
|
|
3143
3152
|
children: e.display_name
|
|
3144
3153
|
}, e.psp_id))
|
|
3145
|
-
}) : null, nr(W) ? /* @__PURE__ */
|
|
3154
|
+
}) : null, nr(W) ? /* @__PURE__ */ F(Wt, {
|
|
3146
3155
|
publicKey: W.config.public_api_key,
|
|
3147
|
-
submitLabel:
|
|
3148
|
-
disabled:
|
|
3156
|
+
submitLabel: K,
|
|
3157
|
+
disabled: M || !q,
|
|
3149
3158
|
onTokenized: (e) => G(async () => ({
|
|
3150
3159
|
token: e.payment_token,
|
|
3151
3160
|
psp_id: W.psp_id,
|
|
3152
3161
|
billing_details: Et(e)
|
|
3153
3162
|
}), !0)
|
|
3154
|
-
}, W.psp_id) : s(W) === "collect_js" ? /* @__PURE__ */
|
|
3163
|
+
}, W.psp_id) : s(W) === "collect_js" ? /* @__PURE__ */ F(_n, {
|
|
3155
3164
|
tokenizationKey: W.config.tokenization_key,
|
|
3156
3165
|
tokenizationURL: W.config.tokenization_url,
|
|
3157
|
-
submitLabel:
|
|
3158
|
-
disabled:
|
|
3166
|
+
submitLabel: K,
|
|
3167
|
+
disabled: M || !q,
|
|
3159
3168
|
appearance: u,
|
|
3160
3169
|
onTokenized: (e) => G(async () => ({
|
|
3161
3170
|
token: e.payment_token,
|
|
3162
3171
|
psp_id: W.psp_id,
|
|
3163
3172
|
billing_details: Et(e)
|
|
3164
3173
|
}))
|
|
3165
|
-
}, W.psp_id) : /* @__PURE__ */
|
|
3174
|
+
}, W.psp_id) : /* @__PURE__ */ I("form", {
|
|
3166
3175
|
className: "grid gap-4",
|
|
3167
3176
|
onSubmit: (e) => {
|
|
3168
3177
|
e.preventDefault(), G(async () => ({
|
|
3169
|
-
token: await
|
|
3178
|
+
token: await de.current.tokenize(),
|
|
3170
3179
|
psp_id: W.psp_id
|
|
3171
3180
|
}));
|
|
3172
3181
|
},
|
|
3173
3182
|
children: [
|
|
3174
|
-
/* @__PURE__ */
|
|
3175
|
-
ref:
|
|
3183
|
+
/* @__PURE__ */ F(on, {
|
|
3184
|
+
ref: de,
|
|
3176
3185
|
psp: W,
|
|
3177
3186
|
client: g,
|
|
3178
3187
|
unavailableMessage: m.t("paymentMethods.unavailable"),
|
|
3179
3188
|
verificationPendingMessage: m.t("paymentMethods.verificationPending")
|
|
3180
3189
|
}, W.psp_id),
|
|
3181
|
-
/* @__PURE__ */
|
|
3182
|
-
label:
|
|
3183
|
-
processing:
|
|
3190
|
+
/* @__PURE__ */ F(Q, {
|
|
3191
|
+
label: K,
|
|
3192
|
+
processing: M,
|
|
3184
3193
|
disabled: !q
|
|
3185
3194
|
}),
|
|
3186
|
-
/* @__PURE__ */
|
|
3195
|
+
/* @__PURE__ */ F(Ut, {})
|
|
3187
3196
|
]
|
|
3188
|
-
})] }) : _e || be.length > 0 || xe.length > 0 ? null : /* @__PURE__ */
|
|
3197
|
+
})] }) : _e || be.length > 0 || xe.length > 0 ? null : /* @__PURE__ */ F("p", {
|
|
3189
3198
|
role: "alert",
|
|
3190
3199
|
className: "text-sm text-destructive",
|
|
3191
3200
|
children: m.t("paymentMethods.unavailable")
|
|
3192
|
-
}) : /* @__PURE__ */
|
|
3201
|
+
}) : /* @__PURE__ */ F("form", {
|
|
3193
3202
|
className: "grid gap-4",
|
|
3194
3203
|
onSubmit: (e) => {
|
|
3195
3204
|
e.preventDefault();
|
|
3196
|
-
let t =
|
|
3197
|
-
G(async () => ({ payment_method_id: t }), n).then(() =>
|
|
3205
|
+
let t = R ?? k, n = V.some((e) => e.saved_payment_method_ids?.includes(t));
|
|
3206
|
+
G(async () => ({ payment_method_id: t }), n).then(() => oe(void 0)).catch(() => oe(t));
|
|
3198
3207
|
},
|
|
3199
|
-
children: /* @__PURE__ */
|
|
3200
|
-
label:
|
|
3201
|
-
processing:
|
|
3208
|
+
children: /* @__PURE__ */ F(Q, {
|
|
3209
|
+
label: R ? "Retry payment" : K,
|
|
3210
|
+
processing: M,
|
|
3202
3211
|
disabled: !q
|
|
3203
3212
|
})
|
|
3204
3213
|
}),
|
|
3205
|
-
be.map((e) => /* @__PURE__ */
|
|
3214
|
+
be.map((e) => /* @__PURE__ */ F("form", {
|
|
3206
3215
|
onSubmit: (t) => {
|
|
3207
3216
|
t.preventDefault(), G(async () => ({
|
|
3208
3217
|
return_url: r ?? window.location.href,
|
|
3209
3218
|
psp_id: e.psp_id
|
|
3210
3219
|
}));
|
|
3211
3220
|
},
|
|
3212
|
-
children: /* @__PURE__ */
|
|
3213
|
-
label: `${
|
|
3214
|
-
processing:
|
|
3215
|
-
disabled: !q || !!
|
|
3221
|
+
children: /* @__PURE__ */ F(Q, {
|
|
3222
|
+
label: `${K} with ${e.display_name}`,
|
|
3223
|
+
processing: M,
|
|
3224
|
+
disabled: !q || !!R
|
|
3216
3225
|
})
|
|
3217
3226
|
}, e.psp_id)),
|
|
3218
|
-
xe.length > 0 ? /* @__PURE__ */
|
|
3227
|
+
xe.length > 0 ? /* @__PURE__ */ I("div", {
|
|
3219
3228
|
className: "grid gap-2 border-t border-border pt-4",
|
|
3220
|
-
children: [/* @__PURE__ */
|
|
3229
|
+
children: [/* @__PURE__ */ F("p", {
|
|
3221
3230
|
className: "text-[13px] text-muted-foreground",
|
|
3222
3231
|
children: "Card payment isn't working?"
|
|
3223
|
-
}), xe.map((e) => /* @__PURE__ */
|
|
3232
|
+
}), xe.map((e) => /* @__PURE__ */ I("button", {
|
|
3224
3233
|
type: "button",
|
|
3225
3234
|
className: "h-9 rounded-md border border-border text-sm",
|
|
3226
|
-
disabled:
|
|
3235
|
+
disabled: M || !q || !!R,
|
|
3227
3236
|
onClick: () => void G(async () => ({
|
|
3228
3237
|
return_url: r ?? window.location.href,
|
|
3229
3238
|
psp_id: e.psp_id
|
|
@@ -3231,12 +3240,12 @@ function ar({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3231
3240
|
children: ["Pay with ", e.display_name]
|
|
3232
3241
|
}, e.psp_id))]
|
|
3233
3242
|
}) : null,
|
|
3234
|
-
_e &&
|
|
3243
|
+
_e && Ce.length > 0 ? /* @__PURE__ */ F("div", {
|
|
3235
3244
|
className: "grid gap-2 border-t border-border pt-4",
|
|
3236
|
-
children:
|
|
3245
|
+
children: Ce.map((e) => /* @__PURE__ */ I("button", {
|
|
3237
3246
|
type: "button",
|
|
3238
3247
|
className: "h-9 rounded-md border border-border text-sm",
|
|
3239
|
-
disabled:
|
|
3248
|
+
disabled: M || !q || !!R,
|
|
3240
3249
|
onClick: () => void G(async () => ({
|
|
3241
3250
|
token_symbol: e.symbol,
|
|
3242
3251
|
psp_id: _e.psp_id
|
|
@@ -3248,17 +3257,17 @@ function ar({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3248
3257
|
]
|
|
3249
3258
|
}, e.symbol))
|
|
3250
3259
|
}) : null,
|
|
3251
|
-
|
|
3260
|
+
A ? /* @__PURE__ */ F("p", {
|
|
3252
3261
|
role: "alert",
|
|
3253
3262
|
className: "text-sm text-destructive",
|
|
3254
|
-
children:
|
|
3263
|
+
children: A
|
|
3255
3264
|
}) : null
|
|
3256
3265
|
]
|
|
3257
|
-
}) : /* @__PURE__ */
|
|
3266
|
+
}) : /* @__PURE__ */ F("p", {
|
|
3258
3267
|
role: "status",
|
|
3259
3268
|
className: "text-sm text-muted-foreground",
|
|
3260
3269
|
children: "This order can no longer be paid."
|
|
3261
|
-
}) : /* @__PURE__ */
|
|
3270
|
+
}) : /* @__PURE__ */ F("p", {
|
|
3262
3271
|
role: "status",
|
|
3263
3272
|
className: "text-sm text-muted-foreground",
|
|
3264
3273
|
children: "This bill is collected by the payment provider. No payment is needed here."
|
|
@@ -3269,11 +3278,11 @@ function ar({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3269
3278
|
//#region src/embedded-payment.tsx
|
|
3270
3279
|
var or = "openrails.payment.complete", sr = "openrails.payment.resize";
|
|
3271
3280
|
function cr({ url: e, onComplete: t, fallbacks: n, title: r = "Payment", className: i }) {
|
|
3272
|
-
let a =
|
|
3273
|
-
|
|
3281
|
+
let a = N.useRef(null), [o, s] = N.useState(), c = N.useRef(t);
|
|
3282
|
+
N.useEffect(() => {
|
|
3274
3283
|
c.current = t;
|
|
3275
3284
|
});
|
|
3276
|
-
let l =
|
|
3285
|
+
let l = N.useMemo(() => {
|
|
3277
3286
|
try {
|
|
3278
3287
|
let t = new URL(e);
|
|
3279
3288
|
return t.protocol === "https:" || t.protocol === "http:" ? t.origin : null;
|
|
@@ -3281,7 +3290,7 @@ function cr({ url: e, onComplete: t, fallbacks: n, title: r = "Payment", classNa
|
|
|
3281
3290
|
return null;
|
|
3282
3291
|
}
|
|
3283
3292
|
}, [e]);
|
|
3284
|
-
return
|
|
3293
|
+
return N.useEffect(() => {
|
|
3285
3294
|
if (!l) return;
|
|
3286
3295
|
let e = !1, t = (t) => {
|
|
3287
3296
|
if (t.origin !== l || !a.current || t.source !== a.current.contentWindow) return;
|
|
@@ -3301,7 +3310,7 @@ function cr({ url: e, onComplete: t, fallbacks: n, title: r = "Payment", classNa
|
|
|
3301
3310
|
}) : /^https?:\/\//i.test(i) && window.location.assign(i);
|
|
3302
3311
|
};
|
|
3303
3312
|
return window.addEventListener("message", t), () => window.removeEventListener("message", t);
|
|
3304
|
-
}, [l]), l ? /* @__PURE__ */
|
|
3313
|
+
}, [l]), l ? /* @__PURE__ */ F("iframe", {
|
|
3305
3314
|
ref: a,
|
|
3306
3315
|
src: er(e, n),
|
|
3307
3316
|
title: r,
|
|
@@ -3317,8 +3326,8 @@ function cr({ url: e, onComplete: t, fallbacks: n, title: r = "Payment", classNa
|
|
|
3317
3326
|
//#endregion
|
|
3318
3327
|
//#region src/cart.tsx
|
|
3319
3328
|
function lr({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i, className: a }) {
|
|
3320
|
-
let o = S(), s = T(), c = e ?? s.client, l = O(), [u, f] =
|
|
3321
|
-
|
|
3329
|
+
let o = S(), s = T(), c = e ?? s.client, l = O(), [u, f] = N.useState(), [p, m] = N.useState(), [h, g] = N.useState(), [_, v] = N.useState(!1), [y, b] = N.useState(() => crypto.randomUUID());
|
|
3330
|
+
N.useEffect(() => {
|
|
3322
3331
|
let e = new AbortController();
|
|
3323
3332
|
return c.getCart(e.signal).then(f, (t) => {
|
|
3324
3333
|
e.signal.aborted || g(o.error(t));
|
|
@@ -3336,7 +3345,7 @@ function lr({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i,
|
|
|
3336
3345
|
}
|
|
3337
3346
|
}
|
|
3338
3347
|
};
|
|
3339
|
-
if (p && !t) return /* @__PURE__ */
|
|
3348
|
+
if (p && !t) return /* @__PURE__ */ F(ar, {
|
|
3340
3349
|
orderId: p.id,
|
|
3341
3350
|
client: c,
|
|
3342
3351
|
onSettled: n,
|
|
@@ -3344,14 +3353,14 @@ function lr({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i,
|
|
|
3344
3353
|
appearance: i,
|
|
3345
3354
|
className: a
|
|
3346
3355
|
});
|
|
3347
|
-
if (!u) return h ? /* @__PURE__ */
|
|
3356
|
+
if (!u) return h ? /* @__PURE__ */ F("p", {
|
|
3348
3357
|
role: "alert",
|
|
3349
3358
|
className: "text-sm text-destructive",
|
|
3350
3359
|
children: h
|
|
3351
|
-
}) : /* @__PURE__ */
|
|
3352
|
-
let w = l[u.currency.toUpperCase()] ?? 2, D = (e) => d(e, u.currency, w),
|
|
3360
|
+
}) : /* @__PURE__ */ F(Gn, {});
|
|
3361
|
+
let w = l[u.currency.toUpperCase()] ?? 2, D = (e) => d(e, u.currency, w), ee = u.lines.length > 0 && u.lines.every((e) => !e.refusal), k = (e) => x(async () => {
|
|
3353
3362
|
f(await c.setCartLine(e, { quantity: 0 })), b(crypto.randomUUID());
|
|
3354
|
-
}),
|
|
3363
|
+
}), te = () => x(async () => {
|
|
3355
3364
|
let e = await c.createOrder({
|
|
3356
3365
|
cart: !0,
|
|
3357
3366
|
expectedTotal: u.total,
|
|
@@ -3360,63 +3369,63 @@ function lr({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i,
|
|
|
3360
3369
|
if (e.error) throw e.error;
|
|
3361
3370
|
m(e.order), t?.(e.order);
|
|
3362
3371
|
});
|
|
3363
|
-
return /* @__PURE__ */
|
|
3364
|
-
className:
|
|
3372
|
+
return /* @__PURE__ */ I("div", {
|
|
3373
|
+
className: L("orck grid gap-5", a),
|
|
3365
3374
|
"data-orck-theme": C(i),
|
|
3366
3375
|
style: E(i),
|
|
3367
3376
|
children: [
|
|
3368
|
-
u.lines.length === 0 ? /* @__PURE__ */
|
|
3377
|
+
u.lines.length === 0 ? /* @__PURE__ */ F("p", {
|
|
3369
3378
|
role: "status",
|
|
3370
3379
|
className: "text-sm text-muted-foreground",
|
|
3371
3380
|
children: "Your cart is empty."
|
|
3372
|
-
}) : /* @__PURE__ */
|
|
3381
|
+
}) : /* @__PURE__ */ I("div", {
|
|
3373
3382
|
className: "grid",
|
|
3374
|
-
children: [u.lines.map((e) => /* @__PURE__ */
|
|
3383
|
+
children: [u.lines.map((e) => /* @__PURE__ */ I("div", {
|
|
3375
3384
|
className: "grid gap-1 border-b border-border py-2 text-[13.5px]",
|
|
3376
3385
|
children: [
|
|
3377
|
-
/* @__PURE__ */
|
|
3386
|
+
/* @__PURE__ */ I("div", {
|
|
3378
3387
|
className: "flex items-start justify-between gap-4",
|
|
3379
|
-
children: [/* @__PURE__ */
|
|
3388
|
+
children: [/* @__PURE__ */ F("span", { children: e.description || e.price_id }), /* @__PURE__ */ F("span", {
|
|
3380
3389
|
className: "whitespace-nowrap tabular-nums",
|
|
3381
3390
|
children: D(e.amount)
|
|
3382
3391
|
})]
|
|
3383
3392
|
}),
|
|
3384
|
-
/* @__PURE__ */
|
|
3393
|
+
/* @__PURE__ */ I("div", {
|
|
3385
3394
|
className: "flex items-center gap-2",
|
|
3386
|
-
children: [e.quantity != null && e.quantity > 1 ? /* @__PURE__ */
|
|
3395
|
+
children: [e.quantity != null && e.quantity > 1 ? /* @__PURE__ */ I("span", {
|
|
3387
3396
|
className: "text-[13px] text-muted-foreground",
|
|
3388
3397
|
children: ["Quantity ", e.quantity]
|
|
3389
|
-
}) : null, /* @__PURE__ */
|
|
3398
|
+
}) : null, /* @__PURE__ */ F("button", {
|
|
3390
3399
|
type: "button",
|
|
3391
3400
|
className: "text-[13px] text-muted-foreground underline",
|
|
3392
3401
|
disabled: _,
|
|
3393
|
-
onClick: () => void
|
|
3402
|
+
onClick: () => void k(e.price_id),
|
|
3394
3403
|
children: "Remove"
|
|
3395
3404
|
})]
|
|
3396
3405
|
}),
|
|
3397
|
-
e.refusal ? /* @__PURE__ */
|
|
3406
|
+
e.refusal ? /* @__PURE__ */ F("p", {
|
|
3398
3407
|
className: "text-[13px] text-destructive",
|
|
3399
3408
|
children: e.refusal.message
|
|
3400
3409
|
}) : null
|
|
3401
3410
|
]
|
|
3402
|
-
}, e.price_id)), /* @__PURE__ */
|
|
3411
|
+
}, e.price_id)), /* @__PURE__ */ I("div", {
|
|
3403
3412
|
className: "flex items-start justify-between gap-4 pt-3 text-[13.5px] font-semibold",
|
|
3404
|
-
children: [/* @__PURE__ */
|
|
3413
|
+
children: [/* @__PURE__ */ F("span", { children: "Total" }), /* @__PURE__ */ F("span", {
|
|
3405
3414
|
className: "whitespace-nowrap tabular-nums",
|
|
3406
3415
|
children: D(u.total)
|
|
3407
3416
|
})]
|
|
3408
3417
|
})]
|
|
3409
3418
|
}),
|
|
3410
|
-
u.lines.length > 0 ? /* @__PURE__ */
|
|
3419
|
+
u.lines.length > 0 ? /* @__PURE__ */ I("form", {
|
|
3411
3420
|
className: "grid gap-2",
|
|
3412
3421
|
onSubmit: (e) => {
|
|
3413
|
-
e.preventDefault(),
|
|
3422
|
+
e.preventDefault(), te();
|
|
3414
3423
|
},
|
|
3415
|
-
children: [/* @__PURE__ */
|
|
3424
|
+
children: [/* @__PURE__ */ F(Q, {
|
|
3416
3425
|
label: "Check out",
|
|
3417
3426
|
processing: _,
|
|
3418
|
-
disabled: !
|
|
3419
|
-
}), /* @__PURE__ */
|
|
3427
|
+
disabled: !ee
|
|
3428
|
+
}), /* @__PURE__ */ F("button", {
|
|
3420
3429
|
type: "button",
|
|
3421
3430
|
className: "text-[13px] text-muted-foreground underline",
|
|
3422
3431
|
disabled: _,
|
|
@@ -3426,7 +3435,7 @@ function lr({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i,
|
|
|
3426
3435
|
children: "Empty cart"
|
|
3427
3436
|
})]
|
|
3428
3437
|
}) : null,
|
|
3429
|
-
h ? /* @__PURE__ */
|
|
3438
|
+
h ? /* @__PURE__ */ F("p", {
|
|
3430
3439
|
role: "alert",
|
|
3431
3440
|
className: "text-sm text-destructive",
|
|
3432
3441
|
children: h
|
|
@@ -3460,24 +3469,24 @@ function dr(e, t, n, r) {
|
|
|
3460
3469
|
//#endregion
|
|
3461
3470
|
//#region src/modal.tsx
|
|
3462
3471
|
function fr({ open: e, onOpenChange: t, appearance: n, children: r }) {
|
|
3463
|
-
return /* @__PURE__ */
|
|
3472
|
+
return /* @__PURE__ */ F(st, {
|
|
3464
3473
|
open: e,
|
|
3465
3474
|
onOpenChange: t,
|
|
3466
|
-
children: /* @__PURE__ */
|
|
3475
|
+
children: /* @__PURE__ */ I(ut, {
|
|
3467
3476
|
className: "orck max-h-[calc(100dvh-2rem)] w-[460px] max-w-[calc(100vw-2rem)] gap-0 overflow-hidden bg-background p-6 text-foreground ring-0 [&>[data-slot=dialog-close]]:top-5 [&>[data-slot=dialog-close]]:right-5 [&>[data-slot=dialog-close]]:text-foreground",
|
|
3468
3477
|
"data-orck-theme": C(n),
|
|
3469
3478
|
style: E(n),
|
|
3470
3479
|
showCloseButton: !0,
|
|
3471
3480
|
children: [
|
|
3472
|
-
/* @__PURE__ */
|
|
3481
|
+
/* @__PURE__ */ F(pt, {
|
|
3473
3482
|
className: "sr-only",
|
|
3474
3483
|
children: "Payment"
|
|
3475
3484
|
}),
|
|
3476
|
-
/* @__PURE__ */
|
|
3485
|
+
/* @__PURE__ */ F(mt, {
|
|
3477
3486
|
className: "sr-only",
|
|
3478
3487
|
children: "Complete your payment"
|
|
3479
3488
|
}),
|
|
3480
|
-
/* @__PURE__ */
|
|
3489
|
+
/* @__PURE__ */ F("div", {
|
|
3481
3490
|
className: "max-h-[calc(100dvh-5rem)] min-h-0 touch-pan-y [scrollbar-width:none] overflow-y-auto overscroll-contain pt-7 pr-6 [-webkit-overflow-scrolling:touch] [&::-webkit-scrollbar]:hidden",
|
|
3482
3491
|
children: r
|
|
3483
3492
|
})
|
|
@@ -3486,19 +3495,19 @@ function fr({ open: e, onOpenChange: t, appearance: n, children: r }) {
|
|
|
3486
3495
|
});
|
|
3487
3496
|
}
|
|
3488
3497
|
function pr({ open: e, onOpenChange: t, ...n }) {
|
|
3489
|
-
return /* @__PURE__ */
|
|
3498
|
+
return /* @__PURE__ */ F(fr, {
|
|
3490
3499
|
open: e,
|
|
3491
3500
|
onOpenChange: t,
|
|
3492
3501
|
appearance: n.appearance,
|
|
3493
|
-
children: /* @__PURE__ */
|
|
3502
|
+
children: /* @__PURE__ */ F(ar, { ...n })
|
|
3494
3503
|
});
|
|
3495
3504
|
}
|
|
3496
3505
|
function mr({ open: e, onOpenChange: t, appearance: n, ...r }) {
|
|
3497
|
-
return /* @__PURE__ */
|
|
3506
|
+
return /* @__PURE__ */ F(fr, {
|
|
3498
3507
|
open: e,
|
|
3499
3508
|
onOpenChange: t,
|
|
3500
3509
|
appearance: n,
|
|
3501
|
-
children: /* @__PURE__ */
|
|
3510
|
+
children: /* @__PURE__ */ F(cr, { ...r })
|
|
3502
3511
|
});
|
|
3503
3512
|
}
|
|
3504
3513
|
//#endregion
|
|
@@ -3510,9 +3519,9 @@ function hr(e) {
|
|
|
3510
3519
|
}
|
|
3511
3520
|
var gr = (e) => typeof window < "u" && e.includes(window.location.origin);
|
|
3512
3521
|
function _r({ price: t, label: i, amount: a, returnUrl: o, fallbacks: s, onPaid: c, onSignInRequired: l, signedIn: u, appearance: d, className: f }) {
|
|
3513
|
-
let p = S(), { locale: m } =
|
|
3522
|
+
let p = S(), { locale: m } = ee(), h = O(), g = x(d), { client: _ } = T(), [v, y] = N.useState(), [b, C] = N.useState(!1), [w, E] = N.useState(), D = (e) => {
|
|
3514
3523
|
e.status === "complete" && (y(void 0), c(e));
|
|
3515
|
-
},
|
|
3524
|
+
}, k = async () => {
|
|
3516
3525
|
if (u === !1) return l();
|
|
3517
3526
|
E(void 0), C(!0);
|
|
3518
3527
|
try {
|
|
@@ -3554,37 +3563,37 @@ function _r({ price: t, label: i, amount: a, returnUrl: o, fallbacks: s, onPaid:
|
|
|
3554
3563
|
} finally {
|
|
3555
3564
|
C(!1);
|
|
3556
3565
|
}
|
|
3557
|
-
},
|
|
3558
|
-
return /* @__PURE__ */
|
|
3559
|
-
className:
|
|
3566
|
+
}, te = (e) => !e && y(void 0);
|
|
3567
|
+
return /* @__PURE__ */ I("span", {
|
|
3568
|
+
className: L(g.className, "inline-flex flex-col gap-1", f),
|
|
3560
3569
|
"data-orck-theme": g["data-orck-theme"],
|
|
3561
3570
|
style: {
|
|
3562
3571
|
...g.style,
|
|
3563
3572
|
containerType: "normal"
|
|
3564
3573
|
},
|
|
3565
3574
|
children: [
|
|
3566
|
-
/* @__PURE__ */
|
|
3575
|
+
/* @__PURE__ */ F(U, {
|
|
3567
3576
|
disabled: b,
|
|
3568
|
-
onClick: () => void
|
|
3577
|
+
onClick: () => void k(),
|
|
3569
3578
|
children: i ?? dr(t, h, p, m)
|
|
3570
3579
|
}),
|
|
3571
|
-
w ? /* @__PURE__ */
|
|
3580
|
+
w ? /* @__PURE__ */ F("span", {
|
|
3572
3581
|
role: "alert",
|
|
3573
3582
|
className: "text-sm text-destructive",
|
|
3574
3583
|
children: w
|
|
3575
3584
|
}) : null,
|
|
3576
|
-
v?.kind === "inline" ? /* @__PURE__ */
|
|
3585
|
+
v?.kind === "inline" ? /* @__PURE__ */ F(pr, {
|
|
3577
3586
|
open: !0,
|
|
3578
|
-
onOpenChange:
|
|
3587
|
+
onOpenChange: te,
|
|
3579
3588
|
orderId: v.orderId,
|
|
3580
3589
|
returnUrl: o,
|
|
3581
3590
|
fallbacks: s,
|
|
3582
3591
|
appearance: d,
|
|
3583
3592
|
onSettled: D
|
|
3584
3593
|
}) : null,
|
|
3585
|
-
v?.kind === "embedded" ? /* @__PURE__ */
|
|
3594
|
+
v?.kind === "embedded" ? /* @__PURE__ */ F(mr, {
|
|
3586
3595
|
open: !0,
|
|
3587
|
-
onOpenChange:
|
|
3596
|
+
onOpenChange: te,
|
|
3588
3597
|
url: v.url,
|
|
3589
3598
|
fallbacks: s,
|
|
3590
3599
|
appearance: d,
|
|
@@ -3595,21 +3604,25 @@ function _r({ price: t, label: i, amount: a, returnUrl: o, fallbacks: s, onPaid:
|
|
|
3595
3604
|
}
|
|
3596
3605
|
//#endregion
|
|
3597
3606
|
//#region src/product-list.tsx
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3607
|
+
var vr = (e, t) => e.unit_amount === t.unit_amount && e.currency === t.currency && e.billing_interval_hours === t.billing_interval_hours && e.access_duration_hours === (t.provider?.access_duration_default ? t.billing_interval_hours : t.access_duration_hours) && !e.trial_unit_amount && !t.trial_unit_amount && !e.trial_duration_hours && !t.trial_duration_hours && !e.quantity && !t.quantity;
|
|
3608
|
+
function yr({ products: e, onPaid: t, onSignInRequired: n, signedIn: r, returnUrl: i, fallbacks: a, appearance: o, className: s }) {
|
|
3609
|
+
let c = S(), l = x(o), u = e.filter((e) => !e.archived).map((e) => {
|
|
3610
|
+
let t = e.prices.filter((e) => !e.archived && !e.customer_amount && (!e.provider || e.provider.rail === "ccbill"));
|
|
3611
|
+
return {
|
|
3612
|
+
product: e,
|
|
3613
|
+
prices: t.filter((e) => !e.provider || !t.some((t) => !t.provider && (!t.sell_via?.length || t.sell_via.includes("card")) && vr(t, e)))
|
|
3614
|
+
};
|
|
3615
|
+
}).filter((e) => e.prices.length > 0), d;
|
|
3616
|
+
return d = u.length === 0 ? /* @__PURE__ */ F(ze, { title: c.t("products.empty") }) : u.map(({ product: e, prices: s }) => /* @__PURE__ */ I(Ne, {
|
|
3604
3617
|
className: "gap-4",
|
|
3605
3618
|
"data-testid": "product",
|
|
3606
|
-
children: [/* @__PURE__ */
|
|
3619
|
+
children: [/* @__PURE__ */ I(K, { children: [/* @__PURE__ */ F(q, {
|
|
3607
3620
|
role: "heading",
|
|
3608
3621
|
"aria-level": 2,
|
|
3609
3622
|
children: e.display_name
|
|
3610
|
-
}), e.description ? /* @__PURE__ */
|
|
3623
|
+
}), e.description ? /* @__PURE__ */ F(Pe, { children: e.description }) : null] }), /* @__PURE__ */ F(Ie, {
|
|
3611
3624
|
className: "flex flex-wrap gap-2",
|
|
3612
|
-
children: s.map((e) => /* @__PURE__ */
|
|
3625
|
+
children: s.map((e) => /* @__PURE__ */ F(_r, {
|
|
3613
3626
|
price: e,
|
|
3614
3627
|
onPaid: t,
|
|
3615
3628
|
onSignInRequired: n,
|
|
@@ -3619,14 +3632,14 @@ function vr({ products: e, onPaid: t, onSignInRequired: n, signedIn: r, returnUr
|
|
|
3619
3632
|
appearance: o
|
|
3620
3633
|
}, e.id))
|
|
3621
3634
|
})]
|
|
3622
|
-
}, e.id)), /* @__PURE__ */
|
|
3623
|
-
className:
|
|
3635
|
+
}, e.id)), /* @__PURE__ */ F("div", {
|
|
3636
|
+
className: L(l.className, Me, "grid gap-4", s),
|
|
3624
3637
|
"data-orck-theme": l["data-orck-theme"],
|
|
3625
3638
|
style: l.style,
|
|
3626
3639
|
children: d
|
|
3627
3640
|
});
|
|
3628
3641
|
}
|
|
3629
3642
|
//#endregion
|
|
3630
|
-
export { Ln as AccountBilling, w as BillingProvider, Ue as BillingStatusBadge,
|
|
3643
|
+
export { Ln as AccountBilling, w as BillingProvider, Ue as BillingStatusBadge, H as BillingUiRoot, _r as BuyButton, kn as CancelSubscriptionDialog, Ze as CardBrandPlate, lr as Cart, cr as EmbeddedPayment, ar as OrderPayment, or as PAYMENT_COMPLETE_MESSAGE, sr as PAYMENT_RESIZE_MESSAGE, Ge as PaymentHistory, Dn as PaymentMethodsPanel, yr as ProductList, vn as SavePaymentMethod, In as SubscriptionsPanel, _n as TokenizedCardForm, c as addAmounts, l as amountToDecimal, ur as authenticateChange, Ot as browserCountry, a as canAuthenticatePayment, m as canSavePaymentMethod, s as cardSetupDriver, o as createBillingClient, v as createTranslator, re as defaultMessages, A as defineMessages, d as formatAmount, kt as initialCountry, b as interpolate, u as isAmount, g as pspConfigSchema, tr as readPaymentFragment, t as redeemAssertion, qe as resolveCardBrand, ie as resolveMessages, i as routedPsps, je as statusTone, h as tokenSource, S as useMessages, er as withPaymentFallbacks };
|
|
3631
3644
|
|
|
3632
3645
|
//# sourceMappingURL=index.js.map
|