From 80a2b6c0687ff2a36184e507470fb8f9ee1b4605 Mon Sep 17 00:00:00 2001 From: Mihai C <34626017+mihaic195@users.noreply.github.com> Date: Wed, 1 Dec 2021 12:32:08 +0200 Subject: [PATCH] chore: clean up and fix images (#1224) Co-authored-by: Bailey Pumfleet --- .../api/integrations/stripepayment/webhook.ts | 3 +- lib/config/constants.ts | 1 + .../attendee-awaiting-payment-email.ts | 142 +++--------------- .../templates/attendee-cancelled-email.ts | 109 ++------------ .../templates/attendee-declined-email.ts | 109 ++------------ .../templates/attendee-rescheduled-email.ts | 137 ++--------------- .../templates/attendee-scheduled-email.ts | 142 +++--------------- lib/emails/templates/common/body-logo.ts | 42 ++++++ lib/emails/templates/common/index.ts | 6 + lib/emails/templates/common/link-icon.ts | 5 + .../common/scheduling-body-divider.ts | 31 ++++ .../common/scheduling-body-head-content.ts | 33 ++++ .../templates/common/scheduling-body-head.ts | 14 +- lib/emails/templates/forgot-password-email.ts | 40 +---- .../templates/organizer-cancelled-email.ts | 109 ++------------ .../organizer-payment-refund-failed-email.ts | 66 +------- .../templates/organizer-request-email.ts | 140 ++--------------- .../organizer-request-reminder-email.ts | 140 ++--------------- .../templates/organizer-rescheduled-email.ts | 137 ++--------------- .../templates/organizer-scheduled-email.ts | 142 +++--------------- lib/emails/templates/team-invite-email.ts | 39 +---- lib/logger.ts | 6 +- lib/prisma.ts | 4 +- public/emails/CalLogo@2x.png | Bin 0 -> 1036 bytes public/emails/linkIcon.png | Bin 0 -> 467 bytes 25 files changed, 291 insertions(+), 1306 deletions(-) create mode 100644 lib/emails/templates/common/body-logo.ts create mode 100644 lib/emails/templates/common/index.ts create mode 100644 lib/emails/templates/common/link-icon.ts create mode 100644 lib/emails/templates/common/scheduling-body-divider.ts create mode 100644 lib/emails/templates/common/scheduling-body-head-content.ts create mode 100644 public/emails/CalLogo@2x.png create mode 100644 public/emails/linkIcon.png diff --git a/ee/pages/api/integrations/stripepayment/webhook.ts b/ee/pages/api/integrations/stripepayment/webhook.ts index 64a87e8e..459db97f 100644 --- a/ee/pages/api/integrations/stripepayment/webhook.ts +++ b/ee/pages/api/integrations/stripepayment/webhook.ts @@ -5,6 +5,7 @@ import Stripe from "stripe"; import stripe from "@ee/lib/stripe/server"; import { CalendarEvent } from "@lib/calendarClient"; +import { IS_PRODUCTION } from "@lib/config/constants"; import { HttpError } from "@lib/core/http/error"; import { getErrorFromUnknown } from "@lib/errors"; import EventManager from "@lib/events/EventManager"; @@ -145,7 +146,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) console.error(`Webhook Error: ${err.message}`); res.status(err.statusCode ?? 500).send({ message: err.message, - stack: process.env.NODE_ENV === "production" ? undefined : err.stack, + stack: IS_PRODUCTION ? undefined : err.stack, }); return; } diff --git a/lib/config/constants.ts b/lib/config/constants.ts index da7099b6..b686c6f7 100644 --- a/lib/config/constants.ts +++ b/lib/config/constants.ts @@ -1 +1,2 @@ export const BASE_URL = process.env.BASE_URL || `https://${process.env.VERCEL_URL}`; +export const IS_PRODUCTION = process.env.NODE_ENV === "production"; diff --git a/lib/emails/templates/attendee-awaiting-payment-email.ts b/lib/emails/templates/attendee-awaiting-payment-email.ts index c5c3404b..e9215e06 100644 --- a/lib/emails/templates/attendee-awaiting-payment-email.ts +++ b/lib/emails/templates/attendee-awaiting-payment-email.ts @@ -5,8 +5,14 @@ import toArray from "dayjs/plugin/toArray"; import utc from "dayjs/plugin/utc"; import AttendeeScheduledEmail from "./attendee-scheduled-email"; -import { emailHead } from "./common/head"; -import { emailSchedulingBodyHeader } from "./common/scheduling-body-head"; +import { + emailHead, + emailSchedulingBodyHeader, + emailBodyLogo, + emailScheduledBodyHeaderContent, + emailSchedulingBodyDivider, + linkIcon, +} from "./common"; dayjs.extend(utc); dayjs.extend(timezone); @@ -66,66 +72,11 @@ ${this.getAdditionalNotes()}
${emailSchedulingBodyHeader("calendarCircle")} - -
- - - - - - -
- -
- - - - - - - - - -
-
${this.calEvent.language( - "meeting_awaiting_payment" - )}
-
-
${this.calEvent.language( - "emailed_you_and_any_other_attendees" - )}
-
-
- -
-
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailScheduledBodyHeaderContent( + this.calEvent.language("meeting_awaiting_payment"), + this.calEvent.language("emailed_you_and_any_other_attendees") + )} + ${emailSchedulingBodyDivider()}
@@ -156,33 +107,7 @@ ${this.getAdditionalNotes()}
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailSchedulingBodyDivider()}
@@ -214,40 +139,7 @@ ${this.getAdditionalNotes()}
- -
- - - - - - -
- -
- - - - - - -
- - - - - - -
- - - -
-
-
- -
-
+ ${emailBodyLogo()}
@@ -263,7 +155,9 @@ ${this.getAdditionalNotes()}

