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
-