@dotcms/analytics 1.6.0 → 1.7.0
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 +4 -4
- package/lib/core/shared/models/library.model.d.ts +4 -1
- package/lib/core/shared/utils/dot-analytics.utils.d.ts +3 -1
- package/lib/react/components/DotContentAnalytics.js +9 -9
- package/lib/react/hook/useRouterTracker.d.ts +2 -1
- package/lib/react/hook/useRouterTracker.js +12 -12
- package/package.json +1 -1
- package/types/src/lib/editor/public.js +2 -2
- package/types/src/lib/events/internal.js +2 -2
- package/uve/src/internal/constants.js +4 -4
- package/uve/src/internal/contentlet-sentinel.constants.js +5 -0
- package/uve/src/internal/events.js +157 -86
- package/uve/src/lib/dom/dom.utils.js +61 -37
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://
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
* -
|
|
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
|
|
2
|
-
import { Suspense as
|
|
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
|
|
5
|
-
function
|
|
4
|
+
import { initializeAnalytics as i } from "../internal/utils.js";
|
|
5
|
+
function u({
|
|
6
6
|
config: t
|
|
7
7
|
}) {
|
|
8
|
-
const n =
|
|
9
|
-
return
|
|
8
|
+
const n = a(() => i(t), [t]), o = !!t.debug;
|
|
9
|
+
return l(n, o, t.autoPageView !== !1), null;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return /* @__PURE__ */
|
|
11
|
+
function f({ config: t }) {
|
|
12
|
+
return /* @__PURE__ */ e(r, { fallback: null, children: /* @__PURE__ */ e(u, { config: t }) });
|
|
13
13
|
}
|
|
14
14
|
export {
|
|
15
|
-
|
|
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
|
|
2
|
-
import { useRef as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
if (!
|
|
8
|
-
const
|
|
9
|
-
|
|
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
|
-
|
|
12
|
-
}, [
|
|
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
|
-
|
|
15
|
+
h as useRouterTracker
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
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
|
-
|
|
4
|
+
r as UVE_MODE
|
|
5
5
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
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
|
-
|
|
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 {
|
|
3
|
-
e.CONTENT_CHANGES + "", e.PAGE_RELOAD + "", e.
|
|
4
|
-
const
|
|
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
|
-
|
|
6
|
+
L as DOT_SECTION_ID_PREFIX
|
|
7
7
|
};
|
|
@@ -1,125 +1,196 @@
|
|
|
1
|
-
import { UVEEventType as
|
|
2
|
-
import { __DOTCMS_UVE_EVENT__ as
|
|
3
|
-
import { DOT_SECTION_ID_PREFIX as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
12
|
+
t.removeEventListener("message", e);
|
|
12
13
|
},
|
|
13
|
-
event:
|
|
14
|
+
event: u.CONTENT_CHANGES
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
return
|
|
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
|
-
|
|
23
|
+
t.removeEventListener("message", e);
|
|
23
24
|
},
|
|
24
|
-
event:
|
|
25
|
+
event: u.PAGE_RELOAD
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
78
|
+
return l.addEventListener("message", m), {
|
|
37
79
|
unsubscribe: () => {
|
|
38
|
-
|
|
80
|
+
e !== null && (clearTimeout(e), e = null), s.disconnect(), d.disconnect(), l.removeEventListener("scroll", E), l.removeEventListener("message", m), t = [];
|
|
39
81
|
},
|
|
40
|
-
event:
|
|
82
|
+
event: u.AUTO_BOUNDS
|
|
41
83
|
};
|
|
42
84
|
}
|
|
43
|
-
function
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
const
|
|
47
|
-
|
|
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
|
|
91
|
+
}, t = T(window);
|
|
92
|
+
return t.addEventListener("message", e), {
|
|
51
93
|
unsubscribe: () => {
|
|
52
|
-
|
|
94
|
+
t.removeEventListener("message", e);
|
|
53
95
|
},
|
|
54
|
-
event:
|
|
96
|
+
event: u.IFRAME_SCROLL
|
|
55
97
|
};
|
|
56
98
|
}
|
|
57
|
-
function
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
99
|
+
function k(a) {
|
|
100
|
+
const e = (o) => {
|
|
101
|
+
if (o.data.name !== f.UVE_SCROLL_TO_SECTION)
|
|
60
102
|
return;
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
};
|
|
64
|
-
return
|
|
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
|
-
|
|
108
|
+
t.removeEventListener("message", e);
|
|
67
109
|
},
|
|
68
|
-
event:
|
|
110
|
+
event: u.SCROLL_TO_SECTION
|
|
69
111
|
};
|
|
70
112
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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:
|
|
81
|
-
baseType:
|
|
126
|
+
widgetTitle: _,
|
|
127
|
+
baseType: _,
|
|
82
128
|
onNumberOfPages: 1
|
|
83
|
-
},
|
|
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
|
-
|
|
133
|
+
n.dataset?.dotContainer ? JSON.parse(n.dataset?.dotContainer) : N(n)
|
|
99
134
|
),
|
|
100
|
-
contentlet:
|
|
101
|
-
vtlFiles:
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
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("
|
|
181
|
+
document.documentElement.removeEventListener("click", t, {
|
|
182
|
+
capture: !0
|
|
183
|
+
}), n.removeEventListener("message", o);
|
|
114
184
|
},
|
|
115
|
-
event:
|
|
185
|
+
event: u.CONTENTLET_CLICKED
|
|
116
186
|
};
|
|
117
187
|
}
|
|
118
188
|
export {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
|
3
|
-
return t.map((
|
|
4
|
-
const
|
|
5
|
-
|
|
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:
|
|
9
|
-
y:
|
|
10
|
-
width:
|
|
11
|
-
height:
|
|
8
|
+
x: n.x,
|
|
9
|
+
y: n.y,
|
|
10
|
+
width: n.width,
|
|
11
|
+
height: n.height,
|
|
12
12
|
payload: JSON.stringify({
|
|
13
|
-
container:
|
|
13
|
+
container: r(e)
|
|
14
14
|
}),
|
|
15
|
-
contentlets:
|
|
15
|
+
contentlets: c(n, o)
|
|
16
16
|
};
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
21
|
-
const o =
|
|
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:
|
|
28
|
+
container: n.dataset?.dotContainer ? JSON.parse(n.dataset?.dotContainer) : l(n),
|
|
29
29
|
contentlet: {
|
|
30
|
-
identifier:
|
|
31
|
-
title:
|
|
32
|
-
inode:
|
|
33
|
-
contentType:
|
|
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
|
|
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
|
|
48
|
-
const
|
|
49
|
-
return
|
|
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
|
|
51
|
+
function u(t) {
|
|
52
52
|
if (!t) return null;
|
|
53
|
-
const
|
|
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" &&
|
|
56
|
-
t?.dataset?.dotObject === "container" && t.children.length === 0 ? t :
|
|
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
|
|
59
|
-
const
|
|
58
|
+
function p(t) {
|
|
59
|
+
const e = t.querySelectorAll(
|
|
60
60
|
'[data-dot-object="vtl-file"]'
|
|
61
61
|
);
|
|
62
|
-
return
|
|
63
|
-
inode:
|
|
64
|
-
name:
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
};
|