@liquidcommerce/elements-sdk 2.7.31 → 2.7.32

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.
@@ -3,19 +3,19 @@ export declare const API_CLIENT_URL: {
3
3
  production: string;
4
4
  };
5
5
  export declare const PRODUCT_LIST_FILTER_TYPES: {
6
- ENGRAVING: string;
7
- FULFILLMENT: string;
8
- PRICE: string;
9
- BRANDS: string;
10
- CATEGORIES: string;
11
- FLAVOR: string;
12
- REGION: string;
13
- VARIETY: string;
14
- VINTAGE: string;
15
- COUNTRY: string;
16
- APPELLATION: string;
17
- MATERIALS: string;
18
- SIZES: string;
6
+ readonly ENGRAVING: "engraving";
7
+ readonly FULFILLMENT: "fulfillment";
8
+ readonly PRICE: "price";
9
+ readonly BRANDS: "brands";
10
+ readonly CATEGORIES: "categories";
11
+ readonly FLAVOR: "flavor";
12
+ readonly REGION: "region";
13
+ readonly VARIETY: "variety";
14
+ readonly VINTAGE: "vintage";
15
+ readonly COUNTRY: "country";
16
+ readonly APPELLATION: "appellation";
17
+ readonly MATERIALS: "materials";
18
+ readonly SIZES: "sizes";
19
19
  };
