@liquidcommerce/cloud-sdk 1.6.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.
Files changed (37) hide show
  1. package/README.md +154 -85
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.esm.js +1 -1
  4. package/dist/liquidcommerce-cloud-sdk.ssr.js +1 -1
  5. package/dist/types/core/authenticated.service.d.ts +6 -38
  6. package/dist/types/core/catalog-helper.service.d.ts +18 -5
  7. package/dist/types/core/checkout-helper.service.d.ts +9 -1
  8. package/dist/types/core/index.d.ts +3 -0
  9. package/dist/types/core/order-authenticated.service.d.ts +98 -0
  10. package/dist/types/core/order-singleton.service.d.ts +62 -0
  11. package/dist/types/core/payment-session-helper.service.d.ts +12 -0
  12. package/dist/types/core/singleton.service.d.ts +23 -3
  13. package/dist/types/core/utils.d.ts +48 -0
  14. package/dist/types/enums/enums.d.ts +70 -1
  15. package/dist/types/index.d.ts +2 -0
  16. package/dist/types/index.umd.d.ts +2 -2
  17. package/dist/types/interfaces/address.interface.d.ts +2 -0
  18. package/dist/types/interfaces/cart.interface.d.ts +5 -15
  19. package/dist/types/interfaces/catalog.interface.d.ts +54 -6
  20. package/dist/types/interfaces/checkout.interface.d.ts +40 -56
  21. package/dist/types/interfaces/index.d.ts +3 -0
  22. package/dist/types/interfaces/liquid-commerce-client.interface.d.ts +83 -4
  23. package/dist/types/interfaces/liquid-commerce-order-client.interface.d.ts +54 -0
  24. package/dist/types/interfaces/order.interface.d.ts +197 -0
  25. package/dist/types/interfaces/payment-element.interface.d.ts +88 -0
  26. package/dist/types/interfaces/payment.interface.d.ts +11 -1
  27. package/dist/types/interfaces/retailer.interface.d.ts +2 -0
  28. package/dist/types/interfaces/user.interface.d.ts +13 -9
  29. package/dist/types/liquid-commerce-order-client.d.ts +19 -0
  30. package/dist/types/liquid-commerce-payment-element.d.ts +10 -0
  31. package/dist/types/services/index.d.ts +3 -0
  32. package/dist/types/services/order.service.d.ts +15 -0
  33. package/dist/types/services/user.service.d.ts +22 -4
  34. package/dist/types/services/webhook.service.d.ts +14 -0
  35. package/dist/types/types.d.ts +9 -0
  36. package/package.json +4 -4
  37. package/umd/liquidcommerce-cloud-sdk.min.js +1 -1
@@ -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';
@@ -1,10 +1,10 @@
1
- import type { IApiResponseWithData, IApiResponseWithoutData, ILiquidCommerceConfig } from '../types';
1
+ import type { IApiResponseWithData, IApiResponseWithoutData, IAuth, ILiquidCommerceConfig } from '../types';
2
2
  import type { IAddressAutocompleteParams, IAddressAutocompleteResult, IAddressDetailsParams, IAddressDetailsResult } from './address.interface';
3
3
  import type { ICart, ICartUpdateParams } from './cart.interface';
4
4
  import type { IAvailabilityParams, IAvailabilityResponse, ICatalog, ICatalogParams } from './catalog.interface';
5
5
  import type { ICheckoutCompleteParams, ICheckoutCompleteResponse, ICheckoutPrepareParams, ICheckoutPrepareResponse } from './checkout.interface';
6
6
  import type { ILiquidPaymentConfig, ILiquidPaymentToken, IPaymentElementEventMap } from './payment.interface';
7
- import type { BaseUser, IPurgeResponse, IUser, IUserAddress, IUserAddressParams, IUserPayment, IUserPaymentAddParams, IUserPaymentParams, IUserPaymentUpdateParams, IUserSessionParams } from './user.interface';
7
+ import type { BaseUser, IPurgeResponse, IUser, IUserAddress, IUserAddressParams, IUserPayment, IUserPaymentAddParams, IUserPaymentParams, IUserPaymentSession, IUserSession, IUserSessionParams } from './user.interface';
8
8
  /**
9
9
  * Interface representing the LiquidCommerce client.
10
10
  * Provides access to methods related to addresses, catalogs, carts, and initialization.
@@ -20,6 +20,14 @@ export interface ILiquidCommerceClient {
20
20
  * @throws {Error} - Throws an error if initialization fails.
21
21
  */
