oneentry 1.0.89 → 1.0.91

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 (50) hide show
  1. package/README.md +208 -31
  2. package/dist/admins/adminsApi.d.ts +2 -1
  3. package/dist/admins/adminsInterfaces.d.ts +2 -2
  4. package/dist/attribute-sets/attributeSetsApi.d.ts +3 -2
  5. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +3 -2
  6. package/dist/auth-provider/authProviderApi.d.ts +11 -10
  7. package/dist/auth-provider/authProvidersInterfaces.d.ts +11 -11
  8. package/dist/base/asyncModules.js +1 -1
  9. package/dist/blocks/blocksApi.d.ts +4 -3
  10. package/dist/blocks/blocksInterfaces.d.ts +4 -4
  11. package/dist/events/eventsApi.d.ts +3 -2
  12. package/dist/events/eventsInterfaces.d.ts +3 -2
  13. package/dist/file-uploding/fileUploadingApi.d.ts +4 -3
  14. package/dist/file-uploding/fileUploadingInterfaces.d.ts +4 -3
  15. package/dist/forms/formsApi.d.ts +3 -2
  16. package/dist/forms/formsInterfaces.d.ts +3 -3
  17. package/dist/formsData/formsDataApi.d.ts +4 -3
  18. package/dist/formsData/formsDataInterfaces.d.ts +4 -3
  19. package/dist/general-types/generalTypesInterfaces.d.ts +2 -2
  20. package/dist/general-types/typesApi.d.ts +2 -1
  21. package/dist/index.d.ts +2 -0
  22. package/dist/index.js +4 -1
  23. package/dist/locales/localesApi.d.ts +2 -1
  24. package/dist/locales/localesInterfaces.d.ts +2 -1
  25. package/dist/menus/menusApi.d.ts +2 -1
  26. package/dist/menus/menusApi.js +1 -17
  27. package/dist/menus/menusInterfaces.d.ts +2 -1
  28. package/dist/orders/ordersApi.d.ts +7 -6
  29. package/dist/orders/ordersInterfaces.d.ts +7 -6
  30. package/dist/pages/pagesApi.d.ts +10 -9
  31. package/dist/pages/pagesInterfaces.d.ts +14 -12
  32. package/dist/payments/paymentsApi.d.ts +8 -7
  33. package/dist/payments/paymentsInterfaces.d.ts +8 -7
  34. package/dist/product-statuses/productStatusesApi.d.ts +5 -4
  35. package/dist/product-statuses/productStatusesInterfaces.d.ts +5 -4
  36. package/dist/products/productsApi.d.ts +10 -9
  37. package/dist/products/productsInterfaces.d.ts +10 -10
  38. package/dist/templates/templatesApi.d.ts +12 -4
  39. package/dist/templates/templatesApi.js +18 -7
  40. package/dist/templates/templatesInterfaces.d.ts +10 -4
  41. package/dist/templates-preview/templatesPreviewApi.d.ts +4 -3
  42. package/dist/templates-preview/templatesPreviewApi.js +3 -3
  43. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +9 -3
  44. package/dist/users/usersApi.d.ts +5 -4
  45. package/dist/users/usersInterfaces.d.ts +5 -4
  46. package/dist/web-socket/wsApi.d.ts +3 -2
  47. package/dist/web-socket/wsApi.js +2 -2
  48. package/dist/web-socket/wsInterfaces.d.ts +9 -0
  49. package/dist/web-socket/wsInterfaces.js +2 -0
  50. package/package.json +2 -1
@@ -1,5 +1,6 @@
1
1
  import AsyncModules from "../base/asyncModules";
2
2
  import { IForms, IFormsEntity } from "./formsInterfaces";
3
+ import { IError } from "../base/utils";
3
4
  import StateModule from "../base/stateModule";
4
5
  /**
5
6
  * Controllers for forms objects
@@ -17,7 +18,7 @@ export default class FormsApi extends AsyncModules implements IForms {
17
18
  *
18
19
  * @returns Returns array for all objects of type FormEntity
19
20
  */
20
- getAllForms(langCode?: string, offset?: number, limit?: number): Promise<Array<IFormsEntity>>;
21
+ getAllForms(langCode?: string, offset?: number, limit?: number): Promise<Array<IFormsEntity> | IError>;
21
22
  /**
22
23
  * Get one form by form marker.
23
24
  *
@@ -26,5 +27,5 @@ export default class FormsApi extends AsyncModules implements IForms {
26
27
  *
27
28
  * @returns Returns object of type FormEntity
28
29
  */
