@dotcms/uve 1.2.1-next.13 → 1.2.1-next.14

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/public.cjs.js CHANGED
@@ -237,24 +237,10 @@ function getDotContentletAttributes(contentlet, container) {
237
237
  'data-dot-inode': contentlet?.inode,
238
238
  'data-dot-type': contentlet?.contentType,
239
239
  'data-dot-container': container,
240
- 'data-dot-on-number-of-pages': contentlet?.['onNumberOfPages'] || '1'
241
- };
242
- }
243
- /**
244
- * Helper function that returns an object containing analytics-specific data attributes.
245
- * These attributes are used by the DotCMS Analytics SDK to track content interactions.
246
- *
247
- * @param {DotCMSBasicContentlet} contentlet - The contentlet to get the analytics attributes for
248
- * @returns {DotAnalyticsAttributes} The analytics data attributes
249
- * @internal
250
- */
251
- function getDotAnalyticsAttributes(contentlet) {
252
- return {
253
- 'data-dot-analytics-identifier': contentlet?.identifier,
254
- 'data-dot-analytics-inode': contentlet?.inode,
255
- 'data-dot-analytics-basetype': contentlet?.baseType,
256
- 'data-dot-analytics-contenttype': contentlet?.contentType,
257
- 'data-dot-analytics-title': contentlet?.['widgetTitle'] || contentlet?.title
240
+ 'data-dot-on-number-of-pages': contentlet?.['onNumberOfPages'] || '1',
241
+ ...(contentlet?.styleProperties && {
242
+ 'data-dot-style-properties': JSON.stringify(contentlet.styleProperties)
243
+ })
258
244
  };
259
245
  }
260
246
  /**
@@ -490,7 +476,10 @@ function onContentletHovered(callback) {
490
476
  contentType: foundElement.dataset?.['dotType'],
491
477
  baseType: foundElement.dataset?.['dotBasetype'],
492
478
  widgetTitle: foundElement.dataset?.['dotWidgetTitle'],
493
- onNumberOfPages: foundElement.dataset?.['dotOnNumberOfPages']
479
+ onNumberOfPages: foundElement.dataset?.['dotOnNumberOfPages'],
480
+ ...(foundElement.dataset?.['dotStyleProperties'] && {
481
+ styleProperties: JSON.parse(foundElement.dataset['dotStyleProperties'])
482
+ })
494
483
  };
495
484
  const vtlFiles = findDotCMSVTLData(foundElement);
496
485
  const contentletPayload = {
@@ -614,10 +603,6 @@ const EMPTY_CONTAINER_STYLE_ANGULAR = {
614
603
  * @internal
615
604
  */
616
605
  const CUSTOM_NO_COMPONENT = 'CustomNoComponent';
617
- // Analytics active flag key
618
- const ANALYTICS_WINDOWS_ACTIVE_KEY = '__dotAnalyticsActive__';
619
- // Analytics cleanup function key
620
- const ANALYTICS_WINDOWS_CLEANUP_KEY = '__dotAnalyticsCleanup';
621
606
 
622
607
  /**
623
608
  * Gets the current state of the Universal Visual Editor (UVE).
@@ -703,57 +688,6 @@ function createUVESubscription(eventType, callback) {
703
688
  }
704
689
  return eventCallback(callback);
705
690
  }
706
- /**
707
- * Checks if DotCMS Analytics is active by verifying the global window flag.
708
- *
709
- * This function checks for the presence of the `__dotAnalyticsActive__` flag on the window object,
710
- * which is set by the `@dotcms/analytics` SDK when Analytics is successfully initialized.
711
- *
712
- * This utility can be used in any JavaScript framework (React, Angular, Vue, etc.) to conditionally
713
- * enable analytics-related features or data attributes.
714
- *
715
- * @export
716
- * @returns {boolean} true if Analytics is initialized and active, false otherwise
717
- *
718
- * @example
719
- * ```ts
720
- * // React example
721
- * import { isAnalyticsActive } from '@dotcms/uve/internal';
722
- *
723
- * function MyComponent() {
724
- * const shouldTrack = isAnalyticsActive();
725
- *
726
- * if (shouldTrack) {
727
- * // Add analytics tracking
728
- * }
729
- * }
730
- * ```
731
- *
732
- * @example
733
- * ```ts
734
- * // Angular example
735
- * import { isAnalyticsActive } from '@dotcms/uve/internal';
736
- *
737
- * if (isAnalyticsActive()) {
738
- * // Apply analytics attributes to elements
739
- * element.setAttribute('data-dot-object', 'contentlet');
740
- * }
741
- * ```
742
- *
743
- * @example
744
- * ```ts
745
- * // Vanilla JavaScript / Any framework
746
- * import { isAnalyticsActive } from '@dotcms/uve/internal';
747
- *
748
- * if (isAnalyticsActive()) {
749
- * console.log('DotCMS Analytics is active');
750
- * }
751
- * ```
752
- */
753
- function isAnalyticsActive() {
754
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
755
- return typeof window !== 'undefined' && window[ANALYTICS_WINDOWS_ACTIVE_KEY] === true;
756
- }
757
691
 
