/** * External dependencies */ import { useMemo } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { PaymentGateway } from '@woocommerce/data'; /** * Internal dependencies */ import './settings-payments-main.scss'; import { PaymentMethod } from './components/payment-method'; import { OtherPaymentMethods } from './components/other-payment-methods'; import { PaymentsBannerWrapper } from '~/payments/payment-settings-banner'; export const SettingsPaymentsMain: React.FC = () => { const [ paymentGateways, error ] = useMemo( () => { const script = document.getElementById( 'experimental_wc_settings_payments_gateways' ); try { if ( script && script.textContent ) { return [ JSON.parse( script.textContent ) as PaymentGateway[], null, ]; } throw new Error( 'Could not find payment gateways data' ); } catch ( e ) { return [ [], e as Error ]; } }, [] ); if ( error ) { // This is a temporary error message to be replaced by error boundary. return (

{ __( 'Error loading payment gateways', 'woocommerce' ) }

{ error.message }

); } return (
{ paymentGateways.map( ( gateway: PaymentGateway ) => ( ) ) }
{ __( 'Method', 'woocommerce' ) } { __( 'Enabled', 'woocommerce' ) } { __( 'Description', 'woocommerce' ) }
); }; export default SettingsPaymentsMain;