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
package/dist/blocks/blocksApi.js
CHANGED
|
@@ -5,8 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
7
|
/**
|
|
8
|
-
* Controllers for working with blocks
|
|
8
|
+
* Controllers for working with blocks.
|
|
9
|
+
*
|
|
9
10
|
* @handle /api/content/blocks
|
|
11
|
+
* @class BlocksApi
|
|
12
|
+
* @extends AsyncModules
|
|
13
|
+
* @implements {IBlocks}
|
|
14
|
+
*
|
|
15
|
+
* @description This class provides methods to interact with blocks.
|
|
10
16
|
*/
|
|
11
17
|
class BlocksApi extends asyncModules_1.default {
|
|
12
18
|
constructor(state) {
|
|
@@ -16,12 +22,17 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
16
22
|
/**
|
|
17
23
|
* Get blocks by parameters.
|
|
18
24
|
*
|
|
19
|
-
* @
|
|
20
|
-
* @param {string} [langCode] - Language code. Default "en_US"
|
|
21
|
-
* @param {number} [offset] - Parameter for pagination. Default 0
|
|
22
|
-
* @param {number} [limit] - Parameter for pagination. Default 30
|
|
25
|
+
* @handleName getBlocks
|
|
23
26
|
*
|
|
24
|
-
* @
|
|
27
|
+
* @param {BlockType} type - Available values : product | error_page | catalog_page | product_preview | similar_products_block | product_block | form | common_page | common_block | order | none. Example: 'product'.
|
|
28
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
29
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
30
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
31
|
+
*
|
|
32
|
+
* @return {IBlocksResponse} Returns BlocksEntity object.
|
|
33
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
34
|
+
*
|
|
35
|
+
* @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.
|
|
25
36
|
*/
|
|
26
37
|
async getBlocks(type, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
27
38
|
const response = await this._fetchGet(`?langCode=${langCode}&type=${type}&offset=${offset}&limit=${limit}`);
|
|
@@ -71,12 +82,17 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
71
82
|
/**
|
|
72
83
|
* Get block by marker.
|
|
73
84
|
*
|
|
74
|
-
* @
|
|
75
|
-
*
|
|
76
|
-
* @param {
|
|
77
|
-
* @param {
|
|
85
|
+
* @handleName getBlockByMarker
|
|
86
|
+
*
|
|
87
|
+
* @param {string} marker - Marker of Block. Example: 'product_block'.
|
|
88
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
89
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
90
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
78
91
|
*
|
|
79
|
-
* @
|
|
92
|
+
* @return {IBlockEntity} - Returns a BlockEntity object.
|
|
93
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
94
|
+
*
|
|
95
|
+
* @description This method retrieves a block by its marker and includes additional information such as similar products or products associated with the block.
|
|
80
96
|
*/
|
|
81
97
|
async getBlockByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
82
98
|
const response = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
@@ -120,12 +136,17 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
120
136
|
/**
|
|
121
137
|
* Get similar products by block marker.
|
|
122
138
|
*
|
|
123
|
-
* @
|
|
124
|
-
*
|
|
125
|
-
* @param {
|
|
126
|
-
* @param {
|
|
139
|
+
* @handleName getSimilarProducts
|
|
140
|
+
*
|
|
141
|
+
* @param {string} marker - Block identifier. Example: 'similar_products_block'.
|
|
142
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
143
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
144
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
127
145
|
*
|
|
128
|
-
* @
|
|
146
|
+
* @return {IProductsResponse} - Returns the total count and an array of product items in object by specified block marker.
|
|
147
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
148
|
+
*
|
|
149
|
+
* @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.
|
|
129
150
|
*/
|
|
130
151
|
async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
131
152
|
const query = {
|
|
@@ -139,12 +160,17 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
139
160
|
/**
|
|
140
161
|
* Get products by block marker.
|
|
141
162
|
*
|
|
142
|
-
* @
|
|
143
|
-
*
|
|
144
|
-
* @param {
|
|
145
|
-
* @param {
|
|
163
|
+
* @handleName getProductsByBlockMarker
|
|
164
|
+
*
|
|
165
|
+
* @param {string} marker - Block identifier. Example: 'product_block'.
|
|
166
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
167
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
168
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
169
|
+
*
|
|
170
|
+
* @return {IProductsEntity[]} Return array of BlocksEntity object.
|
|
171
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
146
172
|
*
|
|
147
|
-
* @
|
|
173
|
+
* @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.
|
|
148
174
|
*/
|
|
149
175
|
async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
150
176
|
const query = {
|
|
@@ -156,12 +182,17 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
156
182
|
return this._normalizeData(result.items);
|
|
157
183
|
}
|
|
158
184
|
/**
|
|
159
|
-
* Quick search for block objects with limited output
|
|
185
|
+
* Quick search for block objects with limited output.
|
|
186
|
+
*
|
|
187
|
+
* @handleName searchBlock
|
|
188
|
+
*
|
|
189
|
+
* @param {string} name - Search string. Example: 'product_block'.
|
|
190
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
160
191
|
*
|
|
161
|
-
* @
|
|
162
|
-
* @
|
|
192
|
+
* @return {ISearchBlock[]} Returns an array of ISearchBlock objects.
|
|
193
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
163
194
|
*
|
|
164
|
-
* @
|
|
195
|
+
* @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.
|
|
165
196
|
*/
|
|
166
197
|
async searchBlock(name, langCode = this.state.lang) {
|
|
167
198
|
const result = await this._fetchGet(`/quick/search?langCode=${langCode}&name=${name}`);
|
|
@@ -1,45 +1,88 @@
|
|
|
1
1
|
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
|
+
* @interface IBlocks
|
|
5
7
|
*
|
|
6
8
|
* @property {function} getBlocks - Get all Blocks objects.
|
|
7
9
|
* @property {function} getBlockByMarker - Get Block object by marker.
|
|
8
10
|
* @property {function} getSimilarProducts - Get Array of similar products from product-similar block.
|
|
9
11
|
* @property {function} getProductsByBlockMarker - Get Array of products from product block.
|
|
10
12
|
* @property {function} searchBlock - Quick search for block objects with limited output.
|
|
13
|
+
*
|
|
14
|
+
* @description This interface defines methods for retrieving and managing blocks in the system.
|
|
11
15
|
*/
|
|
12
16
|
interface IBlocks {
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves all block objects of a specific type.
|
|
19
|
+
*
|
|
20
|
+
* @param {BlockType} type - The type of blocks to retrieve. Example: 'product'.
|
|
21
|
+
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
22
|
+
* @param {number} [offset] - Optional offset for pagination. Default: 0.
|
|
23
|
+
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
24
|
+
*
|
|
25
|
+
* @return {IBlocksResponse} A promise that resolves to a blocks response or an error.
|
|
26
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
27
|
+
*/
|
|
13
28
|
getBlocks(type: BlockType, langCode?: string, offset?: number, limit?: number): Promise<IBlocksResponse | IError>;
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves a block object by its marker.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} marker - The marker identifying the block. Example: 'product_block'.
|
|
33
|
+
* @param {string} langCode - Language code for localization. Default: "en_US".
|
|
34
|
+
* @param {number} [offset] - Optional offset for pagination. Default: 0.
|
|
35
|
+
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
36
|
+
*
|
|
37
|
+
* @return {IBlockEntity} A promise that resolves to a block entity or an error.
|
|
38
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
39
|
+
*/
|
|
14
40
|
getBlockByMarker(marker: string, langCode: string, offset?: number, limit?: number): Promise<IBlockEntity | IError>;
|
|
41
|
+
/**
|
|
42
|
+
* Performs a quick search for block objects with limited output.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} name - The name to search for. Example: 'product_block'.
|
|
45
|
+
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
46
|
+
*
|
|
47
|
+
* @return {ISearchBlock[]} A promise that resolves to an array of search blocks or an error.
|
|
48
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
49
|
+
*/
|
|
15
50
|
searchBlock(name: string, langCode?: string): Promise<Array<ISearchBlock> | IError>;
|
|
16
51
|
}
|
|
17
52
|
/**
|
|
18
|
-
*
|
|
53
|
+
* Represents a response from the blocks API.
|
|
54
|
+
*
|
|
55
|
+
* @interface IBlocksResponse
|
|
56
|
+
*
|
|
57
|
+
* @property {number} total - Total number of found records. Example: 100.
|
|
58
|
+
* @property {Array<IBlockEntity>} items - Array of block entities. Example: .
|
|
19
59
|
*
|
|
20
|
-
* @
|
|
21
|
-
* @property {Array<IBlockEntity>} items -
|
|
60
|
+
* @description Represents a response from the blocks API containing a total count and an array of block entities.
|
|
22
61
|
*/
|
|
23
62
|
interface IBlocksResponse {
|
|
24
63
|
total: number;
|
|
25
64
|
items: Array<IBlockEntity>;
|
|
26
65
|
}
|
|
27
66
|
/**
|
|
28
|
-
*
|
|
67
|
+
* Represents a block entity with various attributes and properties.
|
|
29
68
|
*
|
|
30
|
-
* @
|
|
31
|
-
*
|
|
32
|
-
* @property {
|
|
33
|
-
* @property {
|
|
34
|
-
* @property {
|
|
35
|
-
* @property {
|
|
36
|
-
* @property {
|
|
37
|
-
* @property {
|
|
38
|
-
* @property {
|
|
39
|
-
* @property {
|
|
40
|
-
* @property {number}
|
|
41
|
-
* @property {
|
|
42
|
-
* @property {
|
|
69
|
+
* @interface IBlockEntity
|
|
70
|
+
*
|
|
71
|
+
* @property {AttributeType} attributeValues - Type of attributes used in the block.
|
|
72
|
+
* @property {number} id - Unique identifier of the block. Example: 1234.
|
|
73
|
+
* @property {string} identifier - Unique string identifier for the block. Example: 'block1'.
|
|
74
|
+
* @property {boolean} isVisible - Indicates whether the block is visible. Example: true.
|
|
75
|
+
* @property {ILocalizeInfo} localizeInfos - Localization information for the block. Example: .
|
|
76
|
+
* @property {number} position - Position of the block in a list or layout. Example: 1.
|
|
77
|
+
* @property {string | null} templateIdentifier - Identifier for the template used by the block, or null if not applicable. Example: 'template1' or null.
|
|
78
|
+
* @property {string} type - Type of the block, such as 'product', 'error_page', etc. Example: 'product'.
|
|
79
|
+
* @property {number} version - Version of the block entity. Example: 1.
|
|
80
|
+
* @property {number} [countElementsPerRow] - Number of elements displayed per row in the block, if applicable. Example: 3.
|
|
81
|
+
* @property {number} [quantity] - Quantity of items in the block, if applicable. Example: 5.
|
|
82
|
+
* @property {IProductsResponse} [similarProducts] - Response containing similar products associated with the block. Example: { total: 10, items: [...] }.
|
|
83
|
+
* @property {Array<IProductsEntity>} [products] - Array of product entities associated with the block. Example: [{ id: 1, name: 'Product 1', ... }, { id: 2, name: 'Product 2', ... }].
|
|
84
|
+
*
|
|
85
|
+
* @description Represents a block entity with various attributes and properties.
|
|
43
86
|
*/
|
|
44
87
|
interface IBlockEntity {
|
|
45
88
|
attributeValues: AttributeType;
|
|
@@ -57,11 +100,15 @@ interface IBlockEntity {
|
|
|
57
100
|
products?: Array<IProductsEntity>;
|
|
58
101
|
}
|
|
59
102
|
/**
|
|
60
|
-
*
|
|
103
|
+
* Represents a search block entity with an identifier, name, and ID.
|
|
104
|
+
*
|
|
105
|
+
* @interface ISearchBlock
|
|
106
|
+
*
|
|
107
|
+
* @property {number} id - Unique identifier of the search block. Example: 1.
|
|
108
|
+
* @property {string} name - Name of the search block. Example: 'Search Block 1'.
|
|
109
|
+
* @property {string} identifier - Unique string identifier for the search block. Example: 'search_block_1'.
|
|
61
110
|
*
|
|
62
|
-
* @
|
|
63
|
-
* @property {string} name -
|
|
64
|
-
* @property {string} identifier -
|
|
111
|
+
* @description Represents a search block entity with an identifier, name, and ID.
|
|
65
112
|
*/
|
|
66
113
|
interface ISearchBlock {
|
|
67
114
|
id: number;
|
|
@@ -70,6 +117,8 @@ interface ISearchBlock {
|
|
|
70
117
|
}
|
|
71
118
|
/**
|
|
72
119
|
* BlockType
|
|
120
|
+
* @type {BlockType}
|
|
121
|
+
* @description This type defines the possible values for block types used in the system.
|
|
73
122
|
*/
|
|
74
123
|
type BlockType = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'similar_products_block' | 'product_block' | 'form' | 'common_page' | 'common_block' | 'order' | 'service' | 'none';
|
|
75
124
|
export type { BlockType, IBlockEntity, IBlocks, IBlocksResponse, ISearchBlock };
|
|
@@ -5,37 +5,71 @@ import type { IEvents } from './eventsInterfaces';
|
|
|
5
5
|
import type { ISubscriptions } from './eventsInterfaces';
|
|
6
6
|
/**
|
|
7
7
|
* Controllers for working with events
|
|
8
|
+
*
|
|
8
9
|
* @handle /api/content/events
|
|
10
|
+
* @class EventsApi
|
|
11
|
+
* @extends AsyncModules
|
|
12
|
+
* @implements {IEvents}
|
|
13
|
+
*
|
|
14
|
+
* @description This class provides methods to interact with events, including subscribing and unsubscribing to product events, and retrieving all subscriptions.
|
|
9
15
|
*/
|
|
10
16
|
export default class EventsApi extends AsyncModules implements IEvents {
|
|
11
17
|
protected state: StateModule;
|
|
12
18
|
protected _url: string;
|
|
19
|
+
/**
|
|
20
|
+
* Initializes the EventsApi with the provided state module.
|
|
21
|
+
*
|
|
22
|
+
* @constructor
|
|
23
|
+
* @class - EventsApi
|
|
24
|
+
* @extends - AsyncModules
|
|
25
|
+
* @implements {IEvents}
|
|
26
|
+
*
|
|
27
|
+
* @param {StateModule} state - The state module containing the base URL and other configurations.
|
|
28
|
+
*
|
|
29
|
+
* @description Initializes the EventsApi with the provided state module.
|
|
30
|
+
*/
|
|
13
31
|
constructor(state: StateModule);
|
|
14
32
|
/**
|
|
15
33
|
* Return all subscriptions to product.
|
|
16
34
|
*
|
|
17
|
-
* @
|
|
18
|
-
*
|
|
35
|
+
* @handleName getAllSubscriptions
|
|
36
|
+
*
|
|
37
|
+
* @return {ISubscriptions} Returns an object containing all subscriptions or an error object if there was an issue.
|
|
38
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
39
|
+
*
|
|
40
|
+
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
19
41
|
*/
|
|
20
|
-
getAllSubscriptions(
|
|
42
|
+
getAllSubscriptions(): Promise<ISubscriptions | IError>;
|
|
21
43
|
/**
|
|
22
44
|
* Subscribing to an event on a product.
|
|
23
45
|
*
|
|
46
|
+
* @handleName subscribeByMarker
|
|
47
|
+
*
|
|
48
|
+
* @param {string} marker - Event marker. Example: 'product_price_change'.
|
|
49
|
+
* @param {string} productId - Product id. Example: 12345.
|
|
50
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
51
|
+
* @param {number} [threshold] - Threshold value for comparing numerical value. Default is 0.
|
|
52
|
+
*
|
|
53
|
+
* @return {any} Returns a promise that resolves to the result of the subscription operation or an error object if there was an issue.
|
|
54
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
55
|
+
*
|
|
24
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.
|
|
25
|
-
* @param {string} [marker] - Event marker.
|
|
26
|
-
* @param {string} [productId] - Product id.
|
|
27
|
-
* @param {string} [langCode] - Language code.
|
|
28
|
-
* @param {number} [threshold] - Threshold value for comparing numerical value.
|
|
29
57
|
*/
|
|
30
58
|
subscribeByMarker(marker: string, productId: number, langCode?: string, threshold?: number): Promise<any | IError>;
|
|
31
59
|
/**
|
|
32
60
|
* Unsubscribing to an event on a product.
|
|
33
61
|
*
|
|
62
|
+
* @handleName unsubscribeByMarker
|
|
63
|
+
*
|
|
64
|
+
* @param {string} marker - The marker of the event to unsubscribe from. Example: 'product_price_change'.
|
|
65
|
+
* @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
|
|
66
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
67
|
+
* @param {number} [threshold] - The threshold value for comparing numerical values. Default: 0.
|
|
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.
|
|
70
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
71
|
+
*
|
|
34
72
|
* @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
|
-
* @param {string} [marker] - Event marker.
|
|
36
|
-
* @param {string} [productId] - Product id.
|
|
37
|
-
* @param {number} [langCode] - Language code.
|
|
38
|
-
* @param {number} [threshold] - Threshold value for comparing numerical value.
|
|
39
73
|
*/
|
|
40
74
|
unsubscribeByMarker(marker: string, productId: number, langCode?: string, threshold?: number): Promise<any | IError>;
|
|
41
75
|
}
|
package/dist/events/eventsApi.js
CHANGED
|
@@ -3,14 +3,30 @@ 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-unused-vars */
|
|
7
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
6
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
9
7
|
/**
|
|
10
8
|
* Controllers for working with events
|
|
9
|
+
*
|
|
11
10
|
* @handle /api/content/events
|
|
11
|
+
* @class EventsApi
|
|
12
|
+
* @extends AsyncModules
|
|
13
|
+
* @implements {IEvents}
|
|
14
|
+
*
|
|
15
|
+
* @description This class provides methods to interact with events, including subscribing and unsubscribing to product events, and retrieving all subscriptions.
|
|
12
16
|
*/
|
|
13
17
|
class EventsApi extends asyncModules_1.default {
|
|
18
|
+
/**
|
|
19
|
+
* Initializes the EventsApi with the provided state module.
|
|
20
|
+
*
|
|
21
|
+
* @constructor
|
|
22
|
+
* @class - EventsApi
|
|
23
|
+
* @extends - AsyncModules
|
|
24
|
+
* @implements {IEvents}
|
|
25
|
+
*
|
|
26
|
+
* @param {StateModule} state - The state module containing the base URL and other configurations.
|
|
27
|
+
*
|
|
28
|
+
* @description Initializes the EventsApi with the provided state module.
|
|
29
|
+
*/
|
|
14
30
|
constructor(state) {
|
|
15
31
|
super(state);
|
|
16
32
|
this._url = state.url + '/api/content/events';
|
|
@@ -18,27 +34,34 @@ class EventsApi extends asyncModules_1.default {
|
|
|
18
34
|
/**
|
|
19
35
|
* Return all subscriptions to product.
|
|
20
36
|
*
|
|
21
|
-
* @
|
|
22
|
-
*
|
|
37
|
+
* @handleName getAllSubscriptions
|
|
38
|
+
*
|
|
39
|
+
* @return {ISubscriptions} Returns an object containing all subscriptions or an error object if there was an issue.
|
|
40
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
41
|
+
*
|
|
42
|
+
* @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.
|
|
23
43
|
*/
|
|
24
|
-
async getAllSubscriptions(
|
|
25
|
-
const query = {
|
|
26
|
-
offset,
|
|
27
|
-
limit,
|
|
28
|
-
};
|
|
44
|
+
async getAllSubscriptions() {
|
|
29
45
|
const result = await this._fetchGet(`/subscriptions`);
|
|
30
46
|
return result;
|
|
31
47
|
}
|
|
32
48
|
/**
|
|
33
49
|
* Subscribing to an event on a product.
|
|
34
50
|
*
|
|
51
|
+
* @handleName subscribeByMarker
|
|
52
|
+
*
|
|
53
|
+
* @param {string} marker - Event marker. Example: 'product_price_change'.
|
|
54
|
+
* @param {string} productId - Product id. Example: 12345.
|
|
55
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
56
|
+
* @param {number} [threshold] - Threshold value for comparing numerical value. Default is 0.
|
|
57
|
+
*
|
|
58
|
+
* @return {any} Returns a promise that resolves to the result of the subscription operation or an error object if there was an issue.
|
|
59
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
60
|
+
*
|
|
35
61
|
* @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
|
-
* @param {string} [marker] - Event marker.
|
|
37
|
-
* @param {string} [productId] - Product id.
|
|
38
|
-
* @param {string} [langCode] - Language code.
|
|
39
|
-
* @param {number} [threshold] - Threshold value for comparing numerical value.
|
|
40
62
|
*/
|
|
41
63
|
async subscribeByMarker(marker, productId, langCode = this.state.lang, threshold = 0) {
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
65
|
const data = {
|
|
43
66
|
locale: langCode,
|
|
44
67
|
productId,
|
|
@@ -52,13 +75,20 @@ class EventsApi extends asyncModules_1.default {
|
|
|
52
75
|
/**
|
|
53
76
|
* Unsubscribing to an event on a product.
|
|
54
77
|
*
|
|
78
|
+
* @handleName unsubscribeByMarker
|
|
79
|
+
*
|
|
80
|
+
* @param {string} marker - The marker of the event to unsubscribe from. Example: 'product_price_change'.
|
|
81
|
+
* @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
|
|
82
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
83
|
+
* @param {number} [threshold] - The threshold value for comparing numerical values. Default: 0.
|
|
84
|
+
*
|
|
85
|
+
* @return {any} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
|
|
86
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
87
|
+
*
|
|
55
88
|
* @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
|
-
* @param {string} [marker] - Event marker.
|
|
57
|
-
* @param {string} [productId] - Product id.
|
|
58
|
-
* @param {number} [langCode] - Language code.
|
|
59
|
-
* @param {number} [threshold] - Threshold value for comparing numerical value.
|
|
60
89
|
*/
|
|
61
90
|
async unsubscribeByMarker(marker, productId, langCode = this.state.lang, threshold = 0) {
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
92
|
const data = {
|
|
63
93
|
locale: langCode,
|
|
64
94
|
productId: productId,
|
|
@@ -1,18 +1,60 @@
|
|
|
1
1
|
import type { IError } from '../base/utils';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Interface for managing event subscriptions related to products.
|
|
4
|
+
*
|
|
5
|
+
* @interface IEvents
|
|
4
6
|
*
|
|
5
7
|
* @property {function} getAllSubscriptions - Return all subscriptions to product.
|
|
6
8
|
* @property {function} subscribeByMarker - Subscribing to an event on a product.
|
|
7
9
|
* @property {function} unsubscribeByMarker - Unsubscribing to an event on a product.
|
|
10
|
+
*
|
|
11
|
+
* @description This interface defines methods for managing event subscriptions related to products.
|
|
8
12
|
*/
|
|
9
13
|
interface IEvents {
|
|
14
|
+
/**
|
|
15
|
+
* Retrieves all subscriptions to products.
|
|
16
|
+
*
|
|
17
|
+
* @param {number} [limit] - Optional limit for pagination. Default is 30.
|
|
18
|
+
* @param {number} [offset] - Optional offset for pagination. Default is 0.
|
|
19
|
+
*
|
|
20
|
+
* @return {ISubscriptions} A promise that resolves to a subscriptions object or an error.
|
|
21
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
22
|
+
*/
|
|
10
23
|
getAllSubscriptions(limit?: number, offset?: number): Promise<ISubscriptions | IError>;
|
|
24
|
+
/**
|
|
25
|
+
* Subscribes to an event on a product by its marker.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} marker - The marker identifying the event. Example: 'product_price_change'.
|
|
28
|
+
* @param {number} productId - The ID of the product to subscribe to. Example: 12345.
|
|
29
|
+
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
30
|
+
* @param {number} [threshold] - Optional threshold value for the subscription. Default: 0.
|
|
31
|
+
*
|
|
32
|
+
* @return {any} A promise that resolves to any type or an error.
|
|
33
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
34
|
+
*/
|
|
11
35
|
subscribeByMarker(marker: string, productId: number, langCode?: string, threshold?: number): Promise<any | IError>;
|
|
36
|
+
/**
|
|
37
|
+
* Unsubscribes from an event on a product by its marker.
|
|
38
|
+
*
|
|
39
|
+
* @param {string} marker - The marker identifying the event. Example: 'product_price_change'.
|
|
40
|
+
* @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
|
|
41
|
+
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
42
|
+
* @param {number} [threshold] - Optional threshold value for the unsubscription. Default: 0.
|
|
43
|
+
*
|
|
44
|
+
* @returns {any} A promise that resolves to any type or an error.
|
|
45
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
46
|
+
*/
|
|
12
47
|
unsubscribeByMarker(marker: string, productId: number, langCode?: string, threshold?: number): Promise<any | IError>;
|
|
13
48
|
}
|
|
14
49
|
/**
|
|
15
|
-
*
|
|
50
|
+
* Represents a response from the events API containing a total count and an array of subscription items.
|
|
51
|
+
*
|
|
52
|
+
* @interface ISubscriptions
|
|
53
|
+
*
|
|
54
|
+
* @property {number} total - Total number of found records. Example: 100.
|
|
55
|
+
* @property {Array<{ eventMarker: string; productId: number }>} items - Array of subscription items, each containing an event marker and a product ID. Example: [{ eventMarker: 'product_price_change', productId: 12345 }, { eventMarker: 'product_stock_update', productId: 67890 }].
|
|
56
|
+
*
|
|
57
|
+
* @description Represents a response from the events API containing a total count and an array of subscription items.
|
|
16
58
|
*/
|
|
17
59
|
interface ISubscriptions {
|
|
18
60
|
total: number;
|
|
@@ -4,6 +4,13 @@ import type { IError } from '../base/utils';
|
|
|
4
4
|
import type { IFileUploading, IUploadingQuery, IUploadingReturns } from './fileUploadingInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with file uploading
|
|
7
|
+
*
|
|
8
|
+
* @handle /api/content/files
|
|
9
|
+
* @class FileUploadingApi
|
|
10
|
+
* @extends AsyncModules
|
|
11
|
+
* @implements {IFileUploading}
|
|
12
|
+
*
|
|
13
|
+
* @description This class provides methods to upload and delete files in a cloud file storage, as well as retrieve files by parameters.
|
|
7
14
|
*/
|
|
8
15
|
export default class FileUploadingApi extends AsyncModules implements IFileUploading {
|
|
9
16
|
protected state: StateModule;
|
|
@@ -13,45 +20,58 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
|
|
|
13
20
|
/**
|
|
14
21
|
* Upload file function.
|
|
15
22
|
*
|
|
16
|
-
* @
|
|
23
|
+
* @handleName upload
|
|
17
24
|
*
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
20
|
-
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor"
|
|
21
|
-
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787
|
|
22
|
-
* @param {number} [fileQuery.width] - Optional width parameter. Example: 0
|
|
23
|
-
* @param {number} [fileQuery.height] - Optional height parameter. Example: 0
|
|
24
|
-
* @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true
|
|
25
|
-
* @param {boolean} [fileQuery.template] - preview template identifier. Example: 1
|
|
25
|
+
* @param {File | Blob} file - File to upload. Example: new File(["content"], "file.png", { type: "image/png" }).
|
|
26
|
+
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example: { type: 'page', entity: 'editor', id: 3787, width: 0, height: 0, compress: true, template: 1 }.
|
|
26
27
|
*
|
|
27
|
-
* @
|
|
28
|
+
* @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
|
|
29
|
+
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
30
|
+
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
31
|
+
* @param {number} [fileQuery.width] - Optional width parameter. Example: 0.
|
|
32
|
+
* @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
|
|
33
|
+
* @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
|
|
34
|
+
* @param {boolean} [fileQuery.template] - preview template identifier. Example: 1.
|
|
35
|
+
*
|
|
36
|
+
* @return {IUploadingReturns} Uploads a file to an Amazon S3-compatible cloud file storage.
|
|
37
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
38
|
+
*
|
|
39
|
+
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
28
40
|
*/
|
|
29
41
|
upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturns | IError>;
|
|
30
42
|
/**
|
|
31
43
|
* Deletes a file from the cloud file storage.
|
|
32
44
|
*
|
|
33
|
-
* @
|
|
45
|
+
* @handleName delete
|
|
34
46
|
*
|
|
35
|
-
* @param {
|
|
36
|
-
* @param {
|
|
37
|
-
* @param {string} [fileQuery.
|
|
38
|
-
* @param {
|
|
39
|
-
* @param {number} [fileQuery.
|
|
47
|
+
* @param {string} [filename] - File name. Example: "file.png".
|
|
48
|
+
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example: { type: 'page', entity: 'editor', id: 3787, template: 1 }.
|
|
49
|
+
* @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
|
|
50
|
+
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
51
|
+
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
52
|
+
* @param {number} [fileQuery.template] - preview template identifier. Example: 1.
|
|
40
53
|
*
|
|
41
|
-
* @
|
|
54
|
+
* @return {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
|
|
55
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
56
|
+
*
|
|
57
|
+
* @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
58
|
*/
|
|
43
59
|
delete(filename: string, fileQuery?: IUploadingQuery): Promise<any | IError>;
|
|
44
60
|
/**
|
|
45
61
|
* Get file by parameters.
|
|
46
62
|
*
|
|
47
|
-
* @
|
|
63
|
+
* @handleName getFile
|
|
64
|
+
*
|
|
65
|
+
* @param {number} [id] - Object identifier, from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
66
|
+
* @param {string} [type] - Type, determines the folder name in the storage. Example: "page".
|
|
67
|
+
* @param {string} [entity] - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
68
|
+
* @param {string} [filename] - Filename. Example: "file.png".
|
|
69
|
+
* @param {string} [template] - Preview template identifier. Example: 1.
|
|
48
70
|
*
|
|
49
|
-
* @
|
|
50
|
-
* @
|
|
51
|
-
* @param {string} [filename] - Filename. Example "file.png"
|
|
52
|
-
* @param {string} [template] - preview template identifier. Example 1
|
|
71
|
+
* @return {any} Returns a promise that resolves to a Blob object containing the file data 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.
|
|
53
73
|
*
|
|
54
|
-
* @
|
|
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.
|
|
55
75
|
*/
|
|
56
|
-
getFile(id: number, type: string, entity: string, filename
|
|
76
|
+
getFile(id: number, type: string, entity: string, filename: string, template?: string): Promise<any | IError>;
|
|
57
77
|
}
|