PageSourceSearch

https://maestro.pontua.com.br/assets/ParceiroFinanceiro-C7CXBuW1.js

js pontua.com.br collected 2026-10-01 14:15:33 UTC 32,039 bytes, 1 lines download raw bytes

1import{r as u,j as e,L as $e}from"./vendor-react-DIA7vK4g.js";import{L as We,s as Je,O as Ge,bL as xe,bM as pe,bN as ue,bO as je,bS as we,bQ as be,b9 as m,b7 as J,bi as I,cg as Ce,a7 as ie,bP as w,bA as re,bB as oe,bC as ce,bD as le,bE as g,bz as P,y as Re,b0 as ye,P as Ue,Q as ne,aX as Ke,a$ as ze,bY as G,bZ as U,b_ as C,b$ as c,c0 as K,c1 as l,bF as z,at as Qe,ba as S}from"./index-DtUVjOr4.js";import{a as Q}from"./asArray-CTPHXM1A.js";import{u as Ye}from"./parceiro-pontua-simbolo-BHn6Fgkh.js";import{P as _e}from"./ParceiroLayout-DqodW2gQ.js";import{G as qe}from"./GlowCard-eEGJc4nM.js";import{G as b}from"./GlowButton-DmpRcAFP.js";import{S as Y}from"./StatsCard-BOwc7peS.js";import{T as Ze,a as es,b as F,c as k}from"./tabs-Btg5k50n.js";import{R as ss}from"./RewardModeChooser-CC2uCn1F.js";import{u as Ie,a as Ae,R as as,P as ts,I as is}from"./usePartnerReward-DCUhGG5l.js";import{H as rs}from"./heart-handshake-Cb8AzQJA.js";import{T as os}from"./ticket-percent-DHEHuQH6.js";import{e as Pe}from"./edge-function-error-Bg1_3hCh.js";import{M as de}from"./masked-document-input-CdpHuUqS.js";import{f as cs,g as ls,i as ns,a as ds}from"./document-utils-DQEVigHH.js";import{B as he}from"./banknote-DiarXhf0.js";import{C as hs}from"./clock-x8uDBefL.js";import{R as ms}from"./repeat-sulmqLMn.js";import{A as Z}from"./arrow-up-right-DqLUwefS.js";import{A as me}from"./arrow-down-left-BBdRMFYs.js";import{C as xs}from"./circle-check-big-CW4zvNj2.js";import{p as O,H}from"./vendor-utils-DWHjTIse.js";import"./vendor-docs-BA9xu9ak.js";import"./vendor-supabase-_bOAMmkC.js";import"./scroll-area-DFJSP9HM.js";import"./megaphone-02cGG_Vz.js";import"./BlurBackground-ClCPgGtR.js";import"./usePartnerModuleSettings-C6w9Iy51.js";import"./parceiro-pontua-principal-Gg013pNI.js";import"./trophy-BCwqMM8W.js";import"./log-out-CMftDkmm.js";const Se=a=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(a||0),ps={comissao:We,desconto_cliente:os,doacao:rs};function us({partnerId:a,tierPercent:ee}){const{reward:o,isLoading:A,setMode:se,isSaving:N}=Ie(),{data:D}=Ae((o==null?void 0:o.modo)==="doacao"?a??(o==null?void 0:o.partnerId):void 0),[V,j]=u.useState(!1),[v,y]=u.useState(null),[T,r]=u.useState(!1);if(u.useEffect(()=>{o!=null&&o.modo&&y(o.modo)},[o==null?void 0:o.modo]),A||!o)return null;const E=ps[o.modo],i=(D??[]).reduce((_,M)=>_+Number(M.valor||0),0),h=(D??[]).filter(_=>_.status==="repassado").reduce((_,M)=>_+Number(M.valor||0),0),ae=async()=>{o.cupom&&(await navigator.clipboard.writeText(o.cupom),r(!0),m.success("Cupom copiado!"),setTimeout(()=>r(!1),2e3))},f=async()=>{if(!v||v===o.modo){j(!1);return}try{await se(v),j(!1)}catch{}};return e.jsxs(e.Fragment,{children:[e.jsx(qe,{className:"p-5",children:e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"rounded-lg bg-white/10 p-2.5",children:e.jsx(E,{className:"h-5 w-5 text-white"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-wider text-white/50",children:"Minha forma de recompensa"}),e.jsx("p",{className:"font-semibold text-white",children:as[o.modo]}),o.modo==="comissao"&&e.jsx("p",{className:"text-sm text-white/60",children:"Sua comissão acumula em saldo e pode ser sacada via PIX."}),o.modo==="desconto_cliente"&&e.jsxs("p",{className:"text-sm text-white/60",children:["Seus clientes ganham ",ts,"% de desconto com o seu cupom. Novas vendas não geram comissão."]}),o.modo==="doacao"&&e.jsxs("p",{className:"text-sm text-white/60",children:["100% da comissão liberada é doada ao ",is,"."," ",e.jsx($e,{to:"/parceiro-pontua/empresa-amiga",className:"font-medium text-white underline underline-offset-2",children:"Conheça o programa Empresa Amiga"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[o.modo==="desconto_cliente"&&o.cupom&&e.jsxs("button",{type:"button",onClick:ae,className:"flex items-center gap-2 rounded-lg border border-white/15 bg-white/5 px-3 py-2 font-mono text-sm text-white hover:border-white/30",children:[o.cupom,T?e.jsx(Je,{className:"h-4 w-4 text-[hsl(142,71%,45%)]"}):e.jsx(Ge,{className:"h-4 w-4 text-white/50"})]}),o.modo==="doacao"&&e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-xs text-white/50",children:"Total doado"}),e.jsx("p",{className:"font-semibold text-white",children:Se(i)}),e.jsxs("p",{className:"text-xs text-white/40",children:[Se(h)," já repassado"]}
1)]}),e.jsx(b,{variant:"outline",size:"sm",onClick:()=>j(!0),children:"Alterar"})]})]})}),e.jsx(xe,{open:V,onOpenChange:j,children:e.jsxs(pe,{className:"max-w-3xl bg-[hsl(222,47%,11%)] border-white/10 text-white",children:[e.jsxs(ue,{children:[e.jsx(je,{className:"text-white",children:"Como você quer receber?"}),e.jsx(we,{className:"text-white/60",children:"A mudança vale apenas para comissões futuras. O saldo já liberado continua disponível para saque."})]}),e.jsx(ss,{value:v,onChange:y,disabled:N,tierPercent:ee}),e.jsxs(be,{className:"gap-2",children:[e.jsx(b,{variant:"outline",onClick:()=>j(!1),disabled:N,children:"Cancelar"}),e.jsx(b,{onClick:f,disabled:N||!v,children:N?"Salvando...":"Confirmar"})]})]})})]})}const De={comissao:{label:"Comissão",icon:Z,color:"text-[hsl(142,71%,45%)]"},commission:{label:"Comissão",icon:Z,color:"text-[hsl(142,71%,45%)]"},bonus:{label:"Bônus",icon:Z,color:"text-amber-400"},withdrawal:{label:"Saque",icon:me,color:"text-[hsl(1,100%,50%)]"},saque:{label:"Saque",icon:me,color:"text-[hsl(1,100%,50%)]"},liberacao:{label:"Liberação",icon:xs,color:"text-[hsl(142,71%,45%)]"},adjustment:{label:"Ajuste",icon:Re,color:"text-white/60"},points_redemption:{label:"Resgate",icon:me,color:"text-orange-400"},doacao:{label:"Doação",icon:Z,color:"text-[hsl(1,100%,50%)]"}},Te={pending:{label:"Pendente",bgColor:"bg-yellow-500/20 border-yellow-500/30",textColor:"text-yellow-400"},approved:{label:"Aprovado",bgColor:"bg-blue-500/20 border-blue-500/30",textColor:"text-blue-400"},rejected:{label:"Rejeitado",bgColor:"bg-red-500/20 border-red-500/30",textColor:"text-red-400"},paid:{label:"Pago",bgColor:"bg-[hsla(142,71%,45%,0.2)] border-[hsla(142,71%,45%,0.3)]",textColor:"text-[hsl(142,71%,45%)]"}};function Us(){var ve,fe;const{partner:a,isLoading:ee}=Ye(),[o,A]=u.useState(!1),[se,N]=u.useState(!1),[D,V]=u.useState(""),[j,v]=u.useState(""),[y,T]=u.useState(!1),[r,E]=u.useState(""),[i,h]=u.useState({banco:"",agencia:"",conta:"",tipo_conta:"corrente",titular:"",cpf_cnpj:"",chave_pix:"",tipo_pix:""}),ae=r==="dados_bancarios",{data:f=[],isLoading:_,error:M}=J({queryKey:["financial-transactions",a==null?void 0:a.id],queryFn:async()=>{if(!(a!=null&&a.id))return[];const{data:s,error:t}=await S.from("financial_transactions").select("*").eq("partner_id",a.id).order("created_at",{ascending:!1}).limit(50);if(t)throw t;return Q(s,"financial_transactions")},enabled:!!(a!=null&&a.id)}),{data:d=[],isLoading:Ee,error:Me,refetch:Be}=J({queryKey:["bank-accounts",a==null?void 0:a.id],queryFn:async()=>{if(!(a!=null&&a.id))return[];const{data:s,error:t}=await S.from("bank_accounts").select("*").eq("partner_id",a.id).order("principal",{ascending:!1});if(t)throw t;return Q(s,"bank_accounts")},enabled:!!(a!=null&&a.id)}),{data:R=[],isLoading:Le,error:Fe,refetch:ke}=J({queryKey:["withdrawals",a==null?void 0:a.id],queryFn:async()=>{if(!(a!=null&&a.id))return[];const{data:s,error:t}=await S.from("withdrawal_requests").select("*, bank_accounts(*)").eq("partner_id",a.id).order("created_at",{ascending:!1});if(t)throw t;return Q(s,"withdrawal_requests")},enabled:!!(a!=null&&a.id)}),{data:B=[],isLoading:Oe,error:He}=J({queryKey:["recurring-commissions",a==null?void 0:a.id],queryFn:async()=>{if(!(a!=null&&a.id))return[];const{data:s,error:t}=await S.from("recurring_commissions").select("*").eq("partner_id",a.id).order("created_at",{ascending:!1});if(t)throw t;return Q(s,"recurring_commissions")},enabled:!!(a!=null&&a.id)&&(a==null?void 0:a.tier)==="ouro"}),X=u.useMemo(()=>{const s=B.filter(t=>t.ativo);return{comissaoMensal:s.reduce((t,n)=>t+Number(n.valor_comissao||0),0),mrrTotal:s.reduce((t,n)=>t+Number(n.mrr_cliente||0),0),clientesAtivos:s.length}},[B]),Ne=M||Me||Fe||He,x=s=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(s),ge=r==="cpf"||r==="cnpj",Ve=async()=>{var t,n;if(!(a!=null&&a.id))return;if(!r){m.error("Selecione o tipo de chave PIX");return}if(r==="dados_bancarios"){if(!i.banco||!i.agencia||!i.conta||!i.titular||!i.cpf_cnpj){m.error("Preencha todos os dados bancários");return}}else{if(!i.chave_pix){m.error("Informe a chave PIX");return}
1if(!i.titular||!i.cpf_cnpj){m.error("Preencha os dados do titular");return}}const s=ls(i.cpf_cnpj||"");if(s.length!==11&&s.length!==14){m.error("CPF/CNPJ do titular deve ter 11 ou 14 dígitos");return}if(s.length===11?!ns(s):!ds(s)){m.error(s.length===11?"CPF do titular inválido":"CNPJ do titular inválido");return}T(!0);try{const{data:p}=await S.auth.getSession();if(!((t=p==null?void 0:p.session)!=null&&t.access_token))throw new Error("Sessão não encontrada");const L=await S.functions.invoke("add-bank-account",{body:{banco:r==="dados_bancarios"?i.banco:"PIX",agencia:r==="dados_bancarios"?i.agencia:"0000",conta:r==="dados_bancarios"?i.conta:"PIX",tipo_conta:r==="dados_bancarios"?i.tipo_conta:"pix",titular:i.titular,cpf_cnpj:i.cpf_cnpj,chave_pix:r==="dados_bancarios"?null:i.chave_pix,tipo_pix:r==="dados_bancarios"?"dados_bancarios":r}});if(L.error)throw new Error(await Pe(L.error,"Erro ao cadastrar conta"));if((n=L.data)!=null&&n.error)throw new Error(L.data.details||L.data.error);m.success("Conta PIX cadastrada!"),N(!1),E(""),h({banco:"",agencia:"",conta:"",tipo_conta:"corrente",titular:"",cpf_cnpj:"",chave_pix:"",tipo_pix:""}),Be()}catch(p){console.error("Error adding bank account:",p),m.error(p.message||"Erro ao cadastrar conta")}finally{T(!1)}},$=50,Xe=async()=>{if(!(a!=null&&a.id))return;const s=parseFloat(D.replace(",","."));if(isNaN(s)||s<$){m.error(`Valor mínimo para saque é R$ ${$},00`);return}if(s>(a.saldo_disponivel||0)){m.error("Saldo insuficiente");return}if(!j){m.error("Selecione uma conta bancária");return}T(!0);try{const{data:t,error:n}=await S.functions.invoke("process-withdrawal",{body:{action:"create",valor:s,bank_account_id:j}});if(n)throw new Error(await Pe(n,"Erro ao solicitar saque"));if(t!=null&&t.error)throw new Error(t.details||t.error);m.success("Solicitação de saque enviada! Aguarde aprovação."),A(!1),V(""),v(""),ke()}catch(t){console.error("Error requesting withdrawal:",t),m.error(t.message||"Erro ao solicitar saque")}finally{T(!1)}},{reward:q}=Ie(),W=(q==null?void 0:q.modo)??"comissao",{data:te}=Ae(W==="doacao"?q==null?void 0:q.partnerId:void 0);return ee?e.jsx(_e,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(I,{className:"h-12 w-64 bg-white/10"}),e.jsx("div",{className:"grid gap-4 grid-cols-1 md:grid-cols-3",children:[...Array(3)].map((s,t)=>e.jsx(I,{className:"h-32 bg-white/10"},t))})]})}):e.jsx(_e,{children:e.jsxs("div",{className:"space-y-6",children:[Ne&&e.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 p-4 text-sm text-red-200",children:[e.jsx("strong",{children:"Erro ao carregar dados financeiros:"})," ",Ne.message]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-white",children:"Financeiro"}),e.jsx("p",{className:"text-white/60",children:"Gerencie seu saldo, saques e contas bancárias"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(xe,{open:se,onOpenChange:s=>{N(s),s||(E(""),h({banco:"",agencia:"",conta:"",tipo_conta:"corrente",titular:"",cpf_cnpj:"",chave_pix:"",tipo_pix:""}))},children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(b,{variant:"outline",children:[e.jsx(ie,{className:"mr-2 h-4 w-4"}),"Cadastrar PIX"]})}),e.jsxs(pe,{className:"sm:max-w-md max-h-[90vh] overflow-y-auto bg-[hsl(222,47%,11%)] border-white/10 text-white",children:[e.jsxs(ue,{children:[e.jsx(je,{className:"text-white",children:"Cadastrar Conta PIX"}),e.jsx(we,{className:"text-white/60",children:"Adicione sua chave PIX para receber os pagamentos"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{className:"text-white/80",children:"Tipo de Chave PIX *"}),e.jsxs(re,{value:r,onValueChange:E,children:[e.jsx(oe,{className:"bg-white/5 border-white/20 text-white",children:e.jsx(ce,{placeholder:"Selecione o tipo de chave"})}),e.jsxs(le,{className:"bg-[hsl(222,47%,11%)] border-white/20",children:[e.jsx(g,{value:"cpf",className:"text-white hover:bg-white/10",children:"CPF"}),e.jsx(g,{value:"cnpj",className:"text-white hover:bg-white/10",children:"CNPJ"}),e.jsx(g,{value:"email",className:"text-white hover:bg-white/10",children:"E-mail"}),e.jsx(g,{value:"telefone",className:"text-white hover:bg-white/10",children:"Telefone"}),e.jsx(g,{value:"aleatoria",className:"text-white hover:bg-white/10",children:"Chave Aleatória"}),e.jsx(g,{value:"dados_bancarios",className:"text-white hover:bg-white/10",children:"Dados Bancários Completos"})]})]})]}),r&&r!=="dados_bancarios"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs(w,{className:"text-white/80",children:[r==="cpf"&&"CPF",r==="cnpj"&&"CNPJ",r==="email"&&"E-mail",r==="telefone"&&"Telefone",r==="aleatoria"&&"Chave Aleatória"," *"]}),r==="cpf"?e.jsx(de,{documentType:"cpf",value:i.chave_pix,onChange:(s,t,n)=>{h({...i,chave_pix:s,cpf_cnpj:s})},className:"bg-white/5 border-white/20 text-white placeholder:text-white/40"}):r==="cnpj"?e.jsx(de,{documentType:"cnpj",value:i.chave_pix,onChange:(s,t,n)=>{h({...i,chave_pix:s,cpf_cnpj:s})},className:"bg-white/5 border-white/20 text-white placeholder:text-white/40"}):r==="telefone"?e.jsx(P,{placeholder:"+55 (00) 00000-0000",value:i.chave_pix,onChange:s=>h({...i,chave_pix:cs(s.target.value)}),maxLength:19,className:"bg-white/5 border-white/20 text-white placeholder:text-white/40"}):e.jsx(P,{placeholder:r==="email"?"[email protected]":"Cole sua chave aleatória",value:i.chave_pix,onChange:s=>h({...i,chave_pix:s.target.value}),className:"bg-white/5 border-white/20 text-white placeholder:text-white/40"})]}),ae&&e.jsxs("div",{className:"space-y-4 border-t border-white/10 pt-4",children:[e.jsxs("p",{className:"text-sm text-amber-400/80 flex items-center gap-2",children:[e.jsx(Re,{className:"h-4 w-4"}),"Informe os dados bancários completos"]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{className:"text-white/80",children:"Banco *"}),e.jsx(P,{placeholder:"Nome do banco",value:i.banco,onChange:s=>h({...i,banco:s.target.value}),className:"bg-white/5 border-white/20 text-white placeholder:text-white/40"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{className:"text-white/80",children:"Tipo de Conta *"}),e.jsxs(re,{value:i.tipo_conta,onValueChange:s=>h({...i,tipo_conta:s}),children:[e.jsx(oe,{className:"bg-white/5 border-white/20 text-white",children:e.jsx(ce,{})}),e.jsxs(le,{className:"bg-[hsl(222,47%,11%)] border-white/20",children:[e.jsx(g,{value:"corrente",className:"text-white hover:bg-white/10",children:"Corrente"}),e.jsx(g,{value:"poupanca",className:"text-white hover:bg-white/10",children:"Poupança"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{className:"text-white/80",children:"Agência *"}),e.jsx(P,{placeholder:"0000",value:i.agencia,onChange:s=>h({...i,agencia:s.target.value}),className:"bg-white/5 border-white/20 text-white placeholder:text-white/40"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{className:"text-white/80",children:"Conta *"}),e.jsx(P,{placeholder:"00000-0",value:i.conta,onChange:s=>h({...i,conta:s.target.value}),className:"bg-white/5 border-white/20 text-white placeholder:text-white/40"})]})]})]}),r&&e.jsxs("div",{className:"space-y-4 border-t border-white/10 pt-4",children:[e.jsx("p",{className:"text-sm text-white/50",children:"Dados do Titular"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{className:"text-white/80",children:"Nome Completo *"}),e.jsx(P,{placeholder:"Nome completo do titular",value:i.titular,onChange:s=>h({...i,titular:s.target.value}),className:"bg-white/5 border-white/20 text-white placeholder:text-white/40"})]}),!ge&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{className:"text-white/80",children:"CPF/CNPJ *"}),e.jsx(de,{documentType:"dynamic",value:i.cpf_cnpj,onChange:s=>h({...i,cpf_cnpj:s}),className:"bg-white/5 border-white/20 text-white placeholder:text-white/40"})]}),ge&&i.cpf_cnpj&&e.jsxs("p",{className:"text-xs text-white/40",children:["Documento do titular: ",e.jsx("span",{className:"text-white/60",children:i.cpf_cnpj})," (mesmo da chave PIX)"]})]})]})]}),e.jsxs(be,{className:"gap-2 sticky bottom-0 bg-[hsl(222,47%,11%)] pt-4 border-t border-white/10",children:[e.jsx(b,{variant:"outline",onClick:()=>N(!1),children:"Cancelar"}),e.jsx(b,{onClick:Ve,disabled:y||!r,children:y?"Salvando...":"Salvar"})]})]})]}),W==="comissao"&&e.jsxs(xe,{open:o,onOpenChange:A,children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(b,{disabled:!a||a.saldo_disponivel<$,children:[e.jsx(he,{className:"mr-2 h-4 w-4"}),"Solicitar Saque"]})}),e.jsxs(pe,{className:"bg-[hsl(222,47%,11%)] border-white/10 text-white",children:[e.jsxs(ue,{children:[e.jsx(je,{className:"text-white",children:"Solicitar Saque"}),e.jsxs(we,{className:"text-white/60",children:["Saldo disponível: ",x((a==null?void 0:a.saldo_disponivel)||0)]})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{className:"text-white/80",children:"Valor do Saque"}),e.jsx(P,{type:"text",placeholder:"R$ 0,00",value:D,onChange:s=>V(s.target.value.replace(/[^\d,]/g,"")),className:"bg-white/5 border-white/20 text-white placeholder:text-white/40"}),e.jsxs("p",{className:"text-xs text-white/50",children:["Mínimo: R$ ",$,",00"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{className:"text-white/80",children:"Conta para Depósito"}),d&&d.length>0?e.jsxs(re,{value:j,onValueChange:v,children:[e.jsx(oe,{className:"bg-white/5 border-white/20 text-white",children:e.jsx(ce,{placeholder:"Selecione uma conta"})}),e.jsx(le,{className:"bg-[hsl(222,47%,11%)] border-white/20",children:d.map(s=>e.jsxs(g,{value:s.id,className:"text-white hover:bg-white/10",children:[s.banco," - Ag ",s.agencia," / CC ",s.conta]},s.id))})]}):e.jsx("p",{className:"text-sm text-white/50",children:"Cadastre uma conta bancária primeiro"})]})]}),e.jsxs(be,{className:"gap-2",children:[e.jsx(b,{variant:"outline",onClick:()=>A(!1),children:"Cancelar"}),e.jsx(b,{onClick:Xe,disabled:y||!j||!D,children:y?"Processando...":"Confirmar Saque"})]})]})]})]})]}),e.jsx(us,{partnerId:a==null?void 0:a.id,tierPercent:(a==null?void 0:a.tier)==="ouro"?"10% do MRR recorrente":null}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsx(Y,{title:"Saldo Disponível",value:x((a==null?void 0:a.saldo_disponivel)||0),icon:ye,iconColor:"green",subtitle:"Pronto para saque"}),e.jsx(Y,{title:"Saldo Pendente",value:x((a==null?void 0:a.saldo_pendente)||0),icon:hs,iconColor:"gold",subtitle:"Em período de retenção (7 dias)"}),e.jsx(Y,{title:"Total",value:x(((a==null?void 0:a.saldo_disponivel)||0)+((a==null?void 0:a.saldo_pendente)||0)),icon:he,iconColor:"blue",subt
1itle:"Disponível + Pendente"}),e.jsx(Y,{title:"Contas Cadastradas",value:(d==null?void 0:d.length)||0,icon:Ue,iconColor:"blue",subtitle:d&&d.length>0?`Principal: ${((fe=(ve=d.find(s=>s.principal))==null?void 0:ve.tipo_pix)==null?void 0:fe.toUpperCase())||"PIX"}`:void 0})]}),e.jsx(qe,{children:e.jsxs(Ze,{defaultValue:(a==null?void 0:a.tier)==="ouro"?"recorrente":"extrato",className:"w-full",children:[e.jsx("div",{className:"px-6 pt-6",children:e.jsxs(es,{className:"bg-white/5 border border-white/10",children:[(a==null?void 0:a.tier)==="ouro"&&e.jsxs(F,{value:"recorrente",className:"data-[state=active]:bg-[hsl(1,100%,50%)] data-[state=active]:text-white text-white/60",children:[e.jsx(ne,{className:"h-4 w-4 mr-2 text-amber-400"}),"Receita Recorrente"]}),e.jsx(F,{value:"extrato",className:"data-[state=active]:bg-[hsl(1,100%,50%)] data-[state=active]:text-white text-white/60",children:"Extrato"}),e.jsx(F,{value:"saques",className:"data-[state=active]:bg-[hsl(1,100%,50%)] data-[state=active]:text-white text-white/60",children:"Saques"}),W==="doacao"&&e.jsx(F,{value:"doacoes",className:"data-[state=active]:bg-[hsl(1,100%,50%)] data-[state=active]:text-white text-white/60",children:"Doações"}),e.jsx(F,{value:"contas",className:"data-[state=active]:bg-[hsl(1,100%,50%)] data-[state=active]:text-white text-white/60",children:"Contas Bancárias"})]})}),(a==null?void 0:a.tier)==="ouro"&&e.jsxs(k,{value:"recorrente",className:"mt-0 p-6 space-y-6",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-br from-amber-500/20 to-orange-500/10 border border-amber-500/30",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Ke,{className:"h-4 w-4 text-amber-400"}),e.jsx("span",{className:"text-sm font-medium text-amber-300",children:"Comissão Mensal"})]}),e.jsx("div",{className:"text-2xl font-bold text-amber-400",children:x(X.comissaoMensal)}),e.jsx("p",{className:"text-xs text-white/50 mt-1",children:"por mês, todo mês"})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-br from-amber-500/30 to-orange-400/20 border border-amber-400/50",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(ne,{className:"h-4 w-4 text-amber-400"}),e.jsx("span",{className:"text-sm font-medium text-amber-300",children:"Projeção 12 Meses"})]}),e.jsx("div",{className:"text-2xl font-bold text-amber-400",children:x(X.comissaoMensal*12)}),e.jsx("p",{className:"text-xs text-white/50 mt-1",children:"💰 mantendo clientes ativos"})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-white/5 border border-white/10",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(ze,{className:"h-4 w-4 text-amber-400"}),e.jsx("span",{className:"text-sm font-medium text-white/80",children:"Clientes Ativos"})]}),e.jsx("div",{className:"text-2xl font-bold text-white",children:X.clientesAtivos}),e.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["MRR: ",x(X.mrrTotal)]})]})]}),e.jsxs("div",{className:"rounded-lg border border-white/10 overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-white/10",children:[e.jsxs("h3",{className:"font-semibold text-white flex items-center gap-2",children:[e.jsx(ms,{className:"h-5 w-5 text-amber-400"}),"Clientes com Comissão Recorrente"]}),e.jsx("p",{className:"text-sm text-white/50",children:"Você recebe 10% do MRR de cada cliente indicado, todo mês"})]}),Oe?e.jsx("div",{className:"p-4 space-y-4",children:[...Array(3)].map((s,t)=>e.jsx(I,{className:"h-12 bg-white/10"},t))}):!B||B.length===0?e.jsxs("div",{className:"text-center py-12 text-white/50",children:[e.jsx(ne,{className:"mx-auto h-12 w-12 mb-4 text-amber-500/50"}),e.jsx("p",{children:"Nenhuma comissão recorrente ainda"}),e.jsx("p",{className:"text-sm mt-2",children:"Converta indicações para começar a receber comissões mensais!"})]}):e.jsxs(G,{children:[e.jsx(U,{children:e.jsxs(C,{className:"border-white/10 hover:bg-transparent",children:[e.jsx(c,{className:"text-white/60",children:"Cliente"}),e.jsx(c,{className:"text-right text-white/60",children:"MRR"}),e.jsx(c,{className:"text-right text-white/60",children:"Comissão/mês"}),e.jsx(c,{className:"text-center text-white/60",children:"Status"}),e.jsx(c,{className:"text-white/60",children:"Desde"})]})}),e.jsx(K,{children:B.map(s=>e.jsxs(C,{className:"border-white/10 hover:bg-white/5",children:[e.jsx(l,{className:"font-medium text-white",children:s.cliente_nome}),e.jsx(l,{className:"text-right text-white/80",children:x(Number(s.mrr_cliente))}),e.jsx(l,{className:"text-right font-medium text-amber-400",children:x(Number(s.valor_comissao))}),e.jsx(l,{className:"text-center",children:e.jsx(z,{className:`border ${s.ativo?"bg-[hsla(142,71%,45%,0.2)] border-[hsla(142,71%,45%,0.3)] text-[hsl(142,71%,45%)]":"bg-white/10 border-white/20 text-white/60"}`,children:s.ativo?"Ativo":"Inativo"})}),e.jsx(l,{className:"text-white/50 text-sm",children:O(new Date(s.created_at),"MMM/yyyy",{locale:H})})]},s.id))})]})]})]}),e.jsx(k,{value:"extrato",className:"mt-0 p-6",children:e.jsxs("div",{className:"rounded-lg border border-white/10 overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-white/10",children:[e.jsx("h3",{className:"font-semibold text-white",children:"Extrato Financeiro"}),e.jsx("p",{className:"text-sm text-white/50",children:"Histórico de todas as movimentações"})]}),_?e.jsx("div",{className:"p-4 space-y-4",children:[...Array(5)].map((s,t)=>e.jsx(I,{className:"h-12 bg-white/10"},t))}):(f==null?void 0:f.length)===0?e.jsxs("div",{className:"text-center py-12 text-white/50",children:[e.jsx(ye,{className:"mx-auto h-12 w-12 mb-4 opacity-50"}),e.jsx("p",{children:"Nenhuma movimentação ainda"})]}):e.jsxs(G,{children:[e.jsx(U,{children:e.jsxs(C,{className:"border-white/10 hover:bg-transparent",children:[e.jsx(c,{className:"text-white/60",children:"Data"}),e.jsx(c,{className:"text-white/60",children:"Tipo"}),e.jsx(c,{className:"text-white/60",children:"Descrição"}),e.jsx(c,{className:"text-right text-white/60",children:"Valor"}),e.jsx(c,{className:"text-right text-white/60",children:"Saldo"})]})}),e.jsx(K,{children:f==null?void 0:f.map(s=>{const t=De[s.tipo]||De.adjustment,n=t.icon,p=s.valor>0;return e.jsxs(C,{className:"border-white/10 hover:bg-white/5",children:[e.jsx(l,{className:"text-white/50 text-sm",children:O(new Date(s.created_at),"dd/MM/yyyy HH:mm",{locale:H})}),e.jsx(l,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{className:`h-4 w-4 ${t.color}`}),e.jsx("span",{className:"text-white",children:t.label})]})}),e.jsx(l,{className:"text-white/80",children:s.descricao||"-"}),e.jsxs(l,{className:`text-right font-medium ${p?"text-[hsl(142,71%,45%)]":"text-[hsl(1,100%,50%)]"}`,children:[p?"+":"",x(s.valor)]}),e.jsx(l,{className:"text-right text-white/50",children:x(s.saldo_posterior)})]},s.id)})})]})]})}),W==="doacao"&&e.jsxs(k,{value:"doacoes",className:"mt-0 p-6",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"font-semibold text-white",children:"Minhas Doações"}),e.jsx("p",{className:"text-sm text-white/50",children:"Comissões direcionadas ao Hospital do Câncer Araújo Jorge"})]}),!te||te.length===0?e.jsxs("div",{className:"py-12 text-center text-white/40",children:[e.jsx("p",{children:"Nenhuma doação registrada ainda"}),e.jsx("p",{className:"text-sm mt-2",children:"Assim que uma comissão for liberada, ela aparecerá aqui."})]}):e.jsxs(G,{children:[e.jsx(U,{children:e.jsxs(C,{className:"border-white/10 hover:bg-white/5",children:[e.jsx(c,{className:"text-white/60",children:"Data"}),e.jsx(c,{className:"text-white/60",children:"Origem"}),e.jsx(c,{className:"text-white/60",children:"Valor"}),e.jsx(c,{className:"text-white/60",children:"Situação"}),e.jsx(c,{className:"text-white/60",children:"Repasse"})]})}),e.jsx(K,{children:te.map(s=>e.jsxs(C,{className:"border-white/10 hover:bg-white/5",children:[e.jsx(l,{className:"text-white/80",children:O(new Date(s.created_at),"dd/MM/yyyy",{locale:H})}),e.jsx(l,{className:"text-white/60",children:s.observacao||s.origem}),e.jsx(l,{className:"text-white font-medium",children:x(Number(s.valor))}),e.jsx(l,{children:e.jsx(z,{variant:"outline",className:s.status==="repassado"?"bg-[hsla(142,71%,45%,0.2)] border-[hsla(142,71%,45%,0.3)] text-[hsl(142,71%,45%)]":"bg-yellow-500/20 border-yellow-500/30 text-yellow-400",children:s.status==="repassado"?"Repassado":"Pendente"})}),e.jsx(l,{className:"text-white/60",children:s.repassado_em?O(new Date(s.repassado_em),"dd/MM/yyyy",{locale:H}):"—"})]},s.id))})]})]}),e.jsx(k,{value:"saques",className:"mt-0 p-6",children:e.jsxs("div",{className:"rounded-lg border border-white/10 overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-white/10",children:[e.jsx("h3",{className:"font-semibold text-white",children:"Histórico de Saques"}),e.jsx("p",{className:"text-sm text-white/50",children:"Acompanhe suas 
1solicitações de saque"})]}),Le?e.jsx("div",{className:"p-4 space-y-4",children:[...Array(3)].map((s,t)=>e.jsx(I,{className:"h-12 bg-white/10"},t))}):(R==null?void 0:R.length)===0?e.jsxs("div",{className:"text-center py-12 text-white/50",children:[e.jsx(he,{className:"mx-auto h-12 w-12 mb-4 opacity-50"}),e.jsx("p",{children:"Nenhum saque solicitado"})]}):e.jsxs(G,{children:[e.jsx(U,{children:e.jsxs(C,{className:"border-white/10 hover:bg-transparent",children:[e.jsx(c,{className:"text-white/60",children:"Data"}),e.jsx(c,{className:"text-white/60",children:"Valor"}),e.jsx(c,{className:"text-white/60",children:"Conta"}),e.jsx(c,{className:"text-white/60",children:"Status"})]})}),e.jsx(K,{children:R==null?void 0:R.map(s=>{var n,p;const t=Te[s.status]||Te.pending;return e.jsxs(C,{className:"border-white/10 hover:bg-white/5",children:[e.jsx(l,{className:"text-white/50 text-sm",children:O(new Date(s.created_at),"dd/MM/yyyy HH:mm",{locale:H})}),e.jsx(l,{className:"font-medium text-white",children:x(Number(s.valor))}),e.jsxs(l,{className:"text-white/80",children:[(n=s.bank_accounts)==null?void 0:n.banco," - ",(p=s.bank_accounts)==null?void 0:p.conta]}),e.jsx(l,{children:e.jsx(z,{className:`border ${t.bgColor} ${t.textColor}`,children:t.label})})]},s.id)})})]})]})}),e.jsx(k,{value:"contas",className:"mt-0 p-6",children:e.jsxs("div",{className:"rounded-lg border border-white/10 overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-white/10 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-white",children:"Contas Bancárias"}),e.jsx("p",{className:"text-sm text-white/50",children:"Gerencie suas contas para recebimento"})]}),e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>N(!0),children:[e.jsx(Qe,{className:"mr-2 h-4 w-4"}),"Nova Conta"]})]}),Ee?e.jsx("div",{className:"p-4 space-y-4",children:[...Array(2)].map((s,t)=>e.jsx(I,{className:"h-20 bg-white/10"},t))}):(d==null?void 0:d.length)===0?e.jsxs("div",{className:"text-center py-12 text-white/50",children:[e.jsx(ie,{className:"mx-auto h-12 w-12 mb-4 opacity-50"}),e.jsx("p",{children:"Nenhuma conta cadastrada"}),e.jsx("p",{className:"text-sm mt-2",children:"Cadastre uma conta para solicitar saques"})]}):e.jsx("div",{className:"p-4 grid gap-4",children:d==null?void 0:d.map(s=>e.jsx("div",{className:`p-4 rounded-xl border transition-all ${s.principal?"bg-[hsl(1,100%,50%)]/10 border-[hsl(1,100%,50%)]/30":"bg-white/5 border-white/10"}`,children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${s.principal?"bg-[hsl(1,100%,50%)]/20":"bg-white/10"}`,children:e.jsx(ie,{className:`h-5 w-5 ${s.principal?"text-[hsl(1,100%,50%)]":"text-white/60"}`})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-white",children:s.banco}),s.principal&&e.jsx(z,{className:"bg-[hsl(1,100%,50%)] text-white text-xs",children:"Principal"})]}),e.jsxs("p",{className:"text-sm text-white/60 mt-0.5",children:["Ag: ",s.agencia," | Conta: ",s.conta," | ",s.tipo_conta==="corrente"?"Corrente":s.tipo_conta==="poupanca"?"Poupança":"PIX"]}),e.jsxs("p",{className:"text-xs text-white/40 mt-1",children:[s.titular," - ",s.cpf_cnpj]}),s.chave_pix&&e.jsxs("p",{className:"text-xs text-white/40 mt-0.5",children:["PIX (",s.tipo_pix,"): ",s.chave_pix]})]})]})})},s.id))})]})})]})})]})})}export{Us 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.