oneentry 1.0.176 → 1.0.177

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 (197) 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 +16 -0
  44. package/dist/forms-data/formsDataApi.js +32 -5
  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 +6 -5
  59. package/dist/pages/pagesApi.js +44 -31
  60. package/dist/pages/pagesInterfaces.d.ts +18 -15
  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 +38 -58
  72. package/dist/products/productsApi.js +59 -72
  73. package/dist/products/productsInterfaces.d.ts +48 -85
  74. package/dist/search/searchApi.d.ts +1 -1
  75. package/dist/search/searchApi.js +4 -3
  76. package/dist/sitemap/sitemapInterfaces.d.ts +10 -6
  77. package/dist/subscriptions/subscriptionsApi.d.ts +1 -1
  78. package/dist/subscriptions/subscriptionsApi.js +1 -1
  79. package/dist/subscriptions/subscriptionsInterfaces.d.ts +1 -1
  80. package/dist/system/systemApi.d.ts +2 -0
  81. package/dist/system/systemApi.js +2 -0
  82. package/dist/system/systemInterfaces.d.ts +2 -0
  83. package/dist/templates/templatesApi.d.ts +2 -2
  84. package/dist/templates/templatesApi.js +12 -11
  85. package/dist/templates/templatesInterfaces.d.ts +2 -2
  86. package/dist/templates-preview/templatesPreviewApi.js +2 -2
  87. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +23 -13
  88. package/dist/templates-preview/templatesPreviewSchemas.d.ts +7 -0
  89. package/dist/templates-preview/templatesPreviewSchemas.js +2 -0
  90. package/dist/user-groups/userGroupsApi.js +5 -5
  91. package/dist/user-groups/userGroupsSchemas.d.ts +4 -4
  92. package/dist/users/usersApi.d.ts +1 -1
  93. package/dist/users/usersApi.js +28 -15
  94. package/dist/users/usersInterfaces.d.ts +2 -9
  95. package/dist/web-socket/lazySocket.d.ts +6 -5
  96. package/dist/web-socket/lazySocket.js +212 -15
  97. package/dist/web-socket/wsApi.d.ts +7 -4
  98. package/dist/web-socket/wsApi.js +49 -12
  99. package/dist/web-socket/wsInterfaces.d.ts +41 -4
  100. package/esm/admins/adminsApi.js +2 -9
  101. package/esm/admins/adminsInterfaces.d.ts +5 -5
  102. package/esm/admins/adminsSchemas.d.ts +4 -4
  103. package/esm/admins/adminsSchemas.js +2 -2
  104. package/esm/attribute-sets/attributeSetsApi.d.ts +1 -1
  105. package/esm/attribute-sets/attributeSetsApi.js +4 -4
  106. package/esm/attribute-sets/attributeSetsInterfaces.d.ts +65 -14
  107. package/esm/attribute-sets/attributeSetsSchemas.d.ts +8 -6
  108. package/esm/attribute-sets/attributeSetsSchemas.js +6 -9
  109. package/esm/auth-provider/authProviderApi.d.ts +4 -4
  110. package/esm/auth-provider/authProviderApi.js +90 -23
  111. package/esm/auth-provider/authProviderSchemas.d.ts +1 -0
  112. package/esm/auth-provider/authProviderSchemas.js +1 -0
  113. package/esm/auth-provider/authProvidersInterfaces.d.ts +8 -6
  114. package/esm/base/asyncModules.d.ts +62 -1
  115. package/esm/base/asyncModules.js +219 -37
  116. package/esm/base/stateModule.d.ts +2 -0
  117. package/esm/base/stateModule.js +22 -12
  118. package/esm/base/syncModules.d.ts +18 -10
  119. package/esm/base/syncModules.js +99 -29
  120. package/esm/base/utils.d.ts +26 -21
  121. package/esm/base/validation.d.ts +3 -3
  122. package/esm/base/validation.js +6 -7
  123. package/esm/blocks/blocksApi.d.ts +20 -17
  124. package/esm/blocks/blocksApi.js +82 -64
  125. package/esm/blocks/blocksInterfaces.d.ts +8 -8
  126. package/esm/discounts/discountsApi.d.ts +9 -7
  127. package/esm/discounts/discountsApi.js +16 -13
  128. package/esm/discounts/discountsInterfaces.d.ts +14 -10
  129. package/esm/events/eventsApi.d.ts +3 -3
  130. package/esm/events/eventsApi.js +3 -3
  131. package/esm/events/eventsInterfaces.d.ts +10 -14
  132. package/esm/file-uploading/fileUploadingApi.d.ts +4 -4
  133. package/esm/file-uploading/fileUploadingApi.js +13 -5
  134. package/esm/file-uploading/fileUploadingInterfaces.d.ts +5 -6
  135. package/esm/filters/filtersApi.js +2 -2
  136. package/esm/forms/formsApi.js +2 -2
  137. package/esm/forms/formsInterfaces.d.ts +1 -3
  138. package/esm/forms/formsSchemas.d.ts +3 -6
  139. package/esm/forms/formsSchemas.js +2 -4
  140. package/esm/forms-data/formsDataApi.d.ts +16 -0
  141. package/esm/forms-data/formsDataApi.js +32 -5
  142. package/esm/forms-data/formsDataInterfaces.d.ts +17 -13
  143. package/esm/general-types/generalTypesInterfaces.d.ts +1 -1
  144. package/esm/index.d.ts +7 -6
  145. package/esm/index.js +50 -7
  146. package/esm/integration-collections/integrationCollectionsApi.d.ts +15 -4
  147. package/esm/integration-collections/integrationCollectionsApi.js +41 -14
  148. package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +8 -9
  149. package/esm/integration-collections/integrationCollectionsSchemas.d.ts +0 -2
  150. package/esm/integration-collections/integrationCollectionsSchemas.js +0 -1
  151. package/esm/menus/menusApi.js +1 -1
  152. package/esm/orders/ordersApi.d.ts +1 -13
  153. package/esm/orders/ordersApi.js +21 -42
  154. package/esm/orders/ordersInterfaces.d.ts +21 -14
  155. package/esm/pages/pagesApi.d.ts +6 -5
  156. package/esm/pages/pagesApi.js +44 -31
  157. package/esm/pages/pagesInterfaces.d.ts +18 -15
  158. package/esm/pages/pagesSchemas.d.ts +0 -3
  159. package/esm/pages/pagesSchemas.js +0 -1
  160. package/esm/payments/paymentsApi.d.ts +10 -11
  161. package/esm/payments/paymentsApi.js +22 -18
  162. package/esm/payments/paymentsInterfaces.d.ts +12 -14
  163. package/esm/payments/paymentsSchemas.d.ts +21 -20
  164. package/esm/payments/paymentsSchemas.js +5 -8
  165. package/esm/product-statuses/productStatusesApi.d.ts +1 -1
  166. package/esm/product-statuses/productStatusesApi.js +3 -3
  167. package/esm/product-statuses/productStatusesInterfaces.d.ts +1 -4
  168. package/esm/products/productsApi.d.ts +38 -58
  169. package/esm/products/productsApi.js +59 -72
  170. package/esm/products/productsInterfaces.d.ts +48 -85
  171. package/esm/search/searchApi.d.ts +1 -1
  172. package/esm/search/searchApi.js +4 -3
  173. package/esm/sitemap/sitemapInterfaces.d.ts +10 -6
  174. package/esm/subscriptions/subscriptionsApi.d.ts +1 -1
  175. package/esm/subscriptions/subscriptionsApi.js +1 -1
  176. package/esm/subscriptions/subscriptionsInterfaces.d.ts +1 -1
  177. package/esm/system/systemApi.d.ts +2 -0
  178. package/esm/system/systemApi.js +2 -0
  179. package/esm/system/systemInterfaces.d.ts +2 -0
  180. package/esm/templates/templatesApi.d.ts +2 -2
  181. package/esm/templates/templatesApi.js +11 -10
  182. package/esm/templates/templatesInterfaces.d.ts +2 -2
  183. package/esm/templates-preview/templatesPreviewApi.js +2 -2
  184. package/esm/templates-preview/templatesPreviewInterfaces.d.ts +23 -13
  185. package/esm/templates-preview/templatesPreviewSchemas.d.ts +7 -0
  186. package/esm/templates-preview/templatesPreviewSchemas.js +2 -0
  187. package/esm/user-groups/userGroupsApi.js +5 -5
  188. package/esm/user-groups/userGroupsSchemas.d.ts +4 -4
  189. package/esm/users/usersApi.d.ts +1 -1
  190. package/esm/users/usersApi.js +28 -15
  191. package/esm/users/usersInterfaces.d.ts +2 -9
  192. package/esm/web-socket/lazySocket.d.ts +6 -5
  193. package/esm/web-socket/lazySocket.js +212 -15
  194. package/esm/web-socket/wsApi.d.ts +7 -4
  195. package/esm/web-socket/wsApi.js +49 -12
  196. package/esm/web-socket/wsInterfaces.d.ts +41 -4
  197. package/package.json +2 -2
