oneentry 1.0.171 → 1.0.173

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 (106) hide show
  1. package/changelog.md +53 -0
  2. package/dist/admins/adminsApi.d.ts +3 -3
  3. package/dist/admins/adminsApi.js +1 -1
  4. package/dist/admins/adminsInterfaces.d.ts +3 -3
  5. package/dist/auth-provider/authProviderApi.d.ts +2 -2
  6. package/dist/auth-provider/authProviderApi.js +2 -2
  7. package/dist/auth-provider/authProvidersInterfaces.d.ts +3 -3
  8. package/dist/base/asyncModules.d.ts +6 -1
  9. package/dist/base/asyncModules.js +9 -1
  10. package/dist/base/utils.d.ts +12 -2
  11. package/dist/blocks/blocksApi.d.ts +1 -1
  12. package/dist/blocks/blocksApi.js +1 -1
  13. package/dist/blocks/blocksInterfaces.d.ts +4 -2
  14. package/dist/discounts/discountsApi.d.ts +3 -3
  15. package/dist/discounts/discountsApi.js +1 -1
  16. package/dist/discounts/discountsInterfaces.d.ts +3 -3
  17. package/dist/events/eventsApi.d.ts +1 -1
  18. package/dist/events/eventsApi.js +1 -2
  19. package/dist/file-uploading/fileUploadingApi.d.ts +11 -11
  20. package/dist/file-uploading/fileUploadingApi.js +12 -14
  21. package/dist/file-uploading/fileUploadingInterfaces.d.ts +15 -15
  22. package/dist/forms-data/formsDataApi.d.ts +4 -4
  23. package/dist/forms-data/formsDataApi.js +24 -17
  24. package/dist/forms-data/formsDataInterfaces.d.ts +3 -3
  25. package/dist/general-types/generalTypesSchemas.d.ts +0 -2
  26. package/dist/general-types/generalTypesSchemas.js +0 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +1 -1
  29. package/dist/integration-collections/integrationCollectionsApi.d.ts +12 -16
  30. package/dist/integration-collections/integrationCollectionsApi.js +10 -14
  31. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +24 -23
  32. package/dist/orders/ordersApi.d.ts +16 -3
  33. package/dist/orders/ordersApi.js +25 -15
  34. package/dist/orders/ordersInterfaces.d.ts +5 -5
  35. package/dist/pages/pagesApi.d.ts +4 -4
  36. package/dist/pages/pagesApi.js +9 -13
  37. package/dist/pages/pagesInterfaces.d.ts +3 -3
  38. package/dist/product-statuses/productStatusesApi.d.ts +2 -2
  39. package/dist/product-statuses/productStatusesApi.js +2 -2
  40. package/dist/product-statuses/productStatusesInterfaces.d.ts +2 -2
  41. package/dist/products/productsApi.d.ts +7 -6
  42. package/dist/products/productsApi.js +6 -3
  43. package/dist/products/productsInterfaces.d.ts +18 -13
  44. package/dist/system/systemApi.d.ts +4 -4
  45. package/dist/system/systemApi.js +2 -2
  46. package/dist/system/systemInterfaces.d.ts +11 -5
  47. package/dist/templates/templatesApi.d.ts +3 -3
  48. package/dist/templates/templatesApi.js +3 -3
  49. package/dist/templates/templatesInterfaces.d.ts +3 -3
  50. package/dist/user-activity/userActivityApi.js +4 -7
  51. package/dist/users/usersApi.d.ts +3 -3
  52. package/dist/users/usersApi.js +1 -1
  53. package/dist/users/usersInterfaces.d.ts +3 -3
  54. package/esm/admins/adminsApi.d.ts +3 -3
  55. package/esm/admins/adminsApi.js +1 -1
  56. package/esm/admins/adminsInterfaces.d.ts +3 -3
  57. package/esm/auth-provider/authProviderApi.d.ts +2 -2
  58. package/esm/auth-provider/authProviderApi.js +2 -2
  59. package/esm/auth-provider/authProvidersInterfaces.d.ts +3 -3
  60. package/esm/base/asyncModules.d.ts +6 -1
  61. package/esm/base/asyncModules.js +9 -1
  62. package/esm/base/utils.d.ts +12 -2
  63. package/esm/blocks/blocksApi.d.ts +1 -1
  64. package/esm/blocks/blocksApi.js +1 -1
  65. package/esm/blocks/blocksInterfaces.d.ts +4 -2
  66. package/esm/discounts/discountsApi.d.ts +3 -3
  67. package/esm/discounts/discountsApi.js +1 -1
  68. package/esm/discounts/discountsInterfaces.d.ts +3 -3
  69. package/esm/events/eventsApi.d.ts +1 -1
  70. package/esm/events/eventsApi.js +1 -2
  71. package/esm/file-uploading/fileUploadingApi.d.ts +11 -11
  72. package/esm/file-uploading/fileUploadingApi.js +12 -14
  73. package/esm/file-uploading/fileUploadingInterfaces.d.ts +15 -15
  74. package/esm/forms-data/formsDataApi.d.ts +4 -4
  75. package/esm/forms-data/formsDataApi.js +24 -17
  76. package/esm/forms-data/formsDataInterfaces.d.ts +3 -3
  77. package/esm/general-types/generalTypesSchemas.d.ts +0 -2
  78. package/esm/general-types/generalTypesSchemas.js +0 -1
  79. package/esm/index.d.ts +1 -1
  80. package/esm/index.js +1 -1
  81. package/esm/integration-collections/integrationCollectionsApi.d.ts +12 -16
  82. package/esm/integration-collections/integrationCollectionsApi.js +10 -14
  83. package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +24 -23
  84. package/esm/orders/ordersApi.d.ts +16 -3
  85. package/esm/orders/ordersApi.js +25 -15
  86. package/esm/orders/ordersInterfaces.d.ts +5 -5
  87. package/esm/pages/pagesApi.d.ts +4 -4
  88. package/esm/pages/pagesApi.js +9 -13
  89. package/esm/pages/pagesInterfaces.d.ts +3 -3
  90. package/esm/product-statuses/productStatusesApi.d.ts +2 -2
  91. package/esm/product-statuses/productStatusesApi.js +2 -2
  92. package/esm/product-statuses/productStatusesInterfaces.d.ts +2 -2
  93. package/esm/products/productsApi.d.ts +7 -6
  94. package/esm/products/productsApi.js +6 -3
  95. package/esm/products/productsInterfaces.d.ts +18 -13
  96. package/esm/system/systemApi.d.ts +4 -4
  97. package/esm/system/systemApi.js +2 -2
  98. package/esm/system/systemInterfaces.d.ts +11 -5
  99. package/esm/templates/templatesApi.d.ts +3 -3
  100. package/esm/templates/templatesApi.js +3 -3
  101. package/esm/templates/templatesInterfaces.d.ts +3 -3
  102. package/esm/user-activity/userActivityApi.js +4 -7
  103. package/esm/users/usersApi.d.ts +3 -3
  104. package/esm/users/usersApi.js +1 -1
  105. package/esm/users/usersInterfaces.d.ts +3 -3
  106. package/package.json +2 -2