758
692
  /**
759
693
  * Sets the bounds of the containers in the editor.
@@ -1176,8 +1110,6 @@ function initUVE(config = {}) {
1176
1110
  };
1177
1111
  }
1178
1112
 
1179
- exports.ANALYTICS_WINDOWS_ACTIVE_KEY = ANALYTICS_WINDOWS_ACTIVE_KEY;
1180
- exports.ANALYTICS_WINDOWS_CLEANUP_KEY = ANALYTICS_WINDOWS_CLEANUP_KEY;
1181
1113
  exports.CUSTOM_NO_COMPONENT = CUSTOM_NO_COMPONENT;
1182
1114
  exports.DEVELOPMENT_MODE = DEVELOPMENT_MODE;
1183
1115
  exports.EMPTY_CONTAINER_STYLE_ANGULAR = EMPTY_CONTAINER_STYLE_ANGULAR;
@@ -1198,7 +1130,6 @@ exports.getClosestDotCMSContainerData = getClosestDotCMSContainerData;
1198
1130
  exports.getColumnPositionClasses = getColumnPositionClasses;
1199
1131
  exports.getContainersData = getContainersData;
1200
1132
  exports.getContentletsInContainer = getContentletsInContainer;
1201
- exports.getDotAnalyticsAttributes = getDotAnalyticsAttributes;
1202
1133
  exports.getDotCMSContainerData = getDotCMSContainerData;
1203
1134
  exports.getDotCMSContentletsBound = getDotCMSContentletsBound;
1204
1135
  exports.getDotCMSPageBounds = getDotCMSPageBounds;
@@ -1207,7 +1138,6 @@ exports.getDotContentletAttributes = getDotContentletAttributes;
1207
1138
  exports.getUVEState = getUVEState;
1208
1139
  exports.initInlineEditing = initInlineEditing;
1209
1140
  exports.initUVE = initUVE;
1210
- exports.isAnalyticsActive = isAnalyticsActive;
1211
1141
  exports.isValidBlocks = isValidBlocks;
1212
1142
  exports.reorderMenu = reorderMenu;
1213
1143
  exports.sendMessageToUVE = sendMessageToUVE;
package/public.esm.js CHANGED
@@ -235,24 +235,10 @@ function getDotContentletAttributes(contentlet, container) {
235
235
  'data-dot-inode': contentlet?.inode,
236
236
  'data-dot-type': contentlet?.contentType,
237
237
  'data-dot-container': container,
238
- 'data-dot-on-number-of-pages': contentlet?.['onNumberOfPages'] || '1'
239
- };
240
- }
241
- /**
242
- * Helper function that returns an object containing analytics-specific data attributes.
243
- * These attributes are used by the DotCMS Analytics SDK to track content interactions.
244
- *
245
- * @param {DotCMSBasicContentlet} contentlet - The contentlet to get the analytics attributes for
246
- * @returns {DotAnalyticsAttributes} The analytics data attributes
247
- * @internal
248
- */
249
- function getDotAnalyticsAttributes(contentlet) {
250
- return {
251
- 'data-dot-analytics-identifier': contentlet?.identifier,
252
- 'data-dot-analytics-inode': contentlet?.inode,
253
- 'data-dot-analytics-basetype': contentlet?.baseType,
254
- 'data-dot-analytics-contenttype': contentlet?.contentType,
255
- 'data-dot-analytics-title': contentlet?.['widgetTitle'] || contentlet?.title
238
+ 'data-dot-on-number-of-pages': contentlet?.['onNumberOfPages'] || '1',
239
+ ...(contentlet?.styleProperties && {
240
+ 'data-dot-style-properties': JSON.stringify(contentlet.styleProperties)
241
+ })
256
242
  };
257
243
  }
