oneentry 1.0.126 → 1.0.128
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 +0 -2
- package/configure.js +25 -18
- package/dist/admins/adminsApi.d.ts +18 -13
- package/dist/admins/adminsApi.js +18 -13
- package/dist/admins/adminsInterfaces.d.ts +16 -25
- package/dist/attribute-sets/attributeSetsApi.d.ts +14 -15
- package/dist/attribute-sets/attributeSetsApi.js +14 -15
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +78 -84
- package/dist/auth-provider/authProviderApi.d.ts +53 -79
- package/dist/auth-provider/authProviderApi.js +52 -78
- package/dist/auth-provider/authProvidersInterfaces.d.ts +98 -94
- package/dist/base/asyncModules.d.ts +23 -21
- package/dist/base/asyncModules.js +39 -29
- package/dist/base/result.d.ts +31 -0
- package/dist/base/result.js +32 -5
- package/dist/base/stateModule.d.ts +10 -0
- package/dist/base/stateModule.js +50 -2
- package/dist/base/syncModules.d.ts +42 -50
- package/dist/base/syncModules.js +106 -58
- package/dist/base/utils.d.ts +33 -2
- package/dist/blocks/blocksApi.d.ts +9 -18
- package/dist/blocks/blocksApi.js +9 -18
- package/dist/blocks/blocksInterfaces.d.ts +41 -46
- package/dist/config.d.ts +13 -0
- package/dist/config.js +30 -0
- package/dist/events/eventsApi.d.ts +10 -27
- package/dist/events/eventsApi.js +26 -40
- package/dist/events/eventsInterfaces.d.ts +33 -28
- package/dist/file-uploading/fileUploadingApi.d.ts +12 -17
- package/dist/file-uploading/fileUploadingApi.js +14 -17
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +8 -19
- package/dist/forms/formsApi.d.ts +10 -9
- package/dist/forms/formsApi.js +10 -9
- package/dist/forms/formsInterfaces.d.ts +20 -12
- package/dist/forms-data/formsDataApi.d.ts +24 -28
- package/dist/forms-data/formsDataApi.js +25 -28
- package/dist/forms-data/formsDataInterfaces.d.ts +71 -71
- package/dist/general-types/generalTypesApi.d.ts +5 -5
- package/dist/general-types/generalTypesApi.js +5 -5
- package/dist/general-types/generalTypesInterfaces.d.ts +5 -8
- package/dist/index.d.ts +3 -4
- package/dist/index.js +3 -4
- package/dist/integration-collections/integrationCollectionsApi.d.ts +29 -47
- package/dist/integration-collections/integrationCollectionsApi.js +31 -51
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +62 -58
- package/dist/locales/localesApi.d.ts +7 -3
- package/dist/locales/localesApi.js +7 -3
- package/dist/locales/localesInterfaces.d.ts +6 -5
- package/dist/menus/menusApi.d.ts +7 -3
- package/dist/menus/menusApi.js +7 -3
- package/dist/menus/menusInterfaces.d.ts +5 -10
- package/dist/menus/menusInterfaces.js +1 -0
- package/dist/orders/ordersApi.d.ts +17 -25
- package/dist/orders/ordersApi.js +17 -26
- package/dist/orders/ordersInterfaces.d.ts +94 -53
- package/dist/pages/pagesApi.d.ts +47 -60
- package/dist/pages/pagesApi.js +51 -61
- package/dist/pages/pagesInterfaces.d.ts +44 -48
- package/dist/payments/paymentsApi.d.ts +17 -27
- package/dist/payments/paymentsApi.js +17 -31
- package/dist/payments/paymentsInterfaces.d.ts +35 -29
- package/dist/product-statuses/productStatusesApi.d.ts +9 -9
- package/dist/product-statuses/productStatusesApi.js +9 -9
- package/dist/product-statuses/productStatusesInterfaces.d.ts +14 -12
- package/dist/products/productsApi.d.ts +23 -44
- package/dist/products/productsApi.js +24 -44
- package/dist/products/productsInterfaces.d.ts +51 -57
- package/dist/system/systemApi.d.ts +11 -13
- package/dist/system/systemApi.js +12 -13
- package/dist/system/systemInterfaces.d.ts +14 -3
- package/dist/templates/templatesApi.d.ts +8 -11
- package/dist/templates/templatesApi.js +8 -11
- package/dist/templates/templatesInterfaces.d.ts +13 -12
- package/dist/templates-preview/templatesPreviewApi.d.ts +7 -8
- package/dist/templates-preview/templatesPreviewApi.js +7 -8
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +15 -18
- package/dist/users/usersApi.d.ts +13 -20
- package/dist/users/usersApi.js +13 -20
- package/dist/users/usersInterfaces.d.ts +26 -30
- package/dist/web-socket/wsApi.d.ts +5 -3
- package/dist/web-socket/wsApi.js +6 -3
- package/dist/web-socket/wsInterfaces.d.ts +7 -2
- package/package.json +16 -12
|
@@ -2,54 +2,53 @@ import type { AttributeType, IError, ILocalizeInfo } from '../base/utils';
|
|
|
2
2
|
import type { IProductsEntity, IProductsResponse } from '../products/productsInterfaces';
|
|
3
3
|
/**
|
|
4
4
|
* Interface for managing and retrieving blocks in the system.
|
|
5
|
-
*
|
|
6
5
|
* @interface IBlocks
|
|
7
|
-
*
|
|
8
|
-
* @property {
|
|
9
|
-
* @property {
|
|
10
|
-
* @property {
|
|
11
|
-
* @property {
|
|
12
|
-
* @property {function} searchBlock - Quick search for block objects with limited output.
|
|
6
|
+
* @property {Function} getBlocks - Get all Blocks objects.
|
|
7
|
+
* @property {Function} getBlockByMarker - Get Block object by marker.
|
|
8
|
+
* @property {Function} getSimilarProducts - Get Array of similar products from product-similar block.
|
|
9
|
+
* @property {Function} getProductsByBlockMarker - Get Array of products from product block.
|
|
10
|
+
* @property {Function} searchBlock - Quick search for block objects with limited output.
|
|
13
11
|
* @description This interface defines methods for retrieving and managing blocks in the system.
|
|
14
12
|
*/
|
|
15
13
|
interface IBlocks {
|
|
16
14
|
/**
|
|
17
15
|
* Retrieves all block objects of a specific type.
|
|
18
|
-
*
|
|
16
|
+
* @handleName getBlocks
|
|
19
17
|
* @param {BlockType} type - The type of blocks to retrieve. Example: "product".
|
|
20
18
|
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
21
19
|
* @param {number} [offset] - Optional offset for pagination. Default: 0.
|
|
22
20
|
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
23
|
-
* @
|
|
21
|
+
* @returns {IBlocksResponse} A promise that resolves to a blocks response or an error.
|
|
24
22
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
23
|
+
* @description This method retrieves all block objects of a specific type.
|
|
25
24
|
*/
|
|
26
25
|
getBlocks(type: BlockType, langCode?: string, offset?: number, limit?: number): Promise<IBlocksResponse | IError>;
|
|
27
26
|
/**
|
|
28
27
|
* Retrieves a block object by its marker.
|
|
29
|
-
*
|
|
28
|
+
* @handleName getBlockByMarker
|
|
30
29
|
* @param {string} marker - The marker identifying the block. Example: "product_block".
|
|
31
30
|
* @param {string} langCode - Language code for localization. Default: "en_US".
|
|
32
31
|
* @param {number} [offset] - Optional offset for pagination. Default: 0.
|
|
33
32
|
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
34
|
-
* @
|
|
33
|
+
* @returns {IBlockEntity} A promise that resolves to a block entity or an error.
|
|
35
34
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
35
|
+
* @description This method retrieves a block object by its marker.
|
|
36
36
|
*/
|
|
37
37
|
getBlockByMarker(marker: string, langCode: string, offset?: number, limit?: number): Promise<IBlockEntity | IError>;
|
|
38
38
|
/**
|
|
39
39
|
* Performs a quick search for block objects with limited output.
|
|
40
|
-
*
|
|
40
|
+
* @handleName searchBlock
|
|
41
41
|
* @param {string} name - The name to search for. Example: "product_block".
|
|
42
42
|
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
43
|
-
* @
|
|
43
|
+
* @returns {ISearchBlock[]} A promise that resolves to an array of search blocks or an error.
|
|
44
44
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
45
|
+
* @description This method performs a quick search for block objects with limited output.
|
|
45
46
|
*/
|
|
46
47
|
searchBlock(name: string, langCode?: string): Promise<ISearchBlock[] | IError>;
|
|
47
48
|
}
|
|
48
49
|
/**
|
|
49
50
|
* Represents a response from the blocks API.
|
|
50
|
-
*
|
|
51
51
|
* @interface IBlocksResponse
|
|
52
|
-
*
|
|
53
52
|
* @property {number} total - Total number of found records. Example: 100.
|
|
54
53
|
* @property {IBlockEntity[]} items - Array of block entities. Example:
|
|
55
54
|
[
|
|
@@ -71,12 +70,12 @@ interface IBlocks {
|
|
|
71
70
|
},
|
|
72
71
|
"products": [
|
|
73
72
|
{
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
"id": 1,
|
|
74
|
+
"name": "Product 1"
|
|
76
75
|
},
|
|
77
76
|
{
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
"id": 2,
|
|
78
|
+
"name": "Product 2"
|
|
80
79
|
}
|
|
81
80
|
]
|
|
82
81
|
}
|
|
@@ -89,20 +88,18 @@ interface IBlocksResponse {
|
|
|
89
88
|
}
|
|
90
89
|
/**
|
|
91
90
|
* Represents a block entity with various attributes and properties.
|
|
92
|
-
*
|
|
93
91
|
* @interface IBlockEntity
|
|
94
|
-
*
|
|
95
92
|
* @property {AttributeType} attributeValues - Type of attributes used in the block. Example:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
93
|
+
{
|
|
94
|
+
"block-text": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"value": "some text",
|
|
97
|
+
"isIcon": false,
|
|
98
|
+
"position": 0,
|
|
99
|
+
"additionalFields": [],
|
|
100
|
+
"isProductPreview": false
|
|
105
101
|
}
|
|
102
|
+
}
|
|
106
103
|
* @property {number} id - Unique identifier of the block. Example: 1234.
|
|
107
104
|
* @property {ILocalizeInfo} localizeInfos - Localization information for the block. Example: {"key": "value"}
|
|
108
105
|
* @property {number} version - Version of the block entity. Example: 1.
|
|
@@ -113,21 +110,21 @@ interface IBlocksResponse {
|
|
|
113
110
|
* @property {number} [countElementsPerRow] - Number of elements displayed per row in the block, if applicable. Example: 3.
|
|
114
111
|
* @property {number} [quantity] - Quantity of items in the block, if applicable. Example: 5.
|
|
115
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
|
+
[
|
|
116
119
|
{
|
|
117
|
-
"
|
|
118
|
-
"
|
|
120
|
+
"id": 1,
|
|
121
|
+
"name": "Product 1"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"id": 2,
|
|
125
|
+
"name": "Product 2"
|
|
119
126
|
}
|
|
120
|
-
|
|
121
|
-
[
|
|
122
|
-
{
|
|
123
|
-
"id": 1,
|
|
124
|
-
"name": "Product 1"
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
"id": 2,
|
|
128
|
-
"name": "Product 2"
|
|
129
|
-
}
|
|
130
|
-
]
|
|
127
|
+
]
|
|
131
128
|
* @description Represents a block entity with various attributes and properties.
|
|
132
129
|
*/
|
|
133
130
|
interface IBlockEntity {
|
|
@@ -147,12 +144,10 @@ interface IBlockEntity {
|
|
|
147
144
|
}
|
|
148
145
|
/**
|
|
149
146
|
* Represents a search block entity with an identifier, name, and ID.
|
|
150
|
-
*
|
|
151
147
|
* @interface ISearchBlock
|
|
152
|
-
*
|
|
153
148
|
* @property {number} id - Unique identifier of the search block. Example: 1.
|
|
154
149
|
* @property {string} identifier - Unique string identifier for the search block. Example: "search_block_1".
|
|
155
|
-
* @property {string} name -
|
|
150
|
+
* @property {string} name - Name of the search block. Example: "Search Block 1".
|
|
156
151
|
* @description Represents a search block entity with an identifier, name, and ID.
|
|
157
152
|
*/
|
|
158
153
|
interface ISearchBlock {
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const projectUrl = "https://stage.oneentry.cloud";
|
|
2
|
+
export declare const projectToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiTlBNIiwic2VyaWFsTnVtYmVyIjozLCJpYXQiOjE3NDA1OTE0MzgsImV4cCI6MTc3MjEyNzQzMX0.MWbtBoXh-MqGTWgmiMTZSkfN8N-WYv3Cv2kSPhRpFlk";
|
|
3
|
+
/**
|
|
4
|
+
* authData
|
|
5
|
+
*/
|
|
6
|
+
export declare const authData: {
|
|
7
|
+
marker: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}[];
|
|
10
|
+
export declare const authData2: {
|
|
11
|
+
marker: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}[];
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.authData2 = exports.authData = exports.projectToken = exports.projectUrl = void 0;
|
|
4
|
+
exports.projectUrl = 'https://stage.oneentry.cloud';
|
|
5
|
+
exports.projectToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiTlBNIiwic2VyaWFsTnVtYmVyIjozLCJpYXQiOjE3NDA1OTE0MzgsImV4cCI6MTc3MjEyNzQzMX0.MWbtBoXh-MqGTWgmiMTZSkfN8N-WYv3Cv2kSPhRpFlk';
|
|
6
|
+
/**
|
|
7
|
+
* authData
|
|
8
|
+
*/
|
|
9
|
+
exports.authData = [
|
|
10
|
+
{
|
|
11
|
+
marker: 'email_reg',
|
|
12
|
+
value: 'test@test.ru',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
marker: 'password_reg',
|
|
16
|
+
// value: '12345',
|
|
17
|
+
value: '1-1',
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
exports.authData2 = [
|
|
21
|
+
{
|
|
22
|
+
marker: 'email_reg',
|
|
23
|
+
value: 'test2@test.ru',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
marker: 'password_reg',
|
|
27
|
+
// value: '12345',
|
|
28
|
+
value: '1-1',
|
|
29
|
+
},
|
|
30
|
+
];
|
|
@@ -4,12 +4,10 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IEvents, ISubscriptions } from './eventsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with events
|
|
7
|
-
*
|
|
8
7
|
* @handle /api/content/events
|
|
9
8
|
* @class EventsApi
|
|
10
|
-
* @
|
|
9
|
+
* @augments AsyncModules
|
|
11
10
|
* @implements {IEvents}
|
|
12
|
-
*
|
|
13
11
|
* @description This class provides methods to interact with events, including subscribing and unsubscribing to product events, and retrieving all subscriptions.
|
|
14
12
|
*/
|
|
15
13
|
export default class EventsApi extends AsyncModules implements IEvents {
|
|
@@ -17,58 +15,43 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
17
15
|
protected _url: string;
|
|
18
16
|
/**
|
|
19
17
|
* Initializes the EventsApi with the provided state module.
|
|
20
|
-
*
|
|
21
|
-
* @
|
|
22
|
-
* @class - EventsApi
|
|
23
|
-
* @extends - AsyncModules
|
|
18
|
+
* @class EventsApi
|
|
19
|
+
* @augments AsyncModules
|
|
24
20
|
* @implements {IEvents}
|
|
25
|
-
*
|
|
26
21
|
* @param {StateModule} state - The state module containing the base URL and other configurations.
|
|
27
|
-
*
|
|
28
22
|
* @description Initializes the EventsApi with the provided state module.
|
|
29
23
|
*/
|
|
30
24
|
constructor(state: StateModule);
|
|
31
25
|
/**
|
|
32
26
|
* Return all subscriptions to product.
|
|
33
|
-
*
|
|
34
27
|
* @handleName getAllSubscriptions
|
|
35
|
-
*
|
|
36
28
|
* @param {number} [offset] - Optional offset for pagination. Default: 0.
|
|
37
29
|
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
38
|
-
* @
|
|
30
|
+
* @returns {ISubscriptions} Returns an object containing all subscriptions or an error object if there was an issue.
|
|
39
31
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
40
|
-
*
|
|
41
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.
|
|
42
33
|
*/
|
|
43
34
|
getAllSubscriptions(offset?: number, limit?: number): Promise<ISubscriptions | IError>;
|
|
44
35
|
/**
|
|
45
36
|
* Subscribing to an event on a product.
|
|
46
|
-
*
|
|
47
37
|
* @handleName subscribeByMarker
|
|
48
|
-
*
|
|
49
38
|
* @param {string} marker - Event marker. Example: "product_price_change".
|
|
50
|
-
* @param {
|
|
51
|
-
* @param {string} [langCode] - Language code. Default: "en_US"
|
|
52
|
-
* @
|
|
53
|
-
*
|
|
54
|
-
* @return {any} Returns a promise that resolves to the result of the subscription operation or an error object if there was an issue.
|
|
39
|
+
* @param {number} productId - Product id. Example: 12345.
|
|
40
|
+
* @param {string} [langCode] - Language code. Default: "en_US".=
|
|
41
|
+
* @returns {Promise<boolean | IError>} Returns true if subscription was successful, or an error object if there was an issue.
|
|
55
42
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
56
|
-
*
|
|
57
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.
|
|
58
44
|
*/
|
|
59
|
-
subscribeByMarker(marker: string, productId: number, langCode?: string
|
|
45
|
+
subscribeByMarker(marker: string, productId: number, langCode?: string): Promise<boolean | IError>;
|
|
60
46
|
/**
|
|
61
47
|
* Unsubscribing to an event on a product.
|
|
62
|
-
*
|
|
63
48
|
* @handleName unsubscribeByMarker
|
|
64
|
-
*
|
|
65
49
|
* @param {string} marker - The marker of the event to unsubscribe from. Example: "product_price_change".
|
|
66
50
|
* @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
|
|
67
51
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
68
|
-
* @
|
|
69
|
-
* @return {any} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
|
|
52
|
+
* @returns {any} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
|
|
70
53
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
71
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.
|
|
72
55
|
*/
|
|
73
|
-
unsubscribeByMarker(marker: string, productId: number, langCode?: string
|
|
56
|
+
unsubscribeByMarker(marker: string, productId: number, langCode?: string): Promise<boolean | IError>;
|
|
74
57
|
}
|
package/dist/events/eventsApi.js
CHANGED
|
@@ -3,29 +3,24 @@ 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 jsdoc/reject-any-type */
|
|
6
7
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
8
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
9
|
/**
|
|
9
10
|
* Controllers for working with events
|
|
10
|
-
*
|
|
11
11
|
* @handle /api/content/events
|
|
12
12
|
* @class EventsApi
|
|
13
|
-
* @
|
|
13
|
+
* @augments AsyncModules
|
|
14
14
|
* @implements {IEvents}
|
|
15
|
-
*
|
|
16
15
|
* @description This class provides methods to interact with events, including subscribing and unsubscribing to product events, and retrieving all subscriptions.
|
|
17
16
|
*/
|
|
18
17
|
class EventsApi extends asyncModules_1.default {
|
|
19
18
|
/**
|
|
20
19
|
* Initializes the EventsApi with the provided state module.
|
|
21
|
-
*
|
|
22
|
-
* @
|
|
23
|
-
* @class - EventsApi
|
|
24
|
-
* @extends - AsyncModules
|
|
20
|
+
* @class EventsApi
|
|
21
|
+
* @augments AsyncModules
|
|
25
22
|
* @implements {IEvents}
|
|
26
|
-
*
|
|
27
23
|
* @param {StateModule} state - The state module containing the base URL and other configurations.
|
|
28
|
-
*
|
|
29
24
|
* @description Initializes the EventsApi with the provided state module.
|
|
30
25
|
*/
|
|
31
26
|
constructor(state) {
|
|
@@ -34,14 +29,11 @@ class EventsApi extends asyncModules_1.default {
|
|
|
34
29
|
}
|
|
35
30
|
/**
|
|
36
31
|
* Return all subscriptions to product.
|
|
37
|
-
*
|
|
38
32
|
* @handleName getAllSubscriptions
|
|
39
|
-
*
|
|
40
33
|
* @param {number} [offset] - Optional offset for pagination. Default: 0.
|
|
41
34
|
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
42
|
-
* @
|
|
35
|
+
* @returns {ISubscriptions} Returns an object containing all subscriptions or an error object if there was an issue.
|
|
43
36
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
44
|
-
*
|
|
45
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.
|
|
46
38
|
*/
|
|
47
39
|
async getAllSubscriptions(offset = 0, limit = 30) {
|
|
@@ -54,55 +46,49 @@ class EventsApi extends asyncModules_1.default {
|
|
|
54
46
|
}
|
|
55
47
|
/**
|
|
56
48
|
* Subscribing to an event on a product.
|
|
57
|
-
*
|
|
58
49
|
* @handleName subscribeByMarker
|
|
59
|
-
*
|
|
60
50
|
* @param {string} marker - Event marker. Example: "product_price_change".
|
|
61
|
-
* @param {
|
|
62
|
-
* @param {string} [langCode] - Language code. Default: "en_US"
|
|
63
|
-
* @
|
|
64
|
-
*
|
|
65
|
-
* @return {any} Returns a promise that resolves to the result of the subscription operation or an error object if there was an issue.
|
|
51
|
+
* @param {number} productId - Product id. Example: 12345.
|
|
52
|
+
* @param {string} [langCode] - Language code. Default: "en_US".=
|
|
53
|
+
* @returns {Promise<boolean | IError>} Returns true if subscription was successful, or an error object if there was an issue.
|
|
66
54
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
67
|
-
*
|
|
68
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.
|
|
69
56
|
*/
|
|
70
|
-
async subscribeByMarker(marker, productId, langCode = this.state.lang
|
|
71
|
-
|
|
72
|
-
const data = {
|
|
57
|
+
async subscribeByMarker(marker, productId, langCode = this.state.lang) {
|
|
58
|
+
const body = {
|
|
73
59
|
locale: langCode,
|
|
74
60
|
productId,
|
|
75
61
|
};
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
try {
|
|
63
|
+
await this._fetchPost(`/subscribe/marker/${marker}`, body);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
return e;
|
|
78
68
|
}
|
|
79
|
-
const result = await this._fetchPost(`/subscribe/marker/${marker}`, data);
|
|
80
|
-
return result;
|
|
81
69
|
}
|
|
82
70
|
/**
|
|
83
71
|
* Unsubscribing to an event on a product.
|
|
84
|
-
*
|
|
85
72
|
* @handleName unsubscribeByMarker
|
|
86
|
-
*
|
|
87
73
|
* @param {string} marker - The marker of the event to unsubscribe from. Example: "product_price_change".
|
|
88
74
|
* @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
|
|
89
75
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
90
|
-
* @
|
|
91
|
-
* @return {any} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
|
|
76
|
+
* @returns {any} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
|
|
92
77
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
93
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.
|
|
94
79
|
*/
|
|
95
|
-
async unsubscribeByMarker(marker, productId, langCode = this.state.lang
|
|
96
|
-
|
|
97
|
-
const data = {
|
|
98
|
-
locale: langCode,
|
|
80
|
+
async unsubscribeByMarker(marker, productId, langCode = this.state.lang) {
|
|
81
|
+
const body = {
|
|
99
82
|
productId: productId,
|
|
83
|
+
locale: langCode,
|
|
100
84
|
};
|
|
101
|
-
|
|
102
|
-
|
|
85
|
+
try {
|
|
86
|
+
await this._fetchDelete(`/unsubscribe/marker/${marker}`, body);
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
return e;
|
|
103
91
|
}
|
|
104
|
-
const result = await this._fetchDelete(`/unsubscribe/marker/${marker}`, data);
|
|
105
|
-
return result;
|
|
106
92
|
}
|
|
107
93
|
}
|
|
108
94
|
exports.default = EventsApi;
|
|
@@ -1,64 +1,58 @@
|
|
|
1
1
|
import type { IError } from '../base/utils';
|
|
2
2
|
/**
|
|
3
3
|
* Interface for managing event subscriptions related to products.
|
|
4
|
-
*
|
|
5
4
|
* @interface IEvents
|
|
6
|
-
*
|
|
7
|
-
* @property {function} getAllSubscriptions - Return all subscriptions to product.
|
|
8
|
-
* @property {function} subscribeByMarker - Subscribing to an event on a product.
|
|
9
|
-
* @property {function} unsubscribeByMarker - Unsubscribing to an event on a product.
|
|
10
5
|
* @description This interface defines methods for managing event subscriptions related to products.
|
|
11
6
|
*/
|
|
12
7
|
interface IEvents {
|
|
13
8
|
/**
|
|
14
9
|
* Retrieves all subscriptions to products.
|
|
15
|
-
*
|
|
10
|
+
* @handleName getAllSubscriptions
|
|
16
11
|
* @param {number} [offset] - Optional offset for pagination. Default: 0.
|
|
17
12
|
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
18
|
-
* @
|
|
13
|
+
* @returns {Promise<ISubscriptions | IError>} A promise that resolves to a subscriptions object or an error.
|
|
19
14
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
15
|
+
* @description This method retrieves all subscriptions to products.
|
|
20
16
|
*/
|
|
21
17
|
getAllSubscriptions(offset?: number, limit?: number): Promise<ISubscriptions | IError>;
|
|
22
18
|
/**
|
|
23
19
|
* Subscribes to an event on a product by its marker.
|
|
24
|
-
*
|
|
20
|
+
* @handleName subscribeByMarker
|
|
25
21
|
* @param {string} marker - The marker identifying the event. Example: "product_price_change".
|
|
26
22
|
* @param {number} productId - The ID of the product to subscribe to. Example: 12345.
|
|
27
23
|
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
28
|
-
* @
|
|
29
|
-
* @return {any} A promise that resolves to any type or an error.
|
|
24
|
+
* @returns {Promise<boolean | IError>} A promise that resolves to any type or an error.
|
|
30
25
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
26
|
+
* @description This method subscribes to an event on a product by its marker.
|
|
31
27
|
*/
|
|
32
|
-
subscribeByMarker(marker: string, productId: number, langCode?: string
|
|
28
|
+
subscribeByMarker(marker: string, productId: number, langCode?: string): Promise<boolean | IError>;
|
|
33
29
|
/**
|
|
34
30
|
* Unsubscribes from an event on a product by its marker.
|
|
35
|
-
*
|
|
31
|
+
* @handleName unsubscribeByMarker
|
|
36
32
|
* @param {string} marker - The marker identifying the event. Example: "product_price_change".
|
|
37
33
|
* @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
|
|
38
34
|
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
39
|
-
* @
|
|
40
|
-
* @returns {any} A promise that resolves to any type or an error.
|
|
35
|
+
* @returns {Promise<boolean | IError>} A promise that resolves to any type or an error.
|
|
41
36
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
37
|
+
* @description This method unsubscribes from an event on a product by its marker.
|
|
42
38
|
*/
|
|
43
|
-
unsubscribeByMarker(marker: string, productId: number, langCode?: string
|
|
39
|
+
unsubscribeByMarker(marker: string, productId: number, langCode?: string): Promise<boolean | IError>;
|
|
44
40
|
}
|
|
45
41
|
/**
|
|
46
42
|
* Represents a response from the events API containing a total count and an array of subscription items.
|
|
47
|
-
*
|
|
48
43
|
* @interface ISubscriptions
|
|
49
|
-
*
|
|
50
44
|
* @property {number} total - Total number of found records. Example: 100.
|
|
51
45
|
* @property {{ eventMarker: string; productId: number }[]} items - Array of subscription items, each containing an event marker and a product ID. Example:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
46
|
+
[
|
|
47
|
+
{
|
|
48
|
+
eventMarker: 'product_price_change',
|
|
49
|
+
productId: 12345
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
eventMarker: 'product_stock_update',
|
|
53
|
+
productId: 67890
|
|
54
|
+
}
|
|
55
|
+
]
|
|
62
56
|
* @description Represents a response from the events API containing a total count and an array of subscription items.
|
|
63
57
|
*/
|
|
64
58
|
interface ISubscriptions {
|
|
@@ -68,4 +62,15 @@ interface ISubscriptions {
|
|
|
68
62
|
productId: number;
|
|
69
63
|
}>;
|
|
70
64
|
}
|
|
71
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Interface for the body of the subscribe methods.
|
|
67
|
+
* @interface ISubscribeBody
|
|
68
|
+
* @property {string} locale - Locale of the user. Example: "en_US".
|
|
69
|
+
* @property {number} productId - Product ID. Example: 12345.
|
|
70
|
+
* @description Represents a body for the subscribe methods, containing the locale and product ID.
|
|
71
|
+
*/
|
|
72
|
+
interface ISubscribeBody {
|
|
73
|
+
locale: string;
|
|
74
|
+
productId: number;
|
|
75
|
+
}
|
|
76
|
+
export type { IEvents, ISubscribeBody, ISubscriptions };
|
|
@@ -4,24 +4,23 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IFileUploading, IUploadingQuery, IUploadingReturn } from './fileUploadingInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with file uploading
|
|
7
|
-
*
|
|
8
7
|
* @handle /api/content/files
|
|
9
8
|
* @class FileUploadingApi
|
|
10
|
-
* @
|
|
9
|
+
* @augments AsyncModules
|
|
11
10
|
* @implements {IFileUploading}
|
|
12
|
-
*
|
|
13
11
|
* @description This class provides methods to upload and delete files in a cloud file storage, as well as retrieve files by parameters.
|
|
14
12
|
*/
|
|
15
13
|
export default class FileUploadingApi extends AsyncModules implements IFileUploading {
|
|
16
14
|
protected state: StateModule;
|
|
17
15
|
protected _url: string;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
18
19
|
constructor(state: StateModule);
|
|
19
20
|
private _defaultQuery;
|
|
20
21
|
/**
|
|
21
22
|
* Upload file function.
|
|
22
|
-
*
|
|
23
23
|
* @handleName upload
|
|
24
|
-
*
|
|
25
24
|
* @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
|
|
26
25
|
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
27
26
|
{
|
|
@@ -40,17 +39,15 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
|
|
|
40
39
|
* @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
|
|
41
40
|
* @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
|
|
42
41
|
* @param {any} [fileQuery.template] - preview template identifier. Example: 1.
|
|
43
|
-
* @
|
|
42
|
+
* @returns {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
|
|
44
43
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
45
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.
|
|
46
45
|
*/
|
|
47
46
|
upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
|
|
48
47
|
/**
|
|
49
48
|
* Deletes a file from the cloud file storage.
|
|
50
|
-
*
|
|
51
49
|
* @handleName delete
|
|
52
|
-
*
|
|
53
|
-
* @param {string} [filename] - File name. Example: "file.png".
|
|
50
|
+
* @param {string} filename - File name. Example: "file.png".
|
|
54
51
|
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
55
52
|
{
|
|
56
53
|
"type": "page",
|
|
@@ -62,22 +59,20 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
|
|
|
62
59
|
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
63
60
|
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
64
61
|
* @param {number} [fileQuery.template] - preview template identifier. Example: 1.
|
|
65
|
-
* @
|
|
62
|
+
* @returns {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
|
|
66
63
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
67
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.
|
|
68
65
|
*/
|
|
69
66
|
delete(filename: string, fileQuery?: IUploadingQuery): Promise<any | IError>;
|
|
70
67
|
/**
|
|
71
68
|
* Get file by parameters.
|
|
72
|
-
*
|
|
73
69
|
* @handleName getFile
|
|
74
|
-
*
|
|
75
|
-
* @param {
|
|
76
|
-
* @param {string}
|
|
77
|
-
* @param {string}
|
|
78
|
-
* @param {string} [filename] - Filename. Example: "file.png".
|
|
70
|
+
* @param {number} id - Object identifier, from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
71
|
+
* @param {string} type - Type, determines the folder name in the storage. Example: "page".
|
|
72
|
+
* @param {string} entity - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
73
|
+
* @param {string} filename - Filename. Example: "file.png".
|
|
79
74
|
* @param {string} [template] - Preview template identifier. Example: 1.
|
|
80
|
-
* @
|
|
75
|
+
* @returns {any} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
|
|
81
76
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
82
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.
|
|
83
78
|
*/
|