oneentry 1.0.145 → 1.0.146

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.
@@ -1,4 +1,4 @@
1
- import type { IError, ILocalizeInfo } from '../base/utils';
1
+ import type { IError, ILocalizeInfo, IRating } from '../base/utils';
2
2
  /**
3
3
  * @interface IAuthProvider
4
4
  * @description This interface defines methods for user authentication and registration through various auth providers.
@@ -241,16 +241,14 @@ interface IOauthData {
241
241
  * @property {number} version - The version number of the sign-up entity. Example: 1.
242
242
  * @property {string} identifier - A unique string that identifies the sign-up entity. Example: "signup_12345".
243
243
  * @property {boolean} isActive - Indicates whether the sign-up entity is active. Example: true.
244
- * @property {Array<object> | Record<string, unknown>} formData - Form data, can be an array or a localized record.
244
+ * @property {Array<object>} formData - Form data array.
245
245
  * @example
246
- {
247
- "en_US": [
248
- {
249
- "marker": "first_name",
250
- "value": "John"
251
- }
252
- ]
253
- }
246
+ [
247
+ {
248
+ "marker": "first_name",
249
+ "value": "John"
250
+ }
251
+ ]
254
252
  * @property {object} notificationData - An object containing notification data, including email, phonePush, and phoneSMS.
255
253
  * @example
256
254
  {
@@ -264,7 +262,7 @@ interface IOauthData {
264
262
  * @property {string | null} [deletedAt] - Deletion date or null. Example: null.
265
263
  * @property {boolean} [isDeleted] - Whether the entity is deleted. Example: false.
266
264
  * @property {Record<string, unknown>} [state] - Additional state information. Example: {}.
267
- * @property {Record<string, unknown>} [rating] - Rating data. Example: {}.
265
+ * @property {IRating} [rating] - Rating data.
268
266
  * @description This interface defines the structure of a sign-up entity.
269
267
  */
