2022-06-23 01:54:38 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
import { Button, ExternalLink } from '@wordpress/components';
|
|
|
|
import { Pill } from '@woocommerce/components';
|
2022-06-28 05:53:03 +00:00
|
|
|
import { getNewPath, navigateTo } from '@woocommerce/navigation';
|
2022-07-06 12:00:08 +00:00
|
|
|
import { recordEvent } from '@woocommerce/tracks';
|
2023-04-25 22:17:33 +00:00
|
|
|
import { useLayoutContext } from '@woocommerce/admin-layout';
|
2022-06-23 01:54:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import './woocommerce-services-item.scss';
|
|
|
|
import WooIcon from './woo-icon.svg';
|
|
|
|
|
|
|
|
const WooCommerceServicesItem: React.FC< {
|
|
|
|
isWCSInstalled: boolean | undefined;
|
|
|
|
} > = ( { isWCSInstalled } ) => {
|
2023-04-25 22:17:33 +00:00
|
|
|
const { layoutString } = useLayoutContext();
|
|
|
|
|
2022-06-23 01:54:38 +00:00
|
|
|
const handleSetupClick = () => {
|
2022-07-06 12:00:08 +00:00
|
|
|
recordEvent( 'tasklist_click', {
|
|
|
|
task_name: 'shipping-recommendation',
|
2023-04-25 22:17:33 +00:00
|
|
|
context: `${ layoutString }/wc-settings`,
|
2022-07-06 12:00:08 +00:00
|
|
|
} );
|
2022-06-28 05:53:03 +00:00
|
|
|
navigateTo( {
|
|
|
|
url: getNewPath( { task: 'shipping-recommendation' }, '/', {} ),
|
|
|
|
} );
|
2022-06-23 01:54:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="woocommerce-list__item-inner woocommerce-services-item">
|
|
|
|
<div className="woocommerce-list__item-before">
|
|
|
|
<img
|
|
|
|
className="woocommerce-services-item__logo"
|
|
|
|
src={ WooIcon }
|
2022-07-13 15:41:22 +00:00
|
|
|
alt="WooCommerce Service Logo"
|
2022-06-23 01:54:38 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div className="woocommerce-list__item-text">
|
|
|
|
<span className="woocommerce-list__item-title">
|
2022-07-13 15:41:22 +00:00
|
|
|
{ __( 'WooCommerce Shipping', 'woocommerce' ) }
|
2022-06-23 01:54:38 +00:00
|
|
|
<Pill>{ __( 'Recommended', 'woocommerce' ) }</Pill>
|
|
|
|
</span>
|
|
|
|
<span className="woocommerce-list__item-content">
|
|
|
|
{ __(
|
|
|
|
'Print USPS and DHL Express labels straight from your WooCommerce dashboard and save on shipping.',
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
|
|
|
<br />
|
2024-04-09 08:50:15 +00:00
|
|
|
<ExternalLink href="https://woocommerce.com/woocommerce-shipping/">
|
2022-06-23 01:54:38 +00:00
|
|
|
{ __( 'Learn more', 'woocommerce' ) }
|
|
|
|
</ExternalLink>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div className="woocommerce-list__item-after">
|
|
|
|
<Button isSecondary onClick={ handleSetupClick }>
|
|
|
|
{ isWCSInstalled
|
|
|
|
? __( 'Activate', 'woocommerce' )
|
|
|
|
: __( 'Get started', 'woocommerce' ) }
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default WooCommerceServicesItem;
|