@yext/pages-components 1.2.1 → 1.2.3

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.
@@ -1,36 +1,6 @@
1
1
  This file was generated with the generate-license-file npm package!
2
2
  https://www.npmjs.com/package/generate-license-file
3
3
 
4
- The following npm package may be included in this product:
5
-
6
- - unified@11.0.4
7
-
8
- This package contains the following license:
9
-
10
- (The MIT License)
11
-
12
- Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com>
13
-
14
- Permission is hereby granted, free of charge, to any person obtaining a copy
15
- of this software and associated documentation files (the "Software"), to deal
16
- in the Software without restriction, including without limitation the rights
17
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- copies of the Software, and to permit persons to whom the Software is
19
- furnished to do so, subject to the following conditions:
20
-
21
- The above copyright notice and this permission notice shall be included in
22
- all copies or substantial portions of the Software.
23
-
24
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30
- THE SOFTWARE.
31
-
32
- -----------
33
-
34
4
  The following npm packages may be included in this product:
35
5
 
36
6
  - mdast-util-to-hast@12.3.0
@@ -96,25 +66,17 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
96
66
 
97
67
  The following npm package may be included in this product:
98
68
 
99
- - picocolors@1.1.1
69
+ - luxon@3.7.2
100
70
 
101
71
  This package contains the following license:
102
72
 
103
- ISC License
73
+ Copyright 2019 JS Foundation and other contributors
104
74
 
105
- Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov, Anton Verinov
75
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
106
76
 
107
- Permission to use, copy, modify, and/or distribute this software for any
108
- purpose with or without fee is hereby granted, provided that the above
109
- copyright notice and this permission notice appear in all copies.
77
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
110
78
 
111
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
112
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
113
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
114
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
115
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
116
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
117
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
79
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
118
80
 
119
81
  -----------
120
82
 
@@ -302,35 +264,5 @@ SOFTWARE.
302
264
 
303
265
  -----------
304
266
 
305
- The following npm package may be included in this product:
306
-
307
- - uvu@0.5.6
308
-
309
- This package contains the following license:
310
-
311
- The MIT License (MIT)
312
-
313
- Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
314
-
315
- Permission is hereby granted, free of charge, to any person obtaining a copy
316
- of this software and associated documentation files (the "Software"), to deal
317
- in the Software without restriction, including without limitation the rights
318
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
319
- copies of the Software, and to permit persons to whom the Software is
320
- furnished to do so, subject to the following conditions:
321
-
322
- The above copyright notice and this permission notice shall be included in
323
- all copies or substantial portions of the Software.
324
-
325
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
326
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
327
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
328
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
329
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
330
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
331
- THE SOFTWARE.
332
-
333
- -----------
334
-
335
267
  This file was generated with the generate-license-file npm package!
336
268
  https://www.npmjs.com/package/generate-license-file
