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.
Files changed (59) hide show
  1. package/README.md +303 -242
  2. package/dist/_cjs/admins/adminsApi.d.ts +1 -1
  3. package/dist/admins/adminsApi.d.ts +6 -4
  4. package/dist/admins/adminsApi.js +6 -6
  5. package/dist/attribute-sets/attributeSetsApi.d.ts +6 -4
  6. package/dist/attribute-sets/attributeSetsApi.js +7 -7
  7. package/dist/auth-provider/authProviderApi.d.ts +6 -4
  8. package/dist/auth-provider/authProviderApi.js +14 -10
  9. package/dist/auth-provider/authProvidersInterfaces.d.ts +2 -2
  10. package/dist/base/asyncModules.d.ts +16 -0
  11. package/dist/base/asyncModules.js +164 -0
  12. package/dist/base/modules.d.ts +14 -0
  13. package/dist/base/modules.js +173 -0
  14. package/dist/base/oneEntry.d.ts +0 -23
  15. package/dist/base/oneEntry.js +74 -236
  16. package/dist/base/stateModule.d.ts +10 -0
  17. package/dist/base/stateModule.js +13 -0
  18. package/dist/base/syncModules.d.ts +14 -0
  19. package/dist/base/syncModules.js +72 -0
  20. package/dist/blocks/blocksApi.d.ts +9 -6
  21. package/dist/blocks/blocksApi.js +17 -16
  22. package/dist/blocks/blocksInterfaces.d.ts +3 -2
  23. package/dist/events/eventsApi.d.ts +6 -4
  24. package/dist/events/eventsApi.js +5 -5
  25. package/dist/file-uploding/fileUploadingApi.d.ts +6 -4
  26. package/dist/file-uploding/fileUploadingApi.js +6 -6
  27. package/dist/forms/formsApi.d.ts +7 -5
  28. package/dist/forms/formsApi.js +8 -8
  29. package/dist/formsData/formsDataApi.d.ts +8 -6
  30. package/dist/formsData/formsDataApi.js +10 -10
  31. package/dist/general-types/typesApi.d.ts +6 -4
  32. package/dist/general-types/typesApi.js +5 -5
  33. package/dist/index.js +22 -20
  34. package/dist/locales/localesApi.d.ts +6 -4
  35. package/dist/locales/localesApi.js +5 -5
  36. package/dist/menus/menusApi.d.ts +7 -5
  37. package/dist/menus/menusApi.js +7 -7
  38. package/dist/orders/ordersApi.d.ts +6 -4
  39. package/dist/orders/ordersApi.js +10 -10
  40. package/dist/pages/pagesApi.d.ts +6 -4
  41. package/dist/pages/pagesApi.js +16 -19
  42. package/dist/payments/paymentsApi.d.ts +6 -10
  43. package/dist/payments/paymentsApi.js +5 -14
  44. package/dist/payments/paymentsInterfaces.d.ts +0 -2
  45. package/dist/product-statuses/productStatusesApi.d.ts +6 -4
  46. package/dist/product-statuses/productStatusesApi.js +8 -8
  47. package/dist/products/productsApi.d.ts +107 -52
  48. package/dist/products/productsApi.js +119 -65
  49. package/dist/products/productsInterfaces.d.ts +16 -8
  50. package/dist/system/systemApi.d.ts +6 -4
  51. package/dist/system/systemApi.js +5 -5
  52. package/dist/templates/templatesApi.d.ts +9 -6
  53. package/dist/templates/templatesApi.js +9 -9
  54. package/dist/templates/templatesInterfaces.d.ts +2 -1
  55. package/dist/templates-preview/templatesPreviewApi.d.ts +8 -6
  56. package/dist/templates-preview/templatesPreviewApi.js +10 -10
  57. package/dist/users/usersApi.d.ts +6 -4
  58. package/dist/users/usersApi.js +7 -7
  59. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const oneEntry_1 = require("../base/oneEntry");
3
+ const asyncModules_1 = require("../base/asyncModules");
4
4
  /**
5
5
  * Controllers for working with file uploading
6
6
  */
