@yext/pages-components 1.0.1 → 1.0.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.
- package/dist/{debugger-DIg74Hi7.js → debugger-C-GK2f4q.js} +1 -1
- package/dist/{debugger-Xi29RTwX.cjs → debugger-DxMCz_HF.cjs} +1 -1
- package/dist/{index-BPyzlGXA.cjs → index-BaREGJWP.cjs} +1 -1
- package/dist/{index-BAeydPvg.js → index-ChSAX9jE.js} +3026 -2993
- package/dist/{index-Cads-eer.cjs → index-LU9eqw2L.cjs} +36 -36
- package/dist/{index-D008ceFk.js → index-zdnlchNT.js} +1 -1
- package/dist/index.d.cts +26 -3
- package/dist/index.d.ts +26 -3
- 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-LU9eqw2L.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,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Tn=require("react"),g=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Tn=require("react"),g=require("./index-LU9eqw2L.cjs");function Zt(n){const t=[];let e=-1;for(;++e<n.footnoteOrder.length;){const r=n.footnoteById[n.footnoteOrder[e]];if(!r)continue;const i=n.all(r),l=String(r.identifier).toUpperCase(),o=g.normalizeUri(l.toLowerCase());let a=0;const h=[];for(;++a<=n.footnoteCounts[l];){const f={type:"element",tagName:"a",properties:{href:"#"+n.clobberPrefix+"fnref-"+o+(a>1?"-"+a:""),dataFootnoteBackref:!0,className:["data-footnote-backref"],ariaLabel:n.footnoteBackLabel},children:[{type:"text",value:"↩"}]};a>1&&f.children.push({type:"element",tagName:"sup",children:[{type:"text",value:String(a)}]}),h.length>0&&h.push({type:"text",value:" "}),h.push(f)}const s=i[i.length-1];if(s&&s.type==="element"&&s.tagName==="p"){const f=s.children[s.children.length-1];f&&f.type==="text"?f.value+=" ":s.children.push({type:"text",value:" "}),s.children.push(...h)}else i.push(...h);const d={type:"element",tagName:"li",properties:{id:n.clobberPrefix+"fn-"+o},children:n.wrap(i,!0)};n.patch(r,d),t.push(d)}if(t.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:n.footnoteLabelTagName,properties:{...JSON.parse(JSON.stringify(n.footnoteLabelProperties)),id:"footnote-label"},children:[{type:"text",value:n.footnoteLabel}]},{type:"text",value:`
|
|
2
2
|
`},{type:"element",tagName:"ol",properties:{},children:n.wrap(t,!0)},{type:"text",value:`
|
|
3
3
|
`}]}}function gt(n,t){const e=g.createState(n,t),r=e.one(n,null),i=Zt(e);return i&&r.children.push({type:"text",value:`
|
|
4
4
|
`},i),Array.isArray(r)?{type:"root",children:r}:r}const nr=function(n,t){return n&&"run"in n?er(n,t):tr(n||t)};function er(n,t){return(e,r,i)=>{n.run(gt(e,t),r,l=>{i(l)})}}function tr(n){return t=>gt(t,n)}const Te=["http","https","mailto","tel"];function yt(n){const t=(n||"").trim(),e=t.charAt(0);if(e==="#"||e==="/")return t;const r=t.indexOf(":");if(r===-1)return t;let i=-1;for(;++i<Te.length;){const l=Te[i];if(r===l.length&&t.slice(0,l.length).toLowerCase()===l)return t}return i=t.indexOf("?"),i!==-1&&r>i||(i=t.indexOf("#"),i!==-1&&r>i)?t:"javascript:void(0)"}/*!
|