(() => { const CFG = window.PROLOGY_CONFIG; // ── Icons ── const ICON_PHONE = ``; const ICON_EMAIL = ``; const SOCIAL_SVG = { facebook: ``, linkedin: ``, youtube: ``, ebay: ``, }; // ── Helpers ── const escape = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'", })[c]); const linkUrl = (item) => { const url = item.url || ""; if (item.external || /^https?:\/\//i.test(url)) return url; const trimmed = url.replace(/^\/+/, ""); const suffix = /\.[a-z0-9]+$/i.test(trimmed) ? "" : "/"; return CFG.FOOTER_BASE_URL + trimmed + suffix; }; const staticUrl = (rel) => /^https?:\/\//i.test(rel) ? rel : CFG.FOOTER_STATIC_URL + rel.replace(/^\/+/, ""); // ── Renderers ── const renderBrand = (data) => { const phoneItems = (data.phones || []) .flatMap((g) => (g.numbers || []).map( (n) => ``, ), ) .join(""); const emailItems = (data.emails || []) .flatMap((g) => (g.addresses || []).map( (addr) => ``, ), ) .join(""); const addressBlocks = (data.addresses || []) .map( (a) => ``, ) .join(""); return ` `; }; const renderCol = (title, items) => { if (!items || !items.length) return ""; const lis = items .map( (it) => `
  • ${escape(it.label)}
  • `, ) .join(""); return ``; }; const renderPartnerRow = (label, items, ariaLabel) => { if (!items || !items.length) return ""; const imgs = items .map((p) => { const w = p.width ? ` width="${p.width}"` : ""; const h = p.height ? ` height="${p.height}"` : ""; return `${escape(p.name)}`; }) .join(""); return ``; }; const renderSocial = (items) => { if (!items || !items.length) return ""; return items .map((s) => { const icon = SOCIAL_SVG[s.icon] || ""; const cls = "ns-footer__social-link" + (s.icon === "ebay" ? " ns-footer__social-link--ebay" : ""); return `${icon}`; }) .join(""); }; const renderFooter = (data) => { const links = data.links || {}; return ` `; }; // ── Boot ── const mount = document.querySelector("footer.page-footer"); if (!mount) return; fetch(CFG.FOOTER_DATA_URL) .then((r) => { if (!r.ok) throw new Error("HTTP " + r.status); return r.json(); }) .then((data) => { mount.innerHTML = renderFooter(data); }) .catch((err) => { console.error("[footer] failed to load", CFG.FOOTER_DATA_URL, err); }); })();