@openrails/billing-ui 0.250.0 → 0.251.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/CHANGELOG.md +16 -0
- package/README.md +19 -1
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/routes.d.ts +3 -3
- package/dist/client/generated/wire.d.ts +1 -0
- package/dist/client/types.d.ts +6 -0
- package/dist/{client-HWr09qpX.js → client-imFR1UCe.js} +82 -81
- package/dist/client-imFR1UCe.js.map +1 -0
- package/dist/client.js +2 -2
- package/dist/hooks-C9JkHcRt.js +553 -0
- package/dist/hooks-C9JkHcRt.js.map +1 -0
- package/dist/index.js +778 -745
- package/dist/index.js.map +1 -1
- package/dist/react/config.d.ts +12 -3
- package/dist/react/provider.d.ts +14 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/client-HWr09qpX.js.map +0 -1
- package/dist/hooks-D9MR20BY.js +0 -537
- package/dist/hooks-D9MR20BY.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -11,18 +11,18 @@ if (typeof document !== "undefined") {
|
|
|
11
11
|
if (__orckStyle.textContent !== __orckCss) __orckStyle.textContent = __orckCss;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
import {
|
|
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
|
|
16
|
-
import { z as
|
|
17
|
-
import * as
|
|
18
|
-
import { Fragment as
|
|
19
|
-
import { cn as
|
|
20
|
-
import { Button as
|
|
21
|
-
import { cva as
|
|
22
|
-
import { mergeProps as
|
|
23
|
-
import { useRender as
|
|
24
|
-
import { HugeiconsIcon as
|
|
25
|
-
import { Add01Icon 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-imFR1UCe.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 ee, o as D, p as O, r as k, s as te, t as ne, v as re, x as A, y as j } from "./hooks-C9JkHcRt.js";
|
|
16
|
+
import { z as M } from "zod";
|
|
17
|
+
import * as N from "react";
|
|
18
|
+
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
19
|
+
import { cn as L } from "cn";
|
|
20
|
+
import { Button as ie } from "@base-ui/react/button";
|
|
21
|
+
import { cva as ae } from "class-variance-authority";
|
|
22
|
+
import { mergeProps as oe } from "@base-ui/react/merge-props";
|
|
23
|
+
import { useRender as se } from "@base-ui/react/use-render";
|
|
24
|
+
import { HugeiconsIcon as R } from "@hugeicons/react";
|
|
25
|
+
import { Add01Icon as ce, ArrowUpRight01Icon as le, Cancel01Icon as ue, Delete02Icon as z, Loading03Icon as de } from "@hugeicons/core-free-icons";
|
|
26
26
|
import { AlertDialog as B } from "@base-ui/react/alert-dialog";
|
|
27
27
|
import { Dialog as V } from "@base-ui/react/dialog";
|
|
28
28
|
import { Input as fe } from "@base-ui/react/input";
|
|
@@ -31,9 +31,9 @@ import { RadioGroup as pe } from "@base-ui/react/radio-group";
|
|
|
31
31
|
//#region src/scope.tsx
|
|
32
32
|
function me({ appearance: e, className: t, style: n, ...r }) {
|
|
33
33
|
let i = x(e);
|
|
34
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ F("div", {
|
|
35
35
|
"data-orck-theme": i["data-orck-theme"],
|
|
36
|
-
className:
|
|
36
|
+
className: L(i.className, t),
|
|
37
37
|
style: {
|
|
38
38
|
...i.style,
|
|
39
39
|
...n
|
|
@@ -43,7 +43,7 @@ function me({ appearance: e, className: t, style: n, ...r }) {
|
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
45
45
|
//#region src/components/ui/button.tsx
|
|
46
|
-
var he =
|
|
46
|
+
var he = ae("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", {
|
|
47
47
|
variants: {
|
|
48
48
|
variant: {
|
|
49
49
|
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
@@ -70,9 +70,9 @@ var he = ie("group/button inline-flex shrink-0 items-center justify-center round
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
function U({ className: e, variant: t = "default", size: n = "default", ...r }) {
|
|
73
|
-
return /* @__PURE__ */
|
|
73
|
+
return /* @__PURE__ */ F(ie, {
|
|
74
74
|
"data-slot": "button",
|
|
75
|
-
className:
|
|
75
|
+
className: L(he({
|
|
76
76
|
variant: t,
|
|
77
77
|
size: n,
|
|
78
78
|
className: e
|
|
@@ -104,7 +104,7 @@ function ve(e, t) {
|
|
|
104
104
|
}
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/account/format.ts
|
|
107
|
-
function
|
|
107
|
+
function ye(e, t) {
|
|
108
108
|
if (!e) return null;
|
|
109
109
|
let n = new Date(e);
|
|
110
110
|
if (Number.isNaN(n.getTime())) return null;
|
|
@@ -114,47 +114,47 @@ function W(e, t) {
|
|
|
114
114
|
return n.toISOString().slice(0, 10);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function W(e, t, n, r) {
|
|
118
118
|
if (!e) return null;
|
|
119
119
|
let i = n[t.toUpperCase()];
|
|
120
120
|
return i === void 0 ? null : d(e, t, i, r);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function be(e, t) {
|
|
123
123
|
return e ? e.billing_interval_hours ? _e(e.billing_interval_hours, t) : ve(e.access_duration_hours, t) ?? t.t("interval.once") : null;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function xe(e, { t }) {
|
|
126
126
|
return e.product?.display_name?.trim() || e.price?.key?.trim() || t("subscriptions.fallbackName");
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function Se(e, t, n) {
|
|
129
129
|
let r = [...new Set((t?.lines ?? []).map((e) => e.description.trim()).filter(Boolean))], i = t?.lines.length === 1 ? t.lines[0] : void 0;
|
|
130
130
|
return {
|
|
131
131
|
name: r.join(", ") || n.t(e.subscription_id ? "history.subscription" : "history.purchase"),
|
|
132
132
|
detail: i?.billing_interval_hours ? _e(i.billing_interval_hours, n) : null
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function G(e, t) {
|
|
136
136
|
let n = e?.trim();
|
|
137
137
|
return n ? n[0].toUpperCase() + n.slice(1).toLowerCase() : t;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
let n =
|
|
139
|
+
function Ce(e, t) {
|
|
140
|
+
let n = G(e?.brand, t.t("paymentMethods.fallbackBrand"));
|
|
141
141
|
if (!e?.last4) return n;
|
|
142
142
|
let r = t.t("paymentMethods.cardLabel", {
|
|
143
143
|
brand: n,
|
|
144
144
|
last4: e.last4
|
|
145
|
-
}), i =
|
|
145
|
+
}), i = we(e);
|
|
146
146
|
return i ? `${r} · ${i}` : r;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function we(e) {
|
|
149
149
|
return !e?.exp_month || !e.exp_year ? null : `${String(e.exp_month).padStart(2, "0")}/${String(e.exp_year).slice(-2)}`;
|
|
150
150
|
}
|
|
151
|
-
var
|
|
151
|
+
var Te = /* @__PURE__ */ new Set([
|
|
152
152
|
"active",
|
|
153
153
|
"pending",
|
|
154
154
|
"past_due",
|
|
155
155
|
"awaiting_method",
|
|
156
156
|
"unverified"
|
|
157
|
-
]),
|
|
157
|
+
]), Ee = (e) => !!e && new Date(e).getTime() > Date.now(), K = (e) => Te.has(e.status) || e.status === "canceled" && !!e.access && (!e.access.ends_at || Ee(e.access.ends_at)), q = (e) => K(e) && (!!e.cancel_scheduled || e.status === "canceled"), De = {
|
|
158
158
|
active: "success",
|
|
159
159
|
succeeded: "success",
|
|
160
160
|
paid: "success",
|
|
@@ -174,79 +174,79 @@ var Ce = /* @__PURE__ */ new Set([
|
|
|
174
174
|
//#endregion
|
|
175
175
|
//#region src/components/ui/card.tsx
|
|
176
176
|
function Ae({ className: e, size: t = "default", ...n }) {
|
|
177
|
-
return /* @__PURE__ */
|
|
177
|
+
return /* @__PURE__ */ F("div", {
|
|
178
178
|
"data-slot": "card",
|
|
179
179
|
"data-size": t,
|
|
180
|
-
className:
|
|
180
|
+
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),
|
|
181
181
|
...n
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
184
|
function je({ className: e, ...t }) {
|
|
185
|
-
return /* @__PURE__ */
|
|
185
|
+
return /* @__PURE__ */ F("div", {
|
|
186
186
|
"data-slot": "card-header",
|
|
187
|
-
className:
|
|
187
|
+
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),
|
|
188
188
|
...t
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
191
|
function Me({ className: e, ...t }) {
|
|
192
|
-
return /* @__PURE__ */
|
|
192
|
+
return /* @__PURE__ */ F("div", {
|
|
193
193
|
"data-slot": "card-title",
|
|
194
|
-
className:
|
|
194
|
+
className: L("text-base leading-normal font-medium group-data-[size=sm]/card:text-sm", e),
|
|
195
195
|
...t
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
function Ne({ className: e, ...t }) {
|
|
199
|
-
return /* @__PURE__ */
|
|
199
|
+
return /* @__PURE__ */ F("div", {
|
|
200
200
|
"data-slot": "card-description",
|
|
201
|
-
className:
|
|
201
|
+
className: L("text-sm text-muted-foreground", e),
|
|
202
202
|
...t
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
function Pe({ className: e, ...t }) {
|
|
206
|
-
return /* @__PURE__ */
|
|
206
|
+
return /* @__PURE__ */ F("div", {
|
|
207
207
|
"data-slot": "card-action",
|
|
208
|
-
className:
|
|
208
|
+
className: L("col-start-2 row-span-2 row-start-1 self-start justify-self-end", e),
|
|
209
209
|
...t
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
212
|
function Fe({ className: e, ...t }) {
|
|
213
|
-
return /* @__PURE__ */
|
|
213
|
+
return /* @__PURE__ */ F("div", {
|
|
214
214
|
"data-slot": "card-content",
|
|
215
|
-
className:
|
|
215
|
+
className: L("flex flex-col gap-3 px-(--card-spacing)", e),
|
|
216
216
|
...t
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
219
|
//#endregion
|
|
220
220
|
//#region src/components/ui/skeleton.tsx
|
|
221
221
|
function J({ className: e, ...t }) {
|
|
222
|
-
return /* @__PURE__ */
|
|
222
|
+
return /* @__PURE__ */ F("div", {
|
|
223
223
|
"data-slot": "skeleton",
|
|
224
|
-
className:
|
|
224
|
+
className: L("animate-pulse rounded-md bg-muted", e),
|
|
225
225
|
...t
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
228
|
//#endregion
|
|
229
229
|
//#region src/account/section.tsx
|
|
230
230
|
function Ie({ title: e, description: t, action: n, appearance: r, className: i, children: a, ...o }) {
|
|
231
|
-
let s = x(r), c =
|
|
232
|
-
return /* @__PURE__ */
|
|
231
|
+
let s = x(r), c = N.useId();
|
|
232
|
+
return /* @__PURE__ */ F("section", {
|
|
233
233
|
"aria-labelledby": c,
|
|
234
|
-
className:
|
|
234
|
+
className: L(s.className, ke, "block", i),
|
|
235
235
|
"data-orck-theme": s["data-orck-theme"],
|
|
236
236
|
style: s.style,
|
|
237
237
|
"data-testid": o["data-testid"],
|
|
238
|
-
children: /* @__PURE__ */
|
|
238
|
+
children: /* @__PURE__ */ I(Ae, {
|
|
239
239
|
className: "gap-4 bg-card text-card-foreground",
|
|
240
|
-
children: [/* @__PURE__ */
|
|
241
|
-
/* @__PURE__ */
|
|
240
|
+
children: [/* @__PURE__ */ I(je, { children: [
|
|
241
|
+
/* @__PURE__ */ F(Me, {
|
|
242
242
|
id: c,
|
|
243
243
|
role: "heading",
|
|
244
244
|
"aria-level": 2,
|
|
245
245
|
children: e
|
|
246
246
|
}),
|
|
247
|
-
t ? /* @__PURE__ */
|
|
248
|
-
n ? /* @__PURE__ */
|
|
249
|
-
] }), /* @__PURE__ */
|
|
247
|
+
t ? /* @__PURE__ */ F(Ne, { children: t }) : null,
|
|
248
|
+
n ? /* @__PURE__ */ F(Pe, { children: n }) : null
|
|
249
|
+
] }), /* @__PURE__ */ F(Fe, {
|
|
250
250
|
className: "gap-0",
|
|
251
251
|
children: a
|
|
252
252
|
})]
|
|
@@ -254,35 +254,35 @@ function Ie({ title: e, description: t, action: n, appearance: r, className: i,
|
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
256
|
function Le({ rows: e = 2 }) {
|
|
257
|
-
return /* @__PURE__ */
|
|
257
|
+
return /* @__PURE__ */ F("div", {
|
|
258
258
|
className: "grid gap-4 py-2",
|
|
259
259
|
"aria-hidden": !0,
|
|
260
|
-
children: Array.from({ length: e }, (e, t) => /* @__PURE__ */
|
|
260
|
+
children: Array.from({ length: e }, (e, t) => /* @__PURE__ */ I("div", {
|
|
261
261
|
className: "flex items-center gap-3",
|
|
262
262
|
children: [
|
|
263
|
-
/* @__PURE__ */
|
|
264
|
-
/* @__PURE__ */
|
|
263
|
+
/* @__PURE__ */ F(J, { className: "h-7 w-11 rounded-md" }),
|
|
264
|
+
/* @__PURE__ */ I("div", {
|
|
265
265
|
className: "grid flex-1 gap-2",
|
|
266
|
-
children: [/* @__PURE__ */
|
|
266
|
+
children: [/* @__PURE__ */ F(J, { className: "h-3.5 w-40" }), /* @__PURE__ */ F(J, { className: "h-3 w-28" })]
|
|
267
267
|
}),
|
|
268
|
-
/* @__PURE__ */
|
|
268
|
+
/* @__PURE__ */ F(J, { className: "h-3.5 w-14" })
|
|
269
269
|
]
|
|
270
270
|
}, t))
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
273
|
function Re({ title: e, description: t, action: n }) {
|
|
274
|
-
return /* @__PURE__ */
|
|
274
|
+
return /* @__PURE__ */ I("div", {
|
|
275
275
|
className: "grid justify-items-center gap-1 rounded-lg border border-dashed px-4 py-8 text-center",
|
|
276
276
|
children: [
|
|
277
|
-
/* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ F("p", {
|
|
278
278
|
className: "text-sm font-medium",
|
|
279
279
|
children: e
|
|
280
280
|
}),
|
|
281
|
-
t ? /* @__PURE__ */
|
|
281
|
+
t ? /* @__PURE__ */ F("p", {
|
|
282
282
|
className: "text-sm text-muted-foreground",
|
|
283
283
|
children: t
|
|
284
284
|
}) : null,
|
|
285
|
-
n ? /* @__PURE__ */
|
|
285
|
+
n ? /* @__PURE__ */ F("div", {
|
|
286
286
|
className: "mt-3",
|
|
287
287
|
children: n
|
|
288
288
|
}) : null
|
|
@@ -291,13 +291,13 @@ function Re({ title: e, description: t, action: n }) {
|
|
|
291
291
|
}
|
|
292
292
|
function Y({ error: e, message: t, onRetry: n }) {
|
|
293
293
|
let r = S();
|
|
294
|
-
return /* @__PURE__ */
|
|
294
|
+
return /* @__PURE__ */ I("div", {
|
|
295
295
|
role: "alert",
|
|
296
296
|
className: "flex flex-wrap items-center justify-between gap-3 rounded-lg bg-destructive/5 px-4 py-3",
|
|
297
|
-
children: [/* @__PURE__ */
|
|
297
|
+
children: [/* @__PURE__ */ F("p", {
|
|
298
298
|
className: "text-sm text-destructive",
|
|
299
299
|
children: t ?? r.error(e)
|
|
300
|
-
}), /* @__PURE__ */
|
|
300
|
+
}), /* @__PURE__ */ F(U, {
|
|
301
301
|
variant: "outline",
|
|
302
302
|
size: "sm",
|
|
303
303
|
onClick: n,
|
|
@@ -307,7 +307,7 @@ function Y({ error: e, message: t, onRetry: n }) {
|
|
|
307
307
|
}
|
|
308
308
|
//#endregion
|
|
309
309
|
//#region src/components/ui/badge.tsx
|
|
310
|
-
var ze =
|
|
310
|
+
var ze = ae("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!", {
|
|
311
311
|
variants: { variant: {
|
|
312
312
|
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
313
313
|
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
@@ -319,9 +319,9 @@ var ze = ie("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-cen
|
|
|
319
319
|
defaultVariants: { variant: "default" }
|
|
320
320
|
});
|
|
321
321
|
function Be({ className: e, variant: t = "default", render: n, ...r }) {
|
|
322
|
-
return
|
|
322
|
+
return se({
|
|
323
323
|
defaultTagName: "span",
|
|
324
|
-
props:
|
|
324
|
+
props: oe({ className: L(ze({ variant: t }), e) }, r),
|
|
325
325
|
render: n,
|
|
326
326
|
state: {
|
|
327
327
|
slot: "badge",
|
|
@@ -339,92 +339,92 @@ var Ve = {
|
|
|
339
339
|
};
|
|
340
340
|
function He({ status: e, label: t, className: n }) {
|
|
341
341
|
let { t: r, messages: i } = S(), a = e, o = t ?? (a in i.status ? r(`status.${a}`) : e.replace(/_/g, " "));
|
|
342
|
-
return /* @__PURE__ */
|
|
342
|
+
return /* @__PURE__ */ F(Be, {
|
|
343
343
|
"data-status": e,
|
|
344
|
-
className:
|
|
344
|
+
className: L(Ve[Oe(e)], "font-medium", n),
|
|
345
345
|
children: o
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
348
|
//#endregion
|
|
349
349
|
//#region src/account/payment-history.tsx
|
|
350
350
|
function Ue(e, t) {
|
|
351
|
-
if (e.card?.last4) return
|
|
351
|
+
if (e.card?.last4) return Ce(e.card, t);
|
|
352
352
|
let n = e.rail ?? "";
|
|
353
353
|
return n in t.messages.history.rail ? t.t(`history.rail.${n}`) : n || t.t("common.notAvailable");
|
|
354
354
|
}
|
|
355
355
|
function We({ appearance: e, className: t, ...n }) {
|
|
356
|
-
let r = S(), { t: i } = r, { locale: a } =
|
|
357
|
-
c = l === null && o.error ? /* @__PURE__ */
|
|
356
|
+
let r = S(), { t: i } = r, { locale: a } = O(), o = ee(n), s = D(), c, l = o.payments;
|
|
357
|
+
c = l === null && o.error ? /* @__PURE__ */ F(Y, {
|
|
358
358
|
error: o.error,
|
|
359
359
|
onRetry: o.refetch
|
|
360
|
-
}) : l === null ? /* @__PURE__ */
|
|
360
|
+
}) : l === null ? /* @__PURE__ */ F(Le, { rows: 3 }) : l.length === 0 && o.page === 0 ? /* @__PURE__ */ F(Re, {
|
|
361
361
|
title: i("history.empty"),
|
|
362
362
|
description: i("history.emptyDescription")
|
|
363
|
-
}) : /* @__PURE__ */
|
|
363
|
+
}) : /* @__PURE__ */ F("div", {
|
|
364
364
|
className: "-mx-1 overflow-x-auto px-1",
|
|
365
|
-
children: /* @__PURE__ */
|
|
366
|
-
className:
|
|
365
|
+
children: /* @__PURE__ */ I("table", {
|
|
366
|
+
className: L("w-full border-collapse text-sm", o.loading && "opacity-60 transition-opacity"),
|
|
367
367
|
"aria-busy": o.loading || void 0,
|
|
368
|
-
children: [/* @__PURE__ */
|
|
368
|
+
children: [/* @__PURE__ */ F("thead", { children: /* @__PURE__ */ I("tr", {
|
|
369
369
|
className: "border-b text-left text-xs text-muted-foreground",
|
|
370
370
|
children: [
|
|
371
|
-
/* @__PURE__ */
|
|
371
|
+
/* @__PURE__ */ F("th", {
|
|
372
372
|
scope: "col",
|
|
373
373
|
className: "hidden py-2 pr-3 font-medium @md:table-cell",
|
|
374
374
|
children: i("history.date")
|
|
375
375
|
}),
|
|
376
|
-
/* @__PURE__ */
|
|
376
|
+
/* @__PURE__ */ F("th", {
|
|
377
377
|
scope: "col",
|
|
378
378
|
className: "py-2 pr-3 font-medium",
|
|
379
379
|
children: i("history.item")
|
|
380
380
|
}),
|
|
381
|
-
/* @__PURE__ */
|
|
381
|
+
/* @__PURE__ */ F("th", {
|
|
382
382
|
scope: "col",
|
|
383
383
|
className: "hidden py-2 pr-3 font-medium @md:table-cell",
|
|
384
384
|
children: i("history.method")
|
|
385
385
|
}),
|
|
386
|
-
/* @__PURE__ */
|
|
386
|
+
/* @__PURE__ */ F("th", {
|
|
387
387
|
scope: "col",
|
|
388
388
|
className: "py-2 pr-3 font-medium",
|
|
389
389
|
children: i("history.status")
|
|
390
390
|
}),
|
|
391
|
-
/* @__PURE__ */
|
|
391
|
+
/* @__PURE__ */ F("th", {
|
|
392
392
|
scope: "col",
|
|
393
393
|
className: "py-2 text-right font-medium",
|
|
394
394
|
children: i("history.amount")
|
|
395
395
|
})
|
|
396
396
|
]
|
|
397
|
-
}) }), /* @__PURE__ */
|
|
397
|
+
}) }), /* @__PURE__ */ F("tbody", {
|
|
398
398
|
className: "divide-y divide-border",
|
|
399
399
|
children: l.map((e) => {
|
|
400
|
-
let t = e.kind === "refund", n = e.status || (t ? "refunded" : "unknown"), c =
|
|
401
|
-
return /* @__PURE__ */
|
|
400
|
+
let t = e.kind === "refund", n = e.status || (t ? "refunded" : "unknown"), c = W(e.amount, e.currency, s, a), l = !t && e.amount_refunded && e.amount_refunded !== "0" ? W(e.amount_refunded, e.currency, s, a) : null, u = ye(e.created_at, a) ?? i("common.notAvailable"), d = Se(e, e.order_id ? o.orders[e.order_id] : void 0, r);
|
|
401
|
+
return /* @__PURE__ */ I("tr", {
|
|
402
402
|
"data-testid": "payment-row",
|
|
403
403
|
"data-payment-id": e.id,
|
|
404
404
|
children: [
|
|
405
|
-
/* @__PURE__ */
|
|
405
|
+
/* @__PURE__ */ F("td", {
|
|
406
406
|
className: "hidden py-3 pr-3 align-top whitespace-nowrap tabular-nums @md:table-cell",
|
|
407
407
|
children: u
|
|
408
408
|
}),
|
|
409
|
-
/* @__PURE__ */
|
|
409
|
+
/* @__PURE__ */ I("td", {
|
|
410
410
|
className: "py-3 pr-3 align-top",
|
|
411
411
|
children: [
|
|
412
|
-
/* @__PURE__ */
|
|
412
|
+
/* @__PURE__ */ F("div", {
|
|
413
413
|
"data-testid": "payment-item",
|
|
414
414
|
className: "font-medium",
|
|
415
415
|
children: d.name
|
|
416
416
|
}),
|
|
417
|
-
e.status === "failed" && e.failure?.message ? /* @__PURE__ */
|
|
417
|
+
e.status === "failed" && e.failure?.message ? /* @__PURE__ */ F("div", {
|
|
418
418
|
"data-testid": "payment-failure",
|
|
419
419
|
className: "text-xs text-destructive",
|
|
420
420
|
children: e.failure.message
|
|
421
421
|
}) : null,
|
|
422
|
-
d.detail ? /* @__PURE__ */
|
|
422
|
+
d.detail ? /* @__PURE__ */ F("div", {
|
|
423
423
|
"data-testid": "payment-period",
|
|
424
424
|
className: "text-xs text-muted-foreground",
|
|
425
425
|
children: d.detail
|
|
426
426
|
}) : null,
|
|
427
|
-
/* @__PURE__ */
|
|
427
|
+
/* @__PURE__ */ I("div", {
|
|
428
428
|
className: "text-xs text-muted-foreground tabular-nums @md:hidden",
|
|
429
429
|
children: [
|
|
430
430
|
u,
|
|
@@ -434,20 +434,20 @@ function We({ appearance: e, className: t, ...n }) {
|
|
|
434
434
|
})
|
|
435
435
|
]
|
|
436
436
|
}),
|
|
437
|
-
/* @__PURE__ */
|
|
437
|
+
/* @__PURE__ */ F("td", {
|
|
438
438
|
className: "hidden py-3 pr-3 align-top text-muted-foreground tabular-nums @md:table-cell",
|
|
439
439
|
children: Ue(e, r)
|
|
440
440
|
}),
|
|
441
|
-
/* @__PURE__ */
|
|
441
|
+
/* @__PURE__ */ F("td", {
|
|
442
442
|
className: "py-3 pr-3 align-top",
|
|
443
|
-
children: /* @__PURE__ */
|
|
443
|
+
children: /* @__PURE__ */ F(He, {
|
|
444
444
|
status: n,
|
|
445
445
|
label: t ? i("history.refund") : void 0
|
|
446
446
|
})
|
|
447
447
|
}),
|
|
448
|
-
/* @__PURE__ */
|
|
448
|
+
/* @__PURE__ */ I("td", {
|
|
449
449
|
className: "py-3 text-right align-top font-medium whitespace-nowrap tabular-nums",
|
|
450
|
-
children: [c ?? i("common.notAvailable"), l ? /* @__PURE__ */
|
|
450
|
+
children: [c ?? i("common.notAvailable"), l ? /* @__PURE__ */ F("div", {
|
|
451
451
|
className: "text-xs font-normal text-muted-foreground",
|
|
452
452
|
children: i("history.refundedAmount", { amount: l })
|
|
453
453
|
}) : null]
|
|
@@ -459,7 +459,7 @@ function We({ appearance: e, className: t, ...n }) {
|
|
|
459
459
|
})
|
|
460
460
|
});
|
|
461
461
|
let u = o.page > 0 || o.hasMore;
|
|
462
|
-
return /* @__PURE__ */
|
|
462
|
+
return /* @__PURE__ */ I(Ie, {
|
|
463
463
|
title: i("history.title"),
|
|
464
464
|
description: i("history.description"),
|
|
465
465
|
appearance: e,
|
|
@@ -467,28 +467,28 @@ function We({ appearance: e, className: t, ...n }) {
|
|
|
467
467
|
"data-testid": "payment-history",
|
|
468
468
|
children: [
|
|
469
469
|
c,
|
|
470
|
-
l !== null && o.error ? /* @__PURE__ */
|
|
470
|
+
l !== null && o.error ? /* @__PURE__ */ F("div", {
|
|
471
471
|
className: "pt-3",
|
|
472
|
-
children: /* @__PURE__ */
|
|
472
|
+
children: /* @__PURE__ */ F(Y, {
|
|
473
473
|
error: o.error,
|
|
474
474
|
onRetry: o.refetch
|
|
475
475
|
})
|
|
476
476
|
}) : null,
|
|
477
|
-
u ? /* @__PURE__ */
|
|
477
|
+
u ? /* @__PURE__ */ I("nav", {
|
|
478
478
|
"aria-label": i("history.title"),
|
|
479
479
|
className: "flex items-center justify-between gap-3 pt-4",
|
|
480
|
-
children: [/* @__PURE__ */
|
|
480
|
+
children: [/* @__PURE__ */ F("span", {
|
|
481
481
|
className: "text-xs text-muted-foreground tabular-nums",
|
|
482
482
|
children: i("history.page", { page: o.page + 1 })
|
|
483
|
-
}), /* @__PURE__ */
|
|
483
|
+
}), /* @__PURE__ */ I("div", {
|
|
484
484
|
className: "flex gap-2",
|
|
485
|
-
children: [/* @__PURE__ */
|
|
485
|
+
children: [/* @__PURE__ */ F(U, {
|
|
486
486
|
variant: "outline",
|
|
487
487
|
size: "sm",
|
|
488
488
|
disabled: o.page === 0 || o.loading,
|
|
489
489
|
onClick: o.previous,
|
|
490
490
|
children: i("common.previous")
|
|
491
|
-
}), /* @__PURE__ */
|
|
491
|
+
}), /* @__PURE__ */ F(U, {
|
|
492
492
|
variant: "outline",
|
|
493
493
|
size: "sm",
|
|
494
494
|
disabled: !o.hasMore || o.loading,
|
|
@@ -518,39 +518,39 @@ function Ke(e) {
|
|
|
518
518
|
//#endregion
|
|
519
519
|
//#region src/components/card-brands.tsx
|
|
520
520
|
function qe() {
|
|
521
|
-
return /* @__PURE__ */
|
|
521
|
+
return /* @__PURE__ */ F("svg", {
|
|
522
522
|
viewBox: "0 0 1000 324.68",
|
|
523
523
|
className: "h-2.5 w-auto",
|
|
524
524
|
role: "presentation",
|
|
525
|
-
children: /* @__PURE__ */
|
|
525
|
+
children: /* @__PURE__ */ F("path", {
|
|
526
526
|
fill: "#1434cb",
|
|
527
527
|
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"
|
|
528
528
|
})
|
|
529
529
|
});
|
|
530
530
|
}
|
|
531
531
|
function Je() {
|
|
532
|
-
return /* @__PURE__ */
|
|
532
|
+
return /* @__PURE__ */ F("svg", {
|
|
533
533
|
viewBox: "0 0 152.4 108",
|
|
534
534
|
className: "h-4 w-auto",
|
|
535
535
|
role: "presentation",
|
|
536
|
-
children: /* @__PURE__ */
|
|
536
|
+
children: /* @__PURE__ */ I("g", { children: [/* @__PURE__ */ F("rect", {
|
|
537
537
|
y: "0",
|
|
538
538
|
fill: "none",
|
|
539
539
|
width: "152.4",
|
|
540
540
|
height: "108"
|
|
541
|
-
}), /* @__PURE__ */
|
|
542
|
-
/* @__PURE__ */
|
|
541
|
+
}), /* @__PURE__ */ I("g", { children: [
|
|
542
|
+
/* @__PURE__ */ F("rect", {
|
|
543
543
|
x: "60.4",
|
|
544
544
|
y: "25.7",
|
|
545
545
|
fill: "#FF5F00",
|
|
546
546
|
width: "31.5",
|
|
547
547
|
height: "56.6"
|
|
548
548
|
}),
|
|
549
|
-
/* @__PURE__ */
|
|
549
|
+
/* @__PURE__ */ F("path", {
|
|
550
550
|
fill: "#EB001B",
|
|
551
551
|
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"
|
|
552
552
|
}),
|
|
553
|
-
/* @__PURE__ */
|
|
553
|
+
/* @__PURE__ */ F("path", {
|
|
554
554
|
fill: "#F79E1B",
|
|
555
555
|
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"
|
|
556
556
|
})
|
|
@@ -558,63 +558,63 @@ function Je() {
|
|
|
558
558
|
});
|
|
559
559
|
}
|
|
560
560
|
function Ye() {
|
|
561
|
-
let e = `orck-amex-${
|
|
562
|
-
return /* @__PURE__ */
|
|
561
|
+
let e = `orck-amex-${N.useId().replace(/[^a-zA-Z0-9-]/g, "")}`;
|
|
562
|
+
return /* @__PURE__ */ I("svg", {
|
|
563
563
|
viewBox: "0 0 300 300",
|
|
564
564
|
className: "h-full w-auto",
|
|
565
565
|
role: "presentation",
|
|
566
566
|
children: [
|
|
567
|
-
/* @__PURE__ */
|
|
567
|
+
/* @__PURE__ */ I("radialGradient", {
|
|
568
568
|
id: e,
|
|
569
569
|
cx: "57.3882",
|
|
570
570
|
cy: "57.021",
|
|
571
571
|
r: "264.5797",
|
|
572
572
|
gradientUnits: "userSpaceOnUse",
|
|
573
573
|
children: [
|
|
574
|
-
/* @__PURE__ */
|
|
574
|
+
/* @__PURE__ */ F("stop", {
|
|
575
575
|
offset: "0",
|
|
576
576
|
stopColor: "#9DD5F6"
|
|
577
577
|
}),
|
|
578
|
-
/* @__PURE__ */
|
|
578
|
+
/* @__PURE__ */ F("stop", {
|
|
579
579
|
offset: "0.0711",
|
|
580
580
|
stopColor: "#98D3F5"
|
|
581
581
|
}),
|
|
582
|
-
/* @__PURE__ */
|
|
582
|
+
/* @__PURE__ */ F("stop", {
|
|
583
583
|
offset: "0.1575",
|
|
584
584
|
stopColor: "#89CEF3"
|
|
585
585
|
}),
|
|
586
|
-
/* @__PURE__ */
|
|
586
|
+
/* @__PURE__ */ F("stop", {
|
|
587
587
|
offset: "0.2516",
|
|
588
588
|
stopColor: "#70C6EF"
|
|
589
589
|
}),
|
|
590
|
-
/* @__PURE__ */
|
|
590
|
+
/* @__PURE__ */ F("stop", {
|
|
591
591
|
offset: "0.3514",
|
|
592
592
|
stopColor: "#4EBBEA"
|
|
593
593
|
}),
|
|
594
|
-
/* @__PURE__ */
|
|
594
|
+
/* @__PURE__ */ F("stop", {
|
|
595
595
|
offset: "0.4546",
|
|
596
596
|
stopColor: "#23ADE3"
|
|
597
597
|
}),
|
|
598
|
-
/* @__PURE__ */
|
|
598
|
+
/* @__PURE__ */ F("stop", {
|
|
599
599
|
offset: "0.5",
|
|
600
600
|
stopColor: "#0DA6E0"
|
|
601
601
|
}),
|
|
602
|
-
/* @__PURE__ */
|
|
602
|
+
/* @__PURE__ */ F("stop", {
|
|
603
603
|
offset: "1",
|
|
604
604
|
stopColor: "#2E77BC"
|
|
605
605
|
})
|
|
606
606
|
]
|
|
607
607
|
}),
|
|
608
|
-
/* @__PURE__ */
|
|
608
|
+
/* @__PURE__ */ F("path", {
|
|
609
609
|
fill: `url(#${e})`,
|
|
610
610
|
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"
|
|
611
611
|
}),
|
|
612
|
-
/* @__PURE__ */
|
|
613
|
-
/* @__PURE__ */
|
|
612
|
+
/* @__PURE__ */ F("g", {}),
|
|
613
|
+
/* @__PURE__ */ F("path", {
|
|
614
614
|
fill: "#FFFFFF",
|
|
615
615
|
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"
|
|
616
616
|
}),
|
|
617
|
-
/* @__PURE__ */
|
|
617
|
+
/* @__PURE__ */ F("path", {
|
|
618
618
|
fill: "#FFFFFF",
|
|
619
619
|
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"
|
|
620
620
|
})
|
|
@@ -623,74 +623,74 @@ function Ye() {
|
|
|
623
623
|
}
|
|
624
624
|
function Xe({ brand: e, fallback: t, className: n }) {
|
|
625
625
|
let r = Ke(e);
|
|
626
|
-
return /* @__PURE__ */
|
|
626
|
+
return /* @__PURE__ */ F("span", {
|
|
627
627
|
"aria-hidden": !0,
|
|
628
|
-
className:
|
|
629
|
-
children: r === "visa" ? /* @__PURE__ */
|
|
628
|
+
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),
|
|
629
|
+
children: r === "visa" ? /* @__PURE__ */ F(qe, {}) : r === "mastercard" ? /* @__PURE__ */ F(Je, {}) : r === "amex" ? /* @__PURE__ */ F(Ye, {}) : t
|
|
630
630
|
});
|
|
631
631
|
}
|
|
632
632
|
//#endregion
|
|
633
633
|
//#region src/components/ui/alert-dialog.tsx
|
|
634
634
|
function Ze({ ...e }) {
|
|
635
|
-
return /* @__PURE__ */
|
|
635
|
+
return /* @__PURE__ */ F(B.Root, {
|
|
636
636
|
"data-slot": "alert-dialog",
|
|
637
637
|
...e
|
|
638
638
|
});
|
|
639
639
|
}
|
|
640
640
|
function Qe({ ...e }) {
|
|
641
|
-
return /* @__PURE__ */
|
|
641
|
+
return /* @__PURE__ */ F(B.Portal, {
|
|
642
642
|
"data-slot": "alert-dialog-portal",
|
|
643
643
|
...e
|
|
644
644
|
});
|
|
645
645
|
}
|
|
646
646
|
function $e({ className: e, ...t }) {
|
|
647
|
-
return /* @__PURE__ */
|
|
647
|
+
return /* @__PURE__ */ F(B.Backdrop, {
|
|
648
648
|
"data-slot": "alert-dialog-overlay",
|
|
649
|
-
className:
|
|
649
|
+
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),
|
|
650
650
|
...t
|
|
651
651
|
});
|
|
652
652
|
}
|
|
653
653
|
function et({ className: e, size: t = "default", ...n }) {
|
|
654
|
-
return /* @__PURE__ */
|
|
654
|
+
return /* @__PURE__ */ I(Qe, { children: [/* @__PURE__ */ F($e, {}), /* @__PURE__ */ F(B.Popup, {
|
|
655
655
|
"data-slot": "alert-dialog-content",
|
|
656
656
|
"data-size": t,
|
|
657
|
-
className:
|
|
657
|
+
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),
|
|
658
658
|
...n
|
|
659
659
|
})] });
|
|
660
660
|
}
|
|
661
661
|
function tt({ className: e, ...t }) {
|
|
662
|
-
return /* @__PURE__ */
|
|
662
|
+
return /* @__PURE__ */ F("div", {
|
|
663
663
|
"data-slot": "alert-dialog-header",
|
|
664
|
-
className:
|
|
664
|
+
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),
|
|
665
665
|
...t
|
|
666
666
|
});
|
|
667
667
|
}
|
|
668
668
|
function nt({ className: e, ...t }) {
|
|
669
|
-
return /* @__PURE__ */
|
|
669
|
+
return /* @__PURE__ */ F("div", {
|
|
670
670
|
"data-slot": "alert-dialog-footer",
|
|
671
|
-
className:
|
|
671
|
+
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),
|
|
672
672
|
...t
|
|
673
673
|
});
|
|
674
674
|
}
|
|
675
675
|
function rt({ className: e, ...t }) {
|
|
676
|
-
return /* @__PURE__ */
|
|
676
|
+
return /* @__PURE__ */ F(B.Title, {
|
|
677
677
|
"data-slot": "alert-dialog-title",
|
|
678
|
-
className:
|
|
678
|
+
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),
|
|
679
679
|
...t
|
|
680
680
|
});
|
|
681
681
|
}
|
|
682
682
|
function it({ className: e, ...t }) {
|
|
683
|
-
return /* @__PURE__ */
|
|
683
|
+
return /* @__PURE__ */ F(B.Description, {
|
|
684
684
|
"data-slot": "alert-dialog-description",
|
|
685
|
-
className:
|
|
685
|
+
className: L("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", e),
|
|
686
686
|
...t
|
|
687
687
|
});
|
|
688
688
|
}
|
|
689
689
|
function at({ className: e, variant: t = "outline", size: n = "default", ...r }) {
|
|
690
|
-
return /* @__PURE__ */
|
|
690
|
+
return /* @__PURE__ */ F(B.Close, {
|
|
691
691
|
"data-slot": "alert-dialog-cancel",
|
|
692
|
-
className:
|
|
693
|
-
render: /* @__PURE__ */
|
|
692
|
+
className: L(e),
|
|
693
|
+
render: /* @__PURE__ */ F(U, {
|
|
694
694
|
variant: t,
|
|
695
695
|
size: n
|
|
696
696
|
}),
|
|
@@ -700,40 +700,40 @@ function at({ className: e, variant: t = "outline", size: n = "default", ...r })
|
|
|
700
700
|
//#endregion
|
|
701
701
|
//#region src/components/ui/dialog.tsx
|
|
702
702
|
function ot({ ...e }) {
|
|
703
|
-
return /* @__PURE__ */
|
|
703
|
+
return /* @__PURE__ */ F(V.Root, {
|
|
704
704
|
"data-slot": "dialog",
|
|
705
705
|
...e
|
|
706
706
|
});
|
|
707
707
|
}
|
|
708
708
|
function st({ ...e }) {
|
|
709
|
-
return /* @__PURE__ */
|
|
709
|
+
return /* @__PURE__ */ F(V.Portal, {
|
|
710
710
|
"data-slot": "dialog-portal",
|
|
711
711
|
...e
|
|
712
712
|
});
|
|
713
713
|
}
|
|
714
714
|
function ct({ className: e, ...t }) {
|
|
715
|
-
return /* @__PURE__ */
|
|
715
|
+
return /* @__PURE__ */ F(V.Backdrop, {
|
|
716
716
|
"data-slot": "dialog-overlay",
|
|
717
|
-
className:
|
|
717
|
+
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),
|
|
718
718
|
...t
|
|
719
719
|
});
|
|
720
720
|
}
|
|
721
721
|
function lt({ className: e, children: t, showCloseButton: n = !0, ...r }) {
|
|
722
|
-
return /* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ I(st, { children: [/* @__PURE__ */ F(ct, {}), /* @__PURE__ */ I(V.Popup, {
|
|
723
723
|
"data-slot": "dialog-content",
|
|
724
|
-
className:
|
|
724
|
+
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),
|
|
725
725
|
...r,
|
|
726
|
-
children: [t, n && /* @__PURE__ */
|
|
726
|
+
children: [t, n && /* @__PURE__ */ I(V.Close, {
|
|
727
727
|
"data-slot": "dialog-close",
|
|
728
|
-
render: /* @__PURE__ */
|
|
728
|
+
render: /* @__PURE__ */ F(U, {
|
|
729
729
|
variant: "ghost",
|
|
730
730
|
className: "absolute top-4 right-4",
|
|
731
731
|
size: "icon-sm"
|
|
732
732
|
}),
|
|
733
|
-
children: [/* @__PURE__ */
|
|
734
|
-
icon:
|
|
733
|
+
children: [/* @__PURE__ */ F(R, {
|
|
734
|
+
icon: ue,
|
|
735
735
|
strokeWidth: 2
|
|
736
|
-
}), /* @__PURE__ */
|
|
736
|
+
}), /* @__PURE__ */ F("span", {
|
|
737
737
|
className: "sr-only",
|
|
738
738
|
children: "Close"
|
|
739
739
|
})]
|
|
@@ -741,34 +741,34 @@ function lt({ className: e, children: t, showCloseButton: n = !0, ...r }) {
|
|
|
741
741
|
})] });
|
|
742
742
|
}
|
|
743
743
|
function ut({ className: e, ...t }) {
|
|
744
|
-
return /* @__PURE__ */
|
|
744
|
+
return /* @__PURE__ */ F("div", {
|
|
745
745
|
"data-slot": "dialog-header",
|
|
746
|
-
className:
|
|
746
|
+
className: L("flex flex-col gap-2", e),
|
|
747
747
|
...t
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
750
|
function dt({ className: e, showCloseButton: t = !1, children: n, ...r }) {
|
|
751
|
-
return /* @__PURE__ */
|
|
751
|
+
return /* @__PURE__ */ I("div", {
|
|
752
752
|
"data-slot": "dialog-footer",
|
|
753
|
-
className:
|
|
753
|
+
className: L("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", e),
|
|
754
754
|
...r,
|
|
755
|
-
children: [n, t && /* @__PURE__ */
|
|
756
|
-
render: /* @__PURE__ */
|
|
755
|
+
children: [n, t && /* @__PURE__ */ F(V.Close, {
|
|
756
|
+
render: /* @__PURE__ */ F(U, { variant: "outline" }),
|
|
757
757
|
children: "Close"
|
|
758
758
|
})]
|
|
759
759
|
});
|
|
760
760
|
}
|
|
761
761
|
function ft({ className: e, ...t }) {
|
|
762
|
-
return /* @__PURE__ */
|
|
762
|
+
return /* @__PURE__ */ F(V.Title, {
|
|
763
763
|
"data-slot": "dialog-title",
|
|
764
|
-
className:
|
|
764
|
+
className: L("leading-none font-medium", e),
|
|
765
765
|
...t
|
|
766
766
|
});
|
|
767
767
|
}
|
|
768
768
|
function pt({ className: e, ...t }) {
|
|
769
|
-
return /* @__PURE__ */
|
|
769
|
+
return /* @__PURE__ */ F(V.Description, {
|
|
770
770
|
"data-slot": "dialog-description",
|
|
771
|
-
className:
|
|
771
|
+
className: L("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", e),
|
|
772
772
|
...t
|
|
773
773
|
});
|
|
774
774
|
}
|
|
@@ -776,32 +776,32 @@ function pt({ className: e, ...t }) {
|
|
|
776
776
|
//#region src/components/ui/spinner.tsx
|
|
777
777
|
function X({ className: e, ...t }) {
|
|
778
778
|
let { t: n } = S();
|
|
779
|
-
return /* @__PURE__ */
|
|
779
|
+
return /* @__PURE__ */ F(R, {
|
|
780
780
|
icon: de,
|
|
781
781
|
strokeWidth: 2,
|
|
782
782
|
"data-slot": "spinner",
|
|
783
783
|
role: "status",
|
|
784
784
|
"aria-label": n("common.loading"),
|
|
785
|
-
className:
|
|
785
|
+
className: L("size-4 animate-spin", e),
|
|
786
786
|
...t
|
|
787
787
|
});
|
|
788
788
|
}
|
|
789
789
|
//#endregion
|
|
790
790
|
//#region src/components/ui/input.tsx
|
|
791
791
|
function mt({ className: e, type: t, ...n }) {
|
|
792
|
-
return /* @__PURE__ */
|
|
792
|
+
return /* @__PURE__ */ F(fe, {
|
|
793
793
|
type: t,
|
|
794
794
|
"data-slot": "input",
|
|
795
|
-
className:
|
|
795
|
+
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),
|
|
796
796
|
...n
|
|
797
797
|
});
|
|
798
798
|
}
|
|
799
799
|
//#endregion
|
|
800
800
|
//#region src/components/ui/label.tsx
|
|
801
801
|
function Z({ className: e, ...t }) {
|
|
802
|
-
return /* @__PURE__ */
|
|
802
|
+
return /* @__PURE__ */ F("label", {
|
|
803
803
|
"data-slot": "label",
|
|
804
|
-
className:
|
|
804
|
+
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),
|
|
805
805
|
...t
|
|
806
806
|
});
|
|
807
807
|
}
|
|
@@ -824,7 +824,7 @@ var ht = "AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH B
|
|
|
824
824
|
}, vt = new Intl.DisplayNames(["en"], { type: "region" }), yt = ht.map((e) => ({
|
|
825
825
|
code: e,
|
|
826
826
|
name: vt.of(e) ?? e
|
|
827
|
-
})).sort((e, t) => e.name.localeCompare(t.name)), bt =
|
|
827
|
+
})).sort((e, t) => e.name.localeCompare(t.name)), bt = M.string().trim().min(1, "Name on card is required").max(200, "Name on card is too long"), xt = M.string().trim().regex(/^[A-Za-z]{2}$/, "Select a country").transform((e) => e.toUpperCase());
|
|
828
828
|
function St(e) {
|
|
829
829
|
let t = e.trim().toUpperCase();
|
|
830
830
|
return t === "" || !gt.has(t);
|
|
@@ -838,10 +838,10 @@ function Ct(e, t) {
|
|
|
838
838
|
pattern: n === "US" ? "[0-9]{5}(?:-[0-9]{4})?" : void 0
|
|
839
839
|
};
|
|
840
840
|
}
|
|
841
|
-
var wt =
|
|
841
|
+
var wt = M.object({
|
|
842
842
|
name_on_card: bt,
|
|
843
843
|
country: xt,
|
|
844
|
-
zip:
|
|
844
|
+
zip: M.string().trim().max(32, "Postal code is too long")
|
|
845
845
|
}).superRefine((e, t) => {
|
|
846
846
|
St(e.country) && !e.zip && t.addIssue({
|
|
847
847
|
code: "custom",
|
|
@@ -888,13 +888,13 @@ function Ot(e) {
|
|
|
888
888
|
//#region src/components/billing-fields.tsx
|
|
889
889
|
var kt = "text-[13px] font-medium text-foreground", At = "h-[38px] rounded-[9px] border border-input bg-card text-sm text-foreground", jt = `${At} px-2.5`;
|
|
890
890
|
function Mt({ 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 }) {
|
|
891
|
-
return /* @__PURE__ */
|
|
891
|
+
return /* @__PURE__ */ I("div", {
|
|
892
892
|
className: "grid gap-1.5",
|
|
893
|
-
children: [/* @__PURE__ */
|
|
893
|
+
children: [/* @__PURE__ */ F(Z, {
|
|
894
894
|
htmlFor: e,
|
|
895
895
|
className: kt,
|
|
896
896
|
children: n
|
|
897
|
-
}), /* @__PURE__ */
|
|
897
|
+
}), /* @__PURE__ */ F(mt, {
|
|
898
898
|
id: e,
|
|
899
899
|
name: t,
|
|
900
900
|
type: u,
|
|
@@ -912,13 +912,13 @@ function Mt({ id: e, name: t, label: n, value: r, onChange: i, autoComplete: a,
|
|
|
912
912
|
});
|
|
913
913
|
}
|
|
914
914
|
function Nt({ id: e, value: t, onChange: n, disabled: r }) {
|
|
915
|
-
return /* @__PURE__ */
|
|
915
|
+
return /* @__PURE__ */ I("div", {
|
|
916
916
|
className: "grid gap-1.5",
|
|
917
|
-
children: [/* @__PURE__ */
|
|
917
|
+
children: [/* @__PURE__ */ F(Z, {
|
|
918
918
|
htmlFor: e,
|
|
919
919
|
className: kt,
|
|
920
920
|
children: "Country"
|
|
921
|
-
}), /* @__PURE__ */
|
|
921
|
+
}), /* @__PURE__ */ I("select", {
|
|
922
922
|
id: e,
|
|
923
923
|
name: "country",
|
|
924
924
|
className: `${At} w-full px-2.5`,
|
|
@@ -927,10 +927,10 @@ function Nt({ id: e, value: t, onChange: n, disabled: r }) {
|
|
|
927
927
|
disabled: r,
|
|
928
928
|
required: !0,
|
|
929
929
|
onChange: (e) => n(e.target.value),
|
|
930
|
-
children: [/* @__PURE__ */
|
|
930
|
+
children: [/* @__PURE__ */ F("option", {
|
|
931
931
|
value: "",
|
|
932
932
|
children: "Select country"
|
|
933
|
-
}), yt.map((e) => /* @__PURE__ */
|
|
933
|
+
}), yt.map((e) => /* @__PURE__ */ F("option", {
|
|
934
934
|
value: e.code,
|
|
935
935
|
children: e.name
|
|
936
936
|
}, e.code))]
|
|
@@ -939,9 +939,9 @@ function Nt({ id: e, value: t, onChange: n, disabled: r }) {
|
|
|
939
939
|
}
|
|
940
940
|
function Pt({ id: e, value: t, country: n, onChange: r, disabled: i, required: a, error: o }) {
|
|
941
941
|
let s = Ct(n, a);
|
|
942
|
-
return /* @__PURE__ */
|
|
942
|
+
return /* @__PURE__ */ I("div", {
|
|
943
943
|
className: "grid gap-1.5",
|
|
944
|
-
children: [/* @__PURE__ */
|
|
944
|
+
children: [/* @__PURE__ */ F(Mt, {
|
|
945
945
|
id: e,
|
|
946
946
|
name: "zip",
|
|
947
947
|
label: s.label,
|
|
@@ -954,7 +954,7 @@ function Pt({ id: e, value: t, country: n, onChange: r, disabled: i, required: a
|
|
|
954
954
|
required: a,
|
|
955
955
|
inputMode: s.inputMode,
|
|
956
956
|
pattern: s.pattern
|
|
957
|
-
}), o ? /* @__PURE__ */
|
|
957
|
+
}), o ? /* @__PURE__ */ F("p", {
|
|
958
958
|
className: "text-[12.5px] text-destructive",
|
|
959
959
|
role: "alert",
|
|
960
960
|
children: o
|
|
@@ -966,9 +966,9 @@ function Ft({ idPrefix: e, value: t, onChange: n, disabled: r, postalError: i })
|
|
|
966
966
|
...t,
|
|
967
967
|
[e]: r
|
|
968
968
|
}), o = St(t.country);
|
|
969
|
-
return /* @__PURE__ */
|
|
969
|
+
return /* @__PURE__ */ I("div", {
|
|
970
970
|
className: "grid gap-3",
|
|
971
|
-
children: [/* @__PURE__ */
|
|
971
|
+
children: [/* @__PURE__ */ F(Mt, {
|
|
972
972
|
id: `${e}-name-on-card`,
|
|
973
973
|
name: "name_on_card",
|
|
974
974
|
label: "Name on card",
|
|
@@ -979,14 +979,14 @@ function Ft({ idPrefix: e, value: t, onChange: n, disabled: r, postalError: i })
|
|
|
979
979
|
disabled: r,
|
|
980
980
|
maxLength: 200,
|
|
981
981
|
required: !0
|
|
982
|
-
}), /* @__PURE__ */
|
|
982
|
+
}), /* @__PURE__ */ I("div", {
|
|
983
983
|
className: "grid grid-cols-2 gap-3",
|
|
984
|
-
children: [/* @__PURE__ */
|
|
984
|
+
children: [/* @__PURE__ */ F(Nt, {
|
|
985
985
|
id: `${e}-country`,
|
|
986
986
|
value: t.country,
|
|
987
987
|
onChange: a("country"),
|
|
988
988
|
disabled: r
|
|
989
|
-
}), /* @__PURE__ */
|
|
989
|
+
}), /* @__PURE__ */ F(Pt, {
|
|
990
990
|
id: `${e}-postal-code`,
|
|
991
991
|
value: t.zip,
|
|
992
992
|
country: t.country,
|
|
@@ -1001,7 +1001,7 @@ function Ft({ idPrefix: e, value: t, onChange: n, disabled: r, postalError: i })
|
|
|
1001
1001
|
//#endregion
|
|
1002
1002
|
//#region src/components/card-fields.tsx
|
|
1003
1003
|
function It({ id: e, message: t }) {
|
|
1004
|
-
return t ? /* @__PURE__ */
|
|
1004
|
+
return t ? /* @__PURE__ */ F("p", {
|
|
1005
1005
|
id: e,
|
|
1006
1006
|
className: "text-[12.5px] text-destructive",
|
|
1007
1007
|
role: "alert",
|
|
@@ -1010,80 +1010,80 @@ function It({ id: e, message: t }) {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
var Lt = "orck-collect-field h-[38px] overflow-hidden rounded-[9px] border border-[color:var(--border)] bg-card px-[3px]", Rt = "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";
|
|
1012
1012
|
function zt({ ids: e, preview: t, error: n, fieldErrors: r = {}, hidden: i }) {
|
|
1013
|
-
return /* @__PURE__ */
|
|
1014
|
-
className:
|
|
1013
|
+
return /* @__PURE__ */ I("div", {
|
|
1014
|
+
className: L("grid gap-3", i && "hidden"),
|
|
1015
1015
|
"aria-hidden": i || void 0,
|
|
1016
1016
|
children: [
|
|
1017
|
-
/* @__PURE__ */
|
|
1017
|
+
/* @__PURE__ */ I("div", {
|
|
1018
1018
|
className: "grid gap-1.5",
|
|
1019
1019
|
children: [
|
|
1020
|
-
/* @__PURE__ */
|
|
1020
|
+
/* @__PURE__ */ F(Z, {
|
|
1021
1021
|
htmlFor: e.number,
|
|
1022
1022
|
className: "text-[13px] font-medium text-foreground",
|
|
1023
1023
|
children: "Card number"
|
|
1024
1024
|
}),
|
|
1025
|
-
t ? /* @__PURE__ */
|
|
1025
|
+
t ? /* @__PURE__ */ F("div", {
|
|
1026
1026
|
id: e.number,
|
|
1027
1027
|
className: Rt,
|
|
1028
1028
|
children: "1234 1234 1234 1234"
|
|
1029
|
-
}) : /* @__PURE__ */
|
|
1029
|
+
}) : /* @__PURE__ */ F("div", {
|
|
1030
1030
|
id: e.number,
|
|
1031
|
-
className:
|
|
1031
|
+
className: L(Lt, r.number && "border-destructive")
|
|
1032
1032
|
}),
|
|
1033
|
-
/* @__PURE__ */
|
|
1033
|
+
/* @__PURE__ */ F(It, {
|
|
1034
1034
|
id: `${e.number}-error`,
|
|
1035
1035
|
message: r.number
|
|
1036
1036
|
})
|
|
1037
1037
|
]
|
|
1038
1038
|
}),
|
|
1039
|
-
/* @__PURE__ */
|
|
1039
|
+
/* @__PURE__ */ I("div", {
|
|
1040
1040
|
className: "grid grid-cols-2 gap-3",
|
|
1041
|
-
children: [/* @__PURE__ */
|
|
1041
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1042
1042
|
className: "grid gap-1.5",
|
|
1043
1043
|
children: [
|
|
1044
|
-
/* @__PURE__ */
|
|
1044
|
+
/* @__PURE__ */ F(Z, {
|
|
1045
1045
|
htmlFor: e.expiry,
|
|
1046
1046
|
className: "text-[13px] font-medium text-foreground",
|
|
1047
1047
|
children: "Expiry"
|
|
1048
1048
|
}),
|
|
1049
|
-
t ? /* @__PURE__ */
|
|
1049
|
+
t ? /* @__PURE__ */ F("div", {
|
|
1050
1050
|
id: e.expiry,
|
|
1051
1051
|
className: Rt,
|
|
1052
1052
|
children: "MM / YY"
|
|
1053
|
-
}) : /* @__PURE__ */
|
|
1053
|
+
}) : /* @__PURE__ */ F("div", {
|
|
1054
1054
|
id: e.expiry,
|
|
1055
|
-
className:
|
|
1055
|
+
className: L(Lt, r.expiry && "border-destructive")
|
|
1056
1056
|
}),
|
|
1057
|
-
/* @__PURE__ */
|
|
1057
|
+
/* @__PURE__ */ F(It, {
|
|
1058
1058
|
id: `${e.expiry}-error`,
|
|
1059
1059
|
message: r.expiry
|
|
1060
1060
|
})
|
|
1061
1061
|
]
|
|
1062
|
-
}), /* @__PURE__ */
|
|
1062
|
+
}), /* @__PURE__ */ I("div", {
|
|
1063
1063
|
className: "grid gap-1.5",
|
|
1064
1064
|
children: [
|
|
1065
|
-
/* @__PURE__ */
|
|
1065
|
+
/* @__PURE__ */ F(Z, {
|
|
1066
1066
|
htmlFor: e.cvv,
|
|
1067
1067
|
className: "text-[13px] font-medium text-foreground",
|
|
1068
1068
|
children: "CVC"
|
|
1069
1069
|
}),
|
|
1070
|
-
t ? /* @__PURE__ */
|
|
1070
|
+
t ? /* @__PURE__ */ F("div", {
|
|
1071
1071
|
id: e.cvv,
|
|
1072
1072
|
className: Rt,
|
|
1073
1073
|
children: "CVC"
|
|
1074
|
-
}) : /* @__PURE__ */
|
|
1074
|
+
}) : /* @__PURE__ */ F("div", {
|
|
1075
1075
|
id: e.cvv,
|
|
1076
|
-
className:
|
|
1076
|
+
className: L(Lt, r.cvv && "border-destructive")
|
|
1077
1077
|
}),
|
|
1078
|
-
/* @__PURE__ */
|
|
1078
|
+
/* @__PURE__ */ F(It, {
|
|
1079
1079
|
id: `${e.cvv}-error`,
|
|
1080
1080
|
message: r.cvv
|
|
1081
1081
|
})
|
|
1082
1082
|
]
|
|
1083
1083
|
})]
|
|
1084
1084
|
}),
|
|
1085
|
-
n ? /* @__PURE__ */
|
|
1086
|
-
className:
|
|
1085
|
+
n ? /* @__PURE__ */ F("p", {
|
|
1086
|
+
className: L("text-[13px] text-destructive"),
|
|
1087
1087
|
role: "alert",
|
|
1088
1088
|
children: n
|
|
1089
1089
|
}) : null
|
|
@@ -1095,10 +1095,10 @@ function Vt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1095
1095
|
let a = {
|
|
1096
1096
|
...t.fieldErrors,
|
|
1097
1097
|
...n
|
|
1098
|
-
}, o = (e, n, i, a) => /* @__PURE__ */
|
|
1098
|
+
}, o = (e, n, i, a) => /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("input", {
|
|
1099
1099
|
id: e,
|
|
1100
1100
|
name: `card-${n}`,
|
|
1101
|
-
className:
|
|
1101
|
+
className: L(Bt, i && "border-destructive"),
|
|
1102
1102
|
value: t.input[n],
|
|
1103
1103
|
onChange: (e) => t.change(n, e.target.value),
|
|
1104
1104
|
onBlur: () => t.leave(n),
|
|
@@ -1109,16 +1109,16 @@ function Vt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1109
1109
|
"aria-invalid": i ? !0 : void 0,
|
|
1110
1110
|
"aria-describedby": i ? `${e}-error` : void 0,
|
|
1111
1111
|
...a
|
|
1112
|
-
}), /* @__PURE__ */
|
|
1112
|
+
}), /* @__PURE__ */ F(It, {
|
|
1113
1113
|
id: `${e}-error`,
|
|
1114
1114
|
message: i
|
|
1115
1115
|
})] });
|
|
1116
|
-
return /* @__PURE__ */
|
|
1117
|
-
className:
|
|
1116
|
+
return /* @__PURE__ */ I("div", {
|
|
1117
|
+
className: L("grid gap-3", i && "hidden"),
|
|
1118
1118
|
"aria-hidden": i || void 0,
|
|
1119
|
-
children: [/* @__PURE__ */
|
|
1119
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1120
1120
|
className: "grid gap-1.5",
|
|
1121
|
-
children: [/* @__PURE__ */
|
|
1121
|
+
children: [/* @__PURE__ */ F(Z, {
|
|
1122
1122
|
htmlFor: e.number,
|
|
1123
1123
|
className: "text-[13px] font-medium text-foreground",
|
|
1124
1124
|
children: "Card number"
|
|
@@ -1127,11 +1127,11 @@ function Vt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1127
1127
|
placeholder: "1234 1234 1234 1234",
|
|
1128
1128
|
maxLength: 23
|
|
1129
1129
|
})]
|
|
1130
|
-
}), /* @__PURE__ */
|
|
1130
|
+
}), /* @__PURE__ */ I("div", {
|
|
1131
1131
|
className: "grid grid-cols-2 gap-3",
|
|
1132
|
-
children: [/* @__PURE__ */
|
|
1132
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1133
1133
|
className: "grid gap-1.5",
|
|
1134
|
-
children: [/* @__PURE__ */
|
|
1134
|
+
children: [/* @__PURE__ */ F(Z, {
|
|
1135
1135
|
htmlFor: e.expiry,
|
|
1136
1136
|
className: "text-[13px] font-medium text-foreground",
|
|
1137
1137
|
children: "Expiry"
|
|
@@ -1140,9 +1140,9 @@ function Vt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1140
1140
|
placeholder: "MM / YY",
|
|
1141
1141
|
maxLength: 7
|
|
1142
1142
|
})]
|
|
1143
|
-
}), /* @__PURE__ */
|
|
1143
|
+
}), /* @__PURE__ */ I("div", {
|
|
1144
1144
|
className: "grid gap-1.5",
|
|
1145
|
-
children: [/* @__PURE__ */
|
|
1145
|
+
children: [/* @__PURE__ */ F(Z, {
|
|
1146
1146
|
htmlFor: e.cvv,
|
|
1147
1147
|
className: "text-[13px] font-medium text-foreground",
|
|
1148
1148
|
children: "CVC"
|
|
@@ -1158,25 +1158,25 @@ function Vt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1158
1158
|
//#endregion
|
|
1159
1159
|
//#region src/components/pay-button.tsx
|
|
1160
1160
|
function Q({ label: e, processing: t, disabled: n }) {
|
|
1161
|
-
return /* @__PURE__ */
|
|
1161
|
+
return /* @__PURE__ */ F(U, {
|
|
1162
1162
|
type: "submit",
|
|
1163
|
-
className:
|
|
1163
|
+
className: L("h-[42px] w-full rounded-[10px] text-sm font-semibold tabular-nums", t && "opacity-75"),
|
|
1164
1164
|
disabled: n || t,
|
|
1165
|
-
children: t ? /* @__PURE__ */
|
|
1165
|
+
children: t ? /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("span", {
|
|
1166
1166
|
"aria-hidden": !0,
|
|
1167
1167
|
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"
|
|
1168
1168
|
}), "Processing…"] }) : e
|
|
1169
1169
|
});
|
|
1170
1170
|
}
|
|
1171
1171
|
function Ht() {
|
|
1172
|
-
return /* @__PURE__ */
|
|
1172
|
+
return /* @__PURE__ */ I("div", {
|
|
1173
1173
|
className: "-mt-1 flex items-center justify-center gap-1.5 text-xs text-[color:var(--orck-faint)]",
|
|
1174
|
-
children: [/* @__PURE__ */
|
|
1174
|
+
children: [/* @__PURE__ */ F("svg", {
|
|
1175
1175
|
viewBox: "0 0 16 16",
|
|
1176
1176
|
fill: "currentColor",
|
|
1177
1177
|
"aria-hidden": !0,
|
|
1178
1178
|
className: "size-[11px]",
|
|
1179
|
-
children: /* @__PURE__ */
|
|
1179
|
+
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" })
|
|
1180
1180
|
}), "Secured by OpenRails"]
|
|
1181
1181
|
});
|
|
1182
1182
|
}
|
|
@@ -1237,8 +1237,8 @@ var Qt = {
|
|
|
1237
1237
|
cvv: "Enter a valid security code"
|
|
1238
1238
|
};
|
|
1239
1239
|
function en(e) {
|
|
1240
|
-
let t = e.enabled && Zt(e.tokenizationKey), [n, r] =
|
|
1241
|
-
|
|
1240
|
+
let t = e.enabled && Zt(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;
|
|
1241
|
+
N.useEffect(() => {
|
|
1242
1242
|
if (!e.enabled || t || !e.tokenizationKey || !e.scriptURL || typeof document > "u") return;
|
|
1243
1243
|
let n = Jt(e.scriptURL);
|
|
1244
1244
|
if (!n) {
|
|
@@ -1357,7 +1357,7 @@ function en(e) {
|
|
|
1357
1357
|
d,
|
|
1358
1358
|
f
|
|
1359
1359
|
]);
|
|
1360
|
-
let p =
|
|
1360
|
+
let p = N.useCallback(() => new Promise((e, r) => {
|
|
1361
1361
|
if (t) {
|
|
1362
1362
|
e({
|
|
1363
1363
|
token: "preview_payment_token",
|
|
@@ -1455,13 +1455,13 @@ function nn(e) {
|
|
|
1455
1455
|
}
|
|
1456
1456
|
//#endregion
|
|
1457
1457
|
//#region src/components/stripe-card.tsx
|
|
1458
|
-
var rn =
|
|
1459
|
-
let [s, c] =
|
|
1460
|
-
|
|
1458
|
+
var rn = N.forwardRef(function({ psp: e, client: t, defaultCountry: n, onCompleteChange: r, unavailableMessage: i, verificationPendingMessage: a }, o) {
|
|
1459
|
+
let [s, c] = N.useState(), l = N.useRef(null), u = N.useRef(null), d = N.useRef(r);
|
|
1460
|
+
N.useEffect(() => {
|
|
1461
1461
|
d.current = r;
|
|
1462
1462
|
});
|
|
1463
1463
|
let f = e.config?.publishable_key;
|
|
1464
|
-
return
|
|
1464
|
+
return N.useEffect(() => {
|
|
1465
1465
|
if (!f || !l.current) return;
|
|
1466
1466
|
let e = !1, t;
|
|
1467
1467
|
return Wt(f).then((r) => {
|
|
@@ -1494,7 +1494,7 @@ var rn = P.forwardRef(function({ psp: e, client: t, defaultCountry: n, onComplet
|
|
|
1494
1494
|
f,
|
|
1495
1495
|
n,
|
|
1496
1496
|
i
|
|
1497
|
-
]),
|
|
1497
|
+
]), N.useImperativeHandle(o, () => {
|
|
1498
1498
|
let n = async () => {
|
|
1499
1499
|
let e = u.current;
|
|
1500
1500
|
if (!e) throw Error(i);
|
|
@@ -1527,12 +1527,12 @@ var rn = P.forwardRef(function({ psp: e, client: t, defaultCountry: n, onComplet
|
|
|
1527
1527
|
e.psp_id,
|
|
1528
1528
|
i,
|
|
1529
1529
|
a
|
|
1530
|
-
]), /* @__PURE__ */
|
|
1530
|
+
]), /* @__PURE__ */ I("div", {
|
|
1531
1531
|
className: "grid gap-2",
|
|
1532
|
-
children: [/* @__PURE__ */
|
|
1532
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1533
1533
|
ref: l,
|
|
1534
1534
|
"data-testid": "stripe-card-entry"
|
|
1535
|
-
}), s ? /* @__PURE__ */
|
|
1535
|
+
}), s ? /* @__PURE__ */ F("p", {
|
|
1536
1536
|
role: "alert",
|
|
1537
1537
|
className: "text-[13px] text-destructive",
|
|
1538
1538
|
children: s
|
|
@@ -1598,9 +1598,9 @@ var pn = {
|
|
|
1598
1598
|
cvc: ""
|
|
1599
1599
|
};
|
|
1600
1600
|
function mn() {
|
|
1601
|
-
let [e, t] =
|
|
1601
|
+
let [e, t] = N.useState(pn), [n, r] = N.useState({}), i = dn(e), a = {};
|
|
1602
1602
|
n.number && i.number && (a.number = i.number), n.expiry && i.expiry && (a.expiry = i.expiry), n.cvc && i.cvv && (a.cvv = i.cvv);
|
|
1603
|
-
let o =
|
|
1603
|
+
let o = N.useCallback(() => {
|
|
1604
1604
|
t(pn), r({});
|
|
1605
1605
|
}, []);
|
|
1606
1606
|
return {
|
|
@@ -1629,18 +1629,18 @@ function mn() {
|
|
|
1629
1629
|
//#endregion
|
|
1630
1630
|
//#region src/tokenized-card-form.tsx
|
|
1631
1631
|
function hn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabel: r = "Save card", disabled: i = !1, defaultCountry: a, appearance: o, className: s }) {
|
|
1632
|
-
let c =
|
|
1632
|
+
let c = N.useId().replace(/[^a-zA-Z0-9-]/g, ""), l = N.useMemo(() => ({
|
|
1633
1633
|
number: `orck-save-${c}-number`,
|
|
1634
1634
|
expiry: `orck-save-${c}-expiry`,
|
|
1635
1635
|
cvv: `orck-save-${c}-cvv`
|
|
1636
|
-
}), [c]), [u, d] =
|
|
1636
|
+
}), [c]), [u, d] = N.useState(() => ({
|
|
1637
1637
|
...Et,
|
|
1638
1638
|
country: Ot(a)
|
|
1639
|
-
})), [f, p] =
|
|
1639
|
+
})), [f, p] = N.useState(!1), [m, h] = N.useState(!1), [g, _] = N.useState(), v = N.useRef({
|
|
1640
1640
|
generation: 0,
|
|
1641
1641
|
disabled: i
|
|
1642
1642
|
});
|
|
1643
|
-
|
|
1643
|
+
N.useLayoutEffect(() => {
|
|
1644
1644
|
v.current = {
|
|
1645
1645
|
generation: v.current.generation + 1,
|
|
1646
1646
|
disabled: i
|
|
@@ -1650,8 +1650,8 @@ function hn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1650
1650
|
t,
|
|
1651
1651
|
i
|
|
1652
1652
|
]);
|
|
1653
|
-
let y =
|
|
1654
|
-
|
|
1653
|
+
let y = N.useRef(!0);
|
|
1654
|
+
N.useEffect(() => (y.current = !0, () => {
|
|
1655
1655
|
y.current = !1;
|
|
1656
1656
|
}), []);
|
|
1657
1657
|
let b = en({
|
|
@@ -1687,39 +1687,39 @@ function hn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1687
1687
|
y.current && p(!1);
|
|
1688
1688
|
}
|
|
1689
1689
|
};
|
|
1690
|
-
return /* @__PURE__ */
|
|
1691
|
-
className:
|
|
1690
|
+
return /* @__PURE__ */ F("div", {
|
|
1691
|
+
className: L("orck", s),
|
|
1692
1692
|
"data-orck-theme": C(o),
|
|
1693
1693
|
style: E(o),
|
|
1694
|
-
children: /* @__PURE__ */
|
|
1694
|
+
children: /* @__PURE__ */ I("form", {
|
|
1695
1695
|
"aria-label": "Secure card setup",
|
|
1696
1696
|
autoComplete: "on",
|
|
1697
1697
|
className: "grid gap-4",
|
|
1698
1698
|
onSubmit: (e) => void x(e),
|
|
1699
1699
|
children: [
|
|
1700
|
-
/* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ F(Ft, {
|
|
1701
1701
|
idPrefix: `orck-save-${c}`,
|
|
1702
1702
|
value: u,
|
|
1703
1703
|
onChange: d,
|
|
1704
1704
|
disabled: i || f || m
|
|
1705
1705
|
}),
|
|
1706
|
-
/* @__PURE__ */
|
|
1706
|
+
/* @__PURE__ */ F(zt, {
|
|
1707
1707
|
ids: l,
|
|
1708
1708
|
preview: b.preview,
|
|
1709
1709
|
error: b.loadError,
|
|
1710
1710
|
fieldErrors: b.fieldErrors
|
|
1711
1711
|
}),
|
|
1712
|
-
g ? /* @__PURE__ */
|
|
1712
|
+
g ? /* @__PURE__ */ F("p", {
|
|
1713
1713
|
role: "alert",
|
|
1714
1714
|
className: "text-sm text-destructive",
|
|
1715
1715
|
children: g
|
|
1716
1716
|
}) : null,
|
|
1717
|
-
/* @__PURE__ */
|
|
1717
|
+
/* @__PURE__ */ F(Q, {
|
|
1718
1718
|
label: r,
|
|
1719
1719
|
processing: f,
|
|
1720
1720
|
disabled: i || m || !b.ready || !b.valid || !!b.loadError
|
|
1721
1721
|
}),
|
|
1722
|
-
/* @__PURE__ */
|
|
1722
|
+
/* @__PURE__ */ F(Ht, {})
|
|
1723
1723
|
]
|
|
1724
1724
|
})
|
|
1725
1725
|
});
|
|
@@ -1727,29 +1727,29 @@ function hn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1727
1727
|
//#endregion
|
|
1728
1728
|
//#region src/save-payment-method.tsx
|
|
1729
1729
|
function gn(e) {
|
|
1730
|
-
let { t } = S(), n =
|
|
1731
|
-
return n ? /* @__PURE__ */
|
|
1732
|
-
className:
|
|
1730
|
+
let { t } = S(), n = s(e.psp);
|
|
1731
|
+
return n ? /* @__PURE__ */ I("div", {
|
|
1732
|
+
className: L("orck grid gap-4", e.className),
|
|
1733
1733
|
"data-orck-theme": C(e.appearance),
|
|
1734
1734
|
style: E(e.appearance),
|
|
1735
|
-
children: [/* @__PURE__ */
|
|
1735
|
+
children: [/* @__PURE__ */ F("p", {
|
|
1736
1736
|
className: "text-sm text-muted-foreground",
|
|
1737
1737
|
children: t("paymentMethods.saveNotice")
|
|
1738
|
-
}),
|
|
1739
|
-
}) : /* @__PURE__ */
|
|
1738
|
+
}), F(n === "collect_js" ? vn : n === "card" ? yn : bn, { ...e })]
|
|
1739
|
+
}) : /* @__PURE__ */ F("p", {
|
|
1740
1740
|
role: "alert",
|
|
1741
1741
|
className: "text-sm text-destructive",
|
|
1742
1742
|
children: t("paymentMethods.unavailable")
|
|
1743
1743
|
});
|
|
1744
1744
|
}
|
|
1745
|
-
var _n = (e, t) => !
|
|
1745
|
+
var _n = (e, t) => !n(t) && t instanceof Error && t.message ? t.message : e.error(t);
|
|
1746
1746
|
function vn({ psp: e, onSaved: t, submitLabel: n, appearance: r, defaultCountry: i }) {
|
|
1747
|
-
let a = S(), { client: o, notify: s } = T(), [c, l] =
|
|
1748
|
-
return /* @__PURE__ */
|
|
1747
|
+
let a = S(), { client: o, notify: s } = T(), [c, l] = N.useState(0), [u, d] = N.useState();
|
|
1748
|
+
return /* @__PURE__ */ I(P, { children: [u ? /* @__PURE__ */ F("p", {
|
|
1749
1749
|
role: "alert",
|
|
1750
1750
|
className: "text-sm text-destructive",
|
|
1751
1751
|
children: u
|
|
1752
|
-
}) : null, /* @__PURE__ */
|
|
1752
|
+
}) : null, /* @__PURE__ */ F(hn, {
|
|
1753
1753
|
tokenizationKey: e.config.tokenization_key,
|
|
1754
1754
|
tokenizationURL: e.config.tokenization_url,
|
|
1755
1755
|
onTokenized: async (n) => {
|
|
@@ -1776,14 +1776,14 @@ function vn({ psp: e, onSaved: t, submitLabel: n, appearance: r, defaultCountry:
|
|
|
1776
1776
|
}, c)] });
|
|
1777
1777
|
}
|
|
1778
1778
|
function yn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
1779
|
-
let i = S(), { client: a, notify: o } = T(), s =
|
|
1779
|
+
let i = S(), { client: a, notify: o } = T(), s = N.useId().replace(/[^a-zA-Z0-9-]/g, ""), c = N.useMemo(() => ({
|
|
1780
1780
|
number: `orck-save-${s}-number`,
|
|
1781
1781
|
expiry: `orck-save-${s}-expiry`,
|
|
1782
1782
|
cvv: `orck-save-${s}-cvv`
|
|
1783
|
-
}), [s]), l = mn(), [u, d] =
|
|
1783
|
+
}), [s]), l = mn(), [u, d] = N.useState(() => ({
|
|
1784
1784
|
...Et,
|
|
1785
1785
|
country: Ot(r)
|
|
1786
|
-
})), [f, p] =
|
|
1786
|
+
})), [f, p] = N.useState(!1), [m, h] = N.useState(), g = async (n) => {
|
|
1787
1787
|
if (n.preventDefault(), f) return;
|
|
1788
1788
|
let r = wt.safeParse(u);
|
|
1789
1789
|
if (!r.success) {
|
|
@@ -1810,40 +1810,40 @@ function yn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
1810
1810
|
}
|
|
1811
1811
|
}
|
|
1812
1812
|
};
|
|
1813
|
-
return /* @__PURE__ */
|
|
1813
|
+
return /* @__PURE__ */ I("form", {
|
|
1814
1814
|
"aria-label": "Secure card setup",
|
|
1815
1815
|
autoComplete: "on",
|
|
1816
1816
|
className: "grid gap-4",
|
|
1817
1817
|
noValidate: !0,
|
|
1818
1818
|
onSubmit: (e) => void g(e),
|
|
1819
1819
|
children: [
|
|
1820
|
-
/* @__PURE__ */
|
|
1820
|
+
/* @__PURE__ */ F(Ft, {
|
|
1821
1821
|
idPrefix: `orck-save-${s}`,
|
|
1822
1822
|
value: u,
|
|
1823
1823
|
onChange: d,
|
|
1824
1824
|
disabled: f
|
|
1825
1825
|
}),
|
|
1826
|
-
/* @__PURE__ */
|
|
1826
|
+
/* @__PURE__ */ F(Vt, {
|
|
1827
1827
|
ids: c,
|
|
1828
1828
|
card: l,
|
|
1829
1829
|
disabled: f
|
|
1830
1830
|
}),
|
|
1831
|
-
m ? /* @__PURE__ */
|
|
1831
|
+
m ? /* @__PURE__ */ F("p", {
|
|
1832
1832
|
role: "alert",
|
|
1833
1833
|
className: "text-sm text-destructive",
|
|
1834
1834
|
children: m
|
|
1835
1835
|
}) : null,
|
|
1836
|
-
/* @__PURE__ */
|
|
1836
|
+
/* @__PURE__ */ F(Q, {
|
|
1837
1837
|
label: n ?? i.t("paymentMethods.save"),
|
|
1838
1838
|
processing: f,
|
|
1839
1839
|
disabled: !l.valid
|
|
1840
1840
|
}),
|
|
1841
|
-
/* @__PURE__ */
|
|
1841
|
+
/* @__PURE__ */ F(Ht, {})
|
|
1842
1842
|
]
|
|
1843
1843
|
});
|
|
1844
1844
|
}
|
|
1845
1845
|
function bn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
1846
|
-
let i = S(), { t: a } = i, { client: o, notify: s } = T(), c =
|
|
1846
|
+
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(() => Ot(r), [r]), g = async (e) => {
|
|
1847
1847
|
if (e.preventDefault(), !(!c.current || d)) {
|
|
1848
1848
|
f(!0), m(void 0);
|
|
1849
1849
|
try {
|
|
@@ -1859,11 +1859,11 @@ function bn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
1859
1859
|
}
|
|
1860
1860
|
}
|
|
1861
1861
|
};
|
|
1862
|
-
return /* @__PURE__ */
|
|
1862
|
+
return /* @__PURE__ */ I("form", {
|
|
1863
1863
|
className: "grid gap-4",
|
|
1864
1864
|
onSubmit: (e) => void g(e),
|
|
1865
1865
|
children: [
|
|
1866
|
-
/* @__PURE__ */
|
|
1866
|
+
/* @__PURE__ */ F(rn, {
|
|
1867
1867
|
ref: c,
|
|
1868
1868
|
psp: e,
|
|
1869
1869
|
client: o,
|
|
@@ -1872,46 +1872,46 @@ function bn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
1872
1872
|
unavailableMessage: a("paymentMethods.unavailable"),
|
|
1873
1873
|
verificationPendingMessage: a("paymentMethods.verificationPending")
|
|
1874
1874
|
}),
|
|
1875
|
-
p ? /* @__PURE__ */
|
|
1875
|
+
p ? /* @__PURE__ */ F("p", {
|
|
1876
1876
|
role: "alert",
|
|
1877
1877
|
className: "text-sm text-destructive",
|
|
1878
1878
|
children: p
|
|
1879
1879
|
}) : null,
|
|
1880
|
-
/* @__PURE__ */
|
|
1880
|
+
/* @__PURE__ */ F(Q, {
|
|
1881
1881
|
label: n ?? a("paymentMethods.save"),
|
|
1882
1882
|
processing: d,
|
|
1883
1883
|
disabled: !l
|
|
1884
1884
|
}),
|
|
1885
|
-
/* @__PURE__ */
|
|
1885
|
+
/* @__PURE__ */ F(Ht, {})
|
|
1886
1886
|
]
|
|
1887
1887
|
});
|
|
1888
1888
|
}
|
|
1889
1889
|
//#endregion
|
|
1890
1890
|
//#region src/account/notice.tsx
|
|
1891
1891
|
function xn() {
|
|
1892
|
-
let [e, t] =
|
|
1893
|
-
return
|
|
1892
|
+
let [e, t] = N.useState(null);
|
|
1893
|
+
return N.useEffect(() => {
|
|
1894
1894
|
if (!e) return;
|
|
1895
1895
|
let n = setTimeout(() => t(null), 6e3);
|
|
1896
1896
|
return () => clearTimeout(n);
|
|
1897
|
-
}, [e]), [/* @__PURE__ */
|
|
1897
|
+
}, [e]), [/* @__PURE__ */ F("p", {
|
|
1898
1898
|
role: "status",
|
|
1899
1899
|
"aria-live": "polite",
|
|
1900
|
-
className:
|
|
1900
|
+
className: L("text-sm text-muted-foreground", e ? "pt-3" : "sr-only"),
|
|
1901
1901
|
children: e
|
|
1902
1902
|
}), t];
|
|
1903
1903
|
}
|
|
1904
1904
|
//#endregion
|
|
1905
1905
|
//#region src/account/payment-methods-panel.tsx
|
|
1906
1906
|
function Sn(e, t) {
|
|
1907
|
-
return
|
|
1907
|
+
return Ce(e.card, t);
|
|
1908
1908
|
}
|
|
1909
1909
|
function Cn(e, t) {
|
|
1910
1910
|
return e.status === 409 && e.code === "resource_conflict" ? t.t("paymentMethods.inUse") : t.error(e);
|
|
1911
1911
|
}
|
|
1912
|
-
function wn({ defaultCurrency: e, defaultCountry: t, appearance: n, className:
|
|
1913
|
-
let
|
|
1914
|
-
|
|
1912
|
+
function wn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r }) {
|
|
1913
|
+
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;
|
|
1914
|
+
N.useEffect(() => {
|
|
1915
1915
|
if (w === null) return;
|
|
1916
1916
|
let e = setTimeout(T, w * 1e3);
|
|
1917
1917
|
return () => clearTimeout(e);
|
|
@@ -1920,92 +1920,92 @@ function wn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: i
|
|
|
1920
1920
|
T,
|
|
1921
1921
|
y.config
|
|
1922
1922
|
]);
|
|
1923
|
-
let [E,
|
|
1924
|
-
if (!
|
|
1925
|
-
|
|
1926
|
-
let e = await
|
|
1923
|
+
let [E, ee] = N.useState(), D = C.find((e) => e.psp_id === E) ?? C[0], [O, k] = xn(), re = e?.toUpperCase(), A = async () => {
|
|
1924
|
+
if (!l) return;
|
|
1925
|
+
f(null);
|
|
1926
|
+
let e = await c.remove(l.id);
|
|
1927
1927
|
if (e) {
|
|
1928
|
-
|
|
1928
|
+
f(Cn(e, a));
|
|
1929
1929
|
return;
|
|
1930
1930
|
}
|
|
1931
|
-
|
|
1932
|
-
},
|
|
1933
|
-
if (!
|
|
1934
|
-
|
|
1935
|
-
let t = await
|
|
1936
|
-
t ?
|
|
1931
|
+
u(null), k(o("paymentMethods.removed"));
|
|
1932
|
+
}, j = async (e) => {
|
|
1933
|
+
if (!re) return;
|
|
1934
|
+
h(null);
|
|
1935
|
+
let t = await c.setDefault(e.id, re);
|
|
1936
|
+
t ? h({
|
|
1937
1937
|
id: e.id,
|
|
1938
|
-
message:
|
|
1939
|
-
}) :
|
|
1940
|
-
},
|
|
1941
|
-
|
|
1942
|
-
error:
|
|
1943
|
-
onRetry:
|
|
1944
|
-
}) :
|
|
1945
|
-
title:
|
|
1946
|
-
description:
|
|
1947
|
-
}) : /* @__PURE__ */
|
|
1938
|
+
message: a.error(t)
|
|
1939
|
+
}) : k(o("paymentMethods.defaultUpdated"));
|
|
1940
|
+
}, M, P = c.methods;
|
|
1941
|
+
M = P === null && c.error ? /* @__PURE__ */ F(Y, {
|
|
1942
|
+
error: c.error,
|
|
1943
|
+
onRetry: c.refetch
|
|
1944
|
+
}) : P === null ? /* @__PURE__ */ F(Le, {}) : P.length === 0 ? /* @__PURE__ */ F(Re, {
|
|
1945
|
+
title: o("paymentMethods.empty"),
|
|
1946
|
+
description: o("paymentMethods.emptyDescription")
|
|
1947
|
+
}) : /* @__PURE__ */ F("ul", {
|
|
1948
1948
|
className: "-my-1 divide-y divide-border",
|
|
1949
|
-
children:
|
|
1950
|
-
let t = Sn(e,
|
|
1951
|
-
return /* @__PURE__ */
|
|
1949
|
+
children: P.map((e) => {
|
|
1950
|
+
let t = Sn(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);
|
|
1951
|
+
return /* @__PURE__ */ I("li", {
|
|
1952
1952
|
"data-testid": "payment-method-row",
|
|
1953
1953
|
"data-payment-method-id": e.id,
|
|
1954
1954
|
className: "flex flex-wrap items-center gap-x-3 gap-y-2 py-3.5",
|
|
1955
1955
|
children: [
|
|
1956
|
-
/* @__PURE__ */
|
|
1956
|
+
/* @__PURE__ */ F(Xe, {
|
|
1957
1957
|
brand: e.card?.brand ?? void 0,
|
|
1958
1958
|
fallback: (e.card?.brand ?? "card").slice(0, 4)
|
|
1959
1959
|
}),
|
|
1960
|
-
/* @__PURE__ */
|
|
1960
|
+
/* @__PURE__ */ I("div", {
|
|
1961
1961
|
className: "grid min-w-40 flex-1 gap-0.5",
|
|
1962
1962
|
children: [
|
|
1963
|
-
/* @__PURE__ */
|
|
1963
|
+
/* @__PURE__ */ I("div", {
|
|
1964
1964
|
className: "flex flex-wrap items-center gap-x-2 gap-y-1",
|
|
1965
1965
|
children: [
|
|
1966
|
-
/* @__PURE__ */
|
|
1966
|
+
/* @__PURE__ */ F("span", {
|
|
1967
1967
|
className: "text-sm font-medium tabular-nums",
|
|
1968
1968
|
children: t
|
|
1969
1969
|
}),
|
|
1970
|
-
r === "expired" || r === "expiring_soon" ? /* @__PURE__ */
|
|
1971
|
-
i.length > 0 ? /* @__PURE__ */
|
|
1970
|
+
r === "expired" || r === "expiring_soon" ? /* @__PURE__ */ F(He, { status: r }) : e.health?.active === !1 ? /* @__PURE__ */ F(He, { status: "needs_attention" }) : null,
|
|
1971
|
+
i.length > 0 ? /* @__PURE__ */ F(He, {
|
|
1972
1972
|
status: "default",
|
|
1973
|
-
label:
|
|
1973
|
+
label: o("paymentMethods.defaultFor", { currencies: i.join(", ") })
|
|
1974
1974
|
}) : null
|
|
1975
1975
|
]
|
|
1976
1976
|
}),
|
|
1977
|
-
|
|
1977
|
+
l.length > 0 ? /* @__PURE__ */ F("p", {
|
|
1978
1978
|
className: "text-sm text-muted-foreground tabular-nums",
|
|
1979
|
-
children:
|
|
1979
|
+
children: l.join(" · ")
|
|
1980
1980
|
}) : null,
|
|
1981
|
-
|
|
1981
|
+
p?.id === e.id ? /* @__PURE__ */ F("p", {
|
|
1982
1982
|
role: "alert",
|
|
1983
1983
|
className: "text-sm text-destructive",
|
|
1984
|
-
children:
|
|
1984
|
+
children: p.message
|
|
1985
1985
|
}) : null
|
|
1986
1986
|
]
|
|
1987
1987
|
}),
|
|
1988
|
-
/* @__PURE__ */
|
|
1988
|
+
/* @__PURE__ */ I("div", {
|
|
1989
1989
|
className: "ml-auto flex items-center gap-1",
|
|
1990
|
-
children: [
|
|
1990
|
+
children: [re && !i.includes(re) ? /* @__PURE__ */ I(U, {
|
|
1991
1991
|
variant: "ghost",
|
|
1992
1992
|
size: "sm",
|
|
1993
1993
|
className: "text-muted-foreground",
|
|
1994
|
-
disabled: !!
|
|
1995
|
-
onClick: () => void
|
|
1996
|
-
children: [
|
|
1997
|
-
}) : null, /* @__PURE__ */
|
|
1994
|
+
disabled: !!s,
|
|
1995
|
+
onClick: () => void j(e),
|
|
1996
|
+
children: [s === "default" ? /* @__PURE__ */ F(X, {}) : null, o("paymentMethods.makeDefault")]
|
|
1997
|
+
}) : null, /* @__PURE__ */ F(U, {
|
|
1998
1998
|
variant: "ghost",
|
|
1999
1999
|
size: "icon-sm",
|
|
2000
2000
|
className: "text-muted-foreground hover:text-destructive",
|
|
2001
|
-
"aria-label":
|
|
2002
|
-
title:
|
|
2003
|
-
disabled: !!
|
|
2001
|
+
"aria-label": o("paymentMethods.removeLabel", { label: t }),
|
|
2002
|
+
title: o("paymentMethods.remove"),
|
|
2003
|
+
disabled: !!s,
|
|
2004
2004
|
onClick: () => {
|
|
2005
|
-
|
|
2005
|
+
f(null), u(e);
|
|
2006
2006
|
},
|
|
2007
|
-
children:
|
|
2008
|
-
icon:
|
|
2007
|
+
children: s === "remove" ? /* @__PURE__ */ F(X, {}) : /* @__PURE__ */ F(R, {
|
|
2008
|
+
icon: z,
|
|
2009
2009
|
"aria-hidden": !0
|
|
2010
2010
|
})
|
|
2011
2011
|
})]
|
|
@@ -2014,102 +2014,102 @@ function wn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: i
|
|
|
2014
2014
|
}, e.id);
|
|
2015
2015
|
})
|
|
2016
2016
|
});
|
|
2017
|
-
let
|
|
2018
|
-
return /* @__PURE__ */
|
|
2019
|
-
title:
|
|
2020
|
-
description:
|
|
2017
|
+
let L = l ? c.pending[l.id] === "remove" : !1, ie = l ? Sn(l, a) : "";
|
|
2018
|
+
return /* @__PURE__ */ I(Ie, {
|
|
2019
|
+
title: o("paymentMethods.title"),
|
|
2020
|
+
description: o("paymentMethods.description"),
|
|
2021
2021
|
appearance: n,
|
|
2022
|
-
className:
|
|
2022
|
+
className: r,
|
|
2023
2023
|
"data-testid": "payment-methods-panel",
|
|
2024
|
-
action:
|
|
2024
|
+
action: D ? /* @__PURE__ */ I(U, {
|
|
2025
2025
|
variant: "outline",
|
|
2026
2026
|
size: "sm",
|
|
2027
2027
|
onClick: () => v(!0),
|
|
2028
|
-
children: [/* @__PURE__ */
|
|
2029
|
-
icon:
|
|
2028
|
+
children: [/* @__PURE__ */ F(R, {
|
|
2029
|
+
icon: ce,
|
|
2030
2030
|
"aria-hidden": !0,
|
|
2031
2031
|
"data-icon": "inline-start"
|
|
2032
|
-
}),
|
|
2032
|
+
}), o("paymentMethods.add")]
|
|
2033
2033
|
}) : null,
|
|
2034
2034
|
children: [
|
|
2035
|
-
|
|
2036
|
-
|
|
2035
|
+
M,
|
|
2036
|
+
P !== null && c.error ? /* @__PURE__ */ F("div", {
|
|
2037
2037
|
className: "pt-3",
|
|
2038
|
-
children: /* @__PURE__ */
|
|
2039
|
-
error:
|
|
2040
|
-
onRetry:
|
|
2038
|
+
children: /* @__PURE__ */ F(Y, {
|
|
2039
|
+
error: c.error,
|
|
2040
|
+
onRetry: c.refetch
|
|
2041
2041
|
})
|
|
2042
2042
|
}) : null,
|
|
2043
|
-
y.error ? /* @__PURE__ */
|
|
2043
|
+
y.error ? /* @__PURE__ */ F("div", {
|
|
2044
2044
|
className: "pt-3",
|
|
2045
|
-
children: /* @__PURE__ */
|
|
2045
|
+
children: /* @__PURE__ */ F(Y, {
|
|
2046
2046
|
error: y.error,
|
|
2047
|
-
message:
|
|
2047
|
+
message: o("paymentMethods.addUnavailable"),
|
|
2048
2048
|
onRetry: y.refetch
|
|
2049
2049
|
})
|
|
2050
|
-
}) : w === null ? null : /* @__PURE__ */
|
|
2050
|
+
}) : w === null ? null : /* @__PURE__ */ F("p", {
|
|
2051
2051
|
role: "status",
|
|
2052
2052
|
className: "pt-3 text-sm text-muted-foreground",
|
|
2053
|
-
children:
|
|
2053
|
+
children: o("paymentMethods.addUnavailable")
|
|
2054
2054
|
}),
|
|
2055
|
-
|
|
2056
|
-
/* @__PURE__ */
|
|
2057
|
-
open:
|
|
2055
|
+
O,
|
|
2056
|
+
/* @__PURE__ */ F(Ze, {
|
|
2057
|
+
open: l !== null,
|
|
2058
2058
|
onOpenChange: (e) => {
|
|
2059
|
-
!e && !
|
|
2059
|
+
!e && !L && u(null);
|
|
2060
2060
|
},
|
|
2061
|
-
children: /* @__PURE__ */
|
|
2062
|
-
className: `${
|
|
2063
|
-
"data-orck-theme":
|
|
2064
|
-
style:
|
|
2061
|
+
children: /* @__PURE__ */ I(et, {
|
|
2062
|
+
className: `${s.className} ${ke} bg-popover text-popover-foreground`,
|
|
2063
|
+
"data-orck-theme": s["data-orck-theme"],
|
|
2064
|
+
style: s.style,
|
|
2065
2065
|
children: [
|
|
2066
|
-
/* @__PURE__ */
|
|
2067
|
-
|
|
2066
|
+
/* @__PURE__ */ I(tt, { children: [/* @__PURE__ */ F(rt, { children: o("paymentMethods.removeTitle", { label: ie }) }), /* @__PURE__ */ F(it, { children: o("paymentMethods.removeDescription") })] }),
|
|
2067
|
+
d ? /* @__PURE__ */ F("p", {
|
|
2068
2068
|
role: "alert",
|
|
2069
2069
|
className: "text-sm text-destructive",
|
|
2070
|
-
children:
|
|
2070
|
+
children: d
|
|
2071
2071
|
}) : null,
|
|
2072
|
-
/* @__PURE__ */
|
|
2073
|
-
disabled:
|
|
2074
|
-
children:
|
|
2075
|
-
}), /* @__PURE__ */
|
|
2072
|
+
/* @__PURE__ */ I(nt, { children: [/* @__PURE__ */ F(at, {
|
|
2073
|
+
disabled: L,
|
|
2074
|
+
children: o("common.cancel")
|
|
2075
|
+
}), /* @__PURE__ */ I(U, {
|
|
2076
2076
|
variant: "destructive",
|
|
2077
|
-
disabled:
|
|
2078
|
-
onClick: () => void
|
|
2079
|
-
children: [
|
|
2077
|
+
disabled: L,
|
|
2078
|
+
onClick: () => void A(),
|
|
2079
|
+
children: [L ? /* @__PURE__ */ F(X, {}) : null, o("paymentMethods.removeConfirm")]
|
|
2080
2080
|
})] })
|
|
2081
2081
|
]
|
|
2082
2082
|
})
|
|
2083
2083
|
}),
|
|
2084
|
-
|
|
2085
|
-
open:
|
|
2084
|
+
D ? /* @__PURE__ */ F(ot, {
|
|
2085
|
+
open: g,
|
|
2086
2086
|
onOpenChange: v,
|
|
2087
|
-
children: /* @__PURE__ */
|
|
2088
|
-
className: `${
|
|
2089
|
-
"data-orck-theme":
|
|
2090
|
-
style:
|
|
2087
|
+
children: /* @__PURE__ */ I(lt, {
|
|
2088
|
+
className: `${s.className} ${ke} max-h-[calc(100dvh-2rem)] overflow-y-auto bg-popover text-popover-foreground`,
|
|
2089
|
+
"data-orck-theme": s["data-orck-theme"],
|
|
2090
|
+
style: s.style,
|
|
2091
2091
|
children: [
|
|
2092
|
-
/* @__PURE__ */
|
|
2093
|
-
C.length > 1 ? /* @__PURE__ */
|
|
2092
|
+
/* @__PURE__ */ I(ut, { children: [/* @__PURE__ */ F(ft, { children: o("paymentMethods.addTitle") }), /* @__PURE__ */ F(pt, { children: o("paymentMethods.addDescription") })] }),
|
|
2093
|
+
C.length > 1 ? /* @__PURE__ */ I("label", {
|
|
2094
2094
|
className: "grid gap-1.5 text-sm",
|
|
2095
|
-
children: [
|
|
2095
|
+
children: [o("paymentMethods.provider"), /* @__PURE__ */ F("select", {
|
|
2096
2096
|
className: "h-9 rounded-md border border-input bg-transparent px-2",
|
|
2097
|
-
value:
|
|
2098
|
-
onChange: (e) =>
|
|
2099
|
-
children: C.map((e) => /* @__PURE__ */
|
|
2097
|
+
value: D.psp_id,
|
|
2098
|
+
onChange: (e) => ee(e.target.value),
|
|
2099
|
+
children: C.map((e) => /* @__PURE__ */ F("option", {
|
|
2100
2100
|
value: e.psp_id,
|
|
2101
2101
|
children: e.display_name
|
|
2102
2102
|
}, e.psp_id))
|
|
2103
2103
|
})]
|
|
2104
2104
|
}) : null,
|
|
2105
|
-
/* @__PURE__ */
|
|
2106
|
-
psp:
|
|
2105
|
+
/* @__PURE__ */ F(gn, {
|
|
2106
|
+
psp: D,
|
|
2107
2107
|
defaultCountry: t,
|
|
2108
2108
|
appearance: n,
|
|
2109
2109
|
onSaved: () => {
|
|
2110
|
-
v(!1),
|
|
2110
|
+
v(!1), k(o("paymentMethods.added"));
|
|
2111
2111
|
}
|
|
2112
|
-
},
|
|
2112
|
+
}, D.psp_id)
|
|
2113
2113
|
]
|
|
2114
2114
|
})
|
|
2115
2115
|
}) : null
|
|
@@ -2119,48 +2119,48 @@ function wn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: i
|
|
|
2119
2119
|
//#endregion
|
|
2120
2120
|
//#region src/components/ui/textarea.tsx
|
|
2121
2121
|
function Tn({ className: e, ...t }) {
|
|
2122
|
-
return /* @__PURE__ */
|
|
2122
|
+
return /* @__PURE__ */ F("textarea", {
|
|
2123
2123
|
"data-slot": "textarea",
|
|
2124
|
-
className:
|
|
2124
|
+
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),
|
|
2125
2125
|
...t
|
|
2126
2126
|
});
|
|
2127
2127
|
}
|
|
2128
2128
|
//#endregion
|
|
2129
2129
|
//#region src/account/cancel-dialog.tsx
|
|
2130
2130
|
function En({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, onConfirm: a, appearance: o }) {
|
|
2131
|
-
let s = S(), { t: c } = s, l = x(o), u =
|
|
2131
|
+
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(null), y = i !== void 0, b = f.trim().length, C = b < 4, w = async () => {
|
|
2132
2132
|
if (g(!0), C || y) return;
|
|
2133
2133
|
v(null);
|
|
2134
|
-
let e = await a(
|
|
2135
|
-
e ?
|
|
2134
|
+
let e = await a(f);
|
|
2135
|
+
e ? p(e) || v(e) : t(!1);
|
|
2136
2136
|
}, T = c(i === "cancel" && r ? "cancel.preparing" : i === "signing" ? "cancel.signing" : i === "confirming" ? "cancel.confirming" : y ? "cancel.working" : r ? "cancel.confirmWallet" : "cancel.confirm");
|
|
2137
|
-
return /* @__PURE__ */
|
|
2137
|
+
return /* @__PURE__ */ F(Ze, {
|
|
2138
2138
|
open: e,
|
|
2139
2139
|
onOpenChange: (e) => {
|
|
2140
2140
|
!e && y || t(e);
|
|
2141
2141
|
},
|
|
2142
|
-
children: /* @__PURE__ */
|
|
2142
|
+
children: /* @__PURE__ */ F(et, {
|
|
2143
2143
|
className: `${l.className} ${ke} bg-popover text-popover-foreground`,
|
|
2144
2144
|
"data-orck-theme": l["data-orck-theme"],
|
|
2145
2145
|
style: l.style,
|
|
2146
|
-
children: /* @__PURE__ */
|
|
2146
|
+
children: /* @__PURE__ */ I("form", {
|
|
2147
2147
|
className: "grid gap-5",
|
|
2148
2148
|
noValidate: !0,
|
|
2149
2149
|
onSubmit: (e) => {
|
|
2150
2150
|
e.preventDefault(), w();
|
|
2151
2151
|
},
|
|
2152
2152
|
children: [
|
|
2153
|
-
/* @__PURE__ */
|
|
2154
|
-
/* @__PURE__ */
|
|
2153
|
+
/* @__PURE__ */ I(tt, { children: [/* @__PURE__ */ F(rt, { children: c("cancel.title", { name: n }) }), /* @__PURE__ */ F(it, { children: c(r ? "cancel.solanaDescription" : "cancel.description") })] }),
|
|
2154
|
+
/* @__PURE__ */ I("div", {
|
|
2155
2155
|
className: "grid gap-2",
|
|
2156
2156
|
children: [
|
|
2157
|
-
/* @__PURE__ */
|
|
2157
|
+
/* @__PURE__ */ F(Z, {
|
|
2158
2158
|
htmlFor: u,
|
|
2159
2159
|
children: c("cancel.reasonLabel")
|
|
2160
2160
|
}),
|
|
2161
|
-
/* @__PURE__ */
|
|
2161
|
+
/* @__PURE__ */ F(Tn, {
|
|
2162
2162
|
id: u,
|
|
2163
|
-
value:
|
|
2163
|
+
value: f,
|
|
2164
2164
|
maxLength: 500,
|
|
2165
2165
|
placeholder: c("cancel.reasonPlaceholder"),
|
|
2166
2166
|
"aria-describedby": d,
|
|
@@ -2172,35 +2172,35 @@ function En({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, on
|
|
|
2172
2172
|
onChange: (e) => m(e.target.value),
|
|
2173
2173
|
onBlur: () => b > 0 && g(!0)
|
|
2174
2174
|
}),
|
|
2175
|
-
/* @__PURE__ */
|
|
2175
|
+
/* @__PURE__ */ I("div", {
|
|
2176
2176
|
id: d,
|
|
2177
2177
|
className: "flex justify-between gap-3 text-xs text-muted-foreground",
|
|
2178
|
-
children: [/* @__PURE__ */
|
|
2178
|
+
children: [/* @__PURE__ */ F("span", {
|
|
2179
2179
|
className: h && C ? "text-destructive" : "",
|
|
2180
2180
|
children: h && C ? c("cancel.reasonTooShort", { min: 4 }) : ""
|
|
2181
|
-
}), /* @__PURE__ */
|
|
2181
|
+
}), /* @__PURE__ */ F("span", {
|
|
2182
2182
|
className: "tabular-nums",
|
|
2183
2183
|
children: c("cancel.reasonHint", {
|
|
2184
|
-
count:
|
|
2184
|
+
count: f.length,
|
|
2185
2185
|
max: 500
|
|
2186
2186
|
})
|
|
2187
2187
|
})]
|
|
2188
2188
|
})
|
|
2189
2189
|
]
|
|
2190
2190
|
}),
|
|
2191
|
-
_ ? /* @__PURE__ */
|
|
2191
|
+
_ ? /* @__PURE__ */ F("p", {
|
|
2192
2192
|
role: "alert",
|
|
2193
2193
|
className: "text-sm text-destructive",
|
|
2194
2194
|
children: s.error(_)
|
|
2195
2195
|
}) : null,
|
|
2196
|
-
/* @__PURE__ */
|
|
2196
|
+
/* @__PURE__ */ I(nt, { children: [/* @__PURE__ */ F(at, {
|
|
2197
2197
|
disabled: y,
|
|
2198
2198
|
children: c("cancel.keep")
|
|
2199
|
-
}), /* @__PURE__ */
|
|
2199
|
+
}), /* @__PURE__ */ I(U, {
|
|
2200
2200
|
type: "submit",
|
|
2201
2201
|
variant: "destructive",
|
|
2202
2202
|
disabled: y,
|
|
2203
|
-
children: [y ? /* @__PURE__ */
|
|
2203
|
+
children: [y ? /* @__PURE__ */ F(X, {}) : null, T]
|
|
2204
2204
|
})] })
|
|
2205
2205
|
]
|
|
2206
2206
|
})
|
|
@@ -2210,21 +2210,21 @@ function En({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, on
|
|
|
2210
2210
|
//#endregion
|
|
2211
2211
|
//#region src/components/ui/radio-group.tsx
|
|
2212
2212
|
function Dn({ className: e, ...t }) {
|
|
2213
|
-
return /* @__PURE__ */
|
|
2213
|
+
return /* @__PURE__ */ F(pe, {
|
|
2214
2214
|
"data-slot": "radio-group",
|
|
2215
|
-
className:
|
|
2215
|
+
className: L("grid w-full gap-3", e),
|
|
2216
2216
|
...t
|
|
2217
2217
|
});
|
|
2218
2218
|
}
|
|
2219
2219
|
function On({ className: e, ...t }) {
|
|
2220
|
-
return /* @__PURE__ */
|
|
2220
|
+
return /* @__PURE__ */ F(H.Root, {
|
|
2221
2221
|
"data-slot": "radio-group-item",
|
|
2222
|
-
className:
|
|
2222
|
+
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),
|
|
2223
2223
|
...t,
|
|
2224
|
-
children: /* @__PURE__ */
|
|
2224
|
+
children: /* @__PURE__ */ F(H.Indicator, {
|
|
2225
2225
|
"data-slot": "radio-group-indicator",
|
|
2226
2226
|
className: "flex size-4 items-center justify-center",
|
|
2227
|
-
children: /* @__PURE__ */
|
|
2227
|
+
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" })
|
|
2228
2228
|
})
|
|
2229
2229
|
});
|
|
2230
2230
|
}
|
|
@@ -2236,17 +2236,17 @@ function An(e, t) {
|
|
|
2236
2236
|
}
|
|
2237
2237
|
function jn({ subscription: e, name: t, onOpenChange: n, pending: r, onConfirm: i, appearance: a }) {
|
|
2238
2238
|
let o = x(a);
|
|
2239
|
-
return /* @__PURE__ */
|
|
2239
|
+
return /* @__PURE__ */ F(ot, {
|
|
2240
2240
|
open: e !== null,
|
|
2241
2241
|
onOpenChange: (e) => {
|
|
2242
2242
|
!e && r || n(e);
|
|
2243
2243
|
},
|
|
2244
|
-
children: /* @__PURE__ */
|
|
2244
|
+
children: /* @__PURE__ */ F(lt, {
|
|
2245
2245
|
showCloseButton: !1,
|
|
2246
2246
|
className: `${o.className} ${ke} bg-popover text-popover-foreground`,
|
|
2247
2247
|
"data-orck-theme": o["data-orck-theme"],
|
|
2248
2248
|
style: o.style,
|
|
2249
|
-
children: e ? /* @__PURE__ */
|
|
2249
|
+
children: e ? /* @__PURE__ */ F(Mn, {
|
|
2250
2250
|
subscription: e,
|
|
2251
2251
|
name: t,
|
|
2252
2252
|
pending: r,
|
|
@@ -2257,7 +2257,7 @@ function jn({ subscription: e, name: t, onOpenChange: n, pending: r, onConfirm:
|
|
|
2257
2257
|
});
|
|
2258
2258
|
}
|
|
2259
2259
|
function Mn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i }) {
|
|
2260
|
-
let a = S(), { t: o } = a, s =
|
|
2260
|
+
let a = S(), { t: o } = a, s = N.useId(), c = ne(), l = e.payment_method_id ?? kn, [u, d] = N.useState(l), [f, p] = N.useState(null), m = c.methods ? An(e, c.methods) : null, h = e.price?.currency?.toUpperCase(), g = h ? m?.find((e) => (e.default_currencies ?? []).includes(h)) : void 0, _ = [...g ? [{
|
|
2261
2261
|
id: kn,
|
|
2262
2262
|
card: g
|
|
2263
2263
|
}] : [], ...(m ?? []).map((e) => ({
|
|
@@ -2269,10 +2269,10 @@ function Mn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i })
|
|
|
2269
2269
|
let e = await i(u === kn ? null : u);
|
|
2270
2270
|
e && p(e);
|
|
2271
2271
|
}, b;
|
|
2272
|
-
return b = m === null && c.error ? /* @__PURE__ */
|
|
2272
|
+
return b = m === null && c.error ? /* @__PURE__ */ F(Y, {
|
|
2273
2273
|
error: c.error,
|
|
2274
2274
|
onRetry: c.refetch
|
|
2275
|
-
}) : m === null ? /* @__PURE__ */
|
|
2275
|
+
}) : m === null ? /* @__PURE__ */ F(Le, { rows: 2 }) : /* @__PURE__ */ F(Dn, {
|
|
2276
2276
|
value: u,
|
|
2277
2277
|
onValueChange: (e) => {
|
|
2278
2278
|
typeof e == "string" && e && d(e);
|
|
@@ -2281,55 +2281,55 @@ function Mn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i })
|
|
|
2281
2281
|
"aria-label": o("changeCard.title", { name: t }),
|
|
2282
2282
|
className: "grid gap-0",
|
|
2283
2283
|
children: _.map(({ id: e, card: t }) => {
|
|
2284
|
-
let r = `${s}-${e}`, i =
|
|
2285
|
-
return /* @__PURE__ */
|
|
2284
|
+
let r = `${s}-${e}`, i = Ce(t.card, a);
|
|
2285
|
+
return /* @__PURE__ */ I(Z, {
|
|
2286
2286
|
htmlFor: r,
|
|
2287
2287
|
"data-testid": "change-card-option",
|
|
2288
|
-
className:
|
|
2288
|
+
className: L("flex cursor-pointer items-center gap-3 py-1.5 select-none", n && "cursor-default"),
|
|
2289
2289
|
children: [
|
|
2290
|
-
/* @__PURE__ */
|
|
2290
|
+
/* @__PURE__ */ F(On, {
|
|
2291
2291
|
id: r,
|
|
2292
2292
|
value: e
|
|
2293
2293
|
}),
|
|
2294
|
-
/* @__PURE__ */
|
|
2294
|
+
/* @__PURE__ */ F(Xe, {
|
|
2295
2295
|
brand: t.card?.brand ?? void 0,
|
|
2296
2296
|
fallback: (t.card?.brand ?? "card").slice(0, 4)
|
|
2297
2297
|
}),
|
|
2298
|
-
/* @__PURE__ */
|
|
2298
|
+
/* @__PURE__ */ F("span", {
|
|
2299
2299
|
className: "min-w-0 flex-1 truncate text-sm font-medium tabular-nums",
|
|
2300
2300
|
children: e === kn ? o("changeCard.useDefault", { card: i }) : i
|
|
2301
2301
|
}),
|
|
2302
|
-
e === l ? /* @__PURE__ */
|
|
2302
|
+
e === l ? /* @__PURE__ */ F("span", {
|
|
2303
2303
|
className: "shrink-0 text-xs text-muted-foreground",
|
|
2304
2304
|
children: o("changeCard.current")
|
|
2305
2305
|
}) : null
|
|
2306
2306
|
]
|
|
2307
2307
|
}, e);
|
|
2308
2308
|
})
|
|
2309
|
-
}), /* @__PURE__ */
|
|
2309
|
+
}), /* @__PURE__ */ I("form", {
|
|
2310
2310
|
className: "grid gap-5",
|
|
2311
2311
|
noValidate: !0,
|
|
2312
2312
|
onSubmit: (e) => {
|
|
2313
2313
|
e.preventDefault(), y();
|
|
2314
2314
|
},
|
|
2315
2315
|
children: [
|
|
2316
|
-
/* @__PURE__ */
|
|
2316
|
+
/* @__PURE__ */ I(ut, { children: [/* @__PURE__ */ F(ft, { children: o("changeCard.title", { name: t }) }), /* @__PURE__ */ F(pt, { children: o(m !== null && !v ? "changeCard.none" : "changeCard.description") })] }),
|
|
2317
2317
|
b,
|
|
2318
|
-
f ? /* @__PURE__ */
|
|
2318
|
+
f ? /* @__PURE__ */ F("p", {
|
|
2319
2319
|
role: "alert",
|
|
2320
2320
|
className: "text-sm text-destructive",
|
|
2321
2321
|
children: a.error(f)
|
|
2322
2322
|
}) : null,
|
|
2323
|
-
/* @__PURE__ */
|
|
2323
|
+
/* @__PURE__ */ I(dt, { children: [/* @__PURE__ */ F(U, {
|
|
2324
2324
|
type: "button",
|
|
2325
2325
|
variant: "outline",
|
|
2326
2326
|
disabled: n,
|
|
2327
2327
|
onClick: r,
|
|
2328
2328
|
children: o("common.cancel")
|
|
2329
|
-
}), /* @__PURE__ */
|
|
2329
|
+
}), /* @__PURE__ */ I(U, {
|
|
2330
2330
|
type: "submit",
|
|
2331
2331
|
disabled: n || !u || u === l,
|
|
2332
|
-
children: [n ? /* @__PURE__ */
|
|
2332
|
+
children: [n ? /* @__PURE__ */ F(X, {}) : null, o("changeCard.confirm")]
|
|
2333
2333
|
})] })
|
|
2334
2334
|
]
|
|
2335
2335
|
});
|
|
@@ -2337,9 +2337,9 @@ function Mn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i })
|
|
|
2337
2337
|
//#endregion
|
|
2338
2338
|
//#region src/account/subscriptions-panel.tsx
|
|
2339
2339
|
function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter: n, appearance: r, className: i, ...a }) {
|
|
2340
|
-
let o = S(), { t: s } = o, { locale: c, navigate: l } =
|
|
2340
|
+
let o = S(), { t: s } = o, { locale: c, navigate: l } = O(), u = k(a), d = D(), [f, p] = N.useState(null), [m, h] = N.useState(null), [g, _] = N.useState(null), [v, y] = xn(), b = N.useMemo(() => {
|
|
2341
2341
|
let e = u.subscriptions ?? [];
|
|
2342
|
-
return [...e.filter(
|
|
2342
|
+
return [...e.filter(K), ...e.filter((e) => !K(e))];
|
|
2343
2343
|
}, [u.subscriptions]), x = async (e) => {
|
|
2344
2344
|
_(null);
|
|
2345
2345
|
let t = await u.resume(e.id);
|
|
@@ -2348,13 +2348,13 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2348
2348
|
message: o.error(t)
|
|
2349
2349
|
}) : y(s("subscriptions.resumed"));
|
|
2350
2350
|
}, C = f?.rail === "solana", w;
|
|
2351
|
-
return w = u.subscriptions === null && u.error ? /* @__PURE__ */
|
|
2351
|
+
return w = u.subscriptions === null && u.error ? /* @__PURE__ */ F(Y, {
|
|
2352
2352
|
error: u.error,
|
|
2353
2353
|
onRetry: u.refetch
|
|
2354
|
-
}) : u.subscriptions === null ? /* @__PURE__ */
|
|
2354
|
+
}) : u.subscriptions === null ? /* @__PURE__ */ F(Le, {}) : b.length === 0 ? /* @__PURE__ */ F(Re, {
|
|
2355
2355
|
title: s("subscriptions.empty"),
|
|
2356
2356
|
description: s("subscriptions.emptyDescription"),
|
|
2357
|
-
action: t ? /* @__PURE__ */
|
|
2357
|
+
action: t ? /* @__PURE__ */ F("a", {
|
|
2358
2358
|
href: t,
|
|
2359
2359
|
className: he({
|
|
2360
2360
|
variant: "outline",
|
|
@@ -2365,64 +2365,64 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2365
2365
|
},
|
|
2366
2366
|
children: s("subscriptions.browsePlans")
|
|
2367
2367
|
}) : null
|
|
2368
|
-
}) : /* @__PURE__ */
|
|
2368
|
+
}) : /* @__PURE__ */ F("ul", {
|
|
2369
2369
|
className: "-my-1 divide-y divide-border",
|
|
2370
2370
|
children: b.map((t) => {
|
|
2371
|
-
let r =
|
|
2372
|
-
brand:
|
|
2371
|
+
let r = K(t), i = u.pending[t.id], a = xe(t, o), l = t.price ? W(t.price.unit_amount, t.price.currency, d, c) : null, f = be(t.price, o), m = ye(t.current_period_ends_at, c), v = ye(t.access?.ends_at, c), y = ye(t.ended_at ?? t.canceled_at ?? t.current_period_ends_at, c), b = q(t), S = r && !b && !!t.price?.billing_interval_hours, C = r ? S && m ? s("subscriptions.renews", { date: m }) : v ? s("subscriptions.endsOn", { date: v }) : s("subscriptions.noMorePayments") : t.status === "canceled" ? s("subscriptions.noMorePayments") : y && s("subscriptions.endedOn", { date: y }), w = t.rail === "solana" ? s("subscriptions.wallet") : t.card?.last4 ? s("subscriptions.paidWith", {
|
|
2372
|
+
brand: G(t.card.brand, s("paymentMethods.fallbackBrand")),
|
|
2373
2373
|
last4: t.card.last4
|
|
2374
|
-
}) : null, T = r && !b ? t.cancel_portal_url : null, E =
|
|
2375
|
-
return /* @__PURE__ */
|
|
2374
|
+
}) : null, T = r && !b ? t.cancel_portal_url : null, E = Te.has(t.status) && !b && !T && (t.rail !== "solana" || !!e), ee = (t.status === "active" || t.status === "past_due" || t.status === "awaiting_method" || t.status === "unverified") && !b && !T && t.rail !== "solana" && (t.collection_policy === "engine" || t.collection_policy === "nmi_schedule"), D = t.cancel_scheduled ? "cancel_scheduled" : t.status, O = n?.(t);
|
|
2375
|
+
return /* @__PURE__ */ I("li", {
|
|
2376
2376
|
"data-testid": "subscription-row",
|
|
2377
2377
|
"data-subscription-id": t.id,
|
|
2378
2378
|
className: "grid gap-3 py-4 @md:grid-cols-[1fr_auto] @md:items-center",
|
|
2379
2379
|
children: [
|
|
2380
|
-
/* @__PURE__ */
|
|
2380
|
+
/* @__PURE__ */ I("div", {
|
|
2381
2381
|
className: "grid min-w-0 gap-1",
|
|
2382
2382
|
children: [
|
|
2383
|
-
/* @__PURE__ */
|
|
2383
|
+
/* @__PURE__ */ I("div", {
|
|
2384
2384
|
className: "flex flex-wrap items-center gap-x-2 gap-y-1",
|
|
2385
|
-
children: [/* @__PURE__ */
|
|
2386
|
-
className:
|
|
2385
|
+
children: [/* @__PURE__ */ F("span", {
|
|
2386
|
+
className: L("truncate text-sm font-semibold", !r && "text-muted-foreground"),
|
|
2387
2387
|
children: a
|
|
2388
|
-
}), /* @__PURE__ */
|
|
2388
|
+
}), /* @__PURE__ */ F(He, { status: D })]
|
|
2389
2389
|
}),
|
|
2390
|
-
/* @__PURE__ */
|
|
2390
|
+
/* @__PURE__ */ F("p", {
|
|
2391
2391
|
className: "text-sm text-muted-foreground tabular-nums",
|
|
2392
2392
|
children: [C, w].filter(Boolean).join(" · ") || s("common.notAvailable")
|
|
2393
2393
|
}),
|
|
2394
|
-
l ? /* @__PURE__ */
|
|
2395
|
-
className:
|
|
2396
|
-
children: [/* @__PURE__ */
|
|
2394
|
+
l ? /* @__PURE__ */ I("p", {
|
|
2395
|
+
className: L("text-sm tabular-nums", !r && "text-muted-foreground"),
|
|
2396
|
+
children: [/* @__PURE__ */ F("span", {
|
|
2397
2397
|
className: "font-medium",
|
|
2398
2398
|
children: l
|
|
2399
|
-
}), f ? /* @__PURE__ */
|
|
2399
|
+
}), f ? /* @__PURE__ */ I("span", {
|
|
2400
2400
|
className: "text-muted-foreground",
|
|
2401
2401
|
children: [" ", f]
|
|
2402
2402
|
}) : null]
|
|
2403
2403
|
}) : null,
|
|
2404
|
-
t.status === "past_due" || t.status === "awaiting_method" ? /* @__PURE__ */
|
|
2404
|
+
t.status === "past_due" || t.status === "awaiting_method" ? /* @__PURE__ */ F("p", {
|
|
2405
2405
|
className: "text-sm text-destructive",
|
|
2406
2406
|
children: s("subscriptions.pastDue")
|
|
2407
2407
|
}) : null,
|
|
2408
|
-
g?.id === t.id ? /* @__PURE__ */
|
|
2408
|
+
g?.id === t.id ? /* @__PURE__ */ F("p", {
|
|
2409
2409
|
role: "alert",
|
|
2410
2410
|
className: "text-sm text-destructive",
|
|
2411
2411
|
children: g.message
|
|
2412
2412
|
}) : null
|
|
2413
2413
|
]
|
|
2414
2414
|
}),
|
|
2415
|
-
/* @__PURE__ */
|
|
2415
|
+
/* @__PURE__ */ I("div", {
|
|
2416
2416
|
className: "flex flex-wrap gap-2 @md:justify-end",
|
|
2417
2417
|
children: [
|
|
2418
|
-
t.resumable ? /* @__PURE__ */
|
|
2418
|
+
t.resumable ? /* @__PURE__ */ I(U, {
|
|
2419
2419
|
variant: "outline",
|
|
2420
2420
|
size: "sm",
|
|
2421
2421
|
disabled: !!i,
|
|
2422
2422
|
onClick: () => void x(t),
|
|
2423
|
-
children: [i === "resume" ? /* @__PURE__ */
|
|
2423
|
+
children: [i === "resume" ? /* @__PURE__ */ F(X, {}) : null, s(i === "resume" ? "subscriptions.updating" : "subscriptions.resume")]
|
|
2424
2424
|
}) : null,
|
|
2425
|
-
T ? /* @__PURE__ */
|
|
2425
|
+
T ? /* @__PURE__ */ I("a", {
|
|
2426
2426
|
href: T,
|
|
2427
2427
|
target: "_blank",
|
|
2428
2428
|
rel: "noopener noreferrer",
|
|
@@ -2430,12 +2430,12 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2430
2430
|
variant: "outline",
|
|
2431
2431
|
size: "sm"
|
|
2432
2432
|
}),
|
|
2433
|
-
children: [s("subscriptions.manageAtProvider"), /* @__PURE__ */
|
|
2434
|
-
icon:
|
|
2433
|
+
children: [s("subscriptions.manageAtProvider"), /* @__PURE__ */ F(R, {
|
|
2434
|
+
icon: le,
|
|
2435
2435
|
"aria-hidden": !0
|
|
2436
2436
|
})]
|
|
2437
2437
|
}) : null,
|
|
2438
|
-
|
|
2438
|
+
ee ? /* @__PURE__ */ I(U, {
|
|
2439
2439
|
variant: "outline",
|
|
2440
2440
|
size: "sm",
|
|
2441
2441
|
disabled: !!i,
|
|
@@ -2443,9 +2443,9 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2443
2443
|
onClick: () => {
|
|
2444
2444
|
_(null), h(t);
|
|
2445
2445
|
},
|
|
2446
|
-
children: [i === "payment_method" ? /* @__PURE__ */
|
|
2446
|
+
children: [i === "payment_method" ? /* @__PURE__ */ F(X, {}) : null, s("subscriptions.changeCard")]
|
|
2447
2447
|
}) : null,
|
|
2448
|
-
E ? /* @__PURE__ */
|
|
2448
|
+
E ? /* @__PURE__ */ I(U, {
|
|
2449
2449
|
variant: "ghost",
|
|
2450
2450
|
size: "sm",
|
|
2451
2451
|
className: "text-muted-foreground hover:text-destructive",
|
|
@@ -2454,19 +2454,19 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2454
2454
|
onClick: () => {
|
|
2455
2455
|
_(null), p(t);
|
|
2456
2456
|
},
|
|
2457
|
-
children: [i && i !== "resume" && i !== "payment_method" && i !== "change" ? /* @__PURE__ */
|
|
2457
|
+
children: [i && i !== "resume" && i !== "payment_method" && i !== "change" ? /* @__PURE__ */ F(X, {}) : null, s("subscriptions.cancel")]
|
|
2458
2458
|
}) : null
|
|
2459
2459
|
]
|
|
2460
2460
|
}),
|
|
2461
|
-
|
|
2461
|
+
O ? /* @__PURE__ */ F("div", {
|
|
2462
2462
|
"data-testid": "subscription-footer",
|
|
2463
2463
|
className: "border-t border-border/60 pt-3 @md:col-span-2",
|
|
2464
|
-
children:
|
|
2464
|
+
children: O
|
|
2465
2465
|
}) : null
|
|
2466
2466
|
]
|
|
2467
2467
|
}, t.id);
|
|
2468
2468
|
})
|
|
2469
|
-
}), /* @__PURE__ */
|
|
2469
|
+
}), /* @__PURE__ */ I(Ie, {
|
|
2470
2470
|
title: s("subscriptions.title"),
|
|
2471
2471
|
description: s("subscriptions.description"),
|
|
2472
2472
|
appearance: r,
|
|
@@ -2474,17 +2474,17 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2474
2474
|
"data-testid": "subscriptions-panel",
|
|
2475
2475
|
children: [
|
|
2476
2476
|
w,
|
|
2477
|
-
u.subscriptions !== null && u.error ? /* @__PURE__ */
|
|
2477
|
+
u.subscriptions !== null && u.error ? /* @__PURE__ */ F("div", {
|
|
2478
2478
|
className: "pt-3",
|
|
2479
|
-
children: /* @__PURE__ */
|
|
2479
|
+
children: /* @__PURE__ */ F(Y, {
|
|
2480
2480
|
error: u.error,
|
|
2481
2481
|
onRetry: u.refetch
|
|
2482
2482
|
})
|
|
2483
2483
|
}) : null,
|
|
2484
2484
|
v,
|
|
2485
|
-
/* @__PURE__ */
|
|
2485
|
+
/* @__PURE__ */ F(jn, {
|
|
2486
2486
|
subscription: m,
|
|
2487
|
-
name: m ?
|
|
2487
|
+
name: m ? xe(m, o) : "",
|
|
2488
2488
|
onOpenChange: (e) => !e && h(null),
|
|
2489
2489
|
appearance: r,
|
|
2490
2490
|
pending: !!m && u.pending[m.id] === "payment_method",
|
|
@@ -2494,10 +2494,10 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2494
2494
|
return t || (h(null), y(s("changeCard.done"))), t;
|
|
2495
2495
|
}
|
|
2496
2496
|
}, `card-${m?.id ?? "closed"}`),
|
|
2497
|
-
/* @__PURE__ */
|
|
2497
|
+
/* @__PURE__ */ F(En, {
|
|
2498
2498
|
open: f !== null,
|
|
2499
2499
|
onOpenChange: (e) => !e && p(null),
|
|
2500
|
-
name: f ?
|
|
2500
|
+
name: f ? xe(f, o) : "",
|
|
2501
2501
|
onChain: C,
|
|
2502
2502
|
appearance: r,
|
|
2503
2503
|
pending: f ? u.pending[f.id] : void 0,
|
|
@@ -2513,23 +2513,23 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2513
2513
|
//#endregion
|
|
2514
2514
|
//#region src/account/account-billing.tsx
|
|
2515
2515
|
function Pn({ defaultCurrency: e, defaultCountry: t, sendSolanaTransaction: n, plansHref: r, renderSubscriptionFooter: i, historyPageSize: a, appearance: o, className: s }) {
|
|
2516
|
-
return /* @__PURE__ */
|
|
2516
|
+
return /* @__PURE__ */ I(me, {
|
|
2517
2517
|
appearance: o,
|
|
2518
|
-
className:
|
|
2518
|
+
className: L("grid gap-6", s),
|
|
2519
2519
|
"data-testid": "account-billing",
|
|
2520
2520
|
children: [
|
|
2521
|
-
/* @__PURE__ */
|
|
2521
|
+
/* @__PURE__ */ F(Nn, {
|
|
2522
2522
|
sendSolanaTransaction: n,
|
|
2523
2523
|
plansHref: r,
|
|
2524
2524
|
renderSubscriptionFooter: i,
|
|
2525
2525
|
appearance: o
|
|
2526
2526
|
}),
|
|
2527
|
-
/* @__PURE__ */
|
|
2527
|
+
/* @__PURE__ */ F(wn, {
|
|
2528
2528
|
defaultCurrency: e,
|
|
2529
2529
|
defaultCountry: t,
|
|
2530
2530
|
appearance: o
|
|
2531
2531
|
}),
|
|
2532
|
-
/* @__PURE__ */
|
|
2532
|
+
/* @__PURE__ */ F(We, {
|
|
2533
2533
|
pageSize: a,
|
|
2534
2534
|
appearance: o
|
|
2535
2535
|
})
|
|
@@ -2540,8 +2540,8 @@ function Pn({ defaultCurrency: e, defaultCountry: t, sendSolanaTransaction: n, p
|
|
|
2540
2540
|
//#region src/components/qr.tsx
|
|
2541
2541
|
var Fn = 208;
|
|
2542
2542
|
function In({ amountLabel: e, payload: t, statusLine: n }) {
|
|
2543
|
-
let r =
|
|
2544
|
-
return
|
|
2543
|
+
let r = N.useRef(null), [i, a] = N.useState("loading");
|
|
2544
|
+
return N.useEffect(() => {
|
|
2545
2545
|
let e = r.current;
|
|
2546
2546
|
if (!e || !t) return;
|
|
2547
2547
|
let n = !1;
|
|
@@ -2552,12 +2552,12 @@ function In({ amountLabel: e, payload: t, statusLine: n }) {
|
|
|
2552
2552
|
}), () => {
|
|
2553
2553
|
n = !0, e.replaceChildren();
|
|
2554
2554
|
};
|
|
2555
|
-
}, [t]), /* @__PURE__ */
|
|
2555
|
+
}, [t]), /* @__PURE__ */ I("div", {
|
|
2556
2556
|
className: "grid justify-items-center gap-3 py-1",
|
|
2557
2557
|
children: [
|
|
2558
|
-
/* @__PURE__ */
|
|
2558
|
+
/* @__PURE__ */ F("div", {
|
|
2559
2559
|
className: "grid place-items-center rounded-xl bg-white p-1 shadow-sm ring-1 ring-black/10",
|
|
2560
|
-
children: t ? /* @__PURE__ */
|
|
2560
|
+
children: t ? /* @__PURE__ */ I("div", {
|
|
2561
2561
|
role: "img",
|
|
2562
2562
|
"aria-label": "Solana Pay QR code",
|
|
2563
2563
|
className: "relative overflow-hidden rounded-lg",
|
|
@@ -2566,20 +2566,20 @@ function In({ amountLabel: e, payload: t, statusLine: n }) {
|
|
|
2566
2566
|
height: Fn
|
|
2567
2567
|
},
|
|
2568
2568
|
children: [
|
|
2569
|
-
/* @__PURE__ */
|
|
2569
|
+
/* @__PURE__ */ F("div", {
|
|
2570
2570
|
ref: r,
|
|
2571
2571
|
className: "absolute inset-0"
|
|
2572
2572
|
}),
|
|
2573
|
-
i === "loading" ? /* @__PURE__ */
|
|
2573
|
+
i === "loading" ? /* @__PURE__ */ F("div", {
|
|
2574
2574
|
"aria-hidden": !0,
|
|
2575
2575
|
className: "absolute inset-0 animate-pulse rounded-lg bg-zinc-100"
|
|
2576
2576
|
}) : null,
|
|
2577
|
-
i === "failed" ? /* @__PURE__ */
|
|
2577
|
+
i === "failed" ? /* @__PURE__ */ F("div", {
|
|
2578
2578
|
className: "absolute inset-0 grid place-items-center text-center text-xs text-zinc-600",
|
|
2579
2579
|
children: "QR code unavailable"
|
|
2580
2580
|
}) : null
|
|
2581
2581
|
]
|
|
2582
|
-
}) : /* @__PURE__ */
|
|
2582
|
+
}) : /* @__PURE__ */ F("div", {
|
|
2583
2583
|
"aria-hidden": !0,
|
|
2584
2584
|
className: "animate-pulse rounded-lg bg-zinc-100",
|
|
2585
2585
|
style: {
|
|
@@ -2588,11 +2588,11 @@ function In({ amountLabel: e, payload: t, statusLine: n }) {
|
|
|
2588
2588
|
}
|
|
2589
2589
|
})
|
|
2590
2590
|
}),
|
|
2591
|
-
/* @__PURE__ */
|
|
2591
|
+
/* @__PURE__ */ F("div", {
|
|
2592
2592
|
className: "text-[13px] font-medium text-balance",
|
|
2593
2593
|
children: "Scan with a Solana wallet"
|
|
2594
2594
|
}),
|
|
2595
|
-
/* @__PURE__ */
|
|
2595
|
+
/* @__PURE__ */ I("div", {
|
|
2596
2596
|
className: "text-center text-[12.5px] text-pretty text-muted-foreground tabular-nums",
|
|
2597
2597
|
"aria-live": "polite",
|
|
2598
2598
|
children: [
|
|
@@ -2601,9 +2601,9 @@ function In({ amountLabel: e, payload: t, statusLine: n }) {
|
|
|
2601
2601
|
n
|
|
2602
2602
|
]
|
|
2603
2603
|
}),
|
|
2604
|
-
t ? /* @__PURE__ */
|
|
2604
|
+
t ? /* @__PURE__ */ F("a", {
|
|
2605
2605
|
href: t,
|
|
2606
|
-
className:
|
|
2606
|
+
className: L(he({ variant: "secondary" }), "h-9 w-full max-w-56"),
|
|
2607
2607
|
children: "Open in wallet"
|
|
2608
2608
|
}) : null
|
|
2609
2609
|
]
|
|
@@ -2629,7 +2629,7 @@ function Bn(e) {
|
|
|
2629
2629
|
if (!(!t?.exp_month || !t.exp_year)) return `${String(t.exp_month).padStart(2, "0")}/${String(t.exp_year).slice(-2)}`;
|
|
2630
2630
|
}
|
|
2631
2631
|
function Vn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
2632
|
-
return /* @__PURE__ */
|
|
2632
|
+
return /* @__PURE__ */ I(Dn, {
|
|
2633
2633
|
value: t,
|
|
2634
2634
|
onValueChange: (e) => {
|
|
2635
2635
|
typeof e == "string" && e && n(e);
|
|
@@ -2639,21 +2639,21 @@ function Vn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2639
2639
|
className: "grid gap-0",
|
|
2640
2640
|
children: [e.map((e) => {
|
|
2641
2641
|
let n = `${i}-${e.id}`, a = t === e.id, o = Bn(e), s = e.card?.brand, c = e.card?.last4;
|
|
2642
|
-
return /* @__PURE__ */
|
|
2642
|
+
return /* @__PURE__ */ I(Z, {
|
|
2643
2643
|
htmlFor: n,
|
|
2644
|
-
className:
|
|
2644
|
+
className: L("flex cursor-pointer items-center gap-3 py-1.5 select-none", r && "cursor-default"),
|
|
2645
2645
|
children: [
|
|
2646
|
-
/* @__PURE__ */
|
|
2646
|
+
/* @__PURE__ */ F(On, {
|
|
2647
2647
|
id: n,
|
|
2648
2648
|
value: e.id
|
|
2649
2649
|
}),
|
|
2650
|
-
/* @__PURE__ */
|
|
2650
|
+
/* @__PURE__ */ F(Xe, {
|
|
2651
2651
|
brand: s ?? void 0,
|
|
2652
2652
|
fallback: Rn(s)
|
|
2653
2653
|
}),
|
|
2654
|
-
/* @__PURE__ */
|
|
2655
|
-
className:
|
|
2656
|
-
children: [/* @__PURE__ */
|
|
2654
|
+
/* @__PURE__ */ I("span", {
|
|
2655
|
+
className: L("min-w-0 flex-1 truncate text-sm font-medium text-muted-foreground tabular-nums transition-colors", a && "font-semibold text-foreground"),
|
|
2656
|
+
children: [/* @__PURE__ */ I("span", {
|
|
2657
2657
|
className: "sr-only",
|
|
2658
2658
|
children: [
|
|
2659
2659
|
zn(s),
|
|
@@ -2661,13 +2661,13 @@ function Vn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2661
2661
|
c,
|
|
2662
2662
|
o ? `, expires ${o}` : ""
|
|
2663
2663
|
]
|
|
2664
|
-
}), /* @__PURE__ */
|
|
2664
|
+
}), /* @__PURE__ */ I("span", {
|
|
2665
2665
|
"aria-hidden": !0,
|
|
2666
2666
|
children: [
|
|
2667
2667
|
zn(s),
|
|
2668
2668
|
" •••• ",
|
|
2669
2669
|
c ?? "····",
|
|
2670
|
-
o ? /* @__PURE__ */
|
|
2670
|
+
o ? /* @__PURE__ */ I("span", {
|
|
2671
2671
|
className: "font-normal text-muted-foreground",
|
|
2672
2672
|
children: [
|
|
2673
2673
|
" ",
|
|
@@ -2680,19 +2680,19 @@ function Vn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2680
2680
|
})
|
|
2681
2681
|
]
|
|
2682
2682
|
}, e.id);
|
|
2683
|
-
}), /* @__PURE__ */
|
|
2683
|
+
}), /* @__PURE__ */ I(Z, {
|
|
2684
2684
|
htmlFor: `${i}-new`,
|
|
2685
|
-
className:
|
|
2685
|
+
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"),
|
|
2686
2686
|
children: [
|
|
2687
|
-
/* @__PURE__ */
|
|
2687
|
+
/* @__PURE__ */ F(On, {
|
|
2688
2688
|
id: `${i}-new`,
|
|
2689
2689
|
value: "new"
|
|
2690
2690
|
}),
|
|
2691
|
-
/* @__PURE__ */
|
|
2691
|
+
/* @__PURE__ */ F("span", {
|
|
2692
2692
|
"aria-hidden": !0,
|
|
2693
|
-
className:
|
|
2694
|
-
children: /* @__PURE__ */
|
|
2695
|
-
icon:
|
|
2693
|
+
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"),
|
|
2694
|
+
children: /* @__PURE__ */ F(R, {
|
|
2695
|
+
icon: ce,
|
|
2696
2696
|
className: "size-3.5"
|
|
2697
2697
|
})
|
|
2698
2698
|
}),
|
|
@@ -2704,28 +2704,28 @@ function Vn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2704
2704
|
//#endregion
|
|
2705
2705
|
//#region src/components/states.tsx
|
|
2706
2706
|
function Hn() {
|
|
2707
|
-
return /* @__PURE__ */
|
|
2707
|
+
return /* @__PURE__ */ I("div", {
|
|
2708
2708
|
className: "grid gap-4",
|
|
2709
2709
|
"aria-hidden": !0,
|
|
2710
2710
|
children: [
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
2713
|
-
/* @__PURE__ */
|
|
2714
|
-
/* @__PURE__ */
|
|
2715
|
-
/* @__PURE__ */
|
|
2716
|
-
/* @__PURE__ */
|
|
2711
|
+
/* @__PURE__ */ F(J, { className: "h-3 w-24" }),
|
|
2712
|
+
/* @__PURE__ */ F(J, { className: "h-6 w-52" }),
|
|
2713
|
+
/* @__PURE__ */ F(J, { className: "mt-1.5 h-11 w-full" }),
|
|
2714
|
+
/* @__PURE__ */ F(J, { className: "h-28 w-full" }),
|
|
2715
|
+
/* @__PURE__ */ F(J, { className: "h-11 w-full" }),
|
|
2716
|
+
/* @__PURE__ */ F(J, { className: "mt-1 h-[42px] w-full" })
|
|
2717
2717
|
]
|
|
2718
2718
|
});
|
|
2719
2719
|
}
|
|
2720
2720
|
//#endregion
|
|
2721
2721
|
//#region src/components/stripe-wallets.tsx
|
|
2722
2722
|
function Un({ publishableKey: e, amount: t, currency: n, onPaymentMethod: r, onAvailable: i }) {
|
|
2723
|
-
let a =
|
|
2724
|
-
|
|
2723
|
+
let a = N.useRef(null), o = N.useRef(r), s = N.useRef(i);
|
|
2724
|
+
N.useEffect(() => {
|
|
2725
2725
|
o.current = r, s.current = i;
|
|
2726
2726
|
});
|
|
2727
|
-
let [c, l] =
|
|
2728
|
-
return
|
|
2727
|
+
let [c, l] = N.useState(!1);
|
|
2728
|
+
return N.useEffect(() => {
|
|
2729
2729
|
if (!a.current) return;
|
|
2730
2730
|
let r = !1, i, c = (e) => {
|
|
2731
2731
|
r || (l(e), s.current?.(e));
|
|
@@ -2763,7 +2763,7 @@ function Un({ publishableKey: e, amount: t, currency: n, onPaymentMethod: r, onA
|
|
|
2763
2763
|
e,
|
|
2764
2764
|
t,
|
|
2765
2765
|
n
|
|
2766
|
-
]), /* @__PURE__ */
|
|
2766
|
+
]), /* @__PURE__ */ F("div", {
|
|
2767
2767
|
ref: a,
|
|
2768
2768
|
"data-testid": "stripe-wallets",
|
|
2769
2769
|
style: { visibility: c ? "visible" : "hidden" }
|
|
@@ -2772,258 +2772,291 @@ function Un({ publishableKey: e, amount: t, currency: n, onPaymentMethod: r, onA
|
|
|
2772
2772
|
//#endregion
|
|
2773
2773
|
//#region src/order-payment.tsx
|
|
2774
2774
|
var Wn = (e) => e.status === "complete" || e.status === "processing", Gn = 3e3;
|
|
2775
|
-
function Kn({ orderId: e, client: t, returnUrl:
|
|
2776
|
-
let
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
}),
|
|
2775
|
+
function Kn({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0, serverCardEntry: a = !0, wallets: o = !1, onSettled: c, appearance: l, className: u }) {
|
|
2776
|
+
let p = S(), m = T(), h = t ?? m.client, { config: g } = y(), { config: _ } = te(), v = D(), [b, x] = N.useState(), [w, ee] = N.useState([]), [O, k] = N.useState("new"), [ne, re] = N.useState(), [A, j] = N.useState(), [M, ie] = N.useState(!1), [ae, oe] = N.useState(!1), [se, R] = N.useState(() => crypto.randomUUID()), ce = N.useRef(null), le = N.useRef(c);
|
|
2777
|
+
N.useEffect(() => {
|
|
2778
|
+
le.current = c;
|
|
2779
|
+
}), N.useEffect(() => {
|
|
2780
2780
|
let t = new AbortController();
|
|
2781
|
-
return
|
|
2782
|
-
t.signal.aborted ||
|
|
2781
|
+
return h.getOrder(e, t.signal).then(x, (e) => {
|
|
2782
|
+
t.signal.aborted || j(p.error(e));
|
|
2783
2783
|
}), () => t.abort();
|
|
2784
2784
|
}, [
|
|
2785
|
-
|
|
2785
|
+
h,
|
|
2786
2786
|
e,
|
|
2787
|
-
|
|
2788
|
-
]),
|
|
2789
|
-
if (!
|
|
2787
|
+
p
|
|
2788
|
+
]), N.useEffect(() => {
|
|
2789
|
+
if (!i || b?.collection_owner !== "engine") return;
|
|
2790
2790
|
let e = new AbortController();
|
|
2791
|
-
return
|
|
2791
|
+
return h.listPaymentMethods({ signal: e.signal }).then((e) => ee(e.data), () => void 0), () => e.abort();
|
|
2792
2792
|
}, [
|
|
2793
|
-
|
|
2794
|
-
|
|
2793
|
+
h,
|
|
2794
|
+
i,
|
|
2795
2795
|
b?.collection_owner
|
|
2796
|
-
]),
|
|
2797
|
-
b && Wn(b) &&
|
|
2796
|
+
]), N.useEffect(() => {
|
|
2797
|
+
b && Wn(b) && le.current?.(b);
|
|
2798
2798
|
}, [b]);
|
|
2799
|
-
let
|
|
2800
|
-
|
|
2801
|
-
if (!
|
|
2799
|
+
let ue = b?.collection_owner === "engine" && b?.payment.status === "requires_action" && b.payment.next_action?.type === "solana_pay";
|
|
2800
|
+
N.useEffect(() => {
|
|
2801
|
+
if (!ue || !b) return;
|
|
2802
2802
|
let e = window.setInterval(() => {
|
|
2803
|
-
|
|
2803
|
+
h.confirmOrder(b.id).then((e) => x(e.order), () => void 0);
|
|
2804
2804
|
}, Gn);
|
|
2805
2805
|
return () => window.clearInterval(e);
|
|
2806
2806
|
}, [
|
|
2807
|
-
|
|
2808
|
-
|
|
2807
|
+
ue,
|
|
2808
|
+
h,
|
|
2809
2809
|
b
|
|
2810
2810
|
]);
|
|
2811
|
-
let
|
|
2812
|
-
let t =
|
|
2813
|
-
return (t === "collect_js" || t === "stripe_elements") &&
|
|
2814
|
-
}), V = de.filter((e) =>
|
|
2811
|
+
let z = N.useMemo(() => b?.collection_owner === "engine" ? b.payment_options : [], [b]), de = N.useMemo(() => (_?.payment.psps ?? []).filter((e) => z.some((t) => t.psp_id === e.psp_id)), [_, z]), B = de.filter((e) => {
|
|
2812
|
+
let t = s(e);
|
|
2813
|
+
return (t === "collect_js" || t === "stripe_elements") && z.some((t) => t.psp_id === e.psp_id && t.accepts.includes("new_card"));
|
|
2814
|
+
}), V = de.filter((e) => a || s(e) !== "card"), fe = w.filter((e) => (e.status ?? "active") === "active" && e.reusable !== !1 && e.health?.active !== !1 && V.some((t) => t.psp_id === e.psp_id)).map((e) => ({
|
|
2815
2815
|
id: e.id,
|
|
2816
2816
|
psp_id: e.psp_id ?? "",
|
|
2817
2817
|
rail: e.rail ?? "",
|
|
2818
2818
|
card: e.card ?? void 0
|
|
2819
|
-
})), H = B.find((e) => e.psp_id ===
|
|
2820
|
-
if (!b) return
|
|
2819
|
+
})), H = B.find((e) => e.psp_id === ne) ?? B[0], pe = z.find((e) => e.accepts.includes("solana_pay")), me = de.filter((e) => s(e) === null && z.some((t) => t.psp_id === e.psp_id && t.accepts.includes("redirect"))), he = (e) => z.some((t) => t.psp_id === e.psp_id && t.fallback), U = me.filter((e) => !he(e)), ge = me.filter(he), _e = pe ? _?.payment.solana?.tokens ?? [] : [], ve = o ? B.find((e) => s(e) === "stripe_elements" && !!e.config?.publishable_key) : void 0;
|
|
2820
|
+
if (!b) return A ? /* @__PURE__ */ F("p", {
|
|
2821
2821
|
role: "alert",
|
|
2822
2822
|
className: "text-sm text-destructive",
|
|
2823
|
-
children:
|
|
2824
|
-
}) : /* @__PURE__ */
|
|
2825
|
-
let
|
|
2826
|
-
if (x(e.order), e.error) return
|
|
2823
|
+
children: A
|
|
2824
|
+
}) : /* @__PURE__ */ F(Hn, {});
|
|
2825
|
+
let ye = v[b.currency.toUpperCase()] ?? 2, W = (e) => d(e, b.currency, ye), be = g?.currencies?.find((e) => e.code.toUpperCase() === b.currency.toUpperCase()), xe = ve && be?.minor_decimals != null ? f(b.total, be.decimals, be.minor_decimals) : null, Se = async (e) => {
|
|
2826
|
+
if (x(e.order), e.error) return j(e.order.payment.last_payment_error?.message ?? e.error.message), R(crypto.randomUUID()), !1;
|
|
2827
2827
|
let t = e.order.payment.next_action;
|
|
2828
2828
|
if (e.order.collection_owner !== "engine" || e.order.payment.status !== "requires_action" || !t) return !0;
|
|
2829
2829
|
if (t.type === "redirect_to_url" && t.url) return window.location.assign(t.url), !0;
|
|
2830
2830
|
let n = t.payload?.client_secret, r = (_?.payment.psps.find((e) => e.psp_id === t.psp_id))?.config?.publishable_key;
|
|
2831
|
-
if (t.type !== "authenticate" || !n || !r) return
|
|
2832
|
-
if (
|
|
2831
|
+
if (t.type !== "authenticate" || !n || !r) return j(p.t("paymentMethods.unavailable")), !1;
|
|
2832
|
+
if (ce.current && t.psp_id === H?.psp_id) await ce.current.handleNextAction(n);
|
|
2833
2833
|
else {
|
|
2834
2834
|
let e = await (await Wt(r)).handleNextAction({ clientSecret: n });
|
|
2835
2835
|
if (e.error) throw Error(e.error.message);
|
|
2836
2836
|
}
|
|
2837
|
-
return
|
|
2838
|
-
},
|
|
2839
|
-
if (
|
|
2840
|
-
|
|
2837
|
+
return Se(await h.confirmOrder(b.id));
|
|
2838
|
+
}, G = async (e) => {
|
|
2839
|
+
if (M || b.collection_owner !== "engine") return !1;
|
|
2840
|
+
ie(!0), j(void 0);
|
|
2841
2841
|
try {
|
|
2842
|
-
return await
|
|
2842
|
+
return await Se(await h.payOrder(b.id, {
|
|
2843
2843
|
payment: await e(),
|
|
2844
2844
|
expectedTotal: b.total,
|
|
2845
|
-
idempotencyKey:
|
|
2845
|
+
idempotencyKey: se
|
|
2846
2846
|
}));
|
|
2847
2847
|
} catch (e) {
|
|
2848
|
-
return
|
|
2848
|
+
return j(!n(e) && e instanceof Error && e.message ? e.message : p.error(e)), R(crypto.randomUUID()), !1;
|
|
2849
2849
|
} finally {
|
|
2850
|
-
|
|
2850
|
+
ie(!1);
|
|
2851
2851
|
}
|
|
2852
|
-
},
|
|
2853
|
-
if (!(
|
|
2854
|
-
|
|
2852
|
+
}, Ce = async () => {
|
|
2853
|
+
if (!(M || b.collection_owner !== "engine")) {
|
|
2854
|
+
ie(!0), j(void 0);
|
|
2855
2855
|
try {
|
|
2856
|
-
await
|
|
2856
|
+
await Se({ order: b });
|
|
2857
2857
|
} catch (e) {
|
|
2858
|
-
|
|
2858
|
+
j(!n(e) && e instanceof Error && e.message ? e.message : p.error(e));
|
|
2859
2859
|
} finally {
|
|
2860
|
-
|
|
2860
|
+
ie(!1);
|
|
2861
2861
|
}
|
|
2862
2862
|
}
|
|
2863
|
-
},
|
|
2864
|
-
return /* @__PURE__ */
|
|
2865
|
-
className:
|
|
2866
|
-
"data-orck-theme": C(
|
|
2867
|
-
style: E(
|
|
2868
|
-
children: [/* @__PURE__ */
|
|
2863
|
+
}, we = b.collection_owner === "engine" && b.status === "open" && b.payment.status === "requires_action" && b.payment.next_action?.type === "authenticate", Te = b.collection_owner === "engine" && b.status === "open" && b.payment.status === "requires_action" && b.payment.next_action?.type === "redirect_to_url" && !!b.payment.next_action.url, Ee = _?.payment.psps.find((e) => e.psp_id === b.payment.next_action?.psp_id), K = `Pay ${W(b.usage?.amount_due ?? b.total)}`, q = b.collection_owner === "engine" && (b.status === "open" || b.status === "uncollectible" && !!b.usage) && b.payment.status === "requires_payment_method";
|
|
2864
|
+
return /* @__PURE__ */ I("div", {
|
|
2865
|
+
className: L("orck grid gap-5", u),
|
|
2866
|
+
"data-orck-theme": C(l),
|
|
2867
|
+
style: E(l),
|
|
2868
|
+
children: [/* @__PURE__ */ I("div", {
|
|
2869
2869
|
className: "grid",
|
|
2870
2870
|
children: [
|
|
2871
|
-
b.lines.map((e) => /* @__PURE__ */
|
|
2871
|
+
b.lines.map((e) => /* @__PURE__ */ I("div", {
|
|
2872
2872
|
className: "flex items-start justify-between gap-4 py-2 text-[13.5px]",
|
|
2873
|
-
children: [/* @__PURE__ */
|
|
2873
|
+
children: [/* @__PURE__ */ I("span", { children: [e.description, e.quantity && e.quantity > 1 ? ` × ${e.quantity}` : ""] }), /* @__PURE__ */ F("span", {
|
|
2874
2874
|
className: "whitespace-nowrap tabular-nums",
|
|
2875
|
-
children:
|
|
2875
|
+
children: W(e.amount)
|
|
2876
2876
|
})]
|
|
2877
2877
|
}, e.id)),
|
|
2878
|
-
/* @__PURE__ */
|
|
2878
|
+
/* @__PURE__ */ I("div", {
|
|
2879
2879
|
className: "flex items-start justify-between gap-4 border-t border-border pt-3 text-[13.5px] font-semibold",
|
|
2880
|
-
children: [/* @__PURE__ */
|
|
2880
|
+
children: [/* @__PURE__ */ F("span", { children: "Total" }), /* @__PURE__ */ F("span", {
|
|
2881
2881
|
className: "whitespace-nowrap tabular-nums",
|
|
2882
|
-
children:
|
|
2882
|
+
children: W(b.total)
|
|
2883
2883
|
})]
|
|
2884
2884
|
}),
|
|
2885
|
-
b.usage && b.usage.amount_paid !== "0" && /* @__PURE__ */
|
|
2885
|
+
b.usage && b.usage.amount_paid !== "0" && /* @__PURE__ */ I("div", {
|
|
2886
2886
|
className: "flex items-start justify-between gap-4 pt-1 text-[13.5px]",
|
|
2887
|
-
children: [/* @__PURE__ */
|
|
2887
|
+
children: [/* @__PURE__ */ F("span", { children: "Due" }), /* @__PURE__ */ F("span", {
|
|
2888
2888
|
className: "whitespace-nowrap tabular-nums",
|
|
2889
|
-
children:
|
|
2889
|
+
children: W(b.usage.amount_due)
|
|
2890
2890
|
})]
|
|
2891
2891
|
})
|
|
2892
2892
|
]
|
|
2893
|
-
}),
|
|
2893
|
+
}), ue ? /* @__PURE__ */ F(In, {
|
|
2894
2894
|
amountLabel: `${b.payment.next_action?.payload?.token_amount ?? ""} ${b.payment.next_action?.payload?.token_symbol ?? ""}`.trim(),
|
|
2895
2895
|
payload: b.payment.next_action?.url ?? void 0,
|
|
2896
2896
|
statusLine: "Waiting for your wallet's payment"
|
|
2897
|
-
}) : b.status === "complete" ? /* @__PURE__ */
|
|
2897
|
+
}) : b.status === "complete" ? /* @__PURE__ */ F("p", {
|
|
2898
2898
|
role: "status",
|
|
2899
2899
|
className: "text-sm font-semibold",
|
|
2900
2900
|
children: "Payment complete"
|
|
2901
|
-
}) : b.collection_owner === "engine" ? b.status === "processing" ? /* @__PURE__ */
|
|
2901
|
+
}) : b.collection_owner === "engine" ? b.status === "processing" ? /* @__PURE__ */ F("p", {
|
|
2902
2902
|
role: "status",
|
|
2903
2903
|
className: "text-sm text-muted-foreground",
|
|
2904
2904
|
children: "Your payment is processing."
|
|
2905
|
-
}) : b.status === "open" ?
|
|
2905
|
+
}) : b.status === "open" ? Te ? /* @__PURE__ */ I("form", {
|
|
2906
2906
|
className: "grid gap-4",
|
|
2907
2907
|
onSubmit: (e) => {
|
|
2908
|
-
e.preventDefault(),
|
|
2908
|
+
e.preventDefault(), window.location.assign(b.payment.next_action.url);
|
|
2909
|
+
},
|
|
2910
|
+
children: [/* @__PURE__ */ I("p", {
|
|
2911
|
+
className: "text-sm text-muted-foreground",
|
|
2912
|
+
children: [
|
|
2913
|
+
"Your payment is waiting on",
|
|
2914
|
+
" ",
|
|
2915
|
+
Ee?.display_name ?? "the payment page",
|
|
2916
|
+
"."
|
|
2917
|
+
]
|
|
2918
|
+
}), /* @__PURE__ */ F(Q, {
|
|
2919
|
+
label: `Continue to ${Ee?.display_name ?? "the payment page"}`,
|
|
2920
|
+
processing: !1
|
|
2921
|
+
})]
|
|
2922
|
+
}) : we ? /* @__PURE__ */ I("form", {
|
|
2923
|
+
className: "grid gap-4",
|
|
2924
|
+
onSubmit: (e) => {
|
|
2925
|
+
e.preventDefault(), Ce();
|
|
2909
2926
|
},
|
|
2910
2927
|
children: [
|
|
2911
|
-
/* @__PURE__ */
|
|
2928
|
+
/* @__PURE__ */ F("p", {
|
|
2912
2929
|
className: "text-sm text-muted-foreground",
|
|
2913
2930
|
children: "Your bank asks you to confirm this payment."
|
|
2914
2931
|
}),
|
|
2915
|
-
/* @__PURE__ */
|
|
2932
|
+
/* @__PURE__ */ F(Q, {
|
|
2916
2933
|
label: "Confirm payment",
|
|
2917
|
-
processing:
|
|
2934
|
+
processing: M
|
|
2918
2935
|
}),
|
|
2919
|
-
|
|
2936
|
+
A ? /* @__PURE__ */ F("p", {
|
|
2920
2937
|
role: "alert",
|
|
2921
2938
|
className: "text-sm text-destructive",
|
|
2922
|
-
children:
|
|
2939
|
+
children: A
|
|
2923
2940
|
}) : null
|
|
2924
2941
|
]
|
|
2925
|
-
}) : /* @__PURE__ */
|
|
2942
|
+
}) : /* @__PURE__ */ I("div", {
|
|
2926
2943
|
className: "grid gap-4",
|
|
2927
2944
|
children: [
|
|
2928
|
-
|
|
2929
|
-
publishableKey:
|
|
2930
|
-
amount:
|
|
2945
|
+
ve && xe ? /* @__PURE__ */ F(Un, {
|
|
2946
|
+
publishableKey: ve.config.publishable_key,
|
|
2947
|
+
amount: xe,
|
|
2931
2948
|
currency: b.currency,
|
|
2932
|
-
onAvailable:
|
|
2933
|
-
onPaymentMethod: (e) =>
|
|
2949
|
+
onAvailable: oe,
|
|
2950
|
+
onPaymentMethod: (e) => G(async () => ({
|
|
2934
2951
|
token: e,
|
|
2935
|
-
psp_id:
|
|
2952
|
+
psp_id: ve.psp_id
|
|
2936
2953
|
}))
|
|
2937
2954
|
}) : null,
|
|
2938
|
-
|
|
2955
|
+
ae && ve && xe ? /* @__PURE__ */ F("p", {
|
|
2939
2956
|
className: "text-center text-[13px] text-muted-foreground",
|
|
2940
2957
|
children: "or pay another way"
|
|
2941
2958
|
}) : null,
|
|
2942
|
-
fe.length > 0 ? /* @__PURE__ */
|
|
2959
|
+
fe.length > 0 ? /* @__PURE__ */ F(Vn, {
|
|
2943
2960
|
methods: fe,
|
|
2944
|
-
value:
|
|
2945
|
-
onChange:
|
|
2946
|
-
disabled:
|
|
2961
|
+
value: O,
|
|
2962
|
+
onChange: k,
|
|
2963
|
+
disabled: M || !q,
|
|
2947
2964
|
idPrefix: `orck-order-${b.id}`
|
|
2948
2965
|
}) : null,
|
|
2949
|
-
|
|
2966
|
+
O === "new" ? H ? /* @__PURE__ */ I(P, { children: [B.length > 1 ? /* @__PURE__ */ F("select", {
|
|
2950
2967
|
"aria-label": "Pay with",
|
|
2951
2968
|
className: "h-9 rounded-md border border-border bg-transparent px-2 text-sm",
|
|
2952
2969
|
value: H.psp_id,
|
|
2953
|
-
onChange: (e) =>
|
|
2954
|
-
children: B.map((e) => /* @__PURE__ */
|
|
2970
|
+
onChange: (e) => re(e.target.value),
|
|
2971
|
+
children: B.map((e) => /* @__PURE__ */ F("option", {
|
|
2955
2972
|
value: e.psp_id,
|
|
2956
2973
|
children: e.display_name
|
|
2957
2974
|
}, e.psp_id))
|
|
2958
|
-
}) : null,
|
|
2975
|
+
}) : null, s(H) === "collect_js" ? /* @__PURE__ */ F(hn, {
|
|
2959
2976
|
tokenizationKey: H.config.tokenization_key,
|
|
2960
2977
|
tokenizationURL: H.config.tokenization_url,
|
|
2961
|
-
submitLabel:
|
|
2962
|
-
disabled:
|
|
2963
|
-
appearance:
|
|
2964
|
-
onTokenized: (e) =>
|
|
2978
|
+
submitLabel: K,
|
|
2979
|
+
disabled: M || !q,
|
|
2980
|
+
appearance: l,
|
|
2981
|
+
onTokenized: (e) => G(async () => ({
|
|
2965
2982
|
token: e.payment_token,
|
|
2966
2983
|
psp_id: H.psp_id,
|
|
2967
2984
|
billing_details: Tt(e)
|
|
2968
2985
|
}))
|
|
2969
|
-
}, H.psp_id) : /* @__PURE__ */
|
|
2986
|
+
}, H.psp_id) : /* @__PURE__ */ I("form", {
|
|
2970
2987
|
className: "grid gap-4",
|
|
2971
2988
|
onSubmit: (e) => {
|
|
2972
|
-
e.preventDefault(),
|
|
2973
|
-
token: await
|
|
2989
|
+
e.preventDefault(), G(async () => ({
|
|
2990
|
+
token: await ce.current.tokenize(),
|
|
2974
2991
|
psp_id: H.psp_id
|
|
2975
2992
|
}));
|
|
2976
2993
|
},
|
|
2977
2994
|
children: [
|
|
2978
|
-
/* @__PURE__ */
|
|
2979
|
-
ref:
|
|
2995
|
+
/* @__PURE__ */ F(rn, {
|
|
2996
|
+
ref: ce,
|
|
2980
2997
|
psp: H,
|
|
2981
|
-
client:
|
|
2982
|
-
unavailableMessage:
|
|
2983
|
-
verificationPendingMessage:
|
|
2998
|
+
client: h,
|
|
2999
|
+
unavailableMessage: p.t("paymentMethods.unavailable"),
|
|
3000
|
+
verificationPendingMessage: p.t("paymentMethods.verificationPending")
|
|
2984
3001
|
}, H.psp_id),
|
|
2985
|
-
/* @__PURE__ */
|
|
2986
|
-
label:
|
|
2987
|
-
processing:
|
|
3002
|
+
/* @__PURE__ */ F(Q, {
|
|
3003
|
+
label: K,
|
|
3004
|
+
processing: M,
|
|
2988
3005
|
disabled: !q
|
|
2989
3006
|
}),
|
|
2990
|
-
/* @__PURE__ */
|
|
3007
|
+
/* @__PURE__ */ F(Ht, {})
|
|
2991
3008
|
]
|
|
2992
|
-
})] }) : pe ||
|
|
3009
|
+
})] }) : pe || U.length > 0 || ge.length > 0 ? null : /* @__PURE__ */ F("p", {
|
|
2993
3010
|
role: "alert",
|
|
2994
3011
|
className: "text-sm text-destructive",
|
|
2995
|
-
children:
|
|
2996
|
-
}) : /* @__PURE__ */
|
|
3012
|
+
children: p.t("paymentMethods.unavailable")
|
|
3013
|
+
}) : /* @__PURE__ */ F("form", {
|
|
2997
3014
|
className: "grid gap-4",
|
|
2998
3015
|
onSubmit: (e) => {
|
|
2999
|
-
e.preventDefault(),
|
|
3016
|
+
e.preventDefault(), G(async () => ({ payment_method_id: O }));
|
|
3000
3017
|
},
|
|
3001
|
-
children: /* @__PURE__ */
|
|
3002
|
-
label:
|
|
3003
|
-
processing:
|
|
3018
|
+
children: /* @__PURE__ */ F(Q, {
|
|
3019
|
+
label: K,
|
|
3020
|
+
processing: M,
|
|
3004
3021
|
disabled: !q
|
|
3005
3022
|
})
|
|
3006
3023
|
}),
|
|
3007
|
-
|
|
3024
|
+
U.map((e) => /* @__PURE__ */ F("form", {
|
|
3008
3025
|
onSubmit: (t) => {
|
|
3009
|
-
t.preventDefault(),
|
|
3010
|
-
return_url:
|
|
3026
|
+
t.preventDefault(), G(async () => ({
|
|
3027
|
+
return_url: r ?? window.location.href,
|
|
3011
3028
|
psp_id: e.psp_id
|
|
3012
3029
|
}));
|
|
3013
3030
|
},
|
|
3014
|
-
children: /* @__PURE__ */
|
|
3015
|
-
label: `${
|
|
3016
|
-
processing:
|
|
3031
|
+
children: /* @__PURE__ */ F(Q, {
|
|
3032
|
+
label: `${K} with ${e.display_name}`,
|
|
3033
|
+
processing: M,
|
|
3017
3034
|
disabled: !q
|
|
3018
3035
|
})
|
|
3019
3036
|
}, e.psp_id)),
|
|
3020
|
-
|
|
3037
|
+
ge.length > 0 ? /* @__PURE__ */ I("div", {
|
|
3021
3038
|
className: "grid gap-2 border-t border-border pt-4",
|
|
3022
|
-
children:
|
|
3039
|
+
children: [/* @__PURE__ */ F("p", {
|
|
3040
|
+
className: "text-[13px] text-muted-foreground",
|
|
3041
|
+
children: "Card payment isn't working?"
|
|
3042
|
+
}), ge.map((e) => /* @__PURE__ */ I("button", {
|
|
3023
3043
|
type: "button",
|
|
3024
3044
|
className: "h-9 rounded-md border border-border text-sm",
|
|
3025
|
-
disabled:
|
|
3026
|
-
onClick: () => void
|
|
3045
|
+
disabled: M || !q,
|
|
3046
|
+
onClick: () => void G(async () => ({
|
|
3047
|
+
return_url: r ?? window.location.href,
|
|
3048
|
+
psp_id: e.psp_id
|
|
3049
|
+
})),
|
|
3050
|
+
children: ["Pay with ", e.display_name]
|
|
3051
|
+
}, e.psp_id))]
|
|
3052
|
+
}) : null,
|
|
3053
|
+
pe && _e.length > 0 ? /* @__PURE__ */ F("div", {
|
|
3054
|
+
className: "grid gap-2 border-t border-border pt-4",
|
|
3055
|
+
children: _e.map((e) => /* @__PURE__ */ I("button", {
|
|
3056
|
+
type: "button",
|
|
3057
|
+
className: "h-9 rounded-md border border-border text-sm",
|
|
3058
|
+
disabled: M || !q,
|
|
3059
|
+
onClick: () => void G(async () => ({
|
|
3027
3060
|
token_symbol: e.symbol,
|
|
3028
3061
|
psp_id: pe.psp_id
|
|
3029
3062
|
})),
|
|
@@ -3034,17 +3067,17 @@ function Kn({ orderId: e, client: t, returnUrl: n, savedPaymentMethods: r = !0,
|
|
|
3034
3067
|
]
|
|
3035
3068
|
}, e.symbol))
|
|
3036
3069
|
}) : null,
|
|
3037
|
-
|
|
3070
|
+
A ? /* @__PURE__ */ F("p", {
|
|
3038
3071
|
role: "alert",
|
|
3039
3072
|
className: "text-sm text-destructive",
|
|
3040
|
-
children:
|
|
3073
|
+
children: A
|
|
3041
3074
|
}) : null
|
|
3042
3075
|
]
|
|
3043
|
-
}) : /* @__PURE__ */
|
|
3076
|
+
}) : /* @__PURE__ */ F("p", {
|
|
3044
3077
|
role: "status",
|
|
3045
3078
|
className: "text-sm text-muted-foreground",
|
|
3046
3079
|
children: "This order can no longer be paid."
|
|
3047
|
-
}) : /* @__PURE__ */
|
|
3080
|
+
}) : /* @__PURE__ */ F("p", {
|
|
3048
3081
|
role: "status",
|
|
3049
3082
|
className: "text-sm text-muted-foreground",
|
|
3050
3083
|
children: "This bill is collected by the payment provider. No payment is needed here."
|
|
@@ -3055,11 +3088,11 @@ function Kn({ orderId: e, client: t, returnUrl: n, savedPaymentMethods: r = !0,
|
|
|
3055
3088
|
//#region src/embedded-payment.tsx
|
|
3056
3089
|
var qn = "openrails.payment.complete", Jn = "openrails.payment.resize";
|
|
3057
3090
|
function Yn({ url: e, onComplete: t, title: n = "Payment", className: r }) {
|
|
3058
|
-
let i =
|
|
3059
|
-
|
|
3091
|
+
let i = N.useRef(null), [a, o] = N.useState(), s = N.useRef(t);
|
|
3092
|
+
N.useEffect(() => {
|
|
3060
3093
|
s.current = t;
|
|
3061
3094
|
});
|
|
3062
|
-
let c =
|
|
3095
|
+
let c = N.useMemo(() => {
|
|
3063
3096
|
try {
|
|
3064
3097
|
let t = new URL(e);
|
|
3065
3098
|
return t.protocol === "https:" || t.protocol === "http:" ? t.origin : null;
|
|
@@ -3067,7 +3100,7 @@ function Yn({ url: e, onComplete: t, title: n = "Payment", className: r }) {
|
|
|
3067
3100
|
return null;
|
|
3068
3101
|
}
|
|
3069
3102
|
}, [e]);
|
|
3070
|
-
return
|
|
3103
|
+
return N.useEffect(() => {
|
|
3071
3104
|
if (!c) return;
|
|
3072
3105
|
let e = !1, t = (t) => {
|
|
3073
3106
|
if (t.origin !== c || !i.current || t.source !== i.current.contentWindow) return;
|
|
@@ -3087,7 +3120,7 @@ function Yn({ url: e, onComplete: t, title: n = "Payment", className: r }) {
|
|
|
3087
3120
|
}) : /^https?:\/\//i.test(a) && window.location.assign(a);
|
|
3088
3121
|
};
|
|
3089
3122
|
return window.addEventListener("message", t), () => window.removeEventListener("message", t);
|
|
3090
|
-
}, [c]), c ? /* @__PURE__ */
|
|
3123
|
+
}, [c]), c ? /* @__PURE__ */ F("iframe", {
|
|
3091
3124
|
ref: i,
|
|
3092
3125
|
src: e,
|
|
3093
3126
|
title: n,
|
|
@@ -3103,8 +3136,8 @@ function Yn({ url: e, onComplete: t, title: n = "Payment", className: r }) {
|
|
|
3103
3136
|
//#endregion
|
|
3104
3137
|
//#region src/cart.tsx
|
|
3105
3138
|
function Xn({ client: e, onOrder: t, onSettled: n, appearance: r, className: i }) {
|
|
3106
|
-
let a = S(), o = T(), s = e ?? o.client, c =
|
|
3107
|
-
|
|
3139
|
+
let a = S(), o = T(), s = e ?? o.client, c = D(), [l, u] = N.useState(), [f, p] = N.useState(), [m, h] = N.useState(), [g, _] = N.useState(!1), [v, y] = N.useState(() => crypto.randomUUID());
|
|
3140
|
+
N.useEffect(() => {
|
|
3108
3141
|
let e = new AbortController();
|
|
3109
3142
|
return s.getCart(e.signal).then(u, (t) => {
|
|
3110
3143
|
e.signal.aborted || h(a.error(t));
|
|
@@ -3122,21 +3155,21 @@ function Xn({ client: e, onOrder: t, onSettled: n, appearance: r, className: i }
|
|
|
3122
3155
|
}
|
|
3123
3156
|
}
|
|
3124
3157
|
};
|
|
3125
|
-
if (f && !t) return /* @__PURE__ */
|
|
3158
|
+
if (f && !t) return /* @__PURE__ */ F(Kn, {
|
|
3126
3159
|
orderId: f.id,
|
|
3127
3160
|
client: s,
|
|
3128
3161
|
onSettled: n,
|
|
3129
3162
|
appearance: r,
|
|
3130
3163
|
className: i
|
|
3131
3164
|
});
|
|
3132
|
-
if (!l) return m ? /* @__PURE__ */
|
|
3165
|
+
if (!l) return m ? /* @__PURE__ */ F("p", {
|
|
3133
3166
|
role: "alert",
|
|
3134
3167
|
className: "text-sm text-destructive",
|
|
3135
3168
|
children: m
|
|
3136
|
-
}) : /* @__PURE__ */
|
|
3137
|
-
let x = c[l.currency.toUpperCase()] ?? 2, w = (e) => d(e, l.currency, x),
|
|
3169
|
+
}) : /* @__PURE__ */ F(Hn, {});
|
|
3170
|
+
let x = c[l.currency.toUpperCase()] ?? 2, w = (e) => d(e, l.currency, x), ee = l.lines.length > 0 && l.lines.every((e) => !e.refusal), O = (e) => b(async () => {
|
|
3138
3171
|
u(await s.setCartLine(e, { quantity: 0 })), y(crypto.randomUUID());
|
|
3139
|
-
}),
|
|
3172
|
+
}), k = () => b(async () => {
|
|
3140
3173
|
let e = await s.createOrder({
|
|
3141
3174
|
cart: !0,
|
|
3142
3175
|
expectedTotal: l.total,
|
|
@@ -3145,63 +3178,63 @@ function Xn({ client: e, onOrder: t, onSettled: n, appearance: r, className: i }
|
|
|
3145
3178
|
if (e.error) throw e.error;
|
|
3146
3179
|
p(e.order), t?.(e.order);
|
|
3147
3180
|
});
|
|
3148
|
-
return /* @__PURE__ */
|
|
3149
|
-
className:
|
|
3181
|
+
return /* @__PURE__ */ I("div", {
|
|
3182
|
+
className: L("orck grid gap-5", i),
|
|
3150
3183
|
"data-orck-theme": C(r),
|
|
3151
3184
|
style: E(r),
|
|
3152
3185
|
children: [
|
|
3153
|
-
l.lines.length === 0 ? /* @__PURE__ */
|
|
3186
|
+
l.lines.length === 0 ? /* @__PURE__ */ F("p", {
|
|
3154
3187
|
role: "status",
|
|
3155
3188
|
className: "text-sm text-muted-foreground",
|
|
3156
3189
|
children: "Your cart is empty."
|
|
3157
|
-
}) : /* @__PURE__ */
|
|
3190
|
+
}) : /* @__PURE__ */ I("div", {
|
|
3158
3191
|
className: "grid",
|
|
3159
|
-
children: [l.lines.map((e) => /* @__PURE__ */
|
|
3192
|
+
children: [l.lines.map((e) => /* @__PURE__ */ I("div", {
|
|
3160
3193
|
className: "grid gap-1 border-b border-border py-2 text-[13.5px]",
|
|
3161
3194
|
children: [
|
|
3162
|
-
/* @__PURE__ */
|
|
3195
|
+
/* @__PURE__ */ I("div", {
|
|
3163
3196
|
className: "flex items-start justify-between gap-4",
|
|
3164
|
-
children: [/* @__PURE__ */
|
|
3197
|
+
children: [/* @__PURE__ */ F("span", { children: e.description || e.price_id }), /* @__PURE__ */ F("span", {
|
|
3165
3198
|
className: "whitespace-nowrap tabular-nums",
|
|
3166
3199
|
children: w(e.amount)
|
|
3167
3200
|
})]
|
|
3168
3201
|
}),
|
|
3169
|
-
/* @__PURE__ */
|
|
3202
|
+
/* @__PURE__ */ I("div", {
|
|
3170
3203
|
className: "flex items-center gap-2",
|
|
3171
|
-
children: [e.quantity != null && e.quantity > 1 ? /* @__PURE__ */
|
|
3204
|
+
children: [e.quantity != null && e.quantity > 1 ? /* @__PURE__ */ I("span", {
|
|
3172
3205
|
className: "text-[13px] text-muted-foreground",
|
|
3173
3206
|
children: ["Quantity ", e.quantity]
|
|
3174
|
-
}) : null, /* @__PURE__ */
|
|
3207
|
+
}) : null, /* @__PURE__ */ F("button", {
|
|
3175
3208
|
type: "button",
|
|
3176
3209
|
className: "text-[13px] text-muted-foreground underline",
|
|
3177
3210
|
disabled: g,
|
|
3178
|
-
onClick: () => void
|
|
3211
|
+
onClick: () => void O(e.price_id),
|
|
3179
3212
|
children: "Remove"
|
|
3180
3213
|
})]
|
|
3181
3214
|
}),
|
|
3182
|
-
e.refusal ? /* @__PURE__ */
|
|
3215
|
+
e.refusal ? /* @__PURE__ */ F("p", {
|
|
3183
3216
|
className: "text-[13px] text-destructive",
|
|
3184
3217
|
children: e.refusal.message
|
|
3185
3218
|
}) : null
|
|
3186
3219
|
]
|
|
3187
|
-
}, e.price_id)), /* @__PURE__ */
|
|
3220
|
+
}, e.price_id)), /* @__PURE__ */ I("div", {
|
|
3188
3221
|
className: "flex items-start justify-between gap-4 pt-3 text-[13.5px] font-semibold",
|
|
3189
|
-
children: [/* @__PURE__ */
|
|
3222
|
+
children: [/* @__PURE__ */ F("span", { children: "Total" }), /* @__PURE__ */ F("span", {
|
|
3190
3223
|
className: "whitespace-nowrap tabular-nums",
|
|
3191
3224
|
children: w(l.total)
|
|
3192
3225
|
})]
|
|
3193
3226
|
})]
|
|
3194
3227
|
}),
|
|
3195
|
-
l.lines.length > 0 ? /* @__PURE__ */
|
|
3228
|
+
l.lines.length > 0 ? /* @__PURE__ */ I("form", {
|
|
3196
3229
|
className: "grid gap-2",
|
|
3197
3230
|
onSubmit: (e) => {
|
|
3198
|
-
e.preventDefault(),
|
|
3231
|
+
e.preventDefault(), k();
|
|
3199
3232
|
},
|
|
3200
|
-
children: [/* @__PURE__ */
|
|
3233
|
+
children: [/* @__PURE__ */ F(Q, {
|
|
3201
3234
|
label: "Check out",
|
|
3202
3235
|
processing: g,
|
|
3203
|
-
disabled: !
|
|
3204
|
-
}), /* @__PURE__ */
|
|
3236
|
+
disabled: !ee
|
|
3237
|
+
}), /* @__PURE__ */ F("button", {
|
|
3205
3238
|
type: "button",
|
|
3206
3239
|
className: "text-[13px] text-muted-foreground underline",
|
|
3207
3240
|
disabled: g,
|
|
@@ -3211,7 +3244,7 @@ function Xn({ client: e, onOrder: t, onSettled: n, appearance: r, className: i }
|
|
|
3211
3244
|
children: "Empty cart"
|
|
3212
3245
|
})]
|
|
3213
3246
|
}) : null,
|
|
3214
|
-
m ? /* @__PURE__ */
|
|
3247
|
+
m ? /* @__PURE__ */ F("p", {
|
|
3215
3248
|
role: "alert",
|
|
3216
3249
|
className: "text-sm text-destructive",
|
|
3217
3250
|
children: m
|
|
@@ -3222,16 +3255,16 @@ function Xn({ client: e, onOrder: t, onSettled: n, appearance: r, className: i }
|
|
|
3222
3255
|
//#endregion
|
|
3223
3256
|
//#region src/authenticate.ts
|
|
3224
3257
|
async function Zn(e, t, n, r) {
|
|
3225
|
-
let i = n.next_action,
|
|
3226
|
-
if (n.status !== "requires_action" || i?.type !== "authenticate" || !
|
|
3227
|
-
let
|
|
3228
|
-
if (
|
|
3258
|
+
let i = n.next_action, o = i?.payload?.client_secret;
|
|
3259
|
+
if (n.status !== "requires_action" || i?.type !== "authenticate" || !o || !a(r)) return n;
|
|
3260
|
+
let s = await (await Wt(r.config.publishable_key)).handleNextAction({ clientSecret: o });
|
|
3261
|
+
if (s.error) throw Error(s.error.message ?? "Authentication failed.");
|
|
3229
3262
|
return e.confirmSubscriptionChange(t);
|
|
3230
3263
|
}
|
|
3231
3264
|
//#endregion
|
|
3232
3265
|
//#region src/lib/price-label.ts
|
|
3233
3266
|
function Qn(e, t, n, r) {
|
|
3234
|
-
let i =
|
|
3267
|
+
let i = W(e.unit_amount, e.currency, t, r) ?? `${e.unit_amount} ${e.currency}`, a = ge(e.billing_interval_hours);
|
|
3235
3268
|
if (a) return n.t("products.recurring", {
|
|
3236
3269
|
amount: i,
|
|
3237
3270
|
every: n.plural(`interval.every.${a.unit}`, a.count)
|
|
@@ -3245,24 +3278,24 @@ function Qn(e, t, n, r) {
|
|
|
3245
3278
|
//#endregion
|
|
3246
3279
|
//#region src/modal.tsx
|
|
3247
3280
|
function $n({ open: e, onOpenChange: t, appearance: n, children: r }) {
|
|
3248
|
-
return /* @__PURE__ */
|
|
3281
|
+
return /* @__PURE__ */ F(ot, {
|
|
3249
3282
|
open: e,
|
|
3250
3283
|
onOpenChange: t,
|
|
3251
|
-
children: /* @__PURE__ */
|
|
3284
|
+
children: /* @__PURE__ */ I(lt, {
|
|
3252
3285
|
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",
|
|
3253
3286
|
"data-orck-theme": C(n),
|
|
3254
3287
|
style: E(n),
|
|
3255
3288
|
showCloseButton: !0,
|
|
3256
3289
|
children: [
|
|
3257
|
-
/* @__PURE__ */
|
|
3290
|
+
/* @__PURE__ */ F(ft, {
|
|
3258
3291
|
className: "sr-only",
|
|
3259
3292
|
children: "Payment"
|
|
3260
3293
|
}),
|
|
3261
|
-
/* @__PURE__ */
|
|
3294
|
+
/* @__PURE__ */ F(pt, {
|
|
3262
3295
|
className: "sr-only",
|
|
3263
3296
|
children: "Complete your payment"
|
|
3264
3297
|
}),
|
|
3265
|
-
/* @__PURE__ */
|
|
3298
|
+
/* @__PURE__ */ F("div", {
|
|
3266
3299
|
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",
|
|
3267
3300
|
children: r
|
|
3268
3301
|
})
|
|
@@ -3271,106 +3304,106 @@ function $n({ open: e, onOpenChange: t, appearance: n, children: r }) {
|
|
|
3271
3304
|
});
|
|
3272
3305
|
}
|
|
3273
3306
|
function er({ open: e, onOpenChange: t, ...n }) {
|
|
3274
|
-
return /* @__PURE__ */
|
|
3307
|
+
return /* @__PURE__ */ F($n, {
|
|
3275
3308
|
open: e,
|
|
3276
3309
|
onOpenChange: t,
|
|
3277
3310
|
appearance: n.appearance,
|
|
3278
|
-
children: /* @__PURE__ */
|
|
3311
|
+
children: /* @__PURE__ */ F(Kn, { ...n })
|
|
3279
3312
|
});
|
|
3280
3313
|
}
|
|
3281
3314
|
function tr({ open: e, onOpenChange: t, appearance: n, ...r }) {
|
|
3282
|
-
return /* @__PURE__ */
|
|
3315
|
+
return /* @__PURE__ */ F($n, {
|
|
3283
3316
|
open: e,
|
|
3284
3317
|
onOpenChange: t,
|
|
3285
3318
|
appearance: n,
|
|
3286
|
-
children: /* @__PURE__ */
|
|
3319
|
+
children: /* @__PURE__ */ F(Yn, { ...r })
|
|
3287
3320
|
});
|
|
3288
3321
|
}
|
|
3289
3322
|
//#endregion
|
|
3290
3323
|
//#region src/buy-button.tsx
|
|
3291
3324
|
function nr(e) {
|
|
3292
|
-
if (!
|
|
3325
|
+
if (!n(e) || e.code !== "already_owned") return;
|
|
3293
3326
|
let t = e.metadata.owned_by;
|
|
3294
3327
|
return typeof t == "string" && t.startsWith("ord_") ? t : void 0;
|
|
3295
3328
|
}
|
|
3296
3329
|
var rr = (e) => typeof window < "u" && e.includes(window.location.origin);
|
|
3297
|
-
function ir({ price:
|
|
3298
|
-
let
|
|
3299
|
-
e.status === "complete" && (v(void 0),
|
|
3300
|
-
},
|
|
3301
|
-
if (
|
|
3330
|
+
function ir({ price: t, label: i, amount: a, returnUrl: o, onPaid: s, onSignInRequired: c, signedIn: l, appearance: u, className: d }) {
|
|
3331
|
+
let f = S(), { locale: p } = O(), m = D(), h = x(u), { client: g } = T(), [_, v] = N.useState(), [y, b] = N.useState(!1), [C, w] = N.useState(), E = (e) => {
|
|
3332
|
+
e.status === "complete" && (v(void 0), s(e));
|
|
3333
|
+
}, ee = async () => {
|
|
3334
|
+
if (l === !1) return c();
|
|
3302
3335
|
w(void 0), b(!0);
|
|
3303
3336
|
try {
|
|
3304
|
-
let { merchant:
|
|
3337
|
+
let { merchant: e } = await g.getCustomerConfig(), n = rr(e.embed_origins), i;
|
|
3305
3338
|
try {
|
|
3306
|
-
({order:
|
|
3339
|
+
({order: i} = await g.createOrder({
|
|
3307
3340
|
lines: [{
|
|
3308
|
-
price_id:
|
|
3309
|
-
...
|
|
3341
|
+
price_id: t.id,
|
|
3342
|
+
...a ? { amount: a } : {}
|
|
3310
3343
|
}],
|
|
3311
|
-
...
|
|
3344
|
+
...n ? { payUrl: { embedded: !0 } } : {}
|
|
3312
3345
|
}));
|
|
3313
3346
|
} catch (e) {
|
|
3314
3347
|
let t = nr(e);
|
|
3315
|
-
if (!t ||
|
|
3348
|
+
if (!t || n) throw e;
|
|
3316
3349
|
v({
|
|
3317
3350
|
kind: "inline",
|
|
3318
3351
|
orderId: t
|
|
3319
3352
|
});
|
|
3320
3353
|
return;
|
|
3321
3354
|
}
|
|
3322
|
-
if (
|
|
3323
|
-
if (!
|
|
3355
|
+
if (i.status === "complete") return E(i);
|
|
3356
|
+
if (!n) {
|
|
3324
3357
|
v({
|
|
3325
3358
|
kind: "inline",
|
|
3326
|
-
orderId:
|
|
3359
|
+
orderId: i.id
|
|
3327
3360
|
});
|
|
3328
3361
|
return;
|
|
3329
3362
|
}
|
|
3330
|
-
let o =
|
|
3331
|
-
if (!o) throw
|
|
3363
|
+
let o = i.pay_url;
|
|
3364
|
+
if (!o) throw r("invalid_response", "the order answered no pay URL");
|
|
3332
3365
|
v({
|
|
3333
3366
|
kind: "embedded",
|
|
3334
|
-
orderId:
|
|
3367
|
+
orderId: i.id,
|
|
3335
3368
|
url: o
|
|
3336
3369
|
});
|
|
3337
|
-
} catch (
|
|
3338
|
-
|
|
3370
|
+
} catch (t) {
|
|
3371
|
+
n(t) && t.status === 401 ? c() : w(f.error(e(t)));
|
|
3339
3372
|
} finally {
|
|
3340
3373
|
b(!1);
|
|
3341
3374
|
}
|
|
3342
|
-
},
|
|
3343
|
-
return /* @__PURE__ */
|
|
3344
|
-
className:
|
|
3345
|
-
"data-orck-theme":
|
|
3375
|
+
}, k = (e) => !e && v(void 0);
|
|
3376
|
+
return /* @__PURE__ */ I("span", {
|
|
3377
|
+
className: L(h.className, "inline-flex flex-col gap-1", d),
|
|
3378
|
+
"data-orck-theme": h["data-orck-theme"],
|
|
3346
3379
|
style: {
|
|
3347
|
-
...
|
|
3380
|
+
...h.style,
|
|
3348
3381
|
containerType: "normal"
|
|
3349
3382
|
},
|
|
3350
3383
|
children: [
|
|
3351
|
-
/* @__PURE__ */
|
|
3384
|
+
/* @__PURE__ */ F(U, {
|
|
3352
3385
|
disabled: y,
|
|
3353
|
-
onClick: () => void
|
|
3354
|
-
children:
|
|
3386
|
+
onClick: () => void ee(),
|
|
3387
|
+
children: i ?? Qn(t, m, f, p)
|
|
3355
3388
|
}),
|
|
3356
|
-
C ? /* @__PURE__ */
|
|
3389
|
+
C ? /* @__PURE__ */ F("span", {
|
|
3357
3390
|
role: "alert",
|
|
3358
3391
|
className: "text-sm text-destructive",
|
|
3359
3392
|
children: C
|
|
3360
3393
|
}) : null,
|
|
3361
|
-
_?.kind === "inline" ? /* @__PURE__ */
|
|
3394
|
+
_?.kind === "inline" ? /* @__PURE__ */ F(er, {
|
|
3362
3395
|
open: !0,
|
|
3363
|
-
onOpenChange:
|
|
3396
|
+
onOpenChange: k,
|
|
3364
3397
|
orderId: _.orderId,
|
|
3365
|
-
returnUrl:
|
|
3366
|
-
appearance:
|
|
3398
|
+
returnUrl: o,
|
|
3399
|
+
appearance: u,
|
|
3367
3400
|
onSettled: E
|
|
3368
3401
|
}) : null,
|
|
3369
|
-
_?.kind === "embedded" ? /* @__PURE__ */
|
|
3402
|
+
_?.kind === "embedded" ? /* @__PURE__ */ F(tr, {
|
|
3370
3403
|
open: !0,
|
|
3371
|
-
onOpenChange:
|
|
3404
|
+
onOpenChange: k,
|
|
3372
3405
|
url: _.url,
|
|
3373
|
-
appearance:
|
|
3406
|
+
appearance: u,
|
|
3374
3407
|
onComplete: () => void g.getOrder(_.orderId).then(E, () => void 0)
|
|
3375
3408
|
}) : null
|
|
3376
3409
|
]
|
|
@@ -3383,16 +3416,16 @@ function ar({ products: e, onPaid: t, onSignInRequired: n, signedIn: r, returnUr
|
|
|
3383
3416
|
product: e,
|
|
3384
3417
|
prices: e.prices.filter((e) => !e.archived && !e.customer_amount)
|
|
3385
3418
|
})).filter((e) => e.prices.length > 0), u;
|
|
3386
|
-
return u = l.length === 0 ? /* @__PURE__ */
|
|
3419
|
+
return u = l.length === 0 ? /* @__PURE__ */ F(Re, { title: s.t("products.empty") }) : l.map(({ product: e, prices: o }) => /* @__PURE__ */ I(Ae, {
|
|
3387
3420
|
className: "gap-4",
|
|
3388
3421
|
"data-testid": "product",
|
|
3389
|
-
children: [/* @__PURE__ */
|
|
3422
|
+
children: [/* @__PURE__ */ I(je, { children: [/* @__PURE__ */ F(Me, {
|
|
3390
3423
|
role: "heading",
|
|
3391
3424
|
"aria-level": 2,
|
|
3392
3425
|
children: e.display_name
|
|
3393
|
-
}), e.description ? /* @__PURE__ */
|
|
3426
|
+
}), e.description ? /* @__PURE__ */ F(Ne, { children: e.description }) : null] }), /* @__PURE__ */ F(Fe, {
|
|
3394
3427
|
className: "flex flex-wrap gap-2",
|
|
3395
|
-
children: o.map((e) => /* @__PURE__ */
|
|
3428
|
+
children: o.map((e) => /* @__PURE__ */ F(ir, {
|
|
3396
3429
|
price: e,
|
|
3397
3430
|
onPaid: t,
|
|
3398
3431
|
onSignInRequired: n,
|
|
@@ -3401,14 +3434,14 @@ function ar({ products: e, onPaid: t, onSignInRequired: n, signedIn: r, returnUr
|
|
|
3401
3434
|
appearance: a
|
|
3402
3435
|
}, e.id))
|
|
3403
3436
|
})]
|
|
3404
|
-
}, e.id)), /* @__PURE__ */
|
|
3405
|
-
className:
|
|
3437
|
+
}, e.id)), /* @__PURE__ */ F("div", {
|
|
3438
|
+
className: L(c.className, ke, "grid gap-4", o),
|
|
3406
3439
|
"data-orck-theme": c["data-orck-theme"],
|
|
3407
3440
|
style: c.style,
|
|
3408
3441
|
children: u
|
|
3409
3442
|
});
|
|
3410
3443
|
}
|
|
3411
3444
|
//#endregion
|
|
3412
|
-
export { Pn as AccountBilling, w as BillingProvider, He as BillingStatusBadge, me as BillingUiRoot, ir as BuyButton, En as CancelSubscriptionDialog, Xe as CardBrandPlate, Xn as Cart, Yn as EmbeddedPayment, Kn as OrderPayment, qn as PAYMENT_COMPLETE_MESSAGE, Jn as PAYMENT_RESIZE_MESSAGE, We as PaymentHistory, wn as PaymentMethodsPanel, ar as ProductList, gn as SavePaymentMethod, Nn as SubscriptionsPanel, hn as TokenizedCardForm,
|
|
3445
|
+
export { Pn as AccountBilling, w as BillingProvider, He as BillingStatusBadge, me as BillingUiRoot, ir as BuyButton, En as CancelSubscriptionDialog, Xe as CardBrandPlate, Xn as Cart, Yn as EmbeddedPayment, Kn as OrderPayment, qn as PAYMENT_COMPLETE_MESSAGE, Jn as PAYMENT_RESIZE_MESSAGE, We as PaymentHistory, wn as PaymentMethodsPanel, ar as ProductList, gn as SavePaymentMethod, Nn as SubscriptionsPanel, hn as TokenizedCardForm, c as addAmounts, l as amountToDecimal, Zn as authenticateChange, Dt as browserCountry, a as canAuthenticatePayment, m as canSavePaymentMethod, s as cardSetupDriver, o as createBillingClient, v as createTranslator, re as defaultMessages, j as defineMessages, d as formatAmount, Ot as initialCountry, b as interpolate, u as isAmount, g as pspConfigSchema, t as redeemAssertion, Ke as resolveCardBrand, A as resolveMessages, i as routedPsps, Oe as statusTone, h as tokenSource, S as useMessages };
|
|
3413
3446
|
|
|
3414
3447
|
//# sourceMappingURL=index.js.map
|