oneentry 1.0.122 → 1.0.124

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 (73) hide show
  1. package/dist/admins/adminsApi.d.ts +16 -8
  2. package/dist/admins/adminsApi.js +18 -10
  3. package/dist/admins/adminsInterfaces.d.ts +49 -25
  4. package/dist/attribute-sets/attributeSetsApi.d.ts +43 -21
  5. package/dist/attribute-sets/attributeSetsApi.js +49 -25
  6. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +70 -24
  7. package/dist/auth-provider/authProviderApi.d.ts +94 -83
  8. package/dist/auth-provider/authProviderApi.js +96 -83
  9. package/dist/auth-provider/authProvidersInterfaces.d.ts +188 -10
  10. package/dist/base/asyncModules.d.ts +32 -28
  11. package/dist/base/asyncModules.js +62 -38
  12. package/dist/base/syncModules.d.ts +44 -44
  13. package/dist/base/syncModules.js +65 -63
  14. package/dist/blocks/blocksApi.d.ts +56 -25
  15. package/dist/blocks/blocksApi.js +56 -25
  16. package/dist/blocks/blocksInterfaces.d.ts +71 -22
  17. package/dist/events/eventsApi.d.ts +45 -11
  18. package/dist/events/eventsApi.js +47 -17
  19. package/dist/events/eventsInterfaces.d.ts +44 -2
  20. package/dist/file-uploading/fileUploadingApi.d.ts +44 -24
  21. package/dist/file-uploading/fileUploadingApi.js +46 -27
  22. package/dist/file-uploading/fileUploadingInterfaces.d.ts +63 -14
  23. package/dist/forms/formsApi.d.ts +23 -8
  24. package/dist/forms/formsApi.js +23 -8
  25. package/dist/forms/formsInterfaces.d.ts +62 -15
  26. package/dist/formsData/formsDataApi.d.ts +33 -33
  27. package/dist/formsData/formsDataApi.js +33 -33
  28. package/dist/formsData/formsDataInterfaces.d.ts +123 -35
  29. package/dist/general-types/generalTypesApi.d.ts +12 -1
  30. package/dist/general-types/generalTypesApi.js +12 -1
  31. package/dist/general-types/generalTypesInterfaces.d.ts +18 -5
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.js +1 -1
  34. package/dist/integration-collections/integrationCollectionsApi.d.ts +96 -70
  35. package/dist/integration-collections/integrationCollectionsApi.js +114 -81
  36. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +152 -30
  37. package/dist/locales/localesApi.d.ts +6 -1
  38. package/dist/locales/localesApi.js +6 -1
  39. package/dist/locales/localesInterfaces.d.ts +20 -11
  40. package/dist/menus/menusApi.d.ts +8 -3
  41. package/dist/menus/menusApi.js +8 -3
  42. package/dist/menus/menusInterfaces.d.ts +30 -17
  43. package/dist/orders/ordersApi.d.ts +64 -64
  44. package/dist/orders/ordersApi.js +67 -65
  45. package/dist/orders/ordersInterfaces.d.ts +174 -60
  46. package/dist/pages/pagesApi.d.ts +89 -30
  47. package/dist/pages/pagesApi.js +181 -57
  48. package/dist/pages/pagesInterfaces.d.ts +117 -23
  49. package/dist/payments/paymentsApi.d.ts +56 -22
  50. package/dist/payments/paymentsApi.js +56 -22
  51. package/dist/payments/paymentsInterfaces.d.ts +119 -36
  52. package/dist/product-statuses/productStatusesApi.d.ts +21 -15
  53. package/dist/product-statuses/productStatusesApi.js +21 -18
  54. package/dist/product-statuses/productStatusesInterfaces.d.ts +37 -9
  55. package/dist/products/productsApi.d.ts +137 -157
  56. package/dist/products/productsApi.js +137 -157
  57. package/dist/products/productsInterfaces.d.ts +240 -57
  58. package/dist/system/systemApi.d.ts +29 -10
  59. package/dist/system/systemApi.js +29 -10
  60. package/dist/system/systemInterfaces.d.ts +8 -0
  61. package/dist/templates/templatesApi.d.ts +26 -16
  62. package/dist/templates/templatesApi.js +26 -19
  63. package/dist/templates/templatesInterfaces.d.ts +40 -14
  64. package/dist/templates-preview/templatesPreviewApi.d.ts +18 -14
  65. package/dist/templates-preview/templatesPreviewApi.js +18 -17
  66. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +57 -29
  67. package/dist/users/usersApi.d.ts +37 -33
  68. package/dist/users/usersApi.js +37 -33
  69. package/dist/users/usersInterfaces.d.ts +80 -9
  70. package/dist/web-socket/wsApi.d.ts +6 -3
  71. package/dist/web-socket/wsApi.js +6 -3
  72. package/dist/web-socket/wsInterfaces.d.ts +3 -1
  73. package/package.json +11 -11
