oneentry 1.0.175 → 1.0.176

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 (42) hide show
  1. package/changelog.md +24 -0
  2. package/dist/attribute-sets/attributeSetsApi.js +3 -3
  3. package/dist/auth-provider/authProviderApi.js +12 -12
  4. package/dist/base/asyncModules.d.ts +11 -0
  5. package/dist/base/asyncModules.js +14 -0
  6. package/dist/blocks/blocksApi.js +24 -15
  7. package/dist/discounts/discountsApi.js +2 -1
  8. package/dist/events/eventsApi.js +4 -4
  9. package/dist/filters/filtersApi.js +1 -1
  10. package/dist/forms/formsApi.js +1 -1
  11. package/dist/forms-data/formsDataApi.d.ts +10 -8
  12. package/dist/forms-data/formsDataApi.js +14 -10
  13. package/dist/forms-data/formsDataInterfaces.d.ts +75 -54
  14. package/dist/integration-collections/integrationCollectionsApi.js +7 -6
  15. package/dist/menus/menusApi.js +1 -1
  16. package/dist/orders/ordersApi.js +7 -6
  17. package/dist/pages/pagesApi.js +2 -2
  18. package/dist/product-statuses/productStatusesApi.js +2 -2
  19. package/dist/templates/templatesApi.js +1 -1
  20. package/dist/templates-preview/templatesPreviewApi.js +1 -1
  21. package/dist/user-groups/userGroupsApi.js +2 -2
  22. package/esm/attribute-sets/attributeSetsApi.js +3 -3
  23. package/esm/auth-provider/authProviderApi.js +12 -12
  24. package/esm/base/asyncModules.d.ts +11 -0
  25. package/esm/base/asyncModules.js +14 -0
  26. package/esm/blocks/blocksApi.js +24 -15
  27. package/esm/discounts/discountsApi.js +2 -1
  28. package/esm/events/eventsApi.js +4 -4
  29. package/esm/filters/filtersApi.js +1 -1
  30. package/esm/forms/formsApi.js +1 -1
  31. package/esm/forms-data/formsDataApi.d.ts +10 -8
  32. package/esm/forms-data/formsDataApi.js +14 -10
  33. package/esm/forms-data/formsDataInterfaces.d.ts +75 -54
  34. package/esm/integration-collections/integrationCollectionsApi.js +7 -6
  35. package/esm/menus/menusApi.js +1 -1
  36. package/esm/orders/ordersApi.js +7 -6
  37. package/esm/pages/pagesApi.js +2 -2
  38. package/esm/product-statuses/productStatusesApi.js +2 -2
  39. package/esm/templates/templatesApi.js +1 -1
  40. package/esm/templates-preview/templatesPreviewApi.js +1 -1
  41. package/esm/user-groups/userGroupsApi.js +2 -2
  42. package/package.json +2 -2
@@ -62,7 +62,7 @@ export default class BlocksApi extends AsyncModules {
62
62
  * @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getBlockByMarker getBlockByMarker} documentation.
63
63
  */
64
64
  async getBlockByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
65
- const response = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
65
+ const response = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
66
66
  // Validate response if validation is enabled
67
67
  const validated = await this._validateResponse(response, schema('BlockEntitySchema'));
68
68
  const normalizeResponse = this._normalizeData(validated);
@@ -146,7 +146,8 @@ export default class BlocksApi extends AsyncModules {
146
146
  signPrice,
147
147
  productId,
148
148
  };
149
- const result = await this._fetchGet(`/${marker}/similar-products?` + this._queryParamsToString(query));
149
+ const result = await this._fetchGet(`/${this._pathSegment(marker)}/similar-products?` +
150
+ this._queryParamsToString(query));
150
151
  return this._normalizeData(result);
151
152
  }
152
153
  /**
@@ -169,7 +170,8 @@ export default class BlocksApi extends AsyncModules {
169
170
  limit,
170
171
  signPrice,
171
172
  };
172
- const result = await this._fetchGet(`/${marker}/products?` + this._queryParamsToString(query));
173
+ const result = await this._fetchGet(`/${this._pathSegment(marker)}/products?` +
174
+ this._queryParamsToString(query));
173
175
  // On API error responses there is no `items` array — return the (normalized)
174
176
  // error as-is instead of producing `undefined` from `result.items`.
175
177
  if (!Array.isArray(result === null || result === void 0 ? void 0 : result.items)) {
@@ -196,7 +198,7 @@ export default class BlocksApi extends AsyncModules {
196
198
  signPrice,
197
199
  limit,
198
200
  };
199
- const data = await this._fetchGet(`/${marker}/products/${productId}/frequently-ordered?` +
201
+ const data = await this._fetchGet(`/${this._pathSegment(marker)}/products/${productId}/frequently-ordered?` +
200
202
  this._queryParamsToString(query));
201
203
  return this._normalizeData(data);
202
204
  }
@@ -229,7 +231,8 @@ export default class BlocksApi extends AsyncModules {
229
231
  */
230
232
  async getCartComplement(marker, langCode = this.state.lang, signPrice, limit) {
231
233
  const query = { langCode, signPrice, limit };
232
- const data = await this._fetchGet(`/${marker}/cart-complement?` + this._queryParamsToString(query));
234
+ const data = await this._fetchGet(`/${this._pathSegment(marker)}/cart-complement?` +
235
+ this._queryParamsToString(query));
233
236
  return this._normalizeData(data);
234
237
  }
235
238
  /**
@@ -247,7 +250,7 @@ export default class BlocksApi extends AsyncModules {
247
250
  * @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartComplementByProductIds getCartComplementByProductIds} documentation.
248
251
  */
249
252
  async getCartComplementByProductIds(marker, body) {
250
- const data = await this._fetchPost(`/${marker}/cart-complement`, { langCode: this.state.lang, ...body });
253
+ const data = await this._fetchPost(`/${this._pathSegment(marker)}/cart-complement`, { langCode: this.state.lang, ...body });
251
254
  return this._normalizeData(data);
252
255
  }
