PageSourceSearch

https://app.stoqui.com.br/assets/IdentityScreen-55IQTSHG.js

js stoqui.com.br collected 2026-09-24 11:57:49 UTC 11,859 bytes, 3 lines download raw bytes

1import{aP as K,j as e,ab as g,ad as _e,z as j,q as Se,I as J,T as r,a7 as i,o as v,n as X,ae as Y,X as L,ai as T,Z as H,O,N as m}from"./mui-CRsYZxVY.js";import{r as n}from"./vendor-Dwao9eNC.js";import{dt as ee,z as Ce,b as ke,u as we,N as De,fp as Ee,C as Ie,dr as Z,D as x,fq as Le,fr as Te,aC as He,fs as Oe,ft as Re,F as We,fu as qe}from"./index-TALscxEc.js";import{d as Ae}from"./Edit-BiqqVQWD.js";import{W as Ve}from"./WebCatalogSchema-ijwI1Cl0.js";import{H as ze}from"./HelperText-CbfuMRy9.js";import{u as Pe}from"./useQuizAnswers-CkTYG8hl.js";import{S as Ne}from"./SettingsScreenLayout-BWFwVJu5.js";import{u as Ue}from"./useWebCatalogSettingsSave-Byg91ItV.js";import"./query-8ViTdhdk.js";import"./datePickers-BIJXYOKG.js";import"./icons-D8aatgQ4.js";import"./lab-DSem1Osk.js";import"./HelpOutline-7HiWCqx6.js";import"./UnsavedChangesDialog-gqy_t4YT.js";(function(){try{var l=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};l.SENTRY_RELEASE={id:"2ad85febf9735404429b0670d4acf56a0af5a0a2"}}catch{}})();try{(function(){var l=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new l.Error().stack;d&&(l._sentryDebugIds=l._sentryDebugIds||{},l._sentryDebugIds[d]="39816614-237c-4d7f-9486-856958ca4481",l._sentryDebugIdIdentifier="sentry-dbid-39816614-237c-4d7f-9486-856958ca4481")})()}catch{}var R={},$e=K;Object.defineProperty(R,"__esModule",{value:!0});var ae=R.default=void 0,Be=$e(ee()),Fe=e;ae=R.default=(0,Be.default)((0,Fe.jsx)("path",{d:"M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7m2.85 11.1-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1"}),"LightbulbOutlined");var W={},Me=K;Object.defineProperty(W,"__esModule",{value:!0});var se=W.default=void 0,Ge=Me(ee()),Qe=e;se=W.default=(0,Ge.default)((0,Qe.jsx)("path",{d:"M4.5 11h-2V9H1v6h1.5v-2.5h2V15H6V9H4.5zm2.5-.5h1.5V15H10v-4.5h1.5V9H7zm5.5 0H14V15h1.5v-4.5H17V9h-4.5zm9-1.5H18v6h1.5v-2h2c.8 0 1.5-.7 1.5-1.5v-1c0-.8-.7-1.5-1.5-1.5m0 2.5h-2v-1h2z"}),"HttpOutlined");const Je=Ve.pick(["nome_loja","slug_loja","descricao","habilitado","verificacao_idade"]).shape({segmento:Ce().nullable().default("")}),ua=()=>{var M,G;const l=ke(),{user:d}=we(),{catalog:t,isLoading:oe,save:te}=Ue(),{storeUrl:S,isLoading:re}=De(),{data:u,isLoading:ie}=Pe(),ne=Ee(),le=oe||ie,[h,q]=n.useState(!1),[de,C]=n.useState(null),[ce,k]=n.useState(!1),[A,ue]=n.useState(!1),[he,w]=n.useState(!1),[fe,b]=n.useState(!1),[pe,y]=n.useState(!1),f=n.useRef(null);n.useEffect(()=>{const a=f;return()=>{var s;(s=a.current)==null||s.reject(),a.current=null}},[]);const{control:p,handleSubmit:me,reset:V,watch:D,setValue:z,setError:P,setFocus:N,formState:{errors:c,isDirty:xe}}=Ie({resolver:We(Je),defaultValues:{nome_loja:"",slug_loja:"",descricao:"",habilitado:!0,verificacao_idade:!1,segmento:""}}),E=n.useRef(""),ge=t==null?void 0:t.id;n.useEffect(()=>{if(!t)return;const a=(u==null?void 0:u.segmento)||(u==null?void 0:u.segment)||"";E.current=a,V({nome_loja:t.nome_loja||"",slug_loja:t.slug_loja||"",descricao:t.descricao||"",habilitado:!!t.habilitado,verificacao_idade:!!t.verificacao_idade,segmento:a})},[ge]);const I=D("slug_loja"),je=D("habilitado"),U=D("verificacao_idade"),ve=Z(I||""),$=!re&&!S.includes("stoqui.shop")&&!S.includes("dev.stoqui.shop"),B=async a=>{q(!0);try{await te({nome_loja:a.nome_loja,slug_loja:a.slug_loja,descricao:a.descricao??"",habilitado:a.habilitado,verificacao_idade:a.verificacao_idade},"settings_identity");const s=(a.segmento??"").trim();d!=null&&d.id&&s!==E.current&&s.length>0&&(await ne.mutateAsync({user_id:d.id,answers:{...u??{},segmento:s}}),E.current=s),V(a)}catch(s){const o=s instanceof Error?s.message:"";throw o.includes("DUPLICATE_SLUG_LOJA")||o.toLowerCase().includes("duplicate")||o.toLowerCase().includes("already in use")?(P("slug_loja",{type:"manual",message:"O link já está em uso. Escolha outro."}),C("O link já está em uso por outra loja. Escolha outro."),N("slug_loja")):C("Não foi possível salvar. Tente novamente."),s}finally{q(!1)}},be=()=>new Promise((a,s)=>{me(async o=>{C(null);const _=qe(o.slug_loja);if(!_.isValid){P("slug_loja",{type:"manual",message:_.message||"Link inválido"}),N("slug_loja"),s(new Error("invalid slug"));return}if(!$&&(t!=null&&t.slug_loja)&&o.slug_loja&&t.slug_loja!==o.slug_loja){f.current={resolve:a,reject:s,data:o},w(!0);return}try{await B(o),a()}catch{s(new Error("save failed"))}},()=>s(new Error("validation failed")))()}),ye=async()=>{const a=f.current;if(w(!1),!!a)try{await B(a.data),a.resolve()}catch{a.reject()}finally{f.current=null}},F=()=>{var a;w(!1),(a=f.current)==null||a.reject(),f.current=null};return e.jsxs(Ne,{title:"Identidade da loja",isLoading:le,isDirty:xe,isSaving:h,onSave:be,saveError:de,children:[e.jsxs(g,{spacing:2.5,children:[!je&&e.jsx(_e,{severity:"warning",children:"Sua loja não está acessível ao público. Ative-a abaixo para que os clientes possam acessá-la."}),e.jsx(x,{name:"nome_loja",control:p,render:({field:a})=>{var s;return e.jsx(j,{...a,label:"Nome da loja *",error:!!c.nome_loja,helperText:(s=c.nome_loja)==null?void 0:s.message,disabled:h})}}),$?e.jsx(j,{label:"Link da loja",value:S,disabled:!0,fullWidth:!0,InputProps:{endAdornment:e.jsx(Se,{position:"end",children:e.jsx(J,{onClick:()=>l("/profile/domain"),edge:"end",color:"primary","aria-label":"Gerenciar domínio",children:e.jsx(Ae,{})})})}}):e.jsxs(g,{spacing:1,children:[e.jsx(x,{name:"slug_loja",control:p,render:({field:a})=>{var s;return e.jsx(j,{...a,label:"Link da loja *",error:!!c.slug_loja,helperText:(s=c.slug_loja)==null?void 0:s.message,disabled:h,onChange:o=>{a.onChange(o.target.value);const _=Le(o.target.value),Q=Te(o.target.value);_?k(!0):Q||k(!1),ue(Q)},onBlur:()=>{a.onBlur();const o=Z(a.value||"");o!==a.value&&a.onChange(o)}})}}),e.jsxs(r,{fontSize:"small",fontWeight:500,sx:{pl:.5,overflow:"hidden",textOverflow:"ellipsis"},color:I&&I.length>50?"error.main":"text.secondary",children:["https://",e.jsx(r,{component:"span",fontSize:"inherit",fontWeight:600,color:"primary",children:ve}),".stoqui.shop"]}),ce&&e.jsxs(i,{sx:{p:2,borderRadius:2,display:"flex",alignItems:"flex-start",ga
1p:1.5,border:"1px solid",borderColor:a=>v(a.palette.primary.main,.3),bgcolor:a=>v(a.palette.primary.main,.05)},children:[A?e.jsx(se,{color:"primary",sx:{mt:.3}}):e.jsx(ae,{color:"primary",sx:{mt:.3}}),e.jsxs(i,{sx:{flex:1,minWidth:0},children:[e.jsx(r,{variant:"body2",fontWeight:500,color:"primary.main",gutterBottom:!0,children:A?"Não inclua 'http://' ou 'https://'":"Digite apenas a parte final do link"}),e.jsxs(r,{variant:"body2",color:"text.secondary",children:["Você está criando o identificador que aparece no início do link da sua loja:"," ",e.jsxs(i,{component:"span",sx:{fontWeight:600,fontStyle:"italic"},children:["https://",e.jsx(i,{component:"span",sx:{color:"primary.main"},children:"seu-identificador"}),".stoqui.shop"]})]})]}),e.jsx(J,{size:"small",onClick:()=>k(!1),"aria-label":"Fechar dica",sx:{mt:-.5,mr:-.5,color:"text.secondary"},children:e.jsx(He,{fontSize:"small"})})]})]}),e.jsx(x,{name:"segmento",control:p,render:({field:a})=>{var s;return e.jsxs(j,{...a,value:a.value??"",select:!0,label:"Segmento",disabled:h,error:!!c.segmento,helperText:(s=c.segmento)==null?void 0:s.message,children:[e.jsx(X,{value:"",children:e.jsx(r,{color:"text.disabled",children:"Não definido"})}),Oe.map(o=>e.jsx(X,{value:o,children:o},o))]})}}),e.jsx(x,{name:"descricao",control:p,render:({field:a})=>{var s;return e.jsx(j,{...a,multiline:!0,rows:4,InputLabelProps:{shrink:!0},label:e.jsxs(i,{sx:{display:"flex",alignItems:"center"},children:["Descrição",e.jsx(ze,{text:`A descrição ajuda nosso Chat Vendas a entender melhor sua loja e responder perguntas dos clientes com mais precisão.
2
3Além disso, ao compartilhar o link da sua loja em redes sociais, esta descrição aparece como uma prévia abaixo do nome da loja.`,dialogTitle:"Para que serve a descrição?"})]}),error:!!c.descricao,helperText:(s=c.descricao)==null?void 0:s.message,disabled:h})}}),e.jsx(i,{sx:{bgcolor:"white",borderRadius:2,p:2},children:e.jsxs(g,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",spacing:1.5,children:[e.jsxs(i,{sx:{flex:1},children:[e.jsx(r,{variant:"body1",sx:{fontWeight:600},children:"Loja ativa"}),e.jsx(r,{variant:"caption",color:"text.secondary",sx:{display:"block",mt:.25},children:"Quando desativada, sua loja não fica acessível ao público."})]}),e.jsx(x,{name:"habilitado",control:p,render:({field:a})=>e.jsx(Y,{checked:a.value,onChange:s=>{if(a.value&&!s.target.checked){y(!0);return}a.onChange(s.target.checked)},disabled:h})})]})}),e.jsx(i,{sx:{bgcolor:U?v("#d32f2f",.05):"white",borderRadius:2,p:2,border:"1px solid",borderColor:U?v("#d32f2f",.25):"transparent",transition:"background-color 160ms, border-color 160ms"},children:e.jsxs(g,{direction:"row",alignItems:"flex-start",spacing:1.5,children:[e.jsx(i,{sx:{width:38,height:38,borderRadius:"10px",bgcolor:v("#d32f2f",.12),color:"#d32f2f",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(Re,{size:20})}),e.jsxs(i,{sx:{flex:1,minWidth:0},children:[e.jsx(r,{variant:"body1",sx:{fontWeight:600},children:"Verificação de idade (18+)"}),e.jsx(r,{variant:"caption",color:"text.secondary",sx:{display:"block",mt:.25},children:"Exige que o visitante confirme ser maior de idade antes de ver a loja. Use apenas se você vende produtos para adultos."})]}),e.jsx(x,{name:"verificacao_idade",control:p,render:({field:a})=>e.jsx(Y,{checked:a.value,onChange:s=>{if(s.target.checked){b(!0);return}a.onChange(!1)},disabled:h})})]})})]}),e.jsxs(L,{open:he,onClose:F,maxWidth:"xs",fullWidth:!0,children:[e.jsx(T,{children:"Confirmar alteração do link?"}
3),e.jsxs(H,{children:[e.jsx(r,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"O link antigo da sua loja deixará de funcionar. Não esqueça de avisar seus clientes."}),e.jsxs(g,{spacing:1,children:[e.jsxs(i,{children:[e.jsx(r,{variant:"caption",color:"text.secondary",display:"block",children:"Link atual"}),e.jsxs(r,{variant:"body2",children:["https://",t==null?void 0:t.slug_loja,".stoqui.shop"]})]}),e.jsxs(i,{children:[e.jsx(r,{variant:"caption",color:"text.secondary",display:"block",children:"Novo link"}),e.jsxs(r,{variant:"body2",fontWeight:600,color:"primary",children:["https://",(G=(M=f.current)==null?void 0:M.data)==null?void 0:G.slug_loja,".stoqui.shop"]})]})]})]}),e.jsxs(O,{children:[e.jsx(m,{onClick:F,children:"Cancelar"}),e.jsx(m,{onClick:ye,variant:"contained",children:"Alterar link"})]})]}),e.jsxs(L,{open:pe,onClose:()=>y(!1),maxWidth:"xs",fullWidth:!0,PaperProps:{sx:{borderRadius:2,mx:2,width:"100%"}},children:[e.jsx(T,{children:"Desativar loja?"}),e.jsx(H,{children:e.jsx(r,{variant:"body2",color:"text.secondary",children:"Sua loja ficará inacessível ao público. Você pode reativar a qualquer momento."})}),e.jsxs(O,{children:[e.jsx(m,{onClick:()=>y(!1),children:"Cancelar"}),e.jsx(m,{onClick:()=>{z("habilitado",!1,{shouldDirty:!0}),y(!1)},variant:"contained",color:"error",children:"Desativar"})]})]}),e.jsxs(L,{open:fe,onClose:()=>b(!1),maxWidth:"xs",fullWidth:!0,children:[e.jsx(T,{children:"Ativar verificação de idade?"}),e.jsx(H,{children:e.jsx(r,{variant:"body2",color:"text.secondary",children:"Todo visitante verá uma tela pedindo para confirmar que é maior de 18 anos antes de acessar sua loja. Ative apenas se você vende produtos destinados a adultos."})}),e.jsxs(O,{children:[e.jsx(m,{onClick:()=>b(!1),children:"Cancelar"}),e.jsx(m,{onClick:()=>{z("verificacao_idade",!0,{shouldDirty:!0}),b(!1)},variant:"contained",children:"Ativar"})]})]})]})};export{ua 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.