feat: added organizer daily video recording email (#9667)
Co-authored-by: Shivam Kalra <shivamkalra98@gmail.com>10070-meeting-booking-link-long-event-description-text-wrapping-is-odd
parent
9391bb5b64
commit
9c7428571d
|
@ -31,6 +31,7 @@ import type { OrganizationEmailVerify } from "./templates/organization-email-ver
|
|||
import 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: CalendarE
|
|||
export 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))
|
||||
|
|
|
@ -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 (
|
|
@ -25,6 +25,6 @@ export { OrganizerAttendeeCancelledSeatEmail } from "./OrganizerAttendeeCancelle
|
|||
export { 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";
|
||||
|
|
|
@ -29,7 +29,7 @@ export default class AttendeeDailyVideoDownloadRecordingEmail extends BaseEmail
|
|||
title: this.calEvent.title,
|
||||
date: this.getFormattedDate(),
|
||||
})}`,
|
||||
html: renderEmail("AttendeeDailyVideoDownloadRecordingEmail", {
|
||||
html: renderEmail("DailyVideoDownloadRecordingEmail", {
|
||||
title: this.calEvent.title,
|
||||
date: this.getFormattedDate(),
|
||||
downloadLink: this.downloadLink,
|
||||
|
|
|
@ -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")}`;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue