oneentry 1.0.101 → 1.0.104
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.
- package/README.md +798 -426
- package/configure.js +24 -33
- package/dist/admins/adminsApi.d.ts +11 -7
- package/dist/admins/adminsApi.js +17 -5
- package/dist/admins/adminsInterfaces.d.ts +33 -19
- package/dist/attribute-sets/attributeSetsApi.d.ts +35 -10
- package/dist/attribute-sets/attributeSetsApi.js +49 -7
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +42 -11
- package/dist/auth-provider/authProviderApi.d.ts +17 -5
- package/dist/auth-provider/authProviderApi.js +31 -14
- package/dist/auth-provider/authProvidersInterfaces.d.ts +23 -2
- package/dist/base/asyncModules.d.ts +2 -2
- package/dist/base/asyncModules.js +26 -17
- package/dist/base/result.js +26 -12
- package/dist/base/stateModule.d.ts +1 -1
- package/dist/base/stateModule.js +20 -11
- package/dist/base/syncModules.d.ts +4 -4
- package/dist/base/syncModules.js +16 -12
- package/dist/base/utils.d.ts +2 -2
- package/dist/blocks/blocksApi.d.ts +8 -5
- package/dist/blocks/blocksApi.js +30 -8
- package/dist/blocks/blocksInterfaces.d.ts +38 -5
- package/dist/events/eventsApi.d.ts +7 -7
- package/dist/events/eventsApi.js +14 -9
- package/dist/events/eventsInterfaces.d.ts +5 -2
- package/dist/{file-uploding → file-uploading}/fileUploadingApi.d.ts +3 -3
- package/dist/{file-uploding → file-uploading}/fileUploadingApi.js +9 -5
- package/dist/{file-uploding → file-uploading}/fileUploadingInterfaces.d.ts +8 -5
- package/dist/forms/formsApi.d.ts +4 -4
- package/dist/forms/formsApi.js +4 -1
- package/dist/forms/formsInterfaces.d.ts +2 -3
- package/dist/formsData/formsDataApi.d.ts +5 -5
- package/dist/formsData/formsDataApi.js +10 -4
- package/dist/formsData/formsDataInterfaces.d.ts +2 -2
- package/dist/general-types/{typesApi.d.ts → generalTypesApi.d.ts} +4 -4
- package/dist/general-types/{typesApi.js → generalTypesApi.js} +4 -1
- package/dist/general-types/generalTypesInterfaces.d.ts +2 -2
- package/dist/index.d.ts +33 -21
- package/dist/index.js +37 -26
- package/dist/integration-collections/integrationCollectionsApi.d.ts +128 -0
- package/dist/integration-collections/integrationCollectionsApi.js +161 -0
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +57 -0
- package/dist/integration-collections/integrationCollectionsInterfaces.js +2 -0
- package/dist/locales/localesApi.d.ts +4 -4
- package/dist/locales/localesApi.js +4 -1
- package/dist/locales/localesInterfaces.d.ts +2 -2
- package/dist/menus/menusApi.d.ts +4 -4
- package/dist/menus/menusApi.js +4 -1
- package/dist/menus/menusInterfaces.d.ts +6 -4
- package/dist/menus/menusInterfaces.js +1 -0
- package/dist/orders/ordersApi.d.ts +8 -8
- package/dist/orders/ordersApi.js +15 -7
- package/dist/orders/ordersInterfaces.d.ts +13 -3
- package/dist/pages/pagesApi.d.ts +4 -10
- package/dist/pages/pagesApi.js +14 -10
- package/dist/pages/pagesInterfaces.d.ts +13 -22
- package/dist/payments/paymentsApi.d.ts +6 -6
- package/dist/payments/paymentsApi.js +14 -6
- package/dist/payments/paymentsInterfaces.d.ts +20 -5
- package/dist/product-statuses/productStatusesApi.d.ts +3 -3
- package/dist/product-statuses/productStatusesApi.js +4 -1
- package/dist/product-statuses/productStatusesInterfaces.d.ts +2 -5
- package/dist/products/productsApi.d.ts +38 -54
- package/dist/products/productsApi.js +63 -61
- package/dist/products/productsInterfaces.d.ts +52 -40
- package/dist/system/systemApi.d.ts +3 -3
- package/dist/system/systemApi.js +5 -1
- package/dist/system/systemInterfaces.d.ts +1 -1
- package/dist/templates/templatesApi.d.ts +6 -3
- package/dist/templates/templatesApi.js +10 -2
- package/dist/templates/templatesInterfaces.d.ts +2 -2
- package/dist/templates-preview/templatesPreviewApi.d.ts +5 -4
- package/dist/templates-preview/templatesPreviewApi.js +5 -1
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +21 -10
- package/dist/users/usersApi.d.ts +15 -4
- package/dist/users/usersApi.js +29 -2
- package/dist/users/usersInterfaces.d.ts +10 -4
- package/dist/web-socket/wsApi.d.ts +4 -4
- package/dist/web-socket/wsApi.js +15 -14
- package/dist/web-socket/wsInterfaces.d.ts +2 -2
- package/package.json +46 -10
- /package/dist/{file-uploding → file-uploading}/fileUploadingInterfaces.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IProductsQuery, IFilterParams, IProductApi, IProductsEntity, IProductBlock, IProductEntity, IProductsResponse, IProductsInfo } from './productsInterfaces';
|
|
2
1
|
import AsyncModules from '../base/asyncModules';
|
|
3
|
-
import StateModule from
|
|
4
|
-
import { IError } from
|
|
2
|
+
import type StateModule from '../base/stateModule';
|
|
3
|
+
import type { IError } from '../base/utils';
|
|
4
|
+
import type { IFilterParams, IProductApi, IProductBlock, IProductEntity, IProductsEntity, IProductsInfo, IProductsQuery, IProductsResponse } from './productsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with product pages
|
|
7
7
|
*/
|
|
@@ -12,27 +12,23 @@ 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
|
+
*
|
|
15
16
|
* @param {Array<IFilterParams>} body - Request body. Default [].
|
|
16
17
|
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
17
18
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
18
|
-
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
19
19
|
*
|
|
20
20
|
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
21
|
-
*
|
|
21
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
22
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
23
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by (id, title, date, price, position, status)
|
|
24
|
+
* @param {number} [userQuery.statusId] - Optional parameter - search by status id
|
|
22
25
|
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
23
|
-
*
|
|
24
26
|
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
25
|
-
*
|
|
26
27
|
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
27
|
-
*
|
|
28
28
|
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
29
29
|
*
|
|
30
|
-
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
31
|
-
*
|
|
32
|
-
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
33
|
-
*
|
|
34
30
|
* @example
|
|
35
|
-
* const body = [
|
|
31
|
+
* const body: IFilterParams[] = [
|
|
36
32
|
* {
|
|
37
33
|
* "attributeMarker": "price",
|
|
38
34
|
* "conditionMarker": "mth",
|
|
@@ -64,46 +60,35 @@ export default class ProductApi extends AsyncModules implements IProductApi {
|
|
|
64
60
|
*
|
|
65
61
|
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
66
62
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
67
|
-
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
68
63
|
*
|
|
69
64
|
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
70
|
-
*
|
|
65
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
71
66
|
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
72
|
-
*
|
|
73
67
|
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
74
|
-
*
|
|
75
68
|
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
76
|
-
*
|
|
77
69
|
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
78
|
-
*
|
|
79
70
|
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
80
|
-
*
|
|
81
|
-
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
71
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by (id, title, date, price, position, status)
|
|
82
72
|
*
|
|
83
73
|
* @returns Array with ProductEntity objects
|
|
84
74
|
*/
|
|
85
75
|
getProductsEmptyPage(langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse | IError>;
|
|
86
76
|
/**
|
|
87
77
|
* Search for all products with pagination for the selected category.
|
|
78
|
+
*
|
|
88
79
|
* @param {Array<IFilterParams>} body - Request body.
|
|
89
80
|
* @param {number} id - Page id.
|
|
90
81
|
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
91
82
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
92
|
-
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
93
83
|
*
|
|
94
84
|
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
95
|
-
*
|
|
85
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
96
86
|
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
97
|
-
*
|
|
98
87
|
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
99
|
-
*
|
|
100
88
|
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
101
|
-
*
|
|
102
89
|
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
103
|
-
*
|
|
104
90
|
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
105
|
-
*
|
|
106
|
-
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
91
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by (id, title, date, price, position, status)
|
|
107
92
|
*
|
|
108
93
|
* @example
|
|
109
94
|
* const body = [
|
|
@@ -135,49 +120,39 @@ export default class ProductApi extends AsyncModules implements IProductApi {
|
|
|
135
120
|
getProductsByPageId(id: number, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse | IError>;
|
|
136
121
|
/**
|
|
137
122
|
* Search for information about products and prices for the selected category.
|
|
123
|
+
*
|
|
138
124
|
* @param {string} url - Page url.
|
|
139
125
|
* @param {string} langCode - Language code.
|
|
140
126
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
141
|
-
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
142
127
|
*
|
|
143
128
|
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
144
|
-
*
|
|
129
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
145
130
|
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
146
|
-
*
|
|
147
131
|
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
148
|
-
*
|
|
149
132
|
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
150
|
-
*
|
|
151
133
|
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
152
|
-
*
|
|
153
134
|
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
154
|
-
*
|
|
155
|
-
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
135
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by (id, title, date, price, position, status)
|
|
156
136
|
*
|
|
157
137
|
* @returns Array with ProductInformation objects
|
|
158
138
|
*/
|
|
159
139
|
getProductsPriceByPageUrl(url: string, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsInfo | IError>;
|
|
160
140
|
/**
|
|
161
141
|
* Search for all products with pagination for the selected category.
|
|
142
|
+
*
|
|
162
143
|
* @param {Array<IFilterParams>} body - Request body.
|
|
163
144
|
* @param {string} url - Page url.
|
|
164
145
|
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
165
146
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
166
|
-
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
167
147
|
*
|
|
168
148
|
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
169
|
-
*
|
|
149
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
170
150
|
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
171
|
-
*
|
|
172
151
|
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
173
|
-
*
|
|
174
152
|
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
175
|
-
*
|
|
176
153
|
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
177
|
-
*
|
|
178
154
|
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
179
|
-
*
|
|
180
|
-
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
155
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by (id, title, date, price, position, status)
|
|
181
156
|
*
|
|
182
157
|
* @example
|
|
183
158
|
* const body = [
|
|
@@ -211,26 +186,36 @@ export default class ProductApi extends AsyncModules implements IProductApi {
|
|
|
211
186
|
* Find all related product page objects.
|
|
212
187
|
*
|
|
213
188
|
* @param {number} [id] - Product page identifier for which to find relationship.
|
|
214
|
-
*
|
|
215
189
|
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
216
|
-
*
|
|
217
190
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
218
|
-
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
219
191
|
*
|
|
220
192
|
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
221
|
-
*
|
|
193
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
222
194
|
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
223
|
-
*
|
|
224
|
-
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
195
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by (id, title, date, price, position, status)
|
|
225
196
|
*
|
|
226
197
|
* @returns Array with ProductEntity objects
|
|
227
198
|
*/
|
|
228
199
|
getRelatedProductsById(id: number, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse | IError>;
|
|
200
|
+
/**
|
|
201
|
+
* Find products by its ids.
|
|
202
|
+
*
|
|
203
|
+
* @param {string} [ids] - Product page identifiers for which to find relationships.
|
|
204
|
+
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
205
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
206
|
+
*
|
|
207
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
208
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
209
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
210
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by (id, title, date, price, position, status)
|
|
211
|
+
*
|
|
212
|
+
* @returns Array with ProductEntity objects
|
|
213
|
+
*/
|
|
214
|
+
getProductsByIds(ids: string, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity> | IError>;
|
|
229
215
|
/**
|
|
230
216
|
* Retrieve one product object.
|
|
231
217
|
*
|
|
232
218
|
* @param {number} [id] - Product id.
|
|
233
|
-
*
|
|
234
219
|
* @param {string} [langCode] Language code parameter. Default "en_US".
|
|
235
220
|
*
|
|
236
221
|
* @returns ProductEntity object.
|
|
@@ -238,15 +223,14 @@ export default class ProductApi extends AsyncModules implements IProductApi {
|
|
|
238
223
|
getProductById(id: number, langCode?: string): Promise<IProductEntity | IError>;
|
|
239
224
|
/**
|
|
240
225
|
* Getting a product block object by product id.
|
|
241
|
-
* @param {number} id - Product id
|
|
242
226
|
*
|
|
227
|
+
* @param {number} id - Product id
|
|
243
228
|
*/
|
|
244
229
|
getProductBlockById(id: number): Promise<Array<IProductBlock> | IError>;
|
|
245
230
|
/**
|
|
246
231
|
* Quick search for product page objects with limited output.
|
|
247
232
|
*
|
|
248
233
|
* @param {string} [name] - Text to search product page objects (search is based on the title field of the localizeInfos object with language consideration)
|
|
249
|
-
*
|
|
250
234
|
* @param {string} [langCode] - Language code
|
|
251
235
|
*
|
|
252
236
|
* @returns Array with ProductEntity objects
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const asyncModules_1 = require("../base/asyncModules");
|
|
6
|
+
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
|
+
// import { IProductInfo } from './productsInterfaces';
|
|
4
8
|
/**
|
|
5
9
|
* Controllers for working with product pages
|
|
6
10
|
*/
|
|
@@ -10,39 +14,30 @@ class ProductApi extends asyncModules_1.default {
|
|
|
10
14
|
this._defaultQuery = {
|
|
11
15
|
offset: 0,
|
|
12
16
|
limit: 30,
|
|
13
|
-
templateMarker: null,
|
|
14
|
-
statusMarker: null,
|
|
15
|
-
conditionValue: null,
|
|
16
|
-
conditionMarker: null,
|
|
17
|
-
attributeMarker: null,
|
|
18
17
|
sortOrder: null,
|
|
19
|
-
sortKey: null
|
|
18
|
+
sortKey: null,
|
|
20
19
|
};
|
|
21
20
|
this._url = state.url + '/api/content/products';
|
|
22
21
|
}
|
|
23
22
|
/**
|
|
24
23
|
* Search for all products with pagination and filter.
|
|
24
|
+
*
|
|
25
25
|
* @param {Array<IFilterParams>} body - Request body. Default [].
|
|
26
26
|
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
27
27
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
28
|
-
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
29
28
|
*
|
|
30
29
|
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
31
|
-
*
|
|
30
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
31
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
32
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by (id, title, date, price, position, status)
|
|
33
|
+
* @param {number} [userQuery.statusId] - Optional parameter - search by status id
|
|
32
34
|
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
33
|
-
*
|
|
34
35
|
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
35
|
-
*
|
|
36
36
|
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
37
|
-
*
|
|
38
37
|
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
39
38
|
*
|
|
40
|
-
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
41
|
-
*
|
|
42
|
-
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
43
|
-
*
|
|
44
39
|
* @example
|
|
45
|
-
* const body = [
|
|
40
|
+
* const body: IFilterParams[] = [
|
|
46
41
|
* {
|
|
47
42
|
* "attributeMarker": "price",
|
|
48
43
|
* "conditionMarker": "mth",
|
|
@@ -69,7 +64,11 @@ class ProductApi extends asyncModules_1.default {
|
|
|
69
64
|
* @returns Array with ProductEntity objects
|
|
70
65
|
*/
|
|
71
66
|
async getProducts(body = [], langCode = this.state.lang, userQuery) {
|
|
72
|
-
const query = {
|
|
67
|
+
const query = {
|
|
68
|
+
...this._defaultQuery,
|
|
69
|
+
...userQuery,
|
|
70
|
+
langCode,
|
|
71
|
+
};
|
|
73
72
|
const result = await this._fetchPost(`/all?` + this._queryParamsToString(query), body);
|
|
74
73
|
return this._dataPostProcess(result, langCode);
|
|
75
74
|
}
|
|
@@ -78,21 +77,15 @@ class ProductApi extends asyncModules_1.default {
|
|
|
78
77
|
*
|
|
79
78
|
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
80
79
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
81
|
-
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
82
80
|
*
|
|
83
81
|
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
84
|
-
*
|
|
82
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
85
83
|
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
86
|
-
*
|
|
87
84
|
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
88
|
-
*
|
|
89
85
|
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
90
|
-
*
|
|
91
86
|
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
92
|
-
*
|
|
93
87
|
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
94
|
-
*
|
|
95
|
-
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
88
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by (id, title, date, price, position, status)
|
|
96
89
|
*
|
|
97
90
|
* @returns Array with ProductEntity objects
|
|
98
91
|
*/
|
|
@@ -103,25 +96,20 @@ class ProductApi extends asyncModules_1.default {
|
|
|
103
96
|
}
|
|
104
97
|
/**
|
|
105
98
|
* Search for all products with pagination for the selected category.
|
|
99
|
+
*
|
|
106
100
|
* @param {Array<IFilterParams>} body - Request body.
|
|
107
101
|
* @param {number} id - Page id.
|
|
108
102
|
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
109
103
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
110
|
-
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
111
104
|
*
|
|
112
105
|
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
113
|
-
*
|
|
106
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
114
107
|
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
115
|
-
*
|
|
116
108
|
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
117
|
-
*
|
|
118
109
|
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
119
|
-
*
|
|
120
110
|
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
121
|
-
*
|
|
122
111
|
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
123
|
-
*
|
|
124
|
-
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
112
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by (id, title, date, price, position, status)
|
|
125
113
|
*
|
|
126
114
|
* @example
|
|
127
115
|
* const body = [
|
|
@@ -157,53 +145,47 @@ class ProductApi extends asyncModules_1.default {
|
|
|
157
145
|
}
|
|
158
146
|
/**
|
|
159
147
|
* Search for information about products and prices for the selected category.
|
|
148
|
+
*
|
|
160
149
|
* @param {string} url - Page url.
|
|
161
150
|
* @param {string} langCode - Language code.
|
|
162
151
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
163
|
-
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
164
152
|
*
|
|
165
153
|
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
166
|
-
*
|
|
154
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
167
155
|
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
168
|
-
*
|
|
169
156
|
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
170
|
-
*
|
|
171
157
|
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
172
|
-
*
|
|
173
158
|
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
174
|
-
*
|
|
175
159
|
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
176
|
-
*
|
|
177
|
-
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
160
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by (id, title, date, price, position, status)
|
|
178
161
|
*
|
|
179
162
|
* @returns Array with ProductInformation objects
|
|
180
163
|
*/
|
|
181
164
|
async getProductsPriceByPageUrl(url, langCode = this.state.lang, userQuery) {
|
|
182
|
-
const query = {
|
|
165
|
+
const query = {
|
|
166
|
+
...this._defaultQuery,
|
|
167
|
+
...userQuery,
|
|
168
|
+
langCode,
|
|
169
|
+
};
|
|
183
170
|
const result = await this._fetchGet(`/page/${url}/prices?` + this._queryParamsToString(query));
|
|
184
171
|
return result;
|
|
185
172
|
}
|
|
186
173
|
/**
|
|
187
174
|
* Search for all products with pagination for the selected category.
|
|
175
|
+
*
|
|
188
176
|
* @param {Array<IFilterParams>} body - Request body.
|
|
189
177
|
* @param {string} url - Page url.
|
|
190
178
|
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
191
179
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
192
|
-
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
193
180
|
*
|
|
194
181
|
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
195
|
-
*
|
|
182
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
196
183
|
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
197
|
-
*
|
|
198
184
|
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
199
|
-
*
|
|
200
185
|
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
201
|
-
*
|
|
202
186
|
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
203
|
-
*
|
|
204
187
|
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
205
|
-
*
|
|
206
|
-
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
188
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by (id, title, date, price, position, status)
|
|
207
189
|
*
|
|
208
190
|
* @example
|
|
209
191
|
* const body = [
|
|
@@ -234,24 +216,21 @@ class ProductApi extends asyncModules_1.default {
|
|
|
234
216
|
*/
|
|
235
217
|
async getProductsByPageUrl(url, body = [], langCode = this.state.lang, userQuery) {
|
|
236
218
|
const query = { ...this._defaultQuery, ...userQuery };
|
|
237
|
-
const result = await this._fetchPost(`/page/url/${url}?langCode=${langCode}&` +
|
|
219
|
+
const result = await this._fetchPost(`/page/url/${url}?langCode=${langCode}&` +
|
|
220
|
+
this._queryParamsToString(query), body);
|
|
238
221
|
return this._dataPostProcess(result, langCode);
|
|
239
222
|
}
|
|
240
223
|
/**
|
|
241
224
|
* Find all related product page objects.
|
|
242
225
|
*
|
|
243
226
|
* @param {number} [id] - Product page identifier for which to find relationship.
|
|
244
|
-
*
|
|
245
227
|
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
246
|
-
*
|
|
247
228
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
248
|
-
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
249
229
|
*
|
|
250
230
|
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
251
|
-
*
|
|
231
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
252
232
|
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
253
|
-
*
|
|
254
|
-
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
233
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by (id, title, date, price, position, status)
|
|
255
234
|
*
|
|
256
235
|
* @returns Array with ProductEntity objects
|
|
257
236
|
*/
|
|
@@ -260,11 +239,34 @@ class ProductApi extends asyncModules_1.default {
|
|
|
260
239
|
const result = await this._fetchGet(`/${id}/related?langCode=${langCode}&` + this._queryParamsToString(query));
|
|
261
240
|
return this._dataPostProcess(result, langCode);
|
|
262
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Find products by its ids.
|
|
244
|
+
*
|
|
245
|
+
* @param {string} [ids] - Product page identifiers for which to find relationships.
|
|
246
|
+
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
247
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
248
|
+
*
|
|
249
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
250
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
251
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
252
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by (id, title, date, price, position, status)
|
|
253
|
+
*
|
|
254
|
+
* @returns Array with ProductEntity objects
|
|
255
|
+
*/
|
|
256
|
+
async getProductsByIds(ids, langCode = this.state.lang, userQuery) {
|
|
257
|
+
const query = {
|
|
258
|
+
ids,
|
|
259
|
+
langCode,
|
|
260
|
+
...this._defaultQuery,
|
|
261
|
+
...userQuery,
|
|
262
|
+
};
|
|
263
|
+
const result = await this._fetchGet(`/ids?` + this._queryParamsToString(query));
|
|
264
|
+
return this._dataPostProcess(result, langCode);
|
|
265
|
+
}
|
|
263
266
|
/**
|
|
264
267
|
* Retrieve one product object.
|
|
265
268
|
*
|
|
266
269
|
* @param {number} [id] - Product id.
|
|
267
|
-
*
|
|
268
270
|
* @param {string} [langCode] Language code parameter. Default "en_US".
|
|
269
271
|
*
|
|
270
272
|
* @returns ProductEntity object.
|
|
@@ -275,8 +277,8 @@ class ProductApi extends asyncModules_1.default {
|
|
|
275
277
|
}
|
|
276
278
|
/**
|
|
277
279
|
* Getting a product block object by product id.
|
|
278
|
-
* @param {number} id - Product id
|
|
279
280
|
*
|
|
281
|
+
* @param {number} id - Product id
|
|
280
282
|
*/
|
|
281
283
|
async getProductBlockById(id) {
|
|
282
284
|
const response = await this._fetchGet(`/${id}/blocks`);
|
|
@@ -286,7 +288,6 @@ class ProductApi extends asyncModules_1.default {
|
|
|
286
288
|
* Quick search for product page objects with limited output.
|
|
287
289
|
*
|
|
288
290
|
* @param {string} [name] - Text to search product page objects (search is based on the title field of the localizeInfos object with language consideration)
|
|
289
|
-
*
|
|
290
291
|
* @param {string} [langCode] - Language code
|
|
291
292
|
*
|
|
292
293
|
* @returns Array with ProductEntity objects
|
|
@@ -294,6 +295,7 @@ class ProductApi extends asyncModules_1.default {
|
|
|
294
295
|
async searchProduct(name, langCode = this.state.lang) {
|
|
295
296
|
const searchProducts = await this._fetchGet(`/quick/search?langCode=${langCode}&name=${name}`);
|
|
296
297
|
if (this.state.multipleResponse) {
|
|
298
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
297
299
|
const productsList = [];
|
|
298
300
|
await Promise.all(searchProducts.map(async (product) => {
|
|
299
301
|
await this.getProductById(product.id, langCode).then((result) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AttributeType, IError, LangType, Types } from
|
|
1
|
+
import type { AttributeType, IError, LangType, Types } from '../base/utils';
|
|
2
2
|
/**
|
|
3
3
|
* Represents an interface object of Products Api.
|
|
4
4
|
*
|
|
@@ -38,25 +38,16 @@ interface IProductApi {
|
|
|
38
38
|
* @property {string} sortKey - Field for sorting (default - null)
|
|
39
39
|
*/
|
|
40
40
|
interface IProductsQuery {
|
|
41
|
-
offset
|
|
42
|
-
limit
|
|
41
|
+
offset: number;
|
|
42
|
+
limit: number;
|
|
43
|
+
sortOrder: 'DESC' | 'ASC' | null;
|
|
44
|
+
sortKey: 'id' | 'position' | 'title' | 'date' | 'price' | null;
|
|
45
|
+
templateMarker?: string | null;
|
|
43
46
|
statusMarker?: string | null;
|
|
44
47
|
conditionValue?: string | null;
|
|
45
|
-
/**
|
|
46
|
-
* 'in' - Contains,
|
|
47
|
-
* 'nin' - Does not contain,
|
|
48
|
-
* 'eq' - Equal,
|
|
49
|
-
* 'neq' - Not equal,
|
|
50
|
-
* 'mth' - Greater than,
|
|
51
|
-
* 'lth' - Less than,
|
|
52
|
-
* 'exs' - Exists,
|
|
53
|
-
* 'nexs' - Does not exist
|
|
54
|
-
*/
|
|
55
|
-
conditionMarker?: 'in' | 'nin' | 'eq' | 'neq' | 'mth' | 'lth' | 'exs' | 'nexs' | null;
|
|
56
48
|
attributeMarker?: string | null;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
[key: string]: string | number | null;
|
|
49
|
+
conditionMarker?: 'in' /** in - Contains */ | 'nin' /** nin - Does not contain */ | 'eq' /** 'eq' - Equal */ | 'neq' /** 'neq' - Not equal */ | 'mth' /** 'mth' - Greater than */ | 'lth' /** 'lth' - Less than */ | 'exs' /** 'exs' - Exists */ | 'nexs' /** 'nexs' - Does not exist */ | null;
|
|
50
|
+
[key: string]: any;
|
|
60
51
|
}
|
|
61
52
|
/**
|
|
62
53
|
* Represents a product POST data object.
|
|
@@ -71,22 +62,12 @@ interface IProductsQuery {
|
|
|
71
62
|
*/
|
|
72
63
|
interface IFilterParams {
|
|
73
64
|
attributeMarker: string;
|
|
74
|
-
/**
|
|
75
|
-
* 'in' - Contains,
|
|
76
|
-
* 'nin' - Does not contain,
|
|
77
|
-
* 'eq' - Equal,
|
|
78
|
-
* 'neq' - Not equal,
|
|
79
|
-
* 'mth' - Greater than,
|
|
80
|
-
* 'lth' - Less than,
|
|
81
|
-
* 'exs' - Exists,
|
|
82
|
-
* 'nexs' - Does not exist
|
|
83
|
-
*/
|
|
84
|
-
conditionMarker?: 'in' | 'nin' | 'eq' | 'neq' | 'mth' | 'lth' | 'exs' | 'nexs' | null;
|
|
65
|
+
conditionMarker?: 'in' /** 'in' - Contains */ | 'nin' /** 'nin' - Does not contain */ | 'eq' /** 'eq' - Equal */ | 'neq' /** 'neq' - Not equal */ | 'mth' /** 'mth' - Greater than */ | 'lth' /** 'lth' - Less than */ | 'exs' /** 'exs' - Exists */ | 'nexs' /** 'nexs' - Does not exist */ | null;
|
|
85
66
|
conditionValue: number | string | null;
|
|
86
67
|
pageUrl?: Array<string> | null;
|
|
87
68
|
statusMarker?: string;
|
|
88
|
-
title
|
|
89
|
-
isNested
|
|
69
|
+
title?: string;
|
|
70
|
+
isNested?: boolean;
|
|
90
71
|
}
|
|
91
72
|
/**
|
|
92
73
|
* Represents a product entity object.
|
|
@@ -115,7 +96,7 @@ interface IProductsEntity {
|
|
|
115
96
|
max: number;
|
|
116
97
|
};
|
|
117
98
|
};
|
|
118
|
-
isPositionLocked?:
|
|
99
|
+
isPositionLocked?: boolean;
|
|
119
100
|
localizeInfos: Record<string, any>;
|
|
120
101
|
isVisible: boolean;
|
|
121
102
|
statusIdentifier: string | null;
|
|
@@ -123,28 +104,59 @@ interface IProductsEntity {
|
|
|
123
104
|
isSync: number | boolean;
|
|
124
105
|
price: number;
|
|
125
106
|
templateIdentifier: string | null;
|
|
126
|
-
shortDescTemplateIdentifier: string;
|
|
107
|
+
shortDescTemplateIdentifier: string | null;
|
|
127
108
|
statusLocalizeInfos: Record<string, any>;
|
|
128
109
|
attributeValues: AttributeType;
|
|
129
110
|
position: number;
|
|
130
111
|
sku: string | null;
|
|
131
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* IProductEntity
|
|
115
|
+
*
|
|
116
|
+
* @interface
|
|
117
|
+
* @property {Array<string>} blocks
|
|
118
|
+
* @property {Array<Record<string, any>> | Record<string, any>} productPages
|
|
119
|
+
*/
|
|
132
120
|
interface IProductEntity extends IProductsEntity {
|
|
133
121
|
blocks?: Array<string>;
|
|
134
122
|
productPages?: Array<Record<string, any>> | Record<string, any>;
|
|
135
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* IProductsResponse
|
|
126
|
+
*
|
|
127
|
+
* @interface
|
|
128
|
+
* @property {number} total
|
|
129
|
+
* @property {Array<IProductsEntity>} items
|
|
130
|
+
*/
|
|
136
131
|
interface IProductsResponse {
|
|
137
132
|
total: number;
|
|
138
133
|
items: Array<IProductsEntity>;
|
|
139
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* IProductsInfo
|
|
137
|
+
*
|
|
138
|
+
* @interface
|
|
139
|
+
* @property {number} total
|
|
140
|
+
* @property {Array<IProductInfo>} items
|
|
141
|
+
*/
|
|
140
142
|
interface IProductsInfo {
|
|
141
143
|
total: number;
|
|
142
|
-
items: Array<
|
|
144
|
+
items: Array<IProductInfo>;
|
|
143
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* IProductInfo
|
|
148
|
+
*
|
|
149
|
+
* @interface
|
|
150
|
+
* @property {number} id
|
|
151
|
+
* @property {number} price
|
|
152
|
+
*/
|
|
144
153
|
interface IProductInfo {
|
|
145
154
|
id: number;
|
|
146
155
|
price: number;
|
|
147
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* IProductBlock
|
|
159
|
+
*/
|
|
148
160
|
interface IProductBlock {
|
|
149
161
|
id: number;
|
|
150
162
|
attributeSetIdentifier: number | null;
|
|
@@ -154,13 +166,13 @@ interface IProductBlock {
|
|
|
154
166
|
identifier: string;
|
|
155
167
|
type: Types;
|
|
156
168
|
customSettings: {
|
|
157
|
-
sliderDelay: number;
|
|
158
|
-
sliderDelayType: string;
|
|
169
|
+
sliderDelay: number | null;
|
|
170
|
+
sliderDelayType: string | null;
|
|
159
171
|
productConfig: {
|
|
160
|
-
quantity: number;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
172
|
+
quantity: string | number;
|
|
173
|
+
countElementsPerRow: string | number;
|
|
174
|
+
sortType?: string;
|
|
175
|
+
sortOrder?: string;
|
|
164
176
|
};
|
|
165
177
|
similarProductRules: Array<{
|
|
166
178
|
property: string;
|
|
@@ -175,4 +187,4 @@ interface IProductBlock {
|
|
|
175
187
|
isSync: boolean;
|
|
176
188
|
attributeValues: AttributeType;
|
|
177
189
|
}
|
|
178
|
-
export { IFilterParams,
|
|
190
|
+
export type { IFilterParams, IProductApi, IProductBlock, IProductEntity, IProductInfo, IProductsEntity, IProductsInfo, IProductsQuery, IProductsResponse, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import AsyncModules from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import AsyncModules from '../base/asyncModules';
|
|
2
|
+
import type StateModule from '../base/stateModule';
|
|
3
|
+
import type { ISystem } from './systemInterfaces';
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with system - system
|
|
6
6
|
*/
|
package/dist/system/systemApi.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
|
+
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
4
8
|
/**
|
|
5
9
|
* Controllers for working with system - system
|
|
6
10
|
*/
|