29
- getFormByMarker(marker: string, langCode?: string): Promise<IFormsEntity>;
30
+ getFormByMarker(marker: string, langCode?: string): Promise<IFormsEntity | IError>;
30
31
  }
@@ -1,4 +1,4 @@
1
- import { IAttributes } from "../base/utils";
1
+ import { IAttributes, IError } from "../base/utils";
2
2
  /**
3
3
  * Represents an interface object of Forms Api.
4
4
  *
@@ -7,8 +7,8 @@ import { IAttributes } from "../base/utils";
7
7
  * @property {function} getFormByMarker - Get one form by form marker.
8
8
  */
9
9
  interface IForms {
10
- getAllForms(langCode: string, offset?: number, limit?: number): Promise<Array<IFormsEntity>>;
11
- getFormByMarker(marker: string, langCode: string): Promise<IFormsEntity>;
10
+ getAllForms(langCode: string, offset?: number, limit?: number): Promise<Array<IFormsEntity> | IError>;
11
+ getFormByMarker(marker: string, langCode: string): Promise<IFormsEntity | IError>;
12
12
  }
13
13
  /**
14
14
  * Represents an object with various properties.
@@ -1,6 +1,7 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import { IFormsPost, IFormsData, IFormsDataEntity, IFormDataEntity } from './formsDataInterfaces';
3
3
  import StateModule from "../base/stateModule";
4
+ import { IError } from "../base/utils";
4
5
  /**
5
6
  * Controllers for working with form data
6
7
  */
@@ -17,7 +18,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
17
18
  *
18
19
  * @returns Returns array for all objects of FormData
19
20
  */
20
- getFormsData(langCode?: string, offset?: number, limit?: number): Promise<IFormsDataEntity>;
21
+ getFormsData(langCode?: string, offset?: number, limit?: number): Promise<IFormsDataEntity | IError>;
21
22
  /**
22
23
  * Find all product page objects with pagination and multiple filtering.
23
24
  *
@@ -36,7 +37,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
36
37
  *
37
38
  * @returns - Returns created FormData objects.
38
39
  */
39
- postFormsData(data: IFormsPost, langCode?: string): Promise<IFormDataEntity>;
40
+ postFormsData(data: IFormsPost, langCode?: string): Promise<IFormDataEntity | IError>;
40
41
  /**
41
42
  * Get one object of form data by marker.
42
43
  *
@@ -47,5 +48,5 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
47
48
  *
48
49
  * @returns Returns array of object FormDataEntity
49
50
  */
50
- getFormsDataByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IFormsDataEntity>;
51
+ getFormsDataByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IFormsDataEntity | IError>;
51
52
  }
@@ -1,3 +1,4 @@
1
+ import { IError } from "../base/utils";
1
2
  /**
2
3
  * Represents a interface object of Forms Api.
3
4
  *
@@ -6,9 +7,9 @@
6
7
  * @property {function} getFormsDataByMarker - Get one object of form data by marker.
7
8
  */
8
9
  interface IFormsData {
9
- getFormsData(langCode: string, offset?: number, limit?: number): Promise<IFormsDataEntity>;
10
- postFormsData(data: IFormsPost, langCode?: string): Promise<IFormDataEntity>;
11
- getFormsDataByMarker(marker: string, langCode: string, offset?: number, limit?: number): Promise<IFormsDataEntity>;
10
+ getFormsData(langCode: string, offset?: number, limit?: number): Promise<IFormsDataEntity | IError>;
11
+ postFormsData(data: IFormsPost, langCode?: string): Promise<IFormDataEntity | IError>;
12
+ getFormsDataByMarker(marker: string, langCode: string, offset?: number, limit?: number): Promise<IFormsDataEntity | IError>;
12
13
  }
13
14
  /**
14
15
  * Represents a form data.
@@ -1,11 +1,11 @@
1
- import { Types } from "../base/utils";
1
+ import { IError, Types } from "../base/utils";
2
2
  /**
3
3
  * Represents an interface object of General Type Api.
4
4
  *
5
5
  * @property {function} getAllTypes - Get all types.
6
6
  */
7
7
  interface IGeneralTypes {
8
- getAllTypes(): Promise<Array<IGeneralTypesEntity>>;
8
+ getAllTypes(): Promise<Array<IGeneralTypesEntity> | IError>;
9
9
  }
