@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clicktap/ui",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "private": false,
5
5
  "author": "Clicktap",
6
6
  "description": "A library of React UI components and low-level hooks.",
@@ -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 p(r){const o=new URLSearchParams;for(const e of r){const i="__typename"in e?e.__typename:void 0;if(i==="CollectionFilterAppliedOption"&&"options"in e){const l=e.options.filter(n=>n.isApplied).map(n=>n.code);l.length>0&&o.set(e.code,l.join(","))}else if(i==="CollectionFilterAppliedBoolean"&&"appliedValue"in e){const t=e;o.set(e.code,t.appliedValue?"true":"false")}}return o}function a(r){const o=[];for(const[e,i]of Object.entries(r)){if(!i)continue;const t=Array.isArray(i)?i[0]:i;if(t)if(t==="true"||t==="false")o.push({__typename:"CollectionFilterAppliedBoolean",code:e,label:e,renderer:"boolean",type:"boolean",includeInFilters:!0,appliedValue:t==="true"});else{const l=t.split(",").filter(Boolean);l.length>0&&o.push({__typename:"CollectionFilterAppliedOption",code:e,label:e,renderer:"option",type:"option",includeInFilters:!0,isSearchable:!1,options:l.map(n=>({id:"",code:n,label:"",isApplied:!0}))})}}return o}export{p as filtersToSearchParams,a as searchParamsToFilters};
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};