@liquidcommerce/elements-sdk 2.6.7 → 2.7.0
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/README.md +302 -71
- package/dist/index.checkout.esm.js +16034 -0
- package/dist/index.esm.js +14201 -12166
- package/dist/types/auto-initialize/checkout.d.ts +2 -0
- package/dist/types/auto-initialize/shared-utils.d.ts +22 -0
- package/dist/types/{elements-base-client.d.ts → clients/base.d.ts} +11 -1
- package/dist/types/clients/checkout.d.ts +13 -0
- package/dist/types/constants/core.constant.d.ts +9 -3
- package/dist/types/core/api/api-client.service.d.ts +0 -2
- package/dist/types/core/client/actions/base-action.service.d.ts +15 -0
- package/dist/types/core/client/actions/client-address-action.service.d.ts +18 -0
- package/dist/types/core/client/actions/client-cart-action.service.d.ts +37 -0
- package/dist/types/core/client/actions/client-checkout-action.service.d.ts +50 -0
- package/dist/types/core/client/actions/client-product-action.service.d.ts +12 -0
- package/dist/types/core/client/client-action.service.d.ts +6 -73
- package/dist/types/core/client/client-config.service.d.ts +3 -4
- package/dist/types/core/store/interfaces/core.interface.d.ts +14 -1
- package/dist/types/core/store/interfaces/metadata.interface.d.ts +11 -0
- package/dist/types/core/store/interfaces/product-list.interface.d.ts +45 -0
- package/dist/types/core/store/interfaces/product.interface.d.ts +1 -0
- package/dist/types/core/store/store.constant.d.ts +4 -0
- package/dist/types/enums/core.enum.d.ts +3 -1
- package/dist/types/enums/index.d.ts +0 -1
- package/dist/types/index.checkout.d.ts +7 -0
- package/dist/types/index.checkout.umd.d.ts +4 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/interfaces/api/checkout.interface.d.ts +2 -1
- package/dist/types/interfaces/api/product-list.interface.d.ts +13 -5
- package/dist/types/interfaces/configs/checkout.interface.d.ts +1 -0
- package/dist/types/interfaces/configs/global.interface.d.ts +4 -2
- package/dist/types/interfaces/configs/index.d.ts +1 -0
- package/dist/types/interfaces/configs/product-list.interface.d.ts +28 -0
- package/dist/types/interfaces/core.interface.d.ts +28 -6
- package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/checkout/checkout.commands.d.ts +6 -2
- package/dist/types/modules/checkout/checkout.component.d.ts +2 -0
- package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +2 -0
- package/dist/types/modules/checkout/components/checkout-header.component.d.ts +1 -0
- package/dist/types/modules/checkout/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/product/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/product-list/components/card-components/index.d.ts +4 -0
- package/dist/types/modules/product-list/components/card-components/product-button.d.ts +11 -0
- package/dist/types/modules/product-list/components/card-components/product-fulfillments.d.ts +10 -0
- package/dist/types/modules/product-list/components/card-components/product-quantity-selector.d.ts +10 -0
- package/dist/types/modules/product-list/components/card-components/product-sizes-list.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 +6 -3
- package/dist/types/modules/product-list/components/product-list-card-loading.component.d.ts +2 -1
- package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +6 -0
- package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +58 -37
- package/dist/types/modules/product-list/components/product-list-retailers.component.d.ts +18 -0
- package/dist/types/modules/product-list/components/product-list-search.component.d.ts +22 -0
- package/dist/types/modules/product-list/product-list-card.component.d.ts +35 -0
- package/dist/types/modules/product-list/product-list.commands.d.ts +53 -3
- package/dist/types/modules/product-list/product-list.component.d.ts +16 -43
- 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 +32 -24
- package/dist/types/modules/product-list/styles/product-list-card.style.d.ts +1 -0
- package/dist/types/modules/product-list/styles/product-list-filters.style.d.ts +1 -0
- package/dist/types/modules/product-list/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/theme-provider/constants/component-groupings.d.ts +1 -0
- package/dist/types/modules/theme-provider/constants/css-variable-mappings.d.ts +1 -1
- package/dist/types/modules/theme-provider/services/style-registry.service.d.ts +16 -0
- package/dist/types/modules/theme-provider/services/stylesheet-generator.service.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/theme-provider/theme-provider.service.d.ts +2 -1
- package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +4 -1
- package/dist/types/modules/ui-components/input/index.d.ts +0 -1
- package/dist/types/modules/ui-components/input/input.component.d.ts +8 -1
- package/dist/types/modules/ui-components/modal/modal.component.d.ts +23 -0
- package/dist/types/modules/ui-components/styles/modal.style.d.ts +1 -0
- package/dist/types/modules/ui-components/ui.commands.d.ts +3 -1
- package/dist/types/static/icon/check.icon.d.ts +2 -0
- package/dist/types/static/icon/index.d.ts +1 -0
- package/docs/ACTIONS.md +1 -0
- package/docs/CONFIGURATION.md +178 -34
- package/docs/DOCUMENTATION_INDEX.md +12 -4
- package/docs/THEMING.md +107 -18
- package/package.json +19 -12
- package/dist/types/modules/product-list/components/product-list-card.component.d.ts +0 -37
- 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/theme-provider/styles/address/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/cart/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/checkout/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/product/index.d.ts +0 -3
- package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/ui/index.d.ts +0 -3
- package/dist/types/modules/ui-components/input/birthdate-input.component.d.ts +0 -53
- package/umd/elements.js +0 -1
- /package/dist/types/{auto-initialize.d.ts → auto-initialize/main.d.ts} +0 -0
- /package/dist/types/{elements-builder-client.d.ts → clients/builder.d.ts} +0 -0
- /package/dist/types/{elements-client-helper.d.ts → clients/helpers.d.ts} +0 -0
- /package/dist/types/{elements-client.d.ts → clients/main.d.ts} +0 -0
- /package/dist/types/modules/{theme-provider/styles/address → address/styles}/address.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/cart → cart/styles}/cart.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/checkout → checkout/styles}/checkout.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/product → product/styles}/image-carousel.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/product → product/styles}/product.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/product → product/styles}/retailers.style.d.ts +0 -0
- /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
- /package/dist/types/modules/{theme-provider/styles/product-list → product-list/styles}/product-list.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/drawer.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/loading.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/promo-code-ticker.style.d.ts +0 -0
|
@@ -1,73 +1,45 @@
|
|
|
1
|
+
import type { IProductListComponent } from 'interfaces/configs';
|
|
1
2
|
import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
|
|
2
|
-
import type {
|
|
3
|
+
import type { ProductListFilterType } from '@/interfaces/core.interface';
|
|
3
4
|
export interface IProductListComponentParams {
|
|
4
|
-
cardVariant: ProductListCardVariantType;
|
|
5
5
|
rows: number;
|
|
6
6
|
columns: number;
|
|
7
|
-
fillCard: boolean;
|
|
8
7
|
filters: ProductListFilterType[];
|
|
9
8
|
productUrl?: string;
|
|
10
9
|
}
|
|
11
|
-
export declare class ProductListComponent extends BaseComponent<IProductListComponentParams> {
|
|
10
|
+
export declare class ProductListComponent extends BaseComponent<IProductListComponentParams, IProductListComponent> {
|
|
12
11
|
private products;
|
|
13
12
|
private retailers;
|
|
14
13
|
private pagination;
|
|
15
|
-
private filters;
|
|
16
|
-
private searchFilter;
|
|
17
|
-
private currentFilters;
|
|
18
14
|
private cardsContainer;
|
|
19
|
-
private filtersContainer;
|
|
20
|
-
private searchContainer;
|
|
21
15
|
private sentinelElement;
|
|
22
|
-
private personalizedSwitch;
|
|
23
|
-
private preOrderSwitch;
|
|
24
|
-
private deliveryRadios;
|
|
25
|
-
private deliveryRadioLabels;
|
|
26
16
|
private loadingState;
|
|
27
17
|
private scrollObserver;
|
|
28
18
|
private initializationPromise;
|
|
29
|
-
private
|
|
30
|
-
private readonly FILTER_DEBOUNCE_MS;
|
|
31
|
-
private filterButton;
|
|
19
|
+
private unsubscribeFromState?;
|
|
32
20
|
get hostClasses(): string[];
|
|
33
21
|
constructor();
|
|
34
22
|
protected connected(): Promise<void>;
|
|
35
|
-
|
|
23
|
+
disconnected(): void;
|
|
36
24
|
private initializeComponent;
|
|
37
|
-
|
|
25
|
+
private handleStateUpdate;
|
|
26
|
+
private updateLoadingState;
|
|
27
|
+
private hasProductsChanged;
|
|
28
|
+
private updateProductData;
|
|
29
|
+
private handleProductRendering;
|
|
30
|
+
private renderSimplifiedProducts;
|
|
38
31
|
private setLoadingState;
|
|
39
32
|
private renderCurrentState;
|
|
40
33
|
private loadInitialProducts;
|
|
41
|
-
private updateFiltersComponent;
|
|
42
34
|
private loadMoreProducts;
|
|
43
|
-
private
|
|
44
|
-
private
|
|
45
|
-
private buildApiParams;
|
|
46
|
-
private buildFiltersFromState;
|
|
47
|
-
private syncFiltersFromResponse;
|
|
48
|
-
private onFilterChange;
|
|
49
|
-
private resetPagination;
|
|
50
|
-
private updateFiltersUI;
|
|
51
|
-
private updatePersonalizedSwitch;
|
|
52
|
-
private updatePreOrderSwitch;
|
|
53
|
-
private updateDeliveryOptions;
|
|
54
|
-
private updateRadioLabel;
|
|
55
|
-
private isPersonalizationDisabled;
|
|
56
|
-
private isPreOrderDisabled;
|
|
57
|
-
private isSameDayDeliveryDisabled;
|
|
35
|
+
private buildCurrentFiltersFromState;
|
|
36
|
+
private mapStateFilterToComponentFilter;
|
|
58
37
|
private createCardsContainer;
|
|
59
|
-
private getResponsiveColumns;
|
|
60
38
|
private renderLoadingState;
|
|
61
39
|
private renderProducts;
|
|
62
40
|
private appendNewProducts;
|
|
63
41
|
private createProductCard;
|
|
64
|
-
private
|
|
65
|
-
private buildFiltersParams;
|
|
66
|
-
private createSearchContainer;
|
|
67
|
-
private createFiltersContainer;
|
|
68
|
-
private storeFilterElementReferences;
|
|
69
|
-
private openFiltersDrawer;
|
|
70
|
-
private createFilterButton;
|
|
42
|
+
private getResponsiveColumns;
|
|
71
43
|
private setupInfiniteScroll;
|
|
72
44
|
private createScrollSentinel;
|
|
73
45
|
private updateSentinel;
|
|
@@ -79,6 +51,7 @@ export declare class ProductListComponent extends BaseComponent<IProductListComp
|
|
|
79
51
|
private showErrorState;
|
|
80
52
|
private clearCardsContainer;
|
|
81
53
|
private cleanupScrollObserver;
|
|
82
|
-
onStoreWatch(changes: IOnStoreChanged[]): Promise<void>;
|
|
83
54
|
private doCleanup;
|
|
55
|
+
onStoreWatch(changes: IOnStoreChanged[]): Promise<void>;
|
|
56
|
+
protected template(): HTMLElement[];
|
|
84
57
|
}
|
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,24 +1,24 @@
|
|
|
1
|
+
import type { IProductFulfillmentStore, IProductSizeStore } from 'core/store/interfaces/product.interface';
|
|
1
2
|
import type { IFilterValue } from '@/interfaces/api/product-list.interface';
|
|
3
|
+
export interface IPriceConfig {
|
|
4
|
+
min?: string;
|
|
5
|
+
max?: string;
|
|
6
|
+
}
|
|
2
7
|
export interface IProductListFilters {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
deliveryOptions: 'all' | 'shipping' | 'onDemand';
|
|
6
|
-
price?: {
|
|
7
|
-
min?: string;
|
|
8
|
-
max?: string;
|
|
9
|
-
};
|
|
10
|
-
[key: string]: any;
|
|
8
|
+
price?: IPriceConfig;
|
|
9
|
+
[key: string]: boolean | string | string[] | IPriceConfig | undefined;
|
|
11
10
|
}
|
|
12
11
|
export interface IExtendedFilterSchema {
|
|
13
|
-
|
|
12
|
+
type: string;
|
|
14
13
|
values: IFilterValue[];
|
|
15
14
|
}
|
|
16
15
|
export interface IProductListSearch {
|
|
17
|
-
searchTerm
|
|
16
|
+
searchTerm: string;
|
|
18
17
|
}
|
|
19
18
|
export interface IPagination {
|
|
20
19
|
currentPage: number;
|
|
21
20
|
totalPages: number;
|
|
21
|
+
totalCount: number;
|
|
22
22
|
hasMorePages: boolean;
|
|
23
23
|
}
|
|
24
24
|
export interface ICheckboxLabelStates {
|
|
@@ -31,20 +31,6 @@ export interface ICheckboxLabelStates {
|
|
|
31
31
|
iconElement: HTMLElement | null;
|
|
32
32
|
hasUserInteraction: boolean;
|
|
33
33
|
}
|
|
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
34
|
export interface ICreateCheckboxItemParams {
|
|
49
35
|
filter: IExtendedFilterSchema;
|
|
50
36
|
state: ICheckboxLabelStates;
|
|
@@ -75,3 +61,25 @@ export interface IRenderCheckboxItemsParams {
|
|
|
75
61
|
export interface ICreateFiltersContainerParams {
|
|
76
62
|
isDrawerMode?: boolean;
|
|
77
63
|
}
|
|
64
|
+
export interface IProductAvailabilityData {
|
|
65
|
+
hasAvailability: boolean;
|
|
66
|
+
upc: string;
|
|
67
|
+
fulfillmentId: string;
|
|
68
|
+
partNumber: string;
|
|
69
|
+
quantity: number;
|
|
70
|
+
state: string;
|
|
71
|
+
isPresale: boolean;
|
|
72
|
+
isPresaleActive: boolean;
|
|
73
|
+
}
|
|
74
|
+
export interface IProductVariantParams {
|
|
75
|
+
image: string;
|
|
76
|
+
name: string;
|
|
77
|
+
size: string | null;
|
|
78
|
+
price: number;
|
|
79
|
+
availability: IProductAvailabilityData;
|
|
80
|
+
hasPersonalization: boolean;
|
|
81
|
+
sizes: Record<string, IProductSizeStore>;
|
|
82
|
+
maxQuantityPerOrder: number;
|
|
83
|
+
shippingVariants: Record<string, IProductFulfillmentStore>;
|
|
84
|
+
onDemandVariants: Record<string, IProductFulfillmentStore>;
|
|
85
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getProductListCardStyles: () => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getProductListFiltersStyles: () => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,3 +3,4 @@ export declare const productGroupComponents: ComponentType[];
|
|
|
3
3
|
export declare const addressGroupComponents: ComponentType[];
|
|
4
4
|
export declare const cartGroupComponents: ComponentType[];
|
|
5
5
|
export declare const checkoutGroupComponents: ComponentType[];
|
|
6
|
+
export declare const productListGroupComponent: ComponentType[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type StylesheetType = 'global' | 'ui' | 'product' | 'address' | 'cart' | 'checkout';
|
|
1
|
+
export type StylesheetType = 'global' | 'ui' | 'product' | 'address' | 'cart' | 'checkout' | 'product-list';
|
|
2
2
|
export declare function getCSSVariableMapping(componentPrefix: string): Record<string, string>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { StylesheetType } from '../constants/css-variable-mappings';
|
|
2
|
+
export type StyleGetter = () => string;
|
|
3
|
+
declare class StyleRegistryService {
|
|
4
|
+
private static instance;
|
|
5
|
+
private registry;
|
|
6
|
+
private constructor();
|
|
7
|
+
static getInstance(): StyleRegistryService;
|
|
8
|
+
register(type: StylesheetType, getter: StyleGetter, priority?: number): void;
|
|
9
|
+
getStyleGetters(type: StylesheetType): StyleGetter[];
|
|
10
|
+
getStyles(type: StylesheetType): string[];
|
|
11
|
+
hasStyles(type: StylesheetType): boolean;
|
|
12
|
+
getRegisteredTypes(): StylesheetType[];
|
|
13
|
+
clear(): void;
|
|
14
|
+
}
|
|
15
|
+
export declare const styleRegistry: StyleRegistryService;
|
|
16
|
+
export { StyleRegistryService };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentType } from '@/enums';
|
|
2
|
-
import type { ConfigsKeyType, ConfigsType, IAllConfigs, UpdateAddressComponent, UpdateCartComponent, UpdateCheckoutComponent, UpdateComponentGlobalConfigs, UpdateProductComponent } from '@/interfaces/configs';
|
|
2
|
+
import type { ConfigsKeyType, ConfigsType, IAllConfigs, UpdateAddressComponent, UpdateCartComponent, UpdateCheckoutComponent, UpdateComponentGlobalConfigs, UpdateProductComponent, UpdateProductListComponent } from '@/interfaces/configs';
|
|
3
3
|
import { type GeneratedStylesheet } from './services/stylesheet-generator.service';
|
|
4
4
|
export declare class ThemeProviderService {
|
|
5
5
|
private data;
|
|
@@ -14,6 +14,7 @@ export declare class ThemeProviderService {
|
|
|
14
14
|
updateAddressComponent(data: UpdateAddressComponent): void;
|
|
15
15
|
updateCartComponent(data: UpdateCartComponent): void;
|
|
16
16
|
updateCheckoutComponent(data: UpdateCheckoutComponent): void;
|
|
17
|
+
updateProductListComponent(data: UpdateProductListComponent): void;
|
|
17
18
|
getConfigs<T = any>(type: ConfigsKeyType): T;
|
|
18
19
|
getComponentConfig(componentType: ComponentType): ConfigsType | undefined;
|
|
19
20
|
getStylesheet(componentType: ComponentType): GeneratedStylesheet[];
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { BaseComponent } from '@/core/base-component.service';
|
|
2
|
+
import type { IDisplayMode } from '@/interfaces/configs';
|
|
2
3
|
export interface IEngravingFormComponentParams {
|
|
3
4
|
identifier: string;
|
|
4
|
-
context: 'product' | 'cart';
|
|
5
|
+
context: 'product' | 'cart' | 'product-list';
|
|
5
6
|
lines: string[];
|
|
6
7
|
maxLines: number;
|
|
7
8
|
maxCharsPerLine: number;
|
|
8
9
|
fee: number;
|
|
9
10
|
location?: string;
|
|
11
|
+
displayMode?: IDisplayMode;
|
|
10
12
|
}
|
|
11
13
|
export declare class EngravingFormComponent extends BaseComponent<IEngravingFormComponentParams, null> {
|
|
12
14
|
get hostClasses(): string[];
|
|
@@ -20,6 +22,7 @@ export declare class EngravingFormComponent extends BaseComponent<IEngravingForm
|
|
|
20
22
|
private calculateTotalPrice;
|
|
21
23
|
private productInformationSection;
|
|
22
24
|
private addToCartButtonText;
|
|
25
|
+
private getFulfillmentData;
|
|
23
26
|
private retailersSection;
|
|
24
27
|
private engravingLinesSection;
|
|
25
28
|
private actionButtonsSection;
|
|
@@ -5,9 +5,13 @@ export interface IInputValidation {
|
|
|
5
5
|
max?: number;
|
|
6
6
|
pattern?: string;
|
|
7
7
|
customValidator?: (value: string) => string | null;
|
|
8
|
+
minYear?: number;
|
|
9
|
+
maxYear?: number;
|
|
10
|
+
minAge?: number;
|
|
11
|
+
maxAge?: number;
|
|
8
12
|
}
|
|
9
13
|
export interface IInputComponentParams {
|
|
10
|
-
inputType: 'text' | 'number' | 'email' | 'tel' | 'date';
|
|
14
|
+
inputType: 'text' | 'number' | 'email' | 'tel' | 'date' | 'birthdate';
|
|
11
15
|
value?: string | null;
|
|
12
16
|
placeholder?: string;
|
|
13
17
|
className?: string;
|
|
@@ -31,6 +35,9 @@ export declare class InputComponent extends BaseComponent<IInputComponentParams,
|
|
|
31
35
|
private validateEmail;
|
|
32
36
|
private validateTel;
|
|
33
37
|
private validateDate;
|
|
38
|
+
private parseDateString;
|
|
39
|
+
private calculateAge;
|
|
40
|
+
private validateDateConstraints;
|
|
34
41
|
private isFieldComplete;
|
|
35
42
|
private validateInput;
|
|
36
43
|
private scheduleValidation;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
|
|
2
|
+
export declare class ModalComponent extends BaseComponent {
|
|
3
|
+
private isOpen;
|
|
4
|
+
private wrapperElement;
|
|
5
|
+
private modalElement;
|
|
6
|
+
private backdropElement;
|
|
7
|
+
private contentContainer;
|
|
8
|
+
private currentContentType;
|
|
9
|
+
private readonly boundHandleKeydown;
|
|
10
|
+
constructor();
|
|
11
|
+
disconnected(): void;
|
|
12
|
+
onStoreChanged(changes: IOnStoreChanged[]): boolean;
|
|
13
|
+
private openWithContent;
|
|
14
|
+
private open;
|
|
15
|
+
private close;
|
|
16
|
+
private cleanupCurrentContent;
|
|
17
|
+
private handleBackdropClick;
|
|
18
|
+
private handleKeydown;
|
|
19
|
+
private updateModalContentTypeClass;
|
|
20
|
+
private updateModalState;
|
|
21
|
+
private isElementsEnabled;
|
|
22
|
+
protected template(): HTMLElement;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getModalStyles(): string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { BaseCommand } from '@/core/command/base-command.service';
|
|
2
|
-
import type { IDrawerContentConfig } from '@/core/store/interfaces/core.interface';
|
|
2
|
+
import type { IDrawerContentConfig, IModalContentConfig } from '@/core/store/interfaces/core.interface';
|
|
3
3
|
export declare class UICommands extends BaseCommand {
|
|
4
4
|
static getInstance(): UICommands;
|
|
5
5
|
openDrawer(contentType: IDrawerContentConfig['type'], data?: Record<string, any>): void;
|
|
6
6
|
closeDrawer(): void;
|
|
7
|
+
openModal(contentType: IModalContentConfig['type'], data?: Record<string, any>): void;
|
|
8
|
+
closeModal(): void;
|
|
7
9
|
}
|
package/docs/ACTIONS.md
CHANGED
|
@@ -524,6 +524,7 @@ await actions.cart.resetCart();
|
|
|
524
524
|
actions.checkout.openCheckout();
|
|
525
525
|
actions.checkout.closeCheckout();
|
|
526
526
|
actions.checkout.toggleCheckout();
|
|
527
|
+
actions.checkout.exitCheckout();
|
|
527
528
|
|
|
528
529
|
// Example: Open checkout automatically for high-value carts
|
|
529
530
|
const cart = actions.cart.getDetails();
|
package/docs/CONFIGURATION.md
CHANGED
|
@@ -11,7 +11,10 @@ const client = await Elements('YOUR_API_KEY', {
|
|
|
11
11
|
isBuilder: false,
|
|
12
12
|
customTheme: {},
|
|
13
13
|
proxy: {},
|
|
14
|
-
promoTicker: []
|
|
14
|
+
promoTicker: [],
|
|
15
|
+
checkout: {
|
|
16
|
+
pageUrl: 'https://yoursite.com/checkout?id={id}' // Optional: hosted checkout
|
|
17
|
+
}
|
|
15
18
|
});
|
|
16
19
|
```
|
|
17
20
|
|
|
@@ -262,6 +265,33 @@ activeUntil: '2025-12-31T23:59:59Z'
|
|
|
262
265
|
|
|
263
266
|
**Note:** Only active promotions are displayed.
|
|
264
267
|
|
|
268
|
+
### `checkout`
|
|
269
|
+
|
|
270
|
+
**Type:** `object`
|
|
271
|
+
**Default:** `undefined`
|
|
272
|
+
|
|
273
|
+
Configuration for hosted checkout (external checkout page).
|
|
274
|
+
|
|
275
|
+
```javascript
|
|
276
|
+
checkout: {
|
|
277
|
+
pageUrl: 'https://yoursite.com/checkout?id={id}'
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
**Properties:**
|
|
282
|
+
|
|
283
|
+
#### `checkout.pageUrl`
|
|
284
|
+
|
|
285
|
+
**Type:** `string` (required)
|
|
286
|
+
|
|
287
|
+
URL of your dedicated checkout page. The `{id}` placeholder is replaced with the checkout token.
|
|
288
|
+
|
|
289
|
+
```javascript
|
|
290
|
+
pageUrl: 'https://yoursite.com/checkout?id={id}'
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
When set, the "Go to Checkout" button in the cart redirects to this URL instead of opening the checkout drawer.
|
|
294
|
+
|
|
265
295
|
## Auto-Initialization Configuration
|
|
266
296
|
|
|
267
297
|
When using auto-initialization, configure via `data-` attributes on the script tag.
|
|
@@ -376,6 +406,28 @@ data-cart-badge-button="" <!-- Empty value = floating button w
|
|
|
376
406
|
- `replace:` - Replace the target element
|
|
377
407
|
- `inside:` - Place inside the target element (default)
|
|
378
408
|
|
|
409
|
+
#### `data-cart-mobile-button`
|
|
410
|
+
|
|
411
|
+
**Type:** `string`
|
|
412
|
+
|
|
413
|
+
Mobile-specific cart button (no badge). Same syntax as `data-cart-button` but only shown on mobile devices.
|
|
414
|
+
|
|
415
|
+
```html
|
|
416
|
+
data-cart-mobile-button="below:.mobile-header"
|
|
417
|
+
data-cart-mobile-button="inside:.mobile-nav"
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
#### `data-cart-mobile-badge-button`
|
|
421
|
+
|
|
422
|
+
**Type:** `string`
|
|
423
|
+
|
|
424
|
+
Mobile-specific cart button with item count badge. Same syntax as `data-cart-badge-button` but only shown on mobile devices.
|
|
425
|
+
|
|
426
|
+
```html
|
|
427
|
+
data-cart-mobile-badge-button="below:.mobile-header"
|
|
428
|
+
data-cart-mobile-badge-button="inside:.mobile-nav"
|
|
429
|
+
```
|
|
430
|
+
|
|
379
431
|
#### `data-cart-button-hidden`
|
|
380
432
|
|
|
381
433
|
**Type:** flag (no value)
|
|
@@ -517,11 +569,9 @@ data-product-2="00832889005513"
|
|
|
517
569
|
|
|
518
570
|
```html
|
|
519
571
|
<div data-liquid-commerce-elements-products-list
|
|
520
|
-
data-card="standard"
|
|
521
572
|
data-rows="3"
|
|
522
573
|
data-columns="4"
|
|
523
|
-
data-
|
|
524
|
-
data-filters="personalization,pre-order,delivery-options"
|
|
574
|
+
data-filters="engraving,presale,fulfillment,price,brands"
|
|
525
575
|
data-product-url="/product/{upc}">
|
|
526
576
|
</div>
|
|
527
577
|
```
|
|
@@ -534,23 +584,12 @@ data-product-2="00832889005513"
|
|
|
534
584
|
|
|
535
585
|
Enables product list on this div element.
|
|
536
586
|
|
|
537
|
-
##### `data-card`
|
|
538
|
-
|
|
539
|
-
**Type:** `'standard'`
|
|
540
|
-
**Default:** `'standard'`
|
|
541
|
-
|
|
542
|
-
Card variant style.
|
|
543
|
-
|
|
544
|
-
```html
|
|
545
|
-
data-card="standard"
|
|
546
|
-
```
|
|
547
|
-
|
|
548
587
|
##### `data-rows`
|
|
549
588
|
|
|
550
|
-
**Type:** `number`
|
|
589
|
+
**Type:** `number`
|
|
551
590
|
**Default:** `3`
|
|
552
591
|
|
|
553
|
-
Number of rows to display per page.
|
|
592
|
+
Number of rows to display per page (1-10).
|
|
554
593
|
|
|
555
594
|
```html
|
|
556
595
|
data-rows="4"
|
|
@@ -558,39 +597,40 @@ data-rows="4"
|
|
|
558
597
|
|
|
559
598
|
##### `data-columns`
|
|
560
599
|
|
|
561
|
-
**Type:** `number`
|
|
600
|
+
**Type:** `number`
|
|
562
601
|
**Default:** `4`
|
|
563
602
|
|
|
564
|
-
Number of columns in the grid.
|
|
603
|
+
Number of columns in the grid (1-4).
|
|
565
604
|
|
|
566
605
|
```html
|
|
567
606
|
data-columns="4"
|
|
568
607
|
```
|
|
569
608
|
|
|
570
|
-
##### `data-card-fill`
|
|
571
|
-
|
|
572
|
-
**Type:** flag (no value)
|
|
573
|
-
|
|
574
|
-
Whether cards should fill the whole card with white background color to match the image background color.
|
|
575
|
-
|
|
576
|
-
```html
|
|
577
|
-
data-card-fill
|
|
578
|
-
```
|
|
579
|
-
|
|
580
609
|
##### `data-filters`
|
|
581
610
|
|
|
582
611
|
**Type:** `string` (comma-separated)
|
|
583
612
|
|
|
584
|
-
Filter types to enable
|
|
613
|
+
Filter types to enable.
|
|
585
614
|
|
|
586
615
|
```html
|
|
587
|
-
data-filters="
|
|
616
|
+
data-filters="engraving,presale,fulfillment,price,brands"
|
|
588
617
|
```
|
|
589
618
|
|
|
590
619
|
**Available filters:**
|
|
591
|
-
- `
|
|
592
|
-
- `
|
|
593
|
-
- `
|
|
620
|
+
- `engraving` - Show filter for personalized/engravable products
|
|
621
|
+
- `presale` - Show filter for pre-order products
|
|
622
|
+
- `fulfillment` - Show filter for delivery type (shipping, onDemand)
|
|
623
|
+
- `price` - Show price range filter
|
|
624
|
+
- `brands` - Show brand filter
|
|
625
|
+
- `categories` - Show category filter
|
|
626
|
+
- `flavor` - Show flavor filter
|
|
627
|
+
- `region` - Show region filter
|
|
628
|
+
- `variety` - Show variety filter
|
|
629
|
+
- `vintage` - Show vintage year filter
|
|
630
|
+
- `country` - Show country filter
|
|
631
|
+
- `appellation` - Show appellation filter
|
|
632
|
+
- `materials` - Show materials filter
|
|
633
|
+
- `sizes` - Show size filter
|
|
594
634
|
|
|
595
635
|
##### `data-product-url`
|
|
596
636
|
|
|
@@ -607,6 +647,60 @@ data-product-url="/products/{grouping}"
|
|
|
607
647
|
- `{upc}` - Replaced with product UPC
|
|
608
648
|
- `{grouping}` - Replaced with Salsify grouping ID
|
|
609
649
|
|
|
650
|
+
### Product List Search and Filters Containers
|
|
651
|
+
|
|
652
|
+
You can place search and filter components in separate containers:
|
|
653
|
+
|
|
654
|
+
```html
|
|
655
|
+
<!-- Search bar (any div) -->
|
|
656
|
+
<div data-search-container></div>
|
|
657
|
+
|
|
658
|
+
<!-- Filter panel (any div) -->
|
|
659
|
+
<div data-filters-container></div>
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
These work alongside the main `data-liquid-commerce-elements-products-list` container. The search and filter components communicate with the product list automatically.
|
|
663
|
+
|
|
664
|
+
### Checkout URL Configuration
|
|
665
|
+
|
|
666
|
+
#### `data-checkout-url`
|
|
667
|
+
|
|
668
|
+
**Type:** `string`
|
|
669
|
+
|
|
670
|
+
URL for hosted checkout page. The `{id}` placeholder is replaced with the checkout token.
|
|
671
|
+
|
|
672
|
+
```html
|
|
673
|
+
data-checkout-url="https://yoursite.com/checkout?id={id}"
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
When set, the "Go to Checkout" button in the cart redirects to this URL instead of opening the checkout drawer.
|
|
677
|
+
|
|
678
|
+
### Custom Cart Elements
|
|
679
|
+
|
|
680
|
+
#### `data-lce-cart-toggle-button`
|
|
681
|
+
|
|
682
|
+
**Type:** flag (no value)
|
|
683
|
+
|
|
684
|
+
Add to any element to make it toggle the cart open/closed on click.
|
|
685
|
+
|
|
686
|
+
```html
|
|
687
|
+
<button data-lce-cart-toggle-button>Open Cart</button>
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
#### `data-lce-cart-items-count`
|
|
691
|
+
|
|
692
|
+
**Type:** `string` (optional value: `"keep-zero"`)
|
|
693
|
+
|
|
694
|
+
Displays the current cart item count inside the element. Updated automatically.
|
|
695
|
+
|
|
696
|
+
```html
|
|
697
|
+
<!-- Hides when count is 0 -->
|
|
698
|
+
<span data-lce-cart-items-count></span>
|
|
699
|
+
|
|
700
|
+
<!-- Always shows count, even when 0 -->
|
|
701
|
+
<span data-lce-cart-items-count="keep-zero">0</span>
|
|
702
|
+
```
|
|
703
|
+
|
|
610
704
|
### URL Parameter Configuration
|
|
611
705
|
|
|
612
706
|
#### `data-product-param`
|
|
@@ -692,6 +786,51 @@ data-promo-active-from="2025-01-01T00:00:00Z"
|
|
|
692
786
|
data-promo-active-until="2025-12-31T23:59:59Z"
|
|
693
787
|
```
|
|
694
788
|
|
|
789
|
+
## Checkout-Only Build (Hosted Checkout)
|
|
790
|
+
|
|
791
|
+
For hosted checkout pages, use the checkout-only build for a smaller bundle.
|
|
792
|
+
|
|
793
|
+
### Auto-Initialization
|
|
794
|
+
|
|
795
|
+
```html
|
|
796
|
+
<script
|
|
797
|
+
data-liquid-commerce-checkout
|
|
798
|
+
data-token="YOUR_API_KEY"
|
|
799
|
+
data-env="production"
|
|
800
|
+
data-debug-mode="none"
|
|
801
|
+
src="https://assets-elements.liquidcommerce.us/checkout/elements.js"
|
|
802
|
+
></script>
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
**Attributes:**
|
|
806
|
+
- `data-liquid-commerce-checkout` - Enables checkout-only auto-initialization (required)
|
|
807
|
+
- `data-token` - Your API key (required)
|
|
808
|
+
- `data-env` - Environment: `production`, `staging`, `development`
|
|
809
|
+
- `data-debug-mode` - Debug mode: `console`, `panel`
|
|
810
|
+
- `data-checkout-url` - Checkout page URL (for redirect behavior)
|
|
811
|
+
|
|
812
|
+
### Programmatic Initialization
|
|
813
|
+
|
|
814
|
+
```javascript
|
|
815
|
+
import { ElementsCheckout } from '@liquidcommerce/elements-sdk/checkout';
|
|
816
|
+
|
|
817
|
+
const client = await ElementsCheckout('YOUR_API_KEY', {
|
|
818
|
+
env: 'production'
|
|
819
|
+
});
|
|
820
|
+
|
|
821
|
+
const component = await client.injectCheckout({
|
|
822
|
+
containerId: 'checkout-container',
|
|
823
|
+
checkoutId: 'checkout-token-from-url', // Optional: checkout token
|
|
824
|
+
hideHeader: true // Optional
|
|
825
|
+
});
|
|
826
|
+
```
|
|
827
|
+
|
|
828
|
+
**Differences from full SDK:**
|
|
829
|
+
- Smaller bundle (tree-shaken, no product/cart/PLP components)
|
|
830
|
+
- Only `injectCheckout()` method available (no `injectProductElement`, `injectCartElement`, etc.)
|
|
831
|
+
- Checkout actions only (no `openCheckout`/`closeCheckout`/`toggleCheckout` drawer controls)
|
|
832
|
+
- Same theming, events, and configuration system
|
|
833
|
+
|
|
695
834
|
## TypeScript Types
|
|
696
835
|
|
|
697
836
|
### `ILiquidCommerceElementsConfig`
|
|
@@ -704,6 +843,11 @@ interface ILiquidCommerceElementsConfig {
|
|
|
704
843
|
customTheme?: IClientCustomThemeConfig;
|
|
705
844
|
proxy?: IElementsProxyConfig;
|
|
706
845
|
promoTicker?: IPromoTicker[];
|
|
846
|
+
checkout?: ILiquidCommerceElementsCheckoutConfig;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
interface ILiquidCommerceElementsCheckoutConfig {
|
|
850
|
+
pageUrl: string; // URL with {id} placeholder for checkout token
|
|
707
851
|
}
|
|
708
852
|
```
|
|
709
853
|
|