10
10
  /**
11
11
  * Represents a general types object.
@@ -1,6 +1,7 @@
1
1
  import AsyncModules from "../base/asyncModules";
2
2
  import { IGeneralTypes, IGeneralTypesEntity } from "./generalTypesInterfaces";
3
3
  import StateModule from "../base/stateModule";
4
+ import { IError } from "../base/utils";
4
5
  /**
5
6
  * Controllers for working with types
6
7
  */
@@ -13,5 +14,5 @@ export default class GeneralTypesApi extends AsyncModules implements IGeneralTyp
13
14
  *
14
15
  * @returns Returns all objects of type GeneralTypeEntity
15
16
  */
16
- getAllTypes(): Promise<Array<IGeneralTypesEntity>>;
17
+ getAllTypes(): Promise<Array<IGeneralTypesEntity> | IError>;
17
18
  }
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ import PaymentsApi from "./payments/paymentsApi";
19
19
  import AuthProviderApi from "./auth-provider/authProviderApi";
20
20
  import EventsApi from "./events/eventsApi";
21
21
  import UsersApi from "./users/usersApi";
22
+ import WsApi from "./web-socket/wsApi";
22
23
  interface IDefineApi {
23
24
  Admins: AdminsApi;
24
25
  AttributesSets: AttributesSetsApi;
@@ -40,6 +41,7 @@ interface IDefineApi {
40
41
  Templates: TemplatesApi;
41
42
  TemplatePreviews: TemplatePreviewsApi;
42
43
  Users: UsersApi;
44
+ WS: WsApi;
43
45
  }
44
46
  /**
45
47
  * Define API.
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ const authProviderApi_1 = require("./auth-provider/authProviderApi");
22
22
  const eventsApi_1 = require("./events/eventsApi");
23
23
  const usersApi_1 = require("./users/usersApi");
24
24
  const stateModule_1 = require("./base/stateModule");
25
+ const wsApi_1 = require("./web-socket/wsApi");
25
26
  /**
26
27
  * Define API.
27
28
  * @param {string} url - URl of your project.
@@ -57,6 +58,7 @@ function defineOneEntry(url, config) {
57
58
  const Templates = new templatesApi_1.default(stateModule);
58
59
  const TemplatePreviews = new templatesPreviewApi_1.default(stateModule);
59
60
  const Users = new usersApi_1.default(stateModule);
61
+ const WS = new wsApi_1.default(stateModule);
60
62
  return {
61
63
  Admins,
62
64
  AttributesSets,
@@ -77,7 +79,8 @@ function defineOneEntry(url, config) {
77
79
  System,
78
80
  Templates,
79
81
  TemplatePreviews,
80
- Users
82
+ Users,
83
+ WS
81
84
  };
82
85
  }
83
86
  exports.defineOneEntry = defineOneEntry;
@@ -1,5 +1,6 @@
1
1
  import AsyncModules from "../base/asyncModules";
2
2
  import { ILocales, ILocalEntity } from "./localesInterfaces";
3
+ import { IError } from "../base/utils";
3
4
  import StateModule from "../base/stateModule";
4
5
  /**
5
6
  * Controllers for working with localizations (content language)
@@ -13,5 +14,5 @@ export default class LocalesApi extends AsyncModules implements ILocales {
13
14
  *
14
15
  * @returns Returns an array of LocaleEntity objects
15
16
  */
16
- getLocales(): Promise<Array<ILocalEntity>>;
17
+ getLocales(): Promise<Array<ILocalEntity> | IError>;
17
18
  }
@@ -1,10 +1,11 @@
1
+ import { IError } from "../base/utils";
1
2
  /**
2
3
  * Represents an interface object of Locales Api.
3
4
  *
4
5
  * @property {function} getLocales - Find all active language localization objects.
5
6
  */
6
7
  interface ILocales {
7
- getLocales(): Promise<Array<ILocalEntity>>;
8
+ getLocales(): Promise<Array<ILocalEntity> | IError>;
8
9
  }
9
10
  /**
10
11
  * Represents a locales object.
@@ -1,5 +1,6 @@
1
1
  import AsyncModules from "../base/asyncModules";
2
2
  import { IMenus, IMenusEntity } from "./menusInterfaces";
3
+ import { IError } from "../base/utils";
3
4
  import StateModule from "../base/stateModule";
4
5
  /**
5
6
  * Controllers for working with menu objects
@@ -16,5 +17,5 @@ export default class MenusApi extends AsyncModules implements IMenus {
16
17
  *
17
18
  * @returns Returns a single menu object as a ContentMenu object with included pages
18
19
  */
