PageSourceSearch

https://endorsy.com/assets/ConnectionProviders-DTf6-RDe.js

js endorsy.com collected 2026-10-10 00:09:50 UTC 12,136 bytes, 1 lines download raw bytes

1import{r as x,j as e}from"./vendor-ui-6bymxjVp.js";import{a as C}from"./vendor-query-q2i9JZGt.js";import{n as X,s as M,J as k,H as L,y as u,k as S,eM as J,b4 as V,b5 as W,b6 as Z,bL as ee,M as se,Y as te,I as ae,aE as re,eN as B,bT as D,bn as ne,b8 as T,aq as $,ev as ie,ew as oe,G as le,bX as de,ex as ce,gl as me,a$ as xe,e3 as U}from"./index-CSuv8oHH.js";import{u as ue}from"./useSharedCyrcles-CT7ZYJgp.js";import{u as he}from"./useMutualConnectionsList-Dlw6r3pK.js";import{M as fe}from"./MutualConnectionsModal-BfATwCBv.js";import{C as ge}from"./ComposeUserMessageModal-CTfD-yXt.js";import{u as pe,d as be}from"./vendor-react-w_XInYjb.js";import{P}from"./package-BvmaCATo.js";import"./vendor-supabase-BUAHZHsI.js";import"./vendor-charts-BGhzyVp7.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"v0.1.446"};var i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="bdc7e00d-fa23-4f5e-b13a-d9f695e35ab3",t._sentryDebugIdIdentifier="sentry-dbid-bdc7e00d-fa23-4f5e-b13a-d9f695e35ab3")}catch{}})();function je(t){return t>=50?{label:"Local Expert",icon:me,className:"bg-amber-50 text-amber-800 dark:bg-amber-900/20 dark:text-amber-300 border border-amber-200 dark:border-amber-700/50"}:t>=20?{label:"Influencer",icon:xe,className:"bg-primary/10 text-primary border border-primary/20"}:t>=5?{label:"Contributor",icon:U,className:"bg-primary/5 text-primary border border-primary/15"}:t>=1?{label:"Contributor",icon:U,className:"bg-primary/5 text-primary border border-primary/15"}:null}const Ee=()=>{var q,A;const{user:t}=X(),i=pe(),{memberId:a}=be(),[K,z]=x.useState(!1),[Q,E]=x.useState(!1),[l,y]=x.useState(""),{data:m=[]}=he(t==null?void 0:t.id,a),{data:r,isLoading:Y}=C({queryKey:["connection-profile",a],queryFn:async()=>{if(!a)return null;const{data:s,error:n}=await M.from("profiles").select("id, first_name, last_name, avatar_url, zip_code").eq("id",a).single();if(n)throw n;return s},enabled:!!a}),{data:F,isLoading:G}=C({queryKey:["verify-connection",t==null?void 0:t.id,a],queryFn:async()=>{if(!(t!=null&&t.id)||!a)return!1;const{data:s}=await M.rpc("are_users_connected",{user_a:t.id,user_b:a});return!!s},enabled:!!(t!=null&&t.id)&&!!a}),{data:d,isLoading:H}=ue(t==null?void 0:t.id,a),{data:o,isLoading:h}=C({queryKey:["connection-endorsements",a,t==null?void 0:t.id],queryFn:async()=>{if(!a)return[];const{data:s,error:n}=await M.from("endorsements").select("*, business_profiles(logo_url, city, state)").eq("user_id",a).in("visibility",["public_to_connections","circles_only"]).order("created_at",{ascending:!1});if(n)throw n;return(s||[]).map(c=>{var f,g,R;return{...c,logo_url:k((f=c.business_profiles)==null?void 0:f.logo_url)||null,biz_city:((g=c.business_profiles)==null?void 0:g.city)||null,biz_state:((R=c.business_profiles)==null?void 0:R.state)||null}})},enabled:!!a&&F===!0}),p=x.useMemo(()=>(o||[]).filter(s=>s.recommendation_type!=="not_recommended"),[o]),N=x.useMemo(()=>(o||[]).filter(s=>s.recommendation_type==="not_recommended"),[o]),w=x.useMemo(()=>{if(!l.trim())return p;const s=l.toLowerCase();return p.filter(n=>{var c,f,g;return((c=n.company_name)==null?void 0:c.toLowerCase().includes(s))||((f=n.industry)==null?void 0:f.toLowerCase().includes(s))||((g=n.description)==null?void 0:g.toLowerCase().includes(s))})},[p,l]),I=s=>{i(`/endorsement/${s}`,{state:{from:`/friends/${a}`,fromLabel:`Back to ${(r==null?void 0:r.first_name)||"Friend"}'s Profile`}})},O=s=>i(`/group/${s}`);if(!t)return i("/signin"),null;if(Y||G||H)return e.jsxs(e.Fragment,{children:[e.jsx(L,{}),e.jsx("div",{className:"min-h-screen bg-card flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-8 h-8 border-4 border-primary border-t-transparent rounded-full animate-spin mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading profile..."})]})})]});if(!r)return i("/friends"),null;if(F===!1)return e.jsxs(e.Fragment,{children:[e.jsx(L,{}),e.jsx("div",{className:"min-h-screen bg-card",children:e.jsx("div",{className:"container max-w-4xl mx-auto px-4 py-8",children:e.jsx(u,{className:"p-12 text-center mt-6 rounded-2xl",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md mx-auto",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center",children:e.jsx(P,{className:"w-8 h-8 text-muted-foreground"})}),e.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Not Connected"}),e.jsx("p",{className:"text-muted-foreground",children:"You need to be friends with this user to view their recommendations."}),e.jsx(S,{onClick:()=>i("/friends"),className:"mt-4",children:"Back to Friends"})]})})})})]});const _=`${r.first_name} ${r.last_name}`,v=J(r.zip_code),b=p.length,j=je(b);return e.jsxs(e.Fragment,{children:[e.jsx(L,{}),e.jsx("div",{className:"min-h-screen bg-card",children:e.jsxs("div",{className:"container mx-auto pt-4 pb-8 px-5 lg:px-8 max-w-[1152px]",children:[e.jsx(u,{className:"p-5 md:p-7 mb-6 rounded-2xl",children:e.jsxs("div",{className:"flex flex-col items-center text-center md:flex-row md:items-start md:text-left gap-4 md:gap-6",children:[e.jsxs(V,{className:"h-[9
16px] w-[96px] sm:h-[88px] sm:w-[88px] shrink-0",children:[e.jsx(W,{src:k(r.avatar_url),alt:_}),e.jsxs(Z,{className:"bg-primary/10 text-primary text-2xl font-medium",children:[((q=r.first_name)==null?void 0:q[0])||"",((A=r.last_name)==null?void 0:A[0])||""]})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h1",{className:"text-2xl md:text-3xl font-bold leading-tight",children:_}),(v||j)&&e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[v,v&&j&&" – ",j&&e.jsx("span",{className:"font-medium",style:{color:"var(--brand-teal)"},children:j.label})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-center md:justify-start gap-x-1.5 text-sm text-muted-foreground mt-1",children:[e.jsxs("span",{children:[b," Recommendation",b!==1?"s":""]}),e.jsx("span",{children:"–"}),e.jsxs("button",{onClick:()=>m.length>0&&z(!0),className:ee(m.length>0?"hover:text-primary transition-colors cursor-pointer underline decoration-muted-foreground/30 hover:decoration-primary":"cursor-default"),disabled:m.length===0,children:[m.length," Mutual Friend",m.length!==1?"s":""]})]}),d&&d.length>0&&e.jsxs("p",{className:"text-sm text-muted-foreground mt-1.5",children:[e.jsx("span",{className:"font-medium",style:{color:"var(--brand-dark)"},children:"Shared Communities:"})," ",d.map((s,n)=>e.jsxs("span",{children:[e.jsx("button",{onClick:()=>O(s.id),className:"hover:text-primary transition-colors underline decoration-muted-foreground/30 hover:decoration-primary",children:s.name}),n<d.length-1&&", "]},s.id))]}),a&&(t==null?void 0:t.id)!==a&&e.jsxs(S,{variant:"default",size:"sm",onClick:()=>E(!0),className:"gap-1.5 w-full md:w-auto mt-3",children:[e.jsx(se,{className:"h-4 w-4"}),"Message ",r.first_name]})]})]})}),e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsx("div",{children:e.jsxs("h2",{className:"text-lg font-semibold",children:["Recommendations from ",r.first_name]})}),b>0&&e.jsxs("div",{className:"relative w-full sm:w-72",children:[e.jsx(te,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(ae,{type:"text",placeholder:"Search providers...",value:l,onChange:s=>y(s.target.value),className:"pl-9 pr-8 h-9"}),l&&e.jsx("button",{onClick:()=>y(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:e.jsx(re,{className:"h-4 w-4"})})]})]})}),h&&e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"w-8 h-8 border-4 border-primary border-t-transparent rounded-full animate-spin"})}),!h&&(!o||o.length===0)&&e.jsx(u,{className:"p-12 text-center rounded-2xl",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md mx-auto",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center",children:e.jsx(P,{className:"w-8 h-8 text-muted-foreground"})}),e.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No recommendations yet"}),e.jsxs("p",{className:"text-muted-foreground",children:[r.first_name," hasn't shared any recommendations with your network yet."]})]})}),!h&&o&&o.length>0&&w.length===0&&l&&e.jsxs(u,{className:"p-8 text-center rounded-2xl",children:[e.jsxs("p",{className:"text-muted-foreground",children:['No providers found matching "',l,'"']}),e.jsx(S,{variant:"link",onClick:()=>y(""),className:"mt-2",children:"Clear search"})]}),!h&&w.length>0&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",children:w.map(s=>e.jsx(u,{onClick:()=>I(s.id),className:"p-4 cursor-pointer rounded-2xl hover:shadow-md hover:border-primary/30 transition-all active:scale-[0.98] group",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(B,{category:s.industry,logoUrl:s.logo_url,size:"sm",className:"w-10 h-10 rounded-lg"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors leading-snug",children:s.company_name}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[D(s.industry),(s.biz_city||s.biz_state)&&e.jsxs(e.Fragment,{children:[" · ",[s.biz_city,s.biz_state].filter(
1Boolean).join(", ")]})]}),s.description&&e.jsx("p",{className:"text-sm text-muted-foreground italic line-clamp-2 mt-1.5",children:s.description}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-2.5 text-xs text-muted-foreground",children:[e.jsx(ne,{className:"h-3 w-3"}),e.jsxs("span",{children:["Recommended by ",r.first_name]}),e.jsx("span",{children:"·"}),e.jsx("span",{children:T(new Date(s.created_at),"MMM d, yyyy")})]})]}),e.jsx($,{className:"w-5 h-5 text-muted-foreground group-hover:text-primary shrink-0 mt-0.5 transition-colors"})]})},s.id))}),!h&&N.length>0&&e.jsx("div",{className:"mt-8",children:e.jsxs(ie,{children:[e.jsxs(oe,{className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors group/neg",children:[e.jsx(le,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Wouldn't Recommend (",N.length,")"]}),e.jsx(de,{className:"w-3.5 h-3.5 transition-transform group-data-[state=open]/neg:rotate-180"})]}),e.jsx(ce,{className:"mt-3",children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",children:N.map(s=>e.jsx(u,{onClick:()=>I(s.id),className:"p-4 cursor-pointer rounded-2xl hover:shadow-md transition-all active:scale-[0.98] group",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(B,{category:s.industry,logoUrl:s.logo_url,size:"sm",className:"w-10 h-10 rounded-lg"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors leading-snug",children:s.company_name}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[D(s.industry),(s.biz_city||s.biz_state)&&e.jsxs(e.Fragment,{children:[" · ",[s.biz_city,s.biz_state].filter(Boolean).join(", ")]})]}),s.description&&e.jsx("p",{className:"text-sm text-muted-foreground italic line-clamp-2 mt-1.5",children:s.description}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-2.5 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["Not recommended by ",r.first_name]}),e.jsx("span",{children:"·"}),e.jsx("span",{children:T(new Date(s.created_at),"MMM d, yyyy")})]})]}),e.jsx($,{className:"w-5 h-5 text-muted-foreground group-hover:text-primary shrink-0 mt-0.5 transition-colors"})]})},s.id))})})]})})]})}),e.jsx(fe,{open:K,onOpenChange:z,memberName:r.first_name,connections:m}),a&&e.jsx(ge,{open:Q,onOpenChange:E,recipientId:a,recipientName:_,recipientAvatarUrl:k(r.avatar_url),contextGroupName:d&&d.length>0?d[0].name:void 0})]})};export{Ee 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.