oneentry 1.0.66 → 1.0.67
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 +303 -242
- package/dist/_cjs/admins/adminsApi.d.ts +1 -1
- package/dist/admins/adminsApi.d.ts +6 -4
- package/dist/admins/adminsApi.js +6 -6
- package/dist/attribute-sets/attributeSetsApi.d.ts +6 -4
- package/dist/attribute-sets/attributeSetsApi.js +7 -7
- package/dist/auth-provider/authProviderApi.d.ts +6 -4
- package/dist/auth-provider/authProviderApi.js +14 -10
- package/dist/auth-provider/authProvidersInterfaces.d.ts +2 -2
- package/dist/base/asyncModules.d.ts +16 -0
- package/dist/base/asyncModules.js +164 -0
- package/dist/base/modules.d.ts +14 -0
- package/dist/base/modules.js +173 -0
- package/dist/base/oneEntry.d.ts +0 -23
- package/dist/base/oneEntry.js +74 -236
- package/dist/base/stateModule.d.ts +10 -0
- package/dist/base/stateModule.js +13 -0
- package/dist/base/syncModules.d.ts +14 -0
- package/dist/base/syncModules.js +72 -0
- package/dist/blocks/blocksApi.d.ts +9 -6
- package/dist/blocks/blocksApi.js +17 -16
- package/dist/blocks/blocksInterfaces.d.ts +3 -2
- package/dist/events/eventsApi.d.ts +6 -4
- package/dist/events/eventsApi.js +5 -5
- package/dist/file-uploding/fileUploadingApi.d.ts +6 -4
- package/dist/file-uploding/fileUploadingApi.js +6 -6
- package/dist/forms/formsApi.d.ts +7 -5
- package/dist/forms/formsApi.js +8 -8
- package/dist/formsData/formsDataApi.d.ts +8 -6
- package/dist/formsData/formsDataApi.js +10 -10
- package/dist/general-types/typesApi.d.ts +6 -4
- package/dist/general-types/typesApi.js +5 -5
- package/dist/index.js +22 -20
- package/dist/locales/localesApi.d.ts +6 -4
- package/dist/locales/localesApi.js +5 -5
- package/dist/menus/menusApi.d.ts +7 -5
- package/dist/menus/menusApi.js +7 -7
- package/dist/orders/ordersApi.d.ts +6 -4
- package/dist/orders/ordersApi.js +10 -10
- package/dist/pages/pagesApi.d.ts +6 -4
- package/dist/pages/pagesApi.js +16 -19
- package/dist/payments/paymentsApi.d.ts +6 -10
- package/dist/payments/paymentsApi.js +5 -14
- package/dist/payments/paymentsInterfaces.d.ts +0 -2
- package/dist/product-statuses/productStatusesApi.d.ts +6 -4
- package/dist/product-statuses/productStatusesApi.js +8 -8
- package/dist/products/productsApi.d.ts +107 -52
- package/dist/products/productsApi.js +119 -65
- package/dist/products/productsInterfaces.d.ts +16 -8
- package/dist/system/systemApi.d.ts +6 -4
- package/dist/system/systemApi.js +5 -5
- package/dist/templates/templatesApi.d.ts +9 -6
- package/dist/templates/templatesApi.js +9 -9
- package/dist/templates/templatesInterfaces.d.ts +2 -1
- package/dist/templates-preview/templatesPreviewApi.d.ts +8 -6
- package/dist/templates-preview/templatesPreviewApi.js +10 -10
- package/dist/users/usersApi.d.ts +6 -4
- package/dist/users/usersApi.js +7 -7
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const asyncModules_1 = require("../base/asyncModules");
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with payments
|
|
6
6
|
*/
|
|
7
|
-
class PaymentsApi extends
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
10
|
-
this._url
|
|
7
|
+
class PaymentsApi extends asyncModules_1.default {
|
|
8
|
+
constructor(state) {
|
|
9
|
+
super(state);
|
|
10
|
+
this._url = state.url + '/api/content/payments';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Get list of payment sessions.
|
|
@@ -95,14 +95,5 @@ class PaymentsApi extends oneEntry_1.default {
|
|
|
95
95
|
const result = await this._fetchPost('/webhook/stripe', null);
|
|
96
96
|
return result;
|
|
97
97
|
}
|
|
98
|
-
/**
|
|
99
|
-
* Webhook for Paypal.
|
|
100
|
-
*
|
|
101
|
-
* @returns Returns true (in case of successful execution) or false (in case of unsuccessful execution)
|
|
102
|
-
*/
|
|
103
|
-
async webhookPaypal() {
|
|
104
|
-
const result = await this._fetchPost('/webhook/paypal', null);
|
|
105
|
-
return result;
|
|
106
|
-
}
|
|
107
98
|
}
|
|
108
99
|
exports.default = PaymentsApi;
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* @property {function} getAccounts - Get all payment accounts as an array.
|
|
9
9
|
* @property {function} getAccountById - Get a single payment account object by its identifier.
|
|
10
10
|
* @property {function} webhookStripe - Webhook for Stripe.
|
|
11
|
-
* @property {function} webhookPaypal - Webhook for Paypal.
|
|
12
11
|
*
|
|
13
12
|
*/
|
|
14
13
|
interface IPaymentsApi {
|
|
@@ -19,7 +18,6 @@ interface IPaymentsApi {
|
|
|
19
18
|
getAccounts(): Promise<Array<IAccountsEntity>>;
|
|
20
19
|
getAccountById(id: number): Promise<IAccountsEntity>;
|
|
21
20
|
webhookStripe(): Promise<boolean>;
|
|
22
|
-
webhookPaypal(): Promise<boolean>;
|
|
23
21
|
}
|
|
24
22
|
/**
|
|
25
23
|
*
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AsyncModules from '../base/asyncModules';
|
|
2
2
|
import { IProductStatusEntity, IProductStatuses } from "./productStatusesInterfaces";
|
|
3
|
-
import
|
|
3
|
+
import StateModule from "../base/stateModule";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with product statuses
|
|
6
6
|
*/
|
|
7
|
-
export default class ProductStatusesApi extends
|
|
8
|
-
|
|
7
|
+
export default class ProductStatusesApi extends AsyncModules implements IProductStatuses {
|
|
8
|
+
protected state: StateModule;
|
|
9
|
+
protected _url: string;
|
|
10
|
+
constructor(state: StateModule);
|
|
9
11
|
/**
|
|
10
12
|
* Search for all product status objects.
|
|
11
13
|
* @param {string} [langCode] - Optional parameter language code
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const asyncModules_1 = require("../base/asyncModules");
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with product statuses
|
|
6
6
|
*/
|
|
7
|
-
class ProductStatusesApi extends
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
10
|
-
this._url
|
|
7
|
+
class ProductStatusesApi extends asyncModules_1.default {
|
|
8
|
+
constructor(state) {
|
|
9
|
+
super(state);
|
|
10
|
+
this._url = state.url + '/api/content/product-statuses';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Search for all product status objects.
|
|
@@ -15,7 +15,7 @@ class ProductStatusesApi extends oneEntry_1.default {
|
|
|
15
15
|
*
|
|
16
16
|
* @returns Returns an array of product status objects
|
|
17
17
|
*/
|
|
18
|
-
async getProductStatuses(langCode = this.
|
|
18
|
+
async getProductStatuses(langCode = this.state.lang) {
|
|
19
19
|
const result = await this._fetchGet('');
|
|
20
20
|
return this._normalizeData(result, langCode);
|
|
21
21
|
}
|
|
@@ -27,7 +27,7 @@ class ProductStatusesApi extends oneEntry_1.default {
|
|
|
27
27
|
*
|
|
28
28
|
* @returns Returns a product status object
|
|
29
29
|
*/
|
|
30
|
-
async getProductStatusesById(id, langCode = this.
|
|
30
|
+
async getProductStatusesById(id, langCode = this.state.lang) {
|
|
31
31
|
const result = await this._fetchGet(`/${id}`);
|
|
32
32
|
return this._normalizeData(result, langCode);
|
|
33
33
|
}
|
|
@@ -39,7 +39,7 @@ class ProductStatusesApi extends oneEntry_1.default {
|
|
|
39
39
|
*
|
|
40
40
|
* @returns Returns a product status object
|
|
41
41
|
*/
|
|
42
|
-
async getProductsByStatusMarker(marker, langCode = this.
|
|
42
|
+
async getProductsByStatusMarker(marker, langCode = this.state.lang) {
|
|
43
43
|
const result = await this._fetchGet(`/marker/${marker}`);
|
|
44
44
|
return this._normalizeData(result, langCode);
|
|
45
45
|
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { IProductsQuery, IFilterParams, IProductApi, IProductsEntity } from './productsInterfaces';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { IProductsQuery, IFilterParams, IProductApi, IProductsEntity, IProductInfo } from './productsInterfaces';
|
|
2
|
+
import AsyncModules from '../base/asyncModules';
|
|
3
|
+
import StateModule from "../base/stateModule";
|
|
4
|
+
import { IBlocksResponse } from "../blocks/blocksInterfaces";
|
|
4
5
|
/**
|
|
5
6
|
* Controllers for working with product pages
|
|
6
7
|
*/
|
|
7
|
-
export default class ProductApi extends
|
|
8
|
-
|
|
8
|
+
export default class ProductApi extends AsyncModules implements IProductApi {
|
|
9
|
+
protected state: StateModule;
|
|
10
|
+
protected _url: string;
|
|
11
|
+
constructor(state: StateModule);
|
|
9
12
|
private _defaultQuery;
|
|
10
13
|
/**
|
|
11
|
-
* Search for all
|
|
12
|
-
*
|
|
14
|
+
* Search for all products with pagination and filter.
|
|
15
|
+
* @param {Array<IFilterParams>} body - Request body.
|
|
13
16
|
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
14
17
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
15
18
|
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
@@ -28,9 +31,30 @@ export default class ProductApi extends OneEntry implements IProductApi {
|
|
|
28
31
|
*
|
|
29
32
|
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
30
33
|
*
|
|
31
|
-
* @
|
|
34
|
+
* @example
|
|
35
|
+
* const body = [
|
|
36
|
+
* {
|
|
37
|
+
* "attributeMarker": "price",
|
|
38
|
+
* "conditionMarker": "mth",
|
|
39
|
+
* "statusMarker": "waiting",
|
|
40
|
+
* "conditionValue": 1,
|
|
41
|
+
* "pageUrls": [
|
|
42
|
+
* "23-laminat-floorwood-maxima"
|
|
43
|
+
* ]
|
|
44
|
+
* },
|
|
45
|
+
* {
|
|
46
|
+
* "attributeMarker": "price",
|
|
47
|
+
* "conditionMarker": "lth",
|
|
48
|
+
* "conditionValue": 3,
|
|
49
|
+
* "pageUrls": [
|
|
50
|
+
* "23-laminat-floorwood-maxima"
|
|
51
|
+
* ]
|
|
52
|
+
* }
|
|
53
|
+
* ]
|
|
54
|
+
*
|
|
55
|
+
* @returns Array with ProductEntity objects
|
|
32
56
|
*/
|
|
33
|
-
getProducts(langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
57
|
+
getProducts(body: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
34
58
|
/**
|
|
35
59
|
* Search for all product page objects with pagination that do not have a category.
|
|
36
60
|
*
|
|
@@ -56,12 +80,10 @@ export default class ProductApi extends OneEntry implements IProductApi {
|
|
|
56
80
|
*/
|
|
57
81
|
getProductsEmptyPage(langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
58
82
|
/**
|
|
59
|
-
* Search for all
|
|
60
|
-
*
|
|
61
|
-
* @param {number}
|
|
62
|
-
*
|
|
83
|
+
* Search for all products with pagination for the selected category.
|
|
84
|
+
* @param {Array<IFilterParams>} body - Request body.
|
|
85
|
+
* @param {number} id - Page id.
|
|
63
86
|
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
64
|
-
*
|
|
65
87
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
66
88
|
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
67
89
|
*
|
|
@@ -79,16 +101,58 @@ export default class ProductApi extends OneEntry implements IProductApi {
|
|
|
79
101
|
*
|
|
80
102
|
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
81
103
|
*
|
|
104
|
+
* @example
|
|
105
|
+
* const body = [
|
|
106
|
+
* {
|
|
107
|
+
* "attributeMarker": "price",
|
|
108
|
+
* "conditionMarker": "mth",
|
|
109
|
+
* "statusMarker": "waiting",
|
|
110
|
+
* "conditionValue": 1,
|
|
111
|
+
* "pageUrls": [
|
|
112
|
+
* "23-laminat-floorwood-maxima"
|
|
113
|
+
* ]
|
|
114
|
+
* },
|
|
115
|
+
* {
|
|
116
|
+
* "attributeMarker": "price",
|
|
117
|
+
* "conditionMarker": "lth",
|
|
118
|
+
* "conditionValue": 3,
|
|
119
|
+
* "pageUrls": [
|
|
120
|
+
* "23-laminat-floorwood-maxima"
|
|
121
|
+
* ]
|
|
122
|
+
* }
|
|
123
|
+
* ]
|
|
124
|
+
*
|
|
82
125
|
* @returns Array with ProductEntity objects
|
|
83
126
|
*/
|
|
84
|
-
|
|
127
|
+
getProductsByPageId(id: number, body: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
85
128
|
/**
|
|
86
|
-
* Search for
|
|
129
|
+
* Search for information about products and prices for the selected category.
|
|
130
|
+
* @param {string} url - Page url.
|
|
131
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
132
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
87
133
|
*
|
|
88
|
-
* @param {
|
|
134
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
89
135
|
*
|
|
90
|
-
* @param {string} [
|
|
136
|
+
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
137
|
+
*
|
|
138
|
+
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
139
|
+
*
|
|
140
|
+
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
141
|
+
*
|
|
142
|
+
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
91
143
|
*
|
|
144
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
145
|
+
*
|
|
146
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
147
|
+
*
|
|
148
|
+
* @returns Array with ProductInformation objects
|
|
149
|
+
*/
|
|
150
|
+
getProductsPriceByPageUrl(url: string, userQuery?: IProductsQuery): Promise<Array<IProductInfo>>;
|
|
151
|
+
/**
|
|
152
|
+
* Search for all products with pagination for the selected category.
|
|
153
|
+
* @param {Array<IFilterParams>} body - Request body.
|
|
154
|
+
* @param {string} url - Page url.
|
|
155
|
+
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
92
156
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
93
157
|
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
94
158
|
*
|
|
@@ -106,9 +170,30 @@ export default class ProductApi extends OneEntry implements IProductApi {
|
|
|
106
170
|
*
|
|
107
171
|
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
108
172
|
*
|
|
173
|
+
* @example
|
|
174
|
+
* const body = [
|
|
175
|
+
* {
|
|
176
|
+
* "attributeMarker": "price",
|
|
177
|
+
* "conditionMarker": "mth",
|
|
178
|
+
* "statusMarker": "waiting",
|
|
179
|
+
* "conditionValue": 1,
|
|
180
|
+
* "pageUrls": [
|
|
181
|
+
* "23-laminat-floorwood-maxima"
|
|
182
|
+
* ]
|
|
183
|
+
* },
|
|
184
|
+
* {
|
|
185
|
+
* "attributeMarker": "price",
|
|
186
|
+
* "conditionMarker": "lth",
|
|
187
|
+
* "conditionValue": 3,
|
|
188
|
+
* "pageUrls": [
|
|
189
|
+
* "23-laminat-floorwood-maxima"
|
|
190
|
+
* ]
|
|
191
|
+
* }
|
|
192
|
+
* ]
|
|
193
|
+
*
|
|
109
194
|
* @returns Array with ProductEntity objects
|
|
110
195
|
*/
|
|
111
|
-
|
|
196
|
+
getProductsByPageUrl(url: string, body: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
112
197
|
/**
|
|
113
198
|
* Find all related product page objects.
|
|
114
199
|
*
|
|
@@ -139,41 +224,11 @@ export default class ProductApi extends OneEntry implements IProductApi {
|
|
|
139
224
|
*/
|
|
140
225
|
getProductById(id: number, langCode?: string): Promise<IProductsEntity>;
|
|
141
226
|
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* @param {array} [data] - Request body.
|
|
145
|
-
*
|
|
146
|
-
* @param {string} [langCode] Language code parameter. Default "en_US".
|
|
147
|
-
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
148
|
-
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
227
|
+
* Getting a product block object by product id.
|
|
228
|
+
* @param {number} id - Product id
|
|
149
229
|
*
|
|
150
|
-
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
151
|
-
*
|
|
152
|
-
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
153
|
-
*
|
|
154
|
-
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* @example
|
|
158
|
-
* const body = [
|
|
159
|
-
*{
|
|
160
|
-
* attributeMarker: "price",
|
|
161
|
-
* conditionMarker: "mth",
|
|
162
|
-
* conditionValue: 1,
|
|
163
|
-
* pageId: 0
|
|
164
|
-
*},
|
|
165
|
-
*{
|
|
166
|
-
* attributeMarker: "price",
|
|
167
|
-
* conditionMarker: "lth",
|
|
168
|
-
* conditionValue: 3,
|
|
169
|
-
* pageId: 0
|
|
170
|
-
*},
|
|
171
|
-
*];
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* @returns Array with ProductEntity objects
|
|
175
230
|
*/
|
|
176
|
-
|
|
231
|
+
getProductBlockById(id: number): Promise<Array<IBlocksResponse>>;
|
|
177
232
|
/**
|
|
178
233
|
* Quick search for product page objects with limited output.
|
|
179
234
|
*
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const asyncModules_1 = require("../base/asyncModules");
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with product pages
|
|
6
6
|
*/
|
|
7
|
-
class ProductApi extends
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
7
|
+
class ProductApi extends asyncModules_1.default {
|
|
8
|
+
constructor(state) {
|
|
9
|
+
super(state);
|
|
10
10
|
this._defaultQuery = {
|
|
11
11
|
offset: 0,
|
|
12
12
|
limit: 30,
|
|
13
|
+
templateMarker: null,
|
|
13
14
|
statusMarker: null,
|
|
14
15
|
conditionValue: null,
|
|
15
16
|
conditionMarker: null,
|
|
@@ -17,11 +18,11 @@ class ProductApi extends oneEntry_1.default {
|
|
|
17
18
|
sortOrder: null,
|
|
18
19
|
sortKey: null
|
|
19
20
|
};
|
|
20
|
-
this._url
|
|
21
|
+
this._url = state.url + '/api/content/products';
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
|
-
* Search for all
|
|
24
|
-
*
|
|
24
|
+
* Search for all products with pagination and filter.
|
|
25
|
+
* @param {Array<IFilterParams>} body - Request body.
|
|
25
26
|
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
26
27
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
27
28
|
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
@@ -40,11 +41,32 @@ class ProductApi extends oneEntry_1.default {
|
|
|
40
41
|
*
|
|
41
42
|
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
42
43
|
*
|
|
43
|
-
* @
|
|
44
|
+
* @example
|
|
45
|
+
* const body = [
|
|
46
|
+
* {
|
|
47
|
+
* "attributeMarker": "price",
|
|
48
|
+
* "conditionMarker": "mth",
|
|
49
|
+
* "statusMarker": "waiting",
|
|
50
|
+
* "conditionValue": 1,
|
|
51
|
+
* "pageUrls": [
|
|
52
|
+
* "23-laminat-floorwood-maxima"
|
|
53
|
+
* ]
|
|
54
|
+
* },
|
|
55
|
+
* {
|
|
56
|
+
* "attributeMarker": "price",
|
|
57
|
+
* "conditionMarker": "lth",
|
|
58
|
+
* "conditionValue": 3,
|
|
59
|
+
* "pageUrls": [
|
|
60
|
+
* "23-laminat-floorwood-maxima"
|
|
61
|
+
* ]
|
|
62
|
+
* }
|
|
63
|
+
* ]
|
|
64
|
+
*
|
|
65
|
+
* @returns Array with ProductEntity objects
|
|
44
66
|
*/
|
|
45
|
-
async getProducts(langCode = this.
|
|
67
|
+
async getProducts(body, langCode = this.state.lang, userQuery) {
|
|
46
68
|
const query = { ...this._defaultQuery, ...userQuery };
|
|
47
|
-
const result = await this.
|
|
69
|
+
const result = await this._fetchPost(`/all?` + this._queryParamsToString(query), body);
|
|
48
70
|
return this._dataPostProcess(result.items, langCode);
|
|
49
71
|
}
|
|
50
72
|
/**
|
|
@@ -70,18 +92,16 @@ class ProductApi extends oneEntry_1.default {
|
|
|
70
92
|
*
|
|
71
93
|
* @returns Array with ProductEntity objects
|
|
72
94
|
*/
|
|
73
|
-
async getProductsEmptyPage(langCode = this.
|
|
95
|
+
async getProductsEmptyPage(langCode = this.state.lang, userQuery) {
|
|
74
96
|
const query = { ...this._defaultQuery, ...userQuery };
|
|
75
97
|
const result = await this._fetchGet(`/empty-page?langCode=${langCode}&` + this._queryParamsToString(query));
|
|
76
98
|
return this._dataPostProcess(result.items, langCode);
|
|
77
99
|
}
|
|
78
100
|
/**
|
|
79
|
-
* Search for all
|
|
80
|
-
*
|
|
81
|
-
* @param {number}
|
|
82
|
-
*
|
|
101
|
+
* Search for all products with pagination for the selected category.
|
|
102
|
+
* @param {Array<IFilterParams>} body - Request body.
|
|
103
|
+
* @param {number} id - Page id.
|
|
83
104
|
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
84
|
-
*
|
|
85
105
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
86
106
|
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
87
107
|
*
|
|
@@ -99,20 +119,66 @@ class ProductApi extends oneEntry_1.default {
|
|
|
99
119
|
*
|
|
100
120
|
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
101
121
|
*
|
|
122
|
+
* @example
|
|
123
|
+
* const body = [
|
|
124
|
+
* {
|
|
125
|
+
* "attributeMarker": "price",
|
|
126
|
+
* "conditionMarker": "mth",
|
|
127
|
+
* "statusMarker": "waiting",
|
|
128
|
+
* "conditionValue": 1,
|
|
129
|
+
* "pageUrls": [
|
|
130
|
+
* "23-laminat-floorwood-maxima"
|
|
131
|
+
* ]
|
|
132
|
+
* },
|
|
133
|
+
* {
|
|
134
|
+
* "attributeMarker": "price",
|
|
135
|
+
* "conditionMarker": "lth",
|
|
136
|
+
* "conditionValue": 3,
|
|
137
|
+
* "pageUrls": [
|
|
138
|
+
* "23-laminat-floorwood-maxima"
|
|
139
|
+
* ]
|
|
140
|
+
* }
|
|
141
|
+
* ]
|
|
142
|
+
*
|
|
102
143
|
* @returns Array with ProductEntity objects
|
|
103
144
|
*/
|
|
104
|
-
async
|
|
145
|
+
async getProductsByPageId(id, body, langCode = this.state.lang, userQuery) {
|
|
105
146
|
const query = { ...this._defaultQuery, ...userQuery };
|
|
106
|
-
const result = await this.
|
|
147
|
+
const result = await this._fetchPost(`/page/${id}?` + this._queryParamsToString(query), body);
|
|
107
148
|
return this._dataPostProcess(result.items, langCode);
|
|
108
149
|
}
|
|
109
150
|
/**
|
|
110
|
-
* Search for
|
|
151
|
+
* Search for information about products and prices for the selected category.
|
|
152
|
+
* @param {string} url - Page url.
|
|
153
|
+
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
154
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
111
155
|
*
|
|
112
|
-
* @param {
|
|
156
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
113
157
|
*
|
|
114
|
-
* @param {string} [
|
|
158
|
+
* @param {string} [userQuery.statusMarker] - Optional identifier of the product page status
|
|
159
|
+
*
|
|
160
|
+
* @param {string} [userQuery.conditionValue] - Optional value that is being searched
|
|
161
|
+
*
|
|
162
|
+
* @param {string} [userQuery.conditionMarker] - Optional identifier of the filter condition by which values are filtered
|
|
163
|
+
*
|
|
164
|
+
* @param {string} [userQuery.attributeMarker] - Optional text identifier of the indexed attribute by which values are filtered
|
|
165
|
+
*
|
|
166
|
+
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
167
|
+
*
|
|
168
|
+
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
115
169
|
*
|
|
170
|
+
* @returns Array with ProductInformation objects
|
|
171
|
+
*/
|
|
172
|
+
async getProductsPriceByPageUrl(url, userQuery) {
|
|
173
|
+
const query = { ...this._defaultQuery, ...userQuery };
|
|
174
|
+
const result = await this._fetchGet(`/page/${url}/prices?` + this._queryParamsToString(query));
|
|
175
|
+
return result.items;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Search for all products with pagination for the selected category.
|
|
179
|
+
* @param {Array<IFilterParams>} body - Request body.
|
|
180
|
+
* @param {string} url - Page url.
|
|
181
|
+
* @param {string} [langCode] - Language code parameter. Default "en_US"
|
|
116
182
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
117
183
|
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
118
184
|
*
|
|
@@ -130,11 +196,32 @@ class ProductApi extends oneEntry_1.default {
|
|
|
130
196
|
*
|
|
131
197
|
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
132
198
|
*
|
|
199
|
+
* @example
|
|
200
|
+
* const body = [
|
|
201
|
+
* {
|
|
202
|
+
* "attributeMarker": "price",
|
|
203
|
+
* "conditionMarker": "mth",
|
|
204
|
+
* "statusMarker": "waiting",
|
|
205
|
+
* "conditionValue": 1,
|
|
206
|
+
* "pageUrls": [
|
|
207
|
+
* "23-laminat-floorwood-maxima"
|
|
208
|
+
* ]
|
|
209
|
+
* },
|
|
210
|
+
* {
|
|
211
|
+
* "attributeMarker": "price",
|
|
212
|
+
* "conditionMarker": "lth",
|
|
213
|
+
* "conditionValue": 3,
|
|
214
|
+
* "pageUrls": [
|
|
215
|
+
* "23-laminat-floorwood-maxima"
|
|
216
|
+
* ]
|
|
217
|
+
* }
|
|
218
|
+
* ]
|
|
219
|
+
*
|
|
133
220
|
* @returns Array with ProductEntity objects
|
|
134
221
|
*/
|
|
135
|
-
async
|
|
222
|
+
async getProductsByPageUrl(url, body, langCode = this.state.lang, userQuery) {
|
|
136
223
|
const query = { ...this._defaultQuery, ...userQuery };
|
|
137
|
-
const result = await this.
|
|
224
|
+
const result = await this._fetchPost(`/page/url/${url}?` + this._queryParamsToString(query), body);
|
|
138
225
|
return this._dataPostProcess(result.items, langCode);
|
|
139
226
|
}
|
|
140
227
|
/**
|
|
@@ -155,7 +242,7 @@ class ProductApi extends oneEntry_1.default {
|
|
|
155
242
|
*
|
|
156
243
|
* @returns Array with ProductEntity objects
|
|
157
244
|
*/
|
|
158
|
-
async getRelatedProductsById(id, langCode = this.
|
|
245
|
+
async getRelatedProductsById(id, langCode = this.state.lang, userQuery) {
|
|
159
246
|
const query = { ...this._defaultQuery, ...userQuery };
|
|
160
247
|
const result = await this._fetchGet(`/${id}/related?langCode=${langCode}&` + this._queryParamsToString(query));
|
|
161
248
|
return this._dataPostProcess(result.items, langCode);
|
|
@@ -169,51 +256,18 @@ class ProductApi extends oneEntry_1.default {
|
|
|
169
256
|
*
|
|
170
257
|
* @returns ProductEntity object.
|
|
171
258
|
*/
|
|
172
|
-
async getProductById(id, langCode = this.
|
|
259
|
+
async getProductById(id, langCode = this.state.lang) {
|
|
173
260
|
const result = await this._fetchGet(`/${id}?langCode=${langCode}`);
|
|
174
261
|
return this._dataPostProcess(result, langCode);
|
|
175
262
|
}
|
|
176
263
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
* @param {array} [data] - Request body.
|
|
180
|
-
*
|
|
181
|
-
* @param {string} [langCode] Language code parameter. Default "en_US".
|
|
182
|
-
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
183
|
-
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
264
|
+
* Getting a product block object by product id.
|
|
265
|
+
* @param {number} id - Product id
|
|
184
266
|
*
|
|
185
|
-
* @param {number} [userQuery.offset] - Optional parameter for pagination, default is 30
|
|
186
|
-
*
|
|
187
|
-
* @param {string} [userQuery.sortOrder] - Optional sorting order DESC | ASC
|
|
188
|
-
*
|
|
189
|
-
* @param {string} [userQuery.sortKey] - Optional field to sort by
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* @example
|
|
193
|
-
* const body = [
|
|
194
|
-
*{
|
|
195
|
-
* attributeMarker: "price",
|
|
196
|
-
* conditionMarker: "mth",
|
|
197
|
-
* conditionValue: 1,
|
|
198
|
-
* pageId: 0
|
|
199
|
-
*},
|
|
200
|
-
*{
|
|
201
|
-
* attributeMarker: "price",
|
|
202
|
-
* conditionMarker: "lth",
|
|
203
|
-
* conditionValue: 3,
|
|
204
|
-
* pageId: 0
|
|
205
|
-
*},
|
|
206
|
-
*];
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* @returns Array with ProductEntity objects
|
|
210
267
|
*/
|
|
211
|
-
async
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
const products = response.items;
|
|
215
|
-
const result = products.map(item => this._normalizeData(item));
|
|
216
|
-
return result;
|
|
268
|
+
async getProductBlockById(id) {
|
|
269
|
+
const response = await this._fetchGet(`/${id}/blocks`);
|
|
270
|
+
return this._normalizeData(response);
|
|
217
271
|
}
|
|
218
272
|
/**
|
|
219
273
|
* Quick search for product page objects with limited output.
|
|
@@ -224,9 +278,9 @@ class ProductApi extends oneEntry_1.default {
|
|
|
224
278
|
*
|
|
225
279
|
* @returns Array with ProductEntity objects
|
|
226
280
|
*/
|
|
227
|
-
async searchProduct(name, langCode = this.
|
|
281
|
+
async searchProduct(name, langCode = this.state.lang) {
|
|
228
282
|
const searchProducts = await this._fetchGet(`/quick/search?lang=${langCode}&name=${name}`);
|
|
229
|
-
if (this.
|
|
283
|
+
if (this.state.multipleResponse) {
|
|
230
284
|
const productsList = [];
|
|
231
285
|
await Promise.all(searchProducts.map(async (product) => {
|
|
232
286
|
await this.getProductById(product.id, langCode).then((result) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LangType } from "../base/utils";
|
|
2
|
+
import { IBlocksResponse } from "../blocks/blocksInterfaces";
|
|
2
3
|
/**
|
|
3
4
|
* Represents an interface object of Products Api.
|
|
4
5
|
*
|
|
@@ -6,26 +7,29 @@ import { LangType } from "../base/utils";
|
|
|
6
7
|
*
|
|
7
8
|
* @property {function} getProductsEmptyPage - Search for all product page objects with pagination that do not have a category.
|
|
8
9
|
*
|
|
9
|
-
* @property {function}
|
|
10
|
+
* @property {function} getProductsByPageId - Search for all products with pagination for the selected category.
|
|
10
11
|
*
|
|
11
|
-
* @property {function}
|
|
12
|
+
* @property {function} getProductsPriceByPageUrl - Search for information about products and prices for the selected category.
|
|
13
|
+
*
|
|
14
|
+
* @property {function} getProductsByPageUrl - Search for all products with pagination for the selected category.
|
|
12
15
|
*
|
|
13
16
|
* @property {function} getRelatedProductsById - Find all related product page objects.
|
|
14
17
|
*
|
|
15
18
|
* @property {function} getProductById - Retrieve one product object.
|
|
16
19
|
*
|
|
17
|
-
* @property {function}
|
|
20
|
+
* @property {function} getProductBlockById - Getting a product block object by product id.
|
|
18
21
|
*
|
|
19
22
|
* @property {function} searchProduct - Quick search for product page objects with limited output.
|
|
20
23
|
*/
|
|
21
24
|
interface IProductApi {
|
|
22
|
-
getProducts(langCode?:
|
|
25
|
+
getProducts(body: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
23
26
|
getProductsEmptyPage(langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
getProductsByPageId(id: number, body: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
28
|
+
getProductsPriceByPageUrl(url: string, userQuery?: IProductsQuery): Promise<Array<IProductInfo>>;
|
|
29
|
+
getProductsByPageUrl(url: string, body: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
26
30
|
getRelatedProductsById(id: number, langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
27
31
|
getProductById(id: number, langCode: LangType): Promise<IProductsEntity>;
|
|
28
|
-
|
|
32
|
+
getProductBlockById(id: number): Promise<Array<IBlocksResponse>>;
|
|
29
33
|
searchProduct(name: string, langCode: string): Promise<Array<IProductsEntity>>;
|
|
30
34
|
}
|
|
31
35
|
/**
|
|
@@ -130,4 +134,8 @@ interface IProductsEntity {
|
|
|
130
134
|
sku: string | null;
|
|
131
135
|
productPages?: Array<Record<string, any>> | Record<string, any>;
|
|
132
136
|
}
|
|
133
|
-
|
|
137
|
+
interface IProductInfo {
|
|
138
|
+
id: number;
|
|
139
|
+
price: number;
|
|
140
|
+
}
|
|
141
|
+
export { IFilterParams, IProductsQuery, IProductApi, IProductsEntity, IProductInfo };
|