diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/ControlToggleButton.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/ControlToggleButton.js new file mode 100644 index 000000000..da4500086 --- /dev/null +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/ControlToggleButton.js @@ -0,0 +1,19 @@ +import { ToggleControl } from '@wordpress/components'; +import { Action, Description } from '../Elements'; + +const ControlToggleButton = ( { label, description, value, onChange } ) => { + return ( + + { description } } + /> + + ); +}; + +export default ControlToggleButton; diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/ToggleSettingsBlock.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/ToggleSettingsBlock.js deleted file mode 100644 index 644cbf9b8..000000000 --- a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/ToggleSettingsBlock.js +++ /dev/null @@ -1,27 +0,0 @@ -import { ToggleControl } from '@wordpress/components'; -import SettingsBlock from '../SettingsBlock'; -import { Header, Title, Action, Description } from '../Elements'; - -const ToggleSettingsBlock = ( { title, description, ...props } ) => ( - - - - props.actionProps?.callback( - props.actionProps?.key, - newValue - ) - } - /> - -
- { title && { title } } - { description && { description } } -
-
-); - -export default ToggleSettingsBlock; diff --git a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/index.js b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/index.js index cda0bc9f0..192f9ee3c 100644 --- a/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/index.js +++ b/modules/ppcp-settings/resources/js/Components/ReusableComponents/SettingsBlocks/index.js @@ -1,10 +1,10 @@ export { default as ButtonSettingsBlock } from './ButtonSettingsBlock'; export { default as SelectSettingsBlock } from './SelectSettingsBlock'; export { default as AccordionSettingsBlock } from './AccordionSettingsBlock'; -export { default as ToggleSettingsBlock } from './ToggleSettingsBlock'; export { default as RadioSettingsBlock } from './RadioSettingsBlock'; export { default as PaymentMethodsBlock } from './PaymentMethodsBlock'; export { default as PaymentMethodItemBlock } from './PaymentMethodItemBlock'; export { default as ControlStaticValue } from './ControlStaticValue'; export { default as ControlTextInput } from './ControlTextInput'; +export { default as ControlToggleButton } from './ControlToggleButton'; diff --git a/modules/ppcp-settings/resources/js/Components/Screens/Overview/TabSettingsElements/Blocks/PaypalSettings.js b/modules/ppcp-settings/resources/js/Components/Screens/Overview/TabSettingsElements/Blocks/PaypalSettings.js index a8561adac..1aa23f134 100644 --- a/modules/ppcp-settings/resources/js/Components/Screens/Overview/TabSettingsElements/Blocks/PaypalSettings.js +++ b/modules/ppcp-settings/resources/js/Components/Screens/Overview/TabSettingsElements/Blocks/PaypalSettings.js @@ -2,7 +2,7 @@ import { __ } from '@wordpress/i18n'; import { AccordionSettingsBlock, RadioSettingsBlock, - ToggleSettingsBlock, + ControlToggleButton, ControlTextInput, SelectSettingsBlock, } from '../../../../ReusableComponents/SettingsBlocks'; @@ -66,7 +66,7 @@ const PaypalSettings = ( { updateFormValue, settings } ) => { } } /> - { value: settings.payNowExperience, } } > - { } = SettingsHooks.useSettings(); return ( - -
- - { __( 'Order Intent', 'woocommerce-paypal-payments' ) } - - - { __( - 'Choose between immediate capture or authorization-only, with manual capture in the Order section.', - 'woocommerce-paypal-payments' - ) } - -
- - + -
); diff --git a/modules/ppcp-settings/resources/js/Components/Screens/Settings/Components/Settings/Blocks/PayNowExperience.js b/modules/ppcp-settings/resources/js/Components/Screens/Settings/Components/Settings/Blocks/PayNowExperience.js index ff529cf43..abbccd0d2 100644 --- a/modules/ppcp-settings/resources/js/Components/Screens/Settings/Components/Settings/Blocks/PayNowExperience.js +++ b/modules/ppcp-settings/resources/js/Components/Screens/Settings/Components/Settings/Blocks/PayNowExperience.js @@ -1,24 +1,28 @@ import { __ } from '@wordpress/i18n'; -import { ToggleSettingsBlock } from '../../../../../ReusableComponents/SettingsBlocks'; + +import { ControlToggleButton } from '../../../../../ReusableComponents/SettingsBlocks'; import { SettingsHooks } from '../../../../../../data'; +import SettingsBlock from '../../../../../ReusableComponents/SettingsBlock'; const PayNowExperience = () => { const { payNowExperience, setPayNowExperience } = SettingsHooks.useSettings(); return ( - + + + ); }; diff --git a/modules/ppcp-settings/resources/js/Components/Screens/Settings/Components/Settings/Blocks/SavePaymentMethods.js b/modules/ppcp-settings/resources/js/Components/Screens/Settings/Components/Settings/Blocks/SavePaymentMethods.js index 8d0329de4..3fe2172c4 100644 --- a/modules/ppcp-settings/resources/js/Components/Screens/Settings/Components/Settings/Blocks/SavePaymentMethods.js +++ b/modules/ppcp-settings/resources/js/Components/Screens/Settings/Components/Settings/Blocks/SavePaymentMethods.js @@ -5,7 +5,7 @@ import { Description, } from '../../../../../ReusableComponents/Elements'; import SettingsBlock from '../../../../../ReusableComponents/SettingsBlock'; -import { ToggleSettingsBlock } from '../../../../../ReusableComponents/SettingsBlocks'; +import { ControlToggleButton } from '../../../../../ReusableComponents/SettingsBlocks'; import { SettingsHooks } from '../../../../../../data'; const SavePaymentMethods = () => { @@ -17,51 +17,37 @@ const SavePaymentMethods = () => { } = SettingsHooks.useSettings(); return ( - -
- - { __( - 'Save payment methods', - 'woocommerce-paypal-payments' - ) } - - - { __( - "Securely store customers' payment methods for future payments and subscriptions, simplifying checkout and enabling recurring transactions.", - 'woocommerce-paypal-payments' - ) } - -
- - + This will disable all Pay Later features and Alternative Payment Methods on your site.', - 'woocommerce-paypal-payments' - ), - 'https://woocommerce.com/document/woocommerce-paypal-payments/#pay-later', - 'https://woocommerce.com/document/woocommerce-paypal-payments/#alternative-payment-methods' - ), - } } - /> - } - actionProps={ { - value: savePaypalAndVenmo, - callback: setSavePaypalAndVenmo, - key: 'savePaypalAndVenmo', - } } + description={ sprintf( + /* translators: 1: URL to Pay Later documentation, 2: URL to Alternative Payment Methods documentation */ + __( + 'Securely store your customers\' PayPal accounts for a seamless checkout experience.
This will disable all Pay Later features and Alternative Payment Methods on your site.', + 'woocommerce-paypal-payments' + ), + 'https://woocommerce.com/document/woocommerce-paypal-payments/#pay-later', + 'https://woocommerce.com/document/woocommerce-paypal-payments/#alternative-payment-methods' + ) } + value={ savePaypalAndVenmo } + onChange={ setSavePaypalAndVenmo } /> - { "Securely store your customer's credit card.", 'woocommerce-paypal-payments' ) } - actionProps={ { - callback: setSaveCardDetails, - key: 'saveCreditCardAndDebitCard', - value: saveCardDetails, - } } + onChange={ setSaveCardDetails } + value={ saveCardDetails } />
);