@@ -18,107 +18,167 @@ class PageApi extends asyncModules_1.default {
18
18
  /**
19
19
  * Get all top-level page objects.
20
20
  *
21
- * @param {string} [langCode] - lang code
21
+ * @handleName getRootPages
22
22
  *
23
- * @returns Returns all created pages without parents as an array of PageEntity objects or an empty array [] (if there is no data)
23
+ * @param {string} [langCode] - Language code. Default: "en_US".
24
+ *
25
+ * @return {IPagesEntity[]} Returns all created pages without parents as an array of PageEntity objects or an empty array [] (if there is no data)
26
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
27
+ *
28
+ * @description
24
29
  */
25
30
  async getRootPages(langCode = this.state.lang) {
31
+ // Fetch data from the server using a GET request to retrieve root pages for the specified language code
26
32
  const data = await this._fetchGet(`/root?langCode=${langCode}`);
27
- const result = await this.addTemplateToPages(data);
28
- return this._normalizeData(result, langCode);
33
+ // Add template information to each page in the fetched root pages data
34
+ const withTemplate = await this.addTemplateToPages(data);
35
+ // Normalize the data and return it; ensures consistent structure or handles errors
36
+ return this._normalizeData(withTemplate, langCode);
29
37
  }
30
38
  /**
31
39
  * Get all page objects with product information as an array.
32
40
  *
33
- * @param {string} [langCode] - lang code
41
+ * @handleName getPages
42
+ *
43
+ * @param {string} [langCode] - Language code. Default: "en_US".
44
+ *
45
+ * @return {IPagesEntity[]} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data).
46
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
34
47
  *
35
- * @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
48
+ * @description Get all page objects with product information as an array.
36
49
  */
37
50
  async getPages(langCode = this.state.lang) {
51
+ // Fetch data from the server using a GET request to retrieve all pages for the specified language code
38
52
  const data = await this._fetchGet(`?langCode=${langCode}`);
39
- const result = await this.addTemplateToPages(data);
40
- return this._normalizeData(result, langCode);
53
+ // Add template information to each page in the fetched data
54
+ const withTemplate = await this.addTemplateToPages(data);
55
+ // Normalize the data and return it; ensures consistent structure or handles errors
56
+ return this._normalizeData(withTemplate, langCode);
41
57
  }
42
58
  /**
43
59
  * Get page object with information about forms, blocks, menus, linked to the page.
44
60
  *
45
- * @param {number} [id] - Page object identifier
46
- * @param {string} [langCode] - lang code
61
+ * @handleName getPageById
47
62
  *
48
- * @returns Returns PageEntity object
63
+ * @param {number} id - The unique identifier of the page to be fetched. Example: 1.
64
+ * @param {string} [langCode] - Language code. Default: "en_US".
65
+ *
66
+ * @return {IPagesEntity} Returns PageEntity object
67
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
68
+ *
69
+ * @description Get page object with information about forms, blocks, menus, linked to the page.
49
70
  */
50
71
  async getPageById(id, langCode = this.state.lang) {
72
+ // Fetch data from the server using a GET request to retrieve page details by ID and language code
51
73
  const data = await this._fetchGet(`/${id}?langCode=${langCode}`);
52
- const result = await this.addTemplateToPage(data);
53
- return this._normalizeData(result, langCode);
74
+ // Add template information to the fetched page data
75
+ const withTemplate = await this.addTemplateToPage(data);
76
+ // Normalize the data and return it; ensures consistent structure or handles errors
77
+ return this._normalizeData(withTemplate, langCode);
54
78
  }
55
79
  /**
56
80
  * Get page object with information about forms, blocks, menus, linked to the page by URL.
57
81
  *
58
- * @param {string} [url] - Page URL
59
- * @param {string} [langCode] - lang code
82
+ * @handleName getPageByUrl
83
+ *
84
+ * @param {string} url - Page URL. Example: "about".
85
+ * @param {string} [langCode] - Language code. Default: "en_US".
60
86
  *
61
- * @returns Returns PageEntity object
87
+ * @return {IPagesEntity} Returns PageEntity object
88
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
89
+ *
90
+ * @description Get page object with information about forms, blocks, menus, linked to the page by URL.
62
91
  */
63
92
  async getPageByUrl(url, langCode = this.state.lang) {
93
+ // Fetch data from the server using a GET request with the specified URL and language code
64
94
  const data = await this._fetchGet(`/url/${url}?langCode=${langCode}`);
65
- const result = await this.addTemplateToPage(data);
66
- return this._normalizeData(result, langCode);
95
+ // Add template information to the fetched page data
96
+ const withTemplate = await this.addTemplateToPage(data);
97
+ // Normalize the result data and return it; ensures consistent structure or handles errors
98
+ return this._normalizeData(withTemplate, langCode);
67
99
  }
68
100
  /**
69
101
  * Get child pages object with information as an array.
70
102
  *
71
- * @param {string} [url] - Parent page URL
72
- * @param {string} [langCode] - Required parameter lang code
103
+ * @handleName getChildPagesByParentUrl
104
+ *
105
+ * @param {string} url - The URL of the parent page for which child pages are to be fetched. Example: "about/our-team".
106
+ * @param {string} [langCode] - Language code. Default: "en_US".
73
107
  *
74
- * @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
108
+ * @return {IPagesEntity} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
109
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
110
+ *
111
+ * @description Get child pages object with information as an array.
75
112
  */
76
113
  async getChildPagesByParentUrl(url, langCode = this.state.lang) {
114
+ // Fetch data from the server using a GET request to retrieve child pages for the specified parent URL and language code
77
115
  const data = await this._fetchGet(`/${url}/children?langCode=${langCode}`);
78
- const result = await this.addTemplateToPages(data);
79
- return this._normalizeData(result, langCode);
116
+ // Add template information to each of the fetched child pages
117
+ const withTemplate = await this.addTemplateToPages(data);
118
+ // Normalize the result data and return it; ensures consistent structure or handles errors
119
+ return this._normalizeData(withTemplate, langCode);
80
120
  }
81
121
  /**
82
122
  * Get all blocks by page url.
83
123
  *
84
- * @param {string} [url] - Page URL
85
- * @param {string} [langCode] - lang code
124
+ * @handleName getBlocksByPageUrl
125
+ *
126
+ * @param {string} url - Page URL. Example: "about".
127
+ * @param {string} [langCode] - Language code. Default: "en_US".
86
128
  *
87
- * @returns Returns all blocks as an array of PositionBlock objects or an empty array [] (if there is no data) for the selected parent
129
+ * @return {IPositionBlock[]} Returns all blocks as an array of PositionBlock objects or an empty array [] (if there is no data) for the selected parent
130
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
131
+ *
132
+ * @description Get all blocks by page url.
88
133
  */
89
134
  async getBlocksByPageUrl(url, langCode = this.state.lang) {
90
135
  const response = await this._fetchGet(`/${url}/blocks?langCode=${langCode}`);
136
+ // Normalize the fetched response data
91
137
  const normalizeResponse = this._normalizeData(response);
138
+ // Iterate over each item in the normalized response
92
139
  normalizeResponse.map((item) => {
93
140
  const customSettings = item.customSettings;
141
+ // Check if customSettings contains 'productConfig' property
94
142
  // eslint-disable-next-line no-prototype-builtins
95
143
  if (customSettings && customSettings.hasOwnProperty('productConfig')) {
144
+ // If 'countElementsPerRow' exists, set it on the item
96
145
  if (customSettings.productConfig.countElementsPerRow)
97
146
  item.countElementsPerRow =
98
147
  +customSettings.productConfig.countElementsPerRow;
148
+ // If 'quantity' exists, set it on the item
99
149
  if (customSettings.productConfig.quantity)
100
150
  item.quantity = +customSettings.productConfig.quantity;
101
151
  }
152
+ // Remove unnecessary properties from the item
102
153
  delete item.customSettings;
103
154
  delete item.attributesSetIdentifier;
155
+ // Return the modified item
104
156
  return item;
105
157
  });
158
+ // Check if traffic limit is not set
106
159
  if (!this.state.traficLimit) {
160
+ // Define a class 'StaffModule' extending 'AsyncModules'
107
161
  class StaffModule extends asyncModules_1.default {
108
162
  constructor(state) {
109
- super(state);
110
- this._url = state.url + '/api/content/blocks';
163
+ super(state); // Call parent constructor
164
+ this._url = state.url + '/api/content/blocks'; // Set URL for content blocks
111
165
  }
166
+ // Method to fetch similar products by marker
112
167
  async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30) {
168
+ // Fetch similar products from the server
113
169
  const result = await this._fetchGet(`/${marker}/similar-products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
114
170
  return this._normalizeData(result.items);
115
171
  }
172
+ // Method to fetch products by block marker
116
173
  async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
174
+ // Fetch products from the server
117
175
  const result = await this._fetchGet(`/${marker}/products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
118
176
  return this._normalizeData(result.items);
119
177
  }
120
178
  }
179
+ // Create an instance of 'StaffModule' with the current state
121
180
  const staffModule = new StaffModule(this.state);
181
+ // If the block type is 'similar_products_block', fetch similar products
122
182
  if (normalizeResponse.type === 'similar_products_block') {
123
183
  try {
124
184
  await staffModule
@@ -128,8 +188,10 @@ class PageApi extends asyncModules_1.default {
128
188
  });
129
189
  }
130
190
  catch {
191
+ // Handle errors by setting an empty array
131
192
  normalizeResponse.similarProducts = [];
132
193
  }
194
+ // If the block type is 'product_block', fetch products
133
195
  }
134
196
  else if (normalizeResponse.type === 'product_block') {
135
197
  try {
@@ -140,86 +202,148 @@ class PageApi extends asyncModules_1.default {
140
202
  });
141
203
  }
142
204
  catch {
205
+ // Handle errors by setting an empty array
143
206
  normalizeResponse.products = [];
144
207
  }
145
208
  }
146
209
  }
