feat: add cancel and reschedule reason variables in workflows (#18305)

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
This commit is contained in:
Kartik SainiandPeer Richelsen authored and GitHub committed 2025-01-06 11:56:06 +00:00
1 parent f7f36978e1
commit 487cc0751d
9 files changed
+25

No files matched your search

@@ -2031,8 +2031,12 @@
"event_end_time_info": "The event end time",
"cancel_url_variable": "Cancel URL",
"cancel_url_info": "The URL to cancel the booking",
"cancel_reason_variable": "Cancellation Reason",
"cancel_reason_info": "The reason for canceling the booking",
"reschedule_url_variable": "Reschedule URL",
"reschedule_url_info": "The URL to reschedule the booking",
"reschedule_reason_variable": "Reschedule Reason",
"reschedule_reason_info": "The reason for rescheduling the booking",
"invalid_event_name_variables": "{{item}} is an invalid variable in your event name",
"select_all": "Select All",
"default_conferencing_bulk_title": "Bulk update existing event types",
@@ -152,6 +152,7 @@ export async function handleConfirmation(args: {
endTime: Date;
uid: string;
smsReminderNumber: string | null;
cancellationReason?: string | null;
metadata: Prisma.JsonValue | null;
customInputs: Prisma.JsonValue;
eventType: {
@@ -229,6 +230,7 @@ export async function handleConfirmation(args: {
},
},
description: true,
cancellationReason: true,
attendees: true,
location: true,
uid: true,
@@ -291,6 +293,7 @@ export async function handleConfirmation(args: {
uid: true,
startTime: true,
metadata: true,
cancellationReason: true,
endTime: true,
smsReminderNumber: true,
description: true,
@@ -324,6 +327,7 @@ export async function handleConfirmation(args: {
const eventTypeSlug = updatedBookings[index].eventType?.slug || "";
const evtOfBooking = {
...evt,
rescheduleReason: updatedBookings[index].cancellationReason || null,
metadata: { videoCallUrl: meetingUrl },
eventType: {
slug: eventTypeSlug,
@@ -1941,6 +1941,7 @@ async function handler(
const evtWithMetadata = {
...evt,
rescheduleReason,
metadata,
eventType: { slug: eventType.slug, schedulingType: eventType.schedulingType, hosts: eventType.hosts },
bookerUrl,
@@ -32,6 +32,7 @@ const handleSeats = async (newSeatedBookingObject: NewSeatedBookingObject) => {
evt,
workflows,
rescheduledBy,
rescheduleReason,
isDryRun = false,
} = newSeatedBookingObject;
// TODO: We could allow doing more things to support good dry run for seats
@@ -112,6 +113,7 @@ const handleSeats = async (newSeatedBookingObject: NewSeatedBookingObject) => {
smsReminderNumber: smsReminderNumber || null,
calendarEvent: {
...evt,
rescheduleReason,
...{
metadata,
eventType: {
@@ -61,7 +61,9 @@ export const DYNAMIC_TEXT_VARIABLES = [
"additional_notes",
"meeting_url",
"cancel_url",
"cancel_reason",
"reschedule_url",
"reschedule_reason",
"rating_url",
"no_show_url",
"attendee_timezone",
@@ -160,7 +160,9 @@ export const scheduleEmailReminder = async (args: scheduleEmailReminderArgs) =>
responses: evt.responses,
meetingUrl: bookingMetadataSchema.parse(evt.metadata || {})?.videoCallUrl,
cancelLink: `${bookerUrl}/booking/${evt.uid}?cancel=true`,
cancelReason: evt.cancellationReason,
rescheduleLink: `${bookerUrl}/reschedule/${evt.uid}`,
rescheduleReason: evt.rescheduleReason,
ratingUrl: `${bookerUrl}/booking/${evt.uid}?rating`,
noShowUrl: `${bookerUrl}/booking/${evt.uid}?noShow=true`,
attendeeTimezone: evt.attendees[0].timeZone,
@@ -21,6 +21,8 @@ export type ExtendedCalendarEvent = Omit<CalendarEvent, "bookerUrl"> & {
schedulingType?: SchedulingType | null;
hosts?: { user: { email: string; destinationCalendar?: { primaryEmail: string | null } | null } }[];
};
rescheduleReason?: string | null;
cancellationReason?: string | null;
bookerUrl: string;
};
@@ -57,6 +57,8 @@ export type BookingInfo = {
additionalNotes?: string | null;
responses?: CalEventResponses | null;
metadata?: Prisma.JsonValue;
cancellationReason?: string | null;
rescheduleReason?: string | null;
};
export type ScheduleTextReminderAction = Extract<
@@ -159,7 +161,9 @@ export const scheduleSMSReminder = async (args: ScheduleTextReminderArgs) => {
responses: evt.responses,
meetingUrl: bookingMetadataSchema.parse(evt.metadata || {})?.videoCallUrl,
cancelLink: `${evt.bookerUrl ?? WEBSITE_URL}/booking/${evt.uid}?cancel=true`,
cancelReason: evt.cancellationReason,
rescheduleLink: `${evt.bookerUrl ?? WEBSITE_URL}/reschedule/${evt.uid}`,
rescheduleReason: evt.rescheduleReason,
attendeeTimezone: evt.attendees[0].timeZone,
eventTimeInAttendeeTimezone: dayjs(evt.startTime).tz(evt.attendees[0].timeZone),
eventEndTimeInAttendeeTimezone: dayjs(evt.endTime).tz(evt.attendees[0].timeZone),
@@ -20,7 +20,9 @@ export type VariablesType = {
responses?: CalEventResponses | null;
meetingUrl?: string;
cancelLink?: string;
cancelReason?: string | null;
rescheduleLink?: string;
rescheduleReason?: string | null;
ratingUrl?: string;
noShowUrl?: string;
attendeeTimezone?: string;
@@ -83,7 +85,9 @@ const customTemplate = (
.replaceAll("{ATTENDEE_EMAIL}", variables.attendeeEmail || "")
.replaceAll("{TIMEZONE}", variables.timeZone || "")
.replaceAll("{CANCEL_URL}", cancelLink)
.replaceAll("{CANCELLATION_REASON}", variables.cancelReason || "")
.replaceAll("{RESCHEDULE_URL}", rescheduleLink)
.replaceAll("{RESCHEDULE_REASON}", variables.rescheduleReason || "")
.replaceAll("{MEETING_URL}", variables.meetingUrl || "")
.replaceAll("{RATING_URL}", variables.ratingUrl || "")
.replaceAll("{NO_SHOW_URL}", variables.noShowUrl || "")