mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Refactor button renderer and filter woocommerce_paypal_payments_<context>_button_disabled
This commit is contained in:
parent
74f28ca921
commit
6b03960de7
7 changed files with 131 additions and 83 deletions
|
@ -122,21 +122,10 @@ const bootstrap = () => {
|
|||
}
|
||||
};
|
||||
|
||||
let smartButtonsOptions = {
|
||||
onInit: null,
|
||||
init: function (actions) {
|
||||
this.actions = actions;
|
||||
if (typeof this.onInit === 'function') {
|
||||
this.onInit();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const onSmartButtonsInit = (data, actions) => {
|
||||
const onSmartButtonsInit = () => {
|
||||
buttonsSpinner.unblock();
|
||||
smartButtonsOptions.init(actions);
|
||||
};
|
||||
const renderer = new Renderer(creditCardRenderer, PayPalCommerceGateway, onSmartButtonClick, onSmartButtonsInit, smartButtonsOptions);
|
||||
const renderer = new Renderer(creditCardRenderer, PayPalCommerceGateway, onSmartButtonClick, onSmartButtonsInit);
|
||||
const messageRenderer = new MessageRenderer(PayPalCommerceGateway.messages);
|
||||
const context = PayPalCommerceGateway.context;
|
||||
if (context === 'mini-cart' || context === 'product') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue