@reblu/site-blocks 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -0
- package/README.md +196 -42
- package/dist/client.cjs +198 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +114 -1
- package/dist/client.d.ts +114 -1
- package/dist/client.js +196 -0
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +316 -238
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +140 -55
- package/dist/index.d.ts +140 -55
- package/dist/index.js +290 -216
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -36,6 +36,25 @@ function buildShareUrls(url, title) {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
// src/lib/shop-error-messages.ts
|
|
40
|
+
var DEFAULT_SHOP_ERROR_MESSAGES = {
|
|
41
|
+
STOCK_CHANGED: "Alguno de los productos de tu carrito ya no tiene stock suficiente.",
|
|
42
|
+
PRICE_CHANGED: "El precio de alguno de los productos de tu carrito ha cambiado. Rev\xEDsalo antes de continuar.",
|
|
43
|
+
PRODUCT_UNAVAILABLE: "Alguno de los productos de tu carrito ya no est\xE1 disponible.",
|
|
44
|
+
DISCOUNT_INVALID: "El c\xF3digo de descuento no es v\xE1lido.",
|
|
45
|
+
SHIPPING_UNAVAILABLE: "El env\xEDo no est\xE1 disponible para la direcci\xF3n indicada.",
|
|
46
|
+
INVALID_INPUT: "Revisa los datos introducidos.",
|
|
47
|
+
STORE_DISABLED: "La tienda no est\xE1 disponible en este momento.",
|
|
48
|
+
PAYMENT_PROVIDER_ERROR: "No hemos podido conectar con la pasarela de pago. Int\xE9ntalo de nuevo.",
|
|
49
|
+
INTERNAL_ERROR: "Ha ocurrido un error inesperado. Int\xE9ntalo de nuevo en unos minutos."
|
|
50
|
+
};
|
|
51
|
+
var DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE = "No se ha podido completar la operaci\xF3n. Int\xE9ntalo de nuevo.";
|
|
52
|
+
function getShopErrorMessage(code, overrides, fallback = DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE) {
|
|
53
|
+
if (!code) return fallback;
|
|
54
|
+
const messages = { ...DEFAULT_SHOP_ERROR_MESSAGES, ...overrides };
|
|
55
|
+
return messages[code] ?? fallback;
|
|
56
|
+
}
|
|
57
|
+
|
|
39
58
|
// ../../node_modules/.pnpm/devlop@1.1.0/node_modules/devlop/lib/default.js
|
|
40
59
|
function ok() {
|
|
41
60
|
}
|
|
@@ -13589,103 +13608,16 @@ function ShopFilters({
|
|
|
13589
13608
|
] });
|
|
13590
13609
|
}
|
|
13591
13610
|
|
|
13592
|
-
// src/components/
|
|
13611
|
+
// src/components/cart-line-list.tsx
|
|
13593
13612
|
import { cn as cn8 } from "@reblu/site-ui/utils";
|
|
13594
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
13613
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
13595
13614
|
var DEFAULT_LABELS2 = {
|
|
13596
|
-
add: "A\xF1adir al carrito",
|
|
13597
|
-
adding: "A\xF1adiendo\u2026",
|
|
13598
|
-
outOfStock: "Agotado"
|
|
13599
|
-
};
|
|
13600
|
-
function AddToCartButton({
|
|
13601
|
-
onAddToCart,
|
|
13602
|
-
disabled,
|
|
13603
|
-
outOfStock,
|
|
13604
|
-
pending,
|
|
13605
|
-
labels,
|
|
13606
|
-
className
|
|
13607
|
-
}) {
|
|
13608
|
-
const t = { ...DEFAULT_LABELS2, ...labels };
|
|
13609
|
-
const isDisabled = Boolean(disabled || outOfStock || pending);
|
|
13610
|
-
return /* @__PURE__ */ jsx8(
|
|
13611
|
-
"button",
|
|
13612
|
-
{
|
|
13613
|
-
type: "button",
|
|
13614
|
-
onClick: onAddToCart,
|
|
13615
|
-
disabled: isDisabled,
|
|
13616
|
-
"data-slot": "add-to-cart-button",
|
|
13617
|
-
className: cn8(
|
|
13618
|
-
"inline-flex items-center justify-center gap-2 rounded-xl px-4 py-2.5 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
13619
|
-
isDisabled ? "cursor-not-allowed bg-muted text-muted-foreground" : "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
13620
|
-
className
|
|
13621
|
-
),
|
|
13622
|
-
children: outOfStock ? t.outOfStock : pending ? t.adding : t.add
|
|
13623
|
-
}
|
|
13624
|
-
);
|
|
13625
|
-
}
|
|
13626
|
-
|
|
13627
|
-
// src/components/cart-icon.tsx
|
|
13628
|
-
import { cn as cn9 } from "@reblu/site-ui/utils";
|
|
13629
|
-
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
13630
|
-
var DEFAULT_LABELS3 = {
|
|
13631
|
-
cart: "Carrito",
|
|
13632
|
-
itemsSuffix: (count) => `${count} art\xEDculo${count === 1 ? "" : "s"}`
|
|
13633
|
-
};
|
|
13634
|
-
function CartIcon({ itemCount, href, labels, className }) {
|
|
13635
|
-
const t = { ...DEFAULT_LABELS3, ...labels };
|
|
13636
|
-
const ariaLabel = itemCount > 0 ? `${t.cart} (${t.itemsSuffix(itemCount)})` : t.cart;
|
|
13637
|
-
const displayCount = itemCount > 99 ? "99+" : String(itemCount);
|
|
13638
|
-
return /* @__PURE__ */ jsxs7(
|
|
13639
|
-
"a",
|
|
13640
|
-
{
|
|
13641
|
-
href,
|
|
13642
|
-
"aria-label": ariaLabel,
|
|
13643
|
-
"data-slot": "cart-icon",
|
|
13644
|
-
className: cn9(
|
|
13645
|
-
"relative inline-flex items-center justify-center rounded-lg p-2 text-foreground/80 transition-colors hover:bg-muted/60 hover:text-foreground",
|
|
13646
|
-
className
|
|
13647
|
-
),
|
|
13648
|
-
children: [
|
|
13649
|
-
/* @__PURE__ */ jsxs7(
|
|
13650
|
-
"svg",
|
|
13651
|
-
{
|
|
13652
|
-
viewBox: "0 0 24 24",
|
|
13653
|
-
fill: "none",
|
|
13654
|
-
stroke: "currentColor",
|
|
13655
|
-
strokeWidth: 2,
|
|
13656
|
-
strokeLinecap: "round",
|
|
13657
|
-
strokeLinejoin: "round",
|
|
13658
|
-
className: "h-5 w-5",
|
|
13659
|
-
"aria-hidden": "true",
|
|
13660
|
-
children: [
|
|
13661
|
-
/* @__PURE__ */ jsx9("circle", { cx: "9", cy: "21", r: "1" }),
|
|
13662
|
-
/* @__PURE__ */ jsx9("circle", { cx: "20", cy: "21", r: "1" }),
|
|
13663
|
-
/* @__PURE__ */ jsx9("path", { d: "M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6" })
|
|
13664
|
-
]
|
|
13665
|
-
}
|
|
13666
|
-
),
|
|
13667
|
-
itemCount > 0 && /* @__PURE__ */ jsx9(
|
|
13668
|
-
"span",
|
|
13669
|
-
{
|
|
13670
|
-
"aria-hidden": "true",
|
|
13671
|
-
className: "absolute -top-0.5 -right-0.5 flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold leading-none tabular-nums text-primary-foreground",
|
|
13672
|
-
children: displayCount
|
|
13673
|
-
}
|
|
13674
|
-
)
|
|
13675
|
-
]
|
|
13676
|
-
}
|
|
13677
|
-
);
|
|
13678
|
-
}
|
|
13679
|
-
|
|
13680
|
-
// src/components/cart-line-list.tsx
|
|
13681
|
-
import { cn as cn10 } from "@reblu/site-ui/utils";
|
|
13682
|
-
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
13683
|
-
var DEFAULT_LABELS4 = {
|
|
13684
13615
|
quantityLabel: "Cantidad",
|
|
13685
13616
|
decrease: "Reducir cantidad",
|
|
13686
13617
|
increase: "Aumentar cantidad",
|
|
13687
13618
|
remove: "Eliminar",
|
|
13688
|
-
unitPriceSuffix: "/ ud."
|
|
13619
|
+
unitPriceSuffix: "/ ud.",
|
|
13620
|
+
cancelledNotice: "Pago cancelado: tu carrito sigue aqu\xED"
|
|
13689
13621
|
};
|
|
13690
13622
|
function lineKey(productId, variantId) {
|
|
13691
13623
|
return `${productId}-${variantId ?? "no-variant"}`;
|
|
@@ -13695,40 +13627,51 @@ function CartLineList({
|
|
|
13695
13627
|
onQuantityChange,
|
|
13696
13628
|
onRemove,
|
|
13697
13629
|
liveMessage,
|
|
13630
|
+
notice,
|
|
13698
13631
|
labels,
|
|
13699
13632
|
currencyCode,
|
|
13700
13633
|
locale,
|
|
13701
13634
|
className
|
|
13702
13635
|
}) {
|
|
13703
|
-
const t = { ...
|
|
13704
|
-
|
|
13705
|
-
|
|
13706
|
-
/* @__PURE__ */
|
|
13636
|
+
const t = { ...DEFAULT_LABELS2, ...labels };
|
|
13637
|
+
const noticeContent = notice === true ? t.cancelledNotice : notice;
|
|
13638
|
+
return /* @__PURE__ */ jsxs7("div", { className: cn8("space-y-4", className), "data-slot": "cart-line-list", children: [
|
|
13639
|
+
/* @__PURE__ */ jsx8("div", { "aria-live": "polite", className: "sr-only", children: liveMessage }),
|
|
13640
|
+
noticeContent != null && noticeContent !== false && /* @__PURE__ */ jsx8(
|
|
13641
|
+
"div",
|
|
13642
|
+
{
|
|
13643
|
+
role: "status",
|
|
13644
|
+
className: "rounded-lg bg-muted px-3 py-2 text-sm text-muted-foreground",
|
|
13645
|
+
"data-slot": "cart-line-list-notice",
|
|
13646
|
+
children: noticeContent
|
|
13647
|
+
}
|
|
13648
|
+
),
|
|
13649
|
+
/* @__PURE__ */ jsx8("ul", { className: "space-y-4", children: items.map((item) => {
|
|
13707
13650
|
const maxQty = item.maxStock ?? Infinity;
|
|
13708
13651
|
const atMax = item.quantity >= maxQty;
|
|
13709
13652
|
const atMin = item.quantity <= 1;
|
|
13710
|
-
return /* @__PURE__ */
|
|
13653
|
+
return /* @__PURE__ */ jsxs7(
|
|
13711
13654
|
"li",
|
|
13712
13655
|
{
|
|
13713
13656
|
className: "flex gap-4 rounded-xl border border-border bg-card p-4",
|
|
13714
13657
|
children: [
|
|
13715
|
-
/* @__PURE__ */
|
|
13716
|
-
/* @__PURE__ */
|
|
13717
|
-
/* @__PURE__ */
|
|
13718
|
-
item.variantName && /* @__PURE__ */
|
|
13719
|
-
/* @__PURE__ */
|
|
13658
|
+
/* @__PURE__ */ jsx8("div", { className: "h-20 w-20 flex-shrink-0 overflow-hidden rounded-lg bg-muted", children: item.imageUrl ? /* @__PURE__ */ jsx8("img", { src: item.imageUrl, alt: item.name, className: "h-full w-full object-cover" }) : null }),
|
|
13659
|
+
/* @__PURE__ */ jsxs7("div", { className: "min-w-0 flex-1", children: [
|
|
13660
|
+
/* @__PURE__ */ jsx8("p", { className: "truncate text-sm font-semibold leading-tight", children: item.name }),
|
|
13661
|
+
item.variantName && /* @__PURE__ */ jsx8("p", { className: "mt-0.5 text-xs text-muted-foreground", children: item.variantName }),
|
|
13662
|
+
/* @__PURE__ */ jsxs7("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
13720
13663
|
formatPrice(item.unitPrice, currencyCode, locale),
|
|
13721
13664
|
" ",
|
|
13722
13665
|
t.unitPriceSuffix
|
|
13723
13666
|
] }),
|
|
13724
|
-
/* @__PURE__ */
|
|
13667
|
+
/* @__PURE__ */ jsxs7(
|
|
13725
13668
|
"div",
|
|
13726
13669
|
{
|
|
13727
13670
|
role: "group",
|
|
13728
13671
|
"aria-label": t.quantityLabel,
|
|
13729
13672
|
className: "mt-3 flex items-center gap-3",
|
|
13730
13673
|
children: [
|
|
13731
|
-
/* @__PURE__ */
|
|
13674
|
+
/* @__PURE__ */ jsx8(
|
|
13732
13675
|
"button",
|
|
13733
13676
|
{
|
|
13734
13677
|
type: "button",
|
|
@@ -13739,8 +13682,8 @@ function CartLineList({
|
|
|
13739
13682
|
children: "\u2212"
|
|
13740
13683
|
}
|
|
13741
13684
|
),
|
|
13742
|
-
/* @__PURE__ */
|
|
13743
|
-
/* @__PURE__ */
|
|
13685
|
+
/* @__PURE__ */ jsx8("span", { className: "w-8 text-center text-sm font-semibold tabular-nums", children: item.quantity }),
|
|
13686
|
+
/* @__PURE__ */ jsx8(
|
|
13744
13687
|
"button",
|
|
13745
13688
|
{
|
|
13746
13689
|
type: "button",
|
|
@@ -13751,7 +13694,7 @@ function CartLineList({
|
|
|
13751
13694
|
children: "+"
|
|
13752
13695
|
}
|
|
13753
13696
|
),
|
|
13754
|
-
onRemove && /* @__PURE__ */
|
|
13697
|
+
onRemove && /* @__PURE__ */ jsx8(
|
|
13755
13698
|
"button",
|
|
13756
13699
|
{
|
|
13757
13700
|
type: "button",
|
|
@@ -13765,7 +13708,7 @@ function CartLineList({
|
|
|
13765
13708
|
}
|
|
13766
13709
|
)
|
|
13767
13710
|
] }),
|
|
13768
|
-
/* @__PURE__ */
|
|
13711
|
+
/* @__PURE__ */ jsx8("div", { className: "flex-shrink-0 text-right", children: /* @__PURE__ */ jsx8("p", { className: "text-base font-bold", children: formatPrice(item.unitPrice * item.quantity, currencyCode, locale) }) })
|
|
13769
13712
|
]
|
|
13770
13713
|
},
|
|
13771
13714
|
lineKey(item.productId, item.variantId)
|
|
@@ -13775,15 +13718,16 @@ function CartLineList({
|
|
|
13775
13718
|
}
|
|
13776
13719
|
|
|
13777
13720
|
// src/components/cart-summary.tsx
|
|
13778
|
-
import { cn as
|
|
13779
|
-
import { jsx as
|
|
13780
|
-
var
|
|
13721
|
+
import { cn as cn9 } from "@reblu/site-ui/utils";
|
|
13722
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
13723
|
+
var DEFAULT_LABELS3 = {
|
|
13781
13724
|
subtotal: "Subtotal",
|
|
13782
13725
|
discountPrefix: "Descuento",
|
|
13783
13726
|
shipping: "Env\xEDo",
|
|
13784
13727
|
freeShipping: "Env\xEDo gratis",
|
|
13785
13728
|
shippingCalculated: "Se calcula en el pago",
|
|
13786
|
-
total: "Total"
|
|
13729
|
+
total: "Total",
|
|
13730
|
+
cancelledNotice: "Pago cancelado: tu carrito sigue aqu\xED"
|
|
13787
13731
|
};
|
|
13788
13732
|
function CartSummary({
|
|
13789
13733
|
subtotal,
|
|
@@ -13792,43 +13736,112 @@ function CartSummary({
|
|
|
13792
13736
|
shipping,
|
|
13793
13737
|
shippingEnabled,
|
|
13794
13738
|
total,
|
|
13739
|
+
notice,
|
|
13795
13740
|
labels,
|
|
13796
13741
|
currencyCode,
|
|
13797
13742
|
locale,
|
|
13798
13743
|
className
|
|
13799
13744
|
}) {
|
|
13800
|
-
const t = { ...
|
|
13745
|
+
const t = { ...DEFAULT_LABELS3, ...labels };
|
|
13801
13746
|
const hasDiscount = Boolean(discount && discount > 0);
|
|
13802
|
-
|
|
13803
|
-
|
|
13804
|
-
|
|
13805
|
-
|
|
13806
|
-
|
|
13807
|
-
|
|
13808
|
-
|
|
13809
|
-
|
|
13810
|
-
|
|
13811
|
-
|
|
13812
|
-
|
|
13813
|
-
|
|
13814
|
-
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13747
|
+
const noticeContent = notice === true ? t.cancelledNotice : notice;
|
|
13748
|
+
const hasNotice = noticeContent != null && noticeContent !== false;
|
|
13749
|
+
const breakdown = /* @__PURE__ */ jsxs8(
|
|
13750
|
+
"dl",
|
|
13751
|
+
{
|
|
13752
|
+
className: cn9("space-y-2 text-sm", !hasNotice && className),
|
|
13753
|
+
"data-slot": "cart-summary",
|
|
13754
|
+
children: [
|
|
13755
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex justify-between text-muted-foreground", children: [
|
|
13756
|
+
/* @__PURE__ */ jsx9("dt", { children: t.subtotal }),
|
|
13757
|
+
/* @__PURE__ */ jsx9("dd", { children: formatPrice(subtotal, currencyCode, locale) })
|
|
13758
|
+
] }),
|
|
13759
|
+
hasDiscount && /* @__PURE__ */ jsxs8("div", { className: "flex justify-between text-green-600 dark:text-green-400", children: [
|
|
13760
|
+
/* @__PURE__ */ jsxs8("dt", { children: [
|
|
13761
|
+
t.discountPrefix,
|
|
13762
|
+
discountCode ? ` (${discountCode})` : ""
|
|
13763
|
+
] }),
|
|
13764
|
+
/* @__PURE__ */ jsxs8("dd", { children: [
|
|
13765
|
+
"-",
|
|
13766
|
+
formatPrice(discount, currencyCode, locale)
|
|
13767
|
+
] })
|
|
13768
|
+
] }),
|
|
13769
|
+
shippingEnabled && /* @__PURE__ */ jsxs8("div", { className: "flex justify-between text-muted-foreground", children: [
|
|
13770
|
+
/* @__PURE__ */ jsx9("dt", { children: t.shipping }),
|
|
13771
|
+
/* @__PURE__ */ jsx9("dd", { children: shipping == null || !Number.isFinite(shipping) ? t.shippingCalculated : shipping === 0 ? t.freeShipping : formatPrice(shipping, currencyCode, locale) })
|
|
13772
|
+
] }),
|
|
13773
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex justify-between border-t border-border pt-2 text-base font-bold", children: [
|
|
13774
|
+
/* @__PURE__ */ jsx9("dt", { children: t.total }),
|
|
13775
|
+
/* @__PURE__ */ jsx9("dd", { children: formatPrice(total, currencyCode, locale) })
|
|
13776
|
+
] })
|
|
13777
|
+
]
|
|
13778
|
+
}
|
|
13779
|
+
);
|
|
13780
|
+
if (!hasNotice) return breakdown;
|
|
13781
|
+
return /* @__PURE__ */ jsxs8("div", { className: cn9("space-y-3", className), "data-slot": "cart-summary-wrapper", children: [
|
|
13782
|
+
/* @__PURE__ */ jsx9(
|
|
13783
|
+
"div",
|
|
13784
|
+
{
|
|
13785
|
+
role: "status",
|
|
13786
|
+
className: "rounded-lg bg-muted px-3 py-2 text-sm text-muted-foreground",
|
|
13787
|
+
"data-slot": "cart-summary-notice",
|
|
13788
|
+
children: noticeContent
|
|
13789
|
+
}
|
|
13790
|
+
),
|
|
13791
|
+
breakdown
|
|
13825
13792
|
] });
|
|
13826
13793
|
}
|
|
13827
13794
|
|
|
13795
|
+
// src/components/added-to-cart-toast.tsx
|
|
13796
|
+
import { cn as cn10 } from "@reblu/site-ui/utils";
|
|
13797
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
13798
|
+
var DEFAULT_LABELS4 = {
|
|
13799
|
+
success: "A\xF1adido al carrito",
|
|
13800
|
+
error: "No se pudo a\xF1adir al carrito",
|
|
13801
|
+
outOfStock: "Producto agotado",
|
|
13802
|
+
viewCart: "Ver carrito"
|
|
13803
|
+
};
|
|
13804
|
+
function AddedToCartToast({
|
|
13805
|
+
status = "success",
|
|
13806
|
+
productName,
|
|
13807
|
+
quantity,
|
|
13808
|
+
imageUrl,
|
|
13809
|
+
cartHref,
|
|
13810
|
+
labels,
|
|
13811
|
+
className
|
|
13812
|
+
}) {
|
|
13813
|
+
const t = { ...DEFAULT_LABELS4, ...labels };
|
|
13814
|
+
const message = status === "error" ? t.error : status === "outOfStock" ? t.outOfStock : t.success;
|
|
13815
|
+
const hasThumbnail = Boolean(imageUrl && imageUrl.trim().length > 0);
|
|
13816
|
+
const variant = status === "success" ? "success" : "error";
|
|
13817
|
+
return /* @__PURE__ */ jsxs9(
|
|
13818
|
+
"div",
|
|
13819
|
+
{
|
|
13820
|
+
"data-slot": "added-to-cart-toast",
|
|
13821
|
+
"data-variant": variant,
|
|
13822
|
+
className: cn10(
|
|
13823
|
+
"flex items-center gap-3 rounded-xl border border-border bg-card p-3 text-sm shadow-lg",
|
|
13824
|
+
variant === "success" && "border-green-600/30 dark:border-green-400/30",
|
|
13825
|
+
variant === "error" && "border-destructive/30",
|
|
13826
|
+
className
|
|
13827
|
+
),
|
|
13828
|
+
children: [
|
|
13829
|
+
hasThumbnail && // eslint-disable-next-line @next/next/no-img-element -- toast content, not a Next <Image> layout context
|
|
13830
|
+
/* @__PURE__ */ jsx10("img", { src: imageUrl, alt: productName, className: "h-10 w-10 flex-shrink-0 rounded-lg object-cover" }),
|
|
13831
|
+
/* @__PURE__ */ jsxs9("div", { className: "min-w-0 flex-1", children: [
|
|
13832
|
+
/* @__PURE__ */ jsx10("p", { className: "truncate font-semibold text-foreground", children: productName }),
|
|
13833
|
+
/* @__PURE__ */ jsx10("p", { className: "truncate text-muted-foreground", children: quantity && quantity > 1 ? `${message} \xB7 x${quantity}` : message })
|
|
13834
|
+
] }),
|
|
13835
|
+
/* @__PURE__ */ jsx10("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx10("a", { href: cartHref, className: "text-sm font-semibold text-primary underline-offset-2 hover:underline", children: t.viewCart }) })
|
|
13836
|
+
]
|
|
13837
|
+
}
|
|
13838
|
+
);
|
|
13839
|
+
}
|
|
13840
|
+
|
|
13828
13841
|
// src/components/checkout-login-prompt.tsx
|
|
13829
|
-
import { cn as
|
|
13830
|
-
import { Fragment as Fragment3, jsx as
|
|
13831
|
-
var
|
|
13842
|
+
import { cn as cn11 } from "@reblu/site-ui/utils";
|
|
13843
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
13844
|
+
var DEFAULT_LABELS5 = {
|
|
13832
13845
|
title: "Identificaci\xF3n",
|
|
13833
13846
|
description: "Introduce tu email para agilizar el proceso o contin\xFAa como invitado.",
|
|
13834
13847
|
emailLabel: "Email",
|
|
@@ -13852,10 +13865,10 @@ function CheckoutLoginPrompt({
|
|
|
13852
13865
|
className
|
|
13853
13866
|
}) {
|
|
13854
13867
|
if (!open) return null;
|
|
13855
|
-
const t = { ...
|
|
13868
|
+
const t = { ...DEFAULT_LABELS5, ...labels };
|
|
13856
13869
|
const isValidEmail = EMAIL_PATTERN.test(email.trim());
|
|
13857
13870
|
return /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
13858
|
-
/* @__PURE__ */
|
|
13871
|
+
/* @__PURE__ */ jsx11("div", { className: "fixed inset-0 z-50 bg-black/50", onClick: onClose, "aria-hidden": "true" }),
|
|
13859
13872
|
/* @__PURE__ */ jsxs10(
|
|
13860
13873
|
"div",
|
|
13861
13874
|
{
|
|
@@ -13863,17 +13876,17 @@ function CheckoutLoginPrompt({
|
|
|
13863
13876
|
"aria-modal": "true",
|
|
13864
13877
|
"aria-labelledby": "checkout-login-prompt-title",
|
|
13865
13878
|
"data-slot": "checkout-login-prompt",
|
|
13866
|
-
className:
|
|
13879
|
+
className: cn11(
|
|
13867
13880
|
"fixed left-1/2 top-1/2 z-50 w-full max-w-md -translate-x-1/2 -translate-y-1/2 space-y-5 rounded-2xl border border-border bg-background p-6 shadow-2xl",
|
|
13868
13881
|
className
|
|
13869
13882
|
),
|
|
13870
13883
|
children: [
|
|
13871
13884
|
/* @__PURE__ */ jsxs10("div", { className: "flex items-start justify-between gap-3", children: [
|
|
13872
13885
|
/* @__PURE__ */ jsxs10("div", { children: [
|
|
13873
|
-
/* @__PURE__ */
|
|
13874
|
-
/* @__PURE__ */
|
|
13886
|
+
/* @__PURE__ */ jsx11("h2", { id: "checkout-login-prompt-title", className: "text-xl font-bold", children: t.title }),
|
|
13887
|
+
/* @__PURE__ */ jsx11("p", { className: "mt-1 text-sm text-muted-foreground", children: t.description })
|
|
13875
13888
|
] }),
|
|
13876
|
-
/* @__PURE__ */
|
|
13889
|
+
/* @__PURE__ */ jsx11(
|
|
13877
13890
|
"button",
|
|
13878
13891
|
{
|
|
13879
13892
|
type: "button",
|
|
@@ -13885,8 +13898,8 @@ function CheckoutLoginPrompt({
|
|
|
13885
13898
|
)
|
|
13886
13899
|
] }),
|
|
13887
13900
|
/* @__PURE__ */ jsxs10("div", { className: "space-y-2", children: [
|
|
13888
|
-
/* @__PURE__ */
|
|
13889
|
-
/* @__PURE__ */
|
|
13901
|
+
/* @__PURE__ */ jsx11("label", { htmlFor: "checkout-login-prompt-email", className: "text-sm font-medium", children: t.emailLabel }),
|
|
13902
|
+
/* @__PURE__ */ jsx11(
|
|
13890
13903
|
"input",
|
|
13891
13904
|
{
|
|
13892
13905
|
id: "checkout-login-prompt-email",
|
|
@@ -13895,29 +13908,29 @@ function CheckoutLoginPrompt({
|
|
|
13895
13908
|
value: email,
|
|
13896
13909
|
onChange: (e) => onEmailChange(e.target.value),
|
|
13897
13910
|
placeholder: t.emailPlaceholder,
|
|
13898
|
-
className:
|
|
13911
|
+
className: cn11(
|
|
13899
13912
|
"w-full rounded-lg border bg-background px-3 py-2 text-sm transition focus:outline-none focus:ring-2 focus:ring-primary/20",
|
|
13900
13913
|
error ? "border-destructive" : "border-border focus:border-primary"
|
|
13901
13914
|
)
|
|
13902
13915
|
}
|
|
13903
13916
|
),
|
|
13904
|
-
error && /* @__PURE__ */
|
|
13917
|
+
error && /* @__PURE__ */ jsx11("p", { className: "text-xs text-destructive", children: error })
|
|
13905
13918
|
] }),
|
|
13906
13919
|
/* @__PURE__ */ jsxs10("div", { className: "space-y-2", children: [
|
|
13907
|
-
/* @__PURE__ */
|
|
13920
|
+
/* @__PURE__ */ jsx11(
|
|
13908
13921
|
"button",
|
|
13909
13922
|
{
|
|
13910
13923
|
type: "button",
|
|
13911
13924
|
onClick: onSubmitEmail,
|
|
13912
13925
|
disabled: checking || !isValidEmail,
|
|
13913
|
-
className:
|
|
13926
|
+
className: cn11(
|
|
13914
13927
|
"flex w-full items-center justify-center gap-2 rounded-xl px-4 py-2.5 text-sm font-semibold transition-all",
|
|
13915
13928
|
checking || !isValidEmail ? "cursor-not-allowed bg-muted text-muted-foreground" : "bg-primary text-primary-foreground hover:bg-primary/90"
|
|
13916
13929
|
),
|
|
13917
13930
|
children: checking ? t.checking : t.continueWithEmail
|
|
13918
13931
|
}
|
|
13919
13932
|
),
|
|
13920
|
-
/* @__PURE__ */
|
|
13933
|
+
/* @__PURE__ */ jsx11(
|
|
13921
13934
|
"button",
|
|
13922
13935
|
{
|
|
13923
13936
|
type: "button",
|
|
@@ -13934,9 +13947,10 @@ function CheckoutLoginPrompt({
|
|
|
13934
13947
|
}
|
|
13935
13948
|
|
|
13936
13949
|
// src/components/checkout-form.tsx
|
|
13937
|
-
import { cn as
|
|
13938
|
-
import {
|
|
13939
|
-
|
|
13950
|
+
import { cn as cn12 } from "@reblu/site-ui/utils";
|
|
13951
|
+
import { PhoneInput } from "@reblu/site-ui/phone-input";
|
|
13952
|
+
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
13953
|
+
var DEFAULT_LABELS6 = {
|
|
13940
13954
|
contactTitle: "Datos de contacto",
|
|
13941
13955
|
nameLabel: "Nombre completo",
|
|
13942
13956
|
namePlaceholder: "Tu nombre",
|
|
@@ -13956,6 +13970,8 @@ function CheckoutForm({
|
|
|
13956
13970
|
contact,
|
|
13957
13971
|
onContactChange,
|
|
13958
13972
|
contactErrors,
|
|
13973
|
+
phoneRegion,
|
|
13974
|
+
checkoutError,
|
|
13959
13975
|
discountCode,
|
|
13960
13976
|
onDiscountCodeChange,
|
|
13961
13977
|
onApplyDiscount,
|
|
@@ -13973,7 +13989,11 @@ function CheckoutForm({
|
|
|
13973
13989
|
locale,
|
|
13974
13990
|
className
|
|
13975
13991
|
}) {
|
|
13976
|
-
const t = { ...
|
|
13992
|
+
const t = { ...DEFAULT_LABELS6, ...labels };
|
|
13993
|
+
const details = checkoutError?.details;
|
|
13994
|
+
const rejectedPhone = checkoutError?.code === "INVALID_INPUT" && typeof details === "object" && details !== null && !Array.isArray(details) && "field" in details && details.field === "customerPhone" && typeof checkoutError.error === "string" && checkoutError.error.trim().length > 0;
|
|
13995
|
+
const phoneError = contactErrors?.phone ?? (rejectedPhone ? checkoutError.error : void 0);
|
|
13996
|
+
const generalError = checkoutError && !rejectedPhone ? getShopErrorMessage(typeof checkoutError.code === "string" ? checkoutError.code : void 0) : null;
|
|
13977
13997
|
function patchContact(patch3) {
|
|
13978
13998
|
onContactChange({ ...contact, ...patch3 });
|
|
13979
13999
|
}
|
|
@@ -13990,15 +14010,15 @@ function CheckoutForm({
|
|
|
13990
14010
|
{
|
|
13991
14011
|
"data-testid": "checkout-form",
|
|
13992
14012
|
onSubmit,
|
|
13993
|
-
className:
|
|
14013
|
+
className: cn12("space-y-8", className),
|
|
13994
14014
|
"data-slot": "checkout-form",
|
|
13995
14015
|
children: [
|
|
13996
14016
|
/* @__PURE__ */ jsxs11("section", { className: "space-y-4", children: [
|
|
13997
|
-
/* @__PURE__ */
|
|
14017
|
+
/* @__PURE__ */ jsx12("h2", { className: "border-b border-border pb-2 text-lg font-semibold", children: t.contactTitle }),
|
|
13998
14018
|
/* @__PURE__ */ jsxs11("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [
|
|
13999
14019
|
/* @__PURE__ */ jsxs11("div", { className: "space-y-1", children: [
|
|
14000
|
-
/* @__PURE__ */
|
|
14001
|
-
/* @__PURE__ */
|
|
14020
|
+
/* @__PURE__ */ jsx12("label", { htmlFor: "checkout-form-name", className: "text-sm font-medium", children: t.nameLabel }),
|
|
14021
|
+
/* @__PURE__ */ jsx12(
|
|
14002
14022
|
"input",
|
|
14003
14023
|
{
|
|
14004
14024
|
id: "checkout-form-name",
|
|
@@ -14007,17 +14027,17 @@ function CheckoutForm({
|
|
|
14007
14027
|
value: contact.name,
|
|
14008
14028
|
onChange: (e) => patchContact({ name: e.target.value }),
|
|
14009
14029
|
placeholder: t.namePlaceholder,
|
|
14010
|
-
className:
|
|
14030
|
+
className: cn12(
|
|
14011
14031
|
"w-full rounded-lg border bg-background px-3 py-2 text-sm transition focus:outline-none focus:ring-2 focus:ring-primary/20",
|
|
14012
14032
|
contactErrors?.name ? "border-destructive" : "border-border focus:border-primary"
|
|
14013
14033
|
)
|
|
14014
14034
|
}
|
|
14015
14035
|
),
|
|
14016
|
-
contactErrors?.name && /* @__PURE__ */
|
|
14036
|
+
contactErrors?.name && /* @__PURE__ */ jsx12("p", { className: "text-xs text-destructive", children: contactErrors.name })
|
|
14017
14037
|
] }),
|
|
14018
14038
|
/* @__PURE__ */ jsxs11("div", { className: "space-y-1", children: [
|
|
14019
|
-
/* @__PURE__ */
|
|
14020
|
-
/* @__PURE__ */
|
|
14039
|
+
/* @__PURE__ */ jsx12("label", { htmlFor: "checkout-form-email", className: "text-sm font-medium", children: t.emailLabel }),
|
|
14040
|
+
/* @__PURE__ */ jsx12(
|
|
14021
14041
|
"input",
|
|
14022
14042
|
{
|
|
14023
14043
|
id: "checkout-form-email",
|
|
@@ -14026,43 +14046,37 @@ function CheckoutForm({
|
|
|
14026
14046
|
value: contact.email,
|
|
14027
14047
|
onChange: (e) => patchContact({ email: e.target.value }),
|
|
14028
14048
|
placeholder: t.emailPlaceholder,
|
|
14029
|
-
className:
|
|
14049
|
+
className: cn12(
|
|
14030
14050
|
"w-full rounded-lg border bg-background px-3 py-2 text-sm transition focus:outline-none focus:ring-2 focus:ring-primary/20",
|
|
14031
14051
|
contactErrors?.email ? "border-destructive" : "border-border focus:border-primary"
|
|
14032
14052
|
)
|
|
14033
14053
|
}
|
|
14034
14054
|
),
|
|
14035
|
-
contactErrors?.email && /* @__PURE__ */
|
|
14055
|
+
contactErrors?.email && /* @__PURE__ */ jsx12("p", { className: "text-xs text-destructive", children: contactErrors.email })
|
|
14036
14056
|
] }),
|
|
14037
|
-
/* @__PURE__ */
|
|
14038
|
-
|
|
14039
|
-
|
|
14040
|
-
"
|
|
14041
|
-
|
|
14042
|
-
|
|
14043
|
-
|
|
14044
|
-
|
|
14045
|
-
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
"w-full rounded-lg border bg-background px-3 py-2 text-sm transition focus:outline-none focus:ring-2 focus:ring-primary/20",
|
|
14049
|
-
contactErrors?.phone ? "border-destructive" : "border-border focus:border-primary"
|
|
14050
|
-
)
|
|
14051
|
-
}
|
|
14052
|
-
),
|
|
14053
|
-
contactErrors?.phone && /* @__PURE__ */ jsx13("p", { className: "text-xs text-destructive", children: contactErrors.phone })
|
|
14054
|
-
] })
|
|
14057
|
+
/* @__PURE__ */ jsx12("div", { className: "space-y-1", children: /* @__PURE__ */ jsx12(
|
|
14058
|
+
PhoneInput,
|
|
14059
|
+
{
|
|
14060
|
+
id: "checkout-form-phone",
|
|
14061
|
+
label: t.phoneLabel,
|
|
14062
|
+
region: phoneRegion,
|
|
14063
|
+
value: contact.phone ?? "",
|
|
14064
|
+
onChange: (phone) => patchContact({ phone }),
|
|
14065
|
+
error: phoneError
|
|
14066
|
+
}
|
|
14067
|
+
) })
|
|
14055
14068
|
] })
|
|
14056
14069
|
] }),
|
|
14057
14070
|
children2,
|
|
14071
|
+
generalError ? /* @__PURE__ */ jsx12("p", { role: "alert", className: "text-sm text-destructive", children: generalError }) : null,
|
|
14058
14072
|
/* @__PURE__ */ jsxs11("section", { className: "space-y-3", children: [
|
|
14059
|
-
/* @__PURE__ */
|
|
14073
|
+
/* @__PURE__ */ jsx12("h2", { className: "border-b border-border pb-2 text-lg font-semibold", children: t.discountTitle }),
|
|
14060
14074
|
appliedDiscount ? /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between rounded-lg border border-green-200 bg-green-50 px-4 py-3 dark:border-green-800 dark:bg-green-900/20", children: [
|
|
14061
14075
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 text-sm text-green-700 dark:text-green-400", children: [
|
|
14062
|
-
/* @__PURE__ */
|
|
14063
|
-
/* @__PURE__ */
|
|
14076
|
+
/* @__PURE__ */ jsx12("span", { className: "font-semibold", children: appliedDiscount.code }),
|
|
14077
|
+
/* @__PURE__ */ jsx12("span", { children: t.discountAppliedSuffix(formatPrice(appliedDiscount.amount, currencyCode, locale)) })
|
|
14064
14078
|
] }),
|
|
14065
|
-
/* @__PURE__ */
|
|
14079
|
+
/* @__PURE__ */ jsx12(
|
|
14066
14080
|
"button",
|
|
14067
14081
|
{
|
|
14068
14082
|
type: "button",
|
|
@@ -14073,8 +14087,8 @@ function CheckoutForm({
|
|
|
14073
14087
|
}
|
|
14074
14088
|
)
|
|
14075
14089
|
] }) : /* @__PURE__ */ jsxs11("div", { className: "flex gap-2", children: [
|
|
14076
|
-
/* @__PURE__ */
|
|
14077
|
-
/* @__PURE__ */
|
|
14090
|
+
/* @__PURE__ */ jsx12("label", { htmlFor: "checkout-form-discount-code", className: "sr-only", children: t.discountTitle }),
|
|
14091
|
+
/* @__PURE__ */ jsx12(
|
|
14078
14092
|
"input",
|
|
14079
14093
|
{
|
|
14080
14094
|
id: "checkout-form-discount-code",
|
|
@@ -14086,7 +14100,7 @@ function CheckoutForm({
|
|
|
14086
14100
|
className: "flex-1 rounded-lg border border-border bg-background px-3 py-2 text-sm uppercase transition focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
14087
14101
|
}
|
|
14088
14102
|
),
|
|
14089
|
-
/* @__PURE__ */
|
|
14103
|
+
/* @__PURE__ */ jsx12(
|
|
14090
14104
|
"button",
|
|
14091
14105
|
{
|
|
14092
14106
|
type: "button",
|
|
@@ -14097,14 +14111,14 @@ function CheckoutForm({
|
|
|
14097
14111
|
}
|
|
14098
14112
|
)
|
|
14099
14113
|
] }),
|
|
14100
|
-
discountError && /* @__PURE__ */
|
|
14114
|
+
discountError && /* @__PURE__ */ jsx12("p", { className: "text-xs text-destructive", children: discountError })
|
|
14101
14115
|
] }),
|
|
14102
|
-
/* @__PURE__ */
|
|
14116
|
+
/* @__PURE__ */ jsx12(
|
|
14103
14117
|
"button",
|
|
14104
14118
|
{
|
|
14105
14119
|
type: "submit",
|
|
14106
14120
|
disabled: submitting || submitDisabled,
|
|
14107
|
-
className:
|
|
14121
|
+
className: cn12(
|
|
14108
14122
|
"flex w-full items-center justify-center gap-2 rounded-xl px-4 py-3 font-semibold transition-all",
|
|
14109
14123
|
submitting || submitDisabled ? "cursor-not-allowed bg-muted text-muted-foreground" : "bg-primary text-primary-foreground hover:bg-primary/90"
|
|
14110
14124
|
),
|
|
@@ -14118,9 +14132,9 @@ function CheckoutForm({
|
|
|
14118
14132
|
}
|
|
14119
14133
|
|
|
14120
14134
|
// src/components/order-confirmation.tsx
|
|
14121
|
-
import { cn as
|
|
14122
|
-
import { jsx as
|
|
14123
|
-
var
|
|
14135
|
+
import { cn as cn13 } from "@reblu/site-ui/utils";
|
|
14136
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
14137
|
+
var DEFAULT_LABELS7 = {
|
|
14124
14138
|
pollingTitle: "Confirmando tu pedido\u2026",
|
|
14125
14139
|
pollingDescription: "Estamos procesando el pago, un momento\u2026",
|
|
14126
14140
|
foundTitle: "\xA1Pedido confirmado!",
|
|
@@ -14130,27 +14144,64 @@ var DEFAULT_LABELS8 = {
|
|
|
14130
14144
|
orderNumberLabel: "Pedido confirmado",
|
|
14131
14145
|
totalLabel: "Total",
|
|
14132
14146
|
confirmationEmailPrefix: "Te hemos enviado un email de confirmaci\xF3n a",
|
|
14133
|
-
sessionReferenceLabel: "Referencia de sesi\xF3n"
|
|
14147
|
+
sessionReferenceLabel: "Referencia de sesi\xF3n",
|
|
14148
|
+
// REB-837
|
|
14149
|
+
failedTitle: "El pago no se ha completado",
|
|
14150
|
+
failedDescription: "No se ha podido procesar el pago. Tu carrito sigue intacto.",
|
|
14151
|
+
backToCartLabel: "Volver al carrito",
|
|
14152
|
+
refundedTitle: "Este pedido ha sido reembolsado",
|
|
14153
|
+
refundedDescription: "El importe se ha devuelto a tu m\xE9todo de pago original.",
|
|
14154
|
+
partiallyRefundedTitle: "Este pedido ha sido reembolsado parcialmente",
|
|
14155
|
+
partiallyRefundedDescription: "Parte del importe se ha devuelto a tu m\xE9todo de pago original.",
|
|
14156
|
+
pendingTimeoutTitle: "Pedido recibido",
|
|
14157
|
+
pendingTimeoutDescription: "Estamos confirmando el pago; te enviaremos un email en cuanto se complete.",
|
|
14158
|
+
recheckLabel: "Volver a comprobar",
|
|
14159
|
+
notFoundTitle: "No encontramos ning\xFAn pedido",
|
|
14160
|
+
notFoundDescription: "Comprueba el enlace o contacta con nosotros si el problema persiste.",
|
|
14161
|
+
errorTitle: "Ha ocurrido un error",
|
|
14162
|
+
errorDescription: "No hemos podido comprobar el estado de tu pedido.",
|
|
14163
|
+
orderReferenceLabel: "Referencia del pedido"
|
|
14134
14164
|
};
|
|
14135
14165
|
function OrderConfirmation({
|
|
14136
14166
|
status,
|
|
14137
14167
|
order,
|
|
14138
14168
|
sessionId,
|
|
14169
|
+
cartHref,
|
|
14170
|
+
onRecheck,
|
|
14139
14171
|
labels,
|
|
14140
14172
|
currencyCode,
|
|
14141
14173
|
locale,
|
|
14142
14174
|
className
|
|
14143
14175
|
}) {
|
|
14144
|
-
const t = { ...
|
|
14145
|
-
const
|
|
14146
|
-
const
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14176
|
+
const t = { ...DEFAULT_LABELS7, ...labels };
|
|
14177
|
+
const isPolling = status === "polling" || status === "loading";
|
|
14178
|
+
const isFound = status === "found" || status === "paid";
|
|
14179
|
+
const { title, description } = (() => {
|
|
14180
|
+
if (isPolling) return { title: t.pollingTitle, description: t.pollingDescription };
|
|
14181
|
+
if (status === "failed") return { title: t.failedTitle, description: t.failedDescription };
|
|
14182
|
+
if (status === "refunded") return { title: t.refundedTitle, description: t.refundedDescription };
|
|
14183
|
+
if (status === "partially_refunded") {
|
|
14184
|
+
return { title: t.partiallyRefundedTitle, description: t.partiallyRefundedDescription };
|
|
14185
|
+
}
|
|
14186
|
+
if (status === "pending_timeout") {
|
|
14187
|
+
return { title: t.pendingTimeoutTitle, description: t.pendingTimeoutDescription };
|
|
14188
|
+
}
|
|
14189
|
+
if (status === "not_found") return { title: t.notFoundTitle, description: t.notFoundDescription };
|
|
14190
|
+
if (status === "error") return { title: t.errorTitle, description: t.errorDescription };
|
|
14191
|
+
if (isFound || order) return { title: t.foundTitle, description: t.foundDescription };
|
|
14192
|
+
return { title: t.timeoutTitle, description: t.timeoutDescription };
|
|
14193
|
+
})();
|
|
14194
|
+
const showFullOrderSummary = Boolean(order) && (isFound || status === "timeout");
|
|
14195
|
+
const showOrderReference = Boolean(order) && !showFullOrderSummary && (status === "refunded" || status === "partially_refunded" || status === "pending_timeout");
|
|
14196
|
+
const showSessionReference = !order && sessionId && (status === "timeout" || status === "not_found" || status === "pending_timeout");
|
|
14197
|
+
const showRecheck = (status === "pending_timeout" || status === "error") && onRecheck;
|
|
14198
|
+
return /* @__PURE__ */ jsxs12("div", { className: cn13("space-y-6 text-center", className), "data-slot": "order-confirmation", children: [
|
|
14199
|
+
/* @__PURE__ */ jsx13("h1", { className: "text-3xl font-bold", children: title }),
|
|
14200
|
+
/* @__PURE__ */ jsx13("p", { className: "text-lg text-muted-foreground", children: description }),
|
|
14201
|
+
showFullOrderSummary && order && /* @__PURE__ */ jsxs12("div", { className: "space-y-6", children: [
|
|
14151
14202
|
/* @__PURE__ */ jsxs12("div", { className: "inline-block rounded-xl bg-muted px-6 py-4", children: [
|
|
14152
|
-
/* @__PURE__ */
|
|
14153
|
-
/* @__PURE__ */
|
|
14203
|
+
/* @__PURE__ */ jsx13("p", { className: "mb-1 text-xs uppercase tracking-widest text-muted-foreground", children: t.orderNumberLabel }),
|
|
14204
|
+
/* @__PURE__ */ jsx13("p", { className: "font-mono text-lg font-semibold", children: order.orderNumber })
|
|
14154
14205
|
] }),
|
|
14155
14206
|
/* @__PURE__ */ jsxs12("div", { className: "mx-auto max-w-sm space-y-3 rounded-xl border border-border bg-card p-5 text-left", children: [
|
|
14156
14207
|
order.items.map((item, idx) => /* @__PURE__ */ jsxs12(
|
|
@@ -14164,37 +14215,59 @@ function OrderConfirmation({
|
|
|
14164
14215
|
" x",
|
|
14165
14216
|
item.quantity
|
|
14166
14217
|
] }),
|
|
14167
|
-
/* @__PURE__ */
|
|
14218
|
+
/* @__PURE__ */ jsx13("span", { children: formatPrice(item.total, currencyCode, locale) })
|
|
14168
14219
|
]
|
|
14169
14220
|
},
|
|
14170
14221
|
idx
|
|
14171
14222
|
)),
|
|
14172
|
-
/* @__PURE__ */
|
|
14173
|
-
/* @__PURE__ */
|
|
14174
|
-
/* @__PURE__ */
|
|
14223
|
+
/* @__PURE__ */ jsx13("div", { className: "space-y-1 border-t border-border pt-3 text-sm", children: /* @__PURE__ */ jsxs12("div", { className: "flex justify-between pt-1 text-base font-bold", children: [
|
|
14224
|
+
/* @__PURE__ */ jsx13("span", { children: t.totalLabel }),
|
|
14225
|
+
/* @__PURE__ */ jsx13("span", { children: formatPrice(order.total, currencyCode, locale) })
|
|
14175
14226
|
] }) })
|
|
14176
14227
|
] }),
|
|
14177
14228
|
/* @__PURE__ */ jsxs12("p", { className: "mx-auto max-w-sm text-sm text-muted-foreground", children: [
|
|
14178
14229
|
t.confirmationEmailPrefix,
|
|
14179
14230
|
" ",
|
|
14180
|
-
/* @__PURE__ */
|
|
14231
|
+
/* @__PURE__ */ jsx13("span", { className: "font-medium text-foreground", children: order.customerEmail }),
|
|
14181
14232
|
"."
|
|
14182
14233
|
] })
|
|
14183
14234
|
] }),
|
|
14184
|
-
|
|
14185
|
-
/* @__PURE__ */
|
|
14186
|
-
/* @__PURE__ */
|
|
14235
|
+
showOrderReference && order && /* @__PURE__ */ jsxs12("div", { className: "inline-block rounded-xl bg-muted px-6 py-4", children: [
|
|
14236
|
+
/* @__PURE__ */ jsx13("p", { className: "mb-1 text-xs uppercase tracking-widest text-muted-foreground", children: t.orderReferenceLabel }),
|
|
14237
|
+
/* @__PURE__ */ jsx13("p", { className: "font-mono text-lg font-semibold", children: order.orderNumber })
|
|
14238
|
+
] }),
|
|
14239
|
+
status === "failed" && cartHref && /* @__PURE__ */ jsx13(
|
|
14240
|
+
"a",
|
|
14241
|
+
{
|
|
14242
|
+
href: cartHref,
|
|
14243
|
+
className: "inline-block text-sm font-semibold text-primary underline-offset-2 hover:underline",
|
|
14244
|
+
children: t.backToCartLabel
|
|
14245
|
+
}
|
|
14246
|
+
),
|
|
14247
|
+
showRecheck && /* @__PURE__ */ jsx13(
|
|
14248
|
+
"button",
|
|
14249
|
+
{
|
|
14250
|
+
type: "button",
|
|
14251
|
+
onClick: onRecheck,
|
|
14252
|
+
className: "inline-flex items-center justify-center rounded-xl bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground transition-colors hover:bg-primary/90",
|
|
14253
|
+
children: t.recheckLabel
|
|
14254
|
+
}
|
|
14255
|
+
),
|
|
14256
|
+
showSessionReference && /* @__PURE__ */ jsxs12("div", { className: "inline-block rounded-xl bg-muted px-6 py-4", children: [
|
|
14257
|
+
/* @__PURE__ */ jsx13("p", { className: "mb-1 text-xs uppercase tracking-widest text-muted-foreground", children: t.sessionReferenceLabel }),
|
|
14258
|
+
/* @__PURE__ */ jsx13("p", { className: "break-all font-mono text-sm font-semibold", children: sessionId })
|
|
14187
14259
|
] })
|
|
14188
14260
|
] });
|
|
14189
14261
|
}
|
|
14190
14262
|
export {
|
|
14191
14263
|
ALLOWED_YOUTUBE_HOSTS,
|
|
14192
|
-
|
|
14193
|
-
CartIcon,
|
|
14264
|
+
AddedToCartToast,
|
|
14194
14265
|
CartLineList,
|
|
14195
14266
|
CartSummary,
|
|
14196
14267
|
CheckoutForm,
|
|
14197
14268
|
CheckoutLoginPrompt,
|
|
14269
|
+
DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE,
|
|
14270
|
+
DEFAULT_SHOP_ERROR_MESSAGES,
|
|
14198
14271
|
DEFAULT_SHOP_PRICE_BANDS,
|
|
14199
14272
|
MarkdownRenderer,
|
|
14200
14273
|
OrderConfirmation,
|
|
@@ -14206,6 +14279,7 @@ export {
|
|
|
14206
14279
|
Treatment,
|
|
14207
14280
|
buildShareUrls,
|
|
14208
14281
|
formatPrice,
|
|
14282
|
+
getShopErrorMessage,
|
|
14209
14283
|
isAllowedYouTubeHost,
|
|
14210
14284
|
markdownToSafeHtml,
|
|
14211
14285
|
readingTime,
|