import { notFound } from "next/navigation" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert" import { dt } from "@scandic-hotels/common/dt" import { Alert } from "@scandic-hotels/design-system/Alert" import { Divider } from "@scandic-hotels/design-system/Divider" 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" import { PaymentDetails } from "./PaymentDetails" import { Promos } from "./Promos" import { Receipt } from "./Receipt" import { Rooms } from "./Rooms" import BookingConfirmationTracking from "./Tracking" import { mapRoomState } from "./utils" import styles from "./bookingConfirmation.module.css" import type { BookingConfirmation } from "@scandic-hotels/trpc/types/bookingConfirmation" import type { IntlShape } from "react-intl" type BookingConfirmationProps = { intl: IntlShape refId: string membershipFailedError: boolean } export async function BookingConfirmation({ intl, refId, membershipFailedError, }: BookingConfirmationProps) { const bookingConfirmation = await getBookingConfirmation(refId) if (!bookingConfirmation) { return notFound() } const { booking, hotel, room, roomCategories } = bookingConfirmation if (!room) { return notFound() } return (
{membershipFailedError && ( )} {filterOverlappingDates( hotel.specialAlerts, dt(booking.checkInDate), dt(booking.checkOutDate) ).map((alert) => (
))}
) }