mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 12:25:15 +08:00
Merge branch 'trunk' into PCP-3384-shipping-method-visible-in-pay-pal-popup-for-zone-that-has-no-shipping-defined-when-shipping-callback-enabled
This commit is contained in:
commit
4a72743d0f
26 changed files with 666 additions and 111 deletions
|
@ -181,9 +181,14 @@ class CheckoutBootstap {
|
|||
const isSeparateButtonGateway = [ PaymentMethods.CARD_BUTTON ].includes(
|
||||
currentPaymentMethod
|
||||
);
|
||||
const isGooglePayMethod =
|
||||
currentPaymentMethod === PaymentMethods.GOOGLEPAY;
|
||||
const isSavedCard = isCard && isSavedCardSelected();
|
||||
const isNotOurGateway =
|
||||
! isPaypal && ! isCard && ! isSeparateButtonGateway;
|
||||
! isPaypal &&
|
||||
! isCard &&
|
||||
! isSeparateButtonGateway &&
|
||||
! isGooglePayMethod;
|
||||
const isFreeTrial = PayPalCommerceGateway.is_free_trial_cart;
|
||||
const hasVaultedPaypal =
|
||||
PayPalCommerceGateway.vaulted_paypal_email !== '';
|
||||
|
@ -227,6 +232,8 @@ class CheckoutBootstap {
|
|||
}
|
||||
}
|
||||
|
||||
setVisible( '#ppc-button-ppcp-googlepay', isGooglePayMethod );
|
||||
|
||||
jQuery( document.body ).trigger( 'ppcp_checkout_rendered' );
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import { getPlanIdFromVariation } from '../Helper/Subscriptions';
|
|||
import SimulateCart from '../Helper/SimulateCart';
|
||||
import { strRemoveWord, strAddWord, throttle } from '../Helper/Utils';
|
||||
import merge from 'deepmerge';
|
||||
import { debounce } from '../../../../../ppcp-blocks/resources/js/Helper/debounce';
|
||||
|
||||
class SingleProductBootstap {
|
||||
constructor( gateway, renderer, errorHandler ) {
|
||||
|
@ -20,9 +21,13 @@ class SingleProductBootstap {
|
|||
|
||||
// Prevent simulate cart being called too many times in a burst.
|
||||
this.simulateCartThrottled = throttle(
|
||||
this.simulateCart,
|
||||
this.simulateCart.bind( this ),
|
||||
this.gateway.simulate_cart.throttling || 5000
|
||||
);
|
||||
this.debouncedHandleChange = debounce(
|
||||
this.handleChange.bind( this ),
|
||||
100
|
||||
);
|
||||
|
||||
this.renderer.onButtonsInit(
|
||||
this.gateway.button.wrapper,
|
||||
|
@ -74,7 +79,7 @@ class SingleProductBootstap {
|
|||
}
|
||||
|
||||
jQuery( document ).on( 'change', this.formSelector, () => {
|
||||
this.handleChange();
|
||||
this.debouncedHandleChange();
|
||||
} );
|
||||
this.mutationObserver.observe( form, {
|
||||
childList: true,
|
||||
|
|
|
@ -3,6 +3,7 @@ export const PaymentMethods = {
|
|||
CARDS: 'ppcp-credit-card-gateway',
|
||||
OXXO: 'ppcp-oxxo-gateway',
|
||||
CARD_BUTTON: 'ppcp-card-button-gateway',
|
||||
GOOGLEPAY: 'ppcp-googlepay',
|
||||
};
|
||||
|
||||
export const ORDER_BUTTON_SELECTOR = '#place_order';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue