feat: Add onTimeslotsLoaded prop to Booker atom (#21871)
* [CAL-5926] Add 'onTimeslotsLoaded' prop to 'Booker' atom * Added 'onTimeslotsLoaded' to BookerPlatformWrapperAtomProps * fixed type error and added onTimeslotsLoaded prop to doc --------- Co-authored-by: Somay Chauhan <[email protected]>
This commit is contained in:
1 parent
4edb39616d
commit
8b83d39ac3
3 files changed
+10
No files matched your search
@@ -56,6 +56,7 @@ export const BookerPlatformWrapper = (
|
||||
confirmButtonDisabled,
|
||||
isBookingDryRun,
|
||||
handleSlotReservation,
|
||||
onTimeslotsLoaded,
|
||||
} = props;
|
||||
const layout = BookerLayouts[view];
|
||||
|
||||
@@ -276,6 +277,12 @@ export const BookerPlatformWrapper = (
|
||||
...routingParams,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (schedule.data && !schedule.isPending && !schedule.error && onTimeslotsLoaded) {
|
||||
onTimeslotsLoaded(schedule.data.slots);
|
||||
}
|
||||
}, [schedule.data, schedule.isPending, schedule.error, onTimeslotsLoaded]);
|
||||
|
||||
const bookerForm = useBookingForm({
|
||||
event: event?.data,
|
||||
sessionEmail:
|
||||
|
||||
@@ -11,6 +11,7 @@ import type {
|
||||
RoutingFormSearchParams,
|
||||
} from "@calcom/platform-types";
|
||||
import type { BookerLayouts } from "@calcom/prisma/zod-utils";
|
||||
import type { Slot } from "@calcom/trpc/server/routers/viewer/slots/types";
|
||||
|
||||
import type { UseCreateBookingInput } from "../hooks/bookings/useCreateBooking";
|
||||
|
||||
@@ -81,6 +82,7 @@ export type BookerPlatformWrapperAtomProps = Omit<
|
||||
timeZones?: Timezone[];
|
||||
isBookingDryRun?: boolean;
|
||||
eventMetaChildren?: React.ReactNode;
|
||||
onTimeslotsLoaded?: (slots: Record<string, Slot[]>) => void;
|
||||
};
|
||||
|
||||
type VIEW_TYPE = keyof typeof BookerLayouts;
|
||||
|
||||
Reference in new issue
Block a user