oneentry 1.0.146 → 1.0.148

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/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 +122 -25
  7. package/dist/auth-provider/authProvidersInterfaces.d.ts +34 -25
  8. package/dist/base/utils.d.ts +147 -71
  9. package/dist/blocks/blocksApi.d.ts +3 -3
  10. package/dist/blocks/blocksApi.js +1 -1
  11. package/dist/blocks/blocksInterfaces.d.ts +8 -8
  12. package/dist/blocks/blocksSchemas.d.ts +52 -8
  13. package/dist/discounts/discountsInterfaces.d.ts +53 -19
  14. package/dist/forms/formsInterfaces.d.ts +89 -14
  15. package/dist/forms-data/formsDataInterfaces.d.ts +141 -66
  16. package/dist/general-types/generalTypesSchemas.d.ts +2 -2
  17. package/dist/menus/menusInterfaces.d.ts +1 -1
  18. package/dist/orders/ordersInterfaces.d.ts +81 -19
  19. package/dist/orders/ordersSchemas.d.ts +73 -2
  20. package/dist/orders/ordersSchemas.js +32 -3
  21. package/dist/pages/pagesApi.js +1 -1
  22. package/dist/pages/pagesInterfaces.d.ts +12 -12
  23. package/dist/payments/paymentsInterfaces.d.ts +41 -16
  24. package/dist/products/productsApi.d.ts +26 -19
  25. package/dist/products/productsApi.js +27 -20
  26. package/dist/products/productsInterfaces.d.ts +118 -41
  27. package/dist/products/productsSchemas.d.ts +52 -8
  28. package/dist/products/productsSchemas.js +15 -2
  29. package/dist/sitemap/sitemapApi.d.ts +4 -4
  30. package/dist/sitemap/sitemapApi.js +2 -2
  31. package/dist/sitemap/sitemapInterfaces.d.ts +13 -11
  32. package/dist/templates/templatesApi.d.ts +6 -5
  33. package/dist/templates/templatesApi.js +10 -5
  34. package/dist/templates/templatesInterfaces.d.ts +10 -9
  35. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +25 -11
  36. package/dist/users/usersInterfaces.d.ts +4 -8
  37. package/package.json +2 -2
@@ -1,5 +1,6 @@
1
1
  import type { IPosition } from '../admins/adminsInterfaces';
