PageSourceSearch

https://crosslyst.com/assets/Home-CnwbxwSH.js

js crosslyst.com collected 2026-10-02 01:26:33 UTC 10,655 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/engagement-timeline-2jOZIsd8.js","assets/markdown-BniUNT3b.js","assets/stripe-DNH-pMf_.js","assets/use-persistent-state-COZlt01K.js","assets/select-mcp4chQz.js","assets/recharts-BxZy5o_C.js","assets/index-DuSE7Tbu.js","assets/supabase-H0uDwzZe.js","assets/index-orMD_mPB.css","assets/app-header-HmgkKqwJ.js","assets/key-round-Cuxv64xH.js","assets/tag-filter-B_U3ya-Q.js","assets/listing-tags-Chw7uww4.js","assets/engagement-metrics-Bi6C6yBf.js","assets/format-Dx7NWJIh.js","assets/endOfDay-Qru9LP9c.js"])))=>i.map(i=>d[i]);
2var se=Object.defineProperty;var ae=(s,a,r)=>a in s?se(s,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[a]=r;var v=(s,a,r)=>ae(s,typeof a!="symbol"?a+"":a,r);import{s as re,E as ie,F as ne,B as oe,h as le,a as de,P as ce,G as x,A as me,T,i as P,L as C,j as L,_ as ue}from"./index-DuSE7Tbu.js";import{j as t}from"./markdown-BniUNT3b.js";import{r as m}from"./stripe-DNH-pMf_.js";import{A as fe}from"./app-header-HmgkKqwJ.js";import{r as pe,a as ge,b as he,e as xe,g as be,f as S}from"./posting-tasks-BZS7Va69.js";import{f as ve,s as ye}from"./posting-task-visibility-BaS8CZ6E.js";import{d as we}from"./platform-pending-update-BgcS_mbn.js";import{c as je}from"./listings-DqQRtlLY.js";import{e as ke}from"./endOfDay-Qru9LP9c.js";import"./recharts-BxZy5o_C.js";import"./supabase-H0uDwzZe.js";import"./key-round-Cuxv64xH.js";import"./posting-lifecycle-BkV2iYa2.js";const _e="facebook",M=2,D=24*60*60*1e3,R=s=>`crosslyst:activated:${s}`,Ne=s=>!s.hidden_at&&(s.status==="ready"||!!s.posted_at),Te=s=>{const a=s.ready_at??s.posted_at;if(!a)return null;const r=new Date(a).getTime();return Number.isFinite(r)?r:null},Pe=(s,a,r=Date.now())=>{const l=new Map;for(const i of a){const n=l.get(i.listing_id)??[];n.push(i),l.set(i.listing_id,n)}for(const i of s){const n=i.created_at?new Date(i.created_at).getTime():NaN;if(!Number.isFinite(n))continue;const g=l.get(i.id)??[],u=new Set(g.filter(Ne).filter(o=>o.platform!==_e).filter(o=>{const d=Te(o);return d===null?!1:d>=n&&d-n<=D}).map(o=>o.platform));if(!(n>r+D)&&u.size>=M)return i.id}return null},Ce=s=>{try{return localStorage.getItem(R(s))==="1"}catch{return!1}},Le=s=>{try{localStorage.setItem(R(s),"1")}catch{}},Se=async(s,a,r)=>{if(!s||Ce(s))return;const l=Pe(a,r);if(!l)return;const{data:i,error:n}=await re.rpc("claim_activation_milestone",{_listing_id:l});n||(Le(s),i===!0&&ie("listing_activated",{platforms_prepared:M,label:"First listing prepared for two additional marketplaces"}))};class De extends m.Component{constructor(){super(...arguments);v(this,"state",{error:null});v(this,"reset",()=>this.setState({error:null}))}static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,l){console.error(`[SectionErrorBoundary:${this.props.label}]`,r,l)}render(){return this.state.error?t.jsxs("div",{className:"mt-10 mx-auto max-w-5xl w-full rounded-lg border bg-card p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-destructive mb-2",children:[t.jsx(ne,{className:"h-4 w-4"}),t.jsxs("span",{className:"text-sm font-medium",children:[this.props.label," couldn't load"]})]}),t.jsx("pre",{className:"rounded bg-muted p-3 text-xs overflow-auto max-h-32 mb-3",children:this.state.error.message}),t.jsx(oe,{size:"sm",variant:"outline",onClick:this.reset,children:"Retry"})]}):this.props.children}}const Ae=m.lazy(()=>ue(()=>import("./engagement-timeline-2jOZIsd8.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])).then(s=>({default:s.EngagementTimeline}))),Ee=3,A=s=>{if(s==null)return 0;const a=String(s).trim();if(!a||/^free$/i.test(a))return 0;const r=Number(a.replace(/[^0-9.-]/g,""));return Number.isFinite(r)?r:0},E=s=>s>=1e3?`$${(s/1e3).toFixed(s>=1e4?0:1).replace(/\.0$/,"")}k`:`$${Math.round(s).toLocaleString()}`,Ke=()=>{const[s,a]=m.useState([]),[r,l]=m.useState([]),[i,n]=m.useState([]),{isTrialing:g,trialDaysLeft:u}=le(),{user:o}=de(),d=g?Math.min(Math.max(x-u+1,1),x):null,$=d?d/x*100:0;m.useEffect(()=>{let e=!1;const c=async()=>{const[{listings:h,platforms:N},te]=await Promise.all([je(),S()]);e||(a(h),l(N),n(te),Se(o==null?void 0:o.id,h,N))};return(async()=>
2{if(await c(),e||(await Promise.all([pe(),ge(),he(),xe(),be()]),e))return;const h=await S();e||n(h)})(),()=>{e=!0}},[o==null?void 0:o.id]);const f=s.filter(e=>!e.sold_at&&e.status!=="archived"),I=new Set(f.map(e=>e.id)),p=r.filter(e=>I.has(e.listing_id)),F=new Map(f.map(e=>[e.id,e])),b=e=>we(F.get(e.listing_id)??null,e),O=f.length,B=p.filter(e=>!!e.posted_at&&!b(e)).length,H=p.filter(e=>e.status==="ready"&&!e.posted_at||b(e)).length,V=p.filter(e=>e.status!=="ready"&&!e.posted_at).length,W=new Set(p.map(e=>e.listing_id)),U=f.filter(e=>!W.has(e.id)).length*Ee,z=V+U,y=new Map;r.forEach(e=>{y.set(`${e.listing_id}:${e.platform}`,{listing_id:e.listing_id,platform:e.platform,status:e.status,posted_at:e.posted_at,external_url:null,hidden_at:e.hidden_at??null})});const w=ve(i,{platformRows:y}),G=ke(new Date).getTime(),Y=w.filter(e=>new Date(e.scheduled_at).getTime()<=G).length,q=w.length,K=ye(new Date),j=s.filter(e=>!!e.sold_at&&new Date(e.sold_at)>=K),J=j.length,Q=new Set(p.filter(e=>!!e.posted_at&&!b(e)).map(e=>e.listing_id)),k=f.filter(e=>Q.has(e.id)).reduce((e,c)=>e+A(c.price),0),_=j.reduce((e,c)=>e+A(c.sold_price??c.price),0),X=[{label:"Needs attention",value:Y,tooltip:"Overdue actions plus everything scheduled for today across all platforms.",to:"/app/schedule",accent:"text-amber-600 dark:text-amber-400"}],Z=[{label:"Unsold Products",value:O,tooltip:"Products in your inventory that haven't been marked sold or archived.",to:"/app/inventory",accent:"text-red-700 dark:text-red-400",barClass:"bg-red-50 dark:bg-red-950/30 border-red-200 dark:border-red-900"},{label:"Draft Listings",value:z,tooltip:"Platform posts still in draft — need title, price, photos or final review before they're ready.",to:"/app/listings?status=draft",accent:"text-amber-600 dark:text-amber-400",barClass:"bg-amber-50 dark:bg-amber-950/30 border-amber-200 dark:border-amber-900"},{label:"Ready Listings",value:H,tooltip:"Platform posts marked Ready but not yet published — open the extension to post them.",to:"/app/listings?status=ready",accent:"text-amber-600 dark:text-amber-400",barClass:"bg-amber-50 dark:bg-amber-950/30 border-amber-200 dark:border-amber-900"},{label:"Live Listings",value:B,sub:k>0?`${E(k)} asking`:void 0,tooltip:"Individual platform posts (FB / ND / CL) that are currently published. Subline sums the asking price across distinct products with at least one live post.",to:"/app/listings?status=live",accent:"text-amber-600 dark:text-amber-400",barClass:"bg-amber-50 dark:bg-amber-950/30 border-amber-200 dark:border-amber-900"},{label:"Sold This Month",value:J,sub:_>0?`${E(_)} sales`:void 0,tooltip:"Products marked sold since the start of this calendar month. Subline sums the final sale price (falling back to the original ask when not recorded).",to:"/app/inventory?status=sold",accent:"text-emerald-700 dark:text-emerald-400",barClass:"bg-emerald-50 dark:bg-emerald-950/30 border-emerald-200 dark:border-emerald-900"}],ee=["100%","76%","76%","76%","52%"];return t.jsxs("div",{className:"min-h-screen bg-background",children:[t.jsx(ce,{title:"Home · Crosslyst",description:"Your Crosslyst account overview: active listings, posting activity, engagement, and quick shortcuts to your inventory and schedule.",path:"/app"}),t.jsx(fe,{active:"home",pendingTaskCount:q}),t.jsxs("main",{className:"container mx-auto px-4 py-8",children:[t.jsxs("div",{className:"mb-6",children:[t.jsx("h1",{className:"text-2xl font-bold",children:"Home"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Where every listing stands right now, and what needs your attention next. Click any tile to jump to the matching view."})]}),g&&d!==null&&t.jsxs("div",{className:"mb-6 rounded-lg border bg-card p-4",children:[t.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Pro trial"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:u===0?"Ends today":`${u} day${u===1?"":"s"} left`})]}),t.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[t.jsxs("span",{className:"text-2xl font-bold",children:["Day ",d]}),t.jsxs("span",{className:"text-sm text-muted-foreground",children:["of ",x]})]}),t.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:t.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${$}%`}})})]}),t.jsx(me,{delayDuration:150,children:t.jsxs("div",{className:"mx-auto flex flex-col sm:flex-row sm:items-start sm:justify-center gap-6 max-w-4xl",children:[t.jsx("div",{className:"flex flex-col gap-3 w-full sm:w-56 shrink-0",children:X.map(e=>t.jsxs(T,{children:[t.jsx(P,{asChild:!0,children:t.jsxs(C,{to:e.to,className:"rounded-lg border bg-card hover:bg-accent/40 transition p-3 flex flex-col gap-1 min-h-[72px] focus:outline-none focus:ring-2 focus:ring-ring",children:[t.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:e.label}),t.jsx("span",{className:`text-2xl font-bold tabular-nums ${e.accent}`,children:e.value})]})}),t.jsx(L,{side:"bottom",className:"max-w-[220px] text-xs",children:e.tooltip})]},e.label))}),t.jsxs("section",{"aria-label":"Listing lifecycle",className:"flex-1 max-w-xl w-full",children:[t.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-muted-foreground mb-3 sm:sr-only",children:"Listing lifecycle"}),t.jsx("div",{className:"flex flex-col items-center gap-2",children:Z.map((e,c)=>t.jsxs(T,{children:[t.jsx(P,{asChild:!0,children:t.jsxs(C,{to:e.to,style:{width:ee[c]},className:`rounded-lg border transition hover:brightness-105 px-4 py-3 flex items-center justify-between gap-4 focus:outline-none focus:ring-2 focus:ring-ring ${e.barClass}`,children:[t.jsx("span",{className:"text-xs sm:text-sm font-medium uppercase tracking-wide text-muted-foreground",children:e.label}),t.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[e.sub&&t.jsx("span",{className:"text-xs font-medium tabular-nums text-muted-foreground truncate",children:e.sub}),t.jsx("span",{className:`text-2xl font-bold tabular-nums ${e.accent}`,children:e.value})]})]})}),t.jsx(L,{side:"right",className:"max-w-[220px] text-xs",children:e.tooltip})]},e.label))})]})]})}),t.jsx(De,{label:"Engagement timeline",children:t.jsx(m.Suspense,{fallback:t.jsx("div",{className:"h-64 roun
2ded-lg border bg-muted/30","aria-hidden":"true"}),children:t.jsx(Ae,{})})})]})]})};export{Ke as Home};

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.