(() => { if (!window.location.pathname.includes('/productos/')) return; if (LS?.theme?.name === "Patagonia") return; const buildGocuotasBlock = () => { const newContainer = document.createElement('div'); newContainer.classList.add('col-12','mb-2'); const newSubContainer = document.createElement('div'); newSubContainer.classList.add('gocuotas-info-container-product'); newSubContainer.innerHTML = `
Logo GOcuotas
Cuotas SIN interés con DÉBITO
`; newContainer.appendChild(newSubContainer); return newContainer; }; const insertIfNeeded = (targetSelector, position = 'beforeend', after = false) => { if (document.querySelector('.gocuotas-info-container-product')) return null; const target = document.querySelector(targetSelector); if (!target) return null; const block = buildGocuotasBlock(); if (after) { target.insertAdjacentElement('afterend', block); } else { target.insertAdjacentElement(position, block); } setupModalHandlers(block); return block; }; const setupModalHandlers = (block) => { if (!block) return; const learnMoreButton = block.querySelector('#gocuotas-learn-more'); const modal = block.querySelector('#gocuotas-modal'); if (!learnMoreButton || !modal) return; const closeModal = block.querySelector('#gocuotas-modal-close'); const modalContent = block.querySelector('.gocuotas-modal-content'); const goSiteButton = block.querySelector('#gocuotas-site'); if (learnMoreButton._gocuotasBound) return; learnMoreButton._gocuotasBound = true; learnMoreButton.addEventListener('click', (event) => { event.preventDefault(); event.stopPropagation(); modal.style.display = 'flex'; return false; }); if (closeModal) { closeModal.addEventListener('click', (event) => { event.preventDefault(); event.stopPropagation(); modal.style.display = 'none'; }); } modal.addEventListener('click', (event) => { if (event.target === modal) { event.preventDefault(); event.stopPropagation(); modal.style.display = 'none'; } }); if (modalContent) { modalContent.addEventListener('click', (event) => { event.stopPropagation(); }); } if (goSiteButton) { goSiteButton.addEventListener('click', (event) => { event.preventDefault(); event.stopPropagation(); window.open('https://www.gocuotas.com/usuarios', '_blank'); }); } }; // Theme Default insertIfNeeded('.js-product-payments-container', 'afterbegin', false); })();