FEAT: Painel de templates HSM com preview WhatsApp e integração Meta
Some checks are pending
Deploy Dev / deploy (push) Waiting to run
Some checks are pending
Deploy Dev / deploy (push) Waiting to run
- TemplateManagementPanel reescrito: form com header/body/footer/
botões (Quick Reply, URL, Ligar) e preview visual estilo WhatsApp
- Detecção automática de variáveis {{1}} {{2}} com editor de rótulo
e exemplo para cada variável do corpo
- Cartões de template com status Meta (Aprovado/Aguardando/Rejeitado)
e ações Editar, Enviar para Meta, Excluir
- Botão Sincronizar para buscar status atualizado da Meta API
- WhatsappConfigModal agora inclui campo WABA ID (obrigatório para
criação e sincronização de templates)
- templateService.js: submitTemplateToMeta() e syncTemplatesFromMeta()
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e2e3e626c4
commit
aed077f344
File diff suppressed because it is too large
Load Diff
@ -40,6 +40,7 @@ export function WhatsappConfigModal({ onClose }) {
|
|||||||
phone_number_id: '',
|
phone_number_id: '',
|
||||||
api_version: 'v25.0',
|
api_version: 'v25.0',
|
||||||
webhook_token: '',
|
webhook_token: '',
|
||||||
|
waba_id: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -51,6 +52,7 @@ export function WhatsappConfigModal({ onClose }) {
|
|||||||
phone_number_id: data.phone_number_id || '',
|
phone_number_id: data.phone_number_id || '',
|
||||||
api_version: data.api_version || 'v25.0',
|
api_version: data.api_version || 'v25.0',
|
||||||
webhook_token: data.webhook_token || '',
|
webhook_token: data.webhook_token || '',
|
||||||
|
waba_id: data.waba_id || '',
|
||||||
}));
|
}));
|
||||||
})
|
})
|
||||||
.catch(() => setError('Não foi possível carregar a configuração atual.'))
|
.catch(() => setError('Não foi possível carregar a configuração atual.'))
|
||||||
@ -262,6 +264,23 @@ export function WhatsappConfigModal({ onClose }) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label htmlFor="wa-waba-id" style={labelStyle}>
|
||||||
|
WABA ID (WhatsApp Business Account ID)
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
id="wa-waba-id"
|
||||||
|
type="text"
|
||||||
|
placeholder="ex: 123456789012345"
|
||||||
|
value={form.waba_id}
|
||||||
|
onChange={(e) => handleChange('waba_id', e.target.value)}
|
||||||
|
style={fieldStyle}
|
||||||
|
/>
|
||||||
|
<p style={{ margin: '0.2rem 0 0', fontSize: '0.75rem', color: 'var(--color-text-soft)', fontWeight: 600 }}>
|
||||||
|
Necessário para criar e sincronizar templates HSM.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '0.65rem' }}>
|
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '0.65rem' }}>
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="wa-api-version" style={labelStyle}>
|
<label htmlFor="wa-api-version" style={labelStyle}>
|
||||||
|
|||||||
@ -25,14 +25,14 @@ export function updateTemplate(id, payload) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function approveTemplateByAdmin(id) {
|
export function submitTemplateToMeta(id) {
|
||||||
return request(`/whatsapp/templates/approve-admin/${id}`, {
|
return request(`/whatsapp/templates/${id}/submit-meta`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function rejectTemplateByAdmin(id) {
|
export function syncTemplatesFromMeta() {
|
||||||
return request(`/whatsapp/templates/reject-admin/${id}`, {
|
return request('/whatsapp/templates/sync-meta', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user