- ${manageText} + ${manageText}

diff --git a/lib/emails/templates/attendee-cancelled-email.ts b/lib/emails/templates/attendee-cancelled-email.ts index 8f42eaf5..55449e0a 100644 --- a/lib/emails/templates/attendee-cancelled-email.ts +++ b/lib/emails/templates/attendee-cancelled-email.ts @@ -5,8 +5,13 @@ import toArray from "dayjs/plugin/toArray"; import utc from "dayjs/plugin/utc"; import AttendeeScheduledEmail from "./attendee-scheduled-email"; -import { emailHead } from "./common/head"; -import { emailSchedulingBodyHeader } from "./common/scheduling-body-head"; +import { + emailHead, + emailSchedulingBodyHeader, + emailBodyLogo, + emailScheduledBodyHeaderContent, + emailSchedulingBodyDivider, +} from "./common"; dayjs.extend(utc); dayjs.extend(timezone); @@ -67,66 +72,11 @@ ${this.getAdditionalNotes()}
${emailSchedulingBodyHeader("xCircle")} - -
- - - - - - -
- -
- - - - - - - - - -
-
${this.calEvent.language( - "event_request_cancelled" - )}
-
-
${this.calEvent.language( - "emailed_you_and_any_other_attendees" - )}
-
-
- -
-
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailScheduledBodyHeaderContent( + this.calEvent.language("event_request_cancelled"), + this.calEvent.language("emailed_you_and_any_other_attendees") + )} + ${emailSchedulingBodyDivider()}
@@ -169,40 +119,7 @@ ${this.getAdditionalNotes()}
- -
- - - - - - -
- -
- - - - - - -
- - - - - - -
- - - -
-
-
- -
-
+ ${emailBodyLogo()}
diff --git a/lib/emails/templates/attendee-declined-email.ts b/lib/emails/templates/attendee-declined-email.ts index 34dc3576..78afb3df 100644 --- a/lib/emails/templates/attendee-declined-email.ts +++ b/lib/emails/templates/attendee-declined-email.ts @@ -5,8 +5,13 @@ import toArray from "dayjs/plugin/toArray"; import utc from "dayjs/plugin/utc"; import AttendeeScheduledEmail from "./attendee-scheduled-email"; -import { emailHead } from "./common/head"; -import { emailSchedulingBodyHeader } from "./common/scheduling-body-head"; +import { + emailHead, + emailSchedulingBodyHeader, + emailBodyLogo, + emailScheduledBodyHeaderContent, + emailSchedulingBodyDivider, +} from "./common"; dayjs.extend(utc); dayjs.extend(timezone); @@ -67,66 +72,11 @@ ${this.getAdditionalNotes()}
${emailSchedulingBodyHeader("xCircle")} - -
- - - - - - -
- -
- - - - - - - - - -
-
${this.calEvent.language( - "event_request_declined" - )}
-
-
${this.calEvent.language( - "emailed_you_and_any_other_attendees" - )}
-
-
- -
-
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailScheduledBodyHeaderContent( + this.calEvent.language("event_request_declined"), + this.calEvent.language("emailed_you_and_any_other_attendees") + )} + ${emailSchedulingBodyDivider()}
@@ -169,40 +119,7 @@ ${this.getAdditionalNotes()}
- -
- - - - - - -
- -
- - - - - - -
- - - - - - -
- - - -
-
-
- -
-
+ ${emailBodyLogo()}
diff --git a/lib/emails/templates/attendee-rescheduled-email.ts b/lib/emails/templates/attendee-rescheduled-email.ts index 7756e1e8..4e39e1d3 100644 --- a/lib/emails/templates/attendee-rescheduled-email.ts +++ b/lib/emails/templates/attendee-rescheduled-email.ts @@ -7,8 +7,13 @@ import utc from "dayjs/plugin/utc"; import { getCancelLink } from "@lib/CalEventParser"; import AttendeeScheduledEmail from "./attendee-scheduled-email"; -import { emailHead } from "./common/head"; -import { emailSchedulingBodyHeader } from "./common/scheduling-body-head"; +import { + emailHead, + emailSchedulingBodyHeader, + emailBodyLogo, + emailScheduledBodyHeaderContent, + emailSchedulingBodyDivider, +} from "./common"; dayjs.extend(utc); dayjs.extend(timezone); @@ -87,66 +92,11 @@ ${this.getAdditionalNotes()}
${emailSchedulingBodyHeader("calendarCircle")} - -
- - - - - - -
- -
- - - - - - - - - -
-
${this.calEvent.language( - "event_has_been_rescheduled" - )}
-
-
${this.calEvent.language( - "emailed_you_and_any_other_attendees" - )}
-
-
- -
-
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailScheduledBodyHeaderContent( + this.calEvent.language("event_has_been_rescheduled"), + this.calEvent.language("emailed_you_and_any_other_attendees") + )} + ${emailSchedulingBodyDivider()}
@@ -177,33 +127,7 @@ ${this.getAdditionalNotes()}
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailSchedulingBodyDivider()}
@@ -230,40 +154,7 @@ ${this.getAdditionalNotes()}
- -
- - - - - - -
- -
- - - - - - -
- - - - - - -
- - - -
-
-
- -
-
+ ${emailBodyLogo()}
diff --git a/lib/emails/templates/attendee-scheduled-email.ts b/lib/emails/templates/attendee-scheduled-email.ts index 861d2523..eabe008f 100644 --- a/lib/emails/templates/attendee-scheduled-email.ts +++ b/lib/emails/templates/attendee-scheduled-email.ts @@ -12,8 +12,14 @@ import { getErrorFromUnknown } from "@lib/errors"; import { getIntegrationName } from "@lib/integrations"; import { serverConfig } from "@lib/serverConfig"; -import { emailHead } from "./common/head"; -import { emailSchedulingBodyHeader } from "./common/scheduling-body-head"; +import { + emailHead, + emailSchedulingBodyHeader, + emailBodyLogo, + emailScheduledBodyHeaderContent, + emailSchedulingBodyDivider, + linkIcon, +} from "./common"; dayjs.extend(utc); dayjs.extend(timezone); @@ -156,66 +162,11 @@ ${this.getAdditionalNotes()}
${emailSchedulingBodyHeader("checkCircle")} - -
- - - - - - -
- -
- - - - - - - - - -
-
${this.calEvent.language( - "your_event_has_been_scheduled" - )}
-
-
${this.calEvent.language( - "emailed_you_and_any_other_attendees" - )}
-
-
- -
-
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailScheduledBodyHeaderContent( + this.calEvent.language("your_event_has_been_scheduled"), + this.calEvent.language("emailed_you_and_any_other_attendees") + )} + ${emailSchedulingBodyDivider()}
@@ -246,33 +197,7 @@ ${this.getAdditionalNotes()}
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailSchedulingBodyDivider()}
@@ -299,40 +224,7 @@ ${this.getAdditionalNotes()}
- -
- - - - - - -
- -
- - - - - - -
- - - - - - -
- - - -
-
-
- -
-
+ ${emailBodyLogo()}
@@ -438,7 +330,7 @@ ${this.getAdditionalNotes()} meetingUrl && `` + )}">` }

