oneentry 1.0.67 → 1.0.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
- import { Types } from "../base/utils";
2
1
  /**
3
2
  * Represents an interface object of AttributesSets Api.
4
3
  *
@@ -14,14 +13,17 @@ interface IListTitle {
14
13
  title: string;
15
14
  value: number | string;
16
15
  position: string | number | null;
17
- extendedValue: string | number | null;
18
- extendedValueType: string | number | null;
16
+ extended: {
17
+ value: string | null;
18
+ type: string | null;
19
+ };
19
20
  }
21
+ type AttributeType = 'string' | 'text' | 'textWithHeader' | 'integer' | 'real' | 'float' | 'dateTime' | 'date' | 'time' | 'file' | 'image' | 'groupOfImages' | 'radioButton' | 'list' | 'button';
20
22
  /**
21
23
  * Represents a template entity object.
22
24
  *
23
25
  * @interface
24
- * @property {Types} type - Attribute type.
26
+ * @property {AttributeType} type - Attribute type.
25
27
  * @property {string} marker - Textual identifier of the attribute (marker).
26
28
  * @property {number} position - Position number for sorting.
27
29
  * @property {Record<string, any>} validators - Set of validators for validation.
@@ -30,7 +32,7 @@ interface IListTitle {
30
32
  *
31
33
  */
