@dotcms/uve 1.5.5-next.2180 → 1.5.5-next.2253
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 +21 -19
- package/internal.cjs.js +4 -0
- package/internal.esm.js +1 -1
- package/package.json +1 -1
- package/public.cjs.js +59 -0
- package/public.esm.js +56 -1
- package/src/internal/constants.d.ts +23 -0
- package/src/lib/dom/dom.utils.d.ts +23 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `@dotcms/uve` SDK adds live editing to your JavaScript app using the dotCMS Universal Visual Editor (UVE). It provides low-level tools that power our framework-specific SDKs, such as [@dotcms/react](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/react/README.md) and [@dotcms/angular](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/angular/README.md).
|
|
4
4
|
|
|
5
|
-
> ⚠️ We **do not recommend using this SDK directly** for most use cases
|
|
5
|
+
> ⚠️ We **do not recommend using this SDK directly** for most use cases; you should use a [framework SDK that handles setup](#getting-started-recommended-examples), rendering, and event wiring for you.
|
|
6
6
|
|
|
7
7
|
With `@dotcms/uve`, framework SDKs are able to:
|
|
8
8
|
- Make pages and contentlets editable
|
|
@@ -17,11 +17,11 @@ With `@dotcms/uve`, framework SDKs are able to:
|
|
|
17
17
|
- [🚩 Custom Setup: Manual Rendering (Not Recommended)](#-custom-setup-manual-rendering-not-recommended)
|
|
18
18
|
- [Prerequisites & Setup](#prerequisites--setup)
|
|
19
19
|
- [Get a dotCMS Environment](#get-a-dotcms-environment)
|
|
20
|
-
- [
|
|
20
|
+
- [Configure The Universal Visual Editor App](#configure-the-universal-visual-editor-app)
|
|
21
21
|
- [Installation](#installation)
|
|
22
22
|
- [Using the SDK with TypeScript](#using-the-sdk-with-typescript)
|
|
23
23
|
- [SDK Reference](#sdk-reference)
|
|
24
|
-
- [`initUVE()`](#inituveconfig-
|
|
24
|
+
- [`initUVE()`](#inituveconfig-dotcmspageresponse)
|
|
25
25
|
- [`getUVEState()`](#getuvestate)
|
|
26
26
|
- [`createUVESubscription()`](#createuvesubscriptioneventtype-callback)
|
|
27
27
|
- [`editContentlet()`](#editcontentletcontentlet)
|
|
@@ -49,7 +49,7 @@ With `@dotcms/uve`, framework SDKs are able to:
|
|
|
49
49
|
We strongly recommend using one of our official framework SDKs, which are designed to handle UVE integration, routing, rendering, and more—out of the box. These examples are the best way to get started:
|
|
50
50
|
|
|
51
51
|
- [dotCMS Angular SDK: Angular Example](https://github.com/dotCMS/core/tree/main/examples/angular) – Ideal for Angular apps 🅰️
|
|
52
|
-
- [dotCMS React SDK: NextJS Example](https://github.com/dotCMS/core/tree/main/examples/
|
|
52
|
+
- [dotCMS React SDK: NextJS Example](https://github.com/dotCMS/core/tree/main/examples/nextjs) – Ideal for NextJS projects ⚛️
|
|
53
53
|
- [dotCMS React SDK: Astro Example](https://github.com/dotCMS/core/tree/main/examples/astro) – Ideal for Astro projects 🌌
|
|
54
54
|
|
|
55
55
|
These examples handle UVE integration, routing, rendering, and more—out of the box. **If you're building a headless dotCMS front-end, start there.**
|
|
@@ -66,7 +66,7 @@ You can use `@dotcms/uve` directly, but **it’s not recommended or supported**
|
|
|
66
66
|
|
|
67
67
|
Here's a minimal setup using `@dotcms/client` and `@dotcms/uve`:
|
|
68
68
|
|
|
69
|
-
1.
|
|
69
|
+
1. Initialize the Client and get the page response:
|
|
70
70
|
|
|
71
71
|
```ts
|
|
72
72
|
// getPage.ts
|
|
@@ -94,12 +94,13 @@ const getPage = async () => {
|
|
|
94
94
|
|
|
95
95
|
```ts
|
|
96
96
|
import { initUVE, createUVESubscription } from '@dotcms/uve';
|
|
97
|
+
import { UVEEventType } from '@dotcms/types';
|
|
97
98
|
import { getPage } from './getPage';
|
|
98
99
|
|
|
99
100
|
const pageResponse = await getPage();
|
|
100
101
|
|
|
101
102
|
initUVE(pageResponse);
|
|
102
|
-
createUVESubscription(
|
|
103
|
+
createUVESubscription(UVEEventType.CONTENT_CHANGES, (newPageResponse) => {
|
|
103
104
|
// Handle page updates (e.g. re-render)
|
|
104
105
|
});
|
|
105
106
|
```
|
|
@@ -118,7 +119,7 @@ createUVESubscription('changes', (newPageResponse) => {
|
|
|
118
119
|
#### 🔄 How to Render a dotCMS Page
|
|
119
120
|
|
|
120
121
|
> 📚 For a complete guide, here is a full tutorial:
|
|
121
|
-
> 👉 [dotCMS Page Rendering Architecture](
|
|
122
|
+
> 👉 [dotCMS Page Rendering Architecture](https://dev.dotcms.com/docs/dotcms-page-rendering-architecture)
|
|
122
123
|
|
|
123
124
|
dotCMS pages are structured as nested layout objects:
|
|
124
125
|
|
|
@@ -218,7 +219,6 @@ The SDK uses several key types from `@dotcms/types`:
|
|
|
218
219
|
import {
|
|
219
220
|
DotCMSBasicContentlet,
|
|
220
221
|
DotCMSPageResponse,
|
|
221
|
-
DotCMSUVEConfig,
|
|
222
222
|
DotCMSInlineEditingType,
|
|
223
223
|
UVEEventType,
|
|
224
224
|
UVEState
|
|
@@ -229,7 +229,7 @@ For a complete reference of all available types and interfaces, please refer to
|
|
|
229
229
|
|
|
230
230
|
## SDK Reference
|
|
231
231
|
|
|
232
|
-
### `initUVE(config?:
|
|
232
|
+
### `initUVE(config?: DotCMSPageResponse)`
|
|
233
233
|
|
|
234
234
|
`initUVE` is a function that initializes the Universal Visual Editor (UVE). It sets up the necessary communication between your app and the editor, enabling seamless integration and interaction.
|
|
235
235
|
|
|
@@ -243,7 +243,7 @@ For a complete reference of all available types and interfaces, please refer to
|
|
|
243
243
|
const { destroyUVESubscriptions } = initUVE(pageResponse);
|
|
244
244
|
```
|
|
245
245
|
|
|
246
|
-
> ⚠️ If you don't provide a `pageResponse`, we
|
|
246
|
+
> ⚠️ If you don't provide a `pageResponse`, we cannot guarantee that the UVE will be initialized correctly.
|
|
247
247
|
|
|
248
248
|
### `getUVEState()`
|
|
249
249
|
|
|
@@ -303,14 +303,16 @@ sub.unsubscribe();
|
|
|
303
303
|
|
|
304
304
|
- `UVEEventType.CONTENT_CHANGES`: Triggered when the content of the page changes.
|
|
305
305
|
- `UVEEventType.PAGE_RELOAD`: Triggered when the page is reloaded.
|
|
306
|
-
- `UVEEventType.
|
|
307
|
-
- `UVEEventType.IFRAME_SCROLL`: Triggered when the iframe is scrolled.
|
|
308
|
-
- `UVEEventType.IFRAME_SCROLL_END`: Triggered when the iframe has stopped scrolling.
|
|
306
|
+
- `UVEEventType.IFRAME_SCROLL`: Triggered when scroll action is needed inside the iframe (`'up'` or `'down'`).
|
|
309
307
|
- `UVEEventType.CONTENTLET_HOVERED`: Triggered when a contentlet is hovered.
|
|
308
|
+
- `UVEEventType.CONTENTLET_CLICKED`: Triggered when a contentlet is clicked.
|
|
309
|
+
- `UVEEventType.AUTO_BOUNDS`: Triggered when the SDK syncs page bounds after layout changes (internal SDK use).
|
|
310
|
+
- `UVEEventType.SCROLL_TO_SECTION`: Triggered when the editor requests a scroll to a specific page section (internal).
|
|
311
|
+
- `UVEEventType.SELECTION_CLEARED`: Triggered when the editor clears its selection (internal).
|
|
310
312
|
|
|
311
313
|
### `editContentlet(contentlet)`
|
|
312
314
|
|
|
313
|
-
`editContentlet` is a function that opens the dotCMS modal editor for any contentlet in or out of page area.
|
|
315
|
+
`editContentlet` is a function that opens the dotCMS modal editor for any contentlet in or out of the page area.
|
|
314
316
|
|
|
315
317
|
| Input | Type | Required | Description |
|
|
316
318
|
| ------------ | ------------------ | -------- | -------------------------------- |
|
|
@@ -340,7 +342,7 @@ const myEditButton = ({ contentlet }) => {
|
|
|
340
342
|
| Input | Type | Required | Description |
|
|
341
343
|
| ----------- | ---------------------------- | -------- | ------------------------------------------------------------------------------ |
|
|
342
344
|
| `type` | `DotCMSInlineEditingType` | ✅ | `'BLOCK_EDITOR'` or `'WYSIWYG'` |
|
|
343
|
-
| `
|
|
345
|
+
| `data` | `DotCMSInlineEditingPayload` | ✅ | [Field content required to enable inline editing](#dotcmsinlineeditingpayload) |
|
|
344
346
|
|
|
345
347
|
#### Usage
|
|
346
348
|
|
|
@@ -449,7 +451,7 @@ reorderMenu({ startLevel: 2, depth: 3 });
|
|
|
449
451
|
|
|
450
452
|
| Input | Type | Required | Description |
|
|
451
453
|
| --------- | ------------------------------------------ | -------- | ---------------------------- |
|
|
452
|
-
| `message` | [`DotCMSUVEMessage<T>`](#
|
|
454
|
+
| `message` | [`DotCMSUVEMessage<T>`](#dotcmsuvemessaget) | ✅ | Object with action + payload |
|
|
453
455
|
|
|
454
456
|
#### Usage
|
|
455
457
|
|
|
@@ -488,7 +490,7 @@ Style editor schemas are configured in the DotCMS admin UI under **Content Types
|
|
|
488
490
|
**Key Benefits:**
|
|
489
491
|
|
|
490
492
|
- **Real-Time Visual Editing**: Modify component styles and see changes instantly in the editor
|
|
491
|
-
- **Content-Specific Customization**: Different content types can have unique style schemas, and the same contentlet could have different styles depending on
|
|
493
|
+
- **Content-Specific Customization**: Different content types can have unique style schemas, and the same contentlet could have different styles depending on whether it is located in a different container or page
|
|
492
494
|
- **Admin-Managed**: Style schemas are defined in the DotCMS admin UI under Content Types and fetched automatically by the SDK
|
|
493
495
|
|
|
494
496
|
**Use Cases:**
|
|
@@ -627,7 +629,7 @@ When **defining styles** for a contentlet within a page using **Style Editor**,
|
|
|
627
629
|
|
|
628
630
|
> **NOTE:** (🎨 Styles are different) means the capability to define distinct styles, even when utilizing the identical Contentlet.
|
|
629
631
|
|
|
630
|
-
The only known limitation is that moving a contentlet with defined styles between different container types (5th scenario)
|
|
632
|
+
The only known limitation is that moving a contentlet with defined styles between different container types (5th scenario) results in the loss of those styles. A fix for this scenario is on our roadmap.
|
|
631
633
|
|
|
632
634
|
## Troubleshooting
|
|
633
635
|
|
|
@@ -713,7 +715,7 @@ We offer multiple channels to get help with the dotCMS UVE SDK:
|
|
|
713
715
|
- **GitHub Issues**: For bug reports and feature requests, please [open an issue](https://github.com/dotCMS/core/issues/new/choose) in the GitHub repository
|
|
714
716
|
- **Community Forum**: Join our [community discussions](https://community.dotcms.com/) to ask questions and share solutions
|
|
715
717
|
- **Stack Overflow**: Use the tag `dotcms-uve` when posting questions
|
|
716
|
-
- **Enterprise Support**: Enterprise customers can access premium support through the [dotCMS Support Portal](https://
|
|
718
|
+
- **Enterprise Support**: Enterprise customers can access premium support through the [dotCMS Support Portal](https://www.dotcms.com/support)
|
|
717
719
|
|
|
718
720
|
When reporting issues, please include:
|
|
719
721
|
|
package/internal.cjs.js
CHANGED
|
@@ -370,6 +370,8 @@ const styleEditorField = {
|
|
|
370
370
|
})
|
|
371
371
|
};
|
|
372
372
|
|
|
373
|
+
exports.ANALYTICS_ACTIVE_WINDOW_KEY = _public.ANALYTICS_ACTIVE_WINDOW_KEY;
|
|
374
|
+
exports.ANALYTICS_READY_EVENT = _public.ANALYTICS_READY_EVENT;
|
|
373
375
|
exports.CUSTOM_NO_COMPONENT = _public.CUSTOM_NO_COMPONENT;
|
|
374
376
|
exports.DEVELOPMENT_MODE = _public.DEVELOPMENT_MODE;
|
|
375
377
|
exports.DOT_SECTION_ID_PREFIX = _public.DOT_SECTION_ID_PREFIX;
|
|
@@ -387,6 +389,7 @@ exports.computeScrollIsInBottom = _public.computeScrollIsInBottom;
|
|
|
387
389
|
exports.createUVESubscription = _public.createUVESubscription;
|
|
388
390
|
exports.findDotCMSElement = _public.findDotCMSElement;
|
|
389
391
|
exports.findDotCMSVTLData = _public.findDotCMSVTLData;
|
|
392
|
+
exports.getAnalyticsContentletAttributes = _public.getAnalyticsContentletAttributes;
|
|
390
393
|
exports.getClosestDotCMSContainerData = _public.getClosestDotCMSContainerData;
|
|
391
394
|
exports.getColumnPositionClasses = _public.getColumnPositionClasses;
|
|
392
395
|
exports.getContainersData = _public.getContainersData;
|
|
@@ -397,6 +400,7 @@ exports.getDotCMSPageBounds = _public.getDotCMSPageBounds;
|
|
|
397
400
|
exports.getDotContainerAttributes = _public.getDotContainerAttributes;
|
|
398
401
|
exports.getDotContentletAttributes = _public.getDotContentletAttributes;
|
|
399
402
|
exports.getUVEState = _public.getUVEState;
|
|
403
|
+
exports.isDotAnalyticsActive = _public.isDotAnalyticsActive;
|
|
400
404
|
exports.isValidBlocks = _public.isValidBlocks;
|
|
401
405
|
exports.readContentletDataset = _public.readContentletDataset;
|
|
402
406
|
exports.setBounds = _public.setBounds;
|
package/internal.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as getUVEState, s as sendMessageToUVE } from './public.esm.js';
|
|
2
|
-
export { C as CUSTOM_NO_COMPONENT, D as DEVELOPMENT_MODE,
|
|
2
|
+
export { A as ANALYTICS_ACTIVE_WINDOW_KEY, f as ANALYTICS_READY_EVENT, C as CUSTOM_NO_COMPONENT, D as DEVELOPMENT_MODE, h as DOT_SECTION_ID_PREFIX, E as EMPTY_CONTAINER_STYLE_ANGULAR, j as EMPTY_CONTAINER_STYLE_REACT, k as END_CLASS, P as PRODUCTION_MODE, S as START_CLASS, T as TEMP_EMPTY_CONTENTLET, l as TEMP_EMPTY_CONTENTLET_TYPE, _ as __UVE_EVENTS__, m as __UVE_EVENT_ERROR_FALLBACK__, n as combineClasses, o as computeScrollIsInBottom, a as createUVESubscription, p as findDotCMSElement, q as findDotCMSVTLData, t as getAnalyticsContentletAttributes, v as getClosestDotCMSContainerData, w as getColumnPositionClasses, x as getContainersData, y as getContentletsInContainer, z as getDotCMSContainerData, B as getDotCMSContentletsBound, F as getDotCMSPageBounds, G as getDotContainerAttributes, H as getDotContentletAttributes, I as isDotAnalyticsActive, J as isValidBlocks, K as readContentletDataset, L as setBounds } from './public.esm.js';
|
|
3
3
|
import { UVE_MODE, DotCMSUVEAction } from '@dotcms/types';
|
|
4
4
|
import '@dotcms/types/internal';
|
|
5
5
|
|
package/package.json
CHANGED
package/public.cjs.js
CHANGED
|
@@ -257,6 +257,38 @@ function getDotContentletAttributes(contentlet, container) {
|
|
|
257
257
|
})
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
*
|
|
262
|
+
* Returns the minimal set of contentlet data attributes required by DotCMS
|
|
263
|
+
* Analytics (impression & click tracking) to identify a contentlet.
|
|
264
|
+
*
|
|
265
|
+
* Used in live mode where the full editor metadata is stripped but Analytics
|
|
266
|
+
* still needs to resolve the contentlet behind an impression/click.
|
|
267
|
+
*
|
|
268
|
+
* @param {DotCMSBasicContentlet} contentlet - The contentlet to get the attributes for
|
|
269
|
+
* @returns {DotAnalyticsContentletAttributes} The Analytics-required data attributes
|
|
270
|
+
*/
|
|
271
|
+
function getAnalyticsContentletAttributes(contentlet) {
|
|
272
|
+
return {
|
|
273
|
+
'data-dot-identifier': contentlet?.identifier,
|
|
274
|
+
'data-dot-inode': contentlet?.inode,
|
|
275
|
+
'data-dot-title': contentlet?.['widgetTitle'] || contentlet?.title,
|
|
276
|
+
'data-dot-type': contentlet?.contentType,
|
|
277
|
+
'data-dot-basetype': contentlet?.baseType
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
*
|
|
282
|
+
* Checks whether DotCMS Analytics is initialized and active on the page.
|
|
283
|
+
*
|
|
284
|
+
* The SDKs use this in live mode to decide whether to keep the minimal
|
|
285
|
+
* contentlet attributes Analytics depends on.
|
|
286
|
+
*
|
|
287
|
+
* @returns {boolean} `true` when analytics is active, otherwise `false`
|
|
288
|
+
*/
|
|
289
|
+
function isDotAnalyticsActive() {
|
|
290
|
+
return typeof window !== 'undefined' && window[ANALYTICS_ACTIVE_WINDOW_KEY] === true;
|
|
291
|
+
}
|
|
260
292
|
/**
|
|
261
293
|
*
|
|
262
294
|
*
|
|
@@ -885,6 +917,29 @@ const CUSTOM_NO_COMPONENT = 'CustomNoComponent';
|
|
|
885
917
|
* @internal
|
|
886
918
|
*/
|
|
887
919
|
const DOT_SECTION_ID_PREFIX = 'dot-section-';
|
|
920
|
+
/**
|
|
921
|
+
* Window flag set by `@dotcms/analytics` when content analytics is initialized
|
|
922
|
+
* and active on the page.
|
|
923
|
+
*
|
|
924
|
+
* @important This value is intentionally duplicated from `@dotcms/analytics`
|
|
925
|
+
* (`ANALYTICS_WINDOWS_ACTIVE_KEY` in dot-analytics.constants.ts). The SDKs read
|
|
926
|
+
* it in live mode to decide whether to keep the minimal contentlet attributes
|
|
927
|
+
* Analytics depends on. Both constants MUST stay in sync.
|
|
928
|
+
*
|
|
929
|
+
* @internal
|
|
930
|
+
*/
|
|
931
|
+
const ANALYTICS_ACTIVE_WINDOW_KEY = '__dotAnalyticsActive__';
|
|
932
|
+
/**
|
|
933
|
+
* Event dispatched by `@dotcms/analytics` once analytics is ready. The SDKs
|
|
934
|
+
* listen for it so live-mode contentlets can re-render with the attributes
|
|
935
|
+
* Analytics needs, regardless of initialization order.
|
|
936
|
+
*
|
|
937
|
+
* @important Kept in sync with the `dotcms:analytics:ready` event dispatched by
|
|
938
|
+
* `@dotcms/analytics` (initializeContentAnalytics).
|
|
939
|
+
*
|
|
940
|
+
* @internal
|
|
941
|
+
*/
|
|
942
|
+
const ANALYTICS_READY_EVENT = 'dotcms:analytics:ready';
|
|
888
943
|
|
|
889
944
|
/**
|
|
890
945
|
* Gets the current state of the Universal Visual Editor (UVE).
|
|
@@ -1434,6 +1489,8 @@ function initUVE(config = {}) {
|
|
|
1434
1489
|
};
|
|
1435
1490
|
}
|
|
1436
1491
|
|
|
1492
|
+
exports.ANALYTICS_ACTIVE_WINDOW_KEY = ANALYTICS_ACTIVE_WINDOW_KEY;
|
|
1493
|
+
exports.ANALYTICS_READY_EVENT = ANALYTICS_READY_EVENT;
|
|
1437
1494
|
exports.CUSTOM_NO_COMPONENT = CUSTOM_NO_COMPONENT;
|
|
1438
1495
|
exports.DEVELOPMENT_MODE = DEVELOPMENT_MODE;
|
|
1439
1496
|
exports.DOT_SECTION_ID_PREFIX = DOT_SECTION_ID_PREFIX;
|
|
@@ -1454,6 +1511,7 @@ exports.editContentlet = editContentlet;
|
|
|
1454
1511
|
exports.enableBlockEditorInline = enableBlockEditorInline;
|
|
1455
1512
|
exports.findDotCMSElement = findDotCMSElement;
|
|
1456
1513
|
exports.findDotCMSVTLData = findDotCMSVTLData;
|
|
1514
|
+
exports.getAnalyticsContentletAttributes = getAnalyticsContentletAttributes;
|
|
1457
1515
|
exports.getClosestDotCMSContainerData = getClosestDotCMSContainerData;
|
|
1458
1516
|
exports.getColumnPositionClasses = getColumnPositionClasses;
|
|
1459
1517
|
exports.getContainersData = getContainersData;
|
|
@@ -1466,6 +1524,7 @@ exports.getDotContentletAttributes = getDotContentletAttributes;
|
|
|
1466
1524
|
exports.getUVEState = getUVEState;
|
|
1467
1525
|
exports.initInlineEditing = initInlineEditing;
|
|
1468
1526
|
exports.initUVE = initUVE;
|
|
1527
|
+
exports.isDotAnalyticsActive = isDotAnalyticsActive;
|
|
1469
1528
|
exports.isValidBlocks = isValidBlocks;
|
|
1470
1529
|
exports.readContentletDataset = readContentletDataset;
|
|
1471
1530
|
exports.reorderMenu = reorderMenu;
|
package/public.esm.js
CHANGED
|
@@ -255,6 +255,38 @@ function getDotContentletAttributes(contentlet, container) {
|
|
|
255
255
|
})
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
|
+
/**
|
|
259
|
+
*
|
|
260
|
+
* Returns the minimal set of contentlet data attributes required by DotCMS
|
|
261
|
+
* Analytics (impression & click tracking) to identify a contentlet.
|
|
262
|
+
*
|
|
263
|
+
* Used in live mode where the full editor metadata is stripped but Analytics
|
|
264
|
+
* still needs to resolve the contentlet behind an impression/click.
|
|
265
|
+
*
|
|
266
|
+
* @param {DotCMSBasicContentlet} contentlet - The contentlet to get the attributes for
|
|
267
|
+
* @returns {DotAnalyticsContentletAttributes} The Analytics-required data attributes
|
|
268
|
+
*/
|
|
269
|
+
function getAnalyticsContentletAttributes(contentlet) {
|
|
270
|
+
return {
|
|
271
|
+
'data-dot-identifier': contentlet?.identifier,
|
|
272
|
+
'data-dot-inode': contentlet?.inode,
|
|
273
|
+
'data-dot-title': contentlet?.['widgetTitle'] || contentlet?.title,
|
|
274
|
+
'data-dot-type': contentlet?.contentType,
|
|
275
|
+
'data-dot-basetype': contentlet?.baseType
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
*
|
|
280
|
+
* Checks whether DotCMS Analytics is initialized and active on the page.
|
|
281
|
+
*
|
|
282
|
+
* The SDKs use this in live mode to decide whether to keep the minimal
|
|
283
|
+
* contentlet attributes Analytics depends on.
|
|
284
|
+
*
|
|
285
|
+
* @returns {boolean} `true` when analytics is active, otherwise `false`
|
|
286
|
+
*/
|
|
287
|
+
function isDotAnalyticsActive() {
|
|
288
|
+
return typeof window !== 'undefined' && window[ANALYTICS_ACTIVE_WINDOW_KEY] === true;
|
|
289
|
+
}
|
|
258
290
|
/**
|
|
259
291
|
*
|
|
260
292
|
*
|
|
@@ -883,6 +915,29 @@ const CUSTOM_NO_COMPONENT = 'CustomNoComponent';
|
|
|
883
915
|
* @internal
|
|
884
916
|
*/
|
|
885
917
|
const DOT_SECTION_ID_PREFIX = 'dot-section-';
|
|
918
|
+
/**
|
|
919
|
+
* Window flag set by `@dotcms/analytics` when content analytics is initialized
|
|
920
|
+
* and active on the page.
|
|
921
|
+
*
|
|
922
|
+
* @important This value is intentionally duplicated from `@dotcms/analytics`
|
|
923
|
+
* (`ANALYTICS_WINDOWS_ACTIVE_KEY` in dot-analytics.constants.ts). The SDKs read
|
|
924
|
+
* it in live mode to decide whether to keep the minimal contentlet attributes
|
|
925
|
+
* Analytics depends on. Both constants MUST stay in sync.
|
|
926
|
+
*
|
|
927
|
+
* @internal
|
|
928
|
+
*/
|
|
929
|
+
const ANALYTICS_ACTIVE_WINDOW_KEY = '__dotAnalyticsActive__';
|
|
930
|
+
/**
|
|
931
|
+
* Event dispatched by `@dotcms/analytics` once analytics is ready. The SDKs
|
|
932
|
+
* listen for it so live-mode contentlets can re-render with the attributes
|
|
933
|
+
* Analytics needs, regardless of initialization order.
|
|
934
|
+
*
|
|
935
|
+
* @important Kept in sync with the `dotcms:analytics:ready` event dispatched by
|
|
936
|
+
* `@dotcms/analytics` (initializeContentAnalytics).
|
|
937
|
+
*
|
|
938
|
+
* @internal
|
|
939
|
+
*/
|
|
940
|
+
const ANALYTICS_READY_EVENT = 'dotcms:analytics:ready';
|
|
886
941
|
|
|
887
942
|
/**
|
|
888
943
|
* Gets the current state of the Universal Visual Editor (UVE).
|
|
@@ -1432,4 +1487,4 @@ function initUVE(config = {}) {
|
|
|
1432
1487
|
};
|
|
1433
1488
|
}
|
|
1434
1489
|
|
|
1435
|
-
export {
|
|
1490
|
+
export { ANALYTICS_ACTIVE_WINDOW_KEY as A, getDotCMSContentletsBound as B, CUSTOM_NO_COMPONENT as C, DEVELOPMENT_MODE as D, EMPTY_CONTAINER_STYLE_ANGULAR as E, getDotCMSPageBounds as F, getDotContainerAttributes as G, getDotContentletAttributes as H, isDotAnalyticsActive as I, isValidBlocks as J, readContentletDataset as K, setBounds as L, PRODUCTION_MODE as P, START_CLASS as S, TEMP_EMPTY_CONTENTLET as T, __UVE_EVENTS__ as _, createUVESubscription as a, enableBlockEditorInline as b, createContentlet as c, initUVE as d, editContentlet as e, ANALYTICS_READY_EVENT as f, getUVEState as g, DOT_SECTION_ID_PREFIX as h, initInlineEditing as i, EMPTY_CONTAINER_STYLE_REACT as j, END_CLASS as k, TEMP_EMPTY_CONTENTLET_TYPE as l, __UVE_EVENT_ERROR_FALLBACK__ as m, combineClasses as n, computeScrollIsInBottom as o, findDotCMSElement as p, findDotCMSVTLData as q, reorderMenu as r, sendMessageToUVE as s, getAnalyticsContentletAttributes as t, updateNavigation as u, getClosestDotCMSContainerData as v, getColumnPositionClasses as w, getContainersData as x, getContentletsInContainer as y, getDotCMSContainerData as z };
|
|
@@ -81,3 +81,26 @@ export declare const CUSTOM_NO_COMPONENT = "CustomNoComponent";
|
|
|
81
81
|
* @internal
|
|
82
82
|
*/
|
|
83
83
|
export declare const DOT_SECTION_ID_PREFIX = "dot-section-";
|
|
84
|
+
/**
|
|
85
|
+
* Window flag set by `@dotcms/analytics` when content analytics is initialized
|
|
86
|
+
* and active on the page.
|
|
87
|
+
*
|
|
88
|
+
* @important This value is intentionally duplicated from `@dotcms/analytics`
|
|
89
|
+
* (`ANALYTICS_WINDOWS_ACTIVE_KEY` in dot-analytics.constants.ts). The SDKs read
|
|
90
|
+
* it in live mode to decide whether to keep the minimal contentlet attributes
|
|
91
|
+
* Analytics depends on. Both constants MUST stay in sync.
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
export declare const ANALYTICS_ACTIVE_WINDOW_KEY = "__dotAnalyticsActive__";
|
|
96
|
+
/**
|
|
97
|
+
* Event dispatched by `@dotcms/analytics` once analytics is ready. The SDKs
|
|
98
|
+
* listen for it so live-mode contentlets can re-render with the attributes
|
|
99
|
+
* Analytics needs, regardless of initialization order.
|
|
100
|
+
*
|
|
101
|
+
* @important Kept in sync with the `dotcms:analytics:ready` event dispatched by
|
|
102
|
+
* `@dotcms/analytics` (initializeContentAnalytics).
|
|
103
|
+
*
|
|
104
|
+
* @internal
|
|
105
|
+
*/
|
|
106
|
+
export declare const ANALYTICS_READY_EVENT = "dotcms:analytics:ready";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DotCMSBasicContentlet, DotCMSColumnContainer, DotCMSPageAsset, DotPageAssetLayoutColumn, EditableContainerData } from '@dotcms/types';
|
|
2
|
-
import { DotCMSContainerBound, DotCMSContentletBound, DotContainerAttributes, DotContentletAttributes } from '@dotcms/types/internal';
|
|
2
|
+
import { DotAnalyticsContentletAttributes, DotCMSContainerBound, DotCMSContentletBound, DotContainerAttributes, DotContentletAttributes } from '@dotcms/types/internal';
|
|
3
3
|
/**
|
|
4
4
|
* Calculates the bounding information for each page element within the given containers.
|
|
5
5
|
*
|
|
@@ -152,6 +152,28 @@ export declare const getColumnPositionClasses: (column: DotPageAssetLayoutColumn
|
|
|
152
152
|
* @returns {DotContentletAttributes} The dotCMS data attributes
|
|
153
153
|
*/
|
|
154
154
|
export declare function getDotContentletAttributes(contentlet: DotCMSBasicContentlet, container: string): DotContentletAttributes;
|
|
155
|
+
/**
|
|
156
|
+
*
|
|
157
|
+
* Returns the minimal set of contentlet data attributes required by DotCMS
|
|
158
|
+
* Analytics (impression & click tracking) to identify a contentlet.
|
|
159
|
+
*
|
|
160
|
+
* Used in live mode where the full editor metadata is stripped but Analytics
|
|
161
|
+
* still needs to resolve the contentlet behind an impression/click.
|
|
162
|
+
*
|
|
163
|
+
* @param {DotCMSBasicContentlet} contentlet - The contentlet to get the attributes for
|
|
164
|
+
* @returns {DotAnalyticsContentletAttributes} The Analytics-required data attributes
|
|
165
|
+
*/
|
|
166
|
+
export declare function getAnalyticsContentletAttributes(contentlet: DotCMSBasicContentlet): DotAnalyticsContentletAttributes;
|
|
167
|
+
/**
|
|
168
|
+
*
|
|
169
|
+
* Checks whether DotCMS Analytics is initialized and active on the page.
|
|
170
|
+
*
|
|
171
|
+
* The SDKs use this in live mode to decide whether to keep the minimal
|
|
172
|
+
* contentlet attributes Analytics depends on.
|
|
173
|
+
*
|
|
174
|
+
* @returns {boolean} `true` when analytics is active, otherwise `false`
|
|
175
|
+
*/
|
|
176
|
+
export declare function isDotAnalyticsActive(): boolean;
|
|
155
177
|
/**
|
|
156
178
|
*
|
|
157
179
|
*
|