oneentry 1.0.145 → 1.0.147

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/admins/adminsApi.d.ts +4 -3
  2. package/dist/admins/adminsApi.js +1 -1
  3. package/dist/admins/adminsInterfaces.d.ts +4 -4
  4. package/dist/admins/adminsSchemas.d.ts +24 -8
  5. package/dist/admins/adminsSchemas.js +11 -5
  6. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +121 -24
  7. package/dist/auth-provider/authProvidersInterfaces.d.ts +43 -36
  8. package/dist/base/utils.d.ts +159 -53
  9. package/dist/blocks/blocksApi.d.ts +3 -3
  10. package/dist/blocks/blocksApi.js +1 -1
  11. package/dist/blocks/blocksInterfaces.d.ts +7 -7
  12. package/dist/blocks/blocksSchemas.d.ts +52 -8
  13. package/dist/discounts/discountsApi.d.ts +7 -7
  14. package/dist/discounts/discountsApi.js +3 -3
  15. package/dist/discounts/discountsInterfaces.d.ts +79 -33
  16. package/dist/forms/formsInterfaces.d.ts +85 -15
  17. package/dist/forms-data/formsDataInterfaces.d.ts +142 -67
  18. package/dist/menus/menusInterfaces.d.ts +1 -1
  19. package/dist/orders/ordersApi.d.ts +4 -4
  20. package/dist/orders/ordersApi.js +2 -2
  21. package/dist/orders/ordersInterfaces.d.ts +97 -24
  22. package/dist/orders/ordersSchemas.d.ts +73 -2
  23. package/dist/orders/ordersSchemas.js +32 -3
  24. package/dist/pages/pagesApi.js +1 -1
  25. package/dist/pages/pagesInterfaces.d.ts +8 -8
  26. package/dist/payments/paymentsApi.d.ts +3 -3
  27. package/dist/payments/paymentsApi.js +2 -2
  28. package/dist/payments/paymentsInterfaces.d.ts +45 -56
  29. package/dist/payments/paymentsSchemas.d.ts +4 -10
  30. package/dist/payments/paymentsSchemas.js +2 -11
  31. package/dist/products/productsApi.d.ts +26 -19
  32. package/dist/products/productsApi.js +27 -20
  33. package/dist/products/productsInterfaces.d.ts +109 -33
  34. package/dist/products/productsSchemas.d.ts +52 -8
  35. package/dist/products/productsSchemas.js +15 -2
  36. package/dist/sitemap/sitemapApi.d.ts +5 -5
  37. package/dist/sitemap/sitemapApi.js +2 -2
  38. package/dist/sitemap/sitemapInterfaces.d.ts +32 -21
  39. package/dist/templates/templatesApi.js +8 -3
  40. package/dist/templates/templatesInterfaces.d.ts +3 -3
  41. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +22 -8
  42. package/dist/users/usersInterfaces.d.ts +7 -11
  43. package/package.json +1 -1
