fix: disable skip confirm for booker_layout=WEEK_VIEW (#19524)

* fix: disable skip confirm for booker_layout=WEEK_VIEW

* Make code clearer

---------

Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
This commit is contained in:
Somay Chauhan
2025-02-26 11:15:55 +05:30
committed by GitHub
co-authored by Hariom Balhara
parent a44bcafcf2
commit ca1f84c827
2 changed files with 11 additions and 5 deletions
+5 -2
View File
@@ -165,6 +165,7 @@ const BookerComponent = ({
bookingForm,
bookerState,
isInstantMeeting,
layout == BookerLayouts.WEEK_VIEW,
event?.data?.bookingFields
);
@@ -181,9 +182,11 @@ const BookerComponent = ({
if (event.isPending) return setBookerState("loading");
if (!selectedDate) return setBookerState("selecting_date");
if (!selectedTimeslot) return setBookerState("selecting_time");
if (selectedTimeslot && skipConfirmStep && !isInstantMeeting) return setBookerState("selecting_time");
const isSkipConfirmStepSupported = !isInstantMeeting && layout !== BookerLayouts.WEEK_VIEW;
if (selectedTimeslot && skipConfirmStep && isSkipConfirmStepSupported)
return setBookerState("selecting_time");
return setBookerState("booking");
}, [event, selectedDate, selectedTimeslot, setBookerState, skipConfirmStep]);
}, [event, selectedDate, selectedTimeslot, setBookerState, skipConfirmStep, layout, isInstantMeeting]);
const slot = getQueryParam("slot");
@@ -11,6 +11,7 @@ const useSkipConfirmStep = (
bookingForm: UseBookingFormReturnType["bookingForm"],
bookerState: BookerState,
isInstantMeeting: boolean,
isWeekView: boolean,
bookingFields?: BookerEvent["bookingFields"]
) => {
const bookingFormValues = bookingForm.getValues();
@@ -37,9 +38,11 @@ const useSkipConfirmStep = (
setCanSkip(false);
}
};
bookerState === "selecting_time" && !isInstantMeeting && checkSkipStep();
}, [bookingFormValues, bookingFields, rescheduleUid, bookerState]);
const isSkipConfirmStepSupported = !isInstantMeeting && !isWeekView;
if (bookerState === "selecting_time" && isSkipConfirmStepSupported) {
checkSkipStep();
}
}, [bookingFormValues, bookingFields, rescheduleUid, bookerState, isWeekView, isInstantMeeting]);
return canSkip;
};