Merged in fix/BOOK-658-remove-info-modal-prepaid-reward-night (pull request #3311)
fix(BOOK-658): show booking guaranteed if guaranteed, prepaid or reward night, and hide info icon for prepaid and reward night * fix(BOOK-658): show booking guaranteed if guaranteed, prepaid or reward night, and hide info icon for prepaid and reward night Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { CancellationRuleEnum } from "@scandic-hotels/common/constants/booking"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
@@ -12,14 +13,24 @@ import styles from "./guaranteeInfo.module.css"
|
|||||||
|
|
||||||
export default function GuaranteeInfo() {
|
export default function GuaranteeInfo() {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const { isGuaranteeable, guaranteeInfo, allRoomsAreCancelled } =
|
const { guaranteeInfo, allRoomsAreCancelled, cancellationRule, priceType } =
|
||||||
useMyStayStore((state) => ({
|
useMyStayStore((state) => ({
|
||||||
isGuaranteeable: state.bookedRoom.isGuaranteeable,
|
|
||||||
guaranteeInfo: state.bookedRoom.guaranteeInfo,
|
guaranteeInfo: state.bookedRoom.guaranteeInfo,
|
||||||
allRoomsAreCancelled: state.allRoomsAreCancelled,
|
allRoomsAreCancelled: state.allRoomsAreCancelled,
|
||||||
|
cancellationRule: state.bookedRoom.rateDefinition.cancellationRule,
|
||||||
|
priceType: state.bookedRoom.priceType,
|
||||||
}))
|
}))
|
||||||
|
const isFlexBooking =
|
||||||
|
cancellationRule === CancellationRuleEnum.CancellableBefore6PM
|
||||||
|
const isRewardNight = priceType === "points"
|
||||||
|
|
||||||
if ((isGuaranteeable && !guaranteeInfo) || allRoomsAreCancelled) {
|
const showGuaranteeInfoModal =
|
||||||
|
isFlexBooking && !!guaranteeInfo && !isRewardNight
|
||||||
|
|
||||||
|
if (
|
||||||
|
allRoomsAreCancelled ||
|
||||||
|
(!guaranteeInfo && isFlexBooking && !isRewardNight)
|
||||||
|
) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +49,7 @@ export default function GuaranteeInfo() {
|
|||||||
</div>
|
</div>
|
||||||
<Typography variant="Body/Paragraph/mdRegular">
|
<Typography variant="Body/Paragraph/mdRegular">
|
||||||
<span className={styles.guaranteeInfo}>
|
<span className={styles.guaranteeInfo}>
|
||||||
<GuaranteeInfoModal />
|
{showGuaranteeInfoModal && <GuaranteeInfoModal />}
|
||||||
{intl.formatMessage({
|
{intl.formatMessage({
|
||||||
id: "myStay.roomHeldAfter18",
|
id: "myStay.roomHeldAfter18",
|
||||||
defaultMessage: "Room held after 18:00",
|
defaultMessage: "Room held after 18:00",
|
||||||
|
|||||||
Reference in New Issue
Block a user