oneentry 1.0.48 → 1.0.49

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 (34) hide show
  1. package/dist/admins/adminsApi.js +1 -1
  2. package/dist/admins/adminsInterfaces.d.ts +2 -3
  3. package/dist/attribute-sets/attributeSetsApi.js +1 -1
  4. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +3 -3
  5. package/dist/base/oneEntry.d.ts +2 -2
  6. package/dist/base/oneEntry.js +6 -6
  7. package/dist/base/utils.d.ts +1 -1
  8. package/dist/blocks/blocksApi.js +1 -1
  9. package/dist/blocks/blocksInterfaces.d.ts +2 -3
  10. package/dist/forms/formsApi.js +2 -2
  11. package/dist/forms/formsInterfaces.d.ts +4 -4
  12. package/dist/formsData/formsDataApi.js +2 -2
  13. package/dist/markers/markersApi.d.ts +8 -5
  14. package/dist/markers/markersApi.js +11 -8
  15. package/dist/markers/markersInterfaces.d.ts +5 -6
  16. package/dist/menus/menusApi.d.ts +2 -1
  17. package/dist/menus/menusApi.js +5 -4
  18. package/dist/menus/menusInterfaces.d.ts +4 -5
  19. package/dist/pages/pagesApi.js +9 -9
  20. package/dist/pages/pagesInterfaces.d.ts +11 -17
  21. package/dist/product-statuses/productStatusesApi.d.ts +6 -3
  22. package/dist/product-statuses/productStatusesApi.js +9 -6
  23. package/dist/product-statuses/productStatusesInterfaces.d.ts +5 -6
  24. package/dist/products/productsApi.d.ts +1 -1
  25. package/dist/products/productsApi.js +7 -7
  26. package/dist/products/productsInterfaces.d.ts +6 -19
  27. package/dist/products/productsInterfaces.js +0 -8
  28. package/dist/templates/templatesApi.d.ts +5 -3
  29. package/dist/templates/templatesApi.js +7 -5
  30. package/dist/templates/templatesInterfaces.d.ts +5 -5
  31. package/dist/templates-preview/templatesPreviewApi.d.ts +6 -3
  32. package/dist/templates-preview/templatesPreviewApi.js +9 -6
  33. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +5 -6
  34. 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._normalizeData(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,7 +34,7 @@ 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;
@@ -7,11 +7,11 @@ 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
17
  }
@@ -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,11 +132,11 @@ 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;
@@ -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;
@@ -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._normalizeData(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
  }