22
22
  init(): Promise<void>;
23
+ /**
24
+ * Authenticates a service, initiating the authentication process and providing an
25
+ * authorization response.
26
+ *
27
+ * @return {Promise<IAuth>} A promise that resolves to an authentication service
28
+ * response containing details of the authentication process.
29
+ */
30
+ auth(): Promise<IAuth>;
23
31
  /**
24
32
  * Provides methods for performing address autocompletion and retrieving address details.
25
33
  * See {@link IAddressMethod} for more details on the available methods.
@@ -321,6 +329,56 @@ export interface IUserMethod {
321
329
  * @see {@link IUser} for the structure of the user data returned.
322
330
  */
323
331
  session: (params: IUserSessionParams) => Promise<IApiResponseWithData<IUser>>;
332
+ /**
333
+ * Represents a payment session object used for the payment element mounting.
334
+ *
335
+ * @param {IUserPaymentSession} params - The parameters for creating a payment session.
336
+ * @returns {Promise<IApiResponseWithData<IUserSession>>} A Promise that resolves to the API response with user payment session.
337
+ *
338
+ * @example
339
+ * const liquidCommerce = await LiquidCommerce(apiKey, config);
340
+ *
341
+ * try {
342
+ * const paymentSession = await liquidCommerce.user.paymentSession({
343
+ * cartId: "6735340d5da29bac0eb78f7d",
344
+ * customerEmail: "user@example.com"
345
+ * });
346
+ *
347
+ * console.log('User payment session:', paymentSession?.data);
348
+ * } catch (error) {
349
+ * console.error('Failed to create user payment session:', error);
350
+ * }
351
+ *
352
+ * @throws {Error} - Throws an error if the sessions request fails or if authentication is unsuccessful.
353
+ *
354
+ * @see {@link IUserPaymentSession} for the structure of the payment session request parameters.
355
+ * @see {@link IUserSession} for the structure of the user data returned.
356
+ */
357
+ paymentSession: (params: IUserPaymentSession) => Promise<IApiResponseWithData<IUserSession>>;
358
+ /**
359
+ * Confirms a payment session using a token from the payment element.
360
+ *
361
+ * @param {string} token - The payment token received from the payment provider (e.g., Stripe) after user interaction.
362
+ * @returns {Promise<IApiResponseWithData<ILiquidPaymentToken>>} A Promise that resolves to the API response with the confirmed payment token details.
363
+ *
364
+ * @example
365
+ * const liquidCommerce = await LiquidCommerce(apiKey, config);
366
+ *
367
+ * try {
368
+ * // Assume 'paymentElementToken' is obtained from the front-end after the user completes the payment steps.
369
+ * const paymentElementToken = '1fa23fa4d5fad'; // Example token
370
+ * const confirmedPayment = await liquidCommerce.user.confirmPaymentSession(paymentElementToken);
371
+ *
372
+ * console.log('Confirmed payment session data:', confirmedPayment?.data);
373
+ * } catch (error) {
374
+ * console.error('Failed to confirm payment session:', error);
375
+ * }
376
+ *
377
+ * @throws {Error} - Throws an error if the confirmation request fails or the token is invalid.
378
+ *
379
+ * @see {@link ILiquidPaymentToken} for the structure of the confirmed payment data returned.
380
+ */
381
+ confirmPaymentSession: (token: string) => Promise<IApiResponseWithData<ILiquidPaymentToken>>;
324
382
  /**
325
383
  * Represents a user object without creating a new session.
326
384
  *
@@ -484,7 +542,7 @@ export interface IUserMethod {
484
542
  /**
485
543
  * Updates a payment method for a user.
486
544
  *
487
- * @param {IUserPaymentUpdateParams} params - The parameters for updating a payment method.
545
+ * @param {IUserPaymentParams} params - The parameters for updating a payment method.
488
546
  * @returns {Promise<IApiResponseWithData<IUserPayment>>} A promise that resolves to the API response with the updated payment method data.
489
547
  *
490
548
  * @example
@@ -507,7 +565,7 @@ export interface IUserMethod {
507
565
  * @see {@link IUserPaymentParams} for the structure of the update payment request parameters.
508
566
  * @see {@link IUserPayment} for the structure of the user's payment method data returned.
509
567
  */