2
- import type { IAttributes, IError, ILocalizeInfo } from '../base/utils';
2
+ import type { AttributeType, IAttributeValidators, IListTitle } from '../attribute-sets/attributeSetsInterfaces';
3
+ import type { IAttributeLocalizeInfo, IError, ILocalizeInfo } from '../base/utils';
3
4
  /**
4
5
  * Interface for retrieving forms in the system.
5
6
  * @interface IForms
@@ -60,7 +61,7 @@ interface IFromPages {
60
61
  * @property {number} id - The identifier of the object. Example: 12345.
61
62
  * @property {number | null} attributeSetId - The identifier of the attribute set being used, or null if not applicable. Example: 1234.
62
63
  * @property {string | null} type - Form type. Example: "contact".
63
- * @property {ILocalizeInfo} localizeInfos - The name of the form, taking into account localization.
64
+ * @property {IFormLocalizeInfo} localizeInfos - The name of the form and form-side localization fields (success/error messages, processing config, etc.).
64
65
  * @example
65
66
  {
66
67
  "key": "value"
@@ -70,11 +71,7 @@ interface IFromPages {
70
71
  * @property {string} identifier - The textual identifier for the record field. Example: "form_contact_us".
71
72
  * @property {string} processingType - Type of form processing. Example: "async".
72
73
  * @property {number | null} templateId - The identifier of the template used by the form, or null if no template is used. Example: 6789.
73
- * @property {IAttributes[] | Record<string, any>} [attributes] - The attributes of the form, which can be an array of attribute objects or a record of key-value pairs.
74
- * @example
75
- {
76
- "key": "value"
77
- }
74
+ * @property {IFormAttribute[]} attributes - Form fields with their localization, validators and form-specific flags.
78
75
  * @property {number | string} [total] - Total count of related entries. Example: "1".
79
76
  * @property {IFormConfig[]} [moduleFormConfigs] - Array of module form configurations associated with the form.
80
77
  * @description This interface defines the structure of a form entity, including its identifiers, attributes, and processing data.
@@ -83,16 +80,87 @@ interface IFormsEntity {
83
80
  id: number;
84
81
  attributeSetId: number | null;
85
82
  type: 'order' | 'sing_in_up' | 'collection' | 'data' | 'rating' | null;
86
- localizeInfos: ILocalizeInfo;
83
+ localizeInfos: IFormLocalizeInfo;
87
84
  version: number;
88
85
  position: number;
89
86
  identifier: string;
90
87
  processingType: string;
91
88
  templateId: number | null;
92
- attributes?: IAttributes[] | Record<string, unknown>;
89
+ attributes: IFormAttribute[];
93
90
  total?: number | string;
94
91
  moduleFormConfigs?: IFormConfig[];
95
92
  }
93
+ /**
94
+ * @interface IFormLocalizeInfo
95
+ * @property {string} [titleForSite] - Public-facing title shown on the website. Example: "Form title (for application)".
96
+ * @property {string} [successMessage] - Message shown to the user after successful submission.
97
+ * @property {string} [unsuccessMessage] - Message shown to the user after a failed submission.
98
+ * @property {string} [urlAddress] - URL where the form data is sent for processing (used by `processingType: "url"`).
99
+ * @property {string} [database] - Database flag/id used by the form processor (stringly-typed in the API: "0" / "1" / id).
100
+ * @property {string} [script] - Script flag/id used by the form processor (stringly-typed in the API: "0" / "1" / id).
101
+ * @description Localization payload of a form — extends {@link ILocalizeInfo} with form-side fields (messages, processing config).
102
+ */
103
+ interface IFormLocalizeInfo extends ILocalizeInfo {
104
+ titleForSite?: string;
105
+ successMessage?: string;
106
+ unsuccessMessage?: string;
107
+ urlAddress?: string;
108
+ database?: string;
109
+ script?: string;
110
+ }
111
+ /**
112
+ * @interface IFormAttribute
113
+ * @property {string} marker - Field marker (machine name). Example: "email".
114
+ * @property {AttributeType} type - Attribute data type (e.g. "string", "file").
115
+ * @property {number} position - Sort position of the field. Example: 1.
116
+ * @property {boolean} isVisible - Whether the field is exposed to the user. Example: true.
117
+ * @property {IAttributeLocalizeInfo} localizeInfos - Localized labels for the field. For `timeInterval` attributes, also carries the `intervals` schedule payload.
118
+ * @property {unknown} initialValue - Default value applied when the field is not filled.
119
+ * @property {IListTitle[]} listTitles - Predefined options for `list`/`radioButton` fields; empty array for other types.
120
+ * @property {IAttributeValidators} validators - Validation rules; empty object when no validators are configured.
121
+ * @property {Record<string, unknown>} settings - Field-specific configuration; empty object by default.
122
+ * @property {Record<string, IFormAttributeAdditionalField>} additionalFields - Nested sub-fields keyed by marker; empty object when none.
123
+ * @property {boolean} isLogin - Whether this field carries the login value used for authentication. Example: false.
124
+ * @property {boolean} isSignUp - Whether this field is required during sign-up. Example: false.
125
+ * @property {boolean} isPassword - Whether this field carries the password value used for authentication. Example: false.
126
+ * @property {boolean} isSignUpRequired - Whether this field is required during sign-up. Example: false.
127
+ * @property {boolean} isNotificationEmail - Whether this field stores the email used for notifications. Example: false.
128
+ * @property {boolean} isNotificationPhonePush - Whether this field stores the phone number used for push notifications. Example: false.
129
+ * @property {boolean} isNotificationPhoneSMS - Whether this field stores the phone number used for SMS notifications. Example: false.
130
+ * @description Definition of a single field inside a form — extends a generic attribute with form-specific authentication / notification flags.
131
+ */
132
+ interface IFormAttribute {
133
+ marker: string;
134
+ type: AttributeType;
135
+ position: number;
136
+ isVisible: boolean;
137
+ localizeInfos: IAttributeLocalizeInfo;
138
+ initialValue: unknown;
139
+ listTitles: IListTitle[];
140
+ validators: IAttributeValidators;
141
+ settings: Record<string, unknown>;
142
+ additionalFields: Record<string, IFormAttributeAdditionalField>;
143
+ isLogin: boolean;
144
+ isSignUp: boolean;
145
+ isPassword: boolean;
146
+ isSignUpRequired: boolean;
147
+ isNotificationEmail: boolean;
148
+ isNotificationPhonePush: boolean;
149
+ isNotificationPhoneSMS: boolean;
150
+ [key: string]: unknown;
151
+ }
152
+ /**
153
+ * @interface IFormAttributeAdditionalField
154
+ * @property {string} marker - Marker of the additional field. Example: "additional_field".
155
+ * @property {string} type - Type of the additional field. Example: "string".
156
+ * @property {unknown} value - Value of the additional field. Example: "Additional field data".
157
+ * @description A single nested entry inside {@link IFormAttribute}'s `additionalFields` map.
158
+ */
159
+ interface IFormAttributeAdditionalField {
160
+ marker: string;
161
+ type: string;
162
+ value: unknown;
163
+ }
96
164
  /**
97
165
  * Represents the structure of a form configuration.
98
166
  * @interface IFormConfig
@@ -132,10 +200,7 @@ interface IFormConfig {
132
200
  commentOnlyUserData?: boolean;
133
201
  viewOnlyMyData?: boolean;
134
202
  commentOnlyMyData?: boolean;
135
- entityIdentifiers: {
136
- id: string;
137
- isNested: boolean;
138
- }[];
203
+ entityIdentifiers: IEntityIdentifier[];
139
204
  nestedEntityIdentifiers?: string[];
140
205
  exceptionIds?: string[];
141
206
  formDataCount?: number;
@@ -147,6 +212,16 @@ interface IFormConfig {
147
212
  maxRatingScale?: number | null;
148
213
  ratingCalculation?: string;
149
214
  }
215
+ /**
216
+ * @interface IEntityIdentifier
217
+ * @property {string} id - Entity identifier (e.g. page or product marker). Example: "blog".
218
+ * @property {boolean} isNested - Whether the entit, is treated as ,ested unde, its parent. Exa,ple: false.
219
+ * @description Reference to an entity attached to a form configuration.
220
+ */
221
+ interface IEntityIdentifier {
222
+ id: string;
223
+ isNested: boolean;
224
+ }
150
225
  /**
151
226
  * Represents the paginated response structure for forms.
152
227
  * @interface IFormsResponse
@@ -157,4 +232,4 @@ interface IFormsResponse {
157
232
  total: number;
158
233
  items: IFormsEntity[];
159
234
  }
160
- export type { IFormConfig, IForms, IFormsEntity, IFormsResponse, IFromPages };
235
+ export type { IEntityIdentifier, IFormAttribute, IFormAttributeAdditionalField, IFormConfig, IFormLocalizeInfo, IForms, IFormsEntity, IFormsResponse, IFromPages, };
@@ -244,20 +244,35 @@ interface IFormsByMarkerDataEntity {
244
244
  * @property {string} actionMessage - Action message for the form data (can be localized). Example: "Form submitted successfully".
245
245
  */
