diff --git a/apps/web/lib/emails/templates/attendee-awaiting-payment-email.ts b/apps/web/lib/emails/templates/attendee-awaiting-payment-email.ts index 9cf8823e..27fe50d6 100644 --- a/apps/web/lib/emails/templates/attendee-awaiting-payment-email.ts +++ b/apps/web/lib/emails/templates/attendee-awaiting-payment-email.ts @@ -48,6 +48,7 @@ ${this.attendee.language.translate("emailed_you_and_any_other_attendees")} ${this.getWhat()} ${this.getWhen()} ${this.getLocation()} +${this.getDescription()} ${this.getAdditionalNotes()} `.replace(/(<([^>]+)>)/gi, ""); } @@ -94,6 +95,7 @@ ${this.getAdditionalNotes()} ${this.getWhen()} ${this.getWho()} ${this.getLocation()} + ${this.getDescription()} ${this.getAdditionalNotes()} diff --git a/apps/web/lib/emails/templates/attendee-cancelled-email.ts b/apps/web/lib/emails/templates/attendee-cancelled-email.ts index 477ec5e4..d356beaf 100644 --- a/apps/web/lib/emails/templates/attendee-cancelled-email.ts +++ b/apps/web/lib/emails/templates/attendee-cancelled-email.ts @@ -47,6 +47,7 @@ ${this.attendee.language.translate("emailed_you_and_any_other_attendees")} ${this.getWhat()} ${this.getWhen()} ${this.getLocation()} +${this.getDescription()} ${this.getAdditionalNotes()} ${this.calEvent.cancellationReason && this.getCancellationReason()} `.replace(/(<([^>]+)>)/gi, ""); @@ -95,6 +96,7 @@ ${this.calEvent.cancellationReason && this.getCancellationReason()} ${this.getWhen()} ${this.getWho()} ${this.getLocation()} + ${this.getDescription()} ${this.getAdditionalNotes()} ${this.calEvent.cancellationReason && this.getCancellationReason()} diff --git a/apps/web/lib/emails/templates/attendee-declined-email.ts b/apps/web/lib/emails/templates/attendee-declined-email.ts index c27c3605..b1e36496 100644 --- a/apps/web/lib/emails/templates/attendee-declined-email.ts +++ b/apps/web/lib/emails/templates/attendee-declined-email.ts @@ -47,6 +47,7 @@ ${this.attendee.language.translate("emailed_you_and_any_other_attendees")} ${this.getWhat()} ${this.getWhen()} ${this.getLocation()} +${this.getDescription()} ${this.getAdditionalNotes()} ${this.getRejectionReason()} `.replace(/(<([^>]+)>)/gi, ""); @@ -95,6 +96,7 @@ ${this.getRejectionReason()} ${this.getWhen()} ${this.getWho()} ${this.getLocation()} + ${this.getDescription()} ${this.getAdditionalNotes()} ${this.getRejectionReason()} diff --git a/apps/web/lib/emails/templates/attendee-request-email.ts b/apps/web/lib/emails/templates/attendee-request-email.ts index 921b5d34..98dec12b 100644 --- a/apps/web/lib/emails/templates/attendee-request-email.ts +++ b/apps/web/lib/emails/templates/attendee-request-email.ts @@ -60,6 +60,7 @@ ${this.calEvent.attendees[0].language.translate("user_needs_to_confirm_or_reject ${this.getWhat()} ${this.getWhen()} ${this.getLocation()} +${this.getDescription()} ${this.getAdditionalNotes()} `.replace(/(<([^>]+)>)/gi, ""); } @@ -109,6 +110,7 @@ ${this.getAdditionalNotes()} ${this.getWhen()} ${this.getWho()} ${this.getLocation()} + ${this.getDescription()} ${this.getAdditionalNotes()} diff --git a/apps/web/lib/emails/templates/attendee-rescheduled-email.ts b/apps/web/lib/emails/templates/attendee-rescheduled-email.ts index 46bf6364..d232cf99 100644 --- a/apps/web/lib/emails/templates/attendee-rescheduled-email.ts +++ b/apps/web/lib/emails/templates/attendee-rescheduled-email.ts @@ -45,7 +45,6 @@ export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail { text: this.getTextBody(), }; } - protected getTextBody(): string { // Only the original attendee can make changes to the event // Guests cannot @@ -56,6 +55,7 @@ export default class AttendeeRescheduledEmail extends AttendeeScheduledEmail { ${this.getWhat()} ${this.getWhen()} ${this.getLocation()} + ${this.getDescription()} ${this.getAdditionalNotes()} ${this.attendee.language.translate("need_to_reschedule_or_cancel")} ${getCancelLink(this.calEvent)} @@ -114,6 +114,7 @@ ${this.getAdditionalNotes()} ${this.getWhen()} ${this.getWho()} ${this.getLocation()} + ${this.getDescription()} ${this.getAdditionalNotes()} diff --git a/apps/web/lib/emails/templates/attendee-scheduled-email.ts b/apps/web/lib/emails/templates/attendee-scheduled-email.ts index 9f8cd49e..22730dc0 100644 --- a/apps/web/lib/emails/templates/attendee-scheduled-email.ts +++ b/apps/web/lib/emails/templates/attendee-scheduled-email.ts @@ -112,7 +112,18 @@ export default class AttendeeScheduledEmail { from: serverConfig.from, }; } - + protected getDescription(): string { + if (!this.calEvent.description) return ""; + return ` +

+
+

${this.calEvent.organizer.language.translate("description")}

+

${ + this.calEvent.description + }

+
+ `; + } protected getTextBody(): string { return ` ${this.calEvent.attendees[0].language.translate("your_event_has_been_scheduled")} @@ -168,6 +179,7 @@ ${getRichDescription(this.calEvent)} ${this.getWhen()} ${this.getWho()} ${this.getLocation()} + ${this.getDescription()} ${this.getAdditionalNotes()} @@ -286,13 +298,13 @@ ${getRichDescription(this.calEvent)} } protected getAdditionalNotes(): string { - if (!this.calEvent.description) return ""; + if (!this.calEvent.additionalNotes) return ""; return `

${this.calEvent.attendees[0].language.translate("additional_notes")}

${ - this.calEvent.description + this.calEvent.additionalNotes }

`; diff --git a/apps/web/lib/emails/templates/organizer-cancelled-email.ts b/apps/web/lib/emails/templates/organizer-cancelled-email.ts index 639e4a8f..7f7c6bb5 100644 --- a/apps/web/lib/emails/templates/organizer-cancelled-email.ts +++ b/apps/web/lib/emails/templates/organizer-cancelled-email.ts @@ -56,6 +56,7 @@ ${this.calEvent.organizer.language.translate("emailed_you_and_any_other_attendee ${this.getWhat()} ${this.getWhen()} ${this.getLocation()} +${this.getDescription()} ${this.getAdditionalNotes()} ${this.calEvent.cancellationReason && this.getCancellationReason()} `.replace(/(<([^>]+)>)/gi, ""); @@ -103,6 +104,7 @@ ${this.calEvent.cancellationReason && this.getCancellationReason()} ${this.getWhen()} ${this.getWho()} ${this.getLocation()} + ${this.getDescription()} ${this.getAdditionalNotes()} ${this.calEvent.cancellationReason && this.getCancellationReason()} diff --git a/apps/web/lib/emails/templates/organizer-payment-refund-failed-email.ts b/apps/web/lib/emails/templates/organizer-payment-refund-failed-email.ts index 6b254980..40f4b524 100644 --- a/apps/web/lib/emails/templates/organizer-payment-refund-failed-email.ts +++ b/apps/web/lib/emails/templates/organizer-payment-refund-failed-email.ts @@ -58,6 +58,7 @@ ${ ${this.getWhat()} ${this.getWhen()} ${this.getLocation()} +${this.getDescription()} ${this.getAdditionalNotes()} `.replace(/(<([^>]+)>)/gi, ""); } @@ -136,6 +137,7 @@ ${this.getAdditionalNotes()} ${this.getWhen()} ${this.getWho()} ${this.getLocation()} + ${this.getDescription()} ${this.getAdditionalNotes()} diff --git a/apps/web/lib/emails/templates/organizer-request-email.ts b/apps/web/lib/emails/templates/organizer-request-email.ts index 58278930..b9459329 100644 --- a/apps/web/lib/emails/templates/organizer-request-email.ts +++ b/apps/web/lib/emails/templates/organizer-request-email.ts @@ -57,6 +57,7 @@ ${this.calEvent.organizer.language.translate("someone_requested_an_event")} ${this.getWhat()} ${this.getWhen()} ${this.getLocation()} +${this.getDescription()} ${this.getAdditionalNotes()} ${this.calEvent.organizer.language.translate("confirm_or_reject_request")} ${process.env.NEXT_PUBLIC_WEBAPP_URL} + "/bookings/upcoming" diff --git a/apps/web/lib/emails/templates/organizer-request-reminder-email.ts b/apps/web/lib/emails/templates/organizer-request-reminder-email.ts index 50ab1e80..bc3acc7c 100644 --- a/apps/web/lib/emails/templates/organizer-request-reminder-email.ts +++ b/apps/web/lib/emails/templates/organizer-request-reminder-email.ts @@ -57,6 +57,7 @@ ${this.calEvent.organizer.language.translate("someone_requested_an_event")} ${this.getWhat()} ${this.getWhen()} ${this.getLocation()} +${this.getDescription()} ${this.getAdditionalNotes()} ${this.calEvent.organizer.language.translate("confirm_or_reject_request")} ${process.env.NEXT_PUBLIC_WEBAPP_URL} + "/bookings/upcoming" @@ -105,6 +106,7 @@ ${process.env.NEXT_PUBLIC_WEBAPP_URL} + "/bookings/upcoming" ${this.getWhen()} ${this.getWho()} ${this.getLocation()} + ${this.getDescription()} ${this.getAdditionalNotes()} diff --git a/apps/web/lib/emails/templates/organizer-rescheduled-email.ts b/apps/web/lib/emails/templates/organizer-rescheduled-email.ts index 5c9a7e5c..dd371c8c 100644 --- a/apps/web/lib/emails/templates/organizer-rescheduled-email.ts +++ b/apps/web/lib/emails/templates/organizer-rescheduled-email.ts @@ -62,6 +62,7 @@ ${this.calEvent.organizer.language.translate("emailed_you_and_any_other_attendee ${this.getWhat()} ${this.getWhen()} ${this.getLocation()} +${this.getDescription()} ${this.getAdditionalNotes()} ${this.calEvent.organizer.language.translate("need_to_reschedule_or_cancel")} ${getCancelLink(this.calEvent)} @@ -110,6 +111,7 @@ ${getCancelLink(this.calEvent)} ${this.getWhen()} ${this.getWho()} ${this.getLocation()} + ${this.getDescription()} ${this.getAdditionalNotes()} diff --git a/apps/web/lib/emails/templates/organizer-scheduled-email.ts b/apps/web/lib/emails/templates/organizer-scheduled-email.ts index 2fd38896..35828360 100644 --- a/apps/web/lib/emails/templates/organizer-scheduled-email.ts +++ b/apps/web/lib/emails/templates/organizer-scheduled-email.ts @@ -175,6 +175,7 @@ ${getRichDescription(this.calEvent)} ${this.getWhen()} ${this.getWho()} ${this.getLocation()} + ${this.getDescription()} ${this.getAdditionalNotes()} @@ -287,11 +288,24 @@ ${getRichDescription(this.calEvent)} } protected getAdditionalNotes(): string { - if (!this.calEvent.description) return ""; + if (!this.calEvent.additionalNotes) return ""; return `

${this.calEvent.organizer.language.translate("additional_notes")}

+

${ + this.calEvent.additionalNotes + }

+
+ `; + } + + protected getDescription(): string { + if (!this.calEvent.description) return ""; + return ` +

+
+

${this.calEvent.organizer.language.translate("description")}

${ this.calEvent.description }

diff --git a/apps/web/pages/api/book/event.ts b/apps/web/pages/api/book/event.ts index eed093b9..87d2c9f9 100644 --- a/apps/web/pages/api/book/event.ts +++ b/apps/web/pages/api/book/event.ts @@ -200,6 +200,7 @@ const getEventTypesFromDB = async (eventTypeId: number) => { length: true, eventName: true, schedulingType: true, + description: true, periodType: true, periodStartDate: true, periodEndDate: true, @@ -337,7 +338,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) t: tOrganizer, }; - const description = + const additionalNotes = reqBody.notes + reqBody.customInputs.reduce( (str, input) => str + "

" + input.label + ":
" + input.value, @@ -346,7 +347,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) const evt: CalendarEvent = { type: eventType.title, title: getEventName(eventNameObject), //this needs to be either forced in english, or fetched for each attendee and organizer separately - description, + description: eventType.description, + additionalNotes, startTime: reqBody.start, endTime: reqBody.end, organizer: { @@ -402,7 +404,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) title: evt.title, startTime: dayjs(evt.startTime).toDate(), endTime: dayjs(evt.endTime).toDate(), - description: evt.description, + description: evt.additionalNotes, confirmed: (!eventType.requiresConfirmation && !eventType.price) || !!rescheduleUid, location: evt.location, eventType: eventTypeRel, @@ -557,7 +559,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) const updateManager = await eventManager.update(evt, rescheduleUid); // This gets overridden when updating the event - to check if notes have been hidden or not. We just reset this back // to the default description when we are sending the emails. - evt.description = description; + evt.description = eventType.description; results = updateManager.results; referencesToCreate = updateManager.referencesToCreate; @@ -594,7 +596,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) // This gets overridden when creating the event - to check if notes have been hidden or not. We just reset this back // to the default description when we are sending the emails. - evt.description = description; + evt.description = eventType.description; results = createManager.results; referencesToCreate = createManager.referencesToCreate; diff --git a/apps/web/playwright/integrations.test.ts-snapshots/webhookResponse-chromium.txt b/apps/web/playwright/integrations.test.ts-snapshots/webhookResponse-chromium.txt index 51471113..2d8e6d92 100644 --- a/apps/web/playwright/integrations.test.ts-snapshots/webhookResponse-chromium.txt +++ b/apps/web/playwright/integrations.test.ts-snapshots/webhookResponse-chromium.txt @@ -1 +1 @@ -{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30min","title":"30min between Pro Example and Test Testson","description":"","startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"Pro Example","email":"pro@example.com","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"test@example.com","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"hideCalendarNotes":false,"uid":"[redacted/dynamic]","metadata":{},"additionInformation":"[redacted/dynamic]"}} \ No newline at end of file +{"triggerEvent":"BOOKING_CREATED","createdAt":"[redacted/dynamic]","payload":{"type":"30min","title":"30min between Pro Example and Test Testson","description":null,"additionalNotes":"","startTime":"[redacted/dynamic]","endTime":"[redacted/dynamic]","organizer":{"name":"Pro Example","email":"pro@example.com","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"},"attendees":[{"email":"test@example.com","name":"Test Testson","timeZone":"[redacted/dynamic]","language":"[redacted/dynamic]"}],"location":"[redacted/dynamic]","destinationCalendar":null,"hideCalendarNotes":false,"uid":"[redacted/dynamic]","metadata":{},"additionInformation":"[redacted/dynamic]"}} \ No newline at end of file diff --git a/packages/core/CalendarManager.ts b/packages/core/CalendarManager.ts index 5d387429..726fb56c 100644 --- a/packages/core/CalendarManager.ts +++ b/packages/core/CalendarManager.ts @@ -104,7 +104,7 @@ export const createEvent = async (credential: Credential, calEvent: CalendarEven // Check if the disabledNotes flag is set to true if (calEvent.hideCalendarNotes) { - calEvent.description = "Notes have been hidden by the organiser"; // TODO: i18n this string? + calEvent.additionalNotes = "Notes have been hidden by the organiser"; // TODO: i18n this string? } const creationResult = calendar diff --git a/packages/lib/CalEventParser.ts b/packages/lib/CalEventParser.ts index 2cb39deb..888a3748 100644 --- a/packages/lib/CalEventParser.ts +++ b/packages/lib/CalEventParser.ts @@ -48,10 +48,15 @@ ${organizer + attendees} export const getAdditionalNotes = (calEvent: CalendarEvent) => { return ` ${calEvent.organizer.language.translate("additional_notes")}: -${calEvent.description} +${calEvent.additionalNotes} `; }; +export const getDescription = (calEvent: CalendarEvent) => { + return `\n${calEvent.attendees[0].language.translate("description")} + ${calEvent.description} + `; +}; export const getLocation = (calEvent: CalendarEvent) => { let providerName = ""; @@ -97,6 +102,7 @@ ${getWhen(calEvent)} ${getWho(calEvent)} ${calEvent.organizer.language.translate("where")}: ${getLocation(calEvent)} +${getDescription(calEvent)} ${getAdditionalNotes(calEvent)} `.trim(); } @@ -107,6 +113,7 @@ ${getWhen(calEvent)} ${getWho(calEvent)} ${calEvent.organizer.language.translate("where")}: ${getLocation(calEvent)} +${getDescription(calEvent)} ${getAdditionalNotes(calEvent)} ${getManageLink(calEvent)} `.trim(); diff --git a/packages/types/Calendar.d.ts b/packages/types/Calendar.d.ts index 0708eb3f..00b9ab3f 100644 --- a/packages/types/Calendar.d.ts +++ b/packages/types/Calendar.d.ts @@ -75,6 +75,7 @@ export interface CalendarEvent { title: string; startTime: string; endTime: string; + additionalNotes?: string | null; description?: string | null; team?: { name: string;