oneentry 1.0.160 → 1.0.161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/changelog.md +43 -0
- package/dist/admins/adminsApi.d.ts +15 -1
- package/dist/admins/adminsApi.js +29 -0
- package/dist/admins/adminsInterfaces.d.ts +37 -1
- package/dist/base/lazySchema.d.ts +15 -0
- package/dist/base/lazySchema.js +20 -0
- package/dist/discounts/discountsApi.d.ts +14 -1
- package/dist/discounts/discountsApi.js +21 -0
- package/dist/discounts/discountsInterfaces.d.ts +27 -1
- package/dist/filters/filtersInterfaces.d.ts +2 -2
- package/dist/filters/filtersSchemas.d.ts +1 -1
- package/dist/filters/filtersSchemas.js +4 -1
- package/dist/forms-data/formsDataApi.d.ts +14 -1
- package/dist/forms-data/formsDataApi.js +21 -0
- package/dist/forms-data/formsDataInterfaces.d.ts +74 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/orders/ordersApi.d.ts +15 -1
- package/dist/orders/ordersApi.js +22 -0
- package/dist/orders/ordersInterfaces.d.ts +27 -1
- package/dist/pages/pagesApi.d.ts +14 -1
- package/dist/pages/pagesApi.js +21 -0
- package/dist/pages/pagesInterfaces.d.ts +38 -1
- package/dist/payments/paymentsInterfaces.d.ts +2 -2
- package/dist/products/productsInterfaces.d.ts +1 -1
- package/dist/search/searchApi.d.ts +35 -0
- package/dist/search/searchApi.js +86 -0
- package/dist/search/searchInterfaces.d.ts +94 -0
- package/dist/search/searchInterfaces.js +2 -0
- package/dist/search/searchSchemas.d.ts +73 -0
- package/dist/search/searchSchemas.js +44 -0
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +0 -2
- package/dist/templates-preview/templatesPreviewSchemas.d.ts +0 -2
- package/dist/templates-preview/templatesPreviewSchemas.js +0 -1
- package/dist/types.d.ts +35 -0
- package/dist/types.js +2 -0
- package/dist/users/usersApi.d.ts +15 -1
- package/dist/users/usersApi.js +22 -0
- package/dist/users/usersInterfaces.d.ts +39 -1
- package/dist/web-socket/lazySocket.d.ts +18 -0
- package/dist/web-socket/lazySocket.js +70 -0
- package/esm/admins/adminsApi.d.ts +66 -0
- package/esm/admins/adminsApi.js +90 -0
- package/esm/admins/adminsInterfaces.d.ts +137 -0
- package/esm/admins/adminsInterfaces.js +1 -0
- package/esm/admins/adminsSchemas.d.ts +48 -0
- package/esm/admins/adminsSchemas.js +31 -0
- package/esm/attribute-sets/attributeSetsApi.d.ts +67 -0
- package/esm/attribute-sets/attributeSetsApi.js +97 -0
- package/esm/attribute-sets/attributeSetsInterfaces.d.ts +285 -0
- package/esm/attribute-sets/attributeSetsInterfaces.js +1 -0
- package/esm/attribute-sets/attributeSetsSchemas.d.ts +84 -0
- package/esm/attribute-sets/attributeSetsSchemas.js +66 -0
- package/esm/auth-provider/authProviderApi.d.ts +262 -0
- package/esm/auth-provider/authProviderApi.js +362 -0
- package/esm/auth-provider/authProviderSchemas.d.ts +124 -0
- package/esm/auth-provider/authProviderSchemas.js +92 -0
- package/esm/auth-provider/authProvidersInterfaces.d.ts +430 -0
- package/esm/auth-provider/authProvidersInterfaces.js +1 -0
- package/esm/base/asyncModules.d.ts +123 -0
- package/esm/base/asyncModules.js +382 -0
- package/esm/base/lazySchema.d.ts +15 -0
- package/esm/base/lazySchema.js +17 -0
- package/esm/base/stateModule.d.ts +35 -0
- package/esm/base/stateModule.js +51 -0
- package/esm/base/syncModules.d.ts +245 -0
- package/esm/base/syncModules.js +555 -0
- package/esm/base/timeIntervals.d.ts +95 -0
- package/esm/base/timeIntervals.js +317 -0
- package/esm/base/utils.d.ts +354 -0
- package/esm/base/utils.js +1 -0
- package/esm/base/validation.d.ts +98 -0
- package/esm/base/validation.js +118 -0
- package/esm/blocks/blocksApi.d.ts +252 -0
- package/esm/blocks/blocksApi.js +394 -0
- package/esm/blocks/blocksInterfaces.d.ts +361 -0
- package/esm/blocks/blocksInterfaces.js +1 -0
- package/esm/blocks/blocksSchemas.d.ts +213 -0
- package/esm/blocks/blocksSchemas.js +40 -0
- package/esm/discounts/discountsApi.d.ts +94 -0
- package/esm/discounts/discountsApi.js +136 -0
- package/esm/discounts/discountsInterfaces.d.ts +293 -0
- package/esm/discounts/discountsInterfaces.js +1 -0
- package/esm/events/eventsApi.d.ts +108 -0
- package/esm/events/eventsApi.js +141 -0
- package/esm/events/eventsInterfaces.d.ts +176 -0
- package/esm/events/eventsInterfaces.js +1 -0
- package/esm/file-uploading/fileUploadingApi.d.ts +91 -0
- package/esm/file-uploading/fileUploadingApi.js +127 -0
- package/esm/file-uploading/fileUploadingInterfaces.d.ts +116 -0
- package/esm/file-uploading/fileUploadingInterfaces.js +1 -0
- package/esm/file-uploading/fileUploadingSchemas.d.ts +24 -0
- package/esm/file-uploading/fileUploadingSchemas.js +19 -0
- package/esm/filters/filtersApi.d.ts +32 -0
- package/esm/filters/filtersApi.js +36 -0
- package/esm/filters/filtersInterfaces.d.ts +56 -0
- package/esm/filters/filtersInterfaces.js +1 -0
- package/esm/filters/filtersSchemas.d.ts +32 -0
- package/esm/filters/filtersSchemas.js +29 -0
- package/esm/forms/formsApi.d.ts +44 -0
- package/esm/forms/formsApi.js +54 -0
- package/esm/forms/formsInterfaces.d.ts +237 -0
- package/esm/forms/formsInterfaces.js +1 -0
- package/esm/forms/formsSchemas.d.ts +56 -0
- package/esm/forms/formsSchemas.js +32 -0
- package/esm/forms-data/formsDataApi.d.ts +124 -0
- package/esm/forms-data/formsDataApi.js +210 -0
- package/esm/forms-data/formsDataInterfaces.d.ts +670 -0
- package/esm/forms-data/formsDataInterfaces.js +1 -0
- package/esm/forms-data/formsDataSchemas.d.ts +107 -0
- package/esm/forms-data/formsDataSchemas.js +83 -0
- package/esm/general-types/generalTypesApi.d.ts +29 -0
- package/esm/general-types/generalTypesApi.js +34 -0
- package/esm/general-types/generalTypesInterfaces.d.ts +29 -0
- package/esm/general-types/generalTypesInterfaces.js +1 -0
- package/esm/general-types/generalTypesSchemas.d.ts +68 -0
- package/esm/general-types/generalTypesSchemas.js +42 -0
- package/esm/index.d.ts +143 -0
- package/esm/index.js +124 -0
- package/esm/integration-collections/integrationCollectionsApi.d.ts +172 -0
- package/esm/integration-collections/integrationCollectionsApi.js +224 -0
- package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +317 -0
- package/esm/integration-collections/integrationCollectionsInterfaces.js +1 -0
- package/esm/integration-collections/integrationCollectionsSchemas.d.ts +84 -0
- package/esm/integration-collections/integrationCollectionsSchemas.js +60 -0
- package/esm/locales/localesApi.d.ts +28 -0
- package/esm/locales/localesApi.js +33 -0
- package/esm/locales/localesInterfaces.d.ts +40 -0
- package/esm/locales/localesInterfaces.js +1 -0
- package/esm/locales/localesSchemas.d.ts +32 -0
- package/esm/locales/localesSchemas.js +23 -0
- package/esm/menus/menusApi.d.ts +30 -0
- package/esm/menus/menusApi.js +35 -0
- package/esm/menus/menusInterfaces.d.ts +87 -0
- package/esm/menus/menusInterfaces.js +2 -0
- package/esm/menus/menusSchemas.d.ts +16 -0
- package/esm/menus/menusSchemas.js +25 -0
- package/esm/orders/ordersApi.d.ts +213 -0
- package/esm/orders/ordersApi.js +288 -0
- package/esm/orders/ordersInterfaces.d.ts +763 -0
- package/esm/orders/ordersInterfaces.js +1 -0
- package/esm/orders/ordersSchemas.d.ts +312 -0
- package/esm/orders/ordersSchemas.js +171 -0
- package/esm/package.json +4 -0
- package/esm/pages/pagesApi.d.ts +173 -0
- package/esm/pages/pagesApi.js +414 -0
- package/esm/pages/pagesInterfaces.d.ts +344 -0
- package/esm/pages/pagesInterfaces.js +1 -0
- package/esm/pages/pagesSchemas.d.ts +121 -0
- package/esm/pages/pagesSchemas.js +60 -0
- package/esm/payments/paymentsApi.d.ts +88 -0
- package/esm/payments/paymentsApi.js +122 -0
- package/esm/payments/paymentsInterfaces.d.ts +189 -0
- package/esm/payments/paymentsInterfaces.js +1 -0
- package/esm/payments/paymentsSchemas.d.ts +94 -0
- package/esm/payments/paymentsSchemas.js +53 -0
- package/esm/product-statuses/productStatusesApi.d.ts +50 -0
- package/esm/product-statuses/productStatusesApi.js +68 -0
- package/esm/product-statuses/productStatusesInterfaces.d.ts +62 -0
- package/esm/product-statuses/productStatusesInterfaces.js +1 -0
- package/esm/product-statuses/productStatusesSchemas.d.ts +34 -0
- package/esm/product-statuses/productStatusesSchemas.js +27 -0
- package/esm/products/productsApi.d.ts +366 -0
- package/esm/products/productsApi.js +468 -0
- package/esm/products/productsInterfaces.d.ts +723 -0
- package/esm/products/productsInterfaces.js +1 -0
- package/esm/products/productsSchemas.d.ts +234 -0
- package/esm/products/productsSchemas.js +121 -0
- package/esm/search/searchApi.d.ts +35 -0
- package/esm/search/searchApi.js +47 -0
- package/esm/search/searchInterfaces.d.ts +94 -0
- package/esm/search/searchInterfaces.js +1 -0
- package/esm/search/searchSchemas.d.ts +73 -0
- package/esm/search/searchSchemas.js +41 -0
- package/esm/sitemap/sitemapApi.d.ts +37 -0
- package/esm/sitemap/sitemapApi.js +41 -0
- package/esm/sitemap/sitemapInterfaces.d.ts +51 -0
- package/esm/sitemap/sitemapInterfaces.js +1 -0
- package/esm/subscriptions/subscriptionsApi.d.ts +74 -0
- package/esm/subscriptions/subscriptionsApi.js +90 -0
- package/esm/subscriptions/subscriptionsInterfaces.d.ts +111 -0
- package/esm/subscriptions/subscriptionsInterfaces.js +1 -0
- package/esm/subscriptions/subscriptionsSchemas.d.ts +46 -0
- package/esm/subscriptions/subscriptionsSchemas.js +38 -0
- package/esm/system/systemApi.d.ts +46 -0
- package/esm/system/systemApi.js +53 -0
- package/esm/system/systemInterfaces.d.ts +29 -0
- package/esm/system/systemInterfaces.js +1 -0
- package/esm/templates/templatesApi.d.ts +53 -0
- package/esm/templates/templatesApi.js +78 -0
- package/esm/templates/templatesInterfaces.d.ts +68 -0
- package/esm/templates/templatesInterfaces.js +1 -0
- package/esm/templates/templatesSchemas.d.ts +48 -0
- package/esm/templates/templatesSchemas.js +28 -0
- package/esm/templates-preview/templatesPreviewApi.d.ts +40 -0
- package/esm/templates-preview/templatesPreviewApi.js +50 -0
- package/esm/templates-preview/templatesPreviewInterfaces.d.ts +129 -0
- package/esm/templates-preview/templatesPreviewInterfaces.js +1 -0
- package/esm/templates-preview/templatesPreviewSchemas.d.ts +79 -0
- package/esm/templates-preview/templatesPreviewSchemas.js +43 -0
- package/esm/types.d.ts +35 -0
- package/esm/types.js +1 -0
- package/esm/user-activity/userActivityApi.d.ts +31 -0
- package/esm/user-activity/userActivityApi.js +37 -0
- package/esm/user-activity/userActivityInterfaces.d.ts +42 -0
- package/esm/user-activity/userActivityInterfaces.js +1 -0
- package/esm/users/usersApi.d.ts +249 -0
- package/esm/users/usersApi.js +312 -0
- package/esm/users/usersInterfaces.d.ts +419 -0
- package/esm/users/usersInterfaces.js +1 -0
- package/esm/users/usersSchemas.d.ts +72 -0
- package/esm/users/usersSchemas.js +55 -0
- package/esm/web-socket/lazySocket.d.ts +18 -0
- package/esm/web-socket/lazySocket.js +67 -0
- package/esm/web-socket/wsApi.d.ts +27 -0
- package/esm/web-socket/wsApi.js +43 -0
- package/esm/web-socket/wsInterfaces.d.ts +16 -0
- package/esm/web-socket/wsInterfaces.js +1 -0
- package/package.json +5 -1
- package/types.d.ts +1 -0
- package/types.js +1 -0
package/README.md
CHANGED
|
@@ -58,6 +58,7 @@ const {
|
|
|
58
58
|
Payments,
|
|
59
59
|
Products,
|
|
60
60
|
ProductStatuses,
|
|
61
|
+
Search,
|
|
61
62
|
Sitemap,
|
|
62
63
|
Subscriptions,
|
|
63
64
|
System,
|
|
@@ -276,6 +277,7 @@ Now you can use the following links to jump to specific entries documentation:
|
|
|
276
277
|
- [Payments](https://js-sdk.oneentry.cloud/docs/category/payments)
|
|
277
278
|
- [ProductStatuses](https://js-sdk.oneentry.cloud/docs/category/productstatuses)
|
|
278
279
|
- [Products](https://js-sdk.oneentry.cloud/docs/category/products-1)
|
|
280
|
+
- [Search](https://js-sdk.oneentry.cloud/docs/category/search)
|
|
279
281
|
- [Sitemap](https://js-sdk.oneentry.cloud/docs/category/sitemap)
|
|
280
282
|
- [Subscriptions](https://js-sdk.oneentry.cloud/docs/category/subscriptions)
|
|
281
283
|
- [System](https://js-sdk.oneentry.cloud/docs/category/system)
|
package/changelog.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# SDK Change Log
|
|
2
2
|
|
|
3
|
+
## v.1.0.161
|
|
4
|
+
|
|
5
|
+
### What's New
|
|
6
|
+
|
|
7
|
+
- **Search — a new module** wrapping `GET /api/content/search`, the public cross-entity search over names and attribute values of visible records:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
const { Search } = defineOneEntry('your-url', config)
|
|
11
|
+
|
|
12
|
+
const all = await Search.globalSearch('winter')
|
|
13
|
+
// drilldown: offset/limit are applied by the API only when a single type is requested
|
|
14
|
+
const products = await Search.globalSearch('winter', ['products'], 'visible', 0, 20)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Results come back grouped by entity type (`IGlobalSearchResponse` → `IGlobalSearchGroup[]`), each item carrying the context of how it matched — `matchKind`, `matchedField`, `fragment`, `langCode` and, where relevant, `parent` or `matchedAttribute`. `types` accepts any of the 18 searchable entity types and is sent comma-separated.
|
|
18
|
+
|
|
19
|
+
`offset` and `limit` switch the endpoint into drilldown mode and are accepted only alongside exactly one accessible type in `types` — otherwise the API answers `400`. Omit them (the SDK does not default them) to get every group in full.
|
|
20
|
+
|
|
21
|
+
- **Semantic (vector) search in six more modules**, alongside the existing `Products.getProductsByVectorSearch`. Each takes the same body — `{ queryText, vectorDistanceThreshold?, maxHits?, debug? }` — plus `langCode`, `offset` and `limit`, and returns an `{ items, total }` container:
|
|
22
|
+
|
|
23
|
+
- Admins > `getAdminsByVectorSearch` → `IAdminsResponse`;
|
|
24
|
+
- Discounts > `getDiscountsByVectorSearch` → `IDiscountsResponse`;
|
|
25
|
+
- FormData > `getFormsDataByVectorSearch` → `IFormsDataSearchResponse`;
|
|
26
|
+
- Orders > `getOrdersByVectorSearch` → `IOrdersByMarkerEntity` (searches the authorized user's orders);
|
|
27
|
+
- Pages > `getPagesByVectorSearch` → `IPagesResponse`;
|
|
28
|
+
- Users > `getUsersByVectorSearch` → `IUsersResponse` (requires user authorization).
|
|
29
|
+
|
|
30
|
+
All six answer `500` on the test project at the time of release — the SDK side follows the documented contract, which is the same `ItemsWithTotal` container the working products endpoint returns.
|
|
31
|
+
|
|
32
|
+
- FormData > `IFormDataSearchEntity` — new exported type for the records returned by the form data vector search. It carries the moderation and sender fields of the raw record (`status`, `ip`, `fingerprint`, `isUserAdmin`, `userIdentifier`, `entityIdentifier`, `parentId`), which `IFormDataEntity` does not declare.
|
|
33
|
+
|
|
34
|
+
### What's Changed
|
|
35
|
+
|
|
36
|
+
- Payments > `IAccountsEntity.type` — the union is widened from `'stripe' | 'custom'` to `'stripe' | 'yookassa' | 'midtrans' | 'xendit' | 'custom'`, matching the payment providers the API actually reports. Accounts of these types were already returned; the declared type simply did not list them.
|
|
37
|
+
|
|
38
|
+
- Products > `IFilterParams.conditionMarker` — three operators the API accepts are now declared: `'pat'` (matches pattern), `'same'` (matches the value exactly) and `'same_part'` (matches a part of the value exactly). Filter bodies using them were valid before but did not type-check.
|
|
39
|
+
|
|
40
|
+
- Filters > `IContentFilterItem.value` — widened from `string | null` to `string | string[] | null` (and `ContentFilterItemSchema` accepts both). A range attribute node returns the array of values within the range; the other node types keep returning a single string or `null`.
|
|
41
|
+
|
|
42
|
+
### What's Deleted
|
|
43
|
+
|
|
44
|
+
- **Breaking** — TemplatePreviews > `ITemplatesPreviewEntity.attributeSetIdentifier` is removed, along with its Zod schema field. The API no longer returns it — it is absent from every template preview in the test project and has been dropped from the endpoint's response schema.
|
|
45
|
+
|
|
3
46
|
## v.1.0.160
|
|
4
47
|
|
|
5
48
|
> Re-release of v.1.0.159. The 1.0.159 tarball was published from a stale build directory: the files changed by that release were updated, but the files it added (`dist/base/lazySchema.js`, `dist/web-socket/lazySocket.js`, `dist/types.js`, the root `types.js` / `types.d.ts` stubs and the whole `esm/` build) never made it into the package, so `require('oneentry')` threw `Cannot find module '../base/lazySchema'`. Use 1.0.160 instead — same feature set, complete build.
|
|
@@ -2,7 +2,7 @@ import AsyncModules from '../base/asyncModules';
|
|
|
2
2
|
import type StateModule from '../base/stateModule';
|
|
3
3
|
import type { IError } from '../base/utils';
|
|
4
4
|
import type { IFilterParams } from '../products/productsInterfaces';
|
|
5
|
-
import type { IAdminEntity, IAdmins } from './adminsInterfaces';
|
|
5
|
+
import type { IAdminEntity, IAdmins, IAdminsResponse, IAdminsVectorSearch } from './adminsInterfaces';
|
|
6
6
|
/**
|
|
7
7
|
* Controllers for working with users - admins.
|
|
8
8
|
* @class AdminsApi
|
|
@@ -13,6 +13,7 @@ import type { IAdminEntity, IAdmins } from './adminsInterfaces';
|
|
|
13
13
|
export default class AdminsApi extends AsyncModules implements IAdmins {
|
|
14
14
|
protected state: StateModule;
|
|
15
15
|
protected _url: string;
|
|
16
|
+
private _adminsUrl;
|
|
16
17
|
/**
|
|
17
18
|
* Initializes the AdminsApi with the provided state module.
|
|
18
19
|
* @class
|
|
@@ -49,4 +50,17 @@ export default class AdminsApi extends AsyncModules implements IAdmins {
|
|
|
49
50
|
* @see {@link https://js-sdk.oneentry.cloud/docs/admins/getAdminsInfo getAdminsInfo} documentation.
|
|
50
51
|
*/
|
|
51
52
|
getAdminsInfo(body?: IFilterParams[], langCode?: string, offset?: number, limit?: number): Promise<IAdminEntity[] | IError>;
|
|
53
|
+
/**
|
|
54
|
+
* Semantic (vector) search for admins.
|
|
55
|
+
* @handleName getAdminsByVectorSearch
|
|
56
|
+
* @param {IAdminsVectorSearch} body - Vector search body. Example: `{ queryText: "content manager" }`.
|
|
57
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
58
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
59
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
60
|
+
* @returns {Promise<IAdminsResponse | IError>} Returns an object with an array of found admins and total count.
|
|
61
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
62
|
+
* @description This method performs a semantic (vector) search for admins.
|
|
63
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/admins/getAdminsByVectorSearch getAdminsByVectorSearch} documentation.
|
|
64
|
+
*/
|
|
65
|
+
getAdminsByVectorSearch(body: IAdminsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IAdminsResponse | IError>;
|
|
52
66
|
}
|
package/dist/admins/adminsApi.js
CHANGED
|
@@ -57,6 +57,7 @@ class AdminsApi extends asyncModules_1.default {
|
|
|
57
57
|
constructor(state) {
|
|
58
58
|
super(state);
|
|
59
59
|
this._url = state.url + '/api/content/admins/all';
|
|
60
|
+
this._adminsUrl = state.url + '/api/content/admins';
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
63
|
* Get all admins objects with filters.
|
|
@@ -96,5 +97,33 @@ class AdminsApi extends asyncModules_1.default {
|
|
|
96
97
|
const validated = await this._validateResponse(response, schema('AdminsResponseSchema'));
|
|
97
98
|
return this._normalizeData(validated, langCode);
|
|
98
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Semantic (vector) search for admins.
|
|
102
|
+
* @handleName getAdminsByVectorSearch
|
|
103
|
+
* @param {IAdminsVectorSearch} body - Vector search body. Example: `{ queryText: "content manager" }`.
|
|
104
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
105
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
106
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
107
|
+
* @returns {Promise<IAdminsResponse | IError>} Returns an object with an array of found admins and total count.
|
|
108
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
109
|
+
* @description This method performs a semantic (vector) search for admins.
|
|
110
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/admins/getAdminsByVectorSearch getAdminsByVectorSearch} documentation.
|
|
111
|
+
*/
|
|
112
|
+
async getAdminsByVectorSearch(body, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
113
|
+
const query = {
|
|
114
|
+
langCode,
|
|
115
|
+
offset,
|
|
116
|
+
limit,
|
|
117
|
+
};
|
|
118
|
+
const savedUrl = this._url;
|
|
119
|
+
this._url = this._adminsUrl;
|
|
120
|
+
try {
|
|
121
|
+
const response = await this._fetchPost(`/vector/search?` + this._queryParamsToString(query), body);
|
|
122
|
+
return this._normalizeData(response, langCode);
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
this._url = savedUrl;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
99
128
|
}
|
|
100
129
|
exports.default = AdminsApi;
|
|
@@ -33,6 +33,42 @@ interface IAdmins {
|
|
|
33
33
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
34
34
|
*/
|
|
35
35
|
getAdminsInfo(body?: IFilterParams[], langCode?: string, offset?: number, limit?: number): Promise<IAdminEntity[] | IError>;
|
|
36
|
+
/**
|
|
37
|
+
* Semantic (vector) search for admins.
|
|
38
|
+
* @handleName getAdminsByVectorSearch
|
|
39
|
+
* @param {IAdminsVectorSearch} body - Vector search body. Example: `{ queryText: "content manager" }`.
|
|
40
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
41
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
42
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
43
|
+
* @returns {IAdminsResponse} Returns an object with an array of found admins and total count.
|
|
44
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
45
|
+
*/
|
|
46
|
+
getAdminsByVectorSearch(body: IAdminsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IAdminsResponse | IError>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Body for semantic (vector) admin search.
|
|
50
|
+
* @interface IAdminsVectorSearch
|
|
51
|
+
* @property {string} queryText - Natural-language search query. Example: "content manager".
|
|
52
|
+
* @property {number} [vectorDistanceThreshold] - Override of the cosine distance threshold (0..2). Example: 0.3.
|
|
53
|
+
* @property {number} [maxHits] - Top-K candidates fetched before pagination. Default: 100. Max: 500. Example: 10.
|
|
54
|
+
* @property {boolean} [debug] - When true, each returned item gets a `distance` field. Example: false.
|
|
55
|
+
* @description Body for the admins vector/search endpoint.
|
|
56
|
+
*/
|
|
57
|
+
interface IAdminsVectorSearch {
|
|
58
|
+
queryText: string;
|
|
59
|
+
vectorDistanceThreshold?: number;
|
|
60
|
+
maxHits?: number;
|
|
61
|
+
debug?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @interface IAdminsResponse
|
|
65
|
+
* @property {IAdminEntity[]} items - Array of found admin objects.
|
|
66
|
+
* @property {number} total - Total number of found records. Example: 100.
|
|
67
|
+
* @description This interface defines the structure of a response containing multiple admin entities, including the total count and an array of admin items.
|
|
68
|
+
*/
|
|
69
|
+
interface IAdminsResponse {
|
|
70
|
+
items: IAdminEntity[];
|
|
71
|
+
total: number;
|
|
36
72
|
}
|
|
37
73
|
/**
|
|
38
74
|
* Interface representing a Position entity.
|
|
@@ -98,4 +134,4 @@ interface IAdminQuery {
|
|
|
98
134
|
limit: number;
|
|
99
135
|
offset: number;
|
|
100
136
|
}
|
|
101
|
-
export type { IAdminEntity, IAdminQuery, IAdmins, IPosition };
|
|
137
|
+
export type { IAdminEntity, IAdminQuery, IAdmins, IAdminsResponse, IAdminsVectorSearch, IPosition, };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a lazy schema loader bound to a module of Zod schemas.
|
|
3
|
+
*
|
|
4
|
+
* Validation is opt-in (`config.validation.enabled`, `false` by default), yet a static
|
|
5
|
+
* `import { PageEntitySchema } from './pagesSchemas'` would put Zod into the import graph
|
|
6
|
+
* of every consumer regardless. Binding the module behind a dynamic `import()` keeps it —
|
|
7
|
+
* and Zod — out of the bundle until a request actually needs to be validated.
|
|
8
|
+
* @param {() => Promise<TSchemas>} importSchemas - Dynamic import of the module holding the schemas.
|
|
9
|
+
* @returns {(name: keyof TSchemas) => () => Promise<TSchemas[keyof TSchemas]>} Function that takes
|
|
10
|
+
* a schema name and returns a loader for that schema.
|
|
11
|
+
* @description Usage: `const schema = createSchemaLoader(() => import('./pagesSchemas'))`,
|
|
12
|
+
* then `this._validateResponse(data, schema('PageEntitySchema'))`. The schema name is
|
|
13
|
+
* checked against the module's exports, so a typo is a compile-time error.
|
|
14
|
+
*/
|
|
15
|
+
export default function createSchemaLoader<TSchemas>(importSchemas: () => Promise<TSchemas>): <TName extends keyof TSchemas>(name: TName) => () => Promise<TSchemas[TName]>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = createSchemaLoader;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a lazy schema loader bound to a module of Zod schemas.
|
|
6
|
+
*
|
|
7
|
+
* Validation is opt-in (`config.validation.enabled`, `false` by default), yet a static
|
|
8
|
+
* `import { PageEntitySchema } from './pagesSchemas'` would put Zod into the import graph
|
|
9
|
+
* of every consumer regardless. Binding the module behind a dynamic `import()` keeps it —
|
|
10
|
+
* and Zod — out of the bundle until a request actually needs to be validated.
|
|
11
|
+
* @param {() => Promise<TSchemas>} importSchemas - Dynamic import of the module holding the schemas.
|
|
12
|
+
* @returns {(name: keyof TSchemas) => () => Promise<TSchemas[keyof TSchemas]>} Function that takes
|
|
13
|
+
* a schema name and returns a loader for that schema.
|
|
14
|
+
* @description Usage: `const schema = createSchemaLoader(() => import('./pagesSchemas'))`,
|
|
15
|
+
* then `this._validateResponse(data, schema('PageEntitySchema'))`. The schema name is
|
|
16
|
+
* checked against the module's exports, so a typo is a compile-time error.
|
|
17
|
+
*/
|
|
18
|
+
function createSchemaLoader(importSchemas) {
|
|
19
|
+
return (name) => () => importSchemas().then((schemas) => schemas[name]);
|
|
20
|
+
}
|
|
@@ -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 { IBonusBalanceEntity, IBonusTransactionEntity, IBonusTransactionType, ICouponValidationResult, IDiscountsApi, IDiscountsEntity, IDiscountsResponse, IDiscountType } from './discountsInterfaces';
|
|
4
|
+
import type { IBonusBalanceEntity, IBonusTransactionEntity, IBonusTransactionType, ICouponValidationResult, IDiscountsApi, IDiscountsEntity, IDiscountsResponse, IDiscountsVectorSearch, IDiscountType } from './discountsInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with events
|
|
7
7
|
* @handle /api/content/events
|
|
@@ -78,4 +78,17 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
|
|
|
78
78
|
* @see {@link https://js-sdk.oneentry.cloud/docs/discounts/validateDiscountsCoupon validateDiscountsCoupon} documentation.
|
|
79
79
|
*/
|
|
80
80
|
validateDiscountsCoupon(code: string): Promise<ICouponValidationResult | IError>;
|
|
81
|
+
/**
|
|
82
|
+
* Semantic (vector) search for discounts.
|
|
83
|
+
* @handleName getDiscountsByVectorSearch
|
|
84
|
+
* @param {IDiscountsVectorSearch} body - Vector search body. Example: `{ queryText: "winter sale" }`.
|
|
85
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
86
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
87
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
88
|
+
* @returns {Promise<IDiscountsResponse | IError>} Returns an object with an array of found discounts and total count.
|
|
89
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
90
|
+
* @description This method performs a semantic (vector) search for discounts.
|
|
91
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getDiscountsByVectorSearch getDiscountsByVectorSearch} documentation.
|
|
92
|
+
*/
|
|
93
|
+
getDiscountsByVectorSearch(body: IDiscountsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IDiscountsResponse | IError>;
|
|
81
94
|
}
|
|
@@ -117,5 +117,26 @@ class DiscountsApi extends asyncModules_1.default {
|
|
|
117
117
|
const data = await this._fetchGet(`/coupons/validate?` + this._queryParamsToString(query));
|
|
118
118
|
return this._normalizeData(data);
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Semantic (vector) search for discounts.
|
|
122
|
+
* @handleName getDiscountsByVectorSearch
|
|
123
|
+
* @param {IDiscountsVectorSearch} body - Vector search body. Example: `{ queryText: "winter sale" }`.
|
|
124
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
125
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
126
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
127
|
+
* @returns {Promise<IDiscountsResponse | IError>} Returns an object with an array of found discounts and total count.
|
|
128
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
129
|
+
* @description This method performs a semantic (vector) search for discounts.
|
|
130
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getDiscountsByVectorSearch getDiscountsByVectorSearch} documentation.
|
|
131
|
+
*/
|
|
132
|
+
async getDiscountsByVectorSearch(body, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
133
|
+
const query = {
|
|
134
|
+
langCode,
|
|
135
|
+
offset,
|
|
136
|
+
limit,
|
|
137
|
+
};
|
|
138
|
+
const data = await this._fetchPost(`/vector/search?` + this._queryParamsToString(query), body);
|
|
139
|
+
return this._normalizeData(data, langCode);
|
|
140
|
+
}
|
|
120
141
|
}
|
|
121
142
|
exports.default = DiscountsApi;
|
|
@@ -59,6 +59,32 @@ interface IDiscountsApi {
|
|
|
59
59
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
60
60
|
*/
|
|
61
61
|
getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusTransactionEntity[] | IError>;
|
|
62
|
+
/**
|
|
63
|
+
* Semantic (vector) search for discounts.
|
|
64
|
+
* @handleName getDiscountsByVectorSearch
|
|
65
|
+
* @param {IDiscountsVectorSearch} body - Vector search body. Example: `{ queryText: "winter sale" }`.
|
|
66
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
67
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
68
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
69
|
+
* @returns {Promise<IDiscountsResponse | IError>} Returns an object with an array of found discounts and total count.
|
|
70
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
71
|
+
*/
|
|
72
|
+
getDiscountsByVectorSearch(body: IDiscountsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IDiscountsResponse | IError>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Body for semantic (vector) discount search.
|
|
76
|
+
* @interface IDiscountsVectorSearch
|
|
77
|
+
* @property {string} queryText - Natural-language search query. Example: "winter sale".
|
|
78
|
+
* @property {number} [vectorDistanceThreshold] - Override of the cosine distance threshold (0..2). Example: 0.3.
|
|
79
|
+
* @property {number} [maxHits] - Top-K candidates fetched before pagination. Default: 100. Max: 500. Example: 10.
|
|
80
|
+
* @property {boolean} [debug] - When true, each returned item gets a `distance` field. Example: false.
|
|
81
|
+
* @description Body for the discounts vector/search endpoint.
|
|
82
|
+
*/
|
|
83
|
+
interface IDiscountsVectorSearch {
|
|
84
|
+
queryText: string;
|
|
85
|
+
vectorDistanceThreshold?: number;
|
|
86
|
+
maxHits?: number;
|
|
87
|
+
debug?: boolean;
|
|
62
88
|
}
|
|
63
89
|
/**
|
|
64
90
|
* Query parameters for fetching discounts.
|
|
@@ -264,4 +290,4 @@ interface IBonusTransactionEntity {
|
|
|
264
290
|
interface IBonusBalanceEntity {
|
|
265
291
|
balance: number;
|
|
266
292
|
}
|
|
267
|
-
export type { IBonusBalanceEntity, IBonusHistoryQuery, IBonusTransactionEntity, IBonusTransactionType, ICouponEntity, ICouponValidationResult, IDiscountByMarkerQuery, IDiscountCondition, IDiscountsApi, IDiscountsEntity, IDiscountsQuery, IDiscountsResponse, IDiscountsValidateCoupon, IDiscountType, IDiscountValue, };
|
|
293
|
+
export type { IBonusBalanceEntity, IBonusHistoryQuery, IBonusTransactionEntity, IBonusTransactionType, ICouponEntity, ICouponValidationResult, IDiscountByMarkerQuery, IDiscountCondition, IDiscountsApi, IDiscountsEntity, IDiscountsQuery, IDiscountsResponse, IDiscountsValidateCoupon, IDiscountsVectorSearch, IDiscountType, IDiscountValue, };
|
|
@@ -28,7 +28,7 @@ type TContentFilterItemType = 'page' | 'product' | 'admin' | 'attribute' | 'disc
|
|
|
28
28
|
* @property {string | null} [marker] - Marker of the linked entity, or null for type=page. Example: "about".
|
|
29
29
|
* @property {string | null} [url] - Page URL (only for type=page; null otherwise). Example: "about".
|
|
30
30
|
* @property {ILocalizeInfo} [localizeInfos] - Localized info of the linked entity in the requested locale.
|
|
31
|
-
* @property {string | null} [value] - Unified node value
|
|
31
|
+
* @property {string | string[] | null} [value] - Unified node value: an array of values in range for a range attribute, a resolved title for a legacy checkbox attribute, the discount value for discount/personal-discount/bonus, the object id for product/admin/payment-method, and null for a page. Example: ["25", "50", "75"].
|
|
32
32
|
* @property {number} [position] - Numeric position (per-level). Example: 1.
|
|
33
33
|
* @property {IContentFilterItem[]} [children] - Nested tree nodes (regular and custom items in a single array).
|
|
34
34
|
* @description A single node of a content filter items tree.
|
|
@@ -38,7 +38,7 @@ interface IContentFilterItem {
|
|
|
38
38
|
marker?: string | null;
|
|
39
39
|
url?: string | null;
|
|
40
40
|
localizeInfos?: ILocalizeInfo;
|
|
41
|
-
value?: string | null;
|
|
41
|
+
value?: string | string[] | null;
|
|
42
42
|
position?: number;
|
|
43
43
|
children?: IContentFilterItem[];
|
|
44
44
|
}
|
|
@@ -15,7 +15,10 @@ exports.ContentFilterItemSchema = zod_1.z.lazy(() => zod_1.z.object({
|
|
|
15
15
|
marker: zod_1.z.string().nullable().optional(),
|
|
16
16
|
url: zod_1.z.string().nullable().optional(),
|
|
17
17
|
localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
18
|
-
value: zod_1.z
|
|
18
|
+
value: zod_1.z
|
|
19
|
+
.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())])
|
|
20
|
+
.nullable()
|
|
21
|
+
.optional(),
|
|
19
22
|
position: zod_1.z.number().optional(),
|
|
20
23
|
children: zod_1.z.array(exports.ContentFilterItemSchema).optional(),
|
|
21
24
|
}));
|
|
@@ -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 { IBodyPostFormData, IFormsByMarkerDataEntity, IFormsData, IPostFormResponse, IUpdateFormsData } from './formsDataInterfaces';
|
|
4
|
+
import type { IBodyPostFormData, IFormsByMarkerDataEntity, IFormsData, IFormsDataSearchResponse, IFormsDataVectorSearch, IPostFormResponse, IUpdateFormsData } from './formsDataInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with form data
|
|
7
7
|
* @handle /api/content/form-data
|
|
@@ -108,4 +108,17 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
|
|
|
108
108
|
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/deleteFormsDataByid deleteFormsDataByid} documentation.
|
|
109
109
|
*/
|
|
110
110
|
deleteFormsDataByid(id: number): Promise<boolean | IError>;
|
|
111
|
+
/**
|
|
112
|
+
* Semantic (vector) search for form data.
|
|
113
|
+
* @handleName getFormsDataByVectorSearch
|
|
114
|
+
* @param {IFormsDataVectorSearch} body - Vector search body. Example: `{ queryText: "order confirmation" }`.
|
|
115
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
116
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
117
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
118
|
+
* @returns {Promise<IFormsDataSearchResponse | IError>} Returns an object with an array of found form data records and total count.
|
|
119
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
120
|
+
* @description This method performs a semantic (vector) search for form data.
|
|
121
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByVectorSearch getFormsDataByVectorSearch} documentation.
|
|
122
|
+
*/
|
|
123
|
+
getFormsDataByVectorSearch(body: IFormsDataVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IFormsDataSearchResponse | IError>;
|
|
111
124
|
}
|
|
@@ -224,5 +224,26 @@ class FormsDataApi extends asyncModules_1.default {
|
|
|
224
224
|
const result = await this._fetchDelete(`/${id}`);
|
|
225
225
|
return result;
|
|
226
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Semantic (vector) search for form data.
|
|
229
|
+
* @handleName getFormsDataByVectorSearch
|
|
230
|
+
* @param {IFormsDataVectorSearch} body - Vector search body. Example: `{ queryText: "order confirmation" }`.
|
|
231
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
232
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
233
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
234
|
+
* @returns {Promise<IFormsDataSearchResponse | IError>} Returns an object with an array of found form data records and total count.
|
|
235
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
236
|
+
* @description This method performs a semantic (vector) search for form data.
|
|
237
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByVectorSearch getFormsDataByVectorSearch} documentation.
|
|
238
|
+
*/
|
|
239
|
+
async getFormsDataByVectorSearch(body, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
240
|
+
const query = {
|
|
241
|
+
langCode,
|
|
242
|
+
offset,
|
|
243
|
+
limit,
|
|
244
|
+
};
|
|
245
|
+
const result = await this._fetchPost(`/vector/search?` + this._queryParamsToString(query), body);
|
|
246
|
+
return this._normalizeData(result, langCode);
|
|
247
|
+
}
|
|
227
248
|
}
|
|
228
249
|
exports.default = FormsDataApi;
|
|
@@ -70,6 +70,79 @@ interface IFormsData {
|
|
|
70
70
|
* @description This method retrieves form data by its marker.
|
|
71
71
|
*/
|
|
72
72
|
getFormsDataByMarker(marker: string, formModuleConfigId: number, body?: object, isNested?: number, langCode?: string, offset?: number, limit?: number): Promise<IFormsByMarkerDataEntity | IError>;
|
|
73
|
+
/**
|
|
74
|
+
* Semantic (vector) search for form data.
|
|
75
|
+
* @handleName getFormsDataByVectorSearch
|
|
76
|
+
* @param {IFormsDataVectorSearch} body - Vector search body. Example: `{ queryText: "order confirmation" }`.
|
|
77
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
78
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
79
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
80
|
+
* @returns {Promise<IFormsDataSearchResponse | IError>} Returns an object with an array of found form data records and total count.
|
|
81
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
82
|
+
*/
|
|
83
|
+
getFormsDataByVectorSearch(body: IFormsDataVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IFormsDataSearchResponse | IError>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Body for semantic (vector) form data search.
|
|
87
|
+
* @interface IFormsDataVectorSearch
|
|
88
|
+
* @property {string} queryText - Natural-language search query. Example: "order confirmation".
|
|
89
|
+
* @property {number} [vectorDistanceThreshold] - Override of the cosine distance threshold (0..2). Example: 0.3.
|
|
90
|
+
* @property {number} [maxHits] - Top-K candidates fetched before pagination. Default: 100. Max: 500. Example: 10.
|
|
91
|
+
* @property {boolean} [debug] - When true, each returned item gets a `distance` field. Example: false.
|
|
92
|
+
* @description Body for the form-data vector/search endpoint.
|
|
93
|
+
*/
|
|
94
|
+
interface IFormsDataVectorSearch {
|
|
95
|
+
queryText: string;
|
|
96
|
+
vectorDistanceThreshold?: number;
|
|
97
|
+
maxHits?: number;
|
|
98
|
+
debug?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Represents a form data record returned by the vector search endpoint.
|
|
102
|
+
* @interface IFormDataSearchEntity
|
|
103
|
+
* @property {number} [id] - The unique identifier of the form data record. Example: 12345.
|
|
104
|
+
* @property {string} [formIdentifier] - Text identifier of the form. Example: "contact_form".
|
|
105
|
+
* @property {Date | string} [time] - Date and time the form data was last changed. Example: "2023-02-12 10:56".
|
|
106
|
+
* @property {FormDataType[]} [formData] - Data submitted by the form.
|
|
107
|
+
* @example
|
|
108
|
+
[
|
|
109
|
+
{
|
|
110
|
+
"marker": "name",
|
|
111
|
+
"type": "string",
|
|
112
|
+
"value": "Test"
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
* @property {string} [userIdentifier] - Text identifier of the user who submitted the form. Example: "user_12345".
|
|
116
|
+
* @property {string} [entityIdentifier] - Text identifier of the entity the record belongs to. Example: "product_1".
|
|
117
|
+
* @property {number} [parentId] - Identifier of the parent form data record. Example: 1.
|
|
118
|
+
* @property {string} [ip] - IP address the form was submitted from. Example: "127.0.0.1".
|
|
119
|
+
* @property {string} [fingerprint] - Device fingerprint of the sender. Example: "UQ_123456_abcdef".
|
|
120
|
+
* @property {boolean} [isUserAdmin] - Whether the record was submitted by an admin. Example: false.
|
|
121
|
+
* @property {'sent' | 'banned' | 'deleted' | 'moderation' | 'approved'} [status] - Moderation status of the record. Example: "sent".
|
|
122
|
+
* @description This interface defines a form data record as returned by the semantic (vector) search endpoint. Unlike IFormDataEntity it carries the moderation and sender fields of the raw record.
|
|
123
|
+
*/
|
|
124
|
+
interface IFormDataSearchEntity {
|
|
125
|
+
id?: number;
|
|
126
|
+
formIdentifier?: string;
|
|
127
|
+
time?: Date | string;
|
|
128
|
+
formData?: FormDataType[];
|
|
129
|
+
userIdentifier?: string;
|
|
130
|
+
entityIdentifier?: string;
|
|
131
|
+
parentId?: number;
|
|
132
|
+
ip?: string;
|
|
133
|
+
fingerprint?: string;
|
|
134
|
+
isUserAdmin?: boolean;
|
|
135
|
+
status?: 'sent' | 'banned' | 'deleted' | 'moderation' | 'approved';
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* @interface IFormsDataSearchResponse
|
|
139
|
+
* @property {IFormDataSearchEntity[]} items - Array of found form data records.
|
|
140
|
+
* @property {number} total - Total number of found records. Example: 100.
|
|
141
|
+
* @description This interface defines the structure of the response returned by the form data vector search endpoint.
|
|
142
|
+
*/
|
|
143
|
+
interface IFormsDataSearchResponse {
|
|
144
|
+
items: IFormDataSearchEntity[];
|
|
145
|
+
total: number;
|
|
73
146
|
}
|
|
74
147
|
/**
|
|
75
148
|
* Represents the structure of a form data entity.
|
|
@@ -594,4 +667,4 @@ interface IListOptionValue {
|
|
|
594
667
|
value: string;
|
|
595
668
|
extended: IListOptionExtended;
|
|
596
669
|
}
|
|
597
|
-
export type { FormDataType, IBodyPostFormData, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IFileValue, IFormByMarkerDataEntity, IFormDataEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IImageValue, IImageValueParams, IListOptionExtended, IListOptionValue, IPostFormResponse, IPostFormResponseData, ITextEditorParams, ITextValue, ITextWithHeaderValue, ITimeDateValue, IUpdateFormsData, };
|
|
670
|
+
export type { FormDataType, IBodyPostFormData, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IFileValue, IFormByMarkerDataEntity, IFormDataEntity, IFormDataSearchEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IFormsDataSearchResponse, IFormsDataVectorSearch, IImageValue, IImageValueParams, IListOptionExtended, IListOptionValue, IPostFormResponse, IPostFormResponseData, ITextEditorParams, ITextValue, ITextWithHeaderValue, ITimeDateValue, IUpdateFormsData, };
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import PagesApi from './pages/pagesApi';
|
|
|
21
21
|
import PaymentsApi from './payments/paymentsApi';
|
|
22
22
|
import ProductStatusesApi from './product-statuses/productStatusesApi';
|
|
23
23
|
import ProductsApi from './products/productsApi';
|
|
24
|
+
import SearchApi from './search/searchApi';
|
|
24
25
|
import SitemapApi from './sitemap/sitemapApi';
|
|
25
26
|
import SubscriptionsApi from './subscriptions/subscriptionsApi';
|
|
26
27
|
import SystemApi from './system/systemApi';
|
|
@@ -53,6 +54,7 @@ export type * from './types';
|
|
|
53
54
|
* @property {PaymentsApi} Payments - Payments API module.
|
|
54
55
|
* @property {ProductsApi} Products - Products API module.
|
|
55
56
|
* @property {ProductStatusesApi} ProductStatuses - Product statuses API module.
|
|
57
|
+
* @property {SearchApi} Search - Search API module.
|
|
56
58
|
* @property {SitemapApi} Sitemap - Sitemap API module.
|
|
57
59
|
* @property {SubscriptionsApi} Subscriptions - Subscriptions API module.
|
|
58
60
|
* @property {SystemApi} System - System API module.
|
|
@@ -101,6 +103,8 @@ interface IDefineApi {
|
|
|
101
103
|
Products: ProductsApi;
|
|
102
104
|
/** Product statuses: getProductStatuses */
|
|
103
105
|
ProductStatuses: ProductStatusesApi;
|
|
106
|
+
/** Public cross-entity search: globalSearch */
|
|
107
|
+
Search: SearchApi;
|
|
104
108
|
/** Sitemap generation */
|
|
105
109
|
Sitemap: SitemapApi;
|
|
106
110
|
/** Paid subscriptions: subscribe, cancelSubscription, recoverSubscriptions, getAllSubscriptions, getActiveSubscriptions */
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,7 @@ const pagesApi_1 = __importDefault(require("./pages/pagesApi"));
|
|
|
28
28
|
const paymentsApi_1 = __importDefault(require("./payments/paymentsApi"));
|
|
29
29
|
const productStatusesApi_1 = __importDefault(require("./product-statuses/productStatusesApi"));
|
|
30
30
|
const productsApi_1 = __importDefault(require("./products/productsApi"));
|
|
31
|
+
const searchApi_1 = __importDefault(require("./search/searchApi"));
|
|
31
32
|
const sitemapApi_1 = __importDefault(require("./sitemap/sitemapApi"));
|
|
32
33
|
const subscriptionsApi_1 = __importDefault(require("./subscriptions/subscriptionsApi"));
|
|
33
34
|
const systemApi_1 = __importDefault(require("./system/systemApi"));
|
|
@@ -91,6 +92,7 @@ function defineOneEntry(url, config) {
|
|
|
91
92
|
const Payments = new paymentsApi_1.default(stateModule);
|
|
92
93
|
const Products = new productsApi_1.default(stateModule);
|
|
93
94
|
const ProductStatuses = new productStatusesApi_1.default(stateModule);
|
|
95
|
+
const Search = new searchApi_1.default(stateModule);
|
|
94
96
|
const Sitemap = new sitemapApi_1.default(stateModule);
|
|
95
97
|
const Subscriptions = new subscriptionsApi_1.default(stateModule);
|
|
96
98
|
const System = new systemApi_1.default(stateModule);
|
|
@@ -119,6 +121,7 @@ function defineOneEntry(url, config) {
|
|
|
119
121
|
Payments,
|
|
120
122
|
Products,
|
|
121
123
|
ProductStatuses,
|
|
124
|
+
Search,
|
|
122
125
|
Sitemap,
|
|
123
126
|
Subscriptions,
|
|
124
127
|
System,
|
|
@@ -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 { IBaseOrdersEntity, ICreateOrderPreview, ICreateRefundRequest, IOrderByMarkerEntity, IOrderData, IOrderPreviewResponse, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrderStatus, IRefundRequest } from './ordersInterfaces';
|
|
4
|
+
import type { IBaseOrdersEntity, ICreateOrderPreview, ICreateRefundRequest, IOrderByMarkerEntity, IOrderData, IOrderPreviewResponse, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrderStatus, IOrdersVectorSearch, IRefundRequest } from './ordersInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with orders.
|
|
7
7
|
* @handle /api/content/orders-storage
|
|
@@ -183,6 +183,20 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
|
183
183
|
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/cancelRefundRequest cancelRefundRequest} documentation.
|
|
184
184
|
*/
|
|
185
185
|
cancelRefundRequest(id: number): Promise<boolean | IError>;
|
|
186
|
+
/**
|
|
187
|
+
* Semantic (vector) search for the current user's orders.
|
|
188
|
+
* @handleName getOrdersByVectorSearch
|
|
189
|
+
* @param {IOrdersVectorSearch} body - Vector search body. Example: `{ queryText: "winter jacket" }`.
|
|
190
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
191
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
192
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
193
|
+
* @returns {Promise<IOrdersByMarkerEntity | IError>} Returns an object with an array of found orders and total count.
|
|
194
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
195
|
+
* @description This method performs a semantic (vector) search over the orders of the authorized user. It requires user authorization.
|
|
196
|
+
* @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}.
|
|
197
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrdersByVectorSearch getOrdersByVectorSearch} documentation.
|
|
198
|
+
*/
|
|
199
|
+
getOrdersByVectorSearch(body: IOrdersVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IOrdersByMarkerEntity | IError>;
|
|
186
200
|
/**
|
|
187
201
|
* Runs a fetch against the `/orders` base URL instead of the default
|
|
188
202
|
* `/orders-storage`, then restores the original URL.
|
package/dist/orders/ordersApi.js
CHANGED
|
@@ -279,6 +279,28 @@ class OrdersApi extends asyncModules_1.default {
|
|
|
279
279
|
const data = await this._withOrdersUrl(() => this._fetchDelete(`/${id}/refund`));
|
|
280
280
|
return this._normalizeData(data);
|
|
281
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* Semantic (vector) search for the current user's orders.
|
|
284
|
+
* @handleName getOrdersByVectorSearch
|
|
285
|
+
* @param {IOrdersVectorSearch} body - Vector search body. Example: `{ queryText: "winter jacket" }`.
|
|
286
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
287
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
288
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
289
|
+
* @returns {Promise<IOrdersByMarkerEntity | IError>} Returns an object with an array of found orders and total count.
|
|
290
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
291
|
+
* @description This method performs a semantic (vector) search over the orders of the authorized user. It requires user authorization.
|
|
292
|
+
* @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}.
|
|
293
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrdersByVectorSearch getOrdersByVectorSearch} documentation.
|
|
294
|
+
*/
|
|
295
|
+
async getOrdersByVectorSearch(body, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
296
|
+
const query = {
|
|
297
|
+
langCode,
|
|
298
|
+
offset,
|
|
299
|
+
limit,
|
|
300
|
+
};
|
|
301
|
+
const data = await this._withOrdersUrl(() => this._fetchPost(`/vector/search?` + this._queryParamsToString(query), body));
|
|
302
|
+
return this._normalizeData(data, langCode);
|
|
303
|
+
}
|
|
282
304
|
/**
|
|
283
305
|
* Runs a fetch against the `/orders` base URL instead of the default
|
|
284
306
|
* `/orders-storage`, then restores the original URL.
|