diff --git a/packages/features/bookings/Booker/components/hooks/useBookerLayout.ts b/packages/features/bookings/Booker/components/hooks/useBookerLayout.ts index 56c3df6f4e..d1d101d1ba 100644 --- a/packages/features/bookings/Booker/components/hooks/useBookerLayout.ts +++ b/packages/features/bookings/Booker/components/hooks/useBookerLayout.ts @@ -15,7 +15,9 @@ import { getQueryParam } from "../../utils/query-param"; export type UseBookerLayoutType = ReturnType; -export const useBookerLayout = (event: Pick | undefined | null) => { +export const useBookerLayout = ( + profileBookerLayouts: BookerEvent["profile"]["bookerLayouts"] | undefined | null +) => { const [_layout, setLayout] = useBookerStore((state) => [state.layout, state.setLayout], shallow); const isEmbed = useIsEmbed(); const isMobile = useMediaQuery("(max-width: 768px)"); @@ -31,7 +33,7 @@ export const useBookerLayout = (event: Pick | undefined const columnViewExtraDays = useRef( isTablet ? extraDaysConfig[layout].tablet : extraDaysConfig[layout].desktop ); - const bookerLayouts = event?.profile?.bookerLayouts || defaultBookerLayoutSettings; + const bookerLayouts = profileBookerLayouts || defaultBookerLayoutSettings; const defaultLayout = isEmbed ? validateLayout(embedUiConfig.layout) || bookerLayouts.defaultLayout : bookerLayouts.defaultLayout; diff --git a/packages/platform/atoms/booker/BookerPlatformWrapper.tsx b/packages/platform/atoms/booker/BookerPlatformWrapper.tsx index 5056047c9f..3275162cac 100644 --- a/packages/platform/atoms/booker/BookerPlatformWrapper.tsx +++ b/packages/platform/atoms/booker/BookerPlatformWrapper.tsx @@ -203,7 +203,7 @@ export const BookerPlatformWrapper = ( event.data.length = props.duration; } - const bookerLayout = useBookerLayout(event.data); + const bookerLayout = useBookerLayout(event.data?.profile?.bookerLayouts); useInitializeBookerStore({ ...props, teamMemberEmail, diff --git a/packages/platform/atoms/booker/BookerWebWrapper.tsx b/packages/platform/atoms/booker/BookerWebWrapper.tsx index 57fa29731b..7b81d5516d 100644 --- a/packages/platform/atoms/booker/BookerWebWrapper.tsx +++ b/packages/platform/atoms/booker/BookerWebWrapper.tsx @@ -47,8 +47,7 @@ export const BookerWebWrapper = (props: BookerWebWrapperAtomProps) => { } : clientFetchedEvent; - const bookerLayout = useBookerLayout(event.data); - + const bookerLayout = useBookerLayout(event.data?.profile?.bookerLayouts); const selectedDate = searchParams?.get("date"); const isRedirect = searchParams?.get("redirected") === "true" || false; const fromUserNameRedirected = searchParams?.get("username") || "";