PageSourceSearch

https://prmtr.ai/assets/Sessions-BmPXzBpP.js

js prmtr.ai collected 2026-10-05 14:05:45 UTC 25,410 bytes, 1 lines download raw bytes

1import{n as f,r as d,j as e,L as A}from"./app-CbTY1FG7.js";import{P as Z}from"./PageHeader-vTeOQwaA.js";const b="https://meama-prmtr-production.up.railway.app";async function ee(s="30d"){const i=await f(`${b}/api/v1/sessions/overview?range=${s}`);if(!i.ok)throw new Error(`Sessions overview: ${i.status}`);return i.json()}async function te(s="30d"){const i=await f(`${b}/api/v1/sessions/abandonment?range=${s}`);if(!i.ok)throw new Error(`Abandonment: ${i.status}`);return i.json()}async function ne(s="30d"){const i=await f(`${b}/api/v1/sessions/page-journey?range=${s}`);if(!i.ok)throw new Error(`Page journey: ${i.status}`);return i.json()}async function se(s){const i=await f(`${b}/api/v1/sessions/page-journey/${encodeURIComponent(s)}`);if(!i.ok)throw new Error(`Session journey: ${i.status}`);return i.json()}async function re(){const s=await f(`${b}/api/v1/sessions/insights`);if(!s.ok)throw new Error(`Session insights: ${s.status}`);return s.json()}async function q(s,i){const r=await f(`${b}/api/v1/sessions/insights/${encodeURIComponent(s)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Error(`Insight feedback: ${r.status}`)}const t={bg:"var(--gray-50)",card:"var(--gray-0)",line:"var(--gray-200)",lineSoft:"var(--gray-100)",ink:"var(--gray-900)",muted:"var(--gray-400)",muted2:"var(--gray-500)",green:"var(--green-600)",greenBg:"var(--green-50)",greenBar:"var(--green-500)",amber:"var(--warning-600)",amberBar:"var(--warning-500)",red:"var(--danger-600)",redBg:"var(--danger-50)",chipLine:"var(--gray-300)"};function S(s){const i=Math.floor(s/60),r=s%60;return`${i}:${String(r).padStart(2,"0")}`}function E(s){return`${(s*100).toFixed(1)}%`}function x(s){return s.toLocaleString("en-US")}function oe(s){return s>=1e3?`₾${(s/1e3).toFixed(0)}k`:`₾${s.toFixed(0)}`}function L(s){if(!s)return"—";const i=Date.now()-new Date(s).getTime(),r=Math.floor(i/6e4);if(r<60)return`${r}m ago`;const g=Math.floor(r/60);return g<24?`${g}h ago`:`${Math.floor(g/24)}d ago`}function U(s){return{direct:"Direct",organic_search:"Organic Search",paid:"Paid",organic_social:"Organic Social",email:"Email / Referral",referral:"Email / Referral",unknown:"Other"}[s]??s}const ie=[t.greenBar,"var(--green-400)","var(--green-300)",t.amberBar,"var(--seg-atrisk)",t.green],H=[t.amberBar,t.greenBar,"var(--info-500)","var(--green-400)","var(--seg-atrisk)",t.muted2];function m({title:s,meta:i,children:r}){return e.jsxs("div",{style:{background:t.card,border:`1px solid ${t.line}`,borderRadius:"var(--radius-card)"},className:"p-5 mb-5",children:[e.jsxs("div",{className:"flex justify-between items-baseline mb-4",children:[e.jsx("h2",{style:{color:t.ink},className:"text-[15px] font-semibold m-0",children:s}),i&&e.jsx("span",{style:{color:t.muted},className:"font-mono text-[10px] tracking-[0.06em] uppercase",children:i})]}),r]})}function h({children:s}){return e.jsx("span",{style:{color:t.muted},className:"block font-mono text-[9.5px] tracking-[0.06em] uppercase mb-[5px]",children:s})}function p({label:s,value:i,sub:r}){return e.jsxs("div",{style:{background:t.card,borderRight:`1px solid ${t.line}`},className:"px-[18px] py-[18px] last:border-r-0",children:[e.jsxs("div",{style:{color:t.ink},className:"text-[26px] font-bold tracking-[-0.01em] leading-none",children:[i,r&&e.jsx("small",{style:{color:t.muted2},className:"text-[14px] font-semibold ml-[2px]",children:r})]}),e.jsx(h,{children:s})]})}function N({pct:s,color:i,height:r=22}){return e.jsx("div",{style:{height:r,background:t.lineSoft,borderRadius:"var(--radius-pill)",overflow:"hidden"},children:e.jsx("span",{style:{display:"block",height:"100%",width:`${Math.max(s*100,2)}%`,background:i,transition:"width .4s ease"}})})}function z({label:s,color:i,value:r}){return e.jsxs("div",{className:"flex justify-between items-center",style:{color:t.muted2,fontSize:13},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{style:{width:9,height:9,borderRadius:"2px",background:i,display:"inline-block"}}),s]}),e.jsx("b",{style:{color:t.ink},children:r})]})}function k({children:s,variant:i="red"}){const r=i==="green";return e.jsx("div",{style:{borderLeft:`3px solid ${r?t.green:t.red}
1`,background:r?t.greenBg:t.redBg,borderRadius:"var(--radius-ctl)",padding:"12px 14px",fontSize:13,marginTop:14,color:t.muted2},children:s})}function W({name:s,count:i,max:r,color:g=t.amber}){return e.jsxs("div",{className:"grid items-center gap-2",style:{gridTemplateColumns:"1fr 64px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13,color:t.ink},children:s}),e.jsx("div",{style:{height:6,background:t.lineSoft,borderRadius:"var(--radius-pill)",marginTop:4,overflow:"hidden"},children:e.jsx("span",{style:{display:"block",height:"100%",width:`${i/r*100}%`,background:g}})})]}),e.jsx("span",{style:{textAlign:"right",fontFamily:"var(--font-mono)",fontSize:11,color:t.muted2},children:x(i)})]})}function _({label:s,tone:i}){const r={atrisk:{borderColor:"rgb(var(--rgb-seg-atrisk) / .30)",color:"var(--seg-atrisk)",background:"rgb(var(--rgb-seg-atrisk) / .12)"},never:{borderColor:"var(--gray-300)",color:t.muted2},queued:{borderColor:"var(--green-200)",color:t.green,background:t.greenBg},plain:{borderColor:t.chipLine,color:t.muted2}};return e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"10px",letterSpacing:".04em",textTransform:"uppercase",padding:"3px 8px",borderRadius:"var(--radius-chip)",border:"1px solid",display:"inline-block",...r[i]},children:s})}function de(){const[s,i]=d.useState("30d"),[r,g]=d.useState(null),[a,J]=d.useState(null),[y,G]=d.useState(null),[l,$]=d.useState(null),[j,V]=d.useState(!1),[w,C]=d.useState(!0),[P,D]=d.useState(null),[F,T]=d.useState(null),[v,B]=d.useState(null),[K,R]=d.useState(!1),[M,I]=d.useState(null);d.useEffect(()=>{C(!0),D(null),T(null),B(null),Promise.all([ee(s),te(s),ne(s)]).then(([n,o,c])=>{g(n),J(o),G(c),C(!1)}).catch(n=>{D(n.message),C(!1)}),re().then($).catch(()=>$(null))},[s]);function O(n){!(l!=null&&l.id)||j||(V(!0),$({...l,useful:n}),q(l.id,{useful:n}).catch(()=>{}))}function Q(){if(!(l!=null&&l.id))return;const n=l.id;$(null),q(n,{dismissed:!0}).catch(()=>{})}function X(n){if(F===n){T(null),B(null);return}T(n),B(null),I(null),R(!0),se(n).then(o=>{B(o),R(!1)}).catch(o=>{I(o.message),R(!1)})}const u=s==="today"?"today":s==="7d"?"last 7 days":"last 30 days";return e.jsxs("div",{children:[e.jsx(Z,{title:"Sessions & Abandonment",subtitle:"Live on-site behavior — registered customers and anonymous visitors."}),e.jsx("div",{className:"flex justify-end mb-5",children:e.jsx("div",{style:{display:"inline-flex",background:t.card,border:`1px solid ${t.line}`,borderRadius:"var(--radius-btn)",overflow:"hidden"},children:["today","7d","30d"].map(n=>e.jsx("button",{onClick:()=>i(n),style:{fontFamily:"var(--font-mono)",fontSize:10,letterSpacing:".12em",textTransform:"uppercase",color:s===n?"var(--gray-0)":t.muted2,background:s===n?t.ink:"none",border:"none",borderRight:`1px solid ${t.line}`,padding:"9px 15px",cursor:"pointer"},className:"last:border-r-0",children:n==="today"?"Today":n==="7d"?"7 days":"30 days"},n))})}),P&&e.jsxs("div",{style:{background:t.redBg,border:`1px solid ${t.red}`,borderRadius:"var(--radius-card)",padding:"12px 16px",color:t.red,marginBottom:20},children:["Error: ",P]}),w&&e.jsx("div",{className:"flex justify-center items-center py-20",children:e.jsx("div",{className:"h-2 w-2 pulse-live",style:{background:t.amberBar}})}),!w&&r&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(8,1fr)",background:t.line,border:`1px solid ${t.line}`,borderRadius:"var(--radius-card)",overflow:"hidden",marginBottom:20},children:[e.jsx(p,{label:"Sessions",value:x(r.kpis.sessions)}),e.jsx(p,{label:"Unique visitors",value:x(r.kpis.unique_visitors)}),e.jsx(p,{label:"Registered share",value:Math.round(r.kpis.registered_share*100),sub:"%"}),e.jsx(p,{label:"Conversion rate",value:(r.kpis.conversion_rate*100).toFixed(1),sub:"%"}),e.jsx(p,{label:"Avg duration",value:S(r.kpis.avg_duration_seconds)}),e.jsx(p,{label:"Engaged sessions",value:Math.round(r.kpis.engaged_pct*100),sub:"%"}),e.jsx(p,{label:"Bounce rate",value:r.kpis.bounce_rate_pct.toFixed(1),sub:"%"}),e.jsx(p,{label:"New · Returning",value:`${x(r.kpis.new_visitors)} · ${x(r.kpis.returning_visitors)}`})]}),e.jsxs("div",{className:"grid gap-5 mb-5",style:{gridTemplateColumns:"1.35fr 1fr"}
1,children:[e.jsxs(m,{title:"Conversion funnel",meta:u,children:[e.jsx("div",{className:"flex flex-col gap-[9px]",children:r.funnel.map((n,o)=>e.jsxs("div",{className:"grid items-center gap-3",style:{gridTemplateColumns:"150px 1fr 90px"},children:[e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,letterSpacing:".06em",textTransform:"uppercase",color:t.muted2},children:n.label}),e.jsx(N,{pct:n.pct,color:ie[o]??t.muted2}),e.jsxs("span",{style:{textAlign:"right",fontWeight:600,fontSize:13,color:t.ink},children:[x(n.count),e.jsx("small",{style:{display:"block",fontFamily:"var(--font-mono)",fontSize:"9.5px",color:t.muted,fontWeight:400},children:E(n.pct)})]})]},n.label))}),r.funnel.length>=3&&e.jsxs(k,{children:[e.jsx("b",{style:{color:t.ink},children:"Biggest leak: Add to cart → Checkout."})," The largest recoverable pool — sessions that carted but never started checkout."]})]}),e.jsx(m,{title:"Who is browsing",meta:u,children:(()=>{const n=r.who.registered+r.who.anonymous,o=n?r.who.registered/n:0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{height:14,borderRadius:"var(--radius-pill)",display:"flex",overflow:"hidden",marginBottom:14},children:[e.jsx("i",{style:{display:"block",height:"100%",width:`${o*100}%`,background:t.greenBar}}),e.jsx("i",{style:{display:"block",height:"100%",flex:1,background:"var(--gray-300)"}})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(z,{label:"Registered (linked to customer)",color:t.greenBar,value:x(r.who.registered)}),e.jsx(z,{label:"Anonymous (aggregate only)",color:"var(--gray-300)",value:x(r.who.anonymous)})]}),e.jsxs(k,{children:[e.jsxs("b",{style:{color:t.ink},children:[x(r.who.warm)," registered customers browsing, not buying."]})," Includes never-ordered registrants — the warm pool for re-engagement."]})]})})()})]}),e.jsx(m,{title:"What they view — to the SKU",meta:`product_viewed · ${u}`,children:e.jsxs("div",{className:"grid gap-5",style:{gridTemplateColumns:"repeat(3,1fr)"},children:[e.jsxs("div",{children:[e.jsx(h,{children:"Top viewed products"}),e.jsxs("div",{className:"flex flex-col gap-[9px]",children:[r.top_products.map(n=>{var o;return e.jsx(W,{name:n.name,count:n.count,max:((o=r.top_products[0])==null?void 0:o.count)||1,color:t.greenBar},n.sku||n.name)}),!r.top_products.length&&e.jsx("span",{style:{color:t.muted,fontSize:13},children:"No data yet"})]})]}),e.jsxs("div",{children:[e.jsx(h,{children:"Top categories"}),e.jsxs("div",{className:"flex flex-col gap-[9px]",children:[r.top_categories.map(n=>{var o;return e.jsx(W,{name:n.name,count:n.count,max:((o=r.top_categories[0])==null?void 0:o.count)||1,color:t.amberBar},n.name)}),!r.top_categories.length&&e.jsx("span",{style:{color:t.muted,fontSize:13},children:"No data yet"})]})]}),e.jsxs("div",{children:[e.jsx(h,{children:"Viewed, not bought · gap"}),e.jsxs("div",{className:"flex flex-col gap-[9px]",children:[r.viewed_not_bought.map(n=>{var o;return e.jsx(W,{name:n.name,count:n.count,max:((o=r.viewed_not_bought[0])==null?void 0:o.count)||1,color:t.red},n.sku||n.name)}),!r.viewed_not_bought.length&&e.jsx("span",{style:{color:t.muted,fontSize:13},children:"No gap detected"})]})]})]})}),e.jsxs("div",{className:"grid gap-5 mb-5",style:{gridTemplateColumns:"1.35fr 1fr"},children:[e.jsx(m,{title:"Acquisition channel",meta:`sessions · ${u}`,children:e.jsx("div",{className:"flex flex-col gap-3",children:r.channels.map((n,o)=>e.jsxs("div",{className:"grid items-center gap-[10px]",style:{gridTemplateColumns:"130px 1fr 48px"},children:[e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"10.5px",letterSpacing:".05em",textTransform:"uppercase",color:t.muted2},children:U(n.channel)}),e.jsx(N,{pct:n.pct,color:H[o]??t.muted2,height:14}),e.jsx("span",{style:{textAlign:"right",fontFamily:"var(--font-mono)",fontSize:11,color:t.muted2},children:E(n.pct)})]},n.channel))})}),e.jsx(m,{title:"Device & region",meta:"geo · self-hosted",children:(()=>{const n=r.devices.find(c=>c.device_type==="mobile"),o=n?Math.round(n.pct*100):0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[e.jsxs("div",{children:[e.jsx(h,{children:"Mobile"}),e.jsxs("span",{style:{fontSize:15,fontWeight:500,color:t.ink},children:[o,"%"]})]}),e.jsxs("div",{children:[e.jsx(h,{children:"Desktop / tablet"}),e.jsxs("span",{style:{fontSize:15,fontWeight:500,color:t.ink},children:[100-o,"%"]})]})]}),e.jsx("div",{className:"flex flex-col gap-3",children:r.geo.map((c,Y)=>e.jsxs("div",{className:"grid items-center gap-[10px]",style:{gridTemplateColumns:"130px 1fr 48px"},children:[e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"10.5px",letterSpacing:".05em",textTransform:"uppercase",color:t.muted2},children:c.location}),e.jsx(N,{pct:c.pct,color:H[Y]??t.muted2,height:14}),e.jsx("span",{style:{textAlign:"right",fontFamily:"var(--font-mono)",fontSize:11,color:t.muted2},children:E(c.pct)})]},c.location))})]})})()})]})]}),!w&&y&&e.jsxs(e.Fragment,{children:[e.jsx(m,{title:"Top pages",meta:`customer_page_journey · ${u}`,children:y.top_pages.length===0?e.jsx("p",{style:{color:t.muted,fontSize:13},children:"No page-journey data in this period."}):e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13},children:[e.jsx("thead",{children:e.jsx("tr",{children:["Page","Category","Visits","Unique visitors","Avg time on page","Exit rate"].map(n=>e.jsx("th",{style:{fontFamily:"monospace",fontSize:"9.5px",letterSpacing:".12em",textTransform:"uppercase",color:t.muted,textAlign:"left",fontWeight:500,padding:"0 10px 10px",borderBottom:`1px solid ${t.line}`},children:n},n))})}),e.jsx("tbody",{children:y.top_pages.map(n=>e.jsxs("tr",{children:[e.jsxs("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`,fontWeight:500,color:t.ink},children:[n.page_label||n.path,e.jsx("div",{style:{fontFamily:"monospace",fontSize:10,
1color:t.muted},children:n.path})]}),e.jsx("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`,color:t.muted2},children:n.page_category||"—"}),e.jsx("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`,fontWeight:600},children:x(n.visits)}),e.jsx("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`},children:x(n.unique_visitors)}),e.jsx("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`},children:S(Math.round(n.avg_time_on_page_sec))}),e.jsxs("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`,color:n.exit_rate_pct>=50?t.red:t.muted2},children:[n.exit_rate_pct.toFixed(1),"%"]})]},n.path))})]})}),e.jsx(m,{title:"Per-session journey",meta:`most recent · ${u}`,children:y.sessions.length===0?e.jsx("p",{style:{color:t.muted,fontSize:13},children:"No sessions with page-journey data in this period."}):e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13},children:[e.jsx("thead",{children:e.jsx("tr",{children:["Visitor","Started","Duration","Device","Channel","Pages",""].map(n=>e.jsx("th",{style:{fontFamily:"monospace",fontSize:"9.5px",letterSpacing:".12em",textTransform:"uppercase",color:t.muted,textAlign:"left",fontWeight:500,padding:"0 10px 10px",borderBottom:`1px solid ${t.line}`},children:n},n))})}),e.jsx("tbody",{children:y.sessions.map(n=>e.jsxs(d.Fragment,{children:[e.jsxs("tr",{onClick:()=>X(n.session_id),style:{cursor:"pointer"},children:[e.jsx("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`,verticalAlign:"middle"},children:n.customer_id?e.jsx(A,{to:`/portfolios/${n.customer_id}`,onClick:o=>o.stopPropagation(),style:{color:t.ink,fontWeight:500},children:n.full_name||`#${n.customer_id}`}):e.jsx("span",{style:{color:t.ink,fontWeight:500},children:"Anonymous"})}),e.jsx("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`},children:L(n.started_at||"")}),e.jsx("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`},children:n.duration_seconds!=null?S(n.duration_seconds):"—"}),e.jsx("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`,textTransform:"capitalize"},children:n.device_type||"—"}),e.jsx("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`},children:n.channel?U(n.channel):"—"}),e.jsx("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`,fontWeight:600},children:n.page_count}),e.jsxs("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`},children:[n.converted?e.jsx(_,{label:"Converted",tone:"queued"}):null,e.jsx("span",{style:{color:t.muted,marginLeft:6},children:F===n.session_id?"▾":"▸"})]})]}),F===n.session_id&&e.jsx("tr",{children:e.jsxs("td",{colSpan:7,style:{padding:"0 10px 16px",borderBottom:`1px solid ${t.lineSoft}`},children:[K&&e.jsx("span",{style:{color:t.muted,fontSize:12},children:"Loading journey…"}),M&&e.jsxs("span",{style:{color:t.red,fontSize:12},children:["Error: ",M]}),v&&v.session_id===n.session_id&&e.jsxs("div",{style:{background:t.bg,border:`1px solid ${t.line}`,padding:"12px 14px"},children:[e.jsxs("div",{className:"flex gap-5 mb-3",style:{fontSize:12,color:t.muted2},children:[e.jsxs("span",{children:[e.jsx("b",{style:{color:t.ink},children:v.total_pages_visited})," pages visited"]}),e.jsxs("span",{children:["avg ",e.jsx("b",{style:{color:t.ink},children:S(Math.round(v.avg_time_on_page_sec))})," per page"]})]}),e.jsx("div",{className:"flex flex-col gap-2",children:v.pages.map((o,c)=>e.jsxs("div",{className:"grid items-center gap-3",style:{gridTemplateColumns:"20px 1fr 90px 80px"},children:[e.jsx("span",{style:{fontFamily:"monospace",fontSize:10,color:t.muted},children:c+1}),e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:13,color:t.ink,fontWeight:500},children:o.page_label||o.path}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:10,color:t.muted},children:o.path})]}),e.jsx("span",{style:{fontFamily:"monospace",fontSize:11,color:t.muted2,textAlign:"right"},children:o.time_on_page_sec!=null?S(Math.round(o.time_on_page_sec)):"—"}),e.jsx("span",{style:{textAlign:"right"},children:e.jsx(_,{label:o.engagement_level,tone:o.engagement_level==="exit"?"atrisk":o.engagement_level==="engaged"||o.engagement_level==="deep"?"queued":"plain"})})]},c))})]})]})},`${n.session_id}-detail`)]},n.session_id))})]})})]}),!w&&a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4,1fr)",background:t.line,border:`1px solid ${t.line}`,borderRadius:"var(--radius-card)",overflow:"hidden",marginBottom:20},children:[e.jsx(p,{label:"Cart abandonment",value:Math.round(a.kpis.cart_abandonment_rate*100),sub:"%"}),e.jsx(p,{label:"Checkout abandonment",value:Math.round(a.kpis.checkout_abandonment_rate*100),sub:"%"}),e.jsx(p,{label:`Recoverable carts · ${u}`,value:x(a.kpis.recoverable_carts)}),e.jsx(p,{label:"Recoverable value",value:oe(a.kpis.recoverable_value)})]}),(l==null?void 0:l.available)&&e.jsxs(m,{title:"AI Insights",meta:`claude · ${l.scope??"30d"} snapshot`,children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[l.insights.map((n,o)=>e.jsxs("div",{style:{borderTop:o>0?`1px solid ${t.line}`:void 0,paddingTop:o>0?16:0},children:[e.jsxs("div",{className:"flex justify-between items-baseline gap-2 mb-2",children:[e.jsx("h3",{style:{color:t.ink,fontSize:14,fontWeight:600,margin:0},children:n.title}),n.confidence&&e.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:9.5,letterSpacing:".08em",textTransform:"uppercase",color:n.confidence==="high"?t.green:t.muted2,whiteSpace:"nowrap"},children:[n.confidence," confidence"]})]}),e.jsx("p",{style:{color:t.muted2,fontSize:13,marginBottom:8},children:n.finding}),e.jsxs(k,{variant:"red",children:[e.jsx("b",{style:{color:t.ink},children:"Why it matters."})," ",n.why_it_matters]}),e.jsxs(k,{variant:"green",children:[e.jsx("b",{style:{color:t.ink},children:"Recommendation."})," ",n.recommendation]})]},o)),!l.insights.length&&e.jsx("span",{style:{color:t.muted,fontSize:12.5},children:"—"})]}),l.id&&e.jsxs("div",{className:"flex justify-between items-center",style:{marginTop:14},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>O(!0),disabled:j,style:{background:"none",border:"none",padding:0,cursor:j?"default":"pointer",color:l.useful===!0?t.green:t.muted2,fontSize:12},children:"Useful"}),e.jsx("button",{type:"button",onClick:()=>O(!1),disabled:j,style:{background:"none",border:"none",padding:0,cursor:j?"default":"pointer",color:l.useful===!1?t.red:t.muted2,fontSize:12},children:"Not useful"}),e.jsx("button",{type:"button",onClick:Q,style:{background:"none",border:"none",padding:0,cursor:"pointer",color:t.muted2,fontSize:12,textDecoration:"underline"},children:"Hide"})]}),l.created_at&&e.jsxs("p",{style:{fontFamily:"var(--font-mono)",fontSize:10,
1color:t.muted,margin:0},children:["Generated ",L(l.created_at)," · see also the"," ",e.jsx(A,{to:"/actions",style:{color:t.muted2},children:"Action Queue"})]})]})]}),e.jsxs("div",{className:"grid gap-5 mb-5",style:{gridTemplateColumns:"1.35fr 1fr"},children:[e.jsxs(m,{title:"Where carts are abandoned",meta:"by furthest stage",children:[e.jsx("div",{className:"flex flex-col gap-3",children:(()=>{const n=Math.max(...a.by_stage.map(o=>o.count),1);return a.by_stage.map((o,c)=>e.jsxs("div",{className:"grid items-center gap-[10px]",style:{gridTemplateColumns:"160px 1fr 48px"},children:[e.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:"10.5px",textTransform:"uppercase",color:t.muted2},children:o.stage}),e.jsx(N,{pct:o.count/n,color:[t.amberBar,"var(--warning-500)","var(--seg-atrisk)",t.red][c]??t.red,height:18}),e.jsx("span",{style:{textAlign:"right",fontFamily:"var(--font-mono)",fontSize:11,color:t.muted2},children:o.count})]},o.stage))})()}),a.by_stage.some(n=>n.stage_num>=6)&&e.jsxs(k,{children:[e.jsx("b",{style:{color:t.ink},children:"Reached payment and dropped."})," Highest intent, highest ROI — the primary win-back trigger fires here."]})]}),e.jsx(m,{title:"Source",meta:"combined",children:(()=>{const n=a.source.shopify_abandoned+a.source.live_pixel,o=n?a.source.shopify_abandoned/n:0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{height:14,borderRadius:"var(--radius-pill)",display:"flex",overflow:"hidden",marginBottom:14},children:[e.jsx("i",{style:{display:"block",height:"100%",width:`${o*100}%`,background:t.amberBar}}),e.jsx("i",{style:{display:"block",height:"100%",flex:1,background:"var(--green-400)"}})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(z,{label:"Shopify abandoned checkout (email)",color:t.amberBar,value:a.source.shopify_abandoned}),e.jsx(z,{label:"Live pixel (earlier stages)",color:"var(--green-400)",value:a.source.live_pixel})]}),e.jsxs("p",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:t.muted2,marginTop:14},children:["Existing ",e.jsx("b",{children:"georgia_abandoned_carts"})," + live ",e.jsx("b",{children:"checkout_started"})," abandonment, deduped by client/session."]})]})})()})]}),e.jsx(m,{title:"Recoverable carts",meta:"most valuable first",children:a.recoverable.length===0?e.jsx("p",{style:{color:t.muted,fontSize:13},children:"No recoverable carts in this period."}):e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13},children:[e.jsx("thead",{children:e.jsx("tr",{children:["Customer","Segment","Stage reached","Cart","Last seen","Source"].map(n=>e.jsx("th",{style:{fontFamily:"var(--font-mono)",fontSize:"9.5px",letterSpacing:".12em",textTransform:"uppercase",color:t.muted,textAlign:"left",fontWeight:500,padding:"0 10px 10px",borderBottom:`1px solid ${t.line}`},children:n},n))})}),e.jsx("tbody",{children:a.recoverable.map((n,o)=>e.jsxs("tr",{children:[e.jsxs("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`,verticalAlign:"middle"},children:[n.customer_id?e.jsx(A,{to:`/portfolios/${n.customer_id}`,style:{color:t.ink,fontWeight:500},children:n.full_name||`#${n.customer_id}`}):e.jsx("span",{style:{color:t.ink,fontWeight:500},children:n.email||"Anonymous"}),n.email&&e.jsx("div",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:t.muted},children:n.email})]}),e.jsx("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`,verticalAlign:"middle"},children:n.segment?e.jsx(_,{label:n.segment.replace(/_/g," "),tone:n.segment==="at_risk"?"atrisk":"plain"}):e.jsx(_,{label:"Unknown",tone:"never"})}),e.jsx("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`,fontWeight:600},children:n.stage}),e.jsxs("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`,fontWeight:700},children:["₾",n.cart_value.toFixed(0)]}),e.jsx("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`},children:L(n.last_seen)}),e.jsx("td",{style:{padding:"11px 10px",borderBottom:`1px solid ${t.lineSoft}`},children:e.jsx(_,{label:n.products.length?"Live pixel":"Shopify",tone:"queued"})})]},`${n.customer_id}-${o}`))})]})})]})]})}export{de as default};

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.