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