253
256
  /**
@@ -264,7 +267,8 @@ export default class BlocksApi extends AsyncModules {
264
267
  */
265
268
  async getCartSimilar(marker, langCode = this.state.lang, signPrice, limit) {
266
269
  const query = { langCode, signPrice, limit };
267
- const data = await this._fetchGet(`/${marker}/cart-similar?` + this._queryParamsToString(query));
270
+ const data = await this._fetchGet(`/${this._pathSegment(marker)}/cart-similar?` +
271
+ this._queryParamsToString(query));
268
272
  return this._normalizeData(data);
269
273
  }
270
274
  /**
@@ -282,7 +286,7 @@ export default class BlocksApi extends AsyncModules {
282
286
  * @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartSimilarByProductIds getCartSimilarByProductIds} documentation.
283
287
  */
284
288
  async getCartSimilarByProductIds(marker, body) {
285
- const data = await this._fetchPost(`/${marker}/cart-similar`, { langCode: this.state.lang, ...body });
289
+ const data = await this._fetchPost(`/${this._pathSegment(marker)}/cart-similar`, { langCode: this.state.lang, ...body });
286
290
  return this._normalizeData(data);
287
291
  }
288
292
  /**
@@ -299,7 +303,8 @@ export default class BlocksApi extends AsyncModules {
299
303
  */
300
304
  async getPersonalRecommendations(marker, langCode = this.state.lang, signPrice, limit) {
301
305
  const query = { langCode, signPrice, limit };
302
- const data = await this._fetchGet(`/${marker}/personal-recommendations?` + this._queryParamsToString(query));
306
+ const data = await this._fetchGet(`/${this._pathSegment(marker)}/personal-recommendations?` +
307
+ this._queryParamsToString(query));
303
308
  return this._normalizeData(data);
304
309
  }
305
310
  /**
@@ -316,7 +321,8 @@ export default class BlocksApi extends AsyncModules {
316
321
  */
317
322
  async getRecentlyViewed(marker, langCode = this.state.lang, signPrice, limit) {
318
323
  const query = { langCode, signPrice, limit };
319
- const data = await this._fetchGet(`/${marker}/recently-viewed?` + this._queryParamsToString(query));
324
+ const data = await this._fetchGet(`/${this._pathSegment(marker)}/recently-viewed?` +
325
+ this._queryParamsToString(query));
320
326
  return this._normalizeData(data);
321
327
  }
322
328
  /**
@@ -333,7 +339,8 @@ export default class BlocksApi extends AsyncModules {
333
339
  */
334
340
  async getRepeatPurchase(marker, langCode = this.state.lang, signPrice, limit) {
335
341
  const query = { langCode, signPrice, limit };
336
- const data = await this._fetchGet(`/${marker}/repeat-purchase?` + this._queryParamsToString(query));
342
+ const data = await this._fetchGet(`/${this._pathSegment(marker)}/repeat-purchase?` +
343
+ this._queryParamsToString(query));
337
344
  return this._normalizeData(data);
338
345
  }
339
346
  /**
@@ -345,7 +352,7 @@ export default class BlocksApi extends AsyncModules {
345
352
  * @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getSlides getSlides} documentation.
346
353
  */
347
354
  async getSlides(marker) {
348
- const data = await this._fetchGet(`/${marker}/slides`);
355
+ const data = await this._fetchGet(`/${this._pathSegment(marker)}/slides`);
349
356
  return this._normalizeData(data);
350
357
  }
351
358
  /**
@@ -362,7 +369,8 @@ export default class BlocksApi extends AsyncModules {
362
369
  */
363
370
  async getTrending(marker, langCode = this.state.lang, signPrice, limit) {
364
371
  const query = { langCode, signPrice, limit };
365
- const data = await this._fetchGet(`/${marker}/trending?` + this._queryParamsToString(query));
372
+ const data = await this._fetchGet(`/${this._pathSegment(marker)}/trending?` +
373
+ this._queryParamsToString(query));
366
374
  return this._normalizeData(data);
367
375
  }
368
376
  /**
@@ -379,7 +387,8 @@ export default class BlocksApi extends AsyncModules {
379
387
  */
380
388
  async getWishlistSimilar(marker, langCode = this.state.lang, signPrice, limit) {
381
389
  const query = { langCode, signPrice, limit };
382
- const data = await this._fetchGet(`/${marker}/wishlist-similar?` + this._queryParamsToString(query));
390
+ const data = await this._fetchGet(`/${this._pathSegment(marker)}/wishlist-similar?` +
391
+ this._queryParamsToString(query));
383
392
  return this._normalizeData(data);
384
393
  }
385
394
  /**
@@ -397,7 +406,7 @@ export default class BlocksApi extends AsyncModules {
397
406
  * @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getWishlistSimilarByProductIds getWishlistSimilarByProductIds} documentation.
398
407
  */
399
408
  async getWishlistSimilarByProductIds(marker, body) {
400
- const data = await this._fetchPost(`/${marker}/wishlist-similar`, { langCode: this.state.lang, ...body });
409
+ const data = await this._fetchPost(`/${this._pathSegment(marker)}/wishlist-similar`, { langCode: this.state.lang, ...body });
401
410
  return this._normalizeData(data);
402
411
  }
403
412
  }
@@ -57,7 +57,8 @@ export default class DiscountsApi extends AsyncModules {
57
57
  marker: '',
58
58
  langCode,
59
59
  };
60
- const data = await this._fetchGet(`/marker/${marker}?` + this._queryParamsToString(query));
60
+ const data = await this._fetchGet(`/marker/${this._pathSegment(marker)}?` +
61
+ this._queryParamsToString(query));
61
62
  return this._normalizeData(data);
