oneentry 1.0.70 → 1.0.72
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 +642 -881
- package/dist/attribute-sets/attributeSetsApi.d.ts +2 -2
- package/dist/attribute-sets/attributeSetsApi.js +2 -2
- package/dist/auth-provider/authProviderApi.d.ts +3 -2
- package/dist/auth-provider/authProviderApi.js +5 -2
- package/dist/auth-provider/authProvidersInterfaces.d.ts +7 -2
- package/dist/base/asyncModules.js +6 -2
- package/dist/base/stateModule.js +1 -1
- package/dist/blocks/blocksApi.d.ts +3 -3
- package/dist/blocks/blocksApi.js +6 -6
- package/dist/blocks/blocksInterfaces.d.ts +2 -2
- package/dist/formsData/formsDataApi.d.ts +1 -0
- package/dist/formsData/formsDataApi.js +2 -1
- package/dist/formsData/formsDataInterfaces.d.ts +2 -2
- package/dist/orders/ordersApi.d.ts +1 -1
- package/dist/orders/ordersApi.js +3 -0
- package/dist/orders/ordersInterfaces.d.ts +11 -9
- package/dist/pages/pagesApi.js +12 -3
- package/dist/pages/pagesInterfaces.d.ts +6 -20
- package/dist/payments/paymentsApi.d.ts +5 -17
- package/dist/payments/paymentsApi.js +9 -18
- package/dist/payments/paymentsInterfaces.d.ts +11 -37
- 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 +40 -12
- 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/templatesPreviewInterfaces.d.ts +1 -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 +1 -1
|
@@ -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
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import AsyncModules from "../base/asyncModules";
|
|
2
|
-
import { IAuthProvider, ISignUpData, ISignUpEntity, IAuthEntity, IAuthProvidersEntity, IAuthPostBody } from "./authProvidersInterfaces";
|
|
2
|
+
import { IAuthProvider, ISignUpData, ISignUpEntity, ICode, IAuthEntity, IAuthProvidersEntity, IAuthPostBody } from "./authProvidersInterfaces";
|
|
3
3
|
import StateModule from "../base/stateModule";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with auth services.
|
|
@@ -46,8 +46,9 @@ export default class AuthProviderApi extends AsyncModules implements IAuthProvid
|
|
|
46
46
|
* Getting a user activation code. The code is returned via the appropriate user notification method
|
|
47
47
|
* @param {string} marker - The text identifier of the authorization provider. Example - email
|
|
48
48
|
* @param {string} userIdentifier - The text identifier of the user's object (user login)
|
|
49
|
+
* @param {string} eventIdentifier - Text identifier of the event object for which the code is generated
|
|
49
50
|
*/
|
|
50
|
-
generateCode(marker: string, userIdentifier: string): Promise<
|
|
51
|
+
generateCode(marker: string, userIdentifier: string, eventIdentifier: string): Promise<ICode>;
|
|
51
52
|
/**
|
|
52
53
|
* User activation code verification. Returns true (if the code is correct) or false (if it is incorrect).
|
|
53
54
|
* @param {string} marker - The text identifier of the authorization provider. Example - email
|
|
@@ -52,12 +52,15 @@ class AuthProviderApi extends asyncModules_1.default {
|
|
|
52
52
|
* Getting a user activation code. The code is returned via the appropriate user notification method
|
|
53
53
|
* @param {string} marker - The text identifier of the authorization provider. Example - email
|
|
54
54
|
* @param {string} userIdentifier - The text identifier of the user's object (user login)
|
|
55
|
+
* @param {string} eventIdentifier - Text identifier of the event object for which the code is generated
|
|
55
56
|
*/
|
|
56
|
-
async generateCode(marker, userIdentifier) {
|
|
57
|
+
async generateCode(marker, userIdentifier, eventIdentifier) {
|
|
57
58
|
const data = {
|
|
58
|
-
"userIdentifier": userIdentifier
|
|
59
|
+
"userIdentifier": userIdentifier,
|
|
60
|
+
"eventIdentifier": eventIdentifier
|
|
59
61
|
};
|
|
60
62
|
const result = await this._fetchPost(`/marker/${marker}/users/generate-code`, data);
|
|
63
|
+
return result;
|
|
61
64
|
}
|
|
62
65
|
/**
|
|
63
66
|
* User activation code verification. Returns true (if the code is correct) or false (if it is incorrect).
|
|
@@ -15,7 +15,7 @@ import { ILocalizeInfo } from "../base/utils";
|
|
|
15
15
|
*/
|
|
16
16
|
interface IAuthProvider {
|
|
17
17
|
signUp(marker: string, data: ISignUpData, langCode?: string): Promise<ISignUpEntity>;
|
|
18
|
-
generateCode(marker: string, userIdentifier: string): Promise<
|
|
18
|
+
generateCode(marker: string, userIdentifier: string, eventIdentifier: string): Promise<ICode>;
|
|
19
19
|
checkCode(marker: string, userIdentifier: string, code: string): Promise<boolean>;
|
|
20
20
|
activateUser(marker: string, userIdentifier: string, code: string): Promise<boolean>;
|
|
21
21
|
auth(marker: string, data: IAuthPostBody): Promise<IAuthEntity>;
|
|
@@ -80,6 +80,7 @@ interface IAuthProvidersEntity {
|
|
|
80
80
|
isCheckCode: boolean;
|
|
81
81
|
type: string;
|
|
82
82
|
formIdentifier: string | null;
|
|
83
|
+
config: Record<string, any>;
|
|
83
84
|
}
|
|
84
85
|
interface IAuthPostBody {
|
|
85
86
|
authData: Array<{
|
|
@@ -87,4 +88,8 @@ interface IAuthPostBody {
|
|
|
87
88
|
value: string | number;
|
|
88
89
|
}>;
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
+
interface ICode {
|
|
92
|
+
"code": string;
|
|
93
|
+
"expiredDate": string;
|
|
94
|
+
}
|
|
95
|
+
export { IAuthProvider, IAuthFormData, ISignUpData, ISignUpEntity, ICodeEntity, IAuthEntity, IAuthProvidersEntity, IAuthPostBody, ICode };
|
|
@@ -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;
|
|
@@ -12,18 +12,18 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
12
12
|
/**
|
|
13
13
|
* Get blocks by parameters.
|
|
14
14
|
*
|
|
15
|
-
* @param {BlockType}
|
|
15
|
+
* @param {BlockType} type - Available values : forCatalogProducts, forBasketPage, forErrorPage, forCatalogPages, forProductPreview, forProductPage, forSimilarProductBlock, forStatisticProductBlock, forProductBlock, forForm, forFormField, forNewsPage, forNewsBlock, forNewsPreview, forOneNewsPage, forUsualPage, forTextBlock, forSlider, forOrder, service
|
|
16
16
|
* @param {string} [langCode] - Language code. Default "en_US"
|
|
17
17
|
* @param {number} [offset] - Parameter for pagination. Default 0
|
|
18
18
|
* @param {number} [limit] - Parameter for pagination. Default 30
|
|
19
19
|
*
|
|
20
20
|
* @returns Return array of BlocksEntity object.
|
|
21
21
|
*/
|
|
22
|
-
getBlocks(type
|
|
22
|
+
getBlocks(type: BlockType, langCode?: string, offset?: number, limit?: number): Promise<Array<IBlockEntity | IBlocksResponse>>;
|
|
23
23
|
/**
|
|
24
24
|
* Get block by marker.
|
|
25
25
|
*
|
|
26
|
-
* @param {string}
|
|
26
|
+
* @param {string} marker - Marker of Block.
|
|
27
27
|
* @param {string} [langCode] - Language code. Default "en_US"
|
|
28
28
|
*
|
|
29
29
|
* @returns Return BlocksEntity object.
|
package/dist/blocks/blocksApi.js
CHANGED
|
@@ -12,14 +12,14 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
12
12
|
/**
|
|
13
13
|
* Get blocks by parameters.
|
|
14
14
|
*
|
|
15
|
-
* @param {BlockType}
|
|
15
|
+
* @param {BlockType} type - Available values : forCatalogProducts, forBasketPage, forErrorPage, forCatalogPages, forProductPreview, forProductPage, forSimilarProductBlock, forStatisticProductBlock, forProductBlock, forForm, forFormField, forNewsPage, forNewsBlock, forNewsPreview, forOneNewsPage, forUsualPage, forTextBlock, forSlider, forOrder, service
|
|
16
16
|
* @param {string} [langCode] - Language code. Default "en_US"
|
|
17
17
|
* @param {number} [offset] - Parameter for pagination. Default 0
|
|
18
18
|
* @param {number} [limit] - Parameter for pagination. Default 30
|
|
19
19
|
*
|
|
20
20
|
* @returns Return array of BlocksEntity object.
|
|
21
21
|
*/
|
|
22
|
-
async getBlocks(type
|
|
22
|
+
async getBlocks(type, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
23
23
|
const response = await this._fetchGet(`?langCode=${langCode}&type=${type}&offset=${offset}&limit=${limit}`);
|
|
24
24
|
if (this.state.multipleResponse) {
|
|
25
25
|
const normalizeResponse = this._normalizeData(response.items);
|
|
@@ -32,7 +32,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
32
32
|
block.countElementsPerRow = 0;
|
|
33
33
|
}
|
|
34
34
|
delete block.customSettings;
|
|
35
|
-
delete block.
|
|
35
|
+
delete block.attributesSetIdentifier;
|
|
36
36
|
delete block.productPageUrls;
|
|
37
37
|
if (block.type === 'forSimilarProductBlock') {
|
|
38
38
|
try {
|
|
@@ -62,14 +62,14 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
62
62
|
/**
|
|
63
63
|
* Get block by marker.
|
|
64
64
|
*
|
|
65
|
-
* @param {string}
|
|
65
|
+
* @param {string} marker - Marker of Block.
|
|
66
66
|
* @param {string} [langCode] - Language code. Default "en_US"
|
|
67
67
|
*
|
|
68
68
|
* @returns Return BlocksEntity object.
|
|
69
69
|
*/
|
|
70
70
|
async getBlockByMarker(marker, langCode = this.state.lang) {
|
|
71
71
|
const response = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
72
|
-
const normalizeResponse = this._normalizeData(response
|
|
72
|
+
const normalizeResponse = this._normalizeData(response);
|
|
73
73
|
const customSettings = normalizeResponse.customSettings;
|
|
74
74
|
if (customSettings && customSettings.hasOwnProperty('productConfig')) {
|
|
75
75
|
normalizeResponse.countElementsPerRow = customSettings.productConfig.countElementsPerRow ? (+customSettings.productConfig.countElementsPerRow) : 0;
|
|
@@ -78,7 +78,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
78
78
|
normalizeResponse.countElementsPerRow = 0;
|
|
79
79
|
}
|
|
80
80
|
delete normalizeResponse.customSettings;
|
|
81
|
-
delete normalizeResponse.
|
|
81
|
+
delete normalizeResponse.attributesSetIdentifier;
|
|
82
82
|
delete normalizeResponse.productPageUrls;
|
|
83
83
|
if (this.state.multipleResponse) {
|
|
84
84
|
if (normalizeResponse.type === 'forSimilarProductBlock') {
|
|
@@ -9,7 +9,7 @@ import { IProductsEntity } from "../products/productsInterfaces";
|
|
|
9
9
|
* @property {function} searchBlock - Quick search for block objects with limited output.
|
|
10
10
|
*/
|
|
11
11
|
interface IBlocks {
|
|
12
|
-
getBlocks(type: BlockType, langCode
|
|
12
|
+
getBlocks(type: BlockType, langCode?: string, offset?: number, limit?: number): Promise<Array<IBlockEntity | IBlocksResponse>>;
|
|
13
13
|
getBlockByMarker(marker: string, langCode: string): Promise<IBlockEntity>;
|
|
14
14
|
getSimilarProducts(marker: string, langCode?: string, offset?: number, limit?: number): Promise<Array<IProductsEntity>>;
|
|
15
15
|
getProductsByBlockMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<Array<IProductsEntity>>;
|
|
@@ -17,7 +17,7 @@ interface IBlocks {
|
|
|
17
17
|
}
|
|
18
18
|
interface IBlocksResponse {
|
|
19
19
|
id: number;
|
|
20
|
-
|
|
20
|
+
attributesSetIdentifier: string | null;
|
|
21
21
|
localizeInfos: Record<string, any>;
|
|
22
22
|
customSettings: ICustomSetting | null;
|
|
23
23
|
version: number;
|
|
@@ -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
|
/**
|
|
@@ -17,14 +17,14 @@ interface IFormsData {
|
|
|
17
17
|
* @property {number} id - The unique identifier of the form page.
|
|
18
18
|
* @property {string} formIdentifier - The identifier of the page.
|
|
19
19
|
* @property {Date | string} time - The identifier of the form.
|
|
20
|
-
* @property {
|
|
20
|
+
* @property {IFormsPost} formData - The identifier of the position.
|
|
21
21
|
* @property {string} attributeSetIdentifier - Text identifier (marker) of the used attribute set.
|
|
22
22
|
*/
|
|
23
23
|
interface IFormsDataEntity {
|
|
24
24
|
id: number;
|
|
25
25
|
formIdentifier: string;
|
|
26
26
|
time: Date | string;
|
|
27
|
-
formData:
|
|
27
|
+
formData: IFormsPost;
|
|
28
28
|
attributeSetIdentifier?: string;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
@@ -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;
|
|
@@ -90,9 +90,11 @@ interface IOrdersEntity {
|
|
|
90
90
|
identifier: string | null;
|
|
91
91
|
generalTypeId: number | null;
|
|
92
92
|
formIdentifier: string | null;
|
|
93
|
-
paymentAccountIdentifiers: Array<
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
paymentAccountIdentifiers: Array<IPaymentAccountIdentifiers>;
|
|
94
|
+
position: number | null;
|
|
95
|
+
}
|
|
96
|
+
interface IPaymentAccountIdentifiers {
|
|
97
|
+
identifier: string;
|
|
96
98
|
}
|
|
97
99
|
/**
|
|
98
100
|
* @interface
|
|
@@ -114,7 +116,6 @@ interface IOrderData {
|
|
|
114
116
|
* @property {Array<IOrdersFormData>} formData - Data submitted by the form linked to the order store.
|
|
115
117
|
* @property {Array<IOrderProducts>} products - Array of products added to order.
|
|
116
118
|
* @property {string} totalSum - Total order amount.
|
|
117
|
-
* @property {number} price - Price order.
|
|
118
119
|
* @property {string} currency - Currency used to pay for the order.
|
|
119
120
|
* @property {string} createdDate - Date when the order was created.
|
|
120
121
|
* @property {string} paymentAccountIdentifier - Textual identifier for the order payment.
|
|
@@ -122,6 +123,7 @@ interface IOrderData {
|
|
|
122
123
|
* @property {boolean} isHistory - Indicates that the order has been saved in the order history.
|
|
123
124
|
*/
|
|
124
125
|
interface IOrdersByMarkersEntity {
|
|
126
|
+
attributeSetIdentifier: string;
|
|
125
127
|
statusIdentifier: string;
|
|
126
128
|
formIdentifier: string;
|
|
127
129
|
formData: Array<IOrdersFormData>;
|
|
@@ -129,9 +131,9 @@ interface IOrdersByMarkersEntity {
|
|
|
129
131
|
totalSum: string;
|
|
130
132
|
currency: string;
|
|
131
133
|
createdDate: string;
|
|
132
|
-
price: number;
|
|
133
134
|
paymentAccountIdentifier: string;
|
|
134
135
|
paymentAccountLocalizeInfos: Record<string, any>;
|
|
135
136
|
isHistory: boolean;
|
|
137
|
+
id: number;
|
|
136
138
|
}
|
|
137
|
-
export { IOrdersEntity, IBaseOrdersEntity, IOrderProducts, IPicture, IOrdersApi, IOrderData, IOrderProductData, IOrdersFormData, IOrdersByMarkersEntity };
|
|
139
|
+
export { IOrdersEntity, IBaseOrdersEntity, IOrderProducts, IPicture, IOrdersApi, IOrderData, IOrderProductData, IOrdersFormData, IOrdersByMarkersEntity, IPaymentAccountIdentifiers };
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -120,7 +120,7 @@ class PageApi extends asyncModules_1.default {
|
|
|
120
120
|
item.countElementsPerRow = 0;
|
|
121
121
|
}
|
|
122
122
|
delete item.customSettings;
|
|
123
|
-
delete item.
|
|
123
|
+
delete item.attributesSetIdentifier;
|
|
124
124
|
return item;
|
|
125
125
|
});
|
|
126
126
|
if (this.state.multipleResponse) {
|
|
@@ -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,26 @@ 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).
|
|
83
|
+
* @property {string} attributeSetIdentifier
|
|
85
84
|
* @property {Types} type - Page type.
|
|
86
|
-
* @property {string} templateIdentifier - User id of the linked template.
|
|
87
85
|
*/
|
|
88
86
|
interface IPositionBlock {
|
|
89
87
|
id: number;
|
|
90
88
|
version: number;
|
|
91
89
|
identifier: string;
|
|
92
|
-
attributeSetId: number;
|
|
93
90
|
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
91
|
position: number;
|
|
109
92
|
isSync: boolean;
|
|
93
|
+
isVisible: boolean;
|
|
110
94
|
attributeValues: Record<string, any>;
|
|
95
|
+
attributeSetIdentifier: string | null;
|
|
111
96
|
type: string;
|
|
112
97
|
templateIdentifier: string | null;
|
|
98
|
+
countElementsPerRow: number;
|
|
113
99
|
}
|
|
114
100
|
/**
|
|
115
101
|
* Represents an object with various properties.
|
|
@@ -123,7 +109,7 @@ interface IPositionBlock {
|
|
|
123
109
|
* @property {Record<string, any>} localizeInfos - The name of the page, taking into account localization.
|
|
124
110
|
* @property {boolean} isVisible - A sign of page visibility.
|
|
125
111
|
* @property {number} products - The number of products linked to the page.
|
|
126
|
-
* @property {
|
|
112
|
+
* @property {string} attributeSetIdentifier - Set of attributes id.
|
|
127
113
|
* @property {boolean} isSync - Indication of page indexing.
|
|
128
114
|
* @property {string} templateIdentifier - User id of the linked template.
|
|
129
115
|
* @property {Record<string, any>} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
|
|
@@ -132,7 +118,7 @@ interface IPositionBlock {
|
|
|
132
118
|
* @property {number} childrenCount - Children count.
|
|
133
119
|
*/
|
|
134
120
|
interface IPagesEntity {
|
|
135
|
-
|
|
121
|
+
attributeSetIdentifier?: string;
|
|
136
122
|
attributeValues: Record<string, any>;
|
|
137
123
|
childrenCount?: number;
|
|
138
124
|
config?: Record<string, number>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import AsyncModules from "../base/asyncModules";
|
|
2
|
-
import { IPaymentsApi, ISessionEntity, IConnectedEntity, IAccountsEntity,
|
|
2
|
+
import { IPaymentsApi, ISessionEntity, IConnectedEntity, IAccountsEntity, ICreateSessionEntity } 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<ICreateSessionEntity>;
|
|
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<ICreateSessionEntity>;
|
|
17
17
|
getConnected(): Promise<IConnectedEntity | null>;
|
|
18
18
|
getAccounts(): Promise<Array<IAccountsEntity>>;
|
|
19
19
|
getAccountById(id: number): Promise<IAccountsEntity>;
|
|
@@ -35,15 +35,6 @@ interface ILineItems {
|
|
|
35
35
|
name: string;
|
|
36
36
|
description: string;
|
|
37
37
|
}
|
|
38
|
-
/**
|
|
39
|
-
* @interface
|
|
40
|
-
* @property {Array<ILineItems>} lineItems - List of items.
|
|
41
|
-
* @property {number} orderId - Order identifier.
|
|
42
|
-
*/
|
|
43
|
-
interface ISessionBody {
|
|
44
|
-
lineItems: Array<ILineItems>;
|
|
45
|
-
orderId: number;
|
|
46
|
-
}
|
|
47
38
|
/**
|
|
48
39
|
* @interface
|
|
49
40
|
* @property {number} amount
|
|
@@ -57,54 +48,39 @@ interface IIntent {
|
|
|
57
48
|
* @interface
|
|
58
49
|
* @property {number} id - Object identifier.
|
|
59
50
|
* @property {string} updatedDate - Object modification date.
|
|
60
|
-
* @property {number} version - Object modification version number.
|
|
61
|
-
* @property {string} identifier - Text identifier for the record field.
|
|
62
51
|
* @property {string} type - Type may be 'session' or 'intent'.
|
|
63
52
|
* @property {number} orderId - Order identifier.
|
|
64
53
|
* @property {number} paymentAccountId - Payment account object identifier.
|
|
65
|
-
* @property {string} status - Payment status.
|
|
66
|
-
* @property {string} sessionId - Payment ID from an external provider.
|
|
67
54
|
* @property {string} paymentUrl - Payment link.
|
|
68
|
-
* @property {string} successUrl - Redirect link after successful payment.
|
|
69
|
-
* @property {string} cancelUrl - Redirect link after payment cancellation.
|
|
70
|
-
* @property {IIntent} intent - Payment intent.
|
|
71
|
-
* @property {number} intentId - Intent object identifier.
|
|
72
55
|
* @property {string} clientSecret - Client secret key.
|
|
73
56
|
*/
|
|
74
57
|
interface ISessionEntity {
|
|
75
58
|
id: number;
|
|
76
59
|
updatedDate: string;
|
|
77
|
-
version: number;
|
|
78
|
-
identifier: string;
|
|
79
60
|
type: 'session' | 'intent';
|
|
80
|
-
lineItems: Array<ILineItems>;
|
|
81
61
|
orderId: number;
|
|
82
62
|
paymentAccountId: number;
|
|
83
|
-
status: string;
|
|
84
|
-
sessionId: string;
|
|
85
63
|
paymentUrl: string;
|
|
86
|
-
successUrl: string;
|
|
87
|
-
cancelUrl: string;
|
|
88
|
-
intent: IIntent;
|
|
89
|
-
intentId: number;
|
|
90
64
|
clientSecret: string;
|
|
91
65
|
}
|
|
66
|
+
interface ICreateSessionEntity {
|
|
67
|
+
id: number;
|
|
68
|
+
updatedDate: string;
|
|
69
|
+
version: number;
|
|
70
|
+
identifier: string;
|
|
71
|
+
}
|
|
92
72
|
/**
|
|
93
73
|
* @interface
|
|
94
74
|
* @property {string} [stripeAccountId] - Identifier of connected Stripe account.
|
|
95
75
|
* @property {string} [stripePublishableKey] - Stripe Connect public key.
|
|
96
|
-
* @property {string} [paypalAccountId] - Identifier of connected Paypal account.
|
|
97
76
|
*/
|
|
98
77
|
interface IConnectedEntity {
|
|
99
|
-
stripeAccountId
|
|
100
|
-
stripePublishableKey
|
|
101
|
-
paypalAccountId?: string;
|
|
78
|
+
stripeAccountId: string;
|
|
79
|
+
stripePublishableKey: string;
|
|
102
80
|
}
|
|
103
81
|
/**
|
|
104
82
|
* @interface
|
|
105
83
|
* @property {number} id - Object identifier.
|
|
106
|
-
* @property {string} updatedDate - Object modification date.
|
|
107
|
-
* @property {number} version - Object modification version number.
|
|
108
84
|
* @property {string} identifier - Text identifier for the recording field.
|
|
109
85
|
* @property {Record<string, any>} localizeInfos - Json description of the payment account object.
|
|
110
86
|
* @property {string} type - Type may be 'stripe', 'paypal' or 'custom'.
|
|
@@ -112,11 +88,9 @@ interface IConnectedEntity {
|
|
|
112
88
|
*/
|
|
113
89
|
interface IAccountsEntity {
|
|
114
90
|
id: number;
|
|
115
|
-
updatedDate: string;
|
|
116
|
-
version: number;
|
|
117
91
|
identifier: string;
|
|
118
92
|
localizeInfos: Record<string, any>;
|
|
119
|
-
type: 'stripe' | '
|
|
93
|
+
type: 'stripe' | 'custom';
|
|
120
94
|
isVisible: boolean;
|
|
121
95
|
}
|
|
122
|
-
export { IAccountsEntity, IConnectedEntity, ISessionEntity, ILineItems,
|
|
96
|
+
export { IAccountsEntity, IConnectedEntity, ISessionEntity, ILineItems, IPaymentsApi, IIntent, ICreateSessionEntity };
|