7
- class FileUploadingApi extends oneEntry_1.default {
8
- constructor(url, config) {
9
- super(url, config);
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 += '/api/content/files';
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._token,
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);
@@ -1,11 +1,13 @@
1
- import OneEntry from "../base/oneEntry";
1
+ import AsyncModules from "../base/asyncModules";
2
2
  import { IForms, IFormsEntity } from "./formsInterfaces";
3
- import { IConfig } from "../base/utils";
3
+ import StateModule from "../base/stateModule";
4
4
  /**
5
5
  * Controllers for forms objects
6
6
  */
7
- export default class FormsApi extends OneEntry implements IForms {
8
- constructor(url: string, config: IConfig);
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} [marker] - Marker of form.
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
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const oneEntry_1 = require("../base/oneEntry");
3
+ const asyncModules_1 = require("../base/asyncModules");
4
4
  /**
5
5
  * Controllers for forms objects
6
6
  */
7
- class FormsApi extends oneEntry_1.default {
8
- constructor(url, config) {
9
- super(url, config);
10
- this._url += '/api/content/forms';
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._defaultLangCode, offset = 0, limit = 30) {
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} [marker] - Marker of form.
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._defaultLangCode) {
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 OneEntry from '../base/oneEntry';
1
+ import AsyncModules from '../base/asyncModules';
2
2
  import { IFormsPost, IFormsData, IFormsDataEntity } from './formsDataInterfaces';
3
- import { IConfig } from "../base/utils";
3
+ import StateModule from "../base/stateModule";
4
4
  /**
5
5
  * Controllers for working with form data
6
6
  */
7
- export default class FormsDataApi extends OneEntry implements IFormsData {
8
- constructor(url: string, config: IConfig);
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} [marker] - Marker of the form data
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 oneEntry_1 = require("../base/oneEntry");
3
+ const asyncModules_1 = require("../base/asyncModules");
4
4
  /**
5
5
  * Controllers for working with form data
6
6
  */
7
- class FormsDataApi extends oneEntry_1.default {
8
- constructor(url, config) {
9
- super(url, config);
10
- this._url += '/api/content/form-data';
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._defaultLangCode, offset = 0, limit = 30) {
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._defaultLangCode) {
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} [marker] - Marker of the form data
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._defaultLangCode, offset = 0, limit = 30) {
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 OneEntry from "../base/oneEntry";
1
+ import AsyncModules from "../base/asyncModules";
2
2
  import { IGeneralTypes, IGeneralTypesEntity } from "./generalTypesInterfaces";
3
- import { IConfig } from "../base/utils";
3
+ import StateModule from "../base/stateModule";
4
4
  /**
5
5
  * Controllers for working with types
6
6
  */
7
- export default class GeneralTypesApi extends OneEntry implements IGeneralTypes {
8
- constructor(url: string, config: IConfig);
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 oneEntry_1 = require("../base/oneEntry");
3
+ const asyncModules_1 = require("../base/asyncModules");
4
4
  /**
5
5
  * Controllers for working with types
6
6
  */
7
- class GeneralTypesApi extends oneEntry_1.default {
8
- constructor(url, config) {
9
- super(url, config);
10
- this._url += '/api/content/general-types';
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 Admins = new adminsApi_1.default(url, config);
34
- const AttributesSets = new attributeSetsApi_1.default(url, config);
35
- const AuthProvider = new authProviderApi_1.default(url, config);
36
- const Blocks = new blocksApi_1.default(url, config);
37
- const Events = new eventsApi_1.default(url, config);
38
- const FileUploading = new fileUploadingApi_1.default(url, config);
39
- const Forms = new formsApi_1.default(url, config);
40
- const FormData = new formsDataApi_1.default(url, config);
41
- const GeneralTypes = new typesApi_1.default(url, config);
42
- const Locales = new localesApi_1.default(url, config);
43
- const Menus = new menusApi_1.default(url, config);
44
- const Orders = new ordersApi_1.default(url, config);
45
- const Pages = new pagesApi_1.default(url, config);
46
- const Payments = new paymentsApi_1.default(url, config);
47
- const Products = new productsApi_1.default(url, config);
48
- const ProductStatuses = new productStatusesApi_1.default(url, config);
49
- const System = new systemApi_1.default(url, config);
50
- const Templates = new templatesApi_1.default(url, config);
51
- const TemplatePreviews = new templatesPreviewApi_1.default(url, config);
52
- const Users = new usersApi_1.default(url, config);
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 OneEntry from "../base/oneEntry";
1
+ import AsyncModules from "../base/asyncModules";
2
2
  import { ILocales, ILocalEntity } from "./localesInterfaces";
3
- import { IConfig } from "../base/utils";
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 OneEntry implements ILocales {
8
- constructor(url: string, config: IConfig);
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 oneEntry_1 = require("../base/oneEntry");
3
+ const asyncModules_1 = require("../base/asyncModules");
4
4
  /**
5
5
  * Controllers for working with localizations (content language)
6
6
  */
7
- class LocalesApi extends oneEntry_1.default {
8
- constructor(url, config) {
9
- super(url, config);
10
- this._url += '/api/content/locales';
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.
@@ -1,15 +1,17 @@
1
- import OneEntry from "../base/oneEntry";
1
+ import AsyncModules from "../base/asyncModules";
2
2
  import { IMenus, IMenusEntity } from "./menusInterfaces";
3
- import { IConfig } from "../base/utils";
3
+ import StateModule from "../base/stateModule";
4
4
  /**
5
5
  * Controllers for working with menu objects
6
6
  */
7
- export default class MenusApi extends OneEntry implements IMenus {
8
- constructor(url: string, config: IConfig);
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} [marker] - Menu marker
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
@@ -1,23 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const oneEntry_1 = require("../base/oneEntry");
3
+ const asyncModules_1 = require("../base/asyncModules");
4
4
  /**
5
5
  * Controllers for working with menu objects
6
6
  */
7
- class MenusApi extends oneEntry_1.default {
8
- constructor(url, config) {
9
- super(url, config);
10
- this._url += '/api/content/menus';
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} [marker] - Menu marker
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._defaultLangCode) {
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 OneEntry from "../base/oneEntry";
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 OneEntry implements IOrdersApi {
8
- constructor(url: string, config: IConfig);
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
  *
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const oneEntry_1 = require("../base/oneEntry");
3
+ const asyncModules_1 = require("../base/asyncModules");
4
4
  /**
5
5
  * Controllers for working with orders
6
6
  */
7
- class OrdersApi extends oneEntry_1.default {
8
- constructor(url, config) {
9
- super(url, config);
10
- this._url += '/api/content/orders-storage';
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._defaultLangCode) {
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._defaultLangCode) {
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._defaultLangCode) {
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._defaultLangCode, limit = 30, offset = 0) {
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._defaultLangCode) {
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
  }
@@ -1,11 +1,13 @@
1
- import OneEntry from "../base/oneEntry";
1
+ import AsyncModules from "../base/asyncModules";
2
2
  import { IPageApi, IPageConfig, IPagesEntity, IPositionForm, IPositionBlock } from "./pagesInterfaces";
3
- import { IConfig } from "../base/utils";
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 OneEntry implements IPageApi {
8
- constructor(url: string, config: IConfig);
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
  *
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const oneEntry_1 = require("../base/oneEntry");
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 oneEntry_1.default {
9
- constructor(url, config) {
10
- super(url, config);
11
- this._url += '/api/content/pages';
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._defaultLangCode) {
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._defaultLangCode, limit = 30, offset = 0) {
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._defaultLangCode) {
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._defaultLangCode) {
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._defaultLangCode) {
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._defaultLangCode) {
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._defaultLangCode) {
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._defaultLangCode) {
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._multipleResponse) {
127
- const Blocks = new blocksApi_1.default(this._url.split('/api')[0], {
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._defaultLangCode) {
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 OneEntry from "../base/oneEntry";
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 OneEntry implements IPaymentsApi {
8
- constructor(url: string, config: IConfig);
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
  }