@dotcms/uve 1.5.5-next.2245 → 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/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, f as DOT_SECTION_ID_PREFIX, E as EMPTY_CONTAINER_STYLE_ANGULAR, h as EMPTY_CONTAINER_STYLE_REACT, j as END_CLASS, P as PRODUCTION_MODE, S as START_CLASS, T as TEMP_EMPTY_CONTENTLET, k as TEMP_EMPTY_CONTENTLET_TYPE, _ as __UVE_EVENTS__, l as __UVE_EVENT_ERROR_FALLBACK__, m as combineClasses, n as computeScrollIsInBottom, a as createUVESubscription, o as findDotCMSElement, p as findDotCMSVTLData, q as getClosestDotCMSContainerData, t as getColumnPositionClasses, v as getContainersData, w as getContentletsInContainer, x as getDotCMSContainerData, y as getDotCMSContentletsBound, z as getDotCMSPageBounds, A as getDotContainerAttributes, B as getDotContentletAttributes, F as isValidBlocks, G as readContentletDataset, H as setBounds } from './public.esm.js';
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcms/uve",
3
- "version": "1.5.5-next.2245",
3
+ "version": "1.5.5-next.2253",
4
4
  "description": "Official JavaScript library for interacting with Universal Visual Editor (UVE)",
5
5
  "repository": {
6
6
  "type": "git",
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 { getDotContainerAttributes as A, getDotContentletAttributes as B, CUSTOM_NO_COMPONENT as C, DEVELOPMENT_MODE as D, EMPTY_CONTAINER_STYLE_ANGULAR as E, isValidBlocks as F, readContentletDataset as G, setBounds as H, 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, DOT_SECTION_ID_PREFIX as f, getUVEState as g, EMPTY_CONTAINER_STYLE_REACT as h, initInlineEditing as i, END_CLASS as j, TEMP_EMPTY_CONTENTLET_TYPE as k, __UVE_EVENT_ERROR_FALLBACK__ as l, combineClasses as m, computeScrollIsInBottom as n, findDotCMSElement as o, findDotCMSVTLData as p, getClosestDotCMSContainerData as q, reorderMenu as r, sendMessageToUVE as s, getColumnPositionClasses as t, updateNavigation as u, getContainersData as v, getContentletsInContainer as w, getDotCMSContainerData as x, getDotCMSContentletsBound as y, getDotCMSPageBounds as z };
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
  *