246
246
  interface IPostFormResponse {
247
- formData: {
248
- id: number;
249
- formIdentifier: string;
250
- time: string;
251
- entityIdentifier: string;
252
- fingerprint: string;
253
- isUserAdmin: boolean;
254
- formModuleId: number;
255
- userIdentifier: string | null;
256
- parentId: number | null;
257
- formData: FormDataType[] | Record<string, any>;
258
- };
247
+ formData: IPostFormResponseData;
259
248
  actionMessage: string;
260
249
  }
250
+ /**
251
+ * @interface IPostFormResponseData
252
+ * @property {number} id - Identifier of the created form data record. Example: 42.
253
+ * @property {string} formIdentifier - Identifier of the form. Example: "contact_form".
254
+ * @property {string} time - Time of submission. Example: "2023-10-01T12:00:00Z".
255
+ * @property {string} entityIdentifier - Identifier of the entity the form is attached to. Example: "blog".
256
+ * @property {string} fingerprint - Submission fingerprint.
257
+ * @property {boolean} isUserAdmin - Whether the submitting user is an administrator. Example: false.
258
+ * @property {number} formModuleId - Form module configuration identifier. Example: 2.
259
+ * @property {string | null} userIdentifier - Identifier of the submitting user, or null when anonymous.
260
+ * @property {number | null} parentId - Identifier of the parent record, or null when top-level.
261
+ * @property {FormDataType[]} formData - Submitted form fields.
262
+ * @description Inner `formData` payload of {@link IPostFormResponse} — describes the created form data record.
263
+ */
264
+ interface IPostFormResponseData {
265
+ id: number;
266
+ formIdentifier: string;
267
+ time: string;
268
+ entityIdentifier: string;
269
+ fingerprint: string;
270
+ isUserAdmin: boolean;
271
+ formModuleId: number;
272
+ userIdentifier: string | null;
273
+ parentId: number | null;
274
+ formData: FormDataType[];
275
+ }
261
276
  /**
262
277
  * Represents the structure of the response after updating form data.
263
278
  * @interface IUpdateFormsData
@@ -287,7 +302,7 @@ interface IUpdateFormsData {
287
302
  /**
288
303
  * Contains an array of data form objects with the following values
289
304
  */
