oneentry 1.0.48 → 1.0.50

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 (36) hide show
  1. package/README.md +397 -397
  2. package/dist/admins/adminsApi.js +1 -1
  3. package/dist/admins/adminsInterfaces.d.ts +2 -3
  4. package/dist/attribute-sets/attributeSetsApi.js +1 -1
  5. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +4 -4
  6. package/dist/base/oneEntry.d.ts +4 -2
  7. package/dist/base/oneEntry.js +31 -6
  8. package/dist/base/utils.d.ts +2 -2
  9. package/dist/blocks/blocksApi.js +1 -1
  10. package/dist/blocks/blocksInterfaces.d.ts +3 -4
  11. package/dist/forms/formsApi.js +2 -2
  12. package/dist/forms/formsInterfaces.d.ts +5 -5
  13. package/dist/formsData/formsDataApi.js +3 -3
  14. package/dist/formsData/formsDataInterfaces.d.ts +4 -1
  15. package/dist/markers/markersApi.d.ts +8 -5
  16. package/dist/markers/markersApi.js +11 -8
  17. package/dist/markers/markersInterfaces.d.ts +5 -6
  18. package/dist/menus/menusApi.d.ts +2 -1
  19. package/dist/menus/menusApi.js +5 -4
  20. package/dist/menus/menusInterfaces.d.ts +6 -7
  21. package/dist/pages/pagesApi.js +9 -9
  22. package/dist/pages/pagesInterfaces.d.ts +13 -19
  23. package/dist/product-statuses/productStatusesApi.d.ts +6 -3
  24. package/dist/product-statuses/productStatusesApi.js +9 -6
  25. package/dist/product-statuses/productStatusesInterfaces.d.ts +5 -6
  26. package/dist/products/productsApi.d.ts +2 -2
  27. package/dist/products/productsApi.js +8 -8
  28. package/dist/products/productsInterfaces.d.ts +7 -20
  29. package/dist/products/productsInterfaces.js +0 -8
  30. package/dist/templates/templatesApi.d.ts +5 -3
  31. package/dist/templates/templatesApi.js +7 -5
  32. package/dist/templates/templatesInterfaces.d.ts +5 -5
  33. package/dist/templates-preview/templatesPreviewApi.d.ts +6 -3
  34. package/dist/templates-preview/templatesPreviewApi.js +9 -6
  35. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +5 -6
  36. package/package.json +1 -1
@@ -20,7 +20,7 @@ class AdminsApi extends oneEntry_1.default {
20
20
  */
21
21
  async getAdminsInfo(langCode = this._defaultLangCode, offset = 0, limit = 30) {
22
22
  const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
23
- return this._normalizeData(result);
23
+ return this._normalizeData(result, langCode);
24
24
  }
25
25
  }
26
26
  exports.default = AdminsApi;
@@ -1,4 +1,3 @@
1
- import { AttributeType } from "../base/utils";
2
1
  /**
3
2
  * Represents a interface object of Admins Api.
4
3
  *
@@ -32,14 +31,14 @@ interface IPosition {
32
31
  * @interface
33
32
  * @property {number} id - The identifier of the object.
34
33
  * @property {string} identifier - The textual identifier for the record field.
35
- * @property {AttributeType} attributeValues - The attributes with values used by the object.
34
+ * @property {Record<string, any>} attributeValues - The attributes with values used by the object.
36
35
  * @property {number} attributeSetId - The identifier of the attribute set being used.
37
36
  * @property {boolean} isSync - Indication of page indexing.
38
37
  * @property {number} position - The position of the object.
39
38
  */
