2022-08-03 17:42:22 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { recordEvent } from '@woocommerce/tracks';
|
|
|
|
import { useEffect } from '@wordpress/element';
|
2022-08-11 14:04:14 +00:00
|
|
|
import { Form } from '@woocommerce/components';
|
|
|
|
import { Product } from '@woocommerce/data';
|
2022-08-03 17:42:22 +00:00
|
|
|
|
2022-08-04 13:15:30 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2022-11-15 19:19:58 +00:00
|
|
|
import { ProductFormHeader } from './layout/product-form-header';
|
2022-08-04 13:15:30 +00:00
|
|
|
import { ProductFormLayout } from './layout/product-form-layout';
|
|
|
|
import { ProductDetailsSection } from './sections/product-details-section';
|
2022-10-12 20:11:05 +00:00
|
|
|
import { ProductInventorySection } from './sections/product-inventory-section';
|
2022-08-30 13:26:24 +00:00
|
|
|
import { PricingSection } from './sections/pricing-section';
|
2022-09-23 12:54:52 +00:00
|
|
|
import { ProductShippingSection } from './sections/product-shipping-section';
|
2022-10-12 18:16:22 +00:00
|
|
|
import { ImagesSection } from './sections/images-section';
|
2022-08-11 14:04:14 +00:00
|
|
|
import './product-page.scss';
|
2022-08-30 13:26:24 +00:00
|
|
|
import { validate } from './product-validation';
|
2022-09-26 17:44:06 +00:00
|
|
|
import { AttributesSection } from './sections/attributes-section';
|
2022-12-02 09:35:47 +00:00
|
|
|
import { ProductFormFooter } from './layout/product-form-footer';
|
2022-08-04 13:15:30 +00:00
|
|
|
|
|
|
|
const AddProductPage: React.FC = () => {
|
2022-08-03 17:42:22 +00:00
|
|
|
useEffect( () => {
|
|
|
|
recordEvent( 'view_new_product_management_experience' );
|
|
|
|
}, [] );
|
2022-08-11 14:04:14 +00:00
|
|
|
|
2022-08-03 17:42:22 +00:00
|
|
|
return (
|
|
|
|
<div className="woocommerce-add-product">
|
2022-08-30 13:26:24 +00:00
|
|
|
<Form< Partial< Product > >
|
2022-10-21 14:03:49 +00:00
|
|
|
initialValues={ {
|
2022-11-17 17:59:51 +00:00
|
|
|
reviews_allowed: true,
|
2022-10-21 14:03:49 +00:00
|
|
|
name: '',
|
|
|
|
sku: '',
|
|
|
|
stock_quantity: 0,
|
|
|
|
stock_status: 'instock',
|
|
|
|
} }
|
2022-08-30 13:26:24 +00:00
|
|
|
errors={ {} }
|
|
|
|
validate={ validate }
|
|
|
|
>
|
2022-11-15 19:19:58 +00:00
|
|
|
<ProductFormHeader />
|
2022-08-11 14:04:14 +00:00
|
|
|
<ProductFormLayout>
|
|
|
|
<ProductDetailsSection />
|
2022-08-30 13:26:24 +00:00
|
|
|
<PricingSection />
|
2022-10-12 18:16:22 +00:00
|
|
|
<ImagesSection />
|
2022-10-12 20:11:05 +00:00
|
|
|
<ProductInventorySection />
|
2022-09-23 12:54:52 +00:00
|
|
|
<ProductShippingSection />
|
2022-09-26 17:44:06 +00:00
|
|
|
<AttributesSection />
|
2022-08-11 14:04:14 +00:00
|
|
|
</ProductFormLayout>
|
2022-12-02 09:35:47 +00:00
|
|
|
<ProductFormFooter />
|
2022-08-11 14:04:14 +00:00
|
|
|
</Form>
|
2022-08-03 17:42:22 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
2022-08-04 13:15:30 +00:00
|
|
|
|
|
|
|
export default AddProductPage;
|