210
+ // Return the final normalized response
147
211
  return this._normalizeData(normalizeResponse);
148
212
  }
149
213
  /**
150
214
  * Get all forms by page url.
151
215
  *
152
- * @param {string} [url] - Page URL
153
- * @param {string} [langCode] - lang code
216
+ * @handleName getFormsByPageUrl
217
+ *
218
+ * @param {string} url - The URL of the page for which forms are to be fetched. Example: "about".
219
+ * @param {string} [langCode] - Language code. Default: "en_US".
220
+ *
221
+ * @return {IPositionForm[]} Returns all forms as an array of PositionForm objects or an empty array [] (if there is no data) for the selected parent
222
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
154
223
  *
155
- * @returns Returns all forms as an array of PositionForm objects or an empty array [] (if there is no data) for the selected parent
224
+ * @description Get all forms by page url.
156
225
  */
157
226
  async getFormsByPageUrl(url, langCode = this.state.lang) {
158
- const result = await this._fetchGet(`/${url}/forms?langCode=${langCode}`);
159
- return this._normalizeData(result, langCode);
227
+ // Fetch data from the server using a GET request to retrieve forms for the specified page URL and language code
228
+ const withTemplate = await this._fetchGet(`/${url}/forms?langCode=${langCode}`);
229
+ // Normalize the fetched result data and return it; ensures consistent structure or handles errors
230
+ return this._normalizeData(withTemplate, langCode);
160
231
  }
