mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
♻️ Refactor payment method choices
This commit is contained in:
parent
307a55b4ec
commit
618b687428
1 changed files with 30 additions and 30 deletions
|
@ -1,4 +1,5 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import { useMemo } from '@wordpress/element';
|
||||
|
||||
import { CommonHooks, OnboardingHooks } from '../../../../data';
|
||||
import { OptionSelector } from '../../../ReusableComponents/Fields';
|
||||
|
@ -6,9 +7,37 @@ import PricingDescription from '../Components/PricingDescription';
|
|||
import OnboardingHeader from '../Components/OnboardingHeader';
|
||||
import PaymentFlow from '../Components/PaymentFlow';
|
||||
|
||||
const StepPaymentMethods = ( {} ) => {
|
||||
const StepPaymentMethods = () => {
|
||||
const { optionalMethods, setOptionalMethods } =
|
||||
OnboardingHooks.useOptionalPaymentMethods();
|
||||
const { isCasualSeller } = OnboardingHooks.useBusiness();
|
||||
|
||||
const optionalMethodTitle = useMemo( () => {
|
||||
// The BCDC flow does not show a title.
|
||||
if ( isCasualSeller ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return __(
|
||||
'Available with additional application',
|
||||
'woocommerce-paypal-payments'
|
||||
);
|
||||
}, [ isCasualSeller ] );
|
||||
|
||||
const methodChoices = [
|
||||
{
|
||||
value: true,
|
||||
title: optionalMethodTitle,
|
||||
description: <OptionalMethodDescription />,
|
||||
},
|
||||
{
|
||||
title: __(
|
||||
'No thanks, I prefer to use a different provider for processing credit cards, digital wallets, and local payment methods',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
value: false,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="ppcp-r-page-optional-payment-methods">
|
||||
|
@ -45,20 +74,6 @@ const PaymentStepTitle = () => {
|
|||
);
|
||||
};
|
||||
|
||||
const OptionalMethodTitle = () => {
|
||||
const { isCasualSeller } = OnboardingHooks.useBusiness();
|
||||
|
||||
// The BCDC flow does not show a title.
|
||||
if ( isCasualSeller ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return __(
|
||||
'Available with additional application',
|
||||
'woocommerce-paypal-payments'
|
||||
);
|
||||
};
|
||||
|
||||
const OptionalMethodDescription = () => {
|
||||
const { storeCountry, storeCurrency } = CommonHooks.useWooSettings();
|
||||
const { isCasualSeller } = OnboardingHooks.useBusiness();
|
||||
|
@ -78,18 +93,3 @@ const OptionalMethodDescription = () => {
|
|||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const methodChoices = [
|
||||
{
|
||||
value: true,
|
||||
title: <OptionalMethodTitle />,
|
||||
description: <OptionalMethodDescription />,
|
||||
},
|
||||
{
|
||||
title: __(
|
||||
'No thanks, I prefer to use a different provider for processing credit cards, digital wallets, and local payment methods',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
value: false,
|
||||
},
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue