PageSourceSearch

https://crazyleads.com.br/_next/static/chunks/4390.cd1330c5edd9757d.js

js crazyleads.com.br collected 2026-09-24 14:35:45 UTC 29,254 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},s=(new e.Error).stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="b0d6df53-5d23-4f3e-ada9-c0c6dd65f8c3",e._sentryDebugIdIdentifier="sentry-dbid-b0d6df53-5d23-4f3e-ada9-c0c6dd65f8c3")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4390],{34390:function(e,s,a){a.r(s),a.d(s,{MetaCapiDetailTemplate:function(){return K}});var n=a(57437),t=a(79455),r=a(57175),o=a(65252),i=a(23882),l=a(99199),d=a(29827),c=a(71632),x=a(21770),u=a(76865),m=a(82431),p=a(51817),h=a(11239),f=a(83578),g=a(99397),v=a(27648),j=a(2265),b=a(14438),N=a(86659),y=a(63935),w=a(30401),k=a(55799);function C(e){let{projectId:s,destinationId:a,subscriptions:i}=e,l=(0,d.NL)(),[m,h]=(0,j.useState)({}),[f,g]=(0,j.useState)(null),v=i.some(e=>"pixel.event.resolved"===e.signal_type),N=(0,c.a)({queryKey:["pixel-semantic-catalog",s],queryFn:()=>o.d.getSemanticCatalog(s),enabled:!!s&&v,staleTime:3e4}),C=(0,x.D)({mutationFn:e=>o.d.approveEvent(s,a,e),onMutate:e=>g(e.src_event),onSuccess:(e,n)=>{l.invalidateQueries({queryKey:["actions","subscriptions",s,a]}),l.invalidateQueries({queryKey:["pixel-semantic-catalog",s]});let t=null==e?void 0:e.warning,r="missing_value_currency"===t?"".concat(n.meta_event," exige value e currency e o evento ainda n\xe3o mapeia esses campos. O Meta pode rejeitar as entregas at\xe9 voc\xea configur\xe1-los."):t;b.Am.success("".concat(n.src_event," aprovado, enviando como ").concat(n.meta_event),r?{description:r}:void 0)},onError:e=>{b.Am.error("N\xe3o foi poss\xedvel aprovar o evento",{description:e.message})},onSettled:()=>g(null)});if(!v)return null;let _=(0,k.gm)(i),D=Object.entries(_),F=N.data?(0,k.Hn)(N.data.data).defined:[],E=(0,k.yh)(F,_);return(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsx)("h2",{className:"font-sans text-[13px] font-semibold leading-4 text-foreground",children:"Eventos enviados"}),0===D.length?(0,n.jsx)("div",{className:"rounded-lg border border-dashed bg-muted/30 p-4",children:(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"Nenhum evento do pixel aprovado pra envio ainda. Aprove abaixo ou reative os padr\xf5es no wizard."})}):(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:D.map(e=>{let[s,a]=e;return(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md border border-[#BBF7D0] bg-[#F0FDF4] px-2 py-1 text-[11px] font-medium text-[#15803D]",children:[(0,n.jsx)(w.Z,{className:"h-3 w-3"}),(0,n.jsx)("code",{className:"font-mono",children:s}),a!==s&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"text-[#15803D]/60",children:"→"}),(0,n.jsx)("code",{className:"font-mono",children:a})]})]},s)})}),N.isLoading?(0,n.jsx)(r.O,{className:"h-[42px] w-full rounded-lg"}):N.isError?(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-dashed bg-muted/30 px-3.5 py-2.5",children:[(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"N\xe3o foi poss\xedvel carregar a fila de aprova\xe7\xe3o (cat\xe1logo sem\xe2ntico indispon\xedvel)."}),(0,n.jsx)(t.z,{size:"sm",variant:"outline",className:"h-7 shrink-0 text-xs",onClick:()=>N.refetch(),children:"Tentar novamente"})]}):E.length>0?(0,n.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,n.jsx)("p",{className:"text-[11px] font-medium text-muted-foreground",children:"Aguardando aprova\xe7\xe3o: definidos na aba Eventos do pixel, mas ainda n\xe3o enviados:"}),(0,n.jsx)("div",{className:"flex flex-col overflow-hidden rounded-lg border",children:E.map((e,s)=>{var a;let r=null!==(a=m[e.canonical])&&void 0!==a?a:e.canonical,o=k.hU.has(r),i=f===e.canonical,l=k.Qq.includes(e.canonical)?k.Qq:[e.canonical,...k.Qq];return(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 px-3.5 py-2.5 ".concat(s<E.length-1?"border-b":""),children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("code",{className:"min-w-0 grow truncate font-mono text-xs text-foreground",children:e.canonical}),(0,n.jsxs)("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:[e.volume30d.toLocaleStr
1ing("pt-BR")," /30d"]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,n.jsx)("span",{className:"text-[11px] text-muted-foreground",children:"enviar como"}),(0,n.jsxs)(y.Ph,{value:r,onValueChange:s=>h(a=>({...a,[e.canonical]:s})),children:[(0,n.jsx)(y.i4,{className:"h-7 w-[180px] text-xs",children:(0,n.jsx)(y.ki,{})}),(0,n.jsx)(y.Bw,{children:l.map(e=>(0,n.jsx)(y.Ql,{value:e,children:e},e))})]})]}),(0,n.jsxs)(t.z,{size:"sm",variant:"outline",className:"h-7 shrink-0 gap-1.5 px-2.5 text-xs",disabled:C.isPending,onClick:()=>C.mutate({src_event:e.canonical,meta_event:r}),children:[i?(0,n.jsx)(p.Z,{className:"h-3 w-3 animate-spin"}):(0,n.jsx)(w.Z,{className:"h-3 w-3"}),"Aprovar"]})]}),o&&(0,n.jsxs)("div",{className:"flex items-start gap-1.5 rounded-md border border-[#FDE68A] bg-[#FFFBEB] p-2",children:[(0,n.jsx)(u.Z,{className:"mt-0.5 h-3 w-3 shrink-0 text-[#B45309]"}),(0,n.jsxs)("span",{className:"text-[11px] leading-4 text-[#92400E]",children:[(0,n.jsx)("strong",{children:r})," exige"," ",(0,n.jsx)("code",{className:"font-mono",children:"value"})," e"," ",(0,n.jsx)("code",{className:"font-mono",children:"currency"}),". Garanta que o evento do pixel carrega esses dados (ou o Meta rejeita a entrega)."]})]})]},e.canonical)})})]}):null]})}var _=a(92934),D=a(88414),F=a(88827);function E(e){let{open:s,onOpenChange:a,projectId:r,destinationId:o,onViewDeliveries:i}=e,[l,d]=(0,j.useState)(null);return(0,j.useEffect)(()=>{s&&d(null)},[s]),(0,n.jsx)(D.yo,{open:s,onOpenChange:a,children:(0,n.jsxs)(D.ue,{className:"flex w-full flex-col sm:max-w-md",children:[(0,n.jsxs)(D.Tu,{children:[(0,n.jsx)(D.bC,{children:"Conectar outra fonte"}),(0,n.jsx)(D.Ei,{children:'Escolha qual fonte deste projeto deve alimentar esta integra\xe7\xe3o Meta CAPI. Cada fonte conecta na hora que voc\xea clica em "Conectar".'})]}),(0,n.jsxs)("div",{className:"flex-1 space-y-3 overflow-y-auto py-2",children:[l&&(0,n.jsxs)("div",{className:"flex items-start gap-2.5 rounded-lg border border-[#BBF7D0] bg-[#F0FDF4] p-3",children:[(0,n.jsx)(_.Z,{className:"mt-0.5 h-4 w-4 shrink-0 text-[#15803D]"}),(0,n.jsxs)("div",{className:"flex min-w-0 grow flex-col gap-1.5",children:[(0,n.jsxs)("p",{className:"text-xs leading-4 text-[#15803D]",children:[(0,n.jsx)("strong",{children:l})," conectado. Aguardando a primeira entrega. Ela aparecer\xe1 em \xdaltimas entregas."]}),(0,n.jsx)(t.z,{type:"button",size:"sm",variant:"outline",className:"h-7 w-fit gap-1.5 border-[#BBF7D0] bg-transparent px-2.5 text-xs text-[#15803D] hover:bg-[#DCFCE7]",onClick:i,children:"Ver entregas"})]})]}),(0,n.jsx)(F.Q9,{mode:"immediate",projectId:r,currentDestinationId:o,onConnected:e=>{let{label:s}=e;return d(s)}})]}),(0,n.jsx)(D.FF,{className:"gap-2 sm:gap-2",children:(0,n.jsx)(t.z,{variant:"outline",onClick:()=>a(!1),children:"Fechar"})})]})})}var A=a(71533),P=a(18930),q=a(96362),z=a(39612),S=a(56372),T=a(27064),I=a(24028),O=a(5616),Z=a(22365);function B(e){let{subscription:s,projectId:a,destinationId:r,projectSlug:l}=e,c=(0,d.NL)(),[u,m]=(0,j.useState)(!1),[h,f]=(0,j.useState)(!1),g=["actions","subscriptions",a,r],N=["actions","destinations",a],y=(0,x.D)({mutationFn:e=>o.d.updateSubscription(a,r,s.id,{enabled:e}),onSuccess:(e,s)=>{c.invalidateQueries({queryKey:g}),b.Am.success(s?"Fonte ativada":"Fonte pausada")},onError:e=>{b.Am.error("N\xe3o foi poss\xedvel atualizar a fonte",{description:e.message})}}),w=(0,x.D)({mutationFn:()=>o.d.deleteSubscription(a,r,s.id),onSuccess:()=>{b.Am.success("Fonte desconectada"),c.invalidateQueries({queryKey:g}),c.invalidateQueries({queryKey:N}),m(!1),f(!1)},onError:e=>{b.Am.error("N\xe3o foi poss\xedvel remover a fonte",{description:e.message})}}),k=(0,O.Tz)(s.signal_type),C=k.icon,_=y.isPending||w.isPending,D=s.signal_source_id?"/projects/".concat(l,"/sources/").concat(s.signal_source_id):null,{allSources:F}=(0,Z.Xt)(),E=(0,Z.wY)(F,s.signal_source_id),B=null!=E?E:(0,O.K3)(s.signal_type),K=E?(0,O.K3)(s.signal_type):"pixel.event.resolved"===s.signal_type?"Eventos de navega\xe7\xe3o resolvidos":"lead.created"===s.signal_type?"Qualquer fonte deste projeto":"Sinal conectado";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(T.J2,{open:h,onOpenChange:f,children:[(0,n.jsx)(T.xo,{asChild:!0,children:(0,n.jsxs)("div",{role:"button",tabIndex:0,className:"flex grow basis-[220px] cursor-pointer items-center gap-[10px] rounded-lg border border-border px-[14px] py-3 transition-colors hover:bg-accent/30",children:[(0,n.jsx)("div",{className:(0,i.cn)("flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-[7px]",k.bg),children:(0,n.jsx)(C,{className:(0,i.cn)("h-[13px] w-[13px]",k.iconClass)})}),(0,n.jsxs)("div",{className:"flex min-w-0 grow flex-col gap-px",children:[(0,n.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,n.jsx)("span",{className:"truncate font-sans text-xs font-semibold leading-4 text-foreground",children:B}),(0,n.jsxs)("span",{className:(0,i.cn)("flex shrink-0 items-center gap-1 rounded-full px-[7px] py-px",s.enabled?"bg-[#DCFCE7]":"bg-gray-100 dark:bg-gray-800"),children:[(0,n.jsx)("span",{className:(0,i.cn)("size-1 shrink-0 rounded-full",s.enabled?"bg-[#22C55E]":"bg-gray-400")}),(0,n.jsx)("span",{className:(0,i.cn)("font-sans text-[9px] font-medium leading-3",s.enabled?"text-[#15803D]":"text-gray-500 dark:text-gray-400"),children:s.enabled?"enviando":"inativo"})]})]}),(0,n.jsx)("span",{className:"truncate font-sans text-[11px] leading-[14px] text-muted-foreground",children:K})]}),(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-1",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)(I.r,{checked:s.enabled,disabled:_,onCheckedChange:e=>y.mutate(e),"aria-label":s.enabled?"Pausar fonte":"Ativar fonte",className:"scale-90"}),(0,n.jsxs)(S.h_,{children:[(0,n.jsx)(S.$F,{asChild:!0,children:(0,n.jsxs)(t.z,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",disabled:_,onClick:e=>e.stopPropagation(),children:[(0,n.jsx)(A.Z,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,n.jsx)("span",{className:"sr-only",children:"Mais a\xe7\xf5es"})]})}),(0,n.jsx)(S.AW,{align:"end",onClick:e=>e.stopPropagation(),children:(0,n.jsxs)(S.Xi,{className:"text-destructive focus:text-destructive",onSelect:e=>{e.preventDefault(),m(!0)},children:[(0,n.jsx)(P.Z,{className:"mr-2 h-3.5 w-3.5"}),"Remover"]})})]})]})]})}),(0,n.jsxs)(T.yk,{className:"w-72 space-y-3",align:"start",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:(0,i.cn)("flex h-7 w-7 shrink-0 items-center justify-center rounded-md",k.bg),children:(0,n.jsx)(C,{className:(0,i.cn)("h-3.5 w-3.5",k.iconClass)})}),(0,n.jsxs)("div",{className:"flex min-w-0 flex-col",children:[(0,n.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:B}),(0,n.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:K})]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-2",children:[(0,n.jsx)("span",{className:"text-xs font-medium text-foreground",children:s.enabled?"Enviando":"Inativo"}),(0,n.jsx)(I.r,{checked:s.enabled,disabled:_,onCheckedChange:e=>y.mutate(e),"aria-label":s.enabled?"Pausar fonte":"Ativar fonte"})]}),D&&(0,n.jsxs)(v.default,{href:D,className:"flex items-center gap-1.5 text-xs font-medium text-[#16A34A] transition-colors hover:text-[#15803D]",children:[(0,n.jsx)(q.Z,{className:"h-3 w-3"}),"Abrir fonte"]}),(0,n.jsxs)(t.z,{variant:"outline",size:"sm",className:"w-full gap-1.5 text-destructive hover:text-destructive",disabled:_,onClick:()=>m(!0),children:[w.isPending?(0,n.jsx)(p.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,n.jsx)(P.Z,{className:"h-3.5 w-3.5"}),"Remover fonte"]})]})]}),(0,n.jsx)(z.aR,{open:u,onOpenChange:m,children:(0,n.jsxs)(z._T,{children:[(0,n.jsxs)(z.fY,{children:[(0,n.jsx)(z.f$,{children:"Remover esta fonte?"}),(0,n.jsxs)(z.yT,{children:["A integra\xe7\xe3o deixa de receber eventos de"," ",(0,n.jsx)("strong",{children:B}),". Essa a\xe7\xe3o n\xe3o pode ser desfeita."]})]}),(0,n.jsxs)(z.xo,{children:[(0,n.jsx)(z.le,{disabled:w.isPending,children:"Cancelar"}),(0,n.jsx)(z.OL,{variant:"destructive",disabled:w.isPending,onClick:e=>{e.preventDefault(),w.mutate()},children:w.isPending?"Removendo...":"Remover"})]})]})})]})}function K(e){var s,a,y,w,k,_,D,F,A,P,q;let{destinationId:z}=e,S=(0,l.i)(e=>e.project),T=null!==(y=null==S?void 0:S.uuid)&&void 0!==y?y:"",I=null!==(w=null==S?void 0:S.slug)&&void 0!==w?w:"",Z=(0,d.NL)(),K="/projects/".concat(I,"/ads/meta-capi"),[M,Q]=(0,j.use
1State)(null),[R,L]=(0,j.useState)(!1),[V,H]=(0,j.useState)(!1),[J,W]=(0,j.useState)(20),Y=(0,j.useRef)(null),G=(0,j.useCallback)(()=>{L(!1),requestAnimationFrame(()=>{var e;null===(e=Y.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"})})},[]),{data:X,isLoading:$,isError:U,refetch:ee}=(0,c.a)({queryKey:["actions","destinations",T],queryFn:()=>o.d.listDestinations(T),enabled:!!T,staleTime:3e4}),es=null!==(_=(null!==(k=null==X?void 0:X.data)&&void 0!==k?k:[]).find(e=>e.id===z&&"facebook_capi"===e.type))&&void 0!==_?_:null,{data:ea,isLoading:en}=(0,c.a)({queryKey:["actions","subscriptions",T,z],queryFn:()=>o.d.listSubscriptions(T,z),enabled:!!T&&!!z&&!!es,staleTime:3e4}),{data:et,isLoading:er,isError:eo}=(0,c.a)({queryKey:["actions","deliveries",T,z,"24h"],queryFn:()=>o.d.listDeliveryStats(T,z,{hours:24}),enabled:!!T&&!!z&&!!es,staleTime:3e4}),{data:ei,isLoading:el}=(0,c.a)({queryKey:["actions","deliveries",T,z,"recent",J],queryFn:()=>o.d.listDeliveries(T,z,{limit:J}),enabled:!!T&&!!z&&!!es,staleTime:15e3}),ed=(0,x.D)({mutationFn:()=>o.d.testDestination(T,z),onSuccess:e=>{e.success?b.Am.success("Conex\xe3o OK: HTTP ".concat(e.http_status),{description:"Lat\xeancia: ".concat(e.latency_ms,"ms")}):b.Am.error("Falha na conex\xe3o: HTTP ".concat(e.http_status),{description:e.response_body||void 0})},onError:e=>{b.Am.error("Erro ao testar conex\xe3o",{description:e.message})}}),ec=(0,x.D)({mutationFn:()=>o.d.reactivateDestination(T,z),onSuccess:e=>{var s;let a=!!(e.truncated||e.dispatch_failed);H(a),b.Am.success("Reconectado: ".concat(null!==(s=e.requeued)&&void 0!==s?s:0," entrega(s) reenfileirada(s)").concat(a?" (parcial: clique em 'Reenviar retidos' para drenar o resto)":"")),Z.invalidateQueries({queryKey:["actions","destinations",T]}),Z.invalidateQueries({queryKey:["actions","deliveries",T,z]})},onError:e=>{b.Am.error("N\xe3o foi poss\xedvel reconectar",{description:e.message})}}),ex=["actions","destinations",T],eu=(0,x.D)({mutationFn:e=>o.d.updateDestination(T,z,{enabled:e}),onMutate:async e=>{await Z.cancelQueries({queryKey:ex});let s=Z.getQueryData(ex);return Z.setQueryData(ex,s=>s?{...s,data:s.data.map(s=>s.id===z?{...s,enabled:e}:s)}:s),{previous:s}},onError:(e,s,a)=>{(null==a?void 0:a.previous)&&Z.setQueryData(ex,a.previous),b.Am.error("N\xe3o foi poss\xedvel atualizar o estado dos envios",{description:e.message})},onSuccess:(e,s)=>{b.Am.success(s?"Envios retomados":"Envios pausados")},onSettled:()=>{Z.invalidateQueries({queryKey:ex})}});if(!T)return(0,n.jsx)("div",{className:"p-6 text-muted-foreground",children:"Selecione um projeto."});if($)return(0,n.jsxs)("div",{className:"p-6 space-y-6",children:[(0,n.jsx)(r.O,{className:"h-8 w-64"}),(0,n.jsx)(r.O,{className:"h-24 w-full rounded-xl"}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,n.jsx)(r.O,{className:"h-24 w-full rounded-xl"}),(0,n.jsx)(r.O,{className:"h-24 w-full rounded-xl"})]}),(0,n.jsx)(r.O,{className:"h-64 w-full rounded-xl"})]});if(U)return(0,n.jsx)("div",{className:"p-6",children:(0,n.jsxs)("div",{className:"rounded-lg border border-dashed bg-muted/30 p-12 text-center",children:[(0,n.jsx)("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:(0,n.jsx)(u.Z,{className:"h-5 w-5 text-muted-foreground"})}),(0,n.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"N\xe3o foi poss\xedvel carregar a integra\xe7\xe3o"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Falha ao consultar o servidor. Verifique sua conex\xe3o e tente novamente."}),(0,n.jsx)(t.z,{variant:"outline",className:"mt-4",onClick:()=>ee(),children:"Tentar novamente"})]})});if(!es)return(0,n.jsx)("div",{className:"p-6",children:(0,n.jsxs)("div",{className:"rounded-lg border border-dashed bg-muted/30 p-12 text-center",children:[(0,n.jsx)("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:(0,n.jsx)(u.Z,{className:"h-5 w-5 text-muted-foreground"})}),(0,n.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:"Integra\xe7\xe3o n\xe3o encontrada"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Esta integra\xe7\xe3o Meta CAPI n\xe3o existe ou foi removida."}),(0,n.jsx)(t.z,{asChild:!0,variant:"outline",className:"mt-4",children:(0,n.jsx)(v.default,{href:K,children:"Voltar para Meta CAPI"})})]})});let em=(0,O.DZ)(es.health_status),ep=O.vG.has(es.health_status),eh=null!==(F=null!==(D=null===(s=es.config)||void 0===s?void 0:s.pixel_id)&&void 0!==D?D:null===(a=es.config)||void 0===a?void 0:a.pixelId)&&void 0!==F?F:null,ef=null!==(A=null==ea?void 0:ea.data)&&void 0!==A?A:[],eg=null!==(P=null==et?void 0:et.data)&&void 0!==P?P:[],ev=eg.reduce((e,s)=>{var a;return e+(null!==(a=s.sent)&&void 0!==a?a:0)},0),ej=eg.reduce((e,s)=>{var a,n;return e+(null!==(a=s.failed)&&void 0!==a?a:0)+(null!==(n=s.dead)&&void 0!==n?n:0)},0),eb=er||eo,eN=null!==(q=null==ei?void 0:ei.data)&&void 0!==q?q:[],ey=e=>(0,n.jsxs)(t.z,{size:"sm",disabled:ec.isPending,onClick:()=>ec.mutate(),className:(0,i.cn)("h-8 px-3 rounded-md gap-1.5 border-0 shrink-0","banner"===e&&"h-9","bg-[#DC2626] text-white hover:bg-[#DC2626]/90"),children:[(0,n.jsx)(m.Z,{className:(0,i.cn)("h-3.5 w-3.5",ec.isPending&&"animate-spin")}),ec.isPending?"Reconectando...":"Reconectar"]});return(0,n.jsxs)("div",{className:"flex flex-col grow bg-background",children:[(0,n.jsxs)("div",{className:"flex items-center h-10 shrink-0 px-5 gap-2 border-b border-border",children:[(0,n.jsx)(v.default,{href:K,className:"font-sans text-xs leading-4 text-muted-foreground hover:text-foreground transition-colors",children:"M\xeddia Paga"}),(0,n.jsx)("span",{className:"font-sans text-xs leading-4 text-muted-foreground",children:"/"}),(0,n.jsx)(v.default,{href:K,className:"font-sans text-xs leading-4 text-muted-foreground hover:text-foreground transition-colors",children:"Meta CAPI"}),(0,n.jsx)("span",{className:"font-sans text-xs leading-4 text-muted-foreground",children:"/"}),(0,n.jsx)("span",{className:"font-sans text-xs font-medium leading-4 text-foreground truncate",children:es.name})]}),(0,n.jsxs)("div",{className:"flex items-center shrink-0 py-[14px] px-5 gap-3",children:[(0,n.jsx)("div",{className:"w-[34px] h-[34px] flex items-center justify-center shrink-0 rounded-lg bg-[#1877F2]",children:(0,n.jsx)("span",{className:"font-sans text-[17px] font-bold leading-[22px] text-white",children:"f"})}),(0,n.jsxs)("div",{className:"flex flex-col grow min-w-0 gap-px",children:[(0,n.jsxs)("span",{className:"font-sans text-sm font-semibold leading-[18px] text-foreground truncate",children:[es.name,eh?" \xb7 ".concat(eh):""]}),(0,n.jsxs)("span",{className:"text-[11px] font-['JetBrains_Mono',monospace] leading-[14px] text-muted-foreground truncate",children:["Meta CAPI \xb7 conectado a ",ef.length," ",1===ef.length?"fonte":"fontes"]})]}),(0,n.jsxs)("div",{className:"flex items-center shrink-0 gap-[10px]",children:[(0,n.jsx)("span",{className:(0,i.cn)("w-[6px] h-[6px] rounded-full shrink-0",em.statusDotColor)}),(0,n.jsx)("span",{className:"font-sans text-xs leading-4 text-muted-foreground",children:em.statusWord}),(0,n.jsx)("button",{type:"button",role:"switch","aria-checked":es.enabled,"aria-label":es.enabled?"Pausar envios":"Retomar envios",disabled:eu.isPending,onClick:()=>eu.mutate(!es.enabled),className:(0,i.cn)("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors disabled:opacity-50 disabled:cursor-not-allowed",es.enabled?"bg-primary":"bg-input"),children:(0,n.jsx)("span",{className:(0,i.cn)("inline-block h-4 w-4 transform rounded-full bg-background shadow transition-transform",es.enabled?"translate-x-[18px]":"translate-x-[2px]")})})]})]}),(0,n.jsxs)("div",{className:"flex flex-col grow py-4 px-5 gap-[14px]",children:[(0,n.jsxs)("div",{className:"flex items-center gap-[10px] flex-wrap",children:[(0,n.jsx)("span",{className:(0,i.cn)("w-[7
1px] h-[7px] rounded-full shrink-0",em.statusDotColor)}),(0,n.jsx)("span",{className:"font-sans text-[13px] font-semibold leading-4 text-foreground",children:em.statusWord}),(0,n.jsxs)("span",{className:"font-sans text-xs leading-4 text-muted-foreground truncate",children:[es.name,eh?" \xb7 ".concat(eh):""]}),(0,n.jsx)("div",{className:"grow"}),(0,n.jsxs)(t.z,{variant:"outline",size:"sm",className:"h-[28px] px-3 rounded-md gap-1.5",onClick:()=>ed.mutate(),disabled:ed.isPending,children:[ed.isPending?(0,n.jsx)(p.Z,{className:"h-[11px] w-[11px] animate-spin"}):(0,n.jsx)(h.Z,{className:"h-[11px] w-[11px]"}),"Testar conex\xe3o"]}),ep&&ey("header"),!ep&&V&&(0,n.jsxs)(t.z,{size:"sm",variant:"outline",className:"h-8 px-3 rounded-md gap-1.5",disabled:ec.isPending,onClick:()=>ec.mutate(),children:[(0,n.jsx)(m.Z,{className:(0,i.cn)("h-3.5 w-3.5",ec.isPending&&"animate-spin")}),ec.isPending?"Reenviando...":"Reenviar retidos"]}),!ep&&!V&&(0,n.jsx)(t.z,{variant:"outline",size:"sm",className:"h-[28px] px-3 rounded-md gap-1.5",disabled:eu.isPending,onClick:()=>eu.mutate(!es.enabled),children:es.enabled?"Pausar envios":"Retomar envios"})]}),"paused"===es.health_status&&(0,n.jsxs)("div",{className:"rounded-lg border-[1.5px] border-[#FCA5A5] bg-[#FEF2F2] p-4 flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,n.jsx)(u.Z,{className:"h-4 w-4 text-[#DC2626] mt-0.5 shrink-0"}),(0,n.jsxs)("p",{className:"text-sm text-[#991B1B]",children:["Pausamos os envios automaticamente ap\xf3s"," ",es.consecutive_failures||0," falhas consecutivas (circuit breaker). Nenhum evento foi perdido, tudo ser\xe1 reenviado ao reconectar."]})]}),ey("banner")]}),"credentials_invalid"===es.health_status&&(0,n.jsxs)("div",{className:"rounded-lg border border-[#FDE68A] bg-[#FFFBEB] p-4 flex items-start gap-2.5",children:[(0,n.jsx)(f.Z,{className:"h-4 w-4 text-[#B45309] mt-0.5 shrink-0"}),(0,n.jsx)("p",{className:"text-sm text-[#92400E]",children:"Token inv\xe1lido ou expirado. Gere um novo token e teste a conex\xe3o."})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsx)("h2",{className:"font-sans text-[13px] font-semibold leading-4 text-foreground",children:"Fontes que alimentam esta integra\xe7\xe3o"}),en?(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)(r.O,{className:"h-[62px] flex-1"}),(0,n.jsx)(r.O,{className:"h-[62px] w-[190px]"})]}):(0,n.jsxs)("div",{className:"flex gap-3 flex-wrap",children:[ef.map(e=>(0,n.jsx)(B,{subscription:e,projectId:T,destinationId:z,projectSlug:I},e.id)),(0,n.jsxs)("button",{type:"button",onClick:()=>L(!0),className:"flex items-center justify-center w-[190px] shrink-0 py-3 px-[14px] rounded-lg gap-1.5 border border-dashed border-input hover:bg-accent/40 transition-colors",children:[(0,n.jsx)(g.Z,{className:"h-3 w-3 text-muted-foreground"}),(0,n.jsx)("span",{className:"font-sans text-[11px] font-medium leading-[14px] text-muted-foreground",children:"Conectar outra fonte"})]})]})]}),(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsxs)("div",{className:"flex flex-col grow py-[14px] px-4 rounded-lg gap-1 border border-border",children:[(0,n.jsx)("span",{className:"font-sans text-[11px] leading-[14px] text-muted-foreground",children:"Enviados (24h)"}),(0,n.jsx)("span",{className:"font-sans text-[22px] font-semibold leading-[28px] text-foreground",children:eb?"":ev}),(0,n.jsx)("span",{className:"font-sans text-[11px] leading-[14px] text-muted-foreground",children:"\xfaltimas 24 horas"})]}),(0,n.jsxs)("div",{className:"flex flex-col grow py-[14px] px-4 rounded-lg gap-1 border border-border",children:[(0,n.jsx)("span",{className:"font-sans text-[11px] leading-[14px] text-muted-foreground",children:"Falhas (24h)"}),(0,n.jsx)("span",{className:(0,i.cn)("font-sans text-[22px] font-semibold leading-[28px]",!eb&&ej>0?"text-[#DC2626]":"text-foreground"),children:eb?"":ej}),(0,n.jsx)("span",{className:"font-sans text-[11px] leading-[14px] text-muted-foreground",children:"retentativa autom\xe1tica ativa"})]})]}),!en&&(0,n.jsx)(C,{projectId:T,destinationId:z,subscriptions:ef}),(0,n.jsxs)("div",{ref:Y,className:"flex flex-col gap-2 scroll-mt-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("h2",{className:"font-sans text-[13px] grow font-semibold leading-4 text-foreground",children:"\xdaltimas entregas"}),20===J&&eN.length>=20&&(0,n.jsx)("button",{type:"button",onClick:()=>W(100),className:"font-sans text-xs font-medium leading-4 text-[#16A34A] underline underline-offset-2 hover:text-[#15803D] transition-colors",children:"Ver todas"})]}),el?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(r.O,{className:"h-[34px] w-full"}),(0,n.jsx)(r.O,{className:"h-[34px] w-full"}),(0,n.jsx)(r.O,{className:"h-[34px] w-full"})]}):0===eN.length?(0,n.jsxs)("div",{className:"rounded-lg border border-dashed bg-muted/30 p-6 text-center",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Nenhuma entrega encontrada"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Entregas aparecem aqui quando as fontes conectadas disparam eventos."})]}):(0,n.jsx)("div",{className:"flex flex-col rounded-lg overflow-clip border border-border",children:eN.map((e,s)=>{let a=function(e){if((0,O.V5)(e.status)){let s=e.error_message?function(e,s){let a=s?" (".concat(s,")"):"",n=e.indexOf("{");
1if(-1!==n)try{var t,r;let s=JSON.parse(e.slice(n)),o=null!==(r=null===(t=s.error)||void 0===t?void 0:t.message)&&void 0!==r?r:s.message;if(o)return"".concat(o).concat(a)}catch(e){}let o=e.length>90?"".concat(e.slice(0,90),"…"):e;return"".concat(o).concat(a)}(e.error_message,e.http_status_code):"HTTP ".concat(e.http_status_code||""),a=e.attempt?" \xb7 tentativa ".concat(e.attempt,"/8"):"";return{text:"".concat(s).concat(a),isError:!0}}if("sent"===e.status){var s;return{text:"HTTP ".concat(e.http_status_code||200," \xb7 ").concat(null!==(s=e.latency_ms)&&void 0!==s?s:0,"ms"),isError:!1}}return{text:e.status,isError:!1}}(e);return(0,n.jsxs)("div",{className:(0,i.cn)("flex items-center h-[34px] px-[14px] shrink-0 cursor-pointer hover:bg-accent/40 transition-colors",s<eN.length-1&&"border-b border-border/50"),onClick:()=>Q(e),children:[(0,n.jsx)("span",{className:(0,i.cn)("shrink-0 rounded-full size-2",(0,O.Ep)(e.status))}),(0,n.jsx)("span",{className:"w-[170px] shrink-0 pl-[10px] font-sans text-xs font-medium leading-4 text-foreground truncate",children:(0,O.K3)(e.signal_type)}),(0,n.jsx)("span",{className:"w-[280px] shrink-0 text-[11px] font-['JetBrains_Mono',monospace] leading-[14px] text-muted-foreground truncate pr-2",title:e.outbox_key,children:e.outbox_key}),(0,n.jsx)("span",{className:(0,i.cn)("grow basis-0 font-sans text-[11px] leading-[14px] truncate",a.isError?"text-[#DC2626]":"text-muted-foreground"),children:a.text}),(0,n.jsx)("span",{className:"font-sans text-[11px] leading-[14px] text-muted-foreground shrink-0 pl-2",children:function(e){let s=Math.round((Date.now()-new Date(e).getTime())/1e3);if(s<5)return"agora";if(s<60)return"h\xe1 ".concat(s,"s");let a=Math.round(s/60);if(a<60)return"h\xe1 ".concat(a," min");let n=Math.round(a/60);return n<24?"h\xe1 ".concat(n,"h"):"h\xe1 ".concat(Math.round(n/24),"d")}(e.sent_at)})]},"".concat(e.outbox_key,"-").concat(e.attempt,"-").concat(s))})})]})]}),(0,n.jsx)(N.z,{open:!!M,onOpenChange:e=>{e||Q(null)},delivery:M}),(0,n.jsx)(E,{open:R,onOpenChange:L,projectId:T,destinationId:z,onViewDeliveries:G})]})}},27064:function(e,s,a){a.d(s,{J2:function(){return i},tW:function(){return d},xo:function(){return l},yk:function(){return c}});var n=a(57437),t=a(27312),r=a(2265),o=a(23882);let i=t.fC,l=t.xz,d=t.ee,c=r.forwardRef((e,s)=>{let{className:a,align:r="center",sideOffset:i=4,...l}=e;return(0,n.jsx)(t.h_,{children:(0,n.jsx)(t.VY,{ref:s,align:r,sideOffset:i,className:(0,o.cn)("z-[110] w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",a),...l})})});c.displayName=t.VY.displayName}}]);

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.