fix(worker): restore original Ravis de vous revoir email template #9
@ -564,74 +564,87 @@ async function sendWelcomeViaResend(env, contact) {
|
||||
}
|
||||
|
||||
// Email "Ravis de vous revoir" pour les clients déjà inscrits qui retentent
|
||||
// le formulaire de contact. Rappelle le numéro de référence existant et
|
||||
// précise que le contact n'est pas re-créé (= anti-doublon HubSpot).
|
||||
// Idempotent côté HubSpot (= zéro write). Footer 2026 cohérent avec les
|
||||
// autres emails Resend.
|
||||
// le formulaire de contact. Reprend EXACTEMENT le template original (= avant
|
||||
// migration EmailJS \xe2\x86\x92 Resend) car son contenu est strat\xc3\xa9gique \xe2\x80\x94 rappel
|
||||
// adresse Paris + warning anti-modification + r\xe9f\xe9rence client. Seules
|
||||
// modifications : footer (c) 2025 \xe2\x86\x92 \xc2\xa9 2026, suppression du tag
|
||||
// "Email sent via EmailJS.com" (obsol\xe8te depuis Resend), URL logo
|
||||
// pointe vers le nouveau domaine, et adresse Paris injecte la ref via
|
||||
// le placeholder {{ref}} de PARIS_DEPOT_ADDRESS.
|
||||
//
|
||||
// Idempotent c\xf4t\xe9 HubSpot (= z\xe9ro write).
|
||||
async function sendWelcomeBackViaResend(env, contact) {
|
||||
const siteUrl = env.SITE_URL || 'https://mva-globalfret.com';
|
||||
const logoUrl = `${siteUrl}/PNG%20MVA%20GLOBAL%20FRET.png`;
|
||||
const firstname = escapeHtml(contact.firstname || '');
|
||||
const ref = escapeHtml(contact.reference_client || '');
|
||||
const refBlock = ref
|
||||
? `<div style="margin:24px 0;padding:18px 24px;background:#1a1a3e;border:2px solid #c5a55a;border-radius:10px;text-align:center;">
|
||||
<div style="color:#c5a55a;font-size:11px;font-weight:700;letter-spacing:1.5px;margin-bottom:6px;">VOTRE NUMÉRO DE RÉFÉRENCE EXISTANT</div>
|
||||
<div style="color:#fff;font-size:28px;font-weight:700;letter-spacing:3px;">${ref}</div>
|
||||
</div>`
|
||||
: '';
|
||||
const firstnameRaw = contact.firstname || '';
|
||||
const firstname = escapeHtml(firstnameRaw);
|
||||
const refRaw = contact.reference_client || '';
|
||||
const ref = escapeHtml(refRaw);
|
||||
|
||||
const html = `<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<body style="margin:0;padding:0;font-family:Arial,sans-serif;background:#f5f5f5;">
|
||||
<div style="max-width:600px;margin:0 auto;background:#fff;">
|
||||
<div style="background:#1a1a3e;padding:24px 30px;">
|
||||
<table role="presentation" cellspacing="0" cellpadding="0" border="0" style="width:100%;border-collapse:collapse;">
|
||||
<tr>
|
||||
<td style="width:80px;vertical-align:middle;">
|
||||
<img src="${logoUrl}" alt="MVA Global Fret" style="display:block;width:70px;height:auto;border:0;">
|
||||
</td>
|
||||
<td style="vertical-align:middle;text-align:center;padding-right:80px;">
|
||||
<div style="color:#c5a55a;font-size:24px;font-weight:700;letter-spacing:2px;">MVA GLOBAL FRET</div>
|
||||
<div style="color:#fff;font-size:13px;margin-top:6px;">Fret Aérien Paris — Antananarivo</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
// Construction adresse Paris (= m\xeame logique que sendWelcomeViaResend) :
|
||||
// injecte la ref client soit via placeholder {{ref}}, soit en l'ajoutant
|
||||
// entre parenth\xe8ses sur la 1\xe8re ligne (= pattern original "VASTA Mélissa (MVA-XXX)").
|
||||
let parisAddrRaw = env.PARIS_DEPOT_ADDRESS || '';
|
||||
if (parisAddrRaw.includes('{{ref}}')) {
|
||||
parisAddrRaw = parisAddrRaw.replace(/\{\{ref\}\}/g, refRaw);
|
||||
} else if (refRaw && parisAddrRaw) {
|
||||
const lines = parisAddrRaw.split('\n');
|
||||
lines[0] = `${lines[0]} (${refRaw})`;
|
||||
parisAddrRaw = lines.join('\n');
|
||||
}
|
||||
// 1\xe8re ligne en gras (= match original `<strong>VASTA Melissa (MVA-XXX)</strong>`)
|
||||
const addrLines = escapeHtml(parisAddrRaw).split('\n');
|
||||
const parisAddrHtml = addrLines.length > 1
|
||||
? `<strong>${addrLines[0]}</strong><br>${addrLines.slice(1).join('<br>')}`
|
||||
: escapeHtml(parisAddrRaw);
|
||||
|
||||
const greetingTitle = firstnameRaw
|
||||
? `Ravis de vous revoir, ${firstname} !`
|
||||
: 'Ravis de vous revoir !';
|
||||
|
||||
const html = `<html lang=""><body><div style="font-family:Arial,sans-serif;font-size:16px;background-color:#f5f5f5;padding:20px">
|
||||
<div style="max-width:600px;margin:auto;background-color:#ffffff;border-radius:8px;overflow:hidden">
|
||||
<div style="background-color:#1a1a3e;padding:30px 40px;text-align:center">
|
||||
<table width="100%" cellpadding="0" cellspacing="0" role="presentation"><tr><td width="145" style="padding:15px 0 15px 20px;vertical-align:middle"><img src="${logoUrl}" width="130" height="130" alt="MVA" style="display:block;"></td><td style="text-align:center;padding:15px 75px 15px 0;vertical-align:middle"><div style="color:#c5a55a;font-size:22px;font-weight:700;letter-spacing:2px;font-family:Arial,sans-serif">MVA GLOBAL FRET</div><div style="color:#ffffff;font-size:12px;margin-top:4px;font-family:Arial,sans-serif">Fret Aerien Paris - Antananarivo</div></td></tr></table>
|
||||
</div>
|
||||
<div style="padding:40px;">
|
||||
<p style="font-size:18px;color:#1a1a3e;font-weight:bold;">Bonjour ${firstname || 'cher client'},</p>
|
||||
<p style="color:#333;line-height:1.6;">
|
||||
Votre adresse email est <strong>déjà enregistrée</strong> chez MVA Global Fret.
|
||||
Pas besoin de vous ré-inscrire — votre compte est actif.
|
||||
</p>
|
||||
${refBlock}
|
||||
<p style="color:#333;line-height:1.6;">
|
||||
Utilisez ce numéro pour étiqueter vos colis et les rendre traçables tout au long du transport Paris → Antananarivo.
|
||||
</p>
|
||||
<p style="color:#333;line-height:1.6;">
|
||||
Pour toute question, n'hésitez pas à nous contacter :
|
||||
</p>
|
||||
<ul style="color:#333;line-height:1.8;padding-left:18px;">
|
||||
<li><a href="mailto:mvaglobalfret@gmail.com" style="color:#c5a55a;text-decoration:none;">mvaglobalfret@gmail.com</a></li>
|
||||
<li><a href="tel:+33780970825" style="color:#c5a55a;text-decoration:none;">+33 7 80 97 08 25</a> (France)</li>
|
||||
<li><a href="tel:+261384973751" style="color:#c5a55a;text-decoration:none;">+261 38 49 737 51</a> (Madagascar)</li>
|
||||
<div style="padding:40px">
|
||||
<p style="color:#1a1a3e;font-size:22px;font-weight:bold;margin-top:0">${greetingTitle}</p>
|
||||
<p style="color:#333333">Nous avons bien recu votre nouvelle tentative d'inscription. Pas d'inquietude : vous etes <strong>deja client</strong> chez MVA Global Fret !</p>
|
||||
<p style="color:#333333">Voici un rappel de votre numero de reference client :</p>
|
||||
<div style="background-color:#f0ead8;border-left:4px solid #c5a55a;padding:16px 20px;margin:24px 0;border-radius:4px;text-align:center">
|
||||
<p style="margin:0;color:#1a1a3e;font-size:14px;letter-spacing:1px">VOTRE NUMERO DE REFERENCE CLIENT</p>
|
||||
<p style="margin:8px 0 0 0;color:#1a1a3e;font-size:28px;font-weight:bold;letter-spacing:2px">${ref}</p>
|
||||
<p style="margin:6px 0 0 0;color:#666666;font-size:12px">Conservez ce numero precieusement.</p>
|
||||
</div>
|
||||
<p style="color:#333333;margin-top:28px"><strong>L'adresse a Paris pour l'envoi de vos colis est :</strong></p>
|
||||
<div style="background-color:#f9f9f9;border:1px solid #dddddd;padding:20px 24px;border-radius:6px;margin:12px 0 24px 0;font-family:monospace;font-size:15px;line-height:1.8;color:#1a1a3e">
|
||||
${parisAddrHtml}
|
||||
</div>
|
||||
<div style="background-color:#fff3cd;border:1px solid #ffc107;padding:16px 20px;border-radius:6px;margin:24px 0">
|
||||
<p style="margin:0;color:#856404;font-size:14px"><strong>IMPORTANT :</strong> Cette adresse ne doit etre changee sous aucun pretexte. Toute modification empecherait la bonne transmission de votre colis a notre depot a Paris.</p>
|
||||
</div>
|
||||
<p style="color:#333333">Pour toute question, n'hesitez pas a nous contacter :</p>
|
||||
<ul style="color:#333333;line-height:2">
|
||||
<li><a href="mailto:mvaglobalfret@gmail.com" style="color:#c5a55a">mvaglobalfret@gmail.com</a></li>
|
||||
<li><a href="tel:+33780970825" style="color:#c5a55a">+33 7 80 97 08 25</a> (France)</li>
|
||||
<li><a href="tel:+261384973751" style="color:#c5a55a">+261 38 49 737 51</a> (Madagascar)</li>
|
||||
</ul>
|
||||
<p style="color:#666;font-size:13px;line-height:1.6;border-top:1px solid #eee;padding-top:18px;margin-top:30px;">
|
||||
À très bientôt pour votre prochain envoi,<br>
|
||||
<strong>L'équipe MVA Global Fret</strong>
|
||||
</p>
|
||||
<p style="color:#333333;margin-top:32px">A tres bientot pour votre prochain envoi,<br><strong>L'equipe MVA Global Fret</strong></p>
|
||||
</div>
|
||||
<div style="background:#1a1a3e;padding:18px;text-align:center;color:#c5a55a;font-size:12px;">
|
||||
© 2026 MVA Global Fret — Antananarivo 101, Madagascar
|
||||
<div style="background-color:#1a1a3e;color:rgba(255,255,255,0.6);padding:16px;text-align:center;font-size:12px">
|
||||
(c) 2026 MVA Global Fret - Antananarivo 101, Madagascar
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>`;
|
||||
</div></body></html>`;
|
||||
|
||||
// Subject : reprend strictement le sujet original "Ravis de vous revoir, [firstname] !"
|
||||
// (= en cas de firstname vide, fallback sans virgule).
|
||||
const subjectFirstname = firstnameRaw.replace(/[\r\n]/g, '').trim();
|
||||
return resendSend(env, {
|
||||
to: contact.email,
|
||||
subject: ref
|
||||
? `Vous êtes déjà inscrit chez MVA Global Fret — Référence ${contact.reference_client}`
|
||||
: 'Vous êtes déjà inscrit chez MVA Global Fret',
|
||||
subject: subjectFirstname
|
||||
? `Ravis de vous revoir, ${subjectFirstname} !`
|
||||
: 'Ravis de vous revoir !',
|
||||
html,
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user