@credithub/harlan-components 1.28.2 → 1.30.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.
@@ -51,7 +51,7 @@ var ChartSystem = function (_a) {
51
51
  useEffect(function () {
52
52
  if (consultaPefinBoaVista || consultaPefinSerasa)
53
53
  refetch();
54
- }, [consultaPefinBoaVista, consultaPefinSerasa]);
54
+ }, [consultaPefinBoaVista, consultaPefinSerasa, refetch]);
55
55
  return (React.createElement(PrintSectionWrapper, null,
56
56
  React.createElement(Header, { title: "Resumo de Negativa\u00E7\u00F5es", subtitle: "Veja a quantidade de ocorr\u00EAncias conforme o documento foi consultado ao longo do tempo", description: errorMessage && (React.createElement(StatusMessage, { type: "error" }, errorMessage)), variant: isLoading ? 'loading' : 'default', icon: ResumoDeNegativacoesIcon, actions: React.createElement(BtnWrapper, { onClick: toggleOpen }, isOpen ? React.createElement(ChevronUp, null) : React.createElement(ChevronDown, null)) }),
57
57
  React.createElement(Content, { isOpen: isOpen },
@@ -1,5 +1,5 @@
1
- import { useContext, useEffect, useState, useMemo } from 'react';
2
- import { useQuery, Queries, RequestStatus } from '../../../components/webservice';
1
+ import { Queries, RequestStatus, useQuery } from '../../../components/webservice';
2
+ import { useContext, useEffect, useMemo, useState } from 'react';
3
3
  import { processData, processProtestData } from '../utils/dataProcessing';
4
4
  var useChartData = function (documento) {
5
5
  var _a = useState(null), data = _a[0], setData = _a[1];
@@ -35,7 +35,7 @@ var useChartData = function (documento) {
35
35
  if (liveQueriesIsFinish) {
36
36
  refetch();
37
37
  }
38
- }, [liveQueriesIsFinish]);
38
+ }, [liveQueriesIsFinish, refetch]);
39
39
  useEffect(function () {
40
40
  if (!isLoading &&
41
41
  !queryError &&
@@ -57,7 +57,8 @@ var useChartData = function (documento) {
57
57
  response,
58
58
  queryError,
59
59
  liveQueriesIsFinish,
60
- quantidadeProcessosJuridicos
60
+ quantidadeProcessosJuridicos,
61
+ dadosProtestos
61
62
  ]);
62
63
  return { data: data, isLoading: isLoading, error: errorState || queryError, refetch: refetch };
63
64
  };
@@ -1,10 +1,10 @@
1
- import { useMemo } from 'react';
2
1
  import { useWindowSize } from '../../../hooks/useWindowSize';
2
+ import { useMemo } from 'react';
3
3
  export var usePieChartData = function (dataInput) {
4
4
  var width = useWindowSize().width;
5
5
  return useMemo(function () {
6
6
  var _a;
7
- var getLastValue = function (arr) { var _a; return arr.length > 0 ? (_a = arr[arr.length - 1].quantidade) !== null && _a !== void 0 ? _a : 0 : 0; };
7
+ var getLastValue = function (arr) { var _a; return arr.length > 0 ? ((_a = arr[arr.length - 1].quantidade) !== null && _a !== void 0 ? _a : 0) : 0; };
8
8
  var totalProtestos = getLastValue(dataInput.protestos);
9
9
  var totalCCFs = getLastValue(dataInput.ccfs);
10
10
  var totalSerasa = getLastValue(dataInput.serasa);
@@ -85,5 +85,5 @@ export var usePieChartData = function (dataInput) {
85
85
  }
86
86
  };
87
87
  return { data: chartData, options: options };
88
- }, [dataInput]);
88
+ }, [dataInput, width]);
89
89
  };
@@ -30,8 +30,9 @@ import Section from '../interface/section';
30
30
  import StatusMessage from '../interface/statusMessage';
31
31
  import { Queries, RequestStatus } from '../webservice';
