@usereactify/search 3.10.2 → 3.10.3
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/dist/provider.js +6 -0
- package/dist/types/firestore.d.ts +1 -0
- package/package.json +1 -1
package/dist/provider.js
CHANGED
|
@@ -195,6 +195,12 @@ const useFilterStack = (config, collection, filterStackId) => react_1.default.us
|
|
|
195
195
|
if (filterStack)
|
|
196
196
|
return filterStack;
|
|
197
197
|
}
|
|
198
|
+
// automatically select filter stack by collection if provided
|
|
199
|
+
if (collection === null || collection === void 0 ? void 0 : collection.handle) {
|
|
200
|
+
const filterStack = config.filters.find((filter) => { var _a; return (_a = filter.collections) === null || _a === void 0 ? void 0 : _a.includes(collection.handle); });
|
|
201
|
+
if (filterStack)
|
|
202
|
+
return filterStack;
|
|
203
|
+
}
|
|
198
204
|
const type = !!collection ? "collection" : "search";
|
|
199
205
|
return ((_a = config.filters.find((filter) => type === filter.type)) !== null && _a !== void 0 ? _a : config.filters[0]);
|
|
200
206
|
}, [config, collection]);
|
|
@@ -120,6 +120,7 @@ export interface Filter {
|
|
|
120
120
|
pageSize: number;
|
|
121
121
|
keywords: string[];
|
|
122
122
|
defaultSort: string;
|
|
123
|
+
collections: string[];
|
|
123
124
|
type: "search" | "collection";
|
|
124
125
|
paginationType: "pagination" | "load_more" | "next_prev" | "infinite_scroll";
|
|
125
126
|
inventoryVisibility: "show_all" | "hide_products" | "hide_variants" | "hide_all";
|