diff --git a/index.html b/index.html index c448a33..a2384aa 100644 --- a/index.html +++ b/index.html @@ -85,7 +85,54 @@ -
+ + +
@@ -359,12 +406,13 @@ if (!data.ok) throw new Error("Token inválido"); const servicesList = data.services || []; - - currentQuotes = data.quotes || []; - renderPortal(data.client, data.company, servicesList); - - renderQuotes(); + currentQuotes = data.quotes || []; + + renderPortal(data.client, data.company, servicesList); + initProtectionBanner(data.subscription); + + renderQuotes(); // Si viene un service en la URL, podríamos hacer scroll hacia él aquí if (serviceParam) { @@ -393,6 +441,37 @@ }, 300); } + function openProtectionPlan() { + window.location.href = `plan-tranquilidad.html?token=${urlToken}`; +} + +function closeProtectionBanner() { + localStorage.setItem(`promo_closed_${urlToken}`, 'true'); + const banner = document.getElementById('promo-banner'); + if (!banner) return; + + banner.classList.add('opacity-0', 'translate-y-2', 'pointer-events-none'); + setTimeout(() => { + banner.classList.add('hidden'); + }, 250); +} + +function initProtectionBanner(subscription) { + const banner = document.getElementById('promo-banner'); + if (!banner) return; + + const wasClosed = localStorage.getItem(`promo_closed_${urlToken}`) === 'true'; + const isPlanPage = window.location.pathname.includes('plan-tranquilidad'); + + if (!subscription && !wasClosed && !isPlanPage) { + banner.classList.remove('hidden'); + } else { + banner.classList.add('hidden'); + } + + lucide.createIcons(); +} + // --- SISTEMA DE PESTAÑAS --- function toggleHistory() { const container = document.getElementById('historyServicesContainer');