* feat(course): add auto-enrol flow for paid course join requests - Extend teacher buy-request email with manual access steps and an Auto Enrol this Student button - Link teachers to the course People page with grantAccess query param - Add grant-access modal that sends the same org audience invite used by the Invite new students flow Co-authored-by: Rotimi Best <[email protected]> * fix(i18n): translate grant access modal strings Replace English placeholders copied into non-en locale files with proper translations for each supported language. Co-authored-by: Rotimi Best <[email protected]> * fix(email): shorten auto-enrol button label per review Co-authored-by: Rotimi Best <[email protected]> * fix(email): use American spelling Enroll in auto-enroll CTA Co-authored-by: Rotimi Best <[email protected]> * fix(i18n): localize Danish grant-access send invite label Co-authored-by: Rotimi Best <[email protected]> --------- Co-authored-by: Rotimi Best <[email protected]>
45 lines
1.7 KiB
TypeScript
45 lines
1.7 KiB
TypeScript
import * as z from 'zod';
|
|
|
|
import { defineEmail } from '../send';
|
|
import { getDefaultTemplate } from '../templates';
|
|
import { ZEmailBranding } from '../core/branding';
|
|
|
|
export const teacherStudentBuyRequestEmail = defineEmail({
|
|
id: 'teacherStudentBuyRequest',
|
|
subject: 'Request to Join Course!',
|
|
schema: z.object({
|
|
courseName: z.string().min(1),
|
|
studentEmail: z.string().email(),
|
|
studentFullname: z.string().min(1),
|
|
courseUrl: z.url(),
|
|
autoEnrollUrl: z.url(),
|
|
branding: ZEmailBranding
|
|
}),
|
|
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>
|
|
<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>
|
|
`;
|
|
|
|
return getDefaultTemplate(content, fields.branding);
|
|
}
|
|
});
|