oneentry 1.0.126 → 1.0.128
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 +0 -2
- package/configure.js +25 -18
- package/dist/admins/adminsApi.d.ts +18 -13
- package/dist/admins/adminsApi.js +18 -13
- package/dist/admins/adminsInterfaces.d.ts +16 -25
- package/dist/attribute-sets/attributeSetsApi.d.ts +14 -15
- package/dist/attribute-sets/attributeSetsApi.js +14 -15
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +78 -84
- package/dist/auth-provider/authProviderApi.d.ts +53 -79
- package/dist/auth-provider/authProviderApi.js +52 -78
- package/dist/auth-provider/authProvidersInterfaces.d.ts +98 -94
- package/dist/base/asyncModules.d.ts +23 -21
- package/dist/base/asyncModules.js +39 -29
- package/dist/base/result.d.ts +31 -0
- package/dist/base/result.js +32 -5
- package/dist/base/stateModule.d.ts +10 -0
- package/dist/base/stateModule.js +50 -2
- package/dist/base/syncModules.d.ts +42 -50
- package/dist/base/syncModules.js +106 -58
- package/dist/base/utils.d.ts +33 -2
- package/dist/blocks/blocksApi.d.ts +9 -18
- package/dist/blocks/blocksApi.js +9 -18
- package/dist/blocks/blocksInterfaces.d.ts +41 -46
- package/dist/config.d.ts +13 -0
- package/dist/config.js +30 -0
- package/dist/events/eventsApi.d.ts +10 -27
- package/dist/events/eventsApi.js +26 -40
- package/dist/events/eventsInterfaces.d.ts +33 -28
- package/dist/file-uploading/fileUploadingApi.d.ts +12 -17
- package/dist/file-uploading/fileUploadingApi.js +14 -17
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +8 -19
- package/dist/forms/formsApi.d.ts +10 -9
- package/dist/forms/formsApi.js +10 -9
- package/dist/forms/formsInterfaces.d.ts +20 -12
- package/dist/forms-data/formsDataApi.d.ts +24 -28
- package/dist/forms-data/formsDataApi.js +25 -28
- package/dist/forms-data/formsDataInterfaces.d.ts +71 -71
- package/dist/general-types/generalTypesApi.d.ts +5 -5
- package/dist/general-types/generalTypesApi.js +5 -5
- package/dist/general-types/generalTypesInterfaces.d.ts +5 -8
- package/dist/index.d.ts +3 -4
- package/dist/index.js +3 -4
- package/dist/integration-collections/integrationCollectionsApi.d.ts +29 -47
- package/dist/integration-collections/integrationCollectionsApi.js +31 -51
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +62 -58
- package/dist/locales/localesApi.d.ts +7 -3
- package/dist/locales/localesApi.js +7 -3
- package/dist/locales/localesInterfaces.d.ts +6 -5
- package/dist/menus/menusApi.d.ts +7 -3
- package/dist/menus/menusApi.js +7 -3
- package/dist/menus/menusInterfaces.d.ts +5 -10
- package/dist/menus/menusInterfaces.js +1 -0
- package/dist/orders/ordersApi.d.ts +17 -25
- package/dist/orders/ordersApi.js +17 -26
- package/dist/orders/ordersInterfaces.d.ts +94 -53
- package/dist/pages/pagesApi.d.ts +47 -60
- package/dist/pages/pagesApi.js +51 -61
- package/dist/pages/pagesInterfaces.d.ts +44 -48
- package/dist/payments/paymentsApi.d.ts +17 -27
- package/dist/payments/paymentsApi.js +17 -31
- package/dist/payments/paymentsInterfaces.d.ts +35 -29
- package/dist/product-statuses/productStatusesApi.d.ts +9 -9
- package/dist/product-statuses/productStatusesApi.js +9 -9
- package/dist/product-statuses/productStatusesInterfaces.d.ts +14 -12
- package/dist/products/productsApi.d.ts +23 -44
- package/dist/products/productsApi.js +24 -44
- package/dist/products/productsInterfaces.d.ts +51 -57
- package/dist/system/systemApi.d.ts +11 -13
- package/dist/system/systemApi.js +12 -13
- package/dist/system/systemInterfaces.d.ts +14 -3
- package/dist/templates/templatesApi.d.ts +8 -11
- package/dist/templates/templatesApi.js +8 -11
- package/dist/templates/templatesInterfaces.d.ts +13 -12
- package/dist/templates-preview/templatesPreviewApi.d.ts +7 -8
- package/dist/templates-preview/templatesPreviewApi.js +7 -8
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +15 -18
- package/dist/users/usersApi.d.ts +13 -20
- package/dist/users/usersApi.js +13 -20
- package/dist/users/usersInterfaces.d.ts +26 -30
- package/dist/web-socket/wsApi.d.ts +5 -3
- package/dist/web-socket/wsApi.js +6 -3
- package/dist/web-socket/wsInterfaces.d.ts +7 -2
- package/package.json +16 -12
package/dist/pages/pagesApi.d.ts
CHANGED
|
@@ -5,156 +5,143 @@ import type { IPageApi, IPageConfig, IPagesEntity, IPositionBlock } from './page
|
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with page objects, including catalog pages
|
|
7
7
|
* @handle /api/content/pages
|
|
8
|
+
* @description Controllers for working with page objects, including catalog pages
|
|
8
9
|
*/
|
|
9
10
|
export default class PageApi extends AsyncModules implements IPageApi {
|
|
10
11
|
protected state: StateModule;
|
|
11
12
|
protected _url: string;
|
|
13
|
+
/**
|
|
14
|
+
* Constructor
|
|
15
|
+
* @param {StateModule} state - The state module.
|
|
16
|
+
* @description Constructor initializes the PageApi with a given state.
|
|
17
|
+
*/
|
|
12
18
|
constructor(state: StateModule);
|
|
13
19
|
/**
|
|
14
20
|
* Get all top-level page objects.
|
|
15
|
-
*
|
|
16
21
|
* @handleName getRootPages
|
|
17
|
-
*
|
|
18
22
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
19
|
-
* @
|
|
23
|
+
* @returns {IPagesEntity[]} Returns all created pages without parents as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
20
24
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
21
25
|
* @description Get all top-level page objects.
|
|
22
26
|
*/
|
|
23
27
|
getRootPages(langCode?: string): Promise<IPagesEntity[] | IError>;
|
|
24
28
|
/**
|
|
25
29
|
* Get all page objects with product information as an array.
|
|
26
|
-
*
|
|
27
30
|
* @handleName getPages
|
|
28
|
-
*
|
|
29
31
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
30
|
-
* @
|
|
32
|
+
* @returns {IPagesEntity[]} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data).
|
|
31
33
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
32
34
|
* @description Get all page objects with product information as an array.
|
|
33
35
|
*/
|
|
34
36
|
getPages(langCode?: string): Promise<IPagesEntity[] | IError>;
|
|
35
37
|
/**
|
|
36
38
|
* Get page object with information about forms, blocks, menus, linked to the page.
|
|
37
|
-
*
|
|
38
39
|
* @handleName getPageById
|
|
39
|
-
*
|
|
40
40
|
* @param {number} id - The unique identifier of the page to be fetched. Example: 1.
|
|
41
41
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
42
|
-
* @
|
|
42
|
+
* @returns {IPagesEntity} Returns PageEntity object
|
|
43
43
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
44
44
|
* @description Get page object with information about forms, blocks, menus, linked to the page.
|
|
45
45
|
*/
|
|
46
46
|
getPageById(id: number, langCode?: string): Promise<IPagesEntity | IError>;
|
|
47
47
|
/**
|
|
48
48
|
* Get page object with information about forms, blocks, menus, linked to the page by URL.
|
|
49
|
-
*
|
|
50
49
|
* @handleName getPageByUrl
|
|
51
|
-
*
|
|
52
50
|
* @param {string} url - Page URL. Example: "about".
|
|
53
51
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
54
|
-
* @
|
|
52
|
+
* @returns {IPagesEntity} Returns PageEntity object
|
|
55
53
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
56
54
|
* @description Get page object with information about forms, blocks, menus, linked to the page by URL.
|
|
57
55
|
*/
|
|
58
56
|
getPageByUrl(url: string, langCode?: string): Promise<IPagesEntity | IError>;
|
|
59
57
|
/**
|
|
60
58
|
* Get child pages object with information as an array.
|
|
61
|
-
*
|
|
62
59
|
* @handleName getChildPagesByParentUrl
|
|
63
|
-
*
|
|
64
60
|
* @param {string} url - The URL of the parent page for which child pages are to be fetched. Example: "about/our-team".
|
|
65
61
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
66
|
-
* @
|
|
62
|
+
* @returns {IPagesEntity} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
|
|
67
63
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
68
64
|
* @description Get child pages object with information as an array.
|
|
69
65
|
*/
|
|
70
66
|
getChildPagesByParentUrl(url: string, langCode?: string): Promise<IPagesEntity[] | IError>;
|
|
71
67
|
/**
|
|
72
68
|
* Get all blocks by page url.
|
|
73
|
-
*
|
|
74
69
|
* @handleName getBlocksByPageUrl
|
|
75
|
-
*
|
|
76
70
|
* @param {string} url - Page URL. Example: "about".
|
|
77
71
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
78
|
-
* @
|
|
72
|
+
* @returns {IPositionBlock[]} Returns all blocks as an array of PositionBlock objects or an empty array [] (if there is no data) for the selected parent
|
|
79
73
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
80
74
|
* @description Get all blocks by page url.
|
|
81
75
|
*/
|
|
82
76
|
getBlocksByPageUrl(url: string, langCode?: string): Promise<IPositionBlock[] | IError>;
|
|
83
77
|
/**
|
|
84
78
|
* Get settings for the page.
|
|
85
|
-
*
|
|
86
79
|
* @handleName getConfigPageByUrl
|
|
87
|
-
*
|
|
88
80
|
* @param {string} url - Page URL. Example: "about".
|
|
89
|
-
* @
|
|
81
|
+
* @returns {IPageConfig} Returns a ConfigPage object with page display settings
|
|
90
82
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
91
83
|
* @description Get settings for the page.
|
|
92
84
|
*/
|
|
93
85
|
getConfigPageByUrl(url: string): Promise<IPageConfig | IError>;
|
|
94
86
|
/**
|
|
95
87
|
* Quick search for page objects with limited output.
|
|
96
|
-
*
|
|
97
88
|
* @handleName searchPage
|
|
98
|
-
*
|
|
99
89
|
* @param {string} name - Text for searching page objects (search is performed on the title field of the localizeInfos object with the language taken into account). Example: "About Us".
|
|
90
|
+
* @param {string} [url] - Page URL. Example: "catalog".
|
|
100
91
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
101
|
-
* @
|
|
92
|
+
* @returns {IPagesEntity[]} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
102
93
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
103
94
|
* @description Quick search for page objects with limited output.
|
|
104
95
|
*/
|
|
105
|
-
searchPage(name: string, langCode?: string): Promise<IPagesEntity[] | IError>;
|
|
96
|
+
searchPage(name: string, url?: string, langCode?: string): Promise<IPagesEntity[] | IError>;
|
|
106
97
|
/**
|
|
107
98
|
* Add template data to pages
|
|
108
|
-
*
|
|
109
99
|
* @handleName addTemplateToPages
|
|
110
|
-
*
|
|
111
100
|
* @param {IPagesEntity[]} data - An array of page objects (IPagesEntity[]) to which template data will be added. Example:
|
|
112
101
|
[
|
|
113
102
|
{
|
|
114
|
-
id: 8,
|
|
115
|
-
parentId: null,
|
|
116
|
-
moduleFormConfigs: [],
|
|
117
|
-
pageUrl:
|
|
118
|
-
depth: 0,
|
|
119
|
-
localizeInfos: {
|
|
120
|
-
title:
|
|
121
|
-
menuTitle:
|
|
122
|
-
htmlContent:
|
|
123
|
-
plainContent:
|
|
124
|
-
},
|
|
125
|
-
isVisible: true,
|
|
126
|
-
forms: [],
|
|
127
|
-
blocks: [],
|
|
128
|
-
type: 'common_page',
|
|
129
|
-
templateIdentifier: 'template',
|
|
130
|
-
attributeSetIdentifier: 'page',
|
|
131
|
-
attributeValues: {},
|
|
132
|
-
isSync: true,
|
|
133
|
-
template: {
|
|
134
|
-
id: 4,
|
|
135
|
-
attributeSetIdentifier: null,
|
|
136
|
-
title: 'Template',
|
|
137
|
-
generalTypeId: 4,
|
|
138
|
-
identifier: 'template',
|
|
139
|
-
version: 0,
|
|
140
|
-
generalTypeName: 'catalog_page',
|
|
141
|
-
attributeValues: {},
|
|
142
|
-
position: 1,
|
|
103
|
+
"id": 8,
|
|
104
|
+
"parentId": null,
|
|
105
|
+
"moduleFormConfigs": [],
|
|
106
|
+
"pageUrl": "blog",
|
|
107
|
+
"depth": 0,
|
|
108
|
+
"localizeInfos": {
|
|
109
|
+
"title": "Blog",
|
|
110
|
+
"menuTitle": "Blog",
|
|
111
|
+
"htmlContent": "",
|
|
112
|
+
"plainContent": "",
|
|
143
113
|
},
|
|
114
|
+
"isVisible": true,
|
|
115
|
+
"forms": [],
|
|
116
|
+
"blocks": [],
|
|
117
|
+
"type": "common_page",
|
|
118
|
+
"templateIdentifier": "template",
|
|
119
|
+
"attributeSetIdentifier": "page",
|
|
120
|
+
"attributeValues": {},
|
|
121
|
+
"isSync": true,
|
|
122
|
+
"template": {
|
|
123
|
+
"id": 4,
|
|
124
|
+
"attributeSetIdentifier": null,
|
|
125
|
+
"title": "Template",
|
|
126
|
+
"generalTypeId": 4,
|
|
127
|
+
"identifier": "template",
|
|
128
|
+
"version": 0,
|
|
129
|
+
"generalTypeName": "catalog_page",
|
|
130
|
+
"attributeValues": {},
|
|
131
|
+
"position": 1,
|
|
132
|
+
}
|
|
144
133
|
}
|
|
145
134
|
]
|
|
146
|
-
* @
|
|
135
|
+
* @returns {any} An array of page objects with template data added
|
|
147
136
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
148
137
|
* @description Add template data to pages
|
|
149
138
|
*/
|
|
150
139
|
protected addTemplateToPages(data: IPagesEntity[]): Promise<any | IError>;
|
|
151
140
|
/**
|
|
152
141
|
* Add template data to page by page templateIdentifier
|
|
153
|
-
*
|
|
154
142
|
* @handleName addTemplateToPage
|
|
155
|
-
*
|
|
156
143
|
* @param {IPagesEntity} data - Page object (IPagesEntity) to which template data will be added.
|
|
157
|
-
* @
|
|
144
|
+
* @returns {any} An array of page objects with template data added
|
|
158
145
|
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
159
146
|
* @description Add template data to page by page templateIdentifier
|
|
160
147
|
*/
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -3,25 +3,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/* eslint-disable jsdoc/reject-any-type */
|
|
6
7
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
8
|
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
9
|
const templatesApi_1 = __importDefault(require("../templates/templatesApi"));
|
|
9
10
|
/**
|
|
10
11
|
* Controllers for working with page objects, including catalog pages
|
|
11
12
|
* @handle /api/content/pages
|
|
13
|
+
* @description Controllers for working with page objects, including catalog pages
|
|
12
14
|
*/
|
|
13
15
|
class PageApi extends asyncModules_1.default {
|
|
16
|
+
/**
|
|
17
|
+
* Constructor
|
|
18
|
+
* @param {StateModule} state - The state module.
|
|
19
|
+
* @description Constructor initializes the PageApi with a given state.
|
|
20
|
+
*/
|
|
14
21
|
constructor(state) {
|
|
15
22
|
super(state);
|
|
16
23
|
this._url = state.url + '/api/content/pages';
|
|
17
24
|
}
|
|
18
25
|
/**
|
|
19
26
|
* Get all top-level page objects.
|
|
20
|
-
*
|
|
21
27
|
* @handleName getRootPages
|
|
22
|
-
*
|
|
23
28
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
24
|
-
* @
|
|
29
|
+
* @returns {IPagesEntity[]} Returns all created pages without parents as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
25
30
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
26
31
|
* @description Get all top-level page objects.
|
|
27
32
|
*/
|
|
@@ -35,11 +40,9 @@ class PageApi extends asyncModules_1.default {
|
|
|
35
40
|
}
|
|
36
41
|
/**
|
|
37
42
|
* Get all page objects with product information as an array.
|
|
38
|
-
*
|
|
39
43
|
* @handleName getPages
|
|
40
|
-
*
|
|
41
44
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
42
|
-
* @
|
|
45
|
+
* @returns {IPagesEntity[]} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data).
|
|
43
46
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
44
47
|
* @description Get all page objects with product information as an array.
|
|
45
48
|
*/
|
|
@@ -53,12 +56,10 @@ class PageApi extends asyncModules_1.default {
|
|
|
53
56
|
}
|
|
54
57
|
/**
|
|
55
58
|
* Get page object with information about forms, blocks, menus, linked to the page.
|
|
56
|
-
*
|
|
57
59
|
* @handleName getPageById
|
|
58
|
-
*
|
|
59
60
|
* @param {number} id - The unique identifier of the page to be fetched. Example: 1.
|
|
60
61
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
61
|
-
* @
|
|
62
|
+
* @returns {IPagesEntity} Returns PageEntity object
|
|
62
63
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
63
64
|
* @description Get page object with information about forms, blocks, menus, linked to the page.
|
|
64
65
|
*/
|
|
@@ -72,12 +73,10 @@ class PageApi extends asyncModules_1.default {
|
|
|
72
73
|
}
|
|
73
74
|
/**
|
|
74
75
|
* Get page object with information about forms, blocks, menus, linked to the page by URL.
|
|
75
|
-
*
|
|
76
76
|
* @handleName getPageByUrl
|
|
77
|
-
*
|
|
78
77
|
* @param {string} url - Page URL. Example: "about".
|
|
79
78
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
80
|
-
* @
|
|
79
|
+
* @returns {IPagesEntity} Returns PageEntity object
|
|
81
80
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
82
81
|
* @description Get page object with information about forms, blocks, menus, linked to the page by URL.
|
|
83
82
|
*/
|
|
@@ -91,12 +90,10 @@ class PageApi extends asyncModules_1.default {
|
|
|
91
90
|
}
|
|
92
91
|
/**
|
|
93
92
|
* Get child pages object with information as an array.
|
|
94
|
-
*
|
|
95
93
|
* @handleName getChildPagesByParentUrl
|
|
96
|
-
*
|
|
97
94
|
* @param {string} url - The URL of the parent page for which child pages are to be fetched. Example: "about/our-team".
|
|
98
95
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
99
|
-
* @
|
|
96
|
+
* @returns {IPagesEntity} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
|
|
100
97
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
101
98
|
* @description Get child pages object with information as an array.
|
|
102
99
|
*/
|
|
@@ -110,12 +107,10 @@ class PageApi extends asyncModules_1.default {
|
|
|
110
107
|
}
|
|
111
108
|
/**
|
|
112
109
|
* Get all blocks by page url.
|
|
113
|
-
*
|
|
114
110
|
* @handleName getBlocksByPageUrl
|
|
115
|
-
*
|
|
116
111
|
* @param {string} url - Page URL. Example: "about".
|
|
117
112
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
118
|
-
* @
|
|
113
|
+
* @returns {IPositionBlock[]} Returns all blocks as an array of PositionBlock objects or an empty array [] (if there is no data) for the selected parent
|
|
119
114
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
120
115
|
* @description Get all blocks by page url.
|
|
121
116
|
*/
|
|
@@ -200,11 +195,9 @@ class PageApi extends asyncModules_1.default {
|
|
|
200
195
|
}
|
|
201
196
|
/**
|
|
202
197
|
* Get settings for the page.
|
|
203
|
-
*
|
|
204
198
|
* @handleName getConfigPageByUrl
|
|
205
|
-
*
|
|
206
199
|
* @param {string} url - Page URL. Example: "about".
|
|
207
|
-
* @
|
|
200
|
+
* @returns {IPageConfig} Returns a ConfigPage object with page display settings
|
|
208
201
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
209
202
|
* @description Get settings for the page.
|
|
210
203
|
*/
|
|
@@ -216,18 +209,18 @@ class PageApi extends asyncModules_1.default {
|
|
|
216
209
|
}
|
|
217
210
|
/**
|
|
218
211
|
* Quick search for page objects with limited output.
|
|
219
|
-
*
|
|
220
212
|
* @handleName searchPage
|
|
221
|
-
*
|
|
222
213
|
* @param {string} name - Text for searching page objects (search is performed on the title field of the localizeInfos object with the language taken into account). Example: "About Us".
|
|
214
|
+
* @param {string} [url] - Page URL. Example: "catalog".
|
|
223
215
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
224
|
-
* @
|
|
216
|
+
* @returns {IPagesEntity[]} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
225
217
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
226
218
|
* @description Quick search for page objects with limited output.
|
|
227
219
|
*/
|
|
228
|
-
async searchPage(name, langCode = this.state.lang) {
|
|
220
|
+
async searchPage(name, url, langCode = this.state.lang) {
|
|
229
221
|
// Fetch data from the server using a GET request to perform a quick search by page name and language code
|
|
230
|
-
const data = await this._fetchGet(`/quick/search
|
|
222
|
+
const data = await this._fetchGet(`/quick/search?${url && 'url=' + url}&lang=${langCode}&name=${name}`);
|
|
223
|
+
// /quick/search?url=catalog&langCode=en_US&name=cat
|
|
231
224
|
// Check if there is no traffic limit set in the state
|
|
232
225
|
if (!this.state.traficLimit) {
|
|
233
226
|
// Initialize an empty array to store detailed page information
|
|
@@ -251,45 +244,43 @@ class PageApi extends asyncModules_1.default {
|
|
|
251
244
|
}
|
|
252
245
|
/**
|
|
253
246
|
* Add template data to pages
|
|
254
|
-
*
|
|
255
247
|
* @handleName addTemplateToPages
|
|
256
|
-
*
|
|
257
248
|
* @param {IPagesEntity[]} data - An array of page objects (IPagesEntity[]) to which template data will be added. Example:
|
|
258
249
|
[
|
|
259
250
|
{
|
|
260
|
-
id: 8,
|
|
261
|
-
parentId: null,
|
|
262
|
-
moduleFormConfigs: [],
|
|
263
|
-
pageUrl:
|
|
264
|
-
depth: 0,
|
|
265
|
-
localizeInfos: {
|
|
266
|
-
title:
|
|
267
|
-
menuTitle:
|
|
268
|
-
htmlContent:
|
|
269
|
-
plainContent:
|
|
270
|
-
},
|
|
271
|
-
isVisible: true,
|
|
272
|
-
forms: [],
|
|
273
|
-
blocks: [],
|
|
274
|
-
type: 'common_page',
|
|
275
|
-
templateIdentifier: 'template',
|
|
276
|
-
attributeSetIdentifier: 'page',
|
|
277
|
-
attributeValues: {},
|
|
278
|
-
isSync: true,
|
|
279
|
-
template: {
|
|
280
|
-
id: 4,
|
|
281
|
-
attributeSetIdentifier: null,
|
|
282
|
-
title: 'Template',
|
|
283
|
-
generalTypeId: 4,
|
|
284
|
-
identifier: 'template',
|
|
285
|
-
version: 0,
|
|
286
|
-
generalTypeName: 'catalog_page',
|
|
287
|
-
attributeValues: {},
|
|
288
|
-
position: 1,
|
|
251
|
+
"id": 8,
|
|
252
|
+
"parentId": null,
|
|
253
|
+
"moduleFormConfigs": [],
|
|
254
|
+
"pageUrl": "blog",
|
|
255
|
+
"depth": 0,
|
|
256
|
+
"localizeInfos": {
|
|
257
|
+
"title": "Blog",
|
|
258
|
+
"menuTitle": "Blog",
|
|
259
|
+
"htmlContent": "",
|
|
260
|
+
"plainContent": "",
|
|
289
261
|
},
|
|
262
|
+
"isVisible": true,
|
|
263
|
+
"forms": [],
|
|
264
|
+
"blocks": [],
|
|
265
|
+
"type": "common_page",
|
|
266
|
+
"templateIdentifier": "template",
|
|
267
|
+
"attributeSetIdentifier": "page",
|
|
268
|
+
"attributeValues": {},
|
|
269
|
+
"isSync": true,
|
|
270
|
+
"template": {
|
|
271
|
+
"id": 4,
|
|
272
|
+
"attributeSetIdentifier": null,
|
|
273
|
+
"title": "Template",
|
|
274
|
+
"generalTypeId": 4,
|
|
275
|
+
"identifier": "template",
|
|
276
|
+
"version": 0,
|
|
277
|
+
"generalTypeName": "catalog_page",
|
|
278
|
+
"attributeValues": {},
|
|
279
|
+
"position": 1,
|
|
280
|
+
}
|
|
290
281
|
}
|
|
291
282
|
]
|
|
292
|
-
* @
|
|
283
|
+
* @returns {any} An array of page objects with template data added
|
|
293
284
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
294
285
|
* @description Add template data to pages
|
|
295
286
|
*/
|
|
@@ -304,11 +295,9 @@ class PageApi extends asyncModules_1.default {
|
|
|
304
295
|
}
|
|
305
296
|
/**
|
|
306
297
|
* Add template data to page by page templateIdentifier
|
|
307
|
-
*
|
|
308
298
|
* @handleName addTemplateToPage
|
|
309
|
-
*
|
|
310
299
|
* @param {IPagesEntity} data - Page object (IPagesEntity) to which template data will be added.
|
|
311
|
-
* @
|
|
300
|
+
* @returns {any} An array of page objects with template data added
|
|
312
301
|
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
313
302
|
* @description Add template data to page by page templateIdentifier
|
|
314
303
|
*/
|
|
@@ -332,6 +321,7 @@ class PageApi extends asyncModules_1.default {
|
|
|
332
321
|
}
|
|
333
322
|
catch (error) {
|
|
334
323
|
// Log any errors that occur during the template fetching process
|
|
324
|
+
// eslint-disable-next-line no-undef, no-console
|
|
335
325
|
console.error('Template fetch error: ', error);
|
|
336
326
|
// Return the original data object unchanged if an error occurs
|
|
337
327
|
return data;
|
|
@@ -1,92 +1,99 @@
|
|
|
1
1
|
import type { IFormConfig } from 'forms/formsInterfaces';
|
|
2
|
+
import type { ITemplateEntity } from 'templates/templatesInterfaces';
|
|
2
3
|
import type { AttributeType, IAttributes, IError, ILocalizeInfo, LangType, Types } from '../base/utils';
|
|
3
4
|
/**
|
|
4
5
|
* @interface IPageApi
|
|
5
|
-
*
|
|
6
|
-
* @property {
|
|
7
|
-
* @property {
|
|
8
|
-
* @property {
|
|
9
|
-
* @property {
|
|
10
|
-
* @property {
|
|
11
|
-
* @property {
|
|
12
|
-
* @property {
|
|
13
|
-
* @property {function} searchPage - Quick search for page objects with limited output.
|
|
6
|
+
* @property {Function} getRootPages - Get all top-level page objects.
|
|
7
|
+
* @property {Function} getCatalogPages - Get all page objects with product information as an array.
|
|
8
|
+
* @property {Function} getPages - Get all page objects with product information as an array.
|
|
9
|
+
* @property {Function} getPageById - Get page object with information about forms, blocks, menus, linked to the page.
|
|
10
|
+
* @property {Function} getPageByUrl - Get page object with information about forms, blocks, menus, linked to the page by URL.
|
|
11
|
+
* @property {Function} getChildPagesByParentUrl - Get child pages object with information as an array.
|
|
12
|
+
* @property {Function} getConfigPageByUrl - Get settings for the page.
|
|
13
|
+
* @property {Function} searchPage - Quick search for page objects with limited output.
|
|
14
14
|
* @description This interface defines methods for retrieving and managing pages in the system.
|
|
15
15
|
*/
|
|
16
16
|
interface IPageApi {
|
|
17
17
|
/**
|
|
18
18
|
* Get all top-level page objects.
|
|
19
|
-
*
|
|
19
|
+
* @handleName getRootPages
|
|
20
20
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
21
|
-
* @
|
|
21
|
+
* @returns {IPagesEntity[]} Returns all created pages without parents as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
22
22
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
23
|
+
* @description This method gets all top-level page objects.
|
|
23
24
|
*/
|
|
24
25
|
getRootPages(langCode?: LangType): Promise<IPagesEntity[] | IError>;
|
|
25
26
|
/**
|
|
26
27
|
* Get all page objects with product information as an array.
|
|
27
|
-
*
|
|
28
|
+
* @handleName getPages
|
|
28
29
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
29
|
-
* @
|
|
30
|
+
* @returns {IPagesEntity[]} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data).
|
|
30
31
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
32
|
+
* @description This method gets all page objects with product information as an array.
|
|
31
33
|
*/
|
|
32
34
|
getPages(langCode?: LangType): Promise<IPagesEntity[] | IError>;
|
|
33
35
|
/**
|
|
34
36
|
* Get page object with information about forms, blocks, menus, linked to the page.
|
|
35
|
-
*
|
|
37
|
+
* @handleName getPageById
|
|
36
38
|
* @param {number} id - The unique identifier of the page to be fetched. Example: 123.
|
|
37
39
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
38
|
-
* @
|
|
40
|
+
* @returns {IPagesEntity} Returns PageEntity object
|
|
39
41
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
42
|
+
* @description This method gets a page object with information about forms, blocks, menus, linked to the page.
|
|
40
43
|
*/
|
|
41
44
|
getPageById(id: number, langCode?: LangType): Promise<IPagesEntity | IError>;
|
|
42
45
|
/**
|
|
43
46
|
* Get page object with information about forms, blocks, menus, linked to the page by URL.
|
|
44
|
-
*
|
|
47
|
+
* @handleName getPageByUrl
|
|
45
48
|
* @param {string} url - Page URL. Example: "about".
|
|
46
49
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
47
|
-
* @
|
|
50
|
+
* @returns {IPagesEntity} Returns PageEntity object
|
|
48
51
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
52
|
+
* @description This method gets a page object with information about forms, blocks, menus, linked to the page by URL.
|
|
49
53
|
*/
|
|
50
54
|
getPageByUrl(url: string, langCode?: LangType): Promise<IPagesEntity | IError>;
|
|
51
55
|
/**
|
|
52
56
|
* Get child pages object with information as an array.
|
|
53
|
-
*
|
|
57
|
+
* @handleName getChildPagesByParentUrl
|
|
54
58
|
* @param {string} url - The URL of the parent page for which child pages are to be fetched. Example: "about".
|
|
55
59
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
56
|
-
* @
|
|
60
|
+
* @returns {IPagesEntity} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
|
|
57
61
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
62
|
+
* @description This method gets child pages object with information as an array.
|
|
58
63
|
*/
|
|
59
64
|
getChildPagesByParentUrl(url: string, langCode?: LangType): Promise<IPagesEntity[] | IError>;
|
|
60
65
|
/**
|
|
61
66
|
* Get all blocks by page url.
|
|
62
|
-
*
|
|
67
|
+
* @handleName getBlocksByPageUrl
|
|
63
68
|
* @param {string} url - Page URL. Example: "about".
|
|
64
69
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
65
|
-
* @
|
|
70
|
+
* @returns {IPositionBlock[]} Returns all blocks as an array of PositionBlock objects or an empty array [] (if there is no data) for the selected parent
|
|
66
71
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
72
|
+
* @description This method gets all blocks by page url.
|
|
67
73
|
*/
|
|
68
74
|
getBlocksByPageUrl(url: string, langCode?: LangType): Promise<IPositionBlock[] | IError>;
|
|
69
75
|
/**
|
|
70
76
|
* Get settings for the page.
|
|
71
|
-
*
|
|
77
|
+
* @handleName getConfigPageByUrl
|
|
72
78
|
* @param {string} url - Page URL. Example: "about".
|
|
73
|
-
* @
|
|
79
|
+
* @returns {IPageConfig} Returns a ConfigPage object with page display settings
|
|
74
80
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
81
|
+
* @description This method gets settings for the page.
|
|
75
82
|
*/
|
|
76
83
|
getConfigPageByUrl(url: string): Promise<IPageConfig | IError>;
|
|
77
84
|
/**
|
|
78
85
|
* Quick search for page objects with limited output.
|
|
79
|
-
*
|
|
86
|
+
* @handleName searchPage
|
|
80
87
|
* @param {string} name - Text for searching page objects (search is performed on the title field of the localizeInfos object with the language taken into account). Example: "About Us".
|
|
81
88
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
82
|
-
* @
|
|
89
|
+
* @returns {IPagesEntity[]} Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
83
90
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
91
|
+
* @description This method performs a quick search for page objects with limited output.
|
|
84
92
|
*/
|
|
85
93
|
searchPage(name: string, langCode?: LangType): Promise<IPagesEntity[] | IError>;
|
|
86
94
|
}
|
|
87
95
|
/**
|
|
88
96
|
* @interface IPageConfig
|
|
89
|
-
*
|
|
90
97
|
* @property {number | null} rowsPerPage - Number of lines per page. Example: 1.
|
|
91
98
|
* @property {number | null} productsPerRow - Number of products per page. Example: 1.
|
|
92
99
|
* @description This interface defines the configuration for pagination in pages, including the number of rows and products displayed per page.
|
|
@@ -97,13 +104,12 @@ interface IPageConfig {
|
|
|
97
104
|
}
|
|
98
105
|
/**
|
|
99
106
|
* @interface IPositionForm
|
|
100
|
-
*
|
|
101
107
|
* @property {number} id - The identifier of the object. Example: 1764.
|
|
102
108
|
* @property {number} version - The version number of the object. Example: 10.
|
|
103
109
|
* @property {string} identifier - The textual identifier for the record field. Example: "catalog".
|
|
104
110
|
* @property {number} attributeSetId - The identifier of the attribute set being used. Example: 0.
|
|
105
111
|
* @property {string} processingType - Type of form processing. Example: "email".
|
|
106
|
-
* @property {ILocalizeInfo} localizeInfos
|
|
112
|
+
* @property {ILocalizeInfo} localizeInfos - The name of the page, taking into account localization. Example:
|
|
107
113
|
* @property {object} processingData - Form data. Example: {}.
|
|
108
114
|
* @property {number} position - The position of the object. Example: 0.
|
|
109
115
|
* @property {IAttributes[]} attributes - Array of attribute values from the used attribute set for displaying the form (taking into account the specified language). Example:
|
|
@@ -130,19 +136,9 @@ interface IPageConfig {
|
|
|
130
136
|
],
|
|
131
137
|
"validators": {},
|
|
132
138
|
"localizeInfos": {
|
|
133
|
-
|
|
134
|
-
}
|
|
139
|
+
"title": "l1"
|
|
135
140
|
}
|
|
136
141
|
]
|
|
137
|
-
{
|
|
138
|
-
"title": "My form",
|
|
139
|
-
"titleForSite": "",
|
|
140
|
-
"successMessage": "",
|
|
141
|
-
"unsuccessMessage": "",
|
|
142
|
-
"urlAddress": "",
|
|
143
|
-
"database": "0",
|
|
144
|
-
"script": "0"
|
|
145
|
-
}
|
|
146
142
|
* @description This interface defines the structure of a position form entity, including its identifiers, attributes, and processing data.
|
|
147
143
|
*/
|
|
148
144
|
interface IPositionForm {
|
|
@@ -158,7 +154,6 @@ interface IPositionForm {
|
|
|
158
154
|
}
|
|
159
155
|
/**
|
|
160
156
|
* @interface IPositionBlock
|
|
161
|
-
*
|
|
162
157
|
* @property {number} id - The identifier of the object. Example: 1.
|
|
163
158
|
* @property {string | null} attributeSetIdentifier - Set of attributes id. Example: "block".
|
|
164
159
|
* @property {ILocalizeInfo} localizeInfos - The name of the page, taking into account localization. Example:
|
|
@@ -166,7 +161,7 @@ interface IPositionForm {
|
|
|
166
161
|
* @property {number} position - The position of the object. Example: 1.
|
|
167
162
|
* @property {string} identifier - The textual identifier for the record field. Example: "product_block".
|
|
168
163
|
* @property {Types} type - Page type. Example: "product".
|
|
169
|
-
* @property {string | null} templateIdentifier
|
|
164
|
+
* @property {string | null} templateIdentifier - User id of the linked template. Example: null.
|
|
170
165
|
* @property {boolean} isVisible - A sign of page visibility. Example: true.
|
|
171
166
|
* @property {boolean} isSync - Indication of page indexing. Example: false.
|
|
172
167
|
* @property {AttributeType} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value). Example:
|
|
@@ -202,7 +197,6 @@ interface IPositionBlock {
|
|
|
202
197
|
}
|
|
203
198
|
/**
|
|
204
199
|
* @interface IPagesEntity
|
|
205
|
-
*
|
|
206
200
|
* @property {number} id - The identifier of the object. Example: 8.
|
|
207
201
|
* @property {number | null} parentId - The id of the parent page, if it contains null, then it is the top-level page. Example: 10.
|
|
208
202
|
* @property {string} pageUrl - Unique page Url. Example: "blog".
|
|
@@ -237,8 +231,7 @@ interface IPositionBlock {
|
|
|
237
231
|
}
|
|
238
232
|
* @property {number} [products] - The number of products linked to the page. Example: 0.
|
|
239
233
|
* @property {number} [childrenCount] - Children count. Example: 1.
|
|
240
|
-
* @property {any} [
|
|
241
|
-
* @property {any} [blocks]
|
|
234
|
+
* @property {any} [blocks] - blocks. Example:
|
|
242
235
|
{
|
|
243
236
|
"id": 4,
|
|
244
237
|
"attributeSetIdentifier": null,
|
|
@@ -259,17 +252,20 @@ interface IPagesEntity {
|
|
|
259
252
|
depth: number;
|
|
260
253
|
localizeInfos: ILocalizeInfo;
|
|
261
254
|
isVisible: boolean;
|
|
255
|
+
blocks?: any[];
|
|
256
|
+
forms?: any[];
|
|
262
257
|
type: Types;
|
|
263
258
|
templateIdentifier: string | null;
|
|
264
259
|
attributeSetIdentifier: string | null;
|
|
265
260
|
attributeValues: AttributeType;
|
|
261
|
+
moduleFormConfigs?: IFormConfig[];
|
|
266
262
|
isSync: boolean;
|
|
267
|
-
template?:
|
|
263
|
+
template?: ITemplateEntity;
|
|
268
264
|
position?: number;
|
|
269
265
|
config?: Record<string, number>;
|
|
270
266
|
products?: number;
|
|
271
|
-
childrenCount?: number;
|
|
272
|
-
|
|
273
|
-
|
|
267
|
+
childrenCount?: string | number;
|
|
268
|
+
total?: string | number;
|
|
269
|
+
categoryPath?: string;
|
|
274
270
|
}
|
|
275
271
|
export type { IPageApi, IPageConfig, IPagesEntity, IPositionBlock, IPositionForm, };
|