@empathyco/x-components
Version:
Empathy X Components
60 lines (57 loc) • 1.84 kB
JavaScript
import { setConfig, mergeConfig } from '../../../store/utils/config-store.utils.js';
import { setQuery } from '../../../store/utils/query.utils.js';
import { setStatus } from '../../../store/utils/status-store.utils.js';
import { cancelFetchAndSaveSuggestions, fetchAndSaveSuggestions } from './actions/fetch-and-save-suggestions.action.js';
import { fetchSuggestions } from './actions/fetch-suggestions.action.js';
import { setUrlParams } from './actions/set-url-params.action.js';
import { normalizedQuery } from './getters/normalized-query.getter.js';
import { querySuggestions } from './getters/query-suggestions.getter.js';
import { request } from './getters/request.getter.js';
/**
* {@link XStoreModule} For the query-suggestions module.
*
* @internal
*/
const querySuggestionsXStoreModule = {
state: () => ({
query: '',
suggestions: [],
searchedQueries: [],
status: 'initial',
config: {
debounceInMs: 200,
maxItemsToRequest: 10,
hideIfEqualsQuery: true,
hideSessionQueries: true,
},
params: {},
}),
getters: {
request,
normalizedQuery,
querySuggestions,
},
mutations: {
setQuery,
setSuggestions(state, suggestions) {
state.suggestions = suggestions;
},
setSearchedQueries(state, searchedQueries) {
state.searchedQueries = searchedQueries;
},
setStatus,
setParams(state, params) {
state.params = params;
},
setConfig,
mergeConfig,
},
actions: {
cancelFetchAndSaveSuggestions,
fetchSuggestions,
fetchAndSaveSuggestions,
setUrlParams,
},
};
export { querySuggestionsXStoreModule };
//# sourceMappingURL=module.js.map