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 teacherStudentBuyRequestEmail = defineEmail({
|
|
|
|
|
id: 'teacherStudentBuyRequest',
|
|
|
|
|
subject: 'Request to Join Course!',
|
|
|
|
|
schema: z.object({
|
|
|
|
|
courseName: z.string().min(1),
|
|
|
|
|
studentEmail: z.string().email(),
|
2026-06-22 05:43:48 +01:00
|
|
|
studentFullname: z.string().min(1),
|
2026-07-19 12:02:11 +01:00
|
|
|
courseUrl: z.url(),
|
|
|
|
|
autoEnrollUrl: z.url(),
|
2026-06-22 05:43:48 +01:00
|
|
|
branding: ZEmailBranding
|
2026-03-09 11:18:22 +01:00
|
|
|
}),
|
|
|
|
|
render: (fields) => {
|
|
|
|
|
const content = `
|
|
|
|
|
<p>Hi amazing tutor,</p>
|
|
|
|
|
<p>A new student has requested to join a course you are teaching: "${fields.courseName}"</p>
|
|
|
|
|
<p style="font-weight: bold;">Student details</p>
|
|
|
|
|
<p>
|
|
|
|
|
Name: ${fields.studentFullname}<br />
|
|
|
|
|
Email: ${fields.studentEmail}
|
|
|
|
|
</p>
|
2026-07-19 12:02:11 +01:00
|
|
|
<p style="font-weight: bold; margin-top: 24px;">How to give this student access</p>
|
|
|
|
|
<ol style="padding-left: 20px; line-height: 1.6;">
|
|
|
|
|
<li>Open the course: <a href="${fields.courseUrl}">${fields.courseUrl}</a></li>
|
|
|
|
|
<li>Click <strong>People</strong> on the sidebar</li>
|
|
|
|
|
<li>Click <strong>Add</strong></li>
|
|
|
|
|
<li>Under <strong>Invite new students</strong>, enter <strong>${fields.studentEmail}</strong></li>
|
|
|
|
|
<li>Click <strong>Invite Students</strong></li>
|
|
|
|
|
</ol>
|
|
|
|
|
<p style="font-weight: bold; margin-top: 24px;">Or automatically enroll them</p>
|
|
|
|
|
<p>Use the button below to open the course and send this student an invite in one step.</p>
|
|
|
|
|
<div>
|
|
|
|
|
<a class="button" href="${fields.autoEnrollUrl}">Auto Enroll Student</a>
|
|
|
|
|
</div>
|
2026-03-09 11:18:22 +01:00
|
|
|
`;
|
|
|
|
|
|
2026-06-22 05:43:48 +01:00
|
|
|
return getDefaultTemplate(content, fields.branding);
|
2026-03-09 11:18:22 +01:00
|
|
|
}
|
|
|
|
|
});
|