161
232
  /**
162
233
  * Get settings for the page.
163
234
  *
164
- * @param {string} [url] - Page URL
235
+ * @handleName getConfigPageByUrl
165
236
  *
166
- * @returns Returns a ConfigPage object with page display settings
237
+ * @param {string} url - Page URL. Example: "about".
238
+ *
239
+ * @return {IPageConfig} Returns a ConfigPage object with page display settings
240
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
241
+ *
242
+ * @description Get settings for the page.
167
243
  */
168
244
  async getConfigPageByUrl(url) {
245
+ // Fetch data from the server using a GET request to retrieve forms for the specified page URL and language code
169
246
  const result = await this._fetchGet(`/${url}/config`);
247
+ // return fetched data
170
248
  return result;
171
249
  }
172
250
  /**
173
251
  * Quick search for page objects with limited output.
174
252
  *
175
- * @param {string} [name] - Text for searching page objects (search is performed on the title field of the localizeInfos object with the language taken into account)
176
- * @param {string} [langCode] - lang code
253
+ * @handleName searchPage
254
+ *
255
+ * @param {string} name - Text for searching page objects (search is performed on the title field of the localizeInfos object with the language taken into account). Example: "About Us".
256
+ * @param {string} [langCode] - Language code. Default: "en_US".
257
+ *
258
+ * @return {IPagesEntity[]} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
259
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
177
260
  *
178
- * @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
261
+ * @description Quick search for page objects with limited output.
179
262
  */
