oneentry 1.0.146 → 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 (35) 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 +34 -25
  8. package/dist/base/utils.d.ts +155 -63
  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/discountsInterfaces.d.ts +53 -19
  14. package/dist/forms/formsInterfaces.d.ts +84 -14
  15. package/dist/forms-data/formsDataInterfaces.d.ts +140 -65
  16. package/dist/menus/menusInterfaces.d.ts +1 -1
  17. package/dist/orders/ordersInterfaces.d.ts +81 -19
  18. package/dist/orders/ordersSchemas.d.ts +73 -2
  19. package/dist/orders/ordersSchemas.js +32 -3
  20. package/dist/pages/pagesApi.js +1 -1
  21. package/dist/pages/pagesInterfaces.d.ts +8 -8
  22. package/dist/payments/paymentsInterfaces.d.ts +41 -16
  23. package/dist/products/productsApi.d.ts +26 -19
  24. package/dist/products/productsApi.js +27 -20
  25. package/dist/products/productsInterfaces.d.ts +109 -33
  26. package/dist/products/productsSchemas.d.ts +52 -8
  27. package/dist/products/productsSchemas.js +15 -2
  28. package/dist/sitemap/sitemapApi.d.ts +4 -4
  29. package/dist/sitemap/sitemapApi.js +2 -2
  30. package/dist/sitemap/sitemapInterfaces.d.ts +13 -11
  31. package/dist/templates/templatesApi.js +8 -3
  32. package/dist/templates/templatesInterfaces.d.ts +3 -3
  33. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +22 -8
  34. package/dist/users/usersInterfaces.d.ts +4 -8
  35. package/package.json +2 -2
@@ -62,30 +62,46 @@ interface IConfig {
62
62
  errors?: {
63
63
  isShell?: boolean;
64
64
  customErrors?: {
65
- 400?: (data?: IError) => any;
66
- 401?: (data?: IError) => any;
67
- 403?: (data?: IError) => any;
68
- 404?: (data?: IError) => any;
69
- 429?: (data?: IError) => any;
70
- 500?: (data?: IError) => any;
71
- 502?: (data?: IError) => any;
72
- 503?: (data?: IError) => any;
73
- 504?: (data?: IError) => any;
65
+ 400?: (data?: IError) => unknown;
66
+ 401?: (data?: IError) => unknown;
67
+ 403?: (data?: IError) => unknown;
68
+ 404?: (data?: IError) => unknown;
69
+ 429?: (data?: IError) => unknown;
70
+ 500?: (data?: IError) => unknown;
71
+ 502?: (data?: IError) => unknown;
72
+ 503?: (data?: IError) => unknown;
73
+ 504?: (data?: IError) => unknown;
74
74
  };
75
75
  };
76
76
  }
77
77
  /**
78
78
  * @interface IAttributes
79
- * @property {Array<object>} listTitles - List of titles.
80
- * @property {ILocalizeInfo} localizeInfos - Localization information.
81
- * @property {string} marker - Attribute marker.
82
- * @property {number} position - Attribute position.
83
- * @property {boolean} isVisible - Indicates whether the attribute is visible.
84
- * @property {string} type - Attribute type.
85
- * @property {Record<string, any>} settings - Additional settings for the attribute.
86
- * @property {Record<string, any>} validators - Validators for the attribute.
87
- * @property {Record<string, any>} additionalFields - Additional fields for the attribute.
88
- * @description Interface for attributes.
79
+ * @property {Array<object>} listTitles - Predefined option list for `list`/`enum`-style attributes. Each entry holds a localized label, raw value, sort position, and an `extended` payload with the typed value used by the runtime.
80
+ * @example
81
+ [
82
+ {
83
+ "title": "Red",
84
+ "value": "red",
85
+ "position": 1,
86
+ "extended": { "value": "#ff0000", "type": "string" }
87
+ }
88
+ ]
89
+ * @property {IAttributeLocalizeInfo} localizeInfos - Localized labels for the attribute (title and other text fields shown in UI). For `timeInterval` attributes, also carries the `intervals` schedule payload.
90
+ * @property {string} marker - Machine-readable identifier of the attribute, unique within its set. Example: "color".
91
+ * @property {number} position - Sort position of the attribute inside its set. Example: 1.
92
+ * @property {boolean} isVisible - Whether the attribute is exposed in the public API/UI. Example: true.
93
+ * @property {string} type - Attribute data type (e.g. "string", "integer", "list", "file", "image").
94
+ * @property {Record<string, unknown>} [settings] - Type-specific configuration (e.g. min/max for numbers, accepted MIME types for files). Optional.
95
+ * @property {Record<string, unknown>} validators - Validation rules applied to the attribute value (e.g. `requiredValidator`, `regexValidator`). Example: { "requiredValidator": { "strict": true } }.
96
+ * @property {Record<string, IAttributes>} [additionalFields] - Nested sub-attributes attached to this attribute, keyed by marker. Optional.
97
+ * @property {boolean} [isIcon] - Block/preview attribute flag — whether the field is treated as an icon. Optional.
98
+ * @property {boolean} [isProductPreview] - Block/preview attribute flag — whether the field is shown in product preview. Optional.
99
+ * @property {boolean} [isLogin] - Form attribute flag — whether the field carries the login value used for authentication. Optional.
100
+ * @property {boolean} [isSignUp] - Form attribute flag — whether the field is required during sign-up. Optional.
101
+ * @property {boolean} [isNotificationEmail] - Form attribute flag — whether the field stores the email used for notifications. Optional.
102
+ * @property {boolean} [isNotificationPhonePush] - Form attribute flag — whether the field stores the phone number used for push notifications. Optional.
103
+ * @property {boolean} [isNotificationPhoneSMS] - Form attribute flag — whether the field stores the phone number used for SMS notifications. Optional.
104
+ * @description Definition of a single attribute inside an attribute set — describes how a field is labeled, validated and rendered.
89
105
  */
