oneentry 1.0.66 → 1.0.67
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 +303 -242
- package/dist/_cjs/admins/adminsApi.d.ts +1 -1
- package/dist/admins/adminsApi.d.ts +6 -4
- package/dist/admins/adminsApi.js +6 -6
- package/dist/attribute-sets/attributeSetsApi.d.ts +6 -4
- package/dist/attribute-sets/attributeSetsApi.js +7 -7
- package/dist/auth-provider/authProviderApi.d.ts +6 -4
- package/dist/auth-provider/authProviderApi.js +14 -10
- package/dist/auth-provider/authProvidersInterfaces.d.ts +2 -2
- package/dist/base/asyncModules.d.ts +16 -0
- package/dist/base/asyncModules.js +164 -0
- package/dist/base/modules.d.ts +14 -0
- package/dist/base/modules.js +173 -0
- package/dist/base/oneEntry.d.ts +0 -23
- package/dist/base/oneEntry.js +74 -236
- package/dist/base/stateModule.d.ts +10 -0
- package/dist/base/stateModule.js +13 -0
- package/dist/base/syncModules.d.ts +14 -0
- package/dist/base/syncModules.js +72 -0
- package/dist/blocks/blocksApi.d.ts +9 -6
- package/dist/blocks/blocksApi.js +17 -16
- package/dist/blocks/blocksInterfaces.d.ts +3 -2
- package/dist/events/eventsApi.d.ts +6 -4
- package/dist/events/eventsApi.js +5 -5
- package/dist/file-uploding/fileUploadingApi.d.ts +6 -4
- package/dist/file-uploding/fileUploadingApi.js +6 -6
- package/dist/forms/formsApi.d.ts +7 -5
- package/dist/forms/formsApi.js +8 -8
- package/dist/formsData/formsDataApi.d.ts +8 -6
- package/dist/formsData/formsDataApi.js +10 -10
- package/dist/general-types/typesApi.d.ts +6 -4
- package/dist/general-types/typesApi.js +5 -5
- package/dist/index.js +22 -20
- package/dist/locales/localesApi.d.ts +6 -4
- package/dist/locales/localesApi.js +5 -5
- package/dist/menus/menusApi.d.ts +7 -5
- package/dist/menus/menusApi.js +7 -7
- package/dist/orders/ordersApi.d.ts +6 -4
- package/dist/orders/ordersApi.js +10 -10
- package/dist/pages/pagesApi.d.ts +6 -4
- package/dist/pages/pagesApi.js +16 -19
- package/dist/payments/paymentsApi.d.ts +6 -10
- package/dist/payments/paymentsApi.js +5 -14
- package/dist/payments/paymentsInterfaces.d.ts +0 -2
- package/dist/product-statuses/productStatusesApi.d.ts +6 -4
- package/dist/product-statuses/productStatusesApi.js +8 -8
- package/dist/products/productsApi.d.ts +107 -52
- package/dist/products/productsApi.js +119 -65
- package/dist/products/productsInterfaces.d.ts +16 -8
- package/dist/system/systemApi.d.ts +6 -4
- package/dist/system/systemApi.js +5 -5
- package/dist/templates/templatesApi.d.ts +9 -6
- package/dist/templates/templatesApi.js +9 -9
- package/dist/templates/templatesInterfaces.d.ts +2 -1
- package/dist/templates-preview/templatesPreviewApi.d.ts +8 -6
- package/dist/templates-preview/templatesPreviewApi.js +10 -10
- package/dist/users/usersApi.d.ts +6 -4
- package/dist/users/usersApi.js +7 -7
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const asyncModules_1 = require("../base/asyncModules");
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with file uploading
|
|
6
6
|
*/
|
|
7
|
-
class FileUploadingApi extends
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
7
|
+
class FileUploadingApi extends asyncModules_1.default {
|
|
8
|
+
constructor(state) {
|
|
9
|
+
super(state);
|
|
10
10
|
this._defaultQuery = {
|
|
11
11
|
type: null,
|
|
12
12
|
entity: null,
|
|
@@ -15,7 +15,7 @@ class FileUploadingApi extends oneEntry_1.default {
|
|
|
15
15
|
height: null,
|
|
16
16
|
compress: null,
|
|
17
17
|
};
|
|
18
|
-
this._url
|
|
18
|
+
this._url = state.url + '/api/content/files';
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Upload file function.
|
|
@@ -72,7 +72,7 @@ class FileUploadingApi extends oneEntry_1.default {
|
|
|
72
72
|
method: 'GET',
|
|
73
73
|
headers: {
|
|
74
74
|
'Content-Type': 'application/json',
|
|
75
|
-
'x-app-token': this.
|
|
75
|
+
'x-app-token': this.state.token,
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
const response = await fetch(this._getFullPath(`?id=${id}&type=${type}&entity=${entity}${filename ? `&filename=${filename}` : ''}`), options);
|
package/dist/forms/formsApi.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AsyncModules from "../base/asyncModules";
|
|
2
2
|
import { IForms, IFormsEntity } from "./formsInterfaces";
|
|
3
|
-
import
|
|
3
|
+
import StateModule from "../base/stateModule";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for forms objects
|
|
6
6
|
*/
|
|
7
|
-
export default class FormsApi extends
|
|
8
|
-
|
|
7
|
+
export default class FormsApi extends AsyncModules implements IForms {
|
|
8
|
+
protected state: StateModule;
|
|
9
|
+
protected _url: string;
|
|
10
|
+
constructor(state: StateModule);
|
|
9
11
|
/**
|
|
10
12
|
* Get all forms.
|
|
11
13
|
*
|
|
@@ -19,7 +21,7 @@ export default class FormsApi extends OneEntry implements IForms {
|
|
|
19
21
|
/**
|
|
20
22
|
* Get one form by form marker.
|
|
21
23
|
*
|
|
22
|
-
* @param {string}
|
|
24
|
+
* @param {string} marker - Marker of form.
|
|
23
25
|
* @param {string} [langCode] - Language code. Default "en_US"
|
|
24
26
|
*
|
|
25
27
|
* @returns Returns object of type FormEntity
|
package/dist/forms/formsApi.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const asyncModules_1 = require("../base/asyncModules");
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for forms objects
|
|
6
6
|
*/
|
|
7
|
-
class FormsApi extends
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
10
|
-
this._url
|
|
7
|
+
class FormsApi extends asyncModules_1.default {
|
|
8
|
+
constructor(state) {
|
|
9
|
+
super(state);
|
|
10
|
+
this._url = state.url + '/api/content/forms';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Get all forms.
|
|
@@ -18,19 +18,19 @@ class FormsApi extends oneEntry_1.default {
|
|
|
18
18
|
*
|
|
19
19
|
* @returns Returns array for all objects of type FormEntity
|
|
20
20
|
*/
|
|
21
|
-
async getAllForms(langCode = this.
|
|
21
|
+
async getAllForms(langCode = this.state.lang, offset = 0, limit = 30) {
|
|
22
22
|
const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
23
23
|
return this._dataPostProcess(result, langCode);
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Get one form by form marker.
|
|
27
27
|
*
|
|
28
|
-
* @param {string}
|
|
28
|
+
* @param {string} marker - Marker of form.
|
|
29
29
|
* @param {string} [langCode] - Language code. Default "en_US"
|
|
30
30
|
*
|
|
31
31
|
* @returns Returns object of type FormEntity
|
|
32
32
|
*/
|
|
33
|
-
async getFormByMarker(marker, langCode = this.
|
|
33
|
+
async getFormByMarker(marker, langCode = this.state.lang) {
|
|
34
34
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
35
35
|
return this._dataPostProcess(result, langCode);
|
|
36
36
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AsyncModules from '../base/asyncModules';
|
|
2
2
|
import { IFormsPost, IFormsData, IFormsDataEntity } from './formsDataInterfaces';
|
|
3
|
-
import
|
|
3
|
+
import StateModule from "../base/stateModule";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with form data
|
|
6
6
|
*/
|
|
7
|
-
export default class FormsDataApi extends
|
|
8
|
-
|
|
7
|
+
export default class FormsDataApi extends AsyncModules implements IFormsData {
|
|
8
|
+
protected state: StateModule;
|
|
9
|
+
protected _url: string;
|
|
10
|
+
constructor(state: StateModule);
|
|
9
11
|
/**
|
|
10
12
|
* Get all forms data.
|
|
11
13
|
*
|
|
@@ -20,7 +22,7 @@ export default class FormsDataApi extends OneEntry implements IFormsData {
|
|
|
20
22
|
* Find all product page objects with pagination and multiple filtering.
|
|
21
23
|
*
|
|
22
24
|
* @param {object} data - Request body.
|
|
23
|
-
* @param {string} langCode - Optional language field
|
|
25
|
+
* @param {string} [langCode] - Optional language field
|
|
24
26
|
*
|
|
25
27
|
* @example
|
|
26
28
|
* const data = {
|
|
@@ -37,7 +39,7 @@ export default class FormsDataApi extends OneEntry implements IFormsData {
|
|
|
37
39
|
/**
|
|
38
40
|
* Get one object of form data by marker.
|
|
39
41
|
*
|
|
40
|
-
* @param {string}
|
|
42
|
+
* @param {string} marker - Marker of the form data
|
|
41
43
|
* @param {string} [langCode] - Language code. Default "en_US"
|
|
42
44
|
* @param {number} [offset] - Parameter for pagination. Default 0
|
|
43
45
|
* @param {number} [limit] - Parameter for pagination. Default 30
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const asyncModules_1 = require("../base/asyncModules");
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with form data
|
|
6
6
|
*/
|
|
7
|
-
class FormsDataApi extends
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
10
|
-
this._url
|
|
7
|
+
class FormsDataApi extends asyncModules_1.default {
|
|
8
|
+
constructor(state) {
|
|
9
|
+
super(state);
|
|
10
|
+
this._url = state.url + '/api/content/form-data';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Get all forms data.
|
|
@@ -18,7 +18,7 @@ class FormsDataApi extends oneEntry_1.default {
|
|
|
18
18
|
*
|
|
19
19
|
* @returns Returns array for all objects of FormData
|
|
20
20
|
*/
|
|
21
|
-
async getFormsData(langCode = this.
|
|
21
|
+
async getFormsData(langCode = this.state.lang, offset = 0, limit = 30) {
|
|
22
22
|
const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
23
23
|
return this._dataPostProcess(result.items, langCode);
|
|
24
24
|
}
|
|
@@ -26,7 +26,7 @@ class FormsDataApi extends oneEntry_1.default {
|
|
|
26
26
|
* Find all product page objects with pagination and multiple filtering.
|
|
27
27
|
*
|
|
28
28
|
* @param {object} data - Request body.
|
|
29
|
-
* @param {string} langCode - Optional language field
|
|
29
|
+
* @param {string} [langCode] - Optional language field
|
|
30
30
|
*
|
|
31
31
|
* @example
|
|
32
32
|
* const data = {
|
|
@@ -39,7 +39,7 @@ class FormsDataApi extends oneEntry_1.default {
|
|
|
39
39
|
*
|
|
40
40
|
* @returns - Returns created FormData objects.
|
|
41
41
|
*/
|
|
42
|
-
async postFormsData(data, langCode = this.
|
|
42
|
+
async postFormsData(data, langCode = this.state.lang) {
|
|
43
43
|
const formData = {};
|
|
44
44
|
formData[langCode] = Array.isArray(data.formData) ? data.formData : [data.formData];
|
|
45
45
|
data.formData = formData;
|
|
@@ -49,14 +49,14 @@ class FormsDataApi extends oneEntry_1.default {
|
|
|
49
49
|
/**
|
|
50
50
|
* Get one object of form data by marker.
|
|
51
51
|
*
|
|
52
|
-
* @param {string}
|
|
52
|
+
* @param {string} marker - Marker of the form data
|
|
53
53
|
* @param {string} [langCode] - Language code. Default "en_US"
|
|
54
54
|
* @param {number} [offset] - Parameter for pagination. Default 0
|
|
55
55
|
* @param {number} [limit] - Parameter for pagination. Default 30
|
|
56
56
|
*
|
|
57
57
|
* @returns Returns array of object FormDataEntity
|
|
58
58
|
*/
|
|
59
|
-
async getFormsDataByMarker(marker, langCode = this.
|
|
59
|
+
async getFormsDataByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
60
60
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
61
61
|
return this._dataPostProcess(result.items, langCode);
|
|
62
62
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AsyncModules from "../base/asyncModules";
|
|
2
2
|
import { IGeneralTypes, IGeneralTypesEntity } from "./generalTypesInterfaces";
|
|
3
|
-
import
|
|
3
|
+
import StateModule from "../base/stateModule";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with types
|
|
6
6
|
*/
|
|
7
|
-
export default class GeneralTypesApi extends
|
|
8
|
-
|
|
7
|
+
export default class GeneralTypesApi extends AsyncModules implements IGeneralTypes {
|
|
8
|
+
protected state: StateModule;
|
|
9
|
+
protected _url: string;
|
|
10
|
+
constructor(state: StateModule);
|
|
9
11
|
/**
|
|
10
12
|
* Get all types.
|
|
11
13
|
*
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const asyncModules_1 = require("../base/asyncModules");
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with types
|
|
6
6
|
*/
|
|
7
|
-
class GeneralTypesApi extends
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
10
|
-
this._url
|
|
7
|
+
class GeneralTypesApi extends asyncModules_1.default {
|
|
8
|
+
constructor(state) {
|
|
9
|
+
super(state);
|
|
10
|
+
this._url = state.url + '/api/content/general-types';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Get all types.
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ const paymentsApi_1 = require("./payments/paymentsApi");
|
|
|
21
21
|
const authProviderApi_1 = require("./auth-provider/authProviderApi");
|
|
22
22
|
const eventsApi_1 = require("./events/eventsApi");
|
|
23
23
|
const usersApi_1 = require("./users/usersApi");
|
|
24
|
+
const stateModule_1 = require("./base/stateModule");
|
|
24
25
|
/**
|
|
25
26
|
* Define API.
|
|
26
27
|
* @param {string} url - URl of your project.
|
|
@@ -30,26 +31,27 @@ const usersApi_1 = require("./users/usersApi");
|
|
|
30
31
|
* @returns {IDefineApi} - List of methods set.
|
|
31
32
|
*/
|
|
32
33
|
function defineOneEntry(url, config) {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
34
|
+
const stateModule = new stateModule_1.default(url, config);
|
|
35
|
+
const Admins = new adminsApi_1.default(stateModule);
|
|
36
|
+
const AttributesSets = new attributeSetsApi_1.default(stateModule);
|
|
37
|
+
const AuthProvider = new authProviderApi_1.default(stateModule);
|
|
38
|
+
const Blocks = new blocksApi_1.default(stateModule);
|
|
39
|
+
const Events = new eventsApi_1.default(stateModule);
|
|
40
|
+
const FileUploading = new fileUploadingApi_1.default(stateModule);
|
|
41
|
+
const Forms = new formsApi_1.default(stateModule);
|
|
42
|
+
const FormData = new formsDataApi_1.default(stateModule);
|
|
43
|
+
const GeneralTypes = new typesApi_1.default(stateModule);
|
|
44
|
+
const Locales = new localesApi_1.default(stateModule);
|
|
45
|
+
const Menus = new menusApi_1.default(stateModule);
|
|
46
|
+
const Orders = new ordersApi_1.default(stateModule);
|
|
47
|
+
const Pages = new pagesApi_1.default(stateModule);
|
|
48
|
+
const Payments = new paymentsApi_1.default(stateModule);
|
|
49
|
+
const Products = new productsApi_1.default(stateModule);
|
|
50
|
+
const ProductStatuses = new productStatusesApi_1.default(stateModule);
|
|
51
|
+
const System = new systemApi_1.default(stateModule);
|
|
52
|
+
const Templates = new templatesApi_1.default(stateModule);
|
|
53
|
+
const TemplatePreviews = new templatesPreviewApi_1.default(stateModule);
|
|
54
|
+
const Users = new usersApi_1.default(stateModule);
|
|
53
55
|
return {
|
|
54
56
|
Admins,
|
|
55
57
|
AttributesSets,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AsyncModules from "../base/asyncModules";
|
|
2
2
|
import { ILocales, ILocalEntity } from "./localesInterfaces";
|
|
3
|
-
import
|
|
3
|
+
import StateModule from "../base/stateModule";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with localizations (content language)
|
|
6
6
|
*/
|
|
7
|
-
export default class LocalesApi extends
|
|
8
|
-
|
|
7
|
+
export default class LocalesApi extends AsyncModules implements ILocales {
|
|
8
|
+
protected state: StateModule;
|
|
9
|
+
protected _url: string;
|
|
10
|
+
constructor(state: StateModule);
|
|
9
11
|
/**
|
|
10
12
|
* Find all active language localization objects.
|
|
11
13
|
*
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const asyncModules_1 = require("../base/asyncModules");
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with localizations (content language)
|
|
6
6
|
*/
|
|
7
|
-
class LocalesApi extends
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
10
|
-
this._url
|
|
7
|
+
class LocalesApi extends asyncModules_1.default {
|
|
8
|
+
constructor(state) {
|
|
9
|
+
super(state);
|
|
10
|
+
this._url = state.url + '/api/content/locales';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Find all active language localization objects.
|
package/dist/menus/menusApi.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AsyncModules from "../base/asyncModules";
|
|
2
2
|
import { IMenus, IMenusEntity } from "./menusInterfaces";
|
|
3
|
-
import
|
|
3
|
+
import StateModule from "../base/stateModule";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with menu objects
|
|
6
6
|
*/
|
|
7
|
-
export default class MenusApi extends
|
|
8
|
-
|
|
7
|
+
export default class MenusApi extends AsyncModules implements IMenus {
|
|
8
|
+
protected state: StateModule;
|
|
9
|
+
protected _url: string;
|
|
10
|
+
constructor(state: StateModule);
|
|
9
11
|
/**
|
|
10
12
|
* Get pages includes in menu by marker.
|
|
11
13
|
*
|
|
12
|
-
* @param {string}
|
|
14
|
+
* @param {string} marker - Menu marker
|
|
13
15
|
* @param {string} [langCode] - Language code
|
|
14
16
|
*
|
|
15
17
|
* @returns Returns a single menu object as a ContentMenu object with included pages
|
package/dist/menus/menusApi.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const asyncModules_1 = require("../base/asyncModules");
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with menu objects
|
|
6
6
|
*/
|
|
7
|
-
class MenusApi extends
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
10
|
-
this._url
|
|
7
|
+
class MenusApi extends asyncModules_1.default {
|
|
8
|
+
constructor(state) {
|
|
9
|
+
super(state);
|
|
10
|
+
this._url = state.url + '/api/content/menus';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Get pages includes in menu by marker.
|
|
14
14
|
*
|
|
15
|
-
* @param {string}
|
|
15
|
+
* @param {string} marker - Menu marker
|
|
16
16
|
* @param {string} [langCode] - Language code
|
|
17
17
|
*
|
|
18
18
|
* @returns Returns a single menu object as a ContentMenu object with included pages
|
|
19
19
|
*/
|
|
20
|
-
async getMenusByMarker(marker, langCode = this.
|
|
20
|
+
async getMenusByMarker(marker, langCode = this.state.lang) {
|
|
21
21
|
const result = await this._fetchGet(`/marker/${marker}`);
|
|
22
22
|
let pages = result.pages;
|
|
23
23
|
pages = pages.map(page => {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IConfig } from "../base/utils";
|
|
1
|
+
import AsyncModules from "../base/asyncModules";
|
|
3
2
|
import { IOrdersApi, IOrdersEntity, IBaseOrdersEntity, IOrderData, IOrdersByMarkersEntity } from "./ordersInterfaces";
|
|
3
|
+
import StateModule from "../base/stateModule";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with orders
|
|
6
6
|
*/
|
|
7
|
-
export default class OrdersApi extends
|
|
8
|
-
|
|
7
|
+
export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
8
|
+
protected state: StateModule;
|
|
9
|
+
protected _url: string;
|
|
10
|
+
constructor(state: StateModule);
|
|
9
11
|
/**
|
|
10
12
|
* Creation of an order in the order storage.
|
|
11
13
|
*
|
package/dist/orders/ordersApi.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const asyncModules_1 = require("../base/asyncModules");
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with orders
|
|
6
6
|
*/
|
|
7
|
-
class OrdersApi extends
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
10
|
-
this._url
|
|
7
|
+
class OrdersApi extends asyncModules_1.default {
|
|
8
|
+
constructor(state) {
|
|
9
|
+
super(state);
|
|
10
|
+
this._url = state.url + '/api/content/orders-storage';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Creation of an order in the order storage.
|
|
@@ -36,7 +36,7 @@ class OrdersApi extends oneEntry_1.default {
|
|
|
36
36
|
*
|
|
37
37
|
* @returns Returns object for creating an order.
|
|
38
38
|
*/
|
|
39
|
-
async createOrder(marker, data, langCode = this.
|
|
39
|
+
async createOrder(marker, data, langCode = this.state.lang) {
|
|
40
40
|
const formData = {};
|
|
41
41
|
formData[langCode] = Array.isArray(data.formData) ? data.formData : [data.formData];
|
|
42
42
|
data.formData = formData;
|
|
@@ -48,7 +48,7 @@ class OrdersApi extends oneEntry_1.default {
|
|
|
48
48
|
* @param {number} marker - Textual identifier of the order storage object
|
|
49
49
|
* @param {number} [langCode] Optional language field
|
|
50
50
|
*/
|
|
51
|
-
async getAllOrdersByMarker(marker, langCode = this.
|
|
51
|
+
async getAllOrdersByMarker(marker, langCode = this.state.lang) {
|
|
52
52
|
const result = this._fetchGet(`/marker/${marker}/orders?langCode=${langCode}`);
|
|
53
53
|
return this._normalizeData(result.items);
|
|
54
54
|
}
|
|
@@ -77,7 +77,7 @@ class OrdersApi extends oneEntry_1.default {
|
|
|
77
77
|
* "currency": "USD"
|
|
78
78
|
* }
|
|
79
79
|
*/
|
|
80
|
-
async updateOrderByMarkerAndId(marker, id, data, langCode = this.
|
|
80
|
+
async updateOrderByMarkerAndId(marker, id, data, langCode = this.state.lang) {
|
|
81
81
|
const result = await this._fetchPut(`/marker/${marker}/orders/${id}?langCode=${langCode}`, data);
|
|
82
82
|
return this._normalizeData(result);
|
|
83
83
|
}
|
|
@@ -87,7 +87,7 @@ class OrdersApi extends oneEntry_1.default {
|
|
|
87
87
|
* @param {number} [limit] - Optional parameter for pagination, default is 0
|
|
88
88
|
* @param {number} [offset] - Optional parameter for pagination, default is 30
|
|
89
89
|
*/
|
|
90
|
-
async getAllOrders(langCode = this.
|
|
90
|
+
async getAllOrders(langCode = this.state.lang, limit = 30, offset = 0) {
|
|
91
91
|
const result = await this._fetchGet(`?langCode=${langCode}&limit=${limit}&offset=${offset}`);
|
|
92
92
|
return this._normalizeData(result);
|
|
93
93
|
}
|
|
@@ -99,7 +99,7 @@ class OrdersApi extends oneEntry_1.default {
|
|
|
99
99
|
*
|
|
100
100
|
* @returns Return object of order information.
|
|
101
101
|
*/
|
|
102
|
-
async getOrderByMarker(marker, langCode = this.
|
|
102
|
+
async getOrderByMarker(marker, langCode = this.state.lang) {
|
|
103
103
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
104
104
|
return this._normalizeData(result);
|
|
105
105
|
}
|
package/dist/pages/pagesApi.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AsyncModules from "../base/asyncModules";
|
|
2
2
|
import { IPageApi, IPageConfig, IPagesEntity, IPositionForm, IPositionBlock } from "./pagesInterfaces";
|
|
3
|
-
import
|
|
3
|
+
import StateModule from "../base/stateModule";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with page objects, including catalog pages
|
|
6
6
|
*/
|
|
7
|
-
export default class PageApi extends
|
|
8
|
-
|
|
7
|
+
export default class PageApi extends AsyncModules implements IPageApi {
|
|
8
|
+
protected state: StateModule;
|
|
9
|
+
protected _url: string;
|
|
10
|
+
constructor(state: StateModule);
|
|
9
11
|
/**
|
|
10
12
|
* Get all top-level page objects.
|
|
11
13
|
*
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const asyncModules_1 = require("../base/asyncModules");
|
|
4
4
|
const blocksApi_1 = require("../blocks/blocksApi");
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with page objects, including catalog pages
|
|
7
7
|
*/
|
|
8
|
-
class PageApi extends
|
|
9
|
-
constructor(
|
|
10
|
-
super(
|
|
11
|
-
this._url
|
|
8
|
+
class PageApi extends asyncModules_1.default {
|
|
9
|
+
constructor(state) {
|
|
10
|
+
super(state);
|
|
11
|
+
this._url = state.url + '/api/content/pages';
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Get all top-level page objects.
|
|
@@ -17,7 +17,7 @@ class PageApi extends oneEntry_1.default {
|
|
|
17
17
|
*
|
|
18
18
|
* @returns Returns all created pages without parents as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
19
19
|
*/
|
|
20
|
-
async getRootPages(langCode = this.
|
|
20
|
+
async getRootPages(langCode = this.state.lang) {
|
|
21
21
|
const result = await this._fetchGet(`/root?langCode=${langCode}`);
|
|
22
22
|
return this._normalizeData(result, langCode);
|
|
23
23
|
}
|
|
@@ -32,7 +32,7 @@ class PageApi extends oneEntry_1.default {
|
|
|
32
32
|
*
|
|
33
33
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
34
34
|
*/
|
|
35
|
-
async getCatalogPages(langCode = this.
|
|
35
|
+
async getCatalogPages(langCode = this.state.lang, limit = 30, offset = 0) {
|
|
36
36
|
const result = await this._fetchGet(`/catalog?langCode=${langCode}&limit=${limit}&offset=${offset}`);
|
|
37
37
|
return this._normalizeData(result, langCode);
|
|
38
38
|
}
|
|
@@ -43,7 +43,7 @@ class PageApi extends oneEntry_1.default {
|
|
|
43
43
|
*
|
|
44
44
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
45
45
|
*/
|
|
46
|
-
async getPages(langCode = this.
|
|
46
|
+
async getPages(langCode = this.state.lang) {
|
|
47
47
|
const result = await this._fetchGet(`?langCode=${langCode}`);
|
|
48
48
|
return this._normalizeData(result, langCode);
|
|
49
49
|
}
|
|
@@ -56,7 +56,7 @@ class PageApi extends oneEntry_1.default {
|
|
|
56
56
|
*
|
|
57
57
|
* @returns Returns PageEntity object
|
|
58
58
|
*/
|
|
59
|
-
async getPageById(id, langCode = this.
|
|
59
|
+
async getPageById(id, langCode = this.state.lang) {
|
|
60
60
|
const result = await this._fetchGet(`/${id}?langCode=${langCode}`);
|
|
61
61
|
return this._normalizeData(result, langCode);
|
|
62
62
|
}
|
|
@@ -69,7 +69,7 @@ class PageApi extends oneEntry_1.default {
|
|
|
69
69
|
*
|
|
70
70
|
* @returns Returns PageEntity object
|
|
71
71
|
*/
|
|
72
|
-
async getPageByUrl(url, langCode = this.
|
|
72
|
+
async getPageByUrl(url, langCode = this.state.lang) {
|
|
73
73
|
const result = await this._fetchGet(`/url/${url}?langCode=${langCode}`);
|
|
74
74
|
return this._normalizeData(result, langCode);
|
|
75
75
|
}
|
|
@@ -82,7 +82,7 @@ class PageApi extends oneEntry_1.default {
|
|
|
82
82
|
*
|
|
83
83
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
|
|
84
84
|
*/
|
|
85
|
-
async getChildPagesByParentUrl(url, langCode = this.
|
|
85
|
+
async getChildPagesByParentUrl(url, langCode = this.state.lang) {
|
|
86
86
|
const result = await this._fetchGet(`/${url}/children?langCode=${langCode}`);
|
|
87
87
|
return this._normalizeData(result, langCode);
|
|
88
88
|
}
|
|
@@ -95,7 +95,7 @@ class PageApi extends oneEntry_1.default {
|
|
|
95
95
|
*
|
|
96
96
|
* @returns Returns all forms as an array of PositionForm objects or an empty array [] (if there is no data) for the selected parent
|
|
97
97
|
*/
|
|
98
|
-
async getFormsByPageUrl(url, langCode = this.
|
|
98
|
+
async getFormsByPageUrl(url, langCode = this.state.lang) {
|
|
99
99
|
const result = await this._fetchGet(`/${url}/forms?langCode=${langCode}`);
|
|
100
100
|
return this._normalizeData(result, langCode);
|
|
101
101
|
}
|
|
@@ -108,7 +108,7 @@ class PageApi extends oneEntry_1.default {
|
|
|
108
108
|
*
|
|
109
109
|
* @returns Returns all blocks as an array of PositionBlock objects or an empty array [] (if there is no data) for the selected parent
|
|
110
110
|
*/
|
|
111
|
-
async getBlocksByPageUrl(url, langCode = this.
|
|
111
|
+
async getBlocksByPageUrl(url, langCode = this.state.lang) {
|
|
112
112
|
const response = await this._fetchGet(`/${url}/blocks?langCode=${langCode}`);
|
|
113
113
|
const normalizeResponse = this._normalizeData(response);
|
|
114
114
|
normalizeResponse.map((item) => {
|
|
@@ -123,11 +123,8 @@ class PageApi extends oneEntry_1.default {
|
|
|
123
123
|
delete item.attributeSetId;
|
|
124
124
|
return item;
|
|
125
125
|
});
|
|
126
|
-
if (this.
|
|
127
|
-
const Blocks = new blocksApi_1.default(this.
|
|
128
|
-
langCode: this._defaultLangCode,
|
|
129
|
-
token: this._token
|
|
130
|
-
});
|
|
126
|
+
if (this.state.multipleResponse) {
|
|
127
|
+
const Blocks = new blocksApi_1.default(this.state);
|
|
131
128
|
if (normalizeResponse.type === 'forSimilarProductBlock') {
|
|
132
129
|
try {
|
|
133
130
|
await Blocks.getSimilarProducts(normalizeResponse.identifier, langCode).then((result) => {
|
|
@@ -171,7 +168,7 @@ class PageApi extends oneEntry_1.default {
|
|
|
171
168
|
*
|
|
172
169
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
173
170
|
*/
|
|
174
|
-
async searchPage(name, langCode = this.
|
|
171
|
+
async searchPage(name, langCode = this.state.lang) {
|
|
175
172
|
const result = await this._fetchGet(`/quick/search?lang=${langCode}&name=${name}`);
|
|
176
173
|
return this._normalizeData(result, langCode);
|
|
177
174
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IConfig } from "../base/utils";
|
|
1
|
+
import AsyncModules from "../base/asyncModules";
|
|
3
2
|
import { IPaymentsApi, ISessionEntity, IConnectedEntity, IAccountsEntity, ISessionBody } from "./paymentsInterfaces";
|
|
3
|
+
import StateModule from "../base/stateModule";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with payments
|
|
6
6
|
*/
|
|
7
|
-
export default class PaymentsApi extends
|
|
8
|
-
|
|
7
|
+
export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
|
|
8
|
+
protected state: StateModule;
|
|
9
|
+
protected _url: string;
|
|
10
|
+
constructor(state: StateModule);
|
|
9
11
|
/**
|
|
10
12
|
* Get list of payment sessions.
|
|
11
13
|
*
|
|
@@ -71,10 +73,4 @@ export default class PaymentsApi extends OneEntry implements IPaymentsApi {
|
|
|
71
73
|
* @returns Returns true (in case of successful execution) or false (in case of unsuccessful execution)
|
|
72
74
|
*/
|
|
73
75
|
webhookStripe(): Promise<boolean>;
|
|
74
|
-
/**
|
|
75
|
-
* Webhook for Paypal.
|
|
76
|
-
*
|
|
77
|
-
* @returns Returns true (in case of successful execution) or false (in case of unsuccessful execution)
|
|
78
|
-
*/
|
|
79
|
-
webhookPaypal(): Promise<boolean>;
|
|
80
76
|
}
|