oneentry 1.0.10 → 1.0.13
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.
- package/README.md +91 -215
- package/dist/_cjs/admins/adminsApi.d.ts +14 -0
- package/dist/_cjs/admins/adminsApi.js +34 -0
- package/dist/_cjs/admins/adminsApi.js.map +1 -0
- package/dist/_cjs/admins/adminsInterfaces.d.ts +32 -0
- package/dist/_cjs/admins/adminsInterfaces.js +3 -0
- package/dist/_cjs/admins/adminsInterfaces.js.map +1 -0
- package/dist/_cjs/attribute-set/attributeSetApi.d.ts +24 -0
- package/dist/_cjs/attribute-set/attributeSetApi.js +49 -0
- package/dist/_cjs/attribute-set/attributeSetApi.js.map +1 -0
- package/dist/_cjs/attribute-set/attributeSetInterfaces.d.ts +23 -0
- package/dist/_cjs/attribute-set/attributeSetInterfaces.js +3 -0
- package/dist/_cjs/attribute-set/attributeSetInterfaces.js.map +1 -0
- package/dist/_cjs/base/oneEntry.d.ts +9 -0
- package/dist/_cjs/base/oneEntry.js +55 -0
- package/dist/_cjs/base/oneEntry.js.map +1 -0
- package/dist/_cjs/base/utils.d.ts +32 -0
- package/dist/_cjs/base/utils.js +32 -0
- package/dist/_cjs/base/utils.js.map +1 -0
- package/dist/_cjs/forms/formsApi.d.ts +26 -0
- package/dist/_cjs/forms/formsApi.js +56 -0
- package/dist/_cjs/forms/formsApi.js.map +1 -0
- package/dist/_cjs/forms/formsInterfaces.d.ts +28 -0
- package/dist/_cjs/forms/formsInterfaces.js +3 -0
- package/dist/_cjs/forms/formsInterfaces.js.map +1 -0
- package/dist/_cjs/formsData/formsDataApi.d.ts +41 -0
- package/dist/_cjs/formsData/formsDataApi.js +71 -0
- package/dist/_cjs/formsData/formsDataApi.js.map +1 -0
- package/dist/_cjs/formsData/formsDataInterfaces.d.ts +25 -0
- package/dist/_cjs/formsData/formsDataInterfaces.js +3 -0
- package/dist/_cjs/formsData/formsDataInterfaces.js.map +1 -0
- package/dist/_cjs/general-types/generalTypesApi.d.ts +14 -0
- package/dist/_cjs/general-types/generalTypesApi.js +34 -0
- package/dist/_cjs/general-types/generalTypesApi.js.map +1 -0
- package/dist/_cjs/general-types/generalTypesInterfaces.d.ts +9 -0
- package/dist/_cjs/general-types/generalTypesInterfaces.js +3 -0
- package/dist/_cjs/general-types/generalTypesInterfaces.js.map +1 -0
- package/dist/_cjs/index.d.ts +35 -0
- package/dist/_cjs/index.js +55 -0
- package/dist/_cjs/index.js.map +1 -0
- package/dist/_cjs/locales/localesApi.d.ts +14 -0
- package/dist/_cjs/locales/localesApi.js +34 -0
- package/dist/_cjs/locales/localesApi.js.map +1 -0
- package/dist/_cjs/locales/localesInterfaces.d.ts +15 -0
- package/dist/_cjs/locales/localesInterfaces.js +3 -0
- package/dist/_cjs/locales/localesInterfaces.js.map +1 -0
- package/dist/_cjs/markers/markersApi.d.ts +35 -0
- package/dist/_cjs/markers/markersApi.js +65 -0
- package/dist/_cjs/markers/markersApi.js.map +1 -0
- package/dist/_cjs/markers/markersInterfaces.d.ts +16 -0
- package/dist/_cjs/markers/markersInterfaces.js +3 -0
- package/dist/_cjs/markers/markersInterfaces.js.map +1 -0
- package/dist/_cjs/menus/menusApi.d.ts +16 -0
- package/dist/_cjs/menus/menusApi.js +36 -0
- package/dist/_cjs/menus/menusApi.js.map +1 -0
- package/dist/_cjs/menus/menusInterfaces.d.ts +18 -0
- package/dist/_cjs/menus/menusInterfaces.js +3 -0
- package/dist/_cjs/menus/menusInterfaces.js.map +1 -0
- package/dist/_cjs/modules/modulesApi.d.ts +14 -0
- package/dist/_cjs/modules/modulesApi.js +34 -0
- package/dist/_cjs/modules/modulesApi.js.map +1 -0
- package/dist/_cjs/modules/modulesInterfaces.d.ts +19 -0
- package/dist/_cjs/modules/modulesInterfaces.js +3 -0
- package/dist/_cjs/modules/modulesInterfaces.js.map +1 -0
- package/dist/_cjs/pages/pagesApi.d.ts +74 -0
- package/dist/_cjs/pages/pagesApi.js +137 -0
- package/dist/_cjs/pages/pagesApi.js.map +1 -0
- package/dist/_cjs/pages/pagesInterfaces.d.ts +39 -0
- package/dist/_cjs/pages/pagesInterfaces.js +3 -0
- package/dist/_cjs/pages/pagesInterfaces.js.map +1 -0
- package/dist/_cjs/product-statuses/productStatusesApi.d.ts +38 -0
- package/dist/_cjs/product-statuses/productStatusesApi.js +73 -0
- package/dist/_cjs/product-statuses/productStatusesApi.js.map +1 -0
- package/dist/_cjs/product-statuses/productStatusesInterfaces.d.ts +15 -0
- package/dist/_cjs/product-statuses/productStatusesInterfaces.js +3 -0
- package/dist/_cjs/product-statuses/productStatusesInterfaces.js.map +1 -0
- package/dist/_cjs/products/productsApi.d.ts +195 -0
- package/dist/_cjs/products/productsApi.js +295 -0
- package/dist/_cjs/products/productsApi.js.map +1 -0
- package/dist/_cjs/products/productsInterfaces.d.ts +83 -0
- package/dist/_cjs/products/productsInterfaces.js +3 -0
- package/dist/_cjs/products/productsInterfaces.js.map +1 -0
- package/dist/_cjs/templates/templatesApi.d.ts +32 -0
- package/dist/_cjs/templates/templatesApi.js +72 -0
- package/dist/_cjs/templates/templatesApi.js.map +1 -0
- package/dist/_cjs/templates/templatesInterfaces.d.ts +30 -0
- package/dist/_cjs/templates/templatesInterfaces.js +3 -0
- package/dist/_cjs/templates/templatesInterfaces.js.map +1 -0
- package/dist/_cjs/templates-preview/templatesPreviewApi.d.ts +30 -0
- package/dist/_cjs/templates-preview/templatesPreviewApi.js +60 -0
- package/dist/_cjs/templates-preview/templatesPreviewApi.js.map +1 -0
- package/dist/_cjs/templates-preview/templatesPreviewInterfaces.d.ts +27 -0
- package/dist/_cjs/templates-preview/templatesPreviewInterfaces.js +3 -0
- package/dist/_cjs/templates-preview/templatesPreviewInterfaces.js.map +1 -0
- package/dist/_esm/admins/adminsApi.d.ts +14 -0
- package/dist/_esm/admins/adminsApi.js +31 -0
- package/dist/_esm/admins/adminsApi.js.map +1 -0
- package/dist/_esm/admins/adminsInterfaces.d.ts +32 -0
- package/dist/_esm/admins/adminsInterfaces.js +2 -0
- package/dist/_esm/admins/adminsInterfaces.js.map +1 -0
- package/dist/_esm/attribute-set/attributeSetApi.d.ts +24 -0
- package/dist/_esm/attribute-set/attributeSetApi.js +46 -0
- package/dist/_esm/attribute-set/attributeSetApi.js.map +1 -0
- package/dist/_esm/attribute-set/attributeSetInterfaces.d.ts +23 -0
- package/dist/_esm/attribute-set/attributeSetInterfaces.js +2 -0
- package/dist/_esm/attribute-set/attributeSetInterfaces.js.map +1 -0
- package/dist/_esm/base/oneEntry.d.ts +9 -0
- package/dist/_esm/base/oneEntry.js +52 -0
- package/dist/_esm/base/oneEntry.js.map +1 -0
- package/dist/_esm/base/utils.d.ts +32 -0
- package/dist/_esm/base/utils.js +30 -0
- package/dist/_esm/base/utils.js.map +1 -0
- package/dist/_esm/forms/formsApi.d.ts +26 -0
- package/dist/_esm/forms/formsApi.js +53 -0
- package/dist/_esm/forms/formsApi.js.map +1 -0
- package/dist/_esm/forms/formsInterfaces.d.ts +28 -0
- package/dist/_esm/forms/formsInterfaces.js +2 -0
- package/dist/_esm/forms/formsInterfaces.js.map +1 -0
- package/dist/_esm/formsData/formsDataApi.d.ts +41 -0
- package/dist/_esm/formsData/formsDataApi.js +68 -0
- package/dist/_esm/formsData/formsDataApi.js.map +1 -0
- package/dist/_esm/formsData/formsDataInterfaces.d.ts +25 -0
- package/dist/_esm/formsData/formsDataInterfaces.js +2 -0
- package/dist/_esm/formsData/formsDataInterfaces.js.map +1 -0
- package/dist/_esm/general-types/generalTypesApi.d.ts +14 -0
- package/dist/_esm/general-types/generalTypesApi.js +31 -0
- package/dist/_esm/general-types/generalTypesApi.js.map +1 -0
- package/dist/_esm/general-types/generalTypesInterfaces.d.ts +9 -0
- package/dist/_esm/general-types/generalTypesInterfaces.js +2 -0
- package/dist/_esm/general-types/generalTypesInterfaces.js.map +1 -0
- package/dist/_esm/index.d.ts +35 -0
- package/dist/_esm/index.js +51 -0
- package/dist/_esm/index.js.map +1 -0
- package/dist/_esm/locales/localesApi.d.ts +14 -0
- package/dist/_esm/locales/localesApi.js +31 -0
- package/dist/_esm/locales/localesApi.js.map +1 -0
- package/dist/_esm/locales/localesInterfaces.d.ts +15 -0
- package/dist/_esm/locales/localesInterfaces.js +2 -0
- package/dist/_esm/locales/localesInterfaces.js.map +1 -0
- package/dist/_esm/markers/markersApi.d.ts +35 -0
- package/dist/_esm/markers/markersApi.js +62 -0
- package/dist/_esm/markers/markersApi.js.map +1 -0
- package/dist/_esm/markers/markersInterfaces.d.ts +16 -0
- package/dist/_esm/markers/markersInterfaces.js +2 -0
- package/dist/_esm/markers/markersInterfaces.js.map +1 -0
- package/dist/_esm/menus/menusApi.d.ts +16 -0
- package/dist/_esm/menus/menusApi.js +33 -0
- package/dist/_esm/menus/menusApi.js.map +1 -0
- package/dist/_esm/menus/menusInterfaces.d.ts +18 -0
- package/dist/_esm/menus/menusInterfaces.js +2 -0
- package/dist/_esm/menus/menusInterfaces.js.map +1 -0
- package/dist/_esm/modules/modulesApi.d.ts +14 -0
- package/dist/_esm/modules/modulesApi.js +31 -0
- package/dist/_esm/modules/modulesApi.js.map +1 -0
- package/dist/_esm/modules/modulesInterfaces.d.ts +19 -0
- package/dist/_esm/modules/modulesInterfaces.js +2 -0
- package/dist/_esm/modules/modulesInterfaces.js.map +1 -0
- package/dist/_esm/pages/pagesApi.d.ts +74 -0
- package/dist/_esm/pages/pagesApi.js +134 -0
- package/dist/_esm/pages/pagesApi.js.map +1 -0
- package/dist/_esm/pages/pagesInterfaces.d.ts +39 -0
- package/dist/_esm/pages/pagesInterfaces.js +2 -0
- package/dist/_esm/pages/pagesInterfaces.js.map +1 -0
- package/dist/_esm/product-statuses/productStatusesApi.d.ts +38 -0
- package/dist/_esm/product-statuses/productStatusesApi.js +70 -0
- package/dist/_esm/product-statuses/productStatusesApi.js.map +1 -0
- package/dist/_esm/product-statuses/productStatusesInterfaces.d.ts +15 -0
- package/dist/_esm/product-statuses/productStatusesInterfaces.js +2 -0
- package/dist/_esm/product-statuses/productStatusesInterfaces.js.map +1 -0
- package/dist/_esm/products/productsApi.d.ts +195 -0
- package/dist/_esm/products/productsApi.js +292 -0
- package/dist/_esm/products/productsApi.js.map +1 -0
- package/dist/_esm/products/productsInterfaces.d.ts +83 -0
- package/dist/_esm/products/productsInterfaces.js +2 -0
- package/dist/_esm/products/productsInterfaces.js.map +1 -0
- package/dist/_esm/templates/templatesApi.d.ts +32 -0
- package/dist/_esm/templates/templatesApi.js +69 -0
- package/dist/_esm/templates/templatesApi.js.map +1 -0
- package/dist/_esm/templates/templatesInterfaces.d.ts +30 -0
- package/dist/_esm/templates/templatesInterfaces.js +2 -0
- package/dist/_esm/templates/templatesInterfaces.js.map +1 -0
- package/dist/_esm/templates-preview/templatesPreviewApi.d.ts +30 -0
- package/dist/_esm/templates-preview/templatesPreviewApi.js +57 -0
- package/dist/_esm/templates-preview/templatesPreviewApi.js.map +1 -0
- package/dist/_esm/templates-preview/templatesPreviewInterfaces.d.ts +27 -0
- package/dist/_esm/templates-preview/templatesPreviewInterfaces.js +2 -0
- package/dist/_esm/templates-preview/templatesPreviewInterfaces.js.map +1 -0
- package/dist/_types/admins/adminsApi.d.ts +14 -0
- package/dist/_types/admins/adminsInterfaces.d.ts +32 -0
- package/dist/_types/attribute-set/attributeSetApi.d.ts +24 -0
- package/dist/_types/attribute-set/attributeSetInterfaces.d.ts +23 -0
- package/dist/_types/base/oneEntry.d.ts +9 -0
- package/dist/_types/base/utils.d.ts +32 -0
- package/dist/_types/forms/formsApi.d.ts +26 -0
- package/dist/_types/forms/formsInterfaces.d.ts +28 -0
- package/dist/_types/formsData/formsDataApi.d.ts +41 -0
- package/dist/_types/formsData/formsDataInterfaces.d.ts +25 -0
- package/dist/_types/general-types/generalTypesApi.d.ts +14 -0
- package/dist/_types/general-types/generalTypesInterfaces.d.ts +9 -0
- package/dist/_types/index.d.ts +35 -0
- package/dist/_types/locales/localesApi.d.ts +14 -0
- package/dist/_types/locales/localesInterfaces.d.ts +15 -0
- package/dist/_types/markers/markersApi.d.ts +35 -0
- package/dist/_types/markers/markersInterfaces.d.ts +16 -0
- package/dist/_types/menus/menusApi.d.ts +16 -0
- package/dist/_types/menus/menusInterfaces.d.ts +18 -0
- package/dist/_types/modules/modulesApi.d.ts +14 -0
- package/dist/_types/modules/modulesInterfaces.d.ts +19 -0
- package/dist/_types/pages/pagesApi.d.ts +74 -0
- package/dist/_types/pages/pagesInterfaces.d.ts +39 -0
- package/dist/_types/product-statuses/productStatusesApi.d.ts +38 -0
- package/dist/_types/product-statuses/productStatusesInterfaces.d.ts +15 -0
- package/dist/_types/products/productsApi.d.ts +195 -0
- package/dist/_types/products/productsInterfaces.d.ts +83 -0
- package/dist/_types/templates/templatesApi.d.ts +32 -0
- package/dist/_types/templates/templatesInterfaces.d.ts +30 -0
- package/dist/_types/templates-preview/templatesPreviewApi.d.ts +30 -0
- package/dist/_types/templates-preview/templatesPreviewInterfaces.d.ts +27 -0
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -8
- package/dist/index.js.map +1 -1
- package/dist/products/productsApi.d.ts +6 -4
- package/dist/products/productsApi.js +34 -7
- package/dist/products/productsApi.js.map +1 -1
- package/dist/products/productsInterfaces.d.ts +14 -3
- package/package.json +3 -2
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ILocalizeInfos, Types } from "../base/utils";
|
|
2
|
+
interface IPageApi {
|
|
3
|
+
getRootPages(langCode: string): Promise<Array<IPagesEntity>>;
|
|
4
|
+
getCatalogPages(langCode: string, limit: number, offset: number): Promise<Array<IPagesEntity>>;
|
|
5
|
+
getPages(langCode: string): Promise<Array<IPagesEntity>>;
|
|
6
|
+
getPageById(id: number, langCode: string): Promise<IPagesEntity>;
|
|
7
|
+
getPageByUrl(url: string, langCode: string): Promise<IPagesEntity>;
|
|
8
|
+
getConfigPageByUrl(url: string): Promise<IPageConfig>;
|
|
9
|
+
searchPage(name: string, langCode: string): Promise<IPagesEntity>;
|
|
10
|
+
}
|
|
11
|
+
interface IPageConfig {
|
|
12
|
+
rowsPerPage: number;
|
|
13
|
+
productsPerRow: number;
|
|
14
|
+
}
|
|
15
|
+
interface IPagesEntity {
|
|
16
|
+
id: number;
|
|
17
|
+
parentId: number;
|
|
18
|
+
config: Record<string, number>;
|
|
19
|
+
pageUrl: string;
|
|
20
|
+
depth: number;
|
|
21
|
+
localizeInfos: ILocalizeInfos;
|
|
22
|
+
isVisible: boolean;
|
|
23
|
+
isEditorDisabled: boolean;
|
|
24
|
+
products: number;
|
|
25
|
+
attributeSetId: number;
|
|
26
|
+
templateIdentifier: string;
|
|
27
|
+
/**
|
|
28
|
+
* Language-specific attribute values.
|
|
29
|
+
* @example attributeValues['en_US']
|
|
30
|
+
*
|
|
31
|
+
* @property {langCode.<object>}
|
|
32
|
+
*/
|
|
33
|
+
attributeValues: {
|
|
34
|
+
[langCode: string]: object;
|
|
35
|
+
};
|
|
36
|
+
position: string;
|
|
37
|
+
type: Types;
|
|
38
|
+
}
|
|
39
|
+
export { IPageApi, IPageConfig, IPagesEntity };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagesInterfaces.js","sourceRoot":"","sources":["../../../src/pages/pagesInterfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import OneEntry from '../base/oneEntry';
|
|
2
|
+
import { IProductStatusEntity, IProductStatuses } from "./productStatusesInterfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Controllers for working with product statuses
|
|
5
|
+
*/
|
|
6
|
+
export default class ProductStatusesApi extends OneEntry implements IProductStatuses {
|
|
7
|
+
constructor(url: string);
|
|
8
|
+
/**
|
|
9
|
+
* Search for all product status objects.
|
|
10
|
+
*
|
|
11
|
+
* @returns Returns an array of product status objects
|
|
12
|
+
*/
|
|
13
|
+
getProductStatuses(): Promise<Array<IProductStatusEntity>>;
|
|
14
|
+
/**
|
|
15
|
+
* Search for a product status object by identifier.
|
|
16
|
+
*
|
|
17
|
+
* @param {number} [id] - Status id
|
|
18
|
+
*
|
|
19
|
+
* @returns Returns a product status object
|
|
20
|
+
*/
|
|
21
|
+
getProductStatusesById(id: number): Promise<IProductStatusEntity>;
|
|
22
|
+
/**
|
|
23
|
+
* Search for a product status object by its textual identifier (marker).
|
|
24
|
+
*
|
|
25
|
+
* @param {string} [marker] - Product marker
|
|
26
|
+
*
|
|
27
|
+
* @returns Returns a product status object
|
|
28
|
+
*/
|
|
29
|
+
getProductsByStatusMarker(marker: string): Promise<IProductStatusEntity>;
|
|
30
|
+
/**
|
|
31
|
+
* Check the existence of a textual identifier.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} [marker] - Product marker
|
|
34
|
+
*
|
|
35
|
+
* @returns Returns true if the textual identifier (marker) exists or false if it doesn't
|
|
36
|
+
*/
|
|
37
|
+
validateMarker(marker: string): Promise<boolean>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const oneEntry_1 = require("../base/oneEntry");
|
|
13
|
+
/**
|
|
14
|
+
* Controllers for working with product statuses
|
|
15
|
+
*/
|
|
16
|
+
class ProductStatusesApi extends oneEntry_1.default {
|
|
17
|
+
constructor(url) {
|
|
18
|
+
super(url);
|
|
19
|
+
this._url += '/api/content/product-statuses';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Search for all product status objects.
|
|
23
|
+
*
|
|
24
|
+
* @returns Returns an array of product status objects
|
|
25
|
+
*/
|
|
26
|
+
getProductStatuses() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const result = yield this._fetchGet('');
|
|
29
|
+
return result;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Search for a product status object by identifier.
|
|
34
|
+
*
|
|
35
|
+
* @param {number} [id] - Status id
|
|
36
|
+
*
|
|
37
|
+
* @returns Returns a product status object
|
|
38
|
+
*/
|
|
39
|
+
getProductStatusesById(id) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const result = yield this._fetchGet(`/${id}`);
|
|
42
|
+
return result;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Search for a product status object by its textual identifier (marker).
|
|
47
|
+
*
|
|
48
|
+
* @param {string} [marker] - Product marker
|
|
49
|
+
*
|
|
50
|
+
* @returns Returns a product status object
|
|
51
|
+
*/
|
|
52
|
+
getProductsByStatusMarker(marker) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const result = yield this._fetchGet(`/marker/${marker}`);
|
|
55
|
+
return result;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check the existence of a textual identifier.
|
|
60
|
+
*
|
|
61
|
+
* @param {string} [marker] - Product marker
|
|
62
|
+
*
|
|
63
|
+
* @returns Returns true if the textual identifier (marker) exists or false if it doesn't
|
|
64
|
+
*/
|
|
65
|
+
validateMarker(marker) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const result = yield this._fetchGet(`/marker-validation/${marker}`);
|
|
68
|
+
return result;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.default = ProductStatusesApi;
|
|
73
|
+
//# sourceMappingURL=productStatusesApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"productStatusesApi.js","sourceRoot":"","sources":["../../../src/product-statuses/productStatusesApi.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+CAAuC;AAGvC;;GAEG;AACH,MAAqB,kBAAmB,SAAQ,kBAAQ;IACpD,YAAY,GAAW;QACnB,KAAK,CAAC,GAAG,CAAC,CAAA;QACV,IAAI,CAAC,IAAI,IAAI,+BAA+B,CAAA;IAChD,CAAC;IAED;;;;OAIG;IACU,kBAAkB;;YAC3B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;YACvC,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAED;;;;;;OAMG;IACU,sBAAsB,CAAC,EAAS;;YACzC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;YAC7C,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAED;;;;;;OAMG;IACU,yBAAyB,CAAC,MAAa;;YAChD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,MAAM,EAAE,CAAC,CAAA;YACxD,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAED;;;;;;OAMG;IACU,cAAc,CAAC,MAAa;;YACrC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,sBAAsB,MAAM,EAAE,CAAC,CAAA;YACnE,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;CACJ;AAnDD,qCAmDC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ILocalizeInfos } from "../base/utils";
|
|
2
|
+
interface IProductStatuses {
|
|
3
|
+
getProductStatuses(): Promise<Array<IProductStatusEntity>>;
|
|
4
|
+
getProductStatusesById(id: number): Promise<IProductStatusEntity>;
|
|
5
|
+
getProductsByStatusMarker(marker: string): Promise<IProductStatusEntity>;
|
|
6
|
+
validateMarker(marker: string): Promise<boolean>;
|
|
7
|
+
}
|
|
8
|
+
interface IProductStatusEntity {
|
|
9
|
+
id: number;
|
|
10
|
+
updatedDate: string;
|
|
11
|
+
version: number;
|
|
12
|
+
identifier: string;
|
|
13
|
+
localizeInfos: ILocalizeInfos;
|
|
14
|
+
}
|
|
15
|
+
export { IProductStatuses, IProductStatusEntity };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"productStatusesInterfaces.js","sourceRoot":"","sources":["../../../src/product-statuses/productStatusesInterfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { IProductsQuery, IFilterParams, IProductApi, IProductsEntity } from './productsInterfaces';
|
|
2
|
+
import OneEntry from '../base/oneEntry';
|
|
3
|
+
/**
|
|
4
|
+
* Controllers for working with product pages
|
|
5
|
+
*/
|
|
6
|
+
export default class ProductApi extends OneEntry implements IProductApi {
|
|
7
|
+
constructor(url: string);
|
|
8
|
+
private _defaultQuery;
|
|
9
|
+
/**
|
|
10
|
+
* Search for all product page objects with pagination and filtering.
|
|
11
|
+
*
|
|
12
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
13
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
14
|
+
*
|
|
15
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
16
|
+
*
|
|
17
|
+
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
18
|
+
*
|
|
19
|
+
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
20
|
+
*
|
|
21
|
+
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
22
|
+
*
|
|
23
|
+
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
24
|
+
*
|
|
25
|
+
* @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
|
|
26
|
+
*
|
|
27
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
28
|
+
*
|
|
29
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
30
|
+
*
|
|
31
|
+
* @returns {Promise<IProduct[]>} - List of products.
|
|
32
|
+
*/
|
|
33
|
+
getProducts(userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
34
|
+
/**
|
|
35
|
+
* Search for all product page objects with pagination that do not have a category.
|
|
36
|
+
*
|
|
37
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
38
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
39
|
+
*
|
|
40
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
41
|
+
*
|
|
42
|
+
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
43
|
+
*
|
|
44
|
+
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
45
|
+
*
|
|
46
|
+
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
47
|
+
*
|
|
48
|
+
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
49
|
+
*
|
|
50
|
+
* @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
|
|
51
|
+
*
|
|
52
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
53
|
+
*
|
|
54
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
55
|
+
*
|
|
56
|
+
* @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
|
|
57
|
+
*/
|
|
58
|
+
getProductsEmptyPage(userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
59
|
+
/**
|
|
60
|
+
* Search for all product page objects with pagination for the selected category.
|
|
61
|
+
*
|
|
62
|
+
* @param {number} [id] - Page identifier.
|
|
63
|
+
*
|
|
64
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
65
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
66
|
+
*
|
|
67
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
68
|
+
*
|
|
69
|
+
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
70
|
+
*
|
|
71
|
+
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
72
|
+
*
|
|
73
|
+
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
74
|
+
*
|
|
75
|
+
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
76
|
+
*
|
|
77
|
+
* @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
|
|
78
|
+
*
|
|
79
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
80
|
+
*
|
|
81
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
82
|
+
*
|
|
83
|
+
* @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
|
|
84
|
+
*/
|
|
85
|
+
getProductsPageById(id: number, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
86
|
+
/**
|
|
87
|
+
* Search for all product page objects with pagination for the selected category (by its URL).
|
|
88
|
+
*
|
|
89
|
+
* @param {string} [url] - URL of the category page.
|
|
90
|
+
*
|
|
91
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
92
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
93
|
+
*
|
|
94
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
95
|
+
*
|
|
96
|
+
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
97
|
+
*
|
|
98
|
+
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
99
|
+
*
|
|
100
|
+
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
101
|
+
*
|
|
102
|
+
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
103
|
+
*
|
|
104
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
105
|
+
*
|
|
106
|
+
* @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
|
|
107
|
+
*
|
|
108
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
109
|
+
*
|
|
110
|
+
* @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
|
|
111
|
+
*/
|
|
112
|
+
getProductsPageByUrl(url: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
113
|
+
/**
|
|
114
|
+
* Find all related product page objects.
|
|
115
|
+
*
|
|
116
|
+
* @param {number} [id] - Product page identifier for which to find relationship.
|
|
117
|
+
*
|
|
118
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
119
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
120
|
+
*
|
|
121
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
122
|
+
*
|
|
123
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
124
|
+
*
|
|
125
|
+
* @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
|
|
126
|
+
*
|
|
127
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
128
|
+
*
|
|
129
|
+
* @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
|
|
130
|
+
*/
|
|
131
|
+
getRelatedProductsById(id: number, userQuery?: IProductsQuery): Promise<IProductsEntity>;
|
|
132
|
+
/**
|
|
133
|
+
* Retrieve one product object.
|
|
134
|
+
*
|
|
135
|
+
* @param {number} [id] - Product id.
|
|
136
|
+
*
|
|
137
|
+
* @param {string | Array<string>} [langCode] Language code parameter. Default "en_US". Нou can also pass several language parameters ['en_US', 'it_IT']
|
|
138
|
+
*
|
|
139
|
+
* @returns {Promise<IProductsEntity>} - Returns ContentIndexedProductDto object for the product.
|
|
140
|
+
*/
|
|
141
|
+
getProductById(id: number, langCode?: string | Array<string>): Promise<IProductsEntity>;
|
|
142
|
+
/**
|
|
143
|
+
* Find all product page objects with pagination and multiple filtering.
|
|
144
|
+
*
|
|
145
|
+
* @param {array} [data] - Request body.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* const objects = [
|
|
149
|
+
* {
|
|
150
|
+
* attributeMarker: "price",
|
|
151
|
+
* conditionMarker: "mth",
|
|
152
|
+
* conditionValue: 1,
|
|
153
|
+
* pageId: 0,
|
|
154
|
+
* },
|
|
155
|
+
* {
|
|
156
|
+
* attributeMarker: "price",
|
|
157
|
+
* conditionMarker: "lth",
|
|
158
|
+
* conditionValue: 3,
|
|
159
|
+
* pageId: 0,
|
|
160
|
+
* },
|
|
161
|
+
* ];
|
|
162
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
163
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
164
|
+
*
|
|
165
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
166
|
+
*
|
|
167
|
+
* @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
|
|
168
|
+
*
|
|
169
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
170
|
+
*
|
|
171
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
172
|
+
*
|
|
173
|
+
* @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
|
|
174
|
+
*/
|
|
175
|
+
filterProduct(data: Array<IFilterParams>, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
176
|
+
/**
|
|
177
|
+
* Quick search for product page objects with limited output.
|
|
178
|
+
*
|
|
179
|
+
* @param {string} [name] - Text to search product page objects (search is based on the title field of the localizeInfos object with language consideration)
|
|
180
|
+
*
|
|
181
|
+
* @param {string} [langCode] - Language code
|
|
182
|
+
*
|
|
183
|
+
* @returns {Promise<IProduct[]>} - Returns array of ContentIndexedProductDto object for the product.
|
|
184
|
+
*/
|
|
185
|
+
searchProduct(name: string, langCode?: string): Promise<Array<IProductsEntity>>;
|
|
186
|
+
/**
|
|
187
|
+
* Get all attributes of one Product.
|
|
188
|
+
*
|
|
189
|
+
* @param {number} [id] - Product id.
|
|
190
|
+
*
|
|
191
|
+
* @returns {Promise<IProduct[]>} - Returns array of set attributes.
|
|
192
|
+
*/
|
|
193
|
+
getAttributesByProductId(id: number): Promise<any>;
|
|
194
|
+
private _normalizeProductData;
|
|
195
|
+
}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const oneEntry_1 = require("../base/oneEntry");
|
|
13
|
+
/**
|
|
14
|
+
* Controllers for working with product pages
|
|
15
|
+
*/
|
|
16
|
+
class ProductApi extends oneEntry_1.default {
|
|
17
|
+
constructor(url) {
|
|
18
|
+
super(url);
|
|
19
|
+
this._defaultQuery = {
|
|
20
|
+
offset: 0,
|
|
21
|
+
limit: 30,
|
|
22
|
+
statusMarker: null,
|
|
23
|
+
conditionValue: null,
|
|
24
|
+
conditionMarker: null,
|
|
25
|
+
attributeMarker: null,
|
|
26
|
+
langCode: 'en_US',
|
|
27
|
+
sortOrder: 'DESC',
|
|
28
|
+
sortKey: 'id'
|
|
29
|
+
};
|
|
30
|
+
this._url += '/api/content/products';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Search for all product page objects with pagination and filtering.
|
|
34
|
+
*
|
|
35
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
36
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
37
|
+
*
|
|
38
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
39
|
+
*
|
|
40
|
+
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
41
|
+
*
|
|
42
|
+
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
43
|
+
*
|
|
44
|
+
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
45
|
+
*
|
|
46
|
+
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
47
|
+
*
|
|
48
|
+
* @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
|
|
49
|
+
*
|
|
50
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
51
|
+
*
|
|
52
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
53
|
+
*
|
|
54
|
+
* @returns {Promise<IProduct[]>} - List of products.
|
|
55
|
+
*/
|
|
56
|
+
getProducts(userQuery) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const query = Object.assign(Object.assign({}, this._defaultQuery), userQuery);
|
|
59
|
+
const result = yield this._fetchGet('?' + this._queryParamsToString(query));
|
|
60
|
+
return result.items;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Search for all product page objects with pagination that do not have a category.
|
|
65
|
+
*
|
|
66
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
67
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
68
|
+
*
|
|
69
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
70
|
+
*
|
|
71
|
+
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
72
|
+
*
|
|
73
|
+
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
74
|
+
*
|
|
75
|
+
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
76
|
+
*
|
|
77
|
+
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
78
|
+
*
|
|
79
|
+
* @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
|
|
80
|
+
*
|
|
81
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
82
|
+
*
|
|
83
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
84
|
+
*
|
|
85
|
+
* @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
|
|
86
|
+
*/
|
|
87
|
+
getProductsEmptyPage(userQuery) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
const query = Object.assign(Object.assign({}, this._defaultQuery), userQuery);
|
|
90
|
+
const result = yield this._fetchGet('/empty-page?' + this._queryParamsToString(query));
|
|
91
|
+
return result;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Search for all product page objects with pagination for the selected category.
|
|
96
|
+
*
|
|
97
|
+
* @param {number} [id] - Page identifier.
|
|
98
|
+
*
|
|
99
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
100
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
101
|
+
*
|
|
102
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
103
|
+
*
|
|
104
|
+
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
105
|
+
*
|
|
106
|
+
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
107
|
+
*
|
|
108
|
+
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
109
|
+
*
|
|
110
|
+
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
111
|
+
*
|
|
112
|
+
* @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
|
|
113
|
+
*
|
|
114
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
115
|
+
*
|
|
116
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
117
|
+
*
|
|
118
|
+
* @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
|
|
119
|
+
*/
|
|
120
|
+
getProductsPageById(id, userQuery) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const query = Object.assign(Object.assign({}, this._defaultQuery), userQuery);
|
|
123
|
+
const result = yield this._fetchGet(`/page/${id}?` + this._queryParamsToString(query));
|
|
124
|
+
return result.items;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Search for all product page objects with pagination for the selected category (by its URL).
|
|
129
|
+
*
|
|
130
|
+
* @param {string} [url] - URL of the category page.
|
|
131
|
+
*
|
|
132
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
133
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
134
|
+
*
|
|
135
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
136
|
+
*
|
|
137
|
+
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
138
|
+
*
|
|
139
|
+
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
140
|
+
*
|
|
141
|
+
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
142
|
+
*
|
|
143
|
+
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
144
|
+
*
|
|
145
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
146
|
+
*
|
|
147
|
+
* @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
|
|
148
|
+
*
|
|
149
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
150
|
+
*
|
|
151
|
+
* @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
|
|
152
|
+
*/
|
|
153
|
+
getProductsPageByUrl(url, userQuery) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
const query = Object.assign(Object.assign({}, this._defaultQuery), userQuery);
|
|
156
|
+
const result = yield this._fetchGet(`/page/url/${url}?` + this._queryParamsToString(query));
|
|
157
|
+
return result.items;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Find all related product page objects.
|
|
162
|
+
*
|
|
163
|
+
* @param {number} [id] - Product page identifier for which to find relationship.
|
|
164
|
+
*
|
|
165
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
166
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
167
|
+
*
|
|
168
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
169
|
+
*
|
|
170
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
171
|
+
*
|
|
172
|
+
* @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
|
|
173
|
+
*
|
|
174
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
175
|
+
*
|
|
176
|
+
* @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
|
|
177
|
+
*/
|
|
178
|
+
getRelatedProductsById(id, userQuery) {
|
|
179
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
const query = Object.assign(Object.assign({}, this._defaultQuery), userQuery);
|
|
181
|
+
const result = yield this._fetchGet(`/${id}/related?` + this._queryParamsToString(query));
|
|
182
|
+
return result.items;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Retrieve one product object.
|
|
187
|
+
*
|
|
188
|
+
* @param {number} [id] - Product id.
|
|
189
|
+
*
|
|
190
|
+
* @param {string | Array<string>} [langCode] Language code parameter. Default "en_US". Нou can also pass several language parameters ['en_US', 'it_IT']
|
|
191
|
+
*
|
|
192
|
+
* @returns {Promise<IProductsEntity>} - Returns ContentIndexedProductDto object for the product.
|
|
193
|
+
*/
|
|
194
|
+
getProductById(id, langCode = 'en_US') {
|
|
195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
const response = yield this._fetchGet(`/${id}?langCode=${langCode}`);
|
|
197
|
+
const product = yield this._normalizeProductData(response, langCode);
|
|
198
|
+
return product;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Find all product page objects with pagination and multiple filtering.
|
|
203
|
+
*
|
|
204
|
+
* @param {array} [data] - Request body.
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* const objects = [
|
|
208
|
+
* {
|
|
209
|
+
* attributeMarker: "price",
|
|
210
|
+
* conditionMarker: "mth",
|
|
211
|
+
* conditionValue: 1,
|
|
212
|
+
* pageId: 0,
|
|
213
|
+
* },
|
|
214
|
+
* {
|
|
215
|
+
* attributeMarker: "price",
|
|
216
|
+
* conditionMarker: "lth",
|
|
217
|
+
* conditionValue: 3,
|
|
218
|
+
* pageId: 0,
|
|
219
|
+
* },
|
|
220
|
+
* ];
|
|
221
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
222
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
223
|
+
*
|
|
224
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
225
|
+
*
|
|
226
|
+
* @param {string} [userQuery.langCode] Language code parameter. Default "en_US"
|
|
227
|
+
*
|
|
228
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
229
|
+
*
|
|
230
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
231
|
+
*
|
|
232
|
+
* @returns {Promise<IProduct[]>} - Returns array of items, where item - ContentIndexedProductDto objects.
|
|
233
|
+
*/
|
|
234
|
+
filterProduct(data, userQuery) {
|
|
235
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
236
|
+
const query = Object.assign(Object.assign({}, this._defaultQuery), userQuery);
|
|
237
|
+
const result = yield this._fetchPost(`/conditions-filter?` + this._queryParamsToString(query), data);
|
|
238
|
+
return result.items;
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Quick search for product page objects with limited output.
|
|
243
|
+
*
|
|
244
|
+
* @param {string} [name] - Text to search product page objects (search is based on the title field of the localizeInfos object with language consideration)
|
|
245
|
+
*
|
|
246
|
+
* @param {string} [langCode] - Language code
|
|
247
|
+
*
|
|
248
|
+
* @returns {Promise<IProduct[]>} - Returns array of ContentIndexedProductDto object for the product.
|
|
249
|
+
*/
|
|
250
|
+
searchProduct(name, langCode = 'en_US') {
|
|
251
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
252
|
+
const searchProducts = yield this._fetchGet(`/quick/search?lang=${langCode}&name=${name}`);
|
|
253
|
+
const productsList = [];
|
|
254
|
+
yield Promise.all(searchProducts.map((product) => __awaiter(this, void 0, void 0, function* () {
|
|
255
|
+
yield this.getProductById(product.id).then((result) => {
|
|
256
|
+
productsList.push(result);
|
|
257
|
+
});
|
|
258
|
+
})));
|
|
259
|
+
return productsList;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Get all attributes of one Product.
|
|
264
|
+
*
|
|
265
|
+
* @param {number} [id] - Product id.
|
|
266
|
+
*
|
|
267
|
+
* @returns {Promise<IProduct[]>} - Returns array of set attributes.
|
|
268
|
+
*/
|
|
269
|
+
getAttributesByProductId(id) {
|
|
270
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
271
|
+
const product = yield this.getProductById(id);
|
|
272
|
+
return product.attributeValues;
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
_normalizeProductData(product, langSet) {
|
|
276
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
277
|
+
const normalizeProduct = Object.assign({}, product);
|
|
278
|
+
if (!Array.isArray(langSet)) {
|
|
279
|
+
normalizeProduct.attributeValues = product.attributeValues[langSet];
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
const attrs = [];
|
|
283
|
+
yield Promise.all(langSet.map((lang) => __awaiter(this, void 0, void 0, function* () {
|
|
284
|
+
yield this.getProductById(product.id, lang).then((result) => {
|
|
285
|
+
attrs.push(result.attributeValues);
|
|
286
|
+
});
|
|
287
|
+
})));
|
|
288
|
+
Object.assign(normalizeProduct.attributeValues, ...attrs);
|
|
289
|
+
}
|
|
290
|
+
return normalizeProduct;
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
exports.default = ProductApi;
|
|
295
|
+
//# sourceMappingURL=productsApi.js.map
|