fix: Upgrade booking-flow eslint config * Upgrade booking-flow eslint config Approved-by: Bianca Widstam
27 lines
708 B
TypeScript
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
|
|
}
|