@yext/visual-editor 0.0.63 → 1.0.0-beta.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yext/visual-editor",
3
3
  "description": "Component library for Yext Pages Visual Editor",
4
- "version": "0.0.63",
4
+ "version": "1.0.0-beta.0",
5
5
  "type": "module",
6
6
  "author": "sumo@yext.com",
7
7
  "repository": {
@@ -64,6 +64,7 @@
64
64
  "prompts": "^2.4.2",
65
65
  "pure-react-carousel": "^1.32.0",
66
66
  "react-aria-components": "^1.11.0",
67
+ "react-collapsed": "^4.1.2",
67
68
  "react-color": "^2.19.3",
68
69
  "react-error-boundary": "^5.0.0",
69
70
  "react-i18next": "^15.5.2",
@@ -111,7 +112,7 @@
111
112
  "lint-staged": "^15.2.7",
112
113
  "minimist": "^1.2.8",
113
114
  "pixelmatch": "^7.1.0",
114
- "playwright": "1.55.0",
115
+ "playwright": "1.55.1",
115
116
  "pngjs": "^7.0.0",
116
117
  "prettier": "^3.3.3",
117
118
  "react-icons": "^5.2.1",
@@ -129,8 +130,8 @@
129
130
  },
130
131
  "peerDependencies": {
131
132
  "@yext/pages-components": "^1.1.13",
132
- "@yext/search-headless-react": "^2.5.4",
133
- "@yext/search-ui-react": "^1.9.3",
133
+ "@yext/search-headless-react": "^2.6.0",
134
+ "@yext/search-ui-react": "^1.10.0",
134
135
  "mapbox-gl": "^2.9.2",
135
136
  "react": "^17.0.2 || ^18.2.0",
136
137
  "react-dom": "^17.0.2 || ^18.2.0"
@@ -1,314 +0,0 @@
1
- import { r as b, n as l, e as w, a as k, l as S } from "./index-BU3c50aZ.js";
2
- function P() {
3
- return S().name !== "browser" || window.hasOwnProperty("debuggerInitialized") ? null : (window.debuggerInitialized = !0, k.createPortal(/* @__PURE__ */ l.jsx($, {}), document.body));
4
- }
5
- const Y = (e, s) => {
6
- const n = e.dataset.yaAction, t = e.dataset.yaScopeoverride, o = e.dataset.yaEventname, i = t || s;
7
- return {
8
- action: n,
9
- originalEventName: i ? `${i}_${o}` : o,
10
- scope: i
11
- };
12
- }, C = (e, s) => {
13
- const n = [];
14
- let t = e;
15
- for (; t != null && t.parentElement; )
16
- t = t.parentElement.closest(s), t && n.push(t);
17
- return n;
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
- {
22
- eventData: s,
23
- el: t
24
- }
25
- ]) : h[e] = {
26
- scopeEl: n || t,
27
- // overidden scopes still need an element
28
- events: [
29
- {
30
- eventData: s,
31
- el: t
32
- }
33
- ]
34
- };
35
- };
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
- };
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: [
90
- /* @__PURE__ */ l.jsxs("div", { className: "analytics-debugger", children: [
91
- /* @__PURE__ */ l.jsxs("div", { className: "analytics-debugger-toggles", children: [
92
- /* @__PURE__ */ l.jsx(
93
- "button",
94
- {
95
- className: w("analytics-debugger-toggle", {
96
- "is-active": e === "Events"
97
- }),
98
- onClick: () => a("Events"),
99
- children: "Events"
100
- }
101
- ),
102
- /* @__PURE__ */ l.jsx(
103
- "button",
104
- {
105
- className: w("analytics-debugger-toggle", {
106
- "is-active": e === "Scopes"
107
- }),
108
- onClick: () => a("Scopes"),
109
- children: "Scopes"
110
- }
111
- )
112
- ] }),
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 }) })
114
- ] }),
115
- /* @__PURE__ */ l.jsx(B, { tooltips: n })
116
- ] }) : null;
117
- }
118
- const D = () => {
119
- const e = {};
120
- return Object.values(h).forEach((s) => {
121
- s.events.forEach((n) => {
122
- const { originalEventName: t } = n.eventData;
123
- e[t] || (e[t] = []), !e[t].find(
124
- (o) => o.el === n.el
125
- ) && e[t].push(n);
126
- });
127
- }), e;
128
- };
129
- function O(e) {
130
- const { setTooltips: s } = e, [n, t] = b.useState([]), [o, i] = b.useState(""), a = (r, d) => {
131
- n.forEach(
132
- (c) => c.classList.remove("analytics-event-highlight")
133
- );
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
142
- }))
143
- );
144
- };
145
- return /* @__PURE__ */ l.jsxs("div", { className: "analytics-debugger-tab", children: [
146
- /* @__PURE__ */ l.jsx("h2", { className: "analytics-debugger-tab-title", children: "Event Names" }),
147
- /* @__PURE__ */ l.jsx("ul", { className: "analytics-debugger-list", children: Object.entries(D()).map(
148
- ([r, d], g) => {
149
- const c = `${r}_${g}`;
150
- return /* @__PURE__ */ l.jsx("li", { className: "analytics-debugger-listItem", children: /* @__PURE__ */ l.jsx(
151
- "button",
152
- {
153
- className: w("analytics-debugger-button", {
154
- "is-active": c === o
155
- }),
156
- onClick: () => a(d, c),
157
- children: r
158
- }
159
- ) }, c);
160
- }
161
- ) })
162
- ] });
163
- }
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({
168
- behavior: "smooth",
169
- block: "nearest"
170
- }), o(a), n(
171
- r.events.map((d, g) => {
172
- const c = d.eventData;
173
- return {
174
- elem: d.el,
175
- key: `${c.originalEventName}_${g}`,
176
- action: c.action,
177
- originalEventName: c.originalEventName,
178
- scope: c.scope
179
- };
180
- })
181
- ));
182
- };
183
- return /* @__PURE__ */ l.jsxs("div", { className: "analytics-debugger-tab", children: [
184
- /* @__PURE__ */ l.jsx("h2", { className: "analytics-debugger-tab-title", children: "Scope Names" }),
185
- /* @__PURE__ */ l.jsx("ul", { className: "analytics-debugger-list", children: Object.keys(s).map((a, r) => {
186
- if (a !== N)
187
- return /* @__PURE__ */ l.jsx("li", { className: "analytics-debugger-listItem", children: /* @__PURE__ */ l.jsx(
188
- "button",
189
- {
190
- className: w("analytics-debugger-button", {
191
- "is-active": a === t
192
- }),
193
- onClick: () => i(a),
194
- children: a
195
- }
196
- ) }, a + r);
197
- }) })
198
- ] });
199
- }
200
- function B(e) {
201
- const s = b.useRef({});
202
- return b.useEffect(() => {
203
- if (s.current)
204
- for (const n of Object.values(s.current)) {
205
- const t = Object.values(s.current).map((o) => o.el).filter((o) => o !== n.el);
206
- I(n, t), n.el.style.visibility = "visible";
207
- }
208
- }, [e.tooltips]), /* @__PURE__ */ l.jsx(l.Fragment, { children: e.tooltips.map((n) => /* @__PURE__ */ l.jsxs(
209
- "div",
210
- {
211
- style: { visibility: "hidden" },
212
- className: "analytics-debugger-tooltip",
213
- ref: (t) => {
214
- t ? s.current[n.key] = {
215
- el: t,
216
- tooltip: n
217
- } : delete s.current[n.key];
218
- },
219
- children: [
220
- /* @__PURE__ */ l.jsxs("span", { children: [
221
- "Action: ",
222
- n.action
223
- ] }),
224
- /* @__PURE__ */ l.jsx("br", {}),
225
- /* @__PURE__ */ l.jsxs("span", { children: [
226
- "Scope: ",
227
- n.scope
228
- ] }),
229
- /* @__PURE__ */ l.jsx("br", {}),
230
- /* @__PURE__ */ l.jsxs("span", { children: [
231
- "Original Event Name: ",
232
- n.originalEventName
233
- ] })
234
- ]
235
- },
236
- n.key
237
- )) });
238
- }
239
- function I(e, s) {
240
- for (let n = 0; n < 9; n++) {
241
- const t = A(
242
- e.tooltip.elem.getBoundingClientRect(),
243
- e.el,
244
- n
245
- );
246
- if (e.el.style.inset = `${t.top} auto auto ${t.left}`, !!_(
247
- e.el.getBoundingClientRect().left,
248
- e.el.getBoundingClientRect().top + window.scrollY,
249
- e.el.getBoundingClientRect().right,
250
- e.el.getBoundingClientRect().bottom + window.scrollY
251
- )) continue;
252
- let o = !0;
253
- for (let i = 0; i < s.length; i++) {
254
- const a = s[i];
255
- L(e.el, a) && (o = !1);
256
- }
257
- if (o) break;
258
- }
259
- }
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);
263
- }
264
- function _(e, s, n, t) {
265
- return e < 0 || n > window.innerWidth || s < 0 || t > document.documentElement.scrollHeight;
266
- }
267
- function A(e, s, n) {
268
- const t = s.clientHeight, o = s.clientWidth;
269
- let i, a;
270
- switch (n) {
271
- case 0: {
272
- a = window.scrollY + e.top - t + "px", i = e.left - o + "px";
273
- break;
274
- }
275
- case 1: {
276
- a = window.scrollY + e.top - t + "px", i = e.left + "px";
277
- break;
278
- }
279
- case 2: {
280
- a = window.scrollY + e.top - t + "px", i = e.right + "px";
281
- break;
282
- }
283
- case 3: {
284
- a = window.scrollY + e.top - t + "px", i = e.right - o + "px";
285
- break;
286
- }
287
- case 4: {
288
- a = window.scrollY + e.bottom + "px", i = e.left - o + "px";
289
- break;
290
- }
291
- case 5: {
292
- a = window.scrollY + e.bottom + "px", i = e.left + "px";
293
- break;
294
- }
295
- case 6: {
296
- a = window.scrollY + e.bottom + "px", i = e.right - o + "px";
297
- break;
298
- }
299
- case 7: {
300
- a = window.scrollY + e.bottom + "px", i = e.right + "px";
301
- break;
302
- }
303
- default:
304
- a = 0, i = 0;
305
- }
306
- return {
307
- top: a,
308
- left: i
309
- };
310
- }
311
- export {
312
- $ as AnalyticsDebuggerInternal,
313
- P as default
314
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-DNFbLH_-.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;