32
32
  var getPossuiPendenciaText = function (_a) {
33
- var ccf = _a.ccf, ultimoRegistroCCF = _a.ultimoRegistroCCF, dividasPublicas = _a.dividasPublicas, protestos = _a.protestos, processosJuridicos = _a.processosJuridicos;
33
+ var ccf = _a.ccf, ultimoRegistroCCF = _a.ultimoRegistroCCF, dividasPublicas = _a.dividasPublicas, protestos = _a.protestos, processosJuridicos = _a.processosJuridicos, receitaStatus = _a.receitaStatus;
34
34
  return [
35
+ receitaStatus ? "".concat(receitaStatus) : '',
35
36
  dividasPublicas
36
37
  ? "".concat(formatMoney(dividasPublicas), " em D\u00EDvidas P\u00FAblicas")
37
38
  : '',
@@ -51,14 +52,20 @@ var getPossuiPendenciaText = function (_a) {
51
52
  ].filter(function (x) { return !!x; });
52
53
  };
53
54
  var ConsultaSimplesSection = function (_a) {
55
+ var _b, _c;
54
56
  var documento = _a.documento, children = _a.children, onClose = _a.onClose, rest = __rest(_a, ["documento", "children", "onClose"]);
55
57
  var ctx = useContext(Queries.Finder);
56
58
  var data = useGlobalData().data;
59
+ var receitaStatus = ((_c = (_b = data.dossie) === null || _b === void 0 ? void 0 : _b.summary) === null || _c === void 0 ? void 0 : _c.receitaStatus) &&
60
+ data.dossie.summary.receitaStatus !== 'ATIVA'
61
+ ? data.dossie.summary.receitaStatus
62
+ : null;
57
63
  var possuiPendencias = data.ccf ||
58
64
  data.protestos ||
59
65
  data.dividasPublicas ||
60
- data.processosJuridicos;
61
- var possuiPendenciaText = getPossuiPendenciaText(data);
66
+ data.processosJuridicos ||
67
+ receitaStatus;
68
+ var possuiPendenciaText = getPossuiPendenciaText(__assign(__assign({}, data), { receitaStatus: receitaStatus }));
62
69
  var isError = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Error;
63
70
  var isLoading = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Loading;
64
71
  var statusType = isError
@@ -4,7 +4,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
4
4
  };
5
5
  import { Chart, registerables } from 'chart.js';
6
6
  import React from 'react';
7
- import styled from 'styled-components';
7
+ import styled, { ThemeProvider } from 'styled-components';
8
8
  import { Addresses, BankAccounts, CCF, ChartSystem, Contacts, DividasPublicas, Dossie, Partners, ProcessosJuridicos, Protestos, Queries, RefinBoaVista, RefinSerasa, Veiculos, WebServiceProvider } from './';
9
9
  import { ConsultaRfbProvider } from './components/consultaRfb';
10
10
  import ConsultaSimplesSection from './components/consultaSimplesSection/consultaSimplesSection';
@@ -12,6 +12,7 @@ import { ConsultasComplementaresProvider } from './components/consultasComplemen
12
12
  import Dominios from './components/dominios/dominios';
13
13
  import ConsultaImoveis from './components/imoveis/imoveisService';
14
14
  import GlobalStyle from './components/interface/globalStyle';
15
+ import theme from './components/interface/theme';
15
16
  import Liminar from './components/liminar/liminar';
16
17
  import ConsultaScore from './components/score/scoreService';
17
18
  import ConsultaSCR from './components/scr/scr';
@@ -21,8 +22,7 @@ var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateO
21
22
  var ConsultaSimples = function (_a) {
22
23
  var _documento = _a.documento, onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico, onClickQSA = _a.onClickQSA, onClickPrint = _a.onClickPrint, apiKey = _a.apiKey, onClose = _a.onClose, hasCredits = _a.hasCredits, _b = _a.initRefinBoaVista, initRefinBoaVista = _b === void 0 ? false : _b, _c = _a.initRefinSerasa, initRefinSerasa = _c === void 0 ? false : _c, _d = _a.initVeiculos, initVeiculos = _d === void 0 ? false : _d;
23
24
  var documento = _documento.replace(/\D+/g, '');
24
- return (React.createElement(React.Fragment, null,
25
- React.createElement(GlobalStyle, null),
25
+ return (React.createElement(ThemeProvider, { theme: theme },
26
26
  React.createElement(ConsultasComplementaresProvider, { hasCredits: hasCredits, initRefinBoaVista: initRefinBoaVista, initRefinSerasa: initRefinSerasa, initVeiculos: initVeiculos },
27
27
  React.createElement(WebServiceProvider, { credential: apiKey },
28
28
  React.createElement(Queries.Dominios.Request, { data: { documento: documento, cnpj: documento } },
@@ -53,7 +53,8 @@ var ConsultaSimples = function (_a) {
53
53
  React.createElement(Protestos, null),
54
54
  React.createElement(CCF, null),
55
55
  React.createElement(DividasPublicas, null),
56
- React.createElement(ProcessosJuridicos, { onClickConsultarProcessoJuridico: onClickConsultarProcessoJuridico }))))))))))))));
56
+ React.createElement(ProcessosJuridicos, { onClickConsultarProcessoJuridico: onClickConsultarProcessoJuridico })))))))))))),
57
+ React.createElement(GlobalStyle, null)));
57
58
  };
58
59
  export default ConsultaSimples;
59
60
  var templateObject_1;