@yext/pages-components 1.1.15 → 1.1.16
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/{debugger-Bc6LFql_.cjs → debugger-BL5RlYxB.cjs} +1 -1
- package/dist/{debugger-BxGLUF0a.js → debugger-BrsjgtOq.js} +1 -1
- package/dist/{index-CjhHamzw.cjs → index-B1spQwtc.cjs} +22 -22
- package/dist/{index-7fAhZ2Ii.cjs → index-COgeaXvJ.cjs} +1 -1
- package/dist/{index-BZoK3sUE.js → index-D3PATLn2.js} +1 -1
- package/dist/{index-CDEZRpEm.js → index-DP_FQeoV.js} +607 -605
- package/dist/pages-components.cjs +1 -1
- package/dist/pages-components.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-B1spQwtc.cjs"),m=require("react"),N=require("react-dom");function S(){return i.getRuntime().name!=="browser"||window.hasOwnProperty("debuggerInitialized")?null:(window.debuggerInitialized=!0,N.createPortal(i.jsxRuntimeExports.jsx(k,{}),document.body))}const B=(e,n)=>{const s=e.dataset.yaAction,t=e.dataset.yaScopeoverride,r=e.dataset.yaEventname,c=t||n;return{action:s,originalEventName:c?`${c}_${r}`:r,scope:c}},C=(e,n)=>{const s=[];let t=e;for(;t!=null&&t.parentElement;)t=t.parentElement.closest(n),t&&s.push(t);return s},b={},R="YA_NO_SCOPE",w=(e,n,s,t)=>{b.hasOwnProperty(e)?b[e].events.map(r=>r.el).includes(t)||(b[e].events=[...b[e].events,{eventData:n,el:t}]):b[e]={scopeEl:s||t,events:[{eventData:n,el:t}]}};function k(){const[e,n]=m.useState(),[s,t]=m.useState([]),[r,c]=m.useState(!1),o=a=>{n(e===a?void 0:a)};return m.useEffect(()=>{let a=null;const d=()=>{a&&a.abort(),a=new AbortController;const l=a.signal;document.documentElement.classList.add("xYextDebug"),document.querySelectorAll("[data-ya-eventname]").forEach((u,j)=>{const p=u.closest("[data-ya-scope]"),v=p==null?void 0:p.dataset.yaScope,x=B(u,v);u.addEventListener("mouseenter",()=>{t([{elem:u,key:`${x.originalEventName}_${j}`,action:x.action,originalEventName:x.originalEventName,scope:x.scope}])},{signal:l}),u.addEventListener("mouseleave",()=>{t([])},{signal:l});const E=u.dataset.yaScopeoverride;E?w(E,x,p,u):[v,...C(u,"[data-ya-scope]").map(y=>y.dataset.yaScope)].forEach(y=>{w(y||R,x,p,u)})}),c(!0)};d();const g=new MutationObserver(d);return g.observe(document,{childList:!0,subtree:!0}),()=>{document.documentElement.classList.remove("xYextDebug"),g.disconnect(),a==null||a.abort()}},[]),r?i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsxs("div",{className:"analytics-debugger",children:[i.jsxRuntimeExports.jsxs("div",{className:"analytics-debugger-toggles",children:[i.jsxRuntimeExports.jsx("button",{className:i.c("analytics-debugger-toggle",{"is-active":e==="Events"}),onClick:()=>o("Events"),children:"Events"}),i.jsxRuntimeExports.jsx("button",{className:i.c("analytics-debugger-toggle",{"is-active":e==="Scopes"}),onClick:()=>o("Scopes"),children:"Scopes"})]}),e&&i.jsxRuntimeExports.jsx("div",{className:"analytics-debugger-tabs",children:e==="Events"?i.jsxRuntimeExports.jsx(O,{data:b,setTooltips:t}):i.jsxRuntimeExports.jsx(Y,{data:b,setTooltips:t})})]}),i.jsxRuntimeExports.jsx(T,{tooltips:s})]}):null}const D=()=>{const e={};return Object.values(b).forEach(n=>{n.events.forEach(s=>{const{originalEventName:t}=s.eventData;e[t]||(e[t]=[]),!e[t].find(r=>r.el===s.el)&&e[t].push(s)})}),e};function O(e){const{setTooltips:n}=e,[s,t]=m.useState([]),[r,c]=m.useState(""),o=(a,d)=>{s.forEach(l=>l.classList.remove("analytics-event-highlight"));const g=a.map(l=>(l.el.scrollIntoView({behavior:"smooth",block:"nearest"}),l.el.classList.add("analytics-event-highlight"),l.el));t(g),c(d),n(a.map((l,h)=>({elem:l.el,key:`${l.eventData.originalEventName}_${h}`,action:l.eventData.action,originalEventName:l.eventData.originalEventName,scope:l.eventData.scope})))};return i.jsxRuntimeExports.jsxs("div",{className:"analytics-debugger-tab",children:[i.jsxRuntimeExports.jsx("h2",{className:"analytics-debugger-tab-title",children:"Event Names"}),i.jsxRuntimeExports.jsx("ul",{className:"analytics-debugger-list",children:Object.entries(D()).map(([a,d],g)=>{const l=`${a}_${g}`;return i.jsxRuntimeExports.jsx("li",{className:"analytics-debugger-listItem",children:i.jsxRuntimeExports.jsx("button",{className:i.c("analytics-debugger-button",{"is-active":l===r}),onClick:()=>o(d,l),children:a})},l)})})]})}function Y(e){const{data:n,setTooltips:s}=e,[t,r]=m.useState(""),c=o=>{const a=n[o];a.scopeEl&&(a.scopeEl.scrollIntoView({behavior:"smooth",block:"nearest"}),r(o),s(a.events.map((d,g)=>{const l=d.eventData;return{elem:d.el,key:`${l.originalEventName}_${g}`,action:l.action,originalEventName:l.originalEventName,scope:l.scope}})))};return i.jsxRuntimeExports.jsxs("div",{className:"analytics-debugger-tab",children:[i.jsxRuntimeExports.jsx("h2",{className:"analytics-debugger-tab-title",children:"Scope Names"}),i.jsxRuntimeExports.jsx("ul",{className:"analytics-debugger-list",children:Object.keys(n).map((o,a)=>{if(o!==R)return i.jsxRuntimeExports.jsx("li",{className:"analytics-debugger-listItem",children:i.jsxRuntimeExports.jsx("button",{className:i.c("analytics-debugger-button",{"is-active":o===t}),onClick:()=>c(o),children:o})},o+a)})})]})}function T(e){const n=m.useRef({});return m.useEffect(()=>{if(n.current)for(const s of Object.values(n.current)){const t=Object.values(n.current).map(r=>r.el).filter(r=>r!==s.el);A(s,t),s.el.style.visibility="visible"}},[e.tooltips]),i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:e.tooltips.map(s=>i.jsxRuntimeExports.jsxs("div",{style:{visibility:"hidden"},className:"analytics-debugger-tooltip",ref:t=>{t?n.current[s.key]={el:t,tooltip:s}:delete n.current[s.key]},children:[i.jsxRuntimeExports.jsxs("span",{children:["Action: ",s.action]}),i.jsxRuntimeExports.jsx("br",{}),i.jsxRuntimeExports.jsxs("span",{children:["Scope: ",s.scope]}),i.jsxRuntimeExports.jsx("br",{}),i.jsxRuntimeExports.jsxs("span",{children:["Original Event Name: ",s.originalEventName]})]},s.key))})}function A(e,n){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}`,!!L(e.el.getBoundingClientRect().left,e.el.getBoundingClientRect().top+window.scrollY,e.el.getBoundingClientRect().right,e.el.getBoundingClientRect().bottom+window.scrollY))continue;let c=!0;for(let o=0;o<n.length;o++){const a=n[o];$(e.el,a)&&(c=!1)}if(c)break}}function $(e,n){const s=e.getBoundingClientRect().top+window.scrollY,t=e.getBoundingClientRect().left,r=s+e.clientHeight,c=t+e.clientWidth,o=n.getBoundingClientRect().top+window.scrollY,a=n.getBoundingClientRect().left,d=o+n.clientHeight,g=a+n.clientWidth,l=(h,u,j,p,v,x,E,f)=>j<=v&&v<=E&&p<=x&&x<=f||j<=h&&h<=E&&p<=u&&u<=f||j<=h&&h<=E&&p<=x&&x<=f||j<=v&&v<=E&&p<=u&&u<=f;return l(t,s,a,o,c,r,g,d)||l(a,o,t,s,g,d,c,r)}function L(e,n,s,t){return e<0||s>window.innerWidth||n<0||t>document.documentElement.scrollHeight}function I(e,n,s){const t=n.clientHeight,r=n.clientWidth;let c,o;switch(s){case 0:{o=window.scrollY+e.top-t+"px",c=e.left-r+"px";break}case 1:{o=window.scrollY+e.top-t+"px",c=e.left+"px";break}case 2:{o=window.scrollY+e.top-t+"px",c=e.right+"px";break}case 3:{o=window.scrollY+e.top-t+"px",c=e.right-r+"px";break}case 4:{o=window.scrollY+e.bottom+"px",c=e.left-r+"px";break}case 5:{o=window.scrollY+e.bottom+"px",c=e.left+"px";break}case 6:{o=window.scrollY+e.bottom+"px",c=e.right-r+"px";break}case 7:{o=window.scrollY+e.bottom+"px",c=e.right+"px";break}default:o=0,c=0}return{top:o,left:c}}exports.AnalyticsDebuggerInternal=k;exports.default=S;
|