@openrails/billing-ui 0.257.0 → 0.257.1
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 +15 -4
- package/README.md +41 -17
- package/dist/account/change-plan.d.ts +17 -0
- package/dist/account/format.d.ts +2 -0
- package/dist/account/renewal-prompt.d.ts +13 -0
- package/dist/account/subscriptions-panel.d.ts +2 -1
- package/dist/{admin-attempts-C761C4Ys.js → admin-attempts-DWjIBJOm.js} +8 -8
- package/dist/{admin-attempts-C761C4Ys.js.map → admin-attempts-DWjIBJOm.js.map} +1 -1
- package/dist/{admin-auth-CMtFwKlJ.js → admin-auth-CoOuQn-h.js} +2 -2
- package/dist/{admin-auth-CMtFwKlJ.js.map → admin-auth-CoOuQn-h.js.map} +1 -1
- package/dist/{admin-badge-CKME6YUp.js → admin-badge-u30W_xsJ.js} +2 -2
- package/dist/{admin-badge-CKME6YUp.js.map → admin-badge-u30W_xsJ.js.map} +1 -1
- package/dist/{admin-button-BpaYeqIA.js → admin-button-CxwHe1kq.js} +2 -2
- package/dist/{admin-button-BpaYeqIA.js.map → admin-button-CxwHe1kq.js.map} +1 -1
- package/dist/{admin-capabilities-KRi36PEI.js → admin-capabilities-CR_kXo1O.js} +2 -2
- package/dist/{admin-capabilities-KRi36PEI.js.map → admin-capabilities-CR_kXo1O.js.map} +1 -1
- package/dist/{admin-card-DAAMT-zo.js → admin-card-2MDoKLKO.js} +2 -2
- package/dist/{admin-card-DAAMT-zo.js.map → admin-card-2MDoKLKO.js.map} +1 -1
- package/dist/{admin-catalog-DX0fQ_Li.js → admin-catalog-Jeaxiug7.js} +18 -18
- package/dist/{admin-catalog-DX0fQ_Li.js.map → admin-catalog-Jeaxiug7.js.map} +1 -1
- package/dist/{admin-customers-DHnEvj4J.js → admin-customers-Da7HpOfT.js} +6 -6
- package/dist/{admin-customers-DHnEvj4J.js.map → admin-customers-Da7HpOfT.js.map} +1 -1
- package/dist/{admin-dashboard-DahEHElc.js → admin-dashboard-BMQVUn-1.js} +14 -14
- package/dist/{admin-dashboard-DahEHElc.js.map → admin-dashboard-BMQVUn-1.js.map} +1 -1
- package/dist/{admin-data-table-JFcCM4nz.js → admin-data-table-DZt4Qa0G.js} +6 -6
- package/dist/{admin-data-table-JFcCM4nz.js.map → admin-data-table-DZt4Qa0G.js.map} +1 -1
- package/dist/{admin-detail-EFditqtQ.js → admin-detail-BEa3CslM.js} +12 -12
- package/dist/{admin-detail-EFditqtQ.js.map → admin-detail-BEa3CslM.js.map} +1 -1
- package/dist/{admin-detail-Dum-UENt.js → admin-detail-CmP7B4jy.js} +15 -15
- package/dist/{admin-detail-Dum-UENt.js.map → admin-detail-CmP7B4jy.js.map} +1 -1
- package/dist/{admin-detail-CrZd_jsD.js → admin-detail-D4emDRBW.js} +11 -11
- package/dist/{admin-detail-CrZd_jsD.js.map → admin-detail-D4emDRBW.js.map} +1 -1
- package/dist/{admin-detail-BBhbe-TN.js → admin-detail-z3ctRzrU.js} +15 -15
- package/dist/{admin-detail-BBhbe-TN.js.map → admin-detail-z3ctRzrU.js.map} +1 -1
- package/dist/{admin-dialog-C6q9m4AO.js → admin-dialog-CrUVcoIa.js} +3 -3
- package/dist/{admin-dialog-C6q9m4AO.js.map → admin-dialog-CrUVcoIa.js.map} +1 -1
- package/dist/{admin-dom-CFOQMhV5.js → admin-dom-dHFky0E4.js} +4 -4
- package/dist/{admin-dom-CFOQMhV5.js.map → admin-dom-dHFky0E4.js.map} +1 -1
- package/dist/{admin-dropdown-menu-B0BamhwM.js → admin-dropdown-menu-Dp3H1-jG.js} +2 -2
- package/dist/{admin-dropdown-menu-B0BamhwM.js.map → admin-dropdown-menu-Dp3H1-jG.js.map} +1 -1
- package/dist/{admin-fact-card-CayqfxhD.js → admin-fact-card-cUIlus24.js} +2 -2
- package/dist/{admin-fact-card-CayqfxhD.js.map → admin-fact-card-cUIlus24.js.map} +1 -1
- package/dist/{admin-health-DrYyfrQG.js → admin-health-C1_gvPn3.js} +9 -9
- package/dist/{admin-health-DrYyfrQG.js.map → admin-health-C1_gvPn3.js.map} +1 -1
- package/dist/{admin-input-D5JvWtz6.js → admin-input-efDEUMq_.js} +2 -2
- package/dist/{admin-input-D5JvWtz6.js.map → admin-input-efDEUMq_.js.map} +1 -1
- package/dist/{admin-label-DiDLN80J.js → admin-label-CCWfJBgj.js} +2 -2
- package/dist/{admin-label-DiDLN80J.js.map → admin-label-CCWfJBgj.js.map} +1 -1
- package/dist/{admin-linked-table-row-BLui28tf.js → admin-linked-table-row-B2FZB0fb.js} +4 -4
- package/dist/{admin-linked-table-row-BLui28tf.js.map → admin-linked-table-row-B2FZB0fb.js.map} +1 -1
- package/dist/{admin-metering-DlUZXwed.js → admin-metering-8H60g7za.js} +14 -14
- package/dist/{admin-metering-DlUZXwed.js.map → admin-metering-8H60g7za.js.map} +1 -1
- package/dist/{admin-ops-CotDCsxb.js → admin-ops-uv0TOEQj.js} +11 -11
- package/dist/{admin-ops-CotDCsxb.js.map → admin-ops-uv0TOEQj.js.map} +1 -1
- package/dist/{admin-orders-DfJWLFAI.js → admin-orders-BEuKlqRk.js} +8 -8
- package/dist/{admin-orders-DfJWLFAI.js.map → admin-orders-BEuKlqRk.js.map} +1 -1
- package/dist/{admin-payments-yaUgdqSl.js → admin-payments-DdNXYh5s.js} +9 -9
- package/dist/{admin-payments-yaUgdqSl.js.map → admin-payments-DdNXYh5s.js.map} +1 -1
- package/dist/{admin-price-detail-ncX-vQVz.js → admin-price-detail-CU9qmpKA.js} +9 -9
- package/dist/{admin-price-detail-ncX-vQVz.js.map → admin-price-detail-CU9qmpKA.js.map} +1 -1
- package/dist/{admin-price-wizard-BKrUH8iN.js → admin-price-wizard-BHbWs9k-.js} +7 -7
- package/dist/{admin-price-wizard-BKrUH8iN.js.map → admin-price-wizard-BHbWs9k-.js.map} +1 -1
- package/dist/{admin-range-picker-CgCtBuH8.js → admin-range-picker-DSwi7tAv.js} +5 -5
- package/dist/{admin-range-picker-CgCtBuH8.js.map → admin-range-picker-DSwi7tAv.js.map} +1 -1
- package/dist/{admin-reports-Crpx48rH.js → admin-reports-CXVuKp_6.js} +8 -8
- package/dist/{admin-reports-Crpx48rH.js.map → admin-reports-CXVuKp_6.js.map} +1 -1
- package/dist/{admin-select-C-vgRjrt.js → admin-select-DUQi6WF3.js} +2 -2
- package/dist/{admin-select-C-vgRjrt.js.map → admin-select-DUQi6WF3.js.map} +1 -1
- package/dist/{admin-settings-Ms2ghC00.js → admin-settings-DZGrBr8F.js} +13 -13
- package/dist/{admin-settings-Ms2ghC00.js.map → admin-settings-DZGrBr8F.js.map} +1 -1
- package/dist/{admin-skeleton-DwCr2rr_.js → admin-skeleton-9lJsUfWq.js} +2 -2
- package/dist/{admin-skeleton-DwCr2rr_.js.map → admin-skeleton-9lJsUfWq.js.map} +1 -1
- package/dist/{admin-status-badge-BPYozxZA.js → admin-status-badge-ClEvhHcQ.js} +2 -2
- package/dist/{admin-status-badge-BPYozxZA.js.map → admin-status-badge-ClEvhHcQ.js.map} +1 -1
- package/dist/{admin-subscriptions-CiAsfgw4.js → admin-subscriptions-D1aP6lrm.js} +9 -9
- package/dist/{admin-subscriptions-CiAsfgw4.js.map → admin-subscriptions-D1aP6lrm.js.map} +1 -1
- package/dist/{admin-switch-DCQyukkF.js → admin-switch-DdlzY8ux.js} +2 -2
- package/dist/{admin-switch-DCQyukkF.js.map → admin-switch-DdlzY8ux.js.map} +1 -1
- package/dist/{admin-table-Cvdx51W3.js → admin-table-Bf2ARo0f.js} +2 -2
- package/dist/{admin-table-Cvdx51W3.js.map → admin-table-Bf2ARo0f.js.map} +1 -1
- package/dist/{admin-tabs-opLnz2dz.js → admin-tabs-Bbi6W5Zq.js} +2 -2
- package/dist/{admin-tabs-opLnz2dz.js.map → admin-tabs-Bbi6W5Zq.js.map} +1 -1
- package/dist/{admin-textarea-YT0_5ldp.js → admin-textarea-Dp6LDB9h.js} +2 -2
- package/dist/{admin-textarea-YT0_5ldp.js.map → admin-textarea-Dp6LDB9h.js.map} +1 -1
- package/dist/{admin-typed-confirm-dialog-Dk0tz8C0.js → admin-typed-confirm-dialog-Rff1Ixsp.js} +6 -6
- package/dist/{admin-typed-confirm-dialog-Dk0tz8C0.js.map → admin-typed-confirm-dialog-Rff1Ixsp.js.map} +1 -1
- package/dist/{admin-utils-CwzkGo6Y.js → admin-utils-KQZv9NPg.js} +30 -3
- package/dist/{admin-utils-CwzkGo6Y.js.map → admin-utils-KQZv9NPg.js.map} +1 -1
- package/dist/{admin-widget-viz-D0ZYS8wJ.js → admin-widget-viz-DKfb-3bv.js} +3 -3
- package/dist/{admin-widget-viz-D0ZYS8wJ.js.map → admin-widget-viz-DKfb-3bv.js.map} +1 -1
- package/dist/admin.js +28 -28
- package/dist/client/client.d.ts +6 -1
- package/dist/client/generated/routes.d.ts +14 -0
- package/dist/client/generated/wire.d.ts +5 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/types.d.ts +65 -0
- package/dist/{client-CDA6v1Jd.js → client-B_Ujr9ei.js} +96 -89
- package/dist/client-B_Ujr9ei.js.map +1 -0
- package/dist/client.js +1 -1
- package/dist/{hooks-UswS31Eu.js → hooks-CYo-sw2y.js} +16 -7
- package/dist/{hooks-UswS31Eu.js.map → hooks-CYo-sw2y.js.map} +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +996 -786
- package/dist/index.js.map +1 -1
- package/dist/locales/de.js +29 -2
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.d.ts +27 -0
- package/dist/locales/en.js +29 -2
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +29 -2
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +29 -2
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +29 -2
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +29 -2
- package/dist/locales/zh.js.map +1 -1
- package/dist/react/hooks.d.ts +10 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react.js +2 -2
- package/package.json +1 -1
- package/dist/client-CDA6v1Jd.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -11,27 +11,27 @@ 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 {
|
|
16
|
-
import { t as
|
|
17
|
-
import { z as
|
|
18
|
-
import * as
|
|
19
|
-
import { Fragment as
|
|
14
|
+
import { A as e, C as t, E as n, O as r, S as i, _ as a, a as o, b as s, d as c, f as l, g as u, h as d, p as f, s as p, v as m, w as h, x as g, y as _ } from "./client-B_Ujr9ei.js";
|
|
15
|
+
import { S as v, _ as y, a as b, b as x, c as S, g as C, h as w, i as T, m as E, n as D, o as O, p as k, r as ee, s as te, t as A, u as j, v as ne, x as re, y as ie } from "./hooks-CYo-sw2y.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 ae, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
20
20
|
import { cn as L } from "cn";
|
|
21
|
-
import { Button as
|
|
22
|
-
import { cva as
|
|
23
|
-
import { mergeProps as
|
|
24
|
-
import { useRender as
|
|
25
|
-
import { HugeiconsIcon as
|
|
26
|
-
import { Add01Icon as
|
|
21
|
+
import { Button as R } from "@base-ui/react/button";
|
|
22
|
+
import { cva as oe } from "class-variance-authority";
|
|
23
|
+
import { mergeProps as z } from "@base-ui/react/merge-props";
|
|
24
|
+
import { useRender as se } from "@base-ui/react/use-render";
|
|
25
|
+
import { HugeiconsIcon as ce } from "@hugeicons/react";
|
|
26
|
+
import { Add01Icon as le, ArrowUpRight01Icon as ue, Cancel01Icon as de, Delete02Icon as fe, Loading03Icon as pe } from "@hugeicons/core-free-icons";
|
|
27
27
|
import { AlertDialog as B } from "@base-ui/react/alert-dialog";
|
|
28
28
|
import { Dialog as V } from "@base-ui/react/dialog";
|
|
29
|
-
import { Input as
|
|
30
|
-
import { Radio as
|
|
31
|
-
import { RadioGroup as
|
|
29
|
+
import { Input as me } from "@base-ui/react/input";
|
|
30
|
+
import { Radio as he } from "@base-ui/react/radio";
|
|
31
|
+
import { RadioGroup as ge } from "@base-ui/react/radio-group";
|
|
32
32
|
//#region src/scope.tsx
|
|
33
|
-
function
|
|
34
|
-
let i =
|
|
33
|
+
function _e({ appearance: e, className: t, style: n, ...r }) {
|
|
34
|
+
let i = k(e);
|
|
35
35
|
return /* @__PURE__ */ F("div", {
|
|
36
36
|
"data-orck-theme": i["data-orck-theme"],
|
|
37
37
|
className: L(i.className, t),
|
|
@@ -44,7 +44,7 @@ function ge({ appearance: e, className: t, style: n, ...r }) {
|
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region src/components/ui/button.tsx
|
|
47
|
-
var
|
|
47
|
+
var H = oe("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
48
48
|
variants: {
|
|
49
49
|
variant: {
|
|
50
50
|
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
@@ -70,10 +70,10 @@ var _e = R("group/button inline-flex shrink-0 items-center justify-center rounde
|
|
|
70
70
|
size: "default"
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
-
function
|
|
74
|
-
return /* @__PURE__ */ F(
|
|
73
|
+
function U({ className: e, variant: t = "default", size: n = "default", ...r }) {
|
|
74
|
+
return /* @__PURE__ */ F(R, {
|
|
75
75
|
"data-slot": "button",
|
|
76
|
-
className: L(
|
|
76
|
+
className: L(H({
|
|
77
77
|
variant: t,
|
|
78
78
|
size: n,
|
|
79
79
|
className: e
|
|
@@ -83,7 +83,7 @@ function H({ className: e, variant: t = "default", size: n = "default", ...r })
|
|
|
83
83
|
}
|
|
84
84
|
//#endregion
|
|
85
85
|
//#region src/lib/period.ts
|
|
86
|
-
function
|
|
86
|
+
function ve(e) {
|
|
87
87
|
return !e || !Number.isSafeInteger(e) || e <= 0 ? null : e % 168 == 0 ? {
|
|
88
88
|
unit: "week",
|
|
89
89
|
count: e / 168
|
|
@@ -95,17 +95,17 @@ function U(e) {
|
|
|
95
95
|
count: e
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
let n =
|
|
98
|
+
function ye(e, t) {
|
|
99
|
+
let n = ve(e);
|
|
100
100
|
return n ? t.plural(`interval.every.${n.unit}`, n.count) : null;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
let n =
|
|
102
|
+
function W(e, t) {
|
|
103
|
+
let n = ve(e);
|
|
104
104
|
return n ? t.plural(`interval.access.${n.unit}`, n.count) : null;
|
|
105
105
|
}
|
|
106
106
|
//#endregion
|
|
107
107
|
//#region src/account/format.ts
|
|
108
|
-
function
|
|
108
|
+
function G(e, t) {
|
|
109
109
|
if (!e) return null;
|
|
110
110
|
let n = new Date(e);
|
|
111
111
|
if (Number.isNaN(n.getTime())) return null;
|
|
@@ -115,13 +115,13 @@ function W(e, t) {
|
|
|
115
115
|
return n.toISOString().slice(0, 10);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function K(e, t, n, r) {
|
|
119
119
|
if (!e) return null;
|
|
120
120
|
let i = n[t.toUpperCase()];
|
|
121
121
|
return i === void 0 ? null : d(e, t, i, r);
|
|
122
122
|
}
|
|
123
123
|
function be(e, t) {
|
|
124
|
-
return e ? e.billing_interval_hours ?
|
|
124
|
+
return e ? e.billing_interval_hours ? ye(e.billing_interval_hours, t) : W(e.access_duration_hours, t) ?? t.t("interval.once") : null;
|
|
125
125
|
}
|
|
126
126
|
function xe(e, { t }) {
|
|
127
127
|
return e.product?.display_name?.trim() || e.price?.key?.trim() || t("subscriptions.fallbackName");
|
|
@@ -130,7 +130,7 @@ function Se(e, t, n) {
|
|
|
130
130
|
let r = [...new Set((t?.lines ?? []).map((e) => e.description.trim()).filter(Boolean))], i = t?.lines.length === 1 ? t.lines[0] : void 0;
|
|
131
131
|
return {
|
|
132
132
|
name: r.join(", ") || n.t(e.subscription_id ? "history.subscription" : "history.purchase"),
|
|
133
|
-
detail: i?.billing_interval_hours ?
|
|
133
|
+
detail: i?.billing_interval_hours ? ye(i.billing_interval_hours, n) : null
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
function Ce(e, t) {
|
|
@@ -155,7 +155,7 @@ var Ee = /* @__PURE__ */ new Set([
|
|
|
155
155
|
"past_due",
|
|
156
156
|
"awaiting_method",
|
|
157
157
|
"unverified"
|
|
158
|
-
]), De = (e) => !!e && new Date(e).getTime() > Date.now(), Oe = (e) => Ee.has(e.status) || e.status === "canceled" && !!e.access && (!e.access.ends_at || De(e.access.ends_at)), ke = (e) => Oe(e) && (!!e.cancel_scheduled || e.status === "canceled"), Ae = {
|
|
158
|
+
]), De = (e) => !!e && new Date(e).getTime() > Date.now(), Oe = (e) => Ee.has(e.status) || e.status === "canceled" && !!e.access && (!e.access.ends_at || De(e.access.ends_at)), ke = (e) => Oe(e) && (!!e.cancel_scheduled || e.status === "canceled"), Ae = (e) => (e.status === "active" || e.status === "past_due") && !e.cancel_scheduled && !e.cancel_portal_url && !!e.product?.tier_group, je = {
|
|
159
159
|
active: "success",
|
|
160
160
|
succeeded: "success",
|
|
161
161
|
paid: "success",
|
|
@@ -171,10 +171,10 @@ var Ee = /* @__PURE__ */ new Set([
|
|
|
171
171
|
expired: "destructive",
|
|
172
172
|
canceled: "neutral",
|
|
173
173
|
refunded: "neutral"
|
|
174
|
-
},
|
|
174
|
+
}, Me = (e) => je[e] ?? "neutral", q = "[&_h2]:m-0 [&_p]:m-0 [&_ul]:m-0 [&_ul]:list-none [&_ul]:p-0 [&_table]:border-spacing-0";
|
|
175
175
|
//#endregion
|
|
176
176
|
//#region src/components/ui/card.tsx
|
|
177
|
-
function
|
|
177
|
+
function Ne({ className: e, size: t = "default", ...n }) {
|
|
178
178
|
return /* @__PURE__ */ F("div", {
|
|
179
179
|
"data-slot": "card",
|
|
180
180
|
"data-size": t,
|
|
@@ -182,21 +182,21 @@ function Me({ className: e, size: t = "default", ...n }) {
|
|
|
182
182
|
...n
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function Pe({ className: e, ...t }) {
|
|
186
186
|
return /* @__PURE__ */ F("div", {
|
|
187
187
|
"data-slot": "card-header",
|
|
188
188
|
className: L("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)", e),
|
|
189
189
|
...t
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function Fe({ className: e, ...t }) {
|
|
193
193
|
return /* @__PURE__ */ F("div", {
|
|
194
194
|
"data-slot": "card-title",
|
|
195
195
|
className: L("text-base leading-normal font-medium group-data-[size=sm]/card:text-sm", e),
|
|
196
196
|
...t
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function J({ className: e, ...t }) {
|
|
200
200
|
return /* @__PURE__ */ F("div", {
|
|
201
201
|
"data-slot": "card-description",
|
|
202
202
|
className: L("text-sm text-muted-foreground", e),
|
|
@@ -210,7 +210,7 @@ function Ie({ className: e, ...t }) {
|
|
|
210
210
|
...t
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function Y({ className: e, ...t }) {
|
|
214
214
|
return /* @__PURE__ */ F("div", {
|
|
215
215
|
"data-slot": "card-content",
|
|
216
216
|
className: L("flex flex-col gap-3 px-(--card-spacing)", e),
|
|
@@ -219,7 +219,7 @@ function q({ className: e, ...t }) {
|
|
|
219
219
|
}
|
|
220
220
|
//#endregion
|
|
221
221
|
//#region src/components/ui/skeleton.tsx
|
|
222
|
-
function
|
|
222
|
+
function X({ className: e, ...t }) {
|
|
223
223
|
return /* @__PURE__ */ F("div", {
|
|
224
224
|
"data-slot": "skeleton",
|
|
225
225
|
className: L("animate-pulse rounded-md bg-muted", e),
|
|
@@ -228,50 +228,50 @@ function J({ className: e, ...t }) {
|
|
|
228
228
|
}
|
|
229
229
|
//#endregion
|
|
230
230
|
//#region src/account/section.tsx
|
|
231
|
-
function
|
|
232
|
-
let s =
|
|
231
|
+
function Le({ title: e, description: t, action: n, appearance: r, className: i, children: a, ...o }) {
|
|
232
|
+
let s = k(r), c = P.useId();
|
|
233
233
|
return /* @__PURE__ */ F("section", {
|
|
234
234
|
"aria-labelledby": c,
|
|
235
|
-
className: L(s.className,
|
|
235
|
+
className: L(s.className, q, "block", i),
|
|
236
236
|
"data-orck-theme": s["data-orck-theme"],
|
|
237
237
|
style: s.style,
|
|
238
238
|
"data-testid": o["data-testid"],
|
|
239
|
-
children: /* @__PURE__ */ I(
|
|
239
|
+
children: /* @__PURE__ */ I(Ne, {
|
|
240
240
|
className: "gap-4 bg-card text-card-foreground",
|
|
241
|
-
children: [/* @__PURE__ */ I(
|
|
242
|
-
/* @__PURE__ */ F(
|
|
241
|
+
children: [/* @__PURE__ */ I(Pe, { children: [
|
|
242
|
+
/* @__PURE__ */ F(Fe, {
|
|
243
243
|
id: c,
|
|
244
244
|
role: "heading",
|
|
245
245
|
"aria-level": 2,
|
|
246
246
|
children: e
|
|
247
247
|
}),
|
|
248
|
-
t ? /* @__PURE__ */ F(
|
|
248
|
+
t ? /* @__PURE__ */ F(J, { children: t }) : null,
|
|
249
249
|
n ? /* @__PURE__ */ F(Ie, { children: n }) : null
|
|
250
|
-
] }), /* @__PURE__ */ F(
|
|
250
|
+
] }), /* @__PURE__ */ F(Y, {
|
|
251
251
|
className: "gap-0",
|
|
252
252
|
children: a
|
|
253
253
|
})]
|
|
254
254
|
})
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Re({ rows: e = 2 }) {
|
|
258
258
|
return /* @__PURE__ */ F("div", {
|
|
259
259
|
className: "grid gap-4 py-2",
|
|
260
260
|
"aria-hidden": !0,
|
|
261
261
|
children: Array.from({ length: e }, (e, t) => /* @__PURE__ */ I("div", {
|
|
262
262
|
className: "flex items-center gap-3",
|
|
263
263
|
children: [
|
|
264
|
-
/* @__PURE__ */ F(
|
|
264
|
+
/* @__PURE__ */ F(X, { className: "h-7 w-11 rounded-md" }),
|
|
265
265
|
/* @__PURE__ */ I("div", {
|
|
266
266
|
className: "grid flex-1 gap-2",
|
|
267
|
-
children: [/* @__PURE__ */ F(
|
|
267
|
+
children: [/* @__PURE__ */ F(X, { className: "h-3.5 w-40" }), /* @__PURE__ */ F(X, { className: "h-3 w-28" })]
|
|
268
268
|
}),
|
|
269
|
-
/* @__PURE__ */ F(
|
|
269
|
+
/* @__PURE__ */ F(X, { className: "h-3.5 w-14" })
|
|
270
270
|
]
|
|
271
271
|
}, t))
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
|
-
function
|
|
274
|
+
function ze({ title: e, description: t, action: n }) {
|
|
275
275
|
return /* @__PURE__ */ I("div", {
|
|
276
276
|
className: "grid justify-items-center gap-1 rounded-lg border border-dashed px-4 py-8 text-center",
|
|
277
277
|
children: [
|
|
@@ -290,15 +290,15 @@ function Re({ title: e, description: t, action: n }) {
|
|
|
290
290
|
]
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
let r =
|
|
293
|
+
function Be({ error: e, message: t, onRetry: n }) {
|
|
294
|
+
let r = y();
|
|
295
295
|
return /* @__PURE__ */ I("div", {
|
|
296
296
|
role: "alert",
|
|
297
297
|
className: "flex flex-wrap items-center justify-between gap-3 rounded-lg bg-destructive/5 px-4 py-3",
|
|
298
298
|
children: [/* @__PURE__ */ F("p", {
|
|
299
299
|
className: "text-sm text-destructive",
|
|
300
300
|
children: t ?? r.error(e)
|
|
301
|
-
}), /* @__PURE__ */ F(
|
|
301
|
+
}), /* @__PURE__ */ F(U, {
|
|
302
302
|
variant: "outline",
|
|
303
303
|
size: "sm",
|
|
304
304
|
onClick: n,
|
|
@@ -308,7 +308,7 @@ function ze({ error: e, message: t, onRetry: n }) {
|
|
|
308
308
|
}
|
|
309
309
|
//#endregion
|
|
310
310
|
//#region src/components/ui/badge.tsx
|
|
311
|
-
var
|
|
311
|
+
var Ve = oe("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
|
|
312
312
|
variants: { variant: {
|
|
313
313
|
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
314
314
|
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
@@ -319,10 +319,10 @@ var Be = R("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-cent
|
|
|
319
319
|
} },
|
|
320
320
|
defaultVariants: { variant: "default" }
|
|
321
321
|
});
|
|
322
|
-
function
|
|
323
|
-
return
|
|
322
|
+
function He({ className: e, variant: t = "default", render: n, ...r }) {
|
|
323
|
+
return se({
|
|
324
324
|
defaultTagName: "span",
|
|
325
|
-
props:
|
|
325
|
+
props: z({ className: L(Ve({ variant: t }), e) }, r),
|
|
326
326
|
render: n,
|
|
327
327
|
state: {
|
|
328
328
|
slot: "badge",
|
|
@@ -332,33 +332,33 @@ function Ve({ className: e, variant: t = "default", render: n, ...r }) {
|
|
|
332
332
|
}
|
|
333
333
|
//#endregion
|
|
334
334
|
//#region src/account/status-badge.tsx
|
|
335
|
-
var
|
|
335
|
+
var Ue = {
|
|
336
336
|
success: "bg-[color:var(--orck-success)]/12 text-[color:var(--orck-success)]",
|
|
337
337
|
warning: "bg-[color:var(--orck-warning)]/14 text-[color:var(--orck-warning)]",
|
|
338
338
|
destructive: "bg-destructive/10 text-destructive",
|
|
339
339
|
neutral: "bg-muted text-muted-foreground"
|
|
340
340
|
};
|
|
341
|
-
function
|
|
342
|
-
let { t: r, messages: i } =
|
|
343
|
-
return /* @__PURE__ */ F(
|
|
341
|
+
function We({ status: e, label: t, className: n }) {
|
|
342
|
+
let { t: r, messages: i } = y(), a = e, o = t ?? (a in i.status ? r(`status.${a}`) : e.replace(/_/g, " "));
|
|
343
|
+
return /* @__PURE__ */ F(He, {
|
|
344
344
|
"data-status": e,
|
|
345
|
-
className: L(
|
|
345
|
+
className: L(Ue[Me(e)], "font-medium", n),
|
|
346
346
|
children: o
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
349
|
//#endregion
|
|
350
350
|
//#region src/account/payment-history.tsx
|
|
351
|
-
function
|
|
351
|
+
function Ge(e, t) {
|
|
352
352
|
if (e.card?.last4) return we(e.card, t);
|
|
353
353
|
let n = e.rail ?? "";
|
|
354
354
|
return n in t.messages.history.rail ? t.t(`history.rail.${n}`) : n || t.t("common.notAvailable");
|
|
355
355
|
}
|
|
356
|
-
function
|
|
357
|
-
let r =
|
|
358
|
-
c = l === null && o.error ? /* @__PURE__ */ F(
|
|
356
|
+
function Ke({ appearance: e, className: t, ...n }) {
|
|
357
|
+
let r = y(), { t: i } = r, { locale: a } = E(), o = ee(n), s = te(), c, l = o.payments;
|
|
358
|
+
c = l === null && o.error ? /* @__PURE__ */ F(Be, {
|
|
359
359
|
error: o.error,
|
|
360
360
|
onRetry: o.refetch
|
|
361
|
-
}) : l === null ? /* @__PURE__ */ F(
|
|
361
|
+
}) : l === null ? /* @__PURE__ */ F(Re, { rows: 3 }) : l.length === 0 && o.page === 0 ? /* @__PURE__ */ F(ze, {
|
|
362
362
|
title: i("history.empty"),
|
|
363
363
|
description: i("history.emptyDescription")
|
|
364
364
|
}) : /* @__PURE__ */ F("div", {
|
|
@@ -398,7 +398,7 @@ function Ge({ appearance: e, className: t, ...n }) {
|
|
|
398
398
|
}) }), /* @__PURE__ */ F("tbody", {
|
|
399
399
|
className: "divide-y divide-border",
|
|
400
400
|
children: l.map((e) => {
|
|
401
|
-
let t = e.kind === "refund", n = e.status || (t ? "refunded" : "unknown"), c =
|
|
401
|
+
let t = e.kind === "refund", n = e.status || (t ? "refunded" : "unknown"), c = K(e.amount, e.currency, s, a), l = !t && e.amount_refunded && e.amount_refunded !== "0" ? K(e.amount_refunded, e.currency, s, a) : null, u = G(e.created_at, a) ?? i("common.notAvailable"), d = Se(e, e.order_id ? o.orders[e.order_id] : void 0, r);
|
|
402
402
|
return /* @__PURE__ */ I("tr", {
|
|
403
403
|
"data-testid": "payment-row",
|
|
404
404
|
"data-payment-id": e.id,
|
|
@@ -430,18 +430,18 @@ function Ge({ appearance: e, className: t, ...n }) {
|
|
|
430
430
|
children: [
|
|
431
431
|
u,
|
|
432
432
|
" · ",
|
|
433
|
-
|
|
433
|
+
Ge(e, r)
|
|
434
434
|
]
|
|
435
435
|
})
|
|
436
436
|
]
|
|
437
437
|
}),
|
|
438
438
|
/* @__PURE__ */ F("td", {
|
|
439
439
|
className: "hidden py-3 pr-3 align-top text-muted-foreground tabular-nums @md:table-cell",
|
|
440
|
-
children:
|
|
440
|
+
children: Ge(e, r)
|
|
441
441
|
}),
|
|
442
442
|
/* @__PURE__ */ F("td", {
|
|
443
443
|
className: "py-3 pr-3 align-top",
|
|
444
|
-
children: /* @__PURE__ */ F(
|
|
444
|
+
children: /* @__PURE__ */ F(We, {
|
|
445
445
|
status: n,
|
|
446
446
|
label: t ? i("history.refund") : void 0
|
|
447
447
|
})
|
|
@@ -460,7 +460,7 @@ function Ge({ appearance: e, className: t, ...n }) {
|
|
|
460
460
|
})
|
|
461
461
|
});
|
|
462
462
|
let u = o.page > 0 || o.hasMore;
|
|
463
|
-
return /* @__PURE__ */ I(
|
|
463
|
+
return /* @__PURE__ */ I(Le, {
|
|
464
464
|
title: i("history.title"),
|
|
465
465
|
description: i("history.description"),
|
|
466
466
|
appearance: e,
|
|
@@ -470,7 +470,7 @@ function Ge({ appearance: e, className: t, ...n }) {
|
|
|
470
470
|
c,
|
|
471
471
|
l !== null && o.error ? /* @__PURE__ */ F("div", {
|
|
472
472
|
className: "pt-3",
|
|
473
|
-
children: /* @__PURE__ */ F(
|
|
473
|
+
children: /* @__PURE__ */ F(Be, {
|
|
474
474
|
error: o.error,
|
|
475
475
|
onRetry: o.refetch
|
|
476
476
|
})
|
|
@@ -483,13 +483,13 @@ function Ge({ appearance: e, className: t, ...n }) {
|
|
|
483
483
|
children: i("history.page", { page: o.page + 1 })
|
|
484
484
|
}), /* @__PURE__ */ I("div", {
|
|
485
485
|
className: "flex gap-2",
|
|
486
|
-
children: [/* @__PURE__ */ F(
|
|
486
|
+
children: [/* @__PURE__ */ F(U, {
|
|
487
487
|
variant: "outline",
|
|
488
488
|
size: "sm",
|
|
489
489
|
disabled: o.page === 0 || o.loading,
|
|
490
490
|
onClick: o.previous,
|
|
491
491
|
children: i("common.previous")
|
|
492
|
-
}), /* @__PURE__ */ F(
|
|
492
|
+
}), /* @__PURE__ */ F(U, {
|
|
493
493
|
variant: "outline",
|
|
494
494
|
size: "sm",
|
|
495
495
|
disabled: !o.hasMore || o.loading,
|
|
@@ -503,7 +503,7 @@ function Ge({ appearance: e, className: t, ...n }) {
|
|
|
503
503
|
}
|
|
504
504
|
//#endregion
|
|
505
505
|
//#region src/lib/card-brands.ts
|
|
506
|
-
var
|
|
506
|
+
var qe = {
|
|
507
507
|
visa: "visa",
|
|
508
508
|
mastercard: "mastercard",
|
|
509
509
|
mc: "mastercard",
|
|
@@ -512,13 +512,13 @@ var Ke = {
|
|
|
512
512
|
americanexpress: "amex",
|
|
513
513
|
"american express": "amex"
|
|
514
514
|
};
|
|
515
|
-
function
|
|
515
|
+
function Je(e) {
|
|
516
516
|
let t = e?.trim().toLowerCase().replace(/[^a-z ]/g, "");
|
|
517
|
-
return t ?
|
|
517
|
+
return t ? qe[t] : void 0;
|
|
518
518
|
}
|
|
519
519
|
//#endregion
|
|
520
520
|
//#region src/components/card-brands.tsx
|
|
521
|
-
function
|
|
521
|
+
function Ye() {
|
|
522
522
|
return /* @__PURE__ */ F("svg", {
|
|
523
523
|
viewBox: "0 0 1000 324.68",
|
|
524
524
|
className: "h-2.5 w-auto",
|
|
@@ -529,7 +529,7 @@ function Je() {
|
|
|
529
529
|
})
|
|
530
530
|
});
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function Xe() {
|
|
533
533
|
return /* @__PURE__ */ F("svg", {
|
|
534
534
|
viewBox: "0 0 152.4 108",
|
|
535
535
|
className: "h-4 w-auto",
|
|
@@ -558,8 +558,8 @@ function Ye() {
|
|
|
558
558
|
] })] })
|
|
559
559
|
});
|
|
560
560
|
}
|
|
561
|
-
function
|
|
562
|
-
let e = `orck-amex-${
|
|
561
|
+
function Ze() {
|
|
562
|
+
let e = `orck-amex-${P.useId().replace(/[^a-zA-Z0-9-]/g, "")}`;
|
|
563
563
|
return /* @__PURE__ */ I("svg", {
|
|
564
564
|
viewBox: "0 0 300 300",
|
|
565
565
|
className: "h-full w-auto",
|
|
@@ -622,34 +622,34 @@ function Xe() {
|
|
|
622
622
|
]
|
|
623
623
|
});
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
let r =
|
|
625
|
+
function Qe({ brand: e, fallback: t, className: n }) {
|
|
626
|
+
let r = Je(e);
|
|
627
627
|
return /* @__PURE__ */ F("span", {
|
|
628
628
|
"aria-hidden": !0,
|
|
629
629
|
className: L("grid h-7 w-11 shrink-0 place-items-center overflow-hidden rounded-md", r ? "bg-white" : "bg-muted text-[10px] font-semibold tracking-wide text-muted-foreground uppercase", n),
|
|
630
|
-
children: r === "visa" ? /* @__PURE__ */ F(
|
|
630
|
+
children: r === "visa" ? /* @__PURE__ */ F(Ye, {}) : r === "mastercard" ? /* @__PURE__ */ F(Xe, {}) : r === "amex" ? /* @__PURE__ */ F(Ze, {}) : t
|
|
631
631
|
});
|
|
632
632
|
}
|
|
633
|
-
var
|
|
633
|
+
var $e = [
|
|
634
634
|
{
|
|
635
635
|
brand: "visa",
|
|
636
|
-
Mark:
|
|
636
|
+
Mark: Ye
|
|
637
637
|
},
|
|
638
638
|
{
|
|
639
639
|
brand: "mastercard",
|
|
640
|
-
Mark:
|
|
640
|
+
Mark: Xe
|
|
641
641
|
},
|
|
642
642
|
{
|
|
643
643
|
brand: "amex",
|
|
644
|
-
Mark:
|
|
644
|
+
Mark: Ze
|
|
645
645
|
}
|
|
646
646
|
];
|
|
647
|
-
function
|
|
648
|
-
let t =
|
|
647
|
+
function et({ active: e }) {
|
|
648
|
+
let t = Je(e);
|
|
649
649
|
return /* @__PURE__ */ F("span", {
|
|
650
650
|
"aria-hidden": !0,
|
|
651
651
|
className: "flex items-center gap-1",
|
|
652
|
-
children:
|
|
652
|
+
children: $e.map(({ brand: e, Mark: n }) => /* @__PURE__ */ F("span", {
|
|
653
653
|
className: L("grid h-5 w-8 place-items-center rounded-[4px] bg-white ring-1 ring-[color:var(--border)] transition-opacity", t && t !== e && "opacity-30"),
|
|
654
654
|
children: /* @__PURE__ */ F(n, {})
|
|
655
655
|
}, e))
|
|
@@ -657,66 +657,66 @@ function $e({ active: e }) {
|
|
|
657
657
|
}
|
|
658
658
|
//#endregion
|
|
659
659
|
//#region src/components/ui/alert-dialog.tsx
|
|
660
|
-
function
|
|
660
|
+
function tt({ ...e }) {
|
|
661
661
|
return /* @__PURE__ */ F(B.Root, {
|
|
662
662
|
"data-slot": "alert-dialog",
|
|
663
663
|
...e
|
|
664
664
|
});
|
|
665
665
|
}
|
|
666
|
-
function
|
|
666
|
+
function nt({ ...e }) {
|
|
667
667
|
return /* @__PURE__ */ F(B.Portal, {
|
|
668
668
|
"data-slot": "alert-dialog-portal",
|
|
669
669
|
...e
|
|
670
670
|
});
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function rt({ className: e, ...t }) {
|
|
673
673
|
return /* @__PURE__ */ F(B.Backdrop, {
|
|
674
674
|
"data-slot": "alert-dialog-overlay",
|
|
675
675
|
className: L("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", e),
|
|
676
676
|
...t
|
|
677
677
|
});
|
|
678
678
|
}
|
|
679
|
-
function
|
|
680
|
-
return /* @__PURE__ */ I(
|
|
679
|
+
function it({ className: e, size: t = "default", ...n }) {
|
|
680
|
+
return /* @__PURE__ */ I(nt, { children: [/* @__PURE__ */ F(rt, {}), /* @__PURE__ */ F(B.Popup, {
|
|
681
681
|
"data-slot": "alert-dialog-content",
|
|
682
682
|
"data-size": t,
|
|
683
683
|
className: L("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", e),
|
|
684
684
|
...n
|
|
685
685
|
})] });
|
|
686
686
|
}
|
|
687
|
-
function
|
|
687
|
+
function at({ className: e, ...t }) {
|
|
688
688
|
return /* @__PURE__ */ F("div", {
|
|
689
689
|
"data-slot": "alert-dialog-header",
|
|
690
690
|
className: L("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]", e),
|
|
691
691
|
...t
|
|
692
692
|
});
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function ot({ className: e, ...t }) {
|
|
695
695
|
return /* @__PURE__ */ F("div", {
|
|
696
696
|
"data-slot": "alert-dialog-footer",
|
|
697
697
|
className: L("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end", e),
|
|
698
698
|
...t
|
|
699
699
|
});
|
|
700
700
|
}
|
|
701
|
-
function
|
|
701
|
+
function st({ className: e, ...t }) {
|
|
702
702
|
return /* @__PURE__ */ F(B.Title, {
|
|
703
703
|
"data-slot": "alert-dialog-title",
|
|
704
704
|
className: L("text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2", e),
|
|
705
705
|
...t
|
|
706
706
|
});
|
|
707
707
|
}
|
|
708
|
-
function
|
|
708
|
+
function ct({ className: e, ...t }) {
|
|
709
709
|
return /* @__PURE__ */ F(B.Description, {
|
|
710
710
|
"data-slot": "alert-dialog-description",
|
|
711
711
|
className: L("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", e),
|
|
712
712
|
...t
|
|
713
713
|
});
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function lt({ className: e, variant: t = "outline", size: n = "default", ...r }) {
|
|
716
716
|
return /* @__PURE__ */ F(B.Close, {
|
|
717
717
|
"data-slot": "alert-dialog-cancel",
|
|
718
718
|
className: L(e),
|
|
719
|
-
render: /* @__PURE__ */ F(
|
|
719
|
+
render: /* @__PURE__ */ F(U, {
|
|
720
720
|
variant: t,
|
|
721
721
|
size: n
|
|
722
722
|
}),
|
|
@@ -725,39 +725,39 @@ function ct({ className: e, variant: t = "outline", size: n = "default", ...r })
|
|
|
725
725
|
}
|
|
726
726
|
//#endregion
|
|
727
727
|
//#region src/components/ui/dialog.tsx
|
|
728
|
-
function
|
|
728
|
+
function ut({ ...e }) {
|
|
729
729
|
return /* @__PURE__ */ F(V.Root, {
|
|
730
730
|
"data-slot": "dialog",
|
|
731
731
|
...e
|
|
732
732
|
});
|
|
733
733
|
}
|
|
734
|
-
function
|
|
734
|
+
function dt({ ...e }) {
|
|
735
735
|
return /* @__PURE__ */ F(V.Portal, {
|
|
736
736
|
"data-slot": "dialog-portal",
|
|
737
737
|
...e
|
|
738
738
|
});
|
|
739
739
|
}
|
|
740
|
-
function
|
|
740
|
+
function ft({ className: e, ...t }) {
|
|
741
741
|
return /* @__PURE__ */ F(V.Backdrop, {
|
|
742
742
|
"data-slot": "dialog-overlay",
|
|
743
743
|
className: L("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", e),
|
|
744
744
|
...t
|
|
745
745
|
});
|
|
746
746
|
}
|
|
747
|
-
function
|
|
748
|
-
return /* @__PURE__ */ I(
|
|
747
|
+
function pt({ className: e, children: t, showCloseButton: n = !0, ...r }) {
|
|
748
|
+
return /* @__PURE__ */ I(dt, { children: [/* @__PURE__ */ F(ft, {}), /* @__PURE__ */ I(V.Popup, {
|
|
749
749
|
"data-slot": "dialog-content",
|
|
750
750
|
className: L("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", e),
|
|
751
751
|
...r,
|
|
752
752
|
children: [t, n && /* @__PURE__ */ I(V.Close, {
|
|
753
753
|
"data-slot": "dialog-close",
|
|
754
|
-
render: /* @__PURE__ */ F(
|
|
754
|
+
render: /* @__PURE__ */ F(U, {
|
|
755
755
|
variant: "ghost",
|
|
756
756
|
className: "absolute top-4 right-4",
|
|
757
757
|
size: "icon-sm"
|
|
758
758
|
}),
|
|
759
|
-
children: [/* @__PURE__ */ F(
|
|
760
|
-
icon:
|
|
759
|
+
children: [/* @__PURE__ */ F(ce, {
|
|
760
|
+
icon: de,
|
|
761
761
|
strokeWidth: 2
|
|
762
762
|
}), /* @__PURE__ */ F("span", {
|
|
763
763
|
className: "sr-only",
|
|
@@ -766,32 +766,32 @@ function ft({ className: e, children: t, showCloseButton: n = !0, ...r }) {
|
|
|
766
766
|
})]
|
|
767
767
|
})] });
|
|
768
768
|
}
|
|
769
|
-
function
|
|
769
|
+
function mt({ className: e, ...t }) {
|
|
770
770
|
return /* @__PURE__ */ F("div", {
|
|
771
771
|
"data-slot": "dialog-header",
|
|
772
772
|
className: L("flex flex-col gap-2", e),
|
|
773
773
|
...t
|
|
774
774
|
});
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function ht({ className: e, showCloseButton: t = !1, children: n, ...r }) {
|
|
777
777
|
return /* @__PURE__ */ I("div", {
|
|
778
778
|
"data-slot": "dialog-footer",
|
|
779
779
|
className: L("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", e),
|
|
780
780
|
...r,
|
|
781
781
|
children: [n, t && /* @__PURE__ */ F(V.Close, {
|
|
782
|
-
render: /* @__PURE__ */ F(
|
|
782
|
+
render: /* @__PURE__ */ F(U, { variant: "outline" }),
|
|
783
783
|
children: "Close"
|
|
784
784
|
})]
|
|
785
785
|
});
|
|
786
786
|
}
|
|
787
|
-
function
|
|
787
|
+
function gt({ className: e, ...t }) {
|
|
788
788
|
return /* @__PURE__ */ F(V.Title, {
|
|
789
789
|
"data-slot": "dialog-title",
|
|
790
790
|
className: L("leading-none font-medium", e),
|
|
791
791
|
...t
|
|
792
792
|
});
|
|
793
793
|
}
|
|
794
|
-
function
|
|
794
|
+
function _t({ className: e, ...t }) {
|
|
795
795
|
return /* @__PURE__ */ F(V.Description, {
|
|
796
796
|
"data-slot": "dialog-description",
|
|
797
797
|
className: L("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", e),
|
|
@@ -800,10 +800,10 @@ function gt({ className: e, ...t }) {
|
|
|
800
800
|
}
|
|
801
801
|
//#endregion
|
|
802
802
|
//#region src/components/ui/spinner.tsx
|
|
803
|
-
function
|
|
804
|
-
let { t: n } =
|
|
805
|
-
return /* @__PURE__ */ F(
|
|
806
|
-
icon:
|
|
803
|
+
function Z({ className: e, ...t }) {
|
|
804
|
+
let { t: n } = y();
|
|
805
|
+
return /* @__PURE__ */ F(ce, {
|
|
806
|
+
icon: pe,
|
|
807
807
|
strokeWidth: 2,
|
|
808
808
|
"data-slot": "spinner",
|
|
809
809
|
role: "status",
|
|
@@ -814,8 +814,8 @@ function X({ className: e, ...t }) {
|
|
|
814
814
|
}
|
|
815
815
|
//#endregion
|
|
816
816
|
//#region src/components/ui/input.tsx
|
|
817
|
-
function
|
|
818
|
-
return /* @__PURE__ */ F(
|
|
817
|
+
function vt({ className: e, type: t, ...n }) {
|
|
818
|
+
return /* @__PURE__ */ F(me, {
|
|
819
819
|
type: t,
|
|
820
820
|
"data-slot": "input",
|
|
821
821
|
className: L("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", e),
|
|
@@ -824,7 +824,7 @@ function _t({ className: e, type: t, ...n }) {
|
|
|
824
824
|
}
|
|
825
825
|
//#endregion
|
|
826
826
|
//#region src/components/ui/label.tsx
|
|
827
|
-
function
|
|
827
|
+
function Q({ className: e, ...t }) {
|
|
828
828
|
return /* @__PURE__ */ F("label", {
|
|
829
829
|
"data-slot": "label",
|
|
830
830
|
className: L("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", e),
|
|
@@ -833,7 +833,7 @@ function Z({ className: e, ...t }) {
|
|
|
833
833
|
}
|
|
834
834
|
//#endregion
|
|
835
835
|
//#region src/lib/billing.ts
|
|
836
|
-
var
|
|
836
|
+
var yt = "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(" "), bt = /* @__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(".")), xt = {
|
|
837
837
|
AR: "C1000",
|
|
838
838
|
BR: "01000-000",
|
|
839
839
|
CA: "A1A 1A1",
|
|
@@ -847,31 +847,31 @@ var vt = "AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH B
|
|
|
847
847
|
MX: "01000",
|
|
848
848
|
PE: "15001",
|
|
849
849
|
US: "12345"
|
|
850
|
-
},
|
|
850
|
+
}, St = new Intl.DisplayNames(["en"], { type: "region" }), Ct = yt.map((e) => ({
|
|
851
851
|
code: e,
|
|
852
|
-
name:
|
|
853
|
-
})).sort((e, t) => e.name.localeCompare(t.name)),
|
|
854
|
-
function
|
|
852
|
+
name: St.of(e) ?? e
|
|
853
|
+
})).sort((e, t) => e.name.localeCompare(t.name)), wt = N.string().trim().min(1, "Full name is required").max(200, "Full name is too long"), Tt = N.string().trim().regex(/^[A-Za-z]{2}$/, "Select a country").transform((e) => e.toUpperCase());
|
|
854
|
+
function Et(e) {
|
|
855
855
|
let t = e.trim().toUpperCase();
|
|
856
|
-
return t === "" || !
|
|
856
|
+
return t === "" || !bt.has(t);
|
|
857
857
|
}
|
|
858
|
-
function
|
|
858
|
+
function Dt(e, t) {
|
|
859
859
|
let n = e.trim().toUpperCase(), r = n === "US" ? "ZIP code" : n === "GB" || n === "AU" || n === "NZ" ? "Postcode" : "Postal code";
|
|
860
860
|
return {
|
|
861
861
|
label: t ? r : `${r} (optional)`,
|
|
862
|
-
placeholder:
|
|
862
|
+
placeholder: xt[n] ?? r,
|
|
863
863
|
inputMode: n === "US" ? "numeric" : "text",
|
|
864
864
|
pattern: n === "US" ? "[0-9]{5}(?:-[0-9]{4})?" : void 0
|
|
865
865
|
};
|
|
866
866
|
}
|
|
867
|
-
var
|
|
868
|
-
name_on_card:
|
|
869
|
-
country:
|
|
870
|
-
zip:
|
|
867
|
+
var Ot = N.object({
|
|
868
|
+
name_on_card: wt,
|
|
869
|
+
country: Tt,
|
|
870
|
+
zip: N.string().trim().max(32, "Postal code is too long")
|
|
871
871
|
}).superRefine((e, t) => {
|
|
872
|
-
|
|
872
|
+
Et(e.country) && !e.zip && t.addIssue({
|
|
873
873
|
code: "custom",
|
|
874
|
-
message: `${
|
|
874
|
+
message: `${Dt(e.country, !0).label} is required`,
|
|
875
875
|
path: ["zip"]
|
|
876
876
|
}), e.country === "US" && e.zip && !/^\d{5}(?:-\d{4})?$/.test(e.zip) && t.addIssue({
|
|
877
877
|
code: "custom",
|
|
@@ -879,7 +879,7 @@ var Dt = M.object({
|
|
|
879
879
|
path: ["zip"]
|
|
880
880
|
});
|
|
881
881
|
});
|
|
882
|
-
function
|
|
882
|
+
function kt(e) {
|
|
883
883
|
let t = {
|
|
884
884
|
...e.zip ? { postal_code: e.zip } : {},
|
|
885
885
|
...e.country ? { country: e.country } : {}
|
|
@@ -890,12 +890,12 @@ function Ot(e) {
|
|
|
890
890
|
...Object.keys(t).length > 0 ? { address: t } : {}
|
|
891
891
|
};
|
|
892
892
|
}
|
|
893
|
-
var
|
|
893
|
+
var At = {
|
|
894
894
|
name_on_card: "",
|
|
895
895
|
country: "",
|
|
896
896
|
zip: ""
|
|
897
897
|
};
|
|
898
|
-
function
|
|
898
|
+
function jt() {
|
|
899
899
|
try {
|
|
900
900
|
if (typeof navigator > "u" || !navigator.language) return "";
|
|
901
901
|
let e = new Intl.Locale(navigator.language).maximize().region;
|
|
@@ -904,31 +904,31 @@ function At() {
|
|
|
904
904
|
return "";
|
|
905
905
|
}
|
|
906
906
|
}
|
|
907
|
-
function
|
|
907
|
+
function Mt(e) {
|
|
908
908
|
let t = e?.trim().toUpperCase() ?? "";
|
|
909
|
-
if (
|
|
910
|
-
let n =
|
|
911
|
-
return
|
|
909
|
+
if (Ct.some((e) => e.code === t)) return t;
|
|
910
|
+
let n = jt();
|
|
911
|
+
return Ct.some((e) => e.code === n) ? n : "";
|
|
912
912
|
}
|
|
913
|
-
var
|
|
914
|
-
function
|
|
915
|
-
return
|
|
913
|
+
var Nt = /* @__PURE__ */ new Set(/* @__PURE__ */ "AT.BE.BG.CY.CZ.DE.DK.EE.ES.FI.FR.GR.HR.HU.IE.IT.LT.LU.LV.MT.NL.PL.PT.RO.SE.SI.SK.IS.LI.NO.GB".split("."));
|
|
914
|
+
function Pt(e) {
|
|
915
|
+
return Nt.has(e.trim().toUpperCase());
|
|
916
916
|
}
|
|
917
917
|
//#endregion
|
|
918
918
|
//#region src/components/billing-fields.tsx
|
|
919
|
-
var
|
|
920
|
-
function
|
|
919
|
+
var Ft = "text-[13px] font-medium text-foreground", It = "h-[38px] rounded-[9px] border border-input bg-card text-sm text-foreground", Lt = `${It} px-2.5`;
|
|
920
|
+
function Rt({ 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 }) {
|
|
921
921
|
return /* @__PURE__ */ I("div", {
|
|
922
922
|
className: "grid gap-1.5",
|
|
923
|
-
children: [/* @__PURE__ */ F(
|
|
923
|
+
children: [/* @__PURE__ */ F(Q, {
|
|
924
924
|
htmlFor: e,
|
|
925
|
-
className:
|
|
925
|
+
className: Ft,
|
|
926
926
|
children: n
|
|
927
|
-
}), /* @__PURE__ */ F(
|
|
927
|
+
}), /* @__PURE__ */ F(vt, {
|
|
928
928
|
id: e,
|
|
929
929
|
name: t,
|
|
930
930
|
type: u,
|
|
931
|
-
className:
|
|
931
|
+
className: Lt,
|
|
932
932
|
value: r,
|
|
933
933
|
autoComplete: a,
|
|
934
934
|
placeholder: o,
|
|
@@ -941,17 +941,17 @@ function Lt({ id: e, name: t, label: n, value: r, onChange: i, autoComplete: a,
|
|
|
941
941
|
})]
|
|
942
942
|
});
|
|
943
943
|
}
|
|
944
|
-
function
|
|
944
|
+
function zt({ id: e, value: t, onChange: n, disabled: r }) {
|
|
945
945
|
return /* @__PURE__ */ I("div", {
|
|
946
946
|
className: "grid gap-1.5",
|
|
947
|
-
children: [/* @__PURE__ */ F(
|
|
947
|
+
children: [/* @__PURE__ */ F(Q, {
|
|
948
948
|
htmlFor: e,
|
|
949
|
-
className:
|
|
949
|
+
className: Ft,
|
|
950
950
|
children: "Country or region"
|
|
951
951
|
}), /* @__PURE__ */ I("select", {
|
|
952
952
|
id: e,
|
|
953
953
|
name: "country",
|
|
954
|
-
className: `${
|
|
954
|
+
className: `${It} w-full px-2.5`,
|
|
955
955
|
value: t,
|
|
956
956
|
autoComplete: "billing country",
|
|
957
957
|
disabled: r,
|
|
@@ -960,18 +960,18 @@ function Rt({ id: e, value: t, onChange: n, disabled: r }) {
|
|
|
960
960
|
children: [/* @__PURE__ */ F("option", {
|
|
961
961
|
value: "",
|
|
962
962
|
children: "Select country"
|
|
963
|
-
}),
|
|
963
|
+
}), Ct.map((e) => /* @__PURE__ */ F("option", {
|
|
964
964
|
value: e.code,
|
|
965
965
|
children: e.name
|
|
966
966
|
}, e.code))]
|
|
967
967
|
})]
|
|
968
968
|
});
|
|
969
969
|
}
|
|
970
|
-
function
|
|
971
|
-
let s =
|
|
970
|
+
function Bt({ id: e, value: t, country: n, onChange: r, disabled: i, required: a, error: o }) {
|
|
971
|
+
let s = Dt(n, a);
|
|
972
972
|
return /* @__PURE__ */ I("div", {
|
|
973
973
|
className: "grid gap-1.5",
|
|
974
|
-
children: [/* @__PURE__ */ F(
|
|
974
|
+
children: [/* @__PURE__ */ F(Rt, {
|
|
975
975
|
id: e,
|
|
976
976
|
name: "zip",
|
|
977
977
|
label: s.label,
|
|
@@ -991,15 +991,15 @@ function zt({ id: e, value: t, country: n, onChange: r, disabled: i, required: a
|
|
|
991
991
|
}) : null]
|
|
992
992
|
});
|
|
993
993
|
}
|
|
994
|
-
function
|
|
994
|
+
function Vt({ idPrefix: e, value: t, onChange: n, disabled: r, postalError: i, children: a }) {
|
|
995
995
|
let o = (e) => (r) => n({
|
|
996
996
|
...t,
|
|
997
997
|
[e]: r
|
|
998
|
-
}), s =
|
|
998
|
+
}), s = Et(t.country);
|
|
999
999
|
return /* @__PURE__ */ I("div", {
|
|
1000
1000
|
className: "grid gap-3",
|
|
1001
1001
|
children: [
|
|
1002
|
-
/* @__PURE__ */ F(
|
|
1002
|
+
/* @__PURE__ */ F(Rt, {
|
|
1003
1003
|
id: `${e}-name-on-card`,
|
|
1004
1004
|
name: "name_on_card",
|
|
1005
1005
|
label: "Full name",
|
|
@@ -1013,12 +1013,12 @@ function Bt({ idPrefix: e, value: t, onChange: n, disabled: r, postalError: i, c
|
|
|
1013
1013
|
a,
|
|
1014
1014
|
/* @__PURE__ */ I("div", {
|
|
1015
1015
|
className: "grid grid-cols-2 gap-3",
|
|
1016
|
-
children: [/* @__PURE__ */ F(
|
|
1016
|
+
children: [/* @__PURE__ */ F(zt, {
|
|
1017
1017
|
id: `${e}-country`,
|
|
1018
1018
|
value: t.country,
|
|
1019
1019
|
onChange: o("country"),
|
|
1020
1020
|
disabled: r
|
|
1021
|
-
}), /* @__PURE__ */ F(
|
|
1021
|
+
}), /* @__PURE__ */ F(Bt, {
|
|
1022
1022
|
id: `${e}-postal-code`,
|
|
1023
1023
|
value: t.zip,
|
|
1024
1024
|
country: t.country,
|
|
@@ -1033,7 +1033,7 @@ function Bt({ idPrefix: e, value: t, onChange: n, disabled: r, postalError: i, c
|
|
|
1033
1033
|
}
|
|
1034
1034
|
//#endregion
|
|
1035
1035
|
//#region src/components/card-fields.tsx
|
|
1036
|
-
function
|
|
1036
|
+
function Ht({ id: e, message: t }) {
|
|
1037
1037
|
return t ? /* @__PURE__ */ F("p", {
|
|
1038
1038
|
id: e,
|
|
1039
1039
|
className: "text-[12.5px] text-destructive",
|
|
@@ -1041,8 +1041,8 @@ function Vt({ id: e, message: t }) {
|
|
|
1041
1041
|
children: t
|
|
1042
1042
|
}) : null;
|
|
1043
1043
|
}
|
|
1044
|
-
var
|
|
1045
|
-
function
|
|
1044
|
+
var Ut = "orck-collect-field h-[38px] overflow-hidden rounded-[9px] border border-[color:var(--border)] bg-card px-[3px]", Wt = "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";
|
|
1045
|
+
function Gt({ ids: e, preview: t, error: n, fieldErrors: r = {}, hidden: i, brand: a }) {
|
|
1046
1046
|
return /* @__PURE__ */ I("div", {
|
|
1047
1047
|
className: L("grid gap-3", i && "hidden"),
|
|
1048
1048
|
"aria-hidden": i || void 0,
|
|
@@ -1052,21 +1052,21 @@ function Wt({ ids: e, preview: t, error: n, fieldErrors: r = {}, hidden: i, bran
|
|
|
1052
1052
|
children: [
|
|
1053
1053
|
/* @__PURE__ */ I("div", {
|
|
1054
1054
|
className: "flex items-center justify-between",
|
|
1055
|
-
children: [/* @__PURE__ */ F(
|
|
1055
|
+
children: [/* @__PURE__ */ F(Q, {
|
|
1056
1056
|
htmlFor: e.number,
|
|
1057
1057
|
className: "text-[13px] font-medium text-foreground",
|
|
1058
1058
|
children: "Card number"
|
|
1059
|
-
}), /* @__PURE__ */ F(
|
|
1059
|
+
}), /* @__PURE__ */ F(et, { active: a })]
|
|
1060
1060
|
}),
|
|
1061
1061
|
t ? /* @__PURE__ */ F("div", {
|
|
1062
1062
|
id: e.number,
|
|
1063
|
-
className:
|
|
1063
|
+
className: Wt,
|
|
1064
1064
|
children: "1234 1234 1234 1234"
|
|
1065
1065
|
}) : /* @__PURE__ */ F("div", {
|
|
1066
1066
|
id: e.number,
|
|
1067
|
-
className: L(
|
|
1067
|
+
className: L(Ut, r.number && "border-destructive")
|
|
1068
1068
|
}),
|
|
1069
|
-
/* @__PURE__ */ F(
|
|
1069
|
+
/* @__PURE__ */ F(Ht, {
|
|
1070
1070
|
id: `${e.number}-error`,
|
|
1071
1071
|
message: r.number
|
|
1072
1072
|
})
|
|
@@ -1077,20 +1077,20 @@ function Wt({ ids: e, preview: t, error: n, fieldErrors: r = {}, hidden: i, bran
|
|
|
1077
1077
|
children: [/* @__PURE__ */ I("div", {
|
|
1078
1078
|
className: "grid gap-1.5",
|
|
1079
1079
|
children: [
|
|
1080
|
-
/* @__PURE__ */ F(
|
|
1080
|
+
/* @__PURE__ */ F(Q, {
|
|
1081
1081
|
htmlFor: e.expiry,
|
|
1082
1082
|
className: "text-[13px] font-medium text-foreground",
|
|
1083
1083
|
children: "Expiry"
|
|
1084
1084
|
}),
|
|
1085
1085
|
t ? /* @__PURE__ */ F("div", {
|
|
1086
1086
|
id: e.expiry,
|
|
1087
|
-
className:
|
|
1087
|
+
className: Wt,
|
|
1088
1088
|
children: "MM / YY"
|
|
1089
1089
|
}) : /* @__PURE__ */ F("div", {
|
|
1090
1090
|
id: e.expiry,
|
|
1091
|
-
className: L(
|
|
1091
|
+
className: L(Ut, r.expiry && "border-destructive")
|
|
1092
1092
|
}),
|
|
1093
|
-
/* @__PURE__ */ F(
|
|
1093
|
+
/* @__PURE__ */ F(Ht, {
|
|
1094
1094
|
id: `${e.expiry}-error`,
|
|
1095
1095
|
message: r.expiry
|
|
1096
1096
|
})
|
|
@@ -1098,20 +1098,20 @@ function Wt({ ids: e, preview: t, error: n, fieldErrors: r = {}, hidden: i, bran
|
|
|
1098
1098
|
}), /* @__PURE__ */ I("div", {
|
|
1099
1099
|
className: "grid gap-1.5",
|
|
1100
1100
|
children: [
|
|
1101
|
-
/* @__PURE__ */ F(
|
|
1101
|
+
/* @__PURE__ */ F(Q, {
|
|
1102
1102
|
htmlFor: e.cvv,
|
|
1103
1103
|
className: "text-[13px] font-medium text-foreground",
|
|
1104
1104
|
children: "CVC"
|
|
1105
1105
|
}),
|
|
1106
1106
|
t ? /* @__PURE__ */ F("div", {
|
|
1107
1107
|
id: e.cvv,
|
|
1108
|
-
className:
|
|
1108
|
+
className: Wt,
|
|
1109
1109
|
children: "CVC"
|
|
1110
1110
|
}) : /* @__PURE__ */ F("div", {
|
|
1111
1111
|
id: e.cvv,
|
|
1112
|
-
className: L(
|
|
1112
|
+
className: L(Ut, r.cvv && "border-destructive")
|
|
1113
1113
|
}),
|
|
1114
|
-
/* @__PURE__ */ F(
|
|
1114
|
+
/* @__PURE__ */ F(Ht, {
|
|
1115
1115
|
id: `${e.cvv}-error`,
|
|
1116
1116
|
message: r.cvv
|
|
1117
1117
|
})
|
|
@@ -1126,15 +1126,15 @@ function Wt({ ids: e, preview: t, error: n, fieldErrors: r = {}, hidden: i, bran
|
|
|
1126
1126
|
]
|
|
1127
1127
|
});
|
|
1128
1128
|
}
|
|
1129
|
-
var
|
|
1130
|
-
function
|
|
1129
|
+
var Kt = "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";
|
|
1130
|
+
function qt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
1131
1131
|
let a = {
|
|
1132
1132
|
...t.fieldErrors,
|
|
1133
1133
|
...n
|
|
1134
|
-
}, o = (e, n, i, a) => /* @__PURE__ */ I(
|
|
1134
|
+
}, o = (e, n, i, a) => /* @__PURE__ */ I(ae, { children: [/* @__PURE__ */ F("input", {
|
|
1135
1135
|
id: e,
|
|
1136
1136
|
name: `card-${n}`,
|
|
1137
|
-
className: L(
|
|
1137
|
+
className: L(Kt, i && "border-destructive"),
|
|
1138
1138
|
value: t.input[n],
|
|
1139
1139
|
onChange: (e) => t.change(n, e.target.value),
|
|
1140
1140
|
onBlur: () => t.leave(n),
|
|
@@ -1145,7 +1145,7 @@ function Kt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1145
1145
|
"aria-invalid": i ? !0 : void 0,
|
|
1146
1146
|
"aria-describedby": i ? `${e}-error` : void 0,
|
|
1147
1147
|
...a
|
|
1148
|
-
}), /* @__PURE__ */ F(
|
|
1148
|
+
}), /* @__PURE__ */ F(Ht, {
|
|
1149
1149
|
id: `${e}-error`,
|
|
1150
1150
|
message: i
|
|
1151
1151
|
})] });
|
|
@@ -1156,11 +1156,11 @@ function Kt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1156
1156
|
className: "grid gap-1.5",
|
|
1157
1157
|
children: [/* @__PURE__ */ I("div", {
|
|
1158
1158
|
className: "flex items-center justify-between",
|
|
1159
|
-
children: [/* @__PURE__ */ F(
|
|
1159
|
+
children: [/* @__PURE__ */ F(Q, {
|
|
1160
1160
|
htmlFor: e.number,
|
|
1161
1161
|
className: "text-[13px] font-medium text-foreground",
|
|
1162
1162
|
children: "Card number"
|
|
1163
|
-
}), /* @__PURE__ */ F(
|
|
1163
|
+
}), /* @__PURE__ */ F(et, {})]
|
|
1164
1164
|
}), o(e.number, "number", a.number, {
|
|
1165
1165
|
autoComplete: "cc-number",
|
|
1166
1166
|
placeholder: "1234 1234 1234 1234",
|
|
@@ -1170,7 +1170,7 @@ function Kt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1170
1170
|
className: "grid grid-cols-2 gap-3",
|
|
1171
1171
|
children: [/* @__PURE__ */ I("div", {
|
|
1172
1172
|
className: "grid gap-1.5",
|
|
1173
|
-
children: [/* @__PURE__ */ F(
|
|
1173
|
+
children: [/* @__PURE__ */ F(Q, {
|
|
1174
1174
|
htmlFor: e.expiry,
|
|
1175
1175
|
className: "text-[13px] font-medium text-foreground",
|
|
1176
1176
|
children: "Expiry"
|
|
@@ -1181,7 +1181,7 @@ function Kt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1181
1181
|
})]
|
|
1182
1182
|
}), /* @__PURE__ */ I("div", {
|
|
1183
1183
|
className: "grid gap-1.5",
|
|
1184
|
-
children: [/* @__PURE__ */ F(
|
|
1184
|
+
children: [/* @__PURE__ */ F(Q, {
|
|
1185
1185
|
htmlFor: e.cvv,
|
|
1186
1186
|
className: "text-[13px] font-medium text-foreground",
|
|
1187
1187
|
children: "CVC"
|
|
@@ -1196,18 +1196,18 @@ function Kt({ ids: e, card: t, fieldErrors: n = {}, disabled: r, hidden: i }) {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
//#endregion
|
|
1198
1198
|
//#region src/components/pay-button.tsx
|
|
1199
|
-
function
|
|
1200
|
-
return /* @__PURE__ */ F(
|
|
1199
|
+
function $({ label: e, processing: t, disabled: n }) {
|
|
1200
|
+
return /* @__PURE__ */ F(U, {
|
|
1201
1201
|
type: "submit",
|
|
1202
1202
|
className: L("h-[42px] w-full rounded-[10px] text-sm font-semibold tabular-nums", t && "opacity-75"),
|
|
1203
1203
|
disabled: n || t,
|
|
1204
|
-
children: t ? /* @__PURE__ */ I(
|
|
1204
|
+
children: t ? /* @__PURE__ */ I(ae, { children: [/* @__PURE__ */ F("span", {
|
|
1205
1205
|
"aria-hidden": !0,
|
|
1206
1206
|
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"
|
|
1207
1207
|
}), "Processing…"] }) : e
|
|
1208
1208
|
});
|
|
1209
1209
|
}
|
|
1210
|
-
function
|
|
1210
|
+
function Jt() {
|
|
1211
1211
|
return /* @__PURE__ */ I("div", {
|
|
1212
1212
|
className: "-mt-1 flex items-center justify-center gap-1.5 text-xs text-[color:var(--orck-faint)]",
|
|
1213
1213
|
children: [
|
|
@@ -1232,25 +1232,25 @@ function qt() {
|
|
|
1232
1232
|
}
|
|
1233
1233
|
//#endregion
|
|
1234
1234
|
//#region src/components/platform-card-form.tsx
|
|
1235
|
-
function
|
|
1236
|
-
let o =
|
|
1235
|
+
function Yt({ publicKey: e, submitLabel: t, disabled: n, onTokenized: r, purpose: i = "payment", defaultCountry: a }) {
|
|
1236
|
+
let o = P.useId().replace(/[^a-zA-Z0-9-]/g, ""), s = P.useMemo(() => ({
|
|
1237
1237
|
number: `bt-${o}-number`,
|
|
1238
1238
|
expiry: `bt-${o}-expiry`,
|
|
1239
1239
|
cvv: `bt-${o}-cvv`
|
|
1240
|
-
}), [o]), [c, l] =
|
|
1241
|
-
...
|
|
1242
|
-
country:
|
|
1243
|
-
})), [u, d] =
|
|
1240
|
+
}), [o]), [c, l] = P.useState(() => ({
|
|
1241
|
+
...At,
|
|
1242
|
+
country: Mt(a)
|
|
1243
|
+
})), [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({
|
|
1244
1244
|
generation: 0,
|
|
1245
1245
|
disabled: n
|
|
1246
1246
|
});
|
|
1247
|
-
|
|
1247
|
+
P.useLayoutEffect(() => {
|
|
1248
1248
|
C.current = {
|
|
1249
1249
|
generation: C.current.generation + 1,
|
|
1250
1250
|
disabled: n
|
|
1251
1251
|
};
|
|
1252
|
-
}, [e, n]),
|
|
1253
|
-
let t = !0, n =
|
|
1252
|
+
}, [e, n]), P.useEffect(() => {
|
|
1253
|
+
let t = !0, n = M(e), r = n.createElement("cardNumber"), i = n.createElement("expiry"), a = n.createElement("cvv");
|
|
1254
1254
|
return Promise.all([
|
|
1255
1255
|
r.mount(`#${s.number}`),
|
|
1256
1256
|
i.mount(`#${s.expiry}`),
|
|
@@ -1273,7 +1273,7 @@ function Jt({ publicKey: e, submitLabel: t, disabled: n, onTokenized: r, purpose
|
|
|
1273
1273
|
}, [e, s]);
|
|
1274
1274
|
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) => {
|
|
1275
1275
|
if (e.preventDefault(), n || S.current || m || !x.current) return;
|
|
1276
|
-
let t =
|
|
1276
|
+
let t = Ot.safeParse(c);
|
|
1277
1277
|
if (!t.success) {
|
|
1278
1278
|
y(t.error.issues[0]?.message ?? "Check the billing details");
|
|
1279
1279
|
return;
|
|
@@ -1299,12 +1299,12 @@ function Jt({ publicKey: e, submitLabel: t, disabled: n, onTokenized: r, purpose
|
|
|
1299
1299
|
className: "grid gap-4",
|
|
1300
1300
|
onSubmit: (e) => void E(e),
|
|
1301
1301
|
children: [
|
|
1302
|
-
/* @__PURE__ */ F(
|
|
1302
|
+
/* @__PURE__ */ F(Vt, {
|
|
1303
1303
|
idPrefix: `bt-${o}`,
|
|
1304
1304
|
value: c,
|
|
1305
1305
|
onChange: l,
|
|
1306
1306
|
disabled: n || f || g || m,
|
|
1307
|
-
children: /* @__PURE__ */ F(
|
|
1307
|
+
children: /* @__PURE__ */ F(Gt, {
|
|
1308
1308
|
ids: s,
|
|
1309
1309
|
preview: !1
|
|
1310
1310
|
})
|
|
@@ -1314,29 +1314,29 @@ function Jt({ publicKey: e, submitLabel: t, disabled: n, onTokenized: r, purpose
|
|
|
1314
1314
|
className: "text-sm text-destructive",
|
|
1315
1315
|
children: v
|
|
1316
1316
|
}) : null,
|
|
1317
|
-
/* @__PURE__ */ F(
|
|
1317
|
+
/* @__PURE__ */ F($, {
|
|
1318
1318
|
label: g ? w : t,
|
|
1319
1319
|
processing: f,
|
|
1320
|
-
disabled: n || m || !u || !
|
|
1320
|
+
disabled: n || m || !u || !Ot.safeParse(c).success
|
|
1321
1321
|
}),
|
|
1322
|
-
/* @__PURE__ */ F(
|
|
1322
|
+
/* @__PURE__ */ F(Jt, {})
|
|
1323
1323
|
]
|
|
1324
1324
|
});
|
|
1325
1325
|
}
|
|
1326
1326
|
//#endregion
|
|
1327
1327
|
//#region src/lib/stripe.ts
|
|
1328
|
-
var
|
|
1329
|
-
function
|
|
1330
|
-
let t =
|
|
1328
|
+
var Xt = /* @__PURE__ */ new Map();
|
|
1329
|
+
function Zt(e) {
|
|
1330
|
+
let t = Xt.get(e);
|
|
1331
1331
|
return t || (t = import("@stripe/stripe-js").then(({ loadStripe: t }) => t(e)).then((e) => {
|
|
1332
1332
|
if (!e) throw Error("Stripe could not be loaded.");
|
|
1333
1333
|
return e;
|
|
1334
|
-
}), t.catch(() =>
|
|
1334
|
+
}), t.catch(() => Xt.delete(e)), Xt.set(e, t)), t;
|
|
1335
1335
|
}
|
|
1336
1336
|
//#endregion
|
|
1337
1337
|
//#region src/lib/collect.ts
|
|
1338
|
-
var
|
|
1339
|
-
function
|
|
1338
|
+
var Qt = "openrails-collectjs", $t = 3e4, en = /* @__PURE__ */ new WeakMap();
|
|
1339
|
+
function tn(e) {
|
|
1340
1340
|
try {
|
|
1341
1341
|
let t = new URL(e);
|
|
1342
1342
|
return t.protocol !== "https:" || t.username || t.password || t.hash ? void 0 : t.toString();
|
|
@@ -1344,9 +1344,9 @@ function en(e) {
|
|
|
1344
1344
|
return;
|
|
1345
1345
|
}
|
|
1346
1346
|
}
|
|
1347
|
-
function
|
|
1347
|
+
function nn(e) {
|
|
1348
1348
|
if (!e) return "";
|
|
1349
|
-
let t =
|
|
1349
|
+
let t = rn(e);
|
|
1350
1350
|
if (t) return t;
|
|
1351
1351
|
try {
|
|
1352
1352
|
let t = document.createElement("canvas").getContext("2d");
|
|
@@ -1358,7 +1358,7 @@ function tn(e) {
|
|
|
1358
1358
|
return "";
|
|
1359
1359
|
}
|
|
1360
1360
|
}
|
|
1361
|
-
function
|
|
1361
|
+
function rn(e) {
|
|
1362
1362
|
let t = /^oklch\(\s*([\d.]+%?)\s+([\d.]+)\s+([\d.]+)(?:deg)?\s*(?:\/\s*([\d.]+%?)\s*)?\)$/i.exec(e.trim());
|
|
1363
1363
|
if (!t) return "";
|
|
1364
1364
|
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) => {
|
|
@@ -1367,23 +1367,23 @@ function nn(e) {
|
|
|
1367
1367
|
}, 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);
|
|
1368
1368
|
return o >= 1 ? `rgb(${p}, ${m}, ${h})` : `rgba(${p}, ${m}, ${h}, ${o})`;
|
|
1369
1369
|
}
|
|
1370
|
-
function
|
|
1370
|
+
function an(e) {
|
|
1371
1371
|
return e.startsWith("preview_");
|
|
1372
1372
|
}
|
|
1373
|
-
var
|
|
1373
|
+
var on = {
|
|
1374
1374
|
ccnumber: "number",
|
|
1375
1375
|
ccexp: "expiry",
|
|
1376
1376
|
cvv: "cvv"
|
|
1377
|
-
},
|
|
1377
|
+
}, sn = {
|
|
1378
1378
|
number: "Enter a valid card number",
|
|
1379
1379
|
expiry: "Enter a valid expiry date",
|
|
1380
1380
|
cvv: "Enter a valid security code"
|
|
1381
1381
|
};
|
|
1382
|
-
function
|
|
1383
|
-
let t = e.enabled &&
|
|
1384
|
-
|
|
1382
|
+
function cn(e) {
|
|
1383
|
+
let t = e.enabled && an(e.tokenizationKey), [n, r] = P.useState(!1), [i, a] = P.useState(), [o, s] = P.useState(), [c, l] = P.useState({}), u = P.useRef(void 0), d = P.useRef(void 0), { number: f, expiry: p, cvv: m } = e.selectors;
|
|
1384
|
+
P.useEffect(() => {
|
|
1385
1385
|
if (!e.enabled || t || !e.tokenizationKey || !e.scriptURL || typeof document > "u") return;
|
|
1386
|
-
let n =
|
|
1386
|
+
let n = tn(e.scriptURL);
|
|
1387
1387
|
if (!n) {
|
|
1388
1388
|
Promise.resolve().then(() => {
|
|
1389
1389
|
r(!1), a("Card fields failed to load");
|
|
@@ -1411,7 +1411,7 @@ function sn(e) {
|
|
|
1411
1411
|
c(() => {
|
|
1412
1412
|
r(!1), a(void 0), l({});
|
|
1413
1413
|
});
|
|
1414
|
-
let t = document.querySelector(f), n = t ? window.getComputedStyle(t) : void 0, i =
|
|
1414
|
+
let t = document.querySelector(f), n = t ? window.getComputedStyle(t) : void 0, i = nn(n?.backgroundColor), d = i && i !== "transparent" && i !== "rgba(0, 0, 0, 0)" ? i : "#ffffff", h = nn(n?.color) || "#18181b", g = nn(n?.getPropertyValue("--muted-foreground").trim()) || h;
|
|
1415
1415
|
try {
|
|
1416
1416
|
e.configure({
|
|
1417
1417
|
variant: "inline",
|
|
@@ -1426,7 +1426,7 @@ function sn(e) {
|
|
|
1426
1426
|
color: h
|
|
1427
1427
|
},
|
|
1428
1428
|
placeholderCss: { color: g },
|
|
1429
|
-
invalidCss: { color:
|
|
1429
|
+
invalidCss: { color: nn(n?.getPropertyValue("--destructive").trim()) || "#dc2626" },
|
|
1430
1430
|
focusCss: { outline: "none" },
|
|
1431
1431
|
fields: {
|
|
1432
1432
|
ccnumber: {
|
|
@@ -1448,16 +1448,16 @@ function sn(e) {
|
|
|
1448
1448
|
fieldsAvailableCallback: () => c(() => r(!0)),
|
|
1449
1449
|
lookUpCallback: (e) => c(() => s(e?.type || void 0)),
|
|
1450
1450
|
validationCallback: (e, t, n) => {
|
|
1451
|
-
let r =
|
|
1451
|
+
let r = on[e];
|
|
1452
1452
|
r && c(() => l((e) => ({
|
|
1453
1453
|
...e,
|
|
1454
1454
|
[r]: {
|
|
1455
1455
|
valid: t,
|
|
1456
|
-
message: t ? void 0 : n && n !== "Field is empty" ? `${
|
|
1456
|
+
message: t ? void 0 : n && n !== "Field is empty" ? `${sn[r]}.` : sn[r]
|
|
1457
1457
|
}
|
|
1458
1458
|
})));
|
|
1459
1459
|
},
|
|
1460
|
-
timeoutDuration:
|
|
1460
|
+
timeoutDuration: $t,
|
|
1461
1461
|
timeoutCallback: () => {
|
|
1462
1462
|
let e = u.current;
|
|
1463
1463
|
u.current = void 0, e && (window.clearTimeout(e.timer), e.reject(/* @__PURE__ */ Error("Card entry timed out")));
|
|
@@ -1470,12 +1470,12 @@ function sn(e) {
|
|
|
1470
1470
|
} catch {
|
|
1471
1471
|
c(() => a("Card fields failed to load"));
|
|
1472
1472
|
}
|
|
1473
|
-
}, g = document.getElementById(
|
|
1474
|
-
if (g instanceof HTMLScriptElement && (g.src !== n ||
|
|
1473
|
+
}, g = document.getElementById(Qt);
|
|
1474
|
+
if (g instanceof HTMLScriptElement && (g.src !== n || en.get(g) === "failed") && (g.remove(), g.src !== n && Reflect.deleteProperty(window, "CollectJS"), g = null), g instanceof HTMLScriptElement) {
|
|
1475
1475
|
if (window.CollectJS) return h(), () => {
|
|
1476
1476
|
o = !0;
|
|
1477
1477
|
};
|
|
1478
|
-
if (
|
|
1478
|
+
if (en.get(g) === "loaded") return c(() => a("Card fields failed to load")), () => {
|
|
1479
1479
|
o = !0;
|
|
1480
1480
|
};
|
|
1481
1481
|
let e = () => c(() => a("Card fields failed to load"));
|
|
@@ -1484,10 +1484,10 @@ function sn(e) {
|
|
|
1484
1484
|
};
|
|
1485
1485
|
}
|
|
1486
1486
|
let _ = document.createElement("script");
|
|
1487
|
-
return _.id =
|
|
1488
|
-
|
|
1487
|
+
return _.id = Qt, _.src = n, _.async = !0, _.dataset.tokenizationKey = e.tokenizationKey, en.set(_, "loading"), _.onload = () => {
|
|
1488
|
+
en.set(_, "loaded"), h();
|
|
1489
1489
|
}, _.onerror = () => {
|
|
1490
|
-
|
|
1490
|
+
en.set(_, "failed"), c(() => a("Card fields failed to load"));
|
|
1491
1491
|
}, document.head.appendChild(_), () => {
|
|
1492
1492
|
o = !0;
|
|
1493
1493
|
};
|
|
@@ -1501,7 +1501,7 @@ function sn(e) {
|
|
|
1501
1501
|
p,
|
|
1502
1502
|
m
|
|
1503
1503
|
]);
|
|
1504
|
-
let h =
|
|
1504
|
+
let h = P.useCallback(() => new Promise((e, r) => {
|
|
1505
1505
|
if (t) {
|
|
1506
1506
|
e({
|
|
1507
1507
|
token: "preview_payment_token",
|
|
@@ -1554,7 +1554,7 @@ function sn(e) {
|
|
|
1554
1554
|
tokenize: h
|
|
1555
1555
|
};
|
|
1556
1556
|
}
|
|
1557
|
-
function
|
|
1557
|
+
function ln(e) {
|
|
1558
1558
|
let t = (e?.number ?? "").replace(/\D/g, ""), n = (e?.exp ?? "").replace(/\D/g, "");
|
|
1559
1559
|
return {
|
|
1560
1560
|
...t.length >= 4 ? { last_four: t.slice(-4) } : {},
|
|
@@ -1564,8 +1564,8 @@ function cn(e) {
|
|
|
1564
1564
|
}
|
|
1565
1565
|
//#endregion
|
|
1566
1566
|
//#region src/lib/stripe-appearance.ts
|
|
1567
|
-
function
|
|
1568
|
-
let t = window.getComputedStyle(e), n = (e) =>
|
|
1567
|
+
function un(e) {
|
|
1568
|
+
let t = window.getComputedStyle(e), n = (e) => nn(t.getPropertyValue(e).trim()) || void 0;
|
|
1569
1569
|
return {
|
|
1570
1570
|
theme: e.closest(".dark") ? "night" : "stripe",
|
|
1571
1571
|
variables: {
|
|
@@ -1600,22 +1600,22 @@ function ln(e) {
|
|
|
1600
1600
|
}
|
|
1601
1601
|
//#endregion
|
|
1602
1602
|
//#region src/components/stripe-card.tsx
|
|
1603
|
-
var
|
|
1604
|
-
let [s, c] =
|
|
1605
|
-
|
|
1603
|
+
var dn = P.forwardRef(function({ psp: e, client: t, defaultCountry: n, onCompleteChange: r, unavailableMessage: i, verificationPendingMessage: a }, o) {
|
|
1604
|
+
let [s, c] = P.useState(), l = P.useRef(null), u = P.useRef(null), d = P.useRef(r);
|
|
1605
|
+
P.useEffect(() => {
|
|
1606
1606
|
d.current = r;
|
|
1607
1607
|
});
|
|
1608
1608
|
let f = e.config?.publishable_key;
|
|
1609
|
-
return
|
|
1609
|
+
return P.useEffect(() => {
|
|
1610
1610
|
if (!f || !l.current) return;
|
|
1611
1611
|
let e = !1, t;
|
|
1612
|
-
return
|
|
1612
|
+
return Zt(f).then((r) => {
|
|
1613
1613
|
if (e || !l.current) return;
|
|
1614
1614
|
let i = r.elements({
|
|
1615
1615
|
mode: "setup",
|
|
1616
1616
|
paymentMethodTypes: ["card"],
|
|
1617
1617
|
paymentMethodCreation: "manual",
|
|
1618
|
-
appearance:
|
|
1618
|
+
appearance: un(l.current)
|
|
1619
1619
|
}), a = i.create("payment", {
|
|
1620
1620
|
wallets: {
|
|
1621
1621
|
link: "never",
|
|
@@ -1639,7 +1639,7 @@ var un = N.forwardRef(function({ psp: e, client: t, defaultCountry: n, onComplet
|
|
|
1639
1639
|
f,
|
|
1640
1640
|
n,
|
|
1641
1641
|
i
|
|
1642
|
-
]),
|
|
1642
|
+
]), P.useImperativeHandle(o, () => {
|
|
1643
1643
|
let n = async () => {
|
|
1644
1644
|
let e = u.current;
|
|
1645
1645
|
if (!e) throw Error(i);
|
|
@@ -1683,12 +1683,12 @@ var un = N.forwardRef(function({ psp: e, client: t, defaultCountry: n, onComplet
|
|
|
1683
1683
|
children: s
|
|
1684
1684
|
}) : null]
|
|
1685
1685
|
});
|
|
1686
|
-
}),
|
|
1686
|
+
}), fn = {
|
|
1687
1687
|
number: "Enter a valid card number",
|
|
1688
1688
|
expiry: "Enter a valid expiry date",
|
|
1689
1689
|
cvv: "Enter a valid security code"
|
|
1690
|
-
},
|
|
1691
|
-
function
|
|
1690
|
+
}, pn = (e) => e.replace(/\D/g, "");
|
|
1691
|
+
function mn(e) {
|
|
1692
1692
|
let t = 0;
|
|
1693
1693
|
for (let n = 0; n < e.length; n++) {
|
|
1694
1694
|
let r = e.charCodeAt(e.length - 1 - n) - 48;
|
|
@@ -1696,24 +1696,24 @@ function fn(e) {
|
|
|
1696
1696
|
}
|
|
1697
1697
|
return t % 10 == 0;
|
|
1698
1698
|
}
|
|
1699
|
-
function
|
|
1700
|
-
let t =
|
|
1699
|
+
function hn(e) {
|
|
1700
|
+
let t = pn(e), n = (e) => t.length >= e ? Number(t.slice(0, e)) : -1;
|
|
1701
1701
|
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" : "";
|
|
1702
1702
|
}
|
|
1703
|
-
function
|
|
1704
|
-
let t =
|
|
1705
|
-
return
|
|
1703
|
+
function gn(e) {
|
|
1704
|
+
let t = pn(e).slice(0, 19);
|
|
1705
|
+
return hn(t) === "amex" ? [
|
|
1706
1706
|
t.slice(0, 4),
|
|
1707
1707
|
t.slice(4, 10),
|
|
1708
1708
|
t.slice(10, 15)
|
|
1709
1709
|
].filter(Boolean).join(" ") : t.replace(/(\d{4})(?=\d)/g, "$1 ");
|
|
1710
1710
|
}
|
|
1711
|
-
function
|
|
1712
|
-
let t =
|
|
1711
|
+
function _n(e) {
|
|
1712
|
+
let t = pn(e).slice(0, 4);
|
|
1713
1713
|
return t.length > 2 ? `${t.slice(0, 2)} / ${t.slice(2)}` : t;
|
|
1714
1714
|
}
|
|
1715
|
-
function
|
|
1716
|
-
let n =
|
|
1715
|
+
function vn(e, t) {
|
|
1716
|
+
let n = pn(e);
|
|
1717
1717
|
if (n.length !== 4) return null;
|
|
1718
1718
|
let r = Number(n.slice(0, 2)), i = 2e3 + Number(n.slice(2));
|
|
1719
1719
|
return r < 1 || r > 12 || i < t.getFullYear() || i === t.getFullYear() && r < t.getMonth() + 1 ? null : {
|
|
@@ -1721,32 +1721,32 @@ function gn(e, t) {
|
|
|
1721
1721
|
year: i
|
|
1722
1722
|
};
|
|
1723
1723
|
}
|
|
1724
|
-
function
|
|
1725
|
-
let n = {}, r =
|
|
1726
|
-
(r.length < 12 || r.length > 19 || !
|
|
1727
|
-
let i =
|
|
1728
|
-
return (i !== e.cvc.trim() || i.length !== a && i.length !== 4) && (n.cvv =
|
|
1724
|
+
function yn(e, t = /* @__PURE__ */ new Date()) {
|
|
1725
|
+
let n = {}, r = pn(e.number);
|
|
1726
|
+
(r.length < 12 || r.length > 19 || !mn(r)) && (n.number = fn.number), vn(e.expiry, t) || (n.expiry = fn.expiry);
|
|
1727
|
+
let i = pn(e.cvc), a = hn(r) === "amex" ? 4 : 3;
|
|
1728
|
+
return (i !== e.cvc.trim() || i.length !== a && i.length !== 4) && (n.cvv = fn.cvv), n;
|
|
1729
1729
|
}
|
|
1730
|
-
function
|
|
1731
|
-
if (Object.keys(
|
|
1732
|
-
let n =
|
|
1730
|
+
function bn(e, t = /* @__PURE__ */ new Date()) {
|
|
1731
|
+
if (Object.keys(yn(e, t)).length > 0) return null;
|
|
1732
|
+
let n = vn(e.expiry, t);
|
|
1733
1733
|
return {
|
|
1734
|
-
number:
|
|
1734
|
+
number: pn(e.number),
|
|
1735
1735
|
exp_month: n.month,
|
|
1736
1736
|
exp_year: n.year,
|
|
1737
|
-
cvc:
|
|
1737
|
+
cvc: pn(e.cvc)
|
|
1738
1738
|
};
|
|
1739
1739
|
}
|
|
1740
|
-
var
|
|
1740
|
+
var xn = {
|
|
1741
1741
|
number: "",
|
|
1742
1742
|
expiry: "",
|
|
1743
1743
|
cvc: ""
|
|
1744
1744
|
};
|
|
1745
|
-
function
|
|
1746
|
-
let [e, t] =
|
|
1745
|
+
function Sn() {
|
|
1746
|
+
let [e, t] = P.useState(xn), [n, r] = P.useState({}), i = yn(e), a = {};
|
|
1747
1747
|
n.number && i.number && (a.number = i.number), n.expiry && i.expiry && (a.expiry = i.expiry), n.cvc && i.cvv && (a.cvv = i.cvv);
|
|
1748
|
-
let o =
|
|
1749
|
-
t(
|
|
1748
|
+
let o = P.useCallback(() => {
|
|
1749
|
+
t(xn), r({});
|
|
1750
1750
|
}, []);
|
|
1751
1751
|
return {
|
|
1752
1752
|
input: e,
|
|
@@ -1754,14 +1754,14 @@ function bn() {
|
|
|
1754
1754
|
valid: Object.keys(i).length === 0,
|
|
1755
1755
|
change: (e, n) => t((t) => ({
|
|
1756
1756
|
...t,
|
|
1757
|
-
[e]: e === "number" ?
|
|
1757
|
+
[e]: e === "number" ? gn(n) : e === "expiry" ? _n(n) : pn(n).slice(0, 4)
|
|
1758
1758
|
})),
|
|
1759
1759
|
leave: (e) => r((t) => ({
|
|
1760
1760
|
...t,
|
|
1761
1761
|
[e]: !0
|
|
1762
1762
|
})),
|
|
1763
1763
|
take: () => {
|
|
1764
|
-
let t =
|
|
1764
|
+
let t = bn(e);
|
|
1765
1765
|
return t ? (o(), t) : (r({
|
|
1766
1766
|
number: !0,
|
|
1767
1767
|
expiry: !0,
|
|
@@ -1773,21 +1773,21 @@ function bn() {
|
|
|
1773
1773
|
}
|
|
1774
1774
|
//#endregion
|
|
1775
1775
|
//#region src/tokenized-card-form.tsx
|
|
1776
|
-
function
|
|
1777
|
-
let [d, f] =
|
|
1776
|
+
function Cn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabel: r = "Save card", disabled: i = !1, defaultCountry: a, saveOptInMerchant: o, terms: s, statementDescriptor: c, appearance: l, className: u }) {
|
|
1777
|
+
let [d, f] = P.useState(!1), p = P.useId().replace(/[^a-zA-Z0-9-]/g, ""), m = P.useMemo(() => ({
|
|
1778
1778
|
number: `orck-save-${p}-number`,
|
|
1779
1779
|
expiry: `orck-save-${p}-expiry`,
|
|
1780
1780
|
cvv: `orck-save-${p}-cvv`
|
|
1781
|
-
}), [p]), [h, g] =
|
|
1782
|
-
...
|
|
1783
|
-
country:
|
|
1784
|
-
})), [_, v] =
|
|
1781
|
+
}), [p]), [h, g] = P.useState(() => ({
|
|
1782
|
+
...At,
|
|
1783
|
+
country: Mt(a)
|
|
1784
|
+
})), [_, v] = P.useState(!1), [y, b] = P.useState(!1), [x, S] = P.useState(), T = P.useRef({
|
|
1785
1785
|
generation: 0,
|
|
1786
1786
|
disabled: i
|
|
1787
1787
|
});
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
generation:
|
|
1788
|
+
P.useLayoutEffect(() => {
|
|
1789
|
+
T.current = {
|
|
1790
|
+
generation: T.current.generation + 1,
|
|
1791
1791
|
disabled: i
|
|
1792
1792
|
};
|
|
1793
1793
|
}, [
|
|
@@ -1795,11 +1795,11 @@ function xn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1795
1795
|
t,
|
|
1796
1796
|
i
|
|
1797
1797
|
]);
|
|
1798
|
-
let
|
|
1799
|
-
|
|
1800
|
-
|
|
1798
|
+
let E = P.useRef(!0);
|
|
1799
|
+
P.useEffect(() => (E.current = !0, () => {
|
|
1800
|
+
E.current = !1;
|
|
1801
1801
|
}), []);
|
|
1802
|
-
let D =
|
|
1802
|
+
let D = cn({
|
|
1803
1803
|
enabled: !0,
|
|
1804
1804
|
active: !0,
|
|
1805
1805
|
tokenizationKey: e,
|
|
@@ -1809,46 +1809,46 @@ function xn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1809
1809
|
expiry: `#${m.expiry}`,
|
|
1810
1810
|
cvv: `#${m.cvv}`
|
|
1811
1811
|
}
|
|
1812
|
-
}), O =
|
|
1812
|
+
}), O = Ot.safeParse(h).success, k = o !== void 0 && Pt(h.country), ee = async (e) => {
|
|
1813
1813
|
if (e.preventDefault(), i || _ || y) return;
|
|
1814
|
-
let t =
|
|
1814
|
+
let t = Ot.safeParse(h);
|
|
1815
1815
|
if (!t.success) {
|
|
1816
1816
|
S(t.error.issues[0]?.message ?? "Check the billing details");
|
|
1817
1817
|
return;
|
|
1818
1818
|
}
|
|
1819
1819
|
v(!0), S(void 0);
|
|
1820
|
-
let r =
|
|
1820
|
+
let r = T.current.generation, a = !1;
|
|
1821
1821
|
try {
|
|
1822
1822
|
let e = await D.tokenize();
|
|
1823
|
-
if (!
|
|
1823
|
+
if (!E.current || T.current.generation !== r || T.current.disabled) return;
|
|
1824
1824
|
a = !0, b(!0), await n({
|
|
1825
1825
|
payment_token: e.token,
|
|
1826
1826
|
...t.data,
|
|
1827
|
-
...
|
|
1827
|
+
...ln(e.card),
|
|
1828
1828
|
...k ? { reusable: d } : {}
|
|
1829
|
-
}) === !1 &&
|
|
1829
|
+
}) === !1 && E.current && b(!1);
|
|
1830
1830
|
} catch (e) {
|
|
1831
|
-
|
|
1831
|
+
E.current && S(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.");
|
|
1832
1832
|
} finally {
|
|
1833
|
-
|
|
1833
|
+
E.current && v(!1);
|
|
1834
1834
|
}
|
|
1835
1835
|
};
|
|
1836
1836
|
return /* @__PURE__ */ F("div", {
|
|
1837
1837
|
className: L("orck", u),
|
|
1838
1838
|
"data-orck-theme": C(l),
|
|
1839
|
-
style:
|
|
1839
|
+
style: w(l),
|
|
1840
1840
|
children: /* @__PURE__ */ I("form", {
|
|
1841
1841
|
"aria-label": "Secure card setup",
|
|
1842
1842
|
autoComplete: "on",
|
|
1843
1843
|
className: "grid gap-4",
|
|
1844
|
-
onSubmit: (e) => void
|
|
1844
|
+
onSubmit: (e) => void ee(e),
|
|
1845
1845
|
children: [
|
|
1846
|
-
/* @__PURE__ */ F(
|
|
1846
|
+
/* @__PURE__ */ F(Vt, {
|
|
1847
1847
|
idPrefix: `orck-save-${p}`,
|
|
1848
1848
|
value: h,
|
|
1849
1849
|
onChange: g,
|
|
1850
1850
|
disabled: i || _ || y,
|
|
1851
|
-
children: /* @__PURE__ */ F(
|
|
1851
|
+
children: /* @__PURE__ */ F(Gt, {
|
|
1852
1852
|
ids: m,
|
|
1853
1853
|
preview: D.preview,
|
|
1854
1854
|
brand: D.brand,
|
|
@@ -1880,7 +1880,7 @@ function xn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1880
1880
|
className: "text-sm text-destructive",
|
|
1881
1881
|
children: x
|
|
1882
1882
|
}) : null,
|
|
1883
|
-
/* @__PURE__ */ F(
|
|
1883
|
+
/* @__PURE__ */ F($, {
|
|
1884
1884
|
label: r,
|
|
1885
1885
|
processing: _,
|
|
1886
1886
|
disabled: i || y || !O || !D.ready || !D.valid || !!D.loadError
|
|
@@ -1892,37 +1892,37 @@ function xn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1892
1892
|
c,
|
|
1893
1893
|
"” on your card statement."
|
|
1894
1894
|
]
|
|
1895
|
-
}) : /* @__PURE__ */ F(
|
|
1895
|
+
}) : /* @__PURE__ */ F(Jt, {})
|
|
1896
1896
|
]
|
|
1897
1897
|
})
|
|
1898
1898
|
});
|
|
1899
1899
|
}
|
|
1900
1900
|
//#endregion
|
|
1901
1901
|
//#region src/save-payment-method.tsx
|
|
1902
|
-
function
|
|
1903
|
-
let { t } =
|
|
1902
|
+
function wn(e) {
|
|
1903
|
+
let { t } = y(), n = s(e.psp);
|
|
1904
1904
|
return n ? /* @__PURE__ */ I("div", {
|
|
1905
1905
|
className: L("orck grid gap-4", e.className),
|
|
1906
1906
|
"data-orck-theme": C(e.appearance),
|
|
1907
|
-
style:
|
|
1907
|
+
style: w(e.appearance),
|
|
1908
1908
|
children: [/* @__PURE__ */ F("p", {
|
|
1909
1909
|
className: "text-sm text-muted-foreground",
|
|
1910
1910
|
children: t("paymentMethods.saveNotice")
|
|
1911
|
-
}), F(n === "platform" ?
|
|
1911
|
+
}), F(n === "platform" ? kn : n === "collect_js" ? En : n === "card" ? Dn : On, { ...e })]
|
|
1912
1912
|
}) : /* @__PURE__ */ F("p", {
|
|
1913
1913
|
role: "alert",
|
|
1914
1914
|
className: "text-sm text-destructive",
|
|
1915
1915
|
children: t("paymentMethods.unavailable")
|
|
1916
1916
|
});
|
|
1917
1917
|
}
|
|
1918
|
-
var
|
|
1919
|
-
function
|
|
1920
|
-
let a =
|
|
1921
|
-
return /* @__PURE__ */ I(
|
|
1918
|
+
var Tn = (e, t) => !n(t) && t instanceof Error && t.message ? t.message : e.error(t);
|
|
1919
|
+
function En({ psp: e, onSaved: t, submitLabel: n, appearance: r, defaultCountry: i }) {
|
|
1920
|
+
let a = y(), { client: o, notify: s } = j(), [c, l] = P.useState(0), [u, d] = P.useState();
|
|
1921
|
+
return /* @__PURE__ */ I(ae, { children: [u ? /* @__PURE__ */ F("p", {
|
|
1922
1922
|
role: "alert",
|
|
1923
1923
|
className: "text-sm text-destructive",
|
|
1924
1924
|
children: u
|
|
1925
|
-
}) : null, /* @__PURE__ */ F(
|
|
1925
|
+
}) : null, /* @__PURE__ */ F(Cn, {
|
|
1926
1926
|
tokenizationKey: e.config.tokenization_key,
|
|
1927
1927
|
tokenizationURL: e.config.tokenization_url,
|
|
1928
1928
|
onTokenized: async (n) => {
|
|
@@ -1932,10 +1932,10 @@ function wn({ psp: e, onSaved: t, submitLabel: n, appearance: r, defaultCountry:
|
|
|
1932
1932
|
r = await o.addPaymentMethod({
|
|
1933
1933
|
psp_id: e.psp_id,
|
|
1934
1934
|
token: n.payment_token,
|
|
1935
|
-
billing_details:
|
|
1935
|
+
billing_details: kt(n)
|
|
1936
1936
|
});
|
|
1937
1937
|
} catch (e) {
|
|
1938
|
-
d(
|
|
1938
|
+
d(Tn(a, e)), l((e) => e + 1);
|
|
1939
1939
|
return;
|
|
1940
1940
|
}
|
|
1941
1941
|
s({
|
|
@@ -1948,17 +1948,17 @@ function wn({ psp: e, onSaved: t, submitLabel: n, appearance: r, defaultCountry:
|
|
|
1948
1948
|
appearance: r
|
|
1949
1949
|
}, c)] });
|
|
1950
1950
|
}
|
|
1951
|
-
function
|
|
1952
|
-
let i =
|
|
1951
|
+
function Dn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
1952
|
+
let i = y(), { client: a, notify: o } = j(), s = P.useId().replace(/[^a-zA-Z0-9-]/g, ""), c = P.useMemo(() => ({
|
|
1953
1953
|
number: `orck-save-${s}-number`,
|
|
1954
1954
|
expiry: `orck-save-${s}-expiry`,
|
|
1955
1955
|
cvv: `orck-save-${s}-cvv`
|
|
1956
|
-
}), [s]), l =
|
|
1957
|
-
...
|
|
1958
|
-
country:
|
|
1959
|
-
})), [f, p] =
|
|
1956
|
+
}), [s]), l = Sn(), [u, d] = P.useState(() => ({
|
|
1957
|
+
...At,
|
|
1958
|
+
country: Mt(r)
|
|
1959
|
+
})), [f, p] = P.useState(!1), [m, h] = P.useState(), g = async (n) => {
|
|
1960
1960
|
if (n.preventDefault(), f) return;
|
|
1961
|
-
let r =
|
|
1961
|
+
let r = Ot.safeParse(u);
|
|
1962
1962
|
if (!r.success) {
|
|
1963
1963
|
h(r.error.issues[0]?.message ?? "Check the billing details");
|
|
1964
1964
|
return;
|
|
@@ -1970,14 +1970,14 @@ function Tn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
1970
1970
|
let n = await a.addPaymentMethod({
|
|
1971
1971
|
psp_id: e.psp_id,
|
|
1972
1972
|
card: s,
|
|
1973
|
-
billing_details:
|
|
1973
|
+
billing_details: kt(r.data)
|
|
1974
1974
|
});
|
|
1975
1975
|
o({
|
|
1976
1976
|
type: "payment_method.added",
|
|
1977
1977
|
paymentMethodId: n.id
|
|
1978
1978
|
}), t(n.id);
|
|
1979
1979
|
} catch (e) {
|
|
1980
|
-
h(
|
|
1980
|
+
h(Tn(i, e));
|
|
1981
1981
|
} finally {
|
|
1982
1982
|
p(!1);
|
|
1983
1983
|
}
|
|
@@ -1990,12 +1990,12 @@ function Tn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
1990
1990
|
noValidate: !0,
|
|
1991
1991
|
onSubmit: (e) => void g(e),
|
|
1992
1992
|
children: [
|
|
1993
|
-
/* @__PURE__ */ F(
|
|
1993
|
+
/* @__PURE__ */ F(Vt, {
|
|
1994
1994
|
idPrefix: `orck-save-${s}`,
|
|
1995
1995
|
value: u,
|
|
1996
1996
|
onChange: d,
|
|
1997
1997
|
disabled: f,
|
|
1998
|
-
children: /* @__PURE__ */ F(
|
|
1998
|
+
children: /* @__PURE__ */ F(qt, {
|
|
1999
1999
|
ids: c,
|
|
2000
2000
|
card: l,
|
|
2001
2001
|
disabled: f
|
|
@@ -2006,17 +2006,17 @@ function Tn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
2006
2006
|
className: "text-sm text-destructive",
|
|
2007
2007
|
children: m
|
|
2008
2008
|
}) : null,
|
|
2009
|
-
/* @__PURE__ */ F(
|
|
2009
|
+
/* @__PURE__ */ F($, {
|
|
2010
2010
|
label: n ?? i.t("paymentMethods.save"),
|
|
2011
2011
|
processing: f,
|
|
2012
|
-
disabled: !l.valid || !
|
|
2012
|
+
disabled: !l.valid || !Ot.safeParse(u).success
|
|
2013
2013
|
}),
|
|
2014
|
-
/* @__PURE__ */ F(
|
|
2014
|
+
/* @__PURE__ */ F(Jt, {})
|
|
2015
2015
|
]
|
|
2016
2016
|
});
|
|
2017
2017
|
}
|
|
2018
|
-
function
|
|
2019
|
-
let i =
|
|
2018
|
+
function On({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
2019
|
+
let i = y(), { t: a } = i, { client: o, notify: s } = j(), c = P.useRef(null), [l, u] = P.useState(!1), [d, f] = P.useState(!1), [p, m] = P.useState(), h = P.useMemo(() => Mt(r), [r]), g = async (e) => {
|
|
2020
2020
|
if (e.preventDefault(), !(!c.current || d)) {
|
|
2021
2021
|
f(!0), m(void 0);
|
|
2022
2022
|
try {
|
|
@@ -2026,7 +2026,7 @@ function En({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
2026
2026
|
paymentMethodId: e
|
|
2027
2027
|
}), t(e);
|
|
2028
2028
|
} catch (e) {
|
|
2029
|
-
m(
|
|
2029
|
+
m(Tn(i, e));
|
|
2030
2030
|
} finally {
|
|
2031
2031
|
f(!1);
|
|
2032
2032
|
}
|
|
@@ -2036,7 +2036,7 @@ function En({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
2036
2036
|
className: "grid gap-4",
|
|
2037
2037
|
onSubmit: (e) => void g(e),
|
|
2038
2038
|
children: [
|
|
2039
|
-
/* @__PURE__ */ F(
|
|
2039
|
+
/* @__PURE__ */ F(dn, {
|
|
2040
2040
|
ref: c,
|
|
2041
2041
|
psp: e,
|
|
2042
2042
|
client: o,
|
|
@@ -2050,22 +2050,22 @@ function En({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
2050
2050
|
className: "text-sm text-destructive",
|
|
2051
2051
|
children: p
|
|
2052
2052
|
}) : null,
|
|
2053
|
-
/* @__PURE__ */ F(
|
|
2053
|
+
/* @__PURE__ */ F($, {
|
|
2054
2054
|
label: n ?? a("paymentMethods.save"),
|
|
2055
2055
|
processing: d,
|
|
2056
2056
|
disabled: !l
|
|
2057
2057
|
}),
|
|
2058
|
-
/* @__PURE__ */ F(
|
|
2058
|
+
/* @__PURE__ */ F(Jt, {})
|
|
2059
2059
|
]
|
|
2060
2060
|
});
|
|
2061
2061
|
}
|
|
2062
|
-
function
|
|
2063
|
-
let a =
|
|
2064
|
-
return /* @__PURE__ */ I(
|
|
2062
|
+
function kn({ psp: e, onSaved: t, submitLabel: r, defaultCountry: i }) {
|
|
2063
|
+
let a = y(), { client: o, notify: s } = j(), [c, l] = P.useState();
|
|
2064
|
+
return /* @__PURE__ */ I(ae, { children: [c ? /* @__PURE__ */ F("p", {
|
|
2065
2065
|
role: "alert",
|
|
2066
2066
|
className: "text-sm text-destructive",
|
|
2067
2067
|
children: c
|
|
2068
|
-
}) : null, /* @__PURE__ */ F(
|
|
2068
|
+
}) : null, /* @__PURE__ */ F(Yt, {
|
|
2069
2069
|
publicKey: e.config.public_api_key,
|
|
2070
2070
|
purpose: "setup",
|
|
2071
2071
|
defaultCountry: i,
|
|
@@ -2078,10 +2078,10 @@ function Dn({ psp: e, onSaved: t, submitLabel: r, defaultCountry: i }) {
|
|
|
2078
2078
|
i = await o.addPaymentMethod({
|
|
2079
2079
|
psp_id: e.psp_id,
|
|
2080
2080
|
token: r.payment_token,
|
|
2081
|
-
billing_details:
|
|
2081
|
+
billing_details: kt(r)
|
|
2082
2082
|
});
|
|
2083
2083
|
} catch (e) {
|
|
2084
|
-
if (l(
|
|
2084
|
+
if (l(Tn(a, e)), n(e) && (e.status === 400 || e.status === 402)) return !1;
|
|
2085
2085
|
throw e;
|
|
2086
2086
|
}
|
|
2087
2087
|
return s({
|
|
@@ -2093,9 +2093,9 @@ function Dn({ psp: e, onSaved: t, submitLabel: r, defaultCountry: i }) {
|
|
|
2093
2093
|
}
|
|
2094
2094
|
//#endregion
|
|
2095
2095
|
//#region src/account/notice.tsx
|
|
2096
|
-
function
|
|
2097
|
-
let [e, t] =
|
|
2098
|
-
return
|
|
2096
|
+
function An() {
|
|
2097
|
+
let [e, t] = P.useState(null);
|
|
2098
|
+
return P.useEffect(() => {
|
|
2099
2099
|
if (!e) return;
|
|
2100
2100
|
let n = setTimeout(() => t(null), 6e3);
|
|
2101
2101
|
return () => clearTimeout(n);
|
|
@@ -2108,29 +2108,29 @@ function On() {
|
|
|
2108
2108
|
}
|
|
2109
2109
|
//#endregion
|
|
2110
2110
|
//#region src/account/payment-methods-panel.tsx
|
|
2111
|
-
function
|
|
2111
|
+
function jn(e, t) {
|
|
2112
2112
|
return we(e.card, t);
|
|
2113
2113
|
}
|
|
2114
|
-
function
|
|
2114
|
+
function Mn(e, t) {
|
|
2115
2115
|
return e.status === 409 && e.code === "resource_conflict" ? t.t("paymentMethods.inUse") : t.error(e);
|
|
2116
2116
|
}
|
|
2117
|
-
function
|
|
2118
|
-
let a =
|
|
2119
|
-
|
|
2117
|
+
function Nn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r }) {
|
|
2118
|
+
let a = y(), { t: o } = a, s = k(n), c = D(), [l, u] = P.useState(null), [d, f] = P.useState(null), [p, h] = P.useState(null), [g, v] = P.useState(!1), b = S(), x = i(b.config?.payment.psps ?? []), C = x.filter(m), w = C.length > 0 ? null : _(x), { refetch: T } = b;
|
|
2119
|
+
P.useEffect(() => {
|
|
2120
2120
|
if (w === null) return;
|
|
2121
2121
|
let e = setTimeout(T, w * 1e3);
|
|
2122
2122
|
return () => clearTimeout(e);
|
|
2123
2123
|
}, [
|
|
2124
2124
|
w,
|
|
2125
2125
|
T,
|
|
2126
|
-
|
|
2126
|
+
b.config
|
|
2127
2127
|
]);
|
|
2128
|
-
let [E,
|
|
2128
|
+
let [E, O] = P.useState(), ee = C.find((e) => e.psp_id === E) ?? C[0], [te, A] = An(), j = e?.toUpperCase(), ne = async () => {
|
|
2129
2129
|
if (!l) return;
|
|
2130
2130
|
f(null);
|
|
2131
2131
|
let e = await c.remove(l.id);
|
|
2132
2132
|
if (e) {
|
|
2133
|
-
f(
|
|
2133
|
+
f(Mn(e, a));
|
|
2134
2134
|
return;
|
|
2135
2135
|
}
|
|
2136
2136
|
u(null), A(o("paymentMethods.removed"));
|
|
@@ -2143,22 +2143,22 @@ function jn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2143
2143
|
message: a.error(t)
|
|
2144
2144
|
}) : A(o("paymentMethods.defaultUpdated"));
|
|
2145
2145
|
}, ie, M = c.methods;
|
|
2146
|
-
ie = M === null && c.error ? /* @__PURE__ */ F(
|
|
2146
|
+
ie = M === null && c.error ? /* @__PURE__ */ F(Be, {
|
|
2147
2147
|
error: c.error,
|
|
2148
2148
|
onRetry: c.refetch
|
|
2149
|
-
}) : M === null ? /* @__PURE__ */ F(
|
|
2149
|
+
}) : M === null ? /* @__PURE__ */ F(Re, {}) : M.length === 0 ? /* @__PURE__ */ F(ze, {
|
|
2150
2150
|
title: o("paymentMethods.empty"),
|
|
2151
2151
|
description: o("paymentMethods.emptyDescription")
|
|
2152
2152
|
}) : /* @__PURE__ */ F("ul", {
|
|
2153
2153
|
className: "-my-1 divide-y divide-border",
|
|
2154
2154
|
children: M.map((e) => {
|
|
2155
|
-
let t =
|
|
2155
|
+
let t = jn(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);
|
|
2156
2156
|
return /* @__PURE__ */ I("li", {
|
|
2157
2157
|
"data-testid": "payment-method-row",
|
|
2158
2158
|
"data-payment-method-id": e.id,
|
|
2159
2159
|
className: "flex flex-wrap items-center gap-x-3 gap-y-2 py-3.5",
|
|
2160
2160
|
children: [
|
|
2161
|
-
/* @__PURE__ */ F(
|
|
2161
|
+
/* @__PURE__ */ F(Qe, {
|
|
2162
2162
|
brand: e.card?.brand ?? void 0,
|
|
2163
2163
|
fallback: (e.card?.brand ?? "card").slice(0, 4)
|
|
2164
2164
|
}),
|
|
@@ -2172,8 +2172,8 @@ function jn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2172
2172
|
className: "text-sm font-medium tabular-nums",
|
|
2173
2173
|
children: t
|
|
2174
2174
|
}),
|
|
2175
|
-
r === "expired" || r === "expiring_soon" ? /* @__PURE__ */ F(
|
|
2176
|
-
i.length > 0 ? /* @__PURE__ */ F(
|
|
2175
|
+
r === "expired" || r === "expiring_soon" ? /* @__PURE__ */ F(We, { status: r }) : e.health?.active === !1 ? /* @__PURE__ */ F(We, { status: "needs_attention" }) : null,
|
|
2176
|
+
i.length > 0 ? /* @__PURE__ */ F(We, {
|
|
2177
2177
|
status: "default",
|
|
2178
2178
|
label: o("paymentMethods.defaultFor", { currencies: i.join(", ") })
|
|
2179
2179
|
}) : null
|
|
@@ -2192,14 +2192,14 @@ function jn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2192
2192
|
}),
|
|
2193
2193
|
/* @__PURE__ */ I("div", {
|
|
2194
2194
|
className: "ml-auto flex items-center gap-1",
|
|
2195
|
-
children: [j && !i.includes(j) ? /* @__PURE__ */ I(
|
|
2195
|
+
children: [j && !i.includes(j) ? /* @__PURE__ */ I(U, {
|
|
2196
2196
|
variant: "ghost",
|
|
2197
2197
|
size: "sm",
|
|
2198
2198
|
className: "text-muted-foreground",
|
|
2199
2199
|
disabled: !!s,
|
|
2200
2200
|
onClick: () => void re(e),
|
|
2201
|
-
children: [s === "default" ? /* @__PURE__ */ F(
|
|
2202
|
-
}) : null, /* @__PURE__ */ F(
|
|
2201
|
+
children: [s === "default" ? /* @__PURE__ */ F(Z, {}) : null, o("paymentMethods.makeDefault")]
|
|
2202
|
+
}) : null, /* @__PURE__ */ F(U, {
|
|
2203
2203
|
variant: "ghost",
|
|
2204
2204
|
size: "icon-sm",
|
|
2205
2205
|
className: "text-muted-foreground hover:text-destructive",
|
|
@@ -2209,8 +2209,8 @@ function jn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2209
2209
|
onClick: () => {
|
|
2210
2210
|
f(null), u(e);
|
|
2211
2211
|
},
|
|
2212
|
-
children: s === "remove" ? /* @__PURE__ */ F(
|
|
2213
|
-
icon:
|
|
2212
|
+
children: s === "remove" ? /* @__PURE__ */ F(Z, {}) : /* @__PURE__ */ F(ce, {
|
|
2213
|
+
icon: fe,
|
|
2214
2214
|
"aria-hidden": !0
|
|
2215
2215
|
})
|
|
2216
2216
|
})]
|
|
@@ -2219,19 +2219,19 @@ function jn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2219
2219
|
}, e.id);
|
|
2220
2220
|
})
|
|
2221
2221
|
});
|
|
2222
|
-
let
|
|
2223
|
-
return /* @__PURE__ */ I(
|
|
2222
|
+
let N = l ? c.pending[l.id] === "remove" : !1, ae = l ? jn(l, a) : "";
|
|
2223
|
+
return /* @__PURE__ */ I(Le, {
|
|
2224
2224
|
title: o("paymentMethods.title"),
|
|
2225
2225
|
description: o("paymentMethods.description"),
|
|
2226
2226
|
appearance: n,
|
|
2227
2227
|
className: r,
|
|
2228
2228
|
"data-testid": "payment-methods-panel",
|
|
2229
|
-
action:
|
|
2229
|
+
action: ee ? /* @__PURE__ */ I(U, {
|
|
2230
2230
|
variant: "outline",
|
|
2231
2231
|
size: "sm",
|
|
2232
2232
|
onClick: () => v(!0),
|
|
2233
|
-
children: [/* @__PURE__ */ F(
|
|
2234
|
-
icon:
|
|
2233
|
+
children: [/* @__PURE__ */ F(ce, {
|
|
2234
|
+
icon: le,
|
|
2235
2235
|
"aria-hidden": !0,
|
|
2236
2236
|
"data-icon": "inline-start"
|
|
2237
2237
|
}), o("paymentMethods.add")]
|
|
@@ -2240,81 +2240,81 @@ function jn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2240
2240
|
ie,
|
|
2241
2241
|
M !== null && c.error ? /* @__PURE__ */ F("div", {
|
|
2242
2242
|
className: "pt-3",
|
|
2243
|
-
children: /* @__PURE__ */ F(
|
|
2243
|
+
children: /* @__PURE__ */ F(Be, {
|
|
2244
2244
|
error: c.error,
|
|
2245
2245
|
onRetry: c.refetch
|
|
2246
2246
|
})
|
|
2247
2247
|
}) : null,
|
|
2248
|
-
|
|
2248
|
+
b.error ? /* @__PURE__ */ F("div", {
|
|
2249
2249
|
className: "pt-3",
|
|
2250
|
-
children: /* @__PURE__ */ F(
|
|
2251
|
-
error:
|
|
2250
|
+
children: /* @__PURE__ */ F(Be, {
|
|
2251
|
+
error: b.error,
|
|
2252
2252
|
message: o("paymentMethods.addUnavailable"),
|
|
2253
|
-
onRetry:
|
|
2253
|
+
onRetry: b.refetch
|
|
2254
2254
|
})
|
|
2255
2255
|
}) : w === null ? null : /* @__PURE__ */ F("p", {
|
|
2256
2256
|
role: "status",
|
|
2257
2257
|
className: "pt-3 text-sm text-muted-foreground",
|
|
2258
2258
|
children: o("paymentMethods.addUnavailable")
|
|
2259
2259
|
}),
|
|
2260
|
-
|
|
2261
|
-
/* @__PURE__ */ F(
|
|
2260
|
+
te,
|
|
2261
|
+
/* @__PURE__ */ F(tt, {
|
|
2262
2262
|
open: l !== null,
|
|
2263
2263
|
onOpenChange: (e) => {
|
|
2264
|
-
!e && !
|
|
2264
|
+
!e && !N && u(null);
|
|
2265
2265
|
},
|
|
2266
|
-
children: /* @__PURE__ */ I(
|
|
2267
|
-
className: `${s.className} ${
|
|
2266
|
+
children: /* @__PURE__ */ I(it, {
|
|
2267
|
+
className: `${s.className} ${q} bg-popover text-popover-foreground`,
|
|
2268
2268
|
"data-orck-theme": s["data-orck-theme"],
|
|
2269
2269
|
style: s.style,
|
|
2270
2270
|
children: [
|
|
2271
|
-
/* @__PURE__ */ I(
|
|
2271
|
+
/* @__PURE__ */ I(at, { children: [/* @__PURE__ */ F(st, { children: o("paymentMethods.removeTitle", { label: ae }) }), /* @__PURE__ */ F(ct, { children: o("paymentMethods.removeDescription") })] }),
|
|
2272
2272
|
d ? /* @__PURE__ */ F("p", {
|
|
2273
2273
|
role: "alert",
|
|
2274
2274
|
className: "text-sm text-destructive",
|
|
2275
2275
|
children: d
|
|
2276
2276
|
}) : null,
|
|
2277
|
-
/* @__PURE__ */ I(
|
|
2278
|
-
disabled:
|
|
2277
|
+
/* @__PURE__ */ I(ot, { children: [/* @__PURE__ */ F(lt, {
|
|
2278
|
+
disabled: N,
|
|
2279
2279
|
children: o("common.cancel")
|
|
2280
|
-
}), /* @__PURE__ */ I(
|
|
2280
|
+
}), /* @__PURE__ */ I(U, {
|
|
2281
2281
|
variant: "destructive",
|
|
2282
|
-
disabled:
|
|
2282
|
+
disabled: N,
|
|
2283
2283
|
onClick: () => void ne(),
|
|
2284
|
-
children: [
|
|
2284
|
+
children: [N ? /* @__PURE__ */ F(Z, {}) : null, o("paymentMethods.removeConfirm")]
|
|
2285
2285
|
})] })
|
|
2286
2286
|
]
|
|
2287
2287
|
})
|
|
2288
2288
|
}),
|
|
2289
|
-
|
|
2289
|
+
ee ? /* @__PURE__ */ F(ut, {
|
|
2290
2290
|
open: g,
|
|
2291
2291
|
onOpenChange: v,
|
|
2292
|
-
children: /* @__PURE__ */ I(
|
|
2293
|
-
className: `${s.className} ${
|
|
2292
|
+
children: /* @__PURE__ */ I(pt, {
|
|
2293
|
+
className: `${s.className} ${q} max-h-[calc(100dvh-2rem)] overflow-y-auto bg-popover text-popover-foreground`,
|
|
2294
2294
|
"data-orck-theme": s["data-orck-theme"],
|
|
2295
2295
|
style: s.style,
|
|
2296
2296
|
children: [
|
|
2297
|
-
/* @__PURE__ */ I(
|
|
2297
|
+
/* @__PURE__ */ I(mt, { children: [/* @__PURE__ */ F(gt, { children: o("paymentMethods.addTitle") }), /* @__PURE__ */ F(_t, { children: o("paymentMethods.addDescription") })] }),
|
|
2298
2298
|
C.length > 1 ? /* @__PURE__ */ I("label", {
|
|
2299
2299
|
className: "grid gap-1.5 text-sm",
|
|
2300
2300
|
children: [o("paymentMethods.provider"), /* @__PURE__ */ F("select", {
|
|
2301
2301
|
className: "h-9 rounded-md border border-input bg-transparent px-2",
|
|
2302
|
-
value:
|
|
2303
|
-
onChange: (e) =>
|
|
2302
|
+
value: ee.psp_id,
|
|
2303
|
+
onChange: (e) => O(e.target.value),
|
|
2304
2304
|
children: C.map((e) => /* @__PURE__ */ F("option", {
|
|
2305
2305
|
value: e.psp_id,
|
|
2306
2306
|
children: e.display_name
|
|
2307
2307
|
}, e.psp_id))
|
|
2308
2308
|
})]
|
|
2309
2309
|
}) : null,
|
|
2310
|
-
/* @__PURE__ */ F(
|
|
2311
|
-
psp:
|
|
2310
|
+
/* @__PURE__ */ F(wn, {
|
|
2311
|
+
psp: ee,
|
|
2312
2312
|
defaultCountry: t,
|
|
2313
2313
|
appearance: n,
|
|
2314
2314
|
onSaved: () => {
|
|
2315
2315
|
v(!1), A(o("paymentMethods.added"));
|
|
2316
2316
|
}
|
|
2317
|
-
},
|
|
2317
|
+
}, ee.psp_id)
|
|
2318
2318
|
]
|
|
2319
2319
|
})
|
|
2320
2320
|
}) : null
|
|
@@ -2323,7 +2323,7 @@ function jn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2323
2323
|
}
|
|
2324
2324
|
//#endregion
|
|
2325
2325
|
//#region src/components/ui/textarea.tsx
|
|
2326
|
-
function
|
|
2326
|
+
function Pn({ className: e, ...t }) {
|
|
2327
2327
|
return /* @__PURE__ */ F("textarea", {
|
|
2328
2328
|
"data-slot": "textarea",
|
|
2329
2329
|
className: L("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", e),
|
|
@@ -2332,57 +2332,57 @@ function Mn({ className: e, ...t }) {
|
|
|
2332
2332
|
}
|
|
2333
2333
|
//#endregion
|
|
2334
2334
|
//#region src/account/cancel-dialog.tsx
|
|
2335
|
-
function
|
|
2336
|
-
let s =
|
|
2337
|
-
if (v(!0),
|
|
2338
|
-
|
|
2335
|
+
function Fn({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, onConfirm: a, appearance: o }) {
|
|
2336
|
+
let s = y(), { t: c } = s, l = k(o), u = P.useId(), d = P.useId(), [f, m] = P.useState(""), [h, g] = P.useState(!1), [_, v] = P.useState(!1), [b, x] = P.useState(null), S = i !== void 0, C = f.trim().length, w = C < 4, T = async () => {
|
|
2337
|
+
if (v(!0), w || S) return;
|
|
2338
|
+
x(null);
|
|
2339
2339
|
let e = await a(f, h);
|
|
2340
|
-
e ? p(e) ||
|
|
2341
|
-
},
|
|
2342
|
-
return /* @__PURE__ */ F(
|
|
2340
|
+
e ? p(e) || x(e) : t(!1);
|
|
2341
|
+
}, E = c(i === "cancel" && h ? "cancel.preparing" : i === "signing" ? "cancel.signing" : i === "confirming" ? "cancel.confirming" : S ? "cancel.working" : h ? "cancel.confirmWallet" : "cancel.confirm");
|
|
2342
|
+
return /* @__PURE__ */ F(tt, {
|
|
2343
2343
|
open: e,
|
|
2344
2344
|
onOpenChange: (e) => {
|
|
2345
|
-
!e &&
|
|
2345
|
+
!e && S || t(e);
|
|
2346
2346
|
},
|
|
2347
|
-
children: /* @__PURE__ */ F(
|
|
2348
|
-
className: `${l.className} ${
|
|
2347
|
+
children: /* @__PURE__ */ F(it, {
|
|
2348
|
+
className: `${l.className} ${q} bg-popover text-popover-foreground`,
|
|
2349
2349
|
"data-orck-theme": l["data-orck-theme"],
|
|
2350
2350
|
style: l.style,
|
|
2351
2351
|
children: /* @__PURE__ */ I("form", {
|
|
2352
2352
|
className: "grid gap-5",
|
|
2353
2353
|
noValidate: !0,
|
|
2354
2354
|
onSubmit: (e) => {
|
|
2355
|
-
e.preventDefault(),
|
|
2355
|
+
e.preventDefault(), T();
|
|
2356
2356
|
},
|
|
2357
2357
|
children: [
|
|
2358
|
-
/* @__PURE__ */ I(
|
|
2358
|
+
/* @__PURE__ */ I(at, { children: [/* @__PURE__ */ F(st, { children: c("cancel.title", { name: n }) }), /* @__PURE__ */ F(ct, { children: c("cancel.description") })] }),
|
|
2359
2359
|
/* @__PURE__ */ I("div", {
|
|
2360
2360
|
className: "grid gap-2",
|
|
2361
2361
|
children: [
|
|
2362
|
-
/* @__PURE__ */ F(
|
|
2362
|
+
/* @__PURE__ */ F(Q, {
|
|
2363
2363
|
htmlFor: u,
|
|
2364
2364
|
children: c("cancel.reasonLabel")
|
|
2365
2365
|
}),
|
|
2366
|
-
/* @__PURE__ */ F(
|
|
2366
|
+
/* @__PURE__ */ F(Pn, {
|
|
2367
2367
|
id: u,
|
|
2368
2368
|
value: f,
|
|
2369
2369
|
maxLength: 500,
|
|
2370
2370
|
placeholder: c("cancel.reasonPlaceholder"),
|
|
2371
2371
|
"aria-describedby": d,
|
|
2372
|
-
"aria-invalid": _ &&
|
|
2373
|
-
disabled:
|
|
2372
|
+
"aria-invalid": _ && w ? !0 : void 0,
|
|
2373
|
+
disabled: S,
|
|
2374
2374
|
required: !0,
|
|
2375
2375
|
rows: 3,
|
|
2376
2376
|
className: "[font:inherit]",
|
|
2377
2377
|
onChange: (e) => m(e.target.value),
|
|
2378
|
-
onBlur: () =>
|
|
2378
|
+
onBlur: () => C > 0 && v(!0)
|
|
2379
2379
|
}),
|
|
2380
2380
|
/* @__PURE__ */ I("div", {
|
|
2381
2381
|
id: d,
|
|
2382
2382
|
className: "flex justify-between gap-3 text-xs text-muted-foreground",
|
|
2383
2383
|
children: [/* @__PURE__ */ F("span", {
|
|
2384
|
-
className: _ &&
|
|
2385
|
-
children: _ &&
|
|
2384
|
+
className: _ && w ? "text-destructive" : "",
|
|
2385
|
+
children: _ && w ? c("cancel.reasonTooShort", { min: 4 }) : ""
|
|
2386
2386
|
}), /* @__PURE__ */ F("span", {
|
|
2387
2387
|
className: "tabular-nums",
|
|
2388
2388
|
children: c("cancel.reasonHint", {
|
|
@@ -2398,23 +2398,23 @@ function Nn({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, on
|
|
|
2398
2398
|
children: [/* @__PURE__ */ F("input", {
|
|
2399
2399
|
type: "checkbox",
|
|
2400
2400
|
checked: h,
|
|
2401
|
-
disabled:
|
|
2401
|
+
disabled: S,
|
|
2402
2402
|
onChange: (e) => g(e.target.checked)
|
|
2403
2403
|
}), /* @__PURE__ */ F("span", { children: c("cancel.revokeOnChain") })]
|
|
2404
2404
|
}) : null,
|
|
2405
|
-
|
|
2405
|
+
b ? /* @__PURE__ */ F("p", {
|
|
2406
2406
|
role: "alert",
|
|
2407
2407
|
className: "text-sm text-destructive",
|
|
2408
|
-
children: s.error(
|
|
2408
|
+
children: s.error(b)
|
|
2409
2409
|
}) : null,
|
|
2410
|
-
/* @__PURE__ */ I(
|
|
2411
|
-
disabled:
|
|
2410
|
+
/* @__PURE__ */ I(ot, { children: [/* @__PURE__ */ F(lt, {
|
|
2411
|
+
disabled: S,
|
|
2412
2412
|
children: c("cancel.keep")
|
|
2413
|
-
}), /* @__PURE__ */ I(
|
|
2413
|
+
}), /* @__PURE__ */ I(U, {
|
|
2414
2414
|
type: "submit",
|
|
2415
2415
|
variant: "destructive",
|
|
2416
|
-
disabled:
|
|
2417
|
-
children: [
|
|
2416
|
+
disabled: S,
|
|
2417
|
+
children: [S ? /* @__PURE__ */ F(Z, {}) : null, E]
|
|
2418
2418
|
})] })
|
|
2419
2419
|
]
|
|
2420
2420
|
})
|
|
@@ -2423,19 +2423,19 @@ function Nn({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, on
|
|
|
2423
2423
|
}
|
|
2424
2424
|
//#endregion
|
|
2425
2425
|
//#region src/components/ui/radio-group.tsx
|
|
2426
|
-
function
|
|
2427
|
-
return /* @__PURE__ */ F(
|
|
2426
|
+
function In({ className: e, ...t }) {
|
|
2427
|
+
return /* @__PURE__ */ F(ge, {
|
|
2428
2428
|
"data-slot": "radio-group",
|
|
2429
2429
|
className: L("grid w-full gap-3", e),
|
|
2430
2430
|
...t
|
|
2431
2431
|
});
|
|
2432
2432
|
}
|
|
2433
|
-
function
|
|
2434
|
-
return /* @__PURE__ */ F(
|
|
2433
|
+
function Ln({ className: e, ...t }) {
|
|
2434
|
+
return /* @__PURE__ */ F(he.Root, {
|
|
2435
2435
|
"data-slot": "radio-group-item",
|
|
2436
2436
|
className: L("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary", e),
|
|
2437
2437
|
...t,
|
|
2438
|
-
children: /* @__PURE__ */ F(
|
|
2438
|
+
children: /* @__PURE__ */ F(he.Indicator, {
|
|
2439
2439
|
"data-slot": "radio-group-indicator",
|
|
2440
2440
|
className: "flex size-4 items-center justify-center",
|
|
2441
2441
|
children: /* @__PURE__ */ F("span", { className: "absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground" })
|
|
@@ -2444,23 +2444,23 @@ function Fn({ className: e, ...t }) {
|
|
|
2444
2444
|
}
|
|
2445
2445
|
//#endregion
|
|
2446
2446
|
//#region src/account/change-card-dialog.tsx
|
|
2447
|
-
var
|
|
2448
|
-
function
|
|
2447
|
+
var Rn = "default";
|
|
2448
|
+
function zn(e, t) {
|
|
2449
2449
|
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));
|
|
2450
2450
|
}
|
|
2451
|
-
function
|
|
2452
|
-
let o =
|
|
2453
|
-
return /* @__PURE__ */ F(
|
|
2451
|
+
function Bn({ subscription: e, name: t, onOpenChange: n, pending: r, onConfirm: i, appearance: a }) {
|
|
2452
|
+
let o = k(a);
|
|
2453
|
+
return /* @__PURE__ */ F(ut, {
|
|
2454
2454
|
open: e !== null,
|
|
2455
2455
|
onOpenChange: (e) => {
|
|
2456
2456
|
!e && r || n(e);
|
|
2457
2457
|
},
|
|
2458
|
-
children: /* @__PURE__ */ F(
|
|
2458
|
+
children: /* @__PURE__ */ F(pt, {
|
|
2459
2459
|
showCloseButton: !1,
|
|
2460
|
-
className: `${o.className} ${
|
|
2460
|
+
className: `${o.className} ${q} bg-popover text-popover-foreground`,
|
|
2461
2461
|
"data-orck-theme": o["data-orck-theme"],
|
|
2462
2462
|
style: o.style,
|
|
2463
|
-
children: e ? /* @__PURE__ */ F(
|
|
2463
|
+
children: e ? /* @__PURE__ */ F(Vn, {
|
|
2464
2464
|
subscription: e,
|
|
2465
2465
|
name: t,
|
|
2466
2466
|
pending: r,
|
|
@@ -2470,23 +2470,23 @@ function Rn({ subscription: e, name: t, onOpenChange: n, pending: r, onConfirm:
|
|
|
2470
2470
|
})
|
|
2471
2471
|
});
|
|
2472
2472
|
}
|
|
2473
|
-
function
|
|
2474
|
-
let a =
|
|
2475
|
-
id:
|
|
2473
|
+
function Vn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i }) {
|
|
2474
|
+
let a = y(), { t: o } = a, s = P.useId(), c = D(), l = e.payment_method_id ?? Rn, [u, d] = P.useState(l), [f, p] = P.useState(null), m = c.methods ? zn(e, c.methods) : null, h = e.price?.currency?.toUpperCase(), g = h ? m?.find((e) => (e.default_currencies ?? []).includes(h)) : void 0, _ = [...g ? [{
|
|
2475
|
+
id: Rn,
|
|
2476
2476
|
card: g
|
|
2477
2477
|
}] : [], ...(m ?? []).map((e) => ({
|
|
2478
2478
|
id: e.id,
|
|
2479
2479
|
card: e
|
|
2480
|
-
}))], v = _.some((e) => e.id !== l),
|
|
2480
|
+
}))], v = _.some((e) => e.id !== l), b = async () => {
|
|
2481
2481
|
if (!u || u === l || n) return;
|
|
2482
2482
|
p(null);
|
|
2483
|
-
let e = await i(u ===
|
|
2483
|
+
let e = await i(u === Rn ? null : u);
|
|
2484
2484
|
e && p(e);
|
|
2485
|
-
},
|
|
2486
|
-
return
|
|
2485
|
+
}, x;
|
|
2486
|
+
return x = m === null && c.error ? /* @__PURE__ */ F(Be, {
|
|
2487
2487
|
error: c.error,
|
|
2488
2488
|
onRetry: c.refetch
|
|
2489
|
-
}) : m === null ? /* @__PURE__ */ F(
|
|
2489
|
+
}) : m === null ? /* @__PURE__ */ F(Re, { rows: 2 }) : /* @__PURE__ */ F(In, {
|
|
2490
2490
|
value: u,
|
|
2491
2491
|
onValueChange: (e) => {
|
|
2492
2492
|
typeof e == "string" && e && d(e);
|
|
@@ -2496,22 +2496,22 @@ function zn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i })
|
|
|
2496
2496
|
className: "grid gap-0",
|
|
2497
2497
|
children: _.map(({ id: e, card: t }) => {
|
|
2498
2498
|
let r = `${s}-${e}`, i = we(t.card, a);
|
|
2499
|
-
return /* @__PURE__ */ I(
|
|
2499
|
+
return /* @__PURE__ */ I(Q, {
|
|
2500
2500
|
htmlFor: r,
|
|
2501
2501
|
"data-testid": "change-card-option",
|
|
2502
2502
|
className: L("flex cursor-pointer items-center gap-3 py-1.5 select-none", n && "cursor-default"),
|
|
2503
2503
|
children: [
|
|
2504
|
-
/* @__PURE__ */ F(
|
|
2504
|
+
/* @__PURE__ */ F(Ln, {
|
|
2505
2505
|
id: r,
|
|
2506
2506
|
value: e
|
|
2507
2507
|
}),
|
|
2508
|
-
/* @__PURE__ */ F(
|
|
2508
|
+
/* @__PURE__ */ F(Qe, {
|
|
2509
2509
|
brand: t.card?.brand ?? void 0,
|
|
2510
2510
|
fallback: (t.card?.brand ?? "card").slice(0, 4)
|
|
2511
2511
|
}),
|
|
2512
2512
|
/* @__PURE__ */ F("span", {
|
|
2513
2513
|
className: "min-w-0 flex-1 truncate text-sm font-medium tabular-nums",
|
|
2514
|
-
children: e ===
|
|
2514
|
+
children: e === Rn ? o("changeCard.useDefault", { card: i }) : i
|
|
2515
2515
|
}),
|
|
2516
2516
|
e === l ? /* @__PURE__ */ F("span", {
|
|
2517
2517
|
className: "shrink-0 text-xs text-muted-foreground",
|
|
@@ -2524,81 +2524,263 @@ function zn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i })
|
|
|
2524
2524
|
className: "grid gap-5",
|
|
2525
2525
|
noValidate: !0,
|
|
2526
2526
|
onSubmit: (e) => {
|
|
2527
|
-
e.preventDefault(),
|
|
2527
|
+
e.preventDefault(), b();
|
|
2528
2528
|
},
|
|
2529
2529
|
children: [
|
|
2530
|
-
/* @__PURE__ */ I(
|
|
2531
|
-
|
|
2530
|
+
/* @__PURE__ */ I(mt, { children: [/* @__PURE__ */ F(gt, { children: o("changeCard.title", { name: t }) }), /* @__PURE__ */ F(_t, { children: o(m !== null && !v ? "changeCard.none" : "changeCard.description") })] }),
|
|
2531
|
+
x,
|
|
2532
2532
|
f ? /* @__PURE__ */ F("p", {
|
|
2533
2533
|
role: "alert",
|
|
2534
2534
|
className: "text-sm text-destructive",
|
|
2535
2535
|
children: a.error(f)
|
|
2536
2536
|
}) : null,
|
|
2537
|
-
/* @__PURE__ */ I(
|
|
2537
|
+
/* @__PURE__ */ I(ht, { children: [/* @__PURE__ */ F(U, {
|
|
2538
2538
|
type: "button",
|
|
2539
2539
|
variant: "outline",
|
|
2540
2540
|
disabled: n,
|
|
2541
2541
|
onClick: r,
|
|
2542
2542
|
children: o("common.cancel")
|
|
2543
|
-
}), /* @__PURE__ */ I(
|
|
2543
|
+
}), /* @__PURE__ */ I(U, {
|
|
2544
2544
|
type: "submit",
|
|
2545
2545
|
disabled: n || !u || u === l,
|
|
2546
|
-
children: [n ? /* @__PURE__ */ F(
|
|
2546
|
+
children: [n ? /* @__PURE__ */ F(Z, {}) : null, o("changeCard.confirm")]
|
|
2547
|
+
})] })
|
|
2548
|
+
]
|
|
2549
|
+
});
|
|
2550
|
+
}
|
|
2551
|
+
//#endregion
|
|
2552
|
+
//#region src/authenticate.ts
|
|
2553
|
+
async function Hn(e, t, n, r) {
|
|
2554
|
+
let i = n.next_action, o = i?.payload?.client_secret;
|
|
2555
|
+
if (n.status !== "requires_action" || i?.type !== "authenticate" || !o || !a(r)) return n;
|
|
2556
|
+
let s = await (await Zt(r.config.publishable_key)).handleNextAction({ clientSecret: o });
|
|
2557
|
+
if (s.error) throw Error(s.error.message ?? "Authentication failed.");
|
|
2558
|
+
return e.confirmSubscriptionChange(t);
|
|
2559
|
+
}
|
|
2560
|
+
//#endregion
|
|
2561
|
+
//#region src/account/change-plan.tsx
|
|
2562
|
+
var Un = /* @__PURE__ */ new Map(), Wn = (e, t) => JSON.stringify([e, t]);
|
|
2563
|
+
function Gn(e, t) {
|
|
2564
|
+
let n = Wn(e, t), r = Un.get(n) ?? crypto.randomUUID();
|
|
2565
|
+
return Un.set(n, r), r;
|
|
2566
|
+
}
|
|
2567
|
+
var Kn = (e) => e.code === "subscription_change_in_flight" || e.status === 0 || e.status >= 500;
|
|
2568
|
+
function qn({ subscription: e, name: t, pending: r, changeSubscription: i, sendSolanaTransaction: a, onChanged: o, appearance: s }) {
|
|
2569
|
+
let c = y(), { t: l } = c, { locale: u } = E(), { client: d, notify: f } = j(), { config: p } = S(), m = A(e.id), [h, g] = P.useState(!1), [_, v] = P.useState(!1);
|
|
2570
|
+
if (!h && !m.options?.length) return null;
|
|
2571
|
+
let b = async (r) => {
|
|
2572
|
+
let s = e.id, m = r.price.id, h = await i(s, {
|
|
2573
|
+
priceId: m,
|
|
2574
|
+
idempotencyKey: Gn(s, m)
|
|
2575
|
+
}, a);
|
|
2576
|
+
if (n(h)) return Kn(h) || Un.delete(Wn(s, m)), c.error(h);
|
|
2577
|
+
let _ = h.next_action;
|
|
2578
|
+
if (_?.type === "redirect_to_url" && _.url) return window.location.assign(_.url), null;
|
|
2579
|
+
if (h.status === "requires_action" && _?.type === "authenticate") {
|
|
2580
|
+
let e = p?.payment.psps.find((e) => e.psp_id === _.psp_id);
|
|
2581
|
+
if (!e) return c.t("paymentMethods.unavailable");
|
|
2582
|
+
try {
|
|
2583
|
+
h = await Hn(d, s, h, e);
|
|
2584
|
+
} catch (e) {
|
|
2585
|
+
return n(e) ? c.error(e) : e instanceof Error && e.message || c.t("errors.generic");
|
|
2586
|
+
}
|
|
2587
|
+
f({
|
|
2588
|
+
type: "subscription.changed",
|
|
2589
|
+
subscriptionId: s,
|
|
2590
|
+
change: h
|
|
2591
|
+
});
|
|
2592
|
+
}
|
|
2593
|
+
if (h.status === "requires_action") return c.t("changePlan.actionRequired");
|
|
2594
|
+
if (h.status !== "processing" && Un.delete(Wn(s, m)), h.status === "blocked") return h.message || c.t("errors.generic");
|
|
2595
|
+
g(!1);
|
|
2596
|
+
let v = r.product.display_name || t, y = G(h.delayed_start ?? h.next_charge_date, u);
|
|
2597
|
+
return o(h.status === "processing" ? l("changePlan.processing") : h.effective === "period_end" && y ? l("changePlan.scheduled", {
|
|
2598
|
+
name: v,
|
|
2599
|
+
date: y
|
|
2600
|
+
}) : l("changePlan.done", { name: v })), null;
|
|
2601
|
+
};
|
|
2602
|
+
return /* @__PURE__ */ I(ae, { children: [/* @__PURE__ */ F(U, {
|
|
2603
|
+
variant: "ghost",
|
|
2604
|
+
size: "sm",
|
|
2605
|
+
disabled: !!r,
|
|
2606
|
+
"aria-label": l("subscriptions.changePlanLabel", { name: t }),
|
|
2607
|
+
onClick: () => {
|
|
2608
|
+
m.refetch(), g(!0);
|
|
2609
|
+
},
|
|
2610
|
+
children: l("subscriptions.changePlan")
|
|
2611
|
+
}), /* @__PURE__ */ F(Jn, {
|
|
2612
|
+
open: h,
|
|
2613
|
+
onOpenChange: g,
|
|
2614
|
+
name: t,
|
|
2615
|
+
options: m,
|
|
2616
|
+
busy: _ || !!r,
|
|
2617
|
+
stage: r,
|
|
2618
|
+
onConfirm: async (e) => {
|
|
2619
|
+
v(!0);
|
|
2620
|
+
try {
|
|
2621
|
+
return await b(e);
|
|
2622
|
+
} finally {
|
|
2623
|
+
v(!1);
|
|
2624
|
+
}
|
|
2625
|
+
},
|
|
2626
|
+
appearance: s
|
|
2627
|
+
})] });
|
|
2628
|
+
}
|
|
2629
|
+
function Jn({ open: e, onOpenChange: t, appearance: n, busy: r, ...i }) {
|
|
2630
|
+
let a = k(n);
|
|
2631
|
+
return /* @__PURE__ */ F(ut, {
|
|
2632
|
+
open: e,
|
|
2633
|
+
onOpenChange: (e) => {
|
|
2634
|
+
!e && r || t(e);
|
|
2635
|
+
},
|
|
2636
|
+
children: /* @__PURE__ */ F(pt, {
|
|
2637
|
+
showCloseButton: !1,
|
|
2638
|
+
className: `${a.className} ${q} bg-popover text-popover-foreground`,
|
|
2639
|
+
"data-orck-theme": a["data-orck-theme"],
|
|
2640
|
+
style: a.style,
|
|
2641
|
+
children: e ? /* @__PURE__ */ F(Yn, {
|
|
2642
|
+
...i,
|
|
2643
|
+
busy: r,
|
|
2644
|
+
onCancel: () => t(!1)
|
|
2645
|
+
}) : null
|
|
2646
|
+
})
|
|
2647
|
+
});
|
|
2648
|
+
}
|
|
2649
|
+
function Yn({ name: e, options: t, busy: n, stage: r, onConfirm: i, onCancel: a }) {
|
|
2650
|
+
let o = y(), { t: s } = o, { locale: c } = E(), l = te(), u = P.useId(), [d, f] = P.useState(""), [p, m] = P.useState(null), h = t.options, g = h?.find((e) => e.price.id === d), _;
|
|
2651
|
+
return _ = h === null && t.error ? /* @__PURE__ */ F(Be, {
|
|
2652
|
+
error: t.error,
|
|
2653
|
+
onRetry: t.refetch
|
|
2654
|
+
}) : h === null ? /* @__PURE__ */ F(Re, { rows: 2 }) : /* @__PURE__ */ F(In, {
|
|
2655
|
+
value: d,
|
|
2656
|
+
onValueChange: (e) => {
|
|
2657
|
+
typeof e == "string" && e && f(e);
|
|
2658
|
+
},
|
|
2659
|
+
disabled: n,
|
|
2660
|
+
"aria-label": s("changePlan.title", { name: e }),
|
|
2661
|
+
className: "grid gap-0",
|
|
2662
|
+
children: h.map((e) => {
|
|
2663
|
+
let t = `${u}-${e.price.id}`, r = K(e.price.unit_amount, e.price.currency, l, c), i = be(e.price, o);
|
|
2664
|
+
return /* @__PURE__ */ I(Q, {
|
|
2665
|
+
htmlFor: t,
|
|
2666
|
+
"data-testid": "change-plan-option",
|
|
2667
|
+
className: L("flex cursor-pointer items-start gap-3 py-2 select-none", n && "cursor-default"),
|
|
2668
|
+
children: [/* @__PURE__ */ F(Ln, {
|
|
2669
|
+
id: t,
|
|
2670
|
+
value: e.price.id,
|
|
2671
|
+
className: "mt-0.5"
|
|
2672
|
+
}), /* @__PURE__ */ I("span", {
|
|
2673
|
+
className: "grid min-w-0 flex-1 gap-0.5",
|
|
2674
|
+
children: [/* @__PURE__ */ I("span", {
|
|
2675
|
+
className: "text-sm font-medium",
|
|
2676
|
+
children: [e.product.display_name, r ? /* @__PURE__ */ I("span", {
|
|
2677
|
+
className: "font-normal text-muted-foreground tabular-nums",
|
|
2678
|
+
children: [
|
|
2679
|
+
" · ",
|
|
2680
|
+
r,
|
|
2681
|
+
i ? ` ${i}` : null
|
|
2682
|
+
]
|
|
2683
|
+
}) : null]
|
|
2684
|
+
}), /* @__PURE__ */ F("span", {
|
|
2685
|
+
className: "text-xs font-normal text-muted-foreground tabular-nums",
|
|
2686
|
+
children: Xn(e, o, l, c)
|
|
2687
|
+
})]
|
|
2688
|
+
})]
|
|
2689
|
+
}, e.price.id);
|
|
2690
|
+
})
|
|
2691
|
+
}), /* @__PURE__ */ I("form", {
|
|
2692
|
+
className: "grid gap-5",
|
|
2693
|
+
noValidate: !0,
|
|
2694
|
+
onSubmit: (e) => {
|
|
2695
|
+
e.preventDefault(), !(!g || n) && (m(null), i(g).then(m));
|
|
2696
|
+
},
|
|
2697
|
+
children: [
|
|
2698
|
+
/* @__PURE__ */ I(mt, { children: [/* @__PURE__ */ F(gt, { children: s("changePlan.title", { name: e }) }), /* @__PURE__ */ F(_t, { children: h?.length === 0 ? s("changePlan.none") : s("changePlan.description") })] }),
|
|
2699
|
+
_,
|
|
2700
|
+
p ? /* @__PURE__ */ F("p", {
|
|
2701
|
+
role: "alert",
|
|
2702
|
+
className: "text-sm text-destructive",
|
|
2703
|
+
children: p
|
|
2704
|
+
}) : null,
|
|
2705
|
+
/* @__PURE__ */ I(ht, { children: [/* @__PURE__ */ F(U, {
|
|
2706
|
+
type: "button",
|
|
2707
|
+
variant: "outline",
|
|
2708
|
+
disabled: n,
|
|
2709
|
+
onClick: a,
|
|
2710
|
+
children: s("common.cancel")
|
|
2711
|
+
}), /* @__PURE__ */ I(U, {
|
|
2712
|
+
type: "submit",
|
|
2713
|
+
disabled: n || !g,
|
|
2714
|
+
children: [n ? /* @__PURE__ */ F(Z, {}) : null, s(r === "signing" ? "changePlan.signing" : r === "confirming" ? "changePlan.confirming" : "changePlan.confirm")]
|
|
2547
2715
|
})] })
|
|
2548
2716
|
]
|
|
2549
2717
|
});
|
|
2550
2718
|
}
|
|
2719
|
+
function Xn(e, t, n, r) {
|
|
2720
|
+
let i = e.preview, a = K(i.next_charge_amount, i.currency, n, r), o = G(i.next_charge_date, r);
|
|
2721
|
+
if (!a || !o) return i.message ?? "";
|
|
2722
|
+
if (i.effective !== "now") return t.t("changePlan.atPeriodEnd", {
|
|
2723
|
+
next: a,
|
|
2724
|
+
date: o
|
|
2725
|
+
});
|
|
2726
|
+
let s = K(i.amount_due_now, i.currency, n, r);
|
|
2727
|
+
return s ? t.t(i.is_estimate ? "changePlan.chargeNowEstimate" : "changePlan.chargeNow", {
|
|
2728
|
+
amount: s,
|
|
2729
|
+
next: a,
|
|
2730
|
+
date: o
|
|
2731
|
+
}) : i.message ?? "";
|
|
2732
|
+
}
|
|
2551
2733
|
//#endregion
|
|
2552
2734
|
//#region src/account/resume-dialog.tsx
|
|
2553
|
-
function
|
|
2554
|
-
let c =
|
|
2555
|
-
return /* @__PURE__ */ F(
|
|
2735
|
+
function Zn({ open: e, onOpenChange: t, name: n, price: r, date: i, busy: a, onConfirm: o, appearance: s }) {
|
|
2736
|
+
let c = y().t, l = k(s);
|
|
2737
|
+
return /* @__PURE__ */ F(tt, {
|
|
2556
2738
|
open: e,
|
|
2557
2739
|
onOpenChange: (e) => {
|
|
2558
2740
|
!e && a || t(e);
|
|
2559
2741
|
},
|
|
2560
|
-
children: /* @__PURE__ */ I(
|
|
2561
|
-
className: `${l.className} ${
|
|
2742
|
+
children: /* @__PURE__ */ I(it, {
|
|
2743
|
+
className: `${l.className} ${q} bg-popover text-popover-foreground`,
|
|
2562
2744
|
"data-orck-theme": l["data-orck-theme"],
|
|
2563
2745
|
style: l.style,
|
|
2564
|
-
children: [/* @__PURE__ */ I(
|
|
2746
|
+
children: [/* @__PURE__ */ I(at, { children: [/* @__PURE__ */ F(st, { children: c("resume.title", { name: n }) }), /* @__PURE__ */ F(ct, { children: r && i ? c("resume.description", {
|
|
2565
2747
|
price: r,
|
|
2566
2748
|
date: i
|
|
2567
|
-
}) : c("resume.descriptionNoDate") })] }), /* @__PURE__ */ I(
|
|
2749
|
+
}) : c("resume.descriptionNoDate") })] }), /* @__PURE__ */ I(ot, { children: [/* @__PURE__ */ F(lt, {
|
|
2568
2750
|
disabled: a,
|
|
2569
2751
|
children: c("resume.keepCanceled")
|
|
2570
|
-
}), /* @__PURE__ */ I(
|
|
2752
|
+
}), /* @__PURE__ */ I(U, {
|
|
2571
2753
|
type: "button",
|
|
2572
2754
|
disabled: a,
|
|
2573
2755
|
onClick: o,
|
|
2574
|
-
children: [a ? /* @__PURE__ */ F(
|
|
2756
|
+
children: [a ? /* @__PURE__ */ F(Z, {}) : null, c("resume.confirm")]
|
|
2575
2757
|
})] })]
|
|
2576
2758
|
})
|
|
2577
2759
|
});
|
|
2578
2760
|
}
|
|
2579
2761
|
//#endregion
|
|
2580
2762
|
//#region src/account/subscriptions-panel.tsx
|
|
2581
|
-
function
|
|
2582
|
-
let o =
|
|
2763
|
+
function Qn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter: n, appearance: r, className: i, ...a }) {
|
|
2764
|
+
let o = y(), { t: s } = o, { locale: c, navigate: l } = E(), u = T(a), d = te(), [f, p] = P.useState(null), [m, h] = P.useState(null), [g, _] = P.useState(null), [v, b] = P.useState(null), [x, S] = An(), C = P.useMemo(() => {
|
|
2583
2765
|
let e = u.subscriptions ?? [];
|
|
2584
2766
|
return [...e.filter(Oe), ...e.filter((e) => !Oe(e))];
|
|
2585
2767
|
}, [u.subscriptions]), w = async (e) => {
|
|
2586
|
-
|
|
2768
|
+
b(null);
|
|
2587
2769
|
let t = await u.resume(e.id);
|
|
2588
|
-
h(null), t ?
|
|
2770
|
+
h(null), t ? b({
|
|
2589
2771
|
id: e.id,
|
|
2590
2772
|
message: o.error(t)
|
|
2591
|
-
}) :
|
|
2592
|
-
},
|
|
2593
|
-
return
|
|
2773
|
+
}) : S(s("subscriptions.resumed"));
|
|
2774
|
+
}, D = f?.rail === "solana", O;
|
|
2775
|
+
return O = u.subscriptions === null && u.error ? /* @__PURE__ */ F(Be, {
|
|
2594
2776
|
error: u.error,
|
|
2595
2777
|
onRetry: u.refetch
|
|
2596
|
-
}) : u.subscriptions === null ? /* @__PURE__ */ F(
|
|
2778
|
+
}) : u.subscriptions === null ? /* @__PURE__ */ F(Re, {}) : C.length === 0 ? /* @__PURE__ */ F(ze, {
|
|
2597
2779
|
title: s("subscriptions.empty"),
|
|
2598
2780
|
description: s("subscriptions.emptyDescription"),
|
|
2599
2781
|
action: t ? /* @__PURE__ */ F("a", {
|
|
2600
2782
|
href: t,
|
|
2601
|
-
className:
|
|
2783
|
+
className: H({
|
|
2602
2784
|
variant: "outline",
|
|
2603
2785
|
size: "sm"
|
|
2604
2786
|
}),
|
|
@@ -2609,14 +2791,14 @@ function Vn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2609
2791
|
}) : null
|
|
2610
2792
|
}) : /* @__PURE__ */ F("ul", {
|
|
2611
2793
|
className: "-my-1 divide-y divide-border",
|
|
2612
|
-
children: C.map((
|
|
2613
|
-
let
|
|
2614
|
-
brand: Ce(
|
|
2615
|
-
last4:
|
|
2616
|
-
}) : null,
|
|
2794
|
+
children: C.map((t) => {
|
|
2795
|
+
let i = Oe(t), a = u.pending[t.id], l = xe(t, o), m = t.price ? K(t.price.unit_amount, t.price.currency, d, c) : null, g = be(t.price, o), y = G(t.current_period_ends_at, c), x = G(t.access?.ends_at, c), C = G(t.ended_at ?? t.canceled_at ?? t.current_period_ends_at, c), w = ke(t), T = i && !w && !!t.price?.billing_interval_hours, E = i ? T && y ? s("subscriptions.renews", { date: y }) : x ? s("subscriptions.endsOn", { date: x }) : s("subscriptions.noMorePayments") : t.status === "canceled" ? s("subscriptions.noMorePayments") : C && s("subscriptions.endedOn", { date: C }), D = t.rail === "solana" ? s("subscriptions.wallet") : t.card?.last4 ? s("subscriptions.paidWith", {
|
|
2796
|
+
brand: Ce(t.card.brand, s("paymentMethods.fallbackBrand")),
|
|
2797
|
+
last4: t.card.last4
|
|
2798
|
+
}) : null, O = i && !w ? t.cancel_portal_url : null, k = Ee.has(t.status) && !w && !O, ee = (t.status === "active" || t.status === "past_due" || t.status === "awaiting_method" || t.status === "unverified") && !w && !O && t.rail !== "solana" && (t.collection_policy === "engine" || t.collection_policy === "nmi_schedule"), te = t.cancel_scheduled ? "cancel_scheduled" : t.status, A = n?.(t);
|
|
2617
2799
|
return /* @__PURE__ */ I("li", {
|
|
2618
2800
|
"data-testid": "subscription-row",
|
|
2619
|
-
"data-subscription-id":
|
|
2801
|
+
"data-subscription-id": t.id,
|
|
2620
2802
|
className: "grid gap-3 py-4 @md:grid-cols-[1fr_auto] @md:items-center",
|
|
2621
2803
|
children: [
|
|
2622
2804
|
/* @__PURE__ */ I("div", {
|
|
@@ -2625,29 +2807,29 @@ function Vn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2625
2807
|
/* @__PURE__ */ I("div", {
|
|
2626
2808
|
className: "flex flex-wrap items-center gap-x-2 gap-y-1",
|
|
2627
2809
|
children: [/* @__PURE__ */ F("span", {
|
|
2628
|
-
className: L("truncate text-sm font-semibold", !
|
|
2629
|
-
children:
|
|
2630
|
-
}), /* @__PURE__ */ F(
|
|
2810
|
+
className: L("truncate text-sm font-semibold", !i && "text-muted-foreground"),
|
|
2811
|
+
children: l
|
|
2812
|
+
}), /* @__PURE__ */ F(We, { status: te })]
|
|
2631
2813
|
}),
|
|
2632
2814
|
/* @__PURE__ */ F("p", {
|
|
2633
2815
|
className: "text-sm text-muted-foreground tabular-nums",
|
|
2634
|
-
children: [
|
|
2816
|
+
children: [E, D].filter(Boolean).join(" · ") || s("common.notAvailable")
|
|
2635
2817
|
}),
|
|
2636
|
-
|
|
2637
|
-
className: L("text-sm tabular-nums", !
|
|
2818
|
+
m ? /* @__PURE__ */ I("p", {
|
|
2819
|
+
className: L("text-sm tabular-nums", !i && "text-muted-foreground"),
|
|
2638
2820
|
children: [/* @__PURE__ */ F("span", {
|
|
2639
2821
|
className: "font-medium",
|
|
2640
|
-
children:
|
|
2641
|
-
}),
|
|
2822
|
+
children: m
|
|
2823
|
+
}), g ? /* @__PURE__ */ I("span", {
|
|
2642
2824
|
className: "text-muted-foreground",
|
|
2643
|
-
children: [" ",
|
|
2825
|
+
children: [" ", g]
|
|
2644
2826
|
}) : null]
|
|
2645
2827
|
}) : null,
|
|
2646
|
-
|
|
2828
|
+
t.status === "past_due" || t.status === "awaiting_method" ? /* @__PURE__ */ F("p", {
|
|
2647
2829
|
className: "text-sm text-destructive",
|
|
2648
2830
|
children: s("subscriptions.pastDue")
|
|
2649
2831
|
}) : null,
|
|
2650
|
-
v?.id ===
|
|
2832
|
+
v?.id === t.id ? /* @__PURE__ */ F("p", {
|
|
2651
2833
|
role: "alert",
|
|
2652
2834
|
className: "text-sm text-destructive",
|
|
2653
2835
|
children: v.message
|
|
@@ -2657,75 +2839,84 @@ function Vn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2657
2839
|
/* @__PURE__ */ I("div", {
|
|
2658
2840
|
className: "flex flex-wrap gap-2 @md:justify-end",
|
|
2659
2841
|
children: [
|
|
2660
|
-
|
|
2842
|
+
t.resumable ? /* @__PURE__ */ I(U, {
|
|
2661
2843
|
variant: "outline",
|
|
2662
2844
|
size: "sm",
|
|
2663
|
-
disabled: !!
|
|
2845
|
+
disabled: !!a,
|
|
2664
2846
|
onClick: () => {
|
|
2665
|
-
|
|
2847
|
+
b(null), h(t);
|
|
2666
2848
|
},
|
|
2667
|
-
children: [
|
|
2849
|
+
children: [a === "resume" ? /* @__PURE__ */ F(Z, {}) : null, s(a === "resume" ? "subscriptions.updating" : "subscriptions.resume")]
|
|
2668
2850
|
}) : null,
|
|
2669
|
-
|
|
2670
|
-
href:
|
|
2851
|
+
O ? /* @__PURE__ */ I("a", {
|
|
2852
|
+
href: O,
|
|
2671
2853
|
target: "_blank",
|
|
2672
2854
|
rel: "noopener noreferrer",
|
|
2673
|
-
className:
|
|
2855
|
+
className: H({
|
|
2674
2856
|
variant: "outline",
|
|
2675
2857
|
size: "sm"
|
|
2676
2858
|
}),
|
|
2677
|
-
children: [s("subscriptions.manageAtProvider"), /* @__PURE__ */ F(
|
|
2678
|
-
icon:
|
|
2859
|
+
children: [s("subscriptions.manageAtProvider"), /* @__PURE__ */ F(ce, {
|
|
2860
|
+
icon: ue,
|
|
2679
2861
|
"aria-hidden": !0
|
|
2680
2862
|
})]
|
|
2681
2863
|
}) : null,
|
|
2682
|
-
|
|
2864
|
+
Ae(t) && (t.rail !== "solana" || e) ? /* @__PURE__ */ F(qn, {
|
|
2865
|
+
subscription: t,
|
|
2866
|
+
name: l,
|
|
2867
|
+
pending: a,
|
|
2868
|
+
changeSubscription: u.changeSubscription,
|
|
2869
|
+
sendSolanaTransaction: e,
|
|
2870
|
+
onChanged: S,
|
|
2871
|
+
appearance: r
|
|
2872
|
+
}) : null,
|
|
2873
|
+
ee ? /* @__PURE__ */ I(U, {
|
|
2683
2874
|
variant: "ghost",
|
|
2684
2875
|
size: "sm",
|
|
2685
|
-
disabled: !!
|
|
2686
|
-
"aria-label": s("subscriptions.changeCardLabel", { name:
|
|
2876
|
+
disabled: !!a,
|
|
2877
|
+
"aria-label": s("subscriptions.changeCardLabel", { name: l }),
|
|
2687
2878
|
onClick: () => {
|
|
2688
|
-
|
|
2879
|
+
b(null), _(t);
|
|
2689
2880
|
},
|
|
2690
|
-
children: [
|
|
2881
|
+
children: [a === "payment_method" ? /* @__PURE__ */ F(Z, {}) : null, s("subscriptions.changeCard")]
|
|
2691
2882
|
}) : null,
|
|
2692
|
-
|
|
2883
|
+
k ? /* @__PURE__ */ I(U, {
|
|
2693
2884
|
size: "sm",
|
|
2694
2885
|
className: "bg-red-600 text-white hover:bg-red-700",
|
|
2695
|
-
disabled: !!
|
|
2696
|
-
"aria-label": s("subscriptions.cancelLabel", { name:
|
|
2886
|
+
disabled: !!a,
|
|
2887
|
+
"aria-label": s("subscriptions.cancelLabel", { name: l }),
|
|
2697
2888
|
onClick: () => {
|
|
2698
|
-
|
|
2889
|
+
b(null), p(t);
|
|
2699
2890
|
},
|
|
2700
|
-
children: [
|
|
2891
|
+
children: [a === "cancel" || f?.id === t.id && a ? /* @__PURE__ */ F(Z, {}) : null, s("subscriptions.cancel")]
|
|
2701
2892
|
}) : null
|
|
2702
2893
|
]
|
|
2703
2894
|
}),
|
|
2704
|
-
|
|
2895
|
+
A ? /* @__PURE__ */ F("div", {
|
|
2705
2896
|
"data-testid": "subscription-footer",
|
|
2706
2897
|
className: "border-t border-border/60 pt-3 @md:col-span-2",
|
|
2707
|
-
children:
|
|
2898
|
+
children: A
|
|
2708
2899
|
}) : null
|
|
2709
2900
|
]
|
|
2710
|
-
},
|
|
2901
|
+
}, t.id);
|
|
2711
2902
|
})
|
|
2712
|
-
}), /* @__PURE__ */ I(
|
|
2903
|
+
}), /* @__PURE__ */ I(Le, {
|
|
2713
2904
|
title: s("subscriptions.title"),
|
|
2714
2905
|
description: s("subscriptions.description"),
|
|
2715
2906
|
appearance: r,
|
|
2716
2907
|
className: i,
|
|
2717
2908
|
"data-testid": "subscriptions-panel",
|
|
2718
2909
|
children: [
|
|
2719
|
-
|
|
2910
|
+
O,
|
|
2720
2911
|
u.subscriptions !== null && u.error ? /* @__PURE__ */ F("div", {
|
|
2721
2912
|
className: "pt-3",
|
|
2722
|
-
children: /* @__PURE__ */ F(
|
|
2913
|
+
children: /* @__PURE__ */ F(Be, {
|
|
2723
2914
|
error: u.error,
|
|
2724
2915
|
onRetry: u.refetch
|
|
2725
2916
|
})
|
|
2726
2917
|
}) : null,
|
|
2727
|
-
|
|
2728
|
-
/* @__PURE__ */ F(
|
|
2918
|
+
x,
|
|
2919
|
+
/* @__PURE__ */ F(Bn, {
|
|
2729
2920
|
subscription: g,
|
|
2730
2921
|
name: g ? xe(g, o) : "",
|
|
2731
2922
|
onOpenChange: (e) => !e && _(null),
|
|
@@ -2734,30 +2925,30 @@ function Vn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2734
2925
|
onConfirm: async (e) => {
|
|
2735
2926
|
if (!g) return null;
|
|
2736
2927
|
let t = await u.setPaymentMethod(g.id, e);
|
|
2737
|
-
return t || (_(null),
|
|
2928
|
+
return t || (_(null), S(s("changeCard.done"))), t;
|
|
2738
2929
|
}
|
|
2739
2930
|
}, `card-${g?.id ?? "closed"}`),
|
|
2740
|
-
/* @__PURE__ */ F(
|
|
2931
|
+
/* @__PURE__ */ F(Zn, {
|
|
2741
2932
|
open: m !== null,
|
|
2742
2933
|
onOpenChange: (e) => !e && h(null),
|
|
2743
2934
|
name: m ? xe(m, o) : "",
|
|
2744
|
-
price: m?.price ?
|
|
2745
|
-
date:
|
|
2935
|
+
price: m?.price ? K(m.price.unit_amount, m.price.currency, d, c) : null,
|
|
2936
|
+
date: G(m?.current_period_ends_at, c) || null,
|
|
2746
2937
|
busy: m ? u.pending[m.id] === "resume" : !1,
|
|
2747
2938
|
onConfirm: () => m && void w(m),
|
|
2748
2939
|
appearance: r
|
|
2749
2940
|
}),
|
|
2750
|
-
/* @__PURE__ */ F(
|
|
2941
|
+
/* @__PURE__ */ F(Fn, {
|
|
2751
2942
|
open: f !== null,
|
|
2752
2943
|
onOpenChange: (e) => !e && p(null),
|
|
2753
2944
|
name: f ? xe(f, o) : "",
|
|
2754
|
-
onChain:
|
|
2945
|
+
onChain: D && !!e,
|
|
2755
2946
|
appearance: r,
|
|
2756
2947
|
pending: f ? u.pending[f.id] : void 0,
|
|
2757
2948
|
onConfirm: async (t, n) => {
|
|
2758
2949
|
if (!f) return null;
|
|
2759
2950
|
let r = await u.cancel(f.id, t, e, n);
|
|
2760
|
-
return r ||
|
|
2951
|
+
return r || S(s("cancel.done")), r;
|
|
2761
2952
|
}
|
|
2762
2953
|
}, f?.id ?? "closed")
|
|
2763
2954
|
]
|
|
@@ -2765,24 +2956,24 @@ function Vn({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2765
2956
|
}
|
|
2766
2957
|
//#endregion
|
|
2767
2958
|
//#region src/account/account-billing.tsx
|
|
2768
|
-
function
|
|
2769
|
-
return /* @__PURE__ */ I(
|
|
2959
|
+
function $n({ defaultCurrency: e, defaultCountry: t, sendSolanaTransaction: n, plansHref: r, renderSubscriptionFooter: i, historyPageSize: a, appearance: o, className: s }) {
|
|
2960
|
+
return /* @__PURE__ */ I(_e, {
|
|
2770
2961
|
appearance: o,
|
|
2771
2962
|
className: L("grid gap-6", s),
|
|
2772
2963
|
"data-testid": "account-billing",
|
|
2773
2964
|
children: [
|
|
2774
|
-
/* @__PURE__ */ F(
|
|
2965
|
+
/* @__PURE__ */ F(Qn, {
|
|
2775
2966
|
sendSolanaTransaction: n,
|
|
2776
2967
|
plansHref: r,
|
|
2777
2968
|
renderSubscriptionFooter: i,
|
|
2778
2969
|
appearance: o
|
|
2779
2970
|
}),
|
|
2780
|
-
/* @__PURE__ */ F(
|
|
2971
|
+
/* @__PURE__ */ F(Nn, {
|
|
2781
2972
|
defaultCurrency: e,
|
|
2782
2973
|
defaultCountry: t,
|
|
2783
2974
|
appearance: o
|
|
2784
2975
|
}),
|
|
2785
|
-
/* @__PURE__ */ F(
|
|
2976
|
+
/* @__PURE__ */ F(Ke, {
|
|
2786
2977
|
pageSize: a,
|
|
2787
2978
|
appearance: o
|
|
2788
2979
|
})
|
|
@@ -2790,16 +2981,44 @@ function Hn({ defaultCurrency: e, defaultCountry: t, sendSolanaTransaction: n, p
|
|
|
2790
2981
|
});
|
|
2791
2982
|
}
|
|
2792
2983
|
//#endregion
|
|
2984
|
+
//#region src/account/renewal-prompt.tsx
|
|
2985
|
+
function er({ plansHref: e, appearance: t, className: n }) {
|
|
2986
|
+
let { t: r } = y(), { navigate: i } = E(), a = k(t), { subscriptions: o } = T();
|
|
2987
|
+
return !o?.length || o.some(Oe) ? null : /* @__PURE__ */ I("div", {
|
|
2988
|
+
"data-testid": "renewal-prompt",
|
|
2989
|
+
"data-orck-theme": a["data-orck-theme"],
|
|
2990
|
+
style: a.style,
|
|
2991
|
+
className: L(a.className, q, "flex flex-wrap items-center justify-between gap-3 rounded-xl border border-border bg-card p-4 text-card-foreground", n),
|
|
2992
|
+
children: [/* @__PURE__ */ I("div", {
|
|
2993
|
+
className: "grid min-w-0 gap-1",
|
|
2994
|
+
children: [/* @__PURE__ */ F("p", {
|
|
2995
|
+
className: "text-sm font-semibold",
|
|
2996
|
+
children: r("renewal.title")
|
|
2997
|
+
}), /* @__PURE__ */ F("p", {
|
|
2998
|
+
className: "text-sm text-muted-foreground",
|
|
2999
|
+
children: r("renewal.description")
|
|
3000
|
+
})]
|
|
3001
|
+
}), /* @__PURE__ */ F("a", {
|
|
3002
|
+
href: e,
|
|
3003
|
+
className: H({ size: "sm" }),
|
|
3004
|
+
onClick: (t) => {
|
|
3005
|
+
i && (t.preventDefault(), i(e));
|
|
3006
|
+
},
|
|
3007
|
+
children: r("renewal.action")
|
|
3008
|
+
})]
|
|
3009
|
+
});
|
|
3010
|
+
}
|
|
3011
|
+
//#endregion
|
|
2793
3012
|
//#region src/components/qr.tsx
|
|
2794
|
-
var
|
|
2795
|
-
function
|
|
2796
|
-
let r =
|
|
2797
|
-
return
|
|
3013
|
+
var tr = 208;
|
|
3014
|
+
function nr({ amountLabel: e, payload: t, statusLine: n }) {
|
|
3015
|
+
let r = P.useRef(null), [i, a] = P.useState("loading");
|
|
3016
|
+
return P.useEffect(() => {
|
|
2798
3017
|
let e = r.current;
|
|
2799
3018
|
if (!e || !t) return;
|
|
2800
3019
|
let n = !1;
|
|
2801
3020
|
return e.replaceChildren(), a("loading"), import("./dist-CslWupfi.js").then(({ createQR: r }) => {
|
|
2802
|
-
n || (r(t,
|
|
3021
|
+
n || (r(t, tr, "#ffffff", "#18181b").append(e), a("ready"));
|
|
2803
3022
|
}).catch(() => {
|
|
2804
3023
|
n || a("failed");
|
|
2805
3024
|
}), () => {
|
|
@@ -2815,8 +3034,8 @@ function Wn({ amountLabel: e, payload: t, statusLine: n }) {
|
|
|
2815
3034
|
"aria-label": "Solana Pay QR code",
|
|
2816
3035
|
className: "relative overflow-hidden rounded-lg",
|
|
2817
3036
|
style: {
|
|
2818
|
-
width:
|
|
2819
|
-
height:
|
|
3037
|
+
width: tr,
|
|
3038
|
+
height: tr
|
|
2820
3039
|
},
|
|
2821
3040
|
children: [
|
|
2822
3041
|
/* @__PURE__ */ F("div", {
|
|
@@ -2836,8 +3055,8 @@ function Wn({ amountLabel: e, payload: t, statusLine: n }) {
|
|
|
2836
3055
|
"aria-hidden": !0,
|
|
2837
3056
|
className: "animate-pulse rounded-lg bg-zinc-100",
|
|
2838
3057
|
style: {
|
|
2839
|
-
width:
|
|
2840
|
-
height:
|
|
3058
|
+
width: tr,
|
|
3059
|
+
height: tr
|
|
2841
3060
|
}
|
|
2842
3061
|
})
|
|
2843
3062
|
}),
|
|
@@ -2856,13 +3075,13 @@ function Wn({ amountLabel: e, payload: t, statusLine: n }) {
|
|
|
2856
3075
|
}),
|
|
2857
3076
|
t ? /* @__PURE__ */ F("a", {
|
|
2858
3077
|
href: t,
|
|
2859
|
-
className: L(
|
|
3078
|
+
className: L(H({ variant: "secondary" }), "h-9 w-full max-w-56"),
|
|
2860
3079
|
children: "Open in wallet"
|
|
2861
3080
|
}) : null
|
|
2862
3081
|
]
|
|
2863
3082
|
});
|
|
2864
3083
|
}
|
|
2865
|
-
var
|
|
3084
|
+
var rr = {
|
|
2866
3085
|
visa: "VISA",
|
|
2867
3086
|
mastercard: "MC",
|
|
2868
3087
|
amex: "AMEX",
|
|
@@ -2870,19 +3089,19 @@ var Gn = {
|
|
|
2870
3089
|
jcb: "JCB",
|
|
2871
3090
|
diners: "DINERS"
|
|
2872
3091
|
};
|
|
2873
|
-
function
|
|
2874
|
-
return
|
|
3092
|
+
function ir(e) {
|
|
3093
|
+
return rr[e?.trim().toLowerCase() ?? ""] ?? "CARD";
|
|
2875
3094
|
}
|
|
2876
|
-
function
|
|
3095
|
+
function ar(e) {
|
|
2877
3096
|
let t = e?.trim();
|
|
2878
3097
|
return t ? t[0].toUpperCase() + t.slice(1) : "Card";
|
|
2879
3098
|
}
|
|
2880
|
-
function
|
|
3099
|
+
function or(e) {
|
|
2881
3100
|
let t = e.card;
|
|
2882
3101
|
if (!(!t?.exp_month || !t.exp_year)) return `${String(t.exp_month).padStart(2, "0")}/${String(t.exp_year).slice(-2)}`;
|
|
2883
3102
|
}
|
|
2884
|
-
function
|
|
2885
|
-
return /* @__PURE__ */ I(
|
|
3103
|
+
function sr({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
3104
|
+
return /* @__PURE__ */ I(In, {
|
|
2886
3105
|
value: t,
|
|
2887
3106
|
onValueChange: (e) => {
|
|
2888
3107
|
typeof e == "string" && e && n(e);
|
|
@@ -2891,25 +3110,25 @@ function Yn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2891
3110
|
"aria-label": "Saved cards",
|
|
2892
3111
|
className: "grid gap-0",
|
|
2893
3112
|
children: [e.map((e) => {
|
|
2894
|
-
let n = `${i}-${e.id}`, a = t === e.id, o =
|
|
2895
|
-
return /* @__PURE__ */ I(
|
|
3113
|
+
let n = `${i}-${e.id}`, a = t === e.id, o = or(e), s = e.card?.brand, c = e.card?.last4;
|
|
3114
|
+
return /* @__PURE__ */ I(Q, {
|
|
2896
3115
|
htmlFor: n,
|
|
2897
3116
|
className: L("flex cursor-pointer items-center gap-3 py-1.5 select-none", r && "cursor-default"),
|
|
2898
3117
|
children: [
|
|
2899
|
-
/* @__PURE__ */ F(
|
|
3118
|
+
/* @__PURE__ */ F(Ln, {
|
|
2900
3119
|
id: n,
|
|
2901
3120
|
value: e.id
|
|
2902
3121
|
}),
|
|
2903
|
-
/* @__PURE__ */ F(
|
|
3122
|
+
/* @__PURE__ */ F(Qe, {
|
|
2904
3123
|
brand: s ?? void 0,
|
|
2905
|
-
fallback:
|
|
3124
|
+
fallback: ir(s)
|
|
2906
3125
|
}),
|
|
2907
3126
|
/* @__PURE__ */ I("span", {
|
|
2908
3127
|
className: L("min-w-0 flex-1 truncate text-sm font-medium text-muted-foreground tabular-nums transition-colors", a && "font-semibold text-foreground"),
|
|
2909
3128
|
children: [/* @__PURE__ */ I("span", {
|
|
2910
3129
|
className: "sr-only",
|
|
2911
3130
|
children: [
|
|
2912
|
-
|
|
3131
|
+
ar(s),
|
|
2913
3132
|
" card ending ",
|
|
2914
3133
|
c,
|
|
2915
3134
|
o ? `, expires ${o}` : ""
|
|
@@ -2917,7 +3136,7 @@ function Yn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2917
3136
|
}), /* @__PURE__ */ I("span", {
|
|
2918
3137
|
"aria-hidden": !0,
|
|
2919
3138
|
children: [
|
|
2920
|
-
|
|
3139
|
+
ar(s),
|
|
2921
3140
|
" •••• ",
|
|
2922
3141
|
c ?? "····",
|
|
2923
3142
|
o ? /* @__PURE__ */ I("span", {
|
|
@@ -2933,19 +3152,19 @@ function Yn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2933
3152
|
})
|
|
2934
3153
|
]
|
|
2935
3154
|
}, e.id);
|
|
2936
|
-
}), /* @__PURE__ */ I(
|
|
3155
|
+
}), /* @__PURE__ */ I(Q, {
|
|
2937
3156
|
htmlFor: `${i}-new`,
|
|
2938
3157
|
className: L("flex cursor-pointer items-center gap-3 py-1.5 text-sm font-medium text-muted-foreground select-none", t === "new" && "font-semibold text-foreground", r && "cursor-default"),
|
|
2939
3158
|
children: [
|
|
2940
|
-
/* @__PURE__ */ F(
|
|
3159
|
+
/* @__PURE__ */ F(Ln, {
|
|
2941
3160
|
id: `${i}-new`,
|
|
2942
3161
|
value: "new"
|
|
2943
3162
|
}),
|
|
2944
3163
|
/* @__PURE__ */ F("span", {
|
|
2945
3164
|
"aria-hidden": !0,
|
|
2946
3165
|
className: L("grid h-7 w-11 shrink-0 place-items-center rounded-md border border-dashed border-border text-muted-foreground transition-colors", t === "new" && "border-solid border-transparent bg-foreground text-background"),
|
|
2947
|
-
children: /* @__PURE__ */ F(
|
|
2948
|
-
icon:
|
|
3166
|
+
children: /* @__PURE__ */ F(ce, {
|
|
3167
|
+
icon: le,
|
|
2949
3168
|
className: "size-3.5"
|
|
2950
3169
|
})
|
|
2951
3170
|
}),
|
|
@@ -2956,34 +3175,34 @@ function Yn({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
2956
3175
|
}
|
|
2957
3176
|
//#endregion
|
|
2958
3177
|
//#region src/components/states.tsx
|
|
2959
|
-
function
|
|
3178
|
+
function cr() {
|
|
2960
3179
|
return /* @__PURE__ */ I("div", {
|
|
2961
3180
|
className: "grid gap-4",
|
|
2962
3181
|
"aria-hidden": !0,
|
|
2963
3182
|
children: [
|
|
2964
|
-
/* @__PURE__ */ F(
|
|
2965
|
-
/* @__PURE__ */ F(
|
|
2966
|
-
/* @__PURE__ */ F(
|
|
2967
|
-
/* @__PURE__ */ F(
|
|
2968
|
-
/* @__PURE__ */ F(
|
|
2969
|
-
/* @__PURE__ */ F(
|
|
3183
|
+
/* @__PURE__ */ F(X, { className: "h-3 w-24" }),
|
|
3184
|
+
/* @__PURE__ */ F(X, { className: "h-6 w-52" }),
|
|
3185
|
+
/* @__PURE__ */ F(X, { className: "mt-1.5 h-11 w-full" }),
|
|
3186
|
+
/* @__PURE__ */ F(X, { className: "h-28 w-full" }),
|
|
3187
|
+
/* @__PURE__ */ F(X, { className: "h-11 w-full" }),
|
|
3188
|
+
/* @__PURE__ */ F(X, { className: "mt-1 h-[42px] w-full" })
|
|
2970
3189
|
]
|
|
2971
3190
|
});
|
|
2972
3191
|
}
|
|
2973
3192
|
//#endregion
|
|
2974
3193
|
//#region src/components/stripe-wallets.tsx
|
|
2975
|
-
function
|
|
2976
|
-
let a =
|
|
2977
|
-
|
|
3194
|
+
function lr({ publishableKey: e, amount: t, currency: n, onPaymentMethod: r, onAvailable: i }) {
|
|
3195
|
+
let a = P.useRef(null), o = P.useRef(r), s = P.useRef(i);
|
|
3196
|
+
P.useEffect(() => {
|
|
2978
3197
|
o.current = r, s.current = i;
|
|
2979
3198
|
});
|
|
2980
|
-
let [c, l] =
|
|
2981
|
-
return
|
|
3199
|
+
let [c, l] = P.useState(!1);
|
|
3200
|
+
return P.useEffect(() => {
|
|
2982
3201
|
if (!a.current) return;
|
|
2983
3202
|
let r = !1, i, c = (e) => {
|
|
2984
3203
|
r || (l(e), s.current?.(e));
|
|
2985
3204
|
};
|
|
2986
|
-
return
|
|
3205
|
+
return Zt(e).then((e) => {
|
|
2987
3206
|
if (r || !a.current) return;
|
|
2988
3207
|
let s = e.elements({
|
|
2989
3208
|
mode: "payment",
|
|
@@ -2991,7 +3210,7 @@ function Zn({ publishableKey: e, amount: t, currency: n, onPaymentMethod: r, onA
|
|
|
2991
3210
|
currency: n.toLowerCase(),
|
|
2992
3211
|
paymentMethodCreation: "manual",
|
|
2993
3212
|
paymentMethodTypes: ["card"],
|
|
2994
|
-
appearance:
|
|
3213
|
+
appearance: un(a.current)
|
|
2995
3214
|
}), l = s.create("expressCheckout", { paymentMethods: {
|
|
2996
3215
|
applePay: "auto",
|
|
2997
3216
|
googlePay: "auto",
|
|
@@ -3024,7 +3243,7 @@ function Zn({ publishableKey: e, amount: t, currency: n, onPaymentMethod: r, onA
|
|
|
3024
3243
|
}
|
|
3025
3244
|
//#endregion
|
|
3026
3245
|
//#region src/fallbacks.ts
|
|
3027
|
-
function
|
|
3246
|
+
function ur(e, t, n) {
|
|
3028
3247
|
let r = /* @__PURE__ */ new Set();
|
|
3029
3248
|
if (!e) return r;
|
|
3030
3249
|
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]));
|
|
@@ -3036,25 +3255,25 @@ function Qn(e, t, n) {
|
|
|
3036
3255
|
}
|
|
3037
3256
|
return r;
|
|
3038
3257
|
}
|
|
3039
|
-
var
|
|
3040
|
-
for:
|
|
3041
|
-
afterFailures:
|
|
3258
|
+
var dr = "fallbacks", fr = 4096, pr = 1024, mr = 8, hr = N.string().regex(/^[a-z0-9][a-z0-9_-]{0,62}$/), gr = N.record(hr, N.strictObject({
|
|
3259
|
+
for: N.array(hr).min(1).max(mr),
|
|
3260
|
+
afterFailures: N.number().int().min(1).max(100)
|
|
3042
3261
|
})).refine((e) => {
|
|
3043
3262
|
let t = Object.keys(e).length;
|
|
3044
|
-
return t >= 1 && t <=
|
|
3263
|
+
return t >= 1 && t <= mr;
|
|
3045
3264
|
});
|
|
3046
|
-
function
|
|
3265
|
+
function _r(e, t) {
|
|
3047
3266
|
if (!t || Object.keys(t).length === 0) return e;
|
|
3048
|
-
let n = e.indexOf("#"), r = n < 0 ? e : e.slice(0, n), i = n < 0 ? "" : e.slice(n + 1), a = `${
|
|
3267
|
+
let n = e.indexOf("#"), r = n < 0 ? e : e.slice(0, n), i = n < 0 ? "" : e.slice(n + 1), a = `${dr}=${encodeURIComponent(JSON.stringify(t))}`;
|
|
3049
3268
|
return `${r}#${i ? `${i}&` : ""}${a}`;
|
|
3050
3269
|
}
|
|
3051
|
-
function
|
|
3270
|
+
function vr(e) {
|
|
3052
3271
|
let [t = "", ...n] = e.replace(/^#/, "").split("&"), r = { secret: t.startsWith("pus_") ? t : null };
|
|
3053
|
-
if (e.length >
|
|
3054
|
-
let i = new URLSearchParams(n.join("&")).get(
|
|
3055
|
-
if (!i || i.length >
|
|
3272
|
+
if (e.length > fr) return r;
|
|
3273
|
+
let i = new URLSearchParams(n.join("&")).get(dr);
|
|
3274
|
+
if (!i || i.length > pr) return r;
|
|
3056
3275
|
try {
|
|
3057
|
-
let e =
|
|
3276
|
+
let e = gr.safeParse(JSON.parse(i));
|
|
3058
3277
|
return e.success ? {
|
|
3059
3278
|
...r,
|
|
3060
3279
|
fallbacks: e.data
|
|
@@ -3065,82 +3284,82 @@ function or(e) {
|
|
|
3065
3284
|
}
|
|
3066
3285
|
//#endregion
|
|
3067
3286
|
//#region src/order-payment.tsx
|
|
3068
|
-
var
|
|
3069
|
-
function
|
|
3070
|
-
let m =
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
}),
|
|
3287
|
+
var yr = (e) => e.custodian === "platform" && e.rail === "nmi" && e.flow === "tokenize" && !e.status && !!e.config?.public_api_key, br = (e) => e.status === "complete" || e.status === "processing", xr = 3e3;
|
|
3288
|
+
function Sr({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0, serverCardEntry: a = !0, wallets: o = !1, fallbacks: c, onSettled: l, appearance: u, className: p }) {
|
|
3289
|
+
let m = y(), h = j(), g = t ?? h.client, { config: _ } = O(), { config: v, error: b, refetch: x } = S(), T = te(), [E, D] = P.useState(), [k, ee] = P.useState([]), [A, ne] = P.useState("new"), [re, ie] = P.useState(), [M, N] = P.useState(), [R, oe] = P.useState(!1), [z, se] = P.useState(), [ce, le] = P.useState(!1), [ue, de] = P.useState(() => crypto.randomUUID()), fe = P.useRef(null), pe = P.useRef(l);
|
|
3290
|
+
P.useEffect(() => {
|
|
3291
|
+
pe.current = l;
|
|
3292
|
+
}), P.useEffect(() => {
|
|
3074
3293
|
let t = new AbortController();
|
|
3075
|
-
return g.getOrder(e, t.signal).then(
|
|
3076
|
-
t.signal.aborted ||
|
|
3294
|
+
return g.getOrder(e, t.signal).then(D, (e) => {
|
|
3295
|
+
t.signal.aborted || N(m.error(e));
|
|
3077
3296
|
}), () => t.abort();
|
|
3078
3297
|
}, [
|
|
3079
3298
|
g,
|
|
3080
3299
|
e,
|
|
3081
3300
|
m
|
|
3082
|
-
]),
|
|
3083
|
-
if (!i ||
|
|
3301
|
+
]), P.useEffect(() => {
|
|
3302
|
+
if (!i || E?.collection_owner !== "engine") return;
|
|
3084
3303
|
let e = new AbortController();
|
|
3085
|
-
return g.listPaymentMethods({ signal: e.signal }).then((e) =>
|
|
3304
|
+
return g.listPaymentMethods({ signal: e.signal }).then((e) => ee(e.data), () => void 0), () => e.abort();
|
|
3086
3305
|
}, [
|
|
3087
3306
|
g,
|
|
3088
3307
|
i,
|
|
3089
|
-
|
|
3090
|
-
]),
|
|
3091
|
-
|
|
3092
|
-
}, [
|
|
3093
|
-
let
|
|
3094
|
-
|
|
3095
|
-
if (!
|
|
3308
|
+
E?.collection_owner
|
|
3309
|
+
]), P.useEffect(() => {
|
|
3310
|
+
E && br(E) && pe.current?.(E);
|
|
3311
|
+
}, [E]);
|
|
3312
|
+
let B = E?.collection_owner === "engine" && E?.payment.status === "requires_action" && E.payment.next_action?.type === "solana_pay";
|
|
3313
|
+
P.useEffect(() => {
|
|
3314
|
+
if (!B || !E) return;
|
|
3096
3315
|
let e = window.setInterval(() => {
|
|
3097
|
-
g.confirmOrder(
|
|
3098
|
-
},
|
|
3316
|
+
g.confirmOrder(E.id).then((e) => D(e.order), () => void 0);
|
|
3317
|
+
}, xr);
|
|
3099
3318
|
return () => window.clearInterval(e);
|
|
3100
3319
|
}, [
|
|
3101
|
-
|
|
3320
|
+
B,
|
|
3102
3321
|
g,
|
|
3103
|
-
|
|
3322
|
+
E
|
|
3104
3323
|
]);
|
|
3105
|
-
let
|
|
3324
|
+
let V = P.useMemo(() => E?.collection_owner === "engine" ? E.payment_options : [], [E]), me = P.useMemo(() => (v?.payment.psps ?? []).filter((e) => V.some((t) => t.psp_id === e.psp_id)), [v, V]), he = ur(c, V, me), ge = V.filter((e) => !he.has(e.psp_id)), _e = me.filter((e) => !he.has(e.psp_id)), H = _e.filter((e) => {
|
|
3106
3325
|
let t = s(e);
|
|
3107
|
-
return (t === "collect_js" || t === "stripe_elements" ||
|
|
3108
|
-
}), ve = _e.filter((e) => a || s(e) !== "card"), ye =
|
|
3326
|
+
return (t === "collect_js" || t === "stripe_elements" || yr(e)) && ge.some((t) => t.psp_id === e.psp_id && t.accepts.includes("new_card"));
|
|
3327
|
+
}), ve = _e.filter((e) => a || s(e) !== "card"), ye = k.filter((e) => (e.status ?? "active") === "active" && e.reusable !== !1 && e.health?.active !== !1 && ve.some((t) => t.psp_id === e.psp_id || ge.some((n) => n.psp_id === t.psp_id && n.saved_payment_method_ids?.includes(e.id)))).map((e) => ({
|
|
3109
3328
|
id: e.id,
|
|
3110
3329
|
psp_id: e.psp_id ?? "",
|
|
3111
3330
|
rail: e.rail ?? "",
|
|
3112
3331
|
card: e.card ?? void 0
|
|
3113
|
-
})), W =
|
|
3114
|
-
if (!
|
|
3332
|
+
})), W = H.find((e) => e.psp_id === re) ?? H[0], G = ge.find((e) => e.accepts.includes("solana_pay")), K = _e.filter((e) => s(e) === null && ge.some((t) => t.psp_id === e.psp_id && t.accepts.includes("redirect"))), be = (e) => !!c && Object.keys(c).some((t) => t.toLowerCase() === e.key.toLowerCase()), xe = K.filter((e) => !be(e)), Se = K.filter(be), Ce = E?.lines.some((e) => e.billing_interval_hours !== null) ?? !1, we = G ? (v?.payment.solana?.tokens ?? []).filter((e) => !Ce || e.recurring_eligible === !0) : [], Te = o ? H.find((e) => s(e) === "stripe_elements" && !!e.config?.publishable_key) : void 0;
|
|
3333
|
+
if (!E) return M ? /* @__PURE__ */ F("p", {
|
|
3115
3334
|
role: "alert",
|
|
3116
3335
|
className: "text-sm text-destructive",
|
|
3117
3336
|
children: M
|
|
3118
|
-
}) : /* @__PURE__ */ F(
|
|
3119
|
-
let
|
|
3120
|
-
if (
|
|
3337
|
+
}) : /* @__PURE__ */ F(cr, {});
|
|
3338
|
+
let Ee = T[E.currency.toUpperCase()] ?? 2, De = (e) => d(e, E.currency, Ee), Oe = _?.currencies?.find((e) => e.code.toUpperCase() === E.currency.toUpperCase()), ke = Te && Oe?.minor_decimals != null ? f(E.total, Oe.decimals, Oe.minor_decimals) : null, Ae = async (e) => {
|
|
3339
|
+
if (D(e.order), e.error) return N(e.order.payment.last_payment_error?.message ?? e.error.message), de(crypto.randomUUID()), !1;
|
|
3121
3340
|
let t = e.order.payment.next_action;
|
|
3122
3341
|
if (e.order.collection_owner !== "engine" || e.order.payment.status !== "requires_action" || !t) return !0;
|
|
3123
3342
|
if (t.type === "redirect_to_url" && t.url) return window.location.assign(t.url), !0;
|
|
3124
3343
|
let n = t.payload?.client_secret, r = (v?.payment.psps.find((e) => e.psp_id === t.psp_id))?.config?.publishable_key;
|
|
3125
|
-
if (t.type !== "authenticate" || !n || !r) return
|
|
3344
|
+
if (t.type !== "authenticate" || !n || !r) return N(m.t("paymentMethods.unavailable")), !1;
|
|
3126
3345
|
if (fe.current && t.psp_id === W?.psp_id) await fe.current.handleNextAction(n);
|
|
3127
3346
|
else {
|
|
3128
|
-
let e = await (await
|
|
3347
|
+
let e = await (await Zt(r)).handleNextAction({ clientSecret: n });
|
|
3129
3348
|
if (e.error) throw Error(e.error.message);
|
|
3130
3349
|
}
|
|
3131
|
-
return
|
|
3132
|
-
},
|
|
3133
|
-
if (R ||
|
|
3134
|
-
oe(!0),
|
|
3350
|
+
return Ae(await g.confirmOrder(E.id));
|
|
3351
|
+
}, je = async (e, t = !1, r) => {
|
|
3352
|
+
if (R || E.collection_owner !== "engine" || z && !t) return !1;
|
|
3353
|
+
oe(!0), N(void 0);
|
|
3135
3354
|
try {
|
|
3136
|
-
return await
|
|
3355
|
+
return await Ae(await g.payOrder(E.id, {
|
|
3137
3356
|
payment: await e(),
|
|
3138
|
-
expectedTotal:
|
|
3357
|
+
expectedTotal: E.total,
|
|
3139
3358
|
idempotencyKey: ue,
|
|
3140
3359
|
...r === void 0 ? {} : { reusable: r }
|
|
3141
3360
|
}));
|
|
3142
3361
|
} catch (e) {
|
|
3143
|
-
|
|
3362
|
+
N(!n(e) && e instanceof Error && e.message ? e.message : m.error(e));
|
|
3144
3363
|
let r = n(e) && e.status === 400 && e.type === "invalid_request_error";
|
|
3145
3364
|
if (t && !r) throw e;
|
|
3146
3365
|
return de(crypto.randomUUID()), !1;
|
|
@@ -3148,97 +3367,97 @@ function ur({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3148
3367
|
oe(!1);
|
|
3149
3368
|
}
|
|
3150
3369
|
}, Me = async () => {
|
|
3151
|
-
if (!(R ||
|
|
3152
|
-
oe(!0),
|
|
3370
|
+
if (!(R || E.collection_owner !== "engine")) {
|
|
3371
|
+
oe(!0), N(void 0);
|
|
3153
3372
|
try {
|
|
3154
|
-
await
|
|
3373
|
+
await Ae({ order: E });
|
|
3155
3374
|
} catch (e) {
|
|
3156
|
-
|
|
3375
|
+
N(!n(e) && e instanceof Error && e.message ? e.message : m.error(e));
|
|
3157
3376
|
} finally {
|
|
3158
3377
|
oe(!1);
|
|
3159
3378
|
}
|
|
3160
3379
|
}
|
|
3161
|
-
},
|
|
3380
|
+
}, q = E.collection_owner === "engine" && E.status === "open" && E.payment.status === "requires_action" && E.payment.next_action?.type === "authenticate", Ne = E.collection_owner === "engine" && E.status === "open" && E.payment.status === "requires_action" && E.payment.next_action?.type === "redirect_to_url" && !!E.payment.next_action.url, Pe = v?.payment.psps.find((e) => e.psp_id === E.payment.next_action?.psp_id), Fe = Ce ? "Subscribe" : "Pay", J = v?.merchant, Ie = J?.terms_url || J?.privacy_url ? /* @__PURE__ */ I(ae, { children: [
|
|
3162
3381
|
"By ",
|
|
3163
|
-
|
|
3382
|
+
Ce ? "subscribing" : "paying",
|
|
3164
3383
|
", you agree to our",
|
|
3165
3384
|
" ",
|
|
3166
|
-
|
|
3167
|
-
href:
|
|
3385
|
+
J.terms_url ? /* @__PURE__ */ F("a", {
|
|
3386
|
+
href: J.terms_url,
|
|
3168
3387
|
target: "_blank",
|
|
3169
3388
|
rel: "noreferrer",
|
|
3170
3389
|
className: "underline",
|
|
3171
3390
|
children: "Terms of Service"
|
|
3172
3391
|
}) : null,
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
href:
|
|
3392
|
+
J.terms_url && J.privacy_url ? " and " : null,
|
|
3393
|
+
J.privacy_url ? /* @__PURE__ */ F("a", {
|
|
3394
|
+
href: J.privacy_url,
|
|
3176
3395
|
target: "_blank",
|
|
3177
3396
|
rel: "noreferrer",
|
|
3178
3397
|
className: "underline",
|
|
3179
3398
|
children: "Privacy Policy"
|
|
3180
3399
|
}) : null,
|
|
3181
3400
|
"."
|
|
3182
|
-
] }) : void 0, Y =
|
|
3401
|
+
] }) : void 0, Y = E.collection_owner === "engine" && (E.status === "open" || E.status === "uncollectible" && !!E.usage) && E.payment.status === "requires_payment_method";
|
|
3183
3402
|
return /* @__PURE__ */ I("div", {
|
|
3184
3403
|
className: L("orck grid gap-5", p),
|
|
3185
3404
|
"data-orck-theme": C(u),
|
|
3186
|
-
style:
|
|
3405
|
+
style: w(u),
|
|
3187
3406
|
children: [/* @__PURE__ */ I("div", {
|
|
3188
3407
|
className: "grid",
|
|
3189
3408
|
children: [
|
|
3190
|
-
|
|
3409
|
+
E.lines.map((e) => /* @__PURE__ */ I("div", {
|
|
3191
3410
|
className: "flex items-start justify-between gap-4 py-2 text-[13.5px]",
|
|
3192
3411
|
children: [/* @__PURE__ */ I("span", { children: [e.description, e.quantity && e.quantity > 1 ? ` × ${e.quantity}` : ""] }), /* @__PURE__ */ F("span", {
|
|
3193
3412
|
className: "whitespace-nowrap tabular-nums",
|
|
3194
|
-
children:
|
|
3413
|
+
children: De(e.amount)
|
|
3195
3414
|
})]
|
|
3196
3415
|
}, e.id)),
|
|
3197
3416
|
/* @__PURE__ */ I("div", {
|
|
3198
3417
|
className: "flex items-start justify-between gap-4 border-t border-border pt-3 text-[13.5px] font-semibold",
|
|
3199
3418
|
children: [/* @__PURE__ */ F("span", { children: "Total" }), /* @__PURE__ */ F("span", {
|
|
3200
3419
|
className: "whitespace-nowrap tabular-nums",
|
|
3201
|
-
children:
|
|
3420
|
+
children: De(E.total)
|
|
3202
3421
|
})]
|
|
3203
3422
|
}),
|
|
3204
|
-
|
|
3423
|
+
E.usage && E.usage.amount_paid !== "0" && /* @__PURE__ */ I("div", {
|
|
3205
3424
|
className: "flex items-start justify-between gap-4 pt-1 text-[13.5px]",
|
|
3206
3425
|
children: [/* @__PURE__ */ F("span", { children: "Due" }), /* @__PURE__ */ F("span", {
|
|
3207
3426
|
className: "whitespace-nowrap tabular-nums",
|
|
3208
|
-
children:
|
|
3427
|
+
children: De(E.usage.amount_due)
|
|
3209
3428
|
})]
|
|
3210
3429
|
})
|
|
3211
3430
|
]
|
|
3212
|
-
}),
|
|
3213
|
-
amountLabel: `${
|
|
3214
|
-
payload:
|
|
3431
|
+
}), B ? /* @__PURE__ */ F(nr, {
|
|
3432
|
+
amountLabel: `${E.payment.next_action?.payload?.token_amount ?? ""} ${E.payment.next_action?.payload?.token_symbol ?? ""}`.trim(),
|
|
3433
|
+
payload: E.payment.next_action?.url ?? void 0,
|
|
3215
3434
|
statusLine: "Waiting for your wallet's payment"
|
|
3216
|
-
}) :
|
|
3435
|
+
}) : E.status === "complete" ? /* @__PURE__ */ F("p", {
|
|
3217
3436
|
role: "status",
|
|
3218
3437
|
className: "text-sm font-semibold",
|
|
3219
3438
|
children: "Payment complete"
|
|
3220
|
-
}) :
|
|
3439
|
+
}) : E.collection_owner === "engine" ? E.status === "processing" ? /* @__PURE__ */ F("p", {
|
|
3221
3440
|
role: "status",
|
|
3222
3441
|
className: "text-sm text-muted-foreground",
|
|
3223
3442
|
children: "Your payment is processing."
|
|
3224
|
-
}) :
|
|
3443
|
+
}) : E.status === "open" ? Ne ? /* @__PURE__ */ I("form", {
|
|
3225
3444
|
className: "grid gap-4",
|
|
3226
3445
|
onSubmit: (e) => {
|
|
3227
|
-
e.preventDefault(), window.location.assign(
|
|
3446
|
+
e.preventDefault(), window.location.assign(E.payment.next_action.url);
|
|
3228
3447
|
},
|
|
3229
3448
|
children: [/* @__PURE__ */ I("p", {
|
|
3230
3449
|
className: "text-sm text-muted-foreground",
|
|
3231
3450
|
children: [
|
|
3232
3451
|
"Your payment is waiting on",
|
|
3233
3452
|
" ",
|
|
3234
|
-
|
|
3453
|
+
Pe?.display_name ?? "the payment page",
|
|
3235
3454
|
"."
|
|
3236
3455
|
]
|
|
3237
|
-
}), /* @__PURE__ */ F(
|
|
3238
|
-
label: `Continue to ${
|
|
3456
|
+
}), /* @__PURE__ */ F($, {
|
|
3457
|
+
label: `Continue to ${Pe?.display_name ?? "the payment page"}`,
|
|
3239
3458
|
processing: !1
|
|
3240
3459
|
})]
|
|
3241
|
-
}) :
|
|
3460
|
+
}) : q ? /* @__PURE__ */ I("form", {
|
|
3242
3461
|
className: "grid gap-4",
|
|
3243
3462
|
onSubmit: (e) => {
|
|
3244
3463
|
e.preventDefault(), Me();
|
|
@@ -3248,7 +3467,7 @@ function ur({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3248
3467
|
className: "text-sm text-muted-foreground",
|
|
3249
3468
|
children: "Your bank asks you to confirm this payment."
|
|
3250
3469
|
}),
|
|
3251
|
-
/* @__PURE__ */ F(
|
|
3470
|
+
/* @__PURE__ */ F($, {
|
|
3252
3471
|
label: "Confirm payment",
|
|
3253
3472
|
processing: R
|
|
3254
3473
|
}),
|
|
@@ -3261,84 +3480,84 @@ function ur({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3261
3480
|
}) : /* @__PURE__ */ I("div", {
|
|
3262
3481
|
className: "grid gap-4",
|
|
3263
3482
|
children: [
|
|
3264
|
-
!z &&
|
|
3265
|
-
publishableKey:
|
|
3266
|
-
amount:
|
|
3267
|
-
currency:
|
|
3483
|
+
!z && Te && ke ? /* @__PURE__ */ F(lr, {
|
|
3484
|
+
publishableKey: Te.config.publishable_key,
|
|
3485
|
+
amount: ke,
|
|
3486
|
+
currency: E.currency,
|
|
3268
3487
|
onAvailable: le,
|
|
3269
|
-
onPaymentMethod: (e) =>
|
|
3488
|
+
onPaymentMethod: (e) => je(async () => ({
|
|
3270
3489
|
token: e,
|
|
3271
|
-
psp_id:
|
|
3490
|
+
psp_id: Te.psp_id
|
|
3272
3491
|
}))
|
|
3273
3492
|
}) : null,
|
|
3274
|
-
!z && ce &&
|
|
3493
|
+
!z && ce && Te && ke ? /* @__PURE__ */ F("p", {
|
|
3275
3494
|
className: "text-center text-[13px] text-muted-foreground",
|
|
3276
3495
|
children: "or pay another way"
|
|
3277
3496
|
}) : null,
|
|
3278
|
-
ye.length > 0 ? /* @__PURE__ */ F(
|
|
3497
|
+
ye.length > 0 ? /* @__PURE__ */ F(sr, {
|
|
3279
3498
|
methods: ye,
|
|
3280
|
-
value:
|
|
3499
|
+
value: A,
|
|
3281
3500
|
onChange: ne,
|
|
3282
3501
|
disabled: R || !Y || !!z,
|
|
3283
|
-
idPrefix: `orck-order-${
|
|
3502
|
+
idPrefix: `orck-order-${E.id}`
|
|
3284
3503
|
}) : null,
|
|
3285
|
-
|
|
3504
|
+
A === "new" ? W ? /* @__PURE__ */ I(ae, { children: [H.length > 1 ? /* @__PURE__ */ F("select", {
|
|
3286
3505
|
"aria-label": "Pay with",
|
|
3287
3506
|
className: "h-9 rounded-md border border-border bg-transparent px-2 text-sm",
|
|
3288
3507
|
value: W.psp_id,
|
|
3289
3508
|
onChange: (e) => ie(e.target.value),
|
|
3290
|
-
children:
|
|
3509
|
+
children: H.map((e) => /* @__PURE__ */ F("option", {
|
|
3291
3510
|
value: e.psp_id,
|
|
3292
3511
|
children: e.display_name
|
|
3293
3512
|
}, e.psp_id))
|
|
3294
|
-
}) : null,
|
|
3513
|
+
}) : null, yr(W) ? /* @__PURE__ */ F(Yt, {
|
|
3295
3514
|
publicKey: W.config.public_api_key,
|
|
3296
|
-
submitLabel:
|
|
3515
|
+
submitLabel: Fe,
|
|
3297
3516
|
disabled: R || !Y,
|
|
3298
|
-
onTokenized: (e) =>
|
|
3517
|
+
onTokenized: (e) => je(async () => ({
|
|
3299
3518
|
token: e.payment_token,
|
|
3300
3519
|
psp_id: W.psp_id,
|
|
3301
|
-
billing_details:
|
|
3520
|
+
billing_details: kt(e)
|
|
3302
3521
|
}), !0)
|
|
3303
|
-
}, W.psp_id) : s(W) === "collect_js" ? /* @__PURE__ */ F(
|
|
3522
|
+
}, W.psp_id) : s(W) === "collect_js" ? /* @__PURE__ */ F(Cn, {
|
|
3304
3523
|
tokenizationKey: W.config.tokenization_key,
|
|
3305
3524
|
tokenizationURL: W.config.tokenization_url,
|
|
3306
|
-
submitLabel:
|
|
3525
|
+
submitLabel: Fe,
|
|
3307
3526
|
disabled: R || !Y,
|
|
3308
3527
|
appearance: u,
|
|
3309
3528
|
defaultCountry: v?.client_country || void 0,
|
|
3310
|
-
saveOptInMerchant:
|
|
3311
|
-
terms:
|
|
3312
|
-
statementDescriptor:
|
|
3313
|
-
onTokenized: (e) =>
|
|
3529
|
+
saveOptInMerchant: Ce ? void 0 : J?.display_name,
|
|
3530
|
+
terms: Ie,
|
|
3531
|
+
statementDescriptor: J?.statement_descriptor ?? void 0,
|
|
3532
|
+
onTokenized: (e) => je(async () => ({
|
|
3314
3533
|
token: e.payment_token,
|
|
3315
3534
|
psp_id: W.psp_id,
|
|
3316
|
-
billing_details:
|
|
3535
|
+
billing_details: kt(e)
|
|
3317
3536
|
}), !1, e.reusable)
|
|
3318
3537
|
}, W.psp_id) : /* @__PURE__ */ I("form", {
|
|
3319
3538
|
className: "grid gap-4",
|
|
3320
3539
|
onSubmit: (e) => {
|
|
3321
|
-
e.preventDefault(),
|
|
3540
|
+
e.preventDefault(), je(async () => ({
|
|
3322
3541
|
token: await fe.current.tokenize(),
|
|
3323
3542
|
psp_id: W.psp_id
|
|
3324
3543
|
}));
|
|
3325
3544
|
},
|
|
3326
3545
|
children: [
|
|
3327
|
-
/* @__PURE__ */ F(
|
|
3546
|
+
/* @__PURE__ */ F(dn, {
|
|
3328
3547
|
ref: fe,
|
|
3329
3548
|
psp: W,
|
|
3330
3549
|
client: g,
|
|
3331
3550
|
unavailableMessage: m.t("paymentMethods.unavailable"),
|
|
3332
3551
|
verificationPendingMessage: m.t("paymentMethods.verificationPending")
|
|
3333
3552
|
}, W.psp_id),
|
|
3334
|
-
/* @__PURE__ */ F(
|
|
3335
|
-
label:
|
|
3553
|
+
/* @__PURE__ */ F($, {
|
|
3554
|
+
label: Fe,
|
|
3336
3555
|
processing: R,
|
|
3337
3556
|
disabled: !Y
|
|
3338
3557
|
}),
|
|
3339
|
-
/* @__PURE__ */ F(
|
|
3558
|
+
/* @__PURE__ */ F(Jt, {})
|
|
3340
3559
|
]
|
|
3341
|
-
})] }) : G ||
|
|
3560
|
+
})] }) : G || xe.length > 0 || Se.length > 0 ? null : v ? /* @__PURE__ */ F("p", {
|
|
3342
3561
|
role: "alert",
|
|
3343
3562
|
className: "text-sm text-destructive",
|
|
3344
3563
|
children: m.t("paymentMethods.unavailable")
|
|
@@ -3348,7 +3567,7 @@ function ur({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3348
3567
|
children: [/* @__PURE__ */ F("p", {
|
|
3349
3568
|
className: "text-destructive",
|
|
3350
3569
|
children: m.error(b)
|
|
3351
|
-
}), /* @__PURE__ */ F(
|
|
3570
|
+
}), /* @__PURE__ */ F(U, {
|
|
3352
3571
|
type: "button",
|
|
3353
3572
|
variant: "outline",
|
|
3354
3573
|
size: "sm",
|
|
@@ -3362,51 +3581,51 @@ function ur({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3362
3581
|
className: "grid gap-4",
|
|
3363
3582
|
onSubmit: (e) => {
|
|
3364
3583
|
e.preventDefault();
|
|
3365
|
-
let t = z ??
|
|
3366
|
-
|
|
3584
|
+
let t = z ?? A, n = ge.some((e) => e.saved_payment_method_ids?.includes(t));
|
|
3585
|
+
je(async () => ({ payment_method_id: t }), n).then(() => se(void 0)).catch(() => se(t));
|
|
3367
3586
|
},
|
|
3368
|
-
children: /* @__PURE__ */ F(
|
|
3369
|
-
label: z ? "Retry payment" :
|
|
3587
|
+
children: /* @__PURE__ */ F($, {
|
|
3588
|
+
label: z ? "Retry payment" : Fe,
|
|
3370
3589
|
processing: R,
|
|
3371
3590
|
disabled: !Y
|
|
3372
3591
|
})
|
|
3373
3592
|
}),
|
|
3374
|
-
|
|
3593
|
+
xe.map((e) => /* @__PURE__ */ F("form", {
|
|
3375
3594
|
onSubmit: (t) => {
|
|
3376
|
-
t.preventDefault(),
|
|
3595
|
+
t.preventDefault(), je(async () => ({
|
|
3377
3596
|
return_url: r ?? window.location.href,
|
|
3378
3597
|
psp_id: e.psp_id
|
|
3379
3598
|
}));
|
|
3380
3599
|
},
|
|
3381
|
-
children: /* @__PURE__ */ F(
|
|
3382
|
-
label: `${
|
|
3600
|
+
children: /* @__PURE__ */ F($, {
|
|
3601
|
+
label: `${Fe} with ${e.display_name}`,
|
|
3383
3602
|
processing: R,
|
|
3384
3603
|
disabled: !Y || !!z
|
|
3385
3604
|
})
|
|
3386
3605
|
}, e.psp_id)),
|
|
3387
|
-
|
|
3606
|
+
Se.length > 0 ? /* @__PURE__ */ I("div", {
|
|
3388
3607
|
className: "grid gap-2 border-t border-border pt-4",
|
|
3389
3608
|
children: [/* @__PURE__ */ F("p", {
|
|
3390
3609
|
className: "text-[13px] text-muted-foreground",
|
|
3391
3610
|
children: "Card payment isn't working?"
|
|
3392
|
-
}),
|
|
3611
|
+
}), Se.map((e) => /* @__PURE__ */ I("button", {
|
|
3393
3612
|
type: "button",
|
|
3394
3613
|
className: "h-9 rounded-md border border-border text-sm",
|
|
3395
3614
|
disabled: R || !Y || !!z,
|
|
3396
|
-
onClick: () => void
|
|
3615
|
+
onClick: () => void je(async () => ({
|
|
3397
3616
|
return_url: r ?? window.location.href,
|
|
3398
3617
|
psp_id: e.psp_id
|
|
3399
3618
|
})),
|
|
3400
3619
|
children: ["Pay with ", e.display_name]
|
|
3401
3620
|
}, e.psp_id))]
|
|
3402
3621
|
}) : null,
|
|
3403
|
-
G &&
|
|
3622
|
+
G && we.length > 0 ? /* @__PURE__ */ F("div", {
|
|
3404
3623
|
className: "grid gap-2 border-t border-border pt-4",
|
|
3405
|
-
children:
|
|
3624
|
+
children: we.map((e) => /* @__PURE__ */ I("button", {
|
|
3406
3625
|
type: "button",
|
|
3407
3626
|
className: "h-9 rounded-md border border-border text-sm",
|
|
3408
3627
|
disabled: R || !Y || !!z,
|
|
3409
|
-
onClick: () => void
|
|
3628
|
+
onClick: () => void je(async () => ({
|
|
3410
3629
|
token_symbol: e.symbol,
|
|
3411
3630
|
psp_id: G.psp_id
|
|
3412
3631
|
})),
|
|
@@ -3436,17 +3655,17 @@ function ur({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3436
3655
|
}
|
|
3437
3656
|
//#endregion
|
|
3438
3657
|
//#region src/embedded-payment.tsx
|
|
3439
|
-
var
|
|
3440
|
-
function
|
|
3441
|
-
let o =
|
|
3442
|
-
|
|
3658
|
+
var Cr = "openrails.payment.complete", wr = "openrails.payment.resize", Tr = 12e3;
|
|
3659
|
+
function Er({ url: e, onComplete: t, fallbacks: n, onLoadFailure: r, title: i = "Payment", className: a }) {
|
|
3660
|
+
let o = P.useRef(null), [s, c] = P.useState(), [l, u] = P.useState(0), [d, f] = P.useState(!1), [p, m] = P.useState(!1), h = P.useRef(!1), g = P.useRef(r);
|
|
3661
|
+
P.useEffect(() => {
|
|
3443
3662
|
g.current = r;
|
|
3444
3663
|
});
|
|
3445
|
-
let _ =
|
|
3446
|
-
|
|
3664
|
+
let _ = P.useRef(t);
|
|
3665
|
+
P.useEffect(() => {
|
|
3447
3666
|
_.current = t;
|
|
3448
3667
|
});
|
|
3449
|
-
let v =
|
|
3668
|
+
let v = P.useMemo(() => {
|
|
3450
3669
|
try {
|
|
3451
3670
|
let t = new URL(e);
|
|
3452
3671
|
return t.protocol === "https:" || t.protocol === "http:" ? t.origin : null;
|
|
@@ -3454,7 +3673,7 @@ function mr({ url: e, onComplete: t, fallbacks: n, onLoadFailure: r, title: i =
|
|
|
3454
3673
|
return null;
|
|
3455
3674
|
}
|
|
3456
3675
|
}, [e]);
|
|
3457
|
-
return
|
|
3676
|
+
return P.useEffect(() => {
|
|
3458
3677
|
if (!v) return;
|
|
3459
3678
|
let e = !1, t = (t) => {
|
|
3460
3679
|
if (t.origin !== v || !o.current || t.source !== o.current.contentWindow) return;
|
|
@@ -3475,11 +3694,11 @@ function mr({ url: e, onComplete: t, fallbacks: n, onLoadFailure: r, title: i =
|
|
|
3475
3694
|
}) : /^https?:\/\//i.test(i) && window.location.assign(i);
|
|
3476
3695
|
};
|
|
3477
3696
|
return window.addEventListener("message", t), () => window.removeEventListener("message", t);
|
|
3478
|
-
}, [v]),
|
|
3697
|
+
}, [v]), P.useEffect(() => {
|
|
3479
3698
|
if (!v || d || p) return;
|
|
3480
3699
|
let e = window.setTimeout(() => {
|
|
3481
3700
|
m(!0), h.current || (h.current = !0, g.current?.());
|
|
3482
|
-
},
|
|
3701
|
+
}, Tr);
|
|
3483
3702
|
return () => window.clearTimeout(e);
|
|
3484
3703
|
}, [
|
|
3485
3704
|
v,
|
|
@@ -3507,12 +3726,12 @@ function mr({ url: e, onComplete: t, fallbacks: n, onLoadFailure: r, title: i =
|
|
|
3507
3726
|
children: "Try again"
|
|
3508
3727
|
})
|
|
3509
3728
|
]
|
|
3510
|
-
}) : /* @__PURE__ */ I(
|
|
3729
|
+
}) : /* @__PURE__ */ I(ae, { children: [d ? null : /* @__PURE__ */ F("p", {
|
|
3511
3730
|
className: "p-6 text-center text-sm text-muted-foreground",
|
|
3512
3731
|
children: "Loading secure payment page…"
|
|
3513
3732
|
}), /* @__PURE__ */ F("iframe", {
|
|
3514
3733
|
ref: o,
|
|
3515
|
-
src:
|
|
3734
|
+
src: _r(e, n),
|
|
3516
3735
|
title: i,
|
|
3517
3736
|
className: a,
|
|
3518
3737
|
scrolling: "no",
|
|
@@ -3527,15 +3746,15 @@ function mr({ url: e, onComplete: t, fallbacks: n, onLoadFailure: r, title: i =
|
|
|
3527
3746
|
}
|
|
3528
3747
|
//#endregion
|
|
3529
3748
|
//#region src/cart.tsx
|
|
3530
|
-
function
|
|
3531
|
-
let o =
|
|
3532
|
-
|
|
3749
|
+
function Dr({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i, className: a }) {
|
|
3750
|
+
let o = y(), s = j(), c = e ?? s.client, l = te(), [u, f] = P.useState(), [p, m] = P.useState(), [h, g] = P.useState(), [_, v] = P.useState(!1), [b, x] = P.useState(() => crypto.randomUUID());
|
|
3751
|
+
P.useEffect(() => {
|
|
3533
3752
|
let e = new AbortController();
|
|
3534
3753
|
return c.getCart(e.signal).then(f, (t) => {
|
|
3535
3754
|
e.signal.aborted || g(o.error(t));
|
|
3536
3755
|
}), () => e.abort();
|
|
3537
3756
|
}, [c, o]);
|
|
3538
|
-
let
|
|
3757
|
+
let S = async (e) => {
|
|
3539
3758
|
if (!_) {
|
|
3540
3759
|
v(!0), g(void 0);
|
|
3541
3760
|
try {
|
|
@@ -3547,7 +3766,7 @@ function hr({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i,
|
|
|
3547
3766
|
}
|
|
3548
3767
|
}
|
|
3549
3768
|
};
|
|
3550
|
-
if (p && !t) return /* @__PURE__ */ F(
|
|
3769
|
+
if (p && !t) return /* @__PURE__ */ F(Sr, {
|
|
3551
3770
|
orderId: p.id,
|
|
3552
3771
|
client: c,
|
|
3553
3772
|
onSettled: n,
|
|
@@ -3559,14 +3778,14 @@ function hr({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i,
|
|
|
3559
3778
|
role: "alert",
|
|
3560
3779
|
className: "text-sm text-destructive",
|
|
3561
3780
|
children: h
|
|
3562
|
-
}) : /* @__PURE__ */ F(
|
|
3563
|
-
let
|
|
3564
|
-
f(await c.setCartLine(e, { quantity: 0 })),
|
|
3565
|
-
}),
|
|
3781
|
+
}) : /* @__PURE__ */ F(cr, {});
|
|
3782
|
+
let T = l[u.currency.toUpperCase()] ?? 2, E = (e) => d(e, u.currency, T), D = u.lines.length > 0 && u.lines.every((e) => !e.refusal), O = (e) => S(async () => {
|
|
3783
|
+
f(await c.setCartLine(e, { quantity: 0 })), x(crypto.randomUUID());
|
|
3784
|
+
}), k = () => S(async () => {
|
|
3566
3785
|
let e = await c.createOrder({
|
|
3567
3786
|
cart: !0,
|
|
3568
3787
|
expectedTotal: u.total,
|
|
3569
|
-
idempotencyKey:
|
|
3788
|
+
idempotencyKey: b
|
|
3570
3789
|
});
|
|
3571
3790
|
if (e.error) throw e.error;
|
|
3572
3791
|
m(e.order), t?.(e.order);
|
|
@@ -3574,7 +3793,7 @@ function hr({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i,
|
|
|
3574
3793
|
return /* @__PURE__ */ I("div", {
|
|
3575
3794
|
className: L("orck grid gap-5", a),
|
|
3576
3795
|
"data-orck-theme": C(i),
|
|
3577
|
-
style:
|
|
3796
|
+
style: w(i),
|
|
3578
3797
|
children: [
|
|
3579
3798
|
u.lines.length === 0 ? /* @__PURE__ */ F("p", {
|
|
3580
3799
|
role: "status",
|
|
@@ -3589,7 +3808,7 @@ function hr({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i,
|
|
|
3589
3808
|
className: "flex items-start justify-between gap-4",
|
|
3590
3809
|
children: [/* @__PURE__ */ F("span", { children: e.description || e.price_id }), /* @__PURE__ */ F("span", {
|
|
3591
3810
|
className: "whitespace-nowrap tabular-nums",
|
|
3592
|
-
children:
|
|
3811
|
+
children: E(e.amount)
|
|
3593
3812
|
})]
|
|
3594
3813
|
}),
|
|
3595
3814
|
/* @__PURE__ */ I("div", {
|
|
@@ -3601,7 +3820,7 @@ function hr({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i,
|
|
|
3601
3820
|
type: "button",
|
|
3602
3821
|
className: "text-[13px] text-muted-foreground underline",
|
|
3603
3822
|
disabled: _,
|
|
3604
|
-
onClick: () => void
|
|
3823
|
+
onClick: () => void O(e.price_id),
|
|
3605
3824
|
children: "Remove"
|
|
3606
3825
|
})]
|
|
3607
3826
|
}),
|
|
@@ -3614,24 +3833,24 @@ function hr({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i,
|
|
|
3614
3833
|
className: "flex items-start justify-between gap-4 pt-3 text-[13.5px] font-semibold",
|
|
3615
3834
|
children: [/* @__PURE__ */ F("span", { children: "Total" }), /* @__PURE__ */ F("span", {
|
|
3616
3835
|
className: "whitespace-nowrap tabular-nums",
|
|
3617
|
-
children:
|
|
3836
|
+
children: E(u.total)
|
|
3618
3837
|
})]
|
|
3619
3838
|
})]
|
|
3620
3839
|
}),
|
|
3621
3840
|
u.lines.length > 0 ? /* @__PURE__ */ I("form", {
|
|
3622
3841
|
className: "grid gap-2",
|
|
3623
3842
|
onSubmit: (e) => {
|
|
3624
|
-
e.preventDefault(),
|
|
3843
|
+
e.preventDefault(), k();
|
|
3625
3844
|
},
|
|
3626
|
-
children: [/* @__PURE__ */ F(
|
|
3845
|
+
children: [/* @__PURE__ */ F($, {
|
|
3627
3846
|
label: "Check out",
|
|
3628
3847
|
processing: _,
|
|
3629
|
-
disabled: !
|
|
3848
|
+
disabled: !D
|
|
3630
3849
|
}), /* @__PURE__ */ F("button", {
|
|
3631
3850
|
type: "button",
|
|
3632
3851
|
className: "text-[13px] text-muted-foreground underline",
|
|
3633
3852
|
disabled: _,
|
|
3634
|
-
onClick: () => void
|
|
3853
|
+
onClick: () => void S(async () => {
|
|
3635
3854
|
await c.clearCart(), f(await c.getCart());
|
|
3636
3855
|
}),
|
|
3637
3856
|
children: "Empty cart"
|
|
@@ -3646,23 +3865,14 @@ function hr({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i,
|
|
|
3646
3865
|
});
|
|
3647
3866
|
}
|
|
3648
3867
|
//#endregion
|
|
3649
|
-
//#region src/authenticate.ts
|
|
3650
|
-
async function gr(e, t, n, r) {
|
|
3651
|
-
let i = n.next_action, o = i?.payload?.client_secret;
|
|
3652
|
-
if (n.status !== "requires_action" || i?.type !== "authenticate" || !o || !a(r)) return n;
|
|
3653
|
-
let s = await (await Xt(r.config.publishable_key)).handleNextAction({ clientSecret: o });
|
|
3654
|
-
if (s.error) throw Error(s.error.message ?? "Authentication failed.");
|
|
3655
|
-
return e.confirmSubscriptionChange(t);
|
|
3656
|
-
}
|
|
3657
|
-
//#endregion
|
|
3658
3868
|
//#region src/lib/price-label.ts
|
|
3659
|
-
function
|
|
3660
|
-
let i =
|
|
3869
|
+
function Or(e, t, n, r) {
|
|
3870
|
+
let i = K(e.unit_amount, e.currency, t, r) ?? `${e.unit_amount} ${e.currency}`, a = ve(e.billing_interval_hours);
|
|
3661
3871
|
if (a) return n.t("products.recurring", {
|
|
3662
3872
|
amount: i,
|
|
3663
3873
|
every: n.plural(`interval.every.${a.unit}`, a.count)
|
|
3664
3874
|
});
|
|
3665
|
-
let o =
|
|
3875
|
+
let o = ve(e.access_duration_hours);
|
|
3666
3876
|
return o ? n.t("products.rent", {
|
|
3667
3877
|
amount: i,
|
|
3668
3878
|
period: n.plural(`interval.duration.${o.unit}`, o.count)
|
|
@@ -3670,21 +3880,21 @@ function _r(e, t, n, r) {
|
|
|
3670
3880
|
}
|
|
3671
3881
|
//#endregion
|
|
3672
3882
|
//#region src/modal.tsx
|
|
3673
|
-
function
|
|
3674
|
-
return /* @__PURE__ */ F(
|
|
3883
|
+
function kr({ open: e, onOpenChange: t, appearance: n, children: r }) {
|
|
3884
|
+
return /* @__PURE__ */ F(ut, {
|
|
3675
3885
|
open: e,
|
|
3676
3886
|
onOpenChange: t,
|
|
3677
|
-
children: /* @__PURE__ */ I(
|
|
3887
|
+
children: /* @__PURE__ */ I(pt, {
|
|
3678
3888
|
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",
|
|
3679
3889
|
"data-orck-theme": C(n),
|
|
3680
|
-
style:
|
|
3890
|
+
style: w(n),
|
|
3681
3891
|
showCloseButton: !0,
|
|
3682
3892
|
children: [
|
|
3683
|
-
/* @__PURE__ */ F(
|
|
3893
|
+
/* @__PURE__ */ F(gt, {
|
|
3684
3894
|
className: "sr-only",
|
|
3685
3895
|
children: "Payment"
|
|
3686
3896
|
}),
|
|
3687
|
-
/* @__PURE__ */ F(
|
|
3897
|
+
/* @__PURE__ */ F(_t, {
|
|
3688
3898
|
className: "sr-only",
|
|
3689
3899
|
children: "Complete your payment"
|
|
3690
3900
|
}),
|
|
@@ -3696,38 +3906,38 @@ function vr({ open: e, onOpenChange: t, appearance: n, children: r }) {
|
|
|
3696
3906
|
})
|
|
3697
3907
|
});
|
|
3698
3908
|
}
|
|
3699
|
-
function
|
|
3700
|
-
return /* @__PURE__ */ F(
|
|
3909
|
+
function Ar({ open: e, onOpenChange: t, ...n }) {
|
|
3910
|
+
return /* @__PURE__ */ F(kr, {
|
|
3701
3911
|
open: e,
|
|
3702
3912
|
onOpenChange: t,
|
|
3703
3913
|
appearance: n.appearance,
|
|
3704
|
-
children: /* @__PURE__ */ F(
|
|
3914
|
+
children: /* @__PURE__ */ F(Sr, { ...n })
|
|
3705
3915
|
});
|
|
3706
3916
|
}
|
|
3707
|
-
function
|
|
3708
|
-
return /* @__PURE__ */ F(
|
|
3917
|
+
function jr({ open: e, onOpenChange: t, appearance: n, ...r }) {
|
|
3918
|
+
return /* @__PURE__ */ F(kr, {
|
|
3709
3919
|
open: e,
|
|
3710
3920
|
onOpenChange: t,
|
|
3711
3921
|
appearance: n,
|
|
3712
|
-
children: /* @__PURE__ */ F(
|
|
3922
|
+
children: /* @__PURE__ */ F(Er, { ...r })
|
|
3713
3923
|
});
|
|
3714
3924
|
}
|
|
3715
3925
|
//#endregion
|
|
3716
3926
|
//#region src/buy-button.tsx
|
|
3717
|
-
function
|
|
3927
|
+
function Mr(e) {
|
|
3718
3928
|
if (!n(e) || e.code !== "already_owned") return;
|
|
3719
3929
|
let t = e.metadata.owned_by;
|
|
3720
3930
|
return typeof t == "string" && t.startsWith("ord_") ? t : void 0;
|
|
3721
3931
|
}
|
|
3722
|
-
var
|
|
3723
|
-
function
|
|
3724
|
-
let p =
|
|
3725
|
-
e.status === "complete" && (
|
|
3726
|
-
},
|
|
3932
|
+
var Nr = (e) => typeof window < "u" && e.includes(window.location.origin);
|
|
3933
|
+
function Pr({ price: t, label: i, amount: a, returnUrl: o, fallbacks: s, onPaid: c, onSignInRequired: l, signedIn: u, appearance: d, className: f }) {
|
|
3934
|
+
let p = y(), { locale: m } = E(), h = te(), g = k(d), { client: _ } = j(), [v, b] = P.useState(), [x, S] = P.useState(!1), [C, w] = P.useState(), T = (e) => {
|
|
3935
|
+
e.status === "complete" && (b(void 0), c(e));
|
|
3936
|
+
}, D = async () => {
|
|
3727
3937
|
if (u === !1) return l();
|
|
3728
|
-
|
|
3938
|
+
w(void 0), S(!0);
|
|
3729
3939
|
try {
|
|
3730
|
-
let { merchant: e } = await _.getCustomerConfig(), n =
|
|
3940
|
+
let { merchant: e } = await _.getCustomerConfig(), n = Nr(e.embed_origins), i;
|
|
3731
3941
|
try {
|
|
3732
3942
|
({order: i} = await _.createOrder({
|
|
3733
3943
|
lines: [{
|
|
@@ -3737,17 +3947,17 @@ function Cr({ price: t, label: i, amount: a, returnUrl: o, fallbacks: s, onPaid:
|
|
|
3737
3947
|
...n ? { payUrl: { embedded: !0 } } : {}
|
|
3738
3948
|
}));
|
|
3739
3949
|
} catch (e) {
|
|
3740
|
-
let t =
|
|
3950
|
+
let t = Mr(e);
|
|
3741
3951
|
if (!t || n) throw e;
|
|
3742
|
-
|
|
3952
|
+
b({
|
|
3743
3953
|
kind: "inline",
|
|
3744
3954
|
orderId: t
|
|
3745
3955
|
});
|
|
3746
3956
|
return;
|
|
3747
3957
|
}
|
|
3748
|
-
if (i.status === "complete") return
|
|
3958
|
+
if (i.status === "complete") return T(i);
|
|
3749
3959
|
if (!n) {
|
|
3750
|
-
|
|
3960
|
+
b({
|
|
3751
3961
|
kind: "inline",
|
|
3752
3962
|
orderId: i.id
|
|
3753
3963
|
});
|
|
@@ -3755,17 +3965,17 @@ function Cr({ price: t, label: i, amount: a, returnUrl: o, fallbacks: s, onPaid:
|
|
|
3755
3965
|
}
|
|
3756
3966
|
let o = i.pay_url;
|
|
3757
3967
|
if (!o) throw r("invalid_response", "the order answered no pay URL");
|
|
3758
|
-
|
|
3968
|
+
b({
|
|
3759
3969
|
kind: "embedded",
|
|
3760
3970
|
orderId: i.id,
|
|
3761
3971
|
url: o
|
|
3762
3972
|
});
|
|
3763
3973
|
} catch (t) {
|
|
3764
|
-
n(t) && t.status === 401 ? l() :
|
|
3974
|
+
n(t) && t.status === 401 ? l() : w(p.error(e(t)));
|
|
3765
3975
|
} finally {
|
|
3766
|
-
|
|
3976
|
+
S(!1);
|
|
3767
3977
|
}
|
|
3768
|
-
},
|
|
3978
|
+
}, O = (e) => !e && b(void 0);
|
|
3769
3979
|
return /* @__PURE__ */ I("span", {
|
|
3770
3980
|
className: L(g.className, "inline-flex flex-col gap-1", f),
|
|
3771
3981
|
"data-orck-theme": g["data-orck-theme"],
|
|
@@ -3774,32 +3984,32 @@ function Cr({ price: t, label: i, amount: a, returnUrl: o, fallbacks: s, onPaid:
|
|
|
3774
3984
|
containerType: "normal"
|
|
3775
3985
|
},
|
|
3776
3986
|
children: [
|
|
3777
|
-
/* @__PURE__ */ F(
|
|
3778
|
-
disabled:
|
|
3779
|
-
onClick: () => void
|
|
3780
|
-
children: i ??
|
|
3987
|
+
/* @__PURE__ */ F(U, {
|
|
3988
|
+
disabled: x,
|
|
3989
|
+
onClick: () => void D(),
|
|
3990
|
+
children: i ?? Or(t, h, p, m)
|
|
3781
3991
|
}),
|
|
3782
|
-
|
|
3992
|
+
C ? /* @__PURE__ */ F("span", {
|
|
3783
3993
|
role: "alert",
|
|
3784
3994
|
className: "text-sm text-destructive",
|
|
3785
|
-
children:
|
|
3995
|
+
children: C
|
|
3786
3996
|
}) : null,
|
|
3787
|
-
v?.kind === "inline" ? /* @__PURE__ */ F(
|
|
3997
|
+
v?.kind === "inline" ? /* @__PURE__ */ F(Ar, {
|
|
3788
3998
|
open: !0,
|
|
3789
|
-
onOpenChange:
|
|
3999
|
+
onOpenChange: O,
|
|
3790
4000
|
orderId: v.orderId,
|
|
3791
4001
|
returnUrl: o,
|
|
3792
4002
|
fallbacks: s,
|
|
3793
4003
|
appearance: d,
|
|
3794
|
-
onSettled:
|
|
4004
|
+
onSettled: T
|
|
3795
4005
|
}) : null,
|
|
3796
|
-
v?.kind === "embedded" ? /* @__PURE__ */ F(
|
|
4006
|
+
v?.kind === "embedded" ? /* @__PURE__ */ F(jr, {
|
|
3797
4007
|
open: !0,
|
|
3798
|
-
onOpenChange:
|
|
4008
|
+
onOpenChange: O,
|
|
3799
4009
|
url: v.url,
|
|
3800
4010
|
fallbacks: s,
|
|
3801
4011
|
appearance: d,
|
|
3802
|
-
onComplete: () => void _.getOrder(v.orderId).then(
|
|
4012
|
+
onComplete: () => void _.getOrder(v.orderId).then(T, () => void 0),
|
|
3803
4013
|
onLoadFailure: () => void _.reportPayURLFailure(v.orderId).catch(() => void 0)
|
|
3804
4014
|
}) : null
|
|
3805
4015
|
]
|
|
@@ -3807,25 +4017,25 @@ function Cr({ price: t, label: i, amount: a, returnUrl: o, fallbacks: s, onPaid:
|
|
|
3807
4017
|
}
|
|
3808
4018
|
//#endregion
|
|
3809
4019
|
//#region src/product-list.tsx
|
|
3810
|
-
var
|
|
3811
|
-
function
|
|
3812
|
-
let c =
|
|
4020
|
+
var Fr = (e, t) => e.unit_amount === t.unit_amount && e.currency === t.currency && e.billing_interval_hours === t.billing_interval_hours && e.access_duration_hours === (t.provider?.access_duration_default ? t.billing_interval_hours : t.access_duration_hours) && !e.trial_unit_amount && !t.trial_unit_amount && !e.trial_duration_hours && !t.trial_duration_hours && !e.quantity && !t.quantity;
|
|
4021
|
+
function Ir({ products: e, onPaid: t, onSignInRequired: n, signedIn: r, returnUrl: i, fallbacks: a, appearance: o, className: s }) {
|
|
4022
|
+
let c = y(), l = k(o), u = e.filter((e) => !e.archived).map((e) => {
|
|
3813
4023
|
let t = e.prices.filter((e) => !e.archived && !e.customer_amount && (!e.provider || e.provider.rail === "ccbill"));
|
|
3814
4024
|
return {
|
|
3815
4025
|
product: e,
|
|
3816
|
-
prices: t.filter((e) => !e.provider || !t.some((t) => !t.provider && (!t.sell_via?.length || t.sell_via.includes("card")) &&
|
|
4026
|
+
prices: t.filter((e) => !e.provider || !t.some((t) => !t.provider && (!t.sell_via?.length || t.sell_via.includes("card")) && Fr(t, e)))
|
|
3817
4027
|
};
|
|
3818
4028
|
}).filter((e) => e.prices.length > 0), d;
|
|
3819
|
-
return d = u.length === 0 ? /* @__PURE__ */ F(
|
|
4029
|
+
return d = u.length === 0 ? /* @__PURE__ */ F(ze, { title: c.t("products.empty") }) : u.map(({ product: e, prices: s }) => /* @__PURE__ */ I(Ne, {
|
|
3820
4030
|
className: "gap-4",
|
|
3821
4031
|
"data-testid": "product",
|
|
3822
|
-
children: [/* @__PURE__ */ I(
|
|
4032
|
+
children: [/* @__PURE__ */ I(Pe, { children: [/* @__PURE__ */ F(Fe, {
|
|
3823
4033
|
role: "heading",
|
|
3824
4034
|
"aria-level": 2,
|
|
3825
4035
|
children: e.display_name
|
|
3826
|
-
}), e.description ? /* @__PURE__ */ F(
|
|
4036
|
+
}), e.description ? /* @__PURE__ */ F(J, { children: e.description }) : null] }), /* @__PURE__ */ F(Y, {
|
|
3827
4037
|
className: "flex flex-wrap gap-2",
|
|
3828
|
-
children: s.map((e) => /* @__PURE__ */ F(
|
|
4038
|
+
children: s.map((e) => /* @__PURE__ */ F(Pr, {
|
|
3829
4039
|
price: e,
|
|
3830
4040
|
onPaid: t,
|
|
3831
4041
|
onSignInRequired: n,
|
|
@@ -3836,13 +4046,13 @@ function Tr({ products: e, onPaid: t, onSignInRequired: n, signedIn: r, returnUr
|
|
|
3836
4046
|
}, e.id))
|
|
3837
4047
|
})]
|
|
3838
4048
|
}, e.id)), /* @__PURE__ */ F("div", {
|
|
3839
|
-
className: L(l.className,
|
|
4049
|
+
className: L(l.className, q, "grid gap-4", s),
|
|
3840
4050
|
"data-orck-theme": l["data-orck-theme"],
|
|
3841
4051
|
style: l.style,
|
|
3842
4052
|
children: d
|
|
3843
4053
|
});
|
|
3844
4054
|
}
|
|
3845
4055
|
//#endregion
|
|
3846
|
-
export {
|
|
4056
|
+
export { $n as AccountBilling, b as BillingProvider, We as BillingStatusBadge, _e as BillingUiRoot, Pr as BuyButton, Fn as CancelSubscriptionDialog, Qe as CardBrandPlate, Dr as Cart, Er as EmbeddedPayment, Sr as OrderPayment, Cr as PAYMENT_COMPLETE_MESSAGE, wr as PAYMENT_RESIZE_MESSAGE, Ke as PaymentHistory, Nn as PaymentMethodsPanel, Ir as ProductList, er as RenewalPrompt, wn as SavePaymentMethod, Qn as SubscriptionsPanel, Cn as TokenizedCardForm, c as addAmounts, l as amountToDecimal, Hn as authenticateChange, jt as browserCountry, a as canAuthenticatePayment, m as canSavePaymentMethod, s as cardSetupDriver, o as createBillingClient, ne as createTranslator, ie as defaultMessages, x as defineMessages, d as formatAmount, Mt as initialCountry, re as interpolate, u as isAmount, g as pspConfigSchema, vr as readPaymentFragment, t as redeemAssertion, Je as resolveCardBrand, v as resolveMessages, i as routedPsps, Me as statusTone, h as tokenSource, y as useMessages, _r as withPaymentFallbacks };
|
|
3847
4057
|
|
|
3848
4058
|
//# sourceMappingURL=index.js.map
|