@reblu/site-blocks 0.21.0 → 0.23.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 +33 -0
- package/README.md +125 -0
- package/dist/index.cjs +367 -178
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +101 -2
- package/dist/index.d.ts +101 -2
- package/dist/index.js +363 -178
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -50,7 +50,19 @@ var DEFAULT_SHOP_ERROR_MESSAGES = {
|
|
|
50
50
|
// REB-73 — checkout refusals before any payment.
|
|
51
51
|
BILLING_DATA_REQUIRED: "Para emitir tu factura necesitamos tu NIF/NIE o un documento de identificaci\xF3n, tu nombre y tu direcci\xF3n de facturaci\xF3n.",
|
|
52
52
|
INVOICING_NOT_READY: "No se puede completar la compra en este momento. Int\xE9ntalo m\xE1s tarde.",
|
|
53
|
-
FULL_INVOICE_UNAVAILABLE: "Esta tienda no emite facturas completas: contin\xFAa sin solicitarla."
|
|
53
|
+
FULL_INVOICE_UNAVAILABLE: "Esta tienda no emite facturas completas: contin\xFAa sin solicitarla.",
|
|
54
|
+
// REB-912 — the code used up its total uses; refused before any payment.
|
|
55
|
+
DISCOUNT_LIMIT_REACHED: "Este c\xF3digo ya ha alcanzado su l\xEDmite de usos",
|
|
56
|
+
// REB-1197 — delivery refusals before any payment.
|
|
57
|
+
PICKUP_UNAVAILABLE: "La recogida no est\xE1 disponible en esta tienda. Elige el env\xEDo a domicilio.",
|
|
58
|
+
PICKUP_LOCATION_INVALID: "El punto de recogida elegido ya no est\xE1 disponible. Elige otro.",
|
|
59
|
+
SHIPPING_ADDRESS_REQUIRED: "Indica la direcci\xF3n de env\xEDo para recibir tu pedido.",
|
|
60
|
+
ORDER_TOO_HEAVY: "Tu pedido supera el peso m\xE1ximo. Reduce alguna cantidad o divide la compra.",
|
|
61
|
+
// REB-1198 — terms acceptance, before any payment.
|
|
62
|
+
TERMS_NOT_ACCEPTED: "Para continuar, acepta las condiciones generales de contrataci\xF3n.",
|
|
63
|
+
TERMS_VERSION_CHANGED: "Las condiciones de contrataci\xF3n se han actualizado. Rev\xEDsalas y vuelve a aceptarlas.",
|
|
64
|
+
// Owner, 2-Nov — no home delivery nor pickup for a cart that ships.
|
|
65
|
+
DELIVERY_UNAVAILABLE: "Ahora mismo no podemos entregar productos f\xEDsicos. Int\xE9ntalo m\xE1s tarde o contacta con la tienda."
|
|
54
66
|
};
|
|
55
67
|
var DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE = "No se ha podido completar la operaci\xF3n. Int\xE9ntalo de nuevo.";
|
|
56
68
|
function getShopErrorMessage(code, overrides, fallback = DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE) {
|
|
@@ -14733,9 +14745,129 @@ function ShopFilters({
|
|
|
14733
14745
|
] });
|
|
14734
14746
|
}
|
|
14735
14747
|
|
|
14736
|
-
// src/components/
|
|
14748
|
+
// src/components/course-catalog-filters.tsx
|
|
14737
14749
|
import { cn as cn13 } from "@reblu/site-ui/utils";
|
|
14738
14750
|
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
14751
|
+
var DEFAULT_COURSE_PRICE_BANDS = [
|
|
14752
|
+
{ max: 5e3 },
|
|
14753
|
+
{ min: 5e3, max: 15e3 },
|
|
14754
|
+
{ min: 15e3, max: 3e4 },
|
|
14755
|
+
{ min: 3e4 }
|
|
14756
|
+
];
|
|
14757
|
+
var DEFAULT_COURSE_CATALOG_FILTERS_LABELS = {
|
|
14758
|
+
instructor: "Docente",
|
|
14759
|
+
allInstructors: "Todos",
|
|
14760
|
+
price: "Precio",
|
|
14761
|
+
free: "Gratis",
|
|
14762
|
+
clearAll: "Quitar filtros",
|
|
14763
|
+
priceUnder: (formattedMax) => `Hasta ${formattedMax}`,
|
|
14764
|
+
priceOver: (formattedMin) => `Desde ${formattedMin}`,
|
|
14765
|
+
priceRange: (formattedMin, formattedMax) => `${formattedMin} \u2013 ${formattedMax}`
|
|
14766
|
+
};
|
|
14767
|
+
function instructorName(instructor) {
|
|
14768
|
+
return [instructor.firstName, instructor.lastName].filter(Boolean).join(" ");
|
|
14769
|
+
}
|
|
14770
|
+
function bandLabel(band, t, currencyCode, locale) {
|
|
14771
|
+
if (band.label) return band.label;
|
|
14772
|
+
const fmt = (cents) => formatPrice(cents, currencyCode, locale);
|
|
14773
|
+
if (band.min !== void 0 && band.max !== void 0)
|
|
14774
|
+
return t.priceRange(fmt(band.min), fmt(band.max));
|
|
14775
|
+
if (band.max !== void 0) return t.priceUnder(fmt(band.max));
|
|
14776
|
+
if (band.min !== void 0) return t.priceOver(fmt(band.min));
|
|
14777
|
+
return "";
|
|
14778
|
+
}
|
|
14779
|
+
function CourseCatalogFilters({
|
|
14780
|
+
instructors,
|
|
14781
|
+
hrefs,
|
|
14782
|
+
active = {},
|
|
14783
|
+
onChange,
|
|
14784
|
+
priceBands = DEFAULT_COURSE_PRICE_BANDS,
|
|
14785
|
+
labels,
|
|
14786
|
+
currencyCode,
|
|
14787
|
+
locale,
|
|
14788
|
+
className
|
|
14789
|
+
}) {
|
|
14790
|
+
const t = { ...DEFAULT_COURSE_CATALOG_FILTERS_LABELS, ...labels };
|
|
14791
|
+
const named = instructors.filter((i) => instructorName(i) !== "");
|
|
14792
|
+
const showInstructors = named.length > 0 || active.instructor !== void 0;
|
|
14793
|
+
const isFree = Boolean(active.free);
|
|
14794
|
+
return /* @__PURE__ */ jsxs16("div", { className: cn13("space-y-6", className), "data-slot": "course-catalog-filters", children: [
|
|
14795
|
+
showInstructors && /* @__PURE__ */ jsxs16(FilterFieldset, { legend: t.instructor, children: [
|
|
14796
|
+
/* @__PURE__ */ jsx17(
|
|
14797
|
+
OptionLink,
|
|
14798
|
+
{
|
|
14799
|
+
href: hrefs.instructor(void 0),
|
|
14800
|
+
active: active.instructor === void 0,
|
|
14801
|
+
label: t.allInstructors,
|
|
14802
|
+
onActivate: onChange ? () => onChange({ instructor: void 0 }) : void 0
|
|
14803
|
+
}
|
|
14804
|
+
),
|
|
14805
|
+
named.map((instructor) => {
|
|
14806
|
+
const isActive = active.instructor === instructor.id;
|
|
14807
|
+
const next2 = isActive ? void 0 : instructor.id;
|
|
14808
|
+
return /* @__PURE__ */ jsx17(
|
|
14809
|
+
OptionLink,
|
|
14810
|
+
{
|
|
14811
|
+
href: hrefs.instructor(next2),
|
|
14812
|
+
active: isActive,
|
|
14813
|
+
label: instructorName(instructor),
|
|
14814
|
+
onActivate: onChange ? () => onChange({ instructor: next2 }) : void 0
|
|
14815
|
+
},
|
|
14816
|
+
instructor.id
|
|
14817
|
+
);
|
|
14818
|
+
})
|
|
14819
|
+
] }),
|
|
14820
|
+
/* @__PURE__ */ jsxs16(FilterFieldset, { legend: t.price, children: [
|
|
14821
|
+
/* @__PURE__ */ jsx17(
|
|
14822
|
+
OptionLink,
|
|
14823
|
+
{
|
|
14824
|
+
href: hrefs.free(!isFree),
|
|
14825
|
+
active: isFree,
|
|
14826
|
+
label: t.free,
|
|
14827
|
+
onActivate: onChange ? () => onChange(
|
|
14828
|
+
isFree ? { free: false } : { free: true, priceMin: void 0, priceMax: void 0 }
|
|
14829
|
+
) : void 0
|
|
14830
|
+
}
|
|
14831
|
+
),
|
|
14832
|
+
priceBands.map((band, i) => {
|
|
14833
|
+
const isActive = !isFree && active.priceMin === band.min && active.priceMax === band.max;
|
|
14834
|
+
const nextMin = isActive ? void 0 : band.min;
|
|
14835
|
+
const nextMax = isActive ? void 0 : band.max;
|
|
14836
|
+
return /* @__PURE__ */ jsx17(
|
|
14837
|
+
OptionLink,
|
|
14838
|
+
{
|
|
14839
|
+
href: hrefs.price(nextMin, nextMax),
|
|
14840
|
+
active: isActive,
|
|
14841
|
+
label: bandLabel(band, t, currencyCode, locale),
|
|
14842
|
+
onActivate: onChange ? () => onChange({ priceMin: nextMin, priceMax: nextMax, free: false }) : void 0
|
|
14843
|
+
},
|
|
14844
|
+
i
|
|
14845
|
+
);
|
|
14846
|
+
})
|
|
14847
|
+
] }),
|
|
14848
|
+
/* @__PURE__ */ jsx17(
|
|
14849
|
+
"a",
|
|
14850
|
+
{
|
|
14851
|
+
href: hrefs.clearAll(),
|
|
14852
|
+
onClick: onChange ? (event) => {
|
|
14853
|
+
event.preventDefault();
|
|
14854
|
+
onChange({
|
|
14855
|
+
instructor: void 0,
|
|
14856
|
+
priceMin: void 0,
|
|
14857
|
+
priceMax: void 0,
|
|
14858
|
+
free: false
|
|
14859
|
+
});
|
|
14860
|
+
} : void 0,
|
|
14861
|
+
className: "text-sm font-medium text-muted-foreground underline-offset-4 hover:text-foreground hover:underline",
|
|
14862
|
+
children: t.clearAll
|
|
14863
|
+
}
|
|
14864
|
+
)
|
|
14865
|
+
] });
|
|
14866
|
+
}
|
|
14867
|
+
|
|
14868
|
+
// src/components/cart-line-list.tsx
|
|
14869
|
+
import { cn as cn14 } from "@reblu/site-ui/utils";
|
|
14870
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
14739
14871
|
var DEFAULT_LABELS2 = {
|
|
14740
14872
|
quantityLabel: "Cantidad",
|
|
14741
14873
|
decrease: "Reducir cantidad",
|
|
@@ -14761,9 +14893,9 @@ function CartLineList({
|
|
|
14761
14893
|
}) {
|
|
14762
14894
|
const t = { ...DEFAULT_LABELS2, ...labels };
|
|
14763
14895
|
const noticeContent = notice === true ? t.cancelledNotice : notice;
|
|
14764
|
-
return /* @__PURE__ */
|
|
14765
|
-
/* @__PURE__ */
|
|
14766
|
-
noticeContent != null && noticeContent !== false && /* @__PURE__ */
|
|
14896
|
+
return /* @__PURE__ */ jsxs17("div", { className: cn14("space-y-4", className), "data-slot": "cart-line-list", children: [
|
|
14897
|
+
/* @__PURE__ */ jsx18("div", { "aria-live": "polite", className: "sr-only", children: liveMessage }),
|
|
14898
|
+
noticeContent != null && noticeContent !== false && /* @__PURE__ */ jsx18(
|
|
14767
14899
|
"div",
|
|
14768
14900
|
{
|
|
14769
14901
|
role: "status",
|
|
@@ -14772,33 +14904,33 @@ function CartLineList({
|
|
|
14772
14904
|
children: noticeContent
|
|
14773
14905
|
}
|
|
14774
14906
|
),
|
|
14775
|
-
/* @__PURE__ */
|
|
14907
|
+
/* @__PURE__ */ jsx18("ul", { className: "space-y-4", children: items.map((item) => {
|
|
14776
14908
|
const maxQty = item.maxStock ?? Infinity;
|
|
14777
14909
|
const atMax = item.quantity >= maxQty;
|
|
14778
14910
|
const atMin = item.quantity <= 1;
|
|
14779
14911
|
const message = lineMessage?.(item);
|
|
14780
|
-
return /* @__PURE__ */
|
|
14912
|
+
return /* @__PURE__ */ jsxs17(
|
|
14781
14913
|
"li",
|
|
14782
14914
|
{
|
|
14783
14915
|
className: "flex gap-4 rounded-xl border border-border bg-card p-4",
|
|
14784
14916
|
children: [
|
|
14785
|
-
/* @__PURE__ */
|
|
14786
|
-
/* @__PURE__ */
|
|
14787
|
-
/* @__PURE__ */
|
|
14788
|
-
item.variantName && /* @__PURE__ */
|
|
14789
|
-
/* @__PURE__ */
|
|
14917
|
+
/* @__PURE__ */ jsx18("div", { className: "h-20 w-20 flex-shrink-0 overflow-hidden rounded-lg bg-muted", children: item.imageUrl ? /* @__PURE__ */ jsx18("img", { src: item.imageUrl, alt: item.name, className: "h-full w-full object-cover" }) : null }),
|
|
14918
|
+
/* @__PURE__ */ jsxs17("div", { className: "min-w-0 flex-1", children: [
|
|
14919
|
+
/* @__PURE__ */ jsx18("p", { className: "truncate text-sm font-semibold leading-tight", children: item.name }),
|
|
14920
|
+
item.variantName && /* @__PURE__ */ jsx18("p", { className: "mt-0.5 text-xs text-muted-foreground", children: item.variantName }),
|
|
14921
|
+
/* @__PURE__ */ jsxs17("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
14790
14922
|
formatPrice(item.unitPrice, currencyCode, locale),
|
|
14791
14923
|
" ",
|
|
14792
14924
|
t.unitPriceSuffix
|
|
14793
14925
|
] }),
|
|
14794
|
-
/* @__PURE__ */
|
|
14926
|
+
/* @__PURE__ */ jsxs17(
|
|
14795
14927
|
"div",
|
|
14796
14928
|
{
|
|
14797
14929
|
role: "group",
|
|
14798
14930
|
"aria-label": t.quantityLabel,
|
|
14799
14931
|
className: "mt-3 flex items-center gap-3",
|
|
14800
14932
|
children: [
|
|
14801
|
-
/* @__PURE__ */
|
|
14933
|
+
/* @__PURE__ */ jsx18(
|
|
14802
14934
|
"button",
|
|
14803
14935
|
{
|
|
14804
14936
|
type: "button",
|
|
@@ -14809,8 +14941,8 @@ function CartLineList({
|
|
|
14809
14941
|
children: "\u2212"
|
|
14810
14942
|
}
|
|
14811
14943
|
),
|
|
14812
|
-
/* @__PURE__ */
|
|
14813
|
-
/* @__PURE__ */
|
|
14944
|
+
/* @__PURE__ */ jsx18("span", { className: "w-8 text-center text-sm font-semibold tabular-nums", children: item.quantity }),
|
|
14945
|
+
/* @__PURE__ */ jsx18(
|
|
14814
14946
|
"button",
|
|
14815
14947
|
{
|
|
14816
14948
|
type: "button",
|
|
@@ -14821,7 +14953,7 @@ function CartLineList({
|
|
|
14821
14953
|
children: "+"
|
|
14822
14954
|
}
|
|
14823
14955
|
),
|
|
14824
|
-
onRemove && /* @__PURE__ */
|
|
14956
|
+
onRemove && /* @__PURE__ */ jsx18(
|
|
14825
14957
|
"button",
|
|
14826
14958
|
{
|
|
14827
14959
|
type: "button",
|
|
@@ -14834,7 +14966,7 @@ function CartLineList({
|
|
|
14834
14966
|
]
|
|
14835
14967
|
}
|
|
14836
14968
|
),
|
|
14837
|
-
message != null && message !== false && /* @__PURE__ */
|
|
14969
|
+
message != null && message !== false && /* @__PURE__ */ jsx18(
|
|
14838
14970
|
"p",
|
|
14839
14971
|
{
|
|
14840
14972
|
className: "mt-2 text-sm text-destructive",
|
|
@@ -14843,7 +14975,7 @@ function CartLineList({
|
|
|
14843
14975
|
}
|
|
14844
14976
|
)
|
|
14845
14977
|
] }),
|
|
14846
|
-
/* @__PURE__ */
|
|
14978
|
+
/* @__PURE__ */ jsx18("div", { className: "flex-shrink-0 text-right", children: /* @__PURE__ */ jsx18("p", { className: "text-base font-bold", children: formatPrice(item.unitPrice * item.quantity, currencyCode, locale) }) })
|
|
14847
14979
|
]
|
|
14848
14980
|
},
|
|
14849
14981
|
lineKey(item.productId, item.variantId)
|
|
@@ -14853,8 +14985,8 @@ function CartLineList({
|
|
|
14853
14985
|
}
|
|
14854
14986
|
|
|
14855
14987
|
// src/components/cart-summary.tsx
|
|
14856
|
-
import { cn as
|
|
14857
|
-
import { jsx as
|
|
14988
|
+
import { cn as cn15 } from "@reblu/site-ui/utils";
|
|
14989
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
14858
14990
|
var DEFAULT_LABELS3 = {
|
|
14859
14991
|
subtotal: "Subtotal",
|
|
14860
14992
|
discountPrefix: "Descuento",
|
|
@@ -14884,37 +15016,37 @@ function CartSummary({
|
|
|
14884
15016
|
const hasDiscount = Boolean(discountAmount && discountAmount > 0);
|
|
14885
15017
|
const noticeContent = notice === true ? t.cancelledNotice : notice;
|
|
14886
15018
|
const hasNotice = noticeContent != null && noticeContent !== false;
|
|
14887
|
-
const breakdown = /* @__PURE__ */
|
|
15019
|
+
const breakdown = /* @__PURE__ */ jsxs18(
|
|
14888
15020
|
"dl",
|
|
14889
15021
|
{
|
|
14890
|
-
className:
|
|
15022
|
+
className: cn15("space-y-2 text-sm", !hasNotice && className),
|
|
14891
15023
|
"data-slot": "cart-summary",
|
|
14892
15024
|
children: [
|
|
14893
|
-
/* @__PURE__ */
|
|
14894
|
-
/* @__PURE__ */
|
|
14895
|
-
/* @__PURE__ */
|
|
15025
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between text-muted-foreground", children: [
|
|
15026
|
+
/* @__PURE__ */ jsx19("dt", { children: t.subtotal }),
|
|
15027
|
+
/* @__PURE__ */ jsx19("dd", { children: formatPrice(subtotal, currencyCode, locale) })
|
|
14896
15028
|
] }),
|
|
14897
|
-
hasDiscount && /* @__PURE__ */
|
|
14898
|
-
/* @__PURE__ */
|
|
14899
|
-
/* @__PURE__ */
|
|
15029
|
+
hasDiscount && /* @__PURE__ */ jsxs18("div", { className: "flex justify-between text-green-600 dark:text-green-400", children: [
|
|
15030
|
+
/* @__PURE__ */ jsx19("dt", { children: autoDiscount ? t.staffDiscountApplied : `${t.discountPrefix}${discountCode ? ` (${discountCode})` : ""}` }),
|
|
15031
|
+
/* @__PURE__ */ jsxs18("dd", { children: [
|
|
14900
15032
|
"-",
|
|
14901
15033
|
formatPrice(discountAmount, currencyCode, locale)
|
|
14902
15034
|
] })
|
|
14903
15035
|
] }),
|
|
14904
|
-
shippingEnabled && /* @__PURE__ */
|
|
14905
|
-
/* @__PURE__ */
|
|
14906
|
-
/* @__PURE__ */
|
|
15036
|
+
shippingEnabled && /* @__PURE__ */ jsxs18("div", { className: "flex justify-between text-muted-foreground", children: [
|
|
15037
|
+
/* @__PURE__ */ jsx19("dt", { children: t.shipping }),
|
|
15038
|
+
/* @__PURE__ */ jsx19("dd", { children: shipping == null || !Number.isFinite(shipping) ? t.shippingCalculated : shipping === 0 ? t.freeShipping : formatPrice(shipping, currencyCode, locale) })
|
|
14907
15039
|
] }),
|
|
14908
|
-
/* @__PURE__ */
|
|
14909
|
-
/* @__PURE__ */
|
|
14910
|
-
/* @__PURE__ */
|
|
15040
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex justify-between border-t border-border pt-2 text-base font-bold", children: [
|
|
15041
|
+
/* @__PURE__ */ jsx19("dt", { children: t.total }),
|
|
15042
|
+
/* @__PURE__ */ jsx19("dd", { children: formatPrice(total, currencyCode, locale) })
|
|
14911
15043
|
] })
|
|
14912
15044
|
]
|
|
14913
15045
|
}
|
|
14914
15046
|
);
|
|
14915
15047
|
if (!hasNotice) return breakdown;
|
|
14916
|
-
return /* @__PURE__ */
|
|
14917
|
-
/* @__PURE__ */
|
|
15048
|
+
return /* @__PURE__ */ jsxs18("div", { className: cn15("space-y-3", className), "data-slot": "cart-summary-wrapper", children: [
|
|
15049
|
+
/* @__PURE__ */ jsx19(
|
|
14918
15050
|
"div",
|
|
14919
15051
|
{
|
|
14920
15052
|
role: "status",
|
|
@@ -14928,8 +15060,8 @@ function CartSummary({
|
|
|
14928
15060
|
}
|
|
14929
15061
|
|
|
14930
15062
|
// src/components/cart-adjustments-notice.tsx
|
|
14931
|
-
import { cn as
|
|
14932
|
-
import { jsx as
|
|
15063
|
+
import { cn as cn16 } from "@reblu/site-ui/utils";
|
|
15064
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
14933
15065
|
var DEFAULT_LABELS4 = {
|
|
14934
15066
|
removed: (names) => names.length === 1 ? `Hemos quitado del carrito: ${names[0]}, ya no est\xE1 disponible.` : `Hemos quitado del carrito: ${names.join(", ")}, ya no est\xE1n disponibles.`,
|
|
14935
15067
|
quantityChanged: (name, quantity) => `Hemos ajustado la cantidad de ${name} a ${quantity} por el stock disponible.`,
|
|
@@ -14963,20 +15095,20 @@ function CartAdjustmentsNotice({
|
|
|
14963
15095
|
);
|
|
14964
15096
|
}
|
|
14965
15097
|
if (messages.length === 0) return null;
|
|
14966
|
-
return /* @__PURE__ */
|
|
15098
|
+
return /* @__PURE__ */ jsx20(
|
|
14967
15099
|
"div",
|
|
14968
15100
|
{
|
|
14969
15101
|
role: "status",
|
|
14970
|
-
className:
|
|
15102
|
+
className: cn16("rounded-lg border border-border bg-muted px-3 py-2 text-sm", className),
|
|
14971
15103
|
"data-slot": "cart-adjustments-notice",
|
|
14972
|
-
children: messages.length === 1 ? /* @__PURE__ */
|
|
15104
|
+
children: messages.length === 1 ? /* @__PURE__ */ jsx20("p", { children: messages[0] }) : /* @__PURE__ */ jsx20("ul", { className: "list-disc space-y-1 pl-4", children: messages.map((message, index) => /* @__PURE__ */ jsx20("li", { children: message }, index)) })
|
|
14973
15105
|
}
|
|
14974
15106
|
);
|
|
14975
15107
|
}
|
|
14976
15108
|
|
|
14977
15109
|
// src/components/added-to-cart-toast.tsx
|
|
14978
|
-
import { cn as
|
|
14979
|
-
import { jsx as
|
|
15110
|
+
import { cn as cn17 } from "@reblu/site-ui/utils";
|
|
15111
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
14980
15112
|
var DEFAULT_LABELS5 = {
|
|
14981
15113
|
success: "A\xF1adido al carrito",
|
|
14982
15114
|
error: "No se pudo a\xF1adir al carrito",
|
|
@@ -14996,12 +15128,12 @@ function AddedToCartToast({
|
|
|
14996
15128
|
const message = status === "error" ? t.error : status === "outOfStock" ? t.outOfStock : t.success;
|
|
14997
15129
|
const hasThumbnail = Boolean(imageUrl && imageUrl.trim().length > 0);
|
|
14998
15130
|
const variant = status === "success" ? "success" : "error";
|
|
14999
|
-
return /* @__PURE__ */
|
|
15131
|
+
return /* @__PURE__ */ jsxs19(
|
|
15000
15132
|
"div",
|
|
15001
15133
|
{
|
|
15002
15134
|
"data-slot": "added-to-cart-toast",
|
|
15003
15135
|
"data-variant": variant,
|
|
15004
|
-
className:
|
|
15136
|
+
className: cn17(
|
|
15005
15137
|
"flex items-center gap-3 rounded-xl border border-border bg-card p-3 text-sm shadow-lg",
|
|
15006
15138
|
variant === "success" && "border-green-600/30 dark:border-green-400/30",
|
|
15007
15139
|
variant === "error" && "border-destructive/30",
|
|
@@ -15009,20 +15141,20 @@ function AddedToCartToast({
|
|
|
15009
15141
|
),
|
|
15010
15142
|
children: [
|
|
15011
15143
|
hasThumbnail && // eslint-disable-next-line @next/next/no-img-element -- toast content, not a Next <Image> layout context
|
|
15012
|
-
/* @__PURE__ */
|
|
15013
|
-
/* @__PURE__ */
|
|
15014
|
-
/* @__PURE__ */
|
|
15015
|
-
/* @__PURE__ */
|
|
15144
|
+
/* @__PURE__ */ jsx21("img", { src: imageUrl, alt: productName, className: "h-10 w-10 flex-shrink-0 rounded-lg object-cover" }),
|
|
15145
|
+
/* @__PURE__ */ jsxs19("div", { className: "min-w-0 flex-1", children: [
|
|
15146
|
+
/* @__PURE__ */ jsx21("p", { className: "truncate font-semibold text-foreground", children: productName }),
|
|
15147
|
+
/* @__PURE__ */ jsx21("p", { className: "truncate text-muted-foreground", children: quantity && quantity > 1 ? `${message} \xB7 x${quantity}` : message })
|
|
15016
15148
|
] }),
|
|
15017
|
-
/* @__PURE__ */
|
|
15149
|
+
/* @__PURE__ */ jsx21("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx21("a", { href: cartHref, className: "text-sm font-semibold text-primary underline-offset-2 hover:underline", children: t.viewCart }) })
|
|
15018
15150
|
]
|
|
15019
15151
|
}
|
|
15020
15152
|
);
|
|
15021
15153
|
}
|
|
15022
15154
|
|
|
15023
15155
|
// src/components/checkout-login-prompt.tsx
|
|
15024
|
-
import { cn as
|
|
15025
|
-
import { Fragment as Fragment3, jsx as
|
|
15156
|
+
import { cn as cn18 } from "@reblu/site-ui/utils";
|
|
15157
|
+
import { Fragment as Fragment3, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
15026
15158
|
var DEFAULT_LABELS6 = {
|
|
15027
15159
|
title: "Identificaci\xF3n",
|
|
15028
15160
|
description: "Introduce tu email para agilizar el proceso o contin\xFAa como invitado.",
|
|
@@ -15049,26 +15181,26 @@ function CheckoutLoginPrompt({
|
|
|
15049
15181
|
if (!open) return null;
|
|
15050
15182
|
const t = { ...DEFAULT_LABELS6, ...labels };
|
|
15051
15183
|
const isValidEmail = EMAIL_PATTERN.test(email.trim());
|
|
15052
|
-
return /* @__PURE__ */
|
|
15053
|
-
/* @__PURE__ */
|
|
15054
|
-
/* @__PURE__ */
|
|
15184
|
+
return /* @__PURE__ */ jsxs20(Fragment3, { children: [
|
|
15185
|
+
/* @__PURE__ */ jsx22("div", { className: "fixed inset-0 z-50 bg-black/50", onClick: onClose, "aria-hidden": "true" }),
|
|
15186
|
+
/* @__PURE__ */ jsxs20(
|
|
15055
15187
|
"div",
|
|
15056
15188
|
{
|
|
15057
15189
|
role: "dialog",
|
|
15058
15190
|
"aria-modal": "true",
|
|
15059
15191
|
"aria-labelledby": "checkout-login-prompt-title",
|
|
15060
15192
|
"data-slot": "checkout-login-prompt",
|
|
15061
|
-
className:
|
|
15193
|
+
className: cn18(
|
|
15062
15194
|
"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",
|
|
15063
15195
|
className
|
|
15064
15196
|
),
|
|
15065
15197
|
children: [
|
|
15066
|
-
/* @__PURE__ */
|
|
15067
|
-
/* @__PURE__ */
|
|
15068
|
-
/* @__PURE__ */
|
|
15069
|
-
/* @__PURE__ */
|
|
15198
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-start justify-between gap-3", children: [
|
|
15199
|
+
/* @__PURE__ */ jsxs20("div", { children: [
|
|
15200
|
+
/* @__PURE__ */ jsx22("h2", { id: "checkout-login-prompt-title", className: "text-xl font-bold", children: t.title }),
|
|
15201
|
+
/* @__PURE__ */ jsx22("p", { className: "mt-1 text-sm text-muted-foreground", children: t.description })
|
|
15070
15202
|
] }),
|
|
15071
|
-
/* @__PURE__ */
|
|
15203
|
+
/* @__PURE__ */ jsx22(
|
|
15072
15204
|
"button",
|
|
15073
15205
|
{
|
|
15074
15206
|
type: "button",
|
|
@@ -15079,9 +15211,9 @@ function CheckoutLoginPrompt({
|
|
|
15079
15211
|
}
|
|
15080
15212
|
)
|
|
15081
15213
|
] }),
|
|
15082
|
-
/* @__PURE__ */
|
|
15083
|
-
/* @__PURE__ */
|
|
15084
|
-
/* @__PURE__ */
|
|
15214
|
+
/* @__PURE__ */ jsxs20("div", { className: "space-y-2", children: [
|
|
15215
|
+
/* @__PURE__ */ jsx22("label", { htmlFor: "checkout-login-prompt-email", className: "text-sm font-medium", children: t.emailLabel }),
|
|
15216
|
+
/* @__PURE__ */ jsx22(
|
|
15085
15217
|
"input",
|
|
15086
15218
|
{
|
|
15087
15219
|
id: "checkout-login-prompt-email",
|
|
@@ -15090,29 +15222,29 @@ function CheckoutLoginPrompt({
|
|
|
15090
15222
|
value: email,
|
|
15091
15223
|
onChange: (e) => onEmailChange(e.target.value),
|
|
15092
15224
|
placeholder: t.emailPlaceholder,
|
|
15093
|
-
className:
|
|
15225
|
+
className: cn18(
|
|
15094
15226
|
"w-full rounded-lg border bg-background px-3 py-2 text-sm transition focus:outline-none focus:ring-2 focus:ring-primary/20",
|
|
15095
15227
|
error ? "border-destructive" : "border-border focus:border-primary"
|
|
15096
15228
|
)
|
|
15097
15229
|
}
|
|
15098
15230
|
),
|
|
15099
|
-
error && /* @__PURE__ */
|
|
15231
|
+
error && /* @__PURE__ */ jsx22("p", { className: "text-xs text-destructive", children: error })
|
|
15100
15232
|
] }),
|
|
15101
|
-
/* @__PURE__ */
|
|
15102
|
-
/* @__PURE__ */
|
|
15233
|
+
/* @__PURE__ */ jsxs20("div", { className: "space-y-2", children: [
|
|
15234
|
+
/* @__PURE__ */ jsx22(
|
|
15103
15235
|
"button",
|
|
15104
15236
|
{
|
|
15105
15237
|
type: "button",
|
|
15106
15238
|
onClick: onSubmitEmail,
|
|
15107
15239
|
disabled: checking || !isValidEmail,
|
|
15108
|
-
className:
|
|
15240
|
+
className: cn18(
|
|
15109
15241
|
"flex w-full cursor-pointer items-center justify-center gap-2 rounded-xl px-4 py-2.5 text-sm font-semibold transition-all",
|
|
15110
15242
|
checking || !isValidEmail ? "cursor-not-allowed bg-muted text-muted-foreground" : "bg-primary text-primary-foreground hover:bg-primary/90"
|
|
15111
15243
|
),
|
|
15112
15244
|
children: checking ? t.checking : t.continueWithEmail
|
|
15113
15245
|
}
|
|
15114
15246
|
),
|
|
15115
|
-
/* @__PURE__ */
|
|
15247
|
+
/* @__PURE__ */ jsx22(
|
|
15116
15248
|
"button",
|
|
15117
15249
|
{
|
|
15118
15250
|
type: "button",
|
|
@@ -15129,9 +15261,9 @@ function CheckoutLoginPrompt({
|
|
|
15129
15261
|
}
|
|
15130
15262
|
|
|
15131
15263
|
// src/components/checkout-form.tsx
|
|
15132
|
-
import { cn as
|
|
15264
|
+
import { cn as cn19 } from "@reblu/site-ui/utils";
|
|
15133
15265
|
import { PhoneInput } from "@reblu/site-ui/phone-input";
|
|
15134
|
-
import { Fragment as Fragment4, jsx as
|
|
15266
|
+
import { Fragment as Fragment4, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
15135
15267
|
var DEFAULT_LABELS7 = {
|
|
15136
15268
|
contactTitle: "Datos de contacto",
|
|
15137
15269
|
nameLabel: "Nombre completo",
|
|
@@ -15187,22 +15319,22 @@ function CheckoutForm({
|
|
|
15187
15319
|
event.preventDefault();
|
|
15188
15320
|
if (discountCode.trim() && !discountApplying) onApplyDiscount();
|
|
15189
15321
|
}
|
|
15190
|
-
return /* @__PURE__ */
|
|
15322
|
+
return /* @__PURE__ */ jsxs21(Fragment4, { children: [
|
|
15191
15323
|
loginPrompt,
|
|
15192
|
-
/* @__PURE__ */
|
|
15324
|
+
/* @__PURE__ */ jsxs21(
|
|
15193
15325
|
"form",
|
|
15194
15326
|
{
|
|
15195
15327
|
"data-testid": "checkout-form",
|
|
15196
15328
|
onSubmit,
|
|
15197
|
-
className:
|
|
15329
|
+
className: cn19("space-y-8", className),
|
|
15198
15330
|
"data-slot": "checkout-form",
|
|
15199
15331
|
children: [
|
|
15200
|
-
/* @__PURE__ */
|
|
15201
|
-
/* @__PURE__ */
|
|
15202
|
-
/* @__PURE__ */
|
|
15203
|
-
/* @__PURE__ */
|
|
15204
|
-
/* @__PURE__ */
|
|
15205
|
-
/* @__PURE__ */
|
|
15332
|
+
/* @__PURE__ */ jsxs21("section", { className: "space-y-4", children: [
|
|
15333
|
+
/* @__PURE__ */ jsx23("h2", { className: "border-b border-border pb-2 text-lg font-semibold", children: t.contactTitle }),
|
|
15334
|
+
/* @__PURE__ */ jsxs21("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [
|
|
15335
|
+
/* @__PURE__ */ jsxs21("div", { className: "space-y-1", children: [
|
|
15336
|
+
/* @__PURE__ */ jsx23("label", { htmlFor: "checkout-form-name", className: "text-sm font-medium", children: t.nameLabel }),
|
|
15337
|
+
/* @__PURE__ */ jsx23(
|
|
15206
15338
|
"input",
|
|
15207
15339
|
{
|
|
15208
15340
|
id: "checkout-form-name",
|
|
@@ -15211,17 +15343,17 @@ function CheckoutForm({
|
|
|
15211
15343
|
value: contact.name,
|
|
15212
15344
|
onChange: (e) => patchContact({ name: e.target.value }),
|
|
15213
15345
|
placeholder: t.namePlaceholder,
|
|
15214
|
-
className:
|
|
15346
|
+
className: cn19(
|
|
15215
15347
|
"w-full rounded-lg border bg-background px-3 py-2 text-sm transition focus:outline-none focus:ring-2 focus:ring-primary/20",
|
|
15216
15348
|
contactErrors?.name ? "border-destructive" : "border-border focus:border-primary"
|
|
15217
15349
|
)
|
|
15218
15350
|
}
|
|
15219
15351
|
),
|
|
15220
|
-
contactErrors?.name && /* @__PURE__ */
|
|
15352
|
+
contactErrors?.name && /* @__PURE__ */ jsx23("p", { className: "text-xs text-destructive", children: contactErrors.name })
|
|
15221
15353
|
] }),
|
|
15222
|
-
/* @__PURE__ */
|
|
15223
|
-
/* @__PURE__ */
|
|
15224
|
-
/* @__PURE__ */
|
|
15354
|
+
/* @__PURE__ */ jsxs21("div", { className: "space-y-1", children: [
|
|
15355
|
+
/* @__PURE__ */ jsx23("label", { htmlFor: "checkout-form-email", className: "text-sm font-medium", children: t.emailLabel }),
|
|
15356
|
+
/* @__PURE__ */ jsx23(
|
|
15225
15357
|
"input",
|
|
15226
15358
|
{
|
|
15227
15359
|
id: "checkout-form-email",
|
|
@@ -15230,15 +15362,15 @@ function CheckoutForm({
|
|
|
15230
15362
|
value: contact.email,
|
|
15231
15363
|
onChange: (e) => patchContact({ email: e.target.value }),
|
|
15232
15364
|
placeholder: t.emailPlaceholder,
|
|
15233
|
-
className:
|
|
15365
|
+
className: cn19(
|
|
15234
15366
|
"w-full rounded-lg border bg-background px-3 py-2 text-sm transition focus:outline-none focus:ring-2 focus:ring-primary/20",
|
|
15235
15367
|
contactErrors?.email ? "border-destructive" : "border-border focus:border-primary"
|
|
15236
15368
|
)
|
|
15237
15369
|
}
|
|
15238
15370
|
),
|
|
15239
|
-
contactErrors?.email && /* @__PURE__ */
|
|
15371
|
+
contactErrors?.email && /* @__PURE__ */ jsx23("p", { className: "text-xs text-destructive", children: contactErrors.email })
|
|
15240
15372
|
] }),
|
|
15241
|
-
/* @__PURE__ */
|
|
15373
|
+
/* @__PURE__ */ jsx23("div", { className: "space-y-1", children: /* @__PURE__ */ jsx23(
|
|
15242
15374
|
PhoneInput,
|
|
15243
15375
|
{
|
|
15244
15376
|
id: "checkout-form-phone",
|
|
@@ -15252,26 +15384,26 @@ function CheckoutForm({
|
|
|
15252
15384
|
] })
|
|
15253
15385
|
] }),
|
|
15254
15386
|
children2,
|
|
15255
|
-
generalError ? /* @__PURE__ */
|
|
15256
|
-
/* @__PURE__ */
|
|
15257
|
-
/* @__PURE__ */
|
|
15258
|
-
autoDiscount ? /* @__PURE__ */
|
|
15387
|
+
generalError ? /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-sm text-destructive", children: generalError }) : null,
|
|
15388
|
+
/* @__PURE__ */ jsxs21("section", { className: "space-y-3", children: [
|
|
15389
|
+
/* @__PURE__ */ jsx23("h2", { className: "border-b border-border pb-2 text-lg font-semibold", children: t.discountTitle }),
|
|
15390
|
+
autoDiscount ? /* @__PURE__ */ jsxs21(
|
|
15259
15391
|
"div",
|
|
15260
15392
|
{
|
|
15261
15393
|
className: "flex items-center gap-2 rounded-lg border border-green-200 bg-green-50 px-4 py-3 text-sm text-green-700 dark:border-green-800 dark:bg-green-900/20 dark:text-green-400",
|
|
15262
15394
|
"data-slot": "checkout-staff-discount",
|
|
15263
15395
|
children: [
|
|
15264
|
-
/* @__PURE__ */
|
|
15265
|
-
/* @__PURE__ */
|
|
15396
|
+
/* @__PURE__ */ jsx23("span", { className: "font-semibold", children: t.staffDiscountApplied }),
|
|
15397
|
+
/* @__PURE__ */ jsx23("span", { children: t.discountAppliedSuffix(formatPrice(autoDiscount.amount, currencyCode, locale)) })
|
|
15266
15398
|
]
|
|
15267
15399
|
}
|
|
15268
15400
|
) : null,
|
|
15269
|
-
appliedDiscount && !autoDiscount ? /* @__PURE__ */
|
|
15270
|
-
/* @__PURE__ */
|
|
15271
|
-
/* @__PURE__ */
|
|
15272
|
-
/* @__PURE__ */
|
|
15401
|
+
appliedDiscount && !autoDiscount ? /* @__PURE__ */ jsxs21("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: [
|
|
15402
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2 text-sm text-green-700 dark:text-green-400", children: [
|
|
15403
|
+
/* @__PURE__ */ jsx23("span", { className: "font-semibold", children: appliedDiscount.code }),
|
|
15404
|
+
/* @__PURE__ */ jsx23("span", { children: t.discountAppliedSuffix(formatPrice(appliedDiscount.amount, currencyCode, locale)) })
|
|
15273
15405
|
] }),
|
|
15274
|
-
/* @__PURE__ */
|
|
15406
|
+
/* @__PURE__ */ jsx23(
|
|
15275
15407
|
"button",
|
|
15276
15408
|
{
|
|
15277
15409
|
type: "button",
|
|
@@ -15281,9 +15413,9 @@ function CheckoutForm({
|
|
|
15281
15413
|
children: t.removeDiscount
|
|
15282
15414
|
}
|
|
15283
15415
|
)
|
|
15284
|
-
] }) : /* @__PURE__ */
|
|
15285
|
-
/* @__PURE__ */
|
|
15286
|
-
/* @__PURE__ */
|
|
15416
|
+
] }) : /* @__PURE__ */ jsxs21("div", { className: "flex gap-2", children: [
|
|
15417
|
+
/* @__PURE__ */ jsx23("label", { htmlFor: "checkout-form-discount-code", className: "sr-only", children: t.discountTitle }),
|
|
15418
|
+
/* @__PURE__ */ jsx23(
|
|
15287
15419
|
"input",
|
|
15288
15420
|
{
|
|
15289
15421
|
id: "checkout-form-discount-code",
|
|
@@ -15295,7 +15427,7 @@ function CheckoutForm({
|
|
|
15295
15427
|
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"
|
|
15296
15428
|
}
|
|
15297
15429
|
),
|
|
15298
|
-
/* @__PURE__ */
|
|
15430
|
+
/* @__PURE__ */ jsx23(
|
|
15299
15431
|
"button",
|
|
15300
15432
|
{
|
|
15301
15433
|
type: "button",
|
|
@@ -15306,14 +15438,14 @@ function CheckoutForm({
|
|
|
15306
15438
|
}
|
|
15307
15439
|
)
|
|
15308
15440
|
] }),
|
|
15309
|
-
discountError && /* @__PURE__ */
|
|
15441
|
+
discountError && /* @__PURE__ */ jsx23("p", { className: "text-xs text-destructive", children: discountError })
|
|
15310
15442
|
] }),
|
|
15311
|
-
/* @__PURE__ */
|
|
15443
|
+
/* @__PURE__ */ jsx23(
|
|
15312
15444
|
"button",
|
|
15313
15445
|
{
|
|
15314
15446
|
type: "submit",
|
|
15315
15447
|
disabled: submitting || submitDisabled,
|
|
15316
|
-
className:
|
|
15448
|
+
className: cn19(
|
|
15317
15449
|
"flex w-full cursor-pointer items-center justify-center gap-2 rounded-xl px-4 py-3 font-semibold transition-all",
|
|
15318
15450
|
submitting || submitDisabled ? "cursor-not-allowed bg-muted text-muted-foreground" : "bg-primary text-primary-foreground hover:bg-primary/90"
|
|
15319
15451
|
),
|
|
@@ -15327,11 +15459,11 @@ function CheckoutForm({
|
|
|
15327
15459
|
}
|
|
15328
15460
|
|
|
15329
15461
|
// src/components/order-confirmation.tsx
|
|
15330
|
-
import { cn as
|
|
15462
|
+
import { cn as cn21 } from "@reblu/site-ui/utils";
|
|
15331
15463
|
|
|
15332
15464
|
// src/components/order-invoice-link.tsx
|
|
15333
|
-
import { cn as
|
|
15334
|
-
import { jsx as
|
|
15465
|
+
import { cn as cn20 } from "@reblu/site-ui/utils";
|
|
15466
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
15335
15467
|
var DEFAULT_LABELS8 = {
|
|
15336
15468
|
linkLabel: "Descargar la factura {number}",
|
|
15337
15469
|
signInHint: "Te pediremos que inicies sesi\xF3n para abrirla."
|
|
@@ -15339,8 +15471,8 @@ var DEFAULT_LABELS8 = {
|
|
|
15339
15471
|
function OrderInvoiceLink({ invoice, labels, className }) {
|
|
15340
15472
|
if (!invoice) return null;
|
|
15341
15473
|
const t = { ...DEFAULT_LABELS8, ...labels };
|
|
15342
|
-
return /* @__PURE__ */
|
|
15343
|
-
/* @__PURE__ */
|
|
15474
|
+
return /* @__PURE__ */ jsxs22("div", { className: cn20("space-y-1 text-sm", className), "data-slot": "order-invoice-link", children: [
|
|
15475
|
+
/* @__PURE__ */ jsx24(
|
|
15344
15476
|
"a",
|
|
15345
15477
|
{
|
|
15346
15478
|
href: invoice.url,
|
|
@@ -15348,12 +15480,12 @@ function OrderInvoiceLink({ invoice, labels, className }) {
|
|
|
15348
15480
|
children: t.linkLabel.replace("{number}", invoice.number)
|
|
15349
15481
|
}
|
|
15350
15482
|
),
|
|
15351
|
-
/* @__PURE__ */
|
|
15483
|
+
/* @__PURE__ */ jsx24("p", { className: "text-muted-foreground", children: t.signInHint })
|
|
15352
15484
|
] });
|
|
15353
15485
|
}
|
|
15354
15486
|
|
|
15355
15487
|
// src/components/order-confirmation.tsx
|
|
15356
|
-
import { jsx as
|
|
15488
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
15357
15489
|
var DEFAULT_LABELS9 = {
|
|
15358
15490
|
pollingTitle: "Confirmando tu pedido\u2026",
|
|
15359
15491
|
pollingDescription: "Estamos procesando el pago, un momento\u2026",
|
|
@@ -15419,43 +15551,43 @@ function OrderConfirmation({
|
|
|
15419
15551
|
const showOrderReference = Boolean(order) && !showFullOrderSummary && (status === "refunded" || status === "partially_refunded" || status === "pending_timeout");
|
|
15420
15552
|
const showSessionReference = !order && sessionId && (status === "timeout" || status === "not_found" || status === "pending_timeout");
|
|
15421
15553
|
const showRecheck = (status === "pending_timeout" || status === "error") && onRecheck;
|
|
15422
|
-
return /* @__PURE__ */
|
|
15423
|
-
/* @__PURE__ */
|
|
15424
|
-
/* @__PURE__ */
|
|
15425
|
-
showFullOrderSummary && order && /* @__PURE__ */
|
|
15426
|
-
/* @__PURE__ */
|
|
15427
|
-
/* @__PURE__ */
|
|
15428
|
-
/* @__PURE__ */
|
|
15554
|
+
return /* @__PURE__ */ jsxs23("div", { className: cn21("space-y-6 text-center", className), "data-slot": "order-confirmation", children: [
|
|
15555
|
+
/* @__PURE__ */ jsx25("h1", { className: "text-3xl font-bold", children: title }),
|
|
15556
|
+
/* @__PURE__ */ jsx25("p", { className: "text-lg text-muted-foreground", children: description }),
|
|
15557
|
+
showFullOrderSummary && order && /* @__PURE__ */ jsxs23("div", { className: "space-y-6", children: [
|
|
15558
|
+
/* @__PURE__ */ jsxs23("div", { className: "inline-block rounded-xl bg-muted px-6 py-4", children: [
|
|
15559
|
+
/* @__PURE__ */ jsx25("p", { className: "mb-1 text-xs uppercase tracking-widest text-muted-foreground", children: t.orderNumberLabel }),
|
|
15560
|
+
/* @__PURE__ */ jsx25("p", { className: "font-mono text-lg font-semibold", children: order.orderNumber })
|
|
15429
15561
|
] }),
|
|
15430
|
-
/* @__PURE__ */
|
|
15431
|
-
order.items.map((item, idx) => /* @__PURE__ */
|
|
15562
|
+
/* @__PURE__ */ jsxs23("div", { className: "mx-auto max-w-sm space-y-3 rounded-xl border border-border bg-card p-5 text-left", children: [
|
|
15563
|
+
order.items.map((item, idx) => /* @__PURE__ */ jsxs23(
|
|
15432
15564
|
"div",
|
|
15433
15565
|
{
|
|
15434
15566
|
className: "flex justify-between gap-4 text-sm",
|
|
15435
15567
|
children: [
|
|
15436
|
-
/* @__PURE__ */
|
|
15568
|
+
/* @__PURE__ */ jsxs23("span", { className: "max-w-[60%] truncate text-muted-foreground", children: [
|
|
15437
15569
|
item.product.name,
|
|
15438
15570
|
item.variant ? ` (${item.variant.name})` : "",
|
|
15439
15571
|
" x",
|
|
15440
15572
|
item.quantity
|
|
15441
15573
|
] }),
|
|
15442
|
-
/* @__PURE__ */
|
|
15574
|
+
/* @__PURE__ */ jsx25("span", { children: formatPrice(item.total, currencyCode, locale) })
|
|
15443
15575
|
]
|
|
15444
15576
|
},
|
|
15445
15577
|
idx
|
|
15446
15578
|
)),
|
|
15447
|
-
/* @__PURE__ */
|
|
15448
|
-
/* @__PURE__ */
|
|
15449
|
-
/* @__PURE__ */
|
|
15579
|
+
/* @__PURE__ */ jsx25("div", { className: "space-y-1 border-t border-border pt-3 text-sm", children: /* @__PURE__ */ jsxs23("div", { className: "flex justify-between pt-1 text-base font-bold", children: [
|
|
15580
|
+
/* @__PURE__ */ jsx25("span", { children: t.totalLabel }),
|
|
15581
|
+
/* @__PURE__ */ jsx25("span", { children: formatPrice(order.total, currencyCode, locale) })
|
|
15450
15582
|
] }) })
|
|
15451
15583
|
] }),
|
|
15452
|
-
/* @__PURE__ */
|
|
15584
|
+
/* @__PURE__ */ jsxs23("p", { className: "mx-auto max-w-sm text-sm text-muted-foreground", children: [
|
|
15453
15585
|
t.confirmationEmailPrefix,
|
|
15454
15586
|
" ",
|
|
15455
|
-
/* @__PURE__ */
|
|
15587
|
+
/* @__PURE__ */ jsx25("span", { className: "font-medium text-foreground", children: order.customerEmail }),
|
|
15456
15588
|
"."
|
|
15457
15589
|
] }),
|
|
15458
|
-
/* @__PURE__ */
|
|
15590
|
+
/* @__PURE__ */ jsx25(
|
|
15459
15591
|
OrderInvoiceLink,
|
|
15460
15592
|
{
|
|
15461
15593
|
invoice: order.invoice,
|
|
@@ -15463,11 +15595,11 @@ function OrderConfirmation({
|
|
|
15463
15595
|
}
|
|
15464
15596
|
)
|
|
15465
15597
|
] }),
|
|
15466
|
-
showOrderReference && order && /* @__PURE__ */
|
|
15467
|
-
/* @__PURE__ */
|
|
15468
|
-
/* @__PURE__ */
|
|
15598
|
+
showOrderReference && order && /* @__PURE__ */ jsxs23("div", { className: "inline-block rounded-xl bg-muted px-6 py-4", children: [
|
|
15599
|
+
/* @__PURE__ */ jsx25("p", { className: "mb-1 text-xs uppercase tracking-widest text-muted-foreground", children: t.orderReferenceLabel }),
|
|
15600
|
+
/* @__PURE__ */ jsx25("p", { className: "font-mono text-lg font-semibold", children: order.orderNumber })
|
|
15469
15601
|
] }),
|
|
15470
|
-
status === "failed" && cartHref && /* @__PURE__ */
|
|
15602
|
+
status === "failed" && cartHref && /* @__PURE__ */ jsx25(
|
|
15471
15603
|
"a",
|
|
15472
15604
|
{
|
|
15473
15605
|
href: cartHref,
|
|
@@ -15475,7 +15607,7 @@ function OrderConfirmation({
|
|
|
15475
15607
|
children: t.backToCartLabel
|
|
15476
15608
|
}
|
|
15477
15609
|
),
|
|
15478
|
-
showRecheck && /* @__PURE__ */
|
|
15610
|
+
showRecheck && /* @__PURE__ */ jsx25(
|
|
15479
15611
|
"button",
|
|
15480
15612
|
{
|
|
15481
15613
|
type: "button",
|
|
@@ -15484,16 +15616,16 @@ function OrderConfirmation({
|
|
|
15484
15616
|
children: t.recheckLabel
|
|
15485
15617
|
}
|
|
15486
15618
|
),
|
|
15487
|
-
showSessionReference && /* @__PURE__ */
|
|
15488
|
-
/* @__PURE__ */
|
|
15489
|
-
/* @__PURE__ */
|
|
15619
|
+
showSessionReference && /* @__PURE__ */ jsxs23("div", { className: "inline-block rounded-xl bg-muted px-6 py-4", children: [
|
|
15620
|
+
/* @__PURE__ */ jsx25("p", { className: "mb-1 text-xs uppercase tracking-widest text-muted-foreground", children: t.sessionReferenceLabel }),
|
|
15621
|
+
/* @__PURE__ */ jsx25("p", { className: "break-all font-mono text-sm font-semibold", children: sessionId })
|
|
15490
15622
|
] })
|
|
15491
15623
|
] });
|
|
15492
15624
|
}
|
|
15493
15625
|
|
|
15494
15626
|
// src/components/full-invoice-fields.tsx
|
|
15495
|
-
import { cn as
|
|
15496
|
-
import { jsx as
|
|
15627
|
+
import { cn as cn22 } from "@reblu/site-ui/utils";
|
|
15628
|
+
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
15497
15629
|
var EMPTY_FULL_INVOICE_VALUE = {
|
|
15498
15630
|
wantsFullInvoice: false,
|
|
15499
15631
|
billingIdType: "NIF",
|
|
@@ -15610,12 +15742,12 @@ function FullInvoiceFields({
|
|
|
15610
15742
|
const showFields = value.wantsFullInvoice || overCap;
|
|
15611
15743
|
const isSpanishNif = value.billingIdType === "NIF";
|
|
15612
15744
|
const set = (key2, next2) => onChange({ ...value, [key2]: next2 });
|
|
15613
|
-
const error = (key2) => errors[key2] ? /* @__PURE__ */
|
|
15745
|
+
const error = (key2) => errors[key2] ? /* @__PURE__ */ jsx26("p", { id: `full-invoice-${key2}-error`, className: "text-sm text-destructive", children: errors[key2] }) : null;
|
|
15614
15746
|
const invalid2 = (key2) => errors[key2] ? { "aria-invalid": true, "aria-describedby": `full-invoice-${key2}-error` } : {};
|
|
15615
|
-
return /* @__PURE__ */
|
|
15616
|
-
overCap ? /* @__PURE__ */
|
|
15617
|
-
/* @__PURE__ */
|
|
15618
|
-
/* @__PURE__ */
|
|
15747
|
+
return /* @__PURE__ */ jsxs24("section", { className: cn22("space-y-4", className), "data-slot": "full-invoice-fields", children: [
|
|
15748
|
+
overCap ? /* @__PURE__ */ jsx26("p", { role: "note", className: "rounded-lg border border-border p-4 text-sm", children: t.overCapNotice }) : /* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
15749
|
+
/* @__PURE__ */ jsxs24("label", { className: "flex items-center gap-2 text-sm font-medium", children: [
|
|
15750
|
+
/* @__PURE__ */ jsx26(
|
|
15619
15751
|
"input",
|
|
15620
15752
|
{
|
|
15621
15753
|
type: "checkbox",
|
|
@@ -15625,12 +15757,12 @@ function FullInvoiceFields({
|
|
|
15625
15757
|
),
|
|
15626
15758
|
t.toggle
|
|
15627
15759
|
] }),
|
|
15628
|
-
/* @__PURE__ */
|
|
15760
|
+
/* @__PURE__ */ jsx26("p", { className: "text-sm text-muted-foreground", children: t.underCapNotice })
|
|
15629
15761
|
] }),
|
|
15630
|
-
showFields && /* @__PURE__ */
|
|
15631
|
-
/* @__PURE__ */
|
|
15632
|
-
/* @__PURE__ */
|
|
15633
|
-
/* @__PURE__ */
|
|
15762
|
+
showFields && /* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [
|
|
15763
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
15764
|
+
/* @__PURE__ */ jsx26("label", { htmlFor: "full-invoice-id-type", className: "text-sm font-medium", children: t.idType }),
|
|
15765
|
+
/* @__PURE__ */ jsx26(
|
|
15634
15766
|
"select",
|
|
15635
15767
|
{
|
|
15636
15768
|
id: "full-invoice-id-type",
|
|
@@ -15639,14 +15771,14 @@ function FullInvoiceFields({
|
|
|
15639
15771
|
value: value.billingIdType,
|
|
15640
15772
|
onChange: (e) => set("billingIdType", e.target.value),
|
|
15641
15773
|
...invalid2("billingIdType"),
|
|
15642
|
-
children: ID_TYPES.map((type) => /* @__PURE__ */
|
|
15774
|
+
children: ID_TYPES.map((type) => /* @__PURE__ */ jsx26("option", { value: type, children: t.idTypeOptions[type] }, type))
|
|
15643
15775
|
}
|
|
15644
15776
|
),
|
|
15645
15777
|
error("billingIdType")
|
|
15646
15778
|
] }),
|
|
15647
|
-
!isSpanishNif && /* @__PURE__ */
|
|
15648
|
-
/* @__PURE__ */
|
|
15649
|
-
/* @__PURE__ */
|
|
15779
|
+
!isSpanishNif && /* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
15780
|
+
/* @__PURE__ */ jsx26("label", { htmlFor: "full-invoice-id-country", className: "text-sm font-medium", children: t.idCountry }),
|
|
15781
|
+
/* @__PURE__ */ jsxs24(
|
|
15650
15782
|
"select",
|
|
15651
15783
|
{
|
|
15652
15784
|
id: "full-invoice-id-country",
|
|
@@ -15656,16 +15788,16 @@ function FullInvoiceFields({
|
|
|
15656
15788
|
onChange: (e) => set("billingIdCountry", e.target.value),
|
|
15657
15789
|
...invalid2("billingIdCountry"),
|
|
15658
15790
|
children: [
|
|
15659
|
-
/* @__PURE__ */
|
|
15660
|
-
countries.map((c) => /* @__PURE__ */
|
|
15791
|
+
/* @__PURE__ */ jsx26("option", { value: "", disabled: true, children: t.chooseCountry }),
|
|
15792
|
+
countries.map((c) => /* @__PURE__ */ jsx26("option", { value: c.code, children: c.name }, c.code))
|
|
15661
15793
|
]
|
|
15662
15794
|
}
|
|
15663
15795
|
),
|
|
15664
15796
|
error("billingIdCountry")
|
|
15665
15797
|
] }),
|
|
15666
|
-
/* @__PURE__ */
|
|
15667
|
-
/* @__PURE__ */
|
|
15668
|
-
/* @__PURE__ */
|
|
15798
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
15799
|
+
/* @__PURE__ */ jsx26("label", { htmlFor: "full-invoice-nif", className: "text-sm font-medium", children: isSpanishNif ? t.spanishNif : t.documentNumber }),
|
|
15800
|
+
/* @__PURE__ */ jsx26(
|
|
15669
15801
|
"input",
|
|
15670
15802
|
{
|
|
15671
15803
|
id: "full-invoice-nif",
|
|
@@ -15678,9 +15810,9 @@ function FullInvoiceFields({
|
|
|
15678
15810
|
),
|
|
15679
15811
|
error("billingNif")
|
|
15680
15812
|
] }),
|
|
15681
|
-
/* @__PURE__ */
|
|
15682
|
-
/* @__PURE__ */
|
|
15683
|
-
/* @__PURE__ */
|
|
15813
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
15814
|
+
/* @__PURE__ */ jsx26("label", { htmlFor: "full-invoice-name", className: "text-sm font-medium", children: t.name }),
|
|
15815
|
+
/* @__PURE__ */ jsx26(
|
|
15684
15816
|
"input",
|
|
15685
15817
|
{
|
|
15686
15818
|
id: "full-invoice-name",
|
|
@@ -15693,9 +15825,9 @@ function FullInvoiceFields({
|
|
|
15693
15825
|
),
|
|
15694
15826
|
error("billingName")
|
|
15695
15827
|
] }),
|
|
15696
|
-
/* @__PURE__ */
|
|
15697
|
-
/* @__PURE__ */
|
|
15698
|
-
/* @__PURE__ */
|
|
15828
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1 sm:col-span-2", children: [
|
|
15829
|
+
/* @__PURE__ */ jsx26("label", { htmlFor: "full-invoice-street", className: "text-sm font-medium", children: t.street }),
|
|
15830
|
+
/* @__PURE__ */ jsx26(
|
|
15699
15831
|
"input",
|
|
15700
15832
|
{
|
|
15701
15833
|
id: "full-invoice-street",
|
|
@@ -15707,9 +15839,9 @@ function FullInvoiceFields({
|
|
|
15707
15839
|
}
|
|
15708
15840
|
)
|
|
15709
15841
|
] }),
|
|
15710
|
-
/* @__PURE__ */
|
|
15711
|
-
/* @__PURE__ */
|
|
15712
|
-
/* @__PURE__ */
|
|
15842
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
15843
|
+
/* @__PURE__ */ jsx26("label", { htmlFor: "full-invoice-postal-code", className: "text-sm font-medium", children: t.postalCode }),
|
|
15844
|
+
/* @__PURE__ */ jsx26(
|
|
15713
15845
|
"input",
|
|
15714
15846
|
{
|
|
15715
15847
|
id: "full-invoice-postal-code",
|
|
@@ -15720,9 +15852,9 @@ function FullInvoiceFields({
|
|
|
15720
15852
|
}
|
|
15721
15853
|
)
|
|
15722
15854
|
] }),
|
|
15723
|
-
/* @__PURE__ */
|
|
15724
|
-
/* @__PURE__ */
|
|
15725
|
-
/* @__PURE__ */
|
|
15855
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
15856
|
+
/* @__PURE__ */ jsx26("label", { htmlFor: "full-invoice-city", className: "text-sm font-medium", children: t.city }),
|
|
15857
|
+
/* @__PURE__ */ jsx26(
|
|
15726
15858
|
"input",
|
|
15727
15859
|
{
|
|
15728
15860
|
id: "full-invoice-city",
|
|
@@ -15733,9 +15865,9 @@ function FullInvoiceFields({
|
|
|
15733
15865
|
}
|
|
15734
15866
|
)
|
|
15735
15867
|
] }),
|
|
15736
|
-
/* @__PURE__ */
|
|
15737
|
-
/* @__PURE__ */
|
|
15738
|
-
/* @__PURE__ */
|
|
15868
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
15869
|
+
/* @__PURE__ */ jsx26("label", { htmlFor: "full-invoice-country", className: "text-sm font-medium", children: t.country }),
|
|
15870
|
+
/* @__PURE__ */ jsx26(
|
|
15739
15871
|
"select",
|
|
15740
15872
|
{
|
|
15741
15873
|
id: "full-invoice-country",
|
|
@@ -15743,15 +15875,64 @@ function FullInvoiceFields({
|
|
|
15743
15875
|
required: true,
|
|
15744
15876
|
value: value.country,
|
|
15745
15877
|
onChange: (e) => set("country", e.target.value),
|
|
15746
|
-
children: countries.map((c) => /* @__PURE__ */
|
|
15878
|
+
children: countries.map((c) => /* @__PURE__ */ jsx26("option", { value: c.code, children: c.name }, c.code))
|
|
15747
15879
|
}
|
|
15748
15880
|
)
|
|
15749
15881
|
] }),
|
|
15750
|
-
/* @__PURE__ */
|
|
15882
|
+
/* @__PURE__ */ jsx26("div", { className: "sm:col-span-2", children: error("address") })
|
|
15751
15883
|
] })
|
|
15752
15884
|
] });
|
|
15753
15885
|
}
|
|
15754
15886
|
|
|
15887
|
+
// src/components/contact-interest-field.tsx
|
|
15888
|
+
import { cn as cn23 } from "@reblu/site-ui/utils";
|
|
15889
|
+
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
15890
|
+
function ContactInterestField({
|
|
15891
|
+
interest,
|
|
15892
|
+
value,
|
|
15893
|
+
onChange,
|
|
15894
|
+
idPrefix = "contact-interest",
|
|
15895
|
+
disabled,
|
|
15896
|
+
className
|
|
15897
|
+
}) {
|
|
15898
|
+
if (!interest || interest.options.length === 0) return null;
|
|
15899
|
+
const chosen = new Set(value);
|
|
15900
|
+
const toggle = (option2, checked) => {
|
|
15901
|
+
const next2 = new Set(chosen);
|
|
15902
|
+
if (checked) next2.add(option2);
|
|
15903
|
+
else next2.delete(option2);
|
|
15904
|
+
onChange(interest.options.filter((candidate) => next2.has(candidate)));
|
|
15905
|
+
};
|
|
15906
|
+
return /* @__PURE__ */ jsxs25("fieldset", { "data-slot": "contact-interest", className: cn23("space-y-2", className), children: [
|
|
15907
|
+
/* @__PURE__ */ jsx27("legend", { className: "text-sm font-medium", children: interest.label }),
|
|
15908
|
+
/* @__PURE__ */ jsx27("div", { className: "flex flex-col gap-2", children: interest.options.map((option2, index) => {
|
|
15909
|
+
const id = `${idPrefix}-${index}`;
|
|
15910
|
+
return /* @__PURE__ */ jsxs25(
|
|
15911
|
+
"label",
|
|
15912
|
+
{
|
|
15913
|
+
htmlFor: id,
|
|
15914
|
+
"data-slot": "contact-interest-option",
|
|
15915
|
+
className: "flex items-center gap-2 text-sm",
|
|
15916
|
+
children: [
|
|
15917
|
+
/* @__PURE__ */ jsx27(
|
|
15918
|
+
"input",
|
|
15919
|
+
{
|
|
15920
|
+
id,
|
|
15921
|
+
type: "checkbox",
|
|
15922
|
+
checked: chosen.has(option2),
|
|
15923
|
+
disabled,
|
|
15924
|
+
onChange: (event) => toggle(option2, event.target.checked)
|
|
15925
|
+
}
|
|
15926
|
+
),
|
|
15927
|
+
option2
|
|
15928
|
+
]
|
|
15929
|
+
},
|
|
15930
|
+
option2
|
|
15931
|
+
);
|
|
15932
|
+
}) })
|
|
15933
|
+
] });
|
|
15934
|
+
}
|
|
15935
|
+
|
|
15755
15936
|
// src/index.ts
|
|
15756
15937
|
import { DATA_REQUEST_TYPES } from "@reblu/site-contracts";
|
|
15757
15938
|
export {
|
|
@@ -15762,8 +15943,12 @@ export {
|
|
|
15762
15943
|
CartSummary,
|
|
15763
15944
|
CheckoutForm,
|
|
15764
15945
|
CheckoutLoginPrompt,
|
|
15946
|
+
ContactInterestField,
|
|
15947
|
+
CourseCatalogFilters,
|
|
15765
15948
|
CourseDescription,
|
|
15766
15949
|
DATA_REQUEST_TYPES,
|
|
15950
|
+
DEFAULT_COURSE_CATALOG_FILTERS_LABELS,
|
|
15951
|
+
DEFAULT_COURSE_PRICE_BANDS,
|
|
15767
15952
|
DEFAULT_INVOICE_COUNTRIES,
|
|
15768
15953
|
DEFAULT_LESSON_PREVIEW_LABELS,
|
|
15769
15954
|
DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE,
|