1import{r as d,j as e,a3 as u,B as f,Q as w,aX as h,e3 as N,z as v,e4 as S,s as j}from"./index-BwaMfbd5.js";import{C as _}from"./circle-check-big-BgY6TOzv.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="68fc33f6-607f-4b96-9dab-d6ee4bf59561",t._sentryDebugIdIdentifier="sentry-dbid-68fc33f6-607f-4b96-9dab-d6ee4bf59561")}catch{}})();function E({projectId:t,variant:r="card",className:a=""}){const[n,s]=d.useState(""),[x,b]=d.useState(""),[o,l]=d.useState("idle"),[c,m]=d.useState(""),p=async i=>{if(i.preventDefault(),!!n.trim()){l("loading"),m("");try{const g=await fetch("https://esptwxlgdbblvnmdpoao.supabase.co/functions/v1/blog-subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project_id:t,email:n.trim(),name:x.trim()||void 0})}),y=await g.json();if(!g.ok){m(y.error||"Error al suscribirse"),l("error");return}l("success"),s(""),b("")}catch{m("Error de conexión"),l("error")}}};return o==="success"?e.jsxs("div",{className:`flex items-center gap-3 ${a}`,children:[e.jsx(_,{className:"h-5 w-5 text-green-400 shrink-0"}),e.jsx("p",{className:"text-sm text-white/60",children:"¡Suscripción exitosa! Recibirás nuestro contenido en tu correo."})]}):r==="inline"?e.jsxs("form",{onSubmit:p,className:`flex items-center gap-2 ${a}`,children:[e.jsx(u,{type:"email",placeholder:"[email protected]",value:n,onChange:i=>s(i.target.value),className:"h-10 bg-white/[0.04] border-white/[0.08] text-white placeholder:text-white/25 text-sm flex-1",required:!0}),e.jsxs(f,{type:"submit",disabled:o==="loading",className:"h-10 bg-[#d62ac2] hover:bg-[#d62ac2]/80 text-white text-sm shrink-0",children:[o==="loading"?e.jsx(w,{className:"h-4 w-4 animate-spin"}):e.jsx(h,{className:"h-4 w-4 mr-1.5"}),"Suscribirme"]}),c&&e.jsx("p",{className:"text-xs text-red-400",children:c})]}):e.jsxs("div",{className:`rounded-2xl border border-white/[0.06] bg-white/[0.02] p-6 ${a}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(h,{className:"h-5 w-5 text-[#d62ac2]"}),e.jsx("h3",{className:"text-lg font-bold text-white/90",children:"SuscrÃbete al newsletter"})]}),e.jsx("p",{className:"text-sm text-white/40 mb-4",children:"Recibe los mejores artÃculos de marketing, SEO e IA directo a tu correo."}),e.jsxs("form",{onSubmit:p,className:"space-y-3",children:[e.jsx(u,{type:"text",placeholder:"Tu nombre (opcional)",value:x,onChange:i=>b(i.target.value),className:"h-10 bg-white/[0.04] border-white/[0.08] text-white placeholder:text-white/25 text-sm"}),e.jsx(u,{type:"email",placeholder:"[email protected]",value:n,onChange:i=>s(i.target.value),className:"h-10 bg-white/[0.04] border-white/[0.08] text-white placeholder:text-white/25 text-sm",required:!0}),e.jsxs(f,{type:"submit",disabled:o==="loading",className:"w-full h-10 bg-[#d62ac2] hover:bg-[#d62ac2]/80 text-white text-sm",children:[o==="loading"?e.jsx(w,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(h,{className:"h-4 w-4 mr-2"}),"Suscribirme gratis"]}),c&&e.jsx("p",{className:"text-xs text-red-400 text-center",children:c})]}),e.jsx("p",{className:"text-[10px] text-white/20 mt-3 text-center",children:"Sin spam. Puedes darte de baja cuando quieras."})]})}function I(){const t=S(),r=N(t);return v({queryKey:["blog-domain-resolve",t],queryFn:async()=>{if(!r)return null;const{data:a,error:n}=await j.from("blog_custom_domains").select("project_id, domain").eq("domain",t).eq("is_active",!0).maybeSingle();if(n||!a)return null;const{data:s}=await j.from("projects").select("id, name, logo_url").eq("id",a.project_id).single();return{projectId:a.project_id,brandName:(s==null?void 0:s.name)||null,brandLogoUrl:(s==null?void 0:s.logo_url)||null,isWhiteLabel:!0}},enabled:!!r,staleTime:5*60*1e3})}export{E as B,I as u}; 2//# sourceMappingURL=usePublicBlogByDomain-D5wEui0k.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.