@yext/pages-components 1.2.0 → 1.2.2

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,4 +1,4 @@
1
- import { A as e, N as t, X as o, e as i, f as r, l as c, o as n, Z as p, E as g, _ as u, C as h, a3 as m, D as l, F as S, J as d, $ as M, H as P, B as y, I as x, q as A, a1 as L, z as C, y as f, r as O, L as v, G as R, x as T, O as B, s as I, M as b, a2 as k, a0 as D, v as H, R as w, Q as G, U as Q, T as z, V as E, W as F, P as U, Y as V, S as W, m as q, d as J, p as K, K as N, u as X, w as Y, k as Z, t as _, i as $, n as j, h as aa } from "./index-sidm05Eh.js";
1
+ import { A as e, K as t, W as o, e as i, f as r, k as c, n, Y as p, B as g, Z as u, C as h, a2 as m, D as l, E as S, G as d, _ as M, H as P, z as y, I as x, p as A, a0 as L, y as C, x as f, q as O, L as v, F as R, w as T, N as B, r as I, M as b, a1 as k, $ as D, t as H, Q as w, O as G, T as Q, R as z, U as E, V as F, P as U, X as V, S as W, l as j, d as q, o as J, J as K, u as N, v as X, j as Y, s as Z, i as _, m as $, h as aa } from "./index-0El3OWzn.js";
2
2
  export {
3
3
  e as Address,
4
4
  t as AddressSchema,
@@ -42,15 +42,15 @@ export {
42
42
  U as Product,
43
43
  V as ReviewSchema,
44
44
  W as SchemaWrapper,
45
- q as debuggingParamDetected,
46
- J as getDirections,
47
- K as getImageUrl,
48
- N as getRichTextContent,
49
- X as useAnalytics,
50
- Y as useClusterContext,
51
- Z as useIdentify,
52
- _ as useMapContext,
53
- $ as usePageView,
54
- j as useScope,
45
+ j as debuggingParamDetected,
46
+ q as getDirections,
47
+ J as getImageUrl,
48
+ K as getRichTextContent,
49
+ N as useAnalytics,
50
+ X as useClusterContext,
51
+ Y as useIdentify,
52
+ Z as useMapContext,
53
+ _ as usePageView,
54
+ $ as useScope,
55
55
  aa as useTrack
56
56
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yext/pages-components",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "A React component library that supports Yext Pages development",
5
5
  "author": "sumo@yext.com",
6
6
  "license": "BSD-3-Clause",
@@ -54,6 +54,7 @@
54
54
  "@types/google.maps": "^3.58.1",
55
55
  "@types/jest-image-snapshot": "^6.4.0",
56
56
  "@types/leaflet": "^1.9.12",
57
+ "@types/luxon": "^3.7.1",
57
58
  "@types/mapbox-gl": "^3.4.0",
58
59
  "@types/mdast": "3.0.10",
59
60
  "@types/node": "^20.10.4",
@@ -90,6 +91,7 @@
90
91
  "browser-or-node": "^3.0.0",
91
92
  "classnames": "^2.5.1",
92
93
  "lexical": "~0.38.2",
94
+ "luxon": "^3.7.2",
93
95
  "mdast-util-from-markdown": "1.2.0",
94
96
  "mdast-util-to-hast": "12.3.0",
95
97
  "micromark-util-chunked": "1.0.0",
@@ -1,316 +0,0 @@
1
- import { g as C, j as o, c as j } from "./index-sidm05Eh.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
- };