PageSourceSearch

https://app.hubmax.ai/assets/FormsHub-B9MMoaWZ.js

js hubmax.ai collected 2026-10-05 15:15:55 UTC 17,499 bytes, 1 lines download raw bytes

1import{b as V,r as p,j as e}from"./vendor-react-c04Qizzb.js";import{u as H,a as K,b as y}from"./vendor-query-Beh96XiU.js";import{M as X,ak as Y,u as J,s as Z,x as P,a8 as ee,a9 as ae,O as _,t as i,cY as se,aj as re,cI as te,cz as oe,aW as ie,I,bw as le,ac as q,S as ne,a as f,U as w,az as G,cX as de,Q as ce,a7 as o}from"./index-CS71Crlq.js";import{E as me,f as pe,h as ue,i as xe,j as he,c as ge}from"./formsService-B-ZZmH3r.js";import{A as O}from"./PaymentIcons-BamoSLRH.js";import{T as be}from"./templateApi-B7oQcxpV.js";import{E as fe}from"./clinicPresentation-CcCJYc_1.js";import{G as ve,H as je}from"./HelpHint-0TUQMws1.js";import{U as Ne}from"./interactionService-nRaPmI4q.js";import{C as ke}from"./calculator-C9N5j-94.js";import{T as ye}from"./ticket-BifOU2hl.js";import{G as we}from"./types-DgUNzYh1.js";import{L as Ce}from"./life-buoy-pdv8wyFP.js";import{D as Pe,a as Ee,b as Ae,c as n,d as Fe}from"./dropdown-menu-D3rsV1wL.js";import{F as C}from"./SettingsSearch-pklPEDA8.js";import{P as Le}from"./usePlaybooks-DkKTQRZ-.js";import{L as Se}from"./list-checks-CfgM7Rc0.js";import{T as Me}from"./useLongPress-DvC0mrvk.js";import{P as De}from"./SubmissionDetailSheet-C9Y6YIOB.js";import{L as Te}from"./flowService-8UtiEI3r.js";import{L as _e}from"./layout-template-jMUvB5ow.js";import"./vendor-utils-CbK4XRml.js";import"./vendor-i18n-CTh7dEoX.js";import"./sanitize-q_brDuvP.js";import"./statusService-BO7958ha.js";import"./massDispatchService-5vzcykBl.js";const Ie=[{id:"lead-capture",title:"Captação de leads",description:"Nome, contato e interesse. Já dispara o evento Lead no Pixel.",icon:Ne,badge:"Marketing",highlights:["Nome, email e WhatsApp","Campo de interesse","Consentimento LGPD"]},{id:"contact",title:"Fale conosco",description:"O clássico formulário de contato do site, direto ao ponto.",icon:X,badge:"Site",highlights:["Dados de contato","Campo de mensagem","Consentimento LGPD"]},{id:"quote",title:"Solicitar orçamento",description:"Qualifica o pedido com empresa, serviço e orçamento estimado.",icon:ke,badge:"Vendas",highlights:["Empresa e serviço","Orçamento estimado","Detalhes do projeto"]},{id:"event",title:"Inscrição em evento",description:"Capa de boas-vindas e confirmação de presença com lembretes.",icon:ye,badge:"Evento",highlights:["Capa de boas-vindas","Origem do inscrito","Aceite de lembretes"]},{id:"nps",title:"Pesquisa de satisfação",description:"Escala NPS de 0 a 10 com espaço para o cliente justificar a nota.",icon:we,badge:"Pesquisa",highlights:["Escala NPS 0 a 10","Motivo da nota","Não exige contato"]},{id:"newsletter",title:"Assinar newsletter",description:"Curto e objetivo, só o essencial para crescer sua lista.",icon:Y,badge:"Lista",highlights:["Nome e email","Consentimento LGPD","Pronto para publicar"]},{id:"support",title:"Abrir chamado de suporte",description:"Tipo de problema e descrição para triagem rápida do atendimento.",icon:Ce,badge:"Suporte",highlights:["Tipo de problema","Descrição do caso","Dados de contato"]}],qe={draft:{label:"Rascunho",className:"bg-slate-100 text-slate-600 border-slate-200 dark:bg-slate-800 dark:text-slate-300 dark:border-slate-700"},published:{label:"Publicado",className:"bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-950/40 dark:text-emerald-400 dark:border-emerald-900"},archived:{label:"Arquivado",className:"bg-slate-100 text-slate-400 border-slate-200 dark:bg-slate-800/60 dark:text-slate-500 dark:border-slate-700"}},Ge=[{id:"template",label:"Templates",icon:_e},{id:"ai",label:"Criar com IA",icon:ne},{id:"zero",label:"Do zero",icon:P}],Oe=["Captação de leads para uma clínica odontológica","Inscrição em um workshop online de marketing","Orçamento de marmoraria, com tipo de pedra e metragem"];function pa(){const l=V(),$=H(),{tenantId:E}=J(),[z,A]=p.useState(!1),[g,F]=p.useState("template"),[L,S]=p.useState(""),[b,v]=p.useState(""),[R,j]=p.useState(null),[r,u]=p.useState(null),M=["forms",E],{data:N,isLoading:B}=K({queryKey:M,queryFn:ge,enabled:!!E}),k=()=>$.invalidateQueries({queryKey:M}),d=y({mutationFn:({name:a,templateKey:s})=>pe(a,s?{templateKey:s}:{}),onSuccess:(a,s)=>{k(),o.success(s.templateKey?"Formulário criado a partir do template":"Formulário criado"),l(`/aplicativos/formularios/${a.id}`)},onError:a=>{j(null),o.error(a.message||"Falha ao criar formulário")}}),c=y({mutationFn:a=>ue(a),onSuccess:a=>{k(),o.success("Formulário gerado. Revise os campos e publique."),l(`/aplicativos/formularios/${a.id}`)},onError:a=>o.error(a.message||"Não foi possível gerar o formulário")}),x=y({mutationFn:async({id:a,action:s})=>s==="delete"?xe(a):he[`${s}Form`](a),onSuccess:(a,{action:s})=>{k();const t={publish:"Formulário publicado",unpublish:"Formulário despublicado",archive:"Formulário arquivado",duplicate:"Formulário duplicado",delete:"Formulário excluído"};o.success(t[s])},onError:a=>o.error(a.message||"Falha na operação")}),m=d.isPending||c.isPending,D=()=>{m||d.mutate({name:L.trim()||"Novo formulário"})},W=(a,s)=>{m||(j(a),d.mutate({name:s,templateKey:a}))},Q=()=>{m||b.trim().length<8||c.mutate(b.trim())},T=()=>{F("template"),S(""),v(""),j(null),A(!0)},U=a=>{var t;const s=`${window.location.origin}/f/${a}
1`;(t=navigator.clipboard)!=null&&t.writeText?navigator.clipboard.writeText(s).then(()=>o.success("Link copiado")).catch(()=>o.error("Não foi possível copiar o link")):o.error("Não foi possível copiar o link")};return e.jsxs(me,{inlineActionsOnMobile:!0,title:"Formulários",subtitle:"Crie formulários de captura e transforme respostas em contatos, negócios e conversas",icon:C,onBack:()=>l("/aplicativos"),actions:e.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[e.jsxs(i,{variant:"outline",className:"h-11 w-11 rounded-full sm:h-10 p-0 sm:w-auto sm:rounded-lg sm:px-4","aria-label":"Ver capturas",onClick:()=>l("/aplicativos/formularios/respostas"),children:[e.jsx(I,{className:"h-4 w-4 sm:mr-2","aria-hidden":!0}),e.jsx("span",{className:"max-sm:sr-only",children:"Capturas"})]}),e.jsxs(i,{onClick:T,className:"h-11 w-11 rounded-full sm:h-10 bg-primary p-0 font-bold text-primary-foreground shadow-md shadow-primary/20 hover:bg-primary/90 sm:w-auto sm:rounded-lg sm:px-4","aria-label":"Novo formulário",children:[e.jsx(P,{className:"h-4 w-4 sm:mr-2","aria-hidden":!0}),e.jsx("span",{className:"max-sm:sr-only",children:"Novo formulário"})]})]}),scrollClassName:"pb-safe-plus-nav",children:[B?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Array.from({length:3}).map((a,s)=>e.jsx(Z,{className:"h-44 rounded-xl"},s))}):!N||N.length===0?e.jsx(fe,{icon:C,title:"Nenhum formulário ainda",description:"Monte seu primeiro formulário de captura. Cada resposta pode virar contato no CRM, negócio no pipeline, conversa no WhatsApp e evento Lead no Pixel.",action:{label:"Criar formulário",onClick:T,icon:P,variant:"primary"}}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:N.map(a=>{const s=qe[a.status],t=a.view_count>0?Math.round(a.submission_count/a.view_count*1e3)/10:null;return e.jsxs(ee,{className:"group relative flex h-full flex-col overflow-hidden border border-border/60 rounded-2xl bg-card/50 shadow-sm transition-all duration-300 hover:border-primary/30 hover:shadow-lg hover:-translate-y-0.5 cursor-pointer",onClick:()=>l(`/aplicativos/formularios/${a.id}`),children:[e.jsx("div",{className:"absolute left-0 top-0 h-full w-1 bg-slate-200 dark:bg-slate-700 transition-colors duration-200 group-hover:bg-primary"}),e.jsxs(ae,{className:"p-5 pl-6 flex flex-col gap-4 h-full",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("div",{className:"h-11 w-11 flex items-center justify-center rounded-2xl bg-slate-100 dark:bg-slate-800/60 text-slate-500 dark:text-slate-400 shadow-sm group-hover:text-primary transition-colors",children:e.jsx(C,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(_,{variant:"outline",className:`text-[10px] px-2 py-0.5 font-semibold uppercase ${s.className}`,children:s.label}),e.jsxs(Pe,{children:[e.jsx(Ee,{asChild:!0,onClick:h=>h.stopPropagation(),children:e.jsx(i,{variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-600 dark:hover:text-slate-300",children:e.jsx(se,{className:"h-4 w-4"})})}),e.jsxs(Ae,{align:"end",onClick:h=>h.stopPropagation(),children:[e.jsxs(n,{onClick:()=>l(`/aplicativos/formularios/${a.id}`),children:[e.jsx(Le,{className:"h-4 w-4 mr-2"})," Editar"]}),e.jsxs(n,{onClick:()=>l(`/aplicativos/formularios/${a.id}/respostas`),children:[e.jsx(Se,{className:"h-4 w-4 mr-2"})," Ver capturas"]}),a.status==="published"?e.jsxs(n,{onClick:()=>x.mutate({id:a.id,action:"unpublish"}),children:[e.jsx(ve,{className:"h-4 w-4 mr-2"})," Despublicar"]}):e.jsxs(n,{onClick:()=>x.mutate({id:a.id,action:"publish"}),children:[e.jsx(re,{className:"h-4 w-4 mr-2"})," Publicar"]}),e.jsxs(n,{onClick:()=>x.mutate({id:a.id,action:"duplicate"}),children:[e.jsx(te,{className:"h-4 w-4 mr-2"})," Duplicar"]}),a.status!=="archived"&&e.jsxs(n,{onClick:()=>x.mutate({id:a.id,action:"archive"}),children:[e.jsx(oe,{className:"h-4 w-4 mr-2"})," Arquivar"]}),e.jsx(Fe,{}),e.jsxs(n,{className:"text-rose-600 focus:text-rose-600",onClick:()=>u(a),children:[e.jsx(Me,{className:"h-4 w-4 mr-2"})," Excluir"]})]})]})]})]}),e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsx("h2",{className:"text-base font-semibold tracking-tight text-slate-700 dark:text-slate-100 group-hover:text-primary transition-colors line-clamp-1",children:a.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Atualizado em ",new Date(a.updated_at).toLocaleDateString("pt-BR")]})]}),e.jsxs("div",{className:"pt-3 border-t border-border/60 space-y-2.5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(ie,{className:"h-3.5 w-3.5 text-slate-400"}),e.jsx("span",{className:"font-medium tabular-nums text-slate-600 dar
1k:text-slate-300",children:a.view_count}),"visualizações"]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(I,{className:"h-3.5 w-3.5 text-slate-400"}),e.jsx("span",{className:"font-medium tabular-nums text-slate-600 dark:text-slate-300",children:a.submission_count}),"capturas"]}),t!==null&&e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(De,{className:"h-3.5 w-3.5 text-slate-400"}),e.jsxs("span",{className:"font-medium tabular-nums text-slate-600 dark:text-slate-300",children:[t,"%"]}),"conversão"]})]}),a.status==="published"?e.jsxs("div",{className:"flex items-center gap-1.5",onClick:h=>h.stopPropagation(),children:[e.jsxs("code",{className:"flex-1 truncate rounded-md bg-slate-100 dark:bg-slate-800/60 px-2 py-1 text-[11px] font-mono text-slate-500 dark:text-slate-400",children:["/f/",a.slug]}),e.jsx("button",{type:"button",onClick:()=>U(a.slug),"aria-label":"Copiar link público",title:"Copiar link",className:"shrink-0 h-7 w-7 flex items-center justify-center rounded-md text-slate-400 hover:text-slate-600 dark:hover:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors",children:e.jsx(Te,{className:"h-3.5 w-3.5"})}),e.jsx("a",{href:`/f/${a.slug}`,target:"_blank",rel:"noopener noreferrer","aria-label":"Abrir formulário",title:"Abrir formulário",className:"shrink-0 h-7 w-7 flex items-center justify-center rounded-md text-slate-400 hover:text-slate-600 dark:hover:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors",children:e.jsx(le,{className:"h-3.5 w-3.5"})})]}):e.jsx("div",{className:"flex items-center justify-end",children:e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-slate-400 group-hover:text-primary transition-colors",children:["Abrir editor",e.jsx(q,{className:"h-3.5 w-3.5"})]})})]})]})]},a.id)})}),e.jsxs(O,{open:z,onOpenChange:a=>!m&&A(a),title:"Criar formulário",description:"Escolha por onde começar. Você ajusta tudo depois no editor.",surfaceId:"forms-create",mode:"bottom",className:"sm:w-[min(calc(100vw-2rem),42rem)]",contentClassName:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3",children:Ge.map(a=>{const s=g===a.id;return e.jsxs("button",{type:"button",onClick:()=>F(a.id),disabled:m,className:f("flex flex-col items-center gap-1.5 rounded-lg border p-3 text-center transition-colors disabled:opacity-60",s?"border-primary bg-primary/5 ring-1 ring-primary/20":"border-border/60 hover:border-slate-300 dark:hover:border-slate-600"),children:[e.jsx(a.icon,{className:f("h-5 w-5",s?"text-primary":"text-slate-400")}),e.jsx("span",{className:f("text-xs font-semibold",s?"text-slate-800 dark:text-slate-100":"text-slate-500"),children:a.label})]},a.id)})}),g==="template"&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 max-h-[52vh] overflow-y-auto pr-1 -mr-1",children:Ie.map(a=>{const s=R===a.id;return e.jsxs("button",{type:"button",onClick:()=>W(a.id,a.title),disabled:m,className:f("group relative flex flex-col gap-2 rounded-xl border border-border/60 bg-card/50 p-4 text-left transition-all","hover:border-primary/40 hover:shadow-md disabled:opacity-60"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-slate-100 dark:bg-slate-800 text-slate-500 dark:text-slate-400 group-hover:text-primary transition-colors",children:s?e.jsx(w,{className:"h-4 w-4 animate-spin"}):e.jsx(a.icon,{className:"h-4 w-4"})}),e.jsx(_,{variant:"outline",className:"text-[10px] px-2 py-0.5 font-medium text-slate-500 border-slate-200 dark:border-slate-700",children:a.badge})]}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("h3",{className:"text-sm font-semibold text-slate-700 dark:text-slate-100 group-hover:text-primary transition-colors",children:a.title}),e.jsx("p",{className:"text-xs text-muted-foreground leading-snug",children:a.description})]}),e.jsx("ul",{className:"mt-auto flex flex-wrap gap-1 pt-1",children:a.highlights.map(t=>
1e.jsx("li",{className:"rounded-md bg-slate-100 dark:bg-slate-800/60 px-1.5 py-0.5 text-[10px] text-slate-500 dark:text-slate-400",children:t},t))})]},a.id)})}),g==="ai"&&e.jsxs("div",{className:"space-y-3 py-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(G,{htmlFor:"ai-prompt",className:"text-sm",children:"Descreva o formulário que você precisa"}),e.jsx(je,{children:"A IA monta os campos a partir da sua descrição. Nada é publicado automaticamente: você revisa e ajusta antes."})]}),e.jsx(be,{id:"ai-prompt",autoFocus:!0,rows:4,placeholder:"Ex: formulário de captação para uma imobiliária, com nome, WhatsApp, tipo de imóvel e faixa de orçamento",value:b,onChange:a=>v(a.target.value),disabled:c.isPending,className:"resize-none"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Oe.map(a=>e.jsx("button",{type:"button",onClick:()=>v(a),disabled:c.isPending,className:"rounded-full border border-border/60 bg-card px-2.5 py-1 text-[11px] text-slate-500 dark:text-slate-400 hover:border-primary/40 hover:text-slate-700 dark:hover:text-slate-200 transition-colors",children:a},a))}),e.jsx(i,{onClick:Q,disabled:c.isPending||b.trim().length<8,className:"w-full h-12 md:h-11 bg-primary hover:bg-primary/90 text-primary-foreground font-bold rounded-lg",children:c.isPending?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"h-4 w-4 mr-2 animate-spin"})," Gerando o formulário..."]}):e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"h-4 w-4 mr-2"})," Gerar formulário"]})})]}),g==="zero"&&e.jsxs("div",{className:"space-y-3 py-1",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(G,{htmlFor:"form-name",children:"Nome do formulário"}),e.jsx(ce,{id:"form-name",autoFocus:!0,placeholder:"Ex: Captação de leads do site",value:L,onChange:a=>S(a.target.value),onKeyDown:a=>a.key==="Enter"&&D(),disabled:d.isPending})]}),e.jsx(i,{onClick:D,disabled:d.isPending,className:"w-full h-12 md:h-11 bg-primary hover:bg-primary/90 text-primary-foreground font-bold rounded-lg",children:d.isPending?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"h-4 w-4 mr-2 animate-spin"})," Criando..."]}):e.jsxs(e.Fragment,{children:["Criar e abrir editor ",e.jsx(q,{className:"h-4 w-4 ml-2"})]})})]})]}),e.jsx(O,{open:!!r,onOpenChange:a=>!a&&u(null),title:"Excluir formulário?",description:"Confirmação de exclusão do formulário",surfaceId:"forms-delete",mode:"confirm",footer:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(i,{type:"button",variant:"outline",className:"min-h-11 rounded-xl",onClick:()=>u(null),children:"Cancelar"}),r!=null&&r.submission_count?e.jsx(i,{type:"button",className:"min-h-11 rounded-xl",onClick:()=>u(null),children:"Entendi"}):e.jsx(i,{type:"button",className:"min-h-11 rounded-xl bg-rose-600 text-white hover:bg-rose-700",onClick:()=>{r&&x.mutate({id:r.id,action:"delete"}),u(null)},children:"Excluir"})]}),children:e.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:r!=null&&r.submission_count?"Este formulário já recebeu capturas e não pode ser excluído. Use a opção Arquivar para tir
1á-lo de circulação sem perder os dados.":`"${r==null?void 0:r.name}" será removido de forma definitiva. Essa ação não pode ser desfeita.`})})]})}export{pa 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.