@@ -86,11 +86,13 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
86
86
  * @handleName getICollectionRowsByMarker
87
87
  * @param {string} marker - Marker of the collection. Example: "collection1".
88
88
  * @param {string} [langCode] - Language code. Default: "en_US".
89
+ * @param {ICollectionQuery} [userQuery] - Pagination and entity filter, as in `getICollectionRowsById`. Without it the API returns the first 30 records only. Example: `{ limit: 100, offset: 0 }`.
89
90
  * @returns {Promise<ICollectionRowsResponce | IError>} Returns CollectionRowEntity object.
90
91
  * @throws {IError} When isShell=false and an error occurs during the fetch
92
+ * @description Records of the collection, one page at a time: `limit` defaults to 30 and `total` holds the full count.
91
93
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsByMarker getICollectionRowsByMarker} documentation.
92
94
  */
93
- getICollectionRowsByMarker(marker: string, langCode?: string): Promise<ICollectionRowsResponce | IError>;
95
+ getICollectionRowsByMarker(marker: string, langCode?: string, userQuery?: ICollectionQuery): Promise<ICollectionRowsResponce | IError>;
94
96
  /**
95
97
  * Getting one record from the collection.
96
98
  * @handleName getICollectionRowByMarkerAndId
@@ -121,7 +123,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
121
123
  * @param {string} [langCode] - Language code. Default: "en_US".
122
124
  * @returns {Promise<ICollectionRow | IError>} Returns object of type ICollectionRow.
123
125
  * @throws {IError} When isShell=false and an error occurs during the fetch
124
- * @description Create a record in the collection.
126
+ * @description Create a record in the collection. The row is stored under the language key of `formData` when it is wrapped (`{ "en_US": [...] }`), not under `langCode` of the call; the returned `formData` is an array either way.
125
127
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/createICollectionRow createICollectionRow} documentation.
126
128
  */
