Merged in chore/move-enter-details (pull request #2778)
Chore/move enter details Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
"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) {
|
||||
setAvailablePaymentOptions(otherPaymentOptions)
|
||||
}
|
||||
}, [otherPaymentOptions, setAvailablePaymentOptions])
|
||||
|
||||
return availablePaymentOptions
|
||||
}
|
||||
Reference in New Issue
Block a user