258
244
  /**
@@ -488,7 +474,10 @@ function onContentletHovered(callback) {
488
474
  contentType: foundElement.dataset?.['dotType'],
489
475
  baseType: foundElement.dataset?.['dotBasetype'],
490
476
  widgetTitle: foundElement.dataset?.['dotWidgetTitle'],
491
- onNumberOfPages: foundElement.dataset?.['dotOnNumberOfPages']
477
+ onNumberOfPages: foundElement.dataset?.['dotOnNumberOfPages'],
478
+ ...(foundElement.dataset?.['dotStyleProperties'] && {
479
+ styleProperties: JSON.parse(foundElement.dataset['dotStyleProperties'])
480
+ })
492
481
  };
493
482
  const vtlFiles = findDotCMSVTLData(foundElement);
494
483
  const contentletPayload = {
@@ -612,10 +601,6 @@ const EMPTY_CONTAINER_STYLE_ANGULAR = {
612
601
  * @internal
613
602
  */
614
603
  const CUSTOM_NO_COMPONENT = 'CustomNoComponent';
615
- // Analytics active flag key
616
- const ANALYTICS_WINDOWS_ACTIVE_KEY = '__dotAnalyticsActive__';
617
- // Analytics cleanup function key
618
- const ANALYTICS_WINDOWS_CLEANUP_KEY = '__dotAnalyticsCleanup';
619
604
 
620
605
  /**
621
606
  * Gets the current state of the Universal Visual Editor (UVE).
@@ -701,57 +686,6 @@ function createUVESubscription(eventType, callback) {
701
686
  }
702
687
  return eventCallback(callback);
703
688
  }
704
- /**
705
- * Checks if DotCMS Analytics is active by verifying the global window flag.
706
- *
707
- * This function checks for the presence of the `__dotAnalyticsActive__` flag on the window object,
708
- * which is set by the `@dotcms/analytics` SDK when Analytics is successfully initialized.
709
- *
710
- * This utility can be used in any JavaScript framework (React, Angular, Vue, etc.) to conditionally
711
- * enable analytics-related features or data attributes.
712
- *
713
- * @export
714
- * @returns {boolean} true if Analytics is initialized and active, false otherwise
715
- *
716
- * @example
717
- * ```ts
718
- * // React example
719
- * import { isAnalyticsActive } from '@dotcms/uve/internal';
720
- *
721
- * function MyComponent() {
722
- * const shouldTrack = isAnalyticsActive();
723
- *
724
- * if (shouldTrack) {
725
- * // Add analytics tracking
726
- * }
727
- * }
728
- * ```
729
- *
730
- * @example
731
- * ```ts
732
- * // Angular example
733
- * import { isAnalyticsActive } from '@dotcms/uve/internal';
734
- *
735
- * if (isAnalyticsActive()) {
736
- * // Apply analytics attributes to elements
737
- * element.setAttribute('data-dot-object', 'contentlet');
738
- * }
739
- * ```
740
- *
741
- * @example
742
- * ```ts
743
- * // Vanilla JavaScript / Any framework
744
- * import { isAnalyticsActive } from '@dotcms/uve/internal';
745
- *
746
- * if (isAnalyticsActive()) {
747
- * console.log('DotCMS Analytics is active');
748
- * }
749
- * ```
750
- */
751
- function isAnalyticsActive() {
752
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
753
- return typeof window !== 'undefined' && window[ANALYTICS_WINDOWS_ACTIVE_KEY] === true;
754
- }
755
689
 