127
129
  createICollectionRow(marker: string, body: ICollectionFormObject, langCode?: string): Promise<ICollectionRow | IError>;
@@ -147,7 +149,7 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
147
149
  * @param {string} [langCode] - Language code. Default: "en_US".
148
150
  * @returns {Promise<ICollectionRow | IError>} Returns object of type ICollectionRow.
149
151
  * @throws {IError} When isShell=false and an error occurs during the fetch
150
- * @description Edit a record in the collection.
152
+ * @description Edit a record in the collection. `formData` **replaces** every field of the row: fields left out of the body are removed, not kept.
151
153
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/updateICollectionRow updateICollectionRow} documentation.
152
154
  */
153
155
  updateICollectionRow(marker: string, id: number, body: {
@@ -159,10 +161,19 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
159
161
  * @handleName deleteICollectionRowByMarkerAndId
160
162
  * @param {string} marker - Marker of the collection. Example: "collection1".
161
163
  * @param {number} id - ID of the collection row. Example: 12.
162
- * @returns {Promise<boolean | IError>} Returns true (in case of successful deletion) or false (in case of unsuccessful deletion) (permission "collections.row.delete" required for access)
164
+ * @returns {Promise<boolean | IError>} Returns `true` once the row is deleted; a row that is not there (or already deleted) answers IError `404 Row not found`, not `false`. Permission "collections.row.delete" is required.
163
165
  * @throws {IError} When isShell=false and an error occurs during the fetch
164
166
  * @description Deletion of collection record object
165
167
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/deleteICollectionRowByMarkerAndId deleteICollectionRowByMarkerAndId} documentation.
166
168
  */
167
169
  deleteICollectionRowByMarkerAndId(marker: string, id: number): Promise<boolean | IError>;
170
+ /**
171
+ * Unwraps `formData` of a created or updated row that is still keyed by a language.
172
+ * @param {any} row - The normalized row.
173
+ * @returns {any} The row with `formData` as an array.
174
+ * @description The row is stored under the language key of the body, and the answer
175
+ * keeps that key: `createICollectionRow(…, 'ru_RU')` with `{ en_US: [...] }` returned
176
+ * `formData` as an object, while `ICollectionRow.formData` is an array.
177
+ */
178
+ private _rowFormDataAsArray;
168
179
  }
@@ -94,7 +94,8 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
94
94
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionById getICollectionById} documentation.
95
95
  */
96
96
  async getICollectionById(id, langCode = this.state.lang) {
97
- const result = await this._fetchGet(`/${id}?` + this._queryParamsToString({ langCode }));
97
+ const result = await this._fetchGet(`/${this._pathSegment(String(id))}?` +
98
+ this._queryParamsToString({ langCode }));
98
99
  // Validate response if validation is enabled
99
100
  const validated = await this._validateResponse(result, schema('CollectionEntitySchema'));
100
101
  return this._normalizeData(validated, langCode);
@@ -122,7 +123,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
122
123
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsById getICollectionRowsById} documentation.
123
124
  */
