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
@@ -22,7 +22,7 @@ export default class BlocksApi extends AsyncModules {
22
22
  /**
23
23
  * Get blocks by parameters.
24
24
  * @handleName getBlocks
25
- * @param {BlockType} [type] - Optional block type to filter by. Available values: "product" | "error_page" | "catalog_page" | "product_preview" | "similar_products_block" | "product_block" | "frequently_ordered_block" | "trending_block" | "recently_viewed_block" | "repeat_purchase_block" | "slider_block" | "personal_recommendations_block" | "cart_complement_block" | "cart_similar_block" | "wishlist_similar_block" | "form" | "common_page" | "common_block" | "order" | "service" | "external_page" | "discount" (see BlockType). When omitted, blocks of all types are returned. Example: 'product'.
25
+ * @param {BlockType} [type] - Optional block type to filter by. Available values: "product" | "error_page" | "catalog_page" | "product_preview" | "similar_products_block" | "product_block" | "frequently_ordered_block" | "trending_block" | "recently_viewed_block" | "repeat_purchase_block" | "slider_block" | "personal_recommendations_block" | "cart_complement_block" | "cart_similar_block" | "wishlist_similar_block" | "form" | "common_page" | "common_block" | "order" | "service" | "external_page" | "discount" (see BlockType). When omitted, blocks of all types are returned. A type no block has (e.g. "product", which is a product type, not a block type) gives an empty list, not an error. Example: 'product_block'.
26
26
  * @param {string} [langCode] - Language code. Default: "en_US".
27
27
  * @param {number} [offset] - Number of records to skip. Default: 0.
28
28
  * @param {number} [limit] - Maximum number of records to return. Default: 30.
@@ -35,19 +35,22 @@ export default class BlocksApi extends AsyncModules {
35
35
  // empty type value, so it must not be sent at all.
36
36
  const query = this._queryParamsToString({ langCode, type, offset, limit });
37
37
  const response = await this._fetchPost(`?${query}`);
38
+ // Display settings are lifted before validation: a strict schema drops
39
+ // `customSettings`, and with it `countElementsPerRow` and `quantity`
40
+ if (Array.isArray(response === null || response === void 0 ? void 0 : response.items)) {
41
+ response.items.forEach((block) => this._liftBlockSettings(block));
42
+ }
38
43
  // Validate response if validation is enabled
39
44
  const validated = await this._validateResponse(response, schema('BlocksResponseSchema'));
40
- if (!this.state.traficLimit) {
41
- const normalizeResponse = this._normalizeData(validated);
42
- // On API error responses (e.g. 403 without list permission, 422) the
43
- // normalized value is an IError without `items` — skip enrichment and
44
- // return it as-is
45
- if (Array.isArray(normalizeResponse.items)) {
46
- await Promise.all(normalizeResponse.items.map((block) => this._enrichBlock(block, langCode, offset, limit, true)));
47
- }
48
- return normalizeResponse;
45
+ const normalizeResponse = this._normalizeData(validated, langCode);
46
+ // On API error responses (e.g. 403 without list permission, 422) the
47
+ // normalized value is an IError without `items` — return it as-is.
48
+ // `offset` and `limit` page the list of blocks, not the products inside
49
+ // each block: passed on, `offset: 5` emptied every block's products.
50
+ if (!this.state.traficLimit && Array.isArray(normalizeResponse.items)) {
51
+ await Promise.all(normalizeResponse.items.map((block) => this._loadBlockProducts(block, langCode)));
49
52
  }
50
- return this._normalizeData(validated);
53
+ return normalizeResponse;
51
54
  }
52
55
  /**
53
56
  * Get block by marker.
@@ -62,33 +65,29 @@ export default class BlocksApi extends AsyncModules {
62
65
  * @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getBlockByMarker getBlockByMarker} documentation.
63
66
  */
64
67
  async getBlockByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
65
- const response = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
68
+ const response = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${encodeURIComponent(langCode)}`);
69
+ if (response && !this._isErrorResponse(response)) {
70
+ this._liftBlockSettings(response);
71
+ }
66
72
  // Validate response if validation is enabled
67
73
  const validated = await this._validateResponse(response, schema('BlockEntitySchema'));
68
- const normalizeResponse = this._normalizeData(validated);
69
- await this._enrichBlock(normalizeResponse, langCode, offset, limit, !this.state.traficLimit);
74
+ const normalizeResponse = this._normalizeData(validated, langCode);
75
+ if (!this.state.traficLimit && !this._isErrorResponse(normalizeResponse)) {
76
+ await this._loadBlockProducts(normalizeResponse, langCode, offset, limit);
77
+ }
70
78
  return normalizeResponse;
71
79
  }
72
80
  /**
73
- * Enrich a single block in place.
74
- *
75
- * Lifts product display settings from `customSettings.productConfig` to
76
- * numeric top-level fields, strips internal-only fields, and — when
77
- * `loadProducts` is true — fetches the related products for
78
- * `similar_products_block` / `product_block` blocks. Shared by `getBlocks`
79
- * (array) and `getBlockByMarker` (single block). Mutates `block` in place.
80
- * @param {any} block - Normalized block to enrich (mutated in place).
81
- * @param {string} langCode - Language code passed to product sub-requests.
82
- * @param {number} offset - Pagination offset for product sub-requests.
83
- * @param {number} limit - Pagination limit for product sub-requests.
84
- * @param {boolean} loadProducts - Whether to fetch related products.
85
- * @returns {Promise<void>} Resolves when enrichment (incl. sub-requests) is done.
81
+ * Lifts the product display settings of a block to top-level fields and drops internal ones.
82
+ * @param {any} block - A block as the API sent it.
83
+ * @description `customSettings.productConfig` holds `countElementsPerRow` and `quantity`
84
+ * as strings; they become numbers on the block. `customSettings`, `attributeSetIdentifier`
85
+ * and `productPageUrls` are internal and removed — in traffic-saving mode as well, which
86
+ * used to return them as they came; the set marker was misspelt (`attributesSetIdentifier`)
87
+ * and stayed in every block.
86
88
  */
87
- async _enrichBlock(block, langCode, offset, limit, loadProducts) {
88
- const customSettings = block.customSettings;
89
- // Если у блока есть настройки отображения товаров (productConfig) —
90
- // переносим их на верхний уровень блока в числовом формате (в API значения
91
- // хранятся строками, поэтому приводим через «+»).
89
+ _liftBlockSettings(block) {
90
+ const customSettings = block === null || block === void 0 ? void 0 : block.customSettings;
92
91
  if (customSettings &&
93
92
  Object.prototype.hasOwnProperty.call(customSettings, 'productConfig')) {
94
93
  if (customSettings.productConfig.countElementsPerRow)
@@ -97,31 +96,43 @@ export default class BlocksApi extends AsyncModules {
97
96
  if (customSettings.productConfig.quantity)
98
97
  block.quantity = +customSettings.productConfig.quantity;
99
98
  }
100
- // Убираем служебные/внутренние поля из итогового объекта блока.
101
99
  delete block.customSettings;
102
- delete block.attributesSetIdentifier;
100
+ delete block.attributeSetIdentifier;
103
101
  delete block.productPageUrls;
104
- // В режиме экономии трафика товары не подгружаем.
105
- if (!loadProducts)
106
- return;
107
- // Подгружаем связанные товары по идентификатору блока. При ошибке запроса
108
- // подставляем пустой массив, чтобы один упавший подзапрос не ронял весь
109
- // ответ (в getBlocks — не ломал обработку остальных блоков).
102
+ }
103
+ /**
104
+ * Attaches the products of a product or similar-products block.
105
+ * @param {any} block - A normalized block.
106
+ * @param {string} langCode - Language of the products.
107
+ * @param {number} [offset] - Products to skip.
108
+ * @param {number} [limit] - Products to return.
109
+ * @description A failed sub-request leaves an empty value of the declared type —
110
+ * `{ items: [], total: 0 }` for `similarProducts`, `[]` for `products` — instead of
111
+ * the error object or an array where a container is declared.
112
+ */
113
+ async _loadBlockProducts(block, langCode, offset, limit) {
110
114
  if (block.type === 'similar_products_block') {
115
+ let similar;
111
116
  try {
112
- block.similarProducts = await this.getSimilarProducts(block.identifier, langCode, offset, limit);
117
+ similar = await this._asSubRequest().getSimilarProducts(block.identifier, langCode, offset, limit);
113
118
  }
114
119
  catch {
115
- block.similarProducts = [];
120
+ similar = null;
116
121
  }
122
+ block.similarProducts =
123
+ similar && !this._isErrorResponse(similar)
124
+ ? similar
125
+ : { items: [], total: 0 };
117
126
  }
118
127
  else if (block.type === 'product_block') {
128
+ let products;
119
129
  try {
120
- block.products = await this.getProductsByBlockMarker(block.identifier, langCode, offset, limit);
130
+ products = await this._asSubRequest().getProductsByBlockMarker(block.identifier, langCode, offset, limit);
121
131
  }
122
132
  catch {
123
- block.products = [];
133
+ products = null;
124
134
  }
135
+ block.products = Array.isArray(products) ? products : [];
125
136
  }
126
137
  }
127
138
  /**
@@ -136,7 +147,6 @@ export default class BlocksApi extends AsyncModules {
136
147
  * @param {number} [productId] - Optional product id to find similar products for.
137
148
  * @returns {Promise<IProductsResponse | IError>} Returns the total count and an array of product items in object by specified block marker.
138
149
  * @throws {IError} When isShell=false and an error occurs during the fetch
139
- * @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getSimilarProducts getSimilarProducts} documentation.
140
150
  */
141
151
  async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30, signPrice, productId) {
142
152
  const query = {
@@ -148,7 +158,7 @@ export default class BlocksApi extends AsyncModules {
148
158
  };
149
159
  const result = await this._fetchGet(`/${this._pathSegment(marker)}/similar-products?` +
150
160
  this._queryParamsToString(query));
151
- return this._normalizeData(result);
161
+ return this._normalizeData(result, langCode);
152
162
  }
153
163
  /**
154
164
  * Get products by block marker.
@@ -161,7 +171,6 @@ export default class BlocksApi extends AsyncModules {
161
171
  * @see {@link https://js-sdk.oneentry.cloud/docs/blocks/#Fixing-the-price-signPrice Fixing the price} documentation.
162
172
  * @returns {Promise<IProductsEntity[] | IError>} Return array of BlocksEntity object.
163
173
  * @throws {IError} When isShell=false and an error occurs during the fetch
164
- * @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getProductsByBlockMarker getProductsByBlockMarker} documentation.
165
174
  */
166
175
  async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30, signPrice) {
167
176
  const query = {
@@ -175,9 +184,9 @@ export default class BlocksApi extends AsyncModules {
175
184
  // On API error responses there is no `items` array — return the (normalized)
176
185
  // error as-is instead of producing `undefined` from `result.items`.
177
186
  if (!Array.isArray(result === null || result === void 0 ? void 0 : result.items)) {
178
- return this._normalizeData(result);
187
+ return this._normalizeData(result, langCode);
179
188
  }
180
- return this._normalizeData(result.items);
189
+ return this._normalizeData(result.items, langCode);
181
190
  }
182
191
  /**
183
192
  * Get frequently ordered products by block marker and product id.
@@ -198,9 +207,9 @@ export default class BlocksApi extends AsyncModules {
198
207
  signPrice,
199
208
  limit,
200
209
  };
201
- const data = await this._fetchGet(`/${this._pathSegment(marker)}/products/${productId}/frequently-ordered?` +
210
+ const data = await this._fetchGet(`/${this._pathSegment(marker)}/products/${this._pathSegment(String(productId))}/frequently-ordered?` +
202
211
  this._queryParamsToString(query));
203
- return this._normalizeData(data);
212
+ return this._normalizeData(data, langCode);
204
213
  }
205
214
  /**
206
215
  * Quick search for block objects with limited output.
@@ -233,7 +242,7 @@ export default class BlocksApi extends AsyncModules {
233
242
  const query = { langCode, signPrice, limit };
234
243
  const data = await this._fetchGet(`/${this._pathSegment(marker)}/cart-complement?` +
235
244
  this._queryParamsToString(query));
236
- return this._normalizeData(data);
245
+ return this._normalizeData(data, langCode);
237
246
  }
238
247
  /**
239
248
  * Get "complete your cart" products by an explicit list of productIds (POST body).
@@ -250,8 +259,11 @@ export default class BlocksApi extends AsyncModules {
250
259
  * @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartComplementByProductIds getCartComplementByProductIds} documentation.
251
260
  */
252
261
  async getCartComplementByProductIds(marker, body) {
253
- const data = await this._fetchPost(`/${this._pathSegment(marker)}/cart-complement`, { langCode: this.state.lang, ...body });
254
- return this._normalizeData(data);
262
+ var _a;
263
+ // An explicit `langCode: undefined` in the body used to override the default
264
+ const langCode = (_a = body.langCode) !== null && _a !== void 0 ? _a : this.state.lang;
265
+ const data = await this._fetchPost(`/${this._pathSegment(marker)}/cart-complement`, { ...body, langCode });
266
+ return this._normalizeData(data, langCode);
255
267
  }
256
268
  /**
257
269
  * Get "similar to cart" products by the cart from context (auth user or guest).
@@ -269,7 +281,7 @@ export default class BlocksApi extends AsyncModules {
269
281
  const query = { langCode, signPrice, limit };
270
282
  const data = await this._fetchGet(`/${this._pathSegment(marker)}/cart-similar?` +
271
283
  this._queryParamsToString(query));
272
- return this._normalizeData(data);
284
+ return this._normalizeData(data, langCode);
273
285
  }
274
286
  /**
275
287
  * Get "similar to cart" products by an explicit list of productIds (POST body).
@@ -286,8 +298,11 @@ export default class BlocksApi extends AsyncModules {
286
298
  * @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartSimilarByProductIds getCartSimilarByProductIds} documentation.
287
299
  */
288
300
  async getCartSimilarByProductIds(marker, body) {
289
- const data = await this._fetchPost(`/${this._pathSegment(marker)}/cart-similar`, { langCode: this.state.lang, ...body });
290
- return this._normalizeData(data);
301
+ var _a;
302
+ // An explicit `langCode: undefined` in the body used to override the default
303
+ const langCode = (_a = body.langCode) !== null && _a !== void 0 ? _a : this.state.lang;
304
+ const data = await this._fetchPost(`/${this._pathSegment(marker)}/cart-similar`, { ...body, langCode });
305
+ return this._normalizeData(data, langCode);
291
306
  }
292
307
  /**
293
308
  * Get personal recommendations for the user.
@@ -305,7 +320,7 @@ export default class BlocksApi extends AsyncModules {
305
320
  const query = { langCode, signPrice, limit };
306
321
  const data = await this._fetchGet(`/${this._pathSegment(marker)}/personal-recommendations?` +
307
322
  this._queryParamsToString(query));
308
- return this._normalizeData(data);
323
+ return this._normalizeData(data, langCode);
309
324
  }
310
325
  /**
311
326
  * Get recently viewed products.
@@ -323,7 +338,7 @@ export default class BlocksApi extends AsyncModules {
323
338
  const query = { langCode, signPrice, limit };
324
339
  const data = await this._fetchGet(`/${this._pathSegment(marker)}/recently-viewed?` +
325
340
  this._queryParamsToString(query));
326
- return this._normalizeData(data);
341
+ return this._normalizeData(data, langCode);
327
342
  }
328
343
  /**
329
344
  * Get products for repeat purchase.
@@ -341,7 +356,7 @@ export default class BlocksApi extends AsyncModules {
341
356
  const query = { langCode, signPrice, limit };
342
357
  const data = await this._fetchGet(`/${this._pathSegment(marker)}/repeat-purchase?` +
343
358
  this._queryParamsToString(query));
344
- return this._normalizeData(data);
359
+ return this._normalizeData(data, langCode);
345
360
  }
346
361
  /**
347
362
  * Get the block's slides tree as a flat pre-order array (slider_block only).
@@ -371,7 +386,7 @@ export default class BlocksApi extends AsyncModules {
371
386
  const query = { langCode, signPrice, limit };
372
387
  const data = await this._fetchGet(`/${this._pathSegment(marker)}/trending?` +
373
388
  this._queryParamsToString(query));
374
- return this._normalizeData(data);
389
+ return this._normalizeData(data, langCode);
375
390
  }
376
391
  /**
377
392
  * Get "similar to wishlist" products by the wishlist from context (auth user or guest).
@@ -389,7 +404,7 @@ export default class BlocksApi extends AsyncModules {
389
404
  const query = { langCode, signPrice, limit };
390
405
  const data = await this._fetchGet(`/${this._pathSegment(marker)}/wishlist-similar?` +
391
406
  this._queryParamsToString(query));
392
- return this._normalizeData(data);
407
+ return this._normalizeData(data, langCode);
393
408
  }
394
409
  /**
395
410
  * Get "similar to wishlist" products by an explicit list of productIds (POST body).
@@ -406,7 +421,10 @@ export default class BlocksApi extends AsyncModules {
406
421
  * @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getWishlistSimilarByProductIds getWishlistSimilarByProductIds} documentation.
407
422
  */
408
423
  async getWishlistSimilarByProductIds(marker, body) {
409
- const data = await this._fetchPost(`/${this._pathSegment(marker)}/wishlist-similar`, { langCode: this.state.lang, ...body });
410
- return this._normalizeData(data);
424
+ var _a;
425
+ // An explicit `langCode: undefined` in the body used to override the default
426
+ const langCode = (_a = body.langCode) !== null && _a !== void 0 ? _a : this.state.lang;
427
+ const data = await this._fetchPost(`/${this._pathSegment(marker)}/wishlist-similar`, { ...body, langCode });
428
+ return this._normalizeData(data, langCode);
411
429
  }
412
430
  }
@@ -9,7 +9,7 @@ interface IBlocks {
9
9
  /**
10
10
  * Retrieves all block objects of a specific type.
11
11
  * @handleName getBlocks
12
- * @param {BlockType} [type] - Optional type of blocks to retrieve. When omitted, blocks of all types are returned. Example: "product".
12
+ * @param {BlockType} [type] - Optional type of blocks to retrieve. When omitted, blocks of all types are returned. A type no block has (e.g. "product") gives an empty list, not an error. Example: "product_block".
13
13
  * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
14
14
  * @param {number} [offset] - Number of records to skip. Default: 0.
15
15
  * @param {number} [limit] - Maximum number of records to return. Default: 30.
@@ -203,7 +203,7 @@ interface IBlocks {
203
203
  "localizeInfos": { "key": "value" },
204
204
  "position": 1,
205
205
  "templateIdentifier": null,
206
- "type": "product",
206
+ "type": "product_block",
207
207
  "version": 1,
208
208
  "countElementsPerRow": 3,
209
209
  "quantity": 9,
@@ -214,11 +214,11 @@ interface IBlocks {
214
214
  "products": [
215
215
  {
216
216
  "id": 1,
217
- "name": "Product 1"
217
+ "localizeInfos": { "title": "Product 1" }
218
218
  },
219
219
  {
220
220
  "id": 2,
221
- "name": "Product 2"
221
+ "localizeInfos": { "title": "Product 2" }
222
222
  }
223
223
  ]
224
224
  }
@@ -252,7 +252,7 @@ interface IBlocksResponse {
252
252
  }
253
253
  * @property {number} version - Version number of the block. Example: 1.
254
254
  * @property {string} identifier - Marker of the block. Example: "block1".
255
- * @property {BlockType} type - Type of the block. Example: "product".
255
+ * @property {BlockType} type - Type of the block. Example: "product_block".
256
256
  * @property {number} position - Position of the block, used for sorting. Example: 1.
257
257
  * @property {string | null} templateIdentifier - Marker of the template used by the block, or `null`. Example: "template1".
258
258
  * @property {boolean} isVisible - Whether the block is visible. Example: true.
@@ -269,11 +269,11 @@ interface IBlocksResponse {
269
269
  [
270
270
  {
271
271
  "id": 1,
272
- "name": "Product 1"
272
+ "localizeInfos": { "title": "Product 1" }
273
273
  },
274
274
  {
275
275
  "id": 2,
276
- "name": "Product 2"
276
+ "localizeInfos": { "title": "Product 2" }
277
277
  }
278
278
  ]
279
279
  * @description Represents a block entity with various attributes and properties.
@@ -311,7 +311,7 @@ interface ISearchBlock {
311
311
  * @type {BlockType}
312
312
  * @description This type defines the possible values for block types used in the system: the types `GET /api/content/general-types` returns.
313
313
  * `'none'` was dropped — the platform has no such type and a filter by it answers `400 type must be a valid enum value`.
314
- * `'service'` is the platform's own name for the type, but the `type` filter of getBlocks and getTemplateByType currently refuses it with the same `400`; that is a platform defect.
314
+ * `'service'` is the platform's own name for the type; the `type` filter of getBlocks and getTemplateByType takes it in lower case.
315
315
  */
316
316
  type BlockType = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'similar_products_block' | 'product_block' | 'frequently_ordered_block' | 'trending_block' | 'recently_viewed_block' | 'repeat_purchase_block' | 'slider_block' | 'personal_recommendations_block' | 'cart_complement_block' | 'cart_similar_block' | 'wishlist_similar_block' | 'form' | 'common_page' | 'common_block' | 'order' | 'service' | 'external_page' | 'discount';
317
317
  /**
@@ -3,12 +3,12 @@ import type StateModule from '../base/stateModule.js';
3
3
  import type { IError, IVectorSearchResponse } from '../base/utils.js';
4
4
  import type { IBonusBalanceEntity, IBonusHistoryResponse, IBonusTransactionType, ICouponValidationResult, IDiscountsApi, IDiscountsEntity, IDiscountsResponse, IDiscountsVectorSearch, IDiscountType } from './discountsInterfaces.js';
5
5
  /**
6
- * Controllers for working with events
7
- * @handle /api/content/events
6
+ * Controllers for working with discounts, coupons and the bonus balance
7
+ * @handle /api/content/discounts
8
8
  * @class DiscountsApi
9
9
  * @augments AsyncModules
10
10
  * @implements {IDiscountsApi}
11
- * @description This class provides methods to interact with events, including subscribing and unsubscribing to product events, and retrieving all subscriptions.
11
+ * @description This class provides methods for discounts: the list and one discount by marker, coupon validation, the bonus balance and its history, and vector search.
12
12
  */
13
13
  export default class DiscountsApi extends AsyncModules implements IDiscountsApi {
14
14
  protected state: StateModule;
@@ -38,7 +38,7 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
38
38
  /**
39
39
  * Get discount by marker
40
40
  * @handleName getDiscountByMarker
41
- * @param {string} marker - Marker of the discount storage. Example: "discount_storage".
41
+ * @param {string} marker - Marker of the discount. Example: "example_discount".
42
42
  * @param {string} [langCode] - Language code. Default: "en_US".
43
43
  * @returns {Promise<IDiscountsEntity | IError>} Returns an object containing discount by marker or an error object if there was an issue.
44
44
  * @throws {IError} When isShell=false and an error occurs during the fetch
@@ -58,16 +58,18 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
58
58
  * Get bonus transaction history of the current user.
59
59
  * @handleName getBonusHistory
60
60
  * @param {IBonusTransactionType} [type] - Transaction type to filter by.
61
- * @param {string} [dateFrom] - Start of the date range.
62
- * @param {string} [dateTo] - End of the date range.
61
+ * @param {string} [dateFrom] - Start of the date range. Full ISO date-time (`2026-01-01T00:00:00.000Z`); a bare date answers `400 dateFrom must be a ISOString`.
62
+ * @param {string} [dateTo] - End of the date range. Full ISO date-time (`2026-12-31T00:00:00.000Z`); a bare date answers `400 dateTo must be a ISOString`.
63
63
  * @param {number} [discountId] - Return only transactions of this discount ID.
64
64
  * @param {number} [moduleId] - Filter by module ID.
65
65
  * @param {boolean} [isAdmin] - Filter by the transaction's `isAdmin` flag.
66
+ * @param {number} [offset] - Number of transactions to skip, `0` or more. Default: 0.
67
+ * @param {number} [limit] - Maximum number of transactions to return, `1` or more. Default: 30.
66
68
  * @returns {Promise<IBonusHistoryResponse | IError>} Returns the container with the transactions and their total, or an error object.
67
69
  * @throws {IError} When isShell=false and an error occurs during the fetch
68
70
  * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getBonusHistory getBonusHistory} documentation.
69
71
  */
70
- getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusHistoryResponse | IError>;
72
+ getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean, offset?: number, limit?: number): Promise<IBonusHistoryResponse | IError>;
71
73
  /**
72
74
  * Validate discounts coupon
73
75
  * @handleName validateDiscountsCoupon
@@ -1,11 +1,11 @@
1
1
  import AsyncModules from '../base/asyncModules.js';
2
2
  /**
3
- * Controllers for working with events
4
- * @handle /api/content/events
3
+ * Controllers for working with discounts, coupons and the bonus balance
4
+ * @handle /api/content/discounts
5
5
  * @class DiscountsApi
6
6
  * @augments AsyncModules
7
7
  * @implements {IDiscountsApi}
8
- * @description This class provides methods to interact with events, including subscribing and unsubscribing to product events, and retrieving all subscriptions.
8
+ * @description This class provides methods for discounts: the list and one discount by marker, coupon validation, the bonus balance and its history, and vector search.
9
9
  */
10
10
  export default class DiscountsApi extends AsyncModules {
11
11
  /**
@@ -40,12 +40,12 @@ export default class DiscountsApi extends AsyncModules {
40
40
  type,
41
41
  };
42
42
  const data = await this._fetchGet(`?` + this._queryParamsToString(query));
43
- return this._normalizeData(data);
43
+ return this._normalizeData(data, langCode);
44
44
  }
45
45
  /**
46
46
  * Get discount by marker
47
47
  * @handleName getDiscountByMarker
48
- * @param {string} marker - Marker of the discount storage. Example: "discount_storage".
48
+ * @param {string} marker - Marker of the discount. Example: "example_discount".
49
49
  * @param {string} [langCode] - Language code. Default: "en_US".
50
50
  * @returns {Promise<IDiscountsEntity | IError>} Returns an object containing discount by marker or an error object if there was an issue.
51
51
  * @throws {IError} When isShell=false and an error occurs during the fetch
@@ -53,13 +53,11 @@ export default class DiscountsApi extends AsyncModules {
53
53
  * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getDiscountByMarker getDiscountByMarker} documentation.
54
54
  */
55
55
  async getDiscountByMarker(marker, langCode = this.state.lang) {
56
- const query = {
57
- marker: '',
58
- langCode,
59
- };
56
+ // The marker goes in the path; an empty `marker=` used to be sent along
57
+ const query = { langCode };
60
58
  const data = await this._fetchGet(`/marker/${this._pathSegment(marker)}?` +
61
59
  this._queryParamsToString(query));
62
- return this._normalizeData(data);
60
+ return this._normalizeData(data, langCode);
63
61
  }
64
62
  /**
65
63
  * Get bonus balance of the current user.
@@ -76,16 +74,19 @@ export default class DiscountsApi extends AsyncModules {
76
74
  * Get bonus transaction history of the current user.
77
75
  * @handleName getBonusHistory
78
76
  * @param {IBonusTransactionType} [type] - Transaction type to filter by.
79
- * @param {string} [dateFrom] - Start of the date range.
80
- * @param {string} [dateTo] - End of the date range.
77
+ * @param {string} [dateFrom] - Start of the date range. Full ISO date-time (`2026-01-01T00:00:00.000Z`); a bare date answers `400 dateFrom must be a ISOString`.
78
+ * @param {string} [dateTo] - End of the date range. Full ISO date-time (`2026-12-31T00:00:00.000Z`); a bare date answers `400 dateTo must be a ISOString`.
81
79
  * @param {number} [discountId] - Return only transactions of this discount ID.
82
80
  * @param {number} [moduleId] - Filter by module ID.
83
81
  * @param {boolean} [isAdmin] - Filter by the transaction's `isAdmin` flag.
82
+ * @param {number} [offset] - Number of transactions to skip, `0` or more. Default: 0.
83
+ * @param {number} [limit] - Maximum number of transactions to return, `1` or more. Default: 30.
84
84
  * @returns {Promise<IBonusHistoryResponse | IError>} Returns the container with the transactions and their total, or an error object.
85
85
  * @throws {IError} When isShell=false and an error occurs during the fetch
86
86
  * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getBonusHistory getBonusHistory} documentation.
87
87
  */
88
- async getBonusHistory(type, dateFrom, dateTo, discountId, moduleId, isAdmin) {
88
+ async getBonusHistory(type, dateFrom, dateTo, discountId, moduleId, isAdmin, offset, limit) {
89
+ // The endpoint pages its answer; offset/limit were not reachable from the SDK
89
90
  const query = {
90
91
  type,
91
92
  dateFrom,
@@ -93,6 +94,8 @@ export default class DiscountsApi extends AsyncModules {
93
94
  discountId,
94
95
  moduleId,
95
96
  isAdmin,
97
+ offset,
98
+ limit,
96
99
  };
97
100
  const data = await this._fetchGet(`/bonus-balance/history?` + this._queryParamsToString(query));
98
101
  return this._normalizeData(data);
@@ -10,7 +10,7 @@ type IDiscountType = 'DISCOUNT' | 'BONUS' | 'PERSONAL_DISCOUNT';
10
10
  interface IDiscountsApi {
11
11
  /**
12
12
  * Return all discounts.
13
- * @handleName getAllSubscriptions
13
+ * @handleName getAllDiscounts
14
14
  * @param {string} [langCode] - Language code. Default: "en_US".
15
15
  * @param {number} [offset] - Number of records to skip. Default: 0.
16
16
  * @param {number} [limit] - Maximum number of records to return. Default: 30.
@@ -23,7 +23,7 @@ interface IDiscountsApi {
23
23
  /**
24
24
  * Get discount by marker
25
25
  * @handleName getDiscountByMarker
26
- * @param {string} marker - Marker of the discount storage. Example: "discount_storage".
26
+ * @param {string} marker - Marker of the discount. Example: "example_discount".
27
27
  * @param {string} [langCode] - Language code. Default: "en_US".
28
28
  * @returns {Promise<IDiscountsEntity | IError>} Returns an object containing discount by marker or an error object if there was an issue.
29
29
  * @throws {IError} When isShell=false and an error occurs during the fetch
@@ -50,15 +50,17 @@ interface IDiscountsApi {
50
50
  * Get bonus transaction history of the current user.
51
51
  * @handleName getBonusHistory
52
52
  * @param {string} [type] - Transaction type to filter by.
53
- * @param {string} [dateFrom] - Start of the date range.
54
- * @param {string} [dateTo] - End of the date range.
53
+ * @param {string} [dateFrom] - Start of the date range. Full ISO date-time (`2026-01-01T00:00:00.000Z`); a bare date answers `400 dateFrom must be a ISOString`.
54
+ * @param {string} [dateTo] - End of the date range. Full ISO date-time (`2026-12-31T00:00:00.000Z`); a bare date answers `400 dateTo must be a ISOString`.
55
55
  * @param {number} [discountId] - Return only transactions of this discount ID.
56
56
  * @param {number} [moduleId] - Filter by module ID.
57
57
  * @param {boolean} [isAdmin] - Filter by the transaction's `isAdmin` flag.
58
+ * @param {number} [offset] - Number of transactions to skip, `0` or more. Default: 0.
59
+ * @param {number} [limit] - Maximum number of transactions to return, `1` or more. Default: 30.
58
60
  * @returns {Promise<IBonusHistoryResponse | IError>} Returns the container with the transactions and their total, or an error object.
59
61
  * @throws {IError} When isShell=false and an error occurs during the fetch
60
62
  */
61
- getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusHistoryResponse | IError>;
63
+ getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean, offset?: number, limit?: number): Promise<IBonusHistoryResponse | IError>;
62
64
  /**
63
65
  * Semantic (vector) search for discounts.
64
66
  * @handleName getDiscountsByVectorSearch
@@ -133,7 +135,6 @@ interface IDiscountCondition {
133
135
  * @property {string} [attributeSetIdentifier] - Marker of the attribute set.
134
136
  * @property {Record<string, unknown>} [bonusEvent] - Bonus event configuration.
135
137
  * @property {number} [position] - Position used for sorting. Example: 1.
136
- * @property {number | string} [total] - Total count of related entries. Example: "1".
137
138
  * @property {number} [distance] - Cosine distance to the query. Returned only by the semantic (vector) search endpoint when `debug: true` is passed in the search body. Example: 0.12.
138
139
  */
139
140
  interface IDiscountsEntity {
@@ -157,7 +158,6 @@ interface IDiscountsEntity {
157
158
  attributeSetIdentifier?: string;
158
159
  bonusEvent?: Record<string, unknown> | null;
159
160
  position?: number;
160
- total?: number | string;
161
161
  distance?: number;
162
162
  }
163
163
  /**
@@ -235,17 +235,19 @@ interface IDiscountByMarkerQuery {
235
235
  marker: string;
236
236
  }
237
237
  /**
238
- *
238
+ * Type of a bonus balance transaction: accrual, usage, reduction, the reversal of an accrual or a usage, or expiration.
239
239
  */
240
240
  type IBonusTransactionType = 'ACCRUAL' | 'USAGE' | 'REDUCE' | 'REVERSAL_ACCRUAL' | 'REVERSAL_USAGE' | 'EXPIRATION';
241
241
  /**
242
242
  * @interface IBonusHistoryQuery
243
243
  * @property {IBonusTransactionType} [type] - Transaction type to filter by.
244
- * @property {string} [dateFrom] - Start of the date range.
245
- * @property {string} [dateTo] - End of the date range.
244
+ * @property {string} [dateFrom] - Start of the date range. Full ISO date-time (`2026-01-01T00:00:00.000Z`); a bare date answers `400 dateFrom must be a ISOString`.
245
+ * @property {string} [dateTo] - End of the date range. Full ISO date-time (`2026-12-31T00:00:00.000Z`); a bare date answers `400 dateTo must be a ISOString`.
246
246
  * @property {number} [discountId] - Return only transactions of this discount ID.
247
247
  * @property {number} [moduleId] - Filter by module ID.
248
248
  * @property {boolean} [isAdmin] - Filter by the transaction's `isAdmin` flag.
249
+ * @property {number} [offset] - Number of transactions to skip. Default: 0.
250
+ * @property {number} [limit] - Maximum number of transactions to return. Default: 30.
249
251
  */
250
252
  interface IBonusHistoryQuery {
251
253
  type?: IBonusTransactionType;
@@ -254,6 +256,8 @@ interface IBonusHistoryQuery {
254
256
  discountId?: number;
255
257
  moduleId?: number;
256
258
  isAdmin?: boolean;
259
+ offset?: number;
260
+ limit?: number;
257
261
  }
258
262
  /**
259
263
  * @interface IBonusTransactionEntity
@@ -39,7 +39,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
39
39
  * @handleName subscribeByMarker
40
40
  * @param {string} marker - Marker of the event. Example: "product_price_change".
41
41
  * @param {number} productId - Product ID. Example: 12345.
42
- * @param {string} [langCode] - Language code. Default: "en_US".
42
+ * @param {string} [langCode] - Language code. Default: the client's language.
43
43
  * @returns {Promise<boolean | IError>} Returns true if subscription was successful, or an error object if there was an issue.
44
44
  * @throws {IError} When isShell=false and an error occurs during the fetch
45
45
  * @description This method requires user authorization.
@@ -52,7 +52,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
52
52
  * @handleName unsubscribeByMarker
53
53
  * @param {string} marker - Marker of the event to unsubscribe from. Example: "product_price_change".
54
54
  * @param {number} productId - ID of the product to unsubscribe from. Example: 12345.
55
- * @param {string} [langCode] - Language code. Default: "en_US".
55
+ * @param {string} [langCode] - Language code. Default: the client's language.
56
56
  * @returns {Promise<boolean | IError>} - Returns true if the unsubscription succeeded, or an error object if there was an issue.
57
57
  * @throws {IError} When isShell=false and an error occurs during the fetch
58
58
  * @description This method requires user authorization.
@@ -65,7 +65,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
65
65
  * @handleName getAllEvents
66
66
  * @returns {Promise<IContentApiEvent[] | IError>} Returns an array of available events.
67
67
  * @throws {IError} When isShell=false and an error occurs during the fetch
68
- * @description This method returns all available events.
68
+ * @description This method returns all available events. This method requires user authorization — without it the API answers `401 Unauthorized`.
69
69
  * @see {@link https://js-sdk.oneentry.cloud/docs/events/getAllEvents getAllEvents} documentation.
70
70
  */
71
71
  getAllEvents(): Promise<IContentApiEvent[] | IError>;
@@ -45,7 +45,7 @@ export default class EventsApi extends AsyncModules {
45
45
  * @handleName subscribeByMarker
46
46
  * @param {string} marker - Marker of the event. Example: "product_price_change".
47
47
  * @param {number} productId - Product ID. Example: 12345.
48
- * @param {string} [langCode] - Language code. Default: "en_US".
48
+ * @param {string} [langCode] - Language code. Default: the client's language.
49
49
  * @returns {Promise<boolean | IError>} Returns true if subscription was successful, or an error object if there was an issue.
50
50
  * @throws {IError} When isShell=false and an error occurs during the fetch
51
51
  * @description This method requires user authorization.
@@ -64,7 +64,7 @@ export default class EventsApi extends AsyncModules {
64
64
  * @handleName unsubscribeByMarker
65
65
  * @param {string} marker - Marker of the event to unsubscribe from. Example: "product_price_change".
66
66
  * @param {number} productId - ID of the product to unsubscribe from. Example: 12345.
67
- * @param {string} [langCode] - Language code. Default: "en_US".
67
+ * @param {string} [langCode] - Language code. Default: the client's language.
68
68
  * @returns {Promise<boolean | IError>} - Returns true if the unsubscription succeeded, or an error object if there was an issue.
69
69
  * @throws {IError} When isShell=false and an error occurs during the fetch
70
70
  * @description This method requires user authorization.
@@ -83,7 +83,7 @@ export default class EventsApi extends AsyncModules {
83
83
  * @handleName getAllEvents
84
84
  * @returns {Promise<IContentApiEvent[] | IError>} Returns an array of available events.
85
85
  * @throws {IError} When isShell=false and an error occurs during the fetch
86
- * @description This method returns all available events.
86
+ * @description This method returns all available events. This method requires user authorization — without it the API answers `401 Unauthorized`.
87
87
  * @see {@link https://js-sdk.oneentry.cloud/docs/events/getAllEvents getAllEvents} documentation.
88
88
  */
89
89
  async getAllEvents() {