@yext/visual-editor 0.0.43 → 0.0.45
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/dist/index.d.cts +224 -59
- package/dist/index.d.ts +224 -59
- package/dist/plugin/{debugger-rlNxnZtt-0yDbAQLD.js → debugger-BwrGCC7Q-B7S-mlGb.js} +122 -101
- package/dist/plugin/debugger-BwrGCC7Q-DdB4cbWi.cjs +1 -0
- package/dist/plugin/{index-Cs0QW4io.js → index-BAnL5AMG.js} +45333 -41993
- package/dist/plugin/index-DvewYwma.cjs +2621 -0
- package/dist/plugin/plugin.cjs +1 -1
- package/dist/plugin/plugin.js +1 -1
- package/dist/style.css +1 -1
- package/dist/visual-editor.cjs +81 -86
- package/dist/visual-editor.js +23093 -18864
- package/package.json +7 -14
- package/dist/plugin/debugger-rlNxnZtt-DlXl4uaY.cjs +0 -1
- package/dist/plugin/index-BspHgnfK.cjs +0 -2626
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
function
|
|
3
|
-
return S().name !== "browser" || window.hasOwnProperty("debuggerInitialized") ? null : (window.debuggerInitialized = !0, k.createPortal(/* @__PURE__ */ l.jsx(
|
|
1
|
+
import { r as b, n as l, e as w, a as k, l as S } from "./index-BAnL5AMG.js";
|
|
2
|
+
function P() {
|
|
3
|
+
return S().name !== "browser" || window.hasOwnProperty("debuggerInitialized") ? null : (window.debuggerInitialized = !0, k.createPortal(/* @__PURE__ */ l.jsx($, {}), document.body));
|
|
4
4
|
}
|
|
5
5
|
const Y = (e, s) => {
|
|
6
|
-
const n = e.dataset.yaAction, t = e.dataset.yaScopeoverride, o = e.dataset.yaEventname,
|
|
6
|
+
const n = e.dataset.yaAction, t = e.dataset.yaScopeoverride, o = e.dataset.yaEventname, i = t || s;
|
|
7
7
|
return {
|
|
8
8
|
action: n,
|
|
9
|
-
originalEventName:
|
|
10
|
-
scope:
|
|
9
|
+
originalEventName: i ? `${i}_${o}` : o,
|
|
10
|
+
scope: i
|
|
11
11
|
};
|
|
12
12
|
}, C = (e, s) => {
|
|
13
13
|
const n = [];
|
|
@@ -15,14 +15,14 @@ const Y = (e, s) => {
|
|
|
15
15
|
for (; t != null && t.parentElement; )
|
|
16
16
|
t = t.parentElement.closest(s), t && n.push(t);
|
|
17
17
|
return n;
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
...
|
|
18
|
+
}, h = {}, N = "YA_NO_SCOPE", j = (e, s, n, t) => {
|
|
19
|
+
h.hasOwnProperty(e) ? h[e].events.map((o) => o.el).includes(t) || (h[e].events = [
|
|
20
|
+
...h[e].events,
|
|
21
21
|
{
|
|
22
22
|
eventData: s,
|
|
23
23
|
el: t
|
|
24
24
|
}
|
|
25
|
-
]) :
|
|
25
|
+
]) : h[e] = {
|
|
26
26
|
scopeEl: n || t,
|
|
27
27
|
// overidden scopes still need an element
|
|
28
28
|
events: [
|
|
@@ -33,39 +33,60 @@ const Y = (e, s) => {
|
|
|
33
33
|
]
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
-
function
|
|
37
|
-
const [e, s] =
|
|
38
|
-
s(e ===
|
|
36
|
+
function $() {
|
|
37
|
+
const [e, s] = b.useState(), [n, t] = b.useState([]), [o, i] = b.useState(!1), a = (r) => {
|
|
38
|
+
s(e === r ? void 0 : r);
|
|
39
39
|
};
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
40
|
+
return b.useEffect(() => {
|
|
41
|
+
let r = null;
|
|
42
|
+
const d = () => {
|
|
43
|
+
r && r.abort(), r = new AbortController();
|
|
44
|
+
const c = r.signal;
|
|
45
|
+
document.documentElement.classList.add("xYextDebug"), document.querySelectorAll(
|
|
46
|
+
"[data-ya-eventname]"
|
|
47
|
+
).forEach((u, y) => {
|
|
48
|
+
const p = u.closest("[data-ya-scope]"), x = p?.dataset.yaScope, m = Y(u, x);
|
|
49
|
+
u.addEventListener(
|
|
50
|
+
"mouseenter",
|
|
51
|
+
() => {
|
|
52
|
+
t([
|
|
53
|
+
{
|
|
54
|
+
elem: u,
|
|
55
|
+
key: `${m.originalEventName}_${y}`,
|
|
56
|
+
action: m.action,
|
|
57
|
+
originalEventName: m.originalEventName,
|
|
58
|
+
scope: m.scope
|
|
59
|
+
}
|
|
60
|
+
]);
|
|
61
|
+
},
|
|
62
|
+
{ signal: c }
|
|
63
|
+
), u.addEventListener(
|
|
64
|
+
"mouseleave",
|
|
65
|
+
() => {
|
|
66
|
+
t([]);
|
|
67
|
+
},
|
|
68
|
+
{ signal: c }
|
|
69
|
+
);
|
|
70
|
+
const f = u.dataset.yaScopeoverride;
|
|
71
|
+
f ? j(f, m, p, u) : [
|
|
72
|
+
x,
|
|
73
|
+
...C(u, "[data-ya-scope]").map(
|
|
74
|
+
(v) => v.dataset.yaScope
|
|
75
|
+
)
|
|
76
|
+
].forEach((v) => {
|
|
77
|
+
j(v || N, m, p, u);
|
|
78
|
+
});
|
|
79
|
+
}), i(!0);
|
|
80
|
+
};
|
|
81
|
+
d();
|
|
82
|
+
const g = new MutationObserver(d);
|
|
83
|
+
return g.observe(document, {
|
|
84
|
+
childList: !0,
|
|
85
|
+
subtree: !0
|
|
86
|
+
}), () => {
|
|
87
|
+
document.documentElement.classList.remove("xYextDebug"), g.disconnect(), r?.abort();
|
|
88
|
+
};
|
|
89
|
+
}, []), o ? /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
|
69
90
|
/* @__PURE__ */ l.jsxs("div", { className: "analytics-debugger", children: [
|
|
70
91
|
/* @__PURE__ */ l.jsxs("div", { className: "analytics-debugger-toggles", children: [
|
|
71
92
|
/* @__PURE__ */ l.jsx(
|
|
@@ -89,14 +110,14 @@ function D() {
|
|
|
89
110
|
}
|
|
90
111
|
)
|
|
91
112
|
] }),
|
|
92
|
-
e && /* @__PURE__ */ l.jsx("div", { className: "analytics-debugger-tabs", children: e === "Events" ? /* @__PURE__ */ l.jsx(
|
|
113
|
+
e && /* @__PURE__ */ l.jsx("div", { className: "analytics-debugger-tabs", children: e === "Events" ? /* @__PURE__ */ l.jsx(O, { data: h, setTooltips: t }) : /* @__PURE__ */ l.jsx(R, { data: h, setTooltips: t }) })
|
|
93
114
|
] }),
|
|
94
115
|
/* @__PURE__ */ l.jsx(B, { tooltips: n })
|
|
95
116
|
] }) : null;
|
|
96
117
|
}
|
|
97
|
-
const
|
|
118
|
+
const D = () => {
|
|
98
119
|
const e = {};
|
|
99
|
-
return Object.values(
|
|
120
|
+
return Object.values(h).forEach((s) => {
|
|
100
121
|
s.events.forEach((n) => {
|
|
101
122
|
const { originalEventName: t } = n.eventData;
|
|
102
123
|
e[t] || (e[t] = []), !e[t].find(
|
|
@@ -105,80 +126,80 @@ const $ = () => {
|
|
|
105
126
|
});
|
|
106
127
|
}), e;
|
|
107
128
|
};
|
|
108
|
-
function
|
|
109
|
-
const { setTooltips: s } = e, [n, t] =
|
|
129
|
+
function O(e) {
|
|
130
|
+
const { setTooltips: s } = e, [n, t] = b.useState([]), [o, i] = b.useState(""), a = (r, d) => {
|
|
110
131
|
n.forEach(
|
|
111
|
-
(
|
|
132
|
+
(c) => c.classList.remove("analytics-event-highlight")
|
|
112
133
|
);
|
|
113
|
-
const
|
|
114
|
-
t(
|
|
115
|
-
|
|
116
|
-
elem:
|
|
117
|
-
key: `${
|
|
118
|
-
action:
|
|
119
|
-
originalEventName:
|
|
120
|
-
scope:
|
|
134
|
+
const g = r.map((c) => (c.el.scrollIntoView({ behavior: "smooth", block: "nearest" }), c.el.classList.add("analytics-event-highlight"), c.el));
|
|
135
|
+
t(g), i(d), s(
|
|
136
|
+
r.map((c, u) => ({
|
|
137
|
+
elem: c.el,
|
|
138
|
+
key: `${c.eventData.originalEventName}_${u}`,
|
|
139
|
+
action: c.eventData.action,
|
|
140
|
+
originalEventName: c.eventData.originalEventName,
|
|
141
|
+
scope: c.eventData.scope
|
|
121
142
|
}))
|
|
122
143
|
);
|
|
123
144
|
};
|
|
124
145
|
return /* @__PURE__ */ l.jsxs("div", { className: "analytics-debugger-tab", children: [
|
|
125
146
|
/* @__PURE__ */ l.jsx("h2", { className: "analytics-debugger-tab-title", children: "Event Names" }),
|
|
126
|
-
/* @__PURE__ */ l.jsx("ul", { className: "analytics-debugger-list", children: Object.entries(
|
|
127
|
-
([
|
|
128
|
-
const
|
|
147
|
+
/* @__PURE__ */ l.jsx("ul", { className: "analytics-debugger-list", children: Object.entries(D()).map(
|
|
148
|
+
([r, d], g) => {
|
|
149
|
+
const c = `${r}_${g}`;
|
|
129
150
|
return /* @__PURE__ */ l.jsx("li", { className: "analytics-debugger-listItem", children: /* @__PURE__ */ l.jsx(
|
|
130
151
|
"button",
|
|
131
152
|
{
|
|
132
153
|
className: w("analytics-debugger-button", {
|
|
133
|
-
"is-active":
|
|
154
|
+
"is-active": c === o
|
|
134
155
|
}),
|
|
135
|
-
onClick: () => a(
|
|
136
|
-
children:
|
|
156
|
+
onClick: () => a(d, c),
|
|
157
|
+
children: r
|
|
137
158
|
}
|
|
138
|
-
) },
|
|
159
|
+
) }, c);
|
|
139
160
|
}
|
|
140
161
|
) })
|
|
141
162
|
] });
|
|
142
163
|
}
|
|
143
|
-
function
|
|
144
|
-
const { data: s, setTooltips: n } = e, [t, o] =
|
|
145
|
-
const
|
|
146
|
-
|
|
164
|
+
function R(e) {
|
|
165
|
+
const { data: s, setTooltips: n } = e, [t, o] = b.useState(""), i = (a) => {
|
|
166
|
+
const r = s[a];
|
|
167
|
+
r.scopeEl && (r.scopeEl.scrollIntoView({
|
|
147
168
|
behavior: "smooth",
|
|
148
169
|
block: "nearest"
|
|
149
170
|
}), o(a), n(
|
|
150
|
-
|
|
151
|
-
const
|
|
171
|
+
r.events.map((d, g) => {
|
|
172
|
+
const c = d.eventData;
|
|
152
173
|
return {
|
|
153
|
-
elem:
|
|
154
|
-
key: `${
|
|
155
|
-
action:
|
|
156
|
-
originalEventName:
|
|
157
|
-
scope:
|
|
174
|
+
elem: d.el,
|
|
175
|
+
key: `${c.originalEventName}_${g}`,
|
|
176
|
+
action: c.action,
|
|
177
|
+
originalEventName: c.originalEventName,
|
|
178
|
+
scope: c.scope
|
|
158
179
|
};
|
|
159
180
|
})
|
|
160
181
|
));
|
|
161
182
|
};
|
|
162
183
|
return /* @__PURE__ */ l.jsxs("div", { className: "analytics-debugger-tab", children: [
|
|
163
184
|
/* @__PURE__ */ l.jsx("h2", { className: "analytics-debugger-tab-title", children: "Scope Names" }),
|
|
164
|
-
/* @__PURE__ */ l.jsx("ul", { className: "analytics-debugger-list", children: Object.keys(s).map((a,
|
|
165
|
-
if (a !==
|
|
185
|
+
/* @__PURE__ */ l.jsx("ul", { className: "analytics-debugger-list", children: Object.keys(s).map((a, r) => {
|
|
186
|
+
if (a !== N)
|
|
166
187
|
return /* @__PURE__ */ l.jsx("li", { className: "analytics-debugger-listItem", children: /* @__PURE__ */ l.jsx(
|
|
167
188
|
"button",
|
|
168
189
|
{
|
|
169
190
|
className: w("analytics-debugger-button", {
|
|
170
191
|
"is-active": a === t
|
|
171
192
|
}),
|
|
172
|
-
onClick: () =>
|
|
193
|
+
onClick: () => i(a),
|
|
173
194
|
children: a
|
|
174
195
|
}
|
|
175
|
-
) }, a +
|
|
196
|
+
) }, a + r);
|
|
176
197
|
}) })
|
|
177
198
|
] });
|
|
178
199
|
}
|
|
179
200
|
function B(e) {
|
|
180
|
-
const s =
|
|
181
|
-
return
|
|
201
|
+
const s = b.useRef({});
|
|
202
|
+
return b.useEffect(() => {
|
|
182
203
|
if (s.current)
|
|
183
204
|
for (const n of Object.values(s.current)) {
|
|
184
205
|
const t = Object.values(s.current).map((o) => o.el).filter((o) => o !== n.el);
|
|
@@ -222,72 +243,72 @@ function I(e, s) {
|
|
|
222
243
|
e.el,
|
|
223
244
|
n
|
|
224
245
|
);
|
|
225
|
-
if (e.el.style.inset = `${t.top} auto auto ${t.left}`, !!
|
|
246
|
+
if (e.el.style.inset = `${t.top} auto auto ${t.left}`, !!_(
|
|
226
247
|
e.el.getBoundingClientRect().left,
|
|
227
248
|
e.el.getBoundingClientRect().top + window.scrollY,
|
|
228
249
|
e.el.getBoundingClientRect().right,
|
|
229
250
|
e.el.getBoundingClientRect().bottom + window.scrollY
|
|
230
251
|
)) continue;
|
|
231
252
|
let o = !0;
|
|
232
|
-
for (let
|
|
233
|
-
const a = s[
|
|
234
|
-
|
|
253
|
+
for (let i = 0; i < s.length; i++) {
|
|
254
|
+
const a = s[i];
|
|
255
|
+
L(e.el, a) && (o = !1);
|
|
235
256
|
}
|
|
236
257
|
if (o) break;
|
|
237
258
|
}
|
|
238
259
|
}
|
|
239
|
-
function
|
|
240
|
-
const n = e.getBoundingClientRect().top + window.scrollY, t = e.getBoundingClientRect().left, o = n + e.clientHeight,
|
|
241
|
-
return
|
|
260
|
+
function L(e, s) {
|
|
261
|
+
const n = e.getBoundingClientRect().top + window.scrollY, t = e.getBoundingClientRect().left, o = n + e.clientHeight, i = t + e.clientWidth, a = s.getBoundingClientRect().top + window.scrollY, r = s.getBoundingClientRect().left, d = a + s.clientHeight, g = r + s.clientWidth, c = (u, y, p, x, m, f, v, E) => p <= m && m <= v && x <= f && f <= E || p <= u && u <= v && x <= y && y <= E || p <= u && u <= v && x <= f && f <= E || p <= m && m <= v && x <= y && y <= E;
|
|
262
|
+
return c(t, n, r, a, i, o, g, d) || c(r, a, t, n, g, d, i, o);
|
|
242
263
|
}
|
|
243
|
-
function
|
|
264
|
+
function _(e, s, n, t) {
|
|
244
265
|
return e < 0 || n > window.innerWidth || s < 0 || t > document.documentElement.scrollHeight;
|
|
245
266
|
}
|
|
246
267
|
function A(e, s, n) {
|
|
247
268
|
const t = s.clientHeight, o = s.clientWidth;
|
|
248
|
-
let
|
|
269
|
+
let i, a;
|
|
249
270
|
switch (n) {
|
|
250
271
|
case 0: {
|
|
251
|
-
a = window.scrollY + e.top - t + "px",
|
|
272
|
+
a = window.scrollY + e.top - t + "px", i = e.left - o + "px";
|
|
252
273
|
break;
|
|
253
274
|
}
|
|
254
275
|
case 1: {
|
|
255
|
-
a = window.scrollY + e.top - t + "px",
|
|
276
|
+
a = window.scrollY + e.top - t + "px", i = e.left + "px";
|
|
256
277
|
break;
|
|
257
278
|
}
|
|
258
279
|
case 2: {
|
|
259
|
-
a = window.scrollY + e.top - t + "px",
|
|
280
|
+
a = window.scrollY + e.top - t + "px", i = e.right + "px";
|
|
260
281
|
break;
|
|
261
282
|
}
|
|
262
283
|
case 3: {
|
|
263
|
-
a = window.scrollY + e.top - t + "px",
|
|
284
|
+
a = window.scrollY + e.top - t + "px", i = e.right - o + "px";
|
|
264
285
|
break;
|
|
265
286
|
}
|
|
266
287
|
case 4: {
|
|
267
|
-
a = window.scrollY + e.bottom + "px",
|
|
288
|
+
a = window.scrollY + e.bottom + "px", i = e.left - o + "px";
|
|
268
289
|
break;
|
|
269
290
|
}
|
|
270
291
|
case 5: {
|
|
271
|
-
a = window.scrollY + e.bottom + "px",
|
|
292
|
+
a = window.scrollY + e.bottom + "px", i = e.left + "px";
|
|
272
293
|
break;
|
|
273
294
|
}
|
|
274
295
|
case 6: {
|
|
275
|
-
a = window.scrollY + e.bottom + "px",
|
|
296
|
+
a = window.scrollY + e.bottom + "px", i = e.right - o + "px";
|
|
276
297
|
break;
|
|
277
298
|
}
|
|
278
299
|
case 7: {
|
|
279
|
-
a = window.scrollY + e.bottom + "px",
|
|
300
|
+
a = window.scrollY + e.bottom + "px", i = e.right + "px";
|
|
280
301
|
break;
|
|
281
302
|
}
|
|
282
303
|
default:
|
|
283
|
-
a = 0,
|
|
304
|
+
a = 0, i = 0;
|
|
284
305
|
}
|
|
285
306
|
return {
|
|
286
307
|
top: a,
|
|
287
|
-
left:
|
|
308
|
+
left: i
|
|
288
309
|
};
|
|
289
310
|
}
|
|
290
311
|
export {
|
|
291
|
-
|
|
292
|
-
|
|
312
|
+
$ as AnalyticsDebuggerInternal,
|
|
313
|
+
P as default
|
|
293
314
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-DvewYwma.cjs");function N(){return n.la().name!=="browser"||window.hasOwnProperty("debuggerInitialized")?null:(window.debuggerInitialized=!0,n.reactDomExports.createPortal(n.nt.jsx(j,{}),document.body))}const k=(e,a)=>{const s=e.dataset.yaAction,t=e.dataset.yaScopeoverride,o=e.dataset.yaEventname,i=t||a;return{action:s,originalEventName:i?`${i}_${o}`:o,scope:i}},S=(e,a)=>{const s=[];let t=e;for(;t!=null&&t.parentElement;)t=t.parentElement.closest(a),t&&s.push(t);return s},v={},w="YA_NO_SCOPE",y=(e,a,s,t)=>{v.hasOwnProperty(e)?v[e].events.map(o=>o.el).includes(t)||(v[e].events=[...v[e].events,{eventData:a,el:t}]):v[e]={scopeEl:s||t,events:[{eventData:a,el:t}]}};function j(){const[e,a]=n.reactExports.useState(),[s,t]=n.reactExports.useState([]),[o,i]=n.reactExports.useState(!1),l=r=>{a(e===r?void 0:r)};return n.reactExports.useEffect(()=>{let r=null;const d=()=>{r&&r.abort(),r=new AbortController;const c=r.signal;document.documentElement.classList.add("xYextDebug"),document.querySelectorAll("[data-ya-eventname]").forEach((u,E)=>{const m=u.closest("[data-ya-scope]"),h=m?.dataset.yaScope,p=k(u,h);u.addEventListener("mouseenter",()=>{t([{elem:u,key:`${p.originalEventName}_${E}`,action:p.action,originalEventName:p.originalEventName,scope:p.scope}])},{signal:c}),u.addEventListener("mouseleave",()=>{t([])},{signal:c});const x=u.dataset.yaScopeoverride;x?y(x,p,m,u):[h,...S(u,"[data-ya-scope]").map(b=>b.dataset.yaScope)].forEach(b=>{y(b||w,p,m,u)})}),i(!0)};d();const g=new MutationObserver(d);return g.observe(document,{childList:!0,subtree:!0}),()=>{document.documentElement.classList.remove("xYextDebug"),g.disconnect(),r?.abort()}},[]),o?n.nt.jsxs(n.nt.Fragment,{children:[n.nt.jsxs("div",{className:"analytics-debugger",children:[n.nt.jsxs("div",{className:"analytics-debugger-toggles",children:[n.nt.jsx("button",{className:n.el("analytics-debugger-toggle",{"is-active":e==="Events"}),onClick:()=>l("Events"),children:"Events"}),n.nt.jsx("button",{className:n.el("analytics-debugger-toggle",{"is-active":e==="Scopes"}),onClick:()=>l("Scopes"),children:"Scopes"})]}),e&&n.nt.jsx("div",{className:"analytics-debugger-tabs",children:e==="Events"?n.nt.jsx(C,{data:v,setTooltips:t}):n.nt.jsx($,{data:v,setTooltips:t})})]}),n.nt.jsx(D,{tooltips:s})]}):null}const Y=()=>{const e={};return Object.values(v).forEach(a=>{a.events.forEach(s=>{const{originalEventName:t}=s.eventData;e[t]||(e[t]=[]),!e[t].find(o=>o.el===s.el)&&e[t].push(s)})}),e};function C(e){const{setTooltips:a}=e,[s,t]=n.reactExports.useState([]),[o,i]=n.reactExports.useState(""),l=(r,d)=>{s.forEach(c=>c.classList.remove("analytics-event-highlight"));const g=r.map(c=>(c.el.scrollIntoView({behavior:"smooth",block:"nearest"}),c.el.classList.add("analytics-event-highlight"),c.el));t(g),i(d),a(r.map((c,u)=>({elem:c.el,key:`${c.eventData.originalEventName}_${u}`,action:c.eventData.action,originalEventName:c.eventData.originalEventName,scope:c.eventData.scope})))};return n.nt.jsxs("div",{className:"analytics-debugger-tab",children:[n.nt.jsx("h2",{className:"analytics-debugger-tab-title",children:"Event Names"}),n.nt.jsx("ul",{className:"analytics-debugger-list",children:Object.entries(Y()).map(([r,d],g)=>{const c=`${r}_${g}`;return n.nt.jsx("li",{className:"analytics-debugger-listItem",children:n.nt.jsx("button",{className:n.el("analytics-debugger-button",{"is-active":c===o}),onClick:()=>l(d,c),children:r})},c)})})]})}function $(e){const{data:a,setTooltips:s}=e,[t,o]=n.reactExports.useState(""),i=l=>{const r=a[l];r.scopeEl&&(r.scopeEl.scrollIntoView({behavior:"smooth",block:"nearest"}),o(l),s(r.events.map((d,g)=>{const c=d.eventData;return{elem:d.el,key:`${c.originalEventName}_${g}`,action:c.action,originalEventName:c.originalEventName,scope:c.scope}})))};return n.nt.jsxs("div",{className:"analytics-debugger-tab",children:[n.nt.jsx("h2",{className:"analytics-debugger-tab-title",children:"Scope Names"}),n.nt.jsx("ul",{className:"analytics-debugger-list",children:Object.keys(a).map((l,r)=>{if(l!==w)return n.nt.jsx("li",{className:"analytics-debugger-listItem",children:n.nt.jsx("button",{className:n.el("analytics-debugger-button",{"is-active":l===t}),onClick:()=>i(l),children:l})},l+r)})})]})}function D(e){const a=n.reactExports.useRef({});return n.reactExports.useEffect(()=>{if(a.current)for(const s of Object.values(a.current)){const t=Object.values(a.current).map(o=>o.el).filter(o=>o!==s.el);O(s,t),s.el.style.visibility="visible"}},[e.tooltips]),n.nt.jsx(n.nt.Fragment,{children:e.tooltips.map(s=>n.nt.jsxs("div",{style:{visibility:"hidden"},className:"analytics-debugger-tooltip",ref:t=>{t?a.current[s.key]={el:t,tooltip:s}:delete a.current[s.key]},children:[n.nt.jsxs("span",{children:["Action: ",s.action]}),n.nt.jsx("br",{}),n.nt.jsxs("span",{children:["Scope: ",s.scope]}),n.nt.jsx("br",{}),n.nt.jsxs("span",{children:["Original Event Name: ",s.originalEventName]})]},s.key))})}function O(e,a){for(let s=0;s<9;s++){const t=I(e.tooltip.elem.getBoundingClientRect(),e.el,s);if(e.el.style.inset=`${t.top} auto auto ${t.left}`,!!B(e.el.getBoundingClientRect().left,e.el.getBoundingClientRect().top+window.scrollY,e.el.getBoundingClientRect().right,e.el.getBoundingClientRect().bottom+window.scrollY))continue;let o=!0;for(let i=0;i<a.length;i++){const l=a[i];R(e.el,l)&&(o=!1)}if(o)break}}function R(e,a){const s=e.getBoundingClientRect().top+window.scrollY,t=e.getBoundingClientRect().left,o=s+e.clientHeight,i=t+e.clientWidth,l=a.getBoundingClientRect().top+window.scrollY,r=a.getBoundingClientRect().left,d=l+a.clientHeight,g=r+a.clientWidth,c=(u,E,m,h,p,x,b,f)=>m<=p&&p<=b&&h<=x&&x<=f||m<=u&&u<=b&&h<=E&&E<=f||m<=u&&u<=b&&h<=x&&x<=f||m<=p&&p<=b&&h<=E&&E<=f;return c(t,s,r,l,i,o,g,d)||c(r,l,t,s,g,d,i,o)}function B(e,a,s,t){return e<0||s>window.innerWidth||a<0||t>document.documentElement.scrollHeight}function I(e,a,s){const t=a.clientHeight,o=a.clientWidth;let i,l;switch(s){case 0:{l=window.scrollY+e.top-t+"px",i=e.left-o+"px";break}case 1:{l=window.scrollY+e.top-t+"px",i=e.left+"px";break}case 2:{l=window.scrollY+e.top-t+"px",i=e.right+"px";break}case 3:{l=window.scrollY+e.top-t+"px",i=e.right-o+"px";break}case 4:{l=window.scrollY+e.bottom+"px",i=e.left-o+"px";break}case 5:{l=window.scrollY+e.bottom+"px",i=e.left+"px";break}case 6:{l=window.scrollY+e.bottom+"px",i=e.right-o+"px";break}case 7:{l=window.scrollY+e.bottom+"px",i=e.right+"px";break}default:l=0,i=0}return{top:l,left:i}}exports.AnalyticsDebuggerInternal=j;exports.default=N;
|