/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { useSelect, useDispatch } from '@wordpress/data'; import { Button, ExternalLink } from '@wordpress/components'; import { Pill } from '@woocommerce/components'; import { PLUGINS_STORE_NAME } from '@woocommerce/data'; import { getAdminLink } from '@woocommerce/settings'; /** * Internal dependencies */ import './woocommerce-services-item.scss'; import WooIcon from './woo-icon.svg'; const WooCommerceServicesItem: React.FC< { pluginsBeingSetup: Array< string >; onSetupClick: ( slugs: string[] ) => PromiseLike< void >; } > = ( { onSetupClick, pluginsBeingSetup } ) => { const { createSuccessNotice } = useDispatch( 'core/notices' ); const isSiteConnectedToJetpack = useSelect( ( select ) => select( PLUGINS_STORE_NAME ).isJetpackConnected() ); const handleSetupClick = () => { onSetupClick( [ 'woocommerce-services' ] ).then( () => { const actions = []; if ( ! isSiteConnectedToJetpack ) { actions.push( { url: getAdminLink( 'plugins.php' ), label: __( 'Finish the setup by connecting your store to Jetpack.', 'woocommerce' ), } ); } createSuccessNotice( __( '🎉 WooCommerce Shipping is installed!', 'woocommerce' ), { actions, } ); } ); }; return (