1import{a as c,j as e}from"./ui-vendor-Pu0cN9S7.js";import{ah as E,a as S,L as w,c as m,d as y,G as B,aq as P,ar as T,as as L,C as t,r as n,s as d,S as x,b as i,B as h,T as A,at as D,au as O,f as I}from"./index-DVqYXXq7.js";function M(){var N;const{slug:l}=E(),u=S(),[a,C]=c.useState(null),[k,j]=c.useState(!0),[b,o]=c.useState(null);c.useEffect(()=>{if(!l){o("Invalid preview URL"),j(!1);return}(async()=>{try{const v=await fetch("https://worker.rainfactory.ai/rainfactory/anonymous-brands/get_public_preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({publicSlug:l})}),_=await v.json();v.ok?C(_):o(_.error||"Brand preview not found")}catch(r){console.error("Error fetching brand preview:",r),o("Failed to load brand preview")}finally{j(!1)}})()},[l]);const g=s=>{switch(s){case"COMPLETED":return e.jsx(I,{className:"h-4 w-4 text-green-600"});case"PROCESSING":return e.jsx(w,{className:"h-4 w-4 text-blue-600 animate-spin"});case"FAILED":return e.jsx(m,{className:"h-4 w-4 text-red-600"});default:return e.jsx(m,{className:"h-4 w-4 text-gray-400"})}},f=s=>{switch(s){case"COMPLETED":return"Complete";case"PROCESSING":return"Processing";case"FAILED":return"Failed";default:return"Pending"}},p=()=>{u(`/auth?action=claim&flow=brand-claim&brand=${l}&redirectTo=${encodeURIComponent("/onboarding")}`)};return k?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(w,{className:"h-8 w-8 animate-spin mx-auto mb-4 text-primary"}),e.jsx("p",{className:"text-lg font-medium",children:"Loading brand preview..."})]})}):b||!a?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800 flex items-center justify-center",children:e.jsxs("div",{className:"max-w-md mx-auto text-center",children:[e.jsx(m,{className:"h-12 w-12 text-red-500 mx-auto mb-4"}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Preview Not Found"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:b||"This brand preview is no longer available."}),e.jsx(y,{onClick:()=>u("/"),children:"Return Home"})]})}):e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800",children:e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-4xl font-bold mb-2",children:a.brand_data.brand_name||"Brand Analysis"}),e.jsxs("div",{className:"flex items-center justify-center gap-4 text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(B,{className:"h-4 w-4"}),e.jsxs("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",className:"hover:underline",children:[a.url,e.jsx(P,{className:"h-3 w-3 ml-1 inline"})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"h-4 w-4"}),e.jsxs("span",{children:[a.views_count," views"]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(L,{className:"h-4 w-4"}),e.jsx("span",{children:new Date(a.created_at).toLocaleDateString()})]})]})]}),e.jsx("div",{className:"max-w-2xl mx-auto mb-8",children:e.jsxs(t,{children:[e.jsx(n,{children:e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(x,{className:"h-5 w-5"}),"Analysis Status"]})}),e.jsxs(i,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Website Scraping"}),e.jsxs("div",{className:"flex items-center gap-2",children:[g(a.scraping_status),e.jsx(h,{variant:a.scraping_status==="COMPLETED"?"default":"secondary",children:f(a.scraping_status)})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"Brand Analysis"}),e.jsxs("div",{className:"flex items-center gap-2",children:[g(a.brand_analysis_status),e.jsx(h,{variant:a.brand_analysis_status==="COMPLETED"?"default":"secondary",children:f(a.brand_analysis_status)})]})]})]})]})}),e.jsxs("div",{className:"max-w-4xl mx-auto grid md:grid-cols-2 gap-6 mb-8",children:[e.jsxs(t,{children:[e.jsx(n,{children:e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(A,{className:"h-5 w-5"}),"Brand Overview"]})}),e.jsxs(i,{className:"space-y-4",children:[a.brand_data.elevator_pitch&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Elevator Pitch"}),e.jsx("p",{className:"text-muted-foreground",children:a.brand_data.elevator_pitch})]}),a.brand_data.target_market&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Target Market"}),e.jsx("p",{className:"text-muted-foreground",children:a.brand_data.target_market})]}),a.brand_data.niche&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Niche"}),e.jsx("p",{className:"text-muted-foreground",children:a.brand_data.niche})]}),a.brand_data.b2b_b2c&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Business Model"}),e.jsx(h,{children:a.brand_data.b2b_b2c})]})]})]}),e.jsxs(t,{children:[e.jsx(n,{children:e.jsx(d,{children:"Brand Details"})}),e.jsxs(i,{className:"space-y-4",children:[a.brand_data.value_props&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Value Propositions"}),e.jsx("p",{className:"text-muted-foreground",children:a.brand_data.value_props})]}),a.brand_data.differentiators&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Differentiators"}),e.jsx("p",{className:"text-muted-foreground",children:a.brand_data.differentiators})]}),a.brand_data.brand_voice&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Brand Voice"}),e.jsx("p",{className:"text-muted-foreground",children:a.brand_data.brand_voice})]}),a.brand_data.call_to_action&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Call to Action"}),e.jsx("p",{className:"text-muted-foreground",children:a.brand_data.call_to_action})]})]})]})]}),(a.brand_data.products_overview||a.brand_data.target_geography)&&e.jsx("div",{className:"max-w-4xl mx-auto mb-8",children:e.jsxs(t,{children:[e.jsx(n,{children:e.jsx(d,{children:"Additional Information"})}),e.jsxs(i,{className:"space-y-4",children:[a.brand_data.products_overview&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Products Overview"}),e.jsx("p",{className:"text-muted-foreground",children:a.brand_data.products_overview})]}),a.brand_data.target_geography&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Target Geography"}),e.jsx("p",{className:"text-muted-foreground",children:a.brand_data.target_geography})]})]})]})}),((N=a.metadata)==null?void 0:N.images)&&a.metadata.images.length>0&&e.jsx("div",{className:"max-w-4xl mx-auto mb-8",children:e.jsxs(t,{children:[e.jsx(n,{children:e.jsx(d,{children:"Brand Images"})}),e.jsx(i,{children:e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:a.metadata.images.map((s,r)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-gray-100",children:e.jsx("img",{src:s.url,alt:s.description||`Brand image ${r+1}`,className:"absolute inset-0 w-full h-full object-cover",loading:"lazy"})}),s.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:s.description})]},r))})})]})}),e.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[e.jsxs(D,{className:"mb-6",children:[e.jsx(x,{className:"h-4 w-4"}),e.jsx(O,{children:"This is a preview of your brand analysis. Sign up to claim this brand, get the full analysis, and start creating content with Rainfactory."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(y,{size:"lg",onClick:p,className:"w-full md:w-auto",children:[e.jsx(x,{className:"h-4 w-4 mr-2"}),"Claim This Brand & Get Started"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Already have an account? ",e.jsx("button",{onClick:p,className:"underline hover:no-underline",children:"Sign in to claim"})]})]})]})]})})}export{M as default}; 2//# sourceMappingURL=BrandPreview-D1OVqlFF.js.map
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.