fix: remove oAuth clientId from email when rescheduling platform booking (#20354)

Co-authored-by: Rajiv Sahal <sahalrajiv-extc@atharvacoe.ac.in>
This commit is contained in:
Lauris Skraucis
2025-03-25 13:18:29 +00:00
committed by GitHub
co-authored by Rajiv Sahal
parent c7c2c03f6a
commit 8a18e167e9
3 changed files with 10 additions and 0 deletions
@@ -23,6 +23,7 @@ export interface IUseBookingForm {
name: string | null;
};
lastBookingResponse?: Record<string, string>;
clientId?: string;
}
export type UseBookingFormReturnType = ReturnType<typeof useBookingForm>;
@@ -36,6 +37,7 @@ export const useBookingForm = ({
extraOptions,
prefillFormParams,
lastBookingResponse,
clientId,
}: IUseBookingForm) => {
const rescheduleUid = useBookerStore((state) => state.rescheduleUid);
const bookingData = useBookerStore((state) => state.bookingData);
@@ -75,6 +77,7 @@ export const useBookingForm = ({
extraOptions,
prefillFormParams,
lastBookingResponse,
clientId,
});
const bookingForm = useForm<BookingFormValues>({
@@ -22,6 +22,7 @@ type UseInitialFormValuesProps = {
name: string | null;
};
lastBookingResponse?: Record<string, string>;
clientId?: string;
};
// Add this stable hash function
@@ -63,6 +64,7 @@ export function useInitialFormValues({
extraOptions,
prefillFormParams,
lastBookingResponse,
clientId,
}: UseInitialFormValuesProps) {
const stableHashExtraOptions = getStableHash(extraOptions);
@@ -120,6 +122,10 @@ export function useInitialFormValues({
: name ?? username ?? parsedLastBookingResponse?.name ?? "",
};
if (clientId) {
defaultUserValues.email = defaultUserValues.email.replace(`+${clientId}`, "");
}
if (!isRescheduling) {
const defaults = {
responses: {} as Partial<z.infer<ReturnType<typeof getBookingResponsesSchema>>>,
@@ -340,6 +340,7 @@ export const BookerPlatformWrapper = (
hasSession,
extraOptions: extraOptions ?? {},
prefillFormParams: prefillFormParams,
clientId,
});
const {
mutate: createBooking,