62
63
  }
63
64
  /**
@@ -57,7 +57,7 @@ export default class EventsApi extends AsyncModules {
57
57
  locale: langCode,
58
58
  productId,
59
59
  };
60
- return this._fetchBoolean(() => this._fetchPost(`/subscribe/marker/${marker}`, body));
60
+ return this._fetchBoolean(() => this._fetchPost(`/subscribe/marker/${this._pathSegment(marker)}`, body));
61
61
  }
62
62
  /**
63
63
  * Unsubscribing to an event on a product.
@@ -76,7 +76,7 @@ export default class EventsApi extends AsyncModules {
76
76
  productId: productId,
77
77
  locale: langCode,
78
78
  };
79
- return this._fetchBoolean(() => this._fetchDelete(`/unsubscribe/marker/${marker}`, body));
79
+ return this._fetchBoolean(() => this._fetchDelete(`/unsubscribe/marker/${this._pathSegment(marker)}`, body));
80
80
  }
81
81
  /**
82
82
  * Returns all available events.
@@ -102,7 +102,7 @@ export default class EventsApi extends AsyncModules {
102
102
  * @see {@link https://js-sdk.oneentry.cloud/docs/events/subscribeToForm subscribeToForm} documentation.
103
103
  */
104
104
  async subscribeToForm(marker, body) {
105
- return this._fetchBoolean(() => this._fetchPost(`/forms/subscribe/marker/${marker}`, body));
105
+ return this._fetchBoolean(() => this._fetchPost(`/forms/subscribe/marker/${this._pathSegment(marker)}`, body));
106
106
  }
107
107
  /**
108
108
  * Returns all form subscriptions.
@@ -135,6 +135,6 @@ export default class EventsApi extends AsyncModules {
135
135
  * @see {@link https://js-sdk.oneentry.cloud/docs/events/unsubscribeFromForm unsubscribeFromForm} documentation.
136
136
  */
137
137
  async unsubscribeFromForm(marker, body) {
138
- return this._fetchBoolean(() => this._fetchDelete(`/forms/unsubscribe/marker/${marker}`, body));
138
+ return this._fetchBoolean(() => this._fetchDelete(`/forms/unsubscribe/marker/${this._pathSegment(marker)}`, body));
139
139
  }
140
140
  }
