oneentry 1.0.130 → 1.0.133

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.
Files changed (55) hide show
  1. package/dist/admins/adminsApi.d.ts +2 -2
  2. package/dist/admins/adminsApi.js +2 -2
  3. package/dist/admins/adminsInterfaces.d.ts +4 -3
  4. package/dist/attribute-sets/attributeSetsApi.d.ts +0 -4
  5. package/dist/attribute-sets/attributeSetsApi.js +1 -5
  6. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +43 -32
  7. package/dist/auth-provider/authProviderApi.d.ts +18 -9
  8. package/dist/auth-provider/authProviderApi.js +18 -9
  9. package/dist/auth-provider/authProvidersInterfaces.d.ts +36 -18
  10. package/dist/base/syncModules.js +7 -3
  11. package/dist/blocks/blocksApi.d.ts +0 -4
  12. package/dist/blocks/blocksApi.js +0 -4
  13. package/dist/blocks/blocksInterfaces.d.ts +25 -17
  14. package/dist/config.d.ts +1 -1
  15. package/dist/config.js +3 -1
  16. package/dist/events/eventsApi.d.ts +6 -3
  17. package/dist/events/eventsApi.js +6 -3
  18. package/dist/events/eventsInterfaces.d.ts +2 -1
  19. package/dist/file-uploading/fileUploadingApi.d.ts +14 -6
  20. package/dist/file-uploading/fileUploadingApi.js +22 -6
  21. package/dist/file-uploading/fileUploadingInterfaces.d.ts +21 -13
  22. package/dist/forms/formsApi.d.ts +0 -2
  23. package/dist/forms/formsApi.js +0 -2
  24. package/dist/forms/formsInterfaces.d.ts +12 -3
  25. package/dist/forms-data/formsDataApi.d.ts +14 -20
  26. package/dist/forms-data/formsDataApi.js +17 -22
  27. package/dist/forms-data/formsDataInterfaces.d.ts +46 -37
  28. package/dist/integration-collections/integrationCollectionsApi.d.ts +10 -10
  29. package/dist/integration-collections/integrationCollectionsApi.js +10 -10
  30. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +20 -10
  31. package/dist/menus/menusInterfaces.d.ts +13 -5
  32. package/dist/orders/ordersApi.d.ts +16 -8
  33. package/dist/orders/ordersApi.js +16 -8
  34. package/dist/orders/ordersInterfaces.d.ts +50 -30
  35. package/dist/pages/pagesApi.d.ts +2 -1
  36. package/dist/pages/pagesApi.js +2 -1
  37. package/dist/pages/pagesInterfaces.d.ts +29 -12
  38. package/dist/payments/paymentsApi.d.ts +20 -12
  39. package/dist/payments/paymentsApi.js +20 -12
  40. package/dist/payments/paymentsInterfaces.d.ts +25 -7
  41. package/dist/product-statuses/productStatusesInterfaces.d.ts +5 -4
  42. package/dist/products/productsApi.d.ts +28 -15
  43. package/dist/products/productsApi.js +28 -15
  44. package/dist/products/productsInterfaces.d.ts +53 -25
  45. package/dist/system/systemApi.d.ts +2 -1
  46. package/dist/system/systemApi.js +2 -1
  47. package/dist/templates/templatesInterfaces.d.ts +3 -2
  48. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +8 -4
  49. package/dist/users/usersApi.d.ts +65 -14
  50. package/dist/users/usersApi.js +65 -14
  51. package/dist/users/usersInterfaces.d.ts +95 -26
  52. package/dist/web-socket/wsApi.d.ts +2 -1
  53. package/dist/web-socket/wsApi.js +2 -1
  54. package/dist/web-socket/wsInterfaces.d.ts +3 -2
  55. package/package.json +1 -1
