@yext/pages-components 1.1.4 → 1.1.6

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 { g as B, j as o, c as j } from "./index-sv5RsdeI.js";
1
+ import { g as B, j as o, c as j } from "./index-C8IsJIMm.js";
2
2
  import { useState as b, useEffect as k, useRef as C } from "react";
3
3
  import { createPortal as O } from "react-dom";
4
4
  function q() {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-BQ2AP_nD.cjs"),p=require("react"),k=require("react-dom");function N(){return i.getRuntime().name!=="browser"||window.hasOwnProperty("debuggerInitialized")?null:(window.debuggerInitialized=!0,k.createPortal(i.jsxRuntimeExports.jsx(R,{}),document.body))}const S=(e,n)=>{const s=e.dataset.yaAction,t=e.dataset.yaScopeoverride,l=e.dataset.yaEventname,c=t||n;return{action:s,originalEventName:c?`${c}_${l}`:l,scope:c}},B=(e,n)=>{const s=[];let t=e;for(;t!=null&&t.parentElement;)t=t.parentElement.closest(n),t&&s.push(t);return s},h={},w="YA_NO_SCOPE",y=(e,n,s,t)=>{h.hasOwnProperty(e)?h[e].events.map(l=>l.el).includes(t)||(h[e].events=[...h[e].events,{eventData:n,el:t}]):h[e]={scopeEl:s||t,events:[{eventData:n,el:t}]}};function R(){const[e,n]=p.useState(),[s,t]=p.useState([]),[l,c]=p.useState(!1),o=r=>{n(e===r?void 0:r)};return p.useEffect(()=>(document.documentElement.classList.add("xYextDebug"),document.querySelectorAll("[data-ya-eventname]").forEach((u,g)=>{const a=u.closest("[data-ya-scope]"),x=a==null?void 0:a.dataset.yaScope,d=S(u,x);u.addEventListener("mouseenter",()=>{t([{elem:u,key:`${d.originalEventName}_${g}`,action:d.action,originalEventName:d.originalEventName,scope:d.scope}])}),u.addEventListener("mouseleave",()=>{t([])});const b=u.dataset.yaScopeoverride;b?y(b,d,a,u):[x,...B(u,"[data-ya-scope]").map(m=>m.dataset.yaScope)].forEach(m=>{y(m||w,d,a,u)})}),c(!0),()=>{document.documentElement.classList.remove("xYextDebug")}),[]),l?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:h,setTooltips:t}):i.jsxRuntimeExports.jsx($,{data:h,setTooltips:t})})]}),i.jsxRuntimeExports.jsx(D,{tooltips:s})]}):null}const C=()=>{const e={};return Object.values(h).forEach(n=>{n.events.forEach(s=>{const{originalEventName:t}=s.eventData;e[t]||(e[t]=[]),!e[t].find(l=>l.el===s.el)&&e[t].push(s)})}),e};function O(e){const{setTooltips:n}=e,[s,t]=p.useState([]),[l,c]=p.useState(""),o=(r,u)=>{s.forEach(a=>a.classList.remove("analytics-event-highlight"));const g=r.map(a=>(a.el.scrollIntoView({behavior:"smooth",block:"nearest"}),a.el.classList.add("analytics-event-highlight"),a.el));t(g),c(u),n(r.map((a,x)=>({elem:a.el,key:`${a.eventData.originalEventName}_${x}`,action:a.eventData.action,originalEventName:a.eventData.originalEventName,scope:a.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(C()).map(([r,u],g)=>{const a=`${r}_${g}`;return i.jsxRuntimeExports.jsx("li",{className:"analytics-debugger-listItem",children:i.jsxRuntimeExports.jsx("button",{className:i.c("analytics-debugger-button",{"is-active":a===l}),onClick:()=>o(u,a),children:r})},a)})})]})}function $(e){const{data:n,setTooltips:s}=e,[t,l]=p.useState(""),c=o=>{const r=n[o];r.scopeEl&&(r.scopeEl.scrollIntoView({behavior:"smooth",block:"nearest"}),l(o),s(r.events.map((u,g)=>{const a=u.eventData;return{elem:u.el,key:`${a.originalEventName}_${g}`,action:a.action,originalEventName:a.originalEventName,scope:a.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,r)=>{if(o!==w)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+r)})})]})}function D(e){const n=p.useRef({});return p.useEffect(()=>{if(n.current)for(const s of Object.values(n.current)){const t=Object.values(n.current).map(l=>l.el).filter(l=>l!==s.el);Y(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 Y(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}`,!!A(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 r=n[o];T(e.el,r)&&(c=!1)}if(c)break}}function T(e,n){const s=e.getBoundingClientRect().top+window.scrollY,t=e.getBoundingClientRect().left,l=s+e.clientHeight,c=t+e.clientWidth,o=n.getBoundingClientRect().top+window.scrollY,r=n.getBoundingClientRect().left,u=o+n.clientHeight,g=r+n.clientWidth,a=(x,d,b,E,m,j,v,f)=>b<=m&&m<=v&&E<=j&&j<=f||b<=x&&x<=v&&E<=d&&d<=f||b<=x&&x<=v&&E<=j&&j<=f||b<=m&&m<=v&&E<=d&&d<=f;return a(t,s,r,o,c,l,g,u)||a(r,o,t,s,g,u,c,l)}function A(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,l=n.clientWidth;let c,o;switch(s){case 0:{o=window.scrollY+e.top-t+"px",c=e.left-l+"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-l+"px";break}case 4:{o=window.scrollY+e.bottom+"px",c=e.left-l+"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-l+"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=R;exports.default=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-BbVj7quu.cjs"),p=require("react"),k=require("react-dom");function N(){return i.getRuntime().name!=="browser"||window.hasOwnProperty("debuggerInitialized")?null:(window.debuggerInitialized=!0,k.createPortal(i.jsxRuntimeExports.jsx(R,{}),document.body))}const S=(e,n)=>{const s=e.dataset.yaAction,t=e.dataset.yaScopeoverride,l=e.dataset.yaEventname,c=t||n;return{action:s,originalEventName:c?`${c}_${l}`:l,scope:c}},B=(e,n)=>{const s=[];let t=e;for(;t!=null&&t.parentElement;)t=t.parentElement.closest(n),t&&s.push(t);return s},h={},w="YA_NO_SCOPE",y=(e,n,s,t)=>{h.hasOwnProperty(e)?h[e].events.map(l=>l.el).includes(t)||(h[e].events=[...h[e].events,{eventData:n,el:t}]):h[e]={scopeEl:s||t,events:[{eventData:n,el:t}]}};function R(){const[e,n]=p.useState(),[s,t]=p.useState([]),[l,c]=p.useState(!1),o=r=>{n(e===r?void 0:r)};return p.useEffect(()=>(document.documentElement.classList.add("xYextDebug"),document.querySelectorAll("[data-ya-eventname]").forEach((u,g)=>{const a=u.closest("[data-ya-scope]"),x=a==null?void 0:a.dataset.yaScope,d=S(u,x);u.addEventListener("mouseenter",()=>{t([{elem:u,key:`${d.originalEventName}_${g}`,action:d.action,originalEventName:d.originalEventName,scope:d.scope}])}),u.addEventListener("mouseleave",()=>{t([])});const b=u.dataset.yaScopeoverride;b?y(b,d,a,u):[x,...B(u,"[data-ya-scope]").map(m=>m.dataset.yaScope)].forEach(m=>{y(m||w,d,a,u)})}),c(!0),()=>{document.documentElement.classList.remove("xYextDebug")}),[]),l?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:h,setTooltips:t}):i.jsxRuntimeExports.jsx($,{data:h,setTooltips:t})})]}),i.jsxRuntimeExports.jsx(D,{tooltips:s})]}):null}const C=()=>{const e={};return Object.values(h).forEach(n=>{n.events.forEach(s=>{const{originalEventName:t}=s.eventData;e[t]||(e[t]=[]),!e[t].find(l=>l.el===s.el)&&e[t].push(s)})}),e};function O(e){const{setTooltips:n}=e,[s,t]=p.useState([]),[l,c]=p.useState(""),o=(r,u)=>{s.forEach(a=>a.classList.remove("analytics-event-highlight"));const g=r.map(a=>(a.el.scrollIntoView({behavior:"smooth",block:"nearest"}),a.el.classList.add("analytics-event-highlight"),a.el));t(g),c(u),n(r.map((a,x)=>({elem:a.el,key:`${a.eventData.originalEventName}_${x}`,action:a.eventData.action,originalEventName:a.eventData.originalEventName,scope:a.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(C()).map(([r,u],g)=>{const a=`${r}_${g}`;return i.jsxRuntimeExports.jsx("li",{className:"analytics-debugger-listItem",children:i.jsxRuntimeExports.jsx("button",{className:i.c("analytics-debugger-button",{"is-active":a===l}),onClick:()=>o(u,a),children:r})},a)})})]})}function $(e){const{data:n,setTooltips:s}=e,[t,l]=p.useState(""),c=o=>{const r=n[o];r.scopeEl&&(r.scopeEl.scrollIntoView({behavior:"smooth",block:"nearest"}),l(o),s(r.events.map((u,g)=>{const a=u.eventData;return{elem:u.el,key:`${a.originalEventName}_${g}`,action:a.action,originalEventName:a.originalEventName,scope:a.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,r)=>{if(o!==w)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+r)})})]})}function D(e){const n=p.useRef({});return p.useEffect(()=>{if(n.current)for(const s of Object.values(n.current)){const t=Object.values(n.current).map(l=>l.el).filter(l=>l!==s.el);Y(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 Y(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}`,!!A(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 r=n[o];T(e.el,r)&&(c=!1)}if(c)break}}function T(e,n){const s=e.getBoundingClientRect().top+window.scrollY,t=e.getBoundingClientRect().left,l=s+e.clientHeight,c=t+e.clientWidth,o=n.getBoundingClientRect().top+window.scrollY,r=n.getBoundingClientRect().left,u=o+n.clientHeight,g=r+n.clientWidth,a=(x,d,b,E,m,j,v,f)=>b<=m&&m<=v&&E<=j&&j<=f||b<=x&&x<=v&&E<=d&&d<=f||b<=x&&x<=v&&E<=j&&j<=f||b<=m&&m<=v&&E<=d&&d<=f;return a(t,s,r,o,c,l,g,u)||a(r,o,t,s,g,u,c,l)}function A(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,l=n.clientWidth;let c,o;switch(s){case 0:{o=window.scrollY+e.top-t+"px",c=e.left-l+"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-l+"px";break}case 4:{o=window.scrollY+e.bottom+"px",c=e.left-l+"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-l+"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=R;exports.default=N;