@@ -29,7 +29,7 @@ export default class FiltersApi extends AsyncModules {
29
29
  * @see {@link https://js-sdk.oneentry.cloud/docs/filters/getFilterByMarker getFilterByMarker} documentation.
30
30
  */
31
31
  async getFilterByMarker(marker, langCode = this.state.lang) {
32
- const data = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
32
+ const data = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
33
33
  const validated = await this._validateResponse(data, schema('ContentFilterSchema'));
34
34
  return this._normalizeData(validated);
35
35
  }
@@ -46,7 +46,7 @@ export default class FormsApi extends AsyncModules {
46
46
  * @see {@link https://js-sdk.oneentry.cloud/docs/forms/getFormByMarker getFormByMarker} documentation.
47
47
  */
48
48
  async getFormByMarker(marker, langCode = this.state.lang) {
49
- const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
49
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
50
50
  // Validate response if validation is enabled
51
51
  const validated = await this._validateResponse(result, schema('FormEntitySchema'));
52
52
  return this._normalizeData(validated, langCode);
@@ -118,17 +118,19 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
118
118
  * @param {number} [body.parentId] - Identifier of the parent record, to fetch replies to one submission. Example: 10.
119
119
  * @param {string} [body.userIdentifier] - Text identifier of the sender. Example: "admin".
120
120
  * @param {FormDataStatus[]} [body.status] - Moderation statuses to keep: "sent", "moderation", "approved", "banned", "deleted". Must be an array; anything outside the set is rejected with `400 each value in status must be a valid enum value`. Example: ["approved"].
121
- * @param {string} [body.dateFrom] - Lower bound of the submission date, `YYYY-MM-DD`. An empty string means "no bound" — the SDK removes it from the body, because the endpoint answers `400 dateFrom must be a valid date in format "YYYY-MM-DD"` to one. An unparsable non-empty value still fails the request. Example: "2025-01-01".
122
- * @param {string} [body.dateTo] - Upper bound of the submission date, `YYYY-MM-DD`. An empty string means "no bound", handled like `dateFrom`. Example: "2025-12-31".
121
+ * @param {string} [body.dateFrom] - Lower bound of the submission date, `YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`. An empty string means "no bound" — the SDK removes it from the body, because the endpoint answers `400 dateFrom must be a valid date in format "YYYY-MM-DD"` to one. An unparsable non-empty value still fails the request. Example: "2025-01-01".
122
+ * @param {string} [body.dateTo] - Upper bound of the submission date, `YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`. An empty string means "no bound", handled like `dateFrom`. Example: "2025-12-31".
123
123
  * @param {number} [isExtended] - Pass `1` to return additional fields for each record. Default: `0`. Example: 1.
124
124
  * @param {string} [langCode] - Language code. Default: "en_US".
125
- * @param {number} [offset] - Number of records to skip. Default: 0.
126
- * @param {number} [limit] - Maximum number of records to return. Default: 30.
125
+ * @param {number} [offset] - Number of records to skip, `0` or more (a negative one answers `400 offset must not be less than 0`). Default: 0.
126
+ * @param {number} [limit] - Maximum number of records to return, `1` or more (`0` answers `400 limit must not be less than 1`). Default: 30.
127
127
  * @returns {Promise<IFormsByMarkerDataEntity | IError>} Returns an object containing the form data or an error object if there was an issue.
128
128
  * @throws {IError} When isShell=false and an error occurs during the fetch
129
129
  * @description Each record's `formData` comes back **already unwrapped from its locale**. The API sends `formData: { "en_US": [ … ] }`; the SDK normalizes the response and hands over the array for `langCode`, so read `record.formData` — `record.formData[langCode]` is `undefined` and yields an empty list with no error. This holds for both values of `isExtended`.
130
130
  *
131
- * The filter body is typed for a reason: the API silently ignores a field it does not know, so a misspelled `statuses` returns every record — unmoderated ones included — and the code looks like it works.
131
+ * The filter body is typed because the API refuses a field it does not know: a misspelled `statuses` answers `400 property statuses should not exist`.
132
+ *
133
+ * A marker or `formModuleConfigId` that matches nothing answers `200` with `{ items: [], total: 0 }`, not `404` — an empty list does not prove the form exists.
132
134
  *
133
135
  * Empty `dateFrom` / `dateTo` are stripped from the body before it is sent: the endpoint validates the pair as dates and rejects an empty string with a `400`, while every other field still treats "" as "no filter".
134
136
  * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByMarker getFormsDataByMarker} documentation.
@@ -164,11 +166,11 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
164
166
  * @handleName getFormsDataByVectorSearch
165
167
  * @param {IFormsDataVectorSearch} body - Vector search parameters. Example: `{ queryText: "order confirmation" }`.
166
168
  * @param {string} [langCode] - Language code. Default: "en_US".
167
- * @param {number} [offset] - Number of records to skip. Default: 0.
168
- * @param {number} [limit] - Maximum number of records to return. Default: 30.
169
+ * @param {number} [offset] - Number of records to skip, `0` or more. Default: 0.
170
+ * @param {number} [limit] - Maximum number of records to return, `1` or more. Default: 30.
169
171
  * @returns {Promise<IVectorSearchResponse<IFormsDataSearchResponse> | IError>} Returns an object with an array of found form data records and total count.
170
172
  * @throws {IError} When isShell=false and an error occurs during the fetch
171
- * @description This method performs a semantic (vector) search for form data.
173
+ * @description This method performs a semantic (vector) search for form data. The body is checked by the API: an empty `queryText` or one longer than 512 characters, a negative `vectorDistanceThreshold` and a `maxHits` below `1` each answer `400`.
172
174
  * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByVectorSearch getFormsDataByVectorSearch} documentation.
173
175
  */
174
176
  getFormsDataByVectorSearch(body: IFormsDataVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IFormsDataSearchResponse> | IError>;
@@ -133,7 +133,9 @@ export default class FormsDataApi extends AsyncModules {
133
133
  const result = await this._fetchPost(``, { ...body, formData });
134
134
  // Validate response if validation is enabled
135
135
  const validated = await this._validateResponse(result, schema('PostFormResponseSchema'));
136
- return this._normalizeData(validated);
136
+ // The fields went in under `langCode`, so the response is unwrapped from the same
137
+ // locale; without it a call in another language returned `formData` still keyed by it
138
+ return this._normalizeData(validated, langCode);
137
139
  }
138
140
  /**
139
141
  * Tells a file the SDK still has to upload from one already in storage.
@@ -214,23 +216,25 @@ export default class FormsDataApi extends AsyncModules {
214
216
  * @param {number} [body.parentId] - Identifier of the parent record, to fetch replies to one submission. Example: 10.
215
217
  * @param {string} [body.userIdentifier] - Text identifier of the sender. Example: "admin".
216
218
  * @param {FormDataStatus[]} [body.status] - Moderation statuses to keep: "sent", "moderation", "approved", "banned", "deleted". Must be an array; anything outside the set is rejected with `400 each value in status must be a valid enum value`. Example: ["approved"].
217
- * @param {string} [body.dateFrom] - Lower bound of the submission date, `YYYY-MM-DD`. An empty string means "no bound" — the SDK removes it from the body, because the endpoint answers `400 dateFrom must be a valid date in format "YYYY-MM-DD"` to one. An unparsable non-empty value still fails the request. Example: "2025-01-01".
218
- * @param {string} [body.dateTo] - Upper bound of the submission date, `YYYY-MM-DD`. An empty string means "no bound", handled like `dateFrom`. Example: "2025-12-31".
219
+ * @param {string} [body.dateFrom] - Lower bound of the submission date, `YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`. An empty string means "no bound" — the SDK removes it from the body, because the endpoint answers `400 dateFrom must be a valid date in format "YYYY-MM-DD"` to one. An unparsable non-empty value still fails the request. Example: "2025-01-01".
220
+ * @param {string} [body.dateTo] - Upper bound of the submission date, `YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`. An empty string means "no bound", handled like `dateFrom`. Example: "2025-12-31".
219
221
  * @param {number} [isExtended] - Pass `1` to return additional fields for each record. Default: `0`. Example: 1.
220
222
  * @param {string} [langCode] - Language code. Default: "en_US".
221
- * @param {number} [offset] - Number of records to skip. Default: 0.
222
- * @param {number} [limit] - Maximum number of records to return. Default: 30.
223
+ * @param {number} [offset] - Number of records to skip, `0` or more (a negative one answers `400 offset must not be less than 0`). Default: 0.
224
+ * @param {number} [limit] - Maximum number of records to return, `1` or more (`0` answers `400 limit must not be less than 1`). Default: 30.
223
225
  * @returns {Promise<IFormsByMarkerDataEntity | IError>} Returns an object containing the form data or an error object if there was an issue.
224
226
  * @throws {IError} When isShell=false and an error occurs during the fetch
225
227
  * @description Each record's `formData` comes back **already unwrapped from its locale**. The API sends `formData: { "en_US": [ … ] }`; the SDK normalizes the response and hands over the array for `langCode`, so read `record.formData` — `record.formData[langCode]` is `undefined` and yields an empty list with no error. This holds for both values of `isExtended`.
226
228
  *
227
- * The filter body is typed for a reason: the API silently ignores a field it does not know, so a misspelled `statuses` returns every record — unmoderated ones included — and the code looks like it works.
229
+ * The filter body is typed because the API refuses a field it does not know: a misspelled `statuses` answers `400 property statuses should not exist`.
230
+ *
231
+ * A marker or `formModuleConfigId` that matches nothing answers `200` with `{ items: [], total: 0 }`, not `404` — an empty list does not prove the form exists.
228
232
  *
229
233
  * Empty `dateFrom` / `dateTo` are stripped from the body before it is sent: the endpoint validates the pair as dates and rejects an empty string with a `400`, while every other field still treats "" as "no filter".
230
234
  * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByMarker getFormsDataByMarker} documentation.
231
235
  */
232
236
  async getFormsDataByMarker(marker, formModuleConfigId, body = {}, isExtended = 0, langCode = this.state.lang, offset = 0, limit = 30) {
233
- const result = await this._fetchPost(`/marker/${marker}?formModuleConfigId=${formModuleConfigId}&isExtended=${isExtended}&langCode=${langCode}&offset=${offset}&limit=${limit}`, this._stripEmptyDates(body));
237
+ const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}?formModuleConfigId=${formModuleConfigId}&isExtended=${isExtended}&langCode=${langCode}&offset=${offset}&limit=${limit}`, this._stripEmptyDates(body));
234
238
  // Validate response if validation is enabled
235
239
  const validated = await this._validateResponse(result, schema('FormsByMarkerDataResponseSchema'));
236
240
  return this._normalizeData(validated, langCode);
@@ -276,11 +280,11 @@ export default class FormsDataApi extends AsyncModules {
276
280
  * @handleName getFormsDataByVectorSearch
277
281
  * @param {IFormsDataVectorSearch} body - Vector search parameters. Example: `{ queryText: "order confirmation" }`.
278
282
  * @param {string} [langCode] - Language code. Default: "en_US".
279
- * @param {number} [offset] - Number of records to skip. Default: 0.
280
- * @param {number} [limit] - Maximum number of records to return. Default: 30.
283
+ * @param {number} [offset] - Number of records to skip, `0` or more. Default: 0.
284
+ * @param {number} [limit] - Maximum number of records to return, `1` or more. Default: 30.
281
285
  * @returns {Promise<IVectorSearchResponse<IFormsDataSearchResponse> | IError>} Returns an object with an array of found form data records and total count.
282
286
  * @throws {IError} When isShell=false and an error occurs during the fetch
283
- * @description This method performs a semantic (vector) search for form data.
287
+ * @description This method performs a semantic (vector) search for form data. The body is checked by the API: an empty `queryText` or one longer than 512 characters, a negative `vectorDistanceThreshold` and a `maxHits` below `1` each answer `400`.
284
288
  * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByVectorSearch getFormsDataByVectorSearch} documentation.
285
289
  */
286
290
  async getFormsDataByVectorSearch(body, langCode = this.state.lang, offset = 0, limit = 30) {
@@ -85,9 +85,9 @@ interface IFormsData {
85
85
  /**
86
86
  * Body for semantic (vector) form data search.
87
87
  * @interface IFormsDataVectorSearch
88
- * @property {string} queryText - Natural-language search query. Example: "order confirmation".
89
- * @property {number} [vectorDistanceThreshold] - Override of the cosine distance threshold (0..2). Example: 0.3.
90
- * @property {number} [maxHits] - Number of top candidates fetched before pagination. Default: 100. Maximum: 500. Example: 10.
88
+ * @property {string} queryText - Natural-language search query, 1 to 512 characters: an empty one answers `400 queryText should not be empty`, a longer one `400 queryText must be shorter than or equal to 512 characters`. Example: "order confirmation".
89
+ * @property {number} [vectorDistanceThreshold] - Override of the cosine distance threshold (0..2); a negative value answers `400`. Example: 0.3.
90
+ * @property {number} [maxHits] - Number of top candidates fetched before pagination, from 1. Default: 100. Maximum: 500. Example: 10.
91
91
  * @property {boolean} [debug] - When `true`, each returned item gets a `distance` field. Example: false.
92
92
  * @description Body for the form-data vector/search endpoint.
93
93
  */
@@ -113,14 +113,14 @@ type FormDataStatus = 'sent' | 'moderation' | 'approved' | 'banned' | 'deleted';
113
113
  * @property {number} [parentId] - Identifier of the parent record — the way to fetch replies to one comment. Example: 10.
114
114
  * @property {string} [userIdentifier] - Text identifier of the sender; an empty string means "no filter". Example: "admin".
115
115
  * @property {FormDataStatus[]} [status] - Moderation statuses to keep. Must be an array — a bare string is rejected with `400`. An empty array means "no filter". Example: ["approved"].
116
- * @property {string} [dateFrom] - Lower bound of the submission date, `YYYY-MM-DD`; an empty string means "no bound" — `getFormsDataByMarker` strips it from the body, since the endpoint rejects an empty date with a `400`. A non-empty value the API cannot parse still fails the request. Example: "2025-01-01".
117
- * @property {string} [dateTo] - Upper bound of the submission date, `YYYY-MM-DD`; an empty string means "no bound", handled like `dateFrom`. Example: "2025-12-31".
116
+ * @property {string} [dateFrom] - Lower bound of the submission date, `YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`; an empty string means "no bound" — `getFormsDataByMarker` strips it from the body, since the endpoint rejects an empty date with a `400`. A non-empty value the API cannot parse still fails the request. Example: "2025-01-01".
117
+ * @property {string} [dateTo] - Upper bound of the submission date, `YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`; an empty string means "no bound", handled like `dateFrom`. Example: "2025-12-31".
118
118
  * @description Filter for reading form submissions. Every field is optional and an omitted one is simply not applied.
119
119
  *
120
- * Typed rather than left as `object` on purpose: the API **ignores** a field it
121
- * does not know, so `statuses: ['approved']` (note the "s") is not an error —
122
- * it returns every record, unmoderated ones included. That is premoderation
123
- * leaking onto a public page, from one typo the compiler used to accept.
120
+ * Typed rather than left as `object` on purpose: the API **refuses** a field it
121
+ * does not know, so `statuses: ['approved']` (note the "s") answers
122
+ * `400 property statuses should not exist` — the compiler catches the typo
123
+ * before the request does.
124
124
  */
125
125
  interface IFormsDataFilter {
126
126
  /**
@@ -419,7 +419,7 @@ interface IUpdateFormsData {
419
419
  /**
420
420
  * Contains an array of data form objects with the following values
421
421
  */
422
- type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | Record<string, unknown>;
422
+ type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | IBodyTypeEntity | IBodyTypeTimeInterval | Record<string, unknown>;
423
423
  /**
424
424
  * Value shapes accepted by a SUBMISSION (`POST /form-data`).
425
425
  *
@@ -588,13 +588,13 @@ interface IBodyPostFormData {
588
588
  * Represents a form data entity with a simple value.
589
589
  * @interface IBodyTypeStringNumberFloat
590
590
  * @property {string} marker - marker name. Example: "some_marker".
591
- * @property {string} type - Type value. "string" | "number" | "float". Example: "string".
592
- * @property {string | number | null} value - Value of the form data entity. Send it as a string; in responses numeric fields come back normalized to `number`, or `null` when the field is empty. Example: "string".
591
+ * @property {string} type - Type value. "string" | "integer" | "number" | "float". Example: "string".
592
+ * @property {string | number | null} value - Value of the form data entity. A submission may send a number or a string; responses return numeric fields **as strings** — `3` comes back as `"3"`, `2.565` as `"2.565"` — or `null` when the field is empty. Convert with `Number(value)` before arithmetic. Example: "string".
593
593
  * @description Represents a form data entity with a marker, type, and value.
594
594
  */
595
595
  interface IBodyTypeStringNumberFloat {
596
596
  marker: string;
597
- type: 'string' | 'number' | 'float';
597
+ type: 'string' | 'integer' | 'number' | 'float';
598
598
  value: string | number | null;
599
599
  }
600
600
  /**
@@ -633,43 +633,46 @@ interface ITimeDateValue {
633
633
  * @interface IBodyTypeText
634
634
  * @property {string} marker - marker name. Example: "some_marker".
635
635
  * @property {string} type - Type value. Example: "text".
636
- * @property {object} value - Text Object. Contains html as string, plain text and params.
636
+ * @property {ITextValue | ITextValue[]} value - Text value. A read returns a one-element **array**, without `plainValue` and with `params.editorMode`; older records may hold a single object.
637
637
  * @example
638
- {
639
- "htmlValue": "<p>Hello world</p>",
640
- "plainValue": "",
641
- "params": {
642
- "isEditorDisabled": false,
643
- "isImageCompressed": true
638
+ [
639
+ {
640
+ "htmlValue": "<p>Hello world</p>",
641
+ "params": {
642
+ "isImageCompressed": true,
643
+ "editorMode": "html"
644
+ }
644
645
  }
645
- }
646
- * @description Represents a text value with HTML and plain text representations, along with parameters for editor and image compression settings.
646
+ ]
647
+ * @description Represents a text value with HTML and plain text representations, along with parameters for editor and image compression settings. To submit a text field use {@link IBodyPostTypeText}.
647
648
  */
648
649
  interface IBodyTypeText {
649
650
  marker: string;
650
651
  type: 'text';
651
- value: ITextValue;
652
+ value: ITextValue | ITextValue[];
652
653
  }
653
654
  /**
654
655
  * @interface ITextEditorParams
655
- * @property {boolean} isEditorDisabled - Whether the rich-text editor is disabled. Example: false.
656
+ * @property {boolean} [isEditorDisabled] - Whether the rich-text editor is disabled. Older records only; current reads carry `editorMode` instead. Example: false.
656
657
  * @property {boolean} isImageCompressed - Whether embedded images are compressed. Example: true.
658
+ * @property {string} [editorMode] - Editor the value was written in. Example: "html".
657
659
  * @description Editor parameters attached to text-type form values.
658
660
  */
659
661
  interface ITextEditorParams {
660
- isEditorDisabled: boolean;
662
+ isEditorDisabled?: boolean;
661
663
  isImageCompressed: boolean;
664
+ editorMode?: string;
662
665
  }
663
666
  /**
664
667
  * @interface ITextValue
665
668
  * @property {string} htmlValue - HTML representation of the text. Example: "<p>Hello world</p>".
666
- * @property {string} plainValue - Plain-text representation.
669
+ * @property {string} [plainValue] - Plain-text representation. Absent from current reads. Example: "Hello world".
667
670
  * @property {ITextEditorParams} params - Editor configuration applied to this value.
668
671
  * @description Value payload for `text` form fields.
669
672
  */
670
673
  interface ITextValue {
671
674
  htmlValue: string;
672
- plainValue: string;
675
+ plainValue?: string;
673
676
  params: ITextEditorParams;
674
677
  }
675
678
  /**
@@ -677,36 +680,37 @@ interface ITextValue {
677
680
  * @interface IBodyTypeTextWithHeader
678
681
  * @property {string} marker - marker name. Example: "about".
679
682
  * @property {string} type - Type value. Example: "textWithHeader".
680
- * @property {object} value - Text Object. Contains html as string, header and params.
683
+ * @property {ITextWithHeaderValue | ITextWithHeaderValue[]} value - Text with a header. A read returns a one-element **array**, without `plainValue` and with `params.editorMode`; older records may hold a single object.
681
684
  * @example
682
- {
683
- "header": "Headline",
684
- "htmlValue": "<p>Hello World</p>",
685
- "plainValue": "",
686
- "params": {
687
- "isEditorDisabled": false,
688
- "isImageCompressed": true
685
+ [
686
+ {
687
+ "header": "Headline",
688
+ "htmlValue": "<p>Hello World</p>",
689
+ "params": {
690
+ "isImageCompressed": true,
691
+ "editorMode": "html"
692
+ }
689
693
  }
690
- }
694
+ ]
691
695
  * @description Represents a text value with a header, HTML and plain text representations, along with parameters for editor and image compression settings.
692
696
  */
693
697
  interface IBodyTypeTextWithHeader {
694
698
  marker: string;
695
699
  type: 'textWithHeader';
696
- value: ITextWithHeaderValue;
700
+ value: ITextWithHeaderValue | ITextWithHeaderValue[];
697
701
  }
698
702
  /**
699
703
  * @interface ITextWithHeaderValue
700
704
  * @property {string} header - Headline text. Example: "Headline".
701
705
  * @property {string} htmlValue - HTML body. Example: "<p>Hello world</p>".
702
- * @property {string} plainValue - Plain-text body.
706
+ * @property {string} [plainValue] - Plain-text body. Absent from current reads. Example: "Hello world".
703
707
  * @property {ITextEditorParams} params - Editor configuration applied to this value.
704
708
  * @description Value payload for `textWithHeader` form fields.
705
709
  */
706
710
  interface ITextWithHeaderValue {
707
711
  header: string;
708
712
  htmlValue: string;
709
- plainValue: string;
713
+ plainValue?: string;
710
714
  params: ITextEditorParams;
711
715
  }
712
716
  /**
@@ -765,7 +769,7 @@ interface IImageValue {
765
769
  * @interface IBodyTypeFile
766
770
  * @property {string} marker - marker name. Example: "picture".
767
771
  * @property {'file'} type - Type value. Example: "file".
768
- * @property {object} value - The attached file. Three shapes are accepted and may be mixed in one array: a `File`/`Blob` (also a `FileList`), which the SDK uploads first; the descriptor `FileUploading.upload` returns for a file **already in storage**, which is passed through as it is; or a hand-built {@link IFileValue}. In a SUBMISSION the value must be an **array** — a lone descriptor or {@link IFileValue} answers `400 formData's marker '<marker>' value must be an array`, while a lone `File`/`Blob` is fine because the SDK wraps the upload result. A READ returns a single attached file as the object itself.
772
+ * @property {object} value - The attached file. Three shapes are accepted and may be mixed in one array: a `File`/`Blob` (also a `FileList`), which the SDK uploads first; the descriptor `FileUploading.upload` returns for a file **already in storage**, which is passed through as it is; or a hand-built {@link IFileValue}. In a SUBMISSION the value must be an **array** — a lone descriptor or {@link IFileValue} answers `400 formData's marker '<marker>' value must be an array`, while a lone `File`/`Blob` is fine because the SDK wraps the upload result. A READ returns the files as an array too — a single attached file is a one-element array.
769
773
  * @example
770
774
  [
771
775
  {
@@ -800,24 +804,41 @@ interface IFileValue {
800
804
  * @interface IBodyTypeRadioButtonList
801
805
  * @property {string} marker - marker name. Example: "selector".
802
806
  * @property {string} type - Type value. Example: 'list'.
803
- * @property {Array} value - Array of list or radioButton bojects.
807
+ * @property {IListOptionValue[] | string[] | string} value - Chosen option(s). A read of a submission returns the option **values as stored**: `list` — an array of strings (`["1"]`), `radioButton` — one string (`"1"`). The `[{ title, value, extended }]` form is the shape of a page attribute.
804
808
  * @example
805
- [
806
- {
807
- "title": "red",
808
- "value": "1",
809
- "extended": {
810
- "value": "red",
811
- "type": "string"
812
- }
813
- }
814
- ]
815
- * @description Represents a list or radio button selection with multiple options, each containing a title, value, and extended information.
809
+ ["1"]
810
+ * @description Represents a list or radio button selection. Look the titles up in the form's attribute (`Forms.getFormByMarker`) by the stored value.
816
811
  */
817
812
  interface IBodyTypeRadioButtonList {
818
813
  marker: string;
819
814
  type: 'list' | 'radioButton';
820
- value: IListOptionValue[];
815
+ value: IListOptionValue[] | string[] | string;
816
+ }
817
+ /**
818
+ * Represents an `entity` form data field — links to other entities.
819
+ * @interface IBodyTypeEntity
820
+ * @property {string} marker - marker name. Example: "related".
821
+ * @property {'entity'} type - Type value. Example: "entity".
822
+ * @property {number[]} value - Identifiers of the linked entities. Example: [2954, 2957].
823
+ * @description A form field that stores links to other entities (for example products) by id.
824
+ */
825
+ interface IBodyTypeEntity {
826
+ marker: string;
827
+ type: 'entity';
828
+ value: number[];
829
+ }
830
+ /**
831
+ * Represents a `timeInterval` form data field.
832
+ * @interface IBodyTypeTimeInterval
833
+ * @property {string} marker - marker name. Example: "booking".
834
+ * @property {'timeInterval'} type - Type value. Example: "timeInterval".
835
+ * @property {string[][]} value - Intervals as `[start, end]` pairs of ISO dates. Example: [["2025-02-11T16:00:00.000Z", "2025-02-13T16:00:00.000Z"]].
836
+ * @description A form field that stores one or more time intervals.
837
+ */
838
+ interface IBodyTypeTimeInterval {
839
+ marker: string;
840
+ type: 'timeInterval';
841
+ value: string[][];
821
842
  }
822
843
  /**
823
844
  * @interface IListOptionExtended
@@ -841,4 +862,4 @@ interface IListOptionValue {
841
862
  value: string;
842
863
  extended: IListOptionExtended;
843
864
  }
844
- export type { FormDataPostType, FormDataStatus, FormDataType, IBodyPostFormData, IBodyPostTypeList, IBodyPostTypeSpam, IBodyPostTypeText, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, ICaptchaEvent, ICaptchaValue, IFileValue, IFormByMarkerDataEntity, IFormDataEntity, IFormDataSearchEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IFormsDataFilter, IFormsDataSearchResponse, IFormsDataVectorSearch, IImageValue, IImageValueParams, IListOptionExtended, IListOptionValue, IPostFormResponse, IPostFormResponseData, ITextEditorParams, ITextSubmissionValue, ITextValue, ITextWithHeaderValue, ITimeDateValue, IUpdateFormsData, };
865
+ export type { FormDataPostType, FormDataStatus, FormDataType, IBodyPostFormData, IBodyPostTypeList, IBodyPostTypeSpam, IBodyPostTypeText, IBodyTypeEntity, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IBodyTypeTimeInterval, ICaptchaEvent, ICaptchaValue, IFileValue, IFormByMarkerDataEntity, IFormDataEntity, IFormDataSearchEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IFormsDataFilter, IFormsDataSearchResponse, IFormsDataVectorSearch, IImageValue, IImageValueParams, IListOptionExtended, IListOptionValue, IPostFormResponse, IPostFormResponseData, ITextEditorParams, ITextSubmissionValue, ITextValue, ITextWithHeaderValue, ITimeDateValue, IUpdateFormsData, };
@@ -108,7 +108,7 @@ export default class IntegrationCollectionsApi extends AsyncModules {
108
108
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/validateICollectionMarker validateICollectionMarker} documentation.
109
109
  */
110
110
  async validateICollectionMarker(marker) {
111
- const result = await this._fetchGet(`/marker-validation/${marker}`);
111
+ const result = await this._fetchGet(`/marker-validation/${this._pathSegment(marker)}`);
112
112
  // Validate response if validation is enabled
113
113
  const validated = await this._validateResponse(result, schema('CollectionIsValidSchema'));
114
114
  return this._normalizeData(validated);
@@ -123,7 +123,7 @@ export default class IntegrationCollectionsApi extends AsyncModules {
123
123
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsByMarker getICollectionRowsByMarker} documentation.
124
124
  */
125
125
  async getICollectionRowsByMarker(marker, langCode = this.state.lang) {
126
- const result = await this._fetchGet(`/marker/${marker}/rows?langCode=${langCode}`);
126
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/rows?langCode=${langCode}`);
127
127
  // Validate response if validation is enabled
128
128
  const validated = await this._validateResponse(result, schema('CollectionRowsResponseSchema'));
129
129
  return this._normalizeData(validated, langCode);
@@ -139,7 +139,7 @@ export default class IntegrationCollectionsApi extends AsyncModules {
139
139
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowByMarkerAndId getICollectionRowByMarkerAndId} documentation.
140
140
  */
141
141
  async getICollectionRowByMarkerAndId(marker, id, langCode = this.state.lang) {
142
- const result = await this._fetchGet(`/marker/${marker}/rows/${id}?langCode=${langCode}`);
142
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/rows/${id}?langCode=${langCode}`);
143
143
  // Validate response if validation is enabled
144
144
  const validated = await this._validateResponse(result, schema('CollectionRowSchema'));
145
145
  return this._normalizeData(validated, langCode);
@@ -167,7 +167,7 @@ export default class IntegrationCollectionsApi extends AsyncModules {
167
167
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/createICollectionRow createICollectionRow} documentation.
168
168
  */
169
169
  async createICollectionRow(marker, body, langCode = this.state.lang) {
170
- const response = await this._fetchPost(`/marker/${marker}/rows?langCode=${langCode}`, body);
170
+ const response = await this._fetchPost(`/marker/${this._pathSegment(marker)}/rows?langCode=${langCode}`, body);
171
171
  // Validate response if validation is enabled
172
172
  const validated = await this._validateResponse(response, schema('CollectionRowSchema'));
173
173
  return this._normalizeData(validated, langCode);
@@ -198,7 +198,8 @@ export default class IntegrationCollectionsApi extends AsyncModules {
198
198
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/updateICollectionRow updateICollectionRow} documentation.
199
199
  */
200
200
  async updateICollectionRow(marker, id, body, langCode = this.state.lang) {
201
- const response = await this._fetchPut(`/marker/${marker}/rows/${id}?` + `langCode=${langCode}`, body);
201
+ const response = await this._fetchPut(`/marker/${this._pathSegment(marker)}/rows/${id}?` +
202
+ `langCode=${langCode}`, body);
202
203
  // Validate response if validation is enabled
203
204
  const validated = await this._validateResponse(response, schema('CollectionRowSchema'));
204
205
  return this._normalizeData(validated, langCode);
@@ -214,7 +215,7 @@ export default class IntegrationCollectionsApi extends AsyncModules {
214
215
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/deleteICollectionRowByMarkerAndId deleteICollectionRowByMarkerAndId} documentation.
215
216
  */
216
217
  async deleteICollectionRowByMarkerAndId(marker, id) {
217
- const result = await this._fetchDelete(`/marker/${marker}/rows/${id}`);
218
+ const result = await this._fetchDelete(`/marker/${this._pathSegment(marker)}/rows/${id}`);
218
219
  return result;
219
220
  }
220
221
  }
@@ -27,7 +27,7 @@ export default class MenusApi extends AsyncModules {
27
27
  * @see {@link https://js-sdk.oneentry.cloud/docs/menus/getMenusByMarker getMenusByMarker} documentation.
28
28
  */
29
29
  async getMenusByMarker(marker, langCode = this.state.lang) {
30
- const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
30
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
31
31
  // Validate response if validation is enabled
32
32
  const validated = await this._validateResponse(result, schema('MenuEntitySchema'));
33
33
  return this._normalizeData(validated, langCode);