/** * External dependencies */ import { Button } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import apiFetch from '@wordpress/api-fetch'; import { useDispatch } from '@wordpress/data'; import { useState } from '@wordpress/element'; import { WC_ADMIN_NAMESPACE } from '@woocommerce/data'; import { Link } from '@woocommerce/components'; import interpolateComponents from '@automattic/interpolate-components'; /** * Internal dependencies */ import TimerImage from './timer.svg'; import { WC_ASSET_URL } from '../../utils/admin-settings'; const connect = ( createNotice, setIsBusy ) => { const errorMessage = __( 'There was an error connecting to WooCommerce Payments. Please try again or connect later in store settings.', 'woocommerce' ); setIsBusy( true ); apiFetch( { path: WC_ADMIN_NAMESPACE + '/plugins/connect-wcpay', method: 'POST', } ) .then( ( response ) => { window.location = response.connectUrl; } ) .catch( () => { createNotice( 'error', errorMessage ); setIsBusy( false ); } ); }; const WoocommercePaymentsHeader = ( { task, trackClick } ) => { const { createNotice } = useDispatch( 'core/notices' ); const [ isBusy, setIsBusy ] = useState( false ); const onClick = () => { trackClick(); connect( createNotice, setIsBusy ); }; return (
{

{ __( "It's time to get paid", 'woocommerce' ) }

{ __( "You're only one step away from getting paid. Verify your business details to start managing transactions with WooCommerce Payments.", 'woocommerce' ) }

{ interpolateComponents( { mixedString: __( 'By clicking "Verify Details", you agree to the {{link}}Terms of Service{{/link}}', 'woocommerce' ), components: { link: ( ), }, } ) }

Timer{ ' ' } { __( '2 minutes', 'woocommerce' ) }

); }; export default WoocommercePaymentsHeader;