oneentry 1.0.142 → 1.0.143
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/dist/admins/adminsApi.d.ts +50 -0
- package/dist/admins/adminsApi.js +65 -0
- package/dist/admins/adminsInterfaces.d.ts +98 -0
- package/dist/admins/adminsInterfaces.js +2 -0
- package/dist/admins/adminsSchemas.d.ts +30 -0
- package/dist/admins/adminsSchemas.js +27 -0
- package/dist/attribute-sets/attributeSetsApi.d.ts +63 -0
- package/dist/attribute-sets/attributeSetsApi.js +98 -0
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +185 -0
- package/dist/attribute-sets/attributeSetsInterfaces.js +2 -0
- package/dist/attribute-sets/attributeSetsSchemas.d.ts +90 -0
- package/dist/attribute-sets/attributeSetsSchemas.js +74 -0
- package/dist/auth-provider/authProviderApi.d.ts +249 -0
- package/dist/auth-provider/authProviderApi.js +354 -0
- package/dist/auth-provider/authProviderSchemas.d.ts +131 -0
- package/dist/auth-provider/authProviderSchemas.js +82 -0
- package/dist/auth-provider/authProvidersInterfaces.d.ts +412 -0
- package/dist/auth-provider/authProvidersInterfaces.js +2 -0
- package/dist/base/asyncModules.d.ts +80 -0
- package/dist/base/asyncModules.js +448 -0
- package/dist/base/result.d.ts +39 -0
- package/dist/base/result.js +154 -0
- package/dist/base/stateModule.d.ts +41 -0
- package/dist/base/stateModule.js +128 -0
- package/dist/base/syncModules.d.ts +286 -0
- package/dist/base/syncModules.js +716 -0
- package/dist/base/utils.d.ts +197 -0
- package/dist/base/utils.js +2 -0
- package/dist/base/validation.d.ts +118 -0
- package/dist/base/validation.js +132 -0
- package/dist/blocks/blocksApi.d.ts +76 -0
- package/dist/blocks/blocksApi.js +188 -0
- package/dist/blocks/blocksInterfaces.d.ts +168 -0
- package/dist/blocks/blocksInterfaces.js +2 -0
- package/dist/blocks/blocksSchemas.d.ts +195 -0
- package/dist/blocks/blocksSchemas.js +43 -0
- package/dist/discounts/discountsApi.d.ts +56 -0
- package/dist/discounts/discountsApi.js +82 -0
- package/dist/discounts/discountsInterfaces.d.ts +145 -0
- package/dist/discounts/discountsInterfaces.js +2 -0
- package/dist/events/eventsApi.d.ts +60 -0
- package/dist/events/eventsApi.js +97 -0
- package/dist/events/eventsInterfaces.d.ts +87 -0
- package/dist/events/eventsInterfaces.js +2 -0
- package/dist/file-uploading/fileUploadingApi.d.ts +88 -0
- package/dist/file-uploading/fileUploadingApi.js +129 -0
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +114 -0
- package/dist/file-uploading/fileUploadingInterfaces.js +2 -0
- package/dist/file-uploading/fileUploadingSchemas.d.ts +22 -0
- package/dist/file-uploading/fileUploadingSchemas.js +21 -0
- package/dist/forms/formsApi.d.ts +42 -0
- package/dist/forms/formsApi.js +57 -0
- package/dist/forms/formsInterfaces.d.ts +134 -0
- package/dist/forms/formsInterfaces.js +2 -0
- package/dist/forms/formsSchemas.d.ts +50 -0
- package/dist/forms/formsSchemas.js +31 -0
- package/dist/forms-data/formsDataApi.d.ts +106 -0
- package/dist/forms-data/formsDataApi.js +189 -0
- package/dist/forms-data/formsDataInterfaces.d.ts +522 -0
- package/dist/forms-data/formsDataInterfaces.js +2 -0
- package/dist/forms-data/formsDataSchemas.d.ts +115 -0
- package/dist/forms-data/formsDataSchemas.js +86 -0
- package/dist/general-types/generalTypesApi.d.ts +28 -0
- package/dist/general-types/generalTypesApi.js +38 -0
- package/dist/general-types/generalTypesInterfaces.d.ts +29 -0
- package/dist/general-types/generalTypesInterfaces.js +2 -0
- package/dist/general-types/generalTypesSchemas.d.ts +50 -0
- package/dist/general-types/generalTypesSchemas.js +35 -0
- package/dist/index.d.ts +100 -0
- package/dist/index.js +103 -0
- package/dist/integration-collections/integrationCollectionsApi.d.ts +163 -0
- package/dist/integration-collections/integrationCollectionsApi.js +220 -0
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +313 -0
- package/dist/integration-collections/integrationCollectionsInterfaces.js +2 -0
- package/dist/integration-collections/integrationCollectionsSchemas.d.ts +80 -0
- package/dist/integration-collections/integrationCollectionsSchemas.js +61 -0
- package/dist/locales/localesApi.d.ts +27 -0
- package/dist/locales/localesApi.js +37 -0
- package/dist/locales/localesInterfaces.d.ts +40 -0
- package/dist/locales/localesInterfaces.js +2 -0
- package/dist/locales/localesSchemas.d.ts +32 -0
- package/dist/locales/localesSchemas.js +26 -0
- package/dist/menus/menusApi.d.ts +29 -0
- package/dist/menus/menusApi.js +39 -0
- package/dist/menus/menusInterfaces.d.ts +87 -0
- package/dist/menus/menusInterfaces.js +3 -0
- package/dist/menus/menusSchemas.d.ts +16 -0
- package/dist/menus/menusSchemas.js +28 -0
- package/dist/orders/ordersApi.d.ts +149 -0
- package/dist/orders/ordersApi.js +203 -0
- package/dist/orders/ordersInterfaces.d.ts +520 -0
- package/dist/orders/ordersInterfaces.js +2 -0
- package/dist/orders/ordersSchemas.d.ts +120 -0
- package/dist/orders/ordersSchemas.js +101 -0
- package/dist/pages/pagesApi.d.ts +151 -0
- package/dist/pages/pagesApi.js +390 -0
- package/dist/pages/pagesInterfaces.d.ts +284 -0
- package/dist/pages/pagesInterfaces.js +2 -0
- package/dist/pages/pagesSchemas.d.ts +85 -0
- package/dist/pages/pagesSchemas.js +46 -0
- package/dist/payments/paymentsApi.d.ts +82 -0
- package/dist/payments/paymentsApi.js +121 -0
- package/dist/payments/paymentsInterfaces.d.ts +200 -0
- package/dist/payments/paymentsInterfaces.js +2 -0
- package/dist/payments/paymentsSchemas.d.ts +100 -0
- package/dist/payments/paymentsSchemas.js +65 -0
- package/dist/product-statuses/productStatusesApi.d.ts +47 -0
- package/dist/product-statuses/productStatusesApi.js +70 -0
- package/dist/product-statuses/productStatusesInterfaces.d.ts +62 -0
- package/dist/product-statuses/productStatusesInterfaces.js +2 -0
- package/dist/product-statuses/productStatusesSchemas.d.ts +34 -0
- package/dist/product-statuses/productStatusesSchemas.js +30 -0
- package/dist/products/productsApi.d.ts +365 -0
- package/dist/products/productsApi.js +459 -0
- package/dist/products/productsInterfaces.d.ts +577 -0
- package/dist/products/productsInterfaces.js +2 -0
- package/dist/products/productsSchemas.d.ts +200 -0
- package/dist/products/productsSchemas.js +98 -0
- package/dist/sitemap/sitemapApi.d.ts +35 -0
- package/dist/sitemap/sitemapApi.js +45 -0
- package/dist/sitemap/sitemapInterfaces.d.ts +40 -0
- package/dist/sitemap/sitemapInterfaces.js +2 -0
- package/dist/system/systemApi.d.ts +43 -0
- package/dist/system/systemApi.js +56 -0
- package/dist/system/systemInterfaces.d.ts +29 -0
- package/dist/system/systemInterfaces.js +2 -0
- package/dist/templates/templatesApi.d.ts +49 -0
- package/dist/templates/templatesApi.js +75 -0
- package/dist/templates/templatesInterfaces.d.ts +67 -0
- package/dist/templates/templatesInterfaces.js +2 -0
- package/dist/templates/templatesSchemas.d.ts +48 -0
- package/dist/templates/templatesSchemas.js +31 -0
- package/dist/templates-preview/templatesPreviewApi.d.ts +38 -0
- package/dist/templates-preview/templatesPreviewApi.js +53 -0
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +119 -0
- package/dist/templates-preview/templatesPreviewInterfaces.js +2 -0
- package/dist/templates-preview/templatesPreviewSchemas.d.ts +83 -0
- package/dist/templates-preview/templatesPreviewSchemas.js +48 -0
- package/dist/users/usersApi.d.ts +143 -0
- package/dist/users/usersApi.js +171 -0
- package/dist/users/usersInterfaces.d.ts +229 -0
- package/dist/users/usersInterfaces.js +2 -0
- package/dist/users/usersSchemas.d.ts +38 -0
- package/dist/users/usersSchemas.js +28 -0
- package/dist/web-socket/wsApi.d.ts +25 -0
- package/dist/web-socket/wsApi.js +45 -0
- package/dist/web-socket/wsInterfaces.d.ts +16 -0
- package/dist/web-socket/wsInterfaces.js +2 -0
- package/package.json +3 -81
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules';
|
|
2
|
+
import type StateModule from '../base/stateModule';
|
|
3
|
+
import type { IError } from '../base/utils';
|
|
4
|
+
import type { ILocalEntity, ILocales } from './localesInterfaces';
|
|
5
|
+
/**
|
|
6
|
+
* Controllers for working with localizations (content language)
|
|
7
|
+
* @handle /api/content/locales
|
|
8
|
+
* @description Controllers for working with localizations (content language)
|
|
9
|
+
*/
|
|
10
|
+
export default class LocalesApi extends AsyncModules implements ILocales {
|
|
11
|
+
protected state: StateModule;
|
|
12
|
+
protected _url: string;
|
|
13
|
+
/**
|
|
14
|
+
* Constructor
|
|
15
|
+
* @param {StateModule} state - StateModule instance
|
|
16
|
+
* @description Constructor initializes the LocalesApi with a given state.
|
|
17
|
+
*/
|
|
18
|
+
constructor(state: StateModule);
|
|
19
|
+
/**
|
|
20
|
+
* Find all active language localization objects.
|
|
21
|
+
* @handleName getLocales
|
|
22
|
+
* @returns {Promise<ILocalEntity[] | IError>} Returns an array of LocaleEntity objects.
|
|
23
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
24
|
+
* @description Find all active language localization objects.
|
|
25
|
+
*/
|
|
26
|
+
getLocales(): Promise<Array<ILocalEntity> | IError>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
|
+
const localesSchemas_1 = require("./localesSchemas");
|
|
8
|
+
/**
|
|
9
|
+
* Controllers for working with localizations (content language)
|
|
10
|
+
* @handle /api/content/locales
|
|
11
|
+
* @description Controllers for working with localizations (content language)
|
|
12
|
+
*/
|
|
13
|
+
class LocalesApi extends asyncModules_1.default {
|
|
14
|
+
/**
|
|
15
|
+
* Constructor
|
|
16
|
+
* @param {StateModule} state - StateModule instance
|
|
17
|
+
* @description Constructor initializes the LocalesApi with a given state.
|
|
18
|
+
*/
|
|
19
|
+
constructor(state) {
|
|
20
|
+
super(state);
|
|
21
|
+
this._url = state.url + '/api/content/locales';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Find all active language localization objects.
|
|
25
|
+
* @handleName getLocales
|
|
26
|
+
* @returns {Promise<ILocalEntity[] | IError>} Returns an array of LocaleEntity objects.
|
|
27
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
28
|
+
* @description Find all active language localization objects.
|
|
29
|
+
*/
|
|
30
|
+
async getLocales() {
|
|
31
|
+
const result = await this._fetchGet('/active/all');
|
|
32
|
+
// Validate response if validation is enabled
|
|
33
|
+
const validated = this._validateResponse(result, localesSchemas_1.LocalesResponseSchema);
|
|
34
|
+
return validated;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = LocalesApi;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { IError } from '../base/utils';
|
|
2
|
+
/**
|
|
3
|
+
* The `ILocales` interface defines methods for working with language localization objects in the system.
|
|
4
|
+
* @interface ILocales
|
|
5
|
+
* @description This interface defines a method for retrieving all active language localization objects in the system.
|
|
6
|
+
*/
|
|
7
|
+
interface ILocales {
|
|
8
|
+
/**
|
|
9
|
+
* Find all active language localization objects.
|
|
10
|
+
* @handleName getLocales
|
|
11
|
+
* @returns {ILocalEntity[]} Returns an array of LocaleEntity objects.
|
|
12
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
13
|
+
* @description This method finds all active language localization objects.
|
|
14
|
+
*/
|
|
15
|
+
getLocales(): Promise<ILocalEntity[] | IError>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The `ILocalEntity` interface defines the structure of a locales entity, including its identifiers, name, and other properties.
|
|
19
|
+
* @interface ILocalEntity
|
|
20
|
+
* @property {number} id - The unique identifier of the locales. Example: 1.
|
|
21
|
+
* @property {string} shortCode - The shortCode of locales. Example: "en".
|
|
22
|
+
* @property {string} code - The full language code. Example: "en_US".
|
|
23
|
+
* @property {string} name - The language name. Example: "English".
|
|
24
|
+
* @property {string} nativeName - The native language name. Example: "English".
|
|
25
|
+
* @property {boolean} isActive - Active language flag. Example: true.
|
|
26
|
+
* @property {string | null} image - The language image. Example: "https://example.com/images/en.png".
|
|
27
|
+
* @property {number} position - The language position. Example: 1.
|
|
28
|
+
* @description This interface defines the structure of a locales entity, including its identifiers, name, and other properties.
|
|
29
|
+
*/
|
|
30
|
+
interface ILocalEntity {
|
|
31
|
+
id: number;
|
|
32
|
+
shortCode: string;
|
|
33
|
+
code: string;
|
|
34
|
+
name: string;
|
|
35
|
+
nativeName: string;
|
|
36
|
+
isActive: boolean;
|
|
37
|
+
image: string | null;
|
|
38
|
+
position: number;
|
|
39
|
+
}
|
|
40
|
+
export type { ILocalEntity, ILocales };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation schemas for Locales module
|
|
3
|
+
* @description Zod schemas for validating locales-related API responses
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* Locale entity schema
|
|
8
|
+
* Includes all fields returned by the API
|
|
9
|
+
*/
|
|
10
|
+
export declare const LocaleEntitySchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodNumber;
|
|
12
|
+
shortCode: z.ZodString;
|
|
13
|
+
code: z.ZodString;
|
|
14
|
+
name: z.ZodString;
|
|
15
|
+
nativeName: z.ZodString;
|
|
16
|
+
isActive: z.ZodBoolean;
|
|
17
|
+
image: z.ZodNullable<z.ZodString>;
|
|
18
|
+
position: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
/**
|
|
21
|
+
* Locales response schema (array of locales)
|
|
22
|
+
*/
|
|
23
|
+
export declare const LocalesResponseSchema: z.ZodArray<z.ZodObject<{
|
|
24
|
+
id: z.ZodNumber;
|
|
25
|
+
shortCode: z.ZodString;
|
|
26
|
+
code: z.ZodString;
|
|
27
|
+
name: z.ZodString;
|
|
28
|
+
nativeName: z.ZodString;
|
|
29
|
+
isActive: z.ZodBoolean;
|
|
30
|
+
image: z.ZodNullable<z.ZodString>;
|
|
31
|
+
position: z.ZodNumber;
|
|
32
|
+
}, z.core.$strip>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LocalesResponseSchema = exports.LocaleEntitySchema = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Validation schemas for Locales module
|
|
6
|
+
* @description Zod schemas for validating locales-related API responses
|
|
7
|
+
*/
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
/**
|
|
10
|
+
* Locale entity schema
|
|
11
|
+
* Includes all fields returned by the API
|
|
12
|
+
*/
|
|
13
|
+
exports.LocaleEntitySchema = zod_1.z.object({
|
|
14
|
+
id: zod_1.z.number(),
|
|
15
|
+
shortCode: zod_1.z.string(),
|
|
16
|
+
code: zod_1.z.string(),
|
|
17
|
+
name: zod_1.z.string(),
|
|
18
|
+
nativeName: zod_1.z.string(),
|
|
19
|
+
isActive: zod_1.z.boolean(),
|
|
20
|
+
image: zod_1.z.string().nullable(),
|
|
21
|
+
position: zod_1.z.number(),
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Locales response schema (array of locales)
|
|
25
|
+
*/
|
|
26
|
+
exports.LocalesResponseSchema = zod_1.z.array(exports.LocaleEntitySchema);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules';
|
|
2
|
+
import type StateModule from '../base/stateModule';
|
|
3
|
+
import type { IError } from '../base/utils';
|
|
4
|
+
import type { IMenus, IMenusEntity } from './menusInterfaces';
|
|
5
|
+
/**
|
|
6
|
+
* Controllers for working with menu objects
|
|
7
|
+
* @handle /api/content/menus
|
|
8
|
+
* @description Controllers for working with menu objects
|
|
9
|
+
*/
|
|
10
|
+
export default class MenusApi extends AsyncModules implements IMenus {
|
|
11
|
+
protected state: StateModule;
|
|
12
|
+
protected _url: string;
|
|
13
|
+
/**
|
|
14
|
+
* Constructor initializes the MenusApi with a given state.
|
|
15
|
+
* @param {StateModule} state - The state module.
|
|
16
|
+
* @description Constructor initializes the MenusApi with a given state.
|
|
17
|
+
*/
|
|
18
|
+
constructor(state: StateModule);
|
|
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
|
+
*/
|
|
28
|
+
getMenusByMarker(marker: string, langCode?: string): Promise<IMenusEntity | IError>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
7
|
+
const menusSchemas_1 = require("./menusSchemas");
|
|
8
|
+
/**
|
|
9
|
+
* Controllers for working with menu objects
|
|
10
|
+
* @handle /api/content/menus
|
|
11
|
+
* @description Controllers for working with menu objects
|
|
12
|
+
*/
|
|
13
|
+
class MenusApi extends asyncModules_1.default {
|
|
14
|
+
/**
|
|
15
|
+
* Constructor initializes the MenusApi with a given state.
|
|
16
|
+
* @param {StateModule} state - The state module.
|
|
17
|
+
* @description Constructor initializes the MenusApi with a given state.
|
|
18
|
+
*/
|
|
19
|
+
constructor(state) {
|
|
20
|
+
super(state);
|
|
21
|
+
this._url = state.url + '/api/content/menus';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get pages includes in menu by marker.
|
|
25
|
+
* @handleName getMenusByMarker
|
|
26
|
+
* @param {string} marker - Menu marker. Example: "main_menu".
|
|
27
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
28
|
+
* @returns {Promise<IMenusEntity | IError>} Returns a single menu object as a ContentMenu object with included pages.
|
|
29
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
30
|
+
* @description Get pages includes in menu by marker.
|
|
31
|
+
*/
|
|
32
|
+
async getMenusByMarker(marker, langCode = this.state.lang) {
|
|
33
|
+
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
34
|
+
// Validate response if validation is enabled
|
|
35
|
+
const validated = this._validateResponse(result, menusSchemas_1.MenuEntitySchema);
|
|
36
|
+
return this._dataPostProcess(validated, langCode);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.default = MenusApi;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { IAttributeValues, IError, ILocalizeInfo } from '../base/utils';
|
|
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[] | 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,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MenuEntitySchema = exports.MenusPagesSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Menu pages schema (recursive)
|
|
7
|
+
* Can have children that are also menu pages
|
|
8
|
+
*/
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
exports.MenusPagesSchema = zod_1.z.lazy(() => zod_1.z.object({
|
|
11
|
+
children: zod_1.z.union([zod_1.z.array(exports.MenusPagesSchema), exports.MenusPagesSchema]).optional(),
|
|
12
|
+
id: zod_1.z.number().nullable(),
|
|
13
|
+
pageUrl: zod_1.z.string().nullable(),
|
|
14
|
+
localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
15
|
+
attributeValues: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
16
|
+
position: zod_1.z.number(),
|
|
17
|
+
parentId: zod_1.z.number().nullable(),
|
|
18
|
+
}));
|
|
19
|
+
/**
|
|
20
|
+
* Menu entity schema
|
|
21
|
+
* Includes all fields returned by the API
|
|
22
|
+
*/
|
|
23
|
+
exports.MenuEntitySchema = zod_1.z.object({
|
|
24
|
+
id: zod_1.z.number(),
|
|
25
|
+
identifier: zod_1.z.string(),
|
|
26
|
+
localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
27
|
+
pages: zod_1.z.union([zod_1.z.array(exports.MenusPagesSchema), exports.MenusPagesSchema]),
|
|
28
|
+
});
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules';
|
|
2
|
+
import type StateModule from '../base/stateModule';
|
|
3
|
+
import type { IError } from '../base/utils';
|
|
4
|
+
import type { IBaseOrdersEntity, ICreateOrderPreview, IOrderByMarkerEntity, IOrderData, IOrderPreviewResponse, IOrdersApi, IOrdersByMarkerEntity, IOrdersEntity, IOrderStatus } from './ordersInterfaces';
|
|
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
|
+
/**
|
|
15
|
+
* Constructs an instance of the OrdersApi class.
|
|
16
|
+
* @param {StateModule} state - The state module containing the necessary information for making API calls.
|
|
17
|
+
* @description Constructor initializes the OrdersApi with a given state.
|
|
18
|
+
*/
|
|
19
|
+
constructor(state: StateModule);
|
|
20
|
+
/**
|
|
21
|
+
* Getting all the order storage objects.
|
|
22
|
+
* @handleName getAllOrdersStorage
|
|
23
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
24
|
+
* @param {number} [offset] - Optional parameter for pagination. Default: 0.
|
|
25
|
+
* @param {number} [limit] - Optional parameter for pagination. Default: 30.
|
|
26
|
+
* @returns {Promise<IOrdersEntity[] | IError>} Returns an array of order storage objects.
|
|
27
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
28
|
+
* @description This method requires user authorization.
|
|
29
|
+
* @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}.
|
|
30
|
+
*/
|
|
31
|
+
getAllOrdersStorage(langCode?: string, offset?: number, limit?: number): Promise<IOrdersEntity[] | IError>;
|
|
32
|
+
/**
|
|
33
|
+
* Getting all orders from the orders storage object created by the user.
|
|
34
|
+
* @handleName getAllOrdersByMarker
|
|
35
|
+
* @param {string} marker - Textual identifier of the order storage object. Example: "order_storage_1".
|
|
36
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
37
|
+
* @param {number} [offset] - Offset parameter. Default: 0.
|
|
38
|
+
* @param {number} [limit] - Limit parameter. Default: 30.
|
|
39
|
+
* @returns {Promise<IOrdersByMarkerEntity | IError>} Returns an object with the orders.
|
|
40
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
41
|
+
* @description This method requires user authorization.
|
|
42
|
+
* @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}.
|
|
43
|
+
*/
|
|
44
|
+
getAllOrdersByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IOrdersByMarkerEntity | IError>;
|
|
45
|
+
/**
|
|
46
|
+
* Retrieve one order storage object by marker.
|
|
47
|
+
* @handleName getOrdersStorageByMarker
|
|
48
|
+
* @param {string} marker - Marker of the order object. Example: "order_storage_1".
|
|
49
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
50
|
+
* @returns {Promise<IOrdersEntity | IError>} Return object of order information.
|
|
51
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
52
|
+
* @description This method requires user authorization.
|
|
53
|
+
* @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}.
|
|
54
|
+
*/
|
|
55
|
+
getOrdersStorageByMarker(marker: string, langCode?: string): Promise<IOrdersEntity | IError>;
|
|
56
|
+
/**
|
|
57
|
+
* Getting a single order from the order storage object created by the user.
|
|
58
|
+
* @handleName getOrderByMarkerAndId
|
|
59
|
+
* @param {string} marker - The text identifier of the order storage object. Example: "order_storage_1".
|
|
60
|
+
* @param {number} id - ID of the order object. Example: 12345.
|
|
61
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
62
|
+
* @returns {Promise<IOrderByMarkerEntity | IError>} Returns an object with the order.
|
|
63
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
64
|
+
* @description This method requires user authorization.
|
|
65
|
+
* @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}.
|
|
66
|
+
*/
|
|
67
|
+
getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<IOrderByMarkerEntity | IError>;
|
|
68
|
+
/**
|
|
69
|
+
* Preview order calculation with discounts and coupons (without saving).
|
|
70
|
+
* @handleName previewOrder
|
|
71
|
+
* @param {ICreateOrderPreview} body - Order preview body.
|
|
72
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
73
|
+
* @returns {Promise<IOrderPreviewResponse | IError>} Returns an object with the order preview.
|
|
74
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
75
|
+
* @description This method requires user authorization ???.
|
|
76
|
+
* @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}.
|
|
77
|
+
*/
|
|
78
|
+
previewOrder(body: ICreateOrderPreview, langCode?: string): Promise<IOrderPreviewResponse | IError>;
|
|
79
|
+
/**
|
|
80
|
+
* Creation of an order in the order storage.
|
|
81
|
+
* @handleName createOrder
|
|
82
|
+
* @param {string} marker - Textual identifier of the order storage object. Example: "order_storage_1".
|
|
83
|
+
* @param {IOrderData} body - Object for creating an order.
|
|
84
|
+
* @example
|
|
85
|
+
{
|
|
86
|
+
"formIdentifier": "bar-orders-form",
|
|
87
|
+
"paymentAccountIdentifier": "usd-payment",
|
|
88
|
+
"formData": {
|
|
89
|
+
"marker": "name_1",
|
|
90
|
+
"value": "Name",
|
|
91
|
+
"type": "string"
|
|
92
|
+
},
|
|
93
|
+
"products": [
|
|
94
|
+
{
|
|
95
|
+
"productId": 1,
|
|
96
|
+
"quantity": 2
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
101
|
+
* @returns {Promise<IBaseOrdersEntity | IError>} Returns an object with the created order.
|
|
102
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
103
|
+
* @description This method requires user authorization.
|
|
104
|
+
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
105
|
+
*/
|
|
106
|
+
createOrder(marker: string, body: IOrderData, langCode?: string): Promise<IBaseOrdersEntity | IError>;
|
|
107
|
+
/**
|
|
108
|
+
* Changing an order in the orders storage
|
|
109
|
+
* @handleName updateOrderByMarkerAndId
|
|
110
|
+
* @param {string} marker - The text identifier of the order storage object. Example: "order_storage_1".
|
|
111
|
+
* @param {number} id - ID of the order object. Example: 12345.
|
|
112
|
+
* @param {IOrderData} body - Object for updating an order.
|
|
113
|
+
* @example
|
|
114
|
+
{
|
|
115
|
+
"formIdentifier": "bar-orders-form",
|
|
116
|
+
"paymentAccountIdentifier": "usd-payment",
|
|
117
|
+
"formData": {
|
|
118
|
+
"marker": "name_1",
|
|
119
|
+
"value": "Name",
|
|
120
|
+
"type": "string"
|
|
121
|
+
},
|
|
122
|
+
"products": [
|
|
123
|
+
{
|
|
124
|
+
"productId": 1,
|
|
125
|
+
"quantity": 2
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
"currency": "USD"
|
|
129
|
+
}
|
|
130
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
131
|
+
* @returns {Promise<IBaseOrdersEntity | IError>} Returns an object with the updated order.
|
|
132
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
133
|
+
* @description This method requires user authorization.
|
|
134
|
+
* @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}.
|
|
135
|
+
*/
|
|
136
|
+
updateOrderByMarkerAndId(marker: string, id: number, body: IOrderData, langCode?: string): Promise<IBaseOrdersEntity | IError>;
|
|
137
|
+
/**
|
|
138
|
+
* Get all orders statuses by Storage marker
|
|
139
|
+
* @handleName getAllStatusesByStorageMarker
|
|
140
|
+
* @param {string} marker - Textual identifier of the order storage object. Example: "order_storage_1".
|
|
141
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
142
|
+
* @param {number} [offset] - Offset parameter. Default: 0.
|
|
143
|
+
* @param {number} [limit] - Limit parameter. Default: 30.
|
|
144
|
+
* @returns {Promise<IOrderStatus[] | IError>} Returns an object with the orders statuses.
|
|
145
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
146
|
+
* @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}.
|
|
147
|
+
*/
|
|
148
|
+
getAllStatusesByStorageMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IOrderStatus[] | IError>;
|
|
149
|
+
}
|