290
- type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | Record<string, any>;
305
+ type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | Record<string, unknown>;
291
306
  /**
292
307
  * Represents the structure of the body for posting form data.
293
308
  * @interface IBodyPostFormData
@@ -356,11 +371,19 @@ interface IBodyTypeStringNumberFloat {
356
371
  interface IBodyTypeTimeDate {
357
372
  marker: string;
358
373
  type: 'date' | 'dateTime' | 'time';
359
- value: {
360
- fullDate: string;
361
- formattedValue: string;
362
- formatString: string;
363
- };
374
+ value: ITimeDateValue;
375
+ }
376
+ /**
377
+ * @interface ITimeDateValue
378
+ * @property {string} fullDate - ISO date string. Example: "2024-05-07T21:02:00.000Z".
379
+ * @property {string} formattedValue - Human-readable formatted date. Example: "08-05-2024 00:02".
380
+ * @property {string} formatString - Format mask used to render `formattedValue`. Example: "DD-MM-YYYY HH:mm".
381
+ * @description Value payload for `date`/`dateTime`/`time` form fields.
382
+ */
383
+ interface ITimeDateValue {
384
+ fullDate: string;
385
+ formattedValue: string;
386
+ formatString: string;
364
387
  }
365
388
  /**
366
389
  * Represents a text form data entity.
@@ -382,14 +405,29 @@ interface IBodyTypeTimeDate {
382
405
  interface IBodyTypeText {
383
406
  marker: string;
384
407
  type: 'text';
385
- value: {
386
- htmlValue: string;
387
- plainValue: string;
388
- params: {
389
- isEditorDisabled: boolean;
390
- isImageCompressed: boolean;
391
- };
392
- };
408
+ value: ITextValue;
409
+ }
410
+ /**
411
+ * @interface ITextEditorParams
412
+ * @property {boolean} isEditorDisabled - Whether the rich-text editor is disabled. Example: false.
413
+ * @property {boolean} isImageCompressed - Whether embedded images are compressed. Example: true.
414
+ * @description Editor parameters attached to text-type form values.
415
+ */
416
+ interface ITextEditorParams {
417
+ isEditorDisabled: boolean;
418
+ isImageCompressed: boolean;
419
+ }
420
+ /**
421
+ * @interface ITextValue
422
+ * @property {string} htmlValue - HTML representation of the text. Example: "<p>Hello world</p>".
423
+ * @property {string} plainValue - Plain-text representation.
424
+ * @property {ITextEditorParams} params - Editor configuration applied to this value.
425
+ * @description Value payload for `text` form fields.
426
+ */
427
+ interface ITextValue {
428
+ htmlValue: string;
429
+ plainValue: string;
430
+ params: ITextEditorParams;
393
431
  }
