@nextblock-cms/ecom 0.19.2 → 0.19.3
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/lib/components/Cart.cjs.js +1 -1
- package/lib/components/Cart.d.ts +1 -1
- package/lib/components/Cart.es.js +70 -62
- package/lib/components/Checkout.cjs.js +1 -1
- package/lib/components/Checkout.d.ts +1 -1
- package/lib/components/Checkout.es.js +224 -212
- package/lib/components/CustomerProfileForm.d.ts +1 -1
- package/lib/components/FeaturedProduct.cjs.js +1 -1
- package/lib/components/FeaturedProduct.es.js +29 -22
- package/lib/components/ProductDetailsLayout.cjs.js +1 -1
- package/lib/components/ProductDetailsLayout.es.js +27 -28
- package/lib/components/ShippingEstimator.cjs.js +1 -1
- package/lib/components/ShippingEstimator.es.js +64 -58
- package/lib/components/ShortDescription.cjs.js +1 -0
- package/lib/components/ShortDescription.d.ts +19 -0
- package/lib/components/ShortDescription.es.js +18 -0
- package/lib/components/media/MediaPickerDialog.d.ts +1 -1
- package/lib/components/media/MediaUploadForm.d.ts +1 -1
- package/lib/order-inventory.d.ts +1 -1
- package/lib/pages/cms/products/actions.d.ts +20 -20
- package/lib/pages/cms/products/attributes/components/AttributeManager.d.ts +1 -1
- package/lib/pages/cms/shipping/components/RateForm.d.ts +1 -1
- package/lib/product-actions.d.ts +31 -31
- package/lib/shared-inventory.d.ts +1 -1
- package/lib/states.cjs.js +1 -1
- package/lib/states.d.ts +2 -0
- package/lib/states.es.js +63 -29
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { jsxs as r, jsx as e, Fragment as ht } from "react/jsx-runtime";
|
|
3
3
|
import { Badge as Xe } from "@nextblock-cms/ui/badge";
|
|
4
|
-
import { Button as
|
|
4
|
+
import { Button as ke } from "@nextblock-cms/ui/button";
|
|
5
5
|
import { Card as X, CardHeader as Y, CardTitle as W, CardContent as Z } from "@nextblock-cms/ui/card";
|
|
6
6
|
import { Checkbox as gt } from "@nextblock-cms/ui/checkbox";
|
|
7
7
|
import { Input as j } from "@nextblock-cms/ui/input";
|
|
@@ -11,8 +11,8 @@ import { RadioGroup as Ue, RadioGroupItem as Ce } from "@nextblock-cms/ui/radio-
|
|
|
11
11
|
import { Checkout as _t } from "@freemius/checkout";
|
|
12
12
|
import { getCartItemActivePrice as Ae } from "../cart-store.es.js";
|
|
13
13
|
import { useCart as yt } from "../use-cart.es.js";
|
|
14
|
-
import { useState as y, useMemo as
|
|
15
|
-
import { X as bt, FlaskConical as xt, CreditCard as vt, ChevronRight as Nt, Loader2 as Se, Package as
|
|
14
|
+
import { useState as y, useMemo as F, useEffect as V } from "react";
|
|
15
|
+
import { X as bt, FlaskConical as xt, CreditCard as vt, ChevronRight as Nt, Loader2 as Se, Package as wt, Download as kt, MapPin as Ct } from "lucide-react";
|
|
16
16
|
import { useTranslations as Ye } from "@nextblock-cms/utils";
|
|
17
17
|
import { usePriceFormatter as St } from "../use-price-formatter.es.js";
|
|
18
18
|
import { normalizeCountryCode as $t, countries as Ft } from "../countries.es.js";
|
|
@@ -20,17 +20,17 @@ import { usePaymentReadiness as At } from "../PaymentReadinessProvider.es.js";
|
|
|
20
20
|
import { getShippingEstimates as Tt } from "../server-actions/shipping-actions.es.js";
|
|
21
21
|
import { getTaxEstimate as jt } from "../server-actions/tax-actions.es.js";
|
|
22
22
|
import { isDigitalItem as $e } from "../types.es.js";
|
|
23
|
-
import { countryUsesStructuredStates as pe, getStatesForCountry as Je } from "../states.es.js";
|
|
24
|
-
import { addressesMatch as
|
|
25
|
-
import { useCurrency as
|
|
23
|
+
import { countryUsesStructuredStates as pe, getStatesForCountry as Je, getSubdivisionLabel as Et } from "../states.es.js";
|
|
24
|
+
import { addressesMatch as It, emptyCustomerAddress as Mt, normalizeCustomerAddress as Te, isCustomerAddressComplete as Ge } from "../customer.es.js";
|
|
25
|
+
import { useCurrency as Dt } from "../CurrencyProvider.es.js";
|
|
26
26
|
import { getTrialSummary as He } from "../trials.es.js";
|
|
27
|
-
import { CouponForm as
|
|
28
|
-
const
|
|
29
|
-
function ue(n,
|
|
27
|
+
import { CouponForm as Lt } from "./CouponForm.es.js";
|
|
28
|
+
const Rt = process.env.NEXT_PUBLIC_IS_SANDBOX === "true", me = "nextblock-checkout-draft-v1";
|
|
29
|
+
function ue(n, o) {
|
|
30
30
|
return {
|
|
31
|
-
...
|
|
31
|
+
...Mt(),
|
|
32
32
|
company_name: n?.company_name || "",
|
|
33
|
-
recipient_name: n?.recipient_name ||
|
|
33
|
+
recipient_name: n?.recipient_name || o || "",
|
|
34
34
|
line1: n?.line1 || "",
|
|
35
35
|
line2: n?.line2 || "",
|
|
36
36
|
city: n?.city || "",
|
|
@@ -39,40 +39,40 @@ function ue(n, a) {
|
|
|
39
39
|
country_code: $t(n?.country_code) || "CA"
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
const
|
|
44
|
-
return !(!
|
|
42
|
+
function qt(n) {
|
|
43
|
+
const o = Te(n);
|
|
44
|
+
return !(!o?.country_code || !o.postal_code || pe(o.country_code) && !o.state);
|
|
45
45
|
}
|
|
46
|
-
function Fe(n,
|
|
47
|
-
return n.reduce((
|
|
48
|
-
const { price: g, sale_price:
|
|
49
|
-
currencyCode:
|
|
50
|
-
currencies:
|
|
46
|
+
function Fe(n, o, A) {
|
|
47
|
+
return n.reduce((m, f) => {
|
|
48
|
+
const { price: g, sale_price: S } = Ae(f, {
|
|
49
|
+
currencyCode: o,
|
|
50
|
+
currencies: A
|
|
51
51
|
});
|
|
52
|
-
return
|
|
52
|
+
return m + (S ?? g) * f.quantity;
|
|
53
53
|
}, 0);
|
|
54
54
|
}
|
|
55
55
|
function Qe({
|
|
56
56
|
idPrefix: n,
|
|
57
|
-
title:
|
|
58
|
-
description:
|
|
59
|
-
value:
|
|
57
|
+
title: o,
|
|
58
|
+
description: A,
|
|
59
|
+
value: m,
|
|
60
60
|
onChange: f
|
|
61
61
|
}) {
|
|
62
|
-
const { t: g, lang:
|
|
62
|
+
const { t: g, lang: S } = Ye(), E = F(() => {
|
|
63
63
|
try {
|
|
64
|
-
return new Intl.DisplayNames([
|
|
64
|
+
return new Intl.DisplayNames([S], { type: "region" });
|
|
65
65
|
} catch {
|
|
66
66
|
return null;
|
|
67
67
|
}
|
|
68
|
-
}, [
|
|
68
|
+
}, [S]), I = g("company_name") === "company_name" ? "Company name" : g("company_name"), ee = g("select_an_option") === "select_an_option" ? "Select an option" : g("select_an_option"), q = g("state_province") === "state_province" ? "State / Province" : g("state_province"), U = Je(m.country_code), K = pe(m.country_code);
|
|
69
69
|
return /* @__PURE__ */ r(X, { children: [
|
|
70
70
|
/* @__PURE__ */ r(Y, { children: [
|
|
71
71
|
/* @__PURE__ */ r(W, { role: "heading", "aria-level": 2, className: "flex items-center gap-2", children: [
|
|
72
72
|
/* @__PURE__ */ e(Ct, { className: "w-5 h-5" }),
|
|
73
|
-
|
|
73
|
+
o
|
|
74
74
|
] }),
|
|
75
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children:
|
|
75
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: A })
|
|
76
76
|
] }),
|
|
77
77
|
/* @__PURE__ */ r(Z, { className: "space-y-4", children: [
|
|
78
78
|
/* @__PURE__ */ r("div", { className: "grid gap-4 sm:grid-cols-3", children: [
|
|
@@ -84,8 +84,8 @@ function Qe({
|
|
|
84
84
|
id: `${n}-company`,
|
|
85
85
|
name: `${n}-company`,
|
|
86
86
|
autoComplete: `${n} organization`,
|
|
87
|
-
value:
|
|
88
|
-
onChange: (
|
|
87
|
+
value: m.company_name,
|
|
88
|
+
onChange: (u) => f({ ...m, company_name: u.target.value })
|
|
89
89
|
}
|
|
90
90
|
)
|
|
91
91
|
] }),
|
|
@@ -98,8 +98,8 @@ function Qe({
|
|
|
98
98
|
name: `${n}-name`,
|
|
99
99
|
autoComplete: `${n} name`,
|
|
100
100
|
required: !0,
|
|
101
|
-
value:
|
|
102
|
-
onChange: (
|
|
101
|
+
value: m.recipient_name,
|
|
102
|
+
onChange: (u) => f({ ...m, recipient_name: u.target.value })
|
|
103
103
|
}
|
|
104
104
|
)
|
|
105
105
|
] }),
|
|
@@ -113,16 +113,16 @@ function Qe({
|
|
|
113
113
|
autoComplete: `${n} country`,
|
|
114
114
|
required: !0,
|
|
115
115
|
className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
116
|
-
value:
|
|
117
|
-
onChange: (
|
|
118
|
-
const te =
|
|
116
|
+
value: m.country_code,
|
|
117
|
+
onChange: (u) => {
|
|
118
|
+
const te = u.target.value, re = Je(te);
|
|
119
119
|
f({
|
|
120
|
-
...
|
|
120
|
+
...m,
|
|
121
121
|
country_code: te,
|
|
122
|
-
state: re.some((he) => he.code ===
|
|
122
|
+
state: re.some((he) => he.code === m.state) ? m.state : ""
|
|
123
123
|
});
|
|
124
124
|
},
|
|
125
|
-
children: Ft.map((
|
|
125
|
+
children: Ft.map((u) => /* @__PURE__ */ e("option", { value: u.code, children: E?.of(u.code) ?? u.name }, u.code))
|
|
126
126
|
}
|
|
127
127
|
)
|
|
128
128
|
] })
|
|
@@ -136,8 +136,8 @@ function Qe({
|
|
|
136
136
|
name: `${n}-line1`,
|
|
137
137
|
autoComplete: `${n} address-line1`,
|
|
138
138
|
required: !0,
|
|
139
|
-
value:
|
|
140
|
-
onChange: (
|
|
139
|
+
value: m.line1,
|
|
140
|
+
onChange: (u) => f({ ...m, line1: u.target.value })
|
|
141
141
|
}
|
|
142
142
|
)
|
|
143
143
|
] }),
|
|
@@ -149,8 +149,8 @@ function Qe({
|
|
|
149
149
|
id: `${n}-line2`,
|
|
150
150
|
name: `${n}-line2`,
|
|
151
151
|
autoComplete: `${n} address-line2`,
|
|
152
|
-
value:
|
|
153
|
-
onChange: (
|
|
152
|
+
value: m.line2,
|
|
153
|
+
onChange: (u) => f({ ...m, line2: u.target.value })
|
|
154
154
|
}
|
|
155
155
|
)
|
|
156
156
|
] }),
|
|
@@ -164,8 +164,8 @@ function Qe({
|
|
|
164
164
|
name: `${n}-city`,
|
|
165
165
|
autoComplete: `${n} address-level2`,
|
|
166
166
|
required: !0,
|
|
167
|
-
value:
|
|
168
|
-
onChange: (
|
|
167
|
+
value: m.city,
|
|
168
|
+
onChange: (u) => f({ ...m, city: u.target.value })
|
|
169
169
|
}
|
|
170
170
|
)
|
|
171
171
|
] }),
|
|
@@ -179,11 +179,11 @@ function Qe({
|
|
|
179
179
|
autoComplete: `${n} address-level1`,
|
|
180
180
|
required: !0,
|
|
181
181
|
className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
182
|
-
value:
|
|
183
|
-
onChange: (
|
|
182
|
+
value: m.state,
|
|
183
|
+
onChange: (u) => f({ ...m, state: u.target.value }),
|
|
184
184
|
children: [
|
|
185
185
|
/* @__PURE__ */ e("option", { value: "", children: `${ee}: ${q}` }),
|
|
186
|
-
U.map((
|
|
186
|
+
U.map((u) => /* @__PURE__ */ e("option", { value: u.code, children: Et(m.country_code, u, S) }, u.code))
|
|
187
187
|
]
|
|
188
188
|
}
|
|
189
189
|
) : /* @__PURE__ */ e(
|
|
@@ -192,8 +192,8 @@ function Qe({
|
|
|
192
192
|
id: `${n}-state`,
|
|
193
193
|
name: `${n}-state`,
|
|
194
194
|
autoComplete: `${n} address-level1`,
|
|
195
|
-
value:
|
|
196
|
-
onChange: (
|
|
195
|
+
value: m.state,
|
|
196
|
+
onChange: (u) => f({ ...m, state: u.target.value })
|
|
197
197
|
}
|
|
198
198
|
)
|
|
199
199
|
] }),
|
|
@@ -206,8 +206,8 @@ function Qe({
|
|
|
206
206
|
name: `${n}-postal`,
|
|
207
207
|
autoComplete: `${n} postal-code`,
|
|
208
208
|
required: !0,
|
|
209
|
-
value:
|
|
210
|
-
onChange: (
|
|
209
|
+
value: m.postal_code,
|
|
210
|
+
onChange: (u) => f({ ...m, postal_code: u.target.value })
|
|
211
211
|
}
|
|
212
212
|
)
|
|
213
213
|
] })
|
|
@@ -217,23 +217,23 @@ function Qe({
|
|
|
217
217
|
}
|
|
218
218
|
function Ve({
|
|
219
219
|
title: n,
|
|
220
|
-
description:
|
|
221
|
-
badgeLabel:
|
|
222
|
-
children:
|
|
220
|
+
description: o,
|
|
221
|
+
badgeLabel: A,
|
|
222
|
+
children: m
|
|
223
223
|
}) {
|
|
224
224
|
return /* @__PURE__ */ r(X, { children: [
|
|
225
225
|
/* @__PURE__ */ e(Y, { children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-3 flex-wrap", children: [
|
|
226
226
|
/* @__PURE__ */ r("div", { children: [
|
|
227
227
|
/* @__PURE__ */ e(W, { role: "heading", "aria-level": 2, children: n }),
|
|
228
|
-
/* @__PURE__ */ e("p", { className: "mt-1 text-sm text-muted-foreground", children:
|
|
228
|
+
/* @__PURE__ */ e("p", { className: "mt-1 text-sm text-muted-foreground", children: o })
|
|
229
229
|
] }),
|
|
230
|
-
|
|
230
|
+
A ? /* @__PURE__ */ e(Xe, { variant: "secondary", children: A }) : null
|
|
231
231
|
] }) }),
|
|
232
|
-
/* @__PURE__ */ e(Z, { className: "space-y-4", children:
|
|
232
|
+
/* @__PURE__ */ e(Z, { className: "space-y-4", children: m })
|
|
233
233
|
] });
|
|
234
234
|
}
|
|
235
|
-
const
|
|
236
|
-
const
|
|
235
|
+
const mr = ({ initialCustomer: n }) => {
|
|
236
|
+
const o = St(), [A, m] = y({}), [f, g] = y(null), [S, E] = y({}), [I, ee] = y(n?.email || ""), [q, U] = y(""), [K, u] = y(n?.phone || ""), [te, re] = y(!1), [he, je] = y(null), [Ee, ne] = y(!1), [We, Ie] = y(!1), [Ze, le] = y(!1), [J, G] = y([]), [T, z] = y(null), [w, se] = y(null), [M, et] = y(null), [k, Me] = y(
|
|
237
237
|
() => ue(n?.billingAddress, n?.fullName)
|
|
238
238
|
), [B, De] = y(
|
|
239
239
|
() => ue(
|
|
@@ -241,47 +241,47 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
241
241
|
n?.fullName
|
|
242
242
|
)
|
|
243
243
|
), [D, Le] = y(
|
|
244
|
-
!n?.shippingAddress ||
|
|
245
|
-
), H = yt((t) => t), { t:
|
|
244
|
+
!n?.shippingAddress || It(n?.billingAddress, n?.shippingAddress)
|
|
245
|
+
), H = yt((t) => t), { t: s, lang: ge } = Ye(), { activeCurrencyCode: a, currencies: L } = Dt(), Re = At(), x = H?.items ?? [], v = F(
|
|
246
246
|
() => x.filter((t) => !$e(t)),
|
|
247
247
|
[x]
|
|
248
|
-
), C =
|
|
248
|
+
), C = F(
|
|
249
249
|
() => x.filter((t) => $e(t)),
|
|
250
250
|
[x]
|
|
251
|
-
), P = n?.isAuthenticated ?? !1, l = (t,
|
|
252
|
-
const i =
|
|
251
|
+
), P = n?.isAuthenticated ?? !1, l = (t, c, h) => {
|
|
252
|
+
const i = s(t, h);
|
|
253
253
|
if (i !== t)
|
|
254
254
|
return i;
|
|
255
255
|
if (!h)
|
|
256
|
-
return
|
|
257
|
-
let _ =
|
|
256
|
+
return c;
|
|
257
|
+
let _ = c;
|
|
258
258
|
return Object.entries(h).forEach(([p, d]) => {
|
|
259
259
|
_ = _.replace(
|
|
260
260
|
new RegExp(`\\{${p}\\}`, "g"),
|
|
261
261
|
String(d)
|
|
262
262
|
);
|
|
263
263
|
}), _;
|
|
264
|
-
}, N = v.length > 0, tt =
|
|
265
|
-
() => Fe(x,
|
|
266
|
-
[
|
|
267
|
-
), fe =
|
|
268
|
-
() => Fe(v,
|
|
269
|
-
[
|
|
270
|
-
), _e =
|
|
271
|
-
() => Fe(C,
|
|
272
|
-
[
|
|
273
|
-
), ye = M?.providerDiscounts.stripe ?? 0, be = M?.providerDiscounts.freemius ?? 0,
|
|
274
|
-
() => D ?
|
|
275
|
-
[
|
|
276
|
-
), O =
|
|
277
|
-
() => N ?
|
|
278
|
-
[
|
|
279
|
-
), ie = !N ||
|
|
264
|
+
}, N = v.length > 0, tt = F(
|
|
265
|
+
() => Fe(x, a, L),
|
|
266
|
+
[a, L, x]
|
|
267
|
+
), fe = F(
|
|
268
|
+
() => Fe(v, a, L),
|
|
269
|
+
[a, L, v]
|
|
270
|
+
), _e = F(
|
|
271
|
+
() => Fe(C, a, L),
|
|
272
|
+
[a, L, C]
|
|
273
|
+
), ye = M?.providerDiscounts.stripe ?? 0, be = M?.providerDiscounts.freemius ?? 0, ce = Math.max(0, fe - ye), rt = Math.max(0, _e - be), $ = F(
|
|
274
|
+
() => D ? k : B,
|
|
275
|
+
[k, B, D]
|
|
276
|
+
), O = F(
|
|
277
|
+
() => N ? $ : k,
|
|
278
|
+
[k, N, $]
|
|
279
|
+
), ie = !N || qt($), ae = F(
|
|
280
280
|
() => J.find((t) => t.id === T),
|
|
281
281
|
[J, T]
|
|
282
|
-
), qe =
|
|
283
|
-
() =>
|
|
284
|
-
[
|
|
282
|
+
), qe = F(
|
|
283
|
+
() => ce + (ae?.amount ?? 0) + (w && !w.isPendingExternalCalculation ? w.amount : 0),
|
|
284
|
+
[ce, ae, w]
|
|
285
285
|
), nt = qe + rt;
|
|
286
286
|
if (V(() => {
|
|
287
287
|
if (!(P || typeof window > "u"))
|
|
@@ -289,8 +289,8 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
289
289
|
const t = window.localStorage.getItem(me);
|
|
290
290
|
if (!t)
|
|
291
291
|
return;
|
|
292
|
-
const
|
|
293
|
-
|
|
292
|
+
const c = JSON.parse(t);
|
|
293
|
+
c.email && ee(c.email), c.phone && u(c.phone), c.billingAddress && Me(ue(c.billingAddress)), c.shippingAddress && De(ue(c.shippingAddress)), typeof c.useBillingForShipping == "boolean" && Le(c.useBillingForShipping), (typeof c.selectedMethodId == "string" || c.selectedMethodId === null) && z(c.selectedMethodId);
|
|
294
294
|
} catch (t) {
|
|
295
295
|
console.error("[Checkout] Failed to restore checkout draft:", t);
|
|
296
296
|
}
|
|
@@ -306,7 +306,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
306
306
|
JSON.stringify({
|
|
307
307
|
email: I,
|
|
308
308
|
phone: K,
|
|
309
|
-
billingAddress:
|
|
309
|
+
billingAddress: k,
|
|
310
310
|
shippingAddress: B,
|
|
311
311
|
useBillingForShipping: D,
|
|
312
312
|
selectedMethodId: T
|
|
@@ -315,7 +315,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
315
315
|
} catch {
|
|
316
316
|
}
|
|
317
317
|
}, [
|
|
318
|
-
|
|
318
|
+
k,
|
|
319
319
|
I,
|
|
320
320
|
P,
|
|
321
321
|
K,
|
|
@@ -333,18 +333,18 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
333
333
|
}
|
|
334
334
|
let t = !1;
|
|
335
335
|
const h = setTimeout(async () => {
|
|
336
|
-
if (
|
|
336
|
+
if ($.country_code) {
|
|
337
337
|
ne(!0), Ie(!1);
|
|
338
338
|
try {
|
|
339
339
|
const i = await Tt(
|
|
340
|
-
|
|
340
|
+
ce,
|
|
341
341
|
{
|
|
342
|
-
country:
|
|
343
|
-
state:
|
|
344
|
-
postal_code:
|
|
342
|
+
country: $.country_code,
|
|
343
|
+
state: $.state,
|
|
344
|
+
postal_code: $.postal_code
|
|
345
345
|
},
|
|
346
346
|
ge,
|
|
347
|
-
|
|
347
|
+
a
|
|
348
348
|
);
|
|
349
349
|
if (t)
|
|
350
350
|
return;
|
|
@@ -368,23 +368,23 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
368
368
|
t = !0, clearTimeout(h);
|
|
369
369
|
};
|
|
370
370
|
}, [
|
|
371
|
-
|
|
371
|
+
a,
|
|
372
372
|
N,
|
|
373
373
|
ie,
|
|
374
374
|
ge,
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
375
|
+
$.country_code,
|
|
376
|
+
$.postal_code,
|
|
377
|
+
$.state,
|
|
378
|
+
ce
|
|
379
379
|
]), V(() => {
|
|
380
380
|
let t = !1;
|
|
381
381
|
const h = setTimeout(async () => {
|
|
382
382
|
if (!N || !O.country_code) {
|
|
383
|
-
le(!1),
|
|
383
|
+
le(!1), se(null);
|
|
384
384
|
return;
|
|
385
385
|
}
|
|
386
386
|
if (pe(O.country_code) && !O.state) {
|
|
387
|
-
le(!1),
|
|
387
|
+
le(!1), se(null);
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
390
|
le(!0);
|
|
@@ -395,17 +395,17 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
395
395
|
country_code: O.country_code,
|
|
396
396
|
state: O.state
|
|
397
397
|
},
|
|
398
|
-
|
|
398
|
+
a,
|
|
399
399
|
M?.code ?? null,
|
|
400
400
|
x
|
|
401
401
|
);
|
|
402
402
|
if (t)
|
|
403
403
|
return;
|
|
404
|
-
|
|
404
|
+
se(i.success && i.tax ? i.tax : null);
|
|
405
405
|
} catch (i) {
|
|
406
406
|
if (t)
|
|
407
407
|
return;
|
|
408
|
-
console.error("[Checkout] Failed to load the tax estimate:", i),
|
|
408
|
+
console.error("[Checkout] Failed to load the tax estimate:", i), se(null);
|
|
409
409
|
} finally {
|
|
410
410
|
t || le(!1);
|
|
411
411
|
}
|
|
@@ -414,7 +414,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
414
414
|
t = !0, clearTimeout(h);
|
|
415
415
|
};
|
|
416
416
|
}, [
|
|
417
|
-
|
|
417
|
+
a,
|
|
418
418
|
N,
|
|
419
419
|
v,
|
|
420
420
|
O.country_code,
|
|
@@ -422,12 +422,24 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
422
422
|
M?.code,
|
|
423
423
|
x
|
|
424
424
|
]), V(() => {
|
|
425
|
-
const t = (
|
|
426
|
-
|
|
425
|
+
const t = (c) => {
|
|
426
|
+
c.persisted && g(null);
|
|
427
427
|
};
|
|
428
428
|
return window.addEventListener("pageshow", t), () => window.removeEventListener("pageshow", t);
|
|
429
429
|
}, []), !H)
|
|
430
|
-
return
|
|
430
|
+
return /* @__PURE__ */ r("div", { role: "status", "aria-busy": "true", className: "container mx-auto px-4 py-12 md:px-6", children: [
|
|
431
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: s("loading") === "loading" ? "Loading…" : s("loading") }),
|
|
432
|
+
/* @__PURE__ */ r("div", { className: "mx-auto max-w-6xl", children: [
|
|
433
|
+
/* @__PURE__ */ e("div", { className: "mb-8 h-9 w-48 rounded-md bg-muted" }),
|
|
434
|
+
/* @__PURE__ */ r("div", { className: "grid gap-8 lg:grid-cols-12 lg:items-start", children: [
|
|
435
|
+
/* @__PURE__ */ r("div", { className: "space-y-6 lg:col-span-8", children: [
|
|
436
|
+
/* @__PURE__ */ e("div", { className: "h-56 rounded-xl border bg-muted/40" }),
|
|
437
|
+
/* @__PURE__ */ e("div", { className: "h-96 rounded-xl border bg-muted/40" })
|
|
438
|
+
] }),
|
|
439
|
+
/* @__PURE__ */ e("div", { className: "lg:col-span-4", children: /* @__PURE__ */ e("div", { className: "h-72 rounded-xl border bg-muted/40" }) })
|
|
440
|
+
] })
|
|
441
|
+
] })
|
|
442
|
+
] });
|
|
431
443
|
const xe = () => {
|
|
432
444
|
re(!1), je(null);
|
|
433
445
|
}, ze = te ? /* @__PURE__ */ e(
|
|
@@ -460,9 +472,9 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
460
472
|
),
|
|
461
473
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-3 mb-4", children: [
|
|
462
474
|
/* @__PURE__ */ e("div", { className: "p-2 rounded-full bg-amber-100 dark:bg-amber-900/20", children: /* @__PURE__ */ e(xt, { className: "h-6 w-6 text-amber-600 dark:text-amber-400" }) }),
|
|
463
|
-
/* @__PURE__ */ e("h2", { id: "sandbox-checkout-title", className: "text-xl font-semibold", children:
|
|
475
|
+
/* @__PURE__ */ e("h2", { id: "sandbox-checkout-title", className: "text-xl font-semibold", children: s("ecommerce.checkout_successful") })
|
|
464
476
|
] }),
|
|
465
|
-
/* @__PURE__ */ e("p", { className: "text-muted-foreground mb-2", children:
|
|
477
|
+
/* @__PURE__ */ e("p", { className: "text-muted-foreground mb-2", children: s("ecommerce.sandbox_notice") }),
|
|
466
478
|
/* @__PURE__ */ e("p", { className: "text-muted-foreground mb-2", children: he === "stripe" ? l(
|
|
467
479
|
"ecommerce.sandbox_checkout_stripe_description",
|
|
468
480
|
"This simulated step represents the Stripe checkout for physical products."
|
|
@@ -470,7 +482,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
470
482
|
"ecommerce.sandbox_checkout_freemius_description",
|
|
471
483
|
"This simulated step represents the Freemius checkout for digital products."
|
|
472
484
|
) }),
|
|
473
|
-
/* @__PURE__ */ e("p", { className: "text-muted-foreground mb-6", children:
|
|
485
|
+
/* @__PURE__ */ e("p", { className: "text-muted-foreground mb-6", children: s("ecommerce.license_notice") }),
|
|
474
486
|
/* @__PURE__ */ e(
|
|
475
487
|
"a",
|
|
476
488
|
{
|
|
@@ -478,33 +490,33 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
478
490
|
target: "_blank",
|
|
479
491
|
rel: "noopener noreferrer",
|
|
480
492
|
className: "block w-full text-center py-3 px-4 rounded-lg bg-primary text-primary-foreground font-semibold hover:opacity-90 transition-opacity",
|
|
481
|
-
children:
|
|
493
|
+
children: s("ecommerce.purchase_at")
|
|
482
494
|
}
|
|
483
495
|
)
|
|
484
496
|
]
|
|
485
497
|
}
|
|
486
498
|
)
|
|
487
499
|
}
|
|
488
|
-
) : null,
|
|
500
|
+
) : null, oe = (t, c, h) => (E((i) => ({ ...i, [t]: c })), h && document.getElementById(h)?.focus(), null), ve = (t, c) => c.recipient_name.trim() ? c.line1.trim() ? c.city.trim() ? pe(c.country_code) && !c.state ? `${t}-state` : c.postal_code.trim() ? `${t}-line1` : `${t}-postal` : `${t}-city` : `${t}-line1` : `${t}-name`, lt = (t) => {
|
|
489
501
|
if (!P && (!I || !/^\S+@\S+\.\S+$/.test(I)))
|
|
490
|
-
return U(
|
|
491
|
-
const
|
|
492
|
-
if (!Ge(
|
|
493
|
-
return
|
|
502
|
+
return U(s("ecommerce.invalid_email")), oe(t, s("ecommerce.invalid_email"), "checkout-email");
|
|
503
|
+
const c = Te(k);
|
|
504
|
+
if (!Ge(c))
|
|
505
|
+
return oe(
|
|
494
506
|
t,
|
|
495
|
-
|
|
496
|
-
ve("billing",
|
|
507
|
+
s("checkout_complete_billing_address"),
|
|
508
|
+
ve("billing", k)
|
|
497
509
|
);
|
|
498
|
-
const h = N ? Te(D ?
|
|
510
|
+
const h = N ? Te(D ? k : B) : null;
|
|
499
511
|
if (t === "stripe") {
|
|
500
512
|
if (!Ge(h))
|
|
501
|
-
return
|
|
513
|
+
return oe(
|
|
502
514
|
t,
|
|
503
|
-
|
|
504
|
-
D ? ve("billing",
|
|
515
|
+
s("checkout_complete_shipping_address"),
|
|
516
|
+
D ? ve("billing", k) : ve("shipping", B)
|
|
505
517
|
);
|
|
506
518
|
if (!T)
|
|
507
|
-
return
|
|
519
|
+
return oe(
|
|
508
520
|
t,
|
|
509
521
|
l(
|
|
510
522
|
"ecommerce.shipping_method_required",
|
|
@@ -513,18 +525,18 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
513
525
|
);
|
|
514
526
|
}
|
|
515
527
|
return U(""), {
|
|
516
|
-
normalizedBillingAddress:
|
|
528
|
+
normalizedBillingAddress: c,
|
|
517
529
|
normalizedShippingAddress: h
|
|
518
530
|
};
|
|
519
|
-
}, Be = async (t,
|
|
531
|
+
}, Be = async (t, c, h) => {
|
|
520
532
|
E((_) => ({
|
|
521
533
|
..._,
|
|
522
534
|
[t]: ""
|
|
523
535
|
}));
|
|
524
536
|
const i = lt(t);
|
|
525
537
|
if (i) {
|
|
526
|
-
if (
|
|
527
|
-
const _ = new Set(
|
|
538
|
+
if (Rt) {
|
|
539
|
+
const _ = new Set(c.map((d) => d.id)), p = x.filter((d) => !_.has(d.id));
|
|
528
540
|
if (H.setItems(p), p.length === 0 && H.removeCoupon(), je(t), re(!0), typeof window < "u" && p.length === 0)
|
|
529
541
|
try {
|
|
530
542
|
window.localStorage.removeItem(me);
|
|
@@ -538,14 +550,14 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
538
550
|
method: "POST",
|
|
539
551
|
headers: { "Content-Type": "application/json" },
|
|
540
552
|
body: JSON.stringify({
|
|
541
|
-
items:
|
|
553
|
+
items: c,
|
|
542
554
|
customerEmail: P ? void 0 : I,
|
|
543
555
|
customerPhone: K || null,
|
|
544
556
|
billingAddress: i.normalizedBillingAddress,
|
|
545
557
|
shippingAddress: t === "stripe" ? i.normalizedShippingAddress : null,
|
|
546
558
|
shippingMethodId: t === "stripe" ? T : null,
|
|
547
559
|
locale: ge,
|
|
548
|
-
currencyCode:
|
|
560
|
+
currencyCode: a,
|
|
549
561
|
couponCode: M?.code ?? H.appliedCoupon?.code ?? null,
|
|
550
562
|
couponContextItems: x
|
|
551
563
|
})
|
|
@@ -555,7 +567,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
555
567
|
p.errorKey,
|
|
556
568
|
p?.error || l("ecommerce.generic_error", "Something went wrong."),
|
|
557
569
|
p.errorParams
|
|
558
|
-
) : p?.error ||
|
|
570
|
+
) : p?.error || s("ecommerce.generic_error");
|
|
559
571
|
E((Q) => ({
|
|
560
572
|
...Q,
|
|
561
573
|
[t]: d
|
|
@@ -584,7 +596,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
584
596
|
public_key: d.public_key,
|
|
585
597
|
sandbox: d.sandbox
|
|
586
598
|
}, ut = {
|
|
587
|
-
name:
|
|
599
|
+
name: s("ecommerce.checkout_overlay_title"),
|
|
588
600
|
plan_id: d.plan_id,
|
|
589
601
|
...d.billing_cycle ? { billing_cycle: d.billing_cycle } : {},
|
|
590
602
|
...d.trial ? { trial: d.trial } : {},
|
|
@@ -611,17 +623,17 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
611
623
|
} catch (R) {
|
|
612
624
|
console.error("[Checkout] Freemius overlay failed to open:", R), E((de) => ({
|
|
613
625
|
...de,
|
|
614
|
-
[t]:
|
|
626
|
+
[t]: s("ecommerce.checkout_popup_blocked")
|
|
615
627
|
})), p.url && (window.location.href = p.url), g(null);
|
|
616
628
|
}
|
|
617
629
|
} else p.url ? window.location.href = p.url : (E((d) => ({
|
|
618
630
|
...d,
|
|
619
|
-
[t]:
|
|
631
|
+
[t]: s("ecommerce.checkout_failed") + (p.error || l("ecommerce.unknown_error", "Unknown error"))
|
|
620
632
|
})), g(null));
|
|
621
633
|
} catch (_) {
|
|
622
634
|
console.error(_), E((p) => ({
|
|
623
635
|
...p,
|
|
624
|
-
[t]:
|
|
636
|
+
[t]: s("ecommerce.generic_error")
|
|
625
637
|
})), g(null);
|
|
626
638
|
}
|
|
627
639
|
}
|
|
@@ -630,21 +642,21 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
630
642
|
return /* @__PURE__ */ r(ht, { children: [
|
|
631
643
|
ze,
|
|
632
644
|
/* @__PURE__ */ r("div", { className: "container mx-auto flex min-h-[50vh] flex-col items-center justify-center p-8 text-center", children: [
|
|
633
|
-
/* @__PURE__ */ e("h1", { className: "mb-4 text-2xl font-bold", children:
|
|
634
|
-
/* @__PURE__ */ e("p", { className: "mb-8 text-muted-foreground", children:
|
|
635
|
-
/* @__PURE__ */ e(
|
|
645
|
+
/* @__PURE__ */ e("h1", { className: "mb-4 text-2xl font-bold", children: s("ecommerce.cart_empty") }),
|
|
646
|
+
/* @__PURE__ */ e("p", { className: "mb-8 text-muted-foreground", children: s("ecommerce.cart_empty_description") }),
|
|
647
|
+
/* @__PURE__ */ e(ke, { asChild: !0, children: /* @__PURE__ */ e("a", { href: "/shop", children: s("ecommerce.go_to_shop") }) })
|
|
636
648
|
] })
|
|
637
649
|
] });
|
|
638
650
|
const Pe = l(
|
|
639
651
|
"ecommerce.checkout_payments_unavailable",
|
|
640
652
|
"This store is not able to take payments right now. Please contact the seller to complete your purchase."
|
|
641
|
-
), Oe = Re.stripe ? null : Pe, Ne = Re.freemius ? null : Pe,
|
|
653
|
+
), Oe = Re.stripe ? null : Pe, Ne = Re.freemius ? null : Pe, we = Oe || (N ? ie ? Ee ? l(
|
|
642
654
|
"ecommerce.calculating_shipping",
|
|
643
655
|
"Calculating shipping..."
|
|
644
|
-
) : T ? null : J.length > 0 ?
|
|
656
|
+
) : T ? null : J.length > 0 ? s("ecommerce.select_rate") : s("ecommerce.no_rates_for_region") : l(
|
|
645
657
|
"ecommerce.waiting_on_address_info",
|
|
646
658
|
"Complete your shipping address to view available shipping options."
|
|
647
|
-
) : null),
|
|
659
|
+
) : null), st = f !== null || we !== null, ct = v.length === 1 ? l("ecommerce.item_count_one", "{count} item", {
|
|
648
660
|
count: v.length
|
|
649
661
|
}) : l("ecommerce.item_count_other", "{count} items", {
|
|
650
662
|
count: v.length
|
|
@@ -652,7 +664,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
652
664
|
count: C.length
|
|
653
665
|
}) : l("ecommerce.license_count_other", "{count} licenses", {
|
|
654
666
|
count: C.length
|
|
655
|
-
}),
|
|
667
|
+
}), at = (t) => $e(t) ? l("ecommerce.digital_label", "Digital") : l("ecommerce.physical_label", "Physical"), ot = (t) => t === "monthly" ? l(
|
|
656
668
|
"ecommerce.checkout_billing_cycle_monthly",
|
|
657
669
|
"Monthly subscription"
|
|
658
670
|
) : t === "annual" ? l(
|
|
@@ -665,18 +677,18 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
665
677
|
return /* @__PURE__ */ r("div", { className: "container mx-auto px-4 py-12 md:px-6", children: [
|
|
666
678
|
ze,
|
|
667
679
|
/* @__PURE__ */ r("div", { className: "mx-auto max-w-6xl", children: [
|
|
668
|
-
/* @__PURE__ */ e("h1", { className: "mb-8 text-3xl font-bold", children:
|
|
680
|
+
/* @__PURE__ */ e("h1", { className: "mb-8 text-3xl font-bold", children: s("ecommerce.checkout") }),
|
|
669
681
|
/* @__PURE__ */ r("div", { className: "grid gap-8 lg:grid-cols-12 lg:items-start", children: [
|
|
670
682
|
/* @__PURE__ */ r("div", { className: "lg:col-span-8 space-y-6", children: [
|
|
671
683
|
/* @__PURE__ */ r(X, { children: [
|
|
672
684
|
/* @__PURE__ */ e(Y, { children: /* @__PURE__ */ r(W, { role: "heading", "aria-level": 2, className: "flex items-center gap-2", children: [
|
|
673
685
|
/* @__PURE__ */ e(vt, { className: "w-5 h-5" }),
|
|
674
|
-
|
|
686
|
+
s("ecommerce.contact_information")
|
|
675
687
|
] }) }),
|
|
676
688
|
/* @__PURE__ */ r(Z, { className: "space-y-4", children: [
|
|
677
|
-
P ? /* @__PURE__ */ e("div", { className: "rounded-xl border bg-muted/20 p-4 text-sm text-muted-foreground", children:
|
|
689
|
+
P ? /* @__PURE__ */ e("div", { className: "rounded-xl border bg-muted/20 p-4 text-sm text-muted-foreground", children: s("checkout_prefill_notice", { email: n?.email || "" }) }) : /* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
678
690
|
/* @__PURE__ */ r(b, { htmlFor: "checkout-email", children: [
|
|
679
|
-
|
|
691
|
+
s("ecommerce.email_address"),
|
|
680
692
|
" ",
|
|
681
693
|
/* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
|
|
682
694
|
] }),
|
|
@@ -690,7 +702,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
690
702
|
spellCheck: !1,
|
|
691
703
|
"aria-invalid": q ? !0 : void 0,
|
|
692
704
|
"aria-describedby": q ? "checkout-email-error" : void 0,
|
|
693
|
-
placeholder:
|
|
705
|
+
placeholder: s("ecommerce.email_placeholder"),
|
|
694
706
|
value: I,
|
|
695
707
|
onChange: (t) => {
|
|
696
708
|
ee(t.target.value), q && U("");
|
|
@@ -701,7 +713,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
701
713
|
q ? /* @__PURE__ */ e("p", { id: "checkout-email-error", role: "alert", className: "text-xs text-destructive mt-1", children: q }) : null
|
|
702
714
|
] }),
|
|
703
715
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
704
|
-
/* @__PURE__ */ e(b, { htmlFor: "checkout-phone", children:
|
|
716
|
+
/* @__PURE__ */ e(b, { htmlFor: "checkout-phone", children: s("phone_number") }),
|
|
705
717
|
/* @__PURE__ */ e(
|
|
706
718
|
j,
|
|
707
719
|
{
|
|
@@ -710,9 +722,9 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
710
722
|
type: "tel",
|
|
711
723
|
inputMode: "tel",
|
|
712
724
|
autoComplete: "tel",
|
|
713
|
-
placeholder:
|
|
725
|
+
placeholder: s("optional"),
|
|
714
726
|
value: K,
|
|
715
|
-
onChange: (t) =>
|
|
727
|
+
onChange: (t) => u(t.target.value)
|
|
716
728
|
}
|
|
717
729
|
)
|
|
718
730
|
] })
|
|
@@ -722,9 +734,9 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
722
734
|
Qe,
|
|
723
735
|
{
|
|
724
736
|
idPrefix: "billing",
|
|
725
|
-
title:
|
|
726
|
-
description:
|
|
727
|
-
value:
|
|
737
|
+
title: s("billing_address"),
|
|
738
|
+
description: s("checkout_billing_address_help"),
|
|
739
|
+
value: k,
|
|
728
740
|
onChange: Me
|
|
729
741
|
}
|
|
730
742
|
),
|
|
@@ -738,16 +750,16 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
738
750
|
}
|
|
739
751
|
),
|
|
740
752
|
/* @__PURE__ */ r("div", { className: "space-y-1", children: [
|
|
741
|
-
/* @__PURE__ */ e(b, { htmlFor: "use-billing-for-shipping", className: "cursor-pointer", children:
|
|
742
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children:
|
|
753
|
+
/* @__PURE__ */ e(b, { htmlFor: "use-billing-for-shipping", className: "cursor-pointer", children: s("use_billing_for_shipping") }),
|
|
754
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: s("checkout_use_billing_for_shipping_help") })
|
|
743
755
|
] })
|
|
744
756
|
] }) : null,
|
|
745
757
|
N && !D ? /* @__PURE__ */ e(
|
|
746
758
|
Qe,
|
|
747
759
|
{
|
|
748
760
|
idPrefix: "shipping",
|
|
749
|
-
title:
|
|
750
|
-
description:
|
|
761
|
+
title: s("shipping_address"),
|
|
762
|
+
description: s("checkout_shipping_address_help"),
|
|
751
763
|
value: B,
|
|
752
764
|
onChange: De
|
|
753
765
|
}
|
|
@@ -755,7 +767,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
755
767
|
N ? /* @__PURE__ */ r(X, { children: [
|
|
756
768
|
/* @__PURE__ */ e(Y, { children: /* @__PURE__ */ r(W, { role: "heading", "aria-level": 2, className: "flex items-center gap-2", children: [
|
|
757
769
|
/* @__PURE__ */ e(Nt, { className: "w-5 h-5 text-primary" }),
|
|
758
|
-
|
|
770
|
+
s("ecommerce.shipping_method")
|
|
759
771
|
] }) }),
|
|
760
772
|
/* @__PURE__ */ e(Z, { children: Ee ? /* @__PURE__ */ r("div", { role: "status", className: "flex items-center justify-center py-6", children: [
|
|
761
773
|
/* @__PURE__ */ e(Se, { className: "w-6 h-6 animate-spin text-muted-foreground" }),
|
|
@@ -771,7 +783,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
771
783
|
{
|
|
772
784
|
value: T ?? "",
|
|
773
785
|
onValueChange: z,
|
|
774
|
-
"aria-label":
|
|
786
|
+
"aria-label": s("ecommerce.shipping_method"),
|
|
775
787
|
className: "space-y-3",
|
|
776
788
|
children: J.map((t) => /* @__PURE__ */ r(
|
|
777
789
|
b,
|
|
@@ -783,14 +795,14 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
783
795
|
/* @__PURE__ */ e(Ce, { id: `shipping-method-${t.id}`, value: t.id }),
|
|
784
796
|
/* @__PURE__ */ e("span", { className: "font-medium break-words", children: t.name })
|
|
785
797
|
] }),
|
|
786
|
-
/* @__PURE__ */ e("span", { className: "font-bold tabular-nums", children:
|
|
798
|
+
/* @__PURE__ */ e("span", { className: "font-bold tabular-nums", children: o(t.amount, a) })
|
|
787
799
|
]
|
|
788
800
|
},
|
|
789
801
|
t.id
|
|
790
802
|
))
|
|
791
803
|
}
|
|
792
804
|
)
|
|
793
|
-
) : /* @__PURE__ */ e("div", { className: "py-4 text-center text-muted-foreground bg-muted/30 rounded-lg italic", children: ie ?
|
|
805
|
+
) : /* @__PURE__ */ e("div", { className: "py-4 text-center text-muted-foreground bg-muted/30 rounded-lg italic", children: ie ? s("ecommerce.no_rates_for_region") : l(
|
|
794
806
|
"ecommerce.waiting_on_address_info",
|
|
795
807
|
"Complete your shipping address to view available shipping options."
|
|
796
808
|
) }) })
|
|
@@ -798,24 +810,24 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
798
810
|
] }),
|
|
799
811
|
/* @__PURE__ */ r("div", { className: "lg:col-span-4 space-y-6", children: [
|
|
800
812
|
/* @__PURE__ */ r(X, { className: "top-6", children: [
|
|
801
|
-
/* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(W, { role: "heading", "aria-level": 2, children:
|
|
813
|
+
/* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(W, { role: "heading", "aria-level": 2, children: s("ecommerce.order_summary") }) }),
|
|
802
814
|
/* @__PURE__ */ r(Z, { className: "space-y-4", children: [
|
|
803
815
|
/* @__PURE__ */ e("div", { className: "space-y-3 max-h-[260px] overflow-y-auto pr-2", children: x.map((t) => {
|
|
804
|
-
const
|
|
805
|
-
currencyCode:
|
|
816
|
+
const c = Ae(t, {
|
|
817
|
+
currencyCode: a,
|
|
806
818
|
currencies: L
|
|
807
|
-
}), h = He(t,
|
|
819
|
+
}), h = He(t, s);
|
|
808
820
|
return /* @__PURE__ */ r("div", { className: "flex items-start justify-between gap-4", children: [
|
|
809
821
|
/* @__PURE__ */ r("div", { className: "flex gap-3", children: [
|
|
810
822
|
t.image_url ? /* @__PURE__ */ e("div", { className: "h-10 w-10 shrink-0 overflow-hidden rounded border bg-neutral-100", children: /* @__PURE__ */ e("img", { src: t.image_url, alt: t.title, className: "h-full w-full object-cover" }) }) : null,
|
|
811
823
|
/* @__PURE__ */ r("div", { className: "grid gap-0.5", children: [
|
|
812
824
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
813
825
|
/* @__PURE__ */ e("span", { className: "font-medium text-xs line-clamp-1", children: t.title }),
|
|
814
|
-
/* @__PURE__ */ e(Xe, { variant: "outline", className: "text-[9px] uppercase", children:
|
|
826
|
+
/* @__PURE__ */ e(Xe, { variant: "outline", className: "text-[9px] uppercase", children: at(t) })
|
|
815
827
|
] }),
|
|
816
828
|
t.variant_label ? /* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground line-clamp-1", children: t.variant_label }) : null,
|
|
817
829
|
/* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground", children: [
|
|
818
|
-
|
|
830
|
+
s("ecommerce.qty"),
|
|
819
831
|
": ",
|
|
820
832
|
t.quantity
|
|
821
833
|
] }),
|
|
@@ -827,41 +839,41 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
827
839
|
] })
|
|
828
840
|
] }),
|
|
829
841
|
/* @__PURE__ */ r("div", { className: "flex flex-col items-end gap-0.5 shrink-0", children: [
|
|
830
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-xs", children:
|
|
831
|
-
(
|
|
832
|
-
|
|
842
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-xs", children: o(
|
|
843
|
+
(c.sale_price ?? c.price) * t.quantity,
|
|
844
|
+
a
|
|
833
845
|
) }),
|
|
834
|
-
|
|
846
|
+
c.sale_price ? /* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground line-through", children: o(c.price * t.quantity, a) }) : null
|
|
835
847
|
] })
|
|
836
848
|
] }, `${t.id}-${t.variant_id || "base"}`);
|
|
837
849
|
}) }),
|
|
838
850
|
/* @__PURE__ */ e(ft, {}),
|
|
839
851
|
/* @__PURE__ */ e(
|
|
840
|
-
|
|
852
|
+
Lt,
|
|
841
853
|
{
|
|
842
854
|
items: x,
|
|
843
|
-
currencyCode:
|
|
855
|
+
currencyCode: a,
|
|
844
856
|
onQuoteChange: et
|
|
845
857
|
}
|
|
846
858
|
),
|
|
847
859
|
/* @__PURE__ */ r("div", { className: "space-y-2 text-sm", children: [
|
|
848
860
|
/* @__PURE__ */ r("div", { className: "flex justify-between", children: [
|
|
849
|
-
/* @__PURE__ */ e("span", { children:
|
|
850
|
-
/* @__PURE__ */ e("span", { children:
|
|
861
|
+
/* @__PURE__ */ e("span", { children: s("ecommerce.subtotal") }),
|
|
862
|
+
/* @__PURE__ */ e("span", { children: o(tt, a) })
|
|
851
863
|
] }),
|
|
852
864
|
v.length > 0 ? /* @__PURE__ */ r("div", { className: "flex justify-between text-muted-foreground", children: [
|
|
853
865
|
/* @__PURE__ */ e("span", { children: l(
|
|
854
866
|
"ecommerce.physical_products",
|
|
855
867
|
"Physical products"
|
|
856
868
|
) }),
|
|
857
|
-
/* @__PURE__ */ e("span", { children:
|
|
869
|
+
/* @__PURE__ */ e("span", { children: o(fe, a) })
|
|
858
870
|
] }) : null,
|
|
859
871
|
C.length > 0 ? /* @__PURE__ */ r("div", { className: "flex justify-between text-muted-foreground", children: [
|
|
860
872
|
/* @__PURE__ */ e("span", { children: l(
|
|
861
873
|
"ecommerce.digital_products",
|
|
862
874
|
"Digital products"
|
|
863
875
|
) }),
|
|
864
|
-
/* @__PURE__ */ e("span", { children:
|
|
876
|
+
/* @__PURE__ */ e("span", { children: o(_e, a) })
|
|
865
877
|
] }) : null,
|
|
866
878
|
M ? /* @__PURE__ */ r("div", { className: "flex justify-between text-emerald-600", children: [
|
|
867
879
|
/* @__PURE__ */ r("span", { children: [
|
|
@@ -872,7 +884,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
872
884
|
] }),
|
|
873
885
|
/* @__PURE__ */ r("span", { children: [
|
|
874
886
|
"-",
|
|
875
|
-
|
|
887
|
+
o(M.discountTotal, a)
|
|
876
888
|
] })
|
|
877
889
|
] }) : null,
|
|
878
890
|
(v.length > 0 || C.length > 0) && /* @__PURE__ */ r("div", { className: "flex justify-between font-bold text-lg pt-2 border-t mt-2", children: [
|
|
@@ -880,7 +892,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
880
892
|
"ecommerce.estimated_total",
|
|
881
893
|
"Estimated total"
|
|
882
894
|
) }),
|
|
883
|
-
/* @__PURE__ */ e("span", { className: "text-primary", children:
|
|
895
|
+
/* @__PURE__ */ e("span", { className: "text-primary", children: o(nt, a) })
|
|
884
896
|
] })
|
|
885
897
|
] })
|
|
886
898
|
] })
|
|
@@ -896,7 +908,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
896
908
|
"ecommerce.stripe_checkout_description",
|
|
897
909
|
"Pay for physical products in one Stripe checkout session."
|
|
898
910
|
),
|
|
899
|
-
badgeLabel:
|
|
911
|
+
badgeLabel: ct,
|
|
900
912
|
children: [
|
|
901
913
|
/* @__PURE__ */ r("div", { className: "space-y-2 text-sm", children: [
|
|
902
914
|
/* @__PURE__ */ r("div", { className: "flex justify-between", children: [
|
|
@@ -904,62 +916,62 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
904
916
|
"ecommerce.physical_subtotal",
|
|
905
917
|
"Physical subtotal"
|
|
906
918
|
) }),
|
|
907
|
-
/* @__PURE__ */ e("span", { children:
|
|
919
|
+
/* @__PURE__ */ e("span", { children: o(fe, a) })
|
|
908
920
|
] }),
|
|
909
921
|
ye > 0 ? /* @__PURE__ */ r("div", { className: "flex justify-between text-emerald-600", children: [
|
|
910
922
|
/* @__PURE__ */ e("span", { children: l("ecommerce.discount", "Discount") }),
|
|
911
923
|
/* @__PURE__ */ r("span", { children: [
|
|
912
924
|
"-",
|
|
913
|
-
|
|
925
|
+
o(ye, a)
|
|
914
926
|
] })
|
|
915
927
|
] }) : null,
|
|
916
928
|
/* @__PURE__ */ r("div", { className: "flex justify-between", children: [
|
|
917
|
-
/* @__PURE__ */ e("span", { children:
|
|
918
|
-
/* @__PURE__ */ e("span", { children:
|
|
929
|
+
/* @__PURE__ */ e("span", { children: s("ecommerce.shipping") }),
|
|
930
|
+
/* @__PURE__ */ e("span", { children: ae ? o(ae.amount, a) : "-" })
|
|
919
931
|
] }),
|
|
920
932
|
/* @__PURE__ */ r("div", { className: "flex justify-between", children: [
|
|
921
933
|
/* @__PURE__ */ e("span", { children: l("ecommerce.tax", "Tax") }),
|
|
922
|
-
/* @__PURE__ */ e("span", { children: Ze ? "..." :
|
|
934
|
+
/* @__PURE__ */ e("span", { children: Ze ? "..." : w?.isPendingExternalCalculation ? l(
|
|
923
935
|
"ecommerce.tax_calculated_on_stripe",
|
|
924
936
|
"Calculated on Stripe"
|
|
925
|
-
) :
|
|
937
|
+
) : w ? o(w.amount, a) : "-" })
|
|
926
938
|
] }),
|
|
927
|
-
|
|
939
|
+
w && w.lines.length > 0 ? /* @__PURE__ */ e("div", { className: "rounded-lg bg-muted/20 px-3 py-2 text-xs text-muted-foreground", children: w.lines.map((t) => /* @__PURE__ */ r("div", { className: "flex justify-between gap-3", children: [
|
|
928
940
|
/* @__PURE__ */ r("span", { children: [
|
|
929
941
|
t.name,
|
|
930
942
|
" (",
|
|
931
943
|
t.rate.toFixed(4),
|
|
932
944
|
"%)"
|
|
933
945
|
] }),
|
|
934
|
-
/* @__PURE__ */ e("span", { children:
|
|
946
|
+
/* @__PURE__ */ e("span", { children: o(t.amount, a) })
|
|
935
947
|
] }, t.id || `${t.name}-${t.rate}`)) }) : null,
|
|
936
948
|
/* @__PURE__ */ r("div", { className: "flex justify-between font-semibold pt-2 border-t", children: [
|
|
937
949
|
/* @__PURE__ */ e("span", { children: l(
|
|
938
950
|
"ecommerce.total_on_stripe",
|
|
939
951
|
"Total on Stripe"
|
|
940
952
|
) }),
|
|
941
|
-
/* @__PURE__ */ e("span", { children:
|
|
953
|
+
/* @__PURE__ */ e("span", { children: o(qe, a) })
|
|
942
954
|
] })
|
|
943
955
|
] }),
|
|
944
956
|
/* @__PURE__ */ r(
|
|
945
|
-
|
|
957
|
+
ke,
|
|
946
958
|
{
|
|
947
959
|
className: "w-full",
|
|
948
960
|
size: "lg",
|
|
949
961
|
onClick: () => Be("stripe", v, "stripe"),
|
|
950
|
-
disabled:
|
|
962
|
+
disabled: st,
|
|
951
963
|
children: [
|
|
952
|
-
f === "stripe" ? /* @__PURE__ */ e(Se, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ e(
|
|
953
|
-
f === "stripe" ?
|
|
964
|
+
f === "stripe" ? /* @__PURE__ */ e(Se, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ e(wt, { className: "mr-2 h-4 w-4" }),
|
|
965
|
+
f === "stripe" ? s("ecommerce.processing") : l(
|
|
954
966
|
"ecommerce.checkout_physical_products",
|
|
955
967
|
"Checkout Physical Products"
|
|
956
968
|
)
|
|
957
969
|
]
|
|
958
970
|
}
|
|
959
971
|
),
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children:
|
|
972
|
+
we && f === null ? /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: we }) : null,
|
|
973
|
+
S.stripe ? /* @__PURE__ */ e("div", { role: "alert", className: "rounded-lg border border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: S.stripe }) : null,
|
|
974
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: w?.isPendingExternalCalculation ? l(
|
|
963
975
|
"checkout_stripe_tax_finalized_notice",
|
|
964
976
|
"Tax will be finalized by Stripe Tax on the payment step."
|
|
965
977
|
) : l(
|
|
@@ -983,22 +995,22 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
983
995
|
badgeLabel: it,
|
|
984
996
|
children: [
|
|
985
997
|
/* @__PURE__ */ e("div", { className: "space-y-3", children: C.map((t) => {
|
|
986
|
-
const
|
|
987
|
-
currencyCode:
|
|
998
|
+
const c = Ae(t, {
|
|
999
|
+
currencyCode: a,
|
|
988
1000
|
currencies: L
|
|
989
|
-
}), h = He(t,
|
|
1001
|
+
}), h = He(t, s), i = `freemius:${t.id}`, _ = h ? A[i] || "paid" : void 0;
|
|
990
1002
|
return /* @__PURE__ */ r("div", { className: "rounded-lg border p-3 space-y-3", children: [
|
|
991
1003
|
/* @__PURE__ */ r("div", { className: "flex items-start justify-between gap-3", children: [
|
|
992
1004
|
/* @__PURE__ */ r("div", { children: [
|
|
993
1005
|
/* @__PURE__ */ e("p", { className: "font-medium", children: t.title }),
|
|
994
|
-
t.billing_cycle ? /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground capitalize", children:
|
|
1006
|
+
t.billing_cycle ? /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground capitalize", children: ot(t.billing_cycle) }) : null,
|
|
995
1007
|
h ? /* @__PURE__ */ r("p", { className: "text-xs font-medium text-emerald-700", children: [
|
|
996
1008
|
h.label,
|
|
997
1009
|
" - ",
|
|
998
1010
|
h.paymentRequirementLabel
|
|
999
1011
|
] }) : null
|
|
1000
1012
|
] }),
|
|
1001
|
-
/* @__PURE__ */ e("span", { className: "font-medium", children:
|
|
1013
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: o(c.sale_price ?? c.price, a) })
|
|
1002
1014
|
] }),
|
|
1003
1015
|
h && !t.trial_requires_payment_method && /* @__PURE__ */ r("div", { className: "bg-muted/30 p-3 rounded-md border text-sm mt-2 mb-3", children: [
|
|
1004
1016
|
/* @__PURE__ */ e("p", { className: "font-medium mb-3", children: l(
|
|
@@ -1008,8 +1020,8 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
1008
1020
|
/* @__PURE__ */ r(
|
|
1009
1021
|
Ue,
|
|
1010
1022
|
{
|
|
1011
|
-
value:
|
|
1012
|
-
onValueChange: (p) =>
|
|
1023
|
+
value: A[i] || "paid",
|
|
1024
|
+
onValueChange: (p) => m((d) => ({ ...d, [i]: p })),
|
|
1013
1025
|
className: "gap-3",
|
|
1014
1026
|
children: [
|
|
1015
1027
|
/* @__PURE__ */ r("div", { className: "flex items-start space-x-3", children: [
|
|
@@ -1037,7 +1049,7 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
1037
1049
|
)
|
|
1038
1050
|
] }),
|
|
1039
1051
|
/* @__PURE__ */ r(
|
|
1040
|
-
|
|
1052
|
+
ke,
|
|
1041
1053
|
{
|
|
1042
1054
|
className: "w-full h-auto min-h-[2.75rem] py-2",
|
|
1043
1055
|
onClick: () => Be(
|
|
@@ -1052,8 +1064,8 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
1052
1064
|
),
|
|
1053
1065
|
disabled: f !== null || Ne !== null,
|
|
1054
1066
|
children: [
|
|
1055
|
-
f === i ? /* @__PURE__ */ e(Se, { className: "mr-2 h-4 w-4 shrink-0 animate-spin" }) : /* @__PURE__ */ e(
|
|
1056
|
-
/* @__PURE__ */ e("span", { className: "whitespace-normal text-left", children: f === i ?
|
|
1067
|
+
f === i ? /* @__PURE__ */ e(Se, { className: "mr-2 h-4 w-4 shrink-0 animate-spin" }) : /* @__PURE__ */ e(kt, { className: "mr-2 h-4 w-4 shrink-0" }),
|
|
1068
|
+
/* @__PURE__ */ e("span", { className: "whitespace-normal text-left", children: f === i ? s("ecommerce.processing") : C.length > 1 ? l(
|
|
1057
1069
|
"ecommerce.checkout_product",
|
|
1058
1070
|
"Checkout {title}",
|
|
1059
1071
|
{ title: t.title }
|
|
@@ -1071,17 +1083,17 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
1071
1083
|
"ecommerce.digital_subtotal",
|
|
1072
1084
|
"Digital subtotal"
|
|
1073
1085
|
) }),
|
|
1074
|
-
/* @__PURE__ */ e("span", { children:
|
|
1086
|
+
/* @__PURE__ */ e("span", { children: o(_e, a) })
|
|
1075
1087
|
] }),
|
|
1076
1088
|
be > 0 ? /* @__PURE__ */ r("div", { className: "flex justify-between text-sm font-semibold text-emerald-600", children: [
|
|
1077
1089
|
/* @__PURE__ */ e("span", { children: l("ecommerce.discount", "Discount") }),
|
|
1078
1090
|
/* @__PURE__ */ r("span", { children: [
|
|
1079
1091
|
"-",
|
|
1080
|
-
|
|
1092
|
+
o(be, a)
|
|
1081
1093
|
] })
|
|
1082
1094
|
] }) : null,
|
|
1083
1095
|
Ne ? /* @__PURE__ */ e("div", { className: "rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs", children: Ne }) : null,
|
|
1084
|
-
|
|
1096
|
+
S.freemius ? /* @__PURE__ */ e("div", { role: "alert", className: "rounded-lg border border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: S.freemius }) : null,
|
|
1085
1097
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: C.length > 1 ? l(
|
|
1086
1098
|
"ecommerce.freemius_multi_checkout_notice",
|
|
1087
1099
|
"Freemius licenses are completed one at a time, so each digital product gets its own checkout action."
|
|
@@ -1098,5 +1110,5 @@ const dr = ({ initialCustomer: n }) => {
|
|
|
1098
1110
|
] });
|
|
1099
1111
|
};
|
|
1100
1112
|
export {
|
|
1101
|
-
|
|
1113
|
+
mr as Checkout
|
|
1102
1114
|
};
|