510
- updatePayment: (params: IUserPaymentParams | IUserPaymentUpdateParams) => Promise<IApiResponseWithData<boolean>>;
568
+ updatePayment: (params: IUserPaymentParams) => Promise<IApiResponseWithData<boolean>>;
511
569
  /**
512
570
  * Purges a payment method for a user.
513
571
  *
@@ -785,3 +843,24 @@ export interface ICheckoutMethod {
785
843
  */
786
844
  complete: (params: ICheckoutCompleteParams) => Promise<IApiResponseWithoutData<ICheckoutCompleteResponse>>;
787
845
  }
846
+ export interface IWebhookMethod {
847
+ /**
848
+ * Retrieves whether the webhook test succeeded or not.
849
+ *
850
+ * @param {string} [endpoint] - The endpoint to test. If not provided, the default endpoint will be used.
851
+ * @returns {Promise<boolean>} A promise that resolves whether the test succeeded or not.
852
+ *
853
+ * @example
854
+ * const liquidCommerce = await LiquidCommerce(apiKey, config);
855
+ *
856
+ * try {
857
+ * const testSucceeded = await liquidCommerce.webhook.test();
858
+ * console.log('Webhook test succeeded:', testSucceeded);
859
+ * } catch (error) {
860
+ * console.error('Failed to test Webhook:', error);
861
+ * }
862
+ *
863
+ * @throws {Error} Throws an error if the webhook test request fails or if authentication is unsuccessful.
864
+ */
865
+ test: (endpoint?: string) => Promise<boolean>;
866
+ }
@@ -0,0 +1,54 @@
1
+ import type { IApiResponseWithData, ILiquidCommerceOrderConfig } from '../types';
2
+ import type { IOrder } from './order.interface';
3
+ /**
4
+ * Interface representing the LiquidCommerce order client.
5
+ * Provides access to methods related to orders and initialization.
6
+ *
7
+ * @interface
8
+ */
9
+ export interface ILiquidCommerceOrderClient {
10
+ /**
11
+ * Initializes the client by authenticating with the LiquidCommerce Order API.
12
+ * Should be called before making any API requests.
13
+ *
14
+ * @return {Promise<void>} - Resolves when the client is successfully initialized.
15
+ * @throws {Error} - Throws an error if initialization fails.
16
+ */
17
+ init(): Promise<void>;
18
+ /**
19
+ * Provides methods for order-related operations.
20
+ *
21
+ * @property {IOrderMethod} order - Object containing methods for order operations.
22
+ */
23
+ order: IOrderMethod;
24
+ }
25
+ /**
26
+ * Type for the LiquidCommerceOrderClient constructor.
27
+ * Used to define the expected constructor signature.
28
+ *
29
+ * @type {new (config: ILiquidCommerceOrderConfig) => ILiquidCommerceOrderClient} ILiquidCommerceOrderClientConstructor
30
+ */
31
+ export type ILiquidCommerceOrderClientConstructor = new (config: ILiquidCommerceOrderConfig) => ILiquidCommerceOrderClient;
32
+ export interface IOrderMethod {
33
+ /**
34
+ * Retrieves the order details based on the provided order ID.
35
+ *
36
+ * @param {string} identifier - The ID of the order to retrieve.
37
+ * @returns {Promise<IApiResponseWithData<IOrder>>} A promise that resolves to the API response with the order data.
38
+ *
39
+ * @example
40
+ * const orderLiquidCommerce = await OrderLiquidCommerce(apiKey, config);
41
+ *
42
+ * try {
43
+ * const orderDetails = await orderLiquidCommerce.order.fetch('order_id_123');
44
+ * console.log('Order details:', orderDetails.data);
45
+ * } catch (error) {
46
+ * console.error('Failed to retrieve order details:', error);
47
+ * }
48
+ *
49
+ * @throws {Error} Throws an error if the order retrieval request fails or if authentication is unsuccessful.
50
+ *
51
+ * @see {@link IOrder} for the structure of the order data returned.
52
+ */
53
+ fetch: (identifier: string) => Promise<IApiResponseWithData<IOrder>>;
54
+ }
@@ -0,0 +1,197 @@
1
+ import type { ENUM_CUSTOMER_PLACEMENT, ENUM_ORDER_FULFILLMENT_TYPE, ENUM_ORDER_PACKAGE_STATUS, ENUM_ORDER_STATUS, ENUM_ORDER_SYSTEM } from 'enums';
2
+ export interface IAddressCoordinates {
3
+ latitude: number | null;
4
+ longitude: number | null;
5
+ }
6
+ export interface IOrderAddress {
7
+ one: string;
8
+ two: string | null;
9
+ city: string;
10
+ state: string;
11
+ zip: string;
12
+ country: string;
13
+ }
14
+ export interface IOrderFullAddress extends IOrderAddress {
15
+ firstName: string | null;
16
+ lastName: string | null;
17
+ email: string;
18
+ phone: string | null;
19
+ company: string | null;
20
+ }
21
+ export interface IOrderFulfillmentTimeline {
22
+ status: ENUM_ORDER_STATUS;
23
+ timestamp: string;
24
+ }
25
+ export interface IOrderFulfillmentPackage {
26
+ id: string;
27
+ carrier: string | null;
28
+ trackingNumber: string | null;
29
+ trackingUrl: string | null;
30
+ status: ENUM_ORDER_PACKAGE_STATUS;
31
+ dateShipped: string | null;
32
+ }
33
+ export interface IOrderFulfillment {
34
+ id: string;
35
+ type: ENUM_ORDER_FULFILLMENT_TYPE;
36
+ status: ENUM_ORDER_STATUS;
37
+ scheduledFor: string | null;
38
+ updatedAt: string;
39
+ itemIds: string[];
40
+ packages: IOrderFulfillmentPackage[];
41
+ timeline: IOrderFulfillmentTimeline[];
42
+ }
43
+ export interface IOrderRetailerAddress extends IOrderAddress {
44
+ coordinates: IAddressCoordinates;
45
+ }
46
+ export interface IOrderRetailer {
47
+ id: string;
48
+ legacyId: string | null;
49
+ name: string;
50
+ system: ENUM_ORDER_SYSTEM;
51
+ timezone: string;
52
+ address: IOrderRetailerAddress;
53
+ amounts: IOrderAmounts;
54
+ fulfillments: IOrderFulfillment[];
55
+ }
56
+ export interface IOrderItemProductAttributes {
57
+ pack: boolean;
58
+ packDescription: string | null;
59
+ abv: string | null;
60
+ container: string | null;
61
+ containerType: string | null;
62
+ }
63
+ export interface IOrderItemProduct {
64
+ name: string;
65
+ brand: string;
66
+ upc: string;
67
+ sku: string;
68
+ mskus: string[];
69
+ category: string | null;
70
+ size: string | null;
71
+ volume: string | null;
72
+ uom: string | null;
73
+ proof: string | null;
74
+ attributes: IOrderItemProductAttributes;
75
+ }
76
+ export interface IOrderItemPricing {
77
+ price: number;
78
+ unitPrice: number;
79
+ quantity: number;
80
+ tax: number;
81
+ bottleDeposits: number;
82
+ }
83
+ export interface IOrderItemEngraving {
84
+ hasEngraving: boolean;
85
+ fee: number;
86
+ location: string | null;
87
+ lines: string[];
88
+ }
89
+ export interface IOrderItemGiftCard {
90
+ sender: string | null;
91
+ message: string | null;
92
+ recipients: string[];
93
+ sendDate: string | null;
94
+ }
95
+ export interface IOrderItemAttributes {
96
+ engraving: IOrderItemEngraving;
97
+ giftCard: IOrderItemGiftCard;
98
+ }
99
+ export interface IOrderItem {
100
+ id: string;
101
+ fulfillmentId: string | null;
102
+ retailerId: string;
103
+ variantId: string;
104
+ liquidId: string | null;
105
+ legacyGrouping: string | null;
106
+ legacyPid: string | null;
107
+ customerPlacement: ENUM_CUSTOMER_PLACEMENT;
108
+ product: IOrderItemProduct;
109
+ image: string | null;
110
+ pricing: IOrderItemPricing;
111
+ attributes: IOrderItemAttributes;
112
+ isPresale: boolean;
113
+ estimatedShipBy: string | null;
114
+ }
115
+ export interface IOrderCustomer {
116
+ id: string;
117
+ firstName: string | null;
118
+ lastName: string | null;
119
+ email: string;
120
+ phone: string | null;
121
+ birthdate: string | null;
122
+ }
123
+ export interface IOrderGiftRecipient {
124
+ name: string | null;
125
+ email: string | null;
126
+ phone: string | null;
127
+ }
128
+ export interface IOrderMarketingPreferences {
129
+ email: boolean;
130
+ sms: boolean;
131
+ }
132
+ export interface IOrderOptions {
133
+ isGift: boolean;
134
+ giftMessage: string | null;
135
+ giftRecipient: IOrderGiftRecipient;
136
+ hasVerifiedAge: boolean;
137
+ allowsSubstitution: boolean;
138
+ billingSameAsShipping: boolean;
139
+ deliveryInstructions: string | null;
140
+ marketingPreferences: IOrderMarketingPreferences;
141
+ }
142
+ export interface IOrderTaxDetails {
143
+ products: number;
144
+ shipping: number;
145
+ delivery: number;
146
+ bag: number;
147
+ bottleDeposits: number;
148
+ retailDelivery: number;
149
+ }
150
+ export interface IOrderDiscountDetails {
151
+ products: number;
152
+ shipping: number;
153
+ delivery: number;
154
+ engraving: number;
155
+ service: number;
156
+ }
157
+ export interface IOrderAmounts {
158
+ subtotal: number;
159
+ shipping: number;
160
+ platform: number;
161
+ tax: number;
162
+ engraving: number;
163
+ service: number;
164
+ delivery: number;
165
+ discounts: number;
166
+ giftCards: number;
167
+ tip: number;
168
+ total: number;
169
+ taxDetails: IOrderTaxDetails;
170
+ discountDetails: IOrderDiscountDetails;
171
+ }
172
+ export interface IOrderAddresses {
173
+ shipping: IOrderFullAddress;
174
+ billing: IOrderFullAddress;
175
+ }
176
+ export interface IOrderPaymentMethod {
177
+ type: string | null;
178
+ card: string | null;
179
+ last4: string | null;
180
+ holder: string | null;
181
+ code: string | null;
182
+ }
183
+ export interface IOrder {
184
+ referenceId: string | null;
185
+ legacyOrderNumber: string | null;
186
+ isHybrid: boolean;
187
+ partnerId: string;
188
+ createdAt: string;
189
+ updatedAt: string;
190
+ customer: IOrderCustomer;
191
+ addresses: IOrderAddresses;
192
+ options: IOrderOptions;
193
+ amounts: IOrderAmounts;
194
+ paymentMethods: IOrderPaymentMethod[];
195
+ retailers: IOrderRetailer[];
196
+ items: IOrderItem[];
197
+ }
@@ -0,0 +1,88 @@
1
+ import type { IConfirmationTokenClientParams, IConfirmationTokenResponse, ILiquidPaymentElementOptions, IPaymentElementEventMap } from './payment.interface';
2
+ import type { IUserSession } from './user.interface';
3
+ export interface IPaymentElementConfig {
4
+ session: IUserSession;
5
+ elementId: string;
6
+ appearance?: {
7
+ theme?: 'stipe' | 'night' | 'flat';
8
+ };
9
+ elementOptions?: ILiquidPaymentElementOptions;
10
+ }
11
+ /**
12
+ * Defines the public interface for the Liquid Commerce Payment Element.
13
+ * This element provides a secure UI component for collecting payment information
14
+ * through an integrated payment provider.
15
+ *
16
+ * @interface ILiquidCommercePaymentElement
17
+ */
18
+ export interface ILiquidCommercePaymentElement {
19
+ /**
20
+ * Mounts the payment UI component to the specified DOM element.
21
+ *
22
+ * @param {IPaymentElementConfig} config - Configuration for mounting the element,
23
+ * including the DOM element ID, appearance options, and session credentials.
24
+ * @returns {Promise<void>} A promise that resolves when the element is successfully mounted.
25
+ * @throws {Error} If the DOM element is not found, if the payment provider SDK fails to load,
26
+ * or if the component cannot be properly initialized.
27
+ */
28
+ mount(config: IPaymentElementConfig): Promise<void>;
29
+ /**
30
+ * Creates a secure confirmation token using the payment data collected by the UI component.
31
+ * This token can be used to complete the payment setup process on the server side.
32
+ *
33
+ * @param {IConfirmationTokenClientParams} [params] - Optional parameters for token creation,
34
+ * such as the return URL for redirect-based payment methods.
35
+ * @returns {Promise<IConfirmationTokenResponse>} A promise that resolves with
36
+ * an object containing the confirmation token ID on success, or an error object describing
37
+ * the failure reason (validation errors, network issues, etc.).
38
+ */
39
+ createConfirmationToken(params?: IConfirmationTokenClientParams): Promise<IConfirmationTokenResponse>;
40
+ /**
41
+ * Subscribes to events emitted by the payment UI component for real-time updates
42
+ * on user interactions and component state changes.
43
+ *
44
+ * @template K
45
+ * @param {K} eventType - The type of event to subscribe to. Supported events include:
46
+ * 'ready' (component fully loaded), 'change' (input changes), 'focus', 'blur',
47
+ * 'loaderror' (loading failures), and 'loaderstart' (loading initiated).
48
+ * @param {(event: IPaymentElementEventMap[K]) => void} handler - The callback function
49
+ * to execute when the specified event occurs. Receives event-specific data.
50
+ * @returns {void}
51
+ */
52
+ subscribe<K extends keyof IPaymentElementEventMap>(eventType: K, handler: (event: IPaymentElementEventMap[K]) => void): void;
53
+ /**
54
+ * Unsubscribes from events emitted by the payment UI component.
55
+ *
56
+ * @template K
57
+ * @param {K} eventType - The type of event to unsubscribe from.
58
+ * @param {(event: IPaymentElementEventMap[K]) => void} [handler] - The specific handler
59
+ * function to remove. If not provided, all handlers for the specified event type will be removed.
60
+ * @returns {void}
61
+ */
62
+ unsubscribe<K extends keyof IPaymentElementEventMap>(eventType: K, handler?: (event: IPaymentElementEventMap[K]) => void): void;
63
+ /**
64
+ * Unmounts the payment UI component from the DOM, removing its visual elements
65
+ * while preserving the internal state. The component can be remounted later.
66
+ * @returns {void}
67
+ */
68
+ unmount(): void;
69
+ /**
70
+ * Destroys the payment UI component, releasing all associated resources and clearing
71
+ * internal state. This is a permanent action - the component cannot be remounted
72
+ * after destruction and a new instance must be created if needed.
73
+ * @returns {void}
74
+ */
75
+ destroy(): void;
76
+ /**
77
+ * Collapses the payment UI component to a minimized state if this feature is supported
78
+ * by the current configuration and payment provider.
79
+ * @returns {void}
80
+ */
81
+ collapse(): void;
82
+ }
83
+ /**
84
+ * @private
85
+ * Defines the constructor signature for the PaymentElementImpl class.
86
+ * Used internally by the singleton manager to instantiate the payment element.
87
+ */
88
+ export type PaymentElementImplConstructor = new (options: IPaymentElementConfig) => ILiquidCommercePaymentElement;
@@ -34,7 +34,7 @@ export interface ILiquidPaymentConfig {
34
34
  key: string;
35
35
  elementId: string;
36
36
  appearance?: {
37
- theme?: 'default' | 'night' | 'flat';
37
+ theme?: 'stripe' | 'night' | 'flat';
38
38
  };
39
39
  elementOptions?: ILiquidPaymentElementOptions;
40
40
  }
