diff --git a/apps/scandic-web/components/Forms/BookingWidget/index.tsx b/apps/scandic-web/components/Forms/BookingWidget/index.tsx index 850800f97..e56d3092e 100644 --- a/apps/scandic-web/components/Forms/BookingWidget/index.tsx +++ b/apps/scandic-web/components/Forms/BookingWidget/index.tsx @@ -1,12 +1,16 @@ "use client" -import { useRouter } from "next/navigation" +import { usePathname, useRouter } from "next/navigation" import { useTransition } from "react" import { Form as FormRAC } from "react-aria-components" import { useFormContext } from "react-hook-form" import { REDEMPTION } from "@/constants/booking" -import { selectHotel, selectRate } from "@/constants/routes/hotelReservation" +import { + selectHotel, + selectHotelMap, + selectRate, +} from "@/constants/routes/hotelReservation" import useLang from "@/hooks/useLang" import { trackBookingSearchClick } from "@/utils/tracking/booking" @@ -27,6 +31,7 @@ const formId = "booking-widget" export default function Form({ type, onClose }: BookingWidgetFormProps) { const router = useRouter() + const pathname = usePathname() const lang = useLang() const [isPending, startTransition] = useTransition() @@ -39,7 +44,12 @@ export default function Form({ type, onClose }: BookingWidgetFormProps) { function onSubmit(data: BookingWidgetSchema) { trackBookingSearchClick(data.search, data.hotel ? "hotel" : "destination") - const bookingFlowPage = data.hotel ? selectRate(lang) : selectHotel(lang) + const isMapView = pathname.endsWith("/map") + const bookingFlowPage = data.hotel + ? selectRate(lang) + : isMapView + ? selectHotelMap(lang) + : selectHotel(lang) const bookingWidgetParams = serializeBookingSearchParams({ rooms: data.rooms, ...data.date,