/* global React, useWishlist, useUI, Placeholder, waLink, waMessageForWishlist, HeartIcon */ const { useEffect } = React; function Wishlist() { const wl = useWishlist(); const ui = useUI(); useEffect(() => { if (!ui.wlOpen) return; const onKey = (e) => { if (e.key === "Escape") ui.closeWl(); }; window.addEventListener("keydown", onKey); return () => window.removeEventListener("keydown", onKey); }, [ui.wlOpen]); const total = wl.items.reduce((s, p) => s + (Number(String(p.price || "0").replace(/\./g, "")) || 0), 0); const fmt = (n) => n.toLocaleString("es-CO"); const msg = waMessageForWishlist(wl.items); return ( <>
> ); } window.Wishlist = Wishlist;