oneentry 1.0.145 → 1.0.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +121 -24
- package/dist/auth-provider/authProvidersInterfaces.d.ts +43 -36
- package/dist/base/utils.d.ts +159 -53
- package/dist/blocks/blocksApi.d.ts +3 -3
- package/dist/blocks/blocksApi.js +1 -1
- package/dist/blocks/blocksInterfaces.d.ts +7 -7
- package/dist/blocks/blocksSchemas.d.ts +52 -8
- package/dist/discounts/discountsApi.d.ts +7 -7
- package/dist/discounts/discountsApi.js +3 -3
- package/dist/discounts/discountsInterfaces.d.ts +79 -33
- package/dist/forms/formsInterfaces.d.ts +85 -15
- package/dist/forms-data/formsDataInterfaces.d.ts +142 -67
- package/dist/menus/menusInterfaces.d.ts +1 -1
- package/dist/orders/ordersApi.d.ts +4 -4
- package/dist/orders/ordersApi.js +2 -2
- package/dist/orders/ordersInterfaces.d.ts +97 -24
- 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 +8 -8
- package/dist/payments/paymentsApi.d.ts +3 -3
- package/dist/payments/paymentsApi.js +2 -2
- package/dist/payments/paymentsInterfaces.d.ts +45 -56
- package/dist/payments/paymentsSchemas.d.ts +4 -10
- package/dist/payments/paymentsSchemas.js +2 -11
- package/dist/products/productsApi.d.ts +26 -19
- package/dist/products/productsApi.js +27 -20
- package/dist/products/productsInterfaces.d.ts +109 -33
- package/dist/products/productsSchemas.d.ts +52 -8
- package/dist/products/productsSchemas.js +15 -2
- package/dist/sitemap/sitemapApi.d.ts +5 -5
- package/dist/sitemap/sitemapApi.js +2 -2
- package/dist/sitemap/sitemapInterfaces.d.ts +32 -21
- package/dist/templates/templatesApi.js +8 -3
- package/dist/templates/templatesInterfaces.d.ts +3 -3
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +22 -8
- package/dist/users/usersInterfaces.d.ts +7 -11
- package/package.json +1 -1
package/dist/base/utils.d.ts
CHANGED
|
@@ -62,30 +62,46 @@ interface IConfig {
|
|
|
62
62
|
errors?: {
|
|
63
63
|
isShell?: boolean;
|
|
64
64
|
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) =>
|
|
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 -
|
|
80
|
-
* @
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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,71 +113,161 @@ interface IAttributes {
|
|
|
97
113
|
type: string | number | null;
|
|
98
114
|
};
|
|
99
115
|
}>;
|
|
100
|
-
localizeInfos:
|
|
116
|
+
localizeInfos: IAttributeLocalizeInfo;
|
|
101
117
|
marker: string;
|
|
102
118
|
position: number;
|
|
103
119
|
isVisible: boolean;
|
|
104
120
|
type: string;
|
|
105
|
-
settings?: Record<string,
|
|
106
|
-
validators: Record<string,
|
|
107
|
-
additionalFields?:
|
|
108
|
-
|
|
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
|
|
112
|
-
* @property {
|
|
113
|
-
* @
|
|
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
|
|
116
|
-
|
|
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
|
-
*
|
|
120
|
-
* @property {
|
|
121
|
-
* @description
|
|
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
|
-
[
|
|
153
|
+
interface IAttributeLocalizeInfo extends ILocalizeInfo {
|
|
154
|
+
intervals?: ITimeIntervalSchedule[];
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
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.
|
|
166
|
+
*/
|
|
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;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* @interface IAttributeValue
|
|
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, …).
|
|
214
|
+
*/
|
|
215
|
+
interface IAttributeValue {
|
|
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;
|
|
125
227
|
}
|
|
126
228
|
/**
|
|
127
229
|
* @interface IAttributeValues
|
|
128
|
-
* @
|
|
129
|
-
* @description Interface for attribute values.
|
|
230
|
+
* @description Map of attribute values keyed by attribute marker.
|
|
130
231
|
*/
|
|
131
232
|
interface IAttributeValues {
|
|
132
233
|
[key: string]: IAttributeValue;
|
|
133
234
|
}
|
|
134
235
|
/**
|
|
135
|
-
* @interface
|
|
136
|
-
* @property {
|
|
137
|
-
* @
|
|
236
|
+
* @interface IRating
|
|
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.
|
|
138
242
|
*/
|
|
139
|
-
interface
|
|
140
|
-
|
|
243
|
+
interface IRating {
|
|
244
|
+
value?: number;
|
|
245
|
+
like?: number;
|
|
246
|
+
dislike?: number;
|
|
247
|
+
method?: string;
|
|
141
248
|
}
|
|
142
249
|
/**
|
|
143
250
|
* @interface IError
|
|
144
251
|
* @property {string} message - Error message.
|
|
145
|
-
* @property {
|
|
252
|
+
* @property {unknown} pageData - Page data.
|
|
146
253
|
* @property {number} statusCode - Status code.
|
|
147
254
|
* @property {string} timestamp - Timestamp.
|
|
148
|
-
* @property {
|
|
149
|
-
* @
|
|
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.
|
|
150
258
|
*/
|
|
151
259
|
interface IError {
|
|
152
260
|
message: string;
|
|
153
|
-
pageData:
|
|
261
|
+
pageData: unknown;
|
|
154
262
|
statusCode: number;
|
|
155
263
|
timestamp: string;
|
|
156
|
-
|
|
264
|
+
localizeMessage?: string;
|
|
265
|
+
validationErrors?: unknown[];
|
|
157
266
|
}
|
|
158
267
|
/**
|
|
159
268
|
* @interface IHttpHeaders
|
|
160
|
-
* @property {string} [
|
|
161
|
-
* @
|
|
162
|
-
* @property {string} [x-device-metadata] - Device metadata header
|
|
163
|
-
* @property {string} [Authorization] - Authorization header
|
|
164
|
-
* @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.
|
|
165
271
|
*/
|
|
166
272
|
interface IHttpHeaders {
|
|
167
273
|
'Content-Type'?: string;
|
|
@@ -193,5 +299,5 @@ type LangType = string | Array<string>;
|
|
|
193
299
|
/**
|
|
194
300
|
* LocalizeType
|
|
195
301
|
*/
|
|
196
|
-
type LocalizeType =
|
|
197
|
-
export type { AttributeType, IAttributes, IAttributeValues, IConfig, IError, IHttpHeaders, IHttpOptions, ILocalizeInfo,
|
|
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 {
|
|
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.
|
|
@@ -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,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 { IBonusBalanceEntity, IBonusTransactionEntity, IBonusTransactionType, ICouponValidationResult, IDiscountsApi, IDiscountsEntity, IDiscountsResponse, IDiscountType } from './discountsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with events
|
|
7
7
|
* @handle /api/content/events
|
|
@@ -28,12 +28,12 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
|
|
|
28
28
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
29
29
|
* @param {number} [offset] - Optional parameter for pagination. Default: 0.
|
|
30
30
|
* @param {number} [limit] - Optional parameter for pagination. Default: 30.
|
|
31
|
-
* @param {
|
|
31
|
+
* @param {IDiscountType} [type] - Optional parameter to filter discounts by type.
|
|
32
32
|
* @returns {Promise<IDiscountsResponse | IError>} Returns an object containing all discounts or an error object if there was an issue.
|
|
33
33
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
34
34
|
* @description Fetches all discounts from the server.
|
|
35
35
|
*/
|
|
36
|
-
getAllDiscounts(langCode?: string, offset?: number, limit?: number, type?:
|
|
36
|
+
getAllDiscounts(langCode?: string, offset?: number, limit?: number, type?: IDiscountType): Promise<IDiscountsResponse | IError>;
|
|
37
37
|
/**
|
|
38
38
|
* Get discount by marker
|
|
39
39
|
* @handleName getDiscountByMarker
|
|
@@ -47,14 +47,14 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
|
|
|
47
47
|
/**
|
|
48
48
|
* Get bonus balance of the current user.
|
|
49
49
|
* @handleName getBonusBalance
|
|
50
|
-
* @returns {Promise<
|
|
50
|
+
* @returns {Promise<IBonusBalanceEntity | IError>} Returns bonus balance or an error object.
|
|
51
51
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
52
52
|
*/
|
|
53
|
-
getBonusBalance(): Promise<
|
|
53
|
+
getBonusBalance(): Promise<IBonusBalanceEntity | IError>;
|
|
54
54
|
/**
|
|
55
55
|
* Get bonus transaction history of the current user.
|
|
56
56
|
* @handleName getBonusHistory
|
|
57
|
-
* @param {
|
|
57
|
+
* @param {IBonusTransactionType} [type] - Transaction type filter.
|
|
58
58
|
* @param {string} [dateFrom] - Start date filter.
|
|
59
59
|
* @param {string} [dateTo] - End date filter.
|
|
60
60
|
* @param {number} [discountId] - Discount id filter.
|
|
@@ -63,7 +63,7 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
|
|
|
63
63
|
* @returns {Promise<IBonusTransactionEntity[] | IError>} Returns array of bonus transactions or an error object.
|
|
64
64
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
65
65
|
*/
|
|
66
|
-
getBonusHistory(type?:
|
|
66
|
+
getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusTransactionEntity[] | IError>;
|
|
67
67
|
/**
|
|
68
68
|
* Validate discounts coupon
|
|
69
69
|
* @handleName validateDiscountsCoupon
|
|
@@ -31,7 +31,7 @@ class DiscountsApi extends asyncModules_1.default {
|
|
|
31
31
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
32
32
|
* @param {number} [offset] - Optional parameter for pagination. Default: 0.
|
|
33
33
|
* @param {number} [limit] - Optional parameter for pagination. Default: 30.
|
|
34
|
-
* @param {
|
|
34
|
+
* @param {IDiscountType} [type] - Optional parameter to filter discounts by type.
|
|
35
35
|
* @returns {Promise<IDiscountsResponse | IError>} Returns an object containing all discounts or an error object if there was an issue.
|
|
36
36
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
37
37
|
* @description Fetches all discounts from the server.
|
|
@@ -66,7 +66,7 @@ class DiscountsApi extends asyncModules_1.default {
|
|
|
66
66
|
/**
|
|
67
67
|
* Get bonus balance of the current user.
|
|
68
68
|
* @handleName getBonusBalance
|
|
69
|
-
* @returns {Promise<
|
|
69
|
+
* @returns {Promise<IBonusBalanceEntity | IError>} Returns bonus balance or an error object.
|
|
70
70
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
71
71
|
*/
|
|
72
72
|
async getBonusBalance() {
|
|
@@ -76,7 +76,7 @@ class DiscountsApi extends asyncModules_1.default {
|
|
|
76
76
|
/**
|
|
77
77
|
* Get bonus transaction history of the current user.
|
|
78
78
|
* @handleName getBonusHistory
|
|
79
|
-
* @param {
|
|
79
|
+
* @param {IBonusTransactionType} [type] - Transaction type filter.
|
|
80
80
|
* @param {string} [dateFrom] - Start date filter.
|
|
81
81
|
* @param {string} [dateTo] - End date filter.
|
|
82
82
|
* @param {number} [discountId] - Discount id filter.
|