@s_mart/minha-conta 9.0.0-next.0 → 9.0.0-next.1
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.
- package/dist/index.mjs +1 -1
- package/package.json +17 -15
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{cloneElement as Ms}from"react";import{Tab as Es}from"@s_mart/core";import{Grid as ar}from"@mui/material";import{useEffect as Dt}from"react";import{jwtDecode as Rt}from"jwt-decode";import{Backdrop as st,CircularProgress as lt}from"@mui/material";import{jsx as ir}from"react/jsx-runtime";function mt({show:o}){return ir(st,{open:o,style:{zIndex:1e4},children:ir(lt,{size:50,sx:{color:e=>e.palette.primary.main}})})}var nr=mt;import{create as pt}from"zustand";var Me={axiosInstance:null,ready:!1,tabAtiva:"minhaEmpresa",sistemaNome:"",telefoneSuporte:"",telefoneCS:"",minhaEmpresa:{},meuPlano:{},recursosDialog:{},planosDialog:{}};var ct=pt(o=>({...Me,setValues:e=>o(e),setTabAtiva:e=>o({tabAtiva:e}),resetState:()=>o(Me)})),u=ct;import{create as ut}from"zustand";var dt=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},sr=dt;var Ee={loading:!1,notification:null};var ft=ut(o=>({...Ee,setLoading:e=>o({loading:e}),toggleNotification:e=>o({notification:e}),handleErrors:e=>{let r=sr(e);o({loading:!1,notification:{title:r[0],variant:"error",autoHideDuration:5e3}})},resetState:()=>o(Ee)})),x=ft;import{useEffect as gt}from"react";import{
|
|
1
|
+
import{cloneElement as Ms}from"react";import{Tab as Es}from"@s_mart/core";import{Grid as ar}from"@mui/material";import{useEffect as Dt}from"react";import{jwtDecode as Rt}from"jwt-decode";import{Backdrop as st,CircularProgress as lt}from"@mui/material";import{jsx as ir}from"react/jsx-runtime";function mt({show:o}){return ir(st,{open:o,style:{zIndex:1e4},children:ir(lt,{size:50,sx:{color:e=>e.palette.primary.main}})})}var nr=mt;import{create as pt}from"zustand";var Me={axiosInstance:null,ready:!1,tabAtiva:"minhaEmpresa",sistemaNome:"",telefoneSuporte:"",telefoneCS:"",minhaEmpresa:{},meuPlano:{},recursosDialog:{},planosDialog:{}};var ct=pt(o=>({...Me,setValues:e=>o(e),setTabAtiva:e=>o({tabAtiva:e}),resetState:()=>o(Me)})),u=ct;import{create as ut}from"zustand";var dt=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},sr=dt;var Ee={loading:!1,notification:null};var ft=ut(o=>({...Ee,setLoading:e=>o({loading:e}),toggleNotification:e=>o({notification:e}),handleErrors:e=>{let r=sr(e);o({loading:!1,notification:{title:r[0],variant:"error",autoHideDuration:5e3}})},resetState:()=>o(Ee)})),x=ft;import{useEffect as gt}from"react";import{useNotistack as yt}from"@s_mart/notistack";var ht={success:"A\xE7\xE3o realizada com sucesso!",warning:"Aten\xE7\xE3o",error:"Algum problema ocorreu"},Ct=()=>{let o=x(a=>a.notification),e=x(a=>a.toggleNotification),r=yt();gt(()=>{o&&r.setNotification({title:o.title||ht[o.variant||"success"],message:o.message,variant:o.variant,autoHideDuration:o.autoHideDuration,onClose:(a,i)=>{i!=="clickaway"&&(o.onClose?.(),i!=="maxsnack"&&e(null))},style:{minWidth:"19rem",maxWidth:"50rem"}})},[o])},Yo=Ct;import{create as xt}from"zustand";import mr from"dayjs";import lr from"axios";var bt=()=>{let o=u.getState().axiosInstance,r=u.getState().endpointsV2?"/v2":"";return{fetchMeusDados:()=>o.get(`${r}/meus-dados`),updateMeusDados:a=>o.patch(`${r}/meus-dados`,a),confirmarEmailEmpresa:(a,i)=>lr.post(`${a}/meus-dados/confirmar-atualizacao-do-email-da-empresa/${i}`),confirmarEmailResponsavel:(a,i)=>lr.post(`${a}/meus-dados/confirmar-atualizacao-do-email-do-responsavel/${i}`),fetchMeuPlano:()=>o.get(`${r}/meus-dados/meu-plano/recursos`),contratarRecurso:a=>o.patch(`${r}/meus-dados/plano/contratar-recurso/${a}`),descontratarRecurso:a=>o.patch(`${r}/meus-dados/plano/descontratar-recurso/${a}`),buscarPlano:(a,i)=>o.get(`${r}/meus-dados/plano-buscar/${a}`,{params:{periodicidade:i}}),contratarPlano:a=>o.patch(`${r}/meus-dados/alterar-plano`,a),fetchCobrancas:()=>o.get(`${r}/meus-dados/cobrancas`),fetchBoleto:a=>o.get(`${r}/meus-dados/cobrancas/baixar-boleto/${a}`),fetchNfse:a=>o.get(`${r}/meus-dados/cobrancas/baixar-nfse/${a}`)}},w=bt;var Uo={codigoGrupo:null,codigoPlano:null,dataContratacao:null,descricaoPlano:null,diasCarencia:null,diaVencimentoBoleto:null,nomePlano:null,observacaoPlano:null,periodicidade:null,qtdeBilhetagem:null,recursos:null,tipoAcesso:null,tipoCobranca:null,valor:null,cobrancas:[],fetchedCobrancas:!1,fetchedMeuPlano:!1};var Pt=xt((o,e)=>({...Uo,fetchMeuPlano:async()=>{try{let r=await w().fetchMeuPlano();r.data&&o({...e().fetchedMeuPlano?Uo:{},...r.data,fetchedMeuPlano:!0,fetchedCobrancas:e().fetchedCobrancas})}catch(r){x.getState().handleErrors(r)}},fetchCobrancas:async()=>{try{let r=await w().fetchCobrancas();r.data&&o({cobrancas:r.data.sort((a,i)=>mr(i.dataVencimento).unix()-mr(a.dataVencimento).unix()),fetchedCobrancas:!0})}catch(r){x.getState().handleErrors(r)}},getValorTotalPlano:()=>{let r=e().valor??0,a=e().recursos?.filter(i=>i.recursoContratado).reduce((i,n)=>i+n.valorRecurso,0)??0;return r+a},getMeuPlanoData:()=>{let r={...e()},a=["cobrancas","fetchedCobrancas","fetchedMeuPlano"],i=Object.entries(r).filter(([n,l])=>typeof l!="function"&&!a.includes(n));return Object.fromEntries(i)},resetState:()=>o(Uo)})),b=Pt;import{create as St}from"zustand";var Qo={alteracaoDoEmailDaEmpresa:null,alteracaoDoEmailDoResponsavel:null,bairro:null,cep:null,cidade:null,codigoCidade:null,complemento:null,cpfCnpj:null,dataContratacao:null,dataInativacao:null,email:null,emailResponsavel:null,exibirAbaMeuPlano:null,fone:null,foneResponsavel:null,funruralDescricao:null,funruralTipo:null,ie:null,logotipo:null,motivoInativacao:null,nomeFantasia:null,nomeResponsavel:null,numero:null,razaoSocial:null,regimeTributario:null,rntrc:null,rntrcDataVencimento:null,rua:null,situacao:null,tipoPessoa:null,uf:null,fetched:!1};var vt=St((o,e)=>({...Qo,fetchMinhaEmpresa:async()=>{try{let r=await w().fetchMeusDados();r.data&&o({...Qo,...r.data,fetched:!0})}catch(r){x.getState().handleErrors(r)}},updateMinhaEmpresa:async(r,a)=>{try{await w().updateMeusDados(r),x.getState().toggleNotification({title:"Dados atualizados com sucesso!",variant:"success"}),a?.callback?.(),await e().fetchMinhaEmpresa()}catch(i){a?.fallback?.(i),x.getState().handleErrors(i)}},getMeusDados:()=>{let r={...e()},a=["fetched"],i=Object.entries(r).filter(([n,l])=>typeof l!="function"&&!a.includes(n));return Object.fromEntries(i)},resetState:()=>o(Qo)})),v=vt;import Mt from"axios";import{Fragment as pr,jsx as cr,jsxs as Tt}from"react/jsx-runtime";function Et(o){let e=u(p=>p.ready),r=x(p=>p.loading),a=u(p=>p.setValues),i=u(p=>p.resetState),n=x(p=>p.resetState),l=b(p=>p.resetState),m=v(p=>p.resetState);return Yo(),Dt(()=>{let p,d=o.axiosInstance?.defaults.headers.common.Authorization?.toString().replace("Bearer ","");if(d)try{p={email:Rt(d).email}}catch{}let C=Mt.create({...o.axiosInstance?.defaults});return C?.interceptors.response.use(function(g){return Array.isArray(g.data)?g.data:{...g.data,status:g.status}},function(g){return Promise.reject(g?.response?.data||{message:g?.message})}),a({...o,axiosInstance:C,usuario:p,ready:!0}),()=>{n(),l(),m(),i()}},[]),e?Tt(pr,{children:[o.children,cr(nr,{show:r})]}):cr(pr,{})}var So=Et;import{useMemo as Qa}from"react";import{memo as Ei}from"react";import{Divider as Ve,Grid as no,CircularProgress as Ti,useMediaQuery as Ai}from"@mui/material";import{Form as Ii}from"@s_mart/form";import At from"@emotion/styled";import{css as It}from"@emotion/react";import{colorPalette as Gt}from"@s_mart/tokens";var z=At.div`
|
|
2
2
|
background-color: ${Gt.neutral[0]};
|
|
3
3
|
box-shadow: 0px 3px 12px rgba(0, 0, 0, 0.12);
|
|
4
4
|
border-radius: 4px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s_mart/minha-conta",
|
|
3
|
-
"version": "9.0.0-next.
|
|
3
|
+
"version": "9.0.0-next.1",
|
|
4
4
|
"main": "./dist/index.mjs",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.mts",
|
|
@@ -32,15 +32,16 @@
|
|
|
32
32
|
"react-hook-form": "^7.51.0",
|
|
33
33
|
"typescript": ">=5.4.2",
|
|
34
34
|
"zustand": "^4.5.2",
|
|
35
|
-
"@s_mart/
|
|
36
|
-
"@s_mart/
|
|
37
|
-
"@s_mart/form": "8.0.0-next.
|
|
38
|
-
"@s_mart/hooks": "8.0.0-next.
|
|
35
|
+
"@s_mart/core": "8.0.0-next.1",
|
|
36
|
+
"@s_mart/data": "9.0.0-next.1",
|
|
37
|
+
"@s_mart/form": "8.0.0-next.1",
|
|
38
|
+
"@s_mart/hooks": "8.0.0-next.1",
|
|
39
39
|
"@s_mart/masks": "5.1.2",
|
|
40
|
-
"@s_mart/
|
|
41
|
-
"@s_mart/
|
|
40
|
+
"@s_mart/notistack": "1.0.0-next.0",
|
|
41
|
+
"@s_mart/typed": "7.0.0-next.0",
|
|
42
|
+
"@s_mart/regular-icons": "5.3.2-next.0",
|
|
42
43
|
"@s_mart/rules": "5.1.1",
|
|
43
|
-
"@s_mart/solid-icons": "5.2.
|
|
44
|
+
"@s_mart/solid-icons": "5.2.2-next.0",
|
|
44
45
|
"@s_mart/tokens": "5.1.0",
|
|
45
46
|
"@s_mart/utils": "5.1.1"
|
|
46
47
|
},
|
|
@@ -66,15 +67,16 @@
|
|
|
66
67
|
"react-hook-form": "^7.51.0",
|
|
67
68
|
"typescript": ">=5.4.2",
|
|
68
69
|
"zustand": "^4.5.2",
|
|
69
|
-
"@s_mart/core": "8.0.0-next.
|
|
70
|
-
"@s_mart/data": "9.0.0-next.
|
|
71
|
-
"@s_mart/form": "8.0.0-next.
|
|
72
|
-
"@s_mart/hooks": "8.0.0-next.
|
|
73
|
-
"@s_mart/typed": "
|
|
70
|
+
"@s_mart/core": "8.0.0-next.1",
|
|
71
|
+
"@s_mart/data": "9.0.0-next.1",
|
|
72
|
+
"@s_mart/form": "8.0.0-next.1",
|
|
73
|
+
"@s_mart/hooks": "8.0.0-next.1",
|
|
74
|
+
"@s_mart/typed": "7.0.0-next.0",
|
|
74
75
|
"@s_mart/masks": "5.1.2",
|
|
75
|
-
"@s_mart/
|
|
76
|
+
"@s_mart/notistack": "1.0.0-next.0",
|
|
77
|
+
"@s_mart/regular-icons": "5.3.2-next.0",
|
|
76
78
|
"@s_mart/rules": "5.1.1",
|
|
77
|
-
"@s_mart/solid-icons": "5.2.
|
|
79
|
+
"@s_mart/solid-icons": "5.2.2-next.0",
|
|
78
80
|
"@s_mart/tokens": "5.1.0",
|
|
79
81
|
"@s_mart/utils": "5.1.1"
|
|
80
82
|
},
|