@liquidcommerce/cloud-sdk 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +378 -120
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/liquidcommerce-cloud-sdk.ssr.js +1 -1
- package/dist/types/constants/core.constant.d.ts +8 -0
- package/dist/types/core/cart-helper.service.d.ts +1 -1
- package/dist/types/core/catalog-helper.service.d.ts +24 -4
- package/dist/types/core/checkout-helper.service.d.ts +23 -8
- package/dist/types/core/location-helper.service.d.ts +4 -3
- package/dist/types/core/payment-provider.service.d.ts +16 -1
- package/dist/types/core/singleton.service.d.ts +9 -10
- package/dist/types/{enums.d.ts → enums/enums.d.ts} +62 -92
- package/dist/types/enums/index.d.ts +2 -0
- package/dist/types/enums/taxonomy.d.ts +285 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interfaces/address.interface.d.ts +86 -1
- package/dist/types/interfaces/cart.interface.d.ts +28 -10
- package/dist/types/interfaces/catalog.interface.d.ts +268 -8
- package/dist/types/interfaces/checkout.interface.d.ts +265 -50
- package/dist/types/interfaces/index.d.ts +8 -0
- package/dist/types/interfaces/liquid-commerce-client.interface.d.ts +34 -9
- package/dist/types/interfaces/payment.interface.d.ts +81 -2
- package/dist/types/interfaces/retailer.interface.d.ts +121 -0
- package/dist/types/interfaces/user.interface.d.ts +115 -8
- package/dist/types/liquid-commerce-client.d.ts +3 -192
- package/dist/types/services/address.service.d.ts +2 -18
- package/dist/types/services/cart.service.d.ts +1 -1
- package/dist/types/services/catalog.service.d.ts +1 -12
- package/dist/types/services/checkout.service.d.ts +1 -1
- package/dist/types/services/index.d.ts +5 -0
- package/dist/types/services/payment.service.d.ts +1 -1
- package/dist/types/services/user.service.d.ts +53 -1
- package/dist/types/types.d.ts +11 -5
- package/package.json +105 -105
- package/umd/liquidcommerce-cloud-sdk.min.js +1 -1
- package/dist/types/interfaces/catalog.service.interface.d.ts +0 -65
|
@@ -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, IUserPayment, IUserPaymentAddParams, IUserPaymentUpdateParams, 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
|
*
|
|
@@ -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,6 +38,39 @@ 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;
|
|
@@ -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
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;
|
|
@@ -1,22 +1,63 @@
|
|
|
1
1
|
import type { ENUM_ADDRESS_TYPE } from '../enums';
|
|
2
2
|
import type { ICoreParams } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a user session with key and secret used for authentication.
|
|
5
|
+
*/
|
|
3
6
|
export interface IUserSession {
|
|
4
7
|
key: string | null;
|
|
5
8
|
secret: string | null;
|
|
6
9
|
createdAt: Date;
|
|
7
10
|
}
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Represents the basic structure of a user's address.
|
|
13
|
+
*
|
|
14
|
+
* @interface IUserAddressBase
|
|
15
|
+
*
|
|
16
|
+
* @property {string} placesId - The unique identifier for the place.
|
|
17
|
+
* @property {string} one - The primary street address or neighborhood.
|
|
18
|
+
* @property {string} two - The secondary address information, such as apartment or suite number.
|
|
19
|
+
* @property {string} city - The name of the city.
|
|
20
|
+
* @property {string} state - The name of the state or region.
|
|
21
|
+
* @property {string} zip - The postal code.
|
|
22
|
+
* @property {string} country - The name of the country.
|
|
23
|
+
* @property {number} lat - The latitude coordinate of the address.
|
|
24
|
+
* @property {number} long - The longitude coordinate of the address.
|
|
25
|
+
*/
|
|
26
|
+
export interface IUserAddressBase {
|
|
27
|
+
placesId: string;
|
|
10
28
|
one: string;
|
|
11
|
-
two
|
|
29
|
+
two: string;
|
|
12
30
|
city: string;
|
|
13
31
|
state: string;
|
|
14
32
|
zip: string;
|
|
15
33
|
country: string;
|
|
34
|
+
lat: number;
|
|
35
|
+
long: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* IUserAddress interface represents a user's address details.
|
|
39
|
+
* It extends the IUserAddressBase interface, adding additional properties for
|
|
40
|
+
* unique identification, timestamps, and default status.
|
|
41
|
+
*
|
|
42
|
+
* @interface IUserAddress
|
|
43
|
+
* @extends {IUserAddressBase}
|
|
44
|
+
*
|
|
45
|
+
* @property {string} id - Unique identifier for the user's address.
|
|
46
|
+
* @property {Date} createdAt - Timestamp indicating when the address was created.
|
|
47
|
+
* @property {Date} updatedAt - Timestamp indicating the last update to the address.
|
|
48
|
+
* @property {boolean} [isDefault] - Optional flag indicating if this is the default address.
|
|
49
|
+
*/
|
|
50
|
+
export interface IUserAddress extends IUserAddressBase {
|
|
51
|
+
id: string;
|
|
16
52
|
createdAt: Date;
|
|
17
53
|
updatedAt: Date;
|
|
18
54
|
isDefault?: boolean;
|
|
19
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Interface representing a saved card.
|
|
58
|
+
*
|
|
59
|
+
* @interface ISavedCard
|
|
60
|
+
*/
|
|
20
61
|
export interface ISavedCard {
|
|
21
62
|
brand: string | null;
|
|
22
63
|
country: string | null;
|
|
@@ -25,12 +66,26 @@ export interface ISavedCard {
|
|
|
25
66
|
last4: string | null;
|
|
26
67
|
funding: string | null;
|
|
27
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Represents a user's payment method.
|
|
71
|
+
*
|
|
72
|
+
* @interface IUserPayment
|
|
73
|
+
* @property {string} id - The unique identifier for the payment method.
|
|
74
|
+
* @property {string} type - The type of the payment method (e.g., credit card, PayPal).
|
|
75
|
+
* @property {boolean} isDefault - Indicates whether this payment method is the default one.
|
|
76
|
+
* @property {ISavedCard} [card] - The saved card details if the payment method is a card.
|
|
77
|
+
* @property {Date} createdAt - The date when the payment method was added.
|
|
78
|
+
*/
|
|
28
79
|
export interface IUserPayment {
|
|
29
80
|
id: string;
|
|
30
81
|
type: string;
|
|
31
82
|
isDefault: boolean;
|
|
32
83
|
card?: ISavedCard;
|
|
84
|
+
createdAt: Date;
|
|
33
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* The IUser interface defines the structure for user objects within the application.
|
|
88
|
+
*/
|
|
34
89
|
export interface IUser {
|
|
35
90
|
id: string;
|
|
36
91
|
email: string;
|
|
@@ -46,6 +101,22 @@ export interface IUser {
|
|
|
46
101
|
savedPayments: IUserPayment[];
|
|
47
102
|
session: IUserSession;
|
|
48
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Represents a basic user excluding the session information.
|
|
106
|
+
*
|
|
107
|
+
* This type is useful when user session details are not required
|
|
108
|
+
* or need to be omitted for certain operations, such as basic
|
|
109
|
+
* user management tasks.
|
|
110
|
+
*
|
|
111
|
+
* It extends the IUser interface but removes the 'session' property.
|
|
112
|
+
*
|
|
113
|
+
* Typically used in contexts where minimal user information is
|
|
114
|
+
* sufficient, focusing on non-session related attributes.
|
|
115
|
+
*/
|
|
116
|
+
export type BaseUser = Omit<IUser, 'session'>;
|
|
117
|
+
/**
|
|
118
|
+
* Interface representing the parameters for a user session.
|
|
119
|
+
*/
|
|
49
120
|
export interface IUserSessionParams extends ICoreParams {
|
|
50
121
|
id?: string;
|
|
51
122
|
email?: string;
|
|
@@ -56,27 +127,63 @@ export interface IUserSessionParams extends ICoreParams {
|
|
|
56
127
|
profileImage?: string | null;
|
|
57
128
|
birthDate?: string | null;
|
|
58
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Interface representing the response from a purge operation.
|
|
132
|
+
*/
|
|
59
133
|
export interface IPurgeResponse {
|
|
60
134
|
deleted: boolean;
|
|
61
135
|
message: string;
|
|
62
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Interface representing the parameters required for user address operations.
|
|
139
|
+
* Extends the core parameters from ICoreParams.
|
|
140
|
+
*/
|
|
63
141
|
export interface IUserAddressParams extends ICoreParams {
|
|
64
142
|
customerId: string;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
143
|
+
placesId?: string;
|
|
144
|
+
one?: string;
|
|
145
|
+
two?: string;
|
|
146
|
+
city?: string;
|
|
147
|
+
state?: string;
|
|
148
|
+
zip?: string;
|
|
149
|
+
country?: string;
|
|
150
|
+
lat?: number;
|
|
151
|
+
long?: number;
|
|
70
152
|
type: ENUM_ADDRESS_TYPE;
|
|
71
153
|
isDefault?: boolean;
|
|
72
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Interface representing the parameters required for user payment operations.
|
|
157
|
+
*
|
|
158
|
+
* This interface extends the core parameters interface (`ICoreParams`) and includes
|
|
159
|
+
* specific properties necessary for processing a user payment.
|
|
160
|
+
*
|
|
161
|
+
* Properties:
|
|
162
|
+
* - `customerId`: A string representing the unique identifier of the customer making the payment.
|
|
163
|
+
* - `paymentMethodId`: A string representing the unique identifier of the payment method to be used.
|
|
164
|
+
*/
|
|
73
165
|
export interface IUserPaymentParams extends ICoreParams {
|
|
74
166
|
customerId: string;
|
|
75
167
|
paymentMethodId: string;
|
|
76
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Interface representing the parameters required to add a user payment.
|
|
171
|
+
*
|
|
172
|
+
* Extends the IUserPaymentParams interface to inherit the basic payment parameters.
|
|
173
|
+
*
|
|
174
|
+
* @property isDefault - Optional boolean indicating if the payment method should be set as default.
|
|
175
|
+
*/
|
|
77
176
|
export interface IUserPaymentAddParams extends IUserPaymentParams {
|
|
78
177
|
isDefault?: boolean;
|
|
79
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* IUserPaymentUpdateParams is an interface extending IUserPaymentParams,
|
|
181
|
+
* representing the parameters required to update user payment information.
|
|
182
|
+
*
|
|
183
|
+
* @extends IUserPaymentParams
|
|
184
|
+
*
|
|
185
|
+
* @property {boolean} isDefault - Indicates whether the payment method is the default one.
|
|
186
|
+
*/
|
|
80
187
|
export interface IUserPaymentUpdateParams extends IUserPaymentParams {
|
|
81
188
|
isDefault: boolean;
|
|
82
189
|
}
|