@liquidcommerce/elements-sdk 2.6.0-beta.29 → 2.6.0-beta.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +13685 -12680
- package/dist/types/constants/core.constant.d.ts +1 -0
- package/dist/types/core/api/api-client.service.d.ts +0 -2
- package/dist/types/core/store/interfaces/core.interface.d.ts +12 -1
- package/dist/types/core/store/interfaces/product-list.interface.d.ts +47 -0
- package/dist/types/core/store/interfaces/product.interface.d.ts +1 -0
- package/dist/types/core/store/store.constant.d.ts +2 -0
- package/dist/types/elements-base-client.d.ts +2 -0
- package/dist/types/enums/core.enum.d.ts +2 -0
- package/dist/types/interfaces/api/product-list.interface.d.ts +5 -4
- 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 +25 -0
- package/dist/types/interfaces/core.interface.d.ts +2 -5
- 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 +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/index.d.ts +2 -1
- package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +32 -40
- package/dist/types/modules/product-list/components/product-list-retailers.d.ts +17 -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 +23 -28
- package/dist/types/modules/product-list/product-list.component.d.ts +6 -8
- package/dist/types/modules/product-list/product-list.interface.d.ts +24 -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/styles/ui/index.d.ts +1 -0
- package/dist/types/modules/theme-provider/styles/ui/modal.style.d.ts +1 -0
- package/dist/types/modules/theme-provider/theme-provider.service.d.ts +2 -1
- package/dist/types/modules/ui-components/modal/modal.component.d.ts +21 -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/package.json +1 -1
- package/umd/elements.js +1 -1
- package/dist/types/modules/product-list/components/product-list-card.component.d.ts +0 -37
|
@@ -5,14 +5,12 @@ import type { ICart, ICartUpdateParams } from '@/interfaces/api/cart.interface';
|
|
|
5
5
|
import type { ICheckoutComplete, ICheckoutItemsUpdateParams, ICheckoutItemsUpdateResponse, ICheckoutPaymentConfirm, ICheckoutPaymentConfirmParams, ICheckoutPaymentSession, ICheckoutPrepare, ICheckoutPrepareParams } from '@/interfaces/api/checkout.interface';
|
|
6
6
|
import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
|
|
7
7
|
import type { IProductSearchParams, IProductSearchResponse } from '@/interfaces/api/product-list.interface';
|
|
8
|
-
import type { IAllConfigs } from '@/interfaces/configs';
|
|
9
8
|
export declare class ApiClientService {
|
|
10
9
|
private client;
|
|
11
10
|
private readonly logger;
|
|
12
11
|
constructor();
|
|
13
12
|
static getInstance(): ApiClientService;
|
|
14
13
|
setClient(client: AuthClientService): Promise<void>;
|
|
15
|
-
getAllConfigs(): Promise<IAllConfigs>;
|
|
16
14
|
setPersistedStore(userDeviceId: string, data: IPersistedStore): Promise<void>;
|
|
17
15
|
getPersistedStore(userDeviceId: string): Promise<IPersistedStore | null>;
|
|
18
16
|
deletePersistedStore(userDeviceId: string): Promise<void>;
|
|
@@ -2,6 +2,7 @@ import type { IAddressStore } from '@/core/store/interfaces/address.interface';
|
|
|
2
2
|
import type { ICartFulfillmentStore, ICartItemStore, ICartRetailerStore, ICartStore } from '@/core/store/interfaces/cart.interface';
|
|
3
3
|
import type { ICheckoutCustomerFormStore, ICheckoutGiftRecipientFormStore, ICheckoutItemStore, ICheckoutPaymentFormStore, ICheckoutPaymentMethodStore, ICheckoutPaymentSessionStore, ICheckoutStore } from '@/core/store/interfaces/checkout.interface';
|
|
4
4
|
import type { IProductSizeStore, IProductStore } from '@/core/store/interfaces/product.interface';
|
|
5
|
+
import type { IProductListStore } from '@/core/store/interfaces/product-list.interface';
|
|
5
6
|
import type { ComponentType } from '@/enums';
|
|
6
7
|
import type { ICartPromoCode } from '@/interfaces/api/cart.interface';
|
|
7
8
|
import type { ICheckoutGiftRecipient, ICheckoutMarketingPreferences, ICheckoutPresale, ICheckoutPromoCode, ICheckoutRetailer } from '@/interfaces/api/checkout.interface';
|
|
@@ -9,25 +10,35 @@ export interface IDrawerContentConfig {
|
|
|
9
10
|
type: ComponentType;
|
|
10
11
|
data?: Record<string, any>;
|
|
11
12
|
}
|
|
13
|
+
export interface IModalContentConfig {
|
|
14
|
+
type: ComponentType;
|
|
15
|
+
data?: Record<string, any>;
|
|
16
|
+
}
|
|
12
17
|
export interface IDrawerStore {
|
|
13
18
|
isOpen: boolean;
|
|
14
19
|
contentConfig: IDrawerContentConfig | null;
|
|
15
20
|
}
|
|
16
21
|
export interface IUIStore {
|
|
17
22
|
drawer: IDrawerStore;
|
|
23
|
+
modal: IModalStore;
|
|
24
|
+
}
|
|
25
|
+
export interface IModalStore {
|
|
26
|
+
isOpen: boolean;
|
|
27
|
+
contentConfig: IModalContentConfig | null;
|
|
18
28
|
}
|
|
19
29
|
export interface IGlobalStore {
|
|
20
30
|
address: IAddressStore;
|
|
21
31
|
products: Record<string, IProductStore>;
|
|
22
32
|
cart: ICartStore;
|
|
23
33
|
checkout: ICheckoutStore;
|
|
34
|
+
productsList: IProductListStore;
|
|
24
35
|
ui: IUIStore;
|
|
25
36
|
}
|
|
26
37
|
export interface IPersistedStore {
|
|
27
38
|
p?: string;
|
|
28
39
|
c?: string;
|
|
29
40
|
}
|
|
30
|
-
export type StorePaths = keyof IGlobalStore | `products.${string}` | `products.${string}.${keyof IProductStore}` | `products.${string}.sizes.${string}` | `products.${string}.sizes.${string}.${keyof IProductSizeStore}` | `address.${keyof IAddressStore}` | `cart.${keyof ICartStore}` | `cart.items.${string}` | `cart.items.${string}.${keyof ICartItemStore}` | `cart.retailers.${string}` | `cart.items.${string}.${keyof ICartRetailerStore}` | `cart.fulfillments.${string}` | `cart.fulfillments.${string}.${keyof ICartFulfillmentStore}` | `cart.promoCode.${keyof ICartPromoCode}` | `ui.${keyof IUIStore}` | `ui.drawer.${keyof IDrawerStore}` | `checkout.${keyof ICheckoutStore}` | `checkout.customerForm.${keyof ICheckoutCustomerFormStore}` | `checkout.giftRecipientForm.${keyof ICheckoutGiftRecipientFormStore}` | `checkout.paymentForm.${keyof ICheckoutPaymentFormStore}` | `checkout.paymentForm.paymentSession.${keyof ICheckoutPaymentSessionStore}` | `checkout.paymentForm.paymentMethod.${keyof ICheckoutPaymentMethodStore}` | `checkout.presale.${keyof ICheckoutPresale}` | `checkout.marketingPreferences.${keyof ICheckoutMarketingPreferences}` | `checkout.giftRecipient.${keyof ICheckoutGiftRecipient}` | `checkout.giftCards.${string}` | `checkout.promoCode.${keyof ICheckoutPromoCode}` | `checkout.items.${string}` | `checkout.items.${string}.${keyof ICheckoutItemStore}` | `checkout.retailers.${string}` | `checkout.retailers.${string}.${keyof ICheckoutRetailer}` | `checkout.fulfillments.${string}`;
|
|
41
|
+
export type StorePaths = keyof IGlobalStore | `products.${string}` | `products.${string}.${keyof IProductStore}` | `products.${string}.sizes.${string}` | `products.${string}.sizes.${string}.${keyof IProductSizeStore}` | `address.${keyof IAddressStore}` | `cart.${keyof ICartStore}` | `cart.items.${string}` | `cart.items.${string}.${keyof ICartItemStore}` | `cart.retailers.${string}` | `cart.items.${string}.${keyof ICartRetailerStore}` | `cart.fulfillments.${string}` | `cart.fulfillments.${string}.${keyof ICartFulfillmentStore}` | `cart.promoCode.${keyof ICartPromoCode}` | `ui.${keyof IUIStore}` | `ui.drawer.${keyof IDrawerStore}` | `ui.modal.${keyof IModalStore}` | `checkout.${keyof ICheckoutStore}` | `checkout.customerForm.${keyof ICheckoutCustomerFormStore}` | `checkout.giftRecipientForm.${keyof ICheckoutGiftRecipientFormStore}` | `checkout.paymentForm.${keyof ICheckoutPaymentFormStore}` | `checkout.paymentForm.paymentSession.${keyof ICheckoutPaymentSessionStore}` | `checkout.paymentForm.paymentMethod.${keyof ICheckoutPaymentMethodStore}` | `checkout.presale.${keyof ICheckoutPresale}` | `checkout.marketingPreferences.${keyof ICheckoutMarketingPreferences}` | `checkout.giftRecipient.${keyof ICheckoutGiftRecipient}` | `checkout.giftCards.${string}` | `checkout.promoCode.${keyof ICheckoutPromoCode}` | `checkout.items.${string}` | `checkout.items.${string}.${keyof ICheckoutItemStore}` | `checkout.retailers.${string}` | `checkout.retailers.${string}.${keyof ICheckoutRetailer}` | `checkout.fulfillments.${string}` | `productsList.${string}`;
|
|
31
42
|
interface MiddlewareContext {
|
|
32
43
|
action: string;
|
|
33
44
|
payload: any;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { IPagination } from 'modules/product-list/product-list.interface';
|
|
2
|
+
import type { FulfillmentType } from '@/enums';
|
|
3
|
+
import type { IFulfillment, IProduct, IProductVariant, IRetailer, IRetailerAddress } from '@/interfaces/api/product.interface';
|
|
4
|
+
import type { IFilterSchema } from '@/interfaces/api/product-list.interface';
|
|
5
|
+
import type { IModalStore } from './core.interface';
|
|
6
|
+
import type { IProductSizeStore } from './product.interface';
|
|
7
|
+
export type IProductFulfillmentStore = IFulfillment & {
|
|
8
|
+
retailerName: string;
|
|
9
|
+
retailerAddress: IRetailerAddress;
|
|
10
|
+
retailerAddressFormatted: string;
|
|
11
|
+
variant: IProductVariant;
|
|
12
|
+
image: string | null;
|
|
13
|
+
};
|
|
14
|
+
export interface IProductList extends IProduct {
|
|
15
|
+
quantity: number;
|
|
16
|
+
selectedSizeId: string | null;
|
|
17
|
+
selectedFulfillmentType: FulfillmentType;
|
|
18
|
+
selectedFulfillmentId: string | null;
|
|
19
|
+
selectedFulfillment: IProductFulfillmentStore | null;
|
|
20
|
+
productHasAvailability: boolean;
|
|
21
|
+
fulfillmentHasAvailability: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface IProductListProduct extends Omit<IProduct, 'sizes'> {
|
|
24
|
+
sizes: Record<string, IProductSizeStore>;
|
|
25
|
+
}
|
|
26
|
+
export interface IProductListStore {
|
|
27
|
+
products: IProductListProduct[];
|
|
28
|
+
retailers: Record<string, IRetailer>;
|
|
29
|
+
filters: IFilterSchema[];
|
|
30
|
+
pagination: IPagination;
|
|
31
|
+
appliedFilters: Record<string, string[]>;
|
|
32
|
+
searchTerm: string;
|
|
33
|
+
gridConfig?: {
|
|
34
|
+
rows: number;
|
|
35
|
+
columns: number;
|
|
36
|
+
};
|
|
37
|
+
userProducts: {
|
|
38
|
+
[productId: string]: {
|
|
39
|
+
selectedSizeId: string;
|
|
40
|
+
selectedFulfillmentType: FulfillmentType;
|
|
41
|
+
selectedFulfillment: IProductFulfillmentStore | null;
|
|
42
|
+
selectedQuantity: number;
|
|
43
|
+
modal: IModalStore;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
loading: boolean;
|
|
47
|
+
}
|
|
@@ -13,6 +13,7 @@ export type IProductFulfillmentStore = IFulfillment & {
|
|
|
13
13
|
retailerAddress: IRetailerAddress;
|
|
14
14
|
retailerAddressFormatted: string;
|
|
15
15
|
variant: IProductVariant;
|
|
16
|
+
image?: string;
|
|
16
17
|
};
|
|
17
18
|
export interface IProductSizeStore extends Omit<IProductSize, 'shippingVariants' | 'onDemandVariants'> {
|
|
18
19
|
onDemandFulfillments: Record<string, IProductFulfillmentStore>;
|
|
@@ -3,10 +3,12 @@ import type { ICartStore } from '@/core/store/interfaces/cart.interface';
|
|
|
3
3
|
import type { ICheckoutStore } from '@/core/store/interfaces/checkout.interface';
|
|
4
4
|
import type { IGlobalStore, IUIStore } from '@/core/store/interfaces/core.interface';
|
|
5
5
|
import type { IProductStore } from '@/core/store/interfaces/product.interface';
|
|
6
|
+
import type { IProductListStore } from './interfaces/product-list.interface';
|
|
6
7
|
export declare const LOCAL_STORAGE_PREFIX = "lce";
|
|
7
8
|
export declare const initialAddressState: IAddressStore;
|
|
8
9
|
export declare const initialProductState: IProductStore;
|
|
9
10
|
export declare const initialCartState: ICartStore;
|
|
10
11
|
export declare const initialCheckoutState: ICheckoutStore;
|
|
11
12
|
export declare const initialUIState: IUIStore;
|
|
13
|
+
export declare const initialProductsListState: IProductListStore;
|
|
12
14
|
export declare const initialStoreState: IGlobalStore;
|
|
@@ -28,6 +28,7 @@ export declare abstract class ElementsBaseClient {
|
|
|
28
28
|
protected clientPrepared: boolean;
|
|
29
29
|
protected componentFactoryInitialized: boolean;
|
|
30
30
|
protected cartDrawerCreated: boolean;
|
|
31
|
+
protected modalCreated: boolean;
|
|
31
32
|
protected injectedComponents: Map<string, IInjectedComponent>;
|
|
32
33
|
constructor(clientConfigs: IClientConfigs);
|
|
33
34
|
prepare(): Promise<void>;
|
|
@@ -41,6 +42,7 @@ export declare abstract class ElementsBaseClient {
|
|
|
41
42
|
injectProductListSearch(params: IInjectProductListSearchParams): Promise<void>;
|
|
42
43
|
injectProductListFilters(params: IInjectProductListFiltersParams): Promise<void>;
|
|
43
44
|
protected ensureCartDrawerExists(): void;
|
|
45
|
+
protected ensureModalExists(): void;
|
|
44
46
|
protected ensureAllComponentsRegistered(): void;
|
|
45
47
|
protected createInjectedComponentWrapper(containerId: string, type: ComponentType, element: HTMLElement): IInjectedComponent;
|
|
46
48
|
protected rerenderInjectedComponentsByType(type: ComponentType): void;
|
|
@@ -76,6 +76,7 @@ export declare const COMPONENT_TYPE: {
|
|
|
76
76
|
readonly PURCHASE_MIN_ALERT: "purchase-min-alert";
|
|
77
77
|
readonly ALERT: "alert";
|
|
78
78
|
readonly PROMO_CODE_TICKER: "promo-code-ticker";
|
|
79
|
+
readonly MODAL: "modal";
|
|
79
80
|
readonly ADDRESS: "address";
|
|
80
81
|
readonly ADDRESS_INPUT: "address-input";
|
|
81
82
|
readonly ADDRESS_DISPLAY: "address-display";
|
|
@@ -97,6 +98,7 @@ export declare const COMPONENT_TYPE: {
|
|
|
97
98
|
readonly PRODUCT_LIST_FILTERS: "product-list-filters";
|
|
98
99
|
readonly PRODUCT_LIST_SEARCH: "product-list-search";
|
|
99
100
|
readonly PRODUCT_LIST_CARD_LOADING: "product-list-card-loading";
|
|
101
|
+
readonly PRODUCT_LIST_RETAILERS: "product-list-retailers";
|
|
100
102
|
readonly CART: "cart";
|
|
101
103
|
readonly CART_RETAILER: "cart-retailer";
|
|
102
104
|
readonly CART_ITEM: "cart-item";
|
|
@@ -9,12 +9,13 @@ export interface IProductSearchParams {
|
|
|
9
9
|
perPage?: number;
|
|
10
10
|
filters?: IFilterParams[];
|
|
11
11
|
}
|
|
12
|
+
export type IFilterParamsValue = string | string[] | {
|
|
13
|
+
min?: string | number;
|
|
14
|
+
max?: string | number;
|
|
15
|
+
} | boolean;
|
|
12
16
|
export interface IFilterParams {
|
|
13
17
|
key: string;
|
|
14
|
-
values:
|
|
15
|
-
min?: string | number;
|
|
16
|
-
max?: string | number;
|
|
17
|
-
} | boolean;
|
|
18
|
+
values: IFilterParamsValue;
|
|
18
19
|
}
|
|
19
20
|
export type FacetFilterKeys = typeof FILTER_KEYS.BRANDS | typeof FILTER_KEYS.CATEGORIES | typeof FILTER_KEYS.FLAVOR | typeof FILTER_KEYS.REGION | typeof FILTER_KEYS.VARIETY | typeof FILTER_KEYS.VINTAGE | typeof FILTER_KEYS.COUNTRY | typeof FILTER_KEYS.APPELLATION | typeof FILTER_KEYS.TAGS | typeof FILTER_KEYS.MATERIALS | typeof FILTER_KEYS.SIZES | typeof FILTER_KEYS.ENGRAVING | typeof FILTER_KEYS.PRESALE | typeof FILTER_KEYS.FULFILLMENT | typeof FILTER_KEYS.PRICE | typeof FILTER_KEYS.AVAILABILITY | typeof FILTER_KEYS.COLORS;
|
|
20
21
|
export interface IFilterSchema {
|
|
@@ -4,6 +4,7 @@ import type { IAddressComponent } from './address.interface';
|
|
|
4
4
|
import type { ICartComponent } from './cart.interface';
|
|
5
5
|
import type { ICheckoutComponent } from './checkout.interface';
|
|
6
6
|
import type { IProductComponent } from './product.interface';
|
|
7
|
+
import type { IProductListComponent } from './product-list.interface';
|
|
7
8
|
export interface IFontFamily {
|
|
8
9
|
name: string;
|
|
9
10
|
weights: number[];
|
|
@@ -55,6 +56,7 @@ export interface IAllConfigs {
|
|
|
55
56
|
address: IAddressComponent;
|
|
56
57
|
cart: ICartComponent;
|
|
57
58
|
checkout: ICheckoutComponent;
|
|
59
|
+
productList: IProductListComponent;
|
|
58
60
|
}
|
|
59
|
-
export type ConfigsKeyType = 'all' | 'configurations' | 'global' | 'product' | 'address' | 'cart' | 'checkout';
|
|
60
|
-
export type ConfigsType = IAllConfigs | IElementsConfigurations | IComponentGlobalConfigs | IProductComponent | IAddressComponent | ICartComponent | ICheckoutComponent;
|
|
61
|
+
export type ConfigsKeyType = 'all' | 'configurations' | 'global' | 'product' | 'address' | 'cart' | 'checkout' | 'productList';
|
|
62
|
+
export type ConfigsType = IAllConfigs | IElementsConfigurations | IComponentGlobalConfigs | IProductComponent | IAddressComponent | ICartComponent | ICheckoutComponent | IProductListComponent;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DeepPartial } from '@/interfaces/core.interface';
|
|
2
|
+
export type ProductListCardStyle = 'card' | 'ghost';
|
|
3
|
+
export type ProductListCardCornerRadius = 'rounded' | 'sharp';
|
|
4
|
+
export interface IProductListTheme {
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
}
|
|
7
|
+
export interface IProductListLayout {
|
|
8
|
+
productCard: {
|
|
9
|
+
style: ProductListCardStyle;
|
|
10
|
+
cornerRadius: ProductListCardCornerRadius;
|
|
11
|
+
showPrice: boolean;
|
|
12
|
+
showSizeSelector: boolean;
|
|
13
|
+
showFulfillment: boolean;
|
|
14
|
+
showQuantityCounter: boolean;
|
|
15
|
+
enableShippingFulfillment: boolean;
|
|
16
|
+
enableOnDemandFulfillment: boolean;
|
|
17
|
+
showCollections: boolean;
|
|
18
|
+
enablePersonalization: boolean;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface IProductListComponent {
|
|
22
|
+
theme: IProductListTheme;
|
|
23
|
+
layout: IProductListLayout;
|
|
24
|
+
}
|
|
25
|
+
export type UpdateProductListComponent = DeepPartial<IProductListComponent>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PRODUCT_LIST_FILTER_TYPES } from '@/constants';
|
|
2
2
|
import type { IAddressActions, ICartActions, ICheckoutActions, IProductActions } from '@/core/client/client-action.service';
|
|
3
3
|
import type { IClientConfigs } from '@/core/client/client-config.service';
|
|
4
4
|
import type { ComponentType, DebugMode, ElementsEnv } from '@/enums';
|
|
@@ -40,14 +40,11 @@ export interface IInjectProductElement {
|
|
|
40
40
|
containerId: string;
|
|
41
41
|
identifier: string;
|
|
42
42
|
}
|
|
43
|
-
export type ProductListCardVariantType = (typeof PRODUCT_LIST_CARD_VARIANT)[keyof typeof PRODUCT_LIST_CARD_VARIANT];
|
|
44
43
|
export type ProductListFilterType = (typeof PRODUCT_LIST_FILTER_TYPES)[keyof typeof PRODUCT_LIST_FILTER_TYPES];
|
|
45
44
|
export interface IInjectProductListParams {
|
|
46
45
|
containerId: string;
|
|
47
46
|
rows?: number;
|
|
48
47
|
columns?: number;
|
|
49
|
-
cardVariant?: ProductListCardVariantType;
|
|
50
|
-
fillCard?: boolean;
|
|
51
48
|
filters?: ProductListFilterType[];
|
|
52
49
|
productUrl?: string;
|
|
53
50
|
}
|
|
@@ -56,7 +53,7 @@ export interface IInjectProductListSearchParams {
|
|
|
56
53
|
}
|
|
57
54
|
export interface IInjectProductListFiltersParams {
|
|
58
55
|
containerId: string;
|
|
59
|
-
filters
|
|
56
|
+
filters: ProductListFilterType[];
|
|
60
57
|
}
|
|
61
58
|
export interface IBuilderInjectElementParams {
|
|
62
59
|
type: ComponentType;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ProductListCardCornerRadius } from 'interfaces/configs';
|
|
2
|
+
export interface IAddToCartButtonParams {
|
|
3
|
+
isPresale: boolean;
|
|
4
|
+
hasAvailability: boolean;
|
|
5
|
+
state: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
borderRadius: ProductListCardCornerRadius;
|
|
8
|
+
hasAddress: boolean;
|
|
9
|
+
onClick?: (e: MouseEvent) => void | Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare const createAddToCartButton: ({ isPresale, hasAvailability, state, disabled, borderRadius, hasAddress, onClick, }: IAddToCartButtonParams) => HTMLElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IProductFulfillmentStore } from 'core/store/interfaces/product.interface';
|
|
2
|
+
import { type FulfillmentType } from '@/enums';
|
|
3
|
+
export interface IFulfillmentSectionParams {
|
|
4
|
+
shippingVariants: Record<string, IProductFulfillmentStore>;
|
|
5
|
+
onDemandVariants: Record<string, IProductFulfillmentStore>;
|
|
6
|
+
enableShippingFulfillment: boolean;
|
|
7
|
+
enableOnDemandFulfillment: boolean;
|
|
8
|
+
selectedFulfillmentType: FulfillmentType;
|
|
9
|
+
selectedFulfillmentRetailerName: string;
|
|
10
|
+
productId: string;
|
|
11
|
+
onDeliveryOptionsClick: (productId: string) => void | Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare const createFulfillmentSection: (params: IFulfillmentSectionParams) => HTMLElement;
|
package/dist/types/modules/product-list/components/card-components/product-quantity-selector.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ProductListCardCornerRadius, ProductListCardStyle } from 'interfaces/configs';
|
|
2
|
+
export interface IQuantitySelectorParams {
|
|
3
|
+
initialQuantity: number;
|
|
4
|
+
minQuantity: number;
|
|
5
|
+
maxQuantity: number;
|
|
6
|
+
cornerRadius: ProductListCardCornerRadius;
|
|
7
|
+
cardStyle: ProductListCardStyle;
|
|
8
|
+
onChange: (quantity: number) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const createQuantitySelector: ({ initialQuantity, minQuantity, maxQuantity, cornerRadius, cardStyle, onChange, }: IQuantitySelectorParams) => HTMLElement;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IProductSizeStore } from 'core/store/interfaces/product.interface';
|
|
2
|
+
import type { ProductListCardCornerRadius } from 'interfaces/configs';
|
|
3
|
+
export interface ISizeSelectorParams {
|
|
4
|
+
sizes: Record<string, IProductSizeStore>;
|
|
5
|
+
selectedSize: IProductSizeStore;
|
|
6
|
+
cornerRadius: ProductListCardCornerRadius;
|
|
7
|
+
onSelect?: (size: IProductSizeStore) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const createProductSizesList: ({ sizes, selectedSize, cornerRadius, onSelect }: ISizeSelectorParams) => HTMLElement;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export * from '../product-list-card.component';
|
|
1
2
|
export * from './filter-components';
|
|
2
3
|
export * from './filter-components/product-list-apply-filter-button';
|
|
3
|
-
export * from './product-list-card.component';
|
|
4
4
|
export * from './product-list-card-loading.component';
|
|
5
5
|
export * from './product-list-filters.component';
|
|
6
|
+
export * from './product-list-retailers';
|
|
6
7
|
export * from './product-list-search.component';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { BaseComponent } from 'core/base-component.service';
|
|
1
2
|
import type { ProductListFilterType } from 'interfaces/core.interface';
|
|
2
|
-
import { BaseComponent } from '@/core/base-component.service';
|
|
3
3
|
export interface IProductListFiltersParams {
|
|
4
4
|
filters: ProductListFilterType[];
|
|
5
5
|
}
|
|
@@ -8,66 +8,58 @@ export declare class ProductListFiltersComponent extends BaseComponent<IProductL
|
|
|
8
8
|
private readonly DEFAULT_MAX_PRICE;
|
|
9
9
|
private readonly FILTER_DEBOUNCE_DELAY_MS;
|
|
10
10
|
private readonly DESKTOP_BREAKPOINT;
|
|
11
|
-
private
|
|
11
|
+
private isRenderedInDrawerMode;
|
|
12
|
+
private permanentFilters;
|
|
12
13
|
private availableDynamicFilters;
|
|
13
14
|
private checkboxFilterStateMap;
|
|
14
15
|
private isPriceFilterCollapsed;
|
|
15
16
|
private isFulfillmentFilterCollapsed;
|
|
16
|
-
private
|
|
17
|
-
private
|
|
17
|
+
private appliedFiltersChipsContainer;
|
|
18
|
+
private engravingFiltersContainer?;
|
|
19
|
+
private presaleFilterContainer?;
|
|
20
|
+
private fulfillmentFilterContainer?;
|
|
18
21
|
private priceFiltersContainer?;
|
|
19
22
|
private dynamicFiltersContainer?;
|
|
20
23
|
private filterButtonContainer?;
|
|
24
|
+
private fulfillmentOptionsList?;
|
|
21
25
|
private priceFilterChevronIcon?;
|
|
22
|
-
private priceSliderWrapper?;
|
|
23
26
|
private fulfillmentFilterChevronIcon?;
|
|
24
|
-
private
|
|
25
|
-
private productSearchComponent;
|
|
26
|
-
private hasRenderedFiltersOnce;
|
|
27
|
-
private priceFilterDebounceTimer;
|
|
28
|
-
private stateSubscriptionCleanup?;
|
|
27
|
+
private priceSliderWrapper?;
|
|
29
28
|
private resizeHandler;
|
|
29
|
+
private priceFilterDebounceTimer;
|
|
30
|
+
constructor();
|
|
30
31
|
get hostClasses(): string[];
|
|
31
32
|
protected connected(): Promise<void>;
|
|
32
|
-
|
|
33
|
-
private
|
|
34
|
-
private
|
|
35
|
-
|
|
33
|
+
private setupDrawerCloseListener;
|
|
34
|
+
private setupResizeListener;
|
|
35
|
+
private detectIfRenderedInDrawer;
|
|
36
|
+
onStoreWatch(): void;
|
|
37
|
+
private syncFiltersFromStore;
|
|
38
|
+
private refreshUIStates;
|
|
39
|
+
private transformFilterValue;
|
|
36
40
|
private fetchFilters;
|
|
37
41
|
private applyFiltersAndCloseDrawer;
|
|
38
|
-
|
|
42
|
+
protected template(): HTMLElement[];
|
|
43
|
+
private buildFilterButton;
|
|
44
|
+
private openFilterDrawer;
|
|
45
|
+
private buildFilterHeader;
|
|
39
46
|
private clearAllActiveFilters;
|
|
40
|
-
private
|
|
41
|
-
private isEngravingCurrentlyDisabled;
|
|
42
|
-
private isPresaleCurrentlyDisabled;
|
|
43
|
-
private shouldRenderPriceFilter;
|
|
47
|
+
private removeSingleFilter;
|
|
44
48
|
private getFilteredAndSanitizedFilters;
|
|
49
|
+
private buildAppliedFiltersChipsContainer;
|
|
50
|
+
private handleFilterChange;
|
|
51
|
+
private isEngravingCurrentlyDisabled;
|
|
45
52
|
private buildEngravingFilterElements;
|
|
46
53
|
private buildPresaleFilterElements;
|
|
54
|
+
private isSameDayDeliveryCurrentlyDisabled;
|
|
55
|
+
private toggleFulfillmentFilterCollapse;
|
|
47
56
|
private buildFulfillmentFilterElements;
|
|
57
|
+
private togglePriceFilterCollapse;
|
|
48
58
|
private buildPriceFilterElements;
|
|
59
|
+
private buildDynamicFiltersElements;
|
|
60
|
+
private getFilterElements;
|
|
49
61
|
private buildCheckboxFilterElements;
|
|
62
|
+
private toggleCheckboxFilterExpansion;
|
|
50
63
|
private renderCheckboxItemsForFilter;
|
|
51
64
|
private handleCheckboxSelectionChange;
|
|
52
|
-
private toggleCheckboxFilterExpansion;
|
|
53
|
-
private buildFilterButton;
|
|
54
|
-
private openFilterDrawer;
|
|
55
|
-
private buildActiveFiltersChipsContainer;
|
|
56
|
-
private synchronizeUIWithFilters;
|
|
57
|
-
private refreshActiveFiltersChips;
|
|
58
|
-
private togglePriceFilterCollapse;
|
|
59
|
-
private toggleFulfillmentFilterCollapse;
|
|
60
|
-
private refreshFilterButton;
|
|
61
|
-
private setupResizeListener;
|
|
62
|
-
private renderPriceFilters;
|
|
63
|
-
private renderDynamicFilters;
|
|
64
|
-
private renderSpecificFilterType;
|
|
65
|
-
private renderAllRemainingFilters;
|
|
66
|
-
private appendFilterElementsToContainer;
|
|
67
|
-
private detectIfRenderedInDrawer;
|
|
68
|
-
private emitFiltersChangedEvent;
|
|
69
|
-
protected template(): HTMLElement[];
|
|
70
|
-
private buildFilterHeader;
|
|
71
|
-
private cleanupResizeListener;
|
|
72
|
-
private doCleanup;
|
|
73
65
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IProductListComponent } from 'interfaces/configs';
|
|
2
|
+
import { BaseComponent } from '@/core/base-component.service';
|
|
3
|
+
export interface IProductListRetailersParams {
|
|
4
|
+
productId: string;
|
|
5
|
+
config?: IProductListComponent;
|
|
6
|
+
}
|
|
7
|
+
export declare class ProductListRetailersComponent extends BaseComponent<IProductListRetailersParams, IProductListComponent> {
|
|
8
|
+
get hostClasses(): string[];
|
|
9
|
+
constructor();
|
|
10
|
+
private getProductId;
|
|
11
|
+
protected template(): HTMLElement[];
|
|
12
|
+
private extractFulfillments;
|
|
13
|
+
private onFulfillmentTabClick;
|
|
14
|
+
private onRetailerCardClick;
|
|
15
|
+
private createHeader;
|
|
16
|
+
private createNoAvailabilityMessage;
|
|
17
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
private readonly DESKTOP_BREAKPOINT;
|
|
15
|
+
constructor();
|
|
16
|
+
get hostClasses(): string[];
|
|
17
|
+
protected connected(): Promise<void>;
|
|
18
|
+
disconnectedCallback(): void;
|
|
19
|
+
private reRender;
|
|
20
|
+
private getAvailabilityData;
|
|
21
|
+
private isPresaleActive;
|
|
22
|
+
private handleAddToCart;
|
|
23
|
+
protected template(): HTMLElement[];
|
|
24
|
+
private generateProductUrl;
|
|
25
|
+
private createVariantStandard;
|
|
26
|
+
private createImageSection;
|
|
27
|
+
private createContentSection;
|
|
28
|
+
private createBadgesSection;
|
|
29
|
+
private createTitleSection;
|
|
30
|
+
private createPricePersonalizationSection;
|
|
31
|
+
private createSizesSection;
|
|
32
|
+
private handleDeliveryOptionsClick;
|
|
33
|
+
private createFulfillmentSectionWrapper;
|
|
34
|
+
private createAddToCartSection;
|
|
35
|
+
}
|
|
@@ -1,72 +1,67 @@
|
|
|
1
|
+
import type { IModalContentConfig } from 'core/store/interfaces/core.interface';
|
|
2
|
+
import type { IProductListProduct, IProductListStore } from 'core/store/interfaces/product-list.interface';
|
|
1
3
|
import { BaseCommand } from '@/core/command/base-command.service';
|
|
4
|
+
import { type FulfillmentType } from '@/enums';
|
|
2
5
|
import type { IProduct, IRetailer } from '@/interfaces/api/product.interface';
|
|
3
6
|
import type { IFilterSchema, INavigationResponse, IProductSearchParams, IProductSearchResponse } from '@/interfaces/api/product-list.interface';
|
|
4
7
|
import type { ProductListFilterType } from '@/interfaces/core.interface';
|
|
5
8
|
import { type AddItemParams } from '@/modules/cart/cart.commands';
|
|
6
9
|
import type { IExtendedFilterSchema, IPagination, IProductListFilters } from './product-list.interface';
|
|
7
|
-
|
|
8
|
-
products: IProduct[];
|
|
9
|
-
retailers: Record<string, IRetailer>;
|
|
10
|
-
filters: IFilterSchema[];
|
|
11
|
-
pagination: IPagination;
|
|
12
|
-
isLoading: boolean;
|
|
13
|
-
currentFilters: Record<string, string[]>;
|
|
14
|
-
searchTerm: string;
|
|
15
|
-
gridConfig?: {
|
|
16
|
-
rows: number;
|
|
17
|
-
columns: number;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
type StateListener = (state: IProductListState) => void;
|
|
10
|
+
type StateListener = (state: IProductListStore) => void;
|
|
21
11
|
export declare class ProductListCommands extends BaseCommand {
|
|
22
12
|
private readonly uiCommands;
|
|
23
13
|
private readonly cartCommands;
|
|
24
14
|
private readonly checkoutCommands;
|
|
25
15
|
private readonly FILTER_TYPE_MAP;
|
|
26
|
-
private state;
|
|
27
16
|
private listeners;
|
|
28
17
|
constructor();
|
|
29
18
|
static getInstance(): ProductListCommands;
|
|
30
19
|
subscribe(listener: StateListener): () => void;
|
|
31
|
-
|
|
32
|
-
updateState(partial: Partial<IProductListState>): void;
|
|
20
|
+
private getStoreState;
|
|
33
21
|
updateSearchTerm(searchTerm: string): void;
|
|
34
22
|
setLoading(isLoading: boolean): void;
|
|
35
23
|
private notifyListeners;
|
|
24
|
+
private initializeProductFulfillment;
|
|
25
|
+
private transformProductVariantsToFulfillments;
|
|
26
|
+
private transformSingleProduct;
|
|
27
|
+
private transformProductSize;
|
|
28
|
+
private addShippingFulfillments;
|
|
29
|
+
private addOnDemandFulfillments;
|
|
36
30
|
loadInitialProducts(page: number, perPage: number, searchTerm: string, currentFilters: IProductListFilters, configuredFilters: ProductListFilterType[]): Promise<void>;
|
|
37
31
|
loadMoreProducts(perPage: number, searchTerm: string, currentFilters: IProductListFilters, configuredFilters: ProductListFilterType[]): Promise<void>;
|
|
38
32
|
getProductList(params: IProductSearchParams): Promise<IProductSearchResponse>;
|
|
39
|
-
updateCurrentFilters(filterKey: string, values: string[]): void;
|
|
40
33
|
syncFiltersFromComponent(filters: IProductListFilters): void;
|
|
41
34
|
getSanitizedFilters(filters: IFilterSchema[], configuredFilters: ProductListFilterType[]): IExtendedFilterSchema[];
|
|
42
35
|
buildSearchParams(page: number, perPage: number, searchTerm: string, currentFilters: IProductListFilters, configuredFilters: ProductListFilterType[]): IProductSearchParams;
|
|
43
|
-
private
|
|
36
|
+
private buildFilters;
|
|
44
37
|
private addToggleFilters;
|
|
38
|
+
private getBooleanFilterValue;
|
|
45
39
|
private addEngravingFilter;
|
|
46
40
|
private addPresaleFilter;
|
|
47
41
|
private addFulfillmentFilter;
|
|
48
42
|
private addPriceFilter;
|
|
49
43
|
private addDynamicFilters;
|
|
50
|
-
isEngravingDisabled(currentFilters: IProductListFilters): boolean;
|
|
51
|
-
isPresaleDisabled(currentFilters: IProductListFilters): boolean;
|
|
52
|
-
isSameDayFulfillmentDisabled(currentFilters: IProductListFilters): boolean;
|
|
53
|
-
private isValidFilterValue;
|
|
54
44
|
setGridConfig(rows: number, columns: number): void;
|
|
55
45
|
getItemsPerPage(): number;
|
|
56
46
|
updatePagination(navigation: INavigationResponse | undefined): IPagination;
|
|
57
47
|
createInitialPagination(): IPagination;
|
|
58
48
|
mergeRetailers(existingRetailers: Record<string, IRetailer>, newRetailers: Record<string, IRetailer>): Record<string, IRetailer>;
|
|
59
|
-
extractProductCardData(product:
|
|
60
|
-
product:
|
|
61
|
-
defaultSize: any;
|
|
62
|
-
firstVariant: any;
|
|
49
|
+
extractProductCardData(product: IProductListProduct, retailers: Record<string, IRetailer>): {
|
|
50
|
+
product: IProductListProduct;
|
|
63
51
|
retailer: IRetailer;
|
|
64
52
|
} | null;
|
|
65
53
|
private getFilterKeyToTypeMap;
|
|
66
54
|
addToCart(params: AddItemParams): Promise<void>;
|
|
67
55
|
addPresaleToCart(params: AddItemParams): Promise<void>;
|
|
68
56
|
trackViewItemList(products: IProduct[]): void;
|
|
69
|
-
trackSelectItem(product:
|
|
57
|
+
trackSelectItem(product: IProductListProduct): void;
|
|
70
58
|
private convertProductToBaseItem;
|
|
59
|
+
openProductListModal(productId: string, contentType: IModalContentConfig['type'], data?: Record<string, any>): void;
|
|
60
|
+
closeProductListModal(productId: string): void;
|
|
61
|
+
selectFulfillmentType: (productId: string, selectedFulfillmentType: FulfillmentType) => Promise<void>;
|
|
62
|
+
selectFulfillment: (productId: string, fulfillmentId: string) => Promise<void>;
|
|
63
|
+
selectSize: (productId: string, sizeId: string) => Promise<void>;
|
|
64
|
+
private getFulfillmentForSize;
|
|
65
|
+
updateQuantity: (productId: string, quantity: number) => void;
|
|
71
66
|
}
|
|
72
67
|
export {};
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { BaseComponent, type IOnStoreChanged } from '@/core/base-component.service';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ProductListFilterType } from '@/interfaces/core.interface';
|
|
3
3
|
export interface IProductListComponentParams {
|
|
4
|
-
cardVariant: ProductListCardVariantType;
|
|
5
4
|
rows: number;
|
|
6
5
|
columns: number;
|
|
7
|
-
fillCard: boolean;
|
|
8
6
|
filters: ProductListFilterType[];
|
|
9
7
|
productUrl?: string;
|
|
10
8
|
}
|
|
11
9
|
export declare class ProductListComponent extends BaseComponent<IProductListComponentParams> {
|
|
12
10
|
private products;
|
|
13
11
|
private retailers;
|
|
14
|
-
private filters;
|
|
15
12
|
private pagination;
|
|
16
13
|
private cardsContainer;
|
|
17
14
|
private sentinelElement;
|
|
@@ -25,16 +22,17 @@ export declare class ProductListComponent extends BaseComponent<IProductListComp
|
|
|
25
22
|
disconnectedCallback(): void;
|
|
26
23
|
private initializeComponent;
|
|
27
24
|
private handleStateUpdate;
|
|
25
|
+
private updateLoadingState;
|
|
26
|
+
private hasProductsChanged;
|
|
27
|
+
private updateProductData;
|
|
28
|
+
private handleProductRendering;
|
|
29
|
+
private renderSimplifiedProducts;
|
|
28
30
|
private setLoadingState;
|
|
29
31
|
private renderCurrentState;
|
|
30
32
|
private loadInitialProducts;
|
|
31
33
|
private loadMoreProducts;
|
|
32
34
|
private buildCurrentFiltersFromState;
|
|
33
35
|
private mapStateFilterToComponentFilter;
|
|
34
|
-
private refetchProductsWithNewFilters;
|
|
35
|
-
private resetPagination;
|
|
36
|
-
private setupFilterChangeListener;
|
|
37
|
-
private setupSearchChangeListener;
|
|
38
36
|
private createCardsContainer;
|
|
39
37
|
private renderLoadingState;
|
|
40
38
|
private renderProducts;
|