oneentry 1.0.176 → 1.0.178

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 (199) hide show
  1. package/README.md +12 -5
  2. package/changelog.md +116 -0
  3. package/dist/admins/adminsApi.js +2 -9
  4. package/dist/admins/adminsInterfaces.d.ts +5 -5
  5. package/dist/admins/adminsSchemas.d.ts +4 -4
  6. package/dist/admins/adminsSchemas.js +2 -2
  7. package/dist/attribute-sets/attributeSetsApi.d.ts +1 -1
  8. package/dist/attribute-sets/attributeSetsApi.js +4 -4
  9. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +65 -14
  10. package/dist/attribute-sets/attributeSetsSchemas.d.ts +8 -6
  11. package/dist/attribute-sets/attributeSetsSchemas.js +6 -9
  12. package/dist/auth-provider/authProviderApi.d.ts +4 -4
  13. package/dist/auth-provider/authProviderApi.js +90 -23
  14. package/dist/auth-provider/authProviderSchemas.d.ts +1 -0
  15. package/dist/auth-provider/authProviderSchemas.js +1 -0
  16. package/dist/auth-provider/authProvidersInterfaces.d.ts +8 -6
  17. package/dist/base/asyncModules.d.ts +62 -1
  18. package/dist/base/asyncModules.js +219 -37
  19. package/dist/base/stateModule.d.ts +2 -0
  20. package/dist/base/stateModule.js +22 -12
  21. package/dist/base/syncModules.d.ts +18 -10
  22. package/dist/base/syncModules.js +100 -29
  23. package/dist/base/utils.d.ts +26 -21
  24. package/dist/base/validation.d.ts +3 -3
  25. package/dist/base/validation.js +6 -7
  26. package/dist/blocks/blocksApi.d.ts +20 -17
  27. package/dist/blocks/blocksApi.js +82 -64
  28. package/dist/blocks/blocksInterfaces.d.ts +8 -8
  29. package/dist/discounts/discountsApi.d.ts +9 -7
  30. package/dist/discounts/discountsApi.js +16 -13
  31. package/dist/discounts/discountsInterfaces.d.ts +14 -10
  32. package/dist/events/eventsApi.d.ts +3 -3
  33. package/dist/events/eventsApi.js +3 -3
  34. package/dist/events/eventsInterfaces.d.ts +10 -14
  35. package/dist/file-uploading/fileUploadingApi.d.ts +4 -4
  36. package/dist/file-uploading/fileUploadingApi.js +13 -5
  37. package/dist/file-uploading/fileUploadingInterfaces.d.ts +5 -6
  38. package/dist/filters/filtersApi.js +2 -2
  39. package/dist/forms/formsApi.js +2 -2
  40. package/dist/forms/formsInterfaces.d.ts +1 -3
  41. package/dist/forms/formsSchemas.d.ts +3 -6
  42. package/dist/forms/formsSchemas.js +2 -4
  43. package/dist/forms-data/formsDataApi.d.ts +27 -1
  44. package/dist/forms-data/formsDataApi.js +119 -68
  45. package/dist/forms-data/formsDataInterfaces.d.ts +17 -13
  46. package/dist/general-types/generalTypesInterfaces.d.ts +1 -1
  47. package/dist/index.d.ts +7 -6
  48. package/dist/index.js +50 -7
  49. package/dist/integration-collections/integrationCollectionsApi.d.ts +15 -4
  50. package/dist/integration-collections/integrationCollectionsApi.js +41 -14
  51. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +8 -9
  52. package/dist/integration-collections/integrationCollectionsSchemas.d.ts +0 -2
  53. package/dist/integration-collections/integrationCollectionsSchemas.js +0 -1
  54. package/dist/menus/menusApi.js +1 -1
  55. package/dist/orders/ordersApi.d.ts +1 -13
  56. package/dist/orders/ordersApi.js +21 -42
  57. package/dist/orders/ordersInterfaces.d.ts +21 -14
  58. package/dist/pages/pagesApi.d.ts +8 -6
  59. package/dist/pages/pagesApi.js +48 -33
  60. package/dist/pages/pagesInterfaces.d.ts +20 -16
  61. package/dist/pages/pagesSchemas.d.ts +0 -3
  62. package/dist/pages/pagesSchemas.js +0 -1
  63. package/dist/payments/paymentsApi.d.ts +10 -11
  64. package/dist/payments/paymentsApi.js +22 -18
  65. package/dist/payments/paymentsInterfaces.d.ts +12 -14
  66. package/dist/payments/paymentsSchemas.d.ts +21 -20
  67. package/dist/payments/paymentsSchemas.js +5 -8
  68. package/dist/product-statuses/productStatusesApi.d.ts +1 -1
  69. package/dist/product-statuses/productStatusesApi.js +3 -3
  70. package/dist/product-statuses/productStatusesInterfaces.d.ts +1 -4
  71. package/dist/products/productsApi.d.ts +50 -64
  72. package/dist/products/productsApi.js +79 -80
  73. package/dist/products/productsInterfaces.d.ts +59 -90
  74. package/dist/search/searchApi.d.ts +3 -2
  75. package/dist/search/searchApi.js +7 -4
  76. package/dist/search/searchInterfaces.d.ts +2 -1
  77. package/dist/sitemap/sitemapInterfaces.d.ts +10 -6
  78. package/dist/subscriptions/subscriptionsApi.d.ts +1 -1
  79. package/dist/subscriptions/subscriptionsApi.js +1 -1
  80. package/dist/subscriptions/subscriptionsInterfaces.d.ts +1 -1
  81. package/dist/system/systemApi.d.ts +2 -0
  82. package/dist/system/systemApi.js +2 -0
  83. package/dist/system/systemInterfaces.d.ts +2 -0
  84. package/dist/templates/templatesApi.d.ts +2 -2
  85. package/dist/templates/templatesApi.js +12 -11
  86. package/dist/templates/templatesInterfaces.d.ts +2 -2
  87. package/dist/templates-preview/templatesPreviewApi.js +2 -2
  88. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +23 -13
  89. package/dist/templates-preview/templatesPreviewSchemas.d.ts +7 -0
  90. package/dist/templates-preview/templatesPreviewSchemas.js +2 -0
  91. package/dist/user-groups/userGroupsApi.js +5 -5
  92. package/dist/user-groups/userGroupsSchemas.d.ts +4 -4
  93. package/dist/users/usersApi.d.ts +1 -1
  94. package/dist/users/usersApi.js +28 -15
  95. package/dist/users/usersInterfaces.d.ts +2 -9
  96. package/dist/web-socket/lazySocket.d.ts +6 -5
  97. package/dist/web-socket/lazySocket.js +212 -15
  98. package/dist/web-socket/wsApi.d.ts +7 -4
  99. package/dist/web-socket/wsApi.js +49 -12
  100. package/dist/web-socket/wsInterfaces.d.ts +41 -4
  101. package/esm/admins/adminsApi.js +2 -9
  102. package/esm/admins/adminsInterfaces.d.ts +5 -5
  103. package/esm/admins/adminsSchemas.d.ts +4 -4
  104. package/esm/admins/adminsSchemas.js +2 -2
  105. package/esm/attribute-sets/attributeSetsApi.d.ts +1 -1
  106. package/esm/attribute-sets/attributeSetsApi.js +4 -4
  107. package/esm/attribute-sets/attributeSetsInterfaces.d.ts +65 -14
  108. package/esm/attribute-sets/attributeSetsSchemas.d.ts +8 -6
  109. package/esm/attribute-sets/attributeSetsSchemas.js +6 -9
  110. package/esm/auth-provider/authProviderApi.d.ts +4 -4
  111. package/esm/auth-provider/authProviderApi.js +90 -23
  112. package/esm/auth-provider/authProviderSchemas.d.ts +1 -0
  113. package/esm/auth-provider/authProviderSchemas.js +1 -0
  114. package/esm/auth-provider/authProvidersInterfaces.d.ts +8 -6
  115. package/esm/base/asyncModules.d.ts +62 -1
  116. package/esm/base/asyncModules.js +219 -37
  117. package/esm/base/stateModule.d.ts +2 -0
  118. package/esm/base/stateModule.js +22 -12
  119. package/esm/base/syncModules.d.ts +18 -10
  120. package/esm/base/syncModules.js +99 -29
  121. package/esm/base/utils.d.ts +26 -21
  122. package/esm/base/validation.d.ts +3 -3
  123. package/esm/base/validation.js +6 -7
  124. package/esm/blocks/blocksApi.d.ts +20 -17
  125. package/esm/blocks/blocksApi.js +82 -64
  126. package/esm/blocks/blocksInterfaces.d.ts +8 -8
  127. package/esm/discounts/discountsApi.d.ts +9 -7
  128. package/esm/discounts/discountsApi.js +16 -13
  129. package/esm/discounts/discountsInterfaces.d.ts +14 -10
  130. package/esm/events/eventsApi.d.ts +3 -3
  131. package/esm/events/eventsApi.js +3 -3
  132. package/esm/events/eventsInterfaces.d.ts +10 -14
  133. package/esm/file-uploading/fileUploadingApi.d.ts +4 -4
  134. package/esm/file-uploading/fileUploadingApi.js +13 -5
  135. package/esm/file-uploading/fileUploadingInterfaces.d.ts +5 -6
  136. package/esm/filters/filtersApi.js +2 -2
  137. package/esm/forms/formsApi.js +2 -2
  138. package/esm/forms/formsInterfaces.d.ts +1 -3
  139. package/esm/forms/formsSchemas.d.ts +3 -6
  140. package/esm/forms/formsSchemas.js +2 -4
  141. package/esm/forms-data/formsDataApi.d.ts +27 -1
  142. package/esm/forms-data/formsDataApi.js +119 -68
  143. package/esm/forms-data/formsDataInterfaces.d.ts +17 -13
  144. package/esm/general-types/generalTypesInterfaces.d.ts +1 -1
  145. package/esm/index.d.ts +7 -6
  146. package/esm/index.js +50 -7
  147. package/esm/integration-collections/integrationCollectionsApi.d.ts +15 -4
  148. package/esm/integration-collections/integrationCollectionsApi.js +41 -14
  149. package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +8 -9
  150. package/esm/integration-collections/integrationCollectionsSchemas.d.ts +0 -2
  151. package/esm/integration-collections/integrationCollectionsSchemas.js +0 -1
  152. package/esm/menus/menusApi.js +1 -1
  153. package/esm/orders/ordersApi.d.ts +1 -13
  154. package/esm/orders/ordersApi.js +21 -42
  155. package/esm/orders/ordersInterfaces.d.ts +21 -14
  156. package/esm/pages/pagesApi.d.ts +8 -6
  157. package/esm/pages/pagesApi.js +48 -33
  158. package/esm/pages/pagesInterfaces.d.ts +20 -16
  159. package/esm/pages/pagesSchemas.d.ts +0 -3
  160. package/esm/pages/pagesSchemas.js +0 -1
  161. package/esm/payments/paymentsApi.d.ts +10 -11
  162. package/esm/payments/paymentsApi.js +22 -18
  163. package/esm/payments/paymentsInterfaces.d.ts +12 -14
  164. package/esm/payments/paymentsSchemas.d.ts +21 -20
  165. package/esm/payments/paymentsSchemas.js +5 -8
  166. package/esm/product-statuses/productStatusesApi.d.ts +1 -1
  167. package/esm/product-statuses/productStatusesApi.js +3 -3
  168. package/esm/product-statuses/productStatusesInterfaces.d.ts +1 -4
  169. package/esm/products/productsApi.d.ts +50 -64
  170. package/esm/products/productsApi.js +79 -80
  171. package/esm/products/productsInterfaces.d.ts +59 -90
  172. package/esm/search/searchApi.d.ts +3 -2
  173. package/esm/search/searchApi.js +7 -4
  174. package/esm/search/searchInterfaces.d.ts +2 -1
  175. package/esm/sitemap/sitemapInterfaces.d.ts +10 -6
  176. package/esm/subscriptions/subscriptionsApi.d.ts +1 -1
  177. package/esm/subscriptions/subscriptionsApi.js +1 -1
  178. package/esm/subscriptions/subscriptionsInterfaces.d.ts +1 -1
  179. package/esm/system/systemApi.d.ts +2 -0
  180. package/esm/system/systemApi.js +2 -0
  181. package/esm/system/systemInterfaces.d.ts +2 -0
  182. package/esm/templates/templatesApi.d.ts +2 -2
  183. package/esm/templates/templatesApi.js +11 -10
  184. package/esm/templates/templatesInterfaces.d.ts +2 -2
  185. package/esm/templates-preview/templatesPreviewApi.js +2 -2
  186. package/esm/templates-preview/templatesPreviewInterfaces.d.ts +23 -13
  187. package/esm/templates-preview/templatesPreviewSchemas.d.ts +7 -0
  188. package/esm/templates-preview/templatesPreviewSchemas.js +2 -0
  189. package/esm/user-groups/userGroupsApi.js +5 -5
  190. package/esm/user-groups/userGroupsSchemas.d.ts +4 -4
  191. package/esm/users/usersApi.d.ts +1 -1
  192. package/esm/users/usersApi.js +28 -15
  193. package/esm/users/usersInterfaces.d.ts +2 -9
  194. package/esm/web-socket/lazySocket.d.ts +6 -5
  195. package/esm/web-socket/lazySocket.js +212 -15
  196. package/esm/web-socket/wsApi.d.ts +7 -4
  197. package/esm/web-socket/wsApi.js +49 -12
  198. package/esm/web-socket/wsInterfaces.d.ts +41 -4
  199. package/package.json +2 -2