20
20
  export declare const Z_INDEX: {
21
21
  readonly DRAWER_WRAPPER: 2147483640;
@@ -21,7 +21,7 @@ export interface IFilterParams {
21
21
  export type FacetFilterKeys = typeof FILTER_KEYS.BRANDS | typeof FILTER_KEYS.CATEGORIES | typeof FILTER_KEYS.FLAVOR | typeof FILTER_KEYS.REGION | typeof FILTER_KEYS.VARIETY | typeof FILTER_KEYS.VINTAGE | typeof FILTER_KEYS.COUNTRY | typeof FILTER_KEYS.APPELLATION | typeof FILTER_KEYS.TAGS | typeof FILTER_KEYS.MATERIALS | typeof FILTER_KEYS.SIZES | typeof FILTER_KEYS.ENGRAVING | typeof FILTER_KEYS.FULFILLMENT | typeof FILTER_KEYS.PRICE | typeof FILTER_KEYS.AVAILABILITY | typeof FILTER_KEYS.COLORS;
22
22
  export interface IFilterSchema {
23
23
  type: FacetFilterKeys;
24
- values: IFilterValue[];
24
+ values: IFilterValue[] | string[];
25
25
  }
26
26
  export interface IFilterValue {
27
27
  value: string;
@@ -1,6 +1,7 @@
1
1
  import type { ICheckboxLabelStates, ICreateCheckboxFilterHeaderParams, ICreateCheckboxFilterSearchContainerParams, ICreateCheckboxItemParams, IHandleCheckboxFilterSearchParams, IRenderCheckboxItemsParams } from '../../product-list.interface';
2
2
  export declare function createCheckboxItem(params: ICreateCheckboxItemParams): HTMLElement;
3
3
  export declare function handleCheckboxFilterSearch(params: IHandleCheckboxFilterSearchParams): void;
4
+ export declare function checkboxFilterContentId(filterType: string): string;
4
5
  export declare function createCheckboxFilterHeader(params: ICreateCheckboxFilterHeaderParams): HTMLElement;
5
6
  export declare function createCheckboxFilterSearchContainer(params: ICreateCheckboxFilterSearchContainerParams): HTMLElement;
6
7
  export declare function renderCheckboxItems(params: IRenderCheckboxItemsParams): void;
@@ -19,4 +19,5 @@ export declare function createPriceFilter(params: ICreatePriceFilterParams): {
19
19
  elements: HTMLElement[];
20
20
  chevronContainer: HTMLElement;
21
21
  sliderContainer: HTMLElement;
22
+ headerButton: HTMLButtonElement;
22
23
  };
@@ -13,15 +13,13 @@ export declare class ProductListFiltersComponent extends BaseComponent<IProductL
13
13
  private isPriceFilterCollapsed;
14
14
  private isFulfillmentFilterCollapsed;
15
15
  private appliedFiltersChipsContainer;
16
- private engravingFiltersContainer?;
17
- private fulfillmentFilterContainer?;
18
- private priceFiltersContainer?;
19
- private dynamicFiltersContainer?;
16
+ private filterSectionsContainer?;
20
17
  private filterButtonContainer?;
21
18
  private fulfillmentOptionsList?;
22
19
  private priceFilterChevronIcon?;
23
20
  private fulfillmentFilterChevronIcon?;
24
21
  private priceSliderWrapper?;
22
+ private priceFilterHeaderButton;
25
23
  private boundDrawerClosedHandler;
26
24
  private priceFilterDebounceTimer;
27
25
  constructor();
@@ -35,7 +33,8 @@ export declare class ProductListFiltersComponent extends BaseComponent<IProductL
35
33
  private createFilterSection;
36
34
  private rebuildContainer;
37
35
  private refreshUIStates;
38
- private transformFilterValue;
36
+ private buildFilterSections;
37
+ private refreshFilterButtonVisibility;
39
38
  private fetchFilters;
40
39
  private applyFiltersAndCloseDrawer;
41
40
  protected template(): HTMLElement[];
@@ -44,7 +43,10 @@ export declare class ProductListFiltersComponent extends BaseComponent<IProductL
44
43
  private buildFilterHeader;
45
44
  private clearAllActiveFilters;
46
45
  private removeSingleFilter;
46
+ private removeFacetValue;
47
47
  private getFilteredAndSanitizedFilters;
48
+ private isFilterConfigured;
49
+ private hasVisibleFilters;
48
50
  private buildAppliedFiltersChipsContainer;
49
51
  private handleFilterChange;
50
52
  private isEngravingCurrentlyDisabled;
@@ -0,0 +1,42 @@
1
+ import type { IFilterParamsValue } from '@/interfaces/api/product-list.interface';
2
+ import type { ProductListFilterType } from '@/interfaces/injection.interface';
3
+ import type { IProductListFilters } from './product-list.interface';
4
+ export declare const FILTER_KIND: {
5
+ readonly FACET: "facet";
6
+ readonly TOGGLE: "toggle";
7
+ readonly CHOICE: "choice";
8
+ readonly RANGE: "range";
9
+ };
10
+ export type FilterKind = (typeof FILTER_KIND)[keyof typeof FILTER_KIND];
11
+ interface IFilterDefinitionBase {
12
+ key: string;
13
+ type: ProductListFilterType;
14
+ }
15
+ export interface IFacetFilterDefinition extends IFilterDefinitionBase {
16
+ kind: typeof FILTER_KIND.FACET;
17
+ }
18
+ export interface IToggleFilterDefinition extends IFilterDefinitionBase {
19
+ kind: typeof FILTER_KIND.TOGGLE;
20
+ apiOn: string;
21
+ }
22
+ export interface IChoiceFilterDefinition extends IFilterDefinitionBase {
23
+ kind: typeof FILTER_KIND.CHOICE;
24
+ anyValue: string;
25
+ anyExpandsTo: string[];
26
+ values: string[];
27
+ }
28
+ export interface IRangeFilterDefinition extends IFilterDefinitionBase {
29
+ kind: typeof FILTER_KIND.RANGE;
30
+ defaultMin: string;
31
+ defaultMax: string;
32
+ }
33
+ export type IFilterDefinition = IFacetFilterDefinition | IToggleFilterDefinition | IChoiceFilterDefinition | IRangeFilterDefinition;
34
+ export declare const FILTER_DEFINITIONS: IFilterDefinition[];
35
+ export declare function getFilterDefinition(key: string): IFilterDefinition | undefined;
36
+ export declare function getConfiguredFilterDefinitions(configuredFilters: ProductListFilterType[] | undefined): IFilterDefinition[];
37
+ export declare function getDefaultFilterValue(definition: IFilterDefinition): IProductListFilters[string];
38
+ export declare function createDefaultFilterValues(): IProductListFilters;
39
+ export declare function isFilterValueApplied(definition: IFilterDefinition, value: IProductListFilters[string]): boolean;
40
+ export declare function decodeStoredFilterValue(definition: IFilterDefinition, stored: unknown): IProductListFilters[string];
41
+ export declare function encodeFilterValueForApi(definition: IFilterDefinition, value: IProductListFilters[string]): IFilterParamsValue;
42
+ export {};
@@ -1,8 +1,7 @@
1
1
  import type { IFilterSchema, IProductSearchParams } from '@/interfaces/api/product-list.interface';
2
2
  import type { ProductListFilterType } from '@/interfaces/injection.interface';
3
3
  import type { IExtendedFilterSchema, IProductListFilters } from './product-list.interface';
4
- export declare const FILTER_TYPE_MAP: Record<string, string>;
5
4
  export declare function getSanitizedFilters(filters: IFilterSchema[], configuredFilters: ProductListFilterType[]): IExtendedFilterSchema[];
6
5
  export declare function syncFiltersToAppliedFormat(filters: IProductListFilters): Record<string, string[]>;
7
- export declare function buildSearchParams(slug: string, page: number, perPage: number, searchTerm: string, currentFilters: IProductListFilters, configuredFilters: ProductListFilterType[]): IProductSearchParams;
8
6
  export declare function buildCurrentFiltersFromState(stateFilters: Record<string, string[]>): IProductListFilters;
7
+ export declare function buildSearchParams(slug: string, page: number, perPage: number, searchTerm: string, currentFilters: IProductListFilters, configuredFilters: ProductListFilterType[]): IProductSearchParams;
@@ -39,6 +39,7 @@ export declare class ProductListComponent extends BaseComponent<IProductListComp
39
39
  private lastAnnouncedSentinelState;
40
40
  private renderProducts;
41
41
  private announceResultCount;
42
+ private getListConfig;
42
43
  private insertOrderedProducts;
43
44
  private appendNewProducts;
44
45
  private setupInfiniteScroll;
@@ -26,6 +26,7 @@ export interface ICheckboxLabelStates {
26
26
  filteredItems: IFilterValue[];
27
27
  contentElement: HTMLElement | null;
28
28
  iconElement: HTMLElement | null;
29
+ toggleButton: HTMLButtonElement | null;
29
30
  hasUserInteraction: boolean;
30
31
  }
31
32
  export interface ICreateCheckboxItemParams {
@@ -274,6 +274,11 @@ await client.injectProductListFilters({
274
274
  });
275
275
  ```
276
276
 
277
+ > **Note:** Every section of the panel is opt-in — a filter type absent from `filters` is not
278
+ > rendered, `'price'`, `'fulfillment'` and `'engraving'` included — and all sections render
279
+ > collapsed. See
280
+ > [Available Filters](../guides/product-list-component.md#available-filters).
281
+
277
282
  ---
278
283
 
279
284
  ## Component Management
@@ -114,7 +114,7 @@ The following filter type values can be used in the `filters` array:
114
114
  | `'brands'` | Checkboxes for available brands |
115
115
  | `'categories'` | Category selection checkboxes |
116
116
  | `'fulfillment'`| Shipping vs. on-demand delivery toggle |
117
- | `'engraving'` | Filter by personalization support |
117
+ | `'engraving'` | Toggle: on shows only personalizable products, off shows all |
118
118
  | `'sizes'` | Filter by product size/volume |
119
119
  | `'flavor'` | Filter by flavor profile |
120
120
  | `'region'` | Filter by region of origin |
@@ -129,6 +129,15 @@ The following filter type values can be used in the `filters` array:
129
129
  filters: ['price', 'brands', 'categories', 'fulfillment', 'sizes']
130
130
  ```
131
131
 
132
+ Every section of the filters panel is opt-in — `'price'`, `'fulfillment'` and `'engraving'`
133
+ included. A value you leave out of the array is not rendered, and an empty array draws no
134
+ filters panel at all. Omit `filters` entirely and the list falls back to the server-configured
135
+ defaults for that slug.
136
+
137
+ Sections render **collapsed**; the shopper opens the ones they care about. Nothing is
138
+ auto-expanded, not even a filter seeded from the URL — an applied value shows as a removable
139
+ chip above the sections, so it stays visible without opening anything.
140
+
132
141
  ## URL Query Param Filters
133
142
 
134
143
  The product list auto-applies filters from the page URL on first load. Useful for category landing pages, "shop the look" links, marketing emails, or any flow where you want to deep-link into a pre-filtered list.
@@ -151,6 +160,10 @@ Only filter keys that are configured for the list are honored — anything else
151
160
  | `engraving` | `true` or `false` | `?engraving=true` |
152
161
  | `price` | `min-max` range; `min-` or `-max` are accepted | `?price=20-150`, `?price=20-`, `?price=-150` |
153
162
 
163
+ `engraving=true` narrows the list to products that support personalization. `engraving=false` is
164
+ the filter's unset state and narrows nothing — it is equivalent to leaving the param off, not a
165
+ request for products that cannot be personalized.
166
+
154
167
  Invalid values are dropped (e.g. `?fulfillment=garbage`, `?price=abc` — no error, the filter just isn't applied). Combining params is supported:
155
168
 
156
169
  ```
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "LiquidCommerce Elements SDK",
4
4
  "license": "UNLICENSED",
5
5
  "author": "LiquidCommerce Team",
6
- "version": "2.7.31",
6
+ "version": "2.7.32",
7
7
  "homepage": "https://docs.liquidcommerce.co/elements-sdk",
8
8
  "repository": {
9
9
  "type": "git",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "module": "./dist/index.esm.js",
16
16
  "types": "./dist/types/index.d.ts",
17
- "packageManager": "pnpm@11.21.0",
17
+ "packageManager": "pnpm@11.22.0",
18
18
  "exports": {
19
19
  ".": {
20
20
  "types": "./dist/types/index.d.ts",
@@ -107,7 +107,7 @@
107
107
  "theming"
108
108
  ],
109
109
  "devDependencies": {
110
- "@biomejs/biome": "^2.5.8",
110
+ "@biomejs/biome": "^2.5.9",
111
111
  "@commitlint/cli": "^21.2.2",
112
112
  "@commitlint/config-conventional": "^21.2.2",
113
113
  "@rollup/plugin-alias": "^6.0.0",