PageSourceSearch

https://app.stoqui.com.br/assets/ChatScreen-BLrExdGO.js

js stoqui.com.br collected 2026-10-01 15:18:13 UTC 7,563 bytes, 1 lines download raw bytes

1import{j as e,F as R,a7 as i,C as w,o as p,ab as h,T as l,ad as A,I as W,ae as z,X as q,ai as B,Z as N,O,N as $}from"./mui-CRsYZxVY.js";import{r as f}from"./vendor-Dwao9eNC.js";import{aG as F,bJ as M,eB as V,C as H,D as y,en as L}from"./index-TALscxEc.js";import{d as P}from"./RadioButtonUnchecked-BJKJ-TId.js";import{d as G}from"./WhatsApp-BptyU9R8.js";import{S as J}from"./SettingsScreenLayout-BWFwVJu5.js";import{u as X}from"./useWebCatalogSettingsSave-Byg91ItV.js";import"./query-8ViTdhdk.js";import"./datePickers-BIJXYOKG.js";import"./icons-D8aatgQ4.js";import"./lab-DSem1Osk.js";import"./UnsavedChangesDialog-gqy_t4YT.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};a.SENTRY_RELEASE={id:"2ad85febf9735404429b0670d4acf56a0af5a0a2"}}catch{}})();try{(function(){var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new a.Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="7012d6fd-383e-42b6-9f06-4491b16b90b1",a._sentryDebugIdIdentifier="sentry-dbid-7012d6fd-383e-42b6-9f06-4491b16b90b1")})()}catch{}const Y=[{value:"fab",label:"Botão discreto",description:"Botão flutuante no canto da tela."},{value:"sempre_visivel",label:"Sempre visível",description:"Chat aberto na lateral (desktop) ou barra inferior (celular)."},{value:"whatsapp_fab",label:"WhatsApp",description:"Troca chat IA por um botão do WhatsApp."},{value:"desativado",label:"Sem chat",description:"Nenhum chat disponível."}],C=({type:a,chatMode:t,primaryColor:n})=>{const o=w(),s=a==="desktop",r=s?80/55:40/60,u=()=>{if(t==="desativado")return null;if(t==="sempre_visivel")return s?e.jsx(i,{sx:{position:"absolute",right:"10%",top:"22%",bottom:"11%",width:"25%",backgroundColor:n,borderRadius:"4px"}}):e.jsx(i,{sx:{position:"absolute",bottom:0,left:0,right:0,height:"15%",backgroundColor:n,opacity:.9,borderRadius:0}});if(t==="fab"||t==="whatsapp_fab"){const d=t==="whatsapp_fab";return e.jsx(i,{sx:{position:"absolute",bottom:s?"7%":"5%",right:s?"5%":"7.5%",width:s?"22%":"35%",aspectRatio:"1",borderRadius:"50%",backgroundColor:d?"#25D366":n,display:"flex",alignItems:"center",justifyContent:"center"},children:d?e.jsx(G,{sx:{width:"65%",height:"65%",color:"white"}}):e.jsx(V,{size:"65%",style:{color:"white"}})})}return null};return e.jsxs(i,{sx:{width:"100%",aspectRatio:`${r}`,border:"2px solid",borderColor:o.palette.divider,borderRadius:"8px",backgroundColor:"background.paper",position:"relative",overflow:"hidden",opacity:t==="desativado"?.5:1,transition:"opacity 0.3s ease-in-out"},children:[e.jsx(i,{sx:{position:"absolute",top:0,left:0,right:0,height:"12%",backgroundColor:p(o.palette.primary.main,.1),borderBottom:"1px solid",borderColor:o.palette.divider}}),e.jsx(i,{sx:{position:"absolute",top:"20%",left:"8%",right:"8%",display:"flex",flexDirection:"column",gap:.5},children:[1,2,3].map(d=>e.jsx(i,{sx:{height:s?4:3,backgroundColor:p(o.palette.text.primary,.1),borderRadius:.5,width:`${20+d*15}%`}},d))}),u()]})},Z=({option:a,isSelected:t,onSelect:n,disabled:o})=>{const r=w().palette.primary.main;return e.jsx(F.div,{whileTap:{scale:o?1:.98},onClick:o?void 0:n,style:{},"data-disabled":o,children:e.jsx(i,{sx:{p:1.5,border:"2px solid",borderColor:t?r:"divider",borderRadius:2,backgroundColor:t?p(r,.05):"background.paper",transition:"all 0.2s ease-in-out",height:"100%","&:hover":{borderColor:o?"divider":t?r:p(r,.5),backgroundColor:o?"background.paper":t?p(r,.08):p(r,.02)}},children:e.jsxs(h,{spacing:1,children:[e.jsxs(h,{direction:"row",spacing:.5,alignItems:"center",children:[t?e.jsx(M,{sx:{color:r,fontSize:18}}):e.jsx(P,{sx:{color:"text.secondary",fontSize:18}}),e.jsx(l,{variant:"body2",sx:{fontWeight:600,color:t?r:"text.primary",fontSize:"0.875rem"},children:a.label})]}),e.jsx(l,{variant:"caption",sx:{color:"text.secondary",display:"block",pl:3,lineHeight:1.3,fontSize:"0.75rem",minHeight:"2em"},children:a.description}),e.jsxs(h,{direction:"row",spacing:1,sx:{pl:3,pt:.5},children:[e.jsxs(i,{sx:{flex:2,minWidth:0,maxWidth:80},children:[e.jsx(l,{variant:"caption",sx:{fontSize:"0.65rem",color:"text.secondary",display:"block",mb:.25},children:"Desktop"}),e.jsx(C,{type:"desktop",chatMode:a.value,primaryColor:r})]}),e.jsxs(i,{sx:{flex:1,minWidth:0,maxWidth:40},children:[e.jsx(l,{variant:"caption",sx:{fontSize:"0.65rem",color:"text.secondary",display:"block",mb:.25},children:"Mobile"}),e.jsx(C,{type:"mobile",chatMode:a.value,primaryColor:r})]})]})]})})})},K=({value:a,onChange:t,disabled:n=!1})=>{const o=a||"fab";return e.jsx(R,{component:"fieldset",disabled:n,children:e.jsx(i,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(2, 1fr)",md:"repeat(4, 1fr)"},gap:1.5,maxWidth:960},children:Y.map(s=>e.jsx(Z,{option:s,isSelected:o===s.value,onSelect:()=>t(s.value),disabled:n},s.value))})})},Q="/assets/chat-auth-example-D3dauN2j.png",pe=()=>{const{catalog:a,isLoading:t,save:n}=X(),[o,s]=f.useState(!1),[r,u]=f.useState(null),[d,m]=f.useState(!1),{control:v,handleSubmit:_,reset:j,watch:k,formState:{isDirty:S}}=H({defaultValues:{modo_chat:"fab",chat_requer_autenticacao:!0}}),I=a==null?void 0:a.id;f.useEffect(()=>{a&&j({modo_chat:a.modo_chat||"fab",chat_requer_autenticacao:!!a.chat_requer_autenticacao})},[I]);const x=k("modo_chat"),D=()=>new Promise((c,b)=>{_(async g=>{u(null),s(!0);try{await n({modo_chat:g.modo_chat,chat_requer_autenticacao:g.chat_requer_autenticacao},"settings_chat"),j(g),c()}catch{u("Não foi possível salvar. Tente novamente."),b(new Error("save failed"))}finally{s(!1)}})()}),E=x!=="desativado"&&x!=="whatsapp_fab",T=x==="whatsapp_fab"&&!(a!=null&&a.whatsapp_contato);return e.jsxs(J,{title:"Chat",isLoading:t,isDirty:S,isSaving:o,onSave:D,saveError:r,children:[e.jsxs(h,{spacing:2,children:[e.jsx(l,{variant:"body2",color:"text.secondary",children:"Escolha como o chat de vendas aparece para quem visita sua loja."}),e.jsx(y,{name:"modo_chat",control:v,render:({field:c})=>e.jsx(K,{value:c.value,onChange:c.onChange,disabled:o})}),T&&e.jsx(A,{severity:"warning",children:'Configure um número de WhatsApp em "Contato e redes sociais" para que o botão funcione.'}),E&&e.jsx(i,{sx:{bgcolor:"white",borderRadius:2,p:2},children:e.jsxs(h,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",spacing:1.5,children:[e.jsxs(i,{sx:{flex:1},children:[e.jsxs(h,{direction:"row",alignItems:"center",spacing:.5,children:[e.jsx(l,{variant:"body1",sx:{fontWeight:600},children:"Pedir identificação no chat"}),e.jsx(W,{size:"small",onClick:()=>m(!0),"aria-label":"Sobre a identificação no chat",children:e.jsx(L,{fontSize:"small"})})]}
1),e.jsx(l,{variant:"caption",color:"text.secondary",sx:{display:"block",mt:.25},children:"O chat pede nome e telefone antes de iniciar a conversa."})]}),e.jsx(y,{name:"chat_requer_autenticacao",control:v,render:({field:c})=>e.jsx(z,{checked:c.value,onChange:b=>c.onChange(b.target.checked),disabled:o})})]})})]}),e.jsxs(q,{open:d,onClose:()=>m(!1),children:[e.jsx(B,{children:"Identificação no chat"}),e.jsxs(N,{children:[e.jsx(l,{variant:"body2",children:"Ao ativar essa opção, o Chat Vendas solicita nome e telefone da pessoa com quem está conversando. Com essas informações você pode entrar em contato com esse novo cliente e personalizar seu atendimento."}),e.jsx("img",{src:Q,alt:"Exemplo de solicitação de identificação no Chat Vendas",style:{width:"100%",marginTop:16,borderRadius:8}})]}),e.jsx(O,{children:e.jsx($,{onClick:()=>m(!1),children:"Fechar"})})]})]})};export{pe 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.