@@ -42,7 +42,7 @@ interface IProductsApi {
42
42
  "offset": 0,
43
43
  "sortOrder": "DESC",
44
44
  "sortKey": "id",
45
- "signPrice": "orders"
45
+ "signPrice": "my_order"
46
46
  }
47
47
  * @returns {IProductsResponse} Array with ProductEntity objects
48
48
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
@@ -60,7 +60,7 @@ interface IProductsApi {
60
60
  "offset": 0,
61
61
  "sortOrder": "DESC",
62
62
  "sortKey": "id",
63
- "signPrice": "orders"
63
+ "signPrice": "my_order"
64
64
  }
65
65
  * @returns {Promise<IProductsResponse | IError>} Products without a category: `{ items, total }`, the same container as getProducts.
66
66
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
@@ -80,7 +80,7 @@ interface IProductsApi {
80
80
  "offset": 0,
81
81
  "sortOrder": "DESC",
82
82
  "sortKey": "id",
83
- "signPrice": "orders"
83
+ "signPrice": "my_order"
84
84
  }
85
85
  * @returns {IProductsResponse} Array with ProductEntity objects
86
86
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
@@ -98,7 +98,7 @@ interface IProductsApi {
98
98
  "limit": 30,
99
99
  "offset": 0,
100
100
  "sortOrder": "DESC",
101
- "signPrice": "orders",
101
+ "signPrice": "my_order",
102
102
  "statusMarker": "in_stock"
103
103
  }
