Merge branch 'trunk' into PCP-1486-paylater-block

This commit is contained in:
Alex P 2023-12-20 09:00:57 +02:00
commit c83975f293
No known key found for this signature in database
GPG key ID: 54487A734A204D71
54 changed files with 2315 additions and 1600 deletions

View file

@ -34,6 +34,7 @@ const PayPalComponent = ({
const {responseTypes} = emitResponse;
const [paypalOrder, setPaypalOrder] = useState(null);
const [gotoContinuationOnError, setGotoContinuationOnError] = useState(false);
const [paypalScriptLoaded, setPaypalScriptLoaded] = useState(false);
@ -165,6 +166,7 @@ const PayPalComponent = ({
if (config.finalReviewEnabled) {
location.href = getCheckoutRedirectUrl();
} else {
setGotoContinuationOnError(true);
onSubmit();
}
} catch (err) {
@ -183,7 +185,7 @@ const PayPalComponent = ({
if (config.scriptData.continuation) {
return true;
}
if (wp.data.select('wc/store/validation').hasValidationErrors()) {
if (gotoContinuationOnError && wp.data.select('wc/store/validation').hasValidationErrors()) {
location.href = getCheckoutRedirectUrl();
return { type: responseTypes.ERROR };
}
@ -191,7 +193,7 @@ const PayPalComponent = ({
return true;
});
return unsubscribe;
}, [onCheckoutValidation] );
}, [onCheckoutValidation, gotoContinuationOnError] );
const handleClick = (data, actions) => {
if (isEditing) {