124
125
  async getICollectionRowsById(id, langCode = this.state.lang, userQuery) {
125
- const result = await this._fetchGet(`/${id}/rows?` +
126
+ const result = await this._fetchGet(`/${this._pathSegment(String(id))}/rows?` +
126
127
  this._queryParamsToString({
127
128
  ...this._defaultQuery,
128
129
  ...userQuery,
@@ -156,12 +157,19 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
156
157
  * @handleName getICollectionRowsByMarker
157
158
  * @param {string} marker - Marker of the collection. Example: "collection1".
158
159
  * @param {string} [langCode] - Language code. Default: "en_US".
160
+ * @param {ICollectionQuery} [userQuery] - Pagination and entity filter, as in `getICollectionRowsById`. Without it the API returns the first 30 records only. Example: `{ limit: 100, offset: 0 }`.
159
161
  * @returns {Promise<ICollectionRowsResponce | IError>} Returns CollectionRowEntity object.
160
162
  * @throws {IError} When isShell=false and an error occurs during the fetch
163
+ * @description Records of the collection, one page at a time: `limit` defaults to 30 and `total` holds the full count.
161
164
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsByMarker getICollectionRowsByMarker} documentation.
162
165
  */
163
- async getICollectionRowsByMarker(marker, langCode = this.state.lang) {
164
- const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/rows?langCode=${langCode}`);
166
+ async getICollectionRowsByMarker(marker, langCode = this.state.lang, userQuery) {
167
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/rows?` +
168
+ this._queryParamsToString({
169
+ ...this._defaultQuery,
170
+ ...userQuery,
171
+ langCode,
172
+ }));
165
173
  // Validate response if validation is enabled
166
174
  const validated = await this._validateResponse(result, schema('CollectionRowsResponseSchema'));
167
175
  return this._normalizeData(validated, langCode);
@@ -177,7 +185,7 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
177
185
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowByMarkerAndId getICollectionRowByMarkerAndId} documentation.
178
186
  */
179
187
  async getICollectionRowByMarkerAndId(marker, id, langCode = this.state.lang) {
180
- const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/rows/${id}?langCode=${langCode}`);
188
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/rows/${this._pathSegment(String(id))}?langCode=${encodeURIComponent(langCode)}`);
181
189
  // Validate response if validation is enabled
182
190
  const validated = await this._validateResponse(result, schema('CollectionRowSchema'));
183
191
  return this._normalizeData(validated, langCode);
@@ -201,14 +209,14 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
201
209
  * @param {string} [langCode] - Language code. Default: "en_US".
202
210
  * @returns {Promise<ICollectionRow | IError>} Returns object of type ICollectionRow.
203
211
  * @throws {IError} When isShell=false and an error occurs during the fetch
204
- * @description Create a record in the collection.
212
+ * @description Create a record in the collection. The row is stored under the language key of `formData` when it is wrapped (`{ "en_US": [...] }`), not under `langCode` of the call; the returned `formData` is an array either way.
205
213
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/createICollectionRow createICollectionRow} documentation.
206
214
  */
207
215
  async createICollectionRow(marker, body, langCode = this.state.lang) {
208
- const response = await this._fetchPost(`/marker/${this._pathSegment(marker)}/rows?langCode=${langCode}`, body);
216
+ const response = await this._fetchPost(`/marker/${this._pathSegment(marker)}/rows?langCode=${encodeURIComponent(langCode)}`, body);
209
217
  // Validate response if validation is enabled
210
218
  const validated = await this._validateResponse(response, schema('CollectionRowSchema'));
211
- return this._normalizeData(validated, langCode);
219
+ return this._rowFormDataAsArray(this._normalizeData(validated, langCode));
212
220
  }
213
221
  /**
214
222
  * Edit a record in the collection.
@@ -232,29 +240,48 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
232
240
  * @param {string} [langCode] - Language code. Default: "en_US".
233
241
  * @returns {Promise<ICollectionRow | IError>} Returns object of type ICollectionRow.
234
242
  * @throws {IError} When isShell=false and an error occurs during the fetch
235
- * @description Edit a record in the collection.
243
+ * @description Edit a record in the collection. `formData` **replaces** every field of the row: fields left out of the body are removed, not kept.
236
244
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/updateICollectionRow updateICollectionRow} documentation.
237
245
  */
238
246
  async updateICollectionRow(marker, id, body, langCode = this.state.lang) {
239
- const response = await this._fetchPut(`/marker/${this._pathSegment(marker)}/rows/${id}?` +
240
- `langCode=${langCode}`, body);
247
+ const response = await this._fetchPut(`/marker/${this._pathSegment(marker)}/rows/${this._pathSegment(String(id))}?` +
248
+ `langCode=${encodeURIComponent(langCode)}`, body);
241
249
  // Validate response if validation is enabled
242
250
  const validated = await this._validateResponse(response, schema('CollectionRowSchema'));
243
- return this._normalizeData(validated, langCode);
251
+ return this._rowFormDataAsArray(this._normalizeData(validated, langCode));
244
252
  }
245
253
  /**
246
254
  * Deletion of collection record object
247
255
  * @handleName deleteICollectionRowByMarkerAndId
248
256
  * @param {string} marker - Marker of the collection. Example: "collection1".
249
257
  * @param {number} id - ID of the collection row. Example: 12.
250
- * @returns {Promise<boolean | IError>} Returns true (in case of successful deletion) or false (in case of unsuccessful deletion) (permission "collections.row.delete" required for access)
258
+ * @returns {Promise<boolean | IError>} Returns `true` once the row is deleted; a row that is not there (or already deleted) answers IError `404 Row not found`, not `false`. Permission "collections.row.delete" is required.
251
259
  * @throws {IError} When isShell=false and an error occurs during the fetch
252
260
  * @description Deletion of collection record object
253
261
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/deleteICollectionRowByMarkerAndId deleteICollectionRowByMarkerAndId} documentation.
254
262
  */
255
263
  async deleteICollectionRowByMarkerAndId(marker, id) {
256
- const result = await this._fetchDelete(`/marker/${this._pathSegment(marker)}/rows/${id}`);
264
+ const result = await this._fetchDelete(`/marker/${this._pathSegment(marker)}/rows/${this._pathSegment(String(id))}`);
257
265
  return result;
258
266
  }
267
+ /**
268
+ * Unwraps `formData` of a created or updated row that is still keyed by a language.
269
+ * @param {any} row - The normalized row.
270
+ * @returns {any} The row with `formData` as an array.
271
+ * @description The row is stored under the language key of the body, and the answer
272
+ * keeps that key: `createICollectionRow(…, 'ru_RU')` with `{ en_US: [...] }` returned
273
+ * `formData` as an object, while `ICollectionRow.formData` is an array.
274
+ */
275
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
276
+ _rowFormDataAsArray(row) {
277
+ const formData = row === null || row === void 0 ? void 0 : row.formData;
278
+ if (formData && typeof formData === 'object' && !Array.isArray(formData)) {
279
+ const keys = Object.keys(formData);
280
+ if (keys.length === 1 && Array.isArray(formData[keys[0]])) {
281
+ return { ...row, formData: formData[keys[0]] };
282
+ }
283
+ }
284
+ return row;
285
+ }
259
286
  }
260
287
  exports.default = IntegrationCollectionsApi;
@@ -71,11 +71,12 @@ interface ICollectionsApi {
71
71
  * @handleName getICollectionRowsByMarker
72
72
  * @param {string} marker - Marker of the collection. Example: "collection1".
73
73
  * @param {string} [langCode] - Language code. Default: "en_US".
74
+ * @param {ICollectionQuery} [userQuery] - Pagination and entity filter. Without it the API returns the first 30 records only.
74
75
  * @returns {ICollectionRowsResponce} Returns collection row entity object.
75
76
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
76
- * @description This method gets all records from the collection.
77
+ * @description Records of the collection, one page at a time: `limit` defaults to 30 and `total` holds the full count.
77
78
  */
78
- getICollectionRowsByMarker(marker: string, langCode?: string): Promise<ICollectionRowsResponce | IError>;
79
+ getICollectionRowsByMarker(marker: string, langCode?: string, userQuery?: ICollectionQuery): Promise<ICollectionRowsResponce | IError>;
79
80
  /**
80
81
  * Getting one record from the collection.
81
82
  * @handleName getICollectionRowByMarkerAndId
@@ -189,13 +190,13 @@ interface ICollectionResponce {
189
190
  * @interface ICollectionFormData
190
191
  * @property {string} marker - Text identifier (marker) of the form field. Example: "collection_marker".
191
192
  * @property {string} type - Type of the form field, for example `"text"`, `"number"` or `"date"`. Example: "number".
192
- * @property {string} value - Value of the form field. Example: "Collection marker".
193
+ * @property {string | number | null} value - Value of the form field. Send a string; on reading, `integer`/`float`/`real` fields come back as a `number` — and as `null` when the stored value is not a number (the API stores `"abc"` in a `float` field as is, the SDK does not pass it on). Example: "Collection marker".
193
194
  * @description Represents a form data object within a collection, containing a marker, type, and value.
194
195
  */
195
196
  interface ICollectionFormData {
196
197
  marker: string;
197
198
  type: string;
198
- value: string;
199
+ value: string | number | null;
199
200
  }
200
201
  /**
201
202
  * Collection form object
@@ -225,7 +226,7 @@ interface ICollectionFormObject {
225
226
  * @property {number} id - Object ID. Example: 1.
226
227
  * @property {string} createdDate - Creation date of the record. Example: "2023-01-01T00:00:00Z".
227
228
  * @property {string} updatedDate - Date the record was last updated. Example: "2023-01-02T00:00:00Z".
228
- * @property {number | null} [collectionId] - ID of the collection the row belongs to. Example: "product", "order", "etc".
229
+ * @property {number | null} [collectionId] - ID of the collection the row belongs to. The row list and row-by-id endpoints do not return it. Example: 1.
229
230
  * @property {ICollectionFormData[]} formData - Form fields of the collection row.
230
231
  * @example
231
232
  [
@@ -240,8 +241,7 @@ interface ICollectionFormObject {
240
241
  * @property {string | null} [attributeSetIdentifier] - Marker of the attribute set used by the form attached to the collection row, or `null` if there is none. Example: "attributeSet1" or null.
241
242
  * @property {string | null} [langCode] - Language code the row was stored under. Example: "en_US".
242
243
  * @property {string | null} [formIdentifier] - Marker of the form the row was created from; returned by the create and update row endpoints. Example: "collection_form".
243
- * @property {string} total - Total number of records. Example: "1".
244
- * @description Represents a row in a collection, containing various properties such as identifiers, dates, form data, and an optional total value.
244
+ * @description Represents a row in a collection, containing various properties such as identifiers, dates and form data.
245
245
  */
246
246
  interface ICollectionRow {
247
247
  id: number;
@@ -254,7 +254,6 @@ interface ICollectionRow {
254
254
  attributeSetIdentifier?: string | null;
255
255
  langCode?: string | null;
256
256
  formIdentifier?: string | null;
257
- total?: string;
258
257
  }
259
258
  /**
260
259
  * Collection rows response object
@@ -315,4 +314,4 @@ interface ICollectionQuery {
315
314
  * @property {number} [offset] - Number of records to skip. Default: 0.
316
315
  */
317
316
  type ICollectionsListQuery = Pick<ICollectionQuery, 'limit' | 'offset'>;
318
- export type { ICollectionEntity, ICollectionFormObject, ICollectionIsValid, ICollectionQuery, ICollectionResponce, ICollectionRow, ICollectionRowsResponce, ICollectionsApi, ICollectionsListQuery, };
317
+ export type { ICollectionEntity, ICollectionFormData, ICollectionFormObject, ICollectionIsValid, ICollectionQuery, ICollectionResponce, ICollectionRow, ICollectionRowsResponce, ICollectionsApi, ICollectionsListQuery, };
@@ -51,7 +51,6 @@ export declare const CollectionRowSchema: z.ZodObject<{
51
51
  attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
52
  langCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
53
  formIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
- total: z.ZodOptional<z.ZodString>;
55
54
  }, z.core.$strip>;
56
55
  /**
57
56
  * Collection rows response schema
@@ -72,7 +71,6 @@ export declare const CollectionRowsResponseSchema: z.ZodObject<{
72
71
  attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
72
  langCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
74
73
  formIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
75
- total: z.ZodOptional<z.ZodString>;
76
74
  }, z.core.$strip>>;
77
75
  total: z.ZodNumber;
78
76
  }, z.core.$strip>;
@@ -46,7 +46,6 @@ exports.CollectionRowSchema = zod_1.z.object({
46
46
  attributeSetIdentifier: zod_1.z.string().nullable().optional(),
47
47
  langCode: zod_1.z.string().nullable().optional(),
48
48
  formIdentifier: zod_1.z.string().nullable().optional(),
49
- total: zod_1.z.string().optional(),
50
49
  });
51
50
  /**
52
51
  * Collection rows response schema
@@ -65,7 +65,7 @@ class MenusApi extends asyncModules_1.default {
65
65
  * @see {@link https://js-sdk.oneentry.cloud/docs/menus/getMenusByMarker getMenusByMarker} documentation.
66
66
  */
67
67
  async getMenusByMarker(marker, langCode = this.state.lang) {
68
- const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
68
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${encodeURIComponent(langCode)}`);
69
69
  // Validate response if validation is enabled
70
70
  const validated = await this._validateResponse(result, schema('MenuEntitySchema'));
71
71
  return this._normalizeData(validated, langCode);
@@ -165,6 +165,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
165
165
  * @param {number} [limit] - Maximum number of records to return. Default: 30.
166
166
  * @returns {Promise<IOrderStatus[] | IError>} Returns an object with the orders statuses.
167
167
  * @throws {IError} When isShell=false and an error occurs during the fetch
168
+ * @description Get all order statuses of the storage. This method requires user authorization: a guest gets `401 Unauthorized`.
168
169
  * @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}.
169
170
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllStatusesByStorageMarker getAllStatusesByStorageMarker} documentation.
170
171
  */
@@ -211,19 +212,6 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
211
212
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrdersByVectorSearch getOrdersByVectorSearch} documentation.
212
213
  */
213
214
  getOrdersByVectorSearch(body: IOrdersVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IOrdersByMarkerEntity> | IError>;
214
- /**
215
- * Runs a fetch against the `/orders` base URL instead of the default
216
- * `/orders-storage`, then restores the original URL.
217
- *
218
- * Refund endpoints live under `/api/content/orders`, while this class is based
219
- * on `/api/content/orders-storage`. The helper swaps `_url` for the duration of
220
- * the call and restores it in `finally`, so the base URL is restored even if
221
- * the request throws.
222
- * @param {() => Promise<T>} fetcher - Thunk performing the fetch call.
223
- * @returns {Promise<T>} The fetcher result.
224
- * @template T
225
- */
226
- private _withOrdersUrl;
227
215
  /**
228
216
  * Builds the order body the API expects: `formData` wrapped in a map keyed by locale.
229
217
  *
@@ -69,8 +69,8 @@ class OrdersApi extends asyncModules_1.default {
69
69
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllOrdersStorage getAllOrdersStorage} documentation.
70
70
  */
71
71
  async getAllOrdersStorage(langCode = this.state.lang, offset = 0, limit = 30) {
72
- const result = await this._fetchGet(`?langCode=${langCode}&limit=${limit}&offset=${offset}`);
73
- return this._normalizeData(result);
72
+ const result = await this._fetchGet(`?langCode=${encodeURIComponent(langCode)}&limit=${encodeURIComponent(String(limit))}&offset=${encodeURIComponent(String(offset))}`);
73
+ return this._normalizeData(result, langCode);
74
74
  }
75
75
  /**
76
76
  * Getting all orders from the orders storage object created by the user.
@@ -86,10 +86,10 @@ class OrdersApi extends asyncModules_1.default {
86
86
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllOrdersByMarker getAllOrdersByMarker} documentation.
87
87
  */
88
88
  async getAllOrdersByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
89
- const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/orders?langCode=${langCode}&limit=${limit}&offset=${offset}`);
89
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/orders?langCode=${encodeURIComponent(langCode)}&limit=${encodeURIComponent(String(limit))}&offset=${encodeURIComponent(String(offset))}`);
90
90
  // Validate response if validation is enabled
91
91
  const validated = await this._validateResponse(result, schema('OrdersResponseSchema'));
92
- return this._normalizeData(validated);
92
+ return this._normalizeData(validated, langCode);
93
93
  }
94
94
  /**
95
95
  * Retrieve one order storage object by marker.
@@ -103,8 +103,8 @@ class OrdersApi extends asyncModules_1.default {
103
103
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrdersStorageByMarker getOrdersStorageByMarker} documentation.
104
104
  */
105
105
  async getOrdersStorageByMarker(marker, langCode = this.state.lang) {
106
- const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
107
- return this._normalizeData(result);
106
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${encodeURIComponent(langCode)}`);
107
+ return this._normalizeData(result, langCode);
108
108
  }
109
109
  /**
110
110
  * Getting a single order from the order storage object created by the user.
@@ -119,10 +119,10 @@ class OrdersApi extends asyncModules_1.default {
119
119
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrderByMarkerAndId getOrderByMarkerAndId} documentation.
120
120
  */
121
121
  async getOrderByMarkerAndId(marker, id, langCode = this.state.lang) {
122
- const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/orders/${id}?langCode=${langCode}`);
122
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/orders/${this._pathSegment(String(id))}?langCode=${encodeURIComponent(langCode)}`);
123
123
  // Validate response if validation is enabled
124
124
  const validated = await this._validateResponse(result, schema('OrderEntitySchema'));
125
- return this._normalizeData(validated);
125
+ return this._normalizeData(validated, langCode);
126
126
  }
