2026-03-09 11:18:22 +01:00
|
|
|
import * as z from 'zod';
|
|
|
|
|
|
|
|
|
|
import { defineEmail } from '../send';
|
|
|
|
|
import { getDefaultTemplate } from '../templates';
|
2026-06-22 05:43:48 +01:00
|
|
|
import { ZEmailBranding } from '../core/branding';
|
2026-03-09 11:18:22 +01:00
|
|
|
|
|
|
|
|
export const studentCourseInviteEmail = defineEmail({
|
|
|
|
|
id: 'studentCourseInvite',
|
|
|
|
|
subject: 'You are invited to join a course',
|
|
|
|
|
schema: z.object({
|
|
|
|
|
orgName: z.string().min(1),
|
|
|
|
|
courseName: z.string().min(1),
|
|
|
|
|
inviteLink: z.string().url(),
|
2026-06-22 05:43:48 +01:00
|
|
|
expiresAt: z.string().min(1),
|
|
|
|
|
branding: ZEmailBranding
|
2026-03-09 11:18:22 +01:00
|
|
|
}),
|
|
|
|
|
render: (fields) => {
|
|
|
|
|
const content = `
|
|
|
|
|
<p>Hi there,</p>
|
|
|
|
|
<p>You have been invited to join <strong>${fields.courseName}</strong> on ${fields.orgName}.</p>
|
|
|
|
|
<p>This invitation expires at <strong>${fields.expiresAt}</strong>.</p>
|
|
|
|
|
<div>
|
|
|
|
|
<a class="button" href="${fields.inviteLink}">Join Course</a>
|
|
|
|
|
</div>
|
|
|
|
|
`;
|
|
|
|
|
|
2026-06-22 05:43:48 +01:00
|
|
|
return getDefaultTemplate(content, fields.branding);
|
2026-03-09 11:18:22 +01:00
|
|
|
}
|
|
|
|
|
});
|