oneentry 1.0.152 → 1.0.153
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/changelog.md +12 -0
- package/dist/admins/adminsApi.d.ts +2 -1
- package/dist/admins/adminsApi.js +2 -1
- package/dist/admins/adminsInterfaces.d.ts +1 -1
- package/dist/attribute-sets/attributeSetsApi.d.ts +4 -0
- package/dist/attribute-sets/attributeSetsApi.js +4 -0
- package/dist/auth-provider/authProviderApi.d.ts +14 -1
- package/dist/auth-provider/authProviderApi.js +14 -1
- package/dist/base/asyncModules.d.ts +11 -0
- package/dist/base/asyncModules.js +19 -0
- package/dist/blocks/blocksApi.d.ts +34 -1
- package/dist/blocks/blocksApi.js +69 -62
- package/dist/discounts/discountsApi.d.ts +5 -0
- package/dist/discounts/discountsApi.js +5 -0
- package/dist/events/eventsApi.d.ts +7 -0
- package/dist/events/eventsApi.js +11 -28
- package/dist/file-uploading/fileUploadingApi.d.ts +4 -1
- package/dist/file-uploading/fileUploadingApi.js +4 -1
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +1 -1
- package/dist/filters/filtersApi.d.ts +1 -0
- package/dist/filters/filtersApi.js +1 -0
- package/dist/forms/formsApi.d.ts +2 -0
- package/dist/forms/formsApi.js +2 -0
- package/dist/forms-data/formsDataApi.d.ts +5 -0
- package/dist/forms-data/formsDataApi.js +5 -0
- package/dist/general-types/generalTypesApi.d.ts +1 -0
- package/dist/general-types/generalTypesApi.js +1 -0
- package/dist/integration-collections/integrationCollectionsApi.d.ts +10 -1
- package/dist/integration-collections/integrationCollectionsApi.js +10 -1
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +1 -1
- package/dist/locales/localesApi.d.ts +1 -0
- package/dist/locales/localesApi.js +1 -0
- package/dist/menus/menusApi.d.ts +1 -0
- package/dist/menus/menusApi.js +1 -0
- package/dist/orders/ordersApi.d.ts +25 -1
- package/dist/orders/ordersApi.js +36 -12
- package/dist/orders/ordersInterfaces.d.ts +4 -2
- package/dist/pages/pagesApi.d.ts +9 -0
- package/dist/pages/pagesApi.js +33 -38
- package/dist/pages/pagesInterfaces.d.ts +5 -0
- package/dist/payments/paymentsApi.d.ts +6 -0
- package/dist/payments/paymentsApi.js +6 -0
- package/dist/product-statuses/productStatusesApi.d.ts +3 -0
- package/dist/product-statuses/productStatusesApi.js +3 -0
- package/dist/products/productsApi.d.ts +14 -0
- package/dist/products/productsApi.js +14 -0
- package/dist/products/productsInterfaces.d.ts +2 -2
- package/dist/sitemap/sitemapApi.d.ts +2 -0
- package/dist/sitemap/sitemapApi.js +2 -0
- package/dist/subscriptions/subscriptionsApi.d.ts +5 -0
- package/dist/subscriptions/subscriptionsApi.js +7 -14
- package/dist/system/systemApi.d.ts +3 -0
- package/dist/system/systemApi.js +3 -0
- package/dist/templates/templatesApi.d.ts +3 -0
- package/dist/templates/templatesApi.js +3 -0
- package/dist/templates-preview/templatesPreviewApi.d.ts +2 -0
- package/dist/templates-preview/templatesPreviewApi.js +2 -0
- package/dist/user-activity/userActivityApi.d.ts +1 -0
- package/dist/user-activity/userActivityApi.js +1 -0
- package/dist/users/usersApi.d.ts +14 -0
- package/dist/users/usersApi.js +14 -0
- package/dist/web-socket/wsApi.d.ts +1 -1
- package/dist/web-socket/wsApi.js +1 -1
- package/package.json +1 -1
package/dist/blocks/blocksApi.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 jsdoc/reject-any-type */
|
|
6
7
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
8
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
9
|
const blocksSchemas_1 = require("./blocksSchemas");
|
|
@@ -31,6 +32,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
31
32
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
32
33
|
* @returns {Promise<IBlocksResponse | IError>} Returns BlocksEntity object.
|
|
33
34
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
35
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getBlocks getBlocks} documentation.
|
|
34
36
|
*/
|
|
35
37
|
async getBlocks(type, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
36
38
|
// type is omitted from the query when not provided — the API rejects an
|
|
@@ -41,41 +43,8 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
41
43
|
const validated = this._validateResponse(response, blocksSchemas_1.BlocksResponseSchema);
|
|
42
44
|
if (!this.state.traficLimit) {
|
|
43
45
|
const normalizeResponse = this._normalizeData(validated);
|
|
44
|
-
await Promise.all(normalizeResponse.items.map(
|
|
45
|
-
|
|
46
|
-
if (customSettings &&
|
|
47
|
-
Object.prototype.hasOwnProperty.call(customSettings, 'productConfig')) {
|
|
48
|
-
if (customSettings.productConfig.countElementsPerRow)
|
|
49
|
-
block.countElementsPerRow =
|
|
50
|
-
+customSettings.productConfig.countElementsPerRow;
|
|
51
|
-
if (customSettings.productConfig.quantity)
|
|
52
|
-
block.quantity = +customSettings.productConfig.quantity;
|
|
53
|
-
}
|
|
54
|
-
delete block.customSettings;
|
|
55
|
-
delete block.attributesSetIdentifier;
|
|
56
|
-
delete block.productPageUrls;
|
|
57
|
-
if (block.type === 'similar_products_block') {
|
|
58
|
-
try {
|
|
59
|
-
await this.getSimilarProducts(block.identifier, langCode, offset, limit).then((result) => {
|
|
60
|
-
block.similarProducts = result;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
block.similarProducts = [];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
else if (block.type === 'product_block') {
|
|
68
|
-
try {
|
|
69
|
-
await this.getProductsByBlockMarker(block.identifier, langCode, offset, limit).then((result) => {
|
|
70
|
-
block.products = result;
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
block.products = [];
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}));
|
|
78
|
-
return this._normalizeData(normalizeResponse);
|
|
46
|
+
await Promise.all(normalizeResponse.items.map((block) => this._enrichBlock(block, langCode, offset, limit, true)));
|
|
47
|
+
return normalizeResponse;
|
|
79
48
|
}
|
|
80
49
|
return this._normalizeData(validated);
|
|
81
50
|
}
|
|
@@ -89,47 +58,70 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
89
58
|
* @returns {Promise<IBlockEntity | IError>} - Returns a BlockEntity object.
|
|
90
59
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
91
60
|
* @description This method retrieves a block by its marker and includes additional information such as similar products or products associated with the block.
|
|
61
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getBlockByMarker getBlockByMarker} documentation.
|
|
92
62
|
*/
|
|
93
63
|
async getBlockByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
94
64
|
const response = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
95
65
|
// Validate response if validation is enabled
|
|
96
66
|
const validated = this._validateResponse(response, blocksSchemas_1.BlockEntitySchema);
|
|
97
67
|
const normalizeResponse = this._normalizeData(validated);
|
|
98
|
-
|
|
68
|
+
await this._enrichBlock(normalizeResponse, langCode, offset, limit, !this.state.traficLimit);
|
|
69
|
+
return normalizeResponse;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Enrich a single block in place.
|
|
73
|
+
*
|
|
74
|
+
* Lifts product display settings from `customSettings.productConfig` to
|
|
75
|
+
* numeric top-level fields, strips internal-only fields, and — when
|
|
76
|
+
* `loadProducts` is true — fetches the related products for
|
|
77
|
+
* `similar_products_block` / `product_block` blocks. Shared by `getBlocks`
|
|
78
|
+
* (array) and `getBlockByMarker` (single block). Mutates `block` in place.
|
|
79
|
+
* @param {any} block - Normalized block to enrich (mutated in place).
|
|
80
|
+
* @param {string} langCode - Language code passed to product sub-requests.
|
|
81
|
+
* @param {number} offset - Pagination offset for product sub-requests.
|
|
82
|
+
* @param {number} limit - Pagination limit for product sub-requests.
|
|
83
|
+
* @param {boolean} loadProducts - Whether to fetch related products.
|
|
84
|
+
* @returns {Promise<void>} Resolves when enrichment (incl. sub-requests) is done.
|
|
85
|
+
*/
|
|
86
|
+
async _enrichBlock(block, langCode, offset, limit, loadProducts) {
|
|
87
|
+
const customSettings = block.customSettings;
|
|
88
|
+
// Если у блока есть настройки отображения товаров (productConfig) —
|
|
89
|
+
// переносим их на верхний уровень блока в числовом формате (в API значения
|
|
90
|
+
// хранятся строками, поэтому приводим через «+»).
|
|
99
91
|
if (customSettings &&
|
|
100
92
|
Object.prototype.hasOwnProperty.call(customSettings, 'productConfig')) {
|
|
101
93
|
if (customSettings.productConfig.countElementsPerRow)
|
|
102
|
-
|
|
94
|
+
block.countElementsPerRow =
|
|
103
95
|
+customSettings.productConfig.countElementsPerRow;
|
|
104
96
|
if (customSettings.productConfig.quantity)
|
|
105
|
-
|
|
97
|
+
block.quantity = +customSettings.productConfig.quantity;
|
|
106
98
|
}
|
|
107
|
-
|
|
108
|
-
delete
|
|
109
|
-
delete
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
99
|
+
// Убираем служебные/внутренние поля из итогового объекта блока.
|
|
100
|
+
delete block.customSettings;
|
|
101
|
+
delete block.attributesSetIdentifier;
|
|
102
|
+
delete block.productPageUrls;
|
|
103
|
+
// В режиме экономии трафика товары не подгружаем.
|
|
104
|
+
if (!loadProducts)
|
|
105
|
+
return;
|
|
106
|
+
// Подгружаем связанные товары по идентификатору блока. При ошибке запроса
|
|
107
|
+
// подставляем пустой массив, чтобы один упавший подзапрос не ронял весь
|
|
108
|
+
// ответ (в getBlocks — не ломал обработку остальных блоков).
|
|
109
|
+
if (block.type === 'similar_products_block') {
|
|
110
|
+
try {
|
|
111
|
+
block.similarProducts = await this.getSimilarProducts(block.identifier, langCode, offset, limit);
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
block.similarProducts = [];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else if (block.type === 'product_block') {
|
|
118
|
+
try {
|
|
119
|
+
block.products = await this.getProductsByBlockMarker(block.identifier, langCode, offset, limit);
|
|
120
120
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
await this.getProductsByBlockMarker(normalizeResponse.identifier, langCode, offset, limit).then((result) => {
|
|
124
|
-
normalizeResponse.products = result;
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
catch {
|
|
128
|
-
normalizeResponse.products = [];
|
|
129
|
-
}
|
|
121
|
+
catch {
|
|
122
|
+
block.products = [];
|
|
130
123
|
}
|
|
131
124
|
}
|
|
132
|
-
return this._normalizeData(normalizeResponse);
|
|
133
125
|
}
|
|
134
126
|
/**
|
|
135
127
|
* Get similar products by block marker.
|
|
@@ -140,8 +132,9 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
140
132
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
141
133
|
* @param {string} [signPrice] - Sign price.
|
|
142
134
|
* @param {number} [productId] - Optional product id to find similar products for.
|
|
143
|
-
* @returns {Promise<IProductsResponse | IError>}
|
|
135
|
+
* @returns {Promise<IProductsResponse | IError>} Returns the total count and an array of product items in object by specified block marker.
|
|
144
136
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
137
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getSimilarProducts getSimilarProducts} documentation.
|
|
145
138
|
*/
|
|
146
139
|
async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30, signPrice, productId) {
|
|
147
140
|
const query = {
|
|
@@ -164,6 +157,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
164
157
|
* @param {string} [signPrice] - Sign price.
|
|
165
158
|
* @returns {Promise<IProductsEntity[] | IError>} Return array of BlocksEntity object.
|
|
166
159
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
160
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getProductsByBlockMarker getProductsByBlockMarker} documentation.
|
|
167
161
|
*/
|
|
168
162
|
async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30, signPrice) {
|
|
169
163
|
const query = {
|
|
@@ -184,6 +178,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
184
178
|
* @param {string} [signPrice] - Sign price.
|
|
185
179
|
* @returns {Promise<IProductsResponse | IError>} Returns a products response with items and total.
|
|
186
180
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
181
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getFrequentlyOrderedProducts getFrequentlyOrderedProducts} documentation.
|
|
187
182
|
*/
|
|
188
183
|
async getFrequentlyOrderedProducts(productId, marker, langCode = this.state.lang, signPrice) {
|
|
189
184
|
const query = {
|
|
@@ -201,6 +196,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
201
196
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
202
197
|
* @returns {Promise<ISearchBlock[] | IError>} Returns an array of ISearchBlock objects.
|
|
203
198
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
199
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/searchBlock searchBlock} documentation.
|
|
204
200
|
*/
|
|
205
201
|
async searchBlock(name, langCode = this.state.lang) {
|
|
206
202
|
const result = await this._fetchGet(`/quick/search?langCode=${langCode}&name=${name}`);
|
|
@@ -216,6 +212,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
216
212
|
* @param {string} [signPrice] - Sign price.
|
|
217
213
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
218
214
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
215
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartComplement getCartComplement} documentation.
|
|
219
216
|
*/
|
|
220
217
|
async getCartComplement(marker, langCode = this.state.lang, signPrice) {
|
|
221
218
|
const query = { langCode, signPrice };
|
|
@@ -234,6 +231,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
234
231
|
}
|
|
235
232
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
236
233
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
234
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartComplementByProductIds getCartComplementByProductIds} documentation.
|
|
237
235
|
*/
|
|
238
236
|
async getCartComplementByProductIds(marker, body) {
|
|
239
237
|
const data = await this._fetchPost(`/${marker}/cart-complement`, { langCode: this.state.lang, ...body });
|
|
@@ -247,6 +245,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
247
245
|
* @param {string} [signPrice] - Sign price.
|
|
248
246
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
249
247
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
248
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartSimilar getCartSimilar} documentation.
|
|
250
249
|
*/
|
|
251
250
|
async getCartSimilar(marker, langCode = this.state.lang, signPrice) {
|
|
252
251
|
const query = { langCode, signPrice };
|
|
@@ -265,6 +264,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
265
264
|
}
|
|
266
265
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
267
266
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
267
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getCartSimilarByProductIds getCartSimilarByProductIds} documentation.
|
|
268
268
|
*/
|
|
269
269
|
async getCartSimilarByProductIds(marker, body) {
|
|
270
270
|
const data = await this._fetchPost(`/${marker}/cart-similar`, { langCode: this.state.lang, ...body });
|
|
@@ -278,6 +278,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
278
278
|
* @param {string} [signPrice] - Sign price.
|
|
279
279
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
280
280
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
281
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getPersonalRecommendations getPersonalRecommendations} documentation.
|
|
281
282
|
*/
|
|
282
283
|
async getPersonalRecommendations(marker, langCode = this.state.lang, signPrice) {
|
|
283
284
|
const query = { langCode, signPrice };
|
|
@@ -292,6 +293,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
292
293
|
* @param {string} [signPrice] - Sign price.
|
|
293
294
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
294
295
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
296
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getRecentlyViewed getRecentlyViewed} documentation.
|
|
295
297
|
*/
|
|
296
298
|
async getRecentlyViewed(marker, langCode = this.state.lang, signPrice) {
|
|
297
299
|
const query = { langCode, signPrice };
|
|
@@ -306,6 +308,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
306
308
|
* @param {string} [signPrice] - Sign price.
|
|
307
309
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
308
310
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
311
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getRepeatPurchase getRepeatPurchase} documentation.
|
|
309
312
|
*/
|
|
310
313
|
async getRepeatPurchase(marker, langCode = this.state.lang, signPrice) {
|
|
311
314
|
const query = { langCode, signPrice };
|
|
@@ -318,6 +321,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
318
321
|
* @param {string} marker - Block marker. Example: "slider_block".
|
|
319
322
|
* @returns {Promise<IBlockSlidesResponse | IError>} Returns the slides response.
|
|
320
323
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
324
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getSlides getSlides} documentation.
|
|
321
325
|
*/
|
|
322
326
|
async getSlides(marker) {
|
|
323
327
|
const data = await this._fetchGet(`/${marker}/slides`);
|
|
@@ -331,6 +335,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
331
335
|
* @param {string} [signPrice] - Sign price.
|
|
332
336
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
333
337
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
338
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getTrending getTrending} documentation.
|
|
334
339
|
*/
|
|
335
340
|
async getTrending(marker, langCode = this.state.lang, signPrice) {
|
|
336
341
|
const query = { langCode, signPrice };
|
|
@@ -345,6 +350,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
345
350
|
* @param {string} [signPrice] - Sign price.
|
|
346
351
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
347
352
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
353
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getWishlistSimilar getWishlistSimilar} documentation.
|
|
348
354
|
*/
|
|
349
355
|
async getWishlistSimilar(marker, langCode = this.state.lang, signPrice) {
|
|
350
356
|
const query = { langCode, signPrice };
|
|
@@ -363,6 +369,7 @@ class BlocksApi extends asyncModules_1.default {
|
|
|
363
369
|
}
|
|
364
370
|
* @returns {Promise<IProductsEntity[] | IError>} Returns an array of products.
|
|
365
371
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
372
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/blocks/getWishlistSimilarByProductIds getWishlistSimilarByProductIds} documentation.
|
|
366
373
|
*/
|
|
367
374
|
async getWishlistSimilarByProductIds(marker, body) {
|
|
368
375
|
const data = await this._fetchPost(`/${marker}/wishlist-similar`, { langCode: this.state.lang, ...body });
|
|
@@ -32,6 +32,7 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
|
|
|
32
32
|
* @returns {Promise<IDiscountsResponse | IError>} Returns an object containing all discounts or an error object if there was an issue.
|
|
33
33
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
34
34
|
* @description Fetches all discounts from the server.
|
|
35
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getAllDiscounts getAllDiscounts} documentation.
|
|
35
36
|
*/
|
|
36
37
|
getAllDiscounts(langCode?: string, offset?: number, limit?: number, type?: IDiscountType): Promise<IDiscountsResponse | IError>;
|
|
37
38
|
/**
|
|
@@ -42,6 +43,7 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
|
|
|
42
43
|
* @returns {Promise<IDiscountsEntity | IError>} Returns an object containing discount by marker or an error object if there was an issue.
|
|
43
44
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
44
45
|
* @description Fetches a discount by its marker.
|
|
46
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getDiscountByMarker getDiscountByMarker} documentation.
|
|
45
47
|
*/
|
|
46
48
|
getDiscountByMarker(marker: string, langCode?: string): Promise<IDiscountsEntity | IError>;
|
|
47
49
|
/**
|
|
@@ -49,6 +51,7 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
|
|
|
49
51
|
* @handleName getBonusBalance
|
|
50
52
|
* @returns {Promise<IBonusBalanceEntity | IError>} Returns bonus balance or an error object.
|
|
51
53
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
54
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getBonusBalance getBonusBalance} documentation.
|
|
52
55
|
*/
|
|
53
56
|
getBonusBalance(): Promise<IBonusBalanceEntity | IError>;
|
|
54
57
|
/**
|
|
@@ -62,6 +65,7 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
|
|
|
62
65
|
* @param {boolean} [isAdmin] - Admin filter.
|
|
63
66
|
* @returns {Promise<IBonusTransactionEntity[] | IError>} Returns array of bonus transactions or an error object.
|
|
64
67
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
68
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getBonusHistory getBonusHistory} documentation.
|
|
65
69
|
*/
|
|
66
70
|
getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusTransactionEntity[] | IError>;
|
|
67
71
|
/**
|
|
@@ -71,6 +75,7 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
|
|
|
71
75
|
* @returns {Promise<ICouponValidationResult | IError>} Returns an coupon validation result or an error object if there was an issue.
|
|
72
76
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
73
77
|
* @description This function validates a coupon code and returns the result.
|
|
78
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/discounts/validateDiscountsCoupon validateDiscountsCoupon} documentation.
|
|
74
79
|
*/
|
|
75
80
|
validateDiscountsCoupon(code: string): Promise<ICouponValidationResult | IError>;
|
|
76
81
|
}
|
|
@@ -35,6 +35,7 @@ class DiscountsApi extends asyncModules_1.default {
|
|
|
35
35
|
* @returns {Promise<IDiscountsResponse | IError>} Returns an object containing all discounts or an error object if there was an issue.
|
|
36
36
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
37
37
|
* @description Fetches all discounts from the server.
|
|
38
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getAllDiscounts getAllDiscounts} documentation.
|
|
38
39
|
*/
|
|
39
40
|
async getAllDiscounts(langCode = this.state.lang, offset = 0, limit = 30, type) {
|
|
40
41
|
const query = {
|
|
@@ -54,6 +55,7 @@ class DiscountsApi extends asyncModules_1.default {
|
|
|
54
55
|
* @returns {Promise<IDiscountsEntity | IError>} Returns an object containing discount by marker or an error object if there was an issue.
|
|
55
56
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
56
57
|
* @description Fetches a discount by its marker.
|
|
58
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getDiscountByMarker getDiscountByMarker} documentation.
|
|
57
59
|
*/
|
|
58
60
|
async getDiscountByMarker(marker, langCode = this.state.lang) {
|
|
59
61
|
const query = {
|
|
@@ -68,6 +70,7 @@ class DiscountsApi extends asyncModules_1.default {
|
|
|
68
70
|
* @handleName getBonusBalance
|
|
69
71
|
* @returns {Promise<IBonusBalanceEntity | IError>} Returns bonus balance or an error object.
|
|
70
72
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
73
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getBonusBalance getBonusBalance} documentation.
|
|
71
74
|
*/
|
|
72
75
|
async getBonusBalance() {
|
|
73
76
|
const data = await this._fetchGet(`/bonus-balance`);
|
|
@@ -84,6 +87,7 @@ class DiscountsApi extends asyncModules_1.default {
|
|
|
84
87
|
* @param {boolean} [isAdmin] - Admin filter.
|
|
85
88
|
* @returns {Promise<IBonusTransactionEntity[] | IError>} Returns array of bonus transactions or an error object.
|
|
86
89
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
90
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getBonusHistory getBonusHistory} documentation.
|
|
87
91
|
*/
|
|
88
92
|
async getBonusHistory(type, dateFrom, dateTo, discountId, moduleId, isAdmin) {
|
|
89
93
|
const query = {
|
|
@@ -104,6 +108,7 @@ class DiscountsApi extends asyncModules_1.default {
|
|
|
104
108
|
* @returns {Promise<ICouponValidationResult | IError>} Returns an coupon validation result or an error object if there was an issue.
|
|
105
109
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
106
110
|
* @description This function validates a coupon code and returns the result.
|
|
111
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/discounts/validateDiscountsCoupon validateDiscountsCoupon} documentation.
|
|
107
112
|
*/
|
|
108
113
|
async validateDiscountsCoupon(code) {
|
|
109
114
|
const query = {
|
|
@@ -31,6 +31,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
31
31
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
32
32
|
* @description This method requires user authorization.
|
|
33
33
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
34
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/events/getAllSubscriptions getAllSubscriptions} documentation.
|
|
34
35
|
*/
|
|
35
36
|
getAllSubscriptions(offset?: number, limit?: number): Promise<ISubscriptions | IError>;
|
|
36
37
|
/**
|
|
@@ -43,6 +44,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
43
44
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
44
45
|
* @description This method requires user authorization.
|
|
45
46
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
47
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/events/subscribeByMarker subscribeByMarker} documentation.
|
|
46
48
|
*/
|
|
47
49
|
subscribeByMarker(marker: string, productId: number, langCode?: string): Promise<boolean | IError>;
|
|
48
50
|
/**
|
|
@@ -55,6 +57,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
55
57
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
56
58
|
* @description This method requires user authorization.
|
|
57
59
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
60
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/events/unsubscribeByMarker unsubscribeByMarker} documentation.
|
|
58
61
|
*/
|
|
59
62
|
unsubscribeByMarker(marker: string, productId: number, langCode?: string): Promise<boolean | IError>;
|
|
60
63
|
/**
|
|
@@ -63,6 +66,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
63
66
|
* @returns {Promise<IContentApiEvent[] | IError>} Returns an array of available events.
|
|
64
67
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
65
68
|
* @description This method returns all available events.
|
|
69
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/events/getAllEvents getAllEvents} documentation.
|
|
66
70
|
*/
|
|
67
71
|
getAllEvents(): Promise<IContentApiEvent[] | IError>;
|
|
68
72
|
/**
|
|
@@ -74,6 +78,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
74
78
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
75
79
|
* @description This method requires user authorization.
|
|
76
80
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
81
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/events/subscribeToForm subscribeToForm} documentation.
|
|
77
82
|
*/
|
|
78
83
|
subscribeToForm(marker: string, body: ISubscribeFormEvent): Promise<boolean | IError>;
|
|
79
84
|
/**
|
|
@@ -85,6 +90,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
85
90
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
86
91
|
* @description This method requires user authorization.
|
|
87
92
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
93
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/events/getFormSubscriptions getFormSubscriptions} documentation.
|
|
88
94
|
*/
|
|
89
95
|
getFormSubscriptions(offset?: number, limit?: number): Promise<IListFormSubscription[] | IError>;
|
|
90
96
|
/**
|
|
@@ -96,6 +102,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
96
102
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
97
103
|
* @description This method requires user authorization.
|
|
98
104
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
105
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/events/unsubscribeFromForm unsubscribeFromForm} documentation.
|
|
99
106
|
*/
|
|
100
107
|
unsubscribeFromForm(marker: string, body: ISubscribeFormEvent): Promise<boolean | IError>;
|
|
101
108
|
}
|
package/dist/events/eventsApi.js
CHANGED
|
@@ -36,6 +36,7 @@ class EventsApi extends asyncModules_1.default {
|
|
|
36
36
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
37
37
|
* @description This method requires user authorization.
|
|
38
38
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
39
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/events/getAllSubscriptions getAllSubscriptions} documentation.
|
|
39
40
|
*/
|
|
40
41
|
async getAllSubscriptions(offset = 0, limit = 30) {
|
|
41
42
|
const query = {
|
|
@@ -55,19 +56,14 @@ class EventsApi extends asyncModules_1.default {
|
|
|
55
56
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
56
57
|
* @description This method requires user authorization.
|
|
57
58
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
59
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/events/subscribeByMarker subscribeByMarker} documentation.
|
|
58
60
|
*/
|
|
59
61
|
async subscribeByMarker(marker, productId, langCode = this.state.lang) {
|
|
60
62
|
const body = {
|
|
61
63
|
locale: langCode,
|
|
62
64
|
productId,
|
|
63
65
|
};
|
|
64
|
-
|
|
65
|
-
await this._fetchPost(`/subscribe/marker/${marker}`, body);
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
catch (e) {
|
|
69
|
-
return e;
|
|
70
|
-
}
|
|
66
|
+
return this._fetchBoolean(() => this._fetchPost(`/subscribe/marker/${marker}`, body));
|
|
71
67
|
}
|
|
72
68
|
/**
|
|
73
69
|
* Unsubscribing to an event on a product.
|
|
@@ -79,19 +75,14 @@ class EventsApi extends asyncModules_1.default {
|
|
|
79
75
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
80
76
|
* @description This method requires user authorization.
|
|
81
77
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
78
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/events/unsubscribeByMarker unsubscribeByMarker} documentation.
|
|
82
79
|
*/
|
|
83
80
|
async unsubscribeByMarker(marker, productId, langCode = this.state.lang) {
|
|
84
81
|
const body = {
|
|
85
82
|
productId: productId,
|
|
86
83
|
locale: langCode,
|
|
87
84
|
};
|
|
88
|
-
|
|
89
|
-
await this._fetchDelete(`/unsubscribe/marker/${marker}`, body);
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
catch (e) {
|
|
93
|
-
return e;
|
|
94
|
-
}
|
|
85
|
+
return this._fetchBoolean(() => this._fetchDelete(`/unsubscribe/marker/${marker}`, body));
|
|
95
86
|
}
|
|
96
87
|
/**
|
|
97
88
|
* Returns all available events.
|
|
@@ -99,6 +90,7 @@ class EventsApi extends asyncModules_1.default {
|
|
|
99
90
|
* @returns {Promise<IContentApiEvent[] | IError>} Returns an array of available events.
|
|
100
91
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
101
92
|
* @description This method returns all available events.
|
|
93
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/events/getAllEvents getAllEvents} documentation.
|
|
102
94
|
*/
|
|
103
95
|
async getAllEvents() {
|
|
104
96
|
const data = await this._fetchGet(`/all`);
|
|
@@ -113,15 +105,10 @@ class EventsApi extends asyncModules_1.default {
|
|
|
113
105
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
114
106
|
* @description This method requires user authorization.
|
|
115
107
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
108
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/events/subscribeToForm subscribeToForm} documentation.
|
|
116
109
|
*/
|
|
117
110
|
async subscribeToForm(marker, body) {
|
|
118
|
-
|
|
119
|
-
await this._fetchPost(`/forms/subscribe/marker/${marker}`, body);
|
|
120
|
-
return true;
|
|
121
|
-
}
|
|
122
|
-
catch (e) {
|
|
123
|
-
return e;
|
|
124
|
-
}
|
|
111
|
+
return this._fetchBoolean(() => this._fetchPost(`/forms/subscribe/marker/${marker}`, body));
|
|
125
112
|
}
|
|
126
113
|
/**
|
|
127
114
|
* Returns all form subscriptions.
|
|
@@ -132,6 +119,7 @@ class EventsApi extends asyncModules_1.default {
|
|
|
132
119
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
133
120
|
* @description This method requires user authorization.
|
|
134
121
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
122
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/events/getFormSubscriptions getFormSubscriptions} documentation.
|
|
135
123
|
*/
|
|
136
124
|
async getFormSubscriptions(offset = 0, limit = 30) {
|
|
137
125
|
const query = {
|
|
@@ -150,15 +138,10 @@ class EventsApi extends asyncModules_1.default {
|
|
|
150
138
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
151
139
|
* @description This method requires user authorization.
|
|
152
140
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
141
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/events/unsubscribeFromForm unsubscribeFromForm} documentation.
|
|
153
142
|
*/
|
|
154
143
|
async unsubscribeFromForm(marker, body) {
|
|
155
|
-
|
|
156
|
-
await this._fetchDelete(`/forms/unsubscribe/marker/${marker}`, body);
|
|
157
|
-
return true;
|
|
158
|
-
}
|
|
159
|
-
catch (e) {
|
|
160
|
-
return e;
|
|
161
|
-
}
|
|
144
|
+
return this._fetchBoolean(() => this._fetchDelete(`/forms/unsubscribe/marker/${marker}`, body));
|
|
162
145
|
}
|
|
163
146
|
}
|
|
164
147
|
exports.default = EventsApi;
|
|
@@ -43,6 +43,7 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
|
|
|
43
43
|
* @param {string | number} [fileQuery.template] - preview template identifier. Example: 1.
|
|
44
44
|
* @returns {Promise<IUploadingReturn[] | IError>} Uploads a file to an Amazon S3-compatible cloud file storage.
|
|
45
45
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
46
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/upload upload} documentation.
|
|
46
47
|
*/
|
|
47
48
|
upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
|
|
48
49
|
/**
|
|
@@ -63,6 +64,7 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
|
|
|
63
64
|
* @param {number} [fileQuery.template] - preview template identifier. Example: 1.
|
|
64
65
|
* @returns {Promise<boolean | IError>} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
|
|
65
66
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
67
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/delete delete} documentation.
|
|
66
68
|
*/
|
|
67
69
|
delete(filename: string, fileQuery?: IUploadingQuery): Promise<boolean | IError>;
|
|
68
70
|
/**
|
|
@@ -80,9 +82,10 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
|
|
|
80
82
|
* @param {string} type - Type, determines the folder name in the storage. Example: "page".
|
|
81
83
|
* @param {string} entity - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
82
84
|
* @param {string} filename - Filename. Example: "file.png".
|
|
83
|
-
* @param {string} [template] - Preview template identifier. Example:
|
|
85
|
+
* @param {string} [template] - Preview template identifier. Example: "preview_template".
|
|
84
86
|
* @returns {Promise<Response | IError>} Returns a promise that resolves to a Response object containing the file data or an error object if there was an issue.
|
|
85
87
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
88
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/getFile getFile} documentation.
|
|
86
89
|
*/
|
|
87
90
|
getFile(id: number, type: string, entity: string, filename: string, template?: string): Promise<Response | IError>;
|
|
88
91
|
}
|
|
@@ -55,6 +55,7 @@ class FileUploadingApi extends asyncModules_1.default {
|
|
|
55
55
|
* @param {string | number} [fileQuery.template] - preview template identifier. Example: 1.
|
|
56
56
|
* @returns {Promise<IUploadingReturn[] | IError>} Uploads a file to an Amazon S3-compatible cloud file storage.
|
|
57
57
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
58
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/upload upload} documentation.
|
|
58
59
|
*/
|
|
59
60
|
async upload(file, fileQuery) {
|
|
60
61
|
const query = { ...this._defaultQuery, ...fileQuery };
|
|
@@ -83,6 +84,7 @@ class FileUploadingApi extends asyncModules_1.default {
|
|
|
83
84
|
* @param {number} [fileQuery.template] - preview template identifier. Example: 1.
|
|
84
85
|
* @returns {Promise<boolean | IError>} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
|
|
85
86
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
87
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/delete delete} documentation.
|
|
86
88
|
*/
|
|
87
89
|
async delete(filename, fileQuery) {
|
|
88
90
|
const query = { ...this._defaultQuery, ...fileQuery };
|
|
@@ -110,9 +112,10 @@ class FileUploadingApi extends asyncModules_1.default {
|
|
|
110
112
|
* @param {string} type - Type, determines the folder name in the storage. Example: "page".
|
|
111
113
|
* @param {string} entity - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
112
114
|
* @param {string} filename - Filename. Example: "file.png".
|
|
113
|
-
* @param {string} [template] - Preview template identifier. Example:
|
|
115
|
+
* @param {string} [template] - Preview template identifier. Example: "preview_template".
|
|
114
116
|
* @returns {Promise<Response | IError>} Returns a promise that resolves to a Response object containing the file data or an error object if there was an issue.
|
|
115
117
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
118
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/getFile getFile} documentation.
|
|
116
119
|
*/
|
|
117
120
|
async getFile(id, type, entity, filename, template) {
|
|
118
121
|
// eslint-disable-next-line no-undef
|
|
@@ -66,7 +66,7 @@ interface IFileUploading {
|
|
|
66
66
|
* @param {string} type - Type, determines the folder name in the storage. Example: "page".
|
|
67
67
|
* @param {string} entity - Entity name, from which the file is uploaded, determines the folder name in the storage. Example: "editor".
|
|
68
68
|
* @param {string} filename - Filename. Example: "file.png".
|
|
69
|
-
* @param {string} [template] - Preview template identifier. Example: 1.
|
|
69
|
+
* @param {string} [template] - Preview template identifier. Example: "1".
|
|
70
70
|
* @returns {Response | IError} Returns a promise that resolves to a Response object containing the file data or an error object if there was an issue.
|
|
71
71
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
72
72
|
*/
|
|
@@ -26,6 +26,7 @@ export default class FiltersApi extends AsyncModules implements IFiltersApi {
|
|
|
26
26
|
* @returns {Promise<IContentFilter | IError>} Returns the filter with its items tree.
|
|
27
27
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
28
28
|
* @description Retrieves a single content filter by marker.
|
|
29
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/filters/getFilterByMarker getFilterByMarker} documentation.
|
|
29
30
|
*/
|
|
30
31
|
getFilterByMarker(marker: string, langCode?: string): Promise<IContentFilter | IError>;
|
|
31
32
|
}
|
|
@@ -30,6 +30,7 @@ class FiltersApi extends asyncModules_1.default {
|
|
|
30
30
|
* @returns {Promise<IContentFilter | IError>} Returns the filter with its items tree.
|
|
31
31
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
32
32
|
* @description Retrieves a single content filter by marker.
|
|
33
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/filters/getFilterByMarker getFilterByMarker} documentation.
|
|
33
34
|
*/
|
|
34
35
|
async getFilterByMarker(marker, langCode = this.state.lang) {
|
|
35
36
|
const data = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
package/dist/forms/formsApi.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export default class FormsApi extends AsyncModules implements IForms {
|
|
|
28
28
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
29
29
|
* @returns {Promise<IFormsResponse | IError>} Returns paginated object with array of FormEntity and total count.
|
|
30
30
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
31
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms/getAllForms getAllForms} documentation.
|
|
31
32
|
*/
|
|
32
33
|
getAllForms(langCode?: string, offset?: number, limit?: number): Promise<IFormsResponse | IError>;
|
|
33
34
|
/**
|
|
@@ -37,6 +38,7 @@ export default class FormsApi extends AsyncModules implements IForms {
|
|
|
37
38
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
38
39
|
* @returns {Promise<IFormsEntity | IError>} Returns object of type FormEntity.
|
|
39
40
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
41
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms/getFormByMarker getFormByMarker} documentation.
|
|
40
42
|
*/
|
|
41
43
|
getFormByMarker(marker: string, langCode?: string): Promise<IFormsEntity | IError>;
|
|
42
44
|
}
|
package/dist/forms/formsApi.js
CHANGED
|
@@ -32,6 +32,7 @@ class FormsApi extends asyncModules_1.default {
|
|
|
32
32
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
33
33
|
* @returns {Promise<IFormsResponse | IError>} Returns paginated object with array of FormEntity and total count.
|
|
34
34
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
35
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms/getAllForms getAllForms} documentation.
|
|
35
36
|
*/
|
|
36
37
|
async getAllForms(langCode = this.state.lang, offset = 0, limit = 30) {
|
|
37
38
|
const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
@@ -46,6 +47,7 @@ class FormsApi extends asyncModules_1.default {
|
|
|
46
47
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
47
48
|
* @returns {Promise<IFormsEntity | IError>} Returns object of type FormEntity.
|
|
48
49
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
50
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms/getFormByMarker getFormByMarker} documentation.
|
|
49
51
|
*/
|
|
50
52
|
async getFormByMarker(marker, langCode = this.state.lang) {
|
|
51
53
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|