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