@dotcms/client 0.0.1-alpha.37 → 0.0.1-alpha.39

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.
Files changed (66) hide show
  1. package/.eslintrc.json +18 -0
  2. package/README.md +4 -4
  3. package/jest.config.ts +15 -0
  4. package/package.json +3 -15
  5. package/project.json +72 -0
  6. package/src/index.ts +30 -0
  7. package/src/lib/client/content/builders/collection/collection.spec.ts +515 -0
  8. package/src/lib/client/content/builders/collection/collection.ts +416 -0
  9. package/src/lib/client/content/content-api.ts +139 -0
  10. package/src/lib/client/content/shared/const.ts +15 -0
  11. package/src/lib/client/content/shared/types.ts +155 -0
  12. package/src/lib/client/content/shared/utils.ts +28 -0
  13. package/src/lib/client/models/index.ts +19 -0
  14. package/src/lib/client/models/types.ts +14 -0
  15. package/src/lib/client/sdk-js-client.spec.ts +483 -0
  16. package/src/lib/client/sdk-js-client.ts +442 -0
  17. package/src/lib/editor/listeners/listeners.spec.ts +119 -0
  18. package/src/lib/editor/listeners/listeners.ts +223 -0
  19. package/src/lib/editor/models/{client.model.d.ts → client.model.ts} +19 -16
  20. package/src/lib/editor/models/{editor.model.d.ts → editor.model.ts} +9 -5
  21. package/src/lib/editor/models/{listeners.model.d.ts → listeners.model.ts} +9 -6
  22. package/src/lib/editor/sdk-editor-vtl.ts +31 -0
  23. package/src/lib/editor/sdk-editor.spec.ts +116 -0
  24. package/src/lib/editor/sdk-editor.ts +105 -0
  25. package/src/lib/editor/utils/editor.utils.spec.ts +206 -0
  26. package/src/lib/editor/utils/editor.utils.ts +258 -0
  27. package/src/lib/query-builder/lucene-syntax/{Equals.d.ts → Equals.ts} +83 -18
  28. package/src/lib/query-builder/lucene-syntax/Field.ts +40 -0
  29. package/src/lib/query-builder/lucene-syntax/{NotOperand.d.ts → NotOperand.ts} +18 -6
  30. package/src/lib/query-builder/lucene-syntax/{Operand.d.ts → Operand.ts} +21 -7
  31. package/src/lib/query-builder/sdk-query-builder.spec.ts +159 -0
  32. package/src/lib/query-builder/sdk-query-builder.ts +87 -0
  33. package/src/lib/query-builder/utils/index.ts +179 -0
  34. package/src/lib/utils/graphql/transforms.spec.ts +150 -0
  35. package/src/lib/utils/graphql/transforms.ts +99 -0
  36. package/src/lib/utils/page/common-utils.spec.ts +37 -0
  37. package/src/lib/utils/page/common-utils.ts +64 -0
  38. package/tsconfig.json +22 -0
  39. package/tsconfig.lib.json +13 -0
  40. package/tsconfig.spec.json +9 -0
  41. package/index.cjs.d.ts +0 -1
  42. package/index.cjs.default.js +0 -1
  43. package/index.cjs.js +0 -1490
  44. package/index.cjs.mjs +0 -2
  45. package/index.esm.d.ts +0 -1
  46. package/index.esm.js +0 -1481
  47. package/src/index.d.ts +0 -6
  48. package/src/lib/client/content/builders/collection/collection.d.ts +0 -148
  49. package/src/lib/client/content/content-api.d.ts +0 -78
  50. package/src/lib/client/content/shared/const.d.ts +0 -3
  51. package/src/lib/client/content/shared/types.d.ts +0 -62
  52. package/src/lib/client/content/shared/utils.d.ts +0 -12
  53. package/src/lib/client/models/index.d.ts +0 -1
  54. package/src/lib/client/models/types.d.ts +0 -5
  55. package/src/lib/client/sdk-js-client.d.ts +0 -193
  56. package/src/lib/editor/listeners/listeners.d.ts +0 -46
  57. package/src/lib/editor/sdk-editor-vtl.d.ts +0 -6
  58. package/src/lib/editor/sdk-editor.d.ts +0 -29
  59. package/src/lib/editor/utils/editor.utils.d.ts +0 -83
  60. package/src/lib/query-builder/lucene-syntax/Field.d.ts +0 -23
  61. package/src/lib/query-builder/sdk-query-builder.d.ts +0 -42
  62. package/src/lib/query-builder/utils/index.d.ts +0 -91
  63. package/src/lib/utils/graphql/transforms.d.ts +0 -11
  64. package/src/lib/utils/page/common-utils.d.ts +0 -11
  65. /package/src/lib/query-builder/lucene-syntax/{index.d.ts → index.ts} +0 -0
  66. /package/src/lib/utils/{index.d.ts → index.ts} +0 -0