@@ -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._normalizeData(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._normalizeData(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,10 +26,10 @@ interface IForms {
26
26
  */
27
27
  interface IFormsEntity {
28
28
  attributeSetId: number | null;
29
- attributes: Array<IAttributes> | Object;
29
+ attributes: Array<IAttributes>;
30
30
  id: number;
31
31
  identifier: string;
32
- localizeInfos: LocalizeType;
32
+ localizeInfos: Record<string, any>;
33
33
  position: number;
34
34
  processingData: object | string;
35
35
  processingType: string;
@@ -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._normalizeData(result.items, langCode);
24
24
  }
25
25
  /**
26
26
  * Find all product page objects with pagination and multiple filtering.
@@ -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._normalizeData(result.items, langCode);
60
60
  }
61
61
  }
62
62
  exports.default = FormsDataApi;
@@ -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._normalizeData(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.
@@ -22,7 +21,7 @@ interface IMenusPages {
22
21
  children?: Array<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;
40
+ localizeInfos: Record<string, any>;
42
41
  pages: Array<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;
@@ -1,4 +1,4 @@
1
- import { AttributeType, IAttributes, LangType, LocalizeType, Types } from "../base/utils";
1
+ import { IAttributes, LangType, Types } from "../base/utils";
2
2
  /**
3
3
  * Represents an interface object of Pages Api.
4
4
  *
@@ -54,7 +54,7 @@ interface IPageConfig {
54
54
  * @property {Array<IAttributes>} attributes - Array of attribute values from the used attribute set for displaying the form (taking into account the specified language).
55
55
  * @property {number} attributeSetId - The identifier of the attribute set being used.
56
56
  * @property {string} processingType - Type of form processing.
57
- * @property {LocalizeType} localizeInfos - The name of the page, taking into account localization.
57
+ * @property {Record<string, any>} localizeInfos - The name of the page, taking into account localization.
58
58
  * @property {object} processingData - Form data.
59
59
  * @property {number} position - The position of the object.
60
60
  */
@@ -65,7 +65,7 @@ interface IPositionForm {
65
65
  attributes: Array<IAttributes>;
66
66
  attributeSetId: number;
67
67
  processingType: string;
68
- localizeInfos: LocalizeType;
68
+ localizeInfos: Record<string, any>;
69
69
  processingData: object;
70
70
  position: number;
71
71
  }
@@ -77,11 +77,11 @@ interface IPositionForm {
77
77
  * @property {number} version - The version number of the object.
78
78
  * @property {string} identifier - The textual identifier for the record field.
79
79
  * @property {number} attributeSetId - The identifier of the attribute set being used.
80
- * @property {LocalizeType} localizeInfos - The name of the page, taking into account localization.
80
+ * @property {Record<string, any>} localizeInfos - The name of the page, taking into account localization.
81
81
  * @property {object} customSettings - Custom settings for different types of blocks.
82
82
  * @property {number} position - The position of the object.
83
83
  * @property {boolean} isSync - Indication of page indexing.
84
- * @property {AttributeType} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
84
+ * @property {Record<string, any>} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
85
85
  * @property {Types} type - Page type.
86
86
  * @property {string} templateIdentifier - User id of the linked template.
87
87
  */
@@ -90,7 +90,7 @@ interface IPositionBlock {
90
90
  version: number;
91
91
  identifier: string;
92
92
  attributeSetId: number;
93
- localizeInfos: LocalizeType;
93
+ localizeInfos: Record<string, any>;
94
94
  customSettings: {
95
95
  sliderDelay: number;
96
96
  sliderDelayType: string;
@@ -107,7 +107,7 @@ interface IPositionBlock {
107
107
  };
108
108
  position: number;
109
109
  isSync: boolean;
110
- attributeValues: AttributeType;
110
+ attributeValues: Record<string, any>;
111
111
  type: string;
112
112
  templateIdentifier: string | null;
113
113
  }
@@ -120,26 +120,20 @@ interface IPositionBlock {
120
120
  * @property {Record<string, number>} config - Output settings for catalog pages.
121
121
  * @property {string} pageUrl - Unique page Url.
122
122
  * @property {number} depth - Page nesting depth relative to parentId.
123
- * @property {ILocalizeInfos} localizeInfos - The name of the page, taking into account localization.
123
+ * @property {Record<string, any>} localizeInfos - The name of the page, taking into account localization.
124
124
  * @property {boolean} isVisible - A sign of page visibility.
125
125
  * @property {number} products - The number of products linked to the page.
126
126
  * @property {number} attributeSetId - Set of attributes id.
127
127
  * @property {boolean} isSync - Indication of page indexing.
128
128
  * @property {string} templateIdentifier - User id of the linked template.
129
- * @property {AttributeType} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
129
+ * @property {Record<string, any>} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
130
130
  * @property {number} position - Item number (for sorting).
131
131
  * @property {Types} type - Page type.
132
132
  * @property {number} childrenCount - Children count.
133
133
  */
134
134
  interface IPagesEntity {
135
135
  attributeSetId: number;
136
- /**
137
- * Language-specific attribute values.
138
- * @example attributeValues['en_US']
139
- *
140
- * @property {langCode.<object>}
141
- */
142
- attributeValues: AttributeType;
136
+ attributeValues: Record<string, any>;
143
137
  childrenCount?: number;
144
138
  config?: Record<string, number>;
145
139
  depth: number;
@@ -148,7 +142,7 @@ interface IPagesEntity {
148
142
  isVisible: boolean;
149
143
  forms?: Record<string, any>;
150
144
  blocks?: Record<string, any>;
151
- localizeInfos: LocalizeType;
145
+ localizeInfos: Record<string, any>;
152
146
  pageUrl: string;
153
147
  parentId: number | null;
154
148
  position?: number;
@@ -8,26 +8,29 @@ export default class ProductStatusesApi extends OneEntry implements IProductStat
8
8
  constructor(url: string, config: IConfig);
9
9
  /**
10
10
  * Search for all product status objects.
11
+ * @param {string} [langCode] - Optional parameter language code
11
12
  *
12
13
  * @returns Returns an array of product status objects
13
14
  */
14
- getProductStatuses(): Promise<Array<IProductStatusEntity>>;
15
+ getProductStatuses(langCode?: string): Promise<Array<IProductStatusEntity>>;
15
16
  /**
16
17
  * Search for a product status object by identifier.
17
18
  *
18
19
  * @param {number} [id] - Status id
20
+ * @param {string} [langCode] - Optional parameter language code
19
21
  *
20
22
  * @returns Returns a product status object
21
23
  */
22
- getProductStatusesById(id: number): Promise<IProductStatusEntity>;
24
+ getProductStatusesById(id: number, langCode?: string): Promise<IProductStatusEntity>;
23
25
  /**
24
26
  * Search for a product status object by its textual identifier (marker).
25
27
  *
26
28
  * @param {string} [marker] - Product marker
29
+ * @param {string} [langCode] - Optional parameter language code
27
30
  *
28
31
  * @returns Returns a product status object
29
32
  */
30
- getProductsByStatusMarker(marker: string): Promise<IProductStatusEntity>;
33
+ getProductsByStatusMarker(marker: string, langCode?: string): Promise<IProductStatusEntity>;
31
34
  /**
32
35
  * Check the existence of a textual identifier.
33
36
  *
@@ -11,34 +11,37 @@ class ProductStatusesApi extends oneEntry_1.default {
11
11
  }
12
12
  /**
13
13
  * Search for all product status objects.
14
+ * @param {string} [langCode] - Optional parameter language code
14
15
  *
15
16
  * @returns Returns an array of product status objects
16
17
  */
17
- async getProductStatuses() {
18
+ async getProductStatuses(langCode = this._defaultLangCode) {
18
19
  const result = await this._fetchGet('');
19
- return this._normalizeData(result);
20
+ return this._normalizeData(result, langCode);
20
21
  }
21
22
  /**
22
23
  * Search for a product status object by identifier.
23
24
  *
24
25
  * @param {number} [id] - Status id
26
+ * @param {string} [langCode] - Optional parameter language code
25
27
  *
26
28
  * @returns Returns a product status object
27
29
  */
28
- async getProductStatusesById(id) {
30
+ async getProductStatusesById(id, langCode = this._defaultLangCode) {
29
31
  const result = await this._fetchGet(`/${id}`);
30
- return this._normalizeData(result);
32
+ return this._normalizeData(result, langCode);
31
33
  }
32
34
  /**
33
35
  * Search for a product status object by its textual identifier (marker).
34
36
  *
35
37
  * @param {string} [marker] - Product marker
38
+ * @param {string} [langCode] - Optional parameter language code
36
39
  *
37
40
  * @returns Returns a product status object
38
41
  */
39
- async getProductsByStatusMarker(marker) {
42
+ async getProductsByStatusMarker(marker, langCode = this._defaultLangCode) {
40
43
  const result = await this._fetchGet(`/marker/${marker}`);
41
- return this._normalizeData(result);
44
+ return this._normalizeData(result, langCode);
42
45
  }
43
46
  /**
44
47
  * Check the existence of a textual identifier.
@@ -1,4 +1,3 @@
1
- import { LocalizeType } from "../base/utils";
2
1
  /**
3
2
  * Represents an interface object of Product Statuses Api.
4
3
  *
@@ -11,9 +10,9 @@ import { LocalizeType } from "../base/utils";
11
10
  * @property {function} validateMarker - Check the existence of a textual identifier.
12
11
  */
13
12
  interface IProductStatuses {
14
- getProductStatuses(): Promise<Array<IProductStatusEntity>>;
15
- getProductStatusesById(id: number): Promise<IProductStatusEntity>;
16
- getProductsByStatusMarker(marker: string): Promise<IProductStatusEntity>;
13
+ getProductStatuses(langCode: string): Promise<Array<IProductStatusEntity>>;
14
+ getProductStatusesById(id: number, langCode: string): Promise<IProductStatusEntity>;
15
+ getProductsByStatusMarker(marker: string, langCode: string): Promise<IProductStatusEntity>;
17
16
  validateMarker(marker: string): Promise<boolean>;
18
17
  }
19
18
  /**
@@ -25,13 +24,13 @@ interface IProductStatuses {
25
24
  * @property {number} version - The version number of the object.
26
25
  * @property {string} identifier - The textual identifier for the record field.
27
26
  * @property {boolean} isLocked - Indicates whether the position is locked or not.
28
- * @property {ILocalizeInfos} localizeInfos - The name of the products statuses, taking into account localization.
27
+ * @property {Record<string, any>} localizeInfos - The name of the products statuses, taking into account localization.
29
28
  */
30
29
  interface IProductStatusEntity {
31
30
  id: number;
32
31
  updatedDate: string | Date;
33
32
  version: number;
34
33
  identifier: string;
35
- localizeInfos: LocalizeType;
34
+ localizeInfos: Record<string, any>;
36
35
  }
37
36
  export { IProductStatuses, IProductStatusEntity };
@@ -127,7 +127,7 @@ export default class ProductApi extends OneEntry implements IProductApi {
127
127
  *
128
128
  * @returns Array with ProductEntity objects
129
129
  */
130
- getRelatedProductsById(id: number, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsEntity>;
130
+ getRelatedProductsById(id: number, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
131
131
  /**
132
132
  * Retrieve one product object.
133
133
  *
@@ -45,7 +45,7 @@ class ProductApi extends oneEntry_1.default {
45
45
  async getProducts(langCode = this._defaultLangCode, userQuery) {
46
46
  const query = { ...this._defaultQuery, ...userQuery };
47
47
  const result = await this._fetchGet(`?langCode=${langCode}&` + this._queryParamsToString(query));
48
- return this._normalizeData(result.items);
48
+ return this._normalizeData(result.items, langCode);
49
49
  }
50
50
  /**
51
51
  * Search for all product page objects with pagination that do not have a category.
@@ -73,7 +73,7 @@ class ProductApi extends oneEntry_1.default {
73
73
  async getProductsEmptyPage(langCode = this._defaultLangCode, userQuery) {
74
74
  const query = { ...this._defaultQuery, ...userQuery };
75
75
  const result = await this._fetchGet(`/empty-page?langCode=${langCode}&` + this._queryParamsToString(query));
76
- return this._normalizeData(result.items);
76
+ return this._normalizeData(result.items, langCode);
77
77
  }
78
78
  /**
79
79
  * Search for all product page objects with pagination for the selected category.
@@ -104,7 +104,7 @@ class ProductApi extends oneEntry_1.default {
104
104
  async getProductsPageById(id, langCode = this._defaultLangCode, userQuery) {
105
105
  const query = { ...this._defaultQuery, ...userQuery };
106
106
  const result = await this._fetchGet(`/page/${id}?langCode=${langCode}&` + this._queryParamsToString(query));
107
- return this._normalizeData(result.items);
107
+ return this._normalizeData(result.items, langCode);
108
108
  }
109
109
  /**
110
110
  * Search for all product page objects with pagination for the selected category (by its URL).
@@ -135,7 +135,7 @@ class ProductApi extends oneEntry_1.default {
135
135
  async getProductsPageByUrl(url = this._defaultLangCode, langCode, userQuery) {
136
136
  const query = { ...this._defaultQuery, ...userQuery };
137
137
  const result = await this._fetchGet(`/page/url/${url}?langCode=${langCode}&` + this._queryParamsToString(query));
138
- return this._normalizeData(result.items);
138
+ return this._normalizeData(result.items, langCode);
139
139
  }
140
140
  /**
141
141
  * Find all related product page objects.
@@ -158,7 +158,7 @@ class ProductApi extends oneEntry_1.default {
158
158
  async getRelatedProductsById(id, langCode = this._defaultLangCode, userQuery) {
159
159
  const query = { ...this._defaultQuery, ...userQuery };
160
160
  const result = await this._fetchGet(`/${id}/related?langCode=${langCode}&` + this._queryParamsToString(query));
161
- return this._normalizeData(result.items);
161
+ return this._normalizeData(result.items, langCode);
162
162
  }
163
163
  /**
164
164
  * Retrieve one product object.
@@ -171,7 +171,7 @@ class ProductApi extends oneEntry_1.default {
171
171
  */
172
172
  async getProductById(id, langCode = this._defaultLangCode) {
173
173
  const result = await this._fetchGet(`/${id}?langCode=${langCode}`);
174
- return this._normalizeData(result);
174
+ return this._normalizeData(result, langCode);
175
175
  }
176
176
  /**
177
177
  * Find all product page objects with pagination and multiple filtering.
@@ -244,7 +244,7 @@ class ProductApi extends oneEntry_1.default {
244
244
  productsList.push(result);
245
245
  });
246
246
  }));
247
- return this._normalizeData(productsList);
247
+ return this._normalizeData(productsList, langCode);
248
248
  }
249
249
  }
250
250
  exports.default = ProductApi;
@@ -1,4 +1,4 @@
1
- import { AttributeType, LangType, LocalizeType } from "../base/utils";
1
+ import { LangType } from "../base/utils";
2
2
  /**
3
3
  * Represents an interface object of Products Api.
4
4
  *
@@ -23,18 +23,11 @@ interface IProductApi {
23
23
  getProductsEmptyPage(langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
24
24
  getProductsPageById(id: number, langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
25
25
  getProductsPageByUrl(url: string, langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
26
- getRelatedProductsById(id: number, langCode?: LangType, userQuery?: IProductsQuery): Promise<IProductsEntity>;
26
+ getRelatedProductsById(id: number, langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
27
27
  getProductById(id: number, langCode: LangType): Promise<IProductsEntity>;
28
28
  filterProduct(data: Array<IFilterParams>, langCode: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
29
29
  searchProduct(name: string, langCode: string): Promise<Array<IProductsEntity>>;
30
30
  }
31
- declare enum SortKey {
32
- id = "id",
33
- position = "position",
34
- title = "title",
35
- date = "date",
36
- price = "price"
37
- }
38
31
  /**
39
32
  * Represents a product query parameters object.
40
33
  *
@@ -67,7 +60,7 @@ interface IProductsQuery {
67
60
  conditionMarker?: 'in' | 'nin' | 'eq' | 'neq' | 'mth' | 'lth' | 'exs' | 'nexs' | null;
68
61
  attributeMarker?: string | null;
69
62
  sortOrder?: 'DESC' | 'ASC' | null;
70
- sortKey?: SortKey | null;
63
+ sortKey?: "id" | "position" | "title" | "date" | "price" | null;
71
64
  [key: string]: string | number | null;
72
65
  }
73
66
  /**
@@ -100,7 +93,7 @@ interface IFilterParams {
100
93
  *
101
94
  * @interface
102
95
  * @property {number} id - The unique identifier.
103
- * @property {ILocalizeInfos} localizeInfos - The name of the products, taking into account localization.
96
+ * @property {Record<string, any>} localizeInfos - The name of the products, taking into account localization.
104
97
  * @property {boolean} isVisible - A sign of page visibility.
105
98
  * @property {number | null} statusId - Product page status identifiers (may be null).
106
99
  * @property {Array<number>} relatedIds - Ids of related product pages.
@@ -113,7 +106,7 @@ interface IFilterParams {
113
106
  */
114
107
  interface IProductsEntity {
115
108
  id: number;
116
- localizeInfos: LocalizeType;
109
+ localizeInfos: Record<string, any>;
117
110
  isVisible: boolean;
118
111
  statusId: number | null;
119
112
  relatedIds: number[];
@@ -122,13 +115,7 @@ interface IProductsEntity {
122
115
  price: number;
123
116
  templateIdentifier: string | null;
124
117
  shortDescTemplateIdentifier: string;
125
- /**
126
- * Language-specific attribute values.
127
- * @example attributeValues['en_US']
128
- *
129
- * @property {langCode.<object>}
130
- */
131
- attributeValues: AttributeType;
118
+ attributeValues: Record<string, any>;
132
119
  position: number;
133
120
  productPages: Array<Object>;
134
121
  }
@@ -1,10 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var SortKey;
4
- (function (SortKey) {
5
- SortKey["id"] = "id";
6
- SortKey["position"] = "position";
7
- SortKey["title"] = "title";
8
- SortKey["date"] = "date";
9
- SortKey["price"] = "price";
10
- })(SortKey || (SortKey = {}));
@@ -8,16 +8,18 @@ export default class TemplatesPreviewApi extends OneEntry implements ITemplatesA
8
8
  constructor(url: string, config: IConfig);
9
9
  /**
10
10
  * Get all template objects grouped by types.
11
+ * @param {string} [langCode] - Optional parameter language code
11
12
  *
12
13
  * @returns Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
13
14
  */
14
- getAllTemplates(): Promise<Array<ITemplateEntity>>;
15
+ getAllTemplates(langCode?: string): Promise<Array<ITemplateEntity>>;
15
16
  /**
16
17
  * Get template objects by type.
17
18
  *
18
- * @param {Types} [type] - Product marker
19
+ * @param {Types} type - Product marker
20
+ * @param {string} [langCode] - Optional parameter language code
19
21
  *
20
22
  * @returns Returns a TemplateEntity object
21
23
  */
22
- getTemplateByType(type: Types): Promise<Array<ITemplateEntity>>;
24
+ getTemplateByType(type: Types, langCode?: string): Promise<Array<ITemplateEntity>>;
23
25
  }
@@ -11,23 +11,25 @@ class TemplatesPreviewApi extends oneEntry_1.default {
11
11
  }
12
12
  /**
13
13
  * Get all template objects grouped by types.
14
+ * @param {string} [langCode] - Optional parameter language code
14
15
  *
15
16
  * @returns Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
16
17
  */
17
- async getAllTemplates() {
18
+ async getAllTemplates(langCode = this._defaultLangCode) {
18
19
  const result = await this._fetchGet('/all');
19
- return this._normalizeData(result);
20
+ return this._normalizeData(result, langCode);
20
21
  }
21
22
  /**
22
23
  * Get template objects by type.
23
24
  *
24
- * @param {Types} [type] - Product marker
25
+ * @param {Types} type - Product marker
26
+ * @param {string} [langCode] - Optional parameter language code
25
27
  *
26
28
  * @returns Returns a TemplateEntity object
27
29
  */
28
- async getTemplateByType(type) {
30
+ async getTemplateByType(type, langCode = this._defaultLangCode) {
29
31
  const result = await this._fetchGet(`?type=${type}`);
30
- return this._normalizeData(result);
32
+ return this._normalizeData(result, langCode);
31
33
  }
32
34
  }
33
35
  exports.default = TemplatesPreviewApi;
@@ -1,5 +1,5 @@
1
1
  import { IGeneralTypesEntity } from "../general-types/generalTypesInterfaces";
2
- import { ILocalizeInfos, Types } from "../base/utils";
2
+ import { Types } from "../base/utils";
3
3
  /**
4
4
  * Represents an interface object of Templates Api.
5
5
  *
@@ -8,8 +8,8 @@ import { ILocalizeInfos, Types } from "../base/utils";
8
8
  * @property {function} getTemplateByType - Get template objects by type.
9
9
  */
10
10
  interface ITemplatesApi {
11
- getAllTemplates(): Promise<Array<ITemplateEntity>>;
12
- getTemplateByType(type: Types): Promise<Array<ITemplateEntity>>;
11
+ getAllTemplates(langCode: string): Promise<Array<ITemplateEntity>>;
12
+ getTemplateByType(type: Types, langCode: string): Promise<Array<ITemplateEntity>>;
13
13
  }
14
14
  /**
15
15
  * Represents a template entity object.
@@ -21,7 +21,7 @@ interface ITemplatesApi {
21
21
  * @property {string} identifier - The textual identifier for the record field.
22
22
  * @property {IGeneralTypesEntity} generalType - General type Entity object.
23
23
  * @property {number} generalTypeId - General type Entity id.
24
- * @property {ILocalizeInfos} localizeInfos - The name of the template, taking into account localization.
24
+ * @property {Record<string, any>} localizeInfos - The name of the template, taking into account localization.
25
25
  * @property {number} position - The position of the object.
26
26
  * @property {number | string} positionId - Id of the item object.
27
27
  * @property {Types} generalTypeName - General type name.
@@ -34,7 +34,7 @@ interface ITemplateEntity {
34
34
  identifier: string;
35
35
  generalType?: IGeneralTypesEntity;
36
36
  generalTypeId: number;
37
- localizeInfos: ILocalizeInfos;
37
+ localizeInfos: Record<string, any>;
38
38
  position: number;
39
39
  positionId?: number;
40
40
  generalTypeName: Types;
@@ -8,24 +8,27 @@ export default class TemplatePreviewsApi extends OneEntry implements ITemplatesP
8
8
  constructor(url: string, config: IConfig);
9
9
  /**
10
10
  * Get all template objects.
11
+ * @param {string} [langCode] - Optional parameter language code
11
12
  *
12
13
  * @returns Returns all TemplatePreviewsEntity template objects
13
14
  */
14
- getTemplatePreviews(): Promise<Array<ITemplatesPreviewEntity>>;
15
+ getTemplatePreviews(langCode?: string): Promise<Array<ITemplatesPreviewEntity>>;
15
16
  /**
16
17
  * Get one template object by id.
17
18
  *
18
19
  * @param {number} [id] - Product marker
20
+ * @param {string} [langCode] - Optional parameter language code
19
21
  *
20
22
  * @returns Returns a TemplatePreviewsEntity object
21
23
  */
22
- getTemplatePreviewById(id: number): Promise<ITemplatesPreviewEntity>;
24
+ getTemplatePreviewById(id: number, langCode?: string): Promise<ITemplatesPreviewEntity>;
23
25
  /**
24
26
  * Get one template object by marker.
25
27
  *
26
28
  * @param {string} [marker] - Product marker
29
+ * @param {string} [langCode] - Optional parameter language code
27
30
  *
28
31
  * @returns Returns a TemplatePreviewsEntity object
29
32
  */
30
- getTemplatePreviewByMarker(marker: string): Promise<ITemplatesPreviewEntity>;
33
+ getTemplatePreviewByMarker(marker: string, langCode?: string): Promise<ITemplatesPreviewEntity>;
31
34
  }
@@ -11,34 +11,37 @@ class TemplatePreviewsApi extends oneEntry_1.default {
11
11
  }
12
12
  /**
13
13
  * Get all template objects.
14
+ * @param {string} [langCode] - Optional parameter language code
14
15
  *
15
16
  * @returns Returns all TemplatePreviewsEntity template objects
16
17
  */
17
- async getTemplatePreviews() {
18
+ async getTemplatePreviews(langCode = this._defaultLangCode) {
18
19
  const result = await this._fetchGet('');
19
- return this._normalizeData(result);
20
+ return this._normalizeData(result, langCode);
20
21
  }
21
22
  /**
22
23
  * Get one template object by id.
23
24
  *
24
25
  * @param {number} [id] - Product marker
26
+ * @param {string} [langCode] - Optional parameter language code
25
27
  *
26
28
  * @returns Returns a TemplatePreviewsEntity object
27
29
  */
28
- async getTemplatePreviewById(id) {
30
+ async getTemplatePreviewById(id, langCode = this._defaultLangCode) {
29
31
  const result = await this._fetchGet(`/${id}`);
30
- return this._normalizeData(result);
32
+ return this._normalizeData(result, langCode);
31
33
  }
32
34
  /**
33
35
  * Get one template object by marker.
34
36
  *
35
37
  * @param {string} [marker] - Product marker
38
+ * @param {string} [langCode] - Optional parameter language code
36
39
  *
37
40
  * @returns Returns a TemplatePreviewsEntity object
38
41
  */
39
- async getTemplatePreviewByMarker(marker) {
42
+ async getTemplatePreviewByMarker(marker, langCode = this._defaultLangCode) {
40
43
  const result = await this._fetchGet(`/marker/${marker}`);
41
- return this._normalizeData(result);
44
+ return this._normalizeData(result, langCode);
42
45
  }
43
46
  }
44
47
  exports.default = TemplatePreviewsApi;
@@ -1,4 +1,3 @@
1
- import { ILocalizeInfos } from "../base/utils";
2
1
  /**
3
2
  * Represents an interface object of Templates Preview Api.
4
3
  *
@@ -9,9 +8,9 @@ import { ILocalizeInfos } from "../base/utils";
9
8
  * @property {function} getTemplatesPreviewByMarker - Get one template object by marker.
10
9
  */
11
10
  interface ITemplatesPreview {
12
- getTemplatePreviews(): Promise<Array<ITemplatesPreviewEntity>>;
13
- getTemplatePreviewById(id: number): Promise<ITemplatesPreviewEntity>;
14
- getTemplatePreviewByMarker(marker: string): Promise<ITemplatesPreviewEntity>;
11
+ getTemplatePreviews(langCode: string): Promise<Array<ITemplatesPreviewEntity>>;
12
+ getTemplatePreviewById(id: number, langCode: string): Promise<ITemplatesPreviewEntity>;
13
+ getTemplatePreviewByMarker(marker: string, langCode: string): Promise<ITemplatesPreviewEntity>;
15
14
  }
16
15
  /**
17
16
  * Represents a template preview entity object.
@@ -21,7 +20,7 @@ interface ITemplatesPreview {
21
20
  * @property {Date | string} updatedDate - The date of last updated.
22
21
  * @property {string} identifier - The textual identifier for the record field.
23
22
  * @property {object} proportion - Object contains info by proportion template preview.
24
- * @property {ILocalizeInfos} localizeInfos - The name of the template, taking into account localization.
23
+ * @property {Record<string, any>} localizeInfos - The name of the template, taking into account localization.
25
24
  * @property {number} position - The position of the object.
26
25
  *
27
26
  */
@@ -35,7 +34,7 @@ interface ITemplatesPreviewEntity {
35
34
  vertical: IProportion | null;
36
35
  square: ISquare;
37
36
  };
38
- localizeInfos: ILocalizeInfos;
37
+ localizeInfos: Record<string, any>;
39
38
  position: number;
40
39
  }
41
40
  interface IProportion {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.48",
3
+ "version": "1.0.49",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",