/* =====================================================================
ed-app.jsx — Versión Sell-U Laravel: SOLO el contenido del SPA.
El Nav y Footer del sitio público (Blade y )
los wrapping en cotizador-web.blade.php — aquí solo renderizamos
la sección hub/categoría/cotizador con hash routing.
===================================================================== */
const { useState: useSt, useEffect: useEf } = React;
function useHashRoute() {
const [hash, setHash] = useSt(() => window.location.hash || "#/");
useEf(() => {
const on = () => { setHash(window.location.hash || "#/"); window.scrollTo({ top: 0, behavior: "auto" }); };
window.addEventListener("hashchange", on);
return () => window.removeEventListener("hashchange", on);
}, []);
return hash;
}
function parseRoute(hash) {
const path = hash.replace(/^#/, "").replace(/^\//, "");
const seg = path.split("/").filter(Boolean);
if (seg.length === 0) return { name: "hub" };
if (seg[0] === "paginas-web") return { name: "paginas-web" };
if (seg[0] === "tipo") return { name: "tipo", key: seg[1] };
if (seg[0] === "plataforma") return { name: "plataforma", key: seg[1] };
if (seg[0] === "cotizador") return { name: "cotizador", key: seg[1] };
if (["contenido", "linkedin", "seo", "email"].includes(seg[0])) return { name: seg[0] };
return { name: "404" };
}
/* ---- Wrapper de cotizador con breadcrumb + volver ---- */
function CotizadorPage({ cfgKey }) {
const cfg = window.ED.quoters[cfgKey];
if (!cfg) return ;
const typeLabel = { landing: "Landing Page", ventas: "Página de Ventas", embudo: "Embudo de Ventas" }[cfgKey];
return (
{cfg.title}
Estimado en menos de un minuto · sin compromiso
);
}
/* ---- App ---- */
function App() {
const hash = useHashRoute();
const route = parseRoute(hash);
const [cal, setCal] = useSt(null);
useEf(() => { window.__edCal = (ctx) => setCal(ctx || "Consulta"); }, []);
useEf(() => { if (window.lucide) window.lucide.createIcons(); });
let view;
switch (route.name) {
case "hub": view = ; break;
case "paginas-web": view = ; break;
case "tipo": view = ; break;
case "plataforma": view = ; break;
case "cotizador": view = ; break;
case "contenido": view = ; break;
case "linkedin": view = ; break;
case "seo": view = ; break;
case "email": view = ; break;
default: view = ;
}
return (
{view}
setCal(null)} context={cal} />
);
}
window.EcosistemasApp = App;