Merge pull request #2457 from woocommerce/PCP-3321-separate-apple-pay-button-for-classic-checkout

Separate Apple Pay button for Classic Checkout (3321)
This commit is contained in:
Emili Castells 2024-08-22 11:37:05 +02:00 committed by GitHub
commit fbd7dc1857
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 929 additions and 394 deletions

View file

@ -1,3 +1,5 @@
/* global PayPalCommerceGateway */
import CheckoutActionHandler from '../ActionHandler/CheckoutActionHandler';
import { setVisible, setVisibleByClass } from '../Helper/Hiding';
import {
@ -197,12 +199,15 @@ class CheckoutBootstap {
);
const isGooglePayMethod =
currentPaymentMethod === PaymentMethods.GOOGLEPAY;
const isApplePayMethod =
currentPaymentMethod === PaymentMethods.APPLEPAY;
const isSavedCard = isCard && isSavedCardSelected();
const isNotOurGateway =
! isPaypal &&
! isCard &&
! isSeparateButtonGateway &&
! isGooglePayMethod;
! isGooglePayMethod &&
! isApplePayMethod;
const isFreeTrial = PayPalCommerceGateway.is_free_trial_cart;
const hasVaultedPaypal =
PayPalCommerceGateway.vaulted_paypal_email !== '';
@ -257,6 +262,8 @@ class CheckoutBootstap {
paymentMethod: currentPaymentMethod,
} );
setVisible( '#ppc-button-ppcp-applepay', isApplePayMethod );
document.body.dispatchEvent( new Event( 'ppcp_checkout_rendered' ) );
}

View file

@ -4,6 +4,7 @@ export const PaymentMethods = {
OXXO: 'ppcp-oxxo-gateway',
CARD_BUTTON: 'ppcp-card-button-gateway',
GOOGLEPAY: 'ppcp-googlepay',
APPLEPAY: 'ppcp-applepay',
};
/**