import dayjs, { Dayjs } from "dayjs"; import EventOrganizerMail from "./EventOrganizerMail"; export default class EventOrganizerRescheduledMail extends EventOrganizerMail { /** * Returns the email text as HTML representation. * * @protected */ protected getHtmlRepresentation(): string { return ( `
Hi ${this.calEvent.organizer.name},

Your event has been rescheduled.

Event Type:
${this.calEvent.type}

Invitee Email:
${this.calEvent.attendees[0].email}

` + this.getAdditionalBody() + (this.calEvent.location ? ` Location:
${this.calEvent.location}

` : "") + `Invitee Time Zone:
${this.calEvent.attendees[0].timeZone}

Additional notes:
${this.calEvent.description} ` + this.getAdditionalFooter() + `
` ); } /** * Returns the payload object for the nodemailer. * * @protected */ protected getNodeMailerPayload(): Record { const organizerStart: Dayjs = dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone); return { icalEvent: { filename: "event.ics", content: this.getiCalEventAsString(), }, from: `Cal.com <${this.getMailerOptions().from}>`, to: this.calEvent.organizer.email, subject: `Rescheduled event: ${this.calEvent.attendees[0].name} - ${organizerStart.format( "LT dddd, LL" )} - ${this.calEvent.type}`, html: this.getHtmlRepresentation(), text: this.getPlainTextRepresentation(), }; } protected printNodeMailerError(error: string): void { console.error("SEND_RESCHEDULE_EVENT_NOTIFICATION_ERROR", this.calEvent.organizer.email, error); } }