@liquidcommerce/elements-sdk 2.5.6-beta.2 → 2.5.6-beta.21
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 +99 -25
- package/dist/index.esm.js +13044 -11746
- package/dist/types/constants/core.constant.d.ts +0 -1
- package/dist/types/core/{api-client.service.d.ts → api/api-client.service.d.ts} +3 -3
- package/dist/types/core/{auth.service.d.ts → api/auth-client.service.d.ts} +2 -3
- package/dist/types/core/api/http-client.service.d.ts +45 -0
- package/dist/types/core/client/client-action.service.d.ts +0 -4
- package/dist/types/core/client/client-config.service.d.ts +8 -0
- package/dist/types/core/command/base-command.service.d.ts +1 -1
- package/dist/types/core/fingerprint.service.d.ts +2 -1
- package/dist/types/core/google-tag-manager.service.d.ts +3 -20
- package/dist/types/core/logger/logger.service.d.ts +0 -2
- package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +0 -2
- package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +0 -10
- package/dist/types/core/pubsub/interfaces/core.interface.d.ts +14 -8
- package/dist/types/core/pubsub/interfaces/product.interface.d.ts +0 -6
- package/dist/types/core/singleton-manager.service.d.ts +6 -1
- package/dist/types/core/store/interfaces/checkout.interface.d.ts +77 -80
- package/dist/types/core/store/interfaces/core.interface.d.ts +2 -2
- package/dist/types/core/store/store.constant.d.ts +1 -1
- package/dist/types/core/telemetry/telemetry.interface.d.ts +1 -1
- package/dist/types/core/telemetry/telemetry.service.d.ts +1 -0
- package/dist/types/elements-base-client.d.ts +3 -4
- package/dist/types/enums/core.enum.d.ts +15 -11
- package/dist/types/interfaces/cloud/checkout.interface.d.ts +1 -1
- package/dist/types/interfaces/configs/checkout.interface.d.ts +0 -1
- package/dist/types/interfaces/core.interface.d.ts +13 -7
- package/dist/types/modules/cart/components/cart-retailer.component.d.ts +0 -2
- package/dist/types/modules/checkout/checkout.commands.d.ts +28 -25
- package/dist/types/modules/checkout/components/checkout-billing.component.d.ts +14 -0
- package/dist/types/modules/checkout/components/checkout-buyer-summary.component.d.ts +7 -0
- package/dist/types/modules/checkout/components/{checkout-information-section.component.d.ts → checkout-buyer.component.d.ts} +5 -5
- package/dist/types/modules/checkout/components/checkout-deliver-to-summary.component.d.ts +7 -0
- package/dist/types/modules/checkout/components/checkout-deliver-to.component.d.ts +13 -0
- package/dist/types/modules/checkout/components/checkout-information.component.d.ts +17 -0
- package/dist/types/modules/checkout/components/{checkout-summary-section.component.d.ts → checkout-order-summary.component.d.ts} +1 -1
- package/dist/types/modules/checkout/components/checkout-payment-summary.component.d.ts +7 -0
- package/dist/types/modules/checkout/components/checkout-payment.component.d.ts +30 -0
- package/dist/types/modules/checkout/components/{summary/checkout-place-order-button.component.d.ts → checkout-place-order-button.component.d.ts} +1 -5
- package/dist/types/modules/checkout/components/checkout-send-as-gift.component.d.ts +7 -0
- package/dist/types/modules/checkout/components/{information/checkout-stripe-form.component.d.ts → checkout-stripe-form.component.d.ts} +5 -3
- package/dist/types/modules/checkout/components/checkout-stripe-handler.component.d.ts +50 -0
- package/dist/types/modules/checkout/components/index.d.ts +23 -18
- 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/utils/helpers.d.ts +0 -7
- package/dist/types/modules/ui-components/input/birthdate-input.component.d.ts +6 -4
- package/dist/types/modules/ui-components/input/input.component.d.ts +4 -4
- package/dist/types/modules/ui-components/purchase-min-alert/helpers.d.ts +3 -4
- package/docs/ACTIONS.md +29 -29
- package/docs/CONFIGURATION.md +20 -1
- package/docs/EVENTS.md +62 -29
- package/docs/THEMING.md +2 -5
- package/package.json +8 -8
- package/umd/elements.js +1 -1
- package/dist/types/core/utils.d.ts +0 -23
- package/dist/types/modules/checkout/checkout.commands.helper.d.ts +0 -13
- package/dist/types/modules/checkout/components/information/checkout-billing-form.component.d.ts +0 -18
- package/dist/types/modules/checkout/components/information/checkout-buyer-information-form.component.d.ts +0 -12
- package/dist/types/modules/checkout/components/information/checkout-delivery-information-form.component.d.ts +0 -17
- package/dist/types/modules/checkout/components/information/checkout-payment-form.component.d.ts +0 -21
- package/dist/types/modules/product/utils/index.d.ts +0 -2
- /package/dist/types/modules/checkout/components/{summary/checkout-amounts.component.d.ts → checkout-amounts.component.d.ts} +0 -0
- /package/dist/types/modules/checkout/components/{summary/checkout-completed.component.d.ts → checkout-completed.component.d.ts} +0 -0
- /package/dist/types/modules/checkout/components/{summary/checkout-gift-cards.component.d.ts → checkout-gift-cards.component.d.ts} +0 -0
- /package/dist/types/modules/checkout/components/{summary/checkout-item-quantity.component.d.ts → checkout-item-quantity.component.d.ts} +0 -0
- /package/dist/types/modules/checkout/components/{summary/checkout-item.component.d.ts → checkout-item.component.d.ts} +0 -0
- /package/dist/types/modules/checkout/components/{summary/checkout-items.component.d.ts → checkout-items.component.d.ts} +0 -0
- /package/dist/types/modules/checkout/components/{summary/checkout-presale-expired.component.d.ts → checkout-presale-expired.component.d.ts} +0 -0
- /package/dist/types/modules/checkout/components/{summary/checkout-promo-code.component.d.ts → checkout-promo-code.component.d.ts} +0 -0
- /package/dist/types/modules/checkout/components/{summary/checkout-tips.component.d.ts → checkout-tips.component.d.ts} +0 -0
- /package/dist/types/modules/checkout/components/{summary/promo-pc-gc.component.d.ts → promo-pc-gc.component.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AuthClientService } from '@/core/api/auth-client.service';
|
|
2
2
|
import type { IPersistedStore } from '@/core/store/interfaces/core.interface';
|
|
3
3
|
import type { IAddressAutocompleteResult, IAddressDetailsResult, ICart, ICartUpdateParams, ICatalog, ICatalogParams, ICheckoutCompleteParams, ICheckoutCompleteResponse, ICheckoutPrepareParams, ICheckoutPrepareResponse, ILiquidPaymentToken, ILoc, IProductData } from '@/interfaces/cloud';
|
|
4
4
|
import type { IUserPaymentSession, IUserSession } from '@/interfaces/cloud/user.interface';
|
|
@@ -8,7 +8,7 @@ export declare class ApiClientService {
|
|
|
8
8
|
private readonly logger;
|
|
9
9
|
constructor();
|
|
10
10
|
static getInstance(): ApiClientService;
|
|
11
|
-
setClient(client:
|
|
11
|
+
setClient(client: AuthClientService): Promise<void>;
|
|
12
12
|
getAllConfigs(): Promise<IAllConfigs>;
|
|
13
13
|
setPersistedStore(userDeviceId: string, data: IPersistedStore): Promise<void>;
|
|
14
14
|
getPersistedStore(userDeviceId: string): Promise<IPersistedStore | null>;
|
|
@@ -23,7 +23,7 @@ export declare class ApiClientService {
|
|
|
23
23
|
prepareCheckout(params: ICheckoutPrepareParams): Promise<ICheckoutPrepareResponse>;
|
|
24
24
|
getPaymentSession(params: IUserPaymentSession): Promise<IUserSession>;
|
|
25
25
|
confirmPaymentSession(confirmationTokenId: string, setupIntentId: string): Promise<ILiquidPaymentToken>;
|
|
26
|
-
checkoutComplete(params: ICheckoutCompleteParams): Promise<ICheckoutCompleteResponse['order']>;
|
|
26
|
+
checkoutComplete(params: Partial<ICheckoutCompleteParams>): Promise<ICheckoutCompleteResponse['order']>;
|
|
27
27
|
catalogSearch(params: ICatalogParams): Promise<ICatalog>;
|
|
28
28
|
private validResponseData;
|
|
29
29
|
private ensureClientInitialized;
|
|
@@ -29,7 +29,7 @@ export interface IApiResponseBase {
|
|
|
29
29
|
export type IApiResponseWithData<T> = IApiResponseBase & {
|
|
30
30
|
data: T;
|
|
31
31
|
};
|
|
32
|
-
export declare class
|
|
32
|
+
export declare class AuthClientService {
|
|
33
33
|
private readonly apiKey;
|
|
34
34
|
private readonly baseUrl;
|
|
35
35
|
private readonly env;
|
|
@@ -40,9 +40,8 @@ export declare class AuthService {
|
|
|
40
40
|
private readonly logger;
|
|
41
41
|
private readonly clientConfig;
|
|
42
42
|
private constructor();
|
|
43
|
-
static getInstance(config: IAuthConfig):
|
|
43
|
+
static getInstance(config: IAuthConfig): AuthClientService;
|
|
44
44
|
authenticate(): Promise<boolean>;
|
|
45
|
-
private requestWithoutAuth;
|
|
46
45
|
isTokenExpired(): boolean;
|
|
47
46
|
private request;
|
|
48
47
|
private buildUrl;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type FetchFunction = typeof fetch;
|
|
2
|
+
export interface IHttpClientOptions {
|
|
3
|
+
method: string;
|
|
4
|
+
headers: Record<string, string>;
|
|
5
|
+
body?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ICustomResponse {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
status: number;
|
|
10
|
+
statusText: string;
|
|
11
|
+
headers: Record<string, string>;
|
|
12
|
+
json: () => Promise<any>;
|
|
13
|
+
text: () => Promise<string>;
|
|
14
|
+
_bodyText?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface IRequestOptions {
|
|
17
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
18
|
+
headers?: Record<string, string>;
|
|
19
|
+
body?: any;
|
|
20
|
+
}
|
|
21
|
+
export interface IHttpRequestConfig {
|
|
22
|
+
url: string;
|
|
23
|
+
options: IHttpClientOptions;
|
|
24
|
+
retryConfig?: {
|
|
25
|
+
maxRetries: number;
|
|
26
|
+
retryDelay: number;
|
|
27
|
+
shouldRetry?: (error: any, response?: ICustomResponse) => boolean;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export declare class HttpClientService {
|
|
31
|
+
private readonly fetchImpl;
|
|
32
|
+
private readonly logger;
|
|
33
|
+
constructor();
|
|
34
|
+
request(config: IHttpRequestConfig): Promise<ICustomResponse>;
|
|
35
|
+
private defaultShouldRetry;
|
|
36
|
+
private logFailedResponse;
|
|
37
|
+
private logNetworkError;
|
|
38
|
+
private diagnosePossibleCauses;
|
|
39
|
+
private enhanceError;
|
|
40
|
+
private sanitizeHeaders;
|
|
41
|
+
private delay;
|
|
42
|
+
private getFetchImplementation;
|
|
43
|
+
private fetchAdapter;
|
|
44
|
+
private xhrFetch;
|
|
45
|
+
}
|
|
@@ -4,7 +4,6 @@ import type { IBaseProductEventData } from '@/core/pubsub/interfaces/product.int
|
|
|
4
4
|
import { type FulfillmentType } from '@/enums';
|
|
5
5
|
import type { IAddress, ICoords } from '@/interfaces/cloud';
|
|
6
6
|
import type { IAddressData } from '@/modules/address/address.interface';
|
|
7
|
-
import type { BillingFieldName, CustomerFieldName, GiftFieldName } from '@/modules/checkout/components/checkout.type';
|
|
8
7
|
export interface IProductActions {
|
|
9
8
|
getDetails: (identifier: string) => IBaseProductEventData;
|
|
10
9
|
}
|
|
@@ -42,9 +41,6 @@ export interface ICheckoutActions {
|
|
|
42
41
|
toggleIsGift: (active?: boolean) => Promise<void>;
|
|
43
42
|
toggleBillingSameAsShipping: (active?: boolean) => Promise<void>;
|
|
44
43
|
toggleMarketingPreferences: (field: 'canEmail' | 'canSms', active: boolean) => void;
|
|
45
|
-
updateCustomerInfo: (params: Record<CustomerFieldName, string>) => void;
|
|
46
|
-
updateBillingInfo: (params: Record<BillingFieldName, string>) => void;
|
|
47
|
-
updateGiftInfo: (params: Record<GiftFieldName, string>) => void;
|
|
48
44
|
getDetails: () => ICheckoutDetailsEventData;
|
|
49
45
|
}
|
|
50
46
|
export declare class ClientActionService {
|
|
@@ -14,10 +14,13 @@ export interface IClientConfigs {
|
|
|
14
14
|
proxy: IElementsProxyConfig | null;
|
|
15
15
|
deviceType: DeviceType;
|
|
16
16
|
userDeviceId?: string;
|
|
17
|
+
localStorageKeyPrefix?: string;
|
|
17
18
|
isLocalStorageAvailable?: boolean;
|
|
18
19
|
version?: string;
|
|
19
20
|
clientPrepared: boolean;
|
|
20
21
|
promoTicker: IPromoTicker[] | null;
|
|
22
|
+
paymentMethodId?: string;
|
|
23
|
+
openShadowDom?: boolean;
|
|
21
24
|
}
|
|
22
25
|
export interface IClientConfigInput {
|
|
23
26
|
env?: ElementsEnv;
|
|
@@ -26,6 +29,11 @@ export interface IClientConfigInput {
|
|
|
26
29
|
customTheme?: IClientCustomThemeConfig;
|
|
27
30
|
proxy?: IElementsProxyConfig;
|
|
28
31
|
promoTicker?: IPromoTicker[];
|
|
32
|
+
development?: {
|
|
33
|
+
customApiUrl?: string;
|
|
34
|
+
paymentMethodId?: string;
|
|
35
|
+
openShadowDom?: boolean;
|
|
36
|
+
};
|
|
29
37
|
}
|
|
30
38
|
export declare class ClientConfigService {
|
|
31
39
|
private config;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiClientService } from '@/core/api-client.service';
|
|
1
|
+
import { ApiClientService } from '@/core/api/api-client.service';
|
|
2
2
|
import { ClientConfigService } from '@/core/client/client-config.service';
|
|
3
3
|
import { GoogleTagManagerService } from '@/core/google-tag-manager.service';
|
|
4
4
|
import { LoggerFactory } from '@/core/logger/logger-factory';
|
|
@@ -4,9 +4,10 @@ interface FingerprintData {
|
|
|
4
4
|
timezone: string;
|
|
5
5
|
}
|
|
6
6
|
export declare class FingerPrintService {
|
|
7
|
-
private readonly keyPrefix;
|
|
8
7
|
private isLocalStorageAvailable;
|
|
9
8
|
private cachedFingerprint;
|
|
9
|
+
private readonly clientConfig;
|
|
10
|
+
constructor();
|
|
10
11
|
static getInstance(): FingerPrintService;
|
|
11
12
|
getId(partnerCode: string): Promise<string>;
|
|
12
13
|
getFingerprintData(): FingerprintData;
|
|
@@ -64,8 +64,10 @@ export declare class GoogleTagManagerService {
|
|
|
64
64
|
private isGTMAlreadyLoaded;
|
|
65
65
|
private isContainerLoaded;
|
|
66
66
|
private isContainerInitialized;
|
|
67
|
-
private initializeGtag;
|
|
68
67
|
private loadGTMScript;
|
|
68
|
+
private waitForContainerInit;
|
|
69
|
+
private injectGTMScript;
|
|
70
|
+
private checkFallbackGTM;
|
|
69
71
|
private processEventQueue;
|
|
70
72
|
private getSendToTargets;
|
|
71
73
|
initialize(config: GTMConfig): Promise<void>;
|
|
@@ -80,26 +82,7 @@ export declare class GoogleTagManagerService {
|
|
|
80
82
|
removeFromCart(item: BaseItem): void;
|
|
81
83
|
beginCheckout(items: BaseItem[], coupon?: string): void;
|
|
82
84
|
addShippingInfo(items: BaseItem[], coupon?: string): void;
|
|
83
|
-
addShippingInfoWithCustomerData(value: number, coupon?: string, customerData?: {
|
|
84
|
-
phone?: string;
|
|
85
|
-
email?: string;
|
|
86
|
-
birth_date?: string;
|
|
87
|
-
customer_id?: string;
|
|
88
|
-
}, amounts?: {
|
|
89
|
-
subtotal?: number;
|
|
90
|
-
total_before_discounts?: number;
|
|
91
|
-
discounts?: number;
|
|
92
|
-
gift_cards?: number;
|
|
93
|
-
net_total?: number;
|
|
94
|
-
}): void;
|
|
95
85
|
addPaymentInfo(items: BaseItem[], paymentType?: string, coupon?: string): void;
|
|
96
|
-
addPaymentInfoWithoutItems(value: number, paymentType?: string, coupon?: string, amounts?: {
|
|
97
|
-
subtotal?: number;
|
|
98
|
-
total_before_discounts?: number;
|
|
99
|
-
discounts?: number;
|
|
100
|
-
gift_cards?: number;
|
|
101
|
-
net_total?: number;
|
|
102
|
-
}): void;
|
|
103
86
|
purchase(purchaseData: PurchaseData & {
|
|
104
87
|
subtotal?: number;
|
|
105
88
|
total_before_discounts?: number;
|
|
@@ -14,7 +14,5 @@ export declare class LoggerService {
|
|
|
14
14
|
info(message: string, data?: Record<string, any>): void;
|
|
15
15
|
warn(message: string, data?: Record<string, any>): void;
|
|
16
16
|
error(message: string, error?: Error | Record<string, any>): void;
|
|
17
|
-
group(label: string, collapsed?: boolean): void;
|
|
18
|
-
groupEnd(): void;
|
|
19
17
|
private sendToTelemetry;
|
|
20
18
|
}
|
|
@@ -92,11 +92,9 @@ export interface ICartItemEngravingUpdatedEventData {
|
|
|
92
92
|
export interface ICartPromoCodeEventData {
|
|
93
93
|
discountAmount?: number;
|
|
94
94
|
newTotal?: number;
|
|
95
|
-
applied: boolean;
|
|
96
95
|
}
|
|
97
96
|
export interface ICartPromoCodeFailedEventData {
|
|
98
97
|
error: string;
|
|
99
|
-
attempted: boolean;
|
|
100
98
|
}
|
|
101
99
|
export interface ICartProductAddEventData {
|
|
102
100
|
itemsAdded: number;
|
|
@@ -43,25 +43,18 @@ export interface ICheckoutItemEngravingUpdatedEventData {
|
|
|
43
43
|
engravingLines: string[];
|
|
44
44
|
previousEngravingLines: string[];
|
|
45
45
|
}
|
|
46
|
-
export interface ICheckoutFormUpdatedEventData {
|
|
47
|
-
fieldName: string;
|
|
48
|
-
}
|
|
49
46
|
export interface ICheckoutPromoCodeEventData {
|
|
50
47
|
discountAmount?: number;
|
|
51
48
|
newTotal?: number;
|
|
52
|
-
applied: boolean;
|
|
53
49
|
}
|
|
54
50
|
export interface ICheckoutPromoCodeFailedEventData {
|
|
55
51
|
error: string;
|
|
56
|
-
attempted: boolean;
|
|
57
52
|
}
|
|
58
53
|
export interface ICheckoutGiftCardEventData {
|
|
59
|
-
applied: boolean;
|
|
60
54
|
newTotal?: number;
|
|
61
55
|
}
|
|
62
56
|
export interface ICheckoutGiftCardFailedEventData {
|
|
63
57
|
error: string;
|
|
64
|
-
attempted: boolean;
|
|
65
58
|
}
|
|
66
59
|
export interface ICheckoutProductAddEventData {
|
|
67
60
|
itemsAdded: number;
|
|
@@ -107,9 +100,6 @@ export interface ICheckoutItemEventData {
|
|
|
107
100
|
}
|
|
108
101
|
export interface ICheckoutDetailsEventData {
|
|
109
102
|
cartId: string;
|
|
110
|
-
acceptedAccountCreation: boolean;
|
|
111
|
-
hasAgeVerify: boolean;
|
|
112
|
-
hasSubstitutionPolicy: boolean;
|
|
113
103
|
isGift: boolean;
|
|
114
104
|
billingSameAsShipping: boolean;
|
|
115
105
|
marketingPreferences: {
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { IAddressActionEventData } from '@/core/pubsub/interfaces/address.interface';
|
|
2
2
|
import type { ICartFailedEventData, ICartItemAddedEventData, ICartItemEngravingUpdatedEventData, ICartItemQuantityChangedEventData, ICartItemRemovedEventData, ICartLoadedEventData, ICartProductAddEventData, ICartProductAddFailedEventData, ICartPromoCodeEventData, ICartPromoCodeFailedEventData, ICartUpdatedEventData } from '@/core/pubsub/interfaces/cart.interface';
|
|
3
|
-
import type { ICheckoutFailedEventData,
|
|
4
|
-
import type {
|
|
3
|
+
import type { ICheckoutFailedEventData, 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 { IProductAddToCartEventData, IProductFulfillmentChangedEventData, IProductFulfillmentTypeChangedEventData, IProductLoadedEventData, IProductQuantityChangedEventData, IProductSizeChangedEventData } from '@/core/pubsub/interfaces/product.interface';
|
|
5
5
|
import { ELEMENTS_ACTIONS_EVENT } from '@/enums';
|
|
6
|
+
export interface IElementsClientIsReadyEventData {
|
|
7
|
+
isReady: boolean;
|
|
8
|
+
message: string;
|
|
9
|
+
timestamp: number;
|
|
10
|
+
version?: string;
|
|
11
|
+
}
|
|
6
12
|
export interface IEventMetadata {
|
|
7
13
|
eventId: string;
|
|
8
14
|
namespace: 'actions' | 'forms';
|
|
@@ -17,6 +23,9 @@ export interface IEnhancedEventData<T> {
|
|
|
17
23
|
}
|
|
18
24
|
export interface IElementsActionsEventsMap {
|
|
19
25
|
[ELEMENTS_ACTIONS_EVENT.CLIENT_READY]: IElementsClientIsReadyEventData;
|
|
26
|
+
[ELEMENTS_ACTIONS_EVENT.ADDRESS_UPDATED]: IAddressActionEventData;
|
|
27
|
+
[ELEMENTS_ACTIONS_EVENT.ADDRESS_CLEARED]: boolean;
|
|
28
|
+
[ELEMENTS_ACTIONS_EVENT.ADDRESS_FAILED]: IAddressActionEventData;
|
|
20
29
|
[ELEMENTS_ACTIONS_EVENT.PRODUCT_LOADED]: IProductLoadedEventData;
|
|
21
30
|
[ELEMENTS_ACTIONS_EVENT.PRODUCT_QUANTITY_DECREASE]: IProductQuantityChangedEventData;
|
|
22
31
|
[ELEMENTS_ACTIONS_EVENT.PRODUCT_QUANTITY_INCREASE]: IProductQuantityChangedEventData;
|
|
@@ -40,9 +49,6 @@ export interface IElementsActionsEventsMap {
|
|
|
40
49
|
[ELEMENTS_ACTIONS_EVENT.CART_PROMO_CODE_FAILED]: ICartPromoCodeFailedEventData;
|
|
41
50
|
[ELEMENTS_ACTIONS_EVENT.CART_PRODUCT_ADD_SUCCESS]: ICartProductAddEventData;
|
|
42
51
|
[ELEMENTS_ACTIONS_EVENT.CART_PRODUCT_ADD_FAILED]: ICartProductAddFailedEventData;
|
|
43
|
-
[ELEMENTS_ACTIONS_EVENT.ADDRESS_UPDATED]: IAddressActionEventData;
|
|
44
|
-
[ELEMENTS_ACTIONS_EVENT.ADDRESS_CLEARED]: boolean;
|
|
45
|
-
[ELEMENTS_ACTIONS_EVENT.ADDRESS_FAILED]: IAddressActionEventData;
|
|
46
52
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_OPENED]: boolean;
|
|
47
53
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_CLOSED]: boolean;
|
|
48
54
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_LOADED]: ICheckoutLoadedEventData;
|
|
@@ -50,9 +56,9 @@ export interface IElementsActionsEventsMap {
|
|
|
50
56
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_IS_GIFT_TOGGLED]: ICheckoutToggleEventData;
|
|
51
57
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED]: ICheckoutToggleEventData;
|
|
52
58
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_MARKETING_PREFERENCES_TOGGLED]: ICheckoutMarketingPreferencesToggleEventData;
|
|
53
|
-
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_CUSTOMER_INFORMATION_UPDATED]:
|
|
54
|
-
[ELEMENTS_ACTIONS_EVENT.
|
|
55
|
-
[ELEMENTS_ACTIONS_EVENT.
|
|
59
|
+
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_CUSTOMER_INFORMATION_UPDATED]: boolean;
|
|
60
|
+
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_GIFT_INFORMATION_UPDATED]: boolean;
|
|
61
|
+
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_BILLING_INFORMATION_UPDATED]: boolean;
|
|
56
62
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_ITEM_REMOVED]: ICheckoutItemRemovedEventData;
|
|
57
63
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_ITEM_QUANTITY_INCREASE]: ICheckoutItemQuantityChangedEventData;
|
|
58
64
|
[ELEMENTS_ACTIONS_EVENT.CHECKOUT_ITEM_QUANTITY_DECREASE]: ICheckoutItemQuantityChangedEventData;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import type { FulfillmentType } from '@/enums';
|
|
2
2
|
import type { IAddress, ICoords } from '@/interfaces/cloud';
|
|
3
|
-
export interface IElementsClientIsReadyEventData {
|
|
4
|
-
isReady: boolean;
|
|
5
|
-
message: string;
|
|
6
|
-
timestamp: number;
|
|
7
|
-
version?: string;
|
|
8
|
-
}
|
|
9
3
|
export interface IBaseProductFulfillmentEventData {
|
|
10
4
|
price: number;
|
|
11
5
|
partNumber: string;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { IClientConfigs } from '@/core/client/client-config.service';
|
|
2
2
|
import type { LiquidCommerceElementsBuilderClientConstructor, LiquidCommerceElementsClientConstructor } from '@/interfaces/core.interface';
|
|
3
3
|
export declare class SingletonManager {
|
|
4
|
-
private static instances;
|
|
5
4
|
private static clientConstructor;
|
|
5
|
+
private static regularClientInstances;
|
|
6
|
+
private static builderClientInstances;
|
|
7
|
+
private static currentContext;
|
|
6
8
|
private static getInstances;
|
|
7
9
|
private constructor();
|
|
10
|
+
static setContext({ isBuilder }: {
|
|
11
|
+
isBuilder: boolean;
|
|
12
|
+
}): void;
|
|
8
13
|
static setClientConstructor(lceConstructor: LiquidCommerceElementsClientConstructor | LiquidCommerceElementsBuilderClientConstructor): void;
|
|
9
14
|
static getClientConstructor(): LiquidCommerceElementsClientConstructor | LiquidCommerceElementsBuilderClientConstructor | null;
|
|
10
15
|
static getClassInstance<T>(className: string, instanceCreator: () => T): T;
|
|
@@ -12,43 +12,6 @@ export interface ICheckoutGiftCardStore {
|
|
|
12
12
|
code: string;
|
|
13
13
|
discountAmount: number;
|
|
14
14
|
}
|
|
15
|
-
export interface ICheckoutPaymentStore {
|
|
16
|
-
key: string;
|
|
17
|
-
secret: string;
|
|
18
|
-
paymentMethodId: string | null;
|
|
19
|
-
sendSubmitSignal: boolean;
|
|
20
|
-
}
|
|
21
|
-
export interface ICheckoutGiftRecipientStore {
|
|
22
|
-
firstName: string;
|
|
23
|
-
lastName: string;
|
|
24
|
-
email: string;
|
|
25
|
-
phone: string;
|
|
26
|
-
birthDate: string;
|
|
27
|
-
addressTwo: string | null;
|
|
28
|
-
message: string | null;
|
|
29
|
-
}
|
|
30
|
-
export interface ICheckoutCustomerStore {
|
|
31
|
-
id?: string;
|
|
32
|
-
firstName: string;
|
|
33
|
-
lastName: string;
|
|
34
|
-
email: string;
|
|
35
|
-
phone: string;
|
|
36
|
-
birthDate: string;
|
|
37
|
-
addressTwo: string;
|
|
38
|
-
company: string;
|
|
39
|
-
}
|
|
40
|
-
export interface ICheckoutBillingStore {
|
|
41
|
-
firstName: string;
|
|
42
|
-
lastName: string;
|
|
43
|
-
email: string;
|
|
44
|
-
phone: string;
|
|
45
|
-
company: string | null;
|
|
46
|
-
addressOne: string;
|
|
47
|
-
addressTwo: string | null;
|
|
48
|
-
city: string;
|
|
49
|
-
state: string;
|
|
50
|
-
zipCode: string;
|
|
51
|
-
}
|
|
52
15
|
export interface ICheckoutItemStore {
|
|
53
16
|
liquidId: string;
|
|
54
17
|
variantId: string;
|
|
@@ -84,13 +47,6 @@ export interface ICheckoutItemStore {
|
|
|
84
47
|
updating: boolean;
|
|
85
48
|
error: string | null;
|
|
86
49
|
}
|
|
87
|
-
export interface ICheckoutReadyForSubmitStore {
|
|
88
|
-
customer: boolean;
|
|
89
|
-
gift: boolean;
|
|
90
|
-
billing: boolean;
|
|
91
|
-
payment: boolean;
|
|
92
|
-
prepared: boolean;
|
|
93
|
-
}
|
|
94
50
|
export interface IOnDemandFulfillmentTipInfo {
|
|
95
51
|
fulfillmentId: string;
|
|
96
52
|
retailerId: string;
|
|
@@ -98,56 +54,97 @@ export interface IOnDemandFulfillmentTipInfo {
|
|
|
98
54
|
subtotal: number;
|
|
99
55
|
tip: number;
|
|
100
56
|
}
|
|
101
|
-
export interface
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
57
|
+
export interface ICheckoutPresaleStore {
|
|
58
|
+
isLocked: boolean;
|
|
59
|
+
expiresAt: string | null;
|
|
60
|
+
}
|
|
61
|
+
export interface ICheckoutCustomerStore {
|
|
62
|
+
id?: string;
|
|
63
|
+
firstName: string;
|
|
64
|
+
lastName: string;
|
|
65
|
+
email: string;
|
|
66
|
+
phone: string;
|
|
67
|
+
birthDate: string;
|
|
68
|
+
company: string;
|
|
69
|
+
}
|
|
70
|
+
export interface ICheckoutCustomerFormStore {
|
|
71
|
+
data: ICheckoutCustomerStore;
|
|
72
|
+
isEditing: boolean;
|
|
73
|
+
isValid: boolean;
|
|
74
|
+
isSaving: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface ICheckoutGiftRecipientStore {
|
|
77
|
+
firstName: string;
|
|
78
|
+
lastName: string;
|
|
79
|
+
email: string;
|
|
80
|
+
phone: string;
|
|
81
|
+
message: string;
|
|
82
|
+
}
|
|
83
|
+
export interface ICheckoutGiftRecipientFormStore {
|
|
84
|
+
data: ICheckoutGiftRecipientStore;
|
|
85
|
+
isEditing: boolean;
|
|
86
|
+
isValid: boolean;
|
|
87
|
+
isSaving: boolean;
|
|
88
|
+
}
|
|
89
|
+
export interface ICheckoutBillingStore {
|
|
90
|
+
firstName: string;
|
|
91
|
+
lastName: string;
|
|
92
|
+
email: string;
|
|
93
|
+
phone: string;
|
|
94
|
+
company: string;
|
|
95
|
+
addressOne: string;
|
|
96
|
+
addressTwo: string;
|
|
97
|
+
city: string;
|
|
98
|
+
state: string;
|
|
99
|
+
zipCode: string;
|
|
100
|
+
}
|
|
101
|
+
export interface ICheckoutPaymentCardStore {
|
|
102
|
+
brand: string;
|
|
103
|
+
last4: string;
|
|
104
|
+
expMonth: string;
|
|
105
|
+
expYear: string;
|
|
106
|
+
}
|
|
107
|
+
export interface ICheckoutPaymentMethodStore {
|
|
108
|
+
id: string;
|
|
109
|
+
card: ICheckoutPaymentCardStore;
|
|
110
|
+
}
|
|
111
|
+
export interface ICheckoutPaymentSessionStore {
|
|
112
|
+
key: string;
|
|
113
|
+
secret: string;
|
|
106
114
|
}
|
|
107
|
-
export interface
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
export interface ICheckoutPaymentFormStore {
|
|
116
|
+
paymentSession: ICheckoutPaymentSessionStore | null;
|
|
117
|
+
paymentMethod: ICheckoutPaymentMethodStore | null;
|
|
118
|
+
data: ICheckoutBillingStore | null;
|
|
119
|
+
billingSameAsShipping: boolean;
|
|
120
|
+
isEditing: boolean;
|
|
121
|
+
isValid: boolean;
|
|
122
|
+
isSaving: boolean;
|
|
114
123
|
}
|
|
115
124
|
export interface ICheckoutStore {
|
|
116
125
|
token: string;
|
|
117
126
|
cartId: string;
|
|
118
|
-
|
|
119
|
-
updating: boolean;
|
|
120
|
-
error: string | null;
|
|
121
|
-
warning: string[];
|
|
122
|
-
isPresaleLocked: boolean;
|
|
123
|
-
presaleExpiresAt: string | null;
|
|
124
|
-
acceptedAccountCreation: boolean;
|
|
125
|
-
deliveryTips: [];
|
|
126
|
-
hasAgeVerify: boolean;
|
|
127
|
-
hasSubstitutionPolicy: boolean;
|
|
127
|
+
presale: ICheckoutPresaleStore | null;
|
|
128
128
|
isGift: boolean;
|
|
129
|
-
billingSameAsShipping: boolean;
|
|
130
129
|
marketingPreferences: ICheckoutMarketingPreferencesStore;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
customerForm: ICheckoutCustomerFormStore;
|
|
131
|
+
giftRecipientForm: ICheckoutGiftRecipientFormStore;
|
|
132
|
+
paymentForm: ICheckoutPaymentFormStore;
|
|
133
|
+
shippingAddressTwo: string;
|
|
135
134
|
promoCode: ICheckoutPromoCodeStore | null;
|
|
136
135
|
giftCards: ICheckoutGiftCardStore[];
|
|
137
|
-
amounts: ICheckoutTotalAmounts;
|
|
138
136
|
items: Record<string, ICheckoutItemStore>;
|
|
139
|
-
|
|
137
|
+
amounts: ICheckoutTotalAmounts;
|
|
140
138
|
orderNumber: string | null;
|
|
141
|
-
rerender: boolean;
|
|
142
|
-
isFormValid: boolean;
|
|
143
|
-
invalidFields: string[];
|
|
144
|
-
focusField: string | null;
|
|
145
139
|
onDemandFulfillmentTipInfo: Record<string, IOnDemandFulfillmentTipInfo>;
|
|
146
140
|
tipSelection: number;
|
|
147
|
-
|
|
148
|
-
deliveryInstructions: string | null;
|
|
149
|
-
card: ICheckoutCardInfoStore;
|
|
141
|
+
deliveryInstructions: string;
|
|
150
142
|
giftCardError: string | null;
|
|
151
143
|
promoCodeError: string | null;
|
|
144
|
+
rerender: boolean;
|
|
145
|
+
loading: boolean;
|
|
146
|
+
updating: boolean;
|
|
147
|
+
error: string | null;
|
|
148
|
+
warning: string[];
|
|
152
149
|
events: IElementsCheckoutEvents[];
|
|
153
150
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IAddressStore } from '@/core/store/interfaces/address.interface';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ICheckoutCustomerFormStore, ICheckoutGiftRecipientFormStore, ICheckoutGiftRecipientStore, ICheckoutItemStore, ICheckoutMarketingPreferencesStore, ICheckoutPaymentFormStore, ICheckoutPaymentMethodStore, ICheckoutPaymentSessionStore, ICheckoutPresaleStore, ICheckoutPromoCodeStore, ICheckoutStore } from '@/core/store/interfaces/checkout.interface';
|
|
3
3
|
import type { IProductSizeStore, IProductStore } from '@/core/store/interfaces/product.interface';
|
|
4
4
|
import type { ComponentType } from '@/enums';
|
|
5
5
|
import type { ICartItemStore, ICartPromoCodeStore, ICartStore, ICartTotalsStore, IRetailerFulfillmentStore, IRetailerStore } from './cart.interface';
|
|
@@ -25,7 +25,7 @@ export interface IPersistedStore {
|
|
|
25
25
|
p?: string;
|
|
26
26
|
c?: string;
|
|
27
27
|
}
|
|
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.
|
|
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.customerForm.${keyof ICheckoutCustomerFormStore}` | `checkout.giftRecipientForm.${keyof ICheckoutGiftRecipientFormStore}` | `checkout.paymentForm.${keyof ICheckoutPaymentFormStore}` | `checkout.paymentForm.paymentSession.${keyof ICheckoutPaymentSessionStore}` | `checkout.paymentForm.paymentMethod.${keyof ICheckoutPaymentMethodStore}` | `checkout.presale.${keyof ICheckoutPresaleStore}` | `checkout.marketingPreferences.${keyof ICheckoutMarketingPreferencesStore}` | `checkout.giftRecipient.${keyof ICheckoutGiftRecipientStore}` | `checkout.giftCards.${string}` | `checkout.promoCode.${keyof ICheckoutPromoCodeStore}` | `checkout.items.${string}` | `checkout.items.${string}.${keyof ICheckoutItemStore}` | `checkout.onDemandFulfillmentTipInfo.${string}`;
|
|
29
29
|
interface MiddlewareContext {
|
|
30
30
|
action: string;
|
|
31
31
|
payload: any;
|
|
@@ -3,7 +3,7 @@ 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
|
-
export declare const LOCAL_STORAGE_PREFIX = "
|
|
6
|
+
export declare const LOCAL_STORAGE_PREFIX = "lce";
|
|
7
7
|
export declare const initialProductState: IProductStore;
|
|
8
8
|
export declare const initialCartState: ICartStore;
|
|
9
9
|
export declare const initialCheckoutState: ICheckoutStore;
|
|
@@ -55,8 +55,8 @@ export interface ITelemetryComponentContext {
|
|
|
55
55
|
}
|
|
56
56
|
export interface ITelemetryUserContext {
|
|
57
57
|
deviceId: string;
|
|
58
|
-
sessionId?: string;
|
|
59
58
|
isLocalStorageAvailable: boolean;
|
|
59
|
+
selectedAddress?: string;
|
|
60
60
|
}
|
|
61
61
|
export interface ITelemetryBrowserContext {
|
|
62
62
|
userAgent: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApiClientService } from '@/core/api-client.service';
|
|
2
|
-
import {
|
|
1
|
+
import { ApiClientService } from '@/core/api/api-client.service';
|
|
2
|
+
import { AuthClientService } from '@/core/api/auth-client.service';
|
|
3
3
|
import { ClientActionService } from '@/core/client/client-action.service';
|
|
4
4
|
import { ClientConfigService, type IClientConfigs } from '@/core/client/client-config.service';
|
|
5
5
|
import { CommandService } from '@/core/command/command.service';
|
|
@@ -13,7 +13,7 @@ import { type ComponentType } from '@/enums';
|
|
|
13
13
|
import type { IInjectedComponent, IInjectProductElement, IInjectProductListParams, ILiquidCommerceElementsActions, IProcessInjectElementParams } from '@/interfaces/core.interface';
|
|
14
14
|
import { ThemeProviderService } from '@/modules/theme-provider/theme-provider.service';
|
|
15
15
|
export declare abstract class ElementsBaseClient {
|
|
16
|
-
protected readonly
|
|
16
|
+
protected readonly authClient: AuthClientService;
|
|
17
17
|
protected readonly clientConfig: ClientConfigService;
|
|
18
18
|
protected readonly store: StoreService;
|
|
19
19
|
protected readonly commands: CommandService;
|
|
@@ -28,7 +28,6 @@ export declare abstract class ElementsBaseClient {
|
|
|
28
28
|
protected clientPrepared: boolean;
|
|
29
29
|
protected componentFactoryInitialized: boolean;
|
|
30
30
|
protected cartDrawerCreated: boolean;
|
|
31
|
-
protected gtmInitialized: boolean;
|
|
32
31
|
protected injectedComponents: Map<string, IInjectedComponent>;
|
|
33
32
|
constructor(clientConfigs: IClientConfigs);
|
|
34
33
|
prepare(): Promise<void>;
|