PageSourceSearch

https://maestro.pontua.com.br/assets/ParceiroLojinhaDetalhe-DWqXWIoP.js

js pontua.com.br collected 2026-10-01 14:15:35 UTC 13,884 bytes, 1 lines download raw bytes

1import{r as w,j as e,f as q,u as D,L as O}from"./vendor-react-DIA7vK4g.js";import{b6 as z,bL as T,bM as V,bN as I,bO as $,bS as J,bP as r,bz as d,z as M,by as Q,bQ as G,bm as m,aa as P,ba as W,b9 as C,bi as B,aR as H,d as K,bF as U,s as F,L as X,ah as Y,ad as Z,T as ee}from"./index-DtUVjOr4.js";import{P as S}from"./ParceiroLayout-DqodW2gQ.js";import{u as se}from"./parceiro-pontua-simbolo-BHn6Fgkh.js";import{b as ae,a as oe,c as te,g as ie,t as R,d as le,e as ne,C as ce}from"./solution-state-DVzjhgpt.js";import{R as re,a as A}from"./radio-group-CV0oqF9i.js";import{A as me,a as de,b as he,c as xe}from"./accordion-u7Y1_Ni9.js";import"./vendor-docs-BA9xu9ak.js";import"./vendor-utils-DWHjTIse.js";import"./vendor-supabase-_bOAMmkC.js";import"./scroll-area-DFJSP9HM.js";import"./asArray-CTPHXM1A.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"./heart-handshake-Cb8AzQJA.js";import"./log-out-CMftDkmm.js";import"./partner-license-benefit-C5AbcGFu.js";import"./index-C-uNlZii.js";const f=u=>u.replace(/\D/g,"");function pe({open:u,onOpenChange:j,partner:s,maxColaboradores:o}){const N=z(),[c,x]=w.useState(1),[b,_]=w.useState(!1),[h,g]=w.useState(!1),[a,v]=w.useState(()=>{const t=(s==null?void 0:s.metadata)??{},i=(s==null?void 0:s.telefone)||t.telefone||t.phone||"";return{tipo_pessoa:(s==null?void 0:s.tipo_pessoa)==="pf"||!(s!=null&&s.cnpj)?"pf":"pj",company_name:(s==null?void 0:s.razao_social)||(s==null?void 0:s.nome_completo)||"",trade_name:(s==null?void 0:s.nome_fantasia)||"",document:(s==null?void 0:s.cnpj)||(s==null?void 0:s.cpf)||"",email:(s==null?void 0:s.email)||"",phone:i,owner_name:(s==null?void 0:s.nome_responsavel)||(s==null?void 0:s.nome_completo)||"",owner_email:(s==null?void 0:s.email)||"",owner_phone:i,owner_cpf:(s==null?void 0:s.cpf_responsavel)||(s==null?void 0:s.cpf)||""}}),n=(t,i)=>v(l=>({...l,[t]:i})),p=a.company_name.trim().length>1&&f(a.document).length===(a.tipo_pessoa==="pj"?14:11)&&a.email.includes("@")&&f(a.phone).length>=10,y=a.owner_name.trim().length>1&&a.owner_email.includes("@")&&f(a.owner_cpf).length===11,L=async()=>{var t;g(!0);try{const{data:i,error:l}=await W.functions.invoke("partner-redeem-free-license",{body:{tipo_pessoa:a.tipo_pessoa,company_name:a.company_name,trade_name:a.trade_name||null,document:f(a.document),email:a.email,phone:a.phone,owner_name:a.owner_name,owner_email:a.owner_email,owner_phone:a.owner_phone,owner_cpf:f(a.owner_cpf)}});if(l){const E=l!=null&&l.context?await l.context.text():l.message;let k="Não foi possível ativar sua licença.";try{k=((t=JSON.parse(E))==null?void 0:t.error)??k}catch{}throw new Error(k)}if(i!=null&&i.error)throw new Error(i.error);C.success("Sistema Pontua resgatado! Os acessos serão enviados por e-mail."),N.invalidateQueries({queryKey:["partner"]}),N.invalidateQueries({queryKey:["marketplace-redemptions"]}),j(!1),x(1)}catch(i){C.error((i==null?void 0:i.message)??"Não foi possível ativar sua licença.")}finally{g(!1)}};return e.jsx(T,{open:u,onOpenChange:t=>!h&&j(t),children:e.jsxs(V,{className:"max-h-[90vh] max-w-lg overflow-y-auto",children:[e.jsxs(I,{children:[e.jsx($,{children:"Resgatar Sistema Pontua"}),e.jsxs(J,{children:["Passo ",c," de 3 — confirme os dados para criarmos sua conta."]})]}),c===1&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{children:"Tipo de conta"}),e.jsxs(re,{value:a.tipo_pessoa,onValueChange:t=>n("tipo_pessoa",t),className:"flex gap-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{value:"pj",id:"tp-pj"}),e.jsx(r,{htmlFor:"tp-pj",className:"font-normal",children:"Pessoa jurídica"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{value:"pf",id:"tp-pf"}),e.jsx(r,{htmlFor:"tp-pf",className:"font-normal",children:"Pessoa física"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"company_name",children:a.tipo_pessoa==="pj"?"Razão social":"Nome completo"}),e.jsx(d,{id:"company_name",value:a.company_name,maxLength:120,onChange:t=>n("company_name",t.target.value)})]}),a.tipo_pessoa==="pj"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"trade_name",children:"Nome fantasia"}),e.jsx(d,{id:"trade_name",value:a.trade_name,maxLength:120,onChange:t=>n("trade_name",t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"document",children:a.tipo_pessoa==="pj"?"CNPJ":"CPF"}),e.jsx(d,{id:"document",value:a.document,maxLength:18,onChange:t=>n("document",t.target.value)})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"email",children:"E-mail da conta"}),e.jsx(d,{id:"email",type:"email",value:a.email,maxLength:255,onChange:t=>n("email",t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"phone",children:"Telefone"}
1),e.jsx(d,{id:"phone",value:a.phone,maxLength:20,onChange:t=>n("phone",t.target.value)})]})]})]}),c===2&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"owner_name",children:"Nome do responsável"}),e.jsx(d,{id:"owner_name",value:a.owner_name,maxLength:120,onChange:t=>n("owner_name",t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"owner_cpf",children:"CPF do responsável"}),e.jsx(d,{id:"owner_cpf",value:a.owner_cpf,maxLength:14,onChange:t=>n("owner_cpf",t.target.value)})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"owner_email",children:"E-mail do responsável"}),e.jsx(d,{id:"owner_email",type:"email",value:a.owner_email,maxLength:255,onChange:t=>n("owner_email",t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"owner_phone",children:"Telefone do responsável"}),e.jsx(d,{id:"owner_phone",value:a.owner_phone,maxLength:20,onChange:t=>n("owner_phone",t.target.value)})]})]})]}),c===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-border bg-muted/40 p-4 text-sm",children:[e.jsx("p",{className:"font-medium",children:a.company_name}),e.jsxs("p",{className:"text-muted-foreground",children:[a.tipo_pessoa==="pj"?"CNPJ":"CPF",": ",a.document]}),e.jsxs("p",{className:"text-muted-foreground",children:[a.email," · ",a.phone]}),e.jsxs("div",{className:"mt-3 border-t border-border pt-3",children:[e.jsxs("p",{className:"font-medium",children:["Responsável: ",a.owner_name]}),e.jsxs("p",{className:"text-muted-foreground",children:["CPF: ",a.owner_cpf," · ",a.owner_email]})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-border pt-3",children:[e.jsx(M,{className:"h-4 w-4 text-emerald-500"}),e.jsxs("span",{children:["Licença liberada para até ",o," colaboradores"]})]})]}),e.jsxs("label",{className:"flex items-start gap-3 text-sm",children:[e.jsx(Q,{checked:b,onCheckedChange:t=>_(t===!0)}),e.jsx("span",{className:"text-muted-foreground",children:"Entendo que a licença é gratuita enquanto eu for um parceiro ativo e está sujeita à meta trimestral de indicações do programa."})]})]}),e.jsxs(G,{className:"gap-2 sm:justify-between",children:[e.jsx(m,{variant:"ghost",disabled:h,onClick:()=>c===1?j(!1):x(c-1),children:c===1?"Cancelar":"Voltar"}),c<3?e.jsx(m,{onClick:()=>x(c+1),disabled:c===1?!p:!y,children:"Continuar"}):e.jsxs(m,{onClick:L,disabled:!b||h,children:[h&&e.jsx(P,{className:"mr-2 h-4 w-4 animate-spin"}),"Confirmar resgate"]})]})]})})}function Oe(){const{slug:u}=q(),j=D(),{partner:s}=se(),{data:o,isLoading:N}=ae(u),{data:c}=oe(),x=te(),[b,_]=w.useState(!1);if(N)return e.jsx(S,{children:e.jsx(B,{className:"h-96 w-full rounded-2xl bg-white/5"})});if(!o)return e.jsx(S,{children:e.jsxs("div",{className:"rounded-2xl border border-white/10 bg-white/[0.03] p-10 text-center text-white/70",children:[e.jsx(H,{className:"mx-auto mb-3 h-8 w-8 text-white/30"}),e.jsx("p",{children:"Solução não encontrada."}),e.jsx(m,{variant:"outline",className:"mt-4",onClick:()=>j("/parceiro-pontua/lojinha"),children:"Voltar para a Lojinha"})]})});const h=ie(o,c??[],s),g=R(o.beneficios),a=R(o.passos),v=le(o.faq),n=o.tipo_acao==="licenca_pontua",p=ne(s),y=((s==null?void 0:s.pontos_disponiveis)??
10)>=o.pontos_necessarios,L=async()=>{try{await x.mutateAsync({solutionId:o.id}),C.success("Resgate solicitado! Nosso time entrará em contato com as instruções.")}catch(i){C.error((i==null?void 0:i.message)??"Não foi possível concluir o resgate.")}},t=()=>h.kind==="resgatado"?e.jsxs(m,{disabled:!0,className:"w-full gap-2",children:[e.jsx(F,{className:"h-4 w-4"})," Já resgatado"]}):h.kind==="pendente"?e.jsxs(m,{disabled:!0,className:"w-full gap-2",children:[e.jsx(P,{className:"h-4 w-4 animate-spin"})," ",h.label]}):o.status==="em_breve"?e.jsx(m,{disabled:!0,className:"w-full",children:"Em breve"}):n?e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{className:"w-full",disabled:!p.eligible,onClick:()=>_(!0),children:"Resgatar Sistema Pontua"}),p.reason&&e.jsx("p",{className:"text-xs text-white/50",children:p.reason})]}):o.tipo_acao==="contato"?e.jsxs("div",{className:"space-y-2",children:[o.contato_whatsapp&&e.jsx(m,{asChild:!0,className:"w-full gap-2",children:e.jsxs("a",{href:`https://wa.me/${o.contato_whatsapp.replace(/\D/g,"")}`,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(Y,{className:"h-4 w-4"})," Falar no WhatsApp"]})}),o.contato_email&&e.jsx(m,{asChild:!0,variant:"outline",className:"w-full gap-2",children:e.jsxs("a",{href:`mailto:${o.contato_email}`,children:[e.jsx(Z,{className:"h-4 w-4"})," Enviar e-mail"]})}),o.contato_url&&e.jsx(m,{asChild:!0,variant:"outline",className:"w-full gap-2",children:e.jsxs("a",{href:o.contato_url,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(ee,{className:"h-4 w-4"})," Saber mais"]})})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs(m,{className:"w-full",disabled:!y||x.isPending,onClick:L,children:[x.isPending&&e.jsx(P,{className:"mr-2 h-4 w-4 animate-spin"}),o.pontos_necessarios>0?`Resgatar por ${o.pontos_necessarios} pontos`:"Resgatar benefício"]}),!y&&e.jsxs("p",{className:"text-xs text-white/50",children:["Você tem ",(s==null?void 0:s.pontos_disponiveis)??
10," pontos e precisa de"," ",o.pontos_necessarios,"."]})]});return e.jsxs(S,{children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs(O,{to:"/parceiro-pontua/lojinha",className:"inline-flex items-center gap-2 text-sm text-white/60 hover:text-white",children:[e.jsx(K,{className:"h-4 w-4"})," Voltar para a Lojinha"]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[1fr_340px]",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"overflow-hidden rounded-2xl border border-white/10 bg-white/[0.03]",children:[o.capa_url&&e.jsx("img",{src:o.capa_url,alt:`Capa da solução ${o.nome}`,className:"h-48 w-full object-cover sm:h-60"}),e.jsxs("div",{className:"space-y-3 p-5 sm:p-6",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[o.logo_url&&e.jsx("img",{src:o.logo_url,alt:`Logo ${o.nome}`,className:"h-14 w-14 rounded-xl object-contain"}),e.jsxs("div",{children:[e.jsx(U,{variant:"outline",className:"mb-1 border-white/15 text-white/60",children:ce[o.categoria]??o.categoria}),e.jsx("h1",{className:"text-2xl font-bold text-white sm:text-3xl",children:o.nome}),o.chamada&&e.jsx("p",{className:"mt-1 text-white/60",children:o.chamada})]})]}),o.descricao&&e.jsx("p",{className:"whitespace-pre-line text-sm leading-relaxed text-white/70",children:o.descricao})]})]}),g.length>0&&e.jsxs("section",{className:"rounded-2xl border border-white/10 bg-white/[0.03] p-5 sm:p-6",children:[e.jsx("h2",{className:"mb-3 text-lg font-semibold text-white",children:"O que você recebe"}),e.jsx("ul",{className:"space-y-2",children:g.map((i,l)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-white/70",children:[e.jsx(F,{className:"mt-0.5 h-4 w-4 shrink-0 text-emerald-400"}),i]},l))})]}),a.length>0&&e.jsxs("section",{className:"rounded-2xl border border-white/10 bg-white/[0.03] p-5 sm:p-6",children:[e.jsx("h2",{className:"mb-3 text-lg font-semibold text-white",children:"Como funciona"}),e.jsx("ol",{className:"space-y-3",children:a.map((i,l)=>e.jsxs("li",{className:"flex items-start gap-3 text-sm text-white/70",children:[e.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-[hsla(1,100%,50%,0.15)] text-xs font-semibold text-[hsl(1,100%,70%)]",children:l+1}),i]},l))})]}),v.length>0&&e.jsxs("section",{className:"rounded-2xl border border-white/10 bg-white/[0.03] p-5 sm:p-6",children:[e.jsx("h2",{className:"mb-2 text-lg font-semibold text-white",children:"Perguntas frequentes"}),e.jsx(me,{type:"single",collapsible:!0,children:v.map((i,l)=>e.jsxs(de,{value:`faq-${l}`,className:"border-white/10",children:[e.jsx(he,{className:"text-left text-sm text-white/80",children:i.pergunta}),e.jsx(xe,{className:"text-sm text-white/60",children:i.resposta})]},l))})]})]}),e.jsx("aside",{className:"lg:sticky lg:top-6 lg:self-start",children:e.jsxs("div",{className:"space-y-4 rounded-2xl border border-white/10 bg-white/[0.04] p-5",children:[o.beneficio_resumo&&e.jsx("p",{className:"text-sm text-white/70",children:o.beneficio_resumo}),e.jsxs("div",{className:"flex items-center justify-between text-sm text-white/60",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(X,{className:"h-4 w-4 text-amber-300"})," Seus pontos"]}),e.jsx("span",{className:"font-semibold text-white",children:(s==null?void 0:s.pontos_disponiveis)??
10})]}),t()]})})]})]}),n&&e.jsx(pe,{open:b,onOpenChange:_,partner:s,maxColaboradores:p.maxColaboradores})]})}export{Oe 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.