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