@liquidcommerce/elements-sdk 2.6.0-beta.27 → 2.6.0-beta.28
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/index.esm.js +11322 -10509
- package/dist/types/constants/core.constant.d.ts +3 -3
- package/dist/types/elements-base-client.d.ts +3 -1
- package/dist/types/enums/index.d.ts +0 -1
- package/dist/types/interfaces/api/product-list.interface.d.ts +12 -5
- package/dist/types/interfaces/core.interface.d.ts +9 -0
- package/dist/types/modules/product-list/components/filter-components/index.d.ts +7 -0
- package/dist/types/modules/product-list/components/filter-components/product-list-apply-filter-button.d.ts +1 -0
- package/dist/types/modules/product-list/components/filter-components/product-list-chip.d.ts +5 -0
- package/dist/types/modules/product-list/components/filter-components/product-list-filters-chips.d.ts +13 -0
- package/dist/types/modules/product-list/components/filter-components/product-list-fulfillment-filter.d.ts +14 -0
- package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-price-filter.components.d.ts → filter-components/product-list-price-filter.d.ts} +1 -1
- package/dist/types/modules/product-list/components/filter-components/product-list-toggle-filters.d.ts +13 -0
- package/dist/types/modules/product-list/components/index.d.ts +3 -2
- package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +66 -36
- package/dist/types/modules/product-list/components/product-list-search.component.d.ts +22 -0
- package/dist/types/modules/product-list/product-list.commands.d.ts +57 -2
- package/dist/types/modules/product-list/product-list.component.d.ts +11 -37
- package/dist/types/{enums/cloud.enum.d.ts → modules/product-list/product-list.constants.d.ts} +20 -1
- package/dist/types/modules/product-list/product-list.interface.d.ts +8 -24
- package/package.json +4 -4
- package/umd/elements.js +1 -1
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/index.d.ts +0 -6
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-apply-filter-button.component.d.ts +0 -1
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-delivery-options-filter.components.d.ts +0 -16
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-search.component.d.ts +0 -16
- package/dist/types/modules/product-list/components/product-list-filters-subcomponents/product-list-toggle-filters.components.d.ts +0 -18
- /package/dist/types/modules/product-list/components/{product-list-filters-subcomponents/product-list-checkbox-filter.components.d.ts → filter-components/product-list-checkbox-filter.d.ts} +0 -0
|
@@ -7,9 +7,9 @@ export declare const PRODUCT_LIST_CARD_VARIANT: {
|
|
|
7
7
|
STANDARD: string;
|
|
8
8
|
};
|
|
9
9
|
export declare const PRODUCT_LIST_FILTER_TYPES: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
ENGRAVING: string;
|
|
11
|
+
PRESALE: string;
|
|
12
|
+
FULFILLMENT: string;
|
|
13
13
|
PRICE: string;
|
|
14
14
|
BRANDS: string;
|
|
15
15
|
CATEGORIES: string;
|
|
@@ -10,7 +10,7 @@ import { LoggerFactory } from '@/core/logger/logger-factory';
|
|
|
10
10
|
import { StoreService } from '@/core/store/store.service';
|
|
11
11
|
import { TelemetryService } from '@/core/telemetry/telemetry.service';
|
|
12
12
|
import { type ComponentType } from '@/enums';
|
|
13
|
-
import type { IInjectProductElement, IInjectProductListParams, IInjectedComponent, ILiquidCommerceElementsActions, IProcessInjectElementParams } from '@/interfaces/core.interface';
|
|
13
|
+
import type { IInjectProductElement, IInjectProductListFiltersParams, IInjectProductListParams, IInjectProductListSearchParams, IInjectedComponent, ILiquidCommerceElementsActions, IProcessInjectElementParams } from '@/interfaces/core.interface';
|
|
14
14
|
import { ThemeProviderService } from '@/modules/theme-provider/theme-provider.service';
|
|
15
15
|
export declare abstract class ElementsBaseClient {
|
|
16
16
|
protected readonly authClient: AuthClientService;
|
|
@@ -38,6 +38,8 @@ export declare abstract class ElementsBaseClient {
|
|
|
38
38
|
protected processInjectElement(params: IProcessInjectElementParams): Promise<IInjectedComponent | null>;
|
|
39
39
|
protected processInjectProduct(params: IInjectProductElement[]): Promise<IInjectedComponent[]>;
|
|
40
40
|
injectProductList(params: IInjectProductListParams): Promise<void>;
|
|
41
|
+
injectProductListSearch(params: IInjectProductListSearchParams): Promise<void>;
|
|
42
|
+
injectProductListFilters(params: IInjectProductListFiltersParams): Promise<void>;
|
|
41
43
|
protected ensureCartDrawerExists(): void;
|
|
42
44
|
protected ensureAllComponentsRegistered(): void;
|
|
43
45
|
protected createInjectedComponentWrapper(containerId: string, type: ComponentType, element: HTMLElement): IInjectedComponent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FILTER_KEYS } from 'modules/product-list/product-list.constants';
|
|
2
2
|
import type { ILocation } from '@/interfaces/api/address.interface';
|
|
3
3
|
import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
|
|
4
4
|
export interface IProductSearchParams {
|
|
@@ -7,16 +7,23 @@ export interface IProductSearchParams {
|
|
|
7
7
|
pageToken?: string;
|
|
8
8
|
page?: number;
|
|
9
9
|
perPage?: number;
|
|
10
|
-
filters?:
|
|
10
|
+
filters?: IFilterParams[];
|
|
11
11
|
}
|
|
12
|
-
export
|
|
12
|
+
export interface IFilterParams {
|
|
13
|
+
key: string;
|
|
14
|
+
values: string | string[] | {
|
|
15
|
+
min?: string | number;
|
|
16
|
+
max?: string | number;
|
|
17
|
+
} | boolean;
|
|
18
|
+
}
|
|
19
|
+
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.PRESALE | typeof FILTER_KEYS.FULFILLMENT | typeof FILTER_KEYS.PRICE | typeof FILTER_KEYS.AVAILABILITY | typeof FILTER_KEYS.COLORS;
|
|
13
20
|
export interface IFilterSchema {
|
|
14
|
-
|
|
21
|
+
type: FacetFilterKeys;
|
|
15
22
|
values: IFilterValue[];
|
|
16
23
|
}
|
|
17
24
|
export interface IFilterValue {
|
|
18
25
|
value: string;
|
|
19
|
-
|
|
26
|
+
name: string;
|
|
20
27
|
count: number;
|
|
21
28
|
}
|
|
22
29
|
export interface INavigationResponse {
|
|
@@ -51,6 +51,13 @@ export interface IInjectProductListParams {
|
|
|
51
51
|
filters?: ProductListFilterType[];
|
|
52
52
|
productUrl?: string;
|
|
53
53
|
}
|
|
54
|
+
export interface IInjectProductListSearchParams {
|
|
55
|
+
containerId: string;
|
|
56
|
+
}
|
|
57
|
+
export interface IInjectProductListFiltersParams {
|
|
58
|
+
containerId: string;
|
|
59
|
+
filters?: ProductListFilterType[];
|
|
60
|
+
}
|
|
54
61
|
export interface IBuilderInjectElementParams {
|
|
55
62
|
type: ComponentType;
|
|
56
63
|
containerId: string;
|
|
@@ -109,6 +116,8 @@ export interface ILiquidCommerceElementsClient {
|
|
|
109
116
|
injectCartElement(containerId: string): Promise<IInjectedComponent | null>;
|
|
110
117
|
injectCheckoutElement(params: IInjectCheckoutParams): Promise<IInjectedComponent | null>;
|
|
111
118
|
injectProductList(params: IInjectProductListParams): Promise<void>;
|
|
119
|
+
injectProductListSearch(params: IInjectProductListSearchParams): Promise<void>;
|
|
120
|
+
injectProductListFilters(params: IInjectProductListFiltersParams): Promise<void>;
|
|
112
121
|
ui: ILiquidCommerceElementsUIMethod;
|
|
113
122
|
actions: ILiquidCommerceElementsActions;
|
|
114
123
|
getInjectedComponents(): Map<string, IInjectedComponent>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './product-list-apply-filter-button';
|
|
2
|
+
export * from './product-list-checkbox-filter';
|
|
3
|
+
export * from './product-list-chip';
|
|
4
|
+
export * from './product-list-filters-chips';
|
|
5
|
+
export * from './product-list-fulfillment-filter';
|
|
6
|
+
export * from './product-list-price-filter';
|
|
7
|
+
export * from './product-list-toggle-filters';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createApplyFiltersButton(onApplyFilters: VoidFunction): HTMLElement;
|
package/dist/types/modules/product-list/components/filter-components/product-list-filters-chips.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IExtendedFilterSchema, IProductListFilters } from 'modules/product-list/product-list.interface';
|
|
2
|
+
export interface ICreateChipsContainerParams {
|
|
3
|
+
currentFilters?: IProductListFilters;
|
|
4
|
+
sanitizedFilters?: IExtendedFilterSchema[];
|
|
5
|
+
onRemoveFilter: (key: string, value: string) => void;
|
|
6
|
+
onClearAllFilters: VoidFunction;
|
|
7
|
+
}
|
|
8
|
+
export interface IActiveFilter {
|
|
9
|
+
key: string;
|
|
10
|
+
value: string;
|
|
11
|
+
label: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function createChipsContainer(params: ICreateChipsContainerParams): HTMLElement;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FULFILLMENT_OPTIONS } from 'modules/product-list/product-list.constants';
|
|
2
|
+
import type { IProductListFilters } from 'modules/product-list/product-list.interface';
|
|
3
|
+
export interface ICreateFulfillmentFilterParams {
|
|
4
|
+
currentFilters?: IProductListFilters;
|
|
5
|
+
deliveryCollapsed: boolean;
|
|
6
|
+
isSameDayDeliveryDisabled: boolean;
|
|
7
|
+
onFulfillmentOptionsChange?: (value: typeof FULFILLMENT_OPTIONS.ALL | typeof FULFILLMENT_OPTIONS.SHIPPING | typeof FULFILLMENT_OPTIONS.ON_DEMAND) => void;
|
|
8
|
+
onToggleCollapse: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function createFulfillmentFilter(params: ICreateFulfillmentFilterParams): {
|
|
11
|
+
elements: HTMLElement[];
|
|
12
|
+
chevronContainer: HTMLElement;
|
|
13
|
+
fulfillmentList: HTMLElement;
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IProductListFilters } from 'modules/product-list/product-list.interface';
|
|
2
|
+
export interface ICreateEngravingFilterParams {
|
|
3
|
+
currentFilters?: IProductListFilters;
|
|
4
|
+
isPersonalizationDisabled: boolean;
|
|
5
|
+
onEngravingChange?: (enabled: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface ICreatePresaleFilterParams {
|
|
8
|
+
currentFilters?: IProductListFilters;
|
|
9
|
+
isPresaleDisabled: boolean;
|
|
10
|
+
onPresaleChange?: (enabled: boolean) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function createEngravingFilter(params: ICreateEngravingFilterParams): HTMLElement[];
|
|
13
|
+
export declare function createPresaleFilter(params: ICreatePresaleFilterParams): HTMLElement[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
export * from './filter-components';
|
|
2
|
+
export * from './filter-components/product-list-apply-filter-button';
|
|
1
3
|
export * from './product-list-card.component';
|
|
2
4
|
export * from './product-list-card-loading.component';
|
|
3
5
|
export * from './product-list-filters.component';
|
|
4
|
-
export * from './product-list-
|
|
5
|
-
export * from './product-list-filters-subcomponents/product-list-apply-filter-button.component';
|
|
6
|
+
export * from './product-list-search.component';
|
|
@@ -1,43 +1,73 @@
|
|
|
1
|
+
import type { ProductListFilterType } from 'interfaces/core.interface';
|
|
1
2
|
import { BaseComponent } from '@/core/base-component.service';
|
|
2
|
-
import type { ICurrentFilters, IExtendedFilterSchema, IPriceConfig } from '../product-list.interface';
|
|
3
3
|
export interface IProductListFiltersParams {
|
|
4
|
-
|
|
5
|
-
enablePreOrder: boolean;
|
|
6
|
-
enableDeliveryOptions: boolean;
|
|
7
|
-
sanitizedFilters?: IExtendedFilterSchema[];
|
|
8
|
-
currentFilters?: ICurrentFilters;
|
|
9
|
-
priceConfig?: IPriceConfig;
|
|
10
|
-
isDrawerMode?: boolean;
|
|
11
|
-
onPersonalizedChange?: (enabled: boolean) => void;
|
|
12
|
-
onPreOrderChange?: (enabled: boolean) => void;
|
|
13
|
-
onDeliveryOptionsChange?: (value: 'all' | 'shipping' | 'onDemand') => void;
|
|
14
|
-
onPriceChange?: (min: string, max: string) => void;
|
|
15
|
-
onCheckboxFilterChange?: (category: string, selectedValues: string[]) => void;
|
|
16
|
-
onApplyFilters?: () => void;
|
|
4
|
+
filters: ProductListFilterType[];
|
|
17
5
|
}
|
|
18
6
|
export declare class ProductListFiltersComponent extends BaseComponent<IProductListFiltersParams> {
|
|
19
|
-
private
|
|
20
|
-
private
|
|
21
|
-
private
|
|
22
|
-
private readonly
|
|
23
|
-
private
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
private
|
|
27
|
-
private
|
|
7
|
+
private readonly DEFAULT_MIN_PRICE;
|
|
8
|
+
private readonly DEFAULT_MAX_PRICE;
|
|
9
|
+
private readonly FILTER_DEBOUNCE_DELAY_MS;
|
|
10
|
+
private readonly DESKTOP_BREAKPOINT;
|
|
11
|
+
private activeFilters;
|
|
12
|
+
private availableDynamicFilters;
|
|
13
|
+
private checkboxFilterStateMap;
|
|
14
|
+
private isPriceFilterCollapsed;
|
|
15
|
+
private isFulfillmentFilterCollapsed;
|
|
16
|
+
private isRenderedInDrawerMode;
|
|
17
|
+
private activeFiltersChipsContainer;
|
|
18
|
+
private priceFiltersContainer?;
|
|
19
|
+
private dynamicFiltersContainer?;
|
|
20
|
+
private filterButtonContainer?;
|
|
21
|
+
private priceFilterChevronIcon?;
|
|
22
|
+
private priceSliderWrapper?;
|
|
23
|
+
private fulfillmentFilterChevronIcon?;
|
|
24
|
+
private fulfillmentOptionsList?;
|
|
25
|
+
private productSearchComponent;
|
|
26
|
+
private hasRenderedFiltersOnce;
|
|
27
|
+
private priceFilterDebounceTimer;
|
|
28
|
+
private stateSubscriptionCleanup?;
|
|
29
|
+
private resizeHandler;
|
|
28
30
|
get hostClasses(): string[];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
private
|
|
33
|
-
private
|
|
34
|
-
private
|
|
35
|
-
private
|
|
36
|
-
private
|
|
37
|
-
private
|
|
38
|
-
private
|
|
39
|
-
private
|
|
40
|
-
private
|
|
41
|
-
private
|
|
31
|
+
protected connected(): Promise<void>;
|
|
32
|
+
disconnectedCallback(): void;
|
|
33
|
+
private updateAvailableFilters;
|
|
34
|
+
private syncUIFromFiltersState;
|
|
35
|
+
private hydrateActiveFiltersFromState;
|
|
36
|
+
private fetchFilters;
|
|
37
|
+
private applyFiltersAndCloseDrawer;
|
|
38
|
+
private removeSingleFilter;
|
|
39
|
+
private clearAllActiveFilters;
|
|
40
|
+
private isSameDayDeliveryCurrentlyDisabled;
|
|
41
|
+
private isEngravingCurrentlyDisabled;
|
|
42
|
+
private isPresaleCurrentlyDisabled;
|
|
43
|
+
private shouldRenderPriceFilter;
|
|
44
|
+
private getFilteredAndSanitizedFilters;
|
|
45
|
+
private buildEngravingFilterElements;
|
|
46
|
+
private buildPresaleFilterElements;
|
|
47
|
+
private buildFulfillmentFilterElements;
|
|
48
|
+
private buildPriceFilterElements;
|
|
49
|
+
private buildCheckboxFilterElements;
|
|
50
|
+
private renderCheckboxItemsForFilter;
|
|
51
|
+
private handleCheckboxSelectionChange;
|
|
52
|
+
private toggleCheckboxFilterExpansion;
|
|
53
|
+
private buildFilterButton;
|
|
54
|
+
private openFilterDrawer;
|
|
55
|
+
private buildActiveFiltersChipsContainer;
|
|
56
|
+
private synchronizeUIWithFilters;
|
|
57
|
+
private refreshActiveFiltersChips;
|
|
58
|
+
private togglePriceFilterCollapse;
|
|
59
|
+
private toggleFulfillmentFilterCollapse;
|
|
60
|
+
private refreshFilterButton;
|
|
61
|
+
private setupResizeListener;
|
|
62
|
+
private renderPriceFilters;
|
|
63
|
+
private renderDynamicFilters;
|
|
64
|
+
private renderSpecificFilterType;
|
|
65
|
+
private renderAllRemainingFilters;
|
|
66
|
+
private appendFilterElementsToContainer;
|
|
67
|
+
private detectIfRenderedInDrawer;
|
|
68
|
+
private emitFiltersChangedEvent;
|
|
42
69
|
protected template(): HTMLElement[];
|
|
70
|
+
private buildFilterHeader;
|
|
71
|
+
private cleanupResizeListener;
|
|
72
|
+
private doCleanup;
|
|
43
73
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseComponent } from '@/core/base-component.service';
|
|
2
|
+
export declare class ProductListSearchComponent extends BaseComponent {
|
|
3
|
+
private searchInput?;
|
|
4
|
+
private clearButton?;
|
|
5
|
+
private debounceTimer;
|
|
6
|
+
private currentSearchTerm;
|
|
7
|
+
private readonly ALLOWED_CHARACTERS;
|
|
8
|
+
private readonly MAX_LENGTH;
|
|
9
|
+
private readonly DEFAULT_DEBOUNCE_MS;
|
|
10
|
+
get hostClasses(): string[];
|
|
11
|
+
disconnectedCallback(): void;
|
|
12
|
+
getCurrentSearchTerm(): string;
|
|
13
|
+
private fetchProducts;
|
|
14
|
+
private buildCurrentFiltersFromState;
|
|
15
|
+
protected template(): HTMLElement[];
|
|
16
|
+
private handleDebouncedSearch;
|
|
17
|
+
private handleClearSearch;
|
|
18
|
+
private cleanInput;
|
|
19
|
+
private normalizeForSearch;
|
|
20
|
+
private updateClearButtonVisibility;
|
|
21
|
+
private cleanupDebounceTimer;
|
|
22
|
+
}
|
|
@@ -1,17 +1,72 @@
|
|
|
1
1
|
import { BaseCommand } from '@/core/command/base-command.service';
|
|
2
|
-
import type { IProduct } from '@/interfaces/api/product.interface';
|
|
3
|
-
import type { IProductSearchParams, IProductSearchResponse } from '@/interfaces/api/product-list.interface';
|
|
2
|
+
import type { IProduct, IRetailer } from '@/interfaces/api/product.interface';
|
|
3
|
+
import type { IFilterSchema, INavigationResponse, IProductSearchParams, IProductSearchResponse } from '@/interfaces/api/product-list.interface';
|
|
4
|
+
import type { ProductListFilterType } from '@/interfaces/core.interface';
|
|
4
5
|
import { type AddItemParams } from '@/modules/cart/cart.commands';
|
|
6
|
+
import type { IExtendedFilterSchema, IPagination, IProductListFilters } from './product-list.interface';
|
|
7
|
+
export interface IProductListState {
|
|
8
|
+
products: IProduct[];
|
|
9
|
+
retailers: Record<string, IRetailer>;
|
|
10
|
+
filters: IFilterSchema[];
|
|
11
|
+
pagination: IPagination;
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
currentFilters: Record<string, string[]>;
|
|
14
|
+
searchTerm: string;
|
|
15
|
+
gridConfig?: {
|
|
16
|
+
rows: number;
|
|
17
|
+
columns: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
type StateListener = (state: IProductListState) => void;
|
|
5
21
|
export declare class ProductListCommands extends BaseCommand {
|
|
6
22
|
private readonly uiCommands;
|
|
7
23
|
private readonly cartCommands;
|
|
8
24
|
private readonly checkoutCommands;
|
|
25
|
+
private readonly FILTER_TYPE_MAP;
|
|
26
|
+
private state;
|
|
27
|
+
private listeners;
|
|
9
28
|
constructor();
|
|
10
29
|
static getInstance(): ProductListCommands;
|
|
30
|
+
subscribe(listener: StateListener): () => void;
|
|
31
|
+
getState(): Readonly<IProductListState>;
|
|
32
|
+
updateState(partial: Partial<IProductListState>): void;
|
|
33
|
+
updateSearchTerm(searchTerm: string): void;
|
|
34
|
+
setLoading(isLoading: boolean): void;
|
|
35
|
+
private notifyListeners;
|
|
36
|
+
loadInitialProducts(page: number, perPage: number, searchTerm: string, currentFilters: IProductListFilters, configuredFilters: ProductListFilterType[]): Promise<void>;
|
|
37
|
+
loadMoreProducts(perPage: number, searchTerm: string, currentFilters: IProductListFilters, configuredFilters: ProductListFilterType[]): Promise<void>;
|
|
11
38
|
getProductList(params: IProductSearchParams): Promise<IProductSearchResponse>;
|
|
39
|
+
updateCurrentFilters(filterKey: string, values: string[]): void;
|
|
40
|
+
syncFiltersFromComponent(filters: IProductListFilters): void;
|
|
41
|
+
getSanitizedFilters(filters: IFilterSchema[], configuredFilters: ProductListFilterType[]): IExtendedFilterSchema[];
|
|
42
|
+
buildSearchParams(page: number, perPage: number, searchTerm: string, currentFilters: IProductListFilters, configuredFilters: ProductListFilterType[]): IProductSearchParams;
|
|
43
|
+
private buildFiltersArray;
|
|
44
|
+
private addToggleFilters;
|
|
45
|
+
private addEngravingFilter;
|
|
46
|
+
private addPresaleFilter;
|
|
47
|
+
private addFulfillmentFilter;
|
|
48
|
+
private addPriceFilter;
|
|
49
|
+
private addDynamicFilters;
|
|
50
|
+
isEngravingDisabled(currentFilters: IProductListFilters): boolean;
|
|
51
|
+
isPresaleDisabled(currentFilters: IProductListFilters): boolean;
|
|
52
|
+
isSameDayFulfillmentDisabled(currentFilters: IProductListFilters): boolean;
|
|
53
|
+
private isValidFilterValue;
|
|
54
|
+
setGridConfig(rows: number, columns: number): void;
|
|
55
|
+
getItemsPerPage(): number;
|
|
56
|
+
updatePagination(navigation: INavigationResponse | undefined): IPagination;
|
|
57
|
+
createInitialPagination(): IPagination;
|
|
58
|
+
mergeRetailers(existingRetailers: Record<string, IRetailer>, newRetailers: Record<string, IRetailer>): Record<string, IRetailer>;
|
|
59
|
+
extractProductCardData(product: IProduct, retailers: Record<string, IRetailer>): {
|
|
60
|
+
product: IProduct;
|
|
61
|
+
defaultSize: any;
|
|
62
|
+
firstVariant: any;
|
|
63
|
+
retailer: IRetailer;
|
|
64
|
+
} | null;
|
|
65
|
+
private getFilterKeyToTypeMap;
|
|
12
66
|
addToCart(params: AddItemParams): Promise<void>;
|
|
13
67
|
addPresaleToCart(params: AddItemParams): Promise<void>;
|
|
14
68
|
trackViewItemList(products: IProduct[]): void;
|
|
15
69
|
trackSelectItem(product: IProduct): void;
|
|
16
70
|
private convertProductToBaseItem;
|
|
17
71
|
}
|
|
72
|
+
export {};
|
|
@@ -11,63 +11,36 @@ export interface IProductListComponentParams {
|
|
|
11
11
|
export declare class ProductListComponent extends BaseComponent<IProductListComponentParams> {
|
|
12
12
|
private products;
|
|
13
13
|
private retailers;
|
|
14
|
-
private pagination;
|
|
15
14
|
private filters;
|
|
16
|
-
private
|
|
17
|
-
private currentFilters;
|
|
15
|
+
private pagination;
|
|
18
16
|
private cardsContainer;
|
|
19
|
-
private filtersContainer;
|
|
20
|
-
private searchContainer;
|
|
21
17
|
private sentinelElement;
|
|
22
|
-
private personalizedSwitch;
|
|
23
|
-
private preOrderSwitch;
|
|
24
|
-
private deliveryRadios;
|
|
25
|
-
private deliveryRadioLabels;
|
|
26
18
|
private loadingState;
|
|
27
19
|
private scrollObserver;
|
|
28
20
|
private initializationPromise;
|
|
29
|
-
private
|
|
30
|
-
private readonly FILTER_DEBOUNCE_MS;
|
|
31
|
-
private filterButton;
|
|
21
|
+
private unsubscribeFromState?;
|
|
32
22
|
get hostClasses(): string[];
|
|
33
23
|
constructor();
|
|
34
24
|
protected connected(): Promise<void>;
|
|
35
25
|
disconnectedCallback(): void;
|
|
36
26
|
private initializeComponent;
|
|
37
|
-
|
|
27
|
+
private handleStateUpdate;
|
|
38
28
|
private setLoadingState;
|
|
39
29
|
private renderCurrentState;
|
|
40
30
|
private loadInitialProducts;
|
|
41
|
-
private updateFiltersComponent;
|
|
42
31
|
private loadMoreProducts;
|
|
43
|
-
private
|
|
44
|
-
private
|
|
45
|
-
private
|
|
46
|
-
private buildFiltersFromState;
|
|
47
|
-
private syncFiltersFromResponse;
|
|
48
|
-
private onFilterChange;
|
|
32
|
+
private buildCurrentFiltersFromState;
|
|
33
|
+
private mapStateFilterToComponentFilter;
|
|
34
|
+
private refetchProductsWithNewFilters;
|
|
49
35
|
private resetPagination;
|
|
50
|
-
private
|
|
51
|
-
private
|
|
52
|
-
private updatePreOrderSwitch;
|
|
53
|
-
private updateDeliveryOptions;
|
|
54
|
-
private updateRadioLabel;
|
|
55
|
-
private isPersonalizationDisabled;
|
|
56
|
-
private isPreOrderDisabled;
|
|
57
|
-
private isSameDayDeliveryDisabled;
|
|
36
|
+
private setupFilterChangeListener;
|
|
37
|
+
private setupSearchChangeListener;
|
|
58
38
|
private createCardsContainer;
|
|
59
|
-
private getResponsiveColumns;
|
|
60
39
|
private renderLoadingState;
|
|
61
40
|
private renderProducts;
|
|
62
41
|
private appendNewProducts;
|
|
63
42
|
private createProductCard;
|
|
64
|
-
private
|
|
65
|
-
private buildFiltersParams;
|
|
66
|
-
private createSearchContainer;
|
|
67
|
-
private createFiltersContainer;
|
|
68
|
-
private storeFilterElementReferences;
|
|
69
|
-
private openFiltersDrawer;
|
|
70
|
-
private createFilterButton;
|
|
43
|
+
private getResponsiveColumns;
|
|
71
44
|
private setupInfiniteScroll;
|
|
72
45
|
private createScrollSentinel;
|
|
73
46
|
private updateSentinel;
|
|
@@ -79,6 +52,7 @@ export declare class ProductListComponent extends BaseComponent<IProductListComp
|
|
|
79
52
|
private showErrorState;
|
|
80
53
|
private clearCardsContainer;
|
|
81
54
|
private cleanupScrollObserver;
|
|
82
|
-
onStoreWatch(changes: IOnStoreChanged[]): Promise<void>;
|
|
83
55
|
private doCleanup;
|
|
56
|
+
onStoreWatch(changes: IOnStoreChanged[]): Promise<void>;
|
|
57
|
+
protected template(): HTMLElement[];
|
|
84
58
|
}
|
package/dist/types/{enums/cloud.enum.d.ts → modules/product-list/product-list.constants.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const FILTER_KEYS: {
|
|
2
2
|
readonly BRANDS: "brands";
|
|
3
3
|
readonly FLAVOR: "flavor";
|
|
4
4
|
readonly FULFILLMENT: "fulfillment";
|
|
@@ -18,3 +18,22 @@ export declare const ENUM_FILTER_KEYS: {
|
|
|
18
18
|
readonly MATERIALS: "materials";
|
|
19
19
|
readonly COLLECTION_TAGS: "collectionTags";
|
|
20
20
|
};
|
|
21
|
+
export declare const FULFILLMENT_OPTIONS: {
|
|
22
|
+
readonly ALL: "all";
|
|
23
|
+
readonly SHIPPING: "shipping";
|
|
24
|
+
readonly ON_DEMAND: "onDemand";
|
|
25
|
+
};
|
|
26
|
+
export declare const PRICE_OPTIONS: {
|
|
27
|
+
readonly MIN: "0";
|
|
28
|
+
readonly MAX: "1000";
|
|
29
|
+
};
|
|
30
|
+
export declare const FILTER_VALUE_OPTIONS: {
|
|
31
|
+
readonly YES: "YES";
|
|
32
|
+
readonly NO: "NO";
|
|
33
|
+
};
|
|
34
|
+
export declare const FILTER_LOADING_STATE: {
|
|
35
|
+
readonly IDLE: "idle";
|
|
36
|
+
readonly LOADING_INITIAL: "loading_initial";
|
|
37
|
+
readonly LOADING_MORE: "loading_more";
|
|
38
|
+
readonly ERROR: "error";
|
|
39
|
+
};
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import type { IFilterValue } from '@/interfaces/api/product-list.interface';
|
|
2
|
+
export interface IPriceConfig {
|
|
3
|
+
min?: string;
|
|
4
|
+
max?: string;
|
|
5
|
+
}
|
|
2
6
|
export interface IProductListFilters {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
deliveryOptions: 'all' | 'shipping' | 'onDemand';
|
|
6
|
-
price?: {
|
|
7
|
-
min?: string;
|
|
8
|
-
max?: string;
|
|
9
|
-
};
|
|
10
|
-
[key: string]: any;
|
|
7
|
+
price?: IPriceConfig;
|
|
8
|
+
[key: string]: boolean | string | string[] | IPriceConfig | undefined;
|
|
11
9
|
}
|
|
12
10
|
export interface IExtendedFilterSchema {
|
|
13
|
-
|
|
11
|
+
type: string;
|
|
14
12
|
values: IFilterValue[];
|
|
15
13
|
}
|
|
16
14
|
export interface IProductListSearch {
|
|
17
|
-
searchTerm
|
|
15
|
+
searchTerm: string;
|
|
18
16
|
}
|
|
19
17
|
export interface IPagination {
|
|
20
18
|
currentPage: number;
|
|
@@ -31,20 +29,6 @@ export interface ICheckboxLabelStates {
|
|
|
31
29
|
iconElement: HTMLElement | null;
|
|
32
30
|
hasUserInteraction: boolean;
|
|
33
31
|
}
|
|
34
|
-
export interface ICurrentFilters {
|
|
35
|
-
personalized: boolean;
|
|
36
|
-
preOrder: boolean;
|
|
37
|
-
deliveryOptions: 'all' | 'shipping' | 'onDemand';
|
|
38
|
-
price?: {
|
|
39
|
-
min?: string;
|
|
40
|
-
max?: string;
|
|
41
|
-
};
|
|
42
|
-
[key: string]: any;
|
|
43
|
-
}
|
|
44
|
-
export interface IPriceConfig {
|
|
45
|
-
min: string;
|
|
46
|
-
max: string;
|
|
47
|
-
}
|
|
48
32
|
export interface ICreateCheckboxItemParams {
|
|
49
33
|
filter: IExtendedFilterSchema;
|
|
50
34
|
state: ICheckboxLabelStates;
|
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.6.0-beta.
|
|
6
|
+
"version": "2.6.0-beta.28",
|
|
7
7
|
"homepage": "https://docs.liquidcommerce.co/elements-sdk",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
],
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@biomejs/biome": "2.3.10",
|
|
74
|
-
"@commitlint/cli": "^20.
|
|
75
|
-
"@commitlint/config-conventional": "^20.
|
|
74
|
+
"@commitlint/cli": "^20.3.0",
|
|
75
|
+
"@commitlint/config-conventional": "^20.3.0",
|
|
76
76
|
"@rollup/plugin-alias": "^6.0.0",
|
|
77
77
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
78
78
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"conventional-changelog-cli": "^5.0.0",
|
|
91
91
|
"husky": "^9.1.7",
|
|
92
92
|
"process": "^0.11.10",
|
|
93
|
-
"rollup": "^4.
|
|
93
|
+
"rollup": "^4.55.1",
|
|
94
94
|
"rollup-obfuscator": "^4.1.1",
|
|
95
95
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
96
96
|
"semantic-release": "^25.0.2",
|