From c22240e6bf449b598603a736ca35d8c45bfe4065 Mon Sep 17 00:00:00 2001 From: louispaulb Date: Fri, 27 Mar 2026 15:56:23 -0400 Subject: [PATCH] feat: Mailjet email for contact form + lead capture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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) --- src/components/AvailabilityDialog.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/AvailabilityDialog.tsx b/src/components/AvailabilityDialog.tsx index 03fa05a..b07c68f 100644 --- a/src/components/AvailabilityDialog.tsx +++ b/src/components/AvailabilityDialog.tsx @@ -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);