${ meetingId && @@ -475,7 +367,7 @@ ${this.getAdditionalNotes()} hangoutLink && `` + )}">` }

{ + const image = IS_PRODUCTION ? BASE_URL + "emails/CalLogo@2x.png" : "https://i.imgur.com/esapZ47.png"; + + return ` + +
+ + + + + + +
+ +
+ + + + + + +
+ + + + + + +
+ + + +
+
+
+ +
+
+ `; +}; diff --git a/lib/emails/templates/common/index.ts b/lib/emails/templates/common/index.ts new file mode 100644 index 00000000..686d871f --- /dev/null +++ b/lib/emails/templates/common/index.ts @@ -0,0 +1,6 @@ +export { emailHead } from "./head"; +export { emailSchedulingBodyHeader } from "./scheduling-body-head"; +export { emailBodyLogo } from "./body-logo"; +export { emailScheduledBodyHeaderContent } from "./scheduling-body-head-content"; +export { emailSchedulingBodyDivider } from "./scheduling-body-divider"; +export { linkIcon } from "./link-icon"; diff --git a/lib/emails/templates/common/link-icon.ts b/lib/emails/templates/common/link-icon.ts new file mode 100644 index 00000000..52ffb74b --- /dev/null +++ b/lib/emails/templates/common/link-icon.ts @@ -0,0 +1,5 @@ +import { IS_PRODUCTION, BASE_URL } from "@lib/config/constants"; + +export const linkIcon = (): string => { + return IS_PRODUCTION ? BASE_URL + "/emails/linkIcon.png" : "https://i.imgur.com/rKsIBcc.png"; +}; diff --git a/lib/emails/templates/common/scheduling-body-divider.ts b/lib/emails/templates/common/scheduling-body-divider.ts new file mode 100644 index 00000000..b8723c3e --- /dev/null +++ b/lib/emails/templates/common/scheduling-body-divider.ts @@ -0,0 +1,31 @@ +export const emailSchedulingBodyDivider = (): string => { + return ` + +
+ + + + + + +
+ +
+ + + + + + +
+

+

+ +
+
+ +
+
+ `; +}; diff --git a/lib/emails/templates/common/scheduling-body-head-content.ts b/lib/emails/templates/common/scheduling-body-head-content.ts new file mode 100644 index 00000000..31515fc7 --- /dev/null +++ b/lib/emails/templates/common/scheduling-body-head-content.ts @@ -0,0 +1,33 @@ +export const emailScheduledBodyHeaderContent = (title: string, subtitle: string): string => { + return ` + +
+ + + + + + +
+ +
+ + + + + + + + + +
+
${title}
+
+
${subtitle}
+
+
+ +
+
+ `; +}; diff --git a/lib/emails/templates/common/scheduling-body-head.ts b/lib/emails/templates/common/scheduling-body-head.ts index 1d243e4a..56f80cce 100644 --- a/lib/emails/templates/common/scheduling-body-head.ts +++ b/lib/emails/templates/common/scheduling-body-head.ts @@ -1,19 +1,15 @@ -const isProduction = process.env.NODE_ENV === "production"; +import { IS_PRODUCTION, BASE_URL } from "@lib/config/constants"; export type BodyHeadType = "checkCircle" | "xCircle" | "calendarCircle"; -export const getHeadImage = (headerType: BodyHeadType) => { +export const getHeadImage = (headerType: BodyHeadType): string => { switch (headerType) { case "checkCircle": - return isProduction - ? "https://www.cal.com/emails/checkCircle@2x.png" - : "https://i.imgur.com/6BHFgjS.png"; + return IS_PRODUCTION ? BASE_URL + "/emails/checkCircle@2x.png" : "https://i.imgur.com/6BHFgjS.png"; case "xCircle": - return isProduction ? "https://www.cal.com/emails/xCircle@2x.png" : "https://i.imgur.com/44Dq2je.png"; + return IS_PRODUCTION ? BASE_URL + "/emails/xCircle@2x.png" : "https://i.imgur.com/44Dq2je.png"; case "calendarCircle": - return isProduction - ? "https://www.cal.com/emails/calendarCircle@2x.png" - : "https://i.imgur.com/aQOp1mm.png"; + return IS_PRODUCTION ? BASE_URL + "/emails/calendarCircle@2x.png" : "https://i.imgur.com/aQOp1mm.png"; } }; diff --git a/lib/emails/templates/forgot-password-email.ts b/lib/emails/templates/forgot-password-email.ts index 803abe61..7bd0e024 100644 --- a/lib/emails/templates/forgot-password-email.ts +++ b/lib/emails/templates/forgot-password-email.ts @@ -4,7 +4,7 @@ import nodemailer from "nodemailer"; import { getErrorFromUnknown } from "@lib/errors"; import { serverConfig } from "@lib/serverConfig"; -import { emailHead } from "./common/head"; +import { emailHead, linkIcon, emailBodyLogo } from "./common"; export type PasswordReset = { language: TFunction; @@ -83,40 +83,7 @@ ${this.passwordEvent.language("have_any_questions")} ${this.passwordEvent.langua ${emailHead(headerContent)}
- -
- - - - - - -
- -
- - - - - - -
- - - - - - -
- - - -
-
-
- -
-
+ ${emailBodyLogo()}
@@ -175,7 +142,7 @@ ${this.passwordEvent.language("have_any_questions")} ${this.passwordEvent.langua this.passwordEvent.resetLink }" target="_blank" style="color: #FFFFFF; text-decoration: none">${this.passwordEvent.language( "change_password" - )} + )}

@@ -244,7 +211,6 @@ ${this.passwordEvent.language("have_any_questions")} ${this.passwordEvent.langua - `; } diff --git a/lib/emails/templates/organizer-cancelled-email.ts b/lib/emails/templates/organizer-cancelled-email.ts index c9ea0567..4845b801 100644 --- a/lib/emails/templates/organizer-cancelled-email.ts +++ b/lib/emails/templates/organizer-cancelled-email.ts @@ -4,8 +4,13 @@ import timezone from "dayjs/plugin/timezone"; import toArray from "dayjs/plugin/toArray"; import utc from "dayjs/plugin/utc"; -import { emailHead } from "./common/head"; -import { emailSchedulingBodyHeader } from "./common/scheduling-body-head"; +import { + emailHead, + emailSchedulingBodyHeader, + emailBodyLogo, + emailScheduledBodyHeaderContent, + emailSchedulingBodyDivider, +} from "./common"; import OrganizerScheduledEmail from "./organizer-scheduled-email"; dayjs.extend(utc); @@ -75,66 +80,11 @@ ${this.getAdditionalNotes()}
${emailSchedulingBodyHeader("xCircle")} - -
-
- - - - - -
- -
- - - - - - - - - -
-
${this.calEvent.language( - "event_request_cancelled" - )}
-
-
${this.calEvent.language( - "emailed_you_and_any_other_attendees" - )}
-
-
- -
-
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailScheduledBodyHeaderContent( + this.calEvent.language("event_request_cancelled"), + this.calEvent.language("emailed_you_and_any_other_attendees") + )} + ${emailSchedulingBodyDivider()}
@@ -177,40 +127,7 @@ ${this.getAdditionalNotes()}
- -
- - - - - - -
- -
- - - - - - -
- - - - - - -
- - - -
-
-
- -
-
+ ${emailBodyLogo()}
diff --git a/lib/emails/templates/organizer-payment-refund-failed-email.ts b/lib/emails/templates/organizer-payment-refund-failed-email.ts index 31a53582..2b97296f 100644 --- a/lib/emails/templates/organizer-payment-refund-failed-email.ts +++ b/lib/emails/templates/organizer-payment-refund-failed-email.ts @@ -4,8 +4,7 @@ import timezone from "dayjs/plugin/timezone"; import toArray from "dayjs/plugin/toArray"; import utc from "dayjs/plugin/utc"; -import { emailHead } from "./common/head"; -import { emailSchedulingBodyHeader } from "./common/scheduling-body-head"; +import { emailHead, emailSchedulingBodyHeader, emailBodyLogo, emailSchedulingBodyDivider } from "./common"; import OrganizerScheduledEmail from "./organizer-scheduled-email"; dayjs.extend(utc); @@ -115,33 +114,7 @@ ${this.getAdditionalNotes()}
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailSchedulingBodyDivider()}
@@ -184,40 +157,7 @@ ${this.getAdditionalNotes()}
- -
- - - - - - -
- -
- - - - - - -
- - - - - - -
- - - -
-
-
- -
-
+ ${emailBodyLogo()} diff --git a/lib/emails/templates/organizer-request-email.ts b/lib/emails/templates/organizer-request-email.ts index 499fd154..e0e30bec 100644 --- a/lib/emails/templates/organizer-request-email.ts +++ b/lib/emails/templates/organizer-request-email.ts @@ -4,8 +4,14 @@ import timezone from "dayjs/plugin/timezone"; import toArray from "dayjs/plugin/toArray"; import utc from "dayjs/plugin/utc"; -import { emailHead } from "./common/head"; -import { emailSchedulingBodyHeader } from "./common/scheduling-body-head"; +import { + emailHead, + emailSchedulingBodyHeader, + emailBodyLogo, + emailScheduledBodyHeaderContent, + emailSchedulingBodyDivider, + linkIcon, +} from "./common"; import OrganizerScheduledEmail from "./organizer-scheduled-email"; dayjs.extend(utc); @@ -78,66 +84,11 @@ ${process.env.BASE_URL} + "/bookings/upcoming"
${emailSchedulingBodyHeader("calendarCircle")} - -
- - - - - - -
- -
- - - - - - - - - -
-
${this.calEvent.language( - "event_awaiting_approval" - )}
-
-
${this.calEvent.language( - "someone_requested_an_event" - )}
-
-
- -
-
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailScheduledBodyHeaderContent( + this.calEvent.language("event_awaiting_approval"), + this.calEvent.language("someone_requested_an_event") + )} + ${emailSchedulingBodyDivider()}
@@ -168,33 +119,7 @@ ${process.env.BASE_URL} + "/bookings/upcoming"
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailSchedulingBodyDivider()}
@@ -232,40 +157,7 @@ ${process.env.BASE_URL} + "/bookings/upcoming"
- -
- - - - - - -
- -
- - - - - - -
- - - - - - -
- - - -
-
-
- -
-
+ ${emailBodyLogo()}
@@ -276,6 +168,6 @@ ${process.env.BASE_URL} + "/bookings/upcoming" protected getManageLink(): string { const manageText = this.calEvent.language("confirm_or_reject_request"); const manageLink = process.env.BASE_URL + "/bookings/upcoming"; - return `
${manageText} `; + return `${manageText} `; } } diff --git a/lib/emails/templates/organizer-request-reminder-email.ts b/lib/emails/templates/organizer-request-reminder-email.ts index 139bde89..2094cf5c 100644 --- a/lib/emails/templates/organizer-request-reminder-email.ts +++ b/lib/emails/templates/organizer-request-reminder-email.ts @@ -4,8 +4,14 @@ import timezone from "dayjs/plugin/timezone"; import toArray from "dayjs/plugin/toArray"; import utc from "dayjs/plugin/utc"; -import { emailHead } from "./common/head"; -import { emailSchedulingBodyHeader } from "./common/scheduling-body-head"; +import { + emailHead, + emailSchedulingBodyHeader, + emailBodyLogo, + emailScheduledBodyHeaderContent, + emailSchedulingBodyDivider, + linkIcon, +} from "./common"; import OrganizerScheduledEmail from "./organizer-scheduled-email"; dayjs.extend(utc); @@ -77,66 +83,11 @@ ${process.env.BASE_URL} + "/bookings/upcoming"
${emailSchedulingBodyHeader("calendarCircle")} - -
- - - - - - -
- -
- - - - - - - - - -
-
${this.calEvent.language( - "event_still_awaiting_approval" - )}
-
-
${this.calEvent.language( - "someone_requested_an_event" - )}
-
-
- -
-
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailScheduledBodyHeaderContent( + this.calEvent.language("event_still_awaiting_approval"), + this.calEvent.language("someone_requested_an_event") + )} + ${emailSchedulingBodyDivider()}
@@ -167,33 +118,7 @@ ${process.env.BASE_URL} + "/bookings/upcoming"
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailSchedulingBodyDivider()}
@@ -231,40 +156,7 @@ ${process.env.BASE_URL} + "/bookings/upcoming"
- -
- - - - - - -
- -
- - - - - - -
- - - - - - -
- - - -
-
-
- -
-
+ ${emailBodyLogo()}
@@ -275,6 +167,6 @@ ${process.env.BASE_URL} + "/bookings/upcoming" protected getManageLink(): string { const manageText = this.calEvent.language("confirm_or_reject_request"); const manageLink = process.env.BASE_URL + "/bookings/upcoming"; - return `${manageText} `; + return `${manageText} `; } } diff --git a/lib/emails/templates/organizer-rescheduled-email.ts b/lib/emails/templates/organizer-rescheduled-email.ts index fd298500..d732cca6 100644 --- a/lib/emails/templates/organizer-rescheduled-email.ts +++ b/lib/emails/templates/organizer-rescheduled-email.ts @@ -6,8 +6,13 @@ import utc from "dayjs/plugin/utc"; import { getCancelLink } from "@lib/CalEventParser"; -import { emailHead } from "./common/head"; -import { emailSchedulingBodyHeader } from "./common/scheduling-body-head"; +import { + emailHead, + emailSchedulingBodyHeader, + emailBodyLogo, + emailScheduledBodyHeaderContent, + emailSchedulingBodyDivider, +} from "./common"; import OrganizerScheduledEmail from "./organizer-scheduled-email"; dayjs.extend(utc); @@ -83,66 +88,11 @@ ${getCancelLink(this.calEvent)}
${emailSchedulingBodyHeader("calendarCircle")} - -
- - - - - - -
- -
- - - - - - - - - -
-
${this.calEvent.language( - "event_has_been_rescheduled" - )}
-
-
${this.calEvent.language( - "emailed_you_and_any_other_attendees" - )}
-
-
- -
-
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailScheduledBodyHeaderContent( + this.calEvent.language("event_has_been_rescheduled"), + this.calEvent.language("emailed_you_and_any_other_attendees") + )} + ${emailSchedulingBodyDivider()}
@@ -173,33 +123,7 @@ ${getCancelLink(this.calEvent)}
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailSchedulingBodyDivider()}
@@ -226,40 +150,7 @@ ${getCancelLink(this.calEvent)}
- -
- - - - - - -
- -
- - - - - - -
- - - - - - -
- - - -
-
-
- -
-
+ ${emailBodyLogo()}
diff --git a/lib/emails/templates/organizer-scheduled-email.ts b/lib/emails/templates/organizer-scheduled-email.ts index 9b031496..8b03dcf3 100644 --- a/lib/emails/templates/organizer-scheduled-email.ts +++ b/lib/emails/templates/organizer-scheduled-email.ts @@ -12,8 +12,14 @@ import { getErrorFromUnknown } from "@lib/errors"; import { getIntegrationName } from "@lib/integrations"; import { serverConfig } from "@lib/serverConfig"; -import { emailHead } from "./common/head"; -import { emailSchedulingBodyHeader } from "./common/scheduling-body-head"; +import { + emailHead, + emailSchedulingBodyHeader, + emailBodyLogo, + emailScheduledBodyHeaderContent, + emailSchedulingBodyDivider, + linkIcon, +} from "./common"; dayjs.extend(utc); dayjs.extend(timezone); @@ -150,66 +156,11 @@ ${getCancelLink(this.calEvent)}
${emailSchedulingBodyHeader("checkCircle")} - -
- - - - - - -
- -
- - - - - - - - - -
-
${this.calEvent.language( - "new_event_scheduled" - )}
-
-
${this.calEvent.language( - "emailed_you_and_any_other_attendees" - )}
-
-
- -
-
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailScheduledBodyHeaderContent( + this.calEvent.language("new_event_scheduled"), + this.calEvent.language("emailed_you_and_any_other_attendees") + )} + ${emailSchedulingBodyDivider()}
@@ -240,33 +191,7 @@ ${getCancelLink(this.calEvent)}
- -
- - - - - - -
- -
- - - - - - -
-

-

- -
-
- -
-
+ ${emailSchedulingBodyDivider()}
@@ -293,40 +218,7 @@ ${getCancelLink(this.calEvent)}
- -
- - - - - - -
- -
- - - - - - -
- - - - - - -
- - - -
-
-
- -
-
+ ${emailBodyLogo()}
@@ -426,7 +318,7 @@ ${getCancelLink(this.calEvent)} meetingUrl && `` + )}">` }

${ meetingId && @@ -463,7 +355,7 @@ ${getCancelLink(this.calEvent)} hangoutLink && `` + )}">` }

- -
- - - - - - -
- -
- - - - - - -
- - - - - - -
- - - -
-
-
- -
-
+ ${emailBodyLogo()}
@@ -171,7 +138,7 @@ export default class TeamInviteEmail { this.teamInviteEvent.joinLink }" target="_blank" style="color: #FFFFFF; text-decoration: none">${this.teamInviteEvent.language( "accept_invitation" - )} + )}

diff --git a/lib/logger.ts b/lib/logger.ts index a4ce3e7c..ff1114ec 100644 --- a/lib/logger.ts +++ b/lib/logger.ts @@ -1,12 +1,12 @@ import { Logger } from "tslog"; -const isProduction = process.env.NODE_ENV === "production"; +import { IS_PRODUCTION } from "@lib/config/constants"; const logger = new Logger({ dateTimePattern: "hour:minute:second.millisecond timeZoneName", displayFunctionName: false, displayFilePath: "hidden", - dateTimeTimezone: isProduction ? "utc" : Intl.DateTimeFormat().resolvedOptions().timeZone, + dateTimeTimezone: IS_PRODUCTION ? "utc" : Intl.DateTimeFormat().resolvedOptions().timeZone, prettyInspectHighlightStyles: { name: "yellow", number: "blue", @@ -14,7 +14,7 @@ const logger = new Logger({ boolean: "blue", }, maskValuesOfKeys: ["password", "passwordConfirmation", "credentials", "credential"], - exposeErrorCodeFrame: !isProduction, + exposeErrorCodeFrame: !IS_PRODUCTION, }); export default logger; diff --git a/lib/prisma.ts b/lib/prisma.ts index 1cb75893..0a6cf581 100644 --- a/lib/prisma.ts +++ b/lib/prisma.ts @@ -1,5 +1,7 @@ import { PrismaClient } from "@prisma/client"; +import { IS_PRODUCTION } from "@lib/config/constants"; + declare global { // eslint-disable-next-line no-var var prisma: PrismaClient | undefined; @@ -11,7 +13,7 @@ export const prisma = log: ["query", "error", "warn"], }); -if (process.env.NODE_ENV !== "production") { +if (!IS_PRODUCTION) { globalThis.prisma = prisma; } diff --git a/public/emails/CalLogo@2x.png b/public/emails/CalLogo@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..d22c77e2e1141cd68cb7f46730e3bbd50f347107 GIT binary patch literal 1036 zcmV+n1oQieP)C@3Q%BPb{+Dk>@{C@3f>C@Lx{C@3f?DJdl-B`GN>DJdx_DJdo< zCMYN@|DJdx_DSoCE(EtDd7IachQvko;U?86mK<|KXfRN8HuTbw$pfDfqYSah- z00Ur2L_t(o!{wOUlG`8*h7FPhK08j<@BgTsFeCyA>~%YxrnCRW&c-108H9vsgb3#u zn{UhPPnqUl$qmNuLDK^GA0V%0&(z|FBR|Y8Ww(z;?)Q?04@U0xvigrjW@4d`wZoe-F|H`3Ob)B44R#DbdIb|w9q*>*MVjL*phZ~0FVyk zDsh|rgji%Icya~}$H;E9aqU`{4ZFVTmC4GL4eA>je6)i&(5wG4i%Ir)P!?^Ht+9!L zeuRuB+r>O~@6(2n=VcG-a7taJsevPv&U5gXR~W1!OEB%s$Z~}O+2*ZG%s!hn{=$=3 zXPGl(_9L93RnKp8hAcYRhbk02h0CR+t&z2bo=##Q&Afk0HwsRV>m0IIW2Qr7ZLuuT z!ce+gelo_tJ5i2odVsif`N2Jnu-NEo$o6IE0#5HM$l9WvgT>R^n5HJ*Q?{pv3>i2Y znT%uV#$CT^$s!wSQ`a zOh&fq&EMT)Y^;hO>;}O0D(?8N?I_ys1>Az8G0~k%e(w7{?Ja+Zpcw0000#bXAB#FU^Ca0jLWy919quoGs;xQIvME5#iccR&erV22O@-sQv$=s-w1g8PHJ zkyw5EU>7imhKiyHx~}s@HgO!6_-_zJ<$3-&48yyGY27rSNuU6qnmGFTD(!)w$;2mTX3)oUDy5P9V|5U@0LVx3?j?2g}qW2?ZMa1NITGh zOFK}3&*r4Wa@$A3Q20gp#wI6LO2EiHW&mYmswe~`QANv z5W!gx7yxCP(5$w2gV zb&pKew(Ds$1MN=002ov JPDHLkV1nFvz`p