Merge branch 'trunk' into PCP-2722-add-block-checkout-compatibility-to-advanced-card-processing

This commit is contained in:
Emili Castells Guasch 2024-05-23 17:29:18 +02:00
commit b95572bdad

View file

@ -70,7 +70,6 @@ class Renderer {
shouldHandleShippingInPaypal = (venmoButtonClicked) => {
if (!this.defaultSettings.should_handle_shipping_in_paypal) {
console.log('no')
return false;
}
@ -91,20 +90,26 @@ class Renderer {
let venmoButtonClicked = false;
const buttonsOptions = () => {
return {
const options = {
style,
...contextConfig,
onClick: this.onSmartButtonClick,
onClick: this.onSmartButtonClick,
onInit: (data, actions) => {
if (this.onSmartButtonsInit) {
this.onSmartButtonsInit(data, actions);
}
this.handleOnButtonsInit(wrapper, data, actions);
},
onShippingOptionsChange: (data, actions) => this.shouldHandleShippingInPaypal(venmoButtonClicked) ? handleShippingOptionsChange(data, actions, this.defaultSettings) : null,
onShippingAddressChange: (data, actions) => this.shouldHandleShippingInPaypal(venmoButtonClicked) ? handleShippingAddressChange(data, actions, this.defaultSettings) : null,
};
// Check the condition and add the onShippingOptionsChange handler if needed
if (this.shouldHandleShippingInPaypal(venmoButtonClicked)) {
options.onShippingOptionsChange = (data, actions) => null;
options.onShippingAddressChange = (data, actions) => null;
}
}
return options;
};
jQuery(document)
.off(this.reloadEventName, wrapper)