2023-01-04 22:14:46 +00:00
|
|
|
import { APP_NAME } from "@calcom/lib/constants";
|
|
|
|
|
2022-06-06 17:49:56 +00:00
|
|
|
import { renderEmail } from "../";
|
|
|
|
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
|
|
|
|
|
|
|
export default class AttendeeRequestEmail extends AttendeeScheduledEmail {
|
|
|
|
protected getNodeMailerPayload(): Record<string, unknown> {
|
|
|
|
const toAddresses = [this.calEvent.attendees[0].email];
|
|
|
|
if (this.calEvent.team) {
|
|
|
|
this.calEvent.team.members.forEach((member) => {
|
|
|
|
const memberAttendee = this.calEvent.attendees.find((attendee) => attendee.name === member);
|
|
|
|
if (memberAttendee) {
|
|
|
|
toAddresses.push(memberAttendee.email);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
2023-01-04 22:14:46 +00:00
|
|
|
from: `${APP_NAME} <${this.getMailerOptions().from}>`,
|
2022-06-06 17:49:56 +00:00
|
|
|
to: toAddresses.join(","),
|
2022-11-15 13:55:02 +00:00
|
|
|
subject: `${this.calEvent.attendees[0].language.translate("booking_submitted_subject", {
|
2023-01-10 18:32:50 +00:00
|
|
|
title: this.calEvent.title,
|
2022-06-06 17:49:56 +00:00
|
|
|
date: this.getFormattedDate(),
|
|
|
|
})}`,
|
|
|
|
html: renderEmail("AttendeeRequestEmail", {
|
|
|
|
calEvent: this.calEvent,
|
|
|
|
attendee: this.attendee,
|
|
|
|
}),
|
|
|
|
text: this.getTextBody(
|
|
|
|
this.calEvent.attendees[0].language.translate("booking_submitted", {
|
|
|
|
name: this.calEvent.attendees[0].name,
|
|
|
|
}),
|
|
|
|
this.calEvent.attendees[0].language.translate("user_needs_to_confirm_or_reject_booking", {
|
|
|
|
user: this.calEvent.organizer.name,
|
|
|
|
})
|
|
|
|
),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|