@openrails/billing-ui 0.265.0 → 0.267.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/{admin-attempts-Ch3gEugh.js → admin-attempts-Er03x8r3.js} +8 -8
- package/dist/{admin-attempts-Ch3gEugh.js.map → admin-attempts-Er03x8r3.js.map} +1 -1
- package/dist/{admin-auth-DhoAWJR7.js → admin-auth-B0lzGq-I.js} +2 -2
- package/dist/{admin-auth-DhoAWJR7.js.map → admin-auth-B0lzGq-I.js.map} +1 -1
- package/dist/{admin-badge-BbWV1fh_.js → admin-badge-D9bk3V0z.js} +2 -2
- package/dist/{admin-badge-BbWV1fh_.js.map → admin-badge-D9bk3V0z.js.map} +1 -1
- package/dist/{admin-button-DuJTjrkZ.js → admin-button-UgWgU33l.js} +2 -2
- package/dist/{admin-button-DuJTjrkZ.js.map → admin-button-UgWgU33l.js.map} +1 -1
- package/dist/{admin-capabilities-CowAO262.js → admin-capabilities-6ztIoqOe.js} +2 -2
- package/dist/{admin-capabilities-CowAO262.js.map → admin-capabilities-6ztIoqOe.js.map} +1 -1
- package/dist/{admin-card-DmEYh5UG.js → admin-card-T3w9wVwC.js} +2 -2
- package/dist/{admin-card-DmEYh5UG.js.map → admin-card-T3w9wVwC.js.map} +1 -1
- package/dist/{admin-catalog-yKUte5Ls.js → admin-catalog-BBMTQ4IE.js} +18 -18
- package/dist/{admin-catalog-yKUte5Ls.js.map → admin-catalog-BBMTQ4IE.js.map} +1 -1
- package/dist/{admin-customers-CIRgT_AM.js → admin-customers-Cj9lIBFF.js} +6 -6
- package/dist/{admin-customers-CIRgT_AM.js.map → admin-customers-Cj9lIBFF.js.map} +1 -1
- package/dist/{admin-dashboard-CjxxfmGn.js → admin-dashboard-rDXWPRMx.js} +14 -14
- package/dist/{admin-dashboard-CjxxfmGn.js.map → admin-dashboard-rDXWPRMx.js.map} +1 -1
- package/dist/{admin-data-table-JDVOjloS.js → admin-data-table-tMoCx6BU.js} +6 -6
- package/dist/{admin-data-table-JDVOjloS.js.map → admin-data-table-tMoCx6BU.js.map} +1 -1
- package/dist/{admin-detail-DbGmUYZF.js → admin-detail-5tgzwBSQ.js} +15 -15
- package/dist/{admin-detail-DbGmUYZF.js.map → admin-detail-5tgzwBSQ.js.map} +1 -1
- package/dist/{admin-detail-BGApmIXp.js → admin-detail-C4rto5hb.js} +12 -12
- package/dist/{admin-detail-BGApmIXp.js.map → admin-detail-C4rto5hb.js.map} +1 -1
- package/dist/{admin-detail-DJyfOdAA.js → admin-detail-C_A8x02G.js} +11 -11
- package/dist/{admin-detail-DJyfOdAA.js.map → admin-detail-C_A8x02G.js.map} +1 -1
- package/dist/{admin-detail-CyhZg3yp.js → admin-detail-Cy4epidT.js} +15 -15
- package/dist/{admin-detail-CyhZg3yp.js.map → admin-detail-Cy4epidT.js.map} +1 -1
- package/dist/{admin-dialog-CZqGCzoM.js → admin-dialog-DSB8NTS8.js} +3 -3
- package/dist/{admin-dialog-CZqGCzoM.js.map → admin-dialog-DSB8NTS8.js.map} +1 -1
- package/dist/{admin-dom-BgUU6fWY.js → admin-dom-swaG6h-Z.js} +4 -4
- package/dist/{admin-dom-BgUU6fWY.js.map → admin-dom-swaG6h-Z.js.map} +1 -1
- package/dist/{admin-dropdown-menu-C07-e8Iw.js → admin-dropdown-menu-BiJgFZEK.js} +2 -2
- package/dist/{admin-dropdown-menu-C07-e8Iw.js.map → admin-dropdown-menu-BiJgFZEK.js.map} +1 -1
- package/dist/{admin-fact-card-qk6tBfnN.js → admin-fact-card-DOmtzhDS.js} +2 -2
- package/dist/{admin-fact-card-qk6tBfnN.js.map → admin-fact-card-DOmtzhDS.js.map} +1 -1
- package/dist/{admin-health-D1jIjJV8.js → admin-health-Cb_vCGip.js} +9 -9
- package/dist/{admin-health-D1jIjJV8.js.map → admin-health-Cb_vCGip.js.map} +1 -1
- package/dist/{admin-input-NT3FKldx.js → admin-input-B6FrJxfC.js} +2 -2
- package/dist/{admin-input-NT3FKldx.js.map → admin-input-B6FrJxfC.js.map} +1 -1
- package/dist/{admin-label-B79EzjMX.js → admin-label-BYiPss0j.js} +2 -2
- package/dist/{admin-label-B79EzjMX.js.map → admin-label-BYiPss0j.js.map} +1 -1
- package/dist/{admin-linked-table-row-C6e4E3MZ.js → admin-linked-table-row-g5Q4eMOC.js} +4 -4
- package/dist/{admin-linked-table-row-C6e4E3MZ.js.map → admin-linked-table-row-g5Q4eMOC.js.map} +1 -1
- package/dist/{admin-metering-Bm6bnZeb.js → admin-metering-BznnYhgX.js} +14 -14
- package/dist/{admin-metering-Bm6bnZeb.js.map → admin-metering-BznnYhgX.js.map} +1 -1
- package/dist/{admin-ops-CnDqkCzG.js → admin-ops-DOCIYTjD.js} +11 -11
- package/dist/{admin-ops-CnDqkCzG.js.map → admin-ops-DOCIYTjD.js.map} +1 -1
- package/dist/{admin-orders-Cxw-bOAv.js → admin-orders-DYbdiO07.js} +8 -8
- package/dist/{admin-orders-Cxw-bOAv.js.map → admin-orders-DYbdiO07.js.map} +1 -1
- package/dist/{admin-payments-BXn7XBhi.js → admin-payments-DQgZR7J5.js} +9 -9
- package/dist/{admin-payments-BXn7XBhi.js.map → admin-payments-DQgZR7J5.js.map} +1 -1
- package/dist/{admin-price-detail-CQTI7Ixc.js → admin-price-detail-BvUo5pVr.js} +9 -9
- package/dist/{admin-price-detail-CQTI7Ixc.js.map → admin-price-detail-BvUo5pVr.js.map} +1 -1
- package/dist/{admin-price-wizard-BVYhsc1H.js → admin-price-wizard-D8c-vvzV.js} +7 -7
- package/dist/{admin-price-wizard-BVYhsc1H.js.map → admin-price-wizard-D8c-vvzV.js.map} +1 -1
- package/dist/{admin-range-picker-DdOvjkbI.js → admin-range-picker-C2lZ51RS.js} +5 -5
- package/dist/{admin-range-picker-DdOvjkbI.js.map → admin-range-picker-C2lZ51RS.js.map} +1 -1
- package/dist/{admin-reports-DjTVFwfN.js → admin-reports-CYwfX2qK.js} +8 -8
- package/dist/{admin-reports-DjTVFwfN.js.map → admin-reports-CYwfX2qK.js.map} +1 -1
- package/dist/{admin-select-BImZneOo.js → admin-select-OMB6gB61.js} +2 -2
- package/dist/{admin-select-BImZneOo.js.map → admin-select-OMB6gB61.js.map} +1 -1
- package/dist/{admin-settings-CWm1AxUG.js → admin-settings-Bw49HU8g.js} +13 -13
- package/dist/{admin-settings-CWm1AxUG.js.map → admin-settings-Bw49HU8g.js.map} +1 -1
- package/dist/{admin-skeleton-BxXYNdFd.js → admin-skeleton-DeY6aCVy.js} +2 -2
- package/dist/{admin-skeleton-BxXYNdFd.js.map → admin-skeleton-DeY6aCVy.js.map} +1 -1
- package/dist/{admin-status-badge-BLK_OGGQ.js → admin-status-badge-DENiR55N.js} +2 -2
- package/dist/{admin-status-badge-BLK_OGGQ.js.map → admin-status-badge-DENiR55N.js.map} +1 -1
- package/dist/{admin-subscriptions-CFgYiLn3.js → admin-subscriptions-BU3WGg3F.js} +9 -9
- package/dist/{admin-subscriptions-CFgYiLn3.js.map → admin-subscriptions-BU3WGg3F.js.map} +1 -1
- package/dist/{admin-switch-CXmTUFXa.js → admin-switch-DLdWpESJ.js} +2 -2
- package/dist/{admin-switch-CXmTUFXa.js.map → admin-switch-DLdWpESJ.js.map} +1 -1
- package/dist/{admin-table-DspRnxzH.js → admin-table-BRh16qQu.js} +2 -2
- package/dist/{admin-table-DspRnxzH.js.map → admin-table-BRh16qQu.js.map} +1 -1
- package/dist/{admin-tabs-BC-9XaH-.js → admin-tabs-BXJWVtU7.js} +2 -2
- package/dist/{admin-tabs-BC-9XaH-.js.map → admin-tabs-BXJWVtU7.js.map} +1 -1
- package/dist/{admin-textarea-AXd6EMnb.js → admin-textarea-Dv8Ob7H2.js} +2 -2
- package/dist/{admin-textarea-AXd6EMnb.js.map → admin-textarea-Dv8Ob7H2.js.map} +1 -1
- package/dist/{admin-typed-confirm-dialog-D9z17WED.js → admin-typed-confirm-dialog-D0R5nKD0.js} +6 -6
- package/dist/{admin-typed-confirm-dialog-D9z17WED.js.map → admin-typed-confirm-dialog-D0R5nKD0.js.map} +1 -1
- package/dist/{admin-utils-B02Cfic4.js → admin-utils-BE_Zb14A.js} +31 -1
- package/dist/admin-utils-BE_Zb14A.js.map +1 -0
- package/dist/{admin-widget-viz-Cqd8qzCt.js → admin-widget-viz-BvejlYLH.js} +3 -3
- package/dist/{admin-widget-viz-Cqd8qzCt.js.map → admin-widget-viz-BvejlYLH.js.map} +1 -1
- package/dist/admin.js +28 -28
- package/dist/components/billing-notification.d.ts +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +479 -411
- package/dist/index.js.map +1 -1
- package/dist/lib/billing-notification.d.ts +12 -0
- package/dist/locales/de.js +30 -0
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.d.ts +30 -0
- package/dist/locales/en.js +30 -0
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +30 -0
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +30 -0
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +30 -0
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +30 -0
- package/dist/locales/zh.js.map +1 -1
- package/package.json +1 -1
- package/dist/admin-utils-B02Cfic4.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -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 _e = ae("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
48
48
|
variants: {
|
|
49
49
|
variant: {
|
|
50
50
|
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
@@ -70,10 +70,10 @@ var U = ae("group/button inline-flex shrink-0 items-center justify-center rounde
|
|
|
70
70
|
size: "default"
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
-
function
|
|
73
|
+
function U({ className: e, variant: t = "default", size: n = "default", ...r }) {
|
|
74
74
|
return /* @__PURE__ */ I(z, {
|
|
75
75
|
"data-slot": "button",
|
|
76
|
-
className: R(
|
|
76
|
+
className: R(_e({
|
|
77
77
|
variant: t,
|
|
78
78
|
size: n,
|
|
79
79
|
className: e
|
|
@@ -83,7 +83,7 @@ function W({ 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 _e(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,47 +115,47 @@ function K(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
|
-
function
|
|
124
|
-
return e ? e.billing_interval_hours ?
|
|
123
|
+
function be(e, t) {
|
|
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
|
-
function
|
|
126
|
+
function xe(e, { t }) {
|
|
127
127
|
return e.product?.display_name?.trim() || e.price?.key?.trim() || t("subscriptions.fallbackName");
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
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
|
-
function
|
|
136
|
+
function Ce(e, t) {
|
|
137
137
|
let n = e?.trim();
|
|
138
138
|
return n ? n[0].toUpperCase() + n.slice(1).toLowerCase() : t;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
let n =
|
|
140
|
+
function we(e, t) {
|
|
141
|
+
let n = Ce(e?.brand, t.t("paymentMethods.fallbackBrand"));
|
|
142
142
|
if (!e?.last4) return n;
|
|
143
143
|
let r = t.t("paymentMethods.cardLabel", {
|
|
144
144
|
brand: n,
|
|
145
145
|
last4: e.last4
|
|
146
|
-
}), i =
|
|
146
|
+
}), i = Te(e);
|
|
147
147
|
return i ? `${r} · ${i}` : r;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function Te(e) {
|
|
150
150
|
return !e?.exp_month || !e.exp_year ? null : `${String(e.exp_month).padStart(2, "0")}/${String(e.exp_year).slice(-2)}`;
|
|
151
151
|
}
|
|
152
|
-
var
|
|
152
|
+
var Ee = /* @__PURE__ */ new Set([
|
|
153
153
|
"active",
|
|
154
154
|
"pending",
|
|
155
155
|
"past_due",
|
|
156
156
|
"awaiting_method",
|
|
157
157
|
"unverified"
|
|
158
|
-
]),
|
|
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 Te = /* @__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__ */ I("div", {
|
|
179
179
|
"data-slot": "card",
|
|
180
180
|
"data-size": t,
|
|
@@ -182,35 +182,35 @@ 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__ */ I("div", {
|
|
187
187
|
"data-slot": "card-header",
|
|
188
188
|
className: R("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)", e),
|
|
189
189
|
...t
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function Fe({ className: e, ...t }) {
|
|
193
193
|
return /* @__PURE__ */ I("div", {
|
|
194
194
|
"data-slot": "card-title",
|
|
195
195
|
className: R("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__ */ I("div", {
|
|
201
201
|
"data-slot": "card-description",
|
|
202
202
|
className: R("text-sm text-muted-foreground", e),
|
|
203
203
|
...t
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function Ie({ className: e, ...t }) {
|
|
207
207
|
return /* @__PURE__ */ I("div", {
|
|
208
208
|
"data-slot": "card-action",
|
|
209
209
|
className: R("col-start-2 row-span-2 row-start-1 self-start justify-self-end", e),
|
|
210
210
|
...t
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function Y({ className: e, ...t }) {
|
|
214
214
|
return /* @__PURE__ */ I("div", {
|
|
215
215
|
"data-slot": "card-content",
|
|
216
216
|
className: R("flex flex-col gap-3 px-(--card-spacing)", e),
|
|
@@ -219,7 +219,7 @@ function X({ 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__ */ I("div", {
|
|
224
224
|
"data-slot": "skeleton",
|
|
225
225
|
className: R("animate-pulse rounded-md bg-muted", e),
|
|
@@ -228,50 +228,50 @@ function Z({ className: e, ...t }) {
|
|
|
228
228
|
}
|
|
229
229
|
//#endregion
|
|
230
230
|
//#region src/account/section.tsx
|
|
231
|
-
function
|
|
231
|
+
function Le({ title: e, description: t, action: n, appearance: r, className: i, children: a, ...o }) {
|
|
232
232
|
let s = k(r), c = F.useId();
|
|
233
233
|
return /* @__PURE__ */ I("section", {
|
|
234
234
|
"aria-labelledby": c,
|
|
235
|
-
className: R(s.className,
|
|
235
|
+
className: R(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__ */ L(
|
|
239
|
+
children: /* @__PURE__ */ L(Ne, {
|
|
240
240
|
className: "gap-4 bg-card text-card-foreground",
|
|
241
|
-
children: [/* @__PURE__ */ L(
|
|
242
|
-
/* @__PURE__ */ I(
|
|
241
|
+
children: [/* @__PURE__ */ L(Pe, { children: [
|
|
242
|
+
/* @__PURE__ */ I(Fe, {
|
|
243
243
|
id: c,
|
|
244
244
|
role: "heading",
|
|
245
245
|
"aria-level": 2,
|
|
246
246
|
children: e
|
|
247
247
|
}),
|
|
248
|
-
t ? /* @__PURE__ */ I(
|
|
249
|
-
n ? /* @__PURE__ */ I(
|
|
250
|
-
] }), /* @__PURE__ */ I(
|
|
248
|
+
t ? /* @__PURE__ */ I(J, { children: t }) : null,
|
|
249
|
+
n ? /* @__PURE__ */ I(Ie, { children: n }) : null
|
|
250
|
+
] }), /* @__PURE__ */ I(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__ */ I("div", {
|
|
259
259
|
className: "grid gap-4 py-2",
|
|
260
260
|
"aria-hidden": !0,
|
|
261
261
|
children: Array.from({ length: e }, (e, t) => /* @__PURE__ */ L("div", {
|
|
262
262
|
className: "flex items-center gap-3",
|
|
263
263
|
children: [
|
|
264
|
-
/* @__PURE__ */ I(
|
|
264
|
+
/* @__PURE__ */ I(X, { className: "h-7 w-11 rounded-md" }),
|
|
265
265
|
/* @__PURE__ */ L("div", {
|
|
266
266
|
className: "grid flex-1 gap-2",
|
|
267
|
-
children: [/* @__PURE__ */ I(
|
|
267
|
+
children: [/* @__PURE__ */ I(X, { className: "h-3.5 w-40" }), /* @__PURE__ */ I(X, { className: "h-3 w-28" })]
|
|
268
268
|
}),
|
|
269
|
-
/* @__PURE__ */ I(
|
|
269
|
+
/* @__PURE__ */ I(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__ */ L("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,7 +290,7 @@ function Re({ title: e, description: t, action: n }) {
|
|
|
290
290
|
]
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function Z({ error: e, message: t, onRetry: n }) {
|
|
294
294
|
let r = y();
|
|
295
295
|
return /* @__PURE__ */ L("div", {
|
|
296
296
|
role: "alert",
|
|
@@ -298,7 +298,7 @@ function Q({ error: e, message: t, onRetry: n }) {
|
|
|
298
298
|
children: [/* @__PURE__ */ I("p", {
|
|
299
299
|
className: "text-sm text-destructive",
|
|
300
300
|
children: t ?? r.error(e)
|
|
301
|
-
}), /* @__PURE__ */ I(
|
|
301
|
+
}), /* @__PURE__ */ I(U, {
|
|
302
302
|
variant: "outline",
|
|
303
303
|
size: "sm",
|
|
304
304
|
onClick: n,
|
|
@@ -308,7 +308,7 @@ function Q({ error: e, message: t, onRetry: n }) {
|
|
|
308
308
|
}
|
|
309
309
|
//#endregion
|
|
310
310
|
//#region src/components/ui/badge.tsx
|
|
311
|
-
var
|
|
311
|
+
var Be = ae("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
|
|
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 ze = ae("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-cen
|
|
|
319
319
|
} },
|
|
320
320
|
defaultVariants: { variant: "default" }
|
|
321
321
|
});
|
|
322
|
-
function
|
|
322
|
+
function Ve({ className: e, variant: t = "default", render: n, ...r }) {
|
|
323
323
|
return oe({
|
|
324
324
|
defaultTagName: "span",
|
|
325
|
-
props: B({ className: R(
|
|
325
|
+
props: B({ className: R(Be({ variant: t }), e) }, r),
|
|
326
326
|
render: n,
|
|
327
327
|
state: {
|
|
328
328
|
slot: "badge",
|
|
@@ -332,33 +332,33 @@ function Be({ 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 He = {
|
|
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
|
|
341
|
+
function Ue({ status: e, label: t, className: n }) {
|
|
342
342
|
let { t: r, messages: i } = y(), a = e, o = t ?? (a in i.status ? r(`status.${a}`) : e.replace(/_/g, " "));
|
|
343
|
-
return /* @__PURE__ */ I(
|
|
343
|
+
return /* @__PURE__ */ I(Ve, {
|
|
344
344
|
"data-status": e,
|
|
345
|
-
className: R(
|
|
345
|
+
className: R(He[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
|
|
352
|
-
if (e.card?.last4) return
|
|
351
|
+
function We(e, t) {
|
|
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
|
|
356
|
+
function Ge({ appearance: e, className: t, ...n }) {
|
|
357
357
|
let r = y(), { t: i } = r, { locale: a } = E(), o = A(n), s = ee(), c, l = o.payments;
|
|
358
|
-
c = l === null && o.error ? /* @__PURE__ */ I(
|
|
358
|
+
c = l === null && o.error ? /* @__PURE__ */ I(Z, {
|
|
359
359
|
error: o.error,
|
|
360
360
|
onRetry: o.refetch
|
|
361
|
-
}) : l === null ? /* @__PURE__ */ I(
|
|
361
|
+
}) : l === null ? /* @__PURE__ */ I(Re, { rows: 3 }) : l.length === 0 && o.page === 0 ? /* @__PURE__ */ I(ze, {
|
|
362
362
|
title: i("history.empty"),
|
|
363
363
|
description: i("history.emptyDescription")
|
|
364
364
|
}) : /* @__PURE__ */ I("div", {
|
|
@@ -398,7 +398,7 @@ function We({ appearance: e, className: t, ...n }) {
|
|
|
398
398
|
}) }), /* @__PURE__ */ I("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__ */ L("tr", {
|
|
403
403
|
"data-testid": "payment-row",
|
|
404
404
|
"data-payment-id": e.id,
|
|
@@ -430,18 +430,18 @@ function We({ appearance: e, className: t, ...n }) {
|
|
|
430
430
|
children: [
|
|
431
431
|
u,
|
|
432
432
|
" · ",
|
|
433
|
-
|
|
433
|
+
We(e, r)
|
|
434
434
|
]
|
|
435
435
|
})
|
|
436
436
|
]
|
|
437
437
|
}),
|
|
438
438
|
/* @__PURE__ */ I("td", {
|
|
439
439
|
className: "hidden py-3 pr-3 align-top text-muted-foreground tabular-nums @md:table-cell",
|
|
440
|
-
children:
|
|
440
|
+
children: We(e, r)
|
|
441
441
|
}),
|
|
442
442
|
/* @__PURE__ */ I("td", {
|
|
443
443
|
className: "py-3 pr-3 align-top",
|
|
444
|
-
children: /* @__PURE__ */ I(
|
|
444
|
+
children: /* @__PURE__ */ I(Ue, {
|
|
445
445
|
status: n,
|
|
446
446
|
label: t ? i("history.refund") : void 0
|
|
447
447
|
})
|
|
@@ -460,7 +460,7 @@ function We({ appearance: e, className: t, ...n }) {
|
|
|
460
460
|
})
|
|
461
461
|
});
|
|
462
462
|
let u = o.page > 0 || o.hasMore;
|
|
463
|
-
return /* @__PURE__ */ L(
|
|
463
|
+
return /* @__PURE__ */ L(Le, {
|
|
464
464
|
title: i("history.title"),
|
|
465
465
|
description: i("history.description"),
|
|
466
466
|
appearance: e,
|
|
@@ -470,7 +470,7 @@ function We({ appearance: e, className: t, ...n }) {
|
|
|
470
470
|
c,
|
|
471
471
|
l !== null && o.error ? /* @__PURE__ */ I("div", {
|
|
472
472
|
className: "pt-3",
|
|
473
|
-
children: /* @__PURE__ */ I(
|
|
473
|
+
children: /* @__PURE__ */ I(Z, {
|
|
474
474
|
error: o.error,
|
|
475
475
|
onRetry: o.refetch
|
|
476
476
|
})
|
|
@@ -483,13 +483,13 @@ function We({ appearance: e, className: t, ...n }) {
|
|
|
483
483
|
children: i("history.page", { page: o.page + 1 })
|
|
484
484
|
}), /* @__PURE__ */ L("div", {
|
|
485
485
|
className: "flex gap-2",
|
|
486
|
-
children: [/* @__PURE__ */ I(
|
|
486
|
+
children: [/* @__PURE__ */ I(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__ */ I(
|
|
492
|
+
}), /* @__PURE__ */ I(U, {
|
|
493
493
|
variant: "outline",
|
|
494
494
|
size: "sm",
|
|
495
495
|
disabled: !o.hasMore || o.loading,
|
|
@@ -503,7 +503,7 @@ function We({ appearance: e, className: t, ...n }) {
|
|
|
503
503
|
}
|
|
504
504
|
//#endregion
|
|
505
505
|
//#region src/lib/card-brands.ts
|
|
506
|
-
var
|
|
506
|
+
var Ke = {
|
|
507
507
|
visa: "visa",
|
|
508
508
|
mastercard: "mastercard",
|
|
509
509
|
mc: "mastercard",
|
|
@@ -512,13 +512,13 @@ var Ge = {
|
|
|
512
512
|
americanexpress: "amex",
|
|
513
513
|
"american express": "amex"
|
|
514
514
|
};
|
|
515
|
-
function
|
|
515
|
+
function qe(e) {
|
|
516
516
|
let t = e?.trim().toLowerCase().replace(/[^a-z ]/g, "");
|
|
517
|
-
return t ?
|
|
517
|
+
return t ? Ke[t] : void 0;
|
|
518
518
|
}
|
|
519
519
|
//#endregion
|
|
520
520
|
//#region src/components/card-brands.tsx
|
|
521
|
-
function
|
|
521
|
+
function Je() {
|
|
522
522
|
return /* @__PURE__ */ I("svg", {
|
|
523
523
|
viewBox: "0 0 1000 324.68",
|
|
524
524
|
className: "h-2.5 w-auto",
|
|
@@ -529,7 +529,7 @@ function qe() {
|
|
|
529
529
|
})
|
|
530
530
|
});
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function Ye() {
|
|
533
533
|
return /* @__PURE__ */ I("svg", {
|
|
534
534
|
viewBox: "0 0 152.4 108",
|
|
535
535
|
className: "h-4 w-auto",
|
|
@@ -558,7 +558,7 @@ function Je() {
|
|
|
558
558
|
] })] })
|
|
559
559
|
});
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function Xe() {
|
|
562
562
|
let e = `orck-amex-${F.useId().replace(/[^a-zA-Z0-9-]/g, "")}`;
|
|
563
563
|
return /* @__PURE__ */ L("svg", {
|
|
564
564
|
viewBox: "0 0 300 300",
|
|
@@ -622,34 +622,34 @@ function Ye() {
|
|
|
622
622
|
]
|
|
623
623
|
});
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
let r =
|
|
625
|
+
function Ze({ brand: e, fallback: t, className: n }) {
|
|
626
|
+
let r = qe(e);
|
|
627
627
|
return /* @__PURE__ */ I("span", {
|
|
628
628
|
"aria-hidden": !0,
|
|
629
629
|
className: R("grid h-7 w-11 shrink-0 place-items-center overflow-hidden rounded-md", r ? "bg-white" : "bg-muted text-[10px] font-semibold tracking-wide text-muted-foreground uppercase", n),
|
|
630
|
-
children: r === "visa" ? /* @__PURE__ */ I(
|
|
630
|
+
children: r === "visa" ? /* @__PURE__ */ I(Je, {}) : r === "mastercard" ? /* @__PURE__ */ I(Ye, {}) : r === "amex" ? /* @__PURE__ */ I(Xe, {}) : t
|
|
631
631
|
});
|
|
632
632
|
}
|
|
633
|
-
var
|
|
633
|
+
var Qe = [
|
|
634
634
|
{
|
|
635
635
|
brand: "visa",
|
|
636
|
-
Mark:
|
|
636
|
+
Mark: Je
|
|
637
637
|
},
|
|
638
638
|
{
|
|
639
639
|
brand: "mastercard",
|
|
640
|
-
Mark:
|
|
640
|
+
Mark: Ye
|
|
641
641
|
},
|
|
642
642
|
{
|
|
643
643
|
brand: "amex",
|
|
644
|
-
Mark:
|
|
644
|
+
Mark: Xe
|
|
645
645
|
}
|
|
646
646
|
];
|
|
647
|
-
function
|
|
648
|
-
let t =
|
|
647
|
+
function $e({ active: e }) {
|
|
648
|
+
let t = qe(e);
|
|
649
649
|
return /* @__PURE__ */ I("span", {
|
|
650
650
|
"aria-hidden": !0,
|
|
651
651
|
className: "flex items-center gap-1",
|
|
652
|
-
children:
|
|
652
|
+
children: Qe.map(({ brand: e, Mark: n }) => /* @__PURE__ */ I("span", {
|
|
653
653
|
className: R("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__ */ I(n, {})
|
|
655
655
|
}, e))
|
|
@@ -657,66 +657,66 @@ function Qe({ active: e }) {
|
|
|
657
657
|
}
|
|
658
658
|
//#endregion
|
|
659
659
|
//#region src/components/ui/alert-dialog.tsx
|
|
660
|
-
function
|
|
660
|
+
function et({ ...e }) {
|
|
661
661
|
return /* @__PURE__ */ I(V.Root, {
|
|
662
662
|
"data-slot": "alert-dialog",
|
|
663
663
|
...e
|
|
664
664
|
});
|
|
665
665
|
}
|
|
666
|
-
function
|
|
666
|
+
function tt({ ...e }) {
|
|
667
667
|
return /* @__PURE__ */ I(V.Portal, {
|
|
668
668
|
"data-slot": "alert-dialog-portal",
|
|
669
669
|
...e
|
|
670
670
|
});
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function nt({ className: e, ...t }) {
|
|
673
673
|
return /* @__PURE__ */ I(V.Backdrop, {
|
|
674
674
|
"data-slot": "alert-dialog-overlay",
|
|
675
675
|
className: R("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", e),
|
|
676
676
|
...t
|
|
677
677
|
});
|
|
678
678
|
}
|
|
679
|
-
function
|
|
680
|
-
return /* @__PURE__ */ L(
|
|
679
|
+
function rt({ className: e, size: t = "default", ...n }) {
|
|
680
|
+
return /* @__PURE__ */ L(tt, { children: [/* @__PURE__ */ I(nt, {}), /* @__PURE__ */ I(V.Popup, {
|
|
681
681
|
"data-slot": "alert-dialog-content",
|
|
682
682
|
"data-size": t,
|
|
683
683
|
className: R("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", e),
|
|
684
684
|
...n
|
|
685
685
|
})] });
|
|
686
686
|
}
|
|
687
|
-
function
|
|
687
|
+
function it({ className: e, ...t }) {
|
|
688
688
|
return /* @__PURE__ */ I("div", {
|
|
689
689
|
"data-slot": "alert-dialog-header",
|
|
690
690
|
className: R("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]", e),
|
|
691
691
|
...t
|
|
692
692
|
});
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function at({ className: e, ...t }) {
|
|
695
695
|
return /* @__PURE__ */ I("div", {
|
|
696
696
|
"data-slot": "alert-dialog-footer",
|
|
697
697
|
className: R("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end", e),
|
|
698
698
|
...t
|
|
699
699
|
});
|
|
700
700
|
}
|
|
701
|
-
function
|
|
701
|
+
function ot({ className: e, ...t }) {
|
|
702
702
|
return /* @__PURE__ */ I(V.Title, {
|
|
703
703
|
"data-slot": "alert-dialog-title",
|
|
704
704
|
className: R("text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2", e),
|
|
705
705
|
...t
|
|
706
706
|
});
|
|
707
707
|
}
|
|
708
|
-
function
|
|
708
|
+
function st({ className: e, ...t }) {
|
|
709
709
|
return /* @__PURE__ */ I(V.Description, {
|
|
710
710
|
"data-slot": "alert-dialog-description",
|
|
711
711
|
className: R("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 ct({ className: e, variant: t = "outline", size: n = "default", ...r }) {
|
|
716
716
|
return /* @__PURE__ */ I(V.Close, {
|
|
717
717
|
"data-slot": "alert-dialog-cancel",
|
|
718
718
|
className: R(e),
|
|
719
|
-
render: /* @__PURE__ */ I(
|
|
719
|
+
render: /* @__PURE__ */ I(U, {
|
|
720
720
|
variant: t,
|
|
721
721
|
size: n
|
|
722
722
|
}),
|
|
@@ -725,33 +725,33 @@ function st({ 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 lt({ ...e }) {
|
|
729
729
|
return /* @__PURE__ */ I(H.Root, {
|
|
730
730
|
"data-slot": "dialog",
|
|
731
731
|
...e
|
|
732
732
|
});
|
|
733
733
|
}
|
|
734
|
-
function
|
|
734
|
+
function ut({ ...e }) {
|
|
735
735
|
return /* @__PURE__ */ I(H.Portal, {
|
|
736
736
|
"data-slot": "dialog-portal",
|
|
737
737
|
...e
|
|
738
738
|
});
|
|
739
739
|
}
|
|
740
|
-
function
|
|
740
|
+
function dt({ className: e, ...t }) {
|
|
741
741
|
return /* @__PURE__ */ I(H.Backdrop, {
|
|
742
742
|
"data-slot": "dialog-overlay",
|
|
743
743
|
className: R("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", e),
|
|
744
744
|
...t
|
|
745
745
|
});
|
|
746
746
|
}
|
|
747
|
-
function
|
|
748
|
-
return /* @__PURE__ */ L(
|
|
747
|
+
function ft({ className: e, children: t, showCloseButton: n = !0, ...r }) {
|
|
748
|
+
return /* @__PURE__ */ L(ut, { children: [/* @__PURE__ */ I(dt, {}), /* @__PURE__ */ L(H.Popup, {
|
|
749
749
|
"data-slot": "dialog-content",
|
|
750
750
|
className: R("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", e),
|
|
751
751
|
...r,
|
|
752
752
|
children: [t, n && /* @__PURE__ */ L(H.Close, {
|
|
753
753
|
"data-slot": "dialog-close",
|
|
754
|
-
render: /* @__PURE__ */ I(
|
|
754
|
+
render: /* @__PURE__ */ I(U, {
|
|
755
755
|
variant: "ghost",
|
|
756
756
|
className: "absolute top-4 right-4",
|
|
757
757
|
size: "icon-sm"
|
|
@@ -766,32 +766,32 @@ function dt({ className: e, children: t, showCloseButton: n = !0, ...r }) {
|
|
|
766
766
|
})]
|
|
767
767
|
})] });
|
|
768
768
|
}
|
|
769
|
-
function
|
|
769
|
+
function pt({ className: e, ...t }) {
|
|
770
770
|
return /* @__PURE__ */ I("div", {
|
|
771
771
|
"data-slot": "dialog-header",
|
|
772
772
|
className: R("flex flex-col gap-2", e),
|
|
773
773
|
...t
|
|
774
774
|
});
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function mt({ className: e, showCloseButton: t = !1, children: n, ...r }) {
|
|
777
777
|
return /* @__PURE__ */ L("div", {
|
|
778
778
|
"data-slot": "dialog-footer",
|
|
779
779
|
className: R("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", e),
|
|
780
780
|
...r,
|
|
781
781
|
children: [n, t && /* @__PURE__ */ I(H.Close, {
|
|
782
|
-
render: /* @__PURE__ */ I(
|
|
782
|
+
render: /* @__PURE__ */ I(U, { variant: "outline" }),
|
|
783
783
|
children: "Close"
|
|
784
784
|
})]
|
|
785
785
|
});
|
|
786
786
|
}
|
|
787
|
-
function
|
|
787
|
+
function ht({ className: e, ...t }) {
|
|
788
788
|
return /* @__PURE__ */ I(H.Title, {
|
|
789
789
|
"data-slot": "dialog-title",
|
|
790
790
|
className: R("leading-none font-medium", e),
|
|
791
791
|
...t
|
|
792
792
|
});
|
|
793
793
|
}
|
|
794
|
-
function
|
|
794
|
+
function gt({ className: e, ...t }) {
|
|
795
795
|
return /* @__PURE__ */ I(H.Description, {
|
|
796
796
|
"data-slot": "dialog-description",
|
|
797
797
|
className: R("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", e),
|
|
@@ -800,7 +800,7 @@ function ht({ className: e, ...t }) {
|
|
|
800
800
|
}
|
|
801
801
|
//#endregion
|
|
802
802
|
//#region src/components/ui/spinner.tsx
|
|
803
|
-
function
|
|
803
|
+
function _t({ className: e, ...t }) {
|
|
804
804
|
let { t: n } = y();
|
|
805
805
|
return /* @__PURE__ */ I(se, {
|
|
806
806
|
icon: fe,
|
|
@@ -814,7 +814,7 @@ function gt({ className: e, ...t }) {
|
|
|
814
814
|
}
|
|
815
815
|
//#endregion
|
|
816
816
|
//#region src/components/ui/input.tsx
|
|
817
|
-
function
|
|
817
|
+
function vt({ className: e, type: t, ...n }) {
|
|
818
818
|
return /* @__PURE__ */ I(pe, {
|
|
819
819
|
type: t,
|
|
820
820
|
"data-slot": "input",
|
|
@@ -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__ */ I("label", {
|
|
829
829
|
"data-slot": "label",
|
|
830
830
|
className: R("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", e),
|
|
@@ -833,7 +833,7 @@ function $({ 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 = P.string().trim().min(1, "Full name is required").max(200, "Full name is too long"), Tt = P.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:
|
|
867
|
+
var Ot = P.object({
|
|
868
|
+
name_on_card: wt,
|
|
869
|
+
country: Tt,
|
|
870
870
|
zip: P.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 = P.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__ */ L("div", {
|
|
922
922
|
className: "grid gap-1.5",
|
|
923
|
-
children: [/* @__PURE__ */ I(
|
|
923
|
+
children: [/* @__PURE__ */ I(Q, {
|
|
924
924
|
htmlFor: e,
|
|
925
|
-
className:
|
|
925
|
+
className: Ft,
|
|
926
926
|
children: n
|
|
927
|
-
}), /* @__PURE__ */ I(
|
|
927
|
+
}), /* @__PURE__ */ I(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__ */ L("div", {
|
|
946
946
|
className: "grid gap-1.5",
|
|
947
|
-
children: [/* @__PURE__ */ I(
|
|
947
|
+
children: [/* @__PURE__ */ I(Q, {
|
|
948
948
|
htmlFor: e,
|
|
949
|
-
className:
|
|
949
|
+
className: Ft,
|
|
950
950
|
children: "Country or region"
|
|
951
951
|
}), /* @__PURE__ */ L("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__ */ I("option", {
|
|
961
961
|
value: "",
|
|
962
962
|
children: "Select country"
|
|
963
|
-
}),
|
|
963
|
+
}), Ct.map((e) => /* @__PURE__ */ I("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__ */ L("div", {
|
|
973
973
|
className: "grid gap-1.5",
|
|
974
|
-
children: [/* @__PURE__ */ I(
|
|
974
|
+
children: [/* @__PURE__ */ I(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__ */ L("div", {
|
|
1000
1000
|
className: "grid gap-3",
|
|
1001
1001
|
children: [
|
|
1002
|
-
/* @__PURE__ */ I(
|
|
1002
|
+
/* @__PURE__ */ I(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__ */ L("div", {
|
|
1015
1015
|
className: "grid grid-cols-2 gap-3",
|
|
1016
|
-
children: [/* @__PURE__ */ I(
|
|
1016
|
+
children: [/* @__PURE__ */ I(zt, {
|
|
1017
1017
|
id: `${e}-country`,
|
|
1018
1018
|
value: t.country,
|
|
1019
1019
|
onChange: o("country"),
|
|
1020
1020
|
disabled: r
|
|
1021
|
-
}), /* @__PURE__ */ I(
|
|
1021
|
+
}), /* @__PURE__ */ I(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__ */ I("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__ */ L("div", {
|
|
1047
1047
|
className: R("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__ */ L("div", {
|
|
1054
1054
|
className: "flex items-center justify-between",
|
|
1055
|
-
children: [/* @__PURE__ */ I(
|
|
1055
|
+
children: [/* @__PURE__ */ I(Q, {
|
|
1056
1056
|
htmlFor: e.number,
|
|
1057
1057
|
className: "text-[13px] font-medium text-foreground",
|
|
1058
1058
|
children: "Card number"
|
|
1059
|
-
}), /* @__PURE__ */ I(
|
|
1059
|
+
}), /* @__PURE__ */ I($e, { active: a })]
|
|
1060
1060
|
}),
|
|
1061
1061
|
t ? /* @__PURE__ */ I("div", {
|
|
1062
1062
|
id: e.number,
|
|
1063
|
-
className:
|
|
1063
|
+
className: Wt,
|
|
1064
1064
|
children: "1234 1234 1234 1234"
|
|
1065
1065
|
}) : /* @__PURE__ */ I("div", {
|
|
1066
1066
|
id: e.number,
|
|
1067
|
-
className: R(
|
|
1067
|
+
className: R(Ut, r.number && "border-destructive")
|
|
1068
1068
|
}),
|
|
1069
|
-
/* @__PURE__ */ I(
|
|
1069
|
+
/* @__PURE__ */ I(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__ */ L("div", {
|
|
1078
1078
|
className: "grid gap-1.5",
|
|
1079
1079
|
children: [
|
|
1080
|
-
/* @__PURE__ */ I(
|
|
1080
|
+
/* @__PURE__ */ I(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__ */ I("div", {
|
|
1086
1086
|
id: e.expiry,
|
|
1087
|
-
className:
|
|
1087
|
+
className: Wt,
|
|
1088
1088
|
children: "MM / YY"
|
|
1089
1089
|
}) : /* @__PURE__ */ I("div", {
|
|
1090
1090
|
id: e.expiry,
|
|
1091
|
-
className: R(
|
|
1091
|
+
className: R(Ut, r.expiry && "border-destructive")
|
|
1092
1092
|
}),
|
|
1093
|
-
/* @__PURE__ */ I(
|
|
1093
|
+
/* @__PURE__ */ I(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__ */ L("div", {
|
|
1099
1099
|
className: "grid gap-1.5",
|
|
1100
1100
|
children: [
|
|
1101
|
-
/* @__PURE__ */ I(
|
|
1101
|
+
/* @__PURE__ */ I(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__ */ I("div", {
|
|
1107
1107
|
id: e.cvv,
|
|
1108
|
-
className:
|
|
1108
|
+
className: Wt,
|
|
1109
1109
|
children: "CVC"
|
|
1110
1110
|
}) : /* @__PURE__ */ I("div", {
|
|
1111
1111
|
id: e.cvv,
|
|
1112
|
-
className: R(
|
|
1112
|
+
className: R(Ut, r.cvv && "border-destructive")
|
|
1113
1113
|
}),
|
|
1114
|
-
/* @__PURE__ */ I(
|
|
1114
|
+
/* @__PURE__ */ I(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
1134
|
}, o = (e, n, i, a) => /* @__PURE__ */ L(ie, { children: [/* @__PURE__ */ I("input", {
|
|
1135
1135
|
id: e,
|
|
1136
1136
|
name: `card-${n}`,
|
|
1137
|
-
className: R(
|
|
1137
|
+
className: R(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__ */ I(
|
|
1148
|
+
}), /* @__PURE__ */ I(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__ */ L("div", {
|
|
1158
1158
|
className: "flex items-center justify-between",
|
|
1159
|
-
children: [/* @__PURE__ */ I(
|
|
1159
|
+
children: [/* @__PURE__ */ I(Q, {
|
|
1160
1160
|
htmlFor: e.number,
|
|
1161
1161
|
className: "text-[13px] font-medium text-foreground",
|
|
1162
1162
|
children: "Card number"
|
|
1163
|
-
}), /* @__PURE__ */ I(
|
|
1163
|
+
}), /* @__PURE__ */ I($e, {})]
|
|
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__ */ L("div", {
|
|
1172
1172
|
className: "grid gap-1.5",
|
|
1173
|
-
children: [/* @__PURE__ */ I(
|
|
1173
|
+
children: [/* @__PURE__ */ I(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__ */ L("div", {
|
|
1183
1183
|
className: "grid gap-1.5",
|
|
1184
|
-
children: [/* @__PURE__ */ I(
|
|
1184
|
+
children: [/* @__PURE__ */ I(Q, {
|
|
1185
1185
|
htmlFor: e.cvv,
|
|
1186
1186
|
className: "text-[13px] font-medium text-foreground",
|
|
1187
1187
|
children: "CVC"
|
|
@@ -1196,8 +1196,8 @@ 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__ */ I(
|
|
1199
|
+
function $({ label: e, processing: t, disabled: n }) {
|
|
1200
|
+
return /* @__PURE__ */ I(U, {
|
|
1201
1201
|
type: "submit",
|
|
1202
1202
|
className: R("h-[42px] w-full rounded-[10px] text-sm font-semibold tabular-nums", t && "opacity-75"),
|
|
1203
1203
|
disabled: n || t,
|
|
@@ -1238,8 +1238,8 @@ function Yt({ publicKey: e, submitLabel: t, disabled: n, onTokenized: r, purpose
|
|
|
1238
1238
|
expiry: `bt-${o}-expiry`,
|
|
1239
1239
|
cvv: `bt-${o}-cvv`
|
|
1240
1240
|
}), [o]), [c, l] = F.useState(() => ({
|
|
1241
|
-
...
|
|
1242
|
-
country:
|
|
1241
|
+
...At,
|
|
1242
|
+
country: Mt(a)
|
|
1243
1243
|
})), [u, d] = F.useState(!1), [f, p] = F.useState(!1), [m, h] = F.useState(!1), [g, _] = F.useState(!1), [v, y] = F.useState(), b = F.useRef(void 0), x = F.useRef(void 0), S = F.useRef(!1), C = F.useRef({
|
|
1244
1244
|
generation: 0,
|
|
1245
1245
|
disabled: n
|
|
@@ -1273,7 +1273,7 @@ function Yt({ 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 Yt({ 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__ */ I(
|
|
1302
|
+
/* @__PURE__ */ I(Vt, {
|
|
1303
1303
|
idPrefix: `bt-${o}`,
|
|
1304
1304
|
value: c,
|
|
1305
1305
|
onChange: l,
|
|
1306
1306
|
disabled: n || f || g || m,
|
|
1307
|
-
children: /* @__PURE__ */ I(
|
|
1307
|
+
children: /* @__PURE__ */ I(Gt, {
|
|
1308
1308
|
ids: s,
|
|
1309
1309
|
preview: !1
|
|
1310
1310
|
})
|
|
@@ -1314,10 +1314,10 @@ function Yt({ 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__ */ I(
|
|
1317
|
+
/* @__PURE__ */ I($, {
|
|
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
1322
|
/* @__PURE__ */ I(Jt, {})
|
|
1323
1323
|
]
|
|
@@ -1779,8 +1779,8 @@ function Cn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1779
1779
|
expiry: `orck-save-${p}-expiry`,
|
|
1780
1780
|
cvv: `orck-save-${p}-cvv`
|
|
1781
1781
|
}), [p]), [h, g] = F.useState(() => ({
|
|
1782
|
-
...
|
|
1783
|
-
country:
|
|
1782
|
+
...At,
|
|
1783
|
+
country: Mt(a)
|
|
1784
1784
|
})), [_, v] = F.useState(!1), [y, b] = F.useState(!1), [x, S] = F.useState(), T = F.useRef({
|
|
1785
1785
|
generation: 0,
|
|
1786
1786
|
disabled: i
|
|
@@ -1809,9 +1809,9 @@ function Cn({ 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), A = 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;
|
|
@@ -1843,12 +1843,12 @@ function Cn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1843
1843
|
className: "grid gap-4",
|
|
1844
1844
|
onSubmit: (e) => void A(e),
|
|
1845
1845
|
children: [
|
|
1846
|
-
/* @__PURE__ */ I(
|
|
1846
|
+
/* @__PURE__ */ I(Vt, {
|
|
1847
1847
|
idPrefix: `orck-save-${p}`,
|
|
1848
1848
|
value: h,
|
|
1849
1849
|
onChange: g,
|
|
1850
1850
|
disabled: i || _ || y,
|
|
1851
|
-
children: /* @__PURE__ */ I(
|
|
1851
|
+
children: /* @__PURE__ */ I(Gt, {
|
|
1852
1852
|
ids: m,
|
|
1853
1853
|
preview: D.preview,
|
|
1854
1854
|
brand: D.brand,
|
|
@@ -1880,7 +1880,7 @@ function Cn({ tokenizationKey: e, tokenizationURL: t, onTokenized: n, submitLabe
|
|
|
1880
1880
|
className: "text-sm text-destructive",
|
|
1881
1881
|
children: x
|
|
1882
1882
|
}) : null,
|
|
1883
|
-
/* @__PURE__ */ I(
|
|
1883
|
+
/* @__PURE__ */ I($, {
|
|
1884
1884
|
label: r,
|
|
1885
1885
|
processing: _,
|
|
1886
1886
|
disabled: i || y || !O || !D.ready || !D.valid || !!D.loadError
|
|
@@ -1932,7 +1932,7 @@ function En({ 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
1938
|
d(Tn(a, e)), l((e) => e + 1);
|
|
@@ -1954,11 +1954,11 @@ function Dn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
1954
1954
|
expiry: `orck-save-${s}-expiry`,
|
|
1955
1955
|
cvv: `orck-save-${s}-cvv`
|
|
1956
1956
|
}), [s]), l = Sn(), [u, d] = F.useState(() => ({
|
|
1957
|
-
...
|
|
1958
|
-
country:
|
|
1957
|
+
...At,
|
|
1958
|
+
country: Mt(r)
|
|
1959
1959
|
})), [f, p] = F.useState(!1), [m, h] = F.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,7 +1970,7 @@ function Dn({ 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",
|
|
@@ -1990,12 +1990,12 @@ function Dn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
1990
1990
|
noValidate: !0,
|
|
1991
1991
|
onSubmit: (e) => void g(e),
|
|
1992
1992
|
children: [
|
|
1993
|
-
/* @__PURE__ */ I(
|
|
1993
|
+
/* @__PURE__ */ I(Vt, {
|
|
1994
1994
|
idPrefix: `orck-save-${s}`,
|
|
1995
1995
|
value: u,
|
|
1996
1996
|
onChange: d,
|
|
1997
1997
|
disabled: f,
|
|
1998
|
-
children: /* @__PURE__ */ I(
|
|
1998
|
+
children: /* @__PURE__ */ I(qt, {
|
|
1999
1999
|
ids: c,
|
|
2000
2000
|
card: l,
|
|
2001
2001
|
disabled: f
|
|
@@ -2006,17 +2006,17 @@ function Dn({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
2006
2006
|
className: "text-sm text-destructive",
|
|
2007
2007
|
children: m
|
|
2008
2008
|
}) : null,
|
|
2009
|
-
/* @__PURE__ */ I(
|
|
2009
|
+
/* @__PURE__ */ I($, {
|
|
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
2014
|
/* @__PURE__ */ I(Jt, {})
|
|
2015
2015
|
]
|
|
2016
2016
|
});
|
|
2017
2017
|
}
|
|
2018
2018
|
function On({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
2019
|
-
let i = y(), { t: a } = i, { client: o, notify: s } = M(), c = F.useRef(null), [l, u] = F.useState(!1), [d, f] = F.useState(!1), [p, m] = F.useState(), h = F.useMemo(() =>
|
|
2019
|
+
let i = y(), { t: a } = i, { client: o, notify: s } = M(), c = F.useRef(null), [l, u] = F.useState(!1), [d, f] = F.useState(!1), [p, m] = F.useState(), h = F.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 {
|
|
@@ -2050,7 +2050,7 @@ function On({ psp: e, onSaved: t, submitLabel: n, defaultCountry: r }) {
|
|
|
2050
2050
|
className: "text-sm text-destructive",
|
|
2051
2051
|
children: p
|
|
2052
2052
|
}) : null,
|
|
2053
|
-
/* @__PURE__ */ I(
|
|
2053
|
+
/* @__PURE__ */ I($, {
|
|
2054
2054
|
label: n ?? a("paymentMethods.save"),
|
|
2055
2055
|
processing: d,
|
|
2056
2056
|
disabled: !l
|
|
@@ -2078,7 +2078,7 @@ function kn({ 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
2084
|
if (l(Tn(a, e)), n(e) && (e.status === 400 || e.status === 402)) return !1;
|
|
@@ -2109,7 +2109,7 @@ function An() {
|
|
|
2109
2109
|
//#endregion
|
|
2110
2110
|
//#region src/account/payment-methods-panel.tsx
|
|
2111
2111
|
function jn(e, t) {
|
|
2112
|
-
return
|
|
2112
|
+
return we(e.card, t);
|
|
2113
2113
|
}
|
|
2114
2114
|
function Mn(e, t) {
|
|
2115
2115
|
return e.status === 409 && e.code === "resource_conflict" ? t.t("paymentMethods.inUse") : e.status === 503 || e.code === "invalid_response" ? t.t("paymentMethods.removeFailed") : t.error(e);
|
|
@@ -2143,10 +2143,10 @@ function Nn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2143
2143
|
message: a.error(t)
|
|
2144
2144
|
}) : j(o("paymentMethods.defaultUpdated"));
|
|
2145
2145
|
}, re, N = c.methods;
|
|
2146
|
-
re = N === null && c.error ? /* @__PURE__ */ I(
|
|
2146
|
+
re = N === null && c.error ? /* @__PURE__ */ I(Z, {
|
|
2147
2147
|
error: c.error,
|
|
2148
2148
|
onRetry: c.refetch
|
|
2149
|
-
}) : N === null ? /* @__PURE__ */ I(
|
|
2149
|
+
}) : N === null ? /* @__PURE__ */ I(Re, {}) : N.length === 0 ? /* @__PURE__ */ I(ze, {
|
|
2150
2150
|
title: o("paymentMethods.empty"),
|
|
2151
2151
|
description: o("paymentMethods.emptyDescription")
|
|
2152
2152
|
}) : /* @__PURE__ */ I("ul", {
|
|
@@ -2158,7 +2158,7 @@ function Nn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
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__ */ I(
|
|
2161
|
+
/* @__PURE__ */ I(Ze, {
|
|
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 Nn({ 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__ */ I(
|
|
2176
|
-
i.length > 0 ? /* @__PURE__ */ I(
|
|
2175
|
+
r === "expired" || r === "expiring_soon" ? /* @__PURE__ */ I(Ue, { status: r }) : e.health?.active === !1 ? /* @__PURE__ */ I(Ue, { status: "needs_attention" }) : null,
|
|
2176
|
+
i.length > 0 ? /* @__PURE__ */ I(Ue, {
|
|
2177
2177
|
status: "default",
|
|
2178
2178
|
label: o("paymentMethods.defaultFor", { currencies: i.join(", ") })
|
|
2179
2179
|
}) : null
|
|
@@ -2192,14 +2192,14 @@ function Nn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2192
2192
|
}),
|
|
2193
2193
|
/* @__PURE__ */ L("div", {
|
|
2194
2194
|
className: "ml-auto flex items-center gap-1",
|
|
2195
|
-
children: [M && !i.includes(M) ? /* @__PURE__ */ L(
|
|
2195
|
+
children: [M && !i.includes(M) ? /* @__PURE__ */ L(U, {
|
|
2196
2196
|
variant: "ghost",
|
|
2197
2197
|
size: "sm",
|
|
2198
2198
|
className: "text-muted-foreground",
|
|
2199
2199
|
disabled: !!s,
|
|
2200
2200
|
onClick: () => void ne(e),
|
|
2201
|
-
children: [s === "default" ? /* @__PURE__ */ I(
|
|
2202
|
-
}) : null, /* @__PURE__ */ I(
|
|
2201
|
+
children: [s === "default" ? /* @__PURE__ */ I(_t, {}) : null, o("paymentMethods.makeDefault")]
|
|
2202
|
+
}) : null, /* @__PURE__ */ I(U, {
|
|
2203
2203
|
variant: "destructive",
|
|
2204
2204
|
size: "icon-sm",
|
|
2205
2205
|
className: "bg-red-600 text-white hover:bg-red-700",
|
|
@@ -2209,7 +2209,7 @@ function Nn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2209
2209
|
onClick: () => {
|
|
2210
2210
|
f(null), u(e);
|
|
2211
2211
|
},
|
|
2212
|
-
children: s === "remove" ? /* @__PURE__ */ I(
|
|
2212
|
+
children: s === "remove" ? /* @__PURE__ */ I(_t, {}) : /* @__PURE__ */ I(se, {
|
|
2213
2213
|
icon: de,
|
|
2214
2214
|
"aria-hidden": !0
|
|
2215
2215
|
})
|
|
@@ -2220,13 +2220,13 @@ function Nn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2220
2220
|
})
|
|
2221
2221
|
});
|
|
2222
2222
|
let P = l ? c.pending[l.id] === "remove" : !1, ie = l ? jn(l, a) : "";
|
|
2223
|
-
return /* @__PURE__ */ L(
|
|
2223
|
+
return /* @__PURE__ */ L(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: A ? /* @__PURE__ */ L(
|
|
2229
|
+
action: A ? /* @__PURE__ */ L(U, {
|
|
2230
2230
|
variant: "outline",
|
|
2231
2231
|
size: "sm",
|
|
2232
2232
|
onClick: () => v(!0),
|
|
@@ -2240,14 +2240,14 @@ function Nn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2240
2240
|
re,
|
|
2241
2241
|
N !== null && c.error ? /* @__PURE__ */ I("div", {
|
|
2242
2242
|
className: "pt-3",
|
|
2243
|
-
children: /* @__PURE__ */ I(
|
|
2243
|
+
children: /* @__PURE__ */ I(Z, {
|
|
2244
2244
|
error: c.error,
|
|
2245
2245
|
onRetry: c.refetch
|
|
2246
2246
|
})
|
|
2247
2247
|
}) : null,
|
|
2248
2248
|
b.error ? /* @__PURE__ */ I("div", {
|
|
2249
2249
|
className: "pt-3",
|
|
2250
|
-
children: /* @__PURE__ */ I(
|
|
2250
|
+
children: /* @__PURE__ */ I(Z, {
|
|
2251
2251
|
error: b.error,
|
|
2252
2252
|
message: o("paymentMethods.addUnavailable"),
|
|
2253
2253
|
onRetry: b.refetch
|
|
@@ -2258,43 +2258,43 @@ function Nn({ defaultCurrency: e, defaultCountry: t, appearance: n, className: r
|
|
|
2258
2258
|
children: o("paymentMethods.addUnavailable")
|
|
2259
2259
|
}),
|
|
2260
2260
|
ee,
|
|
2261
|
-
/* @__PURE__ */ I(
|
|
2261
|
+
/* @__PURE__ */ I(et, {
|
|
2262
2262
|
open: l !== null,
|
|
2263
2263
|
onOpenChange: (e) => {
|
|
2264
2264
|
!e && !P && u(null);
|
|
2265
2265
|
},
|
|
2266
|
-
children: /* @__PURE__ */ L(
|
|
2267
|
-
className: `${s.className} ${
|
|
2266
|
+
children: /* @__PURE__ */ L(rt, {
|
|
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__ */ L(
|
|
2271
|
+
/* @__PURE__ */ L(it, { children: [/* @__PURE__ */ I(ot, { children: o("paymentMethods.removeTitle", { label: ie }) }), /* @__PURE__ */ I(st, { children: o("paymentMethods.removeDescription") })] }),
|
|
2272
2272
|
d ? /* @__PURE__ */ I("p", {
|
|
2273
2273
|
role: "alert",
|
|
2274
2274
|
className: "text-sm text-destructive",
|
|
2275
2275
|
children: d
|
|
2276
2276
|
}) : null,
|
|
2277
|
-
/* @__PURE__ */ L(
|
|
2277
|
+
/* @__PURE__ */ L(at, { children: [/* @__PURE__ */ I(ct, {
|
|
2278
2278
|
disabled: P,
|
|
2279
2279
|
children: o("common.cancel")
|
|
2280
|
-
}), /* @__PURE__ */ L(
|
|
2280
|
+
}), /* @__PURE__ */ L(U, {
|
|
2281
2281
|
variant: "destructive",
|
|
2282
2282
|
disabled: P,
|
|
2283
2283
|
onClick: () => void te(),
|
|
2284
|
-
children: [P ? /* @__PURE__ */ I(
|
|
2284
|
+
children: [P ? /* @__PURE__ */ I(_t, {}) : null, o("paymentMethods.removeConfirm")]
|
|
2285
2285
|
})] })
|
|
2286
2286
|
]
|
|
2287
2287
|
})
|
|
2288
2288
|
}),
|
|
2289
|
-
A ? /* @__PURE__ */ I(
|
|
2289
|
+
A ? /* @__PURE__ */ I(lt, {
|
|
2290
2290
|
open: g,
|
|
2291
2291
|
onOpenChange: v,
|
|
2292
|
-
children: /* @__PURE__ */ L(
|
|
2293
|
-
className: `${s.className} ${
|
|
2292
|
+
children: /* @__PURE__ */ L(ft, {
|
|
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__ */ L(
|
|
2297
|
+
/* @__PURE__ */ L(pt, { children: [/* @__PURE__ */ I(ht, { children: o("paymentMethods.addTitle") }), /* @__PURE__ */ I(gt, { children: o("paymentMethods.addDescription") })] }),
|
|
2298
2298
|
C.length > 1 ? /* @__PURE__ */ L("label", {
|
|
2299
2299
|
className: "grid gap-1.5 text-sm",
|
|
2300
2300
|
children: [o("paymentMethods.provider"), /* @__PURE__ */ I("select", {
|
|
@@ -2339,13 +2339,13 @@ function Fn({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, on
|
|
|
2339
2339
|
let e = await a(f, h);
|
|
2340
2340
|
e ? p(e) || x(e) : t(!1);
|
|
2341
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__ */ I(
|
|
2342
|
+
return /* @__PURE__ */ I(et, {
|
|
2343
2343
|
open: e,
|
|
2344
2344
|
onOpenChange: (e) => {
|
|
2345
2345
|
!e && S || t(e);
|
|
2346
2346
|
},
|
|
2347
|
-
children: /* @__PURE__ */ I(
|
|
2348
|
-
className: `${l.className} ${
|
|
2347
|
+
children: /* @__PURE__ */ I(rt, {
|
|
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__ */ L("form", {
|
|
@@ -2355,11 +2355,11 @@ function Fn({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, on
|
|
|
2355
2355
|
e.preventDefault(), T();
|
|
2356
2356
|
},
|
|
2357
2357
|
children: [
|
|
2358
|
-
/* @__PURE__ */ L(
|
|
2358
|
+
/* @__PURE__ */ L(it, { children: [/* @__PURE__ */ I(ot, { children: c("cancel.title", { name: n }) }), /* @__PURE__ */ I(st, { children: c("cancel.description") })] }),
|
|
2359
2359
|
/* @__PURE__ */ L("div", {
|
|
2360
2360
|
className: "grid gap-2",
|
|
2361
2361
|
children: [
|
|
2362
|
-
/* @__PURE__ */ I(
|
|
2362
|
+
/* @__PURE__ */ I(Q, {
|
|
2363
2363
|
htmlFor: u,
|
|
2364
2364
|
children: c("cancel.reasonLabel")
|
|
2365
2365
|
}),
|
|
@@ -2407,14 +2407,14 @@ function Fn({ open: e, onOpenChange: t, name: n, onChain: r = !1, pending: i, on
|
|
|
2407
2407
|
className: "text-sm text-destructive",
|
|
2408
2408
|
children: s.error(b)
|
|
2409
2409
|
}) : null,
|
|
2410
|
-
/* @__PURE__ */ L(
|
|
2410
|
+
/* @__PURE__ */ L(at, { children: [/* @__PURE__ */ I(ct, {
|
|
2411
2411
|
disabled: S,
|
|
2412
2412
|
children: c("cancel.keep")
|
|
2413
|
-
}), /* @__PURE__ */ L(
|
|
2413
|
+
}), /* @__PURE__ */ L(U, {
|
|
2414
2414
|
type: "submit",
|
|
2415
2415
|
variant: "destructive",
|
|
2416
2416
|
disabled: S,
|
|
2417
|
-
children: [S ? /* @__PURE__ */ I(
|
|
2417
|
+
children: [S ? /* @__PURE__ */ I(_t, {}) : null, E]
|
|
2418
2418
|
})] })
|
|
2419
2419
|
]
|
|
2420
2420
|
})
|
|
@@ -2450,14 +2450,14 @@ function zn(e, t) {
|
|
|
2450
2450
|
}
|
|
2451
2451
|
function Bn({ subscription: e, name: t, onOpenChange: n, pending: r, onConfirm: i, mode: a = "change", description: o, appearance: s }) {
|
|
2452
2452
|
let c = k(s);
|
|
2453
|
-
return /* @__PURE__ */ I(
|
|
2453
|
+
return /* @__PURE__ */ I(lt, {
|
|
2454
2454
|
open: e !== null,
|
|
2455
2455
|
onOpenChange: (e) => {
|
|
2456
2456
|
!e && r || n(e);
|
|
2457
2457
|
},
|
|
2458
|
-
children: /* @__PURE__ */ I(
|
|
2458
|
+
children: /* @__PURE__ */ I(ft, {
|
|
2459
2459
|
showCloseButton: !1,
|
|
2460
|
-
className: `${c.className} ${
|
|
2460
|
+
className: `${c.className} ${q} max-h-[calc(100dvh-2rem)] overflow-y-auto bg-popover text-popover-foreground`,
|
|
2461
2461
|
"data-orck-theme": c["data-orck-theme"],
|
|
2462
2462
|
style: c.style,
|
|
2463
2463
|
children: e ? /* @__PURE__ */ I(Vn, {
|
|
@@ -2499,10 +2499,10 @@ function Vn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i, m
|
|
|
2499
2499
|
}
|
|
2500
2500
|
}
|
|
2501
2501
|
}, j;
|
|
2502
|
-
return j = w === null && d.error ? /* @__PURE__ */ I(
|
|
2502
|
+
return j = w === null && d.error ? /* @__PURE__ */ I(Z, {
|
|
2503
2503
|
error: d.error,
|
|
2504
2504
|
onRetry: d.refetch
|
|
2505
|
-
}) : w === null ? /* @__PURE__ */ I(
|
|
2505
|
+
}) : w === null ? /* @__PURE__ */ I(Re, { rows: 2 }) : a === "resume" ? _ ? /* @__PURE__ */ I(Hn, {
|
|
2506
2506
|
subscription: e,
|
|
2507
2507
|
appearance: s,
|
|
2508
2508
|
onSaved: (e) => {
|
|
@@ -2522,7 +2522,7 @@ function Vn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i, m
|
|
|
2522
2522
|
children: l("resume.chooseCard")
|
|
2523
2523
|
}), O.map(({ id: e, card: t }) => /* @__PURE__ */ I("option", {
|
|
2524
2524
|
value: e,
|
|
2525
|
-
children:
|
|
2525
|
+
children: we(t.card, c)
|
|
2526
2526
|
}, e))]
|
|
2527
2527
|
})]
|
|
2528
2528
|
}) : /* @__PURE__ */ I(In, {
|
|
@@ -2534,8 +2534,8 @@ function Vn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i, m
|
|
|
2534
2534
|
"aria-label": l("changeCard.title", { name: t }),
|
|
2535
2535
|
className: "grid gap-0",
|
|
2536
2536
|
children: O.map(({ id: e, card: t }) => {
|
|
2537
|
-
let n = `${u}-${e}`, r =
|
|
2538
|
-
return /* @__PURE__ */ L(
|
|
2537
|
+
let n = `${u}-${e}`, r = we(t.card, c);
|
|
2538
|
+
return /* @__PURE__ */ L(Q, {
|
|
2539
2539
|
htmlFor: n,
|
|
2540
2540
|
"data-testid": "change-card-option",
|
|
2541
2541
|
className: R("flex cursor-pointer items-center gap-3 py-1.5 select-none", C && "cursor-default"),
|
|
@@ -2544,7 +2544,7 @@ function Vn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i, m
|
|
|
2544
2544
|
id: n,
|
|
2545
2545
|
value: e
|
|
2546
2546
|
}),
|
|
2547
|
-
/* @__PURE__ */ I(
|
|
2547
|
+
/* @__PURE__ */ I(Ze, {
|
|
2548
2548
|
brand: t.card?.brand ?? void 0,
|
|
2549
2549
|
fallback: (t.card?.brand ?? "card").slice(0, 4)
|
|
2550
2550
|
}),
|
|
@@ -2562,9 +2562,9 @@ function Vn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i, m
|
|
|
2562
2562
|
}), /* @__PURE__ */ L("div", {
|
|
2563
2563
|
className: "grid gap-5",
|
|
2564
2564
|
children: [
|
|
2565
|
-
/* @__PURE__ */ L(
|
|
2565
|
+
/* @__PURE__ */ L(pt, { children: [/* @__PURE__ */ I(ht, { children: l(a === "resume" ? "resume.title" : "changeCard.title", { name: t }) }), /* @__PURE__ */ I(gt, { children: o ?? l(w !== null && !k ? "changeCard.none" : "changeCard.description") })] }),
|
|
2566
2566
|
j,
|
|
2567
|
-
w !== null && d.error ? /* @__PURE__ */ I(
|
|
2567
|
+
w !== null && d.error ? /* @__PURE__ */ I(Z, {
|
|
2568
2568
|
error: d.error,
|
|
2569
2569
|
onRetry: d.refetch
|
|
2570
2570
|
}) : null,
|
|
@@ -2573,7 +2573,7 @@ function Vn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i, m
|
|
|
2573
2573
|
className: "text-sm text-muted-foreground",
|
|
2574
2574
|
children: l("resume.savedCardUnavailable")
|
|
2575
2575
|
}) : null,
|
|
2576
|
-
a === "resume" && w !== null ? /* @__PURE__ */ I(
|
|
2576
|
+
a === "resume" && w !== null ? /* @__PURE__ */ I(U, {
|
|
2577
2577
|
type: "button",
|
|
2578
2578
|
variant: "link",
|
|
2579
2579
|
disabled: C || _ && w.length === 0,
|
|
@@ -2585,27 +2585,27 @@ function Vn({ subscription: e, name: t, pending: n, onCancel: r, onConfirm: i, m
|
|
|
2585
2585
|
className: "text-sm text-destructive",
|
|
2586
2586
|
children: c.error(h)
|
|
2587
2587
|
}) : null,
|
|
2588
|
-
/* @__PURE__ */ L(
|
|
2588
|
+
/* @__PURE__ */ L(mt, { children: [/* @__PURE__ */ I(U, {
|
|
2589
2589
|
type: "button",
|
|
2590
2590
|
variant: "outline",
|
|
2591
2591
|
disabled: C,
|
|
2592
2592
|
onClick: r,
|
|
2593
2593
|
children: l("common.cancel")
|
|
2594
|
-
}), _ ? null : /* @__PURE__ */ L(
|
|
2594
|
+
}), _ ? null : /* @__PURE__ */ L(U, {
|
|
2595
2595
|
type: "button",
|
|
2596
2596
|
onClick: () => void ee(),
|
|
2597
2597
|
disabled: C || !A || a === "change" && p === f,
|
|
2598
|
-
children: [C ? /* @__PURE__ */ I(
|
|
2598
|
+
children: [C ? /* @__PURE__ */ I(_t, {}) : null, l(a === "resume" ? "resume.confirm" : "changeCard.confirm")]
|
|
2599
2599
|
})] })
|
|
2600
2600
|
]
|
|
2601
2601
|
});
|
|
2602
2602
|
}
|
|
2603
2603
|
function Hn({ subscription: e, appearance: t, onSaved: n }) {
|
|
2604
2604
|
let { t: r } = y(), a = S(), o = i(a.config?.payment.psps ?? []).filter((t) => m(t) && (!e.psp_id || t.psp_id === e.psp_id) && (!e.rail || t.rail === e.rail)), [s, c] = F.useState(), l = o.find((e) => e.psp_id === s) ?? o[0];
|
|
2605
|
-
return a.error ? /* @__PURE__ */ I(
|
|
2605
|
+
return a.error ? /* @__PURE__ */ I(Z, {
|
|
2606
2606
|
error: a.error,
|
|
2607
2607
|
onRetry: a.refetch
|
|
2608
|
-
}) : a.loading ? /* @__PURE__ */ I(
|
|
2608
|
+
}) : a.loading ? /* @__PURE__ */ I(Re, { rows: 2 }) : l ? /* @__PURE__ */ L("div", {
|
|
2609
2609
|
className: "grid gap-4",
|
|
2610
2610
|
children: [o.length > 1 ? /* @__PURE__ */ L("label", {
|
|
2611
2611
|
className: "grid gap-2 text-sm",
|
|
@@ -2673,13 +2673,13 @@ function Jn({ subscription: e, name: t, pending: r, changeSubscription: i, sendS
|
|
|
2673
2673
|
if (h.status === "requires_action") return c.t("changePlan.actionRequired");
|
|
2674
2674
|
if (h.status !== "processing" && Wn.delete(Gn(s, m)), h.status === "blocked") return h.message || c.t("errors.generic");
|
|
2675
2675
|
g(!1);
|
|
2676
|
-
let v = r.product.display_name || t, y =
|
|
2676
|
+
let v = r.product.display_name || t, y = G(h.delayed_start ?? h.next_charge_date, u);
|
|
2677
2677
|
return o(h.status === "processing" ? l("changePlan.processing") : h.effective === "period_end" && y ? l("changePlan.scheduled", {
|
|
2678
2678
|
name: v,
|
|
2679
2679
|
date: y
|
|
2680
2680
|
}) : l("changePlan.done", { name: v })), null;
|
|
2681
2681
|
};
|
|
2682
|
-
return /* @__PURE__ */ L(ie, { children: [/* @__PURE__ */ I(
|
|
2682
|
+
return /* @__PURE__ */ L(ie, { children: [/* @__PURE__ */ I(U, {
|
|
2683
2683
|
variant: "ghost",
|
|
2684
2684
|
size: "sm",
|
|
2685
2685
|
disabled: !!r,
|
|
@@ -2708,14 +2708,14 @@ function Jn({ subscription: e, name: t, pending: r, changeSubscription: i, sendS
|
|
|
2708
2708
|
}
|
|
2709
2709
|
function Yn({ open: e, onOpenChange: t, appearance: n, busy: r, ...i }) {
|
|
2710
2710
|
let a = k(n);
|
|
2711
|
-
return /* @__PURE__ */ I(
|
|
2711
|
+
return /* @__PURE__ */ I(lt, {
|
|
2712
2712
|
open: e,
|
|
2713
2713
|
onOpenChange: (e) => {
|
|
2714
2714
|
!e && r || t(e);
|
|
2715
2715
|
},
|
|
2716
|
-
children: /* @__PURE__ */ I(
|
|
2716
|
+
children: /* @__PURE__ */ I(ft, {
|
|
2717
2717
|
showCloseButton: !1,
|
|
2718
|
-
className: `${a.className} ${
|
|
2718
|
+
className: `${a.className} ${q} bg-popover text-popover-foreground`,
|
|
2719
2719
|
"data-orck-theme": a["data-orck-theme"],
|
|
2720
2720
|
style: a.style,
|
|
2721
2721
|
children: e ? /* @__PURE__ */ I(Xn, {
|
|
@@ -2728,10 +2728,10 @@ function Yn({ open: e, onOpenChange: t, appearance: n, busy: r, ...i }) {
|
|
|
2728
2728
|
}
|
|
2729
2729
|
function Xn({ name: e, options: t, busy: n, stage: r, onConfirm: i, onCancel: a }) {
|
|
2730
2730
|
let o = y(), { t: s } = o, { locale: c } = E(), l = ee(), u = F.useId(), [d, f] = F.useState(""), [p, m] = F.useState(null), h = t.options, g = h?.find((e) => e.price.id === d), _;
|
|
2731
|
-
return _ = h === null && t.error ? /* @__PURE__ */ I(
|
|
2731
|
+
return _ = h === null && t.error ? /* @__PURE__ */ I(Z, {
|
|
2732
2732
|
error: t.error,
|
|
2733
2733
|
onRetry: t.refetch
|
|
2734
|
-
}) : h === null ? /* @__PURE__ */ I(
|
|
2734
|
+
}) : h === null ? /* @__PURE__ */ I(Re, { rows: 2 }) : /* @__PURE__ */ I(In, {
|
|
2735
2735
|
value: d,
|
|
2736
2736
|
onValueChange: (e) => {
|
|
2737
2737
|
typeof e == "string" && e && f(e);
|
|
@@ -2740,8 +2740,8 @@ function Xn({ name: e, options: t, busy: n, stage: r, onConfirm: i, onCancel: a
|
|
|
2740
2740
|
"aria-label": s("changePlan.title", { name: e }),
|
|
2741
2741
|
className: "grid gap-0",
|
|
2742
2742
|
children: h.map((e) => {
|
|
2743
|
-
let t = `${u}-${e.price.id}`, r =
|
|
2744
|
-
return /* @__PURE__ */ L(
|
|
2743
|
+
let t = `${u}-${e.price.id}`, r = K(e.price.unit_amount, e.price.currency, l, c), i = be(e.price, o);
|
|
2744
|
+
return /* @__PURE__ */ L(Q, {
|
|
2745
2745
|
htmlFor: t,
|
|
2746
2746
|
"data-testid": "change-plan-option",
|
|
2747
2747
|
className: R("flex cursor-pointer items-start gap-3 py-2 select-none", n && "cursor-default"),
|
|
@@ -2775,35 +2775,35 @@ function Xn({ name: e, options: t, busy: n, stage: r, onConfirm: i, onCancel: a
|
|
|
2775
2775
|
e.preventDefault(), !(!g || n) && (m(null), i(g).then(m));
|
|
2776
2776
|
},
|
|
2777
2777
|
children: [
|
|
2778
|
-
/* @__PURE__ */ L(
|
|
2778
|
+
/* @__PURE__ */ L(pt, { children: [/* @__PURE__ */ I(ht, { children: s("changePlan.title", { name: e }) }), /* @__PURE__ */ I(gt, { children: h?.length === 0 ? s("changePlan.none") : s("changePlan.description") })] }),
|
|
2779
2779
|
_,
|
|
2780
2780
|
p ? /* @__PURE__ */ I("p", {
|
|
2781
2781
|
role: "alert",
|
|
2782
2782
|
className: "text-sm text-destructive",
|
|
2783
2783
|
children: p
|
|
2784
2784
|
}) : null,
|
|
2785
|
-
/* @__PURE__ */ L(
|
|
2785
|
+
/* @__PURE__ */ L(mt, { children: [/* @__PURE__ */ I(U, {
|
|
2786
2786
|
type: "button",
|
|
2787
2787
|
variant: "outline",
|
|
2788
2788
|
disabled: n,
|
|
2789
2789
|
onClick: a,
|
|
2790
2790
|
children: s("common.cancel")
|
|
2791
|
-
}), /* @__PURE__ */ L(
|
|
2791
|
+
}), /* @__PURE__ */ L(U, {
|
|
2792
2792
|
type: "submit",
|
|
2793
2793
|
disabled: n || !g,
|
|
2794
|
-
children: [n ? /* @__PURE__ */ I(
|
|
2794
|
+
children: [n ? /* @__PURE__ */ I(_t, {}) : null, s(r === "signing" ? "changePlan.signing" : r === "confirming" ? "changePlan.confirming" : "changePlan.confirm")]
|
|
2795
2795
|
})] })
|
|
2796
2796
|
]
|
|
2797
2797
|
});
|
|
2798
2798
|
}
|
|
2799
2799
|
function Zn(e, t, n, r) {
|
|
2800
|
-
let i = e.preview, a =
|
|
2800
|
+
let i = e.preview, a = K(i.next_charge_amount, i.currency, n, r), o = G(i.next_charge_date, r);
|
|
2801
2801
|
if (!a || !o) return i.message ?? "";
|
|
2802
2802
|
if (i.effective !== "now") return t.t("changePlan.atPeriodEnd", {
|
|
2803
2803
|
next: a,
|
|
2804
2804
|
date: o
|
|
2805
2805
|
});
|
|
2806
|
-
let s =
|
|
2806
|
+
let s = K(i.amount_due_now, i.currency, n, r);
|
|
2807
2807
|
return s ? t.t(i.is_estimate ? "changePlan.chargeNowEstimate" : "changePlan.chargeNow", {
|
|
2808
2808
|
amount: s,
|
|
2809
2809
|
next: a,
|
|
@@ -2814,26 +2814,26 @@ function Zn(e, t, n, r) {
|
|
|
2814
2814
|
//#region src/account/resume-dialog.tsx
|
|
2815
2815
|
function Qn({ open: e, onOpenChange: t, name: n, price: r, date: i, busy: a, onConfirm: o, appearance: s }) {
|
|
2816
2816
|
let c = y().t, l = k(s);
|
|
2817
|
-
return /* @__PURE__ */ I(
|
|
2817
|
+
return /* @__PURE__ */ I(et, {
|
|
2818
2818
|
open: e,
|
|
2819
2819
|
onOpenChange: (e) => {
|
|
2820
2820
|
!e && a || t(e);
|
|
2821
2821
|
},
|
|
2822
|
-
children: /* @__PURE__ */ L(
|
|
2823
|
-
className: `${l.className} ${
|
|
2822
|
+
children: /* @__PURE__ */ L(rt, {
|
|
2823
|
+
className: `${l.className} ${q} bg-popover text-popover-foreground`,
|
|
2824
2824
|
"data-orck-theme": l["data-orck-theme"],
|
|
2825
2825
|
style: l.style,
|
|
2826
|
-
children: [/* @__PURE__ */ L(
|
|
2826
|
+
children: [/* @__PURE__ */ L(it, { children: [/* @__PURE__ */ I(ot, { children: c("resume.title", { name: n }) }), /* @__PURE__ */ I(st, { children: r && i ? c("resume.description", {
|
|
2827
2827
|
price: r,
|
|
2828
2828
|
date: i
|
|
2829
|
-
}) : c("resume.descriptionNoDate") })] }), /* @__PURE__ */ L(
|
|
2829
|
+
}) : c("resume.descriptionNoDate") })] }), /* @__PURE__ */ L(at, { children: [/* @__PURE__ */ I(ct, {
|
|
2830
2830
|
disabled: a,
|
|
2831
2831
|
children: c("resume.keepCanceled")
|
|
2832
|
-
}), /* @__PURE__ */ L(
|
|
2832
|
+
}), /* @__PURE__ */ L(U, {
|
|
2833
2833
|
type: "button",
|
|
2834
2834
|
disabled: a,
|
|
2835
2835
|
onClick: o,
|
|
2836
|
-
children: [a ? /* @__PURE__ */ I(
|
|
2836
|
+
children: [a ? /* @__PURE__ */ I(_t, {}) : null, c("resume.confirm")]
|
|
2837
2837
|
})] })]
|
|
2838
2838
|
})
|
|
2839
2839
|
});
|
|
@@ -2844,7 +2844,7 @@ var $n = (e) => (e.rail === "nmi" || e.rail === "stripe") && e.collection_policy
|
|
|
2844
2844
|
function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter: n, appearance: r, className: i, ...a }) {
|
|
2845
2845
|
let o = y(), { t: s } = o, { locale: c, navigate: l } = E(), u = T(a), d = ee(), [f, p] = F.useState(null), [m, h] = F.useState(null), [g, _] = F.useState(null), [v, b] = F.useState(null), [x, S] = An(), C = F.useMemo(() => {
|
|
2846
2846
|
let e = u.subscriptions ?? [];
|
|
2847
|
-
return [...e.filter(
|
|
2847
|
+
return [...e.filter(Oe), ...e.filter((e) => !Oe(e))];
|
|
2848
2848
|
}, [u.subscriptions]), w = async (e, t) => {
|
|
2849
2849
|
if (b(null), $n(e) && t !== e.payment_method_id) {
|
|
2850
2850
|
let n = await u.setPaymentMethod(e.id, t);
|
|
@@ -2853,15 +2853,15 @@ function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2853
2853
|
let n = await u.resume(e.id);
|
|
2854
2854
|
return n || (h(null), S(s("subscriptions.resumed"))), n;
|
|
2855
2855
|
}, D = f?.rail === "solana", O;
|
|
2856
|
-
return O = u.subscriptions === null && u.error ? /* @__PURE__ */ I(
|
|
2856
|
+
return O = u.subscriptions === null && u.error ? /* @__PURE__ */ I(Z, {
|
|
2857
2857
|
error: u.error,
|
|
2858
2858
|
onRetry: u.refetch
|
|
2859
|
-
}) : u.subscriptions === null ? /* @__PURE__ */ I(
|
|
2859
|
+
}) : u.subscriptions === null ? /* @__PURE__ */ I(Re, {}) : C.length === 0 ? /* @__PURE__ */ I(ze, {
|
|
2860
2860
|
title: s("subscriptions.empty"),
|
|
2861
2861
|
description: s("subscriptions.emptyDescription"),
|
|
2862
2862
|
action: t ? /* @__PURE__ */ I("a", {
|
|
2863
2863
|
href: t,
|
|
2864
|
-
className:
|
|
2864
|
+
className: _e({
|
|
2865
2865
|
variant: "outline",
|
|
2866
2866
|
size: "sm"
|
|
2867
2867
|
}),
|
|
@@ -2873,10 +2873,10 @@ function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2873
2873
|
}) : /* @__PURE__ */ I("ul", {
|
|
2874
2874
|
className: "-my-1 divide-y divide-border",
|
|
2875
2875
|
children: C.map((t) => {
|
|
2876
|
-
let i =
|
|
2877
|
-
brand:
|
|
2876
|
+
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 ? t.rail === "solana" ? s("subscriptions.wallet") : t.card?.last4 ? s("subscriptions.paidWith", {
|
|
2877
|
+
brand: Ce(t.card.brand, s("paymentMethods.fallbackBrand")),
|
|
2878
2878
|
last4: t.card.last4
|
|
2879
|
-
}) : null : null, O = i && !w ? t.cancel_portal_url : null, k =
|
|
2879
|
+
}) : null : null, O = i && !w ? t.cancel_portal_url : null, k = Ee.has(t.status) && !w && !O, A = (t.resumable && t.collection_policy === "engine" || (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"), ee = t.cancel_scheduled ? "cancel_scheduled" : t.status, j = n?.(t);
|
|
2880
2880
|
return /* @__PURE__ */ L("li", {
|
|
2881
2881
|
"data-testid": "subscription-row",
|
|
2882
2882
|
"data-subscription-id": t.id,
|
|
@@ -2890,7 +2890,7 @@ function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2890
2890
|
children: [/* @__PURE__ */ I("span", {
|
|
2891
2891
|
className: R("truncate text-sm font-semibold", !i && "text-muted-foreground"),
|
|
2892
2892
|
children: l
|
|
2893
|
-
}), /* @__PURE__ */ I(
|
|
2893
|
+
}), /* @__PURE__ */ I(Ue, { status: ee })]
|
|
2894
2894
|
}),
|
|
2895
2895
|
/* @__PURE__ */ I("p", {
|
|
2896
2896
|
className: "text-sm text-muted-foreground tabular-nums",
|
|
@@ -2920,20 +2920,20 @@ function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2920
2920
|
/* @__PURE__ */ L("div", {
|
|
2921
2921
|
className: "flex flex-wrap gap-2 @md:justify-end",
|
|
2922
2922
|
children: [
|
|
2923
|
-
t.resumable ? /* @__PURE__ */ L(
|
|
2923
|
+
t.resumable ? /* @__PURE__ */ L(U, {
|
|
2924
2924
|
variant: "outline",
|
|
2925
2925
|
size: "sm",
|
|
2926
2926
|
disabled: !!a,
|
|
2927
2927
|
onClick: () => {
|
|
2928
2928
|
b(null), h(t);
|
|
2929
2929
|
},
|
|
2930
|
-
children: [a === "resume" ? /* @__PURE__ */ I(
|
|
2930
|
+
children: [a === "resume" ? /* @__PURE__ */ I(_t, {}) : null, s(a === "resume" ? "subscriptions.updating" : "subscriptions.resume")]
|
|
2931
2931
|
}) : null,
|
|
2932
2932
|
O ? /* @__PURE__ */ L("a", {
|
|
2933
2933
|
href: O,
|
|
2934
2934
|
target: "_blank",
|
|
2935
2935
|
rel: "noopener noreferrer",
|
|
2936
|
-
className:
|
|
2936
|
+
className: _e({
|
|
2937
2937
|
variant: "outline",
|
|
2938
2938
|
size: "sm"
|
|
2939
2939
|
}),
|
|
@@ -2942,7 +2942,7 @@ function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2942
2942
|
"aria-hidden": !0
|
|
2943
2943
|
})]
|
|
2944
2944
|
}) : null,
|
|
2945
|
-
|
|
2945
|
+
Ae(t) && (t.rail !== "solana" || e) ? /* @__PURE__ */ I(Jn, {
|
|
2946
2946
|
subscription: t,
|
|
2947
2947
|
name: l,
|
|
2948
2948
|
pending: a,
|
|
@@ -2951,7 +2951,7 @@ function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2951
2951
|
onChanged: S,
|
|
2952
2952
|
appearance: r
|
|
2953
2953
|
}) : null,
|
|
2954
|
-
A ? /* @__PURE__ */ L(
|
|
2954
|
+
A ? /* @__PURE__ */ L(U, {
|
|
2955
2955
|
variant: "ghost",
|
|
2956
2956
|
size: "sm",
|
|
2957
2957
|
disabled: !!a,
|
|
@@ -2959,9 +2959,9 @@ function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2959
2959
|
onClick: () => {
|
|
2960
2960
|
b(null), _(t);
|
|
2961
2961
|
},
|
|
2962
|
-
children: [a === "payment_method" ? /* @__PURE__ */ I(
|
|
2962
|
+
children: [a === "payment_method" ? /* @__PURE__ */ I(_t, {}) : null, s("subscriptions.changeCard")]
|
|
2963
2963
|
}) : null,
|
|
2964
|
-
k ? /* @__PURE__ */ L(
|
|
2964
|
+
k ? /* @__PURE__ */ L(U, {
|
|
2965
2965
|
size: "sm",
|
|
2966
2966
|
className: "bg-red-600 text-white hover:bg-red-700",
|
|
2967
2967
|
disabled: !!a,
|
|
@@ -2969,7 +2969,7 @@ function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2969
2969
|
onClick: () => {
|
|
2970
2970
|
b(null), p(t);
|
|
2971
2971
|
},
|
|
2972
|
-
children: [a === "cancel" || f?.id === t.id && a ? /* @__PURE__ */ I(
|
|
2972
|
+
children: [a === "cancel" || f?.id === t.id && a ? /* @__PURE__ */ I(_t, {}) : null, s("subscriptions.cancel")]
|
|
2973
2973
|
}) : null
|
|
2974
2974
|
]
|
|
2975
2975
|
}),
|
|
@@ -2981,7 +2981,7 @@ function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2981
2981
|
]
|
|
2982
2982
|
}, t.id);
|
|
2983
2983
|
})
|
|
2984
|
-
}), /* @__PURE__ */ L(
|
|
2984
|
+
}), /* @__PURE__ */ L(Le, {
|
|
2985
2985
|
title: s("subscriptions.title"),
|
|
2986
2986
|
description: s("subscriptions.description"),
|
|
2987
2987
|
appearance: r,
|
|
@@ -2991,7 +2991,7 @@ function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2991
2991
|
O,
|
|
2992
2992
|
u.subscriptions !== null && u.error ? /* @__PURE__ */ I("div", {
|
|
2993
2993
|
className: "pt-3",
|
|
2994
|
-
children: /* @__PURE__ */ I(
|
|
2994
|
+
children: /* @__PURE__ */ I(Z, {
|
|
2995
2995
|
error: u.error,
|
|
2996
2996
|
onRetry: u.refetch
|
|
2997
2997
|
})
|
|
@@ -2999,7 +2999,7 @@ function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
2999
2999
|
x,
|
|
3000
3000
|
/* @__PURE__ */ I(Bn, {
|
|
3001
3001
|
subscription: g,
|
|
3002
|
-
name: g ?
|
|
3002
|
+
name: g ? xe(g, o) : "",
|
|
3003
3003
|
onOpenChange: (e) => !e && _(null),
|
|
3004
3004
|
appearance: r,
|
|
3005
3005
|
pending: !!g && u.pending[g.id] === "payment_method",
|
|
@@ -3013,10 +3013,10 @@ function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
3013
3013
|
subscription: m && $n(m) ? m : null,
|
|
3014
3014
|
mode: "resume",
|
|
3015
3015
|
onOpenChange: (e) => !e && h(null),
|
|
3016
|
-
name: m ?
|
|
3016
|
+
name: m ? xe(m, o) : "",
|
|
3017
3017
|
description: m?.price && m.current_period_ends_at ? s("resume.description", {
|
|
3018
|
-
price:
|
|
3019
|
-
date:
|
|
3018
|
+
price: K(m.price.unit_amount, m.price.currency, d, c) ?? "",
|
|
3019
|
+
date: G(m.current_period_ends_at, c) ?? ""
|
|
3020
3020
|
}) : s("resume.descriptionNoDate"),
|
|
3021
3021
|
pending: m ? !!u.pending[m.id] : !1,
|
|
3022
3022
|
onConfirm: (e) => m ? w(m, e) : Promise.resolve(null),
|
|
@@ -3025,9 +3025,9 @@ function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
3025
3025
|
/* @__PURE__ */ I(Qn, {
|
|
3026
3026
|
open: !!m && !$n(m),
|
|
3027
3027
|
onOpenChange: (e) => !e && h(null),
|
|
3028
|
-
name: m ?
|
|
3029
|
-
price: m?.price ?
|
|
3030
|
-
date:
|
|
3028
|
+
name: m ? xe(m, o) : "",
|
|
3029
|
+
price: m?.price ? K(m.price.unit_amount, m.price.currency, d, c) : null,
|
|
3030
|
+
date: G(m?.current_period_ends_at, c),
|
|
3031
3031
|
busy: m ? !!u.pending[m.id] : !1,
|
|
3032
3032
|
onConfirm: async () => {
|
|
3033
3033
|
if (!m) return;
|
|
@@ -3042,7 +3042,7 @@ function er({ sendSolanaTransaction: e, plansHref: t, renderSubscriptionFooter:
|
|
|
3042
3042
|
/* @__PURE__ */ I(Fn, {
|
|
3043
3043
|
open: f !== null,
|
|
3044
3044
|
onOpenChange: (e) => !e && p(null),
|
|
3045
|
-
name: f ?
|
|
3045
|
+
name: f ? xe(f, o) : "",
|
|
3046
3046
|
onChain: D && !!e,
|
|
3047
3047
|
appearance: r,
|
|
3048
3048
|
pending: f ? u.pending[f.id] : void 0,
|
|
@@ -3074,7 +3074,7 @@ function tr({ defaultCurrency: e, defaultCountry: t, sendSolanaTransaction: n, p
|
|
|
3074
3074
|
defaultCountry: t,
|
|
3075
3075
|
appearance: o
|
|
3076
3076
|
}),
|
|
3077
|
-
/* @__PURE__ */ I(
|
|
3077
|
+
/* @__PURE__ */ I(Ge, {
|
|
3078
3078
|
pageSize: a,
|
|
3079
3079
|
appearance: o
|
|
3080
3080
|
})
|
|
@@ -3085,11 +3085,11 @@ function tr({ defaultCurrency: e, defaultCountry: t, sendSolanaTransaction: n, p
|
|
|
3085
3085
|
//#region src/account/renewal-prompt.tsx
|
|
3086
3086
|
function nr({ plansHref: e, appearance: t, className: n }) {
|
|
3087
3087
|
let { t: r } = y(), { navigate: i } = E(), a = k(t), { subscriptions: o } = T();
|
|
3088
|
-
return !o?.length || o.some(
|
|
3088
|
+
return !o?.length || o.some(Oe) ? null : /* @__PURE__ */ L("div", {
|
|
3089
3089
|
"data-testid": "renewal-prompt",
|
|
3090
3090
|
"data-orck-theme": a["data-orck-theme"],
|
|
3091
3091
|
style: a.style,
|
|
3092
|
-
className: R(a.className,
|
|
3092
|
+
className: R(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),
|
|
3093
3093
|
children: [/* @__PURE__ */ L("div", {
|
|
3094
3094
|
className: "grid min-w-0 gap-1",
|
|
3095
3095
|
children: [/* @__PURE__ */ I("p", {
|
|
@@ -3101,7 +3101,7 @@ function nr({ plansHref: e, appearance: t, className: n }) {
|
|
|
3101
3101
|
})]
|
|
3102
3102
|
}), /* @__PURE__ */ I("a", {
|
|
3103
3103
|
href: e,
|
|
3104
|
-
className:
|
|
3104
|
+
className: _e({ size: "sm" }),
|
|
3105
3105
|
onClick: (t) => {
|
|
3106
3106
|
i && (t.preventDefault(), i(e));
|
|
3107
3107
|
},
|
|
@@ -3176,7 +3176,7 @@ function ir({ amountLabel: e, payload: t, statusLine: n }) {
|
|
|
3176
3176
|
}),
|
|
3177
3177
|
t ? /* @__PURE__ */ I("a", {
|
|
3178
3178
|
href: t,
|
|
3179
|
-
className: R(
|
|
3179
|
+
className: R(_e({ variant: "secondary" }), "h-9 w-full max-w-56"),
|
|
3180
3180
|
children: "Open in wallet"
|
|
3181
3181
|
}) : null
|
|
3182
3182
|
]
|
|
@@ -3212,7 +3212,7 @@ function lr({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
3212
3212
|
className: "grid gap-0",
|
|
3213
3213
|
children: [e.map((e) => {
|
|
3214
3214
|
let n = `${i}-${e.id}`, a = t === e.id, o = cr(e), s = e.card?.brand, c = e.card?.last4;
|
|
3215
|
-
return /* @__PURE__ */ L(
|
|
3215
|
+
return /* @__PURE__ */ L(Q, {
|
|
3216
3216
|
htmlFor: n,
|
|
3217
3217
|
className: R("flex cursor-pointer items-center gap-3 py-1.5 select-none", r && "cursor-default"),
|
|
3218
3218
|
children: [
|
|
@@ -3220,7 +3220,7 @@ function lr({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
3220
3220
|
id: n,
|
|
3221
3221
|
value: e.id
|
|
3222
3222
|
}),
|
|
3223
|
-
/* @__PURE__ */ I(
|
|
3223
|
+
/* @__PURE__ */ I(Ze, {
|
|
3224
3224
|
brand: s ?? void 0,
|
|
3225
3225
|
fallback: or(s)
|
|
3226
3226
|
}),
|
|
@@ -3253,7 +3253,7 @@ function lr({ methods: e, value: t, onChange: n, disabled: r, idPrefix: i }) {
|
|
|
3253
3253
|
})
|
|
3254
3254
|
]
|
|
3255
3255
|
}, e.id);
|
|
3256
|
-
}), /* @__PURE__ */ L(
|
|
3256
|
+
}), /* @__PURE__ */ L(Q, {
|
|
3257
3257
|
htmlFor: `${i}-new`,
|
|
3258
3258
|
className: R("flex cursor-pointer items-center gap-3 py-1.5 text-sm font-medium text-muted-foreground select-none", t === "new" && "font-semibold text-foreground", r && "cursor-default"),
|
|
3259
3259
|
children: [
|
|
@@ -3281,12 +3281,12 @@ function ur() {
|
|
|
3281
3281
|
className: "grid gap-4",
|
|
3282
3282
|
"aria-hidden": !0,
|
|
3283
3283
|
children: [
|
|
3284
|
-
/* @__PURE__ */ I(
|
|
3285
|
-
/* @__PURE__ */ I(
|
|
3286
|
-
/* @__PURE__ */ I(
|
|
3287
|
-
/* @__PURE__ */ I(
|
|
3288
|
-
/* @__PURE__ */ I(
|
|
3289
|
-
/* @__PURE__ */ I(
|
|
3284
|
+
/* @__PURE__ */ I(X, { className: "h-3 w-24" }),
|
|
3285
|
+
/* @__PURE__ */ I(X, { className: "h-6 w-52" }),
|
|
3286
|
+
/* @__PURE__ */ I(X, { className: "mt-1.5 h-11 w-full" }),
|
|
3287
|
+
/* @__PURE__ */ I(X, { className: "h-28 w-full" }),
|
|
3288
|
+
/* @__PURE__ */ I(X, { className: "h-11 w-full" }),
|
|
3289
|
+
/* @__PURE__ */ I(X, { className: "mt-1 h-[42px] w-full" })
|
|
3290
3290
|
]
|
|
3291
3291
|
});
|
|
3292
3292
|
}
|
|
@@ -3422,38 +3422,38 @@ function wr({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3422
3422
|
g,
|
|
3423
3423
|
E
|
|
3424
3424
|
]);
|
|
3425
|
-
let H = F.useMemo(() => E?.collection_owner === "engine" ? E.payment_options : [], [E]), pe = F.useMemo(() => (v?.payment.psps ?? []).filter((e) => H.some((t) => t.psp_id === e.psp_id)), [v, H]), me = fr(c, H, pe), he = H.filter((e) => !me.has(e.psp_id)), ge = pe.filter((e) => !me.has(e.psp_id)),
|
|
3425
|
+
let H = F.useMemo(() => E?.collection_owner === "engine" ? E.payment_options : [], [E]), pe = F.useMemo(() => (v?.payment.psps ?? []).filter((e) => H.some((t) => t.psp_id === e.psp_id)), [v, H]), me = fr(c, H, pe), he = H.filter((e) => !me.has(e.psp_id)), ge = pe.filter((e) => !me.has(e.psp_id)), _e = ge.filter((e) => {
|
|
3426
3426
|
let t = s(e);
|
|
3427
3427
|
return (t === "collect_js" || t === "stripe_elements" || xr(e)) && he.some((t) => t.psp_id === e.psp_id && t.accepts.includes("new_card"));
|
|
3428
|
-
}),
|
|
3428
|
+
}), ve = ge.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 || he.some((n) => n.psp_id === t.psp_id && n.saved_payment_method_ids?.includes(e.id)))).map((e) => ({
|
|
3429
3429
|
id: e.id,
|
|
3430
3430
|
psp_id: e.psp_id ?? "",
|
|
3431
3431
|
rail: e.rail ?? "",
|
|
3432
3432
|
card: e.card ?? void 0
|
|
3433
|
-
})),
|
|
3433
|
+
})), W = _e.find((e) => e.psp_id === ne) ?? _e[0], G = he.find((e) => e.accepts.includes("solana_pay")), K = ge.filter((e) => s(e) === null && he.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 ? _e.find((e) => s(e) === "stripe_elements" && !!e.config?.publishable_key) : void 0;
|
|
3434
3434
|
if (!E) return N ? /* @__PURE__ */ I("p", {
|
|
3435
3435
|
role: "alert",
|
|
3436
3436
|
className: "text-sm text-destructive",
|
|
3437
3437
|
children: N
|
|
3438
3438
|
}) : /* @__PURE__ */ I(ur, {});
|
|
3439
|
-
let
|
|
3439
|
+
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) => {
|
|
3440
3440
|
if (D(e.order), e.error) return P(e.order.payment.last_payment_error?.message ?? e.error.message), ue(crypto.randomUUID()), !1;
|
|
3441
3441
|
let t = e.order.payment.next_action;
|
|
3442
3442
|
if (e.order.collection_owner !== "engine" || e.order.payment.status !== "requires_action" || !t) return !0;
|
|
3443
3443
|
if (t.type === "redirect_to_url" && t.url) return window.location.assign(t.url), !0;
|
|
3444
3444
|
let n = t.payload?.client_secret, r = (v?.payment.psps.find((e) => e.psp_id === t.psp_id))?.config?.publishable_key;
|
|
3445
3445
|
if (t.type !== "authenticate" || !n || !r) return P(m.t("paymentMethods.unavailable")), !1;
|
|
3446
|
-
if (de.current && t.psp_id ===
|
|
3446
|
+
if (de.current && t.psp_id === W?.psp_id) await de.current.handleNextAction(n);
|
|
3447
3447
|
else {
|
|
3448
3448
|
let e = await (await Zt(r)).handleNextAction({ clientSecret: n });
|
|
3449
3449
|
if (e.error) throw Error(e.error.message);
|
|
3450
3450
|
}
|
|
3451
|
-
return
|
|
3452
|
-
},
|
|
3451
|
+
return Ae(await g.confirmOrder(E.id));
|
|
3452
|
+
}, je = async (e, t = !1, r) => {
|
|
3453
3453
|
if (z || E.collection_owner !== "engine" || B && !t) return !1;
|
|
3454
3454
|
ae(!0), P(void 0);
|
|
3455
3455
|
try {
|
|
3456
|
-
return await
|
|
3456
|
+
return await Ae(await g.payOrder(E.id, {
|
|
3457
3457
|
payment: await e(),
|
|
3458
3458
|
expectedTotal: E.total,
|
|
3459
3459
|
idempotencyKey: le,
|
|
@@ -3467,39 +3467,39 @@ function wr({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3467
3467
|
} finally {
|
|
3468
3468
|
ae(!1);
|
|
3469
3469
|
}
|
|
3470
|
-
},
|
|
3470
|
+
}, Me = async () => {
|
|
3471
3471
|
if (!(z || E.collection_owner !== "engine")) {
|
|
3472
3472
|
ae(!0), P(void 0);
|
|
3473
3473
|
try {
|
|
3474
|
-
await
|
|
3474
|
+
await Ae({ order: E });
|
|
3475
3475
|
} catch (e) {
|
|
3476
3476
|
P(!n(e) && e instanceof Error && e.message ? e.message : m.error(e));
|
|
3477
3477
|
} finally {
|
|
3478
3478
|
ae(!1);
|
|
3479
3479
|
}
|
|
3480
3480
|
}
|
|
3481
|
-
},
|
|
3481
|
+
}, 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__ */ L(ie, { children: [
|
|
3482
3482
|
"By ",
|
|
3483
|
-
|
|
3483
|
+
Ce ? "subscribing" : "paying",
|
|
3484
3484
|
", you agree to our",
|
|
3485
3485
|
" ",
|
|
3486
|
-
|
|
3487
|
-
href:
|
|
3486
|
+
J.terms_url ? /* @__PURE__ */ I("a", {
|
|
3487
|
+
href: J.terms_url,
|
|
3488
3488
|
target: "_blank",
|
|
3489
3489
|
rel: "noreferrer",
|
|
3490
3490
|
className: "underline",
|
|
3491
3491
|
children: "Terms of Service"
|
|
3492
3492
|
}) : null,
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
href:
|
|
3493
|
+
J.terms_url && J.privacy_url ? " and " : null,
|
|
3494
|
+
J.privacy_url ? /* @__PURE__ */ I("a", {
|
|
3495
|
+
href: J.privacy_url,
|
|
3496
3496
|
target: "_blank",
|
|
3497
3497
|
rel: "noreferrer",
|
|
3498
3498
|
className: "underline",
|
|
3499
3499
|
children: "Privacy Policy"
|
|
3500
3500
|
}) : null,
|
|
3501
3501
|
"."
|
|
3502
|
-
] }) : void 0,
|
|
3502
|
+
] }) : void 0, Y = E.collection_owner === "engine" && (E.status === "open" || E.status === "uncollectible" && !!E.usage) && E.payment.status === "requires_payment_method";
|
|
3503
3503
|
return /* @__PURE__ */ L("div", {
|
|
3504
3504
|
className: R("orck grid gap-5", p),
|
|
3505
3505
|
"data-orck-theme": C(u),
|
|
@@ -3511,21 +3511,21 @@ function wr({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3511
3511
|
className: "flex items-start justify-between gap-4 py-2 text-[13.5px]",
|
|
3512
3512
|
children: [/* @__PURE__ */ L("span", { children: [e.description, e.quantity && e.quantity > 1 ? ` × ${e.quantity}` : ""] }), /* @__PURE__ */ I("span", {
|
|
3513
3513
|
className: "whitespace-nowrap tabular-nums",
|
|
3514
|
-
children:
|
|
3514
|
+
children: De(e.amount)
|
|
3515
3515
|
})]
|
|
3516
3516
|
}, e.id)),
|
|
3517
3517
|
/* @__PURE__ */ L("div", {
|
|
3518
3518
|
className: "flex items-start justify-between gap-4 border-t border-border pt-3 text-[13.5px] font-semibold",
|
|
3519
3519
|
children: [/* @__PURE__ */ I("span", { children: "Total" }), /* @__PURE__ */ I("span", {
|
|
3520
3520
|
className: "whitespace-nowrap tabular-nums",
|
|
3521
|
-
children:
|
|
3521
|
+
children: De(E.total)
|
|
3522
3522
|
})]
|
|
3523
3523
|
}),
|
|
3524
3524
|
E.usage && E.usage.amount_paid !== "0" && /* @__PURE__ */ L("div", {
|
|
3525
3525
|
className: "flex items-start justify-between gap-4 pt-1 text-[13.5px]",
|
|
3526
3526
|
children: [/* @__PURE__ */ I("span", { children: "Due" }), /* @__PURE__ */ I("span", {
|
|
3527
3527
|
className: "whitespace-nowrap tabular-nums",
|
|
3528
|
-
children:
|
|
3528
|
+
children: De(E.usage.amount_due)
|
|
3529
3529
|
})]
|
|
3530
3530
|
})
|
|
3531
3531
|
]
|
|
@@ -3541,7 +3541,7 @@ function wr({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3541
3541
|
role: "status",
|
|
3542
3542
|
className: "text-sm text-muted-foreground",
|
|
3543
3543
|
children: "Your payment is processing."
|
|
3544
|
-
}) : E.status === "open" ?
|
|
3544
|
+
}) : E.status === "open" ? Ne ? /* @__PURE__ */ L("form", {
|
|
3545
3545
|
className: "grid gap-4",
|
|
3546
3546
|
onSubmit: (e) => {
|
|
3547
3547
|
e.preventDefault(), window.location.assign(E.payment.next_action.url);
|
|
@@ -3551,24 +3551,24 @@ function wr({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3551
3551
|
children: [
|
|
3552
3552
|
"Your payment is waiting on",
|
|
3553
3553
|
" ",
|
|
3554
|
-
|
|
3554
|
+
Pe?.display_name ?? "the payment page",
|
|
3555
3555
|
"."
|
|
3556
3556
|
]
|
|
3557
|
-
}), /* @__PURE__ */ I(
|
|
3558
|
-
label: `Continue to ${
|
|
3557
|
+
}), /* @__PURE__ */ I($, {
|
|
3558
|
+
label: `Continue to ${Pe?.display_name ?? "the payment page"}`,
|
|
3559
3559
|
processing: !1
|
|
3560
3560
|
})]
|
|
3561
|
-
}) :
|
|
3561
|
+
}) : q ? /* @__PURE__ */ L("form", {
|
|
3562
3562
|
className: "grid gap-4",
|
|
3563
3563
|
onSubmit: (e) => {
|
|
3564
|
-
e.preventDefault(),
|
|
3564
|
+
e.preventDefault(), Me();
|
|
3565
3565
|
},
|
|
3566
3566
|
children: [
|
|
3567
3567
|
/* @__PURE__ */ I("p", {
|
|
3568
3568
|
className: "text-sm text-muted-foreground",
|
|
3569
3569
|
children: "Your bank asks you to confirm this payment."
|
|
3570
3570
|
}),
|
|
3571
|
-
/* @__PURE__ */ I(
|
|
3571
|
+
/* @__PURE__ */ I($, {
|
|
3572
3572
|
label: "Confirm payment",
|
|
3573
3573
|
processing: z
|
|
3574
3574
|
}),
|
|
@@ -3581,84 +3581,84 @@ function wr({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3581
3581
|
}) : /* @__PURE__ */ L("div", {
|
|
3582
3582
|
className: "grid gap-4",
|
|
3583
3583
|
children: [
|
|
3584
|
-
!B &&
|
|
3585
|
-
publishableKey:
|
|
3586
|
-
amount:
|
|
3584
|
+
!B && Te && ke ? /* @__PURE__ */ I(dr, {
|
|
3585
|
+
publishableKey: Te.config.publishable_key,
|
|
3586
|
+
amount: ke,
|
|
3587
3587
|
currency: E.currency,
|
|
3588
3588
|
onAvailable: ce,
|
|
3589
|
-
onPaymentMethod: (e) =>
|
|
3589
|
+
onPaymentMethod: (e) => je(async () => ({
|
|
3590
3590
|
token: e,
|
|
3591
|
-
psp_id:
|
|
3591
|
+
psp_id: Te.psp_id
|
|
3592
3592
|
}))
|
|
3593
3593
|
}) : null,
|
|
3594
|
-
!B && se &&
|
|
3594
|
+
!B && se && Te && ke ? /* @__PURE__ */ I("p", {
|
|
3595
3595
|
className: "text-center text-[13px] text-muted-foreground",
|
|
3596
3596
|
children: "or pay another way"
|
|
3597
3597
|
}) : null,
|
|
3598
|
-
|
|
3599
|
-
methods:
|
|
3598
|
+
ye.length > 0 ? /* @__PURE__ */ I(lr, {
|
|
3599
|
+
methods: ye,
|
|
3600
3600
|
value: j,
|
|
3601
3601
|
onChange: te,
|
|
3602
|
-
disabled: z || !
|
|
3602
|
+
disabled: z || !Y || !!B,
|
|
3603
3603
|
idPrefix: `orck-order-${E.id}`
|
|
3604
3604
|
}) : null,
|
|
3605
|
-
j === "new" ?
|
|
3605
|
+
j === "new" ? W ? /* @__PURE__ */ L(ie, { children: [_e.length > 1 ? /* @__PURE__ */ I("select", {
|
|
3606
3606
|
"aria-label": "Pay with",
|
|
3607
3607
|
className: "h-9 rounded-md border border-border bg-transparent px-2 text-sm",
|
|
3608
|
-
value:
|
|
3608
|
+
value: W.psp_id,
|
|
3609
3609
|
onChange: (e) => re(e.target.value),
|
|
3610
|
-
children:
|
|
3610
|
+
children: _e.map((e) => /* @__PURE__ */ I("option", {
|
|
3611
3611
|
value: e.psp_id,
|
|
3612
3612
|
children: e.display_name
|
|
3613
3613
|
}, e.psp_id))
|
|
3614
|
-
}) : null, xr(
|
|
3615
|
-
publicKey:
|
|
3616
|
-
submitLabel:
|
|
3617
|
-
disabled: z || !
|
|
3618
|
-
onTokenized: (e) =>
|
|
3614
|
+
}) : null, xr(W) ? /* @__PURE__ */ I(Yt, {
|
|
3615
|
+
publicKey: W.config.public_api_key,
|
|
3616
|
+
submitLabel: Fe,
|
|
3617
|
+
disabled: z || !Y,
|
|
3618
|
+
onTokenized: (e) => je(async () => ({
|
|
3619
3619
|
token: e.payment_token,
|
|
3620
|
-
psp_id:
|
|
3621
|
-
billing_details:
|
|
3620
|
+
psp_id: W.psp_id,
|
|
3621
|
+
billing_details: kt(e)
|
|
3622
3622
|
}), !0)
|
|
3623
|
-
},
|
|
3624
|
-
tokenizationKey:
|
|
3625
|
-
tokenizationURL:
|
|
3626
|
-
submitLabel:
|
|
3627
|
-
disabled: z || !
|
|
3623
|
+
}, W.psp_id) : s(W) === "collect_js" ? /* @__PURE__ */ I(Cn, {
|
|
3624
|
+
tokenizationKey: W.config.tokenization_key,
|
|
3625
|
+
tokenizationURL: W.config.tokenization_url,
|
|
3626
|
+
submitLabel: Fe,
|
|
3627
|
+
disabled: z || !Y,
|
|
3628
3628
|
appearance: u,
|
|
3629
3629
|
defaultCountry: v?.client_country || void 0,
|
|
3630
|
-
saveOptInMerchant:
|
|
3631
|
-
terms:
|
|
3632
|
-
statementDescriptor:
|
|
3633
|
-
onTokenized: (e) =>
|
|
3630
|
+
saveOptInMerchant: Ce ? void 0 : J?.display_name,
|
|
3631
|
+
terms: Ie,
|
|
3632
|
+
statementDescriptor: J?.statement_descriptor ?? void 0,
|
|
3633
|
+
onTokenized: (e) => je(async () => ({
|
|
3634
3634
|
token: e.payment_token,
|
|
3635
|
-
psp_id:
|
|
3636
|
-
billing_details:
|
|
3635
|
+
psp_id: W.psp_id,
|
|
3636
|
+
billing_details: kt(e)
|
|
3637
3637
|
}), !1, e.reusable)
|
|
3638
|
-
},
|
|
3638
|
+
}, W.psp_id) : /* @__PURE__ */ L("form", {
|
|
3639
3639
|
className: "grid gap-4",
|
|
3640
3640
|
onSubmit: (e) => {
|
|
3641
|
-
e.preventDefault(),
|
|
3641
|
+
e.preventDefault(), je(async () => ({
|
|
3642
3642
|
token: await de.current.tokenize(),
|
|
3643
|
-
psp_id:
|
|
3643
|
+
psp_id: W.psp_id
|
|
3644
3644
|
}));
|
|
3645
3645
|
},
|
|
3646
3646
|
children: [
|
|
3647
3647
|
/* @__PURE__ */ I(dn, {
|
|
3648
3648
|
ref: de,
|
|
3649
|
-
psp:
|
|
3649
|
+
psp: W,
|
|
3650
3650
|
client: g,
|
|
3651
3651
|
unavailableMessage: m.t("paymentMethods.unavailable"),
|
|
3652
3652
|
verificationPendingMessage: m.t("paymentMethods.verificationPending")
|
|
3653
|
-
},
|
|
3654
|
-
/* @__PURE__ */ I(
|
|
3655
|
-
label:
|
|
3653
|
+
}, W.psp_id),
|
|
3654
|
+
/* @__PURE__ */ I($, {
|
|
3655
|
+
label: Fe,
|
|
3656
3656
|
processing: z,
|
|
3657
|
-
disabled: !
|
|
3657
|
+
disabled: !Y
|
|
3658
3658
|
}),
|
|
3659
3659
|
/* @__PURE__ */ I(Jt, {})
|
|
3660
3660
|
]
|
|
3661
|
-
})] }) :
|
|
3661
|
+
})] }) : G || xe.length > 0 || Se.length > 0 ? null : v ? /* @__PURE__ */ I("p", {
|
|
3662
3662
|
role: "alert",
|
|
3663
3663
|
className: "text-sm text-destructive",
|
|
3664
3664
|
children: m.t("paymentMethods.unavailable")
|
|
@@ -3668,7 +3668,7 @@ function wr({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3668
3668
|
children: [/* @__PURE__ */ I("p", {
|
|
3669
3669
|
className: "text-destructive",
|
|
3670
3670
|
children: m.error(b)
|
|
3671
|
-
}), /* @__PURE__ */ I(
|
|
3671
|
+
}), /* @__PURE__ */ I(U, {
|
|
3672
3672
|
type: "button",
|
|
3673
3673
|
variant: "outline",
|
|
3674
3674
|
size: "sm",
|
|
@@ -3683,52 +3683,52 @@ function wr({ orderId: e, client: t, returnUrl: r, savedPaymentMethods: i = !0,
|
|
|
3683
3683
|
onSubmit: (e) => {
|
|
3684
3684
|
e.preventDefault();
|
|
3685
3685
|
let t = B ?? j, n = he.some((e) => e.saved_payment_method_ids?.includes(t));
|
|
3686
|
-
|
|
3686
|
+
je(async () => ({ payment_method_id: t }), n).then(() => oe(void 0)).catch(() => oe(t));
|
|
3687
3687
|
},
|
|
3688
|
-
children: /* @__PURE__ */ I(
|
|
3689
|
-
label: B ? "Retry payment" :
|
|
3688
|
+
children: /* @__PURE__ */ I($, {
|
|
3689
|
+
label: B ? "Retry payment" : Fe,
|
|
3690
3690
|
processing: z,
|
|
3691
|
-
disabled: !
|
|
3691
|
+
disabled: !Y
|
|
3692
3692
|
})
|
|
3693
3693
|
}),
|
|
3694
|
-
|
|
3694
|
+
xe.map((e) => /* @__PURE__ */ I("form", {
|
|
3695
3695
|
onSubmit: (t) => {
|
|
3696
|
-
t.preventDefault(),
|
|
3696
|
+
t.preventDefault(), je(async () => ({
|
|
3697
3697
|
return_url: r ?? window.location.href,
|
|
3698
3698
|
psp_id: e.psp_id
|
|
3699
3699
|
}));
|
|
3700
3700
|
},
|
|
3701
|
-
children: /* @__PURE__ */ I(
|
|
3702
|
-
label: `${
|
|
3701
|
+
children: /* @__PURE__ */ I($, {
|
|
3702
|
+
label: `${Fe} with ${e.display_name}`,
|
|
3703
3703
|
processing: z,
|
|
3704
|
-
disabled: !
|
|
3704
|
+
disabled: !Y || !!B
|
|
3705
3705
|
})
|
|
3706
3706
|
}, e.psp_id)),
|
|
3707
|
-
|
|
3707
|
+
Se.length > 0 ? /* @__PURE__ */ L("div", {
|
|
3708
3708
|
className: "grid gap-2 border-t border-border pt-4",
|
|
3709
3709
|
children: [/* @__PURE__ */ I("p", {
|
|
3710
3710
|
className: "text-[13px] text-muted-foreground",
|
|
3711
3711
|
children: "Card payment isn't working?"
|
|
3712
|
-
}),
|
|
3712
|
+
}), Se.map((e) => /* @__PURE__ */ L("button", {
|
|
3713
3713
|
type: "button",
|
|
3714
3714
|
className: "h-9 rounded-md border border-border text-sm",
|
|
3715
|
-
disabled: z || !
|
|
3716
|
-
onClick: () => void
|
|
3715
|
+
disabled: z || !Y || !!B,
|
|
3716
|
+
onClick: () => void je(async () => ({
|
|
3717
3717
|
return_url: r ?? window.location.href,
|
|
3718
3718
|
psp_id: e.psp_id
|
|
3719
3719
|
})),
|
|
3720
3720
|
children: ["Pay with ", e.display_name]
|
|
3721
3721
|
}, e.psp_id))]
|
|
3722
3722
|
}) : null,
|
|
3723
|
-
|
|
3723
|
+
G && we.length > 0 ? /* @__PURE__ */ I("div", {
|
|
3724
3724
|
className: "grid gap-2 border-t border-border pt-4",
|
|
3725
|
-
children:
|
|
3725
|
+
children: we.map((e) => /* @__PURE__ */ L("button", {
|
|
3726
3726
|
type: "button",
|
|
3727
3727
|
className: "h-9 rounded-md border border-border text-sm",
|
|
3728
|
-
disabled: z || !
|
|
3729
|
-
onClick: () => void
|
|
3728
|
+
disabled: z || !Y || !!B,
|
|
3729
|
+
onClick: () => void je(async () => ({
|
|
3730
3730
|
token_symbol: e.symbol,
|
|
3731
|
-
psp_id:
|
|
3731
|
+
psp_id: G.psp_id
|
|
3732
3732
|
})),
|
|
3733
3733
|
children: [
|
|
3734
3734
|
"Pay with ",
|
|
@@ -3949,7 +3949,7 @@ function Ar({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i,
|
|
|
3949
3949
|
onSubmit: (e) => {
|
|
3950
3950
|
e.preventDefault(), k();
|
|
3951
3951
|
},
|
|
3952
|
-
children: [/* @__PURE__ */ I(
|
|
3952
|
+
children: [/* @__PURE__ */ I($, {
|
|
3953
3953
|
label: "Check out",
|
|
3954
3954
|
processing: _,
|
|
3955
3955
|
disabled: !D
|
|
@@ -3974,12 +3974,12 @@ function Ar({ client: e, onOrder: t, onSettled: n, fallbacks: r, appearance: i,
|
|
|
3974
3974
|
//#endregion
|
|
3975
3975
|
//#region src/lib/price-label.ts
|
|
3976
3976
|
function jr(e, t, n, r) {
|
|
3977
|
-
let i =
|
|
3977
|
+
let i = K(e.unit_amount, e.currency, t, r) ?? `${e.unit_amount} ${e.currency}`, a = ve(e.billing_interval_hours);
|
|
3978
3978
|
if (a) return n.t("products.recurring", {
|
|
3979
3979
|
amount: i,
|
|
3980
3980
|
every: n.plural(`interval.every.${a.unit}`, a.count)
|
|
3981
3981
|
});
|
|
3982
|
-
let o =
|
|
3982
|
+
let o = ve(e.access_duration_hours);
|
|
3983
3983
|
return o ? n.t("products.rent", {
|
|
3984
3984
|
amount: i,
|
|
3985
3985
|
period: n.plural(`interval.duration.${o.unit}`, o.count)
|
|
@@ -3988,20 +3988,20 @@ function jr(e, t, n, r) {
|
|
|
3988
3988
|
//#endregion
|
|
3989
3989
|
//#region src/modal.tsx
|
|
3990
3990
|
function Mr({ open: e, onOpenChange: t, appearance: n, children: r }) {
|
|
3991
|
-
return /* @__PURE__ */ I(
|
|
3991
|
+
return /* @__PURE__ */ I(lt, {
|
|
3992
3992
|
open: e,
|
|
3993
3993
|
onOpenChange: t,
|
|
3994
|
-
children: /* @__PURE__ */ L(
|
|
3994
|
+
children: /* @__PURE__ */ L(ft, {
|
|
3995
3995
|
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",
|
|
3996
3996
|
"data-orck-theme": C(n),
|
|
3997
3997
|
style: w(n),
|
|
3998
3998
|
showCloseButton: !0,
|
|
3999
3999
|
children: [
|
|
4000
|
-
/* @__PURE__ */ I(
|
|
4000
|
+
/* @__PURE__ */ I(ht, {
|
|
4001
4001
|
className: "sr-only",
|
|
4002
4002
|
children: "Payment"
|
|
4003
4003
|
}),
|
|
4004
|
-
/* @__PURE__ */ I(
|
|
4004
|
+
/* @__PURE__ */ I(gt, {
|
|
4005
4005
|
className: "sr-only",
|
|
4006
4006
|
children: "Complete your payment"
|
|
4007
4007
|
}),
|
|
@@ -4091,7 +4091,7 @@ function Lr({ price: t, label: i, amount: a, returnUrl: o, fallbacks: s, onPaid:
|
|
|
4091
4091
|
containerType: "normal"
|
|
4092
4092
|
},
|
|
4093
4093
|
children: [
|
|
4094
|
-
/* @__PURE__ */ I(
|
|
4094
|
+
/* @__PURE__ */ I(U, {
|
|
4095
4095
|
disabled: x,
|
|
4096
4096
|
onClick: () => void D(),
|
|
4097
4097
|
children: i ?? jr(t, h, p, m)
|
|
@@ -4133,14 +4133,14 @@ function zr({ products: e, onPaid: t, onSignInRequired: n, signedIn: r, returnUr
|
|
|
4133
4133
|
prices: t.filter((e) => !e.provider || !t.some((t) => !t.provider && (!t.sell_via?.length || t.sell_via.includes("card")) && Rr(t, e)))
|
|
4134
4134
|
};
|
|
4135
4135
|
}).filter((e) => e.prices.length > 0), d;
|
|
4136
|
-
return d = u.length === 0 ? /* @__PURE__ */ I(
|
|
4136
|
+
return d = u.length === 0 ? /* @__PURE__ */ I(ze, { title: c.t("products.empty") }) : u.map(({ product: e, prices: s }) => /* @__PURE__ */ L(Ne, {
|
|
4137
4137
|
className: "gap-4",
|
|
4138
4138
|
"data-testid": "product",
|
|
4139
|
-
children: [/* @__PURE__ */ L(
|
|
4139
|
+
children: [/* @__PURE__ */ L(Pe, { children: [/* @__PURE__ */ I(Fe, {
|
|
4140
4140
|
role: "heading",
|
|
4141
4141
|
"aria-level": 2,
|
|
4142
4142
|
children: e.display_name
|
|
4143
|
-
}), e.description ? /* @__PURE__ */ I(
|
|
4143
|
+
}), e.description ? /* @__PURE__ */ I(J, { children: e.description }) : null] }), /* @__PURE__ */ I(Y, {
|
|
4144
4144
|
className: "flex flex-wrap gap-2",
|
|
4145
4145
|
children: s.map((e) => /* @__PURE__ */ I(Lr, {
|
|
4146
4146
|
price: e,
|
|
@@ -4153,13 +4153,81 @@ function zr({ products: e, onPaid: t, onSignInRequired: n, signedIn: r, returnUr
|
|
|
4153
4153
|
}, e.id))
|
|
4154
4154
|
})]
|
|
4155
4155
|
}, e.id)), /* @__PURE__ */ I("div", {
|
|
4156
|
-
className: R(l.className,
|
|
4156
|
+
className: R(l.className, q, "grid gap-4", s),
|
|
4157
4157
|
"data-orck-theme": l["data-orck-theme"],
|
|
4158
4158
|
style: l.style,
|
|
4159
4159
|
children: d
|
|
4160
4160
|
});
|
|
4161
4161
|
}
|
|
4162
4162
|
//#endregion
|
|
4163
|
-
|
|
4163
|
+
//#region src/lib/billing-notification.ts
|
|
4164
|
+
function Br(e) {
|
|
4165
|
+
return e.data && typeof e.data == "object" && !Array.isArray(e.data) ? e.data : {};
|
|
4166
|
+
}
|
|
4167
|
+
function Vr(e) {
|
|
4168
|
+
return [
|
|
4169
|
+
"payment_method_failed",
|
|
4170
|
+
"payment_method_update_required",
|
|
4171
|
+
"payment_authentication_required",
|
|
4172
|
+
"order_collection_stopped"
|
|
4173
|
+
].includes(e);
|
|
4174
|
+
}
|
|
4175
|
+
function Hr(e) {
|
|
4176
|
+
return Vr(e.kind) || e.kind === "premium_ended" || e.kind === "premium_renewed" && Br(e).downgrade_applied === !0;
|
|
4177
|
+
}
|
|
4178
|
+
function Ur(e) {
|
|
4179
|
+
let t = Br(e).recovery_action ?? (e.kind === "payment_method_update_required" ? "update_payment_method" : e.kind === "payment_authentication_required" ? "authenticate_payment" : void 0);
|
|
4180
|
+
return t === "update_payment_method" || t === "resubscribe" || t === "authenticate_payment" || t === "contact_support" ? t : "manage_billing";
|
|
4181
|
+
}
|
|
4182
|
+
//#endregion
|
|
4183
|
+
//#region src/components/billing-notification.tsx
|
|
4184
|
+
function Wr({ item: e, actions: t = {}, language: n, messages: r, appearance: i }) {
|
|
4185
|
+
let a = y(), o = n || r ? te(r ? v(r) : a.messages, void 0, n ?? a.locale) : a, { t: s } = o;
|
|
4186
|
+
if (!Hr(e)) return null;
|
|
4187
|
+
let c = Br(e), l = e.kind === "payment_method_update_required" ? s("billingNotifications.paymentMethodRequiredTitle") : e.kind === "payment_authentication_required" ? s("billingNotifications.authenticationRequiredTitle") : e.kind === "order_collection_stopped" ? s("billingNotifications.collectionStoppedTitle") : Vr(e.kind) ? s("billingNotifications.paymentFailed") : e.kind === "premium_ended" ? s("billingNotifications.membershipEnded") : s("billingNotifications.membershipDowngraded"), u;
|
|
4188
|
+
if (Vr(e.kind)) {
|
|
4189
|
+
let e = Gr(c.next_attempt_at, o);
|
|
4190
|
+
u = c.retry_status === "scheduled" && e ? s("billingNotifications.retryScheduled", { date: e }) : c.retry_status === "payment_method_required" ? s("billingNotifications.paymentMethodRequired") : c.retry_status === "stopped" ? s("billingNotifications.retryStopped") : s("billingNotifications.retryUnknown");
|
|
4191
|
+
} else if (e.kind === "premium_ended") {
|
|
4192
|
+
let e = Gr(c.ended_at, o);
|
|
4193
|
+
u = e ? s("billingNotifications.endedAt", { date: e }) : s("billingNotifications.ended");
|
|
4194
|
+
} else u = typeof c.from_product_name == "string" && typeof c.to_product_name == "string" && c.from_product_name && c.to_product_name ? s("billingNotifications.downgradedTo", {
|
|
4195
|
+
from: c.from_product_name,
|
|
4196
|
+
to: c.to_product_name
|
|
4197
|
+
}) : s("billingNotifications.downgraded");
|
|
4198
|
+
let d = Ur(e), f = t[d] ?? t.manage_billing, p = t[d] ? d : "manage_billing";
|
|
4199
|
+
return /* @__PURE__ */ L(ge, {
|
|
4200
|
+
appearance: i,
|
|
4201
|
+
className: "grid gap-2",
|
|
4202
|
+
"data-orck": "billing-notification",
|
|
4203
|
+
children: [
|
|
4204
|
+
/* @__PURE__ */ I("p", {
|
|
4205
|
+
className: "font-medium",
|
|
4206
|
+
children: l
|
|
4207
|
+
}),
|
|
4208
|
+
/* @__PURE__ */ I("p", {
|
|
4209
|
+
className: "text-muted-foreground",
|
|
4210
|
+
children: u
|
|
4211
|
+
}),
|
|
4212
|
+
Vr(e.kind) && /* @__PURE__ */ I("p", {
|
|
4213
|
+
className: "text-muted-foreground",
|
|
4214
|
+
children: s(`billingNotifications.instructions.${d}`)
|
|
4215
|
+
}),
|
|
4216
|
+
f && /* @__PURE__ */ I("a", {
|
|
4217
|
+
href: f,
|
|
4218
|
+
className: "font-medium underline underline-offset-4",
|
|
4219
|
+
children: s(`billingNotifications.actions.${p}`)
|
|
4220
|
+
})
|
|
4221
|
+
]
|
|
4222
|
+
});
|
|
4223
|
+
}
|
|
4224
|
+
function Gr(e, t) {
|
|
4225
|
+
if (!(typeof e != "string" || !Number.isFinite(Date.parse(e)))) return new Intl.DateTimeFormat(t.locale, {
|
|
4226
|
+
dateStyle: "medium",
|
|
4227
|
+
timeStyle: "short"
|
|
4228
|
+
}).format(new Date(e));
|
|
4229
|
+
}
|
|
4230
|
+
//#endregion
|
|
4231
|
+
export { tr as AccountBilling, Wr as BillingNotification, b as BillingProvider, Ue as BillingStatusBadge, ge as BillingUiRoot, Lr as BuyButton, Fn as CancelSubscriptionDialog, Ze as CardBrandPlate, Ar as Cart, Or as EmbeddedPayment, wr as OrderPayment, Tr as PAYMENT_COMPLETE_MESSAGE, Er as PAYMENT_RESIZE_MESSAGE, Ge as PaymentHistory, Nn as PaymentMethodsPanel, zr as ProductList, nr as RenewalPrompt, wn as SavePaymentMethod, er as SubscriptionsPanel, Cn as TokenizedCardForm, c as addAmounts, l as amountToDecimal, Un as authenticateChange, Ur as billingNotificationAction, jt as browserCountry, a as canAuthenticatePayment, m as canSavePaymentMethod, s as cardSetupDriver, o as createBillingClient, te as createTranslator, re as defaultMessages, x as defineMessages, d as formatAmount, Mt as initialCountry, ne as interpolate, u as isAmount, Hr as isBillingNotification, g as pspConfigSchema, br as readPaymentFragment, t as redeemAssertion, qe as resolveCardBrand, v as resolveMessages, i as routedPsps, Me as statusTone, h as tokenSource, y as useMessages, yr as withPaymentFallbacks };
|
|
4164
4232
|
|
|
4165
4233
|
//# sourceMappingURL=index.js.map
|