@frontic/nuxt 0.5.1 → 0.5.2

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.
@@ -188,8 +188,22 @@ export function useFronticSearch(name, params, options) {
188
188
  const rawFilters = response.filter;
189
189
  const rawAggregation = response.aggregation;
190
190
  const pageData = response.page;
191
- let activeFilters = makeFilterState(rawFilters);
192
- activeFilters = applyFilterConfig(activeFilters, filterConfig);
191
+ const activeFilters = applyFilterConfig(makeFilterState(rawFilters), filterConfig);
192
+ const typeConfig = filterConfig.type;
193
+ if (typeConfig) {
194
+ for (const field of Object.keys(typeConfig)) {
195
+ if (field in activeFilters) continue;
196
+ const rangeFilter = _rangeFilterList.value.find((f) => f.field === field);
197
+ if (rangeFilter) {
198
+ activeFilters[field] = { ...rangeFilter.from !== void 0 && { from: rangeFilter.from }, ...rangeFilter.to !== void 0 && { to: rangeFilter.to } };
199
+ continue;
200
+ }
201
+ const equalsFilter = [..._orFilterList.value, ..._andFilterList.value].find((f) => f.field === field);
202
+ if (equalsFilter) {
203
+ activeFilters[field] = equalsFilter.value;
204
+ }
205
+ }
206
+ }
193
207
  const availableFilters = processAvailableFilters(rawFilters, rawAggregation, filterConfig);
194
208
  const responseHasSort = "sort" in response;
195
209
  const availableSorts = processAvailableSorts(sortConfig, responseHasSort);
@@ -103,7 +103,7 @@ export declare function applyFilterConfig(filters: Record<string, FilterOption[]
103
103
  * @param filters - The filter state record
104
104
  * @returns Number of fields with active filters
105
105
  */
106
- export declare function countActiveFilters(filters: Record<string, FilterOption[]> | undefined): number;
106
+ export declare function countActiveFilters(filters: Record<string, unknown> | undefined): number;
107
107
  /**
108
108
  * Parses a sort string into field and order components
109
109
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontic/nuxt",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Nuxt module for Frontstack headless commerce - zero config data fetching composables with smart caching, page routing, and context management",
5
5
  "license": "MIT",
6
6
  "author": "Frontic",