@dotcms/angular 0.0.1-beta.4 → 0.0.1-beta.40

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 (165) hide show
  1. package/README.md +642 -167
  2. package/dotcms-angular.d.ts.map +1 -1
  3. package/esm2022/dotcms-angular.mjs +2 -2
  4. package/esm2022/lib/deprecated/components/dot-editable-text/dot-editable-text.component.mjs +229 -0
  5. package/esm2022/lib/deprecated/components/dot-editable-text/utils.mjs +43 -0
  6. package/esm2022/lib/deprecated/components/no-component/no-component.component.mjs +32 -0
  7. package/esm2022/lib/deprecated/deprecated-api.mjs +11 -0
  8. package/esm2022/lib/{layout → deprecated/layout}/column/column.component.mjs +1 -1
  9. package/esm2022/lib/deprecated/layout/container/container.component.mjs +126 -0
  10. package/esm2022/lib/deprecated/layout/contentlet/contentlet.component.mjs +120 -0
  11. package/esm2022/lib/deprecated/layout/dotcms-layout/dotcms-layout.component.mjs +106 -0
  12. package/esm2022/lib/{layout → deprecated/layout}/row/row.component.mjs +1 -1
  13. package/esm2022/lib/deprecated/models/dotcms.model.mjs +3 -0
  14. package/esm2022/lib/deprecated/models/index.mjs +3 -0
  15. package/esm2022/lib/deprecated/services/dotcms-context/page-context.service.mjs +79 -0
  16. package/esm2022/lib/deprecated/utils/image_loader.mjs +74 -0
  17. package/esm2022/lib/deprecated/utils/index.mjs +84 -0
  18. package/esm2022/next/components/dotcms-block-editor-renderer/blocks/code.component.mjs +49 -0
  19. package/esm2022/next/components/dotcms-block-editor-renderer/blocks/dot-contentlet.component.mjs +125 -0
  20. package/esm2022/next/components/dotcms-block-editor-renderer/blocks/image.component.mjs +25 -0
  21. package/esm2022/next/components/dotcms-block-editor-renderer/blocks/list.component.mjs +66 -0
  22. package/esm2022/next/components/dotcms-block-editor-renderer/blocks/table.component.mjs +97 -0
  23. package/esm2022/next/components/dotcms-block-editor-renderer/blocks/text.component.mjs +231 -0
  24. package/esm2022/next/components/dotcms-block-editor-renderer/blocks/unknown.component.mjs +65 -0
  25. package/esm2022/next/components/dotcms-block-editor-renderer/blocks/video.component.mjs +48 -0
  26. package/esm2022/next/components/dotcms-block-editor-renderer/dotcms-block-editor-renderer.component.mjs +50 -0
  27. package/esm2022/next/components/dotcms-block-editor-renderer/item/dotcms-block-editor-item.component.mjs +45 -0
  28. package/esm2022/next/components/dotcms-editable-text/dotcms-editable-text.component.mjs +240 -0
  29. package/esm2022/next/components/dotcms-editable-text/utils.mjs +20 -0
  30. package/esm2022/next/components/dotcms-layout-body/components/column/column.component.mjs +45 -0
  31. package/esm2022/next/components/dotcms-layout-body/components/container/components/container-not-found/container-not-found.component.mjs +52 -0
  32. package/esm2022/next/components/dotcms-layout-body/components/container/components/empty-container/empty-container.component.mjs +47 -0
  33. package/esm2022/next/components/dotcms-layout-body/components/container/container.component.mjs +99 -0
  34. package/esm2022/next/components/dotcms-layout-body/components/contentlet/contentlet.component.mjs +145 -0
  35. package/esm2022/next/components/dotcms-layout-body/components/fallback-component/fallback-component.component.mjs +47 -0
  36. package/esm2022/next/components/dotcms-layout-body/components/page-error-message/page-error-message.component.mjs +55 -0
  37. package/esm2022/next/components/dotcms-layout-body/components/row/row.component.mjs +46 -0
  38. package/esm2022/next/components/dotcms-layout-body/dotcms-layout-body.component.mjs +69 -0
  39. package/esm2022/next/directives/dotcms-show-when/dotcms-show-when.directive.mjs +49 -0
  40. package/esm2022/next/dotcms-angular-next.mjs +5 -0
  41. package/esm2022/next/models/index.mjs +3 -0
  42. package/esm2022/next/providers/dotcms-client/dotcms-client.provider.mjs +52 -0
  43. package/esm2022/next/providers/dotcms-image-loader/dotcms-image_loader.mjs +74 -0
  44. package/esm2022/next/public_api.mjs +8 -0
  45. package/esm2022/next/services/dotcms-editable-page.service.mjs +93 -0
  46. package/esm2022/next/store/dotcms.store.mjs +61 -0
  47. package/esm2022/public_api.mjs +2 -0
  48. package/fesm2022/dotcms-angular-next.mjs +1904 -0
  49. package/fesm2022/dotcms-angular-next.mjs.map +1 -0
  50. package/fesm2022/dotcms-angular.mjs +103 -10
  51. package/fesm2022/dotcms-angular.mjs.map +1 -1
  52. package/index.d.ts +6 -5
  53. package/lib/{components → deprecated/components}/dot-editable-text/dot-editable-text.component.d.ts +10 -6
  54. package/lib/deprecated/components/dot-editable-text/dot-editable-text.component.d.ts.map +1 -0
  55. package/lib/deprecated/components/dot-editable-text/utils.d.ts.map +1 -0
  56. package/lib/deprecated/components/no-component/no-component.component.d.ts.map +1 -0
  57. package/lib/deprecated/deprecated-api.d.ts +11 -0
  58. package/lib/deprecated/deprecated-api.d.ts.map +1 -0
  59. package/lib/deprecated/layout/column/column.component.d.ts.map +1 -0
  60. package/lib/deprecated/layout/container/container.component.d.ts.map +1 -0
  61. package/lib/deprecated/layout/contentlet/contentlet.component.d.ts.map +1 -0
  62. package/lib/{layout → deprecated/layout}/dotcms-layout/dotcms-layout.component.d.ts +5 -0
  63. package/lib/deprecated/layout/dotcms-layout/dotcms-layout.component.d.ts.map +1 -0
  64. package/lib/deprecated/layout/row/row.component.d.ts.map +1 -0
  65. package/lib/{models → deprecated/models}/dotcms.model.d.ts +2 -2
  66. package/lib/deprecated/models/dotcms.model.d.ts.map +1 -0
  67. package/lib/deprecated/models/index.d.ts.map +1 -0
  68. package/lib/{services → deprecated/services}/dotcms-context/page-context.service.d.ts +4 -0
  69. package/lib/deprecated/services/dotcms-context/page-context.service.d.ts.map +1 -0
  70. package/lib/deprecated/utils/image_loader.d.ts +21 -0
  71. package/lib/deprecated/utils/image_loader.d.ts.map +1 -0
  72. package/lib/deprecated/utils/index.d.ts.map +1 -0
  73. package/next/components/dotcms-block-editor-renderer/blocks/code.component.d.ts +10 -0
  74. package/next/components/dotcms-block-editor-renderer/blocks/code.component.d.ts.map +1 -0
  75. package/next/components/dotcms-block-editor-renderer/blocks/dot-contentlet.component.d.ts +34 -0
  76. package/next/components/dotcms-block-editor-renderer/blocks/dot-contentlet.component.d.ts.map +1 -0
  77. package/next/components/dotcms-block-editor-renderer/blocks/image.component.d.ts +9 -0
  78. package/next/components/dotcms-block-editor-renderer/blocks/image.component.d.ts.map +1 -0
  79. package/next/components/dotcms-block-editor-renderer/blocks/list.component.d.ts +14 -0
  80. package/next/components/dotcms-block-editor-renderer/blocks/list.component.d.ts.map +1 -0
  81. package/next/components/dotcms-block-editor-renderer/blocks/table.component.d.ts +10 -0
  82. package/next/components/dotcms-block-editor-renderer/blocks/table.component.d.ts.map +1 -0
  83. package/next/components/dotcms-block-editor-renderer/blocks/text.component.d.ts +27 -0
  84. package/next/components/dotcms-block-editor-renderer/blocks/text.component.d.ts.map +1 -0
  85. package/next/components/dotcms-block-editor-renderer/blocks/unknown.component.d.ts +18 -0
  86. package/next/components/dotcms-block-editor-renderer/blocks/unknown.component.d.ts.map +1 -0
  87. package/next/components/dotcms-block-editor-renderer/blocks/video.component.d.ts +10 -0
  88. package/next/components/dotcms-block-editor-renderer/blocks/video.component.d.ts.map +1 -0
  89. package/next/components/dotcms-block-editor-renderer/dotcms-block-editor-renderer.component.d.ts +39 -0
  90. package/next/components/dotcms-block-editor-renderer/dotcms-block-editor-renderer.component.d.ts.map +1 -0
  91. package/next/components/dotcms-block-editor-renderer/item/dotcms-block-editor-item.component.d.ts +12 -0
  92. package/next/components/dotcms-block-editor-renderer/item/dotcms-block-editor-item.component.d.ts.map +1 -0
  93. package/next/components/dotcms-editable-text/dotcms-editable-text.component.d.ts +129 -0
  94. package/next/components/dotcms-editable-text/dotcms-editable-text.component.d.ts.map +1 -0
  95. package/next/components/dotcms-editable-text/utils.d.ts +7 -0
  96. package/next/components/dotcms-editable-text/utils.d.ts.map +1 -0
  97. package/next/components/dotcms-layout-body/components/column/column.component.d.ts +21 -0
  98. package/next/components/dotcms-layout-body/components/column/column.component.d.ts.map +1 -0
  99. package/next/components/dotcms-layout-body/components/container/components/container-not-found/container-not-found.component.d.ts +27 -0
  100. package/next/components/dotcms-layout-body/components/container/components/container-not-found/container-not-found.component.d.ts.map +1 -0
  101. package/next/components/dotcms-layout-body/components/container/components/empty-container/empty-container.component.d.ts +23 -0
  102. package/next/components/dotcms-layout-body/components/container/components/empty-container/empty-container.component.d.ts.map +1 -0
  103. package/next/components/dotcms-layout-body/components/container/container.component.d.ts +32 -0
  104. package/next/components/dotcms-layout-body/components/container/container.component.d.ts.map +1 -0
  105. package/next/components/dotcms-layout-body/components/contentlet/contentlet.component.d.ts +48 -0
  106. package/next/components/dotcms-layout-body/components/contentlet/contentlet.component.d.ts.map +1 -0
  107. package/next/components/dotcms-layout-body/components/fallback-component/fallback-component.component.d.ts +16 -0
  108. package/next/components/dotcms-layout-body/components/fallback-component/fallback-component.component.d.ts.map +1 -0
  109. package/next/components/dotcms-layout-body/components/page-error-message/page-error-message.component.d.ts +13 -0
  110. package/next/components/dotcms-layout-body/components/page-error-message/page-error-message.component.d.ts.map +1 -0
  111. package/next/components/dotcms-layout-body/components/row/row.component.d.ts +22 -0
  112. package/next/components/dotcms-layout-body/components/row/row.component.d.ts.map +1 -0
  113. package/next/components/dotcms-layout-body/dotcms-layout-body.component.d.ts +30 -0
  114. package/next/components/dotcms-layout-body/dotcms-layout-body.component.d.ts.map +1 -0
  115. package/next/directives/dotcms-show-when/dotcms-show-when.directive.d.ts +21 -0
  116. package/next/directives/dotcms-show-when/dotcms-show-when.directive.d.ts.map +1 -0
  117. package/next/dotcms-angular-next.d.ts.map +1 -0
  118. package/next/index.d.ts +6 -0
  119. package/next/models/index.d.ts +39 -0
  120. package/next/models/index.d.ts.map +1 -0
  121. package/next/providers/dotcms-client/dotcms-client.provider.d.ts +60 -0
  122. package/next/providers/dotcms-client/dotcms-client.provider.d.ts.map +1 -0
  123. package/next/providers/dotcms-image-loader/dotcms-image_loader.d.ts +21 -0
  124. package/next/providers/dotcms-image-loader/dotcms-image_loader.d.ts.map +1 -0
  125. package/next/public_api.d.ts +8 -0
  126. package/next/public_api.d.ts.map +1 -0
  127. package/next/services/dotcms-editable-page.service.d.ts +40 -0
  128. package/next/services/dotcms-editable-page.service.d.ts.map +1 -0
  129. package/next/store/dotcms.store.d.ts +36 -0
  130. package/next/store/dotcms.store.d.ts.map +1 -0
  131. package/package.json +9 -2
  132. package/public_api.d.ts +2 -0
  133. package/public_api.d.ts.map +1 -0
  134. package/esm2022/index.mjs +0 -5
  135. package/esm2022/lib/components/dot-editable-text/dot-editable-text.component.mjs +0 -225
  136. package/esm2022/lib/components/dot-editable-text/utils.mjs +0 -43
  137. package/esm2022/lib/components/no-component/no-component.component.mjs +0 -32
  138. package/esm2022/lib/layout/container/container.component.mjs +0 -126
  139. package/esm2022/lib/layout/contentlet/contentlet.component.mjs +0 -120
  140. package/esm2022/lib/layout/dotcms-layout/dotcms-layout.component.mjs +0 -100
  141. package/esm2022/lib/models/dotcms.model.mjs +0 -3
  142. package/esm2022/lib/models/index.mjs +0 -3
  143. package/esm2022/lib/services/dotcms-context/page-context.service.mjs +0 -75
  144. package/esm2022/lib/utils/index.mjs +0 -84
  145. package/index.d.ts.map +0 -1
  146. package/lib/components/dot-editable-text/dot-editable-text.component.d.ts.map +0 -1
  147. package/lib/components/dot-editable-text/utils.d.ts.map +0 -1
  148. package/lib/components/no-component/no-component.component.d.ts.map +0 -1
  149. package/lib/layout/column/column.component.d.ts.map +0 -1
  150. package/lib/layout/container/container.component.d.ts.map +0 -1
  151. package/lib/layout/contentlet/contentlet.component.d.ts.map +0 -1
  152. package/lib/layout/dotcms-layout/dotcms-layout.component.d.ts.map +0 -1
  153. package/lib/layout/row/row.component.d.ts.map +0 -1
  154. package/lib/models/dotcms.model.d.ts.map +0 -1
  155. package/lib/models/index.d.ts.map +0 -1
  156. package/lib/services/dotcms-context/page-context.service.d.ts.map +0 -1
  157. package/lib/utils/index.d.ts.map +0 -1
  158. /package/lib/{components → deprecated/components}/dot-editable-text/utils.d.ts +0 -0
  159. /package/lib/{components → deprecated/components}/no-component/no-component.component.d.ts +0 -0
  160. /package/lib/{layout → deprecated/layout}/column/column.component.d.ts +0 -0
  161. /package/lib/{layout → deprecated/layout}/container/container.component.d.ts +0 -0
  162. /package/lib/{layout → deprecated/layout}/contentlet/contentlet.component.d.ts +0 -0
  163. /package/lib/{layout → deprecated/layout}/row/row.component.d.ts +0 -0
  164. /package/lib/{models → deprecated/models}/index.d.ts +0 -0
  165. /package/lib/{utils → deprecated/utils}/index.d.ts +0 -0
