oneentry 1.0.138 → 1.0.140

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.
Files changed (143) hide show
  1. package/README.md +16 -1
  2. package/configure.js +40 -21
  3. package/package.json +15 -12
  4. package/dist/admins/adminsApi.d.ts +0 -50
  5. package/dist/admins/adminsApi.js +0 -65
  6. package/dist/admins/adminsInterfaces.d.ts +0 -99
  7. package/dist/admins/adminsInterfaces.js +0 -2
  8. package/dist/admins/adminsSchemas.d.ts +0 -30
  9. package/dist/admins/adminsSchemas.js +0 -27
  10. package/dist/attribute-sets/attributeSetsApi.d.ts +0 -63
  11. package/dist/attribute-sets/attributeSetsApi.js +0 -98
  12. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +0 -187
  13. package/dist/attribute-sets/attributeSetsInterfaces.js +0 -2
  14. package/dist/attribute-sets/attributeSetsSchemas.d.ts +0 -90
  15. package/dist/attribute-sets/attributeSetsSchemas.js +0 -74
  16. package/dist/auth-provider/authProviderApi.d.ts +0 -249
  17. package/dist/auth-provider/authProviderApi.js +0 -351
  18. package/dist/auth-provider/authProviderSchemas.d.ts +0 -137
  19. package/dist/auth-provider/authProviderSchemas.js +0 -85
  20. package/dist/auth-provider/authProvidersInterfaces.d.ts +0 -417
  21. package/dist/auth-provider/authProvidersInterfaces.js +0 -2
  22. package/dist/base/asyncModules.d.ts +0 -80
  23. package/dist/base/asyncModules.js +0 -440
  24. package/dist/base/result.d.ts +0 -39
  25. package/dist/base/result.js +0 -154
  26. package/dist/base/stateModule.d.ts +0 -41
  27. package/dist/base/stateModule.js +0 -128
  28. package/dist/base/syncModules.d.ts +0 -148
  29. package/dist/base/syncModules.js +0 -530
  30. package/dist/base/utils.d.ts +0 -197
  31. package/dist/base/utils.js +0 -2
  32. package/dist/base/validation.d.ts +0 -118
  33. package/dist/base/validation.js +0 -132
  34. package/dist/blocks/blocksApi.d.ts +0 -74
  35. package/dist/blocks/blocksApi.js +0 -184
  36. package/dist/blocks/blocksInterfaces.d.ts +0 -173
  37. package/dist/blocks/blocksInterfaces.js +0 -2
  38. package/dist/blocks/blocksSchemas.d.ts +0 -187
  39. package/dist/blocks/blocksSchemas.js +0 -43
  40. package/dist/events/eventsApi.d.ts +0 -60
  41. package/dist/events/eventsApi.js +0 -97
  42. package/dist/events/eventsInterfaces.d.ts +0 -87
  43. package/dist/events/eventsInterfaces.js +0 -2
  44. package/dist/file-uploading/fileUploadingApi.d.ts +0 -88
  45. package/dist/file-uploading/fileUploadingApi.js +0 -132
  46. package/dist/file-uploading/fileUploadingInterfaces.d.ts +0 -117
  47. package/dist/file-uploading/fileUploadingInterfaces.js +0 -2
  48. package/dist/file-uploading/fileUploadingSchemas.d.ts +0 -22
  49. package/dist/file-uploading/fileUploadingSchemas.js +0 -21
  50. package/dist/forms/formsApi.d.ts +0 -42
  51. package/dist/forms/formsApi.js +0 -57
  52. package/dist/forms/formsInterfaces.d.ts +0 -132
  53. package/dist/forms/formsInterfaces.js +0 -2
  54. package/dist/forms/formsSchemas.d.ts +0 -65
  55. package/dist/forms/formsSchemas.js +0 -36
  56. package/dist/forms-data/formsDataApi.d.ts +0 -106
  57. package/dist/forms-data/formsDataApi.js +0 -189
  58. package/dist/forms-data/formsDataInterfaces.d.ts +0 -525
  59. package/dist/forms-data/formsDataInterfaces.js +0 -2
  60. package/dist/forms-data/formsDataSchemas.d.ts +0 -115
  61. package/dist/forms-data/formsDataSchemas.js +0 -86
  62. package/dist/general-types/generalTypesApi.d.ts +0 -28
  63. package/dist/general-types/generalTypesApi.js +0 -38
  64. package/dist/general-types/generalTypesInterfaces.d.ts +0 -30
  65. package/dist/general-types/generalTypesInterfaces.js +0 -2
  66. package/dist/general-types/generalTypesSchemas.d.ts +0 -50
  67. package/dist/general-types/generalTypesSchemas.js +0 -35
  68. package/dist/index.d.ts +0 -94
  69. package/dist/index.js +0 -97
  70. package/dist/integration-collections/integrationCollectionsApi.d.ts +0 -173
  71. package/dist/integration-collections/integrationCollectionsApi.js +0 -220
  72. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +0 -313
  73. package/dist/integration-collections/integrationCollectionsInterfaces.js +0 -2
  74. package/dist/integration-collections/integrationCollectionsSchemas.d.ts +0 -84
  75. package/dist/integration-collections/integrationCollectionsSchemas.js +0 -63
  76. package/dist/locales/localesApi.d.ts +0 -27
  77. package/dist/locales/localesApi.js +0 -37
  78. package/dist/locales/localesInterfaces.d.ts +0 -41
  79. package/dist/locales/localesInterfaces.js +0 -2
  80. package/dist/locales/localesSchemas.d.ts +0 -32
  81. package/dist/locales/localesSchemas.js +0 -26
  82. package/dist/menus/menusApi.d.ts +0 -29
  83. package/dist/menus/menusApi.js +0 -39
  84. package/dist/menus/menusInterfaces.d.ts +0 -88
  85. package/dist/menus/menusInterfaces.js +0 -4
  86. package/dist/menus/menusSchemas.d.ts +0 -16
  87. package/dist/menus/menusSchemas.js +0 -28
  88. package/dist/orders/ordersApi.d.ts +0 -126
  89. package/dist/orders/ordersApi.js +0 -169
  90. package/dist/orders/ordersInterfaces.d.ts +0 -427
  91. package/dist/orders/ordersInterfaces.js +0 -2
  92. package/dist/orders/ordersSchemas.d.ts +0 -158
  93. package/dist/orders/ordersSchemas.js +0 -120
  94. package/dist/pages/pagesApi.d.ts +0 -151
  95. package/dist/pages/pagesApi.js +0 -390
  96. package/dist/pages/pagesInterfaces.d.ts +0 -292
  97. package/dist/pages/pagesInterfaces.js +0 -2
  98. package/dist/pages/pagesSchemas.d.ts +0 -85
  99. package/dist/pages/pagesSchemas.js +0 -46
  100. package/dist/payments/paymentsApi.d.ts +0 -82
  101. package/dist/payments/paymentsApi.js +0 -121
  102. package/dist/payments/paymentsInterfaces.d.ts +0 -206
  103. package/dist/payments/paymentsInterfaces.js +0 -2
  104. package/dist/payments/paymentsSchemas.d.ts +0 -137
  105. package/dist/payments/paymentsSchemas.js +0 -78
  106. package/dist/product-statuses/productStatusesApi.d.ts +0 -47
  107. package/dist/product-statuses/productStatusesApi.js +0 -70
  108. package/dist/product-statuses/productStatusesInterfaces.d.ts +0 -66
  109. package/dist/product-statuses/productStatusesInterfaces.js +0 -2
  110. package/dist/product-statuses/productStatusesSchemas.d.ts +0 -34
  111. package/dist/product-statuses/productStatusesSchemas.js +0 -30
  112. package/dist/products/productsApi.d.ts +0 -365
  113. package/dist/products/productsApi.js +0 -464
  114. package/dist/products/productsInterfaces.d.ts +0 -583
  115. package/dist/products/productsInterfaces.js +0 -2
  116. package/dist/products/productsSchemas.d.ts +0 -212
  117. package/dist/products/productsSchemas.js +0 -85
  118. package/dist/system/systemApi.d.ts +0 -65
  119. package/dist/system/systemApi.js +0 -82
  120. package/dist/system/systemInterfaces.d.ts +0 -23
  121. package/dist/system/systemInterfaces.js +0 -2
  122. package/dist/templates/templatesApi.d.ts +0 -49
  123. package/dist/templates/templatesApi.js +0 -75
  124. package/dist/templates/templatesInterfaces.d.ts +0 -70
  125. package/dist/templates/templatesInterfaces.js +0 -2
  126. package/dist/templates/templatesSchemas.d.ts +0 -48
  127. package/dist/templates/templatesSchemas.js +0 -31
  128. package/dist/templates-preview/templatesPreviewApi.d.ts +0 -38
  129. package/dist/templates-preview/templatesPreviewApi.js +0 -53
  130. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +0 -121
  131. package/dist/templates-preview/templatesPreviewInterfaces.js +0 -2
  132. package/dist/templates-preview/templatesPreviewSchemas.d.ts +0 -83
  133. package/dist/templates-preview/templatesPreviewSchemas.js +0 -48
  134. package/dist/users/usersApi.d.ts +0 -143
  135. package/dist/users/usersApi.js +0 -174
  136. package/dist/users/usersInterfaces.d.ts +0 -235
  137. package/dist/users/usersInterfaces.js +0 -2
  138. package/dist/users/usersSchemas.d.ts +0 -38
  139. package/dist/users/usersSchemas.js +0 -28
  140. package/dist/web-socket/wsApi.d.ts +0 -25
  141. package/dist/web-socket/wsApi.js +0 -45
  142. package/dist/web-socket/wsInterfaces.d.ts +0 -17
  143. package/dist/web-socket/wsInterfaces.js +0 -2
