/** * External dependencies */ import { List } from '@woocommerce/components'; import { download, Icon } from '@wordpress/icons'; import { Card, CardBody, CardFooter, CardHeader, ExternalLink, Notice, ToggleControl, } from '@wordpress/components'; /** * Internal dependencies */ import strings from './strings'; import { WC_ASSET_URL } from '~/utils/admin-settings'; export interface Apm { id: string; title: string; icon: string; description: string; link: string; extension: string; } export const apms: Apm[] = [ { id: 'paypal', title: strings.apms.paypal.title, icon: `${ WC_ASSET_URL }images/payment_methods/72x72/paypal.png`, description: strings.apms.paypal.description, link: 'https://woocommerce.com/products/woocommerce-paypal-payments/', extension: 'woocommerce-paypal-payments', }, { id: 'amazonpay', title: strings.apms.amazonpay.title, icon: `${ WC_ASSET_URL }images/payment_methods/72x72/amazonpay.png`, description: strings.apms.amazonpay.description, link: 'https://woocommerce.com/products/pay-with-amazon/', extension: 'woocommerce-gateway-amazon-payments-advanced', }, { id: 'klarna', title: strings.apms.klarna.title, icon: `${ WC_ASSET_URL }images/payment_methods/72x72/klarna.png`, description: strings.apms.klarna.description, link: 'https://woocommerce.com/products/klarna-payments/', extension: 'klarna-payments-for-woocommerce', }, ]; interface ApmListProps { enabledApms: Set< Apm >; setEnabledApms: ( value: Set< Apm > ) => void; } const ApmNotice = ( { enabledApms }: { enabledApms: Set< Apm > } ) => { if ( ! enabledApms.size ) { return null; } const extensions = [ ...enabledApms ] .map( ( apm ) => apm.title ) .join( ', ' ); return (
{ strings.apms.installText( extensions ) }
); }; const ApmList: React.FunctionComponent< ApmListProps > = ( { enabledApms, setEnabledApms, } ) => { const handleToggleChange = ( apm: Apm ) => { if ( enabledApms.has( apm ) ) { enabledApms.delete( apm ); } else { enabledApms.add( apm ); } setEnabledApms( new Set< Apm >( enabledApms ) ); }; const apmsList = apms.map( ( apm ) => ( { key: apm.id, title: apm.title, content: ( <> { apm.description }{ ' ' } { strings.learnMore } ), before: , after: ( handleToggleChange( apm ) } /> ), } ) ); return ( <>

{ strings.apms.addMoreWaysToPay }

{ strings.apms.seeMore }
); }; export default ApmList;