@liquidcommerce/elements-sdk 2.7.2 → 2.7.3
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 +1 -1
- package/dist/index.checkout.esm.js +7272 -7383
- package/dist/index.esm.js +12223 -12452
- package/dist/ssr-stub.checkout.esm.js +18 -0
- package/dist/ssr-stub.esm.js +270 -0
- package/dist/types/auto-initialize/shared-utils.d.ts +3 -1
- package/dist/types/clients/base.d.ts +6 -4
- package/dist/types/clients/builder.d.ts +2 -1
- package/dist/types/clients/checkout.d.ts +2 -10
- package/dist/types/clients/main.d.ts +2 -1
- package/dist/types/constants/core.constant.d.ts +0 -5
- package/dist/types/core/api/api-client.service.d.ts +16 -15
- package/dist/types/core/api/api-result.d.ts +19 -0
- package/dist/types/core/api/auth-client.service.d.ts +13 -5
- package/dist/types/core/client/client-action.service.d.ts +1 -1
- package/dist/types/core/client/client-config.service.d.ts +1 -1
- package/dist/types/core/pubsub/pubsub.service.d.ts +0 -2
- package/dist/types/core/singleton-manager.service.d.ts +12 -8
- package/dist/types/core/store/interfaces/core.interface.d.ts +7 -11
- package/dist/types/core/store/interfaces/product-list.interface.d.ts +12 -28
- package/dist/types/core/store/store.service.d.ts +1 -0
- package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
- package/dist/types/enums/core.enum.d.ts +5 -4
- package/dist/types/index.checkout.d.ts +3 -2
- package/dist/types/index.checkout.umd.d.ts +1 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/interfaces/client.interface.d.ts +72 -0
- package/dist/types/interfaces/component.interface.d.ts +7 -0
- package/dist/types/interfaces/config.interface.d.ts +46 -0
- package/dist/types/interfaces/configs/address.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/cart.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/checkout.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/global.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/product-list.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/product.interface.d.ts +1 -1
- package/dist/types/interfaces/injection.interface.d.ts +44 -0
- package/dist/types/modules/address/address-input.component.d.ts +0 -11
- package/dist/types/modules/address/address.command.d.ts +1 -1
- package/dist/types/modules/checkout/components/checkout-completed.component.d.ts +1 -0
- package/dist/types/modules/product/components/product-image-carousel.component.d.ts +3 -0
- package/dist/types/modules/product/components/product-retailers-carousel.component.d.ts +3 -0
- package/dist/types/modules/product/components/product-retailers-popup-list.component.d.ts +3 -2
- package/dist/types/modules/product/product.commands.d.ts +1 -3
- package/dist/types/modules/product-list/components/card-components/index.d.ts +0 -2
- package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +1 -0
- package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +9 -3
- package/dist/types/modules/product-list/components/index.d.ts +1 -1
- package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +2 -5
- package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +3 -3
- package/dist/types/modules/product-list/components/product-list-product-engraving-lines.component.d.ts +21 -0
- package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +30 -14
- package/dist/types/modules/product-list/components/product-list-search.component.d.ts +0 -2
- package/dist/types/modules/product-list/product-list-card.component.d.ts +18 -16
- package/dist/types/modules/product-list/product-list-filter.utils.d.ts +8 -0
- package/dist/types/modules/product-list/product-list.commands.d.ts +7 -54
- package/dist/types/modules/product-list/product-list.component.d.ts +2 -11
- package/dist/types/modules/product-list/product-list.interface.d.ts +0 -30
- package/dist/types/modules/ui-components/drawer/drawer.component.d.ts +1 -0
- package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +1 -10
- package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +4 -1
- package/dist/types/modules/ui-components/promo-code-ticker/promo-code-ticker.component.d.ts +1 -1
- package/dist/types/modules/ui-components/ui.commands.d.ts +6 -4
- package/dist/types/ssr/stub.checkout.d.ts +6 -0
- package/dist/types/ssr/stub.d.ts +10 -0
- package/dist/types/utils/product-selection.d.ts +16 -0
- package/dist/types/utils/product.d.ts +10 -0
- package/docs/v1/README.md +2 -2
- package/docs/v1/api/actions/address-actions.md +11 -11
- package/docs/v1/api/actions/cart-actions.md +13 -13
- package/docs/v1/api/actions/checkout-actions.md +23 -23
- package/docs/v1/api/actions/product-actions.md +6 -6
- package/docs/v1/api/client.md +11 -11
- package/docs/v1/api/ui-helpers.md +11 -11
- package/docs/v1/examples/advanced-patterns.md +1 -1
- package/docs/v1/examples/checkout-flow.md +1 -1
- package/docs/v1/getting-started/concepts.md +7 -7
- package/docs/v1/getting-started/installation.md +2 -2
- package/docs/v1/getting-started/quick-start.md +3 -3
- package/docs/v1/guides/address-component.md +11 -11
- package/docs/v1/guides/best-practices.md +14 -14
- package/docs/v1/guides/cart-component.md +23 -23
- package/docs/v1/guides/checkout-component.md +24 -24
- package/docs/v1/guides/product-component.md +5 -5
- package/docs/v1/integration/nextjs.md +11 -2
- package/docs/v1/integration/react.md +3 -3
- package/docs/v1/integration/vanilla-js.md +1 -1
- package/docs/v1/integration/vue.md +24 -0
- package/docs/v1/reference/error-handling.md +2 -2
- package/docs/v1/reference/troubleshooting.md +10 -2
- package/package.json +17 -13
- package/dist/types/interfaces/core.interface.d.ts +0 -140
- package/dist/types/modules/product-list/components/card-components/product-fulfillments.d.ts +0 -12
- package/dist/types/modules/product-list/components/card-components/product-title.d.ts +0 -6
- package/dist/types/modules/product-list/components/product-list-retailers.component.d.ts +0 -26
- package/dist/types/modules/ui-components/modal/modal.component.d.ts +0 -23
- package/dist/types/modules/ui-components/styles/modal.style.d.ts +0 -1
- package/docs/gitbook/actions.md +0 -964
- package/docs/gitbook/address.md +0 -48
- package/docs/gitbook/cart.md +0 -65
- package/docs/gitbook/checkout.md +0 -131
- package/docs/gitbook/events.md +0 -1765
- package/docs/gitbook/overview.md +0 -166
- package/docs/gitbook/product.md +0 -64
- package/docs/gitbook/quick-start-guide.md +0 -393
|
@@ -9,9 +9,7 @@ export declare class ProductListSearchComponent extends BaseComponent {
|
|
|
9
9
|
private readonly DEFAULT_DEBOUNCE_MS;
|
|
10
10
|
get hostClasses(): string[];
|
|
11
11
|
disconnectedCallback(): void;
|
|
12
|
-
getCurrentSearchTerm(): string;
|
|
13
12
|
private fetchProducts;
|
|
14
|
-
private buildCurrentFiltersFromState;
|
|
15
13
|
protected template(): HTMLElement[];
|
|
16
14
|
private handleDebouncedSearch;
|
|
17
15
|
private handleClearSearch;
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import type { IProductListProduct } from 'core/store/interfaces/product-list.interface';
|
|
2
1
|
import type { IProductListComponent } from 'interfaces/configs';
|
|
3
|
-
import { BaseComponent } from '@/core/base-component.service';
|
|
4
|
-
import type { IFulfillment } from '@/interfaces/api/product.interface';
|
|
2
|
+
import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
|
|
5
3
|
export interface IProductListCardParams {
|
|
6
|
-
|
|
7
|
-
shippingFulfillment: IFulfillment | null;
|
|
8
|
-
onDemandFulfillment: IFulfillment | null;
|
|
4
|
+
productId: string;
|
|
9
5
|
productUrl?: string;
|
|
10
6
|
}
|
|
11
7
|
export declare class ProductListCardComponent extends BaseComponent<IProductListCardParams, IProductListComponent> {
|
|
12
|
-
private
|
|
13
|
-
private
|
|
8
|
+
private imageElement;
|
|
9
|
+
private priceElement;
|
|
10
|
+
private personalizeElement;
|
|
11
|
+
private fulfillmentTextElement;
|
|
12
|
+
private addToCartButton;
|
|
13
|
+
private previousSelectedSizeId;
|
|
14
|
+
private previousSelectedFulfillmentId;
|
|
14
15
|
constructor();
|
|
15
16
|
get hostClasses(): string[];
|
|
16
|
-
protected
|
|
17
|
-
|
|
18
|
-
private
|
|
17
|
+
protected disconnected?(): void;
|
|
18
|
+
onStoreWatch(changes: IOnStoreChanged[]): void;
|
|
19
|
+
private getSelectedSize;
|
|
19
20
|
protected template(): HTMLElement[];
|
|
21
|
+
private updatePriceDisplay;
|
|
22
|
+
private updateFulfillmentText;
|
|
23
|
+
private updateImage;
|
|
24
|
+
private updatePersonalizeVisibility;
|
|
25
|
+
private updateAddToCartButton;
|
|
20
26
|
private generateProductUrl;
|
|
21
|
-
private createVariantStandard;
|
|
22
27
|
private createImageSection;
|
|
23
28
|
private createContentSection;
|
|
24
|
-
private createPricePersonalizationSection;
|
|
25
|
-
private createSizesSection;
|
|
26
|
-
private handleDeliveryOptionsClick;
|
|
27
29
|
private createFulfillmentSectionWrapper;
|
|
28
|
-
createFulfillmentTextSection
|
|
30
|
+
private createFulfillmentTextSection;
|
|
29
31
|
private createAddToCartSection;
|
|
30
32
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IFilterSchema, IProductSearchParams } from '@/interfaces/api/product-list.interface';
|
|
2
|
+
import type { ProductListFilterType } from '@/interfaces/injection.interface';
|
|
3
|
+
import type { IExtendedFilterSchema, IProductListFilters } from './product-list.interface';
|
|
4
|
+
export declare const FILTER_TYPE_MAP: Record<string, string>;
|
|
5
|
+
export declare function getSanitizedFilters(filters: IFilterSchema[], configuredFilters: ProductListFilterType[]): IExtendedFilterSchema[];
|
|
6
|
+
export declare function syncFiltersToAppliedFormat(filters: IProductListFilters): Record<string, string[]>;
|
|
7
|
+
export declare function buildSearchParams(page: number, perPage: number, searchTerm: string, currentFilters: IProductListFilters, configuredFilters: ProductListFilterType[]): IProductSearchParams;
|
|
8
|
+
export declare function buildCurrentFiltersFromState(stateFilters: Record<string, string[]>): IProductListFilters;
|
|
@@ -1,76 +1,29 @@
|
|
|
1
|
-
import type { IModalContentConfig } from 'core/store/interfaces/core.interface';
|
|
2
|
-
import type { IProductSizeStore } from 'core/store/interfaces/product.interface';
|
|
3
|
-
import type { IProductListProduct, IProductListStore } from 'core/store/interfaces/product-list.interface';
|
|
4
1
|
import { BaseCommand } from '@/core/command/base-command.service';
|
|
5
2
|
import { type FulfillmentType } from '@/enums';
|
|
6
|
-
import type { IFulfillment, IProduct, IProductSizeAttributes, IRetailer } from '@/interfaces/api/product.interface';
|
|
7
3
|
import type { IFilterSchema, INavigationResponse, IProductSearchParams, IProductSearchResponse } from '@/interfaces/api/product-list.interface';
|
|
8
|
-
import type { ProductListFilterType } from '@/interfaces/
|
|
4
|
+
import type { ProductListFilterType } from '@/interfaces/injection.interface';
|
|
9
5
|
import { type AddItemParams } from '@/modules/cart/cart.commands';
|
|
10
|
-
import type { IExtendedFilterSchema, IPagination,
|
|
11
|
-
type StateListener = (state: IProductListStore) => void;
|
|
6
|
+
import type { IExtendedFilterSchema, IPagination, IProductListFilters } from './product-list.interface';
|
|
12
7
|
export declare class ProductListCommands extends BaseCommand {
|
|
13
8
|
private readonly uiCommands;
|
|
14
9
|
private readonly cartCommands;
|
|
15
|
-
private readonly checkoutCommands;
|
|
16
|
-
private readonly FILTER_TYPE_MAP;
|
|
17
|
-
private listeners;
|
|
18
10
|
constructor();
|
|
19
11
|
static getInstance(): ProductListCommands;
|
|
20
|
-
subscribe(listener: StateListener): () => void;
|
|
21
|
-
private getStoreState;
|
|
22
12
|
updateSearchTerm(searchTerm: string): void;
|
|
23
13
|
setLoading(isLoading: boolean): void;
|
|
24
|
-
private notifyListeners;
|
|
25
|
-
private initializeProductFulfillment;
|
|
26
|
-
private transformProductVariantsToFulfillments;
|
|
27
|
-
private transformSingleProduct;
|
|
28
|
-
private transformProductSize;
|
|
29
|
-
private addShippingFulfillments;
|
|
30
|
-
private addOnDemandFulfillments;
|
|
31
14
|
loadInitialProducts(page: number, perPage: number, searchTerm: string, currentFilters: IProductListFilters, configuredFilters: ProductListFilterType[]): Promise<void>;
|
|
32
15
|
loadMoreProducts(perPage: number, searchTerm: string, currentFilters: IProductListFilters, configuredFilters: ProductListFilterType[]): Promise<void>;
|
|
33
16
|
getProductList(params: IProductSearchParams): Promise<IProductSearchResponse>;
|
|
34
17
|
syncFiltersFromComponent(filters: IProductListFilters): void;
|
|
35
18
|
getSanitizedFilters(filters: IFilterSchema[], configuredFilters: ProductListFilterType[]): IExtendedFilterSchema[];
|
|
36
|
-
buildSearchParams(page: number, perPage: number, searchTerm: string, currentFilters: IProductListFilters, configuredFilters: ProductListFilterType[]): IProductSearchParams;
|
|
37
|
-
private buildFilters;
|
|
38
|
-
private addToggleFilters;
|
|
39
|
-
private getBooleanFilterValue;
|
|
40
|
-
private addEngravingFilter;
|
|
41
|
-
private addPresaleFilter;
|
|
42
|
-
private addFulfillmentFilter;
|
|
43
|
-
private addPriceFilter;
|
|
44
|
-
private addDynamicFilters;
|
|
45
19
|
setGridConfig(rows: number, columns: number): void;
|
|
46
20
|
getItemsPerPage(): number;
|
|
47
21
|
updatePagination(navigation: INavigationResponse | undefined): IPagination;
|
|
48
22
|
createInitialPagination(): IPagination;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} | null;
|
|
54
|
-
private getFilterKeyToTypeMap;
|
|
55
|
-
addToCart(params: AddItemParams): Promise<void>;
|
|
56
|
-
addPresaleToCart(params: AddItemParams): Promise<void>;
|
|
57
|
-
trackViewItemList(products: IProduct[]): void;
|
|
58
|
-
trackSelectItem(product: IProductListProduct): void;
|
|
59
|
-
private convertProductToBaseItem;
|
|
60
|
-
openProductListModal(productId: string, contentType: IModalContentConfig['type'], data?: Record<string, any>): void;
|
|
61
|
-
closeProductListModal(productId: string): void;
|
|
62
|
-
selectFulfillmentType: (productId: string, selectedFulfillmentType: FulfillmentType) => Promise<void>;
|
|
63
|
-
selectFulfillment: (productId: string, fulfillmentId: string) => Promise<void>;
|
|
64
|
-
selectSize: (productId: string, sizeId: string) => Promise<void>;
|
|
65
|
-
private getFulfillmentForSize;
|
|
23
|
+
addToCart(productId: string, params: AddItemParams): Promise<void>;
|
|
24
|
+
selectSize(productId: string, sizeId: string): Promise<void>;
|
|
25
|
+
changeFulfillmentType: (productId: string, newFulfillmentType: FulfillmentType) => Promise<void>;
|
|
26
|
+
selectFulfillment: (productId: string, selectedFulfillmentId: string) => Promise<void>;
|
|
66
27
|
updateQuantity: (productId: string, quantity: number) => void;
|
|
67
|
-
|
|
68
|
-
product: IProductListProduct;
|
|
69
|
-
size?: IProductSizeStore;
|
|
70
|
-
shippingFulfillment?: IFulfillment | null;
|
|
71
|
-
onDemandFulfillment?: IFulfillment | null;
|
|
72
|
-
state?: string;
|
|
73
|
-
}): IProductAvailabilityData;
|
|
74
|
-
isPresaleActive(sizeAttributes: IProductSizeAttributes): boolean;
|
|
28
|
+
saveEngravingLines(productId: string, engravingLines: string[]): void;
|
|
75
29
|
}
|
|
76
|
-
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IProductListComponent } from 'interfaces/configs';
|
|
2
2
|
import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
|
|
3
|
-
import type { ProductListFilterType } from '@/interfaces/
|
|
3
|
+
import type { ProductListFilterType } from '@/interfaces/injection.interface';
|
|
4
4
|
export interface IProductListComponentParams {
|
|
5
5
|
rows: number;
|
|
6
6
|
columns: number;
|
|
@@ -9,7 +9,6 @@ export interface IProductListComponentParams {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class ProductListComponent extends BaseComponent<IProductListComponentParams, IProductListComponent> {
|
|
11
11
|
private products;
|
|
12
|
-
private retailers;
|
|
13
12
|
private pagination;
|
|
14
13
|
private cardsContainer;
|
|
15
14
|
private sentinelElement;
|
|
@@ -22,23 +21,15 @@ export declare class ProductListComponent extends BaseComponent<IProductListComp
|
|
|
22
21
|
protected connected(): Promise<void>;
|
|
23
22
|
disconnected(): void;
|
|
24
23
|
private initializeComponent;
|
|
25
|
-
private
|
|
26
|
-
private updateLoadingState;
|
|
27
|
-
private hasProductsChanged;
|
|
28
|
-
private updateProductData;
|
|
29
|
-
private handleProductRendering;
|
|
30
|
-
private renderSimplifiedProducts;
|
|
24
|
+
private toProductArray;
|
|
31
25
|
private setLoadingState;
|
|
32
26
|
private renderCurrentState;
|
|
33
27
|
private loadInitialProducts;
|
|
34
28
|
private loadMoreProducts;
|
|
35
|
-
private buildCurrentFiltersFromState;
|
|
36
|
-
private mapStateFilterToComponentFilter;
|
|
37
29
|
private createCardsContainer;
|
|
38
30
|
private renderLoadingState;
|
|
39
31
|
private renderProducts;
|
|
40
32
|
private appendNewProducts;
|
|
41
|
-
private createProductCard;
|
|
42
33
|
private getResponsiveColumns;
|
|
43
34
|
private setupInfiniteScroll;
|
|
44
35
|
private createScrollSentinel;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { IProductFulfillmentStore, IProductSizeStore } from 'core/store/interfaces/product.interface';
|
|
2
1
|
import type { IFilterValue } from '@/interfaces/api/product-list.interface';
|
|
3
2
|
export interface IPriceConfig {
|
|
4
3
|
min?: string;
|
|
@@ -12,9 +11,6 @@ export interface IExtendedFilterSchema {
|
|
|
12
11
|
type: string;
|
|
13
12
|
values: IFilterValue[];
|
|
14
13
|
}
|
|
15
|
-
export interface IProductListSearch {
|
|
16
|
-
searchTerm: string;
|
|
17
|
-
}
|
|
18
14
|
export interface IPagination {
|
|
19
15
|
currentPage: number;
|
|
20
16
|
totalPages: number;
|
|
@@ -58,29 +54,3 @@ export interface IRenderCheckboxItemsParams {
|
|
|
58
54
|
state: ICheckboxLabelStates;
|
|
59
55
|
onCheckboxChange: (value: string, checked: boolean) => void;
|
|
60
56
|
}
|
|
61
|
-
export interface ICreateFiltersContainerParams {
|
|
62
|
-
isDrawerMode?: boolean;
|
|
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
|
-
presaleShipBy: string | null;
|
|
74
|
-
}
|
|
75
|
-
export interface IProductVariantParams {
|
|
76
|
-
image: string;
|
|
77
|
-
name: string;
|
|
78
|
-
size: string | null;
|
|
79
|
-
price: number;
|
|
80
|
-
availability: IProductAvailabilityData;
|
|
81
|
-
hasPersonalization: boolean;
|
|
82
|
-
sizes: Record<string, IProductSizeStore>;
|
|
83
|
-
maxQuantityPerOrder: number;
|
|
84
|
-
shippingVariants: Record<string, IProductFulfillmentStore>;
|
|
85
|
-
onDemandVariants: Record<string, IProductFulfillmentStore>;
|
|
86
|
-
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type { IProductListProduct } from 'core/store/interfaces/product-list.interface';
|
|
2
|
-
import type { IFulfillment } from 'interfaces/api/product.interface';
|
|
3
1
|
import { BaseComponent } from '@/core/base-component.service';
|
|
4
|
-
import { type DisplayModeType
|
|
5
|
-
import type { IProductListComponent } from '@/interfaces/configs';
|
|
2
|
+
import { type DisplayModeType } from '@/enums';
|
|
6
3
|
export interface IEngravingFormComponentParams {
|
|
7
4
|
identifier: string;
|
|
8
5
|
context: 'product' | 'cart' | 'product-list';
|
|
@@ -12,12 +9,6 @@ export interface IEngravingFormComponentParams {
|
|
|
12
9
|
fee: number;
|
|
13
10
|
location?: string;
|
|
14
11
|
displayMode?: DisplayModeType;
|
|
15
|
-
navigationSource?: NavigationSourceType;
|
|
16
|
-
product?: IProductListProduct;
|
|
17
|
-
shippingFulfillment?: IFulfillment | null;
|
|
18
|
-
onDemandFulfillment?: IFulfillment | null;
|
|
19
|
-
showCollections?: boolean;
|
|
20
|
-
config?: IProductListComponent;
|
|
21
12
|
}
|
|
22
13
|
export declare class EngravingFormComponent extends BaseComponent<IEngravingFormComponentParams, null> {
|
|
23
14
|
get hostClasses(): string[];
|
|
@@ -2,7 +2,10 @@ import { BaseComponent } from '@/core/base-component.service';
|
|
|
2
2
|
import type { IProductComponent } from '@/interfaces/configs';
|
|
3
3
|
export interface IEngravingViewComponentParams {
|
|
4
4
|
identifier: string;
|
|
5
|
-
context: 'cart' | 'checkout';
|
|
5
|
+
context: 'cart' | 'checkout' | 'product-list';
|
|
6
|
+
productListMaxLines?: number;
|
|
7
|
+
productListMaxCharsPerLine?: number;
|
|
8
|
+
productListLocation?: string;
|
|
6
9
|
}
|
|
7
10
|
export declare class EngravingViewComponent extends BaseComponent<IEngravingViewComponentParams, IProductComponent> {
|
|
8
11
|
get hostClasses(): string[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
|
|
2
2
|
import type { IPromoTicker } from '@/interfaces/configs';
|
|
3
3
|
export interface IPromoCodeTickerParams {
|
|
4
|
-
context: 'cart'
|
|
4
|
+
context: 'cart';
|
|
5
5
|
tickers: IPromoTicker[];
|
|
6
6
|
}
|
|
7
7
|
export declare class PromoCodeTickerComponent extends BaseComponent<IPromoCodeTickerParams, null> {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { BaseCommand } from '@/core/command/base-command.service';
|
|
2
|
-
import type { IDrawerContentConfig
|
|
2
|
+
import type { IDrawerContentConfig } from '@/core/store/interfaces/core.interface';
|
|
3
3
|
export declare class UICommands extends BaseCommand {
|
|
4
4
|
static getInstance(): UICommands;
|
|
5
|
-
openDrawer(
|
|
5
|
+
openDrawer({ mode, contentType, data, }: {
|
|
6
|
+
mode?: 'drawer' | 'modal';
|
|
7
|
+
contentType: IDrawerContentConfig['type'];
|
|
8
|
+
data?: Record<string, any>;
|
|
9
|
+
}): void;
|
|
6
10
|
closeDrawer(): void;
|
|
7
|
-
openModal(contentType: IModalContentConfig['type'], data?: Record<string, any>): void;
|
|
8
|
-
closeModal(): void;
|
|
9
11
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { DebugMode, ElementsEnv } from '../enums/core.enum';
|
|
2
|
+
export { DEBUG_MODE, ELEMENTS_ENV } from '../enums/core.enum';
|
|
3
|
+
export type { IElementsCheckoutActions, IElementsCheckoutClient, } from '../interfaces/client.interface';
|
|
4
|
+
export type { IInjectedComponent } from '../interfaces/component.interface';
|
|
5
|
+
export type { ILiquidCommerceElementsCheckoutClientConfig } from '../interfaces/config.interface';
|
|
6
|
+
export declare function ElementsCheckout(..._args: any[]): Promise<null>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { SDKError, isSDKError } from '../core/sdk-error-handler';
|
|
2
|
+
export type { CartEventLevel, CartEventType, CheckoutEventLevel, CheckoutEventType, ComponentType, DebugMode, DisplayModeType, ElementsEnv, FulfillmentType, NavigationSourceType, } from '../enums/core.enum';
|
|
3
|
+
export { CART_EVENT_LEVEL, CART_EVENT_TYPE, CHECKOUT_EVENT_LEVEL, CHECKOUT_EVENT_TYPE, COMPONENT_TYPE, DEBUG_MODE, DISPLAY_MODE, ELEMENTS_ACTIONS_EVENT, ELEMENTS_ENV, ELEMENTS_FORM, FULFILLMENT_TYPE, NAVIGATION_SOURCE, } from '../enums/core.enum';
|
|
4
|
+
export type { ILiquidCommerceElementsActions, ILiquidCommerceElementsBuilderClient, ILiquidCommerceElementsClient, } from '../interfaces/client.interface';
|
|
5
|
+
export type { IInjectedComponent } from '../interfaces/component.interface';
|
|
6
|
+
export type { IElementsProxyConfig, ILiquidCommerceElementsBuilderConfig, ILiquidCommerceElementsCheckoutConfig, ILiquidCommerceElementsConfig, ILiquidCommerceElementsDevelopmentConfig, } from '../interfaces/config.interface';
|
|
7
|
+
export type * from '../interfaces/configs';
|
|
8
|
+
export type { IBuilderInjectElementParams, IInjectCheckoutBuilderParams, IInjectCheckoutParams, IInjectProductElement, IInjectProductListFiltersParams, IInjectProductListParams, IInjectProductListSearchParams, ProductListFilterType, } from '../interfaces/injection.interface';
|
|
9
|
+
export declare function Elements(..._args: any[]): Promise<null>;
|
|
10
|
+
export declare function ElementsBuilder(..._args: any[]): Promise<null>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IProductFulfillmentStore, IProductSizeStore } from '@/core/store/interfaces/product.interface';
|
|
2
|
+
import { type FulfillmentType } from '@/enums';
|
|
3
|
+
export interface ISizeSelectionResult {
|
|
4
|
+
selectedFulfillmentType: FulfillmentType;
|
|
5
|
+
selectedFulfillment: IProductFulfillmentStore | null;
|
|
6
|
+
selectedFulfillmentId: string | null;
|
|
7
|
+
productHasAvailability: boolean;
|
|
8
|
+
fulfillmentHasAvailability: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface IFulfillmentTypeChangeResult {
|
|
11
|
+
selectedFulfillment: IProductFulfillmentStore | null;
|
|
12
|
+
selectedFulfillmentId: string | null;
|
|
13
|
+
fulfillmentHasAvailability: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function calculateSizeSelection(productSize: IProductSizeStore, currentFulfillmentType: FulfillmentType): ISizeSelectionResult;
|
|
16
|
+
export declare function calculateFulfillmentTypeChange(productSize: IProductSizeStore, newFulfillmentType: FulfillmentType): IFulfillmentTypeChangeResult | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IProductStore } from '@/core/store/interfaces/product.interface';
|
|
2
|
+
import type { IPLProductStore } from '@/core/store/interfaces/product-list.interface';
|
|
3
|
+
import type { IProduct, IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
|
|
4
|
+
export interface IPrepareApiProductForStoreParams {
|
|
5
|
+
context: 'product-list' | 'product-page';
|
|
6
|
+
product: IProduct;
|
|
7
|
+
retailers: IProductAvailabilityResponse['retailers'];
|
|
8
|
+
enableShippingFulfillment: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function prepareApiProductForStore({ context, product, retailers, enableShippingFulfillment, }: IPrepareApiProductForStoreParams): IProductStore | IPLProductStore;
|
package/docs/v1/README.md
CHANGED
|
@@ -125,13 +125,13 @@ await client.injectProductElement([
|
|
|
125
125
|
### Opening the Cart
|
|
126
126
|
|
|
127
127
|
```javascript
|
|
128
|
-
window.elements.actions.cart.openCart();
|
|
128
|
+
window.LiquidCommerce.elements.actions.cart.openCart();
|
|
129
129
|
```
|
|
130
130
|
|
|
131
131
|
### Adding to Cart Programmatically
|
|
132
132
|
|
|
133
133
|
```javascript
|
|
134
|
-
await window.elements.actions.cart.addProduct([
|
|
134
|
+
await window.LiquidCommerce.elements.actions.cart.addProduct([
|
|
135
135
|
{
|
|
136
136
|
identifier: '00619947000020',
|
|
137
137
|
fulfillmentType: 'shipping',
|
|
@@ -21,7 +21,7 @@ setAddressByPlacesId(placesId: string): Promise<void>
|
|
|
21
21
|
### Example
|
|
22
22
|
|
|
23
23
|
```javascript
|
|
24
|
-
await window.elements.actions.address.setAddressByPlacesId(
|
|
24
|
+
await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId(
|
|
25
25
|
'ChIJOwg_06VPwokRYv534QaPC8g'
|
|
26
26
|
);
|
|
27
27
|
```
|
|
@@ -65,7 +65,7 @@ interface IAddressCoordinates {
|
|
|
65
65
|
### Example
|
|
66
66
|
|
|
67
67
|
```javascript
|
|
68
|
-
await window.elements.actions.address.setAddressManually(
|
|
68
|
+
await window.LiquidCommerce.elements.actions.address.setAddressManually(
|
|
69
69
|
{
|
|
70
70
|
one: '123 Main Street',
|
|
71
71
|
two: 'Apt 4',
|
|
@@ -110,7 +110,7 @@ clear(): Promise<void>
|
|
|
110
110
|
### Example
|
|
111
111
|
|
|
112
112
|
```javascript
|
|
113
|
-
await window.elements.actions.address.clear();
|
|
113
|
+
await window.LiquidCommerce.elements.actions.address.clear();
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
### Effects
|
|
@@ -156,7 +156,7 @@ Returns `null` if no address is set.
|
|
|
156
156
|
### Example
|
|
157
157
|
|
|
158
158
|
```javascript
|
|
159
|
-
const address = window.elements.actions.address.getDetails();
|
|
159
|
+
const address = window.LiquidCommerce.elements.actions.address.getDetails();
|
|
160
160
|
|
|
161
161
|
if (address) {
|
|
162
162
|
console.log('Current address:', address.formattedAddress);
|
|
@@ -171,7 +171,7 @@ if (address) {
|
|
|
171
171
|
#### Check if Address is Set
|
|
172
172
|
|
|
173
173
|
```javascript
|
|
174
|
-
if (!window.elements.actions.address.getDetails()) {
|
|
174
|
+
if (!window.LiquidCommerce.elements.actions.address.getDetails()) {
|
|
175
175
|
// Prompt user to set address
|
|
176
176
|
showAddressPrompt();
|
|
177
177
|
}
|
|
@@ -180,7 +180,7 @@ if (!window.elements.actions.address.getDetails()) {
|
|
|
180
180
|
#### Display Current Address
|
|
181
181
|
|
|
182
182
|
```javascript
|
|
183
|
-
const address = window.elements.actions.address.getDetails();
|
|
183
|
+
const address = window.LiquidCommerce.elements.actions.address.getDetails();
|
|
184
184
|
|
|
185
185
|
if (address) {
|
|
186
186
|
document.getElementById('current-address').textContent =
|
|
@@ -217,10 +217,10 @@ Google Places provides accurate geocoding:
|
|
|
217
217
|
|
|
218
218
|
```javascript
|
|
219
219
|
// Good - accurate and validated
|
|
220
|
-
await window.elements.actions.address.setAddressByPlacesId(placesId);
|
|
220
|
+
await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId(placesId);
|
|
221
221
|
|
|
222
222
|
// Less ideal - requires manual geocoding
|
|
223
|
-
await window.elements.actions.address.setAddressManually(address, coords);
|
|
223
|
+
await window.LiquidCommerce.elements.actions.address.setAddressManually(address, coords);
|
|
224
224
|
```
|
|
225
225
|
|
|
226
226
|
### Validate Manual Addresses
|
|
@@ -244,7 +244,7 @@ async function setManualAddress(address, coords) {
|
|
|
244
244
|
throw new Error('Invalid ZIP code');
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
await window.elements.actions.address.setAddressManually(address, coords);
|
|
247
|
+
await window.LiquidCommerce.elements.actions.address.setAddressManually(address, coords);
|
|
248
248
|
}
|
|
249
249
|
```
|
|
250
250
|
|
|
@@ -252,7 +252,7 @@ async function setManualAddress(address, coords) {
|
|
|
252
252
|
|
|
253
253
|
```javascript
|
|
254
254
|
try {
|
|
255
|
-
await window.elements.actions.address.setAddressByPlacesId(placesId);
|
|
255
|
+
await window.LiquidCommerce.elements.actions.address.setAddressByPlacesId(placesId);
|
|
256
256
|
showSuccess('Address saved!');
|
|
257
257
|
} catch (error) {
|
|
258
258
|
console.error('Failed to set address:', error);
|
|
@@ -266,7 +266,7 @@ Set address as soon as possible in user flow:
|
|
|
266
266
|
|
|
267
267
|
```javascript
|
|
268
268
|
window.addEventListener('lce:actions.client_ready', () => {
|
|
269
|
-
if (!window.elements.actions.address.getDetails()) {
|
|
269
|
+
if (!window.LiquidCommerce.elements.actions.address.getDetails()) {
|
|
270
270
|
// Prompt for address on first visit
|
|
271
271
|
showAddressModal();
|
|
272
272
|
}
|
|
@@ -15,7 +15,7 @@ openCart(): void
|
|
|
15
15
|
### Example
|
|
16
16
|
|
|
17
17
|
```javascript
|
|
18
|
-
window.elements.actions.cart.openCart();
|
|
18
|
+
window.LiquidCommerce.elements.actions.cart.openCart();
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
---
|
|
@@ -33,7 +33,7 @@ closeCart(): void
|
|
|
33
33
|
### Example
|
|
34
34
|
|
|
35
35
|
```javascript
|
|
36
|
-
window.elements.actions.cart.closeCart();
|
|
36
|
+
window.LiquidCommerce.elements.actions.cart.closeCart();
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
---
|
|
@@ -53,7 +53,7 @@ toggleCart(): void
|
|
|
53
53
|
```javascript
|
|
54
54
|
// Add to your cart button
|
|
55
55
|
document.getElementById('cart-btn').addEventListener('click', () => {
|
|
56
|
-
window.elements.actions.cart.toggleCart();
|
|
56
|
+
window.LiquidCommerce.elements.actions.cart.toggleCart();
|
|
57
57
|
});
|
|
58
58
|
```
|
|
59
59
|
|
|
@@ -88,7 +88,7 @@ interface IAddProductParams {
|
|
|
88
88
|
|
|
89
89
|
```javascript
|
|
90
90
|
// Add single product
|
|
91
|
-
await window.elements.actions.cart.addProduct([
|
|
91
|
+
await window.LiquidCommerce.elements.actions.cart.addProduct([
|
|
92
92
|
{
|
|
93
93
|
identifier: '00619947000020',
|
|
94
94
|
fulfillmentType: 'shipping',
|
|
@@ -97,7 +97,7 @@ await window.elements.actions.cart.addProduct([
|
|
|
97
97
|
], true); // Open cart after adding
|
|
98
98
|
|
|
99
99
|
// Add multiple products
|
|
100
|
-
await window.elements.actions.cart.addProduct([
|
|
100
|
+
await window.LiquidCommerce.elements.actions.cart.addProduct([
|
|
101
101
|
{
|
|
102
102
|
identifier: '00619947000020',
|
|
103
103
|
fulfillmentType: 'shipping',
|
|
@@ -149,7 +149,7 @@ applyPromoCode(promoCode: string): Promise<void>
|
|
|
149
149
|
|
|
150
150
|
```javascript
|
|
151
151
|
try {
|
|
152
|
-
await window.elements.actions.cart.applyPromoCode('SUMMER20');
|
|
152
|
+
await window.LiquidCommerce.elements.actions.cart.applyPromoCode('SUMMER20');
|
|
153
153
|
console.log('Promo code applied successfully');
|
|
154
154
|
} catch (error) {
|
|
155
155
|
console.error('Invalid promo code:', error);
|
|
@@ -178,7 +178,7 @@ removePromoCode(): Promise<void>
|
|
|
178
178
|
### Example
|
|
179
179
|
|
|
180
180
|
```javascript
|
|
181
|
-
await window.elements.actions.cart.removePromoCode();
|
|
181
|
+
await window.LiquidCommerce.elements.actions.cart.removePromoCode();
|
|
182
182
|
```
|
|
183
183
|
|
|
184
184
|
---
|
|
@@ -196,7 +196,7 @@ resetCart(): Promise<void>
|
|
|
196
196
|
### Example
|
|
197
197
|
|
|
198
198
|
```javascript
|
|
199
|
-
await window.elements.actions.cart.resetCart();
|
|
199
|
+
await window.LiquidCommerce.elements.actions.cart.resetCart();
|
|
200
200
|
console.log('Cart cleared');
|
|
201
201
|
```
|
|
202
202
|
|
|
@@ -238,7 +238,7 @@ interface IBaseCartEventData {
|
|
|
238
238
|
### Example
|
|
239
239
|
|
|
240
240
|
```javascript
|
|
241
|
-
const cart = window.elements.actions.cart.getDetails();
|
|
241
|
+
const cart = window.LiquidCommerce.elements.actions.cart.getDetails();
|
|
242
242
|
|
|
243
243
|
console.log(`Cart ID: ${cart.cartId}`);
|
|
244
244
|
console.log(`Items: ${cart.itemsCount}`);
|
|
@@ -256,7 +256,7 @@ if (cart.promoCode) {
|
|
|
256
256
|
|
|
257
257
|
```javascript
|
|
258
258
|
function updateCartSummary() {
|
|
259
|
-
const cart = window.elements.actions.cart.getDetails();
|
|
259
|
+
const cart = window.LiquidCommerce.elements.actions.cart.getDetails();
|
|
260
260
|
|
|
261
261
|
document.getElementById('cart-count').textContent = cart.itemsCount;
|
|
262
262
|
document.getElementById('cart-total').textContent = `$${cart.total / 100}`;
|
|
@@ -270,21 +270,21 @@ window.addEventListener('lce:actions.cart_updated', updateCartSummary);
|
|
|
270
270
|
|
|
271
271
|
```javascript
|
|
272
272
|
document.getElementById('checkout-btn').addEventListener('click', () => {
|
|
273
|
-
const cart = window.elements.actions.cart.getDetails();
|
|
273
|
+
const cart = window.LiquidCommerce.elements.actions.cart.getDetails();
|
|
274
274
|
|
|
275
275
|
if (cart.itemsCount === 0) {
|
|
276
276
|
alert('Your cart is empty');
|
|
277
277
|
return;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
window.elements.actions.checkout.openCheckout();
|
|
280
|
+
window.LiquidCommerce.elements.actions.checkout.openCheckout();
|
|
281
281
|
});
|
|
282
282
|
```
|
|
283
283
|
|
|
284
284
|
#### Track Cart Value
|
|
285
285
|
|
|
286
286
|
```javascript
|
|
287
|
-
const cart = window.elements.actions.cart.getDetails();
|
|
287
|
+
const cart = window.LiquidCommerce.elements.actions.cart.getDetails();
|
|
288
288
|
|
|
289
289
|
gtag('event', 'view_cart', {
|
|
290
290
|
value: cart.total / 100,
|