394
432
  /**
395
433
  * Represents a text with header form data entity.
@@ -412,15 +450,21 @@ interface IBodyTypeText {
412
450
  interface IBodyTypeTextWithHeader {
413
451
  marker: string;
414
452
  type: 'textWithHeader';
415
- value: {
416
- header: string;
417
- htmlValue: string;
418
- plainValue: string;
419
- params: {
420
- isEditorDisabled: boolean;
421
- isImageCompressed: boolean;
422
- };
423
- };
453
+ value: ITextWithHeaderValue;
454
+ }
455
+ /**
456
+ * @interface ITextWithHeaderValue
457
+ * @property {string} header - Headline text. Example: "Headline".
458
+ * @property {string} htmlValue - HTML body. Example: "<p>Hello world</p>".
459
+ * @property {string} plainValue - Plain-text body.
460
+ * @property {ITextEditorParams} params - Editor configuration applied to this value.
461
+ * @description Value payload for `textWithHeader` form fields.
462
+ */
463
+ interface ITextWithHeaderValue {
464
+ header: string;
465
+ htmlValue: string;
466
+ plainValue: string;
467
+ params: ITextEditorParams;
424
468
  }
425
469
  /**
426
470
  * Represents an image or group of images form data entity.
@@ -445,23 +489,31 @@ interface IBodyTypeTextWithHeader {
445
489
  interface IBodyTypeImageGroupOfImages {
446
490
  marker: string;
447
491
  type: 'image' | 'groupOfImage';
448
- value: {
449
- filename: string;
450
- downloadLink: string;
451
- size: number;
452
- previewLink: string;
453
- params: {
454
- isImageCompressed: boolean;
455
- };
456
- } | Array<{
457
- filename: string;
458
- downloadLink: string;
459
- size: number;
460
- previewLink: string;
461
- params: {
462
- isImageCompressed: boolean;
463
- };
464
- }>;
492
+ value: IImageValue | IImageValue[];
493
+ }
494
+ /**
495
+ * @interface IImageValueParams
496
+ * @property {boolean} isImageCompressed - Whether the stored image has been compressed by the server. Example: true.
497
+ * @description Per-image parameters attached to an image form value.
498
+ */
499
+ interface IImageValueParams {
500
+ isImageCompressed: boolean;
501
+ }
502
+ /**
503
+ * @interface IImageValue
504
+ * @property {string} filename - Server-side path to the image. Example: "files/project/page/10/image/foo.png".
505
+ * @property {string} downloadLink - Public URL to download the image.
506
+ * @property {number} size - File size in bytes. Example: 392585.
507
+ * @property {string} previewLink - URL to a preview-sized version (may be empty).
508
+ * @property {IImageValueParams} params - Image-specific parameters.
509
+ * @description Value payload for `image`/`groupOfImage` form fields.
510
+ */
511
+ interface IImageValue {
512
+ filename: string;
513
+ downloadLink: string;
514
+ size: number;
515
+ previewLink: string;
516
+ params: IImageValueParams;
465
517
  }
466
518
  /**
467
519
  * Represents a file form data entity.
@@ -482,11 +534,19 @@ interface IBodyTypeImageGroupOfImages {
482
534
  interface IBodyTypeFile {
483
535
  marker: string;
484
536
  type: 'file';
485
- value: {
486
- filename: string;
487
- downloadLink: string;
488
- size: number;
489
- };
537
+ value: IFileValue;
538
+ }
539
+ /**
540
+ * @interface IFileValue
541
+ * @property {string} filename - Server-side path to the file.
542
+ * @property {string} downloadLink - Public URL to download the file.
543
+ * @property {number} size - File size in bytes.
544
+ * @description Value payload for `file` form fields.
545
+ */
546
+ interface IFileValue {
547
+ filename: string;
548
+ downloadLink: string;
549
+ size: number;
490
550
  }