127
127
  /**
128
128
  * Getting a single order created by the user, by its own id.
@@ -138,10 +138,10 @@ class OrdersApi extends asyncModules_1.default {
138
138
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrderById getOrderById} documentation.
139
139
  */
140
140
  async getOrderById(id, langCode = this.state.lang) {
141
- const result = await this._withOrdersUrl(() => this._fetchGet(`/${id}?langCode=${langCode}`));
141
+ const result = await this._withBaseUrl(this._ordersUrl)._fetchGet(`/${this._pathSegment(String(id))}?langCode=${encodeURIComponent(langCode)}`);
142
142
  // Validate response if validation is enabled
143
143
  const validated = await this._validateResponse(result, schema('OrderEntitySchema'));
144
- return this._normalizeData(validated);
144
+ return this._normalizeData(validated, langCode);
145
145
  }
146
146
  /**
147
147
  * Preview order calculation with discounts and coupons (without saving).
@@ -155,8 +155,8 @@ class OrdersApi extends asyncModules_1.default {
155
155
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/previewOrder previewOrder} documentation.
156
156
  */
157
157
  async previewOrder(body, langCode = this.state.lang) {
158
- const result = await this._fetchPost(`/orders/preview?langCode=${langCode}`, body);
159
- return this._normalizeData(result);
158
+ const result = await this._fetchPost(`/orders/preview?langCode=${encodeURIComponent(langCode)}`, body);
159
+ return this._normalizeData(result, langCode);
160
160
  }
