oneentry 1.0.122 → 1.0.124
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 +16 -8
- package/dist/admins/adminsApi.js +18 -10
- package/dist/admins/adminsInterfaces.d.ts +49 -25
- package/dist/attribute-sets/attributeSetsApi.d.ts +43 -21
- package/dist/attribute-sets/attributeSetsApi.js +49 -25
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +70 -24
- package/dist/auth-provider/authProviderApi.d.ts +94 -83
- package/dist/auth-provider/authProviderApi.js +96 -83
- package/dist/auth-provider/authProvidersInterfaces.d.ts +188 -10
- package/dist/base/asyncModules.d.ts +32 -28
- package/dist/base/asyncModules.js +62 -38
- package/dist/base/syncModules.d.ts +44 -44
- package/dist/base/syncModules.js +65 -63
- package/dist/blocks/blocksApi.d.ts +56 -25
- package/dist/blocks/blocksApi.js +56 -25
- package/dist/blocks/blocksInterfaces.d.ts +71 -22
- package/dist/events/eventsApi.d.ts +45 -11
- package/dist/events/eventsApi.js +47 -17
- package/dist/events/eventsInterfaces.d.ts +44 -2
- package/dist/file-uploading/fileUploadingApi.d.ts +44 -24
- package/dist/file-uploading/fileUploadingApi.js +46 -27
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +63 -14
- package/dist/forms/formsApi.d.ts +23 -8
- package/dist/forms/formsApi.js +23 -8
- package/dist/forms/formsInterfaces.d.ts +62 -15
- package/dist/formsData/formsDataApi.d.ts +33 -33
- package/dist/formsData/formsDataApi.js +33 -33
- package/dist/formsData/formsDataInterfaces.d.ts +123 -35
- package/dist/general-types/generalTypesApi.d.ts +12 -1
- package/dist/general-types/generalTypesApi.js +12 -1
- package/dist/general-types/generalTypesInterfaces.d.ts +18 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/integration-collections/integrationCollectionsApi.d.ts +96 -70
- package/dist/integration-collections/integrationCollectionsApi.js +114 -81
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +152 -30
- package/dist/locales/localesApi.d.ts +6 -1
- package/dist/locales/localesApi.js +6 -1
- package/dist/locales/localesInterfaces.d.ts +20 -11
- package/dist/menus/menusApi.d.ts +8 -3
- package/dist/menus/menusApi.js +8 -3
- package/dist/menus/menusInterfaces.d.ts +30 -17
- package/dist/orders/ordersApi.d.ts +64 -64
- package/dist/orders/ordersApi.js +67 -65
- package/dist/orders/ordersInterfaces.d.ts +174 -60
- package/dist/pages/pagesApi.d.ts +89 -30
- package/dist/pages/pagesApi.js +181 -57
- package/dist/pages/pagesInterfaces.d.ts +117 -23
- package/dist/payments/paymentsApi.d.ts +56 -22
- package/dist/payments/paymentsApi.js +56 -22
- package/dist/payments/paymentsInterfaces.d.ts +119 -36
- package/dist/product-statuses/productStatusesApi.d.ts +21 -15
- package/dist/product-statuses/productStatusesApi.js +21 -18
- package/dist/product-statuses/productStatusesInterfaces.d.ts +37 -9
- package/dist/products/productsApi.d.ts +137 -157
- package/dist/products/productsApi.js +137 -157
- package/dist/products/productsInterfaces.d.ts +240 -57
- package/dist/system/systemApi.d.ts +29 -10
- package/dist/system/systemApi.js +29 -10
- package/dist/system/systemInterfaces.d.ts +8 -0
- package/dist/templates/templatesApi.d.ts +26 -16
- package/dist/templates/templatesApi.js +26 -19
- package/dist/templates/templatesInterfaces.d.ts +40 -14
- package/dist/templates-preview/templatesPreviewApi.d.ts +18 -14
- package/dist/templates-preview/templatesPreviewApi.js +18 -17
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +57 -29
- package/dist/users/usersApi.d.ts +37 -33
- package/dist/users/usersApi.js +37 -33
- package/dist/users/usersInterfaces.d.ts +80 -9
- package/dist/web-socket/wsApi.d.ts +6 -3
- package/dist/web-socket/wsApi.js +6 -3
- package/dist/web-socket/wsInterfaces.d.ts +3 -1
- package/package.json +11 -11
|
@@ -6,65 +6,65 @@ export default abstract class SyncModules {
|
|
|
6
6
|
protected _url: string;
|
|
7
7
|
protected constructor(state: StateModule);
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Constructs the full URL path by appending the given path to the base URL.
|
|
10
10
|
*
|
|
11
|
-
* @param path
|
|
12
|
-
* @
|
|
11
|
+
* @param path - The path to append to the base URL.
|
|
12
|
+
* @return The full URL as a string.
|
|
13
13
|
*/
|
|
14
14
|
protected _getFullPath(path: string): string;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Converts query parameters into a query string.
|
|
17
17
|
*
|
|
18
|
-
* @param query
|
|
19
|
-
* @
|
|
18
|
+
* @param query - The query object containing key-value pairs.
|
|
19
|
+
* @return A string representation of the query parameters.
|
|
20
20
|
*/
|
|
21
21
|
protected _queryParamsToString(query: IProductsQuery | IUploadingQuery | any): string;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Normalizes data based on language code.
|
|
24
24
|
*
|
|
25
|
-
* @param data
|
|
26
|
-
* @param langCode
|
|
27
|
-
* @
|
|
25
|
+
* @param data - The data to normalize.
|
|
26
|
+
* @param langCode - The language code for normalization.
|
|
27
|
+
* @return Normalized data.
|
|
28
28
|
*/
|
|
29
29
|
protected _normalizeData(data: any, langCode?: string): any;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Normalizes the body of a POST request.
|
|
32
32
|
*
|
|
33
|
-
* @param body
|
|
34
|
-
* @param langCode
|
|
35
|
-
* @
|
|
33
|
+
* @param body - The body to normalize.
|
|
34
|
+
* @param langCode - The language code for normalization.
|
|
35
|
+
* @return Normalized body.
|
|
36
36
|
*/
|
|
37
37
|
protected _normalizePostBody(body: any, langCode?: string): any;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Clears arrays within the data structure.
|
|
40
40
|
*
|
|
41
|
-
* @param data
|
|
42
|
-
* @
|
|
41
|
+
* @param data - The data to clear.
|
|
42
|
+
* @return Cleared data.
|
|
43
43
|
*/
|
|
44
44
|
protected _clearArray(data: Record<string, any>): any;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* Sorts attributes by their positions.
|
|
47
47
|
*
|
|
48
|
-
* @param data
|
|
49
|
-
* @
|
|
48
|
+
* @param data - The data containing attributes.
|
|
49
|
+
* @return Sorted attributes.
|
|
50
50
|
*/
|
|
51
51
|
protected _sortAttributes: (data: any) => {
|
|
52
52
|
[k: string]: unknown;
|
|
53
53
|
};
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* Adds a specified number of days to a date.
|
|
56
56
|
*
|
|
57
|
-
* @param date
|
|
58
|
-
* @param days
|
|
59
|
-
* @
|
|
57
|
+
* @param date - The initial date.
|
|
58
|
+
* @param days - The number of days to add.
|
|
59
|
+
* @return The new date with added days.
|
|
60
60
|
*/
|
|
61
61
|
protected _addDays(date: Date, days: number): Date;
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* Generates intervals for a specific date based on a schedule.
|
|
64
64
|
*
|
|
65
|
-
* @param date
|
|
66
|
-
* @param schedule
|
|
67
|
-
* @param utcIntervals
|
|
65
|
+
* @param date - The date for which to generate intervals.
|
|
66
|
+
* @param schedule - The schedule defining the intervals.
|
|
67
|
+
* @param utcIntervals - A set to store unique intervals.
|
|
68
68
|
*/
|
|
69
69
|
protected _generateIntervalsForDate(date: Date, schedule: {
|
|
70
70
|
inEveryWeek: boolean;
|
|
@@ -72,39 +72,39 @@ export default abstract class SyncModules {
|
|
|
72
72
|
inEveryMonth: boolean;
|
|
73
73
|
}, utcIntervals: Set<Array<string>>): void;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* Adds time intervals to schedules.
|
|
76
76
|
*
|
|
77
|
-
* @param schedules
|
|
78
|
-
* @
|
|
77
|
+
* @param schedules - The schedules to process.
|
|
78
|
+
* @return Schedules with added time intervals.
|
|
79
79
|
*/
|
|
80
80
|
_addTimeIntervalsToSchedules(schedules: any[]): any[];
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
82
|
+
* Normalizes attributes within the data.
|
|
83
83
|
*
|
|
84
|
-
* @param data
|
|
85
|
-
* @
|
|
84
|
+
* @param data - The data to normalize.
|
|
85
|
+
* @return Normalized attributes.
|
|
86
86
|
*/
|
|
87
87
|
protected _normalizeAttr(data: any): any;
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* Processes data after fetching or receiving it.
|
|
90
90
|
*
|
|
91
|
-
* @param data
|
|
92
|
-
* @param langCode
|
|
93
|
-
* @
|
|
91
|
+
* @param data - The data to process.
|
|
92
|
+
* @param langCode - The language code for processing.
|
|
93
|
+
* @return Processed data.
|
|
94
94
|
*/
|
|
95
95
|
protected _dataPostProcess(data: any, langCode?: string): any;
|
|
96
96
|
/**
|
|
97
|
-
*
|
|
97
|
+
* Sets the access token in the state.
|
|
98
98
|
*
|
|
99
|
-
* @param accessToken
|
|
100
|
-
* @
|
|
99
|
+
* @param accessToken - The access token to set.
|
|
100
|
+
* @return The instance of SyncModules for chaining.
|
|
101
101
|
*/
|
|
102
102
|
setAccessToken(accessToken: string): this;
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
104
|
+
* Sets the refresh token in the state.
|
|
105
105
|
*
|
|
106
|
-
* @param refreshToken
|
|
107
|
-
* @
|
|
106
|
+
* @param refreshToken - The refresh token to set.
|
|
107
|
+
* @return The instance of SyncModules for chaining.
|
|
108
108
|
*/
|
|
109
109
|
setRefreshToken(refreshToken: string): this;
|
|
110
110
|
}
|
package/dist/base/syncModules.js
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// Abstract class representing synchronization modules
|
|
3
4
|
class SyncModules {
|
|
5
|
+
// Constructor to initialize state and URL
|
|
4
6
|
constructor(state) {
|
|
5
7
|
/**
|
|
6
|
-
*
|
|
8
|
+
* Sorts attributes by their positions.
|
|
7
9
|
*
|
|
8
|
-
* @param data
|
|
9
|
-
* @
|
|
10
|
+
* @param data - The data containing attributes.
|
|
11
|
+
* @return Sorted attributes.
|
|
10
12
|
*/
|
|
11
13
|
this._sortAttributes = (data) => Object.fromEntries(Object.entries(data).sort(([, a], [, b]) => a.position - b.position));
|
|
12
14
|
this.state = state;
|
|
13
15
|
this._url = state.url;
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
|
-
*
|
|
18
|
+
* Constructs the full URL path by appending the given path to the base URL.
|
|
17
19
|
*
|
|
18
|
-
* @param path
|
|
19
|
-
* @
|
|
20
|
+
* @param path - The path to append to the base URL.
|
|
21
|
+
* @return The full URL as a string.
|
|
20
22
|
*/
|
|
21
23
|
_getFullPath(path) {
|
|
22
24
|
return this._url + path;
|
|
23
25
|
}
|
|
24
26
|
/**
|
|
25
|
-
*
|
|
27
|
+
* Converts query parameters into a query string.
|
|
26
28
|
*
|
|
27
|
-
* @param query
|
|
28
|
-
* @
|
|
29
|
+
* @param query - The query object containing key-value pairs.
|
|
30
|
+
* @return A string representation of the query parameters.
|
|
29
31
|
*/
|
|
30
32
|
_queryParamsToString(query) {
|
|
31
33
|
let result = '';
|
|
@@ -37,11 +39,11 @@ class SyncModules {
|
|
|
37
39
|
return result.slice(0, result.length - 1);
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
40
|
-
*
|
|
42
|
+
* Normalizes data based on language code.
|
|
41
43
|
*
|
|
42
|
-
* @param data
|
|
43
|
-
* @param langCode
|
|
44
|
-
* @
|
|
44
|
+
* @param data - The data to normalize.
|
|
45
|
+
* @param langCode - The language code for normalization.
|
|
46
|
+
* @return Normalized data.
|
|
45
47
|
*/
|
|
46
48
|
_normalizeData(data, langCode = this.state.lang) {
|
|
47
49
|
if (Array.isArray(data)) {
|
|
@@ -70,11 +72,11 @@ class SyncModules {
|
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
74
|
/**
|
|
73
|
-
*
|
|
75
|
+
* Normalizes the body of a POST request.
|
|
74
76
|
*
|
|
75
|
-
* @param body
|
|
76
|
-
* @param langCode
|
|
77
|
-
* @
|
|
77
|
+
* @param body - The body to normalize.
|
|
78
|
+
* @param langCode - The language code for normalization.
|
|
79
|
+
* @return Normalized body.
|
|
78
80
|
*/
|
|
79
81
|
_normalizePostBody(body, langCode = this.state.lang) {
|
|
80
82
|
const formData = {};
|
|
@@ -85,10 +87,10 @@ class SyncModules {
|
|
|
85
87
|
return body;
|
|
86
88
|
}
|
|
87
89
|
/**
|
|
88
|
-
*
|
|
90
|
+
* Clears arrays within the data structure.
|
|
89
91
|
*
|
|
90
|
-
* @param data
|
|
91
|
-
* @
|
|
92
|
+
* @param data - The data to clear.
|
|
93
|
+
* @return Cleared data.
|
|
92
94
|
*/
|
|
93
95
|
_clearArray(data) {
|
|
94
96
|
if (Array.isArray(data)) {
|
|
@@ -124,11 +126,11 @@ class SyncModules {
|
|
|
124
126
|
}
|
|
125
127
|
}
|
|
126
128
|
/**
|
|
127
|
-
*
|
|
129
|
+
* Adds a specified number of days to a date.
|
|
128
130
|
*
|
|
129
|
-
* @param date
|
|
130
|
-
* @param days
|
|
131
|
-
* @
|
|
131
|
+
* @param date - The initial date.
|
|
132
|
+
* @param days - The number of days to add.
|
|
133
|
+
* @return The new date with added days.
|
|
132
134
|
*/
|
|
133
135
|
_addDays(date, days) {
|
|
134
136
|
const result = new Date(date);
|
|
@@ -136,17 +138,17 @@ class SyncModules {
|
|
|
136
138
|
return result;
|
|
137
139
|
}
|
|
138
140
|
/**
|
|
139
|
-
*
|
|
141
|
+
* Generates intervals for a specific date based on a schedule.
|
|
140
142
|
*
|
|
141
|
-
* @param date
|
|
142
|
-
* @param schedule
|
|
143
|
-
* @param utcIntervals
|
|
143
|
+
* @param date - The date for which to generate intervals.
|
|
144
|
+
* @param schedule - The schedule defining the intervals.
|
|
145
|
+
* @param utcIntervals - A set to store unique intervals.
|
|
144
146
|
*/
|
|
145
147
|
_generateIntervalsForDate(date, schedule, utcIntervals) {
|
|
146
|
-
//
|
|
148
|
+
// Handle weekly schedules
|
|
147
149
|
if (schedule.inEveryWeek && !schedule.inEveryMonth) {
|
|
148
150
|
let currentDate = new Date(date);
|
|
149
|
-
//
|
|
151
|
+
// Calculate the last day of the current month
|
|
150
152
|
const endOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);
|
|
151
153
|
while (currentDate <= endOfMonth) {
|
|
152
154
|
schedule.times.forEach((timeRange) => {
|
|
@@ -155,16 +157,16 @@ class SyncModules {
|
|
|
155
157
|
intervalStart.setUTCHours(startTime.hours, startTime.minutes, 0, 0);
|
|
156
158
|
const intervalEnd = new Date(currentDate);
|
|
157
159
|
intervalEnd.setUTCHours(endTime.hours, endTime.minutes, 0, 0);
|
|
158
|
-
//
|
|
160
|
+
// Add JSON string to Set for uniqueness
|
|
159
161
|
utcIntervals.add([
|
|
160
162
|
intervalStart.toISOString(),
|
|
161
163
|
intervalEnd.toISOString(),
|
|
162
164
|
]);
|
|
163
165
|
});
|
|
164
|
-
currentDate = this._addDays(currentDate, 7); //
|
|
166
|
+
currentDate = this._addDays(currentDate, 7); // Move to the next week
|
|
165
167
|
}
|
|
166
168
|
}
|
|
167
|
-
//
|
|
169
|
+
// Handle monthly schedules
|
|
168
170
|
if (schedule.inEveryMonth && !schedule.inEveryWeek) {
|
|
169
171
|
const startDate = new Date(date); // Начальная дата
|
|
170
172
|
const targetDayOfMonth = startDate.getUTCDate(); // Определяем день месяца начальной даты
|
|
@@ -172,11 +174,11 @@ class SyncModules {
|
|
|
172
174
|
for (let i = 0; i < numberOfMonths; i++) {
|
|
173
175
|
const currentDate = new Date(startDate);
|
|
174
176
|
currentDate.setUTCMonth(currentDate.getUTCMonth() + i);
|
|
175
|
-
//
|
|
177
|
+
// Try setting the current date to the target day of the month
|
|
176
178
|
currentDate.setUTCDate(targetDayOfMonth);
|
|
177
|
-
//
|
|
179
|
+
// Check if we have exceeded the month
|
|
178
180
|
if (currentDate.getUTCMonth() !== (startDate.getUTCMonth() + i) % 12) {
|
|
179
|
-
continue; //
|
|
181
|
+
continue; // Skip this month if exceeded
|
|
180
182
|
}
|
|
181
183
|
schedule.times.forEach((timeRange) => {
|
|
182
184
|
const [startTime, endTime] = timeRange;
|
|
@@ -191,19 +193,19 @@ class SyncModules {
|
|
|
191
193
|
});
|
|
192
194
|
}
|
|
193
195
|
}
|
|
194
|
-
//
|
|
196
|
+
// Handle both weekly and monthly schedules
|
|
195
197
|
if (schedule.inEveryMonth && schedule.inEveryWeek) {
|
|
196
|
-
const startDate = new Date(date); //
|
|
197
|
-
const targetDayOfWeek = startDate.getUTCDay(); //
|
|
198
|
-
const numberOfMonths = 12; //
|
|
198
|
+
const startDate = new Date(date); // Initial date
|
|
199
|
+
const targetDayOfWeek = startDate.getUTCDay(); // Determine the day of the week
|
|
200
|
+
const numberOfMonths = 12; // Number of months to repeat
|
|
199
201
|
for (let i = 0; i < numberOfMonths; i++) {
|
|
200
202
|
const currentDate = new Date(startDate);
|
|
201
203
|
currentDate.setUTCMonth(currentDate.getUTCMonth() + i);
|
|
202
|
-
currentDate.setUTCDate(1); //
|
|
203
|
-
//
|
|
204
|
+
currentDate.setUTCDate(1); // Set to the first day of the month
|
|
205
|
+
// Find the first target day of the week in the current month
|
|
204
206
|
const daysUntilTargetDay = (targetDayOfWeek - currentDate.getUTCDay() + 7) % 7;
|
|
205
207
|
currentDate.setUTCDate(currentDate.getUTCDate() + daysUntilTargetDay);
|
|
206
|
-
//
|
|
208
|
+
// Iterate over all target days of the week in the current month
|
|
207
209
|
while (currentDate.getUTCMonth() ===
|
|
208
210
|
(startDate.getUTCMonth() + i) % 12) {
|
|
209
211
|
schedule.times.forEach((timeRange) => {
|
|
@@ -217,17 +219,17 @@ class SyncModules {
|
|
|
217
219
|
intervalEnd.toISOString(),
|
|
218
220
|
]);
|
|
219
221
|
});
|
|
220
|
-
//
|
|
222
|
+
// Move to the next week (same day of the week)
|
|
221
223
|
currentDate.setUTCDate(currentDate.getUTCDate() + 7);
|
|
222
224
|
}
|
|
223
225
|
}
|
|
224
226
|
}
|
|
225
227
|
}
|
|
226
228
|
/**
|
|
227
|
-
*
|
|
229
|
+
* Adds time intervals to schedules.
|
|
228
230
|
*
|
|
229
|
-
* @param schedules
|
|
230
|
-
* @
|
|
231
|
+
* @param schedules - The schedules to process.
|
|
232
|
+
* @return Schedules with added time intervals.
|
|
231
233
|
*/
|
|
232
234
|
_addTimeIntervalsToSchedules(schedules) {
|
|
233
235
|
schedules.forEach((scheduleGroup) => {
|
|
@@ -250,13 +252,13 @@ class SyncModules {
|
|
|
250
252
|
return schedules;
|
|
251
253
|
}
|
|
252
254
|
/**
|
|
253
|
-
*
|
|
255
|
+
* Normalizes attributes within the data.
|
|
254
256
|
*
|
|
255
|
-
* @param data
|
|
256
|
-
* @
|
|
257
|
+
* @param data - The data to normalize.
|
|
258
|
+
* @return Normalized attributes.
|
|
257
259
|
*/
|
|
258
260
|
_normalizeAttr(data) {
|
|
259
|
-
//
|
|
261
|
+
// For regular attributes
|
|
260
262
|
if ('attributeValues' in data) {
|
|
261
263
|
for (const attr in data.attributeValues) {
|
|
262
264
|
const d = data.attributeValues[attr];
|
|
@@ -283,11 +285,11 @@ class SyncModules {
|
|
|
283
285
|
if ('attributes' in data) {
|
|
284
286
|
const d = data.attributes;
|
|
285
287
|
for (const attr in d) {
|
|
286
|
-
//
|
|
288
|
+
// Normalize numbers
|
|
287
289
|
if (d[attr].type === 'integer' || d[attr].type === 'float') {
|
|
288
290
|
d[attr].value = Number(d[attr].value);
|
|
289
291
|
}
|
|
290
|
-
//
|
|
292
|
+
// Add time intervals
|
|
291
293
|
if (d[attr].type === 'timeInterval') {
|
|
292
294
|
// const schedules = d[attr].localizeInfos.intervals;
|
|
293
295
|
// if (Array.isArray(schedules) && schedules.length > 0) {
|
|
@@ -301,11 +303,11 @@ class SyncModules {
|
|
|
301
303
|
return data;
|
|
302
304
|
}
|
|
303
305
|
/**
|
|
304
|
-
*
|
|
306
|
+
* Processes data after fetching or receiving it.
|
|
305
307
|
*
|
|
306
|
-
* @param data
|
|
307
|
-
* @param langCode
|
|
308
|
-
* @
|
|
308
|
+
* @param data - The data to process.
|
|
309
|
+
* @param langCode - The language code for processing.
|
|
310
|
+
* @return Processed data.
|
|
309
311
|
*/
|
|
310
312
|
_dataPostProcess(data, langCode = this.state.lang) {
|
|
311
313
|
const normalize = this._normalizeData(data, langCode);
|
|
@@ -313,20 +315,20 @@ class SyncModules {
|
|
|
313
315
|
return result;
|
|
314
316
|
}
|
|
315
317
|
/**
|
|
316
|
-
*
|
|
318
|
+
* Sets the access token in the state.
|
|
317
319
|
*
|
|
318
|
-
* @param accessToken
|
|
319
|
-
* @
|
|
320
|
+
* @param accessToken - The access token to set.
|
|
321
|
+
* @return The instance of SyncModules for chaining.
|
|
320
322
|
*/
|
|
321
323
|
setAccessToken(accessToken) {
|
|
322
324
|
this.state.accessToken = accessToken;
|
|
323
325
|
return this;
|
|
324
326
|
}
|
|
325
327
|
/**
|
|
326
|
-
*
|
|
328
|
+
* Sets the refresh token in the state.
|
|
327
329
|
*
|
|
328
|
-
* @param refreshToken
|
|
329
|
-
* @
|
|
330
|
+
* @param refreshToken - The refresh token to set.
|
|
331
|
+
* @return The instance of SyncModules for chaining.
|
|
330
332
|
*/
|
|
331
333
|
setRefreshToken(refreshToken) {
|
|
332
334
|
this.state.refreshToken = refreshToken;
|
|
@@ -3,8 +3,14 @@ import type StateModule from '../base/stateModule';
|
|
|
3
3
|
import type { IError } from '../base/utils';
|
|
4
4
|
import type { BlockType, IBlockEntity, IBlocks, IBlocksResponse, ISearchBlock } from './blocksInterfaces';
|
|
5
5
|
/**
|
|
6
|
-
* Controllers for working with blocks
|
|
6
|
+
* Controllers for working with blocks.
|
|
7
|
+
*
|
|
7
8
|
* @handle /api/content/blocks
|
|
9
|
+
* @class BlocksApi
|
|
10
|
+
* @extends AsyncModules
|
|
11
|
+
* @implements {IBlocks}
|
|
12
|
+
*
|
|
13
|
+
* @description This class provides methods to interact with blocks.
|
|
8
14
|
*/
|
|
9
15
|
export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
10
16
|
protected state: StateModule;
|
|
@@ -13,54 +19,79 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
13
19
|
/**
|
|
14
20
|
* Get blocks by parameters.
|
|
15
21
|
*
|
|
16
|
-
* @
|
|
17
|
-
* @param {string} [langCode] - Language code. Default "en_US"
|
|
18
|
-
* @param {number} [offset] - Parameter for pagination. Default 0
|
|
19
|
-
* @param {number} [limit] - Parameter for pagination. Default 30
|
|
22
|
+
* @handleName getBlocks
|
|
20
23
|
*
|
|
21
|
-
* @
|
|
24
|
+
* @param {BlockType} type - Available values : product | error_page | catalog_page | product_preview | similar_products_block | product_block | form | common_page | common_block | order | none. Example: 'product'.
|
|
25
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
26
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
27
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
28
|
+
*
|
|
29
|
+
* @return {IBlocksResponse} Returns BlocksEntity object.
|
|
30
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
31
|
+
*
|
|
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.
|
|
22
33
|
*/
|
|
23
34
|
getBlocks(type: BlockType, langCode?: string, offset?: number, limit?: number): Promise<IBlocksResponse | IError>;
|
|
24
35
|
/**
|
|
25
36
|
* Get block by marker.
|
|
26
37
|
*
|
|
27
|
-
* @
|
|
28
|
-
*
|
|
29
|
-
* @param {
|
|
30
|
-
* @param {
|
|
38
|
+
* @handleName getBlockByMarker
|
|
39
|
+
*
|
|
40
|
+
* @param {string} marker - Marker of Block. Example: 'product_block'.
|
|
41
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
42
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
43
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
31
44
|
*
|
|
32
|
-
* @
|
|
45
|
+
* @return {IBlockEntity} - Returns a BlockEntity object.
|
|
46
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
47
|
+
*
|
|
48
|
+
* @description This method retrieves a block by its marker and includes additional information such as similar products or products associated with the block.
|
|
33
49
|
*/
|
|
34
50
|
getBlockByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IBlockEntity | IError>;
|
|
35
51
|
/**
|
|
36
52
|
* Get similar products by block marker.
|
|
37
53
|
*
|
|
38
|
-
* @
|
|
39
|
-
*
|
|
40
|
-
* @param {
|
|
41
|
-
* @param {
|
|
54
|
+
* @handleName getSimilarProducts
|
|
55
|
+
*
|
|
56
|
+
* @param {string} marker - Block identifier. Example: 'similar_products_block'.
|
|
57
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
58
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
59
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
42
60
|
*
|
|
43
|
-
* @
|
|
61
|
+
* @return {IProductsResponse} - Returns the total count and an array of product items in object by specified block marker.
|
|
62
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
63
|
+
*
|
|
64
|
+
* @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.
|
|
44
65
|
*/
|
|
45
66
|
private getSimilarProducts;
|
|
46
67
|
/**
|
|
47
68
|
* Get products by block marker.
|
|
48
69
|
*
|
|
49
|
-
* @
|
|
50
|
-
*
|
|
51
|
-
* @param {
|
|
52
|
-
* @param {
|
|
70
|
+
* @handleName getProductsByBlockMarker
|
|
71
|
+
*
|
|
72
|
+
* @param {string} marker - Block identifier. Example: 'product_block'.
|
|
73
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
74
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
75
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
76
|
+
*
|
|
77
|
+
* @return {IProductsEntity[]} Return array of BlocksEntity object.
|
|
78
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
53
79
|
*
|
|
54
|
-
* @
|
|
80
|
+
* @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.
|
|
55
81
|
*/
|
|
56
82
|
private getProductsByBlockMarker;
|
|
57
83
|
/**
|
|
58
|
-
* Quick search for block objects with limited output
|
|
84
|
+
* Quick search for block objects with limited output.
|
|
85
|
+
*
|
|
86
|
+
* @handleName searchBlock
|
|
87
|
+
*
|
|
88
|
+
* @param {string} name - Search string. Example: 'product_block'.
|
|
89
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
59
90
|
*
|
|
60
|
-
* @
|
|
61
|
-
* @
|
|
91
|
+
* @return {ISearchBlock[]} Returns an array of ISearchBlock objects.
|
|
92
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
62
93
|
*
|
|
63
|
-
* @
|
|
94
|
+
* @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.
|
|
64
95
|
*/
|
|
65
96
|
searchBlock(name: string, langCode?: string): Promise<Array<ISearchBlock> | IError>;
|
|
66
97
|
}
|