package/src/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { ClientConfig, DotCmsClient } from './lib/client/sdk-js-client';
2
- import { CUSTOMER_ACTIONS, postMessageToEditor } from './lib/editor/models/client.model';
3
- import { CustomClientParams, DotCMSPageEditorConfig, EditorConfig } from './lib/editor/models/editor.model';
4
- import { destroyEditor, initEditor, isInsideEditor, updateNavigation } from './lib/editor/sdk-editor';
5
- import { getPageRequestParams, graphqlToPageEntity } from './lib/utils';
6
- export { graphqlToPageEntity, getPageRequestParams, isInsideEditor, DotCmsClient, DotCMSPageEditorConfig, CUSTOMER_ACTIONS, CustomClientParams, postMessageToEditor, EditorConfig, initEditor, updateNavigation, destroyEditor, ClientConfig };
@@ -1,148 +0,0 @@
1
- import { ClientOptions } from '../../../sdk-js-client';
2
- import { GetCollectionResponse, BuildQuery, SortBy, GetCollectionError, OnFullfilled, OnRejected } from '../../shared/types';
3
- /**
4
- * Creates a Builder to filter and fetch content from the content API for an specific content type
5
- *
6
- * @export
7
- * @class CollectionBuilder
8
- * @template T Represents the type of the content type to fetch. Defaults to unknown
9
- */
10
- export declare class CollectionBuilder<T = unknown> {
11
- #private;
12
- constructor(requestOptions: ClientOptions, serverUrl: string, contentType: string);
13
- /**
14
- * This method returns the sort query in this format: field order, field order, ...
15
- *
16
- * @readonly
17
- * @private
18
- * @memberof CollectionBuilder
19
- */
20
- private get sort();
21
- private get offset();
22
- private get url();
23
- /**
24
- * This method returns the current query built
25
- *
26
- * @readonly
27
- * @private
28
- * @memberof CollectionBuilder
29
- */
30
- private get currentQuery();
31
- /**
32
- * Takes a language id and filters the content by that language.
33
- *
34
- * The language id defaults to 1
35
- *
36
- *
37
- * @param {number | string} languageId The language id to filter the content by
38
- * @return {CollectionBuilder} CollectionBuilder - A CollectionBuilder instance
39
- * @memberof CollectionBuilder
40
- */
41
- language(languageId: number | string): this;
42
- /**
43
- * The retrieved content will have the rendered HTML
44
- *
45
- * @return {CollectionBuilder} CollectionBuilder - A CollectionBuilder instance
46
- * @memberof CollectionBuilder
47
- */
48
- render(): this;
49
- /**
50
- * Takes an array of constrains to sort the content by field an specific order
51
- *
52
- * @example
53
- * ```javascript
54
- * // This will sort the content by title in ascending order
55
- * // and by modDate in descending order
56
- * const sortBy = [{ field: 'title', order: 'asc' }, { field: 'modDate', order: 'desc' }]
57
- *
58
- * client.content.getCollection("Blog").sortBy(sortBy)
59
- *```
60
- *
61
- * @param {SortBy[]} sortBy Array of constrains to sort the content by
62
- * @return {CollectionBuilder} CollectionBuilder - A CollectionBuilder instance
63
- * @memberof CollectionBuilder
64
- */
65
- sortBy(sortBy: SortBy[]): this;
66
- /**
67
- * Takes a number that represents the max amount of content to fetch
68
- *
69
- * `limit` is set to 10 by default
70
- *
71
- * @param {number} limit The max amount of content to fetch
72
- * @return {CollectionBuilder} CollectionBuilder - A CollectionBuilder instance
73
- * @memberof CollectionBuilder
74
- */
75
- limit(limit: number): this;
76
- /**
77
- * Takes a number that represents the page to fetch
78
- *
79
- * @param {number} page The page to fetch
80
- * @return {CollectionBuilder} CollectionBuilder - A CollectionBuilder instance
81
- * @memberof CollectionBuilder
82
- */
83
- page(page: number): this;
84
- /**
85
- * Takes a string that represents a {@link https://www.dotcms.com/docs/latest/content-search-syntax#Lucene Lucene Query} that is used to filter the content to fetch.
86
- *
87
- * The string is not validated, so be cautious when using it.
88
- *
89
- * @param {string} query A {@link https://www.dotcms.com/docs/latest/content-search-syntax#Lucene Lucene Query} String
90
- * @return {CollectionBuilder} CollectionBuilder - A CollectionBuilder instance
91
- * @memberof CollectionBuilder
92
- */
93
- query(query: string): this;
94
- /**
95
- * Takes a function that recieves a QueryBuilder to buid a query for content filtering.
96
- * @example
97
- *```javascript
98
- * // This will filter the content by title equals 'Hello World' or 'Hello World 2'
99
- * client.content.getCollection("Activity").query((queryBuilder) =>
100
- * queryBuilder.field('title').equals('Hello World').or().equals('Hello World 2')
101
- * );
102
- *```
103
- * @param {BuildQuery} buildQuery A function that receives a QueryBuilder instance and returns a valid query
104
- * @return {CollectionBuilder} CollectionBuilder - A CollectionBuilder instance
105
- * @memberof CollectionBuilder
106
- */
107
- query(buildQuery: BuildQuery): this;
108
- /**
109
- * The retrieved content will be draft content
110
- *
111
- * The default value is false to fetch content that is not on draft
112
- *
113
- * @return {CollectionBuilder} CollectionBuilder - A CollectionBuilder instance
114
- * @memberof CollectionBuilder
115
- */
116
- draft(): this;
117
- /**
118
- * Takes a string that represents a variant ID of content created with the {@link https://www.dotcms.com/docs/latest/experiments-and-a-b-testing A/B Testing} feature
119
- *
120
- * `variantId` defaults to "DEFAULT" to fetch content that is not part of an A/B test
121
- *
122
- * @param {string} variantId A string that represents a variant ID
123
- * @return {CollectionBuilder} CollectionBuilder - A CollectionBuilder instance
124
- * @memberof CollectionBuilder
125
- */
126
- variant(variantId: string): this;
127
- /**
128
- * Takes a number that represents the depth of the relationships of a content
129
- *
130
- * The `depth` is set to 0 by default and the max supported value is 3.
131
- *
132
- * @param {number} depth The depth of the relationships of a content
133
- * @return {CollectionBuilder} CollectionBuilder - A CollectionBuilder instance
134
- * @memberof CollectionBuilder
135
- */
136
- depth(depth: number): this;
137
- /**
138
- * Executes the fetch and returns a promise that resolves to the content or rejects to an error
139
- *
140
- * @param {OnFullfilled} [onfulfilled] A callback that is called when the fetch is successful
141
- * @param {OnRejected} [onrejected] A callback that is called when the fetch fails
142
- * @return {Promise<GetCollectionResponse<T> | GetCollectionError>} A promise that resolves to the content or rejects to an error
143
- * @memberof CollectionBuilder
144
- */
145
- then(onfulfilled?: OnFullfilled<T>, onrejected?: OnRejected): Promise<GetCollectionResponse<T> | GetCollectionError>;
146
- private formatResponse;
147
- private fetch;
148
- }
@@ -1,78 +0,0 @@
1
- import { CollectionBuilder } from './builders/collection/collection';
2
- import { ClientOptions } from '../sdk-js-client';
3
- /**
4
- * Content classs exposes the content api methods
5
- *
6
- * @export
7
- * @class Content
8
- */
9
- export declare class Content {
10
- #private;
11
- constructor(requestOptions: ClientOptions, serverUrl: string);
12
- /**
13
- * Takes a content type and returns a builder to filter and fetch the collection
14
- *
15
- * @example
16
- * ```javascript
17
- * // Using await and async
18
- * const collectionResponse = await client.content
19
- * .getCollection('Blog')
20
- * .limit(10)
21
- * .page(2)
22
- * .sortBy([{ field: 'title', order: 'asc' }])
23
- * .query((queryBuilder) => queryBuilder.field('author').equals('John Doe'))
24
- * .depth(1);
25
- * ```
26
- * @example
27
- * ```javascript
28
- * // Using then and catch
29
- * client.content
30
- * .getCollection('Blog')
31
- * .limit(10)
32
- * .page(2)
33
- * .sortBy([{ field: 'title', order: 'asc' }])
34
- * .query((queryBuilder) => queryBuilder.field('author').equals('John Doe'))
35
- * .depth(1)
36
- * .then((response) => {
37
- * console.log(response.contentlets);
38
- * })
39
- * .catch((error) => {
40
- * console.error(error);
41
- * });
42
- * ```
43
- * @example
44
- * ```typescript
45
- * // Using an specific type for your content
46
- *
47
- * type Blog = {
48
- * summary: string;
49
- * author: string;
50
- * title: string;
51
- * };
52
- *
53
- * client.content
54
- * .getCollection<Blog>('Blog')
55
- * .limit(10)
56
- * .page(2)
57
- * .sortBy([{ field: 'title', order: 'asc' }])
58
- * .query((queryBuilder) => queryBuilder.field('author').equals('John Doe'))
59
- * .depth(1)
60
- * .then((response) => {
61
- * response.contentlets.forEach((blog) => {
62
- * console.log(blog.title);
63
- * console.log(blog.author);
64
- * console.log(blog.summary);
65
- * });
66
- * })
67
- * .catch((error) => {
68
- * console.error(error);
69
- * });
70
- * ```
71
- *
72
- * @param {string} contentType The content type to get the collection
73
- * @return {CollectionBuilder} CollectionBuilder to filter and fetch the collection
74
- * @template T Represents the type of the content type to fetch. Defaults to unknown
75
- * @memberof Content
76
- */
77
- getCollection<T = unknown>(contentType: string): CollectionBuilder<T>;
78
- }
@@ -1,3 +0,0 @@
1
- export declare const DEFAULT_VARIANT_ID = "DEFAULT";
2
- export declare const CONTENT_TYPE_MAIN_FIELDS: string[];
3
- export declare const CONTENT_API_URL = "/api/content/_search";
@@ -1,62 +0,0 @@
1
- import { Equals } from '../../../query-builder/lucene-syntax';
2
- import { QueryBuilder } from '../../../query-builder/sdk-query-builder';
3
- export type SortBy = {
4
- field: string;
5
- order: 'asc' | 'desc';
6
- };
7
- export type BuildQuery = (qb: QueryBuilder) => Equals;
8
- export interface ContentTypeMainFields {
9
- hostName: string;
10
- modDate: string;
11
- publishDate: string;
12
- title: string;
13
- baseType: string;
14
- inode: string;
15
- archived: boolean;
16
- ownerName: string;
17
- host: string;
18
- working: boolean;
19
- locked: boolean;
20
- stInode: string;
21
- contentType: string;
22
- live: boolean;
23
- owner: string;
24
- identifier: string;
25
- publishUserName: string;
26
- publishUser: string;
27
- languageId: number;
28
- creationDate: string;
29
- url: string;
30
- titleImage: string;
31
- modUserName: string;
32
- hasLiveVersion: boolean;
33
- folder: string;
34
- hasTitleImage: boolean;
35
- sortOrder: number;
36
- modUser: string;
37
- __icon__: string;
38
- contentTypeIcon: string;
39
- variant: string;
40
- }
41
- export type Contentlet<T> = T & ContentTypeMainFields;
42
- export type OnFullfilled<T> = ((value: GetCollectionResponse<T>) => GetCollectionResponse<T> | PromiseLike<GetCollectionResponse<T>> | void) | undefined | null;
43
- export type OnRejected = ((error: GetCollectionError) => GetCollectionError | PromiseLike<GetCollectionError> | void) | undefined | null;
44
- export interface GetCollectionResponse<T> {
45
- contentlets: Contentlet<T>[];
46
- page: number;
47
- size: number;
48
- total: number;
49
- sortedBy?: SortBy[];
50
- }
51
- export interface GetCollectionRawResponse<T> {
52
- entity: {
53
- jsonObjectView: {
54
- contentlets: Contentlet<T>[];
55
- };
56
- resultsSize: number;
57
- };
58
- }
59
- export interface GetCollectionError {
60
- status: number;
61
- [key: string]: unknown;
62
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * Sanitizes the query for the given content type.
3
- * It replaces the fields that are not contentType fields with the correct format.
4
- * Example: +field: -> +contentTypeVar.field:
5
- *
6
- *
7
- * @export
8
- * @param {string} query
9
- * @param {string} contentType
10
- * @return {*} {string}
11
- */
12
- export declare function sanitizeQueryForContentType(query: string, contentType: string): string;
@@ -1 +0,0 @@
1
- export declare const ErrorMessages: Record<number, string>;
@@ -1,5 +0,0 @@
1
- export type DotcmsClientListener = {
2
- action: string;
3
- event: string;
4
- callback: (...args: any[]) => void;
5
- };
@@ -1,193 +0,0 @@
1
- import { Content } from './content/content-api';
2
- export type ClientOptions = Omit<RequestInit, 'body' | 'method'>;
3
- export interface ClientConfig {
4
- /**
5
- * The URL of the dotCMS instance.
6
- *
7
- * @description This is the URL of the dotCMS instance you want to interact with. Ensure to include the protocol (http or https).
8
- * @example `https://demo.dotcms.com`
9
- * @type {string}
10
- * @required
11
- */
12
- dotcmsUrl: string;
13
- /**
14
- * The id of the site you want to interact with.
15
- *
16
- * @description to get the site id, go to the site you want to interact with and copy the id from the History tab
17
- *
18
- * @type {string}
19
- * @required
20
- */
21
- siteId?: string;
22
- /**
23
- * The authentication token to use for the requests. If not provided, it will fallback to default site.
24
- *
25
- * @description you can get the auth token from our UI {@link https://www.dotcms.com/docs/latest/rest-api-authentication#creating-an-api-token-in-the-ui}
26
- *
27
- * @type {string}
28
- * @required
29
- */
30
- authToken: string;
31
- /**
32
- * Additional options to pass to the fetch request.
33
- *
34
- * @description These options will be used in the fetch request. Any option can be specified except for 'body' and 'method' which are omitted.
35
- * @example `{ headers: { 'Content-Type': 'application/json' } }`
36
- * @type {ClientOptions}
37
- * @optional
38
- */
39
- requestOptions?: ClientOptions;
40
- }
41
- type PageApiOptions = {
42
- /**
43
- * The path of the page you want to retrieve.
44
- *
45
- * @type {string}
46
- */
47
- path: string;
48
- /**
49
- * The id of the site you want to interact with. If not provided, the one from the config will be used.
50
- *
51
- * @type {number}
52
- */
53
- siteId?: string;
54
- /**
55
- * The mode of the page you want to retrieve. If not provided will use the default mode of the site.
56
- *
57
- * @type {number}
58
- */
59
- mode?: string;
60
- /**
61
- * The language id of the page you want to retrieve. If not provided will use the default language of the site.
62
- *
63
- * @type {number}
64
- */
65
- language_id?: number;
66
- /**
67
- * The id of the persona you want to retrieve the page for.
68
- *
69
- * @type {string}
70
- */
71
- personaId?: string;
72
- /**
73
- * If you want to fire the rules set on the page
74
- *
75
- * @type {boolean}
76
- */
77
- fireRules?: boolean;
78
- /**
79
- * Allows access to related content via the Relationship fields of contentlets on a Page; 0 (default)
80
- *
81
- * @type {number}
82
- */
83
- depth?: number;
84
- };
85
- type NavApiOptions = {
86
- /**
87
- * The root path to begin traversing the folder tree.
88
- *
89
- * @example
90
- * `/api/v1/nav/` starts from the root of the site
91
- * @example
92
- * `/about-us` starts from the "About Us" folder
93
- *
94
- * @type {string}
95
- */
96
- path: string;
97
- /**
98
- * The depth of the folder tree to return.
99
- * @example
100
- * `1` returns only the element specified in the path.
101
- * @example
102
- * `2` returns the element specified in the path, and if that element is a folder, returns all direct children of that folder.
103
- * @example
104
- * `3` returns all children and grandchildren of the element specified in the path.
105
- *
106
- * @type {number}
107
- */
108
- depth?: number;
109
- /**
110
- * The language ID of content to return.
111
- * @example
112
- * `1` (or unspecified) returns content in the default language of the site.
113
- *
114
- * @link https://www.dotcms.com/docs/latest/system-language-properties#DefaultLanguage
115
- * @link https://www.dotcms.com/docs/latest/adding-and-editing-languages#LanguageID
116
- * @type {number}
117
- */
118
- languageId?: number;
119
- };
120
- /**
121
- * `DotCmsClient` is a TypeScript class that provides methods to interact with the DotCMS REST API.
122
- * It requires a configuration object on instantiation, which includes the DotCMS URL, site ID, and authentication token.
123
- *
124
- * @class DotCmsClient
125
- *
126
- * @property {ClientConfig} config - The configuration object for the DotCMS client.
127
- *
128
- * @method constructor(config: ClientConfig) - Constructs a new instance of the DotCmsClient class.
129
- *
130
- * @method page.get(options: PageApiOptions): Promise<unknown> - Retrieves all the elements of any Page in your dotCMS system in JSON format.
131
- *
132
- * @method nav.get(options: NavApiOptions = { depth: 0, path: '/', languageId: 1 }): Promise<unknown> - Retrieves information about the dotCMS file and folder tree.
133
- *
134
- */
135
- export declare class DotCmsClient {
136
- #private;
137
- static instance: DotCmsClient;
138
- dotcmsUrl?: string;
139
- content: Content;
140
- constructor(config?: ClientConfig);
141
- page: {
142
- /**
143
- * `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.
144
- * It takes a `PageApiOptions` object as a parameter and returns a Promise that resolves to the response from the DotCMS API.
145
- *
146
- * The Page API enables you to retrieve all the elements of any Page in your dotCMS system.
147
- * The elements may be retrieved in JSON format.
148
- *
149
- * @link https://www.dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas
150
- * @async
151
- * @param {PageApiOptions} options - The options for the Page API call.
152
- * @returns {Promise<unknown>} - A Promise that resolves to the response from the DotCMS API.
153
- * @throws {Error} - Throws an error if the options are not valid.
154
- */
155
- get: (options: PageApiOptions) => Promise<unknown>;
156
- };
157
- editor: {
158
- /**
159
- * `editor.on` is an asynchronous method of the `DotCmsClient` class that allows you to react to actions issued by the UVE.
160
- *
161
- * NOTE: This is being used by the development team - This logic is probably varied or moved to another function/object.
162
- * @param action - The name of the name emitted by UVE
163
- * @param callbackFn - The function to execute when the UVE emits the action
164
- */
165
- on: (action: string, callbackFn: (payload: unknown) => void) => void;
166
- /**
167
- * `editor.off` is an synchronous method of the `DotCmsClient` class that allows you to stop listening and reacting to an action issued by UVE.
168
- *
169
- * NOTE: This is being used by the development team - This logic is probably varied or moved to another function/object.
170
- * @param action
171
- */
172
- off: (action: string) => void;
173
- };
174
- nav: {
175
- /**
176
- * `nav.get` is an asynchronous method of the `DotCmsClient` class that retrieves information about the dotCMS file and folder tree.
177
- * It takes a `NavApiOptions` object as a parameter (with default values) and returns a Promise that resolves to the response from the DotCMS API.
178
- *
179
- * The navigation REST API enables you to retrieve information about the dotCMS file and folder tree through REST API calls.
180
- * @link https://www.dotcms.com/docs/latest/navigation-rest-api
181
- * @async
182
- * @param {NavApiOptions} options - The options for the Nav API call. Defaults to `{ depth: 0, path: '/', languageId: 1 }`.
183
- * @returns {Promise<unknown>} - A Promise that resolves to the response from the DotCMS API.
184
- * @throws {Error} - Throws an error if the options are not valid.
185
- */
186
- get: (options?: NavApiOptions) => Promise<unknown>;
187
- };
188
- static init(config: ClientConfig): DotCmsClient;
189
- static get dotcmsUrl(): string;
190
- private validatePageOptions;
191
- private validateNavOptions;
192
- }
193
- export {};
@@ -1,46 +0,0 @@
1
- import { DotCMSPageEditorSubscription } from '../models/listeners.model';
2
- declare global {
3
- interface Window {
4
- lastScrollYPosition: number;
5
- }
6
- }
7
- /**
8
- * Represents an array of DotCMSPageEditorSubscription objects.
9
- * Used to store the subscriptions for the editor and unsubscribe later.
10
- */
11
- export declare const subscriptions: DotCMSPageEditorSubscription[];
12
- /**
13
- * Listens for editor messages and performs corresding actions based on the received message.
14
- *
15
- * @private
16
- * @memberof DotCMSPageEditor
17
- */
18
- export declare function listenEditorMessages(): void;
19
- /**
20
- * Listens for pointer move events and extracts information about the hovered contentlet.
21
- *
22
- * @private
23
- * @memberof DotCMSPageEditor
24
- */
25
- export declare function listenHoveredContentlet(): void;
26
- /**
27
- * Attaches a scroll event listener to the window
28
- * and sends a message to the editor when the window is scrolled.
29
- *
30
- * @private
31
- * @memberof DotCMSPageEditor
32
- */
33
- export declare function scrollHandler(): void;
34
- /**
35
- * Restores the scroll position of the window when an iframe is loaded.
36
- * Only used in VTL Pages.
37
- * @export
38
- */
39
- export declare function preserveScrollOnIframe(): void;
40
- /**
41
- * Sends a message to the editor to get the page data.
42
- * @param {string} pathname - The pathname of the page.
43
- * @private
44
- * @memberof DotCMSPageEditor
45
- */
46
- export declare function fetchPageDataFromInsideUVE(pathname: string): void;
@@ -1,6 +0,0 @@
1
- declare global {
2
- interface Window {
3
- lastScrollYPosition: number;
4
- }
5
- }
6
- export {};
@@ -1,29 +0,0 @@
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;
24
- /**
25
- * Adds a class to empty contentlets.
26
- *
27
- * @export
28
- */
29
- export declare function addClassToEmptyContentlets(): void;
@@ -1,83 +0,0 @@
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 ContainerBound
17
- */
18
- interface ContainerBound {
19
- x: number;
20
- y: number;
21
- width: number;
22
- height: number;
23
- payload: string;
24
- contentlets: ContentletBound[];
25
- }
26
- /**
27
- * Calculates the bounding information for each page element within the given containers.
28
- *
29
- * @export
30
- * @param {HTMLDivElement[]} containers
31
- * @return {*} An array of objects containing the bounding information for each page element.
32
- */
33
- export declare function getPageElementBound(containers: HTMLDivElement[]): ContainerBound[];
34
- /**
35
- * An array of objects containing the bounding information for each contentlet inside a container.
36
- *
37
- * @export
38
- * @param {DOMRect} containerRect
39
- * @param {HTMLDivElement[]} contentlets
40
- * @return {*}
41
- */
42
- export declare function getContentletsBound(containerRect: DOMRect, contentlets: HTMLDivElement[]): ContentletBound[];
43
- /**
44
- * Get container data from VTLS.
45
- *
46
- * @export
47
- * @param {HTMLElement} container
48
- * @return {*}
49
- */
50
- export declare function getContainerData(container: HTMLElement): {
51
- acceptTypes: string;
52
- identifier: string;
53
- maxContentlets: string;
54
- uuid: string;
55
- };
56
- /**
57
- * Get the closest container data from the contentlet.
58
- *
59
- * @export
60
- * @param {Element} element
61
- * @return {*}
62
- */
63
- export declare function getClosestContainerData(element: Element): {
64
- acceptTypes: string;
65
- identifier: string;
66
- maxContentlets: string;
67
- uuid: string;
68
- } | null;
69
- /**
70
- * Find the closest contentlet element based on HTMLElement.
71
- *
72
- * @export
73
- * @param {(HTMLElement | null)} element
74
- * @return {*}
75
- */
76
- export declare function findDotElement(element: HTMLElement | null): HTMLElement | null;
77
- export declare function findDotVTLElement(element: HTMLElement | null): HTMLElement | null;
78
- export declare function findVTLData(target: HTMLElement): {
79
- inode: string | undefined;
80
- name: string | undefined;
81
- }[] | null;
82
- export declare function scrollIsInBottom(): boolean;
83
- export {};