PageSourceSearch

https://dishwasherhero.com/assets/admin_.cta-eFcsOEa_.js

js dishwasherhero.com collected 2026-10-08 09:26:52 UTC 11,313 bytes, 1 lines download raw bytes

1import{r as m,j as e}from"./vendor-react-Bn3iFifz.js";import{b as M,c as z,$ as S,g as E,_ as X}from"./AdminLayout-qpWpqcJe.js";import{D as Y}from"./DateRangeSelector-Bv-LPH5W.js";import{K as y}from"./KPICard-BTfe1TJ6.js";import{C as g}from"./ChartCard-CtlMOl9r.js";import{j as w,ai as G,aj as J,ak as Q,al as W,ab as Z,ei as ee,ao as ae,C as te,ac as se}from"./index-LMKgLQmf.js";import{S as ie}from"./StatsTable-Dz0ZdvAs.js";import{A as re}from"./AnalyticsPDFExportButton-1owHS_ki.js";import{a as oe,c as ce}from"./useAdminData-uNMTwJ6R.js";import{u as le}from"./useDateRange-C3qCI22b.js";import{T as ne,a as de,b as P,c as _}from"./tabs-CLFa8E1Z.js";import{g as me,K as he}from"./kpiBenchmarks-Bd7PYff6.js";import{R as k,A as pe,f as R,X as D,Y as L,T as j,a as ge,B as F,b as H,P as ue,i as xe,C as ve,g as ye}from"./vendor-charts-C8i4Xv16.js";import"./useAdminAuth-BdBDAIeC.js";import"./useQuery-CAMDbIxq.js";import"./useServerFn-LfW_N337.js";import"./auth-middleware-DRJ1xBMi.js";import"./permissions-DVGCnSvR.js";import"./useMutation-Gw6jXggV.js";import"./collapsible-D7IpmqIV.js";import"./scroll-area-JVjfFnyi.js";import"./user-plus-BMC4zSVn.js";import"./eye-CoUrAhGq.js";import"./tag-DC3oern2.js";import"./chevron-left-BtEpJRSp.js";import"./heart-pulse-BFWg7M--.js";import"./calendar-CPz4zsJP.js";import"./normalizeInterval-l7SKT_lb.js";import"./crmColorTokens-BwExxk7Y.js";import"./minus-CLIxNHYR.js";import"./ellipsis-CQR6seLO.js";import"./vendor-supabase-DWAMJqcP.js";import"./data-service-areas-BGj_08fK.js";import"./data-role-city-keywords-Bgd_s1R-.js";import"./data-city-geo-CO43tZjK.js";import"./arrow-up-down-D1Z5kJUS.js";import"./vendor-pdf-4jsS3aGa.js";import"./pdfStorageUtils-D-sJeljR.js";import"./file-down-B-LAmaP_.js";const Ce={hero:"Hero Section",hero_cta:"Hero CTA",sticky_header:"Sticky Header",sticky_cta:"Sticky CTA",role_marketplace:"Role Marketplace",business_positions:"Business Positions",pricing:"Pricing Section",pricing_card:"Pricing Card",footer:"Footer",footer_cta:"Footer CTA",navigation:"Navigation",mobile_menu:"Mobile Menu",sidebar:"Sidebar",inline:"Inline CTA",modal:"Modal",banner:"Banner",calculator:"Calculator",coverage_checker:"Coverage Checker"},ke=(l,h)=>{if(h===0)return"bg-muted";const s=l/h;return s>=.8?"bg-primary":s>=.6?"bg-primary/80":s>=.4?"bg-primary/60":s>=.2?"bg-primary/40":s>0?"bg-primary/20":"bg-muted"},je=({data:l,className:h})=>{const s=m.useMemo(()=>Math.max(...l.map(o=>o.clicks),1),[l]),b=m.useMemo(()=>[...l].sort((o,p)=>p.clicks-o.clicks),[l]);return l.length===0?e.jsx("div",{className:w("flex items-center justify-center h-48 text-muted-foreground",h),children:"No location data available"}):e.jsx(G,{children:e.jsx("div",{className:w("grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-2",h),children:b.map(o=>{const p=Ce[o.location]||o.location,f=ke(o.clicks,s),d=(o.clicks/s*100).toFixed(0);return e.jsxs(J,{children:[e.jsx(Q,{asChild:!0,children:e.jsxs("div",{className:w("relative p-4 rounded-lg cursor-pointer transition-all hover:scale-105",f),children:[e.jsx("div",{className:"text-xs font-medium text-foreground truncate",children:p}),e.jsx("div",{className:"text-lg font-bold text-foreground mt-1",children:o.clicks.toLocaleString()})]})}),e.jsx(W,{children:e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium",children:p}),e.jsxs("p",{children:[o.clicks.toLocaleString()," clicks"]}),e.jsxs("p",{className:"text-muted-foreground",children:[d,"% of max"]})]})})]},o.location)})})})},$=["hsl(var(--primary))","hsl(var(--primary) / 0.8)","hsl(var(--primary) / 0.6)","hsl(var(--primary) / 0.4)","hsl(var(--accent))","hsl(var(--muted-foreground))"],be=()=>{const{dateRange:l,setDateRange:h}=le(),{data:s,isLoading:b,error:o}=oe(l),{data:p,isLoading:f}=ce(l),d=b||f,n=m.useMemo(()=>{if(!s||s.length===0)return{totalClicks:0,uniqueSessions:0,avgTimeOnPage:0,topCTA:"N/A",ctaCTR:0};const a=new Set(s.map(r=>r.session_id).filter(Boolean)).size,t=s.map(r=>r.time_on_page_seconds).filter(r=>r!==null),i=t.length>0?Math.round(t.reduce((r,A)=>r+A,0)/t.length):0,u={};s.forEach(r=>{u[r.cta_name]=(u[r.cta_name]??0)+1});const x=Object.entries(u).sort((r,A)=>A[1]-r[1])[0]?.[0]??"N/A",v=p?.length??0,c=v>0?s.length/v*100:0;return{totalClicks:s.length,uniqueSessions:a,avgTimeOnPage:i,topCTA:x,ctaCTR:c}},[s,p]),T=m.useMemo(()=>
1{if(!s)return[];const a={};return s.forEach(t=>{a[t.cta_name]=(a[t.cta_name]??0)+1}),Object.entries(a).map(([t,i])=>({name:t,clicks:i})).sort((t,i)=>i.clicks-t.clicks).slice(0,10)},[s]),C=m.useMemo(()=>{if(!s)return[];const a={};s.forEach(c=>{a[c.cta_location]=(a[c.cta_location]??0)+1});const t=Object.entries(a).map(([c,r])=>({location:c,clicks:r})).sort((c,r)=>r.clicks-c.clicks),i=t.reduce((c,r)=>c+r.clicks,0),u=i*.02,x=t.filter(c=>c.clicks>=u).slice(0,10),v=i-x.reduce((c,r)=>c+r.clicks,0);return v>0&&x.push({location:"Other",clicks:v}),x},[s]),O=m.useMemo(()=>{if(!s)return[];const a={};return s.forEach(t=>{const i=M(z(S(t.created_at)),"yyyy-MM-dd");a[i]=(a[i]??0)+1}),Object.entries(a).map(([t,i])=>({date:t,clicks:i})).sort((t,i)=>t.date.localeCompare(i.date))},[s]),B=m.useMemo(()=>{if(!s)return[];const a={};return s.forEach(t=>{const i=t.page_path||"/";a[i]=(a[i]??0)+1}),Object.entries(a).map(([t,i])=>({page:t,clicks:i})).sort((t,i)=>i.clicks-t.clicks)},[s]),N=m.useMemo(()=>{if(!s)return[];const a={};return s.forEach(t=>{const i=t.device_type||"unknown";a[i]=(a[i]??0)+1}),Object.entries(a).map(([t,i])=>({name:t,value:i}))},[s]),q=[{key:"page",label:"Page Path",sortable:!0},{key:"clicks",label:"Clicks",sortable:!0,render:a=>e.jsx("span",{className:"font-medium",children:a.toLocaleString()})}];if(o)return e.jsx(E,{children:e.jsx("div",{className:"p-8",children:e.jsxs("div",{className:"text-destructive",children:["Error loading CTA analytics: ",o.message]})})});const I=O.length>0,U=T.length>0,V=N.length>0,K=C.length>0;return e.jsx(E,{children:e.jsxs("div",{className:"p-6 lg:p-8 space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"CTA Analytics"}),e.jsx("p",{className:"text-muted-foreground",children:"Track click performance, location heatmaps, and conversion data"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Y,{value:l,onChange:h}),e.jsx(re,{title:"CTA Analytics Report",subtitle:"Click performance, location heatmaps, and conversion data",dateRange:l,disabled:d,metrics:[{label:"Total Clicks",value:n.totalClicks,description:"All CTA clicks"},{label:"CTA CTR",value:`${n.ctaCTR.toFixed(2)}%`,description:"Clicks / page views"},{label:"Unique Sessions",value:n.uniqueSessions,description:"Distinct visitors"},{label:"Avg. Time on Page",value:`${n.avgTimeOnPage}s`,description:"Before click"}],sections:[{title:"Clicks by CTA Name",type:"table",columns:["CTA Name","Clicks"],data:T.map(a=>({"CTA Name":a.name,Clicks:a.clicks}))},{title:"Clicks by Location",type:"table",columns:["Location","Clicks"],data:C.map(a=>({Location:a.location,Clicks:a.clicks}))}]})]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4",children:d?Array.from({length:5}).map((a,t)=>e.jsx(Z,{className:"h-32"},t)):e.jsxs(e.Fragment,{children:[e.jsx(y,{title:"Total Clicks",value:n.totalClicks,icon:e.jsx(X,{className:"h-5 w-5"})}),e.jsx(y,{title:"CTA CTR",value:`${n.ctaCTR.toFixed(2)}%`,icon:e.jsx(ee,{className:"h-5 w-5"}),variant:n.ctaCTR>=3?"success":n.ctaCTR>=2?"default":"warning",subtitle:me(he.ctaCTR)}),e.jsx(y,{title:"Unique Sessions",value:n.uniqueSessions,icon:e.jsx(ae,{className:"h-5 w-5"})}),e.jsx(y,{title:"Avg. Time on Page",value:`${n.avgTimeOnPage}s`,icon:e.jsx(te,{className:"h-5 w-5"})}),e.jsx(y,{title:"Top CTA",value:n.topCTA,icon:e.jsx(se,{className:"h-5 w-5"})})]})}),e.jsxs(ne,{defaultValue:"overview",className:"space-y-6",children:[e.jsxs(de,{children:[e.jsx(P,{value:"overview",children:"Overview"}),e.jsx(P,{value:"heatmap",children:"Location Heatmap"}),e.jsx(P,{value:"pages",children:"By Page"})]}),e.jsx(_,{value:"overview",className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx(g,{title:"Clicks Over Time",subtitle:"Daily CTA click trend",loading:d,empty:!I,emptyMessage:"No click data available",height:"h-72",children:e.jsx(k,{width:"100%",height:"100%",children:e.jsxs(pe,{data:O,children:[e.jsx(R,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(D,{dataKey:"date",tickFormatter:a=>M(S(a),"MMM d"),className:"text-xs"}),e.jsx(L,{className:"text-xs"}),e.jsx(j,{labelFormatter:a=>M(S(a),"MMM d, yyyy"),contentStyle:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))"}}),e.jsx(ge,{type:"monotone",dataKey:"clicks",stroke:"hsl(var(--primary))",fill:"hsl(var(--primary) / 0.2)"})]})})}),e.jsx(g,{title:"Top CTAs by Clicks",subtitle:"Most clicked call-to-actions",loading:d,empty:!U,emptyMessage:"No CTA data available",height:"h-72",children:e.jsx(k,{width:"100%",height:"100%",children:e.jsxs(F,{data:T,layout:"vertical",children:[e.jsx(R,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(D,{type:"number",className:"text-xs"}),e.jsx(L,{type:"category",dataKey:"name",width:120,tick:{fontSize:12}}),e.jsx(j,{contentStyle:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))"}}),e.jsx(H,{dataKey:"clicks",fill:"hsl(var(--primary))",radius:[0,4,4,0]})]})})}),e.jsx(g,{title:"Device Breakdown",subtitle:"Clicks by device type",loading:d,empty:!V,emptyMessage:"No device data available",height:"h-72",children:e.jsx(k,{width:"100%",height:"100%",children:e.jsxs(ue,{children:[e.jsx(xe,{data:N,cx:"50%",cy:"50%",innerRadius:60,outerRadius:100,paddingAngle:5,dataKey:"value",nameKey:"name",label:({name:a,percent:t})=>`${a} (${(t*100).toFixed(0)}%)`,children:N.map((a,t)=>e.jsx(ve,{fill:$[t%$.length]},`cell-${t}`))}),e.jsx(j,{contentStyle:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))"}}),e.jsx(ye,{})]})})}),e.jsx(g,{title:"Clicks by Location",subtitle:"Distribution across page sections",loading:d,empty:!K,emptyMessage:"No location data available",height:"h-72",children:e.jsx(k,{width:"100%",height:"100%",children:e.jsxs(F,{data:C,layout:"vertical",children:[e.jsx(R,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(D,{type:"number",className:"text-xs"}),e.jsx(L,{type:"category",dataKey:"location",width:120,tick:{fontSize:12}}),e.jsx(j,{contentStyle:{backgroundColor:"hsl(var(--card))",borderColor:"hsl(var(--border))"}}),e.jsx(H,{dataKey:"clicks",fill:"hsl(var(--primary))",radius:[0,4,4,0]})]})})})]})}),e.jsx(_,{value:"heatmap",children:e.jsx(g,{title:"Location Heatmap",subtitle:"Visual representation of click distribution across page sections. Darker colors indicate higher click volumes.",loading:d,empty:!K,emptyMessage:"No location data available",height:"h-auto",children:e.jsx(je,{data:C})})}),e.jsx(_,{value:"pages",children:e.jsx(g,{title:"CTA Clicks by Page",subt
1itle:"See which pages are driving the most CTA engagement",loading:d,empty:B.length===0,emptyMessage:"No page data available",height:"h-auto",children:e.jsx(ie,{data:B,columns:q,searchable:!0,searchPlaceholder:"Search pages...",exportable:!0,exportFilename:"cta-clicks-by-page"})})})]})]})})},la=be;export{la as component};

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.