19
- getMenusByMarker(marker: string, langCode?: string): Promise<IMenusEntity>;
20
+ getMenusByMarker(marker: string, langCode?: string): Promise<IMenusEntity | IError>;
20
21
  }
@@ -18,23 +18,7 @@ class MenusApi extends asyncModules_1.default {
18
18
  * @returns Returns a single menu object as a ContentMenu object with included pages
19
19
  */
20
20
  async getMenusByMarker(marker, langCode = this.state.lang) {
21
- const result = await this._fetchGet(`/marker/${marker}`);
22
- let pages = result.pages;
23
- pages = pages.map(page => {
24
- page = this._normalizeData(page, langCode);
25
- for (const key in page.localizeInfos) {
26
- if (key !== 'menuTitle') {
27
- delete page.localizeInfos[key];
28
- }
29
- }
30
- const children = pages.filter(child => child.parentId === page.id);
31
- if (children.length) {
32
- const normalizeChildren = children.map(child => this._normalizeData(child, langCode));
33
- page.children = normalizeChildren;
34
- }
35
- return page;
36
- });
37
- result.pages = pages;
21
+ const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
38
22
  return this._dataPostProcess(result, langCode);
39
23
  }
40
24
  }
@@ -1,10 +1,11 @@
1
+ import { IError } from "../base/utils";
1
2
  /**
2
3
  * Represents an interface object of Menus Api.
3
4
  *
4
5
  * @property {function} getAdminsInfo - Get pages includes in menu by marker.
5
6
  */
6
7
  interface IMenus {
7
- getMenusByMarker(marker: string, langCode: string): Promise<IMenusEntity>;
8
+ getMenusByMarker(marker: string, langCode: string): Promise<IMenusEntity | IError>;
8
9
  }
9
10
  /**
10
11
  * Represents a position object.
@@ -1,6 +1,7 @@
1
1
  import AsyncModules from "../base/asyncModules";
2
2
  import { IOrdersApi, IOrdersEntity, IBaseOrdersEntity, IOrderData, IOrdersByMarkerEntity, IOrderByMarkerEntity } from "./ordersInterfaces";
3
3
  import StateModule from "../base/stateModule";
4
+ import { IError } from "../base/utils";
4
5
  /**
5
6
  * Controllers for working with orders
6
7
  */
@@ -36,7 +37,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
36
37
  *
37
38
  * @returns Returns object for creating an order.
38
39
  */
