@empathyco/x-components 8.15.1 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/browse/index.js +1 -2
- package/core/index.js +0 -1
- package/core/index.js.map +1 -1
- package/docs/API-reference/api/x-adapter-platform.facetschema.md +1 -1
- package/docs/API-reference/api/x-adapter-platform.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformfacet.md +1 -1
- package/docs/API-reference/api/x-adapter-platform.platformfacet.values.md +1 -1
- package/docs/API-reference/api/x-adapter-platform.platformfacettype.md +1 -1
- package/docs/API-reference/api/x-adapter-platform.platformsliderfilter.max.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformsliderfilter.md +90 -0
- package/docs/API-reference/api/x-adapter-platform.platformsliderfilter.min.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformsliderfilter.unit.md +11 -0
- package/docs/API-reference/api/x-components.baseslider.md +2 -8
- package/docs/API-reference/api/x-components.browseactions.md +0 -19
- package/docs/API-reference/api/x-components.browsemutations.md +0 -19
- package/docs/API-reference/api/x-components.facetsxevents.md +19 -0
- package/docs/API-reference/api/x-components.facetsxevents.usermodifiedsliderfilter.md +13 -0
- package/docs/API-reference/api/x-components.gethashfromquerypreviewinfo.md +72 -0
- package/docs/API-reference/api/x-components.gethashfromquerypreviewitem.md +56 -0
- package/docs/API-reference/api/x-components.hierarchicalfilter.md +1 -0
- package/docs/API-reference/api/x-components.md +22 -121
- package/docs/API-reference/api/x-components.queriespreviewactions.md +0 -19
- package/docs/API-reference/api/x-components.queriespreviewmutations.md +0 -19
- package/docs/API-reference/api/x-components.recommendationsactions.md +0 -38
- package/docs/API-reference/api/x-components.recommendationsmutations.md +0 -19
- package/docs/API-reference/api/x-components.searchactions.md +0 -38
- package/docs/API-reference/api/x-components.searchmutations.md +0 -38
- package/docs/API-reference/api/x-components.simplefilter.md +1 -0
- package/docs/API-reference/api/x-components.snippetcallbacks.md +1 -0
- package/docs/API-reference/api/x-types.facetmodelname.md +1 -1
- package/docs/API-reference/api/x-types.filtermodelname.md +1 -1
- package/docs/API-reference/api/x-types.issliderfacet.md +56 -0
- package/docs/API-reference/api/x-types.issliderfilter.md +56 -0
- package/docs/API-reference/api/x-types.md +44 -0
- package/docs/API-reference/api/x-types.sliderfacet.filters.md +13 -0
- package/docs/API-reference/api/x-types.sliderfacet.md +78 -0
- package/docs/API-reference/api/x-types.sliderfacet.modelname.md +13 -0
- package/docs/API-reference/api/x-types.sliderfilter.md +116 -0
- package/docs/API-reference/api/x-types.sliderfilter.modelname.md +13 -0
- package/docs/API-reference/api/x-types.sliderfilter.range.md +16 -0
- package/docs/API-reference/api/x-types.sliderfilter.selectedrange.md +13 -0
- package/docs/API-reference/api/x-types.sliderfilter.unit.md +13 -0
- package/docs/API-reference/components/common/x-components.base-slider.md +1 -1
- package/docs/API-reference/components/facets/x-components.filters/slider-filter.md +33 -0
- package/facets/index.js +1 -0
- package/js/components/base-slider.vue.js +12 -3
- package/js/components/base-slider.vue.js.map +1 -1
- package/js/components/base-slider.vue2.js +1 -1
- package/js/components/base-slider.vue2.js.map +1 -1
- package/js/index.js +5 -7
- package/js/index.js.map +1 -1
- package/js/x-modules/browse/store/module.js +0 -6
- package/js/x-modules/browse/store/module.js.map +1 -1
- package/js/x-modules/browse/wiring.js +1 -8
- package/js/x-modules/browse/wiring.js.map +1 -1
- package/js/x-modules/facets/entities/filter-entity.factory.js +2 -0
- package/js/x-modules/facets/entities/filter-entity.factory.js.map +1 -1
- package/js/x-modules/facets/entities/slider-filter.entity.js +107 -0
- package/js/x-modules/facets/entities/slider-filter.entity.js.map +1 -0
- package/js/x-modules/facets/wiring.js +3 -0
- package/js/x-modules/facets/wiring.js.map +1 -1
- package/js/x-modules/queries-preview/store/module.js +0 -9
- package/js/x-modules/queries-preview/store/module.js.map +1 -1
- package/js/x-modules/queries-preview/wiring.js +2 -11
- package/js/x-modules/queries-preview/wiring.js.map +1 -1
- package/js/x-modules/recommendations/store/module.js +0 -7
- package/js/x-modules/recommendations/store/module.js.map +1 -1
- package/js/x-modules/recommendations/wiring.js +0 -9
- package/js/x-modules/recommendations/wiring.js.map +1 -1
- package/js/x-modules/search/store/module.js +2 -17
- package/js/x-modules/search/store/module.js.map +1 -1
- package/js/x-modules/search/wiring.js +2 -18
- package/js/x-modules/search/wiring.js.map +1 -1
- package/package.json +4 -4
- package/queries-preview/index.js +2 -1
- package/report/x-adapter-platform.api.json +130 -4
- package/report/x-components.api.json +222 -1163
- package/report/x-components.api.md +36 -82
- package/report/x-types.api.json +351 -2
- package/search/index.js +1 -3
- package/types/src/components/base-slider.vue.d.ts +3 -8
- package/types/src/components/base-slider.vue.d.ts.map +1 -1
- package/types/src/components/snippet-callbacks.vue.d.ts +1 -0
- package/types/src/components/snippet-callbacks.vue.d.ts.map +1 -1
- package/types/src/services/index.d.ts +0 -1
- package/types/src/services/index.d.ts.map +1 -1
- package/types/src/services/services.types.d.ts +0 -21
- package/types/src/services/services.types.d.ts.map +1 -1
- package/types/src/x-modules/browse/store/actions/index.d.ts +0 -1
- package/types/src/x-modules/browse/store/actions/index.d.ts.map +1 -1
- package/types/src/x-modules/browse/store/module.d.ts.map +1 -1
- package/types/src/x-modules/browse/store/types.d.ts +0 -12
- package/types/src/x-modules/browse/store/types.d.ts.map +1 -1
- package/types/src/x-modules/browse/wiring.d.ts +0 -7
- package/types/src/x-modules/browse/wiring.d.ts.map +1 -1
- package/types/src/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +1 -0
- package/types/src/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
- package/types/src/x-modules/facets/components/filters/simple-filter.vue.d.ts +1 -0
- package/types/src/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
- package/types/src/x-modules/facets/entities/filter-entity.factory.d.ts.map +1 -1
- package/types/src/x-modules/facets/entities/index.d.ts +1 -0
- package/types/src/x-modules/facets/entities/index.d.ts.map +1 -1
- package/types/src/x-modules/facets/entities/slider-filter.entity.d.ts +65 -0
- package/types/src/x-modules/facets/entities/slider-filter.entity.d.ts.map +1 -0
- package/types/src/x-modules/facets/events.types.d.ts +6 -1
- package/types/src/x-modules/facets/events.types.d.ts.map +1 -1
- package/types/src/x-modules/facets/wiring.d.ts +3 -0
- package/types/src/x-modules/facets/wiring.d.ts.map +1 -1
- package/types/src/x-modules/queries-preview/index.d.ts +1 -0
- package/types/src/x-modules/queries-preview/index.d.ts.map +1 -1
- package/types/src/x-modules/queries-preview/store/module.d.ts.map +1 -1
- package/types/src/x-modules/queries-preview/store/types.d.ts +0 -17
- package/types/src/x-modules/queries-preview/store/types.d.ts.map +1 -1
- package/types/src/x-modules/queries-preview/wiring.d.ts +0 -9
- package/types/src/x-modules/queries-preview/wiring.d.ts.map +1 -1
- package/types/src/x-modules/recommendations/store/module.d.ts.map +1 -1
- package/types/src/x-modules/recommendations/store/types.d.ts +0 -17
- package/types/src/x-modules/recommendations/store/types.d.ts.map +1 -1
- package/types/src/x-modules/recommendations/wiring.d.ts +0 -3
- package/types/src/x-modules/recommendations/wiring.d.ts.map +1 -1
- package/types/src/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -1
- package/types/src/x-modules/search/store/actions/index.d.ts +0 -2
- package/types/src/x-modules/search/store/actions/index.d.ts.map +1 -1
- package/types/src/x-modules/search/store/module.d.ts.map +1 -1
- package/types/src/x-modules/search/store/types.d.ts +0 -24
- package/types/src/x-modules/search/store/types.d.ts.map +1 -1
- package/types/src/x-modules/search/wiring.d.ts +0 -16
- package/types/src/x-modules/search/wiring.d.ts.map +1 -1
- package/docs/API-reference/api/x-components.browseactions.fetchandsaveresultsenrichment.md +0 -13
- package/docs/API-reference/api/x-components.browsemutations.updateresultsfromenrichment.md +0 -13
- package/docs/API-reference/api/x-components.cancelfetchandsavepartialresultsenrichment.md +0 -17
- package/docs/API-reference/api/x-components.cancelfetchandsaveresultsenrichment.md +0 -17
- package/docs/API-reference/api/x-components.defaultresultsenrichmentservice._constructor_.md +0 -13
- package/docs/API-reference/api/x-components.defaultresultsenrichmentservice.fetchresults.md +0 -52
- package/docs/API-reference/api/x-components.defaultresultsenrichmentservice.instance.md +0 -13
- package/docs/API-reference/api/x-components.defaultresultsenrichmentservice.md +0 -164
- package/docs/API-reference/api/x-components.defaultresultsenrichmentservice.store.md +0 -11
- package/docs/API-reference/api/x-components.defaultresultsenrichmentservice.updateresults.md +0 -66
- package/docs/API-reference/api/x-components.fetchandsavebrowseresultsenrichment.md +0 -66
- package/docs/API-reference/api/x-components.fetchandsavebrowseresultsenrichmentwire.md +0 -13
- package/docs/API-reference/api/x-components.fetchandsavepartialresultsenrichment.md +0 -66
- package/docs/API-reference/api/x-components.fetchandsavepartialresultsenrichmentwire.md +0 -13
- package/docs/API-reference/api/x-components.fetchandsavequerypreviewresultsenrichmentwire.md +0 -13
- package/docs/API-reference/api/x-components.fetchandsaveresultsenrichment.md +0 -66
- package/docs/API-reference/api/x-components.fetchandsaveresultsenrichmentwire.md +0 -13
- package/docs/API-reference/api/x-components.queriespreviewactions.fetchandsavequerypreviewresultsenrichment.md +0 -13
- package/docs/API-reference/api/x-components.queriespreviewmutations.updatequerypreviewresultsfromenrichment.md +0 -16
- package/docs/API-reference/api/x-components.recommendationsactions.cancelfetchandsaverecommendationsenrichment.md +0 -13
- package/docs/API-reference/api/x-components.recommendationsactions.fetchandsaverecommendationsenrichment.md +0 -13
- package/docs/API-reference/api/x-components.recommendationsmutations.updaterecommendationsfromenrichment.md +0 -13
- package/docs/API-reference/api/x-components.resultsenrichmentservice.fetchresults.md +0 -13
- package/docs/API-reference/api/x-components.resultsenrichmentservice.md +0 -77
- package/docs/API-reference/api/x-components.resultsenrichmentservice.updateresults.md +0 -13
- package/docs/API-reference/api/x-components.searchactions.fetchandsavepartialresultsenrichment.md +0 -13
- package/docs/API-reference/api/x-components.searchactions.fetchandsaveresultsenrichment.md +0 -13
- package/docs/API-reference/api/x-components.searchmutations.updatepartialresultsfromenrichment.md +0 -13
- package/docs/API-reference/api/x-components.searchmutations.updateresultsfromenrichment.md +0 -13
- package/js/services/results-enrichment.service.js +0 -37
- package/js/services/results-enrichment.service.js.map +0 -1
- package/js/x-modules/browse/store/actions/fetch-and-save-results-enrichment.action.js +0 -21
- package/js/x-modules/browse/store/actions/fetch-and-save-results-enrichment.action.js.map +0 -1
- package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview-results-enrichment.action.js +0 -21
- package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview-results-enrichment.action.js.map +0 -1
- package/js/x-modules/recommendations/store/actions/fetch-and-save-recommendations-enrichment.action.js +0 -30
- package/js/x-modules/recommendations/store/actions/fetch-and-save-recommendations-enrichment.action.js.map +0 -1
- package/js/x-modules/search/store/actions/fetch-and-save-partial-results-enrichment.action.js +0 -33
- package/js/x-modules/search/store/actions/fetch-and-save-partial-results-enrichment.action.js.map +0 -1
- package/js/x-modules/search/store/actions/fetch-and-save-results-enrichment.action.js +0 -28
- package/js/x-modules/search/store/actions/fetch-and-save-results-enrichment.action.js.map +0 -1
- package/types/src/services/results-enrichment.service.d.ts +0 -31
- package/types/src/services/results-enrichment.service.d.ts.map +0 -1
- package/types/src/x-modules/browse/store/actions/fetch-and-save-results-enrichment.action.d.ts +0 -17
- package/types/src/x-modules/browse/store/actions/fetch-and-save-results-enrichment.action.d.ts.map +0 -1
- package/types/src/x-modules/queries-preview/store/actions/fetch-and-save-query-preview-results-enrichment.action.d.ts +0 -3
- package/types/src/x-modules/queries-preview/store/actions/fetch-and-save-query-preview-results-enrichment.action.d.ts.map +0 -1
- package/types/src/x-modules/recommendations/store/actions/fetch-and-save-recommendations-enrichment.action.d.ts +0 -17
- package/types/src/x-modules/recommendations/store/actions/fetch-and-save-recommendations-enrichment.action.d.ts.map +0 -1
- package/types/src/x-modules/search/store/actions/fetch-and-save-partial-results-enrichment.action.d.ts +0 -17
- package/types/src/x-modules/search/store/actions/fetch-and-save-partial-results-enrichment.action.d.ts.map +0 -1
- package/types/src/x-modules/search/store/actions/fetch-and-save-results-enrichment.action.d.ts +0 -17
- package/types/src/x-modules/search/store/actions/fetch-and-save-results-enrichment.action.d.ts.map +0 -1
|
@@ -50,12 +50,6 @@ const saveBrowseOriginWire = wireDispatch('saveOrigin', ({ metadata }) => metada
|
|
|
50
50
|
* @public
|
|
51
51
|
*/
|
|
52
52
|
const fetchAndSaveBrowseResponseWire = wireDispatch('fetchAndSaveBrowseResponse');
|
|
53
|
-
/**
|
|
54
|
-
* Requests and stores the enrichment results for the results.
|
|
55
|
-
*
|
|
56
|
-
* @public
|
|
57
|
-
*/
|
|
58
|
-
const fetchAndSaveBrowseResultsEnrichmentWire = wireDispatch('fetchAndSaveResultsEnrichment');
|
|
59
53
|
/**
|
|
60
54
|
* Sets the browse state `selectedCategory`.
|
|
61
55
|
*
|
|
@@ -176,7 +170,6 @@ const browseWiring = createWiring({
|
|
|
176
170
|
},
|
|
177
171
|
ResultsChanged: {
|
|
178
172
|
resetBrowseAppending,
|
|
179
|
-
fetchAndSaveBrowseResultsEnrichmentWire,
|
|
180
173
|
},
|
|
181
174
|
ReloadBrowseRequested: {
|
|
182
175
|
resetBrowseStateForReloadWire,
|
|
@@ -214,5 +207,5 @@ const browseWiring = createWiring({
|
|
|
214
207
|
},
|
|
215
208
|
});
|
|
216
209
|
|
|
217
|
-
export { browseWiring, cancelFetchAndSaveBrowseResponseWire, clearBrowseQuery, fetchAndSaveBrowseResponseWire,
|
|
210
|
+
export { browseWiring, cancelFetchAndSaveBrowseResponseWire, clearBrowseQuery, fetchAndSaveBrowseResponseWire, increaseBrowsePageAppendingResultsWire, resetBrowseAppending, resetBrowseRequestOnRefinementWire, resetBrowseStateForReloadWire, resetBrowseStateIfNoRequestWire, resetFromNoBrowseResultsWithFilters, resetIsNoBrowseResults, saveBrowseOriginWire, setBrowseCategory, setBrowseExtraParams, setBrowsePage, setBrowseSelectedFilters, setBrowseSort, setBrowseUrlParamsWire };
|
|
218
211
|
//# sourceMappingURL=wiring.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/browse/wiring.ts"],"sourcesContent":["import type { WirePayload } from '../../wiring'\nimport type { InternalBrowseRequest } from './types'\nimport {\n createWiring,\n filterTruthyPayload,\n namespacedWireCommit,\n namespacedWireCommitWithoutPayload,\n namespacedWireDispatch,\n namespacedWireDispatchWithoutPayload,\n} from '../../wiring'\n\n/**\n * `browse` {@link XModuleName | XModule name}.\n *\n * @internal\n */\nconst moduleName = 'browse'\n\n/**\n * WireCommit for {@link BrowseXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit(moduleName)\n\n/**\n * WireCommit without Payload for {@link BrowseXModule}.\n *\n * @internal\n */\nconst wireCommitWithoutPayload = namespacedWireCommitWithoutPayload(moduleName)\n\n/**\n * WireDispatch for {@link BrowseXModule}.\n *\n * @internal\n */\nconst wireDispatch = namespacedWireDispatch(moduleName)\n\n/**\n * WireDispatchWithoutPayload for {@link BrowseXModule}.\n *\n * @internal\n */\nconst wireDispatchWithoutPayload = namespacedWireDispatchWithoutPayload(moduleName)\n\n/**\n * Cancels the {@link BrowseActions.fetchAndSaveBrowseResponse} request promise.\n *\n * @public\n */\nexport const cancelFetchAndSaveBrowseResponseWire = wireDispatchWithoutPayload(\n 'cancelFetchAndSaveBrowseResponse',\n)\n\n/**\n * Sets the browse state `origin`.\n *\n * @public\n */\nexport const saveBrowseOriginWire = wireDispatch('saveOrigin', ({ metadata }) => metadata)\n\n/**\n * Requests and stores the browse response.\n *\n * @public\n */\nexport const fetchAndSaveBrowseResponseWire = wireDispatch('fetchAndSaveBrowseResponse')\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/browse/wiring.ts"],"sourcesContent":["import type { WirePayload } from '../../wiring'\nimport type { InternalBrowseRequest } from './types'\nimport {\n createWiring,\n filterTruthyPayload,\n namespacedWireCommit,\n namespacedWireCommitWithoutPayload,\n namespacedWireDispatch,\n namespacedWireDispatchWithoutPayload,\n} from '../../wiring'\n\n/**\n * `browse` {@link XModuleName | XModule name}.\n *\n * @internal\n */\nconst moduleName = 'browse'\n\n/**\n * WireCommit for {@link BrowseXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit(moduleName)\n\n/**\n * WireCommit without Payload for {@link BrowseXModule}.\n *\n * @internal\n */\nconst wireCommitWithoutPayload = namespacedWireCommitWithoutPayload(moduleName)\n\n/**\n * WireDispatch for {@link BrowseXModule}.\n *\n * @internal\n */\nconst wireDispatch = namespacedWireDispatch(moduleName)\n\n/**\n * WireDispatchWithoutPayload for {@link BrowseXModule}.\n *\n * @internal\n */\nconst wireDispatchWithoutPayload = namespacedWireDispatchWithoutPayload(moduleName)\n\n/**\n * Cancels the {@link BrowseActions.fetchAndSaveBrowseResponse} request promise.\n *\n * @public\n */\nexport const cancelFetchAndSaveBrowseResponseWire = wireDispatchWithoutPayload(\n 'cancelFetchAndSaveBrowseResponse',\n)\n\n/**\n * Sets the browse state `origin`.\n *\n * @public\n */\nexport const saveBrowseOriginWire = wireDispatch('saveOrigin', ({ metadata }) => metadata)\n\n/**\n * Requests and stores the browse response.\n *\n * @public\n */\nexport const fetchAndSaveBrowseResponseWire = wireDispatch('fetchAndSaveBrowseResponse')\n\n/**\n * Sets the browse state `selectedCategory`.\n *\n * @public\n */\nexport const setBrowseCategory = wireCommit('setSelectedCategory')\n\n/**\n * Clears the browse state `selectedCategory`.\n *\n * @public\n */\nexport const clearBrowseQuery = wireCommit('setSelectedCategory', {\n browseField: '',\n browseValue: '',\n})\n\n/**\n * Sets the browse state `selectedFilters`.\n *\n * @public\n */\nexport const setBrowseSelectedFilters = wireCommit('setSelectedFilters')\n\n/**\n * Sets the browse state `sort`.\n *\n * @public\n */\nexport const setBrowseSort = wireCommit('setSort')\n\n/**\n * Sets the browse state `query`.\n *\n * @public\n */\nexport const setBrowseUrlParamsWire = wireDispatch('setUrlParams')\n\n/**\n * Sets the browse state `page`.\n *\n * @public\n */\nexport const setBrowsePage = wireCommit('setPage')\n\n/**\n * Sets the browse state `params`.\n *\n * @public\n */\nexport const setBrowseExtraParams = wireCommit('setParams')\n\n/**\n * Resets the browse state to reload the current browse.\n *\n * @public\n */\nexport const resetBrowseStateForReloadWire = wireCommitWithoutPayload('resetStateForReload')\n\n/**\n * Resets the browse state `isNoResults`.\n *\n * @public\n */\nexport const resetIsNoBrowseResults = wireCommit('setIsNoResults', false)\n\n/**\n * Resets the browse state `fromNoResultsWithFilters`.\n *\n * @public\n */\nexport const resetFromNoBrowseResultsWithFilters = wireCommit('setFromNoResultsWithFilters', false)\n\n/**\n * Increases the current browse state `page` by one.\n *\n * @public\n */\nexport const increaseBrowsePageAppendingResultsWire = wireDispatchWithoutPayload(\n 'increasePageAppendingResults',\n)\n\n/**\n * Resets the browse state `isAppendingResults`.\n *\n * @public\n */\nexport const resetBrowseAppending = wireCommit('setIsAppendResults', false)\n\n/**\n * Resets the {@link BrowseGetters.request} parameters when refining request and before the actual\n * request is launched.\n *\n * @public\n */\nexport const resetBrowseRequestOnRefinementWire = wireDispatch(\n 'resetRequestOnRefinement',\n ({ eventPayload: newRequest, metadata: { oldValue } }: WirePayload<InternalBrowseRequest>) => ({\n newRequest,\n oldRequest: oldValue as InternalBrowseRequest,\n }),\n)\n\n/**\n * Resets the browse state when the request is changed to null. See the\n * {@link BrowseXStoreModule} for details.\n *\n * @public\n */\nexport const resetBrowseStateIfNoRequestWire = filterTruthyPayload<InternalBrowseRequest | null>(\n wireCommitWithoutPayload('resetState'),\n)\n\n/**\n * Browse wiring.\n *\n * @internal\n */\nexport const browseWiring = createWiring({\n ParamsLoadedFromUrl: {\n setBrowseUrlParamsWire,\n saveBrowseOriginWire,\n },\n UserClickedABrowseSort: {\n setBrowseSort,\n },\n UserReachedResultsListEnd: {\n increaseBrowsePageAppendingResultsWire,\n },\n BrowseRequestUpdated: {\n resetBrowseStateIfNoRequestWire,\n fetchAndSaveBrowseResponseWire,\n },\n BrowseRequestChanged: {\n resetBrowseRequestOnRefinementWire,\n },\n SelectedFiltersForRequestChanged: {\n setBrowseSelectedFilters,\n },\n ResultsChanged: {\n resetBrowseAppending,\n },\n ReloadBrowseRequested: {\n resetBrowseStateForReloadWire,\n },\n SelectedBrowseSortProvided: {\n setBrowseSort,\n },\n ExtraParamsChanged: {\n setBrowseExtraParams,\n },\n UserClickedCloseX: {\n clearBrowseQuery,\n resetBrowseStateForReloadWire,\n cancelFetchAndSaveBrowseResponseWire,\n },\n UserClickedOpenX: {\n clearBrowseQuery,\n resetBrowseStateForReloadWire,\n cancelFetchAndSaveBrowseResponseWire,\n },\n UserAcceptedAQuery: {\n clearBrowseQuery,\n resetBrowseStateForReloadWire,\n cancelFetchAndSaveBrowseResponseWire,\n },\n UserClickedOutOfMainModal: {\n clearBrowseQuery,\n },\n UserSelectedAPage: {\n setBrowsePage,\n resetBrowseAppending,\n },\n UserBrowsedToCategory: {\n setBrowseCategory,\n },\n})\n"],"names":[],"mappings":";;;;AAWA;;;;AAIG;AACH,MAAM,UAAU,GAAG,QAAQ;AAE3B;;;;AAIG;AACH,MAAM,UAAU,GAAG,oBAAoB,CAAC,UAAU,CAAC;AAEnD;;;;AAIG;AACH,MAAM,wBAAwB,GAAG,kCAAkC,CAAC,UAAU,CAAC;AAE/E;;;;AAIG;AACH,MAAM,YAAY,GAAG,sBAAsB,CAAC,UAAU,CAAC;AAEvD;;;;AAIG;AACH,MAAM,0BAA0B,GAAG,oCAAoC,CAAC,UAAU,CAAC;AAEnF;;;;AAIG;MACU,oCAAoC,GAAG,0BAA0B,CAC5E,kCAAkC;AAGpC;;;;AAIG;AACI,MAAM,oBAAoB,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,QAAQ;AAEzF;;;;AAIG;MACU,8BAA8B,GAAG,YAAY,CAAC,4BAA4B;AAEvF;;;;AAIG;MACU,iBAAiB,GAAG,UAAU,CA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BAAyB,EAAE;QACzB,sCAAsC;AACvC,KAAA;AACD,IAAA,oBAAoB,EAAE;QACpB,+BAA+B;QAC/B,8BAA8B;AAC/B,KAAA;AACD,IAAA,oBAAoB,EAAE;QACpB,kCAAkC;AACnC,KAAA;AACD,IAAA,gCAAgC,EAAE;QAChC,wBAAwB;AACzB,KAAA;AACD,IAAA,cAAc,EAAE;QACd,oBAAoB;AACrB,KAAA;AACD,IAAA,qBAAqB,EAAE;QACrB,6BAA6B;AAC9B,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,aAAa;AACd,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,oBAAoB;AACrB,KAAA;AACD,IAAA,iBAAiB,EAAE;QACjB,gBAAgB;QAChB,6BAA6B;QAC7B,oCAAoC;AACrC,KAAA;AACD,IAAA,gBAAgB,EAAE;QAChB,gBAAgB;QAChB,6BAA6B;QAC7B,oCAAoC;AACrC,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,gBAAgB;QAChB,6BAA6B;QAC7B,oCAAoC;AACrC,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,gBAAgB;AACjB,KAAA;AACD,IAAA,iBAAiB,EAAE;QACjB,aAAa;QACb,oBAAoB;AACrB,KAAA;AACD,IAAA,qBAAqB,EAAE;QACrB,iBAAiB;AAClB,KAAA;AACF,CAAA;;;;"}
|
|
@@ -6,6 +6,7 @@ import { HierarchicalFilterEntity } from './hierarchical-filter.entity.js';
|
|
|
6
6
|
import { NumberRangeFilterEntity } from './number-range-filter.entity.js';
|
|
7
7
|
import { RawFilterEntity } from './raw-filter.entity.js';
|
|
8
8
|
import { SimpleFilterEntity } from './simple-filter.entity.js';
|
|
9
|
+
import { SliderFilterEntity } from './slider-filter.entity.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Creates {@link FilterEntity | FilterEntities} based on the provided configs.
|
|
@@ -24,6 +25,7 @@ class FilterEntityFactory {
|
|
|
24
25
|
EditableNumberRangeFilterEntity,
|
|
25
26
|
RawFilterEntity,
|
|
26
27
|
BooleanFilterEntity,
|
|
28
|
+
SliderFilterEntity,
|
|
27
29
|
];
|
|
28
30
|
/**
|
|
29
31
|
* The registered modifiers grouped by the facetId to be applied.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-entity.factory.js","sources":["../../../../../src/x-modules/facets/entities/filter-entity.factory.ts"],"sourcesContent":["import type { Facet, Filter, FilterModelName } from '@empathyco/x-types'\nimport type { Store } from 'vuex'\nimport type { RootXStoreState } from '../../../store/store.types'\nimport type { FilterEntity, FilterEntityConstructor, FilterEntityModifier } from './types'\nimport { isFacetFilter } from '@empathyco/x-types'\nimport { UNKNOWN_FACET_KEY } from '../store/constants'\nimport { BooleanFilterEntity } from './boolean-filter.entity'\nimport { EditableNumberRangeFilterEntity } from './editable-number-range-filter.entity'\nimport { HierarchicalFilterEntity } from './hierarchical-filter.entity'\nimport { NumberRangeFilterEntity } from './number-range-filter.entity'\nimport { RawFilterEntity } from './raw-filter.entity'\nimport { SimpleFilterEntity } from './simple-filter.entity'\n\n/**\n * Creates {@link FilterEntity | FilterEntities} based on the provided configs.\n *\n * @internal\n */\nexport class FilterEntityFactory {\n /**\n * The public global instance of the Singleton.\n *\n * @remarks The constructor is not private, so it's possible to create more instances,\n * to simplify the testing.\n */\n public static instance = new FilterEntityFactory()\n\n /**\n * The registered entities by default to be used by the Factory.\n */\n protected entities = [\n SimpleFilterEntity,\n HierarchicalFilterEntity,\n NumberRangeFilterEntity,\n EditableNumberRangeFilterEntity,\n RawFilterEntity,\n BooleanFilterEntity,\n ] as FilterEntityConstructor[]\n\n /**\n * The registered modifiers grouped by the facetId to be applied.\n */\n protected modifiersByFacetId: Record<Facet['id'], FilterEntityModifier[]> = {}\n\n /**\n * The registered modifiers grouped by the filter `ModelName` to be applied.\n */\n protected modifiersByFilterModelName: Partial<Record<FilterModelName, FilterEntityModifier[]>> =\n {}\n\n /**\n * Contains the instantiated entities for each facet.\n *\n * @internal\n */\n protected cache: Record<Facet['id'] | typeof UNKNOWN_FACET_KEY, FilterEntity> = {}\n\n /**\n * Creates a new FilterEntity from a filter.\n *\n * @param store - The {@link https://vuex.vuejs.org/guide/ | Vuex Store} that the entity will\n * use.\n * @param filter - The {@link @empathyco/x-types#Filter | Filter} necessary to know what\n * {@link FilterEntity} to create.\n * @returns The {@link FilterEntity} created by the factory.\n */\n getFilterEntity(store: Store<RootXStoreState>, filter: Filter): FilterEntity {\n const cacheKey = isFacetFilter(filter) ? filter.facetId : UNKNOWN_FACET_KEY\n return this.cache[cacheKey] ?? (this.cache[cacheKey] = this.createFilterEntity(store, filter))\n }\n\n /**\n * Creates a brand new {@link FilterEntity} for the given\n * {@link @empathyco/x-types#Filter | Filter}.\n *\n * @param store - The store which should be mutated through the entity.\n * @param filter - The filter to create the entity for.\n * @returns A new {@link FilterEntity} for the given {@link @empathyco/x-types#Filter | Filter}.\n * @internal\n */\n protected createFilterEntity(store: Store<RootXStoreState>, filter: Filter): FilterEntity {\n const filterEntityConstructor = this.entities.find(entity => entity.accepts(filter))\n if (!filterEntityConstructor) {\n throw new Error(`Entity configuration for ${filter.modelName} not registered.`)\n }\n // eslint-disable-next-line new-cap\n const entity = new filterEntityConstructor(store)\n const modifiers = isFacetFilter(filter)\n ? (this.modifiersByFacetId[filter.facetId] ??\n this.modifiersByFilterModelName[filter.modelName] ??\n [])\n : []\n return modifiers.reduce(\n // eslint-disable-next-line new-cap\n (modifiedEntity, modifier) => new modifier(store, modifiedEntity),\n entity,\n )\n }\n\n /**\n * Registers a new {@link FilterEntity} to be used by the factory.\n *\n * @param entity - The new {@link FilterEntity} to be registered in the factory.\n */\n registerFilterEntity(entity: FilterEntityConstructor): void {\n if (!this.entities.includes(entity)) {\n this.entities.push(entity)\n }\n }\n\n /**\n * Registers a list of modifiers to be used with the {@link FilterEntity | FilterEntities} of a\n * particular facet.\n *\n * @param facetId - The facet id whose Entities will be modified.\n * @param modifiers - The list of modifiers to be registered.\n */\n registerModifierByFacetId(facetId: Facet['id'], ...modifiers: FilterEntityModifier[]): void {\n this.updateModifiers(this.modifiersByFacetId, facetId, modifiers)\n }\n\n /**\n * Registers a list of modifiers to be used with the {@link FilterEntity | FilterEntities} of a\n * particular facet.\n *\n * @param filterModelName - The facet ModelName whose Entities will be modified.\n * @param modifiers - The list of modifiers to be registered.\n */\n registerModifierByFilterModelName(\n filterModelName: FilterModelName,\n ...modifiers: FilterEntityModifier[]\n ): void {\n this.updateModifiers(this.modifiersByFilterModelName, filterModelName, modifiers)\n }\n\n /**\n * Updates the modifiers for a particular facet.\n *\n * @param modifiersRecord - The map of modifiers to be updated.\n * @param modifierKey - The id whose modifiers will be updated.\n * @param modifiers - The list of new modifiers to be registered.\n */\n protected updateModifiers(\n modifiersRecord: Record<string, FilterEntityModifier[]>,\n modifierKey: string | number,\n modifiers: FilterEntityModifier[],\n ): void {\n if (!modifiersRecord[modifierKey]) {\n modifiersRecord[modifierKey] = []\n }\n const facetModifiers = modifiersRecord[modifierKey]\n const newModifiers = modifiers.filter(modifier => !facetModifiers.includes(modifier))\n facetModifiers.push(...newModifiers)\n }\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filter-entity.factory.js","sources":["../../../../../src/x-modules/facets/entities/filter-entity.factory.ts"],"sourcesContent":["import type { Facet, Filter, FilterModelName } from '@empathyco/x-types'\nimport type { Store } from 'vuex'\nimport type { RootXStoreState } from '../../../store/store.types'\nimport type { FilterEntity, FilterEntityConstructor, FilterEntityModifier } from './types'\nimport { isFacetFilter } from '@empathyco/x-types'\nimport { UNKNOWN_FACET_KEY } from '../store/constants'\nimport { BooleanFilterEntity } from './boolean-filter.entity'\nimport { EditableNumberRangeFilterEntity } from './editable-number-range-filter.entity'\nimport { HierarchicalFilterEntity } from './hierarchical-filter.entity'\nimport { NumberRangeFilterEntity } from './number-range-filter.entity'\nimport { RawFilterEntity } from './raw-filter.entity'\nimport { SimpleFilterEntity } from './simple-filter.entity'\nimport { SliderFilterEntity } from './slider-filter.entity'\n\n/**\n * Creates {@link FilterEntity | FilterEntities} based on the provided configs.\n *\n * @internal\n */\nexport class FilterEntityFactory {\n /**\n * The public global instance of the Singleton.\n *\n * @remarks The constructor is not private, so it's possible to create more instances,\n * to simplify the testing.\n */\n public static instance = new FilterEntityFactory()\n\n /**\n * The registered entities by default to be used by the Factory.\n */\n protected entities = [\n SimpleFilterEntity,\n HierarchicalFilterEntity,\n NumberRangeFilterEntity,\n EditableNumberRangeFilterEntity,\n RawFilterEntity,\n BooleanFilterEntity,\n SliderFilterEntity,\n ] as FilterEntityConstructor[]\n\n /**\n * The registered modifiers grouped by the facetId to be applied.\n */\n protected modifiersByFacetId: Record<Facet['id'], FilterEntityModifier[]> = {}\n\n /**\n * The registered modifiers grouped by the filter `ModelName` to be applied.\n */\n protected modifiersByFilterModelName: Partial<Record<FilterModelName, FilterEntityModifier[]>> =\n {}\n\n /**\n * Contains the instantiated entities for each facet.\n *\n * @internal\n */\n protected cache: Record<Facet['id'] | typeof UNKNOWN_FACET_KEY, FilterEntity> = {}\n\n /**\n * Creates a new FilterEntity from a filter.\n *\n * @param store - The {@link https://vuex.vuejs.org/guide/ | Vuex Store} that the entity will\n * use.\n * @param filter - The {@link @empathyco/x-types#Filter | Filter} necessary to know what\n * {@link FilterEntity} to create.\n * @returns The {@link FilterEntity} created by the factory.\n */\n getFilterEntity(store: Store<RootXStoreState>, filter: Filter): FilterEntity {\n const cacheKey = isFacetFilter(filter) ? filter.facetId : UNKNOWN_FACET_KEY\n return this.cache[cacheKey] ?? (this.cache[cacheKey] = this.createFilterEntity(store, filter))\n }\n\n /**\n * Creates a brand new {@link FilterEntity} for the given\n * {@link @empathyco/x-types#Filter | Filter}.\n *\n * @param store - The store which should be mutated through the entity.\n * @param filter - The filter to create the entity for.\n * @returns A new {@link FilterEntity} for the given {@link @empathyco/x-types#Filter | Filter}.\n * @internal\n */\n protected createFilterEntity(store: Store<RootXStoreState>, filter: Filter): FilterEntity {\n const filterEntityConstructor = this.entities.find(entity => entity.accepts(filter))\n if (!filterEntityConstructor) {\n throw new Error(`Entity configuration for ${filter.modelName} not registered.`)\n }\n // eslint-disable-next-line new-cap\n const entity = new filterEntityConstructor(store)\n const modifiers = isFacetFilter(filter)\n ? (this.modifiersByFacetId[filter.facetId] ??\n this.modifiersByFilterModelName[filter.modelName] ??\n [])\n : []\n return modifiers.reduce(\n // eslint-disable-next-line new-cap\n (modifiedEntity, modifier) => new modifier(store, modifiedEntity),\n entity,\n )\n }\n\n /**\n * Registers a new {@link FilterEntity} to be used by the factory.\n *\n * @param entity - The new {@link FilterEntity} to be registered in the factory.\n */\n registerFilterEntity(entity: FilterEntityConstructor): void {\n if (!this.entities.includes(entity)) {\n this.entities.push(entity)\n }\n }\n\n /**\n * Registers a list of modifiers to be used with the {@link FilterEntity | FilterEntities} of a\n * particular facet.\n *\n * @param facetId - The facet id whose Entities will be modified.\n * @param modifiers - The list of modifiers to be registered.\n */\n registerModifierByFacetId(facetId: Facet['id'], ...modifiers: FilterEntityModifier[]): void {\n this.updateModifiers(this.modifiersByFacetId, facetId, modifiers)\n }\n\n /**\n * Registers a list of modifiers to be used with the {@link FilterEntity | FilterEntities} of a\n * particular facet.\n *\n * @param filterModelName - The facet ModelName whose Entities will be modified.\n * @param modifiers - The list of modifiers to be registered.\n */\n registerModifierByFilterModelName(\n filterModelName: FilterModelName,\n ...modifiers: FilterEntityModifier[]\n ): void {\n this.updateModifiers(this.modifiersByFilterModelName, filterModelName, modifiers)\n }\n\n /**\n * Updates the modifiers for a particular facet.\n *\n * @param modifiersRecord - The map of modifiers to be updated.\n * @param modifierKey - The id whose modifiers will be updated.\n * @param modifiers - The list of new modifiers to be registered.\n */\n protected updateModifiers(\n modifiersRecord: Record<string, FilterEntityModifier[]>,\n modifierKey: string | number,\n modifiers: FilterEntityModifier[],\n ): void {\n if (!modifiersRecord[modifierKey]) {\n modifiersRecord[modifierKey] = []\n }\n const facetModifiers = modifiersRecord[modifierKey]\n const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C;IACtC;;AAvIA;;;;;AAKG;AACW,mBAAA,CAAA,QAAQ,GAAG,IAAI,mBAAmB,EAAE;;;;"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { isSliderFilter } from '@empathyco/x-types';
|
|
2
|
+
import { addFacetIfNotPresent } from './add-facet-if-not-present.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Allows selecting and deselecting a filter of {@link @empathyco/x-types#SliderFilter
|
|
6
|
+
* | SliderFilter}.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
class SliderFilterEntity {
|
|
11
|
+
constructor(store) {
|
|
12
|
+
this.store = store;
|
|
13
|
+
}
|
|
14
|
+
static accepts(filter) {
|
|
15
|
+
return isSliderFilter(filter);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* It sets {@link @empathyco/x-types#SliderFilter | SliderFilter} to
|
|
19
|
+
* false. Range values are kept to be able to update the {@link FacetsGetters.selectedFilters}
|
|
20
|
+
* getter accordingly (as the id is built using the range).
|
|
21
|
+
*
|
|
22
|
+
* @param filterParam - The filter to deselect.
|
|
23
|
+
*/
|
|
24
|
+
deselect(filterParam) {
|
|
25
|
+
const filter = filterParam;
|
|
26
|
+
const newFilterState = {
|
|
27
|
+
facetId: filter.facetId,
|
|
28
|
+
range: { min: filter.range.min, max: filter.range.max },
|
|
29
|
+
selectedRange: { min: null, max: null },
|
|
30
|
+
selected: false,
|
|
31
|
+
};
|
|
32
|
+
this.removePreviousFilter(filter.facetId);
|
|
33
|
+
this.store.commit('x/facets/mutateFilter', {
|
|
34
|
+
filter,
|
|
35
|
+
newFilterState: Object.assign(newFilterState, { id: this.getNewFilterId(newFilterState) }),
|
|
36
|
+
});
|
|
37
|
+
addFacetIfNotPresent(this.store, filter.facetId, 'SliderFacet');
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* It selects the {@link @empathyco/x-types#SliderFilter
|
|
41
|
+
* | SliderFilter}.
|
|
42
|
+
*
|
|
43
|
+
* @param filterParam - The filter to select.
|
|
44
|
+
* @remarks If the filter has no selected range, then filter is deselected when this
|
|
45
|
+
* method is called.
|
|
46
|
+
*/
|
|
47
|
+
select(filterParam) {
|
|
48
|
+
const filter = filterParam;
|
|
49
|
+
this.removePreviousFilter(filter.facetId);
|
|
50
|
+
this.store.commit('x/facets/mutateFilter', {
|
|
51
|
+
filter,
|
|
52
|
+
newFilterState: {
|
|
53
|
+
id: this.getNewFilterId(filter),
|
|
54
|
+
selected: this.isSelected(filter),
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
addFacetIfNotPresent(this.store, filter.facetId, 'SliderFacet');
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Generates a new filter id using the range values.
|
|
61
|
+
*
|
|
62
|
+
* @param filter - The filter to generate its new id.
|
|
63
|
+
* @returns The new filter id.
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
getNewFilterId({ facetId, selectedRange, range, }) {
|
|
67
|
+
return `${facetId}:${String(selectedRange.min ?? range.min)}-${String(selectedRange.max ?? range.max)}`;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* It returns if the filter range min or the filter range max is not null.
|
|
71
|
+
*
|
|
72
|
+
* @param filter - The filter to determine if it is selected or not.
|
|
73
|
+
* @returns True if filter selectedRange min or filter selectedRange max is diferrent from filter range
|
|
74
|
+
* min or filter range max respectively.
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
isSelected({ selectedRange, range }) {
|
|
78
|
+
return ((selectedRange.min ?? range.min) !== range.min ||
|
|
79
|
+
(selectedRange.max ?? range.max) !== range.max);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Removes the previous filter of this facet from the store, only if it exists.
|
|
83
|
+
*
|
|
84
|
+
* @param facetId - The facet to remove its only filter.
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
removePreviousFilter(facetId) {
|
|
88
|
+
const previousFilter = this.getFilterByFacet(facetId);
|
|
89
|
+
if (previousFilter) {
|
|
90
|
+
this.store.commit('x/facets/removeFilter', previousFilter);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Retrieves the filter of the given facet id from the store.
|
|
95
|
+
*
|
|
96
|
+
* @param facetId - The facet id to retrieve its filter.
|
|
97
|
+
* @returns The filter of the facet if it exists.
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
getFilterByFacet(facetId) {
|
|
101
|
+
// eslint-disable-next-line ts/no-unsafe-member-access,ts/no-unsafe-return
|
|
102
|
+
return this.store.getters['x/facets/facets'][facetId]?.filters?.[0];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { SliderFilterEntity };
|
|
107
|
+
//# sourceMappingURL=slider-filter.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider-filter.entity.js","sources":["../../../../../src/x-modules/facets/entities/slider-filter.entity.ts"],"sourcesContent":["import type { Facet, Filter, SliderFilter } from '@empathyco/x-types'\nimport type { Store } from 'vuex'\nimport type { RootXStoreState } from '../../../store/store.types'\nimport type { FilterEntity } from './types'\nimport { isSliderFilter } from '@empathyco/x-types'\nimport { addFacetIfNotPresent } from './add-facet-if-not-present'\n\n/**\n * Allows selecting and deselecting a filter of {@link @empathyco/x-types#SliderFilter\n * | SliderFilter}.\n *\n * @internal\n */\nexport class SliderFilterEntity implements FilterEntity {\n public constructor(protected store: Store<RootXStoreState>) {}\n\n static accepts(filter: Filter): boolean {\n return isSliderFilter(filter)\n }\n\n /**\n * It sets {@link @empathyco/x-types#SliderFilter | SliderFilter} to\n * false. Range values are kept to be able to update the {@link FacetsGetters.selectedFilters}\n * getter accordingly (as the id is built using the range).\n *\n * @param filterParam - The filter to deselect.\n */\n deselect(filterParam: Filter): void {\n const filter = filterParam as SliderFilter\n const newFilterState: Pick<SliderFilter, 'selectedRange' | 'range' | 'facetId' | 'selected'> = {\n facetId: filter.facetId,\n range: { min: filter.range.min, max: filter.range.max },\n selectedRange: { min: null, max: null },\n selected: false,\n }\n this.removePreviousFilter(filter.facetId)\n this.store.commit('x/facets/mutateFilter', {\n filter,\n newFilterState: Object.assign(newFilterState, { id: this.getNewFilterId(newFilterState) }),\n })\n addFacetIfNotPresent(this.store, filter.facetId, 'SliderFacet')\n }\n\n /**\n * It selects the {@link @empathyco/x-types#SliderFilter\n * | SliderFilter}.\n *\n * @param filterParam - The filter to select.\n * @remarks If the filter has no selected range, then filter is deselected when this\n * method is called.\n */\n select(filterParam: Filter): void {\n const filter = filterParam as SliderFilter\n this.removePreviousFilter(filter.facetId)\n this.store.commit('x/facets/mutateFilter', {\n filter,\n newFilterState: {\n id: this.getNewFilterId(filter),\n selected: this.isSelected(filter),\n },\n })\n addFacetIfNotPresent(this.store, filter.facetId, 'SliderFacet')\n }\n\n /**\n * Generates a new filter id using the range values.\n *\n * @param filter - The filter to generate its new id.\n * @returns The new filter id.\n * @internal\n */\n protected getNewFilterId({\n facetId,\n selectedRange,\n range,\n }: Pick<SliderFilter, 'selectedRange' | 'range' | 'facetId'>): string {\n return `${facetId}:${String(selectedRange.min ?? range.min)}-${String(selectedRange.max ?? range.max)}`\n }\n\n /**\n * It returns if the filter range min or the filter range max is not null.\n *\n * @param filter - The filter to determine if it is selected or not.\n * @returns True if filter selectedRange min or filter selectedRange max is diferrent from filter range\n * min or filter range max respectively.\n * @internal\n */\n protected isSelected({ selectedRange, range }: SliderFilter): boolean {\n return (\n (selectedRange.min ?? range.min) !== range.min ||\n (selectedRange.max ?? range.max) !== range.max\n )\n }\n\n /**\n * Removes the previous filter of this facet from the store, only if it exists.\n *\n * @param facetId - The facet to remove its only filter.\n * @internal\n */\n protected removePreviousFilter(facetId: Facet['id']): void {\n const previousFilter = this.getFilterByFacet(facetId)\n if (previousFilter) {\n this.store.commit('x/facets/removeFilter', previousFilter)\n }\n }\n\n /**\n * Retrieves the filter of the given facet id from the store.\n *\n * @param facetId - The facet id to retrieve its filter.\n * @returns The filter of the facet if it exists.\n * @internal\n */\n protected getFilterByFacet(facetId: Facet['id']): SliderFilter | undefined {\n // eslint-disable-next-line ts/no-unsafe-member-access,ts/no-unsafe-return\n return this.store.getters['x/facets/facets'][facetId]?.filters?.[0]\n }\n}\n"],"names":[],"mappings":";;;AAOA;;;;;AAKG;MACU,kBAAkB,CAAA;AAC7B,IAAA,WAAA,CAA6B,KAA6B,EAAA;QAA7B,IAAA,CAAA,KAAK,GAAL,KAAK;IAA2B;IAE7D,OAAO,OAAO,CAAC,MAAc,EAAA;AAC3B,QAAA,OAAO,cAAc,CAAC,MAAM,CAAC;IAC/B;AAEA;;;;;;AAMG;AACH,IAAA,QAAQ,CAAC,WAAmB,EAAA;QAC1B,MAAM,MAAM,GAAG,WAA2B;AAC1C,QAAA,MAAM,cAAc,GAA2E;YAC7F,OAAO,EAAE,MAAM,CAAC,OAAO;AACvB,YAAA,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;YACvD,aAAa,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE;AACvC,YAAA,QAAQ,EAAE,KAAK;SAChB;AACD,QAAA,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,OAAO,CAAC;AACzC,QAAA,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,uBAAuB,EAAE;YACzC,MAAM;AACN,YAAA,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,CAAC;AAC3F,SAAA,CAAC;QACF,oBAAoB,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC;IACjE;AAEA;;;;;;;AAOG;AACH,IAAA,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AEA;;;;;;AAMG;AACO,IAAA,gBAAgB,CAAC,OAAoB,EAAA;;AAE7C,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC;IACrE;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/facets/wiring.ts"],"sourcesContent":["import type { BrowsableRequest, Facet } from '@empathyco/x-types'\nimport type { UrlParams } from '../../types/url-params'\nimport type { XEventPayload } from '../../wiring/index'\nimport { createRawFilters } from '../../utils/filters'\nimport { namespacedWireCommit, namespacedWireCommitWithoutPayload } from '../../wiring/index'\nimport { wireService, wireServiceWithoutPayload } from '../../wiring/wires.factory'\nimport { filter, mapWire } from '../../wiring/wires.operators'\nimport { createWiring } from '../../wiring/wiring.utils'\nimport { DefaultFacetsService } from './service/facets.service'\n\n/**\n * `facets` {@link XModuleName | XModule name}.\n *\n * @internal\n */\nconst moduleName = 'facets'\n\n/**\n * WireCommit for {@link FacetsXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit(moduleName)\n\n/**\n * WireCommitWithoutPayload for {@link FacetsXModule}.\n *\n * @internal\n */\nconst wireCommitWithoutPayload = namespacedWireCommitWithoutPayload(moduleName)\n\n/**\n * Wires factory for {@link DefaultFacetsService}.\n */\nconst wireFacetsService = wireService(DefaultFacetsService.instance)\n\n/**\n * Wires without payload factory for {@link DefaultFacetsService}.\n */\nconst wireFacetsServiceWithoutPayload = wireServiceWithoutPayload(DefaultFacetsService.instance)\n\n/**\n * Saves the facets contained in the `search` group, removing the previous ones, and keeping the\n * previous filters selected state.\n *\n * @public\n */\nconst updateFacetsGroupWithSearchFacetsWire = mapWire(\n wireFacetsService('updateFacets'),\n (facets: Facet[]) => ({\n facets,\n id: 'search',\n }),\n)\n\n/**\n * Saves the facets contained in the group, removing the previous ones, and keeping the new filters\n * selected state.\n *\n * @public\n */\nconst setFacetsGroupWire = wireFacetsService('setFacets')\n\n/**\n * Toggles the selected state of a filter.\n *\n * @public\n */\nconst toggleFilterWire = wireFacetsService('toggle')\n\n/**\n * Deselects all the filters. Optionally, it can accept a list of facets ids as payload, and it will\n * only deselect the filters from those facets.\n *\n * @public\n */\nconst clearFiltersWire = wireFacetsService('clearFilters')\n\n/**\n * Deselects all selected filters.\n *\n * @public\n */\nconst clearAllFiltersWire = wireFacetsServiceWithoutPayload('clearFilters')\n\n/**\n * Deselects all selected filters but keep the sticky ones.\n *\n * @internal\n */\nconst clearAllFiltersButStickyWire = wireFacetsService('clearFiltersWithMetadata', {\n metadata: {\n keepSticky: true,\n },\n})\n\n/**\n * Deselects all selected filters only when oldValue is not empty.\n *\n * @public\n */\nconst clearAllFiltersOnSecondQuery = filter(\n clearAllFiltersButStickyWire,\n ({ metadata }) => !!metadata.oldValue,\n)\n\n/**\n * Selects the filter passed by payload.\n *\n * @public\n */\nconst selectFilterWire = wireFacetsService('select')\n\n/**\n * Saves the params from the url.\n *\n * @public\n */\nconst setFiltersFromUrl = mapWire(wireFacetsService('select'), ({ filter }: UrlParams) =>\n createRawFilters(filter),\n)\n\n/**\n * Saves the browse filters.\n *\n * @public\n */\nexport const setSelectedFiltersFromBrowse = mapWire(\n wireFacetsService('select'),\n ({ browseFilters }: BrowsableRequest) => (browseFilters ? createRawFilters(browseFilters) : []),\n)\n\n/**\n * Saves the preselected filters.\n *\n * @public\n */\nconst updatePreselectedFilters = wireFacetsService('updatePreselectedFilters')\n\n/**\n * Selects the preselected filters stored in the state.\n *\n * @public\n */\nconst selectPreselectedFilterWire = wireFacetsService('selectPreselectedFilters')\n\n/**\n * Sets the facets state `query`.\n *\n * @public\n */\nconst setQuery = wireFacetsService('setQuery')\n\n/**\n * Clear the facets state `query` .\n *\n * @public\n */\nconst clearQuery = wireFacetsService('setQuery', '')\n\n/**\n * Removes all the sticky filters from the state.\n *\n * @internal\n */\nconst clearStickyFilters = filter<XEventPayload<'SearchResponseChanged'>>(\n wireCommitWithoutPayload('clearStickyFilters'),\n ({ eventPayload }) => {\n return eventPayload.totalResults === 0\n },\n)\n\n/**\n * Sets the filters of the facets module from a queryPreview's filters.\n *\n * @public\n */\nexport const setSelectedFiltersFromPreview = wireCommit(\n 'setFilters',\n ({ eventPayload: { filters } }) => (filters ? createRawFilters(filters) : []),\n)\n\n/**\n * Sets the filters of the facets module from a selectedHistoryQuery's filters.\n *\n * @public\n */\nexport const setFiltersFromHistoryQueries = wireCommit(\n 'setFilters',\n ({ eventPayload: { selectedFilters } }) => selectedFilters ?? [],\n)\n\n/**\n * Sets the query of the facets module from a queryPreview.\n *\n * @public\n */\nexport const setQueryFromPreview = wireCommit('setQuery', ({ eventPayload: { query } }) => query)\n\n/**\n * Wiring configuration for the {@link FacetsXModule | facets module}.\n *\n * @internal\n */\nexport const facetsWiring = createWiring({\n ParamsLoadedFromUrl: {\n // TODO: move this logic to Facets Service\n clearAllFiltersWire,\n setFiltersFromUrl,\n },\n PreselectedFiltersProvided: {\n updatePreselectedFilters,\n },\n FacetsChanged: {\n updateFacetsGroupWithSearchFacetsWire,\n },\n FacetsGroupProvided: {\n setFacetsGroupWire,\n },\n UserAcceptedAQuery: {\n setQuery,\n },\n FacetsQueryChanged: {\n clearAllFiltersOnSecondQuery,\n },\n UserChangedExtraParams: {\n clearAllFiltersButStickyWire,\n },\n UserClickedAFilter: {\n toggleFilterWire,\n },\n UserClickedClearAllFilters: {\n clearFiltersWire,\n },\n UserModifiedEditableNumberRangeFilter: {\n selectFilterWire,\n },\n UserClickedAllFilter: {\n clearFiltersWire,\n },\n UserClearedQuery: {\n clearAllFiltersButStickyWire,\n setQuery,\n },\n UserBrowsedToCategory: {\n clearAllFiltersButStickyWire,\n clearQuery,\n setSelectedFiltersFromBrowse,\n },\n UserClickedOpenX: {\n selectPreselectedFilterWire,\n },\n SearchResponseChanged: {\n clearStickyFilters,\n },\n UserAcceptedAQueryPreview: {\n setQueryFromPreview,\n set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AK;AAEhG;;;;AAIG;AACI,MAAM,YAAY,GAAG,YAAY,CAAC;AACvC,IAAA,mBAAmB,EAAE;;QAEnB,mBAAmB;QACnB,iBAAiB;AAClB,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,wBAAwB;AACzB,KAAA;AACD,IAAA,aAAa,EAAE;QACb,qCAAqC;AACtC,KAAA;AACD,IAAA,mBAAmB,EAAE;QACnB,kBAAkB;AACnB,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,QAAQ;AACT,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,4BAA4B;AAC7B,KAAA;AACD,IAAA,sBAAsB,EAAE;QACtB,4BAA4B;AAC7B,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,gBAAgB;AACjB,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,gBAAgB;AACjB,KAAA;AACD,IAAA,qCAAqC,EAAE;QACrC,gBAAgB;AACjB,KAAA;AACD,IAAA,oBAAoB,EAAE;QACpB,gBAAgB;AACjB,KAAA;AACD,IAAA,gBAAgB,EAAE;QAChB,4BAA4B;QAC5B,QAAQ;AACT,KAAA;AACD,IAAA,qBAAqB,EAAE;QACrB,4BAA4B;QAC5B,UAAU;QACV,4BAA4B;AAC7B,KAAA;AACD,IAAA,gBAAgB,EAAE;QAChB,2BAA2B;AAC5B,KAAA;AACD,IAAA,qBAAqB,EAAE;QACrB,kBAAkB;AACnB,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,mBAAmB;QACnB,6BAA6B;AAC9B,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,4BAA4B;AAC7B,KAAA;AACF,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/facets/wiring.ts"],"sourcesContent":["import type { BrowsableRequest, Facet } from '@empathyco/x-types'\nimport type { UrlParams } from '../../types/url-params'\nimport type { XEventPayload } from '../../wiring/index'\nimport { createRawFilters } from '../../utils/filters'\nimport { namespacedWireCommit, namespacedWireCommitWithoutPayload } from '../../wiring/index'\nimport { wireService, wireServiceWithoutPayload } from '../../wiring/wires.factory'\nimport { filter, mapWire } from '../../wiring/wires.operators'\nimport { createWiring } from '../../wiring/wiring.utils'\nimport { DefaultFacetsService } from './service/facets.service'\n\n/**\n * `facets` {@link XModuleName | XModule name}.\n *\n * @internal\n */\nconst moduleName = 'facets'\n\n/**\n * WireCommit for {@link FacetsXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit(moduleName)\n\n/**\n * WireCommitWithoutPayload for {@link FacetsXModule}.\n *\n * @internal\n */\nconst wireCommitWithoutPayload = namespacedWireCommitWithoutPayload(moduleName)\n\n/**\n * Wires factory for {@link DefaultFacetsService}.\n */\nconst wireFacetsService = wireService(DefaultFacetsService.instance)\n\n/**\n * Wires without payload factory for {@link DefaultFacetsService}.\n */\nconst wireFacetsServiceWithoutPayload = wireServiceWithoutPayload(DefaultFacetsService.instance)\n\n/**\n * Saves the facets contained in the `search` group, removing the previous ones, and keeping the\n * previous filters selected state.\n *\n * @public\n */\nconst updateFacetsGroupWithSearchFacetsWire = mapWire(\n wireFacetsService('updateFacets'),\n (facets: Facet[]) => ({\n facets,\n id: 'search',\n }),\n)\n\n/**\n * Saves the facets contained in the group, removing the previous ones, and keeping the new filters\n * selected state.\n *\n * @public\n */\nconst setFacetsGroupWire = wireFacetsService('setFacets')\n\n/**\n * Toggles the selected state of a filter.\n *\n * @public\n */\nconst toggleFilterWire = wireFacetsService('toggle')\n\n/**\n * Deselects all the filters. Optionally, it can accept a list of facets ids as payload, and it will\n * only deselect the filters from those facets.\n *\n * @public\n */\nconst clearFiltersWire = wireFacetsService('clearFilters')\n\n/**\n * Deselects all selected filters.\n *\n * @public\n */\nconst clearAllFiltersWire = wireFacetsServiceWithoutPayload('clearFilters')\n\n/**\n * Deselects all selected filters but keep the sticky ones.\n *\n * @internal\n */\nconst clearAllFiltersButStickyWire = wireFacetsService('clearFiltersWithMetadata', {\n metadata: {\n keepSticky: true,\n },\n})\n\n/**\n * Deselects all selected filters only when oldValue is not empty.\n *\n * @public\n */\nconst clearAllFiltersOnSecondQuery = filter(\n clearAllFiltersButStickyWire,\n ({ metadata }) => !!metadata.oldValue,\n)\n\n/**\n * Selects the filter passed by payload.\n *\n * @public\n */\nconst selectFilterWire = wireFacetsService('select')\n\n/**\n * Saves the params from the url.\n *\n * @public\n */\nconst setFiltersFromUrl = mapWire(wireFacetsService('select'), ({ filter }: UrlParams) =>\n createRawFilters(filter),\n)\n\n/**\n * Saves the browse filters.\n *\n * @public\n */\nexport const setSelectedFiltersFromBrowse = mapWire(\n wireFacetsService('select'),\n ({ browseFilters }: BrowsableRequest) => (browseFilters ? createRawFilters(browseFilters) : []),\n)\n\n/**\n * Saves the preselected filters.\n *\n * @public\n */\nconst updatePreselectedFilters = wireFacetsService('updatePreselectedFilters')\n\n/**\n * Selects the preselected filters stored in the state.\n *\n * @public\n */\nconst selectPreselectedFilterWire = wireFacetsService('selectPreselectedFilters')\n\n/**\n * Sets the facets state `query`.\n *\n * @public\n */\nconst setQuery = wireFacetsService('setQuery')\n\n/**\n * Clear the facets state `query` .\n *\n * @public\n */\nconst clearQuery = wireFacetsService('setQuery', '')\n\n/**\n * Removes all the sticky filters from the state.\n *\n * @internal\n */\nconst clearStickyFilters = filter<XEventPayload<'SearchResponseChanged'>>(\n wireCommitWithoutPayload('clearStickyFilters'),\n ({ eventPayload }) => {\n return eventPayload.totalResults === 0\n },\n)\n\n/**\n * Sets the filters of the facets module from a queryPreview's filters.\n *\n * @public\n */\nexport const setSelectedFiltersFromPreview = wireCommit(\n 'setFilters',\n ({ eventPayload: { filters } }) => (filters ? createRawFilters(filters) : []),\n)\n\n/**\n * Sets the filters of the facets module from a selectedHistoryQuery's filters.\n *\n * @public\n */\nexport const setFiltersFromHistoryQueries = wireCommit(\n 'setFilters',\n ({ eventPayload: { selectedFilters } }) => selectedFilters ?? [],\n)\n\n/**\n * Sets the query of the facets module from a queryPreview.\n *\n * @public\n */\nexport const setQueryFromPreview = wireCommit('setQuery', ({ eventPayload: { query } }) => query)\n\n/**\n * Wiring configuration for the {@link FacetsXModule | facets module}.\n *\n * @internal\n */\nexport const facetsWiring = createWiring({\n ParamsLoadedFromUrl: {\n // TODO: move this logic to Facets Service\n clearAllFiltersWire,\n setFiltersFromUrl,\n },\n PreselectedFiltersProvided: {\n updatePreselectedFilters,\n },\n FacetsChanged: {\n updateFacetsGroupWithSearchFacetsWire,\n },\n FacetsGroupProvided: {\n setFacetsGroupWire,\n },\n UserAcceptedAQuery: {\n setQuery,\n },\n FacetsQueryChanged: {\n clearAllFiltersOnSecondQuery,\n },\n UserChangedExtraParams: {\n clearAllFiltersButStickyWire,\n },\n UserClickedAFilter: {\n toggleFilterWire,\n },\n UserClickedClearAllFilters: {\n clearFiltersWire,\n },\n UserModifiedEditableNumberRangeFilter: {\n selectFilterWire,\n },\n UserModifiedSliderFilter: {\n selectFilterWire,\n },\n UserClickedAllFilter: {\n clearFiltersWire,\n },\n UserClearedQuery: {\n clearAllFiltersButStickyWire,\n setQuery,\n },\n UserBrowsedToCategory: {\n clearAllFiltersButStickyWire,\n clearQuery,\n setSelectedFiltersFromBrowse,\n },\n UserClickedOpenX: {\n selectPreselectedFilterWire,\n },\n SearchResponseChanged: {\n clearStickyFilters,\n },\n UserAcceptedAQueryPreview: {\n setQueryFromPreview,\n setSelectedFiltersFromPreview,\n },\n UserSelectedAHistoryQuery: {\n setFiltersFromHistoryQueries,\n },\n})\n"],"names":[],"mappings":";;;;;;;AAUA;;;;AAIG;AACH,MAAM,UAAU,GAAG,QAAQ;AAE3B;;;;AAIG;AACH,MAAM,UAAU,GAAG,oBAAoB,CAAC,UAAU,CAAC;AAEnD;;;;AAIG;AACH,MAAM,wBAAwB,GAAG,kCAAkC,CAAC,UAAU,CAAC;AAE/E;;AAEG;AACH,MAAM,iBAAiB,GAAG,WAAW,CAAC,oBAAoB,CAAC,QAAQ,CAAC;AAEpE;;AAEG;AACH,MAAM,+B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D,IAAA,sBAAsB,EAAE;QACtB,4BAA4B;AAC7B,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,gBAAgB;AACjB,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,gBAAgB;AACjB,KAAA;AACD,IAAA,qCAAqC,EAAE;QACrC,gBAAgB;AACjB,KAAA;AACD,IAAA,wBAAwB,EAAE;QACxB,gBAAgB;AACjB,KAAA;AACD,IAAA,oBAAoB,EAAE;QACpB,gBAAgB;AACjB,KAAA;AACD,IAAA,gBAAgB,EAAE;QAChB,4BAA4B;QAC5B,QAAQ;AACT,KAAA;AACD,IAAA,qBAAqB,EAAE;QACrB,4BAA4B;QAC5B,UAAU;QACV,4BAA4B;AAC7B,KAAA;AACD,IAAA,gBAAgB,EAAE;QAChB,2BAA2B;AAC5B,KAAA;AACD,IAAA,qBAAqB,EAAE;QACrB,kBAAkB;AACnB,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,mBAAmB;QACnB,6BAA6B;AAC9B,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,4BAA4B;AAC7B,KAAA;AACF,CAAA;;;;"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { DefaultResultsEnrichmentService } from '../../../services/results-enrichment.service.js';
|
|
2
1
|
import { mergeConfig, setConfig } from '../../../store/utils/config-store.utils.js';
|
|
3
2
|
import { getHashFromQueryPreviewItem } from '../utils/get-hash-from-query-preview.js';
|
|
4
|
-
import { fetchAndSaveQueryPreviewResultsEnrichment } from './actions/fetch-and-save-query-preview-results-enrichment.action.js';
|
|
5
3
|
import { fetchAndSaveQueryPreview } from './actions/fetch-and-save-query-preview.action.js';
|
|
6
4
|
import { fetchQueryPreview } from './actions/fetch-query-preview.action.js';
|
|
7
5
|
import { loadedQueriesPreview } from './getters/loaded-queries-preview.getter.js';
|
|
@@ -62,17 +60,10 @@ const queriesPreviewXStoreModule = {
|
|
|
62
60
|
Object.assign(queryPreviewResult, result);
|
|
63
61
|
}
|
|
64
62
|
},
|
|
65
|
-
updateQueryPreviewResultsFromEnrichment(state, { queryPreviewItem, enrichmentResults }) {
|
|
66
|
-
const queryPreview = state.queriesPreview[getHashFromQueryPreviewItem(queryPreviewItem)];
|
|
67
|
-
if (queryPreview) {
|
|
68
|
-
DefaultResultsEnrichmentService.instance.updateResults(queryPreview.results, enrichmentResults);
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
63
|
},
|
|
72
64
|
actions: {
|
|
73
65
|
fetchQueryPreview,
|
|
74
66
|
fetchAndSaveQueryPreview,
|
|
75
|
-
fetchAndSaveQueryPreviewResultsEnrichment,
|
|
76
67
|
},
|
|
77
68
|
};
|
|
78
69
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/queries-preview/store/module.ts"],"sourcesContent":["import type { QueriesPreviewXStoreModule } from './types'\nimport {
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/queries-preview/store/module.ts"],"sourcesContent":["import type { QueriesPreviewXStoreModule } from './types'\nimport { mergeConfig, setConfig } from '../../../store/utils/config-store.utils'\nimport { getHashFromQueryPreviewItem } from '../utils/get-hash-from-query-preview'\nimport { fetchAndSaveQueryPreview } from './actions/fetch-and-save-query-preview.action'\nimport { fetchQueryPreview } from './actions/fetch-query-preview.action'\nimport { loadedQueriesPreview } from './getters/loaded-queries-preview.getter'\n\n/**\n * {@link XStoreModule} For the `queries-preview` module.\n *\n * @internal\n */\nexport const queriesPreviewXStoreModule: QueriesPreviewXStoreModule = {\n state: () => ({\n config: {\n maxItemsToRequest: 24,\n },\n queriesPreview: {},\n selectedQueryPreview: {\n query: '',\n extraParams: undefined,\n filters: undefined,\n },\n params: {},\n }),\n getters: { loadedQueriesPreview },\n mutations: {\n clearQueryPreview(state, queryPreviewHash) {\n delete state.queriesPreview[queryPreviewHash]\n },\n setParams(state, params) {\n state.params = params\n },\n setQueryPreviewCached(state, queryPreview) {\n state.queriesPreview[getHashFromQueryPreviewItem(queryPreview)] = queryPreview\n },\n setStatus(state, { queryPreviewHash, status }) {\n state.queriesPreview[queryPreviewHash].status = status\n },\n setSelectedQueryPreview(state, selectedQueryPreview) {\n state.selectedQueryPreview = selectedQueryPreview\n },\n setConfig,\n mergeConfig,\n addQueryPreviewInstance(state, queryPreviewHash) {\n if (state.queriesPreview[queryPreviewHash]) {\n state.queriesPreview[queryPreviewHash].instances += 1\n }\n },\n removeQueryPreviewInstance(state, { queryPreviewHash, cache }) {\n if (state.queriesPreview[queryPreviewHash]) {\n state.queriesPreview[queryPreviewHash].instances -= 1\n\n if (!cache && state.queriesPreview[queryPreviewHash].instances === 0) {\n delete state.queriesPreview[queryPreviewHash]\n }\n }\n },\n updateAQueryPreviewResult(state, { result, queryPreviewHash }) {\n const queryPreviewResult = state.queriesPreview[queryPreviewHash]?.results.find(\n resultPreview => resultPreview.id === result.id,\n )\n if (queryPreviewResult) {\n Object.assign(queryPreviewResult, result)\n }\n },\n },\n actions: {\n fetchQueryPreview,\n fetchAndSaveQueryPreview,\n },\n}\n"],"names":[],"mappings":";;;;;;AAOA;;;;AAIG;AACI,MAAM,0BAA0B,GAA+B;AACpE,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,MAAM,EAAE;AACN,YAAA,iBAAiB,EAAE,EAAE;AACtB,SAAA;AACD,QAAA,cAAc,EAAE,EAAE;AAClB,QAAA,oBAAoB,EAAE;AACpB,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,WAAW,EAAE,SAAS;AACtB,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AACD,QAAA,MAAM,EAAE,EAAE;KACX,CAAC;IACF,OAAO,EAAE,EAAE,oBAAoB,EAAE;AACjC,IAAA,SAAS,EAAE;QACT,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,EAAA;AACvC,YAAA,OAAO,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC;QAC/C,CAAC;QACD,SAAS,CAAC,KAAK,EAAE,MAAM,EAAA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7E,aAAa,IAAI,aAAa,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAChD;YACD,IAAI,kBAAkB,EAAE;AACtB,gBAAA,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC;YAC3C;QACF,CAAC;AACF,KAAA;AACD,IAAA,OAAO,EAAE;QACP,iBAAiB;QACjB,wBAAwB;AACzB,KAAA;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { namespacedWireCommit, namespacedWireDispatch } from '../../wiring/namespaced-wires.factory.js';
|
|
2
2
|
import { createWiring } from '../../wiring/wiring.utils.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -61,12 +61,6 @@ const addQueryPreviewInstanceWire = wireCommit('addQueryPreviewInstance');
|
|
|
61
61
|
* @public
|
|
62
62
|
*/
|
|
63
63
|
const removeQueryPreviewInstanceWire = wireCommit('removeQueryPreviewInstance');
|
|
64
|
-
/**
|
|
65
|
-
* Requests and stores the enrichment results for the query preview results.
|
|
66
|
-
*
|
|
67
|
-
* @public
|
|
68
|
-
*/
|
|
69
|
-
const fetchAndSaveQueryPreviewResultsEnrichmentWire = wireDispatch('fetchAndSaveQueryPreviewResultsEnrichment');
|
|
70
64
|
/**
|
|
71
65
|
* Wiring configuration for the {@link QueriesPreviewXModule | queriesPreview module}.
|
|
72
66
|
*
|
|
@@ -103,10 +97,7 @@ const queriesPreviewWiring = createWiring({
|
|
|
103
97
|
QueryPreviewUnmounted: {
|
|
104
98
|
removeQueryPreviewInstanceWire,
|
|
105
99
|
},
|
|
106
|
-
QueryPreviewResultReceived: {
|
|
107
|
-
fetchAndSaveQueryPreviewResultsEnrichmentWire,
|
|
108
|
-
},
|
|
109
100
|
});
|
|
110
101
|
|
|
111
|
-
export { addQueryPreviewInstanceWire, clearQueryPreviewWire, clearSelectedQueryPreviewWire,
|
|
102
|
+
export { addQueryPreviewInstanceWire, clearQueryPreviewWire, clearSelectedQueryPreviewWire, fetchAndSaveQueryPreviewWire, queriesPreviewWiring, removeQueryPreviewInstanceWire, setQueriesPreviewExtraParamsWire, setSelectedQueryPreviewWire };
|
|
112
103
|
//# sourceMappingURL=wiring.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/queries-preview/wiring.ts"],"sourcesContent":["import { namespacedWireCommit, namespacedWireDispatch } from '../../wiring/namespaced-wires.factory'\nimport { createWiring } from '../../wiring/wiring.utils'\n\n/**\n * `queriesPreview` {@link XModuleName | XModule name}.\n *\n * @internal\n */\nconst moduleName = 'queriesPreview'\n\n/**\n * WireCommit for {@link QueriesPreviewXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit(moduleName)\n\n/**\n * WireDispatch for {@link QueriesPreviewXModule}.\n *\n * @internal\n */\nconst wireDispatch = namespacedWireDispatch(moduleName)\n\n/**\n * Requests and stores the cacheable query preview results.\n *\n * @public\n */\nexport const fetchAndSaveQueryPreviewWire = wireDispatch('fetchAndSaveQueryPreview')\n\n/**\n * Clears a query preview from queries preview module.\n *\n * @public\n */\nexport const clearQueryPreviewWire = wireCommit('clearQueryPreview')\n\n/**\n * Sets the queries preview state `params`.\n *\n * @public\n */\nexport const setQueriesPreviewExtraParamsWire = wireCommit('setParams')\n\n/**\n * Updates the state with the selected query preview object.\n *\n * @public\n */\nexport const setSelectedQueryPreviewWire = wireCommit('setSelectedQueryPreview')\n\n/**\n * Clears the selected query preview object from queries preview module.\n *\n * @public\n */\nexport const clearSelectedQueryPreviewWire = wireCommit('setSelectedQueryPreview', null)\n\n/**\n * Adds a new instance in a query preview.\n *\n * @public\n */\nexport const addQueryPreviewInstanceWire = wireCommit('addQueryPreviewInstance')\n\n/**\n * Removes an instance in a query preview.\n *\n * @public\n */\nexport const removeQueryPreviewInstanceWire = wireCommit('removeQueryPreviewInstance')\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/queries-preview/wiring.ts"],"sourcesContent":["import { namespacedWireCommit, namespacedWireDispatch } from '../../wiring/namespaced-wires.factory'\nimport { createWiring } from '../../wiring/wiring.utils'\n\n/**\n * `queriesPreview` {@link XModuleName | XModule name}.\n *\n * @internal\n */\nconst moduleName = 'queriesPreview'\n\n/**\n * WireCommit for {@link QueriesPreviewXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit(moduleName)\n\n/**\n * WireDispatch for {@link QueriesPreviewXModule}.\n *\n * @internal\n */\nconst wireDispatch = namespacedWireDispatch(moduleName)\n\n/**\n * Requests and stores the cacheable query preview results.\n *\n * @public\n */\nexport const fetchAndSaveQueryPreviewWire = wireDispatch('fetchAndSaveQueryPreview')\n\n/**\n * Clears a query preview from queries preview module.\n *\n * @public\n */\nexport const clearQueryPreviewWire = wireCommit('clearQueryPreview')\n\n/**\n * Sets the queries preview state `params`.\n *\n * @public\n */\nexport const setQueriesPreviewExtraParamsWire = wireCommit('setParams')\n\n/**\n * Updates the state with the selected query preview object.\n *\n * @public\n */\nexport const setSelectedQueryPreviewWire = wireCommit('setSelectedQueryPreview')\n\n/**\n * Clears the selected query preview object from queries preview module.\n *\n * @public\n */\nexport const clearSelectedQueryPreviewWire = wireCommit('setSelectedQueryPreview', null)\n\n/**\n * Adds a new instance in a query preview.\n *\n * @public\n */\nexport const addQueryPreviewInstanceWire = wireCommit('addQueryPreviewInstance')\n\n/**\n * Removes an instance in a query preview.\n *\n * @public\n */\nexport const removeQueryPreviewInstanceWire = wireCommit('removeQueryPreviewInstance')\n\n/**\n * Wiring configuration for the {@link QueriesPreviewXModule | queriesPreview module}.\n *\n * @internal\n */\nexport const queriesPreviewWiring = createWiring({\n QueryPreviewRequestUpdated: {\n fetchAndSaveQueryPreviewWire,\n },\n NonCacheableQueryPreviewUnmounted: {\n clearQueryPreviewWire,\n },\n UserAcceptedAQueryPreview: {\n setSelectedQueryPreviewWire,\n },\n ExtraParamsChanged: {\n setQueriesPreviewExtraParamsWire,\n },\n UserClearedQuery: {\n clearSelectedQueryPreviewWire,\n },\n UserClickedCloseX: {\n clearSelectedQueryPreviewWire,\n },\n UserClickedOutOfMainModal: {\n clearSelectedQueryPreviewWire,\n },\n UserSelectedAHistoryQuery: {\n clearSelectedQueryPreviewWire,\n },\n QueryPreviewMounted: {\n addQueryPreviewInstanceWire,\n },\n QueryPreviewUnmounted: {\n removeQueryPreviewInstanceWire,\n },\n})\n"],"names":[],"mappings":";;;AAGA;;;;AAIG;AACH,MAAM,UAAU,GAAG,gBAAgB;AAEnC;;;;AAIG;AACH,MAAM,UAAU,GAAG,oBAAoB,CAAC,UAAU,CAAC;AAEnD;;;;AAIG;AACH,MAAM,YAAY,GAAG,sBAAsB,CAAC,UAAU,CAAC;AAEvD;;;;AAIG;MACU,4BAA4B,GAAG,YAAY,CAAC,0BAA0B;AAEnF;;;;AAIG;MACU,qBAAqB,GAAG,UAAU,CAAC,mBAAmB;AAEnE;;;;AAIG;MACU,gCAAgC,GAAG,UAAU,CAAC,WAAW;AAEtE;;;;AAIG;MACU,2BAA2B,GAAG,UAAU,CAAC,yBAAyB;AAE/E;;;;AAIG;AACI,MAAM,6BAA6B,GAAG,UAAU,CAAC,yBAAyB,EAAE,IAAI;AAEvF;;;;AAIG;MACU,2BAA2B,GAAG,UAAU,CAAC,yBAAyB;AAE/E;;;;AAIG;MACU,8BAA8B,GAAG,UAAU,CAAC,4BAA4B;AAErF;;;;AAIG;AACI,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAC/C,IAAA,0BAA0B,EAAE;QAC1B,4BAA4B;AAC7B,KAAA;AACD,IAAA,iCAAiC,EAAE;QACjC,qBAAqB;AACtB,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,2BAA2B;AAC5B,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,gCAAgC;AACjC,KAAA;AACD,IAAA,gBAAgB,EAAE;QAChB,6BAA6B;AAC9B,KAAA;AACD,IAAA,iBAAiB,EAAE;QACjB,6BAA6B;AAC9B,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,6BAA6B;AAC9B,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,6BAA6B;AAC9B,KAAA;AACD,IAAA,mBAAmB,EAAE;QACnB,2BAA2B;AAC5B,KAAA;AACD,IAAA,qBAAqB,EAAE;QACrB,8BAA8B;AAC/B,KAAA;AACF,CAAA;;;;"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { DefaultResultsEnrichmentService } from '../../../services/results-enrichment.service.js';
|
|
2
1
|
import { mergeConfig, setConfig } from '../../../store/utils/config-store.utils.js';
|
|
3
2
|
import { setStatus } from '../../../store/utils/status-store.utils.js';
|
|
4
|
-
import { fetchAndSaveRecommendationsEnrichment, cancelFetchAndSaveRecommendationsEnrichment } from './actions/fetch-and-save-recommendations-enrichment.action.js';
|
|
5
3
|
import { fetchAndSaveRecommendations, cancelFetchAndSaveRecommendations } from './actions/fetch-and-save-recommendations.action.js';
|
|
6
4
|
import { fetchRecommendations } from './actions/fetch-recommendations.action.js';
|
|
7
5
|
import { RECOMMENDATIONS_ORIGIN } from './constants.js';
|
|
@@ -39,18 +37,13 @@ const recommendationsXStoreModule = {
|
|
|
39
37
|
Object.assign(stateRecommendation, recommendation);
|
|
40
38
|
}
|
|
41
39
|
},
|
|
42
|
-
updateRecommendationsFromEnrichment(state, enrichmentResults) {
|
|
43
|
-
DefaultResultsEnrichmentService.instance.updateResults(state.recommendations, enrichmentResults);
|
|
44
|
-
},
|
|
45
40
|
setConfig,
|
|
46
41
|
mergeConfig,
|
|
47
42
|
},
|
|
48
43
|
actions: {
|
|
49
44
|
cancelFetchAndSaveRecommendations,
|
|
50
|
-
cancelFetchAndSaveRecommendationsEnrichment,
|
|
51
45
|
fetchRecommendations,
|
|
52
46
|
fetchAndSaveRecommendations,
|
|
53
|
-
fetchAndSaveRecommendationsEnrichment,
|
|
54
47
|
},
|
|
55
48
|
};
|
|
56
49
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/recommendations/store/module.ts"],"sourcesContent":["import type { RecommendationsXStoreModule } from './types'\nimport {
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/recommendations/store/module.ts"],"sourcesContent":["import type { RecommendationsXStoreModule } from './types'\nimport { mergeConfig, setConfig } from '../../../store/utils/config-store.utils'\nimport { setStatus } from '../../../store/utils/status-store.utils'\nimport {\n cancelFetchAndSaveRecommendations,\n fetchAndSaveRecommendations,\n} from './actions/fetch-and-save-recommendations.action'\nimport { fetchRecommendations } from './actions/fetch-recommendations.action'\nimport { RECOMMENDATIONS_ORIGIN } from './constants'\nimport { request } from './getters/request.getter'\n\n/**\n * {@link XStoreModule} For the recommendations module.\n *\n * @internal\n */\nexport const recommendationsXStoreModule: RecommendationsXStoreModule = {\n state: () => ({\n config: {\n maxItemsToRequest: 24,\n },\n origin: RECOMMENDATIONS_ORIGIN,\n status: 'initial',\n recommendations: [],\n params: {},\n }),\n getters: {\n request,\n },\n mutations: {\n setRecommendations(state, recommendations) {\n state.recommendations = recommendations\n },\n setStatus,\n setParams(state, params) {\n state.params = params\n },\n updateRecommendation(state, recommendation) {\n const stateRecommendation = state.recommendations.find(\n stateRecommendation => recommendation.id === stateRecommendation.id,\n )\n if (stateRecommendation) {\n Object.assign(stateRecommendation, recommendation)\n }\n },\n setConfig,\n mergeConfig,\n },\n actions: {\n cancelFetchAndSaveRecommendations,\n fetchRecommendations,\n fetchAndSaveRecommendations,\n },\n}\n"],"names":[],"mappings":";;;;;;;AAWA;;;;AAIG;AACI,MAAM,2BAA2B,GAAgC;AACtE,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,MAAM,EAAE;AACN,YAAA,iBAAiB,EAAE,EAAE;AACtB,SAAA;AACD,QAAA,MAAM,EAAE,sBAAsB;AAC9B,QAAA,MAAM,EAAE,SAAS;AACjB,QAAA,eAAe,EAAE,EAAE;AACnB,QAAA,MAAM,EAAE,EAAE;KACX,CAAC;AACF,IAAA,OAAO,EAAE;QACP,OAAO;AACR,KAAA;AACD,IAAA,SAAS,EAAE;QACT,kBAAkB,CAAC,KAAK,EAAE,eAAe,EAAA;AACvC,YAAA,KAAK,CAAC,eAAe,GAAG,eAAe;QACzC,CAAC;QACD,SAAS;QACT,SAAS,CAAC,KAAK,EAAE,MAAM,EAAA;AACrB,YAAA,KAAK,CAAC,MAAM,GAAG,MAAM;QACvB,CAAC;QACD,oBAAoB,CAAC,KAAK,EAAE,cAAc,EAAA;YACxC,MAAM,mBAAmB,GAAG,KAAK,CAAC,eAAe,CAAC,IAAI,CACpD,mBAAmB,IAAI,cAAc,CAAC,EAAE,KAAK,mBAAmB,CAAC,EAAE,CACpE;YACD,IAAI,mBAAmB,EAAE;AACvB,gBAAA,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,cAAc,CAAC;YACpD;QACF,CAAC;QACD,SAAS;QACT,WAAW;AACZ,KAAA;AACD,IAAA,OAAO,EAAE;QACP,iCAAiC;QACjC,oBAAoB;QACpB,2BAA2B;AAC5B,KAAA;;;;;"}
|
|
@@ -25,12 +25,6 @@ const wireCommit = namespacedWireCommit(moduleName);
|
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
27
|
const fetchAndSaveRecommendations = wireDispatch('fetchAndSaveRecommendations');
|
|
28
|
-
/**
|
|
29
|
-
* Requests and stores the enrichment results for the recommendations.
|
|
30
|
-
*
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
const fetchAndSaveRecommendationsEnrichmentWire = wireDispatch('fetchAndSaveRecommendationsEnrichment');
|
|
34
28
|
/**
|
|
35
29
|
* Sets the recommendations state `params`.
|
|
36
30
|
*
|
|
@@ -43,9 +37,6 @@ const setRecommendationsExtraParams = wireCommit('setParams');
|
|
|
43
37
|
* @internal
|
|
44
38
|
*/
|
|
45
39
|
const recommendationsWiring = createWiring({
|
|
46
|
-
RecommendationsChanged: {
|
|
47
|
-
fetchAndSaveRecommendationsEnrichmentWire,
|
|
48
|
-
},
|
|
49
40
|
RecommendationsRequestUpdated: {
|
|
50
41
|
fetchAndSaveRecommendations,
|
|
51
42
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/recommendations/wiring.ts"],"sourcesContent":["import { namespacedWireCommit, namespacedWireDispatch } from '../../wiring/namespaced-wires.factory'\nimport { createWiring } from '../../wiring/wiring.utils'\n\n/**\n * `recommendations` {@link XModuleName | XModule name}.\n *\n * @internal\n */\nconst moduleName = 'recommendations'\n/**\n * WireDispatch for {@link RecommendationsXModule}.\n *\n * @internal\n */\nconst wireDispatch = namespacedWireDispatch(moduleName)\n/**\n * WireCommit for {@link RecommendationsXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit(moduleName)\n\n/**\n * Requests and stores the recommendations.\n *\n * @public\n */\nconst fetchAndSaveRecommendations = wireDispatch('fetchAndSaveRecommendations')\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/recommendations/wiring.ts"],"sourcesContent":["import { namespacedWireCommit, namespacedWireDispatch } from '../../wiring/namespaced-wires.factory'\nimport { createWiring } from '../../wiring/wiring.utils'\n\n/**\n * `recommendations` {@link XModuleName | XModule name}.\n *\n * @internal\n */\nconst moduleName = 'recommendations'\n/**\n * WireDispatch for {@link RecommendationsXModule}.\n *\n * @internal\n */\nconst wireDispatch = namespacedWireDispatch(moduleName)\n/**\n * WireCommit for {@link RecommendationsXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit(moduleName)\n\n/**\n * Requests and stores the recommendations.\n *\n * @public\n */\nconst fetchAndSaveRecommendations = wireDispatch('fetchAndSaveRecommendations')\n\n/**\n * Sets the recommendations state `params`.\n *\n * @public\n */\nexport const setRecommendationsExtraParams = wireCommit('setParams')\n\n/**\n * Wiring configuration for the {@link RecommendationsXModule | recommendations module}.\n *\n * @internal\n */\nexport const recommendationsWiring = createWiring({\n RecommendationsRequestUpdated: {\n fetchAndSaveRecommendations,\n },\n UserClickedColumnPicker: {},\n ExtraParamsChanged: {\n setRecommendationsExtraParams,\n },\n})\n"],"names":[],"mappings":";;;AAGA;;;;AAIG;AACH,MAAM,UAAU,GAAG,iBAAiB;AACpC;;;;AAIG;AACH,MAAM,YAAY,GAAG,sBAAsB,CAAC,UAAU,CAAC;AACvD;;;;AAIG;AACH,MAAM,UAAU,GAAG,oBAAoB,CAAC,UAAU,CAAC;AAEnD;;;;AAIG;AACH,MAAM,2BAA2B,GAAG,YAAY,CAAC,6BAA6B,CAAC;AAE/E;;;;AAIG;MACU,6BAA6B,GAAG,UAAU,CAAC,WAAW;AAEnE;;;;AAIG;AACI,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAChD,IAAA,6BAA6B,EAAE;QAC7B,2BAA2B;AAC5B,KAAA;AACD,IAAA,uBAAuB,EAAE,EAAE;AAC3B,IAAA,kBAAkB,EAAE;QAClB,6BAA6B;AAC9B,KAAA;AACF,CAAA;;;;"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { isFacetFilter } from '@empathyco/x-types';
|
|
2
|
-
import { DefaultResultsEnrichmentService } from '../../../services/results-enrichment.service.js';
|
|
3
2
|
import { mergeConfig, setConfig } from '../../../store/utils/config-store.utils.js';
|
|
4
3
|
import '@empathyco/x-utils';
|
|
5
4
|
import { setQuery } from '../../../store/utils/query.utils.js';
|
|
6
5
|
import { setStatus } from '../../../store/utils/status-store.utils.js';
|
|
7
6
|
import { groupItemsBy } from '../../../utils/array.js';
|
|
8
7
|
import { UNKNOWN_FACET_KEY } from '../../facets/store/constants.js';
|
|
9
|
-
import { fetchAndSavePartialResultsEnrichment } from './actions/fetch-and-save-partial-results-enrichment.action.js';
|
|
10
|
-
import { fetchAndSaveResultsEnrichment } from './actions/fetch-and-save-results-enrichment.action.js';
|
|
11
8
|
import { fetchAndSaveSearchResponse, cancelFetchAndSaveSearchResponse } from './actions/fetch-and-save-search-response.action.js';
|
|
12
9
|
import { fetchSearchResponse } from './actions/fetch-search-response.action.js';
|
|
13
10
|
import { increasePageAppendingResults } from './actions/increase-page-apending-results.action.js';
|
|
@@ -119,31 +116,19 @@ const searchXStoreModule = {
|
|
|
119
116
|
Object.assign(stateResult, result);
|
|
120
117
|
}
|
|
121
118
|
},
|
|
122
|
-
updateResultsFromEnrichment(state, enrichmentResults) {
|
|
123
|
-
DefaultResultsEnrichmentService.instance.updateResults(state.results, enrichmentResults);
|
|
124
|
-
},
|
|
125
|
-
updatePartialResultsFromEnrichment(state, enrichmentResults) {
|
|
126
|
-
for (const partialResult of state.partialResults) {
|
|
127
|
-
if (partialResult.results) {
|
|
128
|
-
DefaultResultsEnrichmentService.instance.updateResults(partialResult.results, enrichmentResults);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
119
|
setStats(state, stats) {
|
|
133
120
|
state.stats = stats;
|
|
134
121
|
},
|
|
135
122
|
},
|
|
136
123
|
actions: {
|
|
137
124
|
cancelFetchAndSaveSearchResponse,
|
|
138
|
-
fetchSearchResponse,
|
|
139
125
|
fetchAndSaveSearchResponse,
|
|
140
|
-
|
|
141
|
-
fetchAndSavePartialResultsEnrichment,
|
|
126
|
+
fetchSearchResponse,
|
|
142
127
|
increasePageAppendingResults,
|
|
143
128
|
resetRequestOnRefinement,
|
|
129
|
+
saveOrigin,
|
|
144
130
|
saveSearchResponse,
|
|
145
131
|
setUrlParams,
|
|
146
|
-
saveOrigin,
|
|
147
132
|
},
|
|
148
133
|
};
|
|
149
134
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/search/store/module.ts"],"sourcesContent":["import type { Stats } from '@empathyco/x-types'\nimport type { SearchXStoreModule } from './types'\nimport { isFacetFilter } from '@empathyco/x-types'\nimport {
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/search/store/module.ts"],"sourcesContent":["import type { Stats } from '@empathyco/x-types'\nimport type { SearchXStoreModule } from './types'\nimport { isFacetFilter } from '@empathyco/x-types'\nimport { setStatus } from '../../../store'\nimport { mergeConfig, setConfig } from '../../../store/utils/config-store.utils'\nimport { setQuery } from '../../../store/utils/query.utils'\nimport { groupItemsBy } from '../../../utils/array'\nimport { UNKNOWN_FACET_KEY } from '../../facets/store/constants'\nimport {\n cancelFetchAndSaveSearchResponse,\n fetchAndSaveSearchResponse,\n fetchSearchResponse,\n increasePageAppendingResults,\n resetRequestOnRefinement,\n saveSearchResponse,\n} from './actions'\nimport { saveOrigin } from './actions/save-origin.action'\nimport { setUrlParams } from './actions/set-url-params.action'\nimport { query } from './getters/query.getter'\nimport { request } from './getters/request.getter'\n\n/**\n * {@link XStoreModule} For the search module.\n *\n * @internal\n */\nexport const searchXStoreModule: SearchXStoreModule = {\n state: () => ({\n ...resettableState(),\n selectedFilters: {},\n params: {},\n config: {\n threshold: 24,\n pageSize: 24,\n pageMode: 'infinite_scroll',\n },\n status: 'initial',\n isNoResults: false,\n fromNoResultsWithFilters: false,\n }),\n getters: {\n request,\n query,\n },\n mutations: {\n appendResults(state, results) {\n state.results = [...state.results, ...results]\n },\n resetState(state) {\n Object.assign(state, resettableState())\n },\n resetStateForReload(state) {\n const { query, facets, sort, page, ...resettable } = resettableState()\n Object.assign(state, resettable)\n },\n setQuery,\n setResults(state, results) {\n state.results = results\n },\n setPartialResults(state, partialResults) {\n state.partialResults = partialResults\n },\n setFacets(state, facets) {\n state.facets = facets\n },\n setRelatedTags(state, relatedTags) {\n state.relatedTags = relatedTags\n },\n setSelectedFilters(state, selectedFilters) {\n state.selectedFilters = groupItemsBy(selectedFilters, filter =>\n isFacetFilter(filter) ? filter.facetId : UNKNOWN_FACET_KEY,\n )\n },\n setBanners(state, banners) {\n state.banners = banners\n },\n setPromoteds(state, promoteds) {\n state.promoteds = promoteds\n },\n setSpellcheck(state, spellcheckedQuery) {\n state.spellcheckedQuery = spellcheckedQuery\n },\n setTotalResults(state, totalResults) {\n state.totalResults = totalResults\n },\n setSort(state, sort) {\n state.sort = sort\n },\n setPage(state, page) {\n state.page = page\n },\n setConfig,\n mergeConfig,\n setIsAppendResults(state, isAppendResults) {\n state.isAppendResults = isAppendResults\n },\n setIsNoResults(state, isNoResults) {\n state.isNoResults = isNoResults\n },\n setFromNoResultsWithFilters(state, fromNoResultsWithFilters) {\n state.fromNoResultsWithFilters = fromNoResultsWithFilters\n },\n setStatus,\n setParams(state, params) {\n state.params = params\n },\n setOrigin(state, origin = null) {\n state.origin = origin\n },\n setRedirections(state, redirections) {\n state.redirections = redirections\n },\n setQueryTagging(state, queryTagging) {\n state.queryTagging = queryTagging\n },\n setDisplayTagging(state, displayTagging) {\n state.displayTagging = displayTagging\n },\n updateResult(state, result) {\n const stateResult = state.results.find(stateResult => result.id === stateResult.id)\n if (stateResult) {\n Object.assign(stateResult, result)\n }\n },\n setStats(state, stats) {\n state.stats = stats\n },\n },\n actions: {\n cancelFetchAndSaveSearchResponse,\n fetchAndSaveSearchResponse,\n fetchSearchResponse,\n increasePageAppendingResults,\n resetRequestOnRefinement,\n saveOrigin,\n saveSearchResponse,\n setUrlParams,\n },\n}\n\n/**\n * Function to return the \"resettable\" part of the state. This will be used in the `resetState`\n * mutation to reset to the initial state.\n *\n * @returns The \"resettable\" part of the {@link SearchState}.\n *\n * @internal\n */\nexport function resettableState() {\n return {\n query: '',\n results: [],\n partialResults: [],\n facets: [],\n relatedTags: [],\n banners: [],\n promoteds: [],\n totalResults: 0,\n spellcheckedQuery: '',\n sort: '',\n page: 1,\n origin: null,\n isAppendResults: false,\n redirections: [],\n queryTagging: {\n url: '',\n params: {},\n },\n displayTagging: {\n url: '',\n params: {},\n },\n stats: {} as Stats,\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAqBA;;;;AAIG;AACI,MAAM,kBAAkB,GAAuB;AACpD,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,GAAG,eAAe,EAAE;AACpB,QAAA,eAAe,EAAE,EAA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