import { __ } from '@wordpress/i18n'; import data from '../../utils/data'; import { useState } from '@wordpress/element'; const ConnectionInfo = ( { connectionStatusDataDefault } ) => { const [ connectionData, setConnectionData ] = useState( { ...connectionStatusDataDefault, } ); const showAllData = () => { setConnectionData( { ...connectionData, showAllData: ! connectionData.showAllData, } ); }; const toggleStatusClassName = [ 'ppcp-r-connection-status__status-toggle' ]; if ( connectionData.showAllData ) { toggleStatusClassName.push( 'ppcp-r-connection-status__status-toggle--toggled' ); } return (
showAllData() } > { __( 'Email address:', 'woocommerce-paypal-payments' ) } { connectionData.email } { 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 }
) }
); }; export default ConnectionInfo; export const connectionStatusDataDefault = { connectionStatus: true, showAllData: false, email: 'bt_us@woocommerce.com', merchantId: 'AT45V2DGMKLRY', clientId: 'BAARTJLxtUNN4d2GMB6Eut3suMDYad72xQA-FntdIFuJ6FmFJITxAY8', };