oneentry 1.0.137 → 1.0.138

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 (70) hide show
  1. package/dist/admins/adminsApi.d.ts +2 -2
  2. package/dist/admins/adminsApi.js +2 -2
  3. package/dist/admins/adminsInterfaces.d.ts +1 -1
  4. package/dist/attribute-sets/attributeSetsApi.d.ts +8 -8
  5. package/dist/attribute-sets/attributeSetsApi.js +8 -8
  6. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +3 -3
  7. package/dist/auth-provider/authProviderApi.d.ts +33 -33
  8. package/dist/auth-provider/authProviderApi.js +33 -33
  9. package/dist/auth-provider/authProvidersInterfaces.d.ts +12 -62
  10. package/dist/base/asyncModules.js +4 -50
  11. package/dist/base/stateModule.d.ts +1 -0
  12. package/dist/base/stateModule.js +16 -15
  13. package/dist/base/syncModules.d.ts +6 -0
  14. package/dist/base/syncModules.js +48 -5
  15. package/dist/base/utils.d.ts +15 -8
  16. package/dist/blocks/blocksApi.d.ts +10 -10
  17. package/dist/blocks/blocksApi.js +10 -10
  18. package/dist/blocks/blocksInterfaces.d.ts +1 -0
  19. package/dist/events/eventsApi.d.ts +5 -5
  20. package/dist/events/eventsApi.js +5 -5
  21. package/dist/events/eventsInterfaces.d.ts +25 -15
  22. package/dist/file-uploading/fileUploadingApi.d.ts +6 -6
  23. package/dist/file-uploading/fileUploadingApi.js +6 -6
  24. package/dist/forms/formsApi.d.ts +4 -4
  25. package/dist/forms/formsApi.js +4 -4
  26. package/dist/forms/formsInterfaces.d.ts +1 -0
  27. package/dist/forms-data/formsDataApi.d.ts +10 -10
  28. package/dist/forms-data/formsDataApi.js +10 -10
  29. package/dist/forms-data/formsDataInterfaces.d.ts +24 -24
  30. package/dist/forms-data/formsDataSchemas.d.ts +36 -28
  31. package/dist/forms-data/formsDataSchemas.js +16 -13
  32. package/dist/general-types/generalTypesApi.d.ts +2 -2
  33. package/dist/general-types/generalTypesApi.js +2 -2
  34. package/dist/index.d.ts +23 -1
  35. package/dist/integration-collections/integrationCollectionsApi.d.ts +17 -17
  36. package/dist/integration-collections/integrationCollectionsApi.js +17 -17
  37. package/dist/locales/localesApi.d.ts +2 -2
  38. package/dist/locales/localesApi.js +2 -2
  39. package/dist/menus/menusApi.d.ts +2 -2
  40. package/dist/menus/menusApi.js +2 -2
  41. package/dist/menus/menusInterfaces.d.ts +2 -2
  42. package/dist/orders/ordersApi.d.ts +12 -12
  43. package/dist/orders/ordersApi.js +12 -12
  44. package/dist/orders/ordersInterfaces.d.ts +2 -1
  45. package/dist/pages/pagesApi.d.ts +20 -20
  46. package/dist/pages/pagesApi.js +20 -20
  47. package/dist/pages/pagesInterfaces.d.ts +10 -7
  48. package/dist/payments/paymentsApi.d.ts +13 -13
  49. package/dist/payments/paymentsApi.js +12 -12
  50. package/dist/payments/paymentsInterfaces.d.ts +8 -2
  51. package/dist/payments/paymentsSchemas.d.ts +22 -6
  52. package/dist/payments/paymentsSchemas.js +6 -3
  53. package/dist/product-statuses/productStatusesApi.d.ts +6 -6
  54. package/dist/product-statuses/productStatusesApi.js +6 -6
  55. package/dist/products/productsApi.d.ts +29 -28
  56. package/dist/products/productsApi.js +31 -30
  57. package/dist/products/productsInterfaces.d.ts +26 -21
  58. package/dist/system/systemApi.d.ts +10 -10
  59. package/dist/system/systemApi.js +10 -10
  60. package/dist/templates/templatesApi.d.ts +6 -6
  61. package/dist/templates/templatesApi.js +6 -6
  62. package/dist/templates-preview/templatesPreviewApi.d.ts +3 -3
  63. package/dist/templates-preview/templatesPreviewApi.js +3 -3
  64. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +1 -0
  65. package/dist/users/usersApi.d.ts +18 -18
  66. package/dist/users/usersApi.js +18 -18
  67. package/dist/users/usersInterfaces.d.ts +8 -10
  68. package/package.json +34 -11
  69. package/dist/config.d.ts +0 -21
  70. package/dist/config.js +0 -48
