@dotcms/analytics 1.5.1-next.2010 → 1.5.1-next.2023
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/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,126 +1,192 @@
|
|
|
1
|
-
import { UVEEventType as
|
|
2
|
-
import { __DOTCMS_UVE_EVENT__ as
|
|
3
|
-
import { DOT_SECTION_ID_PREFIX as
|
|
4
|
-
import { TEMP_EMPTY_CONTENTLET as
|
|
5
|
-
import { findDotCMSElement as
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
|
|
1
|
+
import { UVEEventType as d } 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 g } from "./constants.js";
|
|
4
|
+
import { TEMP_EMPTY_CONTENTLET as C, TEMP_EMPTY_CONTENTLET_TYPE as w } from "./contentlet-sentinel.constants.js";
|
|
5
|
+
import { findDotCMSElement as _, readContentletDataset as b, findDotCMSVTLData as L, getClosestDotCMSContainerData as O, getDotCMSPageBounds as N } from "../lib/dom/dom.utils.js";
|
|
6
|
+
function M(s) {
|
|
7
|
+
const e = (t) => {
|
|
8
|
+
t.data.name === f.UVE_SET_PAGE_DATA && s(t.data.payload);
|
|
9
9
|
};
|
|
10
|
-
return window.addEventListener("message",
|
|
10
|
+
return window.addEventListener("message", e), {
|
|
11
11
|
unsubscribe: () => {
|
|
12
|
-
window.removeEventListener("message",
|
|
12
|
+
window.removeEventListener("message", e);
|
|
13
13
|
},
|
|
14
|
-
event:
|
|
14
|
+
event: d.CONTENT_CHANGES
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
|
|
17
|
+
function P(s) {
|
|
18
|
+
const e = (t) => {
|
|
19
|
+
t.data.name === f.UVE_RELOAD_PAGE && s();
|
|
20
20
|
};
|
|
21
|
-
return window.addEventListener("message",
|
|
21
|
+
return window.addEventListener("message", e), {
|
|
22
22
|
unsubscribe: () => {
|
|
23
|
-
window.removeEventListener("message",
|
|
23
|
+
window.removeEventListener("message", e);
|
|
24
24
|
},
|
|
25
|
-
event:
|
|
25
|
+
event: d.PAGE_RELOAD
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
const S = 100;
|
|
29
|
+
function R(s) {
|
|
30
|
+
let e = null, t = [];
|
|
31
|
+
const a = () => {
|
|
32
|
+
const r = Array.from(
|
|
33
|
+
document.querySelectorAll('[data-dot-object="container"]')
|
|
34
|
+
);
|
|
35
|
+
s(N(r));
|
|
36
|
+
}, n = () => {
|
|
37
|
+
e !== null && clearTimeout(e), e = setTimeout(() => {
|
|
38
|
+
e = null, a();
|
|
39
|
+
}, S);
|
|
40
|
+
}, o = new ResizeObserver(() => {
|
|
41
|
+
n();
|
|
42
|
+
}), v = () => {
|
|
43
|
+
for (const r of t)
|
|
44
|
+
o.unobserve(r);
|
|
45
|
+
t = Array.from(
|
|
46
|
+
document.querySelectorAll('[data-dot-object="container"]')
|
|
47
|
+
), o.observe(document.documentElement);
|
|
48
|
+
for (const r of t)
|
|
49
|
+
o.observe(r);
|
|
50
|
+
};
|
|
51
|
+
v();
|
|
52
|
+
const c = (r) => {
|
|
53
|
+
for (let i = 0; i < r.length; i++) {
|
|
54
|
+
const m = r[i];
|
|
55
|
+
if (m.nodeType !== Node.ELEMENT_NODE)
|
|
56
|
+
continue;
|
|
57
|
+
const T = m;
|
|
58
|
+
if (T.matches?.('[data-dot-object="container"]') || T.querySelector?.('[data-dot-object="container"]'))
|
|
59
|
+
return !0;
|
|
35
60
|
}
|
|
61
|
+
return !1;
|
|
62
|
+
}, l = new MutationObserver((r) => {
|
|
63
|
+
for (const i of r)
|
|
64
|
+
if (i.type === "childList" && (c(i.addedNodes) || c(i.removedNodes))) {
|
|
65
|
+
v(), n();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
l.observe(document.body ?? document.documentElement, {
|
|
70
|
+
childList: !0,
|
|
71
|
+
subtree: !0
|
|
72
|
+
});
|
|
73
|
+
const u = () => n();
|
|
74
|
+
window.addEventListener("scroll", u, { passive: !0 });
|
|
75
|
+
const E = (r) => {
|
|
76
|
+
r?.data?.name === f.UVE_FLUSH_BOUNDS && (e !== null && (clearTimeout(e), e = null), a());
|
|
36
77
|
};
|
|
37
|
-
return window.addEventListener("message",
|
|
78
|
+
return window.addEventListener("message", E), {
|
|
38
79
|
unsubscribe: () => {
|
|
39
|
-
window.removeEventListener("message", t
|
|
80
|
+
e !== null && (clearTimeout(e), e = null), o.disconnect(), l.disconnect(), window.removeEventListener("scroll", u), window.removeEventListener("message", E), t = [];
|
|
40
81
|
},
|
|
41
|
-
event:
|
|
82
|
+
event: d.AUTO_BOUNDS
|
|
42
83
|
};
|
|
43
84
|
}
|
|
44
|
-
function
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
const
|
|
48
|
-
|
|
85
|
+
function U(s) {
|
|
86
|
+
const e = (t) => {
|
|
87
|
+
if (t.data.name === f.UVE_SCROLL_INSIDE_IFRAME) {
|
|
88
|
+
const a = t.data.direction;
|
|
89
|
+
s(a);
|
|
49
90
|
}
|
|
50
91
|
};
|
|
51
|
-
return window.addEventListener("message",
|
|
92
|
+
return window.addEventListener("message", e), {
|
|
52
93
|
unsubscribe: () => {
|
|
53
|
-
window.removeEventListener("message",
|
|
94
|
+
window.removeEventListener("message", e);
|
|
54
95
|
},
|
|
55
|
-
event:
|
|
96
|
+
event: d.IFRAME_SCROLL
|
|
56
97
|
};
|
|
57
98
|
}
|
|
58
|
-
function
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
99
|
+
function h(s) {
|
|
100
|
+
const e = (t) => {
|
|
101
|
+
if (t.data.name !== f.UVE_SCROLL_TO_SECTION)
|
|
61
102
|
return;
|
|
62
|
-
const
|
|
63
|
-
|
|
103
|
+
const a = t.data.sectionIndex, n = document.querySelector(`#${g}${a}`) ?? document.querySelector(`#section-${a}`);
|
|
104
|
+
n && s({ sectionIndex: a, offsetTop: n.offsetTop });
|
|
64
105
|
};
|
|
65
|
-
return window.addEventListener("message",
|
|
106
|
+
return window.addEventListener("message", e), {
|
|
66
107
|
unsubscribe: () => {
|
|
67
|
-
window.removeEventListener("message",
|
|
108
|
+
window.removeEventListener("message", e);
|
|
68
109
|
},
|
|
69
|
-
event:
|
|
110
|
+
event: d.SCROLL_TO_SECTION
|
|
70
111
|
};
|
|
71
112
|
}
|
|
72
|
-
function
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
113
|
+
function V(s) {
|
|
114
|
+
let e = !1;
|
|
115
|
+
const t = (a) => {
|
|
116
|
+
const n = _(a.target);
|
|
117
|
+
if (!n) {
|
|
118
|
+
e && (e = !1, s(null));
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const { x: o, y: v, width: c, height: l } = n.getBoundingClientRect(), u = n.dataset?.dotObject === "container", E = {
|
|
122
|
+
identifier: C,
|
|
123
|
+
title: C,
|
|
124
|
+
contentType: w,
|
|
80
125
|
inode: "TEMPY_EMPTY_CONTENTLET_INODE",
|
|
81
|
-
widgetTitle:
|
|
82
|
-
baseType:
|
|
126
|
+
widgetTitle: C,
|
|
127
|
+
baseType: C,
|
|
83
128
|
onNumberOfPages: 1
|
|
84
|
-
},
|
|
85
|
-
identifier: e.dataset?.dotIdentifier,
|
|
86
|
-
title: e.dataset?.dotTitle,
|
|
87
|
-
inode: e.dataset?.dotInode,
|
|
88
|
-
contentType: e.dataset?.dotType,
|
|
89
|
-
baseType: e.dataset?.dotBasetype,
|
|
90
|
-
widgetTitle: e.dataset?.dotWidgetTitle,
|
|
91
|
-
onNumberOfPages: e.dataset?.dotOnNumberOfPages,
|
|
92
|
-
...e.dataset?.dotStyleProperties && {
|
|
93
|
-
dotStyleProperties: JSON.parse(e.dataset.dotStyleProperties)
|
|
94
|
-
}
|
|
95
|
-
}, u = S(e), _ = {
|
|
129
|
+
}, r = b(n), i = L(n), m = {
|
|
96
130
|
container: (
|
|
97
131
|
// Here extract dot-container from contentlet if it is Headless
|
|
98
132
|
// or search in parent container if it is VTL
|
|
99
|
-
|
|
133
|
+
n.dataset?.dotContainer ? JSON.parse(n.dataset?.dotContainer) : O(n)
|
|
100
134
|
),
|
|
101
|
-
contentlet:
|
|
102
|
-
vtlFiles:
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
y: d,
|
|
135
|
+
contentlet: u ? E : r,
|
|
136
|
+
vtlFiles: i
|
|
137
|
+
}, T = {
|
|
138
|
+
x: o,
|
|
139
|
+
y: v,
|
|
107
140
|
width: c,
|
|
108
|
-
height:
|
|
109
|
-
payload:
|
|
110
|
-
}
|
|
141
|
+
height: l,
|
|
142
|
+
payload: m
|
|
143
|
+
};
|
|
144
|
+
e = !0, s(T);
|
|
111
145
|
};
|
|
112
146
|
return document.addEventListener("pointermove", t), {
|
|
113
147
|
unsubscribe: () => {
|
|
114
148
|
document.removeEventListener("pointermove", t);
|
|
115
149
|
},
|
|
116
|
-
event:
|
|
150
|
+
event: d.CONTENTLET_HOVERED
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function k(s) {
|
|
154
|
+
let e;
|
|
155
|
+
const t = (n) => {
|
|
156
|
+
const o = _(n.target);
|
|
157
|
+
if (!o || o.dataset?.dotObject === "container") return;
|
|
158
|
+
const c = o.dataset?.dotInode;
|
|
159
|
+
if (c && c === e)
|
|
160
|
+
return;
|
|
161
|
+
n.preventDefault(), n.stopPropagation(), e = c;
|
|
162
|
+
const { x: l, y: u, width: E, height: r } = o.getBoundingClientRect(), i = b(o), m = L(o);
|
|
163
|
+
s({
|
|
164
|
+
x: l,
|
|
165
|
+
y: u,
|
|
166
|
+
width: E,
|
|
167
|
+
height: r,
|
|
168
|
+
payload: {
|
|
169
|
+
container: o.dataset?.dotContainer ? JSON.parse(o.dataset?.dotContainer) : O(o),
|
|
170
|
+
contentlet: i,
|
|
171
|
+
vtlFiles: m
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}, a = (n) => {
|
|
175
|
+
n?.data?.name === f.UVE_SELECTION_CLEARED && (e = void 0);
|
|
176
|
+
};
|
|
177
|
+
return document.addEventListener("click", t, { capture: !0 }), window.addEventListener("message", a), {
|
|
178
|
+
unsubscribe: () => {
|
|
179
|
+
document.removeEventListener("click", t, { capture: !0 }), window.removeEventListener("message", a);
|
|
180
|
+
},
|
|
181
|
+
event: d.CONTENTLET_CLICKED
|
|
117
182
|
};
|
|
118
183
|
}
|
|
119
184
|
export {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
185
|
+
R as onAutoBounds,
|
|
186
|
+
M as onContentChanges,
|
|
187
|
+
k as onContentletClicked,
|
|
188
|
+
V as onContentletHovered,
|
|
189
|
+
U as onIframeScroll,
|
|
190
|
+
P as onPageReload,
|
|
191
|
+
h as onScrollToSection
|
|
126
192
|
};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import "../../internal/constants.js";
|
|
2
2
|
function c(t) {
|
|
3
|
-
return t.map((
|
|
4
|
-
const
|
|
5
|
-
|
|
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: a(
|
|
13
|
+
container: a(e)
|
|
14
14
|
}),
|
|
15
|
-
contentlets: d(
|
|
15
|
+
contentlets: d(n, o)
|
|
16
16
|
};
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function d(t,
|
|
20
|
-
return
|
|
21
|
-
const o =
|
|
19
|
+
function d(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) : r(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
|
};
|
|
@@ -45,30 +45,46 @@ function a(t) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
function r(t) {
|
|
48
|
-
const
|
|
49
|
-
return
|
|
48
|
+
const e = t.closest('[data-dot-object="container"]');
|
|
49
|
+
return e ? a(e) : (console.warn("No container found for the contentlet"), null);
|
|
50
50
|
}
|
|
51
51
|
function i(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" &&
|
|
55
|
+
t?.dataset?.dotObject === "container" && e || // The container inside Traditional have no content inside
|
|
56
56
|
t?.dataset?.dotObject === "container" && t.children.length === 0 ? t : i(t?.parentElement);
|
|
57
57
|
}
|
|
58
58
|
function u(t) {
|
|
59
|
-
const
|
|
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 l(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
|
+
}
|
|
67
82
|
export {
|
|
68
83
|
i as findDotCMSElement,
|
|
69
84
|
u as findDotCMSVTLData,
|
|
70
85
|
r as getClosestDotCMSContainerData,
|
|
71
86
|
a as getDotCMSContainerData,
|
|
72
87
|
d as getDotCMSContentletsBound,
|
|
73
|
-
c as getDotCMSPageBounds
|
|
88
|
+
c as getDotCMSPageBounds,
|
|
89
|
+
l as readContentletDataset
|
|
74
90
|
};
|