Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Tax Step from ecom flow #276

Merged
merged 6 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/OnboardingSPA/components/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,18 @@ const App = () => {
}

async function syncStoreDetails() {
const { address, tax } = currentData.storeDetails;
const { address } = currentData.storeDetails;
let payload = {};
if ( address !== undefined ) {
delete address.country;
delete address.state;
payload = address;
}
if ( tax !== undefined ) {
delete tax.option;
delete tax.isStoreDetailsFilled;
payload = { ...payload, ...tax };
}
// if ( tax !== undefined ) {
// delete tax.option;
// delete tax.isStoreDetailsFilled;
// payload = { ...payload, ...tax };
// }
if ( ! isEmpty( payload ) ) {
await updateWPSettings( payload );
}
Expand Down
39 changes: 19 additions & 20 deletions src/OnboardingSPA/data/routes/ecommerce-flow.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { __ } from '@wordpress/i18n';
import { store, institution, shipping } from '@wordpress/icons';
import { store, shipping } from '@wordpress/icons';
import { lazy } from '@wordpress/element';
// eslint-disable-next-line import/no-extraneous-dependencies
import { orderBy, filter } from 'lodash';
Expand All @@ -19,10 +19,10 @@ const StepAddressLearnMoreSidebar = lazy( () =>
import( '../../pages/Steps/Ecommerce/StepAddress/Sidebar/LearnMore/' )
);

const StepTax = lazy( () => import( '../../pages/Steps/Ecommerce/StepTax' ) );
const StepTaxLearnMoreSidebar = lazy( () =>
import( '../../pages/Steps/Ecommerce/StepTax/Sidebar/LearnMore/' )
);
// const StepTax = lazy( () => import( '../../pages/Steps/Ecommerce/StepTax' ) );
// const StepTaxLearnMoreSidebar = lazy( () =>
// import( '../../pages/Steps/Ecommerce/StepTax/Sidebar/LearnMore/' )
// );

const StepProducts = lazy( () =>
import( '../../pages/Steps/Ecommerce/StepProducts' )
Expand Down Expand Up @@ -52,21 +52,20 @@ export const ecommerceSteps = [
},
},
},
{
path: '/ecommerce/step/tax',
title: __( 'Tax Info', 'wp-module-onboarding' ),
chapter: CHAPTER_COMMERCE,
tooltipText: __( 'Tax Info', 'wp-module-onboarding' ),
Component: StepTax,
Icon: institution,
priority: 90,
VIEW: VIEW_NAV_ECOMMERCE_STORE_INFO,
sidebars: {
LearnMore: {
SidebarComponents: [ StepTaxLearnMoreSidebar ],
},
},
},
// {
// path: '/ecommerce/step/tax',
// title: __( 'Tax Info', 'wp-module-onboarding' ),
// tooltipText: __( 'Tax Info', 'wp-module-onboarding' ),
// Component: StepTax,
// Icon: institution,
// priority: 90,
// VIEW: VIEW_NAV_ECOMMERCE_STORE_INFO,
// sidebars: {
// LearnMore: {
// SidebarComponents: [ StepTaxLearnMoreSidebar ],
// },
// },
// },
{
path: '/ecommerce/step/products',
title: __( 'Product Info', 'wp-module-onboarding' ),
Expand Down
30 changes: 4 additions & 26 deletions src/OnboardingSPA/pages/Steps/Ecommerce/StepAddress/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useViewportMatch } from '@wordpress/compose';
import { useDispatch, useSelect } from '@wordpress/data';
import { useEffect, useState } from '@wordpress/element';
import { useNavigate } from 'react-router-dom';
import {
SIDEBAR_LEARN_MORE,
VIEW_NAV_ECOMMERCE_STORE_INFO,
Expand All @@ -16,10 +15,10 @@ import currencies from '../currencies.json';
import { useWPSettings as getWPSettings } from '../useWPSettings';
import Animate from '../../../../components/Animate';
import getContents from './contents';
import NavCardButton from '../../../../components/Button/NavCardButton';

const StepAddress = () => {
const [ settings, setSettings ] = useState();
const navigate = useNavigate();
const isLargeViewport = useViewportMatch( 'medium' );
const {
setDrawerActiveView,
Expand Down Expand Up @@ -210,24 +209,6 @@ const StepAddress = () => {
<div className="onboarding-ecommerce-step">
<form
className="onboarding-ecommerce-step"
onSubmit={ ( event ) => {
event.preventDefault();
event.stopPropagation();
//Commented as auto-calculate tax option is removed for MMP

// let selectedTaxOption = content.stepTaxOptions.find((option) =>
// Object.entries(option.data).every(
// ([optionName, requiredValue]) =>
// settings?.[optionName] === requiredValue
// )
// );
// navigate(
// selectedTaxOption === undefined
// ? '/ecommerce/step/tax'
// : '/ecommerce/step/products'
// );
navigate( '/ecommerce/step/tax' );
} }
style={ {
display: 'grid',
justifyItems: 'center',
Expand Down Expand Up @@ -418,13 +399,10 @@ const StepAddress = () => {
</em>
</div>
</Animate>
<button
className="nfd-nav-card-button nfd-card-button"
<NavCardButton
text={ content.buttonText }
disabled={ address === undefined }
type="submit"
>
{ content.buttonText }
</button>
/>
</form>
<NeedHelpTag />
</div>
Expand Down