oneentry 1.0.19 → 1.0.21

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.
@@ -1,9 +1,14 @@
1
1
  import { IProductsQuery } from '../products/productsInterfaces';
2
+ import { LangType } from "./utils";
2
3
  export default abstract class OneEntry {
3
4
  protected _url: string;
5
+ protected _LANGCODE_KEY: string;
4
6
  constructor(url: string);
5
7
  protected _getFullPath(path: string): string;
6
8
  protected _fetchGet(path: string): Promise<any>;
7
9
  protected _fetchPost(path: string, data: object): Promise<any>;
8
10
  protected _queryParamsToString(query: IProductsQuery): string;
11
+ protected _parseLangFromString(str: string, lang: string): string;
12
+ protected _fetchRequests(url: string, lang: LangType): Promise<any>;
13
+ protected _normalizeData(data: any): any;
9
14
  }
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  class OneEntry {
13
13
  constructor(url) {
14
+ this._LANGCODE_KEY = '$LANGCODE';
14
15
  this._url = url;
15
16
  }
16
17
  _getFullPath(path) {
@@ -50,6 +51,63 @@ class OneEntry {
50
51
  }
51
52
  return result.slice(0, (result.length - 1));
52
53
  }
54
+ _parseLangFromString(str, lang) {
55
+ const index = str.indexOf(this._LANGCODE_KEY);
56
+ if (index === -1) {
57
+ console.error('The endpoint does not contain a language template $LANGCODE');
58
+ }
59
+ else {
60
+ return str.slice(0, index) + lang + str.slice(index + this._LANGCODE_KEY.length);
61
+ }
62
+ }
63
+ _fetchRequests(url, lang) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ const langCode = (typeof lang === 'string') ? [lang] : lang;
66
+ if (langCode.length === 1) {
67
+ const response = yield this._fetchGet(this._parseLangFromString(url, langCode[0]));
68
+ if (response.hasOwnProperty('items') || Array.isArray(response)) {
69
+ let result = Array.isArray(response) ? response : response.items;
70
+ result = result.map(item => this._normalizeData(item));
71
+ return result;
72
+ }
73
+ return this._normalizeData(response);
74
+ }
75
+ else {
76
+ const dataList = [];
77
+ yield Promise.all(langCode.map((lang) => __awaiter(this, void 0, void 0, function* () {
78
+ yield this._fetchGet(this._parseLangFromString(url, lang)).then((result) => {
79
+ result.hasOwnProperty('items') ? dataList.push(result.items) : dataList.push(result);
80
+ });
81
+ })));
82
+ const baseData = dataList.splice(0, 1)[0];
83
+ dataList.map(item => {
84
+ if (Array.isArray(item)) {
85
+ item.map((subitem, index) => {
86
+ Object.assign(baseData[index].attributeValues, subitem.attributeValues);
87
+ Object.assign(baseData[index].localizeInfos, subitem.localizeInfos);
88
+ });
89
+ }
90
+ else {
91
+ Object.assign(baseData.attributeValues, item.attributeValues);
92
+ Object.assign(baseData.localizeInfos, item.localizeInfos);
93
+ }
94
+ });
95
+ return baseData;
96
+ }
97
+ });
98
+ }
99
+ _normalizeData(data) {
100
+ const normalizeData = Object.assign({}, data);
101
+ if (data.hasOwnProperty('attributeValues')) {
102
+ const key = Object.keys(data.attributeValues);
103
+ normalizeData.attributeValues = data.attributeValues[key[0]];
104
+ }
105
+ if (data.hasOwnProperty('localizeInfos')) {
106
+ const key = Object.keys(data.localizeInfos);
107
+ normalizeData.localizeInfos = data.localizeInfos[key[0]];
108
+ }
109
+ return normalizeData;
110
+ }
53
111
  }
54
112
  exports.default = OneEntry;
