feat: Mailjet email for contact form + lead capture

- Contact form POSTs to /rpc/contact → Mailjet email to support@targo.ca
- Lead capture (availability dialog) POSTs to /rpc/lead → Mailjet email
- API server handles both endpoints with proper HTML formatting
- No Supabase edge functions needed

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
louispaulb 2026-03-27 15:56:23 -04:00
parent d8200b73e4
commit c22240e6bf

View File

@ -161,8 +161,19 @@ export function AvailabilityDialog({
const validContact = result.data;
const isEmail = validContact.includes("@");
// Log contact + send notification (TODO: replace with n8n webhook or Twilio)
console.log('[Lead]', selected.address_full, validContact, isEmail ? 'email' : 'phone');
// Send lead notification via Mailjet
try {
await fetch(API_BASE + '/rpc/lead', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
contact: validContact,
address: selected.address_full,
fiber_available: selected.fiber_available,
max_speed: selected.max_speed || 0,
}),
});
} catch (e) { console.error('Lead send error:', e); }
setSendingContact(false);
setContactSent(true);