@@ -1,464 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- /* eslint-disable jsdoc/reject-any-type */
7
- const asyncModules_1 = __importDefault(require("../base/asyncModules"));
8
- const productsSchemas_1 = require("./productsSchemas");
9
- /**
10
- * Controllers for working with product pages
11
- * @handle /api/content/products
12
- * @description Controllers for working with product pages
13
- */
14
- class ProductApi extends asyncModules_1.default {
15
- /**
16
- * Constructor
17
- * @param {StateModule} state - StateModule instance
18
- * @description Constructor initializes the ProductApi with a given state.
19
- */
20
- constructor(state) {
21
- super(state);
22
- this._defaultQuery = {
23
- offset: 0,
24
- limit: 30,
25
- sortOrder: 'DESC',
26
- sortKey: 'id',
27
- };
28
- this._url = state.url + '/api/content/products';
29
- }
30
- /**
31
- * Search for all products with pagination and filter.
32
- * @handleName getProducts
33
- * @param {IFilterParams[]} [body] - Request body. Default: [].
34
- * @example
35
- [
36
- {
37
- "attributeMarker": "price",
38
- "conditionMarker": "mth",
39
- "statusMarker": "waiting",
40
- "conditionValue": 1,
41
- "pageUrls": [
42
- "23-laminat-floorwood-maxima"
43
- ],
44
- "isNested": false,
45
- "title": ""
46
- },
47
- {
48
- "attributeMarker": "price",
49
- "conditionMarker": "lth",
50
- "conditionValue": 3,
51
- "pageUrls": [
52
- "23-laminat-floorwood-maxima"
53
- ],
54
- "isNested": false,
55
- "title": ""
56
- }
57
- ]
58
- * @param {string} [langCode] - Language code. Default: "en_US".
59
- * @param {IProductsQuery} [userQuery] - Optional set query parameters.
60
- * @example
61
- {
62
- "signPrice": "orders",
63
- "sortOrder": "DESC",
64
- "sortKey": "id",
65
- "limit": 30,
66
- "offset": 0,
67
- "statusId": 123,
68
- "statusMarker": "in_stock",
69
- "conditionValue": "new",
70
- "conditionMarker": "equals",
71
- "attributeMarker": "color"
72
- }
73
- * @returns {Promise<IProductsResponse | IError>} Products response, or IError when isShell=true
74
- * @throws {IError} When isShell=false and an error occurs during the fetch
75
- * @description Fetch products with optional filters and pagination.
76
- */
77
- async getProducts(body = [], langCode = this.state.lang, userQuery) {
78
- const query = {
79
- ...this._defaultQuery,
80
- ...userQuery,
81
- langCode,
82
- };
83
- const result = await this._fetchPost(`/all?` + this._queryParamsToString(query), body);
84
- // Validate response if validation is enabled
85
- const validated = this._validateResponse(result, productsSchemas_1.ProductsResponseSchema);
86
- return this._dataPostProcess(validated, langCode);
87
- }
88
- /**
89
- * Search for all product page objects with pagination that do not have a category.
90
- * @handleName getProductsEmptyPage
91
- * @param {string} [langCode] - Language code. Default: "en_US".
92
- * @param {IProductsQuery} [userQuery] - Optional set query parameters.
93
- * @example
94
- {
95
- "limit": 30,
96
- "offset": 0,
97
- "sortOrder": "DESC",
98
- "sortKey": "id",
99
- "statusId": 123,
100
- "statusMarker": "in_stock",
101
- "conditionValue": "new",
102
- "conditionMarker": "equals",
103
- "attributeMarker": "color"
104
- }
105
- * @returns {Promise<IProductsResponse | IError>} Array with ProductEntity objects.
106
- * @throws {IError} When isShell=false and an error occurs during the fetch
107
- * @description Search for all product page objects with pagination that do not have a category.
108
- */
109
- async getProductsEmptyPage(langCode = this.state.lang, userQuery) {
110
- const query = { ...this._defaultQuery, ...userQuery };
111
- const result = await this._fetchGet(`/empty-page?langCode=${langCode}&` + this._queryParamsToString(query));
112
- // Validate response if validation is enabled
113
- const validated = this._validateResponse(result, productsSchemas_1.ProductsResponseSchema);
114
- return this._dataPostProcess(validated, langCode);
115
- }
116
- /**
117
- * Search for all products with pagination for the selected category.
118
- * @handleName getProductsByPageId
119
- * @param {number} id - Page id. Example: 2492.
120
- * @param {IFilterParams[]} [body] - Request body. Default: [].
121
- * @example
122
- [
123
- {
124
- "attributeMarker": "price",
125
- "conditionMarker": "mth",
126
- "statusMarker": "waiting",
127
- "conditionValue": 1,
128
- "pageUrls": [
129
- "23-laminat-floorwood-maxima"
130
- ],
131
- "isNested": false,
132
- "title": ""
133
- },
134
- {
135
- "attributeMarker": "price",
136
- "conditionMarker": "lth",
137
- "conditionValue": 3,
138
- "pageUrls": [
139
- "23-laminat-floorwood-maxima"
140
- ],
141
- "isNested": false,
142
- "title": ""
143
- }
144
- ]
145
- * @param {string} [langCode] - Language code. Default: "en_US".
146
- * @param {IProductsQuery} [userQuery] - Optional set query parameters.
147
- * @example
148
- {
149
- "limit": 30,
150
- "offset": 0,
151
- "sortOrder": "DESC",
152
- "sortKey": "id",
153
- "statusId": 123,
154
- "statusMarker": "in_stock",
155
- "conditionValue": "new",
156
- "conditionMarker": "equals",
157
- "attributeMarker": "color"
158
- }
159
- * @returns {Promise<IProductsResponse | IError>} Array with ProductEntity objects
160
- * @throws {IError} When isShell=false and an error occurs during the fetch
161
- * @description Fetch products by page ID with optional filters and pagination.
162
- */
163
- async getProductsByPageId(id, body = [], langCode = this.state.lang, userQuery) {
164
- const query = { ...this._defaultQuery, ...userQuery };
165
- const result = await this._fetchPost(`/page/${id}?langCode=${langCode}&` + this._queryParamsToString(query), body);
166
- // Validate response if validation is enabled
167
- const validated = this._validateResponse(result, productsSchemas_1.ProductsResponseSchema);
168
- return this._dataPostProcess(validated, langCode);
169
- }
170
- /**
171
- * Search for information about products and prices for the selected category.
172
- * @handleName getProductsPriceByPageUrl
173
- * @param {string} [url] - Page url. Example: "23-laminat-floorwood-maxima".
174
- * @param {string} [langCode] - Language code. Default: "en_US".
175
- * @param {IProductsQuery} [userQuery] - Optional set query parameters.
176
- * @example
177
- {
178
- "limit": 30,
179
- "offset": 0,
180
- "sortOrder": "DESC",
181
- "sortKey": "id",
182
- "statusId": 123,
183
- "statusMarker": "in_stock",
184
- "conditionValue": "new",
185
- "conditionMarker": "equals",
186
- "attributeMarker": "color"
187
- }
188
- * @returns {Promise<IProductsInfo | IError>} Array with ProductInformation objects.
189
- * @throws {IError} When isShell=false and an error occurs during the fetch
190
- * @description Search for information about products and prices for the selected category.
191
- */
192
- async getProductsPriceByPageUrl(url, langCode = this.state.lang, userQuery) {
193
- const query = {
194
- ...this._defaultQuery,
195
- ...userQuery,
196
- langCode,
197
- };
198
- const result = await this._fetchGet(`/page/${url}/prices?` + this._queryParamsToString(query));
199
- return result;
200
- }
201
- /**
202
- * Search for all products with pagination for the selected category.
203
- * @handleName getProductsByPageUrl
204
- * @param {string} url - Page url. Example: "catalog".
205
- * @param {IFilterParams[]} [body] - Request body. Default: [].
206
- * @example
207
- [
208
- {
209
- "attributeMarker": "price",
210
- "conditionMarker": "mth",
211
- "statusMarker": "waiting",
212
- "conditionValue": 1,
213
- "pageUrls": [
214
- "23-laminat-floorwood-maxima"
215
- ],
216
- "isNested": false,
217
- "title": ""
218
- },
219
- {
220
- "attributeMarker": "price",
221
- "conditionMarker": "lth",
222
- "conditionValue": 3,
223
- "pageUrls": [
224
- "23-laminat-floorwood-maxima"
225
- ],
226
- "isNested": false,
227
- "title": ""
228
- }
229
- ]
230
- * @param {string} [langCode] - Language code. Default: "en_US".
231
- * @param {IProductsQuery} [userQuery] - Optional set query parameters.
232
- * @example
233
- {
234
- "limit": 30,
235
- "offset": 0,
236
- "sortOrder": "DESC",
237
- "sortKey": "id",
238
- "statusId": 123,
239
- "statusMarker": "in_stock",
240
- "conditionValue": "new",
241
- "conditionMarker": "equals",
242
- "attributeMarker": "color"
243
- }
244
- * @returns {Promise<IProductsResponse | IError>} Array with ProductEntity objects.
245
- * @throws {IError} When isShell=false and an error occurs during the fetch
246
- * @description Search for all products with pagination for the selected category.
247
- */
248
- async getProductsByPageUrl(url, body = [], langCode = this.state.lang, userQuery) {
249
- const query = { ...this._defaultQuery, ...userQuery };
250
- const result = await this._fetchPost(`/page/url/${url}?langCode=${langCode}&` +
251
- this._queryParamsToString(query), body);
252
- // Validate response if validation is enabled
253
- const validated = this._validateResponse(result, productsSchemas_1.ProductsResponseSchema);
254
- return this._dataPostProcess(validated, langCode);
255
- }
256
- /**
257
- * Find all related product page objects.
258
- * @handleName getRelatedProductsById
259
- * @param {number} [id] - Product page identifier for which to find relationship. Example: 12345.
260
- * @param {string} [langCode] - Language code. Default: "en_US".
261
- * @param {IProductsQuery} [userQuery] - Optional set query parameters.
262
- * @example
263
- {
264
- "limit": 30,
265
- "offset": 0,
266
- "sortOrder": "DESC",
267
- "sortKey": "id",
268
- "statusId": 123,
269
- "statusMarker": "in_stock",
270
- "conditionValue": "new",
271
- "conditionMarker": "equals",
272
- "attributeMarker": "color"
273
- }
274
- * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 30.
275
- * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 0.
276
- * @param {string} [userQuery.sortOrder] - Optional sorting order "DESC" | "ASC". Example: "DESC".
277
- * @param {string} [userQuery.sortKey] - Optional field to sort by ("id", "title", "date", "price", "position", "status"). Example: "id".
278
- * @returns {Promise<IProductsResponse | IError>} Array with ProductEntity objects
279
- * @throws {IError} When isShell=false and an error occurs during the fetch
280
- * @description Find all related product page objects.
281
- */
282
- async getRelatedProductsById(id, langCode = this.state.lang, userQuery) {
283
- const query = { ...this._defaultQuery, ...userQuery };
284
- const result = await this._fetchGet(`/${id}/related?langCode=${langCode}&` + this._queryParamsToString(query));
285
- // Validate response if validation is enabled
286
- const validated = this._validateResponse(result, productsSchemas_1.ProductsResponseSchema);
287
- return this._dataPostProcess(validated, langCode);
288
- }
289
- /**
290
- * Find products by its ids.
291
- * @handleName getProductsByIds
292
- * @param {string} ids - Product page identifiers for which to find relationships. Example: "12345,67890".
293
- * @param {string} [langCode] - Language code. Default "en_US".
294
- * @param {IProductsQuery} [userQuery] - Optional set query parameters.
295
- * @example
296
- {
297
- "limit": 30,
298
- "offset": 0,
299
- "sortOrder": "DESC",
300
- "sortKey": "id",
301
- "statusId": 123,
302
- "statusMarker": "in_stock",
303
- "conditionValue": "new",
304
- "conditionMarker": "equals",
305
- "attributeMarker": "color"
306
- }
307
- * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 30.
308
- * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 0.
309
- * @param {string} [userQuery.sortOrder] - Optional sorting order "DESC" | "ASC". Example: "DESC".
310
- * @param {string} [userQuery.sortKey] - Optional field to sort by ("id", "title", "date", "price", "position", "status"). Example: "id".
311
- * @param {number} [userQuery.statusId] - Optional parameter - search by status id. Example: 123.
312
- * @param {string} [userQuery.statusMarker] - Optional identifier of the product page status. Example: "in_stock".
313
- * @param {string} [userQuery.conditionValue] - Optional value that is being searched. Example: "new".
314
- * @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered. Example: "equals".
315
- * @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered. Example: "color".
316
- * @returns {Promise<IProductsEntity[] | IError>} Array with ProductEntity objects
317
- * @throws {IError} When isShell=false and an error occurs during the fetch
318
- * @description Find products by its ids.
319
- */
320
- async getProductsByIds(ids, langCode = this.state.lang, userQuery) {
321
- const query = {
322
- ids,
323
- langCode,
324
- ...this._defaultQuery,
325
- ...userQuery,
326
- };
327
- const result = await this._fetchGet(`/ids?` + this._queryParamsToString(query));
328
- return this._dataPostProcess(result, langCode);
329
- }
330
- /**
331
- * Retrieve one product object.
332
- * @handleName getProductById
333
- * @param {number} id - Product id. Example: 12345.
334
- * @param {string} [langCode] - Language code. Default: "en_US".
335
- * @returns {Promise<IProductsEntity | IError>} ProductEntity object.
336
- * @throws {IError} When isShell=false and an error occurs during the fetch
337
- * @description Retrieve one product object.
338
- */
339
- async getProductById(id, langCode = this.state.lang) {
340
- const result = await this._fetchGet(`/${id}?langCode=${langCode}`);
341
- // Validate response if validation is enabled
342
- const validated = this._validateResponse(result, productsSchemas_1.ProductEntitySchema);
343
- return this._dataPostProcess(validated, langCode);
344
- }
345
- /**
346
- * Getting a product block object by product id.
347
- * @handleName getProductBlockById
348
- * @param {number} id - Product id. Example: 12345.
349
- * @returns {Promise<IProductBlock | IError>} - Product block object.
350
- * @throws {IError} When isShell=false and an error occurs during the fetch
351
- * @description Getting a product block object by product id.
352
- */
353
- async getProductBlockById(id) {
354
- const response = await this._fetchGet(`/${id}/blocks`);
355
- return this._normalizeData(response);
356
- }
357
- /**
358
- * Quick search for product page objects with limited output.
359
- * @handleName searchProduct
360
- * @param {string} name - Text to search product page objects (search is based on the title field of the localizeInfos object with language consideration). Example: "laminat".
361
- * @param {string} [langCode] - Language code. Default: "en_US".
362
- * @returns {Promise<IProductsEntity[] | IError>} Array with ProductEntity objects
363
- * @throws {IError} When isShell=false and an error occurs during the fetch
364
- * @description Quick search for product page objects with limited output.
365
- */
366
- async searchProduct(name, langCode = this.state.lang) {
367
- const searchProducts = await this._fetchGet(`/quick/search?langCode=${langCode}&name=${name}`);
368
- if (!this.state.traficLimit) {
369
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
370
- const productsList = [];
371
- await Promise.all(searchProducts.map(async (product) => {
372
- await this.getProductById(product.id, langCode).then((result) => {
373
- productsList.push(result);
374
- });
375
- }));
376
- return this._dataPostProcess(productsList, langCode);
377
- }
378
- return searchProducts;
379
- }
380
- /**
381
- * Getting the number of products for the entire catalog.
382
- * @handleName getProductsCount
383
- * @param {any[]} body - Body parameters for filter. Deault: [].
384
- * @example
385
- [
386
- {
387
- "attributeMarker": "price",
388
- "conditionMarker": "in",
389
- "statusMarker": "status_1",
390
- "conditionValue": {},
391
- "pageUrls": [
392
- "23-laminat-floorwood-maxima"
393
- ],
394
- "title": "Iphone 17 Pro"
395
- }
396
- ]
397
- * @returns {Promise<IProductsCount | IError>} Object with product items count.
398
- * @throws {IError} When isShell=false and an error occurs during the fetch
399
- * @description This method calculates and returns the total number of products present across the entire catalog, optionally applying specified filters.
400
- */
401
- async getProductsCount(
402
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
403
- body = []) {
404
- const result = await this._fetchPost(`/all/counts`, body);
405
- return result;
406
- }
407
- /**
408
- * Getting the number of products on a catalog page by page ID.
409
- * @handleName getProductsCountByPageId
410
- * @param {string} id - Page ID.
411
- * @param {any[]} body - Body parameters for filter. Deault: [].
412
- * @example
413
- [
414
- {
415
- "attributeMarker": "price",
416
- "conditionMarker": "in",
417
- "statusMarker": "status_1",
418
- "conditionValue": {},
419
- "pageUrls": [
420
- "23-laminat-floorwood-maxima"
421
- ],
422
- "title": "Iphone 17 Pro"
423
- }
424
- ]
425
- * @returns {Promise<IProductsCount | IError>} Object with product items count.
426
- * @throws {IError} When isShell=false and an error occurs during the fetch
427
- * @description This method calculates and returns the number of products available on a given catalog page, identified by its page ID, with optional filtering.
428
- */
429
- async getProductsCountByPageId(id,
430
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
431
- body = []) {
432
- const result = await this._fetchPost(`/page/${id}/counts`, body);
433
- return result;
434
- }
435
- /**
436
- * Getting the number of products for the catalog page by page url.
437
- * @handleName getProductsCountByPageUrl
438
- * @param {string} url - Page url.
439
- * @param {any[]} body - Body parameters for filter. Deault: [].
440
- * @example
441
- [
442
- {
443
- "attributeMarker": "price",
444
- "conditionMarker": "in",
445
- "statusMarker": "status_1",
446
- "conditionValue": {},
447
- "pageUrls": [
448
- "23-laminat-floorwood-maxima"
449
- ],
450
- "title": "Iphone 17 Pro"
451
- }
452
- ]
453
- * @returns {Promise<IProductsCount | IError>} Object with product items count.
454
- * @throws {IError} When isShell=false and an error occurs during the fetch
455
- * @description This method calculates and returns the number of products available on a given catalog page, identified by its URL, with optional filtering.
456
- */
457
- async getProductsCountByPageUrl(url,
458
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
459
- body = []) {
460
- const result = await this._fetchPost(`/page/url/${url}/counts`, body);
461
- return result;
462
- }
463
- }
464
- exports.default = ProductApi;