@@ -29,7 +29,6 @@ class BlocksApi extends asyncModules_1.default {
29
29
  * @param {number} [limit] - Parameter for pagination. Default: 30.
30
30
  * @returns {IBlocksResponse} Returns BlocksEntity object.
31
31
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
32
- * @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.
33
32
  */
34
33
  async getBlocks(type = '', langCode = this.state.lang, offset = 0, limit = 30) {
35
34
  const response = await this._fetchPost(`?langCode=${langCode}&type=${type}&offset=${offset}&limit=${limit}`);
@@ -135,7 +134,6 @@ class BlocksApi extends asyncModules_1.default {
135
134
  * @param {number} [limit] - Parameter for pagination. Default: 30.
136
135
  * @returns {IProductsResponse} - Returns the total count and an array of product items in object by specified block marker.
137
136
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
138
- * @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.
139
137
  */
140
138
  async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30) {
141
139
  const query = {
@@ -155,7 +153,6 @@ class BlocksApi extends asyncModules_1.default {
155
153
  * @param {number} [limit] - Parameter for pagination. Default: 30.
156
154
  * @returns {IProductsEntity[]} Return array of BlocksEntity object.
157
155
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
158
- * @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.
159
156
  */
160
157
  async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
161
158
  const query = {
@@ -173,7 +170,6 @@ class BlocksApi extends asyncModules_1.default {
173
170
  * @param {string} [langCode] - Language code. Default: "en_US".
174
171
  * @returns {ISearchBlock[]} Returns an array of ISearchBlock objects.
175
172
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
176
- * @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.
177
173
  */
178
174
  async searchBlock(name, langCode = this.state.lang) {
179
175
  const result = await this._fetchGet(`/quick/search?langCode=${langCode}&name=${name}`);
@@ -50,7 +50,8 @@ interface IBlocks {
50
50
  * Represents a response from the blocks API.
51
51
  * @interface IBlocksResponse
52
52
  * @property {number} total - Total number of found records. Example: 100.
53
- * @property {IBlockEntity[]} items - Array of block entities. Example:
53
+ * @property {IBlockEntity[]} items - Array of block entities.
54
+ * @example
54
55
  [
55
56
  {
56
57
  "attributeValues": [],
@@ -89,7 +90,8 @@ interface IBlocksResponse {
89
90
  /**
90
91
  * Represents a block entity with various attributes and properties.
91
92
  * @interface IBlockEntity
92
- * @property {AttributeType} attributeValues - Type of attributes used in the block. Example:
93
+ * @property {AttributeType} attributeValues - Type of attributes used in the block.
94
+ * @example
93
95
  {
94
96
  "block-text": {
95
97
  "type": "string",
@@ -101,7 +103,11 @@ interface IBlocksResponse {
101
103
  }
102
104
  }
103
105
  * @property {number} id - Unique identifier of the block. Example: 1234.
104
- * @property {ILocalizeInfo} localizeInfos - Localization information for the block. Example: {"key": "value"}
106
+ * @property {ILocalizeInfo} localizeInfos - Localization information for the block.
107
+ * @example
108
+ {
109
+ "key": "value"
110
+ }
105
111
  * @property {number} version - Version of the block entity. Example: 1.
106
112
  * @property {string} identifier - Unique string identifier for the block. Example: "block1".
107
113
  * @property {string} type - Type of the block, such as 'product', 'error_page', etc. Example: "product".
@@ -109,22 +115,24 @@ interface IBlocksResponse {
109
115
  * @property {boolean} isVisible - Indicates whether the block is visible. Example: true.
110
116
  * @property {number} [countElementsPerRow] - Number of elements displayed per row in the block, if applicable. Example: 3.
111
117
  * @property {number} [quantity] - Quantity of items in the block, if applicable. Example: 5.
112
- * @property {IProductsResponse} [similarProducts] - Response containing similar products associated with the block. Example:
113
- {
114
- "total": 10,
115
- "items": []
116
- }
117
- * @property {IProductsEntity[]} [products] - Array of product entities associated with the block. Example:
118
- [
118
+ * @property {IProductsResponse} [similarProducts] - Response containing similar products associated with the block.
119
+ * @example
119
120
  {
120
- "id": 1,
121
- "name": "Product 1"
122
- },
123
- {
124
- "id": 2,
125
- "name": "Product 2"
121
+ "total": 10,
122
+ "items": []
126
123
  }
127
- ]
124
+ * @property {IProductsEntity[]} [products] - Array of product entities associated with the block.
125
+ * @example
126
+ [
127
+ {
128
+ "id": 1,
129
+ "name": "Product 1"
130
+ },
131
+ {
132
+ "id": 2,
133
+ "name": "Product 2"
134
+ }
135
+ ]
128
136
  * @description Represents a block entity with various attributes and properties.
129
137
  */
130
138
  interface IBlockEntity {
package/dist/config.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const projectUrl = "https://stage.oneentry.cloud";
1
+ export declare const projectUrl = "https://js-sdk-tests.oneentry.cloud";
2
2
  export declare const projectToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiTlBNIiwic2VyaWFsTnVtYmVyIjozLCJpYXQiOjE3NDA1OTE0MzgsImV4cCI6MTc3MjEyNzQzMX0.MWbtBoXh-MqGTWgmiMTZSkfN8N-WYv3Cv2kSPhRpFlk";
3
3
  /**
4
4
  * authData
package/dist/config.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.authData2 = exports.authData = exports.projectToken = exports.projectUrl = void 0;
4
- exports.projectUrl = 'https://stage.oneentry.cloud';
4
+ // export const projectUrl = 'https://stage.oneentry.cloud';
5
+ // export const projectToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiTlBNIiwic2VyaWFsTnVtYmVyIjozLCJpYXQiOjE3NDA1OTE0MzgsImV4cCI6MTc3MjEyNzQzMX0.MWbtBoXh-MqGTWgmiMTZSkfN8N-WYv3Cv2kSPhRpFlk';
6
+ exports.projectUrl = 'https://js-sdk-tests.oneentry.cloud';
5
7
  exports.projectToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiTlBNIiwic2VyaWFsTnVtYmVyIjozLCJpYXQiOjE3NDA1OTE0MzgsImV4cCI6MTc3MjEyNzQzMX0.MWbtBoXh-MqGTWgmiMTZSkfN8N-WYv3Cv2kSPhRpFlk';
6
8
  /**
7
9
  * authData
@@ -29,7 +29,8 @@ export default class EventsApi extends AsyncModules implements IEvents {
29
29
  * @param {number} [limit] - Optional limit for pagination. Default: 30.
30
30
  * @returns {ISubscriptions} Returns an object containing all subscriptions or an error object if there was an issue.
31
31
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
32
- * @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.
32
+ * @description This method requires user authorization.
33
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
33
34
  */
34
35
  getAllSubscriptions(offset?: number, limit?: number): Promise<ISubscriptions | IError>;
35
36
  /**
@@ -40,7 +41,8 @@ export default class EventsApi extends AsyncModules implements IEvents {
40
41
  * @param {string} [langCode] - Language code. Default: "en_US".=
41
42
  * @returns {Promise<boolean | IError>} Returns true if subscription was successful, or an error object if there was an issue.
42
43
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
43
- * @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.
44
+ * @description This method requires user authorization.
45
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
44
46
  */
45
47
  subscribeByMarker(marker: string, productId: number, langCode?: string): Promise<boolean | IError>;
46
48
  /**
@@ -51,7 +53,8 @@ export default class EventsApi extends AsyncModules implements IEvents {
51
53
  * @param {string} [langCode] - Language code. Default: "en_US".
52
54
  * @returns {any} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
53
55
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
54
- * @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.
56
+ * @description This method requires user authorization.
57
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
55
58
  */
56
59
  unsubscribeByMarker(marker: string, productId: number, langCode?: string): Promise<boolean | IError>;
57
60
  }
@@ -34,7 +34,8 @@ class EventsApi extends asyncModules_1.default {
34
34
  * @param {number} [limit] - Optional limit for pagination. Default: 30.
35
35
  * @returns {ISubscriptions} Returns an object containing all subscriptions or an error object if there was an issue.
36
36
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
37
- * @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.
37
+ * @description This method requires user authorization.
38
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
38
39
  */
39
40
  async getAllSubscriptions(offset = 0, limit = 30) {
40
41
  const query = {
@@ -52,7 +53,8 @@ class EventsApi extends asyncModules_1.default {
52
53
  * @param {string} [langCode] - Language code. Default: "en_US".=
53
54
  * @returns {Promise<boolean | IError>} Returns true if subscription was successful, or an error object if there was an issue.
54
55
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
55
- * @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.
56
+ * @description This method requires user authorization.
57
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
56
58
  */
57
59
  async subscribeByMarker(marker, productId, langCode = this.state.lang) {
58
60
  const body = {
@@ -75,7 +77,8 @@ class EventsApi extends asyncModules_1.default {
75
77
  * @param {string} [langCode] - Language code. Default: "en_US".
76
78
  * @returns {any} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
77
79
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
78
- * @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.
80
+ * @description This method requires user authorization.
81
+ * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
79
82
  */
80
83
  async unsubscribeByMarker(marker, productId, langCode = this.state.lang) {
81
84
  const body = {
@@ -42,7 +42,8 @@ interface IEvents {
42
42
  * Represents a response from the events API containing a total count and an array of subscription items.
43
43
  * @interface ISubscriptions
44
44
  * @property {number} total - Total number of found records. Example: 100.
45
- * @property {{ eventMarker: string; productId: number }[]} items - Array of subscription items, each containing an event marker and a product ID. Example:
45
+ * @property {{ eventMarker: string; productId: number }[]} items - Array of subscription items, each containing an event marker and a product ID.
46
+ * @example
46
47
  [
47
48
  {
48
49
  eventMarker: 'product_price_change',
@@ -14,15 +14,17 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
14
14
  protected state: StateModule;
15
15
  protected _url: string;
16
16
  /**
17
- *
17
+ * Constructs a new instance of the FileUploadingApi class.
18
18
  */
19
19
  constructor(state: StateModule);
20
+ /** FileUploadingApi class */
20
21
  private _defaultQuery;
21
22
  /**
22
23
  * Upload file function.
23
24
  * @handleName upload
24
25
  * @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
25
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
26
+ * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
27
+ * @example
26
28
  {
27
29
  "type": "page",
28
30
  "entity": "editor",
@@ -41,14 +43,14 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
41
43
  * @param {any} [fileQuery.template] - preview template identifier. Example: 1.
42
44
  * @returns {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
43
45
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
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.
45
46
  */
46
47
  upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
47
48
  /**
48
49
  * Deletes a file from the cloud file storage.
49
50
  * @handleName delete
50
51
  * @param {string} filename - File name. Example: "file.png".
51
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
52
+ * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
53
+ * @example
52
54
  {
53
55
  "type": "page",
54
56
  "entity": "editor",
@@ -61,9 +63,16 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
61
63
  * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
62
64
  * @returns {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
63
65
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
64
- * @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.
65
66
  */
66
67
  delete(filename: string, fileQuery?: IUploadingQuery): Promise<any | IError>;
68
+ /**
69
+ * Create a File object from a URL.
70
+ * @param {string} url - The URL to fetch the file from.
71
+ * @param {string} filename - The name to give the created file.
72
+ * @param {string} [mimeType] - Optional MIME type for the file.
73
+ * @returns {Promise<File>} A promise that resolves to a File object.
74
+ */
75
+ createFileFromUrl(url: string, filename: string, mimeType?: string): Promise<File>;
67
76
  /**
68
77
  * Get file by parameters.
69
78
  * @handleName getFile
@@ -74,7 +83,6 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
74
83
  * @param {string} [template] - Preview template identifier. Example: 1.
75
84
  * @returns {any} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
76
85
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
77
- * @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.
78
86
  */
79
87
  getFile(id: number, type: string, entity: string, filename: string, template?: string): Promise<any | IError>;
80
88
  }
@@ -4,6 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  /* eslint-disable jsdoc/reject-any-type */
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ /// <reference lib="dom" />
7
9
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
8
10
  // import { IFileEntity } from './fileUploadingInterfaces';
9
11
  /**
@@ -16,10 +18,11 @@ const asyncModules_1 = __importDefault(require("../base/asyncModules"));
16
18
  */
17
19
  class FileUploadingApi extends asyncModules_1.default {
18
20
  /**
19
- *
21
+ * Constructs a new instance of the FileUploadingApi class.
20
22
  */
21
23
  constructor(state) {
22
24
  super(state);
25
+ /** FileUploadingApi class */
23
26
  this._defaultQuery = {
24
27
  type: null,
25
28
  entity: null,
@@ -34,7 +37,8 @@ class FileUploadingApi extends asyncModules_1.default {
34
37
  * Upload file function.
35
38
  * @handleName upload
36
39
  * @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:
40
+ * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
41
+ * @example
38
42
  {
39
43
  "type": "page",
40
44
  "entity": "editor",
@@ -53,7 +57,6 @@ class FileUploadingApi extends asyncModules_1.default {
53
57
  * @param {any} [fileQuery.template] - preview template identifier. Example: 1.
54
58
  * @returns {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
55
59
  * @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.
57
60
  */
58
61
  async upload(file, fileQuery) {
59
62
  const query = { ...this._defaultQuery, ...fileQuery };
@@ -66,7 +69,8 @@ class FileUploadingApi extends asyncModules_1.default {
66
69
  * Deletes a file from the cloud file storage.
67
70
  * @handleName delete
68
71
  * @param {string} filename - File name. Example: "file.png".
69
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
72
+ * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
73
+ * @example
70
74
  {
71
75
  "type": "page",
72
76
  "entity": "editor",
@@ -79,13 +83,26 @@ class FileUploadingApi extends asyncModules_1.default {
79
83
  * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
80
84
  * @returns {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
81
85
  * @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.
83
86
  */
84
87
  async delete(filename, fileQuery) {
85
88
  const query = { ...this._defaultQuery, ...fileQuery };
86
89
  const result = await this._fetchDelete(`?filename=${filename}&` + this._queryParamsToString(query));
87
90
  return result;
88
91
  }
92
+ /**
93
+ * Create a File object from a URL.
94
+ * @param {string} url - The URL to fetch the file from.
95
+ * @param {string} filename - The name to give the created file.
96
+ * @param {string} [mimeType] - Optional MIME type for the file.
97
+ * @returns {Promise<File>} A promise that resolves to a File object.
98
+ */
99
+ async createFileFromUrl(url, filename, mimeType) {
100
+ // eslint-disable-next-line no-undef
101
+ const response = await fetch(url);
102
+ const blob = await response.blob();
103
+ const file = new File([blob], filename, { type: mimeType || blob.type });
104
+ return file;
105
+ }
89
106
  /**
90
107
  * Get file by parameters.
91
108
  * @handleName getFile
@@ -96,7 +113,6 @@ class FileUploadingApi extends asyncModules_1.default {
96
113
  * @param {string} [template] - Preview template identifier. Example: 1.
97
114
  * @returns {any} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
98
115
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
99
- * @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.
100
116
  */
101
117
  async getFile(id, type, entity, filename, template) {
102
118
  // eslint-disable-next-line no-undef
@@ -8,11 +8,20 @@ import type { IError } from '../base/utils';
8
8
  * @description This interface defines methods for uploading, deleting, and retrieving files in the CMS.
9
9
  */
10
10
  interface IFileUploading {
11
+ /**
12
+ * Create a File object from a URL.
13
+ * @param {string} url - The URL to fetch the file from.
14
+ * @param {string} filename - The name to give the created file.
15
+ * @param {string} [mimeType] - Optional MIME type for the file.
16
+ * @returns {Promise<File>} A promise that resolves to a File object.
17
+ */
18
+ createFileFromUrl(url: string, filename: string, mimeType?: string): Promise<File>;
11
19
  /**
12
20
  * Upload file function.
13
21
  * @handleName upload
14
22
  * @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
15
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
23
+ * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
24
+ * @example
16
25
  {
17
26
  "type": "page",
18
27
  "entity": "editor",
@@ -31,14 +40,14 @@ interface IFileUploading {
31
40
  * @param {any} [fileQuery.template] - preview template identifier. Example: 1.
32
41
  * @returns {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
33
42
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
34
- * @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.
35
43
  */
36
44
  upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
37
45
  /**
38
46
  * Deletes a file from the cloud file storage.
39
47
  * @handleName delete
40
48
  * @param {string} [filename] - File name. Example: "file.png".
41
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
49
+ * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
50
+ * @example
42
51
  {
43
52
  "type": "page",
44
53
  "entity": "editor",
@@ -51,24 +60,23 @@ interface IFileUploading {
51
60
  * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
52
61
  * @returns {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
53
62
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
54
- * @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
63
  */
56
64
  delete(filename: string, fileQuery?: IUploadingQuery): Promise<any | IError>;
57
65
  /**
58
- * Retrieves a file by its parameters.
66
+ * Get file by parameters.
59
67
  * @handleName getFile
60
- * @param {number} id - The ID of the file entity. Example: 3787.
61
- * @param {string} type - The type of the file. Example: "page".
62
- * @param {string} entity - The entity associated with the file. Example: "editor".
63
- * @param {string} [filename] - Optional filename to retrieve. Example: "file.png".
64
- * @returns {Blob} A promise that resolves to a Blob object or an error.
68
+ * @param {number} id - Object identifier, from which the file is uploaded, determines the folder name in the storage. Example: 3787.
69
+ * @param {string} type - Type, determines the folder name in the storage. Example: "page".
70
+ * @param {string} entity - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
71
+ * @param {string} filename - Filename. Example: "file.png".
72
+ * @param {string} [template] - Preview template identifier. Example: 1.
73
+ * @returns {any} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
65
74
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
66
- * @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.
67
75
  */
68
- getFile(id: number, type: string, entity: string, filename?: string): Promise<any | IError>;
76
+ getFile(id: number, type: string, entity: string, filename: string, template?: string): Promise<any | IError>;
69
77
  }
70
78
  /**
71
- * Represents a file entity with a file object or string path.
79
+ * Represents a file entity that may contain a file object or a path as a string.
72
80
  * @interface IFileEntity
73
81
  * @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".
74
82
  * @description Represents a file entity that may contain a file object or a path as a string.
@@ -28,7 +28,6 @@ export default class FormsApi extends AsyncModules implements IForms {
28
28
  * @param {number} [limit] - Parameter for pagination. Default: 30.
29
29
  * @returns {IFormsEntity[]} Returns array for all objects of type FormEntity.
30
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.
32
31
  */
33
32
  getAllForms(langCode?: string, offset?: number, limit?: number): Promise<IFormsEntity[] | IError>;
34
33
  /**
@@ -38,7 +37,6 @@ export default class FormsApi extends AsyncModules implements IForms {
38
37
  * @param {string} [langCode] - Language code. Default: "en_US".
39
38
  * @returns {IFormsEntity} Returns object of type FormEntity.
40
39
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
41
- * @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
40
  */
43
41
  getFormByMarker(marker: string, langCode?: string): Promise<IFormsEntity | IError>;
44
42
  }
@@ -31,7 +31,6 @@ class FormsApi extends asyncModules_1.default {
31
31
  * @param {number} [limit] - Parameter for pagination. Default: 30.
32
32
  * @returns {IFormsEntity[]} Returns array for all objects of type FormEntity.
33
33
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
34
- * @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.
35
34
  */
36
35
  async getAllForms(langCode = this.state.lang, offset = 0, limit = 30) {
37
36
  const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
@@ -44,7 +43,6 @@ class FormsApi extends asyncModules_1.default {
44
43
  * @param {string} [langCode] - Language code. Default: "en_US".
45
44
  * @returns {IFormsEntity} Returns object of type FormEntity.
46
45
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
47
- * @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.
48
46
  */
49
47
  async getFormByMarker(marker, langCode = this.state.lang) {
50
48
  const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
@@ -37,7 +37,8 @@ interface IForms {
37
37
  * @property {number} pageId - The identifier of the page. Example: 12.
38
38
  * @property {number} formId - The identifier of the form. Example: 321.
39
39
  * @property {number} positionId - The identifier of the position. Example: 1.
40
- * @property {IPosition} position - The position object. Example:
40
+ * @property {IPosition} position - The position object.
41
+ * @example
41
42
  {
42
43
  "id": 1,
43
44
  "position": 1,
@@ -61,13 +62,21 @@ interface IFromPages {
61
62
  * @property {number} id - The identifier of the object. Example: 12345.
62
63
  * @property {number | null} attributeSetId - The identifier of the attribute set being used, or null if not applicable. Example: 1234.
63
64
  * @property {string | null} type - Form type. Example: "contact".
64
- * @property {ILocalizeInfo} localizeInfos - The name of the form, taking into account localization. Example: {"key": "value"}.
65
+ * @property {ILocalizeInfo} localizeInfos - The name of the form, taking into account localization.
66
+ * @example
67
+ {
68
+ "key": "value"
69
+ }
65
70
  * @property {number} version - The version number of the object. Example: 1.
66
71
  * @property {number} position - The position of the object. Example: 1.
67
72
  * @property {string} identifier - The textual identifier for the record field. Example: "form_contact_us".
68
73
  * @property {string} processingType - Type of form processing. Example: "async".
69
74
  * @property {number | null} templateId - The identifier of the template used by the form, or null if no template is used. Example: 6789.
70
- * @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
+ * @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.
76
+ * @example
77
+ {
78
+ "key": "value"
79
+ }
71
80
  * @description This interface defines the structure of a form entity, including its identifiers, attributes, and processing data.
72
81
  */
73
82
  interface IFormsEntity {
@@ -1,7 +1,7 @@
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 { IBodyPostFormData, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IPostFormResponse } from './formsDataInterfaces';
4
+ import type { IBodyPostFormData, IFormsByMarkerDataEntity, IFormsData, IPostFormResponse } from './formsDataInterfaces';
5
5
  /**
6
6
  * Controllers for working with form data
7
7
  * @handle /api/content/form-data
@@ -17,21 +17,11 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
17
17
  * Constructor for FormsDataApi class.
18
18
  */
19
19
  constructor(state: StateModule);
20
- /**
21
- * Get all forms data.
22
- * @handleName getFormsData
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
- * @returns {IFormsDataEntity} Returns an object containing all forms data or an error object if there was an issue.
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.
29
- */
30
- getFormsData(langCode?: string, offset?: number, limit?: number): Promise<IFormsDataEntity | IError>;
31
20
  /**
32
21
  * Creating an object of data save information by form
33
22
  * @handleName postFormsData
34
- * @param {IBodyPostFormData} body - Request body. Example:
23
+ * @param {IBodyPostFormData} body - Request body.
24
+ * @example
35
25
  {
36
26
  "formIdentifier": "test-form",
37
27
  "formModuleConfigId": 2,
@@ -47,7 +37,12 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
47
37
  ]
48
38
  }
49
39
  * @param {string} body.formIdentifier - The identifier for the form. Example: "form".
50
- * @param {FormDataType[]} body.formData - Form data. Example:
40
+ * @param {number} body.formModuleConfigId - The ID of the form module configuration. Example: 2.
41
+ * @param {string} body.moduleEntityIdentifier - The identifier of the module entity. Example: "form".
42
+ * @param {string | null} [body.replayTo] - The email address to which the reply should be sent.
43
+ * @param {string | null} [body.status] - The status of the form submission.
44
+ * @param {FormDataType[]} body.formData - Form data.
45
+ * @example
51
46
  [
52
47
  {
53
48
  "marker": "name",
@@ -55,13 +50,12 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
55
50
  "value": "Jack"
56
51
  }
57
52
  ]
58
- * @param {string} body.formData.marker - The marker identifying the form field. Example: "name".
59
- * @param {string} body.formData.type - The type of the form field. Example: "string".
60
- * @param {string} body.formData.value - The value of the form field. Example: "Jack".
53
+ * @param {string} body.formData[].marker - The marker identifying the form field. Example: "name".
54
+ * @param {string} body.formData[].type - The type of the form field. Example: "string".
55
+ * @param {string} body.formData[].value - The value of the form field. Example: "Jack".
61
56
  * @param {string} [langCode] - Language code. Default: "en_US".
62
57
  * @returns {IPostFormResponse} Returns an object containing the created form data entry and message.
63
58
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
64
- * @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.
65
59
  */
66
60
  postFormsData(body: IBodyPostFormData, langCode?: string): Promise<IPostFormResponse | IError>;
67
61
  /**
@@ -69,7 +63,8 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
69
63
  * @handleName getFormsDataByMarker
70
64
  * @param {string} marker - Marker of the form. Example: "contact_form".
71
65
  * @param {number} formModuleConfigId - Form module configuration ID. Example: 4.
72
- * @param {object} [body] - Request body. Example:
66
+ * @param {object} [body] - Request body.
67
+ * @example
73
68
  {
74
69
  "entityIdentifier": "test",
75
70
  "userIdentifier": "",
@@ -83,7 +78,6 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
83
78
  * @param {number} [limit] - Parameter for pagination. Default: 30.
84
79
  * @returns {IFormsByMarkerDataEntity} Returns an object containing the form data or an error object if there was an issue.
85
80
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
86
- * @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.
87
81
  */
88
82
  getFormsDataByMarker(marker: string, formModuleConfigId: number, body?: object, isNested?: number, langCode?: string, offset?: number, limit?: number): Promise<IFormsByMarkerDataEntity | IError>;
89
83
  }