| 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 |
termCount, |
| 22 |
requestIdBase, |
| 23 |
showSuggestions, |
| 24 |
suggestionsBehavior, |
| 25 |
} = window.epInstantResults; |
| 26 |
|
| 27 |
/** |
| 28 |
* Sorting options configuration. |
| 29 |
*/ |
| 30 |
const sortOptions = { |
| 31 |
relevance_desc: { |
| 32 |
name: __('Most relevant', 'elasticpress'), |
| 33 |
orderby: 'relevance', |
| 34 |
order: 'desc', |
| 35 |
currencyCode, |
| 36 |
}, |
| 37 |
date_desc: { |
| 38 |
name: __('Date, newest to oldest', 'elasticpress'), |
| 39 |
orderby: 'date', |
| 40 |
order: 'desc', |
| 41 |
}, |
| 42 |
date_asc: { |
| 43 |
name: __('Date, oldest to newest', 'elasticpress'), |
| 44 |
orderby: 'date', |
| 45 |
order: 'asc', |
| 46 |
}, |
| 47 |
}; |
| 48 |
|
| 49 |
/** |
| 50 |
* Sort by price is only available for WooCommerce. |
| 51 |
*/ |
| 52 |
if (isWooCommerce) { |
| 53 |
sortOptions.price_desc = { |
| 54 |
name: __('Price, highest to lowest', 'elasticpress'), |
| 55 |
orderby: 'price', |
| 56 |
order: 'desc', |
| 57 |
}; |
| 58 |
|
| 59 |
sortOptions.price_asc = { |
| 60 |
name: __('Price, lowest to highest', 'elasticpress'), |
| 61 |
orderby: 'price', |
| 62 |
order: 'asc', |
| 63 |
}; |
| 64 |
} |
| 65 |
|
| 66 |
export { |
| 67 |
apiEndpoint, |
| 68 |
apiHost, |
| 69 |
argsSchema, |
| 70 |
currencyCode, |
| 71 |
facets, |
| 72 |
isWooCommerce, |
| 73 |
locale, |
| 74 |
matchType, |
| 75 |
paramPrefix, |
| 76 |
postTypeLabels, |
| 77 |
sortOptions, |
| 78 |
taxonomyLabels, |
| 79 |
termCount, |
| 80 |
requestIdBase, |
| 81 |
showSuggestions, |
| 82 |
suggestionsBehavior, |
| 83 |
}; |
| 84 |
|