oneentry 1.0.54 → 1.0.56
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 +4 -4
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +8 -7
- package/dist/blocks/blocksApi.js +40 -14
- package/dist/blocks/blocksInterfaces.d.ts +1 -1
- package/dist/forms/formsInterfaces.d.ts +1 -1
- package/dist/menus/menusInterfaces.d.ts +1 -1
- package/dist/products/productsInterfaces.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,11 +65,11 @@ You can get a token as follows
|
|
|
65
65
|
5) Log in to the project, go to the settings section and open the token tab
|
|
66
66
|
6) Get and copy the token of your project
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
You can also connect a tls certificate to protect your project. In this case, do not pass the "token" at all. When using the certificate, set up a proxy in your project. Pass an empty string as an url parameter.
|
|
69
69
|
[Learn more about security](https://oneentry.ru/instructions.html#START)
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
```js
|
|
72
|
+
```js
|
|
73
73
|
const api = defineOneEntry('your-url', {token: 'my-token', langCode:'my-langCode'})
|
|
74
74
|
```
|
|
75
75
|
Now you can use the following links to jump to specific entries:
|
|
@@ -560,7 +560,7 @@ example: null <br>
|
|
|
560
560
|
</details>
|
|
561
561
|
---
|
|
562
562
|
|
|
563
|
-
|
|
563
|
+
### Blocks.getSimilarProducts(marker, langCode, offset, limit)
|
|
564
564
|
|
|
565
565
|
|
|
566
566
|
```js
|
|
@@ -607,7 +607,7 @@ Example return:
|
|
|
607
607
|
|
|
608
608
|
|
|
609
609
|
|
|
610
|
-
|
|
610
|
+
### Blocks.getSimilarProducts(marker, langCode, offset, limit)
|
|
611
611
|
|
|
612
612
|
```js
|
|
613
613
|
const value = await Blocks.getProductsByBlockMarker('my-marker', 'en_US')
|
|
@@ -10,6 +10,13 @@ interface IAttributesSets {
|
|
|
10
10
|
getAttributesByMarker(marker: string, langCode: string): Promise<Array<IAttributesSetsEntity>>;
|
|
11
11
|
getSingleAttributeByMarkerSet(attributeMarker: string, setMarker: string, langCode: string): Promise<IAttributesSetsEntity>;
|
|
12
12
|
}
|
|
13
|
+
interface IListTitle {
|
|
14
|
+
title: string;
|
|
15
|
+
value: number | string;
|
|
16
|
+
position: string | number | null;
|
|
17
|
+
extendedValue: string | number | null;
|
|
18
|
+
extendedValueType: string | number | null;
|
|
19
|
+
}
|
|
13
20
|
/**
|
|
14
21
|
* Represents a template entity object.
|
|
15
22
|
*
|
|
@@ -35,12 +42,6 @@ interface IAttributesSetsEntity {
|
|
|
35
42
|
};
|
|
36
43
|
};
|
|
37
44
|
localizeInfos: Record<string, any>;
|
|
38
|
-
listTitles: Array<
|
|
39
|
-
title: string;
|
|
40
|
-
value: number | string;
|
|
41
|
-
position: string | number | null;
|
|
42
|
-
extendedValue: string | number | null;
|
|
43
|
-
extendedValueType: string | number | null;
|
|
44
|
-
}> | Record<string, any>;
|
|
45
|
+
listTitles: Array<IListTitle> | Record<string, any>;
|
|
45
46
|
}
|
|
46
47
|
export { IAttributesSets, IAttributesSetsEntity };
|
package/dist/blocks/blocksApi.js
CHANGED
|
@@ -23,21 +23,34 @@ class BlocksApi extends oneEntry_1.default {
|
|
|
23
23
|
const normalizeResponse = this._normalizeData(response);
|
|
24
24
|
await Promise.all(normalizeResponse.map(async (block) => {
|
|
25
25
|
const customSettings = block.customSettings;
|
|
26
|
-
if (customSettings.hasOwnProperty('productConfig')) {
|
|
26
|
+
if (customSettings && customSettings.hasOwnProperty('productConfig')) {
|
|
27
27
|
block.countElementsPerRow = customSettings.productConfig.countElementsPerRow ? (+customSettings.productConfig.countElementsPerRow) : 0;
|
|
28
28
|
}
|
|
29
|
+
else {
|
|
30
|
+
block.countElementsPerRow = 0;
|
|
31
|
+
}
|
|
29
32
|
delete block.customSettings;
|
|
30
33
|
delete block.attributeSetId;
|
|
31
34
|
delete block.productPageUrls;
|
|
32
35
|
if (block.type === 'forSimilarProductBlock') {
|
|
33
|
-
|
|
34
|
-
block.
|
|
35
|
-
|
|
36
|
+
try {
|
|
37
|
+
await this.getSimilarProducts(block.identifier, langCode, offset, limit).then((result) => {
|
|
38
|
+
block.similarProducts = result;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
block.similarProducts = [];
|
|
43
|
+
}
|
|
36
44
|
}
|
|
37
45
|
else if (block.type === 'forProductBlock') {
|
|
38
|
-
|
|
39
|
-
block.
|
|
40
|
-
|
|
46
|
+
try {
|
|
47
|
+
await this.getProductsByBlockMarker(block.identifier, langCode, offset, limit).then((result) => {
|
|
48
|
+
block.products = result;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
block.products = [];
|
|
53
|
+
}
|
|
41
54
|
}
|
|
42
55
|
}));
|
|
43
56
|
return normalizeResponse;
|
|
@@ -54,21 +67,34 @@ class BlocksApi extends oneEntry_1.default {
|
|
|
54
67
|
const response = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
55
68
|
const normalizeResponse = this._normalizeData(response);
|
|
56
69
|
const customSettings = normalizeResponse.customSettings;
|
|
57
|
-
if (customSettings.hasOwnProperty('productConfig')) {
|
|
70
|
+
if (customSettings && customSettings.hasOwnProperty('productConfig')) {
|
|
58
71
|
normalizeResponse.countElementsPerRow = customSettings.productConfig.countElementsPerRow ? (+customSettings.productConfig.countElementsPerRow) : 0;
|
|
59
72
|
}
|
|
73
|
+
else {
|
|
74
|
+
normalizeResponse.countElementsPerRow = 0;
|
|
75
|
+
}
|
|
60
76
|
delete normalizeResponse.customSettings;
|
|
61
77
|
delete normalizeResponse.attributeSetId;
|
|
62
78
|
delete normalizeResponse.productPageUrls;
|
|
63
79
|
if (normalizeResponse.type === 'forSimilarProductBlock') {
|
|
64
|
-
|
|
65
|
-
normalizeResponse.
|
|
66
|
-
|
|
80
|
+
try {
|
|
81
|
+
await this.getSimilarProducts(normalizeResponse.identifier, langCode).then((result) => {
|
|
82
|
+
normalizeResponse.similarProducts = result;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
normalizeResponse.similarProducts = [];
|
|
87
|
+
}
|
|
67
88
|
}
|
|
68
89
|
else if (normalizeResponse.type === 'forProductBlock') {
|
|
69
|
-
|
|
70
|
-
normalizeResponse.
|
|
71
|
-
|
|
90
|
+
try {
|
|
91
|
+
await this.getProductsByBlockMarker(normalizeResponse.identifier, langCode).then((result) => {
|
|
92
|
+
normalizeResponse.products = result;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
normalizeResponse.products = [];
|
|
97
|
+
}
|
|
72
98
|
}
|
|
73
99
|
return normalizeResponse;
|
|
74
100
|
}
|
|
@@ -70,7 +70,7 @@ interface IProductsQuery {
|
|
|
70
70
|
* @property {number | null} conditionValue - The value that is being searched for, default null.
|
|
71
71
|
* @property {string | null} conditionMarker - Id of the filter condition by which the values are filtered, default null.
|
|
72
72
|
* @property {string | null} attributeMarker - The text identifier of the indexed attribute by which values are filtered, default null.
|
|
73
|
-
* @property {
|
|
73
|
+
* @property {Array<string> | null} pageUrl - Url of the category page object.
|
|
74
74
|
*/
|
|
75
75
|
interface IFilterParams {
|
|
76
76
|
attributeMarker: string;
|
|
@@ -86,7 +86,7 @@ interface IFilterParams {
|
|
|
86
86
|
*/
|
|
87
87
|
conditionMarker?: 'in' | 'nin' | 'eq' | 'neq' | 'mth' | 'lth' | 'exs' | 'nexs' | null;
|
|
88
88
|
conditionValue: number | string | null;
|
|
89
|
-
|
|
89
|
+
pageUrl?: Array<string> | null;
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
92
|
* Represents a product entity object.
|