refactor: url management in hotel reservation flow
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
getFiltersFromHotels,
|
||||
} from "@/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/utils"
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
import { safeTry } from "@/utils/safeTry"
|
||||
|
||||
import { getHotelPins } from "../../HotelCardDialogListing/utils"
|
||||
@@ -33,19 +34,20 @@ function isValidHotelData(hotel: NullableHotelData): hotel is HotelData {
|
||||
|
||||
export async function SelectHotelMapContainer({
|
||||
city,
|
||||
searchParams,
|
||||
selectHotelParams,
|
||||
adultsInRoom,
|
||||
childrenInRoom,
|
||||
child,
|
||||
}: SelectHotelMapContainerProps) {
|
||||
const lang = getLang()
|
||||
const googleMapId = env.GOOGLE_DYNAMIC_MAP_ID
|
||||
const googleMapsApiKey = env.GOOGLE_STATIC_MAP_KEY
|
||||
|
||||
const fetchAvailableHotelsPromise = safeTry(
|
||||
fetchAvailableHotels({
|
||||
cityId: city.id,
|
||||
roomStayStartDate: searchParams.fromDate,
|
||||
roomStayEndDate: searchParams.toDate,
|
||||
roomStayStartDate: selectHotelParams.fromDate,
|
||||
roomStayEndDate: selectHotelParams.toDate,
|
||||
adults: adultsInRoom,
|
||||
children: childrenInRoom,
|
||||
})
|
||||
@@ -62,12 +64,12 @@ export async function SelectHotelMapContainer({
|
||||
hotel: { address: hotels?.[0]?.hotelData?.address.streetAddress },
|
||||
})
|
||||
|
||||
const arrivalDate = new Date(searchParams.fromDate)
|
||||
const departureDate = new Date(searchParams.toDate)
|
||||
const arrivalDate = new Date(selectHotelParams.fromDate)
|
||||
const departureDate = new Date(selectHotelParams.toDate)
|
||||
|
||||
const pageTrackingData: TrackingSDKPageData = {
|
||||
pageId: "select-hotel",
|
||||
domainLanguage: searchParams.lang as Lang,
|
||||
domainLanguage: lang,
|
||||
channel: TrackingChannelEnum["hotelreservation"],
|
||||
pageName: "hotelreservation|select-hotel|mapview",
|
||||
siteSections: "hotelreservation|select-hotel|mapview",
|
||||
@@ -77,7 +79,7 @@ export async function SelectHotelMapContainer({
|
||||
|
||||
const hotelsTrackingData: TrackingSDKHotelInfo = {
|
||||
availableResults: validHotels.length,
|
||||
searchTerm: searchParams.city,
|
||||
searchTerm: selectHotelParams.city,
|
||||
arrivalDate: format(arrivalDate, "yyyy-MM-dd"),
|
||||
departureDate: format(departureDate, "yyyy-MM-dd"),
|
||||
noOfAdults: adultsInRoom,
|
||||
|
||||
Reference in New Issue
Block a user