oneentry 1.0.141 → 1.0.142

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 (150) hide show
  1. package/configure.js +107 -15
  2. package/package.json +81 -3
  3. package/dist/admins/adminsApi.d.ts +0 -50
  4. package/dist/admins/adminsApi.js +0 -65
  5. package/dist/admins/adminsInterfaces.d.ts +0 -99
  6. package/dist/admins/adminsInterfaces.js +0 -2
  7. package/dist/admins/adminsSchemas.d.ts +0 -30
  8. package/dist/admins/adminsSchemas.js +0 -27
  9. package/dist/attribute-sets/attributeSetsApi.d.ts +0 -63
  10. package/dist/attribute-sets/attributeSetsApi.js +0 -98
  11. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +0 -187
  12. package/dist/attribute-sets/attributeSetsInterfaces.js +0 -2
  13. package/dist/attribute-sets/attributeSetsSchemas.d.ts +0 -90
  14. package/dist/attribute-sets/attributeSetsSchemas.js +0 -74
  15. package/dist/auth-provider/authProviderApi.d.ts +0 -249
  16. package/dist/auth-provider/authProviderApi.js +0 -351
  17. package/dist/auth-provider/authProviderSchemas.d.ts +0 -131
  18. package/dist/auth-provider/authProviderSchemas.js +0 -82
  19. package/dist/auth-provider/authProvidersInterfaces.d.ts +0 -425
  20. package/dist/auth-provider/authProvidersInterfaces.js +0 -2
  21. package/dist/base/asyncModules.d.ts +0 -80
  22. package/dist/base/asyncModules.js +0 -440
  23. package/dist/base/result.d.ts +0 -39
  24. package/dist/base/result.js +0 -154
  25. package/dist/base/stateModule.d.ts +0 -41
  26. package/dist/base/stateModule.js +0 -128
  27. package/dist/base/syncModules.d.ts +0 -149
  28. package/dist/base/syncModules.js +0 -549
  29. package/dist/base/utils.d.ts +0 -197
  30. package/dist/base/utils.js +0 -2
  31. package/dist/base/validation.d.ts +0 -118
  32. package/dist/base/validation.js +0 -132
  33. package/dist/blocks/blocksApi.d.ts +0 -76
  34. package/dist/blocks/blocksApi.js +0 -188
  35. package/dist/blocks/blocksInterfaces.d.ts +0 -173
  36. package/dist/blocks/blocksInterfaces.js +0 -2
  37. package/dist/blocks/blocksSchemas.d.ts +0 -187
  38. package/dist/blocks/blocksSchemas.js +0 -43
  39. package/dist/discounts/discountsApi.d.ts +0 -56
  40. package/dist/discounts/discountsApi.js +0 -82
  41. package/dist/discounts/discountsInterfaces.d.ts +0 -145
  42. package/dist/discounts/discountsInterfaces.js +0 -2
  43. package/dist/events/eventsApi.d.ts +0 -60
  44. package/dist/events/eventsApi.js +0 -97
  45. package/dist/events/eventsInterfaces.d.ts +0 -87
  46. package/dist/events/eventsInterfaces.js +0 -2
  47. package/dist/file-uploading/fileUploadingApi.d.ts +0 -88
  48. package/dist/file-uploading/fileUploadingApi.js +0 -132
  49. package/dist/file-uploading/fileUploadingInterfaces.d.ts +0 -117
  50. package/dist/file-uploading/fileUploadingInterfaces.js +0 -2
  51. package/dist/file-uploading/fileUploadingSchemas.d.ts +0 -22
  52. package/dist/file-uploading/fileUploadingSchemas.js +0 -21
  53. package/dist/forms/formsApi.d.ts +0 -42
  54. package/dist/forms/formsApi.js +0 -57
  55. package/dist/forms/formsInterfaces.d.ts +0 -132
  56. package/dist/forms/formsInterfaces.js +0 -2
  57. package/dist/forms/formsSchemas.d.ts +0 -50
  58. package/dist/forms/formsSchemas.js +0 -31
  59. package/dist/forms-data/formsDataApi.d.ts +0 -106
  60. package/dist/forms-data/formsDataApi.js +0 -189
  61. package/dist/forms-data/formsDataInterfaces.d.ts +0 -525
  62. package/dist/forms-data/formsDataInterfaces.js +0 -2
  63. package/dist/forms-data/formsDataSchemas.d.ts +0 -115
  64. package/dist/forms-data/formsDataSchemas.js +0 -86
  65. package/dist/general-types/generalTypesApi.d.ts +0 -28
  66. package/dist/general-types/generalTypesApi.js +0 -38
  67. package/dist/general-types/generalTypesInterfaces.d.ts +0 -30
  68. package/dist/general-types/generalTypesInterfaces.js +0 -2
  69. package/dist/general-types/generalTypesSchemas.d.ts +0 -50
  70. package/dist/general-types/generalTypesSchemas.js +0 -35
  71. package/dist/index.d.ts +0 -100
  72. package/dist/index.js +0 -103
  73. package/dist/integration-collections/integrationCollectionsApi.d.ts +0 -173
  74. package/dist/integration-collections/integrationCollectionsApi.js +0 -220
  75. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +0 -313
  76. package/dist/integration-collections/integrationCollectionsInterfaces.js +0 -2
  77. package/dist/integration-collections/integrationCollectionsSchemas.d.ts +0 -80
  78. package/dist/integration-collections/integrationCollectionsSchemas.js +0 -61
  79. package/dist/locales/localesApi.d.ts +0 -27
  80. package/dist/locales/localesApi.js +0 -37
  81. package/dist/locales/localesInterfaces.d.ts +0 -41
  82. package/dist/locales/localesInterfaces.js +0 -2
  83. package/dist/locales/localesSchemas.d.ts +0 -32
  84. package/dist/locales/localesSchemas.js +0 -26
  85. package/dist/menus/menusApi.d.ts +0 -29
  86. package/dist/menus/menusApi.js +0 -39
  87. package/dist/menus/menusInterfaces.d.ts +0 -88
  88. package/dist/menus/menusInterfaces.js +0 -4
  89. package/dist/menus/menusSchemas.d.ts +0 -16
  90. package/dist/menus/menusSchemas.js +0 -28
  91. package/dist/orders/ordersApi.d.ts +0 -149
  92. package/dist/orders/ordersApi.js +0 -203
  93. package/dist/orders/ordersInterfaces.d.ts +0 -527
  94. package/dist/orders/ordersInterfaces.js +0 -2
  95. package/dist/orders/ordersSchemas.d.ts +0 -120
  96. package/dist/orders/ordersSchemas.js +0 -101
  97. package/dist/pages/pagesApi.d.ts +0 -151
  98. package/dist/pages/pagesApi.js +0 -390
  99. package/dist/pages/pagesInterfaces.d.ts +0 -292
  100. package/dist/pages/pagesInterfaces.js +0 -2
  101. package/dist/pages/pagesSchemas.d.ts +0 -85
  102. package/dist/pages/pagesSchemas.js +0 -46
  103. package/dist/payments/paymentsApi.d.ts +0 -82
  104. package/dist/payments/paymentsApi.js +0 -121
  105. package/dist/payments/paymentsInterfaces.d.ts +0 -206
  106. package/dist/payments/paymentsInterfaces.js +0 -2
  107. package/dist/payments/paymentsSchemas.d.ts +0 -100
  108. package/dist/payments/paymentsSchemas.js +0 -65
  109. package/dist/product-statuses/productStatusesApi.d.ts +0 -47
  110. package/dist/product-statuses/productStatusesApi.js +0 -70
  111. package/dist/product-statuses/productStatusesInterfaces.d.ts +0 -66
  112. package/dist/product-statuses/productStatusesInterfaces.js +0 -2
  113. package/dist/product-statuses/productStatusesSchemas.d.ts +0 -34
  114. package/dist/product-statuses/productStatusesSchemas.js +0 -30
  115. package/dist/products/productsApi.d.ts +0 -365
  116. package/dist/products/productsApi.js +0 -459
  117. package/dist/products/productsInterfaces.d.ts +0 -586
  118. package/dist/products/productsInterfaces.js +0 -2
  119. package/dist/products/productsSchemas.d.ts +0 -192
  120. package/dist/products/productsSchemas.js +0 -96
  121. package/dist/sitemap/sitemapApi.d.ts +0 -35
  122. package/dist/sitemap/sitemapApi.js +0 -45
  123. package/dist/sitemap/sitemapInterfaces.d.ts +0 -40
  124. package/dist/sitemap/sitemapInterfaces.js +0 -2
  125. package/dist/system/systemApi.d.ts +0 -43
  126. package/dist/system/systemApi.js +0 -58
  127. package/dist/system/systemInterfaces.d.ts +0 -31
  128. package/dist/system/systemInterfaces.js +0 -5
  129. package/dist/templates/templatesApi.d.ts +0 -49
  130. package/dist/templates/templatesApi.js +0 -75
  131. package/dist/templates/templatesInterfaces.d.ts +0 -70
  132. package/dist/templates/templatesInterfaces.js +0 -2
  133. package/dist/templates/templatesSchemas.d.ts +0 -48
  134. package/dist/templates/templatesSchemas.js +0 -31
  135. package/dist/templates-preview/templatesPreviewApi.d.ts +0 -38
  136. package/dist/templates-preview/templatesPreviewApi.js +0 -53
  137. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +0 -121
  138. package/dist/templates-preview/templatesPreviewInterfaces.js +0 -2
  139. package/dist/templates-preview/templatesPreviewSchemas.d.ts +0 -83
  140. package/dist/templates-preview/templatesPreviewSchemas.js +0 -48
  141. package/dist/users/usersApi.d.ts +0 -143
  142. package/dist/users/usersApi.js +0 -173
  143. package/dist/users/usersInterfaces.d.ts +0 -235
  144. package/dist/users/usersInterfaces.js +0 -2
  145. package/dist/users/usersSchemas.d.ts +0 -38
  146. package/dist/users/usersSchemas.js +0 -28
  147. package/dist/web-socket/wsApi.d.ts +0 -25
  148. package/dist/web-socket/wsApi.js +0 -45
  149. package/dist/web-socket/wsInterfaces.d.ts +0 -17
  150. package/dist/web-socket/wsInterfaces.js +0 -2