39
- createOrder(marker: string, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
40
+ createOrder(marker: string, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity | IError>;
40
41
  /**
41
42
  * Getting all orders from the orders storage object created by the user
42
43
  *
@@ -46,7 +47,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
46
47
  * @param {number} [limit] Limit parameter. Default 30
47
48
  * @param {number} [offset] Offset parameter. Default 0
48
49
  */
49
- getAllOrdersByMarker(marker: string, langCode?: string, limit?: number, offset?: number): Promise<IOrdersByMarkerEntity>;
50
+ getAllOrdersByMarker(marker: string, langCode?: string, limit?: number, offset?: number): Promise<IOrdersByMarkerEntity | IError>;
50
51
  /**
51
52
  * Changing an order in the orders storage
52
53
  *
@@ -74,7 +75,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
74
75
  * "currency": "USD"
75
76
  * }
76
77
  */
77
- updateOrderByMarkerAndId(marker: string, id: number, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
78
+ updateOrderByMarkerAndId(marker: string, id: number, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity | IError>;
78
79
  /**
79
80
  * Getting a single order from the order storage object created by the user
80
81
  *
@@ -83,7 +84,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
83
84
  * @param langCode Optional language field
84
85
  *
85
86
  */
86
- getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<IOrderByMarkerEntity>;
87
+ getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<IOrderByMarkerEntity | IError>;
87
88
  /**
88
89
  * Getting all the order storage objects
89
90
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
@@ -92,7 +93,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
92
93
  * @param {number} [limit] - Optional parameter for pagination, default is 0
93
94
  * @param {number} [offset] - Optional parameter for pagination, default is 30
94
95
  */
95
- getAllOrdersStorage(langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersEntity>>;
96
+ getAllOrdersStorage(langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersEntity> | IError>;
96
97
  /**
97
98
  * Retrieve one order storage object by marker.
98
99
  *
@@ -102,5 +103,5 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
102
103
  *
103
104
  * @returns Return object of order information.
104
105
  */
105
- getOrderByMarker(marker: string, langCode?: string): Promise<IOrdersEntity>;
106
+ getOrderByMarker(marker: string, langCode?: string): Promise<IOrdersEntity | IError>;
106
107
  }
@@ -1,3 +1,4 @@
1
+ import { IError } from "../base/utils";
1
2
  /**
2
3
  * Represents an interface object of Orders Api.
3
4
  *
@@ -11,12 +12,12 @@
11
12
 
12
13
  */
13
14
  interface IOrdersApi {
14
- createOrder(marker: string, data: IOrderData): Promise<IBaseOrdersEntity>;
15
- getAllOrdersByMarker(marker: string, langCode?: string, limit?: number, offset?: number): Promise<IOrdersByMarkerEntity>;
16
- getOrderByMarker(marker: string, langCode?: string): Promise<IOrdersEntity>;
17
- updateOrderByMarkerAndId(marker: string, id: number, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
18
- getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<IOrderByMarkerEntity>;
19
- getAllOrdersStorage(langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersEntity>>;
15
+ createOrder(marker: string, data: IOrderData): Promise<IBaseOrdersEntity | IError>;
16
+ getAllOrdersByMarker(marker: string, langCode?: string, limit?: number, offset?: number): Promise<IOrdersByMarkerEntity | IError>;
17
+ getOrderByMarker(marker: string, langCode?: string): Promise<IOrdersEntity | IError>;
18
+ updateOrderByMarkerAndId(marker: string, id: number, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity | IError>;
19
+ getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<IOrderByMarkerEntity | IError>;
20
+ getAllOrdersStorage(langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersEntity> | IError>;
20
21
  }
21
22
  /**
22
23
  * Represents a form data.
@@ -1,6 +1,7 @@
1
1
  import AsyncModules from "../base/asyncModules";
2
2
  import { IPageApi, IPageConfig, IPagesEntity, IPositionForm, IPositionBlock } from "./pagesInterfaces";
3
3
  import StateModule from "../base/stateModule";
4
+ import { IError } from "../base/utils";
4
5
  /**
5
6
  * Controllers for working with page objects, including catalog pages
6
7
  */
@@ -15,7 +16,7 @@ export default class PageApi extends AsyncModules implements IPageApi {
15
16
  *
16
17
  * @returns Returns all created pages without parents as an array of PageEntity objects or an empty array [] (if there is no data)
17
18
  */
18
- getRootPages(langCode?: string): Promise<Array<IPagesEntity>>;
19
+ getRootPages(langCode?: string): Promise<Array<IPagesEntity> | IError>;
19
20
  /**
20
21
  * Get all page objects with product information as an array.
21
22
  *
@@ -23,7 +24,7 @@ export default class PageApi extends AsyncModules implements IPageApi {
23
24
  *
24
25
  * @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
25
26
  */
26
- getPages(langCode?: string): Promise<Array<IPagesEntity>>;
27
+ getPages(langCode?: string): Promise<Array<IPagesEntity> | IError>;
27
28
  /**
28
29
  * Get page object with information about forms, blocks, menus, linked to the page.
29
30
  *
@@ -33,7 +34,7 @@ export default class PageApi extends AsyncModules implements IPageApi {
33
34
  *
34
35
  * @returns Returns PageEntity object
35
36
  */
36
- getPageById(id: number, langCode?: string): Promise<IPagesEntity>;
37
+ getPageById(id: number, langCode?: string): Promise<IPagesEntity | IError>;
37
38
  /**
38
39
  * Get page object with information about forms, blocks, menus, linked to the page by URL.
39
40
  *
@@ -43,7 +44,7 @@ export default class PageApi extends AsyncModules implements IPageApi {
43
44
  *
44
45
  * @returns Returns PageEntity object
45
46
  */
46
- getPageByUrl(url: string, langCode?: string): Promise<IPagesEntity>;
47
+ getPageByUrl(url: string, langCode?: string): Promise<IPagesEntity | IError>;
47
48
  /**
48
49
  * Get child pages object with information as an array.
49
50
  *
@@ -53,7 +54,7 @@ export default class PageApi extends AsyncModules implements IPageApi {
53
54
  *
54
55
  * @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
55
56
  */
56
- getChildPagesByParentUrl(url: string, langCode?: string): Promise<Array<IPagesEntity>>;
57
+ getChildPagesByParentUrl(url: string, langCode?: string): Promise<Array<IPagesEntity> | IError>;
57
58
  /**
58
59
  * Get all forms by page url.
59
60
  *
@@ -63,7 +64,7 @@ export default class PageApi extends AsyncModules implements IPageApi {
63
64
  *
64
65
  * @returns Returns all forms as an array of PositionForm objects or an empty array [] (if there is no data) for the selected parent
65
66
  */
66
- getFormsByPageUrl(url: string, langCode?: string): Promise<Array<IPositionForm>>;
67
+ getFormsByPageUrl(url: string, langCode?: string): Promise<Array<IPositionForm> | IError>;
67
68
  /**
68
69
  * Get all blocks by page url.
69
70
  *
@@ -73,7 +74,7 @@ export default class PageApi extends AsyncModules implements IPageApi {
73
74
  *
74
75
  * @returns Returns all blocks as an array of PositionBlock objects or an empty array [] (if there is no data) for the selected parent
75
76
  */
76
- getBlocksByPageUrl(url: string, langCode?: string): Promise<Array<IPositionBlock>>;
77
+ getBlocksByPageUrl(url: string, langCode?: string): Promise<Array<IPositionBlock> | IError>;
77
78
  /**
78
79
  * Get settings for the page.
79
80
  *
@@ -81,7 +82,7 @@ export default class PageApi extends AsyncModules implements IPageApi {
81
82
  *
82
83
  * @returns Returns a ConfigPage object with page display settings
83
84
  */
84
- getConfigPageByUrl(url: string): Promise<IPageConfig>;
85
+ getConfigPageByUrl(url: string): Promise<IPageConfig | IError>;
85
86
  /**
86
87
  * Quick search for page objects with limited output.
87
88
  *
@@ -91,5 +92,5 @@ export default class PageApi extends AsyncModules implements IPageApi {
91
92
  *
92
93
  * @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
93
94
  */
94
- searchPage(name: string, langCode?: string): Promise<Array<IPagesEntity>>;
95
+ searchPage(name: string, langCode?: string): Promise<Array<IPagesEntity> | IError>;
95
96
  }
@@ -1,4 +1,4 @@
1
- import { AttributeType, IAttributes, LangType, Types } from "../base/utils";
1
+ import { AttributeType, IAttributes, IError, LangType, Types } from "../base/utils";
2
2
  /**
3
3
  * Represents an interface object of Pages Api.
4
4
  *
@@ -21,15 +21,15 @@ import { AttributeType, IAttributes, LangType, Types } from "../base/utils";
21
21
  * @property {function} searchPage - Quick search for page objects with limited output.
22
22
  */
23
23
  interface IPageApi {
24
- getRootPages(langCode?: LangType): Promise<Array<IPagesEntity>>;
25
- getPages(langCode: LangType): Promise<Array<IPagesEntity>>;
26
- getPageById(id: number, langCode: LangType): Promise<IPagesEntity>;
27
- getPageByUrl(url: string, langCode: LangType): Promise<IPagesEntity>;
28
- getChildPagesByParentUrl(url: string, langCode: LangType): Promise<Array<IPagesEntity>>;
29
- getFormsByPageUrl(url: string, langCode: LangType): Promise<Array<IPositionForm>>;
30
- getBlocksByPageUrl(url: string, langCode: LangType): Promise<Array<IPositionBlock>>;
31
- getConfigPageByUrl(url: string): Promise<IPageConfig>;
32
- searchPage(name: string, langCode: LangType): Promise<Array<IPagesEntity>>;
24
+ getRootPages(langCode?: LangType): Promise<Array<IPagesEntity> | IError>;
25
+ getPages(langCode: LangType): Promise<Array<IPagesEntity> | IError>;
26
+ getPageById(id: number, langCode: LangType): Promise<IPagesEntity | IError>;
27
+ getPageByUrl(url: string, langCode: LangType): Promise<IPagesEntity | IError>;
28
+ getChildPagesByParentUrl(url: string, langCode: LangType): Promise<Array<IPagesEntity> | IError>;
29
+ getFormsByPageUrl(url: string, langCode: LangType): Promise<Array<IPositionForm> | IError>;
30
+ getBlocksByPageUrl(url: string, langCode: LangType): Promise<Array<IPositionBlock> | IError>;
31
+ getConfigPageByUrl(url: string): Promise<IPageConfig | IError>;
32
+ searchPage(name: string, langCode: LangType): Promise<Array<IPagesEntity> | IError>;
33
33
  }
34
34
  /**
35
35
  * Represents a config object.
@@ -74,16 +74,18 @@ interface IPositionForm {
74
74
  * @interface
75
75
  * @property {number} id - The identifier of the object.
76
76
  * @property {number} version - The version number of the object.
77
+ * @property {number} quantity - Quantity pages in block.
77
78
  * @property {string} identifier - The textual identifier for the record field.
78
79
  * @property {Record<string, any>} localizeInfos - The name of the page, taking into account localization.
79
80
  * @property {number} position - The position of the object.
80
81
  * @property {boolean} isSync - Indication of page indexing.
81
- * @property {Record<string, any>} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
82
+ * @property {AttributeType} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
82
83
  * @property {string} attributeSetIdentifier
83
84
  * @property {Types} type - Page type.
84
85
  */
85
86
  interface IPositionBlock {
86
87
  id: number;
88
+ quantity?: number;
87
89
  version: number;
88
90
  identifier: string;
89
91
  localizeInfos: Record<string, any>;
@@ -111,7 +113,7 @@ interface IPositionBlock {
111
113
  * @property {string} attributeSetIdentifier - Set of attributes id.
112
114
  * @property {boolean} isSync - Indication of page indexing.
113
115
  * @property {string} templateIdentifier - User id of the linked template.
114
- * @property {Record<string, any>} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
116
+ * @property {AttributeType} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
115
117
  * @property {number} position - Item number (for sorting).
116
118
  * @property {Types} type - Page type.
117
119
  * @property {number} childrenCount - Children count.
@@ -1,4 +1,5 @@
1
1
  import AsyncModules from "../base/asyncModules";
2
+ import { IError } from "../base/utils";
2
3
  import { IPaymentsApi, ISessionEntity, IConnectedEntity, IAccountsEntity, ICreateSessionEntity, ISessionsEntity } from "./paymentsInterfaces";
3
4
  import StateModule from "../base/stateModule";
4
5
  /**
@@ -17,7 +18,7 @@ export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
17
18
  *
18
19
  * @returns Returns an array of SessionEntity objects.
19
20
  */
20
- getSessions(limit?: number, offset?: number): Promise<ISessionsEntity>;
21
+ getSessions(limit?: number, offset?: number): Promise<ISessionsEntity | IError>;
21
22
  /**
22
23
  * Get a single payment session object by its identifier.
23
24
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
@@ -26,7 +27,7 @@ export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
26
27
  *
27
28
  * @returns Returns a single payment session object.
28
29
  */
29
- getSessionById(id: number): Promise<ISessionEntity>;
30
+ getSessionById(id: number): Promise<ISessionEntity | IError>;
30
31
  /**
31
32
  * Creation of payment session.
32
33
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
@@ -37,21 +38,21 @@ export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
37
38
  *
38
39
  * @returns Returns a single payment session object.
39
40
  */
40
- createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ICreateSessionEntity>;
41
+ createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ICreateSessionEntity | IError>;
41
42
  /**
42
43
  * Get payment settings.
43
44
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
44
45
  *
45
46
  * @returns Returns object PaymentsConnected or null.
46
47
  */
47
- getConnected(): Promise<IConnectedEntity | null>;
48
+ getConnected(): Promise<IConnectedEntity | null | IError>;
48
49
  /**
49
50
  * Get all payment accounts as an array.
50
51
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
51
52
  *
52
53
  * @returns Returns all created payment accounts as an array of PaymentAccountEntity objects.
53
54
  */
54
- getAccounts(): Promise<Array<IAccountsEntity>>;
55
+ getAccounts(): Promise<Array<IAccountsEntity> | IError>;
55
56
  /**
56
57
  * Get a single payment account object by its identifier.
57
58
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
@@ -60,12 +61,12 @@ export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
60
61
  *
61
62
  * @returns Returns a single payment account object.
62
63
  */
63
- getAccountById(id: number): Promise<IAccountsEntity>;
64
+ getAccountById(id: number): Promise<IAccountsEntity | IError>;
64
65
  /**
65
66
  * Webhook for Stripe.
66
67
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
67
68
  *
68
69
  * @returns Returns true (in case of successful execution) or false (in case of unsuccessful execution)
69
70
  */
70
- webhookStripe(): Promise<boolean>;
71
+ webhookStripe(): Promise<boolean | IError>;
71
72
  }
@@ -1,3 +1,4 @@
1
+ import { IError } from "../base/utils";
1
2
  /**
2
3
  * Represents an interface object of Orders Api.
3
4
  *
@@ -11,13 +12,13 @@
11
12
  * @property {function} setAccessToken - Only for custom authorization. An intermediate method for setting up an access token.
12
13
  */
13
14
  interface IPaymentsApi {
14
- getSessions(limit: number, offset: number): Promise<ISessionsEntity>;
15
- getSessionById(id: number): Promise<ISessionEntity>;
16
- createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ICreateSessionEntity>;
17
- getConnected(): Promise<IConnectedEntity | null>;
18
- getAccounts(): Promise<Array<IAccountsEntity>>;
19
- getAccountById(id: number): Promise<IAccountsEntity>;
20
- webhookStripe(): Promise<boolean>;
15
+ getSessions(limit: number, offset: number): Promise<ISessionsEntity | IError>;
16
+ getSessionById(id: number): Promise<ISessionEntity | IError>;
17
+ createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ICreateSessionEntity | IError>;
18
+ getConnected(): Promise<IConnectedEntity | null | IError>;
19
+ getAccounts(): Promise<Array<IAccountsEntity> | IError>;
20
+ getAccountById(id: number): Promise<IAccountsEntity | IError>;
21
+ webhookStripe(): Promise<boolean | IError>;
21
22
  }
22
23
  interface ISessionsEntity {
23
24
  total: number;
@@ -1,5 +1,6 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import { IProductStatusEntity, IProductStatuses } from "./productStatusesInterfaces";
3
+ import { IError } from "../base/utils";
3
4
  import StateModule from "../base/stateModule";
4
5
  /**
5
6
  * Controllers for working with product statuses
@@ -14,7 +15,7 @@ export default class ProductStatusesApi extends AsyncModules implements IProduct
14
15
  *
15
16
  * @returns Returns an array of product status objects
16
17
  */
17
- getProductStatuses(langCode?: string): Promise<Array<IProductStatusEntity>>;
18
+ getProductStatuses(langCode?: string): Promise<Array<IProductStatusEntity> | IError>;
18
19
  /**
19
20
  * Search for a product status object by identifier.
20
21
  *
@@ -23,7 +24,7 @@ export default class ProductStatusesApi extends AsyncModules implements IProduct
23
24
  *
24
25
  * @returns Returns a product status object
25
26
  */
26
- getProductStatusesById(id: number, langCode?: string): Promise<IProductStatusEntity>;
27
+ getProductStatusesById(id: number, langCode?: string): Promise<IProductStatusEntity | IError>;
27
28
  /**
28
29
  * Search for a product status object by its textual identifier (marker).
29
30
  *
@@ -32,7 +33,7 @@ export default class ProductStatusesApi extends AsyncModules implements IProduct
32
33
  *
33
34
  * @returns Returns a product status object
34
35
  */
35
- getProductsByStatusMarker(marker: string, langCode?: string): Promise<IProductStatusEntity>;
36
+ getProductsByStatusMarker(marker: string, langCode?: string): Promise<IProductStatusEntity | IError>;
36
37
  /**
37
38
  * Check the existence of a textual identifier.
38
39
  *
@@ -40,5 +41,5 @@ export default class ProductStatusesApi extends AsyncModules implements IProduct
40
41
  *
41
42
  * @returns Returns true if the textual identifier (marker) exists or false if it doesn't
42
43
  */
43
- validateMarker(marker: string): Promise<boolean>;
44
+ validateMarker(marker: string): Promise<boolean | IError>;
44
45
  }
@@ -1,3 +1,4 @@
1
+ import { IError } from "../base/utils";
1
2
  /**
2
3
  * Represents an interface object of Product Statuses Api.
3
4
  *
@@ -10,10 +11,10 @@
10
11
  * @property {function} validateMarker - Check the existence of a textual identifier.
11
12
  */
12
13
  interface IProductStatuses {
13
- getProductStatuses(langCode: string): Promise<Array<IProductStatusEntity>>;
14
- getProductStatusesById(id: number, langCode: string): Promise<IProductStatusEntity>;
15
- getProductsByStatusMarker(marker: string, langCode: string): Promise<IProductStatusEntity>;
16
- validateMarker(marker: string): Promise<boolean>;
14
+ getProductStatuses(langCode: string): Promise<Array<IProductStatusEntity> | IError>;
15
+ getProductStatusesById(id: number, langCode: string): Promise<IProductStatusEntity | IError>;
16
+ getProductsByStatusMarker(marker: string, langCode: string): Promise<IProductStatusEntity | IError>;
17
+ validateMarker(marker: string): Promise<boolean | IError>;
17
18
  }
18
19
  /**
19
20
  * Represents a position object.