161
161
  /**
162
162
  * Creation of an order in the order storage.
@@ -190,7 +190,7 @@ class OrdersApi extends asyncModules_1.default {
190
190
  const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/orders`, this._wrapOrderFormData(body, langCode));
191
191
  // Validate response if validation is enabled
192
192
  const validated = await this._validateResponse(result, schema('CreateOrderResponseSchema'));
193
- return this._normalizeData(validated);
193
+ return this._normalizeData(validated, langCode);
194
194
  }
195
195
  /**
196
196
  * Changing an order in the orders storage
@@ -223,10 +223,10 @@ class OrdersApi extends asyncModules_1.default {
223
223
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/updateOrderByMarkerAndId updateOrderByMarkerAndId} documentation.
224
224
  */
225
225
  async updateOrderByMarkerAndId(marker, id, body, langCode = this.state.lang) {
226
- const result = await this._fetchPut(`/marker/${this._pathSegment(marker)}/orders/${id}?langCode=${langCode}`, this._wrapOrderFormData(body, langCode));
226
+ const result = await this._fetchPut(`/marker/${this._pathSegment(marker)}/orders/${this._pathSegment(String(id))}?langCode=${encodeURIComponent(langCode)}`, this._wrapOrderFormData(body, langCode));
227
227
  // Validate response if validation is enabled
228
228
  const validated = await this._validateResponse(result, schema('UpdateOrderResponseSchema'));
229
- return this._normalizeData(validated);
229
+ return this._normalizeData(validated, langCode);
230
230
  }
