Merged in feat/SW-822-handle-breakfast-included (pull request #1138)
Feat/SW-822 handle breakfast included * feat(SW-822): Added flag for breakfast included and hide breakfast step if included * fix: check if window is defined to avoid error during SSR * fix: remove return if rate definition is not found because its expected if input is undefined Approved-by: Christel Westerberg Approved-by: Arvid Norlin
This commit is contained in:
@@ -554,14 +554,20 @@ export const hotelQueryRouter = router({
|
||||
(room) => room.roomType === selectedRoom?.roomType
|
||||
)
|
||||
if (!selectedRoom) {
|
||||
selectedRoomAvailabilityFailCounter.add(1, {
|
||||
hotelId,
|
||||
roomStayStartDate,
|
||||
roomStayEndDate,
|
||||
adults,
|
||||
children,
|
||||
bookingCode,
|
||||
error_type: "not_found",
|
||||
error: `Couldn't find selected room with input: ${roomTypeCode}`,
|
||||
})
|
||||
console.error("No matching room found")
|
||||
return null
|
||||
}
|
||||
|
||||
const rateDetails = validateAvailabilityData.data.rateDefinitions.find(
|
||||
(rateDef) => rateDef.rateCode === rateCode
|
||||
)?.generalTerms
|
||||
|
||||
const rateTypes = selectedRoom.products.find(
|
||||
(rate) =>
|
||||
rate.productType.public?.rateCode === rateCode ||
|
||||
@@ -569,20 +575,25 @@ export const hotelQueryRouter = router({
|
||||
)
|
||||
|
||||
if (!rateTypes) {
|
||||
selectedRoomAvailabilityFailCounter.add(1, {
|
||||
hotelId,
|
||||
roomStayStartDate,
|
||||
roomStayEndDate,
|
||||
adults,
|
||||
children,
|
||||
bookingCode,
|
||||
error_type: "not_found",
|
||||
error: `Couldn't find rateTypes for selected room: ${JSON.stringify(selectedRoom)}`,
|
||||
})
|
||||
console.error("No matching rate found")
|
||||
return null
|
||||
}
|
||||
const rates = rateTypes.productType
|
||||
|
||||
const mustBeGuaranteed =
|
||||
validateAvailabilityData.data.rateDefinitions.filter(
|
||||
(rate) => rate.rateCode === rateCode
|
||||
)[0].mustBeGuaranteed
|
||||
|
||||
const cancellationText =
|
||||
const rateDefinition =
|
||||
validateAvailabilityData.data.rateDefinitions.find(
|
||||
(rate) => rate.rateCode === rateCode
|
||||
)?.cancellationText ?? ""
|
||||
)
|
||||
|
||||
const bedTypes = availableRoomsInCategory
|
||||
.map((availRoom) => {
|
||||
@@ -623,9 +634,10 @@ export const hotelQueryRouter = router({
|
||||
|
||||
return {
|
||||
selectedRoom,
|
||||
rateDetails,
|
||||
mustBeGuaranteed,
|
||||
cancellationText,
|
||||
rateDetails: rateDefinition?.generalTerms,
|
||||
cancellationText: rateDefinition?.cancellationText ?? "",
|
||||
mustBeGuaranteed: !!rateDefinition?.mustBeGuaranteed,
|
||||
breakfastIncluded: !!rateDefinition?.breakfastIncluded,
|
||||
memberRate: rates?.member,
|
||||
publicRate: rates.public,
|
||||
bedTypes,
|
||||
|
||||
Reference in New Issue
Block a user