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
@@ -141,6 +141,7 @@ interface IOrdersApi {
141
141
  * @param {number} [limit] - Maximum number of records to return. Default: 30.
142
142
  * @returns {Promise<IOrderStatus[] | IError>} Returns an object with the orders statuses.
143
143
  * @throws {IError} When isShell=false and an error occurs during the fetch
144
+ * @description Get all order statuses of the storage. This method requires user authorization: a guest gets `401 Unauthorized`.
144
145
  * @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}.
145
146
  */
146
147
  getAllStatusesByStorageMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IOrderStatus[] | IError>;
@@ -216,7 +217,8 @@ interface IOrdersVectorSearch {
216
217
  }
217
218
  ],
218
219
  "attributeSetIdentifier": "order_form",
219
- "totalSum": "300.00",
220
+ "totalSum": "300",
221
+ "totalSumRaw": "300",
220
222
  "currency": "",
221
223
  "paymentAccountIdentifier": "cash",
222
224
  "paymentAccountLocalizeInfos": {
@@ -227,9 +229,10 @@ interface IOrdersVectorSearch {
227
229
  "id": 2957,
228
230
  "title": "Cosmo",
229
231
  "sku": null,
230
- "previewImage": null,
232
+ "previewImage": [],
231
233
  "price": 150,
232
- "quantity": 2
234
+ "quantity": 2,
235
+ "isGift": false
233
236
  }
234
237
  ],
235
238
  "isCompleted": false