@@ -72,7 +72,7 @@ class ProductStatusesApi extends asyncModules_1.default {
72
72
  /**
73
73
  * Search for a product status object by its textual identifier (marker).
74
74
  * @handleName getProductsByStatusMarker
75
- * @param {string} marker - Product marker. Example: "in_stock".
75
+ * @param {string} marker - Product status marker. Example: "in_stock".
76
76
  * @param {string} [langCode] - Language code. Default: "en_US".
77
77
  * @returns {Promise<IProductStatusEntity | IError>} Returns a product status object.
78
78
  * @throws {IError} When isShell=false and an error occurs during the fetch
@@ -88,7 +88,7 @@ class ProductStatusesApi extends asyncModules_1.default {
88
88
  /**
89
89
  * Check the existence of a textual identifier.
90
90
  * @handleName validateMarker
91
- * @param {string} marker - Product marker. Example: "in_stock".
91
+ * @param {string} marker - Product status marker. Example: "in_stock".
92
92
  * @returns {Promise<boolean | IError>} Returns true if the textual identifier (marker) exists or false if it doesn't.
93
93
  * @throws {IError} When isShell=false and an error occurs during the fetch
94
94
  * @description Check the existence of a textual identifier.
@@ -16,7 +16,7 @@ interface IProductStatusesApi {
16
16
  /**
17
17
  * Search for a product status object by its textual identifier (marker).
18
18
  * @handleName getProductsByStatusMarker
19
- * @param {string} marker - Product marker. Example: "in_stock".
19
+ * @param {string} marker - Product status marker. Example: "in_stock".
20
20
  * @param {string} [langCode] - Language code. Default: "en_US".
21
21
  * @returns {IProductStatusEntity} Returns a product status object.
22
22
  * @throws {IError} If there is an error during the fetch operation, it will return an error object.
@@ -26,7 +26,7 @@ interface IProductStatusesApi {
26
26
  /**
27
27
  * Check the existence of a textual identifier.
28
28
  * @handleName validateMarker
29
- * @param {string} marker - Product marker. Example: "in_stock".
29
+ * @param {string} marker - Product status marker. Example: "in_stock".
30
30
  * @returns {boolean} Returns true if the textual identifier (marker) exists or false if it doesn't.
31
31
  * @throws {IError} If there is an error during the fetch operation, it will return an error object.
32
32
  * @description This method checks the existence of a textual identifier.
@@ -1,7 +1,7 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import type StateModule from '../base/stateModule';
3
- import type { IError } from '../base/utils';
4
- import type { IAggregatedProductGroup, IFilterParams, IProductBlock, IProductsApi, IProductsByIdsQuery, IProductsCount, IProductSearchResult, IProductsEntity, IProductsInfo, IProductsPriceQuery, IProductsQueryBase, IProductsRelatedQuery, IProductsResponse, IVectorSearchProducts } from './productsInterfaces';
3
+ import type { IError, IVectorSearchResponse } from '../base/utils';
4
+ import type { IFilterParams, IProductBlock, IProductsApi, IProductsByIdsQuery, IProductsCount, IProductSearchResult, IProductsEntity, IProductsInfo, IProductsPriceQuery, IProductsQueryBase, IProductsRelatedQuery, IProductsResponse, IVectorSearchProducts } from './productsInterfaces';
5
5
  /**
6
6
  * Controllers for working with product pages
7
7
  * @handle /api/content/products
@@ -77,12 +77,12 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
77
77
  "sortKey": "id",
78
78
  "signPrice": "orders"
79
79
  }
80
- * @returns {Promise<IAggregatedProductGroup[] | IError>} Array with AggregatedProductGroup objects.
80
+ * @returns {Promise<IProductsResponse | IError>} Products without a category: `{ items, total }`, the same container as getProducts.
81
81
  * @throws {IError} When isShell=false and an error occurs during the fetch
82
82
  * @description Search for all product page objects with pagination (and aggregation) that do not have a category.
83
83
  * @see {@link https://js-sdk.oneentry.cloud/docs/products/getProductsEmptyPage getProductsEmptyPage} documentation.
84
84
  */
85
- getProductsEmptyPage(body?: object, langCode?: string, userQuery?: IProductsQueryBase): Promise<IAggregatedProductGroup[] | IError>;
85
+ getProductsEmptyPage(body?: object, langCode?: string, userQuery?: IProductsQueryBase): Promise<IProductsResponse | IError>;
86
86
  /**
87
87
  * Search for all products with pagination for the selected category.
88
88
  * @handleName getProductsByPageId
@@ -213,6 +213,7 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
213
213
  * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 0.
214
214
  * @param {string} [userQuery.sortOrder] - Optional sorting order "DESC" | "ASC". Example: "DESC".
215
215
  * @param {string} [userQuery.sortKey] - Optional field to sort by ("id", "title", "date", "price", "position", "status"). Example: "id".
216
+ * @param {string} [userQuery.relationMode] - How relations are computed: "global" (default) or "local", which also requires the product `id` itself to satisfy the template condition. Example: "local".
216
217
  * @returns {Promise<IProductsResponse | IError>} Array with ProductEntity objects
217
218
  * @throws {IError} When isShell=false and an error occurs during the fetch
218
219
  * @description Find all related product page objects.
@@ -350,12 +351,12 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
350
351
  * @param {string} [langCode] - Language code. Default: "en_US".
351
352
  * @param {number} [offset] - Parameter for pagination. Default: 0.
352
353
  * @param {number} [limit] - Parameter for pagination. Default: 30.
353
- * @returns {Promise<IProductsResponse | IError>} Returns an object with an array of found products and total count.
354
+ * @returns {Promise<IVectorSearchResponse<IProductsResponse> | IError>} Returns an object with an array of found products and total count.
354
355
  * @throws {IError} When isShell=false and an error occurs during the fetch
355
356
  * @description This method performs a semantic (vector) search for products.
356
357
  * @see {@link https://js-sdk.oneentry.cloud/docs/products/getProductsByVectorSearch getProductsByVectorSearch} documentation.
357
358
  */
358
- getProductsByVectorSearch(body: IVectorSearchProducts, langCode?: string, offset?: number, limit?: number): Promise<IProductsResponse | IError>;
359
+ getProductsByVectorSearch(body: IVectorSearchProducts, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IProductsResponse> | IError>;
359
360
  /**
360
361
  * Get products by page url.
361
362
  * @param {string} url - Page url.
@@ -125,7 +125,7 @@ class ProductsApi extends asyncModules_1.default {
125
125
  "sortKey": "id",
126
126
  "signPrice": "orders"
127
127
  }
128
- * @returns {Promise<IAggregatedProductGroup[] | IError>} Array with AggregatedProductGroup objects.
128
+ * @returns {Promise<IProductsResponse | IError>} Products without a category: `{ items, total }`, the same container as getProducts.
129
129
  * @throws {IError} When isShell=false and an error occurs during the fetch
130
130
  * @description Search for all product page objects with pagination (and aggregation) that do not have a category.
131
131
  * @see {@link https://js-sdk.oneentry.cloud/docs/products/getProductsEmptyPage getProductsEmptyPage} documentation.
@@ -133,7 +133,9 @@ class ProductsApi extends asyncModules_1.default {
133
133
  async getProductsEmptyPage(body = {}, langCode = this.state.lang, userQuery) {
134
134
  const query = { ...userQuery, langCode };
135
135
  const result = await this._fetchPost(`/empty-page?` + this._queryParamsToString(query), body);
136
- return this._normalizeData(result);
136
+ // Validate response if validation is enabled
137
+ const validated = await this._validateResponse(result, schema('ProductsResponseSchema'));
138
+ return this._normalizeData(validated, langCode);
137
139
  }
138
140
  /**
139
141
  * Search for all products with pagination for the selected category.
@@ -285,6 +287,7 @@ class ProductsApi extends asyncModules_1.default {
285
287
  * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 0.
286
288
  * @param {string} [userQuery.sortOrder] - Optional sorting order "DESC" | "ASC". Example: "DESC".
287
289
  * @param {string} [userQuery.sortKey] - Optional field to sort by ("id", "title", "date", "price", "position", "status"). Example: "id".
290
+ * @param {string} [userQuery.relationMode] - How relations are computed: "global" (default) or "local", which also requires the product `id` itself to satisfy the template condition. Example: "local".
288
291
  * @returns {Promise<IProductsResponse | IError>} Array with ProductEntity objects
289
292
  * @throws {IError} When isShell=false and an error occurs during the fetch
290
293
  * @description Find all related product page objects.
@@ -477,7 +480,7 @@ class ProductsApi extends asyncModules_1.default {
477
480
  * @param {string} [langCode] - Language code. Default: "en_US".
478
481
  * @param {number} [offset] - Parameter for pagination. Default: 0.
479
482
  * @param {number} [limit] - Parameter for pagination. Default: 30.
480
- * @returns {Promise<IProductsResponse | IError>} Returns an object with an array of found products and total count.
483
+ * @returns {Promise<IVectorSearchResponse<IProductsResponse> | IError>} Returns an object with an array of found products and total count.
481
484
  * @throws {IError} When isShell=false and an error occurs during the fetch
482
485
  * @description This method performs a semantic (vector) search for products.
483
486
  * @see {@link https://js-sdk.oneentry.cloud/docs/products/getProductsByVectorSearch getProductsByVectorSearch} documentation.
@@ -1,4 +1,4 @@
1
- import type { IAttributeValues, IError, ILocalizeInfo, IRating } from '../base/utils';
1
+ import type { IAttributeValues, IError, ILocalizeInfo, IRating, IVectorSearchResponse } from '../base/utils';
2
2
  import type { BlockType } from '../blocks/blocksInterfaces';
3
3
  import type { IFormConfig } from '../forms/formsInterfaces';
4
4
  /**
@@ -62,11 +62,11 @@ interface IProductsApi {
62
62
  "sortKey": "id",
63
63
  "signPrice": "orders"
64
64
  }
65
- * @returns {IProductsResponse} Array with ProductEntity objects.
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.
67
67
  * @description This method searches for all product page objects with pagination that do not have a category.
68
68
  */
69
- getProductsEmptyPage(body?: object, langCode?: string, userQuery?: IProductsQueryBase): Promise<IAggregatedProductGroup[] | IError>;
69
+ getProductsEmptyPage(body?: object, langCode?: string, userQuery?: IProductsQueryBase): Promise<IProductsResponse | IError>;
70
70
  /**
71
71
  * Search for all products with pagination for the selected category.
72
72
  * @handleName getProductsByPageId
@@ -299,18 +299,18 @@ interface IProductsApi {
299
299
  * @param {string} [langCode] - Language code. Default: "en_US".
300
300
  * @param {number} [offset] - Parameter for pagination. Default: 0.
301
301
  * @param {number} [limit] - Parameter for pagination. Default: 30.
302
- * @returns {IProductsResponse} A promise that resolves to a products response (items + total) or an error.
302
+ * @returns {IVectorSearchResponse<IProductsResponse>} A promise that resolves to a products response (items + total + indexReady) or an error.
303
303
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
304
304
  * @description This method performs a semantic (vector) search for products.
305
305
  */
306
- getProductsByVectorSearch(body: IVectorSearchProducts, langCode?: string, offset?: number, limit?: number): Promise<IProductsResponse | IError>;
306
+ getProductsByVectorSearch(body: IVectorSearchProducts, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IProductsResponse> | IError>;
307
307
  }
308
308
  /**
309
309
  * @interface IProductsQueryBase
310
310
  * @property {number} offset - Parameter for pagination. Default: 0.
311
311
  * @property {number} limit - Parameter for pagination. Default: 30.
312
312
  * @property {string} sortOrder - Sort order "DESC" | "ASC". Default: "DESC".
313
- * @property {string} sortKey - Field for sorting (default - null). Possible values: "id", "position", "title", "date", "price". Default: null.
313
+ * @property {string} sortKey - Field for sorting (default - null). Possible values: "id", "position", "title", "date", "price", "status". Default: null.
314
314
  * @property {string} [signPrice] - Order storage marker for price fixing. If the parameter is set, the price is fixed for a certain time.
315
315
  * @see {@link https://js-sdk.oneentry.cloud/docs/products/#Fixing-the-price-signPrice Fixing the price} documentation.
316
316
  * @description Base query parameters shared by the product listing endpoints (getProducts, getProductsEmptyPage, getProductsByPageId, getProductsByPageUrl): pagination, sorting and price fixing.
@@ -319,7 +319,7 @@ interface IProductsQueryBase {
319
319
  offset?: number;
320
320
  limit?: number;
321
321
  sortOrder?: 'DESC' | 'ASC' | null;
322
- sortKey?: 'id' | 'position' | 'title' | 'date' | 'price' | null;
322
+ sortKey?: 'id' | 'position' | 'title' | 'date' | 'price' | 'status' | null;
323
323
  signPrice?: string;
324
324
  }
325
325
  /**
@@ -327,11 +327,13 @@ interface IProductsQueryBase {
327
327
  * @augments IProductsQueryBase
328
328
  * @property {string | null} [statusMarker] - Product page status marker, default null. Example: "in_stock".
329
329
  * @property {string | null} [templateMarker] - Product page template marker, default null. Example: "template_12345".
330
- * @description Query parameters for getRelatedProductsById: the base query plus product page status and template markers.
330
+ * @property {string} [relationMode] - How relations are computed: "global" (the default) runs the template's chain of conditions as is; "local" additionally requires the attribute value of the product `id` to satisfy the template condition (same operator, same stored operand) before the products of that step are kept. Example: "local".
331
+ * @description Query parameters for getRelatedProductsById: the base query plus product page status and template markers and the relation mode.
331
332
  */
332
333
  interface IProductsRelatedQuery extends IProductsQueryBase {
333
334
  statusMarker?: string | null;
334
335
  templateMarker?: string | null;
336
+ relationMode?: 'global' | 'local';
335
337
  }
336
338
  /**
337
339
  * Query parameters for getProductsPriceByPageUrl: the base query without
@@ -365,9 +367,9 @@ type IProductsByIdsQuery = Pick<IProductsQueryBase, 'signPrice'>;
365
367
  type IProductsQuery = IProductsQueryBase;
366
368
  /**
367
369
  * @interface IFilterParams
368
- * @property {string | null} attributeMarker - The text identifier of the indexed attribute by which values are filtered. Default: null. Example: "color".
369
- * @property {string | null} [conditionMarker] - Id of the filter condition by which the values are filtered. Default: null. Example: "equals".
370
- * @property {number | string | null} conditionValue - The value that is being searched for, default null. Example: "new".
370
+ * @property {string} [attributeMarker] - The text identifier of the indexed attribute by which values are filtered. Example: "color". Optional: a filter entry may select by `statusMarker` (or `pageUrls`, `title`) alone, e.g. `{ statusMarker: "in_stock" }`.
371
+ * @property {string | null} [conditionMarker] - Id of the filter condition by which the values are filtered. Default: null. Example: "eq".
372
+ * @property {number | string | null} [conditionValue] - The value that is being searched for, default null. Example: "new". Needed together with `attributeMarker`.
371
373
  * @property {string | null} [pageUrl] - Url of the category page object. Example: ["23-laminat-floorwood-maxima"].
372
374
  * @property {string[] | null} [pageUrls] - Url of the category page object. Example: ["23-laminat-floorwood-maxima"].
373
375
  * @property {string | null} [statusMarker] - Text identifier of the product page status (default not set). Example: "in_stock".
@@ -376,9 +378,9 @@ type IProductsQuery = IProductsQueryBase;
376
378
  * @description This interface defines the structure of filter parameters used for querying products, including conditions, attributes, and pagination.
377
379
  */
378
380
  interface IFilterParams {
379
- attributeMarker: string;
381
+ attributeMarker?: string;
380
382
  conditionMarker?: 'in' /** 'in' - Contains */ | 'nin' /** 'nin' - Does not contain */ | 'eq' /** 'eq' - Equal */ | 'neq' /** 'neq' - Not equal */ | 'mth' /** 'mth' - Greater than */ | 'lth' /** 'lth' - Less than */ | 'exs' /** 'exs' - Exists */ | 'nexs' /** 'nexs' - Does not exist */ | 'pat' /** 'pat' - Matches pattern */ | 'same' /** 'same' - Matches the value exactly */ | 'same_part' /** 'same_part' - Matches a part of the value exactly */ | null;
381
- conditionValue: number | string | null;
383
+ conditionValue?: number | string | null;
382
384
  pageUrl?: string | null;
383
385
  pageUrls?: string[] | null;
384
386
  statusMarker?: string;
@@ -694,6 +696,9 @@ interface IProductBlock {
694
696
  }
695
697
  /**
696
698
  * @interface IAggregatedProductGroup
699
+ * @deprecated No method returns this shape: getProductsEmptyPage was declared with it,
700
+ * but the endpoint answers `{ items, total }` — see IProductsResponse (CMS-1065).
701
+ * Kept so that existing imports still compile.
697
702
  * @property {string} attrValue - Attribute value.
698
703
  * @property {IProductsEntity[]} items - Array of product entities.
699
704
  * @property {string[]} productIds - Array of product ids.
@@ -1,7 +1,7 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import type StateModule from '../base/stateModule';
3
3
  import type { IError } from '../base/utils';
4
- import type { ISystemApi } from './systemInterfaces';
4
+ import type { IApiStatEntry, ISystemApi } from './systemInterfaces';
5
5
  /**
6
6
  * Controllers for working with system components
7
7
  * @handle /api/content/system
@@ -37,10 +37,10 @@ export default class SystemApi extends AsyncModules implements ISystemApi {
37
37
  /**
38
38
  * Getting the number of requests to API.
39
39
  * @handleName getApiStat
40
- * @returns {Promise<unknown | IError>} Return object with date and count.
40
+ * @returns {Promise<IApiStatEntry[] | IError>} Array of one-key objects `{ [YYYY-MM-DD]: count }`, one per day. Example: `[{ "2026-10-25": 17280 }, { "2026-10-26": 13671 }]`.
41
41
  * @throws {IError} When isShell=false and an error occurs during the fetch
42
- * @description Getting the number of requests to API.
42
+ * @description Getting the number of requests to API, per day.
43
43
  * @see {@link https://js-sdk.oneentry.cloud/docs/system/getApiStat getApiStat} documentation.
44
44
  */
45
- getApiStat(): Promise<unknown>;
45
+ getApiStat(): Promise<IApiStatEntry[] | IError>;
46
46
  }
@@ -46,9 +46,9 @@ class SystemApi extends asyncModules_1.default {
46
46
  /**
47
47
  * Getting the number of requests to API.
48
48
  * @handleName getApiStat
49
- * @returns {Promise<unknown | IError>} Return object with date and count.
49
+ * @returns {Promise<IApiStatEntry[] | IError>} Array of one-key objects `{ [YYYY-MM-DD]: count }`, one per day. Example: `[{ "2026-10-25": 17280 }, { "2026-10-26": 13671 }]`.
50
50
  * @throws {IError} When isShell=false and an error occurs during the fetch
51
- * @description Getting the number of requests to API.
51
+ * @description Getting the number of requests to API, per day.
52
52
  * @see {@link https://js-sdk.oneentry.cloud/docs/system/getApiStat getApiStat} documentation.
53
53
  */
54
54
  async getApiStat() {
@@ -19,11 +19,17 @@ interface ISystemApi {
19
19
  */
20
20
  test500(): Promise<unknown | IError>;
21
21
  /**
22
- * getApiStat
22
+ * Getting the number of requests to API.
23
23
  * @handleName getApiStat
24
- * @returns {unknown} Returns a Promise that resolves with any data.
25
- * @description This method getApiStat.
24
+ * @returns {Promise<IApiStatEntry[] | IError>} Array of one-key objects `{ [YYYY-MM-DD]: count }`, one per day. Example: `[{ "2026-10-25": 17280 }, { "2026-10-26": 13671 }]`.
25
+ * @description Getting the number of requests to API, per day.
26
26
  */
27
- getApiStat(): Promise<unknown>;
27
+ getApiStat(): Promise<IApiStatEntry[] | IError>;
28
28
  }
29
- export type { ISystemApi };
29
+ /**
30
+ * One day of API request statistics: a single key — the date `YYYY-MM-DD` — holding the number of requests.
31
+ * @typedef {Record<string, number>} IApiStatEntry
32
+ * @description Element of the array returned by getApiStat. Example: `{ "2026-10-26": 13671 }`.
33
+ */
34
+ type IApiStatEntry = Record<string, number>;
35
+ export type { IApiStatEntry, ISystemApi };
@@ -22,7 +22,7 @@ export default class TemplatesPreviewApi extends AsyncModules implements ITempla
22
22
  * Get all template objects grouped by types.
23
23
  * @handleName getAllTemplates
24
24
  * @param {string} [langCode] - Language code. Default: "en_US".
25
- * @returns {Promise<Record<BlockType, ITemplateEntity[]> | IError>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
25
+ * @returns {Promise<Record<BlockType, ITemplateEntity[]> | IError>} Object keyed by `BlockType`; each value is an array of `ITemplateEntity` of that type.
26
26
  * @throws {IError} When isShell=false and an error occurs during the fetch
27
27
  * @description This function is designed to fetch organized template objects in groups based on their types.
28
28
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getAllTemplates getAllTemplates} documentation.
@@ -33,7 +33,7 @@ export default class TemplatesPreviewApi extends AsyncModules implements ITempla
33
33
  * @handleName getTemplateByType
34
34
  * @param {BlockType} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
35
35
  * @param {string} [langCode] - Language code. Default: "en_US".
36
- * @returns {Promise<ITemplateEntity[] | IError>} Returns a TemplateEntity object.
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
38
38
  * @description Fetch template objects that belong to a specific type, with an optional filter by language.
39
39
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByType getTemplateByType} documentation.
@@ -44,7 +44,7 @@ export default class TemplatesPreviewApi extends AsyncModules implements ITempla
44
44
  * @handleName getTemplateByMarker
45
45
  * @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
46
46
  * @param {string} [langCode] - Language code. Default: "en_US".
47
- * @returns {Promise<ITemplateEntity | IError>} Returns a TemplateEntity object
47
+ * @returns {Promise<ITemplateEntity | IError>} Returns an `ITemplateEntity` object
48
48
  * @throws {IError} When isShell=false and an error occurs during the fetch
49
49
  * @description Fetch a specific template object based on its unique marker.
50
50
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByMarker getTemplateByMarker} documentation.
@@ -60,7 +60,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
60
60
  * Get all template objects grouped by types.
61
61
  * @handleName getAllTemplates
62
62
  * @param {string} [langCode] - Language code. Default: "en_US".
63
- * @returns {Promise<Record<BlockType, ITemplateEntity[]> | IError>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
63
+ * @returns {Promise<Record<BlockType, ITemplateEntity[]> | IError>} Object keyed by `BlockType`; each value is an array of `ITemplateEntity` of that type.
64
64
  * @throws {IError} When isShell=false and an error occurs during the fetch
65
65
  * @description This function is designed to fetch organized template objects in groups based on their types.
66
66
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getAllTemplates getAllTemplates} documentation.
@@ -86,7 +86,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
86
86
  * @handleName getTemplateByType
87
87
  * @param {BlockType} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
88
88
  * @param {string} [langCode] - Language code. Default: "en_US".
89
- * @returns {Promise<ITemplateEntity[] | IError>} Returns a TemplateEntity object.
89
+ * @returns {Promise<ITemplateEntity[] | IError>} Array of `ITemplateEntity` objects of the given type.
90
90
  * @throws {IError} When isShell=false and an error occurs during the fetch
91
91
  * @description Fetch template objects that belong to a specific type, with an optional filter by language.
92
92
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByType getTemplateByType} documentation.
@@ -102,7 +102,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
102
102
  * @handleName getTemplateByMarker
103
103
  * @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
104
104
  * @param {string} [langCode] - Language code. Default: "en_US".
105
- * @returns {Promise<ITemplateEntity | IError>} Returns a TemplateEntity object
105
+ * @returns {Promise<ITemplateEntity | IError>} Returns an `ITemplateEntity` object
106
106
  * @throws {IError} When isShell=false and an error occurs during the fetch
107
107
  * @description Fetch a specific template object based on its unique marker.
108
108
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByMarker getTemplateByMarker} documentation.
@@ -9,7 +9,7 @@ interface ITemplatesApi {
9
9
  * Get all template objects grouped by types.
10
10
  * @handleName getAllTemplates
11
11
  * @param {string} [langCode] - Language code. Default: "en_US".
12
- * @returns {Record<BlockType, ITemplateEntity[]>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
12
+ * @returns {Record<BlockType, ITemplateEntity[]>} Object keyed by `BlockType`; each value is an array of `ITemplateEntity` of that type.
13
13
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
14
14
  * @description This method gets all template objects grouped by types.
15
15
  */
@@ -19,7 +19,7 @@ interface ITemplatesApi {
19
19
  * @handleName getTemplateByType
20
20
  * @param {BlockType} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
21
21
  * @param {string} [langCode] - Language code. Default: "en_US".
22
- * @returns {ITemplateEntity[]} Returns a TemplateEntity object.
22
+ * @returns {ITemplateEntity[]} Array of `ITemplateEntity` objects of the given type.
23
23
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
24
24
  * @description This method gets template objects by type.
25
25
  */
@@ -29,7 +29,7 @@ interface ITemplatesApi {
29
29
  * @handleName getTemplateByMarker
30
30
  * @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
31
31
  * @param {string} [langCode] - Language code. Default: "en_US".
32
- * @returns {ITemplateEntity} Returns a TemplateEntity object
32
+ * @returns {ITemplateEntity} Returns an `ITemplateEntity` object
33
33
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
34
34
  * @description This method gets one template object by id.
35
35
  */
@@ -31,13 +31,10 @@ class UserActivityApi extends asyncModules_1.default {
31
31
  * @see {@link https://js-sdk.oneentry.cloud/docs/user-activity/trackUserActivity trackUserActivity} documentation.
32
32
  */
33
33
  async trackUserActivity(body) {
34
- try {
35
- await this._fetchPost(`/track`, body);
36
- return true;
37
- }
38
- catch (e) {
39
- return e;
40
- }
34
+ // The endpoint answers 204: success is the absence of an error. Through
35
+ // _fetchBoolean a 400 comes back as IError instead of `true`, and with
36
+ // isShell=false it is thrown as documented (CMS-1064)
37
+ return this._fetchBoolean(() => this._fetchPost(`/track`, body));
41
38
  }
42
39
  }
43
40
  exports.default = UserActivityApi;
@@ -1,6 +1,6 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import type StateModule from '../base/stateModule';
3
- import type { IError } from '../base/utils';
3
+ import type { IError, IVectorSearchResponse } from '../base/utils';
4
4
  import type { ICartAddItem, ICartResponse, ICartSet, IUserBody, IUserEntity, IUsersApi, IUsersResponse, IUsersVectorSearch, IWishlistAddItem, IWishlistResponse, IWishlistSet } from './usersInterfaces';
5
5
  /**
6
6
  * Controllers for working with users
@@ -239,11 +239,11 @@ export default class UsersApi extends AsyncModules implements IUsersApi {
239
239
  * @param {string} [langCode] - Language code. Default: "en_US".
240
240
  * @param {number} [offset] - Parameter for pagination. Default: 0.
241
241
  * @param {number} [limit] - Parameter for pagination. Default: 30.
242
- * @returns {Promise<IUsersResponse | IError>} Returns an object with an array of found users and total count.
242
+ * @returns {Promise<IVectorSearchResponse<IUsersResponse> | IError>} Returns an object with an array of found users and total count.
243
243
  * @throws {IError} When isShell=false and an error occurs during the fetch
244
244
  * @description This method performs a semantic (vector) search for users. It requires user authorization.
245
245
  * @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}.
246
246
  * @see {@link https://js-sdk.oneentry.cloud/docs/users/getUsersByVectorSearch getUsersByVectorSearch} documentation.
247
247
  */
248
- getUsersByVectorSearch(body: IUsersVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IUsersResponse | IError>;
248
+ getUsersByVectorSearch(body: IUsersVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IUsersResponse> | IError>;
249
249
  }
@@ -332,7 +332,7 @@ class UsersApi extends asyncModules_1.default {
332
332
  * @param {string} [langCode] - Language code. Default: "en_US".
333
333
  * @param {number} [offset] - Parameter for pagination. Default: 0.
334
334
  * @param {number} [limit] - Parameter for pagination. Default: 30.
335
- * @returns {Promise<IUsersResponse | IError>} Returns an object with an array of found users and total count.
335
+ * @returns {Promise<IVectorSearchResponse<IUsersResponse> | IError>} Returns an object with an array of found users and total count.
336
336
  * @throws {IError} When isShell=false and an error occurs during the fetch
337
337
  * @description This method performs a semantic (vector) search for users. It requires user authorization.
338
338
  * @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}.
@@ -1,5 +1,5 @@
1
1
  import type { IAuthData, IAuthFormData, INotificationData } from '../auth-provider/authProvidersInterfaces';
2
- import type { IError, IRating } from '../base/utils';
2
+ import type { IError, IRating, IVectorSearchResponse } from '../base/utils';
3
3
  import type { IFormConfig } from '../forms/formsInterfaces';
4
4
  import type { FormDataType } from '../forms-data/formsDataInterfaces';
5
5
  /**
@@ -217,12 +217,12 @@ interface IUsersApi {
217
217
  * @param {string} [langCode] - Language code. Default: "en_US".
218
218
  * @param {number} [offset] - Parameter for pagination. Default: 0.
219
219
  * @param {number} [limit] - Parameter for pagination. Default: 30.
220
- * @returns {Promise<IUsersResponse | IError>} A promise resolving to a users response (items + total), or an error.
220
+ * @returns {Promise<IVectorSearchResponse<IUsersResponse> | IError>} A promise resolving to a users response (items + total), or an error.
221
221
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
222
222
  * @description This method performs a semantic (vector) search for users. It requires user authorization.
223
223
  * @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}.
224
224
  */
225
- getUsersByVectorSearch(body: IUsersVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IUsersResponse | IError>;
225
+ getUsersByVectorSearch(body: IUsersVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IUsersResponse> | IError>;
226
226
  }
227
227
  /**
228
228
  * Body for semantic (vector) user search.
@@ -1,6 +1,6 @@
1
1
  import AsyncModules from '../base/asyncModules.js';
2
2
  import type StateModule from '../base/stateModule.js';
3
- import type { IError } from '../base/utils.js';
3
+ import type { IError, IVectorSearchResponse } from '../base/utils.js';
4
4
  import type { IFilterParams } from '../products/productsInterfaces.js';
5
5
  import type { IAdminEntity, IAdmins, IAdminsResponse, IAdminsVectorSearch } from './adminsInterfaces.js';
6
6
  /**
@@ -57,10 +57,10 @@ export default class AdminsApi extends AsyncModules implements IAdmins {
57
57
  * @param {string} [langCode] - Language code. Default: "en_US".
58
58
  * @param {number} [offset] - Parameter for pagination. Default: 0.
59
59
  * @param {number} [limit] - Parameter for pagination. Default: 30.
60
- * @returns {Promise<IAdminsResponse | IError>} Returns an object with an array of found admins and total count.
60
+ * @returns {Promise<IVectorSearchResponse<IAdminsResponse> | IError>} Returns an object with an array of found admins and total count.
61
61
  * @throws {IError} When isShell=false and an error occurs during the fetch
62
62
  * @description This method performs a semantic (vector) search for admins.
63
63
  * @see {@link https://js-sdk.oneentry.cloud/docs/admins/getAdminsByVectorSearch getAdminsByVectorSearch} documentation.
64
64
  */
65
- getAdminsByVectorSearch(body: IAdminsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IAdminsResponse | IError>;
65
+ getAdminsByVectorSearch(body: IAdminsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IAdminsResponse> | IError>;
66
66
  }
@@ -66,7 +66,7 @@ export default class AdminsApi extends AsyncModules {
66
66
  * @param {string} [langCode] - Language code. Default: "en_US".
67
67
  * @param {number} [offset] - Parameter for pagination. Default: 0.
68
68
  * @param {number} [limit] - Parameter for pagination. Default: 30.
69
- * @returns {Promise<IAdminsResponse | IError>} Returns an object with an array of found admins and total count.
69
+ * @returns {Promise<IVectorSearchResponse<IAdminsResponse> | IError>} Returns an object with an array of found admins and total count.
70
70
  * @throws {IError} When isShell=false and an error occurs during the fetch
71
71
  * @description This method performs a semantic (vector) search for admins.
72
72
  * @see {@link https://js-sdk.oneentry.cloud/docs/admins/getAdminsByVectorSearch getAdminsByVectorSearch} documentation.
@@ -1,4 +1,4 @@
1
- import type { IAttributeValues, IError } from '../base/utils.js';
1
+ import type { IAttributeValues, IError, IVectorSearchResponse } from '../base/utils.js';
2
2
  import type { IFormConfig } from '../forms/formsInterfaces.js';
3
3
  import type { IFilterParams } from '../products/productsInterfaces.js';
4
4
  /**
@@ -40,10 +40,10 @@ interface IAdmins {
40
40
  * @param {string} [langCode] - Language code. Default: "en_US".
41
41
  * @param {number} [offset] - Parameter for pagination. Default: 0.
42
42
  * @param {number} [limit] - Parameter for pagination. Default: 30.
43
- * @returns {IAdminsResponse} Returns an object with an array of found admins and total count.
43
+ * @returns {IVectorSearchResponse<IAdminsResponse>} Returns an object with an array of found admins, total count and indexReady.
44
44
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
45
45
  */
46
- getAdminsByVectorSearch(body: IAdminsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IAdminsResponse | IError>;
46
+ getAdminsByVectorSearch(body: IAdminsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IAdminsResponse> | IError>;
47
47
  }
48
48
  /**
49
49
  * Body for semantic (vector) admin search.
@@ -233,9 +233,9 @@ export default class AuthProviderApi extends AsyncModules implements IAuthProvid
233
233
  * Getting active user sessions data.
234
234
  * @handleName getActiveSessionsByMarker
235
235
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
236
- * @returns {Promise<IActiveSession[] | IError>} Returns an auth provider object.
236
+ * @returns {Promise<IActiveSession[] | IError>} Array of the authenticated user's active sessions for this provider, one per device (`deviceInfo`).
237
237
  * @throws {IError} When isShell=false and an error occurs during the fetch
238
- * @description Getting a single authorization provider object by marker.
238
+ * @description Getting the authenticated user's active sessions for the authorization provider. This method requires user authorization.
239
239
  * @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/getActiveSessionsByMarker getActiveSessionsByMarker} documentation.
240
240
  */
241
241
  getActiveSessionsByMarker(marker: string): Promise<IActiveSession[] | IError>;
@@ -328,9 +328,9 @@ export default class AuthProviderApi extends AsyncModules {
328
328
  * Getting active user sessions data.
329
329
  * @handleName getActiveSessionsByMarker
330
330
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
331
- * @returns {Promise<IActiveSession[] | IError>} Returns an auth provider object.
331
+ * @returns {Promise<IActiveSession[] | IError>} Array of the authenticated user's active sessions for this provider, one per device (`deviceInfo`).
332
332
  * @throws {IError} When isShell=false and an error occurs during the fetch
333
- * @description Getting a single authorization provider object by marker.
333
+ * @description Getting the authenticated user's active sessions for the authorization provider. This method requires user authorization.
334
334
  * @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/getActiveSessionsByMarker getActiveSessionsByMarker} documentation.
335
335
  */
336
336
  async getActiveSessionsByMarker(marker) {
@@ -405,11 +405,11 @@ interface IAuthPostBody {
405
405
  {
406
406
  "os": "Win32",
407
407
  "browser": "Node.js/22",
408
- "location": "ru-RU"
408
+ "location": "en-US"
409
409
  }
410
410
  * @property {string} deviceInfo.os - The operating system of the active session. Example: "Win32".
411
411
  * @property {string} deviceInfo.browser - The browser used in the active session. Example: "Node.js/22".
412
- * @property {string} deviceInfo.location - The location of the active session. Example: "ru-RU".
412
+ * @property {string} deviceInfo.location - The location of the active session. Example: "en-US".
413
413
  * @description This interface defines the structure of the body used in authentication requests, containing an array of authentication data.
414
414
  */
415
415
  interface IActiveSession {
@@ -419,7 +419,7 @@ interface IActiveSession {
419
419
  * @interface IDeviceInfo
420
420
  * @property {string} os - The operating system of the active session. Example: "Win32".
421
421
  * @property {string} browser - The browser used in the active session. Example: "Node.js/22".
422
- * @property {string} location - The locale of the active session. Example: "ru-RU".
422
+ * @property {string} location - The locale of the active session. Example: "en-US".
423
423
  * @description Information about the device tied to an active authentication session.
424
424
  */
425
425
  interface IDeviceInfo {
@@ -79,8 +79,13 @@ export default abstract class AsyncModules extends SyncModules {
79
79
  * (the default) browserResponse returns the API error instead of throwing
80
80
  * it, so relying on the catch alone would report every failed call — a 404
81
81
  * from cancelSubscription, a 403 from recoverSubscriptions — as a success.
82
+ *
83
+ * With `isShell` disabled browserResponse throws, and the error is thrown on
84
+ * from here too: returning it would break the `@throws` contract every caller
85
+ * documents, and a `try/catch` around the call would never fire (CMS-1067).
82
86
  * @param {() => Promise<unknown>} request - Thunk performing the fetch call.
83
- * @returns {Promise<boolean | IError>} `true` on success, IError on failure.
87
+ * @returns {Promise<boolean | IError>} `true` on success, IError on failure when isShell=true.
88
+ * @throws {IError} When isShell=false and the request fails.
84
89
  */
85
90
  protected _fetchBoolean(request: () => Promise<unknown>): Promise<boolean | IError>;
86
91
  /**
@@ -130,8 +130,13 @@ export default class AsyncModules extends SyncModules {
130
130
  * (the default) browserResponse returns the API error instead of throwing
131
131
  * it, so relying on the catch alone would report every failed call — a 404
132
132
  * from cancelSubscription, a 403 from recoverSubscriptions — as a success.
133
+ *
134
+ * With `isShell` disabled browserResponse throws, and the error is thrown on
135
+ * from here too: returning it would break the `@throws` contract every caller
136
+ * documents, and a `try/catch` around the call would never fire (CMS-1067).
133
137
  * @param {() => Promise<unknown>} request - Thunk performing the fetch call.
134
- * @returns {Promise<boolean | IError>} `true` on success, IError on failure.
138
+ * @returns {Promise<boolean | IError>} `true` on success, IError on failure when isShell=true.
139
+ * @throws {IError} When isShell=false and the request fails.
135
140
  */
136
141
  async _fetchBoolean(request) {
137
142
  try {
@@ -142,6 +147,9 @@ export default class AsyncModules extends SyncModules {
142
147
  return true;
143
148
  }
144
149
  catch (e) {
150
+ if (!this.state.isShell) {
151
+ throw e;
152
+ }
145
153
  return e;
146
154
  }
147
155
  }