180
263
  async searchPage(name, langCode = this.state.lang) {
264
+ // Fetch data from the server using a GET request to perform a quick search by page name and language code
181
265
  const data = await this._fetchGet(`/quick/search?lang=${langCode}&name=${name}`);
266
+ // Check if there is no traffic limit set in the state
182
267
  if (!this.state.traficLimit) {
268
+ // Initialize an empty array to store detailed page information
183
269
  const pageList = [];
270
+ // Use Promise.all to fetch detailed information for each page concurrently
184
271
  await Promise.all(data.map(async (page) => {
272
+ // Fetch detailed page information by page ID and push it to pageList
185
273
  await this.getPageById(page.id, langCode).then((result) => {
186
274
  pageList.push(result);
187
275
  });
188
276
  }));
189
- const result = await this.addTemplateToPages(pageList);
190
- return this._dataPostProcess(result, langCode);
277
+ // Add templates to the fetched pages
278
+ const withTemplate = await this.addTemplateToPages(pageList);
279
+ // Post-process the data and return it; ensures consistent structure or handles errors
280
+ return this._dataPostProcess(withTemplate, langCode);
191
281
  }
192
- const result = await this.addTemplateToPages(data);
193
- return this._normalizeData(result, langCode);
282
+ // If there is a traffic limit, add templates to the initially fetched data without fetching detailed information
283
+ const withTemplate = await this.addTemplateToPages(data);
284
+ // Normalize the data and return it; ensures consistent structure or handles errors
285
+ return this._normalizeData(withTemplate, langCode);
194
286
  }
195
287
  /**
196
- * addTemplateToPages
197
- * @param data
198
- * @returns
288
+ * Add template data to pages
289
+ *
290
+ * @handleName addTemplateToPages
291
+ *
292
+ * @param data - An array of page objects (IPagesEntity[]) to which template data will be added. Example: .
293
+ *
294
+ * @return - An array of page objects with template data added
295
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
296
+ *
297
+ * @description Add template data to pages
199
298
  */
200
299
  async addTemplateToPages(data) {
300
+ // Use Promise.all to handle an array of promises returned by mapping over 'data'
201
301
  return Promise.all(data.map(async (d) => {
302
+ // For each element 'd' in the 'data' array, call 'addTemplateToPage'
202
303
  const result = await this.addTemplateToPage(d);
304
+ // Return the result of 'addTemplateToPage' for the current element
203
305
  return result;
204
306
  }));
205
307
  }
