PageSourceSearch

https://app.timhouse.com.br/assets/EmailCampaignsApprovalPage-BiijcCf0.js

js timhouse.com.br collected 2026-10-06 04:52:36 UTC 6,029 bytes, 1 lines download raw bytes

1import{u as v,j as e}from"./vendor-query-C0G7-zTq.js";import{u as N,r as m}from"./vendor-react-Cog84hhN.js";import{u as w,k as C,r as E}from"./useBrandEmailCampaigns-lX5EYdt6.js";import{p as A}from"./date.utils-DUN3k-Gl.js";import{aH as g,U as u,x as R,ad as k,ac as S}from"./index-Cn9CABFg.js";import{E as D}from"./eye-LO849pZB.js";import"./vendor-sentry-Bg9nlJsI.js";import"./vendor-charts-Dj5OJhBv.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"[email protected]"}}catch{}})();try{(function(){var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new s.Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="572d7fab-eb3d-4cb4-af1e-35d568d3f81f",s._sentryDebugIdIdentifier="sentry-dbid-572d7fab-eb3d-4cb4-af1e-35d568d3f81f")})()}catch{}function p(s){if(!s)return"—";const t=A(s);return t?t.toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function P(){const s=N(),t=v(),[i,n]=m.useState(null),[c,d]=m.useState(null),[r,l]=m.useState(""),{data:x,isLoading:h,isError:b,refetch:o}=w({status:"pending_approval",page:1,pageSize:50}),f=async a=>{if(window.confirm("Aprovar esta divulgação? O envio iniciará em alguns minutos.")){n(a);try{await C(a),t.invalidateQueries({queryKey:["brand-email-campaigns"]}),o()}catch{}finally{n(null)}}},j=async a=>{if(!(!r.trim()||r.trim().length<3)){n(a);try{await E(a,{reason:r.trim()}),t.invalidateQueries({queryKey:["brand-email-campaigns"]}),d(null),l(""),o()}catch{}finally{n(null)}}};return e.jsx("div",{className:"min-h-screen bg-gray-50",children:e.jsxs("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx(g,{className:"h-7 w-7 text-indigo-600"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Aprovação de E-mail Marketing"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Divulgações aguardando revisão e aprovação"})]})]}),h?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(u,{className:"h-8 w-8 animate-spin text-indigo-600"})}):b?e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 text-center",children:[e.jsx(R,{className:"h-8 w-8 text-red-500 mx-auto mb-2"}),e.jsx("p",{className:"text-red-700",children:"Erro ao carregar fila de aprovação."}),e.jsx("button",{onClick:()=>o(),className:"mt-2 text-blue-600 hover:underline",children:"Tentar novamente"})]}):x?.items.length?e.jsx("div",{className:"space-y-4",children:x.items.map(a=>e.jsxs("div",{className:"bg-white rounded-lg border p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:a.name}),e.jsx("span",{className:"px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800",children:"Aguardando Aprovação"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 text-sm text-gray-600 mt-3",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400",children:"Marca:"})," ",e.jsx("span",{className:"font-medium",children:a.tenantName})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400",children:"Submetida em:"})," ",p(a.submittedAt)]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400",children:"Criada em:"})," ",p(a.createdAt)]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx("button",{onClick:()=>s(`/brand/email-campaigns/${a.id}`),className:"p-2 text-gray-400 hover:text-blue-600 rounded-lg hover:bg-blue-50","aria-label":`Ver detalhes de ${a.name}`,children:e.jsx(D,{className:"h-5 w-5"})}),e.jsxs("button",{onClick:()=>f(a.id),disabled:i===a.id,className:"inline-flex items-center gap-1.5 px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 disabled:opacity-50 text-sm font-medium","aria-label":`Aprovar divulgação ${a.name}`,children:[i===a.id?e.jsx(u,{className:"h-4 w-4 animate-spin"}):e.jsx(k,{className:"h-4 w-4"}),"Aprovar"]}),e.jsxs("button",{onClick:()=>d(c===a.id?null:a.id),disabled:i===a.id,className:"inline-flex items-center gap-1.5 px-4 py-2 bg-white text-red-600 border border-red-300 rounded-lg hover:bg-red-50 disabled:opacity-50 text-sm font-medium","aria-label":`Rejeitar divulgação ${a.name}`,children:[e.jsx(S,{className:"h-4 w-4"}),"Rejeitar"]})]})]}),c===a.id&&e.jsxs("div",{className:"mt-4 p-4 bg-red-50 rounded-lg border border-red-200",children:[e.jsx("label",{className:"block text-sm font-medium text-red-700 mb-2",children:"Motivo da rejeição (obrigatório, 3-500 caracteres)"}),e.jsx("textarea",{value:r,onChange:y=>l(y.target.value),placeholder:"Descreva o motivo da rejeição...",rows:3,className:"w-full rounded-md border-red-300 focus:border-red-500 focus:ring-red-500 text-sm",maxLength:500}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[e.jsxs("span",{className:"text-xs text-gray-400",children:[r.length,"/500"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>{d(null),l("")},className:"px-3 py-1.5 text-sm text-gray-600 hover:text-gray-800",children:"Cancelar"}),e.jsx("button",{onClick:()=>j(a.id),disabled:r.trim().length<3||i===a.id,className:"px-4 py-1.5 bg-red-600 text-white rounded-md hover:bg-red-700 disabled:opacity-50 text-sm font-medium",children:i===a.id?"Rejeitando...":"Confirmar Rejeição"})]})]})]})]},a.id))}):e.jsxs("div",{className:"bg-white rounded-lg border p-12 text-center",children:[e.jsx(g,{className:"h-12 w-12 text-gray-300 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-500",children:"Nenhuma divulgação aguardando aprovação."})]})]})})}export{P as EmailCampaignsApprovalPage};

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.