oneentry 1.0.156 → 1.0.158
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 +143 -0
- package/dist/attribute-sets/attributeSetsApi.d.ts +2 -2
- package/dist/attribute-sets/attributeSetsApi.js +5 -5
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +20 -8
- package/dist/auth-provider/authProviderSchemas.d.ts +2 -0
- package/dist/auth-provider/authProviderSchemas.js +2 -0
- package/dist/auth-provider/authProvidersInterfaces.d.ts +4 -0
- package/dist/base/asyncModules.d.ts +18 -2
- package/dist/base/asyncModules.js +32 -8
- package/dist/base/syncModules.d.ts +37 -36
- package/dist/base/syncModules.js +69 -82
- package/dist/base/timeIntervals.js +6 -5
- package/dist/base/utils.d.ts +14 -10
- package/dist/blocks/blocksApi.d.ts +21 -21
- package/dist/blocks/blocksApi.js +10 -10
- package/dist/blocks/blocksInterfaces.d.ts +20 -20
- package/dist/blocks/blocksSchemas.d.ts +2 -0
- package/dist/discounts/discountsInterfaces.d.ts +4 -4
- package/dist/events/eventsApi.d.ts +3 -3
- package/dist/events/eventsApi.js +1 -1
- package/dist/events/eventsInterfaces.d.ts +16 -5
- package/dist/forms/formsApi.js +2 -2
- package/dist/forms/formsInterfaces.d.ts +23 -21
- package/dist/forms-data/formsDataApi.js +2 -2
- package/dist/forms-data/formsDataInterfaces.d.ts +4 -4
- package/dist/integration-collections/integrationCollectionsApi.js +6 -6
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +4 -0
- package/dist/integration-collections/integrationCollectionsSchemas.d.ts +4 -0
- package/dist/integration-collections/integrationCollectionsSchemas.js +2 -0
- package/dist/menus/menusApi.js +1 -1
- package/dist/orders/ordersInterfaces.d.ts +21 -3
- package/dist/orders/ordersSchemas.d.ts +10 -0
- package/dist/orders/ordersSchemas.js +12 -0
- package/dist/pages/pagesApi.d.ts +4 -4
- package/dist/pages/pagesApi.js +10 -9
- package/dist/pages/pagesInterfaces.d.ts +14 -4
- package/dist/pages/pagesSchemas.d.ts +15 -0
- package/dist/pages/pagesSchemas.js +13 -1
- package/dist/products/productsApi.d.ts +6 -6
- package/dist/products/productsApi.js +13 -11
- package/dist/products/productsInterfaces.d.ts +39 -19
- package/dist/products/productsSchemas.d.ts +18 -0
- package/dist/products/productsSchemas.js +15 -1
- package/dist/subscriptions/subscriptionsApi.d.ts +4 -4
- package/dist/subscriptions/subscriptionsApi.js +3 -3
- package/dist/subscriptions/subscriptionsInterfaces.d.ts +26 -5
- package/dist/subscriptions/subscriptionsSchemas.d.ts +27 -1
- package/dist/subscriptions/subscriptionsSchemas.js +20 -2
- package/package.json +1 -1
|
@@ -69,6 +69,10 @@ export declare const OrderEntitySchema: z.ZodObject<{
|
|
|
69
69
|
isPartial: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
70
70
|
paymentStrategy: z.ZodOptional<z.ZodString>;
|
|
71
71
|
statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
72
|
+
fulfillmentStatusIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
73
|
+
fulfillmentStatusLocalizeInfos: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
74
|
+
paymentStatusIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
|
+
paymentStatusLocalizeInfos: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
72
76
|
discountConfig: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
73
77
|
bonus: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
74
78
|
availableBalance: z.ZodNumber;
|
|
@@ -133,6 +137,10 @@ export declare const OrdersResponseSchema: z.ZodObject<{
|
|
|
133
137
|
isPartial: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
134
138
|
paymentStrategy: z.ZodOptional<z.ZodString>;
|
|
135
139
|
statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
140
|
+
fulfillmentStatusIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
141
|
+
fulfillmentStatusLocalizeInfos: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
142
|
+
paymentStatusIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
143
|
+
paymentStatusLocalizeInfos: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
136
144
|
discountConfig: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
137
145
|
bonus: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
138
146
|
availableBalance: z.ZodNumber;
|
|
@@ -220,6 +228,7 @@ export declare const CreateOrderResponseSchema: z.ZodObject<{
|
|
|
220
228
|
totalSum: z.ZodNumber;
|
|
221
229
|
createdDate: z.ZodOptional<z.ZodString>;
|
|
222
230
|
statusIdentifier: z.ZodOptional<z.ZodString>;
|
|
231
|
+
statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
223
232
|
couponCode: z.ZodOptional<z.ZodString>;
|
|
224
233
|
additionalDiscountsMarkers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
225
234
|
discountConfig: z.ZodOptional<z.ZodObject<{
|
|
@@ -267,6 +276,7 @@ export declare const UpdateOrderResponseSchema: z.ZodObject<{
|
|
|
267
276
|
totalSum: z.ZodNumber;
|
|
268
277
|
createdDate: z.ZodOptional<z.ZodString>;
|
|
269
278
|
statusIdentifier: z.ZodOptional<z.ZodString>;
|
|
279
|
+
statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
270
280
|
couponCode: z.ZodOptional<z.ZodString>;
|
|
271
281
|
additionalDiscountsMarkers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
272
282
|
discountConfig: z.ZodOptional<z.ZodObject<{
|
|
@@ -75,6 +75,16 @@ exports.OrderEntitySchema = zod_1.z.object({
|
|
|
75
75
|
isPartial: zod_1.z.boolean().nullable().optional(),
|
|
76
76
|
paymentStrategy: zod_1.z.string().optional(),
|
|
77
77
|
statusLocalizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
78
|
+
fulfillmentStatusIdentifier: zod_1.z.string().nullable().optional(),
|
|
79
|
+
fulfillmentStatusLocalizeInfos: zod_1.z
|
|
80
|
+
.record(zod_1.z.string(), zod_1.z.any())
|
|
81
|
+
.nullable()
|
|
82
|
+
.optional(),
|
|
83
|
+
paymentStatusIdentifier: zod_1.z.string().nullable().optional(),
|
|
84
|
+
paymentStatusLocalizeInfos: zod_1.z
|
|
85
|
+
.record(zod_1.z.string(), zod_1.z.any())
|
|
86
|
+
.nullable()
|
|
87
|
+
.optional(),
|
|
78
88
|
discountConfig: exports.OrderDiscountConfigSchema.nullable().optional(),
|
|
79
89
|
split: zod_1.z
|
|
80
90
|
.object({
|
|
@@ -132,6 +142,7 @@ exports.CreateOrderResponseSchema = zod_1.z.object({
|
|
|
132
142
|
totalSum: zod_1.z.number(),
|
|
133
143
|
createdDate: zod_1.z.string().optional(),
|
|
134
144
|
statusIdentifier: zod_1.z.string().optional(),
|
|
145
|
+
statusLocalizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
135
146
|
couponCode: zod_1.z.string().optional(),
|
|
136
147
|
additionalDiscountsMarkers: zod_1.z.array(zod_1.z.string()).optional(),
|
|
137
148
|
discountConfig: exports.OrderDiscountConfigSchema.optional(),
|
|
@@ -153,6 +164,7 @@ exports.UpdateOrderResponseSchema = zod_1.z.object({
|
|
|
153
164
|
totalSum: zod_1.z.number(),
|
|
154
165
|
createdDate: zod_1.z.string().optional(),
|
|
155
166
|
statusIdentifier: zod_1.z.string().optional(),
|
|
167
|
+
statusLocalizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
156
168
|
couponCode: zod_1.z.string().optional(),
|
|
157
169
|
additionalDiscountsMarkers: zod_1.z.array(zod_1.z.string()).optional(),
|
|
158
170
|
discountConfig: exports.OrderDiscountConfigSchema.optional(),
|
package/dist/pages/pagesApi.d.ts
CHANGED
|
@@ -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 { IPageConfig, IPagesApi, IPagesEntity, IPositionBlock } from './pagesInterfaces';
|
|
4
|
+
import type { IPageConfig, IPagesApi, IPageSearchResult, IPagesEntity, IPositionBlock } from './pagesInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with page objects, including catalog pages
|
|
7
7
|
* @handle /api/content/pages
|
|
@@ -96,12 +96,12 @@ export default class PagesApi extends AsyncModules implements IPagesApi {
|
|
|
96
96
|
* @param {string} name - Text for searching page objects (search is performed on the title field of the localizeInfos object with the language taken into account). Example: "About Us".
|
|
97
97
|
* @param {string} [url] - Page URL. Example: "catalog".
|
|
98
98
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
99
|
-
* @returns {Promise<IPagesEntity[] | IError>} Returns
|
|
99
|
+
* @returns {Promise<IPagesEntity[] | IPageSearchResult[] | IError>} Returns found pages as an array of PageEntity objects, an array of short PageSearchResult cards when the traficLimit config option is enabled, or an empty array [] (if there is no data)
|
|
100
100
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
101
|
-
* @description Quick search for page objects with limited output.
|
|
101
|
+
* @description Quick search for page objects with limited output. The quick search endpoint returns short cards ({ id, title }); with traficLimit enabled they are returned as is, otherwise full page entities are fetched for the found ids.
|
|
102
102
|
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/searchPage searchPage} documentation.
|
|
103
103
|
*/
|
|
104
|
-
searchPage(name: string, url?: string, langCode?: string): Promise<IPagesEntity[] | IError>;
|
|
104
|
+
searchPage(name: string, url?: string, langCode?: string): Promise<IPagesEntity[] | IPageSearchResult[] | IError>;
|
|
105
105
|
/**
|
|
106
106
|
* Add template data to pages
|
|
107
107
|
* @handleName addTemplateToPages
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -201,16 +201,18 @@ class PagesApi extends asyncModules_1.default {
|
|
|
201
201
|
* @param {string} name - Text for searching page objects (search is performed on the title field of the localizeInfos object with the language taken into account). Example: "About Us".
|
|
202
202
|
* @param {string} [url] - Page URL. Example: "catalog".
|
|
203
203
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
204
|
-
* @returns {Promise<IPagesEntity[] | IError>} Returns
|
|
204
|
+
* @returns {Promise<IPagesEntity[] | IPageSearchResult[] | IError>} Returns found pages as an array of PageEntity objects, an array of short PageSearchResult cards when the traficLimit config option is enabled, or an empty array [] (if there is no data)
|
|
205
205
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
206
|
-
* @description Quick search for page objects with limited output.
|
|
206
|
+
* @description Quick search for page objects with limited output. The quick search endpoint returns short cards ({ id, title }); with traficLimit enabled they are returned as is, otherwise full page entities are fetched for the found ids.
|
|
207
207
|
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/searchPage searchPage} documentation.
|
|
208
208
|
*/
|
|
209
209
|
async searchPage(name, url, langCode = this.state.lang) {
|
|
210
210
|
// Fetch data from the server using a GET request to perform a quick search by page name and language code
|
|
211
211
|
const urlPart = url ? `url=${encodeURIComponent(url)}&` : '';
|
|
212
|
-
const
|
|
212
|
+
const searchPages = await this._fetchGet(`/quick/search?${urlPart}lang=${encodeURIComponent(langCode)}&name=${encodeURIComponent(name)}`);
|
|
213
213
|
// /quick/search?url=catalog&langCode=en_US&name=cat
|
|
214
|
+
// Validate response if validation is enabled
|
|
215
|
+
const data = this._validateResponse(searchPages, pagesSchemas_1.PageSearchResponseSchema);
|
|
214
216
|
// Check if there is no traffic limit set in the state
|
|
215
217
|
if (!this.state.traficLimit && Array.isArray(data)) {
|
|
216
218
|
// Initialize an empty array to store detailed page information
|
|
@@ -224,13 +226,12 @@ class PagesApi extends asyncModules_1.default {
|
|
|
224
226
|
}));
|
|
225
227
|
// Add templates to the fetched pages
|
|
226
228
|
const withTemplate = await this.addTemplateToPages(pageList);
|
|
227
|
-
//
|
|
228
|
-
return this.
|
|
229
|
+
// Normalize the data and return it; ensures consistent structure or handles errors
|
|
230
|
+
return this._normalizeData(withTemplate, langCode);
|
|
229
231
|
}
|
|
230
|
-
//
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
return this._normalizeData(withTemplate, langCode);
|
|
232
|
+
// With a traffic limit (or on an API error) return the quick search response as is:
|
|
233
|
+
// short cards carry no templateIdentifier, so there is nothing to attach a template to
|
|
234
|
+
return this._normalizeData(data, langCode);
|
|
234
235
|
}
|
|
235
236
|
/**
|
|
236
237
|
* Add template data to pages
|
|
@@ -81,11 +81,11 @@ interface IPagesApi {
|
|
|
81
81
|
* @param {string} name - Text for searching page objects (search is performed on the title field of the localizeInfos object with the language taken into account). Example: "About Us".
|
|
82
82
|
* @param {string} [url] - Optional page URL to filter search results. Example: "catalog".
|
|
83
83
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
84
|
-
* @returns {IPagesEntity[]} Returns
|
|
84
|
+
* @returns {IPagesEntity[] | IPageSearchResult[]} Returns found pages as an array of PageEntity objects, an array of short PageSearchResult cards when the traficLimit config option is enabled, or an empty array [] (if there is no data)
|
|
85
85
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
86
|
-
* @description This method performs a quick search for page objects with limited output.
|
|
86
|
+
* @description This method performs a quick search for page objects with limited output. With traficLimit enabled the raw quick search response is returned as short cards; otherwise full page entities are fetched for the found ids.
|
|
87
87
|
*/
|
|
88
|
-
searchPage(name: string, url?: string, langCode?: LangType): Promise<IPagesEntity[] | IError>;
|
|
88
|
+
searchPage(name: string, url?: string, langCode?: LangType): Promise<IPagesEntity[] | IPageSearchResult[] | IError>;
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* @interface IPageConfig
|
|
@@ -294,4 +294,14 @@ interface IPagesEntity {
|
|
|
294
294
|
total?: string;
|
|
295
295
|
categoryPath?: string | null;
|
|
296
296
|
}
|
|
297
|
-
|
|
297
|
+
/**
|
|
298
|
+
* @interface IPageSearchResult
|
|
299
|
+
* @property {number} id - The identifier of the page. Example: 10.
|
|
300
|
+
* @property {string} title - Page title in the requested language. Example: "Catalog".
|
|
301
|
+
* @description This interface defines the short page card returned by the quick search endpoint when the traficLimit config option is enabled. It contains only identification fields, without attributeValues, localizeInfos, blocks and other fields of a full page entity.
|
|
302
|
+
*/
|
|
303
|
+
interface IPageSearchResult {
|
|
304
|
+
id: number;
|
|
305
|
+
title: string;
|
|
306
|
+
}
|
|
307
|
+
export type { IPageConfig, IPagesApi, IPageSearchResult, IPagesEntity, IPositionBlock, IPositionForm, PageType, };
|
|
@@ -66,6 +66,21 @@ export declare const PagesResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
66
66
|
total: z.ZodOptional<z.ZodString>;
|
|
67
67
|
categoryPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
68
68
|
}, z.core.$strip>>;
|
|
69
|
+
/**
|
|
70
|
+
* Page search result schema
|
|
71
|
+
* Short card returned by the quick search endpoint
|
|
72
|
+
*/
|
|
73
|
+
export declare const PageSearchResultSchema: z.ZodObject<{
|
|
74
|
+
id: z.ZodNumber;
|
|
75
|
+
title: z.ZodString;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
/**
|
|
78
|
+
* Page search response schema (array of short cards)
|
|
79
|
+
*/
|
|
80
|
+
export declare const PageSearchResponseSchema: z.ZodArray<z.ZodObject<{
|
|
81
|
+
id: z.ZodNumber;
|
|
82
|
+
title: z.ZodString;
|
|
83
|
+
}, z.core.$strip>>;
|
|
69
84
|
/**
|
|
70
85
|
* Single page response schema
|
|
71
86
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PageConfigSchema = exports.SinglePageSchema = exports.PagesResponseSchema = exports.PageEntitySchema = void 0;
|
|
3
|
+
exports.PageConfigSchema = exports.SinglePageSchema = exports.PageSearchResponseSchema = exports.PageSearchResultSchema = exports.PagesResponseSchema = exports.PageEntitySchema = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Validation schemas for Pages module
|
|
6
6
|
* @description Zod schemas for validating pages-related API responses
|
|
@@ -38,6 +38,18 @@ exports.PageEntitySchema = zod_1.z.object({
|
|
|
38
38
|
* Pages response schema (array of pages)
|
|
39
39
|
*/
|
|
40
40
|
exports.PagesResponseSchema = zod_1.z.array(exports.PageEntitySchema);
|
|
41
|
+
/**
|
|
42
|
+
* Page search result schema
|
|
43
|
+
* Short card returned by the quick search endpoint
|
|
44
|
+
*/
|
|
45
|
+
exports.PageSearchResultSchema = zod_1.z.object({
|
|
46
|
+
id: zod_1.z.number(),
|
|
47
|
+
title: zod_1.z.string(),
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Page search response schema (array of short cards)
|
|
51
|
+
*/
|
|
52
|
+
exports.PageSearchResponseSchema = zod_1.z.array(exports.PageSearchResultSchema);
|
|
41
53
|
/**
|
|
42
54
|
* Single page response schema
|
|
43
55
|
*/
|
|
@@ -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 { IAggregatedProductGroup, IFilterParams, IProductBlock, IProductsApi, IProductsByIdsQuery, IProductsCount, IProductsEntity, IProductsInfo, IProductsPriceQuery, IProductsQueryBase, IProductsRelatedQuery, IProductsResponse, IVectorSearchProducts } from './productsInterfaces';
|
|
4
|
+
import type { IAggregatedProductGroup, IFilterParams, IProductBlock, IProductsApi, IProductsByIdsQuery, IProductsCount, IProductSearchResult, IProductsEntity, IProductsInfo, IProductsPriceQuery, IProductsQueryBase, IProductsRelatedQuery, IProductsResponse, IVectorSearchProducts } from './productsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with product pages
|
|
7
7
|
* @handle /api/content/products
|
|
@@ -267,12 +267,12 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
|
|
|
267
267
|
* @handleName searchProduct
|
|
268
268
|
* @param {string} name - Text to search product page objects (search is based on the title field of the localizeInfos object with language consideration). Example: "laminat".
|
|
269
269
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
270
|
-
* @returns {Promise<IProductsEntity[] | IError>} Array with ProductEntity objects
|
|
270
|
+
* @returns {Promise<IProductsEntity[] | IProductSearchResult[] | IError>} Array with ProductEntity objects, or an array with short ProductSearchResult cards when the traficLimit config option is enabled
|
|
271
271
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
272
|
-
* @description Quick search for product page objects with limited output.
|
|
272
|
+
* @description Quick search for product page objects with limited output. The quick search endpoint returns short cards ({ id, title, pageId }); with traficLimit enabled they are returned as is, otherwise full product entities are fetched for the found ids.
|
|
273
273
|
* @see {@link https://js-sdk.oneentry.cloud/docs/products/searchProduct searchProduct} documentation.
|
|
274
274
|
*/
|
|
275
|
-
searchProduct(name: string, langCode?: string): Promise<IProductsEntity[] | IError>;
|
|
275
|
+
searchProduct(name: string, langCode?: string): Promise<IProductsEntity[] | IProductSearchResult[] | IError>;
|
|
276
276
|
/**
|
|
277
277
|
* Getting the number of products for the entire catalog.
|
|
278
278
|
* @handleName getProductsCount
|
|
@@ -350,12 +350,12 @@ export default class ProductsApi extends AsyncModules implements IProductsApi {
|
|
|
350
350
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
351
351
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
352
352
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
353
|
-
* @returns {Promise<
|
|
353
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of found products and total count.
|
|
354
354
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
355
355
|
* @description This method performs a semantic (vector) search for products.
|
|
356
356
|
* @see {@link https://js-sdk.oneentry.cloud/docs/products/getProductsByVectorSearch getProductsByVectorSearch} documentation.
|
|
357
357
|
*/
|
|
358
|
-
getProductsByVectorSearch(body: IVectorSearchProducts, langCode?: string, offset?: number, limit?: number): Promise<
|
|
358
|
+
getProductsByVectorSearch(body: IVectorSearchProducts, langCode?: string, offset?: number, limit?: number): Promise<IProductsResponse | IError>;
|
|
359
359
|
/**
|
|
360
360
|
* Get products by page url.
|
|
361
361
|
* @param {string} url - Page url.
|
|
@@ -75,7 +75,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
75
75
|
const result = await this._fetchPost(`/all?` + this._queryParamsToString(query), { filter: body });
|
|
76
76
|
// Validate response if validation is enabled
|
|
77
77
|
const validated = this._validateResponse(result, productsSchemas_1.ProductsResponseSchema);
|
|
78
|
-
return this.
|
|
78
|
+
return this._normalizeData(validated, langCode);
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
81
|
* Search for all product page objects with pagination (and aggregation) that do not have a category.
|
|
@@ -150,7 +150,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
150
150
|
const result = await this._fetchPost(`/page/${id}?langCode=${langCode}&` + this._queryParamsToString(query), { filter: body });
|
|
151
151
|
// Validate response if validation is enabled
|
|
152
152
|
const validated = this._validateResponse(result, productsSchemas_1.ProductsResponseSchema);
|
|
153
|
-
return this.
|
|
153
|
+
return this._normalizeData(validated, langCode);
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
156
|
* Search for information about products and prices for the selected category.
|
|
@@ -229,7 +229,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
229
229
|
this._queryParamsToString(query), { filter: body });
|
|
230
230
|
// Validate response if validation is enabled
|
|
231
231
|
const validated = this._validateResponse(result, productsSchemas_1.ProductsResponseSchema);
|
|
232
|
-
return this.
|
|
232
|
+
return this._normalizeData(validated, langCode);
|
|
233
233
|
}
|
|
234
234
|
/**
|
|
235
235
|
* Find all related product page objects.
|
|
@@ -261,7 +261,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
261
261
|
const result = await this._fetchGet(`/${id}/related?langCode=${langCode}&` + this._queryParamsToString(query));
|
|
262
262
|
// Validate response if validation is enabled
|
|
263
263
|
const validated = this._validateResponse(result, productsSchemas_1.ProductsResponseSchema);
|
|
264
|
-
return this.
|
|
264
|
+
return this._normalizeData(validated, langCode);
|
|
265
265
|
}
|
|
266
266
|
/**
|
|
267
267
|
* Find products by its ids.
|
|
@@ -290,7 +290,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
290
290
|
...userQuery,
|
|
291
291
|
};
|
|
292
292
|
const result = await this._fetchGet(`/ids?` + this._queryParamsToString(query));
|
|
293
|
-
return this.
|
|
293
|
+
return this._normalizeData(result, langCode);
|
|
294
294
|
}
|
|
295
295
|
/**
|
|
296
296
|
* Retrieve one product object.
|
|
@@ -310,7 +310,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
310
310
|
const result = await this._fetchGet(`/${id}?` + this._queryParamsToString(query));
|
|
311
311
|
// Validate response if validation is enabled
|
|
312
312
|
const validated = this._validateResponse(result, productsSchemas_1.ProductEntitySchema);
|
|
313
|
-
return this.
|
|
313
|
+
return this._normalizeData(validated, langCode);
|
|
314
314
|
}
|
|
315
315
|
/**
|
|
316
316
|
* Getting a product block object by product id.
|
|
@@ -330,13 +330,15 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
330
330
|
* @handleName searchProduct
|
|
331
331
|
* @param {string} name - Text to search product page objects (search is based on the title field of the localizeInfos object with language consideration). Example: "laminat".
|
|
332
332
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
333
|
-
* @returns {Promise<IProductsEntity[] | IError>} Array with ProductEntity objects
|
|
333
|
+
* @returns {Promise<IProductsEntity[] | IProductSearchResult[] | IError>} Array with ProductEntity objects, or an array with short ProductSearchResult cards when the traficLimit config option is enabled
|
|
334
334
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
335
|
-
* @description Quick search for product page objects with limited output.
|
|
335
|
+
* @description Quick search for product page objects with limited output. The quick search endpoint returns short cards ({ id, title, pageId }); with traficLimit enabled they are returned as is, otherwise full product entities are fetched for the found ids.
|
|
336
336
|
* @see {@link https://js-sdk.oneentry.cloud/docs/products/searchProduct searchProduct} documentation.
|
|
337
337
|
*/
|
|
338
338
|
async searchProduct(name, langCode = this.state.lang) {
|
|
339
|
-
const
|
|
339
|
+
const result = await this._fetchGet(`/quick/search?langCode=${encodeURIComponent(langCode)}&name=${encodeURIComponent(name)}`);
|
|
340
|
+
// Validate response if validation is enabled
|
|
341
|
+
const searchProducts = this._validateResponse(result, productsSchemas_1.ProductSearchResponseSchema);
|
|
340
342
|
if (!this.state.traficLimit && Array.isArray(searchProducts)) {
|
|
341
343
|
if (searchProducts.length === 0)
|
|
342
344
|
return searchProducts;
|
|
@@ -441,7 +443,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
441
443
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
442
444
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
443
445
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
444
|
-
* @returns {Promise<
|
|
446
|
+
* @returns {Promise<IProductsResponse | IError>} Returns an object with an array of found products and total count.
|
|
445
447
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
446
448
|
* @description This method performs a semantic (vector) search for products.
|
|
447
449
|
* @see {@link https://js-sdk.oneentry.cloud/docs/products/getProductsByVectorSearch getProductsByVectorSearch} documentation.
|
|
@@ -453,7 +455,7 @@ class ProductsApi extends asyncModules_1.default {
|
|
|
453
455
|
limit,
|
|
454
456
|
};
|
|
455
457
|
const result = await this._fetchPost(`/vector/search?` + this._queryParamsToString(query), body);
|
|
456
|
-
return this.
|
|
458
|
+
return this._normalizeData(result, langCode);
|
|
457
459
|
}
|
|
458
460
|
/**
|
|
459
461
|
* Get products by page url.
|
|
@@ -189,11 +189,11 @@ interface IProductsApi {
|
|
|
189
189
|
* @handleName searchProduct
|
|
190
190
|
* @param {string} name - Text to search product page objects (search is based on the title field of the localizeInfos object with language consideration). Example: 'laminat'.
|
|
191
191
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
192
|
-
* @returns {IProductsEntity[]} Array with ProductEntity objects
|
|
192
|
+
* @returns {IProductsEntity[] | IProductSearchResult[]} Array with ProductEntity objects, or an array with short ProductSearchResult cards when the traficLimit config option is enabled
|
|
193
193
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
194
|
-
* @description This method performs a quick search for product page objects with limited output.
|
|
194
|
+
* @description This method performs a quick search for product page objects with limited output. With traficLimit enabled the raw quick search response is returned as short cards; otherwise full product entities are fetched for the found ids.
|
|
195
195
|
*/
|
|
196
|
-
searchProduct(name: string, langCode?: string): Promise<IProductsEntity[] | IError>;
|
|
196
|
+
searchProduct(name: string, langCode?: string): Promise<IProductsEntity[] | IProductSearchResult[] | IError>;
|
|
197
197
|
/**
|
|
198
198
|
* Getting the number of products for the entire catalog.
|
|
199
199
|
* @handleName getProductsCount
|
|
@@ -299,11 +299,11 @@ interface IProductsApi {
|
|
|
299
299
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
300
300
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
301
301
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
302
|
-
* @returns {
|
|
302
|
+
* @returns {IProductsResponse} A promise that resolves to a products response (items + total) or an error.
|
|
303
303
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
304
304
|
* @description This method performs a semantic (vector) search for products.
|
|
305
305
|
*/
|
|
306
|
-
getProductsByVectorSearch(body: IVectorSearchProducts, langCode?: string, offset?: number, limit?: number): Promise<
|
|
306
|
+
getProductsByVectorSearch(body: IVectorSearchProducts, langCode?: string, offset?: number, limit?: number): Promise<IProductsResponse | IError>;
|
|
307
307
|
}
|
|
308
308
|
/**
|
|
309
309
|
* @interface IProductsQueryBase
|
|
@@ -533,11 +533,25 @@ interface IProductsEntity {
|
|
|
533
533
|
"title": "Product 2"
|
|
534
534
|
}
|
|
535
535
|
]
|
|
536
|
+
* @property {number} [totalFound] - Number of products matched before limits are applied; returned by block product endpoints (`similarProducts`, cart/wishlist recommendations, frequently ordered). Optional. Example: 2.
|
|
536
537
|
* @description This interface defines the structure of a response containing multiple product entities, including the total count and an array of product items.
|
|
537
538
|
*/
|
|
538
539
|
interface IProductsResponse {
|
|
539
540
|
items: IProductsEntity[];
|
|
540
541
|
total: number;
|
|
542
|
+
totalFound?: number;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* @interface IProductSearchResult
|
|
546
|
+
* @property {number} id - The identifier of the product. Example: 2957.
|
|
547
|
+
* @property {string} title - Product title in the requested language. Example: "Cosmo".
|
|
548
|
+
* @property {number} pageId - The identifier of the catalog page the product is linked to. Example: 10.
|
|
549
|
+
* @description This interface defines the short product card returned by the quick search endpoint when the traficLimit config option is enabled. It contains only identification fields, without attributeValues, localizeInfos and other fields of a full product entity.
|
|
550
|
+
*/
|
|
551
|
+
interface IProductSearchResult {
|
|
552
|
+
id: number;
|
|
553
|
+
title: string;
|
|
554
|
+
pageId: number;
|
|
541
555
|
}
|
|
542
556
|
/**
|
|
543
557
|
* @interface IProductsCount
|
|
@@ -632,31 +646,37 @@ interface IProductBlockSettings {
|
|
|
632
646
|
}
|
|
633
647
|
/**
|
|
634
648
|
* @interface IProductBlockProductConfig
|
|
635
|
-
* @property {string | number} quantity - Number of products to render. Example: 9.
|
|
636
|
-
* @property {string | number} countElementsPerRow - Products per row. Example: 3.
|
|
649
|
+
* @property {string | number} [quantity] - Number of products to render; absent when the block config is empty. Example: 9.
|
|
650
|
+
* @property {string | number} [countElementsPerRow] - Products per row; absent when the block config is empty. Example: 3.
|
|
637
651
|
* @property {string | number} [sortType] - Sort field. Example: "price".
|
|
638
652
|
* @property {string | number} [sortOrder] - Sort direction. Example: "ASC".
|
|
639
|
-
* @description Layout config for products inside a {@link IProductBlock}.
|
|
653
|
+
* @description Layout config for products inside a {@link IProductBlock}; an empty object when the block is not configured.
|
|
640
654
|
*/
|
|
641
655
|
interface IProductBlockProductConfig {
|
|
642
|
-
quantity
|
|
643
|
-
countElementsPerRow
|
|
656
|
+
quantity?: string | number;
|
|
657
|
+
countElementsPerRow?: string | number;
|
|
644
658
|
sortType?: string | number;
|
|
645
659
|
sortOrder?: string | number;
|
|
646
660
|
}
|
|
647
661
|
/**
|
|
648
662
|
* @interface IProductBlockSimilarRule
|
|
649
|
-
* @property {string}
|
|
650
|
-
* @property {string}
|
|
651
|
-
* @property {string}
|
|
652
|
-
* @property {string}
|
|
663
|
+
* @property {string} id - Rule identifier (UUID). Example: "812ee2bb-a90f-4743-9643-663f87acedf5".
|
|
664
|
+
* @property {string} title - Rule title; empty string when not set. Example: "".
|
|
665
|
+
* @property {string} attributeMarker - Marker of the product attribute the rule matches on. Example: "nameofproduct_3".
|
|
666
|
+
* @property {string} conditionMarker - Condition operator applied to the attribute. Example: "in".
|
|
667
|
+
* @property {string} conditionValue - Value the condition compares against. Example: "Blue".
|
|
668
|
+
* @property {string} statusMarker - Product status marker the rule is limited to; empty string when not limited. Example: "".
|
|
669
|
+
* @property {string[]} pageUrls - Page URLs the rule is scoped to; empty array when not restricted.
|
|
653
670
|
* @description Single rule used to compute similar products for a {@link IProductBlock}.
|
|
654
671
|
*/
|
|
655
672
|
interface IProductBlockSimilarRule {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
673
|
+
id: string;
|
|
674
|
+
title: string;
|
|
675
|
+
attributeMarker: string;
|
|
676
|
+
conditionMarker: string;
|
|
677
|
+
conditionValue: string;
|
|
678
|
+
statusMarker: string;
|
|
679
|
+
pageUrls: string[];
|
|
660
680
|
}
|
|
661
681
|
interface IProductBlock {
|
|
662
682
|
id: number;
|
|
@@ -700,4 +720,4 @@ interface IVectorSearchProducts {
|
|
|
700
720
|
maxHits?: number;
|
|
701
721
|
debug?: boolean;
|
|
702
722
|
}
|
|
703
|
-
export type { IAggregatedProductGroup, IFilterParams, IProductBlock, IProductInfo, IProductsApi, IProductsByIdsQuery, IProductsCount, IProductsEntity, IProductsInfo, IProductsPriceQuery, IProductsQuery, IProductsQueryBase, IProductsRelatedQuery, IProductsResponse, IVectorSearchProducts, };
|
|
723
|
+
export type { IAggregatedProductGroup, IFilterParams, IProductBlock, IProductInfo, IProductsApi, IProductsByIdsQuery, IProductsCount, IProductSearchResult, IProductsEntity, IProductsInfo, IProductsPriceQuery, IProductsQuery, IProductsQueryBase, IProductsRelatedQuery, IProductsResponse, IVectorSearchProducts, };
|
|
@@ -106,6 +106,7 @@ export declare const ProductsResponseSchema: z.ZodObject<{
|
|
|
106
106
|
discountConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
107
107
|
}, z.core.$strip>>;
|
|
108
108
|
total: z.ZodNumber;
|
|
109
|
+
totalFound: z.ZodOptional<z.ZodNumber>;
|
|
109
110
|
}, z.core.$strip>;
|
|
110
111
|
/**
|
|
111
112
|
* Single product response schema
|
|
@@ -148,6 +149,23 @@ export declare const SingleProductSchema: z.ZodObject<{
|
|
|
148
149
|
distance: z.ZodOptional<z.ZodNumber>;
|
|
149
150
|
discountConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
150
151
|
}, z.core.$strip>;
|
|
152
|
+
/**
|
|
153
|
+
* Product search result schema
|
|
154
|
+
* Short card returned by the quick search endpoint
|
|
155
|
+
*/
|
|
156
|
+
export declare const ProductSearchResultSchema: z.ZodObject<{
|
|
157
|
+
id: z.ZodNumber;
|
|
158
|
+
title: z.ZodString;
|
|
159
|
+
pageId: z.ZodNumber;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
/**
|
|
162
|
+
* Product search response schema (array of short cards)
|
|
163
|
+
*/
|
|
164
|
+
export declare const ProductSearchResponseSchema: z.ZodArray<z.ZodObject<{
|
|
165
|
+
id: z.ZodNumber;
|
|
166
|
+
title: z.ZodString;
|
|
167
|
+
pageId: z.ZodNumber;
|
|
168
|
+
}, z.core.$strip>>;
|
|
151
169
|
/**
|
|
152
170
|
* Products count schema
|
|
153
171
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RelatedProductsSchema = exports.ProductBlockSchema = exports.ProductsCountSchema = exports.SingleProductSchema = exports.ProductsResponseSchema = exports.ProductEntitySchema = exports.ProductImageSchema = exports.ProductPriceSchema = void 0;
|
|
3
|
+
exports.RelatedProductsSchema = exports.ProductBlockSchema = exports.ProductsCountSchema = exports.ProductSearchResponseSchema = exports.ProductSearchResultSchema = exports.SingleProductSchema = exports.ProductsResponseSchema = exports.ProductEntitySchema = exports.ProductImageSchema = exports.ProductPriceSchema = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Validation schemas for Products module
|
|
6
6
|
* @description Zod schemas for validating products-related API responses
|
|
@@ -74,11 +74,25 @@ exports.ProductEntitySchema = zod_1.z.object({
|
|
|
74
74
|
exports.ProductsResponseSchema = zod_1.z.object({
|
|
75
75
|
items: zod_1.z.array(exports.ProductEntitySchema),
|
|
76
76
|
total: zod_1.z.number(),
|
|
77
|
+
totalFound: zod_1.z.number().optional(),
|
|
77
78
|
});
|
|
78
79
|
/**
|
|
79
80
|
* Single product response schema
|
|
80
81
|
*/
|
|
81
82
|
exports.SingleProductSchema = exports.ProductEntitySchema;
|
|
83
|
+
/**
|
|
84
|
+
* Product search result schema
|
|
85
|
+
* Short card returned by the quick search endpoint
|
|
86
|
+
*/
|
|
87
|
+
exports.ProductSearchResultSchema = zod_1.z.object({
|
|
88
|
+
id: zod_1.z.number(),
|
|
89
|
+
title: zod_1.z.string(),
|
|
90
|
+
pageId: zod_1.z.number(),
|
|
91
|
+
});
|
|
92
|
+
/**
|
|
93
|
+
* Product search response schema (array of short cards)
|
|
94
|
+
*/
|
|
95
|
+
exports.ProductSearchResponseSchema = zod_1.z.array(exports.ProductSearchResultSchema);
|
|
82
96
|
/**
|
|
83
97
|
* Products count schema
|
|
84
98
|
*/
|
|
@@ -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 { ICancelSubscription, ICreatedSubscription, ISubscribe, ISubscriptionsApi } from './subscriptionsInterfaces';
|
|
4
|
+
import type { ICancelSubscription, ICreatedSubscription, ISubscribe, ISubscriptionEntity, ISubscriptionsApi } from './subscriptionsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with paid subscriptions.
|
|
7
7
|
* @handle /api/content/subscriptions
|
|
@@ -41,15 +41,15 @@ export default class SubscriptionsApi extends AsyncModules implements ISubscript
|
|
|
41
41
|
*/
|
|
42
42
|
cancelSubscription(body: ICancelSubscription): Promise<boolean | IError>;
|
|
43
43
|
/**
|
|
44
|
-
* Get all available
|
|
44
|
+
* Get all available subscriptions.
|
|
45
45
|
* @handleName getAllSubscriptions
|
|
46
|
-
* @returns {Promise<
|
|
46
|
+
* @returns {Promise<ISubscriptionEntity[] | IError>} Returns an array of available subscriptions.
|
|
47
47
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
48
48
|
* @description This method requires user authorization.
|
|
49
49
|
* @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}.
|
|
50
50
|
* @see {@link https://js-sdk.oneentry.cloud/docs/subscriptions/getAllSubscriptions getAllSubscriptions} documentation.
|
|
51
51
|
*/
|
|
52
|
-
getAllSubscriptions(): Promise<
|
|
52
|
+
getAllSubscriptions(): Promise<ISubscriptionEntity[] | IError>;
|
|
53
53
|
/**
|
|
54
54
|
* Get markers of the user's active subscriptions.
|
|
55
55
|
* @handleName getActiveSubscriptions
|
|
@@ -51,9 +51,9 @@ class SubscriptionsApi extends asyncModules_1.default {
|
|
|
51
51
|
return this._fetchBoolean(() => this._fetchDelete(``, body));
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
* Get all available
|
|
54
|
+
* Get all available subscriptions.
|
|
55
55
|
* @handleName getAllSubscriptions
|
|
56
|
-
* @returns {Promise<
|
|
56
|
+
* @returns {Promise<ISubscriptionEntity[] | IError>} Returns an array of available subscriptions.
|
|
57
57
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
58
58
|
* @description This method requires user authorization.
|
|
59
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}.
|
|
@@ -61,7 +61,7 @@ class SubscriptionsApi extends asyncModules_1.default {
|
|
|
61
61
|
*/
|
|
62
62
|
async getAllSubscriptions() {
|
|
63
63
|
const data = await this._fetchGet(``);
|
|
64
|
-
const validated = this._validateResponse(data, subscriptionsSchemas_1.
|
|
64
|
+
const validated = this._validateResponse(data, subscriptionsSchemas_1.SubscriptionsListSchema);
|
|
65
65
|
return this._normalizeData(validated);
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IError } from '../base/utils';
|
|
1
|
+
import type { IError, ILocalizeInfo } from '../base/utils';
|
|
2
2
|
/**
|
|
3
3
|
* Interface for the Subscriptions API module.
|
|
4
4
|
* @interface ISubscriptionsApi
|
|
@@ -26,14 +26,14 @@ interface ISubscriptionsApi {
|
|
|
26
26
|
*/
|
|
27
27
|
cancelSubscription(body: ICancelSubscription): Promise<boolean | IError>;
|
|
28
28
|
/**
|
|
29
|
-
* Get all available
|
|
29
|
+
* Get all available subscriptions.
|
|
30
30
|
* @handleName getAllSubscriptions
|
|
31
|
-
* @returns {Promise<
|
|
31
|
+
* @returns {Promise<ISubscriptionEntity[] | IError>} Returns an array of available subscriptions.
|
|
32
32
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
33
33
|
* @description This method requires user authorization.
|
|
34
34
|
* @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}.
|
|
35
35
|
*/
|
|
36
|
-
getAllSubscriptions(): Promise<
|
|
36
|
+
getAllSubscriptions(): Promise<ISubscriptionEntity[] | IError>;
|
|
37
37
|
/**
|
|
38
38
|
* Get markers of the user's active subscriptions.
|
|
39
39
|
* @handleName getActiveSubscriptions
|
|
@@ -87,4 +87,25 @@ interface ICreatedSubscription {
|
|
|
87
87
|
paymentUrl: string;
|
|
88
88
|
status: string;
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Available subscription.
|
|
92
|
+
* @interface ISubscriptionEntity
|
|
93
|
+
* @property {number} id - Subscription identifier. Example: 1.
|
|
94
|
+
* @property {string} identifier - Subscription textual identifier (marker). Example: "test_subscription".
|
|
95
|
+
* @property {ILocalizeInfo} localizeInfos - Localized subscription info for the current language. Example: `{ title: "Test subscription" }`.
|
|
96
|
+
* @property {number[]} productIds - Identifiers of the products included in the subscription. Example: [3445].
|
|
97
|
+
* @property {number} periodInDays - Subscription period in days. Example: 30.
|
|
98
|
+
* @property {number} paymentAccountId - Identifier of the payment account the subscription is billed through. Example: 1.
|
|
99
|
+
* @property {boolean} isUsed - Indicates whether the subscription is in use. Example: false.
|
|
100
|
+
* @description Subscription configured in the project, returned by getAllSubscriptions.
|
|
101
|
+
*/
|
|
102
|
+
interface ISubscriptionEntity {
|
|
103
|
+
id: number;
|
|
104
|
+
identifier: string;
|
|
105
|
+
localizeInfos: ILocalizeInfo;
|
|
106
|
+
productIds: number[];
|
|
107
|
+
periodInDays: number;
|
|
108
|
+
paymentAccountId: number;
|
|
109
|
+
isUsed: boolean;
|
|
110
|
+
}
|
|
111
|
+
export type { ICancelSubscription, ICreatedSubscription, ISubscribe, ISubscriptionEntity, ISubscriptionsApi, };
|