32
34
  interface IAttributesSetsEntity {
33
- type: Types;
35
+ type: AttributeType;
34
36
  marker: string;
35
37
  position: number;
36
38
  validators: {
@@ -44,4 +46,4 @@ interface IAttributesSetsEntity {
44
46
  localizeInfos: Record<string, any>;
45
47
  listTitles: Array<IListTitle> | Record<string, any>;
46
48
  }
47
- export { IAttributesSets, IAttributesSetsEntity, IListTitle };
49
+ export { IAttributesSets, IAttributesSetsEntity, IListTitle, AttributeType };
@@ -1,5 +1,5 @@
1
1
  import AsyncModules from "../base/asyncModules";
2
- import { IAuthProvider, ISignUpData, ISignUpEntity, ICodeEntity, IAuthEntity, IAuthProvidersEntity, IAuthPostBody } from "./authProvidersInterfaces";
2
+ import { IAuthProvider, ISignUpData, ISignUpEntity, IAuthEntity, IAuthProvidersEntity, IAuthPostBody } from "./authProvidersInterfaces";
3
3
  import StateModule from "../base/stateModule";
4
4
  /**
5
5
  * Controllers for working with auth services.
@@ -20,7 +20,7 @@ export default class AuthProviderApi extends AsyncModules implements IAuthProvid
20
20
  * "authData": [
21
21
  * {
22
22
  * "marker": "login",
23
- * "value": "test"
23
+ * "value": "example@oneentry.cloud"
24
24
  * },
25
25
  * {
26
26
  * "marker": "password",
@@ -35,19 +35,26 @@ export default class AuthProviderApi extends AsyncModules implements IAuthProvid
35
35
  * }
36
36
  * ],
37
37
  * "notificationData": {
38
- * "email": "test@test.com",
39
- * "phonePush": "",
40
- * "phoneSMS": "+79991234567"
38
+ * "email": "example@oneentry.cloud",
39
+ * "phonePush": "+99999999999",
40
+ * "phoneSMS": "+99999999999"
41
41
  * }
42
42
  * }
43
43
  */
44
44
  signUp(marker: string, data: ISignUpData, langCode?: string): Promise<ISignUpEntity>;
45
45
  /**
46
- * Getting a user activation code
46
+ * Getting a user activation code. The code is returned via the appropriate user notification method
47
47
  * @param {string} marker - The text identifier of the authorization provider. Example - email
48
48
  * @param {string} userIdentifier - The text identifier of the user's object (user login)
49
49
  */
50
- generateCode(marker: string, userIdentifier: string): Promise<ICodeEntity>;
50
+ generateCode(marker: string, userIdentifier: string): Promise<void>;
51
+ /**
52
+ * User activation code verification. Returns true (if the code is correct) or false (if it is incorrect).
53
+ * @param {string} marker - The text identifier of the authorization provider. Example - email
54
+ * @param {string} userIdentifier - The text identifier of the user's object (user login)
55
+ * @param {string} code - Service code
56
+ */
57
+ checkCode(marker: string, userIdentifier: string, code: string): Promise<boolean>;
51
58
  /**
52
59
  * User activate.
53
60
  * @param {string} marker - The text identifier of the authorization provider. Example - email
@@ -21,7 +21,7 @@ class AuthProviderApi extends asyncModules_1.default {
21
21
  * "authData": [
22
22
  * {
23
23
  * "marker": "login",
24
- * "value": "test"
24
+ * "value": "example@oneentry.cloud"
25
25
  * },
26
26
  * {
27
27
  * "marker": "password",
@@ -36,19 +36,20 @@ class AuthProviderApi extends asyncModules_1.default {
36
36
  * }
37
37
  * ],
38
38
  * "notificationData": {
39
- * "email": "test@test.com",
40
- * "phonePush": "",
41
- * "phoneSMS": "+79991234567"
39
+ * "email": "example@oneentry.cloud",
40
+ * "phonePush": "+99999999999",
41
+ * "phoneSMS": "+99999999999"
42
42
  * }
43
43
  * }
44
44
  */
45
45
  async signUp(marker, data, langCode = this.state.lang) {
46
+ data['langCode'] = langCode;
46
47
  const body = this._normalizePostBody(data, langCode);
47
48
  const result = await this._fetchPost(`/marker/${marker}/users/sign-up`, body);
48
49
  return this._normalizeData(result);
49
50
  }
50
51
  /**
51
- * Getting a user activation code
52
+ * Getting a user activation code. The code is returned via the appropriate user notification method
52
53
  * @param {string} marker - The text identifier of the authorization provider. Example - email
53
54
  * @param {string} userIdentifier - The text identifier of the user's object (user login)
54
55
  */
@@ -57,6 +58,19 @@ class AuthProviderApi extends asyncModules_1.default {
57
58
  "userIdentifier": userIdentifier
58
59
  };
59
60
  const result = await this._fetchPost(`/marker/${marker}/users/generate-code`, data);
61
+ }
62
+ /**
63
+ * User activation code verification. Returns true (if the code is correct) or false (if it is incorrect).
64
+ * @param {string} marker - The text identifier of the authorization provider. Example - email
65
+ * @param {string} userIdentifier - The text identifier of the user's object (user login)
66
+ * @param {string} code - Service code
67
+ */
68
+ async checkCode(marker, userIdentifier, code) {
69
+ const data = {
70
+ "userIdentifier": userIdentifier,
71
+ "code": code
72
+ };
73
+ const result = await this._fetchPost(`/marker/${marker}/users/check-code`, data);
60
74
  return result;
61
75
  }
62
76
  /**
@@ -95,8 +109,11 @@ class AuthProviderApi extends asyncModules_1.default {
95
109
  */
96
110
  async auth(marker, data) {
97
111
  const result = await this._fetchPost(`/marker/${marker}/users/auth`, data);
98
- this.state.userToken = result.accessToken;
112
+ this.state.accessToken = result.accessToken;
99
113
  this.state.refreshToken = result.refreshToken;
114
+ if (this.state.saveFunction) {
115
+ this.state.saveFunction(result.refreshToken);
116
+ }
100
117
  return result;
101
118
  }
102
119
  /**
@@ -108,8 +125,11 @@ class AuthProviderApi extends asyncModules_1.default {
108
125
  async refresh(marker, token) {
109
126
  const data = { refreshToken: token };
110
127
  const result = await this._fetchPost(`/marker/${marker}/users/refresh`, data);
111
- this.state.userToken = result.accessToken;
128
+ this.state.accessToken = result.accessToken;
112
129
  this.state.refreshToken = result.refreshToken;
130
+ if (this.state.saveFunction) {
131
+ this.state.saveFunction(result.refreshToken);
132
+ }
113
133
  return result;
114
134
  }
115
135
  /**
@@ -123,8 +143,11 @@ class AuthProviderApi extends asyncModules_1.default {
123
143
  };
124
144
  const result = await this._fetchPost(`/marker/${marker}/users/logout`, data);
125
145
  if (result) {
126
- this.state.userToken = undefined;
146
+ this.state.accessToken = undefined;
127
147
  this.state.refreshToken = undefined;
148
+ if (this.state.saveFunction) {
149
+ this.state.saveFunction('');
150
+ }
128
151
  }
129
152
  return result;
130
153
  }
@@ -4,6 +4,7 @@ import { ILocalizeInfo } from "../base/utils";
4
4
  *
5
5
  * @property {function} signUp - User registration.
6
6
  * @property {function} generateCode - Getting a user activation code.
7
+ * @property {function} checkCode - User activation code verification.
7
8
  * @property {function} activateUser - User activate.
8
9
  * @property {function} auth - User authorization.
9
10
  * @property {function} refresh - Refresh token.
@@ -14,7 +15,8 @@ import { ILocalizeInfo } from "../base/utils";
14
15
  */
15
16
  interface IAuthProvider {
16
17
  signUp(marker: string, data: ISignUpData, langCode?: string): Promise<ISignUpEntity>;
17
- generateCode(marker: string, userIdentifier: string): Promise<ICodeEntity>;
18
+ generateCode(marker: string, userIdentifier: string): Promise<void>;
19
+ checkCode(marker: string, userIdentifier: string, code: string): Promise<boolean>;
18
20
  activateUser(marker: string, userIdentifier: string, code: string): Promise<boolean>;
19
21
  auth(marker: string, data: IAuthPostBody): Promise<IAuthEntity>;
20
22
  refresh(marker: string, token: string): Promise<IAuthEntity>;
@@ -30,6 +32,7 @@ interface IAuthFormData {
30
32
  }
31
33
  interface ISignUpData {
32
34
  formIdentifier: string;
35
+ langCode?: string;
33
36
  authData: Array<{
34
37
  marker: string;
35
38
  value: string;
@@ -107,7 +107,6 @@ class AsyncModules extends syncModules_1.default {
107
107
  }
108
108
  }
109
109
  async refreshToken() {
110
- console.log('ref token', this.state.refreshToken);
111
110
  const response = await fetch(this.state.url + `/api/content/users-auth-providers/marker/email/users/refresh`, {
112
111
  method: 'POST',
113
112
  headers: {
@@ -119,7 +118,10 @@ class AsyncModules extends syncModules_1.default {
119
118
  if (response.ok) {
120
119
  const result = await response.json();
121
120
  this.state.refreshToken = result.refreshToken;
122
- this.state.userToken = result.accessToken;
121
+ this.state.accessToken = result.accessToken;
122
+ if (this.state.saveFunction) {
123
+ this.state.saveFunction(result.refreshToken);
124
+ }
123
125
  return true;
124
126
  }
125
127
  else {
@@ -140,16 +142,17 @@ class AsyncModules extends syncModules_1.default {
140
142
  if (data) {
141
143
  options['body'] = JSON.stringify(data);
142
144
  }
143
- if (this.state.userToken) {
144
- options.headers['Authorization'] = 'Bearer ' + this.state.userToken;
145
+ if (this.state.accessToken) {
146
+ options.headers['Authorization'] = 'Bearer ' + this.state.accessToken;
145
147
  }
146
148
  return options;
147
149
  }
148
150
  async browserResponse(path, options) {
149
151
  const response = await fetch(this._getFullPath(path), options);
150
- if (response.status == 401) {
152
+ if (response.status == 401 && !this.state.customAuth) {
151
153
  const refresh = await this.refreshToken();
152
154
  if (refresh) {
155
+ options.headers['Authorization'] = 'Bearer ' + this.state.accessToken;
153
156
  const secondResponse = await fetch(this._getFullPath(path), options);
154
157
  return await secondResponse.json();
155
158
  }
@@ -3,8 +3,10 @@ export default class StateModule {
3
3
  url: string | undefined;
4
4
  lang: string | undefined;
5
5
  token: string | undefined;
6
- userToken: string | undefined;
6
+ accessToken: string | undefined;
7
7
  multipleResponse: boolean;
8
8
  refreshToken: string | undefined;
9
+ customAuth: boolean;
10
+ saveFunction: (param: string) => void | null;
9
11
  constructor(url: string, config: IConfig);
10
12
  }
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class StateModule {
4
4
  constructor(url, config) {
5
- var _a;
5
+ var _a, _b, _c, _d, _e, _f, _g, _h;
6
6
  this.url = url;
7
- this.lang = config.langCode;
7
+ this.lang = (_a = config.langCode) !== null && _a !== void 0 ? _a : 'en_US';
8
8
  this.token = config.token;
9
- this.multipleResponse = (_a = config.multipleRequests) !== null && _a !== void 0 ? _a : true;
10
- this.userToken = config.userToken;
9
+ this.multipleResponse = !!((_b = config.traficLimit) !== null && _b !== void 0 ? _b : false);
10
+ this.refreshToken = (_d = (_c = config.auth) === null || _c === void 0 ? void 0 : _c.refreshToken) !== null && _d !== void 0 ? _d : undefined;
11
+ this.customAuth = (_f = (_e = config.auth) === null || _e === void 0 ? void 0 : _e.customAuth) !== null && _f !== void 0 ? _f : false;
12
+ this.saveFunction = (_h = (_g = config.auth) === null || _g === void 0 ? void 0 : _g.saveFunction) !== null && _h !== void 0 ? _h : null;
11
13
  }
12
14
  }
13
15
  exports.default = StateModule;
@@ -1,35 +1,39 @@
1
- declare enum Types {
2
- forCatalogProducts = "forCatalogProducts",
3
- forBasketPage = "forBasketPage",
4
- forErrorPage = "forErrorPage",
5
- forCatalogPages = "forCatalogPages",
6
- forProductPreview = "forProductPreview",
7
- forProductPage = "forProductPage",
8
- forSimilarProductBlock = "forSimilarProductBlock",
9
- forStatisticProductBlock = "forStatisticProductBlock",
10
- forProductBlock = "forProductBlock",
11
- forForm = "forForm",
12
- forFormField = "forFormField",
13
- forNewsPage = "forNewsPage",
14
- forNewsBlock = "forNewsBlock",
15
- forNewsPreview = "forNewsPreview",
16
- forOneNewsPage = "forOneNewsPage",
17
- forUsualPage = "forUsualPage",
18
- forTextBlock = "forTextBlock",
19
- forSlider = "forSlider",
20
- service = "service"
21
- }
1
+ type Types = 'forCatalogProducts' | 'forBasketPage' | 'forErrorPage' | 'forCatalogPages' | 'forProductPreview' | 'forProductPage' | 'forSimilarProductBlock' | 'forStatisticProductBlock' | 'forProductBlock' | 'forForm' | 'forFormField' | 'forNewsPage' | 'forNewsBlock' | 'forNewsPreview' | 'forOneNewsPage' | 'forUsualPage' | 'forTextBlock' | 'forSlider' | 'forOrder' | 'service' | 'none';
22
2
  /**
23
3
  * @param {string} [token] - If your project is protected by a token, specify this token in this parameter.
24
4
  * @param {string} [langCode] - specify the default language to avoid specifying it in every request.
25
5
  * @param {boolean} [multipleRequests] - Some methods use multiple queries to make it easier to work with the API. Set this parameter to "false" to save traffic and decide for yourself what data you need.
26
- * @param {boolean} [userToken] - If your project uses user authorization, pass the user access token to the "userToken" variable to use methods that require authorization.
6
+ * @param {boolean} [auth] - An object with authorization settings
7
+ * @param {boolean} [auth.customAuth] - Set this flag to true if you want to configure the authorization process yourself. Set the flag to false, or do not pass it at all to have automatic authorization and token renewal
8
+ * @param {boolean} [auth.refreshToken] - Transfer the refresh token here, for example from the local storage, to resume the user's session. Otherwise, the user will need to log in every time a new session is created
9
+ * @param {boolean} [auth.saveFunction] - If you want to store the token between sessions, for example in local storage, create a custom function that takes refreshToken as a parameter and executes the necessary instructions. This function will be called every time the tokens are updated
10
+ *
11
+ * @example
12
+ * const saveToken = (token) => {
13
+ * localStorage.setItem('refresh', token)
14
+ * }
15
+ *
16
+ * const config = {
17
+ * token: 'project.token.here',
18
+ * langCode: 'en_US',
19
+ * multipleRequests: true,
20
+ * auth: {
21
+ * customAuth: false,
22
+ * refreshToken: 'user.refresh.token',
23
+ * saveFunction: saveToken
24
+ * }
25
+ * }
26
+ *
27
27
  */
28
28
  interface IConfig {
29
29
  token?: string;
30
- userToken?: string;
31
30
  langCode?: string;
32
- multipleRequests?: boolean;
31
+ traficLimit?: boolean;
32
+ auth?: {
33
+ customAuth?: boolean;
34
+ refreshToken?: string;
35
+ saveFunction?: (refreshToken: string) => void;
36
+ };
33
37
  }
34
38
  interface IAttributes {
35
39
  listTitles: Array<{
@@ -1,25 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Types = void 0;
4
- var Types;
5
- (function (Types) {
6
- Types["forCatalogProducts"] = "forCatalogProducts";
7
- Types["forBasketPage"] = "forBasketPage";
8
- Types["forErrorPage"] = "forErrorPage";
9
- Types["forCatalogPages"] = "forCatalogPages";
10
- Types["forProductPreview"] = "forProductPreview";
11
- Types["forProductPage"] = "forProductPage";
12
- Types["forSimilarProductBlock"] = "forSimilarProductBlock";
13
- Types["forStatisticProductBlock"] = "forStatisticProductBlock";
14
- Types["forProductBlock"] = "forProductBlock";
15
- Types["forForm"] = "forForm";
16
- Types["forFormField"] = "forFormField";
17
- Types["forNewsPage"] = "forNewsPage";
18
- Types["forNewsBlock"] = "forNewsBlock";
19
- Types["forNewsPreview"] = "forNewsPreview";
20
- Types["forOneNewsPage"] = "forOneNewsPage";
21
- Types["forUsualPage"] = "forUsualPage";
22
- Types["forTextBlock"] = "forTextBlock";
23
- Types["forSlider"] = "forSlider";
24
- Types["service"] = "service";
25
- })(Types || (exports.Types = Types = {}));
@@ -18,19 +18,18 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
18
18
  * @example
19
19
  * const body = {
20
20
  * "formIdentifier": "bar-orders-form",
21
- * "paymentIdentifier": "usd-payment",
21
+ * "paymentAccountIdentifier": "usd-payment",
22
22
  * "formData": {
23
23
  * "marker": "name_1",
24
- * "value": "Name"
24
+ * "value": "Name",
25
+ * "type": "string"
25
26
  * },
26
27
  * "products": [
27
28
  * {
28
29
  * "productId": 1,
29
30
  * "quantity": 2,
30
- * "price": "23.02"
31
31
  * }
32
32
  * ],
33
- * "currency": "USD"
34
33
  * }
35
34
  *
36
35
  * @returns Returns object for creating an order.
@@ -39,9 +38,11 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
39
38
  /**
40
39
  * Getting all order storage object by marker
41
40
  * @param {number} marker - Textual identifier of the order storage object
42
- * @param {number} [langCode] Optional language field
41
+ * @param {string} [langCode] Optional language field
42
+ * @param {number} [limit] Limit parameter. Default 30
43
+ * @param {number} [offset] Offset parameter. Default 0
43
44
  */
44
- getAllOrdersByMarker(marker: string, langCode?: string): Promise<Array<IOrdersByMarkersEntity>>;
45
+ getAllOrdersByMarker(marker: string, langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersByMarkersEntity>>;
45
46
  /**
46
47
  * Changing an order in the order store
47
48
  * @param marker - The text identifier of the order storage object
@@ -52,16 +53,16 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
52
53
  * @example
53
54
  * const body = {
54
55
  * "formIdentifier": "bar-orders-form",
55
- * "paymentIdentifier": "usd-payment",
56
+ * "paymentAccountIdentifier": "usd-payment",
56
57
  * "formData": {
57
58
  * "marker": "name_1",
58
- * "value": "Name"
59
+ * "value": "Name",
60
+ * "type": "string"
59
61
  * },
60
62
  * "products": [
61
63
  * {
62
64
  * "productId": 1,
63
- * "quantity": 2,
64
- * "price": "23.02"
65
+ * "quantity": 2
65
66
  * }
66
67
  * ],
67
68
  * "currency": "USD"
@@ -19,19 +19,18 @@ class OrdersApi extends asyncModules_1.default {
19
19
  * @example
20
20
  * const body = {
21
21
  * "formIdentifier": "bar-orders-form",
22
- * "paymentIdentifier": "usd-payment",
22
+ * "paymentAccountIdentifier": "usd-payment",
23
23
  * "formData": {
24
24
  * "marker": "name_1",
25
- * "value": "Name"
25
+ * "value": "Name",
26
+ * "type": "string"
26
27
  * },
27
28
  * "products": [
28
29
  * {
29
30
  * "productId": 1,
30
31
  * "quantity": 2,
31
- * "price": "23.02"
32
32
  * }
33
33
  * ],
34
- * "currency": "USD"
35
34
  * }
36
35
  *
37
36
  * @returns Returns object for creating an order.
@@ -46,10 +45,12 @@ class OrdersApi extends asyncModules_1.default {
46
45
  /**
47
46
  * Getting all order storage object by marker
48
47
  * @param {number} marker - Textual identifier of the order storage object
49
- * @param {number} [langCode] Optional language field
48
+ * @param {string} [langCode] Optional language field
49
+ * @param {number} [limit] Limit parameter. Default 30
50
+ * @param {number} [offset] Offset parameter. Default 0
50
51
  */
51
- async getAllOrdersByMarker(marker, langCode = this.state.lang) {
52
- const result = this._fetchGet(`/marker/${marker}/orders?langCode=${langCode}`);
52
+ async getAllOrdersByMarker(marker, langCode = this.state.lang, limit = 30, offset = 0) {
53
+ const result = await this._fetchGet(`/marker/${marker}/orders?langCode=${langCode}&limit=${limit}&offset=${offset}`);
53
54
  return this._normalizeData(result.items);
54
55
  }
55
56
  /**
@@ -62,16 +63,16 @@ class OrdersApi extends asyncModules_1.default {
62
63
  * @example
63
64
  * const body = {
64
65
  * "formIdentifier": "bar-orders-form",
65
- * "paymentIdentifier": "usd-payment",
66
+ * "paymentAccountIdentifier": "usd-payment",
66
67
  * "formData": {
67
68
  * "marker": "name_1",
68
- * "value": "Name"
69
+ * "value": "Name",
70
+ * "type": "string"
69
71
  * },
70
72
  * "products": [
71
73
  * {
72
74
  * "productId": 1,
73
- * "quantity": 2,
74
- * "price": "23.02"
75
+ * "quantity": 2
75
76
  * }
76
77
  * ],
77
78
  * "currency": "USD"
@@ -13,8 +13,14 @@ interface IOrdersApi {
13
13
  createOrder(marker: string, data: IOrderData): Promise<IBaseOrdersEntity>;
14
14
  updateOrderByMarkerAndId(marker: string, id: string, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
15
15
  getAllOrders(langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersEntity>>;
16
- getAllOrdersByMarker(marker: string, langCode?: string): Promise<Array<IOrdersByMarkersEntity>>;
16
+ getAllOrdersByMarker(marker: string, langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersByMarkersEntity>>;
17
17
  }
18
+ /**
19
+ * @property {string} filename
20
+ * @property {string} downloadLink
21
+ * @property {number} size
22
+ * @property {string} previewLink
23
+ */
18
24
  interface IPicture {
19
25
  filename: string;
20
26
  downloadLink: string;
@@ -25,40 +31,49 @@ interface IOrderProducts {
25
31
  id: number;
26
32
  title: string;
27
33
  sku: string | null;
28
- price: string | null;
34
+ price: string;
29
35
  quantity: number | null;
30
- previewImage: Array<IPicture>;
36
+ previewImage: IPicture;
31
37
  }
38
+ /**
39
+ * @property {string} marker - Marker of form field.
40
+ * @property {string} value - Value
41
+ * @property {string} type - Type of value. Example "string"
42
+ */
32
43
  interface IOrdersFormData {
33
44
  marker: string;
34
45
  value: string;
46
+ type: string;
47
+ }
48
+ /**
49
+ * @interface
50
+ * @property {number} productId - Product identifier.
51
+ * @property {number} quantity - Quantity of the product.
52
+ */
53
+ interface IOrderProductData {
54
+ productId: number;
55
+ quantity: number;
35
56
  }
36
57
  /**
37
58
  * @interface
38
- * @property {number} id
39
59
  * @property {string} statusIdentifier - Text identifier of the order status.
40
60
  * @property {string} formIdentifier - Text identifier of the form status.
41
- * @property {string} paymentIdentifier - Text identifier of the order payment.
61
+ * @property {string} paymentAccountIdentifier - Text identifier of the order payment.
42
62
  * @property {Array<IOrdersFormData>} formData - Data submitted by the form linked to the order store.
43
63
  * @property {Array<IOrderProducts>} products - Array of products added to order.
44
64
  * @property {string} totalSum - Total order amount.
45
65
  * @property {string} currency - Currency used to pay for the order.
46
66
  * @property {string} createdDate - Date when the order was created.
47
- * @property {string} paymentAccountIdentifier - Textual identifier for the order payment.
48
- * @property {Record<string, any>} paymentAccountLocalizeInfos - Payment account name considering localization.
49
67
  */
50
68
  interface IBaseOrdersEntity {
51
- id: number;
52
69
  statusIdentifier: string;
53
70
  formIdentifier: string;
54
- paymentIdentifier: string;
71
+ paymentAccountIdentifier: string;
55
72
  formData: Array<IOrdersFormData>;
56
- products: Array<IOrderProducts>;
73
+ products: Array<IOrderProductData>;
57
74
  totalSum: string;
58
75
  currency: string;
59
76
  createdDate: string;
60
- paymentAccountIdentifier: string;
61
- paymentAccountLocalizeInfos: Record<string, any>;
62
77
  }
63
78
  /**
64
79
  * @interface
@@ -79,43 +94,23 @@ interface IOrdersEntity {
79
94
  identifier: string;
80
95
  }>;
81
96
  }
82
- interface IOrderMarkerData {
83
- marker: string;
84
- value: string;
85
- }
86
- /**
87
- * @interface
88
- * @property {number} productId - Product identifier.
89
- * @property {number} quantity - Quantity of the product.
90
- * @property {string} price - Price per unit of the product.
91
- */
92
- interface IOrderProductData {
93
- productId: number;
94
- quantity: number;
95
- price: string;
96
- }
97
97
  /**
98
98
  * @interface
99
99
  * @property {string} formIdentifier - Text identifier of the form object linked to the order repository.
100
- * @property {string} paymentIdentifier - Text identifier of the payment object linked to the order repository.
101
- * @property {string} [statusIdentifier] - Text identifier of the order status object (if not specified, the default status will be assigned).
102
- * @property {IOrderMarkerData | Array<IOrderMarkerData>} formData - Form data linked to the order repositor.
100
+ * @property {string} paymentAccountIdentifier - Text identifier of the payment object linked to the order repository.
101
+ * @property {IOrdersFormData | Array<IOrdersFormData>} formData - Form data linked to the order repositor.
103
102
  * @property {Array<IOrderProductData>} products - An array of ordered products.
104
- * @property {string} currency - Currency used for order paymen.
105
103
  */
106
104
  interface IOrderData {
107
105
  formIdentifier: string;
108
- paymentIdentifier: string;
109
- statusIdentifier?: string;
110
- formData: IOrderMarkerData | Array<IOrderMarkerData>;
106
+ paymentAccountIdentifier: string;
107
+ formData: IOrdersFormData | Array<IOrdersFormData>;
111
108
  products: Array<IOrderProductData>;
112
- currency: string;
113
109
  }
114
110
  /**
115
111
  * @interface
116
112
  * @property {string} statusIdentifier - Text identifier of the order status.
117
113
  * @property {string} formIdentifier - Text identifier of the form status.
118
- * @property {string} paymentIdentifier - Text identifier of the order payment.
119
114
  * @property {Array<IOrdersFormData>} formData - Data submitted by the form linked to the order store.
120
115
  * @property {Array<IOrderProducts>} products - Array of products added to order.
121
116
  * @property {string} totalSum - Total order amount.
@@ -129,7 +124,6 @@ interface IOrderData {
129
124
  interface IOrdersByMarkersEntity {
130
125
  statusIdentifier: string;
131
126
  formIdentifier: string;
132
- paymentIdentifier: string;
133
127
  formData: Array<IOrdersFormData>;
134
128
  products: Array<IOrderProducts>;
135
129
  totalSum: string;
@@ -140,4 +134,4 @@ interface IOrdersByMarkersEntity {
140
134
  paymentAccountLocalizeInfos: Record<string, any>;
141
135
  isHistory: boolean;
142
136
  }
143
- export { IOrdersEntity, IBaseOrdersEntity, IOrderProducts, IPicture, IOrdersApi, IOrderData, IOrderProductData, IOrderMarkerData, IOrdersFormData, IOrdersByMarkersEntity };
137
+ export { IOrdersEntity, IBaseOrdersEntity, IOrderProducts, IPicture, IOrdersApi, IOrderData, IOrderProductData, IOrdersFormData, IOrdersByMarkersEntity };
@@ -12,7 +12,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
12
12
  private _defaultQuery;
13
13
  /**
14
14
  * Search for all products with pagination and filter.
15
- * @param {Array<IFilterParams>} body - Request body.
15
+ * @param {Array<IFilterParams>} body - Request body. Default [].
16
16
  * @param {string} [langCode] - Language code parameter. Default "en_US"
17
17
  * @param {IProductsQuery} [userQuery] - Optional set query parameters.
18
18
  * @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
@@ -54,7 +54,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
54
54
  *
55
55
  * @returns Array with ProductEntity objects
56
56
  */
57
- getProducts(body: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
57
+ getProducts(body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
58
58
  /**
59
59
  * Search for all product page objects with pagination that do not have a category.
60
60
  *
@@ -124,7 +124,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
124
124
  *
125
125
  * @returns Array with ProductEntity objects
126
126
  */
127
- getProductsByPageId(id: number, body: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
127
+ getProductsByPageId(id: number, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
128
128
  /**
129
129
  * Search for information about products and prices for the selected category.
130
130
  * @param {string} url - Page url.
@@ -193,7 +193,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
193
193
  *
194
194
  * @returns Array with ProductEntity objects
195
195
  */
196
- getProductsByPageUrl(url: string, body: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
196
+ getProductsByPageUrl(url: string, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
197
197
  /**
198
198
  * Find all related product page objects.
199
199
  *