756
690
  /**
757
691
  * Sets the bounds of the containers in the editor.
@@ -1174,4 +1108,4 @@ function initUVE(config = {}) {
1174
1108
  };
1175
1109
  }
1176
1110
 
1177
- export { ANALYTICS_WINDOWS_ACTIVE_KEY as A, getContentletsInContainer as B, CUSTOM_NO_COMPONENT as C, DEVELOPMENT_MODE as D, END_CLASS as E, getDotContainerAttributes as F, setBounds as G, isValidBlocks as H, PRODUCTION_MODE as P, START_CLASS as S, __UVE_EVENTS__ as _, initInlineEditing as a, enableBlockEditorInline as b, createUVESubscription as c, initUVE as d, editContentlet as e, __UVE_EVENT_ERROR_FALLBACK__ as f, getUVEState as g, EMPTY_CONTAINER_STYLE_REACT as h, isAnalyticsActive as i, EMPTY_CONTAINER_STYLE_ANGULAR as j, ANALYTICS_WINDOWS_CLEANUP_KEY as k, getDotCMSPageBounds as l, getDotCMSContentletsBound as m, getDotCMSContainerData as n, getClosestDotCMSContainerData as o, findDotCMSElement as p, findDotCMSVTLData as q, reorderMenu as r, sendMessageToUVE as s, computeScrollIsInBottom as t, updateNavigation as u, combineClasses as v, getColumnPositionClasses as w, getDotContentletAttributes as x, getDotAnalyticsAttributes as y, getContainersData as z };
1111
+ export { isValidBlocks as A, CUSTOM_NO_COMPONENT as C, DEVELOPMENT_MODE as D, END_CLASS as E, PRODUCTION_MODE as P, START_CLASS as S, __UVE_EVENTS__ as _, enableBlockEditorInline as a, initUVE as b, createUVESubscription as c, __UVE_EVENT_ERROR_FALLBACK__ as d, editContentlet as e, EMPTY_CONTAINER_STYLE_REACT as f, getUVEState as g, EMPTY_CONTAINER_STYLE_ANGULAR as h, initInlineEditing as i, getDotCMSPageBounds as j, getDotCMSContentletsBound as k, getDotCMSContainerData as l, getClosestDotCMSContainerData as m, findDotCMSElement as n, findDotCMSVTLData as o, computeScrollIsInBottom as p, combineClasses as q, reorderMenu as r, sendMessageToUVE as s, getColumnPositionClasses as t, updateNavigation as u, getDotContentletAttributes as v, getContainersData as w, getContentletsInContainer as x, getDotContainerAttributes as y, setBounds as z };
@@ -74,5 +74,3 @@ export declare const EMPTY_CONTAINER_STYLE_ANGULAR: {
74
74
  * @internal
75
75
  */
76
76
  export declare const CUSTOM_NO_COMPONENT = "CustomNoComponent";