@@ -126,6 +126,16 @@ export interface IPaymentElementEventMap {
126
126
  elementType: 'payment';
127
127
  };
128
128
  }
129
+ /**
130
+ * Parameters for creating a Stripe Confirmation Token using the UI helper.
131
+ */
132
+ export interface IConfirmationTokenClientParams {
133
+ returnUrl?: string;
134
+ }
135
+ export interface IConfirmationTokenPayload {
136
+ token: string;
137
+ }
138
+ export type IConfirmationTokenResponse = IConfirmationTokenPayload | ILiquidPaymentError;
129
139
  /**
130
140
  * Interface representing a payment provider that integrates with a Liquid payment gateway.
131
141
  */
@@ -69,11 +69,13 @@ export interface IRetailerFreeDelivery {
69
69
  *
70
70
  * @property {number} maxQuantity - The maximum quantity of items eligible for the shipping fee.
71
71
  * @property {number} fee - The fee amount for shipping.
72
+ * @property {number} min - The min item total required to checkout.
72
73
  * @property {boolean} active - Indicates whether the fee-based shipping configuration is active.
73
74
  */
74
75
  export interface IFeeShippingConfig {
75
76
  maxQuantity: number;
76
77
  fee: number;
78
+ min: number;
77
79
  active: boolean;
78
80
  }
79
81
  /**
@@ -1,5 +1,9 @@
1
1
  import type { ENUM_ADDRESS_TYPE } from '../enums';
2
2
  import type { ICoreParams } from '../types';
3
+ export interface IUserSessionOb {
4
+ values?: [string, string[]];
5
+ createdAt: Date;
6
+ }
3
7
  /**
4
8
  * Represents a user session with key and secret used for authentication.
5
9
  */
@@ -127,6 +131,15 @@ export interface IUserSessionParams extends ICoreParams {
127
131
  profileImage?: string | null;
128
132
  birthDate?: string | null;
129
133
  }
134
+ /**
135
+ * Interface representing a user payment session.
136
+ */
137
+ export interface IUserPaymentSession {
138
+ cartId?: string;
139
+ checkoutToken?: string;
140
+ customerId?: string;
141
+ customerEmail?: string;
142
+ }
130
143
  /**
131
144
  * Interface representing the response from a purge operation.
132
145
  */
@@ -176,12 +189,3 @@ export interface IUserPaymentParams extends ICoreParams {
176
189
  export interface IUserPaymentAddParams extends IUserPaymentParams {
177
190
  isDefault?: boolean;
178
191
  }
179
- /**
180
- *
181
- * @deprecated - Use IUserPaymentParams
182
- *
183
- * @interface IUserPaymentParams
184
- */
185
- export interface IUserPaymentUpdateParams extends IUserPaymentParams {
186
- isDefault: boolean;
187
- }
@@ -0,0 +1,19 @@
1
+ import type { ILiquidCommerceOrderClient } from './interfaces';
2
+ import type { ILiquidCommerceOrderConfig } from './types';
3
+ /**
4
+ * Factory function to create and initialize a LiquidCommerceOrderClient instance.
5
+ *
6
+ * @param {ILiquidCommerceOrderConfig} config - The configuration object containing options such as environment settings, base URLs, and other preferences.
7
+ * @return {Promise<LiquidCommerceOrderClient>} - A promise that resolves to a fully initialized LiquidCommerceOrderClient instance.
8
+ *
9
+ * @example
10
+ * // Example usage:
11
+ * const orderLiquidClient = await LiquidCommerceOrders({
12
+ * userID: 'yourUserID',
13
+ * password: 'yourPassword',
14
+ * env: LIQUID_COMMERCE_ENV.STAGE,
15
+ * });
16
+ *
17
+ * @throws {Error} - Throws an error if the client initialization fails.
18
+ */
19
+ export declare function LiquidCommerceOrders(config: ILiquidCommerceOrderConfig): Promise<ILiquidCommerceOrderClient>;
@@ -0,0 +1,10 @@
1
+ import type { ILiquidCommercePaymentElement, IPaymentElementConfig } from './interfaces';
2
+ /**
3
+ * Factory function to create a singleton payment element instance.
4
+ * Ensures consistent state management across the application.
5
+ *
6
+ * @param {IPaymentElementConfig} options - Configuration for the payment element.
7
+ * @returns {ILiquidCommercePaymentElement} Payment element instance.
8
+ * @throws {Error} If singleton manager is not properly configured.
9
+ */
10
+ export declare function LiquidCommercePaymentElement(options: IPaymentElementConfig): ILiquidCommercePaymentElement;
@@ -1,5 +1,8 @@
1
1
  export * from './address.service';
2
+ export * from './cart.service';
2
3
  export * from './catalog.service';
3
4
  export * from './checkout.service';
5
+ export * from './order.service';
4
6
  export * from './payment.service';
5
7
  export * from './user.service';
8
+ export * from './webhook.service';
@@ -0,0 +1,15 @@
1
+ import type { OrderAuthenticatedService } from '../core';
2
+ import type { IOrder } from '../interfaces';
3
+ import type { IApiResponseWithData } from '../types';
4
+ export declare class OrderService {
5
+ private client;
6
+ constructor(client: OrderAuthenticatedService);
7
+ /**
8
+ * Fetches an order by its identifier.
9
+ *
10
+ * @param {string} identifier - The identifier of the order to fetch.
11
+ * @returns {Promise<IApiResponseWithData<IOrder>>} A promise that resolves to the order data.
12
+ * @throws {Error} If the fetch request fails.
13
+ */
14
+ fetch(identifier: string): Promise<IApiResponseWithData<IOrder>>;
15
+ }
@@ -1,13 +1,15 @@
1
- import type { AuthenticatedService } from '../core';
2
- import type { BaseUser, IPurgeResponse, IUser, IUserAddress, IUserAddressParams, IUserPayment, IUserPaymentAddParams, IUserPaymentParams, IUserPaymentUpdateParams, IUserSessionParams } from '../interfaces';
1
+ import type { AuthenticatedService, PaymentSessionHelperService } from '../core';
2
+ import type { BaseUser, ILiquidPaymentToken, IPurgeResponse, IUser, IUserAddress, IUserAddressParams, IUserPayment, IUserPaymentAddParams, IUserPaymentParams, IUserPaymentSession, IUserSession, IUserSessionParams } from '../interfaces';
3
3
  import type { IApiResponseWithData } from '../types';
4
4
  /**
5
5
  * A class representing a user service.
6
6
  */
7
7
  export declare class UserService {
8
8
  private client;
9
+ private paymentSessionHelperService;
9
10
  private readonly servicePath;
10
- constructor(client: AuthenticatedService);
11
+ private readonly env;
12
+ constructor(client: AuthenticatedService, paymentSessionHelperService: PaymentSessionHelperService);
11
13
  /**
12
14
  * Creates or updates a user session.
13
15
  *
@@ -16,6 +18,22 @@ export declare class UserService {
16
18
  * @throws {Error} If the session creation/update request fails or if neither id nor email is provided.
17
19
  */
18
20
  createOrUpdateSession(params: IUserSessionParams): Promise<IApiResponseWithData<IUser>>;
21
+ /**
22
+ * Creates a payment session for a user.
23
+ *
24
+ * @param {IUserPaymentSession} params - The parameters required to create the payment session.
25
+ * @return {Promise<IApiResponseWithData<IUserSession>>} A promise that resolves to the API
26
+ * response containing the user session data.
27
+ */
28
+ createPaymentSession(params: IUserPaymentSession): Promise<IApiResponseWithData<IUserSession>>;
29
+ /**
30
+ * Confirms and finalizes a payment session using the provided token.
31
+ *
32
+ * @param {string} token - The token representing the payment session to finalize.
33
+ * @return {Promise<IApiResponseWithData<ILiquidPaymentToken>>} A promise that resolves with the API
34
+ * response containing data about the finalized payment session.
35
+ */
36
+ finalizePaymentSession(token: string): Promise<IApiResponseWithData<ILiquidPaymentToken>>;
19
37
  /**
20
38
  * Fetches user data from the API using the provided identifier.
21
39
  *
@@ -113,7 +131,7 @@ export declare class UserService {
113
131
  * the updated payment information.
114
132
  * @throws {Error} - Throws an error if required parameters are missing or the request fails.
115
133
  */
116
- updatePayment(params: IUserPaymentParams | IUserPaymentUpdateParams): Promise<IApiResponseWithData<boolean>>;
134
+ updatePayment(params: IUserPaymentParams): Promise<IApiResponseWithData<boolean>>;
117
135
  /**
118
136
  * Purges a payment record for a specified customer.
119
137
  *