@liquidcommerce/cloud-sdk 1.5.0 → 1.7.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 +154 -85
- 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 +98 -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 +40 -56
- package/dist/types/interfaces/index.d.ts +3 -0
- package/dist/types/interfaces/liquid-commerce-client.interface.d.ts +84 -5
- 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 -11
- 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 +25 -7
- 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,62 @@
|
|
|
1
|
+
import type { ILiquidCommerceOrderClientConstructor } from '../interfaces';
|
|
2
|
+
import { OrderService } from '../services';
|
|
3
|
+
import type { ILiquidCommerceOrderConfig } from '../types';
|
|
4
|
+
import { OrderAuthenticatedService } from './order-authenticated.service';
|
|
5
|
+
/**
|
|
6
|
+
* The OrderSingletonManager class is responsible for managing singleton instances of various order services.
|
|
7
|
+
* It provides methods for retrieving or creating instances of these services based on unique keys.
|
|
8
|
+
*/
|
|
9
|
+
export declare class OrderSingletonManager {
|
|
10
|
+
private static instance;
|
|
11
|
+
private services;
|
|
12
|
+
private liquidCommerceOrderClientConstructor;
|
|
13
|
+
static getInstance(): OrderSingletonManager;
|
|
14
|
+
/**
|
|
15
|
+
* Sets the constructor for the Liquid Commerce Order Client.
|
|
16
|
+
*
|
|
17
|
+
* @param {ILiquidCommerceOrderClientConstructor} constructor - The constructor function for the Liquid Commerce Order Client.
|
|
18
|
+
*
|
|
19
|
+
* @return {void}
|
|
20
|
+
*/
|
|
21
|
+
setLiquidCommerceOrderClientConstructor(constructor: ILiquidCommerceOrderClientConstructor): void;
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves or creates an instance of the LiquidCommerceOrderClient.
|
|
24
|
+
*
|
|
25
|
+
* @param {ILiquidCommerceOrderConfig} config - The configuration object.
|
|
26
|
+
* @returns {Promise<ILiquidCommerceOrderClient>} - A promise that resolves to an instance of ILiquidCommerceOrderClient.
|
|
27
|
+
* @throws {Error} - If the LiquidCommerceOrderClient constructor is not set.
|
|
28
|
+
*/
|
|
29
|
+
getClient<T>(config: ILiquidCommerceOrderConfig): Promise<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns an instance of a service based on the given key and ServiceClass.
|
|
32
|
+
* If the service does not exist, it creates a new instance using the ServiceClass and optional arguments.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} key - The key to identify the service.
|
|
35
|
+
* @param {ServiceFactory<T>} ServiceClass - The class or factory function for the service.
|
|
36
|
+
* @param {...any[]} args - Optional arguments to be passed to the constructor or factory function.
|
|
37
|
+
* @return {T} - The instance of the service.
|
|
38
|
+
*/
|
|
39
|
+
private getOrCreateService;
|
|
40
|
+
/**
|
|
41
|
+
* Returns an order authenticated client for the given configuration.
|
|
42
|
+
*
|
|
43
|
+
* @param config - The configuration object containing the user ID, password, and base URL.
|
|
44
|
+
* @param config.userID - The user ID for authentication.
|
|
45
|
+
* @param config.password - The password for authentication.
|
|
46
|
+
* @param config.baseURL - The base URL for API requests.
|
|
47
|
+
*
|
|
48
|
+
* @return The order authenticated service object.
|
|
49
|
+
*/
|
|
50
|
+
getAuthenticatedClient(config: {
|
|
51
|
+
userID: string;
|
|
52
|
+
password: string;
|
|
53
|
+
baseURL: string;
|
|
54
|
+
}): OrderAuthenticatedService;
|
|
55
|
+
/**
|
|
56
|
+
* Retrieves the OrderService instance for the provided authenticated client.
|
|
57
|
+
*
|
|
58
|
+
* @param orderAuthenticatedClient - The authenticated client object.
|
|
59
|
+
* @return The OrderService instance.
|
|
60
|
+
*/
|
|
61
|
+
getOrderService(orderAuthenticatedClient: OrderAuthenticatedService): OrderService;
|
|
62
|
+
}
|
|
@@ -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
|
}
|
|
@@ -135,17 +93,12 @@ export interface ICheckoutDeliveryTip {
|
|
|
135
93
|
export interface ICheckoutPrepareParams extends ICoreParams {
|
|
136
94
|
cartId: string;
|
|
137
95
|
customer?: ICheckoutCustomer | string;
|
|
138
|
-
/**
|
|
139
|
-
* @deprecated Use customer property instead. Recipient will be removed in a future version.
|
|
140
|
-
*/
|
|
141
|
-
recipient?: ICheckoutRecipient;
|
|
142
96
|
hasAgeVerify?: boolean;
|
|
143
97
|
shippingAddressTwo?: string;
|
|
144
98
|
/**
|
|
145
99
|
* Billing address information supporting both new and legacy formats.
|
|
146
|
-
* Recommended to use ICheckoutBillingAddress format for new implementations.
|
|
147
100
|
*/
|
|
148
|
-
billingAddress?: ICheckoutBillingAddress
|
|
101
|
+
billingAddress?: ICheckoutBillingAddress;
|
|
149
102
|
hasSubstitutionPolicy?: boolean;
|
|
150
103
|
isGift?: boolean;
|
|
151
104
|
billingSameAsShipping?: boolean;
|
|
@@ -155,6 +108,8 @@ export interface ICheckoutPrepareParams extends ICoreParams {
|
|
|
155
108
|
acceptedAccountCreation?: boolean;
|
|
156
109
|
scheduledDelivery?: string;
|
|
157
110
|
payment?: string;
|
|
111
|
+
promoCode?: string;
|
|
112
|
+
giftCards?: string[];
|
|
158
113
|
}
|
|
159
114
|
/**
|
|
160
115
|
* Represents total amounts and discounts for a checkout process.
|
|
@@ -264,13 +219,10 @@ export interface ICheckoutItem {
|
|
|
264
219
|
pack: boolean;
|
|
265
220
|
packDesc: string;
|
|
266
221
|
mainImage: string;
|
|
267
|
-
/**
|
|
268
|
-
* @deprecated - use mainImage
|
|
269
|
-
*/
|
|
270
|
-
image: string;
|
|
271
222
|
brand: string;
|
|
272
223
|
partNumber: string;
|
|
273
224
|
upc: string;
|
|
225
|
+
sku: string;
|
|
274
226
|
price: number;
|
|
275
227
|
unitPrice: number;
|
|
276
228
|
quantity: number;
|
|
@@ -279,6 +231,36 @@ export interface ICheckoutItem {
|
|
|
279
231
|
bottleDeposits: number;
|
|
280
232
|
attributes: ICartItemAttributes;
|
|
281
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Interface representing a gift card utilized during checkout.
|
|
236
|
+
*
|
|
237
|
+
* This interface defines the structure for a gift card,
|
|
238
|
+
* including its code, the amount applied during the transaction,
|
|
239
|
+
* and any remaining balance on the card.
|
|
240
|
+
*
|
|
241
|
+
* Properties:
|
|
242
|
+
* - `code`: The unique code of the gift card used for identification.
|
|
243
|
+
* - `applied`: The amount deducted from the gift card during the current transaction.
|
|
244
|
+
* - `balance`: The remaining balance on the gift card after the applied amount is deducted.
|
|
245
|
+
*/
|
|
246
|
+
export interface ICheckoutGiftCard {
|
|
247
|
+
code: string;
|
|
248
|
+
applied: number;
|
|
249
|
+
balance: number;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Interface representing events related to the checkout process.
|
|
253
|
+
* This interface defines the structure for any event emitted or handled
|
|
254
|
+
* during the checkout workflow, including the type of event and its corresponding message.
|
|
255
|
+
*
|
|
256
|
+
* @interface ICheckoutEvents
|
|
257
|
+
* @property {CHECKOUT_EVENT_ENUM} type - The type of the checkout event.
|
|
258
|
+
* @property {string} message - A message providing additional context or details about the event.
|
|
259
|
+
*/
|
|
260
|
+
export interface ICheckoutEvents {
|
|
261
|
+
type: CHECKOUT_EVENT_ENUM;
|
|
262
|
+
message: string;
|
|
263
|
+
}
|
|
282
264
|
/**
|
|
283
265
|
* Represents a response object for preparing a checkout process.
|
|
284
266
|
*
|
|
@@ -300,13 +282,15 @@ export interface ICheckoutPrepareResponse {
|
|
|
300
282
|
shippingAddress: IAddress;
|
|
301
283
|
/**
|
|
302
284
|
* Billing address information supporting both new and legacy formats.
|
|
303
|
-
* Recommended to use ICheckoutBillingAddress format for new implementations.
|
|
304
285
|
*/
|
|
305
|
-
billingAddress: ICheckoutBillingAddress
|
|
286
|
+
billingAddress: ICheckoutBillingAddress;
|
|
306
287
|
amounts: ICheckoutTotalAmounts;
|
|
307
288
|
items: ICheckoutItem[];
|
|
308
289
|
retailers: ICheckoutRetailer[];
|
|
309
290
|
payment?: string;
|
|
291
|
+
giftCards: ICheckoutGiftCard[];
|
|
292
|
+
events: ICheckoutEvents[];
|
|
293
|
+
promoCode: string;
|
|
310
294
|
}
|
|
311
295
|
/**
|
|
312
296
|
* Represents the parameters required for completing a checkout process.
|
|
@@ -326,7 +310,7 @@ export interface ICheckoutCompleteParams extends ICoreParams {
|
|
|
326
310
|
*/
|
|
327
311
|
export interface ICheckoutCompleteResponse {
|
|
328
312
|
order: {
|
|
329
|
-
|
|
313
|
+
legacyOrderNumber: string;
|
|
330
314
|
referenceId: string;
|
|
331
315
|
};
|
|
332
316
|
}
|