Skip to content

Commit

Permalink
Merge pull request #276 from newfold-labs/Press-2-1053-Remove-Tax-Step
Browse files Browse the repository at this point in the history
Remove Tax Step from ecom flow
  • Loading branch information
arunshenoy99 authored Aug 8, 2023
2 parents f7fe2a5 + f2806b3 commit dd7e7de
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 52 deletions.
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

0 comments on commit dd7e7de

Please sign in to comment.