"use client" import { useIntl } from "react-intl" import { sumPackages } from "@/components/HotelReservation/utils" import { formatPrice } from "@/utils/numberFormatting" import BoldRow from "../Bold" import RegularRow from "../Regular" import BedTypeRow from "./BedType" import PackagesRow from "./Packages" import type { CurrencyEnum } from "@/types/enums/currency" import type { SharedPriceRowProps } from "./price" export interface RegularPriceType { regular?: { currency: CurrencyEnum pricePerNight: number pricePerStay: number } } interface RegularPriceProps extends SharedPriceRowProps { price: RegularPriceType["regular"] } export default function RegularPrice({ bedType, packages, price, }: RegularPriceProps) { const intl = useIntl() if (!price) { return null } const averagePriceTitle = intl.formatMessage({ defaultMessage: "Average price per night", }) const avgeragePricePerNight = formatPrice( intl, price.pricePerNight, price.currency ) const pkgs = sumPackages(packages) const roomCharge = formatPrice( intl, price.pricePerStay + pkgs.price, price.currency ) return ( <> ) }