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