// Configurações — abas extras: WhatsApp, Agente IA, Status /* ─── SecRow (helper compartilhado) ────────────────────────────── */ function SecRow({ icon, label, hint, onAction }) { const toast = useToast(); return (
{label}
{hint}
); } /* ─── Template Modal (WhatsApp) ─────────────────────────────────── */ const WA_TEMPLATES_DEFAULT = [ { name: 'boas_vindas', text: 'Olá, {{nome}}! Sou da equipe Ezza. Como posso ajudar?', status: 'Aprovado', cat: 'Utilidade' }, { name: 'followup_3dias', text: 'Oi, {{nome}}! Passando pra saber se ficou alguma dúvida.', status: 'Aprovado', cat: 'Marketing' }, { name: 'proposta_enviada', text: '{{nome}}, enviei a proposta no seu e-mail. Conseguiu ver?', status: 'Aprovado', cat: 'Utilidade' }, { name: 'reagendamento', text: 'Oi, {{nome}}! Precisamos remarcar nossa reunião. Qual horário?', status: 'Em revisão', cat: 'Utilidade' }, { name: 'nps_pos_venda', text: 'Olá! Quanto você recomendaria a Ezza de 0 a 10?', status: 'Aprovado', cat: 'Marketing' }, ]; function TemplateModal({ initial, onClose, onSave }) { const [tplName, setTplName] = React.useState(initial?.name || ''); const [tplText, setTplText] = React.useState(initial?.text || ''); const [tplCat, setTplCat] = React.useState(initial?.cat || 'Utilidade'); const textRef = React.useRef(); const toast = useToast(); React.useEffect(() => { const h = (e) => { if (e.key === 'Escape') onClose(); }; window.addEventListener('keydown', h); return () => window.removeEventListener('keydown', h); }, [onClose]); const insertVar = () => { const ta = textRef.current; if (!ta) { setTplText(t => t + '{{nome}}'); return; } const s = ta.selectionStart, e = ta.selectionEnd; setTplText(tplText.slice(0, s) + '{{nome}}' + tplText.slice(e)); setTimeout(() => { ta.selectionStart = ta.selectionEnd = s + 8; ta.focus(); }, 0); }; const valid = tplName.trim().length > 0 && tplText.trim().length > 0; const submit = () => { if (!valid) return; onSave({ name: tplName.trim().toLowerCase().replace(/\s+/g,'_'), text: tplText.trim(), status: 'Em revisão', cat: tplCat }); toast(initial ? 'Template atualizado · Aguardando aprovação Meta ✓' : 'Template enviado para revisão pela Meta ✓'); onClose(); }; return (
e.stopPropagation()} style={{width:520}}>
{initial ? 'Editar' : 'Novo'} Template
Templates precisam de aprovação da Meta antes do uso.
{ICN.x}
setTplName(e.target.value.toLowerCase().replace(/[^a-z0-9_]/g,''))} autoFocus />
Somente letras minúsculas, números e underscore.