Riduce il routing del contact form pubblico a info, privacy e careers.

Allinea backend, configurazione env e documentazione al nuovo modello vetrina con destinatari meno granulari.

Made-with: Cursor
This commit is contained in:
Javaxman
2026-04-24 21:32:15 +02:00
parent f33d29fe7b
commit ddab32d3ef
4 changed files with 24 additions and 24 deletions

View File

@ -30,7 +30,7 @@ export const cta = {
nameLabel: 'Nome',
companyLabel: 'Azienda (opzionale)',
countryLabel: 'Paese',
departmentLabel: 'Reparto',
departmentLabel: 'Area',
emailLabel: 'Email',
messageLabel: 'Scrivi qui il tuo messaggio',
submitLabel: 'Invia messaggio',
@ -54,13 +54,9 @@ export const cta = {
fieldEmail: 'email',
fieldMessage: 'message',
departmentOptions: [
{ value: 'general', label: 'Generale' },
{ value: 'support', label: 'Support' },
{ value: 'privacy', label: 'Privacy / DPO' },
{ value: 'security', label: 'Security / Incident Response' },
{ value: 'ethics', label: 'Segnalazioni confidenziali (Ethics)' },
{ value: 'legal', label: 'Legal' },
{ value: 'hr', label: 'HR' },
{ value: 'info', label: 'Informazioni generali e commerciali' },
{ value: 'privacy', label: 'Privacy' },
{ value: 'careers', label: 'Careers / Collaborazioni' },
],
},
} as const;

View File

@ -82,12 +82,9 @@ async function sendWithResend(apiKey: string, fromEmail: string, toEmail: string
function resolveDepartmentRecipient(runtimeEnv: RuntimeEnv, defaultRecipient: string, department: string): string {
const normalized = department.trim().toLowerCase();
const map: Record<string, string> = {
support: readEnv('CONTACT_FORM_TO_EMAIL_SUPPORT', runtimeEnv),
info: readEnv('CONTACT_FORM_TO_EMAIL_INFO', runtimeEnv) || defaultRecipient,
privacy: readEnv('CONTACT_FORM_TO_EMAIL_PRIVACY', runtimeEnv),
security: readEnv('CONTACT_FORM_TO_EMAIL_SECURITY', runtimeEnv),
ethics: readEnv('CONTACT_FORM_TO_EMAIL_ETHICS', runtimeEnv),
legal: readEnv('CONTACT_FORM_TO_EMAIL_LEGAL', runtimeEnv),
hr: readEnv('CONTACT_FORM_TO_EMAIL_HR', runtimeEnv),
careers: readEnv('CONTACT_FORM_TO_EMAIL_CAREERS', runtimeEnv),
};
return map[normalized] || defaultRecipient;
}
@ -111,7 +108,7 @@ export const POST: APIRoute = async ({ request, locals, url }) => {
const company = required(form.get('company'));
const email = required(form.get('email'));
const country = required(form.get('country'));
const department = required(form.get('department')) || 'general';
const department = required(form.get('department')) || 'info';
const message = required(form.get('message'));
if (!name || !email || !country || !message) {