Fase de pré-lançamento. Estamos preparando tudo com muito carinho. 🫶
Atendimento: 61 998592018

CAFFUNÉ - EM BREVE
<script src="/js/caffune-form.js" defer></script>
(function(){
 
  const ENDPOINT = "https://script.google.com/macros/s/AKfycbzLVizpsF6sWx1E1Aud0OoYlEYqJqf3ntf40M6J5XKI0mi46lARdiO4p2pdCbNL4VAp/exec";
 
  const form = document.getElementById('caffune-form');
  const feedback = document.getElementById('caffune-feedback');
  const phone = document.getElementById('cf_phone');
  const nameField = document.getElementById('cf_name');
  const emailField = document.getElementById('cf_email');
  const consentField = document.getElementById('cf_consent');
 
  function maskPhone(v){
    v = v.replace(/\D/g, '').slice(0,11);
    if (v.length > 10) return v.replace(/^(\d{2})(\d{5})(\d{4}).*/, '($1) $2-$3');
    if (v.length > 6) return v.replace(/^(\d{2})(\d{4})(\d{0,4}).*/, '($1) $2-$3');
    if (v.length > 2) return v.replace(/^(\d{2})(\d{0,5}).*/, '($1) $2');
    if (v.length > 0) return v.replace(/^(\d{0,2}).*/, '($1');
    return v;
  }
 
  phone && phone.addEventListener('input', e => e.target.value = maskPhone(e.target.value));
 
  if (!form) return;
 
  form.addEventListener('submit', async function(e){
    e.preventDefault();
    feedback.textContent = '';
 
    const name = (nameField?.value || '').trim();
    const email = (emailField?.value || '').trim().toLowerCase();
    const phoneVal = (phone?.value || '').trim();
    const consent = consentField?.checked;
 
    if (!name || !email) {
      feedback.style.color = '#b91c1c';
      feedback.textContent = 'Por favor preencha nome e e-mail.';
      return;
    }
    if (!consent) {
      feedback.style.color = '#b91c1c';
      feedback.textContent = 'Por favor aceite a política de privacidade.';
      return;
    }
 
    const payload = {
      name, email, phone: phoneVal, consent,
      meta: {
        referrer: document.referrer || '',
        page: location.pathname,
        userAgent: navigator.userAgent,
        tz: Intl.DateTimeFormat().resolvedOptions().timeZone
      }
    };
 
    const btn = form.querySelector('button[type="submit"]');
    if (btn) btn.disabled = true;
 
    try {
      await fetch(ENDPOINT, {
        method: 'POST',
        headers: { 'Content-Type': 'text/plain;charset=utf-8' },
        body: JSON.stringify(payload)
      });
 
      feedback.style.color = '#065f46';
      feedback.innerHTML = '<strong>Pronto! Você está na lista.</strong>';
      form.reset();
    } catch {
      feedback.style.color = '#b91c1c';
      feedback.textContent = 'Erro ao enviar. Tente novamente.';
    } finally {
      if (btn) btn.disabled = false;
    }
  });
 
})();
 
Cadastre-se e receba cupom de desconto na inauguração