diff --git a/plugins/woocommerce-admin/client/analytics/report/customers/config.js b/plugins/woocommerce-admin/client/analytics/report/customers/config.js index 181f776b911..5ee8e7b1bcb 100644 --- a/plugins/woocommerce-admin/client/analytics/report/customers/config.js +++ b/plugins/woocommerce-admin/client/analytics/report/customers/config.js @@ -18,7 +18,7 @@ export const filters = [ param: 'filter', showFilters: () => true, filters: [ - { label: __( 'All Registered Customers', 'wc-admin' ), value: 'all' }, + { label: __( 'All Customers', 'wc-admin' ), value: 'all' }, { label: __( 'Advanced Filters', 'wc-admin' ), value: 'advanced' }, ], }, diff --git a/plugins/woocommerce-admin/client/analytics/report/customers/index.js b/plugins/woocommerce-admin/client/analytics/report/customers/index.js index 43faa037f02..7b68ebaee8b 100644 --- a/plugins/woocommerce-admin/client/analytics/report/customers/index.js +++ b/plugins/woocommerce-admin/client/analytics/report/customers/index.js @@ -19,6 +19,11 @@ import CustomersReportTable from './table'; export default class CustomersReport extends Component { render() { const { query, path } = this.props; + const tableQuery = { + orderby: 'date_registered', + order: 'desc', + ...query, + }; return ( @@ -29,7 +34,7 @@ export default class CustomersReport extends Component { showDatePicker={ false } advancedFilters={ advancedFilters } /> - + ); } diff --git a/plugins/woocommerce-admin/client/analytics/report/customers/table.js b/plugins/woocommerce-admin/client/analytics/report/customers/table.js index 6bc8804f377..0748db241d4 100644 --- a/plugins/woocommerce-admin/client/analytics/report/customers/table.js +++ b/plugins/woocommerce-admin/client/analytics/report/customers/table.js @@ -43,7 +43,7 @@ export default class CustomersReportTable extends Component { }, { label: __( 'Sign Up', 'wc-admin' ), - key: 'date_sign_up', + key: 'date_registered', defaultSort: true, isSortable: true, }, @@ -95,26 +95,31 @@ export default class CustomersReportTable extends Component { return customers.map( customer => { const { avg_order_value, - billing, date_last_active, - date_sign_up, + date_registered, email, - first_name, - id, - last_name, + name, + user_id, orders_count, username, total_spend, + postcode, + city, + country, } = customer; - const { postcode, city, country } = billing || {}; - const name = `${ first_name } ${ last_name }`; - const customerNameLink = ( - { email }, @@ -182,7 +187,7 @@ export default class CustomersReportTable extends Component { labels={ { placeholder: __( 'Search by customer name', 'wc-admin' ) } } searchBy="customers" searchParam="name_includes" - title={ __( 'Registered Customers', 'wc-admin' ) } + title={ __( 'Customers', 'wc-admin' ) } columnPrefsKey="customers_report_columns" /> ); diff --git a/plugins/woocommerce-admin/client/wc-api/reports/items/operations.js b/plugins/woocommerce-admin/client/wc-api/reports/items/operations.js index 5acd23fd22e..a850a119c60 100644 --- a/plugins/woocommerce-admin/client/wc-api/reports/items/operations.js +++ b/plugins/woocommerce-admin/client/wc-api/reports/items/operations.js @@ -14,10 +14,6 @@ import { stringifyQuery } from '@woocommerce/navigation'; */ import { getResourceIdentifier, getResourcePrefix } from '../../utils'; import { NAMESPACE } from '../../constants'; -import { SWAGGERNAMESPACE } from 'store/constants'; - -// TODO: Remove once swagger endpoints are phased out. -const swaggerEndpoints = [ 'customers' ]; const typeEndpointMap = { 'report-items-query-orders': 'orders', @@ -42,17 +38,11 @@ function read( resourceNames, fetch = apiFetch ) { const prefix = getResourcePrefix( resourceName ); const endpoint = typeEndpointMap[ prefix ]; const query = getResourceIdentifier( resourceName ); - const fetchArgs = { parse: false, + path: NAMESPACE + '/reports/' + endpoint + stringifyQuery( query ), }; - if ( swaggerEndpoints.indexOf( endpoint ) >= 0 ) { - fetchArgs.url = SWAGGERNAMESPACE + 'reports/' + endpoint + stringifyQuery( query ); - } else { - fetchArgs.path = NAMESPACE + '/reports/' + endpoint + stringifyQuery( query ); - } - try { const response = await fetch( fetchArgs ); const report = await response.json();