@dotcms/analytics 1.6.0-next.27 → 1.6.0-next.36

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 CHANGED
@@ -698,7 +698,7 @@ We offer multiple channels to get help with the dotCMS Analytics SDK:
698
698
  - **GitHub Issues**: For bug reports and feature requests, please [open an issue](https://github.com/dotCMS/core/issues/new/choose) in the GitHub repository.
699
699
  - **Community Forum**: Join our [community discussions](https://community.dotcms.com/) to ask questions and share solutions.
700
700
  - **Stack Overflow**: Use the tag `dotcms-analytics` when posting questions.
701
- - **Enterprise Support**: Enterprise customers can access premium support through the [dotCMS Support Portal](https://helpdesk.dotcms.com/support/).
701
+ - **Enterprise Support**: Enterprise customers can access premium support through the [dotCMS Support Portal](https://www.dotcms.com/support).
702
702
 
703
703
  When reporting issues, please include:
704
704
 
@@ -721,8 +721,8 @@ Please ensure your code follows the existing style and includes appropriate test
721
721
 
722
722
  ## Licensing
723
723
 
724
- 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).
724
+ dotCMS is available under either the [Business Source License 1.1 (BSL)](https://www.dotcms.com/bsl) or a commercial license.
725
725
 
726
- This SDK is part of dotCMS's dual-licensed platform (GPL 3.0 for Community, commercial license for Enterprise).
726
+ Under the BSL, dotCMS can be used at no cost by individual developers, small businesses or agencies under $5M in total finances, and by larger organizations in non-production environments. Every BSL release automatically converts to GPL v3 four years after its release date. For full terms and FAQs, visit [dotcms.com/bsl](https://www.dotcms.com/bsl) and [dotcms.com/bsl-faq](https://www.dotcms.com/bsl-faq).
727
727
 
728
- [Learn more ](https://www.dotcms.com)at [dotcms.com](https://www.dotcms.com).
728
+ Production use in larger organizations, along with access to managed cloud, SLAs, support, and enterprise capabilities, is available under a commercial license from dotCMS. For details on commercial plans, features, and support options, see [dotcms.com/pricing](https://www.dotcms.com/pricing).
@@ -93,7 +93,10 @@ export interface DotCMSAnalyticsConfig {
93
93
  */
94
94
  logLevel?: LogLevel;
95
95
  /**
96
- * Automatically track page views when set to true.
96
+ * Automatically track page views. Defaults to `true` (opt-out).
97
+ * Set explicitly to `false` to disable automatic page view tracking.
98
+ * Via the HTML `data-analytics-auto-page-view` attribute, only the literal string "false"
99
+ * disables it (any other value, including "", enables it).
97
100
  */
98
101
  autoPageView?: boolean;
99
102
  /**
@@ -92,7 +92,9 @@ export interface AnalyticsConfigResult {
92
92
  * Always returns a config (with defaults if needed).
93
93
  *
94
94
  * - If no data-analytics-server attribute is found, uses the current domain as the server endpoint
95
- * - Both debug and autoPageView default to false (must be explicitly set to "true")
95
+ * - debug defaults to false (opt-in: must be explicitly set to "true")
96
+ * - autoPageView defaults to true (opt-out: only the literal string "false" disables it via
97
+ * `data-analytics-auto-page-view="false"`)
96
98
  *
97
99
  * @returns The analytics configuration object
98
100
  */
@@ -1,16 +1,16 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { Suspense as e, useMemo as i } from "react";
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { Suspense as r, useMemo as a } from "react";
3
3
  import { useRouterTracker as l } from "../hook/useRouterTracker.js";
4
- import { initializeAnalytics as u } from "../internal/utils.js";
5
- function a({
4
+ import { initializeAnalytics as i } from "../internal/utils.js";
5
+ function u({
6
6
  config: t
7
7
  }) {
8
- const n = i(() => u(t), [t]), r = !!t.debug;
9
- return n && l(n, r), null;
8
+ const n = a(() => i(t), [t]), o = !!t.debug;
9
+ return l(n, o, t.autoPageView !== !1), null;
10
10
  }
11
- function p({ config: t }) {
12
- return /* @__PURE__ */ o(e, { fallback: null, children: /* @__PURE__ */ o(a, { config: t }) });
11
+ function f({ config: t }) {
12
+ return /* @__PURE__ */ e(r, { fallback: null, children: /* @__PURE__ */ e(u, { config: t }) });
13
13
  }
14
14
  export {
15
- p as DotContentAnalytics
15
+ f as DotContentAnalytics
16
16
  };
@@ -7,5 +7,6 @@ import { DotCMSAnalytics } from '../../core/shared/models';
7
7
  *
8
8
  * @param analytics Analytics singleton instance; if null, does nothing
9
9
  * @param debug When true, logs which tracking path is used
10
+ * @param enabled When false, tracking is disabled even if analytics is present (defaults to true)
10
11
  */
11
- export declare function useRouterTracker(analytics: DotCMSAnalytics | null, debug?: boolean): void;
12
+ export declare function useRouterTracker(analytics: DotCMSAnalytics | null, debug?: boolean, enabled?: boolean): void;
@@ -1,16 +1,16 @@
1
- import { usePathname as f, useSearchParams as u } from "next/navigation";
2
- import { useRef as i, useEffect as a } from "react";
3
- const m = (e, t) => `${e}${t?.toString() ? "?" + t.toString() : ""}`;
4
- function R(e, t = !1) {
5
- const r = i(null), n = f(), o = u();
6
- a(() => {
7
- if (!e) return;
8
- const c = (s) => {
9
- s !== r.current && (r.current = s, e.pageView());
1
+ import { usePathname as c, useSearchParams as i } from "next/navigation";
2
+ import { useRef as a, useEffect as m } from "react";
3
+ const p = (t, e) => `${t}${e?.toString() ? "?" + e.toString() : ""}`;
4
+ function h(t, e = !1, r = !0) {
5
+ const n = a(null), o = c(), u = i();
6
+ m(() => {
7
+ if (!r || !t) return;
8
+ const s = (f) => {
9
+ f !== n.current && (n.current = f, t.pageView());
10
10
  };
11
- t && console.info("DotCMS Analytics [React]: using Next.js App Router tracking"), c(m(n, o));
12
- }, [e, n, o, t]);
11
+ e && console.info("DotCMS Analytics [React]: using Next.js App Router tracking"), s(p(o, u));
12
+ }, [t, o, u, e, r]);
13
13
  }
14
14
  export {
15
- R as useRouterTracker
15
+ h as useRouterTracker
16
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcms/analytics",
3
- "version": "1.6.0-next.27",
3
+ "version": "1.6.0-next.36",
4
4
  "description": "Official JavaScript library for Content Analytics with DotCMS.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,5 +1,5 @@
1
- var N = /* @__PURE__ */ ((r) => (r.EDIT = "EDIT_MODE", r.PREVIEW = "PREVIEW_MODE", r.LIVE = "LIVE", r.UNKNOWN = "UNKNOWN", r))(N || {}), O = /* @__PURE__ */ ((r) => (r.CONTENT_CHANGES = "changes", r.PAGE_RELOAD = "page-reload", r.REQUEST_BOUNDS = "request-bounds", r.IFRAME_SCROLL = "iframe-scroll", r.CONTENTLET_HOVERED = "contentlet-hovered", r.SCROLL_TO_SECTION = "scroll-to-section", r))(O || {});
1
+ var r = /* @__PURE__ */ ((N) => (N.EDIT = "EDIT_MODE", N.PREVIEW = "PREVIEW_MODE", N.LIVE = "LIVE", N.UNKNOWN = "UNKNOWN", N))(r || {}), O = /* @__PURE__ */ ((N) => (N.CONTENT_CHANGES = "changes", N.PAGE_RELOAD = "page-reload", N.IFRAME_SCROLL = "iframe-scroll", N.CONTENTLET_HOVERED = "contentlet-hovered", N.CONTENTLET_CLICKED = "contentlet-clicked", N.SCROLL_TO_SECTION = "scroll-to-section", N.SELECTION_CLEARED = "selection-cleared", N.AUTO_BOUNDS = "auto-bounds", N))(O || {});
2
2
  export {
3
3
  O as UVEEventType,
4
- N as UVE_MODE
4
+ r as UVE_MODE
5
5
  };
@@ -1,4 +1,4 @@
1
- var t = /* @__PURE__ */ ((e) => (e.UVE_RELOAD_PAGE = "uve-reload-page", e.UVE_REQUEST_BOUNDS = "uve-request-bounds", e.UVE_EDITOR_PONG = "uve-editor-pong", e.UVE_SCROLL_INSIDE_IFRAME = "uve-scroll-inside-iframe", e.UVE_SET_PAGE_DATA = "uve-set-page-data", e.UVE_COPY_CONTENTLET_INLINE_EDITING_SUCCESS = "uve-copy-contentlet-inline-editing-success", e.UVE_SCROLL_TO_SECTION = "uve-scroll-to-section", e))(t || {});
1
+ var u = /* @__PURE__ */ ((e) => (e.UVE_RELOAD_PAGE = "uve-reload-page", e.UVE_FLUSH_BOUNDS = "uve-flush-bounds", e.UVE_REQUEST_BOUNDS = "uve-request-bounds", e.UVE_EDITOR_PONG = "uve-editor-pong", e.UVE_SCROLL_INSIDE_IFRAME = "uve-scroll-inside-iframe", e.UVE_SET_PAGE_DATA = "uve-set-page-data", e.UVE_COPY_CONTENTLET_INLINE_EDITING_SUCCESS = "uve-copy-contentlet-inline-editing-success", e.UVE_SCROLL_TO_SECTION = "uve-scroll-to-section", e.UVE_SELECTION_CLEARED = "uve-selection-cleared", e))(u || {});
2
2
  export {
3
- t as __DOTCMS_UVE_EVENT__
3
+ u as __DOTCMS_UVE_EVENT__
4
4
  };
@@ -1,7 +1,7 @@
1
1
  import { UVEEventType as e } from "../../../types/src/lib/editor/public.js";
2
- import { onScrollToSection as n, onContentletHovered as r, onIframeScroll as t, onRequestBounds as E, onPageReload as T, onContentChanges as O } from "./events.js";
3
- e.CONTENT_CHANGES + "", e.PAGE_RELOAD + "", e.REQUEST_BOUNDS + "", e.IFRAME_SCROLL + "", e.CONTENTLET_HOVERED + "", e.SCROLL_TO_SECTION + "";
4
- const _ = "dot-section-";
2
+ import { onAutoBounds as o, onScrollToSection as r, onContentletClicked as t, onContentletHovered as E, onIframeScroll as C, onPageReload as T, onContentChanges as O } from "./events.js";
3
+ e.CONTENT_CHANGES + "", e.PAGE_RELOAD + "", e.IFRAME_SCROLL + "", e.CONTENTLET_HOVERED + "", e.CONTENTLET_CLICKED + "", e.SCROLL_TO_SECTION + "", e.SELECTION_CLEARED + "", e.AUTO_BOUNDS + "";
4
+ const L = "dot-section-";
5
5
  export {
6
- _ as DOT_SECTION_ID_PREFIX
6
+ L as DOT_SECTION_ID_PREFIX
7
7
  };
@@ -0,0 +1,5 @@
1
+ const T = "TEMP_EMPTY_CONTENTLET", E = "TEMP_EMPTY_CONTENTLET_TYPE";
2
+ export {
3
+ T as TEMP_EMPTY_CONTENTLET,
4
+ E as TEMP_EMPTY_CONTENTLET_TYPE
5
+ };
@@ -1,125 +1,196 @@
1
- import { UVEEventType as s } from "../../../types/src/lib/editor/public.js";
2
- import { __DOTCMS_UVE_EVENT__ as i } from "../../../types/src/lib/events/internal.js";
3
- import { DOT_SECTION_ID_PREFIX as _ } from "./constants.js";
4
- import { findDotCMSElement as C, findDotCMSVTLData as f, getClosestDotCMSContainerData as O, getDotCMSPageBounds as g } from "../lib/dom/dom.utils.js";
5
- function p(o) {
6
- const t = (n) => {
7
- n.data.name === i.UVE_SET_PAGE_DATA && o(n.data.payload);
8
- };
9
- return window.addEventListener("message", t), {
1
+ import { UVEEventType as u } from "../../../types/src/lib/editor/public.js";
2
+ import { __DOTCMS_UVE_EVENT__ as f } from "../../../types/src/lib/events/internal.js";
3
+ import { DOT_SECTION_ID_PREFIX as S } from "./constants.js";
4
+ import { TEMP_EMPTY_CONTENTLET as _, TEMP_EMPTY_CONTENTLET_TYPE as p } from "./contentlet-sentinel.constants.js";
5
+ import { getNativeEventBinder as T, findDotCMSElement as L, readContentletDataset as O, findDotCMSVTLData as g, getClosestDotCMSContainerData as N, getDotCMSPageBounds as D } from "../lib/dom/dom.utils.js";
6
+ function R(a) {
7
+ const e = (o) => {
8
+ o.data.name === f.UVE_SET_PAGE_DATA && a(o.data.payload);
9
+ }, t = T(window);
10
+ return t.addEventListener("message", e), {
10
11
  unsubscribe: () => {
11
- window.removeEventListener("message", t);
12
+ t.removeEventListener("message", e);
12
13
  },
13
- event: s.CONTENT_CHANGES
14
+ event: u.CONTENT_CHANGES
14
15
  };
15
16
  }
16
- function b(o) {
17
- const t = (n) => {
18
- n.data.name === i.UVE_RELOAD_PAGE && o();
19
- };
20
- return window.addEventListener("message", t), {
17
+ function U(a) {
18
+ const e = (o) => {
19
+ o.data.name === f.UVE_RELOAD_PAGE && a();
20
+ }, t = T(window);
21
+ return t.addEventListener("message", e), {
21
22
  unsubscribe: () => {
22
- window.removeEventListener("message", t);
23
+ t.removeEventListener("message", e);
23
24
  },
24
- event: s.PAGE_RELOAD
25
+ event: u.PAGE_RELOAD
25
26
  };
26
27
  }
27
- function w(o) {
28
- const t = (n) => {
29
- if (n.data.name === i.UVE_REQUEST_BOUNDS) {
30
- const e = Array.from(
31
- document.querySelectorAll('[data-dot-object="container"]')
32
- ), a = g(e);
33
- o(a);
28
+ const w = 100;
29
+ function h(a) {
30
+ let e = null, t = [];
31
+ const o = () => {
32
+ const r = Array.from(
33
+ document.querySelectorAll('[data-dot-object="container"]')
34
+ );
35
+ a(D(r));
36
+ }, n = () => {
37
+ e !== null && clearTimeout(e), e = setTimeout(() => {
38
+ e = null, o();
39
+ }, w);
40
+ }, s = new ResizeObserver(() => {
41
+ n();
42
+ }), i = () => {
43
+ for (const r of t)
44
+ s.unobserve(r);
45
+ t = Array.from(
46
+ document.querySelectorAll('[data-dot-object="container"]')
47
+ ), s.observe(document.documentElement);
48
+ for (const r of t)
49
+ s.observe(r);
50
+ };
51
+ i();
52
+ const C = (r) => {
53
+ for (let c = 0; c < r.length; c++) {
54
+ const v = r[c];
55
+ if (v.nodeType !== Node.ELEMENT_NODE)
56
+ continue;
57
+ const b = v;
58
+ if (b.matches?.('[data-dot-object="container"]') || b.querySelector?.('[data-dot-object="container"]'))
59
+ return !0;
34
60
  }
61
+ return !1;
62
+ }, d = new MutationObserver((r) => {
63
+ for (const c of r)
64
+ if (c.type === "childList" && (C(c.addedNodes) || C(c.removedNodes))) {
65
+ i(), n();
66
+ return;
67
+ }
68
+ });
69
+ d.observe(document.body ?? document.documentElement, {
70
+ childList: !0,
71
+ subtree: !0
72
+ });
73
+ const l = T(window), E = () => n();
74
+ l.addEventListener("scroll", E, { passive: !0 });
75
+ const m = (r) => {
76
+ r?.data?.name === f.UVE_FLUSH_BOUNDS && (e !== null && (clearTimeout(e), e = null), o());
35
77
  };
36
- return window.addEventListener("message", t), {
78
+ return l.addEventListener("message", m), {
37
79
  unsubscribe: () => {
38
- window.removeEventListener("message", t);
80
+ e !== null && (clearTimeout(e), e = null), s.disconnect(), d.disconnect(), l.removeEventListener("scroll", E), l.removeEventListener("message", m), t = [];
39
81
  },
40
- event: s.REQUEST_BOUNDS
82
+ event: u.AUTO_BOUNDS
41
83
  };
42
84
  }
43
- function y(o) {
44
- const t = (n) => {
45
- if (n.data.name === i.UVE_SCROLL_INSIDE_IFRAME) {
46
- const e = n.data.direction;
47
- o(e);
85
+ function V(a) {
86
+ const e = (o) => {
87
+ if (o.data.name === f.UVE_SCROLL_INSIDE_IFRAME) {
88
+ const n = o.data.direction;
89
+ a(n);
48
90
  }
49
- };
50
- return window.addEventListener("message", t), {
91
+ }, t = T(window);
92
+ return t.addEventListener("message", e), {
51
93
  unsubscribe: () => {
52
- window.removeEventListener("message", t);
94
+ t.removeEventListener("message", e);
53
95
  },
54
- event: s.IFRAME_SCROLL
96
+ event: u.IFRAME_SCROLL
55
97
  };
56
98
  }
57
- function M(o) {
58
- const t = (n) => {
59
- if (n.data.name !== i.UVE_SCROLL_TO_SECTION)
99
+ function k(a) {
100
+ const e = (o) => {
101
+ if (o.data.name !== f.UVE_SCROLL_TO_SECTION)
60
102
  return;
61
- const e = n.data.sectionIndex, a = document.querySelector(`#${_}${e}`) ?? document.querySelector(`#section-${e}`);
62
- a && o({ sectionIndex: e, offsetTop: a.offsetTop });
63
- };
64
- return window.addEventListener("message", t), {
103
+ const n = o.data.sectionIndex, s = document.querySelector(`#${S}${n}`) ?? document.querySelector(`#section-${n}`);
104
+ s && a({ sectionIndex: n, offsetTop: s.offsetTop });
105
+ }, t = T(window);
106
+ return t.addEventListener("message", e), {
65
107
  unsubscribe: () => {
66
- window.removeEventListener("message", t);
108
+ t.removeEventListener("message", e);
67
109
  },
68
- event: s.SCROLL_TO_SECTION
110
+ event: u.SCROLL_TO_SECTION
69
111
  };
70
112
  }
71
- function D(o) {
72
- const t = (n) => {
73
- const e = C(n.target);
74
- if (!e) return;
75
- const { x: a, y: r, width: d, height: E } = e.getBoundingClientRect(), c = e.dataset?.dotObject === "container", T = {
76
- identifier: "TEMP_EMPTY_CONTENTLET",
77
- title: "TEMP_EMPTY_CONTENTLET",
78
- contentType: "TEMP_EMPTY_CONTENTLET_TYPE",
113
+ function B(a) {
114
+ let e = !1;
115
+ const t = (o) => {
116
+ const n = L(o.target);
117
+ if (!n) {
118
+ e && (e = !1, a(null));
119
+ return;
120
+ }
121
+ const { x: s, y: i, width: C, height: d } = n.getBoundingClientRect(), l = n.dataset?.dotObject === "container", E = {
122
+ identifier: _,
123
+ title: _,
124
+ contentType: p,
79
125
  inode: "TEMPY_EMPTY_CONTENTLET_INODE",
80
- widgetTitle: "TEMP_EMPTY_CONTENTLET",
81
- baseType: "TEMP_EMPTY_CONTENTLET",
126
+ widgetTitle: _,
127
+ baseType: _,
82
128
  onNumberOfPages: 1
83
- }, l = {
84
- identifier: e.dataset?.dotIdentifier,
85
- title: e.dataset?.dotTitle,
86
- inode: e.dataset?.dotInode,
87
- contentType: e.dataset?.dotType,
88
- baseType: e.dataset?.dotBasetype,
89
- widgetTitle: e.dataset?.dotWidgetTitle,
90
- onNumberOfPages: e.dataset?.dotOnNumberOfPages,
91
- ...e.dataset?.dotStyleProperties && {
92
- dotStyleProperties: JSON.parse(e.dataset.dotStyleProperties)
93
- }
94
- }, m = f(e), u = {
129
+ }, m = O(n), r = g(n), c = {
95
130
  container: (
96
131
  // Here extract dot-container from contentlet if it is Headless
97
132
  // or search in parent container if it is VTL
98
- e.dataset?.dotContainer ? JSON.parse(e.dataset?.dotContainer) : O(e)
133
+ n.dataset?.dotContainer ? JSON.parse(n.dataset?.dotContainer) : N(n)
99
134
  ),
100
- contentlet: c ? T : l,
101
- vtlFiles: m
135
+ contentlet: l ? E : m,
136
+ vtlFiles: r
137
+ }, v = {
138
+ x: s,
139
+ y: i,
140
+ width: C,
141
+ height: d,
142
+ payload: c
102
143
  };
103
- o({
104
- x: a,
105
- y: r,
106
- width: d,
107
- height: E,
108
- payload: u
144
+ e = !0, a(v);
145
+ };
146
+ return document.documentElement.addEventListener("pointermove", t), {
147
+ unsubscribe: () => {
148
+ document.documentElement.removeEventListener("pointermove", t);
149
+ },
150
+ event: u.CONTENTLET_HOVERED
151
+ };
152
+ }
153
+ function F(a) {
154
+ let e;
155
+ const t = (s) => {
156
+ const i = L(s.target);
157
+ if (!i || i.dataset?.dotObject === "container") return;
158
+ const d = i.dataset?.dotInode;
159
+ if (d && d === e)
160
+ return;
161
+ s.preventDefault(), s.stopPropagation(), e = d;
162
+ const { x: l, y: E, width: m, height: r } = i.getBoundingClientRect(), c = O(i), v = g(i);
163
+ a({
164
+ x: l,
165
+ y: E,
166
+ width: m,
167
+ height: r,
168
+ payload: {
169
+ container: i.dataset?.dotContainer ? JSON.parse(i.dataset?.dotContainer) : N(i),
170
+ contentlet: c,
171
+ vtlFiles: v
172
+ }
109
173
  });
174
+ }, o = (s) => {
175
+ s?.data?.name === f.UVE_SELECTION_CLEARED && (e = void 0);
110
176
  };
111
- return document.addEventListener("pointermove", t), {
177
+ document.documentElement.addEventListener("click", t, { capture: !0 });
178
+ const n = T(window);
179
+ return n.addEventListener("message", o), {
112
180
  unsubscribe: () => {
113
- document.removeEventListener("pointermove", t);
181
+ document.documentElement.removeEventListener("click", t, {
182
+ capture: !0
183
+ }), n.removeEventListener("message", o);
114
184
  },
115
- event: s.CONTENTLET_HOVERED
185
+ event: u.CONTENTLET_CLICKED
116
186
  };
117
187
  }
118
188
  export {
119
- p as onContentChanges,
120
- D as onContentletHovered,
121
- y as onIframeScroll,
122
- b as onPageReload,
123
- w as onRequestBounds,
124
- M as onScrollToSection
189
+ h as onAutoBounds,
190
+ R as onContentChanges,
191
+ F as onContentletClicked,
192
+ B as onContentletHovered,
193
+ V as onIframeScroll,
194
+ U as onPageReload,
195
+ k as onScrollToSection
125
196
  };
@@ -1,42 +1,42 @@
1
1
  import "../../internal/constants.js";
2
- function c(t) {
3
- return t.map((n) => {
4
- const e = n.getBoundingClientRect(), o = Array.from(
5
- n.querySelectorAll('[data-dot-object="contentlet"]')
2
+ function f(t) {
3
+ return t.map((e) => {
4
+ const n = e.getBoundingClientRect(), o = Array.from(
5
+ e.querySelectorAll('[data-dot-object="contentlet"]')
6
6
  );
7
7
  return {
8
- x: e.x,
9
- y: e.y,
10
- width: e.width,
11
- height: e.height,
8
+ x: n.x,
9
+ y: n.y,
10
+ width: n.width,
11
+ height: n.height,
12
12
  payload: JSON.stringify({
13
- container: a(n)
13
+ container: r(e)
14
14
  }),
15
- contentlets: d(e, o)
15
+ contentlets: c(n, o)
16
16
  };
17
17
  });
18
18
  }
19
- function d(t, n) {
20
- return n.map((e) => {
21
- const o = e.getBoundingClientRect();
19
+ function c(t, e) {
20
+ return e.map((n) => {
21
+ const o = n.getBoundingClientRect();
22
22
  return {
23
23
  x: 0,
24
24
  y: o.y - t.y,
25
25
  width: o.width,
26
26
  height: o.height,
27
27
  payload: JSON.stringify({
28
- container: e.dataset?.dotContainer ? JSON.parse(e.dataset?.dotContainer) : r(e),
28
+ container: n.dataset?.dotContainer ? JSON.parse(n.dataset?.dotContainer) : l(n),
29
29
  contentlet: {
30
- identifier: e.dataset?.dotIdentifier,
31
- title: e.dataset?.dotTitle,
32
- inode: e.dataset?.dotInode,
33
- contentType: e.dataset?.dotType
30
+ identifier: n.dataset?.dotIdentifier,
31
+ title: n.dataset?.dotTitle,
32
+ inode: n.dataset?.dotInode,
33
+ contentType: n.dataset?.dotType
34
34
  }
35
35
  })
36
36
  };
37
37
  });
38
38
  }
39
- function a(t) {
39
+ function r(t) {
40
40
  return {
41
41
  acceptTypes: t.dataset?.dotAcceptTypes || "",
42
42
  identifier: t.dataset?.dotIdentifier || "",
@@ -44,31 +44,55 @@ function a(t) {
44
44
  uuid: t.dataset?.dotUuid || ""
45
45
  };
46
46
  }
47
- function r(t) {
48
- const n = t.closest('[data-dot-object="container"]');
49
- return n ? a(n) : (console.warn("No container found for the contentlet"), null);
47
+ function l(t) {
48
+ const e = t.closest('[data-dot-object="container"]');
49
+ return e ? r(e) : (console.warn("No container found for the contentlet"), null);
50
50
  }
51
- function i(t) {
51
+ function u(t) {
52
52
  if (!t) return null;
53
- const n = t.querySelector('[data-dot-object="empty-content"]');
53
+ const e = t.querySelector('[data-dot-object="empty-content"]');
54
54
  return t?.dataset?.dotObject === "contentlet" || // The container inside Headless components have a span with the data-dot-object="container" attribute
55
- t?.dataset?.dotObject === "container" && n || // The container inside Traditional have no content inside
56
- t?.dataset?.dotObject === "container" && t.children.length === 0 ? t : i(t?.parentElement);
55
+ t?.dataset?.dotObject === "container" && e || // The container inside Traditional have no content inside
56
+ t?.dataset?.dotObject === "container" && t.children.length === 0 ? t : u(t?.parentElement);
57
57
  }
58
- function u(t) {
59
- const n = t.querySelectorAll(
58
+ function p(t) {
59
+ const e = t.querySelectorAll(
60
60
  '[data-dot-object="vtl-file"]'
61
61
  );
62
- return n.length ? Array.from(n).map((e) => ({
63
- inode: e.dataset?.dotInode,
64
- name: e.dataset?.dotUrl
62
+ return e.length ? Array.from(e).map((n) => ({
63
+ inode: n.dataset?.dotInode,
64
+ name: n.dataset?.dotUrl
65
65
  })) : null;
66
66
  }
67
+ function g(t) {
68
+ const e = t.dataset ?? {};
69
+ return {
70
+ identifier: e.dotIdentifier,
71
+ title: e.dotTitle,
72
+ inode: e.dotInode,
73
+ contentType: e.dotType,
74
+ baseType: e.dotBasetype,
75
+ widgetTitle: e.dotWidgetTitle,
76
+ onNumberOfPages: e.dotOnNumberOfPages,
77
+ ...e.dotStyleProperties && {
78
+ dotStyleProperties: JSON.parse(e.dotStyleProperties)
79
+ }
80
+ };
81
+ }
82
+ function b(t) {
83
+ const e = globalThis.Zone, n = (a) => typeof e?.__symbol__ == "function" ? e.__symbol__(a) : `__zone_symbol__${a}`, o = t, d = t, i = o[n("addEventListener")], s = o[n("removeEventListener")];
84
+ return {
85
+ addEventListener: (i ?? d.addEventListener).bind(d),
86
+ removeEventListener: (s ?? d.removeEventListener).bind(d)
87
+ };
88
+ }
67
89
  export {
68
- i as findDotCMSElement,
69
- u as findDotCMSVTLData,
70
- r as getClosestDotCMSContainerData,
71
- a as getDotCMSContainerData,
72
- d as getDotCMSContentletsBound,
73
- c as getDotCMSPageBounds
90
+ u as findDotCMSElement,
91
+ p as findDotCMSVTLData,
92
+ l as getClosestDotCMSContainerData,
93
+ r as getDotCMSContainerData,
94
+ c as getDotCMSContentletsBound,
95
+ f as getDotCMSPageBounds,
96
+ b as getNativeEventBinder,
97
+ g as readContentletDataset
74
98
  };