@openrails/billing-ui 0.252.1 → 0.253.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 +13 -0
- package/README.md +15 -4
- package/dist/admin/context.d.ts +4 -4
- package/dist/admin/lib/api/endpoints.d.ts +2 -2
- package/dist/admin/lib/api/index.d.ts +1 -1
- package/dist/admin/lib/mutations.d.ts +1 -1
- package/dist/{admin-detail-DG-YaHhS.js → admin-detail-DAOjLNL9.js} +2 -2
- package/dist/admin-detail-DAOjLNL9.js.map +1 -0
- package/dist/{admin-orders-8XzHf7b-.js → admin-orders-DMSOum9t.js} +2 -2
- package/dist/admin-orders-DMSOum9t.js.map +1 -0
- package/dist/admin-utils-DnVY5fYd.js.map +1 -1
- package/dist/admin.js +2 -2
- package/dist/buy-button.d.ts +4 -1
- package/dist/cart.d.ts +4 -1
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/routes.d.ts +4 -4
- package/dist/client/generated/wire.d.ts +8 -3
- package/dist/client/types.d.ts +13 -7
- package/dist/{client-imFR1UCe.js → client-Di2a3HGM.js} +4 -3
- package/dist/client-Di2a3HGM.js.map +1 -0
- package/dist/client.js +1 -1
- package/dist/components/platform-card-form.d.ts +8 -0
- package/dist/create-card-BEILS1VB-DeyyfyFD.js +140 -0
- package/dist/create-card-BEILS1VB-DeyyfyFD.js.map +1 -0
- package/dist/create-card-display-Dv5pcpzc-BWB6vzo2.js +166 -0
- package/dist/create-card-display-Dv5pcpzc-BWB6vzo2.js.map +1 -0
- package/dist/create-copy-button-CAYmfugS-qNapojfj.js +125 -0
- package/dist/create-copy-button-CAYmfugS-qNapojfj.js.map +1 -0
- package/dist/embedded-payment.d.ts +4 -1
- package/dist/fallbacks.d.ts +25 -0
- package/dist/{hooks-C9JkHcRt.js → hooks-Bx0aLyvy.js} +2 -2
- package/dist/{hooks-C9JkHcRt.js.map → hooks-Bx0aLyvy.js.map} +1 -1
- package/dist/index-rGw83t5v-BE6naeQR.js +1801 -0
- package/dist/index-rGw83t5v-BE6naeQR.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1128 -975
- package/dist/index.js.map +1 -1
- package/dist/order-payment.d.ts +8 -1
- package/dist/product-list.d.ts +4 -1
- package/dist/react.js +1 -1
- package/package.json +2 -1
- package/dist/admin-detail-DG-YaHhS.js.map +0 -1
- package/dist/admin-orders-8XzHf7b-.js.map +0 -1
- package/dist/client-imFR1UCe.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -11,29 +11,30 @@ if (typeof document !== "undefined") {
|
|
|
11
11
|
if (__orckStyle.textContent !== __orckCss) __orckStyle.textContent = __orckCss;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
import { A as e, C as t, E as n, O as r, S as i, _ as a, a as o, b as s, d as c, f as l, g as u, h as d, p as f, s as p, v as m, w as h, x as g, y as _ } from "./client-
|
|
15
|
-
import { _ as v, a as y, b, f as x, g as S, h as C, i as w, l as T, m as E, n as
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
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-Di2a3HGM.js";
|
|
15
|
+
import { _ as v, a as y, b, f as x, g as S, h as C, i as w, l as T, m as E, n as D, o as O, p as k, r as A, s as ee, t as te, v as ne, x as re, y as j } from "./hooks-Bx0aLyvy.js";
|
|
16
|
+
import { t as M } from "./index-rGw83t5v-BE6naeQR.js";
|
|
17
|
+
import { z as N } from "zod";
|
|
18
|
+
import * as P from "react";
|
|
19
|
+
import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
|
|
20
|
+
import { cn as R } from "cn";
|
|
20
21
|
import { Button as ie } from "@base-ui/react/button";
|
|
21
|
-
import { cva as
|
|
22
|
-
import { mergeProps as
|
|
23
|
-
import { useRender as
|
|
24
|
-
import { HugeiconsIcon as
|
|
25
|
-
import { Add01Icon as
|
|
26
|
-
import { AlertDialog as
|
|
27
|
-
import { Dialog as
|
|
22
|
+
import { cva as z } from "class-variance-authority";
|
|
23
|
+
import { mergeProps as ae } from "@base-ui/react/merge-props";
|
|
24
|
+
import { useRender as oe } from "@base-ui/react/use-render";
|
|
25
|
+
import { HugeiconsIcon as B } from "@hugeicons/react";
|
|
26
|
+
import { Add01Icon as se, ArrowUpRight01Icon as ce, Cancel01Icon as le, Delete02Icon as ue, Loading03Icon as de } from "@hugeicons/core-free-icons";
|
|
27
|
+
import { AlertDialog as V } from "@base-ui/react/alert-dialog";
|
|
28
|
+
import { Dialog as H } from "@base-ui/react/dialog";
|
|
28
29
|
import { Input as fe } from "@base-ui/react/input";
|
|
29
|
-
import { Radio as
|
|
30
|
-
import { RadioGroup as
|
|
30
|
+
import { Radio as pe } from "@base-ui/react/radio";
|
|
31
|
+
import { RadioGroup as me } from "@base-ui/react/radio-group";
|
|
31
32
|
//#region src/scope.tsx
|
|
32
|
-
function
|
|
33
|
+
function he({ appearance: e, className: t, style: n, ...r }) {
|
|
33
34
|
let i = x(e);
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ I("div", {
|
|
35
36
|
"data-orck-theme": i["data-orck-theme"],
|
|
36
|
-
className:
|
|
37
|
+
className: R(i.className, t),
|
|
37
38
|
style: {
|
|
38
39
|
...i.style,
|
|
39
40
|
...n
|
|
@@ -43,7 +44,7 @@ function me({ appearance: e, className: t, style: n, ...r }) {
|
|
|
43
44
|
}
|
|
44
45
|
//#endregion
|
|
45
46
|
//#region src/components/ui/button.tsx
|
|
46
|
-
var
|
|
47
|
+
var ge = z("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
48
|
variants: {
|
|
48
49
|
variant: {
|
|
49
50
|
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
@@ -70,9 +71,9 @@ var he = ae("group/button inline-flex shrink-0 items-center justify-center round
|
|
|
70
71
|
}
|
|
71
72
|
});
|
|
72
73
|
function U({ className: e, variant: t = "default", size: n = "default", ...r }) {
|
|
73
|
-
return /* @__PURE__ */
|
|
74
|
+
return /* @__PURE__ */ I(ie, {
|
|
74
75
|
"data-slot": "button",
|
|
75
|
-
className:
|
|
76
|
+
className: R(ge({
|
|
76
77
|
variant: t,
|
|
77
78
|
size: n,
|
|
78
79
|
className: e
|
|
@@ -82,7 +83,7 @@ function U({ className: e, variant: t = "default", size: n = "default", ...r })
|
|
|
82
83
|
}
|
|
83
84
|
//#endregion
|
|
84
85
|
//#region src/lib/period.ts
|
|
85
|
-
function
|
|
86
|
+
function W(e) {
|
|
86
87
|
return !e || !Number.isSafeInteger(e) || e <= 0 ? null : e % 168 == 0 ? {
|
|
87
88
|
unit: "week",
|
|
88
89
|
count: e / 168
|
|
@@ -95,11 +96,11 @@ function ge(e) {
|
|
|
95
96
|
};
|
|
96
97
|
}
|
|
97
98
|
function _e(e, t) {
|
|
98
|
-
let n =
|
|
99
|
+
let n = W(e);
|
|
99
100
|
return n ? t.plural(`interval.every.${n.unit}`, n.count) : null;
|
|
100
101
|
}
|
|
101
102
|
function ve(e, t) {
|
|
102
|
-
let n =
|
|
103
|
+
let n = W(e);
|
|
103
104
|
return n ? t.plural(`interval.access.${n.unit}`, n.count) : null;
|
|
104
105
|
}
|
|
105
106
|
//#endregion
|
|
@@ -114,47 +115,47 @@ function ye(e, t) {
|
|
|
114
115
|
return n.toISOString().slice(0, 10);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
function
|
|
118
|
+
function be(e, t, n, r) {
|
|
118
119
|
if (!e) return null;
|
|
119
120
|
let i = n[t.toUpperCase()];
|
|
120
121
|
return i === void 0 ? null : d(e, t, i, r);
|
|
121
122
|
}
|
|
122
|
-
function
|
|
123
|
+
function xe(e, t) {
|
|
123
124
|
return e ? e.billing_interval_hours ? _e(e.billing_interval_hours, t) : ve(e.access_duration_hours, t) ?? t.t("interval.once") : null;
|
|
124
125
|
}
|
|
125
|
-
function
|
|
126
|
+
function Se(e, { t }) {
|
|
126
127
|
return e.product?.display_name?.trim() || e.price?.key?.trim() || t("subscriptions.fallbackName");
|
|
127
128
|
}
|
|
128
|
-
function
|
|
129
|
+
function Ce(e, t, n) {
|
|
129
130
|
let r = [...new Set((t?.lines ?? []).map((e) => e.description.trim()).filter(Boolean))], i = t?.lines.length === 1 ? t.lines[0] : void 0;
|
|
130
131
|
return {
|
|
131
132
|
name: r.join(", ") || n.t(e.subscription_id ? "history.subscription" : "history.purchase"),
|
|
132
133
|
detail: i?.billing_interval_hours ? _e(i.billing_interval_hours, n) : null
|
|
133
134
|
};
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
+
function we(e, t) {
|
|
136
137
|
let n = e?.trim();
|
|
137
138
|
return n ? n[0].toUpperCase() + n.slice(1).toLowerCase() : t;
|
|
138
139
|
}
|
|
139
|
-
function
|
|
140
|
-
let n =
|
|
140
|
+
function Te(e, t) {
|
|
141
|
+
let n = we(e?.brand, t.t("paymentMethods.fallbackBrand"));
|
|
141
142
|
if (!e?.last4) return n;
|
|
142
143
|
let r = t.t("paymentMethods.cardLabel", {
|
|
143
144
|
brand: n,
|
|
144
145
|
last4: e.last4
|
|
145
|
-
}), i =
|
|
146
|
+
}), i = Ee(e);
|
|
146
147
|
return i ? `${r} · ${i}` : r;
|
|
147
148
|
}
|
|
148
|
-
function
|
|
149
|
+
function Ee(e) {
|
|
149
150
|
return !e?.exp_month || !e.exp_year ? null : `${String(e.exp_month).padStart(2, "0")}/${String(e.exp_year).slice(-2)}`;
|
|
150
151
|
}
|
|
151
|
-
var
|
|
152
|
+
var De = /* @__PURE__ */ new Set([
|
|
152
153
|
"active",
|
|
153
154
|
"pending",
|
|
154
155
|
"past_due",
|
|
155
156
|
"awaiting_method",
|
|
156
157
|
"unverified"
|
|
157
|
-
]),
|
|
158
|
+
]), Oe = (e) => !!e && new Date(e).getTime() > Date.now(), G = (e) => De.has(e.status) || e.status === "canceled" && !!e.access && (!e.access.ends_at || Oe(e.access.ends_at)), ke = (e) => G(e) && (!!e.cancel_scheduled || e.status === "canceled"), Ae = {
|
|
158
159
|
active: "success",
|
|
159
160
|
succeeded: "success",
|
|
160
161
|
paid: "success",
|
|
@@ -170,119 +171,119 @@ var Te = /* @__PURE__ */ new Set([
|
|
|
170
171
|
expired: "destructive",
|
|
171
172
|
canceled: "neutral",
|
|
172
173
|
refunded: "neutral"
|
|
173
|
-
},
|
|
174
|
+
}, je = (e) => Ae[e] ?? "neutral", K = "[&_h2]:m-0 [&_p]:m-0 [&_ul]:m-0 [&_ul]:list-none [&_ul]:p-0 [&_table]:border-spacing-0";
|
|
174
175
|
//#endregion
|
|
175
176
|
//#region src/components/ui/card.tsx
|
|
176
|
-
function
|
|
177
|
-
return /* @__PURE__ */
|
|
177
|
+
function Me({ className: e, size: t = "default", ...n }) {
|
|
178
|
+
return /* @__PURE__ */ I("div", {
|
|
178
179
|
"data-slot": "card",
|
|
179
180
|
"data-size": t,
|
|
180
|
-
className:
|
|
181
|
+
className: R("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
182
|
...n
|
|
182
183
|
});
|
|
183
184
|
}
|
|
184
|
-
function
|
|
185
|
-
return /* @__PURE__ */
|
|
185
|
+
function q({ className: e, ...t }) {
|
|
186
|
+
return /* @__PURE__ */ I("div", {
|
|
186
187
|
"data-slot": "card-header",
|
|
187
|
-
className:
|
|
188
|
+
className: R("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
189
|
...t
|
|
189
190
|
});
|
|
190
191
|
}
|
|
191
|
-
function
|
|
192
|
-
return /* @__PURE__ */
|
|
192
|
+
function Ne({ className: e, ...t }) {
|
|
193
|
+
return /* @__PURE__ */ I("div", {
|
|
193
194
|
"data-slot": "card-title",
|
|
194
|
-
className:
|
|
195
|
+
className: R("text-base leading-normal font-medium group-data-[size=sm]/card:text-sm", e),
|
|
195
196
|
...t
|
|
196
197
|
});
|
|
197
198
|
}
|
|
198
|
-
function
|
|
199
|
-
return /* @__PURE__ */
|
|
199
|
+
function Pe({ className: e, ...t }) {
|
|
200
|
+
return /* @__PURE__ */ I("div", {
|
|
200
201
|
"data-slot": "card-description",
|
|
201
|
-
className:
|
|
202
|
+
className: R("text-sm text-muted-foreground", e),
|
|
202
203
|
...t
|
|
203
204
|
});
|
|
204
205
|
}
|
|
205
|
-
function
|
|
206
|
-
return /* @__PURE__ */
|
|
206
|
+
function Fe({ className: e, ...t }) {
|
|
207
|
+
return /* @__PURE__ */ I("div", {
|
|
207
208
|
"data-slot": "card-action",
|
|
208
|
-
className:
|
|
209
|
+
className: R("col-start-2 row-span-2 row-start-1 self-start justify-self-end", e),
|
|
209
210
|
...t
|
|
210
211
|
});
|
|
211
212
|
}
|
|
212
|
-
function
|
|
213
|
-
return /* @__PURE__ */
|
|
213
|
+
function Ie({ className: e, ...t }) {
|
|
214
|
+
return /* @__PURE__ */ I("div", {
|
|
214
215
|
"data-slot": "card-content",
|
|
215
|
-
className:
|
|
216
|
+
className: R("flex flex-col gap-3 px-(--card-spacing)", e),
|
|
216
217
|
...t
|
|
217
218
|
});
|
|
218
219
|
}
|
|
219
220
|
//#endregion
|
|
220
221
|
//#region src/components/ui/skeleton.tsx
|
|
221
222
|
function J({ className: e, ...t }) {
|
|
222
|
-
return /* @__PURE__ */
|
|
223
|
+
return /* @__PURE__ */ I("div", {
|
|
223
224
|
"data-slot": "skeleton",
|
|
224
|
-
className:
|
|
225
|
+
className: R("animate-pulse rounded-md bg-muted", e),
|
|
225
226
|
...t
|
|
226
227
|
});
|
|
227
228
|
}
|
|
228
229
|
//#endregion
|
|
229
230
|
//#region src/account/section.tsx
|
|
230
|
-
function
|
|
231
|
-
let s = x(r), c =
|
|
232
|
-
return /* @__PURE__ */
|
|
231
|
+
function Le({ title: e, description: t, action: n, appearance: r, className: i, children: a, ...o }) {
|
|
232
|
+
let s = x(r), c = P.useId();
|
|
233
|
+
return /* @__PURE__ */ I("section", {
|
|
233
234
|
"aria-labelledby": c,
|
|
234
|
-
className:
|
|
235
|
+
className: R(s.className, K, "block", i),
|
|
235
236
|
"data-orck-theme": s["data-orck-theme"],
|
|
236
237
|
style: s.style,
|
|
237
238
|
"data-testid": o["data-testid"],
|
|
238
|
-
children: /* @__PURE__ */
|
|
239
|
+
children: /* @__PURE__ */ L(Me, {
|
|
239
240
|
className: "gap-4 bg-card text-card-foreground",
|
|
240
|
-
children: [/* @__PURE__ */
|
|
241
|
-
/* @__PURE__ */
|
|
241
|
+
children: [/* @__PURE__ */ L(q, { children: [
|
|
242
|
+
/* @__PURE__ */ I(Ne, {
|
|
242
243
|
id: c,
|
|
243
244
|
role: "heading",
|
|
244
245
|
"aria-level": 2,
|
|
245
246
|
children: e
|
|
246
247
|
}),
|
|
247
|
-
t ? /* @__PURE__ */
|
|
248
|
-
n ? /* @__PURE__ */
|
|
249
|
-
] }), /* @__PURE__ */
|
|
248
|
+
t ? /* @__PURE__ */ I(Pe, { children: t }) : null,
|
|
249
|
+
n ? /* @__PURE__ */ I(Fe, { children: n }) : null
|
|
250
|
+
] }), /* @__PURE__ */ I(Ie, {
|
|
250
251
|
className: "gap-0",
|
|
251
252
|
children: a
|
|
252
253
|
})]
|
|
253
254
|
})
|
|
254
255
|
});
|
|
255
256
|
}
|
|
256
|
-
function
|
|
257
|
-
return /* @__PURE__ */
|
|
257
|
+
function Re({ rows: e = 2 }) {
|
|
258
|
+
return /* @__PURE__ */ I("div", {
|
|
258
259
|
className: "grid gap-4 py-2",
|
|
259
260
|
"aria-hidden": !0,
|
|
260
|
-
children: Array.from({ length: e }, (e, t) => /* @__PURE__ */
|
|
261
|
+
children: Array.from({ length: e }, (e, t) => /* @__PURE__ */ L("div", {
|
|
261
262
|
className: "flex items-center gap-3",
|
|
262
263
|
children: [
|
|
263
|
-
/* @__PURE__ */
|
|
264
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ I(J, { className: "h-7 w-11 rounded-md" }),
|
|
265
|
+
/* @__PURE__ */ L("div", {
|
|
265
266
|
className: "grid flex-1 gap-2",
|
|
266
|
-
children: [/* @__PURE__ */
|
|
267
|
+
children: [/* @__PURE__ */ I(J, { className: "h-3.5 w-40" }), /* @__PURE__ */ I(J, { className: "h-3 w-28" })]
|
|
267
268
|
}),
|
|
268
|
-
/* @__PURE__ */
|
|
269
|
+
/* @__PURE__ */ I(J, { className: "h-3.5 w-14" })
|
|
269
270
|
]
|
|
270
271
|
}, t))
|
|
271
272
|
});
|
|
272
273
|
}
|
|
273
|
-
function
|
|
274
|
-
return /* @__PURE__ */
|
|
274
|
+
function ze({ title: e, description: t, action: n }) {
|
|
275
|
+
return /* @__PURE__ */ L("div", {
|
|
275
276
|
className: "grid justify-items-center gap-1 rounded-lg border border-dashed px-4 py-8 text-center",
|
|
276
277
|
children: [
|
|
277
|
-
/* @__PURE__ */
|
|
278
|
+
/* @__PURE__ */ I("p", {
|
|
278
279
|
className: "text-sm font-medium",
|
|
279
280
|
children: e
|
|
280
281
|
}),
|
|
281
|
-
t ? /* @__PURE__ */
|
|
282
|
+
t ? /* @__PURE__ */ I("p", {
|
|
282
283
|
className: "text-sm text-muted-foreground",
|
|
283
284
|
children: t
|
|
284
285
|
}) : null,
|
|
285
|
-
n ? /* @__PURE__ */
|
|
286
|
+
n ? /* @__PURE__ */ I("div", {
|
|
286
287
|
className: "mt-3",
|
|
287
288
|
children: n
|
|
288
289
|
}) : null
|
|
@@ -291,13 +292,13 @@ function Re({ title: e, description: t, action: n }) {
|
|
|
291
292
|
}
|
|
292
293
|
function Y({ error: e, message: t, onRetry: n }) {
|
|
293
294
|
let r = S();
|
|
294
|
-
return /* @__PURE__ */
|
|
295
|
+
return /* @__PURE__ */ L("div", {
|
|
295
296
|
role: "alert",
|
|
296
297
|
className: "flex flex-wrap items-center justify-between gap-3 rounded-lg bg-destructive/5 px-4 py-3",
|
|
297
|
-
children: [/* @__PURE__ */
|
|
298
|
+
children: [/* @__PURE__ */ I("p", {
|
|
298
299
|
className: "text-sm text-destructive",
|
|
299
300
|
children: t ?? r.error(e)
|
|
300
|
-
}), /* @__PURE__ */
|
|
301
|
+
}), /* @__PURE__ */ I(U, {
|
|
301
302
|
variant: "outline",
|
|
302
303
|
size: "sm",
|
|
303
304
|
onClick: n,
|
|
@@ -307,7 +308,7 @@ function Y({ error: e, message: t, onRetry: n }) {
|
|
|
307
308
|
}
|
|
308
309
|
//#endregion
|
|
309
310
|
//#region src/components/ui/badge.tsx
|
|
310
|
-
var
|
|
311
|
+
var Be = z("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
312
|
variants: { variant: {
|
|
312
313
|
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
313
314
|
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
@@ -318,10 +319,10 @@ var ze = ae("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-cen
|
|
|
318
319
|
} },
|
|
319
320
|
defaultVariants: { variant: "default" }
|
|
320
321
|
});
|
|
321
|
-
function
|
|
322
|
-
return
|
|
322
|
+
function Ve({ className: e, variant: t = "default", render: n, ...r }) {
|
|
323
|
+
return oe({
|
|
323
324
|
defaultTagName: "span",
|
|
324
|
-
props:
|
|
325
|
+
props: ae({ className: R(Be({ variant: t }), e) }, r),
|
|
325
326
|
render: n,
|
|
326
327
|
state: {
|
|
327
328
|
slot: "badge",
|
|
@@ -331,123 +332,123 @@ function Be({ className: e, variant: t = "default", render: n, ...r }) {
|
|
|
331
332
|
}
|
|
332
333
|
//#endregion
|
|
333
334
|
//#region src/account/status-badge.tsx
|
|
334
|
-
var
|
|
335
|
+
var He = {
|
|
335
336
|
success: "bg-[color:var(--orck-success)]/12 text-[color:var(--orck-success)]",
|
|
336
337
|
warning: "bg-[color:var(--orck-warning)]/14 text-[color:var(--orck-warning)]",
|
|
337
338
|
destructive: "bg-destructive/10 text-destructive",
|
|
338
339
|
neutral: "bg-muted text-muted-foreground"
|
|
339
340
|
};
|
|
340
|
-
function
|
|
341
|
+
function Ue({ status: e, label: t, className: n }) {
|
|
341
342
|
let { t: r, messages: i } = S(), a = e, o = t ?? (a in i.status ? r(`status.${a}`) : e.replace(/_/g, " "));
|
|
342
|
-
return /* @__PURE__ */
|
|
343
|
+
return /* @__PURE__ */ I(Ve, {
|
|
343
344
|
"data-status": e,
|
|
344
|
-
className:
|
|
345
|
+
className: R(He[je(e)], "font-medium", n),
|
|
345
346
|
children: o
|
|
346
347
|
});
|
|
347
348
|
}
|
|
348
349
|
//#endregion
|
|
349
350
|
//#region src/account/payment-history.tsx
|
|
350
|
-
function
|
|
351
|
-
if (e.card?.last4) return
|
|
351
|
+
function We(e, t) {
|
|
352
|
+
if (e.card?.last4) return Te(e.card, t);
|
|
352
353
|
let n = e.rail ?? "";
|
|
353
354
|
return n in t.messages.history.rail ? t.t(`history.rail.${n}`) : n || t.t("common.notAvailable");
|
|
354
355
|
}
|
|
355
|
-
function
|
|
356
|
-
let r = S(), { t: i } = r, { locale: a } =
|
|
357
|
-
c = l === null && o.error ? /* @__PURE__ */
|
|
356
|
+
function Ge({ appearance: e, className: t, ...n }) {
|
|
357
|
+
let r = S(), { t: i } = r, { locale: a } = k(), o = D(n), s = O(), c, l = o.payments;
|
|
358
|
+
c = l === null && o.error ? /* @__PURE__ */ I(Y, {
|
|
358
359
|
error: o.error,
|
|
359
360
|
onRetry: o.refetch
|
|
360
|
-
}) : l === null ? /* @__PURE__ */
|
|
361
|
+
}) : l === null ? /* @__PURE__ */ I(Re, { rows: 3 }) : l.length === 0 && o.page === 0 ? /* @__PURE__ */ I(ze, {
|
|
361
362
|
title: i("history.empty"),
|
|
362
363
|
description: i("history.emptyDescription")
|
|
363
|
-
}) : /* @__PURE__ */
|
|
364
|
+
}) : /* @__PURE__ */ I("div", {
|
|
364
365
|
className: "-mx-1 overflow-x-auto px-1",
|
|
365
|
-
children: /* @__PURE__ */
|
|
366
|
-
className:
|
|
366
|
+
children: /* @__PURE__ */ L("table", {
|
|
367
|
+
className: R("w-full border-collapse text-sm", o.loading && "opacity-60 transition-opacity"),
|
|
367
368
|
"aria-busy": o.loading || void 0,
|
|
368
|
-
children: [/* @__PURE__ */
|
|
369
|
+
children: [/* @__PURE__ */ I("thead", { children: /* @__PURE__ */ L("tr", {
|
|
369
370
|
className: "border-b text-left text-xs text-muted-foreground",
|
|
370
371
|
children: [
|
|
371
|
-
/* @__PURE__ */
|
|
372
|
+
/* @__PURE__ */ I("th", {
|
|
372
373
|
scope: "col",
|
|
373
374
|
className: "hidden py-2 pr-3 font-medium @md:table-cell",
|
|
374
375
|
children: i("history.date")
|
|
375
376
|
}),
|
|
376
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ I("th", {
|
|
377
378
|
scope: "col",
|
|
378
379
|
className: "py-2 pr-3 font-medium",
|
|
379
380
|
children: i("history.item")
|
|
380
381
|
}),
|
|
381
|
-
/* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ I("th", {
|
|
382
383
|
scope: "col",
|
|
383
384
|
className: "hidden py-2 pr-3 font-medium @md:table-cell",
|
|
384
385
|
children: i("history.method")
|
|
385
386
|
}),
|
|
386
|
-
/* @__PURE__ */
|
|
387
|
+
/* @__PURE__ */ I("th", {
|
|
387
388
|
scope: "col",
|
|
388
389
|
className: "py-2 pr-3 font-medium",
|
|
389
390
|
children: i("history.status")
|
|
390
391
|
}),
|
|
391
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ I("th", {
|
|
392
393
|
scope: "col",
|
|
393
394
|
className: "py-2 text-right font-medium",
|
|
394
395
|
children: i("history.amount")
|
|
395
396
|
})
|
|
396
397
|
]
|
|
397
|
-
}) }), /* @__PURE__ */
|
|
398
|
+
}) }), /* @__PURE__ */ I("tbody", {
|
|
398
399
|
className: "divide-y divide-border",
|
|
399
400
|
children: l.map((e) => {
|
|
400
|
-
let t = e.kind === "refund", n = e.status || (t ? "refunded" : "unknown"), c =
|
|
401
|
-
return /* @__PURE__ */
|
|
401
|
+
let t = e.kind === "refund", n = e.status || (t ? "refunded" : "unknown"), c = be(e.amount, e.currency, s, a), l = !t && e.amount_refunded && e.amount_refunded !== "0" ? be(e.amount_refunded, e.currency, s, a) : null, u = ye(e.created_at, a) ?? i("common.notAvailable"), d = Ce(e, e.order_id ? o.orders[e.order_id] : void 0, r);
|
|
402
|
+
return /* @__PURE__ */ L("tr", {
|
|
402
403
|
"data-testid": "payment-row",
|
|
403
404
|
"data-payment-id": e.id,
|
|
404
405
|
children: [
|
|
405
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ I("td", {
|
|
406
407
|
className: "hidden py-3 pr-3 align-top whitespace-nowrap tabular-nums @md:table-cell",
|
|
407
408
|
children: u
|
|
408
409
|
}),
|
|
409
|
-
/* @__PURE__ */
|
|
410
|
+
/* @__PURE__ */ L("td", {
|
|
410
411
|
className: "py-3 pr-3 align-top",
|
|
411
412
|
children: [
|
|
412
|
-
/* @__PURE__ */
|
|
413
|
+
/* @__PURE__ */ I("div", {
|
|
413
414
|
"data-testid": "payment-item",
|
|
414
415
|
className: "font-medium",
|
|
415
416
|
children: d.name
|
|
416
417
|
}),
|
|
417
|
-
e.status === "failed" && e.failure?.message ? /* @__PURE__ */
|
|
418
|
+
e.status === "failed" && e.failure?.message ? /* @__PURE__ */ I("div", {
|
|
418
419
|
"data-testid": "payment-failure",
|
|
419
420
|
className: "text-xs text-destructive",
|
|
420
421
|
children: e.failure.message
|
|
421
422
|
}) : null,
|
|
422
|
-
d.detail ? /* @__PURE__ */
|
|
423
|
+
d.detail ? /* @__PURE__ */ I("div", {
|
|
423
424
|
"data-testid": "payment-period",
|
|
424
425
|
className: "text-xs text-muted-foreground",
|
|
425
426
|
children: d.detail
|
|
426
427
|
}) : null,
|
|
427
|
-
/* @__PURE__ */
|
|
428
|
+
/* @__PURE__ */ L("div", {
|
|
428
429
|
className: "text-xs text-muted-foreground tabular-nums @md:hidden",
|
|
429
430
|
children: [
|
|
430
431
|
u,
|
|
431
432
|
" · ",
|
|
432
|
-
|
|
433
|
+
We(e, r)
|
|
433
434
|
]
|
|
434
435
|
})
|
|
435
436
|
]
|
|
436
437
|
}),
|
|
437
|
-
/* @__PURE__ */
|
|
438
|
+
/* @__PURE__ */ I("td", {
|
|
438
439
|
className: "hidden py-3 pr-3 align-top text-muted-foreground tabular-nums @md:table-cell",
|
|
439
|
-
children:
|
|
440
|
+
children: We(e, r)
|
|
440
441
|
}),
|
|
441
|
-
/* @__PURE__ */
|
|
442
|
+
/* @__PURE__ */ I("td", {
|
|
442
443
|
className: "py-3 pr-3 align-top",
|
|
443
|
-
children: /* @__PURE__ */
|
|
444
|
+
children: /* @__PURE__ */ I(Ue, {
|
|
444
445
|
status: n,
|
|
445
446
|
label: t ? i("history.refund") : void 0
|
|
446
447
|
})
|
|
447
448
|
}),
|
|
448
|
-
/* @__PURE__ */
|
|
449
|
+
/* @__PURE__ */ L("td", {
|
|
449
450
|
className: "py-3 text-right align-top font-medium whitespace-nowrap tabular-nums",
|
|
450
|
-
children: [c ?? i("common.notAvailable"), l ? /* @__PURE__ */
|
|
451
|
+
children: [c ?? i("common.notAvailable"), l ? /* @__PURE__ */ I("div", {
|
|
451
452
|
className: "text-xs font-normal text-muted-foreground",
|
|
452
453
|
children: i("history.refundedAmount", { amount: l })
|
|
453
454
|
}) : null]
|
|
@@ -459,7 +460,7 @@ function We({ appearance: e, className: t, ...n }) {
|
|
|
459
460
|
})
|
|
460
461
|
});
|
|
461
462
|
let u = o.page > 0 || o.hasMore;
|
|
462
|
-
return /* @__PURE__ */
|
|
463
|
+
return /* @__PURE__ */ L(Le, {
|
|
463
464
|
title: i("history.title"),
|
|
464
465
|
description: i("history.description"),
|
|
465
466
|
appearance: e,
|
|
@@ -467,28 +468,28 @@ function We({ appearance: e, className: t, ...n }) {
|
|
|
467
468
|
"data-testid": "payment-history",
|
|
468
469
|
children: [
|
|
469
470
|
c,
|
|
470
|
-
l !== null && o.error ? /* @__PURE__ */
|
|
471
|
+
l !== null && o.error ? /* @__PURE__ */ I("div", {
|
|
471
472
|
className: "pt-3",
|
|
472
|
-
children: /* @__PURE__ */
|
|
473
|
+
children: /* @__PURE__ */ I(Y, {
|
|
473
474
|
error: o.error,
|
|
474
475
|
onRetry: o.refetch
|
|
475
476
|
})
|
|
476
477
|
}) : null,
|
|
477
|
-
u ? /* @__PURE__ */
|
|
478
|
+
u ? /* @__PURE__ */ L("nav", {
|
|
478
479
|
"aria-label": i("history.title"),
|
|
479
480
|
className: "flex items-center justify-between gap-3 pt-4",
|
|
480
|
-
children: [/* @__PURE__ */
|
|
481
|
+
children: [/* @__PURE__ */ I("span", {
|
|
481
482
|
className: "text-xs text-muted-foreground tabular-nums",
|
|
482
483
|
children: i("history.page", { page: o.page + 1 })
|
|
483
|
-
}), /* @__PURE__ */
|
|
484
|
+
}), /* @__PURE__ */ L("div", {
|
|
484
485
|
className: "flex gap-2",
|
|
485
|
-
children: [/* @__PURE__ */
|
|
486
|
+
children: [/* @__PURE__ */ I(U, {
|
|
486
487
|
variant: "outline",
|
|
487
488
|
size: "sm",
|
|
488
489
|
disabled: o.page === 0 || o.loading,
|
|
489
490
|
onClick: o.previous,
|
|
490
491
|
children: i("common.previous")
|
|
491
|
-
}), /* @__PURE__ */
|
|
492
|
+
}), /* @__PURE__ */ I(U, {
|
|
492
493
|
variant: "outline",
|
|
493
494
|
size: "sm",
|
|
494
495
|
disabled: !o.hasMore || o.loading,
|
|
@@ -502,7 +503,7 @@ function We({ appearance: e, className: t, ...n }) {
|
|
|
502
503
|
}
|
|
503
504
|
//#endregion
|
|
504
505
|
//#region src/lib/card-brands.ts
|
|
505
|
-
var
|
|
506
|
+
var Ke = {
|
|
506
507
|
visa: "visa",
|
|
507
508
|
mastercard: "mastercard",
|
|
508
509
|
mc: "mastercard",
|
|
@@ -511,186 +512,186 @@ var Ge = {
|
|
|
511
512
|
americanexpress: "amex",
|
|
512
513
|
"american express": "amex"
|
|
513
514
|
};
|
|
514
|
-
function
|
|
515
|
+
function qe(e) {
|
|
515
516
|
let t = e?.trim().toLowerCase().replace(/[^a-z ]/g, "");
|
|
516
|
-
return t ?
|
|
517
|
+
return t ? Ke[t] : void 0;
|
|
517
518
|
}
|
|
518
519
|
//#endregion
|
|
519
520
|
//#region src/components/card-brands.tsx
|
|
520
|
-
function
|
|
521
|
-
return /* @__PURE__ */
|
|
521
|
+
function Je() {
|
|
522
|
+
return /* @__PURE__ */ I("svg", {
|
|
522
523
|
viewBox: "0 0 1000 324.68",
|
|
523
524
|
className: "h-2.5 w-auto",
|
|
524
525
|
role: "presentation",
|
|
525
|
-
children: /* @__PURE__ */
|
|
526
|
+
children: /* @__PURE__ */ I("path", {
|
|
526
527
|
fill: "#1434cb",
|
|
527
528
|
d: "m651.19.5c-70.93,0-134.32,36.77-134.32,104.69,0,77.9,112.42,83.28,112.42,122.42,0,16.48-18.88,31.23-51.14,31.23-45.77,0-79.98-20.61-79.98-20.61l-14.64,68.55s39.41,17.41,91.73,17.41c77.55,0,138.58-38.57,138.58-107.66,0-82.32-112.89-87.54-112.89-123.86,0-12.91,15.5-27.05,47.66-27.05,36.29,0,65.89,14.99,65.89,14.99l14.33-66.2S696.61.5,651.18.5h0ZM2.22,5.5L.5,15.49s29.84,5.46,56.72,16.36c34.61,12.49,37.07,19.77,42.9,42.35l63.51,244.83h85.14L379.93,5.5h-84.94l-84.28,213.17-34.39-180.7c-3.15-20.68-19.13-32.48-38.68-32.48,0,0-135.41,0-135.41,0Zm411.87,0l-66.63,313.53h81L494.85,5.5h-80.76Zm451.76,0c-19.53,0-29.88,10.46-37.47,28.73l-118.67,284.8h84.94l16.43-47.47h103.48l9.99,47.47h74.95L934.12,5.5h-68.27Zm11.05,84.71l25.18,117.65h-67.45l42.28-117.65h0Z"
|
|
528
529
|
})
|
|
529
530
|
});
|
|
530
531
|
}
|
|
531
|
-
function
|
|
532
|
-
return /* @__PURE__ */
|
|
532
|
+
function Ye() {
|
|
533
|
+
return /* @__PURE__ */ I("svg", {
|
|
533
534
|
viewBox: "0 0 152.4 108",
|
|
534
535
|
className: "h-4 w-auto",
|
|
535
536
|
role: "presentation",
|
|
536
|
-
children: /* @__PURE__ */
|
|
537
|
+
children: /* @__PURE__ */ L("g", { children: [/* @__PURE__ */ I("rect", {
|
|
537
538
|
y: "0",
|
|
538
539
|
fill: "none",
|
|
539
540
|
width: "152.4",
|
|
540
541
|
height: "108"
|
|
541
|
-
}), /* @__PURE__ */
|
|
542
|
-
/* @__PURE__ */
|
|
542
|
+
}), /* @__PURE__ */ L("g", { children: [
|
|
543
|
+
/* @__PURE__ */ I("rect", {
|
|
543
544
|
x: "60.4",
|
|
544
545
|
y: "25.7",
|
|
545
546
|
fill: "#FF5F00",
|
|
546
547
|
width: "31.5",
|
|
547
548
|
height: "56.6"
|
|
548
549
|
}),
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
+
/* @__PURE__ */ I("path", {
|
|
550
551
|
fill: "#EB001B",
|
|
551
552
|
d: "M62.4,54c0-11,5.1-21.5,13.7-28.3c-15.6-12.3-38.3-9.6-50.6,6.1C13.3,47.4,16,70,31.7,82.3\n c13.1,10.3,31.4,10.3,44.5,0C67.5,75.5,62.4,65,62.4,54z"
|
|
552
553
|
}),
|
|
553
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__PURE__ */ I("path", {
|
|
554
555
|
fill: "#F79E1B",
|
|
555
556
|
d: "M134.4,54c0,19.9-16.1,36-36,36c-8.1,0-15.9-2.7-22.2-7.7c15.6-12.3,18.3-34.9,6-50.6c-1.8-2.2-3.8-4.3-6-6\n c15.6-12.3,38.3-9.6,50.5,6.1C131.7,38.1,134.4,45.9,134.4,54z"
|
|
556
557
|
})
|
|
557
558
|
] })] })
|
|
558
559
|
});
|
|
559
560
|
}
|
|
560
|
-
function
|
|
561
|
-
let e = `orck-amex-${
|
|
562
|
-
return /* @__PURE__ */
|
|
561
|
+
function Xe() {
|
|
562
|
+
let e = `orck-amex-${P.useId().replace(/[^a-zA-Z0-9-]/g, "")}`;
|
|
563
|
+
return /* @__PURE__ */ L("svg", {
|
|
563
564
|
viewBox: "0 0 300 300",
|
|
564
565
|
className: "h-full w-auto",
|
|
565
566
|
role: "presentation",
|
|
566
567
|
children: [
|
|
567
|
-
/* @__PURE__ */
|
|
568
|
+
/* @__PURE__ */ L("radialGradient", {
|
|
568
569
|
id: e,
|
|
569
570
|
cx: "57.3882",
|
|
570
571
|
cy: "57.021",
|
|
571
572
|
r: "264.5797",
|
|
572
573
|
gradientUnits: "userSpaceOnUse",
|
|
573
574
|
children: [
|
|
574
|
-
/* @__PURE__ */
|
|
575
|
+
/* @__PURE__ */ I("stop", {
|
|
575
576
|
offset: "0",
|
|
576
577
|
stopColor: "#9DD5F6"
|
|
577
578
|
}),
|
|
578
|
-
/* @__PURE__ */
|
|
579
|
+
/* @__PURE__ */ I("stop", {
|
|
579
580
|
offset: "0.0711",
|
|
580
581
|
stopColor: "#98D3F5"
|
|
581
582
|
}),
|
|
582
|
-
/* @__PURE__ */
|
|
583
|
+
/* @__PURE__ */ I("stop", {
|
|
583
584
|
offset: "0.1575",
|
|
584
585
|
stopColor: "#89CEF3"
|
|
585
586
|
}),
|
|
586
|
-
/* @__PURE__ */
|
|
587
|
+
/* @__PURE__ */ I("stop", {
|
|
587
588
|
offset: "0.2516",
|
|
588
589
|
stopColor: "#70C6EF"
|
|
589
590
|
}),
|
|
590
|
-
/* @__PURE__ */
|
|
591
|
+
/* @__PURE__ */ I("stop", {
|
|
591
592
|
offset: "0.3514",
|
|
592
593
|
stopColor: "#4EBBEA"
|
|
593
594
|
}),
|
|
594
|
-
/* @__PURE__ */
|
|
595
|
+
/* @__PURE__ */ I("stop", {
|
|
595
596
|
offset: "0.4546",
|
|
596
597
|
stopColor: "#23ADE3"
|
|
597
598
|
}),
|
|
598
|
-
/* @__PURE__ */
|
|
599
|
+
/* @__PURE__ */ I("stop", {
|
|
599
600
|
offset: "0.5",
|
|
600
601
|
stopColor: "#0DA6E0"
|
|
601
602
|
}),
|
|
602
|
-
/* @__PURE__ */
|
|
603
|
+
/* @__PURE__ */ I("stop", {
|
|
603
604
|
offset: "1",
|
|
604
605
|
stopColor: "#2E77BC"
|
|
605
606
|
})
|
|
606
607
|
]
|
|
607
608
|
}),
|
|
608
|
-
/* @__PURE__ */
|
|
609
|
+
/* @__PURE__ */ I("path", {
|
|
609
610
|
fill: `url(#${e})`,
|
|
610
611
|
d: "M289.584,7.598H7.639v282.966h281.945v-93.386c1.12-1.619,1.673-3.69,1.673-6.222\n c0-2.898-0.553-4.693-1.673-6.205"
|
|
611
612
|
}),
|
|
612
|
-
/* @__PURE__ */
|
|
613
|
-
/* @__PURE__ */
|
|
613
|
+
/* @__PURE__ */ I("g", {}),
|
|
614
|
+
/* @__PURE__ */ I("path", {
|
|
614
615
|
fill: "#FFFFFF",
|
|
615
616
|
d: "M33.053,130.042l-5.424-13.217l-5.393,13.217 M152.543,124.779c-1.089,0.661-2.377,0.683-3.92,0.683h-9.627\n v-7.364h9.758c1.381,0,2.822,0.062,3.758,0.598c1.028,0.483,1.664,1.511,1.664,2.931\n C154.176,123.076,153.571,124.242,152.543,124.779z M221.221,130.042l-5.484-13.217l-5.454,13.217H221.221z M93.201,144.348h-8.124\n l-0.03-25.966l-11.491,25.966h-6.958l-11.521-25.989v25.989H38.959l-3.045-7.395h-16.5l-3.076,7.395H7.731l14.191-33.154h11.774\n l13.478,31.39v-31.39h12.934l10.371,22.491l9.527-22.491h13.194V144.348z M125.58,144.348H99.107v-33.154h26.473v6.904h-18.548\n v5.976h18.103v6.796h-18.103v6.621h18.548V144.348z M162.906,120.123c0,5.286-3.528,8.017-5.584,8.837\n c1.734,0.66,3.215,1.826,3.92,2.792c1.119,1.649,1.312,3.122,1.312,6.083v6.513h-7.993l-0.03-4.181c0-1.995,0.191-4.864-1.251-6.459\n c-1.158-1.166-2.923-1.419-5.776-1.419h-8.507v12.059h-7.924v-33.154h18.227c4.05,0,7.034,0.107,9.596,1.588\n C161.403,114.263,162.906,116.425,162.906,120.123z M175.588,144.348h-8.086v-33.154h8.086V144.348z M269.396,144.348h-11.23\n l-15.021-24.884v24.884h-16.139l-3.084-7.395H207.46l-2.992,7.395h-9.273c-3.852,0-8.729-0.852-11.491-3.667\n c-2.785-2.815-4.234-6.628-4.234-12.657c0-4.917,0.866-9.412,4.272-12.964c2.562-2.646,6.574-3.866,12.035-3.866h7.672v7.104h-7.511\n c-2.892,0-4.525,0.43-6.098,1.964c-1.351,1.396-2.278,4.035-2.278,7.51c0,3.552,0.706,6.113,2.179,7.786\n c1.22,1.312,3.437,1.71,5.523,1.71h3.559l11.169-26.073h11.874l13.417,31.359v-31.359h12.066l13.93,23.09v-23.09h8.117V144.348z\n M7.639,150.86h13.54l3.053-7.364h6.835l3.045,7.364h26.641v-5.63l2.378,5.654h13.83l2.378-5.738v5.714h66.208l-0.031-12.088h1.281\n c0.897,0.031,1.159,0.114,1.159,1.595v10.493h34.243v-2.814c2.762,1.48,7.058,2.814,12.711,2.814h14.406l3.083-7.364h6.835\n l3.015,7.364h27.761v-6.995l4.204,6.995h22.246v-46.24h-22.016v5.461l-3.083-5.461H228.77v5.461l-2.831-5.461h-30.515\n c-5.108,0-9.598,0.713-13.225,2.7v-2.7h-21.058v2.7c-2.308-2.048-5.453-2.7-8.95-2.7H75.258l-5.162,11.943l-5.301-11.943H40.563\n v5.461l-2.662-5.461H17.235l-9.597,21.985V150.86z"
|
|
616
617
|
}),
|
|
617
|
-
/* @__PURE__ */
|
|
618
|
+
/* @__PURE__ */ I("path", {
|
|
618
619
|
fill: "#FFFFFF",
|
|
619
620
|
d: "M289.584,175.315h-14.443c-1.442,0-2.4,0.054-3.207,0.599c-0.836,0.537-1.158,1.334-1.158,2.386\n c0,1.251,0.706,2.102,1.733,2.47c0.836,0.291,1.734,0.376,3.054,0.376l4.295,0.115c4.334,0.107,7.227,0.852,8.991,2.669\n c0.321,0.253,0.514,0.537,0.735,0.821 M289.584,197.178c-1.925,2.815-5.676,4.242-10.754,4.242h-15.304v-7.111h15.242\n c1.512,0,2.57-0.199,3.207-0.821c0.552-0.513,0.937-1.258,0.937-2.163c0-0.966-0.385-1.733-0.968-2.193\n c-0.575-0.506-1.412-0.736-2.792-0.736c-7.441-0.253-16.724,0.23-16.724-10.264c0-4.81,3.054-9.873,11.37-9.873h15.785v-6.598\n h-14.666c-4.426,0-7.641,1.06-9.918,2.708v-2.708h-21.693c-3.469,0-7.541,0.86-9.467,2.708v-2.708h-38.738v2.708\n c-3.083-2.224-8.285-2.708-10.686-2.708h-25.552v2.708c-2.439-2.362-7.863-2.708-11.169-2.708h-28.597l-6.544,7.082l-6.129-7.082\n H63.706v46.272h41.914l6.743-7.194l6.352,7.194l25.836,0.023v-10.885h2.54c3.428,0.053,7.471-0.085,11.038-1.627v12.488h21.31\n v-12.06h1.028c1.312,0,1.441,0.054,1.441,1.365v10.694h64.736c4.11,0,8.406-1.052,10.785-2.961v2.961h20.534\n c4.273,0,8.446-0.599,11.621-2.133V197.178z M257.973,183.93c1.543,1.597,2.37,3.613,2.37,7.026c0,7.134-4.457,10.464-12.449,10.464\n h-15.435v-7.111h15.373c1.503,0,2.569-0.199,3.237-0.821c0.545-0.513,0.936-1.258,0.936-2.163c0-0.966-0.423-1.733-0.967-2.193\n c-0.606-0.506-1.442-0.736-2.822-0.736c-7.411-0.253-16.692,0.23-16.692-10.264c0-4.81,3.022-9.873,11.33-9.873h15.887v7.058\n h-14.537c-1.441,0-2.378,0.054-3.175,0.599c-0.868,0.537-1.19,1.334-1.19,2.386c0,1.251,0.737,2.102,1.734,2.47\n c0.836,0.291,1.734,0.376,3.084,0.376l4.266,0.115C253.225,181.368,256.178,182.112,257.973,183.93z M186.465,181.882\n c-1.06,0.629-2.371,0.683-3.913,0.683h-9.627v-7.448h9.758c1.411,0,2.823,0.03,3.782,0.599c1.027,0.537,1.641,1.564,1.641,2.983\n S187.492,181.261,186.465,181.882z M191.251,186.009c1.764,0.651,3.206,1.818,3.882,2.784c1.119,1.619,1.281,3.13,1.313,6.053v6.574\n h-7.956v-4.149c0-1.995,0.192-4.949-1.281-6.491c-1.158-1.188-2.923-1.472-5.814-1.472h-8.469v12.112h-7.963v-33.162h18.296\n c4.012,0,6.934,0.177,9.535,1.565c2.501,1.511,4.074,3.581,4.074,7.364C196.867,182.48,193.337,185.181,191.251,186.009z\n M201.262,168.258h26.449v6.858h-18.557v6.029h18.104v6.766h-18.104v6.598l18.557,0.03v6.881h-26.449V168.258z M147.795,183.562\n h-10.241v-8.445h10.333c2.861,0,4.847,1.166,4.847,4.066C152.734,182.051,150.84,183.562,147.795,183.562z M129.661,198.404\n l-12.167-13.508l12.167-13.079V198.404z M98.24,194.509H78.756v-6.598h17.398v-6.766H78.756v-6.029h19.868l8.668,9.664\n L98.24,194.509z M161.242,179.183c0,9.212-6.873,11.114-13.8,11.114h-9.888v11.123h-15.403l-9.758-10.978l-10.141,10.978h-31.39\n v-33.162h31.873l9.75,10.87l10.08-10.87h25.322C154.176,168.258,161.242,169.999,161.242,179.183z"
|
|
620
621
|
})
|
|
621
622
|
]
|
|
622
623
|
});
|
|
623
624
|
}
|
|
624
|
-
function
|
|
625
|
-
let r =
|
|
626
|
-
return /* @__PURE__ */
|
|
625
|
+
function Ze({ brand: e, fallback: t, className: n }) {
|
|
626
|
+
let r = qe(e);
|
|
627
|
+
return /* @__PURE__ */ I("span", {
|
|
627
628
|
"aria-hidden": !0,
|
|
628
|
-
className:
|
|
629
|
-
children: r === "visa" ? /* @__PURE__ */
|
|
629
|
+
className: R("grid h-7 w-11 shrink-0 place-items-center overflow-hidden rounded-md", r ? "bg-white" : "bg-muted text-[10px] font-semibold tracking-wide text-muted-foreground uppercase", n),
|
|
630
|
+
children: r === "visa" ? /* @__PURE__ */ I(Je, {}) : r === "mastercard" ? /* @__PURE__ */ I(Ye, {}) : r === "amex" ? /* @__PURE__ */ I(Xe, {}) : t
|
|
630
631
|
});
|
|
631
632
|
}
|
|
632
633
|
//#endregion
|
|
633
634
|
//#region src/components/ui/alert-dialog.tsx
|
|
634
|
-
function
|
|
635
|
-
return /* @__PURE__ */
|
|
635
|
+
function Qe({ ...e }) {
|
|
636
|
+
return /* @__PURE__ */ I(V.Root, {
|
|
636
637
|
"data-slot": "alert-dialog",
|
|
637
638
|
...e
|
|
638
639
|
});
|
|
639
640
|
}
|
|
640
|
-
function
|
|
641
|
-
return /* @__PURE__ */
|
|
641
|
+
function $e({ ...e }) {
|
|
642
|
+
return /* @__PURE__ */ I(V.Portal, {
|
|
642
643
|
"data-slot": "alert-dialog-portal",
|
|
643
644
|
...e
|
|
644
645
|
});
|
|
645
646
|
}
|
|
646
|
-
function
|
|
647
|
-
return /* @__PURE__ */
|
|
647
|
+
function et({ className: e, ...t }) {
|
|
648
|
+
return /* @__PURE__ */ I(V.Backdrop, {
|
|
648
649
|
"data-slot": "alert-dialog-overlay",
|
|
649
|
-
className:
|
|
650
|
+
className: R("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
651
|
...t
|
|
651
652
|
});
|
|
652
653
|
}
|
|
653
|
-
function
|
|
654
|
-
return /* @__PURE__ */
|
|
654
|
+
function tt({ className: e, size: t = "default", ...n }) {
|
|
655
|
+
return /* @__PURE__ */ L($e, { children: [/* @__PURE__ */ I(et, {}), /* @__PURE__ */ I(V.Popup, {
|
|
655
656
|
"data-slot": "alert-dialog-content",
|
|
656
657
|
"data-size": t,
|
|
657
|
-
className:
|
|
658
|
+
className: R("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
659
|
...n
|
|
659
660
|
})] });
|
|
660
661
|
}
|
|
661
|
-
function
|
|
662
|
-
return /* @__PURE__ */
|
|
662
|
+
function nt({ className: e, ...t }) {
|
|
663
|
+
return /* @__PURE__ */ I("div", {
|
|
663
664
|
"data-slot": "alert-dialog-header",
|
|
664
|
-
className:
|
|
665
|
+
className: R("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
666
|
...t
|
|
666
667
|
});
|
|
667
668
|
}
|
|
668
|
-
function
|
|
669
|
-
return /* @__PURE__ */
|
|
669
|
+
function rt({ className: e, ...t }) {
|
|
670
|
+
return /* @__PURE__ */ I("div", {
|
|
670
671
|
"data-slot": "alert-dialog-footer",
|
|
671
|
-
className:
|
|
672
|
+
className: R("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
673
|
...t
|
|
673
674
|
});
|
|
674
675
|
}
|
|
675
|
-
function
|
|
676
|
-
return /* @__PURE__ */
|
|
676
|
+
function it({ className: e, ...t }) {
|
|
677
|
+
return /* @__PURE__ */ I(V.Title, {
|
|
677
678
|
"data-slot": "alert-dialog-title",
|
|
678
|
-
className:
|
|
679
|
+
className: R("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
680
|
...t
|
|
680
681
|
});
|
|
681
682
|
}
|
|
682
|
-
function
|
|
683
|
-
return /* @__PURE__ */
|
|
683
|
+
function at({ className: e, ...t }) {
|
|
684
|
+
return /* @__PURE__ */ I(V.Description, {
|
|
684
685
|
"data-slot": "alert-dialog-description",
|
|
685
|
-
className:
|
|
686
|
+
className: R("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", e),
|
|
686
687
|
...t
|
|
687
688
|
});
|
|
688
689
|
}
|
|
689
|
-
function
|
|
690
|
-
return /* @__PURE__ */
|
|
690
|
+
function ot({ className: e, variant: t = "outline", size: n = "default", ...r }) {
|
|
691
|
+
return /* @__PURE__ */ I(V.Close, {
|
|
691
692
|
"data-slot": "alert-dialog-cancel",
|
|
692
|
-
className:
|
|
693
|
-
render: /* @__PURE__ */
|
|
693
|
+
className: R(e),
|
|
694
|
+
render: /* @__PURE__ */ I(U, {
|
|
694
695
|
variant: t,
|
|
695
696
|
size: n
|
|
696
697
|
}),
|
|
@@ -699,76 +700,76 @@ function at({ className: e, variant: t = "outline", size: n = "default", ...r })
|
|
|
699
700
|
}
|
|
700
701
|
//#endregion
|
|
701
702
|
//#region src/components/ui/dialog.tsx
|
|
702
|
-
function
|
|
703
|
-
return /* @__PURE__ */
|
|
703
|
+
function st({ ...e }) {
|
|
704
|
+
return /* @__PURE__ */ I(H.Root, {
|
|
704
705
|
"data-slot": "dialog",
|
|
705
706
|
...e
|
|
706
707
|
});
|
|
707
708
|
}
|
|
708
|
-
function
|
|
709
|
-
return /* @__PURE__ */
|
|
709
|
+
function ct({ ...e }) {
|
|
710
|
+
return /* @__PURE__ */ I(H.Portal, {
|
|
710
711
|
"data-slot": "dialog-portal",
|
|
711
712
|
...e
|
|
712
713
|
});
|
|
713
714
|
}
|
|
714
|
-
function
|
|
715
|
-
return /* @__PURE__ */
|
|
715
|
+
function lt({ className: e, ...t }) {
|
|
716
|
+
return /* @__PURE__ */ I(H.Backdrop, {
|
|
716
717
|
"data-slot": "dialog-overlay",
|
|
717
|
-
className:
|
|
718
|
+
className: R("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
719
|
...t
|
|
719
720
|
});
|
|
720
721
|
}
|
|
721
|
-
function
|
|
722
|
-
return /* @__PURE__ */
|
|
722
|
+
function ut({ className: e, children: t, showCloseButton: n = !0, ...r }) {
|
|
723
|
+
return /* @__PURE__ */ L(ct, { children: [/* @__PURE__ */ I(lt, {}), /* @__PURE__ */ L(H.Popup, {
|
|
723
724
|
"data-slot": "dialog-content",
|
|
724
|
-
className:
|
|
725
|
+
className: R("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
726
|
...r,
|
|
726
|
-
children: [t, n && /* @__PURE__ */
|
|
727
|
+
children: [t, n && /* @__PURE__ */ L(H.Close, {
|
|
727
728
|
"data-slot": "dialog-close",
|
|
728
|
-
render: /* @__PURE__ */
|
|
729
|
+
render: /* @__PURE__ */ I(U, {
|
|
729
730
|
variant: "ghost",
|
|
730
731
|
className: "absolute top-4 right-4",
|
|
731
732
|
size: "icon-sm"
|
|
732
733
|
}),
|
|
733
|
-
children: [/* @__PURE__ */
|
|
734
|
-
icon:
|
|
734
|
+
children: [/* @__PURE__ */ I(B, {
|
|
735
|
+
icon: le,
|
|
735
736
|
strokeWidth: 2
|
|
736
|
-
}), /* @__PURE__ */
|
|
737
|
+
}), /* @__PURE__ */ I("span", {
|
|
737
738
|
className: "sr-only",
|
|
738
739
|
children: "Close"
|
|
739
740
|
})]
|
|
740
741
|
})]
|
|
741
742
|
})] });
|
|
742
743
|
}
|
|
743
|
-
function
|
|
744
|
-
return /* @__PURE__ */
|
|
744
|
+
function dt({ className: e, ...t }) {
|
|
745
|
+
return /* @__PURE__ */ I("div", {
|
|
745
746
|
"data-slot": "dialog-header",
|
|
746
|
-
className:
|
|
747
|
+
className: R("flex flex-col gap-2", e),
|
|
747
748
|
...t
|
|
748
749
|
});
|
|
749
750
|
}
|
|
750
|
-
function
|
|
751
|
-
return /* @__PURE__ */
|
|
751
|
+
function ft({ className: e, showCloseButton: t = !1, children: n, ...r }) {
|
|
752
|
+
return /* @__PURE__ */ L("div", {
|
|
752
753
|
"data-slot": "dialog-footer",
|
|
753
|
-
className:
|
|
754
|
+
className: R("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", e),
|
|
754
755
|
...r,
|
|
755
|
-
children: [n, t && /* @__PURE__ */
|
|
756
|
-
render: /* @__PURE__ */
|
|
756
|
+
children: [n, t && /* @__PURE__ */ I(H.Close, {
|
|
757
|
+
render: /* @__PURE__ */ I(U, { variant: "outline" }),
|
|
757
758
|
children: "Close"
|
|
758
759
|
})]
|
|
759
760
|
});
|
|
760
761
|
}
|
|
761
|
-
function
|
|
762
|
-
return /* @__PURE__ */
|
|
762
|
+
function pt({ className: e, ...t }) {
|
|
763
|
+
return /* @__PURE__ */ I(H.Title, {
|
|
763
764
|
"data-slot": "dialog-title",
|
|
764
|
-
className:
|
|
765
|
+
className: R("leading-none font-medium", e),
|
|
765
766
|
...t
|
|
766
767
|
});
|
|
767
768
|
}
|
|
768
|
-
function
|
|
769
|
-
return /* @__PURE__ */
|
|
769
|
+
function mt({ className: e, ...t }) {
|
|
770
|
+
return /* @__PURE__ */ I(H.Description, {
|
|
770
771
|
"data-slot": "dialog-description",
|
|
771
|
-
className:
|
|
772
|
+
className: R("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", e),
|
|
772
773
|
...t
|
|
773
774
|
});
|
|
774
775
|
}
|
|
@@ -776,38 +777,38 @@ function pt({ className: e, ...t }) {
|
|
|
776
777
|
//#region src/components/ui/spinner.tsx
|
|
777
778
|
function X({ className: e, ...t }) {
|
|
778
779
|
let { t: n } = S();
|
|
779
|
-
return /* @__PURE__ */
|
|
780
|
+
return /* @__PURE__ */ I(B, {
|
|
780
781
|
icon: de,
|
|
781
782
|
strokeWidth: 2,
|
|
782
783
|
"data-slot": "spinner",
|
|
783
784
|
role: "status",
|
|
784
785
|
"aria-label": n("common.loading"),
|
|
785
|
-
className:
|
|
786
|
+
className: R("size-4 animate-spin", e),
|
|
786
787
|
...t
|
|
787
788
|
});
|
|
788
789
|
}
|
|
789
790
|
//#endregion
|
|
790
791
|
//#region src/components/ui/input.tsx
|
|
791
|
-
function
|
|
792
|
-
return /* @__PURE__ */
|
|
792
|
+
function ht({ className: e, type: t, ...n }) {
|
|
793
|
+
return /* @__PURE__ */ I(fe, {
|
|
793
794
|
type: t,
|
|
794
795
|
"data-slot": "input",
|
|
795
|
-
className:
|
|
796
|
+
className: R("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
797
|
...n
|
|
797
798
|
});
|
|
798
799
|
}
|
|
799
800
|
//#endregion
|
|
800
801
|
//#region src/components/ui/label.tsx
|
|
801
802
|
function Z({ className: e, ...t }) {
|
|
802
|
-
return /* @__PURE__ */
|
|
803
|
+
return /* @__PURE__ */ I("label", {
|
|
803
804
|
"data-slot": "label",
|
|
804
|
-
className:
|
|
805
|
+
className: R("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
806
|
...t
|
|
806
807
|
});
|
|
807
808
|
}
|
|
808
809
|
//#endregion
|
|
809
810
|
//#region src/lib/billing.ts
|
|
810
|
-
var
|
|
811
|
+
var gt = "AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW".split(" "), _t = /* @__PURE__ */ new Set(/* @__PURE__ */ "AE.AG.AO.AQ.AW.BF.BI.BJ.BO.BQ.BS.BV.BW.BZ.CF.CG.CI.CK.CM.CW.DM.ER.FJ.GA.GD.GM.GQ.JM.KM.KP.LY.ML.MR.QA.RW.SB.SC.SL.SO.SR.SS.ST.SX.SY.TD.TG.TK.TO.TV.UM.VU.YE.ZW".split(".")), vt = {
|
|
811
812
|
AR: "C1000",
|
|
812
813
|
BR: "01000-000",
|
|
813
814
|
CA: "A1A 1A1",
|
|
@@ -821,31 +822,31 @@ 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
|
|
|
821
822
|
MX: "01000",
|
|
822
823
|
PE: "15001",
|
|
823
824
|
US: "12345"
|
|
824
|
-
},
|
|
825
|
+
}, yt = new Intl.DisplayNames(["en"], { type: "region" }), bt = gt.map((e) => ({
|
|
825
826
|
code: e,
|
|
826
|
-
name:
|
|
827
|
-
})).sort((e, t) => e.name.localeCompare(t.name)),
|
|
828
|
-
function
|
|
827
|
+
name: yt.of(e) ?? e
|
|
828
|
+
})).sort((e, t) => e.name.localeCompare(t.name)), xt = N.string().trim().min(1, "Name on card is required").max(200, "Name on card is too long"), St = N.string().trim().regex(/^[A-Za-z]{2}$/, "Select a country").transform((e) => e.toUpperCase());
|
|
829
|
+
function Ct(e) {
|
|
829
830
|
let t = e.trim().toUpperCase();
|
|
830
|
-
return t === "" || !
|
|
831
|
+
return t === "" || !_t.has(t);
|
|
831
832
|
}
|
|
832
|
-
function
|
|
833
|
+
function wt(e, t) {
|
|
833
834
|
let n = e.trim().toUpperCase(), r = n === "US" ? "ZIP code" : n === "GB" || n === "AU" || n === "NZ" ? "Postcode" : "Postal code";
|
|
834
835
|
return {
|
|
835
836
|
label: t ? r : `${r} (optional)`,
|
|
836
|
-
placeholder:
|
|
837
|
+
placeholder: vt[n] ?? r,
|
|
837
838
|
inputMode: n === "US" ? "numeric" : "text",
|
|
838
839
|
pattern: n === "US" ? "[0-9]{5}(?:-[0-9]{4})?" : void 0
|
|
839
840
|
};
|
|
840
841
|
}
|
|
841
|
-
var
|
|
842
|
-
name_on_card:
|
|
843
|
-
country:
|
|
844
|
-
zip:
|
|
842
|
+
var Tt = N.object({
|
|
843
|
+
name_on_card: xt,
|
|
844
|
+
country: St,
|
|
845
|
+
zip: N.string().trim().max(32, "Postal code is too long")
|
|
845
846
|
}).superRefine((e, t) => {
|
|
846
|
-
|
|
847
|
+
Ct(e.country) && !e.zip && t.addIssue({
|
|
847
848
|
code: "custom",
|
|
848
|
-
message: `${
|
|
849
|
+
message: `${wt(e.country, !0).label} is required`,
|
|
849
850
|
path: ["zip"]
|
|
850
851
|
}), e.country === "US" && e.zip && !/^\d{5}(?:-\d{4})?$/.test(e.zip) && t.addIssue({
|
|
851
852
|
code: "custom",
|
|
@@ -853,7 +854,7 @@ var wt = M.object({
|
|
|
853
854
|
path: ["zip"]
|
|
854
855
|
});
|
|
855
856
|
});
|
|
856
|
-
function
|
|
857
|
+
function Et(e) {
|
|
857
858
|
let t = {
|
|
858
859
|
...e.zip ? { postal_code: e.zip } : {},
|
|
859
860
|
...e.country ? { country: e.country } : {}
|
|
@@ -864,12 +865,12 @@ function Tt(e) {
|
|
|
864
865
|
...Object.keys(t).length > 0 ? { address: t } : {}
|
|
865
866
|
};
|
|
866
867
|
}
|
|
867
|
-
var
|
|
868
|
+
var Dt = {
|
|
868
869
|
name_on_card: "",
|
|
869
870
|
country: "",
|
|
870
871
|
zip: ""
|
|
871
872
|
};
|
|
872
|
-
function
|
|
873
|
+
function Ot() {
|
|
873
874
|
try {
|
|
874
875
|
if (typeof navigator > "u" || !navigator.language) return "";
|
|
875
876
|
let e = new Intl.Locale(navigator.language).maximize().region;
|
|
@@ -878,27 +879,27 @@ function Dt() {
|
|
|
878
879
|
return "";
|
|
879
880
|
}
|
|
880
881
|
}
|
|
881
|
-
function
|
|
882
|
+
function kt(e) {
|
|
882
883
|
let t = e?.trim().toUpperCase() ?? "";
|
|
883
|
-
if (
|
|
884
|
-
let n =
|
|
885
|
-
return
|
|
884
|
+
if (bt.some((e) => e.code === t)) return t;
|
|
885
|
+
let n = Ot();
|
|
886
|
+
return bt.some((e) => e.code === n) ? n : "";
|
|
886
887
|
}
|
|
887
888
|
//#endregion
|
|
888
889
|
//#region src/components/billing-fields.tsx
|
|
889
|
-
var
|
|
890
|
-
function
|
|
891
|
-
return /* @__PURE__ */
|
|
890
|
+
var At = "text-[13px] font-medium text-foreground", jt = "h-[38px] rounded-[9px] border border-input bg-card text-sm text-foreground", Mt = `${jt} px-2.5`;
|
|
891
|
+
function Nt({ id: e, name: t, label: n, value: r, onChange: i, autoComplete: a, placeholder: o, disabled: s, maxLength: c, required: l, type: u, inputMode: d, pattern: f }) {
|
|
892
|
+
return /* @__PURE__ */ L("div", {
|
|
892
893
|
className: "grid gap-1.5",
|
|
893
|
-
children: [/* @__PURE__ */
|
|
894
|
+
children: [/* @__PURE__ */ I(Z, {
|
|
894
895
|
htmlFor: e,
|
|
895
|
-
className:
|
|
896
|
+
className: At,
|
|
896
897
|
children: n
|
|
897
|
-
}), /* @__PURE__ */
|
|
898
|
+
}), /* @__PURE__ */ I(ht, {
|
|
898
899
|
id: e,
|
|
899
900
|
name: t,
|
|
900
901
|
type: u,
|
|
901
|
-
className:
|
|
902
|
+
className: Mt,
|
|
902
903
|
value: r,
|
|
903
904
|
autoComplete: a,
|
|
904
905
|
placeholder: o,
|
|
@@ -911,37 +912,37 @@ function Mt({ id: e, name: t, label: n, value: r, onChange: i, autoComplete: a,
|
|
|
911
912
|
})]
|
|
912
913
|
});
|
|
913
914
|
}
|
|
914
|
-
function
|
|
915
|
-
return /* @__PURE__ */
|
|
915
|
+
function Pt({ id: e, value: t, onChange: n, disabled: r }) {
|
|
916
|
+
return /* @__PURE__ */ L("div", {
|
|
916
917
|
className: "grid gap-1.5",
|
|
917
|
-
children: [/* @__PURE__ */
|
|
918
|
+
children: [/* @__PURE__ */ I(Z, {
|
|
918
919
|
htmlFor: e,
|
|
919
|
-
className:
|
|
920
|
+
className: At,
|
|
920
921
|
children: "Country"
|
|
921
|
-
}), /* @__PURE__ */
|
|
922
|
+
}), /* @__PURE__ */ L("select", {
|
|
922
923
|
id: e,
|
|
923
924
|
name: "country",
|
|
924
|
-
className: `${
|
|
925
|
+
className: `${jt} w-full px-2.5`,
|
|
925
926
|
value: t,
|
|
926
927
|
autoComplete: "billing country",
|
|
927
928
|
disabled: r,
|
|
928
929
|
required: !0,
|
|
929
930
|
onChange: (e) => n(e.target.value),
|
|
930
|
-
children: [/* @__PURE__ */
|
|
931
|
+
children: [/* @__PURE__ */ I("option", {
|
|
931
932
|
value: "",
|
|
932
933
|
children: "Select country"
|
|
933
|
-
}),
|
|
934
|
+
}), bt.map((e) => /* @__PURE__ */ I("option", {
|
|
934
935
|
value: e.code,
|
|
935
936
|
children: e.name
|
|
936
937
|
}, e.code))]
|
|
937
938
|
})]
|
|
938
939
|
});
|
|
939
940
|
}
|
|
940
|
-
function
|
|
941
|
-
let s =
|
|
942
|
-
return /* @__PURE__ */
|
|
941
|
+
function Ft({ id: e, value: t, country: n, onChange: r, disabled: i, required: a, error: o }) {
|
|
942
|
+
let s = wt(n, a);
|
|
943
|
+
return /* @__PURE__ */ L("div", {
|
|
943
944
|
className: "grid gap-1.5",
|
|
944
|
-
children: [/* @__PURE__ */
|
|
945
|
+
children: [/* @__PURE__ */ I(Nt, {
|
|
945
946
|
id: e,
|
|
946
947
|
name: "zip",
|
|
947
948
|
label: s.label,
|
|
@@ -954,21 +955,21 @@ function Pt({ id: e, value: t, country: n, onChange: r, disabled: i, required: a
|
|
|
954
955
|
required: a,
|
|
955
956
|
inputMode: s.inputMode,
|
|
956
957
|
pattern: s.pattern
|
|
957
|
-
}), o ? /* @__PURE__ */
|
|
958
|
+
}), o ? /* @__PURE__ */ I("p", {
|
|
958
959
|
className: "text-[12.5px] text-destructive",
|
|
959
960
|
role: "alert",
|
|
960
961
|
children: o
|
|
961
962
|
}) : null]
|
|
962
963
|
});
|
|
963
964
|
}
|
|
964
|
-
function
|
|
965
|
+
function It({ idPrefix: e, value: t, onChange: n, disabled: r, postalError: i }) {
|
|
965
966
|
let a = (e) => (r) => n({
|
|
966
967
|
...t,
|
|
967
968
|
[e]: r
|
|
968
|
-
}), o =
|
|
969
|
-
return /* @__PURE__ */
|
|
969
|
+
}), o = Ct(t.country);
|
|
970
|
+
return /* @__PURE__ */ L("div", {
|
|
970
971
|
className: "grid gap-3",
|
|
971
|
-
children: [/* @__PURE__ */
|
|
972
|
+
children: [/* @__PURE__ */ I(Nt, {
|
|
972
973
|
id: `${e}-name-on-card`,
|
|
973
974
|
name: "name_on_card",
|
|
974
975
|
label: "Name on card",
|
|
@@ -979,14 +980,14 @@ function Ft({ idPrefix: e, value: t, onChange: n, disabled: r, postalError: i })
|
|
|
979
980
|
disabled: r,
|
|
980
981
|
maxLength: 200,
|
|
981
982
|
required: !0
|
|
982
|
-
}), /* @__PURE__ */
|
|
983
|
+
}), /* @__PURE__ */ L("div", {
|
|
983
984
|
className: "grid grid-cols-2 gap-3",
|
|
984
|
-
children: [/* @__PURE__ */
|
|
985
|
+
children: [/* @__PURE__ */ I(Pt, {
|
|
985
986
|
id: `${e}-country`,
|
|
986
987
|
value: t.country,
|
|
987
988
|
onChange: a("country"),
|
|
988
989
|
disabled: r
|
|
989
|
-
}), /* @__PURE__ */
|
|
990
|
+
}), /* @__PURE__ */ I(Ft, {
|
|
990
991
|
id: `${e}-postal-code`,
|
|
991
992
|
value: t.zip,
|
|
992
993
|
country: t.country,
|
|
@@ -1000,105 +1001,105 @@ function Ft({ idPrefix: e, value: t, onChange: n, disabled: r, postalError: i })
|
|
|
1000
1001
|
}
|
|
1001
1002
|
//#endregion
|
|
1002
1003
|
//#region src/components/card-fields.tsx
|
|
1003
|
-
function
|
|
1004
|
-
return t ? /* @__PURE__ */
|
|
1004
|
+
function Lt({ id: e, message: t }) {
|
|
1005
|
+
return t ? /* @__PURE__ */ I("p", {
|
|
1005
1006
|
id: e,
|
|
1006
1007
|
className: "text-[12.5px] text-destructive",
|
|
1007
1008
|
role: "alert",
|
|
1008
1009
|
children: t
|
|
1009
1010
|
}) : null;
|
|
1010
1011
|
}
|
|
1011
|
-
var
|
|
1012
|
-
function
|
|
1013
|
-
return /* @__PURE__ */
|
|
1014
|
-
className:
|
|
1012
|
+
var Rt = "orck-collect-field h-[38px] overflow-hidden rounded-[9px] border border-[color:var(--border)] bg-card px-[3px]", zt = "flex h-[38px] items-center rounded-[9px] border border-[color:var(--border)] bg-card px-[11px] text-sm text-[color:var(--orck-faint)] tabular-nums";
|
|
1013
|
+
function Bt({ ids: e, preview: t, error: n, fieldErrors: r = {}, hidden: i }) {
|
|
1014
|
+
return /* @__PURE__ */ L("div", {
|
|
1015
|
+
className: R("grid gap-3", i && "hidden"),
|
|
1015
1016
|
"aria-hidden": i || void 0,
|
|
1016
1017
|
children: [
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
+
/* @__PURE__ */ L("div", {
|
|
1018
1019
|
className: "grid gap-1.5",
|
|
1019
1020
|
children: [
|
|
1020
|
-
/* @__PURE__ */
|
|
1021
|
+
/* @__PURE__ */ I(Z, {
|
|
1021
1022
|
htmlFor: e.number,
|
|
1022
1023
|
className: "text-[13px] font-medium text-foreground",
|
|
1023
1024
|
children: "Card number"
|
|
1024
1025
|
}),
|
|
1025
|
-
t ? /* @__PURE__ */
|
|
1026
|
+
t ? /* @__PURE__ */ I("div", {
|
|
1026
1027
|
id: e.number,
|
|
1027
|
-
className:
|
|
1028
|
+
className: zt,
|
|
1028
1029
|
children: "1234 1234 1234 1234"
|
|
1029
|
-
}) : /* @__PURE__ */
|
|
1030
|
+
}) : /* @__PURE__ */ I("div", {
|
|
1030
1031
|
id: e.number,
|
|
1031
|
-
className:
|
|
1032
|
+
className: R(Rt, r.number && "border-destructive")
|
|
1032
1033
|
}),
|
|
1033
|
-
/* @__PURE__ */
|
|
1034
|
+
/* @__PURE__ */ I(Lt, {
|
|
1034
1035
|
id: `${e.number}-error`,
|
|
1035
1036
|
message: r.number
|
|
1036
1037
|
})
|
|
1037
1038
|
]
|
|
1038
1039
|
}),
|
|
1039
|
-
/* @__PURE__ */
|
|
1040
|
+
/* @__PURE__ */ L("div", {
|
|
1040
1041
|
className: "grid grid-cols-2 gap-3",
|
|
1041
|
-
children: [/* @__PURE__ */
|
|
1042
|
+
children: [/* @__PURE__ */ L("div", {
|
|
1042
1043
|
className: "grid gap-1.5",
|
|
1043
1044
|
children: [
|
|
1044
|
-
/* @__PURE__ */
|
|
1045
|
+
/* @__PURE__ */ I(Z, {
|
|
1045
1046
|
htmlFor: e.expiry,
|
|
1046
1047
|
className: "text-[13px] font-medium text-foreground",
|
|
1047
1048
|
children: "Expiry"
|
|
1048
1049
|
}),
|
|
1049
|
-
t ? /* @__PURE__ */
|
|
1050
|
+
t ? /* @__PURE__ */ I("div", {
|
|
1050
1051
|
id: e.expiry,
|
|
1051
|
-
className:
|
|
1052
|
+
className: zt,
|
|
1052
1053
|
children: "MM / YY"
|
|
1053
|
-
}) : /* @__PURE__ */
|
|
1054
|
+
}) : /* @__PURE__ */ I("div", {
|
|
1054
1055
|
id: e.expiry,
|
|
1055
|
-
className:
|
|
1056
|
+
className: R(Rt, r.expiry && "border-destructive")
|
|
1056
1057
|
}),
|
|
1057
|
-
/* @__PURE__ */
|
|
1058
|
+
/* @__PURE__ */ I(Lt, {
|
|
1058
1059
|
id: `${e.expiry}-error`,
|
|
1059
1060
|
message: r.expiry
|
|
1060
1061
|
})
|
|
1061
1062
|
]
|
|
1062
|
-
}), /* @__PURE__ */
|
|
1063
|
+
}), /* @__PURE__ */ L("div", {
|
|
1063
1064
|
className: "grid gap-1.5",
|
|
1064
1065
|
children: [
|
|
1065
|
-
/* @__PURE__ */
|
|
1066
|
+
/* @__PURE__ */ I(Z, {
|
|
1066
1067
|
htmlFor: e.cvv,
|
|
1067
1068
|
className: "text-[13px] font-medium text-foreground",
|
|
1068
1069
|
children: "CVC"
|
|
1069
1070
|
}),
|
|
1070
|
-
t ? /* @__PURE__ */
|
|
1071
|
+
t ? /* @__PURE__ */ I("div", {
|
|
1071
1072
|
id: e.cvv,
|
|
1072
|
-
className:
|
|
1073
|
+
className: zt,
|
|
1073
1074
|
children: "CVC"
|
|
1074
|
-
}) : /* @__PURE__ */
|
|
1075
|
+
}) : /* @__PURE__ */ I("div", {
|
|
1075
1076
|
id: e.cvv,
|
|
1076
|
-
className:
|
|
1077
|
+
className: R(Rt, r.cvv && "border-destructive")
|
|
1077
1078
|
}),
|
|
1078
|
-
/* @__PURE__ */
|
|
1079
|
+
/* @__PURE__ */ I(Lt, {
|
|
1079
1080
|
id: `${e.cvv}-error`,
|
|
1080
1081
|
message: r.cvv
|
|
1081
1082
|
})
|
|
1082
1083
|
]
|
|
1083
1084
|
})]
|
|
1084
1085
|
}),
|
|
1085
|
-
n ? /* @__PURE__ */
|
|
1086
|
-
className:
|
|
1086
|
+
n ? /* @__PURE__ */ I("p", {
|
|
1087
|
+
className: R("text-[13px] text-destructive"),
|
|
1087
1088
|
role: "alert",
|
|
1088
1089
|
children: n
|
|
1089
1090
|
}) : null
|
|
1090
1091
|
]
|
|
1091
1092
|
});
|
|
1092
1093
|
}
|
|
1093
|
-
var
|
|
1094
|
-
function
|
|
1094
|
+
var Vt = "h-[38px] w-full min-w-0 rounded-[9px] border border-[color:var(--border)] bg-card px-[11px] text-sm text-foreground tabular-nums outline-none placeholder:text-[color:var(--orck-faint)] focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50";
|
|
1095
|
+
function Ht({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
1095
1096
|
let a = {
|
|
1096
1097
|
...t.fieldErrors,
|
|
1097
1098
|
...n
|
|
1098
|
-
}, o = (e, n, i, a) => /* @__PURE__ */
|
|
1099
|
+
}, o = (e, n, i, a) => /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ I("input", {
|
|
1099
1100
|
id: e,
|
|
1100
1101
|
name: `card-${n}`,
|
|
1101
|
-
className:
|
|
1102
|
+
className: R(Vt, i && "border-destructive"),
|
|
1102
1103
|
value: t.input[n],
|
|
1103
1104
|
onChange: (e) => t.change(n, e.target.value),
|
|
1104
1105
|
onBlur: () => t.leave(n),
|
|
@@ -1109,16 +1110,16 @@ function Vt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1109
1110
|
"aria-invalid": i ? !0 : void 0,
|
|
1110
1111
|
"aria-describedby": i ? `${e}-error` : void 0,
|
|
1111
1112
|
...a
|
|
1112
|
-
}), /* @__PURE__ */
|
|
1113
|
+
}), /* @__PURE__ */ I(Lt, {
|
|
1113
1114
|
id: `${e}-error`,
|
|
1114
1115
|
message: i
|
|
1115
1116
|
})] });
|
|
1116
|
-
return /* @__PURE__ */
|
|
1117
|
-
className:
|
|
1117
|
+
return /* @__PURE__ */ L("div", {
|
|
1118
|
+
className: R("grid gap-3", i && "hidden"),
|
|
1118
1119
|
"aria-hidden": i || void 0,
|
|
1119
|
-
children: [/* @__PURE__ */
|
|
1120
|
+
children: [/* @__PURE__ */ L("div", {
|
|
1120
1121
|
className: "grid gap-1.5",
|
|
1121
|
-
children: [/* @__PURE__ */
|
|
1122
|
+
children: [/* @__PURE__ */ I(Z, {
|
|
1122
1123
|
htmlFor: e.number,
|
|
1123
1124
|
className: "text-[13px] font-medium text-foreground",
|
|
1124
1125
|
children: "Card number"
|
|
@@ -1127,11 +1128,11 @@ function Vt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1127
1128
|
placeholder: "1234 1234 1234 1234",
|
|
1128
1129
|
maxLength: 23
|
|
1129
1130
|
})]
|
|
1130
|
-
}), /* @__PURE__ */
|
|
1131
|
+
}), /* @__PURE__ */ L("div", {
|
|
1131
1132
|
className: "grid grid-cols-2 gap-3",
|
|
1132
|
-
children: [/* @__PURE__ */
|
|
1133
|
+
children: [/* @__PURE__ */ L("div", {
|
|
1133
1134
|
className: "grid gap-1.5",
|
|
1134
|
-
children: [/* @__PURE__ */
|
|
1135
|
+
children: [/* @__PURE__ */ I(Z, {
|
|
1135
1136
|
htmlFor: e.expiry,
|
|
1136
1137
|
className: "text-[13px] font-medium text-foreground",
|
|
1137
1138
|
children: "Expiry"
|
|
@@ -1140,9 +1141,9 @@ function Vt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1140
1141
|
placeholder: "MM / YY",
|
|
1141
1142
|
maxLength: 7
|
|
1142
1143
|
})]
|
|
1143
|
-
}), /* @__PURE__ */
|
|
1144
|
+
}), /* @__PURE__ */ L("div", {
|
|
1144
1145
|
className: "grid gap-1.5",
|
|
1145
|
-
children: [/* @__PURE__ */
|
|
1146
|
+
children: [/* @__PURE__ */ I(Z, {
|
|
1146
1147
|
htmlFor: e.cvv,
|
|
1147
1148
|
className: "text-[13px] font-medium text-foreground",
|
|
1148
1149
|
children: "CVC"
|
|
@@ -1158,42 +1159,42 @@ function Vt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1158
1159
|
//#endregion
|
|
1159
1160
|
//#region src/components/pay-button.tsx
|
|
1160
1161
|
function Q({ label: e, processing: t, disabled: n }) {
|
|
1161
|
-
return /* @__PURE__ */
|
|
1162
|
+
return /* @__PURE__ */ I(U, {
|
|
1162
1163
|
type: "submit",
|
|
1163
|
-
className:
|
|
1164
|
+
className: R("h-[42px] w-full rounded-[10px] text-sm font-semibold tabular-nums", t && "opacity-75"),
|
|
1164
1165
|
disabled: n || t,
|
|
1165
|
-
children: t ? /* @__PURE__ */
|
|
1166
|
+
children: t ? /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ I("span", {
|
|
1166
1167
|
"aria-hidden": !0,
|
|
1167
1168
|
className: "size-3.5 animate-spin rounded-full border-2 border-[color:var(--primary-foreground)]/35 border-t-[color:var(--primary-foreground)] motion-reduce:animate-none"
|
|
1168
1169
|
}), "Processing…"] }) : e
|
|
1169
1170
|
});
|
|
1170
1171
|
}
|
|
1171
|
-
function
|
|
1172
|
-
return /* @__PURE__ */
|
|
1172
|
+
function Ut() {
|
|
1173
|
+
return /* @__PURE__ */ L("div", {
|
|
1173
1174
|
className: "-mt-1 flex items-center justify-center gap-1.5 text-xs text-[color:var(--orck-faint)]",
|
|
1174
|
-
children: [/* @__PURE__ */
|
|
1175
|
+
children: [/* @__PURE__ */ I("svg", {
|
|
1175
1176
|
viewBox: "0 0 16 16",
|
|
1176
1177
|
fill: "currentColor",
|
|
1177
1178
|
"aria-hidden": !0,
|
|
1178
1179
|
className: "size-[11px]",
|
|
1179
|
-
children: /* @__PURE__ */
|
|
1180
|
+
children: /* @__PURE__ */ I("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
1181
|
}), "Secured by OpenRails"]
|
|
1181
1182
|
});
|
|
1182
1183
|
}
|
|
1183
1184
|
//#endregion
|
|
1184
1185
|
//#region src/lib/stripe.ts
|
|
1185
|
-
var
|
|
1186
|
-
function
|
|
1187
|
-
let t =
|
|
1186
|
+
var Wt = /* @__PURE__ */ new Map();
|
|
1187
|
+
function Gt(e) {
|
|
1188
|
+
let t = Wt.get(e);
|
|
1188
1189
|
return t || (t = import("@stripe/stripe-js").then(({ loadStripe: t }) => t(e)).then((e) => {
|
|
1189
1190
|
if (!e) throw Error("Stripe could not be loaded.");
|
|
1190
1191
|
return e;
|
|
1191
|
-
}), t.catch(() =>
|
|
1192
|
+
}), t.catch(() => Wt.delete(e)), Wt.set(e, t)), t;
|
|
1192
1193
|
}
|
|
1193
1194
|
//#endregion
|
|
1194
1195
|
//#region src/lib/collect.ts
|
|
1195
|
-
var
|
|
1196
|
-
function
|
|
1196
|
+
var Kt = "openrails-collectjs", qt = 3e4, Jt = /* @__PURE__ */ new WeakMap();
|
|
1197
|
+
function Yt(e) {
|
|
1197
1198
|
try {
|
|
1198
1199
|
let t = new URL(e);
|
|
1199
1200
|
return t.protocol !== "https:" || t.username || t.password || t.hash ? void 0 : t.toString();
|
|
@@ -1201,9 +1202,9 @@ function Jt(e) {
|
|
|
1201
1202
|
return;
|
|
1202
1203
|
}
|
|
1203
1204
|
}
|
|
1204
|
-
function
|
|
1205
|
+
function Xt(e) {
|
|
1205
1206
|
if (!e) return "";
|
|
1206
|
-
let t =
|
|
1207
|
+
let t = Zt(e);
|
|
1207
1208
|
if (t) return t;
|
|
1208
1209
|
try {
|
|
1209
1210
|
let t = document.createElement("canvas").getContext("2d");
|
|
@@ -1215,7 +1216,7 @@ function Yt(e) {
|
|
|
1215
1216
|
return "";
|
|
1216
1217
|
}
|
|
1217
1218
|
}
|
|
1218
|
-
function
|
|
1219
|
+
function Zt(e) {
|
|
1219
1220
|
let t = /^oklch\(\s*([\d.]+%?)\s+([\d.]+)\s+([\d.]+)(?:deg)?\s*(?:\/\s*([\d.]+%?)\s*)?\)$/i.exec(e.trim());
|
|
1220
1221
|
if (!t) return "";
|
|
1221
1222
|
let n = (e) => e.endsWith("%") ? parseFloat(e) / 100 : parseFloat(e), r = n(t[1]), i = parseFloat(t[2]), a = parseFloat(t[3]) * Math.PI / 180, o = t[4] === void 0 ? 1 : n(t[4]), s = i * Math.cos(a), c = i * Math.sin(a), l = (r + .3963377774 * s + .2158037573 * c) ** 3, u = (r - .1055613458 * s - .0638541728 * c) ** 3, d = (r - .0894841775 * s - 1.291485548 * c) ** 3, f = (e) => {
|
|
@@ -1224,23 +1225,23 @@ function Xt(e) {
|
|
|
1224
1225
|
}, p = f(4.0767416621 * l - 3.3077115913 * u + .2309699292 * d), m = f(-1.2684380046 * l + 2.6097574011 * u - .3413193965 * d), h = f(-.0041960863 * l - .7034186147 * u + 1.707614701 * d);
|
|
1225
1226
|
return o >= 1 ? `rgb(${p}, ${m}, ${h})` : `rgba(${p}, ${m}, ${h}, ${o})`;
|
|
1226
1227
|
}
|
|
1227
|
-
function
|
|
1228
|
+
function Qt(e) {
|
|
1228
1229
|
return e.startsWith("preview_");
|
|
1229
1230
|
}
|
|
1230
|
-
var
|
|
1231
|
+
var $t = {
|
|
1231
1232
|
ccnumber: "number",
|
|
1232
1233
|
ccexp: "expiry",
|
|
1233
1234
|
cvv: "cvv"
|
|
1234
|
-
},
|
|
1235
|
+
}, en = {
|
|
1235
1236
|
number: "Enter a valid card number",
|
|
1236
1237
|
expiry: "Enter a valid expiry date",
|
|
1237
1238
|
cvv: "Enter a valid security code"
|
|
1238
1239
|
};
|
|
1239
|
-
function
|
|
1240
|
-
let t = e.enabled &&
|
|
1241
|
-
|
|
1240
|
+
function tn(e) {
|
|
1241
|
+
let t = e.enabled && Qt(e.tokenizationKey), [n, r] = P.useState(!1), [i, a] = P.useState(), [o, s] = P.useState({}), c = P.useRef(void 0), l = P.useRef(void 0), { number: u, expiry: d, cvv: f } = e.selectors;
|
|
1242
|
+
P.useEffect(() => {
|
|
1242
1243
|
if (!e.enabled || t || !e.tokenizationKey || !e.scriptURL || typeof document > "u") return;
|
|
1243
|
-
let n =
|
|
1244
|
+
let n = Yt(e.scriptURL);
|
|
1244
1245
|
if (!n) {
|
|
1245
1246
|
Promise.resolve().then(() => {
|
|
1246
1247
|
r(!1), a("Card fields failed to load");
|
|
@@ -1268,7 +1269,7 @@ function en(e) {
|
|
|
1268
1269
|
p(() => {
|
|
1269
1270
|
r(!1), a(void 0), s({});
|
|
1270
1271
|
});
|
|
1271
|
-
let t = document.querySelector(u), n = t ? window.getComputedStyle(t) : void 0, i =
|
|
1272
|
+
let t = document.querySelector(u), n = t ? window.getComputedStyle(t) : void 0, i = Xt(n?.backgroundColor), l = i && i !== "transparent" && i !== "rgba(0, 0, 0, 0)" ? i : "#ffffff", m = Xt(n?.color) || "#18181b", h = Xt(n?.getPropertyValue("--muted-foreground").trim()) || m;
|
|
1272
1273
|
try {
|
|
1273
1274
|
e.configure({
|
|
1274
1275
|
variant: "inline",
|
|
@@ -1283,7 +1284,7 @@ function en(e) {
|
|
|
1283
1284
|
color: m
|
|
1284
1285
|
},
|
|
1285
1286
|
placeholderCss: { color: h },
|
|
1286
|
-
invalidCss: { color:
|
|
1287
|
+
invalidCss: { color: Xt(n?.getPropertyValue("--destructive").trim()) || "#dc2626" },
|
|
1287
1288
|
focusCss: { outline: "none" },
|
|
1288
1289
|
fields: {
|
|
1289
1290
|
ccnumber: {
|
|
@@ -1304,16 +1305,16 @@ function en(e) {
|
|
|
1304
1305
|
},
|
|
1305
1306
|
fieldsAvailableCallback: () => p(() => r(!0)),
|
|
1306
1307
|
validationCallback: (e, t, n) => {
|
|
1307
|
-
let r =
|
|
1308
|
+
let r = $t[e];
|
|
1308
1309
|
r && p(() => s((e) => ({
|
|
1309
1310
|
...e,
|
|
1310
1311
|
[r]: {
|
|
1311
1312
|
valid: t,
|
|
1312
|
-
message: t ? void 0 : n && n !== "Field is empty" ? `${
|
|
1313
|
+
message: t ? void 0 : n && n !== "Field is empty" ? `${en[r]}.` : en[r]
|
|
1313
1314
|
}
|
|
1314
1315
|
})));
|
|
1315
1316
|
},
|
|
1316
|
-
timeoutDuration:
|
|
1317
|
+
timeoutDuration: qt,
|
|
1317
1318
|
timeoutCallback: () => {
|
|
1318
1319
|
let e = c.current;
|
|
1319
1320
|
c.current = void 0, e && (window.clearTimeout(e.timer), e.reject(/* @__PURE__ */ Error("Card entry timed out")));
|
|
@@ -1326,12 +1327,12 @@ function en(e) {
|
|
|
1326
1327
|
} catch {
|
|
1327
1328
|
p(() => a("Card fields failed to load"));
|
|
1328
1329
|
}
|
|
1329
|
-
}, h = document.getElementById(
|
|
1330
|
-
if (h instanceof HTMLScriptElement && (h.src !== n ||
|
|
1330
|
+
}, h = document.getElementById(Kt);
|
|
1331
|
+
if (h instanceof HTMLScriptElement && (h.src !== n || Jt.get(h) === "failed") && (h.remove(), h.src !== n && Reflect.deleteProperty(window, "CollectJS"), h = null), h instanceof HTMLScriptElement) {
|
|
1331
1332
|
if (window.CollectJS) return m(), () => {
|
|
1332
1333
|
o = !0;
|
|
1333
1334
|
};
|
|
1334
|
-
if (
|
|
1335
|
+
if (Jt.get(h) === "loaded") return p(() => a("Card fields failed to load")), () => {
|
|
1335
1336
|
o = !0;
|
|
1336
1337
|
};
|
|
1337
1338
|
let e = () => p(() => a("Card fields failed to load"));
|
|
@@ -1340,10 +1341,10 @@ function en(e) {
|
|
|
1340
1341
|
};
|
|
1341
1342
|
}
|
|
1342
1343
|
let g = document.createElement("script");
|
|
1343
|
-
return g.id =
|
|
1344
|
-
|
|
1344
|
+
return g.id = Kt, g.src = n, g.async = !0, g.dataset.tokenizationKey = e.tokenizationKey, Jt.set(g, "loading"), g.onload = () => {
|
|
1345
|
+
Jt.set(g, "loaded"), m();
|
|
1345
1346
|
}, g.onerror = () => {
|
|
1346
|
-
|
|
1347
|
+
Jt.set(g, "failed"), p(() => a("Card fields failed to load"));
|
|
1347
1348
|
}, document.head.appendChild(g), () => {
|
|
1348
1349
|
o = !0;
|
|
1349
1350
|
};
|
|
@@ -1357,7 +1358,7 @@ function en(e) {
|
|
|
1357
1358
|
d,
|
|
1358
1359
|
f
|
|
1359
1360
|
]);
|
|
1360
|
-
let p =
|
|
1361
|
+
let p = P.useCallback(() => new Promise((e, r) => {
|
|
1361
1362
|
if (t) {
|
|
1362
1363
|
e({
|
|
1363
1364
|
token: "preview_payment_token",
|
|
@@ -1409,7 +1410,7 @@ function en(e) {
|
|
|
1409
1410
|
tokenize: p
|
|
1410
1411
|
};
|
|
1411
1412
|
}
|
|
1412
|
-
function
|
|
1413
|
+
function nn(e) {
|
|
1413
1414
|
let t = (e?.number ?? "").replace(/\D/g, ""), n = (e?.exp ?? "").replace(/\D/g, "");
|
|
1414
1415
|
return {
|
|
1415
1416
|
...t.length >= 4 ? { last_four: t.slice(-4) } : {},
|
|
@@ -1419,8 +1420,8 @@ function tn(e) {
|
|
|
1419
1420
|
}
|
|
1420
1421
|
//#endregion
|
|
1421
1422
|
//#region src/lib/stripe-appearance.ts
|
|
1422
|
-
function
|
|
1423
|
-
let t = window.getComputedStyle(e), n = (e) =>
|
|
1423
|
+
function rn(e) {
|
|
1424
|
+
let t = window.getComputedStyle(e), n = (e) => Xt(t.getPropertyValue(e).trim()) || void 0;
|
|
1424
1425
|
return {
|
|
1425
1426
|
theme: e.closest(".dark") ? "night" : "stripe",
|
|
1426
1427
|
variables: {
|
|
@@ -1455,22 +1456,22 @@ function nn(e) {
|
|
|
1455
1456
|
}
|
|
1456
1457
|
//#endregion
|
|
1457
1458
|
//#region src/components/stripe-card.tsx
|
|
1458
|
-
var
|
|
1459
|
-
let [s, c] =
|
|
1460
|
-
|
|
1459
|
+
var an = P.forwardRef(function({ psp: e, client: t, defaultCountry: n, onCompleteChange: r, unavailableMessage: i, verificationPendingMessage: a }, o) {
|
|
1460
|
+
let [s, c] = P.useState(), l = P.useRef(null), u = P.useRef(null), d = P.useRef(r);
|
|
1461
|
+
P.useEffect(() => {
|
|
1461
1462
|
d.current = r;
|
|
1462
1463
|
});
|
|
1463
1464
|
let f = e.config?.publishable_key;
|
|
1464
|
-
return
|
|
1465
|
+
return P.useEffect(() => {
|
|
1465
1466
|
if (!f || !l.current) return;
|
|
1466
1467
|
let e = !1, t;
|
|
1467
|
-
return
|
|
1468
|
+
return Gt(f).then((r) => {
|
|
1468
1469
|
if (e || !l.current) return;
|
|
1469
1470
|
let i = r.elements({
|
|
1470
1471
|
mode: "setup",
|
|
1471
1472
|
paymentMethodTypes: ["card"],
|
|
1472
1473
|
paymentMethodCreation: "manual",
|
|
1473
|
-
appearance:
|
|
1474
|
+
appearance: rn(l.current)
|
|
1474
1475
|
}), a = i.create("payment", {
|
|
1475
1476
|
wallets: {
|
|
1476
1477
|
link: "never",
|
|
@@ -1494,7 +1495,7 @@ var rn = N.forwardRef(function({ psp: e, client: t, defaultCountry: n, onComplet
|
|
|
1494
1495
|
f,
|
|
1495
1496
|
n,
|
|
1496
1497
|
i
|
|
1497
|
-
]),
|
|
1498
|
+
]), P.useImperativeHandle(o, () => {
|
|
1498
1499
|
let n = async () => {
|
|
1499
1500
|
let e = u.current;
|
|
1500
1501
|
if (!e) throw Error(i);
|
|
@@ -1527,23 +1528,23 @@ var rn = N.forwardRef(function({ psp: e, client: t, defaultCountry: n, onComplet
|
|
|
1527
1528
|
e.psp_id,
|
|
1528
1529
|
i,
|
|
1529
1530
|
a
|
|
1530
|
-
]), /* @__PURE__ */
|
|
1531
|
+
]), /* @__PURE__ */ L("div", {
|
|
1531
1532
|
className: "grid gap-2",
|
|
1532
|
-
children: [/* @__PURE__ */
|
|
1533
|
+
children: [/* @__PURE__ */ I("div", {
|
|
1533
1534
|
ref: l,
|
|
1534
1535
|
"data-testid": "stripe-card-entry"
|
|
1535
|
-
}), s ? /* @__PURE__ */
|
|
1536
|
+
}), s ? /* @__PURE__ */ I("p", {
|
|
1536
1537
|
role: "alert",
|
|
1537
1538
|
className: "text-[13px] text-destructive",
|
|
1538
1539
|
children: s
|
|
1539
1540
|
}) : null]
|
|
1540
1541
|
});
|
|
1541
|
-
}),
|
|
1542
|
+
}), on = {
|
|
1542
1543
|
number: "Enter a valid card number",
|
|
1543
1544
|
expiry: "Enter a valid expiry date",
|
|
1544
1545
|
cvv: "Enter a valid security code"
|
|
1545
1546
|
}, $ = (e) => e.replace(/\D/g, "");
|
|
1546
|
-
function
|
|
1547
|
+
function sn(e) {
|
|
1547
1548
|
let t = 0;
|
|
1548
1549
|
for (let n = 0; n < e.length; n++) {
|
|
1549
1550
|
let r = e.charCodeAt(e.length - 1 - n) - 48;
|
|
@@ -1551,23 +1552,23 @@ function on(e) {
|
|
|
1551
1552
|
}
|
|
1552
1553
|
return t % 10 == 0;
|
|
1553
1554
|
}
|
|
1554
|
-
function
|
|
1555
|
+
function cn(e) {
|
|
1555
1556
|
let t = $(e), n = (e) => t.length >= e ? Number(t.slice(0, e)) : -1;
|
|
1556
1557
|
return n(1) === 4 ? "visa" : n(2) === 34 || n(2) === 37 ? "amex" : n(2) >= 51 && n(2) <= 55 || n(4) >= 2221 && n(4) <= 2720 ? "mastercard" : n(4) === 6011 || n(2) === 65 || n(3) >= 644 && n(3) <= 649 ? "discover" : n(2) === 35 ? "jcb" : n(2) === 36 || n(2) === 38 || n(3) >= 300 && n(3) <= 305 ? "diners" : "";
|
|
1557
1558
|
}
|
|
1558
|
-
function
|
|
1559
|
+
function ln(e) {
|
|
1559
1560
|
let t = $(e).slice(0, 19);
|
|
1560
|
-
return
|
|
1561
|
+
return cn(t) === "amex" ? [
|
|
1561
1562
|
t.slice(0, 4),
|
|
1562
1563
|
t.slice(4, 10),
|
|
1563
1564
|
t.slice(10, 15)
|
|
1564
1565
|
].filter(Boolean).join(" ") : t.replace(/(\d{4})(?=\d)/g, "$1 ");
|
|
1565
1566
|
}
|
|
1566
|
-
function
|
|
1567
|
+
function un(e) {
|
|
1567
1568
|
let t = $(e).slice(0, 4);
|
|
1568
1569
|
return t.length > 2 ? `${t.slice(0, 2)} / ${t.slice(2)}` : t;
|
|
1569
1570
|
}
|
|
1570
|
-
function
|
|
1571
|
+
function dn(e, t) {
|
|
1571
1572
|
let n = $(e);
|
|
1572
1573
|
if (n.length !== 4 && n.length !== 6) return null;
|
|
1573
1574
|
let r = Number(n.slice(0, 2)), i = n.length === 4 ? 2e3 + Number(n.slice(2)) : Number(n.slice(2));
|
|
@@ -1576,15 +1577,15 @@ function un(e, t) {
|
|
|
1576
1577
|
year: i
|
|
1577
1578
|
};
|
|
1578
1579
|
}
|
|
1579
|
-
function
|
|
1580
|
+
function fn(e, t = /* @__PURE__ */ new Date()) {
|
|
1580
1581
|
let n = {}, r = $(e.number);
|
|
1581
|
-
(r.length < 12 || r.length > 19 || !
|
|
1582
|
-
let i = $(e.cvc), a =
|
|
1583
|
-
return (i !== e.cvc.trim() || i.length !== a && i.length !== 4) && (n.cvv =
|
|
1582
|
+
(r.length < 12 || r.length > 19 || !sn(r)) && (n.number = on.number), dn(e.expiry, t) || (n.expiry = on.expiry);
|
|
1583
|
+
let i = $(e.cvc), a = cn(r) === "amex" ? 4 : 3;
|
|
1584
|
+
return (i !== e.cvc.trim() || i.length !== a && i.length !== 4) && (n.cvv = on.cvv), n;
|
|
1584
1585
|
}
|
|
1585
|
-
function
|
|
1586
|
-
if (Object.keys(
|
|
1587
|
-
let n =
|
|
1586
|
+
function pn(e, t = /* @__PURE__ */ new Date()) {
|
|
1587
|
+
if (Object.keys(fn(e, t)).length > 0) return null;
|
|
1588
|
+
let n = dn(e.expiry, t);
|
|
1588
1589
|
return {
|
|
1589
1590
|
number: $(e.number),
|
|
1590
1591
|
exp_month: n.month,
|
|
@@ -1592,16 +1593,16 @@ function fn(e, t = /* @__PURE__ */ new Date()) {
|
|
|
1592
1593
|
cvc: $(e.cvc)
|
|
1593
1594
|
};
|
|
1594
1595
|
}
|
|
1595
|
-
var
|
|
1596
|
+
var mn = {
|
|
1596
1597
|
number: "",
|
|
1597
1598
|
expiry: "",
|
|
1598
1599
|
cvc: ""
|
|
1599
1600
|
};
|
|
1600
|
-
function
|
|
1601
|
-
let [e, t] =
|
|
1601
|
+
function hn() {
|
|
1602
|
+
let [e, t] = P.useState(mn), [n, r] = P.useState({}), i = fn(e), a = {};
|
|
1602
1603
|
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 =
|
|
1604
|
-
t(
|
|
1604
|
+
let o = P.useCallback(() => {
|
|
1605
|
+
t(mn), r({});
|
|
1605
1606
|
}, []);
|
|
1606
1607
|
return {
|
|
1607
1608
|
input: e,
|
|
@@ -1609,14 +1610,14 @@ function mn() {
|
|
|
1609
1610
|
valid: Object.keys(i).length === 0,
|
|
1610
1611
|
change: (e, n) => t((t) => ({
|
|
1611
1612
|
...t,
|
|
1612
|
-
[e]: e === "number" ?
|
|
1613
|
+
[e]: e === "number" ? ln(n) : e === "expiry" ? un(n) : $(n).slice(0, 4)
|
|
1613
1614
|
})),
|
|
1614
1615
|
leave: (e) => r((t) => ({
|
|
1615
1616
|
...t,
|
|
1616
1617
|
[e]: !0
|
|
1617
1618
|
})),
|
|
1618
1619
|
take: () => {
|
|
1619
|
-
let t =
|
|
1620
|
+
let t = pn(e);
|
|
1620
1621
|
return t ? (o(), t) : (r({
|
|
1621
1622
|
number: !0,
|
|
1622
1623
|
expiry: !0,
|
|
@@ -1628,19 +1629,19 @@ function mn() {
|
|
|
1628
1629
|
}
|
|
1629
1630
|
//#endregion
|
|
1630
1631
|
//#region src/tokenized-card-form.tsx
|
|
1631
|
-
function
|
|
1632
|
-
let c =
|
|
1632
|
+
function gn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabel: r = "Save card", disabled: i = !1, defaultCountry: a, appearance: o, className: s }) {
|
|
1633
|
+
let c = P.useId().replace(/[^a-zA-Z0-9-]/g, ""), l = P.useMemo(() => ({
|
|
1633
1634
|
number: `orck-save-${c}-number`,
|
|
1634
1635
|
expiry: `orck-save-${c}-expiry`,
|
|
1635
1636
|
cvv: `orck-save-${c}-cvv`
|
|
1636
|
-
}), [c]), [u, d] =
|
|
1637
|
-
...
|
|
1638
|
-
country:
|
|
1639
|
-
})), [f, p] =
|
|
1637
|
+
}), [c]), [u, d] = P.useState(() => ({
|
|
1638
|
+
...Dt,
|
|
1639
|
+
country: kt(a)
|
|
1640
|
+
})), [f, p] = P.useState(!1), [m, h] = P.useState(!1), [g, _] = P.useState(), v = P.useRef({
|
|
1640
1641
|
generation: 0,
|
|
1641
1642
|
disabled: i
|
|
1642
1643
|
});
|
|
1643
|
-
|
|
1644
|
+
P.useLayoutEffect(() => {
|
|
1644
1645
|
v.current = {
|
|
1645
1646
|
generation: v.current.generation + 1,
|
|
1646
1647
|
disabled: i
|
|
@@ -1650,11 +1651,11 @@ function hn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1650
1651
|
t,
|
|
1651
1652
|
i
|
|
1652
1653
|
]);
|
|
1653
|
-
let y =
|
|
1654
|
-
|
|
1654
|
+
let y = P.useRef(!0);
|
|
1655
|
+
P.useEffect(() => (y.current = !0, () => {
|
|
1655
1656
|
y.current = !1;
|
|
1656
1657
|
}), []);
|
|
1657
|
-
let b =
|
|
1658
|
+
let b = tn({
|
|
1658
1659
|
enabled: !0,
|
|
1659
1660
|
active: !0,
|
|
1660
1661
|
tokenizationKey: e,
|
|
@@ -1666,7 +1667,7 @@ function hn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1666
1667
|
}
|
|
1667
1668
|
}), x = async (e) => {
|
|
1668
1669
|
if (e.preventDefault(), i || f || m) return;
|
|
1669
|
-
let t =
|
|
1670
|
+
let t = Tt.safeParse(u);
|
|
1670
1671
|
if (!t.success) {
|
|
1671
1672
|
_(t.error.issues[0]?.message ?? "Check the billing details");
|
|
1672
1673
|
return;
|
|
@@ -1679,7 +1680,7 @@ function hn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1679
1680
|
a = !0, h(!0), await n({
|
|
1680
1681
|
payment_token: e.token,
|
|
1681
1682
|
...t.data,
|
|
1682
|
-
...
|
|
1683
|
+
...nn(e.card)
|
|
1683
1684
|
}) === !1 && y.current && h(!1);
|
|
1684
1685
|
} catch (e) {
|
|
1685
1686
|
y.current && _(a ? "The card-save result is not confirmed. Check your saved cards before starting another attempt." : e instanceof Error ? e.message : "Card entry could not be completed.");
|
|
@@ -1687,69 +1688,69 @@ function hn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1687
1688
|
y.current && p(!1);
|
|
1688
1689
|
}
|
|
1689
1690
|
};
|
|
1690
|
-
return /* @__PURE__ */
|
|
1691
|
-
className:
|
|
1691
|
+
return /* @__PURE__ */ I("div", {
|
|
1692
|
+
className: R("orck", s),
|
|
1692
1693
|
"data-orck-theme": C(o),
|
|
1693
1694
|
style: E(o),
|
|
1694
|
-
children: /* @__PURE__ */
|
|
1695
|
+
children: /* @__PURE__ */ L("form", {
|
|
1695
1696
|
"aria-label": "Secure card setup",
|
|
1696
1697
|
autoComplete: "on",
|
|
1697
1698
|
className: "grid gap-4",
|
|
1698
1699
|
onSubmit: (e) => void x(e),
|
|
1699
1700
|
children: [
|
|
1700
|
-
/* @__PURE__ */
|
|
1701
|
+
/* @__PURE__ */ I(It, {
|
|
1701
1702
|
idPrefix: `orck-save-${c}`,
|
|
1702
1703
|
value: u,
|
|
1703
1704
|
onChange: d,
|
|
1704
1705
|
disabled: i || f || m
|
|
1705
1706
|
}),
|
|
1706
|
-
/* @__PURE__ */
|
|
1707
|
+
/* @__PURE__ */ I(Bt, {
|
|
1707
1708
|
ids: l,
|
|
1708
1709
|
preview: b.preview,
|
|
1709
1710
|
error: b.loadError,
|
|
1710
1711
|
fieldErrors: b.fieldErrors
|
|
1711
1712
|
}),
|
|
1712
|
-
g ? /* @__PURE__ */
|
|
1713
|
+
g ? /* @__PURE__ */ I("p", {
|
|
1713
1714
|
role: "alert",
|
|
1714
1715
|
className: "text-sm text-destructive",
|
|
1715
1716
|
children: g
|
|
1716
1717
|
}) : null,
|
|
1717
|
-
/* @__PURE__ */
|
|
1718
|
+
/* @__PURE__ */ I(Q, {
|
|
1718
1719
|
label: r,
|
|
1719
1720
|
processing: f,
|
|
1720
1721
|
disabled: i || m || !b.ready || !b.valid || !!b.loadError
|
|
1721
1722
|
}),
|
|
1722
|
-
/* @__PURE__ */
|
|
1723
|
+
/* @__PURE__ */ I(Ut, {})
|
|
1723
1724
|
]
|
|
1724
1725
|
})
|
|
1725
1726
|
});
|
|
1726
1727
|
}
|
|
1727
1728
|
//#endregion
|
|
1728
1729
|
//#region src/save-payment-method.tsx
|
|
1729
|
-
function
|
|
1730
|
+
function _n(e) {
|
|
1730
1731
|
let { t } = S(), n = s(e.psp);
|
|
1731
|
-
return n ? /* @__PURE__ */
|
|
1732
|
-
className:
|
|
1732
|
+
return n ? /* @__PURE__ */ L("div", {
|
|
1733
|
+
className: R("orck grid gap-4", e.className),
|
|
1733
1734
|
"data-orck-theme": C(e.appearance),
|
|
1734
1735
|
style: E(e.appearance),
|
|
1735
|
-
children: [/* @__PURE__ */
|
|
1736
|
+
children: [/* @__PURE__ */ I("p", {
|
|
1736
1737
|
className: "text-sm text-muted-foreground",
|
|
1737
1738
|
children: t("paymentMethods.saveNotice")
|
|
1738
|
-
}),
|
|
1739
|
-
}) : /* @__PURE__ */
|
|
1739
|
+
}), I(n === "collect_js" ? yn : n === "card" ? bn : xn, { ...e })]
|
|
1740
|
+
}) : /* @__PURE__ */ I("p", {
|
|
1740
1741
|
role: "alert",
|
|
1741
1742
|
className: "text-sm text-destructive",
|
|
1742
1743
|
children: t("paymentMethods.unavailable")
|
|
1743
1744
|
});
|
|
1744
1745
|
}
|
|
1745
|
-
var
|
|
1746
|
-
function
|
|
1747
|
-
let a = S(), { client: o, notify: s } = T(), [c, l] =
|
|
1748
|
-
return /* @__PURE__ */
|
|
1746
|
+
var vn = (e, t) => !n(t) && t instanceof Error && t.message ? t.message : e.error(t);
|
|
1747
|
+
function yn({ psp: e, onSaved: t, submitLabel: n, appearance: r, defaultCountry: i }) {
|
|
1748
|
+
let a = S(), { client: o, notify: s } = T(), [c, l] = P.useState(0), [u, d] = P.useState();
|
|
1749
|
+
return /* @__PURE__ */ L(F, { children: [u ? /* @__PURE__ */ I("p", {
|
|
1749
1750
|
role: "alert",
|
|
1750
1751
|
className: "text-sm text-destructive",
|
|
1751
1752
|
children: u
|
|
1752
|
-
}) : null, /* @__PURE__ */
|
|
1753
|
+
}) : null, /* @__PURE__ */ I(gn, {
|
|
1753
1754
|
tokenizationKey: e.config.tokenization_key,
|
|
1754
1755
|
tokenizationURL: e.config.tokenization_url,
|
|
1755
1756
|
onTokenized: async (n) => {
|
|
@@ -1759,10 +1760,10 @@ function vn({ psp: e, onSaved: t, submitLabel: n, appearance: r, defaultCountry:
|
|
|
1759
1760
|
r = await o.addPaymentMethod({
|
|
1760
1761
|
psp_id: e.psp_id,
|
|
1761
1762
|
token: n.payment_token,
|
|
1762
|
-
billing_details:
|
|
1763
|
+
billing_details: Et(n)
|
|
1763
1764
|
});
|
|
1764
1765
|
} catch (e) {
|
|
1765
|
-
d(
|
|
1766
|
+
d(vn(a, e)), l((e) => e + 1);
|
|
1766
1767
|
return;
|
|
1767
1768
|
}
|
|
1768
1769
|
s({
|
|
@@ -1775,17 +1776,17 @@ function vn({ psp: e, onSaved: t, submitLabel: n, appearance: r, defaultCountry:
|
|
|
1775
1776
|
appearance: r
|
|
1776
1777
|
}, c)] });
|
|
1777
1778
|
}
|
|
1778
|
-
function
|
|
1779
|
-
let i = S(), { client: a, notify: o } = T(), s =
|
|
1779
|
+
function bn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
1780
|
+
let i = S(), { client: a, notify: o } = T(), s = P.useId().replace(/[^a-zA-Z0-9-]/g, ""), c = P.useMemo(() => ({
|
|
1780
1781
|
number: `orck-save-${s}-number`,
|
|
1781
1782
|
expiry: `orck-save-${s}-expiry`,
|
|
1782
1783
|
cvv: `orck-save-${s}-cvv`
|
|
1783
|
-
}), [s]), l =
|
|
1784
|
-
...
|
|
1785
|
-
country:
|
|
1786
|
-
})), [f, p] =
|
|
1784
|
+
}), [s]), l = hn(), [u, d] = P.useState(() => ({
|
|
1785
|
+
...Dt,
|
|
1786
|
+
country: kt(r)
|
|
1787
|
+
})), [f, p] = P.useState(!1), [m, h] = P.useState(), g = async (n) => {
|
|
1787
1788
|
if (n.preventDefault(), f) return;
|
|
1788
|
-
let r =
|
|
1789
|
+
let r = Tt.safeParse(u);
|
|
1789
1790
|
if (!r.success) {
|
|
1790
1791
|
h(r.error.issues[0]?.message ?? "Check the billing details");
|
|
1791
1792
|
return;
|
|
@@ -1797,53 +1798,53 @@ function yn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
1797
1798
|
let n = await a.addPaymentMethod({
|
|
1798
1799
|
psp_id: e.psp_id,
|
|
1799
1800
|
card: s,
|
|
1800
|
-
billing_details:
|
|
1801
|
+
billing_details: Et(r.data)
|
|
1801
1802
|
});
|
|
1802
1803
|
o({
|
|
1803
1804
|
type: "payment_method.added",
|
|
1804
1805
|
paymentMethodId: n.id
|
|
1805
1806
|
}), t(n.id);
|
|
1806
1807
|
} catch (e) {
|
|
1807
|
-
h(
|
|
1808
|
+
h(vn(i, e));
|
|
1808
1809
|
} finally {
|
|
1809
1810
|
p(!1);
|
|
1810
1811
|
}
|
|
1811
1812
|
}
|
|
1812
1813
|
};
|
|
1813
|
-
return /* @__PURE__ */
|
|
1814
|
+
return /* @__PURE__ */ L("form", {
|
|
1814
1815
|
"aria-label": "Secure card setup",
|
|
1815
1816
|
autoComplete: "on",
|
|
1816
1817
|
className: "grid gap-4",
|
|
1817
1818
|
noValidate: !0,
|
|
1818
1819
|
onSubmit: (e) => void g(e),
|
|
1819
1820
|
children: [
|
|
1820
|
-
/* @__PURE__ */
|
|
1821
|
+
/* @__PURE__ */ I(It, {
|
|
1821
1822
|
idPrefix: `orck-save-${s}`,
|
|
1822
1823
|
value: u,
|
|
1823
1824
|
onChange: d,
|
|
1824
1825
|
disabled: f
|
|
1825
1826
|
}),
|
|
1826
|
-
/* @__PURE__ */
|
|
1827
|
+
/* @__PURE__ */ I(Ht, {
|
|
1827
1828
|
ids: c,
|
|
1828
1829
|
card: l,
|
|
1829
1830
|
disabled: f
|
|
1830
1831
|
}),
|
|
1831
|
-
m ? /* @__PURE__ */
|
|
1832
|
+
m ? /* @__PURE__ */ I("p", {
|
|
1832
1833
|
role: "alert",
|
|
1833
1834
|
className: "text-sm text-destructive",
|
|
1834
1835
|
children: m
|
|
1835
1836
|
}) : null,
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
+
/* @__PURE__ */ I(Q, {
|
|
1837
1838
|
label: n ?? i.t("paymentMethods.save"),
|
|
1838
1839
|
processing: f,
|
|
1839
1840
|
disabled: !l.valid
|
|
1840
1841
|
}),
|
|
1841
|
-
/* @__PURE__ */
|
|
1842
|
+
/* @__PURE__ */ I(Ut, {})
|
|
1842
1843
|
]
|
|
1843
1844
|
});
|
|
1844
1845
|
}
|
|
1845
|
-
function
|
|
1846
|
-
let i = S(), { t: a } = i, { client: o, notify: s } = T(), c =
|
|
1846
|
+
function xn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
1847
|
+
let i = S(), { t: a } = i, { client: o, notify: s } = T(), c = P.useRef(null), [l, u] = P.useState(!1), [d, f] = P.useState(!1), [p, m] = P.useState(), h = P.useMemo(() => kt(r), [r]), g = async (e) => {
|
|
1847
1848
|
if (e.preventDefault(), !(!c.current || d)) {
|
|
1848
1849
|
f(!0), m(void 0);
|
|
1849
1850
|
try {
|
|
@@ -1853,17 +1854,17 @@ function bn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
1853
1854
|
paymentMethodId: e
|
|
1854
1855
|
}), t(e);
|
|
1855
1856
|
} catch (e) {
|
|
1856
|
-
m(
|
|
1857
|
+
m(vn(i, e));
|
|
1857
1858
|
} finally {
|
|
1858
1859
|
f(!1);
|
|
1859
1860
|
}
|
|
1860
1861
|
}
|
|
1861
1862
|
};
|
|
1862
|
-
return /* @__PURE__ */
|
|
1863
|
+
return /* @__PURE__ */ L("form", {
|
|
1863
1864
|
className: "grid gap-4",
|
|
1864
1865
|
onSubmit: (e) => void g(e),
|
|
1865
1866
|
children: [
|
|
1866
|
-
/* @__PURE__ */
|
|
1867
|
+
/* @__PURE__ */ I(an, {
|
|
1867
1868
|
ref: c,
|
|
1868
1869
|
psp: e,
|
|
1869
1870
|
client: o,
|
|
@@ -1872,46 +1873,46 @@ function bn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
1872
1873
|
unavailableMessage: a("paymentMethods.unavailable"),
|
|
1873
1874
|
verificationPendingMessage: a("paymentMethods.verificationPending")
|
|
1874
1875
|
}),
|
|
1875
|
-
p ? /* @__PURE__ */
|
|
1876
|
+
p ? /* @__PURE__ */ I("p", {
|
|
1876
1877
|
role: "alert",
|
|
1877
1878
|
className: "text-sm text-destructive",
|
|
1878
1879
|
children: p
|
|
1879
1880
|
}) : null,
|
|
1880
|
-
/* @__PURE__ */
|
|
1881
|
+
/* @__PURE__ */ I(Q, {
|
|
1881
1882
|
label: n ?? a("paymentMethods.save"),
|
|
1882
1883
|
processing: d,
|
|
1883
1884
|
disabled: !l
|
|
1884
1885
|
}),
|
|
1885
|
-
/* @__PURE__ */
|
|
1886
|
+
/* @__PURE__ */ I(Ut, {})
|
|
1886
1887
|
]
|
|
1887
1888
|
});
|
|
1888
1889
|
}
|
|
1889
1890
|
//#endregion
|
|
1890
1891
|
//#region src/account/notice.tsx
|
|
1891
|
-
function
|
|
1892
|
-
let [e, t] =
|
|
1893
|
-
return
|
|
1892
|
+
function Sn() {
|
|
1893
|
+
let [e, t] = P.useState(null);
|
|
1894
|
+
return P.useEffect(() => {
|
|
1894
1895
|
if (!e) return;
|
|
1895
1896
|
let n = setTimeout(() => t(null), 6e3);
|
|
1896
1897
|
return () => clearTimeout(n);
|
|
1897
|
-
}, [e]), [/* @__PURE__ */
|
|
1898
|
+
}, [e]), [/* @__PURE__ */ I("p", {
|
|
1898
1899
|
role: "status",
|
|
1899
1900
|
"aria-live": "polite",
|
|
1900
|
-
className:
|
|
1901
|
+
className: R("text-sm text-muted-foreground", e ? "pt-3" : "sr-only"),
|
|
1901
1902
|
children: e
|
|
1902
1903
|
}), t];
|
|
1903
1904
|
}
|
|
1904
1905
|
//#endregion
|
|
1905
1906
|
//#region src/account/payment-methods-panel.tsx
|
|
1906
|
-
function Sn(e, t) {
|
|
1907
|
-
return Ce(e.card, t);
|
|
1908
|
-
}
|
|
1909
1907
|
function Cn(e, t) {
|
|
1908
|
+
return Te(e.card, t);
|
|
1909
|
+
}
|
|
1910
|
+
function wn(e, t) {
|
|
1910
1911
|
return e.status === 409 && e.code === "resource_conflict" ? t.t("paymentMethods.inUse") : t.error(e);
|
|
1911
1912
|
}
|
|
1912
|
-
function
|
|
1913
|
-
let a = S(), { t: o } = a, s = x(n), c =
|
|
1914
|
-
|
|
1913
|
+
function Tn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r }) {
|
|
1914
|
+
let a = S(), { t: o } = a, s = x(n), c = te(), [l, u] = P.useState(null), [d, f] = P.useState(null), [p, h] = P.useState(null), [g, v] = P.useState(!1), y = ee(), b = i(y.config?.payment.psps ?? []), C = b.filter(m), w = C.length > 0 ? null : _(b), { refetch: T } = y;
|
|
1915
|
+
P.useEffect(() => {
|
|
1915
1916
|
if (w === null) return;
|
|
1916
1917
|
let e = setTimeout(T, w * 1e3);
|
|
1917
1918
|
return () => clearTimeout(e);
|
|
@@ -1920,81 +1921,81 @@ function wn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
1920
1921
|
T,
|
|
1921
1922
|
y.config
|
|
1922
1923
|
]);
|
|
1923
|
-
let [E,
|
|
1924
|
+
let [E, D] = P.useState(), O = C.find((e) => e.psp_id === E) ?? C[0], [k, A] = Sn(), ne = e?.toUpperCase(), re = async () => {
|
|
1924
1925
|
if (!l) return;
|
|
1925
1926
|
f(null);
|
|
1926
1927
|
let e = await c.remove(l.id);
|
|
1927
1928
|
if (e) {
|
|
1928
|
-
f(
|
|
1929
|
+
f(wn(e, a));
|
|
1929
1930
|
return;
|
|
1930
1931
|
}
|
|
1931
|
-
u(null),
|
|
1932
|
+
u(null), A(o("paymentMethods.removed"));
|
|
1932
1933
|
}, j = async (e) => {
|
|
1933
|
-
if (!
|
|
1934
|
+
if (!ne) return;
|
|
1934
1935
|
h(null);
|
|
1935
|
-
let t = await c.setDefault(e.id,
|
|
1936
|
+
let t = await c.setDefault(e.id, ne);
|
|
1936
1937
|
t ? h({
|
|
1937
1938
|
id: e.id,
|
|
1938
1939
|
message: a.error(t)
|
|
1939
|
-
}) :
|
|
1940
|
-
}, M,
|
|
1941
|
-
M =
|
|
1940
|
+
}) : A(o("paymentMethods.defaultUpdated"));
|
|
1941
|
+
}, M, N = c.methods;
|
|
1942
|
+
M = N === null && c.error ? /* @__PURE__ */ I(Y, {
|
|
1942
1943
|
error: c.error,
|
|
1943
1944
|
onRetry: c.refetch
|
|
1944
|
-
}) :
|
|
1945
|
+
}) : N === null ? /* @__PURE__ */ I(Re, {}) : N.length === 0 ? /* @__PURE__ */ I(ze, {
|
|
1945
1946
|
title: o("paymentMethods.empty"),
|
|
1946
1947
|
description: o("paymentMethods.emptyDescription")
|
|
1947
|
-
}) : /* @__PURE__ */
|
|
1948
|
+
}) : /* @__PURE__ */ I("ul", {
|
|
1948
1949
|
className: "-my-1 divide-y divide-border",
|
|
1949
|
-
children:
|
|
1950
|
-
let t =
|
|
1951
|
-
return /* @__PURE__ */
|
|
1950
|
+
children: N.map((e) => {
|
|
1951
|
+
let t = Cn(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);
|
|
1952
|
+
return /* @__PURE__ */ L("li", {
|
|
1952
1953
|
"data-testid": "payment-method-row",
|
|
1953
1954
|
"data-payment-method-id": e.id,
|
|
1954
1955
|
className: "flex flex-wrap items-center gap-x-3 gap-y-2 py-3.5",
|
|
1955
1956
|
children: [
|
|
1956
|
-
/* @__PURE__ */
|
|
1957
|
+
/* @__PURE__ */ I(Ze, {
|
|
1957
1958
|
brand: e.card?.brand ?? void 0,
|
|
1958
1959
|
fallback: (e.card?.brand ?? "card").slice(0, 4)
|
|
1959
1960
|
}),
|
|
1960
|
-
/* @__PURE__ */
|
|
1961
|
+
/* @__PURE__ */ L("div", {
|
|
1961
1962
|
className: "grid min-w-40 flex-1 gap-0.5",
|
|
1962
1963
|
children: [
|
|
1963
|
-
/* @__PURE__ */
|
|
1964
|
+
/* @__PURE__ */ L("div", {
|
|
1964
1965
|
className: "flex flex-wrap items-center gap-x-2 gap-y-1",
|
|
1965
1966
|
children: [
|
|
1966
|
-
/* @__PURE__ */
|
|
1967
|
+
/* @__PURE__ */ I("span", {
|
|
1967
1968
|
className: "text-sm font-medium tabular-nums",
|
|
1968
1969
|
children: t
|
|
1969
1970
|
}),
|
|
1970
|
-
r === "expired" || r === "expiring_soon" ? /* @__PURE__ */
|
|
1971
|
-
i.length > 0 ? /* @__PURE__ */
|
|
1971
|
+
r === "expired" || r === "expiring_soon" ? /* @__PURE__ */ I(Ue, { status: r }) : e.health?.active === !1 ? /* @__PURE__ */ I(Ue, { status: "needs_attention" }) : null,
|
|
1972
|
+
i.length > 0 ? /* @__PURE__ */ I(Ue, {
|
|
1972
1973
|
status: "default",
|
|
1973
1974
|
label: o("paymentMethods.defaultFor", { currencies: i.join(", ") })
|
|
1974
1975
|
}) : null
|
|
1975
1976
|
]
|
|
1976
1977
|
}),
|
|
1977
|
-
l.length > 0 ? /* @__PURE__ */
|
|
1978
|
+
l.length > 0 ? /* @__PURE__ */ I("p", {
|
|
1978
1979
|
className: "text-sm text-muted-foreground tabular-nums",
|
|
1979
1980
|
children: l.join(" · ")
|
|
1980
1981
|
}) : null,
|
|
1981
|
-
p?.id === e.id ? /* @__PURE__ */
|
|
1982
|
+
p?.id === e.id ? /* @__PURE__ */ I("p", {
|
|
1982
1983
|
role: "alert",
|
|
1983
1984
|
className: "text-sm text-destructive",
|
|
1984
1985
|
children: p.message
|
|
1985
1986
|
}) : null
|
|
1986
1987
|
]
|
|
1987
1988
|
}),
|
|
1988
|
-
/* @__PURE__ */
|
|
1989
|
+
/* @__PURE__ */ L("div", {
|
|
1989
1990
|
className: "ml-auto flex items-center gap-1",
|
|
1990
|
-
children: [
|
|
1991
|
+
children: [ne && !i.includes(ne) ? /* @__PURE__ */ L(U, {
|
|
1991
1992
|
variant: "ghost",
|
|
1992
1993
|
size: "sm",
|
|
1993
1994
|
className: "text-muted-foreground",
|
|
1994
1995
|
disabled: !!s,
|
|
1995
1996
|
onClick: () => void j(e),
|
|
1996
|
-
children: [s === "default" ? /* @__PURE__ */
|
|
1997
|
-
}) : null, /* @__PURE__ */
|
|
1997
|
+
children: [s === "default" ? /* @__PURE__ */ I(X, {}) : null, o("paymentMethods.makeDefault")]
|
|
1998
|
+
}) : null, /* @__PURE__ */ I(U, {
|
|
1998
1999
|
variant: "ghost",
|
|
1999
2000
|
size: "icon-sm",
|
|
2000
2001
|
className: "text-muted-foreground hover:text-destructive",
|
|
@@ -2004,8 +2005,8 @@ function wn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2004
2005
|
onClick: () => {
|
|
2005
2006
|
f(null), u(e);
|
|
2006
2007
|
},
|
|
2007
|
-
children: s === "remove" ? /* @__PURE__ */
|
|
2008
|
-
icon:
|
|
2008
|
+
children: s === "remove" ? /* @__PURE__ */ I(X, {}) : /* @__PURE__ */ I(B, {
|
|
2009
|
+
icon: ue,
|
|
2009
2010
|
"aria-hidden": !0
|
|
2010
2011
|
})
|
|
2011
2012
|
})]
|
|
@@ -2014,102 +2015,102 @@ function wn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2014
2015
|
}, e.id);
|
|
2015
2016
|
})
|
|
2016
2017
|
});
|
|
2017
|
-
let
|
|
2018
|
-
return /* @__PURE__ */
|
|
2018
|
+
let F = l ? c.pending[l.id] === "remove" : !1, R = l ? Cn(l, a) : "";
|
|
2019
|
+
return /* @__PURE__ */ L(Le, {
|
|
2019
2020
|
title: o("paymentMethods.title"),
|
|
2020
2021
|
description: o("paymentMethods.description"),
|
|
2021
2022
|
appearance: n,
|
|
2022
2023
|
className: r,
|
|
2023
2024
|
"data-testid": "payment-methods-panel",
|
|
2024
|
-
action:
|
|
2025
|
+
action: O ? /* @__PURE__ */ L(U, {
|
|
2025
2026
|
variant: "outline",
|
|
2026
2027
|
size: "sm",
|
|
2027
2028
|
onClick: () => v(!0),
|
|
2028
|
-
children: [/* @__PURE__ */
|
|
2029
|
-
icon:
|
|
2029
|
+
children: [/* @__PURE__ */ I(B, {
|
|
2030
|
+
icon: se,
|
|
2030
2031
|
"aria-hidden": !0,
|
|
2031
2032
|
"data-icon": "inline-start"
|
|
2032
2033
|
}), o("paymentMethods.add")]
|
|
2033
2034
|
}) : null,
|
|
2034
2035
|
children: [
|
|
2035
2036
|
M,
|
|
2036
|
-
|
|
2037
|
+
N !== null && c.error ? /* @__PURE__ */ I("div", {
|
|
2037
2038
|
className: "pt-3",
|
|
2038
|
-
children: /* @__PURE__ */
|
|
2039
|
+
children: /* @__PURE__ */ I(Y, {
|
|
2039
2040
|
error: c.error,
|
|
2040
2041
|
onRetry: c.refetch
|
|
2041
2042
|
})
|
|
2042
2043
|
}) : null,
|
|
2043
|
-
y.error ? /* @__PURE__ */
|
|
2044
|
+
y.error ? /* @__PURE__ */ I("div", {
|
|
2044
2045
|
className: "pt-3",
|
|
2045
|
-
children: /* @__PURE__ */
|
|
2046
|
+
children: /* @__PURE__ */ I(Y, {
|
|
2046
2047
|
error: y.error,
|
|
2047
2048
|
message: o("paymentMethods.addUnavailable"),
|
|
2048
2049
|
onRetry: y.refetch
|
|
2049
2050
|
})
|
|
2050
|
-
}) : w === null ? null : /* @__PURE__ */
|
|
2051
|
+
}) : w === null ? null : /* @__PURE__ */ I("p", {
|
|
2051
2052
|
role: "status",
|
|
2052
2053
|
className: "pt-3 text-sm text-muted-foreground",
|
|
2053
2054
|
children: o("paymentMethods.addUnavailable")
|
|
2054
2055
|
}),
|
|
2055
|
-
|
|
2056
|
-
/* @__PURE__ */
|
|
2056
|
+
k,
|
|
2057
|
+
/* @__PURE__ */ I(Qe, {
|
|
2057
2058
|
open: l !== null,
|
|
2058
2059
|
onOpenChange: (e) => {
|
|
2059
|
-
!e && !
|
|
2060
|
+
!e && !F && u(null);
|
|
2060
2061
|
},
|
|
2061
|
-
children: /* @__PURE__ */
|
|
2062
|
-
className: `${s.className} ${
|
|
2062
|
+
children: /* @__PURE__ */ L(tt, {
|
|
2063
|
+
className: `${s.className} ${K} bg-popover text-popover-foreground`,
|
|
2063
2064
|
"data-orck-theme": s["data-orck-theme"],
|
|
2064
2065
|
style: s.style,
|
|
2065
2066
|
children: [
|
|
2066
|
-
/* @__PURE__ */
|
|
2067
|
-
d ? /* @__PURE__ */
|
|
2067
|
+
/* @__PURE__ */ L(nt, { children: [/* @__PURE__ */ I(it, { children: o("paymentMethods.removeTitle", { label: R }) }), /* @__PURE__ */ I(at, { children: o("paymentMethods.removeDescription") })] }),
|
|
2068
|
+
d ? /* @__PURE__ */ I("p", {
|
|
2068
2069
|
role: "alert",
|
|
2069
2070
|
className: "text-sm text-destructive",
|
|
2070
2071
|
children: d
|
|
2071
2072
|
}) : null,
|
|
2072
|
-
/* @__PURE__ */
|
|
2073
|
-
disabled:
|
|
2073
|
+
/* @__PURE__ */ L(rt, { children: [/* @__PURE__ */ I(ot, {
|
|
2074
|
+
disabled: F,
|
|
2074
2075
|
children: o("common.cancel")
|
|
2075
|
-
}), /* @__PURE__ */
|
|
2076
|
+
}), /* @__PURE__ */ L(U, {
|
|
2076
2077
|
variant: "destructive",
|
|
2077
|
-
disabled:
|
|
2078
|
-
onClick: () => void
|
|
2079
|
-
children: [
|
|
2078
|
+
disabled: F,
|
|
2079
|
+
onClick: () => void re(),
|
|
2080
|
+
children: [F ? /* @__PURE__ */ I(X, {}) : null, o("paymentMethods.removeConfirm")]
|
|
2080
2081
|
})] })
|
|
2081
2082
|
]
|
|
2082
2083
|
})
|
|
2083
2084
|
}),
|
|
2084
|
-
|
|
2085
|
+
O ? /* @__PURE__ */ I(st, {
|
|
2085
2086
|
open: g,
|
|
2086
2087
|
onOpenChange: v,
|
|
2087
|
-
children: /* @__PURE__ */
|
|
2088
|
-
className: `${s.className} ${
|
|
2088
|
+
children: /* @__PURE__ */ L(ut, {
|
|
2089
|
+
className: `${s.className} ${K} max-h-[calc(100dvh-2rem)] overflow-y-auto bg-popover text-popover-foreground`,
|
|
2089
2090
|
"data-orck-theme": s["data-orck-theme"],
|
|
2090
2091
|
style: s.style,
|
|
2091
2092
|
children: [
|
|
2092
|
-
/* @__PURE__ */
|
|
2093
|
-
C.length > 1 ? /* @__PURE__ */
|
|
2093
|
+
/* @__PURE__ */ L(dt, { children: [/* @__PURE__ */ I(pt, { children: o("paymentMethods.addTitle") }), /* @__PURE__ */ I(mt, { children: o("paymentMethods.addDescription") })] }),
|
|
2094
|
+
C.length > 1 ? /* @__PURE__ */ L("label", {
|
|
2094
2095
|
className: "grid gap-1.5 text-sm",
|
|
2095
|
-
children: [o("paymentMethods.provider"), /* @__PURE__ */
|
|
2096
|
+
children: [o("paymentMethods.provider"), /* @__PURE__ */ I("select", {
|
|
2096
2097
|
className: "h-9 rounded-md border border-input bg-transparent px-2",
|
|
2097
|
-
value:
|
|
2098
|
-
onChange: (e) =>
|
|
2099
|
-
children: C.map((e) => /* @__PURE__ */
|
|
2098
|
+
value: O.psp_id,
|
|
2099
|
+
onChange: (e) => D(e.target.value),
|
|
2100
|
+
children: C.map((e) => /* @__PURE__ */ I("option", {
|
|
2100
2101
|
value: e.psp_id,
|
|
2101
2102
|
children: e.display_name
|
|
2102
2103
|
}, e.psp_id))
|
|
2103
2104
|
})]
|
|
2104
2105
|
}) : null,
|
|
2105
|
-
/* @__PURE__ */
|
|
2106
|
-
psp:
|
|
2106
|
+
/* @__PURE__ */ I(_n, {
|
|
2107
|
+
psp: O,
|
|
2107
2108
|
defaultCountry: t,
|
|
2108
2109
|
appearance: n,
|
|
2109
2110
|
onSaved: () => {
|
|
2110
|
-
v(!1),
|
|
2111
|
+
v(!1), A(o("paymentMethods.added"));
|
|
2111
2112
|
}
|
|
2112
|
-
},
|
|
2113
|
+
}, O.psp_id)
|
|
2113
2114
|
]
|
|
2114
2115
|
})
|
|
2115
2116
|
}) : null
|
|
@@ -2118,47 +2119,47 @@ function wn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2118
2119
|
}
|
|
2119
2120
|
//#endregion
|
|
2120
2121
|
//#region src/components/ui/textarea.tsx
|
|
2121
|
-
function
|
|
2122
|
-
return /* @__PURE__ */
|
|
2122
|
+
function En({ className: e, ...t }) {
|
|
2123
|
+
return /* @__PURE__ */ I("textarea", {
|
|
2123
2124
|
"data-slot": "textarea",
|
|
2124
|
-
className:
|
|
2125
|
+
className: R("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
2126
|
...t
|
|
2126
2127
|
});
|
|
2127
2128
|
}
|
|
2128
2129
|
//#endregion
|
|
2129
2130
|
//#region src/account/cancel-dialog.tsx
|
|
2130
|
-
function
|
|
2131
|
-
let s = S(), { t: c } = s, l = x(o), u =
|
|
2131
|
+
function Dn({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, onConfirm: a, appearance: o }) {
|
|
2132
|
+
let s = S(), { t: c } = s, l = x(o), u = P.useId(), d = P.useId(), [f, m] = P.useState(""), [h, g] = P.useState(!1), [_, v] = P.useState(null), y = i !== void 0, b = f.trim().length, C = b < 4, w = async () => {
|
|
2132
2133
|
if (g(!0), C || y) return;
|
|
2133
2134
|
v(null);
|
|
2134
2135
|
let e = await a(f);
|
|
2135
2136
|
e ? p(e) || v(e) : t(!1);
|
|
2136
2137
|
}, 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__ */
|
|
2138
|
+
return /* @__PURE__ */ I(Qe, {
|
|
2138
2139
|
open: e,
|
|
2139
2140
|
onOpenChange: (e) => {
|
|
2140
2141
|
!e && y || t(e);
|
|
2141
2142
|
},
|
|
2142
|
-
children: /* @__PURE__ */
|
|
2143
|
-
className: `${l.className} ${
|
|
2143
|
+
children: /* @__PURE__ */ I(tt, {
|
|
2144
|
+
className: `${l.className} ${K} bg-popover text-popover-foreground`,
|
|
2144
2145
|
"data-orck-theme": l["data-orck-theme"],
|
|
2145
2146
|
style: l.style,
|
|
2146
|
-
children: /* @__PURE__ */
|
|
2147
|
+
children: /* @__PURE__ */ L("form", {
|
|
2147
2148
|
className: "grid gap-5",
|
|
2148
2149
|
noValidate: !0,
|
|
2149
2150
|
onSubmit: (e) => {
|
|
2150
2151
|
e.preventDefault(), w();
|
|
2151
2152
|
},
|
|
2152
2153
|
children: [
|
|
2153
|
-
/* @__PURE__ */
|
|
2154
|
-
/* @__PURE__ */
|
|
2154
|
+
/* @__PURE__ */ L(nt, { children: [/* @__PURE__ */ I(it, { children: c("cancel.title", { name: n }) }), /* @__PURE__ */ I(at, { children: c(r ? "cancel.solanaDescription" : "cancel.description") })] }),
|
|
2155
|
+
/* @__PURE__ */ L("div", {
|
|
2155
2156
|
className: "grid gap-2",
|
|
2156
2157
|
children: [
|
|
2157
|
-
/* @__PURE__ */
|
|
2158
|
+
/* @__PURE__ */ I(Z, {
|
|
2158
2159
|
htmlFor: u,
|
|
2159
2160
|
children: c("cancel.reasonLabel")
|
|
2160
2161
|
}),
|
|
2161
|
-
/* @__PURE__ */
|
|
2162
|
+
/* @__PURE__ */ I(En, {
|
|
2162
2163
|
id: u,
|
|
2163
2164
|
value: f,
|
|
2164
2165
|
maxLength: 500,
|
|
@@ -2172,13 +2173,13 @@ function En({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, on
|
|
|
2172
2173
|
onChange: (e) => m(e.target.value),
|
|
2173
2174
|
onBlur: () => b > 0 && g(!0)
|
|
2174
2175
|
}),
|
|
2175
|
-
/* @__PURE__ */
|
|
2176
|
+
/* @__PURE__ */ L("div", {
|
|
2176
2177
|
id: d,
|
|
2177
2178
|
className: "flex justify-between gap-3 text-xs text-muted-foreground",
|
|
2178
|
-
children: [/* @__PURE__ */
|
|
2179
|
+
children: [/* @__PURE__ */ I("span", {
|
|
2179
2180
|
className: h && C ? "text-destructive" : "",
|
|
2180
2181
|
children: h && C ? c("cancel.reasonTooShort", { min: 4 }) : ""
|
|
2181
|
-
}), /* @__PURE__ */
|
|
2182
|
+
}), /* @__PURE__ */ I("span", {
|
|
2182
2183
|
className: "tabular-nums",
|
|
2183
2184
|
children: c("cancel.reasonHint", {
|
|
2184
2185
|
count: f.length,
|
|
@@ -2188,19 +2189,19 @@ function En({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, on
|
|
|
2188
2189
|
})
|
|
2189
2190
|
]
|
|
2190
2191
|
}),
|
|
2191
|
-
_ ? /* @__PURE__ */
|
|
2192
|
+
_ ? /* @__PURE__ */ I("p", {
|
|
2192
2193
|
role: "alert",
|
|
2193
2194
|
className: "text-sm text-destructive",
|
|
2194
2195
|
children: s.error(_)
|
|
2195
2196
|
}) : null,
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
+
/* @__PURE__ */ L(rt, { children: [/* @__PURE__ */ I(ot, {
|
|
2197
2198
|
disabled: y,
|
|
2198
2199
|
children: c("cancel.keep")
|
|
2199
|
-
}), /* @__PURE__ */
|
|
2200
|
+
}), /* @__PURE__ */ L(U, {
|
|
2200
2201
|
type: "submit",
|
|
2201
2202
|
variant: "destructive",
|
|
2202
2203
|
disabled: y,
|
|
2203
|
-
children: [y ? /* @__PURE__ */
|
|
2204
|
+
children: [y ? /* @__PURE__ */ I(X, {}) : null, T]
|
|
2204
2205
|
})] })
|
|
2205
2206
|
]
|
|
2206
2207
|
})
|
|
@@ -2209,44 +2210,44 @@ function En({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, on
|
|
|
2209
2210
|
}
|
|
2210
2211
|
//#endregion
|
|
2211
2212
|
//#region src/components/ui/radio-group.tsx
|
|
2212
|
-
function
|
|
2213
|
-
return /* @__PURE__ */
|
|
2213
|
+
function On({ className: e, ...t }) {
|
|
2214
|
+
return /* @__PURE__ */ I(me, {
|
|
2214
2215
|
"data-slot": "radio-group",
|
|
2215
|
-
className:
|
|
2216
|
+
className: R("grid w-full gap-3", e),
|
|
2216
2217
|
...t
|
|
2217
2218
|
});
|
|
2218
2219
|
}
|
|
2219
|
-
function
|
|
2220
|
-
return /* @__PURE__ */
|
|
2220
|
+
function kn({ className: e, ...t }) {
|
|
2221
|
+
return /* @__PURE__ */ I(pe.Root, {
|
|
2221
2222
|
"data-slot": "radio-group-item",
|
|
2222
|
-
className:
|
|
2223
|
+
className: R("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
2224
|
...t,
|
|
2224
|
-
children: /* @__PURE__ */
|
|
2225
|
+
children: /* @__PURE__ */ I(pe.Indicator, {
|
|
2225
2226
|
"data-slot": "radio-group-indicator",
|
|
2226
2227
|
className: "flex size-4 items-center justify-center",
|
|
2227
|
-
children: /* @__PURE__ */
|
|
2228
|
+
children: /* @__PURE__ */ I("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
2229
|
})
|
|
2229
2230
|
});
|
|
2230
2231
|
}
|
|
2231
2232
|
//#endregion
|
|
2232
2233
|
//#region src/account/change-card-dialog.tsx
|
|
2233
|
-
var
|
|
2234
|
-
function
|
|
2234
|
+
var An = "default";
|
|
2235
|
+
function jn(e, t) {
|
|
2235
2236
|
return t.filter((t) => t.health?.expiry_status !== "expired" && (!e.psp_id || !t.psp_id || t.psp_id === e.psp_id) && (!e.rail || !t.rail || t.rail === e.rail));
|
|
2236
2237
|
}
|
|
2237
|
-
function
|
|
2238
|
+
function Mn({ subscription: e, name: t, onOpenChange: n, pending: r, onConfirm: i, appearance: a }) {
|
|
2238
2239
|
let o = x(a);
|
|
2239
|
-
return /* @__PURE__ */
|
|
2240
|
+
return /* @__PURE__ */ I(st, {
|
|
2240
2241
|
open: e !== null,
|
|
2241
2242
|
onOpenChange: (e) => {
|
|
2242
2243
|
!e && r || n(e);
|
|
2243
2244
|
},
|
|
2244
|
-
children: /* @__PURE__ */
|
|
2245
|
+
children: /* @__PURE__ */ I(ut, {
|
|
2245
2246
|
showCloseButton: !1,
|
|
2246
|
-
className: `${o.className} ${
|
|
2247
|
+
className: `${o.className} ${K} bg-popover text-popover-foreground`,
|
|
2247
2248
|
"data-orck-theme": o["data-orck-theme"],
|
|
2248
2249
|
style: o.style,
|
|
2249
|
-
children: e ? /* @__PURE__ */
|
|
2250
|
+
children: e ? /* @__PURE__ */ I(Nn, {
|
|
2250
2251
|
subscription: e,
|
|
2251
2252
|
name: t,
|
|
2252
2253
|
pending: r,
|
|
@@ -2256,9 +2257,9 @@ function jn({ subscription: e, name: t, onOpenChange: n, pending: r, onConfirm:
|
|
|
2256
2257
|
})
|
|
2257
2258
|
});
|
|
2258
2259
|
}
|
|
2259
|
-
function
|
|
2260
|
-
let a = S(), { t: o } = a, s =
|
|
2261
|
-
id:
|
|
2260
|
+
function Nn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i }) {
|
|
2261
|
+
let a = S(), { t: o } = a, s = P.useId(), c = te(), l = e.payment_method_id ?? An, [u, d] = P.useState(l), [f, p] = P.useState(null), m = c.methods ? jn(e, c.methods) : null, h = e.price?.currency?.toUpperCase(), g = h ? m?.find((e) => (e.default_currencies ?? []).includes(h)) : void 0, _ = [...g ? [{
|
|
2262
|
+
id: An,
|
|
2262
2263
|
card: g
|
|
2263
2264
|
}] : [], ...(m ?? []).map((e) => ({
|
|
2264
2265
|
id: e.id,
|
|
@@ -2266,13 +2267,13 @@ function Mn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i })
|
|
|
2266
2267
|
}))], v = _.some((e) => e.id !== l), y = async () => {
|
|
2267
2268
|
if (!u || u === l || n) return;
|
|
2268
2269
|
p(null);
|
|
2269
|
-
let e = await i(u ===
|
|
2270
|
+
let e = await i(u === An ? null : u);
|
|
2270
2271
|
e && p(e);
|
|
2271
2272
|
}, b;
|
|
2272
|
-
return b = m === null && c.error ? /* @__PURE__ */
|
|
2273
|
+
return b = m === null && c.error ? /* @__PURE__ */ I(Y, {
|
|
2273
2274
|
error: c.error,
|
|
2274
2275
|
onRetry: c.refetch
|
|
2275
|
-
}) : m === null ? /* @__PURE__ */
|
|
2276
|
+
}) : m === null ? /* @__PURE__ */ I(Re, { rows: 2 }) : /* @__PURE__ */ I(On, {
|
|
2276
2277
|
value: u,
|
|
2277
2278
|
onValueChange: (e) => {
|
|
2278
2279
|
typeof e == "string" && e && d(e);
|
|
@@ -2281,65 +2282,65 @@ function Mn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i })
|
|
|
2281
2282
|
"aria-label": o("changeCard.title", { name: t }),
|
|
2282
2283
|
className: "grid gap-0",
|
|
2283
2284
|
children: _.map(({ id: e, card: t }) => {
|
|
2284
|
-
let r = `${s}-${e}`, i =
|
|
2285
|
-
return /* @__PURE__ */
|
|
2285
|
+
let r = `${s}-${e}`, i = Te(t.card, a);
|
|
2286
|
+
return /* @__PURE__ */ L(Z, {
|
|
2286
2287
|
htmlFor: r,
|
|
2287
2288
|
"data-testid": "change-card-option",
|
|
2288
|
-
className:
|
|
2289
|
+
className: R("flex cursor-pointer items-center gap-3 py-1.5 select-none", n && "cursor-default"),
|
|
2289
2290
|
children: [
|
|
2290
|
-
/* @__PURE__ */
|
|
2291
|
+
/* @__PURE__ */ I(kn, {
|
|
2291
2292
|
id: r,
|
|
2292
2293
|
value: e
|
|
2293
2294
|
}),
|
|
2294
|
-
/* @__PURE__ */
|
|
2295
|
+
/* @__PURE__ */ I(Ze, {
|
|
2295
2296
|
brand: t.card?.brand ?? void 0,
|
|
2296
2297
|
fallback: (t.card?.brand ?? "card").slice(0, 4)
|
|
2297
2298
|
}),
|
|
2298
|
-
/* @__PURE__ */
|
|
2299
|
+
/* @__PURE__ */ I("span", {
|
|
2299
2300
|
className: "min-w-0 flex-1 truncate text-sm font-medium tabular-nums",
|
|
2300
|
-
children: e ===
|
|
2301
|
+
children: e === An ? o("changeCard.useDefault", { card: i }) : i
|
|
2301
2302
|
}),
|
|
2302
|
-
e === l ? /* @__PURE__ */
|
|
2303
|
+
e === l ? /* @__PURE__ */ I("span", {
|
|
2303
2304
|
className: "shrink-0 text-xs text-muted-foreground",
|
|
2304
2305
|
children: o("changeCard.current")
|
|
2305
2306
|
}) : null
|
|
2306
2307
|
]
|
|
2307
2308
|
}, e);
|
|
2308
2309
|
})
|
|
2309
|
-
}), /* @__PURE__ */
|
|
2310
|
+
}), /* @__PURE__ */ L("form", {
|
|
2310
2311
|
className: "grid gap-5",
|
|
2311
2312
|
noValidate: !0,
|
|
2312
2313
|
onSubmit: (e) => {
|
|
2313
2314
|
e.preventDefault(), y();
|
|
2314
2315
|
},
|
|
2315
2316
|
children: [
|
|
2316
|
-
/* @__PURE__ */
|
|
2317
|
+
/* @__PURE__ */ L(dt, { children: [/* @__PURE__ */ I(pt, { children: o("changeCard.title", { name: t }) }), /* @__PURE__ */ I(mt, { children: o(m !== null && !v ? "changeCard.none" : "changeCard.description") })] }),
|
|
2317
2318
|
b,
|
|
2318
|
-
f ? /* @__PURE__ */
|
|
2319
|
+
f ? /* @__PURE__ */ I("p", {
|
|
2319
2320
|
role: "alert",
|
|
2320
2321
|
className: "text-sm text-destructive",
|
|
2321
2322
|
children: a.error(f)
|
|
2322
2323
|
}) : null,
|
|
2323
|
-
/* @__PURE__ */
|
|
2324
|
+
/* @__PURE__ */ L(ft, { children: [/* @__PURE__ */ I(U, {
|
|
2324
2325
|
type: "button",
|
|
2325
2326
|
variant: "outline",
|
|
2326
2327
|
disabled: n,
|
|
2327
2328
|
onClick: r,
|
|
2328
2329
|
children: o("common.cancel")
|
|
2329
|
-
}), /* @__PURE__ */
|
|
2330
|
+
}), /* @__PURE__ */ L(U, {
|
|
2330
2331
|
type: "submit",
|
|
2331
2332
|
disabled: n || !u || u === l,
|
|
2332
|
-
children: [n ? /* @__PURE__ */
|
|
2333
|
+
children: [n ? /* @__PURE__ */ I(X, {}) : null, o("changeCard.confirm")]
|
|
2333
2334
|
})] })
|
|
2334
2335
|
]
|
|
2335
2336
|
});
|
|
2336
2337
|
}
|
|
2337
2338
|
//#endregion
|
|
2338
2339
|
//#region src/account/subscriptions-panel.tsx
|
|
2339
|
-
function
|
|
2340
|
-
let o = S(), { t: s } = o, { locale: c, navigate: l } =
|
|
2340
|
+
function Pn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter: n, appearance: r, className: i, ...a }) {
|
|
2341
|
+
let o = S(), { t: s } = o, { locale: c, navigate: l } = k(), u = A(a), d = O(), [f, p] = P.useState(null), [m, h] = P.useState(null), [g, _] = P.useState(null), [v, y] = Sn(), b = P.useMemo(() => {
|
|
2341
2342
|
let e = u.subscriptions ?? [];
|
|
2342
|
-
return [...e.filter(
|
|
2343
|
+
return [...e.filter(G), ...e.filter((e) => !G(e))];
|
|
2343
2344
|
}, [u.subscriptions]), x = async (e) => {
|
|
2344
2345
|
_(null);
|
|
2345
2346
|
let t = await u.resume(e.id);
|
|
@@ -2348,15 +2349,15 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2348
2349
|
message: o.error(t)
|
|
2349
2350
|
}) : y(s("subscriptions.resumed"));
|
|
2350
2351
|
}, C = f?.rail === "solana", w;
|
|
2351
|
-
return w = u.subscriptions === null && u.error ? /* @__PURE__ */
|
|
2352
|
+
return w = u.subscriptions === null && u.error ? /* @__PURE__ */ I(Y, {
|
|
2352
2353
|
error: u.error,
|
|
2353
2354
|
onRetry: u.refetch
|
|
2354
|
-
}) : u.subscriptions === null ? /* @__PURE__ */
|
|
2355
|
+
}) : u.subscriptions === null ? /* @__PURE__ */ I(Re, {}) : b.length === 0 ? /* @__PURE__ */ I(ze, {
|
|
2355
2356
|
title: s("subscriptions.empty"),
|
|
2356
2357
|
description: s("subscriptions.emptyDescription"),
|
|
2357
|
-
action: t ? /* @__PURE__ */
|
|
2358
|
+
action: t ? /* @__PURE__ */ I("a", {
|
|
2358
2359
|
href: t,
|
|
2359
|
-
className:
|
|
2360
|
+
className: ge({
|
|
2360
2361
|
variant: "outline",
|
|
2361
2362
|
size: "sm"
|
|
2362
2363
|
}),
|
|
@@ -2365,77 +2366,77 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2365
2366
|
},
|
|
2366
2367
|
children: s("subscriptions.browsePlans")
|
|
2367
2368
|
}) : null
|
|
2368
|
-
}) : /* @__PURE__ */
|
|
2369
|
+
}) : /* @__PURE__ */ I("ul", {
|
|
2369
2370
|
className: "-my-1 divide-y divide-border",
|
|
2370
2371
|
children: b.map((t) => {
|
|
2371
|
-
let r =
|
|
2372
|
-
brand:
|
|
2372
|
+
let r = G(t), i = u.pending[t.id], a = Se(t, o), l = t.price ? be(t.price.unit_amount, t.price.currency, d, c) : null, f = xe(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 = ke(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", {
|
|
2373
|
+
brand: we(t.card.brand, s("paymentMethods.fallbackBrand")),
|
|
2373
2374
|
last4: t.card.last4
|
|
2374
|
-
}) : null, T = r && !b ? t.cancel_portal_url : null, E =
|
|
2375
|
-
return /* @__PURE__ */
|
|
2375
|
+
}) : null, T = r && !b ? t.cancel_portal_url : null, E = De.has(t.status) && !b && !T && (t.rail !== "solana" || !!e), D = (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"), O = t.cancel_scheduled ? "cancel_scheduled" : t.status, k = n?.(t);
|
|
2376
|
+
return /* @__PURE__ */ L("li", {
|
|
2376
2377
|
"data-testid": "subscription-row",
|
|
2377
2378
|
"data-subscription-id": t.id,
|
|
2378
2379
|
className: "grid gap-3 py-4 @md:grid-cols-[1fr_auto] @md:items-center",
|
|
2379
2380
|
children: [
|
|
2380
|
-
/* @__PURE__ */
|
|
2381
|
+
/* @__PURE__ */ L("div", {
|
|
2381
2382
|
className: "grid min-w-0 gap-1",
|
|
2382
2383
|
children: [
|
|
2383
|
-
/* @__PURE__ */
|
|
2384
|
+
/* @__PURE__ */ L("div", {
|
|
2384
2385
|
className: "flex flex-wrap items-center gap-x-2 gap-y-1",
|
|
2385
|
-
children: [/* @__PURE__ */
|
|
2386
|
-
className:
|
|
2386
|
+
children: [/* @__PURE__ */ I("span", {
|
|
2387
|
+
className: R("truncate text-sm font-semibold", !r && "text-muted-foreground"),
|
|
2387
2388
|
children: a
|
|
2388
|
-
}), /* @__PURE__ */
|
|
2389
|
+
}), /* @__PURE__ */ I(Ue, { status: O })]
|
|
2389
2390
|
}),
|
|
2390
|
-
/* @__PURE__ */
|
|
2391
|
+
/* @__PURE__ */ I("p", {
|
|
2391
2392
|
className: "text-sm text-muted-foreground tabular-nums",
|
|
2392
2393
|
children: [C, w].filter(Boolean).join(" · ") || s("common.notAvailable")
|
|
2393
2394
|
}),
|
|
2394
|
-
l ? /* @__PURE__ */
|
|
2395
|
-
className:
|
|
2396
|
-
children: [/* @__PURE__ */
|
|
2395
|
+
l ? /* @__PURE__ */ L("p", {
|
|
2396
|
+
className: R("text-sm tabular-nums", !r && "text-muted-foreground"),
|
|
2397
|
+
children: [/* @__PURE__ */ I("span", {
|
|
2397
2398
|
className: "font-medium",
|
|
2398
2399
|
children: l
|
|
2399
|
-
}), f ? /* @__PURE__ */
|
|
2400
|
+
}), f ? /* @__PURE__ */ L("span", {
|
|
2400
2401
|
className: "text-muted-foreground",
|
|
2401
2402
|
children: [" ", f]
|
|
2402
2403
|
}) : null]
|
|
2403
2404
|
}) : null,
|
|
2404
|
-
t.status === "past_due" || t.status === "awaiting_method" ? /* @__PURE__ */
|
|
2405
|
+
t.status === "past_due" || t.status === "awaiting_method" ? /* @__PURE__ */ I("p", {
|
|
2405
2406
|
className: "text-sm text-destructive",
|
|
2406
2407
|
children: s("subscriptions.pastDue")
|
|
2407
2408
|
}) : null,
|
|
2408
|
-
g?.id === t.id ? /* @__PURE__ */
|
|
2409
|
+
g?.id === t.id ? /* @__PURE__ */ I("p", {
|
|
2409
2410
|
role: "alert",
|
|
2410
2411
|
className: "text-sm text-destructive",
|
|
2411
2412
|
children: g.message
|
|
2412
2413
|
}) : null
|
|
2413
2414
|
]
|
|
2414
2415
|
}),
|
|
2415
|
-
/* @__PURE__ */
|
|
2416
|
+
/* @__PURE__ */ L("div", {
|
|
2416
2417
|
className: "flex flex-wrap gap-2 @md:justify-end",
|
|
2417
2418
|
children: [
|
|
2418
|
-
t.resumable ? /* @__PURE__ */
|
|
2419
|
+
t.resumable ? /* @__PURE__ */ L(U, {
|
|
2419
2420
|
variant: "outline",
|
|
2420
2421
|
size: "sm",
|
|
2421
2422
|
disabled: !!i,
|
|
2422
2423
|
onClick: () => void x(t),
|
|
2423
|
-
children: [i === "resume" ? /* @__PURE__ */
|
|
2424
|
+
children: [i === "resume" ? /* @__PURE__ */ I(X, {}) : null, s(i === "resume" ? "subscriptions.updating" : "subscriptions.resume")]
|
|
2424
2425
|
}) : null,
|
|
2425
|
-
T ? /* @__PURE__ */
|
|
2426
|
+
T ? /* @__PURE__ */ L("a", {
|
|
2426
2427
|
href: T,
|
|
2427
2428
|
target: "_blank",
|
|
2428
2429
|
rel: "noopener noreferrer",
|
|
2429
|
-
className:
|
|
2430
|
+
className: ge({
|
|
2430
2431
|
variant: "outline",
|
|
2431
2432
|
size: "sm"
|
|
2432
2433
|
}),
|
|
2433
|
-
children: [s("subscriptions.manageAtProvider"), /* @__PURE__ */
|
|
2434
|
-
icon:
|
|
2434
|
+
children: [s("subscriptions.manageAtProvider"), /* @__PURE__ */ I(B, {
|
|
2435
|
+
icon: ce,
|
|
2435
2436
|
"aria-hidden": !0
|
|
2436
2437
|
})]
|
|
2437
2438
|
}) : null,
|
|
2438
|
-
|
|
2439
|
+
D ? /* @__PURE__ */ L(U, {
|
|
2439
2440
|
variant: "outline",
|
|
2440
2441
|
size: "sm",
|
|
2441
2442
|
disabled: !!i,
|
|
@@ -2443,9 +2444,9 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2443
2444
|
onClick: () => {
|
|
2444
2445
|
_(null), h(t);
|
|
2445
2446
|
},
|
|
2446
|
-
children: [i === "payment_method" ? /* @__PURE__ */
|
|
2447
|
+
children: [i === "payment_method" ? /* @__PURE__ */ I(X, {}) : null, s("subscriptions.changeCard")]
|
|
2447
2448
|
}) : null,
|
|
2448
|
-
E ? /* @__PURE__ */
|
|
2449
|
+
E ? /* @__PURE__ */ L(U, {
|
|
2449
2450
|
variant: "ghost",
|
|
2450
2451
|
size: "sm",
|
|
2451
2452
|
className: "text-muted-foreground hover:text-destructive",
|
|
@@ -2454,19 +2455,19 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2454
2455
|
onClick: () => {
|
|
2455
2456
|
_(null), p(t);
|
|
2456
2457
|
},
|
|
2457
|
-
children: [i && i !== "resume" && i !== "payment_method" && i !== "change" ? /* @__PURE__ */
|
|
2458
|
+
children: [i && i !== "resume" && i !== "payment_method" && i !== "change" ? /* @__PURE__ */ I(X, {}) : null, s("subscriptions.cancel")]
|
|
2458
2459
|
}) : null
|
|
2459
2460
|
]
|
|
2460
2461
|
}),
|
|
2461
|
-
|
|
2462
|
+
k ? /* @__PURE__ */ I("div", {
|
|
2462
2463
|
"data-testid": "subscription-footer",
|
|
2463
2464
|
className: "border-t border-border/60 pt-3 @md:col-span-2",
|
|
2464
|
-
children:
|
|
2465
|
+
children: k
|
|
2465
2466
|
}) : null
|
|
2466
2467
|
]
|
|
2467
2468
|
}, t.id);
|
|
2468
2469
|
})
|
|
2469
|
-
}), /* @__PURE__ */
|
|
2470
|
+
}), /* @__PURE__ */ L(Le, {
|
|
2470
2471
|
title: s("subscriptions.title"),
|
|
2471
2472
|
description: s("subscriptions.description"),
|
|
2472
2473
|
appearance: r,
|
|
@@ -2474,17 +2475,17 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2474
2475
|
"data-testid": "subscriptions-panel",
|
|
2475
2476
|
children: [
|
|
2476
2477
|
w,
|
|
2477
|
-
u.subscriptions !== null && u.error ? /* @__PURE__ */
|
|
2478
|
+
u.subscriptions !== null && u.error ? /* @__PURE__ */ I("div", {
|
|
2478
2479
|
className: "pt-3",
|
|
2479
|
-
children: /* @__PURE__ */
|
|
2480
|
+
children: /* @__PURE__ */ I(Y, {
|
|
2480
2481
|
error: u.error,
|
|
2481
2482
|
onRetry: u.refetch
|
|
2482
2483
|
})
|
|
2483
2484
|
}) : null,
|
|
2484
2485
|
v,
|
|
2485
|
-
/* @__PURE__ */
|
|
2486
|
+
/* @__PURE__ */ I(Mn, {
|
|
2486
2487
|
subscription: m,
|
|
2487
|
-
name: m ?
|
|
2488
|
+
name: m ? Se(m, o) : "",
|
|
2488
2489
|
onOpenChange: (e) => !e && h(null),
|
|
2489
2490
|
appearance: r,
|
|
2490
2491
|
pending: !!m && u.pending[m.id] === "payment_method",
|
|
@@ -2494,10 +2495,10 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2494
2495
|
return t || (h(null), y(s("changeCard.done"))), t;
|
|
2495
2496
|
}
|
|
2496
2497
|
}, `card-${m?.id ?? "closed"}`),
|
|
2497
|
-
/* @__PURE__ */
|
|
2498
|
+
/* @__PURE__ */ I(Dn, {
|
|
2498
2499
|
open: f !== null,
|
|
2499
2500
|
onOpenChange: (e) => !e && p(null),
|
|
2500
|
-
name: f ?
|
|
2501
|
+
name: f ? Se(f, o) : "",
|
|
2501
2502
|
onChain: C,
|
|
2502
2503
|
appearance: r,
|
|
2503
2504
|
pending: f ? u.pending[f.id] : void 0,
|
|
@@ -2512,24 +2513,24 @@ function Nn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2512
2513
|
}
|
|
2513
2514
|
//#endregion
|
|
2514
2515
|
//#region src/account/account-billing.tsx
|
|
2515
|
-
function
|
|
2516
|
-
return /* @__PURE__ */
|
|
2516
|
+
function Fn({ defaultCurrency: e, defaultCountry: t, sendSolanaTransaction: n, plansHref: r, renderSubscriptionFooter: i, historyPageSize: a, appearance: o, className: s }) {
|
|
2517
|
+
return /* @__PURE__ */ L(he, {
|
|
2517
2518
|
appearance: o,
|
|
2518
|
-
className:
|
|
2519
|
+
className: R("grid gap-6", s),
|
|
2519
2520
|
"data-testid": "account-billing",
|
|
2520
2521
|
children: [
|
|
2521
|
-
/* @__PURE__ */
|
|
2522
|
+
/* @__PURE__ */ I(Pn, {
|
|
2522
2523
|
sendSolanaTransaction: n,
|
|
2523
2524
|
plansHref: r,
|
|
2524
2525
|
renderSubscriptionFooter: i,
|
|
2525
2526
|
appearance: o
|
|
2526
2527
|
}),
|
|
2527
|
-
/* @__PURE__ */
|
|
2528
|
+
/* @__PURE__ */ I(Tn, {
|
|
2528
2529
|
defaultCurrency: e,
|
|
2529
2530
|
defaultCountry: t,
|
|
2530
2531
|
appearance: o
|
|
2531
2532
|
}),
|
|
2532
|
-
/* @__PURE__ */
|
|
2533
|
+
/* @__PURE__ */ I(Ge, {
|
|
2533
2534
|
pageSize: a,
|
|
2534
2535
|
appearance: o
|
|
2535
2536
|
})
|
|
@@ -2538,61 +2539,61 @@ function Pn({ defaultCurrency: e, defaultCountry: t, sendSolanaTransaction: n, p
|
|
|
2538
2539
|
}
|
|
2539
2540
|
//#endregion
|
|
2540
2541
|
//#region src/components/qr.tsx
|
|
2541
|
-
var
|
|
2542
|
-
function
|
|
2543
|
-
let r =
|
|
2544
|
-
return
|
|
2542
|
+
var In = 208;
|
|
2543
|
+
function Ln({ amountLabel: e, payload: t, statusLine: n }) {
|
|
2544
|
+
let r = P.useRef(null), [i, a] = P.useState("loading");
|
|
2545
|
+
return P.useEffect(() => {
|
|
2545
2546
|
let e = r.current;
|
|
2546
2547
|
if (!e || !t) return;
|
|
2547
2548
|
let n = !1;
|
|
2548
2549
|
return e.replaceChildren(), a("loading"), import("./dist-CslWupfi.js").then(({ createQR: r }) => {
|
|
2549
|
-
n || (r(t,
|
|
2550
|
+
n || (r(t, In, "#ffffff", "#18181b").append(e), a("ready"));
|
|
2550
2551
|
}).catch(() => {
|
|
2551
2552
|
n || a("failed");
|
|
2552
2553
|
}), () => {
|
|
2553
2554
|
n = !0, e.replaceChildren();
|
|
2554
2555
|
};
|
|
2555
|
-
}, [t]), /* @__PURE__ */
|
|
2556
|
+
}, [t]), /* @__PURE__ */ L("div", {
|
|
2556
2557
|
className: "grid justify-items-center gap-3 py-1",
|
|
2557
2558
|
children: [
|
|
2558
|
-
/* @__PURE__ */
|
|
2559
|
+
/* @__PURE__ */ I("div", {
|
|
2559
2560
|
className: "grid place-items-center rounded-xl bg-white p-1 shadow-sm ring-1 ring-black/10",
|
|
2560
|
-
children: t ? /* @__PURE__ */
|
|
2561
|
+
children: t ? /* @__PURE__ */ L("div", {
|
|
2561
2562
|
role: "img",
|
|
2562
2563
|
"aria-label": "Solana Pay QR code",
|
|
2563
2564
|
className: "relative overflow-hidden rounded-lg",
|
|
2564
2565
|
style: {
|
|
2565
|
-
width:
|
|
2566
|
-
height:
|
|
2566
|
+
width: In,
|
|
2567
|
+
height: In
|
|
2567
2568
|
},
|
|
2568
2569
|
children: [
|
|
2569
|
-
/* @__PURE__ */
|
|
2570
|
+
/* @__PURE__ */ I("div", {
|
|
2570
2571
|
ref: r,
|
|
2571
2572
|
className: "absolute inset-0"
|
|
2572
2573
|
}),
|
|
2573
|
-
i === "loading" ? /* @__PURE__ */
|
|
2574
|
+
i === "loading" ? /* @__PURE__ */ I("div", {
|
|
2574
2575
|
"aria-hidden": !0,
|
|
2575
2576
|
className: "absolute inset-0 animate-pulse rounded-lg bg-zinc-100"
|
|
2576
2577
|
}) : null,
|
|
2577
|
-
i === "failed" ? /* @__PURE__ */
|
|
2578
|
+
i === "failed" ? /* @__PURE__ */ I("div", {
|
|
2578
2579
|
className: "absolute inset-0 grid place-items-center text-center text-xs text-zinc-600",
|
|
2579
2580
|
children: "QR code unavailable"
|
|
2580
2581
|
}) : null
|
|
2581
2582
|
]
|
|
2582
|
-
}) : /* @__PURE__ */
|
|
2583
|
+
}) : /* @__PURE__ */ I("div", {
|
|
2583
2584
|
"aria-hidden": !0,
|
|
2584
2585
|
className: "animate-pulse rounded-lg bg-zinc-100",
|
|
2585
2586
|
style: {
|
|
2586
|
-
width:
|
|
2587
|
-
height:
|
|
2587
|
+
width: In,
|
|
2588
|
+
height: In
|
|
2588
2589
|
}
|
|
2589
2590
|
})
|
|
2590
2591
|
}),
|
|
2591
|
-
/* @__PURE__ */
|
|
2592
|
+
/* @__PURE__ */ I("div", {
|
|
2592
2593
|
className: "text-[13px] font-medium text-balance",
|
|
2593
2594
|
children: "Scan with a Solana wallet"
|
|
2594
2595
|
}),
|
|
2595
|
-
/* @__PURE__ */
|
|
2596
|
+
/* @__PURE__ */ L("div", {
|
|
2596
2597
|
className: "text-center text-[12.5px] text-pretty text-muted-foreground tabular-nums",
|
|
2597
2598
|
"aria-live": "polite",
|
|
2598
2599
|
children: [
|
|
@@ -2601,15 +2602,15 @@ function In({ amountLabel: e, payload: t, statusLine: n }) {
|
|
|
2601
2602
|
n
|
|
2602
2603
|
]
|
|
2603
2604
|
}),
|
|
2604
|
-
t ? /* @__PURE__ */
|
|
2605
|
+
t ? /* @__PURE__ */ I("a", {
|
|
2605
2606
|
href: t,
|
|
2606
|
-
className:
|
|
2607
|
+
className: R(ge({ variant: "secondary" }), "h-9 w-full max-w-56"),
|
|
2607
2608
|
children: "Open in wallet"
|
|
2608
2609
|
}) : null
|
|
2609
2610
|
]
|
|
2610
2611
|
});
|
|
2611
2612
|
}
|
|
2612
|
-
var
|
|
2613
|
+
var Rn = {
|
|
2613
2614
|
visa: "VISA",
|
|
2614
2615
|
mastercard: "MC",
|
|
2615
2616
|
amex: "AMEX",
|
|
@@ -2617,19 +2618,19 @@ var Ln = {
|
|
|
2617
2618
|
jcb: "JCB",
|
|
2618
2619
|
diners: "DINERS"
|
|
2619
2620
|
};
|
|
2620
|
-
function Rn(e) {
|
|
2621
|
-
return Ln[e?.trim().toLowerCase() ?? ""] ?? "CARD";
|
|
2622
|
-
}
|
|
2623
2621
|
function zn(e) {
|
|
2622
|
+
return Rn[e?.trim().toLowerCase() ?? ""] ?? "CARD";
|
|
2623
|
+
}
|
|
2624
|
+
function Bn(e) {
|
|
2624
2625
|
let t = e?.trim();
|
|
2625
2626
|
return t ? t[0].toUpperCase() + t.slice(1) : "Card";
|
|
2626
2627
|
}
|
|
2627
|
-
function
|
|
2628
|
+
function Vn(e) {
|
|
2628
2629
|
let t = e.card;
|
|
2629
2630
|
if (!(!t?.exp_month || !t.exp_year)) return `${String(t.exp_month).padStart(2, "0")}/${String(t.exp_year).slice(-2)}`;
|
|
2630
2631
|
}
|
|
2631
|
-
function
|
|
2632
|
-
return /* @__PURE__ */
|
|
2632
|
+
function Hn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
2633
|
+
return /* @__PURE__ */ L(On, {
|
|
2633
2634
|
value: t,
|
|
2634
2635
|
onValueChange: (e) => {
|
|
2635
2636
|
typeof e == "string" && e && n(e);
|
|
@@ -2638,36 +2639,36 @@ function Vn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2638
2639
|
"aria-label": "Saved cards",
|
|
2639
2640
|
className: "grid gap-0",
|
|
2640
2641
|
children: [e.map((e) => {
|
|
2641
|
-
let n = `${i}-${e.id}`, a = t === e.id, o =
|
|
2642
|
-
return /* @__PURE__ */
|
|
2642
|
+
let n = `${i}-${e.id}`, a = t === e.id, o = Vn(e), s = e.card?.brand, c = e.card?.last4;
|
|
2643
|
+
return /* @__PURE__ */ L(Z, {
|
|
2643
2644
|
htmlFor: n,
|
|
2644
|
-
className:
|
|
2645
|
+
className: R("flex cursor-pointer items-center gap-3 py-1.5 select-none", r && "cursor-default"),
|
|
2645
2646
|
children: [
|
|
2646
|
-
/* @__PURE__ */
|
|
2647
|
+
/* @__PURE__ */ I(kn, {
|
|
2647
2648
|
id: n,
|
|
2648
2649
|
value: e.id
|
|
2649
2650
|
}),
|
|
2650
|
-
/* @__PURE__ */
|
|
2651
|
+
/* @__PURE__ */ I(Ze, {
|
|
2651
2652
|
brand: s ?? void 0,
|
|
2652
|
-
fallback:
|
|
2653
|
+
fallback: zn(s)
|
|
2653
2654
|
}),
|
|
2654
|
-
/* @__PURE__ */
|
|
2655
|
-
className:
|
|
2656
|
-
children: [/* @__PURE__ */
|
|
2655
|
+
/* @__PURE__ */ L("span", {
|
|
2656
|
+
className: R("min-w-0 flex-1 truncate text-sm font-medium text-muted-foreground tabular-nums transition-colors", a && "font-semibold text-foreground"),
|
|
2657
|
+
children: [/* @__PURE__ */ L("span", {
|
|
2657
2658
|
className: "sr-only",
|
|
2658
2659
|
children: [
|
|
2659
|
-
|
|
2660
|
+
Bn(s),
|
|
2660
2661
|
" card ending ",
|
|
2661
2662
|
c,
|
|
2662
2663
|
o ? `, expires ${o}` : ""
|
|
2663
2664
|
]
|
|
2664
|
-
}), /* @__PURE__ */
|
|
2665
|
+
}), /* @__PURE__ */ L("span", {
|
|
2665
2666
|
"aria-hidden": !0,
|
|
2666
2667
|
children: [
|
|
2667
|
-
|
|
2668
|
+
Bn(s),
|
|
2668
2669
|
" •••• ",
|
|
2669
2670
|
c ?? "····",
|
|
2670
|
-
o ? /* @__PURE__ */
|
|
2671
|
+
o ? /* @__PURE__ */ L("span", {
|
|
2671
2672
|
className: "font-normal text-muted-foreground",
|
|
2672
2673
|
children: [
|
|
2673
2674
|
" ",
|
|
@@ -2680,19 +2681,19 @@ function Vn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2680
2681
|
})
|
|
2681
2682
|
]
|
|
2682
2683
|
}, e.id);
|
|
2683
|
-
}), /* @__PURE__ */
|
|
2684
|
+
}), /* @__PURE__ */ L(Z, {
|
|
2684
2685
|
htmlFor: `${i}-new`,
|
|
2685
|
-
className:
|
|
2686
|
+
className: R("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
2687
|
children: [
|
|
2687
|
-
/* @__PURE__ */
|
|
2688
|
+
/* @__PURE__ */ I(kn, {
|
|
2688
2689
|
id: `${i}-new`,
|
|
2689
2690
|
value: "new"
|
|
2690
2691
|
}),
|
|
2691
|
-
/* @__PURE__ */
|
|
2692
|
+
/* @__PURE__ */ I("span", {
|
|
2692
2693
|
"aria-hidden": !0,
|
|
2693
|
-
className:
|
|
2694
|
-
children: /* @__PURE__ */
|
|
2695
|
-
icon:
|
|
2694
|
+
className: R("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"),
|
|
2695
|
+
children: /* @__PURE__ */ I(B, {
|
|
2696
|
+
icon: se,
|
|
2696
2697
|
className: "size-3.5"
|
|
2697
2698
|
})
|
|
2698
2699
|
}),
|
|
@@ -2703,34 +2704,34 @@ function Vn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2703
2704
|
}
|
|
2704
2705
|
//#endregion
|
|
2705
2706
|
//#region src/components/states.tsx
|
|
2706
|
-
function
|
|
2707
|
-
return /* @__PURE__ */
|
|
2707
|
+
function Un() {
|
|
2708
|
+
return /* @__PURE__ */ L("div", {
|
|
2708
2709
|
className: "grid gap-4",
|
|
2709
2710
|
"aria-hidden": !0,
|
|
2710
2711
|
children: [
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
2713
|
-
/* @__PURE__ */
|
|
2714
|
-
/* @__PURE__ */
|
|
2715
|
-
/* @__PURE__ */
|
|
2716
|
-
/* @__PURE__ */
|
|
2712
|
+
/* @__PURE__ */ I(J, { className: "h-3 w-24" }),
|
|
2713
|
+
/* @__PURE__ */ I(J, { className: "h-6 w-52" }),
|
|
2714
|
+
/* @__PURE__ */ I(J, { className: "mt-1.5 h-11 w-full" }),
|
|
2715
|
+
/* @__PURE__ */ I(J, { className: "h-28 w-full" }),
|
|
2716
|
+
/* @__PURE__ */ I(J, { className: "h-11 w-full" }),
|
|
2717
|
+
/* @__PURE__ */ I(J, { className: "mt-1 h-[42px] w-full" })
|
|
2717
2718
|
]
|
|
2718
2719
|
});
|
|
2719
2720
|
}
|
|
2720
2721
|
//#endregion
|
|
2721
2722
|
//#region src/components/stripe-wallets.tsx
|
|
2722
|
-
function
|
|
2723
|
-
let a =
|
|
2724
|
-
|
|
2723
|
+
function Wn({ publishableKey: e, amount: t, currency: n, onPaymentMethod: r, onAvailable: i }) {
|
|
2724
|
+
let a = P.useRef(null), o = P.useRef(r), s = P.useRef(i);
|
|
2725
|
+
P.useEffect(() => {
|
|
2725
2726
|
o.current = r, s.current = i;
|
|
2726
2727
|
});
|
|
2727
|
-
let [c, l] =
|
|
2728
|
-
return
|
|
2728
|
+
let [c, l] = P.useState(!1);
|
|
2729
|
+
return P.useEffect(() => {
|
|
2729
2730
|
if (!a.current) return;
|
|
2730
2731
|
let r = !1, i, c = (e) => {
|
|
2731
2732
|
r || (l(e), s.current?.(e));
|
|
2732
2733
|
};
|
|
2733
|
-
return
|
|
2734
|
+
return Gt(e).then((e) => {
|
|
2734
2735
|
if (r || !a.current) return;
|
|
2735
2736
|
let s = e.elements({
|
|
2736
2737
|
mode: "payment",
|
|
@@ -2738,7 +2739,7 @@ function Un({ publishableKey: e, amount: t, currency: n, onPaymentMethod: r, onA
|
|
|
2738
2739
|
currency: n.toLowerCase(),
|
|
2739
2740
|
paymentMethodCreation: "manual",
|
|
2740
2741
|
paymentMethodTypes: ["card"],
|
|
2741
|
-
appearance:
|
|
2742
|
+
appearance: rn(a.current)
|
|
2742
2743
|
}), l = s.create("expressCheckout", { paymentMethods: {
|
|
2743
2744
|
applePay: "auto",
|
|
2744
2745
|
googlePay: "auto",
|
|
@@ -2763,286 +2764,434 @@ function Un({ publishableKey: e, amount: t, currency: n, onPaymentMethod: r, onA
|
|
|
2763
2764
|
e,
|
|
2764
2765
|
t,
|
|
2765
2766
|
n
|
|
2766
|
-
]), /* @__PURE__ */
|
|
2767
|
+
]), /* @__PURE__ */ I("div", {
|
|
2767
2768
|
ref: a,
|
|
2768
2769
|
"data-testid": "stripe-wallets",
|
|
2769
2770
|
style: { visibility: c ? "visible" : "hidden" }
|
|
2770
2771
|
});
|
|
2771
2772
|
}
|
|
2772
2773
|
//#endregion
|
|
2774
|
+
//#region src/fallbacks.ts
|
|
2775
|
+
function Gn(e, t, n) {
|
|
2776
|
+
let r = /* @__PURE__ */ new Set();
|
|
2777
|
+
if (!e) return r;
|
|
2778
|
+
let i = new Map(n.map((e) => [e.psp_id, e.key.toLowerCase()])), a = new Map(Object.entries(e).map(([e, t]) => [e.toLowerCase(), t]));
|
|
2779
|
+
for (let e of t) {
|
|
2780
|
+
let n = a.get(i.get(e.psp_id) ?? "");
|
|
2781
|
+
if (!n) continue;
|
|
2782
|
+
let o = new Set(n.for.map((e) => e.toLowerCase())), s = t.filter((e) => o.has(i.get(e.psp_id) ?? "")), c = s.reduce((e, t) => e + t.failed_attempts, 0);
|
|
2783
|
+
s.length > 0 && c < n.afterFailures && r.add(e.psp_id);
|
|
2784
|
+
}
|
|
2785
|
+
return r;
|
|
2786
|
+
}
|
|
2787
|
+
var Kn = "fallbacks", qn = 4096, Jn = 1024, Yn = 8, Xn = N.string().regex(/^[a-z0-9][a-z0-9_-]{0,62}$/), Zn = N.record(Xn, N.strictObject({
|
|
2788
|
+
for: N.array(Xn).min(1).max(Yn),
|
|
2789
|
+
afterFailures: N.number().int().min(1).max(100)
|
|
2790
|
+
})).refine((e) => {
|
|
2791
|
+
let t = Object.keys(e).length;
|
|
2792
|
+
return t >= 1 && t <= Yn;
|
|
2793
|
+
});
|
|
2794
|
+
function Qn(e, t) {
|
|
2795
|
+
if (!t || Object.keys(t).length === 0) return e;
|
|
2796
|
+
let n = e.indexOf("#"), r = n < 0 ? e : e.slice(0, n), i = n < 0 ? "" : e.slice(n + 1), a = `${Kn}=${encodeURIComponent(JSON.stringify(t))}`;
|
|
2797
|
+
return `${r}#${i ? `${i}&` : ""}${a}`;
|
|
2798
|
+
}
|
|
2799
|
+
function $n(e) {
|
|
2800
|
+
let [t = "", ...n] = e.replace(/^#/, "").split("&"), r = { secret: t.startsWith("pus_") ? t : null };
|
|
2801
|
+
if (e.length > qn) return r;
|
|
2802
|
+
let i = new URLSearchParams(n.join("&")).get(Kn);
|
|
2803
|
+
if (!i || i.length > Jn) return r;
|
|
2804
|
+
try {
|
|
2805
|
+
let e = Zn.safeParse(JSON.parse(i));
|
|
2806
|
+
return e.success ? {
|
|
2807
|
+
...r,
|
|
2808
|
+
fallbacks: e.data
|
|
2809
|
+
} : r;
|
|
2810
|
+
} catch {
|
|
2811
|
+
return r;
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
//#endregion
|
|
2815
|
+
//#region src/components/platform-card-form.tsx
|
|
2816
|
+
function er({ publicKey: e, submitLabel: t, disabled: n, onTokenized: r }) {
|
|
2817
|
+
let i = P.useId().replace(/[^a-zA-Z0-9-]/g, ""), a = P.useMemo(() => ({
|
|
2818
|
+
number: `bt-${i}-number`,
|
|
2819
|
+
expiry: `bt-${i}-expiry`,
|
|
2820
|
+
cvv: `bt-${i}-cvv`
|
|
2821
|
+
}), [i]), [o, s] = P.useState(() => ({
|
|
2822
|
+
...Dt,
|
|
2823
|
+
country: kt()
|
|
2824
|
+
})), [c, l] = P.useState(!1), [u, d] = P.useState(!1), [f, p] = P.useState(!1), [m, h] = P.useState(!1), [g, _] = P.useState(), v = P.useRef(void 0), y = P.useRef(void 0), b = P.useRef(!1), x = P.useRef({
|
|
2825
|
+
generation: 0,
|
|
2826
|
+
disabled: n
|
|
2827
|
+
});
|
|
2828
|
+
P.useLayoutEffect(() => {
|
|
2829
|
+
x.current = {
|
|
2830
|
+
generation: x.current.generation + 1,
|
|
2831
|
+
disabled: n
|
|
2832
|
+
};
|
|
2833
|
+
}, [e, n]), P.useEffect(() => {
|
|
2834
|
+
let t = !0, n = M(e), r = n.createElement("cardNumber"), i = n.createElement("expiry"), o = n.createElement("cvv");
|
|
2835
|
+
return Promise.all([
|
|
2836
|
+
r.mount(`#${a.number}`),
|
|
2837
|
+
i.mount(`#${a.expiry}`),
|
|
2838
|
+
o.mount(`#${a.cvv}`)
|
|
2839
|
+
]).then(() => {
|
|
2840
|
+
t && (y.current = async () => (await n.tokenIntents.create({
|
|
2841
|
+
type: "card",
|
|
2842
|
+
data: {
|
|
2843
|
+
number: r,
|
|
2844
|
+
expiration_month: i,
|
|
2845
|
+
expiration_year: i,
|
|
2846
|
+
cvc: o
|
|
2847
|
+
}
|
|
2848
|
+
})).id, l(!0));
|
|
2849
|
+
}, () => {
|
|
2850
|
+
t && _("Secure card entry could not be loaded.");
|
|
2851
|
+
}), () => {
|
|
2852
|
+
t = !1, x.current.generation++, y.current = void 0, n.destroy();
|
|
2853
|
+
};
|
|
2854
|
+
}, [e, a]);
|
|
2855
|
+
let S = async (e) => {
|
|
2856
|
+
if (e.preventDefault(), n || b.current || f || !y.current) return;
|
|
2857
|
+
let t = Tt.safeParse(o);
|
|
2858
|
+
if (!t.success) {
|
|
2859
|
+
_(t.error.issues[0]?.message ?? "Check the billing details");
|
|
2860
|
+
return;
|
|
2861
|
+
}
|
|
2862
|
+
b.current = !0, d(!0), _(void 0);
|
|
2863
|
+
let i = x.current.generation;
|
|
2864
|
+
try {
|
|
2865
|
+
let e = v.current ?? {
|
|
2866
|
+
payment_token: await y.current(),
|
|
2867
|
+
...t.data
|
|
2868
|
+
};
|
|
2869
|
+
if (x.current.generation !== i || x.current.disabled) return;
|
|
2870
|
+
v.current = e, await r(e) ? p(!0) : v.current = void 0, h(!1);
|
|
2871
|
+
} catch {
|
|
2872
|
+
let e = !!v.current;
|
|
2873
|
+
h(e), _(e ? "The payment result is not confirmed. Retry to check the same payment." : "Check your card details and try again.");
|
|
2874
|
+
} finally {
|
|
2875
|
+
b.current = !1, d(!1);
|
|
2876
|
+
}
|
|
2877
|
+
};
|
|
2878
|
+
return /* @__PURE__ */ L("form", {
|
|
2879
|
+
"aria-label": "Secure platform card payment",
|
|
2880
|
+
className: "grid gap-4",
|
|
2881
|
+
onSubmit: (e) => void S(e),
|
|
2882
|
+
children: [
|
|
2883
|
+
/* @__PURE__ */ I(It, {
|
|
2884
|
+
idPrefix: `bt-${i}`,
|
|
2885
|
+
value: o,
|
|
2886
|
+
onChange: s,
|
|
2887
|
+
disabled: n || u || m || f
|
|
2888
|
+
}),
|
|
2889
|
+
/* @__PURE__ */ I(Bt, {
|
|
2890
|
+
ids: a,
|
|
2891
|
+
preview: !1
|
|
2892
|
+
}),
|
|
2893
|
+
g ? /* @__PURE__ */ I("p", {
|
|
2894
|
+
role: "alert",
|
|
2895
|
+
className: "text-sm text-destructive",
|
|
2896
|
+
children: g
|
|
2897
|
+
}) : null,
|
|
2898
|
+
/* @__PURE__ */ I(Q, {
|
|
2899
|
+
label: m ? "Retry payment" : t,
|
|
2900
|
+
processing: u,
|
|
2901
|
+
disabled: n || f || !c
|
|
2902
|
+
}),
|
|
2903
|
+
/* @__PURE__ */ I(Ut, {})
|
|
2904
|
+
]
|
|
2905
|
+
});
|
|
2906
|
+
}
|
|
2907
|
+
//#endregion
|
|
2773
2908
|
//#region src/order-payment.tsx
|
|
2774
|
-
var
|
|
2775
|
-
function
|
|
2776
|
-
let
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
}),
|
|
2909
|
+
var tr = (e) => e.custodian === "platform" && e.rail === "nmi" && e.flow === "tokenize" && !e.status && !!e.config?.public_api_key, nr = (e) => e.status === "complete" || e.status === "processing", rr = 3e3;
|
|
2910
|
+
function ir({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0, serverCardEntry: a = !0, wallets: o = !1, fallbacks: c, onSettled: l, appearance: u, className: p }) {
|
|
2911
|
+
let m = S(), h = T(), g = t ?? h.client, { config: _ } = y(), { config: v } = ee(), b = O(), [x, w] = P.useState(), [D, k] = P.useState([]), [A, te] = P.useState("new"), [ne, re] = P.useState(), [j, M] = P.useState(), [N, ie] = P.useState(!1), [z, ae] = P.useState(), [oe, B] = P.useState(!1), [se, ce] = P.useState(() => crypto.randomUUID()), le = P.useRef(null), ue = P.useRef(l);
|
|
2912
|
+
P.useEffect(() => {
|
|
2913
|
+
ue.current = l;
|
|
2914
|
+
}), P.useEffect(() => {
|
|
2780
2915
|
let t = new AbortController();
|
|
2781
|
-
return
|
|
2782
|
-
t.signal.aborted ||
|
|
2916
|
+
return g.getOrder(e, t.signal).then(w, (e) => {
|
|
2917
|
+
t.signal.aborted || M(m.error(e));
|
|
2783
2918
|
}), () => t.abort();
|
|
2784
2919
|
}, [
|
|
2785
|
-
|
|
2920
|
+
g,
|
|
2786
2921
|
e,
|
|
2787
|
-
|
|
2788
|
-
]),
|
|
2789
|
-
if (!i ||
|
|
2922
|
+
m
|
|
2923
|
+
]), P.useEffect(() => {
|
|
2924
|
+
if (!i || x?.collection_owner !== "engine") return;
|
|
2790
2925
|
let e = new AbortController();
|
|
2791
|
-
return
|
|
2926
|
+
return g.listPaymentMethods({ signal: e.signal }).then((e) => k(e.data), () => void 0), () => e.abort();
|
|
2792
2927
|
}, [
|
|
2793
|
-
|
|
2928
|
+
g,
|
|
2794
2929
|
i,
|
|
2795
|
-
|
|
2796
|
-
]),
|
|
2797
|
-
|
|
2798
|
-
}, [
|
|
2799
|
-
let
|
|
2800
|
-
|
|
2801
|
-
if (!
|
|
2930
|
+
x?.collection_owner
|
|
2931
|
+
]), P.useEffect(() => {
|
|
2932
|
+
x && nr(x) && ue.current?.(x);
|
|
2933
|
+
}, [x]);
|
|
2934
|
+
let de = x?.collection_owner === "engine" && x?.payment.status === "requires_action" && x.payment.next_action?.type === "solana_pay";
|
|
2935
|
+
P.useEffect(() => {
|
|
2936
|
+
if (!de || !x) return;
|
|
2802
2937
|
let e = window.setInterval(() => {
|
|
2803
|
-
|
|
2804
|
-
},
|
|
2938
|
+
g.confirmOrder(x.id).then((e) => w(e.order), () => void 0);
|
|
2939
|
+
}, rr);
|
|
2805
2940
|
return () => window.clearInterval(e);
|
|
2806
2941
|
}, [
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2942
|
+
de,
|
|
2943
|
+
g,
|
|
2944
|
+
x
|
|
2810
2945
|
]);
|
|
2811
|
-
let
|
|
2946
|
+
let V = P.useMemo(() => x?.collection_owner === "engine" ? x.payment_options : [], [x]), H = P.useMemo(() => (v?.payment.psps ?? []).filter((e) => V.some((t) => t.psp_id === e.psp_id)), [v, V]), fe = Gn(c, V, H), pe = V.filter((e) => !fe.has(e.psp_id)), me = H.filter((e) => !fe.has(e.psp_id)), he = me.filter((e) => {
|
|
2812
2947
|
let t = s(e);
|
|
2813
|
-
return (t === "collect_js" || t === "stripe_elements") &&
|
|
2814
|
-
}),
|
|
2948
|
+
return (t === "collect_js" || t === "stripe_elements" || tr(e)) && pe.some((t) => t.psp_id === e.psp_id && t.accepts.includes("new_card"));
|
|
2949
|
+
}), ge = me.filter((e) => a || s(e) !== "card"), U = D.filter((e) => (e.status ?? "active") === "active" && e.reusable !== !1 && e.health?.active !== !1 && ge.some((t) => t.psp_id === e.psp_id || pe.some((n) => n.psp_id === t.psp_id && n.saved_payment_method_ids?.includes(e.id)))).map((e) => ({
|
|
2815
2950
|
id: e.id,
|
|
2816
2951
|
psp_id: e.psp_id ?? "",
|
|
2817
2952
|
rail: e.rail ?? "",
|
|
2818
2953
|
card: e.card ?? void 0
|
|
2819
|
-
})),
|
|
2820
|
-
if (!
|
|
2954
|
+
})), W = he.find((e) => e.psp_id === ne) ?? he[0], _e = pe.find((e) => e.accepts.includes("solana_pay")), ve = me.filter((e) => s(e) === null && pe.some((t) => t.psp_id === e.psp_id && t.accepts.includes("redirect"))), ye = (e) => !!c && Object.keys(c).some((t) => t.toLowerCase() === e.key.toLowerCase()), be = ve.filter((e) => !ye(e)), xe = ve.filter(ye), Se = _e ? v?.payment.solana?.tokens ?? [] : [], Ce = o ? he.find((e) => s(e) === "stripe_elements" && !!e.config?.publishable_key) : void 0;
|
|
2955
|
+
if (!x) return j ? /* @__PURE__ */ I("p", {
|
|
2821
2956
|
role: "alert",
|
|
2822
2957
|
className: "text-sm text-destructive",
|
|
2823
|
-
children:
|
|
2824
|
-
}) : /* @__PURE__ */
|
|
2825
|
-
let
|
|
2826
|
-
if (
|
|
2958
|
+
children: j
|
|
2959
|
+
}) : /* @__PURE__ */ I(Un, {});
|
|
2960
|
+
let we = b[x.currency.toUpperCase()] ?? 2, Te = (e) => d(e, x.currency, we), Ee = _?.currencies?.find((e) => e.code.toUpperCase() === x.currency.toUpperCase()), De = Ce && Ee?.minor_decimals != null ? f(x.total, Ee.decimals, Ee.minor_decimals) : null, Oe = async (e) => {
|
|
2961
|
+
if (w(e.order), e.error) return M(e.order.payment.last_payment_error?.message ?? e.error.message), ce(crypto.randomUUID()), !1;
|
|
2827
2962
|
let t = e.order.payment.next_action;
|
|
2828
2963
|
if (e.order.collection_owner !== "engine" || e.order.payment.status !== "requires_action" || !t) return !0;
|
|
2829
2964
|
if (t.type === "redirect_to_url" && t.url) return window.location.assign(t.url), !0;
|
|
2830
|
-
let n = t.payload?.client_secret, r = (
|
|
2831
|
-
if (t.type !== "authenticate" || !n || !r) return
|
|
2832
|
-
if (
|
|
2965
|
+
let n = t.payload?.client_secret, r = (v?.payment.psps.find((e) => e.psp_id === t.psp_id))?.config?.publishable_key;
|
|
2966
|
+
if (t.type !== "authenticate" || !n || !r) return M(m.t("paymentMethods.unavailable")), !1;
|
|
2967
|
+
if (le.current && t.psp_id === W?.psp_id) await le.current.handleNextAction(n);
|
|
2833
2968
|
else {
|
|
2834
|
-
let e = await (await
|
|
2969
|
+
let e = await (await Gt(r)).handleNextAction({ clientSecret: n });
|
|
2835
2970
|
if (e.error) throw Error(e.error.message);
|
|
2836
2971
|
}
|
|
2837
|
-
return
|
|
2838
|
-
}, G = async (e) => {
|
|
2839
|
-
if (
|
|
2840
|
-
ie(!0),
|
|
2972
|
+
return Oe(await g.confirmOrder(x.id));
|
|
2973
|
+
}, G = async (e, t = !1) => {
|
|
2974
|
+
if (N || x.collection_owner !== "engine" || z && !t) return !1;
|
|
2975
|
+
ie(!0), M(void 0);
|
|
2841
2976
|
try {
|
|
2842
|
-
return await
|
|
2977
|
+
return await Oe(await g.payOrder(x.id, {
|
|
2843
2978
|
payment: await e(),
|
|
2844
|
-
expectedTotal:
|
|
2979
|
+
expectedTotal: x.total,
|
|
2845
2980
|
idempotencyKey: se
|
|
2846
2981
|
}));
|
|
2847
2982
|
} catch (e) {
|
|
2848
|
-
|
|
2983
|
+
M(!n(e) && e instanceof Error && e.message ? e.message : m.error(e));
|
|
2984
|
+
let r = n(e) && e.status === 400 && e.type === "invalid_request_error";
|
|
2985
|
+
if (t && !r) throw e;
|
|
2986
|
+
return ce(crypto.randomUUID()), !1;
|
|
2849
2987
|
} finally {
|
|
2850
2988
|
ie(!1);
|
|
2851
2989
|
}
|
|
2852
|
-
},
|
|
2853
|
-
if (!(
|
|
2854
|
-
ie(!0),
|
|
2990
|
+
}, ke = async () => {
|
|
2991
|
+
if (!(N || x.collection_owner !== "engine")) {
|
|
2992
|
+
ie(!0), M(void 0);
|
|
2855
2993
|
try {
|
|
2856
|
-
await
|
|
2994
|
+
await Oe({ order: x });
|
|
2857
2995
|
} catch (e) {
|
|
2858
|
-
|
|
2996
|
+
M(!n(e) && e instanceof Error && e.message ? e.message : m.error(e));
|
|
2859
2997
|
} finally {
|
|
2860
2998
|
ie(!1);
|
|
2861
2999
|
}
|
|
2862
3000
|
}
|
|
2863
|
-
},
|
|
2864
|
-
return /* @__PURE__ */
|
|
2865
|
-
className:
|
|
2866
|
-
"data-orck-theme": C(
|
|
2867
|
-
style: E(
|
|
2868
|
-
children: [/* @__PURE__ */
|
|
3001
|
+
}, Ae = x.collection_owner === "engine" && x.status === "open" && x.payment.status === "requires_action" && x.payment.next_action?.type === "authenticate", je = x.collection_owner === "engine" && x.status === "open" && x.payment.status === "requires_action" && x.payment.next_action?.type === "redirect_to_url" && !!x.payment.next_action.url, K = v?.payment.psps.find((e) => e.psp_id === x.payment.next_action?.psp_id), Me = `Pay ${Te(x.usage?.amount_due ?? x.total)}`, q = x.collection_owner === "engine" && (x.status === "open" || x.status === "uncollectible" && !!x.usage) && x.payment.status === "requires_payment_method";
|
|
3002
|
+
return /* @__PURE__ */ L("div", {
|
|
3003
|
+
className: R("orck grid gap-5", p),
|
|
3004
|
+
"data-orck-theme": C(u),
|
|
3005
|
+
style: E(u),
|
|
3006
|
+
children: [/* @__PURE__ */ L("div", {
|
|
2869
3007
|
className: "grid",
|
|
2870
3008
|
children: [
|
|
2871
|
-
|
|
3009
|
+
x.lines.map((e) => /* @__PURE__ */ L("div", {
|
|
2872
3010
|
className: "flex items-start justify-between gap-4 py-2 text-[13.5px]",
|
|
2873
|
-
children: [/* @__PURE__ */
|
|
3011
|
+
children: [/* @__PURE__ */ L("span", { children: [e.description, e.quantity && e.quantity > 1 ? ` × ${e.quantity}` : ""] }), /* @__PURE__ */ I("span", {
|
|
2874
3012
|
className: "whitespace-nowrap tabular-nums",
|
|
2875
|
-
children:
|
|
3013
|
+
children: Te(e.amount)
|
|
2876
3014
|
})]
|
|
2877
3015
|
}, e.id)),
|
|
2878
|
-
/* @__PURE__ */
|
|
3016
|
+
/* @__PURE__ */ L("div", {
|
|
2879
3017
|
className: "flex items-start justify-between gap-4 border-t border-border pt-3 text-[13.5px] font-semibold",
|
|
2880
|
-
children: [/* @__PURE__ */
|
|
3018
|
+
children: [/* @__PURE__ */ I("span", { children: "Total" }), /* @__PURE__ */ I("span", {
|
|
2881
3019
|
className: "whitespace-nowrap tabular-nums",
|
|
2882
|
-
children:
|
|
3020
|
+
children: Te(x.total)
|
|
2883
3021
|
})]
|
|
2884
3022
|
}),
|
|
2885
|
-
|
|
3023
|
+
x.usage && x.usage.amount_paid !== "0" && /* @__PURE__ */ L("div", {
|
|
2886
3024
|
className: "flex items-start justify-between gap-4 pt-1 text-[13.5px]",
|
|
2887
|
-
children: [/* @__PURE__ */
|
|
3025
|
+
children: [/* @__PURE__ */ I("span", { children: "Due" }), /* @__PURE__ */ I("span", {
|
|
2888
3026
|
className: "whitespace-nowrap tabular-nums",
|
|
2889
|
-
children:
|
|
3027
|
+
children: Te(x.usage.amount_due)
|
|
2890
3028
|
})]
|
|
2891
3029
|
})
|
|
2892
3030
|
]
|
|
2893
|
-
}),
|
|
2894
|
-
amountLabel: `${
|
|
2895
|
-
payload:
|
|
3031
|
+
}), de ? /* @__PURE__ */ I(Ln, {
|
|
3032
|
+
amountLabel: `${x.payment.next_action?.payload?.token_amount ?? ""} ${x.payment.next_action?.payload?.token_symbol ?? ""}`.trim(),
|
|
3033
|
+
payload: x.payment.next_action?.url ?? void 0,
|
|
2896
3034
|
statusLine: "Waiting for your wallet's payment"
|
|
2897
|
-
}) :
|
|
3035
|
+
}) : x.status === "complete" ? /* @__PURE__ */ I("p", {
|
|
2898
3036
|
role: "status",
|
|
2899
3037
|
className: "text-sm font-semibold",
|
|
2900
3038
|
children: "Payment complete"
|
|
2901
|
-
}) :
|
|
3039
|
+
}) : x.collection_owner === "engine" ? x.status === "processing" ? /* @__PURE__ */ I("p", {
|
|
2902
3040
|
role: "status",
|
|
2903
3041
|
className: "text-sm text-muted-foreground",
|
|
2904
3042
|
children: "Your payment is processing."
|
|
2905
|
-
}) :
|
|
3043
|
+
}) : x.status === "open" ? je ? /* @__PURE__ */ L("form", {
|
|
2906
3044
|
className: "grid gap-4",
|
|
2907
3045
|
onSubmit: (e) => {
|
|
2908
|
-
e.preventDefault(), window.location.assign(
|
|
3046
|
+
e.preventDefault(), window.location.assign(x.payment.next_action.url);
|
|
2909
3047
|
},
|
|
2910
|
-
children: [/* @__PURE__ */
|
|
3048
|
+
children: [/* @__PURE__ */ L("p", {
|
|
2911
3049
|
className: "text-sm text-muted-foreground",
|
|
2912
3050
|
children: [
|
|
2913
3051
|
"Your payment is waiting on",
|
|
2914
3052
|
" ",
|
|
2915
|
-
|
|
3053
|
+
K?.display_name ?? "the payment page",
|
|
2916
3054
|
"."
|
|
2917
3055
|
]
|
|
2918
|
-
}), /* @__PURE__ */
|
|
2919
|
-
label: `Continue to ${
|
|
3056
|
+
}), /* @__PURE__ */ I(Q, {
|
|
3057
|
+
label: `Continue to ${K?.display_name ?? "the payment page"}`,
|
|
2920
3058
|
processing: !1
|
|
2921
3059
|
})]
|
|
2922
|
-
}) :
|
|
3060
|
+
}) : Ae ? /* @__PURE__ */ L("form", {
|
|
2923
3061
|
className: "grid gap-4",
|
|
2924
3062
|
onSubmit: (e) => {
|
|
2925
|
-
e.preventDefault(),
|
|
3063
|
+
e.preventDefault(), ke();
|
|
2926
3064
|
},
|
|
2927
3065
|
children: [
|
|
2928
|
-
/* @__PURE__ */
|
|
3066
|
+
/* @__PURE__ */ I("p", {
|
|
2929
3067
|
className: "text-sm text-muted-foreground",
|
|
2930
3068
|
children: "Your bank asks you to confirm this payment."
|
|
2931
3069
|
}),
|
|
2932
|
-
/* @__PURE__ */
|
|
3070
|
+
/* @__PURE__ */ I(Q, {
|
|
2933
3071
|
label: "Confirm payment",
|
|
2934
|
-
processing:
|
|
3072
|
+
processing: N
|
|
2935
3073
|
}),
|
|
2936
|
-
|
|
3074
|
+
j ? /* @__PURE__ */ I("p", {
|
|
2937
3075
|
role: "alert",
|
|
2938
3076
|
className: "text-sm text-destructive",
|
|
2939
|
-
children:
|
|
3077
|
+
children: j
|
|
2940
3078
|
}) : null
|
|
2941
3079
|
]
|
|
2942
|
-
}) : /* @__PURE__ */
|
|
3080
|
+
}) : /* @__PURE__ */ L("div", {
|
|
2943
3081
|
className: "grid gap-4",
|
|
2944
3082
|
children: [
|
|
2945
|
-
|
|
2946
|
-
publishableKey:
|
|
2947
|
-
amount:
|
|
2948
|
-
currency:
|
|
2949
|
-
onAvailable:
|
|
3083
|
+
!z && Ce && De ? /* @__PURE__ */ I(Wn, {
|
|
3084
|
+
publishableKey: Ce.config.publishable_key,
|
|
3085
|
+
amount: De,
|
|
3086
|
+
currency: x.currency,
|
|
3087
|
+
onAvailable: B,
|
|
2950
3088
|
onPaymentMethod: (e) => G(async () => ({
|
|
2951
3089
|
token: e,
|
|
2952
|
-
psp_id:
|
|
3090
|
+
psp_id: Ce.psp_id
|
|
2953
3091
|
}))
|
|
2954
3092
|
}) : null,
|
|
2955
|
-
|
|
3093
|
+
!z && oe && Ce && De ? /* @__PURE__ */ I("p", {
|
|
2956
3094
|
className: "text-center text-[13px] text-muted-foreground",
|
|
2957
3095
|
children: "or pay another way"
|
|
2958
3096
|
}) : null,
|
|
2959
|
-
|
|
2960
|
-
methods:
|
|
2961
|
-
value:
|
|
2962
|
-
onChange:
|
|
2963
|
-
disabled:
|
|
2964
|
-
idPrefix: `orck-order-${
|
|
3097
|
+
U.length > 0 ? /* @__PURE__ */ I(Hn, {
|
|
3098
|
+
methods: U,
|
|
3099
|
+
value: A,
|
|
3100
|
+
onChange: te,
|
|
3101
|
+
disabled: N || !q || !!z,
|
|
3102
|
+
idPrefix: `orck-order-${x.id}`
|
|
2965
3103
|
}) : null,
|
|
2966
|
-
|
|
3104
|
+
A === "new" ? W ? /* @__PURE__ */ L(F, { children: [he.length > 1 ? /* @__PURE__ */ I("select", {
|
|
2967
3105
|
"aria-label": "Pay with",
|
|
2968
3106
|
className: "h-9 rounded-md border border-border bg-transparent px-2 text-sm",
|
|
2969
|
-
value:
|
|
3107
|
+
value: W.psp_id,
|
|
2970
3108
|
onChange: (e) => re(e.target.value),
|
|
2971
|
-
children:
|
|
3109
|
+
children: he.map((e) => /* @__PURE__ */ I("option", {
|
|
2972
3110
|
value: e.psp_id,
|
|
2973
3111
|
children: e.display_name
|
|
2974
3112
|
}, e.psp_id))
|
|
2975
|
-
}) : null,
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
3113
|
+
}) : null, tr(W) ? /* @__PURE__ */ I(er, {
|
|
3114
|
+
publicKey: W.config.public_api_key,
|
|
3115
|
+
submitLabel: Me,
|
|
3116
|
+
disabled: N || !q,
|
|
3117
|
+
onTokenized: (e) => G(async () => ({
|
|
3118
|
+
token: e.payment_token,
|
|
3119
|
+
psp_id: W.psp_id,
|
|
3120
|
+
billing_details: Et(e)
|
|
3121
|
+
}), !0)
|
|
3122
|
+
}, W.psp_id) : s(W) === "collect_js" ? /* @__PURE__ */ I(gn, {
|
|
3123
|
+
tokenizationKey: W.config.tokenization_key,
|
|
3124
|
+
tokenizationURL: W.config.tokenization_url,
|
|
3125
|
+
submitLabel: Me,
|
|
3126
|
+
disabled: N || !q,
|
|
3127
|
+
appearance: u,
|
|
2981
3128
|
onTokenized: (e) => G(async () => ({
|
|
2982
3129
|
token: e.payment_token,
|
|
2983
|
-
psp_id:
|
|
2984
|
-
billing_details:
|
|
3130
|
+
psp_id: W.psp_id,
|
|
3131
|
+
billing_details: Et(e)
|
|
2985
3132
|
}))
|
|
2986
|
-
},
|
|
3133
|
+
}, W.psp_id) : /* @__PURE__ */ L("form", {
|
|
2987
3134
|
className: "grid gap-4",
|
|
2988
3135
|
onSubmit: (e) => {
|
|
2989
3136
|
e.preventDefault(), G(async () => ({
|
|
2990
|
-
token: await
|
|
2991
|
-
psp_id:
|
|
3137
|
+
token: await le.current.tokenize(),
|
|
3138
|
+
psp_id: W.psp_id
|
|
2992
3139
|
}));
|
|
2993
3140
|
},
|
|
2994
3141
|
children: [
|
|
2995
|
-
/* @__PURE__ */
|
|
2996
|
-
ref:
|
|
2997
|
-
psp:
|
|
2998
|
-
client:
|
|
2999
|
-
unavailableMessage:
|
|
3000
|
-
verificationPendingMessage:
|
|
3001
|
-
},
|
|
3002
|
-
/* @__PURE__ */
|
|
3003
|
-
label:
|
|
3004
|
-
processing:
|
|
3142
|
+
/* @__PURE__ */ I(an, {
|
|
3143
|
+
ref: le,
|
|
3144
|
+
psp: W,
|
|
3145
|
+
client: g,
|
|
3146
|
+
unavailableMessage: m.t("paymentMethods.unavailable"),
|
|
3147
|
+
verificationPendingMessage: m.t("paymentMethods.verificationPending")
|
|
3148
|
+
}, W.psp_id),
|
|
3149
|
+
/* @__PURE__ */ I(Q, {
|
|
3150
|
+
label: Me,
|
|
3151
|
+
processing: N,
|
|
3005
3152
|
disabled: !q
|
|
3006
3153
|
}),
|
|
3007
|
-
/* @__PURE__ */
|
|
3154
|
+
/* @__PURE__ */ I(Ut, {})
|
|
3008
3155
|
]
|
|
3009
|
-
})] }) :
|
|
3156
|
+
})] }) : _e || be.length > 0 || xe.length > 0 ? null : /* @__PURE__ */ I("p", {
|
|
3010
3157
|
role: "alert",
|
|
3011
3158
|
className: "text-sm text-destructive",
|
|
3012
|
-
children:
|
|
3013
|
-
}) : /* @__PURE__ */
|
|
3159
|
+
children: m.t("paymentMethods.unavailable")
|
|
3160
|
+
}) : /* @__PURE__ */ I("form", {
|
|
3014
3161
|
className: "grid gap-4",
|
|
3015
3162
|
onSubmit: (e) => {
|
|
3016
|
-
e.preventDefault()
|
|
3163
|
+
e.preventDefault();
|
|
3164
|
+
let t = z ?? A, n = pe.some((e) => e.saved_payment_method_ids?.includes(t));
|
|
3165
|
+
G(async () => ({ payment_method_id: t }), n).then(() => ae(void 0)).catch(() => ae(t));
|
|
3017
3166
|
},
|
|
3018
|
-
children: /* @__PURE__ */
|
|
3019
|
-
label:
|
|
3020
|
-
processing:
|
|
3167
|
+
children: /* @__PURE__ */ I(Q, {
|
|
3168
|
+
label: z ? "Retry payment" : Me,
|
|
3169
|
+
processing: N,
|
|
3021
3170
|
disabled: !q
|
|
3022
3171
|
})
|
|
3023
3172
|
}),
|
|
3024
|
-
|
|
3173
|
+
be.map((e) => /* @__PURE__ */ I("form", {
|
|
3025
3174
|
onSubmit: (t) => {
|
|
3026
3175
|
t.preventDefault(), G(async () => ({
|
|
3027
3176
|
return_url: r ?? window.location.href,
|
|
3028
3177
|
psp_id: e.psp_id
|
|
3029
3178
|
}));
|
|
3030
3179
|
},
|
|
3031
|
-
children: /* @__PURE__ */
|
|
3032
|
-
label: `${
|
|
3033
|
-
processing:
|
|
3034
|
-
disabled: !q
|
|
3180
|
+
children: /* @__PURE__ */ I(Q, {
|
|
3181
|
+
label: `${Me} with ${e.display_name}`,
|
|
3182
|
+
processing: N,
|
|
3183
|
+
disabled: !q || !!z
|
|
3035
3184
|
})
|
|
3036
3185
|
}, e.psp_id)),
|
|
3037
|
-
|
|
3186
|
+
xe.length > 0 ? /* @__PURE__ */ L("div", {
|
|
3038
3187
|
className: "grid gap-2 border-t border-border pt-4",
|
|
3039
|
-
children: [/* @__PURE__ */
|
|
3188
|
+
children: [/* @__PURE__ */ I("p", {
|
|
3040
3189
|
className: "text-[13px] text-muted-foreground",
|
|
3041
3190
|
children: "Card payment isn't working?"
|
|
3042
|
-
}),
|
|
3191
|
+
}), xe.map((e) => /* @__PURE__ */ L("button", {
|
|
3043
3192
|
type: "button",
|
|
3044
3193
|
className: "h-9 rounded-md border border-border text-sm",
|
|
3045
|
-
disabled:
|
|
3194
|
+
disabled: N || !q || !!z,
|
|
3046
3195
|
onClick: () => void G(async () => ({
|
|
3047
3196
|
return_url: r ?? window.location.href,
|
|
3048
3197
|
psp_id: e.psp_id
|
|
@@ -3050,15 +3199,15 @@ function Kn({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3050
3199
|
children: ["Pay with ", e.display_name]
|
|
3051
3200
|
}, e.psp_id))]
|
|
3052
3201
|
}) : null,
|
|
3053
|
-
|
|
3202
|
+
_e && Se.length > 0 ? /* @__PURE__ */ I("div", {
|
|
3054
3203
|
className: "grid gap-2 border-t border-border pt-4",
|
|
3055
|
-
children:
|
|
3204
|
+
children: Se.map((e) => /* @__PURE__ */ L("button", {
|
|
3056
3205
|
type: "button",
|
|
3057
3206
|
className: "h-9 rounded-md border border-border text-sm",
|
|
3058
|
-
disabled:
|
|
3207
|
+
disabled: N || !q || !!z,
|
|
3059
3208
|
onClick: () => void G(async () => ({
|
|
3060
3209
|
token_symbol: e.symbol,
|
|
3061
|
-
psp_id:
|
|
3210
|
+
psp_id: _e.psp_id
|
|
3062
3211
|
})),
|
|
3063
3212
|
children: [
|
|
3064
3213
|
"Pay with ",
|
|
@@ -3067,17 +3216,17 @@ function Kn({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3067
3216
|
]
|
|
3068
3217
|
}, e.symbol))
|
|
3069
3218
|
}) : null,
|
|
3070
|
-
|
|
3219
|
+
j ? /* @__PURE__ */ I("p", {
|
|
3071
3220
|
role: "alert",
|
|
3072
3221
|
className: "text-sm text-destructive",
|
|
3073
|
-
children:
|
|
3222
|
+
children: j
|
|
3074
3223
|
}) : null
|
|
3075
3224
|
]
|
|
3076
|
-
}) : /* @__PURE__ */
|
|
3225
|
+
}) : /* @__PURE__ */ I("p", {
|
|
3077
3226
|
role: "status",
|
|
3078
3227
|
className: "text-sm text-muted-foreground",
|
|
3079
3228
|
children: "This order can no longer be paid."
|
|
3080
|
-
}) : /* @__PURE__ */
|
|
3229
|
+
}) : /* @__PURE__ */ I("p", {
|
|
3081
3230
|
role: "status",
|
|
3082
3231
|
className: "text-sm text-muted-foreground",
|
|
3083
3232
|
children: "This bill is collected by the payment provider. No payment is needed here."
|
|
@@ -3086,13 +3235,13 @@ function Kn({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3086
3235
|
}
|
|
3087
3236
|
//#endregion
|
|
3088
3237
|
//#region src/embedded-payment.tsx
|
|
3089
|
-
var
|
|
3090
|
-
function
|
|
3091
|
-
let
|
|
3092
|
-
|
|
3093
|
-
|
|
3238
|
+
var ar = "openrails.payment.complete", or = "openrails.payment.resize";
|
|
3239
|
+
function sr({ url: e, onComplete: t, fallbacks: n, title: r = "Payment", className: i }) {
|
|
3240
|
+
let a = P.useRef(null), [o, s] = P.useState(), c = P.useRef(t);
|
|
3241
|
+
P.useEffect(() => {
|
|
3242
|
+
c.current = t;
|
|
3094
3243
|
});
|
|
3095
|
-
let
|
|
3244
|
+
let l = P.useMemo(() => {
|
|
3096
3245
|
try {
|
|
3097
3246
|
let t = new URL(e);
|
|
3098
3247
|
return t.protocol === "https:" || t.protocol === "http:" ? t.origin : null;
|
|
@@ -3100,176 +3249,177 @@ function Yn({ url: e, onComplete: t, title: n = "Payment", className: r }) {
|
|
|
3100
3249
|
return null;
|
|
3101
3250
|
}
|
|
3102
3251
|
}, [e]);
|
|
3103
|
-
return
|
|
3104
|
-
if (!
|
|
3252
|
+
return P.useEffect(() => {
|
|
3253
|
+
if (!l) return;
|
|
3105
3254
|
let e = !1, t = (t) => {
|
|
3106
|
-
if (t.origin !==
|
|
3255
|
+
if (t.origin !== l || !a.current || t.source !== a.current.contentWindow) return;
|
|
3107
3256
|
let n = t.data;
|
|
3108
3257
|
if (!n || typeof n != "object") return;
|
|
3109
3258
|
let r = n;
|
|
3110
3259
|
if (r.type === "openrails.payment.resize" && typeof r.height == "number" && r.height > 0 && r.height < 2e4) {
|
|
3111
|
-
|
|
3260
|
+
s(Math.ceil(r.height));
|
|
3112
3261
|
return;
|
|
3113
3262
|
}
|
|
3114
3263
|
if (r.type !== "openrails.payment.complete" || typeof r.order_id != "string" || e) return;
|
|
3115
3264
|
e = !0;
|
|
3116
|
-
let
|
|
3117
|
-
|
|
3265
|
+
let i = typeof r.success_url == "string" ? r.success_url : "";
|
|
3266
|
+
c.current ? c.current({
|
|
3118
3267
|
orderId: r.order_id,
|
|
3119
|
-
successUrl:
|
|
3120
|
-
}) : /^https?:\/\//i.test(
|
|
3268
|
+
successUrl: i
|
|
3269
|
+
}) : /^https?:\/\//i.test(i) && window.location.assign(i);
|
|
3121
3270
|
};
|
|
3122
3271
|
return window.addEventListener("message", t), () => window.removeEventListener("message", t);
|
|
3123
|
-
}, [
|
|
3124
|
-
ref:
|
|
3125
|
-
src: e,
|
|
3126
|
-
title:
|
|
3127
|
-
className:
|
|
3272
|
+
}, [l]), l ? /* @__PURE__ */ I("iframe", {
|
|
3273
|
+
ref: a,
|
|
3274
|
+
src: Qn(e, n),
|
|
3275
|
+
title: r,
|
|
3276
|
+
className: i,
|
|
3128
3277
|
allow: "payment *; publickey-credentials-get *; publickey-credentials-create *",
|
|
3129
3278
|
style: {
|
|
3130
3279
|
border: 0,
|
|
3131
3280
|
width: "100%",
|
|
3132
|
-
height:
|
|
3281
|
+
height: o ?? 640
|
|
3133
3282
|
}
|
|
3134
3283
|
}) : null;
|
|
3135
3284
|
}
|
|
3136
3285
|
//#endregion
|
|
3137
3286
|
//#region src/cart.tsx
|
|
3138
|
-
function
|
|
3139
|
-
let
|
|
3140
|
-
|
|
3287
|
+
function cr({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i, className: a }) {
|
|
3288
|
+
let o = S(), s = T(), c = e ?? s.client, l = O(), [u, f] = P.useState(), [p, m] = P.useState(), [h, g] = P.useState(), [_, v] = P.useState(!1), [y, b] = P.useState(() => crypto.randomUUID());
|
|
3289
|
+
P.useEffect(() => {
|
|
3141
3290
|
let e = new AbortController();
|
|
3142
|
-
return
|
|
3143
|
-
e.signal.aborted ||
|
|
3291
|
+
return c.getCart(e.signal).then(f, (t) => {
|
|
3292
|
+
e.signal.aborted || g(o.error(t));
|
|
3144
3293
|
}), () => e.abort();
|
|
3145
|
-
}, [
|
|
3146
|
-
let
|
|
3147
|
-
if (!
|
|
3148
|
-
|
|
3294
|
+
}, [c, o]);
|
|
3295
|
+
let x = async (e) => {
|
|
3296
|
+
if (!_) {
|
|
3297
|
+
v(!0), g(void 0);
|
|
3149
3298
|
try {
|
|
3150
3299
|
await e();
|
|
3151
3300
|
} catch (e) {
|
|
3152
|
-
|
|
3301
|
+
g(o.error(e));
|
|
3153
3302
|
} finally {
|
|
3154
|
-
|
|
3303
|
+
v(!1);
|
|
3155
3304
|
}
|
|
3156
3305
|
}
|
|
3157
3306
|
};
|
|
3158
|
-
if (
|
|
3159
|
-
orderId:
|
|
3160
|
-
client:
|
|
3307
|
+
if (p && !t) return /* @__PURE__ */ I(ir, {
|
|
3308
|
+
orderId: p.id,
|
|
3309
|
+
client: c,
|
|
3161
3310
|
onSettled: n,
|
|
3162
|
-
|
|
3163
|
-
|
|
3311
|
+
fallbacks: r,
|
|
3312
|
+
appearance: i,
|
|
3313
|
+
className: a
|
|
3164
3314
|
});
|
|
3165
|
-
if (!
|
|
3315
|
+
if (!u) return h ? /* @__PURE__ */ I("p", {
|
|
3166
3316
|
role: "alert",
|
|
3167
3317
|
className: "text-sm text-destructive",
|
|
3168
|
-
children:
|
|
3169
|
-
}) : /* @__PURE__ */
|
|
3170
|
-
let
|
|
3171
|
-
|
|
3172
|
-
}),
|
|
3173
|
-
let e = await
|
|
3318
|
+
children: h
|
|
3319
|
+
}) : /* @__PURE__ */ I(Un, {});
|
|
3320
|
+
let w = l[u.currency.toUpperCase()] ?? 2, D = (e) => d(e, u.currency, w), k = u.lines.length > 0 && u.lines.every((e) => !e.refusal), A = (e) => x(async () => {
|
|
3321
|
+
f(await c.setCartLine(e, { quantity: 0 })), b(crypto.randomUUID());
|
|
3322
|
+
}), ee = () => x(async () => {
|
|
3323
|
+
let e = await c.createOrder({
|
|
3174
3324
|
cart: !0,
|
|
3175
|
-
expectedTotal:
|
|
3176
|
-
idempotencyKey:
|
|
3325
|
+
expectedTotal: u.total,
|
|
3326
|
+
idempotencyKey: y
|
|
3177
3327
|
});
|
|
3178
3328
|
if (e.error) throw e.error;
|
|
3179
|
-
|
|
3329
|
+
m(e.order), t?.(e.order);
|
|
3180
3330
|
});
|
|
3181
|
-
return /* @__PURE__ */
|
|
3182
|
-
className:
|
|
3183
|
-
"data-orck-theme": C(
|
|
3184
|
-
style: E(
|
|
3331
|
+
return /* @__PURE__ */ L("div", {
|
|
3332
|
+
className: R("orck grid gap-5", a),
|
|
3333
|
+
"data-orck-theme": C(i),
|
|
3334
|
+
style: E(i),
|
|
3185
3335
|
children: [
|
|
3186
|
-
|
|
3336
|
+
u.lines.length === 0 ? /* @__PURE__ */ I("p", {
|
|
3187
3337
|
role: "status",
|
|
3188
3338
|
className: "text-sm text-muted-foreground",
|
|
3189
3339
|
children: "Your cart is empty."
|
|
3190
|
-
}) : /* @__PURE__ */
|
|
3340
|
+
}) : /* @__PURE__ */ L("div", {
|
|
3191
3341
|
className: "grid",
|
|
3192
|
-
children: [
|
|
3342
|
+
children: [u.lines.map((e) => /* @__PURE__ */ L("div", {
|
|
3193
3343
|
className: "grid gap-1 border-b border-border py-2 text-[13.5px]",
|
|
3194
3344
|
children: [
|
|
3195
|
-
/* @__PURE__ */
|
|
3345
|
+
/* @__PURE__ */ L("div", {
|
|
3196
3346
|
className: "flex items-start justify-between gap-4",
|
|
3197
|
-
children: [/* @__PURE__ */
|
|
3347
|
+
children: [/* @__PURE__ */ I("span", { children: e.description || e.price_id }), /* @__PURE__ */ I("span", {
|
|
3198
3348
|
className: "whitespace-nowrap tabular-nums",
|
|
3199
|
-
children:
|
|
3349
|
+
children: D(e.amount)
|
|
3200
3350
|
})]
|
|
3201
3351
|
}),
|
|
3202
|
-
/* @__PURE__ */
|
|
3352
|
+
/* @__PURE__ */ L("div", {
|
|
3203
3353
|
className: "flex items-center gap-2",
|
|
3204
|
-
children: [e.quantity != null && e.quantity > 1 ? /* @__PURE__ */
|
|
3354
|
+
children: [e.quantity != null && e.quantity > 1 ? /* @__PURE__ */ L("span", {
|
|
3205
3355
|
className: "text-[13px] text-muted-foreground",
|
|
3206
3356
|
children: ["Quantity ", e.quantity]
|
|
3207
|
-
}) : null, /* @__PURE__ */
|
|
3357
|
+
}) : null, /* @__PURE__ */ I("button", {
|
|
3208
3358
|
type: "button",
|
|
3209
3359
|
className: "text-[13px] text-muted-foreground underline",
|
|
3210
|
-
disabled:
|
|
3211
|
-
onClick: () => void
|
|
3360
|
+
disabled: _,
|
|
3361
|
+
onClick: () => void A(e.price_id),
|
|
3212
3362
|
children: "Remove"
|
|
3213
3363
|
})]
|
|
3214
3364
|
}),
|
|
3215
|
-
e.refusal ? /* @__PURE__ */
|
|
3365
|
+
e.refusal ? /* @__PURE__ */ I("p", {
|
|
3216
3366
|
className: "text-[13px] text-destructive",
|
|
3217
3367
|
children: e.refusal.message
|
|
3218
3368
|
}) : null
|
|
3219
3369
|
]
|
|
3220
|
-
}, e.price_id)), /* @__PURE__ */
|
|
3370
|
+
}, e.price_id)), /* @__PURE__ */ L("div", {
|
|
3221
3371
|
className: "flex items-start justify-between gap-4 pt-3 text-[13.5px] font-semibold",
|
|
3222
|
-
children: [/* @__PURE__ */
|
|
3372
|
+
children: [/* @__PURE__ */ I("span", { children: "Total" }), /* @__PURE__ */ I("span", {
|
|
3223
3373
|
className: "whitespace-nowrap tabular-nums",
|
|
3224
|
-
children:
|
|
3374
|
+
children: D(u.total)
|
|
3225
3375
|
})]
|
|
3226
3376
|
})]
|
|
3227
3377
|
}),
|
|
3228
|
-
|
|
3378
|
+
u.lines.length > 0 ? /* @__PURE__ */ L("form", {
|
|
3229
3379
|
className: "grid gap-2",
|
|
3230
3380
|
onSubmit: (e) => {
|
|
3231
|
-
e.preventDefault(),
|
|
3381
|
+
e.preventDefault(), ee();
|
|
3232
3382
|
},
|
|
3233
|
-
children: [/* @__PURE__ */
|
|
3383
|
+
children: [/* @__PURE__ */ I(Q, {
|
|
3234
3384
|
label: "Check out",
|
|
3235
|
-
processing:
|
|
3236
|
-
disabled: !
|
|
3237
|
-
}), /* @__PURE__ */
|
|
3385
|
+
processing: _,
|
|
3386
|
+
disabled: !k
|
|
3387
|
+
}), /* @__PURE__ */ I("button", {
|
|
3238
3388
|
type: "button",
|
|
3239
3389
|
className: "text-[13px] text-muted-foreground underline",
|
|
3240
|
-
disabled:
|
|
3241
|
-
onClick: () => void
|
|
3242
|
-
await
|
|
3390
|
+
disabled: _,
|
|
3391
|
+
onClick: () => void x(async () => {
|
|
3392
|
+
await c.clearCart(), f(await c.getCart());
|
|
3243
3393
|
}),
|
|
3244
3394
|
children: "Empty cart"
|
|
3245
3395
|
})]
|
|
3246
3396
|
}) : null,
|
|
3247
|
-
|
|
3397
|
+
h ? /* @__PURE__ */ I("p", {
|
|
3248
3398
|
role: "alert",
|
|
3249
3399
|
className: "text-sm text-destructive",
|
|
3250
|
-
children:
|
|
3400
|
+
children: h
|
|
3251
3401
|
}) : null
|
|
3252
3402
|
]
|
|
3253
3403
|
});
|
|
3254
3404
|
}
|
|
3255
3405
|
//#endregion
|
|
3256
3406
|
//#region src/authenticate.ts
|
|
3257
|
-
async function
|
|
3407
|
+
async function lr(e, t, n, r) {
|
|
3258
3408
|
let i = n.next_action, o = i?.payload?.client_secret;
|
|
3259
3409
|
if (n.status !== "requires_action" || i?.type !== "authenticate" || !o || !a(r)) return n;
|
|
3260
|
-
let s = await (await
|
|
3410
|
+
let s = await (await Gt(r.config.publishable_key)).handleNextAction({ clientSecret: o });
|
|
3261
3411
|
if (s.error) throw Error(s.error.message ?? "Authentication failed.");
|
|
3262
3412
|
return e.confirmSubscriptionChange(t);
|
|
3263
3413
|
}
|
|
3264
3414
|
//#endregion
|
|
3265
3415
|
//#region src/lib/price-label.ts
|
|
3266
|
-
function
|
|
3267
|
-
let i =
|
|
3416
|
+
function ur(e, t, n, r) {
|
|
3417
|
+
let i = be(e.unit_amount, e.currency, t, r) ?? `${e.unit_amount} ${e.currency}`, a = W(e.billing_interval_hours);
|
|
3268
3418
|
if (a) return n.t("products.recurring", {
|
|
3269
3419
|
amount: i,
|
|
3270
3420
|
every: n.plural(`interval.every.${a.unit}`, a.count)
|
|
3271
3421
|
});
|
|
3272
|
-
let o =
|
|
3422
|
+
let o = W(e.access_duration_hours);
|
|
3273
3423
|
return o ? n.t("products.rent", {
|
|
3274
3424
|
amount: i,
|
|
3275
3425
|
period: n.plural(`interval.duration.${o.unit}`, o.count)
|
|
@@ -3277,25 +3427,25 @@ function Qn(e, t, n, r) {
|
|
|
3277
3427
|
}
|
|
3278
3428
|
//#endregion
|
|
3279
3429
|
//#region src/modal.tsx
|
|
3280
|
-
function
|
|
3281
|
-
return /* @__PURE__ */
|
|
3430
|
+
function dr({ open: e, onOpenChange: t, appearance: n, children: r }) {
|
|
3431
|
+
return /* @__PURE__ */ I(st, {
|
|
3282
3432
|
open: e,
|
|
3283
3433
|
onOpenChange: t,
|
|
3284
|
-
children: /* @__PURE__ */
|
|
3434
|
+
children: /* @__PURE__ */ L(ut, {
|
|
3285
3435
|
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",
|
|
3286
3436
|
"data-orck-theme": C(n),
|
|
3287
3437
|
style: E(n),
|
|
3288
3438
|
showCloseButton: !0,
|
|
3289
3439
|
children: [
|
|
3290
|
-
/* @__PURE__ */
|
|
3440
|
+
/* @__PURE__ */ I(pt, {
|
|
3291
3441
|
className: "sr-only",
|
|
3292
3442
|
children: "Payment"
|
|
3293
3443
|
}),
|
|
3294
|
-
/* @__PURE__ */
|
|
3444
|
+
/* @__PURE__ */ I(mt, {
|
|
3295
3445
|
className: "sr-only",
|
|
3296
3446
|
children: "Complete your payment"
|
|
3297
3447
|
}),
|
|
3298
|
-
/* @__PURE__ */
|
|
3448
|
+
/* @__PURE__ */ I("div", {
|
|
3299
3449
|
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",
|
|
3300
3450
|
children: r
|
|
3301
3451
|
})
|
|
@@ -3303,40 +3453,40 @@ function $n({ open: e, onOpenChange: t, appearance: n, children: r }) {
|
|
|
3303
3453
|
})
|
|
3304
3454
|
});
|
|
3305
3455
|
}
|
|
3306
|
-
function
|
|
3307
|
-
return /* @__PURE__ */
|
|
3456
|
+
function fr({ open: e, onOpenChange: t, ...n }) {
|
|
3457
|
+
return /* @__PURE__ */ I(dr, {
|
|
3308
3458
|
open: e,
|
|
3309
3459
|
onOpenChange: t,
|
|
3310
3460
|
appearance: n.appearance,
|
|
3311
|
-
children: /* @__PURE__ */
|
|
3461
|
+
children: /* @__PURE__ */ I(ir, { ...n })
|
|
3312
3462
|
});
|
|
3313
3463
|
}
|
|
3314
|
-
function
|
|
3315
|
-
return /* @__PURE__ */
|
|
3464
|
+
function pr({ open: e, onOpenChange: t, appearance: n, ...r }) {
|
|
3465
|
+
return /* @__PURE__ */ I(dr, {
|
|
3316
3466
|
open: e,
|
|
3317
3467
|
onOpenChange: t,
|
|
3318
3468
|
appearance: n,
|
|
3319
|
-
children: /* @__PURE__ */
|
|
3469
|
+
children: /* @__PURE__ */ I(sr, { ...r })
|
|
3320
3470
|
});
|
|
3321
3471
|
}
|
|
3322
3472
|
//#endregion
|
|
3323
3473
|
//#region src/buy-button.tsx
|
|
3324
|
-
function
|
|
3474
|
+
function mr(e) {
|
|
3325
3475
|
if (!n(e) || e.code !== "already_owned") return;
|
|
3326
3476
|
let t = e.metadata.owned_by;
|
|
3327
3477
|
return typeof t == "string" && t.startsWith("ord_") ? t : void 0;
|
|
3328
3478
|
}
|
|
3329
|
-
var
|
|
3330
|
-
function
|
|
3331
|
-
let
|
|
3332
|
-
e.status === "complete" && (
|
|
3333
|
-
},
|
|
3334
|
-
if (
|
|
3335
|
-
|
|
3479
|
+
var hr = (e) => typeof window < "u" && e.includes(window.location.origin);
|
|
3480
|
+
function gr({ price: t, label: i, amount: a, returnUrl: o, fallbacks: s, onPaid: c, onSignInRequired: l, signedIn: u, appearance: d, className: f }) {
|
|
3481
|
+
let p = S(), { locale: m } = k(), h = O(), g = x(d), { client: _ } = T(), [v, y] = P.useState(), [b, C] = P.useState(!1), [w, E] = P.useState(), D = (e) => {
|
|
3482
|
+
e.status === "complete" && (y(void 0), c(e));
|
|
3483
|
+
}, A = async () => {
|
|
3484
|
+
if (u === !1) return l();
|
|
3485
|
+
E(void 0), C(!0);
|
|
3336
3486
|
try {
|
|
3337
|
-
let { merchant: e } = await
|
|
3487
|
+
let { merchant: e } = await _.getCustomerConfig(), n = hr(e.embed_origins), i;
|
|
3338
3488
|
try {
|
|
3339
|
-
({order: i} = await
|
|
3489
|
+
({order: i} = await _.createOrder({
|
|
3340
3490
|
lines: [{
|
|
3341
3491
|
price_id: t.id,
|
|
3342
3492
|
...a ? { amount: a } : {}
|
|
@@ -3344,17 +3494,17 @@ function ir({ price: t, label: i, amount: a, returnUrl: o, onPaid: s, onSignInRe
|
|
|
3344
3494
|
...n ? { payUrl: { embedded: !0 } } : {}
|
|
3345
3495
|
}));
|
|
3346
3496
|
} catch (e) {
|
|
3347
|
-
let t =
|
|
3497
|
+
let t = mr(e);
|
|
3348
3498
|
if (!t || n) throw e;
|
|
3349
|
-
|
|
3499
|
+
y({
|
|
3350
3500
|
kind: "inline",
|
|
3351
3501
|
orderId: t
|
|
3352
3502
|
});
|
|
3353
3503
|
return;
|
|
3354
3504
|
}
|
|
3355
|
-
if (i.status === "complete") return
|
|
3505
|
+
if (i.status === "complete") return D(i);
|
|
3356
3506
|
if (!n) {
|
|
3357
|
-
|
|
3507
|
+
y({
|
|
3358
3508
|
kind: "inline",
|
|
3359
3509
|
orderId: i.id
|
|
3360
3510
|
});
|
|
@@ -3362,86 +3512,89 @@ function ir({ price: t, label: i, amount: a, returnUrl: o, onPaid: s, onSignInRe
|
|
|
3362
3512
|
}
|
|
3363
3513
|
let o = i.pay_url;
|
|
3364
3514
|
if (!o) throw r("invalid_response", "the order answered no pay URL");
|
|
3365
|
-
|
|
3515
|
+
y({
|
|
3366
3516
|
kind: "embedded",
|
|
3367
3517
|
orderId: i.id,
|
|
3368
3518
|
url: o
|
|
3369
3519
|
});
|
|
3370
3520
|
} catch (t) {
|
|
3371
|
-
n(t) && t.status === 401 ?
|
|
3521
|
+
n(t) && t.status === 401 ? l() : E(p.error(e(t)));
|
|
3372
3522
|
} finally {
|
|
3373
|
-
|
|
3523
|
+
C(!1);
|
|
3374
3524
|
}
|
|
3375
|
-
},
|
|
3376
|
-
return /* @__PURE__ */
|
|
3377
|
-
className:
|
|
3378
|
-
"data-orck-theme":
|
|
3525
|
+
}, ee = (e) => !e && y(void 0);
|
|
3526
|
+
return /* @__PURE__ */ L("span", {
|
|
3527
|
+
className: R(g.className, "inline-flex flex-col gap-1", f),
|
|
3528
|
+
"data-orck-theme": g["data-orck-theme"],
|
|
3379
3529
|
style: {
|
|
3380
|
-
...
|
|
3530
|
+
...g.style,
|
|
3381
3531
|
containerType: "normal"
|
|
3382
3532
|
},
|
|
3383
3533
|
children: [
|
|
3384
|
-
/* @__PURE__ */
|
|
3385
|
-
disabled:
|
|
3386
|
-
onClick: () => void
|
|
3387
|
-
children: i ??
|
|
3534
|
+
/* @__PURE__ */ I(U, {
|
|
3535
|
+
disabled: b,
|
|
3536
|
+
onClick: () => void A(),
|
|
3537
|
+
children: i ?? ur(t, h, p, m)
|
|
3388
3538
|
}),
|
|
3389
|
-
|
|
3539
|
+
w ? /* @__PURE__ */ I("span", {
|
|
3390
3540
|
role: "alert",
|
|
3391
3541
|
className: "text-sm text-destructive",
|
|
3392
|
-
children:
|
|
3542
|
+
children: w
|
|
3393
3543
|
}) : null,
|
|
3394
|
-
|
|
3544
|
+
v?.kind === "inline" ? /* @__PURE__ */ I(fr, {
|
|
3395
3545
|
open: !0,
|
|
3396
|
-
onOpenChange:
|
|
3397
|
-
orderId:
|
|
3546
|
+
onOpenChange: ee,
|
|
3547
|
+
orderId: v.orderId,
|
|
3398
3548
|
returnUrl: o,
|
|
3399
|
-
|
|
3400
|
-
|
|
3549
|
+
fallbacks: s,
|
|
3550
|
+
appearance: d,
|
|
3551
|
+
onSettled: D
|
|
3401
3552
|
}) : null,
|
|
3402
|
-
|
|
3553
|
+
v?.kind === "embedded" ? /* @__PURE__ */ I(pr, {
|
|
3403
3554
|
open: !0,
|
|
3404
|
-
onOpenChange:
|
|
3405
|
-
url:
|
|
3406
|
-
|
|
3407
|
-
|
|
3555
|
+
onOpenChange: ee,
|
|
3556
|
+
url: v.url,
|
|
3557
|
+
fallbacks: s,
|
|
3558
|
+
appearance: d,
|
|
3559
|
+
onComplete: () => void _.getOrder(v.orderId).then(D, () => void 0)
|
|
3408
3560
|
}) : null
|
|
3409
3561
|
]
|
|
3410
3562
|
});
|
|
3411
3563
|
}
|
|
3412
3564
|
//#endregion
|
|
3413
3565
|
//#region src/product-list.tsx
|
|
3414
|
-
function
|
|
3415
|
-
let
|
|
3566
|
+
function _r({ products: e, onPaid: t, onSignInRequired: n, signedIn: r, returnUrl: i, fallbacks: a, appearance: o, className: s }) {
|
|
3567
|
+
let c = S(), l = x(o), u = e.filter((e) => !e.archived).map((e) => ({
|
|
3416
3568
|
product: e,
|
|
3417
3569
|
prices: e.prices.filter((e) => !e.archived && !e.customer_amount)
|
|
3418
|
-
})).filter((e) => e.prices.length > 0),
|
|
3419
|
-
return
|
|
3570
|
+
})).filter((e) => e.prices.length > 0), d;
|
|
3571
|
+
return d = u.length === 0 ? /* @__PURE__ */ I(ze, { title: c.t("products.empty") }) : u.map(({ product: e, prices: s }) => /* @__PURE__ */ L(Me, {
|
|
3420
3572
|
className: "gap-4",
|
|
3421
3573
|
"data-testid": "product",
|
|
3422
|
-
children: [/* @__PURE__ */
|
|
3574
|
+
children: [/* @__PURE__ */ L(q, { children: [/* @__PURE__ */ I(Ne, {
|
|
3423
3575
|
role: "heading",
|
|
3424
3576
|
"aria-level": 2,
|
|
3425
3577
|
children: e.display_name
|
|
3426
|
-
}), e.description ? /* @__PURE__ */
|
|
3578
|
+
}), e.description ? /* @__PURE__ */ I(Pe, { children: e.description }) : null] }), /* @__PURE__ */ I(Ie, {
|
|
3427
3579
|
className: "flex flex-wrap gap-2",
|
|
3428
|
-
children:
|
|
3580
|
+
children: s.map((e) => /* @__PURE__ */ I(gr, {
|
|
3429
3581
|
price: e,
|
|
3430
3582
|
onPaid: t,
|
|
3431
3583
|
onSignInRequired: n,
|
|
3432
3584
|
signedIn: r,
|
|
3433
3585
|
returnUrl: i,
|
|
3434
|
-
|
|
3586
|
+
fallbacks: a,
|
|
3587
|
+
appearance: o
|
|
3435
3588
|
}, e.id))
|
|
3436
3589
|
})]
|
|
3437
|
-
}, e.id)), /* @__PURE__ */
|
|
3438
|
-
className:
|
|
3439
|
-
"data-orck-theme":
|
|
3440
|
-
style:
|
|
3441
|
-
children:
|
|
3590
|
+
}, e.id)), /* @__PURE__ */ I("div", {
|
|
3591
|
+
className: R(l.className, K, "grid gap-4", s),
|
|
3592
|
+
"data-orck-theme": l["data-orck-theme"],
|
|
3593
|
+
style: l.style,
|
|
3594
|
+
children: d
|
|
3442
3595
|
});
|
|
3443
3596
|
}
|
|
3444
3597
|
//#endregion
|
|
3445
|
-
export {
|
|
3598
|
+
export { Fn as AccountBilling, w as BillingProvider, Ue as BillingStatusBadge, he as BillingUiRoot, gr as BuyButton, Dn as CancelSubscriptionDialog, Ze as CardBrandPlate, cr as Cart, sr as EmbeddedPayment, ir as OrderPayment, ar as PAYMENT_COMPLETE_MESSAGE, or as PAYMENT_RESIZE_MESSAGE, Ge as PaymentHistory, Tn as PaymentMethodsPanel, _r as ProductList, _n as SavePaymentMethod, Pn as SubscriptionsPanel, gn as TokenizedCardForm, c as addAmounts, l as amountToDecimal, lr as authenticateChange, Ot as browserCountry, a as canAuthenticatePayment, m as canSavePaymentMethod, s as cardSetupDriver, o as createBillingClient, v as createTranslator, ne as defaultMessages, j as defineMessages, d as formatAmount, kt as initialCountry, b as interpolate, u as isAmount, g as pspConfigSchema, $n as readPaymentFragment, t as redeemAssertion, qe as resolveCardBrand, re as resolveMessages, i as routedPsps, je as statusTone, h as tokenSource, S as useMessages, Qn as withPaymentFallbacks };
|
|
3446
3599
|
|
|
3447
3600
|
//# sourceMappingURL=index.js.map
|