// Cart.jsx — shopping cart + checkout step const { useState: useCartState } = React; const Cart = ({ cart, onChangeQty, onRemove, onNav, onCheckout }) => { const { isMobile } = useViewport(); const subtotal = cart.reduce((s, it) => s + it.p.price * it.qty, 0); const savings = cart.reduce((s, it) => s + ((it.p.was || it.p.price) - it.p.price) * it.qty, 0); const shipping = subtotal >= 599 ? 0 : 89; const total = subtotal + shipping; const [coupon, setCoupon] = useCartState(""); return (

Mi carrito

{cart.length} {cart.length === 1 ? "producto" : "productos"} listos para tu compra

{cart.length === 0 ? (

Tu carrito está vacío

Cuando agregues productos los verás aquí.

) : (
{/* items */}
{cart.map((it, i) => (
{it.p.name}
{it.p.brand}
onNav("pdp", { id: it.p.id })} className="title-sm" style={{ cursor: "pointer", display: "block", marginTop: 4 }}>{it.p.name}
{it.p.shipping || "Llegada en 3-5 días"}
{it.qty}
${(it.p.price * it.qty).toLocaleString("es-MX")}
{it.p.was &&
${(it.p.was * it.qty).toLocaleString("es-MX")}
}
))}
{/* summary */}
)}
); }; const Line = ({ k, v, color }) => (
{k} {v}
); // --------------------------------------------------------------- // CheckoutDone — receipt screen with order summary, address, payment, ETA, invoice. const CheckoutDone = ({ order, onNav }) => { // Backwards compat: in case caller still passes orderNum as a string const orderNum = order?.orderNum || order || "AL-000000"; const o = typeof order === "object" ? order : null; return (
{/* Hero */}

¡Listo, tu compra fue confirmada!

Pedido #{orderNum}. Te enviamos los detalles a tu correo.

{/* Receipt card */}
{/* ETA banner */}
Llegada estimada: viernes 5 de marzo
Entre 10:00 y 18:00. Te avisamos por correo y notificación cuando salga del centro Allen Vallarta.
{o && ( <> {/* Address + payment */}
Entregar a
{o.address.name}
{o.address.street}
{o.address.area} · CP {o.address.zip}
Pago
{o.payment.type === "card" && o.payment.card && ( <>
{o.payment.card.brand} •••• {o.payment.card.last4}
{o.payment.msi > 1 &&
{o.payment.msi} MSI de ${Math.round(o.total / o.payment.msi).toLocaleString("es-MX")}
} )} {o.payment.type === "newCard" &&
Tarjeta nueva guardada
} {o.payment.type === "oxxo" && ( <>
OXXO efectivo
⏱ Tienes 48h para pagar la ficha
)}
{/* Items */}
Productos ({o.items.length})
{o.items.map(it => (
{it.p.name}
Cantidad: {it.qty}
${(it.p.price * it.qty).toLocaleString("es-MX")}
))}
{/* Total */}
Total pagado ${o.total.toLocaleString("es-MX")}
)}
{/* Actions */}
{/* Trust strip */}
{[ { icon: "verified", title: "Compra protegida", sub: "Devolución gratis hasta 30 días" }, { icon: "local_shipping", title: "Seguimiento en vivo",sub: "Te avisamos en cada cambio" }, { icon: "support_agent", title: "Soporte 24/7", sub: "Estamos por correo y WhatsApp" }, ].map(t => (
{t.title}
{t.sub}
))}
); }; window.Cart = Cart; window.CheckoutDone = CheckoutDone;