package/README.md CHANGED
@@ -1,229 +1,704 @@
1
- # @dotcms/angular
1
+ # dotCMS Angular SDK
2
2
 
3
- `@dotcms/angular` is the official Angular library designed to work seamlessly with dotCMS. This library simplifies the process of rendering dotCMS pages and integrating with the [Universal Visual Editor](https://www.dotcms.com/docs/latest/universal-visual-editor) in your Angular applications.
3
+ The `@dotcms/angular` SDK is the DotCMS official Angular library. It empowers Angular developers to build powerful, editable websites and applications in no time.
4
4
 
5
5
  ## Table of Contents
6
6
 
7
- - [Features](#features)
8
- - [Installation](#installation)
9
- - [Configuration](#provider-setup)
10
- - [Provider Setup](#provider-setup)
11
- - [Client Usage](#client-usage)
12
- - [Components](#components)
13
- - [DotcmsLayoutComponent](#dotcmslayoutcomponent)
14
- - [Best Practices](#best-practices)
15
- - [Troubleshooting](#troubleshooting)
16
- - [Contributing](#contributing)
17
- - [Licensing](#licensing)
7
+ - [Prerequisites & Setup](#prerequisites--setup)
8
+ - [dotCMS Instance](#dotcms-instance)
9
+ - [Create a dotCMS API Key](#create-a-dotcms-api-key)
10
+ - [Configure The Universal Visual Editor App](#configure-the-universal-visual-editor-app)
11
+ - [Installation](#installation)
12
+ - [dotCMS Client Configuration](#dotcms-client-configuration)
13
+ - [Proxy Configuration for Static Assets](#proxy-configuration-for-static-assets)
14
+ - [Using dotCMS Images with Angular’s `NgOptimizedImage` Directive (Recommended)](#using-dotcms-images-with-angulars-ngoptimizedimage-directive-recommended)
15
+ - [Quickstart: Render a Page with dotCMS](#quickstart-render-a-page-with-dotcms)
16
+ - [Example Project](#example-project-)
17
+ - [SDK Reference](#sdk-reference)
18
+ - [DotCMSLayoutBody](#dotcmslayoutbody)
19
+ - [DotCMSEditableText](#dotcmseditabletext)
20
+ - [DotCMSBlockEditorRenderer](#dotcmsblockeditorrenderer)
21
+ - [DotCMSShowWhen](#dotcmsshowwhen)
22
+ - [DotCMSEditablePageService](#dotcmseditablepageservice)
23
+ - [Troubleshooting](#troubleshooting)
24
+ - [Common Issues & Solutions](#common-issues--solutions)
25
+ - [Debugging Tips](#debugging-tips)
26
+ - [Still Having Issues?](#still-having-issues)
27
+ - [dotCMS Support](#dotcms-support)
28
+ - [How To Contribute](#how-to-contribute)
29
+ - [Licensing Information](#licensing-information)
18
30
 
19
- ## Features
31
+ ## Prerequisites & Setup
20
32
 
21
- - A set of Angular components developed for dotCMS page rendering and editor integration.
22
- - Enhanced development workflow with full TypeScript support.
23
- - Optimized performance for efficient rendering of dotCMS pages in Angular applications.
24
- - Flexible customization options to adapt to various project requirements.
33
+ ### Get a dotCMS Environment
25
34
 
26
- ## Installation
35
+ #### Version Compatibility
27
36
 
28
- Install the package using npm:
37
+ - **Recommended**: dotCMS Evergreen
38
+ - **Minimum**: dotCMS v25.05
39
+ - **Best Experience**: Latest Evergreen release
29
40
 
30
- ```bash
31
- npm install @dotcms/angular
32
- ```
41
+ #### Environment Setup
42
+
43
+ **For Production Use:**
44
+
45
+ - ☁️ [Cloud hosting options](https://www.dotcms.com/pricing) - managed solutions with SLA
46
+ - 🛠️ [Self-hosted options](https://dev.dotcms.com/docs/current-releases) - deploy on your infrastructure
47
+
48
+ **For Testing & Development:**
49
+
50
+ - 🧑🏻‍💻 [dotCMS demo site](https://demo.dotcms.com/dotAdmin/#/public/login) - perfect for trying out the SDK
51
+ - 📘 [Learn how to use the demo site](https://dev.dotcms.com/docs/demo-site)
52
+ - 📝 Read-only access, ideal for building proof-of-concepts
53
+
54
+ **For Local Development:**
55
+
56
+ - 🐳 [Docker setup guide](https://github.com/dotCMS/core/tree/main/docker/docker-compose-examples/single-node-demo-site)
57
+ - 💻 [Local installation guide](https://dev.dotcms.com/docs/quick-start-guide)
58
+
59
+ ### Configure The Universal Visual Editor App
60
+
61
+ For a step-by-step guide on setting up the Universal Visual Editor, check out our [easy-to-follow instructions](https://dev.dotcms.com/docs/uve-headless-config) and get started in no time!
62
+
63
+ ### Create a dotCMS API Key
33
64
 
34
- Or using Yarn:
65
+ > [!TIP]
66
+ > Make sure your API Token has read-only permissions for Pages, Folders, Assets, and Content. Using a key with minimal permissions follows security best practices.
67
+
68
+ This integration requires an API Key with read-only permissions for security best practices:
69
+
70
+ 1. Go to the **dotCMS admin panel**.
71
+ 2. Click on **System** > **Users**.
72
+ 3. Select the user you want to create the API Key for.
73
+ 4. Go to **API Access Key** and generate a new key.
74
+
75
+ For detailed instructions, please refer to the [dotCMS API Documentation - Read-only token](https://dev.dotcms.com/docs/rest-api-authentication#ReadOnlyToken).
76
+
77
+ ### Installation
35
78
 
36
79
  ```bash
37
- yarn add @dotcms/angular
80
+ npm install @dotcms/angular@next @dotcms/uve@next @dotcms/client@next @dotcms/types@next @tinymce/tinymce-angular
38
81
  ```
39
82
 
40
83
  ## Configuration
41
- ### Provider Setup
42
- We need to provide the information of our dotCMS instance
43
84
 
44
- ```javascript
85
+ The recommended way to configure the DotCMS client in your Angular application is to use the `provideDotCMSClient` function in your `app.config.ts`:
45
86
 
46
- import { ClientConfig } from '@dotcms/client';
87
+ ```ts
88
+ import { ApplicationConfig } from '@angular/core';
89
+ import { provideDotCMSClient } from '@dotcms/angular';
90
+ import { environment } from './environments/environment'; // Assuming your environment variables are here
47
91
 
48
- const DOTCMS_CLIENT_CONFIG: ClientConfig = {
49
- dotcmsUrl: environment.dotcmsUrl,
50
- authToken: environment.authToken,
51
- siteId: environment.siteId
92
+ export const appConfig: ApplicationConfig = {
93
+ providers: [
94
+ provideDotCMSClient({
95
+ dotcmsUrl: environment.dotcmsUrl,
96
+ authToken: environment.authToken,
97
+ siteId: environment.siteId
98
+ })
99
+ ]
52
100
  };
53
101
  ```
54
102
 
55
- Add this configuration to `ApplicationConfig` in your Angular app.
103
+ Then, you can inject the `DotCMSClient` into your components or services:
56
104
 
57
- `src/app/app.config.ts`
58
- ```typescript
59
- import { InjectionToken } from '@angular/core';
60
- import { ClientConfig, DotCmsClient } from '@dotcms/client';
105
+ ```ts
106
+ import { Component, inject } from '@angular/core';
107
+ import { DotCMSClient } from '@dotcms/angular';
108
+
109
+ @Component({
110
+ selector: 'app-my-component',
111
+ template: `<!-- Your component template -->`
112
+ })
113
+ export class MyComponent {
114
+ dotcmsClient = inject(DotCMSClient);
115
+
116
+ ngOnInit() {
117
+ this.dotcmsClient.page
118
+ .get({ url: '/about-us' })
119
+ .then(({ pageAsset }) => {
120
+ console.log(pageAsset);
121
+ });
122
+ }
123
+ }
124
+ ```
61
125
 
62
- export const DOTCMS_CLIENT_TOKEN = new InjectionToken<DotCmsClient>('DOTCMS_CLIENT');
126
+ ### Proxy Configuration for Static Assets
63
127
 
64
- export const appConfig: ApplicationConfig = {
65
- providers: [
66
- provideRouter(routes),
67
- {
68
- provide: DOTCMS_CLIENT_TOKEN,
69
- useValue: DotCmsClient.init(DOTCMS_CLIENT_CONFIG),
128
+ Configure a proxy to leverage the powerful dotCMS image API, allowing you to resize and serve optimized images efficiently. This enhances application performance and improves user experience, making it a strategic enhancement for your project.
129
+
130
+ #### 1. Create a Proxy Configuration
131
+
132
+ Create a `proxy.conf.json` file in your project:
133
+
134
+ ```json
135
+ // proxy.conf.json
136
+ {
137
+ "/dA": {
138
+ "target": "http://localhost:8080", // Your dotCMS instance URL
139
+ "secure": false, // Set to true if using HTTPS
140
+ "changeOrigin": true // Required for hosting scenarios
141
+ }
142
+ }
143
+ ```
144
+
145
+ #### 2. Update Angular Configuration
146
+
147
+ Add the proxy configuration to your `angular.json`:
148
+
149
+ ```json
150
+ // angular.json
151
+ {
152
+ "projects": {
153
+ "my-app": {
154
+ "architect": {
155
+ "serve": {
156
+ "builder": "@angular-devkit/build-angular:dev-server",
157
+ "options": {
158
+ "proxyConfig": "src/proxy.conf.json"
159
+ }
160
+ }
161
+ }
70
162
  }
71
- ],
72
- };
163
+ }
164
+ }
73
165
  ```
74
166
 
75
- This way, we will have access to `DOTCMS_CLIENT_TOKEN` from anywhere in our application.
167
+ #### 3. Usage in Components
168
+
169
+ Once configured, image URLs in your components will automatically be proxied to your dotCMS instance:
76
170
 
77
- ### Client Usage
78
- To interact with the client and obtain information from, for example, our pages
171
+ >📚 Learn more about [Image Resizing and Processing in dotCMS with Angular](https://www.dotcms.com/blog/image-resizing-and-processing-in-dotcms-with-angular-and-nextjs).
79
172
 
80
173
  ```typescript
81
- export class YourComponent {
82
- private readonly client = inject(DOTCMS_CLIENT_TOKEN);
83
-
84
- this.client.page
85
- .get({ ...pageParams })
86
- .then((response) => {
87
- // Use your response
88
- })
89
- .catch((e) => {
90
- const error: PageError = {
91
- message: e.message,
92
- status: e.status,
93
- };
94
- // Use the error response
95
- })
174
+ // /components/my-dotcms-image.component.ts
175
+ @Component({
176
+ template: `
177
+ <img [src]="'/dA/' + contentlet.inode" alt="Asset from dotCMS" />
178
+ `
179
+ })
180
+ class MyDotCMSImageComponent {
181
+ @Input() contentlet: DotCMSBasicContentlet;
96
182
  }
97
183
  ```
98
184
 
99
- For more information on how to use the dotCMS Client, you can visit the [documentation](https://www.github.com/dotCMS/core/blob/main/core-web/libs/sdk/client/README.md)
185
+ ### Using dotCMS Images with Angular’s `NgOptimizedImage` Directive (Recommended)
186
+
187
+ To optimize images served from dotCMS in your Angular app, we recommend using the built-in `NgOptimizedImage` directive. This integration supports automatic image preloading, lazy loading, and improved performance.
100
188
 
101
- ## DotCMS Page API
189
+ We provide a helper function `provideDotCMSImageLoader()` to configure image loading with your dotCMS instance.
102
190
 
103
- The `DotcmsLayoutComponent` requires a `DotCMSPageAsset` object to be passed in to it. This object represents a dotCMS page and can be fetched using the `@dotcms/client` library.
191
+ #### Setup
104
192
 
105
- - [DotCMS Official Angular Example](https://www.github.com/dotCMS/core/tree/main/examples/angular)
106
- - [`@dotcms/client` documentation](https://www.npmjs.com/package/@dotcms/client)
107
- - [Page API documentation](https://www.dotcms.com/docs/latest/page-api)
193
+ Add the image loader to your `app.config.ts`:
108
194
 
109
- ## Components
195
+ ```ts
196
+ // src/app/app.config.ts
197
+ import { provideDotCMSImageLoader } from '@dotcms/angular';
198
+ import { ApplicationConfig } from '@angular/core';
110
199
 
111
- ### DotcmsLayoutComponent
200
+ export const appConfig: ApplicationConfig = {
201
+ providers: [
202
+ provideDotCMSImageLoader(environment.dotcmsUrl)
203
+ ]
204
+ };
205
+ ```
112
206
 
113
- The `DotcmsLayoutComponent` is a crucial component for rendering dotCMS page layouts in your Angular application.
207
+ #### Usage
114
208
 
115
- #### Inputs
209
+ Once configured, you can use the `NgOptimizedImage` directive to render dotCMS images:
116
210
 
117
- | Name | Type | Description |
118
- |--------------|----------------------|-----------------------------------------------------------------------|
119
- | `pageAsset` | `DotCMSPageAsset` | The object representing a dotCMS page from PageAPI response. |
120
- | `components` | `DotCMSPageComponent`| An object mapping contentlets to their respective render components. |
121
- | `editor` | `EditorConfig` | Configuration for data fetching in Edit Mode. |
211
+ ```ts
212
+ // src/components/my-dotcms-image.component.ts
213
+ @Component({
214
+ selector: 'my-dotcms-image',
215
+ template: `
216
+ <img [ngSrc]="imagePath" alt="Asset from dotCMS" />
217
+ `,
218
+ standalone: true
219
+ })
220
+ export class MyDotCMSImageComponent {
221
+ @Input() contentlet!: DotCMSBasicContentlet;
122
222
 
123
- #### Usage Example
223
+ get imagePath() {
224
+ return this.contentlet.image.versionPath;
225
+ }
226
+ }
227
+ ```
124
228
 
125
- In your component file (e.g., `pages.component.ts`):
229
+ > 📚 Learn more about [`NgOptimizedImage`](https://angular.dev/guide/image-optimization)
230
+
231
+ ## Quickstart: Render a Page with dotCMS
232
+
233
+ The following example demonstrates how to quickly set up a basic dotCMS page renderer in your Angular application. This example shows how to:
234
+
235
+ - Create a standalone component that renders a dotCMS page
236
+ - Set up dynamic component loading for different content types
237
+ - Handle both regular page viewing and editor mode
238
+ - Subscribe to real-time page updates when in the Universal Visual Editor
126
239
 
127
240
  ```typescript
241
+ // /src/app/pages/dotcms-page.component.ts
128
242
  import { Component, signal } from '@angular/core';
129
- import { DotCMSPageComponent, EditorConfig } from '@dotcms/angular';
243
+
244
+ import { DotCMSLayoutBody, DotCMSEditablePageService} from '@dotcms/angular/next';
245
+ import { getUVEState } from '@dotcms/uve';
246
+ import { DotCMSPageAsset } from '@dotcms/types';
247
+
248
+ import { DOTCMS_CLIENT_TOKEN } from './app.config';
249
+
250
+ const DYNAMIC_COMPONENTS = {
251
+ Blog: import('./blog.component').then(c => c.BlogComponent),
252
+ Product: import('./product.component').then(c => c.ProductComponent)
253
+ };
130
254
 
131
255
  @Component({
132
256
  selector: 'app-pages',
133
- templateUrl: './pages.component.html',
257
+ standalone: true,
258
+ imports: [DotCMSLayoutBody],
259
+ providers: [DotCMSEditablePageService, DOTCMS_CLIENT_TOKEN],
260
+ template: `
261
+ @if (pageAsset()) {
262
+ <dotcms-layout-body
263
+ [pageAsset]="pageAsset"
264
+ [components]="components()"
265
+ />
266
+ } @else {
267
+ <div>Loading...</div>
268
+ }
269
+ `
134
270
  })
135
271
  export class PagesComponent {
136
- DYNAMIC_COMPONENTS: DotCMSPageComponent = {
137
- Activity: import('../pages/content-types/activity/activity.component').then(
138
- (c) => c.ActivityComponent
139
- ),
140
- Banner: import('../pages/content-types/banner/banner.component').then(
141
- (c) => c.BannerComponent
142
- ),
143
- // Add other components as needed
144
- };
145
-
146
- components = signal(this.DYNAMIC_COMPONENTS);
147
- editorConfig = signal<EditorConfig>({ params: { depth: 2 } });
148
-
149
- // Assume pageAsset is fetched or provided somehow
150
- pageAsset: DotCMSPageAsset;
272
+ private readonly dotCMSClient: DotCMSClient = inject(DOTCMS_CLIENT_TOKEN);
273
+ private readonly editablePageService = inject(DotCMSEditablePageService);
274
+ readonly components = signal(DYNAMIC_COMPONENTS);
275
+ readonly pageAsset = signal<DotCMSPageAsset | null>(null);
276
+
277
+ ngOnInit() {
278
+ this.dotCMSClient.page
279
+ .get({ url: '/my-page' })
280
+ .then(({ pageAsset }) => {
281
+ if(getUVEState()) {
282
+ this.#subscribeToPageUpdates(response);
283
+ return;
284
+ }
285
+
286
+ this.pageAsset.set(pageAsset);
287
+ });
288
+ }
289
+
290
+ #subscribeToPageUpdates(response: DotCMSPageResponse) {
291
+ this.editablePageService
292
+ .listen(response)
293
+ .subscribe({ pageAsset } => this.pageAsset.set(pageAsset));
294
+ }
151
295
  }
152
296
  ```
153
297
 
154
- In your template file (e.g., `pages.component.html`):
298
+ ### Example Project 🚀
299
+
300
+ Looking to get started quickly? We've got you covered! Our [Angular starter project](https://github.com/dotCMS/core/tree/main/examples/angular) is the perfect launchpad for your dotCMS + Angular journey. This production-ready template demonstrates everything you need:
301
+
302
+ 📦 Fetch and render dotCMS pages with best practices
303
+ 🧩 Register and manage components for different content types
304
+ 🔍 Listing pages with search functionality
305
+ 📝 Detail pages for blogs
306
+ 📈 Image and assets optimization for better performance
307
+ ✨ Enable seamless editing via the Universal Visual Editor (UVE)
308
+ ⚡️ Leverage Angular's dependency injection and signals for optimal performance
309
+
310
+ > [!TIP]
311
+ > This starter project is more than just an example, it follows all our best practices. We highly recommend using it as the base for your next dotCMS + Angular project!
312
+
313
+ ## SDK Reference
314
+
315
+ All components, directives, and services should be imported from `@dotcms/angular/next`.
316
+
317
+ ### DotCMSLayoutBody
318
+
319
+ `DotCMSLayoutBody` is a component used to render the layout for a DotCMS page, supporting both production and development modes.
320
+
321
+ | Input | Type | Required | Default | Description |
322
+ |--------------|--------------------------|----------|----------------|------------------------------------------------|
323
+ | `page` | `DotCMSPageAsset` | ✅ | - | The page asset containing the layout to render |
324
+ | `components` | `DotCMSPageComponent` | ✅ | `{}` | [Map of content type → Angular component](#component-mapping) |
325
+ | `mode` | `DotCMSPageRendererMode` | ❌ | `'production'` | [Rendering mode ('production' or 'development')](#layout-body-modes) |
326
+
327
+ #### Usage
328
+
329
+ ```typescript
330
+ import { Component, signal } from '@angular/core';
331
+ import { DotCMSPageAsset } from '@dotcms/types';
332
+ import { DotCMSLayoutBody } from '@dotcms/angular/next';
333
+
334
+ import { DOTCMS_CLIENT_TOKEN } from './app.config';
155
335
 
156
- ```html
157
- <dotcms-layout
158
- [pageAsset]="pageAsset"
159
- [components]="components()"
160
- [editor]="editorConfig()"
161
- />
336
+ @Component({
337
+ template: `
338
+ <dotcms-layout-body [page]="pageAsset()" [components]="components()" mode="development" />
339
+ `
340
+ })
341
+ export class MyPageComponent {
342
+ protected readonly components = signal({
343
+ Blog: import('./blog.component').then((c) => c.BlogComponent)
344
+ });
345
+ protected readonly pageAsset = signal<DotCMSPageAsset | null>(null);
346
+ private readonly dotCMSClient = inject(DOTCMS_CLIENT_TOKEN);
347
+
348
+ ngOnInit() {
349
+ this.dotCMSClient.page.get({ url: '/my-page' }).then(({ pageAsset }) => {
350
+ this.pageAsset.set(pageAsset);
351
+ });
352
+ }
353
+ }
354
+ ```
355
+
356
+ #### Layout Body Modes
357
+
358
+ - `production`: Performance-optimized mode that only renders content with explicitly mapped components, leaving unmapped content empty.
359
+ - `development`: Debug-friendly mode that renders default components for unmapped content types and provides visual indicators and console logs for empty containers and missing mappings.
360
+
361
+ #### Component Mapping
362
+
363
+ The `DotCMSLayoutBody` component uses a `components` input to map content type variable names to Angular components. This allows you to render different components for different content types. Example:
364
+
365
+ ```typescript
366
+ const DYNAMIC_COMPONENTS = {
367
+ Blog: import('./blog.component').then((c) => c.BlogComponent),
368
+ Product: import('./product.component').then((c) => c.ProductComponent)
369
+ };
162
370
  ```
163
371
 
164
- This setup allows for dynamic rendering of different content types on your dotCMS pages.
372
+ - Keys (e.g., `Blog`, `Product`): Match your [content type variable names](https://dev.dotcms.com/docs/content-types#VariableNames) in dotCMS
373
+ - Values: Dynamic imports of your Angular components that render each content type
374
+ - Supports lazy loading through dynamic imports
375
+ - Components must be standalone or declared in a module
376
+
377
+ > [!TIP]
378
+ > Always use the exact content type variable name from dotCMS as the key. You can find this in the Content Types section of your dotCMS admin panel.
379
+
380
+ ### DotCMSEditableText
381
+
382
+ `DotCMSEditableText` is a component for inline editing of text fields in dotCMS, supporting plain text, text area, and WYSIWYG fields.
383
+
384
+ | Input | Type | Required | Description |
385
+ |--------------|---------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
386
+ | `contentlet` | `T extends DotCMSBasicContentlet` | ✅ | The contentlet containing the editable field |
387
+ | `fieldName` | `keyof T` | ✅ | Name of the field to edit, which must be a valid key of the contentlet type `T` |
388
+ | `mode` | `'plain' \| 'full'` | ❌ | `plain` (default): Support text editing. Does not show style controls. <br/> `full`: Enables a bubble menu with style options. This mode only works with [`WYSIWYG` fields](https://dev.dotcms.com/docs/the-wysiwyg-field). |
389
+ | `format` | `'text' \| 'html'` | ❌ | `text` (default): Renders HTML tags as plain text <br/> `html`: Interprets and renders HTML markup |
165
390
 
166
- ## Best Practices
391
+ #### Usage
167
392
 
168
- 1. **Lazy Loading**: Use dynamic imports for components to improve initial load times.
169
- 2. **Error Handling**: Implement robust error handling for API calls and component rendering.
170
- 3. **Type Safety**: Leverage TypeScript's type system to ensure proper usage of dotCMS structures.
171
- 4. **Performance Optimization**: Monitor and optimize the performance of rendered components.
393
+ ```typescript
394
+ import { Component, Input } from '@angular/core';
395
+ import { RouterLink } from '@angular/router';
396
+
397
+ import { DotCMSBasicContentlet } from '@dotcms/types';
398
+ import { DotCMSEditableTextComponent } from '@dotcms/angular/next';
399
+
400
+ @Component({
401
+ selector: 'app-your-component',
402
+ imports: [RouterLink, NgOptimizedImage, DotCMSEditableTextComponent],
403
+ template: `
404
+ <div
405
+ class="flex overflow-hidden relative justify-center items-center w-full h-96 bg-gray-200">
406
+ <img
407
+ class="object-cover w-full"
408
+ [src]="'/dA/' + contentlet().inode"
409
+ [alt]="contentlet().title" />
410
+ <div
411
+ class="flex absolute inset-0 flex-col justify-center items-center p-4 text-center text-white">
412
+ <h2 class="mb-2 text-6xl font-bold text-shadow">
413
+ <dotcms-editable-text fieldName="title" [contentlet]="contentlet()" />
414
+ </h2>
415
+ <a
416
+ class="p-4 text-xl bg-red-400 rounded-sm transition duration-300 hover:bg-red-500"
417
+ [routerLink]="contentlet().link">
418
+ See more
419
+ </a>
420
+ </div>
421
+ </div>
422
+ `
423
+ })
424
+ export class MyBannerComponent {
425
+ @Input() contentlet: DotCMSBasicContentlet;
426
+ }
427
+ ```
428
+
429
+ #### Editor Integration
430
+
431
+ - Detects UVE edit mode and enables inline TinyMCE editing
432
+ - Triggers a `Save` [workflow action](https://dev.dotcms.com/docs/workflows) on blur without needing full content dialog.
433
+
434
+ ### DotCMSBlockEditorRenderer
435
+
436
+ `DotCMSBlockEditorRenderer` is a component for rendering [Block Editor](https://dev.dotcms.com/docs/block-editor) content from dotCMS with support for custom block renderers.
437
+
438
+ | Input | Type | Required | Description |
439
+ |-------------------|----------------------|----------|------------------------------------------------------------------------------------------------------------|
440
+ | `blocks` | `BlockEditorContent` | ✅ | The [Block Editor](https://dev.dotcms.com/docs/block-editor) content to render |
441
+ | `customRenderers` | `CustomRenderer` | ❌ | Custom rendering functions for specific [block types](https://dev.dotcms.com/docs/block-editor#BlockTypes) |
442
+ | `className` | `string` | ❌ | CSS class to apply to the container |
443
+ | `style` | `CSSProperties` | ❌ | Inline styles for the container |
444
+
445
+ #### Usage
446
+
447
+ ```typescript
448
+ import { DotCMSBasicContentlet } from '@dotcms/types';
449
+ import { DotCMSBlockEditorRenderer } from '@dotcms/angular/next';
450
+
451
+ const CUSTOM_RENDERERS = {
452
+ customBlock: import('./custom-block.component').then((c) => c.CustomBlockComponent),
453
+ h1: import('./custom-h1.component').then((c) => c.CustomH1Component)
454
+ };
455
+
456
+ @Component({
457
+ selector: 'app-your-component',
458
+ imports: [DotCMSShowWhen],
459
+ template: `
460
+ <dotcms-block-editor-renderer
461
+ [blocks]="contentlet.myBlockEditorField"
462
+ [customRenderers]="customRenderers()" />
463
+ `
464
+ })
465
+ export class MyBannerComponent {
466
+ @Input() contentlet: DotCMSBasicContentlet;
467
+ readonly customRenderers = signal(CUSTOM_RENDERERS);
468
+ }
469
+ ```
470
+
471
+ #### Recommendations
472
+
473
+ - Should not be used with [`DotCMSEditableText`](#dotcmseditabletext)
474
+ - Take into account the CSS cascade can affect the look and feel of your blocks.
475
+ - `DotCMSBlockEditorRenderer` only works with [Block Editor fields](https://dev.dotcms.com/docs/block-editor). For other fields, use [`DotCMSEditableText`](#dotcmseditabletext).
476
+
477
+ 📘 For advanced examples, customization options, and best practices, refer to the [DotCMSBlockEditorRenderer README](https://github.com/dotCMS/core/tree/master/core-web/libs/sdk/angular/src/lib/components/DotCMSBlockEditorRenderer).
478
+
479
+
480
+ ### DotCMSShowWhen
481
+
482
+ `DotCMSShowWhen` is a `directive` for conditionally showing content based on the current UVE mode. Useful for mode-based behaviors outside of render logic.
483
+
484
+ | Input | Type | Required | Description |
485
+ |--------|------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
486
+ | `when` | `UVE_MODE` | ✅ | The `UVE` mode when content should be displayed: <br/> `UVE_MODE.EDIT`: Only visible in edit mode <br/> `UVE_MODE.PREVIEW`: Only visible in preview mode <br/> `UVE_MODE.PUBLISHED`: Only visible in published mode |
487
+
488
+ #### Usage
489
+
490
+ ```typescript
491
+ import { UVE_MODE } from '@dotcms/types';
492
+ import { DotCMSShowWhen } from '@dotcms/angular/next';
493
+
494
+ @Component({
495
+ selector: 'app-your-component',
496
+ imports: [DotCMSShowWhen],
497
+ template: `
498
+ <div *dotCMSShowWhen="UVE_MODE.EDIT">Only visible in edit mode</div>
499
+ `
500
+ })
501
+ export class YourComponent {}
502
+ ```
503
+
504
+ 📚 Learn more about the `UVE_MODE` enum in the [dotCMS UVE Package Documentation](https://dev.dotcms.com/docs/uve).
505
+
506
+ ### DotCMSEditablePageService
507
+
508
+ The `DotCMSEditablePageService` enables real-time page updates when using the Universal Visual Editor. It provides a single method `listen` that returns an Observable of page changes.
509
+
510
+ | Param | Type | Required | Description |
511
+ |----------------|----------------------|----------|-----------------------------------------------|
512
+ | `pageResponse` | `DotCMSPageResponse` | ✅ | The page data object from `client.page.get()` |
513
+
514
+ #### Service Lifecycle & Operations
515
+
516
+ When you use the `listen` method, the service:
517
+
518
+ 1. Initializes the UVE with your page data
519
+ 2. Sets up communication channels with the editor
520
+ 3. Tracks content changes in real-time
521
+ 4. Updates your page automatically when:
522
+ - Content is edited inline
523
+ - Blocks are added or removed
524
+ - Layout changes are made
525
+ - Components are moved
526
+ 5. Cleans up all listeners and connections on destroy
527
+
528
+ #### Usage
529
+
530
+ ```typescript
531
+ import { Subscription } from 'rxjs';
532
+ import { Component, OnDestroy, OnInit, signal, inject } from '@angular/core';
533
+
534
+ import { getUVEState } from '@dotcms/uve';
535
+ import { DotCMSPageAsset } from '@dotcms/types';
536
+ import { DotCMSLayoutBody, DotCMSEditablePageService } from '@dotcms/angular/next';
537
+ import { DOTCMS_CLIENT_TOKEN } from './app.config';
538
+
539
+ @Component({
540
+ imports: [DotCMSLayoutBody],
541
+ providers: [DotCMSEditablePageService],
542
+ template: `
543
+ @if (pageAsset()) {
544
+ <dotcms-layout-body [page]="pageAsset()" [components]="components()" />
545
+ } @else {
546
+ <div>Loading...</div>
547
+ }
548
+ `
549
+ })
550
+ export class PageComponent implements OnInit, OnDestroy {
551
+ private subscription?: Subscription;
552
+ private readonly dotCMSClient = inject(DOTCMS_CLIENT_TOKEN);
553
+ private readonly editablePageService = inject(DotCMSEditablePageService);
554
+ readonly pageAsset = signal<DotCMSPageAsset | null>(null);
555
+
556
+ ngOnInit() {
557
+ this.dotCMSClient.page.get({ url: '/about-us' }).then((pageResponse) => {
558
+ // Only subscribe to changes when in the editor
559
+ if (getUVEState()) {
560
+ this.subscription = this.editablePageService
561
+ .listen(pageResponse)
562
+ .subscribe(({ pageAsset }) => {
563
+ this.pageAsset.set(pageAsset);
564
+ });
565
+ } else {
566
+ const { pageAsset } = pageResponse;
567
+ this.pageAsset.set(pageAsset);
568
+ }
569
+ });
570
+ }
571
+
572
+ ngOnDestroy() {
573
+ this.subscription?.unsubscribe();
574
+ }
575
+ }
576
+ ```
172
577
 
173
578
  ## Troubleshooting
174
579
 
175
- If you encounter issues while using `@dotcms/angular`, here are some common problems and their solutions:
176
-
177
- 1. **Dependency Issues**:
178
- - Ensure that all dependencies, such as `@dotcms/client`, `@angular/core`, and `rxjs`, are correctly installed and up-to-date. You can verify installed versions by running:
179
- ```bash
180
- npm list @dotcms/client @angular/core rxjs
181
- ```
182
- - If there are any missing or incompatible versions, reinstall dependencies by running:
183
- ```bash
184
- npm install
185
- ```
186
- or
187
- ```bash
188
- npm install --force
189
- ```
190
-
191
- 2. **Configuration Errors**:
192
- - **DotCMS Configuration**: Double-check that your `DOTCMS_CLIENT_CONFIG` settings (URL, auth token, site ID) are correct and aligned with the environment variables. For example:
193
- ```typescript
194
- const DOTCMS_CLIENT_CONFIG: ClientConfig = {
195
- dotcmsUrl: environment.dotcmsUrl, // Ensure this is a valid URL
196
- authToken: environment.authToken, // Ensure auth token has the correct permissions
197
- siteId: environment.siteId // Ensure site ID is valid and accessible
198
- };
199
- ```
200
- - **Injection Issues**: Ensure that `DOTCMS_CLIENT_TOKEN` is provided globally. Errors like `NullInjectorError` usually mean the token hasn’t been properly added to the `ApplicationConfig`. Verify by checking `src/app/app.config.ts`.
201
-
202
- 3. **Network and API Errors**:
203
- - **dotCMS API Connectivity**: If API calls are failing, check your browser’s Network tab to ensure requests to `dotcmsUrl` are successful. For CORS-related issues, ensure that your dotCMS server allows requests from your application’s domain.
204
- - **Auth Token Permissions**: If you’re seeing `401 Unauthorized` errors, make sure the auth token used in `DOTCMS_CLIENT_CONFIG` has appropriate permissions in dotCMS for accessing pages and content.
205
-
206
- 4. **Page and Component Rendering**:
207
- - **Dynamic Imports**: If you’re encountering issues with lazy-loaded components, make sure dynamic imports are correctly set up, as in:
208
- ```typescript
209
- const DYNAMIC_COMPONENTS: DotCMSPageComponent = {
210
- Activity: import('../pages/content-types/activity/activity.component').then(
211
- (c) => c.ActivityComponent
212
- )
213
- };
214
- ```
215
- - **Invalid Page Assets**: Ensure that `pageAsset` objects are correctly formatted. Missing fields in `pageAsset` can cause errors in `DotcmsLayoutComponent`. Validate the structure by logging `pageAsset` before passing it in.
216
-
217
- 5. **Common Angular Errors**:
218
- - **Change Detection**: Angular sometimes fails to detect changes with dynamic content. If `DotcmsLayoutComponent` isn’t updating as expected, you may need to call `ChangeDetectorRef.detectChanges()` manually.
219
- - **TypeScript Type Errors**: Ensure all types (e.g., `DotCMSPageAsset`, `DotCMSPageComponent`) are imported correctly from `@dotcms/angular`. Type mismatches can often be resolved by verifying imports.
220
-
221
- 6. **Consult Documentation**: Refer to the official [dotCMS documentation](https://dotcms.com/docs/) and the [@dotcms/angular GitHub repository](https://github.com/dotCMS/core). These sources often provide updates and additional usage examples.
222
-
223
- ## Contributing
224
-
225
- 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://www.gist.github.com/wezell/85ef45298c48494b90d92755b583acb3).
226
-
227
- ## Licensing
228
-
229
- 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://www.dotcms.com/cms-platform/features).
580
+ ### Common Issues & Solutions
581
+
582
+ #### Universal Visual Editor (UVE)
583
+
584
+ 1. **UVE Not Loading**: Page loads but UVE controls are not visible
585
+ - **Possible Causes**:
586
+ - Incorrect UVE configuration
587
+ - Missing API token permissions
588
+ - Missing the `DotCMSEditablePageService` call to enable UVE.
589
+ - **Solutions**:
590
+ - Verify UVE app configuration in dotCMS admin
591
+ - Check API token has edit permissions
592
+ - Ensure `dotcmsUrl` matches your instance URL exactly
593
+
594
+ #### Missing Content
595
+
596
+ 1. **Components Not Rendering**: Empty spaces where content should appear
597
+
598
+ - **Possible Causes**:
599
+ - Missing component mappings
600
+ - Incorrect content type variable names
601
+ - **Solutions**:
602
+ - Check component registration in `components` prop
603
+ - Verify content type variable names match exactly
604
+ - Enable `development` mode for detailed logging
605
+
606
+ 2. **Asset Loading Issues**: Images or files not loading
607
+ - **Possible Causes**:
608
+ - Proxy configuration issues
609
+ - CORS restrictions
610
+ - **Solutions**:
611
+ - Verify proxy settings in `angular.json`
612
+ - Check network tab for CORS errors
613
+ - Ensure `/dA` path is properly configured
614
+
615
+ #### Development Setup
616
+
617
+ 1. **Build Errors**: `npm install` fails
618
+
619
+ - **Solutions**:
620
+ - Clear npm cache: `npm cache clean --force`
621
+ - Delete `node_modules` and reinstall
622
+ - Verify Node.js version compatibility
623
+
624
+ 2. **Runtime Errors**: Console errors about missing imports or components not rendering
625
+ - **Solutions**:
626
+ - Check all imports are from `@dotcms/angular/next`
627
+ - Verify all peer dependencies are installed
628
+ - Update to latest compatible versions
629
+
630
+ ### Debugging Tips
631
+
632
+ 1. **Enable Development Mode**
633
+
634
+ ```typescript
635
+ <dotcms-layout-body
636
+ [page]="pageAsset()"
637
+ [components]="components()"
638
+ mode="development"
639
+ />
640
+ ```
641
+
642
+ This will:
643
+
644
+ - Show detailed error messages
645
+ - Highlight unmapped components
646
+ - Log component lifecycle events
647
+
648
+ 2. **Check Browser Console**
649
+
650
+ - Check for errors in the browser console
651
+ - Check for errors in the browser network tab
652
+
653
+ 3. **Network Monitoring**
654
+ - Use browser dev tools to monitor API calls
655
+ - Check for 401/403 errors (auth issues)
656
+ - Verify asset loading paths
657
+
658
+ ### Still Having Issues?
659
+
660
+ If you're still experiencing problems after trying these solutions:
661
+
662
+ 1. Search existing [GitHub issues](https://github.com/dotCMS/core/issues)
663
+ 2. Ask questions on the [community forum](https://community.dotcms.com/) to engage with other users.
664
+ 3. Create a new issue with:
665
+ - Detailed reproduction steps
666
+ - Environment information
667
+ - Error messages
668
+ - Code samples
669
+
670
+ ## dotCMS Support
671
+
672
+ We offer multiple channels to get help with the dotCMS Angular SDK:
673
+
674
+ - **GitHub Issues**: For bug reports and feature requests, please [open an issue](https://github.com/dotCMS/core/issues/new/choose) in the GitHub repository.
675
+ - **Community Forum**: Join our [community discussions](https://community.dotcms.com/) to ask questions and share solutions.
676
+ - **Stack Overflow**: Use the tag `dotcms-angular` when posting questions.
677
+ - **Enterprise Support**: Enterprise customers can access premium support through the [dotCMS Support Portal](https://helpdesk.dotcms.com/support/).
678
+
679
+ When reporting issues, please include:
680
+
681
+ - SDK version you're using
682
+ - Angular version
683
+ - Minimal reproduction steps
684
+ - Expected vs. actual behavior
685
+
686
+ ## How To Contribute
687
+
688
+ GitHub pull requests are the preferred method to contribute code to dotCMS. We welcome contributions to the DotCMS UVE SDK! If you'd like to contribute, please follow these steps:
689
+
690
+ 1. Fork the repository [dotCMS/core](https://github.com/dotCMS/core)
691
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
692
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
693
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
694
+ 5. Open a Pull Request
695
+
696
+ Please ensure your code follows the existing style and includes appropriate tests.
697
+
698
+ ## Licensing Information
699
+
700
+ 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 several enterprise features and is available via a supported, indemnified commercial license from dotCMS. For the differences between the editions, see [the feature page](http://www.dotcms.com/cms-platform/features).
701
+
702
+ This SDK is part of dotCMS's dual-licensed platform (GPL 3.0 for Community, commercial license for Enterprise).
703
+
704
+ [Learn more ](https://www.dotcms.com)at [dotcms.com](https://www.dotcms.com).