oneentry 1.0.69 → 1.0.71
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 +5720 -0
- package/dist/attribute-sets/attributeSetsApi.d.ts +2 -2
- package/dist/attribute-sets/attributeSetsApi.js +2 -2
- package/dist/auth-provider/authProvidersInterfaces.d.ts +1 -0
- package/dist/base/asyncModules.js +6 -2
- package/dist/base/stateModule.js +1 -1
- package/dist/formsData/formsDataApi.d.ts +1 -0
- package/dist/formsData/formsDataApi.js +2 -1
- package/dist/orders/ordersApi.d.ts +1 -1
- package/dist/orders/ordersApi.js +3 -0
- package/dist/orders/ordersInterfaces.d.ts +7 -5
- package/dist/pages/pagesApi.js +11 -2
- package/dist/pages/pagesInterfaces.d.ts +2 -18
- package/dist/payments/paymentsApi.d.ts +5 -17
- package/dist/payments/paymentsApi.js +9 -18
- package/dist/payments/paymentsInterfaces.d.ts +1 -5
- package/dist/product-statuses/productStatusesApi.d.ts +3 -3
- package/dist/product-statuses/productStatusesApi.js +3 -3
- package/dist/products/productsApi.d.ts +4 -4
- package/dist/products/productsApi.js +4 -3
- package/dist/products/productsInterfaces.d.ts +36 -8
- package/dist/templates/templatesApi.d.ts +7 -7
- package/dist/templates/templatesApi.js +2 -2
- package/dist/templates/templatesInterfaces.d.ts +4 -15
- package/dist/templates-preview/templatesPreviewApi.d.ts +3 -3
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +28 -5
- package/dist/users/usersApi.d.ts +1 -1
- package/dist/users/usersApi.js +3 -1
- package/dist/users/usersInterfaces.d.ts +6 -3
- package/package.json +2 -2
|
@@ -12,7 +12,7 @@ export default class AttributesSetsApi extends AsyncModules implements IAttribut
|
|
|
12
12
|
* Get all attributes with data from the attribute sets.
|
|
13
13
|
*
|
|
14
14
|
* @param {string} marker - Attribute marker.
|
|
15
|
-
* @param {string} langCode - Language code.
|
|
15
|
+
* @param {string} [langCode] - Language code.
|
|
16
16
|
*
|
|
17
17
|
* @returns Returns an array of AttributeInSet objects.
|
|
18
18
|
*/
|
|
@@ -22,7 +22,7 @@ export default class AttributesSetsApi extends AsyncModules implements IAttribut
|
|
|
22
22
|
*
|
|
23
23
|
* @param {string} attributeMarker - Text identifier (marker) of the attribute in the set.
|
|
24
24
|
* @param {string} setMarker - Text identifier (marker) of the attribute set.
|
|
25
|
-
* @param {string} langCode - Language code.
|
|
25
|
+
* @param {string} [langCode] - Language code.
|
|
26
26
|
*
|
|
27
27
|
* @returns Returns a AttributeInSet object.
|
|
28
28
|
*/
|
|
@@ -13,7 +13,7 @@ class AttributesSetsApi extends asyncModules_1.default {
|
|
|
13
13
|
* Get all attributes with data from the attribute sets.
|
|
14
14
|
*
|
|
15
15
|
* @param {string} marker - Attribute marker.
|
|
16
|
-
* @param {string} langCode - Language code.
|
|
16
|
+
* @param {string} [langCode] - Language code.
|
|
17
17
|
*
|
|
18
18
|
* @returns Returns an array of AttributeInSet objects.
|
|
19
19
|
*/
|
|
@@ -26,7 +26,7 @@ class AttributesSetsApi extends asyncModules_1.default {
|
|
|
26
26
|
*
|
|
27
27
|
* @param {string} attributeMarker - Text identifier (marker) of the attribute in the set.
|
|
28
28
|
* @param {string} setMarker - Text identifier (marker) of the attribute set.
|
|
29
|
-
* @param {string} langCode - Language code.
|
|
29
|
+
* @param {string} [langCode] - Language code.
|
|
30
30
|
*
|
|
31
31
|
* @returns Returns a AttributeInSet object.
|
|
32
32
|
*/
|
|
@@ -8,10 +8,14 @@ class AsyncModules extends syncModules_1.default {
|
|
|
8
8
|
this.state = state;
|
|
9
9
|
this._NO_FETCH = !!(typeof process === 'object' && process.versions);
|
|
10
10
|
try {
|
|
11
|
-
|
|
11
|
+
try {
|
|
12
|
+
this._https = this._NO_FETCH ? require('https') : null;
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
this._https = null;
|
|
16
|
+
}
|
|
12
17
|
}
|
|
13
18
|
catch (e) {
|
|
14
|
-
this._https = null;
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
21
|
async _fetchGet(path) {
|
package/dist/base/stateModule.js
CHANGED
|
@@ -6,7 +6,7 @@ class StateModule {
|
|
|
6
6
|
this.url = url;
|
|
7
7
|
this.lang = (_a = config.langCode) !== null && _a !== void 0 ? _a : 'en_US';
|
|
8
8
|
this.token = config.token;
|
|
9
|
-
this.multipleResponse = !!((_b = config.traficLimit) !== null && _b !== void 0 ? _b :
|
|
9
|
+
this.multipleResponse = !!((_b = config.traficLimit) !== null && _b !== void 0 ? _b : true);
|
|
10
10
|
this.refreshToken = (_d = (_c = config.auth) === null || _c === void 0 ? void 0 : _c.refreshToken) !== null && _d !== void 0 ? _d : undefined;
|
|
11
11
|
this.customAuth = (_f = (_e = config.auth) === null || _e === void 0 ? void 0 : _e.customAuth) !== null && _f !== void 0 ? _f : false;
|
|
12
12
|
this.saveFunction = (_h = (_g = config.auth) === null || _g === void 0 ? void 0 : _g.saveFunction) !== null && _h !== void 0 ? _h : null;
|
|
@@ -34,6 +34,7 @@ class FormsDataApi extends asyncModules_1.default {
|
|
|
34
34
|
* formData: {
|
|
35
35
|
* marker: 'test',
|
|
36
36
|
* value: 'Test',
|
|
37
|
+
* type: 'string'
|
|
37
38
|
* },
|
|
38
39
|
* }
|
|
39
40
|
*
|
|
@@ -43,7 +44,7 @@ class FormsDataApi extends asyncModules_1.default {
|
|
|
43
44
|
const formData = {};
|
|
44
45
|
formData[langCode] = Array.isArray(data.formData) ? data.formData : [data.formData];
|
|
45
46
|
data.formData = formData;
|
|
46
|
-
const result = await this._fetchPost(
|
|
47
|
+
const result = await this._fetchPost(``, data);
|
|
47
48
|
return this._dataPostProcess(result);
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
@@ -68,7 +68,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
68
68
|
* "currency": "USD"
|
|
69
69
|
* }
|
|
70
70
|
*/
|
|
71
|
-
updateOrderByMarkerAndId(marker: string, id:
|
|
71
|
+
updateOrderByMarkerAndId(marker: string, id: number, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
|
|
72
72
|
/**
|
|
73
73
|
* Getting all the order storage objects
|
|
74
74
|
* @param {number} [langCode] Optional language field
|
package/dist/orders/ordersApi.js
CHANGED
|
@@ -79,6 +79,9 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
79
79
|
* }
|
|
80
80
|
*/
|
|
81
81
|
async updateOrderByMarkerAndId(marker, id, data, langCode = this.state.lang) {
|
|
82
|
+
const formData = {};
|
|
83
|
+
formData[langCode] = Array.isArray(data.formData) ? data.formData : [data.formData];
|
|
84
|
+
data.formData = formData;
|
|
82
85
|
const result = await this._fetchPut(`/marker/${marker}/orders/${id}?langCode=${langCode}`, data);
|
|
83
86
|
return this._normalizeData(result);
|
|
84
87
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
interface IOrdersApi {
|
|
12
12
|
getOrderByMarker(marker: string, langCode?: string): Promise<IOrdersEntity>;
|
|
13
13
|
createOrder(marker: string, data: IOrderData): Promise<IBaseOrdersEntity>;
|
|
14
|
-
updateOrderByMarkerAndId(marker: string, id:
|
|
14
|
+
updateOrderByMarkerAndId(marker: string, id: number, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
|
|
15
15
|
getAllOrders(langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersEntity>>;
|
|
16
16
|
getAllOrdersByMarker(marker: string, langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersByMarkersEntity>>;
|
|
17
17
|
}
|
|
@@ -66,14 +66,13 @@ interface IOrderProductData {
|
|
|
66
66
|
* @property {string} createdDate - Date when the order was created.
|
|
67
67
|
*/
|
|
68
68
|
interface IBaseOrdersEntity {
|
|
69
|
-
statusIdentifier: string;
|
|
70
69
|
formIdentifier: string;
|
|
71
70
|
paymentAccountIdentifier: string;
|
|
72
71
|
formData: Array<IOrdersFormData>;
|
|
73
72
|
products: Array<IOrderProductData>;
|
|
74
73
|
totalSum: string;
|
|
75
74
|
currency: string;
|
|
76
|
-
|
|
75
|
+
id: number;
|
|
77
76
|
}
|
|
78
77
|
/**
|
|
79
78
|
* @interface
|
|
@@ -83,6 +82,7 @@ interface IBaseOrdersEntity {
|
|
|
83
82
|
* @property {number} generalTypeId - Type identifier.
|
|
84
83
|
* @property {string} formIdentifier - Textual identifier for the form used by the order storage.
|
|
85
84
|
* @property {Array<{identifier:string}>} paymentAccountIdentifiers - Array of textual identifiers of payment accounts used by the order storage.
|
|
85
|
+
* @property {number | null} position
|
|
86
86
|
*/
|
|
87
87
|
interface IOrdersEntity {
|
|
88
88
|
id: number;
|
|
@@ -93,6 +93,7 @@ interface IOrdersEntity {
|
|
|
93
93
|
paymentAccountIdentifiers: Array<{
|
|
94
94
|
identifier: string;
|
|
95
95
|
}>;
|
|
96
|
+
position: number | null;
|
|
96
97
|
}
|
|
97
98
|
/**
|
|
98
99
|
* @interface
|
|
@@ -114,7 +115,6 @@ interface IOrderData {
|
|
|
114
115
|
* @property {Array<IOrdersFormData>} formData - Data submitted by the form linked to the order store.
|
|
115
116
|
* @property {Array<IOrderProducts>} products - Array of products added to order.
|
|
116
117
|
* @property {string} totalSum - Total order amount.
|
|
117
|
-
* @property {number} price - Price order.
|
|
118
118
|
* @property {string} currency - Currency used to pay for the order.
|
|
119
119
|
* @property {string} createdDate - Date when the order was created.
|
|
120
120
|
* @property {string} paymentAccountIdentifier - Textual identifier for the order payment.
|
|
@@ -122,6 +122,7 @@ interface IOrderData {
|
|
|
122
122
|
* @property {boolean} isHistory - Indicates that the order has been saved in the order history.
|
|
123
123
|
*/
|
|
124
124
|
interface IOrdersByMarkersEntity {
|
|
125
|
+
attributeSetIdentifier: string;
|
|
125
126
|
statusIdentifier: string;
|
|
126
127
|
formIdentifier: string;
|
|
127
128
|
formData: Array<IOrdersFormData>;
|
|
@@ -129,9 +130,10 @@ interface IOrdersByMarkersEntity {
|
|
|
129
130
|
totalSum: string;
|
|
130
131
|
currency: string;
|
|
131
132
|
createdDate: string;
|
|
132
|
-
|
|
133
|
+
position: number;
|
|
133
134
|
paymentAccountIdentifier: string;
|
|
134
135
|
paymentAccountLocalizeInfos: Record<string, any>;
|
|
135
136
|
isHistory: boolean;
|
|
137
|
+
id: number;
|
|
136
138
|
}
|
|
137
139
|
export { IOrdersEntity, IBaseOrdersEntity, IOrderProducts, IPicture, IOrdersApi, IOrderData, IOrderProductData, IOrdersFormData, IOrdersByMarkersEntity };
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -169,8 +169,17 @@ class PageApi extends asyncModules_1.default {
|
|
|
169
169
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
170
170
|
*/
|
|
171
171
|
async searchPage(name, langCode = this.state.lang) {
|
|
172
|
-
const
|
|
173
|
-
|
|
172
|
+
const searchPages = await this._fetchGet(`/quick/search?lang=${langCode}&name=${name}`);
|
|
173
|
+
if (this.state.multipleResponse) {
|
|
174
|
+
const pageList = [];
|
|
175
|
+
await Promise.all(searchPages.map(async (page) => {
|
|
176
|
+
await this.getPageById(page.id, langCode).then((result) => {
|
|
177
|
+
pageList.push(result);
|
|
178
|
+
});
|
|
179
|
+
}));
|
|
180
|
+
return this._dataPostProcess(pageList, langCode);
|
|
181
|
+
}
|
|
182
|
+
return this._normalizeData(searchPages, langCode);
|
|
174
183
|
}
|
|
175
184
|
}
|
|
176
185
|
exports.default = PageApi;
|
|
@@ -76,40 +76,24 @@ interface IPositionForm {
|
|
|
76
76
|
* @property {number} id - The identifier of the object.
|
|
77
77
|
* @property {number} version - The version number of the object.
|
|
78
78
|
* @property {string} identifier - The textual identifier for the record field.
|
|
79
|
-
* @property {number} attributeSetId - The identifier of the attribute set being used.
|
|
80
79
|
* @property {Record<string, any>} localizeInfos - The name of the page, taking into account localization.
|
|
81
|
-
* @property {object} customSettings - Custom settings for different types of blocks.
|
|
82
80
|
* @property {number} position - The position of the object.
|
|
83
81
|
* @property {boolean} isSync - Indication of page indexing.
|
|
84
82
|
* @property {Record<string, any>} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
|
|
85
83
|
* @property {Types} type - Page type.
|
|
86
|
-
* @property {string} templateIdentifier - User id of the linked template.
|
|
87
84
|
*/
|
|
88
85
|
interface IPositionBlock {
|
|
89
86
|
id: number;
|
|
90
87
|
version: number;
|
|
91
88
|
identifier: string;
|
|
92
|
-
attributeSetId: number;
|
|
93
89
|
localizeInfos: Record<string, any>;
|
|
94
|
-
customSettings: {
|
|
95
|
-
sliderDelay: number;
|
|
96
|
-
sliderDelayType: string;
|
|
97
|
-
productQuantity: number;
|
|
98
|
-
productSortType: string;
|
|
99
|
-
productSortOrder: string;
|
|
100
|
-
productCountElementsPerRow: number;
|
|
101
|
-
similarProductRules: Array<{
|
|
102
|
-
property: string;
|
|
103
|
-
includes: string;
|
|
104
|
-
keywords: string;
|
|
105
|
-
strict: string;
|
|
106
|
-
}>;
|
|
107
|
-
};
|
|
108
90
|
position: number;
|
|
109
91
|
isSync: boolean;
|
|
92
|
+
isVisible: boolean;
|
|
110
93
|
attributeValues: Record<string, any>;
|
|
111
94
|
type: string;
|
|
112
95
|
templateIdentifier: string | null;
|
|
96
|
+
countElementsPerRow: number;
|
|
113
97
|
}
|
|
114
98
|
/**
|
|
115
99
|
* Represents an object with various properties.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import AsyncModules from "../base/asyncModules";
|
|
2
|
-
import { IPaymentsApi, ISessionEntity, IConnectedEntity, IAccountsEntity
|
|
2
|
+
import { IPaymentsApi, ISessionEntity, IConnectedEntity, IAccountsEntity } from "./paymentsInterfaces";
|
|
3
3
|
import StateModule from "../base/stateModule";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with payments
|
|
@@ -28,25 +28,13 @@ export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
|
|
|
28
28
|
/**
|
|
29
29
|
* Creation of payment session.
|
|
30
30
|
*
|
|
31
|
-
* @param {
|
|
32
|
-
*
|
|
33
|
-
* @
|
|
34
|
-
* {
|
|
35
|
-
* "lineItems": [
|
|
36
|
-
* {
|
|
37
|
-
* "quantity": 1,
|
|
38
|
-
* "amount": 5,
|
|
39
|
-
* "currency": "USD",
|
|
40
|
-
* "name": "T-Shirt",
|
|
41
|
-
* "description": "White T-Shirt"
|
|
42
|
-
* }
|
|
43
|
-
* ],
|
|
44
|
-
* "orderId": 22
|
|
45
|
-
* }
|
|
31
|
+
* @param {number} orderId - Order identifier
|
|
32
|
+
* @param {'session' | 'intent'} type - Session type
|
|
33
|
+
* @param {boolean} automaticTaxEnabled - Automatic calculation of the tax rate
|
|
46
34
|
*
|
|
47
35
|
* @returns Returns a single payment session object.
|
|
48
36
|
*/
|
|
49
|
-
createSession(
|
|
37
|
+
createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ISessionEntity>;
|
|
50
38
|
/**
|
|
51
39
|
* Get payment settings.
|
|
52
40
|
*
|
|
@@ -35,26 +35,17 @@ class PaymentsApi extends asyncModules_1.default {
|
|
|
35
35
|
/**
|
|
36
36
|
* Creation of payment session.
|
|
37
37
|
*
|
|
38
|
-
* @param {
|
|
39
|
-
*
|
|
40
|
-
* @
|
|
41
|
-
* {
|
|
42
|
-
* "lineItems": [
|
|
43
|
-
* {
|
|
44
|
-
* "quantity": 1,
|
|
45
|
-
* "amount": 5,
|
|
46
|
-
* "currency": "USD",
|
|
47
|
-
* "name": "T-Shirt",
|
|
48
|
-
* "description": "White T-Shirt"
|
|
49
|
-
* }
|
|
50
|
-
* ],
|
|
51
|
-
* "orderId": 22
|
|
52
|
-
* }
|
|
38
|
+
* @param {number} orderId - Order identifier
|
|
39
|
+
* @param {'session' | 'intent'} type - Session type
|
|
40
|
+
* @param {boolean} automaticTaxEnabled - Automatic calculation of the tax rate
|
|
53
41
|
*
|
|
54
42
|
* @returns Returns a single payment session object.
|
|
55
43
|
*/
|
|
56
|
-
async createSession(
|
|
57
|
-
const result = await this._fetchPost('/sessions',
|
|
44
|
+
async createSession(orderId, type, automaticTaxEnabled) {
|
|
45
|
+
const result = await this._fetchPost('/sessions', {
|
|
46
|
+
type,
|
|
47
|
+
orderId
|
|
48
|
+
});
|
|
58
49
|
return result;
|
|
59
50
|
}
|
|
60
51
|
/**
|
|
@@ -92,7 +83,7 @@ class PaymentsApi extends asyncModules_1.default {
|
|
|
92
83
|
* @returns Returns true (in case of successful execution) or false (in case of unsuccessful execution)
|
|
93
84
|
*/
|
|
94
85
|
async webhookStripe() {
|
|
95
|
-
const result = await this._fetchPost('/webhook/stripe',
|
|
86
|
+
const result = await this._fetchPost('/webhook/stripe', {});
|
|
96
87
|
return result;
|
|
97
88
|
}
|
|
98
89
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
interface IPaymentsApi {
|
|
14
14
|
getSessions(limit: number, offset: number): Promise<Array<ISessionEntity>>;
|
|
15
15
|
getSessionById(id: number): Promise<ISessionEntity>;
|
|
16
|
-
createSession(
|
|
16
|
+
createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ISessionEntity>;
|
|
17
17
|
getConnected(): Promise<IConnectedEntity | null>;
|
|
18
18
|
getAccounts(): Promise<Array<IAccountsEntity>>;
|
|
19
19
|
getAccountById(id: number): Promise<IAccountsEntity>;
|
|
@@ -103,8 +103,6 @@ interface IConnectedEntity {
|
|
|
103
103
|
/**
|
|
104
104
|
* @interface
|
|
105
105
|
* @property {number} id - Object identifier.
|
|
106
|
-
* @property {string} updatedDate - Object modification date.
|
|
107
|
-
* @property {number} version - Object modification version number.
|
|
108
106
|
* @property {string} identifier - Text identifier for the recording field.
|
|
109
107
|
* @property {Record<string, any>} localizeInfos - Json description of the payment account object.
|
|
110
108
|
* @property {string} type - Type may be 'stripe', 'paypal' or 'custom'.
|
|
@@ -112,8 +110,6 @@ interface IConnectedEntity {
|
|
|
112
110
|
*/
|
|
113
111
|
interface IAccountsEntity {
|
|
114
112
|
id: number;
|
|
115
|
-
updatedDate: string;
|
|
116
|
-
version: number;
|
|
117
113
|
identifier: string;
|
|
118
114
|
localizeInfos: Record<string, any>;
|
|
119
115
|
type: 'stripe' | 'paypal' | 'custom';
|
|
@@ -18,7 +18,7 @@ export default class ProductStatusesApi extends AsyncModules implements IProduct
|
|
|
18
18
|
/**
|
|
19
19
|
* Search for a product status object by identifier.
|
|
20
20
|
*
|
|
21
|
-
* @param {number}
|
|
21
|
+
* @param {number} id - Status id
|
|
22
22
|
* @param {string} [langCode] - Optional parameter language code
|
|
23
23
|
*
|
|
24
24
|
* @returns Returns a product status object
|
|
@@ -27,7 +27,7 @@ export default class ProductStatusesApi extends AsyncModules implements IProduct
|
|
|
27
27
|
/**
|
|
28
28
|
* Search for a product status object by its textual identifier (marker).
|
|
29
29
|
*
|
|
30
|
-
* @param {string}
|
|
30
|
+
* @param {string} marker - Product marker
|
|
31
31
|
* @param {string} [langCode] - Optional parameter language code
|
|
32
32
|
*
|
|
33
33
|
* @returns Returns a product status object
|
|
@@ -36,7 +36,7 @@ export default class ProductStatusesApi extends AsyncModules implements IProduct
|
|
|
36
36
|
/**
|
|
37
37
|
* Check the existence of a textual identifier.
|
|
38
38
|
*
|
|
39
|
-
* @param {string}
|
|
39
|
+
* @param {string} marker - Product marker
|
|
40
40
|
*
|
|
41
41
|
* @returns Returns true if the textual identifier (marker) exists or false if it doesn't
|
|
42
42
|
*/
|
|
@@ -22,7 +22,7 @@ class ProductStatusesApi extends asyncModules_1.default {
|
|
|
22
22
|
/**
|
|
23
23
|
* Search for a product status object by identifier.
|
|
24
24
|
*
|
|
25
|
-
* @param {number}
|
|
25
|
+
* @param {number} id - Status id
|
|
26
26
|
* @param {string} [langCode] - Optional parameter language code
|
|
27
27
|
*
|
|
28
28
|
* @returns Returns a product status object
|
|
@@ -34,7 +34,7 @@ class ProductStatusesApi extends asyncModules_1.default {
|
|
|
34
34
|
/**
|
|
35
35
|
* Search for a product status object by its textual identifier (marker).
|
|
36
36
|
*
|
|
37
|
-
* @param {string}
|
|
37
|
+
* @param {string} marker - Product marker
|
|
38
38
|
* @param {string} [langCode] - Optional parameter language code
|
|
39
39
|
*
|
|
40
40
|
* @returns Returns a product status object
|
|
@@ -46,7 +46,7 @@ class ProductStatusesApi extends asyncModules_1.default {
|
|
|
46
46
|
/**
|
|
47
47
|
* Check the existence of a textual identifier.
|
|
48
48
|
*
|
|
49
|
-
* @param {string}
|
|
49
|
+
* @param {string} marker - Product marker
|
|
50
50
|
*
|
|
51
51
|
* @returns Returns true if the textual identifier (marker) exists or false if it doesn't
|
|
52
52
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { IProductsQuery, IFilterParams, IProductApi, IProductsEntity, IProductInfo } from './productsInterfaces';
|
|
1
|
+
import { IProductsQuery, IFilterParams, IProductApi, IProductsEntity, IProductInfo, IProductBlock } from './productsInterfaces';
|
|
2
2
|
import AsyncModules from '../base/asyncModules';
|
|
3
3
|
import StateModule from "../base/stateModule";
|
|
4
|
-
import { IBlocksResponse } from "../blocks/blocksInterfaces";
|
|
5
4
|
/**
|
|
6
5
|
* Controllers for working with product pages
|
|
7
6
|
*/
|
|
@@ -128,6 +127,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
|
|
|
128
127
|
/**
|
|
129
128
|
* Search for information about products and prices for the selected category.
|
|
130
129
|
* @param {string} url - Page url.
|
|
130
|
+
* @param {string} langCode - Language code.
|
|
131
131
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
132
132
|
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
133
133
|
*
|
|
@@ -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, userQuery?: IProductsQuery): Promise<Array<IProductInfo>>;
|
|
150
|
+
getProductsPriceByPageUrl(url: string, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductInfo>>;
|
|
151
151
|
/**
|
|
152
152
|
* Search for all products with pagination for the selected category.
|
|
153
153
|
* @param {Array<IFilterParams>} body - Request body.
|
|
@@ -228,7 +228,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
|
|
|
228
228
|
* @param {number} id - Product id
|
|
229
229
|
*
|
|
230
230
|
*/
|
|
231
|
-
getProductBlockById(id: number): Promise<Array<
|
|
231
|
+
getProductBlockById(id: number): Promise<Array<IProductBlock>>;
|
|
232
232
|
/**
|
|
233
233
|
* Quick search for product page objects with limited output.
|
|
234
234
|
*
|
|
@@ -66,7 +66,7 @@ class ProductApi extends asyncModules_1.default {
|
|
|
66
66
|
*/
|
|
67
67
|
async getProducts(body = [], langCode = this.state.lang, userQuery) {
|
|
68
68
|
const query = { ...this._defaultQuery, ...userQuery, langCode };
|
|
69
|
-
const result = await this._fetchPost(`/all
|
|
69
|
+
const result = await this._fetchPost(`/all?` + this._queryParamsToString(query), body);
|
|
70
70
|
return this._dataPostProcess(result.items, langCode);
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
@@ -150,6 +150,7 @@ class ProductApi extends asyncModules_1.default {
|
|
|
150
150
|
/**
|
|
151
151
|
* Search for information about products and prices for the selected category.
|
|
152
152
|
* @param {string} url - Page url.
|
|
153
|
+
* @param {string} langCode - Language code.
|
|
153
154
|
* @param {IProductsQuery} [userQuery] - Optional set query parameters.
|
|
154
155
|
* @param {number} [userQuery.limit] - Optional parameter for pagination, default is 0
|
|
155
156
|
*
|
|
@@ -169,8 +170,8 @@ class ProductApi extends asyncModules_1.default {
|
|
|
169
170
|
*
|
|
170
171
|
* @returns Array with ProductInformation objects
|
|
171
172
|
*/
|
|
172
|
-
async getProductsPriceByPageUrl(url, userQuery) {
|
|
173
|
-
const query = { ...this._defaultQuery, ...userQuery };
|
|
173
|
+
async getProductsPriceByPageUrl(url, langCode = this.state.lang, userQuery) {
|
|
174
|
+
const query = { ...this._defaultQuery, ...userQuery, langCode };
|
|
174
175
|
const result = await this._fetchGet(`/page/${url}/prices?` + this._queryParamsToString(query));
|
|
175
176
|
return result.items;
|
|
176
177
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { LangType } from "../base/utils";
|
|
2
|
-
import { IBlocksResponse } from "../blocks/blocksInterfaces";
|
|
1
|
+
import { LangType, Types } from "../base/utils";
|
|
3
2
|
/**
|
|
4
3
|
* Represents an interface object of Products Api.
|
|
5
4
|
*
|
|
@@ -25,11 +24,11 @@ interface IProductApi {
|
|
|
25
24
|
getProducts(body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
26
25
|
getProductsEmptyPage(langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
27
26
|
getProductsByPageId(id: number, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
28
|
-
getProductsPriceByPageUrl(url: string, userQuery?: IProductsQuery): Promise<Array<IProductInfo>>;
|
|
27
|
+
getProductsPriceByPageUrl(url: string, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductInfo>>;
|
|
29
28
|
getProductsByPageUrl(url: string, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
30
|
-
getRelatedProductsById(id: number, langCode?:
|
|
31
|
-
getProductById(id: number, langCode:
|
|
32
|
-
getProductBlockById(id: number): Promise<Array<
|
|
29
|
+
getRelatedProductsById(id: number, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
30
|
+
getProductById(id: number, langCode: string): Promise<IProductsEntity>;
|
|
31
|
+
getProductBlockById(id: number): Promise<Array<IProductBlock>>;
|
|
33
32
|
searchProduct(name: string, langCode: string): Promise<Array<IProductsEntity>>;
|
|
34
33
|
}
|
|
35
34
|
/**
|
|
@@ -122,7 +121,6 @@ interface IProductsEntity {
|
|
|
122
121
|
blocks?: string | Array<string>;
|
|
123
122
|
isVisible: boolean;
|
|
124
123
|
statusId: number | null;
|
|
125
|
-
relatedIds: number[];
|
|
126
124
|
attributeSetId: number;
|
|
127
125
|
isSync: number | boolean;
|
|
128
126
|
price: number;
|
|
@@ -138,4 +136,34 @@ interface IProductInfo {
|
|
|
138
136
|
id: number;
|
|
139
137
|
price: number;
|
|
140
138
|
}
|
|
141
|
-
|
|
139
|
+
interface IProductBlock {
|
|
140
|
+
id: number;
|
|
141
|
+
attributeSetId: number | null;
|
|
142
|
+
localizeInfos: Record<string, any>;
|
|
143
|
+
version: number;
|
|
144
|
+
position: number;
|
|
145
|
+
identifier: string;
|
|
146
|
+
type: Types;
|
|
147
|
+
customSettings: {
|
|
148
|
+
sliderDelay: number;
|
|
149
|
+
sliderDelayType: string;
|
|
150
|
+
productConfig: {
|
|
151
|
+
quantity: number;
|
|
152
|
+
sortType: string;
|
|
153
|
+
sortOrder: string;
|
|
154
|
+
countElementsPerRow: number;
|
|
155
|
+
};
|
|
156
|
+
similarProductRules: Array<{
|
|
157
|
+
property: string;
|
|
158
|
+
includes: string;
|
|
159
|
+
keywords: string;
|
|
160
|
+
strict: string;
|
|
161
|
+
}>;
|
|
162
|
+
condition: Record<string, any>;
|
|
163
|
+
};
|
|
164
|
+
templateIdentifier: string | null;
|
|
165
|
+
isVisible: boolean;
|
|
166
|
+
isSync: boolean;
|
|
167
|
+
attributeValues: Record<string, any>;
|
|
168
|
+
}
|
|
169
|
+
export { IFilterParams, IProductsQuery, IProductApi, IProductsEntity, IProductInfo, IProductBlock };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AsyncModules from '../base/asyncModules';
|
|
2
|
-
import { ITemplatesApi, ITemplateEntity
|
|
2
|
+
import { ITemplatesApi, ITemplateEntity } from './templatesInterfaces';
|
|
3
|
+
import { Types } from "../base/utils";
|
|
3
4
|
import StateModule from "../base/stateModule";
|
|
4
|
-
import { BlockType } from "../blocks/blocksInterfaces";
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with template objects
|
|
7
7
|
*/
|
|
@@ -15,22 +15,22 @@ export default class TemplatesPreviewApi extends AsyncModules implements ITempla
|
|
|
15
15
|
*
|
|
16
16
|
* @returns Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
|
|
17
17
|
*/
|
|
18
|
-
getAllTemplates(langCode?: string): Promise<
|
|
18
|
+
getAllTemplates(langCode?: string): Promise<Record<Types, ITemplateEntity>>;
|
|
19
19
|
/**
|
|
20
20
|
* Get template objects by type.
|
|
21
21
|
*
|
|
22
|
-
* @param {
|
|
22
|
+
* @param {Types} type - Product marker
|
|
23
23
|
* @param {string} [langCode] - Optional parameter language code
|
|
24
24
|
*
|
|
25
25
|
* @returns Returns a TemplateEntity object
|
|
26
26
|
*/
|
|
27
|
-
getTemplateByType(type:
|
|
27
|
+
getTemplateByType(type: Types): Promise<Array<ITemplateEntity>>;
|
|
28
28
|
/**
|
|
29
29
|
* Get one template object by id.
|
|
30
30
|
*
|
|
31
|
-
* @param {
|
|
31
|
+
* @param {number} id - Template id
|
|
32
32
|
*
|
|
33
33
|
* @returns Returns a TemplateEntity object
|
|
34
34
|
*/
|
|
35
|
-
getTemplateById(id:
|
|
35
|
+
getTemplateById(id: number): Promise<Record<Types, ITemplateEntity>>;
|
|
36
36
|
}
|
|
@@ -26,7 +26,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
|
|
|
26
26
|
/**
|
|
27
27
|
* Get template objects by type.
|
|
28
28
|
*
|
|
29
|
-
* @param {
|
|
29
|
+
* @param {Types} type - Product marker
|
|
30
30
|
* @param {string} [langCode] - Optional parameter language code
|
|
31
31
|
*
|
|
32
32
|
* @returns Returns a TemplateEntity object
|
|
@@ -38,7 +38,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
|
|
|
38
38
|
/**
|
|
39
39
|
* Get one template object by id.
|
|
40
40
|
*
|
|
41
|
-
* @param {
|
|
41
|
+
* @param {number} id - Template id
|
|
42
42
|
*
|
|
43
43
|
* @returns Returns a TemplateEntity object
|
|
44
44
|
*/
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { IGeneralTypesEntity } from "../general-types/generalTypesInterfaces";
|
|
2
1
|
import { Types } from "../base/utils";
|
|
3
|
-
import { BlockType } from "../blocks/blocksInterfaces";
|
|
4
2
|
/**
|
|
5
3
|
* Represents an interface object of Templates Api.
|
|
6
4
|
*
|
|
@@ -9,39 +7,30 @@ import { BlockType } from "../blocks/blocksInterfaces";
|
|
|
9
7
|
* @property {function} getTemplateById - Get one template object by id.
|
|
10
8
|
*/
|
|
11
9
|
interface ITemplatesApi {
|
|
12
|
-
getAllTemplates(langCode: string): Promise<
|
|
13
|
-
getTemplateByType(type:
|
|
14
|
-
getTemplateById(id:
|
|
10
|
+
getAllTemplates(langCode: string): Promise<Record<Types, ITemplateEntity>>;
|
|
11
|
+
getTemplateByType(type: Types, langCode: string): Promise<Array<ITemplateEntity>>;
|
|
12
|
+
getTemplateById(id: number): Promise<Record<Types, ITemplateEntity>>;
|
|
15
13
|
}
|
|
16
14
|
/**
|
|
17
15
|
* Represents a template entity object.
|
|
18
16
|
*
|
|
19
17
|
* @interface
|
|
20
18
|
* @property {number} id - The unique identifier of the position.
|
|
21
|
-
* @property {Date | string} updateDate - The date of last updated.
|
|
22
19
|
* @property {number} version - The version number of the object.
|
|
23
20
|
* @property {string} identifier - The textual identifier for the record field.
|
|
24
|
-
* @property {IGeneralTypesEntity} generalType - General type Entity object.
|
|
25
21
|
* @property {number} generalTypeId - General type Entity id.
|
|
26
22
|
* @property {string} title - The name of the template.
|
|
27
23
|
* @property {number} position - The position of the object.
|
|
28
|
-
* @property {number | string} positionId - Id of the item object.
|
|
29
24
|
* @property {Types} generalTypeName - General type name.
|
|
30
25
|
*
|
|
31
26
|
*/
|
|
32
27
|
interface ITemplateEntity {
|
|
33
28
|
id: number;
|
|
34
|
-
updateDate?: string | Date;
|
|
35
29
|
version: number;
|
|
36
30
|
identifier: string;
|
|
37
|
-
generalType?: IGeneralTypesEntity;
|
|
38
31
|
generalTypeId: number;
|
|
39
32
|
title: string;
|
|
40
33
|
position: number;
|
|
41
|
-
positionId?: number;
|
|
42
34
|
generalTypeName: Types;
|
|
43
35
|
}
|
|
44
|
-
|
|
45
|
-
[key: string]: ITemplateEntity;
|
|
46
|
-
}
|
|
47
|
-
export { ITemplatesApi, ITemplateEntity, ITemplateList };
|
|
36
|
+
export { ITemplatesApi, ITemplateEntity, };
|