@s_mart/minha-conta 15.0.2 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/api/index.d.ts +30 -0
  2. package/dist/api/queries.d.ts +92 -0
  3. package/dist/components/loading/loading.d.ts +4 -0
  4. package/dist/components/meuPlanoInfo/components/buttonPlanos.d.ts +3 -0
  5. package/dist/components/meuPlanoInfo/components/detalhes.d.ts +10 -0
  6. package/dist/components/meuPlanoInfo/components/skeleton.d.ts +1 -0
  7. package/dist/components/meuPlanoInfo/meuPlanoInfo.d.ts +2 -0
  8. package/dist/components/meuPlanoInfo/meuPlanoInfo.static.d.ts +2 -0
  9. package/dist/components/meuPlanoInfo/meuPlanoInfo.types.d.ts +16 -0
  10. package/dist/components/meuPlanoInfo/useMeuPlanoInfo.d.ts +15 -0
  11. package/dist/components/planosDialog/contratarRecursos/confirmacaoDialog/confirmacaoDialog.d.ts +5 -0
  12. package/dist/components/planosDialog/contratarRecursos/confirmacaoDialog/useConfirmacaoDialog.d.ts +15 -0
  13. package/dist/components/planosDialog/contratarRecursos/contratarRecursos.d.ts +1 -0
  14. package/dist/components/planosDialog/contratarRecursos/listaRecursos/listaRecursos.d.ts +1 -0
  15. package/dist/components/planosDialog/contratarRecursos/listaRecursos/listaRecursos.styles.d.ts +5 -0
  16. package/dist/components/planosDialog/contratarRecursos/planoShowcase/planoShowcase.d.ts +1 -0
  17. package/dist/components/planosDialog/contratarRecursos/planoShowcase/planoShowcase.styles.d.ts +7 -0
  18. package/dist/components/planosDialog/contratarRecursos/planoShowcase/usePlanoShowcase.d.ts +7 -0
  19. package/dist/components/planosDialog/emptyState/emptyState.d.ts +1 -0
  20. package/dist/components/planosDialog/listagemPlanos/listagemPlanos.d.ts +2 -0
  21. package/dist/components/planosDialog/listagemPlanos/listagemPlanos.styles.d.ts +5 -0
  22. package/dist/components/planosDialog/listagemPlanos/listagemPlanos.types.d.ts +4 -0
  23. package/dist/components/planosDialog/listagemPlanos/plano/plano.d.ts +10 -0
  24. package/dist/components/planosDialog/listagemPlanos/plano/plano.styles.d.ts +8 -0
  25. package/dist/components/planosDialog/listagemPlanos/useListagemPlanos.d.ts +12 -0
  26. package/dist/components/planosDialog/loading/loading.d.ts +1 -0
  27. package/dist/components/planosDialog/planosDialog.d.ts +2 -0
  28. package/dist/components/planosDialog/planosDialog.static.d.ts +4 -0
  29. package/dist/components/planosDialog/planosDialog.types.d.ts +26 -0
  30. package/dist/components/planosDialog/planosDialogExport.d.ts +2 -0
  31. package/dist/components/planosDialog/usePlanosDialog.d.ts +15 -0
  32. package/dist/components/recursosDialog/confirmacaoAdquirirDialog/confirmacaoAdquirirDialog.d.ts +2 -0
  33. package/dist/components/recursosDialog/confirmacaoAdquirirDialog/confirmacaoAdquirirDialog.types.d.ts +6 -0
  34. package/dist/components/recursosDialog/confirmacaoRemoverDialog/confirmacaoRemoverDialog.d.ts +2 -0
  35. package/dist/components/recursosDialog/confirmacaoRemoverDialog/confirmacaoRemoverDialog.types.d.ts +6 -0
  36. package/dist/components/recursosDialog/emptyState/emptyState.d.ts +1 -0
  37. package/dist/components/recursosDialog/gifDialog/gifDialog.d.ts +2 -0
  38. package/dist/components/recursosDialog/gifDialog/gifDialog.styles.d.ts +1 -0
  39. package/dist/components/recursosDialog/gifDialog/gifDialog.types.d.ts +7 -0
  40. package/dist/components/recursosDialog/recurso/recurso.d.ts +2 -0
  41. package/dist/components/recursosDialog/recurso/recurso.styles.d.ts +14 -0
  42. package/dist/components/recursosDialog/recurso/recurso.types.d.ts +8 -0
  43. package/dist/components/recursosDialog/recursosDialog.d.ts +2 -0
  44. package/dist/components/recursosDialog/recursosDialog.types.d.ts +25 -0
  45. package/dist/components/recursosDialog/recursosDialogExport.d.ts +2 -0
  46. package/dist/components/recursosDialog/useRecursosDialog.d.ts +17 -0
  47. package/dist/context/minhaContaProvider.d.ts +99 -0
  48. package/dist/context/minhaContaQueryProvider.d.ts +2 -0
  49. package/dist/context/notificationProvider.d.ts +3 -0
  50. package/dist/context/notificationProvider.types.d.ts +8 -0
  51. package/dist/helpers/contrateApi/contrateApi.types.d.ts +45 -0
  52. package/dist/helpers/contrateApi/geralApi.types.d.ts +29 -0
  53. package/dist/helpers/contrateApi/meusDadosApi.types.d.ts +175 -0
  54. package/dist/helpers/types.d.ts +3 -0
  55. package/dist/hooks/useDialog.d.ts +4 -0
  56. package/dist/hooks/useToken.d.ts +2 -0
  57. package/dist/index.d.ts +18 -0
  58. package/dist/index.mjs +3388 -83
  59. package/dist/index.mjs.map +1 -0
  60. package/dist/screens/confirmarEmail/api/index.d.ts +7 -0
  61. package/dist/screens/confirmarEmail/confirmarEmail.d.ts +2 -0
  62. package/dist/screens/confirmarEmail/confirmarEmail.styles.d.ts +6 -0
  63. package/dist/screens/confirmarEmail/confirmarEmail.types.d.ts +9 -0
  64. package/dist/screens/confirmarEmail/useConfirmarEmail.d.ts +2 -0
  65. package/dist/screens/meuPlano/faturas/alterarEmailCobrancaDialog/alterarEmailCobrancaDialog.d.ts +4 -0
  66. package/dist/screens/meuPlano/faturas/alterarEmailCobrancaDialog/alterarEmailCobrancaDialog.types.d.ts +8 -0
  67. package/dist/screens/meuPlano/faturas/alterarEmailCobrancaDialog/useAlterarEmailCobrancaDialog.d.ts +19 -0
  68. package/dist/screens/meuPlano/faturas/emptyState/emptyState.d.ts +1 -0
  69. package/dist/screens/meuPlano/faturas/faturas.d.ts +1 -0
  70. package/dist/screens/meuPlano/faturas/useFaturas.d.ts +32 -0
  71. package/dist/screens/meuPlano/faturas/useProximaFatura.d.ts +1 -0
  72. package/dist/screens/meuPlano/meuPlano.d.ts +3 -0
  73. package/dist/screens/meuPlano/termosDeUso/termosDeUso.d.ts +5 -0
  74. package/dist/screens/meuPlano/useMeuPlano.d.ts +5 -0
  75. package/dist/screens/minhaConta/minhaConta.d.ts +2 -0
  76. package/dist/screens/minhaConta/minhaConta.types.d.ts +19 -0
  77. package/dist/screens/minhaConta/useMinhaConta.d.ts +6 -0
  78. package/dist/screens/minhaEmpresa/dadosEmpresa/dadosEmpresa.d.ts +1 -0
  79. package/dist/screens/minhaEmpresa/dadosEmpresa/dadosEmpresa.styles.d.ts +1 -0
  80. package/dist/screens/minhaEmpresa/dadosEmpresa/useDadosEmpresa.d.ts +15 -0
  81. package/dist/screens/minhaEmpresa/dadosEndereco/dadosEndereco.d.ts +1 -0
  82. package/dist/screens/minhaEmpresa/dadosEndereco/useDadosEndereco.d.ts +10 -0
  83. package/dist/screens/minhaEmpresa/dadosResponsavel/dadosResponsavel.d.ts +1 -0
  84. package/dist/screens/minhaEmpresa/header/header.d.ts +1 -0
  85. package/dist/screens/minhaEmpresa/header/useHeader.d.ts +14 -0
  86. package/dist/screens/minhaEmpresa/minhaEmpresa.d.ts +3 -0
  87. package/dist/screens/minhaEmpresa/minhaEmpresa.helpers.d.ts +4 -0
  88. package/dist/screens/minhaEmpresa/minhaEmpresa.types.d.ts +42 -0
  89. package/dist/screens/minhaEmpresa/useMinhaEmpresa.d.ts +6 -0
  90. package/dist/shared/styles.d.ts +7 -0
  91. package/dist/shared/types.d.ts +4 -0
  92. package/dist/store/app/app.static.d.ts +2 -0
  93. package/dist/store/app/app.types.d.ts +9 -0
  94. package/dist/store/app/useAppStore.d.ts +2 -0
  95. package/dist/store/minhaConta/createMinhaContaStore.d.ts +2 -0
  96. package/dist/store/minhaConta/minhaConta.static.d.ts +2 -0
  97. package/dist/store/minhaConta/minhaConta.types.d.ts +226 -0
  98. package/dist/types/index.d.ts +16 -0
  99. package/dist/utils/getPeriodicidadeLabel.d.ts +6 -0
  100. package/dist/utils/openWhatsapp.d.ts +2 -0
  101. package/dist/utils/parseError.d.ts +2 -0
  102. package/package.json +55 -69
  103. package/dist/index.d.mts +0 -618
