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.
- package/dist/admins/adminsApi.d.ts +4 -3
- package/dist/admins/adminsApi.js +1 -1
- package/dist/admins/adminsInterfaces.d.ts +4 -4
- package/dist/admins/adminsSchemas.d.ts +24 -8
- package/dist/admins/adminsSchemas.js +11 -5
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +122 -25
- package/dist/auth-provider/authProvidersInterfaces.d.ts +34 -25
- package/dist/base/utils.d.ts +147 -71
- package/dist/blocks/blocksApi.d.ts +3 -3
- package/dist/blocks/blocksApi.js +1 -1
- package/dist/blocks/blocksInterfaces.d.ts +8 -8
- package/dist/blocks/blocksSchemas.d.ts +52 -8
- package/dist/discounts/discountsInterfaces.d.ts +53 -19
- package/dist/forms/formsInterfaces.d.ts +89 -14
- package/dist/forms-data/formsDataInterfaces.d.ts +141 -66
- package/dist/general-types/generalTypesSchemas.d.ts +2 -2
- package/dist/menus/menusInterfaces.d.ts +1 -1
- package/dist/orders/ordersInterfaces.d.ts +81 -19
- package/dist/orders/ordersSchemas.d.ts +73 -2
- package/dist/orders/ordersSchemas.js +32 -3
- package/dist/pages/pagesApi.js +1 -1
- package/dist/pages/pagesInterfaces.d.ts +12 -12
- package/dist/payments/paymentsInterfaces.d.ts +41 -16
- package/dist/products/productsApi.d.ts +26 -19
- package/dist/products/productsApi.js +27 -20
- package/dist/products/productsInterfaces.d.ts +118 -41
- package/dist/products/productsSchemas.d.ts +52 -8
- package/dist/products/productsSchemas.js +15 -2
- package/dist/sitemap/sitemapApi.d.ts +4 -4
- package/dist/sitemap/sitemapApi.js +2 -2
- package/dist/sitemap/sitemapInterfaces.d.ts +13 -11
- package/dist/templates/templatesApi.d.ts +6 -5
- package/dist/templates/templatesApi.js +10 -5
- package/dist/templates/templatesInterfaces.d.ts +10 -9
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +25 -11
- package/dist/users/usersInterfaces.d.ts +4 -8
- package/package.json +2 -2
package/dist/base/utils.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
*/
|
|
4
|
-
type Types = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'similar_products_block' | 'product_block' | 'form' | 'common_page' | 'common_block' | 'order' | 'service' | 'external_page' | 'discount' | 'frequently_ordered_block' | 'none';
|
|
5
|
-
/**
|
|
2
|
+
* @interface IConfig
|
|
6
3
|
* @property {string} [token] - If your project is protected by a token, specify this token in this parameter.
|
|
7
4
|
* @property {string} [langCode] - specify the default language to avoid specifying it in every request.
|
|
8
5
|
* @property {boolean} [traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set this parameter to "false" to save traffic and decide for yourself what data you need.
|
|
@@ -62,30 +59,46 @@ interface IConfig {
|
|
|
62
59
|
errors?: {
|
|
63
60
|
isShell?: boolean;
|
|
64
61
|
customErrors?: {
|
|
65
|
-
400?: (data?: IError) =>
|
|
66
|
-
401?: (data?: IError) =>
|
|
67
|
-
403?: (data?: IError) =>
|
|
68
|
-
404?: (data?: IError) =>
|
|
69
|
-
429?: (data?: IError) =>
|
|
70
|
-
500?: (data?: IError) =>
|
|
71
|
-
502?: (data?: IError) =>
|
|
72
|
-
503?: (data?: IError) =>
|
|
73
|
-
504?: (data?: IError) =>
|
|
62
|
+
400?: (data?: IError) => unknown;
|
|
63
|
+
401?: (data?: IError) => unknown;
|
|
64
|
+
403?: (data?: IError) => unknown;
|
|
65
|
+
404?: (data?: IError) => unknown;
|
|
66
|
+
429?: (data?: IError) => unknown;
|
|
67
|
+
500?: (data?: IError) => unknown;
|
|
68
|
+
502?: (data?: IError) => unknown;
|
|
69
|
+
503?: (data?: IError) => unknown;
|
|
70
|
+
504?: (data?: IError) => unknown;
|
|
74
71
|
};
|
|
75
72
|
};
|
|
76
73
|
}
|
|
77
74
|
/**
|
|
78
75
|
* @interface IAttributes
|
|
79
|
-
* @property {Array<object>} listTitles -
|
|
80
|
-
* @
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
* @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.
|
|
77
|
+
* @example
|
|
78
|
+
[
|
|
79
|
+
{
|
|
80
|
+
"title": "Red",
|
|
81
|
+
"value": "red",
|
|
82
|
+
"position": 1,
|
|
83
|
+
"extended": { "value": "#ff0000", "type": "string" }
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
* @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.
|
|
87
|
+
* @property {string} marker - Machine-readable identifier of the attribute, unique within its set. Example: "color".
|
|
88
|
+
* @property {number} position - Sort position of the attribute inside its set. Example: 1.
|
|
89
|
+
* @property {boolean} isVisible - Whether the attribute is exposed in the public API/UI. Example: true.
|
|
90
|
+
* @property {string} type - Attribute data type (e.g. "string", "integer", "list", "file", "image").
|
|
91
|
+
* @property {Record<string, unknown>} [settings] - Type-specific configuration (e.g. min/max for numbers, accepted MIME types for files). Optional.
|
|
92
|
+
* @property {Record<string, unknown>} validators - Validation rules applied to the attribute value (e.g. `requiredValidator`, `regexValidator`). Example: { "requiredValidator": { "strict": true } }.
|
|
93
|
+
* @property {Record<string, IAttributes>} [additionalFields] - Nested sub-attributes attached to this attribute, keyed by marker. Optional.
|
|
94
|
+
* @property {boolean} [isIcon] - Block/preview attribute flag — whether the field is treated as an icon. Optional.
|
|
95
|
+
* @property {boolean} [isProductPreview] - Block/preview attribute flag — whether the field is shown in product preview. Optional.
|
|
96
|
+
* @property {boolean} [isLogin] - Form attribute flag — whether the field carries the login value used for authentication. Optional.
|
|
97
|
+
* @property {boolean} [isSignUp] - Form attribute flag — whether the field is required during sign-up. Optional.
|
|
98
|
+
* @property {boolean} [isNotificationEmail] - Form attribute flag — whether the field stores the email used for notifications. Optional.
|
|
99
|
+
* @property {boolean} [isNotificationPhonePush] - Form attribute flag — whether the field stores the phone number used for push notifications. Optional.
|
|
100
|
+
* @property {boolean} [isNotificationPhoneSMS] - Form attribute flag — whether the field stores the phone number used for SMS notifications. Optional.
|
|
101
|
+
* @description Definition of a single attribute inside an attribute set — describes how a field is labeled, validated and rendered.
|
|
89
102
|
*/
|
|
90
103
|
interface IAttributes {
|
|
91
104
|
listTitles: Array<{
|
|
@@ -97,85 +110,152 @@ interface IAttributes {
|
|
|
97
110
|
type: string | number | null;
|
|
98
111
|
};
|
|
99
112
|
}>;
|
|
100
|
-
localizeInfos:
|
|
113
|
+
localizeInfos: IAttributeLocalizeInfo;
|
|
101
114
|
marker: string;
|
|
102
115
|
position: number;
|
|
103
116
|
isVisible: boolean;
|
|
104
117
|
type: string;
|
|
105
|
-
settings?: Record<string,
|
|
106
|
-
validators: Record<string,
|
|
107
|
-
additionalFields?:
|
|
108
|
-
|
|
118
|
+
settings?: Record<string, unknown>;
|
|
119
|
+
validators: Record<string, unknown>;
|
|
120
|
+
additionalFields?: Record<string, IAttributes>;
|
|
121
|
+
isIcon?: boolean;
|
|
122
|
+
isProductPreview?: boolean;
|
|
123
|
+
isLogin?: boolean;
|
|
124
|
+
isSignUp?: boolean;
|
|
125
|
+
isNotificationEmail?: boolean;
|
|
126
|
+
isNotificationPhonePush?: boolean;
|
|
127
|
+
isNotificationPhoneSMS?: boolean;
|
|
109
128
|
}
|
|
110
129
|
/**
|
|
111
|
-
* @interface
|
|
112
|
-
* @property {
|
|
113
|
-
* @
|
|
130
|
+
* @interface ILocalizeInfo
|
|
131
|
+
* @property {string} title - Localized title of the entity. Example: "Catalog".
|
|
132
|
+
* @property {string | null} [plainValue] - Localized plain-text content (without HTML markup). Example: "Plain description".
|
|
133
|
+
* @property {string | null} [htmlValue] - Localized HTML-rendered content. Example: "<p>Description</p>".
|
|
134
|
+
* @property {string | null} [htmlContent] - Localized HTML body content for richer pages. Example: "<div>...</div>".
|
|
135
|
+
* @property {string | null} [menuTitle] - Localized title used in menus and navigation. Example: "Home".
|
|
136
|
+
* @description Normalized localization payload for a single locale, returned by the SDK after unwrapping the API's per-language map.
|
|
114
137
|
*/
|
|
115
|
-
interface
|
|
116
|
-
|
|
138
|
+
interface ILocalizeInfo {
|
|
139
|
+
title: string;
|
|
140
|
+
plainValue?: string | null;
|
|
141
|
+
htmlValue?: string | null;
|
|
142
|
+
htmlContent?: string | null;
|
|
143
|
+
menuTitle?: string | null;
|
|
117
144
|
}
|
|
118
145
|
/**
|
|
119
|
-
*
|
|
120
|
-
* @property {
|
|
121
|
-
* @description
|
|
146
|
+
* @interface IAttributeLocalizeInfo
|
|
147
|
+
* @property {ITimeIntervalSchedule[]} [intervals] - For attributes of type `timeInterval`, the precomputed schedule data attached to the localization payload.
|
|
148
|
+
* @description Extension of {@link ILocalizeInfo} used by attribute entities — adds attribute-type-specific fields the API exposes via `localizeInfos`.
|
|
122
149
|
*/
|
|
123
|
-
interface ILocalizeInfo {
|
|
124
|
-
[
|
|
150
|
+
interface IAttributeLocalizeInfo extends ILocalizeInfo {
|
|
151
|
+
intervals?: ITimeIntervalSchedule[];
|
|
152
|
+
[key: string]: unknown;
|
|
125
153
|
}
|
|
126
154
|
/**
|
|
127
|
-
* @interface
|
|
128
|
-
* @property {
|
|
129
|
-
* @
|
|
155
|
+
* @interface ITimeIntervalSchedule
|
|
156
|
+
* @property {string} id - Schedule entry identifier (UUID). Example: "c6466cd8-c55d-4583-97c5-42b684210f12".
|
|
157
|
+
* @property {number} fullMonth - Month index this schedule covers (0-11). Example: 2.
|
|
158
|
+
* @property {boolean} inEveryMonth - Whether the schedule repeats every month. Example: true.
|
|
159
|
+
* @property {number} selectedYear - Year the schedule applies to. Example: 2025.
|
|
160
|
+
* @property {ITimeIntervalRange[]} intervals - Daily time ranges configured for the schedule.
|
|
161
|
+
* @property {unknown[]} external - External overrides; empty array when none.
|
|
162
|
+
* @property {unknown[]} range - Date ranges; empty array when none.
|
|
163
|
+
* @description One entry of a `timeInterval` attribute's schedule.
|
|
130
164
|
*/
|
|
131
|
-
interface
|
|
132
|
-
|
|
165
|
+
interface ITimeIntervalSchedule {
|
|
166
|
+
id: string;
|
|
167
|
+
fullMonth: number;
|
|
168
|
+
inEveryMonth: boolean;
|
|
169
|
+
selectedYear: number;
|
|
170
|
+
intervals: ITimeIntervalRange[];
|
|
171
|
+
external: unknown[];
|
|
172
|
+
range: unknown[];
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @interface ITimeIntervalPoint
|
|
176
|
+
* @property {number} hours - Hour component (0-23).
|
|
177
|
+
* @property {number} minutes - Minute component (0-59).
|
|
178
|
+
* @description A point in time within a day, used as start/end of {@link ITimeIntervalRange}.
|
|
179
|
+
*/
|
|
180
|
+
interface ITimeIntervalPoint {
|
|
181
|
+
hours: number;
|
|
182
|
+
minutes: number;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* @interface ITimeIntervalRange
|
|
186
|
+
* @property {string} id - Range identifier (UUID).
|
|
187
|
+
* @property {ITimeIntervalPoint} start - Start time of the range.
|
|
188
|
+
* @property {ITimeIntervalPoint} end - End time of the range.
|
|
189
|
+
* @property {number} period - Slot duration in minutes. Example: 60.
|
|
190
|
+
* @description A single daily time range inside a {@link ITimeIntervalSchedule}.
|
|
191
|
+
*/
|
|
192
|
+
interface ITimeIntervalRange {
|
|
193
|
+
id: string;
|
|
194
|
+
start: ITimeIntervalPoint;
|
|
195
|
+
end: ITimeIntervalPoint;
|
|
196
|
+
period: number;
|
|
133
197
|
}
|
|
134
198
|
/**
|
|
135
199
|
* @interface IAttributeValue
|
|
136
|
-
* @property {
|
|
137
|
-
* @
|
|
200
|
+
* @property {string} type - Attribute data type (e.g. "string", "integer", "list", "file", "image").
|
|
201
|
+
* @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".
|
|
202
|
+
* @property {number} [position] - Sort position of the value inside its set. Example: 0.
|
|
203
|
+
* @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.
|
|
204
|
+
* @property {boolean} [isIcon] - Block/preview attribute flag — whether the field is treated as an icon. Optional.
|
|
205
|
+
* @property {boolean} [isProductPreview] - Block/preview attribute flag — whether the field is shown in product preview. Optional.
|
|
206
|
+
* @description A single attribute value attached to an entity (admin, user, page, product, …).
|
|
138
207
|
*/
|
|
139
208
|
interface IAttributeValue {
|
|
140
|
-
|
|
209
|
+
type: string;
|
|
210
|
+
value: unknown;
|
|
211
|
+
position?: number;
|
|
212
|
+
additionalFields?: Record<string, IAttributeValue> | unknown[];
|
|
213
|
+
isIcon?: boolean;
|
|
214
|
+
isProductPreview?: boolean;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* @interface IAttributeValues
|
|
218
|
+
* @description Map of attribute values keyed by attribute marker.
|
|
219
|
+
*/
|
|
220
|
+
interface IAttributeValues {
|
|
221
|
+
[key: string]: IAttributeValue;
|
|
141
222
|
}
|
|
142
223
|
/**
|
|
143
224
|
* @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
|
|
225
|
+
* @property {number} [value] - Average rating value. Example: 4.5.
|
|
226
|
+
* @property {number} [like] - Number of likes. Example: 10.
|
|
227
|
+
* @property {number} [dislike] - Number of dislikes. Example: 2.
|
|
228
|
+
* @property {string} [method] - Rating calculation method. Example: "average".
|
|
229
|
+
* @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
230
|
*/
|
|
150
231
|
interface IRating {
|
|
151
|
-
value
|
|
152
|
-
like
|
|
153
|
-
dislike
|
|
154
|
-
method
|
|
232
|
+
value?: number;
|
|
233
|
+
like?: number;
|
|
234
|
+
dislike?: number;
|
|
235
|
+
method?: string;
|
|
155
236
|
}
|
|
156
237
|
/**
|
|
157
238
|
* @interface IError
|
|
158
239
|
* @property {string} message - Error message.
|
|
159
|
-
* @property {
|
|
240
|
+
* @property {unknown} pageData - Page data.
|
|
160
241
|
* @property {number} statusCode - Status code.
|
|
161
242
|
* @property {string} timestamp - Timestamp.
|
|
162
|
-
* @property {
|
|
163
|
-
* @
|
|
243
|
+
* @property {string} [localizeMessage] - Human-readable localized error message; populated by the SDK when response validation fails. Optional.
|
|
244
|
+
* @property {unknown[]} [validationErrors] - Detailed validation issues from Zod when response validation fails. Optional.
|
|
245
|
+
* @description Interface for error responses returned by the SDK either from the API or from local response validation.
|
|
164
246
|
*/
|
|
165
247
|
interface IError {
|
|
166
248
|
message: string;
|
|
167
|
-
pageData:
|
|
249
|
+
pageData: unknown;
|
|
168
250
|
statusCode: number;
|
|
169
251
|
timestamp: string;
|
|
170
|
-
|
|
252
|
+
localizeMessage?: string;
|
|
253
|
+
validationErrors?: unknown[];
|
|
171
254
|
}
|
|
172
255
|
/**
|
|
173
256
|
* @interface IHttpHeaders
|
|
174
|
-
* @property {string} [
|
|
175
|
-
* @
|
|
176
|
-
* @property {string} [x-device-metadata] - Device metadata header
|
|
177
|
-
* @property {string} [Authorization] - Authorization header
|
|
178
|
-
* @description Interface for HTTP headers
|
|
257
|
+
* @property {string} [Authorization] - Authorization header.
|
|
258
|
+
* @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
259
|
*/
|
|
180
260
|
interface IHttpHeaders {
|
|
181
261
|
'Content-Type'?: string;
|
|
@@ -196,10 +276,6 @@ interface IHttpOptions {
|
|
|
196
276
|
headers: IHttpHeaders;
|
|
197
277
|
body?: string | FormData | Blob;
|
|
198
278
|
}
|
|
199
|
-
/**
|
|
200
|
-
* AttributeType
|
|
201
|
-
*/
|
|
202
|
-
type AttributeType = IAttributeValue | IAttributeValues;
|
|
203
279
|
/**
|
|
204
280
|
* LangType
|
|
205
281
|
*/
|
|
@@ -207,5 +283,5 @@ type LangType = string | Array<string>;
|
|
|
207
283
|
/**
|
|
208
284
|
* LocalizeType
|
|
209
285
|
*/
|
|
210
|
-
type LocalizeType =
|
|
211
|
-
export type {
|
|
286
|
+
type LocalizeType = ILocalizeInfo;
|
|
287
|
+
export type { IAttributeLocalizeInfo, IAttributes, IAttributeValue, IAttributeValues, IConfig, IError, IHttpHeaders, IHttpOptions, ILocalizeInfo, IRating, ITimeIntervalPoint, ITimeIntervalRange, ITimeIntervalSchedule, LangType, LocalizeType, };
|
|
@@ -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 {
|
|
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<
|
|
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<
|
|
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
|
package/dist/blocks/blocksApi.js
CHANGED
|
@@ -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<
|
|
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 {
|
|
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 {
|
|
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<
|
|
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.
|
|
@@ -60,7 +60,7 @@ interface IBlocks {
|
|
|
60
60
|
* @example
|
|
61
61
|
[
|
|
62
62
|
{
|
|
63
|
-
"attributeValues":
|
|
63
|
+
"attributeValues": {},
|
|
64
64
|
"id": 1,
|
|
65
65
|
"identifier": "block1",
|
|
66
66
|
"isVisible": true,
|
|
@@ -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 {
|
|
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 {
|
|
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:
|
|
151
|
+
type: BlockType;
|
|
152
152
|
templateIdentifier: string | null;
|
|
153
153
|
isVisible: boolean;
|
|
154
|
-
attributeValues:
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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 {
|
|
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 {
|
|
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 {
|
|
102
|
-
* @property {
|
|
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 {
|
|
105
|
-
* @property {
|
|
106
|
-
* @property {
|
|
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?:
|
|
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?:
|
|
121
|
+
discountValue?: IDiscountValue;
|
|
122
122
|
conditionLogic?: 'AND' | 'OR';
|
|
123
123
|
conditions?: IDiscountCondition[];
|
|
124
|
-
exclusions?:
|
|
125
|
-
gifts?:
|
|
124
|
+
exclusions?: Record<string, unknown> | null;
|
|
125
|
+
gifts?: Record<string, unknown> | null;
|
|
126
126
|
giftsReplaceCartItems?: boolean;
|
|
127
|
-
userGroups?:
|
|
128
|
-
userExclusions?:
|
|
129
|
-
attributeValues?:
|
|
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 {
|
|
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?:
|
|
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, };
|