@liquidcommerce/elements-sdk 2.6.7 → 2.7.1
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 +83 -2519
- package/dist/index.checkout.esm.js +16086 -0
- package/dist/index.esm.js +16267 -13788
- package/dist/types/auto-initialize/checkout.d.ts +2 -0
- package/dist/types/auto-initialize/shared-utils.d.ts +27 -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 +5 -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/pubsub/interfaces/checkout.interface.d.ts +1 -0
- 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 +14 -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/address-input.component.d.ts +11 -0
- 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 +7 -0
- package/dist/types/modules/product-list/components/card-components/product-badge.d.ts +8 -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 +12 -0
- package/dist/types/modules/product-list/components/card-components/product-price-and-personalization.d.ts +13 -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/card-components/product-title.d.ts +6 -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 +7 -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 +10 -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-product-pre-cart.component.d.ts +28 -0
- package/dist/types/modules/product-list/components/product-list-retailers.component.d.ts +26 -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 +30 -0
- package/dist/types/modules/product-list/product-list.commands.d.ts +62 -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 +33 -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 +13 -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/gitbook/actions.md +160 -0
- package/docs/gitbook/address.md +48 -0
- package/docs/gitbook/cart.md +65 -0
- package/docs/gitbook/checkout.md +131 -0
- package/docs/gitbook/events.md +137 -0
- package/docs/gitbook/overview.md +166 -0
- package/docs/gitbook/product.md +64 -0
- package/docs/gitbook/quick-start-guide.md +393 -0
- package/docs/v1/README.md +210 -0
- package/docs/v1/api/actions/address-actions.md +281 -0
- package/docs/v1/api/actions/cart-actions.md +337 -0
- package/docs/v1/api/actions/checkout-actions.md +387 -0
- package/docs/v1/api/actions/product-actions.md +115 -0
- package/docs/v1/api/client.md +482 -0
- package/docs/v1/api/configuration.md +1 -0
- package/docs/v1/api/injection-methods.md +247 -0
- package/docs/v1/api/typescript-types.md +1 -0
- package/docs/v1/api/ui-helpers.md +200 -0
- package/docs/v1/examples/advanced-patterns.md +96 -0
- package/docs/v1/examples/checkout-flow.md +91 -0
- package/docs/v1/examples/custom-theming.md +63 -0
- package/docs/v1/examples/multi-product-page.md +90 -0
- package/docs/v1/examples/simple-product-page.md +89 -0
- package/docs/v1/getting-started/concepts.md +507 -0
- package/docs/v1/getting-started/installation.md +328 -0
- package/docs/v1/getting-started/quick-start.md +405 -0
- package/docs/v1/guides/address-component.md +431 -0
- package/docs/v1/guides/best-practices.md +324 -0
- package/docs/v1/guides/cart-component.md +737 -0
- package/docs/v1/guides/checkout-component.md +672 -0
- package/docs/v1/guides/events.md +191 -0
- package/docs/v1/guides/product-component.md +686 -0
- package/docs/v1/guides/product-list-component.md +598 -0
- package/docs/v1/guides/theming.md +216 -0
- package/docs/v1/integration/angular.md +39 -0
- package/docs/v1/integration/laravel.md +41 -0
- package/docs/v1/integration/nextjs.md +60 -0
- package/docs/v1/integration/proxy-setup.md +89 -0
- package/docs/v1/integration/react.md +64 -0
- package/docs/v1/integration/vanilla-js.md +84 -0
- package/docs/v1/integration/vue.md +34 -0
- package/docs/v1/reference/browser-support.md +35 -0
- package/docs/v1/reference/error-handling.md +70 -0
- package/docs/v1/reference/performance.md +54 -0
- package/docs/v1/reference/troubleshooting.md +64 -0
- 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/docs/ACTIONS.md +0 -1300
- package/docs/BROWSER_SUPPORT.md +0 -279
- package/docs/CONFIGURATION.md +0 -853
- package/docs/DOCUMENTATION_INDEX.md +0 -311
- package/docs/EVENTS.md +0 -798
- package/docs/PROXY.md +0 -228
- package/docs/THEMING.md +0 -592
- package/docs/TROUBLESHOOTING.md +0 -793
- 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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { IProductListProduct } from 'core/store/interfaces/product-list.interface';
|
|
2
|
+
import type { IProductListComponent } from 'interfaces/configs';
|
|
3
|
+
import { BaseComponent } from '@/core/base-component.service';
|
|
4
|
+
import type { IFulfillment } from '@/interfaces/api/product.interface';
|
|
5
|
+
export interface IProductListCardParams {
|
|
6
|
+
product: IProductListProduct;
|
|
7
|
+
shippingFulfillment: IFulfillment | null;
|
|
8
|
+
onDemandFulfillment: IFulfillment | null;
|
|
9
|
+
productUrl?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class ProductListCardComponent extends BaseComponent<IProductListCardParams, IProductListComponent> {
|
|
12
|
+
private selectedSize;
|
|
13
|
+
private unsubscribeFromState?;
|
|
14
|
+
constructor();
|
|
15
|
+
get hostClasses(): string[];
|
|
16
|
+
protected connected(): Promise<void>;
|
|
17
|
+
disconnected(): void;
|
|
18
|
+
private reRender;
|
|
19
|
+
protected template(): HTMLElement[];
|
|
20
|
+
private generateProductUrl;
|
|
21
|
+
private createVariantStandard;
|
|
22
|
+
private createImageSection;
|
|
23
|
+
private createContentSection;
|
|
24
|
+
private createPricePersonalizationSection;
|
|
25
|
+
private createSizesSection;
|
|
26
|
+
private handleDeliveryOptionsClick;
|
|
27
|
+
private createFulfillmentSectionWrapper;
|
|
28
|
+
createFulfillmentTextSection(selectedFulfillmentType: string, selectedFulfillmentRetailerName: string): HTMLElement;
|
|
29
|
+
private createAddToCartSection;
|
|
30
|
+
}
|
|
@@ -1,17 +1,76 @@
|
|
|
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';
|
|
1
4
|
import { BaseCommand } from '@/core/command/base-command.service';
|
|
2
|
-
import type
|
|
3
|
-
import type {
|
|
5
|
+
import { type FulfillmentType } from '@/enums';
|
|
6
|
+
import type { IFulfillment, IProduct, IProductSizeAttributes, IRetailer } from '@/interfaces/api/product.interface';
|
|
7
|
+
import type { IFilterSchema, INavigationResponse, IProductSearchParams, IProductSearchResponse } from '@/interfaces/api/product-list.interface';
|
|
8
|
+
import type { ProductListFilterType } from '@/interfaces/core.interface';
|
|
4
9
|
import { type AddItemParams } from '@/modules/cart/cart.commands';
|
|
10
|
+
import type { IExtendedFilterSchema, IPagination, IProductAvailabilityData, IProductListFilters } from './product-list.interface';
|
|
11
|
+
type StateListener = (state: IProductListStore) => void;
|
|
5
12
|
export declare class ProductListCommands extends BaseCommand {
|
|
6
13
|
private readonly uiCommands;
|
|
7
14
|
private readonly cartCommands;
|
|
8
15
|
private readonly checkoutCommands;
|
|
16
|
+
private readonly FILTER_TYPE_MAP;
|
|
17
|
+
private listeners;
|
|
9
18
|
constructor();
|
|
10
19
|
static getInstance(): ProductListCommands;
|
|
20
|
+
subscribe(listener: StateListener): () => void;
|
|
21
|
+
private getStoreState;
|
|
22
|
+
updateSearchTerm(searchTerm: string): void;
|
|
23
|
+
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
|
+
loadInitialProducts(page: number, perPage: number, searchTerm: string, currentFilters: IProductListFilters, configuredFilters: ProductListFilterType[]): Promise<void>;
|
|
32
|
+
loadMoreProducts(perPage: number, searchTerm: string, currentFilters: IProductListFilters, configuredFilters: ProductListFilterType[]): Promise<void>;
|
|
11
33
|
getProductList(params: IProductSearchParams): Promise<IProductSearchResponse>;
|
|
34
|
+
syncFiltersFromComponent(filters: IProductListFilters): void;
|
|
35
|
+
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
|
+
setGridConfig(rows: number, columns: number): void;
|
|
46
|
+
getItemsPerPage(): number;
|
|
47
|
+
updatePagination(navigation: INavigationResponse | undefined): IPagination;
|
|
48
|
+
createInitialPagination(): IPagination;
|
|
49
|
+
mergeRetailers(existingRetailers: Record<string, IRetailer>, newRetailers: Record<string, IRetailer>): Record<string, IRetailer>;
|
|
50
|
+
extractProductCardData(product: IProductListProduct, retailers: Record<string, IRetailer>): {
|
|
51
|
+
product: IProductListProduct;
|
|
52
|
+
retailer: IRetailer;
|
|
53
|
+
} | null;
|
|
54
|
+
private getFilterKeyToTypeMap;
|
|
12
55
|
addToCart(params: AddItemParams): Promise<void>;
|
|
13
56
|
addPresaleToCart(params: AddItemParams): Promise<void>;
|
|
14
57
|
trackViewItemList(products: IProduct[]): void;
|
|
15
|
-
trackSelectItem(product:
|
|
58
|
+
trackSelectItem(product: IProductListProduct): void;
|
|
16
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;
|
|
66
|
+
updateQuantity: (productId: string, quantity: number) => void;
|
|
67
|
+
getAvailabilityData(params: {
|
|
68
|
+
product: IProductListProduct;
|
|
69
|
+
size?: IProductSizeStore;
|
|
70
|
+
shippingFulfillment?: IFulfillment | null;
|
|
71
|
+
onDemandFulfillment?: IFulfillment | null;
|
|
72
|
+
state?: string;
|
|
73
|
+
}): IProductAvailabilityData;
|
|
74
|
+
isPresaleActive(sizeAttributes: IProductSizeAttributes): boolean;
|
|
17
75
|
}
|
|
76
|
+
export {};
|
|
@@ -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,26 @@ 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
|
+
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
|
+
}
|
|
@@ -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,23 @@
|
|
|
1
|
+
import type { IProductListProduct } from 'core/store/interfaces/product-list.interface';
|
|
2
|
+
import type { IFulfillment } from 'interfaces/api/product.interface';
|
|
1
3
|
import { BaseComponent } from '@/core/base-component.service';
|
|
4
|
+
import { type DisplayModeType, type NavigationSourceType } from '@/enums';
|
|
5
|
+
import type { IProductListComponent } from '@/interfaces/configs';
|
|
2
6
|
export interface IEngravingFormComponentParams {
|
|
3
7
|
identifier: string;
|
|
4
|
-
context: 'product' | 'cart';
|
|
8
|
+
context: 'product' | 'cart' | 'product-list';
|
|
5
9
|
lines: string[];
|
|
6
10
|
maxLines: number;
|
|
7
11
|
maxCharsPerLine: number;
|
|
8
12
|
fee: number;
|
|
9
13
|
location?: string;
|
|
14
|
+
displayMode?: DisplayModeType;
|
|
15
|
+
navigationSource?: NavigationSourceType;
|
|
16
|
+
product?: IProductListProduct;
|
|
17
|
+
shippingFulfillment?: IFulfillment | null;
|
|
18
|
+
onDemandFulfillment?: IFulfillment | null;
|
|
19
|
+
showCollections?: boolean;
|
|
20
|
+
config?: IProductListComponent;
|
|
10
21
|
}
|
|
11
22
|
export declare class EngravingFormComponent extends BaseComponent<IEngravingFormComponentParams, null> {
|
|
12
23
|
get hostClasses(): string[];
|
|
@@ -20,6 +31,7 @@ export declare class EngravingFormComponent extends BaseComponent<IEngravingForm
|
|
|
20
31
|
private calculateTotalPrice;
|
|
21
32
|
private productInformationSection;
|
|
22
33
|
private addToCartButtonText;
|
|
34
|
+
private getFulfillmentData;
|
|
23
35
|
private retailersSection;
|
|
24
36
|
private engravingLinesSection;
|
|
25
37
|
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
|
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Actions
|
|
2
|
+
|
|
3
|
+
Actions let you control Elements programmatically after the SDK initializes. All actions live under `window.elements.actions.*`.
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
```js
|
|
7
|
+
window.addEventListener('lce:actions.client_ready', () => {
|
|
8
|
+
window.elements.actions.cart.openCart();
|
|
9
|
+
});
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Product actions
|
|
13
|
+
- `actions.product.getDetails(identifier)`
|
|
14
|
+
Returns the current loaded product data (price, size, fulfillment, retailer, quantity, images, etc.). The product must already be injected and loaded.
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
const product = window.elements.actions.product.getDetails('00619947000020');
|
|
18
|
+
console.log(product.name, product.price);
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Cart actions
|
|
22
|
+
- `actions.cart.openCart()`
|
|
23
|
+
Opens the cart drawer.
|
|
24
|
+
- `actions.cart.closeCart()`
|
|
25
|
+
Closes the cart drawer.
|
|
26
|
+
- `actions.cart.toggleCart()`
|
|
27
|
+
Toggles the cart drawer open/closed.
|
|
28
|
+
- `actions.cart.addProduct(params[], openCart?)`
|
|
29
|
+
Adds one or more products to the cart. If no address is set, the SDK prompts for one and retries automatically.
|
|
30
|
+
- `actions.cart.applyPromoCode(promoCode)`
|
|
31
|
+
Applies a promo code (replaces any existing code).
|
|
32
|
+
- `actions.cart.removePromoCode()`
|
|
33
|
+
Removes the active promo code.
|
|
34
|
+
- `actions.cart.resetCart()`
|
|
35
|
+
Clears all cart items (no undo).
|
|
36
|
+
- `actions.cart.getDetails()`
|
|
37
|
+
Returns current cart data (items, totals, promo, retailers, etc.).
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
await window.elements.actions.cart.addProduct([
|
|
41
|
+
{ identifier: '00619947000020', fulfillmentType: 'shipping', quantity: 1 }
|
|
42
|
+
], true);
|
|
43
|
+
|
|
44
|
+
await window.elements.actions.cart.applyPromoCode('SUMMER20');
|
|
45
|
+
await window.elements.actions.cart.removePromoCode();
|
|
46
|
+
await window.elements.actions.cart.resetCart();
|
|
47
|
+
|
|
48
|
+
const cart = window.elements.actions.cart.getDetails();
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Checkout actions
|
|
52
|
+
- `actions.checkout.openCheckout()`
|
|
53
|
+
Opens the checkout drawer.
|
|
54
|
+
- `actions.checkout.closeCheckout()`
|
|
55
|
+
Closes the checkout drawer.
|
|
56
|
+
- `actions.checkout.toggleCheckout()`
|
|
57
|
+
Toggles the checkout drawer open/closed.
|
|
58
|
+
- `actions.checkout.exitCheckout()`
|
|
59
|
+
Navigates away from checkout (requires `exitUrl` config).
|
|
60
|
+
- `actions.checkout.addProduct(params[], openCheckout?)`
|
|
61
|
+
Adds products directly to checkout (bypasses cart).
|
|
62
|
+
- `actions.checkout.applyPromoCode(promoCode)`
|
|
63
|
+
Applies a promo code in checkout.
|
|
64
|
+
- `actions.checkout.removePromoCode()`
|
|
65
|
+
Removes the active promo code.
|
|
66
|
+
- `actions.checkout.applyGiftCard(code)`
|
|
67
|
+
Applies a gift card.
|
|
68
|
+
- `actions.checkout.removeGiftCard(code)`
|
|
69
|
+
Removes a gift card.
|
|
70
|
+
- `actions.checkout.toggleIsGift(active?)`
|
|
71
|
+
Enables/disables gift mode (or toggles when omitted).
|
|
72
|
+
- `actions.checkout.toggleBillingSameAsShipping(active?)`
|
|
73
|
+
Sets billing address to match shipping.
|
|
74
|
+
- `actions.checkout.toggleMarketingPreferences(field, active)`
|
|
75
|
+
Sets marketing opt-in (`canEmail` or `canSms`).
|
|
76
|
+
- `actions.checkout.updateCustomerInfo(fields)`
|
|
77
|
+
Prefills customer info (name, email, phone, birthdate, etc.).
|
|
78
|
+
- `actions.checkout.updateBillingInfo(fields)`
|
|
79
|
+
Prefills billing address fields.
|
|
80
|
+
- `actions.checkout.updateGiftInfo(fields)`
|
|
81
|
+
Prefills gift recipient information.
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
window.elements.actions.checkout.openCheckout();
|
|
85
|
+
window.elements.actions.checkout.closeCheckout();
|
|
86
|
+
window.elements.actions.checkout.toggleCheckout();
|
|
87
|
+
|
|
88
|
+
await window.elements.actions.checkout.addProduct([
|
|
89
|
+
{ identifier: '00619947000020', fulfillmentType: 'shipping', quantity: 1 }
|
|
90
|
+
], true);
|
|
91
|
+
|
|
92
|
+
await window.elements.actions.checkout.applyPromoCode('WELCOME10');
|
|
93
|
+
await window.elements.actions.checkout.applyGiftCard('GIFT-1234-5678');
|
|
94
|
+
|
|
95
|
+
await window.elements.actions.checkout.toggleIsGift(true);
|
|
96
|
+
await window.elements.actions.checkout.toggleBillingSameAsShipping(false);
|
|
97
|
+
await window.elements.actions.checkout.toggleMarketingPreferences('canEmail', true);
|
|
98
|
+
|
|
99
|
+
window.elements.actions.checkout.updateCustomerInfo({
|
|
100
|
+
firstName: 'John',
|
|
101
|
+
lastName: 'Doe',
|
|
102
|
+
email: 'john@example.com'
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
window.elements.actions.checkout.updateBillingInfo({
|
|
106
|
+
firstName: 'John',
|
|
107
|
+
lastName: 'Doe',
|
|
108
|
+
addressOne: '789 Elm St',
|
|
109
|
+
city: 'Chicago',
|
|
110
|
+
state: 'IL',
|
|
111
|
+
zipCode: '60601'
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
window.elements.actions.checkout.updateGiftInfo({
|
|
115
|
+
firstName: 'Jane',
|
|
116
|
+
lastName: 'Smith',
|
|
117
|
+
message: 'Happy Birthday!'
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Address actions
|
|
122
|
+
- `actions.address.setAddressByPlacesId(placesId)`
|
|
123
|
+
Sets address using a Google Places ID (recommended).
|
|
124
|
+
- `actions.address.setAddressManually(address, coordinates)`
|
|
125
|
+
Sets address with your own address + lat/long data.
|
|
126
|
+
- `actions.address.getDetails()`
|
|
127
|
+
Returns the current address (or null if not set).
|
|
128
|
+
- `actions.address.clear()`
|
|
129
|
+
Removes the stored address and resets availability.
|
|
130
|
+
|
|
131
|
+
```js
|
|
132
|
+
await window.elements.actions.address.setAddressByPlacesId('ChIJOwg_06VPwokRYv534QaPC8g');
|
|
133
|
+
|
|
134
|
+
await window.elements.actions.address.setAddressManually(
|
|
135
|
+
{ one: '123 Main Street', city: 'New York', state: 'NY', zip: '10001' },
|
|
136
|
+
{ latitude: 40.7128, longitude: -74.0060 }
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
const address = window.elements.actions.address.getDetails();
|
|
140
|
+
await window.elements.actions.address.clear();
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## UI helpers (non-actions)
|
|
144
|
+
These helpers live under `window.elements.ui.*` and are commonly used with actions.
|
|
145
|
+
|
|
146
|
+
- `ui.cartButton(containerId, showItemsCount?)`
|
|
147
|
+
Renders a cart button inside the given container.
|
|
148
|
+
- `ui.floatingCartButton(showItemsCount?)`
|
|
149
|
+
Renders a floating cart button (bottom-right).
|
|
150
|
+
- `ui.cartSubtotal(elementId)`
|
|
151
|
+
Keeps an element updated with cart subtotal.
|
|
152
|
+
- `ui.cartItemsCount(elementId, { hideZero })`
|
|
153
|
+
Keeps an element updated with cart item count.
|
|
154
|
+
|
|
155
|
+
```js
|
|
156
|
+
window.elements.ui.cartButton('header-cart', true);
|
|
157
|
+
window.elements.ui.floatingCartButton(true);
|
|
158
|
+
window.elements.ui.cartSubtotal('cart-total');
|
|
159
|
+
window.elements.ui.cartItemsCount('items-count', { hideZero: true });
|
|
160
|
+
```
|