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