diff --git a/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx b/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx index 2ddbd7503..301b0c504 100644 --- a/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx +++ b/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx @@ -16,6 +16,7 @@ import Switch from "@/components/TempDesignSystem/Form/Switch" import Body from "@/components/TempDesignSystem/Text/Body" import Caption from "@/components/TempDesignSystem/Text/Caption" +import { bookingWidgetErrors } from "../../schema" import { Input as BookingWidgetInput } from "../Input" import styles from "./booking-code.module.css" @@ -26,8 +27,6 @@ import type { } from "@/types/components/bookingWidget" import type { ButtonProps } from "@/components/TempDesignSystem/Button/button" -const invalidBookingCodeMsg = "Invalid booking code" - export default function BookingCode() { const intl = useIntl() const checkIsTablet = useMediaQuery( @@ -273,8 +272,12 @@ function CodeRemember({ bookingCodeValue, onApplyClick }: CodeRememberProps) { function BookingCodeError({ codeError }: { codeError: FieldError }) { const intl = useIntl() - const isMultiroomErr = codeError.message?.indexOf("Multi-room") !== -1 - const isInvalidErr = codeError.message === invalidBookingCodeMsg + const isMultiroomErr = + codeError.message === + bookingWidgetErrors.MULTIROOM_BOOKING_CODE_UNAVAILABLE || + codeError.message === bookingWidgetErrors.MULTIROOM_REWARD_NIGHT_UNAVAILABLE + const isInvalidErr = + codeError.message === bookingWidgetErrors.BOOKING_CODE_INVALID return (