2021-11-02 17:33:42 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
import { Button } from '@wordpress/components';
|
2022-02-21 02:34:25 +00:00
|
|
|
import interpolateComponents from '@automattic/interpolate-components';
|
2021-11-02 17:33:42 +00:00
|
|
|
import { Link } from '@woocommerce/components';
|
|
|
|
import { recordEvent } from '@woocommerce/tracks';
|
2022-04-21 05:10:56 +00:00
|
|
|
import { SETTINGS_STORE_NAME, WCDataSelector } from '@woocommerce/data';
|
2021-11-02 17:33:42 +00:00
|
|
|
import { useSelect } from '@wordpress/data';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2021-11-05 20:32:02 +00:00
|
|
|
import { SettingsSelector, TaxChildProps } from '../utils';
|
2021-11-02 17:33:42 +00:00
|
|
|
|
2022-04-21 05:10:56 +00:00
|
|
|
export const Configure: React.FC<
|
|
|
|
Pick< TaxChildProps, 'isPending' | 'onManual' >
|
|
|
|
> = ( { isPending, onManual } ) => {
|
2022-04-25 05:49:11 +00:00
|
|
|
const { generalSettings } = useSelect( ( select ) => {
|
2021-11-02 17:33:42 +00:00
|
|
|
const { getSettings } = select(
|
|
|
|
SETTINGS_STORE_NAME
|
|
|
|
) as SettingsSelector;
|
|
|
|
|
|
|
|
return {
|
|
|
|
generalSettings: getSettings( 'general' )?.general,
|
|
|
|
};
|
|
|
|
} );
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Button
|
|
|
|
isPrimary
|
|
|
|
disabled={ isPending }
|
|
|
|
isBusy={ isPending }
|
|
|
|
onClick={ () => {
|
|
|
|
recordEvent( 'tasklist_tax_config_rates', {} );
|
|
|
|
onManual();
|
|
|
|
} }
|
|
|
|
>
|
2022-03-30 09:00:04 +00:00
|
|
|
{ __( 'Configure', 'woocommerce' ) }
|
2021-11-02 17:33:42 +00:00
|
|
|
</Button>
|
|
|
|
<p>
|
|
|
|
{ generalSettings.woocommerce_calc_taxes !== 'yes' &&
|
|
|
|
interpolateComponents( {
|
|
|
|
mixedString: __(
|
|
|
|
/*eslint-disable max-len*/
|
|
|
|
'By clicking "Configure" you\'re enabling tax rates and calculations. More info {{link}}here{{/link}}.',
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2021-11-02 17:33:42 +00:00
|
|
|
),
|
|
|
|
components: {
|
|
|
|
link: (
|
|
|
|
<Link
|
2022-01-04 09:03:58 +00:00
|
|
|
href="https://woocommerce.com/document/setting-up-taxes-in-woocommerce/?utm_medium=product#section-1"
|
2021-11-02 17:33:42 +00:00
|
|
|
target="_blank"
|
|
|
|
type="external"
|
2022-04-21 05:10:56 +00:00
|
|
|
>
|
|
|
|
<></>
|
|
|
|
</Link>
|
2021-11-02 17:33:42 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
} ) }
|
|
|
|
</p>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|