1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6922],{35910:function(e,s,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/url-discovery-signals",function(){return l(81109)}])},81109:function(e,s,l){"use strict";l.r(s);var t=l(24246),i=l(27378),n=l(73977),r=l(14819);let a={product_page_visit:"Product-page visit",retailer_link_click:"Retailer-link click"};function Stat(e){let{label:s,value:l,sub:i}=e;return(0,t.jsxs)("div",{className:"rounded-lg border border-zinc-200 dark:border-zinc-700 p-4",children:[(0,t.jsx)("div",{className:"text-xs uppercase tracking-wider text-zinc-500",children:s}),(0,t.jsx)("div",{className:"text-2xl font-bold mt-1",children:l}),i&&(0,t.jsx)("div",{className:"text-xs text-zinc-500 mt-0.5",children:i})]})}s.default=function(){var e,s,l,d,c,o,x,h;let{auth:u}=(0,n.XL)(),[m,j]=(0,i.useState)(30),[b,v]=(0,i.useState)(null),[g,N]=(0,i.useState)(!1),[p,f]=(0,i.useState)(null),w=(0,i.useCallback)(async()=>{if(null==u?void 0:u.currentUser){N(!0),f(null);try{let e=await u.currentUser.getIdToken(),s=await fetch("/api/admin/url-discovery-signals?windowDays=".concat(m),{headers:{Authorization:"Bearer ".concat(e)}});if(!s.ok){let e=await s.json().catch(()=>({}));throw Error((null==e?void 0:e.error)||"HTTP ".concat(s.status))}v(await s.json())}catch(e){f(e instanceof Error?e.message:String(e))}finally{N(!1)}}},[u,m]);(0,i.useEffect)(()=>{(null==u?void 0:u.currentUser)&&w()},[null==u?void 0:u.currentUser,w]);let _=null==b?void 0:b.funnel;return(0,t.jsx)(r.B,{title:"URL Discovery",children:(0,t.jsxs)("div",{className:"px-6 py-6 max-w-7xl mx-auto",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold mb-1",children:"Browser-extension URL Discovery"}),(0,t.jsx)("p",{className:"text-sm text-zinc-500 mb-6",children:"Confirmed product-page visits and retailer-link clicks from the extensions, and how many became minable work (refresher / expedition-improvement). URL + retailer only â no user data."}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-3 items-end mb-6",children:[(0,t.jsxs)("label",{className:"flex flex-col text-sm",children:[(0,t.jsx)("span",{className:"text-zinc-600 dark:text-zinc-400 mb-1",children:"Window (days)"}),(0,t.jsxs)("select",{value:m,onChange:e=>j(Number(e.target.value)),className:"border rounded px-2 py-1 bg-white dark:bg-zinc-800",children:[(0,t.jsx)("option",{value:7,children:"7"}),(0,t.jsx)("option",{value:30,children:"30"}),(0,t.jsx)("option",{value:90,children:"90"}),(0,t.jsx)("option",{value:365,children:"365"})]})]}),(0,t.jsx)("button",{onClick:w,className:"border rounded px-3 py-1 text-sm bg-white dark:bg-zinc-800",children:"Refresh"})]}),g&&(0,t.jsx)("div",{className:"text-zinc-500",children:"Loadingâ¦"}),p&&(0,t.jsx)("div",{className:"text-red-600",children:p}),(null==b?void 0:b.tableMissing)&&(0,t.jsx)("div",{className:"text-amber-600",children:"url_discovery_signals table not present yet â run the migration."}),_&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3 mb-8",children:[(0,t.jsx)(Stat,{label:"Signals received",value:(null!==(l=null==b?void 0:null===(e=b.totals)||void 0===e?void 0:e.signals_received_in_window)&&void 0!==l?l:0).toLocaleString(),sub:"".concat((null!==(d=null==b?void 0:null===(s=b.totals)||void 0===s?void 0:s.distinct_urls_in_window)&&void 0!==d?d:0).toLocaleString()," distinct URLs in window")}),(0,t.jsx)(Stat,{label:"Received (all)",value:_.received.toLocaleString(),sub:"distinct confirmed URLs"}),(0,t.jsx)(Stat,{label:"Minable",value:_.minable.toLocaleString(),sub:"crossed kind threshold"}),(0,t.jsx)(Stat,{label:"Enqueued",value:_.enqueued.toLocaleString(),sub:"".concat(_.matched.toLocaleString()," already covered")}),(0,t.jsx)(Stat,{label:"Enqueue rate",value:"".concat((100*_.enqueue_rate).toFixed(1),"%"),sub:"enqueued \xf7 minable"})]}),(0,t.jsxs)("div",{className:"grid md:grid-cols-2 gap-8",children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"font-semibold mb-2",children:"By signal kind"}),(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-zinc-500",children:[(0,t.jsx)("th",{className:"py-1",children:"Kind"}),(0,t.jsx)("th",{children:"URLs"}),(0,t.jsx)("th",{children:"Received"}),(0,t.jsx)("th",{children:"Enqueued"})]})}),(0,t.jsx)("tbody",{children:(null!==(c=null==b?void 0:b.byKind)&&void 0!==c?c:[]).map(e=>{var s;return(0,t.jsxs)("tr",{className:"border-t border-zinc-100 dark:border-zinc-800",children:[(0,t.jsx)("td",{className:"py-1",children:null!==(s=a[e.signal_kind])&&void 0!==s?s:e.signal_kind}
1),(0,t.jsx)("td",{children:e.distinct_urls.toLocaleString()}),(0,t.jsx)("td",{children:e.signals_received.toLocaleString()}),(0,t.jsx)("td",{children:e.enqueued.toLocaleString()})]},e.signal_kind)})})]}),(0,t.jsx)("h2",{className:"font-semibold mb-2 mt-6",children:"By state"}),(0,t.jsx)("table",{className:"w-full text-sm",children:(0,t.jsx)("tbody",{children:(null!==(o=null==b?void 0:b.byState)&&void 0!==o?o:[]).map(e=>(0,t.jsxs)("tr",{className:"border-t border-zinc-100 dark:border-zinc-800",children:[(0,t.jsx)("td",{className:"py-1 font-mono text-xs",children:e.state}),(0,t.jsx)("td",{className:"text-right",children:e.count.toLocaleString()})]},e.state))})})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"font-semibold mb-2",children:"Top retailers (by enqueued)"}),(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-zinc-500",children:[(0,t.jsx)("th",{className:"py-1",children:"Retailer"}),(0,t.jsx)("th",{children:"URLs"}),(0,t.jsx)("th",{children:"Enqueued"}),(0,t.jsx)("th",{children:"No match"})]})}),(0,t.jsx)("tbody",{children:(null!==(x=null==b?void 0:b.byRetailer)&&void 0!==x?x:[]).map(e=>(0,t.jsxs)("tr",{className:"border-t border-zinc-100 dark:border-zinc-800",children:[(0,t.jsx)("td",{className:"py-1",children:e.retailer_identifier}),(0,t.jsx)("td",{children:e.distinct_urls.toLocaleString()}),(0,t.jsx)("td",{children:e.enqueued.toLocaleString()}),(0,t.jsx)("td",{children:e.no_match.toLocaleString()})]},e.retailer_identifier))})]})]})]}),(0,t.jsxs)("section",{className:"mt-8",children:[(0,t.jsx)("h2",{className:"font-semibold mb-2",children:"Recent signals"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-xs",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-zinc-500",children:[(0,t.jsx)("th",{className:"py-1",children:"Kind"}),(0,t.jsx)("th",{children:"Retailer"}),(0,t.jsx)("th",{children:"Seen"}),(0,t.jsx)("th",{children:"State"}),(0,t.jsx)("th",{children:"URL"})]})}),(0,t.jsx)("tbody",{children:(null!==(h=null==b?void 0:b.recentSamples)&&void 0!==h?h:[]).map((e,s)=>{var l;return(0,t.jsxs)("tr",{className:"border-t border-zinc-100 dark:border-zinc-800",children:[(0,t.jsx)("td",{className:"py-1 whitespace-nowrap",children:null!==(l=a[e.signal_kind])&&void 0!==l?l:e.signal_kind}),(0,t.jsx)("td",{className:"whitespace-nowrap",children:e.retailer_identifier}),(0,t.jsx)("td",{children:e.times_seen}),(0,t.jsx)("td",{className:"font-mono whitespace-nowrap",children:e.state}),(0,t.jsx)("td",{className:"font-mono break-all",children:e.cleaned_url})]},s)})})]})})]})]})]})})}}},function(e){e.O(0,[9894,9253,4819,9774,2888,179],function(){return e(e.s=35910)}),_N_E=e.O()}]);
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.