2021-11-05 20:32:02 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
import { useState } from '@wordpress/element';
|
|
|
|
import { Stepper } from '@woocommerce/components';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import { Configure } from './configure';
|
|
|
|
import { StoreLocation } from '../components/store-location';
|
|
|
|
|
|
|
|
export type ManualConfigurationProps = {
|
|
|
|
isPending: boolean;
|
|
|
|
onDisable: () => void;
|
|
|
|
onAutomate: () => void;
|
|
|
|
onManual: () => void;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const ManualConfiguration: React.FC< ManualConfigurationProps > = ( {
|
|
|
|
isPending,
|
|
|
|
onDisable,
|
|
|
|
onAutomate,
|
|
|
|
onManual,
|
|
|
|
} ) => {
|
|
|
|
const [ stepIndex, setStepIndex ] = useState( 0 );
|
|
|
|
|
|
|
|
const nextStep = () => {
|
|
|
|
setStepIndex( stepIndex + 1 );
|
|
|
|
};
|
|
|
|
|
|
|
|
const stepProps = {
|
|
|
|
isPending,
|
|
|
|
onAutomate,
|
|
|
|
onDisable,
|
|
|
|
nextStep,
|
|
|
|
onManual,
|
|
|
|
};
|
|
|
|
|
|
|
|
const steps = [
|
|
|
|
{
|
|
|
|
key: 'store_location',
|
2022-03-30 09:00:04 +00:00
|
|
|
label: __( 'Set store location', 'woocommerce' ),
|
2021-11-05 20:32:02 +00:00
|
|
|
description: __(
|
|
|
|
'The address from which your business operates',
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2021-11-05 20:32:02 +00:00
|
|
|
),
|
|
|
|
content: <StoreLocation { ...stepProps } />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'manual_configuration',
|
2022-03-30 09:00:04 +00:00
|
|
|
label: __( 'Configure tax rates', 'woocommerce' ),
|
2021-11-05 20:32:02 +00:00
|
|
|
description: __(
|
|
|
|
'Head over to the tax rate settings screen to configure your tax rates',
|
2022-03-30 09:00:04 +00:00
|
|
|
'woocommerce'
|
2021-11-05 20:32:02 +00:00
|
|
|
),
|
|
|
|
content: <Configure { ...stepProps } />,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const step = steps[ stepIndex ];
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Stepper isVertical={ true } currentStep={ step.key } steps={ steps } />
|
|
|
|
);
|
|
|
|
};
|