mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-08 21:52:55 +08:00
Merge branch 'trunk' into PCP-4120-add-payment-method-modal-data-to-data-store
This commit is contained in:
commit
55a0dd4824
24 changed files with 346 additions and 181 deletions
|
@ -12,8 +12,31 @@ const SelectBox = ( props ) => {
|
|||
boxClassName += ' selected';
|
||||
}
|
||||
|
||||
const handleClick = () => {
|
||||
if ( props.type === 'checkbox' ) {
|
||||
let newValue;
|
||||
|
||||
if ( Array.isArray( props.currentValue ) ) {
|
||||
if ( props.currentValue.includes( props.value ) ) {
|
||||
newValue = props.currentValue.filter(
|
||||
( optionValue ) => optionValue !== props.value
|
||||
);
|
||||
} else {
|
||||
newValue = [ ...props.currentValue, props.value ];
|
||||
}
|
||||
} else {
|
||||
newValue = ! props.currentValue;
|
||||
}
|
||||
|
||||
props.changeCallback( newValue );
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={ boxClassName }>
|
||||
<div
|
||||
className={ boxClassName }
|
||||
onClick={ props.type === 'checkbox' ? handleClick : undefined }
|
||||
>
|
||||
{ props.type === 'radio' && (
|
||||
<PayPalRdb
|
||||
{ ...{
|
||||
|
@ -22,11 +45,7 @@ const SelectBox = ( props ) => {
|
|||
} }
|
||||
/>
|
||||
) }
|
||||
{ props.type === 'checkbox' && (
|
||||
<PayPalCheckbox
|
||||
{ ...props }
|
||||
/>
|
||||
) }
|
||||
{ props.type === 'checkbox' && <PayPalCheckbox { ...props } /> }
|
||||
<div className="ppcp-r-select-box__content">
|
||||
<div className="ppcp-r-select-box__content-inner">
|
||||
<span className="ppcp-r-select-box__title">
|
||||
|
|
|
@ -36,7 +36,8 @@ const ALL_STEPS = [
|
|||
id: 'methods',
|
||||
title: __( 'Choose checkout options', 'woocommerce-paypal-payments' ),
|
||||
StepComponent: StepPaymentMethods,
|
||||
canProceed: () => true,
|
||||
canProceed: ( { methods } ) =>
|
||||
methods.areOptionalPaymentMethodsEnabled !== null,
|
||||
},
|
||||
{
|
||||
id: 'complete',
|
||||
|
|
|
@ -136,10 +136,12 @@ export const useSteps = () => {
|
|||
export const useNavigationState = () => {
|
||||
const products = useProducts();
|
||||
const business = useBusiness();
|
||||
const methods = useOptionalPaymentMethods();
|
||||
|
||||
return {
|
||||
products,
|
||||
business,
|
||||
methods,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue