feat: custom reply To Email (#20771)
Co-authored-by: Joe Au-Yeung <[email protected]>
This commit is contained in:
1 parent
45904c07bc
commit
c6cb3423fa
56 files changed
+315
-30
No files matched your search
@@ -51,6 +51,7 @@ export class CalendarEventBuilder {
|
||||
seatsPerTimeSlot?: number | null;
|
||||
seatsShowAttendees?: boolean | null;
|
||||
seatsShowAvailabilityCount?: boolean | null;
|
||||
customReplyToEmail?: string | null;
|
||||
}) {
|
||||
this.event = {
|
||||
...this.event,
|
||||
@@ -64,6 +65,7 @@ export class CalendarEventBuilder {
|
||||
// if seats are not enabled we should default true
|
||||
seatsShowAttendees: eventType.seatsPerTimeSlot ? eventType.seatsShowAttendees : true,
|
||||
seatsShowAvailabilityCount: eventType.seatsPerTimeSlot ? eventType.seatsShowAvailabilityCount : true,
|
||||
customReplyToEmail: eventType.customReplyToEmail,
|
||||
};
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ export async function getBookingToDelete(id: number | undefined, uid: string | u
|
||||
seatsShowAttendees: true,
|
||||
metadata: true,
|
||||
schedulingType: true,
|
||||
customReplyToEmail: true,
|
||||
hosts: {
|
||||
select: {
|
||||
user: true,
|
||||
|
||||
@@ -266,6 +266,7 @@ async function handler(input: CancelBookingInput) {
|
||||
platformRescheduleUrl,
|
||||
platformCancelUrl,
|
||||
platformBookingUrl,
|
||||
customReplyToEmail: bookingToDelete.eventType?.customReplyToEmail,
|
||||
};
|
||||
|
||||
const dataForWebhooks = { evt, webhooks, eventTypeInfo };
|
||||
|
||||
@@ -1024,6 +1024,7 @@ async function handler(
|
||||
// if seats are not enabled we should default true
|
||||
seatsShowAttendees: eventType.seatsPerTimeSlot ? eventType.seatsShowAttendees : true,
|
||||
seatsShowAvailabilityCount: eventType.seatsPerTimeSlot ? eventType.seatsShowAvailabilityCount : true,
|
||||
customReplyToEmail: eventType.customReplyToEmail,
|
||||
})
|
||||
.withOrganizer({
|
||||
id: organizerUser.id,
|
||||
|
||||
@@ -80,6 +80,7 @@ export const getEventTypesFromDB = async (eventTypeId: number) => {
|
||||
assignAllTeamMembers: true,
|
||||
isRRWeightsEnabled: true,
|
||||
beforeEventBuffer: true,
|
||||
customReplyToEmail: true,
|
||||
afterEventBuffer: true,
|
||||
parentId: true,
|
||||
parent: {
|
||||
|
||||
@@ -271,6 +271,7 @@ export const roundRobinManualReassignment = async ({
|
||||
bookingFields: eventType.bookingFields ?? null,
|
||||
booking,
|
||||
}),
|
||||
customReplyToEmail: eventType?.customReplyToEmail,
|
||||
location: bookingLocation,
|
||||
...(platformClientParams ? platformClientParams : {}),
|
||||
};
|
||||
|
||||
@@ -318,6 +318,7 @@ export const roundRobinReassignment = async ({
|
||||
bookingFields: eventType?.bookingFields ?? null,
|
||||
booking,
|
||||
}),
|
||||
customReplyToEmail: eventType?.customReplyToEmail,
|
||||
location: bookingLocation,
|
||||
...(platformClientParams ? platformClientParams : {}),
|
||||
};
|
||||
|
||||
@@ -332,7 +332,10 @@ export async function handler(req: NextRequest) {
|
||||
html: emailContent.emailBody,
|
||||
batchId: batchId,
|
||||
sendAt: dayjs(reminder.scheduledDate).unix(),
|
||||
replyTo: reminder.booking?.userPrimaryEmail ?? reminder.booking.user?.email,
|
||||
replyTo:
|
||||
reminder.booking?.eventType?.customReplyToEmail ??
|
||||
reminder.booking?.userPrimaryEmail ??
|
||||
reminder.booking.user?.email,
|
||||
attachments: reminder.workflowStep.includeCalendarEvent
|
||||
? [
|
||||
{
|
||||
@@ -407,7 +410,10 @@ export async function handler(req: NextRequest) {
|
||||
html: emailContent.emailBody,
|
||||
batchId: batchId,
|
||||
sendAt: dayjs(reminder.scheduledDate).unix(),
|
||||
replyTo: reminder.booking?.userPrimaryEmail ?? reminder.booking.user?.email,
|
||||
replyTo:
|
||||
reminder.booking?.eventType?.customReplyToEmail ||
|
||||
reminder.booking?.userPrimaryEmail ||
|
||||
reminder.booking.user?.email,
|
||||
sender: reminder.workflowStep?.sender,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -190,6 +190,7 @@ export const select = Prisma.validator<Prisma.WorkflowReminderSelect>()({
|
||||
hideBranding: true,
|
||||
},
|
||||
},
|
||||
customReplyToEmail: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -251,7 +251,7 @@ export const scheduleEmailReminder = async (args: scheduleEmailReminderArgs) =>
|
||||
return {
|
||||
subject: emailContent.emailSubject,
|
||||
html: emailContent.emailBody,
|
||||
replyTo: evt.organizer.email,
|
||||
replyTo: evt?.eventType?.customReplyToEmail || evt.organizer.email,
|
||||
attachments,
|
||||
sender,
|
||||
};
|
||||
|
||||
@@ -53,6 +53,7 @@ export type BookingInfo = {
|
||||
eventType?: {
|
||||
slug: string;
|
||||
recurringEvent?: RecurringEvent | null;
|
||||
customReplyToEmail?: string | null;
|
||||
};
|
||||
startTime: string;
|
||||
endTime: string;
|
||||
|
||||
@@ -99,6 +99,7 @@ export type EventAdvancedTabCustomClassNames = {
|
||||
warningText?: string;
|
||||
};
|
||||
roundRobinReschedule?: SettingsToggleClassNames;
|
||||
customReplyToEmail?: SettingsToggleClassNames;
|
||||
emailNotifications?: EmailNotificationToggleCustomClassNames;
|
||||
};
|
||||
|
||||
@@ -120,6 +121,7 @@ export type EventAdvancedTabProps = EventAdvancedBaseProps & {
|
||||
error: unknown;
|
||||
};
|
||||
showBookerLayoutSelector: boolean;
|
||||
verifiedEmails?: string[];
|
||||
};
|
||||
|
||||
type CalendarSettingsProps = {
|
||||
@@ -399,6 +401,7 @@ export const EventAdvancedTab = ({
|
||||
showToast,
|
||||
showBookerLayoutSelector,
|
||||
customClassNames,
|
||||
verifiedEmails,
|
||||
}: EventAdvancedTabProps) => {
|
||||
const isPlatform = useIsPlatform();
|
||||
const platformContext = useAtomsContext();
|
||||
@@ -488,6 +491,7 @@ export const EventAdvancedTab = ({
|
||||
const lockTimeZoneToggleOnBookingPageLocked = shouldLockDisableProps("lockTimeZoneToggleOnBookingPage");
|
||||
const multiplePrivateLinksLocked = shouldLockDisableProps("multiplePrivateLinks");
|
||||
const reschedulingPastBookingsLocked = shouldLockDisableProps("allowReschedulingPastBookings");
|
||||
const customReplyToEmailLocked = shouldLockDisableProps("customReplyToEmail");
|
||||
|
||||
const disableCancellingLocked = shouldLockDisableProps("disableCancelling");
|
||||
const disableReschedulingLocked = shouldLockDisableProps("disableRescheduling");
|
||||
@@ -506,6 +510,8 @@ export const EventAdvancedTab = ({
|
||||
|
||||
const [isEventTypeColorChecked, setIsEventTypeColorChecked] = useState(!!eventType.eventTypeColor);
|
||||
|
||||
const customReplyToEmail = formMethods.watch("customReplyToEmail");
|
||||
|
||||
const [eventTypeColorState, setEventTypeColorState] = useState(
|
||||
eventType.eventTypeColor || {
|
||||
lightEventTypeColor: DEFAULT_LIGHT_BRAND_COLOR,
|
||||
@@ -1000,6 +1006,52 @@ export const EventAdvancedTab = ({
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
{!isPlatform && (
|
||||
<>
|
||||
<Controller
|
||||
name="customReplyToEmail"
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<>
|
||||
<SettingsToggle
|
||||
labelClassName={classNames("text-sm", customClassNames?.customReplyToEmail?.label)}
|
||||
toggleSwitchAtTheEnd={true}
|
||||
switchContainerClassName={classNames(
|
||||
"border-subtle rounded-lg border py-6 px-4 sm:px-6",
|
||||
!!value && "rounded-b-none",
|
||||
customClassNames?.customReplyToEmail?.container
|
||||
)}
|
||||
descriptionClassName={customClassNames?.customReplyToEmail?.description}
|
||||
childrenClassName={classNames("lg:ml-0", customClassNames?.customReplyToEmail?.children)}
|
||||
title={t("custom_reply_to_email_title")}
|
||||
{...customReplyToEmailLocked}
|
||||
data-testid="custom-reply-to-email"
|
||||
description={t("custom_reply_to_email_description")}
|
||||
checked={!!customReplyToEmail}
|
||||
onCheckedChange={(e) => {
|
||||
onChange(
|
||||
e
|
||||
? customReplyToEmail || eventType.customReplyToEmail || verifiedEmails?.[0] || null
|
||||
: null
|
||||
);
|
||||
}}>
|
||||
<div className="border-subtle rounded-b-lg border border-t-0 p-6">
|
||||
<SelectField
|
||||
className="w-full"
|
||||
label={t("custom_reply_to_email_title")}
|
||||
required={!!customReplyToEmail}
|
||||
placeholder={t("select_verified_email")}
|
||||
data-testid="custom-reply-to-email-input"
|
||||
value={value ? { label: value, value } : undefined}
|
||||
onChange={(option) => onChange(option?.value || null)}
|
||||
options={verifiedEmails?.map((email) => ({ label: email, value: email })) || []}
|
||||
/>
|
||||
</div>
|
||||
</SettingsToggle>
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<Controller
|
||||
name="eventTypeColor"
|
||||
render={() => (
|
||||
|
||||
@@ -90,6 +90,7 @@ export type FormValues = {
|
||||
hideCalendarNotes: boolean;
|
||||
multiplePrivateLinks: string[] | undefined;
|
||||
eventTypeColor: z.infer<typeof eventTypeColor>;
|
||||
customReplyToEmail: string | null;
|
||||
locations: EventLocation[];
|
||||
aiPhoneCallConfig: PhoneCallConfig;
|
||||
customInputs: CustomInputParsed[];
|
||||
|
||||
Reference in new issue
Block a user