77
- export declare const ANALYTICS_WINDOWS_ACTIVE_KEY = "__dotAnalyticsActive__";
78
- export declare const ANALYTICS_WINDOWS_CLEANUP_KEY = "__dotAnalyticsCleanup";
@@ -47,51 +47,3 @@ export declare function getUVEState(): UVEState | undefined;
47
47
  * ```
48
48
  */
49
49
  export declare function createUVESubscription<T extends UVEEventType>(eventType: T, callback: (payload: UVEEventPayloadMap[T] extends undefined ? void : UVEEventPayloadMap[T]) => void): UVEEventSubscription;
50
- /**
51
- * Checks if DotCMS Analytics is active by verifying the global window flag.
52
- *
53
- * This function checks for the presence of the `__dotAnalyticsActive__` flag on the window object,
54
- * which is set by the `@dotcms/analytics` SDK when Analytics is successfully initialized.
55
- *
56
- * This utility can be used in any JavaScript framework (React, Angular, Vue, etc.) to conditionally
57
- * enable analytics-related features or data attributes.
58
- *
59
- * @export
60
- * @returns {boolean} true if Analytics is initialized and active, false otherwise
61
- *
62
- * @example
63
- * ```ts
64
- * // React example
65
- * import { isAnalyticsActive } from '@dotcms/uve/internal';
66
- *
67
- * function MyComponent() {
68
- * const shouldTrack = isAnalyticsActive();
69
- *
70
- * if (shouldTrack) {
71
- * // Add analytics tracking
72
- * }
73
- * }
74
- * ```
75
- *
76
- * @example
77
- * ```ts
78
- * // Angular example
79
- * import { isAnalyticsActive } from '@dotcms/uve/internal';
80
- *
81
- * if (isAnalyticsActive()) {
82
- * // Apply analytics attributes to elements
83
- * element.setAttribute('data-dot-object', 'contentlet');
84
- * }
85
- * ```
86
- *
87
- * @example
88
- * ```ts
89
- * // Vanilla JavaScript / Any framework
90
- * import { isAnalyticsActive } from '@dotcms/uve/internal';
91
- *
92
- * if (isAnalyticsActive()) {
93
- * console.log('DotCMS Analytics is active');
94
- * }
95
- * ```
96
- */
97
- export declare function isAnalyticsActive(): boolean;
@@ -1,5 +1,5 @@
1
1
  import { DotCMSBasicContentlet, DotCMSColumnContainer, DotCMSPageAsset, DotPageAssetLayoutColumn, EditableContainerData } from '@dotcms/types';
2
- import { DotAnalyticsAttributes, DotCMSContainerBound, DotCMSContentletBound, DotContainerAttributes, DotContentletAttributes } from '@dotcms/types/internal';
2
+ import { 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,15 +152,6 @@ 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
- * Helper function that returns an object containing analytics-specific data attributes.
157
- * These attributes are used by the DotCMS Analytics SDK to track content interactions.
158
- *
159
- * @param {DotCMSBasicContentlet} contentlet - The contentlet to get the analytics attributes for
160
- * @returns {DotAnalyticsAttributes} The analytics data attributes
161
- * @internal
162
- */
163
- export declare function getDotAnalyticsAttributes(contentlet: DotCMSBasicContentlet): DotAnalyticsAttributes;
164
155
  /**
165
156
  *
166
157
  *
@@ -1,4 +1,4 @@
1
- import { StyleEditorFormSchema, StyleEditorForm } from './types';
1
+ import { StyleEditorForm, StyleEditorFormSchema } from './types';
2
2
  /**
3
3
  * Normalizes a complete form definition into the schema format expected by UVE.
4
4
  *
@@ -32,14 +32,14 @@ import { StyleEditorFormSchema, StyleEditorForm } from './types';
32
32
  * {
33
33
  * title: 'Typography',
34
34
  * fields: [
35
- * { type: 'input', label: 'Font Size', inputType: 'number', defaultValue: 16 },
36
- * { type: 'dropdown', label: 'Font Family', options: ['Arial', 'Helvetica'] }
35
+ * { type: 'input', id: 'font-size', label: 'Font Size', inputType: 'number' },
36
+ * { type: 'dropdown', id: 'font-family', label: 'Font Family', options: ['Arial', 'Helvetica'] }
37
37
  * ]
38
38
  * },
39
39
  * {
40
40
  * title: 'Colors',
41
41
  * fields: [
42
- * { type: 'input', label: 'Primary Color', inputType: 'text', defaultValue: '#000000' }
42
+ * { type: 'input', id: 'primary-color', label: 'Primary Color', inputType: 'text' }
43
43
  * ]
44
44
  * }
45
45
  * ]
@@ -51,8 +51,8 @@ import { StyleEditorFormSchema, StyleEditorForm } from './types';
51
51
  * // title: 'Typography',
52
52
  * // fields: [
53
53
  * // [
54
- * // { type: 'input', label: 'Font Size', config: { inputType: 'number', defaultValue: 16 } },
55
- * // { type: 'dropdown', label: 'Font Family', config: { options: [...] } }
54
+ * // { type: 'input', id: 'font-size', label: 'Font Size', config: { inputType: 'number' } },
55
+ * // { type: 'dropdown', id: 'font-family', label: 'Font Family', config: { options: [...] } }
56
56
  * // ]
57
57
  * // ]
58
58
  * // },
@@ -60,7 +60,7 @@ import { StyleEditorFormSchema, StyleEditorForm } from './types';
60
60
  * // title: 'Colors',
61
61
  * // fields: [
62
62
  * // [
63
- * // { type: 'input', label: 'Primary Color', config: { inputType: 'text', defaultValue: '#000000' } }
63
+ * // { type: 'input', id: 'primary-color', label: 'Primary Color', config: { inputType: 'text' } }
64
64
  * // ]
65
65
  * // ]
66
66
  * // }