Merged in fix/SW-2428-room-preferences-pageview (pull request #2095)
fix(SW-2428): read room packages from search param in select rate tracking * fix(SW-2428): read room packages from search param in select rate tracking Approved-by: Bianca Widstam
This commit is contained in:
@@ -1,22 +1,18 @@
|
||||
import stringify from "json-stable-stringify-without-jsonify"
|
||||
import { cookies } from "next/headers"
|
||||
import { notFound } from "next/navigation"
|
||||
import { Suspense } from "react"
|
||||
|
||||
import { FamilyAndFriendsCodes, REDEMPTION } from "@/constants/booking"
|
||||
import { FamilyAndFriendsCodes } from "@/constants/booking"
|
||||
import { getHotel } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import HotelInfoCard from "@/components/HotelReservation/SelectRate/HotelInfoCard"
|
||||
import { RoomsContainer } from "@/components/HotelReservation/SelectRate/RoomsContainer"
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import { setLang } from "@/i18n/serverContext"
|
||||
import { getHotelSearchDetails } from "@/utils/hotelSearchDetails"
|
||||
import { convertSearchParamsToObj } from "@/utils/url"
|
||||
|
||||
import FnFNotAllowedAlert from "../FnFNotAllowedAlert/FnFNotAllowedAlert"
|
||||
import AvailabilityError from "./AvailabilityError"
|
||||
import { getValidDates } from "./getValidDates"
|
||||
import { getTracking } from "./tracking"
|
||||
import Tracking from "./Tracking"
|
||||
|
||||
import type { SelectRateSearchParams } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { LangParams, PageArgs } from "@/types/params"
|
||||
@@ -30,14 +26,8 @@ export default async function SelectRatePage({
|
||||
if (!searchDetails?.hotel) {
|
||||
return notFound()
|
||||
}
|
||||
const {
|
||||
adultsInRoom,
|
||||
childrenInRoom,
|
||||
hotel,
|
||||
noOfRooms,
|
||||
selectHotelParams,
|
||||
bookingCode,
|
||||
} = searchDetails
|
||||
const { adultsInRoom, childrenInRoom, hotel, noOfRooms, bookingCode } =
|
||||
searchDetails
|
||||
|
||||
const hotelData = await getHotel({
|
||||
hotelId: hotel.id,
|
||||
@@ -49,30 +39,6 @@ export default async function SelectRatePage({
|
||||
return notFound()
|
||||
}
|
||||
|
||||
const { fromDate, toDate } = getValidDates(
|
||||
selectHotelParams.fromDate,
|
||||
selectHotelParams.toDate
|
||||
)
|
||||
|
||||
const arrivalDate = fromDate.toDate()
|
||||
const departureDate = toDate.toDate()
|
||||
|
||||
const { hotelsTrackingData, pageTrackingData } = getTracking(
|
||||
params.lang,
|
||||
arrivalDate,
|
||||
departureDate,
|
||||
adultsInRoom,
|
||||
childrenInRoom,
|
||||
hotel.id,
|
||||
hotel.name,
|
||||
noOfRooms,
|
||||
hotelData.hotel.address.country,
|
||||
hotelData.hotel.address.city,
|
||||
selectHotelParams.city,
|
||||
bookingCode,
|
||||
selectHotelParams.searchType === REDEMPTION
|
||||
)
|
||||
|
||||
const booking = convertSearchParamsToObj<SelectRateSearchParams>(searchParams)
|
||||
|
||||
let isInValidFNF = false
|
||||
@@ -80,7 +46,6 @@ export default async function SelectRatePage({
|
||||
const cookieStore = cookies()
|
||||
isInValidFNF = cookieStore.get("sc")?.value !== "1"
|
||||
}
|
||||
const suspenseKey = stringify(searchParams)
|
||||
return (
|
||||
<>
|
||||
<HotelInfoCard hotel={hotelData.hotel} />
|
||||
@@ -96,12 +61,15 @@ export default async function SelectRatePage({
|
||||
/>
|
||||
)}
|
||||
|
||||
<Suspense key={`${suspenseKey}-tracking`} fallback={null}>
|
||||
<TrackingSDK
|
||||
pageData={pageTrackingData}
|
||||
hotelInfo={hotelsTrackingData}
|
||||
/>
|
||||
</Suspense>
|
||||
<Tracking
|
||||
adultsInRoom={adultsInRoom}
|
||||
childrenInRoom={childrenInRoom}
|
||||
hotelId={hotel.id}
|
||||
hotelName={hotel.name}
|
||||
noOfRooms={noOfRooms}
|
||||
country={hotelData.hotel.address.country}
|
||||
city={hotelData.hotel.address.city}
|
||||
/>
|
||||
|
||||
<AvailabilityError />
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user