@liquidcommerce/elements-sdk 2.2.0-beta.4 → 2.2.0-beta.41
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 +1715 -569
- package/dist/index.esm.js +14589 -10538
- package/dist/types/constants/core.constant.d.ts +32 -0
- package/dist/types/constants/index.d.ts +0 -1
- package/dist/types/{modules/api-client → core}/api-client.service.d.ts +4 -2
- package/dist/types/core/auth.service.d.ts +31 -4
- package/dist/types/core/base-component.service.d.ts +7 -3
- package/dist/types/core/circuit-breaker.service.d.ts +54 -0
- package/dist/types/core/client/client-action.service.d.ts +19 -14
- package/dist/types/core/client/client-config.service.d.ts +5 -3
- package/dist/types/core/command/base-command.service.d.ts +5 -3
- package/dist/types/core/command/command.service.d.ts +2 -0
- package/dist/types/core/command/common-command.service.d.ts +2 -1
- package/dist/types/core/debug-panel/debug-panel.service.d.ts +43 -0
- package/dist/types/core/debug-panel/debug-panel.styles.d.ts +1 -0
- package/dist/types/core/fingerprint.service.d.ts +4 -9
- package/dist/types/core/google-tag-manager.service.d.ts +128 -2
- package/dist/types/core/logger/logger-factory.d.ts +3 -0
- package/dist/types/core/logger/logger.service.d.ts +8 -5
- package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +1 -0
- package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +46 -6
- package/dist/types/core/pubsub/interfaces/core.interface.d.ts +5 -3
- package/dist/types/core/pubsub/interfaces/product.interface.d.ts +43 -6
- package/dist/types/core/pubsub/pubsub.service.d.ts +3 -2
- package/dist/types/core/sdk-error-handler.d.ts +1 -0
- package/dist/types/core/singleton-manager.service.d.ts +3 -3
- package/dist/types/core/store/interfaces/cart.interface.d.ts +1 -1
- package/dist/types/core/store/interfaces/checkout.interface.d.ts +0 -1
- package/dist/types/core/store/interfaces/core.interface.d.ts +5 -3
- package/dist/types/core/store/interfaces/product.interface.d.ts +18 -7
- package/dist/types/core/store/store.constant.d.ts +5 -1
- package/dist/types/core/store/store.service.d.ts +4 -2
- package/dist/types/core/telemetry/telemetry.interface.d.ts +80 -0
- package/dist/types/core/telemetry/telemetry.service.d.ts +27 -0
- package/dist/types/core/utils.d.ts +0 -4
- package/dist/types/elements-base-client.d.ts +49 -0
- package/dist/types/elements-builder-client.d.ts +2 -0
- package/dist/types/elements-client-helper.d.ts +3 -0
- package/dist/types/enums/core.enum.d.ts +9 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.umd.d.ts +2 -2
- package/dist/types/interfaces/cloud/catalog.interface.d.ts +43 -0
- package/dist/types/interfaces/cloud/index.d.ts +1 -0
- package/dist/types/interfaces/cloud/product.interface.d.ts +2 -0
- package/dist/types/interfaces/configs/checkout.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/product.interface.d.ts +2 -0
- package/dist/types/interfaces/core.interface.d.ts +47 -19
- package/dist/types/modules/address/address.command.d.ts +1 -3
- package/dist/types/modules/cart/cart.commands.d.ts +2 -3
- package/dist/types/modules/cart/cart.commands.helper.d.ts +3 -2
- package/dist/types/modules/cart/cart.component.d.ts +1 -2
- package/dist/types/modules/cart/components/cart-footer.component.d.ts +1 -0
- package/dist/types/modules/cart/components/cart-item.component.d.ts +2 -6
- package/dist/types/modules/cart/components/index.d.ts +2 -0
- package/dist/types/modules/checkout/checkout.commands.d.ts +4 -4
- package/dist/types/modules/checkout/checkout.commands.helper.d.ts +1 -1
- package/dist/types/modules/checkout/checkout.component.d.ts +1 -2
- package/dist/types/modules/checkout/components/checkout-summary-section.component.d.ts +2 -0
- package/dist/types/modules/checkout/components/information/checkout-delivery-information-form.component.d.ts +1 -1
- package/dist/types/modules/checkout/components/summary/checkout-item-quantity.component.d.ts +0 -2
- package/dist/types/modules/checkout/components/summary/checkout-item.component.d.ts +2 -1
- package/dist/types/modules/checkout/components/summary/checkout-items.component.d.ts +1 -0
- package/dist/types/modules/checkout/components/summary/checkout-place-order-button.component.d.ts +0 -1
- package/dist/types/modules/checkout/constant.d.ts +0 -1
- package/dist/types/modules/product/components/components.d.ts +1 -1
- package/dist/types/modules/product/components/index.d.ts +1 -0
- package/dist/types/modules/product/components/product-add-to-cart-section.component.d.ts +1 -0
- package/dist/types/modules/product/components/product-interactions.component.d.ts +4 -1
- package/dist/types/modules/product/components/product-price.component.d.ts +1 -0
- package/dist/types/modules/product/components/product-retailers.component.d.ts +1 -0
- package/dist/types/modules/product/product.commands.d.ts +3 -4
- package/dist/types/modules/product/utils/helpers.d.ts +1 -1
- package/dist/types/modules/product/utils/retailer-hours.d.ts +1 -1
- package/dist/types/modules/product-list/components/index.d.ts +2 -0
- package/dist/types/modules/product-list/components/product-list-card.component.d.ts +36 -0
- package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +21 -0
- package/dist/types/modules/product-list/product-list.commands.d.ts +12 -0
- package/dist/types/modules/product-list/product-list.component.d.ts +76 -0
- package/dist/types/modules/theme-provider/constants/component-groupings.d.ts +0 -2
- package/dist/types/modules/theme-provider/services/font-manager.service.d.ts +1 -0
- package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +1 -0
- package/dist/types/modules/theme-provider/styles/product-list/product-list.style.d.ts +1 -0
- package/dist/types/modules/ui-components/alert/alert.component.d.ts +1 -1
- package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +13 -11
- package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +4 -9
- package/dist/types/modules/ui-components/lce-element/lce-element.component.d.ts +2 -0
- package/dist/types/modules/ui-components/purchase-min-alert/helpers.d.ts +1 -1
- package/dist/types/modules/ui-components/ui.commands.d.ts +1 -1
- package/dist/types/static/icon/index.d.ts +0 -1
- package/dist/types/utils/format.d.ts +2 -1
- package/docs/ACTIONS.md +1300 -0
- package/docs/BROWSER_SUPPORT.md +279 -0
- package/docs/CONFIGURATION.md +740 -0
- package/docs/DOCUMENTATION_INDEX.md +311 -0
- package/docs/EVENTS.md +765 -0
- package/docs/PROXY.md +228 -0
- package/docs/THEMING.md +592 -0
- package/docs/TROUBLESHOOTING.md +793 -0
- package/package.json +20 -17
- package/umd/elements.js +1 -1
- package/dist/types/constants/z-index.constant.d.ts +0 -24
- package/dist/types/core/pubsub/index.d.ts +0 -2
- package/dist/types/core/pubsub/interfaces/index.d.ts +0 -5
- package/dist/types/core/store/index.d.ts +0 -2
- package/dist/types/core/store/interfaces/index.d.ts +0 -5
- package/dist/types/modules/address/index.d.ts +0 -4
- package/dist/types/modules/api-client/api-client.interface.d.ts +0 -21
- package/dist/types/modules/api-client/index.d.ts +0 -2
- package/dist/types/modules/cart/index.d.ts +0 -1
- package/dist/types/modules/checkout/index.d.ts +0 -1
- package/dist/types/modules/product/constant.d.ts +0 -2
- package/dist/types/modules/product/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/index.d.ts +0 -2
- package/dist/types/static/icon/completed.icon.d.ts +0 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ICheckoutTotalAmounts } from '@/interfaces/cloud';
|
|
1
|
+
import type { ICartItemAttributes, ICheckoutTotalAmounts } from '@/interfaces/cloud';
|
|
3
2
|
export interface IBaseCheckoutEventData {
|
|
4
3
|
cartId: string;
|
|
5
4
|
}
|
|
@@ -67,18 +66,59 @@ export interface ICheckoutGiftCardFailedEventData {
|
|
|
67
66
|
export interface ICheckoutProductAddEventData {
|
|
68
67
|
itemsAdded: number;
|
|
69
68
|
identifiers: string[];
|
|
69
|
+
isPresale?: boolean;
|
|
70
70
|
}
|
|
71
71
|
export interface ICheckoutProductAddFailedEventData {
|
|
72
72
|
identifiers: string[];
|
|
73
73
|
error: string;
|
|
74
|
+
isPresale?: boolean;
|
|
74
75
|
}
|
|
75
|
-
export interface
|
|
76
|
+
export interface ICheckoutItemEventData {
|
|
77
|
+
liquidId: string;
|
|
78
|
+
variantId: string;
|
|
79
|
+
cartItemId: string;
|
|
80
|
+
retailerId: string;
|
|
81
|
+
fulfillmentId: string;
|
|
82
|
+
salsifyGrouping: string;
|
|
83
|
+
name: string;
|
|
84
|
+
catPath: string;
|
|
85
|
+
volume: string;
|
|
86
|
+
uom: string;
|
|
87
|
+
proof: string;
|
|
88
|
+
abv: string;
|
|
89
|
+
containerType: string;
|
|
90
|
+
container: string;
|
|
91
|
+
size: string;
|
|
92
|
+
pack: boolean;
|
|
93
|
+
packDesc: string;
|
|
94
|
+
mainImage: string;
|
|
95
|
+
brand: string;
|
|
96
|
+
partNumber: string;
|
|
97
|
+
upc: string;
|
|
98
|
+
sku: string;
|
|
99
|
+
price: number;
|
|
100
|
+
unitPrice: number;
|
|
101
|
+
quantity: number;
|
|
102
|
+
unitTax: number;
|
|
103
|
+
bottleDeposits: number;
|
|
104
|
+
attributes: ICartItemAttributes;
|
|
105
|
+
retailerName: string;
|
|
106
|
+
expectationDetail: string;
|
|
107
|
+
}
|
|
108
|
+
export interface ICheckoutDetailsEventData {
|
|
76
109
|
cartId: string;
|
|
77
|
-
|
|
78
|
-
items: Record<string, Omit<ICheckoutItemStore, 'attributes'>>;
|
|
79
|
-
isGift: boolean;
|
|
110
|
+
acceptedAccountCreation: boolean;
|
|
80
111
|
hasAgeVerify: boolean;
|
|
112
|
+
hasSubstitutionPolicy: boolean;
|
|
113
|
+
isGift: boolean;
|
|
114
|
+
billingSameAsShipping: boolean;
|
|
115
|
+
marketingPreferences: {
|
|
116
|
+
canEmail: boolean;
|
|
117
|
+
canSms: boolean;
|
|
118
|
+
};
|
|
81
119
|
hasPromoCode: boolean;
|
|
82
120
|
hasGiftCards: boolean;
|
|
121
|
+
amounts: ICheckoutTotalAmounts;
|
|
83
122
|
itemCount: number;
|
|
123
|
+
items: Record<string, ICheckoutItemEventData>;
|
|
84
124
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type { IAddressActionEventData
|
|
1
|
+
import type { IAddressActionEventData } from '@/core/pubsub/interfaces/address.interface';
|
|
2
|
+
import type { ICartFailedEventData, ICartItemAddedEventData, ICartItemEngravingUpdatedEventData, ICartItemQuantityChangedEventData, ICartItemRemovedEventData, ICartLoadedEventData, ICartProductAddEventData, ICartProductAddFailedEventData, ICartPromoCodeEventData, ICartPromoCodeFailedEventData, ICartUpdatedEventData } from '@/core/pubsub/interfaces/cart.interface';
|
|
3
|
+
import type { ICheckoutFailedEventData, ICheckoutFormUpdatedEventData, ICheckoutGiftCardEventData, ICheckoutGiftCardFailedEventData, ICheckoutItemEngravingUpdatedEventData, ICheckoutItemQuantityChangedEventData, ICheckoutItemRemovedEventData, ICheckoutLoadedEventData, ICheckoutMarketingPreferencesToggleEventData, ICheckoutProductAddEventData, ICheckoutProductAddFailedEventData, ICheckoutPromoCodeEventData, ICheckoutPromoCodeFailedEventData, ICheckoutSubmitCompletedEventData, ICheckoutSubmitFailedEventData, ICheckoutSubmitStartedEventData, ICheckoutTipUpdatedEventData, ICheckoutToggleEventData } from '@/core/pubsub/interfaces/checkout.interface';
|
|
4
|
+
import type { IElementsClientIsReadyEventData, IProductAddToCartEventData, IProductFulfillmentChangedEventData, IProductFulfillmentTypeChangedEventData, IProductLoadedEventData, IProductQuantityChangedEventData, IProductSizeChangedEventData } from '@/core/pubsub/interfaces/product.interface';
|
|
2
5
|
import { ELEMENTS_ACTIONS_EVENT } from '@/enums';
|
|
3
6
|
export interface IEventMetadata {
|
|
4
7
|
eventId: string;
|
|
@@ -21,7 +24,6 @@ export interface IElementsActionsEventsMap {
|
|
|
21
24
|
[ELEMENTS_ACTIONS_EVENT.PRODUCT_SIZE_CHANGED]: IProductSizeChangedEventData;
|
|
22
25
|
[ELEMENTS_ACTIONS_EVENT.PRODUCT_FULFILLMENT_TYPE_CHANGED]: IProductFulfillmentTypeChangedEventData;
|
|
23
26
|
[ELEMENTS_ACTIONS_EVENT.PRODUCT_FULFILLMENT_CHANGED]: IProductFulfillmentChangedEventData;
|
|
24
|
-
[ELEMENTS_ACTIONS_EVENT.PRODUCT_ENGRAVING_UPDATED]: IProductEngravingUpdatedEventData;
|
|
25
27
|
[ELEMENTS_ACTIONS_EVENT.CART_CLOSED]: boolean;
|
|
26
28
|
[ELEMENTS_ACTIONS_EVENT.CART_OPENED]: boolean;
|
|
27
29
|
[ELEMENTS_ACTIONS_EVENT.CART_UPDATED]: ICartUpdatedEventData;
|
|
@@ -71,7 +73,7 @@ export interface IElementsActionsEventsMap {
|
|
|
71
73
|
export type SpecificActionEvent = keyof IElementsActionsEventsMap;
|
|
72
74
|
export interface IFormEventData {
|
|
73
75
|
fieldName: string;
|
|
74
|
-
fieldValue
|
|
76
|
+
fieldValue?: string;
|
|
75
77
|
}
|
|
76
78
|
export interface IElementsFormsEventsMap {
|
|
77
79
|
customer: IFormEventData;
|
|
@@ -9,6 +9,8 @@ export interface IElementsClientIsReadyEventData {
|
|
|
9
9
|
export interface IBaseProductFulfillmentEventData {
|
|
10
10
|
price: number;
|
|
11
11
|
partNumber: string;
|
|
12
|
+
stock: number;
|
|
13
|
+
isEngravable: boolean;
|
|
12
14
|
fulfillmentId: string;
|
|
13
15
|
fulfillmentType: FulfillmentType;
|
|
14
16
|
modalities: FulfillmentType[];
|
|
@@ -17,6 +19,23 @@ export interface IBaseProductFulfillmentEventData {
|
|
|
17
19
|
retailerAddress: (IAddress & ICoords) | null;
|
|
18
20
|
retailerTimezone: string;
|
|
19
21
|
}
|
|
22
|
+
export interface IBaseProductSizeAttributesEventData {
|
|
23
|
+
engraving?: {
|
|
24
|
+
status: boolean;
|
|
25
|
+
maxLines: number;
|
|
26
|
+
maxCharsPerLine: number;
|
|
27
|
+
fee: number;
|
|
28
|
+
location: string;
|
|
29
|
+
};
|
|
30
|
+
presale?: {
|
|
31
|
+
canPurchaseOn: null | string;
|
|
32
|
+
estimatedShipBy: null | string;
|
|
33
|
+
isActive: boolean;
|
|
34
|
+
language: string;
|
|
35
|
+
presaleLimit: number;
|
|
36
|
+
price: number;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
20
39
|
export interface IBaseProductSizeEventData {
|
|
21
40
|
id: string;
|
|
22
41
|
upc: string;
|
|
@@ -29,17 +48,40 @@ export interface IBaseProductSizeEventData {
|
|
|
29
48
|
image: string;
|
|
30
49
|
uom: string;
|
|
31
50
|
volume: string;
|
|
51
|
+
attributes: IBaseProductSizeAttributesEventData;
|
|
32
52
|
shippingFulfillments: Record<string, IBaseProductFulfillmentEventData>;
|
|
33
53
|
onDemandFulfillments: Record<string, IBaseProductFulfillmentEventData>;
|
|
34
54
|
}
|
|
35
55
|
export interface IBaseProductEventData {
|
|
36
56
|
identifier: string;
|
|
57
|
+
selectedSizeId: string | null;
|
|
58
|
+
selectedFulfillmentId: string | null;
|
|
59
|
+
selectedFulfillmentType: FulfillmentType;
|
|
37
60
|
id: string;
|
|
38
61
|
name: string;
|
|
39
62
|
brand: string;
|
|
40
|
-
category: string;
|
|
41
63
|
catPath: string;
|
|
64
|
+
category: string;
|
|
42
65
|
classification: string;
|
|
66
|
+
type: string;
|
|
67
|
+
salsifyGrouping: string;
|
|
68
|
+
subType: string;
|
|
69
|
+
mainImage: string | null;
|
|
70
|
+
images: string[];
|
|
71
|
+
region: string;
|
|
72
|
+
country: string;
|
|
73
|
+
material: string;
|
|
74
|
+
abv: string;
|
|
75
|
+
proof: string;
|
|
76
|
+
age: string;
|
|
77
|
+
color: string;
|
|
78
|
+
flavor: string;
|
|
79
|
+
variety: string;
|
|
80
|
+
appellation: string;
|
|
81
|
+
vintage: string;
|
|
82
|
+
description: string;
|
|
83
|
+
htmlDescription: string;
|
|
84
|
+
tastingNotes: string;
|
|
43
85
|
priceInfo: {
|
|
44
86
|
min: number;
|
|
45
87
|
max: number;
|
|
@@ -84,8 +126,3 @@ export interface IProductFulfillmentChangedEventData {
|
|
|
84
126
|
previousFulfillmentId: string;
|
|
85
127
|
previousFulfillmentType: FulfillmentType;
|
|
86
128
|
}
|
|
87
|
-
export interface IProductEngravingUpdatedEventData {
|
|
88
|
-
identifier: string;
|
|
89
|
-
engravingLines: string[];
|
|
90
|
-
previousEngravingLines: string[];
|
|
91
|
-
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { IElementsActionsEventsMap, IElementsFormsEventsMap, SpecificActionEvent, SpecificFormEvent } from '@/core/pubsub/interfaces';
|
|
1
|
+
import type { IElementsActionsEventsMap, IElementsFormsEventsMap, SpecificActionEvent, SpecificFormEvent } from '@/core/pubsub/interfaces/core.interface';
|
|
2
2
|
export declare class PubSubService {
|
|
3
3
|
private readonly logger;
|
|
4
|
+
private clientReadyEvent;
|
|
4
5
|
constructor();
|
|
5
6
|
private readonly eventPrefix;
|
|
6
7
|
static getInstance(): PubSubService;
|
|
@@ -8,5 +9,5 @@ export declare class PubSubService {
|
|
|
8
9
|
publishForm<K extends SpecificFormEvent>(eventType: K, data: IElementsFormsEventsMap[K]): void;
|
|
9
10
|
private publishSpecific;
|
|
10
11
|
private dispatchNativeEvents;
|
|
11
|
-
private
|
|
12
|
+
private setupClientReadyBuffering;
|
|
12
13
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isSDKError(error: Error | any, source?: string | null): boolean;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { IClientConfigs } from '@/core/client/client-config.service';
|
|
2
|
-
import type { LiquidCommerceElementsClientConstructor } from '@/interfaces/core.interface';
|
|
2
|
+
import type { LiquidCommerceElementsBuilderClientConstructor, LiquidCommerceElementsClientConstructor } from '@/interfaces/core.interface';
|
|
3
3
|
export declare class SingletonManager {
|
|
4
4
|
private static instances;
|
|
5
5
|
private static clientConstructor;
|
|
6
6
|
private static getInstances;
|
|
7
7
|
private constructor();
|
|
8
|
-
static setClientConstructor(lceConstructor: LiquidCommerceElementsClientConstructor): void;
|
|
9
|
-
static getClientConstructor(): LiquidCommerceElementsClientConstructor | null;
|
|
8
|
+
static setClientConstructor(lceConstructor: LiquidCommerceElementsClientConstructor | LiquidCommerceElementsBuilderClientConstructor): void;
|
|
9
|
+
static getClientConstructor(): LiquidCommerceElementsClientConstructor | LiquidCommerceElementsBuilderClientConstructor | null;
|
|
10
10
|
static getClassInstance<T>(className: string, instanceCreator: () => T): T;
|
|
11
11
|
static getClient<T>(clientConfigs: IClientConfigs): Promise<T>;
|
|
12
12
|
}
|
|
@@ -36,6 +36,7 @@ export interface ICartTotalsStore {
|
|
|
36
36
|
total: number;
|
|
37
37
|
shippingFee: number;
|
|
38
38
|
platformFee: number;
|
|
39
|
+
giftCardTotal: number;
|
|
39
40
|
engravingFee: number;
|
|
40
41
|
deliveryFee: number;
|
|
41
42
|
discounts: number;
|
|
@@ -75,7 +76,6 @@ export interface IRetailerStore {
|
|
|
75
76
|
export interface ICartPromoCodeStore {
|
|
76
77
|
code: string;
|
|
77
78
|
discountAmount: number;
|
|
78
|
-
error: string | null;
|
|
79
79
|
}
|
|
80
80
|
export interface ICartStore {
|
|
81
81
|
id: string | null;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { IAddressStore
|
|
1
|
+
import type { IAddressStore } from '@/core/store/interfaces/address.interface';
|
|
2
|
+
import type { ICheckoutBillingStore, ICheckoutCustomerStore, ICheckoutGiftRecipientStore, ICheckoutItemStore, ICheckoutMarketingPreferencesStore, ICheckoutPaymentStore, ICheckoutPromoCodeStore, ICheckoutReadyForSubmitStore, ICheckoutStore, ICheckoutStripeFormStatusStore } from '@/core/store/interfaces/checkout.interface';
|
|
3
|
+
import type { IProductSizeStore, IProductStore } from '@/core/store/interfaces/product.interface';
|
|
2
4
|
import type { ComponentType } from '@/enums';
|
|
3
|
-
import type { ICartItemStore, ICartStore, ICartTotalsStore, IRetailerFulfillmentStore, IRetailerStore } from './cart.interface';
|
|
5
|
+
import type { ICartItemStore, ICartPromoCodeStore, ICartStore, ICartTotalsStore, IRetailerFulfillmentStore, IRetailerStore } from './cart.interface';
|
|
4
6
|
export interface IDrawerContentConfig {
|
|
5
7
|
type: ComponentType;
|
|
6
8
|
data?: Record<string, any>;
|
|
@@ -23,7 +25,7 @@ export interface IPersistedStore {
|
|
|
23
25
|
p: string;
|
|
24
26
|
c: string;
|
|
25
27
|
}
|
|
26
|
-
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.totals.${keyof ICartTotalsStore}` | `cart.retailers.${string}` | `cart.items.${string}.${keyof IRetailerStore}` | `cart.fulfillments.${string}` | `cart.fulfillments.${string}.${keyof IRetailerFulfillmentStore}` | `cart.promoCode.${keyof
|
|
28
|
+
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.totals.${keyof ICartTotalsStore}` | `cart.retailers.${string}` | `cart.items.${string}.${keyof IRetailerStore}` | `cart.fulfillments.${string}` | `cart.fulfillments.${string}.${keyof IRetailerFulfillmentStore}` | `cart.promoCode.${keyof ICartPromoCodeStore}` | `ui.${keyof IUIStore}` | `ui.drawer.${keyof IDrawerStore}` | `checkout.${keyof ICheckoutStore}` | `checkout.customer.${keyof ICheckoutCustomerStore}` | `checkout.marketingPreferences.${keyof ICheckoutMarketingPreferencesStore}` | `checkout.payment.${keyof ICheckoutPaymentStore}` | `checkout.billing.${keyof ICheckoutBillingStore}` | `checkout.giftRecipient.${keyof ICheckoutGiftRecipientStore}` | `checkout.giftCards.${string}` | `checkout.promoCode.${keyof ICheckoutPromoCodeStore}` | `checkout.items.${string}` | `checkout.items.${string}.${keyof ICheckoutItemStore}` | `checkout.readyForSubmit.${keyof ICheckoutReadyForSubmitStore}` | `checkout.onDemandFulfillmentTipInfo.${string}` | `checkout.readyForSubmit.${string}` | `checkout.stripeFormStatus.${keyof ICheckoutStripeFormStatusStore}`;
|
|
27
29
|
interface MiddlewareContext {
|
|
28
30
|
action: string;
|
|
29
31
|
payload: any;
|
|
@@ -49,20 +49,33 @@ export interface IProductStore {
|
|
|
49
49
|
id: string;
|
|
50
50
|
name: string;
|
|
51
51
|
brand: string;
|
|
52
|
-
category: string;
|
|
53
52
|
catPath: string;
|
|
53
|
+
category: string;
|
|
54
54
|
classification: string;
|
|
55
55
|
type: string;
|
|
56
|
-
subType: string;
|
|
57
56
|
salsifyGrouping: string;
|
|
57
|
+
subType: string;
|
|
58
|
+
mainImage: string | null;
|
|
59
|
+
images: string[];
|
|
60
|
+
region: string;
|
|
61
|
+
country: string;
|
|
62
|
+
material: string;
|
|
63
|
+
abv: string;
|
|
64
|
+
proof: string;
|
|
65
|
+
age: string;
|
|
66
|
+
color: string;
|
|
67
|
+
flavor: string;
|
|
68
|
+
variety: string;
|
|
69
|
+
appellation: string;
|
|
70
|
+
vintage: string;
|
|
71
|
+
description: string;
|
|
72
|
+
htmlDescription: string;
|
|
73
|
+
tastingNotes: string;
|
|
58
74
|
priceInfo?: {
|
|
59
75
|
min: number;
|
|
60
76
|
max: number;
|
|
61
77
|
avg: number;
|
|
62
78
|
};
|
|
63
|
-
description: string;
|
|
64
|
-
htmlDescription: string;
|
|
65
|
-
images: string[];
|
|
66
79
|
quantity: number;
|
|
67
80
|
sizes: Record<string, IProductSizeStore>;
|
|
68
81
|
productHasAvailability: boolean;
|
|
@@ -74,8 +87,6 @@ export interface IProductStore {
|
|
|
74
87
|
loading: boolean;
|
|
75
88
|
updating: boolean;
|
|
76
89
|
error: string | null;
|
|
77
|
-
engravingLines: string[];
|
|
78
90
|
drawer: IProductDrawerStore;
|
|
79
91
|
rerender: boolean;
|
|
80
|
-
mainImage: string | null;
|
|
81
92
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type { IAddressStore
|
|
1
|
+
import type { IAddressStore } from '@/core/store/interfaces/address.interface';
|
|
2
|
+
import type { ICartStore } from '@/core/store/interfaces/cart.interface';
|
|
3
|
+
import type { ICheckoutStore } from '@/core/store/interfaces/checkout.interface';
|
|
4
|
+
import type { IGlobalStore, IUIStore } from '@/core/store/interfaces/core.interface';
|
|
5
|
+
import type { IProductStore } from '@/core/store/interfaces/product.interface';
|
|
2
6
|
export declare const LOCAL_STORAGE_PREFIX = "liquid_elements";
|
|
3
7
|
export declare const initialProductState: IProductStore;
|
|
4
8
|
export declare const initialCartState: ICartStore;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IOnStoreChanged } from '@/core/base-component.service';
|
|
2
|
-
import type { IGlobalStore, IPersistedStore,
|
|
2
|
+
import type { IGlobalStore, IPersistedStore, StorePaths } from '@/core/store/interfaces/core.interface';
|
|
3
|
+
import type { IProductStore } from '@/core/store/interfaces/product.interface';
|
|
3
4
|
export declare class StoreService {
|
|
4
5
|
private state;
|
|
5
6
|
private listeners;
|
|
@@ -36,9 +37,10 @@ export declare class StoreService {
|
|
|
36
37
|
private notifyListeners;
|
|
37
38
|
private debouncedSave;
|
|
38
39
|
forceSave(): void;
|
|
40
|
+
persist(): Promise<void>;
|
|
41
|
+
clearLocalStorage(): void;
|
|
39
42
|
private saveStore;
|
|
40
43
|
private loadPersistedState;
|
|
41
44
|
private loadFromDBPersistence;
|
|
42
|
-
private addBeforeUnloadHandler;
|
|
43
45
|
private getAddressDataFromId;
|
|
44
46
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { DeviceType } from '@/core/client/client-config.service';
|
|
2
|
+
import type { ComponentType, ElementsEnv } from '@/enums';
|
|
3
|
+
export type TelemetryLevel = 'debug' | 'log' | 'info' | 'warn' | 'error' | 'fatal';
|
|
4
|
+
export interface ITelemetryConfig {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
endpoint: string;
|
|
7
|
+
batchSize: number;
|
|
8
|
+
batchInterval: number;
|
|
9
|
+
includeDebugLogs: boolean;
|
|
10
|
+
includeWarnings: boolean;
|
|
11
|
+
includeErrors: boolean;
|
|
12
|
+
maxQueueSize: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ITelemetryEventOptions {
|
|
15
|
+
context?: string;
|
|
16
|
+
error?: Error;
|
|
17
|
+
component?: ITelemetryComponentContext;
|
|
18
|
+
data?: Record<string, any>;
|
|
19
|
+
}
|
|
20
|
+
export interface ITelemetryEvent {
|
|
21
|
+
eventId: string;
|
|
22
|
+
timestamp: number;
|
|
23
|
+
level: TelemetryLevel;
|
|
24
|
+
message: string;
|
|
25
|
+
context?: string;
|
|
26
|
+
error?: ITelemetryError;
|
|
27
|
+
component?: ITelemetryComponentContext;
|
|
28
|
+
data?: Record<string, any>;
|
|
29
|
+
metadata: {
|
|
30
|
+
sdk: ITelemetrySDKContext;
|
|
31
|
+
user: ITelemetryUserContext;
|
|
32
|
+
browser: ITelemetryBrowserContext;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface ITelemetryError {
|
|
36
|
+
name: string;
|
|
37
|
+
message: string;
|
|
38
|
+
stack?: string;
|
|
39
|
+
code?: string | number;
|
|
40
|
+
statusCode?: number;
|
|
41
|
+
}
|
|
42
|
+
export interface ITelemetrySDKContext {
|
|
43
|
+
version: string;
|
|
44
|
+
env: ElementsEnv;
|
|
45
|
+
isBuilder: boolean;
|
|
46
|
+
partnerCode?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ITelemetryComponentContext {
|
|
49
|
+
type: ComponentType;
|
|
50
|
+
tagName: string;
|
|
51
|
+
renderCount?: number;
|
|
52
|
+
renderTrigger?: string;
|
|
53
|
+
renderDuration?: number;
|
|
54
|
+
useShadowDom?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface ITelemetryUserContext {
|
|
57
|
+
deviceId: string;
|
|
58
|
+
sessionId?: string;
|
|
59
|
+
isLocalStorageAvailable: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface ITelemetryBrowserContext {
|
|
62
|
+
userAgent: string;
|
|
63
|
+
deviceType: DeviceType;
|
|
64
|
+
url: string;
|
|
65
|
+
referrer?: string;
|
|
66
|
+
timezone?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface ITelemetryBatchPayload {
|
|
69
|
+
batchId: string;
|
|
70
|
+
timestamp: number;
|
|
71
|
+
events: ITelemetryEvent[];
|
|
72
|
+
}
|
|
73
|
+
export interface ITelemetryStats {
|
|
74
|
+
totalEvents: number;
|
|
75
|
+
eventsByLevel: Record<TelemetryLevel, number>;
|
|
76
|
+
batchesSent: number;
|
|
77
|
+
failedBatches: number;
|
|
78
|
+
queuedEvents: number;
|
|
79
|
+
droppedEvents: number;
|
|
80
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ITelemetryEventOptions, TelemetryLevel } from './telemetry.interface';
|
|
2
|
+
export declare class TelemetryService {
|
|
3
|
+
private config;
|
|
4
|
+
private eventQueue;
|
|
5
|
+
private batchTimer;
|
|
6
|
+
private readonly clientConfig;
|
|
7
|
+
private stats;
|
|
8
|
+
private isShuttingDown;
|
|
9
|
+
constructor();
|
|
10
|
+
static getInstance(): TelemetryService;
|
|
11
|
+
isEnabled(): boolean;
|
|
12
|
+
captureEvent(level: TelemetryLevel, message: string, options?: ITelemetryEventOptions): void;
|
|
13
|
+
private buildErrorContext;
|
|
14
|
+
private buildSDKContext;
|
|
15
|
+
private buildUserContext;
|
|
16
|
+
private buildBrowserContext;
|
|
17
|
+
private shouldCapture;
|
|
18
|
+
private addToQueue;
|
|
19
|
+
private startBatchTimer;
|
|
20
|
+
private flushQueue;
|
|
21
|
+
private createBatch;
|
|
22
|
+
private sendBatch;
|
|
23
|
+
private sendBatchViaXHR;
|
|
24
|
+
private truncateStackTrace;
|
|
25
|
+
private handleInternalError;
|
|
26
|
+
private shutdown;
|
|
27
|
+
}
|
|
@@ -21,7 +21,3 @@ export interface ICustomResponse {
|
|
|
21
21
|
export declare function fetchAdapter(fetchFunc: FetchFunction): HttpClient;
|
|
22
22
|
export declare const xhrFetch: HttpClient;
|
|
23
23
|
export declare function getFetchImplementation(): HttpClient;
|
|
24
|
-
export declare function objectValues<T>(obj: Record<string, T>): T[];
|
|
25
|
-
export declare function objectEntries<T>(obj: Record<string, T>): Array<[string, T]>;
|
|
26
|
-
export declare function arrayFind<T>(array: T[], predicate: (item: T, index: number, array: T[]) => boolean): T | undefined;
|
|
27
|
-
export declare function arrayFindIndex<T>(array: T[], predicate: (item: T, index: number, array: T[]) => boolean): number;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ApiClientService } from '@/core/api-client.service';
|
|
2
|
+
import { AuthService } from '@/core/auth.service';
|
|
3
|
+
import { ClientActionService } from '@/core/client/client-action.service';
|
|
4
|
+
import { ClientConfigService, type IClientConfigs } from '@/core/client/client-config.service';
|
|
5
|
+
import { CommandService } from '@/core/command/command.service';
|
|
6
|
+
import { DebugPanelService } from '@/core/debug-panel/debug-panel.service';
|
|
7
|
+
import { FingerPrintService } from '@/core/fingerprint.service';
|
|
8
|
+
import { GoogleTagManagerService } from '@/core/google-tag-manager.service';
|
|
9
|
+
import { LoggerFactory } from '@/core/logger/logger-factory';
|
|
10
|
+
import { StoreService } from '@/core/store/store.service';
|
|
11
|
+
import { TelemetryService } from '@/core/telemetry/telemetry.service';
|
|
12
|
+
import { type ComponentType } from '@/enums';
|
|
13
|
+
import type { IInjectedComponent, ILiquidCommerceElementsActions, IProcessInjectElementParams } from '@/interfaces/core.interface';
|
|
14
|
+
import { ThemeProviderService } from '@/modules/theme-provider/theme-provider.service';
|
|
15
|
+
export declare abstract class ElementsBaseClient {
|
|
16
|
+
protected readonly authService: AuthService;
|
|
17
|
+
protected readonly clientConfig: ClientConfigService;
|
|
18
|
+
protected readonly store: StoreService;
|
|
19
|
+
protected readonly commands: CommandService;
|
|
20
|
+
protected readonly apiClient: ApiClientService;
|
|
21
|
+
protected readonly themeProvider: ThemeProviderService;
|
|
22
|
+
protected readonly fingerPrintService: FingerPrintService;
|
|
23
|
+
protected readonly googleTagManager: GoogleTagManagerService;
|
|
24
|
+
protected readonly clientAction: ClientActionService;
|
|
25
|
+
protected readonly telemetry: TelemetryService;
|
|
26
|
+
protected readonly debugPanel: DebugPanelService;
|
|
27
|
+
protected readonly logger: ReturnType<typeof LoggerFactory.get>;
|
|
28
|
+
protected clientPrepared: boolean;
|
|
29
|
+
protected componentFactoryInitialized: boolean;
|
|
30
|
+
protected cartDrawerCreated: boolean;
|
|
31
|
+
protected gtmInitialized: boolean;
|
|
32
|
+
protected injectedComponents: Map<string, IInjectedComponent>;
|
|
33
|
+
constructor(clientConfigs: IClientConfigs);
|
|
34
|
+
prepare(): Promise<void>;
|
|
35
|
+
private prepareEssentialServices;
|
|
36
|
+
private deferHeavyInitialization;
|
|
37
|
+
private initializeHeavyServices;
|
|
38
|
+
get actions(): ILiquidCommerceElementsActions;
|
|
39
|
+
protected processInjectElement(params: IProcessInjectElementParams): Promise<IInjectedComponent | null>;
|
|
40
|
+
protected ensureCartDrawerExists(): void;
|
|
41
|
+
protected ensureAllComponentsRegistered(): void;
|
|
42
|
+
protected createInjectedComponentWrapper(containerId: string, type: ComponentType, element: HTMLElement): IInjectedComponent;
|
|
43
|
+
protected rerenderInjectedComponentsByType(type: ComponentType): void;
|
|
44
|
+
protected isElementsEnabled(): boolean;
|
|
45
|
+
protected injectDisabledElementsError(containerId: string, componentName: ComponentType): void;
|
|
46
|
+
private registerEssentialComponents;
|
|
47
|
+
protected registerComponents(): void;
|
|
48
|
+
protected registerAllComponents(): void;
|
|
49
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { ILiquidCommerceElementsBuilderClient, ILiquidCommerceElementsBuilderConfig } from '@/interfaces/core.interface';
|
|
2
|
+
export declare function ElementsBuilder(apiKey: string, config: ILiquidCommerceElementsBuilderConfig): Promise<ILiquidCommerceElementsBuilderClient | null>;
|
|
@@ -1 +1,4 @@
|
|
|
1
|
+
import { type ComponentType } from '@/enums';
|
|
1
2
|
export declare function deepMergeConfigs<T extends Record<string, any>>(target: T, source: Partial<T>): T;
|
|
3
|
+
export declare const layoutFieldToComponentTypes: Map<string, ComponentType[]>;
|
|
4
|
+
export declare function getComponentTypesForLayoutFields(parentPath: string, layoutFields: Record<string, any>): ComponentType[];
|
|
@@ -14,7 +14,6 @@ export declare const ELEMENTS_ACTIONS_EVENT: {
|
|
|
14
14
|
readonly PRODUCT_SIZE_CHANGED: "product_size_changed";
|
|
15
15
|
readonly PRODUCT_FULFILLMENT_TYPE_CHANGED: "product_fulfillment_type_changed";
|
|
16
16
|
readonly PRODUCT_FULFILLMENT_CHANGED: "product_fulfillment_changed";
|
|
17
|
-
readonly PRODUCT_ENGRAVING_UPDATED: "product_engraving_updated";
|
|
18
17
|
readonly CART_LOADED: "cart_loaded";
|
|
19
18
|
readonly CART_CLOSED: "cart_closed";
|
|
20
19
|
readonly CART_OPENED: "cart_opened";
|
|
@@ -94,6 +93,9 @@ export declare const COMPONENT_TYPE: {
|
|
|
94
93
|
readonly PRODUCT_ADD_TO_CART_SECTION: "product-add-to-cart-section";
|
|
95
94
|
readonly PRODUCT_DRAWER: "product-drawer";
|
|
96
95
|
readonly PRODUCT_LOADING: "product-loading";
|
|
96
|
+
readonly PRODUCT_LIST: "product-list";
|
|
97
|
+
readonly PRODUCT_LIST_CARD: "product-list-card";
|
|
98
|
+
readonly PRODUCT_LIST_FILTERS: "product-list-filters";
|
|
97
99
|
readonly CART: "cart";
|
|
98
100
|
readonly CART_RETAILER: "cart-retailer";
|
|
99
101
|
readonly CART_ITEM: "cart-item";
|
|
@@ -132,3 +134,9 @@ export declare const FULFILLMENT_TYPE: {
|
|
|
132
134
|
readonly SHIPPING: "shipping";
|
|
133
135
|
};
|
|
134
136
|
export type FulfillmentType = (typeof FULFILLMENT_TYPE)[keyof typeof FULFILLMENT_TYPE];
|
|
137
|
+
export declare const DEBUG_MODE: {
|
|
138
|
+
readonly NONE: "none";
|
|
139
|
+
readonly CONSOLE: "console";
|
|
140
|
+
readonly PANEL: "panel";
|
|
141
|
+
};
|
|
142
|
+
export type DebugMode = (typeof DEBUG_MODE)[keyof typeof DEBUG_MODE];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Elements } from './index';
|
|
2
|
-
export { Elements };
|
|
1
|
+
import { Elements, ElementsBuilder } from './index';
|
|
2
|
+
export { Elements, ElementsBuilder };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { IProduct } from '@/interfaces/cloud/product.interface';
|
|
2
|
+
import type { ILocBase } from './address.interface';
|
|
3
|
+
import type { IRetailer } from './retailer.interface';
|
|
4
|
+
export declare enum ENUM_NAVIGATION_ORDER_DIRECTION_TYPE {
|
|
5
|
+
ASC = "asc",
|
|
6
|
+
DESC = "desc"
|
|
7
|
+
}
|
|
8
|
+
export declare enum ENUM_ORDER_BY {
|
|
9
|
+
PRICE = "price"
|
|
10
|
+
}
|
|
11
|
+
export interface ICatalogParams extends ILocBase {
|
|
12
|
+
search?: string;
|
|
13
|
+
pageToken?: string;
|
|
14
|
+
entity?: string;
|
|
15
|
+
page?: number;
|
|
16
|
+
perPage?: number;
|
|
17
|
+
visitorId?: string;
|
|
18
|
+
retailers?: string[];
|
|
19
|
+
orderBy?: ENUM_ORDER_BY;
|
|
20
|
+
orderDirection?: ENUM_NAVIGATION_ORDER_DIRECTION_TYPE;
|
|
21
|
+
filters?: Array<Record<any, any>>;
|
|
22
|
+
}
|
|
23
|
+
export interface ICatalog {
|
|
24
|
+
retailers?: IRetailer[];
|
|
25
|
+
products?: IProduct[];
|
|
26
|
+
navigation?: INavigationSchema;
|
|
27
|
+
}
|
|
28
|
+
export interface ICursorSchema {
|
|
29
|
+
nextPageToken: string;
|
|
30
|
+
previousPageToken: string;
|
|
31
|
+
}
|
|
32
|
+
export interface INavigationSchema {
|
|
33
|
+
id: string;
|
|
34
|
+
correctedQuery: string;
|
|
35
|
+
attributionToken: string;
|
|
36
|
+
currentPage: number;
|
|
37
|
+
totalPages: number;
|
|
38
|
+
totalCount: number;
|
|
39
|
+
availableOrderBy: ENUM_ORDER_BY[];
|
|
40
|
+
availableOrderDirection: ENUM_NAVIGATION_ORDER_DIRECTION_TYPE[];
|
|
41
|
+
cursor: ICursorSchema;
|
|
42
|
+
filters: any[];
|
|
43
|
+
}
|
|
@@ -18,6 +18,7 @@ export interface ICheckoutLayout {
|
|
|
18
18
|
drawerHeaderText: string;
|
|
19
19
|
placeOrderButtonText: string;
|
|
20
20
|
placeOrderButtonShowRequiredFields: boolean;
|
|
21
|
+
checkoutCompleted: ICheckoutCompleted;
|
|
21
22
|
}
|
|
22
23
|
export interface ICheckoutCompleted {
|
|
23
24
|
customLogo: string;
|
|
@@ -25,7 +26,6 @@ export interface ICheckoutCompleted {
|
|
|
25
26
|
}
|
|
26
27
|
export interface ICheckoutTheme {
|
|
27
28
|
backgroundColor: string;
|
|
28
|
-
checkoutCompleted: ICheckoutCompleted;
|
|
29
29
|
}
|
|
30
30
|
export interface ICheckoutComponent {
|
|
31
31
|
theme: ICheckoutTheme;
|
|
@@ -14,6 +14,8 @@ export interface IProductLayout {
|
|
|
14
14
|
addToCartButtonShowTotalPrice: boolean;
|
|
15
15
|
buyNowButtonText: string;
|
|
16
16
|
preSaleButtonText: string;
|
|
17
|
+
prioritizeEngraving: boolean;
|
|
18
|
+
noAvailabilityText: string;
|
|
17
19
|
}
|
|
18
20
|
export interface IProductTheme {
|
|
19
21
|
backgroundColor: string;
|