oneentry 1.0.83 → 1.0.85

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,4 @@
1
- import { IProductsQuery, IFilterParams, IProductApi, IProductsEntity, IProductInfo, IProductBlock } from './productsInterfaces';
1
+ import { IProductsQuery, IFilterParams, IProductApi, IProductsEntity, IProductBlock, IProductEntity, IProductsResponse, IProductsInfo } from './productsInterfaces';
2
2
  import AsyncModules from '../base/asyncModules';
3
3
  import StateModule from "../base/stateModule";
4
4
  /**
@@ -53,7 +53,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
53
53
  *
54
54
  * @returns Array with ProductEntity objects
55
55
  */
56
- getProducts(body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
56
+ getProducts(body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
57
57
  /**
58
58
  * Search for all product page objects with pagination that do not have a category.
59
59
  *
@@ -77,7 +77,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
77
77
  *
78
78
  * @returns Array with ProductEntity objects
79
79
  */
80
- getProductsEmptyPage(langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
80
+ getProductsEmptyPage(langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
81
81
  /**
82
82
  * Search for all products with pagination for the selected category.
83
83
  * @param {Array<IFilterParams>} body - Request body.
@@ -123,7 +123,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
123
123
  *
124
124
  * @returns Array with ProductEntity objects
125
125
  */
126
- getProductsByPageId(id: number, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
126
+ getProductsByPageId(id: number, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
127
127
  /**
128
128
  * Search for information about products and prices for the selected category.
129
129
  * @param {string} url - Page url.
@@ -147,7 +147,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
147
147
  *
148
148
  * @returns Array with ProductInformation objects
149
149
  */
150
- getProductsPriceByPageUrl(url: string, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductInfo>>;
150
+ getProductsPriceByPageUrl(url: string, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsInfo>;
151
151
  /**
152
152
  * Search for all products with pagination for the selected category.
153
153
  * @param {Array<IFilterParams>} body - Request body.
@@ -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<IProductsResponse>;
197
197
  /**
198
198
  * Find all related product page objects.
199
199
  *
@@ -212,7 +212,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
212
212
  *
213
213
  * @returns Array with ProductEntity objects
214
214
  */
215
- getRelatedProductsById(id: number, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
215
+ getRelatedProductsById(id: number, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
216
216
  /**
217
217
  * Retrieve one product object.
218
218
  *
@@ -222,7 +222,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
222
222
  *
223
223
  * @returns ProductEntity object.
224
224
  */
225
- getProductById(id: number, langCode?: string): Promise<IProductsEntity>;
225
+ getProductById(id: number, langCode?: string): Promise<IProductEntity>;
226
226
  /**
227
227
  * Getting a product block object by product id.
228
228
  * @param {number} id - Product id
@@ -67,7 +67,7 @@ class ProductApi extends asyncModules_1.default {
67
67
  async getProducts(body = [], langCode = this.state.lang, userQuery) {
68
68
  const query = { ...this._defaultQuery, ...userQuery, langCode };
69
69
  const result = await this._fetchPost(`/all?` + this._queryParamsToString(query), body);
70
- return this._dataPostProcess(result.items, langCode);
70
+ return this._dataPostProcess(result, langCode);
71
71
  }
72
72
  /**
73
73
  * Search for all product page objects with pagination that do not have a category.
@@ -95,7 +95,7 @@ class ProductApi extends asyncModules_1.default {
95
95
  async getProductsEmptyPage(langCode = this.state.lang, userQuery) {
96
96
  const query = { ...this._defaultQuery, ...userQuery };
97
97
  const result = await this._fetchGet(`/empty-page?langCode=${langCode}&` + this._queryParamsToString(query));
98
- return this._dataPostProcess(result.items, langCode);
98
+ return this._dataPostProcess(result, langCode);
99
99
  }
100
100
  /**
101
101
  * Search for all products with pagination for the selected category.
@@ -145,7 +145,7 @@ class ProductApi extends asyncModules_1.default {
145
145
  async getProductsByPageId(id, body = [], langCode = this.state.lang, userQuery) {
146
146
  const query = { ...this._defaultQuery, ...userQuery };
147
147
  const result = await this._fetchPost(`/page/${id}?langCode=${langCode}&` + this._queryParamsToString(query), body);
148
- return this._dataPostProcess(result.items, langCode);
148
+ return this._dataPostProcess(result, langCode);
149
149
  }
150
150
  /**
151
151
  * Search for information about products and prices for the selected category.
@@ -173,7 +173,7 @@ class ProductApi extends asyncModules_1.default {
173
173
  async getProductsPriceByPageUrl(url, langCode = this.state.lang, userQuery) {
174
174
  const query = { ...this._defaultQuery, ...userQuery, langCode };
175
175
  const result = await this._fetchGet(`/page/${url}/prices?` + this._queryParamsToString(query));
176
- return result.items;
176
+ return result;
177
177
  }
178
178
  /**
179
179
  * Search for all products with pagination for the selected category.
@@ -223,7 +223,7 @@ class ProductApi extends asyncModules_1.default {
223
223
  async getProductsByPageUrl(url, body = [], langCode = this.state.lang, userQuery) {
224
224
  const query = { ...this._defaultQuery, ...userQuery };
225
225
  const result = await this._fetchPost(`/page/url/${url}?langCode=${langCode}&` + this._queryParamsToString(query), body);
226
- return this._dataPostProcess(result.items, langCode);
226
+ return this._dataPostProcess(result, langCode);
227
227
  }
228
228
  /**
229
229
  * Find all related product page objects.
@@ -246,7 +246,7 @@ class ProductApi extends asyncModules_1.default {
246
246
  async getRelatedProductsById(id, langCode = this.state.lang, userQuery) {
247
247
  const query = { ...this._defaultQuery, ...userQuery };
248
248
  const result = await this._fetchGet(`/${id}/related?langCode=${langCode}&` + this._queryParamsToString(query));
249
- return this._dataPostProcess(result.items, langCode);
249
+ return this._dataPostProcess(result, langCode);
250
250
  }
251
251
  /**
252
252
  * Retrieve one product object.
@@ -3,31 +3,23 @@ import { LangType, Types } from "../base/utils";
3
3
  * Represents an interface object of Products Api.
4
4
  *
5
5
  * @property {function} getProducts - Search for all product page objects with pagination and filtering.
6
- *
7
6
  * @property {function} getProductsEmptyPage - Search for all product page objects with pagination that do not have a category.
8
- *
9
7
  * @property {function} getProductsByPageId - Search for all products with pagination for the selected category.
10
- *
11
8
  * @property {function} getProductsPriceByPageUrl - Search for information about products and prices for the selected category.
12
- *
13
9
  * @property {function} getProductsByPageUrl - Search for all products with pagination for the selected category.
14
- *
15
10
  * @property {function} getRelatedProductsById - Find all related product page objects.
16
- *
17
11
  * @property {function} getProductById - Retrieve one product object.
18
- *
19
12
  * @property {function} getProductBlockById - Getting a product block object by product id.
20
- *
21
13
  * @property {function} searchProduct - Quick search for product page objects with limited output.
22
14
  */
23
15
  interface IProductApi {
24
- getProducts(body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
25
- getProductsEmptyPage(langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
26
- getProductsByPageId(id: number, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
27
- getProductsPriceByPageUrl(url: string, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductInfo>>;
28
- getProductsByPageUrl(url: string, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
29
- getRelatedProductsById(id: number, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
30
- getProductById(id: number, langCode: string): Promise<IProductsEntity>;
16
+ getProducts(body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
17
+ getProductsEmptyPage(langCode?: LangType, userQuery?: IProductsQuery): Promise<IProductsResponse>;
18
+ getProductsByPageId(id: number, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
19
+ getProductsPriceByPageUrl(url: string, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsInfo>;
20
+ getProductsByPageUrl(url: string, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
21
+ getRelatedProductsById(id: number, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
22
+ getProductById(id: number, langCode: string): Promise<IProductEntity>;
31
23
  getProductBlockById(id: number): Promise<Array<IProductBlock>>;
32
24
  searchProduct(name: string, langCode: string): Promise<Array<IProductsEntity>>;
33
25
  }
@@ -99,6 +91,7 @@ interface IFilterParams {
99
91
  * @property {object} additional - Additional value from the index.
100
92
  * @property {Record<string, any>} localizeInfos - The name of the products, taking into account localization.
101
93
  * @property {boolean} isVisible - A sign of page visibility.
94
+ * @property {boolean} [isPositionLocked] - Sorting position lock indicator (optional).
102
95
  * @property {number | null} statusIdentifier - Product page status identifiers (may be null).
103
96
  * @property {Array<number>} relatedIds - Ids of related product pages.
104
97
  * @property {string} attributeSetIdentifier - Set of attributes id.
@@ -117,8 +110,8 @@ interface IProductsEntity {
117
110
  max: number;
118
111
  };
119
112
  };
113
+ isPositionLocked?: Boolean;
120
114
  localizeInfos: Record<string, any>;
121
- blocks?: string | Array<string>;
122
115
  isVisible: boolean;
123
116
  statusIdentifier: string | null;
124
117
  attributeSetIdentifier: string;
@@ -130,8 +123,19 @@ interface IProductsEntity {
130
123
  attributeValues: Record<string, any>;
131
124
  position: number;
132
125
  sku: string | null;
126
+ }
127
+ interface IProductEntity extends IProductsEntity {
128
+ blocks?: Array<string>;
133
129
  productPages?: Array<Record<string, any>> | Record<string, any>;
134
130
  }
131
+ interface IProductsResponse {
132
+ total: number;
133
+ items: Array<IProductsEntity>;
134
+ }
135
+ interface IProductsInfo {
136
+ total: number;
137
+ items: Array<IProductsInfo>;
138
+ }
135
139
  interface IProductInfo {
136
140
  id: number;
137
141
  price: number;
@@ -166,4 +170,4 @@ interface IProductBlock {
166
170
  isSync: boolean;
167
171
  attributeValues: Record<string, any>;
168
172
  }
169
- export { IFilterParams, IProductsQuery, IProductApi, IProductsEntity, IProductInfo, IProductBlock };
173
+ export { IFilterParams, IProductsQuery, IProductApi, IProductsEntity, IProductsInfo, IProductInfo, IProductBlock, IProductEntity, IProductsResponse };
@@ -39,7 +39,7 @@ export default class UsersApi extends AsyncModules implements IUsers {
39
39
  * },
40
40
  * "notificationData": {
41
41
  * "email": "example@oneentry.cloud",
42
- * "phonePush": "",
42
+ * "phonePush": ["+99999999999"],
43
43
  * "phoneSMS": "+99999999999"
44
44
  * }
45
45
  * }
@@ -43,7 +43,7 @@ class UsersApi extends asyncModules_1.default {
43
43
  * },
44
44
  * "notificationData": {
45
45
  * "email": "example@oneentry.cloud",
46
- * "phonePush": "",
46
+ * "phonePush": ["+99999999999"],
47
47
  * "phoneSMS": "+99999999999"
48
48
  * }
49
49
  * }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.83",
3
+ "version": "1.0.85",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,4 +26,4 @@
26
26
  "ts-jest": "^29.1.1",
27
27
  "typescript": "^5.3.3"
28
28
  }
29
- }
29
+ }