@@ -0,0 +1,316 @@
1
+ import { g as C, j as o, c as j } from "./index-3y1PqoZ5.js";
2
+ import { useState as w, useEffect as N, useRef as O } from "react";
3
+ import { createPortal as D } from "react-dom";
4
+ function z() {
5
+ return C().name !== "browser" || window.hasOwnProperty("debuggerInitialized") ? null : (window.debuggerInitialized = !0, D(/* @__PURE__ */ o.jsx(R, {}), document.body));
6
+ }
7
+ const S = (e, s) => {
8
+ const n = e.dataset.yaAction, t = e.dataset.yaScopeoverride, r = e.dataset.yaEventname, c = t || s;
9
+ return {
10
+ action: n,
11
+ originalEventName: c ? `${c}_${r}` : r,
12
+ scope: c
13
+ };
14
+ }, Y = (e, s) => {
15
+ const n = [];
16
+ let t = e;
17
+ for (; t != null && t.parentElement; )
18
+ t = t.parentElement.closest(s), t && n.push(t);
19
+ return n;
20
+ }, b = {}, B = "YA_NO_SCOPE", k = (e, s, n, t) => {
21
+ b.hasOwnProperty(e) ? b[e].events.map((r) => r.el).includes(t) || (b[e].events = [
22
+ ...b[e].events,
23
+ {
24
+ eventData: s,
25
+ el: t
26
+ }
27
+ ]) : b[e] = {
28
+ scopeEl: n || t,
29
+ // overidden scopes still need an element
30
+ events: [
31
+ {
32
+ eventData: s,
33
+ el: t
34
+ }
35
+ ]
36
+ };
37
+ };
38
+ function R() {
39
+ const [e, s] = w(), [n, t] = w([]), [r, c] = w(!1), i = (a) => {
40
+ s(e === a ? void 0 : a);
41
+ };
42
+ return N(() => {
43
+ let a = null;
44
+ const u = () => {
45
+ a && a.abort(), a = new AbortController();
46
+ const l = a.signal;
47
+ document.documentElement.classList.add("xYextDebug"), document.querySelectorAll(
48
+ "[data-ya-eventname]"
49
+ ).forEach((d, x) => {
50
+ const m = d.closest("[data-ya-scope]"), v = m == null ? void 0 : m.dataset.yaScope, p = S(d, v);
51
+ d.addEventListener(
52
+ "mouseenter",
53
+ () => {
54
+ t([
55
+ {
56
+ elem: d,
57
+ key: `${p.originalEventName}_${x}`,
58
+ action: p.action,
59
+ originalEventName: p.originalEventName,
60
+ scope: p.scope
61
+ }
62
+ ]);
63
+ },
64
+ { signal: l }
65
+ ), d.addEventListener(
66
+ "mouseleave",
67
+ () => {
68
+ t([]);
69
+ },
70
+ { signal: l }
71
+ );
72
+ const f = d.dataset.yaScopeoverride;
73
+ f ? k(f, p, m, d) : [
74
+ v,
75
+ ...Y(d, "[data-ya-scope]").map(
76
+ (E) => E.dataset.yaScope
77
+ )
78
+ ].forEach((E) => {
79
+ k(E || B, p, m, d);
80
+ });
81
+ }), c(!0);
82
+ };
83
+ u();
84
+ const g = new MutationObserver(u);
85
+ return g.observe(document, {
86
+ childList: !0,
87
+ subtree: !0
88
+ }), () => {
89
+ document.documentElement.classList.remove("xYextDebug"), g.disconnect(), a == null || a.abort();
90
+ };
91
+ }, []), r ? /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
92
+ /* @__PURE__ */ o.jsxs("div", { className: "analytics-debugger", children: [
93
+ /* @__PURE__ */ o.jsxs("div", { className: "analytics-debugger-toggles", children: [
94
+ /* @__PURE__ */ o.jsx(
95
+ "button",
96
+ {
97
+ className: j("analytics-debugger-toggle", {
98
+ "is-active": e === "Events"
99
+ }),
100
+ onClick: () => i("Events"),
101
+ children: "Events"
102
+ }
103
+ ),
104
+ /* @__PURE__ */ o.jsx(
105
+ "button",
106
+ {
107
+ className: j("analytics-debugger-toggle", {
108
+ "is-active": e === "Scopes"
109
+ }),
110
+ onClick: () => i("Scopes"),
111
+ children: "Scopes"
112
+ }
113
+ )
114
+ ] }),
115
+ e && /* @__PURE__ */ o.jsx("div", { className: "analytics-debugger-tabs", children: e === "Events" ? /* @__PURE__ */ o.jsx(A, { data: b, setTooltips: t }) : /* @__PURE__ */ o.jsx($, { data: b, setTooltips: t }) })
116
+ ] }),
117
+ /* @__PURE__ */ o.jsx(L, { tooltips: n })
118
+ ] }) : null;
119
+ }
120
+ const T = () => {
121
+ const e = {};
122
+ return Object.values(b).forEach((s) => {
123
+ s.events.forEach((n) => {
124
+ const { originalEventName: t } = n.eventData;
125
+ e[t] || (e[t] = []), !e[t].find(
126
+ (r) => r.el === n.el
127
+ ) && e[t].push(n);
128
+ });
129
+ }), e;
130
+ };
131
+ function A(e) {
132
+ const { setTooltips: s } = e, [n, t] = w([]), [r, c] = w(""), i = (a, u) => {
133
+ n.forEach(
134
+ (l) => l.classList.remove("analytics-event-highlight")
135
+ );
136
+ const g = a.map((l) => (l.el.scrollIntoView({ behavior: "smooth", block: "nearest" }), l.el.classList.add("analytics-event-highlight"), l.el));
137
+ t(g), c(u), s(
138
+ a.map((l, h) => ({
139
+ elem: l.el,
140
+ key: `${l.eventData.originalEventName}_${h}`,
141
+ action: l.eventData.action,
142
+ originalEventName: l.eventData.originalEventName,
143
+ scope: l.eventData.scope
144
+ }))
145
+ );
146
+ };
147
+ return /* @__PURE__ */ o.jsxs("div", { className: "analytics-debugger-tab", children: [
148
+ /* @__PURE__ */ o.jsx("h2", { className: "analytics-debugger-tab-title", children: "Event Names" }),
149
+ /* @__PURE__ */ o.jsx("ul", { className: "analytics-debugger-list", children: Object.entries(T()).map(
150
+ ([a, u], g) => {
151
+ const l = `${a}_${g}`;
152
+ return /* @__PURE__ */ o.jsx("li", { className: "analytics-debugger-listItem", children: /* @__PURE__ */ o.jsx(
153
+ "button",
154
+ {
155
+ className: j("analytics-debugger-button", {
156
+ "is-active": l === r
157
+ }),
158
+ onClick: () => i(u, l),
159
+ children: a
160
+ }
161
+ ) }, l);
162
+ }
163
+ ) })
164
+ ] });
165
+ }
166
+ function $(e) {
167
+ const { data: s, setTooltips: n } = e, [t, r] = w(""), c = (i) => {
168
+ const a = s[i];
169
+ a.scopeEl && (a.scopeEl.scrollIntoView({
170
+ behavior: "smooth",
171
+ block: "nearest"
172
+ }), r(i), n(
173
+ a.events.map((u, g) => {
174
+ const l = u.eventData;
175
+ return {
176
+ elem: u.el,
177
+ key: `${l.originalEventName}_${g}`,
178
+ action: l.action,
179
+ originalEventName: l.originalEventName,
180
+ scope: l.scope
181
+ };
182
+ })
183
+ ));
184
+ };
185
+ return /* @__PURE__ */ o.jsxs("div", { className: "analytics-debugger-tab", children: [
186
+ /* @__PURE__ */ o.jsx("h2", { className: "analytics-debugger-tab-title", children: "Scope Names" }),
187
+ /* @__PURE__ */ o.jsx("ul", { className: "analytics-debugger-list", children: Object.keys(s).map((i, a) => {
188
+ if (i !== B)
189
+ return /* @__PURE__ */ o.jsx("li", { className: "analytics-debugger-listItem", children: /* @__PURE__ */ o.jsx(
190
+ "button",
191
+ {
192
+ className: j("analytics-debugger-button", {
193
+ "is-active": i === t
194
+ }),
195
+ onClick: () => c(i),
196
+ children: i
197
+ }
198
+ ) }, i + a);
199
+ }) })
200
+ ] });
201
+ }
202
+ function L(e) {
203
+ const s = O({});
204
+ return N(() => {
205
+ if (s.current)
206
+ for (const n of Object.values(s.current)) {
207
+ const t = Object.values(s.current).map((r) => r.el).filter((r) => r !== n.el);
208
+ _(n, t), n.el.style.visibility = "visible";
209
+ }
210
+ }, [e.tooltips]), /* @__PURE__ */ o.jsx(o.Fragment, { children: e.tooltips.map((n) => /* @__PURE__ */ o.jsxs(
211
+ "div",
212
+ {
213
+ style: { visibility: "hidden" },
214
+ className: "analytics-debugger-tooltip",
215
+ ref: (t) => {
216
+ t ? s.current[n.key] = {
217
+ el: t,
218
+ tooltip: n
219
+ } : delete s.current[n.key];
220
+ },
221
+ children: [
222
+ /* @__PURE__ */ o.jsxs("span", { children: [
223
+ "Action: ",
224
+ n.action
225
+ ] }),
226
+ /* @__PURE__ */ o.jsx("br", {}),
227
+ /* @__PURE__ */ o.jsxs("span", { children: [
228
+ "Scope: ",
229
+ n.scope
230
+ ] }),
231
+ /* @__PURE__ */ o.jsx("br", {}),
232
+ /* @__PURE__ */ o.jsxs("span", { children: [
233
+ "Original Event Name: ",
234
+ n.originalEventName
235
+ ] })
236
+ ]
237
+ },
238
+ n.key
239
+ )) });
240
+ }
241
+ function _(e, s) {
242
+ for (let n = 0; n < 9; n++) {
243
+ const t = H(
244
+ e.tooltip.elem.getBoundingClientRect(),
245
+ e.el,
246
+ n
247
+ );
248
+ if (e.el.style.inset = `${t.top} auto auto ${t.left}`, !!P(
249
+ e.el.getBoundingClientRect().left,
250
+ e.el.getBoundingClientRect().top + window.scrollY,
251
+ e.el.getBoundingClientRect().right,
252
+ e.el.getBoundingClientRect().bottom + window.scrollY
253
+ )) continue;
254
+ let c = !0;
255
+ for (let i = 0; i < s.length; i++) {
256
+ const a = s[i];
257
+ I(e.el, a) && (c = !1);
258
+ }
259
+ if (c) break;
260
+ }
261
+ }
262
+ function I(e, s) {
263
+ const n = e.getBoundingClientRect().top + window.scrollY, t = e.getBoundingClientRect().left, r = n + e.clientHeight, c = t + e.clientWidth, i = s.getBoundingClientRect().top + window.scrollY, a = s.getBoundingClientRect().left, u = i + s.clientHeight, g = a + s.clientWidth, l = (h, d, x, m, v, p, f, y) => x <= v && v <= f && m <= p && p <= y || x <= h && h <= f && m <= d && d <= y || x <= h && h <= f && m <= p && p <= y || x <= v && v <= f && m <= d && d <= y;
264
+ return l(t, n, a, i, c, r, g, u) || l(a, i, t, n, g, u, c, r);
265
+ }
266
+ function P(e, s, n, t) {
267
+ return e < 0 || n > window.innerWidth || s < 0 || t > document.documentElement.scrollHeight;
268
+ }
269
+ function H(e, s, n) {
270
+ const t = s.clientHeight, r = s.clientWidth;
271
+ let c, i;
272
+ switch (n) {
273
+ case 0: {
274
+ i = window.scrollY + e.top - t + "px", c = e.left - r + "px";
275
+ break;
276
+ }
277
+ case 1: {
278
+ i = window.scrollY + e.top - t + "px", c = e.left + "px";
279
+ break;
280
+ }
281
+ case 2: {
282
+ i = window.scrollY + e.top - t + "px", c = e.right + "px";
283
+ break;
284
+ }
285
+ case 3: {
286
+ i = window.scrollY + e.top - t + "px", c = e.right - r + "px";
287
+ break;
288
+ }
289
+ case 4: {
290
+ i = window.scrollY + e.bottom + "px", c = e.left - r + "px";
291
+ break;
292
+ }
293
+ case 5: {
294
+ i = window.scrollY + e.bottom + "px", c = e.left + "px";
295
+ break;
296
+ }
297
+ case 6: {
298
+ i = window.scrollY + e.bottom + "px", c = e.right - r + "px";
299
+ break;
300
+ }
301
+ case 7: {
302
+ i = window.scrollY + e.bottom + "px", c = e.right + "px";
303
+ break;
304
+ }
305
+ default:
306
+ i = 0, c = 0;
307
+ }
308
+ return {
309
+ top: i,
310
+ left: c
311
+ };
312
+ }
313
+ export {
314
+ R as AnalyticsDebuggerInternal,
315
+ z as default
316
+ };