Refactor button renderer and filter woocommerce_paypal_payments_<context>_button_disabled

This commit is contained in:
Pedro Silva 2023-07-03 17:35:01 +01:00
parent 74f28ca921
commit 6b03960de7
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
7 changed files with 131 additions and 83 deletions

View file

@ -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') {