@liquidcommerce/elements-sdk 2.6.0-beta.45 → 2.6.0-beta.47
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.checkout.esm.js +7254 -7409
- package/dist/index.esm.js +11995 -12602
- package/dist/ssr-stub.esm.js +4 -5
- package/dist/types/clients/base.d.ts +2 -2
- package/dist/types/clients/helpers.d.ts +1 -1
- package/dist/types/constants/core.constant.d.ts +0 -6
- 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/singleton-manager.service.d.ts +12 -8
- package/dist/types/core/store/interfaces/core.interface.d.ts +8 -12
- package/dist/types/core/store/interfaces/product-list.interface.d.ts +12 -30
- package/dist/types/core/store/store.constant.d.ts +2 -1
- 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 +4 -5
- package/dist/types/interfaces/api/product-list.interface.d.ts +2 -1
- package/dist/types/interfaces/client.interface.d.ts +11 -1
- package/dist/types/interfaces/config.interface.d.ts +2 -1
- package/dist/types/interfaces/configs/global.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/product-list.interface.d.ts +33 -19
- package/dist/types/interfaces/injection.interface.d.ts +4 -1
- 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-retailers-popup-list.component.d.ts +5 -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-button.d.ts +1 -3
- package/dist/types/modules/product-list/components/card-components/product-quantity-selector.d.ts +3 -4
- package/dist/types/modules/product-list/components/card-components/product-sizes-list.d.ts +9 -5
- package/dist/types/modules/product-list/components/filter-components/product-list-toggle-filters.d.ts +0 -6
- package/dist/types/modules/product-list/components/index.d.ts +0 -2
- package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +6 -6
- package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +1 -4
- package/dist/types/modules/product-list/components/product-list-product-engraving-lines.component.d.ts +1 -0
- package/dist/types/modules/product-list/components/product-list-product-pre-cart.component.d.ts +17 -15
- package/dist/types/modules/product-list/components/product-list-search.component.d.ts +4 -3
- package/dist/types/modules/product-list/product-list-card.component.d.ts +20 -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 +15 -62
- package/dist/types/modules/product-list/product-list.component.d.ts +2 -10
- package/dist/types/modules/product-list/product-list.constants.d.ts +0 -1
- 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 -0
- package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +1 -2
- 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/utils/product-selection.d.ts +16 -0
- package/dist/types/utils/product.d.ts +10 -0
- package/package.json +8 -8
- 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-content.component.d.ts +0 -22
- package/dist/types/modules/product-list/components/product-list-retailers.component.d.ts +0 -22
- 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/dist/ssr-stub.esm.js
CHANGED
|
@@ -157,7 +157,6 @@ const COMPONENT_TYPE = {
|
|
|
157
157
|
PURCHASE_MIN_ALERT: 'purchase-min-alert',
|
|
158
158
|
ALERT: 'alert',
|
|
159
159
|
PROMO_CODE_TICKER: 'promo-code-ticker',
|
|
160
|
-
MODAL: 'modal',
|
|
161
160
|
ADDRESS: 'address',
|
|
162
161
|
ADDRESS_INPUT: 'address-input',
|
|
163
162
|
ADDRESS_DISPLAY: 'address-display',
|
|
@@ -179,11 +178,10 @@ const COMPONENT_TYPE = {
|
|
|
179
178
|
PRODUCT_LIST_FILTERS: 'product-list-filters',
|
|
180
179
|
PRODUCT_LIST_SEARCH: 'product-list-search',
|
|
181
180
|
PRODUCT_LIST_CARD_LOADING: 'product-list-card-loading',
|
|
182
|
-
PRODUCT_LIST_RETAILERS: 'product-list-retailers',
|
|
183
181
|
PRODUCT_LIST_ENGRAVING_FORM: 'product-list-engraving-form',
|
|
184
182
|
PRODUCT_LIST_PRODUCT_PRE_CART: 'product-list-product-pre-cart',
|
|
185
|
-
PRODUCT_LIST_RETAILERS_CONTENT: 'product-list-retailers-content',
|
|
186
183
|
PRODUCT_LIST_PRODUCT_ENGRAVING_LINES: 'product-list-product-engraving-lines',
|
|
184
|
+
PRODUCT_LIST_SIZE_SELECTOR: 'product-list-size-selector',
|
|
187
185
|
CART: 'cart',
|
|
188
186
|
CART_RETAILER: 'cart-retailer',
|
|
189
187
|
CART_ITEM: 'cart-item',
|
|
@@ -254,8 +252,9 @@ const DISPLAY_MODE = {
|
|
|
254
252
|
DRAWER: 'drawer',
|
|
255
253
|
};
|
|
256
254
|
const NAVIGATION_SOURCE = {
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
PRODUCT: 'product',
|
|
256
|
+
PRODUCT_LIST_CARD: 'product-list-card',
|
|
257
|
+
PRE_CART: 'pre-cart',
|
|
259
258
|
};
|
|
260
259
|
|
|
261
260
|
const SSR_WARN = '[LiquidCommerce Elements] This SDK is designed for the browser. ' + 'Calls made during SSR return null. The SDK will initialize on the client.';
|
|
@@ -36,7 +36,7 @@ export declare abstract class ElementsBaseClient {
|
|
|
36
36
|
protected clientPrepared: boolean;
|
|
37
37
|
protected componentFactoryInitialized: boolean;
|
|
38
38
|
protected cartDrawerElement: HTMLElement | null;
|
|
39
|
-
|
|
39
|
+
private heavyInitTimeoutId;
|
|
40
40
|
protected injectedComponents: Map<string, IInjectedComponent>;
|
|
41
41
|
constructor(clientConfigs: IClientConfigs);
|
|
42
42
|
prepare(): Promise<void>;
|
|
@@ -50,8 +50,8 @@ export declare abstract class ElementsBaseClient {
|
|
|
50
50
|
injectProductListSearch(params: IInjectProductListSearchParams): Promise<void>;
|
|
51
51
|
injectProductListFilters(params: IInjectProductListFiltersParams): Promise<void>;
|
|
52
52
|
protected ensureCartDrawerExists(): void;
|
|
53
|
-
protected ensureModalExists(): void;
|
|
54
53
|
protected ensureAllComponentsRegistered(): void;
|
|
54
|
+
private getServerListConfig;
|
|
55
55
|
protected createInjectedComponentWrapper(containerId: string, type: ComponentType, element: HTMLElement): IInjectedComponent;
|
|
56
56
|
destroy(): void;
|
|
57
57
|
protected rerenderInjectedComponentsByType(type: ComponentType): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type ComponentType } from '@/enums';
|
|
2
|
-
export declare function deepMergeConfigs<T extends Record<string, any>>(target: T, source: Partial<T
|
|
2
|
+
export declare function deepMergeConfigs<T extends Record<string, any>>(target: T, source: Partial<T>, currentPath?: string): T;
|
|
3
3
|
export declare const layoutFieldToComponentTypes: Map<string, ComponentType[]>;
|
|
4
4
|
export declare function getComponentTypesForLayoutFields(parentPath: string, layoutFields: Record<string, any>): ComponentType[];
|
|
@@ -3,12 +3,8 @@ export declare const API_CLIENT_URL: {
|
|
|
3
3
|
staging: string;
|
|
4
4
|
production: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const PRODUCT_LIST_CARD_VARIANT: {
|
|
7
|
-
STANDARD: string;
|
|
8
|
-
};
|
|
9
6
|
export declare const PRODUCT_LIST_FILTER_TYPES: {
|
|
10
7
|
ENGRAVING: string;
|
|
11
|
-
PRESALE: string;
|
|
12
8
|
FULFILLMENT: string;
|
|
13
9
|
PRICE: string;
|
|
14
10
|
BRANDS: string;
|
|
@@ -45,6 +41,4 @@ export declare const Z_INDEX: {
|
|
|
45
41
|
readonly ADDRESS_ACTIONS: 5050;
|
|
46
42
|
readonly SKELETON_WAVE: 5040;
|
|
47
43
|
readonly CONTENT_OVERLAY: 5030;
|
|
48
|
-
readonly MODAL: 2147483640;
|
|
49
44
|
};
|
|
50
|
-
export declare const DESKTOP_BREAKPOINT = 1024;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { ApiResult } from '@/core/api/api-result';
|
|
1
2
|
import type { AuthClientService } from '@/core/api/auth-client.service';
|
|
2
|
-
import type { IPersistedStore } from '@/core/store/interfaces/core.interface';
|
|
3
|
+
import type { IPersistedStore, IPersistedStoreAction } from '@/core/store/interfaces/core.interface';
|
|
3
4
|
import type { IAddressAutocompleteResult, IAddressDetailsResult, ILocation } from '@/interfaces/api/address.interface';
|
|
4
5
|
import type { ICart, ICartUpdateParams } from '@/interfaces/api/cart.interface';
|
|
5
6
|
import type { ICheckoutComplete, ICheckoutItemsUpdateParams, ICheckoutItemsUpdateResponse, ICheckoutPaymentConfirm, ICheckoutPaymentConfirmParams, ICheckoutPaymentSession, ICheckoutPrepare, ICheckoutPrepareParams } from '@/interfaces/api/checkout.interface';
|
|
@@ -11,18 +12,18 @@ export declare class ApiClientService {
|
|
|
11
12
|
constructor();
|
|
12
13
|
static getInstance(): ApiClientService;
|
|
13
14
|
setClient(client: AuthClientService): Promise<void>;
|
|
14
|
-
setPersistedStore(userDeviceId: string, data: IPersistedStore): Promise<
|
|
15
|
-
getPersistedStore(userDeviceId: string): Promise<IPersistedStore
|
|
16
|
-
deletePersistedStore(userDeviceId: string): Promise<
|
|
17
|
-
getAddressSuggestions(input: string): Promise<IAddressAutocompleteResult[]
|
|
18
|
-
getAddressDetails(id: string): Promise<IAddressDetailsResult
|
|
19
|
-
getProductsData(identifier: string[], location?: ILocation): Promise<IProductAvailabilityResponse
|
|
20
|
-
|
|
21
|
-
getCartData(id: string | null): Promise<ICart
|
|
22
|
-
updateCart(params: ICartUpdateParams): Promise<ICart
|
|
23
|
-
prepareCheckout(params: ICheckoutPrepareParams): Promise<ICheckoutPrepare
|
|
24
|
-
updateCheckoutItems(params: ICheckoutItemsUpdateParams): Promise<ICheckoutItemsUpdateResponse
|
|
25
|
-
getPaymentSession(cartId: string): Promise<ICheckoutPaymentSession
|
|
26
|
-
confirmPaymentSession(params: ICheckoutPaymentConfirmParams): Promise<ICheckoutPaymentConfirm
|
|
27
|
-
checkoutComplete(token: string): Promise<ICheckoutComplete
|
|
15
|
+
setPersistedStore(userDeviceId: string, data: IPersistedStore): Promise<ApiResult<IPersistedStoreAction>>;
|
|
16
|
+
getPersistedStore(userDeviceId: string): Promise<ApiResult<IPersistedStore>>;
|
|
17
|
+
deletePersistedStore(userDeviceId: string): Promise<ApiResult<IPersistedStoreAction>>;
|
|
18
|
+
getAddressSuggestions(input: string): Promise<ApiResult<IAddressAutocompleteResult[]>>;
|
|
19
|
+
getAddressDetails(id: string): Promise<ApiResult<IAddressDetailsResult>>;
|
|
20
|
+
getProductsData(identifier: string[], location?: ILocation): Promise<ApiResult<IProductAvailabilityResponse>>;
|
|
21
|
+
productListSearch(params: IProductSearchParams): Promise<ApiResult<IProductSearchResponse>>;
|
|
22
|
+
getCartData(id: string | null): Promise<ApiResult<ICart>>;
|
|
23
|
+
updateCart(params: ICartUpdateParams): Promise<ApiResult<ICart>>;
|
|
24
|
+
prepareCheckout(params: ICheckoutPrepareParams): Promise<ApiResult<ICheckoutPrepare>>;
|
|
25
|
+
updateCheckoutItems(params: ICheckoutItemsUpdateParams): Promise<ApiResult<ICheckoutItemsUpdateResponse>>;
|
|
26
|
+
getPaymentSession(cartId: string): Promise<ApiResult<ICheckoutPaymentSession>>;
|
|
27
|
+
confirmPaymentSession(params: ICheckoutPaymentConfirmParams): Promise<ApiResult<ICheckoutPaymentConfirm>>;
|
|
28
|
+
checkoutComplete(token: string): Promise<ApiResult<ICheckoutComplete>>;
|
|
28
29
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface IApiErrorDetail {
|
|
2
|
+
field?: string;
|
|
3
|
+
message: string;
|
|
4
|
+
code?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ApiError {
|
|
7
|
+
status: number;
|
|
8
|
+
message: string;
|
|
9
|
+
errors: IApiErrorDetail[];
|
|
10
|
+
}
|
|
11
|
+
export type ApiResult<T> = {
|
|
12
|
+
success: true;
|
|
13
|
+
data: T;
|
|
14
|
+
} | {
|
|
15
|
+
success: false;
|
|
16
|
+
error: ApiError;
|
|
17
|
+
};
|
|
18
|
+
export declare function apiSuccess<T>(data: T): ApiResult<T>;
|
|
19
|
+
export declare function apiError<T = never>(status: number, message: string, errors?: IApiErrorDetail[]): ApiResult<T>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ApiResult } from '@/core/api/api-result';
|
|
1
2
|
import type { ElementsEnv } from '@/enums';
|
|
2
3
|
import type { IAllConfigs } from '@/interfaces/configs/global.interface';
|
|
3
4
|
export interface IAuthConfig {
|
|
@@ -13,13 +14,20 @@ export interface IAuth {
|
|
|
13
14
|
accessToken: string;
|
|
14
15
|
expiration: number;
|
|
15
16
|
}
|
|
16
|
-
export interface IApiResponseBase {
|
|
17
|
-
message: string;
|
|
18
|
-
}
|
|
19
17
|
export interface IApiResponse<T> {
|
|
20
18
|
message: string;
|
|
21
19
|
data: T;
|
|
22
20
|
}
|
|
21
|
+
export interface IApiErrorDetail {
|
|
22
|
+
field?: string;
|
|
23
|
+
message: string;
|
|
24
|
+
code?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface IApiError {
|
|
27
|
+
statusCode: number;
|
|
28
|
+
message: string;
|
|
29
|
+
errors: IApiErrorDetail[];
|
|
30
|
+
}
|
|
23
31
|
export interface IAuthWithConfigs {
|
|
24
32
|
auth: IAuth;
|
|
25
33
|
configs: IAllConfigs;
|
|
@@ -46,8 +54,8 @@ export declare class AuthClientService {
|
|
|
46
54
|
}>;
|
|
47
55
|
authenticate(): Promise<boolean>;
|
|
48
56
|
refreshToken(): Promise<boolean>;
|
|
49
|
-
get<
|
|
50
|
-
post<
|
|
57
|
+
get<TData = unknown>(path: string, options?: IHttpRequestOptions): Promise<ApiResult<TData>>;
|
|
58
|
+
post<TData = unknown>(path: string, options?: IHttpRequestOptions): Promise<ApiResult<TData>>;
|
|
51
59
|
private performAuthentication;
|
|
52
60
|
private performTokenRefresh;
|
|
53
61
|
private request;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import type { IClientConfigs } from '@/core/client/client-config.service';
|
|
2
|
-
import type { LiquidCommerceElementsBuilderClientConstructor, LiquidCommerceElementsClientConstructor } from '@/interfaces/client.interface';
|
|
2
|
+
import type { LiquidCommerceElementsBuilderClientConstructor, LiquidCommerceElementsCheckoutClientConstructor, LiquidCommerceElementsClientConstructor } from '@/interfaces/client.interface';
|
|
3
|
+
type ClientConstructor = LiquidCommerceElementsClientConstructor | LiquidCommerceElementsBuilderClientConstructor | LiquidCommerceElementsCheckoutClientConstructor;
|
|
4
|
+
export type SDKContext = 'regular' | 'builder' | 'checkout';
|
|
3
5
|
export declare class SingletonManager {
|
|
4
6
|
private static clientConstructor;
|
|
5
|
-
private static
|
|
6
|
-
private static builderClientInstances;
|
|
7
|
+
private static contexts;
|
|
7
8
|
private static currentContext;
|
|
9
|
+
private static initializationInProgress;
|
|
8
10
|
private static getInstances;
|
|
9
11
|
private constructor();
|
|
10
|
-
static setContext(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
static
|
|
14
|
-
static
|
|
12
|
+
static setContext(context: SDKContext): void;
|
|
13
|
+
static finalizeInitialization(): void;
|
|
14
|
+
static hasContext(context: SDKContext): boolean;
|
|
15
|
+
static destroyContext(context: SDKContext): void;
|
|
16
|
+
static setClientConstructor(lceConstructor: ClientConstructor): void;
|
|
17
|
+
static getClientConstructor(): ClientConstructor | null;
|
|
15
18
|
static getClassInstance<T>(className: string, instanceCreator: () => T): T;
|
|
16
19
|
static getClient<T>(clientConfigs: IClientConfigs): Promise<T>;
|
|
17
20
|
}
|
|
21
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import type { ICartFulfillmentStore, ICartItemStore, ICartRetailerStore, ICartSt
|
|
|
3
3
|
import type { ICheckoutCustomerFormStore, ICheckoutGiftRecipientFormStore, ICheckoutItemStore, ICheckoutPaymentFormStore, ICheckoutPaymentMethodStore, ICheckoutPaymentSessionStore, ICheckoutStore } from '@/core/store/interfaces/checkout.interface';
|
|
4
4
|
import type { ICheckoutInjection, ICheckoutMetadata, IElementsMetadataStore } from '@/core/store/interfaces/metadata.interface';
|
|
5
5
|
import type { IProductSizeStore, IProductStore } from '@/core/store/interfaces/product.interface';
|
|
6
|
-
import type { IProductListStore } from '@/core/store/interfaces/product-list.interface';
|
|
6
|
+
import type { IPLProductStore, IProductListStore } from '@/core/store/interfaces/product-list.interface';
|
|
7
7
|
import type { ComponentType } from '@/enums';
|
|
8
8
|
import type { ICartPromoCode } from '@/interfaces/api/cart.interface';
|
|
9
9
|
import type { ICheckoutGiftRecipient, ICheckoutMarketingPreferences, ICheckoutPresale, ICheckoutPromoCode, ICheckoutRetailer } from '@/interfaces/api/checkout.interface';
|
|
@@ -11,28 +11,21 @@ export interface IDrawerContentConfig {
|
|
|
11
11
|
type: ComponentType;
|
|
12
12
|
data?: Record<string, any>;
|
|
13
13
|
}
|
|
14
|
-
export
|
|
15
|
-
type: ComponentType;
|
|
16
|
-
data?: Record<string, any>;
|
|
17
|
-
}
|
|
14
|
+
export type UIDrawerMode = 'drawer' | 'modal';
|
|
18
15
|
export interface IDrawerStore {
|
|
19
16
|
isOpen: boolean;
|
|
20
17
|
contentConfig: IDrawerContentConfig | null;
|
|
18
|
+
mode: UIDrawerMode;
|
|
21
19
|
}
|
|
22
20
|
export interface IUIStore {
|
|
23
21
|
drawer: IDrawerStore;
|
|
24
|
-
modal: IModalStore;
|
|
25
|
-
}
|
|
26
|
-
export interface IModalStore {
|
|
27
|
-
isOpen: boolean;
|
|
28
|
-
contentConfig: IModalContentConfig | null;
|
|
29
22
|
}
|
|
30
23
|
export interface IGlobalStore {
|
|
31
24
|
address: IAddressStore;
|
|
32
25
|
products: Record<string, IProductStore>;
|
|
33
26
|
cart: ICartStore;
|
|
34
27
|
checkout: ICheckoutStore;
|
|
35
|
-
productsList: IProductListStore
|
|
28
|
+
productsList: Record<string, IProductListStore>;
|
|
36
29
|
ui: IUIStore;
|
|
37
30
|
metadata: IElementsMetadataStore;
|
|
38
31
|
}
|
|
@@ -40,7 +33,10 @@ export interface IPersistedStore {
|
|
|
40
33
|
p?: string;
|
|
41
34
|
c?: string;
|
|
42
35
|
}
|
|
43
|
-
export
|
|
36
|
+
export interface IPersistedStoreAction {
|
|
37
|
+
success: boolean;
|
|
38
|
+
}
|
|
39
|
+
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}` | `productsList.${string}` | `productsList.${string}.${keyof IProductListStore}` | `productsList.${string}.products.${string}` | `productsList.${string}.products.${string}.${keyof IPLProductStore}` | `metadata.${keyof IElementsMetadataStore}` | `metadata.checkout.${keyof ICheckoutMetadata}` | `metadata.checkout.injection.${keyof ICheckoutInjection}`;
|
|
44
40
|
interface MiddlewareContext {
|
|
45
41
|
action: string;
|
|
46
42
|
payload: any;
|
|
@@ -1,47 +1,29 @@
|
|
|
1
1
|
import type { IPagination } from 'modules/product-list/product-list.interface';
|
|
2
2
|
import type { FulfillmentType } from '@/enums';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IProduct } from '@/interfaces/api/product.interface';
|
|
4
4
|
import type { IFilterSchema } from '@/interfaces/api/product-list.interface';
|
|
5
|
-
import type { IProductSizeStore } from './product.interface';
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
retailerAddressFormatted: string;
|
|
10
|
-
variant: IProductVariant;
|
|
11
|
-
image: string | null;
|
|
12
|
-
};
|
|
13
|
-
export interface IProductList extends IProduct {
|
|
5
|
+
import type { IProductFulfillmentStore, IProductSizeStore } from './product.interface';
|
|
6
|
+
export interface IPLProductStore extends Omit<IProduct, 'sizes'> {
|
|
7
|
+
id: string;
|
|
8
|
+
sizes: Record<string, IProductSizeStore>;
|
|
14
9
|
quantity: number;
|
|
15
10
|
selectedSizeId: string | null;
|
|
16
11
|
selectedFulfillmentType: FulfillmentType;
|
|
17
12
|
selectedFulfillmentId: string | null;
|
|
18
13
|
selectedFulfillment: IProductFulfillmentStore | null;
|
|
14
|
+
engravingLines: string[];
|
|
19
15
|
productHasAvailability: boolean;
|
|
20
16
|
fulfillmentHasAvailability: boolean;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
sizes: Record<string, IProductSizeStore>;
|
|
24
|
-
}
|
|
25
|
-
export interface IUserProducts {
|
|
26
|
-
[productId: string]: {
|
|
27
|
-
selectedSizeId: string;
|
|
28
|
-
selectedFulfillmentType: FulfillmentType;
|
|
29
|
-
selectedFulfillment: IProductFulfillmentStore | null;
|
|
30
|
-
selectedQuantity: number;
|
|
31
|
-
engravingLines?: string[];
|
|
32
|
-
};
|
|
17
|
+
loading: boolean;
|
|
18
|
+
updating: boolean;
|
|
33
19
|
}
|
|
34
20
|
export interface IProductListStore {
|
|
35
|
-
products:
|
|
36
|
-
|
|
21
|
+
products: Record<string, IPLProductStore>;
|
|
22
|
+
appliedFilters: Record<string, string[]>;
|
|
37
23
|
filters: IFilterSchema[];
|
|
38
24
|
pagination: IPagination;
|
|
39
|
-
appliedFilters: Record<string, string[]>;
|
|
40
25
|
searchTerm: string;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
columns: number;
|
|
44
|
-
};
|
|
45
|
-
userProducts: IUserProducts;
|
|
26
|
+
rows: number;
|
|
27
|
+
columns: number;
|
|
46
28
|
loading: boolean;
|
|
47
29
|
}
|
|
@@ -12,5 +12,6 @@ export declare const initialCartState: ICartStore;
|
|
|
12
12
|
export declare const initialCheckoutState: ICheckoutStore;
|
|
13
13
|
export declare const initialUIState: IUIStore;
|
|
14
14
|
export declare const initialMetadataState: IElementsMetadataStore;
|
|
15
|
-
export declare const initialProductsListState: IProductListStore
|
|
15
|
+
export declare const initialProductsListState: Record<string, IProductListStore>;
|
|
16
|
+
export declare function createInitialProductListState(): IProductListStore;
|
|
16
17
|
export declare const initialStoreState: IGlobalStore;
|
|
@@ -28,6 +28,7 @@ export declare class StoreService {
|
|
|
28
28
|
createProductInstance(productId: string): boolean;
|
|
29
29
|
removeProductInstance(productId: string): boolean;
|
|
30
30
|
getProductInstances(): Record<string, IProductStore>;
|
|
31
|
+
destroy(): void;
|
|
31
32
|
getState(): IGlobalStore;
|
|
32
33
|
private setupMiddleware;
|
|
33
34
|
private loggingMiddleware;
|
|
@@ -10,6 +10,7 @@ export declare class TelemetryService {
|
|
|
10
10
|
constructor();
|
|
11
11
|
static getInstance(): TelemetryService;
|
|
12
12
|
isEnabled(): boolean;
|
|
13
|
+
destroy(): void;
|
|
13
14
|
captureEvent(level: TelemetryLevel, message: string, options?: ITelemetryEventOptions): void;
|
|
14
15
|
private buildErrorContext;
|
|
15
16
|
private buildSDKContext;
|
|
@@ -76,7 +76,6 @@ 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";
|
|
80
79
|
readonly ADDRESS: "address";
|
|
81
80
|
readonly ADDRESS_INPUT: "address-input";
|
|
82
81
|
readonly ADDRESS_DISPLAY: "address-display";
|
|
@@ -98,11 +97,10 @@ export declare const COMPONENT_TYPE: {
|
|
|
98
97
|
readonly PRODUCT_LIST_FILTERS: "product-list-filters";
|
|
99
98
|
readonly PRODUCT_LIST_SEARCH: "product-list-search";
|
|
100
99
|
readonly PRODUCT_LIST_CARD_LOADING: "product-list-card-loading";
|
|
101
|
-
readonly PRODUCT_LIST_RETAILERS: "product-list-retailers";
|
|
102
100
|
readonly PRODUCT_LIST_ENGRAVING_FORM: "product-list-engraving-form";
|
|
103
101
|
readonly PRODUCT_LIST_PRODUCT_PRE_CART: "product-list-product-pre-cart";
|
|
104
|
-
readonly PRODUCT_LIST_RETAILERS_CONTENT: "product-list-retailers-content";
|
|
105
102
|
readonly PRODUCT_LIST_PRODUCT_ENGRAVING_LINES: "product-list-product-engraving-lines";
|
|
103
|
+
readonly PRODUCT_LIST_SIZE_SELECTOR: "product-list-size-selector";
|
|
106
104
|
readonly CART: "cart";
|
|
107
105
|
readonly CART_RETAILER: "cart-retailer";
|
|
108
106
|
readonly CART_ITEM: "cart-item";
|
|
@@ -181,7 +179,8 @@ export declare const DISPLAY_MODE: {
|
|
|
181
179
|
};
|
|
182
180
|
export type DisplayModeType = (typeof DISPLAY_MODE)[keyof typeof DISPLAY_MODE];
|
|
183
181
|
export declare const NAVIGATION_SOURCE: {
|
|
184
|
-
readonly
|
|
185
|
-
readonly
|
|
182
|
+
readonly PRODUCT: "product";
|
|
183
|
+
readonly PRODUCT_LIST_CARD: "product-list-card";
|
|
184
|
+
readonly PRE_CART: "pre-cart";
|
|
186
185
|
};
|
|
187
186
|
export type NavigationSourceType = (typeof NAVIGATION_SOURCE)[keyof typeof NAVIGATION_SOURCE];
|
|
@@ -2,6 +2,7 @@ import type { FILTER_KEYS } from 'modules/product-list/product-list.constants';
|
|
|
2
2
|
import type { ILocation } from '@/interfaces/api/address.interface';
|
|
3
3
|
import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
|
|
4
4
|
export interface IProductSearchParams {
|
|
5
|
+
slug: string;
|
|
5
6
|
location?: ILocation;
|
|
6
7
|
search?: string;
|
|
7
8
|
pageToken?: string;
|
|
@@ -17,7 +18,7 @@ export interface IFilterParams {
|
|
|
17
18
|
key: string;
|
|
18
19
|
values: IFilterParamsValue;
|
|
19
20
|
}
|
|
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.
|
|
21
|
+
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.FULFILLMENT | typeof FILTER_KEYS.PRICE | typeof FILTER_KEYS.AVAILABILITY | typeof FILTER_KEYS.COLORS;
|
|
21
22
|
export interface IFilterSchema {
|
|
22
23
|
type: FacetFilterKeys;
|
|
23
24
|
values: IFilterValue[];
|
|
@@ -5,7 +5,7 @@ import type { IProductActions } from '@/core/client/actions/client-product-actio
|
|
|
5
5
|
import type { IClientConfigs } from '@/core/client/client-config.service';
|
|
6
6
|
import type { IAddressOptions } from '@/modules/address/address.interface';
|
|
7
7
|
import type { IInjectedComponent } from './component.interface';
|
|
8
|
-
import type { UpdateAddressComponent, UpdateCartComponent, UpdateCheckoutComponent, UpdateComponentGlobalConfigs, UpdateProductComponent } from './configs';
|
|
8
|
+
import type { UpdateAddressComponent, UpdateCartComponent, UpdateCheckoutComponent, UpdateComponentGlobalConfigs, UpdateProductComponent, UpdateProductListComponent } from './configs';
|
|
9
9
|
import type { IBuilderInjectElementParams, IInjectCheckoutBuilderParams, IInjectCheckoutParams, IInjectProductElement, IInjectProductListFiltersParams, IInjectProductListParams, IInjectProductListSearchParams } from './injection.interface';
|
|
10
10
|
export interface ILiquidCommerceElementsUIMethod {
|
|
11
11
|
cartButton(containerId: string, showItemsCount?: boolean): void;
|
|
@@ -36,6 +36,7 @@ export interface ILiquidCommerceElementsBuilderClient {
|
|
|
36
36
|
updateAddressComponent(configs: UpdateAddressComponent): void;
|
|
37
37
|
updateCartComponent(configs: UpdateCartComponent): void;
|
|
38
38
|
updateCheckoutComponent(configs: UpdateCheckoutComponent): void;
|
|
39
|
+
updateProductListComponent(configs: UpdateProductListComponent): void;
|
|
39
40
|
injectElement(params: IBuilderInjectElementParams): Promise<IInjectedComponent | null>;
|
|
40
41
|
injectProductElement(params: IInjectProductElement[]): Promise<IInjectedComponent[]>;
|
|
41
42
|
injectAddressElement(containerId: string, options?: IAddressOptions): Promise<IInjectedComponent | null>;
|
|
@@ -58,5 +59,14 @@ export interface ILiquidCommerceElementsClient {
|
|
|
58
59
|
getInjectedComponents(): Map<string, IInjectedComponent>;
|
|
59
60
|
destroy(): void;
|
|
60
61
|
}
|
|
62
|
+
export interface ILiquidCommerceElementsCheckoutClient {
|
|
63
|
+
prepare(): Promise<void>;
|
|
64
|
+
injectCheckout(params: IInjectCheckoutParams): Promise<IInjectedComponent | null>;
|
|
65
|
+
actions: {
|
|
66
|
+
checkout: IElementsCheckoutActions;
|
|
67
|
+
};
|
|
68
|
+
destroy(): void;
|
|
69
|
+
}
|
|
61
70
|
export type LiquidCommerceElementsClientConstructor = new (clientConfigs: IClientConfigs) => ILiquidCommerceElementsClient;
|
|
62
71
|
export type LiquidCommerceElementsBuilderClientConstructor = new (clientConfigs: IClientConfigs) => ILiquidCommerceElementsBuilderClient;
|
|
72
|
+
export type LiquidCommerceElementsCheckoutClientConstructor = new (clientConfigs: IClientConfigs) => ILiquidCommerceElementsCheckoutClient;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DebugMode, ElementsEnv } from '@/enums';
|
|
2
|
-
import type { IPromoTicker, UpdateAddressComponent, UpdateCartComponent, UpdateCheckoutComponent, UpdateComponentGlobalConfigs, UpdateProductComponent } from './configs';
|
|
2
|
+
import type { IPromoTicker, UpdateAddressComponent, UpdateCartComponent, UpdateCheckoutComponent, UpdateComponentGlobalConfigs, UpdateProductComponent, UpdateProductListComponent } from './configs';
|
|
3
3
|
export type DeepPartial<T> = {
|
|
4
4
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
5
5
|
};
|
|
@@ -18,6 +18,7 @@ export interface IClientCustomThemeConfig {
|
|
|
18
18
|
address?: UpdateAddressComponent;
|
|
19
19
|
cart?: UpdateCartComponent;
|
|
20
20
|
checkout?: UpdateCheckoutComponent;
|
|
21
|
+
productList?: UpdateProductListComponent;
|
|
21
22
|
}
|
|
22
23
|
export interface ILiquidCommerceElementsCheckoutConfig {
|
|
23
24
|
pageUrl: string;
|
|
@@ -53,10 +53,10 @@ export interface IAllConfigs {
|
|
|
53
53
|
configurations: IElementsConfigurations;
|
|
54
54
|
global: IComponentGlobalConfigs;
|
|
55
55
|
product: IProductComponent;
|
|
56
|
+
productList: IProductListComponent;
|
|
56
57
|
address: IAddressComponent;
|
|
57
58
|
cart: ICartComponent;
|
|
58
59
|
checkout: ICheckoutComponent;
|
|
59
|
-
productList: IProductListComponent;
|
|
60
60
|
}
|
|
61
61
|
export type ConfigsKeyType = 'all' | 'configurations' | 'global' | 'product' | 'address' | 'cart' | 'checkout' | 'productList';
|
|
62
62
|
export type ConfigsType = IAllConfigs | IElementsConfigurations | IComponentGlobalConfigs | IProductComponent | IAddressComponent | ICartComponent | ICheckoutComponent | IProductListComponent;
|
|
@@ -1,25 +1,39 @@
|
|
|
1
|
-
import type { DisplayModeType } from 'enums';
|
|
2
1
|
import type { DeepPartial } from '@/interfaces/config.interface';
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
export
|
|
6
|
-
|
|
2
|
+
import type { ProductListFilterType } from '@/interfaces/injection.interface';
|
|
3
|
+
export type PLCPresentationModeType = 'drawer' | 'modal';
|
|
4
|
+
export type PLCListType = 'curated' | 'dynamic';
|
|
5
|
+
export type PLCCardStyle = 'card' | 'ghost';
|
|
6
|
+
export interface IPLCProductCard {
|
|
7
|
+
style: PLCCardStyle;
|
|
8
|
+
cornerRadius: string;
|
|
9
|
+
showPrice: boolean;
|
|
10
|
+
showSizes: boolean;
|
|
11
|
+
showRetailerName: boolean;
|
|
12
|
+
showFulfillmentOptions: boolean;
|
|
13
|
+
enableShippingFulfillment: boolean;
|
|
14
|
+
enableOnDemandFulfillment: boolean;
|
|
15
|
+
enablePersonalization: boolean;
|
|
16
|
+
showQuantityCounter: boolean;
|
|
17
|
+
enablePreCart: boolean;
|
|
18
|
+
showCollectionTags: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface IPLCList {
|
|
21
|
+
type: PLCListType;
|
|
22
|
+
name: string;
|
|
23
|
+
slug: string;
|
|
24
|
+
filters: Record<string, string[]>;
|
|
25
|
+
productCard: IPLCProductCard;
|
|
26
|
+
presentationMode: PLCPresentationModeType;
|
|
27
|
+
availableFilters: ProductListFilterType[];
|
|
28
|
+
rows: number;
|
|
29
|
+
columns: number;
|
|
30
|
+
productUrl: string | null;
|
|
7
31
|
}
|
|
8
32
|
export interface IProductListLayout {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
showSizeSelector: boolean;
|
|
14
|
-
showFulfillment: boolean;
|
|
15
|
-
showRetailerName: boolean;
|
|
16
|
-
showQuantityCounter: boolean;
|
|
17
|
-
enableShippingFulfillment: boolean;
|
|
18
|
-
enableOnDemandFulfillment: boolean;
|
|
19
|
-
showCollections: boolean;
|
|
20
|
-
enablePersonalization: boolean;
|
|
21
|
-
};
|
|
22
|
-
displayMode: DisplayModeType;
|
|
33
|
+
lists: IPLCList[];
|
|
34
|
+
}
|
|
35
|
+
export interface IProductListTheme {
|
|
36
|
+
backgroundColor: string;
|
|
23
37
|
}
|
|
24
38
|
export interface IProductListComponent {
|
|
25
39
|
theme: IProductListTheme;
|
|
@@ -8,6 +8,7 @@ export interface IInjectProductElement {
|
|
|
8
8
|
export type ProductListFilterType = (typeof PRODUCT_LIST_FILTER_TYPES)[keyof typeof PRODUCT_LIST_FILTER_TYPES];
|
|
9
9
|
export interface IInjectProductListParams {
|
|
10
10
|
containerId: string;
|
|
11
|
+
slug: string;
|
|
11
12
|
rows?: number;
|
|
12
13
|
columns?: number;
|
|
13
14
|
filters?: ProductListFilterType[];
|
|
@@ -15,10 +16,12 @@ export interface IInjectProductListParams {
|
|
|
15
16
|
}
|
|
16
17
|
export interface IInjectProductListSearchParams {
|
|
17
18
|
containerId: string;
|
|
19
|
+
slug: string;
|
|
18
20
|
}
|
|
19
21
|
export interface IInjectProductListFiltersParams {
|
|
20
22
|
containerId: string;
|
|
21
|
-
|
|
23
|
+
slug: string;
|
|
24
|
+
filters?: ProductListFilterType[];
|
|
22
25
|
}
|
|
23
26
|
export interface IBuilderInjectElementParams {
|
|
24
27
|
type: ComponentType;
|
|
@@ -6,7 +6,7 @@ export declare class AddressCommands extends BaseCommand {
|
|
|
6
6
|
constructor();
|
|
7
7
|
static getInstance(): AddressCommands;
|
|
8
8
|
searchAddresses(query: string): Promise<IAddressAutocompleteResult[]>;
|
|
9
|
-
getAddressDetails(addressId: string): Promise<IAddressDetailsResult>;
|
|
9
|
+
getAddressDetails(addressId: string): Promise<IAddressDetailsResult | null>;
|
|
10
10
|
setSelectedAddress(addressData: IAddressData): Promise<void>;
|
|
11
11
|
setAddressManually(address: IAddressAddress, coordinates: IAddressCoordinates): Promise<void>;
|
|
12
12
|
clearSelectedAddress(): Promise<void>;
|
|
@@ -8,6 +8,7 @@ export interface ICheckoutCompletedComponentParams {
|
|
|
8
8
|
giftRecipientEmail: string | null;
|
|
9
9
|
checkoutToken?: string;
|
|
10
10
|
cartId?: string;
|
|
11
|
+
isCompleted?: boolean;
|
|
11
12
|
}
|
|
12
13
|
export declare class CheckoutCompletedComponent extends BaseComponent<ICheckoutCompletedComponentParams, ICheckoutComponent> {
|
|
13
14
|
get hostClasses(): string[];
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { BaseComponent } from '@/core/base-component.service';
|
|
2
|
+
import { type NavigationSourceType } from '@/enums';
|
|
2
3
|
import type { IProductComponent } from '@/interfaces/configs';
|
|
3
4
|
export interface IProductRetailersPopupListComponentParams {
|
|
4
5
|
productId: string;
|
|
6
|
+
navigationSource: NavigationSourceType;
|
|
7
|
+
slug?: string;
|
|
5
8
|
}
|
|
6
9
|
export declare class ProductRetailersPopupListComponent extends BaseComponent<IProductRetailersPopupListComponentParams, IProductComponent> {
|
|
7
10
|
get hostClasses(): string[];
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
private get isProductListContext();
|
|
12
|
+
beforeSetupStoreWatchers(): void;
|
|
10
13
|
private onFulfillmentTabClick;
|
|
11
14
|
private onRetailerCardClick;
|
|
12
15
|
protected template(): HTMLElement[];
|
|
@@ -16,7 +16,7 @@ export declare class ProductCommands extends BaseCommand {
|
|
|
16
16
|
selectSize(productId: string, sizeId: string): Promise<void>;
|
|
17
17
|
selectFulfillment(productId: string, selectedFulfillmentId: string): Promise<void>;
|
|
18
18
|
updateQuantity(productId: string, delta: number): Promise<void>;
|
|
19
|
-
changeFulfillmentType(productId: string,
|
|
19
|
+
changeFulfillmentType(productId: string, newFulfillmentType: FulfillmentType): Promise<void>;
|
|
20
20
|
removeProduct(productId: string): Promise<void>;
|
|
21
21
|
openProductDrawer(productId: string, contentType: IProductDrawerContentConfig['type'], data?: Record<string, any>): Promise<void>;
|
|
22
22
|
closeProductDrawer(productId: string): Promise<void>;
|
|
@@ -24,6 +24,4 @@ export declare class ProductCommands extends BaseCommand {
|
|
|
24
24
|
addToCart(productId: string, params: AddItemParams): Promise<void>;
|
|
25
25
|
addPresaleToCart(productId: string, params: AddItemParams): Promise<void>;
|
|
26
26
|
productDataForEventFromStore(identifier: string): IBaseProductEventData;
|
|
27
|
-
private findFirstAvailableSize;
|
|
28
|
-
private loadProductStoreUpdate;
|
|
29
27
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export * from './product-badge';
|
|
2
2
|
export * from './product-button';
|
|
3
|
-
export * from './product-fulfillments';
|
|
4
3
|
export * from './product-price-and-personalization';
|
|
5
4
|
export * from './product-quantity-selector';
|
|
6
5
|
export * from './product-sizes-list';
|
|
7
|
-
export * from './product-title';
|