import SettingsCard from '../../ReusableComponents/SettingsCard'; import { __ } from '@wordpress/i18n'; import { PayPalCheckbox, handleCheckboxState, } from '../../ReusableComponents/Fields'; import { useState } from '@wordpress/element'; import data from '../../../utils/data'; import { Button } from '@wordpress/components'; import TitleBadge, { TITLE_BADGE_NEGATIVE, TITLE_BADGE_POSITIVE, } from '../../ReusableComponents/TitleBadge'; const TabDashboard = () => { const [ todos, setTodos ] = useState( [] ); const [ todosData, setTodosData ] = useState( todosDataDefault ); const [ connectionData, setConnectionData ] = useState( { connectionStatus: true, showAllData: false, email: 'bt_us@woocommerce.com', merchantId: 'AT45V2DGMKLRY', clientId: 'BAARTJLxtUNN4d2GMB6Eut3suMDYad72xQA-FntdIFuJ6FmFJITxAY8', } ); const showAllData = () => { setConnectionData( { ...connectionData, showAllData: true } ); }; return (
{ todosData.length > 0 && (
{ todosData.map( ( todo ) => ( ) ) }
) } { featuresDefault.map( ( feature ) => { return ( ); } ) }
); }; const ConnectionStatus = ( { connectionData, showAllData } ) => { return (
{ __( 'Connection', 'woocommerce-paypal-payments' ) } { connectionData.connectionStatus ? ( ) : ( ) }
{ __( 'PayPal Account Details', 'woocommerce-paypal-payments' ) }
{ connectionData.connectionStatus && (
{ __( 'Email address:', 'woocommerce-paypal-payments' ) } { connectionData.email } { ! connectionData.showAllData && ( showAllData() }> { data().getImage( 'icon-arrow-down.svg', 'ppcp-r-connection-status__show-all-data' ) } ) }
{ connectionData.showAllData && ( <>
{ __( 'Merchant ID:', 'woocommerce-paypal-payments' ) } { connectionData.merchantId }
{ __( 'Client ID:', 'woocommerce-paypal-payments' ) } { connectionData.clientId }
) }
) }
); }; const FeaturesRefresh = () => { return (
{ __( 'Features', 'woocommerce-paypal-payments' ) }

{ __( 'After making changes to your PayPal account, click Refresh to update your store features.', 'woocommerce-paypal-payments' ) }

); }; const TodoItem = ( props ) => { return (
{ ' ' }

{ props.description }

removeTodo( props.value, props.todosData, props.changeTodos ) } > { data().getImage( 'icon-close.svg' ) }
); }; const FeatureItem = ( { feature } ) => { const printNotes = () => { if ( ! feature?.notes ) { return null; } if ( Array.isArray( feature.notes ) && feature.notes.length === 0 ) { return null; } return ( <>

{ feature.notes.map( ( note, index ) => { return { note }; } ) } ); }; return (
{ feature.title } { feature?.featureStatus && ( ) }

{ feature.description } { printNotes() }

{ feature.buttons.map( ( button ) => { return ( ); } ) }
); }; const removeTodo = ( todoValue, todosData, changeTodos ) => { changeTodos( todosData.filter( ( todo ) => todo.value !== todoValue ) ); }; const todosDataDefault = [ { value: 'paypal_later_messaging', description: __( 'Enable Pay Later messaging', 'woocommerce-paypal-payments' ), }, { value: 'capture_authorized_payments', description: __( 'Capture authorized payments', 'woocommerce-paypal-payments' ), }, { value: 'enable_google_pay', description: __( 'Enable Google Pay', 'woocommerce-paypal-payments' ), }, { value: 'paypal_shortcut', description: __( 'Add PayPal shortcut to the Cart page', 'woocommerce-paypal-payments' ), }, { value: 'advanced_cards', description: __( 'Add Advanced Cards to Blocks Checkout', 'woocommerce-paypal-payments' ), }, ]; const featuresDefault = [ { id: 'save_paypal_and_venmo', title: __( 'Save PayPal and Venmo', 'woocommerce-paypal-payments' ), description: __( 'Securely save PayPal and Venmo payment methods for subscriptions or return buyers.', 'woocommerce-paypal-payments' ), buttons: [ { type: 'primary', text: __( 'Configure', 'woocommerce-paypal-payments' ), url: '#', }, { type: 'secondary', text: __( 'Learn more', 'woocommerce-paypal-payments' ), url: '#', }, ], }, { id: 'advanced_credit_and_debit_cards', title: __( 'Advanced Credit and Debit Cards', 'woocommerce-paypal-payments' ), featureStatus: true, description: __( 'Process major credit and debit cards including Visa, Mastercard, American Express and Discover.', 'woocommerce-paypal-payments' ), buttons: [ { type: 'primary', text: __( 'Configure', 'woocommerce-paypal-payments' ), url: '#', }, { type: 'secondary', text: __( 'Learn more', 'woocommerce-paypal-payments' ), url: '#', }, ], }, { id: 'alternative_payment_methods', title: __( 'Alternative Payment Methods', 'woocommerce-paypal-payments' ), description: __( 'Offer global, country-specific payment options for your customers.', 'woocommerce-paypal-payments' ), buttons: [ { type: 'primary', text: __( 'Apply', 'woocommerce-paypal-payments' ), url: '#', }, { type: 'secondary', text: __( 'Learn more', 'woocommerce-paypal-payments' ), url: '#', }, ], }, { id: 'google_pay', title: __( 'Google Pay', 'woocommerce-paypal-payments' ), description: __( 'Let customers pay using their Google Pay wallet.', 'woocommerce-paypal-payments' ), featureStatus: true, buttons: [ { type: 'primary', text: __( 'Configure', 'woocommerce-paypal-payments' ), url: '#', }, { type: 'secondary', text: __( 'Learn more', 'woocommerce-paypal-payments' ), url: '#', }, ], notes: [ __( '¹PayPal Q2 Earnings-2021.', 'woocommerce-paypal-payments' ), ], }, { id: 'apple_pay', title: __( 'Apple Pay', 'woocommerce-paypal-payments' ), description: __( 'Let customers pay using their Apple Pay wallet.', 'woocommerce-paypal-payments' ), buttons: [ { type: 'primary', text: __( 'Domain registration', 'woocommerce-paypal-payments' ), url: '#', }, { type: 'secondary', text: __( 'Learn more', 'woocommerce-paypal-payments' ), url: '#', }, ], }, { id: 'pay_later_messaging', title: __( 'Pay Later Messaging', 'woocommerce-paypal-payments' ), description: __( 'Let customers know they can buy now and pay later with PayPal. Adding this messaging can boost conversion rates and increase cart sizes by 39%¹, with no extra cost to you—plus, you get paid up front.', 'woocommerce-paypal-payments' ), buttons: [ { type: 'primary', text: __( 'Configure', 'woocommerce-paypal-payments' ), url: '#', }, { type: 'secondary', text: __( 'Learn more', 'woocommerce-paypal-payments' ), url: '#', }, ], }, ]; export default TabDashboard;