import { Facet , Filter , isFacetFilter } from '@empathyco/x-types' ; import { groupItemsBy } from '../../../../utils/array' ; import { map } from '../../../../utils/object' ; import { FacetsXStoreModule } from '../types' ; /**
 * Default implementation for the  FacetsGetters . selectedFiltersByFacet getter.
 *
 *  param state - Current  https of the facets
 * module.
 *  param getters - Current  https of the
 * facets module.
 *
 *  returns remarks public export const selectedFiltersByFacet = ( state , getters ) : Record < Facet [ 'id' ] , Filter [ ] > => { const emptyRecord = map ( state . facets , ( ) => [ ] ) ; const filtersByFacet = groupItemsBy ( getters . selectedFilters , filter => isFacetFilter ( filter ) ? filter . facetId : '__unknown-facet__' ) ; return Object . assign ( emptyRecord , filtersByFacet ) ; } ;