Files
web/packages/booking-flow/lib/hooks/useAvailablePaymentOptions.ts
Anton Gunnarsson 3e3b15940f Merged in fix/booking-flow-eslint-fix (pull request #3342)
fix: Upgrade booking-flow eslint config

* Upgrade booking-flow eslint config


Approved-by: Bianca Widstam
2025-12-12 11:40:45 +00:00

27 lines
708 B
TypeScript

"use client"
import { useEffect, useState } from "react"
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
export function useAvailablePaymentOptions(
otherPaymentOptions: PaymentMethodEnum[]
) {
const [availablePaymentOptions, setAvailablePaymentOptions] = useState<
PaymentMethodEnum[]
>(
otherPaymentOptions.filter(
(option) => option !== PaymentMethodEnum.applePay
)
)
useEffect(() => {
if (window.ApplePaySession) {
// eslint-disable-next-line react-hooks/set-state-in-effect
setAvailablePaymentOptions(otherPaymentOptions)
}
}, [otherPaymentOptions, setAvailablePaymentOptions])
return availablePaymentOptions
}