import { cookies } from "next/headers" import { FamilyAndFriendsCodes } from "@scandic-hotels/common/constants/familyAndFriends" import { dt } from "@scandic-hotels/common/dt" import { HotelInfoCard } from "@scandic-hotels/design-system/HotelInfoCard" import { mapApiImagesToGalleryImages } from "../../misc/imageGallery" import { filterOverlappingDates } from "../../utils/SelectRate" import FnFNotAllowedAlert from "../FnFNotAllowedAlert" import { HotelDetailsSidePeek } from "../HotelDetailsSidePeek" import { AmenitiesSidePeekLabel } from "./AmenititesSidePeekLabel" import AvailabilityError from "./AvailabilityError" import { RoomsContainer } from "./RoomsContainer" import type { RouterOutput } from "@scandic-hotels/trpc/client" import type { SelectRateBooking } from "../../types/components/selectRate/selectRate" export { SelectRateSkeleton } from "./SelectRateSkeleton" export async function SelectRate({ booking, hotelData, }: { hotelData: NonNullable booking: SelectRateBooking }) { const bookingCode = booking.bookingCode let isInValidFNF = false if (bookingCode && FamilyAndFriendsCodes.includes(bookingCode)) { const cookieStore = await cookies() isInValidFNF = cookieStore.get("sc")?.value !== "1" } const validAlerts = filterOverlappingDates( hotelData.hotel.specialAlerts.filter((alert) => alert.displayInBookingFlow), dt.utc(booking.fromDate), dt.utc(booking.toDate) ) return ( <> ({ ...alert, heading: alert.heading ?? "", text: alert.text ?? "", }))} facilities={hotelData.hotel.detailedFacilities} slot={ } buttonVariant="primary" /> } /> {isInValidFNF ? ( ) : ( )} ) }