oneentry 1.0.120 → 1.0.122
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 +71 -71
- package/dist/admins/adminsApi.d.ts +1 -3
- package/dist/admins/adminsApi.js +1 -3
- package/dist/attribute-sets/attributeSetsApi.d.ts +1 -0
- package/dist/attribute-sets/attributeSetsApi.js +1 -0
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +13 -13
- package/dist/auth-provider/authProviderApi.d.ts +1 -0
- package/dist/auth-provider/authProviderApi.js +1 -0
- package/dist/base/stateModule.d.ts +1 -1
- package/dist/base/stateModule.js +11 -11
- package/dist/base/syncModules.js +8 -9
- package/dist/blocks/blocksApi.d.ts +1 -0
- package/dist/blocks/blocksApi.js +3 -2
- package/dist/events/eventsApi.d.ts +1 -0
- package/dist/events/eventsApi.js +1 -0
- package/dist/forms/formsApi.d.ts +1 -0
- package/dist/forms/formsApi.js +1 -0
- package/dist/formsData/formsDataApi.d.ts +19 -10
- package/dist/formsData/formsDataApi.js +64 -11
- package/dist/formsData/formsDataInterfaces.d.ts +1 -0
- package/dist/general-types/generalTypesApi.d.ts +1 -0
- package/dist/general-types/generalTypesApi.js +1 -0
- package/dist/index.js +1 -1
- package/dist/integration-collections/integrationCollectionsApi.d.ts +1 -0
- package/dist/integration-collections/integrationCollectionsApi.js +1 -0
- package/dist/locales/localesApi.d.ts +1 -0
- package/dist/locales/localesApi.js +1 -0
- package/dist/menus/menusApi.d.ts +1 -0
- package/dist/menus/menusApi.js +1 -0
- package/dist/orders/ordersApi.d.ts +1 -0
- package/dist/orders/ordersApi.js +1 -0
- package/dist/pages/pagesApi.d.ts +13 -0
- package/dist/pages/pagesApi.js +51 -11
- package/dist/pages/pagesInterfaces.d.ts +1 -0
- package/dist/payments/paymentsApi.d.ts +1 -0
- package/dist/payments/paymentsApi.js +1 -0
- package/dist/product-statuses/productStatusesApi.d.ts +1 -0
- package/dist/product-statuses/productStatusesApi.js +1 -0
- package/dist/products/productsApi.d.ts +1 -0
- package/dist/products/productsApi.js +2 -1
- package/dist/system/systemApi.d.ts +1 -0
- package/dist/system/systemApi.js +1 -0
- package/dist/templates/templatesApi.d.ts +1 -0
- package/dist/templates/templatesApi.js +2 -1
- package/dist/templates-preview/templatesPreviewApi.d.ts +1 -0
- package/dist/templates-preview/templatesPreviewApi.js +1 -0
- package/dist/users/usersApi.d.ts +1 -0
- package/dist/users/usersApi.js +1 -0
- package/dist/web-socket/wsApi.d.ts +1 -0
- package/dist/web-socket/wsApi.js +1 -0
- package/package.json +8 -9
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# OneEntry SDK
|
|
2
2
|
|
|
3
|
-
OneEntry
|
|
3
|
+
OneEntry SDK is an SDK that provides an easy way to interact with the OneEntry API.
|
|
4
4
|
|
|
5
5
|
## Official Site
|
|
6
6
|
|
|
7
|
-
Visit the official
|
|
7
|
+
Visit the official OneEntry website at [https://oneentry.cloud](https://oneentry.cloud) to learn more about the OneEntry Platform.
|
|
8
8
|
|
|
9
9
|
## Sign Up
|
|
10
10
|
|
|
11
|
-
To get started with
|
|
11
|
+
To get started with OneEntry, sign up for an account at [https://account.oneentry.cloud/authentication/register](https://account.oneentry.cloud/authentication/register).
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
|
-
To install the
|
|
15
|
+
To install the OneEntry SDK in your project, run the following command:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
npm install oneentry
|
|
@@ -20,46 +20,46 @@ npm install oneentry
|
|
|
20
20
|
|
|
21
21
|
## Get Started
|
|
22
22
|
|
|
23
|
-
To use the
|
|
23
|
+
To use the OneEntry SDK in your project, import the defineOneEntry function:
|
|
24
24
|
|
|
25
25
|
```js
|
|
26
26
|
import { defineOneEntry } from 'oneentry'
|
|
27
27
|
|
|
28
28
|
const config = {
|
|
29
|
-
|
|
30
|
-
}
|
|
29
|
+
token: 'your-app-token',
|
|
30
|
+
}
|
|
31
31
|
const {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} = defineOneEntry('your-url', config)
|
|
32
|
+
Admins,
|
|
33
|
+
AttributesSets,
|
|
34
|
+
AuthProvider,
|
|
35
|
+
Blocks,
|
|
36
|
+
Events,
|
|
37
|
+
Forms,
|
|
38
|
+
FormData,
|
|
39
|
+
FileUploading,
|
|
40
|
+
GeneralTypes,
|
|
41
|
+
IntegrationCollections,
|
|
42
|
+
Locales,
|
|
43
|
+
Menus,
|
|
44
|
+
Orders,
|
|
45
|
+
Pages,
|
|
46
|
+
Products,
|
|
47
|
+
ProductStatuses,
|
|
48
|
+
System,
|
|
49
|
+
Templates,
|
|
50
|
+
TemplatePreviews,
|
|
51
|
+
Users,
|
|
52
|
+
WS,
|
|
53
|
+
} = defineOneEntry('your-url', config)
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
Or
|
|
57
57
|
|
|
58
58
|
```js
|
|
59
59
|
const config = {
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
const api = defineOneEntry('your-url', config)
|
|
60
|
+
token: 'your-app-token',
|
|
61
|
+
}
|
|
62
|
+
const api = defineOneEntry('your-url', config)
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
---
|
|
@@ -88,16 +88,16 @@ An example of a configuration with token protection and automatic authentication
|
|
|
88
88
|
|
|
89
89
|
```js
|
|
90
90
|
const tokenFunction = (token) => {
|
|
91
|
-
|
|
91
|
+
localStorage.setItem('refreshToken', token)
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
const api = defineOneEntry('https://my-project.oneentry.cloud', {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
token: 'my-token',
|
|
96
|
+
langCode: 'en_US',
|
|
97
|
+
auth: {
|
|
98
|
+
refreshToken: localStorage.getItem('refreshToken'),
|
|
99
|
+
saveFunction: tokenFunction,
|
|
100
|
+
},
|
|
101
101
|
})
|
|
102
102
|
```
|
|
103
103
|
|
|
@@ -105,12 +105,12 @@ An example of a configuration that is protected with a certificate allows you to
|
|
|
105
105
|
|
|
106
106
|
```js
|
|
107
107
|
const api = defineOneEntry('https://my-project.oneentry.cloud', {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
langCode: 'en_US',
|
|
109
|
+
traficLimit: true,
|
|
110
|
+
auth: {
|
|
111
|
+
customAuth: true,
|
|
112
|
+
refreshToken: localStorage.getItem('refreshToken'),
|
|
113
|
+
},
|
|
114
114
|
})
|
|
115
115
|
```
|
|
116
116
|
|
|
@@ -122,16 +122,16 @@ This method (setAccessToken) should not be called if the method does not require
|
|
|
122
122
|
const user = api.Users.setAccessToken('my.access.token').getUser()
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
>If you chose token protection to ensure connection security, just pass your token to the function as an optional parameter.
|
|
125
|
+
> If you chose token protection to ensure connection security, just pass your token to the function as an optional parameter.
|
|
126
126
|
|
|
127
127
|
You can get a token as follows
|
|
128
128
|
|
|
129
|
-
1
|
|
130
|
-
2
|
|
131
|
-
3
|
|
132
|
-
4
|
|
133
|
-
5
|
|
134
|
-
6
|
|
129
|
+
1. Log in to your personal account
|
|
130
|
+
2. Go to the "Projects" tab and select a project
|
|
131
|
+
3. Go to the "Access" tab
|
|
132
|
+
4. Set the switch to "Security API Token"
|
|
133
|
+
5. Log in to the project, go to the settings section and open the token tab
|
|
134
|
+
6. Get and copy the token of your project
|
|
135
135
|
|
|
136
136
|
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.
|
|
137
137
|
[Learn more about security](https://oneentry.cloud/instructions)
|
|
@@ -142,14 +142,14 @@ const saveTokenFromLocalStorage = (token) => {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
const api = defineOneEntry('your-url', {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
})
|
|
145
|
+
token: 'my-token',
|
|
146
|
+
langCode: 'my-langCode',
|
|
147
|
+
auth: {
|
|
148
|
+
customAuth: false,
|
|
149
|
+
userToken: 'rerfesh.token',
|
|
150
|
+
saveFunction: saveTokenFromLocalStorage,
|
|
151
|
+
},
|
|
152
|
+
})
|
|
153
153
|
```
|
|
154
154
|
|
|
155
155
|
### Errors
|
|
@@ -166,17 +166,17 @@ These functions receive an error object as an argument. You can process it yours
|
|
|
166
166
|
|
|
167
167
|
```js
|
|
168
168
|
const api = defineOneEntry('your-url', {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
})
|
|
169
|
+
token: 'my-token',
|
|
170
|
+
langCode: 'my-langCode',
|
|
171
|
+
errors: {
|
|
172
|
+
isShell: false,
|
|
173
|
+
customErrors: {
|
|
174
|
+
400: (error) => console.error(error.message),
|
|
175
|
+
404: (error) => console.error(error.message),
|
|
176
|
+
500: (error) => console.error(error.message),
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
})
|
|
180
180
|
```
|
|
181
181
|
|
|
182
182
|
Now you can use the following links to jump to specific entries documentation:
|
|
@@ -4,13 +4,11 @@ import type { AttributeType, IError } from '../base/utils';
|
|
|
4
4
|
import type { IAdminEntity, IAdmins } from './adminsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with users - admins
|
|
7
|
+
* @handle /api/content/admins
|
|
7
8
|
*/
|
|
8
9
|
export default class AdminsApi extends AsyncModules implements IAdmins {
|
|
9
10
|
protected state: StateModule;
|
|
10
11
|
protected _url: string;
|
|
11
|
-
/**
|
|
12
|
-
* '/api/content/admins'
|
|
13
|
-
*/
|
|
14
12
|
constructor(state: StateModule);
|
|
15
13
|
/**
|
|
16
14
|
* Get all user objects - admins.
|
package/dist/admins/adminsApi.js
CHANGED
|
@@ -6,11 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for working with users - admins
|
|
9
|
+
* @handle /api/content/admins
|
|
9
10
|
*/
|
|
10
11
|
class AdminsApi extends asyncModules_1.default {
|
|
11
|
-
/**
|
|
12
|
-
* '/api/content/admins'
|
|
13
|
-
*/
|
|
14
12
|
constructor(state) {
|
|
15
13
|
super(state);
|
|
16
14
|
this._url = state.url + '/api/content/admins';
|
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IAttributeSetsEntity, IAttributesSets, IAttributesSetsEntity, IAttributesSetsResponse } from './attributeSetsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with attributes - AttributesSetsApi.
|
|
7
|
+
* @handle /api/content/attributes-sets
|
|
7
8
|
* @class
|
|
8
9
|
*/
|
|
9
10
|
export default class AttributesSetsApi extends AsyncModules implements IAttributesSets {
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
8
|
/**
|
|
9
9
|
* Controllers for working with attributes - AttributesSetsApi.
|
|
10
|
+
* @handle /api/content/attributes-sets
|
|
10
11
|
* @class
|
|
11
12
|
*/
|
|
12
13
|
class AttributesSetsApi extends asyncModules_1.default {
|
|
@@ -12,10 +12,10 @@ interface IAttributesSets {
|
|
|
12
12
|
/**
|
|
13
13
|
* Represents an interface object of IListTitle.
|
|
14
14
|
*
|
|
15
|
-
* @property {string} title
|
|
16
|
-
* @property {number | string} value
|
|
17
|
-
* @property {string | number | null} position
|
|
18
|
-
* @property {object} extended
|
|
15
|
+
* @property {string} title - The title or name associated with the list item.
|
|
16
|
+
* @property {number | string} value - The value of the list item, which can be either a number or a string depending on the context.
|
|
17
|
+
* @property {string | number | null} position - The position of the list item, which can be represented as a string, number, or null if not applicable.
|
|
18
|
+
* @property {object} extended - An object containing additional properties or metadata related to the list item. This could include any extra details that extend the basic information.
|
|
19
19
|
*/
|
|
20
20
|
interface IListTitle {
|
|
21
21
|
title: string;
|
|
@@ -53,15 +53,15 @@ interface IAttributesSetsEntity {
|
|
|
53
53
|
/**
|
|
54
54
|
* Represents an interface object of IAttributeSetsEntity.
|
|
55
55
|
*
|
|
56
|
-
* @property {number} id -
|
|
57
|
-
* @property {string} identifier -
|
|
58
|
-
* @property {boolean} isVisible -
|
|
59
|
-
* @property {any} schema -
|
|
60
|
-
* @property {string} title -
|
|
61
|
-
* @property {any} type -
|
|
62
|
-
* @property {number} typeId -
|
|
63
|
-
* @property {string} updatedDate -
|
|
64
|
-
* @property {number} version -
|
|
56
|
+
* @property {number} id - The unique identifier of the attribute set entity.
|
|
57
|
+
* @property {string} identifier - A string that uniquely identifies the attribute set.
|
|
58
|
+
* @property {boolean} isVisible - Indicates whether the attribute set is visible or not.
|
|
59
|
+
* @property {any} schema - The schema definition associated with the attribute set. This could represent the structure or rules for the data.
|
|
60
|
+
* @property {string} title - The title or name of the attribute set.
|
|
61
|
+
* @property {any} type - The type of the attribute set, which could be a specific classification or category.
|
|
62
|
+
* @property {number} typeId - The numerical identifier representing the type of the attribute set.
|
|
63
|
+
* @property {string} updatedDate - The date when the attribute set was last updated, represented as a string. Consider using Date for better date handling.
|
|
64
|
+
* @property {number} version - The version number of the attribute set, used for tracking changes or updates.
|
|
65
65
|
*/
|
|
66
66
|
interface IAttributeSetsEntity {
|
|
67
67
|
id: number;
|
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IAuthEntity, IAuthPostBody, IAuthProvider, IAuthProvidersEntity, ISignUpData, ISignUpEntity } from './authProvidersInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with auth services.
|
|
7
|
+
* @handle /api/content/users-auth-providers
|
|
7
8
|
*/
|
|
8
9
|
export default class AuthProviderApi extends AsyncModules implements IAuthProvider {
|
|
9
10
|
protected state: StateModule;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for working with auth services.
|
|
9
|
+
* @handle /api/content/users-auth-providers
|
|
9
10
|
*/
|
|
10
11
|
class AuthProviderApi extends asyncModules_1.default {
|
|
11
12
|
constructor(state) {
|
package/dist/base/stateModule.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
class StateModule {
|
|
4
4
|
constructor(url, config) {
|
|
5
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o
|
|
5
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
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.
|
|
10
|
-
this.refreshToken = (
|
|
11
|
-
this.customAuth = (
|
|
9
|
+
this.traficLimit = config.traficLimit || false;
|
|
10
|
+
this.refreshToken = (_c = (_b = config.auth) === null || _b === void 0 ? void 0 : _b.refreshToken) !== null && _c !== void 0 ? _c : undefined;
|
|
11
|
+
this.customAuth = (_e = (_d = config.auth) === null || _d === void 0 ? void 0 : _d.customAuth) !== null && _e !== void 0 ? _e : false;
|
|
12
12
|
this.errorsFunctions = {
|
|
13
13
|
'400': undefined,
|
|
14
14
|
'401': undefined,
|
|
@@ -16,20 +16,20 @@ class StateModule {
|
|
|
16
16
|
'404': undefined,
|
|
17
17
|
'500': undefined,
|
|
18
18
|
};
|
|
19
|
-
this.saveFunction = (
|
|
19
|
+
this.saveFunction = (_g = (_f = config.auth) === null || _f === void 0 ? void 0 : _f.saveFunction) !== null && _g !== void 0 ? _g : null;
|
|
20
20
|
if (config.errors) {
|
|
21
|
-
this.isShell = (
|
|
21
|
+
this.isShell = (_h = config.errors.isShell) !== null && _h !== void 0 ? _h : true;
|
|
22
22
|
if (config.errors.customErrors) {
|
|
23
23
|
this.errorsFunctions['400'] =
|
|
24
|
-
(
|
|
24
|
+
(_j = config.errors.customErrors['400']) !== null && _j !== void 0 ? _j : undefined;
|
|
25
25
|
this.errorsFunctions['401'] =
|
|
26
|
-
(
|
|
26
|
+
(_k = config.errors.customErrors['401']) !== null && _k !== void 0 ? _k : undefined;
|
|
27
27
|
this.errorsFunctions['403'] =
|
|
28
|
-
(
|
|
28
|
+
(_l = config.errors.customErrors['403']) !== null && _l !== void 0 ? _l : undefined;
|
|
29
29
|
this.errorsFunctions['404'] =
|
|
30
|
-
(
|
|
30
|
+
(_m = config.errors.customErrors['404']) !== null && _m !== void 0 ? _m : undefined;
|
|
31
31
|
this.errorsFunctions['500'] =
|
|
32
|
-
(
|
|
32
|
+
(_o = config.errors.customErrors['400']) !== null && _o !== void 0 ? _o : undefined;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
else {
|
package/dist/base/syncModules.js
CHANGED
|
@@ -259,10 +259,10 @@ class SyncModules {
|
|
|
259
259
|
// for regular attributes
|
|
260
260
|
if ('attributeValues' in data) {
|
|
261
261
|
for (const attr in data.attributeValues) {
|
|
262
|
+
const d = data.attributeValues[attr];
|
|
262
263
|
// normalize numbers
|
|
263
|
-
if (
|
|
264
|
-
|
|
265
|
-
data.attributeValues[attr].value = Number(data.attributeValues[attr].value);
|
|
264
|
+
if (d.type === 'integer' || d.type === 'float') {
|
|
265
|
+
d.value = Number(d.value);
|
|
266
266
|
}
|
|
267
267
|
// add timeIntervals
|
|
268
268
|
if (data.attributeValues[attr].type === 'timeInterval') {
|
|
@@ -289,12 +289,11 @@ class SyncModules {
|
|
|
289
289
|
}
|
|
290
290
|
// add timeIntervals
|
|
291
291
|
if (d[attr].type === 'timeInterval') {
|
|
292
|
-
const schedules = d[attr].
|
|
293
|
-
//
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
292
|
+
// const schedules = d[attr].localizeInfos.intervals;
|
|
293
|
+
// if (Array.isArray(schedules) && schedules.length > 0) {
|
|
294
|
+
// const result = this._addTimeIntervalsToSchedulesForm(schedules);
|
|
295
|
+
// d[attr].localizeInfos.intervals = result;
|
|
296
|
+
// }
|
|
298
297
|
}
|
|
299
298
|
}
|
|
300
299
|
return data;
|
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { BlockType, IBlockEntity, IBlocks, IBlocksResponse, ISearchBlock } from './blocksInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with blocks
|
|
7
|
+
* @handle /api/content/blocks
|
|
7
8
|
*/
|
|
8
9
|
export default class BlocksApi extends AsyncModules implements IBlocks {
|
|
9
10
|
protected state: StateModule;
|
package/dist/blocks/blocksApi.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for working with blocks
|
|
9
|
+
* @handle /api/content/blocks
|
|
9
10
|
*/
|
|
10
11
|
class BlocksApi extends asyncModules_1.default {
|
|
11
12
|
constructor(state) {
|
|
@@ -24,7 +25,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
24
25
|
*/
|
|
25
26
|
async getBlocks(type, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
26
27
|
const response = await this._fetchGet(`?langCode=${langCode}&type=${type}&offset=${offset}&limit=${limit}`);
|
|
27
|
-
if (this.state.
|
|
28
|
+
if (!this.state.traficLimit) {
|
|
28
29
|
const normalizeResponse = this._normalizeData(response);
|
|
29
30
|
await Promise.all(
|
|
30
31
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -92,7 +93,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
92
93
|
delete normalizeResponse.customSettings;
|
|
93
94
|
delete normalizeResponse.attributesSetIdentifier;
|
|
94
95
|
delete normalizeResponse.productPageUrls;
|
|
95
|
-
if (this.state.
|
|
96
|
+
if (!this.state.traficLimit) {
|
|
96
97
|
if (normalizeResponse.type === 'similar_products_block') {
|
|
97
98
|
try {
|
|
98
99
|
await this.getSimilarProducts(normalizeResponse.identifier, langCode, offset, limit).then((result) => {
|
|
@@ -5,6 +5,7 @@ import type { IEvents } from './eventsInterfaces';
|
|
|
5
5
|
import type { ISubscriptions } from './eventsInterfaces';
|
|
6
6
|
/**
|
|
7
7
|
* Controllers for working with events
|
|
8
|
+
* @handle /api/content/events
|
|
8
9
|
*/
|
|
9
10
|
export default class EventsApi extends AsyncModules implements IEvents {
|
|
10
11
|
protected state: StateModule;
|
package/dist/events/eventsApi.js
CHANGED
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
9
9
|
/**
|
|
10
10
|
* Controllers for working with events
|
|
11
|
+
* @handle /api/content/events
|
|
11
12
|
*/
|
|
12
13
|
class EventsApi extends asyncModules_1.default {
|
|
13
14
|
constructor(state) {
|
package/dist/forms/formsApi.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IForms, IFormsEntity } from './formsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for forms objects
|
|
7
|
+
* @handle /api/content/forms
|
|
7
8
|
*/
|
|
8
9
|
export default class FormsApi extends AsyncModules implements IForms {
|
|
9
10
|
protected state: StateModule;
|
package/dist/forms/formsApi.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for forms objects
|
|
9
|
+
* @handle /api/content/forms
|
|
9
10
|
*/
|
|
10
11
|
class FormsApi extends asyncModules_1.default {
|
|
11
12
|
constructor(state) {
|
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IFormDataEntity, IFormsData, IFormsDataEntity, IFormsPost } from './formsDataInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with form data
|
|
7
|
+
* @handle /api/content/form-data
|
|
7
8
|
*/
|
|
8
9
|
export default class FormsDataApi extends AsyncModules implements IFormsData {
|
|
9
10
|
protected state: StateModule;
|
|
@@ -27,16 +28,24 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
|
|
|
27
28
|
*
|
|
28
29
|
* @example
|
|
29
30
|
* const body = {
|
|
30
|
-
"formIdentifier": "
|
|
31
|
-
"formData":
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
"formIdentifier": "file",
|
|
32
|
+
"formData": [
|
|
33
|
+
{
|
|
34
|
+
"marker": "name",
|
|
35
|
+
"type": "string",
|
|
36
|
+
"value": "filesArray",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"marker": "file",
|
|
40
|
+
"type": "file",
|
|
41
|
+
"value": filesArray,
|
|
42
|
+
fileQuery: {
|
|
43
|
+
type: 'page',
|
|
44
|
+
entity: 'editor',
|
|
45
|
+
id: 3492,
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
]
|
|
40
49
|
}
|
|
41
50
|
*
|
|
42
51
|
* @returns - Returns a created FormDataEntity object.
|
|
@@ -5,8 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
7
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
|
+
const fileUploadingApi_1 = __importDefault(require("../file-uploading/fileUploadingApi"));
|
|
8
9
|
/**
|
|
9
10
|
* Controllers for working with form data
|
|
11
|
+
* @handle /api/content/form-data
|
|
10
12
|
*/
|
|
11
13
|
class FormsDataApi extends asyncModules_1.default {
|
|
12
14
|
constructor(state) {
|
|
@@ -34,26 +36,77 @@ class FormsDataApi extends asyncModules_1.default {
|
|
|
34
36
|
*
|
|
35
37
|
* @example
|
|
36
38
|
* const body = {
|
|
37
|
-
"formIdentifier": "
|
|
38
|
-
"formData":
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
"formIdentifier": "file",
|
|
40
|
+
"formData": [
|
|
41
|
+
{
|
|
42
|
+
"marker": "name",
|
|
43
|
+
"type": "string",
|
|
44
|
+
"value": "filesArray",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"marker": "file",
|
|
48
|
+
"type": "file",
|
|
49
|
+
"value": filesArray,
|
|
50
|
+
fileQuery: {
|
|
51
|
+
type: 'page',
|
|
52
|
+
entity: 'editor',
|
|
53
|
+
id: 3492,
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
]
|
|
47
57
|
}
|
|
48
58
|
*
|
|
49
59
|
* @returns - Returns a created FormDataEntity object.
|
|
50
60
|
*/
|
|
51
61
|
async postFormsData(body, langCode = this.state.lang) {
|
|
52
62
|
const formData = {};
|
|
53
|
-
// filter spam and button fields
|
|
63
|
+
// filter spam and button fields, send file
|
|
54
64
|
formData[langCode] = Array.isArray(body.formData)
|
|
55
65
|
? body.formData.filter((fd) => fd.type !== 'spam' && fd.type !== 'button')
|
|
56
66
|
: [body.formData].filter((fd) => fd.type !== 'spam' && fd.type !== 'button');
|
|
67
|
+
// Handle file uploads if fileQuery is present
|
|
68
|
+
// Check if there is any element in formData[langCode] that contains one of the specified types
|
|
69
|
+
if (formData[langCode].find((fd) => ['file', 'image', 'groupOfImages'].includes(fd.type))) {
|
|
70
|
+
// Create an instance of FileUploadingApi with the current state
|
|
71
|
+
const fileUploader = new fileUploadingApi_1.default(this.state);
|
|
72
|
+
// Process each element in formData[langCode] asynchronously
|
|
73
|
+
formData[langCode] = await Promise.all(formData[langCode].map(async (fd) => {
|
|
74
|
+
// Check if the type is one of the specified types
|
|
75
|
+
if (['file', 'image', 'groupOfImages'].includes(fd.type)) {
|
|
76
|
+
// If fileQuery does not exist, we create it and assign it to an object with the following properties:
|
|
77
|
+
if (!fd.fileQuery) {
|
|
78
|
+
const fileQuery = {
|
|
79
|
+
type: 'page',
|
|
80
|
+
entity: 'editor',
|
|
81
|
+
// Generate a random 4-digit ID
|
|
82
|
+
id: Number(Math.floor(Math.random() * 10000)
|
|
83
|
+
.toString()
|
|
84
|
+
.padStart(4, '0')),
|
|
85
|
+
};
|
|
86
|
+
fd.fileQuery = fileQuery;
|
|
87
|
+
}
|
|
88
|
+
// Convert fd.value to an array if it is a FileList, otherwise use it directly
|
|
89
|
+
const filesArray = typeof FileList !== 'undefined' && fd.value instanceof FileList
|
|
90
|
+
? Array.from(fd.value)
|
|
91
|
+
: fd.value;
|
|
92
|
+
// If filesArray is an array, upload each file asynchronously
|
|
93
|
+
if (Array.isArray(filesArray)) {
|
|
94
|
+
const uploadPromises = filesArray.map((file) => fileUploader.upload(file, fd.fileQuery).catch((e) => e));
|
|
95
|
+
fd.value = (await Promise.all(uploadPromises)).flat();
|
|
96
|
+
}
|
|
97
|
+
// If fd.value is a single File or Blob, upload it
|
|
98
|
+
else if (fd.value instanceof File || fd.value instanceof Blob) {
|
|
99
|
+
fd.value = await fileUploader
|
|
100
|
+
.upload(fd.value, fd.fileQuery)
|
|
101
|
+
.catch((e) => e); // Catch any errors during upload
|
|
102
|
+
}
|
|
103
|
+
// Remove the 'fileQuery' property from the object after processing
|
|
104
|
+
delete fd.fileQuery;
|
|
105
|
+
}
|
|
106
|
+
// Return the processed form data element
|
|
107
|
+
return fd;
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
57
110
|
body.formData = formData;
|
|
58
111
|
const result = await this._fetchPost(``, body);
|
|
59
112
|
return this._dataPostProcess(result);
|
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IGeneralTypes, IGeneralTypesEntity } from './generalTypesInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with types
|
|
7
|
+
* @handle /api/content/general-types
|
|
7
8
|
*/
|
|
8
9
|
export default class GeneralTypesApi extends AsyncModules implements IGeneralTypes {
|
|
9
10
|
protected state: StateModule;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for working with types
|
|
9
|
+
* @handle /api/content/general-types
|
|
9
10
|
*/
|
|
10
11
|
class GeneralTypesApi extends asyncModules_1.default {
|
|
11
12
|
constructor(state) {
|
package/dist/index.js
CHANGED
|
@@ -47,7 +47,7 @@ const wsApi_1 = __importDefault(require("./web-socket/wsApi"));
|
|
|
47
47
|
* @returns {IDefineApi} - List of methods set.
|
|
48
48
|
*/
|
|
49
49
|
function defineOneEntry(url, config) {
|
|
50
|
-
const stateModule = new stateModule_1.default(url, config);
|
|
50
|
+
const stateModule = new stateModule_1.default(url.endsWith('/') ? url.slice(0, -1) : url, config);
|
|
51
51
|
const Admins = new adminsApi_1.default(stateModule);
|
|
52
52
|
const AttributesSets = new attributeSetsApi_1.default(stateModule);
|
|
53
53
|
const AuthProvider = new authProviderApi_1.default(stateModule);
|
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { ICollection, ICollectionFormObject, ICollectionResponce, ICollectionRow, ICollectionsApi } from './integrationCollectionsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with attributes.
|
|
7
|
+
* @handle /api/content/integration-collections
|
|
7
8
|
*/
|
|
8
9
|
export default class IntegrationCollectionsApi extends AsyncModules implements ICollectionsApi {
|
|
9
10
|
protected state: StateModule;
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
8
|
/**
|
|
9
9
|
* Controllers for working with attributes.
|
|
10
|
+
* @handle /api/content/integration-collections
|
|
10
11
|
*/
|
|
11
12
|
class IntegrationCollectionsApi extends asyncModules_1.default {
|
|
12
13
|
constructor(state) {
|
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { ILocalEntity, ILocales } from './localesInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with localizations (content language)
|
|
7
|
+
* @handle /api/content/locales
|
|
7
8
|
*/
|
|
8
9
|
export default class LocalesApi extends AsyncModules implements ILocales {
|
|
9
10
|
protected state: StateModule;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for working with localizations (content language)
|
|
9
|
+
* @handle /api/content/locales
|
|
9
10
|
*/
|
|
10
11
|
class LocalesApi extends asyncModules_1.default {
|
|
11
12
|
constructor(state) {
|
package/dist/menus/menusApi.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IMenus, IMenusEntity } from './menusInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with menu objects
|
|
7
|
+
* @handle /api/content/menus
|
|
7
8
|
*/
|
|
8
9
|
export default class MenusApi extends AsyncModules implements IMenus {
|
|
9
10
|
protected state: StateModule;
|
package/dist/menus/menusApi.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for working with menu objects
|
|
9
|
+
* @handle /api/content/menus
|
|
9
10
|
*/
|
|
10
11
|
class MenusApi extends asyncModules_1.default {
|
|
11
12
|
constructor(state) {
|
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IBaseOrdersEntity, IOrderByMarkerEntity, IOrderData, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity } from './ordersInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with orders
|
|
7
|
+
* @handle /api/content/orders-storage
|
|
7
8
|
*/
|
|
8
9
|
export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
9
10
|
protected state: StateModule;
|
package/dist/orders/ordersApi.js
CHANGED
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
8
|
/**
|
|
9
9
|
* Controllers for working with orders
|
|
10
|
+
* @handle /api/content/orders-storage
|
|
10
11
|
*/
|
|
11
12
|
class OrdersApi extends asyncModules_1.default {
|
|
12
13
|
constructor(state) {
|
package/dist/pages/pagesApi.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IPageApi, IPageConfig, IPagesEntity, IPositionBlock, IPositionForm } from './pagesInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with page objects, including catalog pages
|
|
7
|
+
* @handle /api/content/pages
|
|
7
8
|
*/
|
|
8
9
|
export default class PageApi extends AsyncModules implements IPageApi {
|
|
9
10
|
protected state: StateModule;
|
|
@@ -87,4 +88,16 @@ export default class PageApi extends AsyncModules implements IPageApi {
|
|
|
87
88
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
88
89
|
*/
|
|
89
90
|
searchPage(name: string, langCode?: string): Promise<Array<IPagesEntity> | IError>;
|
|
91
|
+
/**
|
|
92
|
+
* addTemplateToPages
|
|
93
|
+
* @param data
|
|
94
|
+
* @returns
|
|
95
|
+
*/
|
|
96
|
+
protected addTemplateToPages(data: IPagesEntity[]): Promise<IPagesEntity[]>;
|
|
97
|
+
/**
|
|
98
|
+
* addTemplateToPage by page templateIdentifier
|
|
99
|
+
* @param data - page object
|
|
100
|
+
* @returns
|
|
101
|
+
*/
|
|
102
|
+
protected addTemplateToPage(data: IPagesEntity): Promise<IPagesEntity>;
|
|
90
103
|
}
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -5,8 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
7
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
|
+
const templatesApi_1 = __importDefault(require("../templates/templatesApi"));
|
|
8
9
|
/**
|
|
9
10
|
* Controllers for working with page objects, including catalog pages
|
|
11
|
+
* @handle /api/content/pages
|
|
10
12
|
*/
|
|
11
13
|
class PageApi extends asyncModules_1.default {
|
|
12
14
|
constructor(state) {
|
|
@@ -21,7 +23,8 @@ class PageApi extends asyncModules_1.default {
|
|
|
21
23
|
* @returns Returns all created pages without parents as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
22
24
|
*/
|
|
23
25
|
async getRootPages(langCode = this.state.lang) {
|
|
24
|
-
const
|
|
26
|
+
const data = await this._fetchGet(`/root?langCode=${langCode}`);
|
|
27
|
+
const result = await this.addTemplateToPages(data);
|
|
25
28
|
return this._normalizeData(result, langCode);
|
|
26
29
|
}
|
|
27
30
|
/**
|
|
@@ -32,7 +35,8 @@ class PageApi extends asyncModules_1.default {
|
|
|
32
35
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
33
36
|
*/
|
|
34
37
|
async getPages(langCode = this.state.lang) {
|
|
35
|
-
const
|
|
38
|
+
const data = await this._fetchGet(`?langCode=${langCode}`);
|
|
39
|
+
const result = await this.addTemplateToPages(data);
|
|
36
40
|
return this._normalizeData(result, langCode);
|
|
37
41
|
}
|
|
38
42
|
/**
|
|
@@ -44,7 +48,8 @@ class PageApi extends asyncModules_1.default {
|
|
|
44
48
|
* @returns Returns PageEntity object
|
|
45
49
|
*/
|
|
46
50
|
async getPageById(id, langCode = this.state.lang) {
|
|
47
|
-
const
|
|
51
|
+
const data = await this._fetchGet(`/${id}?langCode=${langCode}`);
|
|
52
|
+
const result = await this.addTemplateToPage(data);
|
|
48
53
|
return this._normalizeData(result, langCode);
|
|
49
54
|
}
|
|
50
55
|
/**
|
|
@@ -57,7 +62,8 @@ class PageApi extends asyncModules_1.default {
|
|
|
57
62
|
*/
|
|
58
63
|
async getPageByUrl(url, langCode = this.state.lang) {
|
|
59
64
|
const data = await this._fetchGet(`/url/${url}?langCode=${langCode}`);
|
|
60
|
-
|
|
65
|
+
const result = await this.addTemplateToPage(data);
|
|
66
|
+
return this._normalizeData(result, langCode);
|
|
61
67
|
}
|
|
62
68
|
/**
|
|
63
69
|
* Get child pages object with information as an array.
|
|
@@ -69,7 +75,8 @@ class PageApi extends asyncModules_1.default {
|
|
|
69
75
|
*/
|
|
70
76
|
async getChildPagesByParentUrl(url, langCode = this.state.lang) {
|
|
71
77
|
const data = await this._fetchGet(`/${url}/children?langCode=${langCode}`);
|
|
72
|
-
|
|
78
|
+
const result = await this.addTemplateToPages(data);
|
|
79
|
+
return this._normalizeData(result, langCode);
|
|
73
80
|
}
|
|
74
81
|
/**
|
|
75
82
|
* Get all blocks by page url.
|
|
@@ -96,7 +103,7 @@ class PageApi extends asyncModules_1.default {
|
|
|
96
103
|
delete item.attributesSetIdentifier;
|
|
97
104
|
return item;
|
|
98
105
|
});
|
|
99
|
-
if (this.state.
|
|
106
|
+
if (!this.state.traficLimit) {
|
|
100
107
|
class StaffModule extends asyncModules_1.default {
|
|
101
108
|
constructor(state) {
|
|
102
109
|
super(state);
|
|
@@ -171,17 +178,50 @@ class PageApi extends asyncModules_1.default {
|
|
|
171
178
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
172
179
|
*/
|
|
173
180
|
async searchPage(name, langCode = this.state.lang) {
|
|
174
|
-
const
|
|
175
|
-
if (this.state.
|
|
181
|
+
const data = await this._fetchGet(`/quick/search?lang=${langCode}&name=${name}`);
|
|
182
|
+
if (!this.state.traficLimit) {
|
|
176
183
|
const pageList = [];
|
|
177
|
-
await Promise.all(
|
|
184
|
+
await Promise.all(data.map(async (page) => {
|
|
178
185
|
await this.getPageById(page.id, langCode).then((result) => {
|
|
179
186
|
pageList.push(result);
|
|
180
187
|
});
|
|
181
188
|
}));
|
|
182
|
-
|
|
189
|
+
const result = await this.addTemplateToPages(pageList);
|
|
190
|
+
return this._dataPostProcess(result, langCode);
|
|
191
|
+
}
|
|
192
|
+
const result = await this.addTemplateToPages(data);
|
|
193
|
+
return this._normalizeData(result, langCode);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* addTemplateToPages
|
|
197
|
+
* @param data
|
|
198
|
+
* @returns
|
|
199
|
+
*/
|
|
200
|
+
async addTemplateToPages(data) {
|
|
201
|
+
return Promise.all(data.map(async (d) => {
|
|
202
|
+
const result = await this.addTemplateToPage(d);
|
|
203
|
+
return result;
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* addTemplateToPage by page templateIdentifier
|
|
208
|
+
* @param data - page object
|
|
209
|
+
* @returns
|
|
210
|
+
*/
|
|
211
|
+
async addTemplateToPage(data) {
|
|
212
|
+
if ('templateIdentifier' in data && data.templateIdentifier) {
|
|
213
|
+
// Create an instance of templatesApi with the current state
|
|
214
|
+
const Templates = new templatesApi_1.default(this.state);
|
|
215
|
+
// get template by marker
|
|
216
|
+
const result = await Templates.getTemplateByMarker('template');
|
|
217
|
+
return {
|
|
218
|
+
...data,
|
|
219
|
+
template: result,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
return data;
|
|
183
224
|
}
|
|
184
|
-
return this._normalizeData(searchPages, langCode);
|
|
185
225
|
}
|
|
186
226
|
}
|
|
187
227
|
exports.default = PageApi;
|
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IAccountsEntity, IConnectedEntity, ICreateSessionEntity, IPaymentsApi, ISessionEntity, ISessionsEntity } from './paymentsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with payments
|
|
7
|
+
* @handle /api/content/payments
|
|
7
8
|
*/
|
|
8
9
|
export default class PaymentsApi extends AsyncModules implements IPaymentsApi {
|
|
9
10
|
protected state: StateModule;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for working with payments
|
|
9
|
+
* @handle /api/content/payments
|
|
9
10
|
*/
|
|
10
11
|
class PaymentsApi extends asyncModules_1.default {
|
|
11
12
|
constructor(state) {
|
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IProductStatusEntity, IProductStatuses } from './productStatusesInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with product statuses
|
|
7
|
+
* @handle /api/content/product-statuses
|
|
7
8
|
*/
|
|
8
9
|
export default class ProductStatusesApi extends AsyncModules implements IProductStatuses {
|
|
9
10
|
protected state: StateModule;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for working with product statuses
|
|
9
|
+
* @handle /api/content/product-statuses
|
|
9
10
|
*/
|
|
10
11
|
class ProductStatusesApi extends asyncModules_1.default {
|
|
11
12
|
constructor(state) {
|
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IFilterParams, IProductApi, IProductBlock, IProductEntity, IProductsEntity, IProductsInfo, IProductsQuery, IProductsResponse } from './productsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with product pages
|
|
7
|
+
* @handle /api/content/products
|
|
7
8
|
*/
|
|
8
9
|
export default class ProductApi extends AsyncModules implements IProductApi {
|
|
9
10
|
protected state: StateModule;
|
|
@@ -7,6 +7,7 @@ const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
|
7
7
|
// import { IProductInfo } from './productsInterfaces';
|
|
8
8
|
/**
|
|
9
9
|
* Controllers for working with product pages
|
|
10
|
+
* @handle /api/content/products
|
|
10
11
|
*/
|
|
11
12
|
class ProductApi extends asyncModules_1.default {
|
|
12
13
|
constructor(state) {
|
|
@@ -294,7 +295,7 @@ class ProductApi extends asyncModules_1.default {
|
|
|
294
295
|
*/
|
|
295
296
|
async searchProduct(name, langCode = this.state.lang) {
|
|
296
297
|
const searchProducts = await this._fetchGet(`/quick/search?langCode=${langCode}&name=${name}`);
|
|
297
|
-
if (this.state.
|
|
298
|
+
if (!this.state.traficLimit) {
|
|
298
299
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
299
300
|
const productsList = [];
|
|
300
301
|
await Promise.all(searchProducts.map(async (product) => {
|
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { ISystem } from './systemInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with system - system
|
|
7
|
+
* @handle /api/content/system
|
|
7
8
|
*/
|
|
8
9
|
export default class SystemApi extends AsyncModules implements ISystem {
|
|
9
10
|
protected state: StateModule;
|
package/dist/system/systemApi.js
CHANGED
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
8
|
/**
|
|
9
9
|
* Controllers for working with system - system
|
|
10
|
+
* @handle /api/content/system
|
|
10
11
|
*/
|
|
11
12
|
class SystemApi extends asyncModules_1.default {
|
|
12
13
|
constructor(state) {
|
|
@@ -4,6 +4,7 @@ import type { IError, Types } from '../base/utils';
|
|
|
4
4
|
import type { ITemplateEntity, ITemplatesApi } from './templatesInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with template objects
|
|
7
|
+
* @handle /api/content/templates
|
|
7
8
|
*/
|
|
8
9
|
export default class TemplatesPreviewApi extends AsyncModules implements ITemplatesApi {
|
|
9
10
|
protected state: StateModule;
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
8
|
/**
|
|
9
9
|
* Controllers for working with template objects
|
|
10
|
+
* @handle /api/content/templates
|
|
10
11
|
*/
|
|
11
12
|
class TemplatesPreviewApi extends asyncModules_1.default {
|
|
12
13
|
constructor(state) {
|
|
@@ -62,7 +63,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
|
|
|
62
63
|
* @returns Returns a TemplateEntity object
|
|
63
64
|
*/
|
|
64
65
|
async getTemplateByMarker(marker, langCode = this.state.lang) {
|
|
65
|
-
const result = await this._fetchGet(
|
|
66
|
+
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
66
67
|
return this._normalizeData(result);
|
|
67
68
|
}
|
|
68
69
|
}
|
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { ITemplatesPreview, ITemplatesPreviewEntity } from './templatesPreviewInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with template objects for preview
|
|
7
|
+
* @handle /api/content/template-previews
|
|
7
8
|
*/
|
|
8
9
|
export default class TemplatePreviewsApi extends AsyncModules implements ITemplatesPreview {
|
|
9
10
|
protected state: StateModule;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for working with template objects for preview
|
|
9
|
+
* @handle /api/content/template-previews
|
|
9
10
|
*/
|
|
10
11
|
class TemplatePreviewsApi extends asyncModules_1.default {
|
|
11
12
|
constructor(state) {
|
package/dist/users/usersApi.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IUserBody, IUserEntity, IUsers } from './usersInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with users
|
|
7
|
+
* @handle /api/content/users
|
|
7
8
|
*/
|
|
8
9
|
export default class UsersApi extends AsyncModules implements IUsers {
|
|
9
10
|
protected state: StateModule;
|
package/dist/users/usersApi.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for working with users
|
|
9
|
+
* @handle /api/content/users
|
|
9
10
|
*/
|
|
10
11
|
class UsersApi extends asyncModules_1.default {
|
|
11
12
|
constructor(state) {
|
|
@@ -4,6 +4,7 @@ import type StateModule from '../base/stateModule';
|
|
|
4
4
|
import type { IWS } from './wsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with users
|
|
7
|
+
* @handle /api/content/ws
|
|
7
8
|
*/
|
|
8
9
|
export default class WsApi extends AsyncModules implements IWS {
|
|
9
10
|
protected state: StateModule;
|
package/dist/web-socket/wsApi.js
CHANGED
|
@@ -7,6 +7,7 @@ const socket_io_client_1 = require("socket.io-client");
|
|
|
7
7
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
8
|
/**
|
|
9
9
|
* Controllers for working with users
|
|
10
|
+
* @handle /api/content/ws
|
|
10
11
|
*/
|
|
11
12
|
class WsApi extends asyncModules_1.default {
|
|
12
13
|
constructor(state) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oneentry",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.122",
|
|
4
4
|
"description": "OneEntry NPM package",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -43,22 +43,21 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@jest/globals": "^29.7.0",
|
|
46
|
-
"@microsoft/tsdoc": "^0.15.1",
|
|
47
46
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
48
47
|
"@types/jest": "^29.5.14",
|
|
49
|
-
"@types/node": "^22.
|
|
50
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
51
|
-
"@typescript-eslint/parser": "^8.
|
|
48
|
+
"@types/node": "^22.15.17",
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
50
|
+
"@typescript-eslint/parser": "^8.32.1",
|
|
52
51
|
"eslint": "^8.57.1",
|
|
53
|
-
"eslint-config-prettier": "^10.1.
|
|
52
|
+
"eslint-config-prettier": "^10.1.5",
|
|
54
53
|
"eslint-plugin-import": "^2.31.0",
|
|
55
54
|
"eslint-plugin-jest": "^28.11.0",
|
|
56
|
-
"eslint-plugin-prettier": "^5.
|
|
55
|
+
"eslint-plugin-prettier": "^5.4.0",
|
|
57
56
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
58
57
|
"jest": "^29.7.0",
|
|
59
58
|
"npm-run-all": "^4.1.5",
|
|
60
59
|
"prettier": "^3.5.3",
|
|
61
|
-
"ts-jest": "^29.2
|
|
62
|
-
"typescript": "^5.
|
|
60
|
+
"ts-jest": "^29.3.2",
|
|
61
|
+
"typescript": "^5.8.3"
|
|
63
62
|
}
|
|
64
63
|
}
|