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 { HotelTypeEnum } from "@scandic-hotels/trpc/enums/hotelType" import { env } from "../../../env/server" 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, url, hotel, room, roomCategories } = bookingConfirmation const baseUrl = env.PUBLIC_URL || "https://www.scandichotels.com" const hotelUrl = new URL(`${baseUrl}${url}`) if (!room) { return notFound() } const validAlerts = filterOverlappingDates( hotel.specialAlerts.filter((alert) => alert.displayInBookingFlow), dt.utc(booking.checkInDate), dt.utc(booking.checkOutDate) ) return (
{membershipFailedError && ( )} {validAlerts.map((alert) => (
))}
) }