55
113
  //# sourceMappingURL=oneEntry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"oneEntry.js","sourceRoot":"","sources":["../../src/base/oneEntry.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,MAA8B,QAAQ;IAGlC,YAAY,GAAU;QAClB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAA;IACnB,CAAC;IAES,YAAY,CAAC,IAAW;QAC9B,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;IAC7B,CAAC;IAEe,SAAS,CAAC,IAAW;;YACjC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,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,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE;YACxC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;YAC7C,aAAa,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;SAC/D;QACD,IAAI,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE;YACtC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;YAC3C,aAAa,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;SAC3D;QACD,OAAO,aAAa,CAAA;IACxB,CAAC;CACJ;AAnHD,2BAmHC"}
@@ -29,4 +29,22 @@ interface ILocalizeInfos {
29
29
  [key: string]: string;
30
30
  };
31
31
  }
32
- export { LanguageCode, ILocalizeInfos, Types, };
32
+ interface IAttributeSetEntity {
33
+ id: number;
34
+ updatedDate: string;
35
+ version: number;
36
+ identifier: string;
37
+ typeId: number;
38
+ localizeInfos: ILocalizeInfos;
39
+ schema: object;
40
+ position: {
41
+ id: number;
42
+ objectId: number;
43
+ objectType: string;
44
+ position: number | string;
45
+ };
46
+ positionId: number | string;
47
+ isVisible: boolean;
48
+ }
49
+ type LangType = string | Array<string>;
50
+ export { LanguageCode, ILocalizeInfos, Types, IAttributeSetEntity, LangType };
@@ -1,5 +1,5 @@
1
1
  import { ILocalizeInfos } from "../base/utils";
2
- import { IAttributeSet } from "../attribute-set/attributeSetInterfaces";
2
+ import { IAttributeSetEntity } from "../base/utils";
3
3
  /**
4
4
  * Represents an interface object of Forms Api.
5
5
  *
@@ -31,7 +31,7 @@ interface IFormsEntity {
31
31
  processingType: string;
32
32
  localizeInfos: ILocalizeInfos;
33
33
  processingData: object | string;
34
- attributesValues: IAttributeSet;
34
+ attributesValues: IAttributeSetEntity;
35
35
  version: number;
36
36
  identifier: string;
37
37
  position: number;
package/dist/index.d.ts CHANGED
@@ -12,15 +12,15 @@ import FormsDataApi from "./formsData/formsDataApi";
12
12
  interface IDefineApi {
13
13
  Admins: AdminsApi;
14
14
  Forms: FormsApi;
15
- FormsData: FormsDataApi;
15
+ FormData: FormsDataApi;
16
16
  GeneralTypes: GeneralTypesApi;
17
17
  Locales: LocalesApi;
18
18
  Menus: MenusApi;
19
- Page: PageApi;
20
- Product: ProductApi;
21
- ProductStatus: ProductStatusesApi;
19
+ Pages: PageApi;
20
+ Products: ProductApi;
21
+ ProductStatuses: ProductStatusesApi;
22
22
  Templates: TemplatesApi;
23
- TemplatesPreview: TemplatesPreviewApi;
23
+ TemplatePreviews: TemplatesPreviewApi;
24
24
  }
25
25
  /**
26
26
  * Define API.
package/dist/index.js CHANGED
@@ -18,29 +18,29 @@ const formsDataApi_1 = require("./formsData/formsDataApi");
18
18
  * @returns {IDefineApi} - List of methods set.
19
19
  */
