@dotcms/client 0.0.1-alpha.0 → 0.0.1-alpha.10
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 +8 -10
- package/package.json +8 -8
- package/src/index.d.ts +4 -2
- package/src/index.js +4 -2
- package/src/index.js.map +1 -1
- package/src/lib/{sdk-js-client.d.ts → client/sdk-js-client.d.ts} +49 -31
- package/src/lib/client/sdk-js-client.js +148 -0
- package/src/lib/client/sdk-js-client.js.map +1 -0
- package/src/lib/editor/listeners/listeners.d.ts +42 -0
- package/src/lib/editor/listeners/listeners.js +169 -0
- package/src/lib/editor/listeners/listeners.js.map +1 -0
- package/src/lib/{postMessageToEditor.d.ts → editor/models/client.model.d.ts} +6 -1
- package/src/lib/{postMessageToEditor.js → editor/models/client.model.js} +7 -2
- package/src/lib/editor/models/client.model.js.map +1 -0
- package/src/lib/editor/models/editor.model.d.ts +16 -0
- package/src/lib/editor/models/editor.model.js +2 -0
- package/src/lib/editor/models/editor.model.js.map +1 -0
- package/src/lib/editor/models/listeners.model.d.ts +43 -0
- package/src/lib/editor/models/listeners.model.js +22 -0
- package/src/lib/editor/models/listeners.model.js.map +1 -0
- package/src/lib/editor/sdk-editor-vtl.d.ts +1 -0
- package/src/lib/editor/sdk-editor-vtl.js +19 -0
- package/src/lib/editor/sdk-editor-vtl.js.map +1 -0
- package/src/lib/editor/sdk-editor.d.ts +23 -0
- package/src/lib/editor/sdk-editor.js +55 -0
- package/src/lib/editor/sdk-editor.js.map +1 -0
- package/src/lib/editor/utils/editor.utils.d.ts +84 -0
- package/src/lib/editor/utils/editor.utils.js +107 -0
- package/src/lib/editor/utils/editor.utils.js.map +1 -0
- package/src/lib/postMessageToEditor.js.map +0 -1
- package/src/lib/sdk-js-client.js +0 -152
- package/src/lib/sdk-js-client.js.map +0 -1
package/README.md
CHANGED
|
@@ -6,9 +6,9 @@ This client library provides a streamlined, promise-based interface to fetch pag
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
9
|
+
- Easy-to-use methods to interact with the [DotCMS Page](https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas) and [Navigation APIs](https://www.dotcms.com/docs/latest/navigation-rest-api).
|
|
10
|
+
- Support for custom actions to communicate with the DotCMS page editor.
|
|
11
|
+
- Comprehensive TypeScript typings for better development experience.
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
@@ -43,7 +43,7 @@ const client = dotcmsClient.init({
|
|
|
43
43
|
Retrieve the elements of any page in your DotCMS system in JSON format.
|
|
44
44
|
|
|
45
45
|
```javascript
|
|
46
|
-
const pageData = await client.
|
|
46
|
+
const pageData = await client.page.get({
|
|
47
47
|
path: '/your-page-path',
|
|
48
48
|
language_id: 1,
|
|
49
49
|
personaId: 'optional-persona-id'
|
|
@@ -57,7 +57,7 @@ console.log(pageData);
|
|
|
57
57
|
Retrieve information about the DotCMS file and folder tree.
|
|
58
58
|
|
|
59
59
|
```javascript
|
|
60
|
-
const navData = await client.
|
|
60
|
+
const navData = await client.nav.get({
|
|
61
61
|
path: '/',
|
|
62
62
|
depth: 2,
|
|
63
63
|
languageId: 1
|
|
@@ -74,20 +74,18 @@ Detailed documentation of the `@dotcms/client` methods, parameters, and types ca
|
|
|
74
74
|
|
|
75
75
|
Initializes the DotCMS client with the specified configuration.
|
|
76
76
|
|
|
77
|
-
### `DotCmsClient.
|
|
77
|
+
### `DotCmsClient.page.get(options: PageApiOptions): Promise<unknown>`
|
|
78
78
|
|
|
79
79
|
Retrieves the specified page's elements from your DotCMS system in JSON format.
|
|
80
80
|
|
|
81
|
-
### `DotCmsClient.
|
|
81
|
+
### `DotCmsClient.nav.get(options: NavApiOptions): Promise<unknown>`
|
|
82
82
|
|
|
83
83
|
Retrieves information about the DotCMS file and folder tree.
|
|
84
84
|
|
|
85
|
-
|
|
86
85
|
## Contributing
|
|
87
86
|
|
|
88
87
|
GitHub pull requests are the preferred method to contribute code to dotCMS. Before any pull requests can be accepted, an automated tool will ask you to agree to the [dotCMS Contributor's Agreement](https://gist.github.com/wezell/85ef45298c48494b90d92755b583acb3).
|
|
89
88
|
|
|
90
|
-
|
|
91
89
|
## Licensing
|
|
92
90
|
|
|
93
91
|
dotCMS comes in multiple editions and as such is dual licensed. The dotCMS Community Edition is licensed under the GPL 3.0 and is freely available for download, customization and deployment for use within organizations of all stripes. dotCMS Enterprise Editions (EE) adds a number of enterprise features and is available via a supported, indemnified commercial license from dotCMS. For the differences between the editions, see [the feature page](http://dotcms.com/cms-platform/features).
|
|
@@ -110,4 +108,4 @@ Always refer to the official [DotCMS documentation](https://www.dotcms.com/docs/
|
|
|
110
108
|
| Code Examples | [Codeshare](https://dotcms.com/codeshare/) |
|
|
111
109
|
| Forums/Listserv | [via Google Groups](https://groups.google.com/forum/#!forum/dotCMS) |
|
|
112
110
|
| Twitter | @dotCMS |
|
|
113
|
-
| Main Site | [dotCMS.com](https://dotcms.com/) |
|
|
111
|
+
| Main Site | [dotCMS.com](https://dotcms.com/) |
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotcms/client",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Official JavaScript library for interacting with DotCMS REST APIs.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/dotCMS/core
|
|
8
|
+
"url": "git+https://github.com/dotCMS/core.git#master"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "nx run sdk-client:build:js; cd ../../../../dotCMS/src/main/webapp/html/js/editor-js; rm -rf src package.json *.esm.d.ts"
|
|
9
12
|
},
|
|
10
13
|
"keywords": [
|
|
11
14
|
"dotCMS",
|
|
@@ -15,14 +18,11 @@
|
|
|
15
18
|
"REST API"
|
|
16
19
|
],
|
|
17
20
|
"author": "dotcms <dev@dotcms.com>",
|
|
18
|
-
"license": "
|
|
21
|
+
"license": "MIT",
|
|
19
22
|
"bugs": {
|
|
20
23
|
"url": "https://github.com/dotCMS/core/issues"
|
|
21
24
|
},
|
|
22
25
|
"homepage": "https://github.com/dotCMS/core/tree/master/core-web/libs/sdk/client/README.md",
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
"main": "./src/index.js",
|
|
27
|
-
"types": "./src/index.d.ts"
|
|
26
|
+
"module": "./src/index.js",
|
|
27
|
+
"main": "./src/index.js"
|
|
28
28
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export * from './lib/sdk-js-client';
|
|
2
|
-
export * from './lib/
|
|
1
|
+
export * from './lib/client/sdk-js-client';
|
|
2
|
+
export * from './lib/editor/sdk-editor';
|
|
3
|
+
export * from './lib/editor/models/editor.model';
|
|
4
|
+
export * from './lib/editor/models/client.model';
|
package/src/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export * from './lib/sdk-js-client';
|
|
2
|
-
export * from './lib/
|
|
1
|
+
export * from './lib/client/sdk-js-client';
|
|
2
|
+
export * from './lib/editor/sdk-editor';
|
|
3
|
+
export * from './lib/editor/models/editor.model';
|
|
4
|
+
export * from './lib/editor/models/client.model';
|
|
3
5
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/sdk/client/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/sdk/client/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC"}
|
|
@@ -26,6 +26,15 @@ export interface ClientConfig {
|
|
|
26
26
|
* @required
|
|
27
27
|
*/
|
|
28
28
|
authToken: string;
|
|
29
|
+
/**
|
|
30
|
+
* Additional options to pass to the fetch request.
|
|
31
|
+
*
|
|
32
|
+
* @description These options will be used in the fetch request. Any option can be specified except for 'body' and 'method' which are omitted.
|
|
33
|
+
* @example `{ headers: { 'Content-Type': 'application/json' } }`
|
|
34
|
+
* @type {Omit<RequestInit, 'body' | 'method'>}
|
|
35
|
+
* @optional
|
|
36
|
+
*/
|
|
37
|
+
requestOptions?: Omit<RequestInit, 'body' | 'method'>;
|
|
29
38
|
}
|
|
30
39
|
type PageApiOptions = {
|
|
31
40
|
/**
|
|
@@ -40,6 +49,12 @@ type PageApiOptions = {
|
|
|
40
49
|
* @type {number}
|
|
41
50
|
*/
|
|
42
51
|
siteId?: string;
|
|
52
|
+
/**
|
|
53
|
+
* The mode of the page you want to retrieve. If not provided will use the default mode of the site.
|
|
54
|
+
*
|
|
55
|
+
* @type {number}
|
|
56
|
+
*/
|
|
57
|
+
mode?: string;
|
|
43
58
|
/**
|
|
44
59
|
* The language id of the page you want to retrieve. If not provided will use the default language of the site.
|
|
45
60
|
*
|
|
@@ -110,42 +125,45 @@ type NavApiOptions = {
|
|
|
110
125
|
*
|
|
111
126
|
* @method constructor(config: ClientConfig) - Constructs a new instance of the DotCmsClient class.
|
|
112
127
|
*
|
|
113
|
-
* @method
|
|
128
|
+
* @method page.get(options: PageApiOptions): Promise<unknown> - Retrieves all the elements of any Page in your dotCMS system in JSON format.
|
|
114
129
|
*
|
|
115
|
-
* @method
|
|
130
|
+
* @method nav.get(options: NavApiOptions = { depth: 0, path: '/', languageId: 1 }): Promise<unknown> - Retrieves information about the dotCMS file and folder tree.
|
|
116
131
|
*
|
|
117
132
|
*/
|
|
118
133
|
export declare class DotCmsClient {
|
|
119
134
|
private config;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
135
|
+
private requestOptions;
|
|
136
|
+
constructor(config?: ClientConfig);
|
|
137
|
+
page: {
|
|
138
|
+
/**
|
|
139
|
+
* `page.get` is an asynchronous method of the `DotCmsClient` class that retrieves all the elements of any Page in your dotCMS system in JSON format.
|
|
140
|
+
* It takes a `PageApiOptions` object as a parameter and returns a Promise that resolves to the response from the DotCMS API.
|
|
141
|
+
*
|
|
142
|
+
* The Page API enables you to retrieve all the elements of any Page in your dotCMS system.
|
|
143
|
+
* The elements may be retrieved in JSON format.
|
|
144
|
+
*
|
|
145
|
+
* @link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas
|
|
146
|
+
* @async
|
|
147
|
+
* @param {PageApiOptions} options - The options for the Page API call.
|
|
148
|
+
* @returns {Promise<unknown>} - A Promise that resolves to the response from the DotCMS API.
|
|
149
|
+
* @throws {Error} - Throws an error if the options are not valid.
|
|
150
|
+
*/
|
|
151
|
+
get: (options: PageApiOptions) => Promise<unknown>;
|
|
152
|
+
};
|
|
153
|
+
nav: {
|
|
154
|
+
/**
|
|
155
|
+
* `nav.get` is an asynchronous method of the `DotCmsClient` class that retrieves information about the dotCMS file and folder tree.
|
|
156
|
+
* It takes a `NavApiOptions` object as a parameter (with default values) and returns a Promise that resolves to the response from the DotCMS API.
|
|
157
|
+
*
|
|
158
|
+
* The navigation REST API enables you to retrieve information about the dotCMS file and folder tree through REST API calls.
|
|
159
|
+
* @link https://www.dotcms.com/docs/latest/navigation-rest-api
|
|
160
|
+
* @async
|
|
161
|
+
* @param {NavApiOptions} options - The options for the Nav API call. Defaults to `{ depth: 0, path: '/', languageId: 1 }`.
|
|
162
|
+
* @returns {Promise<unknown>} - A Promise that resolves to the response from the DotCMS API.
|
|
163
|
+
* @throws {Error} - Throws an error if the options are not valid.
|
|
164
|
+
*/
|
|
165
|
+
get: (options?: NavApiOptions) => Promise<unknown>;
|
|
166
|
+
};
|
|
149
167
|
private validatePageOptions;
|
|
150
168
|
private validateNavOptions;
|
|
151
169
|
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
function isValidUrl(url) {
|
|
2
|
+
try {
|
|
3
|
+
new URL(url);
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
catch (error) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* `DotCmsClient` is a TypeScript class that provides methods to interact with the DotCMS REST API.
|
|
12
|
+
* It requires a configuration object on instantiation, which includes the DotCMS URL, site ID, and authentication token.
|
|
13
|
+
*
|
|
14
|
+
* @class DotCmsClient
|
|
15
|
+
*
|
|
16
|
+
* @property {ClientConfig} config - The configuration object for the DotCMS client.
|
|
17
|
+
*
|
|
18
|
+
* @method constructor(config: ClientConfig) - Constructs a new instance of the DotCmsClient class.
|
|
19
|
+
*
|
|
20
|
+
* @method page.get(options: PageApiOptions): Promise<unknown> - Retrieves all the elements of any Page in your dotCMS system in JSON format.
|
|
21
|
+
*
|
|
22
|
+
* @method nav.get(options: NavApiOptions = { depth: 0, path: '/', languageId: 1 }): Promise<unknown> - Retrieves information about the dotCMS file and folder tree.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
export class DotCmsClient {
|
|
26
|
+
constructor(config = { dotcmsUrl: '', authToken: '', requestOptions: {}, siteId: '' }) {
|
|
27
|
+
this.page = {
|
|
28
|
+
/**
|
|
29
|
+
* `page.get` is an asynchronous method of the `DotCmsClient` class that retrieves all the elements of any Page in your dotCMS system in JSON format.
|
|
30
|
+
* It takes a `PageApiOptions` object as a parameter and returns a Promise that resolves to the response from the DotCMS API.
|
|
31
|
+
*
|
|
32
|
+
* The Page API enables you to retrieve all the elements of any Page in your dotCMS system.
|
|
33
|
+
* The elements may be retrieved in JSON format.
|
|
34
|
+
*
|
|
35
|
+
* @link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas
|
|
36
|
+
* @async
|
|
37
|
+
* @param {PageApiOptions} options - The options for the Page API call.
|
|
38
|
+
* @returns {Promise<unknown>} - A Promise that resolves to the response from the DotCMS API.
|
|
39
|
+
* @throws {Error} - Throws an error if the options are not valid.
|
|
40
|
+
*/
|
|
41
|
+
get: async (options) => {
|
|
42
|
+
this.validatePageOptions(options);
|
|
43
|
+
const queryParamsObj = {};
|
|
44
|
+
for (const [key, value] of Object.entries(options)) {
|
|
45
|
+
if (value === undefined || key === 'path' || key === 'siteId')
|
|
46
|
+
continue;
|
|
47
|
+
if (key === 'personaId') {
|
|
48
|
+
queryParamsObj['com.dotmarketing.persona.id'] = String(value);
|
|
49
|
+
}
|
|
50
|
+
else if (key === 'mode' && value) {
|
|
51
|
+
queryParamsObj['mode'] = String(value);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
queryParamsObj[key] = String(value);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const queryHostId = options.siteId ?? this.config.siteId ?? '';
|
|
58
|
+
if (queryHostId) {
|
|
59
|
+
queryParamsObj['host_id'] = queryHostId;
|
|
60
|
+
}
|
|
61
|
+
const queryParams = new URLSearchParams(queryParamsObj).toString();
|
|
62
|
+
const formattedPath = options.path.startsWith('/') ? options.path : `/${options.path}`;
|
|
63
|
+
const url = `${this.config.dotcmsUrl}/api/v1/page/json${formattedPath}${queryParams ? `?${queryParams}` : ''}`;
|
|
64
|
+
const response = await fetch(url, this.requestOptions);
|
|
65
|
+
return response.json();
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
this.nav = {
|
|
69
|
+
/**
|
|
70
|
+
* `nav.get` is an asynchronous method of the `DotCmsClient` class that retrieves information about the dotCMS file and folder tree.
|
|
71
|
+
* It takes a `NavApiOptions` object as a parameter (with default values) and returns a Promise that resolves to the response from the DotCMS API.
|
|
72
|
+
*
|
|
73
|
+
* The navigation REST API enables you to retrieve information about the dotCMS file and folder tree through REST API calls.
|
|
74
|
+
* @link https://www.dotcms.com/docs/latest/navigation-rest-api
|
|
75
|
+
* @async
|
|
76
|
+
* @param {NavApiOptions} options - The options for the Nav API call. Defaults to `{ depth: 0, path: '/', languageId: 1 }`.
|
|
77
|
+
* @returns {Promise<unknown>} - A Promise that resolves to the response from the DotCMS API.
|
|
78
|
+
* @throws {Error} - Throws an error if the options are not valid.
|
|
79
|
+
*/
|
|
80
|
+
get: async (options = { depth: 0, path: '/', languageId: 1 }) => {
|
|
81
|
+
this.validateNavOptions(options);
|
|
82
|
+
// Extract the 'path' from the options and prepare the rest as query parameters
|
|
83
|
+
const { path, ...queryParamsOptions } = options;
|
|
84
|
+
const queryParamsObj = {};
|
|
85
|
+
Object.entries(queryParamsOptions).forEach(([key, value]) => {
|
|
86
|
+
if (value !== undefined) {
|
|
87
|
+
queryParamsObj[key] = String(value);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const queryParams = new URLSearchParams(queryParamsObj).toString();
|
|
91
|
+
// Format the URL correctly depending on the 'path' value
|
|
92
|
+
const formattedPath = path === '/' ? '/' : `/${path}`;
|
|
93
|
+
const url = `${this.config.dotcmsUrl}/api/v1/nav${formattedPath}${queryParams ? `?${queryParams}` : ''}`;
|
|
94
|
+
const response = await fetch(url, this.requestOptions);
|
|
95
|
+
return response.json();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
if (!config.dotcmsUrl) {
|
|
99
|
+
throw new Error("Invalid configuration - 'dotcmsUrl' is required");
|
|
100
|
+
}
|
|
101
|
+
if (!isValidUrl(config.dotcmsUrl)) {
|
|
102
|
+
throw new Error("Invalid configuration - 'dotcmsUrl' must be a valid URL");
|
|
103
|
+
}
|
|
104
|
+
if (!config.authToken) {
|
|
105
|
+
throw new Error("Invalid configuration - 'authToken' is required");
|
|
106
|
+
}
|
|
107
|
+
this.config = config;
|
|
108
|
+
this.requestOptions = {
|
|
109
|
+
...this.config.requestOptions,
|
|
110
|
+
headers: {
|
|
111
|
+
Authorization: `Bearer ${this.config.authToken}`,
|
|
112
|
+
...this.config.requestOptions?.headers
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
validatePageOptions(options) {
|
|
117
|
+
if (!options.path) {
|
|
118
|
+
throw new Error("The 'path' parameter is required for the Page API");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
validateNavOptions(options) {
|
|
122
|
+
if (!options.path) {
|
|
123
|
+
throw new Error("The 'path' parameter is required for the Nav API");
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* `dotcmsClient` is an object that provides a method to initialize the DotCMS SDK client.
|
|
129
|
+
* It has a single method `init` which takes a configuration object and returns an instance of the `DotCmsClient` class.
|
|
130
|
+
*
|
|
131
|
+
* @namespace dotcmsClient
|
|
132
|
+
*
|
|
133
|
+
* @method init(config: ClientConfig): DotCmsClient - Initializes the SDK client.
|
|
134
|
+
*/
|
|
135
|
+
export const dotcmsClient = {
|
|
136
|
+
/**
|
|
137
|
+
* `init` is a method of the `dotcmsClient` object that initializes the SDK client.
|
|
138
|
+
* It takes a configuration object as a parameter and returns an instance of the `DotCmsClient` class.
|
|
139
|
+
*
|
|
140
|
+
* @method init
|
|
141
|
+
* @param {ClientConfig} config - The configuration object for the DotCMS client.
|
|
142
|
+
* @returns {DotCmsClient} - An instance of the {@link DotCmsClient} class.
|
|
143
|
+
*/
|
|
144
|
+
init: (config) => {
|
|
145
|
+
return new DotCmsClient(config);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
//# sourceMappingURL=sdk-js-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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OAAO;aACzC;SACJ,CAAC;IACN,CAAC;IA0FO,mBAAmB,CAAC,OAAuB;QAC/C,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACzE,CAAC;IACL,CAAC;IAEO,kBAAkB,CAAC,OAAsB;QAC7C,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACxE,CAAC;IACL,CAAC;CACJ;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB;;;;;;;OAOG;IACH,IAAI,EAAE,CAAC,MAAoB,EAAgB,EAAE;QACzC,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DotCMSPageEditorConfig } from '../models/editor.model';
|
|
2
|
+
import { DotCMSPageEditorSubscription } from '../models/listeners.model';
|
|
3
|
+
export declare function setPageEditorConfig(config: DotCMSPageEditorConfig): void;
|
|
4
|
+
/**
|
|
5
|
+
* Represents an array of DotCMSPageEditorSubscription objects.
|
|
6
|
+
* Used to store the subscriptions for the editor and unsubscribe later.
|
|
7
|
+
*/
|
|
8
|
+
export declare const subscriptions: DotCMSPageEditorSubscription[];
|
|
9
|
+
/**
|
|
10
|
+
* Listens for editor messages and performs corresponding actions based on the received message.
|
|
11
|
+
*
|
|
12
|
+
* @private
|
|
13
|
+
* @memberof DotCMSPageEditor
|
|
14
|
+
*/
|
|
15
|
+
export declare function listenEditorMessages(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Listens for pointer move events and extracts information about the hovered contentlet.
|
|
18
|
+
*
|
|
19
|
+
* @private
|
|
20
|
+
* @memberof DotCMSPageEditor
|
|
21
|
+
*/
|
|
22
|
+
export declare function listenHoveredContentlet(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Attaches a scroll event listener to the window
|
|
25
|
+
* and sends a message to the editor when the window is scrolled.
|
|
26
|
+
*
|
|
27
|
+
* @private
|
|
28
|
+
* @memberof DotCMSPageEditor
|
|
29
|
+
*/
|
|
30
|
+
export declare function scrollHandler(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Listens for changes in the content and triggers a customer action when the content changes.
|
|
33
|
+
*
|
|
34
|
+
* @private
|
|
35
|
+
* @memberof DotCMSPageEditor
|
|
36
|
+
*/
|
|
37
|
+
export declare function listenContentChange(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Sends a ping message to the editor.
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
export declare function pingEditor(): void;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { CUSTOMER_ACTIONS, postMessageToEditor } from '../models/client.model';
|
|
2
|
+
import { NOTIFY_CUSTOMER } from '../models/listeners.model';
|
|
3
|
+
import { findContentletElement, getClosestContainerData, getPageElementBound } from '../utils/editor.utils';
|
|
4
|
+
/**
|
|
5
|
+
* Default reload function that reloads the current window.
|
|
6
|
+
*/
|
|
7
|
+
const defaultReloadFn = () => window.location.reload();
|
|
8
|
+
/**
|
|
9
|
+
* Configuration object for the DotCMSPageEditor.
|
|
10
|
+
*/
|
|
11
|
+
let pageEditorConfig = {
|
|
12
|
+
onReload: defaultReloadFn
|
|
13
|
+
};
|
|
14
|
+
export function setPageEditorConfig(config) {
|
|
15
|
+
pageEditorConfig = config;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Represents an array of DotCMSPageEditorSubscription objects.
|
|
19
|
+
* Used to store the subscriptions for the editor and unsubscribe later.
|
|
20
|
+
*/
|
|
21
|
+
export const subscriptions = [];
|
|
22
|
+
/**
|
|
23
|
+
* Sets the bounds of the containers in the editor.
|
|
24
|
+
* Retrieves the containers from the DOM and sends their position data to the editor.
|
|
25
|
+
* @private
|
|
26
|
+
* @memberof DotCMSPageEditor
|
|
27
|
+
*/
|
|
28
|
+
function setBounds() {
|
|
29
|
+
const containers = Array.from(document.querySelectorAll('[data-dot-object="container"]'));
|
|
30
|
+
const positionData = getPageElementBound(containers);
|
|
31
|
+
postMessageToEditor({
|
|
32
|
+
action: CUSTOMER_ACTIONS.SET_BOUNDS,
|
|
33
|
+
payload: positionData
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Reloads the page and triggers the onReload callback if it exists in the config object.
|
|
38
|
+
*/
|
|
39
|
+
function reloadPage() {
|
|
40
|
+
pageEditorConfig?.onReload();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Listens for editor messages and performs corresponding actions based on the received message.
|
|
44
|
+
*
|
|
45
|
+
* @private
|
|
46
|
+
* @memberof DotCMSPageEditor
|
|
47
|
+
*/
|
|
48
|
+
export function listenEditorMessages() {
|
|
49
|
+
const messageCallback = (event) => {
|
|
50
|
+
switch (event.data) {
|
|
51
|
+
case NOTIFY_CUSTOMER.EMA_REQUEST_BOUNDS: {
|
|
52
|
+
setBounds();
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
case NOTIFY_CUSTOMER.EMA_RELOAD_PAGE: {
|
|
56
|
+
reloadPage();
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
window.addEventListener('message', messageCallback);
|
|
62
|
+
subscriptions.push({
|
|
63
|
+
type: 'listener',
|
|
64
|
+
event: 'message',
|
|
65
|
+
callback: messageCallback
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Listens for pointer move events and extracts information about the hovered contentlet.
|
|
70
|
+
*
|
|
71
|
+
* @private
|
|
72
|
+
* @memberof DotCMSPageEditor
|
|
73
|
+
*/
|
|
74
|
+
export function listenHoveredContentlet() {
|
|
75
|
+
const pointerMoveCallback = (event) => {
|
|
76
|
+
const target = findContentletElement(event.target);
|
|
77
|
+
if (!target)
|
|
78
|
+
return;
|
|
79
|
+
const { x, y, width, height } = target.getBoundingClientRect();
|
|
80
|
+
const contentletPayload = {
|
|
81
|
+
container:
|
|
82
|
+
// Here extract dot-container from contentlet if is Headless
|
|
83
|
+
// or search in parent container if is VTL
|
|
84
|
+
target.dataset?.['dotContainer']
|
|
85
|
+
? JSON.parse(target.dataset?.['dotContainer'])
|
|
86
|
+
: getClosestContainerData(target),
|
|
87
|
+
contentlet: {
|
|
88
|
+
identifier: target.dataset?.['dotIdentifier'],
|
|
89
|
+
title: target.dataset?.['dotTitle'],
|
|
90
|
+
inode: target.dataset?.['dotInode'],
|
|
91
|
+
contentType: target.dataset?.['dotType']
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
postMessageToEditor({
|
|
95
|
+
action: CUSTOMER_ACTIONS.SET_CONTENTLET,
|
|
96
|
+
payload: {
|
|
97
|
+
x,
|
|
98
|
+
y,
|
|
99
|
+
width,
|
|
100
|
+
height,
|
|
101
|
+
payload: contentletPayload
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
document.addEventListener('pointermove', pointerMoveCallback);
|
|
106
|
+
subscriptions.push({
|
|
107
|
+
type: 'listener',
|
|
108
|
+
event: 'pointermove',
|
|
109
|
+
callback: pointerMoveCallback
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Attaches a scroll event listener to the window
|
|
114
|
+
* and sends a message to the editor when the window is scrolled.
|
|
115
|
+
*
|
|
116
|
+
* @private
|
|
117
|
+
* @memberof DotCMSPageEditor
|
|
118
|
+
*/
|
|
119
|
+
export function scrollHandler() {
|
|
120
|
+
const scrollCallback = () => {
|
|
121
|
+
postMessageToEditor({
|
|
122
|
+
action: CUSTOMER_ACTIONS.IFRAME_SCROLL
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
window.addEventListener('scroll', scrollCallback);
|
|
126
|
+
subscriptions.push({
|
|
127
|
+
type: 'listener',
|
|
128
|
+
event: 'scroll',
|
|
129
|
+
callback: scrollCallback
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Listens for changes in the content and triggers a customer action when the content changes.
|
|
134
|
+
*
|
|
135
|
+
* @private
|
|
136
|
+
* @memberof DotCMSPageEditor
|
|
137
|
+
*/
|
|
138
|
+
export function listenContentChange() {
|
|
139
|
+
const observer = new MutationObserver((mutationsList) => {
|
|
140
|
+
for (const { addedNodes, removedNodes, type } of mutationsList) {
|
|
141
|
+
if (type === 'childList') {
|
|
142
|
+
const didNodesChanged = [
|
|
143
|
+
...Array.from(addedNodes),
|
|
144
|
+
...Array.from(removedNodes)
|
|
145
|
+
].filter((node) => node.dataset?.['dotObject'] === 'contentlet').length;
|
|
146
|
+
if (didNodesChanged) {
|
|
147
|
+
postMessageToEditor({
|
|
148
|
+
action: CUSTOMER_ACTIONS.CONTENT_CHANGE
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
observer.observe(document, { childList: true, subtree: true });
|
|
155
|
+
subscriptions.push({
|
|
156
|
+
type: 'observer',
|
|
157
|
+
observer
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Sends a ping message to the editor.
|
|
162
|
+
*
|
|
163
|
+
*/
|
|
164
|
+
export function pingEditor() {
|
|
165
|
+
postMessageToEditor({
|
|
166
|
+
action: CUSTOMER_ACTIONS.PING_EDITOR
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=listeners.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listeners.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/listeners/listeners.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAgC,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAC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EAAE,CAAC,CAAC;IAE/D,aAAa,CAAC,IAAI,CAAC;QACf,IAAI,EAAE,UAAU;QAChB,QAAQ;KACX,CAAC,CAAC;AACP,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU;IACtB,mBAAmB,CAAC;QAChB,MAAM,EAAE,gBAAgB,CAAC,WAAW;KACvC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -8,7 +8,7 @@ export declare enum CUSTOMER_ACTIONS {
|
|
|
8
8
|
/**
|
|
9
9
|
* Tell the dotcms editor that page change
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
NAVIGATION_UPDATE = "set-url",
|
|
12
12
|
/**
|
|
13
13
|
* Send the element position of the rows, columnsm containers and contentlets
|
|
14
14
|
*/
|
|
@@ -21,6 +21,11 @@ export declare enum CUSTOMER_ACTIONS {
|
|
|
21
21
|
* Tell the editor that the page is being scrolled
|
|
22
22
|
*/
|
|
23
23
|
IFRAME_SCROLL = "scroll",
|
|
24
|
+
/**
|
|
25
|
+
* Ping the editor to see if the page is inside the editor
|
|
26
|
+
*/
|
|
27
|
+
PING_EDITOR = "ping-editor",
|
|
28
|
+
CONTENT_CHANGE = "content-change",
|
|
24
29
|
NOOP = "noop"
|
|
25
30
|
}
|
|
26
31
|
/**
|
|
@@ -9,7 +9,7 @@ export var CUSTOMER_ACTIONS;
|
|
|
9
9
|
/**
|
|
10
10
|
* Tell the dotcms editor that page change
|
|
11
11
|
*/
|
|
12
|
-
CUSTOMER_ACTIONS["
|
|
12
|
+
CUSTOMER_ACTIONS["NAVIGATION_UPDATE"] = "set-url";
|
|
13
13
|
/**
|
|
14
14
|
* Send the element position of the rows, columnsm containers and contentlets
|
|
15
15
|
*/
|
|
@@ -22,6 +22,11 @@ export var CUSTOMER_ACTIONS;
|
|
|
22
22
|
* Tell the editor that the page is being scrolled
|
|
23
23
|
*/
|
|
24
24
|
CUSTOMER_ACTIONS["IFRAME_SCROLL"] = "scroll";
|
|
25
|
+
/**
|
|
26
|
+
* Ping the editor to see if the page is inside the editor
|
|
27
|
+
*/
|
|
28
|
+
CUSTOMER_ACTIONS["PING_EDITOR"] = "ping-editor";
|
|
29
|
+
CUSTOMER_ACTIONS["CONTENT_CHANGE"] = "content-change";
|
|
25
30
|
CUSTOMER_ACTIONS["NOOP"] = "noop";
|
|
26
31
|
})(CUSTOMER_ACTIONS || (CUSTOMER_ACTIONS = {}));
|
|
27
32
|
/**
|
|
@@ -34,4 +39,4 @@ export var CUSTOMER_ACTIONS;
|
|
|
34
39
|
export function postMessageToEditor(message) {
|
|
35
40
|
window.parent.postMessage(message, '*');
|
|
36
41
|
}
|
|
37
|
-
//# sourceMappingURL=
|
|
42
|
+
//# sourceMappingURL=client.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.model.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/models/client.model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,gBAyBX;AAzBD,WAAY,gBAAgB;IACxB;;OAEG;IACH,iDAA6B,CAAA;IAC7B;;OAEG;IACH,6CAAyB,CAAA;IACzB;;OAEG;IACH,qDAAiC,CAAA;IACjC;;OAEG;IACH,4CAAwB,CAAA;IACxB;;OAEG;IACH,+CAA2B,CAAA;IAE3B,qDAAiC,CAAA;IAEjC,iCAAa,CAAA;AACjB,CAAC,EAzBW,gBAAgB,KAAhB,gBAAgB,QAyB3B;AAcD;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAc,OAA4B;IACzE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Represents the configuration options for the DotCMS page editor.
|
|
4
|
+
* @export
|
|
5
|
+
* @interface DotCMSPageEditorConfig
|
|
6
|
+
*/
|
|
7
|
+
export interface DotCMSPageEditorConfig {
|
|
8
|
+
/**
|
|
9
|
+
* A callback function that will be called when the page editor needs to be reloaded.
|
|
10
|
+
*/
|
|
11
|
+
onReload: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* The pathname of the page being edited. Optional.
|
|
14
|
+
*/
|
|
15
|
+
pathname?: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.model.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/models/editor.model.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Actions received from the dotcms editor
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @enum {number}
|
|
6
|
+
*/
|
|
7
|
+
export declare enum NOTIFY_CUSTOMER {
|
|
8
|
+
/**
|
|
9
|
+
* Request to page to reload
|
|
10
|
+
*/
|
|
11
|
+
EMA_RELOAD_PAGE = "ema-reload-page",
|
|
12
|
+
/**
|
|
13
|
+
* Request the bounds for the elements
|
|
14
|
+
*/
|
|
15
|
+
EMA_REQUEST_BOUNDS = "ema-request-bounds",
|
|
16
|
+
/**
|
|
17
|
+
* Received pong from the editor
|
|
18
|
+
*/
|
|
19
|
+
EMA_EDITOR_PONG = "ema-editor-pong"
|
|
20
|
+
}
|
|
21
|
+
type ListenerCallbackMessage = (event: MessageEvent) => void;
|
|
22
|
+
type ListenerCallbackPointer = (event: PointerEvent) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Listener for the dotcms editor
|
|
25
|
+
*
|
|
26
|
+
* @interface DotCMSPageEditorListener
|
|
27
|
+
*/
|
|
28
|
+
interface DotCMSPageEditorListener {
|
|
29
|
+
type: 'listener';
|
|
30
|
+
event: string;
|
|
31
|
+
callback: ListenerCallbackMessage | ListenerCallbackPointer;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Observer for the dotcms editor
|
|
35
|
+
*
|
|
36
|
+
* @interface DotCMSPageEditorObserver
|
|
37
|
+
*/
|
|
38
|
+
interface DotCMSPageEditorObserver {
|
|
39
|
+
type: 'observer';
|
|
40
|
+
observer: MutationObserver;
|
|
41
|
+
}
|
|
42
|
+
export type DotCMSPageEditorSubscription = DotCMSPageEditorListener | DotCMSPageEditorObserver;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Actions received from the dotcms editor
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @enum {number}
|
|
6
|
+
*/
|
|
7
|
+
export var NOTIFY_CUSTOMER;
|
|
8
|
+
(function (NOTIFY_CUSTOMER) {
|
|
9
|
+
/**
|
|
10
|
+
* Request to page to reload
|
|
11
|
+
*/
|
|
12
|
+
NOTIFY_CUSTOMER["EMA_RELOAD_PAGE"] = "ema-reload-page";
|
|
13
|
+
/**
|
|
14
|
+
* Request the bounds for the elements
|
|
15
|
+
*/
|
|
16
|
+
NOTIFY_CUSTOMER["EMA_REQUEST_BOUNDS"] = "ema-request-bounds";
|
|
17
|
+
/**
|
|
18
|
+
* Received pong from the editor
|
|
19
|
+
*/
|
|
20
|
+
NOTIFY_CUSTOMER["EMA_EDITOR_PONG"] = "ema-editor-pong";
|
|
21
|
+
})(NOTIFY_CUSTOMER || (NOTIFY_CUSTOMER = {}));
|
|
22
|
+
//# sourceMappingURL=listeners.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listeners.model.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/models/listeners.model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,eAaX;AAbD,WAAY,eAAe;IACvB;;OAEG;IACH,sDAAmC,CAAA;IACnC;;OAEG;IACH,4DAAyC,CAAA;IACzC;;OAEG;IACH,sDAAmC,CAAA;AACvC,CAAC,EAbW,eAAe,KAAf,eAAe,QAa1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { listenContentChange, listenEditorMessages, listenHoveredContentlet, pingEditor } from './listeners/listeners';
|
|
2
|
+
import { isInsideEditor } from './sdk-editor';
|
|
3
|
+
/**
|
|
4
|
+
* This is the main entry point for the SDK VTL.
|
|
5
|
+
* This is added to VTL Script in the EditPage
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This module sets up the necessary listeners and functionality for the SDK VTL.
|
|
9
|
+
* It checks if the script is running inside the editor and then initializes the client by pinging the editor,
|
|
10
|
+
* listening for editor messages, hovered contentlet changes, and content changes.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
if (isInsideEditor()) {
|
|
14
|
+
pingEditor();
|
|
15
|
+
listenEditorMessages();
|
|
16
|
+
listenHoveredContentlet();
|
|
17
|
+
listenContentChange();
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=sdk-editor-vtl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-editor-vtl.js","sourceRoot":"","sources":["../../../../../../../libs/sdk/client/src/lib/editor/sdk-editor-vtl.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,UAAU,EACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;;;;;GASG;AACH,IAAI,cAAc,EAAE,EAAE,CAAC;IACnB,UAAU,EAAE,CAAC;IACb,oBAAoB,EAAE,CAAC;IACvB,uBAAuB,EAAE,CAAC;IAC1B,mBAAmB,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DotCMSPageEditorConfig } from './models/editor.model';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Updates the navigation in the editor.
|
|
5
|
+
* @param {string} pathname - The pathname to update the navigation with.
|
|
6
|
+
* @memberof DotCMSPageEditor
|
|
7
|
+
*/
|
|
8
|
+
export declare function updateNavigation(pathname: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* Checks if the code is running inside an editor.
|
|
11
|
+
* @returns {boolean} Returns true if the code is running inside an editor, otherwise false.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isInsideEditor(): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Initializes the DotCMS page editor.
|
|
16
|
+
*
|
|
17
|
+
* @param conf - Optional configuration for the editor.
|
|
18
|
+
*/
|
|
19
|
+
export declare function initEditor(config?: DotCMSPageEditorConfig): void;
|
|
20
|
+
/**
|
|
21
|
+
* Destroys the editor by removing event listeners and disconnecting observers.
|
|
22
|
+
*/
|
|
23
|
+
export declare function destroyEditor(): void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { listenContentChange, listenEditorMessages, listenHoveredContentlet, pingEditor, scrollHandler, subscriptions, setPageEditorConfig } from './listeners/listeners';
|
|
2
|
+
import { CUSTOMER_ACTIONS, postMessageToEditor } from './models/client.model';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Updates the navigation in the editor.
|
|
6
|
+
* @param {string} pathname - The pathname to update the navigation with.
|
|
7
|
+
* @memberof DotCMSPageEditor
|
|
8
|
+
*/
|
|
9
|
+
export function updateNavigation(pathname) {
|
|
10
|
+
postMessageToEditor({
|
|
11
|
+
action: CUSTOMER_ACTIONS.NAVIGATION_UPDATE,
|
|
12
|
+
payload: {
|
|
13
|
+
url: pathname === '/' ? 'index' : pathname?.replace('/', '')
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Checks if the code is running inside an editor.
|
|
19
|
+
* @returns {boolean} Returns true if the code is running inside an editor, otherwise false.
|
|
20
|
+
*/
|
|
21
|
+
export function isInsideEditor() {
|
|
22
|
+
if (window.parent === window) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Initializes the DotCMS page editor.
|
|
29
|
+
*
|
|
30
|
+
* @param conf - Optional configuration for the editor.
|
|
31
|
+
*/
|
|
32
|
+
export function initEditor(config) {
|
|
33
|
+
if (config) {
|
|
34
|
+
setPageEditorConfig(config);
|
|
35
|
+
}
|
|
36
|
+
pingEditor();
|
|
37
|
+
listenEditorMessages();
|
|
38
|
+
listenHoveredContentlet();
|
|
39
|
+
scrollHandler();
|
|
40
|
+
listenContentChange();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Destroys the editor by removing event listeners and disconnecting observers.
|
|
44
|
+
*/
|
|
45
|
+
export function destroyEditor() {
|
|
46
|
+
subscriptions.forEach((subscription) => {
|
|
47
|
+
if (subscription.type === 'listener') {
|
|
48
|
+
window.removeEventListener(subscription.event, subscription.callback);
|
|
49
|
+
}
|
|
50
|
+
if (subscription.type === 'observer') {
|
|
51
|
+
subscription.observer.disconnect();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=sdk-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-editor.js","sourceRoot":"","sources":["../../../../../../../libs/sdk/client/src/lib/editor/sdk-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,UAAU,EACV,aAAa,EACb,aAAa,EACb,mBAAmB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG9E;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC7C,mBAAmB,CAAC;QAChB,MAAM,EAAE,gBAAgB,CAAC,iBAAiB;QAC1C,OAAO,EAAE;YACL,GAAG,EAAE,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;SAC/D;KACJ,CAAC,CAAC;AACP,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC1B,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,MAA+B;IACtD,IAAI,MAAM,EAAE,CAAC;QACT,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,UAAU,EAAE,CAAC;IACb,oBAAoB,EAAE,CAAC;IACvB,uBAAuB,EAAE,CAAC;IAC1B,aAAa,EAAE,CAAC;IAChB,mBAAmB,EAAE,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IACzB,aAAa,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE;QACnC,IAAI,YAAY,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACnC,MAAM,CAAC,mBAAmB,CAAC,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,QAAyB,CAAC,CAAC;QAC3F,CAAC;QAED,IAAI,YAAY,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACnC,YAAY,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QACvC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bound information for a contentlet.
|
|
3
|
+
*
|
|
4
|
+
* @interface ContentletBound
|
|
5
|
+
*/
|
|
6
|
+
interface ContentletBound {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
payload: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Bound information for a container.
|
|
15
|
+
*
|
|
16
|
+
* @interface ContenainerBound
|
|
17
|
+
*/
|
|
18
|
+
interface ContenainerBound {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
payload: {
|
|
24
|
+
container: {
|
|
25
|
+
acceptTypes: string;
|
|
26
|
+
identifier: string;
|
|
27
|
+
maxContentlets: string;
|
|
28
|
+
uuid: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
contentlets: ContentletBound[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Calculates the bounding information for each page element within the given containers.
|
|
35
|
+
*
|
|
36
|
+
* @export
|
|
37
|
+
* @param {HTMLDivElement[]} containers
|
|
38
|
+
* @return {*} An array of objects containing the bounding information for each page element.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getPageElementBound(containers: HTMLDivElement[]): ContenainerBound[];
|
|
41
|
+
/**
|
|
42
|
+
* An array of objects containing the bounding information for each contentlet inside a container.
|
|
43
|
+
*
|
|
44
|
+
* @export
|
|
45
|
+
* @param {DOMRect} containerRect
|
|
46
|
+
* @param {HTMLDivElement[]} contentlets
|
|
47
|
+
* @return {*}
|
|
48
|
+
*/
|
|
49
|
+
export declare function getContentletsBound(containerRect: DOMRect, contentlets: HTMLDivElement[]): ContentletBound[];
|
|
50
|
+
/**
|
|
51
|
+
* Get container data from VTLS.
|
|
52
|
+
*
|
|
53
|
+
* @export
|
|
54
|
+
* @param {HTMLElement} container
|
|
55
|
+
* @return {*}
|
|
56
|
+
*/
|
|
57
|
+
export declare function getContainerData(container: HTMLElement): {
|
|
58
|
+
acceptTypes: string;
|
|
59
|
+
identifier: string;
|
|
60
|
+
maxContentlets: string;
|
|
61
|
+
uuid: string;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Get the closest container data from the contentlet.
|
|
65
|
+
*
|
|
66
|
+
* @export
|
|
67
|
+
* @param {Element} element
|
|
68
|
+
* @return {*}
|
|
69
|
+
*/
|
|
70
|
+
export declare function getClosestContainerData(element: Element): {
|
|
71
|
+
acceptTypes: string;
|
|
72
|
+
identifier: string;
|
|
73
|
+
maxContentlets: string;
|
|
74
|
+
uuid: string;
|
|
75
|
+
} | null;
|
|
76
|
+
/**
|
|
77
|
+
* Find the closest contentlet element based on HTMLElement.
|
|
78
|
+
*
|
|
79
|
+
* @export
|
|
80
|
+
* @param {(HTMLElement | null)} element
|
|
81
|
+
* @return {*}
|
|
82
|
+
*/
|
|
83
|
+
export declare function findContentletElement(element: HTMLElement | null): HTMLElement | null;
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the bounding information for each page element within the given containers.
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @param {HTMLDivElement[]} containers
|
|
6
|
+
* @return {*} An array of objects containing the bounding information for each page element.
|
|
7
|
+
*/
|
|
8
|
+
export function getPageElementBound(containers) {
|
|
9
|
+
return containers.map((container) => {
|
|
10
|
+
const containerRect = container.getBoundingClientRect();
|
|
11
|
+
const contentlets = Array.from(container.querySelectorAll('[data-dot-object="contentlet"]'));
|
|
12
|
+
return {
|
|
13
|
+
x: containerRect.x,
|
|
14
|
+
y: containerRect.y,
|
|
15
|
+
width: containerRect.width,
|
|
16
|
+
height: containerRect.height,
|
|
17
|
+
payload: {
|
|
18
|
+
container: getContainerData(container)
|
|
19
|
+
},
|
|
20
|
+
contentlets: getContentletsBound(containerRect, contentlets)
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* An array of objects containing the bounding information for each contentlet inside a container.
|
|
26
|
+
*
|
|
27
|
+
* @export
|
|
28
|
+
* @param {DOMRect} containerRect
|
|
29
|
+
* @param {HTMLDivElement[]} contentlets
|
|
30
|
+
* @return {*}
|
|
31
|
+
*/
|
|
32
|
+
export function getContentletsBound(containerRect, contentlets) {
|
|
33
|
+
return contentlets.map((contentlet) => {
|
|
34
|
+
const contentletRect = contentlet.getBoundingClientRect();
|
|
35
|
+
return {
|
|
36
|
+
x: 0,
|
|
37
|
+
y: contentletRect.y - containerRect.y,
|
|
38
|
+
width: contentletRect.width,
|
|
39
|
+
height: contentletRect.height,
|
|
40
|
+
payload: JSON.stringify({
|
|
41
|
+
container: contentlet.dataset?.['dotContainer']
|
|
42
|
+
? JSON.parse(contentlet.dataset?.['dotContainer'])
|
|
43
|
+
: getClosestContainerData(contentlet),
|
|
44
|
+
contentlet: {
|
|
45
|
+
identifier: contentlet.dataset?.['dotIdentifier'],
|
|
46
|
+
title: contentlet.dataset?.['dotTitle'],
|
|
47
|
+
inode: contentlet.dataset?.['dotInode'],
|
|
48
|
+
contentType: contentlet.dataset?.['dotType']
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get container data from VTLS.
|
|
56
|
+
*
|
|
57
|
+
* @export
|
|
58
|
+
* @param {HTMLElement} container
|
|
59
|
+
* @return {*}
|
|
60
|
+
*/
|
|
61
|
+
export function getContainerData(container) {
|
|
62
|
+
return {
|
|
63
|
+
acceptTypes: container.dataset?.['dotAcceptTypes'] || '',
|
|
64
|
+
identifier: container.dataset?.['dotIdentifier'] || '',
|
|
65
|
+
maxContentlets: container.dataset?.['maxContentlets'] || '',
|
|
66
|
+
uuid: container.dataset?.['dotUuid'] || ''
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get the closest container data from the contentlet.
|
|
71
|
+
*
|
|
72
|
+
* @export
|
|
73
|
+
* @param {Element} element
|
|
74
|
+
* @return {*}
|
|
75
|
+
*/
|
|
76
|
+
export function getClosestContainerData(element) {
|
|
77
|
+
// Find the closest ancestor element with data-dot-object="container" attribute
|
|
78
|
+
const container = element.closest('[data-dot-object="container"]');
|
|
79
|
+
// If a container element is found
|
|
80
|
+
if (container) {
|
|
81
|
+
// Return the dataset of the container element
|
|
82
|
+
return getContainerData(container);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// If no container element is found, return null
|
|
86
|
+
console.warn('No container found for the contentlet');
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Find the closest contentlet element based on HTMLElement.
|
|
92
|
+
*
|
|
93
|
+
* @export
|
|
94
|
+
* @param {(HTMLElement | null)} element
|
|
95
|
+
* @return {*}
|
|
96
|
+
*/
|
|
97
|
+
export function findContentletElement(element) {
|
|
98
|
+
if (!element)
|
|
99
|
+
return null;
|
|
100
|
+
if (element.dataset && element.dataset?.['dotObject'] === 'contentlet') {
|
|
101
|
+
return element;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
return findContentletElement(element?.['parentElement']);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=editor.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.utils.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/utils/editor.utils.ts"],"names":[],"mappings":"AAkCA;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAA4B;IAC5D,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QAChC,MAAM,aAAa,GAAG,SAAS,CAAC,qBAAqB,EAAE,CAAC;QACxD,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAC1B,SAAS,CAAC,gBAAgB,CAAC,gCAAgC,CAAC,CAC3C,CAAC;QAEtB,OAAO;YACH,CAAC,EAAE,aAAa,CAAC,CAAC;YAClB,CAAC,EAAE,aAAa,CAAC,CAAC;YAClB,KAAK,EAAE,aAAa,CAAC,KAAK;YAC1B,MAAM,EAAE,aAAa,CAAC,MAAM;YAC5B,OAAO,EAAE;gBACL,SAAS,EAAE,gBAAgB,CAAC,SAAS,CAAC;aACzC;YACD,WAAW,EAA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ACtD,cAAc,EAAE,SAAS,CAAC,OAAO,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE;QAC3D,IAAI,EAAE,SAAS,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE;KAC7C,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACpD,+EAA+E;IAC/E,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,+BAA+B,CAAgB,CAAC;IAElF,kCAAkC;IAClC,IAAI,SAAS,EAAE,CAAC;QACZ,8CAA8C;QAC9C,OAAO,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;SAAM,CAAC;QACJ,gDAAgD;QAChD,OAAO,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;QAEtD,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA2B;IAC7D,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE1B,IAAI,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,KAAK,YAAY,EAAE,CAAC;QACrE,OAAO,OAAO,CAAC;IACnB,CAAC;SAAM,CAAC;QACJ,OAAO,qBAAqB,CAAC,OAAO,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IAC7D,CAAC;AACL,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postMessageToEditor.js","sourceRoot":"","sources":["../../../../../../libs/sdk/client/src/lib/postMessageToEditor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,gBAkBX;AAlBD,WAAY,gBAAgB;IACxB;;OAEG;IACH,uCAAmB,CAAA;IACnB;;OAEG;IACH,6CAAyB,CAAA;IACzB;;OAEG;IACH,qDAAiC,CAAA;IACjC;;OAEG;IACH,4CAAwB,CAAA;IACxB,iCAAa,CAAA;AACjB,CAAC,EAlBW,gBAAgB,KAAhB,gBAAgB,QAkB3B;AAcD;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAc,OAA4B;IACzE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAC5C,CAAC"}
|
package/src/lib/sdk-js-client.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { __awaiter, __rest } from "tslib";
|
|
2
|
-
function isValidUrl(url) {
|
|
3
|
-
try {
|
|
4
|
-
new URL(url);
|
|
5
|
-
return true;
|
|
6
|
-
}
|
|
7
|
-
catch (error) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* `DotCmsClient` is a TypeScript class that provides methods to interact with the DotCMS REST API.
|
|
13
|
-
* It requires a configuration object on instantiation, which includes the DotCMS URL, site ID, and authentication token.
|
|
14
|
-
*
|
|
15
|
-
* @class DotCmsClient
|
|
16
|
-
*
|
|
17
|
-
* @property {ClientConfig} config - The configuration object for the DotCMS client.
|
|
18
|
-
*
|
|
19
|
-
* @method constructor(config: ClientConfig) - Constructs a new instance of the DotCmsClient class.
|
|
20
|
-
*
|
|
21
|
-
* @method getPage(options: PageApiOptions): Promise<unknown> - Retrieves all the elements of any Page in your dotCMS system in JSON format.
|
|
22
|
-
*
|
|
23
|
-
* @method getNav(options: NavApiOptions = { depth: 0, path: '/', languageId: 1 }): Promise<unknown> - Retrieves information about the dotCMS file and folder tree.
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
export class DotCmsClient {
|
|
27
|
-
constructor(config) {
|
|
28
|
-
if (!config.dotcmsUrl) {
|
|
29
|
-
throw new Error("Invalid configuration - 'dotcmsUrl' is required");
|
|
30
|
-
}
|
|
31
|
-
if (!isValidUrl(config.dotcmsUrl)) {
|
|
32
|
-
throw new Error("Invalid configuration - 'dotcmsUrl' must be a valid URL");
|
|
33
|
-
}
|
|
34
|
-
if (!config.authToken) {
|
|
35
|
-
throw new Error("Invalid configuration - 'authToken' is required");
|
|
36
|
-
}
|
|
37
|
-
this.config = config;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* `getPage` is an asynchronous method of the `DotCmsClient` class that retrieves all the elements of any Page in your dotCMS system in JSON format.
|
|
41
|
-
* It takes a `PageApiOptions` object as a parameter and returns a Promise that resolves to the response from the DotCMS API.
|
|
42
|
-
*
|
|
43
|
-
* The Page API enables you to retrieve all the elements of any Page in your dotCMS system.
|
|
44
|
-
* The elements may be retrieved in JSON format.
|
|
45
|
-
*
|
|
46
|
-
* @link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas
|
|
47
|
-
* @method getPage
|
|
48
|
-
* @async
|
|
49
|
-
* @param {PageApiOptions} options - The options for the Page API call.
|
|
50
|
-
* @returns {Promise<unknown>} - A Promise that resolves to the response from the DotCMS API.
|
|
51
|
-
* @throws {Error} - Throws an error if the options are not valid.
|
|
52
|
-
*/
|
|
53
|
-
getPage(options) {
|
|
54
|
-
var _a, _b;
|
|
55
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
this.validatePageOptions(options);
|
|
57
|
-
const queryParamsObj = {};
|
|
58
|
-
for (const [key, value] of Object.entries(options)) {
|
|
59
|
-
if (value !== undefined && key !== 'path') {
|
|
60
|
-
if (key !== 'siteId') {
|
|
61
|
-
if (key === 'personaId') {
|
|
62
|
-
queryParamsObj['com.dotmarketing.persona.id'] = String(value);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
queryParamsObj[key] = String(value);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
const queryHostId = (_b = (_a = options.siteId) !== null && _a !== void 0 ? _a : this.config.siteId) !== null && _b !== void 0 ? _b : '';
|
|
71
|
-
if (queryHostId) {
|
|
72
|
-
queryParamsObj['host_id'] = queryHostId;
|
|
73
|
-
}
|
|
74
|
-
const queryParams = new URLSearchParams(queryParamsObj).toString();
|
|
75
|
-
const formattedPath = options.path.startsWith('/') ? options.path : `/${options.path}`;
|
|
76
|
-
const url = `${this.config.dotcmsUrl}/api/v1/page/json${formattedPath}${queryParams ? `?${queryParams}` : ''}`;
|
|
77
|
-
const response = yield fetch(url, {
|
|
78
|
-
headers: {
|
|
79
|
-
Authorization: `Bearer ${this.config.authToken}`
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
return response.json();
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* `getNav` is an asynchronous method of the `DotCmsClient` class that retrieves information about the dotCMS file and folder tree.
|
|
87
|
-
* It takes a `NavApiOptions` object as a parameter (with default values) and returns a Promise that resolves to the response from the DotCMS API.
|
|
88
|
-
*
|
|
89
|
-
* The navigation REST API enables you to retrieve information about the dotCMS file and folder tree through REST API calls.
|
|
90
|
-
* @link https://www.dotcms.com/docs/latest/navigation-rest-api
|
|
91
|
-
* @method getNav
|
|
92
|
-
* @async
|
|
93
|
-
* @param {NavApiOptions} options - The options for the Nav API call. Defaults to `{ depth: 0, path: '/', languageId: 1 }`.
|
|
94
|
-
* @returns {Promise<unknown>} - A Promise that resolves to the response from the DotCMS API.
|
|
95
|
-
* @throws {Error} - Throws an error if the options are not valid.
|
|
96
|
-
*/
|
|
97
|
-
getNav(options = { depth: 0, path: '/', languageId: 1 }) {
|
|
98
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
this.validateNavOptions(options);
|
|
100
|
-
// Extract the 'path' from the options and prepare the rest as query parameters
|
|
101
|
-
const { path } = options, queryParamsOptions = __rest(options, ["path"]);
|
|
102
|
-
const queryParamsObj = {};
|
|
103
|
-
Object.entries(queryParamsOptions).forEach(([key, value]) => {
|
|
104
|
-
if (value !== undefined) {
|
|
105
|
-
queryParamsObj[key] = String(value);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
const queryParams = new URLSearchParams(queryParamsObj).toString();
|
|
109
|
-
// Format the URL correctly depending on the 'path' value
|
|
110
|
-
const formattedPath = path === '/' ? '/' : `/${path}`;
|
|
111
|
-
const url = `${this.config.dotcmsUrl}/api/v1/nav${formattedPath}${queryParams ? `?${queryParams}` : ''}`;
|
|
112
|
-
const response = yield fetch(url, {
|
|
113
|
-
headers: {
|
|
114
|
-
Authorization: `Bearer ${this.config.authToken}`
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
return response.json();
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
validatePageOptions(options) {
|
|
121
|
-
if (!options.path) {
|
|
122
|
-
throw new Error("The 'path' parameter is required for the Page API");
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
validateNavOptions(options) {
|
|
126
|
-
if (!options.path) {
|
|
127
|
-
throw new Error("The 'path' parameter is required for the Nav API");
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* `dotcmsClient` is an object that provides a method to initialize the DotCMS SDK client.
|
|
133
|
-
* It has a single method `init` which takes a configuration object and returns an instance of the `DotCmsClient` class.
|
|
134
|
-
*
|
|
135
|
-
* @namespace dotcmsClient
|
|
136
|
-
*
|
|
137
|
-
* @method init(config: ClientConfig): DotCmsClient - Initializes the SDK client.
|
|
138
|
-
*/
|
|
139
|
-
export const dotcmsClient = {
|
|
140
|
-
/**
|
|
141
|
-
* `init` is a method of the `dotcmsClient` object that initializes the SDK client.
|
|
142
|
-
* It takes a configuration object as a parameter and returns an instance of the `DotCmsClient` class.
|
|
143
|
-
*
|
|
144
|
-
* @method init
|
|
145
|
-
* @param {ClientConfig} config - The configuration object for the DotCMS client.
|
|
146
|
-
* @returns {DotCmsClient} - An instance of the {@link DotCmsClient} class.
|
|
147
|
-
*/
|
|
148
|
-
init: (config) => {
|
|
149
|
-
return new DotCmsClient(config);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
//# sourceMappingURL=sdk-js-client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-js-client.js","sourceRoot":"","sources":["../../../../../../libs/sdk/client/src/lib/sdk-js-client.ts"],"names":[],"mappings":";AAyGA,SAAS,UAAU,CAAC,GAAW;IAC3B,IAAI;QACA,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAEb,OAAO,IAAI,CAAC;KACf;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,KAAK,CAAC;KAChB;AACL,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,YAAY;IAGrB,YAAY,MAAoB;QAC5B,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACtE;QAED,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;SAC9E;QAED,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACtE;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACG,OAAO,CAAC,OAAuB;;;YACjC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;YAElC,MAAM,cAAc,GAA2B,EAAE,CAAC;YAClD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gBAChD,IAAI,KAAK,KAAK,SAAS,IAAI,GAAG,KAAK,MAAM,EAAE;oBACvC,IAAI,GAAG,KAAK,QAAQ,EAAE;wBAClB,IAAI,GAAG,KAAK,WAAW,EAAE;4BACrB,cAAc,CAAC,6BAA6B,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;yBACjE;6BAAM;4BACH,cAAc,CAAC,G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