oneentry 1.0.159 → 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 +56 -1
- 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 +47 -2
- package/types.d.ts +1 -0
- package/types.js +1 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules.js';
|
|
2
|
+
import createSchemaLoader from '../base/lazySchema.js';
|
|
3
|
+
const schema = createSchemaLoader(() => import('./menusSchemas.js'));
|
|
4
|
+
/**
|
|
5
|
+
* Controllers for working with menu objects
|
|
6
|
+
* @handle /api/content/menus
|
|
7
|
+
* @description Controllers for working with menu objects
|
|
8
|
+
*/
|
|
9
|
+
export default class MenusApi extends AsyncModules {
|
|
10
|
+
/**
|
|
11
|
+
* Constructor initializes the MenusApi with a given state.
|
|
12
|
+
* @param {StateModule} state - The state module.
|
|
13
|
+
* @description Constructor initializes the MenusApi with a given state.
|
|
14
|
+
*/
|
|
15
|
+
constructor(state) {
|
|
16
|
+
super(state);
|
|
17
|
+
this._url = state.url + '/api/content/menus';
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get pages includes in menu by marker.
|
|
21
|
+
* @handleName getMenusByMarker
|
|
22
|
+
* @param {string} marker - Menu marker. Example: "main_menu".
|
|
23
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
24
|
+
* @returns {Promise<IMenusEntity | IError>} Returns a single menu object as a ContentMenu object with included pages.
|
|
25
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
26
|
+
* @description Get pages includes in menu by marker.
|
|
27
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/menus/getMenusByMarker getMenusByMarker} documentation.
|
|
28
|
+
*/
|
|
29
|
+
async getMenusByMarker(marker, langCode = this.state.lang) {
|
|
30
|
+
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
31
|
+
// Validate response if validation is enabled
|
|
32
|
+
const validated = await this._validateResponse(result, schema('MenuEntitySchema'));
|
|
33
|
+
return this._normalizeData(validated, langCode);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { IAttributeValues, IError, ILocalizeInfo } from '../base/utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* @interface IMenus
|
|
4
|
+
* @description This interface defines a method for retrieving menu pages by a specific marker and language code.
|
|
5
|
+
*/
|
|
6
|
+
interface IMenus {
|
|
7
|
+
/**
|
|
8
|
+
* Get pages includes in menu by marker.
|
|
9
|
+
* @handleName getMenusByMarker
|
|
10
|
+
* @param {string} marker - Menu marker. Example: "main_menu".
|
|
11
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
12
|
+
* @returns {IMenusEntity} Returns a single menu object as a ContentMenu object with included pages.
|
|
13
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
14
|
+
* @description This method gets pages includes in menu by marker.
|
|
15
|
+
*/
|
|
16
|
+
getMenusByMarker(marker: string, langCode: string): Promise<IMenusEntity | IError>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @interface IMenusPages
|
|
20
|
+
* @property {IMenusPages[]} children - Contains array with child page objects.
|
|
21
|
+
* @example
|
|
22
|
+
[
|
|
23
|
+
{
|
|
24
|
+
"id": null,
|
|
25
|
+
"pageUrl": null,
|
|
26
|
+
"localizeInfos": {},
|
|
27
|
+
"attributeValues": {},
|
|
28
|
+
"parentId": null,
|
|
29
|
+
"position": 1
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
* @property {number | null} id - The unique identifier of the menu. Example: 1.
|
|
33
|
+
* @property {string | null} pageUrl - The page url string. Example: "about".
|
|
34
|
+
* @property {ILocalizeInfo} localizeInfos - The menu data, taking into account localization.
|
|
35
|
+
* @example
|
|
36
|
+
{
|
|
37
|
+
"title": "menu"
|
|
38
|
+
}
|
|
39
|
+
* @property {IAttributeValues} attributeValues - Attributes sets.
|
|
40
|
+
* @example
|
|
41
|
+
{
|
|
42
|
+
"color": "red",
|
|
43
|
+
"size": "large"
|
|
44
|
+
}
|
|
45
|
+
* @property {number} position - The menu position. Example: 1.
|
|
46
|
+
* @property {number | null} parentId - The menu parent id. Example: null.
|
|
47
|
+
* @description This interface defines the structure of a menu page entity, including its identifiers, localization information, attributes, and hierarchical relationships.
|
|
48
|
+
*/
|
|
49
|
+
interface IMenusPages {
|
|
50
|
+
children?: IMenusPages[] | IMenusPages;
|
|
51
|
+
id: number | null;
|
|
52
|
+
pageUrl: string | null;
|
|
53
|
+
localizeInfos: ILocalizeInfo;
|
|
54
|
+
attributeValues: IAttributeValues;
|
|
55
|
+
position: number;
|
|
56
|
+
parentId: number | null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @interface IMenusEntity
|
|
60
|
+
* @property {number} id - The unique identifier of the menu. Example: 1.
|
|
61
|
+
* @property {string} identifier - The menu identifier. Example: "main_menu".
|
|
62
|
+
* @property {ILocalizeInfo} localizeInfos - Contains localization information.
|
|
63
|
+
* @example
|
|
64
|
+
{
|
|
65
|
+
"title": "menu"
|
|
66
|
+
}
|
|
67
|
+
* @property {IMenusPages[]} pages - Array of menu pages.
|
|
68
|
+
* @example
|
|
69
|
+
[
|
|
70
|
+
{
|
|
71
|
+
"id": null,
|
|
72
|
+
"pageUrl": null,
|
|
73
|
+
"localizeInfos": {},
|
|
74
|
+
"attributeValues": {},
|
|
75
|
+
"parentId": null,
|
|
76
|
+
"position": 1
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
* @description This interface defines the structure of a menu entity, including its identifiers, localization information, and associated pages.
|
|
80
|
+
*/
|
|
81
|
+
interface IMenusEntity {
|
|
82
|
+
id: number;
|
|
83
|
+
identifier: string;
|
|
84
|
+
localizeInfos: ILocalizeInfo;
|
|
85
|
+
pages: IMenusPages[];
|
|
86
|
+
}
|
|
87
|
+
export type { IMenus, IMenusEntity, IMenusPages };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Menu pages schema (recursive)
|
|
4
|
+
* Can have children that are also menu pages
|
|
5
|
+
*/
|
|
6
|
+
export declare const MenusPagesSchema: z.ZodType<any>;
|
|
7
|
+
/**
|
|
8
|
+
* Menu entity schema
|
|
9
|
+
* Includes all fields returned by the API
|
|
10
|
+
*/
|
|
11
|
+
export declare const MenuEntitySchema: z.ZodObject<{
|
|
12
|
+
id: z.ZodNumber;
|
|
13
|
+
identifier: z.ZodString;
|
|
14
|
+
localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
15
|
+
pages: z.ZodUnion<readonly [z.ZodArray<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>]>;
|
|
16
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Menu pages schema (recursive)
|
|
4
|
+
* Can have children that are also menu pages
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
export const MenusPagesSchema = z.lazy(() => z.object({
|
|
8
|
+
children: z.union([z.array(MenusPagesSchema), MenusPagesSchema]).optional(),
|
|
9
|
+
id: z.number().nullable(),
|
|
10
|
+
pageUrl: z.string().nullable(),
|
|
11
|
+
localizeInfos: z.record(z.string(), z.any()),
|
|
12
|
+
attributeValues: z.record(z.string(), z.any()),
|
|
13
|
+
position: z.number(),
|
|
14
|
+
parentId: z.number().nullable(),
|
|
15
|
+
}));
|
|
16
|
+
/**
|
|
17
|
+
* Menu entity schema
|
|
18
|
+
* Includes all fields returned by the API
|
|
19
|
+
*/
|
|
20
|
+
export const MenuEntitySchema = z.object({
|
|
21
|
+
id: z.number(),
|
|
22
|
+
identifier: z.string(),
|
|
23
|
+
localizeInfos: z.record(z.string(), z.any()),
|
|
24
|
+
pages: z.union([z.array(MenusPagesSchema), MenusPagesSchema]),
|
|
25
|
+
});
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules.js';
|
|
2
|
+
import type StateModule from '../base/stateModule.js';
|
|
3
|
+
import type { IError } from '../base/utils.js';
|
|
4
|
+
import type { IBaseOrdersEntity, ICreateOrderPreview, ICreateRefundRequest, IOrderByMarkerEntity, IOrderData, IOrderPreviewResponse, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrderStatus, IOrdersVectorSearch, IRefundRequest } from './ordersInterfaces.js';
|
|
5
|
+
/**
|
|
6
|
+
* Controllers for working with orders.
|
|
7
|
+
* @handle /api/content/orders-storage
|
|
8
|
+
* @module OrdersApi
|
|
9
|
+
* @description This module provides methods for working with orders, including retrieving, creating, and updating orders in the order storage.
|
|
10
|
+
*/
|
|
11
|
+
export default class OrdersApi extends AsyncModules implements IOrdersApi {
|
|
12
|
+
protected state: StateModule;
|
|
13
|
+
protected _url: string;
|
|
14
|
+
private _ordersUrl;
|
|
15
|
+
/**
|
|
16
|
+
* Constructs an instance of the OrdersApi class.
|
|
17
|
+
* @param {StateModule} state - The state module containing the necessary information for making API calls.
|
|
18
|
+
* @description Constructor initializes the OrdersApi with a given state.
|
|
19
|
+
*/
|
|
20
|
+
constructor(state: StateModule);
|
|
21
|
+
/**
|
|
22
|
+
* Getting all the order storage objects.
|
|
23
|
+
* @handleName getAllOrdersStorage
|
|
24
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
25
|
+
* @param {number} [offset] - Optional parameter for pagination. Default: 0.
|
|
26
|
+
* @param {number} [limit] - Optional parameter for pagination. Default: 30.
|
|
27
|
+
* @returns {Promise<IOrdersEntity[] | IError>} Returns an array of order storage objects.
|
|
28
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
29
|
+
* @description This method requires user authorization.
|
|
30
|
+
* @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}.
|
|
31
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllOrdersStorage getAllOrdersStorage} documentation.
|
|
32
|
+
*/
|
|
33
|
+
getAllOrdersStorage(langCode?: string, offset?: number, limit?: number): Promise<IOrdersEntity[] | IError>;
|
|
34
|
+
/**
|
|
35
|
+
* Getting all orders from the orders storage object created by the user.
|
|
36
|
+
* @handleName getAllOrdersByMarker
|
|
37
|
+
* @param {string} marker - Textual identifier of the order storage object. Example: "order_storage_1".
|
|
38
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
39
|
+
* @param {number} [offset] - Offset parameter. Default: 0.
|
|
40
|
+
* @param {number} [limit] - Limit parameter. Default: 30.
|
|
41
|
+
* @returns {Promise<IOrdersByMarkerEntity | IError>} Returns an object with the orders.
|
|
42
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
43
|
+
* @description This method requires user authorization.
|
|
44
|
+
* @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}.
|
|
45
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllOrdersByMarker getAllOrdersByMarker} documentation.
|
|
46
|
+
*/
|
|
47
|
+
getAllOrdersByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IOrdersByMarkerEntity | IError>;
|
|
48
|
+
/**
|
|
49
|
+
* Retrieve one order storage object by marker.
|
|
50
|
+
* @handleName getOrdersStorageByMarker
|
|
51
|
+
* @param {string} marker - Marker of the order object. Example: "order_storage_1".
|
|
52
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
53
|
+
* @returns {Promise<IOrdersEntity | IError>} Return object of order information.
|
|
54
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
55
|
+
* @description This method requires user authorization.
|
|
56
|
+
* @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}.
|
|
57
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrdersStorageByMarker getOrdersStorageByMarker} documentation.
|
|
58
|
+
*/
|
|
59
|
+
getOrdersStorageByMarker(marker: string, langCode?: string): Promise<IOrdersEntity | IError>;
|
|
60
|
+
/**
|
|
61
|
+
* Getting a single order from the order storage object created by the user.
|
|
62
|
+
* @handleName getOrderByMarkerAndId
|
|
63
|
+
* @param {string} marker - The text identifier of the order storage object. Example: "order_storage_1".
|
|
64
|
+
* @param {number} id - ID of the order object. Example: 12345.
|
|
65
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
66
|
+
* @returns {Promise<IOrderByMarkerEntity | IError>} Returns an object with the order.
|
|
67
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
68
|
+
* @description This method requires user authorization.
|
|
69
|
+
* @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}.
|
|
70
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrderByMarkerAndId getOrderByMarkerAndId} documentation.
|
|
71
|
+
*/
|
|
72
|
+
getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<IOrderByMarkerEntity | IError>;
|
|
73
|
+
/**
|
|
74
|
+
* Preview order calculation with discounts and coupons (without saving).
|
|
75
|
+
* @handleName previewOrder
|
|
76
|
+
* @param {ICreateOrderPreview} body - Order preview body.
|
|
77
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
78
|
+
* @returns {Promise<IOrderPreviewResponse | IError>} Returns an object with the order preview.
|
|
79
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
80
|
+
* @description This method requires user authorization.
|
|
81
|
+
* @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}.
|
|
82
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/previewOrder previewOrder} documentation.
|
|
83
|
+
*/
|
|
84
|
+
previewOrder(body: ICreateOrderPreview, langCode?: string): Promise<IOrderPreviewResponse | IError>;
|
|
85
|
+
/**
|
|
86
|
+
* Creation of an order in the order storage.
|
|
87
|
+
* @handleName createOrder
|
|
88
|
+
* @param {string} marker - Textual identifier of the order storage object. Example: "order_storage_1".
|
|
89
|
+
* @param {IOrderData} body - Object for creating an order.
|
|
90
|
+
* @example
|
|
91
|
+
{
|
|
92
|
+
"formIdentifier": "bar-orders-form",
|
|
93
|
+
"paymentAccountIdentifier": "usd-payment",
|
|
94
|
+
"formData": {
|
|
95
|
+
"marker": "name_1",
|
|
96
|
+
"value": "Name",
|
|
97
|
+
"type": "string"
|
|
98
|
+
},
|
|
99
|
+
"products": [
|
|
100
|
+
{
|
|
101
|
+
"productId": 1,
|
|
102
|
+
"quantity": 2
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
107
|
+
* @returns {Promise<IBaseOrdersEntity | IError>} Returns an object with the created order.
|
|
108
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
109
|
+
* @description This method requires user authorization.
|
|
110
|
+
* @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}.
|
|
111
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/createOrder createOrder} documentation.
|
|
112
|
+
*/
|
|
113
|
+
createOrder(marker: string, body: IOrderData, langCode?: string): Promise<IBaseOrdersEntity | IError>;
|
|
114
|
+
/**
|
|
115
|
+
* Changing an order in the orders storage
|
|
116
|
+
* @handleName updateOrderByMarkerAndId
|
|
117
|
+
* @param {string} marker - The text identifier of the order storage object. Example: "order_storage_1".
|
|
118
|
+
* @param {number} id - ID of the order object. Example: 12345.
|
|
119
|
+
* @param {IOrderData} body - Object for updating an order.
|
|
120
|
+
* @example
|
|
121
|
+
{
|
|
122
|
+
"formIdentifier": "bar-orders-form",
|
|
123
|
+
"paymentAccountIdentifier": "usd-payment",
|
|
124
|
+
"formData": {
|
|
125
|
+
"marker": "name_1",
|
|
126
|
+
"value": "Name",
|
|
127
|
+
"type": "string"
|
|
128
|
+
},
|
|
129
|
+
"products": [
|
|
130
|
+
{
|
|
131
|
+
"productId": 1,
|
|
132
|
+
"quantity": 2
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
"currency": "USD"
|
|
136
|
+
}
|
|
137
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
138
|
+
* @returns {Promise<IBaseOrdersEntity | IError>} Returns an object with the updated order.
|
|
139
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
140
|
+
* @description This method requires user authorization.
|
|
141
|
+
* @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}.
|
|
142
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/updateOrderByMarkerAndId updateOrderByMarkerAndId} documentation.
|
|
143
|
+
*/
|
|
144
|
+
updateOrderByMarkerAndId(marker: string, id: number, body: IOrderData, langCode?: string): Promise<IBaseOrdersEntity | IError>;
|
|
145
|
+
/**
|
|
146
|
+
* Get all orders statuses by Storage marker
|
|
147
|
+
* @handleName getAllStatusesByStorageMarker
|
|
148
|
+
* @param {string} marker - Textual identifier of the order storage object. Example: "order_storage_1".
|
|
149
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
150
|
+
* @param {number} [offset] - Offset parameter. Default: 0.
|
|
151
|
+
* @param {number} [limit] - Limit parameter. Default: 30.
|
|
152
|
+
* @returns {Promise<IOrderStatus[] | IError>} Returns an object with the orders statuses.
|
|
153
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
154
|
+
* @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}.
|
|
155
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllStatusesByStorageMarker getAllStatusesByStorageMarker} documentation.
|
|
156
|
+
*/
|
|
157
|
+
getAllStatusesByStorageMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IOrderStatus[] | IError>;
|
|
158
|
+
/**
|
|
159
|
+
* Get all refund requests for an order.
|
|
160
|
+
* @handleName getRefunds
|
|
161
|
+
* @param {number} id - Order id. Example: 1.
|
|
162
|
+
* @returns {Promise<IRefundRequest[] | IError>} Returns array of refund requests.
|
|
163
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
164
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/getRefunds getRefunds} documentation.
|
|
165
|
+
*/
|
|
166
|
+
getRefunds(id: number): Promise<IRefundRequest[] | IError>;
|
|
167
|
+
/**
|
|
168
|
+
* Create a refund request for an order.
|
|
169
|
+
* @handleName createRefundRequest
|
|
170
|
+
* @param {number} id - Order id. Example: 1.
|
|
171
|
+
* @param {ICreateRefundRequest} body - Refund request body.
|
|
172
|
+
* @returns {Promise<boolean | IError>} Returns true if the refund request was created successfully.
|
|
173
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
174
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/createRefundRequest createRefundRequest} documentation.
|
|
175
|
+
*/
|
|
176
|
+
createRefundRequest(id: number, body: ICreateRefundRequest): Promise<boolean | IError>;
|
|
177
|
+
/**
|
|
178
|
+
* Cancel a refund request for an order.
|
|
179
|
+
* @handleName cancelRefundRequest
|
|
180
|
+
* @param {number} id - Order id. Example: 1.
|
|
181
|
+
* @returns {Promise<boolean | IError>} Returns true if the refund request was cancelled successfully.
|
|
182
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
183
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/orders/cancelRefundRequest cancelRefundRequest} documentation.
|
|
184
|
+
*/
|
|
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>;
|
|
200
|
+
/**
|
|
201
|
+
* Runs a fetch against the `/orders` base URL instead of the default
|
|
202
|
+
* `/orders-storage`, then restores the original URL.
|
|
203
|
+
*
|
|
204
|
+
* Refund endpoints live under `/api/content/orders`, while this class is based
|
|
205
|
+
* on `/api/content/orders-storage`. The helper swaps `_url` for the duration of
|
|
206
|
+
* the call and restores it in `finally`, so the base URL is restored even if
|
|
207
|
+
* the request throws.
|
|
208
|
+
* @param {() => Promise<T>} fetcher - Thunk performing the fetch call.
|
|
209
|
+
* @returns {Promise<T>} The fetcher result.
|
|
210
|
+
* @template T
|
|
211
|
+
*/
|
|
212
|
+
private _withOrdersUrl;
|
|
213
|
+
}
|