40
39
  interface IAdminEntity {
41
40
  attributeSetId: number | null;
42
- attributeValues: AttributeType;
41
+ attributeValues: Record<string, any>;
43
42
  id: number;
44
43
  identifier: string;
45
44
  isSync: boolean;
@@ -19,7 +19,7 @@ class AttributesSetsApi extends oneEntry_1.default {
19
19
  */
20
20
  async getAttributesByMarker(marker, langCode = this._defaultLangCode) {
21
21
  const result = await this._fetchGet(`/${marker}/attributes?langCode=${langCode}`);
22
- return this._normalizeData(result);
22
+ return this._dataPostProcess(result, langCode);
23
23
  }
24
24
  /**
25
25
  * Get a single attribute with data from the attribute sets.
@@ -1,4 +1,4 @@
1
- import { ILocalizeInfos, Types } from "../base/utils";
1
+ import { Types } from "../base/utils";
2
2
  /**
3
3
  * Represents an interface object of AttributesSets Api.
4
4
  *
@@ -18,7 +18,7 @@ interface IAttributesSets {
18
18
  * @property {string} marker - Textual identifier of the attribute (marker).
19
19
  * @property {number} position - Position number for sorting.
20
20
  * @property {Record<string, any>} validators - Set of validators for validation.
21
- * @property {ILocalizeInfos} localizeInfos - The name of the template, taking into account localization.
21
+ * @property {Record<string, any>} localizeInfos - The name of the template, taking into account localization.
22
22
  * @property {Array<Record<string, any>>} listTitles - Array of values (with extended data) for list and radioButton attributes.
23
23
  *
24
24
  */
@@ -34,13 +34,13 @@ interface IAttributesSetsEntity {
34
34
  fieldDefaultValue: number;
35
35
  };
36
36
  };
37
- localizeInfos: ILocalizeInfos;
37
+ localizeInfos: Record<string, any>;
38
38
  listTitles: Array<{
39
39
  title: string;
40
40
  value: number | string;
41
41
  position: string | number | null;
42
42
  extendedValue: string | number | null;
43
43
  extendedValueType: string | number | null;
44
- }>;
44
+ }> | Record<string, any>;
45
45
  }
46
46
  export { IAttributesSets, IAttributesSetsEntity };