@@ -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.
@@ -316,7 +316,7 @@ interface IOrderProductsData {
316
316
  * @property {string} [statusIdentifier] - Text identifier of order status object (if not set, default status will be assigned). Example: "status-1".
317
317
  * @property {string} [couponCode] -
318
318
  * @property {string[]} [additionalDiscountsMarkers] -
319
- * @property {unknown} [discountConfig] -
319
+ * @property {IOrderDiscountConfig} [discountConfig] - Resolved discount configuration applied to the order.
320
320
  * @property {number} [bonusAmount] - Bonus amount applied to the order.
321
321
  * @property {number} [bonusApplied] - Bonus applied to the order.
322
322
  * @property {number} [totalDue] - Total due after bonuses.
@@ -333,11 +333,67 @@ interface IBaseOrdersEntity {
333
333
  statusIdentifier?: string;
334
334
  couponCode?: string;
335
335
  additionalDiscountsMarkers?: string[];
336
- discountConfig?: unknown;
336
+ discountConfig?: IOrderDiscountConfig;
337
337
  bonusAmount?: number;
338
338
  bonusApplied?: number;
339
339
  totalDue?: number;
340
340
  }
341
+ /**
342
+ * @interface IOrderDiscountBonus
343
+ * @property {number} availableBalance - User bonus balance available at the moment of calculation. Example: 0.
344
+ * @property {number} bonusApplied - Bonus amount actually applied to this order. Example: 0.
345
+ * @property {number} maxBonusDiscount - Maximum bonus amount allowed to be spent on this order. Example: 0.
346
+ * @property {number | null} minBonusAmount - Minimum bonus balance required to use bonuses, or null if no threshold. Example: null.
347
+ * @property {number | null} minOrderAmountForBonus - Minimum order total required to apply bonuses, or null if no threshold. Example: null.
348
+ * @description Bonus subsection of the order discount configuration.
349
+ */
350
+ interface IOrderDiscountBonus {
351
+ availableBalance: number;
352
+ bonusApplied: number;
353
+ maxBonusDiscount: number;
354
+ minBonusAmount: number | null;
355
+ minOrderAmountForBonus: number | null;
356
+ }
357
+ /**
358
+ * @interface IOrderDiscountSettings
359
+ * @property {boolean} allowGiftStacking - Whether multiple gift discounts can be combined. Example: false.
360
+ * @property {boolean} allowStacking - Whether multiple non-gift discounts can be combined. Example: false.
361
+ * @property {number | null} maxDiscountValue - Hard cap on total discount value, or null if uncapped. Example: null.
362
+ * @description Stacking and cap settings for the order discount engine.
363
+ */
364
+ interface IOrderDiscountSettings {
365
+ allowGiftStacking: boolean;
366
+ allowStacking: boolean;
367
+ maxDiscountValue: number | null;
368
+ }
369
+ /**
370
+ * @interface IOrderDiscountConfig
371
+ * @property {IOrderDiscountBonus | null} bonus - Bonus calculation result, or null when bonuses are not used.
372
+ * @property {unknown | null} coupon - Resolved coupon, or null when no coupon is applied.
373
+ * @property {unknown[]} orderDiscounts - Order-level discounts that were matched and applied.
374
+ * @property {unknown[]} productDiscounts - Product-level discounts that were matched and applied.
375
+ * @property {IOrderDiscountSettings} settings - Stacking and cap settings used during calculation.
376
+ * @property {string[]} [additionalDiscountsMarkers] - Markers of extra discounts requested by the client (omitted in preview responses).
377
+ * @property {number} [bonusApplied] - Bonus amount applied to the order (omitted in preview responses). Example: 0.
378
+ * @property {string[]} [excludedGiftProductIds] - Product ids excluded from gift selection (omitted in preview responses).
379
+ * @property {number} [totalDue] - Total amount due after discounts and bonuses (omitted in preview responses). Example: 300.
380
+ * @property {number} [totalRaw] - Total amount before discounts (omitted in preview responses). Example: 300.
381
+ * @property {number} [totalSumWithDiscount] - Total amount after discounts but before bonuses (omitted in preview responses). Example: 300.
382
+ * @description Resolved discount configuration returned alongside an order or order preview. Preview responses include only the calculation inputs (bonus, coupon, orderDiscounts, productDiscounts, settings); created/updated orders also carry the totals and applied markers.
383
+ */
384
+ interface IOrderDiscountConfig {
385
+ bonus: IOrderDiscountBonus | null;
386
+ coupon: unknown | null;
387
+ orderDiscounts: unknown[];
388
+ productDiscounts: unknown[];
389
+ settings: IOrderDiscountSettings;
390
+ additionalDiscountsMarkers?: string[];
391
+ bonusApplied?: number;
392
+ excludedGiftProductIds?: string[];
393
+ totalDue?: number;
394
+ totalRaw?: number;
395
+ totalSumWithDiscount?: number;
396
+ }
341
397
  /**
342
398
  * Interface representing a response from the order storage.
343
399
  * @interface IBaseOrdersEntityResponse
@@ -450,11 +506,10 @@ interface IOrderData {
450
506
  * @property {string} totalSum - Total order amount. Example: "100.00".
451
507
  * @property {string} currency - Currency used to pay for the order. Example: "USD".
452
508
  * @property {string | null} [paymentAccountIdentifier] - Textual identifier for the order payment. Example: "payment-1".
453
- * @property {Record<string, unknown>} paymentAccountLocalizeInfos - Payment account name considering localization.
509
+ * @property {ILocalizeInfo} [paymentAccountLocalizeInfos] - Payment account name considering localization.
454
510
  * @example
455
511
  {
456
- "en_US": "USD Payment",
457
- "ru_RU": "Оплата в долларах США"
512
+ "title": "Cash"
458
513
  }
459
514
  * @property {IOrderProducts[]} products - Array of products added to order.
460
515
  * @example
@@ -467,7 +522,7 @@ interface IOrderData {
467
522
  ]
468
523
  * @property {string | null} paymentUrl - Payment link. Example: "https://example.com/pay/123".
469
524
  * @property {boolean | null} isCompleted - Indicates that the order has been completed. Example: true.
470
- * @property {object} [statusLocalizeInfos] - Localization information.
525
+ * @property {ILocalizeInfo} [statusLocalizeInfos] - Localized status name.
471
526
  * @description Represents an order storage object created by the user.
472
527
  */
473
528
  interface IOrderByMarkerEntity {
@@ -481,17 +536,17 @@ interface IOrderByMarkerEntity {
481
536
  totalSum: string;
482
537
  currency: string;
483
538
  paymentAccountIdentifier?: string;
484
- paymentAccountLocalizeInfos?: Record<string, unknown>;
539
+ paymentAccountLocalizeInfos?: ILocalizeInfo;
485
540
  paymentUrl: string | null;
486
541
  products: IOrderProducts[];
487
542
  isCompleted: boolean | null;
488
- statusLocalizeInfos?: object;
543
+ statusLocalizeInfos?: ILocalizeInfo;
489
544
  }
490
545
  /**
491
546
  * Interface representing an order status object.
492
547
  * @interface IOrderStatus
493
548
  * @property {number} [id] - Status identifier. Example: 1.
494
- * @property {object} [localizeInfos] - Localized information for the status.
549
+ * @property {ILocalizeInfo} [localizeInfos] - Localized information for the status.
495
550
  * @property {string} [identifier] - Text identifier of the status. Example: "inProgress".
496
551
  * @property {number} [position] - Position of the status. Example: 1.
497
552
  * @property {boolean} [isUsed] - Whether the status is in use. Example: true.
@@ -499,7 +554,7 @@ interface IOrderByMarkerEntity {
499
554
  */
500
555
  interface IOrderStatus {
501
556
  id?: number;
502
- localizeInfos?: object;
557
+ localizeInfos?: ILocalizeInfo;
503
558
  identifier?: string;
504
559
  position?: number;
505
560
  isUsed?: boolean;
@@ -514,7 +569,6 @@ interface IOrderStatus {
514
569
  interface IPreviewOrderProduct {
515
570
  productId?: number;
516
571
  quantity?: number;
517
- [key: string]: unknown;
518
572
  }
519
573
  /**
520
574
  * Interface representing the body for order preview calculation.
@@ -529,21 +583,29 @@ interface ICreateOrderPreview {
529
583
  couponCode?: string;
530
584
  additionalDiscountsMarkers?: string[];
531
585
  bonusAmount?: number;
532
- [key: string]: unknown;
533
586
  }
534
587
  /**
535
- * Interface representing a single item in an order preview.
536
588
  * @interface IOrderPreviewItem
589
+ * @property {number} id - Product identifier. Example: 2954.
590
+ * @property {number} price - Product unit price before discounts. Example: 51.
591
+ * @property {number} quantity - Quantity of the product. Example: 1.
592
+ * @property {number | null} discountPrice - Unit price after discounts, or null when no discount applies. Example: null.
593
+ * @property {boolean} isGift - Whether the product is delivered as a gift. Example: false.
594
+ * @description A single line item in the order preview response.
537
595
  */
538
596
  interface IOrderPreviewItem {
539
- [key: string]: unknown;
597
+ id: number;
598
+ price: number;
599
+ quantity: number;
600
+ discountPrice: number | null;
601
+ isGift: boolean;
540
602
  }
541
603
  /**
542
604
  * Interface representing the response from an order preview calculation.
543
605
  * @interface IOrderPreviewResponse
544
606
  * @property {number} totalSum - Total order amount before discounts. Example: 300.
545
607
  * @property {number} totalSumWithDiscount - Total order amount after discounts. Example: 250.
546
- * @property {unknown} discountConfig - Discount configuration applied to the order.
608
+ * @property {IOrderDiscountConfig} discountConfig - Discount configuration applied to the order.
547
609
  * @property {string} currency - Currency of the order. Example: "USD".
548
610
  * @property {IOrderPreviewItem[]} orderPreview - Array of order preview items.
549
611
  * @property {number} bonusApplied - Bonus applied to the order.
@@ -552,7 +614,7 @@ interface IOrderPreviewItem {
552
614
  interface IOrderPreviewResponse {
553
615
  totalSum: number;
554
616
  totalSumWithDiscount: number;
555
- discountConfig: unknown;
617
+ discountConfig: IOrderDiscountConfig;
556
618
  currency: string;
557
619
  orderPreview: IOrderPreviewItem[];
558
620
  bonusApplied: number;
@@ -565,7 +627,7 @@ interface IOrderPreviewResponse {
565
627
  * @property {string} status - Refund status.
566
628
  * @property {number} amount - Refund amount.
567
629
  * @property {string} note - Refund note.
568
- * @property {Record<string, unknown>} products - Products for refund.
630
+ * @property {Record<string, IRefundProduct>} products - Map of product id to refund details.
569
631
  * @property {number} orderId - Order id.
570
632
  * @property {number} orderStorageId - Order storage id.
571
633
  * @property {number} userId - User id.
@@ -578,18 +640,29 @@ interface IRefundRequest {
578
640
  status: string;
579
641
  amount: number;
580
642
  note: string;
581
- products: Record<string, unknown>;
643
+ products: Record<string, IRefundProduct>;
582
644
  orderId: number;
583
645
  orderStorageId: number;
584
646
  userId: number;
585
647
  orderStorage: unknown;
586
648
  user: unknown;
587
649
  }
650
+ /**
651
+ * @interface IRefundProduct
652
+ * @description Refund details for a single product.
653
+ * @property {number} quantity - Quantity of the product to refund. Example: 1.
654
+ */
655
+ interface IRefundProduct {
656
+ quantity: number;
657
+ }
588
658
  /**
589
659
  * @interface ICreateRefundRequest
590
660
  * @description Body for creating a refund request.
661
+ * @property {Record<string, IRefundProduct>} products - Map of product id to refund details. Example: `{ "146": { "quantity": 1 } }`.
662
+ * @property {string} [note] - Optional note for the refund request. Example: "test".
591
663
  */
592
664
  interface ICreateRefundRequest {
593
- [key: string]: unknown;
665
+ products: Record<string, IRefundProduct>;
666
+ note?: string;
594
667
  }
595
- export type { IBaseOrdersEntity, IBaseOrdersEntityResponse, ICreateOrderPreview, ICreateRefundRequest, IOrderByMarkerEntity, IOrderData, IOrderPreviewItem, IOrderPreviewResponse, IOrderProductData, IOrderProducts, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrdersFormData, IOrderStatus, IPaymentAccountIdentifiers, IPicture, IPreviewOrderProduct, IRefundRequest, };
668
+ export type { IBaseOrdersEntity, IBaseOrdersEntityResponse, ICreateOrderPreview, ICreateRefundRequest, IOrderByMarkerEntity, IOrderData, IOrderDiscountBonus, IOrderDiscountConfig, IOrderDiscountSettings, IOrderPreviewItem, IOrderPreviewResponse, IOrderProductData, IOrderProducts, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrdersFormData, IOrderStatus, IPaymentAccountIdentifiers, IPicture, IPreviewOrderProduct, IRefundProduct, IRefundRequest, };
@@ -90,6 +90,33 @@ export declare const OrdersStorageResponseSchema: z.ZodArray<z.ZodObject<{
90
90
  }, z.core.$strip>>;
91
91
  position: z.ZodNullable<z.ZodNumber>;
92
92
  }, z.core.$strip>>;
93
+ /**
94
+ * Order discount config schema
95
+ * @description Resolved discount configuration returned with an order or order preview.
96
+ */
97
+ export declare const OrderDiscountConfigSchema: z.ZodObject<{
98
+ bonus: z.ZodNullable<z.ZodObject<{
99
+ availableBalance: z.ZodNumber;
100
+ bonusApplied: z.ZodNumber;
101
+ maxBonusDiscount: z.ZodNumber;
102
+ minBonusAmount: z.ZodNullable<z.ZodNumber>;
103
+ minOrderAmountForBonus: z.ZodNullable<z.ZodNumber>;
104
+ }, z.core.$strip>>;
105
+ coupon: z.ZodNullable<z.ZodUnknown>;
106
+ orderDiscounts: z.ZodArray<z.ZodUnknown>;
107
+ productDiscounts: z.ZodArray<z.ZodUnknown>;
108
+ settings: z.ZodObject<{
109
+ allowGiftStacking: z.ZodBoolean;
110
+ allowStacking: z.ZodBoolean;
111
+ maxDiscountValue: z.ZodNullable<z.ZodNumber>;
112
+ }, z.core.$strip>;
113
+ additionalDiscountsMarkers: z.ZodOptional<z.ZodArray<z.ZodString>>;
114
+ bonusApplied: z.ZodOptional<z.ZodNumber>;
115
+ excludedGiftProductIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
116
+ totalDue: z.ZodOptional<z.ZodNumber>;
117
+ totalRaw: z.ZodOptional<z.ZodNumber>;
118
+ totalSumWithDiscount: z.ZodOptional<z.ZodNumber>;
119
+ }, z.core.$strip>;
93
120
  /**
94
121
  * Create order response schema
95
122
  * API returns a simplified order object after creation
@@ -107,7 +134,29 @@ export declare const CreateOrderResponseSchema: z.ZodObject<{
107
134
  statusIdentifier: z.ZodOptional<z.ZodString>;
108
135
  couponCode: z.ZodOptional<z.ZodString>;
109
136
  additionalDiscountsMarkers: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
- discountConfig: z.ZodOptional<z.ZodUnknown>;
137
+ discountConfig: z.ZodOptional<z.ZodObject<{
138
+ bonus: z.ZodNullable<z.ZodObject<{
139
+ availableBalance: z.ZodNumber;
140
+ bonusApplied: z.ZodNumber;
141
+ maxBonusDiscount: z.ZodNumber;
142
+ minBonusAmount: z.ZodNullable<z.ZodNumber>;
143
+ minOrderAmountForBonus: z.ZodNullable<z.ZodNumber>;
144
+ }, z.core.$strip>>;
145
+ coupon: z.ZodNullable<z.ZodUnknown>;
146
+ orderDiscounts: z.ZodArray<z.ZodUnknown>;
147
+ productDiscounts: z.ZodArray<z.ZodUnknown>;
148
+ settings: z.ZodObject<{
149
+ allowGiftStacking: z.ZodBoolean;
150
+ allowStacking: z.ZodBoolean;
151
+ maxDiscountValue: z.ZodNullable<z.ZodNumber>;
152
+ }, z.core.$strip>;
153
+ additionalDiscountsMarkers: z.ZodOptional<z.ZodArray<z.ZodString>>;
154
+ bonusApplied: z.ZodOptional<z.ZodNumber>;
155
+ excludedGiftProductIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
156
+ totalDue: z.ZodOptional<z.ZodNumber>;
157
+ totalRaw: z.ZodOptional<z.ZodNumber>;
158
+ totalSumWithDiscount: z.ZodOptional<z.ZodNumber>;
159
+ }, z.core.$strip>>;
111
160
  bonusAmount: z.ZodOptional<z.ZodNumber>;
112
161
  bonusApplied: z.ZodOptional<z.ZodNumber>;
113
162
  totalDue: z.ZodOptional<z.ZodNumber>;
@@ -128,7 +177,29 @@ export declare const UpdateOrderResponseSchema: z.ZodObject<{
128
177
  statusIdentifier: z.ZodOptional<z.ZodString>;
129
178
  couponCode: z.ZodOptional<z.ZodString>;
130
179
  additionalDiscountsMarkers: z.ZodOptional<z.ZodArray<z.ZodString>>;
131
- discountConfig: z.ZodOptional<z.ZodUnknown>;
180
+ discountConfig: z.ZodOptional<z.ZodObject<{
181
+ bonus: z.ZodNullable<z.ZodObject<{
182
+ availableBalance: z.ZodNumber;
183
+ bonusApplied: z.ZodNumber;
184
+ maxBonusDiscount: z.ZodNumber;
185
+ minBonusAmount: z.ZodNullable<z.ZodNumber>;
186
+ minOrderAmountForBonus: z.ZodNullable<z.ZodNumber>;
187
+ }, z.core.$strip>>;
188
+ coupon: z.ZodNullable<z.ZodUnknown>;
189
+ orderDiscounts: z.ZodArray<z.ZodUnknown>;
190
+ productDiscounts: z.ZodArray<z.ZodUnknown>;
191
+ settings: z.ZodObject<{
192
+ allowGiftStacking: z.ZodBoolean;
193
+ allowStacking: z.ZodBoolean;
194
+ maxDiscountValue: z.ZodNullable<z.ZodNumber>;
195
+ }, z.core.$strip>;
196
+ additionalDiscountsMarkers: z.ZodOptional<z.ZodArray<z.ZodString>>;
197
+ bonusApplied: z.ZodOptional<z.ZodNumber>;
198
+ excludedGiftProductIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
199
+ totalDue: z.ZodOptional<z.ZodNumber>;
200
+ totalRaw: z.ZodOptional<z.ZodNumber>;
201
+ totalSumWithDiscount: z.ZodOptional<z.ZodNumber>;
202
+ }, z.core.$strip>>;
132
203
  bonusAmount: z.ZodOptional<z.ZodNumber>;
133
204
  bonusApplied: z.ZodOptional<z.ZodNumber>;
134
205
  totalDue: z.ZodOptional<z.ZodNumber>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UpdateOrderResponseSchema = exports.CreateOrderResponseSchema = exports.OrdersStorageResponseSchema = exports.OrderStorageSchema = exports.OrdersResponseSchema = exports.OrderEntitySchema = exports.OrderItemSchema = void 0;
3
+ exports.UpdateOrderResponseSchema = exports.CreateOrderResponseSchema = exports.OrderDiscountConfigSchema = exports.OrdersStorageResponseSchema = exports.OrderStorageSchema = exports.OrdersResponseSchema = exports.OrderEntitySchema = exports.OrderItemSchema = void 0;
4
4
  /**
5
5
  * Validation schemas for Orders module
6
6
  * @description Zod schemas for validating orders-related API responses
@@ -65,6 +65,35 @@ exports.OrderStorageSchema = zod_1.z.object({
65
65
  * @returns Orders storage list response schema
66
66
  */
67
67
  exports.OrdersStorageResponseSchema = zod_1.z.array(exports.OrderStorageSchema);
68
+ /**
69
+ * Order discount config schema
70
+ * @description Resolved discount configuration returned with an order or order preview.
71
+ */
72
+ exports.OrderDiscountConfigSchema = zod_1.z.object({
73
+ bonus: zod_1.z
74
+ .object({
75
+ availableBalance: zod_1.z.number(),
76
+ bonusApplied: zod_1.z.number(),
77
+ maxBonusDiscount: zod_1.z.number(),
78
+ minBonusAmount: zod_1.z.number().nullable(),
79
+ minOrderAmountForBonus: zod_1.z.number().nullable(),
80
+ })
81
+ .nullable(),
82
+ coupon: zod_1.z.unknown().nullable(),
83
+ orderDiscounts: zod_1.z.array(zod_1.z.unknown()),
84
+ productDiscounts: zod_1.z.array(zod_1.z.unknown()),
85
+ settings: zod_1.z.object({
86
+ allowGiftStacking: zod_1.z.boolean(),
87
+ allowStacking: zod_1.z.boolean(),
88
+ maxDiscountValue: zod_1.z.number().nullable(),
89
+ }),
90
+ additionalDiscountsMarkers: zod_1.z.array(zod_1.z.string()).optional(),
91
+ bonusApplied: zod_1.z.number().optional(),
92
+ excludedGiftProductIds: zod_1.z.array(zod_1.z.string()).optional(),
93
+ totalDue: zod_1.z.number().optional(),
94
+ totalRaw: zod_1.z.number().optional(),
95
+ totalSumWithDiscount: zod_1.z.number().optional(),
96
+ });
68
97
  /**
69
98
  * Create order response schema
70
99
  * API returns a simplified order object after creation
@@ -82,7 +111,7 @@ exports.CreateOrderResponseSchema = zod_1.z.object({
82
111
  statusIdentifier: zod_1.z.string().optional(),
83
112
  couponCode: zod_1.z.string().optional(),
84
113
  additionalDiscountsMarkers: zod_1.z.array(zod_1.z.string()).optional(),
85
- discountConfig: zod_1.z.unknown().optional(),
114
+ discountConfig: exports.OrderDiscountConfigSchema.optional(),
86
115
  bonusAmount: zod_1.z.number().optional(),
87
116
  bonusApplied: zod_1.z.number().optional(),
88
117
  totalDue: zod_1.z.number().optional(),
@@ -103,7 +132,7 @@ exports.UpdateOrderResponseSchema = zod_1.z.object({
103
132
  statusIdentifier: zod_1.z.string().optional(),
104
133
  couponCode: zod_1.z.string().optional(),
105
134
  additionalDiscountsMarkers: zod_1.z.array(zod_1.z.string()).optional(),
106
- discountConfig: zod_1.z.unknown().optional(),
135
+ discountConfig: exports.OrderDiscountConfigSchema.optional(),
107
136
  bonusAmount: zod_1.z.number().optional(),
108
137
  bonusApplied: zod_1.z.number().optional(),
109
138
  totalDue: zod_1.z.number().optional(),
@@ -216,7 +216,7 @@ class PagesApi extends asyncModules_1.default {
216
216
  const data = await this._fetchGet(`/quick/search?${url && 'url=' + url}&lang=${langCode}&name=${name}`);
217
217
  // /quick/search?url=catalog&langCode=en_US&name=cat
218
218
  // Check if there is no traffic limit set in the state
219
- if (!this.state.traficLimit) {
219
+ if (!this.state.traficLimit && Array.isArray(data)) {
220
220
  // Initialize an empty array to store detailed page information
221
221
  const pageList = [];
222
222
  // Use Promise.all to fetch detailed information for each page concurrently
@@ -1,4 +1,4 @@
1
- import type { AttributeType, IAttributes, IError, ILocalizeInfo, LangType, Types } from '../base/utils';
1
+ import type { IAttributes, IAttributeValues, IError, ILocalizeInfo, IRating, LangType, Types } from '../base/utils';
2
2
  import type { IBlockEntity } from '../blocks/blocksInterfaces';
3
3
  import type { IFormConfig } from '../forms/formsInterfaces';
4
4
  import type { ITemplateEntity } from '../templates/templatesInterfaces';
@@ -173,7 +173,7 @@ interface IPositionForm {
173
173
  * @property {string | null} templateIdentifier - User id of the linked template. Example: null.
174
174
  * @property {boolean} isVisible - A sign of page visibility. Example: true.
175
175
  * @property {boolean} isSync - Indication of page indexing. Example: false.
176
- * @property {AttributeType} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
176
+ * @property {IAttributeValues} attributeValues - Map of attribute values keyed by marker; empty object when none.
177
177
  * @example
178
178
  {
179
179
  "block-text": {
@@ -194,11 +194,11 @@ interface IPositionBlock {
194
194
  version: number;
195
195
  position: number;
196
196
  identifier: string;
197
- type: string;
197
+ type: Types;
198
198
  templateIdentifier: string | null;
199
199
  isVisible: boolean;
200
200
  isSync: boolean;
201
- attributeValues: AttributeType;
201
+ attributeValues: IAttributeValues;
202
202
  countElementsPerRow?: number;
203
203
  quantity?: number;
204
204
  }
@@ -220,7 +220,7 @@ interface IPositionBlock {
220
220
  * @property {Types} type - Page type. Example: "common_page".
221
221
  * @property {string | null} templateIdentifier - User id of the linked template. Example: "template".
222
222
  * @property {string | null} attributeSetIdentifier - Set of attributes id. Example: "page".
223
- * @property {AttributeType} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
223
+ * @property {IAttributeValues} attributeValues - Map of attribute values keyed by marker; empty object when none.
224
224
  * @example
225
225
  {
226
226
  "text": {
@@ -255,7 +255,7 @@ interface IPositionBlock {
255
255
  "position": 1
256
256
  }
257
257
  * @property {Array<IFormConfig>} [moduleFormConfigs] - Module form configurations linked to the page.
258
- * @property {Record<string, unknown>} [rating] - Rating data.
258
+ * @property {IRating} [rating] - Rating data.
259
259
  * @property {string} [total] - Total number of products linked to the page. Example: "10".
260
260
  * @property {string} [categoryPath] - Category path string. Example: "catalog".
261
261
  * @description This interface defines the structure of a page entity, including its identifiers, attributes, and hierarchical relationships.
@@ -270,9 +270,9 @@ interface IPagesEntity {
270
270
  type: Types;
271
271
  templateIdentifier: string | null;
272
272
  attributeSetIdentifier: string | null;
273
- attributeValues: AttributeType;
273
+ attributeValues: IAttributeValues;
274
274
  moduleFormConfigs?: IFormConfig[];
275
- rating?: Record<string, unknown>;
275
+ rating?: IRating;
276
276
  isSync: boolean;
277
277
  template?: ITemplateEntity;
278
278
  blocks?: IBlockEntity[] | string[];
@@ -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
  /**