oneentry 1.0.126 → 1.0.127
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 +0 -2
- package/configure.js +25 -18
- package/dist/admins/adminsApi.d.ts +30 -25
- package/dist/admins/adminsApi.js +30 -25
- package/dist/admins/adminsInterfaces.d.ts +45 -54
- package/dist/attribute-sets/attributeSetsApi.d.ts +26 -27
- package/dist/attribute-sets/attributeSetsApi.js +26 -27
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +101 -109
- package/dist/auth-provider/authProviderApi.d.ts +132 -158
- package/dist/auth-provider/authProviderApi.js +131 -157
- package/dist/auth-provider/authProvidersInterfaces.d.ts +241 -237
- package/dist/base/asyncModules.d.ts +23 -21
- package/dist/base/asyncModules.js +30 -25
- package/dist/base/result.d.ts +31 -0
- package/dist/base/result.js +32 -1
- package/dist/base/stateModule.d.ts +10 -0
- package/dist/base/stateModule.js +50 -2
- package/dist/base/syncModules.d.ts +41 -49
- package/dist/base/syncModules.js +49 -48
- package/dist/base/utils.d.ts +38 -7
- package/dist/blocks/blocksApi.d.ts +27 -36
- package/dist/blocks/blocksApi.js +27 -36
- package/dist/blocks/blocksInterfaces.d.ts +92 -97
- package/dist/config.d.ts +13 -0
- package/dist/config.js +30 -0
- package/dist/events/eventsApi.d.ts +16 -33
- package/dist/events/eventsApi.js +32 -46
- package/dist/events/eventsInterfaces.d.ts +42 -37
- package/dist/file-uploading/fileUploadingApi.d.ts +42 -47
- package/dist/file-uploading/fileUploadingApi.js +44 -47
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +49 -60
- package/dist/forms/formsApi.d.ts +15 -14
- package/dist/forms/formsApi.js +15 -14
- package/dist/forms/formsInterfaces.d.ts +36 -40
- package/dist/forms-data/formsDataApi.d.ts +40 -44
- package/dist/forms-data/formsDataApi.js +42 -44
- package/dist/forms-data/formsDataInterfaces.d.ts +231 -231
- package/dist/general-types/generalTypesApi.d.ts +5 -5
- package/dist/general-types/generalTypesApi.js +5 -5
- package/dist/general-types/generalTypesInterfaces.d.ts +6 -9
- package/dist/index.d.ts +12 -13
- package/dist/index.js +12 -13
- package/dist/integration-collections/integrationCollectionsApi.d.ts +84 -98
- package/dist/integration-collections/integrationCollectionsApi.js +86 -102
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +177 -169
- package/dist/locales/localesApi.d.ts +7 -3
- package/dist/locales/localesApi.js +7 -3
- package/dist/locales/localesInterfaces.d.ts +14 -13
- package/dist/menus/menusApi.d.ts +9 -5
- package/dist/menus/menusApi.js +9 -5
- package/dist/menus/menusInterfaces.d.ts +43 -48
- package/dist/menus/menusInterfaces.js +1 -0
- package/dist/orders/ordersApi.d.ts +62 -70
- package/dist/orders/ordersApi.js +62 -71
- package/dist/orders/ordersInterfaces.d.ts +238 -203
- package/dist/pages/pagesApi.d.ts +67 -80
- package/dist/pages/pagesApi.js +71 -81
- package/dist/pages/pagesInterfaces.d.ts +164 -160
- package/dist/payments/paymentsApi.d.ts +24 -34
- package/dist/payments/paymentsApi.js +24 -38
- package/dist/payments/paymentsInterfaces.d.ts +82 -76
- package/dist/product-statuses/productStatusesApi.d.ts +13 -13
- package/dist/product-statuses/productStatusesApi.js +13 -13
- package/dist/product-statuses/productStatusesInterfaces.d.ts +29 -27
- package/dist/products/productsApi.d.ts +246 -267
- package/dist/products/productsApi.js +247 -267
- package/dist/products/productsInterfaces.d.ts +333 -339
- package/dist/system/systemApi.d.ts +19 -21
- package/dist/system/systemApi.js +20 -21
- package/dist/system/systemInterfaces.d.ts +14 -3
- package/dist/templates/templatesApi.d.ts +13 -16
- package/dist/templates/templatesApi.js +13 -16
- package/dist/templates/templatesInterfaces.d.ts +30 -29
- package/dist/templates-preview/templatesPreviewApi.d.ts +10 -11
- package/dist/templates-preview/templatesPreviewApi.js +10 -11
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +61 -64
- package/dist/users/usersApi.d.ts +36 -43
- package/dist/users/usersApi.js +36 -43
- package/dist/users/usersInterfaces.d.ts +92 -96
- package/dist/web-socket/wsApi.d.ts +5 -3
- package/dist/web-socket/wsApi.js +6 -3
- package/dist/web-socket/wsInterfaces.d.ts +7 -2
- package/package.json +16 -12
package/dist/base/syncModules.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
// Abstract class representing synchronization modules
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
4
7
|
class SyncModules {
|
|
5
8
|
// Constructor to initialize state and URL
|
|
6
9
|
constructor(state) {
|
|
7
10
|
/**
|
|
8
11
|
* Sorts attributes by their positions.
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
11
|
-
* @return Sorted attributes.
|
|
12
|
+
* @param {any} data - The data containing attributes.
|
|
13
|
+
* @returns {any} Sorted attributes.
|
|
12
14
|
*/
|
|
13
15
|
this._sortAttributes = (data) => Object.fromEntries(Object.entries(data).sort(([, a], [, b]) => a.position - b.position));
|
|
14
16
|
this.state = state;
|
|
@@ -16,18 +18,16 @@ class SyncModules {
|
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Constructs the full URL path by appending the given path to the base URL.
|
|
19
|
-
*
|
|
20
|
-
* @
|
|
21
|
-
* @return The full URL as a string.
|
|
21
|
+
* @param {string} path - The path to append to the base URL.
|
|
22
|
+
* @returns {string} The full URL as a string.
|
|
22
23
|
*/
|
|
23
24
|
_getFullPath(path) {
|
|
24
25
|
return this._url + path;
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
28
|
* Converts query parameters into a query string.
|
|
28
|
-
*
|
|
29
|
-
* @
|
|
30
|
-
* @return A string representation of the query parameters.
|
|
29
|
+
* @param {IProductsQuery | IUploadingQuery | any} query - The query object containing key-value pairs.
|
|
30
|
+
* @returns {string} A string representation of the query parameters.
|
|
31
31
|
*/
|
|
32
32
|
_queryParamsToString(query) {
|
|
33
33
|
let result = '';
|
|
@@ -40,10 +40,9 @@ class SyncModules {
|
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Normalizes data based on language code.
|
|
43
|
-
*
|
|
44
|
-
* @param
|
|
45
|
-
* @
|
|
46
|
-
* @return Normalized data.
|
|
43
|
+
* @param {any} data - The data to normalize.
|
|
44
|
+
* @param {string} langCode - The language code for normalization.
|
|
45
|
+
* @returns {any} Normalized data.
|
|
47
46
|
*/
|
|
48
47
|
_normalizeData(data, langCode = this.state.lang) {
|
|
49
48
|
if (Array.isArray(data)) {
|
|
@@ -73,10 +72,9 @@ class SyncModules {
|
|
|
73
72
|
}
|
|
74
73
|
/**
|
|
75
74
|
* Normalizes the body of a POST request.
|
|
76
|
-
*
|
|
77
|
-
* @param
|
|
78
|
-
* @
|
|
79
|
-
* @return Normalized body.
|
|
75
|
+
* @param {any} body - The body to normalize.
|
|
76
|
+
* @param {string} langCode - The language code for normalization.
|
|
77
|
+
* @returns {any} Normalized body.
|
|
80
78
|
*/
|
|
81
79
|
_normalizePostBody(body, langCode = this.state.lang) {
|
|
82
80
|
const formData = {};
|
|
@@ -88,9 +86,8 @@ class SyncModules {
|
|
|
88
86
|
}
|
|
89
87
|
/**
|
|
90
88
|
* Clears arrays within the data structure.
|
|
91
|
-
*
|
|
92
|
-
* @
|
|
93
|
-
* @return Cleared data.
|
|
89
|
+
* @param {Record<string, any>} data - The data to clear.
|
|
90
|
+
* @returns {any} Cleared data.
|
|
94
91
|
*/
|
|
95
92
|
_clearArray(data) {
|
|
96
93
|
if (Array.isArray(data)) {
|
|
@@ -127,10 +124,9 @@ class SyncModules {
|
|
|
127
124
|
}
|
|
128
125
|
/**
|
|
129
126
|
* Adds a specified number of days to a date.
|
|
130
|
-
*
|
|
131
|
-
* @param
|
|
132
|
-
* @
|
|
133
|
-
* @return The new date with added days.
|
|
127
|
+
* @param {Date} date - The initial date.
|
|
128
|
+
* @param {number} days - The number of days to add.
|
|
129
|
+
* @returns {any} The new date with added days.
|
|
134
130
|
*/
|
|
135
131
|
_addDays(date, days) {
|
|
136
132
|
const result = new Date(date);
|
|
@@ -139,10 +135,12 @@ class SyncModules {
|
|
|
139
135
|
}
|
|
140
136
|
/**
|
|
141
137
|
* Generates intervals for a specific date based on a schedule.
|
|
142
|
-
*
|
|
143
|
-
* @param
|
|
144
|
-
* @param schedule
|
|
145
|
-
* @param
|
|
138
|
+
* @param {Date} date - The date for which to generate intervals.
|
|
139
|
+
* @param {object} schedule - The schedule defining the intervals.
|
|
140
|
+
* @param {boolean} schedule.inEveryWeek - The number of weeks between intervals.
|
|
141
|
+
* @param {any[]} schedule.times - The times for each interval.
|
|
142
|
+
* @param {boolean} schedule.inEveryMonth - The month intervals for each interval.
|
|
143
|
+
* @param {Set<Array<string>>} utcIntervals - A set to store unique intervals.
|
|
146
144
|
*/
|
|
147
145
|
_generateIntervalsForDate(date, schedule, utcIntervals) {
|
|
148
146
|
// Handle weekly schedules
|
|
@@ -227,9 +225,8 @@ class SyncModules {
|
|
|
227
225
|
}
|
|
228
226
|
/**
|
|
229
227
|
* Adds time intervals to schedules.
|
|
230
|
-
*
|
|
231
|
-
* @
|
|
232
|
-
* @return Schedules with added time intervals.
|
|
228
|
+
* @param {any[]} schedules - The schedules to process.
|
|
229
|
+
* @returns {any} Schedules with added time intervals.
|
|
233
230
|
*/
|
|
234
231
|
_addTimeIntervalsToSchedules(schedules) {
|
|
235
232
|
schedules.forEach((scheduleGroup) => {
|
|
@@ -253,9 +250,8 @@ class SyncModules {
|
|
|
253
250
|
}
|
|
254
251
|
/**
|
|
255
252
|
* Normalizes attributes within the data.
|
|
256
|
-
*
|
|
257
|
-
* @
|
|
258
|
-
* @return Normalized attributes.
|
|
253
|
+
* @param {any} data - The data to normalize.
|
|
254
|
+
* @returns {any} Normalized attributes.
|
|
259
255
|
*/
|
|
260
256
|
_normalizeAttr(data) {
|
|
261
257
|
// For regular attributes
|
|
@@ -305,10 +301,9 @@ class SyncModules {
|
|
|
305
301
|
}
|
|
306
302
|
/**
|
|
307
303
|
* Processes data after fetching or receiving it.
|
|
308
|
-
*
|
|
309
|
-
* @param
|
|
310
|
-
* @
|
|
311
|
-
* @return Processed data.
|
|
304
|
+
* @param {any} data - The data to process.
|
|
305
|
+
* @param {any} langCode - The language code for processing.
|
|
306
|
+
* @returns {any} Processed data.
|
|
312
307
|
*/
|
|
313
308
|
_dataPostProcess(data, langCode = this.state.lang) {
|
|
314
309
|
const normalize = this._normalizeData(data, langCode);
|
|
@@ -317,9 +312,8 @@ class SyncModules {
|
|
|
317
312
|
}
|
|
318
313
|
/**
|
|
319
314
|
* Sets the access token in the state.
|
|
320
|
-
*
|
|
321
|
-
* @
|
|
322
|
-
* @return The instance of SyncModules for chaining.
|
|
315
|
+
* @param {string} accessToken - The access token to set.
|
|
316
|
+
* @returns {any} The instance of SyncModules for chaining.
|
|
323
317
|
*/
|
|
324
318
|
setAccessToken(accessToken) {
|
|
325
319
|
this.state.accessToken = accessToken;
|
|
@@ -327,9 +321,8 @@ class SyncModules {
|
|
|
327
321
|
}
|
|
328
322
|
/**
|
|
329
323
|
* Sets the refresh token in the state.
|
|
330
|
-
*
|
|
331
|
-
* @
|
|
332
|
-
* @return The instance of SyncModules for chaining.
|
|
324
|
+
* @param {any} refreshToken - The refresh token to set.
|
|
325
|
+
* @returns {any} The instance of SyncModules for chaining.
|
|
333
326
|
*/
|
|
334
327
|
setRefreshToken(refreshToken) {
|
|
335
328
|
this.state.refreshToken = refreshToken;
|
|
@@ -337,13 +330,21 @@ class SyncModules {
|
|
|
337
330
|
}
|
|
338
331
|
/**
|
|
339
332
|
* Get deviceMetadata
|
|
333
|
+
* @returns {string} - Returns an object containing device metadata.
|
|
340
334
|
*/
|
|
341
335
|
_getDeviceMetadata() {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
336
|
+
// Check if we're in a browser environment
|
|
337
|
+
if (typeof globalThis === 'undefined') {
|
|
338
|
+
return '';
|
|
339
|
+
}
|
|
340
|
+
// Access navigator through globalThis.window object to avoid direct reference
|
|
341
|
+
const win = globalThis.window;
|
|
342
|
+
const nav = (win === null || win === void 0 ? void 0 : win.navigator) || {};
|
|
343
|
+
const platform = nav.platform || 'Win32';
|
|
344
|
+
const userAgent = nav.userAgent || 'Node.js/22';
|
|
345
|
+
const language = nav.language || 'en-US';
|
|
345
346
|
const deviceMetadata = {
|
|
346
|
-
fingerprint:
|
|
347
|
+
fingerprint: `UQ_${platform}_${userAgent}_${language}`,
|
|
347
348
|
deviceInfo: {
|
|
348
349
|
os: platform,
|
|
349
350
|
browser: userAgent,
|
package/dist/base/utils.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
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]
|
|
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
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
9
|
* @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
10
|
* @example
|
|
12
11
|
* const saveToken = (token) => {
|
|
13
12
|
* localStorage.setItem('refresh', token)
|
|
@@ -30,7 +29,6 @@ type Types = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'si
|
|
|
30
29
|
* }
|
|
31
30
|
* }
|
|
32
31
|
* }
|
|
33
|
-
*
|
|
34
32
|
*/
|
|
35
33
|
interface IConfig {
|
|
36
34
|
token?: string;
|
|
@@ -52,6 +50,19 @@ interface IConfig {
|
|
|
52
50
|
};
|
|
53
51
|
};
|
|
54
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* @interface IAttributes
|
|
55
|
+
* @property {Array<object>} listTitles - List of titles.
|
|
56
|
+
* @property {ILocalizeInfo} localizeInfos - Localization information.
|
|
57
|
+
* @property {string} marker - Attribute marker.
|
|
58
|
+
* @property {number} position - Attribute position.
|
|
59
|
+
* @property {boolean} isVisible - Indicates whether the attribute is visible.
|
|
60
|
+
* @property {string} type - Attribute type.
|
|
61
|
+
* @property {Record<string, any>} settings - Additional settings for the attribute.
|
|
62
|
+
* @property {Record<string, any>} validators - Validators for the attribute.
|
|
63
|
+
* @property {Record<string, any>} additionalFields - Additional fields for the attribute.
|
|
64
|
+
* @description Interface for attributes.
|
|
65
|
+
*/
|
|
55
66
|
interface IAttributes {
|
|
56
67
|
listTitles: Array<{
|
|
57
68
|
title: string;
|
|
@@ -72,15 +83,35 @@ interface IAttributes {
|
|
|
72
83
|
additionalFields?: any;
|
|
73
84
|
[key: string]: any;
|
|
74
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* @interface ILocalizeInfos
|
|
88
|
+
* @property {Record<string, ILocalizeInfo>} Localization information.
|
|
89
|
+
* @description Interface for localization information.
|
|
90
|
+
*/
|
|
75
91
|
interface ILocalizeInfos {
|
|
76
92
|
[key: string]: ILocalizeInfo;
|
|
77
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Interface for localization information.
|
|
96
|
+
* @property {Record<string, any>} Localization information.
|
|
97
|
+
* @description Interface for localization information.
|
|
98
|
+
*/
|
|
78
99
|
interface ILocalizeInfo {
|
|
79
100
|
[key: string]: any;
|
|
80
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* @interface IAttributeValues
|
|
104
|
+
* @property {Record<string, IAttributeValue>} Attribute values.
|
|
105
|
+
* @description Interface for attribute values.
|
|
106
|
+
*/
|
|
81
107
|
interface IAttributeValues {
|
|
82
108
|
[key: string]: IAttributeValue;
|
|
83
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* @interface IAttributeValue
|
|
112
|
+
* @property {Record<string, any>} Attribute value.
|
|
113
|
+
* @description Interface for attribute value.
|
|
114
|
+
*/
|
|
84
115
|
interface IAttributeValue {
|
|
85
116
|
[key: string]: any;
|
|
86
117
|
}
|
|
@@ -4,82 +4,73 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { BlockType, IBlockEntity, IBlocks, IBlocksResponse, ISearchBlock } from './blocksInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with blocks.
|
|
7
|
-
*
|
|
8
7
|
* @handle /api/content/blocks
|
|
9
8
|
* @class BlocksApi
|
|
10
|
-
* @
|
|
9
|
+
* @augments AsyncModules
|
|
11
10
|
* @implements {IBlocks}
|
|
12
|
-
*
|
|
13
11
|
* @description This class provides methods to interact with blocks.
|
|
14
12
|
*/
|
|
15
13
|
export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
16
14
|
protected state: StateModule;
|
|
17
15
|
protected _url: string;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
18
19
|
constructor(state: StateModule);
|
|
19
20
|
/**
|
|
20
21
|
* Get blocks by parameters.
|
|
21
|
-
*
|
|
22
22
|
* @handleName getBlocks
|
|
23
|
-
*
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @
|
|
28
|
-
* @return {IBlocksResponse} Returns BlocksEntity object.
|
|
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.
|
|
29
28
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
30
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.
|
|
31
30
|
*/
|
|
32
31
|
getBlocks(type?: BlockType, langCode?: string, offset?: number, limit?: number): Promise<IBlocksResponse | IError>;
|
|
33
32
|
/**
|
|
34
33
|
* Get block by marker.
|
|
35
|
-
*
|
|
36
34
|
* @handleName getBlockByMarker
|
|
37
|
-
*
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
40
|
-
* @param
|
|
41
|
-
* @
|
|
42
|
-
* @return {IBlockEntity} - Returns a BlockEntity object.
|
|
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.
|
|
43
40
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
44
41
|
* @description This method retrieves a block by its marker and includes additional information such as similar products or products associated with the block.
|
|
45
42
|
*/
|
|
46
43
|
getBlockByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IBlockEntity | IError>;
|
|
47
44
|
/**
|
|
48
45
|
* Get similar products by block marker.
|
|
49
|
-
*
|
|
50
46
|
* @handleName getSimilarProducts
|
|
51
|
-
*
|
|
52
|
-
* @param
|
|
53
|
-
* @param
|
|
54
|
-
* @param
|
|
55
|
-
* @
|
|
56
|
-
* @return {IProductsResponse} - Returns the total count and an array of product items in object by specified block marker.
|
|
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.
|
|
57
52
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
58
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.
|
|
59
54
|
*/
|
|
60
55
|
private getSimilarProducts;
|
|
61
56
|
/**
|
|
62
57
|
* Get products by block marker.
|
|
63
|
-
*
|
|
64
58
|
* @handleName getProductsByBlockMarker
|
|
65
|
-
*
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
68
|
-
* @param
|
|
69
|
-
* @
|
|
70
|
-
* @return {IProductsEntity[]} Return array of BlocksEntity object.
|
|
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.
|
|
71
64
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
72
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.
|
|
73
66
|
*/
|
|
74
67
|
private getProductsByBlockMarker;
|
|
75
68
|
/**
|
|
76
69
|
* Quick search for block objects with limited output.
|
|
77
|
-
*
|
|
78
70
|
* @handleName searchBlock
|
|
79
|
-
*
|
|
80
|
-
* @param
|
|
81
|
-
* @
|
|
82
|
-
* @return {ISearchBlock[]} Returns an array of ISearchBlock objects.
|
|
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.
|
|
83
74
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
84
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.
|
|
85
76
|
*/
|
package/dist/blocks/blocksApi.js
CHANGED
|
@@ -6,29 +6,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for working with blocks.
|
|
9
|
-
*
|
|
10
9
|
* @handle /api/content/blocks
|
|
11
10
|
* @class BlocksApi
|
|
12
|
-
* @
|
|
11
|
+
* @augments AsyncModules
|
|
13
12
|
* @implements {IBlocks}
|
|
14
|
-
*
|
|
15
13
|
* @description This class provides methods to interact with blocks.
|
|
16
14
|
*/
|
|
17
15
|
class BlocksApi extends asyncModules_1.default {
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
18
19
|
constructor(state) {
|
|
19
20
|
super(state);
|
|
20
21
|
this._url = state.url + '/api/content/blocks';
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* Get blocks by parameters.
|
|
24
|
-
*
|
|
25
25
|
* @handleName getBlocks
|
|
26
|
-
*
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @
|
|
31
|
-
* @return {IBlocksResponse} Returns BlocksEntity object.
|
|
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.
|
|
32
31
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
33
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.
|
|
34
33
|
*/
|
|
@@ -79,14 +78,12 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
79
78
|
}
|
|
80
79
|
/**
|
|
81
80
|
* Get block by marker.
|
|
82
|
-
*
|
|
83
81
|
* @handleName getBlockByMarker
|
|
84
|
-
*
|
|
85
|
-
* @param
|
|
86
|
-
* @param
|
|
87
|
-
* @param
|
|
88
|
-
* @
|
|
89
|
-
* @return {IBlockEntity} - Returns a BlockEntity object.
|
|
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.
|
|
90
87
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
91
88
|
* @description This method retrieves a block by its marker and includes additional information such as similar products or products associated with the block.
|
|
92
89
|
*/
|
|
@@ -131,14 +128,12 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
131
128
|
}
|
|
132
129
|
/**
|
|
133
130
|
* Get similar products by block marker.
|
|
134
|
-
*
|
|
135
131
|
* @handleName getSimilarProducts
|
|
136
|
-
*
|
|
137
|
-
* @param
|
|
138
|
-
* @param
|
|
139
|
-
* @param
|
|
140
|
-
* @
|
|
141
|
-
* @return {IProductsResponse} - Returns the total count and an array of product items in object by specified block marker.
|
|
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.
|
|
142
137
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
143
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.
|
|
144
139
|
*/
|
|
@@ -153,14 +148,12 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
153
148
|
}
|
|
154
149
|
/**
|
|
155
150
|
* Get products by block marker.
|
|
156
|
-
*
|
|
157
151
|
* @handleName getProductsByBlockMarker
|
|
158
|
-
*
|
|
159
|
-
* @param
|
|
160
|
-
* @param
|
|
161
|
-
* @param
|
|
162
|
-
* @
|
|
163
|
-
* @return {IProductsEntity[]} Return array of BlocksEntity object.
|
|
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.
|
|
164
157
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
165
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.
|
|
166
159
|
*/
|
|
@@ -175,12 +168,10 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
175
168
|
}
|
|
176
169
|
/**
|
|
177
170
|
* Quick search for block objects with limited output.
|
|
178
|
-
*
|
|
179
171
|
* @handleName searchBlock
|
|
180
|
-
*
|
|
181
|
-
* @param
|
|
182
|
-
* @
|
|
183
|
-
* @return {ISearchBlock[]} Returns an array of ISearchBlock objects.
|
|
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.
|
|
184
175
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
185
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.
|
|
186
177
|
*/
|