From 8682e66047ac1c8220d0d75f25bb21c169d6049c Mon Sep 17 00:00:00 2001 From: Bianca Widstam Date: Mon, 8 Dec 2025 15:00:41 +0000 Subject: [PATCH] Merged in fix/BOOK-599-filter-alert-booking-flow (pull request #3314) fix(BOOK-599): filter displayInBookingFlow alert * fix(BOOK-599): filter displayInBookingFlow alert * fix(BOOK-599): filter displayinbookingflow on confirmation page Approved-by: Linus Flood --- .../components/BookingConfirmation/index.tsx | 17 ++++++++++------- .../lib/components/SelectRate/index.tsx | 6 ++++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/booking-flow/lib/components/BookingConfirmation/index.tsx b/packages/booking-flow/lib/components/BookingConfirmation/index.tsx index a28fb0e15..905417806 100644 --- a/packages/booking-flow/lib/components/BookingConfirmation/index.tsx +++ b/packages/booking-flow/lib/components/BookingConfirmation/index.tsx @@ -2,13 +2,13 @@ import { notFound } from "next/navigation" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert" import { dt } from "@scandic-hotels/common/dt" +import { hasOverlappingDates } from "@scandic-hotels/common/dt/utils/hasOverlappingDates" import { Alert } from "@scandic-hotels/design-system/Alert" import { Divider } from "@scandic-hotels/design-system/Divider" import { HotelTypeEnum } from "@scandic-hotels/trpc/enums/hotelType" import { BookingConfirmationProvider } from "../../providers/BookingConfirmationProvider" import { getBookingConfirmation } from "../../trpc/memoizedRequests/getBookingConfirmation" -import { filterOverlappingDates } from "../../utils/SelectRate" import { SidePanel } from "../SidePanel" import { Confirmation } from "./Confirmation" import { HotelDetails } from "./HotelDetails" @@ -46,7 +46,14 @@ export async function BookingConfirmation({ if (!room) { return notFound() } - + const validAlerts = hotel.specialAlerts.filter( + (alert) => + hasOverlappingDates( + alert, + dt(booking.checkInDate), + dt(booking.checkOutDate) + ) && alert.displayInBookingFlow + ) return ( - {filterOverlappingDates( - hotel.specialAlerts, - dt(booking.checkInDate), - dt(booking.checkOutDate) - ).map((alert) => ( + {validAlerts.map((alert) => (
- hasOverlappingDates(alert, dt(booking.fromDate), dt(booking.toDate)) + const validAlerts = hotelData.hotel.specialAlerts.filter( + (alert) => + hasOverlappingDates(alert, dt(booking.fromDate), dt(booking.toDate)) && + alert.displayInBookingFlow ) return (