@liquidcommerce/cloud-sdk 1.3.0 → 1.5.0
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 +378 -120
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/liquidcommerce-cloud-sdk.ssr.js +1 -1
- package/dist/types/constants/core.constant.d.ts +8 -0
- package/dist/types/core/cart-helper.service.d.ts +1 -1
- package/dist/types/core/catalog-helper.service.d.ts +24 -4
- package/dist/types/core/checkout-helper.service.d.ts +23 -8
- package/dist/types/core/location-helper.service.d.ts +4 -3
- package/dist/types/core/payment-provider.service.d.ts +16 -1
- package/dist/types/core/singleton.service.d.ts +9 -10
- package/dist/types/{enums.d.ts → enums/enums.d.ts} +62 -92
- package/dist/types/enums/index.d.ts +2 -0
- package/dist/types/enums/taxonomy.d.ts +285 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interfaces/address.interface.d.ts +86 -1
- package/dist/types/interfaces/cart.interface.d.ts +28 -10
- package/dist/types/interfaces/catalog.interface.d.ts +268 -8
- package/dist/types/interfaces/checkout.interface.d.ts +265 -50
- package/dist/types/interfaces/index.d.ts +8 -0
- package/dist/types/interfaces/liquid-commerce-client.interface.d.ts +34 -9
- package/dist/types/interfaces/payment.interface.d.ts +81 -2
- package/dist/types/interfaces/retailer.interface.d.ts +121 -0
- package/dist/types/interfaces/user.interface.d.ts +115 -8
- package/dist/types/liquid-commerce-client.d.ts +3 -192
- package/dist/types/services/address.service.d.ts +2 -18
- package/dist/types/services/cart.service.d.ts +1 -1
- package/dist/types/services/catalog.service.d.ts +1 -12
- package/dist/types/services/checkout.service.d.ts +1 -1
- package/dist/types/services/index.d.ts +5 -0
- package/dist/types/services/payment.service.d.ts +1 -1
- package/dist/types/services/user.service.d.ts +53 -1
- package/dist/types/types.d.ts +11 -5
- package/package.json +105 -105
- package/umd/liquidcommerce-cloud-sdk.min.js +1 -1
- package/dist/types/interfaces/catalog.service.interface.d.ts +0 -65
|
@@ -1,8 +1,250 @@
|
|
|
1
|
-
import type { ENUM_MODALITIES } from '../enums';
|
|
1
|
+
import type { ENUM_AVAILABILITY_VALUE, ENUM_ENGRAVING, ENUM_FILTER_KEYS, ENUM_MODALITIES, ENUM_NAVIGATION_ORDER_DIRECTION_TYPE, ENUM_ORDER_BY } from '../enums';
|
|
2
|
+
import type { LiquidTaxonomy } from '../types';
|
|
3
|
+
import type { ILocBase } from './address.interface';
|
|
4
|
+
import type { IRetailer } from './retailer.interface';
|
|
5
|
+
/**
|
|
6
|
+
* ICategoryFilter represents a filter specifically for categories.
|
|
7
|
+
*/
|
|
8
|
+
export interface ICategoryFilter {
|
|
9
|
+
key: ENUM_FILTER_KEYS.CATEGORIES | 'categories';
|
|
10
|
+
values: LiquidTaxonomy[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The IPriceFilter interface is used to define a structure for filtering
|
|
14
|
+
* items based on their price range.
|
|
15
|
+
*/
|
|
16
|
+
export interface IPriceFilter {
|
|
17
|
+
key: ENUM_FILTER_KEYS.PRICE | 'price';
|
|
18
|
+
values: {
|
|
19
|
+
min?: number | string;
|
|
20
|
+
max?: number | string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Interface representing a filter based on availability.
|
|
25
|
+
*
|
|
26
|
+
* @interface IAvailabilityFilter
|
|
27
|
+
*/
|
|
28
|
+
export interface IAvailabilityFilter {
|
|
29
|
+
key: ENUM_FILTER_KEYS.AVAILABILITY | 'availability';
|
|
30
|
+
values: ENUM_AVAILABILITY_VALUE | keyof typeof ENUM_AVAILABILITY_VALUE;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Interface representing a Fulfillment Filter used in search or sorting operations.
|
|
34
|
+
*/
|
|
35
|
+
export interface IFulfillmentFilter {
|
|
36
|
+
key: ENUM_FILTER_KEYS.FULFILLMENT | 'fulfillment';
|
|
37
|
+
values: [ENUM_MODALITIES];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Interface representing an engraving filter.
|
|
41
|
+
*
|
|
42
|
+
* This interface is used to define the properties for filtering items
|
|
43
|
+
* based on engraving criteria.
|
|
44
|
+
*
|
|
45
|
+
* Properties:
|
|
46
|
+
*
|
|
47
|
+
* - key: Indicates that the filter criteria is related to engraving.
|
|
48
|
+
* It can either be the ENUM_FILTER_KEYS.ENGRAVING enum value or the string 'engraving'.
|
|
49
|
+
*
|
|
50
|
+
* - values: Specifies the possible engraving values to filter by.
|
|
51
|
+
* It can either be from the ENUM_ENGRAVING enum or a key from the ENUM_ENGRAVING enum.
|
|
52
|
+
*/
|
|
53
|
+
export interface IEngravingFilter {
|
|
54
|
+
key: ENUM_FILTER_KEYS.ENGRAVING | 'engraving';
|
|
55
|
+
values: ENUM_ENGRAVING | keyof typeof ENUM_ENGRAVING;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Represents a filter interface for defining key-value pairs used in filtering operations.
|
|
59
|
+
*
|
|
60
|
+
* @type {IFilter} IFilter
|
|
61
|
+
*/
|
|
62
|
+
export interface IFilter {
|
|
63
|
+
key: Omit<ENUM_FILTER_KEYS, ENUM_FILTER_KEYS.CATEGORIES | ENUM_FILTER_KEYS.PRICE | ENUM_FILTER_KEYS.AVAILABILITY | ENUM_FILTER_KEYS.ENGRAVING | ENUM_FILTER_KEYS.FULFILLMENT>;
|
|
64
|
+
values: string | string[] | number | number[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Interface representing the parameters used for catalog search and navigation.
|
|
68
|
+
*/
|
|
69
|
+
export interface ICatalogParams extends ILocBase {
|
|
70
|
+
search?: string;
|
|
71
|
+
pageToken?: string;
|
|
72
|
+
entity?: string;
|
|
73
|
+
page?: number;
|
|
74
|
+
perPage?: number;
|
|
75
|
+
visitorId?: string;
|
|
76
|
+
orderBy?: ENUM_ORDER_BY;
|
|
77
|
+
orderDirection?: ENUM_NAVIGATION_ORDER_DIRECTION_TYPE;
|
|
78
|
+
filters?: Array<ICategoryFilter | IPriceFilter | IAvailabilityFilter | IFulfillmentFilter | IEngravingFilter | IFilter>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* ICatalog interface represents a structured collection of retailers, products, and navigation schema.
|
|
82
|
+
*/
|
|
83
|
+
export interface ICatalog {
|
|
84
|
+
retailers?: IRetailer[] | Array<Record<string, any>>;
|
|
85
|
+
products?: IProduct[] | Array<Record<string, any>>;
|
|
86
|
+
navigation?: INavigationSchema;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* IFilterValue interface represents a filterable value typically used in context
|
|
90
|
+
* with searching or sorting functionalities within an application.
|
|
91
|
+
* It is designed to hold a specific value and its associated count.
|
|
92
|
+
*/
|
|
93
|
+
export interface IFilterValue {
|
|
94
|
+
value: LiquidTaxonomy | ENUM_AVAILABILITY_VALUE | string;
|
|
95
|
+
count: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* FacetFilterKeys represents the possible keys that can be used to filter items in a faceted search.
|
|
99
|
+
* It encompasses a variety of attributes that can be used to refine search results, such as brands,
|
|
100
|
+
* flavor, region, price, availability, and more.
|
|
101
|
+
* Each key corresponds to an enumerated value in ENUM_FILTER_KEYS.
|
|
102
|
+
*/
|
|
103
|
+
export type FacetFilterKeys = ENUM_FILTER_KEYS.BRANDS | ENUM_FILTER_KEYS.FLAVOR | ENUM_FILTER_KEYS.REGION | ENUM_FILTER_KEYS.VARIETY | ENUM_FILTER_KEYS.ENGRAVING | ENUM_FILTER_KEYS.PRICE | ENUM_FILTER_KEYS.AVAILABILITY | ENUM_FILTER_KEYS.CATEGORIES | ENUM_FILTER_KEYS.SIZES | ENUM_FILTER_KEYS.COLORS | ENUM_FILTER_KEYS.APPELLATION | ENUM_FILTER_KEYS.COUNTRY | ENUM_FILTER_KEYS.VINTAGE | ENUM_FILTER_KEYS.MATERIALS | ENUM_FILTER_KEYS.TAGS;
|
|
104
|
+
/**
|
|
105
|
+
* IFilterSchema represents the structure for filtering datasets based on specific criteria.
|
|
106
|
+
*/
|
|
107
|
+
export interface IFilterSchema {
|
|
108
|
+
bucket: FacetFilterKeys;
|
|
109
|
+
values: IFilterValue[];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* ICursorSchema represents a schema interface that includes pagination tokens.
|
|
113
|
+
* This interface defines the structure for handling cursor-based pagination.
|
|
114
|
+
*/
|
|
115
|
+
export interface ICursorSchema {
|
|
116
|
+
nextPageToken: string;
|
|
117
|
+
previousPageToken: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Interface representing the schema for navigation data.
|
|
121
|
+
*/
|
|
122
|
+
export interface INavigationSchema {
|
|
123
|
+
id: string;
|
|
124
|
+
correctedQuery: string;
|
|
125
|
+
attributionToken: string;
|
|
126
|
+
currentPage: number;
|
|
127
|
+
totalPages: number;
|
|
128
|
+
totalCount: number;
|
|
129
|
+
availableOrderBy: ENUM_ORDER_BY[];
|
|
130
|
+
availableOrderDirection: ENUM_NAVIGATION_ORDER_DIRECTION_TYPE[];
|
|
131
|
+
cursor: ICursorSchema;
|
|
132
|
+
filters: IFilterSchema[];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Represents parameters for availability inquiries.
|
|
136
|
+
*/
|
|
137
|
+
export interface IAvailabilityParams extends ILocBase {
|
|
138
|
+
upcs?: string[];
|
|
139
|
+
grouping?: string[];
|
|
140
|
+
ids?: string[];
|
|
141
|
+
shouldShowOffHours?: boolean;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Interface representing the availability response.
|
|
145
|
+
*/
|
|
146
|
+
export interface IAvailabilityResponse {
|
|
147
|
+
products: IProduct[];
|
|
148
|
+
retailers: IRetailer[];
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Interface representing attributes related to images of a product.
|
|
152
|
+
*/
|
|
153
|
+
export interface IAttributesImage {
|
|
154
|
+
backOfBottle: string;
|
|
155
|
+
frontOfBottle: string;
|
|
156
|
+
lifestyle: string[];
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The IAttributesAward interface represents the structure of an award's attributes.
|
|
160
|
+
*/
|
|
161
|
+
export interface IAttributesAward {
|
|
162
|
+
image: string;
|
|
163
|
+
statement: string;
|
|
164
|
+
title: string;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Interface representing attributes of a recipe ingredient.
|
|
168
|
+
*/
|
|
169
|
+
export interface IAttributesRecipeIngredient {
|
|
170
|
+
name: string;
|
|
171
|
+
amount: string;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Interface for defining the attributes of a recipe.
|
|
175
|
+
*/
|
|
176
|
+
export interface IAttributesRecipe {
|
|
177
|
+
image: string;
|
|
178
|
+
ingredients: IAttributesRecipeIngredient[];
|
|
179
|
+
steps: string[];
|
|
180
|
+
title: string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Interface representing the attributes of a video.
|
|
184
|
+
*
|
|
185
|
+
* This interface includes properties for storing the video's link, image, and title.
|
|
186
|
+
*/
|
|
187
|
+
export interface IAttributesVideo {
|
|
188
|
+
link: string;
|
|
189
|
+
image: string;
|
|
190
|
+
title: string;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Interface representing the attributes of a tasting note.
|
|
194
|
+
*/
|
|
195
|
+
export interface IAttributesTastingNote {
|
|
196
|
+
statement: string;
|
|
197
|
+
image: string;
|
|
198
|
+
title: string;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Interface representing personalization attributes for an item.
|
|
202
|
+
*/
|
|
203
|
+
export interface IAttributesPersonalization {
|
|
204
|
+
type: string;
|
|
205
|
+
engravingMaxLines: number;
|
|
206
|
+
engravingMaxCharsPerLine: number;
|
|
207
|
+
location: string[];
|
|
208
|
+
width: number;
|
|
209
|
+
height: number;
|
|
210
|
+
image: string;
|
|
211
|
+
fee: number;
|
|
212
|
+
availableFrom: Date;
|
|
213
|
+
availableTo: Date;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* IAttributes interface represents the attributes of a product, including its origin,
|
|
217
|
+
* ownership type, tags, images, awards, recipes, videos, tasting notes, and personalizations.
|
|
218
|
+
*/
|
|
219
|
+
export interface IAttributes {
|
|
220
|
+
brandOrigin: string;
|
|
221
|
+
originStatement: string;
|
|
222
|
+
ownershipType: string[];
|
|
223
|
+
tags: string[];
|
|
224
|
+
images: IAttributesImage;
|
|
225
|
+
awards: IAttributesAward[];
|
|
226
|
+
recipes: IAttributesRecipe[];
|
|
227
|
+
video: IAttributesVideo[];
|
|
228
|
+
tastingNotes: IAttributesTastingNote[];
|
|
229
|
+
personalizations: IAttributesPersonalization[];
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Interface representing the types of product fulfillment options.
|
|
233
|
+
*
|
|
234
|
+
* Properties:
|
|
235
|
+
* - shipping: A string representing the shipping fulfillment type.
|
|
236
|
+
* - onDemand: A string representing the on-demand fulfillment type.
|
|
237
|
+
*/
|
|
2
238
|
export interface IProductFulfillmentTypes {
|
|
3
239
|
shipping: string;
|
|
4
240
|
onDemand: string;
|
|
5
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Represents a product variant in the system.
|
|
244
|
+
*
|
|
245
|
+
* This interface holds details about a specific variation of a product, including its
|
|
246
|
+
* part number, retailer ID, pricing information, and fulfillment options.
|
|
247
|
+
*/
|
|
6
248
|
export interface IProductVariant {
|
|
7
249
|
partNumber: string;
|
|
8
250
|
retailerId: string;
|
|
@@ -14,6 +256,9 @@ export interface IProductVariant {
|
|
|
14
256
|
fulfillments: string[];
|
|
15
257
|
fulfillmentTypes: IProductFulfillmentTypes;
|
|
16
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Represents the engraving details for a product size.
|
|
261
|
+
*/
|
|
17
262
|
export interface IProductSizeEngraving {
|
|
18
263
|
status: boolean;
|
|
19
264
|
validated?: boolean;
|
|
@@ -22,12 +267,26 @@ export interface IProductSizeEngraving {
|
|
|
22
267
|
fee: number;
|
|
23
268
|
location: string;
|
|
24
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* Interface representing attributes related to the size of a product.
|
|
272
|
+
*
|
|
273
|
+
* @property {IProductSizeEngraving} [engraving] - Optional engraving details for the product size.
|
|
274
|
+
*/
|
|
25
275
|
export interface IProductSizeAttributes {
|
|
26
276
|
engraving?: IProductSizeEngraving;
|
|
27
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* Represents the size details of a product in an inventory system.
|
|
280
|
+
*
|
|
281
|
+
* @interface IProductSize
|
|
282
|
+
*/
|
|
28
283
|
export interface IProductSize {
|
|
284
|
+
id: string;
|
|
285
|
+
salsifyPid?: string;
|
|
29
286
|
upc: string;
|
|
30
287
|
size: string;
|
|
288
|
+
volume: string;
|
|
289
|
+
uom: string;
|
|
31
290
|
image: string;
|
|
32
291
|
pack: boolean;
|
|
33
292
|
packDesc: string;
|
|
@@ -37,25 +296,25 @@ export interface IProductSize {
|
|
|
37
296
|
modalities?: ENUM_MODALITIES;
|
|
38
297
|
variants: IProductVariant[];
|
|
39
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* Represents a product with various attributes and details.
|
|
301
|
+
*/
|
|
40
302
|
export interface IProduct {
|
|
303
|
+
id?: string;
|
|
41
304
|
name: string;
|
|
42
305
|
brand: string;
|
|
43
306
|
catPath: string;
|
|
44
307
|
category: string;
|
|
45
308
|
classification: string;
|
|
46
309
|
type: string;
|
|
47
|
-
|
|
48
|
-
modalities?: ENUM_MODALITIES;
|
|
310
|
+
salsifyGrouping?: string;
|
|
49
311
|
subType: string;
|
|
50
312
|
region: string;
|
|
51
313
|
country: string;
|
|
52
314
|
material: string;
|
|
53
315
|
abv: string;
|
|
316
|
+
proof: string;
|
|
54
317
|
age: string;
|
|
55
|
-
pack?: boolean;
|
|
56
|
-
packDesc?: string;
|
|
57
|
-
container?: string;
|
|
58
|
-
containerType?: string;
|
|
59
318
|
color: string;
|
|
60
319
|
flavor: string;
|
|
61
320
|
variety: string;
|
|
@@ -64,6 +323,7 @@ export interface IProduct {
|
|
|
64
323
|
description: string;
|
|
65
324
|
htmlDescription: string;
|
|
66
325
|
tastingNotes: string;
|
|
67
|
-
images: string[]
|
|
326
|
+
images: string[] | Array<Record<string, any>>;
|
|
68
327
|
sizes: IProductSize[];
|
|
328
|
+
attributes?: Partial<IAttributes>;
|
|
69
329
|
}
|
|
@@ -1,118 +1,333 @@
|
|
|
1
1
|
import type { ICoreParams } from '../types';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { IAddress } from './address.interface';
|
|
3
|
+
import type { ICartItemAttributes } from './cart.interface';
|
|
4
|
+
import type { IRetailerExpectation } from './retailer.interface';
|
|
4
5
|
/**
|
|
5
6
|
* Represents a recipient of a checkout process.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* first name, last name, email address, phone number, birthdate,
|
|
10
|
-
* and an optional flag indicating if age verification is required.
|
|
11
|
-
*
|
|
12
|
-
* The ICheckoutRecipient interface is intended to be used in checkout
|
|
13
|
-
* processes where the recipient's information is required.
|
|
8
|
+
* Contains recipient's information such as name, contact details, and
|
|
9
|
+
* an optional flag for age verification.
|
|
14
10
|
*
|
|
15
11
|
* @interface
|
|
16
12
|
* @public
|
|
13
|
+
* @deprecated Use ICheckoutCustomer interface instead.
|
|
14
|
+
* ICheckoutRecipient will be removed in a future version.
|
|
17
15
|
*/
|
|
18
16
|
export interface ICheckoutRecipient {
|
|
19
|
-
firstName
|
|
20
|
-
lastName
|
|
21
|
-
email
|
|
22
|
-
phone
|
|
23
|
-
birthDate
|
|
17
|
+
firstName?: string;
|
|
18
|
+
lastName?: string;
|
|
19
|
+
email?: string;
|
|
20
|
+
phone?: string;
|
|
21
|
+
birthDate?: string;
|
|
24
22
|
hasAgeVerify?: boolean;
|
|
25
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Represents a traditional billing address structure.
|
|
26
|
+
*
|
|
27
|
+
* @interface
|
|
28
|
+
* @public
|
|
29
|
+
* @deprecated Use ICheckoutBillingAddress instead for better integration with customer data.
|
|
30
|
+
*/
|
|
31
|
+
export interface IBillingAddress {
|
|
32
|
+
firstName?: string;
|
|
33
|
+
lastName?: string;
|
|
34
|
+
email?: string;
|
|
35
|
+
phone?: string;
|
|
36
|
+
one?: string;
|
|
37
|
+
two?: string;
|
|
38
|
+
city?: string;
|
|
39
|
+
state?: string;
|
|
40
|
+
zip?: string;
|
|
41
|
+
country?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Represents a customer in a checkout process.
|
|
45
|
+
*
|
|
46
|
+
* Contains information about the customer, including identification,
|
|
47
|
+
* contact details, personal information, and timestamps for profile management.
|
|
48
|
+
*
|
|
49
|
+
* @interface
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export interface ICheckoutCustomer {
|
|
53
|
+
id?: string;
|
|
54
|
+
email?: string;
|
|
55
|
+
firstName?: string;
|
|
56
|
+
lastName?: string;
|
|
57
|
+
company?: string;
|
|
58
|
+
phone?: string;
|
|
59
|
+
profileImage?: string;
|
|
60
|
+
birthDate?: string;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated - Moved to ICheckoutPrepareParams
|
|
63
|
+
* @type {ICheckoutPrepareParams}
|
|
64
|
+
*/
|
|
65
|
+
hasAgeVerify?: boolean;
|
|
66
|
+
createdAt?: Date;
|
|
67
|
+
updatedAt?: Date;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Represents the base address information for a checkout process.
|
|
71
|
+
*
|
|
72
|
+
* @interface
|
|
73
|
+
*/
|
|
74
|
+
interface ICheckoutBaseAddress {
|
|
75
|
+
id?: string;
|
|
76
|
+
one?: string;
|
|
77
|
+
two?: string;
|
|
78
|
+
city?: string;
|
|
79
|
+
state?: string;
|
|
80
|
+
zip?: string;
|
|
81
|
+
country?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Represents the billing address in a checkout process.
|
|
85
|
+
*
|
|
86
|
+
* Combines base address information with customer details.
|
|
87
|
+
*
|
|
88
|
+
* @type
|
|
89
|
+
*/
|
|
90
|
+
export type ICheckoutBillingAddress = ICheckoutBaseAddress & Omit<ICheckoutCustomer, 'birthDate' | 'id' | 'createdAt' | 'hasAgeVerify' | 'updatedAt' | 'profileImage'>;
|
|
26
91
|
/**
|
|
27
92
|
* Represents the recipient information for gift options during checkout.
|
|
93
|
+
*
|
|
94
|
+
* @interface
|
|
28
95
|
*/
|
|
29
96
|
export interface ICheckoutGiftOptionsRecipient {
|
|
30
|
-
name
|
|
31
|
-
email
|
|
32
|
-
phone
|
|
97
|
+
name?: string;
|
|
98
|
+
email?: string;
|
|
99
|
+
phone?: string;
|
|
33
100
|
}
|
|
34
101
|
/**
|
|
35
|
-
*
|
|
102
|
+
* Represents the gift options for a checkout process.
|
|
103
|
+
*
|
|
104
|
+
* @interface
|
|
36
105
|
*/
|
|
37
106
|
export interface ICheckoutGiftOptions {
|
|
38
|
-
message
|
|
39
|
-
recipient
|
|
107
|
+
message?: string;
|
|
108
|
+
recipient?: ICheckoutGiftOptionsRecipient;
|
|
40
109
|
}
|
|
41
110
|
/**
|
|
42
111
|
* Represents the marketing preferences for a checkout.
|
|
43
112
|
*
|
|
44
|
-
* @interface
|
|
45
|
-
* @property {boolean} canEmail - Indicates whether the user allows email marketing.
|
|
46
|
-
* @property {boolean} canSms - Indicates whether the user allows SMS marketing.
|
|
113
|
+
* @interface
|
|
47
114
|
*/
|
|
48
115
|
export interface ICheckoutMarketingPreferences {
|
|
49
|
-
canEmail
|
|
50
|
-
canSms
|
|
116
|
+
canEmail?: boolean;
|
|
117
|
+
canSms?: boolean;
|
|
51
118
|
}
|
|
52
119
|
/**
|
|
53
120
|
* Represents the delivery tip for a checkout.
|
|
54
121
|
*
|
|
55
|
-
* @interface
|
|
56
|
-
* @property {string} fulfillmentId - The ID of the fulfillment.
|
|
57
|
-
* @property {number} tip - The amount of the tip.
|
|
122
|
+
* @interface
|
|
58
123
|
*/
|
|
59
124
|
export interface ICheckoutDeliveryTip {
|
|
60
125
|
fulfillmentId: string;
|
|
61
126
|
tip: number;
|
|
62
127
|
}
|
|
63
128
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
129
|
+
* Defines the parameters required for preparing a checkout.
|
|
130
|
+
*
|
|
131
|
+
* Extends the ICoreParams interface.
|
|
66
132
|
*
|
|
67
|
-
* @interface
|
|
68
|
-
* @extends {ICoreParams}
|
|
133
|
+
* @interface
|
|
69
134
|
*/
|
|
70
135
|
export interface ICheckoutPrepareParams extends ICoreParams {
|
|
71
136
|
cartId: string;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
137
|
+
customer?: ICheckoutCustomer | string;
|
|
138
|
+
/**
|
|
139
|
+
* @deprecated Use customer property instead. Recipient will be removed in a future version.
|
|
140
|
+
*/
|
|
141
|
+
recipient?: ICheckoutRecipient;
|
|
142
|
+
hasAgeVerify?: boolean;
|
|
143
|
+
shippingAddressTwo?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Billing address information supporting both new and legacy formats.
|
|
146
|
+
* Recommended to use ICheckoutBillingAddress format for new implementations.
|
|
147
|
+
*/
|
|
148
|
+
billingAddress?: ICheckoutBillingAddress | IBillingAddress;
|
|
149
|
+
hasSubstitutionPolicy?: boolean;
|
|
150
|
+
isGift?: boolean;
|
|
151
|
+
billingSameAsShipping?: boolean;
|
|
152
|
+
giftOptions?: ICheckoutGiftOptions;
|
|
153
|
+
marketingPreferences?: ICheckoutMarketingPreferences;
|
|
79
154
|
deliveryTips?: ICheckoutDeliveryTip[];
|
|
155
|
+
acceptedAccountCreation?: boolean;
|
|
156
|
+
scheduledDelivery?: string;
|
|
157
|
+
payment?: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Represents total amounts and discounts for a checkout process.
|
|
161
|
+
*
|
|
162
|
+
* @interface
|
|
163
|
+
*/
|
|
164
|
+
export interface ICheckoutTotalAmountsDiscounts {
|
|
165
|
+
products: number;
|
|
166
|
+
delivery: number;
|
|
167
|
+
shipping: number;
|
|
168
|
+
engraving: number;
|
|
169
|
+
service: number;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Represents various tax-related amounts in a checkout total.
|
|
173
|
+
*
|
|
174
|
+
* @interface
|
|
175
|
+
*/
|
|
176
|
+
export interface ICheckoutTotalAmountsTaxes {
|
|
177
|
+
bag: number;
|
|
178
|
+
bottleDeposits: number;
|
|
179
|
+
retailDelivery: number;
|
|
180
|
+
products: number;
|
|
181
|
+
delivery: number;
|
|
182
|
+
shipping: number;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Represents the details of the total amounts in the checkout process.
|
|
186
|
+
*
|
|
187
|
+
* @interface
|
|
188
|
+
*/
|
|
189
|
+
export interface ICheckoutTotalAmountsDetails {
|
|
190
|
+
taxes: ICheckoutTotalAmountsTaxes;
|
|
191
|
+
discounts: ICheckoutTotalAmountsDiscounts;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Represents the total amounts in a checkout process, including fees, discounts, and the final total.
|
|
195
|
+
*
|
|
196
|
+
* @interface
|
|
197
|
+
*/
|
|
198
|
+
export interface ICheckoutTotalAmounts {
|
|
199
|
+
subtotal: number;
|
|
200
|
+
engraving: number;
|
|
201
|
+
service: number;
|
|
202
|
+
shipping: number;
|
|
203
|
+
delivery: number;
|
|
204
|
+
platform: number;
|
|
205
|
+
discounts: number;
|
|
206
|
+
giftCards: number;
|
|
207
|
+
tax: number;
|
|
208
|
+
tip: number;
|
|
209
|
+
total: number;
|
|
210
|
+
details: ICheckoutTotalAmountsDetails;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Represents a fulfillment in the checkout process.
|
|
214
|
+
*
|
|
215
|
+
* Extends ICheckoutTotalAmounts.
|
|
216
|
+
*
|
|
217
|
+
* @interface
|
|
218
|
+
*/
|
|
219
|
+
export interface ICheckoutFulfillment extends ICheckoutTotalAmounts {
|
|
220
|
+
id: string;
|
|
221
|
+
scheduledFor?: string | Date;
|
|
222
|
+
type: 'shipping' | 'onDemand';
|
|
223
|
+
expectation: IRetailerExpectation;
|
|
224
|
+
items: string[];
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Represents a retailer in the checkout process.
|
|
228
|
+
*
|
|
229
|
+
* Extends ICheckoutTotalAmounts.
|
|
230
|
+
*
|
|
231
|
+
* @interface
|
|
232
|
+
*/
|
|
233
|
+
export interface ICheckoutRetailer extends ICheckoutTotalAmounts {
|
|
234
|
+
id: string;
|
|
235
|
+
name: string;
|
|
236
|
+
address?: IAddress;
|
|
237
|
+
fulfillments: ICheckoutFulfillment[];
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Represents an item in the checkout process.
|
|
241
|
+
*
|
|
242
|
+
* Contains detailed information about a product in the cart, including identifiers,
|
|
243
|
+
* product details, pricing, quantity, and additional attributes.
|
|
244
|
+
*
|
|
245
|
+
* @interface
|
|
246
|
+
*/
|
|
247
|
+
export interface ICheckoutItem {
|
|
248
|
+
variantId: string;
|
|
249
|
+
cartItemId: string;
|
|
250
|
+
liquidId: string;
|
|
251
|
+
retailerId: string;
|
|
252
|
+
fulfillmentId: string;
|
|
253
|
+
salsifyPid?: string;
|
|
254
|
+
salsifyGrouping?: string;
|
|
255
|
+
name: string;
|
|
256
|
+
catPath: string;
|
|
257
|
+
volume: string;
|
|
258
|
+
uom: string;
|
|
259
|
+
proof: string;
|
|
260
|
+
abv: string;
|
|
261
|
+
containerType: string;
|
|
262
|
+
container: string;
|
|
263
|
+
size: string;
|
|
264
|
+
pack: boolean;
|
|
265
|
+
packDesc: string;
|
|
266
|
+
mainImage: string;
|
|
267
|
+
/**
|
|
268
|
+
* @deprecated - use mainImage
|
|
269
|
+
*/
|
|
270
|
+
image: string;
|
|
271
|
+
brand: string;
|
|
272
|
+
partNumber: string;
|
|
273
|
+
upc: string;
|
|
274
|
+
price: number;
|
|
275
|
+
unitPrice: number;
|
|
276
|
+
quantity: number;
|
|
277
|
+
tax: number;
|
|
278
|
+
unitTax: number;
|
|
279
|
+
bottleDeposits: number;
|
|
280
|
+
attributes: ICartItemAttributes;
|
|
80
281
|
}
|
|
81
282
|
/**
|
|
82
283
|
* Represents a response object for preparing a checkout process.
|
|
83
284
|
*
|
|
84
|
-
* @interface
|
|
285
|
+
* @interface
|
|
85
286
|
*/
|
|
86
287
|
export interface ICheckoutPrepareResponse {
|
|
87
288
|
token: string;
|
|
289
|
+
cartId: string;
|
|
290
|
+
customer: ICheckoutCustomer;
|
|
88
291
|
hasAgeVerify: boolean;
|
|
89
|
-
marketingPreferences: ICheckoutMarketingPreferences;
|
|
90
292
|
hasSubstitutionPolicy: boolean;
|
|
91
293
|
isGift: boolean;
|
|
92
294
|
createdAt: string;
|
|
93
295
|
updatedAt: string;
|
|
94
296
|
billingSameAsShipping: boolean;
|
|
297
|
+
acceptedAccountCreation?: boolean;
|
|
95
298
|
giftOptions: ICheckoutGiftOptions;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
299
|
+
marketingPreferences: ICheckoutMarketingPreferences;
|
|
300
|
+
shippingAddress: IAddress;
|
|
301
|
+
/**
|
|
302
|
+
* Billing address information supporting both new and legacy formats.
|
|
303
|
+
* Recommended to use ICheckoutBillingAddress format for new implementations.
|
|
304
|
+
*/
|
|
305
|
+
billingAddress: ICheckoutBillingAddress | IBillingAddress;
|
|
306
|
+
amounts: ICheckoutTotalAmounts;
|
|
307
|
+
items: ICheckoutItem[];
|
|
308
|
+
retailers: ICheckoutRetailer[];
|
|
309
|
+
payment?: string;
|
|
102
310
|
}
|
|
103
311
|
/**
|
|
104
312
|
* Represents the parameters required for completing a checkout process.
|
|
313
|
+
*
|
|
314
|
+
* Extends ICoreParams.
|
|
315
|
+
*
|
|
105
316
|
* @interface
|
|
106
|
-
* @extends ICoreParams
|
|
107
317
|
*/
|
|
108
318
|
export interface ICheckoutCompleteParams extends ICoreParams {
|
|
109
319
|
token: string;
|
|
110
320
|
payment: string;
|
|
111
321
|
}
|
|
112
322
|
/**
|
|
113
|
-
*
|
|
323
|
+
* Represents the response object after completing the checkout process.
|
|
324
|
+
*
|
|
114
325
|
* @interface
|
|
115
326
|
*/
|
|
116
327
|
export interface ICheckoutCompleteResponse {
|
|
117
|
-
order:
|
|
328
|
+
order: {
|
|
329
|
+
number: string;
|
|
330
|
+
referenceId: string;
|
|
331
|
+
};
|
|
118
332
|
}
|
|
333
|
+
export {};
|