1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c8bace12-9c81-5021-9705-5bba87599719")}catch(e){}}(); 3import{Q as L,W as S,R as e,b5 as q,b6 as k,ao as A,b7 as y,aN as N,bC as xe,b9 as $,ba as D,bt as W,j as Ne,I as J,bj as G,ah as ee,x as P,bG as K,cT as Ce,bp as De,bO as Se,bP as we,bQ as Pe,bR as ze,cU as Te,bD as Fe,bT as Oe,bU as Ie,k as qe,bF as Q,bV as te,aS as ke,cO as V,aw as Ae,a6 as I,ax as $e,a0 as w,cs as X,b2 as Me,cV as ae,cB as re,cy as ne,aJ as oe,ca as se,aj as ie,bY as le,bk as z,l as R,bi as j,bs as ce,o as me,D as de,q as ue,s as pe,t as fe,Y as Ee,aG as ge,c2 as Re,a5 as Ue,aY as Le}from"./index-Cs-In7Vx.js";import{u as M}from"./useOrganization-QJCJqGxh.js";import{f as Ye}from"./formatAddress-DI14OUhR.js";import{s as We,b as je}from"./apiEndpoints-DMnpAh1j.js";import{v as Be}from"./validateCNPJ-D1dZ3Lbf.js";import{v as He}from"./validateCPF-BkwZ4IBk.js";import{C as Ze}from"./CouponField-9Q6k0qeC.js";import{A as ve}from"./AddCircleRounded-az9o5Afs.js";import{C as be}from"./CloudUploadRounded-DqYHvwyH.js";import{D as B}from"./DescriptionRounded-fU0kur7i.js";import{S as _e}from"./SendRounded-F14-gZ8F.js";import{e as Je,c as Ge,d as Qe,p as Ke}from"./apiEndpoints-DLS7WSIB.js";async function Y(a,t){return(await L.put(`/api/v2/admin/organizations/${a}`,t)).data}const Ve=$().shape({name:D().trim().required("Você deve informar o nome").min(10,"Informe o nome e sobrenome"),phone_number:D().matches(/^\(([14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])\) 9?[0-9]{4}-[0-9]{4}$/,"Informe um número válido").required("Você deve informar o telefone")});function Xe({open:a,defaultValues:t,onClose:n,mutate:c}){const o=S(),[i,l]=e.useState(!1),{handleSubmit:m,reset:d,formState:f,control:r}=q({mode:"onSubmit",defaultValues:t,resolver:k(Ve)});e.useEffect(()=>{a&&d({...t})},[t,a,d]);const p=e.useCallback(async u=>{l(!0);const h={users_attributes:[{id:u.user_id,name:u.name,phone_number:u.phone_number.replace(/\D/g,"")}]};try{const v=await Y(t.id,h);c(v,!1),n()}catch(v){o.error(v.response?.data?.message||"Não foi possÃvel atualizar as informações")}l(!1)},[o,t.id,n,c]),{errors:E}=f;return e.createElement(A,{open:a,title:"Atualizar informações do administrador",loading:i,onClose:n,onSubmit:m(p)},e.createElement("div",{className:"space-y-20"},e.createElement(y,{name:"name",control:r,render:({field:u})=>e.createElement(N,{...u,id:"name",label:"Nome completo",error:!!E.name,helperText:E?.name?.message,variant:"outlined",autoFocus:!0,fullWidth:!0,required:!0})}),e.createElement(y,{name:"phone_number",control:r,render:({field:u})=>e.createElement(N,{...u,id:"phone_number",label:"Telefone",error:!!E.phone_number,helperText:E?.phone_number?.message,InputProps:{inputComponent:xe},variant:"outlined",fullWidth:!0,required:!0})})))}function T({title:a,onEdit:t,children:n}){return e.createElement(W,{variant:"outlined",className:"rounded-8"},e.createElement("div",{className:"flex flex-shrink-0 items-center justify-between px-16 py-12"},e.createElement("span",{className:"text-16 font-bold text-gray-700"},a),t&&e.createElement(Ne,{title:"Editar informações",placement:"top",arrow:!0},e.createElement(J,{size:"small",onClick:t},e.createElement(G,null)))),e.createElement(ee,null),e.createElement("div",{className:"space-y-20 p-16"},n))}function x({data:a}){if(!a||!a?.length)return null;if(a.length===1){const{label:t,value:n}=a[0];return e.createElement("div",null,e.createElement("span",{className:"text-gray-400"},t),e.createElement("div",{className:"whitespace-pre-wrap text-15 font-semibold text-gray-500"},n||"Não informado"))}if(a.length===2){const[{label:t,value:n},{label:c,value:o}]=a;return e.createElement("div",{className:"flex justify-between space-x-16"},e.createElement("div",{className:"flex-1 truncate"},e.createElement("span",{className:"text-gray-400"},t),e.createElement("div",{className:"truncate text-15 font-semibold text-gray-500"},n||"Não informado")),e.createElement("div",{className:"w-128"},e.createElement("span",{className:"text-gray-400"},c),e.createElement("div",{className:"text-15 font-semibold text-gray-500"},o||"Não informado")))}return null}function et(){const a=P(({auth:l})=>l.user.user.organization),{data:t,mutate:n}=M(a?.id),[c,o]=e.useState(!1),i=e.useMemo(()=>
3{if(!t||!t.primary_users?.[0])return null;const{id:l,name:m,email:d,phone_number:f}=t.primary_users[0];return{id:t.id,user_id:l,name:m,email:d,phone_number:K(f)}},[t]);return e.createElement(e.Fragment,null,e.createElement(T,{title:"Informações do Administrador",onEdit:()=>o(!0)},e.createElement("div",{className:"space-y-12"},e.createElement(x,{data:[{label:"Nome",value:i?.name}]}),e.createElement(x,{data:[{label:"E-mail",value:i?.email}]}),e.createElement(x,{data:[{label:"Telefone",value:K(i?.phone_number)}]}))),i&&e.createElement(Xe,{open:c,defaultValues:i,onClose:()=>o(!1),mutate:n}))}const tt=$().shape({document_number:D().test("is-cpf-or-cnpj","Informe um CPF ou CNPJ válido",a=>He(a)||Be(a)),document_name:D().trim().required("Você deve informar uma Razão Social ou Nome Completo"),zip_code:D().matches(/^\d{5}-?\d{3}$/,"Informe um CEP válido").required("Você deve informar o CEP"),street:D().trim().required("Você deve informar o Endereço"),neighborhood:D().trim().required("Você deve informar o Bairro"),city:D().trim().required("Você deve informar o Cidade"),state:D().trim().oneOf(ze,"Informe um estado válido").uppercase().required("Você deve informar o Estado")});function at({open:a,defaultValues:t,onClose:n,mutate:c}){const o=S(),[i,l]=e.useState(!1),{handleSubmit:m,reset:d,watch:f,setValue:r,getValues:p,formState:E,control:u}=q({mode:"onSubmit",defaultValues:t,resolver:k(tt)}),h=f("document_number"),v=f("zip_code");e.useEffect(()=>{a&&d(t)},[t,a,d]),e.useEffect(()=>{async function s(_){l(!0);try{const b=await We(_);b.name&&!p("document_name")&&r("document_name",b.name),b.address&&(r("street",b.address.street||""),r("house_number",b.address.number||""),r("neighborhood",b.address.district||""),r("address_complement",b.address.details||""),r("city",b.address.city||""),r("state",b.address.state||""),r("zip_code",b.address.zip||""))}catch{}l(!1)}a&&h?.replace(/\D/g,"")?.length===14&&(!p("document_name")||!p("city"))&&s(h?.replace(/\D/g,""))},[p,a,r,h]),e.useEffect(()=>{async function s(_){l(!0);try{const b=await je(_);r("street",b.logradouro||""),r("neighborhood",b.bairro||""),r("city",b.localidade||""),r("state",b.uf||"")}catch{}l(!1)}if(a&&v?.replace(/\D/g,"")?.length===8){const[_,b]=p(["city","state"]);!_&&!b&&s(v?.replace(/\D/g,""))}},[p,a,r,v]);const C=e.useCallback(async s=>{l(!0);const _={},b=s.document_number.replace(/\D/g,""),{document_number:F,document_name:he}=t;F!==b&&(_.document_number=b),he!==s.document_name&&(_.document_name=s.document_name);const H={street:s.street,house_number:s.house_number,neighborhood:s.neighborhood,address_complement:s.address_complement,city:s.city,state:s.state,zip_code:s.zip_code.replace(/\D/g,"")},ye=Ce(t,Object.keys(H));De(H,ye)||(_.address_attributes=H);try{if(Object.keys(_).length>0){const Z=await Y(t.id,_);c(Z,!1)}n()}catch(Z){o.error(Z.response?.data?.message||"Não foi possÃvel atualizar as informações")}l(!1)},[t,n,c,o]),{errors:g}=E;return e.createElement(A,{open:a,title:"Atualizar informações de faturamento",loading:i,onClose:n,onSubmit:m(C)},e.createElement("div",{className:"space-y-20"},e.createElement(y,{name:"document_number",control:u,render:({field:s})=>e.createElement(N,{...s,id:"document_number",label:"CNPJ ou CPF",error:!!g.document_number,helperText:g?.document_number?.message,InputProps:{inputComponent:Se},variant:"outlined",autoFocus:!0,fullWidth:!0,required:!0})}),e.createElement(y,{name:"document_name",control:u,render:({field:s})=>e.createElement(N,{...s,id:"document_name",label:"Razão Social ou Nome Completo",error:!!g.document_name,helperText:g?.document_name?.message,variant:"outlined",fullWidth:!0,required:!0})}),e.createElement(y,{name:"zip_code",control:u,render:({field:s})=>e.createElement(N,{...s,id:"zip_code",label:"CEP da Empresa",error:!!g.zip_code,helperText:g?.zip_code?.message,InputProps:{inputComponent:we},variant:"outlined",fullWidth:!0,required:!0})}),e.createElement("div",{className:"flex space-x-12"},e.createElement(y,{name:"street",control:u,render:({field:s})=>e.createElement(N,{...s,id:"street",label:"Endereço",error:!!g.street,helperText:g?.street?.message,variant:"outlined",fullWidth:!0,required:!0})}),e.createElement(y,{name:"house_number",control:u,render:({field:s})=>e.createElement(N,{...s,id:"house_number",label:"Número",error:!!g.house_number,helperText:g?.house_number?.message,variant:"outlined",className:"w-128"})})),e.createElement("div",{className:"flex space-x-12"},e.createElement(y,{name:"neighborhood",control:u,render:({field:s})=>e.createElement(N,{...s,id:"neighborhood",label:"Bairro",error:!!g.neighborhood,helperText:g?.neighborhood?.message,variant:"outlined",fullWidth:!0,required:!0})}),e.createElement(y,{name:"address_complement",control:u,render:({field:s})=>e.createElement(N,{...s,id:"address_complement",label:"Complemento",error:!!g.address_complement,helperText:g?.address_complement?.message,variant:"outlined",fullWidth:!0})})),e.createElement("div",{className:"flex space-x-12"},e.createElement(y,{name:"city",control:u,render:({field:s})=>e.createElement(N,{...s,id:"city",label:"Cidade",error:!!g.city,helperText:g?.city?.message,variant:"outlined",fullWidth:!0,required:!0})}),e.createElement(y,{name:"state",control:u,render:({field:s})=>e.createElement(Pe,{...s,error:!!g.state,helperText:g?.state?.message})}))))}function rt(){const a=P(({auth:m})=>m.user.user.organization),{data:t,mutate:n}=M(a?.id),[c,o]=e.useState(!1),i=e.useMemo(()=>
3{if(!t)return null;const{document_number:m,document_name:d}=t,{zip_code:f,street:r,house_number:p,neighborhood:E,address_complement:u,city:h,state:v}=t.address||{};return{id:t.id,document_number:m,document_name:d,zip_code:f||"",street:r||"",house_number:p||"",neighborhood:E||"",address_complement:u||"",city:h||"",state:v||""}},[t]),l=t&&(!t?.document_number||!t?.document_name||!t?.address?.zip_code);return e.createElement(e.Fragment,null,e.createElement(T,{title:"Informações de Faturamento",onEdit:()=>o(!0)},l&&e.createElement("div",{className:"cursor-pointer rounded-8 bg-orange-lightest p-8 text-center font-bold text-orange-dark",onClick:()=>o(!0)},"Dados incompletos, clique aqui"),e.createElement("div",{className:"space-y-12"},e.createElement(x,{data:[{label:"CNPJ/CPF",value:Te(t?.document_number)||"Não informado"}]}),e.createElement(x,{data:[{label:"Razão Social/Nome Completo",value:t?.document_name||"Não informado"}]}),e.createElement(x,{data:[{label:"Endereço de faturamento",value:Ye(t?.address)}]}))),i&&e.createElement(at,{open:c,defaultValues:i,onClose:()=>o(!1),mutate:n}))}const nt=[1,2,3,4,5,6,7,8,9,10],ot=$().shape({automatic_subscription_coupon_id:te().nullable().optional().integer().positive("Aplique ou remova o código")});function st({open:a,defaultValues:t,onClose:n,mutate:c}){const o=S(),[i,l]=e.useState(!1),{handleSubmit:m,reset:d,watch:f,setValue:r,formState:p,control:E}=q({mode:"onSubmit",defaultValues:t,resolver:k(ot)});e.useEffect(()=>{a&&d({...t})},[t,a,d]);const u=e.useCallback(async v=>{l(!0);const C={automatic_subscription_coupon_id:v.automatic_subscription_coupon_id,payment_delay_tolerance:v.payment_delay_tolerance};try{const g=await Y(t.id,C);c(g,!1),n()}catch(g){o.error(g.response?.data?.message||"Não foi possÃvel atualizar as informações")}l(!1)},[o,t.id,n,c]),{errors:h}=p;return e.createElement(A,{open:a,title:"Atualizar informações da operação",loading:i,onClose:n,onSubmit:m(u)},e.createElement("div",{className:"space-y-20"},e.createElement(y,{name:"automatic_subscription_coupon_id",control:E,render:({field:{ref:v}})=>e.createElement(Ze,{id:"automatic_subscription_coupon_id",ref:v,value:f("automatic_subscription_coupon_id"),setValue:C=>r("automatic_subscription_coupon_id",C),error:!!h.automatic_subscription_coupon_id,helperText:h?.automatic_subscription_coupon_id?.message})}),e.createElement(y,{name:"payment_delay_tolerance",control:E,render:({field:v})=>e.createElement(Fe,{variant:"outlined",color:"primary",fullWidth:!0},e.createElement(Oe,{id:"payment_delay_tolerance"},"Tolerância de atraso no pagamento"),e.createElement(Ie,{label:"Tolerância de atraso no pagamento",name:"payment_delay_tolerance",error:!!h.payment_delay_tolerance,...v},nt.map(C=>e.createElement(qe,{key:C,value:C},C," ",parseInt(C)>1?"dias":"dia"))),h?.payment_delay_tolerance?.message&&e.createElement(Q,null,h?.payment_delay_tolerance?.message))})))}function it(){const a=P(({auth:l})=>l.user.user.organization),{data:t,mutate:n}=M(a?.id),[c,o]=e.useState(!1),i=e.useMemo(()=>{if(!t)return null;const{id:l,automatic_subscription_coupon_id:m,payment_delay_tolerance:d}=t;return{id:l,automatic_subscription_coupon_id:m,payment_delay_tolerance:d}},[t]);return e.createElement(e.Fragment,null,e.createElement(T,{title:"Informações da Operação",onEdit:()=>o(!0)},e.createElement("div",{className:"space-y-12"},e.createElement(x,{data:[{label:"Cupom a ser aplicado automáticamente",value:t?.automatic_subscription_coupon_id?t?.automatic_subscription_coupon_name||"Cupom não encontrado":"Não informado"}]}),e.createElement(x,{data:[{label:"Conectado ao Asaas",value:t?.connected_to_asaas?"Sim":"Não"}]}),e.createElement(x,{data:[{label:"Tolerância de atraso no pagamento",value:t?.payment_delay_tolerance>1?`${t?.payment_delay_tolerance} dias`:`${t?.payment_delay_tolerance} dia`}]}))),i&&e.createElement(st,{open:c,defaultValues:i,onClose:()=>o(!1),mutate:n}))}function lt(){const a=P(({auth:n})=>n.user.user.organization),{data:t}=M(a?.id);return t?.api_token?e.createElement(T,{title:"API da Organização"},e.createElement("div",{className:"space-y-12"},e.createElement(x,{data:[{label:"Token de acesso da API",value:t?.api_token}]}))):null}const ct=$().shape({name:D().trim().required("Informe o nome da organização"),enterprise_domain:D().matches(/^([A-Za-z0-9][A-Za-z0-9-]{0,63}[A-Za-z0-9]\.)+[A-Za-z]{2,10}$/,"Informe um domÃnio válido").required("Informe o domÃnio da organização"),site_url:D().matches(/^[(www.)?a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?!&\/=]*)$/,"Informe um site válido").required("Informe o site da organização")});function mt({open:a,defaultValues:t,onClose:n,mutate:c}){const o=S(),[i,l]=e.useState(!1),{handleSubmit:m,reset:d,formState:f,control:r}=q({mode:"onSubmit",defaultValues:t,resolver:k(ct)});e.useEffect(()=>{a&&d({...t})},[t,a,d]);const p=e.useCallback(async u=>{l(!0);const h={name:u.name,enterprise_domain:u.enterprise_domain,site_url:u.site_url};try{const v=await Y(t.id,h);c(v,!1),n()}catch(v){o.error(v.response?.data?.message||"Não foi possÃvel atualizar as informações")}l(!1)},[o,t.id,n,c]),{errors:E}=f;return e.createElement(A,{open:a,title:"Atualizar informações da organização",loading:i,onClose:n,onSubmit:m(p)},e.createElement("div",{className:"space-y-20"},e.createElement(y,{name:"name",control:r,render:({field:u})=>e.createElement(N,{...u,id:"name",label:"Nome da organização",error:!!E.name,helperText:E?.name?.message,variant:"outlined",fullWidth:!0,required:!0})}),e.createElement(y,{name:"enterprise_domain",control:r,render:({field:u})=>e.createElement(N,{...u,id:"enterprise_domain",label:"DomÃnio",error:!!E.enterprise_domain,helperText:E?.enterprise_domain?.message,variant:"outlined",fullWidth:!0,required:!0})}),e.createElement(y,{name:"site_url",control:r,render:({field:u})=>e.createElement(N,{...u,id:"site_url",label:"Site",type:"site_url",error:!!E.site_url,helperText:E?.site_url?.message,InputProps:{startAdornment:e.createElement(ke,{position:"start"},"https://")},variant:"outlined",fullWidth:!0,required:!0})})))}function dt(){const a=P(({auth:d})=>d.user.user.organization),{data:t,mutate:n}=M(a?.id),[c,o]=e.useState(!1),i=e.useMemo(()=>
3{if(!t)return null;const{id:d,name:f,enterprise_domain:r,site_url:p}=t;return{id:d,name:f,enterprise_domain:r,site_url:p}},[t]),l=e.useCallback(d=>n(d,!1),[n]),m=e.useCallback(()=>{},[]);return e.createElement(e.Fragment,null,e.createElement(T,{title:"Informações da Organização",onEdit:()=>o(!0)},e.createElement("div",{className:"space-y-12"},e.createElement("div",{className:"space-y-8 pb-12"},e.createElement("div",{className:"text-gray-400"},"Logo"),e.createElement(W,{key:"image",variant:"outlined",className:"h-128 w-full max-w-384 overflow-hidden rounded-12"},e.createElement(V,{imageURL:t?.image,endpoint:`/api/v2/admin/organizations/${a?.id}`,endpointFieldName:"image",onUploaded:l,onError:m,dropzoneClasses:"rounded-12 bg-white p-8",hideDropzoneText:!0,cropOptions:{aspect:4.67,maxWidth:300}})),t?.image?e.createElement("div",{className:"text-gray-400"},"Clique na imagem para alterá-la"):e.createElement("div",{className:"text-gray-400"},"Clique no espaço acima e adicione a logo"),e.createElement("div",{className:"text-gray-400"},"Resolução recomendada: 288x64")),e.createElement("div",{className:"space-y-8 pb-12"},e.createElement("div",{className:"text-gray-400"},"Favicon"),e.createElement(W,{key:"favicon",variant:"outlined",className:"h-128 w-full max-w-128 overflow-hidden rounded-12"},e.createElement(V,{imageURL:t?.favicon,endpoint:`/api/v2/admin/organizations/${a?.id}`,endpointFieldName:"favicon",onUploaded:l,onError:m,dropzoneClasses:"rounded-12 bg-white p-8",hideDropzoneText:!0,cropOptions:{aspect:1,maxWidth:48}})),t?.favicon?e.createElement("div",{className:"text-gray-400"},"Clique na imagem para alterá-la"):e.createElement("div",{className:"text-gray-400"},"Clique no espaço acima e adicione o seu favicon"),e.createElement("div",{className:"text-gray-400"},"Resolução recomendada: 32x32")),e.createElement(x,{data:[{label:"Nome",value:t?.name}]}),e.createElement(x,{data:[{label:"DomÃnio",value:t?.enterprise_domain}]}),e.createElement(x,{data:[{label:"Site",value:t?.site_url&&`https://${t?.site_url}`}]}))),i&&e.createElement(mt,{open:c,defaultValues:i,onClose:()=>o(!1),mutate:n}))}function O({title:a,children:t,price:n}){const[c,o]=e.useState(!1);return e.createElement("div",{className:"flex flex-col rounded-8 border border-solid border-gray-200 bg-gray-50 p-16"},e.createElement("div",{className:"flex cursor-pointer select-none items-center font-semibold text-gray-600",onClick:()=>o(i=>!i)},e.createElement(Ae,{className:I("transform transition-transform duration-500",c&&"rotate-180")}),e.createElement("span",{className:"ml-12 flex-1 text-16 font-bold"},a),e.createElement("span",{className:"text-16 font-normal"},n!==""?n+" por estabelecimento por mês":null)),e.createElement($e,{in:c},e.createElement("div",{className:"space-y-8 px-36 pt-16 text-15"},e.createElement("div",{className:"whitespace-pre-wrap text-16 text-gray-500"},t))))}const U={basic:{name:"Plano básico",modules:[w.DELIVERY_MODULE]},intermediary:{name:"Plano intermediário",modules:[w.DELIVERY_MODULE,w.AUTOMATIC_PRINTING_MODULE,w.CUSTOM_FIELDS_MODULE,w.ONLINE_PAYMENT,w.DEBT_BOOK]},advanced:{name:"Plano avançado",modules:[...Me(Object.values(w),[w.ZAPZAP,w.IFOOD,w.DELIVERY_MANAGEMENT_MODULE])]}};function ut(){return e.createElement(W,{variant:"outlined",className:"rounded-8"},e.createElement("div",{className:"flex items-center justify-between px-16 py-16"},e.createElement("span",{className:"text-16 font-bold text-gray-700"},"Planos e Repasses")),e.createElement(ee,null),e.createElement("div",{className:"space-y-16 p-16 font-semibold"},e.createElement(O,{price:"R$ 40,00",title:U.basic.name},e.createElement("div",{className:"flex flex-col space-y-8"},e.createElement("div",{className:"font-bold"},"Inclui os Módulos:"),U.basic.modules.map(a=>e.createElement("div",{key:a},"- ",X[a])))),e.createElement(O,{price:"R$ 60,00",title:U.intermediary.name},e.createElement("div",{className:"flex flex-col space-y-8"},e.createElement("div",{className:"font-bold"},"Inclui os Módulos:"),U.intermediary.modules.map(a=>e.createElement("div",{key:a},"- ",X[a])))),e.createElement(O,{price:"R$ 80,00",title:U.advanced.name},e.createElement("span",{className:"font-bold"},"Inclui todos os módulos, com exceção da Integração com iFood, Módulo Fiscal e Módulo de gestão de entregas.")),e.createElement(O,{price:"R$ 10,00",title:"Módulo de integração com iFood"}
3,e.createElement("div",null,"Este módulo é cobrado separadamente em todos os casos. Não está incluso em nenhum plano.")),e.createElement(O,{price:"R$ 49,90",title:"Módulo fiscal"},e.createElement("div",{className:"flex flex-col space-y-8"},e.createElement("div",null,"Este módulo é cobrado separadamente em todos os casos. Não está incluso em nenhum plano."),e.createElement("div",null,"Cada estabelecimento tem direito a emissão de ",e.createElement("strong",null,"2.500")," notas por mês. Será cobrado um valor de ",e.createElement("strong",null,"R$ 0,05")," por nota adicional."))),e.createElement(O,{price:"R$ 29,90",title:"Módulo de gestão de entregas"},e.createElement("div",{className:"flex flex-col space-y-8"},e.createElement("div",null,"Este módulo é cobrado separadamente em todos os casos. Não está incluso em nenhum plano."),e.createElement("div",null,"Cada estabelecimento tem direito a ",e.createElement("strong",null,"500")," pedidos de delivery por mês, incluindo pedidos cancelados. Pedidos adicionais até ",e.createElement("strong",null,"1.500")," serão tarifados em ",e.createElement("strong",null,"R$ 0,08")," por pedido. Para quantidades superiores a"," ",e.createElement("strong",null,"1.500")," pedidos adicionais, a taxa é reduzida para",e.createElement("strong",null,"R$ 0,06")," por pedido extra."))),e.createElement(O,{price:"R$ 49,90",title:"Módulo de gestão financeira"},e.createElement("div",null,"Este módulo é cobrado separadamente em todos os casos. Não está incluso em nenhum plano."))))}function pt({selectedFile:a,setSelectedFile:t,helperText:n}){const c=S(),[o,i]=e.useState(!1),l=d=>{if(d.target.files?.length>0){const f=d.target.files[0];if(f.size/1024/1024>1){c.error("Arquivo muito grande! O limite é 1 MiB");return}!f.type||["application/pdf"].includes(f.type)?t(f):c.error("Tipo de arquivo não suportado")}},m=!!a;return e.createElement(e.Fragment,null,e.createElement(ae,{onDrop:l,onDragDropChange:i,className:I("relative flex w-full items-center justify-center overflow-hidden rounded-8 px-16 py-24","border-2 border-dashed border-gray-300 bg-gray-50 transition-colors duration-300 hover:border-cardapio-web",o&&"border-cardapio-web")},e.createElement("input",{id:"upload-file",type:"file",accept:"application/pdf",className:"sr-only",onChange:l}),e.createElement("label",{htmlFor:"upload-file",className:I("flex w-full cursor-pointer flex-col items-center justify-center text-center text-gray-500 transition-opacity duration-300",o&&"opacity-20")},m?e.createElement(e.Fragment,null,e.createElement(B,{className:"text-72 text-gray-300"}),e.createElement("div",{className:"mt-8 text-16"},e.createElement("strong",null,"Arquivo selecionado"),e.createElement("div",null,a.name))):e.createElement(e.Fragment,null,e.createElement(be,{className:"text-72 text-gray-300"}),e.createElement("div",{className:"mt-8 text-16"},e.createElement("strong",null,"Selecione o arquivo"),e.createElement("div",null,"ou arraste e solte"))))),n&&e.createElement(Q,{className:"w-full text-center text-14 text-cardapio-web"},n))}async function ft(a,t){return(await L.post(`/api/v2/organization/${a}/privacy_policies`,t)).data}async function Et(a,t,n){return(await L.put(`/api/v2/organization/${a}/privacy_policies/${n}`,t)).data}async function gt(a,t){return(await L.delete(`/api/v2/organization/${a}/privacy_policies/${t}`)).data}async function vt(a,t){return(await L.put(`/api/v2/organization/${a}/privacy_policies/${t}/active`)).data}const bt=$().shape({description:D().trim().required("Informe a descrição"),effective_start_date:ne().required("Você deve informar uma data"),term_file:re().required("O arquivo da polÃtica de privacidade é obrigatório")});function _t(a){const n=a.term_file.url.split("/");return{name:n[n.length-1]}}function ht({open:a,defaultValues:t,onClose:n,mutate:c,organizationId:o}){const i=S(),[l,m]=e.useState(!1),{handleSubmit:d,reset:f,formState:r,control:p,setValue:E,watch:u}=q({mode:"onSubmit",defaultValues:t,resolver:k(bt)}),h=u("term_file");e.useEffect(()=>{a&&f({...t,term_file:t?.term_file?.url&&_t(t)})},[t,a,f]);const v=e.useCallback(async(s,_,b)=>b?await Et(s,_,b):await ft(s,_),[]),C=e.useCallback(async s=>{m(!0);const _=new FormData,b=s?.term_file?.type;s.term_file&&b&&_.append("term_file",s.term_file,s.term_file.name),s.effective_start_date&&_.append("effective_start_date",s.effective_start_date),s.description&&_.append("description",s.description);
3try{(await v(o,_,s.id))?.term_file?.url&&i.success("PolÃtica de privacidade salva com sucesso"),c(),n()}catch(F){i.error(F.response?.data?.message||"Não foi possÃvel atualizar as informações")}m(!1)},[i,n,c,v,o]),{errors:g}=r;return e.createElement(A,{open:a,title:t?.id?"Editar polÃtica de privacidade":"Criar polÃtica de privacidade",loading:l,onClose:n,onSubmit:d(C)},e.createElement("div",{className:"space-y-20"},e.createElement(pt,{error:!!g.term_file,helperText:g?.term_file?.message,selectedFile:h,setSelectedFile:s=>E("term_file",s)}),e.createElement(y,{name:"description",control:p,render:({field:s})=>e.createElement(N,{...s,id:"description",label:"Descrição",error:!!g.description,helperText:g?.description?.message,variant:"outlined",fullWidth:!0,required:!0,multiline:!0,rows:4})}),e.createElement(y,{name:"effective_start_date",control:p,render:({field:s})=>e.createElement(N,{...s,id:"effective_start_date",type:"date",label:"Data de vigência",error:!!g.effective_start_date,helperText:g?.effective_start_date?.message,InputLabelProps:{shrink:!0},variant:"outlined",fullWidth:!0,required:!0})})))}function yt(a){const{data:t,error:n,isLoading:c,mutate:o}=oe(a?`api/v2/organization/${a}/privacy_policies`:null,se,{dedupingInterval:1e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,keepPreviousData:!0});return{data:t,isLoading:c,isError:n,mutate:o}}function xt({privacyPoliciesArray:a,isLoading:t,isError:n,setEditing:c,mutate:o}){const i=S(),l=ie(),m=e.useCallback(async(r,p)=>{try{await l({title:"Confirmar exclusão?",description:"O rascunho será excluÃdo permanentemente",confirmationText:"Excluir"});try{await gt(r,p),await o(),i.success("Rascunho excluÃdo com sucesso!")}catch(E){i.error(E.response?.data?.message||"Erro ao excluir rascunho")}}catch{}},[l,o,i]),d=e.useCallback(async(r,p)=>{try{await l({title:"Confirmar publicação?",description:"Essa ação é irreversÃvel! Ao publicar a nova polÃtica de privacidade, um e-mail será enviado a todos os proprietários com assinaturas ativas, informando sobre as atualizações. Além disso, ao acessarem o sistema, os proprietários precisarão aceitar a nova polÃtica de privacidade para continuar utilizando a plataforma.",confirmationText:"Publicar"});try{await vt(r,p),await o(),i.success("PolÃtica de privacidade publicada com sucesso!")}catch(E){i.error(E.response?.data?.message||"Erro ao publicar a polÃtica de privacidade")}}catch{}},[l,o,i]),f=r=>{r.status==="draft"?c(r):i.error("Apenas polÃticas em rascunho podem ser editadas!")};return e.createElement(le,{data:a,loading:t,loadingRowsQuantity:3,showError:n,stickyHeader:!0,columns:[{Header:"Arquivo",accessor:"term_file",sortable:!1,align:"center",Cell:({row:r})=>{const p=r.term_file.url,E=p.split("/"),u=E[E.length-1];return e.createElement(z,{title:u,tooltip:"Abrir arquivo",onClick:h=>{h.stopPropagation(),window.open(p,"_blank","noopener noreferrer")}},e.createElement(B,{color:"inherit"}))}},{Header:"Descrição",accessor:"description",sortable:!1,className:"truncate min-w-192 max-w-360",formatDataFunction:r=>e.createElement("span",{title:r},r)},{Header:"Criado em",accessor:"created_at",sortable:!1,formatDataFunction:r=>R(r).format("DD/MM/YYYY")},{Header:"Válido a partir de",accessor:"effective_start_date",sortable:!1,formatDataFunction:r=>R(r).format("DD/MM/YYYY")},{Header:"Publicado",accessor:"status",sortable:!1,formatDataFunction:r=>r==="draft"?e.createElement(j,{color:"grey"},"NÃO"):e.createElement(j,{color:"green"},"SIM")},{Header:"",accessor:"actions",sortable:!1,align:"right",Cell:({row:r})=>e.createElement("div",{className:"flex justify-end space-x-4"},e.createElement(z,{disabled:r.status==="active",tooltip:"Publicar polÃtica de privacidade",onClick:()=>d(r.organization_id,r.id)},e.createElement(_e,{color:"inherit"})),e.createElement(z,{disabled:r.status==="active",tooltip:"Editar",onClick:()=>f(r)},e.createElement(G,{color:"inherit"})),e.createElement(z,{disabled:r.status==="active",tooltip:"Excluir",onClick:()=>m(r.organization_id,r.id)},e.createElement(ce,null)))}]})}function Nt({open:a,onClose:t,organizationId:n}){const[c,o]=e.useState(!1),[i,l]=e.useState(!1),m=me("(max-width:600px)"),{data:d,isLoading:f,mutate:r,isError:p}=yt(a?n:null);return e.createElement(de,{open:a,onClose:t,PaperProps:{className:I(!m&&"shadow-md rounded-12")},fullWidth:!0,maxWidth:"md",fullScreen:m},e.createElement(ue,{className:"p-8 pl-12 sm:p-12 sm:pl-20"},e.createElement("div",{className:"flex items-center justify-between"},e.createElement("span",{className:"text-18 font-bold text-gray-700"},"Gerenciar polÃtica de privacidade"),e.createElement(J,{style:{padding:9},onClick:t},e.createElement(pe,null)))),e.createElement(fe,{dividers:!0,className:"flex flex-col items-center p-0"},e.createElement("div",{className:"w-full space-y-24 p-24"},e.createElement(Ee,{variant:"outlined",startIcon:e.createElement(ve,null),onClick:()=>o(!0),className:"w-full sm:w-auto"},"NOVA POLÃTICA"),e.createElement(xt,{privacyPoliciesArray:d,isLoading:f,isError:p,mutate:r,setEditing:l}))),e.createElement(ht,{open:c||i,defaultValues:i||{},organizationId:n,onClose:()=>{o(!1),l(null)},onUpdate:()=>{},mutate:r}))}function Ct(){const a=P(({auth:i})=>i.user.user.organization),t=a?.current_privacy_policy,[n,c]=e.useState(!1),o=e.useMemo(()=>
3{if(t){const l=t?.term_file?.url?.split("/"),m=l?l[l.length-1]:null;return{...t,name:m}}return{}},[t]);return e.createElement(ge,null,e.createElement(T,{title:"PolÃticas de privacidade da organização",onEdit:()=>c(!0)},e.createElement("div",{className:"space-y-12"},e.createElement(x,{data:[{label:"PolÃtica de privacidade ativa",value:e.createElement("span",{className:"cursor-pointer hover:text-gray-700",onClick:()=>window.open(o.term_file?.url,"_blank","noopener noreferrer")},o.name||"Não publicado")}]}),e.createElement(x,{data:[{label:"Válido a partir de",value:o.effective_start_date?R(o.effective_start_date).format("DD/MM/YYYY"):"Não publicado"}]}))),e.createElement(Nt,{open:n,organizationId:a?.id,onClose:()=>c(!1)}))}function Dt(a,t){return t?typeof t=="string"?parseFloat(t.replace(",",".")):t:null}const St=$().shape({iss_value:te().typeError("Informe uma alÃquota válida").transform(Dt).min(2,"Informe um valor superior a 2%").max(5,"Informe um valor inferior a 5%")});function wt({open:a,defaultValues:t,onClose:n,mutate:c}){const o=S(),[i,l]=e.useState(!1),{handleSubmit:m,reset:d,formState:f,control:r}=q({mode:"onSubmit",defaultValues:t,resolver:k(St)});e.useEffect(()=>{a&&d({...t})},[t,a,d]);const p=e.useCallback(async u=>{l(!0);const h={iss_value:u.iss_value};try{const v=await Y(t.id,h);c(v,!1),n()}catch(v){o.error(v.response?.data?.message||"Não foi possÃvel atualizar as informações")}l(!1)},[o,t.id,n,c]),{errors:E}=f;return e.createElement(A,{open:a,title:"Atualizar informações fiscais",loading:i,onClose:n,onSubmit:m(p)},e.createElement("div",{className:"space-y-20"},e.createElement(y,{name:"iss_value",control:r,render:({field:u})=>e.createElement(Re,{...u,id:"iss_value",label:"AlÃquota do ISS",error:!!E.iss_value,helperText:E?.iss_value?.message,size:"medium",autoFocus:!0,required:!0})})))}function Pt(){const a=P(({auth:l})=>l.user.user.organization),{data:t,mutate:n}=M(a?.id),[c,o]=e.useState(!1),i=e.useMemo(()=>{if(!t)return null;const{id:l,iss_value:m}=t;return{id:l,iss_value:m}},[t]);return e.createElement(e.Fragment,null,e.createElement(T,{title:"Informações Fiscais",onEdit:()=>o(!0)},e.createElement("div",{className:"space-y-12"},e.createElement(x,{data:[{label:"AlÃquota do ISS",value:t?.iss_value&&t?.iss_value!==0?parseFloat(t.iss_value||0).toFixed(2).replace(".",",")+" %":"Não informada"}]}))),i&&e.createElement(wt,{open:c,defaultValues:i,onClose:()=>o(!1),mutate:n}))}function zt({selectedFile:a,setSelectedFile:t,helperText:n}){const c=S(),[o,i]=e.useState(!1),l=d=>{if(d.target.files?.length>0){const f=d.target.files[0];if(f.size/1024/1024>1){c.error("Arquivo muito grande! O limite é 1 MiB");return}!f.type||["application/pdf"].includes(f.type)?t(f):c.error("Tipo de arquivo não suportado")}},m=!!a;return e.createElement(e.Fragment,null,e.createElement(ae,{onDrop:l,onDragDropChange:i,className:I("relative flex w-full items-center justify-center overflow-hidden rounded-8 px-16 py-24","border-2 border-dashed border-gray-300 bg-gray-50 transition-colors duration-300 hover:border-cardapio-web",o&&"border-cardapio-web")},e.createElement("input",{id:"upload-file",type:"file",accept:"application/pdf",className:"sr-only",onChange:l}),e.createElement("label",{htmlFor:"upload-file",className:I("flex w-full cursor-pointer flex-col items-center justify-center text-center text-gray-500 transition-opacity duration-300",o&&"opacity-20")},m?e.createElement(e.Fragment,null,e.createElement(B,{className:"text-72 text-gray-300"}),e.createElement("div",{className:"mt-8 text-16"},e.createElement("strong",null,"Arquivo selecionado"),e.createElement("div",null,a.name))):e.createElement(e.Fragment,null,e.createElement(be,{className:"text-72 text-gray-300"}),e.createElement("div",{className:"mt-8 text-16"},e.createElement("strong",null,"Selecione o arquivo"),e.createElement("div",null,"ou arraste e solte"))))),n&&e.createElement(Q,{className:"w-full text-center text-14 text-cardapio-web"},n))}const Tt=$().shape({description:D().trim().required("Informe a descrição"),effective_start_date:ne().required("Você deve informar uma data"),term_file:re().required("O arquivo de termo é obrigatório")});
3function Ft(a){const n=a.term_file.url.split("/");return{name:n[n.length-1]}}function Ot({open:a,defaultValues:t,onClose:n,mutate:c,organizationId:o}){const i=S(),[l,m]=e.useState(!1),{handleSubmit:d,reset:f,formState:r,control:p,setValue:E,watch:u}=q({mode:"onSubmit",defaultValues:t,resolver:k(Tt)}),h=u("term_file");e.useEffect(()=>{a&&f({...t,term_file:t?.term_file?.url&&Ft(t)})},[t,a,f]);const v=e.useCallback(async(s,_,b)=>b?await Je(s,_,b):await Ge(s,_),[]),C=e.useCallback(async s=>{m(!0);const _=new FormData,b=s?.term_file?.type;s.term_file&&b&&_.append("term_file",s.term_file,s.term_file.name),s.effective_start_date&&_.append("effective_start_date",s.effective_start_date),s.description&&_.append("description",s.description);try{(await v(o,_,s.id))?.term_file?.url&&i.success("Termo salvo com sucesso"),c(),n()}catch(F){i.error(F.response?.data?.message||"Não foi possÃvel atualizar as informações")}m(!1)},[i,n,c,v,o]),{errors:g}=r;return e.createElement(A,{open:a,title:t?.id?"Editar termo de uso":"Criar termo de uso",loading:l,onClose:n,onSubmit:d(C)},e.createElement("div",{className:"space-y-20"},e.createElement(zt,{error:!!g.term_file,helperText:g?.term_file?.message,selectedFile:h,setSelectedFile:s=>E("term_file",s)}),e.createElement(y,{name:"description",control:p,render:({field:s})=>e.createElement(N,{...s,id:"description",label:"Descrição",error:!!g.description,helperText:g?.description?.message,variant:"outlined",fullWidth:!0,required:!0,multiline:!0,rows:4})}),e.createElement(y,{name:"effective_start_date",control:p,render:({field:s})=>e.createElement(N,{...s,id:"effective_start_date",type:"date",label:"Data de vigência",error:!!g.effective_start_date,helperText:g?.effective_start_date?.message,InputLabelProps:{shrink:!0},variant:"outlined",fullWidth:!0,required:!0})})))}function It(a){const{data:t,error:n,isLoading:c,mutate:o}=oe(a?`api/v2/organization/${a}/usage_terms`:null,se,{dedupingInterval:1e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,keepPreviousData:!0});return{data:t,isLoading:c,isError:n,mutate:o}}function qt({usageTermsArray:a,isLoading:t,isError:n,setEditing:c,mutate:o}){const i=S(),l=ie(),m=e.useCallback(async(r,p)=>{try{await l({title:"Confirmar exclusão?",description:"O rascunho será excluÃdo permanentemente",confirmationText:"Excluir"});try{await Qe(r,p),await o(),i.success("Rascunho excluÃdo com sucesso!")}catch(E){i.error(E.response?.data?.message||"Erro ao excluir rascunho")}}catch{}},[l,o,i]),d=e.useCallback(async(r,p)=>{try{await l({title:"Confirmar publicação?",description:"Essa ação é irreversÃvel! Ao publicar os novos termos, um e-mail será enviado a todos os proprietários com assinaturas ativas, informando sobre as atualizações. Além disso, ao acessarem o sistema, os proprietários precisarão aceitar os novos termos de uso para continuar utilizando a plataforma.",confirmationText:"Publicar"});try{await Ke(r,p),await o(),i.success("Termos de uso publicado com sucesso!")}catch(E){i.error(E.response?.data?.message||"Erro ao publicar os termos de uso")}}catch{}},[l,o,i]),f=r=>{r.status==="draft"?c(r):i.error("Apenas termos de uso em rascunho podem ser editados!")};return e.createElement(le,{data:a,loading:t,loadingRowsQuantity:3,showError:n,stickyHeader:!0,columns:[{Header:"Arquivo",accessor:"term_file",sortable:!1,align:"center",Cell:({row:r})=>{const p=r.term_file.url,E=p.split("/"),u=E[E.length-1];return e.createElement(z,{title:u,tooltip:"Abrir arquivo",onClick:h=>{h.stopPropagation(),window.open(p,"_blank","noopener noreferrer")}},e.createElement(B,{color:"inherit"}))}},{Header:"Descrição",accessor:"description",sortable:!1,className:"truncate min-w-192 max-w-360",formatDataFunction:r=>e.createElement("span",{title:r},r)},{Header:"Criado em",accessor:"created_at",sortable:!1,formatDataFunction:r=>R(r).format("DD/MM/YYYY")},{Header:"Válido a partir de",accessor:"effective_start_date",sortable:!1,formatDataFunction:r=>R(r).format("DD/MM/YYYY")},{Header:"Publicado",accessor:"status",sortable:!1,formatDataFunction:r=>r==="draft"?e.createElement(j,{color:"grey"},"NÃO"):e.createElement(j,{color:"green"},"SIM")},{Header:"",accessor:"actions",sortable:!1,align:"right",Cell:({row:r})=>e.createElement("div",{className:"flex justify-end space-x-4"},e.createElement(z,{disabled:r.status==="active",tooltip:"Publicar termo",onClick:()=>d(r.organization_id,r.id)},e.createElement(_e,{color:"inherit"})),e.createElement(z,{disabled:r.status==="active",tooltip:"Editar",onClick:()=>f(r)},e.createElement(G,{color:"inherit"})),e.createElement(z,{disabled:r.status==="active",tooltip:"Excluir",onClick:()=>m(r.organization_id,r.id)},e.createElement(ce,null)))}]})}function kt({open:a,onClose:t,organizationId:n}){const[c,o]=e.useState(!1),[i,l]=e.useState(!1),m=me("(max-width:600px)"),{data:d,isLoading:f,mutate:r,isError:p}=It(a?n:null);return e.createElement(de,{open:a,onClose:t,PaperProps:{className:I(!m&&"shadow-md rounded-12")},fullWidth:!0,maxWidth:"md",fullScreen:m},e.createElement(ue,{className:"p-8 pl-12 sm:p-12 sm:pl-20"},e.createElement("div",{className:"flex items-center justify-between"},e.createElement("span",{className:"text-18 font-bold text-gray-700"},"Gerenciar termos de uso"),e.createElement(J,{style:{padding:9},onClick:t},e.createElement(pe,null)))),e.createElement(fe,{dividers:!0,className:"flex flex-col items-center p-0"},e.createElement("div",{className:"w-full space-y-24 p-24"},e.createElement(Ee,{variant:"outlined",startIcon:e.createElement(ve,null),onClick:()=>o(!0),className:"w-full sm:w-auto"},"NOVO TERMO"),e.createElement(qt,{usageTermsArray:d,isLoading:f,isError:p,mutate:r,setEditing:l}))),e.createElement(Ot,{open:c||i,defaultValues:i||{},organizationId:n,onClose:()=>{o(!1),l(null)},onUpdate:()=>{},mutate:r}))}function At(){const a=P(({auth:i})=>i.user.user.organization),t=a?.current_usage_term,[n,c]=e.useState(!1),o=e.useMemo(()=>
3{if(t){const l=t?.term_file?.url?.split("/"),m=l?l[l.length-1]:null;return{...t,name:m}}return{}},[t]);return e.createElement(ge,null,e.createElement(T,{title:"Termos de uso da organização",onEdit:()=>c(!0)},e.createElement("div",{className:"space-y-12"},e.createElement(x,{data:[{label:"Termo de uso ativo",value:e.createElement("span",{className:"cursor-pointer hover:text-gray-700",onClick:()=>window.open(o.term_file?.url,"_blank","noopener noreferrer")},o.name||"Não publicado")}]}),e.createElement(x,{data:[{label:"Válido a partir de",value:o.effective_start_date?R(o.effective_start_date).format("DD/MM/YYYY"):"Não publicado"}]}))),e.createElement(kt,{open:n,organizationId:a?.id,onClose:()=>c(!1)}))}function Gt(){const a=P(({auth:o})=>o.user.user.organization),{data:t,isLoading:n,isError:c}=M(a?.id);return n?e.createElement(Ue,null):c?e.createElement(Le,{title:"Problema ao buscar as informações"}):e.createElement("div",{className:"grid w-full flex-1 grid-cols-1 gap-20 overflow-auto px-12 py-24 sm:px-28 md:grid-cols-2"},e.createElement("div",{className:"space-y-20"},e.createElement(dt,null),e.createElement(et,null),e.createElement(lt,null)),e.createElement("div",{className:"space-y-20"},e.createElement(rt,null),e.createElement(it,null),t.kind==="cardapio_web"&&e.createElement(Pt,null),t.kind!=="cardapio_web"&&a?.id!==25&&e.createElement(ut,null),e.createElement(At,null),e.createElement(Ct,null)))}export{Gt as default}; 4 5//# debugId=c8bace12-9c81-5021-9705-5bba87599719
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.