231
231
  /**
232
232
  * Get all orders statuses by Storage marker
@@ -237,6 +237,7 @@ class OrdersApi extends asyncModules_1.default {
237
237
  * @param {number} [limit] - Maximum number of records to return. Default: 30.
238
238
  * @returns {Promise<IOrderStatus[] | IError>} Returns an object with the orders statuses.
239
239
  * @throws {IError} When isShell=false and an error occurs during the fetch
240
+ * @description Get all order statuses of the storage. This method requires user authorization: a guest gets `401 Unauthorized`.
240
241
  * @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}.
241
242
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllStatusesByStorageMarker getAllStatusesByStorageMarker} documentation.
242
243
  */
@@ -248,7 +249,7 @@ class OrdersApi extends asyncModules_1.default {
248
249
  };
249
250
  const data = await this._fetchGet(`/marker/${this._pathSegment(marker)}/order-statuses?` +
250
251
  this._queryParamsToString(query));
251
- return this._normalizeData(data);
252
+ return this._normalizeData(data, langCode);
252
253
  }
253
254
  /**
254
255
  * Get all refund requests for an order.
@@ -259,7 +260,7 @@ class OrdersApi extends asyncModules_1.default {
259
260
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getRefunds getRefunds} documentation.
260
261
  */
261
262
  async getRefunds(id) {
262
- const data = await this._withOrdersUrl(() => this._fetchGet(`/${id}/refund`));
263
+ const data = await this._withBaseUrl(this._ordersUrl)._fetchGet(`/${this._pathSegment(String(id))}/refund`);
263
264
  return this._normalizeData(data);
264
265
  }