@@ -7,11 +7,13 @@ export default abstract class OneEntry {
7
7
  protected _defaultLangCode: string;
8
8
  protected _NO_FETCH: boolean;
9
9
  protected _https: any;
10
- constructor(url: string, config: IConfig);
10
+ constructor(url: string, config?: IConfig);
11
11
  protected _getFullPath(path: string): string;
12
12
  protected _fetchGet(path: string): Promise<any>;
13
13
  protected _fetchPost(path: string, data: any): Promise<any>;
14
14
  protected _fetchDelete(path: string): Promise<any>;
15
15
  protected _queryParamsToString(query: IProductsQuery | IUploadingQuery): string;
16
- protected _normalizeData(data: any): any;
16
+ protected _normalizeData(data: any, langCode?: string): any;
17
+ protected _clearArray(data: Record<string, any>): any;
18
+ protected _dataPostProcess(data: any, langCode?: string): any;
17
19
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class OneEntry {
4
- constructor(url, config) {
4
+ constructor(url, config = {}) {
5
5
  this._url = url;
6
6
  this._token = config.token;
7
7
  this._defaultLangCode = config.langCode ? config.langCode : 'en_US';
@@ -122,9 +122,9 @@ class OneEntry {
122
122
  }
123
123
  return result.slice(0, (result.length - 1));
124
124
  }
125
- _normalizeData(data) {
125
+ _normalizeData(data, langCode = this._defaultLangCode) {
126
126
  if (Array.isArray(data)) {
127
- return data.map(item => this._normalizeData(item));
127
+ return data.map(item => this._normalizeData(item, langCode));
128
128
  }
129
129
  else {
130
130
  const normalizeData = {};
@@ -132,15 +132,40 @@ class OneEntry {
132
132
  if (Array.isArray(data[key]) || !data[key] || typeof data[key] !== 'object') {
133
133
  normalizeData[key] = data[key];
134
134
  }
135
- else if (data[key][this._defaultLangCode]) {
136
- normalizeData[key] = data[key][this._defaultLangCode];
135
+ else if (langCode in data[key]) {
136
+ normalizeData[key] = data[key][langCode];
137
137
  }
138
138
  else {
139
- normalizeData[key] = this._normalizeData(data[key]);
139
+ normalizeData[key] = this._normalizeData(data[key], langCode);
140
140
  }
141
141
  }
142
142
  return normalizeData;
143
143
  }
144
144
  }
145
+ _clearArray(data) {
146
+ if (Array.isArray(data)) {
147
+ return data.map(item => this._clearArray(item));
148
+ }
149
+ else {
150
+ const dataWithoutArray = {};
151
+ for (let key in data) {
152
+ if (Array.isArray(data[key]) && data[key].length === 1) {
153
+ dataWithoutArray[key] = data[key][0];
154
+ }
155
+ else if (typeof data[key] === 'object' && data[key] && !Array.isArray(data[key])) {
156
+ dataWithoutArray[key] = this._clearArray(data[key]);
157
+ }
158
+ else {
159
+ dataWithoutArray[key] = data[key];
160
+ }
161
+ }
162
+ return dataWithoutArray;
163
+ }
164
+ }
165
+ _dataPostProcess(data, langCode = this._defaultLangCode) {
166
+ const normalize = this._normalizeData(data, langCode);
167
+ const result = this._clearArray(normalize);
168
+ return result;
169
+ }
145
170
  }
146
171
  exports.default = OneEntry;
@@ -35,7 +35,7 @@ interface IAttributes {
35
35
  marker: string;
36
36
  position: number;
37
37
  type: string;
38
- validators: object;
38
+ validators: Record<string, any>;
39
39
  }
40
40
  interface ILocalizeInfos {
41
41
  [key: string]: ILocalizeInfo;
@@ -57,7 +57,7 @@ interface IAttributeSetEntity {
57
57
  identifier: string;
58
58
  typeId: number;
59
59
  localizeInfos: LocalizeType;
60
- schema: object;
60
+ schema: Record<string, any>;
61
61
  position: {
62
62
  id: number;
63
63
  objectId: number;
@@ -32,7 +32,7 @@ class BlocksApi extends oneEntry_1.default {
32
32
  */
33
33
  async getBlockByMarker(marker, langCode = this._defaultLangCode) {
34
34
  const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
35
- return this._normalizeData(result);
35
+ return this._dataPostProcess(result, langCode);
36
36
  }
37
37
  }
38
38
  exports.default = BlocksApi;
@@ -1,4 +1,3 @@
1
- import { IAttributeValues, LocalizeType } from "../base/utils";
2
1
  /**
3
2
  * Represents a interface object of Blocks Api.
4
3
  *
@@ -11,13 +10,13 @@ interface IBlocks {
11
10
  interface IBlocksEntity {
12
11
  id: number;
13
12
  attributeSetId: number | null;
14
- localizeInfos: LocalizeType;
13
+ localizeInfos: Record<string, any>;
15
14
  customSettings: ICustomSetting | null;
16
15
  version: number;
17
16
  identifier: string;
18
17
  isVisible: boolean;
19
18
  position: number;
20
- attributeValues: IAttributeValues;
19
+ attributeValues: Record<string, any>;
21
20
  type: string;
22
21
  templateIdentifier: string | null;
23
22
  }
@@ -33,6 +32,6 @@ interface ICustomSetting {
33
32
  includes: string;
34
33
  keywords: string;
35
34
  strict: string;
36
- }>;
35
+ }> | Record<string, any>;
37
36
  }
38
37
  export { IBlocks, IBlocksEntity };
@@ -20,7 +20,7 @@ class FormsApi extends oneEntry_1.default {
20
20
  */
21
21
  async getAllForms(langCode = this._defaultLangCode, offset = 0, limit = 30) {
22
22
  const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
23
- return this._normalizeData(result);
23
+ return this._dataPostProcess(result, langCode);
24
24
  }
25
25
  /**
26
26
  * Get one form by form marker.
@@ -32,7 +32,7 @@ class FormsApi extends oneEntry_1.default {
32
32
  */
33
33
  async getFormByMarker(marker, langCode = this._defaultLangCode) {
34
34
  const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
35
- return this._normalizeData(result);
35
+ return this._dataPostProcess(result, langCode);
36
36
  }
37
37
  }
38
38
  exports.default = FormsApi;
@@ -1,4 +1,4 @@
1
- import { IAttributes, LocalizeType } from "../base/utils";
1
+ import { IAttributes } from "../base/utils";
2
2
  /**
3
3
  * Represents an interface object of Forms Api.
4
4
  *
@@ -17,7 +17,7 @@ interface IForms {
17
17
  * @property {number} id - The identifier of the object.
18
18
  * @property {number} attributeSetId - The identifier of the attribute set being used.
19
19
  * @property {string} processingType - Type of form processing.
20
- * @property {ILocalizeInfos} localizeInfos - The name of the form, taking into account localization.
20
+ * @property {Record<string, any>} localizeInfos - The name of the form, taking into account localization.
21
21
  * @property {object} processingData - Form data.
22
22
  * @property {Array<IAttributes>} attribute - Array of attribute values from the used attribute set for displaying the form (taking into account the specified language)
23
23
  * @property {number} version - The version number of the object.
@@ -26,12 +26,12 @@ interface IForms {
26
26
  */
27
27
  interface IFormsEntity {
28
28
  attributeSetId: number | null;
29
- attributes: Array<IAttributes> | Object;
29
+ attributes: Array<IAttributes> | Record<string, any>;
30
30
  id: number;
31
31
  identifier: string;
32
- localizeInfos: LocalizeType;
32
+ localizeInfos: Record<string, any>;
33
33
  position: number;
34
- processingData: object | string;
34
+ processingData: Record<string, any> | string;
35
35
  processingType: string;
36
36
  version: number;
37
37
  }
@@ -20,7 +20,7 @@ class FormsDataApi extends oneEntry_1.default {
20
20
  */
21
21
  async getFormsData(langCode = this._defaultLangCode, offset = 0, limit = 30) {
22
22
  const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
23
- return this._normalizeData(result.items);
23
+ return this._dataPostProcess(result.items, langCode);
24
24
  }
25
25
  /**
26
26
  * Find all product page objects with pagination and multiple filtering.
@@ -42,7 +42,7 @@ class FormsDataApi extends oneEntry_1.default {
42
42
  */
43
43
  async postFormsData(data) {
44
44
  const result = await this._fetchPost('', JSON.stringify(data));
45
- return this._normalizeData(result);
45
+ return this._dataPostProcess(result);
46
46
  }
47
47
  /**
48
48
  * Get one object of form data by marker.
@@ -56,7 +56,7 @@ class FormsDataApi extends oneEntry_1.default {
56
56
  */
57
57
  async getFormsDataByMarker(marker, langCode = this._defaultLangCode, offset = 0, limit = 30) {
58
58
  const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}&offset=${offset}&limit=${limit}`);
59
- return this._normalizeData(result.items);
59
+ return this._dataPostProcess(result.items, langCode);
60
60
  }
61
61
  }
62
62
  exports.default = FormsDataApi;
@@ -47,7 +47,10 @@ interface IFormData {
47
47
  [langcode: string]: Array<{
48
48
  marker?: string;
49
49
  value?: string;
50
- }>;
50
+ }> | {
51
+ marker?: string;
52
+ value?: string;
53
+ };
51
54
  }
52
55
  /**
53
56
  * interface to create an object of information about saving data using the form
@@ -9,26 +9,29 @@ export default class MarkersApi extends OneEntry implements IMarkersApi {
9
9
  /**
10
10
  * Get all markers.
11
11
  *
12
+ * @param {string} [langCode] - Optional parameter language code
12
13
  * @param {number} [limit] - Optional parameter for pagination, default is 0
13
14
  * @param {number} [offset] - Optional parameter for pagination, default is 30
14
15
  *
15
16
  * @returns Returns an array of MarkerEntity objects.
16
17
  */
17
- getMarkers(offset?: number, limit?: number): Promise<Array<IMarkersEntity>>;
18
+ getMarkers(langCode?: string, offset?: number, limit?: number): Promise<Array<IMarkersEntity>>;
18
19
  /**
19
20
  * Get marker by id.
20
21
  *
21
- * @param {number} [id] - Marker id.
22
+ * @param {number} id - Marker id.
23
+ * @param {string} [langCode] - Optional parameter language code
22
24
  *
23
25
  * @returns Return BlocksEntity object.
24
26
  */
25
- getMarkerById(id: number): Promise<IMarkersEntity>;
27
+ getMarkerById(id: number, langCode?: string): Promise<IMarkersEntity>;
26
28
  /**
27
29
  * Get marker by marker.
28
30
  *
29
- * @param {string} [marker] - Marker of marker.
31
+ * @param {string} marker - Marker of marker.
32
+ * @param {string} [langCode] - Optional parameter language code
30
33
  *
31
34
  * @returns Returns a single MarkerEntity marker object.
32
35
  */
33
- getMarkerByMarker(marker: string): Promise<IMarkersEntity>;
36
+ getMarkerByMarker(marker: string, langCode?: string): Promise<IMarkersEntity>;
34
37
  }
@@ -12,36 +12,39 @@ class MarkersApi extends oneEntry_1.default {
12
12
  /**
13
13
  * Get all markers.
14
14
  *
15
+ * @param {string} [langCode] - Optional parameter language code
15
16
  * @param {number} [limit] - Optional parameter for pagination, default is 0
16
17
  * @param {number} [offset] - Optional parameter for pagination, default is 30
17
18
  *
18
19
  * @returns Returns an array of MarkerEntity objects.
19
20
  */
20
- async getMarkers(offset = 0, limit = 30) {
21
+ async getMarkers(langCode = this._defaultLangCode, offset = 0, limit = 30) {
21
22
  const result = await this._fetchGet(`?offset=${offset}&limit=${limit}`);
22
- return this._normalizeData(result.items);
23
+ return this._normalizeData(result.items, langCode);
23
24
  }
24
25
  /**
25
26
  * Get marker by id.
26
27
  *
27
- * @param {number} [id] - Marker id.
28
+ * @param {number} id - Marker id.
29
+ * @param {string} [langCode] - Optional parameter language code
28
30
  *
29
31
  * @returns Return BlocksEntity object.
30
32
  */
31
- async getMarkerById(id) {
33
+ async getMarkerById(id, langCode = this._defaultLangCode) {
32
34
  const result = await this._fetchGet(`/${id}`);
33
- return this._normalizeData(result);
35
+ return this._normalizeData(result, langCode);
34
36
  }
35
37
  /**
36
38
  * Get marker by marker.
37
39
  *
38
- * @param {string} [marker] - Marker of marker.
40
+ * @param {string} marker - Marker of marker.
41
+ * @param {string} [langCode] - Optional parameter language code
39
42
  *
40
43
  * @returns Returns a single MarkerEntity marker object.
41
44
  */
42
- async getMarkerByMarker(marker) {
45
+ async getMarkerByMarker(marker, langCode = this._defaultLangCode) {
43
46
  const result = await this._fetchGet(`/marker/${marker}`);
44
- return this._normalizeData(result);
47
+ return this._normalizeData(result, langCode);
45
48
  }
46
49
  }
47
50
  exports.default = MarkersApi;
@@ -1,4 +1,3 @@
1
- import { ILocalizeInfos } from "../base/utils";
2
1
  /**
3
2
  * Represents an interface object of Markers Api.
4
3
  *
@@ -9,9 +8,9 @@ import { ILocalizeInfos } from "../base/utils";
9
8
  * @property {function} getMarkerByMarker - Get marker by id.
10
9
  */
11
10
  interface IMarkersApi {
12
- getMarkers(offset: number, limit: number): Promise<Array<IMarkersEntity>>;
13
- getMarkerById(id: number): Promise<IMarkersEntity>;
14
- getMarkerByMarker(marker: string): Promise<IMarkersEntity>;
11
+ getMarkers(langCode: string, offset: number, limit: number): Promise<Array<IMarkersEntity>>;
12
+ getMarkerById(id: number, langCode: string): Promise<IMarkersEntity>;
13
+ getMarkerByMarker(marker: string, langCode: string): Promise<IMarkersEntity>;
15
14
  }
16
15
  /**
17
16
  * Represents a template entity object.
@@ -23,7 +22,7 @@ interface IMarkersApi {
23
22
  * @property {string} identifier - The textual identifier for the record field.
24
23
  * @property {string} name - Name of marker.
25
24
  * @property {string} marker - Marker of marker.
26
- * @property {ILocalizeInfos} localizeInfos - The name of the template, taking into account localization.
25
+ * @property {Record<string, any>} localizeInfos - The name of the template, taking into account localization.
27
26
  *
28
27
  */
29
28
  interface IMarkersEntity {
@@ -33,6 +32,6 @@ interface IMarkersEntity {
33
32
  identifier: string;
34
33
  name: string;
35
34
  marker: string;
36
- localizeInfos: ILocalizeInfos;
35
+ localizeInfos: Record<string, any>;
37
36
  }
38
37
  export { IMarkersApi, IMarkersEntity };
@@ -10,8 +10,9 @@ export default class MenusApi extends OneEntry implements IMenus {
10
10
  * Get pages includes in menu by marker.
11
11
  *
12
12
  * @param {string} [marker] - Menu marker
13
+ * @param {string} [langCode] - Language code
13
14
  *
14
15
  * @returns Returns a single menu object as a ContentMenu object with included pages
15
16
  */
16
- getMenusByMarker(marker: string): Promise<IMenusEntity>;
17
+ getMenusByMarker(marker: string, langCode?: string): Promise<IMenusEntity>;
17
18
  }
@@ -13,14 +13,15 @@ class MenusApi extends oneEntry_1.default {
13
13
  * Get pages includes in menu by marker.
14
14
  *
15
15
  * @param {string} [marker] - Menu marker
16
+ * @param {string} [langCode] - Language code
16
17
  *
17
18
  * @returns Returns a single menu object as a ContentMenu object with included pages
18
19
  */
19
- async getMenusByMarker(marker) {
20
+ async getMenusByMarker(marker, langCode = this._defaultLangCode) {
20
21
  const result = await this._fetchGet(`/marker/${marker}`);
21
22
  let pages = result.pages;
22
23
  pages = pages.map(page => {
23
- page = this._normalizeData(page);
24
+ page = this._normalizeData(page, langCode);
24
25
  for (const key in page.localizeInfos) {
25
26
  if (key !== 'menuTitle') {
26
27
  delete page.localizeInfos[key];
@@ -28,13 +29,13 @@ class MenusApi extends oneEntry_1.default {
28
29
  }
29
30
  const children = pages.filter(child => child.parentId === page.id);
30
31
  if (children.length) {
31
- const normalizeChildren = children.map(child => this._normalizeData(child));
32
+ const normalizeChildren = children.map(child => this._normalizeData(child, langCode));
32
33
  page.children = normalizeChildren;
33
34
  }
34
35
  return page;
35
36
  });
36
37
  result.pages = pages;
37
- return this._normalizeData(result);
38
+ return this._dataPostProcess(result, langCode);
38
39
  }
39
40
  }
40
41
  exports.default = MenusApi;
@@ -1,11 +1,10 @@
1
- import { ILocalizeInfo } from "../base/utils";
2
1
  /**
3
2
  * Represents an interface object of Menus Api.
4
3
  *
5
4
  * @property {function} getAdminsInfo - Get pages includes in menu by marker.
6
5
  */
7
6
  interface IMenus {
8
- getMenusByMarker(marker: string): Promise<IMenusEntity>;
7
+ getMenusByMarker(marker: string, langCode: string): Promise<IMenusEntity>;
9
8
  }
10
9
  /**
11
10
  * Represents a position object.
@@ -19,10 +18,10 @@ interface IMenus {
19
18
  * @property {number | null} parentId - The menu parent id.
20
19
  */
21
20
  interface IMenusPages {
22
- children?: Array<IMenusPages>;
21
+ children?: Array<IMenusPages> | IMenusPages;
23
22
  id: number;
24
23
  pageUrl: string;
25
- localizeInfos: ILocalizeInfo;
24
+ localizeInfos: Record<string, any>;
26
25
  position: number;
27
26
  parentId: number | null;
28
27
  }
@@ -32,13 +31,13 @@ interface IMenusPages {
32
31
  * @interface
33
32
  * @property {number} id - The unique identifier of the menu.
34
33
  * @property {string} identifier - The menu identifier.
35
- * @property {ILocalizeInfos} localizeInfos - The menu data, taking into account localization.
34
+ * @property {Record<string, any>} localizeInfos - The menu data, taking into account localization.
36
35
  * @property {Array<IMenusPages>} pages - Array of menu pages.
37
36
  */
38
37
  interface IMenusEntity {
39
38
  id: number;
40
39
  identifier: string;
41
- localizeInfos: ILocalizeInfo;
42
- pages: Array<IMenusPages>;
40
+ localizeInfos: Record<string, any>;
41
+ pages: Array<IMenusPages> | IMenusPages;
43
42
  }
44
43
  export { IMenus, IMenusEntity };
@@ -18,7 +18,7 @@ class PageApi extends oneEntry_1.default {
18
18
  */
19
19
  async getRootPages(langCode = this._defaultLangCode) {
20
20
  const result = await this._fetchGet(`/root?langCode=${langCode}`);
21
- return this._normalizeData(result.items);
21
+ return this._normalizeData(result.items, langCode);
22
22
  }
23
23
  /**
24
24
  * Get all page objects with product information as an array.
@@ -33,7 +33,7 @@ class PageApi extends oneEntry_1.default {
33
33
  */
34
34
  async getCatalogPages(langCode = this._defaultLangCode, limit = 30, offset = 0) {
35
35
  const result = await this._fetchGet(`/catalog?langCode=${langCode}&limit=${limit}&offset=${offset}`);
36
- return this._normalizeData(result.items);
36
+ return this._normalizeData(result.items, langCode);
37
37
  }
38
38
  /**
39
39
  * Get all page objects with product information as an array.
@@ -44,7 +44,7 @@ class PageApi extends oneEntry_1.default {
44
44
  */
45
45
  async getPages(langCode = this._defaultLangCode) {
46
46
  const result = await this._fetchGet(`?langCode=${langCode}`);
47
- return this._normalizeData(result);
47
+ return this._normalizeData(result, langCode);
48
48
  }
49
49
  /**
50
50
  * Get page object with information about forms, blocks, menus, linked to the page.
@@ -57,7 +57,7 @@ class PageApi extends oneEntry_1.default {
57
57
  */
58
58
  async getPageById(id, langCode = this._defaultLangCode) {
59
59
  const result = await this._fetchGet(`/${id}?langCode=${langCode}`);
60
- return this._normalizeData(result);
60
+ return this._normalizeData(result, langCode);
61
61
  }
62
62
  /**
63
63
  * Get page object with information about forms, blocks, menus, linked to the page by URL.
@@ -70,7 +70,7 @@ class PageApi extends oneEntry_1.default {
70
70
  */
71
71
  async getPageByUrl(url, langCode = this._defaultLangCode) {
72
72
  const result = await this._fetchGet(`/url/${url}?langCode=${langCode}`);
73
- return this._normalizeData(result);
73
+ return this._normalizeData(result, langCode);
74
74
  }
75
75
  /**
76
76
  * Get child pages object with information as an array.
@@ -83,7 +83,7 @@ class PageApi extends oneEntry_1.default {
83
83
  */
84
84
  async getChildPagesByParentUrl(url, langCode = this._defaultLangCode) {
85
85
  const result = await this._fetchGet(`/${url}/children?langCode=${langCode}`);
86
- return this._normalizeData(result.items);
86
+ return this._normalizeData(result.items, langCode);
87
87
  }
88
88
  /**
89
89
  * Get all forms by page url.
@@ -96,7 +96,7 @@ class PageApi extends oneEntry_1.default {
96
96
  */
97
97
  async getFormsByPageUrl(url, langCode = this._defaultLangCode) {
98
98
  const result = await this._fetchGet(`/${url}/forms?langCode=${langCode}`);
99
- return this._normalizeData(result);
99
+ return this._normalizeData(result, langCode);
100
100
  }
101
101
  /**
102
102
  * Get all blocks by page url.
@@ -109,7 +109,7 @@ class PageApi extends oneEntry_1.default {
109
109
  */
110
110
  async getBlocksByPageUrl(url, langCode = this._defaultLangCode) {
111
111
  const result = await this._fetchGet(`/${url}/blocks?langCode=${langCode}`);
112
- return this._normalizeData(result);
112
+ return this._normalizeData(result, langCode);
113
113
  }
114
114
  /**
115
115
  * Get settings for the page.
@@ -133,7 +133,7 @@ class PageApi extends oneEntry_1.default {
133
133
  */
134
134
  async searchPage(name, langCode = this._defaultLangCode) {
135
135
  const result = await this._fetchGet(`/quick/search?lang=${langCode}&name=${name}`);
136
- return this._normalizeData(result);
136
+ return this._normalizeData(result, langCode);
137
137
  }
138
138
  }
139
139
  exports.default = PageApi;