@@ -1,459 +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 ProductsApi extends asyncModules_1.default {
15
- /**
16
- * Constructor
17
- * @param {StateModule} state - StateModule instance
18
- * @description Constructor initializes the ProductsApi 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
- * @param {boolean} [isNormalized] - If true, the product object will be normalized.
327
- * @returns {Promise<IProductsEntity | IError>} ProductEntity object.
328
- * @throws {IError} When isShell=false and an error occurs during the fetch
329
- * @description Retrieve one product object.
330
- */
331
- async getProductById(id, langCode = this.state.lang, isNormalized) {
332
- const query = { langCode };
333
- if (isNormalized !== undefined)
334
- query.isNormalized = isNormalized;
335
- const result = await this._fetchGet(`/${id}?` + this._queryParamsToString(query));
336
- // Validate response if validation is enabled
337
- const validated = this._validateResponse(result, productsSchemas_1.ProductEntitySchema);
338
- return this._dataPostProcess(validated, langCode);
339
- }
340
- /**
341
- * Getting a product block object by product id.
342
- * @handleName getProductBlockById
343
- * @param {number} id - Product id. Example: 12345.
344
- * @returns {Promise<IProductBlock | IError>} - Product block object.
345
- * @throws {IError} When isShell=false and an error occurs during the fetch
346
- * @description Getting a product block object by product id.
347
- */
348
- async getProductBlockById(id) {
349
- const response = await this._fetchGet(`/${id}/blocks`);
350
- return this._normalizeData(response);
351
- }
352
- /**
353
- * Quick search for product page objects with limited output.
354
- * @handleName searchProduct
355
- * @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".
356
- * @param {string} [langCode] - Language code. Default: "en_US".
357
- * @returns {Promise<IProductsEntity[] | IError>} Array with ProductEntity objects
358
- * @throws {IError} When isShell=false and an error occurs during the fetch
359
- * @description Quick search for product page objects with limited output.
360
- */
361
- async searchProduct(name, langCode = this.state.lang) {
362
- const searchProducts = await this._fetchGet(`/quick/search?langCode=${langCode}&name=${name}`);
363
- if (!this.state.traficLimit) {
364
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
365
- const productsList = [];
366
- await Promise.all(searchProducts.map(async (product) => {
367
- await this.getProductById(product.id, langCode).then((result) => {
368
- productsList.push(result);
369
- });
370
- }));
371
- return this._dataPostProcess(productsList, langCode);
372
- }
373
- return searchProducts;
374
- }
375
- /**
376
- * Getting the number of products for the entire catalog.
377
- * @handleName getProductsCount
378
- * @param {any[]} body - Body parameters for filter. Deault: [].
379
- * @example
380
- [
381
- {
382
- "attributeMarker": "price",
383
- "conditionMarker": "in",
384
- "statusMarker": "status_1",
385
- "conditionValue": {},
386
- "pageUrls": [
387
- "23-laminat-floorwood-maxima"
388
- ],
389
- "title": "Iphone 17 Pro"
390
- }
391
- ]
392
- * @returns {Promise<IProductsCount | IError>} Object with product items count.
393
- * @throws {IError} When isShell=false and an error occurs during the fetch
394
- * @description This method calculates and returns the total number of products present across the entire catalog, optionally applying specified filters.
395
- */
396
- async getProductsCount(
397
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
398
- body = []) {
399
- const result = await this._fetchPost(`/all/counts`, body);
400
- return result;
401
- }
402
- /**
403
- * Getting the number of products on a catalog page by page ID.
404
- * @handleName getProductsCountByPageId
405
- * @param {string} id - Page ID.
406
- * @param {any[]} body - Body parameters for filter. Deault: [].
407
- * @example
408
- [
409
- {
410
- "attributeMarker": "price",
411
- "conditionMarker": "in",
412
- "statusMarker": "status_1",
413
- "conditionValue": {},
414
- "pageUrls": [
415
- "23-laminat-floorwood-maxima"
416
- ],
417
- "title": "Iphone 17 Pro"
418
- }
419
- ]
420
- * @returns {Promise<IProductsCount | IError>} Object with product items count.
421
- * @throws {IError} When isShell=false and an error occurs during the fetch
422
- * @description This method calculates and returns the number of products available on a given catalog page, identified by its page ID, with optional filtering.
423
- */
424
- async getProductsCountByPageId(id,
425
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
426
- body = []) {
427
- const result = await this._fetchPost(`/page/${id}/counts`, body);
428
- return result;
429
- }
430
- /**
431
- * Getting the number of products for the catalog page by page url.
432
- * @handleName getProductsCountByPageUrl
433
- * @param {string} url - Page url.
434
- * @param {any[]} body - Body parameters for filter. Deault: [].
435
- * @example
436
- [
437
- {
438
- "attributeMarker": "price",
439
- "conditionMarker": "in",
440
- "statusMarker": "status_1",
441
- "conditionValue": {},
442
- "pageUrls": [
443
- "23-laminat-floorwood-maxima"
444
- ],
445
- "title": "Iphone 17 Pro"
446
- }
447
- ]
448
- * @returns {Promise<IProductsCount | IError>} Object with product items count.
449
- * @throws {IError} When isShell=false and an error occurs during the fetch
450
- * @description This method calculates and returns the number of products available on a given catalog page, identified by its URL, with optional filtering.
451
- */
452
- async getProductsCountByPageUrl(url,
453
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
454
- body = []) {
455
- const result = await this._fetchPost(`/page/url/${url}/counts`, body);
456
- return result;
457
- }
458
- }
459
- exports.default = ProductsApi;