diff --git a/packages/x-components/src/x-modules/facets/wiring.ts b/packages/x-components/src/x-modules/facets/wiring.ts index dec56ef0ce..45cae32989 100644 --- a/packages/x-components/src/x-modules/facets/wiring.ts +++ b/packages/x-components/src/x-modules/facets/wiring.ts @@ -1,10 +1,14 @@ import { Facet } from '@empathyco/x-types'; import { UrlParams } from '../../types/url-params'; import { createRawFilters } from '../../utils/filters'; -import { wireCommit, wireService, wireServiceWithoutPayload } from '../../wiring/wires.factory'; +import { wireService, wireServiceWithoutPayload } from '../../wiring/wires.factory'; import { filter, mapWire } from '../../wiring/wires.operators'; import { createWiring } from '../../wiring/wiring.utils'; -import { namespacedWireCommit, XEventPayload } from '../../wiring/index'; +import { + namespacedWireCommit, + namespacedWireCommitWithoutPayload, + XEventPayload +} from '../../wiring/index'; import { DefaultFacetsService } from './service/facets.service'; /** @@ -14,12 +18,14 @@ import { DefaultFacetsService } from './service/facets.service'; */ const moduleName = 'facets'; +const wireCommitWithoutPayload = namespacedWireCommitWithoutPayload(moduleName); + /** * WireCommit for {@link SearchXModule}. * * @internal */ -const wireCommitModule = namespacedWireCommit(moduleName); +const wireCommit = namespacedWireCommit(moduleName); /** * Wires factory for {@link DefaultFacetsService}. @@ -139,7 +145,7 @@ const setQuery = wireFacetsService('setQuery'); * @internal */ const clearStickyFilters = filter>( - wireCommit('x/facets/clearStickyFilters'), + wireCommitWithoutPayload('clearStickyFilters'), ({ eventPayload }) => { return eventPayload.totalResults === 0; } @@ -150,7 +156,7 @@ const clearStickyFilters = filter>( * * @public */ -export const setSelectedFiltersFromPreview = wireCommitModule( +export const setSelectedFiltersFromPreview = wireCommit( 'setFilters', ({ eventPayload: { filters } }) => (filters ? createRawFilters(filters) : []) ); diff --git a/packages/x-components/src/x-modules/queries-preview/components/__tests__/query-preview-button.spec.ts b/packages/x-components/src/x-modules/queries-preview/components/__tests__/query-preview-button.spec.ts index be8bcd2c14..bfbe5a2cf8 100644 --- a/packages/x-components/src/x-modules/queries-preview/components/__tests__/query-preview-button.spec.ts +++ b/packages/x-components/src/x-modules/queries-preview/components/__tests__/query-preview-button.spec.ts @@ -11,7 +11,11 @@ import { QueryPreviewInfo } from '../../store/index'; import { getXComponentXModuleName, isXComponent } from '../../../../components/index'; function renderQueryPreviewButton({ - queryPreviewInfo = { query: 'milk', extraParams: { store: 'Magrathea' } }, + queryPreviewInfo = { + query: 'milk', + extraParams: { store: 'Magrathea' }, + filters: ['fit:regular'] + }, template = `` }: RenderQueryPreviewButtonOptions = {}): RenderQueryPreviewButtonAPI { const localVue = createLocalVue(); @@ -98,7 +102,8 @@ describe('query preview button', () => { query: 'milk', extraParams: { store: 'Magrathea' - } + }, + filters: ['fit:regular'] }); await updateExtraParams({ warehouse: 42 }); @@ -110,7 +115,8 @@ describe('query preview button', () => { extraParams: { store: 'Magrathea', warehouse: 42 - } + }, + filters: ['fit:regular'] }); }); }); diff --git a/packages/x-components/src/x-modules/search/wiring.ts b/packages/x-components/src/x-modules/search/wiring.ts index d2484242bd..b589663921 100644 --- a/packages/x-components/src/x-modules/search/wiring.ts +++ b/packages/x-components/src/x-modules/search/wiring.ts @@ -6,7 +6,7 @@ import { } from '../../wiring/namespaced-wires.factory'; import { WirePayload } from '../../wiring/wiring.types'; import { createWiring } from '../../wiring/wiring.utils'; -import { createRawFilters } from '../../utils/index'; +import { createRawFilters } from '../../utils/filters'; import { InternalSearchRequest } from './types'; /**