Merged in fix/STAY-22-GLA-check (pull request #3134)

fix: Let API handle logic for if a booking is guaranteeable or not

* fix: Let API handle logic for if a booking is guaranteeable or not


Approved-by: Bianca Widstam
Approved-by: Erik Tiekstra
This commit is contained in:
Christel Westerberg
2025-11-12 12:40:23 +00:00
parent 593cb04a5a
commit 8dce04b931
2 changed files with 5 additions and 18 deletions

View File

@@ -10,7 +10,6 @@ import Modal from "@/components/HotelReservation/MyStay/Modal"
import { trackMyStayPageLink } from "@/utils/tracking"
import ActionsButton from "../ActionsButton"
import { dateHasPassed } from "../utils"
import Form from "./Form"
import styles from "./guarantee.module.css"
@@ -18,24 +17,11 @@ import styles from "./guarantee.module.css"
export default function GuaranteeLateArrival() {
const intl = useIntl()
const { checkInDate, checkInTime, guaranteeInfo, isCancelled, priceType } =
useMyStayStore((state) => ({
checkInDate: state.bookedRoom.checkInDate,
checkInTime: state.hotel.hotelFacts.checkin.checkInTime,
guaranteeInfo: state.bookedRoom.guaranteeInfo,
isCancelled: state.bookedRoom.isCancelled,
priceType: state.bookedRoom.priceType,
}))
const { isGuaranteeable } = useMyStayStore((state) => ({
isGuaranteeable: state.bookedRoom.isGuaranteeable,
}))
const isRewardNight = priceType === "points"
const guaranteeable =
!guaranteeInfo &&
!isCancelled &&
!dateHasPassed(checkInDate, checkInTime) &&
!isRewardNight
if (!guaranteeable) {
if (!isGuaranteeable) {
return null
}