1import{j as e,ab as c,T as r,a7 as m,F as R,af as F,ag as p,ah as x,ae as j}from"./mui-CRsYZxVY.js";import{r as l}from"./vendor-Dwao9eNC.js";import{e as L,r as N,x as W,C as A,O as B,D as g,X as z}from"./index-TALscxEc.js";import{S as G}from"./SettingsScreenLayout-BWFwVJu5.js";import{u as H}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 o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};o.SENTRY_RELEASE={id:"2ad85febf9735404429b0670d4acf56a0af5a0a2"}}catch{}})();try{(function(){var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new o.Error().stack;n&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[n]="99b281cd-5299-43e0-904d-5c1379060217",o._sentryDebugIdIdentifier="sentry-dbid-99b281cd-5299-43e0-904d-5c1379060217")})()}catch{}const oe=()=>{const{catalog:o,isLoading:n,save:w}=H(),{data:q}=L(),{triggerPaywall:S}=N(),a=W(q),[i,f]=l.useState(!1),[C,b]=l.useState(null),[k,h]=l.useState(!1),d=()=>S("stock_display",{pageAction:()=>h(!0),source:"catalog_screen"}),{control:u,handleSubmit:E,reset:_,watch:D,formState:{isDirty:P}}=A({defaultValues:{exibir_sem_estoque:"exibir",ocultar_preco_sem_estoque:!1,ocultar_variacoes_sem_estoque:!1}}),I=o==null?void 0:o.id;l.useEffect(()=>{o&&_({exibir_sem_estoque:o.exibir_sem_estoque||"exibir",ocultar_preco_sem_estoque:!!o.ocultar_preco_sem_estoque,ocultar_variacoes_sem_estoque:!!o.ocultar_variacoes_sem_estoque})},[I]);const y=D("exibir_sem_estoque")==="ocultar",T=!n&&!a?{plan:"pro",trigger:"stock_display"}:void 0,O=()=>new Promise((s,t)=>{E(async v=>{b(null),f(!0);try{await w(v,"settings_catalog"),_(v),s()}catch{b("Não foi possÃvel salvar. Tente novamente."),t(new Error("save failed"))}finally{f(!1)}})()});return e.jsxs(G,{title:"Catálogo",isLoading:n,isDirty:P,isSaving:i,onSave:O,saveError:C,lock:T,children:[e.jsxs(c,{spacing:2,children:[e.jsxs(c,{direction:"row",alignItems:"center",spacing:.75,children:[e.jsx(r,{variant:"body2",color:"text.secondary",children:"Como os produtos aparecem para quem visita sua loja."}),e.jsx(B,{variant:a?"cutout":"contained",fontSize:"0.7rem"})]}),e.jsxs(m,{sx:{bgcolor:"white",borderRadius:2,p:2},children:[e.jsx(r,{variant:"body1",sx:{fontWeight:600},children:"Produtos sem estoque"}),e.jsx(r,{variant:"caption",color:"text.secondary",sx:{display:"block",mt:.25,mb:1},children:"O que acontece quando um produto fica esgotado."}),e.jsx(g,{name:"exibir_sem_estoque",control:u,render:({field:s})=>e.jsx(R,{component:"fieldset",sx:{width:"100%"},children:e.jsxs(F,{value:a?s.value:"exibir",onChange:t=>{if(!a){d();return}s.onChange(t.target.value)},children:[e.jsx(p,{value:"exibir",control:e.jsx(x,{}),label:"Exibir como esgotado",disabled:i}),e.jsx(p,{value:"exibir_no_fim",control:e.jsx(x,{}),label:"Exibir como esgotado e mover para o final",disabled:i||!a,sx:{opacity:a?1:.5}}),e.jsx(p,{value:"ocultar",control:e.jsx(x,{}),label:"Não mostrar na loja",disabled:i||!a,sx:{opacity:a?1:.5}})]})})}),e.jsxs(c,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",spacing:1.5,sx:{mt:1,opacity:a&&!y?1:.5},children:[e.jsxs(m,{sx:{flex:1},children:[e.jsx(r,{variant:"body2",sx:{fontWeight:600},children:"Ocultar preço de produtos esgotados"}),e.jsx(r,{variant:"caption",color:"text.secondary",children:"O preço não aparece em produtos sem estoque."})]}),e.jsx(g,{name:"ocultar_preco_sem_estoque",control:u,render:({field:s})=>e.jsx(j,{checked:a?s.value:!1,onChange:t=>{if(!a){d();return}s.onChange(t.target.checked)},disabled:i||!a||y})})]}),e.jsxs(c,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",spacing:1.5,sx:{mt:1.5,opacity:a?1:.5},children:[e.jsxs(m,{sx:{flex:1},children:[e.jsx(r,{variant:"body2",sx:{fontWeight:600},children:"Ocultar variações esgotadas"}),e.jsx(r,{variant:"caption",color:"text.secondary",children:"Na página do produto, some com a opção que não tem estoque em nenhuma combinação (ex.: o sabor morango, quando nenhum morango tem estoque). Opções com estoque em pelo menos uma combinação continuam ap
1arecendo."})]}),e.jsx(g,{name:"ocultar_variacoes_sem_estoque",control:u,render:({field:s})=>e.jsx(j,{checked:a?s.value:!1,onChange:t=>{if(!a){d();return}s.onChange(t.target.checked)},disabled:i||!a})})]})]})]}),e.jsx(z,{open:k,onClose:()=>h(!1),planSuggestion:"pro",description:"Controlar como produtos sem estoque aparecem na loja é um recurso do plano PRO."})]})};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.