PageSourceSearch

https://endorsy.com/assets/BusinessMessages-D6hlz1An.js

js endorsy.com collected 2026-10-10 00:09:02 UTC 5,645 bytes, 1 lines download raw bytes

1import{r as o,j as e}from"./vendor-ui-6bymxjVp.js";import{n as B,m as F,aG as q,bB as P,bC as R,bD as H,bE as $,bF as G,H as Q,Y,I as V,bG as W,bH as g,M as z}from"./index-CSuv8oHH.js";import{F as J}from"./Footer-BSOD1-c-.js";import{M as K,a as O}from"./MessageConversation-D1T7fMJe.js";import{P as X}from"./PageBreadcrumb-B0IxBWWD.js";import{u as Z,b as ee}from"./vendor-react-w_XInYjb.js";import"./vendor-supabase-BUAHZHsI.js";import"./vendor-charts-BGhzyVp7.js";import"./vendor-query-q2i9JZGt.js";import"./mail-open-CBrEZv8Y.js";import"./archive-DIe4oiWV.js";import"./linkifyText-3dGrS3gJ.js";import"./subDays-D0jrIt_I.js";import"./urlUtils-CdZh9ewb.js";import"./BusinessThumbnail-BPviZMgb.js";import"./lightbox-53_VCQuU.js";(function(){try{var l=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};l.SENTRY_RELEASE={id:"v0.1.446"};var n=new l.Error().stack;n&&(l._sentryDebugIds=l._sentryDebugIds||{},l._sentryDebugIds[n]="6754866c-77f8-415f-92e9-705ea3649f20",l._sentryDebugIdIdentifier="sentry-dbid-6754866c-77f8-415f-92e9-705ea3649f20")}catch{}})();const pe=()=>{Z();const{user:l}=B(),{toast:n}=F(),a=q(),[N]=ee(),v=N.get("thread"),[r,i]=o.useState(v);o.useEffect(()=>{i(v)},[v]);
1const[x,M]=o.useState(""),[m,k]=o.useState("all"),d=!0,{businessProfileId:y}=P(),t=m==="archived",{data:h=[],isLoading:S}=R(d,!1,y),u=o.useMemo(()=>t?h.filter(s=>s.is_archived):h.filter(s=>!s.is_archived),[h,t]),{data:T=[],isLoading:se}=H(r),j=$(),_=G(),f=h.find(s=>s.id===r),C=o.useMemo(()=>{let s=u;if(m==="unread"&&(s=s.filter(c=>(c.unread_count??0)>0)),x.trim()){const c=x.toLowerCase();s=s.filter(b=>{var w;const p=b.member_name||b.other_user_name;return(p==null?void 0:p.toLowerCase().includes(c))||((w=b.last_message_preview)==null?void 0:w.toLowerCase().includes(c))})}return s},[u,m,x]),I=a?r!==null&&!!f:!0,E=a?!r||!f:!0;o.useEffect(()=>{!a&&!r&&!t&&u.length>0&&i(u[0].id)},[u,r,a,t]);const D=s=>{j.mutate({threadId:s,isBusinessUser:d,archive:!0},{onSuccess:()=>{r===s&&i(null),n({title:"Conversation archived"})}})},L=s=>{j.mutate({threadId:s,isBusinessUser:d,archive:!1},{onSuccess:()=>{n({title:"Conversation restored"})}})},U=s=>{_.mutate({threadId:s,isBusinessUser:d},{onSuccess:()=>{n({title:"Marked as unread"})}})},A=[{key:"all",label:"All"},{key:"unread",label:"Unread"},{key:"archived",label:"Archived"}];return e.jsxs("div",{className:"min-h-screen flex flex-col",style:{background:"hsl(var(--card))"},children:[e.jsx(Q,{}),(!a||!r)&&e.jsx(X,{items:[{label:"Dashboard",to:"/business/dashboard"},{label:"Messages"}],className:"max-w-7xl",mobileBackTo:"/business/dashboard"}),(!a||!r)&&e.jsx("div",{style:{background:"hsl(var(--card))",borderBottom:"1px solid hsl(var(--border))"},children:e.jsxs("div",{className:"container mx-auto py-5 md:py-6 px-5 md:px-6 max-w-7xl",children:[e.jsx("h1",{className:"text-xl sm:text-2xl lg:text-[28px] mb-1",style:{fontFamily:"'DM Serif Display', serif",fontWeight:400},children:"Messages"}),e.jsx("p",{className:"text-muted-foreground text-xs sm:text-sm md:text-base",children:"Manage conversations with members who have requested quotes."}),e.jsxs("div",{className:"mt-3 relative max-w-md",children:[e.jsx(Y,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground/50"}),e.jsx(V,{placeholder:"Search conversations...",value:x,onChange:s=>M(s.target.value),className:"pl-9 h-10 rounded-xl"})]})]})}),(!a||!r)&&e.jsx("div",{className:"border-b bg-card",children:e.jsx("div",{className:"container mx-auto px-5 md:px-6 max-w-7xl",children:e.jsx("div",{className:"flex items-center py-2",children:A.map((s,c)=>e.jsxs("div",{className:"flex items-center",children:[c>0&&e.jsx("div",{className:"w-px h-4 mx-1",style:{background:"#d5dadc"}}),e.jsx("button",{onClick:()=>{k(s.key),i(null)},className:`px-3 py-1.5 text-sm font-['DM_Sans'] transition-colors ${m===s.key?"font-semibold":"text-muted-foreground font-medium hover:text-foreground"}`,style:m===s.key?{color:"var(--brand-teal)"}:void 0,children:s.label})]},s.key))})})}),e.jsx("main",{className:"flex-1 flex flex-col min-h-0",children:e.jsxs("div",{className:"container mx-auto flex-1 flex flex-col min-h-0 py-6 px-5 md:px-6 max-w-7xl",children:[(!a||!r)&&e.jsx(W,{audience:"business",businessId:y}),e.jsx("div",{className:"flex-1 flex min-h-0 rounded-xl overflow-hidden border bg-card shadow-sm",style:{minHeight:a?"auto":"520px"},children:S?e.jsx("div",{className:"flex-1 p-6 space-y-4",children:[1,2,3].map(s=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(g,{className:"h-11 w-11 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(g,{className:"h-4 w-32"}),e.jsx(g,{className:"h-3 w-full"})]})]},s))}):e.jsxs(e.Fragment,{children:[E&&e.jsx("div",{className:`${a?"w-full":"w-80 lg:w-96 flex-shrink-0"} border-r overflow-y-auto bg-card`,children:e.jsx(K,{threads:C,selectedThreadId:r,onSelectThread:i,isBusinessUser:d,onArchive:t?void 0:D,onUnarchive:t?L:void 0,onMarkUnread:t?void 0:U,isArchivedView:t})}),I&&e.jsx("div",{className:`flex-1 min-w-0 ${a?"w-full":""}`,children:f?e.jsx(O,{thread:f,messages:T,isBusinessUser:d,onBack:()=>i(null),isMobile:a}):!a&&e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground bg-muted/30",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary/10 flex items-center justify-center mb-4",children:e.jsx(z,{className:"h-8 w-8 text-primary/50"})}),e.jsx("p",{className:"font-['DM_Sans'] text-sm",children:t?"Select an archived conversation":"Select a conversation to view messages"})]})})]})})]})}),e.jsx(J,{})]})};export{pe 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.