import dayjs from "@calcom/dayjs"; import { APP_NAME } from "@calcom/lib/constants"; import { TimeFormat } from "@calcom/lib/timeFormat"; import { WorkflowActions } from "@calcom/prisma/enums"; const emailRatingTemplate = ({ isEditingMode, locale, action, timeFormat, startTime, endTime, eventName, timeZone, organizer, name, isBrandingDisabled, ratingUrl, noShowUrl, }: { isEditingMode: boolean; locale: string; action: WorkflowActions; timeFormat?: TimeFormat; startTime?: string; endTime?: string; eventName?: string; timeZone?: string; organizer?: string; name?: string; isBrandingDisabled?: boolean; ratingUrl?: string; noShowUrl?: string; }) => { const currentTimeFormat = timeFormat || TimeFormat.TWELVE_HOUR; const dateTimeFormat = `ddd, MMM D, YYYY ${currentTimeFormat}`; let eventDate = ""; if (isEditingMode) { endTime = "{EVENT_END_TIME}"; eventName = "{EVENT_NAME}"; timeZone = "{TIMEZONE}"; organizer = "{ORGANIZER}"; name = action === WorkflowActions.EMAIL_ATTENDEE ? "{ATTENDEE}" : "{ORGANIZER}"; eventDate = `{EVENT_DATE_${dateTimeFormat}}`; ratingUrl = "{RATING_URL}"; noShowUrl = "{NO_SHOW_URL}"; } else { eventDate = dayjs(startTime).tz(timeZone).locale(locale).format(dateTimeFormat); endTime = dayjs(endTime).tz(timeZone).locale(locale).format(currentTimeFormat); } const emailSubject = `How was your recent experience? ${eventName}`; const introHtml = `
Hi${
name ? ` ${name}` : ""
},
We're always looking to improve our customer's experience. How satisfied were you with your recent meeting?
${noShowHtml}${eventHtml}${dateTimeHtml}${attendeeHtml}${endingHtml}
`; return { emailSubject, emailBody }; }; export default emailRatingTemplate;