From acfdb3d163dcf49668afb7a5da5090e5a88c1ea2 Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Fri, 3 Jan 2025 15:54:34 +0100 Subject: [PATCH] Extract todos data to a file --- .../Screens/Overview/TabOverview.js | 50 +------------------ .../data/settings/tab-overview-todos-data.js | 50 +++++++++++++++++++ 2 files changed, 52 insertions(+), 48 deletions(-) create mode 100644 modules/ppcp-settings/resources/js/data/settings/tab-overview-todos-data.js diff --git a/modules/ppcp-settings/resources/js/Components/Screens/Overview/TabOverview.js b/modules/ppcp-settings/resources/js/Components/Screens/Overview/TabOverview.js index ff6a15cb5..7e258eec6 100644 --- a/modules/ppcp-settings/resources/js/Components/Screens/Overview/TabOverview.js +++ b/modules/ppcp-settings/resources/js/Components/Screens/Overview/TabOverview.js @@ -11,10 +11,10 @@ import { TITLE_BADGE_POSITIVE } from '../../ReusableComponents/TitleBadge'; import { useMerchantInfo } from '../../../data/common/hooks'; import { STORE_NAME } from '../../../data/common'; import Features from './TabSettingsElements/Blocks/Features'; -import { updateQueryString } from '../../../utils/navigation'; +import { todosData } from '../../../data/settings/tab-overview-todos-data'; const TabOverview = () => { - const [ todosData ] = useState( todosDataDefault ); + //const [ todosData ] = useState( todosDataDefault ); const [ isRefreshing, setIsRefreshing ] = useState( false ); const { merchant } = useMerchantInfo(); @@ -205,50 +205,4 @@ const TabOverview = () => { ); }; -const todosDataDefault = [ - { - id: 'enable_fastlane', - title: __( 'Enable Fastlane', 'woocommerce-paypal-payments' ), - description: __( - 'Accelerate your guest checkout with Fastlane by PayPal.', - 'woocommerce-paypal-payments' - ), - isCompleted: () => { - return false; - }, - onClick: ( event ) => { - event.preventDefault(); - updateQueryString( { panel: 'payment-methods' } ); - }, - }, - { - id: 'enable_credit_debit_cards', - title: __( - 'Enable Credit and Debit Cards on your checkout', - 'woocommerce-paypal-payments' - ), - description: __( - 'Credit and Debit Cards is now available for Blocks checkout pages.', - 'woocommerce-paypal-payments' - ), - isCompleted: () => { - return false; - }, - }, - { - id: 'enable_pay_later_messaging', - title: __( - 'Enable Pay Later messaging', - 'woocommerce-paypal-payments' - ), - description: __( - 'Show Pay Later messaging to boost conversion rate and increase cart size.', - 'woocommerce-paypal-payments' - ), - isCompleted: () => { - return false; - }, - }, -]; - export default TabOverview; diff --git a/modules/ppcp-settings/resources/js/data/settings/tab-overview-todos-data.js b/modules/ppcp-settings/resources/js/data/settings/tab-overview-todos-data.js new file mode 100644 index 000000000..a67255793 --- /dev/null +++ b/modules/ppcp-settings/resources/js/data/settings/tab-overview-todos-data.js @@ -0,0 +1,50 @@ +import { __ } from '@wordpress/i18n'; +import { selectTab, TAB_IDS } from '../../utils/tabSelector'; + +export const todosData = [ + { + id: 'enable_fastlane', + title: __( 'Enable Fastlane', 'woocommerce-paypal-payments' ), + description: __( + 'Accelerate your guest checkout with Fastlane by PayPal.', + 'woocommerce-paypal-payments' + ), + isCompleted: () => { + return false; + }, + onClick: () => { + selectTab( TAB_IDS.PAYMENT_METHODS, 'ppcp-card-payments-card' ); + }, + }, + { + id: 'enable_credit_debit_cards', + title: __( + 'Enable Credit and Debit Cards on your checkout', + 'woocommerce-paypal-payments' + ), + description: __( + 'Credit and Debit Cards is now available for Blocks checkout pages.', + 'woocommerce-paypal-payments' + ), + isCompleted: () => { + return false; + }, + onClick: () => { + selectTab( TAB_IDS.PAYMENT_METHODS, 'ppcp-card-payments-card' ); + }, + }, + { + id: 'enable_pay_later_messaging', + title: __( + 'Enable Pay Later messaging', + 'woocommerce-paypal-payments' + ), + description: __( + 'Show Pay Later messaging to boost conversion rate and increase cart size.', + 'woocommerce-paypal-payments' + ), + isCompleted: () => { + return false; + }, + }, +];