(function() { 'use strict';// --- CONFIGURAÇÕES DO E-BOOK --- const EBOOK_URL = 'https://birdcomunica.com.br/wp-content/uploads/2026/01/Bird_Bot-Book.pdf'; const GOOGLE_SCRIPT_URL = 'https://script.google.com/macros/s/AKfycbywUjtV44v1ZPgoSvxS5MHNxiP_g6prKXlfK_3Oaveh3qgZl99ib4M2R_snLJ3NhwlhPA/exec';// --- CONFIGURAÇÕES DO CHATWOOT --- window.chatwootSettings = { "position": "left", "type": "expanded_bubble", "launcherTitle": "Tire suas dúvidas com nossa IA!" }; function applyTranslations() { // Troca "Contact Form" por "Entre em Contato" document.querySelectorAll("h3.section_title.page_contact_form_title").forEach(function(el) { if (el.textContent.trim().toLowerCase() === "contact form") { el.textContent = "Entre em Contato"; } });// Troca "Biography" por "Mini-biografia" document.querySelectorAll("h3.section_title.team_member_brief_info_title").forEach(function(el) { if (el.textContent.trim().toLowerCase() === "biography") { el.textContent = "Mini-biografia"; } }); } })(document,"script"); })(document,"script"); }); }; } async function handleEbookSubmit(e) { e.preventDefault(); const form = e.target; const submitBtn = form.querySelector('button[type="submit"]');// Pegar valores const nome = document.getElementById('nome')?.value || ''; const email = document.getElementById('email')?.value || ''; const whatsapp = document.getElementById('whatsapp')?.value || '';// Feedback visual submitBtn.disabled = true; submitBtn.innerText = 'Enviando...';// Preparar dados para o Google Sheets const formData = new FormData(); formData.append('nome', nome); formData.append('email', email); formData.append('whatsapp', whatsapp);try { // Envio assíncrono (no-cors) fetch(GOOGLE_SCRIPT_URL, { method: 'POST', mode: 'no-cors', body: formData });// Delay para garantir o disparo e feedback ao usuário setTimeout(() => { window.open(EBOOK_URL, '_blank'); showEbookSuccess(); }, 800);} catch (error) { console.error('Erro no envio:', error); window.open(EBOOK_URL, '_blank'); showEbookSuccess(); } } function showEbookSuccess() { const formContainer = document.getElementById('ebook-form-container'); const successMsg = document.getElementById('success-message'); const downloadBtn = document.querySelector('.download-btn');if (formContainer) formContainer.style.display = 'none'; if (successMsg) successMsg.style.display = 'block'; if (downloadBtn) { downloadBtn.href = EBOOK_URL; downloadBtn.target = '_blank'; }setTimeout(() => { if (successMsg) { successMsg.scrollIntoView({ behavior: 'smooth', block: 'center' }); } }, 300); } function init() { // 1. Aplicar traduções applyTranslations();// 2. Inicializar Chat initChatwoot();// 3. Configurar formulário do E-book (se existir na página) const ebookForm = document.getElementById('bird-download-form'); if (ebookForm) { ebookForm.addEventListener('submit', handleEbookSubmit); } }// Executa quando o DOM estiver pronto if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); }})();
Skip to content Skip to footer