package/dist/index.mjs CHANGED
@@ -1,11 +1,973 @@
1
- import Mr from"axios";var Le=class{axiosSistema;axiosControle;listeners=new Set;constructor(e){let a=e.defaults.baseURL?.includes("staging")?"https://apistaging-controle.sbsistemas.com.br":"https://apicontrole.sbsistemas.com.br";this.axiosControle=Mr.create({...e,baseURL:a}),this.axiosSistema=Mr.create(e.defaults)}setToken(e){let r=e;e.startsWith("Bearer ")||(r=`Bearer ${r}`),this.axiosSistema.defaults.headers.common.Authorization=r,this.axiosControle.defaults.headers.common.Authorization=r,this.notify()}get token(){return this.axiosSistema.defaults.headers.common.Authorization?.toString().replace("Bearer ","")??""}buscarMeusDados(){return this.axiosSistema.get("/meus-dados")}atualizarMeusDados(e){return this.axiosSistema.patch("/meus-dados",e)}buscarMeuPlanoRecursos(){return this.axiosSistema.get("/meus-dados/meu-plano/recursos")}contratarRecurso(e){return this.axiosSistema.patch(`/meus-dados/plano/contratar-recurso/${e}`)}descontratarRecurso(e){return this.axiosSistema.patch(`/meus-dados/plano/descontratar-recurso/${e}`)}buscarPlano(e){return this.axiosSistema.get(`/meus-dados/plano-buscar/${e.path.codigo}`,{params:e.params})}contratarPlano(e){return this.axiosSistema.patch("/meus-dados/alterar-plano",e)}listarCobrancas(){return this.axiosSistema.get("/meus-dados/cobrancas")}atualizarEmailCobranca(e){return this.axiosSistema.patch("/meus-dados/email-cobranca",e)}buscarBoleto(e){return this.axiosSistema.get(`/meus-dados/cobrancas/baixar-boleto/${e}`)}buscarNfse(e){return this.axiosSistema.get(`/meus-dados/cobrancas/baixar-nfse/${e}`)}listarPlanosEGrupos(e){let r=window.location.hostname.includes("parceiro")?1:0;return this.axiosControle.get("/contrate/planos-e-grupos",{params:{...e.params,tipoPlano:r}})}buscarRntrc(e){return this.axiosSistema.get(`/rntrc?cnpj=${e}`)}buscarCep(e){return this.axiosSistema.get(`/cep/${e}`)}pesquisarCidades(e){return this.axiosSistema.get(`/cidades?search=${e}`)}subscriber(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notify(){this.listeners.forEach(e=>e())}};import{Card as ci,Grid as Wo,Typography as te}from"@mui/material";import{LIcon as Kr}from"@s_mart/core";import{decimal as pi}from"@s_mart/masks";import{lineShoppingCard as di,lineStar as ui}from"@s_mart/solid-icons";var jt=(o,e)=>{let r=e?.modelo||"mes",a=o??0;return{mes:{0:"m\xEAs",1:"tri",2:"sem",3:"ano"},mensais:{0:"mensais",1:"trimestrais",2:"semestrais",3:"anuais"},mensalidade:{0:"mensalidade",1:"trimestralidade",2:"semestralidade",3:"anualidade"}}[r][a]},V=jt;import{Paper as Ht,Skeleton as xo}from"@mui/material";import{Grid as Fo}from"@mui/system";import{jsx as j,jsxs as Ar}from"react/jsx-runtime";function Tr(){return j(Ht,{elevation:1,sx:{padding:"1.5rem"},children:Ar(Fo,{container:!0,spacing:1,justifyContent:"center",children:[j(Fo,{size:12,children:j(xo,{height:"1.3rem",style:{transform:"none"}})}),j(Fo,{size:12,marginTop:"0.5rem",children:j(xo,{height:"3.5rem",style:{transform:"none"}})}),Ar(Fo,{size:12,marginY:"1rem",children:[j(xo,{height:"0.8rem",sx:{transform:"none"}}),j(xo,{height:"0.8rem",sx:{transform:"none",marginY:"0.5rem"}}),j(xo,{height:"0.8rem",sx:{transform:"none"}})]}),j(Fo,{size:6,children:j(xo,{height:"2rem",style:{transform:"none"}})}),j(Fo,{size:6,children:j(xo,{height:"2rem",style:{transform:"none"}})})]})})}import{useMediaQuery as mi}from"@mui/system";import{useQuery as Yr}from"@tanstack/react-query";import{useMemo as Xr}from"react";import{useQueryClient as oi}from"@tanstack/react-query";import{jwtDecode as ei}from"jwt-decode";import{createContext as ri,useCallback as ai,useContext as Ve,useEffect as ti,useMemo as ii,useState as qe}from"react";import{createStore as ni,useStore as Br}from"zustand";import{mutationOptions as Qo,queryOptions as J}from"@tanstack/react-query";var Z={all:["minha-conta"],buscarMeusDados(){return[...this.all,"meus-dados"]},buscarMeuPlanoRecursos(){return[...this.all,"meu-plano"]},buscarPlano(o){return[...this.all,"plano",o]},listarCobrancas(){return[...this.buscarMeuPlanoRecursos(),"cobrancas"]},buscarBoleto(o){return[...this.listarCobrancas(),"boleto",o]},buscarNfse(o){return[...this.listarCobrancas(),"Nfse",o]},listarPlanosEGrupos(o){return[...this.all,"listar-planos-e-grupos",o]},buscarRntrc(o){return[...this.all,"buscar-rntrc",o]},buscarCep(o){return[...this.all,"buscar-cep",o]},pesquisarCidades(o){return[...this.all,"pesquisar-cidades",o]}},Ir=o=>({buscarMeusDados:()=>J({queryKey:Z.buscarMeusDados(),queryFn:()=>o.buscarMeusDados()}),buscarMeuPlanoRecursos:()=>J({queryKey:Z.buscarMeuPlanoRecursos(),queryFn:()=>o.buscarMeuPlanoRecursos()}),buscarPlano:e=>J({queryKey:Z.buscarPlano(e),queryFn:()=>o.buscarPlano(e)}),listarCobrancas:()=>J({queryKey:Z.listarCobrancas(),queryFn:()=>o.listarCobrancas()}),buscarBoleto:e=>J({queryKey:Z.buscarBoleto(e),queryFn:()=>o.buscarBoleto(e)}),buscarNfse:e=>J({queryKey:Z.buscarNfse(e),queryFn:()=>o.buscarNfse(e)}),listarPlanosEGrupos:e=>J({queryKey:Z.listarPlanosEGrupos(e),queryFn:()=>o.listarPlanosEGrupos(e)}),buscarRntrc:e=>J({queryKey:Z.buscarRntrc(e),queryFn:()=>o.buscarRntrc(e)}),buscarCep:e=>J({queryKey:Z.buscarCep(e),queryFn:()=>o.buscarCep(e)}),pesquisarCidades:e=>J({queryKey:Z.pesquisarCidades(e),queryFn:()=>o.pesquisarCidades(e)})}),Er=o=>({atualizarMeusDados:()=>Qo({mutationFn:e=>o.atualizarMeusDados(e)}),contratarRecurso:()=>Qo({mutationFn:e=>o.contratarRecurso(e)}),descontratarRecurso:()=>Qo({mutationFn:e=>o.descontratarRecurso(e)}),contratarPlano:()=>Qo({mutationFn:e=>o.contratarPlano(e)}),atualizarEmailCobrancas:()=>Qo({mutationFn:e=>o.atualizarEmailCobranca(e)})});import{Backdrop as Yt,CircularProgress as Xt}from"@mui/material";import{jsx as Gr}from"react/jsx-runtime";function Ut({show:o}){return Gr(Yt,{open:o,style:{zIndex:1e4},children:Gr(Xt,{size:50,sx:{color:e=>e.palette.primary.main}})})}var Fr=Ut;import{useSyncExternalStore as Kt}from"react";var zr=o=>Kt(e=>o.subscriber(e),()=>o.token);import{create as Jt}from"zustand";var Be={loading:!1};var oo=Jt(o=>({...Be,setLoading:e=>o({loading:e}),resetState:()=>o(Be)}));import{createStore as Zt}from"zustand";var kr={tabAtiva:"minhaEmpresa",sistemaNome:"",telefoneSuporte:"",telefoneCS:"",minhaEmpresa:{},meuPlano:{},recursosDialog:{},planosDialog:{}};var wr=o=>Zt()(e=>({...kr,...o,setTabAtiva:r=>e({tabAtiva:r})}));import{jsx as si,jsxs as li}from"react/jsx-runtime";var oe=ri(null),Lr=o=>{try{return ei(o)}catch{return}};function Ne(o){let e=oo(d=>d.loading),r=zr(o.api),a=oi(),[n]=qe(()=>ni(()=>o.slotProps??{})),[t]=qe(()=>wr({...o,usuario:Lr(r)})),[i]=qe(()=>({...Ir(o.api),...Er(o.api)})),s=ai(()=>{t.setState({usuario:Lr(o.api.token)}),a.resetQueries()},[o.api.token,a.resetQueries,t.setState]);ti(()=>{o.api.subscriber(s)},[o.api.subscriber,s]);let m=ii(()=>({storeMinhaConta:t,storeSlotProps:n,api:i}),[i,t,n]);return li(oe.Provider,{value:m,children:[o.children,si(Fr,{show:e})]})}function g(o){let e=Ve(oe);if(e===null)throw new Error("useMinhaContaStore deve ser utilizado dentro de um MinhaContaProvider");return Br(e.storeMinhaConta,o)}function qr(o){let e=Ve(oe);if(e===null)throw new Error("useSlotProps deve ser utilizado dentro de um MinhaContaProvider");return Br(e.storeSlotProps,o)}function S(){let o=Ve(oe);if(o===null)throw new Error("useApi deve ser utilizado dentro de um MinhaContaProvider");return o.api}import{Button as Vr}from"@s_mart/core";import{jsx as Wr}from"react/jsx-runtime";function Nr(o){return Wr(Vr,{...o,children:"Ver planos"})}function Qr(o){return Wr(Vr,{...o,children:"Loja de recursos"})}import{Typography as ee}from"@mui/material";import{valor as $r}from"@s_mart/masks";import{colorPalette as re}from"@s_mart/tokens";import{jsx as ae,jsxs as jr}from"react/jsx-runtime";function Or({recurso:o}){return jr("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"0.2rem"},children:[ae(ee,{variant:"bodySM",color:re.neutral[100],children:o.nomeRecurso}),ae(ee,{variant:"titleXS",color:re.neutral[100],children:$r.format(o.valorRecurso??0)})]},o.codigoRecurso)}function _r({meuPlano:o}){return jr("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"0.2rem"},children:[ae(ee,{variant:"bodySM",color:re.neutral[100],children:o?.nomePlano}),ae(ee,{variant:"titleXS",color:re.neutral[100],children:$r.format(o?.valor??0)})]})}var Hr={DetalhesItemRecurso:Or,DetalhesItemPlano:_r,ButtonPlanos:Nr,ButtonLojaRecursos:Qr};function Ur(o){let e=S(),r=Yr(e.buscarMeuPlanoRecursos()),a=Yr({...e.listarCobrancas(),select(c){return c.data.data.some(u=>u.situacao==="EMITIDO")}}),n=Xr(()=>({...Hr,...o.slots}),[o.slots]),t=r.data?.data.data,i=!!a.data,s=mi("(max-width: 400px)"),m=Xr(()=>{let c=t?.valor??0,u=t?.recursos?.filter(f=>f.recursoContratado).reduce((f,x)=>f+x.valorRecurso,0)??0;return c+u},[t?.valor,t?.recursos]),d=t?.recursos?.filter(c=>c.recursoContratado).sort((c,u)=>c.valorRecurso-u.valorRecurso);return{meuPlanoQuery:r,meuPlano:t,cobrancaEmitida:i,valorTotalPlano:m,recursosContratados:d,slots:n,maxWidth400:s}}import{Fragment as fi,jsx as W,jsxs as $o}from"react/jsx-runtime";function Qe(o){let{cobrancaEmitida:e,maxWidth400:r,meuPlanoQuery:a,meuPlano:n,recursosContratados:t,slots:i,valorTotalPlano:s}=Ur(o);return a.isFetching?W(Tr,{}):W(fi,{children:W(ci,{elevation:2,sx:{padding:"1rem"},children:$o(Wo,{container:!0,children:[W(Wo,{size:12,textAlign:"center",children:W(te,{variant:"titleSM",children:n?.recursos?"Valor Total":"Valor do plano"})}),$o(Wo,{size:12,sx:{display:"flex",justifyContent:"center",alignItems:"end"},children:[W(te,{variant:"titleXXS",alignSelf:"center",children:"R$"}),W(te,{variant:"titleXL",style:{fontSize:"3rem"},children:pi.format(s)}),$o(te,{variant:"titleMD",marginBottom:"0.3rem",children:["/",V(n?.periodicidade??null)]})]}),$o(Wo,{size:12,marginTop:"2rem",children:[W(i.DetalhesItemPlano,{meuPlano:n}),t?.map(m=>W(i.DetalhesItemRecurso,{recurso:m},m.codigoRecurso))]}),$o(Wo,{size:12,sx:{display:"flex",flexDirection:r?"column":"row",justifyContent:"space-between",gap:"0.5rem",marginTop:"2rem"},children:[o.exibirPlanos&&W(i.ButtonPlanos,{variant:e?"neutral":"contained",startIcon:W(Kr,{icon:ui,removeMargin:!0}),fullWidth:r||!o.exibirLojaRecursos,onClick:o.onClickButtonPlanos}),o.exibirLojaRecursos&&W(i.ButtonLojaRecursos,{variant:e?"neutral":"outlined",disabled:!n?.recursos,startIcon:W(Kr,{icon:di,removeMargin:!0}),fullWidth:r||!o.exibirPlanos,onClick:o.onClickButtonLojaRecursos})]})]})})})}import{useContext as yi,createContext as hi}from"react";var gi=o=>{let e=[];return typeof o!="object"||(Array.isArray(o)&&typeof o[0]=="string"?e=o:Array.isArray(o.errors)?e=o.errors:typeof o.errors=="string"?e=[o.errors]:typeof o.error=="string"?e=[o.error]:typeof o.erro=="string"?e=[o.erro]:o.erro?.mensagem?e=[o.erro.mensagem]:typeof o.message=="string"?e=[o.message]:typeof o.mensagem=="string"?e=[o.mensagem]:typeof o.authErrors?.[0]=="string"&&(e=o.authErrors)),e},ie=gi;import{jsx as Ci}from"react/jsx-runtime";var Jr=hi(null),to=({onNotification:o,children:e})=>{let r=a=>{let n=ie(a);console.error(a),o({variant:"error",title:n[0]})};return Ci(Jr.Provider,{value:{setNotification:o,handleErrors:r},children:e})},G=()=>{let o=yi(Jr);if(o===null)throw new Error("Hook `useMinhaContaContext` must be used inside a MinhaContaProvider");return o};import{Button as Ea,Dialog as pe,LIcon as an}from"@s_mart/core";import{Form as tn,SelectV2 as nn}from"@s_mart/form";import{lineWhatsApp as sn}from"@s_mart/regular-icons";import{colorPalette as ln}from"@s_mart/tokens";import{useState as Pi}from"react";var H=o=>{let[e,r]=Pi(!0);return{open:e,onCloseDialog:()=>{r(!1),setTimeout(()=>o(),100)}}};var bi=o=>{let e=`https://api.whatsapp.com/send?phone=${o}`;window.open(e,"_blank","noopener noreferrer")},io=bi;import{CircularProgress as xi}from"@mui/material";import{jsx as Zr}from"react/jsx-runtime";function oa(){return Zr("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"20vh"},children:Zr(xi,{})})}import{LIcon as ma}from"@s_mart/core";import{lineChevronLeft as Li,lineChevronRight as Bi}from"@s_mart/regular-icons";import{styled as vi}from"@mui/material";import{colorPalette as Si}from"@s_mart/tokens";var We=vi("div")`
1
+ import e from "axios";
2
+ import { Alert as t, Avatar as n, Backdrop as r, Button as i, Card as a, Chip as o, CircularProgress as s, Divider as c, Grid as l, InputAdornment as u, Paper as d, Skeleton as f, Tab as p, Tabs as m, Tooltip as h, Typography as g, css as _, styled as v, useMediaQuery as y } from "@mui/material";
3
+ import { Dialog as b, IconButton as x, LIcon as S } from "@s_mart/core";
4
+ import { decimal as ee, valor as C } from "@s_mart/masks";
5
+ import { lineExternalLink as te, lineInfoCircle as w, linePen as ne, linePicture as re, linePlus as ie, lineShoppingCard as ae, lineStar as oe, lineSync as se, lineTrash as ce, lineWhatsappBrands as le } from "@s_mart/solid-icons";
6
+ import { Grid as T, useMediaQuery as ue } from "@mui/system";
7
+ import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
8
+ import { QueryClient as de, QueryClientProvider as fe, mutationOptions as k, queryOptions as A, useIsFetching as pe, useMutation as j, useQuery as M, useQueryClient as N } from "@tanstack/react-query";
9
+ import { createContext as me, memo as he, useCallback as P, useContext as ge, useEffect as _e, useLayoutEffect as ve, useMemo as F, useState as I, useSyncExternalStore as ye } from "react";
10
+ import { jwtDecode as be } from "jwt-decode";
11
+ import { create as xe, createStore as Se, useStore as Ce } from "zustand";
12
+ import { colorPalette as L } from "@s_mart/tokens";
13
+ import { CreatableV2 as we, DatePicker as Te, Form as Ee, SelectV2 as De, Switch as Oe, TextField as R } from "@s_mart/form";
14
+ import { lineCheckCircle as ke, lineChevronLeft as Ae, lineChevronRight as je, lineClock as Me, lineReceipt as Ne, lineTrashAlt as Pe, lineWhatsApp as Fe } from "@s_mart/regular-icons";
15
+ import { FormProvider as Ie, useFieldArray as Le, useForm as Re, useFormContext as z, useWatch as ze } from "react-hook-form";
16
+ import B from "dayjs";
17
+ import { DataTable as Be, List as Ve } from "@s_mart/data";
18
+ import { cep as He, composeValidators as V, cpfCnpj as Ue, email as We, maxLength as H, required as U, requiredWithTrim as Ge, telefone as Ke } from "@s_mart/rules";
19
+ import { createResizedImage as qe, downloadFile as Je } from "@s_mart/utils";
20
+ import Ye from "dayjs/plugin/utc";
21
+ import Xe from "lodash-es/debounce";
22
+ import { useDropzone as Ze } from "react-dropzone";
23
+ //#region src/api/index.ts
24
+ var Qe = class {
25
+ axiosSistema;
26
+ axiosControle;
27
+ listeners = /* @__PURE__ */ new Set();
28
+ constructor(t) {
29
+ let n = t.defaults.baseURL?.includes("staging") ? "https://apistaging-controle.sbsistemas.com.br" : "https://apicontrole.sbsistemas.com.br";
30
+ this.axiosControle = e.create({
31
+ ...t,
32
+ baseURL: n
33
+ }), this.axiosSistema = e.create(t.defaults);
34
+ }
35
+ setToken(e) {
36
+ let t = e;
37
+ e.startsWith("Bearer ") || (t = `Bearer ${t}`), this.axiosSistema.defaults.headers.common.Authorization = t, this.axiosControle.defaults.headers.common.Authorization = t, this.notify();
38
+ }
39
+ get token() {
40
+ return this.axiosSistema.defaults.headers.common.Authorization?.toString().replace("Bearer ", "") ?? "";
41
+ }
42
+ buscarMeusDados() {
43
+ return this.axiosSistema.get("/meus-dados");
44
+ }
45
+ atualizarMeusDados(e) {
46
+ return this.axiosSistema.patch("/meus-dados", e);
47
+ }
48
+ buscarMeuPlanoRecursos() {
49
+ return this.axiosSistema.get("/meus-dados/meu-plano/recursos");
50
+ }
51
+ contratarRecurso(e) {
52
+ return this.axiosSistema.patch(`/meus-dados/plano/contratar-recurso/${e}`);
53
+ }
54
+ descontratarRecurso(e) {
55
+ return this.axiosSistema.patch(`/meus-dados/plano/descontratar-recurso/${e}`);
56
+ }
57
+ buscarPlano(e) {
58
+ return this.axiosSistema.get(`/meus-dados/plano-buscar/${e.path.codigo}`, { params: e.params });
59
+ }
60
+ contratarPlano(e) {
61
+ return this.axiosSistema.patch("/meus-dados/alterar-plano", e);
62
+ }
63
+ listarCobrancas() {
64
+ return this.axiosSistema.get("/meus-dados/cobrancas");
65
+ }
66
+ atualizarEmailCobranca(e) {
67
+ return this.axiosSistema.patch("/meus-dados/email-cobranca", e);
68
+ }
69
+ buscarBoleto(e) {
70
+ return this.axiosSistema.get(`/meus-dados/cobrancas/baixar-boleto/${e}`);
71
+ }
72
+ buscarNfse(e) {
73
+ return this.axiosSistema.get(`/meus-dados/cobrancas/baixar-nfse/${e}`);
74
+ }
75
+ listarPlanosEGrupos(e) {
76
+ let t = +!!window.location.hostname.includes("parceiro");
77
+ return this.axiosControle.get("/contrate/planos-e-grupos", { params: {
78
+ ...e.params,
79
+ tipoPlano: t
80
+ } });
81
+ }
82
+ buscarRntrc(e) {
83
+ return this.axiosSistema.get(`/rntrc?cnpj=${e}`);
84
+ }
85
+ buscarCep(e) {
86
+ return this.axiosSistema.get(`/cep/${e}`);
87
+ }
88
+ pesquisarCidades(e) {
89
+ return this.axiosSistema.get(`/cidades?search=${e}`);
90
+ }
91
+ subscriber(e) {
92
+ return this.listeners.add(e), () => this.listeners.delete(e);
93
+ }
94
+ notify() {
95
+ this.listeners.forEach((e) => e());
96
+ }
97
+ }, W = (e, t) => {
98
+ let n = t?.modelo || "mes", r = e ?? 0;
99
+ return {
100
+ mes: {
101
+ 0: "mês",
102
+ 1: "tri",
103
+ 2: "sem",
104
+ 3: "ano"
105
+ },
106
+ mensais: {
107
+ 0: "mensais",
108
+ 1: "trimestrais",
109
+ 2: "semestrais",
110
+ 3: "anuais"
111
+ },
112
+ mensalidade: {
113
+ 0: "mensalidade",
114
+ 1: "trimestralidade",
115
+ 2: "semestralidade",
116
+ 3: "anualidade"
117
+ }
118
+ }[n][r];
119
+ };
120
+ //#endregion
121
+ //#region src/components/meuPlanoInfo/components/skeleton.tsx
122
+ function $e() {
123
+ return /* @__PURE__ */ D(d, {
124
+ elevation: 1,
125
+ sx: { padding: "1.5rem" },
126
+ children: /* @__PURE__ */ O(T, {
127
+ container: !0,
128
+ spacing: 1,
129
+ sx: { justifyContent: "center" },
130
+ children: [
131
+ /* @__PURE__ */ D(T, {
132
+ size: 12,
133
+ children: /* @__PURE__ */ D(f, {
134
+ height: "1.3rem",
135
+ style: { transform: "none" }
136
+ })
137
+ }),
138
+ /* @__PURE__ */ D(T, {
139
+ size: 12,
140
+ sx: { marginTop: "0.5rem" },
141
+ children: /* @__PURE__ */ D(f, {
142
+ height: "3.5rem",
143
+ style: { transform: "none" }
144
+ })
145
+ }),
146
+ /* @__PURE__ */ O(T, {
147
+ size: 12,
148
+ sx: { marginY: "1rem" },
149
+ children: [
150
+ /* @__PURE__ */ D(f, {
151
+ height: "0.8rem",
152
+ sx: { transform: "none" }
153
+ }),
154
+ /* @__PURE__ */ D(f, {
155
+ height: "0.8rem",
156
+ sx: {
157
+ transform: "none",
158
+ marginY: "0.5rem"
159
+ }
160
+ }),
161
+ /* @__PURE__ */ D(f, {
162
+ height: "0.8rem",
163
+ sx: { transform: "none" }
164
+ })
165
+ ]
166
+ }),
167
+ /* @__PURE__ */ D(T, {
168
+ size: 6,
169
+ children: /* @__PURE__ */ D(f, {
170
+ height: "2rem",
171
+ style: { transform: "none" }
172
+ })
173
+ }),
174
+ /* @__PURE__ */ D(T, {
175
+ size: 6,
176
+ children: /* @__PURE__ */ D(f, {
177
+ height: "2rem",
178
+ style: { transform: "none" }
179
+ })
180
+ })
181
+ ]
182
+ })
183
+ });
184
+ }
185
+ //#endregion
186
+ //#region src/api/queries.ts
187
+ var G = {
188
+ all: ["minha-conta"],
189
+ buscarMeusDados() {
190
+ return [...this.all, "meus-dados"];
191
+ },
192
+ buscarMeuPlanoRecursos() {
193
+ return [...this.all, "meu-plano"];
194
+ },
195
+ buscarPlano(e) {
196
+ return [
197
+ ...this.all,
198
+ "plano",
199
+ e
200
+ ];
201
+ },
202
+ listarCobrancas() {
203
+ return [...this.buscarMeuPlanoRecursos(), "cobrancas"];
204
+ },
205
+ buscarBoleto(e) {
206
+ return [
207
+ ...this.listarCobrancas(),
208
+ "boleto",
209
+ e
210
+ ];
211
+ },
212
+ buscarNfse(e) {
213
+ return [
214
+ ...this.listarCobrancas(),
215
+ "Nfse",
216
+ e
217
+ ];
218
+ },
219
+ listarPlanosEGrupos(e) {
220
+ return [
221
+ ...this.all,
222
+ "listar-planos-e-grupos",
223
+ e
224
+ ];
225
+ },
226
+ buscarRntrc(e) {
227
+ return [
228
+ ...this.all,
229
+ "buscar-rntrc",
230
+ e
231
+ ];
232
+ },
233
+ buscarCep(e) {
234
+ return [
235
+ ...this.all,
236
+ "buscar-cep",
237
+ e
238
+ ];
239
+ },
240
+ pesquisarCidades(e) {
241
+ return [
242
+ ...this.all,
243
+ "pesquisar-cidades",
244
+ e
245
+ ];
246
+ }
247
+ }, et = (e) => ({
248
+ buscarMeusDados: () => A({
249
+ queryKey: G.buscarMeusDados(),
250
+ queryFn: () => e.buscarMeusDados()
251
+ }),
252
+ buscarMeuPlanoRecursos: () => A({
253
+ queryKey: G.buscarMeuPlanoRecursos(),
254
+ queryFn: () => e.buscarMeuPlanoRecursos()
255
+ }),
256
+ buscarPlano: (t) => A({
257
+ queryKey: G.buscarPlano(t),
258
+ queryFn: () => e.buscarPlano(t)
259
+ }),
260
+ listarCobrancas: () => A({
261
+ queryKey: G.listarCobrancas(),
262
+ queryFn: () => e.listarCobrancas()
263
+ }),
264
+ buscarBoleto: (t) => A({
265
+ queryKey: G.buscarBoleto(t),
266
+ queryFn: () => e.buscarBoleto(t)
267
+ }),
268
+ buscarNfse: (t) => A({
269
+ queryKey: G.buscarNfse(t),
270
+ queryFn: () => e.buscarNfse(t)
271
+ }),
272
+ listarPlanosEGrupos: (t) => A({
273
+ queryKey: G.listarPlanosEGrupos(t),
274
+ queryFn: () => e.listarPlanosEGrupos(t)
275
+ }),
276
+ buscarRntrc: (t) => A({
277
+ queryKey: G.buscarRntrc(t),
278
+ queryFn: () => e.buscarRntrc(t)
279
+ }),
280
+ buscarCep: (t) => A({
281
+ queryKey: G.buscarCep(t),
282
+ queryFn: () => e.buscarCep(t)
283
+ }),
284
+ pesquisarCidades: (t) => A({
285
+ queryKey: G.pesquisarCidades(t),
286
+ queryFn: () => e.pesquisarCidades(t)
287
+ })
288
+ }), tt = (e) => ({
289
+ atualizarMeusDados: () => k({ mutationFn: (t) => e.atualizarMeusDados(t) }),
290
+ contratarRecurso: () => k({ mutationFn: (t) => e.contratarRecurso(t) }),
291
+ descontratarRecurso: () => k({ mutationFn: (t) => e.descontratarRecurso(t) }),
292
+ contratarPlano: () => k({ mutationFn: (t) => e.contratarPlano(t) }),
293
+ atualizarEmailCobrancas: () => k({ mutationFn: (t) => e.atualizarEmailCobranca(t) })
294
+ });
295
+ //#endregion
296
+ //#region src/components/loading/loading.tsx
297
+ function nt({ show: e }) {
298
+ return /* @__PURE__ */ D(r, {
299
+ open: e,
300
+ style: { zIndex: 1e4 },
301
+ children: /* @__PURE__ */ D(s, {
302
+ size: 50,
303
+ sx: { color: (e) => e.palette.primary.main }
304
+ })
305
+ });
306
+ }
307
+ //#endregion
308
+ //#region src/hooks/useToken.ts
309
+ var rt = (e) => ye((t) => e.subscriber(t), () => e.token), it = { loading: !1 }, K = xe((e) => ({
310
+ ...it,
311
+ setLoading: (t) => e({ loading: t }),
312
+ resetState: () => e(it)
313
+ })), at = {
314
+ tabAtiva: "minhaEmpresa",
315
+ sistemaNome: "",
316
+ telefoneSuporte: "",
317
+ telefoneCS: "",
318
+ minhaEmpresa: {},
319
+ meuPlano: {},
320
+ recursosDialog: {},
321
+ planosDialog: {}
322
+ }, ot = (e) => Se()((t) => ({
323
+ ...at,
324
+ ...e,
325
+ setTabAtiva: (e) => t({ tabAtiva: e })
326
+ })), st = me(null), ct = (e) => {
327
+ try {
328
+ return be(e);
329
+ } catch {
330
+ return;
331
+ }
332
+ };
333
+ function lt(e) {
334
+ let t = K((e) => e.loading), n = rt(e.api), r = N(), [i] = I(() => Se(() => e.slotProps ?? {})), [a] = I(() => ot({
335
+ ...e,
336
+ usuario: ct(n)
337
+ })), [o] = I(() => ({
338
+ ...et(e.api),
339
+ ...tt(e.api)
340
+ })), s = P(() => {
341
+ a.setState({ usuario: ct(e.api.token) }), r.resetQueries();
342
+ }, [
343
+ e.api.token,
344
+ r.resetQueries,
345
+ a.setState
346
+ ]);
347
+ _e(() => {
348
+ e.api.subscriber(s);
349
+ }, [e.api.subscriber, s]);
350
+ let c = F(() => ({
351
+ storeMinhaConta: a,
352
+ storeSlotProps: i,
353
+ api: o
354
+ }), [
355
+ o,
356
+ a,
357
+ i
358
+ ]);
359
+ return /* @__PURE__ */ O(st.Provider, {
360
+ value: c,
361
+ children: [e.children, /* @__PURE__ */ D(nt, { show: t })]
362
+ });
363
+ }
364
+ function q(e) {
365
+ let t = ge(st);
366
+ if (t === null) throw Error("useMinhaContaStore deve ser utilizado dentro de um MinhaContaProvider");
367
+ return Ce(t.storeMinhaConta, e);
368
+ }
369
+ function ut(e) {
370
+ let t = ge(st);
371
+ if (t === null) throw Error("useSlotProps deve ser utilizado dentro de um MinhaContaProvider");
372
+ return Ce(t.storeSlotProps, e);
373
+ }
374
+ function J() {
375
+ let e = ge(st);
376
+ if (e === null) throw Error("useApi deve ser utilizado dentro de um MinhaContaProvider");
377
+ return e.api;
378
+ }
379
+ //#endregion
380
+ //#region src/components/meuPlanoInfo/components/buttonPlanos.tsx
381
+ function dt(e) {
382
+ return /* @__PURE__ */ D(i, {
383
+ ...e,
384
+ children: "Ver planos"
385
+ });
386
+ }
387
+ function ft(e) {
388
+ return /* @__PURE__ */ D(i, {
389
+ ...e,
390
+ children: "Loja de recursos"
391
+ });
392
+ }
393
+ //#endregion
394
+ //#region src/components/meuPlanoInfo/components/detalhes.tsx
395
+ function pt({ recurso: e }) {
396
+ return /* @__PURE__ */ O("div", {
397
+ style: {
398
+ display: "flex",
399
+ justifyContent: "space-between",
400
+ marginTop: "0.2rem"
401
+ },
402
+ children: [/* @__PURE__ */ D(g, {
403
+ variant: "bodySM",
404
+ color: L.neutral[100],
405
+ children: e.nomeRecurso
406
+ }), /* @__PURE__ */ D(g, {
407
+ variant: "titleXS",
408
+ color: L.neutral[100],
409
+ children: C.format(e.valorRecurso ?? 0)
410
+ })]
411
+ }, e.codigoRecurso);
412
+ }
413
+ function mt({ meuPlano: e }) {
414
+ return /* @__PURE__ */ O("div", {
415
+ style: {
416
+ display: "flex",
417
+ justifyContent: "space-between",
418
+ marginTop: "0.2rem"
419
+ },
420
+ children: [/* @__PURE__ */ D(g, {
421
+ variant: "bodySM",
422
+ color: L.neutral[100],
423
+ children: e?.nomePlano
424
+ }), /* @__PURE__ */ D(g, {
425
+ variant: "titleXS",
426
+ color: L.neutral[100],
427
+ children: C.format(e?.valor ?? 0)
428
+ })]
429
+ });
430
+ }
431
+ //#endregion
432
+ //#region src/components/meuPlanoInfo/meuPlanoInfo.static.ts
433
+ var ht = {
434
+ DetalhesItemRecurso: pt,
435
+ DetalhesItemPlano: mt,
436
+ ButtonPlanos: dt,
437
+ ButtonLojaRecursos: ft
438
+ };
439
+ //#endregion
440
+ //#region src/components/meuPlanoInfo/useMeuPlanoInfo.ts
441
+ function gt(e) {
442
+ let t = J(), n = M(t.buscarMeuPlanoRecursos()), r = M({
443
+ ...t.listarCobrancas(),
444
+ select(e) {
445
+ return e.data.data.some((e) => e.situacao === "EMITIDO");
446
+ }
447
+ }), i = F(() => ({
448
+ ...ht,
449
+ ...e.slots
450
+ }), [e.slots]), a = n.data?.data.data, o = !!r.data, s = ue("(max-width: 400px)");
451
+ return {
452
+ meuPlanoQuery: n,
453
+ meuPlano: a,
454
+ cobrancaEmitida: o,
455
+ valorTotalPlano: F(() => (a?.valor ?? 0) + (a?.recursos?.filter((e) => e.recursoContratado).reduce((e, t) => e + t.valorRecurso, 0) ?? 0), [a?.valor, a?.recursos]),
456
+ recursosContratados: a?.recursos?.filter((e) => e.recursoContratado).sort((e, t) => e.valorRecurso - t.valorRecurso),
457
+ slots: i,
458
+ maxWidth400: s
459
+ };
460
+ }
461
+ //#endregion
462
+ //#region src/components/meuPlanoInfo/meuPlanoInfo.tsx
463
+ function _t(e) {
464
+ let { cobrancaEmitida: t, maxWidth400: n, meuPlanoQuery: r, meuPlano: i, recursosContratados: o, slots: s, valorTotalPlano: c } = gt(e);
465
+ return r.isFetching ? /* @__PURE__ */ D($e, {}) : /* @__PURE__ */ D(E, { children: /* @__PURE__ */ D(a, {
466
+ elevation: 2,
467
+ sx: { padding: "1rem" },
468
+ children: /* @__PURE__ */ O(l, {
469
+ container: !0,
470
+ children: [
471
+ /* @__PURE__ */ D(l, {
472
+ size: 12,
473
+ sx: { textAlign: "center" },
474
+ children: /* @__PURE__ */ D(g, {
475
+ variant: "titleSM",
476
+ children: i?.recursos ? "Valor Total" : "Valor do plano"
477
+ })
478
+ }),
479
+ /* @__PURE__ */ O(l, {
480
+ size: 12,
481
+ sx: {
482
+ display: "flex",
483
+ justifyContent: "center",
484
+ alignItems: "end"
485
+ },
486
+ children: [
487
+ /* @__PURE__ */ D(g, {
488
+ variant: "titleXXS",
489
+ sx: { alignSelf: "center" },
490
+ children: "R$"
491
+ }),
492
+ /* @__PURE__ */ D(g, {
493
+ variant: "titleXL",
494
+ style: { fontSize: "3rem" },
495
+ children: ee.format(c)
496
+ }),
497
+ /* @__PURE__ */ O(g, {
498
+ variant: "titleMD",
499
+ sx: { marginBottom: "0.3rem" },
500
+ children: ["/", W(i?.periodicidade ?? null)]
501
+ })
502
+ ]
503
+ }),
504
+ /* @__PURE__ */ O(l, {
505
+ size: 12,
506
+ sx: { marginTop: "2rem" },
507
+ children: [/* @__PURE__ */ D(s.DetalhesItemPlano, { meuPlano: i }), o?.map((e) => /* @__PURE__ */ D(s.DetalhesItemRecurso, { recurso: e }, e.codigoRecurso))]
508
+ }),
509
+ /* @__PURE__ */ O(l, {
510
+ size: 12,
511
+ sx: {
512
+ display: "flex",
513
+ flexDirection: n ? "column" : "row",
514
+ justifyContent: "space-between",
515
+ gap: "0.5rem",
516
+ marginTop: "2rem"
517
+ },
518
+ children: [e.exibirPlanos && /* @__PURE__ */ D(s.ButtonPlanos, {
519
+ variant: t ? "neutral" : "contained",
520
+ startIcon: /* @__PURE__ */ D(S, {
521
+ icon: oe,
522
+ removeMargin: !0
523
+ }),
524
+ fullWidth: n || !e.exibirLojaRecursos,
525
+ onClick: e.onClickButtonPlanos
526
+ }), e.exibirLojaRecursos && /* @__PURE__ */ D(s.ButtonLojaRecursos, {
527
+ variant: t ? "neutral" : "outlined",
528
+ disabled: !i?.recursos,
529
+ startIcon: /* @__PURE__ */ D(S, {
530
+ icon: ae,
531
+ removeMargin: !0
532
+ }),
533
+ fullWidth: n || !e.exibirPlanos,
534
+ onClick: e.onClickButtonLojaRecursos
535
+ })]
536
+ })
537
+ ]
538
+ })
539
+ }) });
540
+ }
541
+ //#endregion
542
+ //#region src/utils/parseError.ts
543
+ var vt = (e) => {
544
+ let t = [];
545
+ return typeof e == "object" && (Array.isArray(e) && typeof e[0] == "string" ? t = e : Array.isArray(e.errors) ? t = e.errors : typeof e.errors == "string" ? t = [e.errors] : typeof e.error == "string" ? t = [e.error] : typeof e.erro == "string" ? t = [e.erro] : e.erro?.mensagem ? t = [e.erro.mensagem] : typeof e.message == "string" ? t = [e.message] : typeof e.mensagem == "string" ? t = [e.mensagem] : typeof e.authErrors?.[0] == "string" && (t = e.authErrors)), t;
546
+ }, yt = me(null), Y = ({ onNotification: e, children: t }) => /* @__PURE__ */ D(yt.Provider, {
547
+ value: {
548
+ setNotification: e,
549
+ handleErrors: (t) => {
550
+ let n = vt(t);
551
+ console.error(t), e({
552
+ variant: "error",
553
+ title: n[0]
554
+ });
555
+ }
556
+ },
557
+ children: t
558
+ }), X = () => {
559
+ let e = ge(yt);
560
+ if (e === null) throw Error("Hook `useMinhaContaContext` must be used inside a MinhaContaProvider");
561
+ return e;
562
+ }, Z = (e) => {
563
+ let [t, n] = I(!0);
564
+ return {
565
+ open: t,
566
+ onCloseDialog: () => {
567
+ n(!1), setTimeout(() => e(), 100);
568
+ }
569
+ };
570
+ }, Q = (e) => {
571
+ let t = `https://api.whatsapp.com/send?phone=${e}`;
572
+ window.open(t, "_blank", "noopener noreferrer");
573
+ }, bt = v(l)`
574
+ display: flex;
575
+ justify-content: end;
576
+ margin-bottom: 1.5rem;
577
+ margin-right: 0.5rem;
578
+ `, xt = v(l)`
579
+ @media (min-height: 800px) {
580
+ max-height: 50vh;
581
+ overflow-y: auto;
582
+ }
583
+
584
+ @media (max-width: 960px) {
585
+ max-height: fit-content;
586
+ }
587
+ `, St = v(l)`
588
+ display: flex;
589
+ justify-content: space-between;
590
+ align-items: center;
591
+ border: 1px solid #eeeeee;
592
+ border-radius: 8px;
593
+ padding: 1rem 0 1rem 1rem;
594
+ margin-bottom: 1rem;
595
+
596
+ @media ((min-height: 800px) or (max-width: 960px)) {
597
+ margin-right: 0.5rem;
598
+ }
599
+ `;
600
+ //#endregion
601
+ //#region src/components/planosDialog/contratarRecursos/listaRecursos/listaRecursos.tsx
602
+ function Ct() {
603
+ let { getValues: e } = z(), t = e("planoSelecionado.recursos")?.filter((e) => !!e.valorRecurso);
604
+ return t?.length ? /* @__PURE__ */ O(l, {
605
+ container: !0,
606
+ children: [/* @__PURE__ */ D(bt, {
607
+ size: 12,
608
+ children: /* @__PURE__ */ D(g, {
609
+ variant: "titleSM",
610
+ children: "Confira os recursos em seu novo plano"
611
+ })
612
+ }), /* @__PURE__ */ D(xt, {
613
+ size: 12,
614
+ children: t.map((e) => /* @__PURE__ */ O(St, {
615
+ size: 12,
616
+ children: [/* @__PURE__ */ O(g, {
617
+ variant: "titleXS",
618
+ children: [
619
+ e.nomeRecurso,
620
+ " (",
621
+ C.format(e.valorRecurso),
622
+ ")"
623
+ ]
624
+ }), /* @__PURE__ */ D(Oe, {
625
+ name: `recursosSelecionados.${e.slugRecurso}`,
626
+ label: /* @__PURE__ */ D(g, {
627
+ variant: "titleXXS",
628
+ children: "Adicionar"
629
+ })
630
+ })]
631
+ }, e.codigoRecurso))
632
+ })]
633
+ }) : null;
634
+ }
635
+ //#endregion
636
+ //#region src/components/planosDialog/contratarRecursos/confirmacaoDialog/useConfirmacaoDialog.ts
637
+ var wt = () => {
638
+ let e = J(), t = M(e.buscarMeuPlanoRecursos()).data?.data.data, n = t?.valor, r = t?.tipoCobranca, i = t?.periodicidade, a = t?.nomePlano, o = P(() => (t?.valor ?? 0) + (t?.recursos?.filter((e) => e.recursoContratado).reduce((e, t) => e + t.valorRecurso, 0) ?? 0), [t?.recursos?.filter, t?.valor]), s = q((e) => e.planosDialog.imagensAlterarPlano), { getValues: c } = z(), l = c("planoSelecionado"), u = c("recursosSelecionados"), d = F(() => {
639
+ let e = [];
640
+ l?.recursos && u && Object.entries(u).forEach(([t, n]) => {
641
+ if (n) {
642
+ let n = l.recursos.find((e) => e.slugRecurso === t);
643
+ n && e.push(n);
644
+ }
645
+ });
646
+ let t = l?.valorPeriodicoPromocional || l?.valorPeriodico || 0;
647
+ return e.reduce((e, t) => e + t.valorRecurso, t);
648
+ }, [l, u]), f = F(() => l?.periodicidade === i ? d > o() ? {
649
+ title: "Melhorar",
650
+ buttonLabel: "Confirmar alteração de plano",
651
+ img: s?.melhorar
652
+ } : {
653
+ title: "Diminuir",
654
+ buttonLabel: "Confirmar alteração de plano",
655
+ img: s?.diminuir
656
+ } : {
657
+ title: "Contratar",
658
+ buttonLabel: "Confirmar contratação de plano",
659
+ img: s?.contratar
660
+ }, [
661
+ d,
662
+ s,
663
+ o,
664
+ l,
665
+ i
666
+ ]);
667
+ return {
668
+ valorTotal: d,
669
+ mudouTipoCobranca: F(() => {
670
+ let e = l?.valorPeriodicoPromocional || l?.valorPeriodico;
671
+ return n && e && r && l.tipoDeCobranca && r !== l.tipoDeCobranca ? {
672
+ de: r === 2 ? "pós-pago" : "pré-pago",
673
+ para: l.tipoDeCobranca === 2 ? "pós-pago" : "pré-pago"
674
+ } : null;
675
+ }, [
676
+ n,
677
+ r,
678
+ l
679
+ ]),
680
+ dynamicText: f,
681
+ nomePlanoPlanoAtual: a,
682
+ planoSelecionado: l
683
+ };
684
+ };
685
+ //#endregion
686
+ //#region src/components/planosDialog/contratarRecursos/confirmacaoDialog/confirmacaoDialog.tsx
687
+ function Tt({ onClose: e }) {
688
+ let { mudouTipoCobranca: t, dynamicText: n, valorTotal: r, nomePlanoPlanoAtual: a, planoSelecionado: o } = wt(), { open: s, onCloseDialog: c } = Z(e);
689
+ return /* @__PURE__ */ O(b, {
690
+ open: s,
691
+ onClose: c,
692
+ maxWidth: "xs",
693
+ fullWidth: !0,
694
+ closeIcon: !0,
695
+ disablePortal: !0,
696
+ children: [
697
+ /* @__PURE__ */ O(b.Header, { children: [n.title, " plano"] }),
698
+ /* @__PURE__ */ D(b.Content, { children: /* @__PURE__ */ O(l, {
699
+ container: !0,
700
+ spacing: 2,
701
+ children: [/* @__PURE__ */ D(l, {
702
+ size: 12,
703
+ sx: { display: "flex" },
704
+ children: /* @__PURE__ */ O(g, {
705
+ variant: "bodySM",
706
+ children: [
707
+ t ? /* @__PURE__ */ O(E, { children: [
708
+ "Você está alterando seu plano ",
709
+ /* @__PURE__ */ D("strong", { children: a }),
710
+ " para uma nova modalidade:",
711
+ " ",
712
+ /* @__PURE__ */ D("strong", {
713
+ style: { textTransform: "capitalize" },
714
+ children: t.para
715
+ })
716
+ ] }) : /* @__PURE__ */ O(E, { children: [
717
+ "Você está alterando seu plano para ",
718
+ /* @__PURE__ */ D("strong", { children: o?.nome }),
719
+ ". O boleto será enviado por email em até 2 dias úteis."
720
+ ] }),
721
+ /* @__PURE__ */ D("br", {}),
722
+ /* @__PURE__ */ D("br", {}),
723
+ t && /* @__PURE__ */ O(E, { children: [
724
+ "A forma de pagamento será alterada de ",
725
+ t.de,
726
+ " para",
727
+ " ",
728
+ t.para,
729
+ ". O ",
730
+ /* @__PURE__ */ D("strong", { children: "boleto será enviado por email" }),
731
+ " em até 2 dias úteis, com data de vencimento de até 5 dias.",
732
+ /* @__PURE__ */ D("br", {})
733
+ ] }),
734
+ "Ao confirmar sua nova escolha, sua fatura será alterada para",
735
+ " ",
736
+ /* @__PURE__ */ O("strong", { children: [
737
+ C.format(r),
738
+ " ",
739
+ W(o?.periodicidade ?? 0, { modelo: "mensais" })
740
+ ] }),
741
+ "."
742
+ ]
743
+ })
744
+ }), /* @__PURE__ */ D(l, {
745
+ size: 12,
746
+ sx: {
747
+ display: "flex",
748
+ alignItems: "center",
749
+ justifyContent: "center"
750
+ },
751
+ children: !!n.img && /* @__PURE__ */ D("img", {
752
+ src: n.img,
753
+ alt: n.title
754
+ })
755
+ })]
756
+ }) }),
757
+ /* @__PURE__ */ O(b.Footer, { children: [/* @__PURE__ */ D(i, {
758
+ variant: "neutral",
759
+ onClick: c,
760
+ children: "Cancelar"
761
+ }), /* @__PURE__ */ D(i, {
762
+ type: "submit",
763
+ onClick: c,
764
+ children: n.buttonLabel
765
+ })] })
766
+ ]
767
+ });
768
+ }
769
+ //#endregion
770
+ //#region src/components/planosDialog/contratarRecursos/planoShowcase/planoShowcase.styles.ts
771
+ var Et = v(l)`
772
+ width: 90%;
773
+ border-radius: 16px;
774
+ padding: 1.5rem;
775
+ margin: 0.5rem 0;
776
+ box-shadow: 0px 3px 12px rgba(0, 0, 0, 0.12);
777
+
778
+ @media ((min-width: 960px) and (max-height: 800px)) {
779
+ position: sticky;
780
+ top: 0;
781
+ }
782
+
783
+ @media (max-width: 500px) {
784
+ width: 100%;
785
+ padding: 1rem;
786
+ margin: 0.5rem;
787
+ }
788
+ `, Dt = v(l)`
789
+ display: flex;
790
+ justify-content: center;
791
+ margin-bottom: 0.5rem;
792
+ `, Ot = v("div")`
793
+ display: flex;
794
+ justify-content: space-between;
795
+ margin-bottom: 0.3rem;
796
+ `, kt = () => {
797
+ let { watch: e, getValues: t } = z(), n = t("planoSelecionado"), r = e("recursosSelecionados"), i = () => {
798
+ let e = [];
799
+ return n.recursos && (e = n.recursos.filter((e) => !e.valorRecurso)), Object.entries(r || {}).forEach(([t, r]) => {
800
+ if (r) {
801
+ let r = n.recursos?.find((e) => e.slugRecurso === t);
802
+ r && e.push(r);
803
+ }
804
+ }), e;
805
+ };
806
+ return {
807
+ getValorTotal: (e) => {
808
+ let t = i(), r = e ? 0 : n.valorPeriodicoPromocional || n.valorPeriodico;
809
+ return t.reduce((e, t) => e + t.valorRecurso, r);
810
+ },
811
+ getRecursos: i,
812
+ planoSelecionado: n
813
+ };
814
+ };
815
+ //#endregion
816
+ //#region src/components/planosDialog/contratarRecursos/planoShowcase/planoShowcase.tsx
817
+ function At() {
818
+ let [e, t] = I(!1), { planoSelecionado: n, getRecursos: r, getValorTotal: a } = kt();
819
+ return /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ O(Et, {
820
+ container: !0,
821
+ children: [
822
+ /* @__PURE__ */ D(Dt, {
823
+ size: 12,
824
+ style: { marginBottom: "1.5rem" },
825
+ children: /* @__PURE__ */ D(g, {
826
+ variant: "titleMD",
827
+ align: "center",
828
+ children: n.nome
829
+ })
830
+ }),
831
+ /* @__PURE__ */ D(Dt, {
832
+ size: 12,
833
+ children: /* @__PURE__ */ D(g, {
834
+ variant: "titleSM",
835
+ children: "Valor do plano"
836
+ })
837
+ }),
838
+ /* @__PURE__ */ O(Dt, {
839
+ size: 12,
840
+ children: [
841
+ /* @__PURE__ */ D(g, {
842
+ variant: "bodyLG",
843
+ style: { alignSelf: "center" },
844
+ children: "R$"
845
+ }),
846
+ /* @__PURE__ */ D(g, {
847
+ variant: "titleXXL",
848
+ children: Number(a().toFixed(2))
849
+ }),
850
+ /* @__PURE__ */ O(g, {
851
+ variant: "bodyLG",
852
+ style: { alignSelf: "end" },
853
+ children: ["/", W(n.periodicidade)]
854
+ })
855
+ ]
856
+ }),
857
+ /* @__PURE__ */ D(l, {
858
+ size: 12,
859
+ style: { marginBottom: "1rem" },
860
+ children: /* @__PURE__ */ D(i, {
861
+ size: "large",
862
+ fullWidth: !0,
863
+ onClick: () => t(!0),
864
+ children: "Contratar agora"
865
+ })
866
+ }),
867
+ /* @__PURE__ */ O(l, {
868
+ size: 12,
869
+ children: [
870
+ /* @__PURE__ */ O(Ot, { children: [/* @__PURE__ */ D(g, {
871
+ variant: "bodyMD",
872
+ children: n.nome
873
+ }), /* @__PURE__ */ D(g, {
874
+ variant: "bodyMD",
875
+ children: C.format(n.valorPeriodicoPromocional || n.valorPeriodico)
876
+ })] }),
877
+ /* @__PURE__ */ O(Ot, { children: [/* @__PURE__ */ D(g, {
878
+ variant: "bodySM",
879
+ children: "Subtotal recursos"
880
+ }), /* @__PURE__ */ D(g, {
881
+ variant: "bodySM",
882
+ children: C.format(a(!0))
883
+ })] }),
884
+ r().map((e) => /* @__PURE__ */ O(Ot, { children: [/* @__PURE__ */ D(g, {
885
+ variant: "bodySM",
886
+ children: e.nomeRecurso
887
+ }), /* @__PURE__ */ D(g, {
888
+ variant: "bodySM",
889
+ children: C.format(e.valorRecurso)
890
+ })] }, e.codigoRecurso))
891
+ ]
892
+ })
893
+ ]
894
+ }), e && /* @__PURE__ */ D(Tt, { onClose: () => t(!1) })] });
895
+ }
896
+ //#endregion
897
+ //#region src/components/planosDialog/contratarRecursos/contratarRecursos.tsx
898
+ function jt() {
899
+ return /* @__PURE__ */ O(l, {
900
+ container: !0,
901
+ spacing: 2,
902
+ children: [/* @__PURE__ */ D(l, {
903
+ size: {
904
+ xs: 12,
905
+ md: 7
906
+ },
907
+ children: /* @__PURE__ */ D(Ct, {})
908
+ }), /* @__PURE__ */ D(l, {
909
+ size: {
910
+ xs: 12,
911
+ md: 5
912
+ },
913
+ sx: {
914
+ display: "flex",
915
+ justifyContent: "center",
916
+ alignItems: "start"
917
+ },
918
+ children: /* @__PURE__ */ D(At, {})
919
+ })]
920
+ });
921
+ }
922
+ //#endregion
923
+ //#region src/components/planosDialog/emptyState/emptyState.tsx
924
+ function Mt() {
925
+ let e = q((e) => e.planosDialog.emptyStateImg);
926
+ return /* @__PURE__ */ O(l, {
927
+ container: !0,
928
+ spacing: 2,
929
+ sx: {
930
+ padding: "1rem 0",
931
+ direction: "column",
932
+ alignItems: "center"
933
+ },
934
+ children: [
935
+ !!e && /* @__PURE__ */ D(l, {
936
+ size: 12,
937
+ children: /* @__PURE__ */ D("img", {
938
+ src: e,
939
+ alt: "emptyStateImg"
940
+ })
941
+ }),
942
+ /* @__PURE__ */ D(l, {
943
+ size: 12,
944
+ sx: { textAlign: "center" },
945
+ children: /* @__PURE__ */ D(g, {
946
+ variant: "titleMD",
947
+ children: "Você precisa de um plano especial"
948
+ })
949
+ }),
950
+ /* @__PURE__ */ D(l, {
951
+ size: 12,
952
+ sx: { textAlign: "center" },
953
+ children: /* @__PURE__ */ D(g, {
954
+ variant: "bodyMD",
955
+ children: "Para trocar de plano solicite ajuda da nossa equipe no botão abaixo."
956
+ })
957
+ })
958
+ ]
959
+ });
960
+ }
961
+ //#endregion
962
+ //#region src/components/planosDialog/listagemPlanos/listagemPlanos.styles.ts
963
+ var Nt = v("div")`
2
964
  display: flex;
3
965
  align-items: center;
4
966
  border-radius: 4px;
5
967
  cursor: pointer;
6
968
 
7
969
  :hover {
8
- background-color: ${Si.neutral[30]};
970
+ background-color: ${L.neutral[30]};
9
971
  }
10
972
 
11
973
  @media (max-width: 450px) {
@@ -15,9 +977,9 @@ import Mr from"axios";var Le=class{axiosSistema;axiosControle;listeners=new Set;
15
977
  background-color: #fff;
16
978
  border-radius: 50%;
17
979
 
18
- ${({side:o})=>`${o}: 0;`}
980
+ ${({ side: e }) => `${e}: 0;`}
19
981
  }
20
- `;import{Button as Ri,LIcon as ta}from"@s_mart/core";import{Tooltip as Mi,Typography as uo}from"@mui/material";import{colorPalette as Oe}from"@s_mart/tokens";import{lineStar as Ai}from"@s_mart/solid-icons";import{lineCheckCircle as Ti,lineWhatsApp as Ii}from"@s_mart/regular-icons";import{styled as $e}from"@mui/material";import{colorPalette as Di}from"@s_mart/tokens";var ea=$e("div")`
982
+ `, Pt = v("div")`
21
983
  display: flex;
22
984
  min-width: calc(100% / 3);
23
985
  max-width: calc(100% / 3); // Precisa ter o min e max, por algum krl o width não funciona
@@ -31,7 +993,7 @@ import Mr from"axios";var Le=class{axiosSistema;axiosControle;listeners=new Set;
31
993
  min-width: 100%;
32
994
  max-width: 100%;
33
995
  }
34
- `,ra=$e("div")`
996
+ `, Ft = v("div")`
35
997
  position: relative;
36
998
  display: flex;
37
999
  flex-direction: column;
@@ -41,9 +1003,9 @@ import Mr from"axios";var Le=class{axiosSistema;axiosControle;listeners=new Set;
41
1003
  border-radius: 4px;
42
1004
  padding: 2rem 1.5rem 1.5rem;
43
1005
  margin: 0.8rem;
44
- border: ${({destaque:o,theme:e})=>o?`2px solid ${e.palette.primary.main}`:void 0};
45
- background-color: ${({disabled:o})=>o?Di.neutral[30]:void 0};
46
- opacity: ${({disabled:o})=>o?.6:void 0};
1006
+ border: ${({ destaque: e, theme: t }) => e ? `2px solid ${t.palette.primary.main}` : void 0};
1007
+ background-color: ${({ disabled: e }) => e ? L.neutral[30] : void 0};
1008
+ opacity: ${({ disabled: e }) => e ? .6 : void 0};
47
1009
 
48
1010
  @media (max-width: 1050px) {
49
1011
  margin: 0.5rem;
@@ -52,64 +1014,599 @@ import Mr from"axios";var Le=class{axiosSistema;axiosControle;listeners=new Set;
52
1014
  @media (max-width: 400px) {
53
1015
  padding: 1rem;
54
1016
  }
55
- `,aa=$e("div")`
1017
+ `, It = v("div")`
56
1018
  display: flex;
57
1019
  flex-direction: column;
58
1020
  justify-content: space-between;
59
1021
  align-items: center;
60
1022
  min-height: 7rem;
61
- `;import{Fragment as na,jsx as T,jsxs as vo}from"react/jsx-runtime";function ia({plano:o,id:e,reduceFont:r,onContratar:a,periodicidadePlanoAtual:n}){let t=g(u=>u.planosDialog.esconderValorPlanos),i=g(u=>u.planosDialog.habilitarPlanoAtual),s=g(u=>u.telefoneCS),m=g(u=>u.telefoneSuporte),d=o.planoAtual&&!i,c=()=>d?"Seu plano atual":t?"Quero saber mais":i&&o.planoAtual||o.periodicidade!==n?"Contratar plano":o.valorMensalMenorQueAtual?"Diminuir plano":"Aumentar plano";return T(ea,{id:e,children:T(Ei,{title:o.disabled30Dias?vo(uo,{variant:"bodyXS",children:["A troca para um plano de valor ",T("br",{}),"menor, s\xF3 \xE9 poss\xEDvel ap\xF3s 30 dias ",T("br",{}),"de uso do seu plano atual."]}):"",placement:"right",children:vo(ra,{destaque:!!o.destaque,disabled:d||o.disabled||o.disabled30Dias,children:[!!o.destaque&&T(ta,{icon:Ai,color:Oe.yellow[300],style:{position:"absolute",top:"5px",right:"5px"}}),vo(aa,{children:[T("div",{style:{textAlign:"center"},children:T(uo,{variant:r?"titleMS":"titleMD",children:o.nome})}),!!o.fraseDeEfeito&&T("div",{children:T(uo,{variant:"bodySM",color:Oe.neutral[100],children:o.fraseDeEfeito})}),!t&&vo(na,{children:[!!o.valorPeriodicoPromocional&&T("div",{children:vo(uo,{variant:"bodySM",color:Oe.red[300],style:{textDecorationLine:"line-through",marginRight:"2rem"},children:["R$ ",o.valorPeriodico]})}),vo("div",{style:{display:"flex",justifyContent:"center",alignItems:"end"},children:[T(uo,{variant:"titleXXS",alignSelf:"center",children:"R$"}),T(uo,{variant:r?"titleLG":"titleXL",style:{fontSize:"3rem"},children:o.valorPeriodicoPromocional||o.valorPeriodico}),vo(uo,{variant:r?"titleMS":"titleMD",marginBottom:"0.3rem",children:["/",V(o.periodicidade)]})]})]})]}),T(Ri,{fullWidth:!0,variant:d?"neutral":"contained",disabled:d||o.disabled||o.disabled30Dias,startIcon:(d||t)&&T(ta,{icon:d?Ti:Ii,size:"25px"}),onClick:()=>{t?io(s||m):a(o)},style:{margin:"1.5rem 0"},children:c()}),T("div",{style:{paddingLeft:"1rem"},children:T(uo,{variant:"bodySM",children:T("div",{style:{display:"flex",flexDirection:"column"},dangerouslySetInnerHTML:{__html:o.descricao}})})})]})})})}function Ei(o){return o.title?T(Mi,{...o}):T(na,{children:o.children})}import{useMediaQuery as _e}from"@mui/material";import{useQuery as Gi,useQueryClient as Fi}from"@tanstack/react-query";import sa from"dayjs";import{useCallback as zi,useMemo as je}from"react";import{useFormContext as ki}from"react-hook-form";var wi=({planos:o})=>{let e=S(),a=Gi(e.buscarMeuPlanoRecursos()).data?.data.data,n=Fi(),t=a?.codigoPlano,i=a?.periodicidade??null,s=a?.valor,m=a?.dataContratacao,d=a?.recursos,c=oo(P=>P.setLoading),u=g(P=>P.planosDialog.bloquearDowngrade),f=g(P=>P.planosDialog.bloquearDowngrade30Dias),x=g(P=>P.planosDialog.desabilitarPlanosMenores),p=g(P=>P.planosDialog.mostrarSomentePlanosDaPeriodicidade),h=g(P=>P.planosDialog.mostrarPlanosDeterminados?.codigoPlanoValor),{handleErrors:l}=G(),{watch:y,setValue:v}=ki(),F=_e("(max-width: 900px)"),Q=_e("(max-width: 700px)"),Po=_e("(max-width: 450px)"),bo=y("filtroPeriodicidade"),Eo=!!f&&sa().diff(sa(m),"days")<30,po=je(()=>{let P={previous:0,next:4};return Q?P.next=2:F&&(P.next=3),P},[Q,F]),C=zi((P,z)=>{switch(z){case 1:return P/3;case 2:return P/6;case 3:return P/12;default:return P}},[]),L=je(()=>{let P=[];if(!o)return P;if(h&&!p)P=[...o.mensais,...o.trimestrais,...o.semestrais,...o.anuais].filter(_=>h.includes(_.codigoPlanoValor));else if(bo){let _=p||["mensais","trimestrais","semestrais","anuais"][bo.value];P=o[_]}return P.sort((A,_)=>A.valorPeriodico-_.valorPeriodico),P.map(A=>{let _=A.valorPeriodicoPromocional||A.valorPeriodico,Go=C(_,A.periodicidade)<C(s??0,i);return{...A,planoAtual:A.codigo===t&&A.periodicidade===i,valorMensalMenorQueAtual:Go,disabled:(!!u||!!x)&&Go,disabled30Dias:Eo&&Go}})},[o,u,i,Eo,C,s,x,p,t,bo,h]),b=je(()=>Q?L.length>1:F?L.length>2:L.length>3,[Q,F,L]);return{planosFiltrados:L,scrollPlanos:P=>{let z=po[P];if(z===0||z>L.length)return;let A=document.getElementById(`plano-${z}`);A&&(A.scrollIntoView({behavior:"smooth"}),P==="next"?(po.next++,po.previous++):(po.next--,po.previous--))},showScrollControllers:b,maxWidth700:Q,maxWidth450:Po,handleClickContratarPlano:async P=>{try{c(!0);let z=await n.ensureQueryData(e.buscarPlano({params:{periodicidade:P.periodicidade},path:{codigo:P.codigo}}));if(z.data.data){let A={},_=z.data.data.recursos?.filter(ao=>!ao?.valorRecurso)?.map(ao=>ao?.slugRecurso);d?.filter(ao=>ao.recursoContratado)?.forEach(ao=>{z.data.data.recursos.some(_t=>_t.slugRecurso===ao.slugRecurso)&&!_?.includes(ao.slugRecurso)&&(A[ao.slugRecurso]=!0)}),v("recursosSelecionados",A),v("planoSelecionado",{...P,recursos:z.data.data.recursos})}c(!1)}catch(z){l(z)}},periodicidadePlanoAtual:i}},la=wi;import{jsx as zo,jsxs as qi}from"react/jsx-runtime";function ca(o){let{planosFiltrados:e,scrollPlanos:r,showScrollControllers:a,maxWidth700:n,maxWidth450:t,handleClickContratarPlano:i,periodicidadePlanoAtual:s}=la(o);return qi("div",{style:{display:"flex",position:"relative"},children:[a&&zo(We,{side:"left",onClick:()=>r("previous"),children:zo(ma,{icon:Li,size:n?"2rem":"3rem"})}),zo("div",{style:{display:"flex",justifyContent:a?void 0:"center",overflow:"hidden",flex:1},children:e.map((m,d)=>zo(ia,{id:`plano-${d+1}`,plano:m,reduceFont:t,periodicidadePlanoAtual:s??0,onContratar:i},m.codigoPlanoValor))}),a&&zo(We,{side:"right",onClick:()=>r("next"),children:zo(ma,{icon:Bi,size:n?"2rem":"3rem"})})]})}import{Grid as rr}from"@mui/material";import{Grid as Vi,Typography as Xe}from"@mui/material";import{valor as Ni}from"@s_mart/masks";import{Switch as Qi}from"@s_mart/form";import{useFormContext as Wi}from"react-hook-form";import{Grid as He,styled as Ye}from"@mui/material";var pa=Ye(He)`
62
- display: flex;
63
- justify-content: end;
64
- margin-bottom: 1.5rem;
65
- margin-right: 0.5rem;
66
- `,da=Ye(He)`
67
- @media (min-height: 800px) {
68
- max-height: 50vh;
69
- overflow-y: auto;
70
- }
71
-
72
- @media (max-width: 960px) {
73
- max-height: fit-content;
74
- }
75
- `,ua=Ye(He)`
76
- display: flex;
77
- justify-content: space-between;
78
- align-items: center;
79
- border: 1px solid #eeeeee;
80
- border-radius: 8px;
81
- padding: 1rem 0 1rem 1rem;
82
- margin-bottom: 1rem;
83
-
84
- @media ((min-height: 800px) or (max-width: 960px)) {
85
- margin-right: 0.5rem;
86
- }
87
- `;import{jsx as Oo,jsxs as Ue}from"react/jsx-runtime";function fa(){let{getValues:o}=Wi(),r=o("planoSelecionado.recursos").filter(a=>!!a.valorRecurso);return r.length?Ue(Vi,{container:!0,children:[Oo(pa,{size:12,children:Oo(Xe,{variant:"titleSM",children:"Confira os recursos em seu novo plano"})}),Oo(da,{size:12,children:r.map(a=>Ue(ua,{size:12,children:[Ue(Xe,{variant:"titleXS",children:[a.nomeRecurso," (",Ni.format(a.valorRecurso),")"]}),Oo(Qi,{name:`recursosSelecionados.${a.slugRecurso}`,label:Oo(Xe,{variant:"titleXXS",children:"Adicionar"})})]},a.codigoRecurso))})]}):null}import{useState as Ki}from"react";import{Button as Ji}from"@s_mart/core";import{Grid as xa,Typography as Y}from"@mui/material";import{valor as er}from"@s_mart/masks";import{Button as ya,Dialog as ne}from"@s_mart/core";import{Grid as Je,Typography as Hi}from"@mui/material";import{valor as Yi}from"@s_mart/masks";import{useQuery as $i}from"@tanstack/react-query";import{useCallback as Oi,useMemo as Ke}from"react";import{useFormContext as _i}from"react-hook-form";var ji=()=>{let o=S(),r=$i(o.buscarMeuPlanoRecursos()).data?.data.data,a=r?.valor,n=r?.tipoCobranca,t=r?.periodicidade,i=r?.nomePlano,s=Oi(()=>{let h=r?.valor??0,l=r?.recursos?.filter(y=>y.recursoContratado).reduce((y,v)=>y+v.valorRecurso,0)??0;return h+l},[r?.recursos?.filter,r?.valor]),m=g(h=>h.planosDialog.imagensAlterarPlano),{getValues:d}=_i(),c=d("planoSelecionado"),u=d("recursosSelecionados"),f=Ke(()=>{let h=[];c?.recursos&&u&&Object.entries(u).forEach(([v,F])=>{if(F){let Q=c.recursos.find(Po=>Po.slugRecurso===v);Q&&h.push(Q)}});let l=c?.valorPeriodicoPromocional||c?.valorPeriodico||0;return h.reduce((v,F)=>v+F.valorRecurso,l)},[c,u]),x=Ke(()=>c?.periodicidade!==t?{title:"Contratar",buttonLabel:"Confirmar contrata\xE7\xE3o de plano",img:m?.contratar}:f>s()?{title:"Melhorar",buttonLabel:"Confirmar altera\xE7\xE3o de plano",img:m?.melhorar}:{title:"Diminuir",buttonLabel:"Confirmar altera\xE7\xE3o de plano",img:m?.diminuir},[f,m,s,c,t]),p=Ke(()=>{let h=c?.valorPeriodicoPromocional||c?.valorPeriodico;return a&&h&&n&&c.tipoDeCobranca&&n!==c.tipoDeCobranca?{de:n===2?"p\xF3s-pago":"pr\xE9-pago",para:c.tipoDeCobranca===2?"p\xF3s-pago":"pr\xE9-pago"}:null},[a,n,c]);return{valorTotal:f,mudouTipoCobranca:p,dynamicText:x,nomePlanoPlanoAtual:i,planoSelecionado:c}},ga=ji;import{Fragment as Ze,jsx as $,jsxs as no}from"react/jsx-runtime";function ha({onClose:o}){let{mudouTipoCobranca:e,dynamicText:r,valorTotal:a,nomePlanoPlanoAtual:n,planoSelecionado:t}=ga(),{open:i,onCloseDialog:s}=H(o);return no(ne,{open:i,onClose:s,maxWidth:"xs",fullWidth:!0,closeIcon:!0,disablePortal:!0,children:[no(ne.Header,{children:[r.title," plano"]}),$(ne.Content,{children:no(Je,{container:!0,spacing:2,children:[$(Je,{size:12,sx:{display:"flex"},children:no(Hi,{variant:"bodySM",children:[e?no(Ze,{children:["Voc\xEA est\xE1 alterando seu plano ",$("strong",{children:n})," para uma nova modalidade:"," ",$("strong",{style:{textTransform:"capitalize"},children:e.para})]}):no(Ze,{children:["Voc\xEA est\xE1 alterando seu plano para ",$("strong",{children:t?.nome}),". O boleto ser\xE1 enviado por email em at\xE9 2 dias \xFAteis."]}),$("br",{}),$("br",{}),e&&no(Ze,{children:["A forma de pagamento ser\xE1 alterada de ",e.de," para ",e.para,". O"," ",$("strong",{children:"boleto ser\xE1 enviado por email"})," em at\xE9 2 dias \xFAteis, com data de vencimento de at\xE9 5 dias.",$("br",{})]}),"Ao confirmar sua nova escolha, sua fatura ser\xE1 alterada para"," ",no("strong",{children:[Yi.format(a)," ",V(t?.periodicidade??0,{modelo:"mensais"})]}),"."]})}),$(Je,{size:12,sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:!!r.img&&$("img",{src:r.img,alt:r.title})})]})}),no(ne.Footer,{children:[$(ya,{variant:"neutral",onClick:s,children:"Cancelar"}),$(ya,{type:"submit",onClick:s,children:r.buttonLabel})]})]})}import{styled as or}from"@mui/material";import{Grid as Ca}from"@mui/material";var Pa=or(Ca)`
88
- width: 90%;
89
- border-radius: 16px;
90
- padding: 1.5rem;
91
- margin: 0.5rem 0;
92
- box-shadow: 0px 3px 12px rgba(0, 0, 0, 0.12);
93
-
94
- @media ((min-width: 960px) and (max-height: 800px)) {
95
- position: sticky;
96
- top: 0;
97
- }
98
-
99
- @media (max-width: 500px) {
100
- width: 100%;
101
- padding: 1rem;
102
- margin: 0.5rem;
103
- }
104
- `,se=or(Ca)`
105
- display: flex;
106
- justify-content: center;
107
- margin-bottom: 0.5rem;
108
- `,le=or("div")`
109
- display: flex;
110
- justify-content: space-between;
111
- margin-bottom: 0.3rem;
112
- `;import{useFormContext as Xi}from"react-hook-form";var Ui=()=>{let{watch:o,getValues:e}=Xi(),r=e("planoSelecionado"),a=o("recursosSelecionados"),n=()=>{let i=[];return r.recursos&&(i=r.recursos.filter(s=>!s.valorRecurso)),Object.entries(a||{}).forEach(([s,m])=>{if(m){let d=r.recursos?.find(c=>c.slugRecurso===s);d&&i.push(d)}}),i};return{getValorTotal:i=>{let s=n(),m=i?0:r.valorPeriodicoPromocional||r.valorPeriodico;return s.reduce((c,u)=>c+u.valorRecurso,m)},getRecursos:n,planoSelecionado:r}},ba=Ui;import{Fragment as Zi,jsx as B,jsxs as fo}from"react/jsx-runtime";function va(){let[o,e]=Ki(!1),{planoSelecionado:r,getRecursos:a,getValorTotal:n}=ba();return fo(Zi,{children:[fo(Pa,{container:!0,children:[B(se,{size:12,style:{marginBottom:"1.5rem"},children:B(Y,{variant:"titleMD",align:"center",children:r.nome})}),B(se,{size:12,children:B(Y,{variant:"titleSM",children:"Valor do plano"})}),fo(se,{size:12,children:[B(Y,{variant:"bodyLG",style:{alignSelf:"center"},children:"R$"}),B(Y,{variant:"titleXXL",children:Number(n().toFixed(2))}),fo(Y,{variant:"bodyLG",style:{alignSelf:"end"},children:["/",V(r.periodicidade)]})]}),B(xa,{size:12,style:{marginBottom:"1rem"},children:B(Ji,{size:"large",fullWidth:!0,onClick:()=>e(!0),children:"Contratar agora"})}),fo(xa,{size:12,children:[fo(le,{children:[B(Y,{variant:"bodyMD",children:r.nome}),B(Y,{variant:"bodyMD",children:er.format(r.valorPeriodicoPromocional||r.valorPeriodico)})]}),fo(le,{children:[B(Y,{variant:"bodySM",children:"Subtotal recursos"}),B(Y,{variant:"bodySM",children:er.format(n(!0))})]}),a().map(t=>fo(le,{children:[B(Y,{variant:"bodySM",children:t.nomeRecurso}),B(Y,{variant:"bodySM",children:er.format(t.valorRecurso)})]},t.codigoRecurso))]})]}),o&&B(ha,{onClose:()=>e(!1)})]})}import{jsx as me,jsxs as on}from"react/jsx-runtime";function Sa(){return on(rr,{container:!0,spacing:2,children:[me(rr,{size:{xs:12,md:7},children:me(fa,{})}),me(rr,{size:{xs:12,md:5},sx:{display:"flex",justifyContent:"center",alignItems:"start"},children:me(va,{})})]})}import{Grid as ce,Typography as Da}from"@mui/material";import{jsx as ko,jsxs as en}from"react/jsx-runtime";function Ra(){let o=g(e=>e.planosDialog.emptyStateImg);return en(ce,{container:!0,spacing:2,sx:{padding:"1rem 0",direction:"column",alignItems:"center"},children:[!!o&&ko(ce,{size:12,children:ko("img",{src:o,alt:"emptyStateImg"})}),ko(ce,{size:12,textAlign:"center",children:ko(Da,{variant:"titleMD",children:"Voc\xEA precisa de um plano especial"})}),ko(ce,{size:12,textAlign:"center",children:ko(Da,{variant:"bodyMD",children:"Para trocar de plano solicite ajuda da nossa equipe no bot\xE3o abaixo."})})]})}import{useMutation as Ma,useQuery as Aa}from"@tanstack/react-query";import{useMemo as Ta}from"react";var wo=[{label:"Mensais",value:0},{label:"Trimestrais",value:1},{label:"Semestrais",value:2},{label:"Anuais",value:3}];var rn=({onClose:o})=>{let e=g(C=>C.telefoneSuporte),r=g(C=>C.planosDialog.mostrarPlanosDeterminados),a=g(C=>C.planosDialog.esconderPeriodicidade),n=g(C=>C.planosDialog.onContratarSuccess),{handleErrors:t,setNotification:i}=G(),s=oo(C=>C.setLoading),m=S(),d=Aa(m.buscarMeuPlanoRecursos()),c=d.data?.data.data,u=c?.codigoGrupo,f=c?.periodicidade??null,x=r?.codigoGrupo||u,p=Aa({...m.listarPlanosEGrupos({params:{grupo:x}}),enabled:d.isFetched&&!!x,select({data:C}){return C.data.planos&&![...C.data.planos.mensais,...C.data.planos.trimestrais,...C.data.planos.semestrais,...C.data.planos.anuais].length&&(C.data.planos=null),C.data}}),h=p.data,l=Ma(m.contratarPlano()),y=Ma(m.contratarRecurso()),v=!d.isFetched||!p.data,F=Ta(()=>{let C={};return d.isFetched&&typeof f=="number"&&(C.filtroPeriodicidade=wo[f]),C},[f,d.isFetched]),Q=Ta(()=>{let C=[];return h?.planos&&(h.planos.mensais.length&&C.push(wo[0]),h.planos.trimestrais.length&&C.push(wo[1]),h.planos.semestrais.length&&C.push(wo[2]),h.planos.anuais.length&&C.push(wo[3])),C},[h]),Po=!a&&!r?.codigoPlanoValor&&Q.length>1,bo=async C=>{try{if(!C.planoSelecionado)throw{error:"Ocorreu um erro inesperado"};s(!0);let L={codigoPlano:C.planoSelecionado.codigo,codigoPlanoValor:C.planoSelecionado.codigoPlanoValor};await l.mutateAsync(L);let b=()=>{n?.(c,C.planoSelecionado),i({title:"Seu plano foi atualizado com sucesso."}),d.refetch(),o()},E=Object.entries(C.recursosSelecionados||{});if(E.length){let ro=[];E.forEach(([z,A])=>{if(A){let _=C.planoSelecionado?.recursos?.find(Go=>Go.slugRecurso===z);_&&ro.push(_)}});let P=await Eo(ro);if(P.length){let z=P.map(A=>A.nomeRecurso);b(),i({title:"Ocorreu um erro ao contratar os seguintes recursos:",message:z.join(" ; "),duration:1e4})}else b()}else b();s(!1)}catch(L){t(L)}},Eo=C=>{let L=[];return new Promise(b=>{let E=ro=>{let P=ro.shift();if(!P)return b(L);y.mutateAsync(Number(P.codigoRecurso)).catch(()=>L.push(P)).finally(()=>E(ro))};E([...C])})};return{telefoneSuporte:e,handleContratarPlano:bo,isLoading:v,mostrarPeriodicidade:Po,filtroPeriodicidadeOptions:Q,initialValues:F,planosEGrupos:h,getDialogTitle:C=>C?C.periodicidade!==f?"Contratar plano":C.valorMensalMenorQueAtual?"Diminuir plano":"Aumentar plano":"Meus planos"}},Ia=rn;import{Typography as mn}from"@mui/material";import{Fragment as cn,jsx as N,jsxs as Ga}from"react/jsx-runtime";function de({onClose:o}){let{open:e,onCloseDialog:r}=H(o),{isLoading:a,mostrarPeriodicidade:n,filtroPeriodicidadeOptions:t,handleContratarPlano:i,telefoneSuporte:s,initialValues:m,planosEGrupos:d,getDialogTitle:c}=Ia({onClose:r}),u=f=>a?N(oa,{}):d?.planos?f?N(Sa,{}):N(ca,{planos:d.planos}):N(Ra,{});return N(pe,{open:e,onClose:r,fullWidth:!0,maxWidth:"xl",closeIcon:!0,disableBackdropClick:!0,children:N(tn,{onSubmit:i,defaultValues:m,style:{display:"flex",flexDirection:"column",overflowY:"auto"},children:({watch:f,setValue:x})=>{let p=f("planoSelecionado");return Ga(cn,{children:[N(pe.Header,{children:Ga("div",{style:{display:"flex",flex:1,justifyContent:"space-between"},children:[N(mn,{variant:"titleMD",children:c(p)}),n&&!p&&N(nn,{name:"filtroPeriodicidade",options:t,style:{minWidth:"7rem",marginRight:"0.5rem"},getOptionKey:h=>h.value,getOptionLabel:h=>h.label})]})}),N(pe.Content,{children:u(!!p)}),N(pe.Footer,{children:p?N(Ea,{variant:"neutral",disableRipple:!0,onClick:()=>{x("planoSelecionado",void 0),x("recursosSelecionados",void 0)},children:"Voltar"}):N(Ea,{variant:"outlined",color:"neutral",startIcon:N(an,{icon:sn,size:"22px",removeMargin:!0}),style:{color:ln.neutral[100]},onClick:()=>io(s),children:"Preciso de Ajuda"})})]})}})})}import{jsx as Fa}from"react/jsx-runtime";function pn({onClose:o,onNotification:e}){return Fa(to,{onNotification:e,children:Fa(de,{onClose:o})})}import{CircularProgress as An,Divider as Za,Grid as so,Typography as ot}from"@mui/material";import{Button as Tn,Dialog as De,LIcon as In}from"@s_mart/core";import{lineWhatsApp as En}from"@s_mart/regular-icons";import{colorPalette as et}from"@s_mart/tokens";import{Button as za,Grid as ue,Typography as fe}from"@mui/material";import{Dialog as ge}from"@s_mart/core";import{valor as dn}from"@s_mart/masks";import{useQuery as un}from"@tanstack/react-query";import{jsx as X,jsxs as _o}from"react/jsx-runtime";function ka({recurso:o,onClose:e,onConfirmar:r}){let a=S(),i=un(a.buscarMeuPlanoRecursos()).data?.data.data?.periodicidade??null,{open:s,onCloseDialog:m}=H(e),d=async()=>{await r(o),m()};return _o(ge,{open:s,closeIcon:!0,onClose:m,children:[X(ge.Header,{children:"Adquirir novo recurso"}),X(ge.Content,{children:_o(ue,{container:!0,children:[_o(ue,{size:12,children:[X(fe,{variant:"bodySM",children:"Voc\xEA est\xE1 adquirindo um recurso do seu sistema: "}),X(fe,{variant:"titleXS",children:o.nomeRecurso})]}),X(ue,{size:12,children:_o(fe,{variant:"bodySM",children:["Informamos que sua ",V(i,{modelo:"mensalidade"})," ter\xE1 uma adi\xE7\xE3o de"," ",dn.format(o.valorRecurso)]})}),X("br",{}),X("br",{}),X(ue,{size:12,children:X(fe,{variant:"bodySM",children:"Deseja confirmar a aquisi\xE7\xE3o?"})})]})}),_o(ge.Footer,{children:[X(za,{variant:"neutral",onClick:m,children:"Cancelar"}),X(za,{onClick:d,children:"Confirmar"})]})]})}import{Grid as ye,Typography as he}from"@mui/material";import{Button as wa,Dialog as Ce}from"@s_mart/core";import{useQuery as fn}from"@tanstack/react-query";import{jsx as U,jsxs as jo}from"react/jsx-runtime";function La({recurso:o,onClose:e,onRemover:r}){let a=S(),i=fn(a.buscarMeuPlanoRecursos()).data?.data.data?.periodicidade??null,{open:s,onCloseDialog:m}=H(e),d=async()=>{await r(o),m()};return jo(Ce,{open:s,closeIcon:!0,onClose:m,children:[U(Ce.Header,{children:"Remover recurso"}),U(Ce.Content,{children:jo(ye,{container:!0,children:[jo(ye,{size:12,children:[U(he,{variant:"bodySM",children:"Voc\xEA est\xE1 removendo um recurso do seu sistema: "}),U(he,{variant:"titleXS",children:o.nomeRecurso})]}),U(ye,{size:12,children:jo(he,{variant:"bodySM",children:["Sua ",V(i,{modelo:"mensalidade"})," ter\xE1 uma altera\xE7\xE3o."]})}),U("br",{}),U("br",{}),U(ye,{size:12,children:U(he,{variant:"bodySM",children:"Deseja confirmar a remo\xE7\xE3o?"})})]})}),jo(Ce.Footer,{children:[U(wa,{color:"error",onClick:d,children:"Remover"}),U(wa,{variant:"neutral",onClick:m,children:"Cancelar"})]})]})}import{Grid as Pe,Typography as Ba}from"@mui/material";import{jsx as Lo,jsxs as gn}from"react/jsx-runtime";function qa(){let o=g(e=>e.recursosDialog.emptyStateImg);return gn(Pe,{container:!0,spacing:2,sx:{direction:"column",alignItems:"center",margin:"2rem 0",width:"100%"},children:[!!o&&Lo(Pe,{children:Lo("img",{src:o,alt:"emptyStateImg"})}),Lo(Pe,{size:12,textAlign:"center",children:Lo(Ba,{variant:"titleMD",children:"Novos recursos v\xEAm a\xED"})}),Lo(Pe,{size:12,textAlign:"center",children:Lo(Ba,{variant:"bodyMD",children:"Voc\xEA j\xE1 possui todos os recursos dispon\xEDveis no momento."})})]})}import{Button as Na,Dialog as be}from"@s_mart/core";import{Grid as xe,Typography as Qa}from"@mui/material";import{styled as yn}from"@mui/material";var Va=yn("img")`
1023
+ `;
1024
+ //#endregion
1025
+ //#region src/components/planosDialog/listagemPlanos/plano/plano.tsx
1026
+ function Lt({ plano: e, id: t, reduceFont: n, onContratar: r, periodicidadePlanoAtual: a }) {
1027
+ let o = q((e) => e.planosDialog.esconderValorPlanos), s = q((e) => e.planosDialog.habilitarPlanoAtual), c = q((e) => e.telefoneCS), l = q((e) => e.telefoneSuporte), u = e.planoAtual && !s;
1028
+ return /* @__PURE__ */ D(Pt, {
1029
+ id: t,
1030
+ children: /* @__PURE__ */ D(Rt, {
1031
+ title: e.disabled30Dias ? /* @__PURE__ */ O(g, {
1032
+ variant: "bodyXS",
1033
+ children: [
1034
+ "A troca para um plano de valor ",
1035
+ /* @__PURE__ */ D("br", {}),
1036
+ "menor, só é possível após 30 dias ",
1037
+ /* @__PURE__ */ D("br", {}),
1038
+ "de uso do seu plano atual."
1039
+ ]
1040
+ }) : "",
1041
+ placement: "right",
1042
+ children: /* @__PURE__ */ O(Ft, {
1043
+ destaque: !!e.destaque,
1044
+ disabled: u || e.disabled || e.disabled30Dias,
1045
+ children: [
1046
+ !!e.destaque && /* @__PURE__ */ D(S, {
1047
+ icon: oe,
1048
+ color: L.yellow[300],
1049
+ style: {
1050
+ position: "absolute",
1051
+ top: "5px",
1052
+ right: "5px"
1053
+ }
1054
+ }),
1055
+ /* @__PURE__ */ O(It, { children: [
1056
+ /* @__PURE__ */ D("div", {
1057
+ style: { textAlign: "center" },
1058
+ children: /* @__PURE__ */ D(g, {
1059
+ variant: n ? "titleMS" : "titleMD",
1060
+ children: e.nome
1061
+ })
1062
+ }),
1063
+ !!e.fraseDeEfeito && /* @__PURE__ */ D("div", { children: /* @__PURE__ */ D(g, {
1064
+ variant: "bodySM",
1065
+ color: L.neutral[100],
1066
+ children: e.fraseDeEfeito
1067
+ }) }),
1068
+ !o && /* @__PURE__ */ O(E, { children: [!!e.valorPeriodicoPromocional && /* @__PURE__ */ D("div", { children: /* @__PURE__ */ O(g, {
1069
+ variant: "bodySM",
1070
+ color: L.red[300],
1071
+ style: {
1072
+ textDecorationLine: "line-through",
1073
+ marginRight: "2rem"
1074
+ },
1075
+ children: ["R$ ", e.valorPeriodico]
1076
+ }) }), /* @__PURE__ */ O("div", {
1077
+ style: {
1078
+ display: "flex",
1079
+ justifyContent: "center",
1080
+ alignItems: "end"
1081
+ },
1082
+ children: [
1083
+ /* @__PURE__ */ D(g, {
1084
+ variant: "titleXXS",
1085
+ sx: { alignSelf: "center" },
1086
+ children: "R$"
1087
+ }),
1088
+ /* @__PURE__ */ D(g, {
1089
+ variant: n ? "titleLG" : "titleXL",
1090
+ style: { fontSize: "3rem" },
1091
+ children: e.valorPeriodicoPromocional || e.valorPeriodico
1092
+ }),
1093
+ /* @__PURE__ */ O(g, {
1094
+ variant: n ? "titleMS" : "titleMD",
1095
+ sx: { marginBottom: "0.3rem" },
1096
+ children: ["/", W(e.periodicidade)]
1097
+ })
1098
+ ]
1099
+ })] })
1100
+ ] }),
1101
+ /* @__PURE__ */ D(i, {
1102
+ fullWidth: !0,
1103
+ variant: u ? "neutral" : "contained",
1104
+ disabled: u || e.disabled || e.disabled30Dias,
1105
+ startIcon: (u || o) && /* @__PURE__ */ D(S, {
1106
+ icon: u ? ke : Fe,
1107
+ size: "25px"
1108
+ }),
1109
+ onClick: () => {
1110
+ o ? Q(c || l) : r(e);
1111
+ },
1112
+ style: { margin: "1.5rem 0" },
1113
+ children: u ? "Seu plano atual" : o ? "Quero saber mais" : s && e.planoAtual || e.periodicidade !== a ? "Contratar plano" : e.valorMensalMenorQueAtual ? "Diminuir plano" : "Aumentar plano"
1114
+ }),
1115
+ /* @__PURE__ */ D("div", {
1116
+ style: { paddingLeft: "1rem" },
1117
+ children: /* @__PURE__ */ D(g, {
1118
+ variant: "bodySM",
1119
+ children: /* @__PURE__ */ D("div", {
1120
+ style: {
1121
+ display: "flex",
1122
+ flexDirection: "column"
1123
+ },
1124
+ dangerouslySetInnerHTML: { __html: e.descricao }
1125
+ })
1126
+ })
1127
+ })
1128
+ ]
1129
+ })
1130
+ })
1131
+ });
1132
+ }
1133
+ function Rt(e) {
1134
+ return e.title ? /* @__PURE__ */ D(h, { ...e }) : /* @__PURE__ */ D(E, { children: e.children });
1135
+ }
1136
+ //#endregion
1137
+ //#region src/components/planosDialog/listagemPlanos/useListagemPlanos.ts
1138
+ var zt = ({ planos: e }) => {
1139
+ let t = J(), n = M(t.buscarMeuPlanoRecursos()).data?.data.data, r = N(), i = n?.codigoPlano, a = n?.periodicidade ?? null, o = n?.valor, s = n?.dataContratacao, c = n?.recursos, l = K((e) => e.setLoading), u = q((e) => e.planosDialog.bloquearDowngrade), d = q((e) => e.planosDialog.bloquearDowngrade30Dias), f = q((e) => e.planosDialog.desabilitarPlanosMenores), p = q((e) => e.planosDialog.mostrarSomentePlanosDaPeriodicidade), m = q((e) => e.planosDialog.mostrarPlanosDeterminados?.codigoPlanoValor), { handleErrors: h } = X(), { watch: g, setValue: _ } = z(), v = y("(max-width: 900px)"), b = y("(max-width: 700px)"), x = y("(max-width: 450px)"), S = g("filtroPeriodicidade"), ee = !!d && B().diff(B(s), "days") < 30, C = F(() => {
1140
+ let e = {
1141
+ previous: 0,
1142
+ next: 4
1143
+ };
1144
+ return b ? e.next = 2 : v && (e.next = 3), e;
1145
+ }, [b, v]), te = P((e, t) => {
1146
+ switch (t) {
1147
+ case 1: return e / 3;
1148
+ case 2: return e / 6;
1149
+ case 3: return e / 12;
1150
+ default: return e;
1151
+ }
1152
+ }, []), w = F(() => {
1153
+ let t = [];
1154
+ return e ? (m && !p ? t = [
1155
+ ...e.mensais,
1156
+ ...e.trimestrais,
1157
+ ...e.semestrais,
1158
+ ...e.anuais
1159
+ ].filter((e) => m.includes(e.codigoPlanoValor)) : S && (t = e[p || [
1160
+ "mensais",
1161
+ "trimestrais",
1162
+ "semestrais",
1163
+ "anuais"
1164
+ ][S.value]]), t.sort((e, t) => e.valorPeriodico - t.valorPeriodico), t.map((e) => {
1165
+ let t = e.valorPeriodicoPromocional || e.valorPeriodico, n = te(t, e.periodicidade) < te(o ?? 0, a);
1166
+ return {
1167
+ ...e,
1168
+ planoAtual: e.codigo === i && e.periodicidade === a,
1169
+ valorMensalMenorQueAtual: n,
1170
+ disabled: (!!u || !!f) && n,
1171
+ disabled30Dias: ee && n
1172
+ };
1173
+ })) : t;
1174
+ }, [
1175
+ e,
1176
+ u,
1177
+ a,
1178
+ ee,
1179
+ te,
1180
+ o,
1181
+ f,
1182
+ p,
1183
+ i,
1184
+ S,
1185
+ m
1186
+ ]);
1187
+ return {
1188
+ planosFiltrados: w,
1189
+ scrollPlanos: (e) => {
1190
+ let t = C[e];
1191
+ if (t === 0 || t > w.length) return;
1192
+ let n = document.getElementById(`plano-${t}`);
1193
+ n && (n.scrollIntoView({ behavior: "smooth" }), e === "next" ? (C.next++, C.previous++) : (C.next--, C.previous--));
1194
+ },
1195
+ showScrollControllers: F(() => b ? w.length > 1 : v ? w.length > 2 : w.length > 3, [
1196
+ b,
1197
+ v,
1198
+ w
1199
+ ]),
1200
+ maxWidth700: b,
1201
+ maxWidth450: x,
1202
+ handleClickContratarPlano: async (e) => {
1203
+ try {
1204
+ l(!0);
1205
+ let n = await r.ensureQueryData(t.buscarPlano({
1206
+ params: { periodicidade: e.periodicidade },
1207
+ path: { codigo: e.codigo }
1208
+ }));
1209
+ if (n.data.data) {
1210
+ let t = {}, r = n.data.data.recursos?.filter((e) => !e?.valorRecurso)?.map((e) => e?.slugRecurso);
1211
+ (c?.filter((e) => e.recursoContratado))?.forEach((e) => {
1212
+ n.data.data.recursos.some((t) => t.slugRecurso === e.slugRecurso) && !r?.includes(e.slugRecurso) && (t[e.slugRecurso] = !0);
1213
+ }), _("recursosSelecionados", t), _("planoSelecionado", {
1214
+ ...e,
1215
+ recursos: n.data.data.recursos
1216
+ });
1217
+ }
1218
+ l(!1);
1219
+ } catch (e) {
1220
+ h(e);
1221
+ }
1222
+ },
1223
+ periodicidadePlanoAtual: a
1224
+ };
1225
+ };
1226
+ //#endregion
1227
+ //#region src/components/planosDialog/listagemPlanos/listagemPlanos.tsx
1228
+ function Bt(e) {
1229
+ let { planosFiltrados: t, scrollPlanos: n, showScrollControllers: r, maxWidth700: i, maxWidth450: a, handleClickContratarPlano: o, periodicidadePlanoAtual: s } = zt(e);
1230
+ return /* @__PURE__ */ O("div", {
1231
+ style: {
1232
+ display: "flex",
1233
+ position: "relative"
1234
+ },
1235
+ children: [
1236
+ r && /* @__PURE__ */ D(Nt, {
1237
+ side: "left",
1238
+ onClick: () => n("previous"),
1239
+ children: /* @__PURE__ */ D(S, {
1240
+ icon: Ae,
1241
+ size: i ? "2rem" : "3rem"
1242
+ })
1243
+ }),
1244
+ /* @__PURE__ */ D("div", {
1245
+ style: {
1246
+ display: "flex",
1247
+ justifyContent: r ? void 0 : "center",
1248
+ overflow: "hidden",
1249
+ flex: 1
1250
+ },
1251
+ children: t.map((e, t) => /* @__PURE__ */ D(Lt, {
1252
+ id: `plano-${t + 1}`,
1253
+ plano: e,
1254
+ reduceFont: a,
1255
+ periodicidadePlanoAtual: s ?? 0,
1256
+ onContratar: o
1257
+ }, e.codigoPlanoValor))
1258
+ }),
1259
+ r && /* @__PURE__ */ D(Nt, {
1260
+ side: "right",
1261
+ onClick: () => n("next"),
1262
+ children: /* @__PURE__ */ D(S, {
1263
+ icon: je,
1264
+ size: i ? "2rem" : "3rem"
1265
+ })
1266
+ })
1267
+ ]
1268
+ });
1269
+ }
1270
+ //#endregion
1271
+ //#region src/components/planosDialog/loading/loading.tsx
1272
+ function Vt() {
1273
+ return /* @__PURE__ */ D("div", {
1274
+ style: {
1275
+ display: "flex",
1276
+ justifyContent: "center",
1277
+ alignItems: "center",
1278
+ height: "20vh"
1279
+ },
1280
+ children: /* @__PURE__ */ D(s, {})
1281
+ });
1282
+ }
1283
+ //#endregion
1284
+ //#region src/components/planosDialog/planosDialog.static.ts
1285
+ var $ = [
1286
+ {
1287
+ label: "Mensais",
1288
+ value: 0
1289
+ },
1290
+ {
1291
+ label: "Trimestrais",
1292
+ value: 1
1293
+ },
1294
+ {
1295
+ label: "Semestrais",
1296
+ value: 2
1297
+ },
1298
+ {
1299
+ label: "Anuais",
1300
+ value: 3
1301
+ }
1302
+ ], Ht = ({ onClose: e }) => {
1303
+ let t = q((e) => e.telefoneSuporte), n = q((e) => e.planosDialog.mostrarPlanosDeterminados), r = q((e) => e.planosDialog.esconderPeriodicidade), i = q((e) => e.planosDialog.onContratarSuccess), { handleErrors: a, setNotification: o } = X(), s = K((e) => e.setLoading), c = J(), l = M(c.buscarMeuPlanoRecursos()), u = l.data?.data.data, d = u?.codigoGrupo, f = u?.periodicidade ?? null, p = n?.codigoGrupo || d, m = M({
1304
+ ...c.listarPlanosEGrupos({ params: { grupo: p } }),
1305
+ enabled: l.isFetched && !!p,
1306
+ select({ data: e }) {
1307
+ return e.data.planos && ![
1308
+ ...e.data.planos.mensais,
1309
+ ...e.data.planos.trimestrais,
1310
+ ...e.data.planos.semestrais,
1311
+ ...e.data.planos.anuais
1312
+ ].length && (e.data.planos = null), e.data;
1313
+ }
1314
+ }), h = m.data, g = j(c.contratarPlano()), _ = j(c.contratarRecurso()), v = !l.isFetched || !m.data, y = F(() => {
1315
+ let e = {};
1316
+ return l.isFetched && typeof f == "number" && (e.filtroPeriodicidade = $[f]), e;
1317
+ }, [f, l.isFetched]), b = F(() => {
1318
+ let e = [];
1319
+ return h?.planos && (h.planos.mensais.length && e.push($[0]), h.planos.trimestrais.length && e.push($[1]), h.planos.semestrais.length && e.push($[2]), h.planos.anuais.length && e.push($[3])), e;
1320
+ }, [h]), x = !r && !n?.codigoPlanoValor && b.length > 1, S = async (t) => {
1321
+ try {
1322
+ if (!t.planoSelecionado) throw { error: "Ocorreu um erro inesperado" };
1323
+ s(!0);
1324
+ let n = {
1325
+ codigoPlano: t.planoSelecionado.codigo,
1326
+ codigoPlanoValor: t.planoSelecionado.codigoPlanoValor
1327
+ };
1328
+ await g.mutateAsync(n);
1329
+ let r = () => {
1330
+ i?.(u, t.planoSelecionado), o({ title: "Seu plano foi atualizado com sucesso." }), l.refetch(), e();
1331
+ }, a = Object.entries(t.recursosSelecionados || {});
1332
+ if (a.length) {
1333
+ let e = [];
1334
+ a.forEach(([n, r]) => {
1335
+ if (r) {
1336
+ let r = t.planoSelecionado?.recursos?.find((e) => e.slugRecurso === n);
1337
+ r && e.push(r);
1338
+ }
1339
+ });
1340
+ let n = await ee(e);
1341
+ if (n.length) {
1342
+ let e = n.map((e) => e.nomeRecurso);
1343
+ r(), o({
1344
+ title: "Ocorreu um erro ao contratar os seguintes recursos:",
1345
+ message: e.join(" ; "),
1346
+ duration: 1e4
1347
+ });
1348
+ } else r();
1349
+ } else r();
1350
+ s(!1);
1351
+ } catch (e) {
1352
+ a(e);
1353
+ }
1354
+ }, ee = (e) => {
1355
+ let t = [];
1356
+ return new Promise((n) => {
1357
+ let r = (e) => {
1358
+ let i = e.shift();
1359
+ if (!i) return n(t);
1360
+ _.mutateAsync(Number(i.codigoRecurso)).catch(() => t.push(i)).finally(() => r(e));
1361
+ };
1362
+ r([...e]);
1363
+ });
1364
+ };
1365
+ return {
1366
+ telefoneSuporte: t,
1367
+ handleContratarPlano: S,
1368
+ isLoading: v,
1369
+ mostrarPeriodicidade: x,
1370
+ filtroPeriodicidadeOptions: b,
1371
+ initialValues: y,
1372
+ planosEGrupos: h,
1373
+ getDialogTitle: (e) => e ? e.periodicidade === f ? e.valorMensalMenorQueAtual ? "Diminuir plano" : "Aumentar plano" : "Contratar plano" : "Meus planos"
1374
+ };
1375
+ };
1376
+ //#endregion
1377
+ //#region src/components/planosDialog/planosDialog.tsx
1378
+ function Ut({ onClose: e }) {
1379
+ let { open: t, onCloseDialog: n } = Z(e), { isLoading: r, mostrarPeriodicidade: a, filtroPeriodicidadeOptions: o, handleContratarPlano: s, telefoneSuporte: c, initialValues: l, planosEGrupos: u, getDialogTitle: d } = Ht({ onClose: n }), f = (e) => r ? /* @__PURE__ */ D(Vt, {}) : u?.planos ? e ? /* @__PURE__ */ D(jt, {}) : /* @__PURE__ */ D(Bt, { planos: u.planos }) : /* @__PURE__ */ D(Mt, {});
1380
+ return /* @__PURE__ */ D(b, {
1381
+ open: t,
1382
+ onClose: n,
1383
+ fullWidth: !0,
1384
+ maxWidth: "xl",
1385
+ closeIcon: !0,
1386
+ disableBackdropClick: !0,
1387
+ children: /* @__PURE__ */ D(Ee, {
1388
+ onSubmit: s,
1389
+ defaultValues: l,
1390
+ style: {
1391
+ display: "flex",
1392
+ flexDirection: "column",
1393
+ overflowY: "auto"
1394
+ },
1395
+ children: ({ watch: e, setValue: t }) => {
1396
+ let n = e("planoSelecionado");
1397
+ return /* @__PURE__ */ O(E, { children: [
1398
+ /* @__PURE__ */ D(b.Header, { children: /* @__PURE__ */ O("div", {
1399
+ style: {
1400
+ display: "flex",
1401
+ flex: 1,
1402
+ justifyContent: "space-between"
1403
+ },
1404
+ children: [/* @__PURE__ */ D(g, {
1405
+ variant: "titleMD",
1406
+ children: d(n)
1407
+ }), a && !n && /* @__PURE__ */ D(De, {
1408
+ name: "filtroPeriodicidade",
1409
+ options: o,
1410
+ style: {
1411
+ minWidth: "7rem",
1412
+ marginRight: "0.5rem"
1413
+ },
1414
+ getOptionKey: (e) => e.value,
1415
+ getOptionLabel: (e) => e.label
1416
+ })]
1417
+ }) }),
1418
+ /* @__PURE__ */ D(b.Content, { children: f(!!n) }),
1419
+ /* @__PURE__ */ D(b.Footer, { children: n ? /* @__PURE__ */ D(i, {
1420
+ variant: "neutral",
1421
+ disableRipple: !0,
1422
+ onClick: () => {
1423
+ t("planoSelecionado", void 0), t("recursosSelecionados", void 0);
1424
+ },
1425
+ children: "Voltar"
1426
+ }) : /* @__PURE__ */ D(i, {
1427
+ variant: "outlined",
1428
+ color: "neutral",
1429
+ startIcon: /* @__PURE__ */ D(S, {
1430
+ icon: Fe,
1431
+ size: "22px",
1432
+ removeMargin: !0
1433
+ }),
1434
+ style: { color: L.neutral[100] },
1435
+ onClick: () => Q(c),
1436
+ children: "Preciso de Ajuda"
1437
+ }) })
1438
+ ] });
1439
+ }
1440
+ })
1441
+ });
1442
+ }
1443
+ //#endregion
1444
+ //#region src/components/planosDialog/planosDialogExport.tsx
1445
+ function Wt({ onClose: e, onNotification: t }) {
1446
+ return /* @__PURE__ */ D(Y, {
1447
+ onNotification: t,
1448
+ children: /* @__PURE__ */ D(Ut, { onClose: e })
1449
+ });
1450
+ }
1451
+ //#endregion
1452
+ //#region src/components/recursosDialog/confirmacaoAdquirirDialog/confirmacaoAdquirirDialog.tsx
1453
+ function Gt({ recurso: e, onClose: t, onConfirmar: n }) {
1454
+ let r = J(), a = M(r.buscarMeuPlanoRecursos()).data?.data.data?.periodicidade ?? null, { open: o, onCloseDialog: s } = Z(t);
1455
+ return /* @__PURE__ */ O(b, {
1456
+ open: o,
1457
+ closeIcon: !0,
1458
+ onClose: s,
1459
+ children: [
1460
+ /* @__PURE__ */ D(b.Header, { children: "Adquirir novo recurso" }),
1461
+ /* @__PURE__ */ D(b.Content, { children: /* @__PURE__ */ O(l, {
1462
+ container: !0,
1463
+ children: [
1464
+ /* @__PURE__ */ O(l, {
1465
+ size: 12,
1466
+ children: [/* @__PURE__ */ D(g, {
1467
+ variant: "bodySM",
1468
+ children: "Você está adquirindo um recurso do seu sistema: "
1469
+ }), /* @__PURE__ */ D(g, {
1470
+ variant: "titleXS",
1471
+ children: e.nomeRecurso
1472
+ })]
1473
+ }),
1474
+ /* @__PURE__ */ D(l, {
1475
+ size: 12,
1476
+ children: /* @__PURE__ */ O(g, {
1477
+ variant: "bodySM",
1478
+ children: [
1479
+ "Informamos que sua ",
1480
+ W(a, { modelo: "mensalidade" }),
1481
+ " terá uma adição de",
1482
+ " ",
1483
+ C.format(e.valorRecurso)
1484
+ ]
1485
+ })
1486
+ }),
1487
+ /* @__PURE__ */ D("br", {}),
1488
+ /* @__PURE__ */ D("br", {}),
1489
+ /* @__PURE__ */ D(l, {
1490
+ size: 12,
1491
+ children: /* @__PURE__ */ D(g, {
1492
+ variant: "bodySM",
1493
+ children: "Deseja confirmar a aquisição?"
1494
+ })
1495
+ })
1496
+ ]
1497
+ }) }),
1498
+ /* @__PURE__ */ O(b.Footer, { children: [/* @__PURE__ */ D(i, {
1499
+ variant: "neutral",
1500
+ onClick: s,
1501
+ children: "Cancelar"
1502
+ }), /* @__PURE__ */ D(i, {
1503
+ onClick: async () => {
1504
+ await n(e), s();
1505
+ },
1506
+ children: "Confirmar"
1507
+ })] })
1508
+ ]
1509
+ });
1510
+ }
1511
+ //#endregion
1512
+ //#region src/components/recursosDialog/confirmacaoRemoverDialog/confirmacaoRemoverDialog.tsx
1513
+ function Kt({ recurso: e, onClose: t, onRemover: n }) {
1514
+ let r = J(), a = M(r.buscarMeuPlanoRecursos()).data?.data.data?.periodicidade ?? null, { open: o, onCloseDialog: s } = Z(t);
1515
+ return /* @__PURE__ */ O(b, {
1516
+ open: o,
1517
+ closeIcon: !0,
1518
+ onClose: s,
1519
+ children: [
1520
+ /* @__PURE__ */ D(b.Header, { children: "Remover recurso" }),
1521
+ /* @__PURE__ */ D(b.Content, { children: /* @__PURE__ */ O(l, {
1522
+ container: !0,
1523
+ children: [
1524
+ /* @__PURE__ */ O(l, {
1525
+ size: 12,
1526
+ children: [/* @__PURE__ */ O(g, {
1527
+ variant: "bodySM",
1528
+ children: ["Você está removendo um recurso do seu sistema:", " "]
1529
+ }), /* @__PURE__ */ D(g, {
1530
+ variant: "titleXS",
1531
+ children: e.nomeRecurso
1532
+ })]
1533
+ }),
1534
+ /* @__PURE__ */ D(l, {
1535
+ size: 12,
1536
+ children: /* @__PURE__ */ O(g, {
1537
+ variant: "bodySM",
1538
+ children: [
1539
+ "Sua ",
1540
+ W(a, { modelo: "mensalidade" }),
1541
+ " terá uma alteração."
1542
+ ]
1543
+ })
1544
+ }),
1545
+ /* @__PURE__ */ D("br", {}),
1546
+ /* @__PURE__ */ D("br", {}),
1547
+ /* @__PURE__ */ D(l, {
1548
+ size: 12,
1549
+ children: /* @__PURE__ */ D(g, {
1550
+ variant: "bodySM",
1551
+ children: "Deseja confirmar a remoção?"
1552
+ })
1553
+ })
1554
+ ]
1555
+ }) }),
1556
+ /* @__PURE__ */ O(b.Footer, { children: [/* @__PURE__ */ D(i, {
1557
+ color: "error",
1558
+ onClick: async () => {
1559
+ await n(e), s();
1560
+ },
1561
+ children: "Remover"
1562
+ }), /* @__PURE__ */ D(i, {
1563
+ variant: "neutral",
1564
+ onClick: s,
1565
+ children: "Cancelar"
1566
+ })] })
1567
+ ]
1568
+ });
1569
+ }
1570
+ //#endregion
1571
+ //#region src/components/recursosDialog/emptyState/emptyState.tsx
1572
+ function qt() {
1573
+ let e = q((e) => e.recursosDialog.emptyStateImg);
1574
+ return /* @__PURE__ */ O(l, {
1575
+ container: !0,
1576
+ spacing: 2,
1577
+ sx: {
1578
+ direction: "column",
1579
+ alignItems: "center",
1580
+ margin: "2rem 0",
1581
+ width: "100%"
1582
+ },
1583
+ children: [
1584
+ !!e && /* @__PURE__ */ D(l, { children: /* @__PURE__ */ D("img", {
1585
+ src: e,
1586
+ alt: "emptyStateImg"
1587
+ }) }),
1588
+ /* @__PURE__ */ D(l, {
1589
+ size: 12,
1590
+ sx: { textAlign: "center" },
1591
+ children: /* @__PURE__ */ D(g, {
1592
+ variant: "titleMD",
1593
+ children: "Novos recursos vêm aí"
1594
+ })
1595
+ }),
1596
+ /* @__PURE__ */ D(l, {
1597
+ size: 12,
1598
+ sx: { textAlign: "center" },
1599
+ children: /* @__PURE__ */ D(g, {
1600
+ variant: "bodyMD",
1601
+ children: "Você já possui todos os recursos disponíveis no momento."
1602
+ })
1603
+ })
1604
+ ]
1605
+ });
1606
+ }
1607
+ //#endregion
1608
+ //#region src/components/recursosDialog/gifDialog/gifDialog.styles.ts
1609
+ var Jt = v("img")`
113
1610
  max-width: 520px;
114
1611
 
115
1612
  @media only screen and (max-width: 640px) {
@@ -123,39 +1620,86 @@ import Mr from"axios";var Le=class{axiosSistema;axiosControle;listeners=new Set;
123
1620
  @media only screen and (max-width: 420px) {
124
1621
  max-width: 260px;
125
1622
  }
126
- `;import{jsx as K,jsxs as Wa}from"react/jsx-runtime";function $a({recurso:o,onClose:e,onAdquirirRecurso:r,onRemoverRecurso:a}){let{open:n,onCloseDialog:t}=H(e),i=o.valorRecurso===0&&o.recursoContratado,s=async()=>{await a(o),t()},m=async()=>{await r(o),t()};return Wa(be,{open:n,closeIcon:!0,onClose:t,children:[K(be.Header,{children:"Este recurso pode ajudar voc\xEA!"}),K(be.Content,{children:Wa(xe,{container:!0,spacing:2,sx:{direction:"column",alignItems:"center"},children:[K(xe,{children:K(Qa,{variant:"titleSM",children:o.nomeRecurso})}),K(xe,{children:K(Qa,{variant:"bodySM",children:o.descricaoRecurso})}),o.gif&&K(xe,{children:K(Va,{src:o.gif})})]})}),!i&&!o.dataExclusaoRecurso&&K(be.Footer,{children:o.recursoContratado?K(Na,{color:"error",onClick:s,children:"Remover recurso"}):K(Na,{onClick:m,children:"Adquirir recurso"})})]})}import{Tooltip as hn,Typography as Bo}from"@mui/material";import{Button as Ya,LIcon as Se}from"@s_mart/core";import{valor as Cn}from"@s_mart/masks";import{lineCheckCircle as Pn}from"@s_mart/regular-icons";import{lineStar as bn,lineWhatsappBrands as Xa}from"@s_mart/solid-icons";import{colorPalette as Ua}from"@s_mart/tokens";import xn from"dayjs";import{css as Oa,styled as ar}from"@mui/material";import{colorPalette as ve}from"@s_mart/tokens";var _a=ar("div")`
1623
+ `;
1624
+ //#endregion
1625
+ //#region src/components/recursosDialog/gifDialog/gifDialog.tsx
1626
+ function Yt({ recurso: e, onClose: t, onAdquirirRecurso: n, onRemoverRecurso: r }) {
1627
+ let { open: a, onCloseDialog: o } = Z(t), s = e.valorRecurso === 0 && e.recursoContratado;
1628
+ return /* @__PURE__ */ O(b, {
1629
+ open: a,
1630
+ closeIcon: !0,
1631
+ onClose: o,
1632
+ children: [
1633
+ /* @__PURE__ */ D(b.Header, { children: "Este recurso pode ajudar você!" }),
1634
+ /* @__PURE__ */ D(b.Content, { children: /* @__PURE__ */ O(l, {
1635
+ container: !0,
1636
+ spacing: 2,
1637
+ sx: {
1638
+ direction: "column",
1639
+ alignItems: "center"
1640
+ },
1641
+ children: [
1642
+ /* @__PURE__ */ D(l, { children: /* @__PURE__ */ D(g, {
1643
+ variant: "titleSM",
1644
+ children: e.nomeRecurso
1645
+ }) }),
1646
+ /* @__PURE__ */ D(l, { children: /* @__PURE__ */ D(g, {
1647
+ variant: "bodySM",
1648
+ children: e.descricaoRecurso
1649
+ }) }),
1650
+ e.gif && /* @__PURE__ */ D(l, { children: /* @__PURE__ */ D(Jt, { src: e.gif }) })
1651
+ ]
1652
+ }) }),
1653
+ !s && !e.dataExclusaoRecurso && /* @__PURE__ */ D(b.Footer, { children: e.recursoContratado ? /* @__PURE__ */ D(i, {
1654
+ color: "error",
1655
+ onClick: async () => {
1656
+ await r(e), o();
1657
+ },
1658
+ children: "Remover recurso"
1659
+ }) : /* @__PURE__ */ D(i, {
1660
+ onClick: async () => {
1661
+ await n(e), o();
1662
+ },
1663
+ children: "Adquirir recurso"
1664
+ }) })
1665
+ ]
1666
+ });
1667
+ }
1668
+ //#endregion
1669
+ //#region src/components/recursosDialog/recurso/recurso.styles.ts
1670
+ var Xt = v("div")`
127
1671
  display: flex;
128
1672
  padding: 1rem;
129
1673
  gap: 1rem;
130
1674
  min-height: 10rem;
131
- border: 1px solid ${ve.neutral[50]};
1675
+ border: 1px solid ${L.neutral[50]};
132
1676
  border-radius: 6px;
133
- background-color: ${({recursoContratado:o})=>o?ve.neutral[30]:ve.neutral[0]};
1677
+ background-color: ${({ recursoContratado: e }) => e ? L.neutral[30] : L.neutral[0]};
134
1678
  transition: 200ms;
135
1679
 
136
- ${({emDestaque:o,theme:e})=>o&&Oa`
137
- border: 1px solid ${e.palette.primary.main};
1680
+ ${({ emDestaque: e, theme: t }) => e && _`
1681
+ border: 1px solid ${t.palette.primary.main};
138
1682
  box-shadow:
139
1683
  0px 0px 4px 0px rgba(0, 0, 0, 0.25),
140
1684
  0px 0px 1px 0px rgba(0, 0, 0, 0.03);
141
1685
  `}
