chore: [app-router-migration-1] migrate the pages in settings/admin to the app directory (#12561)

Co-authored-by: Dmytro Hryshyn <[email protected]>
Co-authored-by: DmytroHryshyn <[email protected]>
Co-authored-by: zomars <[email protected]>
This commit is contained in:
authored and GitHub committed 2023-12-01 13:07:26 -07:00
1 parent d13dedda9a
commit ca78be011c
83 files changed
+1193 -165

No files matched your search

+2 -3
View File
@@ -1,12 +1,11 @@
import * as ReactDOMServer from "react-dom/server";
import * as templates from "./templates";
function renderEmail<K extends keyof typeof templates>(
async function renderEmail<K extends keyof typeof templates>(
template: K,
props: React.ComponentProps<(typeof templates)[K]>
) {
const Component = templates[template];
const ReactDOMServer = (await import("react-dom/server")).default;
return (
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
+3 -6
View File
@@ -24,7 +24,7 @@ export default class BaseEmail {
return dayjs(time).tz(this.getTimezone()).locale(this.getLocale()).format(format);
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {};
}
public async sendEmail() {
@@ -38,21 +38,20 @@ export default class BaseEmail {
if (process.env.INTEGRATION_TEST_MODE === "true") {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-expect-error
setTestEmail(this.getNodeMailerPayload());
setTestEmail(await this.getNodeMailerPayload());
console.log(
"Skipped Sending Email as process.env.NEXT_PUBLIC_UNIT_TESTS is set. Emails are available in globalThis.testEmails"
);
return new Promise((r) => r("Skipped sendEmail for Unit Tests"));
}
const payload = this.getNodeMailerPayload();
const payload = await this.getNodeMailerPayload();
const parseSubject = z.string().safeParse(payload?.subject);
const payloadWithUnEscapedSubject = {
headers: this.getMailerOptions().headers,
...payload,
...(parseSubject.success && { subject: decodeHTML(parseSubject.data) }),
};
await new Promise((resolve, reject) =>
createTransport(this.getMailerOptions().transport).sendMail(
payloadWithUnEscapedSubject,
@@ -69,7 +68,6 @@ export default class BaseEmail {
).catch((e) => console.error("sendEmail", e));
return new Promise((resolve) => resolve("send mail async"));
}
protected getMailerOptions() {
return {
transport: serverConfig.transport,
@@ -77,7 +75,6 @@ export default class BaseEmail {
headers: serverConfig.headers,
};
}
protected printNodeMailerError(error: Error): void {
/** Don't clog the logs with unsent emails in E2E */
if (process.env.NEXT_PUBLIC_IS_E2E) return;
@@ -23,14 +23,14 @@ export default class AccountVerifyEmail extends BaseEmail {
this.verifyAccountInput = passwordEvent;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.verifyAccountInput.user.name} <${this.verifyAccountInput.user.email}>`,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
subject: this.verifyAccountInput.language("verify_email_subject", {
appName: APP_NAME,
}),
html: renderEmail("VerifyAccountEmail", this.verifyAccountInput),
html: await renderEmail("VerifyAccountEmail", this.verifyAccountInput),
text: this.getTextBody(),
};
}
@@ -22,12 +22,12 @@ export default class AdminOrganizationNotification extends BaseEmail {
this.input = input;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
to: this.input.instanceAdmins.map((admin) => admin.email).join(","),
subject: `${this.input.t("admin_org_notification_email_subject")}`,
html: renderEmail("AdminOrganizationNotificationEmail", {
html: await renderEmail("AdminOrganizationNotificationEmail", {
orgSlug: this.input.orgSlug,
webappIPAddress: this.input.webappIPAddress,
language: this.input.t,
@@ -2,7 +2,7 @@ import { renderEmail } from "../";
import AttendeeScheduledEmail from "./attendee-scheduled-email";
export default class AttendeeAwaitingPaymentEmail extends AttendeeScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.attendee.name} <${this.attendee.email}>`,
from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,
@@ -11,7 +11,7 @@ export default class AttendeeAwaitingPaymentEmail extends AttendeeScheduledEmail
title: this.calEvent.title,
date: this.getFormattedDate(),
})}`,
html: renderEmail("AttendeeAwaitingPaymentEmail", {
html: await renderEmail("AttendeeAwaitingPaymentEmail", {
calEvent: this.calEvent,
attendee: this.attendee,
}),
@@ -2,7 +2,7 @@ import { renderEmail } from "../";
import AttendeeScheduledEmail from "./attendee-scheduled-email";
export default class AttendeeCancelledEmail extends AttendeeScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.attendee.name} <${this.attendee.email}>`,
from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,
@@ -11,7 +11,7 @@ export default class AttendeeCancelledEmail extends AttendeeScheduledEmail {
title: this.calEvent.title,
date: this.getFormattedDate(),
})}`,
html: renderEmail("AttendeeCancelledEmail", {
html: await renderEmail("AttendeeCancelledEmail", {
calEvent: this.calEvent,
attendee: this.attendee,
}),
@@ -2,7 +2,7 @@ import { renderEmail } from "../";
import AttendeeScheduledEmail from "./attendee-scheduled-email";
export default class AttendeeCancelledSeatEmail extends AttendeeScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.attendee.name} <${this.attendee.email}>`,
from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,
@@ -11,7 +11,7 @@ export default class AttendeeCancelledSeatEmail extends AttendeeScheduledEmail {
title: this.calEvent.title,
date: this.getFormattedDate(),
})}`,
html: renderEmail("AttendeeCancelledSeatEmail", {
html: await renderEmail("AttendeeCancelledSeatEmail", {
calEvent: this.calEvent,
attendee: this.attendee,
}),
@@ -21,7 +21,7 @@ export default class AttendeeDailyVideoDownloadRecordingEmail extends BaseEmail
this.downloadLink = downloadLink;
this.t = attendee.language.translate;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.attendee.name} <${this.attendee.email}>`,
from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,
@@ -30,7 +30,7 @@ export default class AttendeeDailyVideoDownloadRecordingEmail extends BaseEmail
title: this.calEvent.title,
date: this.getFormattedDate(),
})}`,
html: renderEmail("DailyVideoDownloadRecordingEmail", {
html: await renderEmail("DailyVideoDownloadRecordingEmail", {
title: this.calEvent.title,
date: this.getFormattedDate(),
downloadLink: this.downloadLink,
@@ -2,7 +2,7 @@ import { renderEmail } from "../";
import AttendeeScheduledEmail from "./attendee-scheduled-email";
export default class AttendeeDeclinedEmail extends AttendeeScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.attendee.name} <${this.attendee.email}>`,
from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,
@@ -11,7 +11,7 @@ export default class AttendeeDeclinedEmail extends AttendeeScheduledEmail {
title: this.calEvent.title,
date: this.getFormattedDate(),
})}`,
html: renderEmail("AttendeeDeclinedEmail", {
html: await renderEmail("AttendeeDeclinedEmail", {
calEvent: this.calEvent,
attendee: this.attendee,
}),
@@ -2,7 +2,7 @@ import { renderEmail } from "../";
import AttendeeScheduledEmail from "./attendee-scheduled-email";
export default class AttendeeLocationChangeEmail extends AttendeeScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
icalEvent: {
filename: "event.ics",
@@ -16,7 +16,7 @@ export default class AttendeeLocationChangeEmail extends AttendeeScheduledEmail
name: this.calEvent.team?.name || this.calEvent.organizer.name,
date: this.getFormattedDate(),
})}`,
html: renderEmail("AttendeeLocationChangeEmail", {
html: await renderEmail("AttendeeLocationChangeEmail", {
calEvent: this.calEvent,
attendee: this.attendee,
}),
@@ -4,7 +4,7 @@ import { renderEmail } from "../";
import AttendeeScheduledEmail from "./attendee-scheduled-email";
export default class AttendeeRequestEmail extends AttendeeScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const toAddresses = this.calEvent.attendees.map((attendee) => attendee.email);
return {
@@ -15,7 +15,7 @@ export default class AttendeeRequestEmail extends AttendeeScheduledEmail {
title: this.calEvent.title,
date: this.getFormattedDate(),
})}`,
html: renderEmail("AttendeeRequestEmail", {
html: await renderEmail("AttendeeRequestEmail", {
calEvent: this.calEvent,
attendee: this.attendee,
}),
@@ -2,7 +2,7 @@ import { renderEmail } from "../";
import AttendeeScheduledEmail from "./attendee-scheduled-email";
export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
icalEvent: {
filename: "event.ics",
@@ -15,7 +15,7 @@ export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail {
title: this.calEvent.title,
date: this.getFormattedDate(),
})}`,
html: renderEmail("AttendeeRescheduledEmail", {
html: await renderEmail("AttendeeRescheduledEmail", {
calEvent: this.calEvent,
attendee: this.attendee,
}),
@@ -82,7 +82,7 @@ export default class AttendeeScheduledEmail extends BaseEmail {
return icsEvent.value;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const clonedCalEvent = cloneDeep(this.calEvent);
this.getiCalEventAsString();
@@ -97,7 +97,7 @@ export default class AttendeeScheduledEmail extends BaseEmail {
from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,
replyTo: [...this.calEvent.attendees.map(({ email }) => email), this.calEvent.organizer.email],
subject: `${this.calEvent.title}`,
html: renderEmail("AttendeeScheduledEmail", {
html: await renderEmail("AttendeeScheduledEmail", {
calEvent: clonedCalEvent,
attendee: this.attendee,
}),
@@ -23,14 +23,14 @@ export default class AttendeeVerifyEmail extends BaseEmail {
this.verifyAccountInput = passwordEvent;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.verifyAccountInput.user.name} <${this.verifyAccountInput.user.email}>`,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
subject: this.verifyAccountInput.language("verify_email_subject", {
appName: APP_NAME,
}),
html: renderEmail("VerifyEmailByCode", this.verifyAccountInput),
html: await renderEmail("VerifyEmailByCode", this.verifyAccountInput),
text: this.getTextBody(),
};
}
@@ -16,7 +16,7 @@ export default class AttendeeWasRequestedToRescheduleEmail extends OrganizerSche
this.metadata = metadata;
this.t = this.calEvent.attendees[0].language.translate;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const toAddresses = [this.calEvent.attendees[0].email];
return {
@@ -30,7 +30,7 @@ export default class AttendeeWasRequestedToRescheduleEmail extends OrganizerSche
eventType: this.calEvent.type,
name: this.calEvent.attendees[0].name,
})}`,
html: renderEmail("AttendeeWasRequestedToRescheduleEmail", {
html: await renderEmail("AttendeeWasRequestedToRescheduleEmail", {
calEvent: this.calEvent,
attendee: this.calEvent.attendees[0],
metadata: this.metadata,
@@ -21,7 +21,7 @@ export default class BrokenIntegrationEmail extends BaseEmail {
this.type = type;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const toAddresses = [this.calEvent.organizer.email];
return {
@@ -32,7 +32,7 @@ export default class BrokenIntegrationEmail extends BaseEmail {
name: this.calEvent.attendees[0].name,
date: this.getFormattedDate(),
})}`,
html: renderEmail("BrokenIntegrationEmail", {
html: await renderEmail("BrokenIntegrationEmail", {
calEvent: this.calEvent,
attendee: this.calEvent.organizer,
type: this.type,
@@ -1,4 +1,4 @@
import { TFunction } from "next-i18next";
import type { TFunction } from "next-i18next";
import { renderEmail } from "..";
import BaseEmail from "./_base-email";
@@ -28,7 +28,7 @@ export default class DisabledAppEmail extends BaseEmail {
this.eventTypeId = eventTypeId;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
from: `Cal.com <${this.getMailerOptions().from}>`,
to: this.email,
@@ -36,7 +36,7 @@ export default class DisabledAppEmail extends BaseEmail {
this.title && this.eventTypeId
? this.t("disabled_app_affects_event_type", { appName: this.appName, eventType: this.title })
: this.t("admin_has_disabled", { appName: this.appName }),
html: renderEmail("DisabledAppEmail", {
html: await renderEmail("DisabledAppEmail", {
title: this.title,
appName: this.appName,
eventTypeId: this.eventTypeId,
+2 -2
View File
@@ -18,12 +18,12 @@ export default class FeedbackEmail extends BaseEmail {
this.feedback = feedback;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
to: process.env.SEND_FEEDBACK_EMAIL,
subject: `User Feedback`,
html: renderEmail("FeedbackEmail", this.feedback),
html: await renderEmail("FeedbackEmail", this.feedback),
text: this.getTextBody(),
};
}
@@ -23,14 +23,14 @@ export default class ForgotPasswordEmail extends BaseEmail {
this.passwordEvent = passwordEvent;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.passwordEvent.user.name} <${this.passwordEvent.user.email}>`,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
subject: this.passwordEvent.language("reset_password_subject", {
appName: APP_NAME,
}),
html: renderEmail("ForgotPasswordEmail", this.passwordEvent),
html: await renderEmail("ForgotPasswordEmail", this.passwordEvent),
text: this.getTextBody(),
};
}
@@ -12,12 +12,12 @@ export default class MonthlyDigestEmail extends BaseEmail {
this.eventData = eventData;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
to: this.eventData.admin.email,
subject: `${APP_NAME}: Your monthly digest`,
html: renderEmail("MonthlyDigestEmail", this.eventData),
html: await renderEmail("MonthlyDigestEmail", this.eventData),
text: "",
};
}
@@ -2,7 +2,7 @@ import { renderEmail } from "../";
import AttendeeScheduledEmail from "./attendee-scheduled-email";
export default class NoShowFeeChargedEmail extends AttendeeScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
if (!this.calEvent.paymentInfo?.amount) throw new Error("No payment into");
return {
to: `${this.attendee.name} <${this.attendee.email}>`,
@@ -14,7 +14,7 @@ export default class NoShowFeeChargedEmail extends AttendeeScheduledEmail {
amount: this.calEvent.paymentInfo.amount / 100,
formatParams: { amount: { currency: this.calEvent.paymentInfo?.currency } },
})}`,
html: renderEmail("NoShowFeeChargedEmail", {
html: await renderEmail("NoShowFeeChargedEmail", {
calEvent: this.calEvent,
attendee: this.attendee,
}),
@@ -22,7 +22,7 @@ export default class OrgAutoJoinEmail extends BaseEmail {
this.orgAutoInviteEvent = orgAutoInviteEvent;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: this.orgAutoInviteEvent.to,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
@@ -32,7 +32,7 @@ export default class OrgAutoJoinEmail extends BaseEmail {
appName: APP_NAME,
entity: this.orgAutoInviteEvent.language("organization").toLowerCase(),
}),
html: renderEmail("OrgAutoInviteEmail", this.orgAutoInviteEvent),
html: await renderEmail("OrgAutoInviteEmail", this.orgAutoInviteEvent),
text: "",
};
}
@@ -22,12 +22,12 @@ export default class OrganizationEmailVerification extends BaseEmail {
this.orgVerifyInput = orgVerifyInput;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
to: this.orgVerifyInput.user.email,
subject: this.orgVerifyInput.language("verify_email_organization"),
html: renderEmail("OrganisationAccountVerifyEmail", this.orgVerifyInput),
html: await renderEmail("OrganisationAccountVerifyEmail", this.orgVerifyInput),
text: this.getTextBody(),
};
}
@@ -4,7 +4,7 @@ import { renderEmail } from "../";
import OrganizerScheduledEmail from "./organizer-scheduled-email";
export default class OrganizerCancelledEmail extends OrganizerScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const toAddresses = [this.calEvent.organizer.email];
if (this.calEvent.team) {
this.calEvent.team.members.forEach((member) => {
@@ -22,7 +22,7 @@ export default class OrganizerCancelledEmail extends OrganizerScheduledEmail {
title: this.calEvent.title,
date: this.getFormattedDate(),
})}`,
html: renderEmail("OrganizerAttendeeCancelledSeatEmail", {
html: await renderEmail("OrganizerAttendeeCancelledSeatEmail", {
attendee: this.calEvent.organizer,
calEvent: this.calEvent,
}),
@@ -4,7 +4,7 @@ import { renderEmail } from "../";
import OrganizerScheduledEmail from "./organizer-scheduled-email";
export default class OrganizerCancelledEmail extends OrganizerScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const toAddresses = [this.teamMember?.email || this.calEvent.organizer.email];
return {
@@ -14,7 +14,7 @@ export default class OrganizerCancelledEmail extends OrganizerScheduledEmail {
title: this.calEvent.title,
date: this.getFormattedDate(),
})}`,
html: renderEmail("OrganizerCancelledEmail", {
html: await renderEmail("OrganizerCancelledEmail", {
attendee: this.calEvent.organizer,
calEvent: this.calEvent,
}),
@@ -19,7 +19,7 @@ export default class OrganizerDailyVideoDownloadRecordingEmail extends BaseEmail
this.downloadLink = downloadLink;
this.t = this.calEvent.organizer.language.translate;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: `${this.calEvent.organizer.email}>`,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
@@ -28,7 +28,7 @@ export default class OrganizerDailyVideoDownloadRecordingEmail extends BaseEmail
title: this.calEvent.title,
date: this.getFormattedDate(),
})}`,
html: renderEmail("DailyVideoDownloadRecordingEmail", {
html: await renderEmail("DailyVideoDownloadRecordingEmail", {
title: this.calEvent.title,
date: this.getFormattedDate(),
downloadLink: this.downloadLink,
@@ -4,7 +4,7 @@ import { renderEmail } from "../";
import OrganizerScheduledEmail from "./organizer-scheduled-email";
export default class OrganizerLocationChangeEmail extends OrganizerScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const toAddresses = [this.teamMember?.email || this.calEvent.organizer.email];
return {
@@ -20,7 +20,7 @@ export default class OrganizerLocationChangeEmail extends OrganizerScheduledEmai
name: this.calEvent.attendees[0].name,
date: this.getFormattedDate(),
})}`,
html: renderEmail("OrganizerLocationChangeEmail", {
html: await renderEmail("OrganizerLocationChangeEmail", {
attendee: this.calEvent.organizer,
calEvent: this.calEvent,
}),
@@ -4,7 +4,7 @@ import { renderEmail } from "../";
import OrganizerScheduledEmail from "./organizer-scheduled-email";
export default class OrganizerPaymentRefundFailedEmail extends OrganizerScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const toAddresses = [this.teamMember?.email || this.calEvent.organizer.email];
return {
@@ -15,7 +15,7 @@ export default class OrganizerPaymentRefundFailedEmail extends OrganizerSchedule
name: this.calEvent.attendees[0].name,
date: this.getFormattedDate(),
})}`,
html: renderEmail("OrganizerPaymentRefundFailedEmail", {
html: await renderEmail("OrganizerPaymentRefundFailedEmail", {
calEvent: this.calEvent,
attendee: this.calEvent.organizer,
}),
@@ -4,7 +4,7 @@ import { renderEmail } from "../";
import OrganizerScheduledEmail from "./organizer-scheduled-email";
export default class OrganizerRequestEmail extends OrganizerScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const toAddresses = [this.teamMember?.email || this.calEvent.organizer.email];
return {
@@ -12,7 +12,7 @@ export default class OrganizerRequestEmail extends OrganizerScheduledEmail {
to: toAddresses.join(","),
replyTo: [this.calEvent.organizer.email, ...this.calEvent.attendees.map(({ email }) => email)],
subject: `${this.t("awaiting_approval")}: ${this.calEvent.title}`,
html: renderEmail("OrganizerRequestEmail", {
html: await renderEmail("OrganizerRequestEmail", {
calEvent: this.calEvent,
attendee: this.calEvent.organizer,
}),
@@ -4,7 +4,7 @@ import { renderEmail } from "../";
import OrganizerRequestEmail from "./organizer-request-email";
export default class OrganizerRequestReminderEmail extends OrganizerRequestEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const toAddresses = [this.teamMember?.email || this.calEvent.organizer.email];
return {
@@ -15,7 +15,7 @@ export default class OrganizerRequestReminderEmail extends OrganizerRequestEmail
title: this.calEvent.title,
date: this.getFormattedDate(),
})}`,
html: renderEmail("OrganizerRequestReminderEmail", {
html: await renderEmail("OrganizerRequestReminderEmail", {
calEvent: this.calEvent,
attendee: this.calEvent.organizer,
}),
@@ -15,7 +15,7 @@ export default class OrganizerRequestedToRescheduleEmail extends OrganizerSchedu
super({ calEvent });
this.metadata = metadata;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const toAddresses = [this.calEvent.organizer.email];
return {
@@ -30,7 +30,7 @@ export default class OrganizerRequestedToRescheduleEmail extends OrganizerSchedu
name: this.calEvent.attendees[0].name,
date: this.getFormattedDate(),
})}`,
html: renderEmail("OrganizerRequestedToRescheduleEmail", {
html: await renderEmail("OrganizerRequestedToRescheduleEmail", {
calEvent: this.calEvent,
attendee: this.calEvent.organizer,
}),
@@ -4,7 +4,7 @@ import { renderEmail } from "../";
import OrganizerScheduledEmail from "./organizer-scheduled-email";
export default class OrganizerRescheduledEmail extends OrganizerScheduledEmail {
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const toAddresses = [this.teamMember?.email || this.calEvent.organizer.email];
return {
@@ -19,7 +19,7 @@ export default class OrganizerRescheduledEmail extends OrganizerScheduledEmail {
title: this.calEvent.title,
date: this.getFormattedDate(),
})}`,
html: renderEmail("OrganizerRescheduledEmail", {
html: await renderEmail("OrganizerRescheduledEmail", {
calEvent: { ...this.calEvent, attendeeSeatId: undefined },
attendee: this.calEvent.organizer,
}),
@@ -70,7 +70,7 @@ export default class OrganizerScheduledEmail extends BaseEmail {
return icsEvent.value;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const clonedCalEvent = cloneDeep(this.calEvent);
const toAddresses = [this.teamMember?.email || this.calEvent.organizer.email];
@@ -83,7 +83,7 @@ export default class OrganizerScheduledEmail extends BaseEmail {
to: toAddresses.join(","),
replyTo: [this.calEvent.organizer.email, ...this.calEvent.attendees.map(({ email }) => email)],
subject: `${this.newSeat ? `${this.t("new_attendee")}: ` : ""}${this.calEvent.title}`,
html: renderEmail("OrganizerScheduledEmail", {
html: await renderEmail("OrganizerScheduledEmail", {
calEvent: clonedCalEvent,
attendee: this.calEvent.organizer,
teamMember: this.teamMember,
@@ -19,12 +19,12 @@ export default class SlugReplacementEmail extends BaseEmail {
this.t = t;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
from: `Cal.com <${this.getMailerOptions().from}>`,
to: this.email,
subject: this.t("email_subject_slug_replacement", { slug: this.slug }),
html: renderEmail("SlugReplacementEmail", {
html: await renderEmail("SlugReplacementEmail", {
slug: this.slug,
name: this.name,
teamName: this.teamName || "",
@@ -24,7 +24,7 @@ export default class TeamInviteEmail extends BaseEmail {
this.teamInviteEvent = teamInviteEvent;
}
protected getNodeMailerPayload(): Record<string, unknown> {
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
return {
to: this.teamInviteEvent.to,
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
@@ -36,7 +36,7 @@ export default class TeamInviteEmail extends BaseEmail {
.language(this.teamInviteEvent.isOrg ? "organization" : "team")
.toLowerCase(),
}),
html: renderEmail("TeamInviteEmail", this.teamInviteEvent),
html: await renderEmail("TeamInviteEmail", this.teamInviteEvent),
text: "",
};
}