206
308
  /**
207
- * addTemplateToPage by page templateIdentifier
208
- * @param data - page object
209
- * @returns
309
+ * Add template data to page by page templateIdentifier
310
+ *
311
+ * @handleName addTemplateToPage
312
+ *
313
+ * @param data - An array of page objects (IPagesEntity[]) to which template data will be added. Example: .
314
+ *
315
+ * @return - An array of page objects with template data added
316
+ * @throws {IError} If there is an error during the fetch operation, it will return an error object.
317
+ *
318
+ * @description
210
319
  */
211
320
  async addTemplateToPage(data) {
212
- if ('templateIdentifier' in data && data.templateIdentifier) {
213
- // Create an instance of templatesApi with the current state
214
- const Templates = new templatesApi_1.default(this.state);
215
- // get template by marker
216
- const result = await Templates.getTemplateByMarker('template');
217
- return {
218
- ...data,
219
- template: result,
220
- };
321
+ // Check if 'templateIdentifier' exists in 'data' and is not null or an empty string
322
+ if ('templateIdentifier' in data &&
323
+ data.templateIdentifier !== null &&
324
+ data.templateIdentifier !== '') {
325
+ // Destructure 'templateIdentifier' from 'data'
326
+ const { templateIdentifier } = data;
327
+ try {
328
+ // Create a new instance of templatesApi with the current state
329
+ const Templates = new templatesApi_1.default(this.state);
330
+ // Fetch the template using the 'templateIdentifier'
331
+ const result = await Templates.getTemplateByMarker(templateIdentifier);
332
+ // Return the original data object with the fetched template added
333
+ return {
334
+ ...data,
335
+ template: result,
336
+ };
337
+ }
338
+ catch (error) {
339
+ // Log any errors that occur during the template fetching process
340
+ console.error('Template fetch error: ', error);
341
+ // Return the original data object unchanged if an error occurs
342
+ return data;
343
+ }
221
344
  }
222
345
  else {
346
+ // If 'templateIdentifier' doesn't exist or is invalid, return the original data
223
347
  return data;
224
348
  }
225
349
  }
@@ -1,6 +1,6 @@
1
1
  import type { AttributeType, IAttributes, IError, LangType, Types } from '../base/utils';
2
2
  /**
3
- * Represents an interface object of Pages Api.
3
+ * @interface IPageApi
4
4
  *
5
5
  * @property {function} getRootPages - Get all top-level page objects.
6
6
  * @property {function} getCatalogPages - Get all page objects with product information as an array.
@@ -11,33 +11,117 @@ import type { AttributeType, IAttributes, IError, LangType, Types } from '../bas
11
11
  * @property {function} getFormsByPageUrl - Get all forms by page url.
12
12
  * @property {function} getConfigPageByUrl - Get settings for the page.
13
13
  * @property {function} searchPage - Quick search for page objects with limited output.
14
+ *
15
+ * @description This interface defines methods for retrieving and managing pages in the system.
14
16
  */
15
17
  interface IPageApi {
18
+ /**
19
+ * Get all top-level page objects.
20
+ *
21
+ * @param {string} [langCode] - Language code. Default: "en_US".
22
+ *
23
+ * @return {IPagesEntity[]} Returns all created pages without parents as an array of PageEntity objects or an empty array [] (if there is no data)
24
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
25
+ */
16
26
  getRootPages(langCode?: LangType): Promise<Array<IPagesEntity> | IError>;
27
+ /**
28
+ * Get all page objects with product information as an array.
29
+ *
30
+ * @param {string} [langCode] - Language code. Default: "en_US".
31
+ *
32
+ * @return {IPagesEntity[]} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data).
33
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
34
+ */
17
35
  getPages(langCode?: LangType): Promise<Array<IPagesEntity> | IError>;
36
+ /**
37
+ * Get page object with information about forms, blocks, menus, linked to the page.
38
+ *
39
+ * @param {number} id - The unique identifier of the page to be fetched. Example: 123.
40
+ * @param {string} [langCode] - Language code. Default: "en_US".
41
+ *
42
+ * @return {IPagesEntity} Returns PageEntity object
43
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
44
+ */
18
45
  getPageById(id: number, langCode?: LangType): Promise<IPagesEntity | IError>;
46
+ /**
47
+ * Get page object with information about forms, blocks, menus, linked to the page by URL.
48
+ *
49
+ * @param {string} url - Page URL. Example: "about".
50
+ * @param {string} [langCode] - Language code. Default: "en_US".
51
+ *
52
+ * @return {IPagesEntity} Returns PageEntity object
53
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
54
+ */
19
55
  getPageByUrl(url: string, langCode?: LangType): Promise<IPagesEntity | IError>;
56
+ /**
57
+ * Get child pages object with information as an array.
58
+ *
59
+ * @param {string} url - The URL of the parent page for which child pages are to be fetched. Example: "about".
60
+ * @param {string} [langCode] - Language code. Default: "en_US".
61
+ *
62
+ * @return {IPagesEntity} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
63
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
64
+ */
20
65
  getChildPagesByParentUrl(url: string, langCode?: LangType): Promise<Array<IPagesEntity> | IError>;
21
- getFormsByPageUrl(url: string, langCode?: LangType): Promise<Array<IPositionForm> | IError>;
66
+ /**
67
+ * Get all blocks by page url.
68
+ *
69
+ * @param {string} url - Page URL. Example: "about".
70
+ * @param {string} [langCode] - Language code. Default: "en_US".
71
+ *
72
+ * @return {IPositionBlock[]} Returns all blocks as an array of PositionBlock objects or an empty array [] (if there is no data) for the selected parent
73
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
74
+ */
22
75
  getBlocksByPageUrl(url: string, langCode?: LangType): Promise<Array<IPositionBlock> | IError>;
76
+ /**
77
+ * Get all forms by page url.
78
+ *
79
+ * @handleName getFormsByPageUrl
80
+ *
81
+ * @param {string} url - The URL of the page for which forms are to be fetched. Example: "about".
82
+ * @param {string} [langCode] - Language code. Default: "en_US".
83
+ *
84
+ * @return {IPositionForm[]} Returns all forms as an array of PositionForm objects or an empty array [] (if there is no data) for the selected parent
85
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
86
+ *
87
+ * @description Get all forms by page url.
88
+ */
89
+ getFormsByPageUrl(url: string, langCode?: LangType): Promise<Array<IPositionForm> | IError>;
90
+ /**
91
+ * Get settings for the page.
92
+ *
93
+ * @param {string} url - Page URL. Example: "about".
94
+ *
95
+ * @return {IPageConfig} Returns a ConfigPage object with page display settings
96
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
97
+ */
23
98
  getConfigPageByUrl(url: string): Promise<IPageConfig | IError>;
99
+ /**
100
+ * Quick search for page objects with limited output.
101
+ *
102
+ * @param {string} name - Text for searching page objects (search is performed on the title field of the localizeInfos object with the language taken into account). Example: "About Us".
103
+ * @param {string} [langCode] - Language code. Default: "en_US".
104
+ *
105
+ * @return {IPagesEntity[]} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
106
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
107
+ */
24
108
  searchPage(name: string, langCode?: LangType): Promise<Array<IPagesEntity> | IError>;
25
109
  }
26
110
  /**
27
- * Represents a config object.
111
+ * @interface IPageConfig
28
112
  *
29
- * @interface
30
113
  * @property {number} rowsPerPage - Number of lines per page.
31
114
  * @property {number} rowsPerPage - Number of products per page.
115
+ *
116
+ * @description This interface defines the configuration for pagination in pages, including the number of rows and products displayed per page.
32
117
  */
33
118
  interface IPageConfig {
34
119
  rowsPerPage: number | null;
35
120
  productsPerRow: number | null;
36
121
  }
37
122
  /**
38
- * Represents an object with various properties.
123
+ * @interface IPositionForm
39
124
  *
40
- * @interface
41
125
  * @property {number} id - The identifier of the object.
42
126
  * @property {number} version - The version number of the object.
43
127
  * @property {string} identifier - The textual identifier for the record field.
@@ -47,6 +131,8 @@ interface IPageConfig {
47
131
  * @property {Record<string, any>} localizeInfos - The name of the page, taking into account localization.
48
132
  * @property {object} processingData - Form data.
49
133
  * @property {number} position - The position of the object.
134
+ *
135
+ * @description This interface defines the structure of a position form entity, including its identifiers, attributes, and processing data.
50
136
  */
51
137
  interface IPositionForm {
52
138
  id: number;
@@ -60,19 +146,23 @@ interface IPositionForm {
60
146
  position: number;
61
147
  }
62
148
  /**
63
- * Represents an object with various properties.
149
+ * @interface IPositionBlock
64
150
  *
65
- * @interface
66
151
  * @property {number} id - The identifier of the object.
152
+ * @property {number} [quantity] - Quantity pages in block.
67
153
  * @property {number} version - The version number of the object.
68
- * @property {number} quantity - Quantity pages in block.
69
154
  * @property {string} identifier - The textual identifier for the record field.
70
155
  * @property {Record<string, any>} localizeInfos - The name of the page, taking into account localization.
71
156
  * @property {number} position - The position of the object.
72
157
  * @property {boolean} isSync - Indication of page indexing.
73
158
  * @property {AttributeType} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
74
- * @property {string} attributeSetIdentifier
159
+ * @property {string} attributeSetIdentifier - Set of attributes id.
160
+ * @property {boolean} isVisible - A sign of page visibility.
75
161
  * @property {Types} type - Page type.
162
+ * @property {string | null} templateIdentifier - User id of the linked template.
163
+ * @property {number} [countElementsPerRow] - Number of elements displayed per row in the block, if applicable.
164
+ *
165
+ * @description This interface defines the structure of a position block entity, including its identifiers, attributes, and visibility.
76
166
  */
77
167
  interface IPositionBlock {
78
168
  id: number;
@@ -90,24 +180,28 @@ interface IPositionBlock {
90
180
  countElementsPerRow?: number;
91
181
  }
92
182
  /**
93
- * Represents an object with various properties.
183
+ * @interface IPagesEntity
94
184
  *
95
- * @interface
96
- * @property {number} id - The identifier of the object.
97
- * @property {number} parentId - The id of the parent page, if it contains null, then it is the top-level page.
98
- * @property {Record<string, number>} config - Output settings for catalog pages.
99
- * @property {string} pageUrl - Unique page Url.
100
- * @property {number} depth - Page nesting depth relative to parentId.
101
- * @property {Record<string, any>} localizeInfos - The name of the page, taking into account localization.
102
- * @property {boolean} isVisible - A sign of page visibility.
103
- * @property {number} products - The number of products linked to the page.
104
185
  * @property {string} attributeSetIdentifier - Set of attributes id.
186
+ * @property {AttributeType} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
187
+ * @property {number} [childrenCount] - Children count.
188
+ * @property {Record<string, number>} [config] - Output settings for catalog pages.
189
+ * @property {number} depth - Page nesting depth relative to parentId.
190
+ * @property {number} id - The identifier of the object.
105
191
  * @property {boolean} isSync - Indication of page indexing.
192
+ * @property {boolean} isVisible - A sign of page visibility.
193
+ * @property {Record<string, any>} [forms] -
194
+ * @property {Record<string, any>} [blocks] -
195
+ * @property {Record<string, any>} localizeInfos - The name of the page, taking into account localization.
196
+ * @property {string} pageUrl - Unique page Url.
197
+ * @property {number} parentId - The id of the parent page, if it contains null, then it is the top-level page.
198
+ * @property {number} [position] - Item number (for sorting).
199
+ * @property {number} [products] - The number of products linked to the page.
106
200
  * @property {string} templateIdentifier - User id of the linked template.
107
- * @property {AttributeType} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
108
- * @property {number} position - Item number (for sorting).
109
201
  * @property {Types} type - Page type.
110
- * @property {number} childrenCount - Children count.
202
+ * @property {any} [template] - Template object.
203
+ *
204
+ * @description This interface defines the structure of a page entity, including its identifiers, attributes, and hierarchical relationships.
111
205
  */
112
206
  interface IPagesEntity {
113
207
  attributeSetIdentifier: string | null;