@credithub/harlan-components 1.32.0 → 1.34.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.
- package/dist/assets/btn/buttonAtualizarDadosRfb.d.ts +3 -0
- package/dist/assets/btn/buttonAtualizarDadosRfb.js +10 -0
- package/dist/components/adresses/addresses.d.ts +2 -2
- package/dist/components/adresses/addresses.js +34 -12
- package/dist/components/adresses/map.js +1 -1
- package/dist/components/bank-accounts/bank-accounts.js +32 -28
- package/dist/components/ccf/ccf.js +2 -2
- package/dist/components/chart/chartSystem.js +51 -29
- package/dist/components/chart/hooks/useChartData.d.ts +6 -0
- package/dist/components/chart/hooks/useChartData.js +57 -4
- package/dist/components/chart/utils/chartUtils.d.ts +0 -4
- package/dist/components/chart/utils/chartUtils.js +0 -16
- package/dist/components/common/button.d.ts +1 -0
- package/dist/components/common/button.js +11 -24
- package/dist/components/consultaRfb.d.ts +2 -0
- package/dist/components/consultaRfb.js +17 -14
- package/dist/components/consultaSimplesSection/consultaSimplesSection.js +2 -2
- package/dist/components/contacts/contacts.js +8 -5
- package/dist/components/dividasPublicas/dividasPublicas.js +40 -40
- package/dist/components/dominios/dominios.js +17 -6
- package/dist/components/dossie/dossie.js +20 -10
- package/dist/components/dossie/summary/cardsAndProducts.d.ts +6 -8
- package/dist/components/dossie/summary/cardsAndProducts.js +94 -26
- package/dist/components/dossie/summary/styles.d.ts +12 -0
- package/dist/components/dossie/summary/styles.js +38 -0
- package/dist/components/dossie/summary/summary.js +7 -16
- package/dist/components/dossie/summary/utils.js +12 -2
- package/dist/components/imoveis/imoveisService.js +26 -13
- package/dist/components/interface/header.js +3 -3
- package/dist/components/interface/loadingBar.js +3 -6
- package/dist/components/interface/section.d.ts +2 -0
- package/dist/components/interface/section.js +7 -6
- package/dist/components/liminar/liminar.js +25 -15
- package/dist/components/llama/llama.d.ts +6 -0
- package/dist/components/llama/llama.js +122 -0
- package/dist/components/partners/partnerList.js +1 -1
- package/dist/components/partners/partners.js +28 -8
- package/dist/components/pep/pep.js +13 -6
- package/dist/components/processos-juridicos/processosJuridicos.js +19 -13
- package/dist/components/protestos/protestos.js +54 -39
- package/dist/components/refinBoaVista/refinBoaVista.js +31 -15
- package/dist/components/refinSerasa/refinSerasa.js +25 -38
- package/dist/components/score/scoreService.js +27 -13
- package/dist/components/scr/scr.js +123 -59
- package/dist/components/section.d.ts +3 -0
- package/dist/components/section.js +91 -0
- package/dist/components/veiculos/veiculos.js +28 -12
- package/dist/components/webservice.d.ts +22 -29
- package/dist/components/webservice.js +92 -131
- package/dist/consultaSimples.js +2 -2
- package/dist/hooks/useConsultaRfb.d.ts +1 -0
- package/lib/cjs/index.js +1448 -1030
- package/lib/esm/index.js +1449 -1031
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Button from '../../components/common/button';
|
|
3
|
+
import { useConsultaRfb } from '../../hooks/useConsultaRfb';
|
|
4
|
+
var ButtonAtualizarDadosRfb = function () {
|
|
5
|
+
var _a = useConsultaRfb(), executeFallback = _a.executeFallback, isLoading = _a.isLoading;
|
|
6
|
+
return (React.createElement(Button, { disabled: isLoading, isLoading: isLoading, onClick: function () {
|
|
7
|
+
executeFallback && executeFallback();
|
|
8
|
+
} }, "Atualizar Dados RFB"));
|
|
9
|
+
};
|
|
10
|
+
export default ButtonAtualizarDadosRfb;
|
|
@@ -22,17 +22,46 @@ import EnderecoIcon from '../../assets/icones/endereco';
|
|
|
22
22
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
23
23
|
import { useConsultaRfb } from '../../hooks/useConsultaRfb';
|
|
24
24
|
import XPathUtils from '../../utils/xpath';
|
|
25
|
-
import React, { useContext, useState } from 'react';
|
|
25
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
26
26
|
import { uniq } from 'underscore';
|
|
27
27
|
import AddItemField from '../common/addItem';
|
|
28
28
|
import { Result, ResultContent } from '../interface/result';
|
|
29
|
-
import {
|
|
29
|
+
import { Section } from '../section';
|
|
30
|
+
import { Queries, RequestStatus } from '../webservice';
|
|
30
31
|
var Addresses = function () {
|
|
31
32
|
var ctx = useContext(Queries.Finder);
|
|
32
|
-
var Section = ctx.Section;
|
|
33
|
-
var rfbResponse = useConsultaRfb().rfbResponse;
|
|
34
33
|
var setData = useGlobalData().setData;
|
|
34
|
+
var rfbResponse = useConsultaRfb().rfbResponse;
|
|
35
35
|
var _a = useState(false), dataUpdated = _a[0], setDataUpdated = _a[1];
|
|
36
|
+
useEffect(function () {
|
|
37
|
+
if (ctx.type === RequestStatus.Success && !dataUpdated && ctx.document) {
|
|
38
|
+
var data = ctx.document;
|
|
39
|
+
var _addresses = __spreadArray(__spreadArray([], ((data &&
|
|
40
|
+
XPathUtils.select('//enderecos/enderecos', data)) ||
|
|
41
|
+
[]), true), ((!data &&
|
|
42
|
+
rfbResponse &&
|
|
43
|
+
XPathUtils.select('//RFB/enderecos/endereco', rfbResponse)) ||
|
|
44
|
+
[]), true);
|
|
45
|
+
var addresses = uniq(_addresses.map(function (address) { return ({
|
|
46
|
+
type: XPathUtils.select('string(tipoLogradouro)', address),
|
|
47
|
+
address: XPathUtils.select('string(logradouro)', address),
|
|
48
|
+
number: XPathUtils.select('string(numero)', address),
|
|
49
|
+
zipcode: XPathUtils.select('string(cep)', address),
|
|
50
|
+
district: XPathUtils.select('string(bairro)', address),
|
|
51
|
+
city: XPathUtils.select('string(cidade)', address),
|
|
52
|
+
state: XPathUtils.select('string(uf)', address),
|
|
53
|
+
urlImage: '',
|
|
54
|
+
urlMaps: ''
|
|
55
|
+
}); }), function (e) { return e.address + e.district; });
|
|
56
|
+
if (addresses.length > 0) {
|
|
57
|
+
var addressState_1 = {
|
|
58
|
+
addresses: addresses
|
|
59
|
+
};
|
|
60
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { addresses: addressState_1 })); });
|
|
61
|
+
setDataUpdated(true);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, [ctx, rfbResponse, dataUpdated, setData]);
|
|
36
65
|
var response = function (data) {
|
|
37
66
|
var _addresses = __spreadArray(__spreadArray([], ((data && XPathUtils.select('//enderecos/enderecos', data)) ||
|
|
38
67
|
[]), true), ((!data &&
|
|
@@ -50,13 +79,6 @@ var Addresses = function () {
|
|
|
50
79
|
urlImage: '',
|
|
51
80
|
urlMaps: ''
|
|
52
81
|
}); }), function (e) { return e.address + e.district; });
|
|
53
|
-
if (!dataUpdated && addresses.length > 0) {
|
|
54
|
-
var addressState_1 = {
|
|
55
|
-
addresses: addresses
|
|
56
|
-
};
|
|
57
|
-
setData(function (prevState) { return (__assign(__assign({}, prevState), { addresses: addressState_1 })); });
|
|
58
|
-
setDataUpdated(true);
|
|
59
|
-
}
|
|
60
82
|
return (React.createElement(Result, { resultContentStriped: true, className: "address" }, addresses === null || addresses === void 0 ? void 0 : addresses.map(function (address, index) { return (React.createElement(ResultContent, { desktop: "repeat(7, 1fr)", tablet: "repeat(4, 1fr)", mobile: "repeat(2, 1fr)", key: index },
|
|
61
83
|
React.createElement(AddItemField, { name: "Tipo", value: address.type, style: { display: 'inline-block' } }),
|
|
62
84
|
React.createElement(AddItemField, { name: "Endere\u00E7o", value: address.address, style: { display: 'inline-block' } }),
|
|
@@ -66,6 +88,6 @@ var Addresses = function () {
|
|
|
66
88
|
React.createElement(AddItemField, { name: "Cidade", value: address.city, style: { display: 'inline-block' } }),
|
|
67
89
|
React.createElement(AddItemField, { name: "Estado", value: address.state, style: { display: 'inline-block' } }))); })));
|
|
68
90
|
};
|
|
69
|
-
return (React.createElement(Section, { title: "Endere\u00E7os", subtitle: "Informa\u00E7\u00F5es de endere\u00E7os do documento pesquisado.", icon: EnderecoIcon, minimized: false, ctx: ctx, onError: function () { return response(undefined); }, onSuccess: response }));
|
|
91
|
+
return (React.createElement(Section, { title: "Endere\u00E7os", subtitle: "Informa\u00E7\u00F5es de endere\u00E7os do documento pesquisado.", icon: EnderecoIcon, minimized: false, ctx: __assign(__assign({}, ctx), { progress: ctx.progress }), onError: function () { return response(undefined); }, onSuccess: response }));
|
|
70
92
|
};
|
|
71
93
|
export default Addresses;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
1
|
import { GoogleMap, LoadScript, Marker } from '@react-google-maps/api';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import { getGeocode } from './getGeocode';
|
|
4
4
|
var MapContainer = function (_a) {
|
|
5
5
|
var address = _a.address, apiKey = _a.apiKey;
|
|
@@ -12,15 +12,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import ContasBancariasIcon from '../../assets/icones/contasBancarias';
|
|
13
13
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
14
14
|
import XPathUtils from '../../utils/xpath';
|
|
15
|
-
import React, { useContext, useState } from 'react';
|
|
15
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
16
16
|
import { useTheme } from 'styled-components';
|
|
17
17
|
import AddItemField from '../common/addItem';
|
|
18
18
|
import { Result, ResultContent } from '../interface/result';
|
|
19
19
|
import StatusMessage from '../interface/statusMessage';
|
|
20
|
-
import {
|
|
20
|
+
import { Section } from '../section';
|
|
21
|
+
import { Queries, RequestStatus } from '../webservice';
|
|
21
22
|
var BankAccounts = function () {
|
|
22
23
|
var ctx = useContext(Queries.Finder);
|
|
23
|
-
var Section = ctx.Section;
|
|
24
24
|
var setData = useGlobalData().setData;
|
|
25
25
|
var _a = useState(false), dataUpdated = _a[0], setDataUpdated = _a[1];
|
|
26
26
|
var theme = useTheme();
|
|
@@ -32,32 +32,36 @@ var BankAccounts = function () {
|
|
|
32
32
|
conta: XPathUtils.select('string(conta)', account)
|
|
33
33
|
}); });
|
|
34
34
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (accounts.length > 0) {
|
|
44
|
-
var bankAccountsData_1 = {
|
|
45
|
-
bankAccounts: accounts
|
|
46
|
-
};
|
|
47
|
-
setData(function (prevState) { return (__assign(__assign({}, prevState), { bankAccountsData: bankAccountsData_1 })); });
|
|
48
|
-
}
|
|
35
|
+
useEffect(function () {
|
|
36
|
+
if (ctx.type === RequestStatus.Success && !dataUpdated && ctx.document) {
|
|
37
|
+
var accounts = extractBankAccountData(ctx.document);
|
|
38
|
+
if (accounts.length > 0) {
|
|
39
|
+
var bankAccountsData_1 = {
|
|
40
|
+
bankAccounts: accounts
|
|
41
|
+
};
|
|
42
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { bankAccounts: bankAccountsData_1 })); });
|
|
49
43
|
setDataUpdated(true);
|
|
50
44
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
45
|
+
}
|
|
46
|
+
}, [ctx, dataUpdated, setData]);
|
|
47
|
+
var response = function (data) {
|
|
48
|
+
var accounts = extractBankAccountData(data);
|
|
49
|
+
var message = (accounts === null || accounts === void 0 ? void 0 : accounts.length)
|
|
50
|
+
? (accounts === null || accounts === void 0 ? void 0 : accounts.length) > 1
|
|
51
|
+
? "Encontrada ".concat(accounts === null || accounts === void 0 ? void 0 : accounts.length, " contas banc\u00E1rias")
|
|
52
|
+
: 'Encontrada 1 conta bancária'
|
|
53
|
+
: 'Não foram encontradas ocorrências';
|
|
54
|
+
return {
|
|
55
|
+
children: accounts.length ? (React.createElement(Result, null, accounts.map(function (account, key) { return (React.createElement(ResultContent, { key: key },
|
|
56
|
+
React.createElement(AddItemField, { name: "Banco", value: account.banco }),
|
|
57
|
+
React.createElement(AddItemField, { name: "Ag\u00EAncia", value: account.agencia }),
|
|
58
|
+
React.createElement(AddItemField, { name: "Conta", value: account.conta }))); }))) : null,
|
|
59
|
+
description: React.createElement(StatusMessage, null, message),
|
|
60
|
+
iconProps: {
|
|
61
|
+
circleFill: (accounts === null || accounts === void 0 ? void 0 : accounts.length) ? theme.colors.erro : ''
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
return (React.createElement(Section, { title: 'Informações de Contas Bancárias', subtitle: 'Vejas as informações disponíveis de contas bancárias.', icon: ContasBancariasIcon, ctx: __assign(__assign({}, ctx), { progress: ctx.progress }), minimized: false, onSuccess: response }));
|
|
62
66
|
};
|
|
63
67
|
export default BankAccounts;
|
|
@@ -15,11 +15,11 @@ import XPathUtils from '../../utils/xpath';
|
|
|
15
15
|
import React, { useCallback, useContext, useState } from 'react';
|
|
16
16
|
import { Result } from '../interface/result';
|
|
17
17
|
import StatusMessage from '../interface/statusMessage';
|
|
18
|
+
import { Section } from '../section';
|
|
18
19
|
import { Queries } from '../webservice';
|
|
19
20
|
import CCFList from './ccfList';
|
|
20
21
|
var CCF = function () {
|
|
21
22
|
var ctx = useContext(Queries.CCF);
|
|
22
|
-
var Section = ctx.Section;
|
|
23
23
|
var setData = useGlobalData().setData;
|
|
24
24
|
var _a = useState(false), dataUpdated = _a[0], setDataUpdated = _a[1];
|
|
25
25
|
var mapNodeToCCFData = useCallback(function (node) { return ({
|
|
@@ -29,7 +29,7 @@ var CCF = function () {
|
|
|
29
29
|
ultimaOcorrencia: XPathUtils.select('string(./ultimo)', node),
|
|
30
30
|
motivo: XPathUtils.select('string(./motivo)', node)
|
|
31
31
|
}); }, []);
|
|
32
|
-
return (React.createElement(Section, { ctx: ctx, title: "Cheques sem Fundos em Institui\u00E7\u00E3o Banc\u00E1ria", subtitle: "Detalhes acerca de cheques sem fundos emitidos.", icon: ChequesSemFundoIcon, onSuccess: function (data) {
|
|
32
|
+
return (React.createElement(Section, { ctx: __assign(__assign({}, ctx), { progress: ctx.progress }), title: "Cheques sem Fundos em Institui\u00E7\u00E3o Banc\u00E1ria", subtitle: "Detalhes acerca de cheques sem fundos emitidos.", icon: ChequesSemFundoIcon, onSuccess: function (data) {
|
|
33
33
|
var allItems = XPathUtils.selectArray('//list/*', data);
|
|
34
34
|
var filteredItems = allItems.filter(function (node) {
|
|
35
35
|
return node.nodeName.startsWith('item');
|
|
@@ -2,36 +2,33 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
2
2
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
|
-
import React, { useContext, useEffect } from 'react';
|
|
6
|
-
import { useUltimaOcorrenciaCCF, useCalculation, useDividasPublicas } from './utils/chartUtils';
|
|
7
|
-
import Header from '../interface/header';
|
|
8
|
-
import StatusMessage from '../interface/statusMessage';
|
|
9
|
-
import useToggle from '../../hooks/useToggle';
|
|
10
|
-
import styled from 'styled-components';
|
|
11
|
-
import QuantidadeResultados from './quantityResult';
|
|
12
|
-
import ChartContent from './chartContent';
|
|
13
|
-
import BtnWrapper from '../../assets/btn/btnWrapper';
|
|
14
|
-
import ChevronUp from '../../assets/btn/chevronUp';
|
|
15
|
-
import ChevronDown from '../../assets/btn/chevronDown';
|
|
16
|
-
import useChartData from './hooks/useChartData';
|
|
17
5
|
import ResumoDeNegativacoesIcon from '../../assets/icones/resumoNegativacoes';
|
|
18
|
-
import { ConsultasComplementaresContext } from '../consultasComplementares';
|
|
19
6
|
import { converterParaFormatoValido } from '../../utils/date';
|
|
20
|
-
import {
|
|
7
|
+
import React, { useCallback, useContext, useEffect } from 'react';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import useToggle from '../../hooks/useToggle';
|
|
10
|
+
import { ConsultasComplementaresContext } from '../consultasComplementares';
|
|
11
|
+
import StatusMessage from '../interface/statusMessage';
|
|
12
|
+
import { Section } from '../section';
|
|
13
|
+
import { RequestStatus } from '../webservice';
|
|
14
|
+
import ChartContent from './chartContent';
|
|
15
|
+
import useChartData, { useDividasPublicas } from './hooks/useChartData';
|
|
16
|
+
import QuantidadeResultados from './quantityResult';
|
|
17
|
+
import { useCalculation, useUltimaOcorrenciaCCF } from './utils/chartUtils';
|
|
21
18
|
var Content = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n padding: 0px 30px;\n\n @media print {\n display: block;\n }\n"], ["\n display: ", ";\n padding: 0px 30px;\n\n @media print {\n display: block;\n }\n"])), function (props) { return (props.isOpen ? 'block' : 'none'); });
|
|
22
19
|
var ChartSystem = function (_a) {
|
|
23
|
-
var _b, _c, _d, _e, _f, _g, _h, _j
|
|
20
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
24
21
|
var documento = _a.documento;
|
|
25
|
-
var
|
|
22
|
+
var _k = useChartData(documento), data = _k.data, isLoading = _k.isLoading, error = _k.error, refetch = _k.refetch, chartDataProgress = _k.loadingProgress;
|
|
23
|
+
var _l = useDividasPublicas(), quantidadeDividas = _l.quantidade, valorTotalDividas = _l.valorTotal, dividasProgress = _l.loadingProgress;
|
|
26
24
|
var ctxConsultasComplementares = useContext(ConsultasComplementaresContext);
|
|
27
|
-
var errorMessage = typeof error === 'string' ?
|
|
28
|
-
var
|
|
25
|
+
var errorMessage = typeof error === 'string' ? new Error(error) : error;
|
|
26
|
+
var isOpen = useToggle(true)[0];
|
|
29
27
|
var ultimaOcorrenciaCCF = useUltimaOcorrenciaCCF();
|
|
30
28
|
var quantidadeProtestos = ((_c = (_b = data === null || data === void 0 ? void 0 : data.protestos) === null || _b === void 0 ? void 0 : _b[(data === null || data === void 0 ? void 0 : data.protestos.length) - 1]) === null || _c === void 0 ? void 0 : _c.quantidade) || 0;
|
|
31
29
|
var valorTotalProtestos = ((_e = (_d = data === null || data === void 0 ? void 0 : data.protestos) === null || _d === void 0 ? void 0 : _d[(data === null || data === void 0 ? void 0 : data.protestos.length) - 1]) === null || _e === void 0 ? void 0 : _e.valorTotal) || 0;
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var _q = useCalculation((data === null || data === void 0 ? void 0 : data.boaVista) || []), quantidadeBoaVista = _q.quantidade, valorTotalBoaVista = _q.valorTotal;
|
|
30
|
+
var _m = useCalculation((data === null || data === void 0 ? void 0 : data.serasa) || []), quantidadeSerasa = _m.quantidade, valorTotalSerasa = _m.valorTotal;
|
|
31
|
+
var _o = useCalculation((data === null || data === void 0 ? void 0 : data.boaVista) || []), quantidadeBoaVista = _o.quantidade, valorTotalBoaVista = _o.valorTotal;
|
|
35
32
|
var quantidadeCCFs = useCalculation((data === null || data === void 0 ? void 0 : data.ccfs) || []).quantidade;
|
|
36
33
|
var ultimaOcorrenciaProtestos = '';
|
|
37
34
|
if ((data === null || data === void 0 ? void 0 : data.protestosCategory) && data.protestosCategory.length > 0) {
|
|
@@ -48,15 +45,40 @@ var ChartSystem = function (_a) {
|
|
|
48
45
|
}
|
|
49
46
|
var consultaPefinBoaVista = (_g = (_f = ctxConsultasComplementares === null || ctxConsultasComplementares === void 0 ? void 0 : ctxConsultasComplementares.consultasComplementares) === null || _f === void 0 ? void 0 : _f.refinBoaVista) === null || _g === void 0 ? void 0 : _g.data;
|
|
50
47
|
var consultaPefinSerasa = (_j = (_h = ctxConsultasComplementares === null || ctxConsultasComplementares === void 0 ? void 0 : ctxConsultasComplementares.consultasComplementares) === null || _h === void 0 ? void 0 : _h.refinSerasa) === null || _j === void 0 ? void 0 : _j.data;
|
|
51
|
-
|
|
52
|
-
if (consultaPefinBoaVista || consultaPefinSerasa)
|
|
48
|
+
var handleRefetch = useCallback(function () {
|
|
49
|
+
if ((consultaPefinBoaVista || consultaPefinSerasa) && !isLoading) {
|
|
53
50
|
refetch();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
}
|
|
52
|
+
}, [consultaPefinBoaVista, consultaPefinSerasa, refetch, isLoading]);
|
|
53
|
+
useEffect(function () {
|
|
54
|
+
handleRefetch();
|
|
55
|
+
}, [handleRefetch]);
|
|
56
|
+
var loadingProgress = (chartDataProgress + dividasProgress) / 2;
|
|
57
|
+
return (React.createElement(Section, { ctx: {
|
|
58
|
+
response: undefined,
|
|
59
|
+
type: isLoading
|
|
60
|
+
? RequestStatus.Loading
|
|
61
|
+
: error
|
|
62
|
+
? RequestStatus.Error
|
|
63
|
+
: RequestStatus.Success,
|
|
64
|
+
error: errorMessage || null,
|
|
65
|
+
refetch: refetch,
|
|
66
|
+
document: data,
|
|
67
|
+
progress: loadingProgress,
|
|
68
|
+
Section: Section
|
|
69
|
+
}, title: "Resumo de Negativa\u00E7\u00F5es", subtitle: "Veja a quantidade de ocorr\u00EAncias conforme o documento foi consultado ao longo do tempo", icon: ResumoDeNegativacoesIcon, onSuccess: function () {
|
|
70
|
+
var _a;
|
|
71
|
+
return (React.createElement(React.Fragment, null,
|
|
72
|
+
React.createElement(Content, { isOpen: isOpen },
|
|
73
|
+
data && React.createElement(ChartContent, { dataInput: data }),
|
|
74
|
+
React.createElement(QuantidadeResultados, { data: data, quantidadeProtestos: quantidadeProtestos, quantidadeProcessos: (_a = data === null || data === void 0 ? void 0 : data.pieChartTotalConfig) === null || _a === void 0 ? void 0 : _a.processosJuridicos, quantidadeDividas: quantidadeDividas, quantidadeDividasSerasa: quantidadeSerasa, quantidadeDividasBoaVista: quantidadeBoaVista, quantidadeChequesSemFundos: quantidadeCCFs, ultimaOcorrenciaChequesSemFundos: ultimaOcorrenciaCCF, valorTotalDividasSerasa: valorTotalSerasa, valorTotalDividasBoaVista: valorTotalBoaVista, valorTotalProtestos: valorTotalProtestos, valorTotalDividas: valorTotalDividas, ultimaOcorrenciaProtestos: ultimaOcorrenciaProtestos }))));
|
|
75
|
+
}, isError: function (err) { return ({
|
|
76
|
+
children: React.createElement(React.Fragment, null),
|
|
77
|
+
description: (React.createElement(StatusMessage, { type: "error" },
|
|
78
|
+
"Erro ao realizar a an\u00E1lise: ",
|
|
79
|
+
err.message)),
|
|
80
|
+
variant: 'error'
|
|
81
|
+
}); } }));
|
|
60
82
|
};
|
|
61
83
|
export default ChartSystem;
|
|
62
84
|
var templateObject_1;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { DataInput } from '../../../components/chart/types/iChart';
|
|
2
|
+
export declare const useDividasPublicas: () => {
|
|
3
|
+
loadingProgress: number;
|
|
4
|
+
quantidade: number;
|
|
5
|
+
valorTotal: number;
|
|
6
|
+
};
|
|
2
7
|
declare const useChartData: (documento: string) => {
|
|
3
8
|
data: DataInput | null;
|
|
4
9
|
isLoading: boolean;
|
|
5
10
|
error: string | Error | null;
|
|
6
11
|
refetch: () => void;
|
|
12
|
+
loadingProgress: number;
|
|
7
13
|
};
|
|
8
14
|
export default useChartData;
|
|
@@ -1,12 +1,51 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
import { Queries, RequestStatus, useQuery } from '../../../components/webservice';
|
|
13
|
+
import XPathUtils from '../../../utils/xpath';
|
|
2
14
|
import { useContext, useEffect, useMemo, useState } from 'react';
|
|
3
15
|
import { processData, processProtestData } from '../utils/dataProcessing';
|
|
16
|
+
export var useDividasPublicas = function () {
|
|
17
|
+
var ctxFinder = useContext(Queries.Finder);
|
|
18
|
+
var _a = useState(0), loadingProgress = _a[0], setLoadingProgress = _a[1]; // Add loading progress state
|
|
19
|
+
useEffect(function () {
|
|
20
|
+
if ((ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.type) === RequestStatus.Loading) {
|
|
21
|
+
setLoadingProgress(function (prev) { return Math.min(prev + 15, 90); }); // Simulate progress
|
|
22
|
+
}
|
|
23
|
+
else if ((ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.type) === RequestStatus.Success ||
|
|
24
|
+
(ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.type) === RequestStatus.Error) {
|
|
25
|
+
setLoadingProgress(100); // Set progress to complete
|
|
26
|
+
}
|
|
27
|
+
}, [ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.type]);
|
|
28
|
+
var dividasPublicasData = useMemo(function () {
|
|
29
|
+
if ((ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.type) === RequestStatus.Success) {
|
|
30
|
+
return {
|
|
31
|
+
quantidade: XPathUtils.select('number(//dividas/resumo/quantidade_dividas)', ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.document) || 0,
|
|
32
|
+
valorTotal: XPathUtils.select('number(//dividas/resumo/valor_total_dividas)', ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.document) || 0
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
quantidade: 0,
|
|
37
|
+
valorTotal: 0
|
|
38
|
+
};
|
|
39
|
+
}, [ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.type]);
|
|
40
|
+
return __assign(__assign({}, dividasPublicasData), { loadingProgress: loadingProgress });
|
|
41
|
+
};
|
|
4
42
|
var useChartData = function (documento) {
|
|
5
43
|
var _a = useState(null), data = _a[0], setData = _a[1];
|
|
6
44
|
var _b = useState(null), errorState = _b[0], setErrorState = _b[1];
|
|
7
|
-
var _c =
|
|
45
|
+
var _c = useState(0), loadingProgress = _c[0], setLoadingProgress = _c[1]; // Add loading progress state
|
|
46
|
+
var _d = useQuery("SELECT FROM 'DOCUMENTHISTORY'.'BASICHISTORY'", {
|
|
8
47
|
documento: documento
|
|
9
|
-
}), response =
|
|
48
|
+
}), response = _d.response, queryError = _d.error, isLoading = _d.isLoading, refetch = _d.refetch;
|
|
10
49
|
var ctxProtestos = useContext(Queries.Protestos);
|
|
11
50
|
var ctxCCF = useContext(Queries.CCF);
|
|
12
51
|
var ctxProcessosJuridicos = useContext(Queries.ProcessosJuridicos);
|
|
@@ -26,7 +65,7 @@ var useChartData = function (documento) {
|
|
|
26
65
|
].every(function (status) { return status !== RequestStatus.Loading; });
|
|
27
66
|
}, [ctxProtestos, ctxCCF, ctxProcessosJuridicos]);
|
|
28
67
|
var dadosProtestos = useMemo(function () {
|
|
29
|
-
if ((ctxProtestos === null || ctxProtestos === void 0 ? void 0 : ctxProtestos.type) === RequestStatus.Success && ctxProtestos.
|
|
68
|
+
if ((ctxProtestos === null || ctxProtestos === void 0 ? void 0 : ctxProtestos.type) === RequestStatus.Success && ctxProtestos.document) {
|
|
30
69
|
return processProtestData(ctxProtestos.document);
|
|
31
70
|
}
|
|
32
71
|
return [];
|
|
@@ -36,6 +75,14 @@ var useChartData = function (documento) {
|
|
|
36
75
|
refetch();
|
|
37
76
|
}
|
|
38
77
|
}, [liveQueriesIsFinish, refetch]);
|
|
78
|
+
useEffect(function () {
|
|
79
|
+
if (isLoading) {
|
|
80
|
+
setLoadingProgress(function (prev) { return Math.min(prev + 15, 90); }); // Simulate loading progress
|
|
81
|
+
}
|
|
82
|
+
else if (!isLoading && (queryError || response)) {
|
|
83
|
+
setLoadingProgress(100); // Set progress to complete
|
|
84
|
+
}
|
|
85
|
+
}, [isLoading, queryError, response]);
|
|
39
86
|
useEffect(function () {
|
|
40
87
|
if (!isLoading &&
|
|
41
88
|
!queryError &&
|
|
@@ -60,6 +107,12 @@ var useChartData = function (documento) {
|
|
|
60
107
|
quantidadeProcessosJuridicos,
|
|
61
108
|
dadosProtestos
|
|
62
109
|
]);
|
|
63
|
-
return {
|
|
110
|
+
return {
|
|
111
|
+
data: data,
|
|
112
|
+
isLoading: isLoading,
|
|
113
|
+
error: errorState || queryError,
|
|
114
|
+
refetch: refetch,
|
|
115
|
+
loadingProgress: loadingProgress
|
|
116
|
+
};
|
|
64
117
|
};
|
|
65
118
|
export default useChartData;
|
|
@@ -5,7 +5,3 @@ export declare const useCalculation: (itens: ItemCalculo[]) => {
|
|
|
5
5
|
dataMaisRecente: string;
|
|
6
6
|
};
|
|
7
7
|
export declare const useUltimaOcorrenciaCCF: () => string | undefined;
|
|
8
|
-
export declare const useDividasPublicas: () => {
|
|
9
|
-
quantidade: number;
|
|
10
|
-
valorTotal: number;
|
|
11
|
-
};
|
|
@@ -20,19 +20,3 @@ export var useUltimaOcorrenciaCCF = function () {
|
|
|
20
20
|
}, [ctxCCF === null || ctxCCF === void 0 ? void 0 : ctxCCF.type]);
|
|
21
21
|
return ultimaOcorrenciaCCF;
|
|
22
22
|
};
|
|
23
|
-
export var useDividasPublicas = function () {
|
|
24
|
-
var ctxFinder = useContext(Queries.Finder);
|
|
25
|
-
var dividasPublicasData = useMemo(function () {
|
|
26
|
-
if ((ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.type) === RequestStatus.Success) {
|
|
27
|
-
return {
|
|
28
|
-
quantidade: XPathUtils.select('number(//dividas/resumo/quantidade_dividas)', ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.document) || 0,
|
|
29
|
-
valorTotal: XPathUtils.select('number(//dividas/resumo/valor_total_dividas)', ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.document) || 0
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
quantidade: 0,
|
|
34
|
-
valorTotal: 0
|
|
35
|
-
};
|
|
36
|
-
}, [ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.type]);
|
|
37
|
-
return dividasPublicasData;
|
|
38
|
-
};
|
|
@@ -24,32 +24,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
24
24
|
}
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
|
+
import theme from '../../styles/theme';
|
|
27
28
|
import classNames from 'classnames';
|
|
28
29
|
import React from 'react';
|
|
29
|
-
import styled from 'styled-components';
|
|
30
|
-
var StyledButton = styled.button(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, function (_a) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
var theme = _a.theme;
|
|
38
|
-
return theme.typography.headline14.fontSize;
|
|
39
|
-
}, function (_a) {
|
|
40
|
-
var theme = _a.theme;
|
|
41
|
-
return theme.typography.headline14.lineHeight;
|
|
42
|
-
}, function (_a) {
|
|
43
|
-
var theme = _a.theme;
|
|
44
|
-
return theme.colors.azulCredithub;
|
|
45
|
-
}, function (_a) {
|
|
46
|
-
var theme = _a.theme;
|
|
47
|
-
return theme.colors.white;
|
|
48
|
-
}, function (_a) {
|
|
49
|
-
var theme = _a.theme;
|
|
50
|
-
return theme.colors.azulApoio;
|
|
30
|
+
import styled, { css } from 'styled-components';
|
|
31
|
+
var StyledButton = styled.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n background-color: ", ";\n color: ", ";\n\n padding: 8px 20px;\n border: none;\n border-radius: 60px;\n cursor: ", ";\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n text-align: center;\n\n transition:\n background-color 0.3s ease-in-out,\n color 0.3s ease-in-out;\n\n ", "\n\n width: 100% !important;\n min-height: 40px;\n"], ["\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n background-color: ", ";\n color: ", ";\n\n padding: 8px 20px;\n border: none;\n border-radius: 60px;\n cursor: ", ";\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n text-align: center;\n\n transition:\n background-color 0.3s ease-in-out,\n color 0.3s ease-in-out;\n\n ", "\n\n width: 100% !important;\n min-height: 40px;\n"])), theme.typography.headline14.fontStyle, theme.typography.headline14.fontWeight, theme.typography.headline14.fontSize, theme.typography.headline14.lineHeight, function (props) {
|
|
32
|
+
return props.isLoading ? theme.colors.cinzaClaro : theme.colors.azulCredithub;
|
|
33
|
+
}, theme.colors.white, function (props) { return (!props.isLoading ? 'pointer' : 'wait'); }, function (props) {
|
|
34
|
+
return !props.isLoading && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:hover {\n background-color: ", ";\n }\n "], ["\n &:hover {\n background-color: ", ";\n }\n "])), function (_a) {
|
|
35
|
+
var theme = _a.theme;
|
|
36
|
+
return theme.colors.azulApoio;
|
|
37
|
+
});
|
|
51
38
|
});
|
|
52
|
-
var SmallContent = styled.small(
|
|
39
|
+
var SmallContent = styled.small(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n color: ", ";\n display: block;\n margin-top: 4px;\n\n @media print {\n display: none;\n }\n"], ["\n color: ", ";\n display: block;\n margin-top: 4px;\n\n @media print {\n display: none;\n }\n"])), function (_a) {
|
|
53
40
|
var theme = _a.theme;
|
|
54
41
|
return theme.colors.alerta;
|
|
55
42
|
});
|
|
@@ -61,4 +48,4 @@ var Button = function (_a) {
|
|
|
61
48
|
smallContent && React.createElement(SmallContent, null, smallContent)));
|
|
62
49
|
};
|
|
63
50
|
export default Button;
|
|
64
|
-
var templateObject_1, templateObject_2;
|
|
51
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -4,12 +4,14 @@ export type ConsultaRfbContextProps = Partial<{
|
|
|
4
4
|
refetch: () => void;
|
|
5
5
|
error: Error | null;
|
|
6
6
|
isLoading: boolean;
|
|
7
|
+
executeFallback: () => void;
|
|
7
8
|
}>;
|
|
8
9
|
export declare const ConsultaRfbContext: React.Context<Partial<{
|
|
9
10
|
rfbResponse: Document;
|
|
10
11
|
refetch: () => void;
|
|
11
12
|
error: Error | null;
|
|
12
13
|
isLoading: boolean;
|
|
14
|
+
executeFallback: () => void;
|
|
13
15
|
}> | null>;
|
|
14
16
|
export declare const ConsultaRfbProvider: React.FC<PropsWithChildren<{
|
|
15
17
|
documento: string;
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
13
|
-
import React, { createContext } from 'react';
|
|
2
|
+
import React, { createContext, useEffect, useState } from 'react';
|
|
14
3
|
import { useQuery } from './webservice';
|
|
15
4
|
export var ConsultaRfbContext = createContext(null);
|
|
16
5
|
export var ConsultaRfbProvider = function (_a) {
|
|
17
|
-
var _b, _c;
|
|
6
|
+
var _b, _c, _d, _e;
|
|
18
7
|
var children = _a.children, documento = _a.documento;
|
|
8
|
+
var _f = useState(false), enableFallback = _f[0], setEnableFallback = _f[1];
|
|
19
9
|
var query = useQuery("SELECT FROM 'RFB'.'CERTIDAO'", { documento: documento }, documento.length > 11);
|
|
20
|
-
|
|
10
|
+
var queryFallback = useQuery("SELECT FROM 'RECEITAWS'.'CNPJ'", { documento: documento }, enableFallback);
|
|
11
|
+
var executeFallback = function () { return setEnableFallback(true); };
|
|
12
|
+
useEffect(function () {
|
|
13
|
+
if (enableFallback) {
|
|
14
|
+
queryFallback.refetch();
|
|
15
|
+
}
|
|
16
|
+
}, [enableFallback]);
|
|
17
|
+
return (React.createElement(ConsultaRfbContext.Provider, { value: {
|
|
18
|
+
rfbResponse: (_e = (_c = (_b = queryFallback === null || queryFallback === void 0 ? void 0 : queryFallback.response) === null || _b === void 0 ? void 0 : _b.document) !== null && _c !== void 0 ? _c : (_d = query === null || query === void 0 ? void 0 : query.response) === null || _d === void 0 ? void 0 : _d.document) !== null && _e !== void 0 ? _e : undefined,
|
|
19
|
+
executeFallback: executeFallback,
|
|
20
|
+
refetch: query.refetch,
|
|
21
|
+
error: query.error || queryFallback.error,
|
|
22
|
+
isLoading: query.isLoading || queryFallback.isLoading
|
|
23
|
+
} }, children));
|
|
21
24
|
};
|
|
@@ -76,7 +76,7 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
76
76
|
return (React.createElement(Section, __assign({ title: "Consulta Simples", subtitle: "Consulta de informa\u00E7\u00F5es do documento.", description: React.createElement(React.Fragment, null,
|
|
77
77
|
React.createElement(StatusMessage, null, format(new Date(), "dd/MM/yyyy 'às' HH:mm")),
|
|
78
78
|
React.createElement(StatusMessage, { type: "found" }, formatDocument(documento)),
|
|
79
|
-
isError && (
|
|
80
|
-
possuiPendenciaText.length ? (possuiPendenciaText.map(function (text) { return (React.createElement(StatusMessage, { key: text, type: "error" }, text)); })) : (React.createElement(StatusMessage, { type: statusType }, "Nenhum registro encontrado"))), onClose: onClose, icon: ConsultaSimplesIcon, variant: isLoading ? 'loading' : 'default' }, rest), children));
|
|
79
|
+
isError && (ctx === null || ctx === void 0 ? void 0 : ctx.error) && (React.createElement(StatusMessage, { type: statusType }, ctx.error.message)),
|
|
80
|
+
possuiPendenciaText.length ? (possuiPendenciaText.map(function (text) { return (React.createElement(StatusMessage, { key: text, type: "error" }, text)); })) : (React.createElement(StatusMessage, { type: statusType }, "Nenhum registro encontrado"))), onClose: onClose, icon: ConsultaSimplesIcon, variant: isLoading ? 'loading' : 'default', ctx: ctx }, rest), children));
|
|
81
81
|
};
|
|
82
82
|
export default ConsultaSimplesSection;
|