@@ -411,56 +411,10 @@ class AsyncModules extends syncModules_1.default {
411
411
  // Store the response status and parse the response body as JSON
412
412
  const status = response.status;
413
413
  const res = await response.json();
414
- // Handle different HTTP status codes with corresponding error functions
415
- // Using strict equality (===) for type safety
416
- if (status === 400) {
417
- if (this.state.errorsFunctions && this.state.errorsFunctions['400']) {
418
- this.state.errorsFunctions['400'](res);
419
- }
420
- }
421
- else if (status === 401) {
422
- if (this.state.errorsFunctions && this.state.errorsFunctions['401']) {
423
- this.state.errorsFunctions['401'](res);
424
- }
425
- }
426
- else if (status === 403) {
427
- if (this.state.errorsFunctions && this.state.errorsFunctions['403']) {
428
- this.state.errorsFunctions['403'](res);
429
- }
430
- }
431
- else if (status === 404) {
432
- if (this.state.errorsFunctions && this.state.errorsFunctions['404']) {
433
- this.state.errorsFunctions['404'](res);
434
- }
435
- }
436
- else if (status === 429) {
437
- // Handle rate limiting
438
- if (this.state.errorsFunctions && this.state.errorsFunctions['429']) {
439
- this.state.errorsFunctions['429'](res);
440
- }
441
- }
442
- else if (status === 500) {
443
- if (this.state.errorsFunctions && this.state.errorsFunctions['500']) {
444
- this.state.errorsFunctions['500'](res);
445
- }
446
- }
447
- else if (status === 502) {
448
- // Handle bad gateway
449
- if (this.state.errorsFunctions && this.state.errorsFunctions['502']) {
450
- this.state.errorsFunctions['502'](res);
451
- }
452
- }
453
- else if (status === 503) {
454
- // Handle service unavailable
455
- if (this.state.errorsFunctions && this.state.errorsFunctions['503']) {
456
- this.state.errorsFunctions['503'](res);
457
- }
458
- }
459
- else if (status === 504) {
460
- // Handle gateway timeout
461
- if (this.state.errorsFunctions && this.state.errorsFunctions['504']) {
462
- this.state.errorsFunctions['504'](res);
463
- }
414
+ const statusKey = status;
415
+ if (this.state.errorsFunctions &&
416
+ this.state.errorsFunctions[statusKey]) {
417
+ this.state.errorsFunctions[statusKey](res);
464
418
  }
465
419
  // Determine whether to return or throw the response based on 'isShell' state
466
420
  if (this.state.isShell) {
@@ -18,6 +18,7 @@ export default class StateModule {
18
18
  validationEnabled: boolean;
19
19
  validationStrictMode: boolean;
20
20
  validationLogErrors: boolean;
21
+ rawData: boolean;
21
22
  errorsFunctions: {
22
23
  400?: (data: IError) => any | null;
23
24
  401?: (data: IError) => any | null;
@@ -45,7 +45,7 @@ class StateModule {
45
45
  * @description Constructor for StateModule.
46
46
  */
47
47
  constructor(url, config) {
48
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
48
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
49
49
  this.url = url;
50
50
  this.lang = (_a = config.langCode) !== null && _a !== void 0 ? _a : 'en_US';
51
51
  this.token = config.token;
@@ -53,9 +53,10 @@ class StateModule {
53
53
  this.validationEnabled = (_c = (_b = config.validation) === null || _b === void 0 ? void 0 : _b.enabled) !== null && _c !== void 0 ? _c : false;
54
54
  this.validationStrictMode = (_e = (_d = config.validation) === null || _d === void 0 ? void 0 : _d.strictMode) !== null && _e !== void 0 ? _e : false;
55
55
  this.validationLogErrors = (_g = (_f = config.validation) === null || _f === void 0 ? void 0 : _f.logErrors) !== null && _g !== void 0 ? _g : true;
56
- this.refreshToken = (_j = (_h = config.auth) === null || _h === void 0 ? void 0 : _h.refreshToken) !== null && _j !== void 0 ? _j : undefined;
57
- this.providerMarker = (_l = (_k = config.auth) === null || _k === void 0 ? void 0 : _k.providerMarker) !== null && _l !== void 0 ? _l : 'email';
58
- this.customAuth = (_o = (_m = config.auth) === null || _m === void 0 ? void 0 : _m.customAuth) !== null && _o !== void 0 ? _o : false;
56
+ this.rawData = (_h = config.rawData) !== null && _h !== void 0 ? _h : false;
57
+ this.refreshToken = (_k = (_j = config.auth) === null || _j === void 0 ? void 0 : _j.refreshToken) !== null && _k !== void 0 ? _k : undefined;
58
+ this.providerMarker = (_m = (_l = config.auth) === null || _l === void 0 ? void 0 : _l.providerMarker) !== null && _m !== void 0 ? _m : 'email';
59
+ this.customAuth = (_p = (_o = config.auth) === null || _o === void 0 ? void 0 : _o.customAuth) !== null && _p !== void 0 ? _p : false;
59
60
  this.errorsFunctions = {
60
61
  '400': undefined,
61
62
  '401': undefined,
@@ -67,28 +68,28 @@ class StateModule {
67
68
  '503': undefined,
68
69
  '504': undefined,
69
70
  };
70
- this.saveFunction = (_q = (_p = config.auth) === null || _p === void 0 ? void 0 : _p.saveFunction) !== null && _q !== void 0 ? _q : null;
71
+ this.saveFunction = (_r = (_q = config.auth) === null || _q === void 0 ? void 0 : _q.saveFunction) !== null && _r !== void 0 ? _r : null;
71
72
  if (config.errors) {
72
- this.isShell = (_r = config.errors.isShell) !== null && _r !== void 0 ? _r : true;
73
+ this.isShell = (_s = config.errors.isShell) !== null && _s !== void 0 ? _s : true;
73
74
  if (config.errors.customErrors) {
74
75
  this.errorsFunctions['400'] =
75
- (_s = config.errors.customErrors['400']) !== null && _s !== void 0 ? _s : undefined;
76
+ (_t = config.errors.customErrors['400']) !== null && _t !== void 0 ? _t : undefined;
76
77
  this.errorsFunctions['401'] =
77
- (_t = config.errors.customErrors['401']) !== null && _t !== void 0 ? _t : undefined;
78
+ (_u = config.errors.customErrors['401']) !== null && _u !== void 0 ? _u : undefined;
78
79
  this.errorsFunctions['403'] =
79
- (_u = config.errors.customErrors['403']) !== null && _u !== void 0 ? _u : undefined;
80
+ (_v = config.errors.customErrors['403']) !== null && _v !== void 0 ? _v : undefined;
80
81
  this.errorsFunctions['404'] =
81
- (_v = config.errors.customErrors['404']) !== null && _v !== void 0 ? _v : undefined;
82
+ (_w = config.errors.customErrors['404']) !== null && _w !== void 0 ? _w : undefined;
82
83
  this.errorsFunctions['429'] =
83
- (_w = config.errors.customErrors['429']) !== null && _w !== void 0 ? _w : undefined;
84
+ (_x = config.errors.customErrors['429']) !== null && _x !== void 0 ? _x : undefined;
84
85
  this.errorsFunctions['500'] =
85
- (_x = config.errors.customErrors['500']) !== null && _x !== void 0 ? _x : undefined;
86
+ (_y = config.errors.customErrors['500']) !== null && _y !== void 0 ? _y : undefined;
86
87
  this.errorsFunctions['502'] =
87
- (_y = config.errors.customErrors['502']) !== null && _y !== void 0 ? _y : undefined;
88
+ (_z = config.errors.customErrors['502']) !== null && _z !== void 0 ? _z : undefined;
88
89
  this.errorsFunctions['503'] =
89
- (_z = config.errors.customErrors['503']) !== null && _z !== void 0 ? _z : undefined;
90
+ (_0 = config.errors.customErrors['503']) !== null && _0 !== void 0 ? _0 : undefined;
90
91
  this.errorsFunctions['504'] =
91
- (_0 = config.errors.customErrors['504']) !== null && _0 !== void 0 ? _0 : undefined;
92
+ (_1 = config.errors.customErrors['504']) !== null && _1 !== void 0 ? _1 : undefined;
92
93
  }
93
94
  }
94
95
  else {
@@ -109,6 +109,12 @@ export default abstract class SyncModules {
109
109
  * @returns {any} Intervals with added time intervals.
110
110
  */
111
111
  _addTimeIntervalsToFormSchedules(intervals: any[]): any;
112
+ /**
113
+ * Transforms additionalFields from array to object keyed by marker.
114
+ * Skipped when rawData is enabled in config.
115
+ * @param {any} attr - The attribute object that may contain additionalFields.
116
+ */
117
+ private _normalizeAdditionalFields;
112
118
  /**
113
119
  * Normalizes attributes within the data.
114
120
  * @param {any} data - The data to normalize.
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ // Using WeakMap to store unique instance IDs for each object instance
4
+ const instanceIds = new WeakMap();
5
+ // Counter to ensure even more uniqueness
6
+ let instanceCounter = 0;
3
7
  /**
4
8
  * Abstract class representing synchronization modules.
5
9
  */
@@ -17,6 +21,15 @@ class SyncModules {
17
21
  this._sortAttributes = (data) => Object.fromEntries(Object.entries(data).sort(([, a], [, b]) => a.position - b.position));
18
22
  this.state = state;
19
23
  this._url = state.url;
24
+ // Generate and store a unique instance ID using WeakMap
25
+ if (!instanceIds.has(this)) {
26
+ const timestampPart = Date.now().toString(36);
27
+ const randomPart = Math.random().toString(36).substring(2, 15) +
28
+ Math.random().toString(36).substring(2, 15);
29
+ const counterPart = (++instanceCounter).toString(36);
30
+ const instanceId = `${timestampPart}${randomPart}${counterPart}`;
31
+ instanceIds.set(this, instanceId);
32
+ }
20
33
  }
21
34
  /**
22
35
  * Constructs the full URL path by appending the given path to the base URL.
@@ -319,6 +332,16 @@ class SyncModules {
319
332
  });
320
333
  return intervals;
321
334
  }
335
+ /**
336
+ * Transforms additionalFields from array to object keyed by marker.
337
+ * Skipped when rawData is enabled in config.
338
+ * @param {any} attr - The attribute object that may contain additionalFields.
339
+ */
340
+ _normalizeAdditionalFields(attr) {
341
+ if (!this.state.rawData && Array.isArray(attr.additionalFields)) {
342
+ attr.additionalFields = Object.fromEntries(attr.additionalFields.map((field) => [field.marker, field]));
343
+ }
344
+ }
322
345
  /**
323
346
  * Normalizes attributes within the data.
324
347
  * @param {any} data - The data to normalize.
@@ -330,6 +353,7 @@ class SyncModules {
330
353
  if ('attributeValues' in data) {
331
354
  for (const attr in data.attributeValues) {
332
355
  const d = data.attributeValues[attr];
356
+ this._normalizeAdditionalFields(d);
333
357
  // normalize numbers
334
358
  if (d.type === 'integer' || d.type === 'float') {
335
359
  const numValue = Number(d.value);
@@ -354,6 +378,7 @@ class SyncModules {
354
378
  if ('attributes' in data) {
355
379
  const d = data.attributes;
356
380
  for (const attr in d) {
381
+ this._normalizeAdditionalFields(d[attr]);
357
382
  // Normalize numbers
358
383
  // if (d[attr].type === 'integer' || d[attr].type === 'float') {
359
384
  // const numValue = Number(d[attr].value);
@@ -373,6 +398,7 @@ class SyncModules {
373
398
  }
374
399
  // For single attribute - for attribute sets
375
400
  if ('type' in data) {
401
+ this._normalizeAdditionalFields(data);
376
402
  // Normalize numbers
377
403
  if (data.type === 'integer' || data.type === 'float') {
378
404
  const numValue = Number(data.value);
@@ -429,12 +455,29 @@ class SyncModules {
429
455
  }
430
456
  // Access navigator through globalThis.window object to avoid direct reference
431
457
  const win = globalThis.window;
432
- const nav = (win === null || win === void 0 ? void 0 : win.navigator) || {};
458
+ // Get the instance ID from the WeakMap
459
+ const instanceId = instanceIds.get(this) ||
460
+ Date.now().toString(36) +
461
+ Math.random().toString(36).substring(2, 15) +
462
+ Math.random().toString(36).substring(2, 15) +
463
+ (++instanceCounter).toString(36);
464
+ // Node.js environment - unique per-instance fingerprint (no shared process ID)
465
+ if (!win) {
466
+ return JSON.stringify({
467
+ fingerprint: `UQ_${instanceId}`,
468
+ deviceInfo: {
469
+ os: 'Node.js',
470
+ browser: `Node.js/${instanceId.substring(0, 10)}`,
471
+ location: 'en-US',
472
+ },
473
+ });
474
+ }
475
+ const nav = win.navigator || {};
433
476
  const platform = nav.platform || 'Win32';
434
477
  const userAgent = nav.userAgent || 'Node.js/22';
435
478
  const language = nav.language || 'en-US';
436
479
  // Get screen information if available
437
- const screen = (win === null || win === void 0 ? void 0 : win.screen) || {};
480
+ const screen = win.screen || {};
438
481
  const screenWidth = screen.width || 0;
439
482
  const screenHeight = screen.height || 0;
440
483
  const colorDepth = screen.colorDepth || 0;
@@ -451,7 +494,7 @@ class SyncModules {
451
494
  let isPrivateBrowsing = false;
452
495
  try {
453
496
  // Simple localStorage test to detect private browsing
454
- if (win === null || win === void 0 ? void 0 : win.localStorage) {
497
+ if (win.localStorage) {
455
498
  const testKey = 'test_private_browsing';
456
499
  win.localStorage.setItem(testKey, '1');
457
500
  win.localStorage.removeItem(testKey);
@@ -465,7 +508,7 @@ class SyncModules {
465
508
  isPrivateBrowsing = true; // Error during localStorage access indicates private browsing
466
509
  }
467
510
  // Create a stable fingerprint string using stable device/browser characteristics
468
- const fingerprintString = `${platform}|${userAgent}|${language}|${screenWidth}|${screenHeight}|${colorDepth}|${timezone}|${isPrivateBrowsing ? 'private' : 'normal'}`;
511
+ const fingerprintString = `${platform}|${userAgent}|${language}|${screenWidth}|${screenHeight}|${colorDepth}|${timezone}|${isPrivateBrowsing ? 'private' : 'normal'}|${instanceId}`;
469
512
  // Simple but stable hash function
470
513
  let hash = 0;
471
514
  for (let i = 0; i < fingerprintString.length; i++) {
@@ -474,7 +517,7 @@ class SyncModules {
474
517
  hash = hash & hash; // Convert to 32-bit integer
475
518
  }
476
519
  const deviceMetadata = {
477
- fingerprint: `UQ_${Math.abs(hash).toString(36)}`,
520
+ fingerprint: `UQ_${Math.abs(hash).toString(36)}_${instanceId.substring(0, 12)}`,
478
521
  deviceInfo: {
479
522
  os: platform.replace(/ /g, '_'),
480
523
  browser: userAgent.replace(/ /g, '_'),
@@ -1,13 +1,19 @@
1
+ /**
2
+ * @typedef {string} Types - Type of block.
3
+ */
1
4
  type Types = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'similar_products_block' | 'product_block' | 'form' | 'common_page' | 'common_block' | 'order' | 'service' | 'none';
2
5
  /**
3
- * @param {string} [token] - If your project is protected by a token, specify this token in this parameter.
4
- * @param {string} [langCode] - specify the default language to avoid specifying it in every request.
5
- * @param {boolean} [traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set this parameter to "false" to save traffic and decide for yourself what data you need.
6
- * @param {boolean} [auth] - An object with authorization settings.
7
- * @param {boolean} [auth.customAuth] - Set this flag to true if you want to configure the authorization process yourself. Set the flag to false, or do not pass it at all to have automatic authorization and token renewal.
8
- * @param {boolean} [auth.refreshToken] - Transfer the refresh token here, for example from the local storage, to resume the user's session. Otherwise, the user will need to log in every time a new session is created.
9
- * @param {boolean} [auth.providerMarker] - The marker of the provider, for example, email, google, facebook, etc. Default 'email';
10
- * @param {boolean} [auth.saveFunction] - If you want to store the token between sessions, for example in local storage, create a custom function that takes refreshToken as a parameter and executes the necessary instructions. This function will be called every time the tokens are updated.
6
+ * @property {string} [token] - If your project is protected by a token, specify this token in this parameter.
7
+ * @property {string} [langCode] - specify the default language to avoid specifying it in every request.
8
+ * @property {boolean} [traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set this parameter to "false" to save traffic and decide for yourself what data you need.
9
+ * @property {boolean} [rawData] - Set to true to receive raw API responses without any transformation.
10
+ * @property {object} [validation] - Validation settings for API responses.
11
+ * @property {boolean} [auth] - An object with authorization settings.
12
+ * @property {boolean} [auth.customAuth] - Set this flag to true if you want to configure the authorization process yourself. Set the flag to false, or do not pass it at all to have automatic authorization and token renewal.
13
+ * @property {boolean} [auth.refreshToken] - Transfer the refresh token here, for example from the local storage, to resume the user's session. Otherwise, the user will need to log in every time a new session is created.
14
+ * @property {boolean} [auth.providerMarker] - The marker of the provider, for example, email, google, facebook, etc. Default 'email';
15
+ * @property {boolean} [auth.saveFunction] - If you want to store the token between sessions, for example in local storage, create a custom function that takes refreshToken as a parameter and executes the necessary instructions. This function will be called every time the tokens are updated.
16
+ * @property {object} [errors] - Error handling settings.
11
17
  * @example
12
18
  * ```ts
13
19
  * const saveToken = (token) => {
@@ -41,6 +47,7 @@ interface IConfig {
41
47
  token?: string;
42
48
  langCode?: string;
43
49
  traficLimit?: boolean;
50
+ rawData?: boolean;
44
51
  validation?: {
45
52
  enabled?: boolean;
46
53
  strictMode?: boolean;
@@ -24,8 +24,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
24
24
  * @param {string} [langCode] - Language code. Default: "en_US".
25
25
  * @param {number} [offset] - Parameter for pagination. Default: 0.
26
26
  * @param {number} [limit] - Parameter for pagination. Default: 30.
27
- * @returns {IBlocksResponse} Returns BlocksEntity object.
28
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
27
+ * @returns {Promise<IBlocksResponse | IError>} Returns BlocksEntity object.
28
+ * @throws {IError} When isShell=false and an error occurs during the fetch
29
29
  */
30
30
  getBlocks(type?: BlockType, langCode?: string, offset?: number, limit?: number): Promise<IBlocksResponse | IError>;
31
31
  /**
@@ -35,8 +35,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
35
35
  * @param {string} [langCode] - Language code. Default: "en_US".
36
36
  * @param {number} [offset] - Parameter for pagination. Default: 0.
37
37
  * @param {number} [limit] - Parameter for pagination. Default: 30.
38
- * @returns {IBlockEntity} - Returns a BlockEntity object.
39
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
38
+ * @returns {Promise<IBlockEntity | IError>} - Returns a BlockEntity object.
39
+ * @throws {IError} When isShell=false and an error occurs during the fetch
40
40
  * @description This method retrieves a block by its marker and includes additional information such as similar products or products associated with the block.
41
41
  */
42
42
  getBlockByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IBlockEntity | IError>;
@@ -47,8 +47,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
47
47
  * @param {string} [langCode] - Language code. Default: "en_US".
48
48
  * @param {number} [offset] - Parameter for pagination. Default: 0.
49
49
  * @param {number} [limit] - Parameter for pagination. Default: 30.
50
- * @returns {IProductsResponse} - Returns the total count and an array of product items in object by specified block marker.
51
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
50
+ * @returns {Promise<IProductsResponse | IError>} - Returns the total count and an array of product items in object by specified block marker.
51
+ * @throws {IError} When isShell=false and an error occurs during the fetch
52
52
  */
53
53
  private getSimilarProducts;
54
54
  /**
@@ -58,8 +58,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
58
58
  * @param {string} [langCode] - Language code. Default: "en_US".
59
59
  * @param {number} [offset] - Parameter for pagination. Default: 0.
60
60
  * @param {number} [limit] - Parameter for pagination. Default: 30.
61
- * @returns {IProductsEntity[]} Return array of BlocksEntity object.
62
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
61
+ * @returns {Promise<IProductsEntity[] | IError>} Return array of BlocksEntity object.
62
+ * @throws {IError} When isShell=false and an error occurs during the fetch
63
63
  */
64
64
  private getProductsByBlockMarker;
65
65
  /**
@@ -67,8 +67,8 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
67
67
  * @handleName searchBlock
68
68
  * @param {string} name - Search string. Example: "product_block".
69
69
  * @param {string} [langCode] - Language code. Default: "en_US".
70
- * @returns {ISearchBlock[]} Returns an array of ISearchBlock objects.
71
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
70
+ * @returns {Promise<ISearchBlock[] | IError>} Returns an array of ISearchBlock objects.
71
+ * @throws {IError} When isShell=false and an error occurs during the fetch
72
72
  */
73
73
  searchBlock(name: string, langCode?: string): Promise<ISearchBlock[] | IError>;
74
74
  }
@@ -29,8 +29,8 @@ class BlocksApi extends asyncModules_1.default {
29
29
  * @param {string} [langCode] - Language code. Default: "en_US".
30
30
  * @param {number} [offset] - Parameter for pagination. Default: 0.
31
31
  * @param {number} [limit] - Parameter for pagination. Default: 30.
32
- * @returns {IBlocksResponse} Returns BlocksEntity object.
33
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
32
+ * @returns {Promise<IBlocksResponse | IError>} Returns BlocksEntity object.
33
+ * @throws {IError} When isShell=false and an error occurs during the fetch
34
34
  */
35
35
  async getBlocks(type = '', langCode = this.state.lang, offset = 0, limit = 30) {
36
36
  const response = await this._fetchPost(`?langCode=${langCode}&type=${type}&offset=${offset}&limit=${limit}`);
@@ -83,8 +83,8 @@ class BlocksApi extends asyncModules_1.default {
83
83
  * @param {string} [langCode] - Language code. Default: "en_US".
84
84
  * @param {number} [offset] - Parameter for pagination. Default: 0.
85
85
  * @param {number} [limit] - Parameter for pagination. Default: 30.
86
- * @returns {IBlockEntity} - Returns a BlockEntity object.
87
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
86
+ * @returns {Promise<IBlockEntity | IError>} - Returns a BlockEntity object.
87
+ * @throws {IError} When isShell=false and an error occurs during the fetch
88
88
  * @description This method retrieves a block by its marker and includes additional information such as similar products or products associated with the block.
89
89
  */
90
90
  async getBlockByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
@@ -135,8 +135,8 @@ class BlocksApi extends asyncModules_1.default {
135
135
  * @param {string} [langCode] - Language code. Default: "en_US".
136
136
  * @param {number} [offset] - Parameter for pagination. Default: 0.
137
137
  * @param {number} [limit] - Parameter for pagination. Default: 30.
138
- * @returns {IProductsResponse} - Returns the total count and an array of product items in object by specified block marker.
139
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
138
+ * @returns {Promise<IProductsResponse | IError>} - Returns the total count and an array of product items in object by specified block marker.
139
+ * @throws {IError} When isShell=false and an error occurs during the fetch
140
140
  */
141
141
  async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30) {
142
142
  const query = {
@@ -154,8 +154,8 @@ class BlocksApi extends asyncModules_1.default {
154
154
  * @param {string} [langCode] - Language code. Default: "en_US".
155
155
  * @param {number} [offset] - Parameter for pagination. Default: 0.
156
156
  * @param {number} [limit] - Parameter for pagination. Default: 30.
157
- * @returns {IProductsEntity[]} Return array of BlocksEntity object.
158
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
157
+ * @returns {Promise<IProductsEntity[] | IError>} Return array of BlocksEntity object.
158
+ * @throws {IError} When isShell=false and an error occurs during the fetch
159
159
  */
160
160
  async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
161
161
  const query = {
@@ -171,8 +171,8 @@ class BlocksApi extends asyncModules_1.default {
171
171
  * @handleName searchBlock
172
172
  * @param {string} name - Search string. Example: "product_block".
173
173
  * @param {string} [langCode] - Language code. Default: "en_US".
174
- * @returns {ISearchBlock[]} Returns an array of ISearchBlock objects.
175
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
174
+ * @returns {Promise<ISearchBlock[] | IError>} Returns an array of ISearchBlock objects.
175
+ * @throws {IError} When isShell=false and an error occurs during the fetch
176
176
  */
177
177
  async searchBlock(name, langCode = this.state.lang) {
178
178
  const result = await this._fetchGet(`/quick/search?langCode=${langCode}&name=${name}`);
@@ -111,6 +111,7 @@ interface IBlocksResponse {
111
111
  * @property {number} version - Version of the block entity. Example: 1.
112
112
  * @property {string} identifier - Unique string identifier for the block. Example: "block1".
113
113
  * @property {string} type - Type of the block, such as 'product', 'error_page', etc. Example: "product".
114
+ * @property {number} position - Position of the block for sorting. Example: 1.
114
115
  * @property {string | null} templateIdentifier - Identifier for the template used by the block, or null if not applicable. Example: "template1".
115
116
  * @property {boolean} isVisible - Indicates whether the block is visible. Example: true.
116
117
  * @property {number} [countElementsPerRow] - Number of elements displayed per row in the block, if applicable. Example: 3.
@@ -27,8 +27,8 @@ export default class EventsApi extends AsyncModules implements IEvents {
27
27
  * @handleName getAllSubscriptions
28
28
  * @param {number} [offset] - Optional offset for pagination. Default: 0.
29
29
  * @param {number} [limit] - Optional limit for pagination. Default: 30.
30
- * @returns {ISubscriptions} Returns an object containing all subscriptions or an error object if there was an issue.
31
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
30
+ * @returns {Promise<ISubscriptions | IError>} Returns an object containing all subscriptions or an error object if there was an issue.
31
+ * @throws {IError} When isShell=false and an error occurs during the fetch
32
32
  * @description This method requires user authorization.
33
33
  * @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}.
34
34
  */
@@ -40,7 +40,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
40
40
  * @param {number} productId - Product id. Example: 12345.
41
41
  * @param {string} [langCode] - Language code. Default: "en_US".=
42
42
  * @returns {Promise<boolean | IError>} Returns true if subscription was successful, or an error object if there was an issue.
43
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
43
+ * @throws {IError} When isShell=false and an error occurs during the fetch
44
44
  * @description This method requires user authorization.
45
45
  * @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}.
46
46
  */
@@ -51,8 +51,8 @@ export default class EventsApi extends AsyncModules implements IEvents {
51
51
  * @param {string} marker - The marker of the event to unsubscribe from. Example: "product_price_change".
52
52
  * @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
53
53
  * @param {string} [langCode] - Language code. Default: "en_US".
54
- * @returns {any} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
55
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
54
+ * @returns {Promise<any | IError>} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
55
+ * @throws {IError} When isShell=false and an error occurs during the fetch
56
56
  * @description This method requires user authorization.
57
57
  * @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}.
58
58
  */
@@ -32,8 +32,8 @@ class EventsApi extends asyncModules_1.default {
32
32
  * @handleName getAllSubscriptions
33
33
  * @param {number} [offset] - Optional offset for pagination. Default: 0.
34
34
  * @param {number} [limit] - Optional limit for pagination. Default: 30.
35
- * @returns {ISubscriptions} Returns an object containing all subscriptions or an error object if there was an issue.
36
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
35
+ * @returns {Promise<ISubscriptions | IError>} Returns an object containing all subscriptions or an error object if there was an issue.
36
+ * @throws {IError} When isShell=false and an error occurs during the fetch
37
37
  * @description This method requires user authorization.
38
38
  * @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}.
39
39
  */
@@ -52,7 +52,7 @@ class EventsApi extends asyncModules_1.default {
52
52
  * @param {number} productId - Product id. Example: 12345.
53
53
  * @param {string} [langCode] - Language code. Default: "en_US".=
54
54
  * @returns {Promise<boolean | IError>} Returns true if subscription was successful, or an error object if there was an issue.
55
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
55
+ * @throws {IError} When isShell=false and an error occurs during the fetch
56
56
  * @description This method requires user authorization.
57
57
  * @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}.
58
58
  */
@@ -75,8 +75,8 @@ class EventsApi extends asyncModules_1.default {
75
75
  * @param {string} marker - The marker of the event to unsubscribe from. Example: "product_price_change".
76
76
  * @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
77
77
  * @param {string} [langCode] - Language code. Default: "en_US".
78
- * @returns {any} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
79
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
78
+ * @returns {Promise<any | IError>} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
79
+ * @throws {IError} When isShell=false and an error occurs during the fetch
80
80
  * @description This method requires user authorization.
81
81
  * @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}.
82
82
  */
@@ -42,26 +42,36 @@ interface IEvents {
42
42
  * Represents a response from the events API containing a total count and an array of subscription items.
43
43
  * @interface ISubscriptions
44
44
  * @property {number} total - Total number of found records. Example: 100.
45
- * @property {{ eventMarker: string; productId: number }[]} items - Array of subscription items, each containing an event marker and a product ID.
45
+ * @property {ISubscriptionItem[]} items - Array of subscription items, each containing an event marker and a product ID.
46
46
  * @example
47
- [
48
- {
49
- eventMarker: 'product_price_change',
50
- productId: 12345
51
- },
52
- {
53
- eventMarker: 'product_stock_update',
54
- productId: 67890
55
- }
56
- ]
47
+ [
48
+ {
49
+ eventMarker: 'product_price_change',
50
+ productId: 12345
51
+ },
52
+ {
53
+ eventMarker: 'product_stock_update',
54
+ productId: 67890
55
+ }
56
+ ]
57
+ * @property { string } items.eventMarker - Event marker.
58
+ * @property { number } items.productId - Product ID.
57
59
  * @description Represents a response from the events API containing a total count and an array of subscription items.
58
60
  */
59
61
  interface ISubscriptions {
60
62
  total: number;
61
- items: Array<{
62
- eventMarker: string;
63
- productId: number;
64
- }>;
63
+ items: Array<ISubscriptionItem>;
64
+ }
65
+ /**
66
+ * Represents item from the events API.
67
+ * @interface ISubscriptionItem
68
+ * @property { string } eventMarker -Event marker.
69
+ * @property { number } productId - Product ID.
70
+ * @description Represents item from the events API.
71
+ */
72
+ interface ISubscriptionItem {
73
+ eventMarker: string;
74
+ productId: number;
65
75
  }
66
76
  /**
67
77
  * Interface for the body of the subscribe methods.
@@ -41,8 +41,8 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
41
41
  * @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
42
42
  * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
43
43
  * @param {any} [fileQuery.template] - preview template identifier. Example: 1.
44
- * @returns {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
45
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
44
+ * @returns {Promise<IUploadingReturn[] | IError>} Uploads a file to an Amazon S3-compatible cloud file storage.
45
+ * @throws {IError} When isShell=false and an error occurs during the fetch
46
46
  */
47
47
  upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
48
48
  /**
@@ -61,8 +61,8 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
61
61
  * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
62
62
  * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
63
63
  * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
64
- * @returns {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
65
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
64
+ * @returns {Promise<any | IError>} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
65
+ * @throws {IError} When isShell=false and an error occurs during the fetch
66
66
  */
67
67
  delete(filename: string, fileQuery?: IUploadingQuery): Promise<any | IError>;
68
68
  /**
@@ -81,8 +81,8 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
81
81
  * @param {string} entity - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
82
82
  * @param {string} filename - Filename. Example: "file.png".
83
83
  * @param {string} [template] - Preview template identifier. Example: 1.
84
- * @returns {any} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
85
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
84
+ * @returns {Promise<any | IError>} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
85
+ * @throws {IError} When isShell=false and an error occurs during the fetch
86
86
  */
87
87
  getFile(id: number, type: string, entity: string, filename: string, template?: string): Promise<any | IError>;
88
88
  }
@@ -56,8 +56,8 @@ class FileUploadingApi extends asyncModules_1.default {
56
56
  * @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
57
57
  * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
58
58
  * @param {any} [fileQuery.template] - preview template identifier. Example: 1.
59
- * @returns {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
60
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
59
+ * @returns {Promise<IUploadingReturn[] | IError>} Uploads a file to an Amazon S3-compatible cloud file storage.
60
+ * @throws {IError} When isShell=false and an error occurs during the fetch
61
61
  */
62
62
  async upload(file, fileQuery) {
63
63
  const query = { ...this._defaultQuery, ...fileQuery };
@@ -84,8 +84,8 @@ class FileUploadingApi extends asyncModules_1.default {
84
84
  * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
85
85
  * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
86
86
  * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
87
- * @returns {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
88
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
87
+ * @returns {Promise<any | IError>} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
88
+ * @throws {IError} When isShell=false and an error occurs during the fetch
89
89
  */
90
90
  async delete(filename, fileQuery) {
91
91
  const query = { ...this._defaultQuery, ...fileQuery };
@@ -114,8 +114,8 @@ class FileUploadingApi extends asyncModules_1.default {
114
114
  * @param {string} entity - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
115
115
  * @param {string} filename - Filename. Example: "file.png".
116
116
  * @param {string} [template] - Preview template identifier. Example: 1.
117
- * @returns {any} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
118
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
117
+ * @returns {Promise<any | IError>} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
118
+ * @throws {IError} When isShell=false and an error occurs during the fetch
119
119
  */
120
120
  async getFile(id, type, entity, filename, template) {
121
121
  // eslint-disable-next-line no-undef