PageSourceSearch

https://app.stoqui.com.br/assets/RetiradaConfigPage-B3GCtBUL.js

js stoqui.com.br collected 2026-09-24 11:58:30 UTC 4,045 bytes, 1 lines download raw bytes

1import{j as a,a9 as E,F as x,af as A}from"./mui-CRsYZxVY.js";import{r as d}from"./vendor-Dwao9eNC.js";import{d as D}from"./StorefrontOutlined-CJa6SJdE.js";import{u as M,w as m,d as P,e as I,r as L,cE as R,b3 as F,X as q}from"./index-TALscxEc.js";import{a as T,b as Q}from"./query-8ViTdhdk.js";import{S as k}from"./ShippingMethodLayout-ymqQcyVo.js";import{C as g}from"./ChoiceOption-BeWSmMeY.js";import"./datePickers-BIJXYOKG.js";import"./icons-D8aatgQ4.js";import"./lab-DSem1Osk.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"2ad85febf9735404429b0670d4acf56a0af5a0a2"}}catch{}})();try{(function(){var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="78e2e9b9-d0f4-4bb8-9117-e348eb508305",e._sentryDebugIdIdentifier="sentry-dbid-78e2e9b9-d0f4-4bb8-9117-e348eb508305")})()}catch{}const N=()=>{const e=T(),{user:o}=M(),c=o==null?void 0:o.id;return Q({mutationFn:async i=>{if(!c)throw new Error("Usuário não autenticado");const{data:t,error:r}=await m.from("catalogo_web").select("id").eq("user_id",c).single();if(r||!t)throw new Error((r==null?void 0:r.message)||"Catálogo web não encontrado.");const{data:s,error:l}=await m.from("catalogo_web").update({retirada_modo:i.modo}).eq("id",t.id).select("id, retirada_modo").single();if(l)throw l;return s},onMutate:async i=>{await e.cancelQueries({queryKey:["webCatalog"]});const t=e.getQueryData(["webCatalog"]);return t&&e.setQueryData(["webCatalog"],{...t,retirada_modo:i.modo}),{previousCatalog:t}},onError:(i,t,r)=>{r!=null&&r.previousCatalog&&e.setQueryData(["webCatalog"],r.previousCatalog),console.error("Erro ao atualizar modo de retirada:",i)},onSettled:()=>{e.invalidateQueries({queryKey:["webCatalog"]})}})},H=()=>{const{data:e,isLoading:o}=P(),{data:c,isLoading:i}=I(),t=N(),{triggerPaywall:r}=L(),[s,l]=d.useState(null),[y,p]=d.useState(null),[w,f]=d.useState(null),[h,b]=d.useState(!1);d.useEffect(()=>{if(e){const n=e.retirada_modo||"entrega";l(n),p(n)}},[e]);const v=R(c,"lite"),j=e&&e.retirada_modo&&e.retirada_modo!=="entrega",u=v||j;d.useEffect(()=>{!o&&!i&&!u&&r("store_pickup",{pageAction:()=>b(!0),source:"retirada_config_page"})},[o,i,u]);const C=async()=>{if(s){f(null);try{await t.mutateAsync({modo:s}),p(s)}catch(n){console.error("Failed to update mode:",n),f("Não foi possível salvar. Verifique sua conexão e tente de novo.")}}},S=o||i,_=s!==y;return a.jsx(k,{title:"Retirada na loja",description:"Escolha se o cliente recebe em casa, retira na loja, ou os dois",icon:a.jsx(D,{sx:{fontSize:24}}),error:w,isLoading:S,onSave:u?C:void 0,isSaving:t.isPending,isDirty:_&&!!s,children:u?a.jsx(E,{sx:{p:2},children:a.jsx(x,{component:"fieldset",disabled:t.isPending,children:a.jsxs(A,{value:s??"",onChange:n=>l(n.target.value),children:[a.jsx(g,{value:"entrega",label:"Apenas entrega",description:"Você envia o pedido para o endereço do cliente. A loja sempre pede o endereço."}),a.jsx(g,{value:"retirada",label:"Apenas retirada (retirar na loja)",description:"O cliente busca o pedido na sua loja. A loja não pede endereço nem cobra frete."}),a.jsx(g,{value:"entrega_e_retirada",label:"Entrega e retirada",description:"O cliente escolhe no checkout se prefere receber em casa ou buscar na loja."}),a.jsx(g,{value:"digital",label:"Entrega digital (produtos digitais)",description:"Nada é enviado fisicamente. A loja não pede endereço nem oferece retirada."})]})})}):a.jsxs(a.Fragment,{children:[a.jsx(F,{severity:"warning",title:"Recurso dos planos pagos",children:"Escolher entre entrega e retirada está disponível a partir do plano LITE. Sua loja continua vendendo com entrega normalmente."}),a.jsx(q,{open:h,onClose:()=>b(!1),title:"Recurso para assinantes",description:"A configuração avançada de retirada na loja está disponível para assinantes.",planSuggestion:"lite"})]})})};export{H 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.