20
20
  function defineOneEntry(url) {
21
- const Product = new productsApi_1.default(url);
22
- const Page = new pagesApi_1.default(url);
23
- const ProductStatus = new productStatusesApi_1.default(url);
24
- const Templates = new templatesApi_1.default(url);
25
- const TemplatesPreview = new templatesPreviewApi_1.default(url);
26
21
  const Admins = new adminsApi_1.default(url);
22
+ const Forms = new formsApi_1.default(url);
23
+ const FormData = new formsDataApi_1.default(url);
27
24
  const GeneralTypes = new GeneralTypesApi_1.default(url);
28
25
  const Locales = new localesApi_1.default(url);
29
26
  const Menus = new menusApi_1.default(url);
30
- const Forms = new formsApi_1.default(url);
31
- const FormsData = new formsDataApi_1.default(url);
27
+ const Pages = new pagesApi_1.default(url);
28
+ const Products = new productsApi_1.default(url);
29
+ const ProductStatuses = new productStatusesApi_1.default(url);
30
+ const Templates = new templatesApi_1.default(url);
31
+ const TemplatePreviews = new templatesPreviewApi_1.default(url);
32
32
  return {
33
33
  Admins,
34
34
  Forms,
35
- FormsData,
35
+ FormData,
36
36
  GeneralTypes,
37
37
  Locales,
38
38
  Menus,
39
- Page,
40
- Product,
41
- ProductStatus,
39
+ Pages,
40
+ Products,
41
+ ProductStatuses,
42
42
  Templates,
43
- TemplatesPreview
43
+ TemplatePreviews
44
44
  };
45
45
  }
46
46
  exports.defineOneEntry = defineOneEntry;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wDAA+C;AAC/C,+CAAuC;AACvC,8EAAuE;AACvE,2DAAoD;AACpD,iFAA0E;AAC1E,kDAA0C;AAC1C,qEAA6D;AAC7D,qDAA6C;AAC7C,+CAAwC;AACxC,+CAAwC;AACxC,2DAAoD;AAgBpD;;;;GAIG;AACH,SAAgB,cAAc,CAAC,GAAU;IACrC,MAAM,OAAO,GAAc,IAAI,qBAAU,CAAC,GAAG,CAAC,CAAA;IAC9C,MAAM,IAAI,GAAW,IAAI,kBAAO,CAAC,GAAG,CAAC,CAAA;IACrC,MAAM,aAAa,GAAsB,IAAI,4BAAkB,CAAC,GAAG,CAAC,CAAA;IACpE,MAAM,SAAS,GAAiB,IAAI,sBAAY,CAAC,GAAG,CAAC,CAAA;IACrD,MAAM,gBAAgB,GAAwB,IAAI,6BAAmB,CAAC,GAAG,CAAC,CAAA;IAC1E,MAAM,MAAM,GAAc,IAAI,mBAAS,CAAC,GAAG,CAAC,CAAA;IAC5C,MAAM,YAAY,GAAqB,IAAI,yBAAe,CAAC,GAAG,CAAC,CAAA;IAC/D,MAAM,OAAO,GAAe,IAAI,oBAAU,CAAC,GAAG,CAAC,CAAA;IAC/C,MAAM,KAAK,GAAa,IAAI,kBAAQ,CAAC,GAAG,CAAC,CAAA;IACzC,MAAM,KAAK,GAAa,IAAI,kBAAQ,CAAC,GAAG,CAAC,CAAA;IACzC,MAAM,SAAS,GAAiB,IAAI,sBAAY,CAAC,GAAG,CAAC,CAAA;IAErD,OAAO;QACH,MAAM;QACN,KAAK;QACL,SAAS;QACT,YAAY;QACZ,O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AAA;AACL,CAAC;AA1BD,wCA0BC"}
@@ -1,5 +1,6 @@
1
1
  import OneEntry from "../base/oneEntry";
2
2
  import { IPageApi, IPageConfig, IPagesEntity, IPositionForm } from "./pagesInterfaces";
3
+ import { LangType } from "../base/utils";
3
4
  /**
4
5
  * Controllers for working with page objects, including catalog pages
5
6
  */
