oneentry 1.0.121 → 1.0.122
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/attribute-sets/attributeSetsInterfaces.d.ts +13 -13
- package/dist/base/stateModule.d.ts +1 -1
- package/dist/base/stateModule.js +11 -11
- package/dist/base/syncModules.js +0 -132
- package/dist/blocks/blocksApi.js +2 -2
- package/dist/formsData/formsDataApi.js +3 -1
- package/dist/pages/pagesApi.d.ts +12 -0
- package/dist/pages/pagesApi.js +50 -11
- package/dist/pages/pagesInterfaces.d.ts +1 -0
- package/dist/products/productsApi.js +1 -1
- package/dist/templates/templatesApi.js +1 -1
- package/package.json +1 -1
|
@@ -12,10 +12,10 @@ interface IAttributesSets {
|
|
|
12
12
|
/**
|
|
13
13
|
* Represents an interface object of IListTitle.
|
|
14
14
|
*
|
|
15
|
-
* @property {string} title
|
|
16
|
-
* @property {number | string} value
|
|
17
|
-
* @property {string | number | null} position
|
|
18
|
-
* @property {object} extended
|
|
15
|
+
* @property {string} title - The title or name associated with the list item.
|
|
16
|
+
* @property {number | string} value - The value of the list item, which can be either a number or a string depending on the context.
|
|
17
|
+
* @property {string | number | null} position - The position of the list item, which can be represented as a string, number, or null if not applicable.
|
|
18
|
+
* @property {object} extended - An object containing additional properties or metadata related to the list item. This could include any extra details that extend the basic information.
|
|
19
19
|
*/
|
|
20
20
|
interface IListTitle {
|
|
21
21
|
title: string;
|
|
@@ -53,15 +53,15 @@ interface IAttributesSetsEntity {
|
|
|
53
53
|
/**
|
|
54
54
|
* Represents an interface object of IAttributeSetsEntity.
|
|
55
55
|
*
|
|
56
|
-
* @property {number} id -
|
|
57
|
-
* @property {string} identifier -
|
|
58
|
-
* @property {boolean} isVisible -
|
|
59
|
-
* @property {any} schema -
|
|
60
|
-
* @property {string} title -
|
|
61
|
-
* @property {any} type -
|
|
62
|
-
* @property {number} typeId -
|
|
63
|
-
* @property {string} updatedDate -
|
|
64
|
-
* @property {number} version -
|
|
56
|
+
* @property {number} id - The unique identifier of the attribute set entity.
|
|
57
|
+
* @property {string} identifier - A string that uniquely identifies the attribute set.
|
|
58
|
+
* @property {boolean} isVisible - Indicates whether the attribute set is visible or not.
|
|
59
|
+
* @property {any} schema - The schema definition associated with the attribute set. This could represent the structure or rules for the data.
|
|
60
|
+
* @property {string} title - The title or name of the attribute set.
|
|
61
|
+
* @property {any} type - The type of the attribute set, which could be a specific classification or category.
|
|
62
|
+
* @property {number} typeId - The numerical identifier representing the type of the attribute set.
|
|
63
|
+
* @property {string} updatedDate - The date when the attribute set was last updated, represented as a string. Consider using Date for better date handling.
|
|
64
|
+
* @property {number} version - The version number of the attribute set, used for tracking changes or updates.
|
|
65
65
|
*/
|
|
66
66
|
interface IAttributeSetsEntity {
|
|
67
67
|
id: number;
|
package/dist/base/stateModule.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
class StateModule {
|
|
4
4
|
constructor(url, config) {
|
|
5
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o
|
|
5
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
6
6
|
this.url = url;
|
|
7
7
|
this.lang = (_a = config.langCode) !== null && _a !== void 0 ? _a : 'en_US';
|
|
8
8
|
this.token = config.token;
|
|
9
|
-
this.
|
|
10
|
-
this.refreshToken = (
|
|
11
|
-
this.customAuth = (
|
|
9
|
+
this.traficLimit = config.traficLimit || false;
|
|
10
|
+
this.refreshToken = (_c = (_b = config.auth) === null || _b === void 0 ? void 0 : _b.refreshToken) !== null && _c !== void 0 ? _c : undefined;
|
|
11
|
+
this.customAuth = (_e = (_d = config.auth) === null || _d === void 0 ? void 0 : _d.customAuth) !== null && _e !== void 0 ? _e : false;
|
|
12
12
|
this.errorsFunctions = {
|
|
13
13
|
'400': undefined,
|
|
14
14
|
'401': undefined,
|
|
@@ -16,20 +16,20 @@ class StateModule {
|
|
|
16
16
|
'404': undefined,
|
|
17
17
|
'500': undefined,
|
|
18
18
|
};
|
|
19
|
-
this.saveFunction = (
|
|
19
|
+
this.saveFunction = (_g = (_f = config.auth) === null || _f === void 0 ? void 0 : _f.saveFunction) !== null && _g !== void 0 ? _g : null;
|
|
20
20
|
if (config.errors) {
|
|
21
|
-
this.isShell = (
|
|
21
|
+
this.isShell = (_h = config.errors.isShell) !== null && _h !== void 0 ? _h : true;
|
|
22
22
|
if (config.errors.customErrors) {
|
|
23
23
|
this.errorsFunctions['400'] =
|
|
24
|
-
(
|
|
24
|
+
(_j = config.errors.customErrors['400']) !== null && _j !== void 0 ? _j : undefined;
|
|
25
25
|
this.errorsFunctions['401'] =
|
|
26
|
-
(
|
|
26
|
+
(_k = config.errors.customErrors['401']) !== null && _k !== void 0 ? _k : undefined;
|
|
27
27
|
this.errorsFunctions['403'] =
|
|
28
|
-
(
|
|
28
|
+
(_l = config.errors.customErrors['403']) !== null && _l !== void 0 ? _l : undefined;
|
|
29
29
|
this.errorsFunctions['404'] =
|
|
30
|
-
(
|
|
30
|
+
(_m = config.errors.customErrors['404']) !== null && _m !== void 0 ? _m : undefined;
|
|
31
31
|
this.errorsFunctions['500'] =
|
|
32
|
-
(
|
|
32
|
+
(_o = config.errors.customErrors['400']) !== null && _o !== void 0 ? _o : undefined;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
else {
|
package/dist/base/syncModules.js
CHANGED
|
@@ -249,138 +249,6 @@ class SyncModules {
|
|
|
249
249
|
});
|
|
250
250
|
return schedules;
|
|
251
251
|
}
|
|
252
|
-
// /**
|
|
253
|
-
// * Function to generate intervals for a specific date
|
|
254
|
-
// *
|
|
255
|
-
// * @param date
|
|
256
|
-
// * @param schedule
|
|
257
|
-
// * @param utcIntervals
|
|
258
|
-
// */
|
|
259
|
-
// protected _generateFormIntervalsForDate(
|
|
260
|
-
// date: Date,
|
|
261
|
-
// schedule: { inEveryWeek: boolean; intervals: any[]; inEveryMonth: boolean },
|
|
262
|
-
// utcIntervals: Set<Array<string>>,
|
|
263
|
-
// ) {
|
|
264
|
-
// // inEveryWeek
|
|
265
|
-
// if (schedule.inEveryWeek && !schedule.inEveryMonth) {
|
|
266
|
-
// let currentDate = new Date(date);
|
|
267
|
-
// // Вычисляем последний день текущего месяца
|
|
268
|
-
// const endOfMonth = new Date(
|
|
269
|
-
// currentDate.getFullYear(),
|
|
270
|
-
// currentDate.getMonth() + 1,
|
|
271
|
-
// 0,
|
|
272
|
-
// );
|
|
273
|
-
// while (currentDate <= endOfMonth) {
|
|
274
|
-
// schedule.intervals?.forEach((timeRange: [any, any]) => {
|
|
275
|
-
// const [startTime, endTime] = timeRange;
|
|
276
|
-
// const intervalStart = new Date(currentDate);
|
|
277
|
-
// intervalStart.setUTCHours(startTime.hours, startTime.minutes, 0, 0);
|
|
278
|
-
// const intervalEnd = new Date(currentDate);
|
|
279
|
-
// intervalEnd.setUTCHours(endTime.hours, endTime.minutes, 0, 0);
|
|
280
|
-
// // Добавляем строку JSON в Set для уникальности
|
|
281
|
-
// utcIntervals.add([
|
|
282
|
-
// intervalStart.toISOString(),
|
|
283
|
-
// intervalEnd.toISOString(),
|
|
284
|
-
// ]);
|
|
285
|
-
// });
|
|
286
|
-
// currentDate = this._addDays(currentDate, 7); // Переходим к следующей неделе
|
|
287
|
-
// }
|
|
288
|
-
// }
|
|
289
|
-
// // inEveryMonth
|
|
290
|
-
// if (schedule.inEveryMonth && !schedule.inEveryWeek) {
|
|
291
|
-
// const startDate = new Date(date); // Начальная дата
|
|
292
|
-
// const targetDayOfMonth = startDate.getUTCDate(); // Определяем день месяца начальной даты
|
|
293
|
-
// const numberOfMonths = 12; // Количество месяцев, на которые нужно повторить
|
|
294
|
-
// for (let i = 0; i < numberOfMonths; i++) {
|
|
295
|
-
// const currentDate = new Date(startDate);
|
|
296
|
-
// currentDate.setUTCMonth(currentDate.getUTCMonth() + i);
|
|
297
|
-
// // Попробуем установить текущую дату на целевой день месяца
|
|
298
|
-
// currentDate.setUTCDate(targetDayOfMonth);
|
|
299
|
-
// // Проверяем, не вышли ли мы за пределы месяца
|
|
300
|
-
// if (currentDate.getUTCMonth() !== (startDate.getUTCMonth() + i) % 12) {
|
|
301
|
-
// continue; // Если вышли, пропускаем этот месяц
|
|
302
|
-
// }
|
|
303
|
-
// schedule.intervals?.forEach((timeRange: [any, any]) => {
|
|
304
|
-
// const [startTime, endTime] = timeRange;
|
|
305
|
-
// const intervalStart = new Date(currentDate);
|
|
306
|
-
// intervalStart.setUTCHours(startTime.hours, startTime.minutes, 0, 0);
|
|
307
|
-
// const intervalEnd = new Date(currentDate);
|
|
308
|
-
// intervalEnd.setUTCHours(endTime.hours, endTime.minutes, 0, 0);
|
|
309
|
-
// utcIntervals.add([
|
|
310
|
-
// intervalStart.toISOString(),
|
|
311
|
-
// intervalEnd.toISOString(),
|
|
312
|
-
// ]);
|
|
313
|
-
// });
|
|
314
|
-
// }
|
|
315
|
-
// }
|
|
316
|
-
// // inEveryMonth && inEveryWeek
|
|
317
|
-
// if (schedule.inEveryMonth && schedule.inEveryWeek) {
|
|
318
|
-
// const startDate = new Date(date); // Начальная дата
|
|
319
|
-
// const targetDayOfWeek = startDate.getUTCDay(); // Определяем день недели начальной даты
|
|
320
|
-
// const numberOfMonths = 12; // Количество месяцев, на которые нужно повторить
|
|
321
|
-
// console.log(startDate);
|
|
322
|
-
// for (let i = 0; i < numberOfMonths; i++) {
|
|
323
|
-
// const currentDate = new Date(startDate);
|
|
324
|
-
// currentDate.setUTCMonth(currentDate.getUTCMonth() + i);
|
|
325
|
-
// currentDate.setUTCDate(1); // Устанавливаем на первый день месяца
|
|
326
|
-
// // Находим первый целевой день недели в текущем месяце
|
|
327
|
-
// const daysUntilTargetDay =
|
|
328
|
-
// (targetDayOfWeek - currentDate.getUTCDay() + 7) % 7;
|
|
329
|
-
// currentDate.setUTCDate(currentDate.getUTCDate() + daysUntilTargetDay);
|
|
330
|
-
// // Проходим по всем целевым дням недели в текущем месяце
|
|
331
|
-
// while (
|
|
332
|
-
// currentDate.getUTCMonth() ===
|
|
333
|
-
// (startDate.getUTCMonth() + i) % 12
|
|
334
|
-
// ) {
|
|
335
|
-
// schedule.intervals.forEach((timeRange: [any, any]) => {
|
|
336
|
-
// const [startTime, endTime] = timeRange;
|
|
337
|
-
// const intervalStart = new Date(currentDate);
|
|
338
|
-
// intervalStart.setUTCHours(startTime.hours, startTime.minutes, 0, 0);
|
|
339
|
-
// const intervalEnd = new Date(currentDate);
|
|
340
|
-
// intervalEnd.setUTCHours(endTime.hours, endTime.minutes, 0, 0);
|
|
341
|
-
// utcIntervals.add([
|
|
342
|
-
// intervalStart.toISOString(),
|
|
343
|
-
// intervalEnd.toISOString(),
|
|
344
|
-
// ]);
|
|
345
|
-
// });
|
|
346
|
-
// // Переходим к следующей неделе (следующему такому же дню недели)
|
|
347
|
-
// currentDate.setUTCDate(currentDate.getUTCDate() + 7);
|
|
348
|
-
// }
|
|
349
|
-
// }
|
|
350
|
-
// }
|
|
351
|
-
// }
|
|
352
|
-
// /**
|
|
353
|
-
// * Add TimeIntervals to schedules Form
|
|
354
|
-
// *
|
|
355
|
-
// * @param schedules
|
|
356
|
-
// * @returns schedules with timeIntervals
|
|
357
|
-
// */
|
|
358
|
-
// _addTimeIntervalsToSchedulesForm(schedules: any[]) {
|
|
359
|
-
// schedules?.forEach((schedule: any) => {
|
|
360
|
-
// const utcIntervals: Set<Array<string>> = new Set();
|
|
361
|
-
// const startDate = new Date(schedule.range[0]);
|
|
362
|
-
// const endDate = new Date(schedule.range[1]);
|
|
363
|
-
// const isSameDay = startDate.toISOString() === endDate.toISOString();
|
|
364
|
-
// // console.log(JSON.stringify(schedule));
|
|
365
|
-
// if (isSameDay) {
|
|
366
|
-
// this._generateFormIntervalsForDate(startDate, schedule, utcIntervals);
|
|
367
|
-
// } else {
|
|
368
|
-
// for (
|
|
369
|
-
// let currentDate = new Date(startDate);
|
|
370
|
-
// currentDate <= endDate;
|
|
371
|
-
// currentDate = this._addDays(currentDate, 1)
|
|
372
|
-
// ) {
|
|
373
|
-
// this._generateFormIntervalsForDate(
|
|
374
|
-
// currentDate,
|
|
375
|
-
// schedule,
|
|
376
|
-
// utcIntervals,
|
|
377
|
-
// );
|
|
378
|
-
// }
|
|
379
|
-
// }
|
|
380
|
-
// // schedule.timeIntervals = Array.from(utcIntervals).sort();
|
|
381
|
-
// });
|
|
382
|
-
// return schedules;
|
|
383
|
-
// }
|
|
384
252
|
/**
|
|
385
253
|
* normalizeAttr
|
|
386
254
|
*
|
package/dist/blocks/blocksApi.js
CHANGED
|
@@ -25,7 +25,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
25
25
|
*/
|
|
26
26
|
async getBlocks(type, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
27
27
|
const response = await this._fetchGet(`?langCode=${langCode}&type=${type}&offset=${offset}&limit=${limit}`);
|
|
28
|
-
if (this.state.
|
|
28
|
+
if (!this.state.traficLimit) {
|
|
29
29
|
const normalizeResponse = this._normalizeData(response);
|
|
30
30
|
await Promise.all(
|
|
31
31
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -93,7 +93,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
93
93
|
delete normalizeResponse.customSettings;
|
|
94
94
|
delete normalizeResponse.attributesSetIdentifier;
|
|
95
95
|
delete normalizeResponse.productPageUrls;
|
|
96
|
-
if (this.state.
|
|
96
|
+
if (!this.state.traficLimit) {
|
|
97
97
|
if (normalizeResponse.type === 'similar_products_block') {
|
|
98
98
|
try {
|
|
99
99
|
await this.getSimilarProducts(normalizeResponse.identifier, langCode, offset, limit).then((result) => {
|
|
@@ -79,7 +79,9 @@ class FormsDataApi extends asyncModules_1.default {
|
|
|
79
79
|
type: 'page',
|
|
80
80
|
entity: 'editor',
|
|
81
81
|
// Generate a random 4-digit ID
|
|
82
|
-
id: Number(Math.floor(Math.random() * 10000)
|
|
82
|
+
id: Number(Math.floor(Math.random() * 10000)
|
|
83
|
+
.toString()
|
|
84
|
+
.padStart(4, '0')),
|
|
83
85
|
};
|
|
84
86
|
fd.fileQuery = fileQuery;
|
|
85
87
|
}
|
package/dist/pages/pagesApi.d.ts
CHANGED
|
@@ -88,4 +88,16 @@ export default class PageApi extends AsyncModules implements IPageApi {
|
|
|
88
88
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
89
89
|
*/
|
|
90
90
|
searchPage(name: string, langCode?: string): Promise<Array<IPagesEntity> | IError>;
|
|
91
|
+
/**
|
|
92
|
+
* addTemplateToPages
|
|
93
|
+
* @param data
|
|
94
|
+
* @returns
|
|
95
|
+
*/
|
|
96
|
+
protected addTemplateToPages(data: IPagesEntity[]): Promise<IPagesEntity[]>;
|
|
97
|
+
/**
|
|
98
|
+
* addTemplateToPage by page templateIdentifier
|
|
99
|
+
* @param data - page object
|
|
100
|
+
* @returns
|
|
101
|
+
*/
|
|
102
|
+
protected addTemplateToPage(data: IPagesEntity): Promise<IPagesEntity>;
|
|
91
103
|
}
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
7
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
|
+
const templatesApi_1 = __importDefault(require("../templates/templatesApi"));
|
|
8
9
|
/**
|
|
9
10
|
* Controllers for working with page objects, including catalog pages
|
|
10
11
|
* @handle /api/content/pages
|
|
@@ -22,7 +23,8 @@ class PageApi extends asyncModules_1.default {
|
|
|
22
23
|
* @returns Returns all created pages without parents as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
23
24
|
*/
|
|
24
25
|
async getRootPages(langCode = this.state.lang) {
|
|
25
|
-
const
|
|
26
|
+
const data = await this._fetchGet(`/root?langCode=${langCode}`);
|
|
27
|
+
const result = await this.addTemplateToPages(data);
|
|
26
28
|
return this._normalizeData(result, langCode);
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
@@ -33,7 +35,8 @@ class PageApi extends asyncModules_1.default {
|
|
|
33
35
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
34
36
|
*/
|
|
35
37
|
async getPages(langCode = this.state.lang) {
|
|
36
|
-
const
|
|
38
|
+
const data = await this._fetchGet(`?langCode=${langCode}`);
|
|
39
|
+
const result = await this.addTemplateToPages(data);
|
|
37
40
|
return this._normalizeData(result, langCode);
|
|
38
41
|
}
|
|
39
42
|
/**
|
|
@@ -45,7 +48,8 @@ class PageApi extends asyncModules_1.default {
|
|
|
45
48
|
* @returns Returns PageEntity object
|
|
46
49
|
*/
|
|
47
50
|
async getPageById(id, langCode = this.state.lang) {
|
|
48
|
-
const
|
|
51
|
+
const data = await this._fetchGet(`/${id}?langCode=${langCode}`);
|
|
52
|
+
const result = await this.addTemplateToPage(data);
|
|
49
53
|
return this._normalizeData(result, langCode);
|
|
50
54
|
}
|
|
51
55
|
/**
|
|
@@ -58,7 +62,8 @@ class PageApi extends asyncModules_1.default {
|
|
|
58
62
|
*/
|
|
59
63
|
async getPageByUrl(url, langCode = this.state.lang) {
|
|
60
64
|
const data = await this._fetchGet(`/url/${url}?langCode=${langCode}`);
|
|
61
|
-
|
|
65
|
+
const result = await this.addTemplateToPage(data);
|
|
66
|
+
return this._normalizeData(result, langCode);
|
|
62
67
|
}
|
|
63
68
|
/**
|
|
64
69
|
* Get child pages object with information as an array.
|
|
@@ -70,7 +75,8 @@ class PageApi extends asyncModules_1.default {
|
|
|
70
75
|
*/
|
|
71
76
|
async getChildPagesByParentUrl(url, langCode = this.state.lang) {
|
|
72
77
|
const data = await this._fetchGet(`/${url}/children?langCode=${langCode}`);
|
|
73
|
-
|
|
78
|
+
const result = await this.addTemplateToPages(data);
|
|
79
|
+
return this._normalizeData(result, langCode);
|
|
74
80
|
}
|
|
75
81
|
/**
|
|
76
82
|
* Get all blocks by page url.
|
|
@@ -97,7 +103,7 @@ class PageApi extends asyncModules_1.default {
|
|
|
97
103
|
delete item.attributesSetIdentifier;
|
|
98
104
|
return item;
|
|
99
105
|
});
|
|
100
|
-
if (this.state.
|
|
106
|
+
if (!this.state.traficLimit) {
|
|
101
107
|
class StaffModule extends asyncModules_1.default {
|
|
102
108
|
constructor(state) {
|
|
103
109
|
super(state);
|
|
@@ -172,17 +178,50 @@ class PageApi extends asyncModules_1.default {
|
|
|
172
178
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
173
179
|
*/
|
|
174
180
|
async searchPage(name, langCode = this.state.lang) {
|
|
175
|
-
const
|
|
176
|
-
if (this.state.
|
|
181
|
+
const data = await this._fetchGet(`/quick/search?lang=${langCode}&name=${name}`);
|
|
182
|
+
if (!this.state.traficLimit) {
|
|
177
183
|
const pageList = [];
|
|
178
|
-
await Promise.all(
|
|
184
|
+
await Promise.all(data.map(async (page) => {
|
|
179
185
|
await this.getPageById(page.id, langCode).then((result) => {
|
|
180
186
|
pageList.push(result);
|
|
181
187
|
});
|
|
182
188
|
}));
|
|
183
|
-
|
|
189
|
+
const result = await this.addTemplateToPages(pageList);
|
|
190
|
+
return this._dataPostProcess(result, langCode);
|
|
191
|
+
}
|
|
192
|
+
const result = await this.addTemplateToPages(data);
|
|
193
|
+
return this._normalizeData(result, langCode);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* addTemplateToPages
|
|
197
|
+
* @param data
|
|
198
|
+
* @returns
|
|
199
|
+
*/
|
|
200
|
+
async addTemplateToPages(data) {
|
|
201
|
+
return Promise.all(data.map(async (d) => {
|
|
202
|
+
const result = await this.addTemplateToPage(d);
|
|
203
|
+
return result;
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* addTemplateToPage by page templateIdentifier
|
|
208
|
+
* @param data - page object
|
|
209
|
+
* @returns
|
|
210
|
+
*/
|
|
211
|
+
async addTemplateToPage(data) {
|
|
212
|
+
if ('templateIdentifier' in data && data.templateIdentifier) {
|
|
213
|
+
// Create an instance of templatesApi with the current state
|
|
214
|
+
const Templates = new templatesApi_1.default(this.state);
|
|
215
|
+
// get template by marker
|
|
216
|
+
const result = await Templates.getTemplateByMarker('template');
|
|
217
|
+
return {
|
|
218
|
+
...data,
|
|
219
|
+
template: result,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
return data;
|
|
184
224
|
}
|
|
185
|
-
return this._normalizeData(searchPages, langCode);
|
|
186
225
|
}
|
|
187
226
|
}
|
|
188
227
|
exports.default = PageApi;
|
|
@@ -295,7 +295,7 @@ class ProductApi extends asyncModules_1.default {
|
|
|
295
295
|
*/
|
|
296
296
|
async searchProduct(name, langCode = this.state.lang) {
|
|
297
297
|
const searchProducts = await this._fetchGet(`/quick/search?langCode=${langCode}&name=${name}`);
|
|
298
|
-
if (this.state.
|
|
298
|
+
if (!this.state.traficLimit) {
|
|
299
299
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
300
300
|
const productsList = [];
|
|
301
301
|
await Promise.all(searchProducts.map(async (product) => {
|
|
@@ -63,7 +63,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
|
|
|
63
63
|
* @returns Returns a TemplateEntity object
|
|
64
64
|
*/
|
|
65
65
|
async getTemplateByMarker(marker, langCode = this.state.lang) {
|
|
66
|
-
const result = await this._fetchGet(
|
|
66
|
+
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
67
67
|
return this._normalizeData(result);
|
|
68
68
|
}
|
|
69
69
|
}
|