diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/CancelStay/Alerts.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/CancelStay/Alerts.tsx index 22ab89542..b1eb36b07 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/CancelStay/Alerts.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/CancelStay/Alerts.tsx @@ -2,6 +2,7 @@ import { useIntl } from "react-intl" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert" +import { CancellationRuleEnum } from "@scandic-hotels/common/constants/booking" import { Alert } from "@scandic-hotels/design-system/Alert" import { useMyStayStore } from "@/stores/my-stay" @@ -14,29 +15,53 @@ interface AlertsProps extends React.PropsWithChildren { export default function Alerts({ children, closeModal }: AlertsProps) { const intl = useIntl() - const mainRoom = useMyStayStore((state) => state.bookedRoom) - if (!mainRoom) { + const { isCancelable, cancellationRule, mainRoom } = useMyStayStore( + (state) => ({ + isCancelable: state.bookedRoom.isCancelable, + cancellationRule: state.bookedRoom.rateDefinition.cancellationRule, + mainRoom: state.bookedRoom, + }) + ) + + // If time has passed for cancellation, or if a FLEX booking no longer is cancellable, show alert + if ( + !mainRoom || + (!isCancelable && + cancellationRule === CancellationRuleEnum.CancellableBefore6PM) + ) { const title = intl.formatMessage({ id: "booking.cancelStay", defaultMessage: "Cancel stay", }) + + const heading = !mainRoom + ? intl.formatMessage({ + id: "myStay.actions.contactBooker", + defaultMessage: "Contact the person who booked the stay", + }) + : intl.formatMessage({ + id: "myStay.actions.tooLateToCancel", + defaultMessage: "Too close to arrival to cancel the stay", + }) + + const text = !mainRoom + ? intl.formatMessage({ + id: "myStay.actions.contactBooker.multiroom.cancel", + defaultMessage: + "As this is a multiroom stay, the cancellation has to be done by the person who made the booking. Please call 08-517 517 00 to talk to our customer service if you would need further assistance.", + }) + : intl.formatMessage({ + id: "myStay.actions.tooLateToCancel.text", + defaultMessage: + "Your booking can’t be cancelled after 18:00 local time on the day of arrival.", + }) + return ( - +