@@ -262,9 +265,9 @@ interface IPicture {
262
265
  * @interface IOrderProducts
263
266
  * @property {number} id - Product ID. Example: 2957.
264
267
  * @property {number} quantity - Product quantity. Example: 1.
265
- * @property {string} title - Product title. Example: "Cosmo".
268
+ * @property {string | null} title - Product title; `null` on a language the product has no translation in. Example: "Cosmo".
266
269
  * @property {string | null} sku - Product SKU. Example: "SKU".
267
- * @property {IPicture | null} previewImage - Preview image of the product.
270
+ * @property {IPicture | IPicture[] | null} previewImage - Preview image of the product. A product without one comes as an empty array `[]`, not `null` — check `Array.isArray(previewImage) ? previewImage[0] : previewImage`.
268
271
  * @example
269
272
  {
270
273
  "filename": "image.jpg",
@@ -279,9 +282,9 @@ interface IPicture {
279
282
  interface IOrderProducts {
280
283
  id: number;
281
284
  quantity: number;
282
- title: string;
285
+ title: string | null;
283
286
  sku: string | null;
284
- previewImage: IPicture | null;
287
+ previewImage: IPicture | IPicture[] | null;
285
288
  price: number;
286
289
  isGift: boolean;
287
290
  }
@@ -542,7 +545,7 @@ interface IOrderData {
542
545
  * @property {number} productId - Identifier of the product covered by the stage. Example: 1.
543
546
  * @property {string} title - Stage title. Example: "Deposit".
544
547
  * @property {number} value - Stage amount. Example: 100.
545
- * @property {string} status - Stage status. Example: "pending".
548
+ * @property {string} status - Stage status. Example: "planned".
546
549
  * @description A single stage of a split (staged) order payment.
547
550
  */
548
551
  interface IOrderSplitStage {
@@ -583,8 +586,8 @@ interface IOrderSplit {
583
586
  }
584
587
  ]
585
588
  * @property {string | null} [attributeSetIdentifier] - Marker of the attribute set. Example: "attribute-set-1".
586
- * @property {string} totalSum - Total order amount. Example: "100.00".
587
- * @property {string} [totalSumRaw] - Raw total order amount with full precision. Example: "100.00".
589
+ * @property {string} totalSum - Total order amount. Example: "300".
590
+ * @property {string} [totalSumRaw] - Raw total order amount with full precision. Example: "300".
588
591
  * @property {string} currency - Currency used to pay for the order. Example: "USD".
589
592
  * @property {string | null} [paymentAccountIdentifier] - Marker of the payment account. Example: "payment-1".
590
593
  * @property {ILocalizeInfo} [paymentAccountLocalizeInfos] - Localized name of the payment account.
@@ -596,9 +599,13 @@ interface IOrderSplit {
596
599
  * @example
597
600
  [
598
601
  {
599
- "id": 1,
600
- "name": "Product 1",
601
- "quantity": 2
602
+ "id": 2957,
603
+ "title": "Cosmo",
604
+ "sku": null,
605
+ "previewImage": [],
606
+ "price": 150,
607
+ "quantity": 2,
608
+ "isGift": false
602
609
  }
603
610
  ]
604
611
  * @property {string | null} paymentUrl - Payment page URL. Example: "https://example.com/pay/123".
@@ -773,4 +780,4 @@ interface ICreateRefundRequest {
773
780
  products: Record<string, IRefundProduct>;
774
781
  note?: string;
775
782
  }
776
- export type { IBaseOrdersEntity, IBaseOrdersEntityResponse, ICreateOrderPreview, ICreateRefundRequest, IOrderByMarkerEntity, IOrderData, IOrderDiscountBonus, IOrderDiscountConfig, IOrderDiscountSettings, IOrderPreviewItem, IOrderPreviewResponse, IOrderProductData, IOrderProducts, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrdersFormData, IOrderSplit, IOrderSplitStage, IOrderStatus, IOrdersVectorSearch, IPaymentAccountIdentifiers, IPicture, IPreviewOrderProduct, IRefundProduct, IRefundRequest, };
783
+ export type { IBaseOrdersEntity, IBaseOrdersEntityResponse, ICreateOrderPreview, ICreateRefundRequest, IOrderByMarkerEntity, IOrderData, IOrderDiscountBonus, IOrderDiscountConfig, IOrderDiscountSettings, IOrderPreviewItem, IOrderPreviewResponse, IOrderProductData, IOrderProducts, IOrderProductsData, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrdersFormData, IOrderSplit, IOrderSplitStage, IOrderStatus, IOrdersVectorSearch, IPaymentAccountIdentifiers, IPicture, IPreviewOrderProduct, IRefundProduct, IRefundRequest, };
@@ -61,9 +61,9 @@ export default class PagesApi extends AsyncModules implements IPagesApi {
61
61
  /**
62
62
  * Get child pages object with information as an array.
63
63
  * @handleName getChildPagesByParentUrl
64
- * @param {string} url - URL of the parent page whose child pages to fetch. Example: "about/our-team".
64
+ * @param {string} url - URL of the parent page whose child pages to fetch — the page's own `pageUrl`, not a nested path: `blog/blog1` answers `404`. Example: "blog".
65
65
  * @param {string} [langCode] - Language code. Default: "en_US".
66
- * @returns {Promise<IPagesEntity | IError>} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
66
+ * @returns {Promise<IPagesEntity[] | IError>} Returns an array of PageEntity objects for the selected parent, or an empty array [] when it has no child pages. A parent page that does not exist answers `404 Parent page not found` (IError).
67
67
  * @throws {IError} When isShell=false and an error occurs during the fetch
68
68
  * @description Get child pages object with information as an array.
69
69
  * @see {@link https://js-sdk.oneentry.cloud/docs/pages/getChildPagesByParentUrl getChildPagesByParentUrl} documentation.
@@ -86,12 +86,13 @@ export default class PagesApi extends AsyncModules implements IPagesApi {
86
86
  * @param {string} name - Text to search for in page titles (`localizeInfos.title`) in the requested language. Example: "About Us".
87
87
  * @param {string} [url] - Page URL. Example: "catalog".
88
88
  * @param {string} [langCode] - Language code. Default: "en_US".
89
+ * @param {boolean} [correct] - Correct typos by the project's search dictionary first. The API defaults to `true`; pass `false` to search the query as is.
89
90
  * @returns {Promise<IPagesEntity[] | IPageSearchResult[] | IError>} Returns found pages as an array of PageEntity objects, an array of short PageSearchResult cards when the traficLimit config option is enabled, or an empty array [] (if there is no data)
90
91
  * @throws {IError} When isShell=false and an error occurs during the fetch
91
92
  * @description Quick search for page objects with limited output. The quick search endpoint returns short cards ({ id, title }); with traficLimit enabled they are returned as is, otherwise full page entities are fetched for the found ids. The search runs in `langCode`, and a found page that cannot be loaded in that language is left out of the result.
92
93
  * @see {@link https://js-sdk.oneentry.cloud/docs/pages/searchPage searchPage} documentation.
93
94
  */
94
- searchPage(name: string, url?: string, langCode?: string): Promise<IPagesEntity[] | IPageSearchResult[] | IError>;
95
+ searchPage(name: string, url?: string, langCode?: string, correct?: boolean): Promise<IPagesEntity[] | IPageSearchResult[] | IError>;
95
96
  /**
96
97
  * Semantic (vector) search for pages.
97
98
  * @handleName getPagesByVectorSearch
@@ -109,6 +110,7 @@ export default class PagesApi extends AsyncModules implements IPagesApi {
109
110
  * Add template data to pages
110
111
  * @handleName addTemplateToPages
111
112
  * @param {IPagesEntity[]} data - An array of page objects (IPagesEntity[]) to which template data will be added.
113
+ * @param {string} [langCode] - Language the templates are fetched and unwrapped in. Default: the client's language.
112
114
  * @example
113
115
  [
114
116
  {
@@ -149,15 +151,15 @@ export default class PagesApi extends AsyncModules implements IPagesApi {
149
151
  * @description Add template data to pages. Optimized to avoid N+1 query problem by fetching only unique templates in parallel.
150
152
  * For example, if 100 pages use 3 different templates, this method makes 3 requests instead of 100.
151
153
  */
152
- protected addTemplateToPages(data: IPagesEntity[]): Promise<any | IError>;
154
+ protected addTemplateToPages(data: IPagesEntity[], langCode?: string): Promise<any | IError>;
153
155
  /**
154
156
  * Add template data to page by page templateIdentifier
155
157
  * @handleName addTemplateToPage
156
158
  * @param {IPagesEntity} data - Page object (IPagesEntity) to which template data will be added.
159
+ * @param {string} [langCode] - Language the templates are fetched and unwrapped in. Default: the client's language.
157
160
  * @returns {Promise<any | IError>} An array of page objects with template data added
158
161
  * @throws {IError} When isShell=false and an error occurs during the fetch
159
162
  * @description Add template data to page by page templateIdentifier
160
- * @see {@link https://js-sdk.oneentry.cloud/docs/pages/addTemplateToPage addTemplateToPage} documentation.
161
163
  */
162
- protected addTemplateToPage(data: IPagesEntity): Promise<any | IError>;
164
+ protected addTemplateToPage(data: IPagesEntity, langCode?: string): Promise<any | IError>;
163
165
  }
@@ -68,11 +68,11 @@ class PagesApi extends asyncModules_1.default {
68
68
  */
69
69
  async getRootPages(langCode = this.state.lang) {
70
70
  // Fetch data from the server using a GET request to retrieve root pages for the specified language code
71
- const data = await this._fetchGet(`/root?langCode=${langCode}`);
71
+ const data = await this._fetchGet(`/root?langCode=${encodeURIComponent(langCode)}`);
72
72
  // Validate response if validation is enabled
73
73
  const validated = await this._validateResponse(data, schema('PagesResponseSchema'));
74
74
  // Add template information to each page in the fetched root pages data
75
- const withTemplate = await this.addTemplateToPages(validated);
75
+ const withTemplate = await this.addTemplateToPages(validated, langCode);
76
76
  // Normalize the data and return it; ensures consistent structure or handles errors
77
77
  return this._normalizeData(withTemplate, langCode);
78
78
  }
@@ -87,11 +87,11 @@ class PagesApi extends asyncModules_1.default {
87
87
  */
88
88
  async getPages(langCode = this.state.lang) {
89
89
  // Fetch data from the server using a GET request to retrieve all pages for the specified language code
90
- const data = await this._fetchGet(`?langCode=${langCode}`);
90
+ const data = await this._fetchGet(`?langCode=${encodeURIComponent(langCode)}`);
91
91
  // Validate response if validation is enabled
92
92
  const validated = await this._validateResponse(data, schema('PagesResponseSchema'));
93
93
  // Add template information to each page in the fetched data
94
- const withTemplate = await this.addTemplateToPages(validated);
94
+ const withTemplate = await this.addTemplateToPages(validated, langCode);
95
95
  // Normalize the data and return it; ensures consistent structure or handles errors
96
96
  return this._normalizeData(withTemplate, langCode);
97
97
  }
@@ -107,11 +107,11 @@ class PagesApi extends asyncModules_1.default {
107
107
  */
108
108
  async getPageById(id, langCode = this.state.lang) {
109
109
  // Fetch data from the server using a GET request to retrieve page details by ID and language code
110
- const data = await this._fetchGet(`/${id}?langCode=${langCode}`);
110
+ const data = await this._fetchGet(`/${this._pathSegment(String(id))}?langCode=${encodeURIComponent(langCode)}`);
111
111
  // Validate response if validation is enabled
112
112
  const validated = await this._validateResponse(data, schema('PageEntitySchema'));
113
113
  // Add template information to the fetched page data
114
- const withTemplate = await this.addTemplateToPage(validated);
114
+ const withTemplate = await this.addTemplateToPage(validated, langCode);
115
115
  // Normalize the data and return it; ensures consistent structure or handles errors
116
116
  return this._normalizeData(withTemplate, langCode);
117
117
  }
@@ -127,31 +127,31 @@ class PagesApi extends asyncModules_1.default {
127
127
  */
128
128
  async getPageByUrl(url, langCode = this.state.lang) {
129
129
  // Fetch data from the server using a GET request with the specified URL and language code
130
- const data = await this._fetchGet(`/url/${url}?langCode=${langCode}`);
130
+ const data = await this._fetchGet(`/url/${this._pathSegments(url)}?langCode=${encodeURIComponent(langCode)}`);
131
131
  // Validate response if validation is enabled
132
132
  const validated = await this._validateResponse(data, schema('PageEntitySchema'));
133
133
  // Add template information to the fetched page data
134
- const withTemplate = await this.addTemplateToPage(validated);
134
+ const withTemplate = await this.addTemplateToPage(validated, langCode);
135
135
  // Normalize the result data and return it; ensures consistent structure or handles errors
136
136
  return this._normalizeData(withTemplate, langCode);
137
137
  }
138
138
  /**
139
139
  * Get child pages object with information as an array.
140
140
  * @handleName getChildPagesByParentUrl
141
- * @param {string} url - URL of the parent page whose child pages to fetch. Example: "about/our-team".
141
+ * @param {string} url - URL of the parent page whose child pages to fetch — the page's own `pageUrl`, not a nested path: `blog/blog1` answers `404`. Example: "blog".
142
142
  * @param {string} [langCode] - Language code. Default: "en_US".
143
- * @returns {Promise<IPagesEntity | IError>} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
143
+ * @returns {Promise<IPagesEntity[] | IError>} Returns an array of PageEntity objects for the selected parent, or an empty array [] when it has no child pages. A parent page that does not exist answers `404 Parent page not found` (IError).
144
144
  * @throws {IError} When isShell=false and an error occurs during the fetch
145
145
  * @description Get child pages object with information as an array.
146
146
  * @see {@link https://js-sdk.oneentry.cloud/docs/pages/getChildPagesByParentUrl getChildPagesByParentUrl} documentation.
147
147
  */
148
148
  async getChildPagesByParentUrl(url, langCode = this.state.lang) {
149
149
  // Fetch data from the server using a GET request to retrieve child pages for the specified parent URL and language code
150
- const data = await this._fetchGet(`/${url}/children?langCode=${langCode}`);
150
+ const data = await this._fetchGet(`/${this._pathSegments(url)}/children?langCode=${encodeURIComponent(langCode)}`);
151
151
  // Validate response if validation is enabled
152
152
  const validated = await this._validateResponse(data, schema('PagesResponseSchema'));
153
153
  // Add template information to each of the fetched child pages
154
- const withTemplate = await this.addTemplateToPages(validated);
154
+ const withTemplate = await this.addTemplateToPages(validated, langCode);
155
155
  // Normalize the result data and return it; ensures consistent structure or handles errors
156
156
  return this._normalizeData(withTemplate, langCode);
157
157
  }
@@ -166,9 +166,9 @@ class PagesApi extends asyncModules_1.default {
166
166
  * @see {@link https://js-sdk.oneentry.cloud/docs/pages/getBlocksByPageUrl getBlocksByPageUrl} documentation.
167
167
  */
168
168
  async getBlocksByPageUrl(url, langCode = this.state.lang) {
169
- const response = await this._fetchGet(`/${url}/blocks?langCode=${langCode}`);
170
- // Normalize the fetched response data
171
- const normalizeResponse = this._normalizeData(response);
169
+ const response = await this._fetchGet(`/${this._pathSegments(url)}/blocks?langCode=${encodeURIComponent(langCode)}`);
170
+ // Normalize by the language of the call, not by the client's one
171
+ const normalizeResponse = this._normalizeData(response, langCode);
172
172
  if (!Array.isArray(normalizeResponse)) {
173
173
  return normalizeResponse;
174
174
  }
@@ -188,22 +188,27 @@ class PagesApi extends asyncModules_1.default {
188
188
  }
189
189
  // Remove internal-only properties from the result.
190
190
  delete item.customSettings;
191
- delete item.attributesSetIdentifier;
192
191
  // In traffic-saving mode skip the extra product requests.
193
192
  if (this.state.traficLimit)
194
193
  return;
195
194
  // Attach related products by block type. StaffModule already normalizes its results.
195
+ // A failed sub-request leaves an empty value of the declared type: with isShell the
196
+ // error comes back as a value, and it used to land in `products`/`similarProducts`
196
197
  if (item.type === 'similar_products_block') {
197
198
  try {
198
- item.similarProducts = await staffModule.getSimilarProducts(item.identifier, langCode);
199
+ const similar = await asyncModules_1.default._subRequestOf(staffModule).getSimilarProducts(item.identifier, langCode);
200
+ item.similarProducts = this._isErrorResponse(similar)
201
+ ? { items: [], total: 0 }
202
+ : similar;
199
203
  }
200
204
  catch {
201
- item.similarProducts = [];
205
+ item.similarProducts = { items: [], total: 0 };
202
206
  }
203
207
  }
204
208
  else if (item.type === 'product_block') {
205
209
  try {
206
- item.products = await staffModule.getProductsByBlockMarker(item.identifier, langCode);
210
+ const products = await asyncModules_1.default._subRequestOf(staffModule).getProductsByBlockMarker(item.identifier, langCode);
211
+ item.products = this._isErrorResponse(products) ? [] : products;
207
212
  }
208
213
  catch {
209
214
  item.products = [];
@@ -218,15 +223,17 @@ class PagesApi extends asyncModules_1.default {
218
223
  * @param {string} name - Text to search for in page titles (`localizeInfos.title`) in the requested language. Example: "About Us".
219
224
  * @param {string} [url] - Page URL. Example: "catalog".
220
225
  * @param {string} [langCode] - Language code. Default: "en_US".
226
+ * @param {boolean} [correct] - Correct typos by the project's search dictionary first. The API defaults to `true`; pass `false` to search the query as is.
221
227
  * @returns {Promise<IPagesEntity[] | IPageSearchResult[] | IError>} Returns found pages as an array of PageEntity objects, an array of short PageSearchResult cards when the traficLimit config option is enabled, or an empty array [] (if there is no data)
222
228
  * @throws {IError} When isShell=false and an error occurs during the fetch
223
229
  * @description Quick search for page objects with limited output. The quick search endpoint returns short cards ({ id, title }); with traficLimit enabled they are returned as is, otherwise full page entities are fetched for the found ids. The search runs in `langCode`, and a found page that cannot be loaded in that language is left out of the result.
224
230
  * @see {@link https://js-sdk.oneentry.cloud/docs/pages/searchPage searchPage} documentation.
225
231
  */
226
- async searchPage(name, url, langCode = this.state.lang) {
232
+ async searchPage(name, url, langCode = this.state.lang, correct) {
227
233
  // Fetch data from the server using a GET request to perform a quick search by page name and language code
228
234
  const urlPart = url ? `url=${encodeURIComponent(url)}&` : '';
229
- const searchPages = await this._fetchGet(`/quick/search?${urlPart}langCode=${encodeURIComponent(langCode)}&name=${encodeURIComponent(name)}`);
235
+ const correctPart = correct !== undefined ? `&correct=${correct}` : '';
236
+ const searchPages = await this._fetchGet(`/quick/search?${urlPart}langCode=${encodeURIComponent(langCode)}&name=${encodeURIComponent(name)}${correctPart}`);
230
237
  // Validate response if validation is enabled
231
238
  const data = (await this._validateResponse(searchPages, schema('PageSearchResponseSchema')));
232
239
  // Check if there is no traffic limit set in the state
@@ -238,7 +245,7 @@ class PagesApi extends asyncModules_1.default {
238
245
  // and broke `page.localizeInfos.title` on the caller's side (CMS-1068)
239
246
  const pageList = fetched.filter((page) => !this._isErrorResponse(page));
240
247
  // Add templates to the fetched pages
241
- const withTemplate = await this.addTemplateToPages(pageList);
248
+ const withTemplate = await this.addTemplateToPages(pageList, langCode);
242
249
  // Normalize the data and return it; ensures consistent structure or handles errors
243
250
  return this._normalizeData(withTemplate, langCode);
244
251
  }
@@ -271,6 +278,7 @@ class PagesApi extends asyncModules_1.default {
271
278
  * Add template data to pages
272
279
  * @handleName addTemplateToPages
273
280
  * @param {IPagesEntity[]} data - An array of page objects (IPagesEntity[]) to which template data will be added.
281
+ * @param {string} [langCode] - Language the templates are fetched and unwrapped in. Default: the client's language.
274
282
  * @example
275
283
  [
276
284
  {
@@ -311,7 +319,7 @@ class PagesApi extends asyncModules_1.default {
311
319
  * @description Add template data to pages. Optimized to avoid N+1 query problem by fetching only unique templates in parallel.
312
320
  * For example, if 100 pages use 3 different templates, this method makes 3 requests instead of 100.
313
321
  */
314
- async addTemplateToPages(data) {
322
+ async addTemplateToPages(data, langCode = this.state.lang) {
315
323
  // On API error responses (e.g. 403 without list permission, 422) the value
316
324
  // is an IError, not an array — return it as-is instead of calling array
317
325
  // methods (.filter/.map) on it and throwing a TypeError.
@@ -332,7 +340,9 @@ class PagesApi extends asyncModules_1.default {
332
340
  }
333
341
  // Step 3: Fetch unique templates in parallel (not N queries, but unique count queries)
334
342
  const Templates = new templatesApi_1.default(this.state);
335
- const templatePromises = uniqueIdentifiers.map((identifier) => Templates.getTemplateByMarker(identifier).catch((error) => {
343
+ const templatePromises = uniqueIdentifiers.map((identifier) => asyncModules_1.default._subRequestOf(Templates)
344
+ .getTemplateByMarker(identifier, langCode)
345
+ .catch((error) => {
336
346
  // eslint-disable-next-line no-undef, no-console
337
347
  console.error(`Template fetch error for ${identifier}: `, error);
338
348
  return null; // Return null for failed templates
@@ -341,7 +351,8 @@ class PagesApi extends asyncModules_1.default {
341
351
  // Step 4: Create a Map for O(1) template lookup
342
352
  const templateMap = new Map();
343
353
  templates.forEach((template, index) => {
344
- if (template !== null) {
354
+ // An error comes back as a value with isShell: it is not a template
355
+ if (template !== null && !this._isErrorResponse(template)) {
345
356
  templateMap.set(uniqueIdentifiers[index], template);
346
357
  }
347
358
  });
@@ -366,12 +377,12 @@ class PagesApi extends asyncModules_1.default {
366
377
  * Add template data to page by page templateIdentifier
367
378
  * @handleName addTemplateToPage
368
379
  * @param {IPagesEntity} data - Page object (IPagesEntity) to which template data will be added.
380
+ * @param {string} [langCode] - Language the templates are fetched and unwrapped in. Default: the client's language.
369
381
  * @returns {Promise<any | IError>} An array of page objects with template data added
370
382
  * @throws {IError} When isShell=false and an error occurs during the fetch
371
383
  * @description Add template data to page by page templateIdentifier
372
- * @see {@link https://js-sdk.oneentry.cloud/docs/pages/addTemplateToPage addTemplateToPage} documentation.
373
384
  */
374
- async addTemplateToPage(data) {
385
+ async addTemplateToPage(data, langCode = this.state.lang) {
375
386
  // Check if 'templateIdentifier' exists in 'data' and is not null or an empty string
376
387
  if ('templateIdentifier' in data &&
377
388
  data.templateIdentifier !== null &&
@@ -382,7 +393,11 @@ class PagesApi extends asyncModules_1.default {
382
393
  // Create a new instance of templatesApi with the current state
383
394
  const Templates = new templatesApi_1.default(this.state);
384
395
  // Fetch the template using the 'templateIdentifier'
385
- const result = await Templates.getTemplateByMarker(templateIdentifier);
396
+ const result = await asyncModules_1.default._subRequestOf(Templates).getTemplateByMarker(templateIdentifier, langCode);
397
+ // An error comes back as a value with isShell: leave the page without a template
398
+ if (this._isErrorResponse(result)) {
399
+ return data;
400
+ }
386
401
  // Return the original data object with the fetched template added
387
402
  return {
388
403
  ...data,
@@ -415,18 +430,18 @@ class StaffModule extends asyncModules_1.default {
415
430
  // ({ total, items }) to match BlocksApi's similarProducts contract.
416
431
  async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30) {
417
432
  // Fetch similar products from the server
418
- const result = await this._fetchGet(`/${this._pathSegment(marker)}/similar-products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
419
- return this._normalizeData(result);
433
+ const result = await this._fetchGet(`/${this._pathSegment(marker)}/similar-products?langCode=${encodeURIComponent(langCode)}&offset=${encodeURIComponent(String(offset))}&limit=${encodeURIComponent(String(limit))}`);
434
+ return this._normalizeData(result, langCode);
420
435
  }
421
436
  // Method to fetch products by block marker
422
437
  async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
423
438
  // Fetch products from the server
424
- const result = await this._fetchGet(`/${this._pathSegment(marker)}/products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
439
+ const result = await this._fetchGet(`/${this._pathSegment(marker)}/products?langCode=${encodeURIComponent(langCode)}&offset=${encodeURIComponent(String(offset))}&limit=${encodeURIComponent(String(limit))}`);
425
440
  // On API error responses there is no `items` array — return the (normalized)
426
441
  // error as-is instead of producing `undefined` from `result.items`.
427
442
  if (!Array.isArray(result === null || result === void 0 ? void 0 : result.items)) {
428
- return this._normalizeData(result);
443
+ return this._normalizeData(result, langCode);
429
444
  }
430
- return this._normalizeData(result.items);
445
+ return this._normalizeData(result.items, langCode);
431
446
  }
432
447
  }
@@ -49,9 +49,9 @@ interface IPagesApi {
49
49
  /**
50
50
  * Get child pages object with information as an array.
51
51
  * @handleName getChildPagesByParentUrl
52
- * @param {string} url - URL of the parent page whose child pages to fetch. Example: "about".
52
+ * @param {string} url - URL of the parent page whose child pages to fetch — the page's own `pageUrl`, not a nested path: `blog/blog1` answers `404`. Example: "blog".
53
53
  * @param {string} [langCode] - Language code. Default: "en_US".
54
- * @returns {IPagesEntity} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
54
+ * @returns {IPagesEntity[]} Returns an array of PageEntity objects for the selected parent, or an empty array [] when it has no child pages. A parent page that does not exist answers `404 Parent page not found` (IError).
55
55
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
56
56
  * @description This method gets child pages object with information as an array.
57
57
  */
@@ -72,11 +72,12 @@ interface IPagesApi {
72
72
  * @param {string} name - Text to search for in page titles (`localizeInfos.title`) in the requested language. Example: "About Us".
73
73
  * @param {string} [url] - Optional page URL to filter search results. Example: "catalog".
74
74
  * @param {string} [langCode] - Language code. Default: "en_US".
75
+ * @param {boolean} [correct] - Correct typos by the project's search dictionary first. The API defaults to `true`; pass `false` to search the query as is.
75
76
  * @returns {IPagesEntity[] | IPageSearchResult[]} Returns found pages as an array of PageEntity objects, an array of short PageSearchResult cards when the traficLimit config option is enabled, or an empty array [] (if there is no data)
76
77
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
77
78
  * @description This method performs a quick search for page objects with limited output. With traficLimit enabled the raw quick search response is returned as short cards; otherwise full page entities are fetched for the found ids.
78
79
  */
79
- searchPage(name: string, url?: string, langCode?: LangType): Promise<IPagesEntity[] | IPageSearchResult[] | IError>;
80
+ searchPage(name: string, url?: string, langCode?: LangType, correct?: boolean): Promise<IPagesEntity[] | IPageSearchResult[] | IError>;
80
81
  /**
81
82
  * Semantic (vector) search for pages.
82
83
  * @handleName getPagesByVectorSearch
@@ -121,7 +122,7 @@ interface IPagesResponse {
121
122
  * @property {number} version - Version number of the object; changes with each update. Example: 10.
122
123
  * @property {string} identifier - Text identifier (marker) of the object. Example: "catalog".
123
124
  * @property {number} attributeSetId - ID of the attribute set in use. Example: 0.
124
- * @property {string} processingType - How form submissions are processed, for example `"email"` or `"url"`. Example: "email".
125
+ * @property {string} processingType - How form submissions are processed: the processing type chosen in the form settings. Example: "script".
125
126
  * @property {ILocalizeInfo} localizeInfos - Localized name and content of the page.
126
127
  * @example
127
128
  {
@@ -142,22 +143,27 @@ interface IPagesResponse {
142
143
  "listTitles": [
143
144
  {
144
145
  "title": "red",
145
- "value": 1,
146
- "position": 1,
147
- "extendedValue": null,
148
- "extendedValueType": null
146
+ "value": "1",
147
+ "extended": {
148
+ "type": null,
149
+ "value": null
150
+ },
151
+ "position": 1
149
152
  },
150
153
  {
151
154
  "title": "yellow",
152
- "value": 2,
153
- "position": 2,
154
- "extendedValue": null,
155
- "extendedValueType": null
155
+ "value": "2",
156
+ "extended": {
157
+ "type": null,
158
+ "value": null
159
+ },
160
+ "position": 2
156
161
  }
157
162
  ],
158
163
  "validators": {},
159
164
  "localizeInfos": {
160
- "title": "l1"
165
+ "title": "l1"
166
+ }
161
167
  }
162
168
  ]
163
169
  * @description This interface defines the structure of a position form entity, including its identifiers, attributes, and processing data.
@@ -188,7 +194,7 @@ interface IPositionForm {
188
194
  * @property {number} version - Version number of the object; changes with each update. Example: 0.
189
195
  * @property {number} position - Position of the object, used for sorting. Example: 1.
190
196
  * @property {string} identifier - Text identifier (marker) of the object. Example: "product_block".
191
- * @property {BlockType} type - Block type. Example: "product".
197
+ * @property {BlockType} type - Block type. Example: "product_block".
192
198
  * @property {string | null} templateIdentifier - Marker of the linked template, or `null` when none is linked. Example: null.
193
199
  * @property {boolean} isVisible - Whether the page is visible. Example: true.
194
200
  * @property {boolean} isSync - Whether the page is indexed. Example: false.
@@ -285,7 +291,6 @@ type PageType = 'catalog_page' | 'common_page' | 'error_page' | 'external_page';
285
291
  }
286
292
  * @property {Array<IFormConfig>} [moduleFormConfigs] - Form configurations of the module linked to the page.
287
293
  * @property {IRating} [rating] - Rating data: average value, likes and dislikes, and the calculation method.
288
- * @property {string} [total] - Total number of products linked to the page. Example: "10".
289
294
  * @property {string | null} [categoryPath] - Category path; `null` for nested pages that have no category path of their own. Example: "catalog".
290
295
  * @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.
291
296
  * @description This interface defines the structure of a page entity, including its identifiers, attributes, and hierarchical relationships.
@@ -310,7 +315,6 @@ interface IPagesEntity {
310
315
  config?: Record<string, number>;
311
316
  products?: number;
312
317
  childrenCount?: number;
313
- total?: string;
314
318
  categoryPath?: string | null;
315
319
  distance?: number;
316
320
  }
@@ -32,7 +32,6 @@ export declare const PageEntitySchema: z.ZodObject<{
32
32
  config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
33
33
  products: z.ZodOptional<z.ZodNumber>;
34
34
  childrenCount: z.ZodOptional<z.ZodNumber>;
35
- total: z.ZodOptional<z.ZodString>;
36
35
  categoryPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
36
  distance: z.ZodOptional<z.ZodNumber>;
38
37
  }, z.core.$strip>;
@@ -64,7 +63,6 @@ export declare const PagesResponseSchema: z.ZodArray<z.ZodObject<{
64
63
  config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
65
64
  products: z.ZodOptional<z.ZodNumber>;
66
65
  childrenCount: z.ZodOptional<z.ZodNumber>;
67
- total: z.ZodOptional<z.ZodString>;
68
66
  categoryPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
67
  distance: z.ZodOptional<z.ZodNumber>;
70
68
  }, z.core.$strip>>;
@@ -111,7 +109,6 @@ export declare const SinglePageSchema: z.ZodObject<{
111
109
  config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
112
110
  products: z.ZodOptional<z.ZodNumber>;
113
111
  childrenCount: z.ZodOptional<z.ZodNumber>;
114
- total: z.ZodOptional<z.ZodString>;
115
112
  categoryPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
116
113
  distance: z.ZodOptional<z.ZodNumber>;
117
114
  }, z.core.$strip>;
@@ -32,7 +32,6 @@ exports.PageEntitySchema = zod_1.z.object({
32
32
  config: zod_1.z.record(zod_1.z.string(), zod_1.z.number()).optional(),
33
33
  products: zod_1.z.number().optional(),
34
34
  childrenCount: zod_1.z.number().optional(),
35
- total: zod_1.z.string().optional(),
36
35
  categoryPath: zod_1.z.string().nullable().optional(),
37
36
  distance: zod_1.z.number().optional(),
38
37
  });
@@ -43,13 +43,13 @@ export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
43
43
  * Get one payment session object by order identifier
44
44
  * @handleName getSessionByOrderId
45
45
  * @param {number} id - Order ID. Example: 12345.
46
- * @returns {Promise<IAccountsEntity | IError>} Returns a single payment account object.
46
+ * @returns {Promise<ISessionEntity[] | IError>} Returns the payment sessions of the order — an **array**, `[]` (with `200`) for an order without sessions, an order that does not exist or an order of another user.
47
47
  * @throws {IError} When isShell=false and an error occurs during the fetch
48
- * @description This method gets one payment session object by order identifier. This method requires user authorization.
48
+ * @description This method gets the payment sessions of an order by its identifier. The answer is an array even for one session. This method requires user authorization.
49
49
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
50
50
  * @see {@link https://js-sdk.oneentry.cloud/docs/payments/getSessionByOrderId getSessionByOrderId} documentation.
51
51
  */
52
- getSessionByOrderId(id: number): Promise<ISessionEntity | ISessionEntity[] | IError>;
52
+ getSessionByOrderId(id: number): Promise<ISessionEntity[] | IError>;
53
53
  /**
54
54
  * Creation of payment session.
55
55
  * @handleName createSession
@@ -66,25 +66,24 @@ export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
66
66
  /**
67
67
  * Get all payment accounts as an array.
68
68
  * @handleName getAccounts
69
- * @returns {Promise<IAccountsEntity | IError>} Returns all created payment accounts as an array of PaymentAccountEntity objects.
69
+ * @param {string} [langCode] - Language code. Default: the client's language.
70
+ * @returns {Promise<IAccountsEntity[] | IError>} Returns all created payment accounts as an array of PaymentAccountEntity objects.
70
71
  * @throws {IError} When isShell=false and an error occurs during the fetch
71
- * @description This method gets all payment accounts as an array. This method requires user authorization.
72
- * @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}.
72
+ * @description This method gets all payment accounts as an array. It does not require user authorization: a guest gets the accounts too.
73
73
  * @see {@link https://js-sdk.oneentry.cloud/docs/payments/getAccounts getAccounts} documentation.
74
74
  */
75
- getAccounts(): Promise<IAccountsEntity[] | IError>;
75
+ getAccounts(langCode?: string): Promise<IAccountsEntity[] | IError>;
76
76
  /**
77
77
  * Get a single payment account object by its identifier.
78
78
  * @handleName getAccountById
79
79
  * @param {number} id - Payment account ID. Example: 12345.
80
+ * @param {string} [langCode] - Language code. Default: the client's language.
80
81
  * @returns {Promise<IAccountsEntity | IError>} Returns a single payment account object.
81
82
  * @throws {IError} When isShell=false and an error occurs during the fetch
82
- * @description Get a single payment account object by its identifier.
83
- * @description This method requires user authorization.
84
- * @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}.
83
+ * @description Get a single payment account object by its identifier. It does not require user authorization: a guest gets the account too.
85
84
  * @see {@link https://js-sdk.oneentry.cloud/docs/payments/getAccountById getAccountById} documentation.
86
85
  */
87
- getAccountById(id: number): Promise<IAccountsEntity | IError>;
86
+ getAccountById(id: number, langCode?: string): Promise<IAccountsEntity | IError>;
88
87
  /**
89
88
  * Get the payment progress of an order: its stages and whether they are paid.
90
89
  * @handleName getPaymentStagesByOrderId