Merged in fix/SW-2402-hide-gla-rewardNight (pull request #1983)

fix(SW-2042): hide guarantee late arrival on my stay for rewardNight

* fix(SW-2042): hide guarantee late arrival on my stay for rewardNight


Approved-by: Niclas Edenvin
This commit is contained in:
Bianca Widstam
2025-05-06 14:16:34 +00:00
parent f8b87f0142
commit 343caed40c
2 changed files with 17 additions and 7 deletions

View File

@@ -16,16 +16,22 @@ import styles from "./guarantee.module.css"
export default function GuaranteeLateArrival() {
const intl = useIntl()
const { checkInDate, checkInTime, guaranteeInfo, isCancelled } =
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 isRewardNight = priceType === "points"
const guaranteeable =
!guaranteeInfo && !isCancelled && !dateHasPassed(checkInDate, checkInTime)
!guaranteeInfo &&
!isCancelled &&
!dateHasPassed(checkInDate, checkInTime) &&
!isRewardNight
if (!guaranteeable) {
return null

View File

@@ -10,12 +10,16 @@ import styles from "./guaranteeInfo.module.css"
export default function GuaranteeInfo() {
const intl = useIntl()
const { allRoomsAreCancelled, guaranteeInfo } = useMyStayStore((state) => ({
allRoomsAreCancelled: state.allRoomsAreCancelled,
guaranteeInfo: state.bookedRoom.guaranteeInfo,
}))
const { allRoomsAreCancelled, guaranteeInfo, priceType } = useMyStayStore(
(state) => ({
allRoomsAreCancelled: state.allRoomsAreCancelled,
guaranteeInfo: state.bookedRoom.guaranteeInfo,
priceType: state.bookedRoom.priceType,
})
)
if (allRoomsAreCancelled || !guaranteeInfo) {
const isRewardNight = priceType === "points"
if (allRoomsAreCancelled || (!guaranteeInfo && !isRewardNight)) {
return null
}