265
266
  /**
@@ -272,7 +273,7 @@ class OrdersApi extends asyncModules_1.default {
272
273
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/createRefundRequest createRefundRequest} documentation.
273
274
  */
274
275
  async createRefundRequest(id, body) {
275
- const data = await this._withOrdersUrl(() => this._fetchPost(`/${id}/refund`, body));
276
+ const data = await this._withBaseUrl(this._ordersUrl)._fetchPost(`/${this._pathSegment(String(id))}/refund`, body);
276
277
  return this._normalizeData(data);
277
278
  }
278
279
  /**
@@ -284,7 +285,7 @@ class OrdersApi extends asyncModules_1.default {
284
285
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/cancelRefundRequest cancelRefundRequest} documentation.
285
286
  */
286
287
  async cancelRefundRequest(id) {
287
- const data = await this._withOrdersUrl(() => this._fetchDelete(`/${id}/refund`));
288
+ const data = await this._withBaseUrl(this._ordersUrl)._fetchDelete(`/${this._pathSegment(String(id))}/refund`);
288
289
  return this._normalizeData(data);
289
290
  }
290
291
  /**
@@ -306,31 +307,9 @@ class OrdersApi extends asyncModules_1.default {
306
307
  offset,
307
308
  limit,
308
309
  };
309
- const data = await this._withOrdersUrl(() => this._fetchPost(`/vector/search?` + this._queryParamsToString(query), body));
310
+ const data = await this._withBaseUrl(this._ordersUrl)._fetchPost(`/vector/search?` + this._queryParamsToString(query), body);
310
311
  return this._normalizeData(data, langCode);
311
312
  }
312
- /**
313
- * Runs a fetch against the `/orders` base URL instead of the default
314
- * `/orders-storage`, then restores the original URL.
315
- *
316
- * Refund endpoints live under `/api/content/orders`, while this class is based
317
- * on `/api/content/orders-storage`. The helper swaps `_url` for the duration of
318
- * the call and restores it in `finally`, so the base URL is restored even if
319
- * the request throws.
320
- * @param {() => Promise<T>} fetcher - Thunk performing the fetch call.
321
- * @returns {Promise<T>} The fetcher result.
322
- * @template T
323
- */
324
- async _withOrdersUrl(fetcher) {
325
- const savedUrl = this._url;
326
- this._url = this._ordersUrl;
327
- try {
328
- return await fetcher();
329
- }
330
- finally {
331
- this._url = savedUrl;
332
- }
333
- }
334
313
  /**
335
314
  * Builds the order body the API expects: `formData` wrapped in a map keyed by locale.
336
315
  *
@@ -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.
@@ -109,6 +109,7 @@ export default class PagesApi extends AsyncModules implements IPagesApi {
109
109
  * Add template data to pages
110
110
  * @handleName addTemplateToPages
111
111
  * @param {IPagesEntity[]} data - An array of page objects (IPagesEntity[]) to which template data will be added.
112
+ * @param {string} [langCode] - Language the templates are fetched and unwrapped in. Default: the client's language.
112
113
  * @example
113
114
  [
114
115
  {
@@ -149,15 +150,15 @@ export default class PagesApi extends AsyncModules implements IPagesApi {
149
150
  * @description Add template data to pages. Optimized to avoid N+1 query problem by fetching only unique templates in parallel.
150
151
  * For example, if 100 pages use 3 different templates, this method makes 3 requests instead of 100.
151
152
  */
152
- protected addTemplateToPages(data: IPagesEntity[]): Promise<any | IError>;
153
+ protected addTemplateToPages(data: IPagesEntity[], langCode?: string): Promise<any | IError>;
153
154
  /**
154
155
  * Add template data to page by page templateIdentifier
155
156
  * @handleName addTemplateToPage
156
157
  * @param {IPagesEntity} data - Page object (IPagesEntity) to which template data will be added.
158
+ * @param {string} [langCode] - Language the templates are fetched and unwrapped in. Default: the client's language.
157
159
  * @returns {Promise<any | IError>} An array of page objects with template data added
158
160
  * @throws {IError} When isShell=false and an error occurs during the fetch
159
161
  * @description Add template data to page by page templateIdentifier
160
- * @see {@link https://js-sdk.oneentry.cloud/docs/pages/addTemplateToPage addTemplateToPage} documentation.
161
162
  */
162
- protected addTemplateToPage(data: IPagesEntity): Promise<any | IError>;
163
+ protected addTemplateToPage(data: IPagesEntity, langCode?: string): Promise<any | IError>;
163
164
  }