2020-04-29 18:01:27 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
import { applyFilters } from '@wordpress/hooks';
|
|
|
|
import { lazy } from '@wordpress/element';
|
|
|
|
|
|
|
|
/**
|
2020-08-13 02:05:22 +00:00
|
|
|
* Internal dependencies
|
2020-04-29 18:01:27 +00:00
|
|
|
*/
|
|
|
|
import { getSetting } from '../../settings';
|
2020-08-13 02:05:22 +00:00
|
|
|
|
2020-04-29 18:01:27 +00:00
|
|
|
const manageStock = getSetting( 'manageStock', 'no' );
|
2020-08-20 23:14:55 +00:00
|
|
|
const REPORTS_FILTER = 'woocommerce_admin_reports_list';
|
2020-04-29 18:01:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
const RevenueReport = lazy( () =>
|
|
|
|
import( /* webpackChunkName: "analytics-report-revenue" */ './revenue' )
|
|
|
|
);
|
|
|
|
const ProductsReport = lazy( () =>
|
|
|
|
import( /* webpackChunkName: "analytics-report-products" */ './products' )
|
|
|
|
);
|
2020-09-25 13:57:48 +00:00
|
|
|
const VariationsReport = lazy( () =>
|
|
|
|
import(
|
|
|
|
/* webpackChunkName: "analytics-report-variations" */ './variations'
|
|
|
|
)
|
|
|
|
);
|
2020-04-29 18:01:27 +00:00
|
|
|
const OrdersReport = lazy( () =>
|
|
|
|
import( /* webpackChunkName: "analytics-report-orders" */ './orders' )
|
|
|
|
);
|
|
|
|
const CategoriesReport = lazy( () =>
|
|
|
|
import(
|
|
|
|
/* webpackChunkName: "analytics-report-categories" */ './categories'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
const CouponsReport = lazy( () =>
|
|
|
|
import( /* webpackChunkName: "analytics-report-coupons" */ './coupons' )
|
|
|
|
);
|
|
|
|
const TaxesReport = lazy( () =>
|
|
|
|
import( /* webpackChunkName: "analytics-report-taxes" */ './taxes' )
|
|
|
|
);
|
|
|
|
const DownloadsReport = lazy( () =>
|
|
|
|
import( /* webpackChunkName: "analytics-report-downloads" */ './downloads' )
|
|
|
|
);
|
|
|
|
const StockReport = lazy( () =>
|
|
|
|
import( /* webpackChunkName: "analytics-report-stock" */ './stock' )
|
|
|
|
);
|
|
|
|
const CustomersReport = lazy( () =>
|
|
|
|
import( /* webpackChunkName: "analytics-report-customers" */ './customers' )
|
|
|
|
);
|
|
|
|
|
|
|
|
export default () => {
|
|
|
|
const reports = [
|
|
|
|
{
|
|
|
|
report: 'revenue',
|
|
|
|
title: __( 'Revenue', 'woocommerce-admin' ),
|
|
|
|
component: RevenueReport,
|
2020-12-02 22:56:24 +00:00
|
|
|
navArgs: {
|
|
|
|
id: 'woocommerce-analytics-revenue',
|
|
|
|
},
|
2020-04-29 18:01:27 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
report: 'products',
|
|
|
|
title: __( 'Products', 'woocommerce-admin' ),
|
|
|
|
component: ProductsReport,
|
2020-12-02 22:56:24 +00:00
|
|
|
navArgs: {
|
|
|
|
id: 'woocommerce-analytics-products',
|
|
|
|
},
|
2020-04-29 18:01:27 +00:00
|
|
|
},
|
2020-09-25 13:57:48 +00:00
|
|
|
{
|
|
|
|
report: 'variations',
|
|
|
|
title: __( 'Variations', 'woocommerce-admin' ),
|
|
|
|
component: VariationsReport,
|
2020-12-02 22:56:24 +00:00
|
|
|
navArgs: {
|
|
|
|
id: 'woocommerce-analytics-variations',
|
|
|
|
},
|
2020-09-25 13:57:48 +00:00
|
|
|
},
|
2020-04-29 18:01:27 +00:00
|
|
|
{
|
|
|
|
report: 'orders',
|
|
|
|
title: __( 'Orders', 'woocommerce-admin' ),
|
|
|
|
component: OrdersReport,
|
2020-12-02 22:56:24 +00:00
|
|
|
navArgs: {
|
|
|
|
id: 'woocommerce-analytics-orders',
|
|
|
|
},
|
2020-04-29 18:01:27 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
report: 'categories',
|
|
|
|
title: __( 'Categories', 'woocommerce-admin' ),
|
|
|
|
component: CategoriesReport,
|
2020-12-02 22:56:24 +00:00
|
|
|
navArgs: {
|
|
|
|
id: 'woocommerce-analytics-categories',
|
|
|
|
},
|
2020-04-29 18:01:27 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
report: 'coupons',
|
|
|
|
title: __( 'Coupons', 'woocommerce-admin' ),
|
|
|
|
component: CouponsReport,
|
2020-12-02 22:56:24 +00:00
|
|
|
navArgs: {
|
|
|
|
id: 'woocommerce-analytics-coupons',
|
|
|
|
},
|
2020-04-29 18:01:27 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
report: 'taxes',
|
|
|
|
title: __( 'Taxes', 'woocommerce-admin' ),
|
|
|
|
component: TaxesReport,
|
2020-12-02 22:56:24 +00:00
|
|
|
navArgs: {
|
|
|
|
id: 'woocommerce-analytics-taxes',
|
|
|
|
},
|
2020-04-29 18:01:27 +00:00
|
|
|
},
|
|
|
|
manageStock === 'yes'
|
|
|
|
? {
|
|
|
|
report: 'stock',
|
|
|
|
title: __( 'Stock', 'woocommerce-admin' ),
|
|
|
|
component: StockReport,
|
2020-12-02 22:56:24 +00:00
|
|
|
navArgs: {
|
|
|
|
id: 'woocommerce-analytics-stock',
|
|
|
|
},
|
2020-04-29 18:01:27 +00:00
|
|
|
}
|
|
|
|
: null,
|
|
|
|
{
|
|
|
|
report: 'customers',
|
|
|
|
title: __( 'Customers', 'woocommerce-admin' ),
|
|
|
|
component: CustomersReport,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
report: 'downloads',
|
|
|
|
title: __( 'Downloads', 'woocommerce-admin' ),
|
|
|
|
component: DownloadsReport,
|
2020-12-02 22:56:24 +00:00
|
|
|
navArgs: {
|
|
|
|
id: 'woocommerce-analytics-downloads',
|
|
|
|
},
|
2020-04-29 18:01:27 +00:00
|
|
|
},
|
|
|
|
].filter( Boolean );
|
|
|
|
|
|
|
|
return applyFilters( REPORTS_FILTER, reports );
|
|
|
|
};
|