oneentry 1.0.123 → 1.0.125
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 +24 -22
- package/dist/admins/adminsApi.d.ts +30 -9
- package/dist/admins/adminsApi.js +30 -9
- package/dist/admins/adminsInterfaces.d.ts +77 -32
- package/dist/attribute-sets/attributeSetsApi.d.ts +36 -22
- package/dist/attribute-sets/attributeSetsApi.js +41 -25
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +133 -39
- package/dist/auth-provider/authProviderApi.d.ts +209 -88
- package/dist/auth-provider/authProviderApi.js +226 -87
- package/dist/auth-provider/authProvidersInterfaces.d.ts +345 -18
- package/dist/base/asyncModules.d.ts +38 -28
- package/dist/base/asyncModules.js +178 -47
- package/dist/base/result.js +23 -0
- package/dist/base/syncModules.d.ts +48 -44
- package/dist/base/syncModules.js +84 -64
- package/dist/base/utils.d.ts +1 -1
- package/dist/blocks/blocksApi.d.ts +48 -27
- package/dist/blocks/blocksApi.js +48 -27
- package/dist/blocks/blocksInterfaces.d.ts +126 -32
- package/dist/events/eventsApi.d.ts +45 -12
- package/dist/events/eventsApi.js +47 -12
- package/dist/events/eventsInterfaces.d.ts +50 -3
- package/dist/file-uploading/fileUploadingApi.d.ts +57 -29
- package/dist/file-uploading/fileUploadingApi.js +57 -30
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +90 -17
- package/dist/forms/formsApi.d.ts +20 -9
- package/dist/forms/formsApi.js +19 -8
- package/dist/forms/formsInterfaces.d.ts +86 -23
- package/dist/formsData/formsDataApi.d.ts +33 -21
- package/dist/formsData/formsDataApi.js +33 -21
- package/dist/formsData/formsDataInterfaces.d.ts +212 -41
- package/dist/general-types/generalTypesApi.d.ts +11 -2
- package/dist/general-types/generalTypesApi.js +10 -1
- package/dist/general-types/generalTypesInterfaces.d.ts +17 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/integration-collections/integrationCollectionsApi.d.ts +134 -81
- package/dist/integration-collections/integrationCollectionsApi.js +135 -83
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +246 -43
- package/dist/locales/localesApi.d.ts +5 -1
- package/dist/locales/localesApi.js +5 -1
- package/dist/locales/localesInterfaces.d.ts +19 -12
- package/dist/menus/menusApi.d.ts +6 -3
- package/dist/menus/menusApi.js +6 -3
- package/dist/menus/menusInterfaces.d.ts +60 -21
- package/dist/orders/ordersApi.d.ts +84 -66
- package/dist/orders/ordersApi.js +91 -71
- package/dist/orders/ordersInterfaces.d.ts +282 -86
- package/dist/pages/pagesApi.d.ts +101 -42
- package/dist/pages/pagesApi.js +93 -39
- package/dist/pages/pagesInterfaces.d.ts +218 -75
- package/dist/payments/paymentsApi.d.ts +53 -39
- package/dist/payments/paymentsApi.js +55 -40
- package/dist/payments/paymentsInterfaces.d.ts +121 -56
- package/dist/product-statuses/productStatusesApi.d.ts +17 -17
- package/dist/product-statuses/productStatusesApi.js +16 -19
- package/dist/product-statuses/productStatusesInterfaces.d.ts +43 -14
- package/dist/products/productsApi.d.ts +309 -177
- package/dist/products/productsApi.js +313 -167
- package/dist/products/productsInterfaces.d.ts +447 -81
- package/dist/system/systemApi.d.ts +42 -12
- package/dist/system/systemApi.js +43 -10
- package/dist/system/systemInterfaces.d.ts +7 -0
- package/dist/templates/templatesApi.d.ts +24 -20
- package/dist/templates/templatesApi.js +22 -21
- package/dist/templates/templatesInterfaces.d.ts +48 -22
- package/dist/templates-preview/templatesPreviewApi.d.ts +17 -17
- package/dist/templates-preview/templatesPreviewApi.js +16 -19
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +85 -32
- package/dist/users/usersApi.d.ts +59 -35
- package/dist/users/usersApi.js +62 -35
- package/dist/users/usersInterfaces.d.ts +136 -14
- package/dist/web-socket/wsApi.d.ts +4 -5
- package/dist/web-socket/wsApi.js +4 -5
- package/dist/web-socket/wsInterfaces.d.ts +2 -1
- package/package.json +20 -18
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import AsyncModules from '../base/asyncModules';
|
|
2
2
|
import type StateModule from '../base/stateModule';
|
|
3
3
|
import type { IError } from '../base/utils';
|
|
4
|
-
import type { IFileUploading, IUploadingQuery,
|
|
4
|
+
import type { IFileUploading, IUploadingQuery, IUploadingReturn } from './fileUploadingInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with file uploading
|
|
7
|
+
*
|
|
8
|
+
* @handle /api/content/files
|
|
9
|
+
* @class FileUploadingApi
|
|
10
|
+
* @extends AsyncModules
|
|
11
|
+
* @implements {IFileUploading}
|
|
12
|
+
*
|
|
13
|
+
* @description This class provides methods to upload and delete files in a cloud file storage, as well as retrieve files by parameters.
|
|
7
14
|
*/
|
|
8
15
|
export default class FileUploadingApi extends AsyncModules implements IFileUploading {
|
|
9
16
|
protected state: StateModule;
|
|
@@ -13,45 +20,66 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
|
|
|
13
20
|
/**
|
|
14
21
|
* Upload file function.
|
|
15
22
|
*
|
|
16
|
-
* @
|
|
23
|
+
* @handleName upload
|
|
17
24
|
*
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
* @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
|
|
26
|
+
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
27
|
+
{
|
|
28
|
+
"type": "page",
|
|
29
|
+
"entity": "editor",
|
|
30
|
+
"id": 3787,
|
|
31
|
+
"width": 0,
|
|
32
|
+
"height": 0,
|
|
33
|
+
"compress": true,
|
|
34
|
+
"template": 1
|
|
35
|
+
}
|
|
36
|
+
* @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
|
|
37
|
+
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
38
|
+
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
39
|
+
* @param {number} [fileQuery.width] - Optional width parameter. Example: 0.
|
|
40
|
+
* @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
|
|
41
|
+
* @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
|
|
42
|
+
* @param {any} [fileQuery.template] - preview template identifier. Example: 1.
|
|
43
|
+
* @return {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
|
|
44
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
45
|
+
* @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.
|
|
28
46
|
*/
|
|
29
|
-
upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<
|
|
47
|
+
upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
|
|
30
48
|
/**
|
|
31
49
|
* Deletes a file from the cloud file storage.
|
|
32
50
|
*
|
|
33
|
-
* @
|
|
34
|
-
*
|
|
35
|
-
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
|
|
36
|
-
* @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page"
|
|
37
|
-
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor"
|
|
38
|
-
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787
|
|
39
|
-
* @param {number} [fileQuery.template] - preview template identifier. Example: 1
|
|
51
|
+
* @handleName delete
|
|
40
52
|
*
|
|
41
|
-
* @
|
|
53
|
+
* @param {string} [filename] - File name. Example: "file.png".
|
|
54
|
+
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
55
|
+
{
|
|
56
|
+
"type": "page",
|
|
57
|
+
"entity": "editor",
|
|
58
|
+
"id": 3787,
|
|
59
|
+
"template": 1
|
|
60
|
+
}
|
|
61
|
+
* @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
|
|
62
|
+
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
63
|
+
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
64
|
+
* @param {number} [fileQuery.template] - preview template identifier. Example: 1.
|
|
65
|
+
* @return {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
|
|
66
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
67
|
+
* @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.
|
|
42
68
|
*/
|
|
43
69
|
delete(filename: string, fileQuery?: IUploadingQuery): Promise<any | IError>;
|
|
44
70
|
/**
|
|
45
71
|
* Get file by parameters.
|
|
46
72
|
*
|
|
47
|
-
* @
|
|
48
|
-
*
|
|
49
|
-
* @param {string} [type] - Type, determines the folder name in the storage
|
|
50
|
-
* @param {string} [entity] - entity name, from which the file is uploaded, determines the folder name in the storage
|
|
51
|
-
* @param {string} [filename] - Filename. Example "file.png"
|
|
52
|
-
* @param {string} [template] - preview template identifier. Example 1
|
|
73
|
+
* @handleName getFile
|
|
53
74
|
*
|
|
54
|
-
* @
|
|
75
|
+
* @param {number} [id] - Object identifier, from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
76
|
+
* @param {string} [type] - Type, determines the folder name in the storage. Example: "page".
|
|
77
|
+
* @param {string} [entity] - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
78
|
+
* @param {string} [filename] - Filename. Example: "file.png".
|
|
79
|
+
* @param {string} [template] - Preview template identifier. Example: 1.
|
|
80
|
+
* @return {any} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
|
|
81
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
82
|
+
* @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.
|
|
55
83
|
*/
|
|
56
|
-
getFile(id: number, type: string, entity: string, filename
|
|
84
|
+
getFile(id: number, type: string, entity: string, filename: string, template?: string): Promise<any | IError>;
|
|
57
85
|
}
|
|
@@ -3,11 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
7
|
// import { IFileEntity } from './fileUploadingInterfaces';
|
|
9
8
|
/**
|
|
10
9
|
* Controllers for working with file uploading
|
|
10
|
+
*
|
|
11
|
+
* @handle /api/content/files
|
|
12
|
+
* @class FileUploadingApi
|
|
13
|
+
* @extends AsyncModules
|
|
14
|
+
* @implements {IFileUploading}
|
|
15
|
+
*
|
|
16
|
+
* @description This class provides methods to upload and delete files in a cloud file storage, as well as retrieve files by parameters.
|
|
11
17
|
*/
|
|
12
18
|
class FileUploadingApi extends asyncModules_1.default {
|
|
13
19
|
constructor(state) {
|
|
@@ -25,18 +31,29 @@ class FileUploadingApi extends asyncModules_1.default {
|
|
|
25
31
|
/**
|
|
26
32
|
* Upload file function.
|
|
27
33
|
*
|
|
28
|
-
* @
|
|
34
|
+
* @handleName upload
|
|
29
35
|
*
|
|
30
|
-
* @param {
|
|
31
|
-
* @param {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
* @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
|
|
37
|
+
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
38
|
+
{
|
|
39
|
+
"type": "page",
|
|
40
|
+
"entity": "editor",
|
|
41
|
+
"id": 3787,
|
|
42
|
+
"width": 0,
|
|
43
|
+
"height": 0,
|
|
44
|
+
"compress": true,
|
|
45
|
+
"template": 1
|
|
46
|
+
}
|
|
47
|
+
* @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
|
|
48
|
+
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
49
|
+
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
50
|
+
* @param {number} [fileQuery.width] - Optional width parameter. Example: 0.
|
|
51
|
+
* @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
|
|
52
|
+
* @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
|
|
53
|
+
* @param {any} [fileQuery.template] - preview template identifier. Example: 1.
|
|
54
|
+
* @return {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
|
|
55
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
56
|
+
* @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.
|
|
40
57
|
*/
|
|
41
58
|
async upload(file, fileQuery) {
|
|
42
59
|
const query = { ...this._defaultQuery, ...fileQuery };
|
|
@@ -48,42 +65,52 @@ class FileUploadingApi extends asyncModules_1.default {
|
|
|
48
65
|
/**
|
|
49
66
|
* Deletes a file from the cloud file storage.
|
|
50
67
|
*
|
|
51
|
-
* @
|
|
52
|
-
*
|
|
53
|
-
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
|
|
54
|
-
* @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page"
|
|
55
|
-
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor"
|
|
56
|
-
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787
|
|
57
|
-
* @param {number} [fileQuery.template] - preview template identifier. Example: 1
|
|
68
|
+
* @handleName delete
|
|
58
69
|
*
|
|
59
|
-
* @
|
|
70
|
+
* @param {string} [filename] - File name. Example: "file.png".
|
|
71
|
+
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
72
|
+
{
|
|
73
|
+
"type": "page",
|
|
74
|
+
"entity": "editor",
|
|
75
|
+
"id": 3787,
|
|
76
|
+
"template": 1
|
|
77
|
+
}
|
|
78
|
+
* @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
|
|
79
|
+
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
80
|
+
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
81
|
+
* @param {number} [fileQuery.template] - preview template identifier. Example: 1.
|
|
82
|
+
* @return {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
|
|
83
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
84
|
+
* @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.
|
|
60
85
|
*/
|
|
61
86
|
async delete(filename, fileQuery) {
|
|
62
87
|
const query = { ...this._defaultQuery, ...fileQuery };
|
|
63
88
|
const result = await this._fetchDelete(`?filename=${filename}&` + this._queryParamsToString(query));
|
|
64
|
-
return result
|
|
89
|
+
return result;
|
|
65
90
|
}
|
|
66
91
|
/**
|
|
67
92
|
* Get file by parameters.
|
|
68
93
|
*
|
|
69
|
-
* @
|
|
70
|
-
*
|
|
71
|
-
* @param {string} [type] - Type, determines the folder name in the storage
|
|
72
|
-
* @param {string} [entity] - entity name, from which the file is uploaded, determines the folder name in the storage
|
|
73
|
-
* @param {string} [filename] - Filename. Example "file.png"
|
|
74
|
-
* @param {string} [template] - preview template identifier. Example 1
|
|
94
|
+
* @handleName getFile
|
|
75
95
|
*
|
|
76
|
-
* @
|
|
96
|
+
* @param {number} [id] - Object identifier, from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
97
|
+
* @param {string} [type] - Type, determines the folder name in the storage. Example: "page".
|
|
98
|
+
* @param {string} [entity] - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
99
|
+
* @param {string} [filename] - Filename. Example: "file.png".
|
|
100
|
+
* @param {string} [template] - Preview template identifier. Example: 1.
|
|
101
|
+
* @return {any} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
|
|
102
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
103
|
+
* @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.
|
|
77
104
|
*/
|
|
78
105
|
async getFile(id, type, entity, filename, template) {
|
|
79
|
-
const response = await fetch(this._getFullPath(`?id=${id}&type=${type}&entity=${entity}${
|
|
106
|
+
const response = await fetch(this._getFullPath(`?id=${id}&type=${type}&entity=${entity}${`&filename=${filename}`}${template ? `&template=${template}` : ''}`), {
|
|
80
107
|
method: 'GET',
|
|
81
108
|
headers: {
|
|
82
109
|
'Content-Type': 'application/json',
|
|
83
110
|
'x-app-token': this.state.token,
|
|
84
111
|
},
|
|
85
112
|
});
|
|
86
|
-
return response
|
|
113
|
+
return response;
|
|
87
114
|
}
|
|
88
115
|
}
|
|
89
116
|
exports.default = FileUploadingApi;
|
|
@@ -1,30 +1,100 @@
|
|
|
1
1
|
import type { IError } from '../base/utils';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Interface for uploading, deleting, and retrieving files in the CMS.
|
|
4
|
+
*
|
|
5
|
+
* @interface IFileUploading
|
|
4
6
|
*
|
|
5
7
|
* @property {function} upload - Upload file from CMS.
|
|
6
8
|
* @property {function} delete - Delete file from CMS.
|
|
7
9
|
* @property {function} getFile - Get file by parameters.
|
|
10
|
+
* @description This interface defines methods for uploading, deleting, and retrieving files in the CMS.
|
|
8
11
|
*/
|
|
9
12
|
interface IFileUploading {
|
|
10
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Upload file function.
|
|
15
|
+
*
|
|
16
|
+
* @handleName upload
|
|
17
|
+
*
|
|
18
|
+
* @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
|
|
19
|
+
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
20
|
+
{
|
|
21
|
+
"type": "page",
|
|
22
|
+
"entity": "editor",
|
|
23
|
+
"id": 3787,
|
|
24
|
+
"width": 0,
|
|
25
|
+
"height": 0,
|
|
26
|
+
"compress": true,
|
|
27
|
+
"template": 1
|
|
28
|
+
}
|
|
29
|
+
* @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
|
|
30
|
+
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
31
|
+
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
32
|
+
* @param {number} [fileQuery.width] - Optional width parameter. Example: 0.
|
|
33
|
+
* @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
|
|
34
|
+
* @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
|
|
35
|
+
* @param {any} [fileQuery.template] - preview template identifier. Example: 1.
|
|
36
|
+
* @return {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
|
|
37
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
38
|
+
* @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.
|
|
39
|
+
*/
|
|
40
|
+
upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
|
|
41
|
+
/**
|
|
42
|
+
* Deletes a file from the cloud file storage.
|
|
43
|
+
*
|
|
44
|
+
* @handleName delete
|
|
45
|
+
*
|
|
46
|
+
* @param {string} [filename] - File name. Example: "file.png".
|
|
47
|
+
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
48
|
+
{
|
|
49
|
+
"type": "page",
|
|
50
|
+
"entity": "editor",
|
|
51
|
+
"id": 3787,
|
|
52
|
+
"template": 1
|
|
53
|
+
}
|
|
54
|
+
* @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
|
|
55
|
+
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
56
|
+
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
57
|
+
* @param {number} [fileQuery.template] - preview template identifier. Example: 1.
|
|
58
|
+
* @return {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
|
|
59
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
60
|
+
* @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.
|
|
61
|
+
*/
|
|
11
62
|
delete(filename: string, fileQuery?: IUploadingQuery): Promise<any | IError>;
|
|
12
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves a file by its parameters.
|
|
65
|
+
*
|
|
66
|
+
* @param {number} id - The ID of the file entity. Example: 3787.
|
|
67
|
+
* @param {string} type - The type of the file. Example: "page".
|
|
68
|
+
* @param {string} entity - The entity associated with the file. Example: "editor".
|
|
69
|
+
* @param {string} [filename] - Optional filename to retrieve. Example: "file.png".
|
|
70
|
+
* @return {Blob} A promise that resolves to a Blob object or an error.
|
|
71
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
72
|
+
*/
|
|
73
|
+
getFile(id: number, type: string, entity: string, filename?: string): Promise<any | IError>;
|
|
13
74
|
}
|
|
14
75
|
/**
|
|
15
|
-
*
|
|
76
|
+
* Represents a file entity with a file object or string path.
|
|
77
|
+
*
|
|
78
|
+
* @interface IFileEntity
|
|
79
|
+
*
|
|
80
|
+
* @property {File | string | null} file - File object or string representing the file path. Example: new File(["content"], "file.png", { "type": "image/png" }) or "/path/to/file.png".
|
|
81
|
+
* @description Represents a file entity that may contain a file object or a path as a string.
|
|
16
82
|
*/
|
|
17
83
|
interface IFileEntity {
|
|
18
84
|
file: File | string | null;
|
|
19
85
|
}
|
|
20
86
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @
|
|
24
|
-
*
|
|
25
|
-
* @property {
|
|
26
|
-
* @property {
|
|
27
|
-
* @property {
|
|
87
|
+
* Represents a query for uploading files, including type, entity, and optional parameters like width, height, and compression.
|
|
88
|
+
*
|
|
89
|
+
* @interface IUploadingQuery
|
|
90
|
+
*
|
|
91
|
+
* @property {string} type - Type, determines the folder name in the storage. Example: "page".
|
|
92
|
+
* @property {string} entity - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
93
|
+
* @property {number} id - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
94
|
+
* @property {number} [width] - Width parameter. Example: 0.
|
|
95
|
+
* @property {number} [height] - Height parameter. Example: 0.
|
|
96
|
+
* @property {boolean} [compress] - Flag of optimization (compression) for images. Example: true.
|
|
97
|
+
* @description Represents a query for uploading files, including type, entity, and optional parameters like width, height, and compression.
|
|
28
98
|
*/
|
|
29
99
|
interface IUploadingQuery {
|
|
30
100
|
type: string | null;
|
|
@@ -33,15 +103,18 @@ interface IUploadingQuery {
|
|
|
33
103
|
[key: string]: string | number | boolean | null;
|
|
34
104
|
}
|
|
35
105
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* @
|
|
39
|
-
*
|
|
106
|
+
* Represents the return value of an uploading operation, including the filename, download link, and file size.
|
|
107
|
+
*
|
|
108
|
+
* @interface IUploadingReturn
|
|
109
|
+
*
|
|
110
|
+
* @property {string} filename - Filename with relative path. Example: "uploads/file.png".
|
|
111
|
+
* @property {string} downloadLink - Link for downloading the file. Example: "https://example.com/uploads/file.png".
|
|
112
|
+
* @property {number} size - Size of the file in bytes. Example: 1024.
|
|
113
|
+
* @description Represents the return value of an uploading operation, including the filename, download link, and file size.
|
|
40
114
|
*/
|
|
41
115
|
interface IUploadingReturn {
|
|
42
116
|
filename: string;
|
|
43
117
|
downloadLink: string;
|
|
44
118
|
size: number;
|
|
45
119
|
}
|
|
46
|
-
type
|
|
47
|
-
export type { IFileEntity, IFileUploading, IUploadingQuery, IUploadingReturns };
|
|
120
|
+
export type { IFileEntity, IFileUploading, IUploadingQuery, IUploadingReturn };
|
package/dist/forms/formsApi.d.ts
CHANGED
|
@@ -4,7 +4,12 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IForms, IFormsEntity } from './formsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for forms objects
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
|
+
* @class FormsApi
|
|
9
|
+
* @extends AsyncModules
|
|
10
|
+
* @implements {IForms}
|
|
11
|
+
*
|
|
12
|
+
* @description This class provides methods to interact with forms, including retrieving all forms and getting a form by its marker.
|
|
8
13
|
*/
|
|
9
14
|
export default class FormsApi extends AsyncModules implements IForms {
|
|
10
15
|
protected state: StateModule;
|
|
@@ -13,20 +18,26 @@ export default class FormsApi extends AsyncModules implements IForms {
|
|
|
13
18
|
/**
|
|
14
19
|
* Get all forms.
|
|
15
20
|
*
|
|
16
|
-
* @
|
|
17
|
-
* @param {number} [offset] - Parameter for pagination. Default 0
|
|
18
|
-
* @param {number} [limit] - Parameter for pagination. Default 30
|
|
21
|
+
* @handleName getAllForms
|
|
19
22
|
*
|
|
20
|
-
* @
|
|
23
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
24
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
25
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
26
|
+
* @return {IFormsEntity[]} Returns array for all objects of type FormEntity.
|
|
27
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
28
|
+
* @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.
|
|
21
29
|
*/
|
|
22
|
-
getAllForms(langCode?: string, offset?: number, limit?: number): Promise<
|
|
30
|
+
getAllForms(langCode?: string, offset?: number, limit?: number): Promise<IFormsEntity[] | IError>;
|
|
23
31
|
/**
|
|
24
32
|
* Get one form by form marker.
|
|
25
33
|
*
|
|
26
|
-
* @
|
|
27
|
-
* @param {string} [langCode] - Language code. Default "en_US"
|
|
34
|
+
* @handleName getFormByMarker
|
|
28
35
|
*
|
|
29
|
-
* @
|
|
36
|
+
* @param {string} marker - Marker of form. Example: "contact_form".
|
|
37
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
38
|
+
* @return {IFormsEntity} Returns object of type FormEntity.
|
|
39
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
40
|
+
* @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.
|
|
30
41
|
*/
|
|
31
42
|
getFormByMarker(marker: string, langCode?: string): Promise<IFormsEntity | IError>;
|
|
32
43
|
}
|
package/dist/forms/formsApi.js
CHANGED
|
@@ -6,7 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
8
|
* Controllers for forms objects
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
|
+
* @class FormsApi
|
|
11
|
+
* @extends AsyncModules
|
|
12
|
+
* @implements {IForms}
|
|
13
|
+
*
|
|
14
|
+
* @description This class provides methods to interact with forms, including retrieving all forms and getting a form by its marker.
|
|
10
15
|
*/
|
|
11
16
|
class FormsApi extends asyncModules_1.default {
|
|
12
17
|
constructor(state) {
|
|
@@ -16,11 +21,14 @@ class FormsApi extends asyncModules_1.default {
|
|
|
16
21
|
/**
|
|
17
22
|
* Get all forms.
|
|
18
23
|
*
|
|
19
|
-
* @
|
|
20
|
-
* @param {number} [offset] - Parameter for pagination. Default 0
|
|
21
|
-
* @param {number} [limit] - Parameter for pagination. Default 30
|
|
24
|
+
* @handleName getAllForms
|
|
22
25
|
*
|
|
23
|
-
* @
|
|
26
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
27
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
28
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
29
|
+
* @return {IFormsEntity[]} Returns array for all objects of type FormEntity.
|
|
30
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
31
|
+
* @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
32
|
*/
|
|
25
33
|
async getAllForms(langCode = this.state.lang, offset = 0, limit = 30) {
|
|
26
34
|
const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
@@ -29,10 +37,13 @@ class FormsApi extends asyncModules_1.default {
|
|
|
29
37
|
/**
|
|
30
38
|
* Get one form by form marker.
|
|
31
39
|
*
|
|
32
|
-
* @
|
|
33
|
-
* @param {string} [langCode] - Language code. Default "en_US"
|
|
40
|
+
* @handleName getFormByMarker
|
|
34
41
|
*
|
|
35
|
-
* @
|
|
42
|
+
* @param {string} marker - Marker of form. Example: "contact_form".
|
|
43
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
44
|
+
* @return {IFormsEntity} Returns object of type FormEntity.
|
|
45
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
46
|
+
* @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.
|
|
36
47
|
*/
|
|
37
48
|
async getFormByMarker(marker, langCode = this.state.lang) {
|
|
38
49
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
@@ -1,39 +1,102 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IPosition } from '../admins/adminsInterfaces';
|
|
2
|
+
import type { IAttributes, IError, ILocalizeInfo } from '../base/utils';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* Interface for retrieving forms in the system.
|
|
5
|
+
*
|
|
6
|
+
* @interface IForms
|
|
4
7
|
*
|
|
5
8
|
* @property {function} getAllForms - Get all forms in array.
|
|
6
9
|
* @property {function} getFormByMarker - Get one form by form marker.
|
|
10
|
+
* @description This interface defines methods for retrieving forms in the system.
|
|
7
11
|
*/
|
|
8
12
|
interface IForms {
|
|
9
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves all forms in the system.
|
|
15
|
+
*
|
|
16
|
+
* @param {string} [langCode] - The language code for localization. Default: "en_US".
|
|
17
|
+
* @param {number} [offset] - Optional offset for pagination. Default: 0.
|
|
18
|
+
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
19
|
+
* @return {IFormsEntity[]} A promise that resolves to an array of form entities or an error.
|
|
20
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
21
|
+
*/
|
|
22
|
+
getAllForms(langCode: string, offset?: number, limit?: number): Promise<IFormsEntity[] | IError>;
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves a form by its marker.
|
|
25
|
+
*
|
|
26
|
+
* @param {string} marker - The marker identifying the form. Example: "contact_form".
|
|
27
|
+
* @param {string} [langCode] - The language code for localization. Default: "en_US".
|
|
28
|
+
* @return {IFormsEntity} A promise that resolves to a form entity or an error.
|
|
29
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
30
|
+
*/
|
|
10
31
|
getFormByMarker(marker: string, langCode: string): Promise<IFormsEntity | IError>;
|
|
11
32
|
}
|
|
12
33
|
/**
|
|
13
|
-
* Represents
|
|
34
|
+
* Represents the structure of a form page.
|
|
35
|
+
*
|
|
36
|
+
* @interface IFromPages
|
|
37
|
+
*
|
|
38
|
+
* @property {number} id - The unique identifier of the form page. Example: 123.
|
|
39
|
+
* @property {number} pageId - The identifier of the page. Example: 12.
|
|
40
|
+
* @property {number} formId - The identifier of the form. Example: 321.
|
|
41
|
+
* @property {number} positionId - The identifier of the position. Example: 1.
|
|
42
|
+
* @property {IPosition} position - The position object. Example:
|
|
43
|
+
{
|
|
44
|
+
"id": 1,
|
|
45
|
+
"position": 1,
|
|
46
|
+
"objectId": 2,
|
|
47
|
+
"objectType": "admin",
|
|
48
|
+
"isLocked": false,
|
|
49
|
+
"objectCategoryId": 1
|
|
50
|
+
}
|
|
51
|
+
* @description This interface defines the structure of a form page.
|
|
52
|
+
*/
|
|
53
|
+
interface IFromPages {
|
|
54
|
+
id: number;
|
|
55
|
+
pageId: number;
|
|
56
|
+
formId: number;
|
|
57
|
+
positionId: number;
|
|
58
|
+
position: IPosition;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Represents the structure of a form entity.
|
|
62
|
+
*
|
|
63
|
+
* @interface IFormsEntity
|
|
14
64
|
*
|
|
15
|
-
* @
|
|
16
|
-
* @property {number}
|
|
17
|
-
* @property {
|
|
18
|
-
* @property {
|
|
19
|
-
* @property {
|
|
20
|
-
* @property {
|
|
21
|
-
* @property {
|
|
22
|
-
* @property {
|
|
23
|
-
* @property {
|
|
24
|
-
* @property {string}
|
|
25
|
-
* @
|
|
65
|
+
* @property {number} id - The identifier of the object. Example: 12345.
|
|
66
|
+
* @property {number | null} attributeSetId - The identifier of the attribute set being used, or null if not applicable. Example: 1234.
|
|
67
|
+
* @property {string | null} type - Form type. Example: "contact".
|
|
68
|
+
* @property {ILocalizeInfo} localizeInfos - The name of the form, taking into account localization. Example: {"key": "value"}.
|
|
69
|
+
* @property {number} version - The version number of the object. Example: 1.
|
|
70
|
+
* @property {number} position - The position of the object. Example: 1.
|
|
71
|
+
* @property {string} identifier - The textual identifier for the record field. Example: "form_contact_us".
|
|
72
|
+
* @property {string} processingType - Type of form processing. Example: "async".
|
|
73
|
+
* @property {number | null} templateId - The identifier of the template used by the form, or null if no template is used. Example: 6789.
|
|
74
|
+
* @property {IAttributes[] | Record<string, any>} attributes - The attributes of the form, which can be an array of attribute objects or a record of key-value pairs. Example: {"key": "value"}.
|
|
75
|
+
* @description This interface defines the structure of a form entity, including its identifiers, attributes, and processing data.
|
|
26
76
|
*/
|
|
27
77
|
interface IFormsEntity {
|
|
28
|
-
attributeSetId: number | null;
|
|
29
|
-
attributes: Array<IAttributes> | Record<string, any>;
|
|
30
78
|
id: number;
|
|
31
|
-
|
|
32
|
-
localizeInfos: Record<string, any>;
|
|
33
|
-
templateId: number | null;
|
|
34
|
-
position: number;
|
|
79
|
+
attributeSetId: number | null;
|
|
35
80
|
type: string | null;
|
|
36
|
-
|
|
81
|
+
localizeInfos: ILocalizeInfo;
|
|
37
82
|
version: number;
|
|
83
|
+
position: number;
|
|
84
|
+
identifier: string;
|
|
85
|
+
processingType: string;
|
|
86
|
+
templateId: number | null;
|
|
87
|
+
attributes: IAttributes[] | Record<string, any>;
|
|
88
|
+
moduleFormConfigs?: Array<IFormConfig>;
|
|
89
|
+
}
|
|
90
|
+
interface IFormConfig {
|
|
91
|
+
id: number;
|
|
92
|
+
moduleIdentifier: string;
|
|
93
|
+
isGlobal: boolean;
|
|
94
|
+
isClosed: boolean;
|
|
95
|
+
viewOnlyUserData: boolean;
|
|
96
|
+
commentOnlyUserData: boolean;
|
|
97
|
+
entityIdentifiers: {
|
|
98
|
+
id: string;
|
|
99
|
+
isNested: boolean;
|
|
100
|
+
}[];
|
|
38
101
|
}
|
|
39
|
-
export type { IForms, IFormsEntity };
|
|
102
|
+
export type { IFormConfig, IForms, IFormsEntity, IFromPages };
|