fix(SW-2385): add booking widget error messages

This commit is contained in:
Christian Andolf
2025-04-16 09:59:16 +02:00
committed by Michael Zetterberg
parent 595eb575d7
commit e544feaa36
2 changed files with 70 additions and 25 deletions

View File

@@ -1,3 +1,4 @@
import { bookingWidgetErrors } from "@/components/Forms/BookingWidget/schema"
import { editProfileErrors } from "@/components/Forms/Edit/Profile/schema"
import { signupErrors } from "@/components/Forms/Signup/schema"
import { multiroomErrors } from "@/components/HotelReservation/EnterDetails/Details/Multiroom/schema"
@@ -16,6 +17,10 @@ export function getErrorMessage(intl: IntlShape, errorCode?: string) {
return intl.formatMessage({
defaultMessage: "Invalid booking number",
})
case bookingWidgetErrors.BOOKING_CODE_INVALID:
return intl.formatMessage({
defaultMessage: "Booking code is invalid",
})
case findMyBookingErrors.FIRST_NAME_REQUIRED:
case signupErrors.FIRST_NAME_REQUIRED:
case multiroomErrors.FIRST_NAME_REQUIRED:
@@ -115,6 +120,41 @@ export function getErrorMessage(intl: IntlShape, errorCode?: string) {
return intl.formatMessage({
defaultMessage: "Invalid membership number format",
})
case bookingWidgetErrors.AGE_REQUIRED:
return intl.formatMessage({
defaultMessage: "Age is required",
})
case bookingWidgetErrors.BED_CHOICE_REQUIRED:
return intl.formatMessage({
defaultMessage: "Bed choice is required",
})
case bookingWidgetErrors.CHILDREN_EXCEEDS_ADULTS:
return intl.formatMessage({
defaultMessage:
"You cannot have more children in adults bed than adults in the room",
})
case bookingWidgetErrors.REQUIRED:
return intl.formatMessage({
defaultMessage: "Required",
})
case bookingWidgetErrors.DESTINATION_REQUIRED:
return intl.formatMessage({
defaultMessage: "Destination required",
})
case bookingWidgetErrors.MULTIROOM_BOOKING_CODE_UNAVAILABLE:
return intl.formatMessage({
defaultMessage:
"Multi-room booking is not available with this booking code.",
})
case bookingWidgetErrors.MULTIROOM_REWARD_NIGHT_UNAVAILABLE:
return intl.formatMessage({
defaultMessage:
"Multi-room booking is not available with reward night.",
})
case bookingWidgetErrors.CODE_VOUCHER_REWARD_NIGHT_UNAVAILABLE:
return intl.formatMessage({
defaultMessage: "Code and voucher is not available with reward night.",
})
default:
console.warn("Error code not supported:", errorCode)
return errorCode