class SiteFooter extends HTMLElement { async connectedCallback() { const { site } = await window.SiteData.get(); const asset = (key, fallback) => window.VendingRuntime?.asset?.(key, fallback) ?? fallback; const value = (path, fallback) => window.VendingRuntime?.value?.(path, fallback) ?? fallback; const copy = (key, fallback) => window.VendingRuntime?.copy?.(key, fallback) ?? fallback; const esc = (text) => String(text ?? "") .replace(/&/g, "&") .replace(//g, ">") .replace(/"/g, """); const text = (raw) => { if (typeof raw !== "string") return ""; return raw.trim(); }; const defaultQuickButtons = [ { image: "img/quick/mo-quick-bottom01.png", label: "전화상담", href: "tel:" }, { image: "img/quick/mo-quick-bottom02.png", label: "프리미엄", href: "?id=premium-premium" }, { image: "img/quick/mo-quick-bottom03.png", label: "인테리어", href: "?id=location-type" }, { image: "img/quick/mo-quick-bottom04.png", label: "방문예약", href: "?id=registration-registration" }, ]; const quickButtons = value("quickButtons", defaultQuickButtons); const ownerInfo = site.ownerInfo && typeof site.ownerInfo === "object" && !Array.isArray(site.ownerInfo) ? site.ownerInfo : null; const resolveHref = (href) => { if (href === "tel:" || href === "tel") return `tel:${site.tel}`; return href; }; const ownerRows = (() => { if (!ownerInfo) return ""; const type = text(ownerInfo.type).toLowerCase(); const rows = type === "agency" || type === "business" || type === "company" ? [ ["회사명", ownerInfo.companyName], ["사업자번호", ownerInfo.businessNumber || ownerInfo.businessRegistrationNumber], ["대표자명", ownerInfo.representativeName], ] : [ ["이름", ownerInfo.name], ["연락처", ownerInfo.phone], ["이메일", ownerInfo.email], ]; return rows .map(([label, raw]) => [label, text(raw)]) .filter(([, raw]) => raw) .map( ([label, raw]) => ` ${esc(label)} ${esc(raw)} `, ) .join(""); })(); const quickButtonsHtml = quickButtons .map((btn, i) => { const fallbackBtn = defaultQuickButtons[i] || {}; const img = asset(btn.image, btn.image || fallbackBtn.image); const label = btn.label ?? fallbackBtn.label ?? ""; const href = resolveHref(btn.href || fallbackBtn.href || "#"); return ` ${esc(label)}

${esc(label)}

`; }) .join(""); this.innerHTML = ` `; } } if (!customElements.get("site-footer")) { customElements.define("site-footer", SiteFooter); }