@s_mart/minha-conta 16.1.4 → 16.1.7

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.
@@ -1,6 +1,19 @@
1
1
  import { BuscarPlanosEGruposPayload } from '../helpers/contrateApi/contrateApi.types';
2
2
  import { AlterarPlanoPayload, AtualizarEmailsCobrancaBody, AtualizarMeusDadosBody, BuscarPlanoPayload } from '../helpers/contrateApi/meusDadosApi.types';
3
3
  import { ApiMinhaConta } from '.';
4
+ export declare const queryKeys: {
5
+ readonly all: readonly ["minha-conta"];
6
+ readonly buscarMeusDados: () => readonly ["minha-conta", "meus-dados"];
7
+ readonly buscarMeuPlanoRecursos: () => readonly ["minha-conta", "meu-plano"];
8
+ readonly buscarPlano: (payload: BuscarPlanoPayload) => readonly ["minha-conta", "plano", BuscarPlanoPayload];
9
+ readonly listarCobrancas: () => readonly ["minha-conta", "meu-plano", "cobrancas"];
10
+ readonly buscarBoleto: (identificador: string) => readonly ["minha-conta", "meu-plano", "cobrancas", "boleto", string];
11
+ readonly buscarNfse: (identificador: string) => readonly ["minha-conta", "meu-plano", "cobrancas", "Nfse", string];
12
+ readonly listarPlanosEGrupos: (payload: BuscarPlanosEGruposPayload) => (string | BuscarPlanosEGruposPayload)[];
13
+ readonly buscarRntrc: (cnpj: string) => string[];
14
+ readonly buscarCep: (cep: string) => string[];
15
+ readonly pesquisarCidades: (search: string) => string[];
16
+ };
4
17
  export declare const generateQueries: (endpoint: ApiMinhaConta) => {
5
18
  readonly buscarMeusDados: () => import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<import('axios').AxiosResponse<import('../helpers/types').ApiResponse<import('../helpers/contrateApi/meusDadosApi.types').BuscarMeusDadosResponse>, any, {}, any>, Error, import('axios').AxiosResponse<import('../helpers/types').ApiResponse<import('../helpers/contrateApi/meusDadosApi.types').BuscarMeusDadosResponse>, any, {}, any>, readonly ["minha-conta", "meus-dados"]>, "queryFn"> & {
6
19
  queryFn?: import('@tanstack/react-query').QueryFunction<import('axios').AxiosResponse<import('../helpers/types').ApiResponse<import('../helpers/contrateApi/meusDadosApi.types').BuscarMeusDadosResponse>, any, {}, any>, readonly ["minha-conta", "meus-dados"], never> | undefined;
@@ -1,3 +1,3 @@
1
1
  import { NotificationContextValues, NotificationProviderProps } from './notificationProvider.types';
2
- export declare const NotificationProvider: ({ onNotification: setNotification, children }: NotificationProviderProps) => import("react").JSX.Element;
2
+ export declare const NotificationProvider: ({ onNotification: setNotification, children, }: NotificationProviderProps) => import("react").JSX.Element;
3
3
  export declare const useNotificationContext: () => NotificationContextValues;
package/dist/index.mjs CHANGED
@@ -338,7 +338,7 @@ function lt(e) {
338
338
  ...et(e.api),
339
339
  ...tt(e.api)
340
340
  })), s = P(() => {
341
- a.setState({ usuario: ct(e.api.token) }), r.resetQueries();
341
+ a.setState({ usuario: ct(e.api.token) }), r.resetQueries({ queryKey: G.all }).catch(() => {});
342
342
  }, [
343
343
  e.api.token,
344
344
  r.resetQueries,
@@ -547,10 +547,9 @@ var vt = (e) => {
547
547
  value: {
548
548
  setNotification: e,
549
549
  handleErrors: (t) => {
550
- let n = vt(t);
551
- console.error(t), e({
550
+ e({
552
551
  variant: "error",
553
- title: n[0]
552
+ title: vt(t)[0]
554
553
  });
555
554
  }
556
555
  },
@@ -2149,7 +2148,7 @@ var un = v(d)`
2149
2148
  onError: a.bind(null)
2150
2149
  }), s = Re({ async defaultValues() {
2151
2150
  let e = [];
2152
- return (await n.ensureQueryData(t.buscarMeusDados())).data.data.emailCobranca?.split(";").map((t) => {
2151
+ return (await n.ensureQueryData(t.buscarMeusDados())).data.data.emailCobranca?.split(";").forEach((t) => {
2153
2152
  e.push({ email: t.trim() });
2154
2153
  }), { emails: e };
2155
2154
  } }), { fields: c, remove: l, append: u } = Le({
@@ -2162,8 +2161,12 @@ var un = v(d)`
2162
2161
  append: u,
2163
2162
  maxFields: c.length === 3,
2164
2163
  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();
2164
+ try {
2165
+ let t = e.emails.map((e) => e.email).join(";");
2166
+ await o.mutateAsync({ emails: t }), await r.refetch();
2167
+ } catch (e) {
2168
+ a(e);
2169
+ }
2167
2170
  })(e), [
2168
2171
  s.handleSubmit,
2169
2172
  o.mutateAsync,
@@ -2988,9 +2991,7 @@ var En = () => {
2988
2991
  uf: e.data.data.uf
2989
2992
  }
2990
2993
  }), 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);
2991
- } catch (e) {
2992
- console.error("Erro ao buscar CEP"), console.error(e);
2993
- }
2994
+ } catch {}
2994
2995
  }, [
2995
2996
  e,
2996
2997
  a.ensureQueryData,
@@ -3394,8 +3395,12 @@ var jn = (e) => {
3394
3395
  return {
3395
3396
  form: s,
3396
3397
  handleSubmit: P((e) => (e.preventDefault(), e.stopPropagation(), s.handleSubmit(async (e) => {
3397
- let t = Mn(e);
3398
- await c.mutateAsync(t), s.reset(e), await a.refetch();
3398
+ try {
3399
+ let t = Mn(e);
3400
+ await c.mutateAsync(t), s.reset(e), await a.refetch();
3401
+ } catch (e) {
3402
+ t(e);
3403
+ }
3399
3404
  })(e)), [
3400
3405
  s.handleSubmit,
3401
3406
  c.mutateAsync,