104
104
  * @returns {IProductsInfo} Array with ProductInformation objects.
@@ -119,7 +119,7 @@ interface IProductsApi {
119
119
  "offset": 0,
120
120
  "sortOrder": "DESC",
121
121
  "sortKey": "id",
122
- "signPrice": "orders"
122
+ "signPrice": "my_order"
123
123
  }
124
124
  * @returns {IProductsResponse} Array with ProductEntity objects.
125
125
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
@@ -138,7 +138,7 @@ interface IProductsApi {
138
138
  "offset": 0,
139
139
  "sortOrder": "DESC",
140
140
  "sortKey": "id",
141
- "signPrice": "orders",
141
+ "signPrice": "my_order",
142
142
  "statusMarker": "in_stock",
143
143
  "templateMarker": "template_12345"
144
144
  }
@@ -150,14 +150,14 @@ interface IProductsApi {
150
150
  /**
151
151
  * Find products by its ids.
152
152
  * @handleName getProductsByIds
153
- * @param {string} ids - Comma-separated IDs of the product pages to fetch. Example: "12345,67890".
153
+ * @param {string} ids - Comma-separated product IDs. Unknown ids are dropped and repeated ones collapsed; a non-numeric one answers `400 Incorrect request`. Example: "12345,67890".
154
154
  * @param {string} [langCode] - Language code. Default: "en_US".
155
155
  * @param {IProductsByIdsQuery} [userQuery] - Optional query parameters.
156
156
  * @example
157
157
  {
158
158
  "limit": 30,
159
159
  "offset": 0,
160
- "signPrice": "orders"
160
+ "signPrice": "my_order"
161
161
  }
162
162
  * @returns {IProductsEntity[]} Array with ProductEntity objects
163
163
  * @throws {IError} If there is an error during the fetch operation, it will return an error object.
@@ -169,31 +169,35 @@ interface IProductsApi {
169
169
  * @handleName getProductById
170
170
  * @param {number} id - Product ID. Example: 12345.
171
171
  * @param {string} [langCode] - Language code. Default: "en_US".
172
- * @param {boolean} [isNormalized] - When `true`, the product is returned in normalized form.
172
+ * @param {boolean} [isNormalized] - Deprecated: the API no longer reads it, the answer is the same with `true`, `false` or without it. Kept for compatibility.
173
+ * @param {string} [signPrice] - Marker of an orders storage to fix the price for; the product then carries a `signedPrice`. An unknown marker answers `404`.
173
174
  * @returns {IProductsEntity} ProductEntity object.
174
175
  * @throws {IError} If there is an error during the fetch operation, it will return an error object.
175
176
  * @description This method retrieves one product object.
176
177
  */
177
- getProductById(id: number, langCode?: string, isNormalized?: boolean): Promise<IProductsEntity | IError>;
178
+ getProductById(id: number, langCode?: string, isNormalized?: boolean, signPrice?: string): Promise<IProductsEntity | IError>;
178
179
  /**
179
180
  * Getting a product block object by product id.
180
181
  * @handleName getProductBlockById
181
182
  * @param {number} id - Product ID. Example: 12345.
182
- * @returns {IProductBlock}
183
+ * @param {string} [langCode] - Language code. Default: the client's language.
184
+ * @returns {IProductBlock[]} Array of the product's block objects.
183
185
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
184
186
  * @description This method gets a product block object by product id.
185
187
  */
186
- getProductBlockById(id: number): Promise<IProductBlock[] | IError>;
188
+ getProductBlockById(id: number, langCode?: string): Promise<IProductBlock[] | IError>;
187
189
  /**
188
190
  * Quick search for product page objects with limited output.
189
191
  * @handleName searchProduct
190
192
  * @param {string} name - Text to search for in product titles (`localizeInfos.title`) in the requested language. Example: 'laminat'.
191
193
  * @param {string} [langCode] - Language code. Default: "en_US".
194
+ * @param {string} [url] - URL of a catalog page to search within that category. Default: the whole catalog.
195
+ * @param {boolean} [correct] - Correct typos by the project's search dictionary first. The API defaults to `true`; pass `false` to search the query as is.
192
196
  * @returns {IProductsEntity[] | IProductSearchResult[]} Array with ProductEntity objects, or an array with short ProductSearchResult cards when the traficLimit config option is enabled
193
197
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
194
198
  * @description This method performs a quick search for product page objects with limited output. With traficLimit enabled the raw quick search response is returned as short cards; otherwise full product entities are fetched for the found ids.
195
199
  */
196
- searchProduct(name: string, langCode?: string): Promise<IProductsEntity[] | IProductSearchResult[] | IError>;
200
+ searchProduct(name: string, langCode?: string, url?: string, correct?: boolean): Promise<IProductsEntity[] | IProductSearchResult[] | IError>;
197
201
  /**
198
202
  * Getting the number of products for the entire catalog.
199
203
  * @handleName getProductsCount
@@ -202,30 +206,16 @@ interface IProductsApi {
202
206
  [
203
207
  {
204
208
  "attributeMarker": "price",
205
- "conditionMarker": "in",
206
- "statusMarker": "status_1",
207
- "conditionValue": {},
208
- "pageUrls": [
209
- "23-laminat-floorwood-maxima"
210
- ],
211
- "title": "Iphone 17 Pro"
212
- },
213
- {
214
- "attributeMarker": "price",
215
- "conditionMarker": "in",
216
- "statusMarker": "status_1",
217
- "conditionValue": {},
218
- "pageUrls": [
219
- "23-laminat-floorwood-maxima"
220
- ],
221
- "title": "Iphone 17 Pro"
209
+ "conditionMarker": "eq",
210
+ "conditionValue": 51
222
211
  }
223
212
  ]
224
213
  * @returns {IProductsCount} Object with product items count.
225
214
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
215
+ * @param {string} [langCode] - Language code. Default: "en_US". Must be an active language of the project — an inactive one answers `400`; the count reflects products visible in that language.
226
216
  * @description This method calculates and returns the total number of products present across the entire catalog, optionally applying specified filters.
227
217
  */
228
- getProductsCount(body?: object[]): Promise<IProductsCount | IError>;
218
+ getProductsCount(body?: object[], langCode?: string): Promise<IProductsCount | IError>;
229
219
  /**
230
220
  * Getting the number of products on a catalog page by page ID.
231
221
  * @handleName getProductsCountByPageId
@@ -235,63 +225,35 @@ interface IProductsApi {
235
225
  [
236
226
  {
237
227
  "attributeMarker": "price",
238
- "conditionMarker": "in",
239
- "statusMarker": "status_1",
240
- "conditionValue": {},
241
- "pageUrls": [
242
- "23-laminat-floorwood-maxima"
243
- ],
244
- "title": "Iphone 17 Pro"
245
- },
246
- {
247
- "attributeMarker": "price",
248
- "conditionMarker": "in",
249
- "statusMarker": "status_1",
250
- "conditionValue": {},
251
- "pageUrls": [
252
- "23-laminat-floorwood-maxima"
253
- ],
254
- "title": "Iphone 17 Pro"
228
+ "conditionMarker": "eq",
229
+ "conditionValue": 51
255
230
  }
256
231
  ]
257
232
  * @returns {IProductsCount} Object with product items count.
258
233
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
234
+ * @param {string} [langCode] - Language code. Default: "en_US". Must be an active language of the project — an inactive one answers `400`; the count reflects products visible in that language.
259
235
  * @description This method calculates and returns the number of products available on a given catalog page, identified by its page ID, with optional filtering.
260
236
  */
261
- getProductsCountByPageId(id: number | string, body?: object[]): Promise<IProductsCount | IError>;
237
+ getProductsCountByPageId(id: number | string, body?: object[], langCode?: string): Promise<IProductsCount | IError>;
262
238
  /**
263
239
  * Getting the number of products on a catalog page by page URL.
264
240
  * @handleName getProductsCountByPageUrl
265
241
  * @param {string} url - Page URL. Example: "catalog".
266
- * @param {string} body - Filter objects with search conditions. Default: `[]`.
242
+ * @param {object[]} [body] - Filter objects with search conditions. Default: `[]`.
267
243
  * @example
268
244
  [
269
245
  {
270
246
  "attributeMarker": "price",
271
- "conditionMarker": "in",
272
- "statusMarker": "status_1",
273
- "conditionValue": {},
274
- "pageUrls": [
275
- "23-laminat-floorwood-maxima"
276
- ],
277
- "title": "Iphone 17 Pro"
278
- },
279
- {
280
- "attributeMarker": "price",
281
- "conditionMarker": "in",
282
- "statusMarker": "status_1",
283
- "conditionValue": {},
284
- "pageUrls": [
285
- "23-laminat-floorwood-maxima"
286
- ],
287
- "title": "Iphone 17 Pro"
247
+ "conditionMarker": "eq",
248
+ "conditionValue": 51
288
249
  }
289
250
  ]
290
251
  * @returns {IProductsCount} Object with product items count.
291
252
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
253
+ * @param {string} [langCode] - Language code. Default: "en_US". Must be an active language of the project — an inactive one answers `400`; the count reflects products visible in that language.
292
254
  * @description This method calculates and returns the number of products available on a given catalog page, identified by its URL, with optional filtering.
293
255
  */
294
- getProductsCountByPageUrl(url: string, body?: object[]): Promise<IProductsCount | IError>;
256
+ getProductsCountByPageUrl(url: string, body?: object[], langCode?: string): Promise<IProductsCount | IError>;
295
257
  /**
296
258
  * Semantic (vector) search for products.
297
259
  * @handleName getProductsByVectorSearch
@@ -311,7 +273,7 @@ interface IProductsApi {
311
273
  * @property {number} limit - Maximum number of records to return. Default: 30.
312
274
  * @property {string} sortOrder - Sort order: "DESC" or "ASC". Default: "DESC".
313
275
  * @property {string} sortKey - Field to sort by: "id", "position", "title", "date", "price" or "status". Default: null.
314
- * @property {string} [signPrice] - Marker of the order storage to fix prices for. When set, each product comes with a `signedPrice` that holds the price for a limited time.
276
+ * @property {string} [signPrice] - Marker of the order storage to fix prices for. When set, each product comes with a `signedPrice` that holds the price for a limited time. Must be an existing orders storage marker of the project, e.g. "my_order"; a marker with no such storage fails the whole request with `404 Specified orders storage for price signature not found`.
315
277
  * @see {@link https://js-sdk.oneentry.cloud/docs/products/#Fixing-the-price-signPrice Fixing the price} documentation.
316
278
  * @description Base query parameters shared by the product listing endpoints (getProducts, getProductsEmptyPage, getProductsByPageId, getProductsByPageUrl): pagination, sorting and price fixing.
317
279
  */
@@ -342,7 +304,7 @@ interface IProductsRelatedQuery extends IProductsQueryBase {
342
304
  * @property {number} [offset] - Number of records to skip. Default: 0.
343
305
  * @property {number} [limit] - Maximum number of records to return. Default: 30.
344
306
  * @property {string} [sortOrder] - Sort order: "DESC" or "ASC". Default: "DESC".
345
- * @property {string} [signPrice] - Marker of the order storage to fix prices for. When set, each product comes with a `signedPrice` that holds the price for a limited time.
307
+ * @property {string} [signPrice] - Marker of the order storage to fix prices for. When set, each product comes with a `signedPrice` that holds the price for a limited time. Must be an existing orders storage marker of the project, e.g. "my_order"; a marker with no such storage fails the whole request with `404 Specified orders storage for price signature not found`.
346
308
  * @property {string | null} [statusMarker] - Marker of the product status. Default: null. Example: "in_stock".
347
309
  */
348
310
  type IProductsPriceQuery = Omit<IProductsQueryBase, 'sortKey'> & {
@@ -352,7 +314,7 @@ type IProductsPriceQuery = Omit<IProductsQueryBase, 'sortKey'> & {
352
314
  * Query parameters for getProductsByIds: only price fixing — `ids` is passed
353
315
  * as a dedicated method argument.
354
316
  * @typedef {object} IProductsByIdsQuery
355
- * @property {string} [signPrice] - Marker of the order storage to fix prices for. When set, each product comes with a `signedPrice` that holds the price for a limited time.
317
+ * @property {string} [signPrice] - Marker of the order storage to fix prices for. When set, each product comes with a `signedPrice` that holds the price for a limited time. Must be an existing orders storage marker of the project, e.g. "my_order"; a marker with no such storage fails the whole request with `404 Specified orders storage for price signature not found`.
356
318
  */
357
319
  type IProductsByIdsQuery = Pick<IProductsQueryBase, 'signPrice'>;
358
320
  /**
@@ -389,7 +351,7 @@ interface IFilterParams {
389
351
  }
390
352
  /**
391
353
  * @interface IProductAdditional
392
- * @property {object} prices - Aggregated price range for the product across all variants.
354
+ * @property {object} prices - Price range of the **whole catalogue**, the same on every product: it depends neither on the product nor on the request filter (two products priced 51 and 150 both carry `{ min: 51, max: 180 }`). Use it for the bounds of a price slider, not for a product's own "from–to" price.
393
355
  * @property {number} prices.min - Minimum price value. Example: 5.
394
356
  * @property {number} prices.max - Maximum price value. Example: 150.
395
357
  * @description Additional indexed values attached to a product entity.
@@ -399,8 +361,8 @@ interface IProductAdditional {
399
361
  }
400
362
  /**
401
363
  * @interface IProductPriceRange
402
- * @property {number} min - Minimum price across product variants. Example: 5.
403
- * @property {number} max - Maximum price across product variants. Example: 150.
364
+ * @property {number} min - Lowest price in the catalogue. Example: 5.
365
+ * @property {number} max - Highest price in the catalogue. Example: 150.
404
366
  * @description Aggregated price range for a product, computed from all its variants.
405
367
  */
406
368
  interface IProductPriceRange {
@@ -442,14 +404,20 @@ interface IProductPageRef {
442
404
  }
443
405
  * @property {string | null} sku - Product SKU from the search index, or `null`. Example: "SKU_12345".
444
406
  * @property {boolean} isSync - Whether the product is indexed. Example: true.
445
- * @property {IAttributeValues} attributeValues - Attribute values keyed by attribute marker.
407
+ * @property {IAttributeValues} attributeValues - Attribute values keyed by attribute marker (an object, not an array).
446
408
  * @example
447
- [
448
- {
449
- "id": "color",
450
- "value": "red"
409
+ {
410
+ "product-name": {
411
+ "type": "string",
412
+ "value": "Split",
413
+ "position": 0
414
+ },
415
+ "price": {
416
+ "type": "integer",
417
+ "value": 150,
418
+ "position": 1
451
419
  }
452
- ]
420
+ }
453
421
  * @property {string[]} categories - URLs of the catalog pages the product belongs to.
454
422
  * @example
455
423
  [
@@ -461,7 +429,7 @@ interface IProductPageRef {
461
429
  * @property {Array<IFormConfig>} [moduleFormConfigs] - Form configurations of the module.
462
430
  * @property {IRating} [rating] - Rating data: average value, likes and dislikes, and the calculation method.
463
431
  * @property {boolean} [isPositionLocked] - Whether the sorting position is locked. Example: false.
464
- * @property {number[]} relatedIds - IDs of related products.
432
+ * @property {number[]} [relatedIds] - IDs of related products.
465
433
  * @example
466
434
  [
467
435
  12345,
@@ -485,7 +453,7 @@ interface IProductPageRef {
485
453
  "categoryPath": "products"
486
454
  }
487
455
  ]
488
- * @property {string[]} [blocks] - Markers of the blocks attached to the product.
456
+ * @property {string[]} [blocks] - Markers of the blocks shown on the product page (not the blocks whose selection includes the product).
489
457
  * @example
490
458
  [
491
459
  "block_12345",
@@ -613,19 +581,20 @@ interface IProductInfo {
613
581
  * @property {number} version - Version number of the product block. Example: 1.
614
582
  * @property {number} position - Position of the product block in a list or layout. Example: 1.
615
583
  * @property {string} identifier - Marker of the product block. Example: "product_block_12345".
616
- * @property {BlockType} type - Block type. Example: "product".
584
+ * @property {BlockType} type - Block type. Example: "product_block".
617
585
  * @property {object} customSettings - Custom settings of the product block: slider delay, product configuration, similar-product rules and conditions. Example: {}
618
586
  * @property {string | null} templateIdentifier - Marker of the template used by the product block, or `null`. Example: "template_12345".
619
587
  * @property {boolean} isVisible - Whether the product block is visible. Example: true.
620
588
  * @property {boolean} isSync - Whether the product block is synchronized. Example: false.
621
- * @property {IAttributeValues} attributeValues - Attribute values keyed by attribute marker.
589
+ * @property {IAttributeValues} attributeValues - Attribute values keyed by attribute marker (an object, not an array); `{}` when the block has no attributes.
622
590
  * @example
623
- [
624
- {
625
- "id": "color",
626
- "value": "red"
591
+ {
592
+ "block-text": {
593
+ "type": "string",
594
+ "value": "Similar products",
595
+ "position": 0
627
596
  }
628
- ]
597
+ }
629
598
  * @description This interface defines the structure of a product block entity, including its identifiers, attributes, and custom settings.
630
599
  */
631
600
  /**
@@ -725,4 +694,4 @@ interface IVectorSearchProducts {
725
694
  maxHits?: number;
726
695
  debug?: boolean;
727
696
  }
728
- export type { IAggregatedProductGroup, IFilterParams, IProductBlock, IProductInfo, IProductsApi, IProductsByIdsQuery, IProductsCount, IProductSearchResult, IProductsEntity, IProductsInfo, IProductsPriceQuery, IProductsQuery, IProductsQueryBase, IProductsRelatedQuery, IProductsResponse, IVectorSearchProducts, };
697
+ export type { IAggregatedProductGroup, IFilterParams, IProductAdditional, IProductBlock, IProductBlockProductConfig, IProductBlockSettings, IProductBlockSimilarRule, IProductInfo, IProductPageRef, IProductPriceRange, IProductsApi, IProductsByIdsQuery, IProductsCount, IProductSearchResult, IProductsEntity, IProductsInfo, IProductsPriceQuery, IProductsQuery, IProductsQueryBase, IProductsRelatedQuery, IProductsResponse, IVectorSearchProducts, };
@@ -22,15 +22,16 @@ export default class SearchApi extends AsyncModules implements ISearchApi {
22
22
  * Public search across titles and attribute values of visible records.
23
23
  * @handleName globalSearch
24
24
  * @param {string} query - Search query. Example: "winter".
25
- * @param {TGlobalSearchEntityType[]} [types] - Entity types to search in, sent comma-separated. Searches every type when omitted.
25
+ * @param {TGlobalSearchEntityType[]} [types] - Entity types to search in, sent comma-separated. Searches every type when omitted or empty.
26
26
  * @param {'all' | 'visible' | 'hidden'} [visibility] - Visibility filter of the searched records. Default: "all".
27
27
  * @param {number} [offset] - Offset for drilldown mode. Pass it only together with exactly one accessible type in `types`.
28
28
  * @param {number} [limit] - Page size for drilldown mode. Pass it only together with exactly one accessible type in `types`; otherwise the API responds with `400 Drilldown mode (limit/offset) requires exactly one accessible type in types`. Without it, every group is returned in full.
29
29
  * @param {string} [langCode] - Language code. Default: "en_US". The search index is built per language: words in another locale are found only when you pass that locale's `langCode`.
30
+ * @param {number} [limitPerType] - Dropdown mode: maximum items per type group (API default 5, max 20). Independent from `limit`/`offset`, which page a single type in drilldown mode.
30
31
  * @returns {Promise<IGlobalSearchResponse | IError>} Returns the query and the found records grouped by entity type.
31
32
  * @throws {IError} When isShell=false and an error occurs during the fetch
32
33
  * @description Searches names and attribute values of visible records across entity types. The index is per language — the request carries `langCode`, so a bilingual project finds a word of either locale.
33
34
  * @see {@link https://js-sdk.oneentry.cloud/docs/search/globalSearch globalSearch} documentation.
34
35
  */
35
- globalSearch(query: string, types?: TGlobalSearchEntityType[], visibility?: 'all' | 'visible' | 'hidden', offset?: number, limit?: number, langCode?: string): Promise<IGlobalSearchResponse | IError>;
36
+ globalSearch(query: string, types?: TGlobalSearchEntityType[], visibility?: 'all' | 'visible' | 'hidden', offset?: number, limit?: number, langCode?: string, limitPerType?: number): Promise<IGlobalSearchResponse | IError>;
36
37
  }
@@ -22,30 +22,33 @@ export default class SearchApi extends AsyncModules {
22
22
  * Public search across titles and attribute values of visible records.
23
23
  * @handleName globalSearch
24
24
  * @param {string} query - Search query. Example: "winter".
25
- * @param {TGlobalSearchEntityType[]} [types] - Entity types to search in, sent comma-separated. Searches every type when omitted.
25
+ * @param {TGlobalSearchEntityType[]} [types] - Entity types to search in, sent comma-separated. Searches every type when omitted or empty.
26
26
  * @param {'all' | 'visible' | 'hidden'} [visibility] - Visibility filter of the searched records. Default: "all".
27
27
  * @param {number} [offset] - Offset for drilldown mode. Pass it only together with exactly one accessible type in `types`.
28
28
  * @param {number} [limit] - Page size for drilldown mode. Pass it only together with exactly one accessible type in `types`; otherwise the API responds with `400 Drilldown mode (limit/offset) requires exactly one accessible type in types`. Without it, every group is returned in full.
29
29
  * @param {string} [langCode] - Language code. Default: "en_US". The search index is built per language: words in another locale are found only when you pass that locale's `langCode`.
30
+ * @param {number} [limitPerType] - Dropdown mode: maximum items per type group (API default 5, max 20). Independent from `limit`/`offset`, which page a single type in drilldown mode.
30
31
  * @returns {Promise<IGlobalSearchResponse | IError>} Returns the query and the found records grouped by entity type.
31
32
  * @throws {IError} When isShell=false and an error occurs during the fetch
32
33
  * @description Searches names and attribute values of visible records across entity types. The index is per language — the request carries `langCode`, so a bilingual project finds a word of either locale.
33
34
  * @see {@link https://js-sdk.oneentry.cloud/docs/search/globalSearch globalSearch} documentation.
34
35
  */
35
- async globalSearch(query, types, visibility, offset, limit, langCode = this.state.lang) {
36
+ async globalSearch(query, types, visibility, offset, limit, langCode = this.state.lang, limitPerType) {
36
37
  // `types` is sent comma-separated — the array stringifies to exactly that.
37
38
  // `langCode` is not optional decoration: the index is per language, and
38
39
  // without it a word of a second locale answers an empty group (CMS-912).
39
40
  const params = {
40
41
  q: query,
41
- types,
42
+ // An empty array would go out as `types=` and the API answers no groups
43
+ types: types && types.length > 0 ? types : undefined,
42
44
  visibility,
43
45
  offset,
44
46
  limit,
47
+ limitPerType,
45
48
  langCode,
46
49
  };
47
50
  const data = await this._fetchGet(`?` + this._queryParamsToString(params));
48
51
  const validated = await this._validateResponse(data, schema('GlobalSearchResponseSchema'));
49
- return this._normalizeData(validated);
52
+ return this._normalizeData(validated, langCode);
50
53
  }
51
54
  }
@@ -14,11 +14,12 @@ interface ISearchApi {
14
14
  * @param {number} [offset] - Offset for drilldown mode. Pass it only together with exactly one accessible type in `types`.
15
15
  * @param {number} [limit] - Page size for drilldown mode. Pass it only together with exactly one accessible type in `types`; otherwise the API responds with `400 Drilldown mode (limit/offset) requires exactly one accessible type in types`. Without it, every group is returned in full.
16
16
  * @param {string} [langCode] - Language code. Default: "en_US". The search index is built per language: words in another locale are found only when you pass that locale's `langCode`.
17
+ * @param {number} [limitPerType] - Dropdown mode: maximum items per type group (API default 5, max 20). Independent from `limit`/`offset`, which page a single type in drilldown mode.
17
18
  * @returns {Promise<IGlobalSearchResponse | IError>} Returns the query and the found records grouped by entity type.
18
19
  * @throws {IError} When isShell=false and an error occurs during the fetch
19
20
  * @description Searches names and attribute values of visible records across entity types. The index is per language — the request carries `langCode`, so a bilingual project finds a word of either locale.
20
21
  */
21
- globalSearch(query: string, types?: TGlobalSearchEntityType[], visibility?: 'all' | 'visible' | 'hidden', offset?: number, limit?: number, langCode?: string): Promise<IGlobalSearchResponse | IError>;
22
+ globalSearch(query: string, types?: TGlobalSearchEntityType[], visibility?: 'all' | 'visible' | 'hidden', offset?: number, limit?: number, langCode?: string, limitPerType?: number): Promise<IGlobalSearchResponse | IError>;
22
23
  }
23
24
  /**
24
25
  * Entity type a global search group or item belongs to.
@@ -21,17 +21,21 @@ interface ISitemapApi {
21
21
  /**
22
22
  * Query parameters for sitemap requests.
23
23
  * @interface ISitemapQuery
24
- * @property {Record<string, string>} [baseUrls] - Base URLs per language for sitemap generation. Example: `{ "en_US": "https://example.com/" }`.
25
- * @property {string} [url] - URL of a single sitemap entry.
26
- * @property {string} [lastmod] - Last modification date of the entry.
27
- * @property {string} [changefreq] - How often the entry changes.
28
- * @property {number} [priority] - Sitemap `priority` of the entry.
24
+ * @property {Record<string, string>} baseUrls - Base URL per active language, an absolute `http(s)://` address; the entry for the default language is required. Without it the API does not generate a sitemap. Example: `{ "en_US": "https://example.com/" }`.
25
+ * @property {string} [url] - Deprecated: ignored by the API.
26
+ * @property {string} [lastmod] - Deprecated: ignored by the API.
27
+ * @property {string} [changefreq] - Deprecated: ignored by the API.
28
+ * @property {number} [priority] - Deprecated: ignored by the API.
29
29
  */
30
30
  interface ISitemapQuery {
31
- baseUrls?: Record<string, string>;
31
+ baseUrls: Record<string, string>;
32
+ /** @deprecated Ignored by the API. */
32
33
  url?: string;
34
+ /** @deprecated Ignored by the API. */
33
35
  lastmod?: string;
36
+ /** @deprecated Ignored by the API. */
34
37
  changefreq?: string;
38
+ /** @deprecated Ignored by the API. */
35
39
  priority?: number;
36
40
  }
37
41
  /**
@@ -45,7 +45,7 @@ export default class SubscriptionsApi extends AsyncModules implements ISubscript
45
45
  * @handleName getAllSubscriptions
46
46
  * @returns {Promise<ISubscriptionEntity[] | IError>} Returns an array of available subscriptions.
47
47
  * @throws {IError} When isShell=false and an error occurs during the fetch
48
- * @description This method requires user authorization.
48
+ * @description Lists the plans available for subscription. It does not need a signed-in user: a guest gets the same list.
49
49
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
50
50
  * @see {@link https://js-sdk.oneentry.cloud/docs/subscriptions/getAllSubscriptions getAllSubscriptions} documentation.
51
51
  */
@@ -51,7 +51,7 @@ export default class SubscriptionsApi extends AsyncModules {
51
51
  * @handleName getAllSubscriptions
52
52
  * @returns {Promise<ISubscriptionEntity[] | IError>} Returns an array of available subscriptions.
53
53
  * @throws {IError} When isShell=false and an error occurs during the fetch
54
- * @description This method requires user authorization.
54
+ * @description Lists the plans available for subscription. It does not need a signed-in user: a guest gets the same list.
55
55
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
56
56
  * @see {@link https://js-sdk.oneentry.cloud/docs/subscriptions/getAllSubscriptions getAllSubscriptions} documentation.
57
57
  */
@@ -30,7 +30,7 @@ interface ISubscriptionsApi {
30
30
  * @handleName getAllSubscriptions
31
31
  * @returns {Promise<ISubscriptionEntity[] | IError>} Returns an array of available subscriptions.
32
32
  * @throws {IError} When isShell=false and an error occurs during the fetch
33
- * @description This method requires user authorization.
33
+ * @description Lists the plans available for subscription. It does not need a signed-in user: a guest gets the same list.
34
34
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
35
35
  */
36
36
  getAllSubscriptions(): Promise<ISubscriptionEntity[] | IError>;
@@ -23,6 +23,7 @@ export default class SystemApi extends AsyncModules implements ISystemApi {
23
23
  * @throws {IError} When isShell=false and an error occurs during the fetch
24
24
  * @description This method is used to test the 404 error handling by sending a GET request to a specific endpoint.
25
25
  * @see {@link https://js-sdk.oneentry.cloud/docs/system/test404 test404} documentation.
26
+ * @deprecated The platform removed `/api/content/system/test404` (CMS-1056, 2026-10-29): the call answers `404 "Cannot GET /api/content/system/test404"`. Kept for compatibility and will be removed.
26
27
  */
27
28
  test404(): Promise<unknown | IError>;
28
29
  /**
@@ -32,6 +33,7 @@ export default class SystemApi extends AsyncModules implements ISystemApi {
32
33
  * @throws {IError} When isShell=false and an error occurs during the fetch
33
34
  * @description This method is used to test the 500 error handling by sending a GET request to a specific endpoint.
34
35
  * @see {@link https://js-sdk.oneentry.cloud/docs/system/test500 test500} documentation.
36
+ * @deprecated The platform removed `/api/content/system/test500` (CMS-1056, 2026-10-29): the call answers `404 "Cannot GET /api/content/system/test500"`. Kept for compatibility and will be removed.
35
37
  */
36
38
  test500(): Promise<unknown | IError>;
37
39
  /**
@@ -21,6 +21,7 @@ export default class SystemApi extends AsyncModules {
21
21
  * @throws {IError} When isShell=false and an error occurs during the fetch
22
22
  * @description This method is used to test the 404 error handling by sending a GET request to a specific endpoint.
23
23
  * @see {@link https://js-sdk.oneentry.cloud/docs/system/test404 test404} documentation.
24
+ * @deprecated The platform removed `/api/content/system/test404` (CMS-1056, 2026-10-29): the call answers `404 "Cannot GET /api/content/system/test404"`. Kept for compatibility and will be removed.
24
25
  */
25
26
  async test404() {
26
27
  const result = await this._fetchGet('/test404');
@@ -33,6 +34,7 @@ export default class SystemApi extends AsyncModules {
33
34
  * @throws {IError} When isShell=false and an error occurs during the fetch
34
35
  * @description This method is used to test the 500 error handling by sending a GET request to a specific endpoint.
35
36
  * @see {@link https://js-sdk.oneentry.cloud/docs/system/test500 test500} documentation.
37
+ * @deprecated The platform removed `/api/content/system/test500` (CMS-1056, 2026-10-29): the call answers `404 "Cannot GET /api/content/system/test500"`. Kept for compatibility and will be removed.
36
38
  */
37
39
  async test500() {
38
40
  const result = await this._fetchGet('/test500');
@@ -9,6 +9,7 @@ interface ISystemApi {
9
9
  * @handleName test404
10
10
  * @returns {unknown} Returns a Promise that resolves with any data.
11
11
  * @description This method tests 404 error.
12
+ * @deprecated The platform removed `/api/content/system/test404` (CMS-1056, 2026-10-29): the call answers `404 "Cannot GET /api/content/system/test404"`. Kept for compatibility and will be removed.
12
13
  */
13
14
  test404(): Promise<unknown | IError>;
14
15
  /**
@@ -16,6 +17,7 @@ interface ISystemApi {
16
17
  * @handleName test500
17
18
  * @returns {unknown} Returns a Promise that resolves with any data.
18
19
  * @description This method tests 500 error.
20
+ * @deprecated The platform removed `/api/content/system/test500` (CMS-1056, 2026-10-29): the call answers `404 "Cannot GET /api/content/system/test500"`. Kept for compatibility and will be removed.
19
21
  */
20
22
  test500(): Promise<unknown | IError>;
21
23
  /**
@@ -9,7 +9,7 @@ import type { ITemplateEntity, ITemplatesApi } from './templatesInterfaces.js';
9
9
  * @handle /api/content/templates
10
10
  * @description This module provides a set of controllers for handling operations related to template objects.
11
11
  */
12
- export default class TemplatesPreviewApi extends AsyncModules implements ITemplatesApi {
12
+ export default class TemplatesApi extends AsyncModules implements ITemplatesApi {
13
13
  protected state: StateModule;
14
14
  protected _url: string;
15
15
  /**
@@ -31,7 +31,7 @@ export default class TemplatesPreviewApi extends AsyncModules implements ITempla
31
31
  /**
32
32
  * Get template objects by type.
33
33
  * @handleName getTemplateByType
34
- * @param {BlockType} type - Type of templates to fetch. Example: "product".
34
+ * @param {BlockType} type - Type of templates to fetch. Example: "product_block". A type with no templates gives an empty array.
35
35
  * @param {string} [langCode] - Language code. Default: "en_US".
36
36
  * @returns {Promise<ITemplateEntity[] | IError>} Array of `ITemplateEntity` objects of the given type.
37
37
  * @throws {IError} When isShell=false and an error occurs during the fetch
@@ -8,7 +8,7 @@ const schema = createSchemaLoader(() => import('./templatesSchemas.js'));
8
8
  * @handle /api/content/templates
9
9
  * @description This module provides a set of controllers for handling operations related to template objects.
10
10
  */
11
- export default class TemplatesPreviewApi extends AsyncModules {
11
+ export default class TemplatesApi extends AsyncModules {
12
12
  /**
13
13
  * Constructor for TemplatesApi class.
14
14
  * @param {StateModule} state - The state module instance.
@@ -28,13 +28,14 @@ export default class TemplatesPreviewApi extends AsyncModules {
28
28
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getAllTemplates getAllTemplates} documentation.
29
29
  */
30
30
  async getAllTemplates(langCode = this.state.lang) {
31
- const response = await this._fetchGet(`/all?langCode=${langCode}`);
31
+ const response = await this._fetchGet(`/all?langCode=${encodeURIComponent(langCode)}`);
32
32
  // Validate response if validation is enabled
33
33
  const validated = await this._validateResponse(response, schema('GroupedTemplatesResponseSchema'));
34
+ if (this._isErrorResponse(validated)) {
35
+ return validated;
36
+ }
34
37
  const result = {};
35
- if (validated &&
36
- typeof validated === 'object' &&
37
- !('statusCode' in validated)) {
38
+ if (validated && typeof validated === 'object') {
38
39
  const grouped = validated;
39
40
  // eslint-disable-next-line no-restricted-syntax
40
41
  for (const item in grouped) {
@@ -46,7 +47,7 @@ export default class TemplatesPreviewApi extends AsyncModules {
46
47
  /**
47
48
  * Get template objects by type.
48
49
  * @handleName getTemplateByType
49
- * @param {BlockType} type - Type of templates to fetch. Example: "product".
50
+ * @param {BlockType} type - Type of templates to fetch. Example: "product_block". A type with no templates gives an empty array.
50
51
  * @param {string} [langCode] - Language code. Default: "en_US".
51
52
  * @returns {Promise<ITemplateEntity[] | IError>} Array of `ITemplateEntity` objects of the given type.
52
53
  * @throws {IError} When isShell=false and an error occurs during the fetch
@@ -54,10 +55,10 @@ export default class TemplatesPreviewApi extends AsyncModules {
54
55
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByType getTemplateByType} documentation.
55
56
  */
56
57
  async getTemplateByType(type, langCode = this.state.lang) {
57
- const result = await this._fetchGet(`?type=${type}&langCode=${langCode}`);
58
+ const result = await this._fetchGet(`?type=${encodeURIComponent(type)}&langCode=${encodeURIComponent(langCode)}`);
58
59
  // Validate response if validation is enabled
59
60
  const validated = await this._validateResponse(result, schema('TemplatesResponseSchema'));
60
- return this._normalizeData(validated);
61
+ return this._normalizeData(validated, langCode);
61
62
  }
62
63
  /**
63
64
  * Get one template object by marker.
@@ -70,9 +71,9 @@ export default class TemplatesPreviewApi extends AsyncModules {
70
71
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByMarker getTemplateByMarker} documentation.
71
72
  */
72
73
  async getTemplateByMarker(marker, langCode = this.state.lang) {
73
- const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
74
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${encodeURIComponent(langCode)}`);
74
75
  // Validate response if validation is enabled
75
76
  const validated = await this._validateResponse(result, schema('TemplateEntitySchema'));
76
- return this._normalizeData(validated);
77
+ return this._normalizeData(validated, langCode);
77
78
  }
78
79
  }