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,7 +90,7 @@ class Renderer {
let venmoButtonClicked = false;
const buttonsOptions = () => {
return {
const options = {
style,
...contextConfig,
onClick: this.onSmartButtonClick,
@ -101,11 +100,17 @@ class Renderer {
}
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)
.on(this.reloadEventName, wrapper, (event, settingsOverride = {}, triggeredFundingSource) => {