fix: clean up hotel and its typings

This commit is contained in:
Simon Emanuelsson
2024-12-17 16:17:25 +01:00
parent ec74af8814
commit 13a164242f
110 changed files with 1931 additions and 1559 deletions

View File

@@ -4,7 +4,7 @@ import { Suspense } from "react"
import {
getBreakfastPackages,
getHotelData,
getHotel,
getPackages,
getProfileSafely,
getSelectedRoomAvailability,
@@ -106,19 +106,19 @@ export default async function StepPage({
const packages = packageCodes
? await getPackages({
adults,
children: childrenInRoom?.length,
endDate: toDate,
hotelId,
packageCodes,
startDate: fromDate,
})
adults,
children: childrenInRoom?.length,
endDate: toDate,
hotelId,
packageCodes,
startDate: fromDate,
})
: null
const roomAvailability = await getSelectedRoomAvailability(
selectedRoomAvailabilityInput
)
const hotelData = await getHotelData({
const hotelData = await getHotel({
hotelId,
isCardOnlyPayment: roomAvailability?.mustBeGuaranteed,
language: lang,
@@ -153,14 +153,14 @@ export default async function StepPage({
const memberPrice = roomAvailability.memberRate
? {
price: roomAvailability.memberRate.localPrice.pricePerStay,
currency: roomAvailability.memberRate.localPrice.currency,
}
price: roomAvailability.memberRate.localPrice.pricePerStay,
currency: roomAvailability.memberRate.localPrice.currency,
}
: undefined
const arrivalDate = new Date(fromDate)
const departureDate = new Date(toDate)
const hotelAttributes = hotelData?.data.attributes
const arrivalDate = new Date(searchParams.fromDate)
const departureDate = new Date(searchParams.toDate)
const hotelAttributes = hotelData?.hotel
const initialHotelsTrackingData: TrackingSDKHotelInfo = {
searchTerm: searchParams.city,
@@ -207,7 +207,7 @@ export default async function StepPage({
searchParamsStr={selectRoomParams.toString()}
step={searchParams.step}
user={user}
vat={hotelData.data.attributes.vat}
vat={hotelAttributes.vat}
>
<main>
<HotelHeader hotelData={hotelData} />
@@ -262,11 +262,11 @@ export default async function StepPage({
user={user}
roomPrice={roomPrice}
otherPaymentOptions={
hotelData.data.attributes.merchantInformationData
hotelData.hotel.merchantInformationData
.alternatePaymentOptions
}
supportedCards={
hotelData.data.attributes.merchantInformationData.cards
hotelData.hotel.merchantInformationData.cards
}
mustBeGuaranteed={mustBeGuaranteed}
/>