oneentry 1.0.124 → 1.0.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -22
- package/dist/admins/adminsApi.d.ts +17 -4
- package/dist/admins/adminsApi.js +16 -3
- package/dist/admins/adminsInterfaces.d.ts +47 -26
- package/dist/attribute-sets/attributeSetsApi.d.ts +10 -18
- package/dist/attribute-sets/attributeSetsApi.js +9 -17
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +92 -44
- package/dist/auth-provider/authProviderApi.d.ts +146 -36
- package/dist/auth-provider/authProviderApi.js +163 -37
- package/dist/auth-provider/authProvidersInterfaces.d.ts +189 -40
- package/dist/base/asyncModules.d.ts +7 -1
- package/dist/base/asyncModules.js +127 -21
- package/dist/base/result.js +23 -0
- package/dist/base/syncModules.d.ts +4 -0
- package/dist/base/syncModules.js +19 -1
- package/dist/base/utils.d.ts +1 -1
- package/dist/blocks/blocksApi.d.ts +7 -17
- package/dist/blocks/blocksApi.js +7 -17
- package/dist/blocks/blocksInterfaces.d.ts +77 -32
- package/dist/events/eventsApi.d.ts +7 -8
- package/dist/events/eventsApi.js +12 -7
- package/dist/events/eventsInterfaces.d.ts +16 -11
- package/dist/file-uploading/fileUploadingApi.d.ts +22 -14
- package/dist/file-uploading/fileUploadingApi.js +20 -12
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +42 -18
- package/dist/forms/formsApi.d.ts +3 -7
- package/dist/forms/formsApi.js +2 -6
- package/dist/forms/formsInterfaces.d.ts +44 -28
- package/dist/formsData/formsDataApi.d.ts +21 -9
- package/dist/formsData/formsDataApi.js +21 -9
- package/dist/formsData/formsDataInterfaces.d.ts +128 -45
- package/dist/general-types/generalTypesApi.d.ts +1 -3
- package/dist/general-types/generalTypesApi.js +0 -2
- package/dist/general-types/generalTypesInterfaces.d.ts +2 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/integration-collections/integrationCollectionsApi.d.ts +74 -47
- package/dist/integration-collections/integrationCollectionsApi.js +64 -45
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +144 -63
- package/dist/locales/localesApi.d.ts +1 -2
- package/dist/locales/localesApi.js +1 -2
- package/dist/locales/localesInterfaces.d.ts +2 -4
- package/dist/menus/menusApi.d.ts +1 -3
- package/dist/menus/menusApi.js +1 -3
- package/dist/menus/menusInterfaces.d.ts +39 -13
- package/dist/orders/ordersApi.d.ts +36 -18
- package/dist/orders/ordersApi.js +40 -22
- package/dist/orders/ordersInterfaces.d.ts +163 -81
- package/dist/pages/pagesApi.d.ts +48 -48
- package/dist/pages/pagesApi.js +40 -45
- package/dist/pages/pagesInterfaces.d.ts +147 -98
- package/dist/payments/paymentsApi.d.ts +25 -45
- package/dist/payments/paymentsApi.js +27 -46
- package/dist/payments/paymentsInterfaces.d.ts +42 -60
- package/dist/product-statuses/productStatusesApi.d.ts +6 -12
- package/dist/product-statuses/productStatusesApi.js +5 -11
- package/dist/product-statuses/productStatusesInterfaces.d.ts +16 -15
- package/dist/products/productsApi.d.ts +256 -104
- package/dist/products/productsApi.js +263 -97
- package/dist/products/productsInterfaces.d.ts +343 -160
- package/dist/system/systemApi.d.ts +21 -10
- package/dist/system/systemApi.js +22 -8
- package/dist/system/systemInterfaces.d.ts +0 -1
- package/dist/templates/templatesApi.d.ts +6 -12
- package/dist/templates/templatesApi.js +4 -10
- package/dist/templates/templatesInterfaces.d.ts +20 -20
- package/dist/templates-preview/templatesPreviewApi.d.ts +2 -6
- package/dist/templates-preview/templatesPreviewApi.js +1 -5
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +50 -25
- package/dist/users/usersApi.d.ts +33 -13
- package/dist/users/usersApi.js +38 -15
- package/dist/users/usersInterfaces.d.ts +78 -27
- package/dist/web-socket/wsApi.d.ts +1 -5
- package/dist/web-socket/wsApi.js +1 -5
- package/dist/web-socket/wsInterfaces.d.ts +0 -1
- package/package.json +18 -16
package/dist/blocks/blocksApi.js
CHANGED
|
@@ -24,18 +24,16 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
24
24
|
*
|
|
25
25
|
* @handleName getBlocks
|
|
26
26
|
*
|
|
27
|
-
* @param {BlockType} type - Available values
|
|
27
|
+
* @param {BlockType} type - Available values: "product" | "error_page" | "catalog_page" | "product_preview" | "similar_products_block" | "product_block" | "form" | "common_page" | "common_block" | "order" | "service" | "none". Example: 'product'.
|
|
28
28
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
29
29
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
30
30
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
31
|
-
*
|
|
32
31
|
* @return {IBlocksResponse} Returns BlocksEntity object.
|
|
33
32
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
34
|
-
*
|
|
35
33
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
36
34
|
*/
|
|
37
|
-
async getBlocks(type, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
38
|
-
const response = await this.
|
|
35
|
+
async getBlocks(type = '', langCode = this.state.lang, offset = 0, limit = 30) {
|
|
36
|
+
const response = await this._fetchPost(`?langCode=${langCode}&type=${type}&offset=${offset}&limit=${limit}`);
|
|
39
37
|
if (!this.state.traficLimit) {
|
|
40
38
|
const normalizeResponse = this._normalizeData(response);
|
|
41
39
|
await Promise.all(
|
|
@@ -84,14 +82,12 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
84
82
|
*
|
|
85
83
|
* @handleName getBlockByMarker
|
|
86
84
|
*
|
|
87
|
-
* @param {string} marker - Marker of Block. Example:
|
|
85
|
+
* @param {string} marker - Marker of Block. Example: "product_block".
|
|
88
86
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
89
87
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
90
88
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
91
|
-
*
|
|
92
89
|
* @return {IBlockEntity} - Returns a BlockEntity object.
|
|
93
90
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
94
|
-
*
|
|
95
91
|
* @description This method retrieves a block by its marker and includes additional information such as similar products or products associated with the block.
|
|
96
92
|
*/
|
|
97
93
|
async getBlockByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
@@ -138,14 +134,12 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
138
134
|
*
|
|
139
135
|
* @handleName getSimilarProducts
|
|
140
136
|
*
|
|
141
|
-
* @param {string} marker - Block identifier. Example:
|
|
137
|
+
* @param {string} marker - Block identifier. Example: "similar_products_block".
|
|
142
138
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
143
139
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
144
140
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
145
|
-
*
|
|
146
141
|
* @return {IProductsResponse} - Returns the total count and an array of product items in object by specified block marker.
|
|
147
142
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
148
|
-
*
|
|
149
143
|
* @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.
|
|
150
144
|
*/
|
|
151
145
|
async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
@@ -162,14 +156,12 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
162
156
|
*
|
|
163
157
|
* @handleName getProductsByBlockMarker
|
|
164
158
|
*
|
|
165
|
-
* @param {string} marker - Block identifier. Example:
|
|
159
|
+
* @param {string} marker - Block identifier. Example: "product_block".
|
|
166
160
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
167
161
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
168
162
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
169
|
-
*
|
|
170
163
|
* @return {IProductsEntity[]} Return array of BlocksEntity object.
|
|
171
164
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
172
|
-
*
|
|
173
165
|
* @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.
|
|
174
166
|
*/
|
|
175
167
|
async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
@@ -186,12 +178,10 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
186
178
|
*
|
|
187
179
|
* @handleName searchBlock
|
|
188
180
|
*
|
|
189
|
-
* @param {string} name - Search string. Example:
|
|
181
|
+
* @param {string} name - Search string. Example: "product_block".
|
|
190
182
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
191
|
-
*
|
|
192
183
|
* @return {ISearchBlock[]} Returns an array of ISearchBlock objects.
|
|
193
184
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
194
|
-
*
|
|
195
185
|
* @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.
|
|
196
186
|
*/
|
|
197
187
|
async searchBlock(name, langCode = this.state.lang) {
|
|
@@ -10,18 +10,16 @@ import type { IProductsEntity, IProductsResponse } from '../products/productsInt
|
|
|
10
10
|
* @property {function} getSimilarProducts - Get Array of similar products from product-similar block.
|
|
11
11
|
* @property {function} getProductsByBlockMarker - Get Array of products from product block.
|
|
12
12
|
* @property {function} searchBlock - Quick search for block objects with limited output.
|
|
13
|
-
*
|
|
14
13
|
* @description This interface defines methods for retrieving and managing blocks in the system.
|
|
15
14
|
*/
|
|
16
15
|
interface IBlocks {
|
|
17
16
|
/**
|
|
18
17
|
* Retrieves all block objects of a specific type.
|
|
19
18
|
*
|
|
20
|
-
* @param {BlockType} type - The type of blocks to retrieve. Example:
|
|
19
|
+
* @param {BlockType} type - The type of blocks to retrieve. Example: "product".
|
|
21
20
|
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
22
21
|
* @param {number} [offset] - Optional offset for pagination. Default: 0.
|
|
23
22
|
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
24
|
-
*
|
|
25
23
|
* @return {IBlocksResponse} A promise that resolves to a blocks response or an error.
|
|
26
24
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
27
25
|
*/
|
|
@@ -29,11 +27,10 @@ interface IBlocks {
|
|
|
29
27
|
/**
|
|
30
28
|
* Retrieves a block object by its marker.
|
|
31
29
|
*
|
|
32
|
-
* @param {string} marker - The marker identifying the block. Example:
|
|
30
|
+
* @param {string} marker - The marker identifying the block. Example: "product_block".
|
|
33
31
|
* @param {string} langCode - Language code for localization. Default: "en_US".
|
|
34
32
|
* @param {number} [offset] - Optional offset for pagination. Default: 0.
|
|
35
33
|
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
36
|
-
*
|
|
37
34
|
* @return {IBlockEntity} A promise that resolves to a block entity or an error.
|
|
38
35
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
39
36
|
*/
|
|
@@ -41,13 +38,12 @@ interface IBlocks {
|
|
|
41
38
|
/**
|
|
42
39
|
* Performs a quick search for block objects with limited output.
|
|
43
40
|
*
|
|
44
|
-
* @param {string} name - The name to search for. Example:
|
|
41
|
+
* @param {string} name - The name to search for. Example: "product_block".
|
|
45
42
|
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
46
|
-
*
|
|
47
43
|
* @return {ISearchBlock[]} A promise that resolves to an array of search blocks or an error.
|
|
48
44
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
49
45
|
*/
|
|
50
|
-
searchBlock(name: string, langCode?: string): Promise<
|
|
46
|
+
searchBlock(name: string, langCode?: string): Promise<ISearchBlock[] | IError>;
|
|
51
47
|
}
|
|
52
48
|
/**
|
|
53
49
|
* Represents a response from the blocks API.
|
|
@@ -55,49 +51,99 @@ interface IBlocks {
|
|
|
55
51
|
* @interface IBlocksResponse
|
|
56
52
|
*
|
|
57
53
|
* @property {number} total - Total number of found records. Example: 100.
|
|
58
|
-
* @property {
|
|
59
|
-
|
|
54
|
+
* @property {IBlockEntity[]} items - Array of block entities. Example:
|
|
55
|
+
[
|
|
56
|
+
{
|
|
57
|
+
"attributeValues": [],
|
|
58
|
+
"id": 1,
|
|
59
|
+
"identifier": "block1",
|
|
60
|
+
"isVisible": true,
|
|
61
|
+
"localizeInfos": { "key": "value" },
|
|
62
|
+
"position": 1,
|
|
63
|
+
"templateIdentifier": null,
|
|
64
|
+
"type": "product",
|
|
65
|
+
"version": 1,
|
|
66
|
+
"countElementsPerRow": 3,
|
|
67
|
+
"quantity": 9,
|
|
68
|
+
"similarProducts": {
|
|
69
|
+
"total": 0,
|
|
70
|
+
"items": []
|
|
71
|
+
},
|
|
72
|
+
"products": [
|
|
73
|
+
{
|
|
74
|
+
"id": 1,
|
|
75
|
+
"name": "Product 1"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": 2,
|
|
79
|
+
"name": "Product 2"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
]
|
|
60
84
|
* @description Represents a response from the blocks API containing a total count and an array of block entities.
|
|
61
85
|
*/
|
|
62
86
|
interface IBlocksResponse {
|
|
87
|
+
items: IBlockEntity[];
|
|
63
88
|
total: number;
|
|
64
|
-
items: Array<IBlockEntity>;
|
|
65
89
|
}
|
|
66
90
|
/**
|
|
67
91
|
* Represents a block entity with various attributes and properties.
|
|
68
92
|
*
|
|
69
93
|
* @interface IBlockEntity
|
|
70
94
|
*
|
|
71
|
-
* @property {AttributeType} attributeValues - Type of attributes used in the block.
|
|
95
|
+
* @property {AttributeType} attributeValues - Type of attributes used in the block. Example:
|
|
96
|
+
{
|
|
97
|
+
"block-text": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"value": "some text",
|
|
100
|
+
"isIcon": false,
|
|
101
|
+
"position": 0,
|
|
102
|
+
"additionalFields": [],
|
|
103
|
+
"isProductPreview": false
|
|
104
|
+
}
|
|
105
|
+
}
|
|
72
106
|
* @property {number} id - Unique identifier of the block. Example: 1234.
|
|
73
|
-
* @property {
|
|
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'.
|
|
107
|
+
* @property {ILocalizeInfo} localizeInfos - Localization information for the block. Example: {"key": "value"}
|
|
79
108
|
* @property {number} version - Version of the block entity. Example: 1.
|
|
109
|
+
* @property {string} identifier - Unique string identifier for the block. Example: "block1".
|
|
110
|
+
* @property {string} type - Type of the block, such as 'product', 'error_page', etc. Example: "product".
|
|
111
|
+
* @property {string | null} templateIdentifier - Identifier for the template used by the block, or null if not applicable. Example: "template1".
|
|
112
|
+
* @property {boolean} isVisible - Indicates whether the block is visible. Example: true.
|
|
80
113
|
* @property {number} [countElementsPerRow] - Number of elements displayed per row in the block, if applicable. Example: 3.
|
|
81
114
|
* @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:
|
|
83
|
-
|
|
84
|
-
|
|
115
|
+
* @property {IProductsResponse} [similarProducts] - Response containing similar products associated with the block. Example:
|
|
116
|
+
{
|
|
117
|
+
"total": 10,
|
|
118
|
+
"items": []
|
|
119
|
+
}
|
|
120
|
+
* @property {IProductsEntity[]} [products] - Array of product entities associated with the block. Example:
|
|
121
|
+
[
|
|
122
|
+
{
|
|
123
|
+
"id": 1,
|
|
124
|
+
"name": "Product 1"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"id": 2,
|
|
128
|
+
"name": "Product 2"
|
|
129
|
+
}
|
|
130
|
+
]
|
|
85
131
|
* @description Represents a block entity with various attributes and properties.
|
|
86
132
|
*/
|
|
87
133
|
interface IBlockEntity {
|
|
88
|
-
attributeValues: AttributeType;
|
|
89
134
|
id: number;
|
|
90
|
-
identifier: string;
|
|
91
|
-
isVisible: boolean;
|
|
92
135
|
localizeInfos: ILocalizeInfo;
|
|
136
|
+
version: number;
|
|
93
137
|
position: number;
|
|
94
|
-
|
|
138
|
+
identifier: string;
|
|
95
139
|
type: string;
|
|
96
|
-
|
|
140
|
+
templateIdentifier: string | null;
|
|
141
|
+
isVisible: boolean;
|
|
142
|
+
attributeValues: AttributeType;
|
|
143
|
+
similarProducts?: IProductsResponse;
|
|
97
144
|
countElementsPerRow?: number;
|
|
98
145
|
quantity?: number;
|
|
99
|
-
|
|
100
|
-
products?: Array<IProductsEntity>;
|
|
146
|
+
products?: IProductsEntity[];
|
|
101
147
|
}
|
|
102
148
|
/**
|
|
103
149
|
* Represents a search block entity with an identifier, name, and ID.
|
|
@@ -105,15 +151,14 @@ interface IBlockEntity {
|
|
|
105
151
|
* @interface ISearchBlock
|
|
106
152
|
*
|
|
107
153
|
* @property {number} id - Unique identifier of the search block. Example: 1.
|
|
108
|
-
* @property {string}
|
|
109
|
-
* @property {string}
|
|
110
|
-
*
|
|
154
|
+
* @property {string} identifier - Unique string identifier for the search block. Example: "search_block_1".
|
|
155
|
+
* @property {string} name - Name of the search block. Example: "Search Block 1".
|
|
111
156
|
* @description Represents a search block entity with an identifier, name, and ID.
|
|
112
157
|
*/
|
|
113
158
|
interface ISearchBlock {
|
|
114
159
|
id: number;
|
|
115
|
-
name: string;
|
|
116
160
|
identifier: string;
|
|
161
|
+
name: string;
|
|
117
162
|
}
|
|
118
163
|
/**
|
|
119
164
|
* BlockType
|
|
@@ -1,8 +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 { IEvents } from './eventsInterfaces';
|
|
5
|
-
import type { ISubscriptions } from './eventsInterfaces';
|
|
4
|
+
import type { IEvents, ISubscriptions } from './eventsInterfaces';
|
|
6
5
|
/**
|
|
7
6
|
* Controllers for working with events
|
|
8
7
|
*
|
|
@@ -34,21 +33,23 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
34
33
|
*
|
|
35
34
|
* @handleName getAllSubscriptions
|
|
36
35
|
*
|
|
36
|
+
* @param {number} [offset] - Optional offset for pagination. Default: 0.
|
|
37
|
+
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
37
38
|
* @return {ISubscriptions} Returns an object containing all subscriptions or an error object if there was an issue.
|
|
38
39
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
39
40
|
*
|
|
40
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.
|
|
41
42
|
*/
|
|
42
|
-
getAllSubscriptions(): Promise<ISubscriptions | IError>;
|
|
43
|
+
getAllSubscriptions(offset?: number, limit?: number): Promise<ISubscriptions | IError>;
|
|
43
44
|
/**
|
|
44
45
|
* Subscribing to an event on a product.
|
|
45
46
|
*
|
|
46
47
|
* @handleName subscribeByMarker
|
|
47
48
|
*
|
|
48
|
-
* @param {string} marker - Event marker. Example:
|
|
49
|
+
* @param {string} marker - Event marker. Example: "product_price_change".
|
|
49
50
|
* @param {string} productId - Product id. Example: 12345.
|
|
50
51
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
51
|
-
* @param {number} [threshold] - Threshold value for comparing numerical value. Default
|
|
52
|
+
* @param {number} [threshold] - Threshold value for comparing numerical value. Default: 0.
|
|
52
53
|
*
|
|
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.
|
|
54
55
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
@@ -61,14 +62,12 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
61
62
|
*
|
|
62
63
|
* @handleName unsubscribeByMarker
|
|
63
64
|
*
|
|
64
|
-
* @param {string} marker - The marker of the event to unsubscribe from. Example:
|
|
65
|
+
* @param {string} marker - The marker of the event to unsubscribe from. Example: "product_price_change".
|
|
65
66
|
* @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
|
|
66
67
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
67
68
|
* @param {number} [threshold] - The threshold value for comparing numerical values. Default: 0.
|
|
68
|
-
*
|
|
69
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
70
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
71
|
-
*
|
|
72
71
|
* @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.
|
|
73
72
|
*/
|
|
74
73
|
unsubscribeByMarker(marker: string, productId: number, langCode?: string, threshold?: number): Promise<any | IError>;
|
package/dist/events/eventsApi.js
CHANGED
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
7
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
8
|
/**
|
|
8
9
|
* Controllers for working with events
|
|
@@ -36,13 +37,19 @@ class EventsApi extends asyncModules_1.default {
|
|
|
36
37
|
*
|
|
37
38
|
* @handleName getAllSubscriptions
|
|
38
39
|
*
|
|
40
|
+
* @param {number} [offset] - Optional offset for pagination. Default: 0.
|
|
41
|
+
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
39
42
|
* @return {ISubscriptions} Returns an object containing all subscriptions or an error object if there was an issue.
|
|
40
43
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
41
44
|
*
|
|
42
45
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
43
46
|
*/
|
|
44
|
-
async getAllSubscriptions() {
|
|
45
|
-
const
|
|
47
|
+
async getAllSubscriptions(offset = 0, limit = 30) {
|
|
48
|
+
const query = {
|
|
49
|
+
offset,
|
|
50
|
+
limit,
|
|
51
|
+
};
|
|
52
|
+
const result = await this._fetchGet(`/subscriptions?` + this._queryParamsToString(query));
|
|
46
53
|
return result;
|
|
47
54
|
}
|
|
48
55
|
/**
|
|
@@ -50,10 +57,10 @@ class EventsApi extends asyncModules_1.default {
|
|
|
50
57
|
*
|
|
51
58
|
* @handleName subscribeByMarker
|
|
52
59
|
*
|
|
53
|
-
* @param {string} marker - Event marker. Example:
|
|
60
|
+
* @param {string} marker - Event marker. Example: "product_price_change".
|
|
54
61
|
* @param {string} productId - Product id. Example: 12345.
|
|
55
62
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
56
|
-
* @param {number} [threshold] - Threshold value for comparing numerical value. Default
|
|
63
|
+
* @param {number} [threshold] - Threshold value for comparing numerical value. Default: 0.
|
|
57
64
|
*
|
|
58
65
|
* @return {any} Returns a promise that resolves to the result of the subscription operation or an error object if there was an issue.
|
|
59
66
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
@@ -77,14 +84,12 @@ class EventsApi extends asyncModules_1.default {
|
|
|
77
84
|
*
|
|
78
85
|
* @handleName unsubscribeByMarker
|
|
79
86
|
*
|
|
80
|
-
* @param {string} marker - The marker of the event to unsubscribe from. Example:
|
|
87
|
+
* @param {string} marker - The marker of the event to unsubscribe from. Example: "product_price_change".
|
|
81
88
|
* @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
|
|
82
89
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
83
90
|
* @param {number} [threshold] - The threshold value for comparing numerical values. Default: 0.
|
|
84
|
-
*
|
|
85
91
|
* @return {any} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
|
|
86
92
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
87
|
-
*
|
|
88
93
|
* @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.
|
|
89
94
|
*/
|
|
90
95
|
async unsubscribeByMarker(marker, productId, langCode = this.state.lang, threshold = 0) {
|
|
@@ -7,28 +7,25 @@ import type { IError } from '../base/utils';
|
|
|
7
7
|
* @property {function} getAllSubscriptions - Return all subscriptions to product.
|
|
8
8
|
* @property {function} subscribeByMarker - Subscribing to an event on a product.
|
|
9
9
|
* @property {function} unsubscribeByMarker - Unsubscribing to an event on a product.
|
|
10
|
-
*
|
|
11
10
|
* @description This interface defines methods for managing event subscriptions related to products.
|
|
12
11
|
*/
|
|
13
12
|
interface IEvents {
|
|
14
13
|
/**
|
|
15
14
|
* Retrieves all subscriptions to products.
|
|
16
15
|
*
|
|
17
|
-
* @param {number} [
|
|
18
|
-
* @param {number} [
|
|
19
|
-
*
|
|
16
|
+
* @param {number} [offset] - Optional offset for pagination. Default: 0.
|
|
17
|
+
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
20
18
|
* @return {ISubscriptions} A promise that resolves to a subscriptions object or an error.
|
|
21
19
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
22
20
|
*/
|
|
23
|
-
getAllSubscriptions(
|
|
21
|
+
getAllSubscriptions(offset?: number, limit?: number): Promise<ISubscriptions | IError>;
|
|
24
22
|
/**
|
|
25
23
|
* Subscribes to an event on a product by its marker.
|
|
26
24
|
*
|
|
27
|
-
* @param {string} marker - The marker identifying the event. Example:
|
|
25
|
+
* @param {string} marker - The marker identifying the event. Example: "product_price_change".
|
|
28
26
|
* @param {number} productId - The ID of the product to subscribe to. Example: 12345.
|
|
29
27
|
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
30
28
|
* @param {number} [threshold] - Optional threshold value for the subscription. Default: 0.
|
|
31
|
-
*
|
|
32
29
|
* @return {any} A promise that resolves to any type or an error.
|
|
33
30
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
34
31
|
*/
|
|
@@ -36,11 +33,10 @@ interface IEvents {
|
|
|
36
33
|
/**
|
|
37
34
|
* Unsubscribes from an event on a product by its marker.
|
|
38
35
|
*
|
|
39
|
-
* @param {string} marker - The marker identifying the event. Example:
|
|
36
|
+
* @param {string} marker - The marker identifying the event. Example: "product_price_change".
|
|
40
37
|
* @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
|
|
41
38
|
* @param {string} [langCode] - Optional language code for localization. Default: "en_US".
|
|
42
39
|
* @param {number} [threshold] - Optional threshold value for the unsubscription. Default: 0.
|
|
43
|
-
*
|
|
44
40
|
* @returns {any} A promise that resolves to any type or an error.
|
|
45
41
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
46
42
|
*/
|
|
@@ -52,8 +48,17 @@ interface IEvents {
|
|
|
52
48
|
* @interface ISubscriptions
|
|
53
49
|
*
|
|
54
50
|
* @property {number} total - Total number of found records. Example: 100.
|
|
55
|
-
* @property {
|
|
56
|
-
|
|
51
|
+
* @property {{ eventMarker: string; productId: number }[]} items - Array of subscription items, each containing an event marker and a product ID. Example:
|
|
52
|
+
[
|
|
53
|
+
{
|
|
54
|
+
eventMarker: 'product_price_change',
|
|
55
|
+
productId: 12345
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
eventMarker: 'product_stock_update',
|
|
59
|
+
productId: 67890
|
|
60
|
+
}
|
|
61
|
+
]
|
|
57
62
|
* @description Represents a response from the events API containing a total count and an array of subscription items.
|
|
58
63
|
*/
|
|
59
64
|
interface ISubscriptions {
|
|
@@ -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 { IFileUploading, IUploadingQuery,
|
|
4
|
+
import type { IFileUploading, IUploadingQuery, IUploadingReturn } from './fileUploadingInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with file uploading
|
|
7
7
|
*
|
|
@@ -22,38 +22,48 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
|
|
|
22
22
|
*
|
|
23
23
|
* @handleName upload
|
|
24
24
|
*
|
|
25
|
-
* @param {File | Blob} file - File to upload. Example: new File(["content"], "file.png", {
|
|
26
|
-
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
27
|
-
|
|
25
|
+
* @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
|
|
26
|
+
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
27
|
+
{
|
|
28
|
+
"type": "page",
|
|
29
|
+
"entity": "editor",
|
|
30
|
+
"id": 3787,
|
|
31
|
+
"width": 0,
|
|
32
|
+
"height": 0,
|
|
33
|
+
"compress": true,
|
|
34
|
+
"template": 1
|
|
35
|
+
}
|
|
28
36
|
* @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
|
|
29
37
|
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
30
38
|
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
31
39
|
* @param {number} [fileQuery.width] - Optional width parameter. Example: 0.
|
|
32
40
|
* @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
|
|
33
41
|
* @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
|
|
34
|
-
* @param {
|
|
35
|
-
*
|
|
36
|
-
* @return {IUploadingReturns} Uploads a file to an Amazon S3-compatible cloud file storage.
|
|
42
|
+
* @param {any} [fileQuery.template] - preview template identifier. Example: 1.
|
|
43
|
+
* @return {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
|
|
37
44
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
38
|
-
*
|
|
39
45
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
40
46
|
*/
|
|
41
|
-
upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<
|
|
47
|
+
upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
|
|
42
48
|
/**
|
|
43
49
|
* Deletes a file from the cloud file storage.
|
|
44
50
|
*
|
|
45
51
|
* @handleName delete
|
|
46
52
|
*
|
|
47
53
|
* @param {string} [filename] - File name. Example: "file.png".
|
|
48
|
-
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
54
|
+
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
55
|
+
{
|
|
56
|
+
"type": "page",
|
|
57
|
+
"entity": "editor",
|
|
58
|
+
"id": 3787,
|
|
59
|
+
"template": 1
|
|
60
|
+
}
|
|
49
61
|
* @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
|
|
50
62
|
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
51
63
|
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
52
64
|
* @param {number} [fileQuery.template] - preview template identifier. Example: 1.
|
|
53
|
-
*
|
|
54
65
|
* @return {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
|
|
55
66
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
56
|
-
*
|
|
57
67
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
58
68
|
*/
|
|
59
69
|
delete(filename: string, fileQuery?: IUploadingQuery): Promise<any | IError>;
|
|
@@ -67,10 +77,8 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
|
|
|
67
77
|
* @param {string} [entity] - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
68
78
|
* @param {string} [filename] - Filename. Example: "file.png".
|
|
69
79
|
* @param {string} [template] - Preview template identifier. Example: 1.
|
|
70
|
-
*
|
|
71
80
|
* @return {any} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
|
|
72
81
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
73
|
-
*
|
|
74
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.
|
|
75
83
|
*/
|
|
76
84
|
getFile(id: number, type: string, entity: string, filename: string, template?: string): Promise<any | IError>;
|
|
@@ -33,20 +33,26 @@ class FileUploadingApi extends asyncModules_1.default {
|
|
|
33
33
|
*
|
|
34
34
|
* @handleName upload
|
|
35
35
|
*
|
|
36
|
-
* @param {File | Blob} file - File to upload. Example: new File(["content"], "file.png", {
|
|
37
|
-
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
38
|
-
|
|
36
|
+
* @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
|
|
37
|
+
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
38
|
+
{
|
|
39
|
+
"type": "page",
|
|
40
|
+
"entity": "editor",
|
|
41
|
+
"id": 3787,
|
|
42
|
+
"width": 0,
|
|
43
|
+
"height": 0,
|
|
44
|
+
"compress": true,
|
|
45
|
+
"template": 1
|
|
46
|
+
}
|
|
39
47
|
* @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
|
|
40
48
|
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
41
49
|
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
42
50
|
* @param {number} [fileQuery.width] - Optional width parameter. Example: 0.
|
|
43
51
|
* @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
|
|
44
52
|
* @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
|
|
45
|
-
* @param {
|
|
46
|
-
*
|
|
47
|
-
* @return {IUploadingReturns} Uploads a file to an Amazon S3-compatible cloud file storage.
|
|
53
|
+
* @param {any} [fileQuery.template] - preview template identifier. Example: 1.
|
|
54
|
+
* @return {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
|
|
48
55
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
49
|
-
*
|
|
50
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.
|
|
51
57
|
*/
|
|
52
58
|
async upload(file, fileQuery) {
|
|
@@ -62,15 +68,19 @@ class FileUploadingApi extends asyncModules_1.default {
|
|
|
62
68
|
* @handleName delete
|
|
63
69
|
*
|
|
64
70
|
* @param {string} [filename] - File name. Example: "file.png".
|
|
65
|
-
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
71
|
+
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters. Example:
|
|
72
|
+
{
|
|
73
|
+
"type": "page",
|
|
74
|
+
"entity": "editor",
|
|
75
|
+
"id": 3787,
|
|
76
|
+
"template": 1
|
|
77
|
+
}
|
|
66
78
|
* @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
|
|
67
79
|
* @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
68
80
|
* @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
|
|
69
81
|
* @param {number} [fileQuery.template] - preview template identifier. Example: 1.
|
|
70
|
-
*
|
|
71
82
|
* @return {any} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
|
|
72
83
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
73
|
-
*
|
|
74
84
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
75
85
|
*/
|
|
76
86
|
async delete(filename, fileQuery) {
|
|
@@ -88,10 +98,8 @@ class FileUploadingApi extends asyncModules_1.default {
|
|
|
88
98
|
* @param {string} [entity] - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
89
99
|
* @param {string} [filename] - Filename. Example: "file.png".
|
|
90
100
|
* @param {string} [template] - Preview template identifier. Example: 1.
|
|
91
|
-
*
|
|
92
101
|
* @return {any} Returns a promise that resolves to a Blob object containing the file data or an error object if there was an issue.
|
|
93
102
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
94
|
-
*
|
|
95
103
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
96
104
|
*/
|
|
97
105
|
async getFile(id, type, entity, filename, template) {
|