oneentry 1.0.63 → 1.0.64

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,5 +1,5 @@
1
1
  import OneEntry from "../base/oneEntry";
2
- import { IBlocks, IBlocksResponse, IBlockEntity } from "./blocksInterfaces";
2
+ import { IBlocks, IBlocksResponse, IBlockEntity, ISearchBlock } from "./blocksInterfaces";
3
3
  import { IProductsEntity } from "../products/productsInterfaces";
4
4
  import { IConfig } from "../base/utils";
5
5
  /**
@@ -48,4 +48,10 @@ export default class BlocksApi extends OneEntry implements IBlocks {
48
48
  * @returns Return array of BlocksEntity object.
49
49
  */
50
50
  getProductsByBlockMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<Array<IProductsEntity>>;
51
+ /**
52
+ * Quick search for block objects with limited output
53
+ * @param name - Search string
54
+ * @param [langCode] - Language code. Default "en_US"
55
+ */
56
+ searchBlock(name: string, langCode?: string): Promise<Array<ISearchBlock>>;
51
57
  }
@@ -131,5 +131,14 @@ class BlocksApi extends oneEntry_1.default {
131
131
  const result = await this._fetchGet(`/${marker}/products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
132
132
  return this._normalizeData(result.items);
133
133
  }
134
+ /**
135
+ * Quick search for block objects with limited output
136
+ * @param name - Search string
137
+ * @param [langCode] - Language code. Default "en_US"
138
+ */
139
+ async searchBlock(name, langCode = this._defaultLangCode) {
140
+ const result = await this._fetchGet(`/quick/search?langCode=${langCode}&name=${name}`);
141
+ return result;
142
+ }
134
143
  }
135
144
  exports.default = BlocksApi;
@@ -6,12 +6,14 @@ import { IProductsEntity } from "../products/productsInterfaces";
6
6
  * @property {function} getBlockByMarker - Get Block object by marker.
7
7
  * @property {function} getSimilarProducts - Get Array of similar products from product-similar block.
8
8
  * @property {function} getProductsByBlockMarker - Get Array of products from product block.
9
+ * @property {function} searchBlock - Quick search for block objects with limited output.
9
10
  */
10
11
  interface IBlocks {
11
12
  getBlocks(langCode: string, offset?: number, limit?: number): Promise<Array<IBlockEntity | IBlocksResponse>>;
12
13
  getBlockByMarker(marker: string, langCode: string): Promise<IBlockEntity>;
13
14
  getSimilarProducts(marker: string, langCode?: string, offset?: number, limit?: number): Promise<Array<IProductsEntity>>;
14
15
  getProductsByBlockMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<Array<IProductsEntity>>;
16
+ searchBlock(name: string, langCode?: string): Promise<Array<ISearchBlock>>;
15
17
  }
16
18
  interface IBlocksResponse {
17
19
  id: number;
@@ -59,4 +61,9 @@ interface ICustomSetting {
59
61
  }> | Record<string, any>;
60
62
  [key: string]: any;
61
63
  }
62
- export { IBlocks, IBlockEntity, IBlocksResponse, ICustomSetting };
64
+ interface ISearchBlock {
65
+ id: number;
66
+ name: string;
67
+ identifier: string;
68
+ }
69
+ export { IBlocks, IBlockEntity, IBlocksResponse, ICustomSetting, ISearchBlock };
@@ -2,9 +2,7 @@
2
2
  * Represents a interface object of Forms Api.
3
3
  *
4
4
  * @property {function} getFormsData - Get all forms data.
5
- *
6
5
  * @property {function} postFormsData - Find all product page objects with pagination and multiple filtering.
7
- *
8
6
  * @property {function} getFormsDataByMarker - Get one object of form data by marker.
9
7
  */
10
8
  interface IFormsData {
@@ -52,7 +50,7 @@ interface IFormsPost {
52
50
  id?: number;
53
51
  formIdentifier: string;
54
52
  time?: Date | string;
55
- formData: Array<IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList>;
53
+ formData: Array<IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | Record<string, any>>;
56
54
  }
57
55
  /**
58
56
  * @property {string} marker - marker name
@@ -1,20 +1,11 @@
1
1
  import OneEntry from "../base/oneEntry";
2
2
  import { IConfig } from "../base/utils";
3
- import { IOrdersApi, IOrdersEntity, IBaseOrdersEntity, IOrderData } from "./ordersInterfaces";
3
+ import { IOrdersApi, IOrdersEntity, IBaseOrdersEntity, IOrderData, IOrdersByMarkersEntity } from "./ordersInterfaces";
4
4
  /**
5
5
  * Controllers for working with orders
6
6
  */
7
7
  export default class OrdersApi extends OneEntry implements IOrdersApi {
8
8
  constructor(url: string, config: IConfig);
9
- /**
10
- * Retrieve one order storage object by marker.
11
- *
12
- * @param {string} marker - Marker of the order object
13
- * @param {string} [langCode] - Language code
14
- *
15
- * @returns Return object of order information.
16
- */
17
- getOrderByMarker(marker: string, langCode?: string): Promise<IOrdersEntity>;
18
9
  /**
19
10
  * Creation of an order in the order storage.
20
11
  *
@@ -43,4 +34,52 @@ export default class OrdersApi extends OneEntry implements IOrdersApi {
43
34
  * @returns Returns object for creating an order.
44
35
  */
45
36
  createOrder(marker: string, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
37
+ /**
38
+ * Getting all order storage object by marker
39
+ * @param {number} marker - Textual identifier of the order storage object
40
+ * @param {number} [langCode] Optional language field
41
+ */
42
+ getAllOrdersByMarker(marker: string, langCode?: string): Promise<Array<IOrdersByMarkersEntity>>;
43
+ /**
44
+ * Changing an order in the order store
45
+ * @param marker - The text identifier of the order storage object
46
+ * @param id - ID of the order object
47
+ * @param data Object for updating an order
48
+ * @param langCode Optional language field
49
+ *
50
+ * @example
51
+ * const body = {
52
+ * "formIdentifier": "bar-orders-form",
53
+ * "paymentIdentifier": "usd-payment",
54
+ * "formData": {
55
+ * "marker": "name_1",
56
+ * "value": "Name"
57
+ * },
58
+ * "products": [
59
+ * {
60
+ * "productId": 1,
61
+ * "quantity": 2,
62
+ * "price": "23.02"
63
+ * }
64
+ * ],
65
+ * "currency": "USD"
66
+ * }
67
+ */
68
+ updateOrderByMarkerAndId(marker: string, id: string, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
69
+ /**
70
+ * Getting all the order storage objects
71
+ * @param {number} [langCode] Optional language field
72
+ * @param {number} [limit] - Optional parameter for pagination, default is 0
73
+ * @param {number} [offset] - Optional parameter for pagination, default is 30
74
+ */
75
+ getAllOrders(langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersEntity>>;
76
+ /**
77
+ * Retrieve one order storage object by marker.
78
+ *
79
+ * @param {string} marker - Marker of the order object
80
+ * @param {string} [langCode] - Language code
81
+ *
82
+ * @returns Return object of order information.
83
+ */
84
+ getOrderByMarker(marker: string, langCode?: string): Promise<IOrdersEntity>;
46
85
  }
@@ -9,18 +9,6 @@ class OrdersApi extends oneEntry_1.default {
9
9
  super(url, config);
10
10
  this._url += '/api/content/orders-storage';
11
11
  }
12
- /**
13
- * Retrieve one order storage object by marker.
14
- *
15
- * @param {string} marker - Marker of the order object
16
- * @param {string} [langCode] - Language code
17
- *
18
- * @returns Return object of order information.
19
- */
20
- async getOrderByMarker(marker, langCode = this._defaultLangCode) {
21
- const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
22
- return this._normalizeData(result);
23
- }
24
12
  /**
25
13
  * Creation of an order in the order storage.
26
14
  *
@@ -52,7 +40,67 @@ class OrdersApi extends oneEntry_1.default {
52
40
  const formData = {};
53
41
  formData[langCode] = Array.isArray(data.formData) ? data.formData : [data.formData];
54
42
  data.formData = formData;
55
- const result = await this._fetchPost(`/marker/${marker}/order`, data);
43
+ const result = await this._fetchPost(`/marker/${marker}/orders`, data);
44
+ return this._normalizeData(result);
45
+ }
46
+ /**
47
+ * Getting all order storage object by marker
48
+ * @param {number} marker - Textual identifier of the order storage object
49
+ * @param {number} [langCode] Optional language field
50
+ */
51
+ async getAllOrdersByMarker(marker, langCode = this._defaultLangCode) {
52
+ const result = this._fetchGet(`/marker/${marker}/orders?langCode=${langCode}`);
53
+ return this._normalizeData(result.items);
54
+ }
55
+ /**
56
+ * Changing an order in the order store
57
+ * @param marker - The text identifier of the order storage object
58
+ * @param id - ID of the order object
59
+ * @param data Object for updating an order
60
+ * @param langCode Optional language field
61
+ *
62
+ * @example
63
+ * const body = {
64
+ * "formIdentifier": "bar-orders-form",
65
+ * "paymentIdentifier": "usd-payment",
66
+ * "formData": {
67
+ * "marker": "name_1",
68
+ * "value": "Name"
69
+ * },
70
+ * "products": [
71
+ * {
72
+ * "productId": 1,
73
+ * "quantity": 2,
74
+ * "price": "23.02"
75
+ * }
76
+ * ],
77
+ * "currency": "USD"
78
+ * }
79
+ */
80
+ async updateOrderByMarkerAndId(marker, id, data, langCode = this._defaultLangCode) {
81
+ const result = await this._fetchPut(`/marker/${marker}/orders/${id}?langCode=${langCode}`, data);
82
+ return this._normalizeData(result);
83
+ }
84
+ /**
85
+ * Getting all the order storage objects
86
+ * @param {number} [langCode] Optional language field
87
+ * @param {number} [limit] - Optional parameter for pagination, default is 0
88
+ * @param {number} [offset] - Optional parameter for pagination, default is 30
89
+ */
90
+ async getAllOrders(langCode = this._defaultLangCode, limit = 30, offset = 0) {
91
+ const result = await this._fetchGet(`?langCode=${langCode}&limit=${limit}&offset=${offset}`);
92
+ return this._normalizeData(result);
93
+ }
94
+ /**
95
+ * Retrieve one order storage object by marker.
96
+ *
97
+ * @param {string} marker - Marker of the order object
98
+ * @param {string} [langCode] - Language code
99
+ *
100
+ * @returns Return object of order information.
101
+ */
102
+ async getOrderByMarker(marker, langCode = this._defaultLangCode) {
103
+ const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
56
104
  return this._normalizeData(result);
57
105
  }
58
106
  }
@@ -3,11 +3,17 @@
3
3
  *
4
4
  * @property {function} getOrderByMarker - Retrieve one order storage object by marker.
5
5
  * @property {function} createOrder - Creation of an order in the order storage.
6
+ * @property {function} updateOrderByMarkerAndId - Changing an order in the order store.
7
+ * @property {function} getAllOrders - Getting all the order storage objects.
8
+ * @property {function} getAllOrdersByMarker - Getting one order storage object by marker.
6
9
 
7
10
  */
8
11
  interface IOrdersApi {
9
12
  getOrderByMarker(marker: string, langCode?: string): Promise<IOrdersEntity>;
10
13
  createOrder(marker: string, data: IOrderData): Promise<IBaseOrdersEntity>;
14
+ updateOrderByMarkerAndId(marker: string, id: string, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
15
+ getAllOrders(langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersEntity>>;
16
+ getAllOrdersByMarker(marker: string, langCode?: string): Promise<Array<IOrdersByMarkersEntity>>;
11
17
  }
12
18
  interface IPicture {
13
19
  filename: string;
@@ -105,4 +111,33 @@ interface IOrderData {
105
111
  products: Array<IOrderProductData>;
106
112
  currency: string;
107
113
  }
108
- export { IOrdersEntity, IBaseOrdersEntity, IOrderProducts, IPicture, IOrdersApi, IOrderData, IOrderProductData, IOrderMarkerData, IOrdersFormData };
114
+ /**
115
+ * @interface
116
+ * @property {string} statusIdentifier - Text identifier of the order status.
117
+ * @property {string} formIdentifier - Text identifier of the form status.
118
+ * @property {string} paymentIdentifier - Text identifier of the order payment.
119
+ * @property {Array<IOrdersFormData>} formData - Data submitted by the form linked to the order store.
120
+ * @property {Array<IOrderProducts>} products - Array of products added to order.
121
+ * @property {string} totalSum - Total order amount.
122
+ * @property {number} price - Price order.
123
+ * @property {string} currency - Currency used to pay for the order.
124
+ * @property {string} createdDate - Date when the order was created.
125
+ * @property {string} paymentAccountIdentifier - Textual identifier for the order payment.
126
+ * @property {Record<string, any>} paymentAccountLocalizeInfos - Payment account name considering localization.
127
+ * @property {boolean} isHistory - Indicates that the order has been saved in the order history.
128
+ */
129
+ interface IOrdersByMarkersEntity {
130
+ statusIdentifier: string;
131
+ formIdentifier: string;
132
+ paymentIdentifier: string;
133
+ formData: Array<IOrdersFormData>;
134
+ products: Array<IOrderProducts>;
135
+ totalSum: string;
136
+ currency: string;
137
+ createdDate: string;
138
+ price: number;
139
+ paymentAccountIdentifier: string;
140
+ paymentAccountLocalizeInfos: Record<string, any>;
141
+ isHistory: boolean;
142
+ }
143
+ export { IOrdersEntity, IBaseOrdersEntity, IOrderProducts, IPicture, IOrdersApi, IOrderData, IOrderProductData, IOrderMarkerData, IOrdersFormData, IOrdersByMarkersEntity };
@@ -93,6 +93,7 @@ interface IFilterParams {
93
93
  *
94
94
  * @interface
95
95
  * @property {number} id - The unique identifier.
96
+ * @property {object} additional - Additional value from the index.
96
97
  * @property {Record<string, any>} localizeInfos - The name of the products, taking into account localization.
97
98
  * @property {boolean} isVisible - A sign of page visibility.
98
99
  * @property {number | null} statusId - Product page status identifiers (may be null).
@@ -102,10 +103,17 @@ interface IFilterParams {
102
103
  * @property {number} price - The value of the product page price taken from the index.
103
104
  * @property {string} templateIdentifier - User id of the linked template.
104
105
  * @property {string} shortDescTemplateIdentifier - User id of the linked template for a short description.
106
+ * @property {Record<string, any>} statusLocalizeInfos - JSON description of the item status object, taking into account the language.
105
107
  * @property {number} position - Item number (for sorting).
106
108
  */
107
109
  interface IProductsEntity {
108
110
  id: number;
111
+ additional: {
112
+ prices: {
113
+ min: number;
114
+ max: number;
115
+ };
116
+ };
109
117
  localizeInfos: Record<string, any>;
110
118
  blocks?: string | Array<string>;
111
119
  isVisible: boolean;
@@ -116,6 +124,7 @@ interface IProductsEntity {
116
124
  price: number;
117
125
  templateIdentifier: string | null;
118
126
  shortDescTemplateIdentifier: string;
127
+ statusLocalizeInfos: Record<string, any>;
119
128
  attributeValues: Record<string, any>;
120
129
  position: number;
121
130
  sku: string | null;
@@ -22,4 +22,12 @@ export default class TemplatesPreviewApi extends OneEntry implements ITemplatesA
22
22
  * @returns Returns a TemplateEntity object
23
23
  */
24
24
  getTemplateByType(type: Types, langCode?: string): Promise<Array<ITemplateEntity>>;
25
+ /**
26
+ * Get one template object by id.
27
+ *
28
+ * @param {string} id - Template id
29
+ *
30
+ * @returns Returns a TemplateEntity object
31
+ */
32
+ getTemplateById(id: string): Promise<ITemplateList>;
25
33
  }
@@ -35,5 +35,16 @@ class TemplatesPreviewApi extends oneEntry_1.default {
35
35
  const result = await this._fetchGet(`?type=${type}`);
36
36
  return this._normalizeData(result, langCode);
37
37
  }
38
+ /**
39
+ * Get one template object by id.
40
+ *
41
+ * @param {string} id - Template id
42
+ *
43
+ * @returns Returns a TemplateEntity object
44
+ */
45
+ async getTemplateById(id) {
46
+ const result = await this._fetchGet(`/${id}`);
47
+ return result;
48
+ }
38
49
  }
39
50
  exports.default = TemplatesPreviewApi;
@@ -4,12 +4,13 @@ import { Types } from "../base/utils";
4
4
  * Represents an interface object of Templates Api.
5
5
  *
6
6
  * @property {function} getAllTemplates - Get all template objects grouped by types.
7
- *
8
7
  * @property {function} getTemplateByType - Get template objects by type.
8
+ * @property {function} getTemplateById - Get one template object by id.
9
9
  */
10
10
  interface ITemplatesApi {
11
11
  getAllTemplates(langCode: string): Promise<ITemplateList>;
12
12
  getTemplateByType(type: Types, langCode: string): Promise<Array<ITemplateEntity>>;
13
+ getTemplateById(id: string): Promise<ITemplateList>;
13
14
  }
14
15
  /**
15
16
  * Represents a template entity object.
@@ -21,7 +22,7 @@ interface ITemplatesApi {
21
22
  * @property {string} identifier - The textual identifier for the record field.
22
23
  * @property {IGeneralTypesEntity} generalType - General type Entity object.
23
24
  * @property {number} generalTypeId - General type Entity id.
24
- * @property {Record<string, any>} localizeInfos - The name of the template, taking into account localization.
25
+ * @property {string} title - The name of the template.
25
26
  * @property {number} position - The position of the object.
26
27
  * @property {number | string} positionId - Id of the item object.
27
28
  * @property {Types} generalTypeName - General type name.
@@ -34,7 +35,7 @@ interface ITemplateEntity {
34
35
  identifier: string;
35
36
  generalType?: IGeneralTypesEntity;
36
37
  generalTypeId: number;
37
- localizeInfos: Record<string, any>;
38
+ title: string;
38
39
  position: number;
39
40
  positionId?: number;
40
41
  generalTypeName: Types;
@@ -34,7 +34,7 @@ interface ITemplatesPreviewEntity {
34
34
  vertical: IProportion | null;
35
35
  square: ISquare;
36
36
  };
37
- localizeInfos: Record<string, any>;
37
+ title: string;
38
38
  position: number;
39
39
  }
40
40
  interface IProportion {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.63",
3
+ "version": "1.0.64",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",