@liquidcommerce/elements-sdk 2.6.0-beta.6 → 2.6.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +10045 -10114
- package/dist/types/core/api/api-client.service.d.ts +3 -4
- package/dist/types/core/client/client-action.service.d.ts +11 -7
- package/dist/types/core/command/common-command.service.d.ts +2 -1
- package/dist/types/core/google-tag-manager.service.d.ts +2 -0
- package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +26 -63
- package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +11 -1
- package/dist/types/core/pubsub/interfaces/product.interface.d.ts +16 -75
- package/dist/types/core/store/interfaces/cart.interface.d.ts +16 -55
- package/dist/types/core/store/interfaces/checkout.interface.d.ts +2 -2
- package/dist/types/core/store/interfaces/core.interface.d.ts +3 -2
- package/dist/types/elements-base-client.d.ts +1 -1
- package/dist/types/interfaces/api/cart.interface.d.ts +91 -0
- package/dist/types/interfaces/cloud/checkout.interface.d.ts +9 -2
- package/dist/types/interfaces/cloud/index.d.ts +0 -1
- package/dist/types/interfaces/configs/product.interface.d.ts +1 -0
- package/dist/types/modules/cart/cart.commands.d.ts +0 -1
- package/dist/types/modules/cart/components/cart-body.component.d.ts +2 -1
- package/dist/types/modules/cart/components/cart-footer.component.d.ts +0 -1
- package/dist/types/modules/cart/components/cart-fulfillment.component.d.ts +0 -2
- package/dist/types/modules/ui-components/purchase-min-alert/index.d.ts +0 -1
- package/dist/types/utils/helper.d.ts +2 -1
- package/package.json +3 -3
- package/umd/elements.js +1 -1
- package/dist/types/interfaces/cloud/cart.interface.d.ts +0 -132
- package/dist/types/modules/cart/cart.commands.helper.d.ts +0 -9
- package/dist/types/modules/ui-components/purchase-min-alert/helpers.d.ts +0 -7
|
@@ -1,8 +1,9 @@
|
|
|
1
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, ILocation } from '@/interfaces/api/address.interface';
|
|
4
|
+
import type { ICart, ICartUpdateParams } from '@/interfaces/api/cart.interface';
|
|
4
5
|
import type { IProductAvailabilityResponse } from '@/interfaces/api/product.interface';
|
|
5
|
-
import type {
|
|
6
|
+
import type { ICatalog, ICatalogParams, ICheckoutCompleteParams, ICheckoutCompleteResponse, ICheckoutPrepareParams, ICheckoutPrepareResponse, ILiquidPaymentToken } from '@/interfaces/cloud';
|
|
6
7
|
import type { IUserPaymentSession, IUserSession } from '@/interfaces/cloud/user.interface';
|
|
7
8
|
import type { IAllConfigs } from '@/interfaces/configs';
|
|
8
9
|
export declare class ApiClientService {
|
|
@@ -20,9 +21,7 @@ export declare class ApiClientService {
|
|
|
20
21
|
getProductsData(identifier: string[], location?: ILocation): Promise<IProductAvailabilityResponse | null>;
|
|
21
22
|
catalogSearch(params: ICatalogParams): Promise<ICatalog>;
|
|
22
23
|
getCartData(id: string | null): Promise<ICart>;
|
|
23
|
-
updateCart(params: ICartUpdateParams
|
|
24
|
-
loc?: ILocation;
|
|
25
|
-
}): Promise<ICart>;
|
|
24
|
+
updateCart(params: ICartUpdateParams): Promise<ICart>;
|
|
26
25
|
prepareCheckout(params: ICheckoutPrepareParams): Promise<ICheckoutPrepareResponse>;
|
|
27
26
|
getPaymentSession(params: IUserPaymentSession): Promise<IUserSession>;
|
|
28
27
|
confirmPaymentSession(confirmationTokenId: string, setupIntentId: string): Promise<ILiquidPaymentToken>;
|
|
@@ -4,8 +4,10 @@ import type { IBaseProductEventData } from '@/core/pubsub/interfaces/product.int
|
|
|
4
4
|
import { type FulfillmentType } from '@/enums';
|
|
5
5
|
import type { IAddressAddress, IAddressCoordinates, IAddressData } from '@/interfaces/api/address.interface';
|
|
6
6
|
import type { BillingFieldName, CustomerFieldName, GiftFieldName } from '@/modules/checkout/components/checkout.type';
|
|
7
|
-
export interface
|
|
8
|
-
|
|
7
|
+
export interface IAddProductParams {
|
|
8
|
+
identifier: string;
|
|
9
|
+
fulfillmentType: FulfillmentType;
|
|
10
|
+
quantity: number;
|
|
9
11
|
}
|
|
10
12
|
export interface IAddressActions {
|
|
11
13
|
setAddressByPlacesId: (placesId: string) => Promise<void>;
|
|
@@ -13,11 +15,6 @@ export interface IAddressActions {
|
|
|
13
15
|
clear: () => Promise<void>;
|
|
14
16
|
getDetails: () => IAddressData | null;
|
|
15
17
|
}
|
|
16
|
-
export interface IAddProductParams {
|
|
17
|
-
identifier: string;
|
|
18
|
-
fulfillmentType: FulfillmentType;
|
|
19
|
-
quantity: number;
|
|
20
|
-
}
|
|
21
18
|
export interface ICartActions {
|
|
22
19
|
openCart: () => void;
|
|
23
20
|
closeCart: () => void;
|
|
@@ -46,6 +43,9 @@ export interface ICheckoutActions {
|
|
|
46
43
|
updateGiftInfo: (params: Record<GiftFieldName, string>) => void;
|
|
47
44
|
getDetails: () => ICheckoutDetailsEventData;
|
|
48
45
|
}
|
|
46
|
+
export interface IProductActions {
|
|
47
|
+
getDetails: (identifier: string) => IBaseProductEventData;
|
|
48
|
+
}
|
|
49
49
|
export declare class ClientActionService {
|
|
50
50
|
private readonly pubSub;
|
|
51
51
|
private readonly command;
|
|
@@ -53,6 +53,9 @@ export declare class ClientActionService {
|
|
|
53
53
|
private readonly api;
|
|
54
54
|
private readonly themeProvider;
|
|
55
55
|
private readonly logger;
|
|
56
|
+
private readonly allowedCustomerFields;
|
|
57
|
+
private readonly allowedBillingFields;
|
|
58
|
+
private readonly allowedGiftFields;
|
|
56
59
|
private pendingCartParams;
|
|
57
60
|
private pendingCartOpenFlag;
|
|
58
61
|
constructor();
|
|
@@ -61,6 +64,7 @@ export declare class ClientActionService {
|
|
|
61
64
|
private retryPendingCartOperation;
|
|
62
65
|
private clearPendingCartOperation;
|
|
63
66
|
private getLocation;
|
|
67
|
+
private normalizeCheckoutFieldValue;
|
|
64
68
|
private productActions;
|
|
65
69
|
private addressActions;
|
|
66
70
|
private cartActions;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { ICart } from '@/interfaces/
|
|
1
|
+
import type { ICart } from '@/interfaces/api/cart.interface';
|
|
2
2
|
import { BaseCommand } from './base-command.service';
|
|
3
3
|
export declare class CommonCommands extends BaseCommand {
|
|
4
4
|
static getInstance(): CommonCommands;
|
|
5
5
|
syncCartFromResponse(cartApi: ICart, publishEvent?: boolean): void;
|
|
6
|
+
private buildCartLoadedEventData;
|
|
6
7
|
loadCart(): Promise<void>;
|
|
7
8
|
}
|
|
@@ -6,6 +6,7 @@ declare global {
|
|
|
6
6
|
}
|
|
7
7
|
interface GTMConfig {
|
|
8
8
|
partnerName: string;
|
|
9
|
+
partnerCode: string;
|
|
9
10
|
partnerGTMId?: string;
|
|
10
11
|
enablePartnerGTM: boolean;
|
|
11
12
|
enableLiquidCommerceGTM: boolean;
|
|
@@ -47,6 +48,7 @@ interface PurchaseData {
|
|
|
47
48
|
}
|
|
48
49
|
export declare class GoogleTagManagerService {
|
|
49
50
|
private partnerName?;
|
|
51
|
+
private partnerCode?;
|
|
50
52
|
private partnerGTMId?;
|
|
51
53
|
private liquidCommerceGTMId?;
|
|
52
54
|
private enablePartnerGTM;
|
|
@@ -1,67 +1,23 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
id: string;
|
|
4
|
-
variantId: string;
|
|
5
|
-
liquidId: string;
|
|
6
|
-
retailerId: string;
|
|
7
|
-
partNumber: string;
|
|
8
|
-
fulfillmentId: string;
|
|
9
|
-
upc: string;
|
|
10
|
-
sku: string;
|
|
11
|
-
salsifyGrouping: string;
|
|
12
|
-
catPath: string;
|
|
13
|
-
volume: string;
|
|
14
|
-
uom: string;
|
|
15
|
-
pack: boolean;
|
|
16
|
-
packDesc: string;
|
|
17
|
-
container: string;
|
|
18
|
-
containerType: string;
|
|
19
|
-
name: string;
|
|
20
|
-
brand: string;
|
|
21
|
-
size: string;
|
|
22
|
-
price: number;
|
|
23
|
-
quantity: number;
|
|
24
|
-
maxQuantity: number;
|
|
25
|
-
unitPrice: number;
|
|
26
|
-
mainImage: string;
|
|
27
|
-
attributes: ICartItemAttributes;
|
|
28
|
-
}
|
|
1
|
+
import type { IAddressAddress, IAddressCoordinates } from '@/interfaces/api/address.interface';
|
|
2
|
+
import type { ICartItem, ICartRetailer } from '@/interfaces/api/cart.interface';
|
|
29
3
|
export interface IBaseCartEventData {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
4
|
+
cartId: string;
|
|
5
|
+
promoCodeDiscount: number | null;
|
|
6
|
+
subtotal: number;
|
|
7
|
+
itemCount: number;
|
|
8
|
+
items: Record<string, ICartItem>;
|
|
9
|
+
retailers: Record<string, ICartRetailer>;
|
|
33
10
|
location: {
|
|
34
11
|
placesId: string;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
state: string;
|
|
40
|
-
zip: string;
|
|
41
|
-
country: string;
|
|
42
|
-
};
|
|
43
|
-
coordinates: {
|
|
44
|
-
latitude: number;
|
|
45
|
-
longitude: number;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
amounts: {
|
|
49
|
-
deliveryFee: number;
|
|
50
|
-
discounts: number;
|
|
51
|
-
engravingFee: number;
|
|
52
|
-
giftCardTotal: number;
|
|
53
|
-
platformFee: number;
|
|
54
|
-
shippingFee: number;
|
|
55
|
-
subtotal: number;
|
|
56
|
-
total: number;
|
|
57
|
-
};
|
|
58
|
-
itemCount: number;
|
|
59
|
-
updatedAt: string;
|
|
60
|
-
createdAt: string;
|
|
12
|
+
formattedAddress: string;
|
|
13
|
+
address: IAddressAddress;
|
|
14
|
+
coordinates: IAddressCoordinates;
|
|
15
|
+
} | null;
|
|
61
16
|
}
|
|
62
17
|
export interface ICartLoadedEventData extends IBaseCartEventData {
|
|
63
18
|
}
|
|
64
19
|
export interface ICartFailedEventData {
|
|
20
|
+
cartId: string;
|
|
65
21
|
message: string;
|
|
66
22
|
}
|
|
67
23
|
export interface ICartUpdatedEventData {
|
|
@@ -69,38 +25,45 @@ export interface ICartUpdatedEventData {
|
|
|
69
25
|
current: IBaseCartEventData;
|
|
70
26
|
}
|
|
71
27
|
export interface ICartItemAddedEventData {
|
|
72
|
-
|
|
73
|
-
|
|
28
|
+
cartId: string;
|
|
29
|
+
itemId: string;
|
|
74
30
|
fulfillmentId: string;
|
|
75
31
|
partNumber: string;
|
|
76
32
|
quantity: number;
|
|
77
33
|
engravingLines?: string[];
|
|
78
34
|
}
|
|
79
35
|
export interface ICartItemRemovedEventData {
|
|
80
|
-
|
|
36
|
+
cartId: string;
|
|
37
|
+
itemId: string;
|
|
81
38
|
}
|
|
82
39
|
export interface ICartItemQuantityChangedEventData {
|
|
83
|
-
|
|
40
|
+
cartId: string;
|
|
41
|
+
itemId: string;
|
|
84
42
|
quantity: number;
|
|
85
43
|
previousQuantity: number;
|
|
86
44
|
}
|
|
87
45
|
export interface ICartItemEngravingUpdatedEventData {
|
|
88
|
-
|
|
46
|
+
cartId: string;
|
|
47
|
+
itemId: string;
|
|
89
48
|
engravingLines: string[];
|
|
90
49
|
previousEngravingLines: string[];
|
|
91
50
|
}
|
|
92
51
|
export interface ICartPromoCodeEventData {
|
|
52
|
+
cartId: string;
|
|
93
53
|
discountAmount?: number;
|
|
94
|
-
|
|
54
|
+
newSubtotal?: number;
|
|
95
55
|
}
|
|
96
56
|
export interface ICartPromoCodeFailedEventData {
|
|
57
|
+
cartId: string;
|
|
97
58
|
error: string;
|
|
98
59
|
}
|
|
99
60
|
export interface ICartProductAddEventData {
|
|
61
|
+
cartId: string;
|
|
100
62
|
itemsAdded: number;
|
|
101
63
|
identifiers: string[];
|
|
102
64
|
}
|
|
103
65
|
export interface ICartProductAddFailedEventData {
|
|
66
|
+
cartId: string;
|
|
104
67
|
identifiers: string[];
|
|
105
68
|
error: string;
|
|
106
69
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ICartItemAttributes
|
|
1
|
+
import type { ICartItemAttributes } from '@/interfaces/api/cart.interface';
|
|
2
|
+
import type { ICheckoutTotalAmounts } from '@/interfaces/cloud';
|
|
2
3
|
export interface IBaseCheckoutEventData {
|
|
3
4
|
cartId: string;
|
|
4
5
|
}
|
|
@@ -31,37 +32,46 @@ export interface ICheckoutSubmitFailedEventData {
|
|
|
31
32
|
message: string;
|
|
32
33
|
}
|
|
33
34
|
export interface ICheckoutItemQuantityChangedEventData {
|
|
35
|
+
cartId: string;
|
|
34
36
|
cartItemId: string;
|
|
35
37
|
quantity: number;
|
|
36
38
|
previousQuantity: number;
|
|
37
39
|
}
|
|
38
40
|
export interface ICheckoutItemRemovedEventData {
|
|
41
|
+
cartId: string;
|
|
39
42
|
cartItemId: string;
|
|
40
43
|
}
|
|
41
44
|
export interface ICheckoutItemEngravingUpdatedEventData {
|
|
45
|
+
cartId: string;
|
|
42
46
|
cartItemId: string;
|
|
43
47
|
engravingLines: string[];
|
|
44
48
|
previousEngravingLines: string[];
|
|
45
49
|
}
|
|
46
50
|
export interface ICheckoutPromoCodeEventData {
|
|
51
|
+
cartId: string;
|
|
47
52
|
discountAmount?: number;
|
|
48
53
|
newTotal?: number;
|
|
49
54
|
}
|
|
50
55
|
export interface ICheckoutPromoCodeFailedEventData {
|
|
56
|
+
cartId: string;
|
|
51
57
|
error: string;
|
|
52
58
|
}
|
|
53
59
|
export interface ICheckoutGiftCardEventData {
|
|
60
|
+
cartId: string;
|
|
54
61
|
newTotal?: number;
|
|
55
62
|
}
|
|
56
63
|
export interface ICheckoutGiftCardFailedEventData {
|
|
64
|
+
cartId: string;
|
|
57
65
|
error: string;
|
|
58
66
|
}
|
|
59
67
|
export interface ICheckoutProductAddEventData {
|
|
68
|
+
cartId: string;
|
|
60
69
|
itemsAdded: number;
|
|
61
70
|
identifiers: string[];
|
|
62
71
|
isPresale?: boolean;
|
|
63
72
|
}
|
|
64
73
|
export interface ICheckoutProductAddFailedEventData {
|
|
74
|
+
cartId: string;
|
|
65
75
|
identifiers: string[];
|
|
66
76
|
error: string;
|
|
67
77
|
isPresale?: boolean;
|
|
@@ -1,81 +1,23 @@
|
|
|
1
1
|
import type { FulfillmentType } from '@/enums';
|
|
2
|
-
import type {
|
|
3
|
-
export
|
|
4
|
-
price: number;
|
|
5
|
-
partNumber: string;
|
|
6
|
-
stock: number;
|
|
7
|
-
isEngravable: boolean;
|
|
8
|
-
fulfillmentId: string;
|
|
9
|
-
fulfillmentType: FulfillmentType;
|
|
10
|
-
retailerId: string;
|
|
2
|
+
import type { IFulfillment, IProduct, IProductSize, IProductVariant, IRetailerAddress } from '@/interfaces/api/product.interface';
|
|
3
|
+
export type IProductFulfillmentEventData = IFulfillment & {
|
|
11
4
|
retailerName: string;
|
|
12
|
-
retailerAddress:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
location: string;
|
|
22
|
-
};
|
|
23
|
-
presale?: {
|
|
24
|
-
canPurchaseOn: null | string;
|
|
25
|
-
estimatedShipBy: null | string;
|
|
26
|
-
isActive: boolean;
|
|
27
|
-
language: string;
|
|
28
|
-
presaleLimit: number;
|
|
29
|
-
price: number;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export interface IBaseProductSizeEventData {
|
|
33
|
-
id: string;
|
|
34
|
-
upc: string;
|
|
35
|
-
size: string;
|
|
36
|
-
pack: boolean;
|
|
37
|
-
packDesc: string;
|
|
38
|
-
container: string;
|
|
39
|
-
containerType: string;
|
|
40
|
-
maxQuantityPerOrder: number;
|
|
41
|
-
image: string;
|
|
42
|
-
uom: string;
|
|
43
|
-
volume: string;
|
|
44
|
-
attributes: IBaseProductSizeAttributesEventData;
|
|
45
|
-
shippingFulfillments: Record<string, IBaseProductFulfillmentEventData>;
|
|
46
|
-
onDemandFulfillments: Record<string, IBaseProductFulfillmentEventData>;
|
|
47
|
-
}
|
|
48
|
-
export interface IBaseProductEventData {
|
|
5
|
+
retailerAddress: IRetailerAddress;
|
|
6
|
+
retailerAddressFormatted: string;
|
|
7
|
+
variant: IProductVariant;
|
|
8
|
+
};
|
|
9
|
+
export interface IProductSizeEventData extends Omit<IProductSize, 'shippingVariants' | 'onDemandVariants'> {
|
|
10
|
+
onDemandFulfillments: Record<string, IProductFulfillmentEventData>;
|
|
11
|
+
shippingFulfillments: Record<string, IProductFulfillmentEventData>;
|
|
12
|
+
}
|
|
13
|
+
export interface IBaseProductEventData extends Omit<IProduct, 'sizes'> {
|
|
49
14
|
identifier: string;
|
|
50
15
|
selectedSizeId: string | null;
|
|
51
|
-
selectedFulfillmentId: string | null;
|
|
52
16
|
selectedFulfillmentType: FulfillmentType;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
category: string;
|
|
58
|
-
classification: string;
|
|
59
|
-
type: string;
|
|
60
|
-
salsifyGrouping: string;
|
|
61
|
-
subType: string;
|
|
62
|
-
images: string[];
|
|
63
|
-
region: string;
|
|
64
|
-
country: string;
|
|
65
|
-
material: string;
|
|
66
|
-
abv: string;
|
|
67
|
-
proof: string;
|
|
68
|
-
age: string;
|
|
69
|
-
color: string;
|
|
70
|
-
flavor: string;
|
|
71
|
-
variety: string;
|
|
72
|
-
appellation: string;
|
|
73
|
-
vintage: string;
|
|
74
|
-
description: string;
|
|
75
|
-
htmlDescription: string;
|
|
76
|
-
tastingNotes: string;
|
|
77
|
-
noAvailabilityPrice: number;
|
|
78
|
-
sizes: Record<string, IBaseProductSizeEventData>;
|
|
17
|
+
selectedFulfillmentId: string | null;
|
|
18
|
+
productHasAvailability: boolean;
|
|
19
|
+
fulfillmentHasAvailability: boolean;
|
|
20
|
+
sizes: Record<string, IProductSizeEventData>;
|
|
79
21
|
}
|
|
80
22
|
export interface IProductLoadedEventData extends IBaseProductEventData {
|
|
81
23
|
}
|
|
@@ -86,7 +28,6 @@ export interface IProductQuantityChangedEventData {
|
|
|
86
28
|
}
|
|
87
29
|
export interface IProductAddToCartEventData {
|
|
88
30
|
identifier: string;
|
|
89
|
-
upc: string;
|
|
90
31
|
fulfillmentId: string;
|
|
91
32
|
partNumber: string;
|
|
92
33
|
quantity: number;
|
|
@@ -95,7 +36,7 @@ export interface IProductAddToCartEventData {
|
|
|
95
36
|
export interface IProductSizeChangedEventData {
|
|
96
37
|
identifier: string;
|
|
97
38
|
selectedSizeId: string;
|
|
98
|
-
|
|
39
|
+
selectedSize: string;
|
|
99
40
|
previousSizeId: string;
|
|
100
41
|
previousSize: string;
|
|
101
42
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { IElementsCartEvent } from 'utils/helper';
|
|
2
|
-
import type {
|
|
3
|
-
import type { IAddressAddress } from '@/interfaces/api/address.interface';
|
|
4
|
-
import type { ICartItemAttributes, IRetailerExpectation, IRetailerFees } from '@/interfaces/cloud';
|
|
2
|
+
import type { ICartFulfillment, ICartItemAttributes, ICartPromoCode, ICartRetailer } from '@/interfaces/api/cart.interface';
|
|
5
3
|
export interface ICartItemStore {
|
|
6
4
|
id: string;
|
|
7
5
|
variantId: string;
|
|
@@ -32,64 +30,27 @@ export interface ICartItemStore {
|
|
|
32
30
|
updating: boolean;
|
|
33
31
|
error: string | null;
|
|
34
32
|
}
|
|
35
|
-
export interface
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
platformFee: number;
|
|
40
|
-
giftCardTotal: number;
|
|
41
|
-
engravingFee: number;
|
|
42
|
-
deliveryFee: number;
|
|
43
|
-
discounts: number;
|
|
44
|
-
quantity: number;
|
|
33
|
+
export interface ICartFulfillmentStore extends ICartFulfillment {
|
|
34
|
+
loading: boolean;
|
|
35
|
+
error: string | null;
|
|
36
|
+
updating: boolean;
|
|
45
37
|
}
|
|
46
|
-
export interface
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
fees: IRetailerFees;
|
|
51
|
-
expectation: IRetailerExpectation;
|
|
52
|
-
shippingFee: number;
|
|
53
|
-
subtotal: number;
|
|
54
|
-
items: string[];
|
|
55
|
-
engravingFee: number;
|
|
56
|
-
deliveryFee: number;
|
|
57
|
-
retailerId: string;
|
|
58
|
-
loading?: boolean;
|
|
59
|
-
error?: string | null;
|
|
60
|
-
updating?: boolean;
|
|
38
|
+
export interface ICartRetailerStore extends ICartRetailer {
|
|
39
|
+
loading: boolean;
|
|
40
|
+
error: string | null;
|
|
41
|
+
updating: boolean;
|
|
61
42
|
}
|
|
62
|
-
export interface
|
|
43
|
+
export interface ICartStore {
|
|
63
44
|
id: string;
|
|
64
|
-
name: string;
|
|
65
|
-
platformFee: number;
|
|
66
|
-
shippingFee: number;
|
|
67
45
|
subtotal: number;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
error?: string | null;
|
|
75
|
-
updating?: boolean;
|
|
76
|
-
}
|
|
77
|
-
export interface ICartPromoCodeStore {
|
|
78
|
-
code: string;
|
|
79
|
-
discountAmount: number;
|
|
80
|
-
}
|
|
81
|
-
export interface ICartStore {
|
|
82
|
-
id: string | null;
|
|
46
|
+
itemsQuantity: number;
|
|
47
|
+
items: Record<string, ICartItemStore>;
|
|
48
|
+
fulfillments: Record<string, ICartFulfillmentStore>;
|
|
49
|
+
retailers: Record<string, ICartRetailerStore>;
|
|
50
|
+
promoCode: ICartPromoCode | null;
|
|
51
|
+
events: IElementsCartEvent[];
|
|
83
52
|
loading: boolean;
|
|
84
53
|
error: string | null;
|
|
85
|
-
items: Record<string, ICartItemStore>;
|
|
86
|
-
totals: ICartTotalsStore;
|
|
87
|
-
retailers: Record<string, IRetailerStore>;
|
|
88
|
-
promoCode: ICartPromoCodeStore | null;
|
|
89
|
-
fulfillments: Record<string, IRetailerFulfillmentStore>;
|
|
90
54
|
rerender: boolean;
|
|
91
55
|
shouldReset: boolean;
|
|
92
|
-
updatedAt: string;
|
|
93
|
-
createdAt: string;
|
|
94
|
-
events: IElementsCartEvent[];
|
|
95
56
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IElementsCheckoutEvents } from 'utils/helper';
|
|
2
|
-
import type { ICartItemAttributes
|
|
2
|
+
import type { ICartItemAttributes } from '@/interfaces/api/cart.interface';
|
|
3
3
|
export interface ICheckoutMarketingPreferencesStore {
|
|
4
4
|
canEmail: boolean;
|
|
5
5
|
canSms: boolean;
|
|
@@ -134,7 +134,7 @@ export interface ICheckoutStore {
|
|
|
134
134
|
promoCode: ICheckoutPromoCodeStore | null;
|
|
135
135
|
giftCards: ICheckoutGiftCardStore[];
|
|
136
136
|
items: Record<string, ICheckoutItemStore>;
|
|
137
|
-
amounts:
|
|
137
|
+
amounts: any;
|
|
138
138
|
orderNumber: string | null;
|
|
139
139
|
onDemandFulfillmentTipInfo: Record<string, IOnDemandFulfillmentTipInfo>;
|
|
140
140
|
tipSelection: number;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { IAddressStore } from '@/core/store/interfaces/address.interface';
|
|
2
|
+
import type { ICartFulfillmentStore, ICartItemStore, ICartRetailerStore, ICartStore } from '@/core/store/interfaces/cart.interface';
|
|
2
3
|
import type { ICheckoutCustomerFormStore, ICheckoutGiftRecipientFormStore, ICheckoutGiftRecipientStore, ICheckoutItemStore, ICheckoutMarketingPreferencesStore, ICheckoutPaymentFormStore, ICheckoutPaymentMethodStore, ICheckoutPaymentSessionStore, ICheckoutPresaleStore, ICheckoutPromoCodeStore, ICheckoutStore } from '@/core/store/interfaces/checkout.interface';
|
|
3
4
|
import type { IProductSizeStore, IProductStore } from '@/core/store/interfaces/product.interface';
|
|
4
5
|
import type { ComponentType } from '@/enums';
|
|
5
|
-
import type {
|
|
6
|
+
import type { ICartPromoCode } from '@/interfaces/api/cart.interface';
|
|
6
7
|
export interface IDrawerContentConfig {
|
|
7
8
|
type: ComponentType;
|
|
8
9
|
data?: Record<string, any>;
|
|
@@ -25,7 +26,7 @@ export interface IPersistedStore {
|
|
|
25
26
|
p?: string;
|
|
26
27
|
c?: string;
|
|
27
28
|
}
|
|
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.
|
|
29
|
+
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 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
30
|
interface MiddlewareContext {
|
|
30
31
|
action: string;
|
|
31
32
|
payload: any;
|
|
@@ -10,7 +10,7 @@ import { LoggerFactory } from '@/core/logger/logger-factory';
|
|
|
10
10
|
import { StoreService } from '@/core/store/store.service';
|
|
11
11
|
import { TelemetryService } from '@/core/telemetry/telemetry.service';
|
|
12
12
|
import { type ComponentType } from '@/enums';
|
|
13
|
-
import type {
|
|
13
|
+
import type { IInjectProductElement, IInjectProductListParams, IInjectedComponent, 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
16
|
protected readonly authClient: AuthClientService;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { CartEventEnum, FulfillmentType } from '@/enums';
|
|
2
|
+
import type { ILocation } from '@/interfaces/api/address.interface';
|
|
3
|
+
import type { IProductPresale } from '@/interfaces/api/product.interface';
|
|
4
|
+
export interface ICartUpdateItem {
|
|
5
|
+
id?: string;
|
|
6
|
+
partNumber: string;
|
|
7
|
+
quantity: number;
|
|
8
|
+
fulfillmentId: string;
|
|
9
|
+
engravingLines?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface ICartUpdateParams {
|
|
12
|
+
id: string;
|
|
13
|
+
items: ICartUpdateItem[];
|
|
14
|
+
promoCode?: string;
|
|
15
|
+
location?: ILocation;
|
|
16
|
+
}
|
|
17
|
+
export interface ICartFulfillment {
|
|
18
|
+
id: string;
|
|
19
|
+
canEngrave: boolean;
|
|
20
|
+
type: FulfillmentType;
|
|
21
|
+
expectation: string;
|
|
22
|
+
itemIds: string[];
|
|
23
|
+
subtotal: number;
|
|
24
|
+
hasUnmetMinimumPurchaseAmount: boolean;
|
|
25
|
+
minimumPurchaseAmount: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ICartRetailer {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
subtotal: number;
|
|
31
|
+
itemsQuantity: number;
|
|
32
|
+
fulfillments: Record<string, ICartFulfillment>;
|
|
33
|
+
}
|
|
34
|
+
export interface ICartItemAttributes {
|
|
35
|
+
engraving: ICartItemEngraving;
|
|
36
|
+
presale: IProductPresale;
|
|
37
|
+
}
|
|
38
|
+
export interface ICartItem {
|
|
39
|
+
id: string;
|
|
40
|
+
variantId: string;
|
|
41
|
+
liquidId: string;
|
|
42
|
+
retailerId: string;
|
|
43
|
+
partNumber: string;
|
|
44
|
+
fulfillmentId: string;
|
|
45
|
+
upc: string;
|
|
46
|
+
sku: string;
|
|
47
|
+
salsifyGrouping: string;
|
|
48
|
+
catPath: string;
|
|
49
|
+
volume: string;
|
|
50
|
+
uom: string;
|
|
51
|
+
pack: boolean;
|
|
52
|
+
packDesc: string;
|
|
53
|
+
container: string;
|
|
54
|
+
containerType: string;
|
|
55
|
+
name: string;
|
|
56
|
+
brand: string;
|
|
57
|
+
size: string;
|
|
58
|
+
price: number;
|
|
59
|
+
quantity: number;
|
|
60
|
+
maxQuantity: number;
|
|
61
|
+
unitPrice: number;
|
|
62
|
+
mainImage: string;
|
|
63
|
+
attributes: ICartItemAttributes;
|
|
64
|
+
}
|
|
65
|
+
export interface ICartPromoCode {
|
|
66
|
+
code: string;
|
|
67
|
+
discountAmount: number;
|
|
68
|
+
}
|
|
69
|
+
export interface ICart {
|
|
70
|
+
id: string;
|
|
71
|
+
subtotal: number;
|
|
72
|
+
itemsQuantity: number;
|
|
73
|
+
items: Record<string, ICartItem>;
|
|
74
|
+
retailers: Record<string, ICartRetailer>;
|
|
75
|
+
promoCode: ICartPromoCode | null;
|
|
76
|
+
events: ICartEvent[];
|
|
77
|
+
}
|
|
78
|
+
export interface ICartItemEngraving {
|
|
79
|
+
isEngravable: boolean;
|
|
80
|
+
hasEngraving: boolean;
|
|
81
|
+
fee: number;
|
|
82
|
+
maxCharsPerLine: number;
|
|
83
|
+
maxLines: number;
|
|
84
|
+
location: string;
|
|
85
|
+
lines: string[];
|
|
86
|
+
}
|
|
87
|
+
export interface ICartEvent {
|
|
88
|
+
type: CartEventEnum;
|
|
89
|
+
message: string;
|
|
90
|
+
items?: Array<Partial<ICartItem>>;
|
|
91
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CheckoutEventEnum } from '@/enums';
|
|
2
2
|
import type { IAddressAddress } from '@/interfaces/api/address.interface';
|
|
3
|
+
import type { ICartItemAttributes } from '@/interfaces/api/cart.interface';
|
|
3
4
|
import type { ICoreParams } from '@/interfaces/cloud/core.interface';
|
|
4
|
-
import type { ICartAttributesPromoCode, ICartItemAttributes } from './cart.interface';
|
|
5
5
|
import type { IRetailerExpectation } from './retailer.interface';
|
|
6
6
|
export interface ICheckoutRecipient {
|
|
7
7
|
firstName?: string;
|
|
@@ -175,6 +175,13 @@ export interface ICheckoutEvents {
|
|
|
175
175
|
type: CheckoutEventEnum;
|
|
176
176
|
message: string;
|
|
177
177
|
}
|
|
178
|
+
export interface ICheckoutAttributesPromoCode {
|
|
179
|
+
value: string;
|
|
180
|
+
discount: number;
|
|
181
|
+
freeDelivery: boolean;
|
|
182
|
+
freeServiceFee: boolean;
|
|
183
|
+
freeShipping: boolean;
|
|
184
|
+
}
|
|
178
185
|
export interface ICheckoutPrepareResponse {
|
|
179
186
|
token: string;
|
|
180
187
|
cartId: string;
|
|
@@ -196,7 +203,7 @@ export interface ICheckoutPrepareResponse {
|
|
|
196
203
|
payment?: string;
|
|
197
204
|
giftCards: ICheckoutGiftCard[];
|
|
198
205
|
events: ICheckoutEvents[];
|
|
199
|
-
promoCode:
|
|
206
|
+
promoCode: ICheckoutAttributesPromoCode;
|
|
200
207
|
isPresaleLocked: boolean;
|
|
201
208
|
presaleExpiresAt: string | null;
|
|
202
209
|
}
|