fix(SW-2929): suppress personal info on confirmation page * fix(SW-2929): suppress personal info on confirmation page Approved-by: Christian Andolf
223 lines
7.4 KiB
TypeScript
223 lines
7.4 KiB
TypeScript
"use client"
|
|
|
|
import { useIntl } from "react-intl"
|
|
|
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
|
|
|
import { CancellationRuleEnum } from "@/constants/booking"
|
|
import { dt } from "@/lib/dt"
|
|
|
|
import Image from "@/components/Image"
|
|
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
|
import useLang from "@/hooks/useLang"
|
|
|
|
import RoomDetailsSidePeek from "./RoomDetailsSidePeek"
|
|
|
|
import styles from "./room.module.css"
|
|
|
|
import type { RoomProps } from "@/types/components/hotelReservation/bookingConfirmation/rooms/room"
|
|
|
|
export default function Room({
|
|
booking,
|
|
checkInTime,
|
|
checkOutTime,
|
|
img,
|
|
roomName,
|
|
}: RoomProps) {
|
|
const intl = useIntl()
|
|
const lang = useLang()
|
|
|
|
const guestName = `${booking.guest.firstName} ${booking.guest.lastName}`
|
|
const fromDate = dt(booking.checkInDate).locale(lang)
|
|
const toDate = dt(booking.checkOutDate).locale(lang)
|
|
|
|
const isFlexBooking =
|
|
booking.rateDefinition.cancellationRule ===
|
|
CancellationRuleEnum.CancellableBefore6PM
|
|
const isChangeBooking =
|
|
booking.rateDefinition.cancellationRule === CancellationRuleEnum.Changeable
|
|
return (
|
|
<article className={styles.room}>
|
|
<header className={styles.header}>
|
|
<Typography variant="Title/Subtitle/md">
|
|
<h2>
|
|
{intl.formatMessage(
|
|
{
|
|
defaultMessage: "Booking number {value}",
|
|
},
|
|
{ value: booking.confirmationNumber }
|
|
)}
|
|
</h2>
|
|
</Typography>
|
|
{booking.rateDefinition.isMemberRate ? (
|
|
<div className={styles.benefits}>
|
|
<>
|
|
<MaterialIcon
|
|
color="Icon/Feedback/Success"
|
|
icon="check_circle"
|
|
size={20}
|
|
/>
|
|
<Caption>
|
|
{intl.formatMessage({
|
|
defaultMessage: "Membership benefits applied",
|
|
})}
|
|
</Caption>
|
|
</>
|
|
</div>
|
|
) : null}
|
|
{booking.guaranteeInfo && (
|
|
<div className={styles.benefits}>
|
|
<MaterialIcon
|
|
icon="check_circle"
|
|
color="Icon/Feedback/Success"
|
|
size={20}
|
|
/>
|
|
<Typography
|
|
variant="Body/Supporting text (caption)/smBold"
|
|
className={styles.guaranteeText}
|
|
>
|
|
<p>
|
|
{intl.formatMessage({
|
|
defaultMessage: "Booking guaranteed.",
|
|
})}
|
|
</p>
|
|
</Typography>
|
|
{/* eslint-disable formatjs/no-literal-string-in-jsx */}{" "}
|
|
{/* eslint-enable formatjs/no-literal-string-in-jsx */}
|
|
<Typography variant="Body/Supporting text (caption)/smRegular">
|
|
<p>
|
|
{intl.formatMessage({
|
|
defaultMessage:
|
|
"Your room will remain available for check-in even after 18:00.",
|
|
})}
|
|
</p>
|
|
</Typography>
|
|
</div>
|
|
)}
|
|
</header>
|
|
<div className={styles.booking}>
|
|
<Image
|
|
alt={img.metaData.altText}
|
|
className={styles.img}
|
|
focalPoint={{ x: 50, y: 50 }}
|
|
height={204}
|
|
src={img.imageSizes.medium}
|
|
style={{ borderRadius: "var(--Corner-radius-md)" }}
|
|
title={img.metaData.title}
|
|
width={204}
|
|
/>
|
|
<div className={styles.roomDetails}>
|
|
<div className={styles.roomName}>
|
|
<Typography variant="Title/Subtitle/md">
|
|
<h2>{roomName}</h2>
|
|
</Typography>
|
|
<RoomDetailsSidePeek roomTypeCode={booking.roomTypeCode} />
|
|
</div>
|
|
<Typography variant="Body/Paragraph/mdRegular">
|
|
<ul className={styles.details}>
|
|
<li className={styles.listItem}>
|
|
<p className={styles.label}>
|
|
{intl.formatMessage({
|
|
defaultMessage: "Check-in",
|
|
})}
|
|
</p>
|
|
<p>
|
|
{intl.formatMessage(
|
|
{
|
|
defaultMessage: "{checkInDate} from {checkInTime}",
|
|
},
|
|
{
|
|
checkInDate: fromDate.format("ddd, D MMM"),
|
|
checkInTime: checkInTime,
|
|
}
|
|
)}
|
|
</p>
|
|
</li>
|
|
<li className={styles.listItem}>
|
|
<p className={styles.label}>
|
|
{intl.formatMessage({
|
|
defaultMessage: "Check-out",
|
|
})}
|
|
</p>
|
|
<p>
|
|
{intl.formatMessage(
|
|
{
|
|
defaultMessage: "{checkOutDate} from {checkOutTime}",
|
|
},
|
|
{
|
|
checkOutDate: toDate.format("ddd, D MMM"),
|
|
checkOutTime: checkOutTime,
|
|
}
|
|
)}
|
|
</p>
|
|
</li>
|
|
<li className={styles.listItem}>
|
|
<p className={styles.label}>
|
|
{intl.formatMessage({
|
|
defaultMessage: "Cancellation policy",
|
|
})}
|
|
</p>
|
|
<p>{booking.rateDefinition.cancellationText}</p>
|
|
</li>
|
|
{isFlexBooking || isChangeBooking ? (
|
|
<li className={styles.listItem}>
|
|
<p className={styles.label}>
|
|
{intl.formatMessage({
|
|
defaultMessage: "Change or cancel",
|
|
})}
|
|
</p>
|
|
<p>
|
|
{intl.formatMessage(
|
|
{
|
|
defaultMessage: "Until {time}, {date}",
|
|
},
|
|
{ time: "18:00", date: fromDate.format("dddd D MMM") }
|
|
)}
|
|
</p>
|
|
</li>
|
|
) : null}
|
|
</ul>
|
|
</Typography>
|
|
<div className={styles.guest}>
|
|
<Typography variant="Body/Paragraph/mdRegular">
|
|
<p className={styles.label}>
|
|
{intl.formatMessage({
|
|
defaultMessage: "Guest",
|
|
})}
|
|
</p>
|
|
</Typography>
|
|
<Typography variant="Body/Paragraph/mdRegular">
|
|
<p data-hj-suppress>{guestName}</p>
|
|
</Typography>
|
|
{booking.guest.membershipNumber ? (
|
|
<Typography variant="Body/Paragraph/mdRegular">
|
|
<p data-hj-suppress>
|
|
{intl.formatMessage(
|
|
{
|
|
defaultMessage: "Friend no. {value}",
|
|
},
|
|
{
|
|
value: booking.guest.membershipNumber,
|
|
}
|
|
)}
|
|
</p>
|
|
</Typography>
|
|
) : null}
|
|
{booking.guest.phoneNumber ? (
|
|
<Typography variant="Body/Paragraph/mdRegular">
|
|
<p data-hj-suppress>{booking.guest.phoneNumber}</p>
|
|
</Typography>
|
|
) : null}
|
|
{booking.guest.email ? (
|
|
<Typography variant="Body/Paragraph/mdRegular">
|
|
<p data-hj-suppress>{booking.guest.email}</p>
|
|
</Typography>
|
|
) : null}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</article>
|
|
)
|
|
}
|