| 1 |
/** |
| 2 |
* WordPress dependencies. |
| 3 |
*/ |
| 4 |
import { __ } from '@wordpress/i18n'; |
| 5 |
|
| 6 |
/** |
| 7 |
* Window dependencies. |
| 8 |
*/ |
| 9 |
const { |
| 10 |
apiEndpoint, |
| 11 |
apiHost, |
| 12 |
argsSchema, |
| 13 |
currencyCode, |
| 14 |
facets, |
| 15 |
isWooCommerce, |
| 16 |
locale, |
| 17 |
matchType, |
| 18 |
paramPrefix, |
| 19 |
postTypeLabels, |
| 20 |
taxonomyLabels, |
| 21 |
} = window.epInstantResults; |
| 22 |
|
| 23 |
/** |
| 24 |
* Sorting options configuration. |
| 25 |
*/ |
| 26 |
const sortOptions = { |
| 27 |
relevance_desc: { |
| 28 |
name: __('Most relevant', 'elasticpress'), |
| 29 |
orderby: 'relevance', |
| 30 |
order: 'desc', |
| 31 |
currencyCode, |
| 32 |
}, |
| 33 |
date_desc: { |
| 34 |
name: __('Date, newest to oldest', 'elasticpress'), |
| 35 |
orderby: 'date', |
| 36 |
order: 'desc', |
| 37 |
}, |
| 38 |
date_asc: { |
| 39 |
name: __('Date, oldest to newest', 'elasticpress'), |
| 40 |
orderby: 'date', |
| 41 |
order: 'asc', |
| 42 |
}, |
| 43 |
}; |
| 44 |
|
| 45 |
/** |
| 46 |
* Sort by price is only available for WooCommerce. |
| 47 |
*/ |
| 48 |
if (isWooCommerce) { |
| 49 |
sortOptions.price_desc = { |
| 50 |
name: __('Price, highest to lowest', 'elasticpress'), |
| 51 |
orderby: 'price', |
| 52 |
order: 'desc', |
| 53 |
}; |
| 54 |
|
| 55 |
sortOptions.price_asc = { |
| 56 |
name: __('Price, lowest to highest', 'elasticpress'), |
| 57 |
orderby: 'price', |
| 58 |
order: 'asc', |
| 59 |
}; |
| 60 |
} |
| 61 |
|
| 62 |
export { |
| 63 |
apiEndpoint, |
| 64 |
apiHost, |
| 65 |
argsSchema, |
| 66 |
currencyCode, |
| 67 |
facets, |
| 68 |
isWooCommerce, |
| 69 |
locale, |
| 70 |
matchType, |
| 71 |
paramPrefix, |
| 72 |
postTypeLabels, |
| 73 |
sortOptions, |
| 74 |
taxonomyLabels, |
| 75 |
}; |
| 76 |
|