90
106
  interface IAttributes {
91
107
  listTitles: Array<{
@@ -97,85 +113,161 @@ interface IAttributes {
97
113
  type: string | number | null;
98
114
  };
99
115
  }>;
100
- localizeInfos: ILocalizeInfo;
116
+ localizeInfos: IAttributeLocalizeInfo;
101
117
  marker: string;
102
118
  position: number;
103
119
  isVisible: boolean;
104
120
  type: string;
105
- settings?: Record<string, any>;
106
- validators: Record<string, any>;
107
- additionalFields?: any;
108
- [key: string]: any;
121
+ settings?: Record<string, unknown>;
122
+ validators: Record<string, unknown>;
123
+ additionalFields?: Record<string, IAttributes>;
124
+ isIcon?: boolean;
125
+ isProductPreview?: boolean;
126
+ isLogin?: boolean;
127
+ isSignUp?: boolean;
128
+ isNotificationEmail?: boolean;
129
+ isNotificationPhonePush?: boolean;
130
+ isNotificationPhoneSMS?: boolean;
109
131
  }
110
132
  /**
111
- * @interface ILocalizeInfos
112
- * @property {Record<string, ILocalizeInfo>} - Localization information.
113
- * @description Interface for localization information.
133
+ * @interface ILocalizeInfo
134
+ * @property {string} title - Localized title of the entity. Example: "Catalog".
135
+ * @property {string | null} [plainValue] - Localized plain-text content (without HTML markup). Example: "Plain description".
136
+ * @property {string | null} [htmlValue] - Localized HTML-rendered content. Example: "<p>Description</p>".
137
+ * @property {string | null} [htmlContent] - Localized HTML body content for richer pages. Example: "<div>...</div>".
138
+ * @property {string | null} [menuTitle] - Localized title used in menus and navigation. Example: "Home".
139
+ * @description Normalized localization payload for a single locale, returned by the SDK after unwrapping the API's per-language map.
114
140
  */
