PageSourceSearch

https://www.axelerant.com/assets/admin.seo-insights-Bq0aeAc5.js

js axelerant.com collected 2026-10-02 02:35:31 UTC 18,786 bytes, 2 lines download raw bytes

1import{m as N,q as v,n as w,r as b,s as S,j as e}from"./index-CtZS8l_c.js";import{u as j}from"./useServerFn-DVDx7IUv.js";import{supabase as k}from"./client-BqOr-40p.js";import{l as M}from"./index-ChtZSsW2.js";import"./tslib.es6-DbC5Ml5T.js";const D=N({method:"POST"}).middleware([v]).handler(w("8d04c17a34a1dc7be2a4310ef570a9e96efa3ee5e6bb8d8def00e9d064908992")),B=N({method:"POST"}).middleware([v]).handler(w("09bdbe99c3ea346b84e8accc795f7c82e1b70332d30663c702f6cbab8fad318a")),H=N({method:"POST"}).middleware([v]).handler(w("3653458763209792cdd8c561e46458ed2b096a8d85ff0284ad773df64bc85c30")),G=N({method:"POST"}).middleware([v]).handler(w("333590c44ddf6d779d52f07c6bd304812cc35f8b25833247a0e5abf973cc566b")),K=N({method:"POST"}).middleware([v]).handler(w("33706e1fa9d6a0a275855050f1a3a312ec37a2314d580cf51dfdfc8c9be11711"));function g(s){return s==null?"—":new Intl.NumberFormat("en-US").format(Math.round(s))}function A(s){return s==null?"—":`${(s*100).toFixed(2)}%`}function O(s){return s==null||s===0?"—":s.toFixed(1)}function Q(s,n){if(!n)return{text:s?"new":"—",tone:"neutral"};const t=(s-n)/n*100,r=t>1?"up":t<-1?"down":"neutral";return{text:`${t>=0?"+":""}${t.toFixed(1)}%`,tone:r}}function ie(){const[s,n]=b.useState(null),[t,r]=b.useState("28d");b.useEffect(()=>{k.auth.getSession().then(({data:a})=>n(a.session));const{data:d}=k.auth.onAuthStateChange((a,x)=>n(x));return()=>d.subscription.unsubscribe()},[]);const o=s?.user?.email??"",p=o.toLowerCase().endsWith("@axelerant.com"),m=!!s&&p,h=j(D),l=j(B),c=S({queryKey:["seo-insights",t],queryFn:()=>h({data:{range:t}}),enabled:m,staleTime:300*1e3}),u=S({queryKey:["seo-alerts"],queryFn:()=>l({data:{}}),enabled:m,staleTime:300*1e3,refetchInterval:900*1e3});return e.jsx("div",{className:"min-h-screen bg-paper",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-6 py-16",children:[e.jsxs("div",{className:"mb-10 flex items-start justify-between gap-6 flex-wrap",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wider text-onyx/60",children:"Internal"}),e.jsx("h1",{className:"mt-2 font-display text-4xl font-semibold text-onyx",children:"SEO insights"}),e.jsx("p",{className:"mt-3 text-onyx/70 max-w-2xl",children:"Search Console performance, indexing status, and week-over-week alerts for axelerant.com. Refreshes live from the connected property."})]}),m&&e.jsx("div",{className:"flex items-center gap-2",children:["28d","90d"].map(d=>e.jsxs("button",{type:"button",onClick:()=>r(d),className:`rounded border px-3 py-1.5 text-xs font-medium transition-colors ${t===d?"bg-onyx text-paper border-onyx":"border-onyx/20 text-onyx hover:border-onyx"}`,children:["Last ",d==="28d"?"28":"90"," days"]},d))})]}),!s&&e.jsx(Y,{onSignIn:()=>M.auth.signInWithOAuth("google",{redirect_uri:`${window.location.origin}/admin/seo-insights`})}),s&&!p&&e.jsxs("div",{className:"rounded border border-vermilion/40 bg-vermilion/5 p-5 text-sm text-onyx",children:["You are signed in as ",e.jsx("strong",{children:o}),". Only @axelerant.com accounts can view SEO insights."]}),m&&e.jsxs(e.Fragment,{children:[e.jsx(J,{loading:u.isLoading,error:u.error,data:u.data,onRefresh:()=>u.refetch()}),e.jsxs("div",{className:"mt-10",children:[e.jsx(z,{title:`Performance, last ${t==="28d"?"28":"90"} days`,subtitle:c.data?.siteUrl}),c.isLoading&&e.jsx(_,{}),c.error&&e.jsx(C,{error:c.error}),c.data&&e.jsx(V,{data:c.data}),c.data&&e.jsx(X,{daily:c.data.daily})]}),e.jsxs("div",{className:"mt-10 grid gap-8 md:grid-cols-2",children:[c.data&&e.jsx(L,{title:"Top queries",rows:c.data.queries,kind:"query"}),c.data&&e.jsx(L,{title:"Top pages",rows:c.data.pages,kind:"page"})]}),e.jsxs("p",{className:"mt-10 text-xs text-onyx/60",children:["Signed in as ",o,". ",e.jsx("button",{className:"underline hover:text-vermilion",onClick:()=>k.auth.signOut(),children:"Sign out"})]})]})]})})}function Y({onSignIn:s}){return e.jsxs("div",{className:"rounded border border-onyx/20 bg-white p-6 flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-sm text-onyx/70",children:"Sign in with your Axelerant Google account to view Search Console insights."}),e.jsx("button",{type:"button",onClick:s,className:"rounded bg-onyx px-4 py-2 text-xs font-medium text-paper hover:bg-vermilion transition-colors",children:"Sign in with Google"})]})}function z({title:s,subtitle:n}){return e.jsxs("div",{className:"mb-4 flex items-baseline justify-between gap-4",children:[e.jsx("h2",{className:"font-display text-2xl font-semibold text-onyx",children:s}),n&&e.jsx("span",{className:"font-mono text-[11px] text-onyx/60",children:n})]})}function _(){return e.jsx("div",{className:"h-24 animate-pulse rounded border border-onyx/10 bg-white"})}function C({error:s}){return e.jsx("div",{className:"rounded border border-vermilion/40 bg-vermilion/5 p-4 text-sm text-onyx",children:s instanceof Error?s.message:"Something went wrong."})}function J({loading:s,error:n,data:t,onRefresh:r}){return e.jsxs("section",{className:"rounded border border-onyx/15 bg-white p-6",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-display text-xl font-semibold text-onyx",children:"Monitoring alerts"}),e.jsx("p",{className:"mt-1 text-xs text-onyx/60",children:"Sitemap indexing, crawl errors, and significant WoW ranking/query changes. Auto-refreshes every 15 minutes."})]}),e.jsx("button",{type:"button",onClick:r,className:"rounded border border-onyx/20 px-3 py-1.5 text-xs font-medium text-onyx hover:bg-onyx hover:text-paper transition-colors",children:"Refresh"})]}),s&&e.jsx(_,{}),n?e.jsx(C,{error:n}):null,t&&t.alerts.length===0&&e.jsx("div",{className:"rounded border border-emerald-500/30 bg-emerald-500/5 p-4 text-sm text-onyx",children:"All clear. No sitemap errors, no significant WoW drops, no top-query ranking losses."}),t&&t.alerts.length>0&&e.jsx("ul",{className:"space-y-3",children:t.alerts.map(o=>e.jsx(Z,{alert:o,siteUrl:t.siteUrl},o.id))}),t&&e.jsxs("div",{className:"mt-6 grid gap-4 sm:grid-cols-2",children:[e.jsx(I,{label:"Clicks, 7d vs prior 7d",cur:t.wow.clicks.current,prev:t.wow.clicks.previous,delta:t.wow.clicks.deltaPct}),e.jsx(I,{label:"Impressions, 7d vs prior 7d",cur:t.wow.impressions.current,prev:t.wow.impressions.previous,delta:t.wow.impressions.deltaPct})]})]})}function I({label:s,cur:n,prev:t,delta:r}){const o=r>1?"text-emerald-700":r<-1?"text-vermilion":"text-onyx/70";return e.jsxs("div",{className:"rounded border border-onyx/10 bg-paper-dim p-4",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wider text-onyx/60",children:s}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-3",children:[e.jsx("p",{className:"font-display text-2xl font-semibold text-onyx",children:g(n)}),e.jsxs("p",{className:`text-xs font-medium ${o}`,children:[r>=0?"+":"",r.toFixed(1),"% vs ",g(t)]})]})]})}function V({data:s}){const n=[{label:"Clicks",cur:s.totals.clicks??0,prev:s.previous.clicks??0,fmt:g},{label:"Impressions",cur:s.totals.impressions??0,prev:s.previous.impressions??0,fmt:g},{label:"CTR",cur:s.totals.ctr??0,prev:s.previous.ctr??0,fmt:A},{label:"Avg. position",cur:s.totals.position??0,prev:s.previous.position??0,fmt:O,invert:!0}];return e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:n.map(t=>{const r=Q(t.cur,t.prev),o=t.invert?r.tone==="up"?"text-vermilion":r.tone==="down"?"text-emerald-700":"text-onyx/60":r.tone==="up"?"text-emerald-700":r.tone==="down"?"text-vermilion":"text-onyx/60";return e.jsxs("div",{className:"brads rounded border border-onyx/15 bg-white p-5",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wider text-onyx/60",children:t.label}),e.jsx("p",{className:"mt-2 font-display text-3xl font-semibold text-onyx",children:t.fmt(t.cur)}),e.jsxs("p",{className:`mt-2 text-xs font-medium ${o}`,children:[r.text," vs prior period"]})]},t.label)})})}function X({daily:s}){const n=b.useMemo(()=>s.map(l=>({date:l.keys[0],clicks:l.clicks??0,impressions:l.impressions??0}
1)).sort((l,c)=>l.date.localeCompare(c.date)),[s]);if(!n.length)return null;const t=Math.max(1,...n.map(l=>l.clicks)),r=Math.max(1,...n.map(l=>l.impressions)),o=720,p=160,m=n.length>1?o/(n.length-1):o,h=(l,c)=>l.map((u,d)=>{const a=d*m,x=p-u/c*(p-10)-4;return`${d===0?"M":"L"}${a.toFixed(1)},${x.toFixed(1)}`}).join(" ");return e.jsxs("div",{className:"mt-4 brads rounded border border-onyx/15 bg-white p-5",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-4 text-xs text-onyx/70",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-vermilion"})," Clicks"]}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-onyx/50"})," Impressions"]})]}),e.jsxs("svg",{viewBox:`0 0 ${o} ${p}`,className:"w-full h-40",preserveAspectRatio:"none",children:[e.jsx("path",{d:h(n.map(l=>l.impressions),r),fill:"none",stroke:"rgb(0 0 0 / 0.35)",strokeWidth:"1.5"}),e.jsx("path",{d:h(n.map(l=>l.clicks),t),fill:"none",stroke:"#F25A02",strokeWidth:"2"})]}),e.jsxs("div",{className:"mt-2 flex justify-between text-[10px] font-mono text-onyx/60",children:[e.jsx("span",{children:n[0]?.date}),e.jsx("span",{children:n[n.length-1]?.date})]})]})}function L({title:s,rows:n,kind:t}){return n?.length?e.jsxs("div",{className:"brads rounded border border-onyx/15 bg-white overflow-hidden",children:[e.jsx("div",{className:"border-b border-onyx/10 px-5 py-3",children:e.jsx("h3",{className:"font-display text-lg font-semibold text-onyx",children:s})}),e.jsx("div",{className:"max-h-[420px] overflow-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"text-[10px] uppercase tracking-wider text-onyx/60 bg-paper-dim",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2 text-left font-medium",children:t==="query"?"Query":"Page"}),e.jsx("th",{className:"px-4 py-2 text-right font-medium",children:"Clicks"}),e.jsx("th",{className:"px-4 py-2 text-right font-medium",children:"Impr."}),e.jsx("th",{className:"px-4 py-2 text-right font-medium",children:"CTR"}),e.jsx("th",{className:"px-4 py-2 text-right font-medium",children:"Pos."})]})}),e.jsx("tbody",{children:n.map((r,o)=>e.jsxs("tr",{className:"border-t border-onyx/5",children:[e.jsx("td",{className:"px-4 py-2 text-onyx/85 max-w-[260px] truncate",title:r.keys[0],children:t==="page"?e.jsx("a",{href:r.keys[0],target:"_blank",rel:"noreferrer",className:"hover:text-vermilion underline underline-offset-2",children:r.keys[0].replace(/^https?:\/\/[^/]+/,"")}):r.keys[0]}),e.jsx("td",{className:"px-4 py-2 text-right font-mono text-onyx",children:g(r.clicks)}),e.jsx("td",{className:"px-4 py-2 text-right font-mono text-onyx/70",children:g(r.impressions)}),e.jsx("td",{className:"px-4 py-2 text-right font-mono text-onyx/70",children:A(r.ctr)}),e.jsx("td",{className:"px-4 py-2 text-right font-mono text-onyx/70",children:O(r.position)})]},r.keys[0]+o))})]})})]}):null}function Z({alert:s,siteUrl:n}){const[t,r]=b.useState(!1),[o,p]=b.useState(null),[m,h]=b.useState(null),l=j(H),c=j(G),u=j(K),d=S({queryKey:["seo-alert-detail",s.kind,s.subject],queryFn:()=>l({data:{kind:s.kind,subject:s.subject}}),enabled:t,staleTime:300*1e3}),a=d.data,x=a&&"sitemap"in a?a.sitemap:void 0,f=a&&"pages"in a?a.pages:void 0,y=a&&"page"in a?a.page:void 0,F=a&&"pageLosers"in a?a.pageLosers:void 0,T=a&&"queryLosers"in a?a.queryLosers:void 0;async function q(i,U,W){p(i),h(null);try{await U(),h({tone:"ok",text:W})}catch($){h({tone:"bad",text:$ instanceof Error?$.message:"That did not work."})}finally{p(null)}}const P="https://search.google.com/search-console",E=s.kind==="rank_loss"?`${P}/performance/search-analytics?resource_id=${encodeURIComponent(n)}&query=*${encodeURIComponent(s.subject)}`:`${P}/sitemaps?resource_id=${encodeURIComponent(n)}`;return e.jsxs("li",{className:`rounded border text-sm ${s.severity==="high"?"border-vermilion/40 bg-vermilion/5":s.severity==="medium"?"border-amber-500/40 bg-amber-500/5":"border-onyx/20 bg-paper-dim"}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 p-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium text-onyx",children:s.title}),e.jsx("p",{className:"mt-1 text-onyx/70",children:s.detail}),s.evidence.length>0&&e.jsx("dl",{className:"mt-3 flex flex-wrap gap-x-6 gap-y-1 text-xs text-onyx/70",children:s.evidence.map(i=>e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("dt",{className:"uppercase tracking-wider text-onyx/55",children:i.label}),e.jsx("dd",{className:"font-mono text-onyx",children:i.value})]},i.label+i.value))})]}),e.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wider text-onyx/60",children:s.severity})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t border-onyx/10 px-4 py-3",children:[e.jsx("button",{type:"button",onClick:()=>r(i=>!i),className:"rounded border border-onyx/25 px-2.5 py-1 text-xs font-medium text-onyx hover:bg-onyx hover:text-paper transition-colors",children:t?"Hide diagnosis":"Diagnose"}),s.actions.includes("resubmit_sitemap")&&e.jsx("button",{type:"button",disabled:o==="resubmit",onClick:()=>q("resubmit",()=>c({data:{sitemapPath:s.subject}}),"Sitemap resubmitted to Search Console. Recrawl usually lands within a day."),className:"rounded bg-onyx px-2.5 py-1 text-xs font-medium text-paper hover:bg-vermilion transition-colors disabled:opacity-50",children:o==="resubmit"?"Resubmitting...":"Resubmit sitemap"}),s.actions.includes("draft_fix")&&e.jsx("button",{type:"button",disabled:o==="fix"||!f?.length,title:f?.length?void 0:"Open the diagnosis first so the affected page is known",onClick:()=>q("fix",()=>u({data:{url:f[0].page,query:s.subject}}),"Fix drafted into the content decay queue. Review it at /admin/content-decay."),className:"rounded bg-onyx px-2.5 py-1 text-xs font-medium text-paper hover:bg-vermilion transition-colors disabled:opacity-50",children:o==="fix"?"Drafting the fix...":"Draft the fix"}),e.jsx("a",{href:E,target:"_blank",rel:"noreferrer",className:"rounded border border-onyx/25 px-2.5 py-1 text-xs font-medium text-onyx hover:bg-onyx hover:text-paper transition-colors",children:"Open in Search Console"}),m&&e.jsx("span",{className:`text-xs ${m.tone==="ok"?"text-emerald-700":"text-vermilion"}`,children:m.text})]}),t&&e.jsxs("div",{className:"border-t border-onyx/10 bg-white/70 px-4 py-4 text-xs",children:[d.isLoading&&e.jsx("p",{className:"text-onyx/60",children:"Pulling the detail from Search Console and the live site..."}),d.error?e.jsx(C,{error:d.error}):null,x&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-onyx/70",children:["Fetched ",e.jsx("a",{className:"underline",href:x.sitemapUrl,target:"_blank",rel:"noreferrer",children:x.sitemapUrl})," ","(HTTP ",x.fetchStatus,"), ",x.entryCount," ",x.isIndex?"child sitemaps":"URLs"," listed,"," ",x.checkedCount," checked, ",x.okCount," returning 200."]}),x.problems.length===0?e.jsx("p",{className:"text-emerald-700",children:"Every checked entry returns 200. The Search Console error is likely historical: resubmit to clear it."}):e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"text-[10px] uppercase tracking-wider text-onyx/60",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-1 text-left font-medium",children:"Entry"}),e.jsx("th",{className:"py-1 text-right font-medium",children:"Status"}),e.jsx("th",{className:"py-1 text-left font-medium pl-4",children:"Redirects to"})]})}),e.jsx("tbody",{children:x.problems.map(i=>e.jsxs("tr",{className:"border-t border-onyx/10",children:[e.jsx("td",{className:"py-1 pr-3 break-all text-onyx/85",children:i.loc}),e.jsx("td",{className:"py-1 text-right font-mono text-vermilion",children:i.status||"fail"}),e.jsx("td",{className:"py-1 pl-4 break-all text-onyx/60",children:"redirectsTo"in i?i.redirectsTo:""})]},i.loc))})]})]}),f&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"text-[10px] uppercase tracking-wider text-onyx/60",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-1 text-left font-medium",children:"Page ranking for this query"}),e.jsx("th",{className:"py-1 text-right font-medium",children:"Clicks"}),e.jsx("th",{className:"py-1 text-right font-medium",children:"Impr."}),e.jsx("th",{className:"py-1 text-right font-medium",children:"Position"})]})}),e.jsx("tbody",{children:f.map(i=>e.jsxs("tr",{className:"border-t border-onyx/10",children:[e.jsx("td",{className:"py-1 pr-3 break-all text-onyx/85",children:e.jsx("a",{className:"underline",href:i.page,target:"_blank",rel:"noreferrer",children:i.page.replace(/^https?:\/\/[^/]+/,"")})}),e.jsxs("td",{className:"py-1 text-right font-mono text-onyx",children:[i.clicks," ",e.jsxs("span",{className:"text-onyx/50",children:["from ",i.prevClicks]})]}),e.jsxs("td",{className:"py-1 text-right font-mono text-onyx/70",children:[i.impressions," ",e.jsxs("span",{className:"text-onyx/50",children:["from ",i.prevImpressions]})]}),e.jsxs("td",{className:"py-1 text-right font-mono text-onyx/70",children:[i.position.toFixed(1)," ",e.jsxs("span",{className:"text-onyx/50",children:["from ",i.prevPosition.toFixed(1)]})]})]},i.page))})]}),y&&e.jsxs("div",{className:"rounded border border-onyx/15 bg-paper-dim p-3",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wider text-onyx/60",children:"Live page check"}),e.jsxs("p",{className:"mt-1 text-onyx/85",children:["Title: ",y.title??"missing"]}),e.jsxs("p",{className:"mt-0.5 text-onyx/85",children:["Meta description: ",y.metaDescription??"missing"]}),e.jsxs("p",{className:"mt-0.5 text-onyx/70",children:["HTTP ",y.status,", ",y.h1Count," h1 ",y.h1Count===1?"heading":"headings",y.h1Count!==1?" (should be exactly one)":""]})]})]}),(F||T)&&e.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[e.jsx(R,{title:"Pages losing the most",rows:F??[]}),e.jsx(R,{title:"Queries losing the most",rows:T??[]})]})]})]})}function R({title:s,rows:n}){return n.length?e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wider text-onyx/60",children:s}),e.jsx("ul",{className:"mt-2 space-y-1",children:n.map(t=>e.jsxs("li",{className:"flex items-baseline justify-between gap-3 border-b border-onyx/5 pb-1",children:[e.jsx("span",{className:"min-w-0 break-all text-onyx/85",children:t.key.replace(/^https?:\/\/[^/]+/,"")}),e.jsxs("span",{className:"shrink-0 font-mono text-vermilion",children:[t.delta," ",e.jsxs("span",{className:"text-onyx/50",children:["(",t.before," to ",t.after,")"]})]})]},t.key))})]}):null}export{ie as component};
2//# sourceMappingURL=admin.seo-insights-Bq0aeAc5.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.