@clicktap/ui 2.0.9 → 2.0.10
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/package.json
CHANGED
|
@@ -5,9 +5,4 @@ import { CollectionFilterAppliedInterface } from '../../types/collection';
|
|
|
5
5
|
* Boolean filters: ?is_new=true
|
|
6
6
|
*/
|
|
7
7
|
export declare function filtersToSearchParams(appliedFilters: CollectionFilterAppliedInterface[]): URLSearchParams;
|
|
8
|
-
|
|
9
|
-
* Deserialize URL search params into a minimal applied filters structure.
|
|
10
|
-
* Returns partial filter objects with code + options/value — enough for
|
|
11
|
-
* buildFilterGroups to construct the GraphQL query.
|
|
12
|
-
*/
|
|
13
|
-
export declare function searchParamsToFilters(params: Record<string, string | string[] | undefined>): CollectionFilterAppliedInterface[];
|
|
8
|
+
export declare function searchParamsToFilters(params: Record<string, string | string[] | undefined>, validAttributeCodes?: Iterable<string>): CollectionFilterAppliedInterface[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function c(r){const i=new URLSearchParams;for(const e of r){const n="__typename"in e?e.__typename:void 0;if(n==="CollectionFilterAppliedOption"&&"options"in e){const l=e.options.filter(o=>o.isApplied).map(o=>o.code);l.length>0&&i.set(e.code,l.join(","))}else if(n==="CollectionFilterAppliedBoolean"&&"appliedValue"in e){const t=e;i.set(e.code,t.appliedValue?"true":"false")}}return i}const p=r=>r.replace(/-/g,"_");function d(r,i){const e=i?new Set([...i].map(p)):null,n=[];for(const[t,l]of Object.entries(r)){if(!l||e&&!e.has(p(t)))continue;const o=Array.isArray(l)?l[0]:l;if(o)if(o==="true"||o==="false")n.push({__typename:"CollectionFilterAppliedBoolean",code:t,label:t,renderer:"boolean",type:"boolean",includeInFilters:!0,appliedValue:o==="true"});else{const a=o.split(",").filter(Boolean);a.length>0&&n.push({__typename:"CollectionFilterAppliedOption",code:t,label:t,renderer:"option",type:"option",includeInFilters:!0,isSearchable:!1,options:a.map(s=>({id:"",code:s,label:"",isApplied:!0}))})}}return n}export{c as filtersToSearchParams,d as searchParamsToFilters};
|