woocommerce/plugins/woocommerce-admin/client/analytics/report/coupons/config.js

79 lines
1.8 KiB
JavaScript
Raw Normal View History

2018-09-17 02:26:34 +00:00
/** @format */
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
2019-05-20 01:57:06 +00:00
import { applyFilters } from '@wordpress/hooks';
2018-09-17 02:26:34 +00:00
/**
* Internal dependencies
*/
import { getCouponLabels } from 'lib/async-requests';
2018-09-17 02:26:34 +00:00
2019-05-20 01:57:06 +00:00
const COUPON_REPORT_CHART_FILTER = 'woocommerce_admin_coupon_report_chart_filter';
export const charts = applyFilters( COUPON_REPORT_CHART_FILTER, [
{
key: 'orders_count',
label: __( 'Discounted Orders', 'woocommerce-admin' ),
order: 'desc',
orderby: 'orders_count',
type: 'number',
},
{
key: 'amount',
label: __( 'Amount', 'woocommerce-admin' ),
order: 'desc',
orderby: 'amount',
type: 'currency',
},
2019-05-20 01:57:06 +00:00
] );
2018-09-17 02:26:34 +00:00
export const filters = [
{
label: __( 'Show', 'woocommerce-admin' ),
2018-10-29 01:30:24 +00:00
staticParams: [],
param: 'filter',
showFilters: () => true,
filters: [
{ label: __( 'All Coupons', 'woocommerce-admin' ), value: 'all' },
{
label: __( 'Single Coupon', 'woocommerce-admin' ),
value: 'select_coupon',
chartMode: 'item-comparison',
subFilters: [
{
component: 'Search',
value: 'single_coupon',
chartMode: 'item-comparison',
path: [ 'select_coupon' ],
settings: {
type: 'coupons',
param: 'coupons',
getLabels: getCouponLabels,
labels: {
placeholder: __( 'Type to search for a coupon', 'woocommerce-admin' ),
button: __( 'Single Coupon', 'woocommerce-admin' ),
},
},
},
],
},
2018-10-29 01:30:24 +00:00
{
label: __( 'Comparison', 'woocommerce-admin' ),
value: 'compare-coupons',
2018-10-29 01:30:24 +00:00
settings: {
type: 'coupons',
param: 'coupons',
getLabels: getCouponLabels,
2018-10-29 01:30:24 +00:00
labels: {
title: __( 'Compare Coupon Codes', 'woocommerce-admin' ),
update: __( 'Compare', 'woocommerce-admin' ),
helpText: __( 'Check at least two coupon codes below to compare', 'woocommerce-admin' ),
2018-10-29 01:30:24 +00:00
},
},
2018-09-17 02:26:34 +00:00
},
2018-10-29 01:30:24 +00:00
],
2018-09-17 02:26:34 +00:00
},
];