oneentry 1.0.127 → 1.0.130
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/README.md +3 -0
- package/dist/admins/adminsApi.d.ts +20 -20
- package/dist/admins/adminsApi.js +20 -20
- package/dist/admins/adminsInterfaces.d.ts +43 -43
- package/dist/attribute-sets/attributeSetsApi.d.ts +16 -16
- package/dist/attribute-sets/attributeSetsApi.js +16 -16
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +87 -85
- package/dist/auth-provider/authProviderApi.d.ts +127 -127
- package/dist/auth-provider/authProviderApi.js +127 -127
- package/dist/auth-provider/authProvidersInterfaces.d.ts +208 -202
- package/dist/base/asyncModules.d.ts +17 -17
- package/dist/base/asyncModules.js +39 -27
- package/dist/base/result.d.ts +11 -11
- package/dist/base/result.js +12 -16
- package/dist/base/stateModule.d.ts +6 -5
- package/dist/base/stateModule.js +15 -14
- package/dist/base/syncModules.d.ts +42 -37
- package/dist/base/syncModules.js +103 -49
- package/dist/base/utils.d.ts +45 -22
- package/dist/blocks/blocksApi.d.ts +24 -24
- package/dist/blocks/blocksApi.js +24 -24
- package/dist/blocks/blocksInterfaces.d.ts +85 -85
- package/dist/events/eventsApi.d.ts +11 -11
- package/dist/events/eventsApi.js +11 -11
- package/dist/events/eventsInterfaces.d.ts +23 -23
- package/dist/file-uploading/fileUploadingApi.d.ts +38 -38
- package/dist/file-uploading/fileUploadingApi.js +38 -38
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +44 -44
- package/dist/forms/formsApi.d.ts +7 -7
- package/dist/forms/formsApi.js +7 -7
- package/dist/forms/formsInterfaces.d.ts +43 -31
- package/dist/forms-data/formsDataApi.d.ts +49 -37
- package/dist/forms-data/formsDataApi.js +49 -38
- package/dist/forms-data/formsDataInterfaces.d.ts +241 -219
- package/dist/general-types/generalTypesApi.d.ts +1 -1
- package/dist/general-types/generalTypesApi.js +1 -1
- package/dist/general-types/generalTypesInterfaces.d.ts +3 -3
- package/dist/index.d.ts +11 -10
- package/dist/index.js +11 -10
- package/dist/integration-collections/integrationCollectionsApi.d.ts +76 -80
- package/dist/integration-collections/integrationCollectionsApi.js +76 -80
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +145 -149
- package/dist/locales/localesInterfaces.d.ts +8 -8
- package/dist/menus/menusApi.d.ts +3 -3
- package/dist/menus/menusApi.js +3 -3
- package/dist/menus/menusInterfaces.d.ts +39 -39
- package/dist/orders/ordersApi.d.ts +56 -56
- package/dist/orders/ordersApi.js +56 -56
- package/dist/orders/ordersInterfaces.d.ts +204 -198
- package/dist/pages/pagesApi.d.ts +60 -60
- package/dist/pages/pagesApi.js +60 -60
- package/dist/pages/pagesInterfaces.d.ts +133 -141
- package/dist/payments/paymentsApi.d.ts +15 -15
- package/dist/payments/paymentsApi.js +15 -15
- package/dist/payments/paymentsInterfaces.d.ts +58 -57
- package/dist/product-statuses/productStatusesApi.d.ts +7 -7
- package/dist/product-statuses/productStatusesApi.js +7 -7
- package/dist/product-statuses/productStatusesInterfaces.d.ts +21 -21
- package/dist/products/productsApi.d.ts +240 -240
- package/dist/products/productsApi.js +240 -240
- package/dist/products/productsInterfaces.d.ts +311 -311
- package/dist/system/systemApi.d.ts +10 -10
- package/dist/system/systemApi.js +10 -10
- package/dist/templates/templatesApi.d.ts +8 -8
- package/dist/templates/templatesApi.js +8 -8
- package/dist/templates/templatesInterfaces.d.ts +22 -22
- package/dist/templates-preview/templatesPreviewApi.d.ts +5 -5
- package/dist/templates-preview/templatesPreviewApi.js +5 -5
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +54 -54
- package/dist/users/usersApi.d.ts +29 -29
- package/dist/users/usersApi.js +29 -29
- package/dist/users/usersInterfaces.d.ts +77 -77
- package/package.json +9 -8
package/dist/base/syncModules.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// Abstract class representing synchronization modules
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
4
|
+
* Abstract class representing synchronization modules.
|
|
6
5
|
*/
|
|
7
6
|
class SyncModules {
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Constructor to initialize state and URL.
|
|
9
|
+
* @param {StateModule} state - StateModule instance.
|
|
10
|
+
*/
|
|
9
11
|
constructor(state) {
|
|
10
12
|
/**
|
|
11
13
|
* Sorts attributes by their positions.
|
|
12
|
-
* @param
|
|
13
|
-
* @returns {any}
|
|
14
|
+
* @param {any} data - The data containing attributes.
|
|
15
|
+
* @returns {any} Sorted attributes.
|
|
14
16
|
*/
|
|
15
17
|
this._sortAttributes = (data) => Object.fromEntries(Object.entries(data).sort(([, a], [, b]) => a.position - b.position));
|
|
16
18
|
this.state = state;
|
|
@@ -18,16 +20,16 @@ class SyncModules {
|
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Constructs the full URL path by appending the given path to the base URL.
|
|
21
|
-
* @param
|
|
22
|
-
* @returns {string}
|
|
23
|
+
* @param {string} path - The path to append to the base URL.
|
|
24
|
+
* @returns {string} The full URL as a string.
|
|
23
25
|
*/
|
|
24
26
|
_getFullPath(path) {
|
|
25
27
|
return this._url + path;
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* Converts query parameters into a query string.
|
|
29
|
-
* @param
|
|
30
|
-
* @returns {string}
|
|
31
|
+
* @param {IProductsQuery | IUploadingQuery | any} query - The query object containing key-value pairs.
|
|
32
|
+
* @returns {string} A string representation of the query parameters.
|
|
31
33
|
*/
|
|
32
34
|
_queryParamsToString(query) {
|
|
33
35
|
let result = '';
|
|
@@ -40,9 +42,9 @@ class SyncModules {
|
|
|
40
42
|
}
|
|
41
43
|
/**
|
|
42
44
|
* Normalizes data based on language code.
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @returns {any}
|
|
45
|
+
* @param {any} data - The data to normalize.
|
|
46
|
+
* @param {string} langCode - The language code for normalization.
|
|
47
|
+
* @returns {any} Normalized data.
|
|
46
48
|
*/
|
|
47
49
|
_normalizeData(data, langCode = this.state.lang) {
|
|
48
50
|
if (Array.isArray(data)) {
|
|
@@ -72,9 +74,9 @@ class SyncModules {
|
|
|
72
74
|
}
|
|
73
75
|
/**
|
|
74
76
|
* Normalizes the body of a POST request.
|
|
75
|
-
* @param
|
|
76
|
-
* @param
|
|
77
|
-
* @returns {any}
|
|
77
|
+
* @param {any} body - The body to normalize.
|
|
78
|
+
* @param {string} [langCode] - The language code for normalization.
|
|
79
|
+
* @returns {any} Normalized body.
|
|
78
80
|
*/
|
|
79
81
|
_normalizePostBody(body, langCode = this.state.lang) {
|
|
80
82
|
const formData = {};
|
|
@@ -86,8 +88,8 @@ class SyncModules {
|
|
|
86
88
|
}
|
|
87
89
|
/**
|
|
88
90
|
* Clears arrays within the data structure.
|
|
89
|
-
* @param
|
|
90
|
-
* @returns {any}
|
|
91
|
+
* @param {Record<string, any>} data - The data to clear.
|
|
92
|
+
* @returns {any} Cleared data.
|
|
91
93
|
*/
|
|
92
94
|
_clearArray(data) {
|
|
93
95
|
if (Array.isArray(data)) {
|
|
@@ -124,9 +126,9 @@ class SyncModules {
|
|
|
124
126
|
}
|
|
125
127
|
/**
|
|
126
128
|
* Adds a specified number of days to a date.
|
|
127
|
-
* @param
|
|
128
|
-
* @param
|
|
129
|
-
* @returns {any}
|
|
129
|
+
* @param {Date} date - The initial date.
|
|
130
|
+
* @param {number} days - The number of days to add.
|
|
131
|
+
* @returns {any} The new date with added days.
|
|
130
132
|
*/
|
|
131
133
|
_addDays(date, days) {
|
|
132
134
|
const result = new Date(date);
|
|
@@ -135,12 +137,12 @@ class SyncModules {
|
|
|
135
137
|
}
|
|
136
138
|
/**
|
|
137
139
|
* Generates intervals for a specific date based on a schedule.
|
|
138
|
-
* @param {Date}
|
|
139
|
-
* @param {object}
|
|
140
|
-
* @param {boolean}
|
|
141
|
-
* @param {any[]}
|
|
142
|
-
* @param {boolean}
|
|
143
|
-
* @param {Set<Array<string>>} utcIntervals
|
|
140
|
+
* @param {Date} date - The date for which to generate intervals.
|
|
141
|
+
* @param {object} schedule - The schedule defining the intervals.
|
|
142
|
+
* @param {boolean} schedule.inEveryWeek - The number of weeks between intervals.
|
|
143
|
+
* @param {any[]} schedule.times - The times for each interval.
|
|
144
|
+
* @param {boolean} schedule.inEveryMonth - The month intervals for each interval.
|
|
145
|
+
* @param {Set<Array<string>>} utcIntervals - A set to store unique intervals.
|
|
144
146
|
*/
|
|
145
147
|
_generateIntervalsForDate(date, schedule, utcIntervals) {
|
|
146
148
|
// Handle weekly schedules
|
|
@@ -161,14 +163,18 @@ class SyncModules {
|
|
|
161
163
|
intervalEnd.toISOString(),
|
|
162
164
|
]);
|
|
163
165
|
});
|
|
164
|
-
|
|
166
|
+
// Move to the next week
|
|
167
|
+
currentDate = this._addDays(currentDate, 7);
|
|
165
168
|
}
|
|
166
169
|
}
|
|
167
170
|
// Handle monthly schedules
|
|
168
171
|
if (schedule.inEveryMonth && !schedule.inEveryWeek) {
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
+
// Начальная дата
|
|
173
|
+
const startDate = new Date(date);
|
|
174
|
+
// Определяем день месяца начальной даты
|
|
175
|
+
const targetDayOfMonth = startDate.getUTCDate();
|
|
176
|
+
// Количество месяцев, на которые нужно повторить
|
|
177
|
+
const numberOfMonths = 12;
|
|
172
178
|
for (let i = 0; i < numberOfMonths; i++) {
|
|
173
179
|
const currentDate = new Date(startDate);
|
|
174
180
|
currentDate.setUTCMonth(currentDate.getUTCMonth() + i);
|
|
@@ -193,13 +199,17 @@ class SyncModules {
|
|
|
193
199
|
}
|
|
194
200
|
// Handle both weekly and monthly schedules
|
|
195
201
|
if (schedule.inEveryMonth && schedule.inEveryWeek) {
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
|
|
202
|
+
// Initial date
|
|
203
|
+
const startDate = new Date(date);
|
|
204
|
+
// Determine the day of the week
|
|
205
|
+
const targetDayOfWeek = startDate.getUTCDay();
|
|
206
|
+
// Number of months to repeat
|
|
207
|
+
const numberOfMonths = 12;
|
|
199
208
|
for (let i = 0; i < numberOfMonths; i++) {
|
|
200
209
|
const currentDate = new Date(startDate);
|
|
201
210
|
currentDate.setUTCMonth(currentDate.getUTCMonth() + i);
|
|
202
|
-
|
|
211
|
+
// Set to the first day of the month
|
|
212
|
+
currentDate.setUTCDate(1);
|
|
203
213
|
// Find the first target day of the week in the current month
|
|
204
214
|
const daysUntilTargetDay = (targetDayOfWeek - currentDate.getUTCDay() + 7) % 7;
|
|
205
215
|
currentDate.setUTCDate(currentDate.getUTCDate() + daysUntilTargetDay);
|
|
@@ -225,8 +235,8 @@ class SyncModules {
|
|
|
225
235
|
}
|
|
226
236
|
/**
|
|
227
237
|
* Adds time intervals to schedules.
|
|
228
|
-
* @param
|
|
229
|
-
* @returns {any}
|
|
238
|
+
* @param {any[]} schedules - The schedules to process.
|
|
239
|
+
* @returns {any} Schedules with added time intervals.
|
|
230
240
|
*/
|
|
231
241
|
_addTimeIntervalsToSchedules(schedules) {
|
|
232
242
|
schedules.forEach((scheduleGroup) => {
|
|
@@ -250,11 +260,11 @@ class SyncModules {
|
|
|
250
260
|
}
|
|
251
261
|
/**
|
|
252
262
|
* Normalizes attributes within the data.
|
|
253
|
-
* @param
|
|
254
|
-
* @returns {any}
|
|
263
|
+
* @param {any} data - The data to normalize.
|
|
264
|
+
* @returns {any} Normalized attributes.
|
|
255
265
|
*/
|
|
256
266
|
_normalizeAttr(data) {
|
|
257
|
-
// For regular attributes
|
|
267
|
+
// For regular attributes collections
|
|
258
268
|
if ('attributeValues' in data) {
|
|
259
269
|
for (const attr in data.attributeValues) {
|
|
260
270
|
const d = data.attributeValues[attr];
|
|
@@ -297,13 +307,17 @@ class SyncModules {
|
|
|
297
307
|
}
|
|
298
308
|
return data;
|
|
299
309
|
}
|
|
310
|
+
// !!! For single attribute
|
|
311
|
+
if ('attributes' in data) {
|
|
312
|
+
//
|
|
313
|
+
}
|
|
300
314
|
return data;
|
|
301
315
|
}
|
|
302
316
|
/**
|
|
303
317
|
* Processes data after fetching or receiving it.
|
|
304
|
-
* @param
|
|
305
|
-
* @param
|
|
306
|
-
* @returns {any}
|
|
318
|
+
* @param {any} data - The data to process.
|
|
319
|
+
* @param {any} [langCode] - The language code for processing.
|
|
320
|
+
* @returns {any} Processed data.
|
|
307
321
|
*/
|
|
308
322
|
_dataPostProcess(data, langCode = this.state.lang) {
|
|
309
323
|
const normalize = this._normalizeData(data, langCode);
|
|
@@ -312,8 +326,8 @@ class SyncModules {
|
|
|
312
326
|
}
|
|
313
327
|
/**
|
|
314
328
|
* Sets the access token in the state.
|
|
315
|
-
* @param
|
|
316
|
-
* @returns {any}
|
|
329
|
+
* @param {string} accessToken - The access token to set.
|
|
330
|
+
* @returns {any} The instance of SyncModules for chaining.
|
|
317
331
|
*/
|
|
318
332
|
setAccessToken(accessToken) {
|
|
319
333
|
this.state.accessToken = accessToken;
|
|
@@ -321,8 +335,8 @@ class SyncModules {
|
|
|
321
335
|
}
|
|
322
336
|
/**
|
|
323
337
|
* Sets the refresh token in the state.
|
|
324
|
-
* @param
|
|
325
|
-
* @returns {any}
|
|
338
|
+
* @param {string} refreshToken - The refresh token to set.
|
|
339
|
+
* @returns {any} The instance of SyncModules for chaining.
|
|
326
340
|
*/
|
|
327
341
|
setRefreshToken(refreshToken) {
|
|
328
342
|
this.state.refreshToken = refreshToken;
|
|
@@ -343,11 +357,51 @@ class SyncModules {
|
|
|
343
357
|
const platform = nav.platform || 'Win32';
|
|
344
358
|
const userAgent = nav.userAgent || 'Node.js/22';
|
|
345
359
|
const language = nav.language || 'en-US';
|
|
360
|
+
// Get screen information if available
|
|
361
|
+
const screen = (win === null || win === void 0 ? void 0 : win.screen) || {};
|
|
362
|
+
const screenWidth = screen.width || 0;
|
|
363
|
+
const screenHeight = screen.height || 0;
|
|
364
|
+
const colorDepth = screen.colorDepth || 0;
|
|
365
|
+
// Get timezone
|
|
366
|
+
let timezone = 'UTC';
|
|
367
|
+
try {
|
|
368
|
+
timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
369
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
370
|
+
}
|
|
371
|
+
catch (e) {
|
|
372
|
+
// Ignore error, fallback to UTC
|
|
373
|
+
}
|
|
374
|
+
// Detect private browsing mode
|
|
375
|
+
let isPrivateBrowsing = false;
|
|
376
|
+
try {
|
|
377
|
+
// Simple localStorage test to detect private browsing
|
|
378
|
+
if (win === null || win === void 0 ? void 0 : win.localStorage) {
|
|
379
|
+
const testKey = 'test_private_browsing';
|
|
380
|
+
win.localStorage.setItem(testKey, '1');
|
|
381
|
+
win.localStorage.removeItem(testKey);
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
isPrivateBrowsing = true; // If localStorage is not available, likely private browsing
|
|
385
|
+
}
|
|
386
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
387
|
+
}
|
|
388
|
+
catch (e) {
|
|
389
|
+
isPrivateBrowsing = true; // Error during localStorage access indicates private browsing
|
|
390
|
+
}
|
|
391
|
+
// Create a stable fingerprint string using stable device/browser characteristics
|
|
392
|
+
const fingerprintString = `${platform}|${userAgent}|${language}|${screenWidth}|${screenHeight}|${colorDepth}|${timezone}|${isPrivateBrowsing ? 'private' : 'normal'}`;
|
|
393
|
+
// Simple but stable hash function
|
|
394
|
+
let hash = 0;
|
|
395
|
+
for (let i = 0; i < fingerprintString.length; i++) {
|
|
396
|
+
const char = fingerprintString.charCodeAt(i);
|
|
397
|
+
hash = (hash << 5) - hash + char;
|
|
398
|
+
hash = hash & hash; // Convert to 32-bit integer
|
|
399
|
+
}
|
|
346
400
|
const deviceMetadata = {
|
|
347
|
-
fingerprint: `UQ_${
|
|
401
|
+
fingerprint: `UQ_${Math.abs(hash).toString(36)}`,
|
|
348
402
|
deviceInfo: {
|
|
349
|
-
os: platform,
|
|
350
|
-
browser: userAgent,
|
|
403
|
+
os: platform.replace(/ /g, '_'),
|
|
404
|
+
browser: userAgent.replace(/ /g, '_'),
|
|
351
405
|
location: language,
|
|
352
406
|
},
|
|
353
407
|
};
|
package/dist/base/utils.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
type Types = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'similar_products_block' | 'product_block' | 'form' | 'common_page' | 'common_block' | 'order' | 'service' | 'none';
|
|
2
2
|
/**
|
|
3
|
-
* @param {string}
|
|
4
|
-
* @param {string}
|
|
5
|
-
* @param {boolean} [traficLimit]
|
|
6
|
-
* @param {boolean} [auth]
|
|
7
|
-
* @param {boolean} [auth.customAuth]
|
|
8
|
-
* @param {boolean} [auth.refreshToken] - Transfer the refresh token here, for example from the local storage, to resume the user's session. Otherwise, the user will need to log in every time a new session is created
|
|
9
|
-
* @param {boolean} [auth.
|
|
3
|
+
* @param {string} [token] - If your project is protected by a token, specify this token in this parameter.
|
|
4
|
+
* @param {string} [langCode] - specify the default language to avoid specifying it in every request.
|
|
5
|
+
* @param {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.
|
|
6
|
+
* @param {boolean} [auth] - An object with authorization settings.
|
|
7
|
+
* @param {boolean} [auth.customAuth] - Set this flag to true if you want to configure the authorization process yourself. Set the flag to false, or do not pass it at all to have automatic authorization and token renewal.
|
|
8
|
+
* @param {boolean} [auth.refreshToken] - Transfer the refresh token here, for example from the local storage, to resume the user's session. Otherwise, the user will need to log in every time a new session is created.
|
|
9
|
+
* @param {boolean} [auth.providerMarker] - The marker of the provider, for example, email, google, facebook, etc. Default 'email';
|
|
10
|
+
* @param {boolean} [auth.saveFunction] - If you want to store the token between sessions, for example in local storage, create a custom function that takes refreshToken as a parameter and executes the necessary instructions. This function will be called every time the tokens are updated.
|
|
10
11
|
* @example
|
|
12
|
+
* ```ts
|
|
11
13
|
* const saveToken = (token) => {
|
|
12
14
|
* localStorage.setItem('refresh', token)
|
|
13
15
|
* }
|
|
@@ -19,6 +21,7 @@ type Types = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'si
|
|
|
19
21
|
* auth: {
|
|
20
22
|
* customAuth: false,
|
|
21
23
|
* refreshToken: 'user.refresh.token',
|
|
24
|
+
* providerMarker: 'email',
|
|
22
25
|
* saveFunction: saveToken
|
|
23
26
|
* },
|
|
24
27
|
* errors: {
|
|
@@ -29,6 +32,7 @@ type Types = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'si
|
|
|
29
32
|
* }
|
|
30
33
|
* }
|
|
31
34
|
* }
|
|
35
|
+
* ```
|
|
32
36
|
*/
|
|
33
37
|
interface IConfig {
|
|
34
38
|
token?: string;
|
|
@@ -37,6 +41,7 @@ interface IConfig {
|
|
|
37
41
|
auth?: {
|
|
38
42
|
customAuth?: boolean;
|
|
39
43
|
refreshToken?: string;
|
|
44
|
+
providerMarker?: string;
|
|
40
45
|
saveFunction?: (refreshToken: string) => void;
|
|
41
46
|
};
|
|
42
47
|
errors?: {
|
|
@@ -52,14 +57,14 @@ interface IConfig {
|
|
|
52
57
|
}
|
|
53
58
|
/**
|
|
54
59
|
* @interface IAttributes
|
|
55
|
-
* @property {Array<object>}
|
|
56
|
-
* @property {ILocalizeInfo}
|
|
57
|
-
* @property {string}
|
|
58
|
-
* @property {number}
|
|
59
|
-
* @property {boolean}
|
|
60
|
-
* @property {string}
|
|
61
|
-
* @property {Record<string, any>} settings
|
|
62
|
-
* @property {Record<string, any>} validators
|
|
60
|
+
* @property {Array<object>} listTitles - List of titles.
|
|
61
|
+
* @property {ILocalizeInfo} localizeInfos - Localization information.
|
|
62
|
+
* @property {string} marker - Attribute marker.
|
|
63
|
+
* @property {number} position - Attribute position.
|
|
64
|
+
* @property {boolean} isVisible - Indicates whether the attribute is visible.
|
|
65
|
+
* @property {string} type - Attribute type.
|
|
66
|
+
* @property {Record<string, any>} settings - Additional settings for the attribute.
|
|
67
|
+
* @property {Record<string, any>} validators - Validators for the attribute.
|
|
63
68
|
* @property {Record<string, any>} additionalFields - Additional fields for the attribute.
|
|
64
69
|
* @description Interface for attributes.
|
|
65
70
|
*/
|
|
@@ -85,7 +90,7 @@ interface IAttributes {
|
|
|
85
90
|
}
|
|
86
91
|
/**
|
|
87
92
|
* @interface ILocalizeInfos
|
|
88
|
-
* @property {Record<string, ILocalizeInfo>} Localization information.
|
|
93
|
+
* @property {Record<string, ILocalizeInfo>} - Localization information.
|
|
89
94
|
* @description Interface for localization information.
|
|
90
95
|
*/
|
|
91
96
|
interface ILocalizeInfos {
|
|
@@ -93,7 +98,7 @@ interface ILocalizeInfos {
|
|
|
93
98
|
}
|
|
94
99
|
/**
|
|
95
100
|
* Interface for localization information.
|
|
96
|
-
* @property {Record<string, any>} Localization information.
|
|
101
|
+
* @property {Record<string, any>} - Localization information.
|
|
97
102
|
* @description Interface for localization information.
|
|
98
103
|
*/
|
|
99
104
|
interface ILocalizeInfo {
|
|
@@ -101,7 +106,7 @@ interface ILocalizeInfo {
|
|
|
101
106
|
}
|
|
102
107
|
/**
|
|
103
108
|
* @interface IAttributeValues
|
|
104
|
-
* @property {Record<string, IAttributeValue>} Attribute values.
|
|
109
|
+
* @property {Record<string, IAttributeValue>} - Attribute values.
|
|
105
110
|
* @description Interface for attribute values.
|
|
106
111
|
*/
|
|
107
112
|
interface IAttributeValues {
|
|
@@ -109,15 +114,21 @@ interface IAttributeValues {
|
|
|
109
114
|
}
|
|
110
115
|
/**
|
|
111
116
|
* @interface IAttributeValue
|
|
112
|
-
* @property {Record<string, any>} Attribute value.
|
|
117
|
+
* @property {Record<string, any>} - Attribute value.
|
|
113
118
|
* @description Interface for attribute value.
|
|
114
119
|
*/
|
|
115
120
|
interface IAttributeValue {
|
|
116
121
|
[key: string]: any;
|
|
117
122
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
123
|
+
/**
|
|
124
|
+
* @interface IError
|
|
125
|
+
* @property {string} message - Error message.
|
|
126
|
+
* @property {any} pageData - Page data.
|
|
127
|
+
* @property {number} statusCode - Status code.
|
|
128
|
+
* @property {string} timestamp - Timestamp.
|
|
129
|
+
* @property {Record<string, any>} - Attribute value.
|
|
130
|
+
* @description Interface for error.
|
|
131
|
+
*/
|
|
121
132
|
interface IError {
|
|
122
133
|
message: string;
|
|
123
134
|
pageData: any;
|
|
@@ -125,4 +136,16 @@ interface IError {
|
|
|
125
136
|
timestamp: string;
|
|
126
137
|
[key: string]: any;
|
|
127
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* AttributeType
|
|
141
|
+
*/
|
|
142
|
+
type AttributeType = IAttributeValue | IAttributeValues;
|
|
143
|
+
/**
|
|
144
|
+
* LangType
|
|
145
|
+
*/
|
|
146
|
+
type LangType = string | Array<string>;
|
|
147
|
+
/**
|
|
148
|
+
* LocalizeType
|
|
149
|
+
*/
|
|
150
|
+
type LocalizeType = ILocalizeInfos | ILocalizeInfo;
|
|
128
151
|
export type { AttributeType, IAttributes, IAttributeValues, IConfig, IError, ILocalizeInfo, ILocalizeInfos, LangType, LocalizeType, Types, };
|
|
@@ -14,17 +14,17 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
14
14
|
protected state: StateModule;
|
|
15
15
|
protected _url: string;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Constructor for BlocksApi class.
|
|
18
18
|
*/
|
|
19
19
|
constructor(state: StateModule);
|
|
20
20
|
/**
|
|
21
21
|
* Get blocks by parameters.
|
|
22
22
|
* @handleName getBlocks
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @returns {IBlocksResponse}
|
|
23
|
+
* @param {BlockType} type - Available values: "product" | "error_page" | "catalog_page" | "product_preview" | "similar_products_block" | "product_block" | "form" | "common_page" | "common_block" | "order" | "service" | "none". Example: 'product'.
|
|
24
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
25
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
26
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
27
|
+
* @returns {IBlocksResponse} Returns BlocksEntity object.
|
|
28
28
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
29
29
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
30
30
|
*/
|
|
@@ -32,11 +32,11 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
32
32
|
/**
|
|
33
33
|
* Get block by marker.
|
|
34
34
|
* @handleName getBlockByMarker
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
39
|
-
* @returns {IBlockEntity}
|
|
35
|
+
* @param {string} marker - Marker of Block. Example: "product_block".
|
|
36
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
37
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
38
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
39
|
+
* @returns {IBlockEntity} - Returns a BlockEntity object.
|
|
40
40
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
41
41
|
* @description This method retrieves a block by its marker and includes additional information such as similar products or products associated with the block.
|
|
42
42
|
*/
|
|
@@ -44,11 +44,11 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
44
44
|
/**
|
|
45
45
|
* Get similar products by block marker.
|
|
46
46
|
* @handleName getSimilarProducts
|
|
47
|
-
* @param
|
|
48
|
-
* @param
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
51
|
-
* @returns {IProductsResponse}
|
|
47
|
+
* @param {string} marker - Block identifier. Example: "similar_products_block".
|
|
48
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
49
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
50
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
51
|
+
* @returns {IProductsResponse} - Returns the total count and an array of product items in object by specified block marker.
|
|
52
52
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
53
53
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
54
54
|
*/
|
|
@@ -56,11 +56,11 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
56
56
|
/**
|
|
57
57
|
* Get products by block marker.
|
|
58
58
|
* @handleName getProductsByBlockMarker
|
|
59
|
-
* @param
|
|
60
|
-
* @param
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
63
|
-
* @returns {IProductsEntity[]}
|
|
59
|
+
* @param {string} marker - Block identifier. Example: "product_block".
|
|
60
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
61
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
62
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
63
|
+
* @returns {IProductsEntity[]} Return array of BlocksEntity object.
|
|
64
64
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
65
65
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
66
66
|
*/
|
|
@@ -68,9 +68,9 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
68
68
|
/**
|
|
69
69
|
* Quick search for block objects with limited output.
|
|
70
70
|
* @handleName searchBlock
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
73
|
-
* @returns {ISearchBlock[]}
|
|
71
|
+
* @param {string} name - Search string. Example: "product_block".
|
|
72
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
73
|
+
* @returns {ISearchBlock[]} Returns an array of ISearchBlock objects.
|
|
74
74
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
75
75
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
76
76
|
*/
|
package/dist/blocks/blocksApi.js
CHANGED
|
@@ -14,7 +14,7 @@ const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
|
14
14
|
*/
|
|
15
15
|
class BlocksApi extends asyncModules_1.default {
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Constructor for BlocksApi class.
|
|
18
18
|
*/
|
|
19
19
|
constructor(state) {
|
|
20
20
|
super(state);
|
|
@@ -23,11 +23,11 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
23
23
|
/**
|
|
24
24
|
* Get blocks by parameters.
|
|
25
25
|
* @handleName getBlocks
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @returns {IBlocksResponse}
|
|
26
|
+
* @param {BlockType} type - Available values: "product" | "error_page" | "catalog_page" | "product_preview" | "similar_products_block" | "product_block" | "form" | "common_page" | "common_block" | "order" | "service" | "none". Example: 'product'.
|
|
27
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
28
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
29
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
30
|
+
* @returns {IBlocksResponse} Returns BlocksEntity object.
|
|
31
31
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
32
32
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
33
33
|
*/
|
|
@@ -79,11 +79,11 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
79
79
|
/**
|
|
80
80
|
* Get block by marker.
|
|
81
81
|
* @handleName getBlockByMarker
|
|
82
|
-
* @param
|
|
83
|
-
* @param
|
|
84
|
-
* @param
|
|
85
|
-
* @param
|
|
86
|
-
* @returns {IBlockEntity}
|
|
82
|
+
* @param {string} marker - Marker of Block. Example: "product_block".
|
|
83
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
84
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
85
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
86
|
+
* @returns {IBlockEntity} - Returns a BlockEntity object.
|
|
87
87
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
88
88
|
* @description This method retrieves a block by its marker and includes additional information such as similar products or products associated with the block.
|
|
89
89
|
*/
|
|
@@ -129,11 +129,11 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
129
129
|
/**
|
|
130
130
|
* Get similar products by block marker.
|
|
131
131
|
* @handleName getSimilarProducts
|
|
132
|
-
* @param
|
|
133
|
-
* @param
|
|
134
|
-
* @param
|
|
135
|
-
* @param
|
|
136
|
-
* @returns {IProductsResponse}
|
|
132
|
+
* @param {string} marker - Block identifier. Example: "similar_products_block".
|
|
133
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
134
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
135
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
136
|
+
* @returns {IProductsResponse} - Returns the total count and an array of product items in object by specified block marker.
|
|
137
137
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
138
138
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
139
139
|
*/
|
|
@@ -149,11 +149,11 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
149
149
|
/**
|
|
150
150
|
* Get products by block marker.
|
|
151
151
|
* @handleName getProductsByBlockMarker
|
|
152
|
-
* @param
|
|
153
|
-
* @param
|
|
154
|
-
* @param
|
|
155
|
-
* @param
|
|
156
|
-
* @returns {IProductsEntity[]}
|
|
152
|
+
* @param {string} marker - Block identifier. Example: "product_block".
|
|
153
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
154
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
155
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
156
|
+
* @returns {IProductsEntity[]} Return array of BlocksEntity object.
|
|
157
157
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
158
158
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
159
159
|
*/
|
|
@@ -169,9 +169,9 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
169
169
|
/**
|
|
170
170
|
* Quick search for block objects with limited output.
|
|
171
171
|
* @handleName searchBlock
|
|
172
|
-
* @param
|
|
173
|
-
* @param
|
|
174
|
-
* @returns {ISearchBlock[]}
|
|
172
|
+
* @param {string} name - Search string. Example: "product_block".
|
|
173
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
174
|
+
* @returns {ISearchBlock[]} Returns an array of ISearchBlock objects.
|
|
175
175
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
176
176
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
177
177
|
*/
|