@@ -8,15 +9,15 @@ export default class PageApi extends OneEntry implements IPageApi {
8
9
  /**
9
10
  * Get all top-level page objects.
10
11
  *
11
- * @param {string} [langCode] Required parameter lang code
12
+ * @param {string | Array<string>} [langCode] Required parameter lang code
12
13
  *
13
14
  * @returns Returns all created pages without parents as an array of ContentIndexedPageDto objects or an empty array [] (if there is no data)
14
15
  */
15
- getRootPages(langCode: string): Promise<Array<IPagesEntity>>;
16
+ getRootPages(langCode: LangType): Promise<Array<IPagesEntity>>;
16
17
  /**
17
18
  * Get all page objects with product information as an array.
18
19
  *
19
- * @param {string} [langCode] Required parameter lang code
20
+ * @param {string | Array<string>} [langCode] Required parameter lang code
20
21
  *
21
22
  * @param {number} [limit] - Optional parameter for pagination, default is 30
22
23
  *
@@ -24,55 +25,55 @@ export default class PageApi extends OneEntry implements IPageApi {
24
25
  *
25
26
  * @returns Returns all created pages as an array of ContentIndexedPageDto objects or an empty array [] (if there is no data)
26
27
  */
27
- getCatalogPages(langCode: string, limit?: number, offset?: number): Promise<Array<IPagesEntity>>;
28
+ getCatalogPages(langCode: LangType, limit?: number, offset?: number): Promise<Array<IPagesEntity>>;
28
29
  /**
29
30
  * Get all page objects with product information as an array.
30
31
  *
31
- * @param {string} [langCode] Required parameter lang code
32
+ * @param {string | Array<string>} [langCode] Required parameter lang code
32
33
  *
33
34
  * @returns Returns all created pages as an array of ContentIndexedPageDto objects or an empty array [] (if there is no data)
34
35
  */
35
- getPages(langCode: string): Promise<Array<IPagesEntity>>;
36
+ getPages(langCode: LangType): Promise<Array<IPagesEntity>>;
36
37
  /**
37
38
  * Get page object with information about forms, blocks, menus, linked to the page.
38
39
  *
39
- * @param {string} [langCode] Required parameter lang code
40
+ * @param {string | Array<string>} [langCode] Required parameter lang code
40
41
  *
41
42
  * @param {number} [id] - Page object identifier
42
43
  *
43
44
  * @returns Returns page object (DTO depends on the type of page being returned)
44
45
  */
45
- getPageById(id: number, langCode: string): Promise<IPagesEntity>;
46
+ getPageById(id: number, langCode: LangType): Promise<IPagesEntity>;
46
47
  /**
47
48
  * Get page object with information about forms, blocks, menus, linked to the page by URL.
48
49
  *
49
- * @param {string} [langCode] Required parameter lang code
50
+ * @param {string | Array<string>} [langCode] Required parameter lang code
50
51
  *
51
52
  * @param {string} [url] - Page URL
52
53
  *
53
54
  * @returns Returns page object (DTO depends on the type of page being returned)
54
55
  */
55
- getPageByUrl(url: string, langCode: string): Promise<IPagesEntity>;
56
+ getPageByUrl(url: string, langCode: LangType): Promise<IPagesEntity>;
56
57
  /**
57
58
  * Get child pages object with information as an array.
58
59
  *
59
- * @param {string} [langCode] Required parameter lang code
60
+ * @param {string | Array<string>} [langCode] Required parameter lang code
60
61
  *
61
62
  * @param {string} [url] - Page URL
62
63
  *
63
64
  * @returns Returns all created pages as an array of ContentIndexedPageDto objects or an empty array [] (if there is no data) for the selected parent
64
65
  */
65
- getChildPagesByParentUrl(url: string, langCode: string): Promise<IPagesEntity>;
66
+ getChildPagesByParentUrl(url: string, langCode: LangType): Promise<IPagesEntity>;
66
67
  /**
67
68
  * Get all forms by page url.
68
69
  *
69
- * @param {string} [langCode] Required parameter lang code
70
+ * @param {string | Array<string>} [langCode] Required parameter lang code
70
71
  *
71
72
  * @param {string} [url] - Page URL
72
73
  *
73
74
  * @returns Returns all forms as an array of PositionFormDto objects or an empty array [] (if there is no data) for the selected parent
74
75
  */
75
- getFormsByPageUrl(url: string, langCode: string): Promise<Array<IPositionForm>>;
76
+ getFormsByPageUrl(url: string, langCode: LangType): Promise<Array<IPositionForm>>;
76
77
  /**
77
78
  * Get settings for the page.
78
79
  *
@@ -21,20 +21,20 @@ class PageApi extends oneEntry_1.default {
21
21
  /**
22
22
  * Get all top-level page objects.
23
23
  *
24
- * @param {string} [langCode] Required parameter lang code
24
+ * @param {string | Array<string>} [langCode] Required parameter lang code
25
25
  *
26
26
  * @returns Returns all created pages without parents as an array of ContentIndexedPageDto objects or an empty array [] (if there is no data)
27
27
  */
28
28
  getRootPages(langCode) {
29
29
  return __awaiter(this, void 0, void 0, function* () {
30
- const result = yield this._fetchGet(`/root?langCode=${langCode}`);
30
+ const result = yield this._fetchRequests(`/root?langCode=${this._LANGCODE_KEY}`, langCode);
31
31
  return result;
32
32
  });
33
33
  }
34
34
  /**
35
35
  * Get all page objects with product information as an array.
36
36
  *
37
- * @param {string} [langCode] Required parameter lang code
37
+ * @param {string | Array<string>} [langCode] Required parameter lang code
38
38
  *
39
39
  * @param {number} [limit] - Optional parameter for pagination, default is 30
40
40
  *
@@ -44,27 +44,27 @@ class PageApi extends oneEntry_1.default {
44
44
  */
45
45
  getCatalogPages(langCode, limit = 30, offset = 0) {
46
46
  return __awaiter(this, void 0, void 0, function* () {
47
- const result = yield this._fetchGet(`/catalog?langCode=${langCode}&limit=${limit}&offset=${offset}`);
47
+ const result = yield this._fetchRequests(`/catalog?langCode=${this._LANGCODE_KEY}&limit=${limit}&offset=${offset}`, langCode);
48
48
  return result;
49
49
  });
50
50
  }
51
51
  /**
52
52
  * Get all page objects with product information as an array.
53
53
  *
54
- * @param {string} [langCode] Required parameter lang code
54
+ * @param {string | Array<string>} [langCode] Required parameter lang code
55
55
  *
56
56
  * @returns Returns all created pages as an array of ContentIndexedPageDto objects or an empty array [] (if there is no data)
57
57
  */
58
58
  getPages(langCode) {
59
59
  return __awaiter(this, void 0, void 0, function* () {
60
- const result = yield this._fetchGet(`?langCode=${langCode}`);
60
+ const result = yield this._fetchRequests(`?langCode=${this._LANGCODE_KEY}`, langCode);
61
61
  return result;
62
62
  });
63
63
  }
64
64
  /**
65
65
  * Get page object with information about forms, blocks, menus, linked to the page.
66
66
  *
67
- * @param {string} [langCode] Required parameter lang code
67
+ * @param {string | Array<string>} [langCode] Required parameter lang code
68
68
  *
69
69
  * @param {number} [id] - Page object identifier
70
70
  *
@@ -72,14 +72,14 @@ class PageApi extends oneEntry_1.default {
72
72
  */
73
73
  getPageById(id, langCode) {
74
74
  return __awaiter(this, void 0, void 0, function* () {
75
- const result = yield this._fetchGet(`/${id}?langCode=${langCode}`);
75
+ const result = yield this._fetchRequests(`?langCode=${this._LANGCODE_KEY}`, langCode);
76
76
  return result;
77
77
  });
78
78
  }
79
79
  /**
80
80
  * Get page object with information about forms, blocks, menus, linked to the page by URL.
81
81
  *
82
- * @param {string} [langCode] Required parameter lang code
82
+ * @param {string | Array<string>} [langCode] Required parameter lang code
83
83
  *
84
84
  * @param {string} [url] - Page URL
85
85
  *
@@ -87,14 +87,14 @@ class PageApi extends oneEntry_1.default {
87
87
  */
88
88
  getPageByUrl(url, langCode) {
89
89
  return __awaiter(this, void 0, void 0, function* () {
90
- const result = yield this._fetchGet(`/url/${url}?langCode=${langCode}`);
90
+ const result = yield this._fetchRequests(`/url/${url}?langCode=${this._LANGCODE_KEY}`, langCode);
91
91
  return result;
92
92
  });
93
93
  }
94
94
  /**
95
95
  * Get child pages object with information as an array.
96
96
  *
97
- * @param {string} [langCode] Required parameter lang code
97
+ * @param {string | Array<string>} [langCode] Required parameter lang code
98
98
  *
99
99
  * @param {string} [url] - Page URL
100
100
  *
@@ -102,14 +102,14 @@ class PageApi extends oneEntry_1.default {
102
102
  */
103
103
  getChildPagesByParentUrl(url, langCode) {
104
104
  return __awaiter(this, void 0, void 0, function* () {
105
- const result = yield this._fetchGet(`/${url}/children?langCode=${langCode}`);
105
+ const result = yield this._fetchRequests(`/${url}/children?langCode=${this._LANGCODE_KEY}`, langCode);
106
106
  return result;
107
107
  });
108
108
  }
109
109
  /**
110
110
  * Get all forms by page url.
111
111
  *
112
- * @param {string} [langCode] Required parameter lang code
112
+ * @param {string | Array<string>} [langCode] Required parameter lang code
113
113
  *
114
114
  * @param {string} [url] - Page URL
115
115
  *
@@ -117,7 +117,7 @@ class PageApi extends oneEntry_1.default {
117
117
  */
118
118
  getFormsByPageUrl(url, langCode) {
119
119
  return __awaiter(this, void 0, void 0, function* () {
120
- const result = yield this._fetchGet(`/${url}/forms?langCode=${langCode}`);
120
+ const result = yield this._fetchRequests(`/${url}/forms?langCode=${this._LANGCODE_KEY}`, langCode);
121
121
  return result;
122
122
  });
123
123
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pagesApi.js","sourceRoot":"","sources":["../../src/pages/pagesApi.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+CAAwC;AAGxC;;GAEG;AACH,MAAqB,OAAQ,SAAQ,kBAAQ;IACzC,YAAY,GAAW;QACnB,KAAK,CAAC,GAAG,CAAC,CAAA;QACV,IAAI,CAAC,IAAI,IAAI,oBAAoB,CAAA;IACrC,CAAC;IAED;;;;;;OAMG;IACU,YAAY,CAAC,QAAe;;YACrC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,kBAAkB,QAAQ,EAAE,CAAC,CAAA;YACjE,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAED;;;;;;;;;;OAUG;IACU,eAAe,CAAC,QAAe,EAAE,QAAe,EAAE,EAAE,SAAgB,CAAC;;YAC9E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,qBAAqB,QAAQ,UAAU,KAAK,WAAW,MAAM,EAAE,CAAC,CAAA;YACpG,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAED;;;;;;OAMG;IACU,QAAQ,CAAC,QAAe;;YACjC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAA;YAC5D,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAED;;;;;;;;OAQG;IACU,WAAW,CAAC,EAAS,EAAE,QAAe;;YAC/C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE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AAiB;;YAC/D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,GAAG,sBAAsB,IAAI,CAAC,aAAa,EAAE,EAAC,QAAQ,CAAC,CAAA;YAEpG,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAED;;;;;;;;OAQG;IACU,iBAAiB,CAAC,GAAU,EAAE,QAAiB;;YACxD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,GAAG,mBAAmB,IAAI,CAAC,aAAa,EAAE,EAAC,QAAQ,CAAC,CAAA;YAEjG,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAED;;;;;;OAMG;IACU,kBAAkB,CAAC,GAAU;;YACtC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,CAAA;YACrD,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAED;;;;;;;;OAQG;IACU,UAAU,CAAC,IAAW,EAAE,QAAe;;YAChD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,sBAAsB,QAAQ,SAAS,IAAI,EAAE,CAAC,CAAA;YAClF,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;CAEJ;AAtID,0BAsIC"}
@@ -1,5 +1,5 @@
1
- import { ILocalizeInfos, Types } from "../base/utils";
2
- import { IAttributeSet } from "../attribute-set/attributeSetInterfaces";
1
+ import { ILocalizeInfos, LangType, Types } from "../base/utils";
2
+ import { IAttributeSetEntity } from "../base/utils";
3
3
  import { IFormsEntity } from "../forms/formsInterfaces";
4
4
  /**
5
5
  * Represents an interface object of Pages Api.
@@ -23,15 +23,15 @@ import { IFormsEntity } from "../forms/formsInterfaces";
23
23
  * @property {function} searchPage - Quick search for page objects with limited output.
24
24
  */
25
25
  interface IPageApi {
26
- getRootPages(langCode: string): Promise<Array<IPagesEntity>>;
27
- getCatalogPages(langCode: string, limit: number, offset: number): Promise<Array<IPagesEntity>>;
28
- getPages(langCode: string): Promise<Array<IPagesEntity>>;
29
- getPageById(id: number, langCode: string): Promise<IPagesEntity>;
30
- getPageByUrl(url: string, langCode: string): Promise<IPagesEntity>;
31
- getChildPagesByParentUrl(url: string, langCode: string): Promise<IPagesEntity>;
32
- getFormsByPageUrl(url: string, langCode: string): Promise<Array<IPositionForm>>;
26
+ getRootPages(langCode?: LangType): Promise<Array<IPagesEntity>>;
27
+ getCatalogPages(langCode: LangType, limit: number, offset: number): Promise<Array<IPagesEntity>>;
28
+ getPages(langCode: LangType): Promise<Array<IPagesEntity>>;
29
+ getPageById(id: number, langCode: LangType): Promise<IPagesEntity>;
30
+ getPageByUrl(url: string, langCode: LangType): Promise<IPagesEntity>;
31
+ getChildPagesByParentUrl(url: string, langCode: LangType): Promise<IPagesEntity>;
32
+ getFormsByPageUrl(url: string, langCode: LangType): Promise<Array<IPositionForm>>;
33
33
  getConfigPageByUrl(url: string): Promise<IPageConfig>;
34
- searchPage(name: string, langCode: string): Promise<Array<IPagesEntity>>;
34
+ searchPage(name: string, langCode: LangType): Promise<Array<IPagesEntity>>;
35
35
  }
36
36
  /**
37
37
  * Represents a config object.
@@ -66,7 +66,7 @@ interface IPositionForm {
66
66
  updatedDate: Date | string;
67
67
  version: number;
68
68
  identifier: string;
69
- attributesSets: IAttributeSet;
69
+ attributesSets: IAttributeSetEntity;
70
70
  attributeSetId: number;
71
71
  processingType: string;
72
72
  localizeInfos: ILocalizeInfos;
@@ -1,5 +1,6 @@
1
1
  import { IProductsQuery, IFilterParams, IProductApi, IProductsEntity } from './productsInterfaces';
2
2
  import OneEntry from '../base/oneEntry';
3
+ import { LangType } from "../base/utils";
3
4
  /**
4
5
  * Controllers for working with product pages
5
6
  */
@@ -9,6 +10,7 @@ export default class ProductApi extends OneEntry implements IProductApi {
9
10
  /**
10
11
  * Search for all product page objects with pagination and filtering.
11
12
  *
13
+ * @param {string | Array<string>} [langCode] - Language code parameter. Default "en_US"
12
14
  * @param {IProductsQuery} [userQuery] - Optional set query parameters.
13
15
  * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
14
16
  *
@@ -30,10 +32,11 @@ export default class ProductApi extends OneEntry implements IProductApi {
30
32
  *
31
33
  * @returns {Promise<IProductsEntity[]>} - List of products.
32
34
  */
33
- getProducts(userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
35
+ getProducts(langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
34
36
  /**
35
37
  * Search for all product page objects with pagination that do not have a category.
36
38
  *
39
+ * @param {string | Array<string>} [langCode] - Language code parameter. Default "en_US"
37
40
  * @param {IProductsQuery} [userQuery] - Optional set query parameters.
38
41
  * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
39
42
  *
@@ -47,20 +50,20 @@ export default class ProductApi extends OneEntry implements IProductApi {
47
50
  *
48
51
  * @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
49
52
  *
50
- * @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
51
- *
52
53
  * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
53
54
  *
54
55
  * @param {string} [userQuery.sortKey] - Optional field to sort by
55
56
  *
56
57
  * @returns {Promise<IProductsEntity[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
57
58
  */
58
- getProductsEmptyPage(userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
59
+ getProductsEmptyPage(langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
59
60
  /**
60
61
  * Search for all product page objects with pagination for the selected category.
61
62
  *
62
63
  * @param {number} [id] - Page identifier.
63
64
  *
65
+ * @param {string | Array<string>} [langCode] - Language code parameter. Default "en_US"
66
+ *
64
67
  * @param {IProductsQuery} [userQuery] - Optional set query parameters.
65
68
  * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
66
69
  *
@@ -74,20 +77,20 @@ export default class ProductApi extends OneEntry implements IProductApi {
74
77
  *
75
78
  * @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
76
79
  *
77
- * @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
78
- *
79
80
  * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
80
81
  *
81
82
  * @param {string} [userQuery.sortKey] - Optional field to sort by
82
83
  *
83
84
  * @returns {Promise<IProductsEntity[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
84
85
  */
85
- getProductsPageById(id: number, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
86
+ getProductsPageById(id: number, langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
86
87
  /**
87
88
  * Search for all product page objects with pagination for the selected category (by its URL).
88
89
  *
89
90
  * @param {string} [url] - URL of the category page.
90
91
  *
92
+ * @param {string | Array<string>} [langCode] - Language code parameter. Default "en_US"
93
+ *
91
94
  * @param {IProductsQuery} [userQuery] - Optional set query parameters.
92
95
  * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
93
96
  *
@@ -103,18 +106,18 @@ export default class ProductApi extends OneEntry implements IProductApi {
103
106
  *
104
107
  * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
105
108
  *
106
- * @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
107
- *
108
109
  * @param {string} [userQuery.sortKey] - Optional field to sort by
109
110
  *
110
111
  * @returns {Promise<IProductsEntity[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
111
112
  */
112
- getProductsPageByUrl(url: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
113
+ getProductsPageByUrl(url: string, langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
113
114
  /**
114
115
  * Find all related product page objects.
115
116
  *
116
117
  * @param {number} [id] - Product page identifier for which to find relationship.
117
118
  *
119
+ * @param {string | Array<string>} [langCode] - Language code parameter. Default "en_US"
120
+ *
118
121
  * @param {IProductsQuery} [userQuery] - Optional set query parameters.
119
122
  * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
120
123
  *
@@ -122,13 +125,11 @@ export default class ProductApi extends OneEntry implements IProductApi {
122
125
  *
123
126
  * @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
124
127
  *
125
- * @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
126
- *
127
128
  * @param {string} [userQuery.sortKey] - Optional field to sort by
128
129
  *
129
130
  * @returns {Promise<IProductsEntity[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
130
131
  */
131
- getRelatedProductsById(id: number, userQuery?: IProductsQuery): Promise<IProductsEntity>;
132
+ getRelatedProductsById(id: number, langCode?: LangType, userQuery?: IProductsQuery): Promise<IProductsEntity>;
132
133
  /**
133
134
  * Retrieve one product object.
134
135
  *
@@ -138,7 +139,7 @@ export default class ProductApi extends OneEntry implements IProductApi {
138
139
  *
139
140
  * @returns {Promise<IProductsEntity>} - Returns ContentIndexedProductDto object for the product.
140
141
  */
141
- getProductById(id: number, langCode?: string | Array<string>): Promise<IProductsEntity>;
142
+ getProductById(id: number, langCode?: LangType): Promise<IProductsEntity>;
142
143
  /**
143
144
  * Find all product page objects with pagination and multiple filtering.
144
145
  *
@@ -183,5 +184,4 @@ export default class ProductApi extends OneEntry implements IProductApi {
183
184
  * @returns {Promise<IProductsEntity[]>} - Returns array of ContentIndexedProductDto object for the product.
184
185
  */
185
186
  searchProduct(name: string, langCode?: string): Promise<Array<IProductsEntity>>;
186
- private _normalizeProductData;
187
187
  }