PageSourceSearch

https://digitalcomics.com.br/_next/static/chunks/pages/admin/conta-679cf997f9e47049.js

js digitalcomics.com.br collected 2026-10-08 01:53:42 UTC 18,029 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6097],{1811:(e,a,t)=>{"use strict";t.r(a),t.d(a,{default:()=>f});var s=t(7876),r=t(7328),n=t.n(r),o=t(8230),i=t.n(o),l=t(4232),c=t(6041);let d=l.forwardRef(function(e,a){let{title:t,titleId:s,...r}=e;return l.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:a,"aria-labelledby":s},r),t?l.createElement("title",{id:s},t):null,l.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.827 6.175A2.31 2.31 0 0 1 5.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 0 0-1.134-.175 2.31 2.31 0 0 1-1.64-1.055l-.822-1.316a2.192 2.192 0 0 0-1.736-1.039 48.774 48.774 0 0 0-5.232 0 2.192 2.192 0 0 0-1.736 1.039l-.821 1.316Z"}),l.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 12.75a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0ZM18.75 10.5h.008v.008h-.008V10.5Z"}))});var m=t(5837),p=t(5044),h=t(5806),u=t(8491);let x="w-full px-4 py-2.5 rounded-lg bg-white border border-gray-300 text-gray-900 text-sm placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-dc-color focus:border-transparent font-Poppins";function g(e){let{label:a,hint:t,children:r}=e;return(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block font-Poppins text-sm font-medium text-gray-700 mb-1.5",children:a}),r,t&&(0,s.jsx)("p",{className:"mt-1 text-xs text-gray-400 font-Poppins",children:t})]})}function f(){let{admin:e,loading:a,logout:t,authFetch:r,sessionExpired:o}=(0,m.b)(),f=(0,l.useRef)(null),[b,v]=(0,l.useState)({slug:"",nome_fantasia:"",email:"",sobre:"",foto_perfil:"",chave_pix:"",senha:"",senha_confirm:""}),[j,w]=(0,l.useState)(!0),[y,N]=(0,l.useState)(!1),[k,C]=(0,l.useState)(!1),[P,S]=(0,l.useState)(""),[E,_]=(0,l.useState)(!1),[I,T]=(0,l.useState)(""),[A,L]=(0,l.useState)(!1),[O,M]=(0,l.useState)(!1),R=e=>a=>v(t=>({...t,[e]:a.target.value})),D=b.slug?"https://digitalcomics.com.br/publisher/".concat(b.slug):"",F=b.slug?'<a href="https://digitalcomics.com.br/publisher/'.concat(b.slug,'" target="_blank" rel="noopener">Leia minhas HQs na Digital Comics</a>'):"";async function V(e,a){try{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),2e3)}catch(e){S("N\xe3o foi poss\xedvel copiar. Selecione o texto manualmente.")}}async function z(e){var a;let t=null==(a=e.target.files)?void 0:a[0];if(t){T(URL.createObjectURL(t)),C(!0),S("");try{let e=await r("/api/admin/presign-avatar",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:t.name,contentType:t.type})}),{url:a,publicUrl:s,error:n}=await e.json();if(n)return void S(n);let o=await fetch(a,{method:"PUT",body:t,headers:{"Content-Type":t.type}});if(!o.ok){let e=await o.text().catch(()=>"");S("Falha ao enviar imagem (HTTP ".concat(o.status,"). ").concat(e.includes("AccessDenied")?"Sem permiss\xe3o de escrita neste path do S3.":e.slice(0,120)));return}v(e=>({...e,foto_perfil:s})),T("/api/publisher-avatar/".concat(b.slug,"?v=").concat(Date.now())),(await r("/api/admin/conta",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...b,foto_perfil:s})})).ok||S('Imagem enviada, mas n\xe3o foi poss\xedvel salvar automaticamente. Clique em "Salvar altera\xe7\xf5es".')}catch(e){S("Erro de conex\xe3o ao enviar imagem.")}finally{C(!1)}}}async function B(e){if(e.preventDefault(),b.senha&&b.senha!==b.senha_confirm)return void S("As senhas n\xe3o coincidem.");S(""),_(!1),N(!0);try{let e=await r("/api/admin/conta",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),a=await e.json();if(!e.ok)return void S(a.error||"Erro ao salvar.");_(!0),v(e=>({...e,senha:"",senha_confirm:""})),window.scrollTo({top:0,behavior:"smooth"})}catch(e){S("Erro de conex\xe3o.")}finally{N(!1)}}if((0,l.useEffect)(()=>{e&&r("/api/admin/conta").then(e=>e.json()).then(e=>{if(e.error)return void S(e.error);v(a=>({...a,...e})),T(e.foto_perfil&&e.slug?"/api/publisher-avatar/".concat(e.slug):"")}).catch(()=>S("Erro ao carregar perfil.")).finally(()=>w(!1))},[e]),a||!e)return(0,s.jsx)("div",{className:"min-h-screen bg-default-bg flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-8 h-8 border-2 border-dc-color border-t-transparent roun
1ded-full animate-spin"})});let U=b.nome_fantasia?b.nome_fantasia.split(" ").map(e=>e[0]).slice(0,2).join("").toUpperCase():"?";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n(),{children:(0,s.jsx)("title",{children:"Minha Conta — Admin Digital Comics"})}),(0,s.jsxs)("div",{className:"min-h-screen bg-default-bg",children:[(0,s.jsx)(h.A,{admin:e,logout:t}),(0,s.jsxs)("main",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-10",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-8",children:[(0,s.jsx)(i(),{href:"/admin",className:"p-2 rounded-lg hover:bg-blue-50 transition-colors text-gray-500 hover:text-dc-color",children:(0,s.jsx)(c.A,{className:"h-5 w-5"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"font-Poppins text-2xl font-bold text-gray-900",children:"Minha Conta"}),(0,s.jsx)("p",{className:"font-Poppins text-sm text-gray-500 mt-0.5",children:"Edite seu perfil de publisher"})]})]}),E&&(0,s.jsx)("div",{className:"mb-6 px-4 py-3 rounded-lg bg-green-50 border border-green-200 text-green-700 text-sm font-Poppins",children:"Perfil atualizado com sucesso!"}),P&&(0,s.jsx)("div",{className:"mb-6 px-4 py-3 rounded-lg bg-red-50 border border-red-200 text-red-600 text-sm font-Poppins",children:P}),j?(0,s.jsx)("div",{className:"flex justify-center py-20",children:(0,s.jsx)("div",{className:"w-8 h-8 border-2 border-dc-color border-t-transparent rounded-full animate-spin"})}):(0,s.jsxs)("form",{onSubmit:B,className:"space-y-6",children:[(0,s.jsxs)("section",{className:"bg-white rounded-2xl p-6 shadow-sm border border-gray-100",children:[(0,s.jsx)("h2",{className:"font-Poppins text-xs font-semibold text-gray-400 uppercase tracking-wider mb-5",children:"Foto de perfil"}),(0,s.jsxs)("div",{className:"flex items-start gap-6",children:[(0,s.jsxs)("div",{className:"relative shrink-0 w-32",children:[(0,s.jsx)("div",{className:"relative aspect-[2/3] w-full rounded overflow-hidden border border-gray-200 bg-dc-color",children:I?(0,s.jsx)("img",{src:I,alt:"Foto de perfil",className:"w-full h-full object-cover",onError:()=>T("")}):(0,s.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-1",children:[(0,s.jsx)("span",{className:"font-Poppins text-3xl font-extrabold text-white tracking-tight",children:U}),(0,s.jsx)("span",{className:"font-Poppins text-[10px] text-blue-200 uppercase tracking-widest",children:"Publisher"})]})}),(0,s.jsx)("button",{type:"button",onClick:()=>{var e;return null==(e=f.current)?void 0:e.click()},disabled:k,className:"absolute -bottom-2 -right-2 w-9 h-9 rounded-full bg-dc-color hover:bg-[#0066d9] text-white flex items-center justify-center shadow-md transition-colors disabled:opacity-50 border-2 border-white",children:k?(0,s.jsx)("span",{className:"w-3.5 h-3.5 border border-white border-t-transparent rounded-full animate-spin"}):(0,s.jsx)(d,{className:"h-4 w-4"})}),(0,s.jsx)("input",{ref:f,type:"file",accept:"image/jpeg,image/png,image/webp",className:"hidden",onChange:z})]}),(0,s.jsxs)("div",{className:"pt-1",children:[(0,s.jsx)("p",{className:"font-Poppins text-sm font-medium text-gray-900",children:k?"Enviando...":"Clique no \xedcone de c\xe2mera para trocar"}),(0,s.jsxs)("p",{className:"font-Poppins text-xs text-gray-400 mt-1.5 leading-relaxed",children:["JPG, PNG ou WebP.",(0,s.jsx)("br",{}),"Propor\xe7\xe3o recomendada: 2\xd73 (retrato).",(0,s.jsx)("br",{}),"Ex: 400\xd7600px."]})]})]})]}),(0,s.jsxs)("section",{className:"bg-white rounded-2xl p-6 shadow-sm border border-gray-100",children:[(0,s.jsx)("h2",{className:"font-Poppins text-xs font-semibold text-gray-400 uppercase tracking-wider mb-4",children:"Informa\xe7\xf5es"}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(g,{label:"Nome da editora / publisher",children:(0,s.jsx)("input",{type:"text",value:b.nome_fantasia,onChange:R("nome_fantasia"),required:!0,placeholder:"Ex: Caveira Publica\xe7\xf5es",className:x})}),(0,s.jsx)(g,{label:"E-mail de acesso",children:(0,s.jsx)("input",{type:"email",value:b.email,onChange:R("email"),required:!0,placeholder:"[email protected]",className:x})}),(0,s.jsx)(g,{label:"Sobre",hint:"Aparece na p\xe1gina p\xfablica da sua editora",children:(0,s.jsx)("textarea",{value:b.sobre,onChange:R("sobre"),rows:4,placeholder:"Conte um pouco sobre sua editora, estilo, hist\xf3ria...",className:"".concat(x," resize-none")})})]})]}),(0,s.jsxs)("section",{className:"bg-white rounded-2xl p-6 shadow-sm border border-gray-100",children:[(0,s.jsx)("h2",{className:"font-Poppins text-xs font-semibold text-gray-400 uppercase tracking-wider mb-1",children:"Divulgue seu perfil"}),(0,s.jsx)("p",{className:"font-Poppins text-xs text-gray-400 mb-4",children:"Adicione este link no seu site, bio do Instagram ou linktree para seus leitores te encontrarem na Digital Comics."}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(g,{label:"Link do seu perfil",children:(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",value:D,readOnly:!0,className:"".concat(x," bg-gray-50")}),(0,s.jsx)("button",{type:"button",onClick:()=>V(D,L),disabled:!D,className:"shrink-0 px-4 py-2.5 rounded-lg bg-gray-100 hover:bg-gray-200 disabled:opacity-50 text-gray-700 font-Poppins text-sm font-medium transition-colors",children:A?"Copiado!":"Copiar"})]})}),(0,s.jsx)(g,{label:"C\xf3digo para incorporar",hint:"Cole este HTML no seu site ou blog.",children:(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("textarea",{readOnly:!0,value:F,rows:2,className:"".concat(x," bg-gray-50 resize-none font-mono text-xs")}),(0,s.jsx)("button",{type:"button",onClick:()=>V(F,M),disabled:!F,className:"shrink-0 px-4 py-2.5 rounded-lg bg-gray-100 hover:bg-gray-200 disabled:opacity-50 text-gray-700 font-Poppins text-sm font-medium transition-colors",children:O?"Copiado!":"Copiar c\xf3digo"})]})})]})]}),(0,s.jsxs)("section",{className:"bg-white rounded-2xl p-6 shadow-sm border border-gray-100",children:[(0,s.jsx)("h2",{className:"font-Poppins text-xs font-semibold text-gray-400 uppercase tracking-wider mb-1",children:"Dados banc\xe1rios"}),(0,s.jsx)("p",{className:"font-Poppins text-xs text-gray-400 mb-4",children:"Usada para receber seus repasses."}),(0,s.jsx)(g,{label:"Chave PIX",children:(0,s.jsx)("input",{type:"text",value:b.chave_pix,onChange:R("chave_pix"),placeholder:"CPF, e-mail, telefone ou chave aleat\xf3ria",className:x})})]}),(0,s.jsxs)("section",{className:"bg-white rounded-2xl p-6 shadow-sm border border-gray-100",children:[(0,s.jsx)("h2",{className:"font-Poppins text-xs font-semibold text-gray-400 uppercase tracking-wider mb-1",children:"Alterar senha"}),(0,s.jsx)("p",{className:"font-Poppins text-xs text-gray-400 mb-4",children:"Deixe em branco para manter a senha atual."}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsx)(g,{label:"Nova senha",children:(0,s.jsx)("input",{type:"password",value:b.senha,onChange:R("senha"),placeholder:"••••••••",autoComplete:"new-password",className:x})}),(0,s.jsx)(g,{label:"Confirmar senha",children:(0,s.jsx)("input",{type:"password",value:b.senha_confirm,onChange:R("senha_confirm"),placeholder:"••••••••",autoComplete:"new-password",className:x})})]})]}),(0,s.jsx)("div",{className:"pb-8",children:(0,s.jsx)("button",{type:"submit",disabled:y||k,className:"w-full py-3 px-4 bg-dc-color hover:bg-[#0066d9] disabled:opacity-50 disabled:cursor-not-allowed text-white font-Poppins font-semibold text-sm rounded-lg transition-colors",children:y?"Salvando...":"Salvar altera\xe7\xf5es"})})]})]}),(0,s.jsx)(u.A,{hideSeoText:!0})]}),(0,s.jsx)(p.A,{open:o})]})}},5044:(e,a,t)=>{"use strict";t.d(a,{A:()=>l});var s=t(7876),r=t(8230),n=t.n(r),o=t(4232);let i=o.forwardRef(function(e,a){let{title:t,titleId:s,...r}=e;return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:a,"aria-labelledby":s},r),t?o.createElement("title",{id:s},t):null,o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))});function l(e){let{open:a}=e;return a?(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 px-4",children:(0,s.jsxs)("div",{className:"bg-white rounded-2xl p-6 max-w-sm w-full shadow-xl text-center",children:[(0,s.jsx)("div",{className:"w-12 h-12 rounded-full bg-blue-50 flex items-center justify-center mx-auto mb-4",children:(0,s.jsx)(i,{className:"h-6 w-6 text-dc-color"})}),(0,s.jsx)("h2",{className:"font-Poppins text-lg font-bold text-gray-900 mb-2",children:"Sess\xe3o expirada"}),(0,s.jsx)("p",{className:"font-Poppins text-sm text-gray-500 mb-6",children:"Voc\xea ficou um tempo sem usar o painel e sua sess\xe3o expirou por seguran\xe7a. Fa\xe7a login novamente pra continuar."}),(0,s.jsx)(n(),{href:"/admin/login",className:"inline-block w-full py-2.5 px-4 bg-dc-color hover:bg-[#0066d9] text-white font-Poppins font-semibold text-sm rounded-lg transition-colors",children:"Fazer login novamente"})]})}):null}},5806:(e,a,t)=>{"use strict";t.d(a,{A:()=>p});var s=t(7876),r=t(4587),n=t.n(r),o=t(8230),i=t.n(o),l=t(4232);let c=l.forwardRef(function(e,a){let{title:t,titleId:s,...r}=e;return l.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:a,"aria-labelledby":s},r),t?l.createElement("title",{id:s},t):null,l.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 21h19.5m-18-18v18m10.5-18v18m6-13.5V21M6.75 6.75h.75m-.75 3h.75m-.75 3h.75m3-6h.75m-.75 3h.75m-.75 3h.75M6.75 21v-3.375c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21M3 3h12m-.75 4.5H2
11m-3.75 3.75h.008v.008h-.008v-.008Zm0 3h.008v.008h-.008v-.008Zm0 3h.008v.008h-.008v-.008Z"}))}),d=l.forwardRef(function(e,a){let{title:t,titleId:s,...r}=e;return l.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:a,"aria-labelledby":s},r),t?l.createElement("title",{id:s},t):null,l.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0 0 13.5 3h-6a2.25 2.25 0 0 0-2.25 2.25v13.5A2.25 2.25 0 0 0 7.5 21h6a2.25 2.25 0 0 0 2.25-2.25V15m3 0 3-3m0 0-3-3m3 3H9"}))});var m=t(4761);function p(e){let{admin:a,logout:t}=e;return(0,s.jsx)("header",{className:"bg-black",children:(0,s.jsxs)("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 h-14 flex items-center justify-between",children:[(0,s.jsx)(i(),{href:"/admin",children:(0,s.jsx)(n(),{src:m.A,alt:"Digital Comics",width:150,height:28,priority:!0,className:"h-auto w-auto"})}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:["platform_admin"===a.role&&(0,s.jsxs)(i(),{href:"/admin/plataforma",className:"flex items-center gap-1.5 text-gray-400 hover:text-white transition-colors text-sm font-Poppins",children:[(0,s.jsx)(c,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Plataforma"})]}),(0,s.jsx)("span",{className:"font-Poppins text-sm text-gray-400 hidden sm:block",children:a.name}),(0,s.jsxs)("button",{onClick:t,className:"flex items-center gap-1.5 text-gray-400 hover:text-white transition-colors text-sm font-Poppins",children:[(0,s.jsx)(d,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Sair"})]})]})]})})}},5837:(e,a,t)=>{"use strict";t.d(a,{b:()=>n});var s=t(4232),r=t(9099);
1function n(){let[e,a]=(0,s.useState)(null),[t,n]=(0,s.useState)(!0),[o,i]=(0,s.useState)(!1),l=(0,r.useRouter)();return(0,s.useEffect)(()=>{let e=localStorage.getItem("adminToken"),t=localStorage.getItem("adminId"),s=localStorage.getItem("adminName"),r=localStorage.getItem("adminEmail"),o=localStorage.getItem("adminRole");e&&t&&s?a({id:parseInt(t,10),name:s,email:r,role:o,token:e}):l.replace("/admin/login"),n(!1)},[l]),{admin:e,loading:t,logout:()=>{let e=localStorage.getItem("adminToken");e&&fetch("/api/admin/logout",{method:"POST",headers:{Authorization:"Bearer ".concat(e)}}).catch(()=>{}),localStorage.removeItem("adminToken"),localStorage.removeItem("adminId"),localStorage.removeItem("adminName"),localStorage.removeItem("adminEmail"),localStorage.removeItem("adminRole"),a(null),l.push("/admin/login")},authFetch:(0,s.useCallback)(async function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=localStorage.getItem("adminToken"),s=await fetch(e,{...a,headers:{...a.headers||{},Authorization:"Bearer ".concat(t)}});return 401===s.status&&(localStorage.removeItem("adminToken"),localStorage.removeItem("adminId"),localStorage.removeItem("adminName"),localStorage.removeItem("adminEmail"),i(!0)),s},[]),sessionExpired:o}}},6041:(e,a,t)=>{"use strict";t.d(a,{A:()=>r});var s=t(4232);let r=s.forwardRef(function(e,a){let{title:t,titleId:r,...n}=e;return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:a,"aria-labelledby":r},n),t?s.createElement("title",{id:r},t):null,s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"}))})},7626:(e,a,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/conta",function(){return t(1811)}])}},e=>{var a=a=>e(e.s=a);e.O(0,[8230,144,2771,636,6593,8792],()=>a(7626)),_N_E=e.O()}]);

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.