Files
classroomio/packages/email/src/emails/student-course-completion.ts
T
Rotimi Best 81294a47f9 feat: live class sessions, CE workflow, and docs (#683)
Adds live-class session scheduling on lessons (join link, date/time,
timezone) with automatic 24h and 1h reminder emails plus a calendar
invite (.ics), a time-change notification with an updated invite, a
teacher-authored welcome email and session invite on enrollment, and a
"Notify students" quiz nudge.

LMS gets an upcoming live-sessions card and Join buttons, plus a
reusable live-session card component (3 states) in @cio/ui with a
Storybook story. The sidebar content tree now reflects sequential
progression locking like the content list, and the course-completion
confetti regression is fixed.

Org-based emails no longer reference ClassroomIO by name. Docs add
live-class, welcome-email, and course-progression guides, expand the
certificates guide (design, signatures, corrected labels), move
plan-required callouts to the top, flatten how-to-guides to the docs
root with redirects, and add screenshots. Includes an add-docs-image
skill.
2026-06-22 05:43:48 +01:00

36 lines
1.5 KiB
TypeScript

import * as z from 'zod';
import { defineEmail } from '../send';
import { getDefaultTemplate } from '../templates';
import { ZEmailBranding } from '../core/branding';
export const studentCourseCompletionEmail = defineEmail({
id: 'studentCourseCompletion',
subject: 'Congratulations — you completed the course requirements',
schema: z.object({
orgName: z.string().min(1),
courseName: z.string().min(1),
studentName: z.string().min(1),
certificateUrl: z.string().url(),
customMessage: z.string().nullable().optional(),
branding: ZEmailBranding
}),
render: (fields) => {
const customBlock =
fields.customMessage && fields.customMessage.trim().length > 0
? `<div style="margin:16px 0;padding:12px;border-left:3px solid #6366f1;background:#f8fafc;">${fields.customMessage}</div>`
: '';
const content = `
<p>Hi ${fields.studentName},</p>
<p>Congratulations! You have met the completion requirements for <strong>${fields.courseName}</strong>.</p>
${customBlock}
<p><a href="${fields.certificateUrl}" style="display:inline-block;padding:10px 16px;background:#111827;color:#fff;text-decoration:none;border-radius:6px;">View your certificate</a></p>
<p>If the button does not work, copy and paste this link into your browser:<br/><span style="word-break:break-all;">${fields.certificateUrl}</span></p>
<p>Cheers,<br/>${fields.orgName}</p>
`;
return getDefaultTemplate(content, fields.branding);
}
});