Merged in fix/SW-1702-new-search-map-view (pull request #2423)
fix(SW-1702): Check if map view in Booking widget * fix(SW-1702): Check if map view in Booking widget * fix: change includes to endsWith Approved-by: Arvid Norlin
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user