PageSourceSearch

https://5ducks.ai/assets/company-details-D3fbW3iM.js

js 5ducks.ai collected 2026-10-05 15:17:10 UTC 7,553 bytes, 1 lines download raw bytes

1import{am as A,u as R,w as z,ah as D,a as I,f as M,V as C,ai as F,j as e,B as m,a2 as k,U as O,Y as t,a3 as l,a4 as c,aq as q,$ as r,S as H,as as V,at as K,au as S,av as h,aw as Q,ax as p,O as W}from"./index-BA-hDO3C.js";import{S as G}from"./seo-head-Chmo95B1.js";import{B as f}from"./badge-BmS2sdGI.js";import{A as _,a as Y}from"./alert-tomusxhU.js";import{G as g}from"./globe-B4oBl9ot.js";import{T as J}from"./trending-up-BgCxkwuB.js";import{B as P}from"./building-2-B59OQuVd.js";import{M as X}from"./mail-ZTV35zlk.js";import{R as Z}from"./refresh-cw-Bjqttn03.js";import{S as ee}from"./star-CLniQGze.js";import{L as se}from"./link-2-BvwoERsm.js";function ae(i){return i?i.includes("***"):!1}function ne(i){return i.some(o=>ae(o.email))}function je(){var w,b;const[,i]=A("/company/:slug/:id"),[,o]=R(),{toast:x}=z();D();const{user:y}=I(),{openModal:E}=M(),n=i!=null&&i.id?parseInt(i.id,10):null;console.log("CompanyDetails - Loading company ID:",n);const{data:s,isLoading:N}=C({queryKey:["/api/companies",n],enabled:!!n}),{data:d=[],refetch:B}=C({queryKey:["/api/companies",n,"contacts"],enabled:!!n});console.log("CompanyDetails - Fetched data:",{requestedId:n,fetchedCompany:s?{id:s.id,name:s.name}:null,contactsCount:d.length,contacts:d.map(a=>({id:a.id,name:a.name}))});const u=F({mutationFn:async()=>{if(!n)throw new Error("No company selected");const a=await W("POST",`/api/companies/${n}/enrich-contacts`);if(!a.ok)throw new Error("Failed to enrich contacts");return a.json()},onSuccess:async()=>{await B(),x({title:"Contacts Updated",description:"Successfully refreshed company contact information."})},onError:a=>{x({title:"Update Failed",description:a instanceof Error?a.message:"Failed to update contact information",variant:"destructive"})}});if(N)return e.jsx("div",{className:"container mx-auto py-8",children:e.jsx("p",{children:"Loading company details..."})});if(!s&&!N)return e.jsxs("div",{className:"container mx-auto py-8",children:[e.jsxs("p",{children:["Company not found. ID: ",n]}),e.jsxs(m,{variant:"ghost",className:"mt-4",onClick:()=>o("/"),children:[e.jsx(k,{className:"mr-2 h-4 w-4"}),"Back to Search"]})]});if(!s)return null;const L=()=>
1{if(!n){x({title:"Error",description:"No company selected",variant:"destructive"});return}u.mutate()},T=[{name:"Website Ranking",value:s.ranking||0,icon:g},{name:"Company Size",value:s.size||0,icon:O},{name:"LinkedIn Score",value:s.linkedinProminence||0,icon:J},{name:"Customer Count",value:s.customerCount||0,icon:P}],U=()=>{window.history.length>1?window.history.back():o("/")},v=`https://5ducks.ai/company/${s.slug||s.name.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").substring(0,50)}/${s.id}`,$={"@context":"https://schema.org","@type":"Organization",name:s.name,description:s.description||`${s.name} - B2B company profile`,url:s.website||v,...s.size&&{numberOfEmployees:{"@type":"QuantitativeValue",value:s.size}}};return e.jsxs("div",{className:"container mx-auto py-8",children:[e.jsx(G,{title:`${s.name} - Company Profile`,description:s.description||`View ${s.name} company profile, key contacts, and business information on 5Ducks.`,canonicalUrl:v,type:"website",jsonLd:$}),e.jsxs(m,{variant:"ghost",className:"mb-6",onClick:U,children:[e.jsx(k,{className:"mr-2 h-4 w-4"}),"Back"]}),e.jsxs("div",{className:"grid gap-8",children:[e.jsxs(t,{children:[e.jsx(l,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(c,{className:"text-2xl font-bold",children:s.name}),s.description&&e.jsx(q,{className:"mt-2",children:s.description})]}),e.jsxs(f,{className:"text-lg py-2",variant:s.totalScore&&s.totalScore>70?"default":"secondary",children:["Score: ",s.totalScore??"N/A"]})]})}),e.jsx(r,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:T.map(a=>e.jsx(t,{children:e.jsxs(r,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(a.icon,{className:"h-5 w-5 text-muted-foreground"}),e.jsx("p",{className:"text-sm font-medium",children:a.name})]}),e.jsx("p",{className:"text-2xl font-bold mt-2",children:a.value})]})},a.name))})})]}),!y&&ne(d)&&e.jsxs(_,{className:"bg-gradient-to-r from-primary/10 to-primary/5 border-primary/20",children:[e.jsx(H,{className:"h-4 w-4 text-primary"}),e.jsxs(Y,{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Sign up to see the full email address and run search prompts with AI - 100 credits included."}),e.jsx(m,{size:"sm",onClick:()=>E(),className:"ml-4 shrink-0","data-testid":"button-signup-cta",children:"Sign Up Free"})]})]}),e.jsxs(t,{children:[e.jsx(l,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(c,{className:"flex items-center gap-2",children:[e.jsx(X,{className:"h-5 w-5"}),"Key Contacts"]}),y&&e.jsxs(m,{variant:"outline",onClick:L,disabled:u.isPending,children:[e.jsx(Z,{className:`h-4 w-4 mr-2 ${u.isPending?"animate-spin":""}`}),"Enrich Contacts"]})]})}),e.jsx(r,{children:e.jsxs(V,{children:[e.jsx(K,{children:e.jsxs(S,{children:[e.jsx(h,{children:"Name"}),e.jsx(h,{children:"Role"}),e.jsx(h,{children:"Email"}),e.jsx(h,{children:"Score"})]})}),e.jsx(Q,{children:d.map(a=>e.jsxs(S,{children:[e.jsx(p,{className:"font-medium",children:a.name}),e.jsx(p,{children:a.role}),e.jsx(p,{children:a.email}),e.jsx(p,{children:e.jsx(f,{variant:"secondary",children:a.probability||0})})]},a.id))})]})})]}),((((w=s.services)==null?void 0:w.length)??0)>0||(((b=s.validationPoints)==null?void 0:b.length)??0)>0)&&e.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[s.services&&s.services.length>0&&e.jsxs(t,{children:[e.jsx(l,{children:e.jsx(c,{children:"Services Offered"})}),e.jsx(r,{children:e.jsx("div",{className:"flex flex-wrap gap-2",children:s.services.map((a,j)=>e.jsx(f,{variant:"secondary",children:a},j))})})]}),s.validationPoints&&s.validationPoints.length>0&&e.jsxs(t,{children:[e.jsx(l,{children:e.jsx(c,{children:"Validation Points"})}),e.jsx(r,{children:e.jsx("ul",{className:"space-y-2",children:s.validationPoints.map((a,j)=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(ee,{className:"h-4 w-4 text-yellow-500"}),e.jsx("span",{children:a})]},j))})})]})]}),e.jsxs(t,{children:[e.jsx(l,{children:e.jsxs(c,{className:"flex items-center gap-2",children:[e.jsx(g,{className:"h-5 w-5"}),"Company Information"]})}),e.jsx(r,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(g,{className:"h-5 w-5"}),e.jsx("span",{children:"Company Website:"}),s.website?e.jsx("a",{href:s.website.startsWith("http")?s.website:`https://${s.website}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:s.website}):e.jsx("span",{className:"italic",children:"No website available"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(se,{className:"h-5 w-5"}),e.jsx("span",{children:"Company Profile:"}),s.alternativeProfileUrl?e.jsx("a",{href:s.alternativeProfileUrl,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:s.alternativeProfileUrl}):e.jsx("span",{className:"italic",children:"No profile link available"})]}),s.age&&e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(P,{className:"h-5 w-5"}),e.jsx("span",{children:"Company Age:"}),e.jsxs("span",{children:[s.age," years"]})]})]})})]})]})]})}export{je 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.