Files
web/apps/scandic-web/components/HotelReservation/BookingConfirmation/Alerts/index.tsx
Arvid Norlin d5e5b9a526 Merged in feat/SW-1652-confirmation-page-multiroom (pull request #1404)
feat(SW-1652): Fetching additional rooms on confirmation page

* feat(SW-1652): Fetching additional rooms on confirmation page


Approved-by: Tobias Johansson
2025-02-26 12:42:54 +00:00

51 lines
2.3 KiB
TypeScript

"use client"
import { useSearchParams } from "next/navigation"
import { useIntl } from "react-intl"
import { MEMBERSHIP_FAILED_ERROR } from "@/constants/booking"
import Alert from "@/components/TempDesignSystem/Alert"
import type { BookingConfirmationAlertsProps } from "@/types/components/hotelReservation/bookingConfirmation/bookingConfirmation"
import { AlertTypeEnum } from "@/types/enums/alert"
export default function Alerts({ booking }: BookingConfirmationAlertsProps) {
const intl = useIntl()
const searchParams = useSearchParams()
const membershipFailedError =
searchParams.get("errorCode") === MEMBERSHIP_FAILED_ERROR
const failedToVerifyMembership =
booking.rateDefinition.isMemberRate && !booking.guest.membershipNumber
return (
<>
{/* Customer has manually entered a membership number for which verification failed */}
{membershipFailedError && (
<Alert
type={AlertTypeEnum.Info}
heading={intl.formatMessage({
id: "Failed to verify membership",
})}
text={intl.formatMessage({
id: "The first or last name doesn't match the membership number you provided. Your booking(s) is confirmed but to get the membership attached you'll need to present your existing membership number upon check-in. If you have booked with a member discount, you'll either need to present your existing membership number upon check-in, become a member or pay the price difference at the hotel. Signing up is preferably done online before the stay, or we can assist upon arrival.",
})}
/>
)}
{/* For some other reason membership could not be verified */}
{!membershipFailedError && failedToVerifyMembership && (
<Alert
type={AlertTypeEnum.Info}
heading={intl.formatMessage({
id: "Failed to verify membership",
})}
text={intl.formatMessage({
id: "Your booking(s) is confirmed but we could not verify your membership. If you have booked with a member discount, you'll either need to present your existing membership number upon check-in, become a member or pay the price difference at the hotel. Signing up is preferably done online before the stay.",
})}
/>
)}
</>
)
}