mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
13 lines
440 B
JavaScript
13 lines
440 B
JavaScript
import {buttonID} from "./utils";
|
|
export const maybeShowButton = () => {
|
|
const {ApplePaySession} = window
|
|
const applePayMethodElement = document.querySelector(
|
|
'#' + buttonID,
|
|
)
|
|
const canShowButton = applePayMethodElement && (ApplePaySession && ApplePaySession.canMakePayments())
|
|
if (!canShowButton) {
|
|
console.error('This device does not support Apple Pay');
|
|
return false
|
|
}
|
|
return true
|
|
}
|