@liquidcommerce/cloud-sdk 1.2.0 → 1.4.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 +384 -93
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/liquidcommerce-cloud-sdk.ssr.js +1 -1
- package/dist/types/constants/core.constant.d.ts +8 -0
- package/dist/types/core/cart-helper.service.d.ts +1 -1
- package/dist/types/core/catalog-helper.service.d.ts +24 -4
- package/dist/types/core/checkout-helper.service.d.ts +23 -8
- package/dist/types/core/location-helper.service.d.ts +4 -3
- package/dist/types/core/payment-provider.service.d.ts +56 -8
- package/dist/types/core/singleton.service.d.ts +9 -10
- package/dist/types/{enums.d.ts → enums/enums.d.ts} +62 -92
- package/dist/types/enums/index.d.ts +2 -0
- package/dist/types/enums/taxonomy.d.ts +285 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interfaces/address.interface.d.ts +86 -1
- package/dist/types/interfaces/cart.interface.d.ts +28 -10
- package/dist/types/interfaces/catalog.interface.d.ts +268 -8
- package/dist/types/interfaces/checkout.interface.d.ts +265 -50
- package/dist/types/interfaces/index.d.ts +8 -0
- package/dist/types/interfaces/liquid-commerce-client.interface.d.ts +199 -9
- package/dist/types/interfaces/payment.interface.d.ts +88 -9
- package/dist/types/interfaces/retailer.interface.d.ts +121 -0
- package/dist/types/interfaces/user.interface.d.ts +145 -9
- package/dist/types/liquid-commerce-client.d.ts +3 -173
- package/dist/types/services/address.service.d.ts +2 -18
- package/dist/types/services/cart.service.d.ts +1 -1
- package/dist/types/services/catalog.service.d.ts +1 -12
- package/dist/types/services/checkout.service.d.ts +1 -1
- package/dist/types/services/index.d.ts +5 -0
- package/dist/types/services/payment.service.d.ts +24 -1
- package/dist/types/services/user.service.d.ts +83 -1
- package/dist/types/types.d.ts +11 -5
- package/package.json +105 -105
- package/umd/liquidcommerce-cloud-sdk.min.js +1 -1
- package/dist/types/interfaces/catalog.service.interface.d.ts +0 -65
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './address.interface';
|
|
2
|
+
export * from './cart.interface';
|
|
3
|
+
export * from './catalog.interface';
|
|
4
|
+
export * from './checkout.interface';
|
|
5
|
+
export * from './liquid-commerce-client.interface';
|
|
6
|
+
export * from './payment.interface';
|
|
7
|
+
export * from './retailer.interface';
|
|
8
|
+
export * from './user.interface';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { IAddressAutocompleteParams, IAddressAutocompleteResult, IAddressDetailsParams, IAddressDetailsResult } from '../services/address.service';
|
|
2
|
-
import type { IAvailabilityParams, IAvailabilityResponse } from '../services/catalog.service';
|
|
3
1
|
import type { IApiResponseWithData, IApiResponseWithoutData, ILiquidCommerceConfig } from '../types';
|
|
2
|
+
import type { IAddressAutocompleteParams, IAddressAutocompleteResult, IAddressDetailsParams, IAddressDetailsResult } from './address.interface';
|
|
4
3
|
import type { ICart, ICartUpdateParams } from './cart.interface';
|
|
5
|
-
import type { ICatalog, ICatalogParams } from './catalog.
|
|
4
|
+
import type { IAvailabilityParams, IAvailabilityResponse, ICatalog, ICatalogParams } from './catalog.interface';
|
|
6
5
|
import type { ICheckoutCompleteParams, ICheckoutCompleteResponse, ICheckoutPrepareParams, ICheckoutPrepareResponse } from './checkout.interface';
|
|
7
6
|
import type { ILiquidPaymentConfig, ILiquidPaymentToken, IPaymentElementEventMap } from './payment.interface';
|
|
8
|
-
import type { IPurgeResponse, IUser, IUserAddress, IUserAddressParams, IUserSessionParams } from './user.interface';
|
|
7
|
+
import type { BaseUser, IPurgeResponse, IUser, IUserAddress, IUserAddressParams, IUserPayment, IUserPaymentAddParams, IUserPaymentUpdateParams, IUserSessionParams } from './user.interface';
|
|
9
8
|
/**
|
|
10
9
|
* Interface representing the LiquidCommerce client.
|
|
11
10
|
* Provides access to methods related to addresses, catalogs, carts, and initialization.
|
|
@@ -37,14 +36,18 @@ export interface ILiquidCommerceClient {
|
|
|
37
36
|
*/
|
|
38
37
|
cart: ICartMethod;
|
|
39
38
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @
|
|
39
|
+
* Provides methods for managing user data and authentication.
|
|
40
|
+
* See {@link IUserMethod} for more details on the available methods.
|
|
41
|
+
*/
|
|
42
|
+
user: IUserMethod;
|
|
43
|
+
/**
|
|
44
|
+
* Provides methods for processing payments.
|
|
45
|
+
* See {@link IPaymentMethod} for more details on the available methods.
|
|
42
46
|
*/
|
|
43
47
|
payment: IPaymentMethod;
|
|
44
48
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @type {ICheckoutMethod} - The interface representing the checkout method.
|
|
49
|
+
* Provides methods for managing the checkout process.
|
|
50
|
+
* See {@link ICheckoutMethod} for more details on the available methods.
|
|
48
51
|
*/
|
|
49
52
|
checkout: ICheckoutMethod;
|
|
50
53
|
}
|
|
@@ -318,6 +321,28 @@ export interface IUserMethod {
|
|
|
318
321
|
* @see {@link IUser} for the structure of the user data returned.
|
|
319
322
|
*/
|
|
320
323
|
session: (params: IUserSessionParams) => Promise<IApiResponseWithData<IUser>>;
|
|
324
|
+
/**
|
|
325
|
+
* Represents a user object without creating a new session.
|
|
326
|
+
*
|
|
327
|
+
* @param {string} identifier - The parameters for fetching a user.
|
|
328
|
+
* @returns {Promise<IApiResponseWithData<BaseUser>>} A Promise that resolves to the API response with user data.
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* const liquidCommerce = await LiquidCommerce(apiKey, config);
|
|
332
|
+
*
|
|
333
|
+
* try {
|
|
334
|
+
* // Fetch by user ID
|
|
335
|
+
* const userFetched = await liquidCommerce.user.fetch('c1fbd454-a540-4f42-86e9-f87a98bf1812');
|
|
336
|
+
* console.log('User fetch response:', userFetched?.data);
|
|
337
|
+
* } catch (error) {
|
|
338
|
+
* console.error('Failed to fetch user data:', error);
|
|
339
|
+
* }
|
|
340
|
+
*
|
|
341
|
+
* @throws {Error} - Throws an error if the sessions request fails or if authentication is unsuccessful.
|
|
342
|
+
*
|
|
343
|
+
* @see {@link BaseUser} for the structure of the user data returned.
|
|
344
|
+
*/
|
|
345
|
+
fetch: (identifier: string) => Promise<IApiResponseWithData<BaseUser>>;
|
|
321
346
|
/**
|
|
322
347
|
* Purges a user's data from the system.
|
|
323
348
|
*
|
|
@@ -344,6 +369,37 @@ export interface IUserMethod {
|
|
|
344
369
|
* @see {@link IPurgeResponse} for the structure of the user data returned.
|
|
345
370
|
*/
|
|
346
371
|
purge: (identifier: string) => Promise<IApiResponseWithData<IPurgeResponse>>;
|
|
372
|
+
/**
|
|
373
|
+
* Adds a new address for a user.
|
|
374
|
+
*
|
|
375
|
+
* @param {IUserAddressParams} params - The parameters for adding a new address.
|
|
376
|
+
* @returns {Promise<IApiResponseWithData<IUserAddress>>} A promise that resolves to the API response with the added address data.
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* const liquidCommerce = await LiquidCommerce(apiKey, config);
|
|
380
|
+
*
|
|
381
|
+
* try {
|
|
382
|
+
* const newAddress = await liquidCommerce.user.addAddress({
|
|
383
|
+
* customerId: 'c1fbd454-a540-4f42-86e9-f87a98bf1812',
|
|
384
|
+
* one: '100 Madison St',
|
|
385
|
+
* city: 'New York',
|
|
386
|
+
* state: 'NY',
|
|
387
|
+
* zip: '10004',
|
|
388
|
+
* type: 'shipping',
|
|
389
|
+
* isDefault: true
|
|
390
|
+
* });
|
|
391
|
+
*
|
|
392
|
+
* console.log('Added address:', newAddress?.data);
|
|
393
|
+
* } catch (error) {
|
|
394
|
+
* console.error('Failed to add address:', error);
|
|
395
|
+
* }
|
|
396
|
+
*
|
|
397
|
+
* @throws {Error} - Throws an error if the add address request fails or if authentication is unsuccessful.
|
|
398
|
+
*
|
|
399
|
+
* @see {@link IUserAddressParams} for the structure of the add address request parameters.
|
|
400
|
+
* @see {@link IUserAddress} for the structure of the user's address data returned.
|
|
401
|
+
*/
|
|
402
|
+
addAddress: (params: IUserAddressParams) => Promise<IApiResponseWithData<IUserAddress>>;
|
|
347
403
|
/**
|
|
348
404
|
* Updates or creates a new address for a user.
|
|
349
405
|
*
|
|
@@ -398,6 +454,86 @@ export interface IUserMethod {
|
|
|
398
454
|
* @see {@link IPurgeResponse} for the structure of the user's purged data state.
|
|
399
455
|
*/
|
|
400
456
|
purgeAddress: (addressId: string) => Promise<IApiResponseWithData<IPurgeResponse>>;
|
|
457
|
+
/**
|
|
458
|
+
* Adds a new payment method for a user.
|
|
459
|
+
*
|
|
460
|
+
* @param {IUserPaymentAddParams} params - The parameters for adding a new payment method.
|
|
461
|
+
* @returns {Promise<IApiResponseWithData<IUserPayment>>} A promise that resolves to the API response with the added payment method data.
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* const liquidCommerce = await LiquidCommerce(apiKey, config);
|
|
465
|
+
*
|
|
466
|
+
* try {
|
|
467
|
+
* const newPayment = await liquidCommerce.user.addPayment({
|
|
468
|
+
* customerId: 'c1fbd454-a540-4f42-86e9-f87a98bf1812',
|
|
469
|
+
* paymentMethodId: 'pm_1234567890abcdef',
|
|
470
|
+
* isDefault: true
|
|
471
|
+
* });
|
|
472
|
+
*
|
|
473
|
+
* console.log('Added payment method:', newPayment?.data);
|
|
474
|
+
* } catch (error) {
|
|
475
|
+
* console.error('Failed to add payment method:', error);
|
|
476
|
+
* }
|
|
477
|
+
*
|
|
478
|
+
* @throws {Error} - Throws an error if the add payment request fails or if authentication is unsuccessful.
|
|
479
|
+
*
|
|
480
|
+
* @see {@link IUserPaymentParams} for the structure of the add payment request parameters.
|
|
481
|
+
* @see {@link IUserPayment} for the structure of the user's payment method data returned.
|
|
482
|
+
*/
|
|
483
|
+
addPayment: (params: IUserPaymentAddParams) => Promise<IApiResponseWithData<IUserPayment>>;
|
|
484
|
+
/**
|
|
485
|
+
* Updates a payment method for a user.
|
|
486
|
+
*
|
|
487
|
+
* @param {IUserPaymentUpdateParams} params - The parameters for updating a payment method.
|
|
488
|
+
* @returns {Promise<IApiResponseWithData<IUserPayment>>} A promise that resolves to the API response with the updated payment method data.
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* const liquidCommerce = await LiquidCommerce(apiKey, config);
|
|
492
|
+
*
|
|
493
|
+
* try {
|
|
494
|
+
* const updatedPayment = await liquidCommerce.user.updatePayment({
|
|
495
|
+
* customerId: 'c1fbd454-a540-4f42-86e9-f87a98bf1812',
|
|
496
|
+
* paymentMethodId: 'pm_1234567890abcdef',
|
|
497
|
+
* isDefault: true
|
|
498
|
+
* });
|
|
499
|
+
*
|
|
500
|
+
* console.log('Updated payment method:', updatedPayment?.data);
|
|
501
|
+
* } catch (error) {
|
|
502
|
+
* console.error('Failed to update payment method:', error);
|
|
503
|
+
* }
|
|
504
|
+
*
|
|
505
|
+
* @throws {Error} - Throws an error if the update payment request fails or if authentication is unsuccessful.
|
|
506
|
+
*
|
|
507
|
+
* @see {@link IUserPaymentUpdateParams} for the structure of the update payment request parameters.
|
|
508
|
+
* @see {@link IUserPayment} for the structure of the user's payment method data returned.
|
|
509
|
+
*/
|
|
510
|
+
updatePayment: (params: IUserPaymentUpdateParams) => Promise<IApiResponseWithData<IUserPayment>>;
|
|
511
|
+
/**
|
|
512
|
+
* Purges a payment method for a user.
|
|
513
|
+
*
|
|
514
|
+
* @param {string} customerId - The ID of the customer.
|
|
515
|
+
* @param {string} paymentId - The ID of the payment method to purge.
|
|
516
|
+
* @returns {Promise<IApiResponseWithData<IPurgeResponse>>} A promise that resolves to the purge response.
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* const liquidCommerce = await LiquidCommerce(apiKey, config);
|
|
520
|
+
*
|
|
521
|
+
* try {
|
|
522
|
+
* const paymentPurgeResponse = await liquidCommerce.user.purgePayment(
|
|
523
|
+
* 'c1fbd454-a540-4f42-86e9-f87a98bf1812',
|
|
524
|
+
* 'pm_1234567890abcdef'
|
|
525
|
+
* );
|
|
526
|
+
*
|
|
527
|
+
* console.log('Payment method purge response:', paymentPurgeResponse?.data);
|
|
528
|
+
* } catch (error) {
|
|
529
|
+
* console.error('Failed to purge payment method:', error);
|
|
530
|
+
* }
|
|
531
|
+
*
|
|
532
|
+
* @throws {Error} - Throws an error if the purge payment request fails or if authentication is unsuccessful.
|
|
533
|
+
*
|
|
534
|
+
* @see {@link IPurgeResponse} for the structure of the purge response data.
|
|
535
|
+
*/
|
|
536
|
+
purgePayment: (customerId: string, paymentId: string) => Promise<IApiResponseWithData<IPurgeResponse>>;
|
|
401
537
|
}
|
|
402
538
|
export interface IPaymentMethod {
|
|
403
539
|
/**
|
|
@@ -501,6 +637,60 @@ export interface IPaymentMethod {
|
|
|
501
637
|
* @throws {Error} - Throws an error if the payment element has not been initialized.
|
|
502
638
|
*/
|
|
503
639
|
unsubscribe<K extends keyof IPaymentElementEventMap>(eventType: K, handler?: (event: IPaymentElementEventMap[K]) => void): void;
|
|
640
|
+
/**
|
|
641
|
+
* Collapses the payment element if it has been initialized.
|
|
642
|
+
*
|
|
643
|
+
* @returns {void}
|
|
644
|
+
*
|
|
645
|
+
* @example
|
|
646
|
+
* const liquidCommerce = await LiquidCommerce(apiKey, config);
|
|
647
|
+
*
|
|
648
|
+
* try {
|
|
649
|
+
* liquidCommerce.payment.collapse();
|
|
650
|
+
* console.log('Payment element collapsed');
|
|
651
|
+
* } catch (error) {
|
|
652
|
+
* console.error('Failed to collapse payment element:', error);
|
|
653
|
+
* }
|
|
654
|
+
*
|
|
655
|
+
* @throws {Error} - Throws an error if the payment element has not been initialized.
|
|
656
|
+
*/
|
|
657
|
+
collapse(): void;
|
|
658
|
+
/**
|
|
659
|
+
* Unmounts the payment element from the DOM.
|
|
660
|
+
*
|
|
661
|
+
* @returns {void}
|
|
662
|
+
*
|
|
663
|
+
* @example
|
|
664
|
+
* const liquidCommerce = await LiquidCommerce(apiKey, config);
|
|
665
|
+
*
|
|
666
|
+
* try {
|
|
667
|
+
* liquidCommerce.payment.unmount();
|
|
668
|
+
* console.log('Payment element unmounted');
|
|
669
|
+
* } catch (error) {
|
|
670
|
+
* console.error('Failed to unmount payment element:', error);
|
|
671
|
+
* }
|
|
672
|
+
*
|
|
673
|
+
* @throws {Error} - Throws an error if the payment element has not been initialized.
|
|
674
|
+
*/
|
|
675
|
+
unmount(): void;
|
|
676
|
+
/**
|
|
677
|
+
* Destroys the payment element if it has been initialized.
|
|
678
|
+
*
|
|
679
|
+
* @returns {void}
|
|
680
|
+
*
|
|
681
|
+
* @example
|
|
682
|
+
* const liquidCommerce = await LiquidCommerce(apiKey, config);
|
|
683
|
+
*
|
|
684
|
+
* try {
|
|
685
|
+
* liquidCommerce.payment.destroy();
|
|
686
|
+
* console.log('Payment element destroyed');
|
|
687
|
+
* } catch (error) {
|
|
688
|
+
* console.error('Failed to destroy payment element:', error);
|
|
689
|
+
* }
|
|
690
|
+
*
|
|
691
|
+
* @throws {Error} - Throws an error if the payment element has not been initialized.
|
|
692
|
+
*/
|
|
693
|
+
destroy(): void;
|
|
504
694
|
}
|
|
505
695
|
export interface ICheckoutMethod {
|
|
506
696
|
/**
|
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
import type { StripePaymentElementChangeEvent } from '@stripe/stripe-js';
|
|
2
2
|
import type { StripeError } from '@stripe/stripe-js/dist/stripe-js/stripe';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the options to configure the layout for a liquid payment element.
|
|
5
|
+
*
|
|
6
|
+
* @interface
|
|
7
|
+
* @property {'tabs' | 'accordion' | 'auto'} [layout] - Determines the layout style.
|
|
8
|
+
* - 'tabs': Layout will use tabbed navigation.
|
|
9
|
+
* - 'accordion': Layout will use accordion-style sections.
|
|
10
|
+
* - 'auto': Layout style will be chosen automatically based on context.
|
|
11
|
+
*/
|
|
3
12
|
export interface ILiquidPaymentElementOptions {
|
|
4
13
|
layout?: 'tabs' | 'accordion' | 'auto';
|
|
5
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* The configuration interface for Liquid Payment.
|
|
17
|
+
*
|
|
18
|
+
* @interface ILiquidPaymentConfig
|
|
19
|
+
*
|
|
20
|
+
* @property {string} clientSecret - The secret key for the client.
|
|
21
|
+
*
|
|
22
|
+
* @property {string} key - The API key provided for access.
|
|
23
|
+
*
|
|
24
|
+
* @property {string} elementId - The ID of the HTML element where the payment form will be rendered.
|
|
25
|
+
*
|
|
26
|
+
* @property {Object} [appearance] - Optional configuration for styling the payment element.
|
|
27
|
+
*
|
|
28
|
+
* @property {'default' | 'night' | 'flat'} [appearance.theme] - An optional theme for the payment form appearance.
|
|
29
|
+
*
|
|
30
|
+
* @property {ILiquidPaymentElementOptions} [elementOptions] - Additional options for configuring the payment element.
|
|
31
|
+
*/
|
|
6
32
|
export interface ILiquidPaymentConfig {
|
|
7
33
|
clientSecret: string;
|
|
8
34
|
key: string;
|
|
@@ -12,16 +38,49 @@ export interface ILiquidPaymentConfig {
|
|
|
12
38
|
};
|
|
13
39
|
elementOptions?: ILiquidPaymentElementOptions;
|
|
14
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Interface representing the parameters required to confirm a session.
|
|
43
|
+
*
|
|
44
|
+
* Properties:
|
|
45
|
+
* - sessionSecret: A string representing the secret key for the session.
|
|
46
|
+
* - paymentMethodId: A string ID corresponding to the payment method to be used.
|
|
47
|
+
*/
|
|
48
|
+
export interface IConfirmSessionParams {
|
|
49
|
+
sessionSecret: string;
|
|
50
|
+
paymentMethodId: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Interface for representing a liquid payment token.
|
|
54
|
+
*
|
|
55
|
+
* An `ILiquidPaymentToken` contains relevant information about
|
|
56
|
+
* a payment token, which can be associated with various payment methods
|
|
57
|
+
* such as credit cards.
|
|
58
|
+
*
|
|
59
|
+
* Properties:
|
|
60
|
+
* @property {string} [id] - The unique identifier for the payment token.
|
|
61
|
+
* @property {string} [type] - The type/category of the payment token.
|
|
62
|
+
* @property {object} [card] - Information about the card associated with the payment token.
|
|
63
|
+
* @property {string|null} [card.brand] - The brand of the card (e.g., Visa, MasterCard).
|
|
64
|
+
* @property {string|null} [card.country] - The country where the card was issued.
|
|
65
|
+
* @property {number|null} [card.expMonth] - The expiration month of the card.
|
|
66
|
+
* @property {number|null} [card.expYear] - The expiration year of the card.
|
|
67
|
+
* @property {string|null} [card.last4] - The last four digits of the card number.
|
|
68
|
+
* @property {string|null} [card.funding] - The funding type of the card (e.g., credit, debit).
|
|
69
|
+
* @property {number} [created] - The timestamp (Unix epoch) indicating when the token was created.
|
|
70
|
+
* @property {object} [error] - Information about any error that occurred while generating the token.
|
|
71
|
+
* @property {string} [error.message] - The error message.
|
|
72
|
+
* @property {string} [error.code] - A code representing the specific error that occurred.
|
|
73
|
+
*/
|
|
15
74
|
export interface ILiquidPaymentToken {
|
|
16
75
|
id?: string;
|
|
17
76
|
type?: string;
|
|
18
77
|
card?: {
|
|
19
|
-
brand: string;
|
|
20
|
-
country: string;
|
|
21
|
-
expMonth: number;
|
|
22
|
-
expYear: number;
|
|
23
|
-
last4: string;
|
|
24
|
-
funding: string;
|
|
78
|
+
brand: string | null;
|
|
79
|
+
country: string | null;
|
|
80
|
+
expMonth: number | null;
|
|
81
|
+
expYear: number | null;
|
|
82
|
+
last4: string | null;
|
|
83
|
+
funding: string | null;
|
|
25
84
|
};
|
|
26
85
|
created?: number;
|
|
27
86
|
error?: {
|
|
@@ -29,12 +88,33 @@ export interface ILiquidPaymentToken {
|
|
|
29
88
|
code?: string;
|
|
30
89
|
};
|
|
31
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* This interface represents an error encountered during a liquid payment process.
|
|
93
|
+
*
|
|
94
|
+
* Properties:
|
|
95
|
+
*
|
|
96
|
+
* - type: A string indicating the type of error. Possible values are:
|
|
97
|
+
* - 'validation_error': Indicates a validation error.
|
|
98
|
+
* - 'api_error': Indicates an error related to the API.
|
|
99
|
+
* - 'client_error': Indicates an error on the client side.
|
|
100
|
+
* - 'confirm_error': Indicates an error during confirmation.
|
|
101
|
+
*
|
|
102
|
+
* - message: A string providing a descriptive message about the error.
|
|
103
|
+
*
|
|
104
|
+
* - code: An optional string that can provide a specific error code.
|
|
105
|
+
*
|
|
106
|
+
* - param: An optional string indicating the parameter that caused the error, if applicable.
|
|
107
|
+
*/
|
|
32
108
|
export interface ILiquidPaymentError {
|
|
33
|
-
type: 'validation_error' | 'api_error' | 'client_error';
|
|
109
|
+
type: 'validation_error' | 'api_error' | 'client_error' | 'confirm_error';
|
|
34
110
|
message: string;
|
|
35
111
|
code?: string;
|
|
36
112
|
param?: string;
|
|
37
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Represents the event map for payment elements and defines the types of events
|
|
116
|
+
* that can occur within the payment process.
|
|
117
|
+
*/
|
|
38
118
|
export interface IPaymentElementEventMap {
|
|
39
119
|
change: StripePaymentElementChangeEvent;
|
|
40
120
|
ready: StripePaymentElementChangeEvent;
|
|
@@ -47,8 +127,7 @@ export interface IPaymentElementEventMap {
|
|
|
47
127
|
};
|
|
48
128
|
}
|
|
49
129
|
/**
|
|
50
|
-
* Interface
|
|
51
|
-
* @interface
|
|
130
|
+
* Interface representing a payment provider that integrates with a Liquid payment gateway.
|
|
52
131
|
*/
|
|
53
132
|
export interface IPaymentProvider {
|
|
54
133
|
/**
|
|
@@ -1,40 +1,145 @@
|
|
|
1
1
|
import type { DAYS_OF_WEEK, ENUM_MODALITIES } from '../enums';
|
|
2
2
|
import type { IAddress } from './address.interface';
|
|
3
|
+
/**
|
|
4
|
+
* The IRetailerTimes interface represents the working hours of a retailer.
|
|
5
|
+
*
|
|
6
|
+
* @property {string} startsAt - The time at which the retailer begins its operations.
|
|
7
|
+
* @property {string} endsAt - The time at which the retailer ends its operations.
|
|
8
|
+
*/
|
|
3
9
|
export interface IRetailerTimes {
|
|
4
10
|
startsAt: string;
|
|
5
11
|
endsAt: string;
|
|
6
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Interface representing the configuration of retailer hours.
|
|
15
|
+
*
|
|
16
|
+
* @interface IRetailerHoursConfig
|
|
17
|
+
* @property {boolean} active - Indicates if the retailer is currently active.
|
|
18
|
+
* @property {IRetailerTimes[]} times - An array of time configurations for the retailer.
|
|
19
|
+
*/
|
|
7
20
|
export interface IRetailerHoursConfig {
|
|
8
21
|
active: boolean;
|
|
9
22
|
times: IRetailerTimes[];
|
|
10
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Represents the operating hours configuration for a retailer, mapped by days of the week.
|
|
26
|
+
* Each day of the week has an associated configuration that details the opening and closing times.
|
|
27
|
+
*
|
|
28
|
+
* @type {Object} RetailerHours
|
|
29
|
+
* @property {IRetailerHoursConfig} MONDAY - Configuration for Monday
|
|
30
|
+
* @property {IRetailerHoursConfig} TUESDAY - Configuration for Tuesday
|
|
31
|
+
* @property {IRetailerHoursConfig} WEDNESDAY - Configuration for Wednesday
|
|
32
|
+
* @property {IRetailerHoursConfig} THURSDAY - Configuration for Thursday
|
|
33
|
+
* @property {IRetailerHoursConfig} FRIDAY - Configuration for Friday
|
|
34
|
+
* @property {IRetailerHoursConfig} SATURDAY - Configuration for Saturday
|
|
35
|
+
* @property {IRetailerHoursConfig} SUNDAY - Configuration for Sunday
|
|
36
|
+
*/
|
|
11
37
|
export type RetailerHours = {
|
|
12
38
|
[day in DAYS_OF_WEEK]: IRetailerHoursConfig;
|
|
13
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Interface representing the expectations of a retailer.
|
|
42
|
+
*
|
|
43
|
+
* @interface IRetailerExpectation
|
|
44
|
+
*
|
|
45
|
+
* @property {string} detail - A detailed description of the expectation.
|
|
46
|
+
* @property {string} short - A brief, summarized version of the expectation.
|
|
47
|
+
*/
|
|
14
48
|
export interface IRetailerExpectation {
|
|
15
49
|
detail: string;
|
|
16
50
|
short: string;
|
|
17
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* The IRetailerFreeDelivery interface represents a structure for the free delivery
|
|
54
|
+
* policy of a retailer. This includes the minimum purchase amount required for
|
|
55
|
+
* free delivery and the status of the free delivery offer.
|
|
56
|
+
*
|
|
57
|
+
* @property min - The minimum amount in the retailer's currency required to qualify
|
|
58
|
+
* for free delivery.
|
|
59
|
+
*
|
|
60
|
+
* @property active - A boolean indicating whether the free delivery offer is currently
|
|
61
|
+
* active or not.
|
|
62
|
+
*/
|
|
18
63
|
export interface IRetailerFreeDelivery {
|
|
19
64
|
min: number;
|
|
20
65
|
active: boolean;
|
|
21
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Interface representing the configuration for fee-based shipping.
|
|
69
|
+
*
|
|
70
|
+
* @property {number} maxQuantity - The maximum quantity of items eligible for the shipping fee.
|
|
71
|
+
* @property {number} fee - The fee amount for shipping.
|
|
72
|
+
* @property {boolean} active - Indicates whether the fee-based shipping configuration is active.
|
|
73
|
+
*/
|
|
22
74
|
export interface IFeeShippingConfig {
|
|
23
75
|
maxQuantity: number;
|
|
24
76
|
fee: number;
|
|
25
77
|
active: boolean;
|
|
26
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Interface representing the shipping fee configurations for a retailer.
|
|
81
|
+
*
|
|
82
|
+
* @interface IRetailerFeeShipping
|
|
83
|
+
* @property {IFeeShippingConfig} individual - Configuration for individual item shipping fee.
|
|
84
|
+
* @property {IFeeShippingConfig} pack - Configuration for pack item shipping fee.
|
|
85
|
+
* @property {IRetailerFreeDelivery} free - Configuration for free delivery options.
|
|
86
|
+
*/
|
|
27
87
|
export interface IRetailerFeeShipping {
|
|
28
88
|
individual: IFeeShippingConfig;
|
|
29
89
|
pack: IFeeShippingConfig;
|
|
30
90
|
free: IRetailerFreeDelivery;
|
|
31
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Interface representing the delivery fee structure for a retailer.
|
|
94
|
+
*
|
|
95
|
+
* @interface IRetailerFeeDelivery
|
|
96
|
+
*
|
|
97
|
+
* @property {number} min - The minimum amount for delivery fee calculation.
|
|
98
|
+
* @property {number} fee - The standard delivery fee charged by the retailer.
|
|
99
|
+
* @property {IRetailerFreeDelivery} free - The criteria for free delivery.
|
|
100
|
+
*/
|
|
32
101
|
export interface IRetailerFeeDelivery {
|
|
33
102
|
min: number;
|
|
34
103
|
fee: number;
|
|
35
104
|
free: IRetailerFreeDelivery;
|
|
36
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Represents the possible types of retailer fees.
|
|
108
|
+
*
|
|
109
|
+
* @typedef {Object} IRetailerFees
|
|
110
|
+
* @property {IRetailerFeeShipping} shipping - The shipping fee details.
|
|
111
|
+
* @property {IRetailerFeeDelivery} delivery - The delivery fee details.
|
|
112
|
+
*/
|
|
37
113
|
export type IRetailerFees = IRetailerFeeShipping | IRetailerFeeDelivery;
|
|
114
|
+
/**
|
|
115
|
+
* Interface representing the fulfillment details of a retailer.
|
|
116
|
+
*
|
|
117
|
+
* @interface IRetailerFulfillments
|
|
118
|
+
*
|
|
119
|
+
* @property {string} id - The unique identifier for the fulfillment.
|
|
120
|
+
*
|
|
121
|
+
* @property {ENUM_MODALITIES} type - The modality type of the fulfillment.
|
|
122
|
+
*
|
|
123
|
+
* @property {number} [deliveryFee] - Optional delivery fee for the fulfillment.
|
|
124
|
+
*
|
|
125
|
+
* @property {number} [shippingFee] - Optional shipping fee for the fulfillment.
|
|
126
|
+
*
|
|
127
|
+
* @property {number} [engravingFee] - Optional engraving fee for the fulfillment.
|
|
128
|
+
*
|
|
129
|
+
* @property {number} [subtotal] - Optional subtotal amount for the fulfillment.
|
|
130
|
+
*
|
|
131
|
+
* @property {string} [timezone] - Optional timezone associated with the fulfillment.
|
|
132
|
+
*
|
|
133
|
+
* @property {IRetailerFees} fees - The various fees associated with the fulfillment.
|
|
134
|
+
*
|
|
135
|
+
* @property {IRetailerExpectation} expectation - The expectations set for the fulfillment process.
|
|
136
|
+
*
|
|
137
|
+
* @property {RetailerHours} hours - The working hours applicable to the fulfillment.
|
|
138
|
+
*
|
|
139
|
+
* @property {IRetailerTimes[]} breaks - The breaks within the working hours.
|
|
140
|
+
*
|
|
141
|
+
* @property {string[]} items - List of item identifiers included in the fulfillment.
|
|
142
|
+
*/
|
|
38
143
|
export interface IRetailerFulfillments {
|
|
39
144
|
id: string;
|
|
40
145
|
type: ENUM_MODALITIES;
|
|
@@ -49,6 +154,22 @@ export interface IRetailerFulfillments {
|
|
|
49
154
|
breaks: IRetailerTimes[];
|
|
50
155
|
items: string[];
|
|
51
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Interface representing a retailer with various attributes related to transactions and logistics.
|
|
159
|
+
*
|
|
160
|
+
* @interface
|
|
161
|
+
*
|
|
162
|
+
* @property {string} name - The name of the retailer.
|
|
163
|
+
* @property {string} id - The unique identifier for the retailer.
|
|
164
|
+
* @property {number} [platformFee] - Optional platform fee associated with the retailer.
|
|
165
|
+
* @property {number} [deliveryFee] - Optional delivery fee charged by the retailer.
|
|
166
|
+
* @property {number} [shippingFee] - Optional shipping fee charged by the retailer.
|
|
167
|
+
* @property {number} [engravingFee] - Optional engraving fee for customization services.
|
|
168
|
+
* @property {number} [subtotal] - Optional subtotal amount before fees and taxes.
|
|
169
|
+
* @property {number} [total] - Optional total amount including fees and taxes.
|
|
170
|
+
* @property {IAddress} [address] - Optional address information for the retailer.
|
|
171
|
+
* @property {IRetailerFulfillments[]} fulfillments - List of fulfillment details related to retailer orders.
|
|
172
|
+
*/
|
|
52
173
|
export interface IRetailer {
|
|
53
174
|
name: string;
|
|
54
175
|
id: string;
|