Scheduling infrastructure for absolutely everyone.
feat: added organizer daily video recording email (#9667)
Udit Takkar9c7428571d4c
diff --git a/packages/emails/email-manager.ts b/packages/emails/email-manager.tsindex 44de2620232..1c032dd91c3 100644--- a/packages/emails/email-manager.ts+++ b/packages/emails/email-manager.ts@@ -31,6 +31,7 @@ import type { OrganizationEmailVerify } from "./templates/organization-email-verimport OrganizationEmailVerification from "./templates/organization-email-verification";import OrganizerAttendeeCancelledSeatEmail from "./templates/organizer-attendee-cancelled-seat-email";import OrganizerCancelledEmail from "./templates/organizer-cancelled-email";+import OrganizerDailyVideoDownloadRecordingEmail from "./templates/organizer-daily-video-download-recording-email";import OrganizerLocationChangeEmail from "./templates/organizer-location-change-email";import OrganizerPaymentRefundFailedEmail from "./templates/organizer-payment-refund-failed-email";import OrganizerRequestEmail from "./templates/organizer-request-email";@@ -355,6 +356,8 @@ export const sendNoShowFeeChargedEmail = async (attendee: Person, evt: CalendarEexport const sendDailyVideoRecordingEmails = async (calEvent: CalendarEvent, downloadLink: string) => {const emailsToSend: Promise<unknown>[] = [];+ emailsToSend.push(sendEmail(() => new OrganizerDailyVideoDownloadRecordingEmail(calEvent, downloadLink)));+for (const attendee of calEvent.attendees) {emailsToSend.push(sendEmail(() => new AttendeeDailyVideoDownloadRecordingEmail(calEvent, attendee, downloadLink))diff --git a/packages/emails/src/templates/AttendeeDailyVideoDownloadRecordingEmail.tsx b/packages/emails/src/templates/DailyVideoDownloadRecordingEmail.tsxsimilarity index 92%rename from packages/emails/src/templates/AttendeeDailyVideoDownloadRecordingEmail.tsxrename to packages/emails/src/templates/DailyVideoDownloadRecordingEmail.tsxindex c21d0dfb283..5b176c8b13e 100644--- a/packages/emails/src/templates/AttendeeDailyVideoDownloadRecordingEmail.tsx+++ b/packages/emails/src/templates/DailyVideoDownloadRecordingEmail.tsx@@ -4,7 +4,7 @@ import { WEBAPP_URL, APP_NAME, COMPANY_NAME } from "@calcom/lib/constants";import { V2BaseEmailHtml, CallToAction } from "../components";-interface AttendeeDailyVideoDownloadRecordingEmailProps {+interface DailyVideoDownloadRecordingEmailProps {language: TFunction;downloadLink: string;title: string;@@ -12,8 +12,8 @@ interface AttendeeDailyVideoDownloadRecordingEmailProps {name: string;}-export const AttendeeDailyVideoDownloadRecordingEmail = (- props: AttendeeDailyVideoDownloadRecordingEmailProps & Partial<React.ComponentProps<typeof V2BaseEmailHtml>>+export const DailyVideoDownloadRecordingEmail = (+ props: DailyVideoDownloadRecordingEmailProps & Partial<React.ComponentProps<typeof V2BaseEmailHtml>>) => {const image = WEBAPP_URL + "/emails/logo.png";return (diff --git a/packages/emails/src/templates/index.ts b/packages/emails/src/templates/index.tsindex 880a2d2a980..eb44d10278c 100644--- a/packages/emails/src/templates/index.ts+++ b/packages/emails/src/templates/index.ts@@ -25,6 +25,6 @@ export { OrganizerAttendeeCancelledSeatEmail } from "./OrganizerAttendeeCancelleexport { NoShowFeeChargedEmail } from "./NoShowFeeChargedEmail";export { VerifyAccountEmail } from "./VerifyAccountEmail";export * from "@calcom/app-store/routing-forms/emails/components";-export { AttendeeDailyVideoDownloadRecordingEmail } from "./AttendeeDailyVideoDownloadRecordingEmail";+export { DailyVideoDownloadRecordingEmail } from "./DailyVideoDownloadRecordingEmail";export { OrganisationAccountVerifyEmail } from "./OrganizationAccountVerifyEmail";export { OrgAutoInviteEmail } from "./OrgAutoInviteEmail";diff --git a/packages/emails/templates/attendee-daily-video-download-recording-email.ts b/packages/emails/templates/attendee-daily-video-download-recording-email.tsindex e878f0b7057..4a7d679a53c 100644--- a/packages/emails/templates/attendee-daily-video-download-recording-email.ts+++ b/packages/emails/templates/attendee-daily-video-download-recording-email.ts@@ -29,7 +29,7 @@ export default class AttendeeDailyVideoDownloadRecordingEmail extends BaseEmailtitle: this.calEvent.title,date: this.getFormattedDate(),})}`,- html: renderEmail("AttendeeDailyVideoDownloadRecordingEmail", {+ html: renderEmail("DailyVideoDownloadRecordingEmail", {title: this.calEvent.title,date: this.getFormattedDate(),downloadLink: this.downloadLink,diff --git a/packages/emails/templates/organizer-daily-video-download-recording-email.ts b/packages/emails/templates/organizer-daily-video-download-recording-email.tsnew file mode 100644index 00000000000..923a1f9251e--- /dev/null+++ b/packages/emails/templates/organizer-daily-video-download-recording-email.ts@@ -0,0 +1,57 @@+import type { TFunction } from "next-i18next";++import { APP_NAME } from "@calcom/lib/constants";+import type { CalendarEvent } from "@calcom/types/Calendar";++import { renderEmail } from "../";+import BaseEmail from "./_base-email";++export default class OrganizerDailyVideoDownloadRecordingEmail extends BaseEmail {+ calEvent: CalendarEvent;+ downloadLink: string;+ t: TFunction;++ constructor(calEvent: CalendarEvent, downloadLink: string) {+ super();+ this.name = "SEND_RECORDING_DOWNLOAD_LINK";+ this.calEvent = calEvent;+ this.downloadLink = downloadLink;+ this.t = this.calEvent.organizer.language.translate;+ }+ protected getNodeMailerPayload(): Record<string, unknown> {+ return {+ to: `${this.calEvent.organizer.email}>`,+ from: `${APP_NAME} <${this.getMailerOptions().from}>`,+ replyTo: [...this.calEvent.attendees.map(({ email }) => email), this.calEvent.organizer.email],+ subject: `${this.t("download_recording_subject", {+ title: this.calEvent.title,+ date: this.getFormattedDate(),+ })}`,+ html: renderEmail("DailyVideoDownloadRecordingEmail", {+ title: this.calEvent.title,+ date: this.getFormattedDate(),+ downloadLink: this.downloadLink,+ language: this.t,+ name: this.calEvent.organizer.name,+ }),+ };+ }++ protected getTimezone(): string {+ return this.calEvent.organizer.timeZone;+ }++ protected getOrganizerStart(format: string) {+ return this.getRecipientTime(this.calEvent.startTime, format);+ }++ protected getOrganizerEnd(format: string) {+ return this.getRecipientTime(this.calEvent.endTime, format);+ }++ protected getFormattedDate() {+ return `${this.getOrganizerStart("h:mma")} - ${this.getOrganizerEnd("h:mma")}, ${this.t(+ this.getOrganizerStart("dddd").toLowerCase()+ )}, ${this.t(this.getOrganizerStart("MMMM").toLowerCase())} ${this.getOrganizerStart("D, YYYY")}`;+ }+}