oneentry 1.0.83 → 1.0.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +476 -442
- package/dist/auth-provider/authProvidersInterfaces.d.ts +1 -1
- package/dist/base/syncModules.js +20 -8
- package/dist/blocks/blocksApi.d.ts +4 -5
- package/dist/blocks/blocksApi.js +14 -14
- package/dist/blocks/blocksInterfaces.d.ts +7 -36
- package/dist/events/eventsApi.d.ts +4 -4
- package/dist/events/eventsApi.js +6 -6
- package/dist/events/eventsInterfaces.d.ts +2 -2
- package/dist/formsData/formsDataApi.d.ts +4 -4
- package/dist/formsData/formsDataApi.js +2 -2
- package/dist/formsData/formsDataInterfaces.d.ts +16 -5
- package/dist/orders/ordersApi.d.ts +4 -4
- package/dist/orders/ordersApi.js +2 -2
- package/dist/orders/ordersInterfaces.d.ts +17 -6
- package/dist/pages/pagesApi.js +21 -8
- package/dist/payments/paymentsApi.d.ts +2 -2
- package/dist/payments/paymentsApi.js +1 -1
- package/dist/payments/paymentsInterfaces.d.ts +9 -5
- package/dist/products/productsApi.d.ts +8 -8
- package/dist/products/productsApi.js +6 -6
- package/dist/products/productsInterfaces.d.ts +21 -17
- package/dist/users/usersApi.d.ts +1 -1
- package/dist/users/usersApi.js +1 -1
- package/package.json +2 -2
package/dist/base/syncModules.js
CHANGED
|
@@ -24,7 +24,10 @@ class SyncModules {
|
|
|
24
24
|
else {
|
|
25
25
|
const normalizeData = {};
|
|
26
26
|
for (let key in data) {
|
|
27
|
-
if (Array.isArray(data[key])
|
|
27
|
+
if (Array.isArray(data[key])) {
|
|
28
|
+
normalizeData[key] = this._normalizeData(data[key], langCode);
|
|
29
|
+
}
|
|
30
|
+
else if (!data[key] || typeof data[key] !== 'object') {
|
|
28
31
|
normalizeData[key] = data[key];
|
|
29
32
|
}
|
|
30
33
|
else if (langCode in data[key]) {
|
|
@@ -48,19 +51,28 @@ class SyncModules {
|
|
|
48
51
|
return data.map(item => this._clearArray(item));
|
|
49
52
|
}
|
|
50
53
|
else {
|
|
51
|
-
const
|
|
54
|
+
const normalizeData = {};
|
|
52
55
|
for (let key in data) {
|
|
53
|
-
if (Array.isArray(data[key])
|
|
54
|
-
|
|
56
|
+
if (Array.isArray(data[key])) {
|
|
57
|
+
normalizeData[key] = this._clearArray(data[key]);
|
|
55
58
|
}
|
|
56
|
-
else if (
|
|
57
|
-
|
|
59
|
+
else if (!data[key] || typeof data[key] !== 'object') {
|
|
60
|
+
normalizeData[key] = data[key];
|
|
61
|
+
}
|
|
62
|
+
else if (key === 'attributeValues') {
|
|
63
|
+
const attrs = data[key];
|
|
64
|
+
for (let attr in attrs) {
|
|
65
|
+
if (attrs[attr].type === 'image' && attrs[attr].value.length === 1) {
|
|
66
|
+
attrs[attr].value = attrs[attr].value[0];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
normalizeData[key] = data[key];
|
|
58
70
|
}
|
|
59
71
|
else {
|
|
60
|
-
|
|
72
|
+
normalizeData[key] = this._clearArray(data[key]);
|
|
61
73
|
}
|
|
62
74
|
}
|
|
63
|
-
return
|
|
75
|
+
return normalizeData;
|
|
64
76
|
}
|
|
65
77
|
}
|
|
66
78
|
_normalizeAttr(data) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import AsyncModules from "../base/asyncModules";
|
|
2
2
|
import { IBlocks, IBlocksResponse, IBlockEntity, ISearchBlock, BlockType } from "./blocksInterfaces";
|
|
3
|
-
import { IProductsEntity } from "../products/productsInterfaces";
|
|
4
3
|
import StateModule from "../base/stateModule";
|
|
5
4
|
/**
|
|
6
5
|
* Controllers for working with blocks
|
|
@@ -19,7 +18,7 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
19
18
|
*
|
|
20
19
|
* @returns Return array of BlocksEntity object.
|
|
21
20
|
*/
|
|
22
|
-
getBlocks(type: BlockType, langCode?: string, offset?: number, limit?: number): Promise<
|
|
21
|
+
getBlocks(type: BlockType, langCode?: string, offset?: number, limit?: number): Promise<IBlocksResponse>;
|
|
23
22
|
/**
|
|
24
23
|
* Get block by marker.
|
|
25
24
|
*
|
|
@@ -28,7 +27,7 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
28
27
|
*
|
|
29
28
|
* @returns Return BlocksEntity object.
|
|
30
29
|
*/
|
|
31
|
-
getBlockByMarker(marker: string, langCode?: string): Promise<IBlockEntity>;
|
|
30
|
+
getBlockByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IBlockEntity>;
|
|
32
31
|
/**
|
|
33
32
|
* Get similar products by block marker.
|
|
34
33
|
*
|
|
@@ -39,7 +38,7 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
39
38
|
*
|
|
40
39
|
* @returns Return array of BlocksEntity object.
|
|
41
40
|
*/
|
|
42
|
-
getSimilarProducts
|
|
41
|
+
private getSimilarProducts;
|
|
43
42
|
/**
|
|
44
43
|
* Get products by block marker.
|
|
45
44
|
*
|
|
@@ -50,7 +49,7 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
|
50
49
|
*
|
|
51
50
|
* @returns Return array of BlocksEntity object.
|
|
52
51
|
*/
|
|
53
|
-
getProductsByBlockMarker
|
|
52
|
+
private getProductsByBlockMarker;
|
|
54
53
|
/**
|
|
55
54
|
* Quick search for block objects with limited output
|
|
56
55
|
* @param name - Search string
|
package/dist/blocks/blocksApi.js
CHANGED
|
@@ -22,14 +22,14 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
22
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
|
-
const normalizeResponse = this._normalizeData(response
|
|
26
|
-
await Promise.all(normalizeResponse.map(async (block) => {
|
|
25
|
+
const normalizeResponse = this._normalizeData(response);
|
|
26
|
+
await Promise.all(normalizeResponse.items.map(async (block) => {
|
|
27
27
|
const customSettings = block.customSettings;
|
|
28
28
|
if (customSettings && customSettings.hasOwnProperty('productConfig')) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
if (customSettings.productConfig.countElementsPerRow)
|
|
30
|
+
block.countElementsPerRow = +customSettings.productConfig.countElementsPerRow;
|
|
31
|
+
if (customSettings.productConfig.quantity)
|
|
32
|
+
block.quantity = +customSettings.productConfig.quantity;
|
|
33
33
|
}
|
|
34
34
|
delete block.customSettings;
|
|
35
35
|
delete block.attributesSetIdentifier;
|
|
@@ -57,7 +57,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
57
57
|
}));
|
|
58
58
|
return this._normalizeData(normalizeResponse);
|
|
59
59
|
}
|
|
60
|
-
return this._normalizeData(response
|
|
60
|
+
return this._normalizeData(response);
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Get block by marker.
|
|
@@ -67,15 +67,15 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
67
67
|
*
|
|
68
68
|
* @returns Return BlocksEntity object.
|
|
69
69
|
*/
|
|
70
|
-
async getBlockByMarker(marker, langCode = this.state.lang) {
|
|
70
|
+
async getBlockByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
71
71
|
const response = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
72
72
|
const normalizeResponse = this._normalizeData(response);
|
|
73
73
|
const customSettings = normalizeResponse.customSettings;
|
|
74
74
|
if (customSettings && customSettings.hasOwnProperty('productConfig')) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
if (customSettings.productConfig.countElementsPerRow)
|
|
76
|
+
customSettings.countElementsPerRow = +customSettings.productConfig.countElementsPerRow;
|
|
77
|
+
if (customSettings.productConfig.quantity)
|
|
78
|
+
customSettings.quantity = +customSettings.productConfig.quantity;
|
|
79
79
|
}
|
|
80
80
|
delete normalizeResponse.customSettings;
|
|
81
81
|
delete normalizeResponse.attributesSetIdentifier;
|
|
@@ -83,7 +83,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
83
83
|
if (this.state.multipleResponse) {
|
|
84
84
|
if (normalizeResponse.type === 'forSimilarProductBlock') {
|
|
85
85
|
try {
|
|
86
|
-
await this.getSimilarProducts(normalizeResponse.identifier, langCode).then((result) => {
|
|
86
|
+
await this.getSimilarProducts(normalizeResponse.identifier, langCode, offset, limit).then((result) => {
|
|
87
87
|
normalizeResponse.similarProducts = result;
|
|
88
88
|
});
|
|
89
89
|
}
|
|
@@ -93,7 +93,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
93
93
|
}
|
|
94
94
|
else if (normalizeResponse.type === 'forProductBlock') {
|
|
95
95
|
try {
|
|
96
|
-
await this.getProductsByBlockMarker(normalizeResponse.identifier, langCode).then((result) => {
|
|
96
|
+
await this.getProductsByBlockMarker(normalizeResponse.identifier, langCode, offset, limit).then((result) => {
|
|
97
97
|
normalizeResponse.products = result;
|
|
98
98
|
});
|
|
99
99
|
}
|
|
@@ -9,28 +9,13 @@ 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?: string, offset?: number, limit?: number): Promise<
|
|
13
|
-
getBlockByMarker(marker: string, langCode: string): Promise<IBlockEntity>;
|
|
14
|
-
getSimilarProducts(marker: string, langCode?: string, offset?: number, limit?: number): Promise<Array<IProductsEntity>>;
|
|
15
|
-
getProductsByBlockMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<Array<IProductsEntity>>;
|
|
12
|
+
getBlocks(type: BlockType, langCode?: string, offset?: number, limit?: number): Promise<IBlocksResponse>;
|
|
13
|
+
getBlockByMarker(marker: string, langCode: string, offset?: number, limit?: number): Promise<IBlockEntity>;
|
|
16
14
|
searchBlock(name: string, langCode?: string): Promise<Array<ISearchBlock>>;
|
|
17
15
|
}
|
|
18
16
|
interface IBlocksResponse {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
localizeInfos: Record<string, any>;
|
|
22
|
-
customSettings: ICustomSetting | null;
|
|
23
|
-
version: number;
|
|
24
|
-
identifier: string;
|
|
25
|
-
isVisible: boolean;
|
|
26
|
-
position: number;
|
|
27
|
-
attributeValues: Record<string, any>;
|
|
28
|
-
type: string;
|
|
29
|
-
templateIdentifier: string | null;
|
|
30
|
-
countElementsPerRow?: number;
|
|
31
|
-
productPageUrls: Array<any>;
|
|
32
|
-
similarProducts?: Array<IProductsEntity>;
|
|
33
|
-
products?: Array<IProductsEntity>;
|
|
17
|
+
total: number;
|
|
18
|
+
items: Array<IBlockEntity>;
|
|
34
19
|
}
|
|
35
20
|
interface IBlockEntity {
|
|
36
21
|
attributeValues: Record<string, any>;
|
|
@@ -42,24 +27,10 @@ interface IBlockEntity {
|
|
|
42
27
|
templateIdentifier: string | null;
|
|
43
28
|
type: string;
|
|
44
29
|
version: number;
|
|
30
|
+
countElementsPerRow?: number;
|
|
31
|
+
quantity?: number;
|
|
45
32
|
similarProducts?: Array<IProductsEntity>;
|
|
46
33
|
products?: Array<IProductsEntity>;
|
|
47
|
-
countElementsPerRow: number;
|
|
48
|
-
}
|
|
49
|
-
interface ICustomSetting {
|
|
50
|
-
sliderDelay: number;
|
|
51
|
-
sliderDelayType: string;
|
|
52
|
-
productQuantity: number;
|
|
53
|
-
productSortType: string;
|
|
54
|
-
productSortOrder: string;
|
|
55
|
-
productCountElementsPerRow: number;
|
|
56
|
-
similarProductRules: Array<{
|
|
57
|
-
property: string;
|
|
58
|
-
includes: string;
|
|
59
|
-
keywords: string;
|
|
60
|
-
strict: string;
|
|
61
|
-
}> | Record<string, any>;
|
|
62
|
-
[key: string]: any;
|
|
63
34
|
}
|
|
64
35
|
interface ISearchBlock {
|
|
65
36
|
id: number;
|
|
@@ -67,4 +38,4 @@ interface ISearchBlock {
|
|
|
67
38
|
identifier: string;
|
|
68
39
|
}
|
|
69
40
|
type BlockType = 'forCatalogProducts' | 'forBasketPage' | 'forErrorPage' | 'forCatalogPages' | 'forProductPreview' | 'forProductPage' | 'forSimilarProductBlock' | 'forStatisticProductBlock' | 'forProductBlock' | 'forForm' | 'forFormField' | 'forNewsPage' | 'forNewsBlock' | 'forNewsPreview' | 'forOneNewsPage' | 'forUsualPage' | 'forTextBlock' | 'forSlider' | 'forOrder' | 'service' | 'none';
|
|
70
|
-
export { IBlocks, IBlockEntity, IBlocksResponse,
|
|
41
|
+
export { IBlocks, IBlockEntity, IBlocksResponse, ISearchBlock, BlockType };
|
|
@@ -13,17 +13,17 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
13
13
|
*
|
|
14
14
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
15
15
|
* @param marker - Event marker.
|
|
16
|
-
* @param
|
|
16
|
+
* @param langCode - Language code.
|
|
17
17
|
* @param productId - Product id.
|
|
18
18
|
*/
|
|
19
|
-
subscribeByMarker(marker: string,
|
|
19
|
+
subscribeByMarker(marker: string, productId: number, langCode?: string): Promise<any>;
|
|
20
20
|
/**
|
|
21
21
|
* Unsubscribing to an event on a product.
|
|
22
22
|
*
|
|
23
23
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
24
24
|
* @param marker - Event marker.
|
|
25
|
-
* @param
|
|
25
|
+
* @param langCode - Language code.
|
|
26
26
|
* @param productId - Product id.
|
|
27
27
|
*/
|
|
28
|
-
unsubscribeByMarker(marker: string,
|
|
28
|
+
unsubscribeByMarker(marker: string, productId: number, langCode?: string): Promise<any>;
|
|
29
29
|
}
|
package/dist/events/eventsApi.js
CHANGED
|
@@ -14,12 +14,12 @@ class EventsApi extends asyncModules_1.default {
|
|
|
14
14
|
*
|
|
15
15
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
16
16
|
* @param marker - Event marker.
|
|
17
|
-
* @param
|
|
17
|
+
* @param langCode - Language code.
|
|
18
18
|
* @param productId - Product id.
|
|
19
19
|
*/
|
|
20
|
-
async subscribeByMarker(marker,
|
|
20
|
+
async subscribeByMarker(marker, productId, langCode = this.state.lang) {
|
|
21
21
|
const result = await this._fetchPost(`/subscribe/marker/${marker}`, {
|
|
22
|
-
"
|
|
22
|
+
"locale": langCode,
|
|
23
23
|
"productId": productId
|
|
24
24
|
});
|
|
25
25
|
return result;
|
|
@@ -29,12 +29,12 @@ class EventsApi extends asyncModules_1.default {
|
|
|
29
29
|
*
|
|
30
30
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
31
31
|
* @param marker - Event marker.
|
|
32
|
-
* @param
|
|
32
|
+
* @param langCode - Language code.
|
|
33
33
|
* @param productId - Product id.
|
|
34
34
|
*/
|
|
35
|
-
async unsubscribeByMarker(marker,
|
|
35
|
+
async unsubscribeByMarker(marker, productId, langCode = this.state.lang) {
|
|
36
36
|
const result = await this._fetchDelete('', {
|
|
37
|
-
"
|
|
37
|
+
"locale": langCode,
|
|
38
38
|
"productId": productId
|
|
39
39
|
});
|
|
40
40
|
return result;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @property {function} unsubscribeByMarker - Unsubscribing to an event on a product.
|
|
6
6
|
*/
|
|
7
7
|
interface IEvents {
|
|
8
|
-
subscribeByMarker(marker: string,
|
|
9
|
-
unsubscribeByMarker(marker: string,
|
|
8
|
+
subscribeByMarker(marker: string, productId: number, langCode: string): Promise<any>;
|
|
9
|
+
unsubscribeByMarker(marker: string, productId: number, langCode: string): Promise<any>;
|
|
10
10
|
}
|
|
11
11
|
export { IEvents };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import AsyncModules from '../base/asyncModules';
|
|
2
|
-
import { IFormsPost, IFormsData, IFormsDataEntity } from './formsDataInterfaces';
|
|
2
|
+
import { IFormsPost, IFormsData, IFormsDataEntity, IFormDataEntity } from './formsDataInterfaces';
|
|
3
3
|
import StateModule from "../base/stateModule";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with form data
|
|
@@ -17,7 +17,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
|
|
|
17
17
|
*
|
|
18
18
|
* @returns Returns array for all objects of FormData
|
|
19
19
|
*/
|
|
20
|
-
getFormsData(langCode?: string, offset?: number, limit?: number): Promise<
|
|
20
|
+
getFormsData(langCode?: string, offset?: number, limit?: number): Promise<IFormsDataEntity>;
|
|
21
21
|
/**
|
|
22
22
|
* Find all product page objects with pagination and multiple filtering.
|
|
23
23
|
*
|
|
@@ -36,7 +36,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
|
|
|
36
36
|
*
|
|
37
37
|
* @returns - Returns created FormData objects.
|
|
38
38
|
*/
|
|
39
|
-
postFormsData(data: IFormsPost, langCode?: string): Promise<
|
|
39
|
+
postFormsData(data: IFormsPost, langCode?: string): Promise<IFormDataEntity>;
|
|
40
40
|
/**
|
|
41
41
|
* Get one object of form data by marker.
|
|
42
42
|
*
|
|
@@ -47,5 +47,5 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
|
|
|
47
47
|
*
|
|
48
48
|
* @returns Returns array of object FormDataEntity
|
|
49
49
|
*/
|
|
50
|
-
getFormsDataByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<
|
|
50
|
+
getFormsDataByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IFormsDataEntity>;
|
|
51
51
|
}
|
|
@@ -20,7 +20,7 @@ class FormsDataApi extends asyncModules_1.default {
|
|
|
20
20
|
*/
|
|
21
21
|
async getFormsData(langCode = this.state.lang, offset = 0, limit = 30) {
|
|
22
22
|
const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
23
|
-
return this._dataPostProcess(result
|
|
23
|
+
return this._dataPostProcess(result, langCode);
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Find all product page objects with pagination and multiple filtering.
|
|
@@ -59,7 +59,7 @@ class FormsDataApi extends asyncModules_1.default {
|
|
|
59
59
|
*/
|
|
60
60
|
async getFormsDataByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
61
61
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
62
|
-
return this._dataPostProcess(result
|
|
62
|
+
return this._dataPostProcess(result, langCode);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
exports.default = FormsDataApi;
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* @property {function} getFormsDataByMarker - Get one object of form data by marker.
|
|
7
7
|
*/
|
|
8
8
|
interface IFormsData {
|
|
9
|
-
getFormsData(langCode: string, offset?: number, limit?: number): Promise<
|
|
10
|
-
postFormsData(data: IFormsPost, langCode?: string): Promise<
|
|
11
|
-
getFormsDataByMarker(marker: string, langCode: string, offset?: number, limit?: number): Promise<
|
|
9
|
+
getFormsData(langCode: string, offset?: number, limit?: number): Promise<IFormsDataEntity>;
|
|
10
|
+
postFormsData(data: IFormsPost, langCode?: string): Promise<IFormDataEntity>;
|
|
11
|
+
getFormsDataByMarker(marker: string, langCode: string, offset?: number, limit?: number): Promise<IFormsDataEntity>;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Represents a form data.
|
|
@@ -20,13 +20,24 @@ interface IFormsData {
|
|
|
20
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
|
-
interface
|
|
23
|
+
interface IFormDataEntity {
|
|
24
24
|
id: number;
|
|
25
25
|
formIdentifier: string;
|
|
26
26
|
time: Date | string;
|
|
27
27
|
formData: IFormsPost;
|
|
28
28
|
attributeSetIdentifier?: string;
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Represents a form data.
|
|
32
|
+
*
|
|
33
|
+
* @interface
|
|
34
|
+
* @property {number} total - Total number of found records.
|
|
35
|
+
* @property {Array<IFormDataEntity>} items
|
|
36
|
+
*/
|
|
37
|
+
interface IFormsDataEntity {
|
|
38
|
+
total: number;
|
|
39
|
+
items: Array<IFormDataEntity>;
|
|
40
|
+
}
|
|
30
41
|
/**
|
|
31
42
|
* Contains an array of data form objects with the following values
|
|
32
43
|
*/
|
|
@@ -161,4 +172,4 @@ interface IBodyTypeRadioButtonList {
|
|
|
161
172
|
};
|
|
162
173
|
}>;
|
|
163
174
|
}
|
|
164
|
-
export { IFormsPost, IFormsData, FormDataType, IFormsDataEntity, IBodyTypeStringNumberFloat, IBodyTypeTimeDate, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeImageGroupOfImages, IBodyTypeFile, IBodyTypeRadioButtonList };
|
|
175
|
+
export { IFormsPost, IFormsData, FormDataType, IFormsDataEntity, IFormDataEntity, IBodyTypeStringNumberFloat, IBodyTypeTimeDate, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeImageGroupOfImages, IBodyTypeFile, IBodyTypeRadioButtonList };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import AsyncModules from "../base/asyncModules";
|
|
2
|
-
import { IOrdersApi, IOrdersEntity, IBaseOrdersEntity, IOrderData,
|
|
2
|
+
import { IOrdersApi, IOrdersEntity, IBaseOrdersEntity, IOrderData, IOrdersByMarkerEntity, IOrderByMarkerEntity } from "./ordersInterfaces";
|
|
3
3
|
import StateModule from "../base/stateModule";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with orders
|
|
@@ -46,7 +46,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
46
46
|
* @param {number} [limit] Limit parameter. Default 30
|
|
47
47
|
* @param {number} [offset] Offset parameter. Default 0
|
|
48
48
|
*/
|
|
49
|
-
getAllOrdersByMarker(marker: string, langCode?: string, limit?: number, offset?: number): Promise<
|
|
49
|
+
getAllOrdersByMarker(marker: string, langCode?: string, limit?: number, offset?: number): Promise<IOrdersByMarkerEntity>;
|
|
50
50
|
/**
|
|
51
51
|
* Changing an order in the orders storage
|
|
52
52
|
*
|
|
@@ -83,7 +83,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
83
83
|
* @param langCode Optional language field
|
|
84
84
|
*
|
|
85
85
|
*/
|
|
86
|
-
getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<
|
|
86
|
+
getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<IOrderByMarkerEntity>;
|
|
87
87
|
/**
|
|
88
88
|
* Getting all the order storage objects
|
|
89
89
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
@@ -92,7 +92,7 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
92
92
|
* @param {number} [limit] - Optional parameter for pagination, default is 0
|
|
93
93
|
* @param {number} [offset] - Optional parameter for pagination, default is 30
|
|
94
94
|
*/
|
|
95
|
-
|
|
95
|
+
getAllOrdersStorage(langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersEntity>>;
|
|
96
96
|
/**
|
|
97
97
|
* Retrieve one order storage object by marker.
|
|
98
98
|
*
|
package/dist/orders/ordersApi.js
CHANGED
|
@@ -55,7 +55,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
55
55
|
*/
|
|
56
56
|
async getAllOrdersByMarker(marker, langCode = this.state.lang, limit = 30, offset = 0) {
|
|
57
57
|
const result = await this._fetchGet(`/marker/${marker}/orders?langCode=${langCode}&limit=${limit}&offset=${offset}`);
|
|
58
|
-
return this._normalizeData(result
|
|
58
|
+
return this._normalizeData(result);
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Changing an order in the orders storage
|
|
@@ -111,7 +111,7 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
111
111
|
* @param {number} [limit] - Optional parameter for pagination, default is 0
|
|
112
112
|
* @param {number} [offset] - Optional parameter for pagination, default is 30
|
|
113
113
|
*/
|
|
114
|
-
async
|
|
114
|
+
async getAllOrdersStorage(langCode = this.state.lang, limit = 30, offset = 0) {
|
|
115
115
|
const result = await this._fetchGet(`?langCode=${langCode}&limit=${limit}&offset=${offset}`);
|
|
116
116
|
return this._normalizeData(result);
|
|
117
117
|
}
|
|
@@ -11,12 +11,23 @@
|
|
|
11
11
|
|
|
12
12
|
*/
|
|
13
13
|
interface IOrdersApi {
|
|
14
|
-
getOrderByMarker(marker: string, langCode?: string): Promise<IOrdersEntity>;
|
|
15
14
|
createOrder(marker: string, data: IOrderData): Promise<IBaseOrdersEntity>;
|
|
15
|
+
getAllOrdersByMarker(marker: string, langCode?: string, limit?: number, offset?: number): Promise<IOrdersByMarkerEntity>;
|
|
16
|
+
getOrderByMarker(marker: string, langCode?: string): Promise<IOrdersEntity>;
|
|
16
17
|
updateOrderByMarkerAndId(marker: string, id: number, data: IOrderData, langCode?: string): Promise<IBaseOrdersEntity>;
|
|
17
|
-
getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<IOrderByMarkerEntity>;
|
|
19
|
+
getAllOrdersStorage(langCode?: string, limit?: number, offset?: number): Promise<Array<IOrdersEntity>>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Represents a form data.
|
|
23
|
+
*
|
|
24
|
+
* @interface
|
|
25
|
+
* @property {number} total - Total number of found records.
|
|
26
|
+
* @property {Array<IOrderByMarkerEntity>} items
|
|
27
|
+
*/
|
|
28
|
+
interface IOrdersByMarkerEntity {
|
|
29
|
+
total: number;
|
|
30
|
+
items: Array<IOrderByMarkerEntity>;
|
|
20
31
|
}
|
|
21
32
|
/**
|
|
22
33
|
* @property {string} filename
|
|
@@ -129,7 +140,7 @@ interface IOrderData {
|
|
|
129
140
|
* @property {Record<string, any>} paymentAccountLocalizeInfos - Payment account name considering localization.
|
|
130
141
|
* @property {boolean} isHistory - Indicates that the order has been saved in the order history.
|
|
131
142
|
*/
|
|
132
|
-
interface
|
|
143
|
+
interface IOrderByMarkerEntity {
|
|
133
144
|
attributeSetIdentifier?: string;
|
|
134
145
|
statusIdentifier: string;
|
|
135
146
|
formIdentifier: string;
|
|
@@ -143,4 +154,4 @@ interface IOrdersByMarkersEntity {
|
|
|
143
154
|
isHistory: boolean;
|
|
144
155
|
id: number;
|
|
145
156
|
}
|
|
146
|
-
export { IOrdersEntity, IBaseOrdersEntity, IOrderProducts, IPicture, IOrdersApi, IOrderData, IOrderProductData, IOrdersFormData,
|
|
157
|
+
export { IOrdersEntity, IBaseOrdersEntity, IOrderProducts, IPicture, IOrdersApi, IOrderData, IOrderProductData, IOrdersFormData, IOrdersByMarkerEntity, IPaymentAccountIdentifiers, IOrderByMarkerEntity };
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const asyncModules_1 = require("../base/asyncModules");
|
|
4
|
-
const blocksApi_1 = require("../blocks/blocksApi");
|
|
5
4
|
/**
|
|
6
5
|
* Controllers for working with page objects, including catalog pages
|
|
7
6
|
*/
|
|
@@ -99,20 +98,34 @@ class PageApi extends asyncModules_1.default {
|
|
|
99
98
|
normalizeResponse.map((item) => {
|
|
100
99
|
const customSettings = item.customSettings;
|
|
101
100
|
if (customSettings && customSettings.hasOwnProperty('productConfig')) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
if (customSettings.productConfig.countElementsPerRow)
|
|
102
|
+
item.countElementsPerRow = +customSettings.productConfig.countElementsPerRow;
|
|
103
|
+
if (customSettings.productConfig.quantity)
|
|
104
|
+
item.quantity = +customSettings.productConfig.quantity;
|
|
106
105
|
}
|
|
107
106
|
delete item.customSettings;
|
|
108
107
|
delete item.attributesSetIdentifier;
|
|
109
108
|
return item;
|
|
110
109
|
});
|
|
111
110
|
if (this.state.multipleResponse) {
|
|
112
|
-
|
|
111
|
+
class StaffModule extends asyncModules_1.default {
|
|
112
|
+
constructor(state) {
|
|
113
|
+
super(state);
|
|
114
|
+
this._url = state.url + '/api/content/blocks';
|
|
115
|
+
}
|
|
116
|
+
async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
117
|
+
const result = await this._fetchGet(`/${marker}/similar-products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
118
|
+
return this._normalizeData(result.items);
|
|
119
|
+
}
|
|
120
|
+
async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
121
|
+
const result = await this._fetchGet(`/${marker}/products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
122
|
+
return this._normalizeData(result.items);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const staffModule = new StaffModule(this.state);
|
|
113
126
|
if (normalizeResponse.type === 'forSimilarProductBlock') {
|
|
114
127
|
try {
|
|
115
|
-
await
|
|
128
|
+
await staffModule.getSimilarProducts(normalizeResponse.identifier, langCode).then((result) => {
|
|
116
129
|
normalizeResponse.similarProducts = this._normalizeData(result);
|
|
117
130
|
});
|
|
118
131
|
}
|
|
@@ -122,7 +135,7 @@ class PageApi extends asyncModules_1.default {
|
|
|
122
135
|
}
|
|
123
136
|
else if (normalizeResponse.type === 'forProductBlock') {
|
|
124
137
|
try {
|
|
125
|
-
await
|
|
138
|
+
await staffModule.getProductsByBlockMarker(normalizeResponse.identifier, langCode).then((result) => {
|
|
126
139
|
normalizeResponse.products = this._normalizeData(result);
|
|
127
140
|
});
|
|
128
141
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import AsyncModules from "../base/asyncModules";
|
|
2
|
-
import { IPaymentsApi, ISessionEntity, IConnectedEntity, IAccountsEntity, ICreateSessionEntity } from "./paymentsInterfaces";
|
|
2
|
+
import { IPaymentsApi, ISessionEntity, IConnectedEntity, IAccountsEntity, ICreateSessionEntity, ISessionsEntity } from "./paymentsInterfaces";
|
|
3
3
|
import StateModule from "../base/stateModule";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with payments
|
|
@@ -17,7 +17,7 @@ export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
|
|
|
17
17
|
*
|
|
18
18
|
* @returns Returns an array of SessionEntity objects.
|
|
19
19
|
*/
|
|
20
|
-
getSessions(limit?: number, offset?: number): Promise<
|
|
20
|
+
getSessions(limit?: number, offset?: number): Promise<ISessionsEntity>;
|
|
21
21
|
/**
|
|
22
22
|
* Get a single payment session object by its identifier.
|
|
23
23
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
@@ -20,7 +20,7 @@ class PaymentsApi extends asyncModules_1.default {
|
|
|
20
20
|
*/
|
|
21
21
|
async getSessions(limit = 30, offset = 0) {
|
|
22
22
|
const result = await this._fetchGet('/sessions');
|
|
23
|
-
return result
|
|
23
|
+
return result;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Get a single payment session object by its identifier.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* @property {function} setAccessToken - Only for custom authorization. An intermediate method for setting up an access token.
|
|
12
12
|
*/
|
|
13
13
|
interface IPaymentsApi {
|
|
14
|
-
getSessions(limit: number, offset: number): Promise<
|
|
14
|
+
getSessions(limit: number, offset: number): Promise<ISessionsEntity>;
|
|
15
15
|
getSessionById(id: number): Promise<ISessionEntity>;
|
|
16
16
|
createSession(orderId: number, type: 'session' | 'intent', automaticTaxEnabled?: boolean): Promise<ICreateSessionEntity>;
|
|
17
17
|
getConnected(): Promise<IConnectedEntity | null>;
|
|
@@ -19,6 +19,10 @@ interface IPaymentsApi {
|
|
|
19
19
|
getAccountById(id: number): Promise<IAccountsEntity>;
|
|
20
20
|
webhookStripe(): Promise<boolean>;
|
|
21
21
|
}
|
|
22
|
+
interface ISessionsEntity {
|
|
23
|
+
total: number;
|
|
24
|
+
items: ISessionEntity;
|
|
25
|
+
}
|
|
22
26
|
/**
|
|
23
27
|
*
|
|
24
28
|
* @interface
|
|
@@ -28,7 +32,7 @@ interface IPaymentsApi {
|
|
|
28
32
|
* @property {string} name - Name.
|
|
29
33
|
* @property {string} description - Description.
|
|
30
34
|
*/
|
|
31
|
-
interface
|
|
35
|
+
interface ISessionEntity {
|
|
32
36
|
quantity: number;
|
|
33
37
|
amount: number;
|
|
34
38
|
currency: string;
|
|
@@ -55,7 +59,7 @@ interface IIntent {
|
|
|
55
59
|
* @property {string} paymentUrl - Payment link.
|
|
56
60
|
* @property {string} clientSecret - Client secret key.
|
|
57
61
|
*/
|
|
58
|
-
interface
|
|
62
|
+
interface ISessionItem {
|
|
59
63
|
id: number;
|
|
60
64
|
updatedDate: string;
|
|
61
65
|
type: 'session' | 'intent';
|
|
@@ -86,7 +90,7 @@ interface IConnectedEntity {
|
|
|
86
90
|
* @property {number} id - Object identifier.
|
|
87
91
|
* @property {string} identifier - Text identifier for the recording field.
|
|
88
92
|
* @property {Record<string, any>} localizeInfos - Json description of the payment account object.
|
|
89
|
-
* @property {
|
|
93
|
+
* @property {'stripe' | 'custom'} type - Type may be 'stripe' or 'custom'.
|
|
90
94
|
* @property {boolean} isVisible - Visibility indicator of the payment account.
|
|
91
95
|
*/
|
|
92
96
|
interface IAccountsEntity {
|
|
@@ -96,4 +100,4 @@ interface IAccountsEntity {
|
|
|
96
100
|
type: 'stripe' | 'custom';
|
|
97
101
|
isVisible: boolean;
|
|
98
102
|
}
|
|
99
|
-
export { IAccountsEntity, IConnectedEntity,
|
|
103
|
+
export { IAccountsEntity, IConnectedEntity, ISessionsEntity, ISessionItem, ISessionEntity, IPaymentsApi, IIntent, ICreateSessionEntity };
|