@@ -4,10 +4,10 @@ import { updateEmbedBookerState } from "@calcom/embed-core/src/embed-iframe";
44import { sdkActionManager } from "@calcom/embed-core/src/sdk-event" ;
55import { useBookerStore } from "@calcom/features/bookings/Booker/store" ;
66import { isBookingDryRun } from "@calcom/features/bookings/Booker/utils/isBookingDryRun" ;
7+ import { getUsernameList } from "@calcom/features/eventtypes/lib/defaultEvents" ;
78import { useTimesForSchedule } from "@calcom/features/schedules/lib/use-schedule/useTimesForSchedule" ;
89import { getRoutedTeamMemberIdsFromSearchParams } from "@calcom/lib/bookings/getRoutedTeamMemberIdsFromSearchParams" ;
910import { PUBLIC_QUERY_AVAILABLE_SLOTS_INTERVAL_SECONDS } from "@calcom/lib/constants" ;
10- import { getUsernameList } from "@calcom/features/eventtypes/lib/defaultEvents" ;
1111import { trpc } from "@calcom/trpc/react" ;
1212
1313import { useApiV2AvailableSlots } from "./useApiV2AvailableSlots" ;
@@ -19,16 +19,22 @@ export type UseScheduleWithCacheArgs = {
1919 month ?: string | null ;
2020 timezone ?: string | null ;
2121 selectedDate ?: string | null ;
22- prefetchNextMonth ?: boolean ;
2322 duration ?: number | null ;
24- monthCount ?: number | null ;
2523 dayCount ?: number | null ;
2624 rescheduleUid ?: string | null ;
2725 isTeamEvent ?: boolean ;
2826 orgSlug ?: string ;
2927 teamMemberEmail ?: string | null ;
3028 useApiV2 ?: boolean ;
3129 enabled ?: boolean ;
30+ /***
31+ * Required when prefetching is needed
32+ */
33+ bookerLayout ?: {
34+ layout : string ;
35+ extraDays : number ;
36+ columnViewExtraDays : { current : number } ;
37+ } ;
3238} ;
3339
3440const getAvailabilityLoadedEventPayload = ( {
@@ -51,25 +57,23 @@ export const useSchedule = ({
5157 eventSlug,
5258 eventId,
5359 selectedDate,
54- prefetchNextMonth,
5560 duration,
56- monthCount,
5761 dayCount,
5862 rescheduleUid,
5963 isTeamEvent,
6064 orgSlug,
6165 teamMemberEmail,
6266 useApiV2 = false ,
6367 enabled : enabledProp = true ,
68+ bookerLayout,
6469} : UseScheduleWithCacheArgs ) => {
6570 const bookerState = useBookerStore ( ( state ) => state . state ) ;
6671
6772 const [ startTime , endTime ] = useTimesForSchedule ( {
6873 month,
69- monthCount,
7074 dayCount,
71- prefetchNextMonth,
7275 selectedDate,
76+ bookerLayout,
7377 } ) ;
7478 const searchParams = useSearchParams ( ) ;
7579 const routedTeamMemberIds = searchParams
@@ -99,7 +103,9 @@ export const useSchedule = ({
99103 startTime,
100104 // if `prefetchNextMonth` is true, two months are fetched at once.
101105 endTime,
102- timeZone : timezone ! ,
106+ // We use a placeholder value that is there to keep TS happy, but still invalid to tell us that it shouldn't actually be passed in request(and wouldn't because enabled is false if timezone is nullish)
107+ // TODO: Better approach here is to use `skipToken` from react-query which requires an upgrade of react-query
108+ timeZone : timezone ?? "PLACEHOLDER_TIMEZONE" ,
103109 duration : duration ? `${ duration } ` : undefined ,
104110 rescheduleUid,
105111 orgSlug,
0 commit comments