@reblu/site-blocks 0.28.0 → 0.30.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 +12 -0
- package/README.md +174 -1
- package/dist/index.cjs +461 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +229 -3
- package/dist/index.d.ts +229 -3
- package/dist/index.js +446 -9
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -15090,8 +15090,36 @@ var DEFAULT_LABELS2 = {
|
|
|
15090
15090
|
increase: "Aumentar cantidad",
|
|
15091
15091
|
remove: "Eliminar",
|
|
15092
15092
|
unitPriceSuffix: "/ ud.",
|
|
15093
|
-
cancelledNotice: "Pago cancelado: tu carrito sigue aqu\xED"
|
|
15093
|
+
cancelledNotice: "Pago cancelado: tu carrito sigue aqu\xED",
|
|
15094
|
+
includesSummary: "Qu\xE9 incluye"
|
|
15094
15095
|
};
|
|
15096
|
+
function CartLineIncludes({ entries, note, className }) {
|
|
15097
|
+
const hasNote = note != null && note !== false && note !== "";
|
|
15098
|
+
if (entries.length === 0 && !hasNote) return null;
|
|
15099
|
+
return /* @__PURE__ */ jsxs20(
|
|
15100
|
+
"div",
|
|
15101
|
+
{
|
|
15102
|
+
className: cn15("mt-2 space-y-2 rounded-lg bg-muted px-4 py-3 text-sm", className),
|
|
15103
|
+
"data-slot": "cart-line-includes",
|
|
15104
|
+
children: [
|
|
15105
|
+
entries.length > 0 && /* @__PURE__ */ jsx21("dl", { className: "grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1.5", children: entries.map((entry, idx) => (
|
|
15106
|
+
// eslint-disable-next-line react/no-array-index-key -- entries are positional, SITE-built rows
|
|
15107
|
+
/* @__PURE__ */ jsxs20("div", { className: "contents", children: [
|
|
15108
|
+
/* @__PURE__ */ jsx21("dt", { className: "font-semibold text-muted-foreground", children: entry.label }),
|
|
15109
|
+
/* @__PURE__ */ jsx21("dd", { className: "m-0", children: entry.value })
|
|
15110
|
+
] }, idx)
|
|
15111
|
+
)) }),
|
|
15112
|
+
hasNote && /* @__PURE__ */ jsx21("p", { className: "text-muted-foreground", children: note })
|
|
15113
|
+
]
|
|
15114
|
+
}
|
|
15115
|
+
);
|
|
15116
|
+
}
|
|
15117
|
+
function bundleComponentsToIncludes(components) {
|
|
15118
|
+
return components.map(({ quantity, component }) => ({
|
|
15119
|
+
label: component.name,
|
|
15120
|
+
value: `x${quantity}`
|
|
15121
|
+
}));
|
|
15122
|
+
}
|
|
15095
15123
|
function lineKey(productId, variantId) {
|
|
15096
15124
|
return `${productId}-${variantId ?? "no-variant"}`;
|
|
15097
15125
|
}
|
|
@@ -15102,6 +15130,7 @@ function CartLineList({
|
|
|
15102
15130
|
liveMessage,
|
|
15103
15131
|
notice,
|
|
15104
15132
|
lineMessage,
|
|
15133
|
+
lineIncludes,
|
|
15105
15134
|
labels,
|
|
15106
15135
|
currencyCode,
|
|
15107
15136
|
locale,
|
|
@@ -15125,6 +15154,7 @@ function CartLineList({
|
|
|
15125
15154
|
const atMax = item.quantity >= maxQty;
|
|
15126
15155
|
const atMin = item.quantity <= 1;
|
|
15127
15156
|
const message = lineMessage?.(item);
|
|
15157
|
+
const includes = lineIncludes?.(item);
|
|
15128
15158
|
return /* @__PURE__ */ jsxs20(
|
|
15129
15159
|
"li",
|
|
15130
15160
|
{
|
|
@@ -15189,7 +15219,11 @@ function CartLineList({
|
|
|
15189
15219
|
"data-slot": "cart-line-list-line-message",
|
|
15190
15220
|
children: message
|
|
15191
15221
|
}
|
|
15192
|
-
)
|
|
15222
|
+
),
|
|
15223
|
+
includes != null && includes !== false && /* @__PURE__ */ jsxs20("details", { className: "mt-2", "data-slot": "cart-line-list-includes", children: [
|
|
15224
|
+
/* @__PURE__ */ jsx21("summary", { className: "cursor-pointer text-sm font-semibold text-primary", children: t.includesSummary }),
|
|
15225
|
+
includes
|
|
15226
|
+
] })
|
|
15193
15227
|
] }),
|
|
15194
15228
|
/* @__PURE__ */ jsx21("div", { className: "flex-shrink-0 text-right", children: /* @__PURE__ */ jsx21("p", { className: "text-base font-bold", children: formatPrice(item.unitPrice * item.quantity, currencyCode, locale) }) })
|
|
15195
15229
|
]
|
|
@@ -16100,9 +16134,399 @@ function FullInvoiceFields({
|
|
|
16100
16134
|
] });
|
|
16101
16135
|
}
|
|
16102
16136
|
|
|
16103
|
-
// src/components/
|
|
16137
|
+
// src/components/checkout-delivery-choice.tsx
|
|
16104
16138
|
import { cn as cn24 } from "@reblu/site-ui/utils";
|
|
16105
16139
|
import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
16140
|
+
var EMPTY_CHECKOUT_ADDRESS = {
|
|
16141
|
+
firstName: "",
|
|
16142
|
+
lastName: "",
|
|
16143
|
+
street: "",
|
|
16144
|
+
postalCode: "",
|
|
16145
|
+
city: "",
|
|
16146
|
+
region: ""
|
|
16147
|
+
};
|
|
16148
|
+
var DEFAULT_CHECKOUT_DELIVERY_CHOICE_LABELS = {
|
|
16149
|
+
legend: "Entrega",
|
|
16150
|
+
free: "Gratis",
|
|
16151
|
+
pickupPointsLegend: "Punto de recogida",
|
|
16152
|
+
addressLegend: "Direcci\xF3n de entrega",
|
|
16153
|
+
firstName: "Nombre",
|
|
16154
|
+
lastName: "Apellidos",
|
|
16155
|
+
street: "Direcci\xF3n",
|
|
16156
|
+
postalCode: "C\xF3digo postal",
|
|
16157
|
+
city: "Ciudad",
|
|
16158
|
+
region: "Provincia"
|
|
16159
|
+
};
|
|
16160
|
+
var INPUT_CLASS = "w-full rounded-lg border bg-background px-3 py-2 text-sm transition focus:outline-none focus:ring-2 focus:ring-primary/20";
|
|
16161
|
+
var ADDRESS_FIELDS = [
|
|
16162
|
+
{ key: "firstName", autoComplete: "shipping given-name", required: true },
|
|
16163
|
+
{ key: "lastName", autoComplete: "shipping family-name", required: true },
|
|
16164
|
+
{ key: "street", autoComplete: "shipping street-address", required: true, wide: true },
|
|
16165
|
+
{ key: "postalCode", autoComplete: "shipping postal-code", required: true },
|
|
16166
|
+
{ key: "city", autoComplete: "shipping address-level2", required: true },
|
|
16167
|
+
{ key: "region", autoComplete: "shipping address-level1", required: false }
|
|
16168
|
+
];
|
|
16169
|
+
function pickupDescription(location2) {
|
|
16170
|
+
return [
|
|
16171
|
+
`${location2.address}, ${location2.postalCode} ${location2.city}`,
|
|
16172
|
+
location2.openingHoursText,
|
|
16173
|
+
location2.pickupReadyText
|
|
16174
|
+
].filter(Boolean).join(". ");
|
|
16175
|
+
}
|
|
16176
|
+
function CheckoutDeliveryChoice({
|
|
16177
|
+
delivery,
|
|
16178
|
+
copy,
|
|
16179
|
+
value,
|
|
16180
|
+
onChange,
|
|
16181
|
+
address,
|
|
16182
|
+
onAddressChange,
|
|
16183
|
+
addressErrors,
|
|
16184
|
+
error,
|
|
16185
|
+
quote,
|
|
16186
|
+
requiresDelivery = true,
|
|
16187
|
+
labels,
|
|
16188
|
+
currencyCode,
|
|
16189
|
+
locale,
|
|
16190
|
+
id: uid = "checkout-delivery",
|
|
16191
|
+
className
|
|
16192
|
+
}) {
|
|
16193
|
+
const t = { ...DEFAULT_CHECKOUT_DELIVERY_CHOICE_LABELS, ...labels };
|
|
16194
|
+
const { homeDelivery, pickup } = delivery.methods;
|
|
16195
|
+
if (!requiresDelivery || !homeDelivery && !pickup) return null;
|
|
16196
|
+
const price = (cents) => formatPrice(cents, currencyCode, locale);
|
|
16197
|
+
const quotedShipping = quote?.fulfillment.type === "SHIPPING" ? quote.shipping : null;
|
|
16198
|
+
const homeCost = quotedShipping ? quotedShipping.isFree ? t.free : price(quotedShipping.cost) : delivery.shippingEnabled && delivery.defaultShippingCost ? price(delivery.defaultShippingCost) : t.free;
|
|
16199
|
+
const isPickup = value?.type === "PICKUP";
|
|
16200
|
+
const isShipping = value?.type === "SHIPPING";
|
|
16201
|
+
const errorId = `${uid}-delivery-error`;
|
|
16202
|
+
return /* @__PURE__ */ jsxs28(
|
|
16203
|
+
"fieldset",
|
|
16204
|
+
{
|
|
16205
|
+
"data-slot": "checkout-delivery",
|
|
16206
|
+
"aria-describedby": error ? errorId : void 0,
|
|
16207
|
+
className: cn24("space-y-4", className),
|
|
16208
|
+
children: [
|
|
16209
|
+
/* @__PURE__ */ jsx30("legend", { className: "mb-2 text-lg font-semibold", children: t.legend }),
|
|
16210
|
+
/* @__PURE__ */ jsxs28("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
16211
|
+
homeDelivery ? /* @__PURE__ */ jsxs28("label", { className: "flex cursor-pointer items-start gap-3 rounded-xl border border-border p-4 has-[:checked]:border-primary", children: [
|
|
16212
|
+
/* @__PURE__ */ jsx30(
|
|
16213
|
+
"input",
|
|
16214
|
+
{
|
|
16215
|
+
type: "radio",
|
|
16216
|
+
name: `${uid}-method`,
|
|
16217
|
+
checked: isShipping,
|
|
16218
|
+
onChange: () => onChange({ type: "SHIPPING" }),
|
|
16219
|
+
className: "mt-0.5 size-4 accent-primary"
|
|
16220
|
+
}
|
|
16221
|
+
),
|
|
16222
|
+
/* @__PURE__ */ jsxs28("span", { className: "flex-1 space-y-1", children: [
|
|
16223
|
+
/* @__PURE__ */ jsxs28("span", { className: "flex justify-between gap-2 font-medium", children: [
|
|
16224
|
+
/* @__PURE__ */ jsx30("span", { children: copy.shippingOptionLabel }),
|
|
16225
|
+
/* @__PURE__ */ jsx30("span", { className: "tabular-nums", children: homeCost })
|
|
16226
|
+
] }),
|
|
16227
|
+
delivery.estimatedDeliveryText ? /* @__PURE__ */ jsx30("span", { className: "block text-sm text-muted-foreground", children: delivery.estimatedDeliveryText }) : null
|
|
16228
|
+
] })
|
|
16229
|
+
] }) : null,
|
|
16230
|
+
pickup ? /* @__PURE__ */ jsxs28("label", { className: "flex cursor-pointer items-start gap-3 rounded-xl border border-border p-4 has-[:checked]:border-primary", children: [
|
|
16231
|
+
/* @__PURE__ */ jsx30(
|
|
16232
|
+
"input",
|
|
16233
|
+
{
|
|
16234
|
+
type: "radio",
|
|
16235
|
+
name: `${uid}-method`,
|
|
16236
|
+
checked: isPickup,
|
|
16237
|
+
onChange: () => onChange({ type: "PICKUP" }),
|
|
16238
|
+
className: "mt-0.5 size-4 accent-primary"
|
|
16239
|
+
}
|
|
16240
|
+
),
|
|
16241
|
+
/* @__PURE__ */ jsxs28("span", { className: "flex flex-1 justify-between gap-2 font-medium", children: [
|
|
16242
|
+
/* @__PURE__ */ jsx30("span", { children: copy.pickupOptionLabel }),
|
|
16243
|
+
/* @__PURE__ */ jsx30("span", { children: t.free })
|
|
16244
|
+
] })
|
|
16245
|
+
] }) : null
|
|
16246
|
+
] }),
|
|
16247
|
+
error ? /* @__PURE__ */ jsx30("p", { id: errorId, role: "alert", className: "text-sm text-destructive", children: error }) : null,
|
|
16248
|
+
isPickup ? /* @__PURE__ */ jsxs28("div", { role: "radiogroup", "aria-labelledby": `${uid}-points`, className: "space-y-2", children: [
|
|
16249
|
+
/* @__PURE__ */ jsx30("p", { id: `${uid}-points`, className: "text-sm font-medium", children: t.pickupPointsLegend }),
|
|
16250
|
+
delivery.pickupLocations.map((location2) => {
|
|
16251
|
+
const descId = `${uid}-point-${location2.id}`;
|
|
16252
|
+
return /* @__PURE__ */ jsxs28(
|
|
16253
|
+
"label",
|
|
16254
|
+
{
|
|
16255
|
+
className: "flex cursor-pointer items-start gap-3 rounded-lg border border-border p-3 has-[:checked]:border-primary",
|
|
16256
|
+
children: [
|
|
16257
|
+
/* @__PURE__ */ jsx30(
|
|
16258
|
+
"input",
|
|
16259
|
+
{
|
|
16260
|
+
type: "radio",
|
|
16261
|
+
name: `${uid}-point`,
|
|
16262
|
+
checked: value?.pickupLocationId === location2.id,
|
|
16263
|
+
onChange: () => onChange({ type: "PICKUP", pickupLocationId: location2.id }),
|
|
16264
|
+
"aria-describedby": descId,
|
|
16265
|
+
className: "mt-0.5 size-4 accent-primary"
|
|
16266
|
+
}
|
|
16267
|
+
),
|
|
16268
|
+
/* @__PURE__ */ jsxs28("span", { className: "space-y-0.5 text-sm", children: [
|
|
16269
|
+
/* @__PURE__ */ jsx30("span", { className: "block font-medium", children: location2.name }),
|
|
16270
|
+
/* @__PURE__ */ jsx30("span", { id: descId, className: "block text-muted-foreground", children: pickupDescription(location2) })
|
|
16271
|
+
] })
|
|
16272
|
+
]
|
|
16273
|
+
},
|
|
16274
|
+
location2.id
|
|
16275
|
+
);
|
|
16276
|
+
})
|
|
16277
|
+
] }) : null,
|
|
16278
|
+
isShipping ? /* @__PURE__ */ jsxs28("fieldset", { className: "space-y-3", children: [
|
|
16279
|
+
/* @__PURE__ */ jsx30("legend", { className: "mb-2 text-sm font-medium", children: t.addressLegend }),
|
|
16280
|
+
/* @__PURE__ */ jsx30("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: ADDRESS_FIELDS.map(({ key: key2, autoComplete, required, wide }) => {
|
|
16281
|
+
const fieldId = `${uid}-${key2}`;
|
|
16282
|
+
const fieldError = addressErrors?.[key2];
|
|
16283
|
+
return /* @__PURE__ */ jsxs28("div", { className: cn24("space-y-1", wide && "sm:col-span-2"), children: [
|
|
16284
|
+
/* @__PURE__ */ jsx30("label", { htmlFor: fieldId, className: "text-sm font-medium", children: t[key2] }),
|
|
16285
|
+
/* @__PURE__ */ jsx30(
|
|
16286
|
+
"input",
|
|
16287
|
+
{
|
|
16288
|
+
id: fieldId,
|
|
16289
|
+
type: "text",
|
|
16290
|
+
required,
|
|
16291
|
+
autoComplete,
|
|
16292
|
+
value: address[key2],
|
|
16293
|
+
onChange: (e) => onAddressChange({ ...address, [key2]: e.target.value }),
|
|
16294
|
+
"aria-invalid": fieldError ? true : void 0,
|
|
16295
|
+
"aria-describedby": fieldError ? `${fieldId}-error` : void 0,
|
|
16296
|
+
className: cn24(
|
|
16297
|
+
INPUT_CLASS,
|
|
16298
|
+
fieldError ? "border-destructive" : "border-border focus:border-primary"
|
|
16299
|
+
)
|
|
16300
|
+
}
|
|
16301
|
+
),
|
|
16302
|
+
fieldError ? /* @__PURE__ */ jsx30("p", { id: `${fieldId}-error`, className: "text-sm text-destructive", children: fieldError }) : null
|
|
16303
|
+
] }, key2);
|
|
16304
|
+
}) })
|
|
16305
|
+
] }) : null
|
|
16306
|
+
]
|
|
16307
|
+
}
|
|
16308
|
+
);
|
|
16309
|
+
}
|
|
16310
|
+
function defaultCheckoutFulfillment(delivery) {
|
|
16311
|
+
if (!delivery) return null;
|
|
16312
|
+
if (delivery.methods.homeDelivery) return { type: "SHIPPING" };
|
|
16313
|
+
if (!delivery.methods.pickup) return null;
|
|
16314
|
+
const [only, ...rest] = delivery.pickupLocations;
|
|
16315
|
+
return only && rest.length === 0 ? { type: "PICKUP", pickupLocationId: only.id } : { type: "PICKUP" };
|
|
16316
|
+
}
|
|
16317
|
+
function quoteRequiresDelivery(quote) {
|
|
16318
|
+
return quote ? quote.lines.some((line) => line.isShippable) : true;
|
|
16319
|
+
}
|
|
16320
|
+
function toCheckoutFulfillmentFields(value, address, requiresDelivery = true) {
|
|
16321
|
+
if (!value || !requiresDelivery) return { fulfillment: { type: "SHIPPING" } };
|
|
16322
|
+
if (value.type === "PICKUP") {
|
|
16323
|
+
return { fulfillment: value.pickupLocationId ? { type: "PICKUP", pickupLocationId: value.pickupLocationId } : { type: "PICKUP" } };
|
|
16324
|
+
}
|
|
16325
|
+
const shippingAddress = {
|
|
16326
|
+
firstName: address.firstName.trim(),
|
|
16327
|
+
lastName: address.lastName.trim(),
|
|
16328
|
+
street: address.street.trim(),
|
|
16329
|
+
postalCode: address.postalCode.trim(),
|
|
16330
|
+
city: address.city.trim(),
|
|
16331
|
+
...address.region.trim() ? { region: address.region.trim() } : {}
|
|
16332
|
+
};
|
|
16333
|
+
return { fulfillment: { type: "SHIPPING" }, shippingAddress };
|
|
16334
|
+
}
|
|
16335
|
+
|
|
16336
|
+
// src/components/checkout-quote-summary.tsx
|
|
16337
|
+
import { cn as cn25 } from "@reblu/site-ui/utils";
|
|
16338
|
+
import { Fragment as Fragment6, jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
16339
|
+
var DEFAULT_CHECKOUT_QUOTE_SUMMARY_LABELS = {
|
|
16340
|
+
subtotal: "Subtotal",
|
|
16341
|
+
discount: (codeOrLabel, isAutomatic) => isAutomatic ? codeOrLabel : `Descuento (${codeOrLabel})`,
|
|
16342
|
+
free: "Gratis",
|
|
16343
|
+
delivery: "Entrega",
|
|
16344
|
+
remainingForFree: (amount) => `Te faltan ${amount} para el env\xEDo gratis`,
|
|
16345
|
+
taxIncluded: (label) => `De los cuales ${label}`,
|
|
16346
|
+
total: "Total",
|
|
16347
|
+
taxesIncludedNote: "Impuestos incluidos",
|
|
16348
|
+
quantityTimesUnit: (quantity, unit) => `${quantity} \xD7 ${unit}`
|
|
16349
|
+
};
|
|
16350
|
+
function Row({
|
|
16351
|
+
name,
|
|
16352
|
+
value,
|
|
16353
|
+
className
|
|
16354
|
+
}) {
|
|
16355
|
+
return /* @__PURE__ */ jsxs29("div", { "data-slot": "checkout-quote-row", className: cn25("flex justify-between gap-4", className), children: [
|
|
16356
|
+
/* @__PURE__ */ jsx31("dt", { children: name }),
|
|
16357
|
+
/* @__PURE__ */ jsx31("dd", { className: "shrink-0 tabular-nums", children: value })
|
|
16358
|
+
] });
|
|
16359
|
+
}
|
|
16360
|
+
function CheckoutQuoteSummary({
|
|
16361
|
+
quote,
|
|
16362
|
+
heading,
|
|
16363
|
+
headingLevel = 2,
|
|
16364
|
+
labels,
|
|
16365
|
+
currencyCode,
|
|
16366
|
+
locale,
|
|
16367
|
+
className
|
|
16368
|
+
}) {
|
|
16369
|
+
const t = { ...DEFAULT_CHECKOUT_QUOTE_SUMMARY_LABELS, ...labels };
|
|
16370
|
+
const price = (cents) => formatPrice(cents, currencyCode, locale);
|
|
16371
|
+
const { fulfillment, shipping, tax, discount } = quote;
|
|
16372
|
+
const Tag = `h${headingLevel}`;
|
|
16373
|
+
return /* @__PURE__ */ jsxs29("section", { "data-slot": "checkout-quote-summary", className: slotClassName("space-y-4", "", className), children: [
|
|
16374
|
+
heading ? /* @__PURE__ */ jsx31(Tag, { className: "text-lg font-semibold", children: heading }) : null,
|
|
16375
|
+
/* @__PURE__ */ jsx31("ul", { className: "space-y-3 text-sm", children: quote.lines.map((line) => /* @__PURE__ */ jsxs29("li", { className: "flex justify-between gap-4", children: [
|
|
16376
|
+
/* @__PURE__ */ jsxs29("div", { className: "min-w-0 space-y-0.5", children: [
|
|
16377
|
+
/* @__PURE__ */ jsx31("p", { className: "font-medium", children: line.name }),
|
|
16378
|
+
line.variantName ? /* @__PURE__ */ jsx31("p", { className: "text-muted-foreground", children: line.variantName }) : null,
|
|
16379
|
+
/* @__PURE__ */ jsxs29("p", { className: "flex flex-wrap items-center gap-2 text-muted-foreground", children: [
|
|
16380
|
+
line.kindLabel ? /* @__PURE__ */ jsx31("span", { "data-slot": "checkout-quote-kind", className: "rounded-full border border-border px-2 py-0.5 text-xs font-medium text-foreground", children: line.kindLabel }) : null,
|
|
16381
|
+
/* @__PURE__ */ jsx31("span", { children: t.quantityTimesUnit(line.quantity, price(line.unitPrice)) })
|
|
16382
|
+
] })
|
|
16383
|
+
] }),
|
|
16384
|
+
/* @__PURE__ */ jsx31("span", { className: "shrink-0 tabular-nums", children: price(line.total) })
|
|
16385
|
+
] }, `${line.productId}-${line.variantId ?? ""}`)) }),
|
|
16386
|
+
/* @__PURE__ */ jsxs29("dl", { className: "space-y-2 border-t border-border pt-3 text-sm", children: [
|
|
16387
|
+
/* @__PURE__ */ jsx31(Row, { name: t.subtotal, value: price(quote.subtotal) }),
|
|
16388
|
+
discount && discount.amount > 0 ? /* @__PURE__ */ jsx31(
|
|
16389
|
+
Row,
|
|
16390
|
+
{
|
|
16391
|
+
className: "text-green-700 dark:text-green-400",
|
|
16392
|
+
name: t.discount(discount.isAutomatic ? discount.label ?? discount.code : discount.code, discount.isAutomatic),
|
|
16393
|
+
value: `\u2212${price(discount.amount)}`
|
|
16394
|
+
}
|
|
16395
|
+
) : null,
|
|
16396
|
+
fulfillment.type ? /* @__PURE__ */ jsx31(
|
|
16397
|
+
Row,
|
|
16398
|
+
{
|
|
16399
|
+
name: /* @__PURE__ */ jsxs29(Fragment6, { children: [
|
|
16400
|
+
fulfillment.label ?? t.delivery,
|
|
16401
|
+
fulfillment.type === "PICKUP" && fulfillment.pickupLocation ? /* @__PURE__ */ jsx31("span", { className: "block text-muted-foreground", children: fulfillment.pickupLocation.name }) : null
|
|
16402
|
+
] }),
|
|
16403
|
+
value: fulfillment.type === "PICKUP" || shipping.isFree ? t.free : price(shipping.cost)
|
|
16404
|
+
}
|
|
16405
|
+
) : null,
|
|
16406
|
+
tax.isLineVisible ? tax.breakdown.map((entry) => /* @__PURE__ */ jsx31(
|
|
16407
|
+
Row,
|
|
16408
|
+
{
|
|
16409
|
+
className: tax.isIncluded ? "text-muted-foreground" : void 0,
|
|
16410
|
+
name: tax.isIncluded ? t.taxIncluded(entry.label) : entry.label,
|
|
16411
|
+
value: price(entry.amount)
|
|
16412
|
+
},
|
|
16413
|
+
entry.label
|
|
16414
|
+
)) : null,
|
|
16415
|
+
/* @__PURE__ */ jsx31(Row, { className: "border-t border-border pt-2 text-base font-bold", name: t.total, value: price(quote.total) })
|
|
16416
|
+
] }),
|
|
16417
|
+
tax.isIncluded ? /* @__PURE__ */ jsx31("p", { className: "text-sm text-muted-foreground", children: t.taxesIncludedNote }) : null,
|
|
16418
|
+
fulfillment.type === "SHIPPING" && !shipping.isFree && shipping.remainingForFree ? /* @__PURE__ */ jsx31("p", { className: "text-sm text-muted-foreground", children: t.remainingForFree(price(shipping.remainingForFree)) }) : null,
|
|
16419
|
+
fulfillment.type && quote.deliveryEstimateText ? /* @__PURE__ */ jsx31("p", { "data-slot": "checkout-quote-estimate", className: "text-sm text-muted-foreground", children: quote.deliveryEstimateText }) : null,
|
|
16420
|
+
quote.discountError ? /* @__PURE__ */ jsx31("p", { role: "status", className: "text-sm text-destructive", children: quote.discountError.message }) : null,
|
|
16421
|
+
quote.blockingReason ? /* @__PURE__ */ jsx31("p", { role: "alert", className: "rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive", children: quote.blockingReason.message }) : null
|
|
16422
|
+
] });
|
|
16423
|
+
}
|
|
16424
|
+
|
|
16425
|
+
// src/components/checkout-terms-acceptance.tsx
|
|
16426
|
+
import { cn as cn26 } from "@reblu/site-ui/utils";
|
|
16427
|
+
import { Fragment as Fragment7, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
16428
|
+
function splitTermsLabel(label) {
|
|
16429
|
+
const at = label.indexOf("{terms}");
|
|
16430
|
+
return at === -1 ? [`${label} `, ""] : [label.slice(0, at), label.slice(at + "{terms}".length)];
|
|
16431
|
+
}
|
|
16432
|
+
function CheckoutTermsAcceptance({
|
|
16433
|
+
copy,
|
|
16434
|
+
termsHref,
|
|
16435
|
+
checked,
|
|
16436
|
+
onCheckedChange,
|
|
16437
|
+
error,
|
|
16438
|
+
newTabHint = "(se abre en una pesta\xF1a nueva)",
|
|
16439
|
+
id,
|
|
16440
|
+
className
|
|
16441
|
+
}) {
|
|
16442
|
+
if (!copy.termsVersion) return null;
|
|
16443
|
+
const boxId = id ?? "checkout-terms";
|
|
16444
|
+
const errorId = `${boxId}-error`;
|
|
16445
|
+
const [before, after] = splitTermsLabel(copy.termsCheckboxLabel).map(
|
|
16446
|
+
(part) => part.replaceAll("{tenant}", copy.tenantName)
|
|
16447
|
+
);
|
|
16448
|
+
const newTab = copy.isTermsLinkNewTab;
|
|
16449
|
+
return /* @__PURE__ */ jsxs30("div", { "data-slot": "checkout-terms", className: cn26("space-y-1", className), children: [
|
|
16450
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-start gap-3", children: [
|
|
16451
|
+
/* @__PURE__ */ jsx32(
|
|
16452
|
+
"input",
|
|
16453
|
+
{
|
|
16454
|
+
id: boxId,
|
|
16455
|
+
type: "checkbox",
|
|
16456
|
+
required: true,
|
|
16457
|
+
checked,
|
|
16458
|
+
onChange: (e) => onCheckedChange(e.target.checked),
|
|
16459
|
+
"aria-invalid": error ? true : void 0,
|
|
16460
|
+
"aria-describedby": error ? errorId : void 0,
|
|
16461
|
+
className: "mt-0.5 size-5 shrink-0 cursor-pointer accent-primary"
|
|
16462
|
+
}
|
|
16463
|
+
),
|
|
16464
|
+
/* @__PURE__ */ jsxs30("label", { htmlFor: boxId, className: "text-sm leading-relaxed", children: [
|
|
16465
|
+
before,
|
|
16466
|
+
/* @__PURE__ */ jsxs30(
|
|
16467
|
+
"a",
|
|
16468
|
+
{
|
|
16469
|
+
href: copy.termsLinkUrl ?? termsHref,
|
|
16470
|
+
...newTab ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
16471
|
+
className: "font-medium underline underline-offset-2 hover:text-primary",
|
|
16472
|
+
children: [
|
|
16473
|
+
copy.termsLinkText,
|
|
16474
|
+
newTab ? /* @__PURE__ */ jsxs30(Fragment7, { children: [
|
|
16475
|
+
" ",
|
|
16476
|
+
/* @__PURE__ */ jsx32("span", { className: "sr-only", children: newTabHint })
|
|
16477
|
+
] }) : null
|
|
16478
|
+
]
|
|
16479
|
+
}
|
|
16480
|
+
),
|
|
16481
|
+
after
|
|
16482
|
+
] })
|
|
16483
|
+
] }),
|
|
16484
|
+
error ? /* @__PURE__ */ jsx32("p", { id: errorId, className: "pl-8 text-sm text-destructive", children: error }) : null
|
|
16485
|
+
] });
|
|
16486
|
+
}
|
|
16487
|
+
function toCheckoutTermsFields(copy, accepted) {
|
|
16488
|
+
const version = copy?.termsVersion;
|
|
16489
|
+
return version ? { acceptsTerms: accepted, termsVersionId: version.id } : {};
|
|
16490
|
+
}
|
|
16491
|
+
|
|
16492
|
+
// src/components/checkout-pay-action.tsx
|
|
16493
|
+
import { cn as cn27 } from "@reblu/site-ui/utils";
|
|
16494
|
+
import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
16495
|
+
function CheckoutPayAction({
|
|
16496
|
+
label,
|
|
16497
|
+
notice,
|
|
16498
|
+
submitting = false,
|
|
16499
|
+
submittingLabel = "Procesando\u2026",
|
|
16500
|
+
disabled = false,
|
|
16501
|
+
id = "checkout-pay",
|
|
16502
|
+
className,
|
|
16503
|
+
buttonClassName,
|
|
16504
|
+
noticeClassName
|
|
16505
|
+
}) {
|
|
16506
|
+
const noticeId = `${id}-notice`;
|
|
16507
|
+
const isDisabled = submitting || disabled;
|
|
16508
|
+
return /* @__PURE__ */ jsxs31("div", { "data-slot": "checkout-pay-action", className: cn27("space-y-3", className), children: [
|
|
16509
|
+
/* @__PURE__ */ jsx33(
|
|
16510
|
+
"button",
|
|
16511
|
+
{
|
|
16512
|
+
type: "submit",
|
|
16513
|
+
disabled: isDisabled,
|
|
16514
|
+
"aria-busy": submitting || void 0,
|
|
16515
|
+
"aria-describedby": notice ? noticeId : void 0,
|
|
16516
|
+
className: buttonClassName ?? cn27(
|
|
16517
|
+
"flex w-full items-center justify-center gap-2 rounded-xl px-4 py-3 text-base font-semibold transition-all",
|
|
16518
|
+
isDisabled ? "cursor-not-allowed bg-muted text-muted-foreground" : "cursor-pointer bg-primary text-primary-foreground hover:bg-primary/90"
|
|
16519
|
+
),
|
|
16520
|
+
children: submitting ? submittingLabel : label
|
|
16521
|
+
}
|
|
16522
|
+
),
|
|
16523
|
+
notice ? /* @__PURE__ */ jsx33("p", { id: noticeId, "data-slot": "checkout-pay-notice", className: noticeClassName ?? "text-sm text-muted-foreground", children: notice }) : null
|
|
16524
|
+
] });
|
|
16525
|
+
}
|
|
16526
|
+
|
|
16527
|
+
// src/components/contact-interest-field.tsx
|
|
16528
|
+
import { cn as cn28 } from "@reblu/site-ui/utils";
|
|
16529
|
+
import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
16106
16530
|
function ContactInterestField({
|
|
16107
16531
|
interest,
|
|
16108
16532
|
value,
|
|
@@ -16119,18 +16543,18 @@ function ContactInterestField({
|
|
|
16119
16543
|
else next2.delete(option2);
|
|
16120
16544
|
onChange(interest.options.filter((candidate) => next2.has(candidate)));
|
|
16121
16545
|
};
|
|
16122
|
-
return /* @__PURE__ */
|
|
16123
|
-
/* @__PURE__ */
|
|
16124
|
-
/* @__PURE__ */
|
|
16546
|
+
return /* @__PURE__ */ jsxs32("fieldset", { "data-slot": "contact-interest", className: cn28("space-y-2", className), children: [
|
|
16547
|
+
/* @__PURE__ */ jsx34("legend", { className: "text-sm font-medium", children: interest.label }),
|
|
16548
|
+
/* @__PURE__ */ jsx34("div", { className: "flex flex-col gap-2", children: interest.options.map((option2, index) => {
|
|
16125
16549
|
const id = `${idPrefix}-${index}`;
|
|
16126
|
-
return /* @__PURE__ */
|
|
16550
|
+
return /* @__PURE__ */ jsxs32(
|
|
16127
16551
|
"label",
|
|
16128
16552
|
{
|
|
16129
16553
|
htmlFor: id,
|
|
16130
16554
|
"data-slot": "contact-interest-option",
|
|
16131
16555
|
className: "flex items-center gap-2 text-sm",
|
|
16132
16556
|
children: [
|
|
16133
|
-
/* @__PURE__ */
|
|
16557
|
+
/* @__PURE__ */ jsx34(
|
|
16134
16558
|
"input",
|
|
16135
16559
|
{
|
|
16136
16560
|
id,
|
|
@@ -16156,15 +16580,22 @@ export {
|
|
|
16156
16580
|
AddedToCartToast,
|
|
16157
16581
|
ArbitrationBadge,
|
|
16158
16582
|
CartAdjustmentsNotice,
|
|
16583
|
+
CartLineIncludes,
|
|
16159
16584
|
CartLineList,
|
|
16160
16585
|
CartSummary,
|
|
16586
|
+
CheckoutDeliveryChoice,
|
|
16161
16587
|
CheckoutForm,
|
|
16162
16588
|
CheckoutLoginPrompt,
|
|
16589
|
+
CheckoutPayAction,
|
|
16590
|
+
CheckoutQuoteSummary,
|
|
16591
|
+
CheckoutTermsAcceptance,
|
|
16163
16592
|
ContactInterestField,
|
|
16164
16593
|
CourseCatalogFilters,
|
|
16165
16594
|
CourseDescription,
|
|
16166
16595
|
CoursePurchaseTerms,
|
|
16167
16596
|
DATA_REQUEST_TYPES,
|
|
16597
|
+
DEFAULT_CHECKOUT_DELIVERY_CHOICE_LABELS,
|
|
16598
|
+
DEFAULT_CHECKOUT_QUOTE_SUMMARY_LABELS,
|
|
16168
16599
|
DEFAULT_COURSE_CATALOG_FILTERS_LABELS,
|
|
16169
16600
|
DEFAULT_COURSE_PRICE_BANDS,
|
|
16170
16601
|
DEFAULT_COURSE_PURCHASE_TERMS_LABELS,
|
|
@@ -16176,6 +16607,7 @@ export {
|
|
|
16176
16607
|
DEFAULT_TRUST_BADGE_HEADINGS,
|
|
16177
16608
|
DEFAULT_TRUST_BADGE_TYPE_ORDER,
|
|
16178
16609
|
DEFAULT_TRUST_ICONS,
|
|
16610
|
+
EMPTY_CHECKOUT_ADDRESS,
|
|
16179
16611
|
EMPTY_FULL_INVOICE_VALUE,
|
|
16180
16612
|
FaqAccordion,
|
|
16181
16613
|
FullInvoiceFields,
|
|
@@ -16198,18 +16630,23 @@ export {
|
|
|
16198
16630
|
TrustBadges,
|
|
16199
16631
|
buildFaqPageJsonLd,
|
|
16200
16632
|
buildShareUrls,
|
|
16633
|
+
bundleComponentsToIncludes,
|
|
16201
16634
|
collectFaqItems,
|
|
16635
|
+
defaultCheckoutFulfillment,
|
|
16202
16636
|
formatPrice,
|
|
16203
16637
|
getShopErrorMessage,
|
|
16204
16638
|
isAllowedYouTubeHost,
|
|
16205
16639
|
isOverSimplifiedInvoiceCap,
|
|
16206
16640
|
markdownToPlainText,
|
|
16207
16641
|
markdownToSafeHtml,
|
|
16642
|
+
quoteRequiresDelivery,
|
|
16208
16643
|
readingTime,
|
|
16209
16644
|
sanitizeHtml,
|
|
16210
16645
|
shopIssuesInvoices,
|
|
16211
16646
|
shouldRenderShopFilters,
|
|
16212
|
-
|
|
16647
|
+
toCheckoutFulfillmentFields,
|
|
16648
|
+
toCheckoutInvoiceFields,
|
|
16649
|
+
toCheckoutTermsFields
|
|
16213
16650
|
};
|
|
16214
16651
|
/*! Bundled license information:
|
|
16215
16652
|
|