@yext/pages-components 1.0.2 → 1.0.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.
- package/dist/{debugger-C-GK2f4q.js → debugger-Bs6mU3Vj.js} +1 -1
- package/dist/{debugger-DxMCz_HF.cjs → debugger-D4yFabmm.cjs} +1 -1
- package/dist/{index-zdnlchNT.js → index-D2DTKjQt.js} +3 -3
- package/dist/{index-ChSAX9jE.js → index-DINajhKX.js} +3383 -3836
- package/dist/{index-LU9eqw2L.cjs → index-Eb3ckUJC.cjs} +54 -52
- package/dist/{index-BaREGJWP.cjs → index-Hfn6D19v.cjs} +2 -2
- package/dist/index.d.cts +369 -1
- package/dist/index.d.ts +369 -1
- package/dist/pages-components.cjs +1 -1
- package/dist/pages-components.js +48 -32
- package/package.json +4 -4
|
@@ -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-Eb3ckUJC.cjs"),x=require("react"),N=require("react-dom");function k(){return i.getRuntime().name!=="browser"||window.hasOwnProperty("debuggerInitialized")?null:(window.debuggerInitialized=!0,N.createPortal(i.jsxRuntimeExports.jsx(w,{}),document.body))}const S=(e,n)=>{const s=e.dataset.yaAction,t=e.dataset.yaScopeoverride,c=e.dataset.yaEventname,a=t||n;return{action:s,originalEventName:a?`${a}_${c}`:c,scope:a}},C=(e,n)=>{const s=[];let t=e;for(;t!=null&&t.parentElement;)t=t.parentElement.closest(n),t&&s.push(t);return s},m={},R="YA_NO_SCOPE",y=(e,n,s,t)=>{m.hasOwnProperty(e)?m[e].events.map(c=>c.el).includes(t)||(m[e].events=[...m[e].events,{eventData:n,el:t}]):m[e]={scopeEl:s||t,events:[{eventData:n,el:t}]}};function w(){const[e,n]=x.useState(),[s,t]=x.useState([]),[c,a]=x.useState(!1),o=l=>{n(e===l?void 0:l)};return x.useEffect(()=>(document.documentElement.classList.add("xYextDebug"),document.querySelectorAll("[data-ya-eventname]").forEach((r,d)=>{const u=r.closest("[data-ya-scope]"),v=u==null?void 0:u.dataset.yaScope,g=S(r,v);r.addEventListener("mouseenter",()=>{t([{elem:r,key:`${g.originalEventName}_${d}`,action:g.action,originalEventName:g.originalEventName,scope:g.scope}])}),r.addEventListener("mouseleave",()=>{t([])});const b=r.dataset.yaScopeoverride;b?y(b,g,u,r):[v,...C(r,"[data-ya-scope]").map(p=>p.dataset.yaScope)].forEach(p=>{y(p||R,g,u,r)})}),a(!0),()=>{document.documentElement.classList.remove("xYextDebug")}),[]),c?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:m,setTooltips:t}):i.jsxRuntimeExports.jsx(Y,{data:m,setTooltips:t})})]}),i.jsxRuntimeExports.jsx(T,{tooltips:s})]}):null}const B=()=>{const e=[];return Object.entries(m).map(([n,s])=>s.events.map(t=>{e.map(c=>c.eventData.originalEventName).includes(t.eventData.originalEventName)||e.push(t)})),e};function O(e){const{setTooltips:n}=e,[s,t]=x.useState(),[c,a]=x.useState(""),o=(l,r,d)=>{l.scrollIntoView({behavior:"smooth",block:"nearest"}),s&&s.classList.remove("analytics-event-highlight"),t(l),l.classList.add("analytics-event-highlight"),a(d),n([{elem:l,key:d,action:r.action,originalEventName:r.originalEventName,scope:r.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:B().map((l,r)=>{const d=l.eventData,u=`${d.originalEventName}_${r}`;return i.jsxRuntimeExports.jsx("li",{className:"analytics-debugger-listItem",children:i.jsxRuntimeExports.jsx("button",{className:i.c("analytics-debugger-button",{"is-active":u===c}),onClick:()=>o(l.el,d,u),children:d.originalEventName})},u)})})]})}function Y(e){const{data:n,setTooltips:s}=e,[t,c]=x.useState(""),a=o=>{const l=n[o];l.scopeEl&&(l.scopeEl.scrollIntoView({behavior:"smooth",block:"nearest"}),c(o),s(l.events.map((r,d)=>{const u=r.eventData;return{elem:r.el,key:`${u.originalEventName}_${d}`,action:u.action,originalEventName:u.originalEventName,scope:u.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,l)=>{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:()=>a(o),children:o})},o+l)})})]})}function T(e){const n=x.useRef({});return x.useEffect(()=>{if(n.current)for(const s of Object.values(n.current)){const t=Object.values(n.current).map(c=>c.el).filter(c=>c!==s.el);$(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 $(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 a=!0;for(let o=0;o<n.length;o++){const l=n[o];D(e.el,l)&&(a=!1)}if(a)break}}function D(e,n){const s=e.getBoundingClientRect().top+window.scrollY,t=e.getBoundingClientRect().left,c=s+e.clientHeight,a=t+e.clientWidth,o=n.getBoundingClientRect().top+window.scrollY,l=n.getBoundingClientRect().left,r=o+n.clientHeight,d=l+n.clientWidth,u=(v,g,b,h,p,j,E,f)=>b<=p&&p<=E&&h<=j&&j<=f||b<=v&&v<=E&&h<=g&&g<=f||b<=v&&v<=E&&h<=j&&j<=f||b<=p&&p<=E&&h<=g&&g<=f;return u(t,s,l,o,a,c,d,r)||u(l,o,t,s,d,r,a,c)}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,c=n.clientWidth;let a,o;switch(s){case 0:{o=window.scrollY+e.top-t+"px",a=e.left-c+"px";break}case 1:{o=window.scrollY+e.top-t+"px",a=e.left+"px";break}case 2:{o=window.scrollY+e.top-t+"px",a=e.right+"px";break}case 3:{o=window.scrollY+e.top-t+"px",a=e.right-c+"px";break}case 4:{o=window.scrollY+e.bottom+"px",a=e.left-c+"px";break}case 5:{o=window.scrollY+e.bottom+"px",a=e.left+"px";break}case 6:{o=window.scrollY+e.bottom+"px",a=e.right-c+"px";break}case 7:{o=window.scrollY+e.bottom+"px",a=e.right+"px";break}default:o=0,a=0}return{top:o,left:a}}exports.AnalyticsDebuggerInternal=w;exports.default=k;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _n from "react";
|
|
2
|
-
import { n as sr, a as cr, b as Nn, m as K, d as B, s as On, p as bn, r as Ce, e as Me, f as Cn, h as En, i as he, k as fr, l as pr, o as
|
|
2
|
+
import { n as sr, a as cr, b as Nn, m as K, d as B, s as On, p as bn, r as Ce, e as Me, f as Cn, h as En, i as he, k as fr, l as pr, o as de, q as hr, t as xn, u as dr, v as mr } from "./index-DINajhKX.js";
|
|
3
3
|
function gr(n) {
|
|
4
4
|
const t = [];
|
|
5
5
|
let e = -1;
|
|
@@ -5745,8 +5745,8 @@ function Oo(n, t, e, r) {
|
|
|
5745
5745
|
const d = nr(n, t);
|
|
5746
5746
|
(o === "ol" || o === "ul") && n.listDepth--, n.schema = l;
|
|
5747
5747
|
const f = t.position || {
|
|
5748
|
-
start: { line: null, column: null
|
|
5749
|
-
end: { line: null, column: null
|
|
5748
|
+
start: { line: null, column: null },
|
|
5749
|
+
end: { line: null, column: null }
|
|
5750
5750
|
}, g = i.components && ve.call(i.components, o) ? i.components[o] : o, p = typeof g == "string" || g === _n.Fragment;
|
|
5751
5751
|
if (!ao.isValidElementType(g))
|
|
5752
5752
|
throw new TypeError(
|