270
268
  interface ISignUpEntity {
@@ -273,7 +271,7 @@ interface ISignUpEntity {
273
271
  version: number;
274
272
  identifier: string;
275
273
  isActive: boolean;
276
- formData: Array<Record<string, any>> | Record<string, any>;
274
+ formData: Array<Record<string, any>>;
277
275
  notificationData: {
278
276
  email: string;
279
277
  phonePush: Array<string>;
@@ -285,7 +283,7 @@ interface ISignUpEntity {
285
283
  deletedAt?: string | null;
286
284
  isDeleted?: boolean;
287
285
  state?: Record<string, any>;
288
- rating?: Record<string, unknown>;
286
+ rating?: IRating;
289
287
  }
290
288
  /**
291
289
  * Interface representing a code entity used for user registration or verification processes.
@@ -139,6 +139,20 @@ interface IAttributeValues {
139
139
  interface IAttributeValue {
140
140
  [key: string]: any;
141
141
  }
142
+ /**
143
+ * @interface IRating
144
+ * @property {number} value - Average rating value. Example: 4.5.
145
+ * @property {number} like - Number of likes. Example: 10.
146
+ * @property {number} dislike - Number of dislikes. Example: 2.
147
+ * @property {string} method - Rating calculation method. Example: "average".
148
+ * @description Interface for rating data.
149
+ */
150
+ interface IRating {
151
+ value: number;
152
+ like: number;
153
+ dislike: number;
154
+ method: string;
155
+ }
142
156
  /**
143
157
  * @interface IError
144
158
  * @property {string} message - Error message.
@@ -194,4 +208,4 @@ type LangType = string | Array<string>;
194
208
  * LocalizeType
195
209
  */
196
210
  type LocalizeType = ILocalizeInfos | ILocalizeInfo;
197
- export type { AttributeType, IAttributes, IAttributeValues, IConfig, IError, IHttpHeaders, IHttpOptions, ILocalizeInfo, ILocalizeInfos, LangType, LocalizeType, Types, };
211
+ export type { AttributeType, IAttributes, IAttributeValues, IConfig, IError, IHttpHeaders, IHttpOptions, ILocalizeInfo, ILocalizeInfos, IRating, LangType, LocalizeType, Types, };
@@ -1,7 +1,7 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import type StateModule from '../base/stateModule';
3
3
  import type { IError } from '../base/utils';
4
- import type { BonusTransactionType, IBonusTransactionEntity, ICouponValidationResult, IDiscountsApi, IDiscountsEntity, IDiscountsResponse } from './discountsInterfaces';
4
+ import type { IBonusBalanceEntity, IBonusTransactionEntity, IBonusTransactionType, ICouponValidationResult, IDiscountsApi, IDiscountsEntity, IDiscountsResponse, IDiscountType } from './discountsInterfaces';
5
5
  /**
6
6
  * Controllers for working with events
7
7
  * @handle /api/content/events
@@ -28,12 +28,12 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
28
28
  * @param {string} [langCode] - Language code. Default: "en_US".
29
29
  * @param {number} [offset] - Optional parameter for pagination. Default: 0.
30
30
  * @param {number} [limit] - Optional parameter for pagination. Default: 30.
31
- * @param {string} [type] - Optional parameter to filter discounts by type.
31
+ * @param {IDiscountType} [type] - Optional parameter to filter discounts by type.
32
32
  * @returns {Promise<IDiscountsResponse | IError>} Returns an object containing all discounts or an error object if there was an issue.
33
33
  * @throws {IError} When isShell=false and an error occurs during the fetch
34
34
  * @description Fetches all discounts from the server.
35
35
  */
36
- getAllDiscounts(langCode?: string, offset?: number, limit?: number, type?: 'DISCOUNT' | 'BONUS' | 'PERSONAL_DISCOUNT'): Promise<IDiscountsResponse | IError>;
36
+ getAllDiscounts(langCode?: string, offset?: number, limit?: number, type?: IDiscountType): Promise<IDiscountsResponse | IError>;
37
37
  /**
38
38
  * Get discount by marker
39
39
  * @handleName getDiscountByMarker
@@ -47,14 +47,14 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
47
47
  /**
48
48
  * Get bonus balance of the current user.
49
49
  * @handleName getBonusBalance
50
- * @returns {Promise<IDiscountsEntity | IError>} Returns bonus balance or an error object.
50
+ * @returns {Promise<IBonusBalanceEntity | IError>} Returns bonus balance or an error object.
51
51
  * @throws {IError} When isShell=false and an error occurs during the fetch
52
52
  */
53
- getBonusBalance(): Promise<IDiscountsEntity | IError>;
53
+ getBonusBalance(): Promise<IBonusBalanceEntity | IError>;
54
54
  /**
55
55
  * Get bonus transaction history of the current user.
56
56
  * @handleName getBonusHistory
57
- * @param {BonusTransactionType} [type] - Transaction type filter.
57
+ * @param {IBonusTransactionType} [type] - Transaction type filter.
58
58
  * @param {string} [dateFrom] - Start date filter.
59
59
  * @param {string} [dateTo] - End date filter.
60
60
  * @param {number} [discountId] - Discount id filter.
@@ -63,7 +63,7 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
63
63
  * @returns {Promise<IBonusTransactionEntity[] | IError>} Returns array of bonus transactions or an error object.
64
64
  * @throws {IError} When isShell=false and an error occurs during the fetch
65
65
  */
66
- getBonusHistory(type?: BonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusTransactionEntity[] | IError>;
66
+ getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusTransactionEntity[] | IError>;
67
67
  /**
68
68
  * Validate discounts coupon
69
69
  * @handleName validateDiscountsCoupon
@@ -31,7 +31,7 @@ class DiscountsApi extends asyncModules_1.default {
31
31
  * @param {string} [langCode] - Language code. Default: "en_US".
32
32
  * @param {number} [offset] - Optional parameter for pagination. Default: 0.
33
33
  * @param {number} [limit] - Optional parameter for pagination. Default: 30.
34
- * @param {string} [type] - Optional parameter to filter discounts by type.
34
+ * @param {IDiscountType} [type] - Optional parameter to filter discounts by type.
35
35
  * @returns {Promise<IDiscountsResponse | IError>} Returns an object containing all discounts or an error object if there was an issue.
36
36
  * @throws {IError} When isShell=false and an error occurs during the fetch
37
37
  * @description Fetches all discounts from the server.
@@ -66,7 +66,7 @@ class DiscountsApi extends asyncModules_1.default {
66
66
  /**
67
67
  * Get bonus balance of the current user.
68
68
  * @handleName getBonusBalance
69
- * @returns {Promise<IDiscountsEntity | IError>} Returns bonus balance or an error object.
69
+ * @returns {Promise<IBonusBalanceEntity | IError>} Returns bonus balance or an error object.
70
70
  * @throws {IError} When isShell=false and an error occurs during the fetch
71
71
  */
72
72
  async getBonusBalance() {
@@ -76,7 +76,7 @@ class DiscountsApi extends asyncModules_1.default {
76
76
  /**
77
77
  * Get bonus transaction history of the current user.
78
78
  * @handleName getBonusHistory
79
- * @param {BonusTransactionType} [type] - Transaction type filter.
79
+ * @param {IBonusTransactionType} [type] - Transaction type filter.
80
80
  * @param {string} [dateFrom] - Start date filter.
81
81
  * @param {string} [dateTo] - End date filter.
82
82
  * @param {number} [discountId] - Discount id filter.
@@ -1,4 +1,8 @@
1
1
  import type { IError } from '../base/utils';
2
+ /**
3
+ * Discount type.
4
+ */
5
+ type IDiscountType = 'DISCOUNT' | 'BONUS' | 'PERSONAL_DISCOUNT';
2
6
  /**
3
7
  * Interface for the Discounts API module.
4
8
  * @interface IDiscountsApi
@@ -10,12 +14,12 @@ interface IDiscountsApi {
10
14
  * @param {string} [langCode] - Language code. Default: "en_US".
11
15
  * @param {number} [offset] - Optional parameter for pagination. Default: 0.
12
16
  * @param {number} [limit] - Optional parameter for pagination. Default: 30.
13
- * @param {string} [type] - Optional parameter to filter discounts by type.
17
+ * @param {IDiscountType} [type] - Optional parameter to filter discounts by type.
14
18
  * @returns {Promise<IDiscountsResponse | IError>} Returns an object containing all discounts or an error object if there was an issue.
15
19
  * @throws {IError} When isShell=false and an error occurs during the fetch
16
20
  * @description Fetches all discounts from the server.
17
21
  */
18
- getAllDiscounts(langCode?: string, offset?: number, limit?: number, type?: 'DISCOUNT' | 'BONUS' | 'PERSONAL_DISCOUNT'): Promise<IDiscountsResponse | IError>;
22
+ getAllDiscounts(langCode?: string, offset?: number, limit?: number, type?: IDiscountType): Promise<IDiscountsResponse | IError>;
19
23
  /**
20
24
  * Get discount by marker
21
25
  * @handleName getDiscountByMarker
@@ -38,10 +42,10 @@ interface IDiscountsApi {
38
42
  /**
39
43
  * Get bonus balance of the current user.
40
44
  * @handleName getBonusBalance
41
- * @returns {Promise<IDiscountsEntity | IError>} Returns bonus balance or an error object.
45
+ * @returns {Promise<IBonusBalanceEntity | IError>} Returns bonus balance or an error object.
42
46
  * @throws {IError} When isShell=false and an error occurs during the fetch
43
47
  */
44
- getBonusBalance(): Promise<IDiscountsEntity | IError>;
48
+ getBonusBalance(): Promise<IBonusBalanceEntity | IError>;
45
49
  /**
46
50
  * Get bonus transaction history of the current user.
47
51
  * @handleName getBonusHistory
@@ -54,18 +58,18 @@ interface IDiscountsApi {
54
58
  * @returns {Promise<IBonusTransactionEntity[] | IError>} Returns array of bonus transactions or an error object.
55
59
  * @throws {IError} When isShell=false and an error occurs during the fetch
56
60
  */
57
- getBonusHistory(type?: BonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusTransactionEntity[] | IError>;
61
+ getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusTransactionEntity[] | IError>;
58
62
  }
59
63
  /**
60
64
  * Query parameters for fetching discounts.
61
65
  * @interface IDiscountsQuery
62
- * @property {'DISCOUNT' | 'BONUS' | 'PERSONAL_DISCOUNT'} [type] - Filter discounts by type.
66
+ * @property {IDiscountType} [type] - Filter discounts by type.
63
67
  * @property {string} langCode - The language code for localization. Example: "en_US".
64
68
  * @property {number} [offset] - Offset for pagination. Default: 0.
65
69
  * @property {number} [limit] - Limit for pagination. Default: 30.
66
70
  */
67
71
  interface IDiscountsQuery {
68
- type?: 'DISCOUNT' | 'BONUS' | 'PERSONAL_DISCOUNT';
72
+ type?: IDiscountType;
69
73
  langCode: string;
70
74
  offset?: number;
71
75
  limit?: number;
@@ -88,7 +92,7 @@ interface IDiscountCondition {
88
92
  * @property {object} [localizeInfos] - The name of the discount.
89
93
  * @property {number} [version] - The version of the discount.
90
94
  * @property {string} [identifier] - The identifier of the discount.
91
- * @property {string} [type] - The type of the discount.
95
+ * @property {IDiscountType} type - The type of the discount.
92
96
  * @property {string} [startDate] - The start date of the discount.
93
97
  * @property {string} [endDate] - The end date of the discount.
94
98
  * @property {Record<string, unknown>} [discountValue] - The value of the discount.
@@ -111,7 +115,7 @@ interface IDiscountsEntity {
111
115
  localizeInfos?: object;
112
116
  version?: number;
113
117
  identifier?: string;
114
- type: 'DISCOUNT' | 'BONUS' | 'PERSONAL_DISCOUNT';
118
+ type: IDiscountType;
115
119
  startDate?: string;
116
120
  endDate?: string;
117
121
  discountValue?: Record<string, unknown>;
@@ -171,10 +175,10 @@ interface IDiscountByMarkerQuery {
171
175
  /**
172
176
  *
173
177
  */
174
- type BonusTransactionType = 'ACCRUAL' | 'USAGE' | 'REDUCE' | 'REVERSAL_ACCRUAL' | 'REVERSAL_USAGE' | 'EXPIRATION';
178
+ type IBonusTransactionType = 'ACCRUAL' | 'USAGE' | 'REDUCE' | 'REVERSAL_ACCRUAL' | 'REVERSAL_USAGE' | 'EXPIRATION';
175
179
  /**
176
180
  * @interface IBonusHistoryQuery
177
- * @property {BonusTransactionType} [type] - Transaction type filter.
181
+ * @property {IBonusTransactionType} [type] - Transaction type filter.
178
182
  * @property {string} [dateFrom] - Start date filter.
179
183
  * @property {string} [dateTo] - End date filter.
180
184
  * @property {number} [discountId] - Discount id filter.
@@ -182,7 +186,7 @@ type BonusTransactionType = 'ACCRUAL' | 'USAGE' | 'REDUCE' | 'REVERSAL_ACCRUAL'
182
186
  * @property {boolean} [isAdmin] - Admin filter.
183
187
  */
184
188
  interface IBonusHistoryQuery {
185
- type?: BonusTransactionType;
189
+ type?: IBonusTransactionType;
186
190
  dateFrom?: string;
187
191
  dateTo?: string;
188
192
  discountId?: number;
@@ -193,7 +197,7 @@ interface IBonusHistoryQuery {
193
197
  * @interface IBonusTransactionEntity
194
198
  * @property {number} balanceId - Balance id.
195
199
  * @property {number} amount - Transaction amount.
196
- * @property {BonusTransactionType} type - Transaction type.
200
+ * @property {IBonusTransactionType} type - Transaction type.
197
201
  * @property {number} [discountId] - Discount id.
198
202
  * @property {number} [moduleId] - Module id.
199
203
  * @property {string} [entityIdentifier] - Entity identifier.
@@ -207,7 +211,7 @@ interface IBonusHistoryQuery {
207
211
  interface IBonusTransactionEntity {
208
212
  balanceId: number;
209
213
  amount: number;
210
- type: BonusTransactionType;
214
+ type: IBonusTransactionType;
211
215
  discountId?: number;
212
216
  moduleId?: number;
213
217
  entityIdentifier?: string;
@@ -218,4 +222,12 @@ interface IBonusTransactionEntity {
218
222
  expiresAt?: string;
219
223
  createdAt?: string;
220
224
  }
221
- export type { BonusTransactionType, IBonusHistoryQuery, IBonusTransactionEntity, ICouponValidationResult, IDiscountByMarkerQuery, IDiscountCondition, IDiscountsApi, IDiscountsEntity, IDiscountsQuery, IDiscountsResponse, IDiscountsValidateCoupon, };
225
+ /**
226
+ * @interface IBonusBalanceEntity
227
+ * @description Represents the balance of bonus points.
228
+ * @property {number} balance - The balance of bonus points. Example: 100
229
+ */
230
+ interface IBonusBalanceEntity {
231
+ balance: number;
232
+ }
233
+ export type { IBonusBalanceEntity, IBonusHistoryQuery, IBonusTransactionEntity, IBonusTransactionType, ICouponValidationResult, IDiscountByMarkerQuery, IDiscountCondition, IDiscountsApi, IDiscountsEntity, IDiscountsQuery, IDiscountsResponse, IDiscountsValidateCoupon, IDiscountType, };
@@ -112,7 +112,7 @@ interface IFormsEntity {
112
112
  * @property {string[]} [nestedEntityIdentifiers] - An array of nested entity identifier strings (only in products/pages API). Example: ["catalog"].
113
113
  * @property {string[]} [exceptionIds] - An array of exception identifiers.
114
114
  * @property {number} [formDataCount] - Total count of form data entries (only in products/pages API). Example: 306.
115
- * @property {Record<string, number>} [entityFormDataCount] - Form data count per entity identifier (only in products/pages API). Example: {"catalog": 306}.
115
+ * @property {Record<string, number>} [entityFormDataCount] - Form data count per entity identifier (only in products/pages API). Example: `{"catalog": 306}`.
116
116
  * @property {boolean | null} [isRating] - Indicates whether this form config is for ratings. Example: null.
117
117
  * @property {boolean | null} [isAnonymous] - Indicates whether anonymous submissions are allowed. Example: null.
118
118
  * @property {boolean | null} [allowHalfRatings] - Indicates whether half ratings are allowed. Example: null.
@@ -241,10 +241,9 @@ interface IFormsByMarkerDataEntity {
241
241
  "value": "Jack"
242
242
  }
243
243
  ]
244
- * @property {string | Record<string, string>} actionMessage - Action message for the form data (can be localized). Example: "Form submitted successfully" or { "en_US": "Success" }.
244
+ * @property {string} actionMessage - Action message for the form data (can be localized). Example: "Form submitted successfully".
245
245
  */
246
246
  interface IPostFormResponse {
247
- actionMessage: string | Record<string, any>;
248
247
  formData: {
249
248
  id: number;
250
249
  formIdentifier: string;
@@ -257,6 +256,7 @@ interface IPostFormResponse {
257
256
  parentId: number | null;
258
257
  formData: FormDataType[] | Record<string, any>;
259
258
  };
259
+ actionMessage: string;
260
260
  }
261
261
  /**
262
262
  * Represents the structure of the response after updating form data.
@@ -160,16 +160,16 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
160
160
  * @handleName createRefundRequest
161
161
  * @param {number} id - Order id. Example: 1.
162
162
  * @param {ICreateRefundRequest} body - Refund request body.
163
- * @returns {Promise<IOrdersEntity | IError>} Returns order entity.
163
+ * @returns {Promise<boolean | IError>} Returns true if the refund request was created successfully.
164
164
  * @throws {IError} When isShell=false and an error occurs during the fetch
165
165
  */
166
- createRefundRequest(id: number, body: ICreateRefundRequest): Promise<IOrdersEntity | IError>;
166
+ createRefundRequest(id: number, body: ICreateRefundRequest): Promise<boolean | IError>;
167
167
  /**
168
168
  * Cancel a refund request for an order.
169
169
  * @handleName cancelRefundRequest
170
170
  * @param {number} id - Order id. Example: 1.
171
- * @returns {Promise<IOrdersEntity | IError>} Returns order entity.
171
+ * @returns {Promise<boolean | IError>} Returns true if the refund request was cancelled successfully.
172
172
  * @throws {IError} When isShell=false and an error occurs during the fetch
173
173
  */
174
- cancelRefundRequest(id: number): Promise<IOrdersEntity | IError>;
174
+ cancelRefundRequest(id: number): Promise<boolean | IError>;
175
175
  }
@@ -219,7 +219,7 @@ class OrdersApi extends asyncModules_1.default {
219
219
  * @handleName createRefundRequest
220
220
  * @param {number} id - Order id. Example: 1.
221
221
  * @param {ICreateRefundRequest} body - Refund request body.
222
- * @returns {Promise<IOrdersEntity | IError>} Returns order entity.
222
+ * @returns {Promise<boolean | IError>} Returns true if the refund request was created successfully.
223
223
  * @throws {IError} When isShell=false and an error occurs during the fetch
224
224
  */
225
225
  async createRefundRequest(id, body) {
@@ -233,7 +233,7 @@ class OrdersApi extends asyncModules_1.default {
233
233
  * Cancel a refund request for an order.
234
234
  * @handleName cancelRefundRequest
235
235
  * @param {number} id - Order id. Example: 1.
236
- * @returns {Promise<IOrdersEntity | IError>} Returns order entity.
236
+ * @returns {Promise<boolean | IError>} Returns true if the refund request was cancelled successfully.
237
237
  * @throws {IError} When isShell=false and an error occurs during the fetch
238
238
  */
239
239
  async cancelRefundRequest(id) {
@@ -146,18 +146,18 @@ interface IOrdersApi {
146
146
  * @handleName createRefundRequest
147
147
  * @param {number} id - Order id.
148
148
  * @param {ICreateRefundRequest} body - Refund request body.
149
- * @returns {Promise<IOrdersEntity | IError>} Returns order entity.
149
+ * @returns {Promise<boolean | IError>} Returns true if the refund request was created successfully.
150
150
  * @throws {IError} When isShell=false and an error occurs during the fetch
151
151
  */
152
- createRefundRequest(id: number, body: ICreateRefundRequest): Promise<IOrdersEntity | IError>;
152
+ createRefundRequest(id: number, body: ICreateRefundRequest): Promise<boolean | IError>;
153
153
  /**
154
154
  * Cancel a refund request for an order.
155
155
  * @handleName cancelRefundRequest
156
156
  * @param {number} id - Order id.
157
- * @returns {Promise<IOrdersEntity | IError>} Returns order entity.
157
+ * @returns {Promise<boolean | IError>} Returns order entity.
158
158
  * @throws {IError} When isShell=false and an error occurs during the fetch
159
159
  */
160
- cancelRefundRequest(id: number): Promise<IOrdersEntity | IError>;
160
+ cancelRefundRequest(id: number): Promise<boolean | IError>;
161
161
  }
162
162
  /**
163
163
  * Interface for the orders storage object.
@@ -585,11 +585,22 @@ interface IRefundRequest {
585
585
  orderStorage: unknown;
586
586
  user: unknown;
587
587
  }
588
+ /**
589
+ * @interface IRefundProduct
590
+ * @description Refund details for a single product.
591
+ * @property {number} quantity - Quantity of the product to refund. Example: 1.
592
+ */
593
+ interface IRefundProduct {
594
+ quantity: number;
595
+ }
588
596
  /**
589
597
  * @interface ICreateRefundRequest
590
598
  * @description Body for creating a refund request.
599
+ * @property {Record<string, IRefundProduct>} products - Map of product id to refund details. Example: `{ "146": { "quantity": 1 } }`.
600
+ * @property {string} [note] - Optional note for the refund request. Example: "test".
591
601
  */
592
602
  interface ICreateRefundRequest {
593
- [key: string]: unknown;
603
+ products: Record<string, IRefundProduct>;
604
+ note?: string;
594
605
  }
595
- export type { IBaseOrdersEntity, IBaseOrdersEntityResponse, ICreateOrderPreview, ICreateRefundRequest, IOrderByMarkerEntity, IOrderData, IOrderPreviewItem, IOrderPreviewResponse, IOrderProductData, IOrderProducts, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrdersFormData, IOrderStatus, IPaymentAccountIdentifiers, IPicture, IPreviewOrderProduct, IRefundRequest, };
606
+ export type { IBaseOrdersEntity, IBaseOrdersEntityResponse, ICreateOrderPreview, ICreateRefundRequest, IOrderByMarkerEntity, IOrderData, IOrderPreviewItem, IOrderPreviewResponse, IOrderProductData, IOrderProducts, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrdersFormData, IOrderStatus, IPaymentAccountIdentifiers, IPicture, IPreviewOrderProduct, IRefundProduct, IRefundRequest, };
@@ -1,7 +1,7 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import type StateModule from '../base/stateModule';
3
3
  import type { IError } from '../base/utils';
4
- import type { IAccountsEntity, ICreateSessionEntity, IPaymentsApi, ISessionEntity, ISessionsEntity } from './paymentsInterfaces';
4
+ import type { IAccountsEntity, IPaymentsApi, ISessionEntity, ISessionsEntity } from './paymentsInterfaces';
5
5
  /**
6
6
  * Controllers for working with payments
7
7
  * @handle /api/content/payments
@@ -53,12 +53,12 @@ export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
53
53
  * @param {number} orderId - Order identifier. Example: 12345.
54
54
  * @param {'session' | 'intent'} type - Session type. Possible values: "session" or "intent". Example: 'session'.
55
55
  * @param {boolean} [automaticTaxEnabled] - Automatic calculation of the tax rate. Default: false.
56
- * @returns {Promise<ICreateSessionEntity | IError>} Returns a single payment session object.
56
+ * @returns {Promise<ISessionEntity | IError>} Returns a single payment session object.
57
57
  * @throws {IError} When isShell=false and an error occurs during the fetch
58
58
  * @description This method creates a payment session. This method requires user authorization.
59
59
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
60
60
  */
61
- createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ICreateSessionEntity | IError>;
61
+ createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ISessionEntity | IError>;
62
62
  /**
63
63
  * Get all payment accounts as an array.
64
64
  * @handleName getAccounts
@@ -74,7 +74,7 @@ class PaymentsApi extends asyncModules_1.default {
74
74
  * @param {number} orderId - Order identifier. Example: 12345.
75
75
  * @param {'session' | 'intent'} type - Session type. Possible values: "session" or "intent". Example: 'session'.
76
76
  * @param {boolean} [automaticTaxEnabled] - Automatic calculation of the tax rate. Default: false.
77
- * @returns {Promise<ICreateSessionEntity | IError>} Returns a single payment session object.
77
+ * @returns {Promise<ISessionEntity | IError>} Returns a single payment session object.
78
78
  * @throws {IError} When isShell=false and an error occurs during the fetch
79
79
  * @description This method creates a payment session. This method requires user authorization.
80
80
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
@@ -86,7 +86,7 @@ class PaymentsApi extends asyncModules_1.default {
86
86
  automaticTaxEnabled,
87
87
  });
88
88
  // Validate response if validation is enabled
89
- const validated = this._validateResponse(result, paymentsSchemas_1.CreateSessionResponseSchema);
89
+ const validated = this._validateResponse(result, paymentsSchemas_1.PaymentSessionSchema);
90
90
  return validated;
91
91
  }
92
92
  /**
@@ -41,12 +41,12 @@ interface IPaymentsApi {
41
41
  * @param {number} orderId - Order identifier. Example: 12345.
42
42
  * @param {'session' | 'intent'} type - Session type. Possible values: "session" or "intent". Example: "session".
43
43
  * @param {boolean} [automaticTaxEnabled] - Automatic calculation of the tax rate. Default: false.
44
- * @returns {ICreateSessionEntity} Returns a single payment session object.
44
+ * @returns {ISessionEntity} Returns a single payment session object.
45
45
  * @throws {IError} If there is an error during the fetch operation, it will return an error object.
46
46
  * @description This method creates a payment session. This method requires user authorization.
47
47
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
48
48
  */
49
- createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ICreateSessionEntity | IError>;
49
+ createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ISessionEntity | IError>;
50
50
  /**
51
51
  * Get all payment accounts as an array.
52
52
  * @handleName getAccounts
@@ -101,6 +101,7 @@ interface ISessionsEntity {
101
101
  * @property {number} orderId - Order identifier. Example: 1.
102
102
  * @property {string | null} paymentUrl - payment link. Example: " https://www.sandbox.paypal.com/checkoutnow?token=9BE88048TU058770M".
103
103
  * @property {number | null} [amount] - Amount of the payment session. Example: 100.
104
+ * @property {string} [clientSecret] - Client secret key returned by payment provider (e.g. Stripe) when creating a session. Example: "pi_3MtwBwLkdIwHu7ix28a3tqPa_secret_YrKJUKribcBjcG8HVhfZluoGH".
104
105
  * @description This interface defines the structure of a session entity, including its quantity, amount, currency, name, and description.
105
106
  */
106
107
  interface ISessionEntity {
@@ -113,6 +114,7 @@ interface ISessionEntity {
113
114
  orderId: number;
114
115
  paymentUrl: string | null;
115
116
  amount?: number | null;
117
+ clientSecret?: string;
116
118
  }
117
119
  /**
118
120
  * @interface IIntent
@@ -124,44 +126,6 @@ interface IIntent {
124
126
  amount: number;
125
127
  currency: string;
126
128
  }
127
- /**
128
- * @interface ISessionItem
129
- * @property {number} id - Object identifier. Example: 12345.
130
- * @property {string} updatedDate - Object modification date. Example: "2023-10-01T12:00:00Z".
131
- * @property {string} type - Type may be 'session' or 'intent'. Example: 'session'.
132
- * @property {number} orderId - Order identifier. Example: 12345.
133
- * @property {number} paymentAccountId - Payment account object identifier. Example: 12345.
134
- * @property {string} paymentUrl - Payment link. Example: "https://example.com/payment/12345".
135
- * @property {string} clientSecret - Client secret key. Example: "sk_test_4eC39HqLyjWDarjtT1zdp7dc".
136
- * @property {string} status - payment status. Example: "pending".
137
- * @description This interface defines the structure of a session item, which includes identifiers, payment details, and status information.
138
- */
139
- interface ISessionItem {
140
- id: number;
141
- updatedDate: string;
142
- type: 'session' | 'intent';
143
- orderId: number;
144
- paymentAccountId: number;
145
- paymentUrl: string;
146
- clientSecret: string;
147
- status: string;
148
- }
149
- /**
150
- * @interface ICreateSessionEntity
151
- * @property {number} id - Object identifier. Example: 12345.
152
- * @property {string} updatedDate - Object modification date. Example: "2023-10-01T12:00:00Z".
153
- * @property {number} version - Version of the object. Example: 1.
154
- * @property {string} identifier - Text identifier for the recording field. Example: "payment_12345".
155
- * @property {string} paymentUrl - Payment link. Example: "https://example.com/payment/12345".
156
- * @description This interface defines the structure of a session entity created during the payment process, including its identifiers, version, and payment URL.
157
- */
158
- interface ICreateSessionEntity {
159
- id: number;
160
- updatedDate: string;
161
- version: number;
162
- identifier: string;
163
- paymentUrl: string;
164
- }
165
129
  /**
166
130
  * @interface IAccountsEntity
167
131
  * @property {number} id - Object identifier. Example: 12345.
@@ -197,4 +161,4 @@ interface IAccountsEntity {
197
161
  };
198
162
  updatedDate: string;
199
163
  }
200
- export type { IAccountsEntity, ICreateSessionEntity, IIntent, IPaymentsApi, ISessionEntity, ISessionItem, ISessionsEntity, };
164
+ export type { IAccountsEntity, IIntent, IPaymentsApi, ISessionEntity, ISessionsEntity, };
@@ -13,6 +13,7 @@ export declare const PaymentSessionSchema: z.ZodObject<{
13
13
  type: z.ZodString;
14
14
  paymentAccountId: z.ZodNumber;
15
15
  paymentUrl: z.ZodNullable<z.ZodString>;
16
+ clientSecret: z.ZodOptional<z.ZodString>;
16
17
  }, z.core.$strip>;
17
18
  /**
18
19
  * Payment sessions response schema
@@ -29,6 +30,7 @@ export declare const PaymentSessionsResponseSchema: z.ZodObject<{
29
30
  type: z.ZodString;
30
31
  paymentAccountId: z.ZodNumber;
31
32
  paymentUrl: z.ZodNullable<z.ZodString>;
33
+ clientSecret: z.ZodOptional<z.ZodString>;
32
34
  }, z.core.$strip>>;
33
35
  total: z.ZodNumber;
34
36
  }, z.core.$strip>;
@@ -46,6 +48,7 @@ export declare const SinglePaymentSessionSchema: z.ZodUnion<readonly [z.ZodObjec
46
48
  type: z.ZodString;
47
49
  paymentAccountId: z.ZodNumber;
48
50
  paymentUrl: z.ZodNullable<z.ZodString>;
51
+ clientSecret: z.ZodOptional<z.ZodString>;
49
52
  }, z.core.$strip>, z.ZodArray<z.ZodObject<{
50
53
  id: z.ZodNumber;
51
54
  orderId: z.ZodNumber;
@@ -56,6 +59,7 @@ export declare const SinglePaymentSessionSchema: z.ZodUnion<readonly [z.ZodObjec
56
59
  type: z.ZodString;
57
60
  paymentAccountId: z.ZodNumber;
58
61
  paymentUrl: z.ZodNullable<z.ZodString>;
62
+ clientSecret: z.ZodOptional<z.ZodString>;
59
63
  }, z.core.$strip>>]>;
60
64
  /**
61
65
  * Payment account schema
@@ -88,13 +92,3 @@ export declare const PaymentAccountsResponseSchema: z.ZodArray<z.ZodObject<{
88
92
  localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
89
93
  updatedDate: z.ZodString;
90
94
  }, z.core.$strip>>;
91
- /**
92
- * Create session response schema
93
- */
94
- export declare const CreateSessionResponseSchema: z.ZodObject<{
95
- id: z.ZodNumber;
96
- updatedDate: z.ZodString;
97
- version: z.ZodNumber;
98
- identifier: z.ZodString;
99
- paymentUrl: z.ZodString;
100
- }, z.core.$strip>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CreateSessionResponseSchema = exports.PaymentAccountsResponseSchema = exports.PaymentAccountSchema = exports.SinglePaymentSessionSchema = exports.PaymentSessionsResponseSchema = exports.PaymentSessionSchema = void 0;
3
+ exports.PaymentAccountsResponseSchema = exports.PaymentAccountSchema = exports.SinglePaymentSessionSchema = exports.PaymentSessionsResponseSchema = exports.PaymentSessionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  /**
6
6
  * Payment session schema
@@ -16,6 +16,7 @@ exports.PaymentSessionSchema = zod_1.z.object({
16
16
  type: zod_1.z.string(),
17
17
  paymentAccountId: zod_1.z.number(),
18
18
  paymentUrl: zod_1.z.string().nullable(),
19
+ clientSecret: zod_1.z.string().optional(),
19
20
  });
20
21
  /**
21
22
  * Payment sessions response schema
@@ -53,13 +54,3 @@ exports.PaymentAccountSchema = zod_1.z.object({
53
54
  * Payment accounts response schema
54
55
  */
55
56
  exports.PaymentAccountsResponseSchema = zod_1.z.array(exports.PaymentAccountSchema);
56
- /**
57
- * Create session response schema
58
- */
59
- exports.CreateSessionResponseSchema = zod_1.z.object({
60
- id: zod_1.z.number(),
61
- updatedDate: zod_1.z.string(),
62
- version: zod_1.z.number(),
63
- identifier: zod_1.z.string(),
64
- paymentUrl: zod_1.z.string(),
65
- });
@@ -1,7 +1,7 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import type StateModule from '../base/stateModule';
3
3
  import type { IError } from '../base/utils';
4
- import type { ISitemapApi, ISitemapEntity, ISitemapQuery } from './sitemapInterfaces';
4
+ import type { ISitemapApi, ISitemapEntity } from './sitemapInterfaces';
5
5
  /**
6
6
  * Controllers for working with sitemaps.
7
7
  * @handle /api/content/sitemap
@@ -23,13 +23,13 @@ export default class SitemapApi extends AsyncModules implements ISitemapApi {
23
23
  * @returns {Promise<string[] | IError>} Returns an array of sitemap URLs.
24
24
  * @throws {IError} When isShell=false and an error occurs during the fetch
25
25
  */
26
- getSitemap(): Promise<ISitemapEntity[] | IError>;
26
+ getSitemap(): Promise<string[] | IError>;
27
27
  /**
28
28
  * Generates a new set of sitemaps.
29
29
  * @handleName updateSitemap
30
- * @param {ISitemapQuery} body - Sitemap body params.
30
+ * @param {Array<ISitemapEntity>} body - Sitemap body params.
31
31
  * @returns {Promise<string[] | IError>} Returns an array of sitemap URLs.
32
32
  * @throws {IError} When isShell=false and an error occurs during the fetch
33
33
  */
34
- updateSitemap(body: ISitemapQuery): Promise<ISitemapEntity[] | IError>;
34
+ updateSitemap(body: Array<ISitemapEntity>): Promise<Array<ISitemapEntity> | IError>;
35
35
  }
@@ -33,7 +33,7 @@ class SitemapApi extends asyncModules_1.default {
33
33
  /**
34
34
  * Generates a new set of sitemaps.
35
35
  * @handleName updateSitemap
36
- * @param {ISitemapQuery} body - Sitemap body params.
36
+ * @param {Array<ISitemapEntity>} body - Sitemap body params.
37
37
  * @returns {Promise<string[] | IError>} Returns an array of sitemap URLs.
38
38
  * @throws {IError} When isShell=false and an error occurs during the fetch
39
39
  */
@@ -1,40 +1,49 @@
1
1
  import type { IError } from '../base/utils';
2
+ /**
3
+ * Interface for the Sitemap API module.
4
+ * @interface ISitemapApi
5
+ */
6
+ interface ISitemapApi {
7
+ /**
8
+ * Retrieves the set of sitemaps.
9
+ * @handleName getSitemap
10
+ * @returns {Promise<Array<string> | IError>}
11
+ */
12
+ getSitemap(): Promise<Array<string> | IError>;
13
+ /**
14
+ * Generates a new set of sitemaps.
15
+ * @handleName updateSitemap
16
+ * @param {Array<ISitemapQuery>} body - Sitemap body params.
17
+ * @returns {Promise<Array<ISitemapEntity> | IError>}
18
+ */
19
+ updateSitemap(body: Array<ISitemapQuery>): Promise<Array<ISitemapEntity> | IError>;
20
+ }
2
21
  /**
3
22
  * Query parameters for sitemap requests.
4
23
  * @interface ISitemapQuery
24
+ * @property {string} url - URL of the sitemap entry.
25
+ * @property {string} lastmod - Last modification date.
26
+ * @property {string} changefreq - Frequency of changes.
27
+ * @property {number} priority - Priority of the entry.
5
28
  */
6
29
  interface ISitemapQuery {
7
- [key: string]: unknown;
30
+ url: string;
31
+ lastmod: string;
32
+ changefreq: string;
33
+ priority: number;
8
34
  }
9
35
  /**
10
36
  * Entity interface for sitemap.
37
+ * @interface ISitemapEntity
11
38
  * @property {string} url - URL of the sitemap.
12
39
  * @property {string} lastmod - Last modification date of the sitemap.
13
40
  * @property {string} changefreq - Frequency of changes for the sitemap.
14
- * @property {string} priority - Priority of the sitemap.
15
- * @interface ISitemapEntity
41
+ * @property {number} priority - Priority of the sitemap.
16
42
  */
17
43
  interface ISitemapEntity {
18
44
  url: string;
19
45
  lastmod: string;
20
46
  changefreq: string;
21
- priority: string;
22
- }
23
- /**
24
- * Interface for the Sitemap API module.
25
- * @interface ISitemapApi
26
- */
27
- interface ISitemapApi {
28
- /**
29
- * Retrieves the set of sitemaps.
30
- * @returns {Promise<ISitemapEntity[] | IError>}
31
- */
32
- getSitemap(): Promise<ISitemapEntity[] | IError>;
33
- /**
34
- * Generates a new set of sitemaps.
35
- * @param {ISitemapQuery} body - Sitemap body params.
36
- * @returns {Promise<ISitemapEntity[] | IError>}
37
- */
38
- updateSitemap(body: ISitemapQuery): Promise<ISitemapEntity[] | IError>;
47
+ priority: number;
39
48
  }
40
49
  export type { ISitemapApi, ISitemapEntity, ISitemapQuery };
@@ -1,5 +1,5 @@
1
1
  import type { IAuthData, IAuthFormData } from '../auth-provider/authProvidersInterfaces';
2
- import type { IError } from '../base/utils';
2
+ import type { IError, IRating } from '../base/utils';
3
3
  import type { IFormConfig } from '../forms/formsInterfaces';
4
4
  import type { FormDataType } from '../forms-data/formsDataInterfaces';
5
5
  /**
@@ -161,7 +161,7 @@ interface IUsersApi {
161
161
  "key": "value"
162
162
  }
163
163
  * @property {Array<IFormConfig>} [moduleFormConfigs] - Optional array of form configuration objects associated with the user.
164
- * @property {Record<string, unknown>} [rating] - Rating data.
164
+ * @property {IRating} [rating] - Rating data.
165
165
  * @description Represents a user entity with various properties, including identifiers, form data, and user groups.
166
166
  */
167
167
  interface IUserEntity {
@@ -174,7 +174,7 @@ interface IUserEntity {
174
174
  groups: Array<string | number>;
175
175
  state: Record<string, any>;
176
176
  moduleFormConfigs?: Array<IFormConfig>;
177
- rating?: Record<string, unknown>;
177
+ rating?: IRating;
178
178
  }
179
179
  /**
180
180
  * @interface IUserBody
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.145",
3
+ "version": "1.0.146",
4
4
  "description": "OneEntry NPM package",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  "bin": {
11
11
  "oneentry": "./configure.js"
12
12
  },
13
- "author": "ONEENTRY PORTAL CO.",
13
+ "author": "ONEENTRY PORTAL LLC",
14
14
  "license": "ISC",
15
15
  "dependencies": {
16
16
  "socket.io-client": "^4.8.3",