Files
Calbook/lib/email/template-engine.ts

30 lines
1013 B
TypeScript

export function renderTemplate(template: string, values: Record<string, string>) {
let output = template;
for (const [key, value] of Object.entries(values)) {
output = output.replaceAll(`{{${key}}}`, value);
}
return output;
}
export const EMAIL_TEMPLATE_PREVIEW_VALUES: Record<string, string> = {
customerName: "Max Mustermann",
date: "20.04.2026",
time: "10:15",
duration: "60",
staffName: "Anna Beispiel",
staffNames: "Anna Beispiel, Ben Demo",
phone: "+49 170 000000",
email: "max@example.com",
notes: "Ich möchte mich zu einem Projekt beraten lassen.",
companyName: "CalBook",
cancelUrl: "https://calbook.example/stornieren?token=demo",
rescheduleUrl: "https://calbook.example/buchen?rescheduleToken=demo",
meetingUrl: "https://meet.jit.si/calbook-demo-room",
meetingButton: "{{meetingButton}}",
reminderLabel: "in 24 Stunden",
hoursBefore: "24",
reminderKind: "primary",
timezone: "Europe/Berlin",
dashboardUrl: "https://calbook.example/admin/termine"
};