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';
|
|
|
|
import { SETTINGS_STORE_NAME } from '@woocommerce/data';
|
|
|
|
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
|
|
|
|
2021-11-05 20:32:02 +00:00
|
|
|
export const Configure: React.FC< TaxChildProps > = ( {
|
2021-11-02 17:33:42 +00:00
|
|
|
isPending,
|
|
|
|
onManual,
|
|
|
|
} ) => {
|
|
|
|
const { generalSettings } = useSelect( ( select ) => {
|
|
|
|
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();
|
|
|
|
} }
|
|
|
|
>
|
|
|
|
{ __( 'Configure', 'woocommerce-admin' ) }
|
|
|
|
</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}}.',
|
|
|
|
/*eslint-enable max-len*/
|
|
|
|
'woocommerce-admin'
|
|
|
|
),
|
|
|
|
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"
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
} ) }
|
|
|
|
</p>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|