491
551
  /**
492
552
  * Represents a radio button or list selection form data entity.
@@ -510,13 +570,28 @@ interface IBodyTypeFile {
510
570
  interface IBodyTypeRadioButtonList {
511
571
  marker: string;
512
572
  type: 'list' | 'radioButton';
513
- value: Array<{
514
- title: string;
515
- value: string;
516
- extended: {
517
- value: string;
518
- type: string;
519
- };
520
- }>;
573
+ value: IListOptionValue[];
574
+ }
575
+ /**
576
+ * @interface IListOptionExtended
577
+ * @property {string} value - Extended option value (e.g. color code "#ff0000"). Example: "red".
578
+ * @property {string} type - Type of the extended value (e.g. "string", "color"). Example: "string".
579
+ * @description Extended payload attached to a list/radio option.
580
+ */
581
+ interface IListOptionExtended {
582
+ value: string;
583
+ type: string;
584
+ }
585
+ /**
586
+ * @interface IListOptionValue
587
+ * @property {string} title - Option title shown to the user.
588
+ * @property {string} value - Underlying option value.
589
+ * @property {IListOptionExtended} extended - Extended payload (e.g. color/code) attached to the option.
590
+ * @description Value payload for `list`/`radioButton` form fields.
591
+ */
592
+ interface IListOptionValue {
593
+ title: string;
594
+ value: string;
595
+ extended: IListOptionExtended;
521
596
  }
522
- export type { FormDataType, IBodyPostFormData, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IFormByMarkerDataEntity, IFormDataEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IPostFormResponse, IUpdateFormsData, };
597
+ export type { FormDataType, IBodyPostFormData, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IFileValue, IFormByMarkerDataEntity, IFormDataEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IImageValue, IImageValueParams, IListOptionExtended, IListOptionValue, IPostFormResponse, IPostFormResponseData, ITextEditorParams, ITextValue, ITextWithHeaderValue, ITimeDateValue, IUpdateFormsData, };
@@ -19,12 +19,12 @@ export declare const GeneralTypeEntitySchema: z.ZodObject<{
19
19
  product_preview: "product_preview";
20
20
  similar_products_block: "similar_products_block";
21
21
  product_block: "product_block";
22
+ frequently_ordered_block: "frequently_ordered_block";
22
23
  common_page: "common_page";
23
24
  common_block: "common_block";
24
25
  service: "service";
25
26
  external_page: "external_page";
26
27
  discount: "discount";
27
- frequently_ordered_block: "frequently_ordered_block";
28
28
  }>;
29
29
  }, z.core.$strip>;
30
30
  /**
@@ -42,11 +42,11 @@ export declare const GeneralTypesResponseSchema: z.ZodArray<z.ZodObject<{
42
42
  product_preview: "product_preview";
43
43
  similar_products_block: "similar_products_block";
44
44
  product_block: "product_block";
45
+ frequently_ordered_block: "frequently_ordered_block";
45
46
  common_page: "common_page";
46
47
  common_block: "common_block";
47
48
  service: "service";
48
49
  external_page: "external_page";
49
50
  discount: "discount";
50
- frequently_ordered_block: "frequently_ordered_block";
51
51
  }>;
52
52
  }, z.core.$strip>>;
@@ -82,6 +82,6 @@ interface IMenusEntity {
82
82
  id: number;
83
83
  identifier: string;
84
84
  localizeInfos: ILocalizeInfo;
85
- pages: IMenusPages[] | IMenusPages;
85
+ pages: IMenusPages[];
86
86
  }
87
87
  export type { IMenus, IMenusEntity, IMenusPages };
@@ -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,7 +640,7 @@ 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;
@@ -603,4 +665,4 @@ interface ICreateRefundRequest {
603
665
  products: Record<string, IRefundProduct>;
604
666
  note?: string;
605
667
  }
606
- export type { IBaseOrdersEntity, IBaseOrdersEntityResponse, ICreateOrderPreview, ICreateRefundRequest, IOrderByMarkerEntity, IOrderData, IOrderPreviewItem, IOrderPreviewResponse, IOrderProductData, IOrderProducts, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrdersFormData, IOrderStatus, IPaymentAccountIdentifiers, IPicture, IPreviewOrderProduct, IRefundProduct, 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, };