1import{j as e}from"./vendor-editor-BX0sR0z-.js";import{e as P,r as o,L as S}from"./vendor-react-BPk9u-w4.js";import{d as L,m as s,h as m,l as k}from"./index-Cou2G-4q.js";import{u as A}from"./useNetworkPath-DZ82TrZP.js";import{A as _}from"./index-D3H0nlay.js";import{L as C,N as z,x as R,J as O,s as I,A as D}from"./vendor-icons-CQ1bz0aB.js";import"./vendor-charts-Cf-ruFca.js";import"./vendor-ui-utils-Bbg69IUi.js";import"./vendor-graph-Df3mHyA7.js";import"./vendor-supabase-UBwEW4nm.js";import"./vendor-sonner-DPZ7yCFm.js";import"./vendor-helmet-C74EPpLp.js";const T=5e3,$=6e4,K=()=>{const{currentPortal:u}=L(),{getPath:p}=A(),[l]=P(),a=l.get("payment_id")||l.get("id")||l.get("ref")||null,[i,x]=o.useState(a?"pending":"unknown"),[c,f]=o.useState(null),[d,h]=o.useState(!1),g=o.useRef(Date.now()),b=typeof window<"u"&&(window.location.hostname.startsWith("publicidadelegal.")||window.location.hostname.startsWith("publicidade-legal."))?"/":p("/anuncie/publicidade-legal");o.useEffect(()=>{if(!a||i==="confirmed")return;let t=!1;const r=async()=>{try{const{data:n}=await m.from("checkout_orders").select("status").eq("asaas_payment_id",a).maybeSingle();if(t)return;if((n==null?void 0:n.status)==="confirmed"){const{count:v}=await m.from("legal_documents").select("id",{count:"exact",head:!0}).eq("metadata->>asaas_payment_id",a);if(t)return;f(v??null),x("confirmed");return}Date.now()-g.current>$&&h(!0)}catch(n){k.warn("[LegalAdsPaymentSuccess] poll error:",n)}};r();const N=setInterval(r,T);return()=>{t=!0,clearInterval(N)}},[a,i]);const y=i==="confirmed"?"Pagamento confirmado":i==="pending"?d?"Recebemos seu pedido":"Confirmando seu pagamento":"Pagamento recebido",w=i==="confirmed"?c?`${c} documento${c===1?"":"s"} encaminhado${c===1?"":"s"} para revisão editorial.`:"Seus documentos foram encaminhados para revisão editorial.":i==="pending"?d?"O pagamento via Boleto pode levar até 3 dias úteis para compensar. Você receberá um email assim que for confirmado.":"Aguardando a confirmação do banco. Pode levar até 1 minuto para PIX, mais para Boleto.":"Sua solicitação de publicação legal foi recebida com sucesso. Nossa equipe editorial iniciará o processamento em breve.",j=i==="pending"&&!d;return e.jsxs("div",{className:"min-h-screen bg-white text-zinc-900 font-sans flex flex-col items-center justify-center selection:bg-black selection:text-white px-6",children:[e.jsx(_,{mode:"wait",children:j?e.jsx(s.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0}
1,transition:{type:"spring",stiffness:200,damping:15},className:"w-20 h-20 bg-amber-50 rounded-full flex items-center justify-center mb-8",children:e.jsx(C,{className:"w-10 h-10 text-amber-500 animate-spin"})},"spinner"):e.jsx(s.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:200,damping:15},className:"w-20 h-20 bg-emerald-50 rounded-full flex items-center justify-center mb-8",children:e.jsx(z,{className:"w-10 h-10 text-emerald-500"})},"check")}),e.jsxs(s.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6,delay:.2},className:"text-center max-w-md space-y-4",children:[e.jsx("h1",{className:"text-[32px] sm:text-[38px] font-medium tracking-tight leading-[1.1]",children:y}),e.jsx("p",{className:"text-zinc-500 text-[16px] leading-relaxed",children:w}),a&&e.jsxs("p",{className:"text-[11px] text-zinc-400 font-mono pt-2",children:["Ref: ",a.slice(0,12),"â¦"]})]}),e.jsx(s.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6,delay:.4}
1,className:"mt-10 w-full max-w-md space-y-3",children:[{icon:R,title:"Revisão editorial",desc:"Nosso time revisará e formatará seus documentos.",color:"text-blue-500",bg:"bg-blue-50"},{icon:O,title:"Certificação digital",desc:"Cada documento receberá um hash SHA-256 verificável.",color:"text-emerald-500",bg:"bg-emerald-50"},{icon:I,title:"Publicação",desc:"Os documentos serão publicados na data solicitada.",color:"text-amber-500",bg:"bg-amber-50"}].map((t,r)=>e.jsxs("div",{className:"flex items-start gap-4 p-4 rounded-xl bg-zinc-50 border border-zinc-100",children:[e.jsx("div",{className:`w-9 h-9 rounded-lg ${t.bg} flex items-center justify-center flex-shrink-0`,children:e.jsx(t.icon,{className:`w-4.5 h-4.5 ${t.color}`})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[14px] font-semibold text-zinc-800",children:t.title}),e.jsx("p",{className:"text-[12px] text-zinc-500 leading-relaxed",children:t.desc})]})]},r))}),e.jsx(s.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6,delay:.6},className:"mt-10 w-full max-w-md",children:e.jsxs(S,{to:b,className:"flex items-center justify-center gap-2 w-full bg-black text-white py-4 rounded-xl font-semibold text-[16px] transition-all hover:bg-zinc-800",children:["Voltar ao Portal ",e.jsx(D,{className:"w-4 h-4"})]})}),e.jsxs(s.p,{initial:{opacity:0}
1,animate:{opacity:1},transition:{delay:1},className:"mt-8 text-[11px] text-zinc-400 text-center",children:["© ",new Date().getFullYear()," ",u.name||"Publicidade Legal"," ⢠Certificado por"," ",e.jsx("span",{className:"font-semibold text-zinc-500",children:"Publicidade.Legal"})]})]})};export{K 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.