import dayjs, { Dayjs } from "dayjs"; import localizedFormat from "dayjs/plugin/localizedFormat"; import timezone from "dayjs/plugin/timezone"; import utc from "dayjs/plugin/utc"; import EventMail from "./EventMail"; dayjs.extend(utc); dayjs.extend(timezone); dayjs.extend(localizedFormat); export default class EventRejectionMail extends EventMail { /** * Returns the email text as HTML representation. * * @protected */ protected getHtmlRepresentation(): string { return ( `

${this.calEvent.language("meeting_request_rejected")}

${this.calEvent.language("emailed_you_and_attendees")}


` + `
Cal.com Logo
` ); } /** * Returns the payload object for the nodemailer. * * @protected */ protected getNodeMailerPayload(): Record { return { to: `${this.calEvent.attendees[0].name} <${this.calEvent.attendees[0].email}>`, from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`, replyTo: this.calEvent.organizer.email, subject: this.calEvent.language("rejected_event_type_with_organizer", { eventType: this.calEvent.type, organizer: this.calEvent.organizer.name, date: this.getInviteeStart().format("dddd, LL"), }), html: this.getHtmlRepresentation(), text: this.getPlainTextRepresentation(), }; } protected printNodeMailerError(error: Error): void { console.error("SEND_BOOKING_CONFIRMATION_ERROR", this.calEvent.attendees[0].email, error); } /** * Returns the inviteeStart value used at multiple points. * * @protected */ protected getInviteeStart(): Dayjs { return dayjs(this.calEvent.startTime).tz(this.calEvent.attendees[0].timeZone); } /** * Adds the video call information to the mail body. * * @protected */ protected getLocation(): string { return ""; } }