import { useWatch } from "react-hook-form" import { useIntl } from "react-intl" import { Divider } from "@scandic-hotels/design-system/Divider" import Checkbox from "@scandic-hotels/design-system/Form/Checkbox" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" import { GuaranteeInfo } from "../../Payment/GuaranteeInfo" import { ConfirmBookingPaymentOptions } from "../PaymentOptions" import styles from "./guarantee.module.css" import type { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" import type { CreditCard } from "@scandic-hotels/trpc/types/user" interface GuaranteeProps { mustBeGuaranteed: boolean savedCreditCards: CreditCard[] | null otherPaymentOptions?: PaymentMethodEnum[] } export function Guarantee({ mustBeGuaranteed, savedCreditCards, otherPaymentOptions, }: GuaranteeProps) { const intl = useIntl() const guarantee = useWatch({ name: "guarantee" }) return (
{!mustBeGuaranteed ? ( <>

{intl.formatMessage({ id: "enterDetails.guarantee.guaranteeLabel", defaultMessage: "Guarantee for late arrival", })}

{intl.formatMessage({ id: "enterDetails.guarantee.guaranteeInfo", defaultMessage: "I may arrive later than 18:00 and want the hotel to hold my booking.", })}

{guarantee ? : null} ) : null} {mustBeGuaranteed || guarantee ? ( <>

{intl.formatMessage({ id: "enterDetails.guarantee.paymentCardRequiredLabel", defaultMessage: "Payment card required to hold your booking", })}

{intl.formatMessage({ id: "enterDetails.guarantee.paymentCardRequiredInfo", defaultMessage: "Complete the booking and provide your payment card details in the next step.", })}

{savedCreditCards && savedCreditCards.length ? ( <> ) : null} ) : null}
) }