2021-11-26 11:03:43 +00:00
|
|
|
import dayjs from "dayjs";
|
|
|
|
import localizedFormat from "dayjs/plugin/localizedFormat";
|
|
|
|
import timezone from "dayjs/plugin/timezone";
|
|
|
|
import toArray from "dayjs/plugin/toArray";
|
|
|
|
import utc from "dayjs/plugin/utc";
|
|
|
|
|
2022-03-23 22:00:30 +00:00
|
|
|
import { getCancelLink } from "@calcom/lib/CalEventParser";
|
2021-11-26 11:03:43 +00:00
|
|
|
|
|
|
|
import AttendeeScheduledEmail from "./attendee-scheduled-email";
|
2021-12-01 10:32:08 +00:00
|
|
|
import {
|
|
|
|
emailHead,
|
|
|
|
emailSchedulingBodyHeader,
|
|
|
|
emailBodyLogo,
|
|
|
|
emailScheduledBodyHeaderContent,
|
|
|
|
emailSchedulingBodyDivider,
|
|
|
|
} from "./common";
|
2021-11-26 11:03:43 +00:00
|
|
|
|
|
|
|
dayjs.extend(utc);
|
|
|
|
dayjs.extend(timezone);
|
|
|
|
dayjs.extend(localizedFormat);
|
|
|
|
dayjs.extend(toArray);
|
|
|
|
|
|
|
|
export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail {
|
|
|
|
protected getNodeMailerPayload(): Record<string, unknown> {
|
|
|
|
return {
|
|
|
|
icalEvent: {
|
|
|
|
filename: "event.ics",
|
|
|
|
content: this.getiCalEventAsString(),
|
|
|
|
},
|
|
|
|
to: `${this.attendee.name} <${this.attendee.email}>`,
|
|
|
|
from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,
|
|
|
|
replyTo: this.calEvent.organizer.email,
|
2022-02-03 12:29:41 +00:00
|
|
|
subject: `${this.attendee.language.translate("rescheduled_event_type_subject", {
|
2021-11-26 11:03:43 +00:00
|
|
|
eventType: this.calEvent.type,
|
|
|
|
name: this.calEvent.team?.name || this.calEvent.organizer.name,
|
|
|
|
date: `${this.getInviteeStart().format("h:mma")} - ${this.getInviteeEnd().format(
|
|
|
|
"h:mma"
|
2022-02-03 12:29:41 +00:00
|
|
|
)}, ${this.attendee.language.translate(
|
2021-11-26 11:03:43 +00:00
|
|
|
this.getInviteeStart().format("dddd").toLowerCase()
|
2022-02-03 12:29:41 +00:00
|
|
|
)}, ${this.attendee.language.translate(
|
2021-11-26 11:03:43 +00:00
|
|
|
this.getInviteeStart().format("MMMM").toLowerCase()
|
|
|
|
)} ${this.getInviteeStart().format("D")}, ${this.getInviteeStart().format("YYYY")}`,
|
|
|
|
})}`,
|
|
|
|
html: this.getHtmlBody(),
|
|
|
|
text: this.getTextBody(),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
protected getTextBody(): string {
|
|
|
|
// Only the original attendee can make changes to the event
|
|
|
|
// Guests cannot
|
|
|
|
if (this.attendee === this.calEvent.attendees[0]) {
|
|
|
|
return `
|
2022-02-03 12:29:41 +00:00
|
|
|
${this.attendee.language.translate("event_has_been_rescheduled")}
|
|
|
|
${this.attendee.language.translate("emailed_you_and_any_other_attendees")}
|
2021-11-26 11:03:43 +00:00
|
|
|
${this.getWhat()}
|
|
|
|
${this.getWhen()}
|
|
|
|
${this.getLocation()}
|
|
|
|
${this.getAdditionalNotes()}
|
2022-02-03 12:29:41 +00:00
|
|
|
${this.attendee.language.translate("need_to_reschedule_or_cancel")}
|
2021-11-26 11:03:43 +00:00
|
|
|
${getCancelLink(this.calEvent)}
|
|
|
|
`.replace(/(<([^>]+)>)/gi, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
return `
|
2022-02-03 12:29:41 +00:00
|
|
|
${this.attendee.language.translate("event_has_been_rescheduled")}
|
|
|
|
${this.attendee.language.translate("emailed_you_and_any_other_attendees")}
|
2021-11-26 11:03:43 +00:00
|
|
|
${this.getWhat()}
|
|
|
|
${this.getWhen()}
|
|
|
|
${this.getLocation()}
|
|
|
|
${this.getAdditionalNotes()}
|
|
|
|
`.replace(/(<([^>]+)>)/gi, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
protected getHtmlBody(): string {
|
2022-02-03 12:29:41 +00:00
|
|
|
const headerContent = this.attendee.language.translate("rescheduled_event_type_subject", {
|
2021-11-26 11:03:43 +00:00
|
|
|
eventType: this.calEvent.type,
|
|
|
|
name: this.calEvent.team?.name || this.calEvent.organizer.name,
|
|
|
|
date: `${this.getInviteeStart().format("h:mma")} - ${this.getInviteeEnd().format(
|
|
|
|
"h:mma"
|
2022-02-03 12:29:41 +00:00
|
|
|
)}, ${this.attendee.language.translate(
|
2021-11-26 11:03:43 +00:00
|
|
|
this.getInviteeStart().format("dddd").toLowerCase()
|
2022-02-03 12:29:41 +00:00
|
|
|
)}, ${this.attendee.language.translate(
|
2021-11-26 11:03:43 +00:00
|
|
|
this.getInviteeStart().format("MMMM").toLowerCase()
|
|
|
|
)} ${this.getInviteeStart().format("D")}, ${this.getInviteeStart().format("YYYY")}`,
|
|
|
|
});
|
|
|
|
|
|
|
|
return `
|
|
|
|
<!doctype html>
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
|
|
|
${emailHead(headerContent)}
|
|
|
|
<body style="word-spacing:normal;background-color:#F5F5F5;">
|
|
|
|
<div style="background-color:#F5F5F5;">
|
|
|
|
${emailSchedulingBodyHeader("calendarCircle")}
|
2021-12-01 10:32:08 +00:00
|
|
|
${emailScheduledBodyHeaderContent(
|
2022-02-03 12:29:41 +00:00
|
|
|
this.attendee.language.translate("event_has_been_rescheduled"),
|
|
|
|
this.attendee.language.translate("emailed_you_and_any_other_attendees")
|
2021-12-01 10:32:08 +00:00
|
|
|
)}
|
|
|
|
${emailSchedulingBodyDivider()}
|
2021-11-26 11:03:43 +00:00
|
|
|
<!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" bgcolor="#FFFFFF" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
|
|
|
|
<div style="background:#FFFFFF;background-color:#FFFFFF;margin:0px auto;max-width:600px;">
|
|
|
|
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#FFFFFF;background-color:#FFFFFF;width:100%;">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td style="border-left:1px solid #E1E1E1;border-right:1px solid #E1E1E1;direction:ltr;font-size:0px;padding:0px;text-align:center;">
|
|
|
|
<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:598px;" ><![endif]-->
|
|
|
|
<div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
|
|
|
|
<div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:1;text-align:left;color:#3E3E3E;">
|
|
|
|
${this.getWhat()}
|
|
|
|
${this.getWhen()}
|
|
|
|
${this.getWho()}
|
|
|
|
${this.getLocation()}
|
|
|
|
${this.getAdditionalNotes()}
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<!--[if mso | IE]></td></tr></table><![endif]-->
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2021-12-01 10:32:08 +00:00
|
|
|
${emailSchedulingBodyDivider()}
|
2021-11-26 11:03:43 +00:00
|
|
|
<!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" bgcolor="#FFFFFF" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
|
|
|
|
<div style="background:#FFFFFF;background-color:#FFFFFF;margin:0px auto;max-width:600px;">
|
|
|
|
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="background:#FFFFFF;background-color:#FFFFFF;width:100%;">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td style="border-bottom:1px solid #E1E1E1;border-left:1px solid #E1E1E1;border-right:1px solid #E1E1E1;direction:ltr;font-size:0px;padding:0px;text-align:center;">
|
|
|
|
<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:598px;" ><![endif]-->
|
|
|
|
<div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
|
|
|
|
<div style="font-family:Roboto, Helvetica, sans-serif;font-size:16px;font-weight:500;line-height:0px;text-align:left;color:#3E3E3E;">
|
|
|
|
${this.getManageLink()}
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<!--[if mso | IE]></td></tr></table><![endif]-->
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2021-12-01 10:32:08 +00:00
|
|
|
${emailBodyLogo()}
|
2021-11-26 11:03:43 +00:00
|
|
|
<!--[if mso | IE]></td></tr></table><![endif]-->
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
}
|