@liquidcommerce/cloud-sdk 1.6.0 → 1.8.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 +285 -103
- 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/core/authenticated.service.d.ts +6 -38
- package/dist/types/core/catalog-helper.service.d.ts +18 -5
- package/dist/types/core/checkout-helper.service.d.ts +9 -1
- package/dist/types/core/index.d.ts +3 -0
- package/dist/types/core/order-authenticated.service.d.ts +89 -0
- package/dist/types/core/order-singleton.service.d.ts +62 -0
- package/dist/types/core/payment-session-helper.service.d.ts +12 -0
- package/dist/types/core/singleton.service.d.ts +23 -3
- package/dist/types/core/utils.d.ts +48 -0
- package/dist/types/enums/enums.d.ts +70 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.umd.d.ts +2 -2
- package/dist/types/interfaces/address.interface.d.ts +2 -0
- package/dist/types/interfaces/cart.interface.d.ts +5 -15
- package/dist/types/interfaces/catalog.interface.d.ts +54 -6
- package/dist/types/interfaces/checkout.interface.d.ts +52 -57
- package/dist/types/interfaces/index.d.ts +3 -0
- package/dist/types/interfaces/liquid-commerce-client.interface.d.ts +83 -4
- package/dist/types/interfaces/liquid-commerce-order-client.interface.d.ts +54 -0
- package/dist/types/interfaces/order.interface.d.ts +197 -0
- package/dist/types/interfaces/payment-element.interface.d.ts +88 -0
- package/dist/types/interfaces/payment.interface.d.ts +11 -1
- package/dist/types/interfaces/retailer.interface.d.ts +2 -0
- package/dist/types/interfaces/user.interface.d.ts +13 -9
- package/dist/types/liquid-commerce-order-client.d.ts +19 -0
- package/dist/types/liquid-commerce-payment-element.d.ts +10 -0
- package/dist/types/services/index.d.ts +3 -0
- package/dist/types/services/order.service.d.ts +15 -0
- package/dist/types/services/user.service.d.ts +22 -4
- package/dist/types/services/webhook.service.d.ts +14 -0
- package/dist/types/types.d.ts +9 -0
- package/package.json +4 -4
- package/umd/liquidcommerce-cloud-sdk.min.js +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IUserSession } from '../interfaces';
|
|
2
|
+
export declare class PaymentSessionHelperService {
|
|
3
|
+
private static readonly F;
|
|
4
|
+
rcd(d: any, env: any): IUserSession;
|
|
5
|
+
private v;
|
|
6
|
+
private a;
|
|
7
|
+
private b;
|
|
8
|
+
ocd(ct: string, si: string): string;
|
|
9
|
+
gsi(s: string): string;
|
|
10
|
+
gdk(t: string): string;
|
|
11
|
+
dd<T>(d: any, t: string): T;
|
|
12
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import { CartService } from '../services
|
|
1
|
+
import type { LIQUID_COMMERCE_ENV } from '../enums';
|
|
2
|
+
import type { ILiquidCommerceClientConstructor, ILiquidCommercePaymentElement, IPaymentElementConfig, PaymentElementImplConstructor } from '../interfaces';
|
|
3
|
+
import { AddressService, CartService, CatalogService, CheckoutService, PaymentService, UserService, WebhookService } from '../services';
|
|
4
4
|
import type { ILiquidCommerceConfig } from '../types';
|
|
5
5
|
import { AuthenticatedService } from './authenticated.service';
|
|
6
6
|
import { CartHelperService } from './cart-helper.service';
|
|
@@ -8,6 +8,7 @@ import { CatalogHelperService } from './catalog-helper.service';
|
|
|
8
8
|
import { CheckoutHelperService } from './checkout-helper.service';
|
|
9
9
|
import { LocationHelperService } from './location-helper.service';
|
|
10
10
|
import { PaymentProviderService } from './payment-provider.service';
|
|
11
|
+
import { PaymentSessionHelperService } from './payment-session-helper.service';
|
|
11
12
|
/**
|
|
12
13
|
* The SingletonManager class is responsible for managing singleton instances of various services.
|
|
13
14
|
* It provides methods for retrieving or creating instances of these services based on unique keys.
|
|
@@ -16,6 +17,7 @@ export declare class SingletonManager {
|
|
|
16
17
|
private static instance;
|
|
17
18
|
private services;
|
|
18
19
|
private liquidCommerceClientConstructor;
|
|
20
|
+
private paymentElementConstructor;
|
|
19
21
|
static getInstance(): SingletonManager;
|
|
20
22
|
/**
|
|
21
23
|
* Sets the constructor for the Liquid Commerce Client.
|
|
@@ -25,6 +27,7 @@ export declare class SingletonManager {
|
|
|
25
27
|
* @return {void}
|
|
26
28
|
*/
|
|
27
29
|
setLiquidCommerceClientConstructor(constructor: ILiquidCommerceClientConstructor): void;
|
|
30
|
+
setPaymentElementConstructor(constructor: PaymentElementImplConstructor): void;
|
|
28
31
|
/**
|
|
29
32
|
* Retrieves or creates an instance of the LiquidCommerceClient.
|
|
30
33
|
*
|
|
@@ -34,6 +37,14 @@ export declare class SingletonManager {
|
|
|
34
37
|
* @throws {Error} - If the LiquidCommerceClient constructor is not set.
|
|
35
38
|
*/
|
|
36
39
|
getClient<T>(apiKey: string, config: ILiquidCommerceConfig): Promise<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Retrieves or creates an instance of the LiquidCommercePaymentElement.
|
|
42
|
+
*
|
|
43
|
+
* @param {IPaymentElementConfig} options - The configuration options for the payment element.
|
|
44
|
+
* @returns {ILiquidCommercePaymentElement} - An instance of ILiquidCommercePaymentElement.
|
|
45
|
+
* @throws {Error} - If the PaymentElement constructor is not set.
|
|
46
|
+
*/
|
|
47
|
+
getPaymentElement(options: IPaymentElementConfig): ILiquidCommercePaymentElement;
|
|
37
48
|
/**
|
|
38
49
|
* Returns an instance of a service based on the given key and ServiceClass.
|
|
39
50
|
* If the service does not exist, it creates a new instance using the ServiceClass and optional arguments.
|
|
@@ -56,6 +67,7 @@ export declare class SingletonManager {
|
|
|
56
67
|
getAuthenticatedClient(config: {
|
|
57
68
|
apiKey: string;
|
|
58
69
|
baseURL: string;
|
|
70
|
+
env: LIQUID_COMMERCE_ENV;
|
|
59
71
|
}): AuthenticatedService;
|
|
60
72
|
/**
|
|
61
73
|
* Retrieves the instance of the LocationHelperService.
|
|
@@ -91,6 +103,7 @@ export declare class SingletonManager {
|
|
|
91
103
|
* @return {CartHelperService} The CartHelperService instance.
|
|
92
104
|
*/
|
|
93
105
|
getCartHelperService(): CartHelperService;
|
|
106
|
+
getPaymentSessionHelperService(): PaymentSessionHelperService;
|
|
94
107
|
/**
|
|
95
108
|
* Retrieves the CartService instance associated with the given authenticated client.
|
|
96
109
|
*
|
|
@@ -134,4 +147,11 @@ export declare class SingletonManager {
|
|
|
134
147
|
* @return The CheckoutService instance.
|
|
135
148
|
*/
|
|
136
149
|
getCheckoutService(authenticatedClient: AuthenticatedService): CheckoutService;
|
|
150
|
+
/**
|
|
151
|
+
* Retrieves the WebhookService instance for the provided authenticated client.
|
|
152
|
+
*
|
|
153
|
+
* @param authenticatedClient - The authenticated client object.
|
|
154
|
+
* @return The WebhookService instance.
|
|
155
|
+
*/
|
|
156
|
+
getWebhookService(authenticatedClient: AuthenticatedService): WebhookService;
|
|
137
157
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type FetchFunction = typeof fetch;
|
|
2
|
+
export interface IHttpClientOptions {
|
|
3
|
+
method: string;
|
|
4
|
+
headers: Record<string, string>;
|
|
5
|
+
body?: string;
|
|
6
|
+
}
|
|
7
|
+
export type HttpClient = (url: string, options: IHttpClientOptions) => Promise<ICustomResponse>;
|
|
8
|
+
export interface IRequestOptions {
|
|
9
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
body?: any;
|
|
12
|
+
}
|
|
13
|
+
export interface ICustomResponse {
|
|
14
|
+
ok: boolean;
|
|
15
|
+
status: number;
|
|
16
|
+
statusText: string;
|
|
17
|
+
headers: Record<string, string>;
|
|
18
|
+
json: () => Promise<any>;
|
|
19
|
+
text: () => Promise<string>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns a HttpClient function that wraps the provided fetch function.
|
|
23
|
+
*
|
|
24
|
+
* @param {FetchFunction} fetchFunc - The fetch function to be wrapped.
|
|
25
|
+
*
|
|
26
|
+
* @return {HttpClient} - The HttpClient function that makes network requests using the provided fetch function.
|
|
27
|
+
*/
|
|
28
|
+
export declare function fetchAdapter(fetchFunc: FetchFunction): HttpClient;
|
|
29
|
+
/**
|
|
30
|
+
* Sends an HTTP request using XMLHttpRequest and returns a Promise that resolves to a custom response object.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} url - The URL to send the request to.
|
|
33
|
+
* @param {IHttpClientOptions} options - The options for the HTTP request.
|
|
34
|
+
* @returns {Promise<ICustomResponse>} - A Promise that resolves to a custom response object.
|
|
35
|
+
* @throws {TypeError} - If the network request fails.
|
|
36
|
+
*/
|
|
37
|
+
export declare const xhrFetch: HttpClient;
|
|
38
|
+
/**
|
|
39
|
+
* Returns the appropriate implementation of the `HttpClient` interface for making HTTP requests.
|
|
40
|
+
*
|
|
41
|
+
* If the `fetch` function is available, it will be used to create a new `HttpClient` instance by calling the `fetchAdapter` method.
|
|
42
|
+
* If the `fetch` function is not available but the `global.fetch` function is defined, the `global.fetch` function will be used.
|
|
43
|
+
* If neither the `fetch` function nor the `global.fetch` function is available, but the `window.fetch` function is defined, the `window.fetch` function will be used.
|
|
44
|
+
* If none of the above conditions are met, the `xhrFetch` property will be returned.
|
|
45
|
+
*
|
|
46
|
+
* @return The appropriate implementation of the `HttpClient` interface.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getFetchImplementation(): HttpClient;
|
|
@@ -21,6 +21,7 @@ export declare enum STATES_CODE {
|
|
|
21
21
|
AL = "AL",
|
|
22
22
|
AK = "AK",
|
|
23
23
|
AR = "AR",
|
|
24
|
+
AZ = "AZ",
|
|
24
25
|
CA = "CA",
|
|
25
26
|
CO = "CO",
|
|
26
27
|
CT = "CT",
|
|
@@ -73,6 +74,7 @@ export declare enum STATES_NAME {
|
|
|
73
74
|
ALABAMA = "AL",
|
|
74
75
|
ALASKA = "AK",
|
|
75
76
|
ARKANSAS = "AR",
|
|
77
|
+
ARIZONA = "AZ",
|
|
76
78
|
CALIFORNIA = "CA",
|
|
77
79
|
COLORADO = "CO",
|
|
78
80
|
CONNECTICUT = "CT",
|
|
@@ -125,6 +127,10 @@ export declare enum ENUM_ENGRAVING {
|
|
|
125
127
|
YES = "YES",
|
|
126
128
|
NO = "NO"
|
|
127
129
|
}
|
|
130
|
+
export declare enum ENUM_BINARY_FILTER {
|
|
131
|
+
YES = "YES",
|
|
132
|
+
NO = "NO"
|
|
133
|
+
}
|
|
128
134
|
export declare enum ENUM_FILTER_KEYS {
|
|
129
135
|
BRANDS = "brands",
|
|
130
136
|
FLAVOR = "flavor",
|
|
@@ -134,6 +140,7 @@ export declare enum ENUM_FILTER_KEYS {
|
|
|
134
140
|
VARIETY = "variety",
|
|
135
141
|
ENGRAVING = "engraving",
|
|
136
142
|
PRICE = "price",
|
|
143
|
+
PRESALE = "presale",
|
|
137
144
|
AVAILABILITY = "availability",
|
|
138
145
|
CATEGORIES = "categories",
|
|
139
146
|
SIZES = "sizes",
|
|
@@ -182,7 +189,31 @@ export declare enum CART_EVENT_ENUM {
|
|
|
182
189
|
DEFAULT = "CartError",
|
|
183
190
|
ITEM_QTY_CHANGE = "ItemQuantityChange",
|
|
184
191
|
ITEM_ID_NOT_FOUND = "ItemIdNotFound",
|
|
185
|
-
ITEMS_REMOVED = "ItemsRemoved"
|
|
192
|
+
ITEMS_REMOVED = "ItemsRemoved",
|
|
193
|
+
RETAILER_FULFILLMENT_INVALID = "RetailerFulfillmentInvalid",
|
|
194
|
+
COUPON_PROCESSING_ERROR = "CouponProcessingError",
|
|
195
|
+
COUPON_NOT_FOUND = "CouponNotFound",
|
|
196
|
+
COUPON_EXPIRED = "CouponExpired",
|
|
197
|
+
NO_APPLICABLE_DISCOUNT = "NoApplicableDiscount",
|
|
198
|
+
COUPON_NOT_STARTED = "CouponNotStarted",
|
|
199
|
+
MINIMUM_ORDER_VALUE_NOT_MET = "MinimumOrderValueNotMet",
|
|
200
|
+
MINIMUM_ORDER_UNITS_NOT_MET = "MinimumOrderUnitsNotMet",
|
|
201
|
+
MINIMUM_DISTINCT_ITEMS_NOT_MET = "MinimumDistinctItemsNotMet",
|
|
202
|
+
QUOTA_EXCEEDED = "QuotaExceeded",
|
|
203
|
+
USER_LIMIT_EXCEEDED = "UserLimitExceeded",
|
|
204
|
+
NOT_FIRST_PURCHASE = "NotFirstPurchase",
|
|
205
|
+
INVALID_COUPON = "InvalidCoupon",
|
|
206
|
+
INVALID_MEMBERSHIP = "InvalidMembership",
|
|
207
|
+
INVALID_DOMAIN = "InvalidDomain",
|
|
208
|
+
INVALID_REQUIREMENTS = "InvalidRequirements",
|
|
209
|
+
INVALID_ORGANIZATION = "InvalidOrganization",
|
|
210
|
+
PRODUCT_NOT_ELIGIBLE = "ProductNotEligible",
|
|
211
|
+
NOT_ENOUGH_PREVIOUS_ORDERS = "NotEnoughPreviousOrders",
|
|
212
|
+
PRESALE_ITEMS_NOT_ALLOWED = "PresaleItemsNotAllowed",
|
|
213
|
+
PRESALE_LIMIT_EXCEEDED = "PresaleLimitExceeded",
|
|
214
|
+
PRESALE_NOT_STARTED = "PresaleNotStarted",
|
|
215
|
+
PRESALE_EXPIRED = "PresaleExpired",
|
|
216
|
+
PRESALE_MIXED_CART = "PresaleMixedCart"
|
|
186
217
|
}
|
|
187
218
|
export declare enum ENUM_ADDRESS_TYPE {
|
|
188
219
|
SHIPPING = "shipping",
|
|
@@ -238,3 +269,41 @@ export declare enum ENUM_CHECKOUT_STATUS_CODE_MESSAGE {
|
|
|
238
269
|
REQUEST_ADDRESS_DEFAULT_ERROR = "There's been an error with your address configurations in cart and/or billing address, check and try again.",
|
|
239
270
|
REQUEST_TIPS_ERROR = "There's been an error applying your tips to the checkout."
|
|
240
271
|
}
|
|
272
|
+
export declare enum CHECKOUT_EVENT_ENUM {
|
|
273
|
+
ERROR_PROCESSING_GIFT_CARDS = "ErrorProcessingGiftCards",
|
|
274
|
+
INVALID_GIFT_CARD_CODE = "InvalidGiftCardCodes",
|
|
275
|
+
INVALID_GIFT_CARD_PARTNER = "InvalidGiftCardPartner",
|
|
276
|
+
INACTIVE_GIFT_CARD = "InactiveGiftCard",
|
|
277
|
+
GIFT_CARD_ALREADY_IN_USE = "GiftCardAlreadyInUse",
|
|
278
|
+
GIFT_CARD_EXPIRED = "GiftCardExpired",
|
|
279
|
+
GIFT_CARD_BALANCE_DEPLETED = "GiftCardBalanceDepleted"
|
|
280
|
+
}
|
|
281
|
+
export declare enum ENUM_ORDER_STATUS {
|
|
282
|
+
CREATED = "created",
|
|
283
|
+
PROCESSING = "processing",
|
|
284
|
+
CANCELED = "canceled",
|
|
285
|
+
DELIVERED = "delivered",
|
|
286
|
+
TEST = "test"
|
|
287
|
+
}
|
|
288
|
+
export declare enum ENUM_ORDER_SYSTEM {
|
|
289
|
+
LIQUIDCOMMERCE = "LiquidCommerce OMS",
|
|
290
|
+
RESERVEBAR = "ReserveBar OMS"
|
|
291
|
+
}
|
|
292
|
+
export declare enum ENUM_ORDER_PACKAGE_STATUS {
|
|
293
|
+
PENDING = "pending",
|
|
294
|
+
SHIPPED = "shipped",
|
|
295
|
+
DELIVERED = "delivered",
|
|
296
|
+
CANCELED = "canceled",
|
|
297
|
+
RETURNED = "returned"
|
|
298
|
+
}
|
|
299
|
+
export declare enum ENUM_ORDER_FULFILLMENT_TYPE {
|
|
300
|
+
SHIPPING = "shipping",
|
|
301
|
+
ON_DEMAND = "onDemand",
|
|
302
|
+
DIGITAL = "digital",
|
|
303
|
+
BOPIS = "bopis"
|
|
304
|
+
}
|
|
305
|
+
export declare enum ENUM_CUSTOMER_PLACEMENT {
|
|
306
|
+
STANDARD = "standard",
|
|
307
|
+
PRE_SALE = "pre_sale",
|
|
308
|
+
BACK_ORDER = "back_order"
|
|
309
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { LIQUID_COMMERCE_ENV, LiquidCommerce } from './index';
|
|
2
|
-
export { LIQUID_COMMERCE_ENV, LiquidCommerce };
|
|
1
|
+
import { LIQUID_COMMERCE_ENV, LiquidCommerce, LiquidCommerceOrders, LiquidCommercePaymentElement } from './index';
|
|
2
|
+
export { LIQUID_COMMERCE_ENV, LiquidCommerce, LiquidCommerceOrders, LiquidCommercePaymentElement };
|
|
@@ -99,8 +99,10 @@ export interface IAddressDetailsParams extends ICoreParams {
|
|
|
99
99
|
*
|
|
100
100
|
* @property {string} formattedAddress - The formatted address as a string.
|
|
101
101
|
* @property {ICoords} coords - The coordinates associated with the address.
|
|
102
|
+
* @property {Omit<IAddress, 'id'>} address - The address object containing all address fields except the id property.
|
|
102
103
|
*/
|
|
103
104
|
export interface IAddressDetailsResult {
|
|
104
105
|
formattedAddress: string;
|
|
105
106
|
coords: ICoords;
|
|
107
|
+
address: Omit<IAddress, 'id'>;
|
|
106
108
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CART_EVENT_ENUM } from '../enums';
|
|
2
2
|
import type { ILoc, ILocBase } from './address.interface';
|
|
3
|
-
import type { IProduct } from './catalog.interface';
|
|
3
|
+
import type { IProduct, IProductPresale } from './catalog.interface';
|
|
4
4
|
import type { IRetailer } from './retailer.interface';
|
|
5
5
|
/**
|
|
6
6
|
* Represents the engraving information for a cart item.
|
|
@@ -44,6 +44,7 @@ export interface ICartItemGiftCart {
|
|
|
44
44
|
*/
|
|
45
45
|
export interface ICartItemAttributes {
|
|
46
46
|
engraving: ICartItemEngraving;
|
|
47
|
+
presale: IProductPresale;
|
|
47
48
|
giftCard: ICartItemGiftCart;
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
@@ -60,6 +61,7 @@ export interface ICartItem extends Partial<Omit<IProduct, 'attributes'>> {
|
|
|
60
61
|
salsifyPid?: string;
|
|
61
62
|
partNumber: string;
|
|
62
63
|
upc: string;
|
|
64
|
+
sku: string;
|
|
63
65
|
name: string;
|
|
64
66
|
brand: string;
|
|
65
67
|
size: string;
|
|
@@ -92,18 +94,6 @@ export interface ICartAttributesPromoCode {
|
|
|
92
94
|
freeServiceFee: boolean;
|
|
93
95
|
freeShipping: boolean;
|
|
94
96
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Represents the attributes of a gift card in a cart.
|
|
97
|
-
*
|
|
98
|
-
* @interface ICartAttributesGiftCard
|
|
99
|
-
*
|
|
100
|
-
* @property {string} code - The code of the gift card.
|
|
101
|
-
* @property {number} value - The value of the gift card in the cart.
|
|
102
|
-
*/
|
|
103
|
-
export interface ICartAttributesGiftCard {
|
|
104
|
-
code: string;
|
|
105
|
-
value: number;
|
|
106
|
-
}
|
|
107
97
|
/**
|
|
108
98
|
* Represents the attributes, amounts, and fees associated with a cart.
|
|
109
99
|
*/
|
|
@@ -135,7 +125,6 @@ export interface ICartAttributesAmounts {
|
|
|
135
125
|
*/
|
|
136
126
|
export interface ICartAttributes {
|
|
137
127
|
promoCode: ICartAttributesPromoCode;
|
|
138
|
-
giftCards: ICartAttributesGiftCard[];
|
|
139
128
|
amounts: ICartAttributesAmounts;
|
|
140
129
|
}
|
|
141
130
|
/**
|
|
@@ -174,6 +163,8 @@ export interface ICart {
|
|
|
174
163
|
giftCardTotal: number;
|
|
175
164
|
subtotal: number;
|
|
176
165
|
total: number;
|
|
166
|
+
isPresaleLocked: boolean;
|
|
167
|
+
presaleExpiresAt: string | null;
|
|
177
168
|
createdAt: string | Date;
|
|
178
169
|
updatedAt: string | Date;
|
|
179
170
|
items: ICartItem[];
|
|
@@ -202,5 +193,4 @@ export interface ICartUpdateParams extends ILocBase {
|
|
|
202
193
|
id: string;
|
|
203
194
|
items: ICartUpdateItem[];
|
|
204
195
|
promoCode?: string;
|
|
205
|
-
giftCards?: string[];
|
|
206
196
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ENUM_AVAILABILITY_VALUE, ENUM_ENGRAVING, ENUM_FILTER_KEYS, ENUM_MODALITIES, ENUM_NAVIGATION_ORDER_DIRECTION_TYPE, ENUM_ORDER_BY } from '../enums';
|
|
1
|
+
import type { ENUM_AVAILABILITY_VALUE, ENUM_BINARY_FILTER, ENUM_ENGRAVING, ENUM_FILTER_KEYS, ENUM_MODALITIES, ENUM_NAVIGATION_ORDER_DIRECTION_TYPE, ENUM_ORDER_BY } from '../enums';
|
|
2
2
|
import type { LiquidTaxonomy } from '../types';
|
|
3
3
|
import type { ILocBase } from './address.interface';
|
|
4
4
|
import type { IRetailer } from './retailer.interface';
|
|
@@ -52,7 +52,18 @@ export interface IFulfillmentFilter {
|
|
|
52
52
|
*/
|
|
53
53
|
export interface IEngravingFilter {
|
|
54
54
|
key: ENUM_FILTER_KEYS.ENGRAVING | 'engraving';
|
|
55
|
-
values: ENUM_ENGRAVING | keyof typeof ENUM_ENGRAVING;
|
|
55
|
+
values: ENUM_BINARY_FILTER | keyof typeof ENUM_BINARY_FILTER | ENUM_ENGRAVING | keyof typeof ENUM_ENGRAVING;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The IPresaleFilter interface defines the structure for filtering presale items in a given context.
|
|
59
|
+
* It includes properties for specifying the filter key and the filter values.
|
|
60
|
+
*
|
|
61
|
+
* @property {ENUM_FILTER_KEYS.PRESALE | 'presale'} key - The key indicating the type of filter, specific to presale.
|
|
62
|
+
* @property {ENUM_BINARY_FILTER | keyof typeof ENUM_BINARY_FILTER} values - The values associated with the presale filter, which can be enumerable binary filter values.
|
|
63
|
+
*/
|
|
64
|
+
export interface IPresaleFilter {
|
|
65
|
+
key: ENUM_FILTER_KEYS.PRESALE | 'presale';
|
|
66
|
+
values: ENUM_BINARY_FILTER | keyof typeof ENUM_BINARY_FILTER;
|
|
56
67
|
}
|
|
57
68
|
/**
|
|
58
69
|
* Represents a filter interface for defining key-value pairs used in filtering operations.
|
|
@@ -73,9 +84,10 @@ export interface ICatalogParams extends ILocBase {
|
|
|
73
84
|
page?: number;
|
|
74
85
|
perPage?: number;
|
|
75
86
|
visitorId?: string;
|
|
87
|
+
retailers?: string[];
|
|
76
88
|
orderBy?: ENUM_ORDER_BY;
|
|
77
89
|
orderDirection?: ENUM_NAVIGATION_ORDER_DIRECTION_TYPE;
|
|
78
|
-
filters?: Array<ICategoryFilter | IPriceFilter | IAvailabilityFilter | IFulfillmentFilter | IEngravingFilter | IFilter>;
|
|
90
|
+
filters?: Array<ICategoryFilter | IPriceFilter | IAvailabilityFilter | IFulfillmentFilter | IEngravingFilter | IPresaleFilter | IFilter>;
|
|
79
91
|
}
|
|
80
92
|
/**
|
|
81
93
|
* ICatalog interface represents a structured collection of retailers, products, and navigation schema.
|
|
@@ -91,7 +103,7 @@ export interface ICatalog {
|
|
|
91
103
|
* It is designed to hold a specific value and its associated count.
|
|
92
104
|
*/
|
|
93
105
|
export interface IFilterValue {
|
|
94
|
-
value: LiquidTaxonomy | ENUM_AVAILABILITY_VALUE | string;
|
|
106
|
+
value: LiquidTaxonomy | ENUM_AVAILABILITY_VALUE | ENUM_BINARY_FILTER | string;
|
|
95
107
|
count: number;
|
|
96
108
|
}
|
|
97
109
|
/**
|
|
@@ -100,7 +112,7 @@ export interface IFilterValue {
|
|
|
100
112
|
* flavor, region, price, availability, and more.
|
|
101
113
|
* Each key corresponds to an enumerated value in ENUM_FILTER_KEYS.
|
|
102
114
|
*/
|
|
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;
|
|
115
|
+
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.PRESALE | 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
116
|
/**
|
|
105
117
|
* IFilterSchema represents the structure for filtering datasets based on specific criteria.
|
|
106
118
|
*/
|
|
@@ -267,13 +279,37 @@ export interface IProductSizeEngraving {
|
|
|
267
279
|
fee: number;
|
|
268
280
|
location: string;
|
|
269
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* Interface representing a product presale.
|
|
284
|
+
*
|
|
285
|
+
* @interface IProductPresale
|
|
286
|
+
*
|
|
287
|
+
* @property {null | string} canPurchaseOn - The date when the product can be added to the cart.
|
|
288
|
+
* If null, the canPurchaseOn date is not set.
|
|
289
|
+
*
|
|
290
|
+
* @property {null | string} estimatedShipBy - The date when the product is expected to ship.
|
|
291
|
+
* If null, the estimatedShipBy date is not set.
|
|
292
|
+
*
|
|
293
|
+
* @property {boolean} isActive - Indicates whether the presale is currently active.
|
|
294
|
+
*
|
|
295
|
+
* @property {string} language - The language associated with the product presale.
|
|
296
|
+
*/
|
|
297
|
+
export interface IProductPresale {
|
|
298
|
+
canPurchaseOn: null | string;
|
|
299
|
+
estimatedShipBy: null | string;
|
|
300
|
+
isActive: boolean;
|
|
301
|
+
language: string;
|
|
302
|
+
}
|
|
270
303
|
/**
|
|
271
304
|
* Interface representing attributes related to the size of a product.
|
|
272
305
|
*
|
|
273
306
|
* @property {IProductSizeEngraving} [engraving] - Optional engraving details for the product size.
|
|
274
307
|
*/
|
|
275
308
|
export interface IProductSizeAttributes {
|
|
276
|
-
|
|
309
|
+
salsifyPid?: string;
|
|
310
|
+
salsifyGrouping?: string;
|
|
311
|
+
presale: IProductPresale;
|
|
312
|
+
engraving: IProductSizeEngraving;
|
|
277
313
|
}
|
|
278
314
|
/**
|
|
279
315
|
* Represents the size details of a product in an inventory system.
|
|
@@ -296,6 +332,17 @@ export interface IProductSize {
|
|
|
296
332
|
modalities?: ENUM_MODALITIES;
|
|
297
333
|
variants: IProductVariant[];
|
|
298
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* Represents product price information.
|
|
337
|
+
*
|
|
338
|
+
* @interface IProductPriceInfo
|
|
339
|
+
*/
|
|
340
|
+
export interface IProductPriceInfo {
|
|
341
|
+
currency: string;
|
|
342
|
+
minimum: number;
|
|
343
|
+
average: number;
|
|
344
|
+
maximum: number;
|
|
345
|
+
}
|
|
299
346
|
/**
|
|
300
347
|
* Represents a product with various attributes and details.
|
|
301
348
|
*/
|
|
@@ -326,4 +373,5 @@ export interface IProduct {
|
|
|
326
373
|
images: string[] | Array<Record<string, any>>;
|
|
327
374
|
sizes: IProductSize[];
|
|
328
375
|
attributes?: Partial<IAttributes>;
|
|
376
|
+
priceInfo: IProductPriceInfo | null;
|
|
329
377
|
}
|
|
@@ -1,45 +1,8 @@
|
|
|
1
|
+
import type { CHECKOUT_EVENT_ENUM } from '../enums';
|
|
1
2
|
import type { ICoreParams } from '../types';
|
|
2
3
|
import type { IAddress } from './address.interface';
|
|
3
4
|
import type { ICartItemAttributes } from './cart.interface';
|
|
4
5
|
import type { IRetailerExpectation } from './retailer.interface';
|
|
5
|
-
/**
|
|
6
|
-
* Represents a recipient of a checkout process.
|
|
7
|
-
*
|
|
8
|
-
* Contains recipient's information such as name, contact details, and
|
|
9
|
-
* an optional flag for age verification.
|
|
10
|
-
*
|
|
11
|
-
* @interface
|
|
12
|
-
* @public
|
|
13
|
-
* @deprecated Use ICheckoutCustomer interface instead.
|
|
14
|
-
* ICheckoutRecipient will be removed in a future version.
|
|
15
|
-
*/
|
|
16
|
-
export interface ICheckoutRecipient {
|
|
17
|
-
firstName?: string;
|
|
18
|
-
lastName?: string;
|
|
19
|
-
email?: string;
|
|
20
|
-
phone?: string;
|
|
21
|
-
birthDate?: string;
|
|
22
|
-
hasAgeVerify?: boolean;
|
|
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
6
|
/**
|
|
44
7
|
* Represents a customer in a checkout process.
|
|
45
8
|
*
|
|
@@ -58,11 +21,6 @@ export interface ICheckoutCustomer {
|
|
|
58
21
|
phone?: string;
|
|
59
22
|
profileImage?: string;
|
|
60
23
|
birthDate?: string;
|
|
61
|
-
/**
|
|
62
|
-
* @deprecated - Moved to ICheckoutPrepareParams
|
|
63
|
-
* @type {ICheckoutPrepareParams}
|
|
64
|
-
*/
|
|
65
|
-
hasAgeVerify?: boolean;
|
|
66
24
|
createdAt?: Date;
|
|
67
25
|
updatedAt?: Date;
|
|
68
26
|
}
|
|
@@ -117,7 +75,7 @@ export interface ICheckoutMarketingPreferences {
|
|
|
117
75
|
canSms?: boolean;
|
|
118
76
|
}
|
|
119
77
|
/**
|
|
120
|
-
* Represents the delivery tip for a checkout.
|
|
78
|
+
* Represents the delivery tip for a checkout's specific fulfillment method.
|
|
121
79
|
*
|
|
122
80
|
* @interface
|
|
123
81
|
*/
|
|
@@ -125,6 +83,15 @@ export interface ICheckoutDeliveryTip {
|
|
|
125
83
|
fulfillmentId: string;
|
|
126
84
|
tip: number;
|
|
127
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Represents the delivery instructions for a checkout's specific fulfillment method.
|
|
88
|
+
*
|
|
89
|
+
* @interface
|
|
90
|
+
*/
|
|
91
|
+
export interface ICheckoutDeliveryInstructions {
|
|
92
|
+
fulfillmentId: string;
|
|
93
|
+
instructions: string;
|
|
94
|
+
}
|
|
128
95
|
/**
|
|
129
96
|
* Defines the parameters required for preparing a checkout.
|
|
130
97
|
*
|
|
@@ -135,26 +102,24 @@ export interface ICheckoutDeliveryTip {
|
|
|
135
102
|
export interface ICheckoutPrepareParams extends ICoreParams {
|
|
136
103
|
cartId: string;
|
|
137
104
|
customer?: ICheckoutCustomer | string;
|
|
138
|
-
/**
|
|
139
|
-
* @deprecated Use customer property instead. Recipient will be removed in a future version.
|
|
140
|
-
*/
|
|
141
|
-
recipient?: ICheckoutRecipient;
|
|
142
105
|
hasAgeVerify?: boolean;
|
|
143
106
|
shippingAddressTwo?: string;
|
|
144
107
|
/**
|
|
145
108
|
* Billing address information supporting both new and legacy formats.
|
|
146
|
-
* Recommended to use ICheckoutBillingAddress format for new implementations.
|
|
147
109
|
*/
|
|
148
|
-
billingAddress?: ICheckoutBillingAddress
|
|
110
|
+
billingAddress?: ICheckoutBillingAddress;
|
|
149
111
|
hasSubstitutionPolicy?: boolean;
|
|
150
112
|
isGift?: boolean;
|
|
151
113
|
billingSameAsShipping?: boolean;
|
|
152
114
|
giftOptions?: ICheckoutGiftOptions;
|
|
153
115
|
marketingPreferences?: ICheckoutMarketingPreferences;
|
|
154
116
|
deliveryTips?: ICheckoutDeliveryTip[];
|
|
117
|
+
deliveryInstructions?: ICheckoutDeliveryInstructions[];
|
|
155
118
|
acceptedAccountCreation?: boolean;
|
|
156
119
|
scheduledDelivery?: string;
|
|
157
120
|
payment?: string;
|
|
121
|
+
promoCode?: string;
|
|
122
|
+
giftCards?: string[];
|
|
158
123
|
}
|
|
159
124
|
/**
|
|
160
125
|
* Represents total amounts and discounts for a checkout process.
|
|
@@ -218,6 +183,7 @@ export interface ICheckoutTotalAmounts {
|
|
|
218
183
|
*/
|
|
219
184
|
export interface ICheckoutFulfillment extends ICheckoutTotalAmounts {
|
|
220
185
|
id: string;
|
|
186
|
+
deliveryInstructions: string;
|
|
221
187
|
scheduledFor?: string | Date;
|
|
222
188
|
type: 'shipping' | 'onDemand';
|
|
223
189
|
expectation: IRetailerExpectation;
|
|
@@ -264,13 +230,10 @@ export interface ICheckoutItem {
|
|
|
264
230
|
pack: boolean;
|
|
265
231
|
packDesc: string;
|
|
266
232
|
mainImage: string;
|
|
267
|
-
/**
|
|
268
|
-
* @deprecated - use mainImage
|
|
269
|
-
*/
|
|
270
|
-
image: string;
|
|
271
233
|
brand: string;
|
|
272
234
|
partNumber: string;
|
|
273
235
|
upc: string;
|
|
236
|
+
sku: string;
|
|
274
237
|
price: number;
|
|
275
238
|
unitPrice: number;
|
|
276
239
|
quantity: number;
|
|
@@ -279,6 +242,36 @@ export interface ICheckoutItem {
|
|
|
279
242
|
bottleDeposits: number;
|
|
280
243
|
attributes: ICartItemAttributes;
|
|
281
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Interface representing a gift card utilized during checkout.
|
|
247
|
+
*
|
|
248
|
+
* This interface defines the structure for a gift card,
|
|
249
|
+
* including its code, the amount applied during the transaction,
|
|
250
|
+
* and any remaining balance on the card.
|
|
251
|
+
*
|
|
252
|
+
* Properties:
|
|
253
|
+
* - `code`: The unique code of the gift card used for identification.
|
|
254
|
+
* - `applied`: The amount deducted from the gift card during the current transaction.
|
|
255
|
+
* - `balance`: The remaining balance on the gift card after the applied amount is deducted.
|
|
256
|
+
*/
|
|
257
|
+
export interface ICheckoutGiftCard {
|
|
258
|
+
code: string;
|
|
259
|
+
applied: number;
|
|
260
|
+
balance: number;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Interface representing events related to the checkout process.
|
|
264
|
+
* This interface defines the structure for any event emitted or handled
|
|
265
|
+
* during the checkout workflow, including the type of event and its corresponding message.
|
|
266
|
+
*
|
|
267
|
+
* @interface ICheckoutEvents
|
|
268
|
+
* @property {CHECKOUT_EVENT_ENUM} type - The type of the checkout event.
|
|
269
|
+
* @property {string} message - A message providing additional context or details about the event.
|
|
270
|
+
*/
|
|
271
|
+
export interface ICheckoutEvents {
|
|
272
|
+
type: CHECKOUT_EVENT_ENUM;
|
|
273
|
+
message: string;
|
|
274
|
+
}
|
|
282
275
|
/**
|
|
283
276
|
* Represents a response object for preparing a checkout process.
|
|
284
277
|
*
|
|
@@ -300,13 +293,15 @@ export interface ICheckoutPrepareResponse {
|
|
|
300
293
|
shippingAddress: IAddress;
|
|
301
294
|
/**
|
|
302
295
|
* Billing address information supporting both new and legacy formats.
|
|
303
|
-
* Recommended to use ICheckoutBillingAddress format for new implementations.
|
|
304
296
|
*/
|
|
305
|
-
billingAddress: ICheckoutBillingAddress
|
|
297
|
+
billingAddress: ICheckoutBillingAddress;
|
|
306
298
|
amounts: ICheckoutTotalAmounts;
|
|
307
299
|
items: ICheckoutItem[];
|
|
308
300
|
retailers: ICheckoutRetailer[];
|
|
309
301
|
payment?: string;
|
|
302
|
+
giftCards: ICheckoutGiftCard[];
|
|
303
|
+
events: ICheckoutEvents[];
|
|
304
|
+
promoCode: string;
|
|
310
305
|
}
|
|
311
306
|
/**
|
|
312
307
|
* Represents the parameters required for completing a checkout process.
|
|
@@ -326,7 +321,7 @@ export interface ICheckoutCompleteParams extends ICoreParams {
|
|
|
326
321
|
*/
|
|
327
322
|
export interface ICheckoutCompleteResponse {
|
|
328
323
|
order: {
|
|
329
|
-
|
|
324
|
+
legacyOrderNumber: string;
|
|
330
325
|
referenceId: string;
|
|
331
326
|
};
|
|
332
327
|
}
|
|
@@ -3,6 +3,9 @@ export * from './cart.interface';
|
|
|
3
3
|
export * from './catalog.interface';
|
|
4
4
|
export * from './checkout.interface';
|
|
5
5
|
export * from './liquid-commerce-client.interface';
|
|
6
|
+
export * from './liquid-commerce-order-client.interface';
|
|
7
|
+
export * from './order.interface';
|
|
6
8
|
export * from './payment.interface';
|
|
9
|
+
export * from './payment-element.interface';
|
|
7
10
|
export * from './retailer.interface';
|
|
8
11
|
export * from './user.interface';
|