115
- interface ILocalizeInfos {
116
- [key: string]: ILocalizeInfo;
141
+ interface ILocalizeInfo {
142
+ title: string;
143
+ plainValue?: string | null;
144
+ htmlValue?: string | null;
145
+ htmlContent?: string | null;
146
+ menuTitle?: string | null;
117
147
  }
118
148
  /**
119
- * Interface for localization information.
120
- * @property {Record<string, any>} - Localization information.
121
- * @description Interface for localization information.
149
+ * @interface IAttributeLocalizeInfo
150
+ * @property {ITimeIntervalSchedule[]} [intervals] - For attributes of type `timeInterval`, the precomputed schedule data attached to the localization payload.
151
+ * @description Extension of {@link ILocalizeInfo} used by attribute entities — adds attribute-type-specific fields the API exposes via `localizeInfos`.
122
152
  */
123
- interface ILocalizeInfo {
124
- [key: string]: any;
153
+ interface IAttributeLocalizeInfo extends ILocalizeInfo {
154
+ intervals?: ITimeIntervalSchedule[];
125
155
  }
126
156
  /**
127
- * @interface IAttributeValues
128
- * @property {Record<string, IAttributeValue>} - Attribute values.
129
- * @description Interface for attribute values.
157
+ * @interface ITimeIntervalSchedule
158
+ * @property {string} id - Schedule entry identifier (UUID). Example: "c6466cd8-c55d-4583-97c5-42b684210f12".
159
+ * @property {number} fullMonth - Month index this schedule covers (0-11). Example: 2.
160
+ * @property {boolean} inEveryMonth - Whether the schedule repeats every month. Example: true.
161
+ * @property {number} selectedYear - Year the schedule applies to. Example: 2025.
162
+ * @property {ITimeIntervalRange[]} intervals - Daily time ranges configured for the schedule.
163
+ * @property {unknown[]} external - External overrides; empty array when none.
164
+ * @property {unknown[]} range - Date ranges; empty array when none.
165
+ * @description One entry of a `timeInterval` attribute's schedule.
130
166
  */
131
- interface IAttributeValues {
132
- [key: string]: IAttributeValue;
167
+ interface ITimeIntervalSchedule {
168
+ id: string;
169
+ fullMonth: number;
170
+ inEveryMonth: boolean;
171
+ selectedYear: number;
172
+ intervals: ITimeIntervalRange[];
173
+ external: unknown[];
174
+ range: unknown[];
175
+ }
176
+ /**
177
+ * @interface ITimeIntervalPoint
178
+ * @property {number} hours - Hour component (0-23).
179
+ * @property {number} minutes - Minute component (0-59).
180
+ * @description A point in time within a day, used as start/end of {@link ITimeIntervalRange}.
181
+ */
182
+ interface ITimeIntervalPoint {
183
+ hours: number;
184
+ minutes: number;
185
+ }
186
+ /**
187
+ * @interface ITimeIntervalRange
188
+ * @property {string} id - Range identifier (UUID).
189
+ * @property {ITimeIntervalPoint} start - Start time of the range.
190
+ * @property {ITimeIntervalPoint} end - End time of the range.
191
+ * @property {number} period - Slot duration in minutes. Example: 60.
192
+ * @description A single daily time range inside a {@link ITimeIntervalSchedule}.
193
+ */
194
+ interface ITimeIntervalRange {
195
+ id: string;
196
+ start: ITimeIntervalPoint;
197
+ end: ITimeIntervalPoint;
198
+ period: number;
133
199
  }
134
200
  /**
135
201
  * @interface IAttributeValue
136
- * @property {Record<string, any>} - Attribute value.
137
- * @description Interface for attribute value.
202
+ * @property {string} type - Attribute data type (e.g. "string", "integer", "list", "file", "image").
203
+ * @property {unknown} value - Attribute value — actual TS type depends on `type` (string for "string"/"text", number for "integer", array for "list", etc.). Example: "Admins text".
204
+ * @property {number} [position] - Sort position of the value inside its set. Example: 0.
205
+ * @property {Record<string, IAttributeValue> | unknown[]} [additionalFields] - Nested attribute values keyed by marker; the API may also return an empty array when none are configured. Optional.
206
+ * @property {boolean} [isIcon] - Block/preview attribute flag — whether the field is treated as an icon. Optional.
207
+ * @property {boolean} [isProductPreview] - Block/preview attribute flag — whether the field is shown in product preview. Optional.
208
+ * @property {boolean} [isLogin] - Form attribute flag — whether the field carries the login value used for authentication. Optional.
209
+ * @property {boolean} [isSignUp] - Form attribute flag — whether the field is required during sign-up. Optional.
210
+ * @property {boolean} [isNotificationEmail] - Form attribute flag — whether the field stores the email used for notifications. Optional.
211
+ * @property {boolean} [isNotificationPhonePush] - Form attribute flag — whether the field stores the phone number used for push notifications. Optional.
212
+ * @property {boolean} [isNotificationPhoneSMS] - Form attribute flag — whether the field stores the phone number used for SMS notifications. Optional.
213
+ * @description A single attribute value attached to an entity (admin, user, page, product, …).
138
214
  */
139
215
  interface IAttributeValue {
140
- [key: string]: any;
216
+ type: string;
217
+ value: unknown;
218
+ position?: number;
219
+ additionalFields?: Record<string, IAttributeValue> | unknown[];
220
+ isIcon?: boolean;
221
+ isProductPreview?: boolean;
222
+ isLogin?: boolean;
223
+ isSignUp?: boolean;
224
+ isNotificationEmail?: boolean;
225
+ isNotificationPhonePush?: boolean;
226
+ isNotificationPhoneSMS?: boolean;
227
+ }
228
+ /**
229
+ * @interface IAttributeValues
230
+ * @description Map of attribute values keyed by attribute marker.
231
+ */
232
+ interface IAttributeValues {
233
+ [key: string]: IAttributeValue;
141
234
  }
142
235
  /**
143
236
  * @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.
237
+ * @property {number} [value] - Average rating value. Example: 4.5.
238
+ * @property {number} [like] - Number of likes. Example: 10.
239
+ * @property {number} [dislike] - Number of dislikes. Example: 2.
240
+ * @property {string} [method] - Rating calculation method. Example: "average".
241
+ * @description Rating data attached to an entity. All fields are optional — the API returns an empty object when no rating has been collected yet.
149
242
  */
150
243
  interface IRating {
151
- value: number;
152
- like: number;
153
- dislike: number;
154
- method: string;
244
+ value?: number;
245
+ like?: number;
246
+ dislike?: number;
247
+ method?: string;
155
248
  }
156
249
  /**
157
250
  * @interface IError
158
251
  * @property {string} message - Error message.
159
- * @property {any} pageData - Page data.
252
+ * @property {unknown} pageData - Page data.
160
253
  * @property {number} statusCode - Status code.
161
254
  * @property {string} timestamp - Timestamp.
162
- * @property {Record<string, any>} - Attribute value.
163
- * @description Interface for error.
255
+ * @property {string} [localizeMessage] - Human-readable localized error message; populated by the SDK when response validation fails. Optional.
256
+ * @property {unknown[]} [validationErrors] - Detailed validation issues from Zod when response validation fails. Optional.
257
+ * @description Interface for error responses returned by the SDK either from the API or from local response validation.
164
258
  */
165
259
  interface IError {
166
260
  message: string;
167
- pageData: any;
261
+ pageData: unknown;
168
262
  statusCode: number;
169
263
  timestamp: string;
170
- [key: string]: any;
264
+ localizeMessage?: string;
265
+ validationErrors?: unknown[];
171
266
  }
172
267
  /**
173
268
  * @interface IHttpHeaders
174
- * @property {string} [Content-Type] - Content type header
175
- * @property {string} [x-app-token] - App token header
176
- * @property {string} [x-device-metadata] - Device metadata header
177
- * @property {string} [Authorization] - Authorization header
178
- * @description Interface for HTTP headers
269
+ * @property {string} [Authorization] - Authorization header.
270
+ * @description Interface for HTTP headers. Supports the standard `Content-Type`, `Authorization`, and OneEntry-specific `x-app-token` / `x-device-metadata` headers, plus arbitrary string entries via the index signature.
179
271
  */
180
272
  interface IHttpHeaders {
181
273
  'Content-Type'?: string;
@@ -207,5 +299,5 @@ type LangType = string | Array<string>;
207
299
  /**
208
300
  * LocalizeType
209
301
  */
210
- type LocalizeType = ILocalizeInfos | ILocalizeInfo;
211
- export type { AttributeType, IAttributes, IAttributeValues, IConfig, IError, IHttpHeaders, IHttpOptions, ILocalizeInfo, ILocalizeInfos, IRating, LangType, LocalizeType, Types, };
302
+ type LocalizeType = ILocalizeInfo;
303
+ export type { AttributeType, IAttributeLocalizeInfo, IAttributes, IAttributeValue, IAttributeValues, IConfig, IError, IHttpHeaders, IHttpOptions, ILocalizeInfo, IRating, ITimeIntervalPoint, ITimeIntervalRange, ITimeIntervalSchedule, 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 { IProductsEntity } from '../products/productsInterfaces';
4
+ import type { IProductsResponse } from '../products/productsInterfaces';
5
5
  import type { BlockType, IBlockEntity, IBlocks, IBlocksResponse, ISearchBlock } from './blocksInterfaces';
6
6
  /**
7
7
  * Controllers for working with blocks.
@@ -72,10 +72,10 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
72
72
  * @param {string} marker - Block marker. Example: "frequently_ordered_block".
73
73
  * @param {string} [langCode] - Language code. Default: "en_US".
74
74
  * @param {string} [signPrice] - Sign price.
75
- * @returns {Promise<IProductsEntity[] | IError>} Returns array of ProductEntity objects.
75
+ * @returns {Promise<IProductsResponse | IError>} Returns a products response with items and total.
76
76
  * @throws {IError} When isShell=false and an error occurs during the fetch
77
77
  */
78
- getFrequentlyOrderedProducts(productId: number, marker: string, langCode?: string, signPrice?: string): Promise<IProductsEntity[] | IError>;
78
+ getFrequentlyOrderedProducts(productId: number, marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
79
79
  /**
80
80
  * Quick search for block objects with limited output.
81
81
  * @handleName searchBlock
@@ -177,7 +177,7 @@ class BlocksApi extends asyncModules_1.default {
177
177
  * @param {string} marker - Block marker. Example: "frequently_ordered_block".
178
178
  * @param {string} [langCode] - Language code. Default: "en_US".
179
179
  * @param {string} [signPrice] - Sign price.
180
- * @returns {Promise<IProductsEntity[] | IError>} Returns array of ProductEntity objects.
180
+ * @returns {Promise<IProductsResponse | IError>} Returns a products response with items and total.
181
181
  * @throws {IError} When isShell=false and an error occurs during the fetch
182
182
  */
183
183
  async getFrequentlyOrderedProducts(productId, marker, langCode = this.state.lang, signPrice) {
@@ -1,4 +1,4 @@
1
- import type { AttributeType, IError, ILocalizeInfo } from '../base/utils';
1
+ import type { IAttributeValues, IError, ILocalizeInfo } from '../base/utils';
2
2
  import type { IProductsEntity, IProductsResponse } from '../products/productsInterfaces';
3
3
  /**
4
4
  * Interface for managing and retrieving blocks in the system.
@@ -47,10 +47,10 @@ interface IBlocks {
47
47
  * @param {string} marker - Block marker. Example: "frequently_ordered_block".
48
48
  * @param {string} [langCode] - Language code. Default: "en_US".
49
49
  * @param {string} [signPrice] - Sign price.
50
- * @returns {IProductsEntity[]} A promise that resolves to an array of product entities or an error.
50
+ * @returns {IProductsResponse} A promise that resolves to a products response (items + total) or an error.
51
51
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
52
52
  */
53
- getFrequentlyOrderedProducts(productId: number, marker: string, langCode?: string, signPrice?: string): Promise<IProductsEntity[] | IError>;
53
+ getFrequentlyOrderedProducts(productId: number, marker: string, langCode?: string, signPrice?: string): Promise<IProductsResponse | IError>;
54
54
  }
55
55
  /**
56
56
  * Represents a response from the blocks API.
@@ -96,7 +96,7 @@ interface IBlocksResponse {
96
96
  /**
97
97
  * Represents a block entity with various attributes and properties.
98
98
  * @interface IBlockEntity
99
- * @property {AttributeType} attributeValues - Type of attributes used in the block.
99
+ * @property {IAttributeValues} attributeValues - Map of attribute values keyed by marker; empty object when none.
100
100
  * @example
101
101
  {
102
102
  "block-text": {
@@ -116,7 +116,7 @@ interface IBlocksResponse {
116
116
  }
117
117
  * @property {number} version - Version of the block entity. Example: 1.
118
118
  * @property {string} identifier - Unique string identifier for the block. Example: "block1".
119
- * @property {string} type - Type of the block, such as 'product', 'error_page', etc. Example: "product".
119
+ * @property {BlockType} type - Type of the block. Example: "product".
120
120
  * @property {number} position - Position of the block for sorting. Example: 1.
121
121
  * @property {string | null} templateIdentifier - Identifier for the template used by the block, or null if not applicable. Example: "template1".
122
122
  * @property {boolean} isVisible - Indicates whether the block is visible. Example: true.
@@ -148,10 +148,10 @@ interface IBlockEntity {
148
148
  version: number;
149
149
  position: number;
150
150
  identifier: string;
151
- type: string;
151
+ type: BlockType;
152
152
  templateIdentifier: string | null;
153
153
  isVisible: boolean;
154
- attributeValues: AttributeType;
154
+ attributeValues: IAttributeValues;
155
155
  similarProducts?: IProductsResponse;
156
156
  countElementsPerRow?: number;
157
157
  quantity?: number;
@@ -22,7 +22,12 @@ export declare const BlockEntitySchema: z.ZodObject<{
22
22
  attributeSetIdentifier: z.ZodNullable<z.ZodString>;
23
23
  position: z.ZodNumber;
24
24
  price: z.ZodNullable<z.ZodNumber>;
25
- additional: z.ZodRecord<z.ZodString, z.ZodAny>;
25
+ additional: z.ZodObject<{
26
+ prices: z.ZodObject<{
27
+ min: z.ZodNumber;
28
+ max: z.ZodNumber;
29
+ }, z.core.$strip>;
30
+ }, z.core.$strip>;
26
31
  sku: z.ZodNullable<z.ZodString>;
27
32
  isSync: z.ZodBoolean;
28
33
  attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
@@ -33,7 +38,13 @@ export declare const BlockEntitySchema: z.ZodObject<{
33
38
  templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
34
39
  shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
35
40
  signedPrice: z.ZodOptional<z.ZodString>;
36
- productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
41
+ productPages: z.ZodOptional<z.ZodArray<z.ZodObject<{
42
+ id: z.ZodNumber;
43
+ pageId: z.ZodNumber;
44
+ productId: z.ZodNumber;
45
+ positionId: z.ZodNumber;
46
+ categoryPath: z.ZodString;
47
+ }, z.core.$strip>>>;
37
48
  blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
38
49
  isPositionLocked: z.ZodOptional<z.ZodBoolean>;
39
50
  relatedIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
@@ -52,7 +63,12 @@ export declare const BlockEntitySchema: z.ZodObject<{
52
63
  attributeSetIdentifier: z.ZodNullable<z.ZodString>;
53
64
  position: z.ZodNumber;
54
65
  price: z.ZodNullable<z.ZodNumber>;
55
- additional: z.ZodRecord<z.ZodString, z.ZodAny>;
66
+ additional: z.ZodObject<{
67
+ prices: z.ZodObject<{
68
+ min: z.ZodNumber;
69
+ max: z.ZodNumber;
70
+ }, z.core.$strip>;
71
+ }, z.core.$strip>;
56
72
  sku: z.ZodNullable<z.ZodString>;
57
73
  isSync: z.ZodBoolean;
58
74
  attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
@@ -63,7 +79,13 @@ export declare const BlockEntitySchema: z.ZodObject<{
63
79
  templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
64
80
  shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
65
81
  signedPrice: z.ZodOptional<z.ZodString>;
66
- productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
82
+ productPages: z.ZodOptional<z.ZodArray<z.ZodObject<{
83
+ id: z.ZodNumber;
84
+ pageId: z.ZodNumber;
85
+ productId: z.ZodNumber;
86
+ positionId: z.ZodNumber;
87
+ categoryPath: z.ZodString;
88
+ }, z.core.$strip>>>;
67
89
  blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
68
90
  isPositionLocked: z.ZodOptional<z.ZodBoolean>;
69
91
  relatedIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
@@ -94,7 +116,12 @@ export declare const BlocksResponseSchema: z.ZodObject<{
94
116
  attributeSetIdentifier: z.ZodNullable<z.ZodString>;
95
117
  position: z.ZodNumber;
96
118
  price: z.ZodNullable<z.ZodNumber>;
97
- additional: z.ZodRecord<z.ZodString, z.ZodAny>;
119
+ additional: z.ZodObject<{
120
+ prices: z.ZodObject<{
121
+ min: z.ZodNumber;
122
+ max: z.ZodNumber;
123
+ }, z.core.$strip>;
124
+ }, z.core.$strip>;
98
125
  sku: z.ZodNullable<z.ZodString>;
99
126
  isSync: z.ZodBoolean;
100
127
  attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
@@ -105,7 +132,13 @@ export declare const BlocksResponseSchema: z.ZodObject<{
105
132
  templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
106
133
  shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
107
134
  signedPrice: z.ZodOptional<z.ZodString>;
108
- productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
135
+ productPages: z.ZodOptional<z.ZodArray<z.ZodObject<{
136
+ id: z.ZodNumber;
137
+ pageId: z.ZodNumber;
138
+ productId: z.ZodNumber;
139
+ positionId: z.ZodNumber;
140
+ categoryPath: z.ZodString;
141
+ }, z.core.$strip>>>;
109
142
  blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
143
  isPositionLocked: z.ZodOptional<z.ZodBoolean>;
111
144
  relatedIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
@@ -124,7 +157,12 @@ export declare const BlocksResponseSchema: z.ZodObject<{
124
157
  attributeSetIdentifier: z.ZodNullable<z.ZodString>;
125
158
  position: z.ZodNumber;
126
159
  price: z.ZodNullable<z.ZodNumber>;
127
- additional: z.ZodRecord<z.ZodString, z.ZodAny>;
160
+ additional: z.ZodObject<{
161
+ prices: z.ZodObject<{
162
+ min: z.ZodNumber;
163
+ max: z.ZodNumber;
164
+ }, z.core.$strip>;
165
+ }, z.core.$strip>;
128
166
  sku: z.ZodNullable<z.ZodString>;
129
167
  isSync: z.ZodBoolean;
130
168
  attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
@@ -135,7 +173,13 @@ export declare const BlocksResponseSchema: z.ZodObject<{
135
173
  templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
136
174
  shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
137
175
  signedPrice: z.ZodOptional<z.ZodString>;
138
- productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
176
+ productPages: z.ZodOptional<z.ZodArray<z.ZodObject<{
177
+ id: z.ZodNumber;
178
+ pageId: z.ZodNumber;
179
+ productId: z.ZodNumber;
180
+ positionId: z.ZodNumber;
181
+ categoryPath: z.ZodString;
182
+ }, z.core.$strip>>>;
139
183
  blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
140
184
  isPositionLocked: z.ZodOptional<z.ZodBoolean>;
141
185
  relatedIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
@@ -1,4 +1,4 @@
1
- import type { IError } from '../base/utils';
1
+ import type { IAttributeValues, IError, ILocalizeInfo } from '../base/utils';
2
2
  /**
3
3
  * Discount type.
4
4
  */
@@ -89,21 +89,21 @@ interface IDiscountCondition {
89
89
  * @interface IDiscountsEntity
90
90
  * @property {number} id - The unique identifier of the discount.
91
91
  * @property {number} [attributeSetId] - The identifier of the discount.
92
- * @property {object} [localizeInfos] - The name of the discount.
92
+ * @property {ILocalizeInfo} [localizeInfos] - The name of the discount.
93
93
  * @property {number} [version] - The version of the discount.
94
94
  * @property {string} [identifier] - The identifier of the discount.
95
95
  * @property {IDiscountType} type - The type of the discount.
96
96
  * @property {string} [startDate] - The start date of the discount.
97
97
  * @property {string} [endDate] - The end date of the discount.
98
- * @property {Record<string, unknown>} [discountValue] - The value of the discount.
98
+ * @property {IDiscountValue} [discountValue] - The value of the discount, including its type and amount limits.
99
99
  * @property {string} [conditionLogic] - The logic of the discount. Possible values are "AND" | "OR".
100
100
  * @property {IDiscountCondition[]} [conditions] - The conditions of the discount.
101
- * @property {object} [exclusions] - The exclusions of the discount.
102
- * @property {object} [gifts] - The gifts of the discount.
101
+ * @property {Record<string, unknown> | null} [exclusions] - The exclusions of the discount.
102
+ * @property {Record<string, unknown> | null} [gifts] - The gifts of the discount.
103
103
  * @property {boolean} [giftsReplaceCartItems] - Whether the gifts replace cart items.
104
- * @property {object} [userGroups] - The user groups of the discount.
105
- * @property {object} [userExclusions] - The user exclusions of the discount.
106
- * @property {object} [attributeValues] - The attribute values of the discount.
104
+ * @property {Record<string, unknown> | null} [userGroups] - The user groups of the discount.
105
+ * @property {Record<string, unknown> | null} [userExclusions] - The user exclusions of the discount.
106
+ * @property {IAttributeValues} [attributeValues] - The attribute values of the discount.
107
107
  * @property {string} [attributeSetIdentifier] - The identifier of the attribute set.
108
108
  * @property {Record<string, unknown>} [bonusEvent] - Bonus event configuration.
109
109
  * @property {number} [position] - Position number for sorting. Example: 1.
@@ -112,26 +112,60 @@ interface IDiscountCondition {
112
112
  interface IDiscountsEntity {
113
113
  id: number;
114
114
  attributeSetId?: number;
115
- localizeInfos?: object;
115
+ localizeInfos?: ILocalizeInfo;
116
116
  version?: number;
117
117
  identifier?: string;
118
118
  type: IDiscountType;
119
119
  startDate?: string;
120
120
  endDate?: string;
121
- discountValue?: Record<string, unknown>;
121
+ discountValue?: IDiscountValue;
122
122
  conditionLogic?: 'AND' | 'OR';
123
123
  conditions?: IDiscountCondition[];
124
- exclusions?: object;
125
- gifts?: object;
124
+ exclusions?: Record<string, unknown> | null;
125
+ gifts?: Record<string, unknown> | null;
126
126
  giftsReplaceCartItems?: boolean;
127
- userGroups?: object;
128
- userExclusions?: object;
129
- attributeValues?: object;
127
+ userGroups?: Record<string, unknown> | null;
128
+ userExclusions?: Record<string, unknown> | null;
129
+ attributeValues?: IAttributeValues;
130
130
  attributeSetIdentifier?: string;
131
- bonusEvent?: Record<string, unknown>;
131
+ bonusEvent?: Record<string, unknown> | null;
132
132
  position?: number;
133
133
  total?: number | string;
134
134
  }
135
+ /**
136
+ * @interface IDiscountValue
137
+ * @property {'TO_PRODUCT' | 'TO_ORDER'} applicability - What the discount applies to. Example: "TO_PRODUCT".
138
+ * @property {'FIXED_AMOUNT' | 'PERCENT'} discountType - How the discount value is interpreted. Example: "FIXED_AMOUNT".
139
+ * @property {number} value - Discount amount (currency units for FIXED_AMOUNT, percentage points for PERCENT). Example: 10.
140
+ * @property {number} [maxAmount] - Optional cap on the absolute discount applied. Example: 5.
141
+ * @description Configuration of the discount calculation.
142
+ */
143
+ interface IDiscountValue {
144
+ applicability: 'TO_PRODUCT' | 'TO_ORDER';
145
+ discountType: 'FIXED_AMOUNT' | 'PERCENT';
146
+ value: number;
147
+ maxAmount?: number;
148
+ }
149
+ /**
150
+ * @interface ICouponEntity
151
+ * @property {number} id - Coupon record id. Example: 1.
152
+ * @property {number} discountId - Discount the coupon belongs to. Example: 1.
153
+ * @property {string} code - Coupon code. Example: "SUMMER-KBWZ-2428".
154
+ * @property {boolean} isReusable - Whether the coupon can be used more than once. Example: false.
155
+ * @property {boolean} isUsed - Whether the coupon has already been used. Example: false.
156
+ * @property {number | null} orderId - Order id where the coupon was applied, or null. Example: null.
157
+ * @property {string | null} usedAt - When the coupon was used, or null. Example: null.
158
+ * @description Coupon entity returned by the discounts API.
159
+ */
160
+ interface ICouponEntity {
161
+ id: number;
162
+ discountId: number;
163
+ code: string;
164
+ isReusable: boolean;
165
+ isUsed: boolean;
166
+ orderId: number | null;
167
+ usedAt: string | null;
168
+ }
135
169
  /**
136
170
  * Paginated response for discounts list.
137
171
  * @interface IDiscountsResponse
@@ -154,12 +188,12 @@ interface IDiscountsValidateCoupon {
154
188
  * Result of coupon validation.
155
189
  * @interface ICouponValidationResult
156
190
  * @property {boolean} valid - Whether the coupon is valid.
157
- * @property {unknown} [coupon] - Coupon data if the coupon is valid.
191
+ * @property {ICouponEntity} [coupon] - Coupon data if the coupon is valid.
158
192
  * @property {string} [error] - Error message if the coupon is invalid.
159
193
  */
160
194
  interface ICouponValidationResult {
161
195
  valid: boolean;
162
- coupon?: unknown;
196
+ coupon?: ICouponEntity;
163
197
  error?: string;
164
198
  }
165
199
  /**
@@ -230,4 +264,4 @@ interface IBonusTransactionEntity {
230
264
  interface IBonusBalanceEntity {
231
265
  balance: number;
232
266
  }
233
- export type { IBonusBalanceEntity, IBonusHistoryQuery, IBonusTransactionEntity, IBonusTransactionType, ICouponValidationResult, IDiscountByMarkerQuery, IDiscountCondition, IDiscountsApi, IDiscountsEntity, IDiscountsQuery, IDiscountsResponse, IDiscountsValidateCoupon, IDiscountType, };
267
+ export type { IBonusBalanceEntity, IBonusHistoryQuery, IBonusTransactionEntity, IBonusTransactionType, ICouponEntity, ICouponValidationResult, IDiscountByMarkerQuery, IDiscountCondition, IDiscountsApi, IDiscountsEntity, IDiscountsQuery, IDiscountsResponse, IDiscountsValidateCoupon, IDiscountType, IDiscountValue, };