@reblu/site-blocks 0.28.0 → 0.29.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 +6 -0
- package/README.md +142 -0
- package/dist/index.cjs +420 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +194 -2
- package/dist/index.d.ts +194 -2
- package/dist/index.js +408 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -16100,9 +16100,399 @@ function FullInvoiceFields({
|
|
|
16100
16100
|
] });
|
|
16101
16101
|
}
|
|
16102
16102
|
|
|
16103
|
-
// src/components/
|
|
16103
|
+
// src/components/checkout-delivery-choice.tsx
|
|
16104
16104
|
import { cn as cn24 } from "@reblu/site-ui/utils";
|
|
16105
16105
|
import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
16106
|
+
var EMPTY_CHECKOUT_ADDRESS = {
|
|
16107
|
+
firstName: "",
|
|
16108
|
+
lastName: "",
|
|
16109
|
+
street: "",
|
|
16110
|
+
postalCode: "",
|
|
16111
|
+
city: "",
|
|
16112
|
+
region: ""
|
|
16113
|
+
};
|
|
16114
|
+
var DEFAULT_CHECKOUT_DELIVERY_CHOICE_LABELS = {
|
|
16115
|
+
legend: "Entrega",
|
|
16116
|
+
free: "Gratis",
|
|
16117
|
+
pickupPointsLegend: "Punto de recogida",
|
|
16118
|
+
addressLegend: "Direcci\xF3n de entrega",
|
|
16119
|
+
firstName: "Nombre",
|
|
16120
|
+
lastName: "Apellidos",
|
|
16121
|
+
street: "Direcci\xF3n",
|
|
16122
|
+
postalCode: "C\xF3digo postal",
|
|
16123
|
+
city: "Ciudad",
|
|
16124
|
+
region: "Provincia"
|
|
16125
|
+
};
|
|
16126
|
+
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";
|
|
16127
|
+
var ADDRESS_FIELDS = [
|
|
16128
|
+
{ key: "firstName", autoComplete: "shipping given-name", required: true },
|
|
16129
|
+
{ key: "lastName", autoComplete: "shipping family-name", required: true },
|
|
16130
|
+
{ key: "street", autoComplete: "shipping street-address", required: true, wide: true },
|
|
16131
|
+
{ key: "postalCode", autoComplete: "shipping postal-code", required: true },
|
|
16132
|
+
{ key: "city", autoComplete: "shipping address-level2", required: true },
|
|
16133
|
+
{ key: "region", autoComplete: "shipping address-level1", required: false }
|
|
16134
|
+
];
|
|
16135
|
+
function pickupDescription(location2) {
|
|
16136
|
+
return [
|
|
16137
|
+
`${location2.address}, ${location2.postalCode} ${location2.city}`,
|
|
16138
|
+
location2.openingHoursText,
|
|
16139
|
+
location2.pickupReadyText
|
|
16140
|
+
].filter(Boolean).join(". ");
|
|
16141
|
+
}
|
|
16142
|
+
function CheckoutDeliveryChoice({
|
|
16143
|
+
delivery,
|
|
16144
|
+
copy,
|
|
16145
|
+
value,
|
|
16146
|
+
onChange,
|
|
16147
|
+
address,
|
|
16148
|
+
onAddressChange,
|
|
16149
|
+
addressErrors,
|
|
16150
|
+
error,
|
|
16151
|
+
quote,
|
|
16152
|
+
requiresDelivery = true,
|
|
16153
|
+
labels,
|
|
16154
|
+
currencyCode,
|
|
16155
|
+
locale,
|
|
16156
|
+
id: uid = "checkout-delivery",
|
|
16157
|
+
className
|
|
16158
|
+
}) {
|
|
16159
|
+
const t = { ...DEFAULT_CHECKOUT_DELIVERY_CHOICE_LABELS, ...labels };
|
|
16160
|
+
const { homeDelivery, pickup } = delivery.methods;
|
|
16161
|
+
if (!requiresDelivery || !homeDelivery && !pickup) return null;
|
|
16162
|
+
const price = (cents) => formatPrice(cents, currencyCode, locale);
|
|
16163
|
+
const quotedShipping = quote?.fulfillment.type === "SHIPPING" ? quote.shipping : null;
|
|
16164
|
+
const homeCost = quotedShipping ? quotedShipping.isFree ? t.free : price(quotedShipping.cost) : delivery.shippingEnabled && delivery.defaultShippingCost ? price(delivery.defaultShippingCost) : t.free;
|
|
16165
|
+
const isPickup = value?.type === "PICKUP";
|
|
16166
|
+
const isShipping = value?.type === "SHIPPING";
|
|
16167
|
+
const errorId = `${uid}-delivery-error`;
|
|
16168
|
+
return /* @__PURE__ */ jsxs28(
|
|
16169
|
+
"fieldset",
|
|
16170
|
+
{
|
|
16171
|
+
"data-slot": "checkout-delivery",
|
|
16172
|
+
"aria-describedby": error ? errorId : void 0,
|
|
16173
|
+
className: cn24("space-y-4", className),
|
|
16174
|
+
children: [
|
|
16175
|
+
/* @__PURE__ */ jsx30("legend", { className: "mb-2 text-lg font-semibold", children: t.legend }),
|
|
16176
|
+
/* @__PURE__ */ jsxs28("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
16177
|
+
homeDelivery ? /* @__PURE__ */ jsxs28("label", { className: "flex cursor-pointer items-start gap-3 rounded-xl border border-border p-4 has-[:checked]:border-primary", children: [
|
|
16178
|
+
/* @__PURE__ */ jsx30(
|
|
16179
|
+
"input",
|
|
16180
|
+
{
|
|
16181
|
+
type: "radio",
|
|
16182
|
+
name: `${uid}-method`,
|
|
16183
|
+
checked: isShipping,
|
|
16184
|
+
onChange: () => onChange({ type: "SHIPPING" }),
|
|
16185
|
+
className: "mt-0.5 size-4 accent-primary"
|
|
16186
|
+
}
|
|
16187
|
+
),
|
|
16188
|
+
/* @__PURE__ */ jsxs28("span", { className: "flex-1 space-y-1", children: [
|
|
16189
|
+
/* @__PURE__ */ jsxs28("span", { className: "flex justify-between gap-2 font-medium", children: [
|
|
16190
|
+
/* @__PURE__ */ jsx30("span", { children: copy.shippingOptionLabel }),
|
|
16191
|
+
/* @__PURE__ */ jsx30("span", { className: "tabular-nums", children: homeCost })
|
|
16192
|
+
] }),
|
|
16193
|
+
delivery.estimatedDeliveryText ? /* @__PURE__ */ jsx30("span", { className: "block text-sm text-muted-foreground", children: delivery.estimatedDeliveryText }) : null
|
|
16194
|
+
] })
|
|
16195
|
+
] }) : null,
|
|
16196
|
+
pickup ? /* @__PURE__ */ jsxs28("label", { className: "flex cursor-pointer items-start gap-3 rounded-xl border border-border p-4 has-[:checked]:border-primary", children: [
|
|
16197
|
+
/* @__PURE__ */ jsx30(
|
|
16198
|
+
"input",
|
|
16199
|
+
{
|
|
16200
|
+
type: "radio",
|
|
16201
|
+
name: `${uid}-method`,
|
|
16202
|
+
checked: isPickup,
|
|
16203
|
+
onChange: () => onChange({ type: "PICKUP" }),
|
|
16204
|
+
className: "mt-0.5 size-4 accent-primary"
|
|
16205
|
+
}
|
|
16206
|
+
),
|
|
16207
|
+
/* @__PURE__ */ jsxs28("span", { className: "flex flex-1 justify-between gap-2 font-medium", children: [
|
|
16208
|
+
/* @__PURE__ */ jsx30("span", { children: copy.pickupOptionLabel }),
|
|
16209
|
+
/* @__PURE__ */ jsx30("span", { children: t.free })
|
|
16210
|
+
] })
|
|
16211
|
+
] }) : null
|
|
16212
|
+
] }),
|
|
16213
|
+
error ? /* @__PURE__ */ jsx30("p", { id: errorId, role: "alert", className: "text-sm text-destructive", children: error }) : null,
|
|
16214
|
+
isPickup ? /* @__PURE__ */ jsxs28("div", { role: "radiogroup", "aria-labelledby": `${uid}-points`, className: "space-y-2", children: [
|
|
16215
|
+
/* @__PURE__ */ jsx30("p", { id: `${uid}-points`, className: "text-sm font-medium", children: t.pickupPointsLegend }),
|
|
16216
|
+
delivery.pickupLocations.map((location2) => {
|
|
16217
|
+
const descId = `${uid}-point-${location2.id}`;
|
|
16218
|
+
return /* @__PURE__ */ jsxs28(
|
|
16219
|
+
"label",
|
|
16220
|
+
{
|
|
16221
|
+
className: "flex cursor-pointer items-start gap-3 rounded-lg border border-border p-3 has-[:checked]:border-primary",
|
|
16222
|
+
children: [
|
|
16223
|
+
/* @__PURE__ */ jsx30(
|
|
16224
|
+
"input",
|
|
16225
|
+
{
|
|
16226
|
+
type: "radio",
|
|
16227
|
+
name: `${uid}-point`,
|
|
16228
|
+
checked: value?.pickupLocationId === location2.id,
|
|
16229
|
+
onChange: () => onChange({ type: "PICKUP", pickupLocationId: location2.id }),
|
|
16230
|
+
"aria-describedby": descId,
|
|
16231
|
+
className: "mt-0.5 size-4 accent-primary"
|
|
16232
|
+
}
|
|
16233
|
+
),
|
|
16234
|
+
/* @__PURE__ */ jsxs28("span", { className: "space-y-0.5 text-sm", children: [
|
|
16235
|
+
/* @__PURE__ */ jsx30("span", { className: "block font-medium", children: location2.name }),
|
|
16236
|
+
/* @__PURE__ */ jsx30("span", { id: descId, className: "block text-muted-foreground", children: pickupDescription(location2) })
|
|
16237
|
+
] })
|
|
16238
|
+
]
|
|
16239
|
+
},
|
|
16240
|
+
location2.id
|
|
16241
|
+
);
|
|
16242
|
+
})
|
|
16243
|
+
] }) : null,
|
|
16244
|
+
isShipping ? /* @__PURE__ */ jsxs28("fieldset", { className: "space-y-3", children: [
|
|
16245
|
+
/* @__PURE__ */ jsx30("legend", { className: "mb-2 text-sm font-medium", children: t.addressLegend }),
|
|
16246
|
+
/* @__PURE__ */ jsx30("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: ADDRESS_FIELDS.map(({ key: key2, autoComplete, required, wide }) => {
|
|
16247
|
+
const fieldId = `${uid}-${key2}`;
|
|
16248
|
+
const fieldError = addressErrors?.[key2];
|
|
16249
|
+
return /* @__PURE__ */ jsxs28("div", { className: cn24("space-y-1", wide && "sm:col-span-2"), children: [
|
|
16250
|
+
/* @__PURE__ */ jsx30("label", { htmlFor: fieldId, className: "text-sm font-medium", children: t[key2] }),
|
|
16251
|
+
/* @__PURE__ */ jsx30(
|
|
16252
|
+
"input",
|
|
16253
|
+
{
|
|
16254
|
+
id: fieldId,
|
|
16255
|
+
type: "text",
|
|
16256
|
+
required,
|
|
16257
|
+
autoComplete,
|
|
16258
|
+
value: address[key2],
|
|
16259
|
+
onChange: (e) => onAddressChange({ ...address, [key2]: e.target.value }),
|
|
16260
|
+
"aria-invalid": fieldError ? true : void 0,
|
|
16261
|
+
"aria-describedby": fieldError ? `${fieldId}-error` : void 0,
|
|
16262
|
+
className: cn24(
|
|
16263
|
+
INPUT_CLASS,
|
|
16264
|
+
fieldError ? "border-destructive" : "border-border focus:border-primary"
|
|
16265
|
+
)
|
|
16266
|
+
}
|
|
16267
|
+
),
|
|
16268
|
+
fieldError ? /* @__PURE__ */ jsx30("p", { id: `${fieldId}-error`, className: "text-sm text-destructive", children: fieldError }) : null
|
|
16269
|
+
] }, key2);
|
|
16270
|
+
}) })
|
|
16271
|
+
] }) : null
|
|
16272
|
+
]
|
|
16273
|
+
}
|
|
16274
|
+
);
|
|
16275
|
+
}
|
|
16276
|
+
function defaultCheckoutFulfillment(delivery) {
|
|
16277
|
+
if (!delivery) return null;
|
|
16278
|
+
if (delivery.methods.homeDelivery) return { type: "SHIPPING" };
|
|
16279
|
+
if (!delivery.methods.pickup) return null;
|
|
16280
|
+
const [only, ...rest] = delivery.pickupLocations;
|
|
16281
|
+
return only && rest.length === 0 ? { type: "PICKUP", pickupLocationId: only.id } : { type: "PICKUP" };
|
|
16282
|
+
}
|
|
16283
|
+
function quoteRequiresDelivery(quote) {
|
|
16284
|
+
return quote ? quote.lines.some((line) => line.isShippable) : true;
|
|
16285
|
+
}
|
|
16286
|
+
function toCheckoutFulfillmentFields(value, address, requiresDelivery = true) {
|
|
16287
|
+
if (!value || !requiresDelivery) return { fulfillment: { type: "SHIPPING" } };
|
|
16288
|
+
if (value.type === "PICKUP") {
|
|
16289
|
+
return { fulfillment: value.pickupLocationId ? { type: "PICKUP", pickupLocationId: value.pickupLocationId } : { type: "PICKUP" } };
|
|
16290
|
+
}
|
|
16291
|
+
const shippingAddress = {
|
|
16292
|
+
firstName: address.firstName.trim(),
|
|
16293
|
+
lastName: address.lastName.trim(),
|
|
16294
|
+
street: address.street.trim(),
|
|
16295
|
+
postalCode: address.postalCode.trim(),
|
|
16296
|
+
city: address.city.trim(),
|
|
16297
|
+
...address.region.trim() ? { region: address.region.trim() } : {}
|
|
16298
|
+
};
|
|
16299
|
+
return { fulfillment: { type: "SHIPPING" }, shippingAddress };
|
|
16300
|
+
}
|
|
16301
|
+
|
|
16302
|
+
// src/components/checkout-quote-summary.tsx
|
|
16303
|
+
import { cn as cn25 } from "@reblu/site-ui/utils";
|
|
16304
|
+
import { Fragment as Fragment6, jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
16305
|
+
var DEFAULT_CHECKOUT_QUOTE_SUMMARY_LABELS = {
|
|
16306
|
+
subtotal: "Subtotal",
|
|
16307
|
+
discount: (codeOrLabel, isAutomatic) => isAutomatic ? codeOrLabel : `Descuento (${codeOrLabel})`,
|
|
16308
|
+
free: "Gratis",
|
|
16309
|
+
delivery: "Entrega",
|
|
16310
|
+
remainingForFree: (amount) => `Te faltan ${amount} para el env\xEDo gratis`,
|
|
16311
|
+
taxIncluded: (label) => `De los cuales ${label}`,
|
|
16312
|
+
total: "Total",
|
|
16313
|
+
taxesIncludedNote: "Impuestos incluidos",
|
|
16314
|
+
quantityTimesUnit: (quantity, unit) => `${quantity} \xD7 ${unit}`
|
|
16315
|
+
};
|
|
16316
|
+
function Row({
|
|
16317
|
+
name,
|
|
16318
|
+
value,
|
|
16319
|
+
className
|
|
16320
|
+
}) {
|
|
16321
|
+
return /* @__PURE__ */ jsxs29("div", { "data-slot": "checkout-quote-row", className: cn25("flex justify-between gap-4", className), children: [
|
|
16322
|
+
/* @__PURE__ */ jsx31("dt", { children: name }),
|
|
16323
|
+
/* @__PURE__ */ jsx31("dd", { className: "shrink-0 tabular-nums", children: value })
|
|
16324
|
+
] });
|
|
16325
|
+
}
|
|
16326
|
+
function CheckoutQuoteSummary({
|
|
16327
|
+
quote,
|
|
16328
|
+
heading,
|
|
16329
|
+
headingLevel = 2,
|
|
16330
|
+
labels,
|
|
16331
|
+
currencyCode,
|
|
16332
|
+
locale,
|
|
16333
|
+
className
|
|
16334
|
+
}) {
|
|
16335
|
+
const t = { ...DEFAULT_CHECKOUT_QUOTE_SUMMARY_LABELS, ...labels };
|
|
16336
|
+
const price = (cents) => formatPrice(cents, currencyCode, locale);
|
|
16337
|
+
const { fulfillment, shipping, tax, discount } = quote;
|
|
16338
|
+
const Tag = `h${headingLevel}`;
|
|
16339
|
+
return /* @__PURE__ */ jsxs29("section", { "data-slot": "checkout-quote-summary", className: slotClassName("space-y-4", "", className), children: [
|
|
16340
|
+
heading ? /* @__PURE__ */ jsx31(Tag, { className: "text-lg font-semibold", children: heading }) : null,
|
|
16341
|
+
/* @__PURE__ */ jsx31("ul", { className: "space-y-3 text-sm", children: quote.lines.map((line) => /* @__PURE__ */ jsxs29("li", { className: "flex justify-between gap-4", children: [
|
|
16342
|
+
/* @__PURE__ */ jsxs29("div", { className: "min-w-0 space-y-0.5", children: [
|
|
16343
|
+
/* @__PURE__ */ jsx31("p", { className: "font-medium", children: line.name }),
|
|
16344
|
+
line.variantName ? /* @__PURE__ */ jsx31("p", { className: "text-muted-foreground", children: line.variantName }) : null,
|
|
16345
|
+
/* @__PURE__ */ jsxs29("p", { className: "flex flex-wrap items-center gap-2 text-muted-foreground", children: [
|
|
16346
|
+
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,
|
|
16347
|
+
/* @__PURE__ */ jsx31("span", { children: t.quantityTimesUnit(line.quantity, price(line.unitPrice)) })
|
|
16348
|
+
] })
|
|
16349
|
+
] }),
|
|
16350
|
+
/* @__PURE__ */ jsx31("span", { className: "shrink-0 tabular-nums", children: price(line.total) })
|
|
16351
|
+
] }, `${line.productId}-${line.variantId ?? ""}`)) }),
|
|
16352
|
+
/* @__PURE__ */ jsxs29("dl", { className: "space-y-2 border-t border-border pt-3 text-sm", children: [
|
|
16353
|
+
/* @__PURE__ */ jsx31(Row, { name: t.subtotal, value: price(quote.subtotal) }),
|
|
16354
|
+
discount && discount.amount > 0 ? /* @__PURE__ */ jsx31(
|
|
16355
|
+
Row,
|
|
16356
|
+
{
|
|
16357
|
+
className: "text-green-700 dark:text-green-400",
|
|
16358
|
+
name: t.discount(discount.isAutomatic ? discount.label ?? discount.code : discount.code, discount.isAutomatic),
|
|
16359
|
+
value: `\u2212${price(discount.amount)}`
|
|
16360
|
+
}
|
|
16361
|
+
) : null,
|
|
16362
|
+
fulfillment.type ? /* @__PURE__ */ jsx31(
|
|
16363
|
+
Row,
|
|
16364
|
+
{
|
|
16365
|
+
name: /* @__PURE__ */ jsxs29(Fragment6, { children: [
|
|
16366
|
+
fulfillment.label ?? t.delivery,
|
|
16367
|
+
fulfillment.type === "PICKUP" && fulfillment.pickupLocation ? /* @__PURE__ */ jsx31("span", { className: "block text-muted-foreground", children: fulfillment.pickupLocation.name }) : null
|
|
16368
|
+
] }),
|
|
16369
|
+
value: fulfillment.type === "PICKUP" || shipping.isFree ? t.free : price(shipping.cost)
|
|
16370
|
+
}
|
|
16371
|
+
) : null,
|
|
16372
|
+
tax.isLineVisible ? tax.breakdown.map((entry) => /* @__PURE__ */ jsx31(
|
|
16373
|
+
Row,
|
|
16374
|
+
{
|
|
16375
|
+
className: tax.isIncluded ? "text-muted-foreground" : void 0,
|
|
16376
|
+
name: tax.isIncluded ? t.taxIncluded(entry.label) : entry.label,
|
|
16377
|
+
value: price(entry.amount)
|
|
16378
|
+
},
|
|
16379
|
+
entry.label
|
|
16380
|
+
)) : null,
|
|
16381
|
+
/* @__PURE__ */ jsx31(Row, { className: "border-t border-border pt-2 text-base font-bold", name: t.total, value: price(quote.total) })
|
|
16382
|
+
] }),
|
|
16383
|
+
tax.isIncluded ? /* @__PURE__ */ jsx31("p", { className: "text-sm text-muted-foreground", children: t.taxesIncludedNote }) : null,
|
|
16384
|
+
fulfillment.type === "SHIPPING" && !shipping.isFree && shipping.remainingForFree ? /* @__PURE__ */ jsx31("p", { className: "text-sm text-muted-foreground", children: t.remainingForFree(price(shipping.remainingForFree)) }) : null,
|
|
16385
|
+
fulfillment.type && quote.deliveryEstimateText ? /* @__PURE__ */ jsx31("p", { "data-slot": "checkout-quote-estimate", className: "text-sm text-muted-foreground", children: quote.deliveryEstimateText }) : null,
|
|
16386
|
+
quote.discountError ? /* @__PURE__ */ jsx31("p", { role: "status", className: "text-sm text-destructive", children: quote.discountError.message }) : null,
|
|
16387
|
+
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
|
|
16388
|
+
] });
|
|
16389
|
+
}
|
|
16390
|
+
|
|
16391
|
+
// src/components/checkout-terms-acceptance.tsx
|
|
16392
|
+
import { cn as cn26 } from "@reblu/site-ui/utils";
|
|
16393
|
+
import { Fragment as Fragment7, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
16394
|
+
function splitTermsLabel(label) {
|
|
16395
|
+
const at = label.indexOf("{terms}");
|
|
16396
|
+
return at === -1 ? [`${label} `, ""] : [label.slice(0, at), label.slice(at + "{terms}".length)];
|
|
16397
|
+
}
|
|
16398
|
+
function CheckoutTermsAcceptance({
|
|
16399
|
+
copy,
|
|
16400
|
+
termsHref,
|
|
16401
|
+
checked,
|
|
16402
|
+
onCheckedChange,
|
|
16403
|
+
error,
|
|
16404
|
+
newTabHint = "(se abre en una pesta\xF1a nueva)",
|
|
16405
|
+
id,
|
|
16406
|
+
className
|
|
16407
|
+
}) {
|
|
16408
|
+
if (!copy.termsVersion) return null;
|
|
16409
|
+
const boxId = id ?? "checkout-terms";
|
|
16410
|
+
const errorId = `${boxId}-error`;
|
|
16411
|
+
const [before, after] = splitTermsLabel(copy.termsCheckboxLabel).map(
|
|
16412
|
+
(part) => part.replaceAll("{tenant}", copy.tenantName)
|
|
16413
|
+
);
|
|
16414
|
+
const newTab = copy.isTermsLinkNewTab;
|
|
16415
|
+
return /* @__PURE__ */ jsxs30("div", { "data-slot": "checkout-terms", className: cn26("space-y-1", className), children: [
|
|
16416
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-start gap-3", children: [
|
|
16417
|
+
/* @__PURE__ */ jsx32(
|
|
16418
|
+
"input",
|
|
16419
|
+
{
|
|
16420
|
+
id: boxId,
|
|
16421
|
+
type: "checkbox",
|
|
16422
|
+
required: true,
|
|
16423
|
+
checked,
|
|
16424
|
+
onChange: (e) => onCheckedChange(e.target.checked),
|
|
16425
|
+
"aria-invalid": error ? true : void 0,
|
|
16426
|
+
"aria-describedby": error ? errorId : void 0,
|
|
16427
|
+
className: "mt-0.5 size-5 shrink-0 cursor-pointer accent-primary"
|
|
16428
|
+
}
|
|
16429
|
+
),
|
|
16430
|
+
/* @__PURE__ */ jsxs30("label", { htmlFor: boxId, className: "text-sm leading-relaxed", children: [
|
|
16431
|
+
before,
|
|
16432
|
+
/* @__PURE__ */ jsxs30(
|
|
16433
|
+
"a",
|
|
16434
|
+
{
|
|
16435
|
+
href: copy.termsLinkUrl ?? termsHref,
|
|
16436
|
+
...newTab ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
16437
|
+
className: "font-medium underline underline-offset-2 hover:text-primary",
|
|
16438
|
+
children: [
|
|
16439
|
+
copy.termsLinkText,
|
|
16440
|
+
newTab ? /* @__PURE__ */ jsxs30(Fragment7, { children: [
|
|
16441
|
+
" ",
|
|
16442
|
+
/* @__PURE__ */ jsx32("span", { className: "sr-only", children: newTabHint })
|
|
16443
|
+
] }) : null
|
|
16444
|
+
]
|
|
16445
|
+
}
|
|
16446
|
+
),
|
|
16447
|
+
after
|
|
16448
|
+
] })
|
|
16449
|
+
] }),
|
|
16450
|
+
error ? /* @__PURE__ */ jsx32("p", { id: errorId, className: "pl-8 text-sm text-destructive", children: error }) : null
|
|
16451
|
+
] });
|
|
16452
|
+
}
|
|
16453
|
+
function toCheckoutTermsFields(copy, accepted) {
|
|
16454
|
+
const version = copy?.termsVersion;
|
|
16455
|
+
return version ? { acceptsTerms: accepted, termsVersionId: version.id } : {};
|
|
16456
|
+
}
|
|
16457
|
+
|
|
16458
|
+
// src/components/checkout-pay-action.tsx
|
|
16459
|
+
import { cn as cn27 } from "@reblu/site-ui/utils";
|
|
16460
|
+
import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
16461
|
+
function CheckoutPayAction({
|
|
16462
|
+
label,
|
|
16463
|
+
notice,
|
|
16464
|
+
submitting = false,
|
|
16465
|
+
submittingLabel = "Procesando\u2026",
|
|
16466
|
+
disabled = false,
|
|
16467
|
+
id = "checkout-pay",
|
|
16468
|
+
className,
|
|
16469
|
+
buttonClassName,
|
|
16470
|
+
noticeClassName
|
|
16471
|
+
}) {
|
|
16472
|
+
const noticeId = `${id}-notice`;
|
|
16473
|
+
const isDisabled = submitting || disabled;
|
|
16474
|
+
return /* @__PURE__ */ jsxs31("div", { "data-slot": "checkout-pay-action", className: cn27("space-y-3", className), children: [
|
|
16475
|
+
/* @__PURE__ */ jsx33(
|
|
16476
|
+
"button",
|
|
16477
|
+
{
|
|
16478
|
+
type: "submit",
|
|
16479
|
+
disabled: isDisabled,
|
|
16480
|
+
"aria-busy": submitting || void 0,
|
|
16481
|
+
"aria-describedby": notice ? noticeId : void 0,
|
|
16482
|
+
className: buttonClassName ?? cn27(
|
|
16483
|
+
"flex w-full items-center justify-center gap-2 rounded-xl px-4 py-3 text-base font-semibold transition-all",
|
|
16484
|
+
isDisabled ? "cursor-not-allowed bg-muted text-muted-foreground" : "cursor-pointer bg-primary text-primary-foreground hover:bg-primary/90"
|
|
16485
|
+
),
|
|
16486
|
+
children: submitting ? submittingLabel : label
|
|
16487
|
+
}
|
|
16488
|
+
),
|
|
16489
|
+
notice ? /* @__PURE__ */ jsx33("p", { id: noticeId, "data-slot": "checkout-pay-notice", className: noticeClassName ?? "text-sm text-muted-foreground", children: notice }) : null
|
|
16490
|
+
] });
|
|
16491
|
+
}
|
|
16492
|
+
|
|
16493
|
+
// src/components/contact-interest-field.tsx
|
|
16494
|
+
import { cn as cn28 } from "@reblu/site-ui/utils";
|
|
16495
|
+
import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
16106
16496
|
function ContactInterestField({
|
|
16107
16497
|
interest,
|
|
16108
16498
|
value,
|
|
@@ -16119,18 +16509,18 @@ function ContactInterestField({
|
|
|
16119
16509
|
else next2.delete(option2);
|
|
16120
16510
|
onChange(interest.options.filter((candidate) => next2.has(candidate)));
|
|
16121
16511
|
};
|
|
16122
|
-
return /* @__PURE__ */
|
|
16123
|
-
/* @__PURE__ */
|
|
16124
|
-
/* @__PURE__ */
|
|
16512
|
+
return /* @__PURE__ */ jsxs32("fieldset", { "data-slot": "contact-interest", className: cn28("space-y-2", className), children: [
|
|
16513
|
+
/* @__PURE__ */ jsx34("legend", { className: "text-sm font-medium", children: interest.label }),
|
|
16514
|
+
/* @__PURE__ */ jsx34("div", { className: "flex flex-col gap-2", children: interest.options.map((option2, index) => {
|
|
16125
16515
|
const id = `${idPrefix}-${index}`;
|
|
16126
|
-
return /* @__PURE__ */
|
|
16516
|
+
return /* @__PURE__ */ jsxs32(
|
|
16127
16517
|
"label",
|
|
16128
16518
|
{
|
|
16129
16519
|
htmlFor: id,
|
|
16130
16520
|
"data-slot": "contact-interest-option",
|
|
16131
16521
|
className: "flex items-center gap-2 text-sm",
|
|
16132
16522
|
children: [
|
|
16133
|
-
/* @__PURE__ */
|
|
16523
|
+
/* @__PURE__ */ jsx34(
|
|
16134
16524
|
"input",
|
|
16135
16525
|
{
|
|
16136
16526
|
id,
|
|
@@ -16158,13 +16548,19 @@ export {
|
|
|
16158
16548
|
CartAdjustmentsNotice,
|
|
16159
16549
|
CartLineList,
|
|
16160
16550
|
CartSummary,
|
|
16551
|
+
CheckoutDeliveryChoice,
|
|
16161
16552
|
CheckoutForm,
|
|
16162
16553
|
CheckoutLoginPrompt,
|
|
16554
|
+
CheckoutPayAction,
|
|
16555
|
+
CheckoutQuoteSummary,
|
|
16556
|
+
CheckoutTermsAcceptance,
|
|
16163
16557
|
ContactInterestField,
|
|
16164
16558
|
CourseCatalogFilters,
|
|
16165
16559
|
CourseDescription,
|
|
16166
16560
|
CoursePurchaseTerms,
|
|
16167
16561
|
DATA_REQUEST_TYPES,
|
|
16562
|
+
DEFAULT_CHECKOUT_DELIVERY_CHOICE_LABELS,
|
|
16563
|
+
DEFAULT_CHECKOUT_QUOTE_SUMMARY_LABELS,
|
|
16168
16564
|
DEFAULT_COURSE_CATALOG_FILTERS_LABELS,
|
|
16169
16565
|
DEFAULT_COURSE_PRICE_BANDS,
|
|
16170
16566
|
DEFAULT_COURSE_PURCHASE_TERMS_LABELS,
|
|
@@ -16176,6 +16572,7 @@ export {
|
|
|
16176
16572
|
DEFAULT_TRUST_BADGE_HEADINGS,
|
|
16177
16573
|
DEFAULT_TRUST_BADGE_TYPE_ORDER,
|
|
16178
16574
|
DEFAULT_TRUST_ICONS,
|
|
16575
|
+
EMPTY_CHECKOUT_ADDRESS,
|
|
16179
16576
|
EMPTY_FULL_INVOICE_VALUE,
|
|
16180
16577
|
FaqAccordion,
|
|
16181
16578
|
FullInvoiceFields,
|
|
@@ -16199,17 +16596,21 @@ export {
|
|
|
16199
16596
|
buildFaqPageJsonLd,
|
|
16200
16597
|
buildShareUrls,
|
|
16201
16598
|
collectFaqItems,
|
|
16599
|
+
defaultCheckoutFulfillment,
|
|
16202
16600
|
formatPrice,
|
|
16203
16601
|
getShopErrorMessage,
|
|
16204
16602
|
isAllowedYouTubeHost,
|
|
16205
16603
|
isOverSimplifiedInvoiceCap,
|
|
16206
16604
|
markdownToPlainText,
|
|
16207
16605
|
markdownToSafeHtml,
|
|
16606
|
+
quoteRequiresDelivery,
|
|
16208
16607
|
readingTime,
|
|
16209
16608
|
sanitizeHtml,
|
|
16210
16609
|
shopIssuesInvoices,
|
|
16211
16610
|
shouldRenderShopFilters,
|
|
16212
|
-
|
|
16611
|
+
toCheckoutFulfillmentFields,
|
|
16612
|
+
toCheckoutInvoiceFields,
|
|
16613
|
+
toCheckoutTermsFields
|
|
16213
16614
|
};
|
|
16214
16615
|
/*! Bundled license information:
|
|
16215
16616
|
|