142
1686
 
143
1687
  :hover {
144
- background-color: ${({recursoContratado:o})=>o&&ve.neutral[50]};
145
- border: 1px solid ${({recursoContratado:o,theme:e})=>!o&&e?.palette?.primary?.main};
1688
+ background-color: ${({ recursoContratado: e }) => e && L.neutral[50]};
1689
+ border: 1px solid ${({ recursoContratado: e, theme: t }) => !e && t?.palette?.primary?.main};
146
1690
  }
147
- `,ja=ar("img")`
1691
+ `, Zt = v("img")`
148
1692
  height: 3.5rem;
149
1693
  width: 3.5rem;
150
1694
 
151
- cursor: ${({hasGif:o})=>o?"pointer":void 0};
152
- `,Ha=ar("div")`
1695
+ cursor: ${({ hasGif: e }) => e ? "pointer" : void 0};
1696
+ `, Qt = v("div")`
153
1697
  display: flex;
154
1698
  justify-content: space-between;
155
1699
  align-items: center;
156
1700
  margin-top: 0.5rem;
157
1701
 
158
- ${({emDestaque:o})=>o&&Oa`
1702
+ ${({ emDestaque: e }) => e && _`
159
1703
  justify-content: end;
160
1704
  gap: 0.5rem;
161
1705
  `}
@@ -168,11 +1712,334 @@ import Mr from"axios";var Le=class{axiosSistema;axiosControle;listeners=new Set;
168
1712
  width: 100%;
169
1713
  }
170
1714
  }
171
- `;import{Fragment as vn,jsx as q,jsxs as So}from"react/jsx-runtime";function tr({recurso:o,periodicidade:e,onClick:r,onAdquirir:a,onRemover:n}){let t=g(f=>f.telefoneCS),i=g(f=>f.telefoneSuporte),s=g(f=>f.recursosDialog.esconderValoresRecursos),m=o.valorRecurso===0&&o.recursoContratado,d=g(f=>f.recursosDialog.acaoSecundariaOnClickRecurso),c=g(f=>f.recursosDialog.naoPermitirRemoverRecursos),u=()=>m?q(vn,{}):o.recursoContratado?o.dataExclusaoRecurso?q(hn,{title:So(Bo,{variant:"bodySM",children:["Recurso dispon\xEDvel at\xE9 ",xn(o.dataExclusaoRecurso).format("DD/MM/YYYY")]}),children:q("div",{style:{padding:"0.3rem 0"},children:q(Bo,{variant:"bodySM",children:"Removido"})})}):q(Ya,{variant:"neutral",size:"small",startIcon:c?q(Se,{icon:Xa,size:"22px",removeMargin:!0}):void 0,onClick:f=>{f.stopPropagation(),c?io(t||i):n(o)},children:"Remover"}):q(Ya,{variant:o.emDestaque?"contained":"outlined",size:"small",fullWidth:s,startIcon:s&&q(Se,{icon:Xa,size:"22px",removeMargin:!0}),onClick:f=>{s?io(t||i):(f.stopPropagation(),a(o)),d?.()},children:s?"Quero saber mais":"Adquirir"});return So(_a,{recursoContratado:o.recursoContratado,emDestaque:o.emDestaque,onClick:()=>o.gif&&r(o),children:[q("div",{children:q(ja,{src:o.caminhoImagem,hasGif:!!o.gif})}),So("div",{style:{display:"flex",flexDirection:"column",justifyContent:"space-between",flex:1},children:[So("div",{children:[So("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"0.1rem"},children:[q(Bo,{variant:"titleSM",children:o.nomeRecurso}),o.recursoContratado&&q(Se,{icon:Pn,size:"24px",color:Ua.green[500]}),o.emDestaque&&q(Se,{icon:bn,size:"24px",color:Ua.yellow[300]})]}),q(Bo,{variant:"bodySM",children:o.descricaoRecurso})]}),So(Ha,{emDestaque:o.emDestaque,children:[m?q(Bo,{variant:"titleXS",sx:{padding:"0.3rem 0"},children:"Recurso incluso"}):!s&&So(Bo,{variant:"titleXS",children:[Cn.format(o.valorRecurso),"/",e]}),u()]})]})]})}import{useMutation as Ka,useQuery as Sn}from"@tanstack/react-query";import{useMemo as Dn,useState as Rn}from"react";var Mn=()=>{let[o,e]=Rn(null),r=S(),a=Sn(r.buscarMeuPlanoRecursos()),n=a.data?.data.data,t=Ka(r.contratarRecurso()),i=Ka(r.descontratarRecurso()),s=n?.recursos,m=n?.periodicidade??null,d=g(b=>b.sistemaNome),c=g(b=>b.telefoneSuporte),u=g(b=>b.telefoneCS),f=g(b=>b.recursosDialog.recursosGifs),x=g(b=>b.recursosDialog.recursoEmDestaque),p=g(b=>b.recursosDialog.onContratarRecurso),h=g(b=>b.recursosDialog.onRemoverRecurso),l=oo(b=>b.setLoading),{handleErrors:y,setNotification:v}=G(),F=V(m),Q=Dn(()=>{let b={contratados:[],naoContratados:[]};return s?.forEach(E=>{let ro=f?.find(P=>P.slug===E.slugRecurso)?.gif||null;E.recursoContratado?b.contratados.push({...E,gif:ro,emDestaque:!1}):b.naoContratados.push({...E,gif:ro,emDestaque:E.slugRecurso===x})}),x&&b.naoContratados.sort(E=>E.emDestaque?-1:1),b},[s,f,x]),Po=async b=>{try{l(!0),await t.mutateAsync(b.codigoRecurso),a.refetch(),v({title:"Novo recurso adquirido"}),l(!1),p?.(b)}catch(E){y(E)}},bo=async b=>{try{l(!0),await i.mutateAsync(b.codigoRecurso),a.refetch(),v({title:"O recurso foi removido"}),l(!1),h?.(b)}catch(E){y(E)}},Eo=()=>e(null),po=b=>e({open:"gif",recurso:b}),C=b=>e({open:"confirmacaoAdquirir",recurso:b}),L=b=>e({open:"confirmacaoRemover",recurso:b});return{sistemaNome:d,isFetched:a.isFetched,telefoneSuporte:c,telefoneCS:u,recursos:Q,periodicidadeLabel:F,handleClickRecurso:po,openedDialog:o,handleCloseDialog:Eo,handleAdquirirRecurso:C,handleRemoverRecurso:L,adquirirRecurso:Po,removerRecurso:bo}},Ja=Mn;import{Fragment as rt,jsx as R,jsxs as Do}from"react/jsx-runtime";function Re({onClose:o}){let{sistemaNome:e,isFetched:r,telefoneSuporte:a,telefoneCS:n,recursos:t,periodicidadeLabel:i,handleClickRecurso:s,openedDialog:m,handleAdquirirRecurso:d,handleCloseDialog:c,handleRemoverRecurso:u,adquirirRecurso:f,removerRecurso:x}=Ja(),{open:p,onCloseDialog:h}=H(o);return Do(rt,{children:[Do(De,{open:p,onClose:h,fullWidth:!0,maxWidth:"lg",closeIcon:!0,disableBackdropClick:!0,children:[Do(De.Header,{children:["Recursos ",e]}),r?Do(rt,{children:[R(De.Content,{style:{marginTop:"1rem"},children:Do(so,{container:!0,spacing:2,children:[Do(so,{size:12,sx:{display:"flex",alignItems:"center"},children:[R(ot,{variant:"titleSM",children:"Recursos feitos para ajudar voc\xEA"}),R(Za,{sx:{flex:1,marginLeft:"1rem",color:et.neutral[30]}})]}),R(so,{size:12,children:R(so,{container:!0,spacing:2,children:t.naoContratados.length?t.naoContratados.map(l=>R(so,{size:{xs:12,sm:l.emDestaque?12:6},children:R(tr,{recurso:l,periodicidade:i,onClick:s,onAdquirir:d,onRemover:u})},l.codigoRecurso)):R(qa,{})})}),Do(so,{size:12,sx:{display:"flex",alignItems:"center"},children:[R(ot,{variant:"titleSM",children:"Recursos que voc\xEA j\xE1 adquiriu"}),R(Za,{sx:{flex:1,marginLeft:"1rem",color:et.neutral[30]}})]}),R(so,{size:12,children:R(so,{container:!0,spacing:2,children:t.contratados.map(l=>R(so,{size:{xs:12,sm:6},children:R(tr,{recurso:l,periodicidade:i,onClick:s,onAdquirir:d,onRemover:u})},l.codigoRecurso))})})]})}),R(De.Footer,{children:R(Tn,{variant:"outlined",color:"neutral",startIcon:R(In,{icon:En,size:"22px",removeMargin:!0}),onClick:()=>io(n||a),children:"Preciso de Ajuda"})})]}):R("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"20vh"},children:R(An,{})})]}),m?.open==="gif"&&R($a,{recurso:m.recurso,onClose:c,onAdquirirRecurso:f,onRemoverRecurso:x}),m?.open==="confirmacaoAdquirir"&&R(ka,{recurso:m.recurso,onClose:c,onConfirmar:f}),m?.open==="confirmacaoRemover"&&R(La,{recurso:m.recurso,onClose:c,onRemover:x})]})}import{jsx as at}from"react/jsx-runtime";function Gn({onClose:o,onNotification:e}){return at(to,{onNotification:e,children:at(Re,{onClose:o})})}import{QueryClient as Fn,QueryClientProvider as zn}from"@tanstack/react-query";import{useState as kn}from"react";import{jsx as wn}from"react/jsx-runtime";function ir({children:o}){let[e]=kn(()=>new Fn({defaultOptions:{queries:{retry:1,staleTime:3e5,gcTime:3e5}}}));return wn(zn,{client:e,children:o})}var nr=class{axiosSistemaPublico;constructor(e){this.axiosSistemaPublico=e}confirmarEmailEmpresa(e){return this.axiosSistemaPublico.post(`/meus-dados/confirmar-atualizacao-do-email-da-empresa/${e}`)}confirmarEmailResponsavel(e){return this.axiosSistemaPublico.post(`/meus-dados/confirmar-atualizacao-do-email-do-responsavel/${e}`)}};import{Button as qn,Typography as Vn}from"@mui/material";import{styled as tt}from"@mui/material";import{Grid as it}from"@mui/material";var nt=tt(it)`
1715
+ `;
1716
+ //#endregion
1717
+ //#region src/components/recursosDialog/recurso/recurso.tsx
1718
+ function $t({ recurso: e, periodicidade: t, onClick: n, onAdquirir: r, onRemover: a }) {
1719
+ let o = q((e) => e.telefoneCS), s = q((e) => e.telefoneSuporte), c = q((e) => e.recursosDialog.esconderValoresRecursos), l = e.valorRecurso === 0 && e.recursoContratado, u = q((e) => e.recursosDialog.acaoSecundariaOnClickRecurso), d = q((e) => e.recursosDialog.naoPermitirRemoverRecursos);
1720
+ return /* @__PURE__ */ O(Xt, {
1721
+ recursoContratado: e.recursoContratado,
1722
+ emDestaque: e.emDestaque,
1723
+ onClick: () => e.gif && n(e),
1724
+ children: [/* @__PURE__ */ D("div", { children: /* @__PURE__ */ D(Zt, {
1725
+ src: e.caminhoImagem,
1726
+ hasGif: !!e.gif
1727
+ }) }), /* @__PURE__ */ O("div", {
1728
+ style: {
1729
+ display: "flex",
1730
+ flexDirection: "column",
1731
+ justifyContent: "space-between",
1732
+ flex: 1
1733
+ },
1734
+ children: [/* @__PURE__ */ O("div", { children: [/* @__PURE__ */ O("div", {
1735
+ style: {
1736
+ display: "flex",
1737
+ justifyContent: "space-between",
1738
+ marginBottom: "0.1rem"
1739
+ },
1740
+ children: [
1741
+ /* @__PURE__ */ D(g, {
1742
+ variant: "titleSM",
1743
+ children: e.nomeRecurso
1744
+ }),
1745
+ e.recursoContratado && /* @__PURE__ */ D(S, {
1746
+ icon: ke,
1747
+ size: "24px",
1748
+ color: L.green[500]
1749
+ }),
1750
+ e.emDestaque && /* @__PURE__ */ D(S, {
1751
+ icon: oe,
1752
+ size: "24px",
1753
+ color: L.yellow[300]
1754
+ })
1755
+ ]
1756
+ }), /* @__PURE__ */ D(g, {
1757
+ variant: "bodySM",
1758
+ children: e.descricaoRecurso
1759
+ })] }), /* @__PURE__ */ O(Qt, {
1760
+ emDestaque: e.emDestaque,
1761
+ children: [l ? /* @__PURE__ */ D(g, {
1762
+ variant: "titleXS",
1763
+ sx: { padding: "0.3rem 0" },
1764
+ children: "Recurso incluso"
1765
+ }) : !c && /* @__PURE__ */ O(g, {
1766
+ variant: "titleXS",
1767
+ children: [
1768
+ C.format(e.valorRecurso),
1769
+ "/",
1770
+ t
1771
+ ]
1772
+ }), l ? /* @__PURE__ */ D(E, {}) : e.recursoContratado ? e.dataExclusaoRecurso ? /* @__PURE__ */ D(h, {
1773
+ title: /* @__PURE__ */ O(g, {
1774
+ variant: "bodySM",
1775
+ children: ["Recurso disponível até ", B(e.dataExclusaoRecurso).format("DD/MM/YYYY")]
1776
+ }),
1777
+ children: /* @__PURE__ */ D("div", {
1778
+ style: { padding: "0.3rem 0" },
1779
+ children: /* @__PURE__ */ D(g, {
1780
+ variant: "bodySM",
1781
+ children: "Removido"
1782
+ })
1783
+ })
1784
+ }) : /* @__PURE__ */ D(i, {
1785
+ variant: "neutral",
1786
+ size: "small",
1787
+ startIcon: d ? /* @__PURE__ */ D(S, {
1788
+ icon: le,
1789
+ size: "22px",
1790
+ removeMargin: !0
1791
+ }) : void 0,
1792
+ onClick: (t) => {
1793
+ t.stopPropagation(), d ? Q(o || s) : a(e);
1794
+ },
1795
+ children: "Remover"
1796
+ }) : /* @__PURE__ */ D(i, {
1797
+ variant: e.emDestaque ? "contained" : "outlined",
1798
+ size: "small",
1799
+ fullWidth: c,
1800
+ startIcon: c && /* @__PURE__ */ D(S, {
1801
+ icon: le,
1802
+ size: "22px",
1803
+ removeMargin: !0
1804
+ }),
1805
+ onClick: (t) => {
1806
+ c ? Q(o || s) : (t.stopPropagation(), r(e)), u?.();
1807
+ },
1808
+ children: c ? "Quero saber mais" : "Adquirir"
1809
+ })]
1810
+ })]
1811
+ })]
1812
+ });
1813
+ }
1814
+ //#endregion
1815
+ //#region src/components/recursosDialog/useRecursosDialog.ts
1816
+ var en = () => {
1817
+ let [e, t] = I(null), n = J(), r = M(n.buscarMeuPlanoRecursos()), i = r.data?.data.data, a = j(n.contratarRecurso()), o = j(n.descontratarRecurso()), s = i?.recursos, c = i?.periodicidade ?? null, l = q((e) => e.sistemaNome), u = q((e) => e.telefoneSuporte), d = q((e) => e.telefoneCS), f = q((e) => e.recursosDialog.recursosGifs), p = q((e) => e.recursosDialog.recursoEmDestaque), m = q((e) => e.recursosDialog.onContratarRecurso), h = q((e) => e.recursosDialog.onRemoverRecurso), g = K((e) => e.setLoading), { handleErrors: _, setNotification: v } = X(), y = W(c), b = F(() => {
1818
+ let e = {
1819
+ contratados: [],
1820
+ naoContratados: []
1821
+ };
1822
+ return s?.forEach((t) => {
1823
+ let n = f?.find((e) => e.slug === t.slugRecurso)?.gif || null;
1824
+ t.recursoContratado ? e.contratados.push({
1825
+ ...t,
1826
+ gif: n,
1827
+ emDestaque: !1
1828
+ }) : e.naoContratados.push({
1829
+ ...t,
1830
+ gif: n,
1831
+ emDestaque: t.slugRecurso === p
1832
+ });
1833
+ }), p && e.naoContratados.sort((e) => e.emDestaque ? -1 : 1), e;
1834
+ }, [
1835
+ s,
1836
+ f,
1837
+ p
1838
+ ]);
1839
+ return {
1840
+ sistemaNome: l,
1841
+ isFetched: r.isFetched,
1842
+ telefoneSuporte: u,
1843
+ telefoneCS: d,
1844
+ recursos: b,
1845
+ periodicidadeLabel: y,
1846
+ handleClickRecurso: (e) => t({
1847
+ open: "gif",
1848
+ recurso: e
1849
+ }),
1850
+ openedDialog: e,
1851
+ handleCloseDialog: () => t(null),
1852
+ handleAdquirirRecurso: (e) => t({
1853
+ open: "confirmacaoAdquirir",
1854
+ recurso: e
1855
+ }),
1856
+ handleRemoverRecurso: (e) => t({
1857
+ open: "confirmacaoRemover",
1858
+ recurso: e
1859
+ }),
1860
+ adquirirRecurso: async (e) => {
1861
+ try {
1862
+ g(!0), await a.mutateAsync(e.codigoRecurso), r.refetch(), v({ title: "Novo recurso adquirido" }), g(!1), m?.(e);
1863
+ } catch (e) {
1864
+ _(e);
1865
+ }
1866
+ },
1867
+ removerRecurso: async (e) => {
1868
+ try {
1869
+ g(!0), await o.mutateAsync(e.codigoRecurso), r.refetch(), v({ title: "O recurso foi removido" }), g(!1), h?.(e);
1870
+ } catch (e) {
1871
+ _(e);
1872
+ }
1873
+ }
1874
+ };
1875
+ };
1876
+ //#endregion
1877
+ //#region src/components/recursosDialog/recursosDialog.tsx
1878
+ function tn({ onClose: e }) {
1879
+ let { sistemaNome: t, isFetched: n, telefoneSuporte: r, telefoneCS: a, recursos: o, periodicidadeLabel: u, handleClickRecurso: d, openedDialog: f, handleAdquirirRecurso: p, handleCloseDialog: m, handleRemoverRecurso: h, adquirirRecurso: _, removerRecurso: v } = en(), { open: y, onCloseDialog: x } = Z(e);
1880
+ return /* @__PURE__ */ O(E, { children: [
1881
+ /* @__PURE__ */ O(b, {
1882
+ open: y,
1883
+ onClose: x,
1884
+ fullWidth: !0,
1885
+ maxWidth: "lg",
1886
+ closeIcon: !0,
1887
+ disableBackdropClick: !0,
1888
+ children: [/* @__PURE__ */ O(b.Header, { children: ["Recursos ", t] }), n ? /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(b.Content, {
1889
+ style: { marginTop: "1rem" },
1890
+ children: /* @__PURE__ */ O(l, {
1891
+ container: !0,
1892
+ spacing: 2,
1893
+ children: [
1894
+ /* @__PURE__ */ O(l, {
1895
+ size: 12,
1896
+ sx: {
1897
+ display: "flex",
1898
+ alignItems: "center"
1899
+ },
1900
+ children: [/* @__PURE__ */ D(g, {
1901
+ variant: "titleSM",
1902
+ children: "Recursos feitos para ajudar você"
1903
+ }), /* @__PURE__ */ D(c, { sx: {
1904
+ flex: 1,
1905
+ marginLeft: "1rem",
1906
+ color: L.neutral[30]
1907
+ } })]
1908
+ }),
1909
+ /* @__PURE__ */ D(l, {
1910
+ size: 12,
1911
+ children: /* @__PURE__ */ D(l, {
1912
+ container: !0,
1913
+ spacing: 2,
1914
+ children: o.naoContratados.length ? o.naoContratados.map((e) => /* @__PURE__ */ D(l, {
1915
+ size: {
1916
+ xs: 12,
1917
+ sm: e.emDestaque ? 12 : 6
1918
+ },
1919
+ children: /* @__PURE__ */ D($t, {
1920
+ recurso: e,
1921
+ periodicidade: u,
1922
+ onClick: d,
1923
+ onAdquirir: p,
1924
+ onRemover: h
1925
+ })
1926
+ }, e.codigoRecurso)) : /* @__PURE__ */ D(qt, {})
1927
+ })
1928
+ }),
1929
+ /* @__PURE__ */ O(l, {
1930
+ size: 12,
1931
+ sx: {
1932
+ display: "flex",
1933
+ alignItems: "center"
1934
+ },
1935
+ children: [/* @__PURE__ */ D(g, {
1936
+ variant: "titleSM",
1937
+ children: "Recursos que você já adquiriu"
1938
+ }), /* @__PURE__ */ D(c, { sx: {
1939
+ flex: 1,
1940
+ marginLeft: "1rem",
1941
+ color: L.neutral[30]
1942
+ } })]
1943
+ }),
1944
+ /* @__PURE__ */ D(l, {
1945
+ size: 12,
1946
+ children: /* @__PURE__ */ D(l, {
1947
+ container: !0,
1948
+ spacing: 2,
1949
+ children: o.contratados.map((e) => /* @__PURE__ */ D(l, {
1950
+ size: {
1951
+ xs: 12,
1952
+ sm: 6
1953
+ },
1954
+ children: /* @__PURE__ */ D($t, {
1955
+ recurso: e,
1956
+ periodicidade: u,
1957
+ onClick: d,
1958
+ onAdquirir: p,
1959
+ onRemover: h
1960
+ })
1961
+ }, e.codigoRecurso))
1962
+ })
1963
+ })
1964
+ ]
1965
+ })
1966
+ }), /* @__PURE__ */ D(b.Footer, { children: /* @__PURE__ */ D(i, {
1967
+ variant: "outlined",
1968
+ color: "neutral",
1969
+ startIcon: /* @__PURE__ */ D(S, {
1970
+ icon: Fe,
1971
+ size: "22px",
1972
+ removeMargin: !0
1973
+ }),
1974
+ onClick: () => Q(a || r),
1975
+ children: "Preciso de Ajuda"
1976
+ }) })] }) : /* @__PURE__ */ D("div", {
1977
+ style: {
1978
+ display: "flex",
1979
+ justifyContent: "center",
1980
+ alignItems: "center",
1981
+ height: "20vh"
1982
+ },
1983
+ children: /* @__PURE__ */ D(s, {})
1984
+ })]
1985
+ }),
1986
+ f?.open === "gif" && /* @__PURE__ */ D(Yt, {
1987
+ recurso: f.recurso,
1988
+ onClose: m,
1989
+ onAdquirirRecurso: _,
1990
+ onRemoverRecurso: v
1991
+ }),
1992
+ f?.open === "confirmacaoAdquirir" && /* @__PURE__ */ D(Gt, {
1993
+ recurso: f.recurso,
1994
+ onClose: m,
1995
+ onConfirmar: _
1996
+ }),
1997
+ f?.open === "confirmacaoRemover" && /* @__PURE__ */ D(Kt, {
1998
+ recurso: f.recurso,
1999
+ onClose: m,
2000
+ onRemover: v
2001
+ })
2002
+ ] });
2003
+ }
2004
+ //#endregion
2005
+ //#region src/components/recursosDialog/recursosDialogExport.tsx
2006
+ function nn({ onClose: e, onNotification: t }) {
2007
+ return /* @__PURE__ */ D(Y, {
2008
+ onNotification: t,
2009
+ children: /* @__PURE__ */ D(tn, { onClose: e })
2010
+ });
2011
+ }
2012
+ //#endregion
2013
+ //#region src/context/minhaContaQueryProvider.tsx
2014
+ function rn({ children: e }) {
2015
+ let [t] = I(() => new de({ defaultOptions: { queries: {
2016
+ retry: 1,
2017
+ staleTime: 3e5,
2018
+ gcTime: 3e5
2019
+ } } }));
2020
+ return /* @__PURE__ */ D(fe, {
2021
+ client: t,
2022
+ children: e
2023
+ });
2024
+ }
2025
+ //#endregion
2026
+ //#region src/screens/confirmarEmail/api/index.ts
2027
+ var an = class {
2028
+ axiosSistemaPublico;
2029
+ constructor(e) {
2030
+ this.axiosSistemaPublico = e;
2031
+ }
2032
+ confirmarEmailEmpresa(e) {
2033
+ return this.axiosSistemaPublico.post(`/meus-dados/confirmar-atualizacao-do-email-da-empresa/${e}`);
2034
+ }
2035
+ confirmarEmailResponsavel(e) {
2036
+ return this.axiosSistemaPublico.post(`/meus-dados/confirmar-atualizacao-do-email-do-responsavel/${e}`);
2037
+ }
2038
+ }, on = v(l)`
172
2039
  height: 100vh;
173
2040
 
174
- background: ${({theme:o})=>o?.palette?.primary?.main};
175
- `,st=tt(it)`
2041
+ background: ${({ theme: e }) => e?.palette?.primary?.main};
2042
+ `, sn = v(l)`
176
2043
  display: flex;
177
2044
  flex-direction: column;
178
2045
  align-items: center;
@@ -181,15 +2048,86 @@ import Mr from"axios";var Le=class{axiosSistema;axiosControle;listeners=new Set;
181
2048
  background-color: #ffffff;
182
2049
  padding: 32px;
183
2050
  border-radius: 8px;
184
- `;import{useCallback as Ln,useLayoutEffect as Bn}from"react";var lt=o=>{let e=new URLSearchParams(window.location.search).get("token"),r=Ln(async a=>{try{a&&o.tipo==="empresa"?await o.api.confirmarEmailEmpresa(a):a&&o.tipo==="respons\xE1vel"&&await o.api.confirmarEmailResponsavel(a)}catch(n){let t=ie(n?.response?.data||n);o.onNotification({variant:"error",title:t[0]})}},[o.tipo,o.onNotification,o.api.confirmarEmailEmpresa,o.api.confirmarEmailResponsavel]);Bn(()=>{r(e)},[r,e])};import{jsx as go,jsxs as mt}from"react/jsx-runtime";function Nn(o){return lt(o),go(to,{onNotification:o.onNotification,children:go(nt,{container:!0,justifyContent:"center",alignItems:"center",children:mt(st,{size:{sm:5,md:4,lg:3},children:[go("div",{children:go("img",{src:o.imagem,alt:"E-mail confirmado",style:{width:"150px"}})}),go("div",{style:{display:"flex"},children:mt(Vn,{variant:"bodyXL",align:"center",children:["E-mail ",o.tipo==="empresa"?"da":"do"," ",o.tipo,go("br",{}),"alterado com sucesso!"]})}),go("div",{children:go(qn,{size:"large",onClick:o.onSubmit,children:"Continuar para o sistema"})})]})})})}import{useState as xs}from"react";import{IconButton as vs,LIcon as dr}from"@s_mart/core";import{DataTable as Ss,List as St}from"@s_mart/data";import{valor as Ds}from"@s_mart/masks";import{lineClock as Rs,lineReceipt as Ms}from"@s_mart/regular-icons";import{linePen as As}from"@s_mart/solid-icons";import{colorPalette as Yo}from"@s_mart/tokens";import{Alert as Ts,Button as Is,Card as Es,Chip as Gs,CircularProgress as Fs,Grid as Vo,Typography as Ao,useMediaQuery as zs}from"@mui/material";import ks from"dayjs";import{css as Qn,styled as Wn}from"@mui/material";import{Paper as $n}from"@mui/material";import{colorPalette as On}from"@s_mart/tokens";var Me=Wn($n)`
185
- background-color: ${On.neutral[0]};
2051
+ `, cn = (e) => {
2052
+ let t = new URLSearchParams(window.location.search).get("token"), n = P(async (t) => {
2053
+ try {
2054
+ t && e.tipo === "empresa" ? await e.api.confirmarEmailEmpresa(t) : t && e.tipo === "responsável" && await e.api.confirmarEmailResponsavel(t);
2055
+ } catch (t) {
2056
+ let n = vt(t?.response?.data || t);
2057
+ e.onNotification({
2058
+ variant: "error",
2059
+ title: n[0]
2060
+ });
2061
+ }
2062
+ }, [
2063
+ e.tipo,
2064
+ e.onNotification,
2065
+ e.api.confirmarEmailEmpresa,
2066
+ e.api.confirmarEmailResponsavel
2067
+ ]);
2068
+ ve(() => {
2069
+ n(t);
2070
+ }, [n, t]);
2071
+ };
2072
+ //#endregion
2073
+ //#region src/screens/confirmarEmail/confirmarEmail.tsx
2074
+ function ln(e) {
2075
+ return cn(e), /* @__PURE__ */ D(Y, {
2076
+ onNotification: e.onNotification,
2077
+ children: /* @__PURE__ */ D(on, {
2078
+ container: !0,
2079
+ sx: {
2080
+ justifyContent: "center",
2081
+ alignItems: "center"
2082
+ },
2083
+ children: /* @__PURE__ */ O(sn, {
2084
+ size: {
2085
+ sm: 5,
2086
+ md: 4,
2087
+ lg: 3
2088
+ },
2089
+ children: [
2090
+ /* @__PURE__ */ D("div", { children: /* @__PURE__ */ D("img", {
2091
+ src: e.imagem,
2092
+ alt: "E-mail confirmado",
2093
+ style: { width: "150px" }
2094
+ }) }),
2095
+ /* @__PURE__ */ D("div", {
2096
+ style: { display: "flex" },
2097
+ children: /* @__PURE__ */ O(g, {
2098
+ variant: "bodyXL",
2099
+ align: "center",
2100
+ children: [
2101
+ "E-mail ",
2102
+ e.tipo === "empresa" ? "da" : "do",
2103
+ " ",
2104
+ e.tipo,
2105
+ /* @__PURE__ */ D("br", {}),
2106
+ "alterado com sucesso!"
2107
+ ]
2108
+ })
2109
+ }),
2110
+ /* @__PURE__ */ D("div", { children: /* @__PURE__ */ D(i, {
2111
+ size: "large",
2112
+ onClick: e.onSubmit,
2113
+ children: "Continuar para o sistema"
2114
+ }) })
2115
+ ]
2116
+ })
2117
+ })
2118
+ });
2119
+ }
2120
+ //#endregion
2121
+ //#region src/shared/styles.ts
2122
+ var un = v(d)`
2123
+ background-color: ${L.neutral[0]};
186
2124
  box-shadow: 0px 3px 12px rgba(0, 0, 0, 0.12);
187
2125
  border-radius: 8px;
188
2126
  padding: 1.5rem;
189
2127
 
190
- height: ${({height:o})=>o};
2128
+ height: ${({ height: e }) => e};
191
2129
 
192
- ${({centerContent:o})=>!!o&&Qn`
2130
+ ${({ centerContent: e }) => !!e && _`
193
2131
  display: flex;
194
2132
  justify-content: center;
195
2133
  align-items: center;
@@ -199,12 +2137,1379 @@ import Mr from"axios";var Le=class{axiosSistema;axiosControle;listeners=new Set;
199
2137
  padding: 1rem;
200
2138
  box-shadow: none;
201
2139
  }
202
- `;import{InputAdornment as Kn,Skeleton as pt,Typography as Jn}from"@mui/material";import{Button as sr,Dialog as Ae,IconButton as Zn,LIcon as dt}from"@s_mart/core";import{TextField as os}from"@s_mart/form";import{lineTrashAlt as es}from"@s_mart/regular-icons";import{composeValidators as rs,email as as,requiredWithTrim as ts}from"@s_mart/rules";import{linePlus as is}from"@s_mart/solid-icons";import{colorPalette as Te}from"@s_mart/tokens";import{FormProvider as ns}from"react-hook-form";import{useMutation as _n,useQuery as jn,useQueryClient as Hn}from"@tanstack/react-query";import{useCallback as Yn}from"react";import{useFieldArray as Xn,useForm as Un}from"react-hook-form";var ct=({onClose:o})=>{let e=S(),r=Hn(),a=jn(e.buscarMeusDados()),{setNotification:n,handleErrors:t}=G(),i=_n({...e.atualizarEmailCobrancas(),onSuccess(){o(),n({title:"Email de cobran\xE7a atualizado com sucesso!",variant:"success"})},onError:t.bind(null)}),s=Un({async defaultValues(){let p=[];return(await r.ensureQueryData(e.buscarMeusDados())).data.data.emailCobranca?.split(";").map(l=>{p.push({email:l.trim()})}),{emails:p}}}),{fields:m,remove:d,append:c}=Xn({name:"emails",control:s.control}),u=m.length===3,f=Yn(async p=>s.handleSubmit(async h=>{let l=h.emails.map(y=>y.email).join(";");await i.mutateAsync({emails:l}),await a.refetch()})(p),[s.handleSubmit,i.mutateAsync,a.refetch]);return{fields:m,remove:d,append:c,maxFields:u,handleFormSubmit:f,emailUnico:p=>({validate:{emailUnico:h=>{let l=s.getValues("emails");if(l.filter(v=>!!v.email&&v.email===h).length>1&&p===l.findLastIndex(v=>v.email===h))return"E-mail j\xE1 inserido"}}}),form:s}};import{jsx as k,jsxs as Ho}from"react/jsx-runtime";var ss=({onClose:o})=>{let{append:e,fields:r,remove:a,maxFields:n,form:t,handleFormSubmit:i,emailUnico:s}=ct({onClose:o});return k(Ae,{open:!0,fullWidth:!0,closeIcon:!0,disableBackdropClick:!0,onClose:o,children:k(ns,{...t,children:Ho("form",{onSubmit:i,children:[k(Ae.Header,{children:"E-mails para recebimento dos boletos"}),k(Ae.Content,{children:t.formState.isLoading?Ho("div",{style:{display:"flex",flexDirection:"column"},children:[k(pt,{height:"3rem"}),k(pt,{height:"3rem"})]}):Ho("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[r.map((m,d)=>Ho("div",{style:{display:"flex",gap:"0.5rem"},children:[k("div",{style:{display:"flex",alignItems:"center",padding:"0 0.8rem",borderRadius:"4px",color:Te.neutral[0],backgroundColor:Te.neutral[100]},children:k(Jn,{variant:"bodyXS",children:d+1})}),k("div",{style:{flex:1},children:k(os,{name:`emails.${d}.email`,placeholder:"Informe o e-mail",required:!0,rules:rs([ts,as,s(d)]),autoComplete:"on",slotProps:{htmlInput:{name:"pesquisar"},input:{endAdornment:d>0&&k(Kn,{position:"end",children:k(Zn,{onClick:()=>a(d),variant:"text",children:k(dt,{size:"24px",icon:es,color:Te.neutral[100]})})})}}})})]},m.id)),!n&&k(sr,{color:"neutral",variant:"dashed",fullWidth:!0,onClick:()=>e({email:""}),startIcon:k(dt,{removeMargin:!0,icon:is,color:Te.neutral[100]}),children:"Adicionar outro e-mail"})]})}),Ho(Ae.Footer,{children:[k(sr,{variant:"neutral",onClick:o,children:"Cancelar"}),k(sr,{type:"submit",disabled:!t.formState.isDirty,children:"Salvar"})]})]})})})},ut=ss;import{Grid as Ie,Paper as ls,Typography as ft}from"@mui/material";import{jsx as Ro,jsxs as ms}from"react/jsx-runtime";function gt(){let o=g(e=>e.meuPlano.faturasEmptyStateImg);return Ro(ls,{elevation:2,sx:{padding:"1rem",borderRadius:".5rem"},children:ms(Ie,{container:!0,spacing:2,sx:{flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"25rem"},children:[!!o&&Ro(Ie,{children:Ro("img",{src:o})}),Ro(Ie,{textAlign:"center",children:Ro(ft,{variant:"titleMD",children:"Nenhuma fatura para mostrar"})}),Ro(Ie,{children:Ro(ft,{variant:"bodyMD",children:"Voc\xEA n\xE3o possui faturas."})})]})})}import{Button as cs,Chip as ps,Tooltip as ds,Typography as yt}from"@mui/material";import{LIcon as us}from"@s_mart/core";import{valor as fs}from"@s_mart/masks";import{lineInfoCircle as gs}from"@s_mart/solid-icons";import{colorPalette as qo}from"@s_mart/tokens";import{downloadFile as lr}from"@s_mart/utils";import{useQuery as ht,useQueryClient as ys}from"@tanstack/react-query";import lo from"dayjs";import hs from"dayjs/plugin/utc";import{useCallback as Ee,useMemo as mr}from"react";import{jsx as Mo}from"react/jsx-runtime";lo.extend(hs);var Cs=()=>{let{handleErrors:o}=G(),e=oo(l=>l.setLoading),r=g(l=>l.meuPlano.exibirAbrirFatura),a=ys(),n=S(),t=ht(n.buscarMeusDados()),i=ht({...n.listarCobrancas(),select:l=>l.data.data.toReversed()}),s=t.data?.data.data.emailCobranca,m=i.data,d=mr(()=>{if(s){let l=s.split(";"),y=l.length-1;return`${l[0]} ${y>0?`e mais ${y}`:""}`}},[s]),c=mr(()=>{let l=null;return i.isFetching?l="loading":m&&!m.length?l="empty":l=null,l},[i.isFetching,m]),u=Ee(l=>{switch(l.situacao){case"EMITIDO":{let y=lo().startOf("day"),v=lo(l.dataVencimento?.replace("Z","")).startOf("day");return y.isAfter(v)&&(lo(v).day()===6?v=v.add(2,"d"):lo(v).day()===0&&(v=v.add(1,"d"))),y.isAfter(v)?{label:"Vencida",color:qo.red[100]}:{label:"A pagar",color:qo.neutral[30]}}case"LIQUIDADO":return{label:"Paga",color:qo.green[100]};case"ISENTADO":return{label:"Isenta",color:qo.neutral[50]};default:return{label:"",color:qo.neutral[0]}}},[]),f=Ee(async l=>{try{e(!0);let y=await a.ensureQueryData(n.buscarBoleto(l.identificador));y.data.data.boleto&&lr(y.data.data.boleto,`Boleto_${lo(l.dataEmissao).format("YYYY[_]MM")}.pdf`,"application/pdf")}catch(y){o(y)}finally{e(!1)}},[e,o,a.ensureQueryData,n.buscarBoleto]),x=Ee(async l=>{try{e(!0);let y=await a.ensureQueryData(n.buscarNfse(l.identificador));y.data.data&&(y.data.data.xml&&lr(y.data.data.xml,`Nota_XML_${lo(l.dataEmissao).format("YYYY[_]MM")}.xml`,"text/xml"),y.data.data.danfse?lr(y.data.data.danfse,`Nota_PDF_${lo(l.dataEmissao).format("YYYY[_]MM")}.pdf`,"application/pdf"):y.data.data.link_impressao_danfse&&window.open(y.data.data.link_impressao_danfse,"_blank","noopener=yes,noreferrer=yes"))}catch(y){o(y)}finally{e(!1)}},[a.ensureQueryData,e,o,n.buscarNfse]),p=Ee(l=>{switch(l.situacao){case"EMITIDO":return r?{button:!0,label:"Ver e pagar fatura",onClick:()=>{window.location.host.includes("staging")?window.open(l.linkFatura.replace("app","staging"),"_blank","noreferrer=yes,noopener=yes"):window.open(l.linkFatura,"_blank","noreferrer=yes,noopener=yes")}}:{label:"Baixar boleto",onClick:()=>f(l)};case"LIQUIDADO":return{label:"Baixar nota",onClick:()=>x(l)}}},[f,x,r]),h=mr(()=>[{field:"dataVencimento",headerName:"Vencimento",flex:2,minWidth:100,valueFormatter:l=>lo(l).utc().format("DD/MM/YYYY")},{field:"situacao",headerName:"Situa\xE7\xE3o",flex:5,minWidth:115,valueGetter:(l,y)=>u(y),renderCell:({value:l})=>Mo(ps,{label:l.label,style:{backgroundColor:l.color,minWidth:"6.5rem"}})},{field:"descricao",headerName:"Ref",renderCell:({value:l})=>Mo(ds,{title:Mo(yt,{variant:"bodySM",children:l}),children:Mo("div",{children:Mo(us,{icon:gs,color:qo.neutral[100]})})}),flex:1},{field:"valor",headerName:"Valor",flex:1.5,minWidth:130,renderCell:({formattedValue:l})=>Mo(yt,{variant:"titleXS",children:l}),valueFormatter:l=>fs.format(l)},{field:"acao",headerName:"A\xE7\xF5es",flex:1.5,minWidth:140,renderCell:({value:l})=>{if(l)return Mo(cs,{size:"small",color:l.button?void 0:"neutral",variant:l.button?"contained":"text",onClick:l.onClick,sx:{textDecoration:l.button?void 0:"underline"},children:l.label})},valueGetter:(l,y)=>p(y)}],[p,u]);return{cobrancas:m,tableStatus:c,tableColumns:h,listaEmailsCobranca:d,getActions:p,getSituacao:u,loading:i.isFetching}},Ct=Cs;import{useMemo as Ps}from"react";import{useQuery as cr}from"@tanstack/react-query";import pr from"dayjs";import bs from"dayjs/plugin/utc";import{Fragment as bt,jsx as Pt,jsxs as xt}from"react/jsx-runtime";pr.extend(bs);var vt=()=>{let o=S(),e=cr(o.buscarMeuPlanoRecursos()),r=cr(o.listarCobrancas()),a=cr(o.buscarMeusDados()),n=r.data?.data.data,t=e.data?.data.data,i=a.data?.data.data;return Ps(()=>{if(!n||!t?.dataFimUltimaFatura)return null;let s=pr(t?.dataFimUltimaFatura).utc().startOf("day");return t.tipoCobranca===2&&(s=s.add(1,"month").startOf("month")),i?.dataBloqueio&&pr().isAfter(s)?t.tipoCobranca===2?null:xt(bt,{children:[Pt("b",{children:"Pr\xF3xima fatura"}),": ser\xE1 gerada em at\xE9 24 horas ap\xF3s o pagamento da fatura em atraso"]}):(s.day()===5?s=s.set("hour",12):s=s.set("hour",19),xt(bt,{children:[Pt("b",{children:"Pr\xF3xima fatura"}),": ser\xE1 gerada em ",s.format("DD/MM/YYYY[, \xE0s ]HH:mm")]}))},[n,t,i?.dataBloqueio])};import{Fragment as ws,jsx as D,jsxs as yo}from"react/jsx-runtime";function ur(){let{cobrancas:o,tableStatus:e,tableColumns:r,listaEmailsCobranca:a,getActions:n,getSituacao:t,loading:i}=Ct(),s=vt(),[m,d]=xs(!1),c=zs("(max-width: 700px)");return i?D(Me,{centerContent:!0,height:"60vh",children:D(Fs,{})}):e==="empty"?D(gt,{}):yo(ws,{children:[D(Es,{sx:{padding:"1rem"},children:yo(Vo,{container:!0,spacing:2,children:[yo(Vo,{size:12,sx:{display:"flex",alignItems:"center"},children:[D(dr,{icon:Ms,size:"25px"}),D(Ao,{variant:"titleSM",children:"Gerenciamento de faturas"})]}),yo(Vo,{size:12,sx:{display:"flex",alignItems:"center",gap:1},children:[yo(Ao,{variant:"bodySM",children:["Boletos enviados para: ",c&&D("br",{})," ",D("strong",{children:a})]}),D(vs,{size:"small",variant:"neutral",onClick:()=>d(!0),children:D(dr,{icon:As,size:"21px",removeMargin:!0})})]}),!!s&&D(Vo,{size:12,children:D(Ts,{color:"info",icon:D(dr,{size:"21px",removeMargin:!0,icon:Rs}),children:D(Ao,{color:"info",children:s})})}),c?D(Vo,{size:12,children:D(St.Root,{data:o??[],isLoading:e==="loading",children:o?.map((u,f)=>{let x=t(u),p=n(u),h=x.label==="Vencida";return yo(St.ListItem,{index:f,style:{width:"calc(100% + 2rem)",marginLeft:"-1rem",padding:"1.5rem 1rem",backgroundColor:h?"#FFE3E3":void 0},children:[yo("div",{style:{display:"flex",justifyContent:"space-between"},children:[D(Gs,{label:x.label,size:"small",style:{backgroundColor:x.color,minWidth:"6.5rem"}}),D(Ao,{variant:"bodySM",color:h?Yo.red[300]:void 0,children:ks(u.dataVencimento).format("DD/MM/YYYY")})]}),D("div",{style:{margin:"0.75rem 0"},children:D(Ao,{variant:"bodyXS",color:h?Yo.neutral[500]:Yo.neutral[100],children:u.descricao})}),yo("div",{style:{display:"flex",justifyContent:"space-between"},children:[D(Ao,{variant:"titleXS",color:h?Yo.red[300]:void 0,children:Ds.format(u.valor)}),!!p&&(p.button?D(Is,{style:{marginTop:"0.5rem"},onClick:p.onClick,children:p.label}):D(Ao,{variant:"bodySM",color:h?Yo.red[300]:void 0,fontWeight:h?700:void 0,style:{textDecorationLine:"underline",cursor:"pointer"},onClick:p.onClick,children:p.label}))]})]},u.identificador||u.dataVencimento)})})}):D(Vo,{size:12,sx:{overflow:"auto",maxHeight:"65vh","@media(max-height: 750px)":{maxHeight:"60vh"}},children:D(Ss,{rows:o??[],loading:e==="loading",columns:r,getRowId:u=>u.identificador||u.dataVencimento,disableRowSelectionOnClick:!0,resizeThrottleMs:1e3})})]})}),m&&D(ut,{onClose:()=>d(!1)})]})}import{Grid as gr,Paper as Os}from"@mui/material";import{memo as _s,useState as js}from"react";import{Grid as Ls,Typography as Bs}from"@mui/material";import{LIcon as qs}from"@s_mart/core";import{lineExternalLink as Vs}from"@s_mart/solid-icons";import{colorPalette as Ns}from"@s_mart/tokens";import{jsx as fr,jsxs as Qs}from"react/jsx-runtime";function Dt({link:o}){return fr(Ls,{sx:{display:"flex",marginTop:"1.5rem"},children:Qs("a",{href:o,rel:"noopener noreferrer",target:"_blank",style:{display:"flex",alignItems:"center",color:Ns.neutral[100]},children:[fr(Bs,{variant:"bodySM",children:"Termos de uso"}),fr(qs,{icon:Vs})]})})}import{useEffect as Ws}from"react";var $s=()=>{let o=g(a=>a.meuPlano.linkTermosDeUso),e=g(a=>a.meuPlano.onRenderTabMeuPlano),r=g(a=>a.meuPlano.esconderInformacoesPlano);return Ws(()=>{e?.()},[e]),{linkTermosDeUso:o,esconderInformacoesPlano:r}},Rt=$s;import{Fragment as Ys,jsx as To,jsxs as yr}from"react/jsx-runtime";function Hs(){let{linkTermosDeUso:o,esconderInformacoesPlano:e}=Rt(),[r,a]=js(null),n=g(i=>i.meuPlano.esconderPlanos),t=g(i=>i.meuPlano.esconderLojaDeRecursos);return yr(Ys,{children:[To(Os,{elevation:2,sx:{padding:"1rem"},children:yr(gr,{container:!0,spacing:4,children:[!e&&yr(gr,{size:{xs:12,md:5,lg:4,xl:3},children:[To(Qe,{onClickButtonPlanos:()=>a("planos"),onClickButtonLojaRecursos:()=>a("recursos"),exibirLojaRecursos:!t,exibirPlanos:!n}),!!o&&To(Dt,{link:o})]}),To(gr,{size:{xs:12,md:7,lg:8,xl:6},children:To(ur,{})})]})}),r==="recursos"&&To(Re,{onClose:()=>a(null)}),r==="planos"&&To(de,{onClose:()=>a(null)})]})}var hr=_s(Hs);import{Grid as Dr,Tab as Ot,Tabs as nm}from"@mui/material";import{CircularProgress as Jl,Divider as Sr,Grid as Co,Paper as Zl,useMediaQuery as om}from"@mui/material";import{memo as em}from"react";import{FormProvider as rm}from"react-hook-form";import{LIcon as il}from"@s_mart/core";import{DatePicker as nl,TextField as Io}from"@s_mart/form";import{composeValidators as Xo,cpfCnpj as sl,email as ll,maxLength as At,required as Uo,telefone as ml}from"@s_mart/rules";import{lineSync as cl}from"@s_mart/solid-icons";import{CircularProgress as pl,Grid as eo,Tooltip as dl,Typography as Tt}from"@mui/material";import{styled as Xs}from"@mui/material";import{Typography as Us}from"@mui/material";var Cr=Xs(Us)`
203
- color: ${o=>o?.theme?.palette?.primary?.main};
2140
+ `, dn = ({ onClose: e }) => {
2141
+ let t = J(), n = N(), r = M(t.buscarMeusDados()), { setNotification: i, handleErrors: a } = X(), o = j({
2142
+ ...t.atualizarEmailCobrancas(),
2143
+ onSuccess() {
2144
+ e(), i({
2145
+ title: "Email de cobrança atualizado com sucesso!",
2146
+ variant: "success"
2147
+ });
2148
+ },
2149
+ onError: a.bind(null)
2150
+ }), s = Re({ async defaultValues() {
2151
+ let e = [];
2152
+ return (await n.ensureQueryData(t.buscarMeusDados())).data.data.emailCobranca?.split(";").map((t) => {
2153
+ e.push({ email: t.trim() });
2154
+ }), { emails: e };
2155
+ } }), { fields: c, remove: l, append: u } = Le({
2156
+ name: "emails",
2157
+ control: s.control
2158
+ });
2159
+ return {
2160
+ fields: c,
2161
+ remove: l,
2162
+ append: u,
2163
+ maxFields: c.length === 3,
2164
+ handleFormSubmit: P(async (e) => s.handleSubmit(async (e) => {
2165
+ let t = e.emails.map((e) => e.email).join(";");
2166
+ await o.mutateAsync({ emails: t }), await r.refetch();
2167
+ })(e), [
2168
+ s.handleSubmit,
2169
+ o.mutateAsync,
2170
+ r.refetch
2171
+ ]),
2172
+ emailUnico: (e) => ({ validate: { emailUnico: (t) => {
2173
+ let n = s.getValues("emails");
2174
+ if (n.filter((e) => !!e.email && e.email === t).length > 1 && e === n.findLastIndex((e) => e.email === t)) return "E-mail já inserido";
2175
+ } } }),
2176
+ form: s
2177
+ };
2178
+ }, fn = ({ onClose: e }) => {
2179
+ let { append: t, fields: n, remove: r, maxFields: a, form: o, handleFormSubmit: s, emailUnico: c } = dn({ onClose: e });
2180
+ return /* @__PURE__ */ D(b, {
2181
+ open: !0,
2182
+ fullWidth: !0,
2183
+ closeIcon: !0,
2184
+ disableBackdropClick: !0,
2185
+ onClose: e,
2186
+ children: /* @__PURE__ */ D(Ie, {
2187
+ ...o,
2188
+ children: /* @__PURE__ */ O("form", {
2189
+ onSubmit: s,
2190
+ children: [
2191
+ /* @__PURE__ */ D(b.Header, { children: "E-mails para recebimento dos boletos" }),
2192
+ /* @__PURE__ */ D(b.Content, { children: o.formState.isLoading ? /* @__PURE__ */ O("div", {
2193
+ style: {
2194
+ display: "flex",
2195
+ flexDirection: "column"
2196
+ },
2197
+ children: [/* @__PURE__ */ D(f, { height: "3rem" }), /* @__PURE__ */ D(f, { height: "3rem" })]
2198
+ }) : /* @__PURE__ */ O("div", {
2199
+ style: {
2200
+ display: "flex",
2201
+ flexDirection: "column",
2202
+ gap: "1rem"
2203
+ },
2204
+ children: [n.map((e, t) => /* @__PURE__ */ O("div", {
2205
+ style: {
2206
+ display: "flex",
2207
+ gap: "0.5rem"
2208
+ },
2209
+ children: [/* @__PURE__ */ D("div", {
2210
+ style: {
2211
+ display: "flex",
2212
+ alignItems: "center",
2213
+ padding: "0 0.8rem",
2214
+ borderRadius: "4px",
2215
+ color: L.neutral[0],
2216
+ backgroundColor: L.neutral[100]
2217
+ },
2218
+ children: /* @__PURE__ */ D(g, {
2219
+ variant: "bodyXS",
2220
+ children: t + 1
2221
+ })
2222
+ }), /* @__PURE__ */ D("div", {
2223
+ style: { flex: 1 },
2224
+ children: /* @__PURE__ */ D(R, {
2225
+ name: `emails.${t}.email`,
2226
+ placeholder: "Informe o e-mail",
2227
+ required: !0,
2228
+ rules: V([
2229
+ Ge,
2230
+ We,
2231
+ c(t)
2232
+ ]),
2233
+ autoComplete: "on",
2234
+ slotProps: {
2235
+ htmlInput: { name: "pesquisar" },
2236
+ input: { endAdornment: t > 0 && /* @__PURE__ */ D(u, {
2237
+ position: "end",
2238
+ children: /* @__PURE__ */ D(x, {
2239
+ onClick: () => r(t),
2240
+ variant: "text",
2241
+ children: /* @__PURE__ */ D(S, {
2242
+ size: "24px",
2243
+ icon: Pe,
2244
+ color: L.neutral[100]
2245
+ })
2246
+ })
2247
+ }) }
2248
+ }
2249
+ })
2250
+ })]
2251
+ }, e.id)), !a && /* @__PURE__ */ D(i, {
2252
+ color: "neutral",
2253
+ variant: "dashed",
2254
+ fullWidth: !0,
2255
+ onClick: () => t({ email: "" }),
2256
+ startIcon: /* @__PURE__ */ D(S, {
2257
+ removeMargin: !0,
2258
+ icon: ie,
2259
+ color: L.neutral[100]
2260
+ }),
2261
+ children: "Adicionar outro e-mail"
2262
+ })]
2263
+ }) }),
2264
+ /* @__PURE__ */ O(b.Footer, { children: [/* @__PURE__ */ D(i, {
2265
+ variant: "neutral",
2266
+ onClick: e,
2267
+ children: "Cancelar"
2268
+ }), /* @__PURE__ */ D(i, {
2269
+ type: "submit",
2270
+ disabled: !o.formState.isDirty,
2271
+ children: "Salvar"
2272
+ })] })
2273
+ ]
2274
+ })
2275
+ })
2276
+ });
2277
+ };
2278
+ //#endregion
2279
+ //#region src/screens/meuPlano/faturas/emptyState/emptyState.tsx
2280
+ function pn() {
2281
+ let e = q((e) => e.meuPlano.faturasEmptyStateImg);
2282
+ return /* @__PURE__ */ D(d, {
2283
+ elevation: 2,
2284
+ sx: {
2285
+ padding: "1rem",
2286
+ borderRadius: ".5rem"
2287
+ },
2288
+ children: /* @__PURE__ */ O(l, {
2289
+ container: !0,
2290
+ spacing: 2,
2291
+ sx: {
2292
+ flexDirection: "column",
2293
+ justifyContent: "center",
2294
+ alignItems: "center",
2295
+ minHeight: "25rem"
2296
+ },
2297
+ children: [
2298
+ !!e && /* @__PURE__ */ D(l, { children: /* @__PURE__ */ D("img", { src: e }) }),
2299
+ /* @__PURE__ */ D(l, {
2300
+ sx: { textAlign: "center" },
2301
+ children: /* @__PURE__ */ D(g, {
2302
+ variant: "titleMD",
2303
+ children: "Nenhuma fatura para mostrar"
2304
+ })
2305
+ }),
2306
+ /* @__PURE__ */ D(l, { children: /* @__PURE__ */ D(g, {
2307
+ variant: "bodyMD",
2308
+ children: "Você não possui faturas."
2309
+ }) })
2310
+ ]
2311
+ })
2312
+ });
2313
+ }
2314
+ //#endregion
2315
+ //#region src/screens/meuPlano/faturas/useFaturas.tsx
2316
+ B.extend(Ye);
2317
+ var mn = () => {
2318
+ let { handleErrors: e } = X(), t = K((e) => e.setLoading), n = q((e) => e.meuPlano.exibirAbrirFatura), r = N(), a = J(), s = M(a.buscarMeusDados()), c = M({
2319
+ ...a.listarCobrancas(),
2320
+ select: (e) => e.data.data.toReversed()
2321
+ }), l = s.data?.data.data.emailCobranca, u = c.data, d = F(() => {
2322
+ if (l) {
2323
+ let e = l.split(";"), t = e.length - 1;
2324
+ return `${e[0]} ${t > 0 ? `e mais ${t}` : ""}`;
2325
+ }
2326
+ }, [l]), f = F(() => {
2327
+ let e = null;
2328
+ return e = c.isFetching ? "loading" : u && !u.length ? "empty" : null, e;
2329
+ }, [c.isFetching, u]), p = P((e) => {
2330
+ switch (e.situacao) {
2331
+ case "EMITIDO": {
2332
+ let t = B().startOf("day"), n = B(e.dataVencimento?.replace("Z", "")).startOf("day");
2333
+ return t.isAfter(n) && (B(n).day() === 6 ? n = n.add(2, "d") : B(n).day() === 0 && (n = n.add(1, "d"))), t.isAfter(n) ? {
2334
+ label: "Vencida",
2335
+ color: L.red[100]
2336
+ } : {
2337
+ label: "A pagar",
2338
+ color: L.neutral[30]
2339
+ };
2340
+ }
2341
+ case "LIQUIDADO": return {
2342
+ label: "Paga",
2343
+ color: L.green[100]
2344
+ };
2345
+ case "ISENTADO": return {
2346
+ label: "Isenta",
2347
+ color: L.neutral[50]
2348
+ };
2349
+ default: return {
2350
+ label: "",
2351
+ color: L.neutral[0]
2352
+ };
2353
+ }
2354
+ }, []), m = P(async (n) => {
2355
+ try {
2356
+ t(!0);
2357
+ let e = await r.ensureQueryData(a.buscarBoleto(n.identificador));
2358
+ e.data.data.boleto && Je(e.data.data.boleto, `Boleto_${B(n.dataEmissao).format("YYYY[_]MM")}.pdf`, "application/pdf");
2359
+ } catch (t) {
2360
+ e(t);
2361
+ } finally {
2362
+ t(!1);
2363
+ }
2364
+ }, [
2365
+ t,
2366
+ e,
2367
+ r.ensureQueryData,
2368
+ a.buscarBoleto
2369
+ ]), _ = P(async (n) => {
2370
+ try {
2371
+ t(!0);
2372
+ let e = await r.ensureQueryData(a.buscarNfse(n.identificador));
2373
+ e.data.data && (e.data.data.xml && Je(e.data.data.xml, `Nota_XML_${B(n.dataEmissao).format("YYYY[_]MM")}.xml`, "text/xml"), e.data.data.danfse ? Je(e.data.data.danfse, `Nota_PDF_${B(n.dataEmissao).format("YYYY[_]MM")}.pdf`, "application/pdf") : e.data.data.link_impressao_danfse && window.open(e.data.data.link_impressao_danfse, "_blank", "noopener=yes,noreferrer=yes"));
2374
+ } catch (t) {
2375
+ e(t);
2376
+ } finally {
2377
+ t(!1);
2378
+ }
2379
+ }, [
2380
+ r.ensureQueryData,
2381
+ t,
2382
+ e,
2383
+ a.buscarNfse
2384
+ ]), v = P((e) => {
2385
+ let t = window.location.host.includes("staging") ? e.linkFatura.replace("app", "staging") : e.linkFatura;
2386
+ window.open(t, "_blank", "noreferrer=yes,noopener=yes");
2387
+ }, []), y = P((e) => {
2388
+ switch (e.situacao) {
2389
+ case "EMITIDO": return n ? [{
2390
+ label: "Ver e pagar fatura",
2391
+ variant: "contained",
2392
+ onClick: () => v(e)
2393
+ }] : [{
2394
+ label: "Baixar boleto",
2395
+ variant: "text",
2396
+ onClick: () => m(e)
2397
+ }];
2398
+ case "LIQUIDADO": {
2399
+ let t = [];
2400
+ return e.linkFatura && t.push({
2401
+ label: "Ver fatura",
2402
+ variant: "outlined",
2403
+ onClick: () => v(e)
2404
+ }), t.push({
2405
+ label: "Baixar nota",
2406
+ variant: "text",
2407
+ onClick: () => _(e)
2408
+ }), t;
2409
+ }
2410
+ default: return [];
2411
+ }
2412
+ }, [
2413
+ m,
2414
+ _,
2415
+ v,
2416
+ n
2417
+ ]);
2418
+ return {
2419
+ cobrancas: u,
2420
+ tableStatus: f,
2421
+ tableColumns: F(() => [
2422
+ {
2423
+ field: "dataVencimento",
2424
+ headerName: "Vencimento",
2425
+ flex: 2,
2426
+ minWidth: 100,
2427
+ valueFormatter: (e) => B(e).utc().format("DD/MM/YYYY")
2428
+ },
2429
+ {
2430
+ field: "situacao",
2431
+ headerName: "Situação",
2432
+ flex: 2,
2433
+ minWidth: 105,
2434
+ valueGetter: (e, t) => p(t),
2435
+ renderCell: ({ value: e }) => /* @__PURE__ */ D(o, {
2436
+ label: e.label,
2437
+ style: {
2438
+ backgroundColor: e.color,
2439
+ minWidth: "6.5rem"
2440
+ }
2441
+ })
2442
+ },
2443
+ {
2444
+ field: "descricao",
2445
+ headerName: "Ref",
2446
+ renderCell: ({ value: e }) => /* @__PURE__ */ D(h, {
2447
+ title: /* @__PURE__ */ D(g, {
2448
+ variant: "bodySM",
2449
+ children: e
2450
+ }),
2451
+ children: /* @__PURE__ */ D("div", { children: /* @__PURE__ */ D(S, {
2452
+ icon: w,
2453
+ color: L.neutral[100]
2454
+ }) })
2455
+ }),
2456
+ width: 70
2457
+ },
2458
+ {
2459
+ field: "valor",
2460
+ headerName: "Valor",
2461
+ flex: 1.5,
2462
+ minWidth: 130,
2463
+ renderCell: ({ formattedValue: e }) => /* @__PURE__ */ D(g, {
2464
+ variant: "titleXS",
2465
+ children: e
2466
+ }),
2467
+ valueFormatter: (e) => C.format(e)
2468
+ },
2469
+ {
2470
+ field: "acao",
2471
+ headerName: "Ações",
2472
+ flex: 1.5,
2473
+ minWidth: 230,
2474
+ align: "center",
2475
+ headerAlign: "center",
2476
+ renderCell: ({ value: e }) => /* @__PURE__ */ D("div", {
2477
+ style: {
2478
+ display: "flex",
2479
+ gap: "0.5rem",
2480
+ alignItems: "center",
2481
+ justifyContent: "center",
2482
+ width: "100%",
2483
+ height: "100%"
2484
+ },
2485
+ children: e?.map((e) => /* @__PURE__ */ D(i, {
2486
+ size: "small",
2487
+ color: e.variant === "text" ? "neutral" : void 0,
2488
+ variant: e.variant,
2489
+ onClick: e.onClick,
2490
+ sx: { textDecoration: e.variant === "text" ? "underline" : void 0 },
2491
+ children: e.label
2492
+ }, e.label))
2493
+ }),
2494
+ valueGetter: (e, t) => y(t)
2495
+ }
2496
+ ], [y, p]),
2497
+ listaEmailsCobranca: d,
2498
+ getActions: y,
2499
+ getSituacao: p,
2500
+ loading: c.isFetching
2501
+ };
2502
+ }, hn = /* @__PURE__ */ function(e) {
2503
+ return e[e.PRE_PAGO = 1] = "PRE_PAGO", e[e.POS_PAGO = 2] = "POS_PAGO", e;
2504
+ }({});
2505
+ //#endregion
2506
+ //#region src/screens/meuPlano/faturas/useProximaFatura.tsx
2507
+ B.extend(Ye);
2508
+ var gn = () => {
2509
+ let e = J(), t = M(e.buscarMeuPlanoRecursos()), n = M(e.listarCobrancas()), r = M(e.buscarMeusDados()), i = n.data?.data.data, a = t.data?.data.data, o = r.data?.data.data;
2510
+ return F(() => {
2511
+ if (!i || !a?.dataFimUltimaFatura) return null;
2512
+ let e = B(a?.dataFimUltimaFatura).utc().startOf("day");
2513
+ return a.tipoCobranca === hn.POS_PAGO && (e = e.add(1, "month").startOf("month")), o?.dataBloqueio && B().isAfter(e) ? a.tipoCobranca === hn.POS_PAGO ? null : /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("b", { children: "Próxima fatura" }), ": será gerada em até 24 horas após o pagamento da fatura em atraso"] }) : (e = e.day() === 5 ? e.set("hour", 12) : e.set("hour", 19), /* @__PURE__ */ O(E, { children: [
2514
+ /* @__PURE__ */ D("b", { children: "Próxima fatura" }),
2515
+ ": será gerada em ",
2516
+ e.format("DD/MM/YYYY[, às ]HH:mm")
2517
+ ] }));
2518
+ }, [
2519
+ i,
2520
+ a,
2521
+ o?.dataBloqueio
2522
+ ]);
2523
+ };
2524
+ //#endregion
2525
+ //#region src/screens/meuPlano/faturas/faturas.tsx
2526
+ function _n() {
2527
+ let { cobrancas: e, tableStatus: n, tableColumns: r, listaEmailsCobranca: c, getActions: u, getSituacao: d, loading: f } = mn(), p = gn(), [m, h] = I(!1), _ = y("(max-width: 700px)");
2528
+ return f ? /* @__PURE__ */ D(un, {
2529
+ centerContent: !0,
2530
+ height: "60vh",
2531
+ children: /* @__PURE__ */ D(s, {})
2532
+ }) : n === "empty" ? /* @__PURE__ */ D(pn, {}) : /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(a, {
2533
+ sx: { padding: "1rem" },
2534
+ children: /* @__PURE__ */ O(l, {
2535
+ container: !0,
2536
+ spacing: 2,
2537
+ children: [
2538
+ /* @__PURE__ */ O(l, {
2539
+ size: 12,
2540
+ sx: {
2541
+ display: "flex",
2542
+ alignItems: "center"
2543
+ },
2544
+ children: [/* @__PURE__ */ D(S, {
2545
+ icon: Ne,
2546
+ size: "25px"
2547
+ }), /* @__PURE__ */ D(g, {
2548
+ variant: "titleSM",
2549
+ children: "Gerenciamento de faturas"
2550
+ })]
2551
+ }),
2552
+ /* @__PURE__ */ O(l, {
2553
+ size: 12,
2554
+ sx: {
2555
+ display: "flex",
2556
+ alignItems: "center",
2557
+ gap: 1
2558
+ },
2559
+ children: [/* @__PURE__ */ O(g, {
2560
+ variant: "bodySM",
2561
+ children: [
2562
+ "Boletos enviados para: ",
2563
+ _ && /* @__PURE__ */ D("br", {}),
2564
+ " ",
2565
+ /* @__PURE__ */ D("strong", { children: c })
2566
+ ]
2567
+ }), /* @__PURE__ */ D(x, {
2568
+ size: "small",
2569
+ variant: "neutral",
2570
+ onClick: () => h(!0),
2571
+ children: /* @__PURE__ */ D(S, {
2572
+ icon: ne,
2573
+ size: "21px",
2574
+ removeMargin: !0
2575
+ })
2576
+ })]
2577
+ }),
2578
+ !!p && /* @__PURE__ */ D(l, {
2579
+ size: 12,
2580
+ children: /* @__PURE__ */ D(t, {
2581
+ color: "info",
2582
+ icon: /* @__PURE__ */ D(S, {
2583
+ size: "21px",
2584
+ removeMargin: !0,
2585
+ icon: Me
2586
+ }),
2587
+ children: /* @__PURE__ */ D(g, {
2588
+ color: "info",
2589
+ children: p
2590
+ })
2591
+ })
2592
+ }),
2593
+ _ ? /* @__PURE__ */ D(l, {
2594
+ size: 12,
2595
+ children: /* @__PURE__ */ D(Ve.Root, {
2596
+ data: e ?? [],
2597
+ isLoading: n === "loading",
2598
+ children: e?.map((e, t) => {
2599
+ let n = d(e), r = u(e), a = n.label === "Vencida";
2600
+ return /* @__PURE__ */ O(Ve.ListItem, {
2601
+ index: t,
2602
+ style: {
2603
+ width: "calc(100% + 2rem)",
2604
+ marginLeft: "-1rem",
2605
+ padding: "1.5rem 1rem",
2606
+ backgroundColor: a ? "#FFE3E3" : void 0
2607
+ },
2608
+ children: [
2609
+ /* @__PURE__ */ O("div", {
2610
+ style: {
2611
+ display: "flex",
2612
+ justifyContent: "space-between"
2613
+ },
2614
+ children: [/* @__PURE__ */ D(o, {
2615
+ label: n.label,
2616
+ size: "small",
2617
+ style: {
2618
+ backgroundColor: n.color,
2619
+ minWidth: "6.5rem"
2620
+ }
2621
+ }), /* @__PURE__ */ D(g, {
2622
+ variant: "bodySM",
2623
+ color: a ? L.red[300] : void 0,
2624
+ children: B(e.dataVencimento).format("DD/MM/YYYY")
2625
+ })]
2626
+ }),
2627
+ /* @__PURE__ */ D("div", {
2628
+ style: { margin: "0.75rem 0" },
2629
+ children: /* @__PURE__ */ D(g, {
2630
+ variant: "bodyXS",
2631
+ color: a ? L.neutral[500] : L.neutral[100],
2632
+ children: e.descricao
2633
+ })
2634
+ }),
2635
+ /* @__PURE__ */ O("div", {
2636
+ style: {
2637
+ display: "flex",
2638
+ justifyContent: "space-between"
2639
+ },
2640
+ children: [/* @__PURE__ */ D(g, {
2641
+ variant: "titleXS",
2642
+ color: a ? L.red[300] : void 0,
2643
+ children: C.format(e.valor)
2644
+ }), /* @__PURE__ */ D("div", {
2645
+ style: {
2646
+ display: "flex",
2647
+ gap: "0.75rem",
2648
+ alignItems: "center"
2649
+ },
2650
+ children: r.map((e) => e.variant === "text" ? /* @__PURE__ */ D(g, {
2651
+ variant: "bodySM",
2652
+ color: a ? L.red[300] : void 0,
2653
+ style: {
2654
+ textDecorationLine: "underline",
2655
+ cursor: "pointer"
2656
+ },
2657
+ onClick: e.onClick,
2658
+ sx: { fontWeight: a ? 700 : void 0 },
2659
+ children: e.label
2660
+ }, e.label) : /* @__PURE__ */ D(i, {
2661
+ size: "small",
2662
+ variant: e.variant,
2663
+ onClick: e.onClick,
2664
+ children: e.label
2665
+ }, e.label))
2666
+ })]
2667
+ })
2668
+ ]
2669
+ }, e.identificador || e.dataVencimento);
2670
+ })
2671
+ })
2672
+ }) : /* @__PURE__ */ D(l, {
2673
+ size: 12,
2674
+ sx: {
2675
+ overflow: "auto",
2676
+ maxHeight: "65vh",
2677
+ "@media(max-height: 750px)": { maxHeight: "60vh" }
2678
+ },
2679
+ children: /* @__PURE__ */ D(Be, {
2680
+ rows: e ?? [],
2681
+ loading: n === "loading",
2682
+ columns: r,
2683
+ getRowId: (e) => e.identificador || e.dataVencimento,
2684
+ disableRowSelectionOnClick: !0,
2685
+ resizeThrottleMs: 1e3
2686
+ })
2687
+ })
2688
+ ]
2689
+ })
2690
+ }), m && /* @__PURE__ */ D(fn, { onClose: () => h(!1) })] });
2691
+ }
2692
+ //#endregion
2693
+ //#region src/screens/meuPlano/termosDeUso/termosDeUso.tsx
2694
+ function vn({ link: e }) {
2695
+ return /* @__PURE__ */ D(l, {
2696
+ sx: {
2697
+ display: "flex",
2698
+ marginTop: "1.5rem"
2699
+ },
2700
+ children: /* @__PURE__ */ O("a", {
2701
+ href: e,
2702
+ rel: "noopener noreferrer",
2703
+ target: "_blank",
2704
+ style: {
2705
+ display: "flex",
2706
+ alignItems: "center",
2707
+ color: L.neutral[100]
2708
+ },
2709
+ children: [/* @__PURE__ */ D(g, {
2710
+ variant: "bodySM",
2711
+ children: "Termos de uso"
2712
+ }), /* @__PURE__ */ D(S, { icon: te })]
2713
+ })
2714
+ });
2715
+ }
2716
+ //#endregion
2717
+ //#region src/screens/meuPlano/useMeuPlano.ts
2718
+ var yn = () => {
2719
+ let e = q((e) => e.meuPlano.linkTermosDeUso), t = q((e) => e.meuPlano.onRenderTabMeuPlano), n = q((e) => e.meuPlano.esconderInformacoesPlano);
2720
+ return _e(() => {
2721
+ t?.();
2722
+ }, [t]), {
2723
+ linkTermosDeUso: e,
2724
+ esconderInformacoesPlano: n
2725
+ };
2726
+ };
2727
+ //#endregion
2728
+ //#region src/screens/meuPlano/meuPlano.tsx
2729
+ function bn() {
2730
+ let { linkTermosDeUso: e, esconderInformacoesPlano: t } = yn(), [n, r] = I(null), i = q((e) => e.meuPlano.esconderPlanos), a = q((e) => e.meuPlano.esconderLojaDeRecursos);
2731
+ return /* @__PURE__ */ O(E, { children: [
2732
+ /* @__PURE__ */ D(d, {
2733
+ elevation: 2,
2734
+ sx: { padding: "1rem" },
2735
+ children: /* @__PURE__ */ O(l, {
2736
+ container: !0,
2737
+ spacing: 4,
2738
+ children: [!t && /* @__PURE__ */ O(l, {
2739
+ size: {
2740
+ xs: 12,
2741
+ md: 5,
2742
+ lg: 4,
2743
+ xl: 3
2744
+ },
2745
+ children: [/* @__PURE__ */ D(_t, {
2746
+ onClickButtonPlanos: () => r("planos"),
2747
+ onClickButtonLojaRecursos: () => r("recursos"),
2748
+ exibirLojaRecursos: !a,
2749
+ exibirPlanos: !i
2750
+ }), !!e && /* @__PURE__ */ D(vn, { link: e })]
2751
+ }), /* @__PURE__ */ D(l, {
2752
+ size: {
2753
+ xs: 12,
2754
+ md: 7,
2755
+ lg: 8,
2756
+ xl: 6
2757
+ },
2758
+ children: /* @__PURE__ */ D(_n, {})
2759
+ })]
2760
+ })
2761
+ }),
2762
+ n === "recursos" && /* @__PURE__ */ D(tn, { onClose: () => r(null) }),
2763
+ n === "planos" && /* @__PURE__ */ D(Ut, { onClose: () => r(null) })
2764
+ ] });
2765
+ }
2766
+ var xn = he(bn), Sn = v(g)`
2767
+ color: ${(e) => e?.theme?.palette?.primary?.main};
204
2768
  cursor: pointer;
205
2769
 
206
2770
  a {
207
2771
  text-decoration: none;
208
- color: ${o=>o?.theme?.palette?.primary?.main};
2772
+ color: ${(e) => e?.theme?.palette?.primary?.main};
209
2773
  }
210
- `;import{useCallback as Ks}from"react";import{useIsFetching as Js,useQuery as Zs,useQueryClient as ol}from"@tanstack/react-query";import el from"dayjs";import{useFormContext as rl}from"react-hook-form";var al={},tl=()=>{let o=g(p=>p.minhaEmpresa.camposAdicionais),e=qr(p=>p.textFieldEmpresaEmail??al),r=ol(),a=S(),t=Zs(a.buscarMeusDados()).data?.data.data,i=t?.cpfCnpj,s=t?.alteracaoDoEmailDaEmpresa,{setValue:m,getValues:d}=rl(),{handleErrors:c,setNotification:u}=G(),f=!!Js({queryKey:a.buscarRntrc(i).queryKey});return{onAtualizarRntrc:Ks(async()=>{if(!(f||!i))try{let p=await r.ensureQueryData(a.buscarRntrc(i));if(p?.data?.data?.rntrc){let h=d("empresa.rntrc"),l=p.data.data.data_validade?el(p.data.data.data_validade,"DD/MM/YYYY"):void 0,y=p.data.data.rntrc.padStart(8,"0");m("empresa.rntrc",y,{shouldDirty:!0}),m("empresa.rntrcDataVencimento",l),y===t.rntrc&&y===h?u({title:"Seu RNTRC j\xE1 est\xE1 atualizado",variant:"info"}):y===h&&u({title:"O RNTRC j\xE1 foi buscado",variant:"info"})}else u({title:"RNTRC n\xE3o encontrado",variant:"warning"})}catch(p){c(p)}},[a.buscarRntrc,r.ensureQueryData,f,i,m,d,u,c,t?.rntrc]),camposAdicionais:o,buscandoRntrc:f,alteracaoDoEmailDaEmpresa:s,textFieldSlotPropsEmpresaEmail:e}},Mt=tl;import{jsx as M,jsxs as No}from"react/jsx-runtime";function It(){let{camposAdicionais:o,buscandoRntrc:e,onAtualizarRntrc:r,alteracaoDoEmailDaEmpresa:a,textFieldSlotPropsEmpresaEmail:n}=Mt();return No(eo,{container:!0,spacing:2,children:[No(eo,{size:12,children:[M(Tt,{variant:"titleSM",children:"Dados da empresa"}),!!a&&M(dl,{placement:"top-start",title:No(Tt,{variant:"titleXS",children:["Altera\xE7\xE3o de e-mail da empresa solicitada.",M("br",{})," Pendente a confirma\xE7\xE3o de e-mail."]}),children:M("div",{style:{display:"inline"},children:M(il,{icon:cl,top:"4px"})})})]}),M(eo,{size:{xs:12,md:6},children:M(Io,{name:"empresa.cpfCnpj",label:"CNPJ",mask:"cpfCnpj",disabled:!0,required:!0,rules:Xo([Uo,sl])})}),M(eo,{size:{xs:12,md:6},children:M(Io,{name:"empresa.razaoSocial",label:"Raz\xE3o social",required:!0,rules:Xo([Uo,At(60)])})}),M(eo,{size:{xs:12,md:4},children:M(Io,{name:"empresa.nomeFantasia",label:"Nome fantasia",required:!0,rules:Xo([Uo,At(60)])})}),M(eo,{size:{xs:12,md:4},children:M(Io,{name:"empresa.email",label:"E-mail da empresa",required:!0,rules:Xo([Uo,ll]),...n})}),M(eo,{size:{xs:12,md:4},children:M(Io,{name:"empresa.fone",label:"Telefone da empresa",mask:"telefone",required:!0,rules:Xo([Uo,ml])})}),o?.ie&&M(eo,{size:{xs:12,md:4,...o.ie.grid},children:M(Io,{name:"empresa.ie",label:"Inscri\xE7\xE3o estadual",required:o.ie.required,rules:o.ie.rules,mask:"numero"})}),o?.rntrc&&No(eo,{size:{xs:12,sm:6,md:4,...o.rntrc.grid},children:[M(Io,{name:"empresa.rntrc",label:"RNTRC",mask:"numero",disabled:e,required:o.rntrc.required,rules:o.rntrc.rules,slotProps:{htmlInput:{maxLength:8}}}),No(Cr,{variant:"bodyXXS",onClick:r,children:["Buscar RNTRC",e&&M(pl,{size:"0.5rem",thickness:5,style:{marginLeft:"0.3rem"}})]})]}),o?.rntrcVencimento&&No(eo,{size:{xs:12,sm:6,md:4,...o.rntrcVencimento.grid},children:[M(nl,{name:"empresa.rntrcDataVencimento",label:"Vencimento",disabled:e,required:o.rntrcVencimento.required,rules:o.rntrcVencimento.rules}),M(Cr,{variant:"bodyXXS",children:M("a",{href:"https://consultapublica.antt.gov.br/Site/ConsultaRNTRC.aspx/ConsultaPublica/",target:"_blank",rel:"noopener noreferrer",children:"Consultar site da ANTT"})})]})]})}import{CircularProgress as xl,Grid as ho,Typography as vl}from"@mui/material";import{CreatableV2 as Sl,TextField as Ko}from"@s_mart/form";import{cep as Dl,composeValidators as Ge,maxLength as Fe,required as Jo}from"@s_mart/rules";import{cep as ul}from"@s_mart/rules";import{useIsFetching as fl,useQueryClient as gl}from"@tanstack/react-query";import yl from"lodash-es/debounce";import{useCallback as Et,useMemo as hl,useState as Cl}from"react";import{useFormContext as Pl}from"react-hook-form";var bl=()=>{let{getValues:o,setValue:e}=Pl(),[r,a]=Cl([]),{handleErrors:n}=G(),t=gl(),i=S(),s=!!fl({queryKey:i.buscarCep("").queryKey.slice(0,2)}),m=Et(async f=>{let x=f.replace(/\D/g,"");if(x&&!ul.validate.cep(x)&&x!==o("flags.ultimoCepBuscado"))try{let p=await t.ensureQueryData(i.buscarCep(f));p.data.data.codigo_ibge&&e("endereco.cidade",{label:`${p.data.data.cidade}/${p.data.data.uf}`,value:{codigo:p.data.data.codigo_ibge,nome:p.data.data.cidade,uf:p.data.data.uf}}),p.data.data.bairro&&e("endereco.bairro",p.data.data.bairro),p.data.data.logradouro&&e("endereco.rua",p.data.data.logradouro),p.data.data.complemento&&e("endereco.complemento",p.data.data.complemento),e("flags.ultimoCepBuscado",x)}catch(p){console.error("Erro ao buscar CEP"),console.error(p)}},[o,t.ensureQueryData,i.buscarCep,e]),d=Et(async f=>{try{let x=await t.ensureQueryData(i.pesquisarCidades(f));a(x.data?.data?.map(p=>({label:`${p.nome}/${p.uf}`,value:{codigo:p.codigo,nome:p.nome,uf:p.uf}})))}catch(x){n(x)}},[i.pesquisarCidades,n,t]),c=hl(()=>yl(d,500),[d]);return{onChangeCep:m,fetchingCep:s,onChangeInputCidades:c,onFocusInputCidades:()=>!r.length&&d(""),cidades:r}},Gt=bl;import{jsx as w,jsxs as Rl}from"react/jsx-runtime";function Ft(){let{onChangeCep:o,fetchingCep:e,onChangeInputCidades:r,onFocusInputCidades:a,cidades:n}=Gt();return Rl(ho,{container:!0,spacing:2,children:[w(ho,{size:12,children:w(vl,{variant:"titleSM",children:"Endere\xE7o"})}),w(ho,{size:{xs:12,md:4},children:w(Ko,{name:"endereco.cep",label:"CEP",mask:"cep",disabled:e,required:!0,rules:Ge([Jo,Dl]),onInputChange:o,slotProps:{input:{endAdornment:e&&w("div",{style:{display:"flex"},children:w(xl,{thickness:6,size:"1.5rem"})})}}})}),w(ho,{size:{xs:12,md:4},children:w(Sl,{name:"endereco.cidade",label:"Cidade/UF",options:n,onInputChange:r,onFocus:a,noOptionsText:"Nenhuma cidade encontrada",disabled:e,required:!0,rules:Jo,showCreatableButton:!1,showEditableButton:!1,getOptionKey:t=>t.label,getOptionLabel:t=>t.label})}),w(ho,{size:{xs:12,md:4},children:w(Ko,{name:"endereco.bairro",label:"Bairro",disabled:e,required:!0,rules:Ge([Jo,Fe(60)])})}),w(ho,{size:{xs:12,md:4},children:w(Ko,{name:"endereco.rua",label:"Rua",disabled:e,required:!0,rules:Ge([Jo,Fe(60)])})}),w(ho,{size:{xs:12,md:4},children:w(Ko,{name:"endereco.numero",label:"N\xFAmero",disabled:e,required:!0,rules:Ge([Jo,Fe(60)])})}),w(ho,{size:{xs:12,md:4},children:w(Ko,{name:"endereco.complemento",label:"Complemento",disabled:e,rules:Fe(60)})})]})}import{Grid as ze,Tooltip as Ml,Typography as zt}from"@mui/material";import{LIcon as Al}from"@s_mart/core";import{TextField as kt}from"@s_mart/form";import{composeValidators as wt,maxLength as Tl,required as Lt,telefone as Il}from"@s_mart/rules";import{lineSync as El}from"@s_mart/solid-icons";import{useQuery as Gl}from"@tanstack/react-query";import{jsx as mo,jsxs as Pr}from"react/jsx-runtime";function Bt(){let o=S(),a=Gl(o.buscarMeusDados()).data?.data.data?.alteracaoDoEmailDoResponsavel;return Pr(ze,{container:!0,spacing:2,children:[Pr(ze,{size:12,children:[mo(zt,{variant:"titleSM",children:"Dados do respons\xE1vel"}),!!a&&mo(Ml,{placement:"top-start",title:Pr(zt,{variant:"titleXS",children:["Altera\xE7\xE3o de respons\xE1vel solicitada.",mo("br",{})," Pendente a confirma\xE7\xE3o de e-mail."]}),children:mo("div",{style:{display:"inline"},children:mo(Al,{icon:El,top:"4px"})})})]}),mo(ze,{size:{xs:12,md:6},children:mo(kt,{name:"responsavel.nome",label:"Nome do respons\xE1vel",required:!0,rules:wt([Lt,Tl(60)])})}),mo(ze,{size:{xs:12,md:6},children:mo(kt,{name:"responsavel.fone",label:"Telefone do respons\xE1vel",mask:"telefone",required:!0,rules:wt([Lt,Il])})})]})}import{Avatar as Bl,CircularProgress as ql,Grid as br,Typography as Vl,useMediaQuery as Nl}from"@mui/material";import{Button as ke,LIcon as xr}from"@s_mart/core";import{linePicture as Ql,lineSync as Wl,lineTrash as $l}from"@s_mart/solid-icons";import{colorPalette as Vt}from"@s_mart/tokens";import{createResizedImage as Fl}from"@s_mart/utils";import{useQuery as zl}from"@tanstack/react-query";import{useDropzone as kl}from"react-dropzone";import{useFormContext as wl,useWatch as Ll}from"react-hook-form";var qt=()=>{let{open:o,getInputProps:e}=kl({noKeyboard:!0,multiple:!1,accept:{"image/jpeg":[".jpeg",".jpg"],"image/png":[".png"]},onDrop:x}),r=S(),n=zl(r.buscarMeusDados()).data?.data.data,t=n?.nomeFantasia,i=n?.razaoSocial,{setNotification:s}=G(),{setValue:m,formState:d,control:c}=wl(),u=Ll({control:c,name:"logo"}),f=l=>new Promise(y=>{Fl(l,300,600,"JPEG",100,0,v=>{y(v)},"file")});async function x(l){let y=l?.[0];if(!y)return s({title:"Selecione um arquivo v\xE1lido",message:"Formatos v\xE1lidos: PNG, JPG e JPEG",variant:"warning",duration:1e4});if(!y.type.startsWith("image/"))return s({title:"Formato de imagem inv\xE1lido",variant:"warning"});if(y.size>2e5)return s({title:"Arquivo muito grande (m\xE1ximo 200kB)",variant:"warning",duration:5e3});let v=await f(y),F=new FileReader;F.onload=()=>{if(!F.result)return console.log("Ocorreu um erro ao ler o arquivo");m("logo",{conteudo:F.result?.toString().replace(`data:${v.type};base64,`,""),nome:v.name,mimetype:v.type,tamanho:v.size},{shouldDirty:!0})},F.readAsDataURL(v)}return{open:o,getInputProps:e,logo:u,getIniciaisEmpresa:()=>(t||i||"").split(" ").map(y=>y[0]).join("").substring(0,2).toUpperCase(),onRemoverLogo:()=>m("logo",void 0,{shouldDirty:!0}),formState:d}};import{Fragment as Ol,jsx as O,jsxs as Zo}from"react/jsx-runtime";function Nt(){let{open:o,getInputProps:e,logo:r,onRemoverLogo:a,getIniciaisEmpresa:n,formState:t}=qt(),i=Nl("(max-width:600px)");return Zo(br,{container:!0,spacing:2,sx:{alignItems:"center",justifyContent:"space-between",flexWrap:i?"wrap-reverse":void 0},children:[Zo(br,{sx:{display:"flex",alignItems:"center",gap:i?"0.5rem":"1rem"},children:[O(Bl,{src:r?`data:${r.mimetype};base64,${r.conteudo}`:void 0,sx:{borderRadius:i?"10px":"16px",height:i?"3rem":"4rem",width:i?"3rem":"4rem",backgroundColor:Vt.neutral[100]},alt:"Logotipo/empresa",children:!r&&n()}),O("input",{...e()}),r?Zo(Ol,{children:[O(ke,{type:"button",variant:"neutral",startIcon:i?void 0:O(xr,{icon:Wl}),onClick:o,children:"Alterar logo"}),O(ke,{type:"button",variant:"outlined",color:"error",startIcon:i?void 0:O(xr,{icon:$l}),onClick:a,children:"Remover"})]}):Zo("div",{children:[O(ke,{type:"button",variant:"neutral",startIcon:O(xr,{icon:Ql}),onClick:o,children:"Adicionar logo"}),Zo(Vl,{variant:"bodyXXS",color:Vt.neutral[100],style:{display:"block",marginTop:"0.3rem"},children:["Utilize imagens no formato .jpg, .png ou .jpeg com",O("br",{})," tamanho recomendado de 300x160 pixels."]})]})]}),O(br,{size:{xs:12,sm:"auto"},children:O(ke,{type:"submit",disabled:t.isSubmitting||!t.isDirty,startIcon:t.isSubmitting&&O("div",{style:{display:"flex"},children:O(ql,{size:"1rem",sx:{color:"#FFF"}})}),fullWidth:i,children:"Salvar informa\xE7\xF5es"})})]})}import{useMutation as jl,useQuery as Hl,useQueryClient as Yl}from"@tanstack/react-query";import{useCallback as Xl,useEffect as Ul}from"react";import{useForm as Kl}from"react-hook-form";import _l from"dayjs";var vr=o=>{let e={empresa:{},endereco:{},responsavel:{},flags:{}};return o.logotipo&&(e.logo=o.logotipo),o.cpfCnpj&&(e.empresa.cpfCnpj=o.cpfCnpj),o.razaoSocial&&(e.empresa.razaoSocial=o.razaoSocial),o.nomeFantasia&&(e.empresa.nomeFantasia=o.nomeFantasia),o.email&&(e.empresa.email=o.email),o.fone&&(e.empresa.fone=o.fone),o.ie&&(e.empresa.ie=o.ie),o.rntrc&&(e.empresa.rntrc=o.rntrc),o.rntrcDataVencimento&&o.rntrcDataVencimento!=="0001-01-01T00:00:00Z"&&(e.empresa.rntrcDataVencimento=_l(o.rntrcDataVencimento)),o.cep&&(e.endereco.cep=o.cep,e.flags.ultimoCepBuscado=o.cep),o.cidade&&o.codigoCidade&&o.uf&&(e.endereco.cidade={label:`${o.cidade}/${o.uf}`,value:{codigo:o.codigoCidade,nome:o.cidade,uf:o.uf}}),o.bairro&&(e.endereco.bairro=o.bairro),o.rua&&(e.endereco.rua=o.rua),o.numero&&(e.endereco.numero=o.numero),o.complemento&&(e.endereco.complemento=o.complemento),o.nomeResponsavel&&(e.responsavel.nome=o.nomeResponsavel),o.emailResponsavel&&(e.responsavel.email=o.emailResponsavel),o.foneResponsavel&&(e.responsavel.fone=o.foneResponsavel),e},Qt=o=>{let e={};if(o.empresa){let r=o.empresa;r.razaoSocial&&(e.razaoSocial=r.razaoSocial.trim()),r.nomeFantasia&&(e.nomeFantasia=r.nomeFantasia.trim()),r.email&&(e.email=r.email.toLowerCase().trim()),r.ie&&(e.ie=r.ie),r.fone&&(e.fone=r.fone),e.rntrc=r.rntrc||"",r?.rntrcDataVencimento?e.rntrcDataVencimento=r.rntrcDataVencimento.toISOString():e.rntrcDataVencimento="0001-01-01T00:00:00Z"}if(o.endereco){let r=o.endereco;r.cep&&(e.cep=r.cep),r.bairro&&(e.bairro=r.bairro),r.rua&&(e.rua=r.rua),r.numero&&(e.numero=r.numero),r.complemento&&(e.complemento=r.complemento),r.cidade?.value&&(e.codigoCidade=r.cidade.value.codigo)}if(o.responsavel){let r=o.responsavel;r.nome&&(e.nomeResponsavel=r.nome.trim()),r.email&&(e.emailResponsavel=r.email.toLowerCase().trim()),r.fone&&(e.foneResponsavel=r.fone)}return o.logo&&(e.logotipo={conteudo:o.logo.conteudo,nome:o.logo.nome,mimetype:o.logo.mimetype,tamanho:o.logo.tamanho}),e};var Wt=()=>{let o=g(c=>c.minhaEmpresa.onDadosAtualizadosComSucesso),{handleErrors:e,setNotification:r}=G(),a=S(),n=Yl(),t=Hl(a.buscarMeusDados()),i=t.data?.data.data,s=Kl({async defaultValues(){let c=await n.ensureQueryData(a.buscarMeusDados());return vr(c.data.data)}});Ul(()=>{i&&s.reset(vr(i))},[s.reset,i]);let m=jl({...a.atualizarMeusDados(),onSuccess(c,u){r({title:"Dados atualizados com sucesso!",variant:"success"}),o?.(u)},onError:e.bind(null)}),d=Xl(c=>(c.preventDefault(),c.stopPropagation(),s.handleSubmit(async u=>{let f=Qt(u);await m.mutateAsync(f),s.reset(u),await t.refetch()})(c)),[s.handleSubmit,m.mutateAsync,s.reset,t.refetch]);return{form:s,handleSubmit:d}};import{jsx as I,jsxs as tm}from"react/jsx-runtime";function am(){let{form:o,handleSubmit:e}=Wt(),r=om("(max-width: 600px)");return o.formState.isLoading?I(Me,{centerContent:!0,height:"75vh",children:I(Jl,{})}):I(rm,{...o,children:I("form",{onSubmit:e,children:I(Zl,{elevation:2,sx:{borderRadius:r?"0 0 16px 16px":"0 16px 16px 16px",padding:"1rem"},children:tm(Co,{container:!0,spacing:3,children:[I(Co,{size:12,children:I(Nt,{})}),I(Co,{size:12,children:I(Sr,{})}),I(Co,{size:12,children:I(It,{})}),I(Co,{size:12,children:I(Sr,{})}),I(Co,{size:12,children:I(Ft,{})}),I(Co,{size:12,children:I(Sr,{})}),I(Co,{size:12,children:I(Bt,{})})]})})})})}var we=em(am);we.displayName="MinhaEmpresa";import{useMediaQuery as im}from"@mui/material";var $t=()=>{let o=g(n=>n.tabAtiva||"minhaEmpresa"),e=g(n=>n.setTabAtiva),r=g(n=>n.esconderTabMeuPlano),a=im("(max-width:600px)");return{esconderTabMeuPlano:r,tabAtiva:o,setTabAtiva:e,fullWidthTabs:a}};import{jsx as co,jsxs as Rr}from"react/jsx-runtime";function sm({onNotification:o}){let{esconderTabMeuPlano:e,tabAtiva:r,setTabAtiva:a,fullWidthTabs:n}=$t();return co(to,{onNotification:o,children:Rr(Dr,{container:!0,children:[co(Dr,{size:{xs:12,sm:"auto"},children:Rr(nm,{variant:n?"fullWidth":"standard",value:r,onChange:(t,i)=>a(i),children:[co(Ot,{label:"Minha empresa",value:"minhaEmpresa"}),!e&&co(Ot,{label:"Meu plano",value:"meuPlano"})]})}),Rr(Dr,{size:12,children:[r==="minhaEmpresa"?co(we,{}):null,r==="meuPlano"?co(hr,{}):null]})]})})}function lm(o){return co(ir,{children:co(Ne,{...o,children:co(sm,{onNotification:o.onNotification})})})}export{nr as ApiConfirmarEmail,Le as ApiMinhaConta,Nn as ConfirmarEmail,ur as Faturas,hr as MeuPlano,Qe as MeuPlanoInfo,lm as MinhaConta,Ne as MinhaContaProvider,ir as MinhaContaQueryProvider,we as MinhaEmpresa,to as NotificationProvider,pn as PlanosDialog,Gn as RecursosDialog};
2774
+ `, Cn = {}, wn = () => {
2775
+ let e = q((e) => e.minhaEmpresa.camposAdicionais), t = ut((e) => e.textFieldEmpresaEmail ?? Cn), n = N(), r = J(), i = M(r.buscarMeusDados()).data?.data.data, a = i?.cpfCnpj, o = i?.alteracaoDoEmailDaEmpresa, { setValue: s, getValues: c } = z(), { handleErrors: l, setNotification: u } = X(), d = !!pe({ queryKey: r.buscarRntrc(a).queryKey });
2776
+ return {
2777
+ onAtualizarRntrc: P(async () => {
2778
+ if (!(d || !a)) try {
2779
+ let e = await n.ensureQueryData(r.buscarRntrc(a));
2780
+ if (e?.data?.data?.rntrc) {
2781
+ let t = c("empresa.rntrc"), n = e.data.data.data_validade ? B(e.data.data.data_validade, "DD/MM/YYYY") : void 0, r = e.data.data.rntrc.padStart(8, "0");
2782
+ s("empresa.rntrc", r, { shouldDirty: !0 }), s("empresa.rntrcDataVencimento", n), r === i.rntrc && r === t ? u({
2783
+ title: "Seu RNTRC já está atualizado",
2784
+ variant: "info"
2785
+ }) : r === t && u({
2786
+ title: "O RNTRC já foi buscado",
2787
+ variant: "info"
2788
+ });
2789
+ } else u({
2790
+ title: "RNTRC não encontrado",
2791
+ variant: "warning"
2792
+ });
2793
+ } catch (e) {
2794
+ l(e);
2795
+ }
2796
+ }, [
2797
+ r.buscarRntrc,
2798
+ n.ensureQueryData,
2799
+ d,
2800
+ a,
2801
+ s,
2802
+ c,
2803
+ u,
2804
+ l,
2805
+ i?.rntrc
2806
+ ]),
2807
+ camposAdicionais: e,
2808
+ buscandoRntrc: d,
2809
+ alteracaoDoEmailDaEmpresa: o,
2810
+ textFieldSlotPropsEmpresaEmail: t
2811
+ };
2812
+ };
2813
+ //#endregion
2814
+ //#region src/screens/minhaEmpresa/dadosEmpresa/dadosEmpresa.tsx
2815
+ function Tn() {
2816
+ let { camposAdicionais: e, buscandoRntrc: t, onAtualizarRntrc: n, alteracaoDoEmailDaEmpresa: r, textFieldSlotPropsEmpresaEmail: i } = wn();
2817
+ return /* @__PURE__ */ O(l, {
2818
+ container: !0,
2819
+ spacing: 2,
2820
+ children: [
2821
+ /* @__PURE__ */ O(l, {
2822
+ size: 12,
2823
+ children: [/* @__PURE__ */ D(g, {
2824
+ variant: "titleSM",
2825
+ children: "Dados da empresa"
2826
+ }), !!r && /* @__PURE__ */ D(h, {
2827
+ placement: "top-start",
2828
+ title: /* @__PURE__ */ O(g, {
2829
+ variant: "titleXS",
2830
+ children: [
2831
+ "Alteração de e-mail da empresa solicitada.",
2832
+ /* @__PURE__ */ D("br", {}),
2833
+ " Pendente a confirmação de e-mail."
2834
+ ]
2835
+ }),
2836
+ children: /* @__PURE__ */ D("div", {
2837
+ style: { display: "inline" },
2838
+ children: /* @__PURE__ */ D(S, {
2839
+ icon: se,
2840
+ top: "4px"
2841
+ })
2842
+ })
2843
+ })]
2844
+ }),
2845
+ /* @__PURE__ */ D(l, {
2846
+ size: {
2847
+ xs: 12,
2848
+ md: 6
2849
+ },
2850
+ children: /* @__PURE__ */ D(R, {
2851
+ name: "empresa.cpfCnpj",
2852
+ label: "CNPJ",
2853
+ mask: "cpfCnpj",
2854
+ disabled: !0,
2855
+ required: !0,
2856
+ rules: V([U, Ue])
2857
+ })
2858
+ }),
2859
+ /* @__PURE__ */ D(l, {
2860
+ size: {
2861
+ xs: 12,
2862
+ md: 6
2863
+ },
2864
+ children: /* @__PURE__ */ D(R, {
2865
+ name: "empresa.razaoSocial",
2866
+ label: "Razão social",
2867
+ required: !0,
2868
+ rules: V([U, H(60)])
2869
+ })
2870
+ }),
2871
+ /* @__PURE__ */ D(l, {
2872
+ size: {
2873
+ xs: 12,
2874
+ md: 4
2875
+ },
2876
+ children: /* @__PURE__ */ D(R, {
2877
+ name: "empresa.nomeFantasia",
2878
+ label: "Nome fantasia",
2879
+ required: !0,
2880
+ rules: V([U, H(60)])
2881
+ })
2882
+ }),
2883
+ /* @__PURE__ */ D(l, {
2884
+ size: {
2885
+ xs: 12,
2886
+ md: 4
2887
+ },
2888
+ children: /* @__PURE__ */ D(R, {
2889
+ name: "empresa.email",
2890
+ label: "E-mail da empresa",
2891
+ required: !0,
2892
+ rules: V([U, We]),
2893
+ ...i
2894
+ })
2895
+ }),
2896
+ /* @__PURE__ */ D(l, {
2897
+ size: {
2898
+ xs: 12,
2899
+ md: 4
2900
+ },
2901
+ children: /* @__PURE__ */ D(R, {
2902
+ name: "empresa.fone",
2903
+ label: "Telefone da empresa",
2904
+ mask: "telefone",
2905
+ required: !0,
2906
+ rules: V([U, Ke])
2907
+ })
2908
+ }),
2909
+ e?.ie && /* @__PURE__ */ D(l, {
2910
+ size: {
2911
+ xs: 12,
2912
+ md: 4,
2913
+ ...e.ie.grid
2914
+ },
2915
+ children: /* @__PURE__ */ D(R, {
2916
+ name: "empresa.ie",
2917
+ label: "Inscrição estadual",
2918
+ required: e.ie.required,
2919
+ rules: e.ie.rules,
2920
+ mask: "numero"
2921
+ })
2922
+ }),
2923
+ e?.rntrc && /* @__PURE__ */ O(l, {
2924
+ size: {
2925
+ xs: 12,
2926
+ sm: 6,
2927
+ md: 4,
2928
+ ...e.rntrc.grid
2929
+ },
2930
+ children: [/* @__PURE__ */ D(R, {
2931
+ name: "empresa.rntrc",
2932
+ label: "RNTRC",
2933
+ mask: "numero",
2934
+ disabled: t,
2935
+ required: e.rntrc.required,
2936
+ rules: e.rntrc.rules,
2937
+ slotProps: { htmlInput: { maxLength: 8 } }
2938
+ }), /* @__PURE__ */ O(Sn, {
2939
+ variant: "bodyXXS",
2940
+ onClick: n,
2941
+ children: ["Buscar RNTRC", t && /* @__PURE__ */ D(s, {
2942
+ size: "0.5rem",
2943
+ thickness: 5,
2944
+ style: { marginLeft: "0.3rem" }
2945
+ })]
2946
+ })]
2947
+ }),
2948
+ e?.rntrcVencimento && /* @__PURE__ */ O(l, {
2949
+ size: {
2950
+ xs: 12,
2951
+ sm: 6,
2952
+ md: 4,
2953
+ ...e.rntrcVencimento.grid
2954
+ },
2955
+ children: [/* @__PURE__ */ D(Te, {
2956
+ name: "empresa.rntrcDataVencimento",
2957
+ label: "Vencimento",
2958
+ disabled: t,
2959
+ required: e.rntrcVencimento.required,
2960
+ rules: e.rntrcVencimento.rules
2961
+ }), /* @__PURE__ */ D(Sn, {
2962
+ variant: "bodyXXS",
2963
+ children: /* @__PURE__ */ D("a", {
2964
+ href: "https://consultapublica.antt.gov.br/Site/ConsultaRNTRC.aspx/ConsultaPublica/",
2965
+ target: "_blank",
2966
+ rel: "noopener noreferrer",
2967
+ children: "Consultar site da ANTT"
2968
+ })
2969
+ })]
2970
+ })
2971
+ ]
2972
+ });
2973
+ }
2974
+ //#endregion
2975
+ //#region src/screens/minhaEmpresa/dadosEndereco/useDadosEndereco.ts
2976
+ var En = () => {
2977
+ let { getValues: e, setValue: t } = z(), [n, r] = I([]), { handleErrors: i } = X(), a = N(), o = J(), s = !!pe({ queryKey: o.buscarCep("").queryKey.slice(0, 2) }), c = P(async (n) => {
2978
+ let r = n.replace(/\D/g, "");
2979
+ if (r && !He.validate.cep(r) && r !== e("flags.ultimoCepBuscado")) try {
2980
+ let e = await a.ensureQueryData(o.buscarCep(n));
2981
+ e.data.data.codigo_ibge && t("endereco.cidade", {
2982
+ label: `${e.data.data.cidade}/${e.data.data.uf}`,
2983
+ value: {
2984
+ codigo: e.data.data.codigo_ibge,
2985
+ nome: e.data.data.cidade,
2986
+ uf: e.data.data.uf
2987
+ }
2988
+ }), e.data.data.bairro && t("endereco.bairro", e.data.data.bairro), e.data.data.logradouro && t("endereco.rua", e.data.data.logradouro), e.data.data.complemento && t("endereco.complemento", e.data.data.complemento), t("flags.ultimoCepBuscado", r);
2989
+ } catch (e) {
2990
+ console.error("Erro ao buscar CEP"), console.error(e);
2991
+ }
2992
+ }, [
2993
+ e,
2994
+ a.ensureQueryData,
2995
+ o.buscarCep,
2996
+ t
2997
+ ]), l = P(async (e) => {
2998
+ try {
2999
+ let t = await a.ensureQueryData(o.pesquisarCidades(e));
3000
+ r(t.data?.data?.map((e) => ({
3001
+ label: `${e.nome}/${e.uf}`,
3002
+ value: {
3003
+ codigo: e.codigo,
3004
+ nome: e.nome,
3005
+ uf: e.uf
3006
+ }
3007
+ })));
3008
+ } catch (e) {
3009
+ i(e);
3010
+ }
3011
+ }, [
3012
+ o.pesquisarCidades,
3013
+ i,
3014
+ a
3015
+ ]);
3016
+ return {
3017
+ onChangeCep: c,
3018
+ fetchingCep: s,
3019
+ onChangeInputCidades: F(() => Xe(l, 500), [l]),
3020
+ onFocusInputCidades: () => !n.length && l(""),
3021
+ cidades: n
3022
+ };
3023
+ };
3024
+ //#endregion
3025
+ //#region src/screens/minhaEmpresa/dadosEndereco/dadosEndereco.tsx
3026
+ function Dn() {
3027
+ let { onChangeCep: e, fetchingCep: t, onChangeInputCidades: n, onFocusInputCidades: r, cidades: i } = En();
3028
+ return /* @__PURE__ */ O(l, {
3029
+ container: !0,
3030
+ spacing: 2,
3031
+ children: [
3032
+ /* @__PURE__ */ D(l, {
3033
+ size: 12,
3034
+ children: /* @__PURE__ */ D(g, {
3035
+ variant: "titleSM",
3036
+ children: "Endereço"
3037
+ })
3038
+ }),
3039
+ /* @__PURE__ */ D(l, {
3040
+ size: {
3041
+ xs: 12,
3042
+ md: 4
3043
+ },
3044
+ children: /* @__PURE__ */ D(R, {
3045
+ name: "endereco.cep",
3046
+ label: "CEP",
3047
+ mask: "cep",
3048
+ disabled: t,
3049
+ required: !0,
3050
+ rules: V([U, He]),
3051
+ onInputChange: e,
3052
+ slotProps: { input: { endAdornment: t && /* @__PURE__ */ D("div", {
3053
+ style: { display: "flex" },
3054
+ children: /* @__PURE__ */ D(s, {
3055
+ thickness: 6,
3056
+ size: "1.5rem"
3057
+ })
3058
+ }) } }
3059
+ })
3060
+ }),
3061
+ /* @__PURE__ */ D(l, {
3062
+ size: {
3063
+ xs: 12,
3064
+ md: 4
3065
+ },
3066
+ children: /* @__PURE__ */ D(we, {
3067
+ name: "endereco.cidade",
3068
+ label: "Cidade/UF",
3069
+ options: i,
3070
+ onInputChange: n,
3071
+ onFocus: r,
3072
+ noOptionsText: "Nenhuma cidade encontrada",
3073
+ disabled: t,
3074
+ required: !0,
3075
+ rules: U,
3076
+ showCreatableButton: !1,
3077
+ showEditableButton: !1,
3078
+ getOptionKey: (e) => e.label,
3079
+ getOptionLabel: (e) => e.label
3080
+ })
3081
+ }),
3082
+ /* @__PURE__ */ D(l, {
3083
+ size: {
3084
+ xs: 12,
3085
+ md: 4
3086
+ },
3087
+ children: /* @__PURE__ */ D(R, {
3088
+ name: "endereco.bairro",
3089
+ label: "Bairro",
3090
+ disabled: t,
3091
+ required: !0,
3092
+ rules: V([U, H(60)])
3093
+ })
3094
+ }),
3095
+ /* @__PURE__ */ D(l, {
3096
+ size: {
3097
+ xs: 12,
3098
+ md: 4
3099
+ },
3100
+ children: /* @__PURE__ */ D(R, {
3101
+ name: "endereco.rua",
3102
+ label: "Rua",
3103
+ disabled: t,
3104
+ required: !0,
3105
+ rules: V([U, H(60)])
3106
+ })
3107
+ }),
3108
+ /* @__PURE__ */ D(l, {
3109
+ size: {
3110
+ xs: 12,
3111
+ md: 4
3112
+ },
3113
+ children: /* @__PURE__ */ D(R, {
3114
+ name: "endereco.numero",
3115
+ label: "Número",
3116
+ disabled: t,
3117
+ required: !0,
3118
+ rules: V([U, H(60)])
3119
+ })
3120
+ }),
3121
+ /* @__PURE__ */ D(l, {
3122
+ size: {
3123
+ xs: 12,
3124
+ md: 4
3125
+ },
3126
+ children: /* @__PURE__ */ D(R, {
3127
+ name: "endereco.complemento",
3128
+ label: "Complemento",
3129
+ disabled: t,
3130
+ rules: H(60)
3131
+ })
3132
+ })
3133
+ ]
3134
+ });
3135
+ }
3136
+ //#endregion
3137
+ //#region src/screens/minhaEmpresa/dadosResponsavel/dadosResponsavel.tsx
3138
+ function On() {
3139
+ let e = J(), t = M(e.buscarMeusDados()).data?.data.data?.alteracaoDoEmailDoResponsavel;
3140
+ return /* @__PURE__ */ O(l, {
3141
+ container: !0,
3142
+ spacing: 2,
3143
+ children: [
3144
+ /* @__PURE__ */ O(l, {
3145
+ size: 12,
3146
+ children: [/* @__PURE__ */ D(g, {
3147
+ variant: "titleSM",
3148
+ children: "Dados do responsável"
3149
+ }), !!t && /* @__PURE__ */ D(h, {
3150
+ placement: "top-start",
3151
+ title: /* @__PURE__ */ O(g, {
3152
+ variant: "titleXS",
3153
+ children: [
3154
+ "Alteração de responsável solicitada.",
3155
+ /* @__PURE__ */ D("br", {}),
3156
+ " Pendente a confirmação de e-mail."
3157
+ ]
3158
+ }),
3159
+ children: /* @__PURE__ */ D("div", {
3160
+ style: { display: "inline" },
3161
+ children: /* @__PURE__ */ D(S, {
3162
+ icon: se,
3163
+ top: "4px"
3164
+ })
3165
+ })
3166
+ })]
3167
+ }),
3168
+ /* @__PURE__ */ D(l, {
3169
+ size: {
3170
+ xs: 12,
3171
+ md: 6
3172
+ },
3173
+ children: /* @__PURE__ */ D(R, {
3174
+ name: "responsavel.nome",
3175
+ label: "Nome do responsável",
3176
+ required: !0,
3177
+ rules: V([U, H(60)])
3178
+ })
3179
+ }),
3180
+ /* @__PURE__ */ D(l, {
3181
+ size: {
3182
+ xs: 12,
3183
+ md: 6
3184
+ },
3185
+ children: /* @__PURE__ */ D(R, {
3186
+ name: "responsavel.fone",
3187
+ label: "Telefone do responsável",
3188
+ mask: "telefone",
3189
+ required: !0,
3190
+ rules: V([U, Ke])
3191
+ })
3192
+ })
3193
+ ]
3194
+ });
3195
+ }
3196
+ //#endregion
3197
+ //#region src/screens/minhaEmpresa/header/useHeader.ts
3198
+ var kn = () => {
3199
+ let { open: e, getInputProps: t } = Ze({
3200
+ noKeyboard: !0,
3201
+ multiple: !1,
3202
+ accept: {
3203
+ "image/jpeg": [".jpeg", ".jpg"],
3204
+ "image/png": [".png"]
3205
+ },
3206
+ onDrop: p
3207
+ }), n = J(), r = M(n.buscarMeusDados()).data?.data.data, i = r?.nomeFantasia, a = r?.razaoSocial, { setNotification: o } = X(), { setValue: s, formState: { isDirty: c, isSubmitting: l }, control: u } = z(), d = ze({
3208
+ control: u,
3209
+ name: "logo"
3210
+ }), f = (e) => new Promise((t) => {
3211
+ qe(e, 300, 600, "JPEG", 100, 0, (e) => {
3212
+ t(e);
3213
+ }, "file");
3214
+ });
3215
+ async function p(e) {
3216
+ let t = e?.[0];
3217
+ if (!t) return o({
3218
+ title: "Selecione um arquivo válido",
3219
+ message: "Formatos válidos: PNG, JPG e JPEG",
3220
+ variant: "warning",
3221
+ duration: 1e4
3222
+ });
3223
+ if (!t.type.startsWith("image/")) return o({
3224
+ title: "Formato de imagem inválido",
3225
+ variant: "warning"
3226
+ });
3227
+ if (t.size > 2e5) return o({
3228
+ title: "Arquivo muito grande (máximo 200kB)",
3229
+ variant: "warning",
3230
+ duration: 5e3
3231
+ });
3232
+ let n = await f(t), r = new FileReader();
3233
+ r.onload = () => {
3234
+ if (!r.result) return console.log("Ocorreu um erro ao ler o arquivo");
3235
+ s("logo", {
3236
+ conteudo: r.result?.toString().replace(`data:${n.type};base64,`, ""),
3237
+ nome: n.name,
3238
+ mimetype: n.type,
3239
+ tamanho: n.size
3240
+ }, { shouldDirty: !0 });
3241
+ }, r.readAsDataURL(n);
3242
+ }
3243
+ return {
3244
+ open: e,
3245
+ getInputProps: t,
3246
+ logo: d,
3247
+ getIniciaisEmpresa: () => (i || a || "").split(" ").map((e) => e[0]).join("").substring(0, 2).toUpperCase(),
3248
+ onRemoverLogo: () => s("logo", void 0, { shouldDirty: !0 }),
3249
+ isDirty: c,
3250
+ isSubmitting: l
3251
+ };
3252
+ };
3253
+ //#endregion
3254
+ //#region src/screens/minhaEmpresa/header/header.tsx
3255
+ function An() {
3256
+ let { open: e, getInputProps: t, logo: r, onRemoverLogo: a, getIniciaisEmpresa: o, isDirty: c, isSubmitting: u } = kn(), d = y("(max-width:600px)");
3257
+ return /* @__PURE__ */ O(l, {
3258
+ container: !0,
3259
+ spacing: 2,
3260
+ sx: {
3261
+ alignItems: "center",
3262
+ justifyContent: "space-between",
3263
+ flexWrap: d ? "wrap-reverse" : void 0
3264
+ },
3265
+ children: [/* @__PURE__ */ O(l, {
3266
+ sx: {
3267
+ display: "flex",
3268
+ alignItems: "center",
3269
+ gap: d ? "0.5rem" : "1rem"
3270
+ },
3271
+ children: [
3272
+ /* @__PURE__ */ D(n, {
3273
+ src: r ? `data:${r.mimetype};base64,${r.conteudo}` : void 0,
3274
+ sx: {
3275
+ borderRadius: d ? "10px" : "16px",
3276
+ height: d ? "3rem" : "4rem",
3277
+ width: d ? "3rem" : "4rem",
3278
+ backgroundColor: L.neutral[100]
3279
+ },
3280
+ alt: "Logotipo/empresa",
3281
+ children: !r && o()
3282
+ }),
3283
+ /* @__PURE__ */ D("input", { ...t() }),
3284
+ r ? /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(i, {
3285
+ type: "button",
3286
+ variant: "neutral",
3287
+ startIcon: d ? void 0 : /* @__PURE__ */ D(S, { icon: se }),
3288
+ onClick: e,
3289
+ children: "Alterar logo"
3290
+ }), /* @__PURE__ */ D(i, {
3291
+ type: "button",
3292
+ variant: "outlined",
3293
+ color: "error",
3294
+ startIcon: d ? void 0 : /* @__PURE__ */ D(S, { icon: ce }),
3295
+ onClick: a,
3296
+ children: "Remover"
3297
+ })] }) : /* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D(i, {
3298
+ type: "button",
3299
+ variant: "neutral",
3300
+ startIcon: /* @__PURE__ */ D(S, { icon: re }),
3301
+ onClick: e,
3302
+ children: "Adicionar logo"
3303
+ }), /* @__PURE__ */ O(g, {
3304
+ variant: "bodyXXS",
3305
+ color: L.neutral[100],
3306
+ style: {
3307
+ display: "block",
3308
+ marginTop: "0.3rem"
3309
+ },
3310
+ children: [
3311
+ "Utilize imagens no formato .jpg, .png ou .jpeg com",
3312
+ /* @__PURE__ */ D("br", {}),
3313
+ " tamanho recomendado de 300x160 pixels."
3314
+ ]
3315
+ })] })
3316
+ ]
3317
+ }), /* @__PURE__ */ D(l, {
3318
+ size: {
3319
+ xs: 12,
3320
+ sm: "auto"
3321
+ },
3322
+ children: /* @__PURE__ */ D(i, {
3323
+ type: "submit",
3324
+ disabled: u || !c,
3325
+ startIcon: u && /* @__PURE__ */ D("div", {
3326
+ style: { display: "flex" },
3327
+ children: /* @__PURE__ */ D(s, {
3328
+ size: "1rem",
3329
+ sx: { color: "#FFF" }
3330
+ })
3331
+ }),
3332
+ fullWidth: d,
3333
+ children: "Salvar informações"
3334
+ })
3335
+ })]
3336
+ });
3337
+ }
3338
+ //#endregion
3339
+ //#region src/screens/minhaEmpresa/minhaEmpresa.helpers.ts
3340
+ var jn = (e) => {
3341
+ let t = {
3342
+ empresa: {},
3343
+ endereco: {},
3344
+ responsavel: {},
3345
+ flags: {}
3346
+ };
3347
+ return e.logotipo && (t.logo = e.logotipo), e.cpfCnpj && (t.empresa.cpfCnpj = e.cpfCnpj), e.razaoSocial && (t.empresa.razaoSocial = e.razaoSocial), e.nomeFantasia && (t.empresa.nomeFantasia = e.nomeFantasia), e.email && (t.empresa.email = e.email), e.fone && (t.empresa.fone = e.fone), e.ie && (t.empresa.ie = e.ie), e.rntrc && (t.empresa.rntrc = e.rntrc), e.rntrcDataVencimento && e.rntrcDataVencimento !== "0001-01-01T00:00:00Z" && (t.empresa.rntrcDataVencimento = B(e.rntrcDataVencimento)), e.cep && (t.endereco.cep = e.cep, t.flags.ultimoCepBuscado = e.cep), e.cidade && e.codigoCidade && e.uf && (t.endereco.cidade = {
3348
+ label: `${e.cidade}/${e.uf}`,
3349
+ value: {
3350
+ codigo: e.codigoCidade,
3351
+ nome: e.cidade,
3352
+ uf: e.uf
3353
+ }
3354
+ }), e.bairro && (t.endereco.bairro = e.bairro), e.rua && (t.endereco.rua = e.rua), e.numero && (t.endereco.numero = e.numero), e.complemento && (t.endereco.complemento = e.complemento), e.nomeResponsavel && (t.responsavel.nome = e.nomeResponsavel), e.emailResponsavel && (t.responsavel.email = e.emailResponsavel), e.foneResponsavel && (t.responsavel.fone = e.foneResponsavel), t;
3355
+ }, Mn = (e) => {
3356
+ let t = {};
3357
+ if (e.empresa) {
3358
+ let n = e.empresa;
3359
+ n.razaoSocial && (t.razaoSocial = n.razaoSocial.trim()), n.nomeFantasia && (t.nomeFantasia = n.nomeFantasia.trim()), n.email && (t.email = n.email.toLowerCase().trim()), n.ie && (t.ie = n.ie), n.fone && (t.fone = n.fone), t.rntrc = n.rntrc || "", t.rntrcDataVencimento = n?.rntrcDataVencimento ? n.rntrcDataVencimento.toISOString() : "0001-01-01T00:00:00Z";
3360
+ }
3361
+ if (e.endereco) {
3362
+ let n = e.endereco;
3363
+ n.cep && (t.cep = n.cep), n.bairro && (t.bairro = n.bairro), n.rua && (t.rua = n.rua), n.numero && (t.numero = n.numero), n.complemento && (t.complemento = n.complemento), n.cidade?.value && (t.codigoCidade = n.cidade.value.codigo);
3364
+ }
3365
+ if (e.responsavel) {
3366
+ let n = e.responsavel;
3367
+ n.nome && (t.nomeResponsavel = n.nome.trim()), n.email && (t.emailResponsavel = n.email.toLowerCase().trim()), n.fone && (t.foneResponsavel = n.fone);
3368
+ }
3369
+ return e.logo && (t.logotipo = {
3370
+ conteudo: e.logo.conteudo,
3371
+ nome: e.logo.nome,
3372
+ mimetype: e.logo.mimetype,
3373
+ tamanho: e.logo.tamanho
3374
+ }), t;
3375
+ }, Nn = () => {
3376
+ let e = q((e) => e.minhaEmpresa.onDadosAtualizadosComSucesso), { handleErrors: t, setNotification: n } = X(), r = J(), i = N(), a = M(r.buscarMeusDados()), o = a.data?.data.data, s = Re({ async defaultValues() {
3377
+ return jn((await i.ensureQueryData(r.buscarMeusDados())).data.data);
3378
+ } });
3379
+ _e(() => {
3380
+ o && s.reset(jn(o));
3381
+ }, [s.reset, o]);
3382
+ let c = j({
3383
+ ...r.atualizarMeusDados(),
3384
+ onSuccess(t, r) {
3385
+ n({
3386
+ title: "Dados atualizados com sucesso!",
3387
+ variant: "success"
3388
+ }), e?.(r);
3389
+ },
3390
+ onError: t.bind(null)
3391
+ });
3392
+ return {
3393
+ form: s,
3394
+ handleSubmit: P((e) => (e.preventDefault(), e.stopPropagation(), s.handleSubmit(async (e) => {
3395
+ let t = Mn(e);
3396
+ await c.mutateAsync(t), s.reset(e), await a.refetch();
3397
+ })(e)), [
3398
+ s.handleSubmit,
3399
+ c.mutateAsync,
3400
+ s.reset,
3401
+ a.refetch
3402
+ ])
3403
+ };
3404
+ };
3405
+ //#endregion
3406
+ //#region src/screens/minhaEmpresa/minhaEmpresa.tsx
3407
+ function Pn() {
3408
+ let { form: e, handleSubmit: t } = Nn(), n = y("(max-width: 600px)");
3409
+ return e.formState.isLoading ? /* @__PURE__ */ D(un, {
3410
+ centerContent: !0,
3411
+ height: "75vh",
3412
+ children: /* @__PURE__ */ D(s, {})
3413
+ }) : /* @__PURE__ */ D(Ie, {
3414
+ ...e,
3415
+ children: /* @__PURE__ */ D("form", {
3416
+ onSubmit: t,
3417
+ children: /* @__PURE__ */ D(d, {
3418
+ elevation: 2,
3419
+ sx: {
3420
+ borderRadius: n ? "0 0 16px 16px" : "0 16px 16px 16px",
3421
+ padding: "1rem"
3422
+ },
3423
+ children: /* @__PURE__ */ O(l, {
3424
+ container: !0,
3425
+ spacing: 3,
3426
+ children: [
3427
+ /* @__PURE__ */ D(l, {
3428
+ size: 12,
3429
+ children: /* @__PURE__ */ D(An, {})
3430
+ }),
3431
+ /* @__PURE__ */ D(l, {
3432
+ size: 12,
3433
+ children: /* @__PURE__ */ D(c, {})
3434
+ }),
3435
+ /* @__PURE__ */ D(l, {
3436
+ size: 12,
3437
+ children: /* @__PURE__ */ D(Tn, {})
3438
+ }),
3439
+ /* @__PURE__ */ D(l, {
3440
+ size: 12,
3441
+ children: /* @__PURE__ */ D(c, {})
3442
+ }),
3443
+ /* @__PURE__ */ D(l, {
3444
+ size: 12,
3445
+ children: /* @__PURE__ */ D(Dn, {})
3446
+ }),
3447
+ /* @__PURE__ */ D(l, {
3448
+ size: 12,
3449
+ children: /* @__PURE__ */ D(c, {})
3450
+ }),
3451
+ /* @__PURE__ */ D(l, {
3452
+ size: 12,
3453
+ children: /* @__PURE__ */ D(On, {})
3454
+ })
3455
+ ]
3456
+ })
3457
+ })
3458
+ })
3459
+ });
3460
+ }
3461
+ var Fn = he(Pn);
3462
+ Fn.displayName = "MinhaEmpresa";
3463
+ //#endregion
3464
+ //#region src/screens/minhaConta/useMinhaConta.tsx
3465
+ var In = () => {
3466
+ let e = q((e) => e.tabAtiva || "minhaEmpresa"), t = q((e) => e.setTabAtiva);
3467
+ return {
3468
+ esconderTabMeuPlano: q((e) => e.esconderTabMeuPlano),
3469
+ tabAtiva: e,
3470
+ setTabAtiva: t,
3471
+ fullWidthTabs: y("(max-width:600px)")
3472
+ };
3473
+ };
3474
+ //#endregion
3475
+ //#region src/screens/minhaConta/minhaConta.tsx
3476
+ function Ln({ onNotification: e }) {
3477
+ let { esconderTabMeuPlano: t, tabAtiva: n, setTabAtiva: r, fullWidthTabs: i } = In();
3478
+ return /* @__PURE__ */ D(Y, {
3479
+ onNotification: e,
3480
+ children: /* @__PURE__ */ O(l, {
3481
+ container: !0,
3482
+ children: [/* @__PURE__ */ D(l, {
3483
+ size: {
3484
+ xs: 12,
3485
+ sm: "auto"
3486
+ },
3487
+ children: /* @__PURE__ */ O(m, {
3488
+ variant: i ? "fullWidth" : "standard",
3489
+ value: n,
3490
+ onChange: (e, t) => r(t),
3491
+ children: [/* @__PURE__ */ D(p, {
3492
+ label: "Minha empresa",
3493
+ value: "minhaEmpresa"
3494
+ }), !t && /* @__PURE__ */ D(p, {
3495
+ label: "Meu plano",
3496
+ value: "meuPlano"
3497
+ })]
3498
+ })
3499
+ }), /* @__PURE__ */ O(l, {
3500
+ size: 12,
3501
+ children: [n === "minhaEmpresa" ? /* @__PURE__ */ D(Fn, {}) : null, n === "meuPlano" ? /* @__PURE__ */ D(xn, {}) : null]
3502
+ })]
3503
+ })
3504
+ });
3505
+ }
3506
+ function Rn(e) {
3507
+ return /* @__PURE__ */ D(rn, { children: /* @__PURE__ */ D(lt, {
3508
+ ...e,
3509
+ children: /* @__PURE__ */ D(Ln, { onNotification: e.onNotification })
3510
+ }) });
3511
+ }
3512
+ //#endregion
3513
+ export { an as ApiConfirmarEmail, Qe as ApiMinhaConta, ln as ConfirmarEmail, _n as Faturas, xn as MeuPlano, _t as MeuPlanoInfo, Rn as MinhaConta, lt as MinhaContaProvider, rn as MinhaContaQueryProvider, Fn as MinhaEmpresa, Y as NotificationProvider, Wt as PlanosDialog, nn as RecursosDialog };
3514
+
3515
+ //# sourceMappingURL=index.mjs.map