import { Typography } from "@scandic-hotels/design-system/Typography" import Divider from "@/components/TempDesignSystem/Divider" import { getIntl } from "@/i18n" import styles from "./specification.module.css" import type { SpecificationProps } from "@/types/components/hotelReservation/myStay/receipt" import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" export default async function Specification({ ancillaryPackages, booking, currency, }: SpecificationProps) { const intl = await getIntl() const breakfastPackages = booking.packages.filter( (p) => p.type === "Breakfast" ) const breakfastTotalPriceInMoney = breakfastPackages .filter((p) => p.currency !== "Points") .reduce((acc, curr) => acc + curr.totalPrice, 0) const breakfastTotalPriceInPoints = breakfastPackages .filter((p) => p.currency === "Points") .reduce((acc, curr) => acc + curr.totalPrice, 0) const breakfastCount = breakfastPackages.reduce( (acc, curr) => acc + curr.unit, 0 ) const breakfastMoneyString = breakfastTotalPriceInMoney > 0 ? `${breakfastTotalPriceInMoney} ${currency}` : "" const breakfastPointsString = breakfastTotalPriceInPoints > 0 ? `${breakfastTotalPriceInPoints} ${intl.formatMessage({ id: "Points" })}` : "" const breakfastPlusString = breakfastMoneyString && breakfastPointsString ? " + " : "" const petRoomPackage = booking.packages.find( (p) => p.code === RoomPackageCodeEnum.PET_ROOM ) const roomPriceExclVat = booking.roomPrice - (booking.roomPrice * booking.vatPercentage) / 100 const roomPriceVat = booking.roomPrice - roomPriceExclVat return (