@credithub/harlan-components 1.83.3 → 1.83.5
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.
|
@@ -57,7 +57,7 @@ import { areModulesLoaded } from '../../utils/isGlobalReady';
|
|
|
57
57
|
import { formatMoney } from '../../utils/number';
|
|
58
58
|
import { isCpf } from '../../utils/string';
|
|
59
59
|
import { Spinner } from 'phosphor-react';
|
|
60
|
-
import React, { useContext, useEffect, useMemo,
|
|
60
|
+
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
61
61
|
import styled from 'styled-components';
|
|
62
62
|
import useToggle from '../../hooks/useToggle';
|
|
63
63
|
import { ConsultasComplementaresContext } from '../consultasComplementares';
|
|
@@ -97,7 +97,6 @@ var ChartSystem = function (_a) {
|
|
|
97
97
|
var consultaSerasa = (_c = (_b = ctxConsultasComplementares === null || ctxConsultasComplementares === void 0 ? void 0 : ctxConsultasComplementares.consultasComplementares) === null || _b === void 0 ? void 0 : _b.refinSerasa) === null || _c === void 0 ? void 0 : _c.data;
|
|
98
98
|
var consultaBoaVista = (_e = (_d = ctxConsultasComplementares === null || ctxConsultasComplementares === void 0 ? void 0 : ctxConsultasComplementares.consultasComplementares) === null || _d === void 0 ? void 0 : _d.refinBoaVista) === null || _e === void 0 ? void 0 : _e.data;
|
|
99
99
|
var _o = useState({}), loadingButtons = _o[0], setLoadingButtons = _o[1];
|
|
100
|
-
var refetchTimer = useRef(null);
|
|
101
100
|
var productsPrices = getProductsPrices(isCpf(documento));
|
|
102
101
|
var handleOnClick = function (key) {
|
|
103
102
|
return function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -143,37 +142,17 @@ var ChartSystem = function (_a) {
|
|
|
143
142
|
};
|
|
144
143
|
var _p = useChartData(consultaSerasa, consultaBoaVista), chartData = _p.data, isLoadingChart = _p.isLoading, errorChart = _p.error, refetchChart = _p.refetch, chartDataProgress = _p.loadingProgress;
|
|
145
144
|
var _q = useDividasPublicas(), quantidadeDividas = _q.quantidade, valorTotalDividas = _q.valorTotal, ultimaOcorrenciaDividas = _q.ultimaOcorrencia, dividasProgress = _q.loadingProgress;
|
|
146
|
-
var modulesReady = useMemo(function () { return areModulesLoaded(globalData); }, [globalData]);
|
|
147
|
-
var _r = useState(false), chartFetched = _r[0], setChartFetched = _r[1];
|
|
148
145
|
useEffect(function () {
|
|
149
|
-
if (
|
|
150
|
-
|
|
151
|
-
refetchTimer.current = setTimeout(function () {
|
|
152
|
-
refetchChart();
|
|
153
|
-
setChartFetched(true);
|
|
154
|
-
refetchTimer.current = null;
|
|
155
|
-
}, 1000);
|
|
156
|
-
}
|
|
146
|
+
if (consultaSerasa || consultaBoaVista) {
|
|
147
|
+
refetchChart();
|
|
157
148
|
}
|
|
158
|
-
|
|
159
|
-
if (refetchTimer.current) {
|
|
160
|
-
clearTimeout(refetchTimer.current);
|
|
161
|
-
refetchTimer.current = null;
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
}, [
|
|
165
|
-
modulesReady,
|
|
166
|
-
chartFetched,
|
|
167
|
-
consultaSerasa,
|
|
168
|
-
consultaBoaVista,
|
|
169
|
-
refetchChart
|
|
170
|
-
]);
|
|
149
|
+
}, [consultaSerasa, consultaBoaVista, refetchChart]);
|
|
171
150
|
var errorMessage = typeof errorChart === 'string' ? new Error(errorChart) : errorChart;
|
|
172
151
|
var isOpen = useToggle(true)[0];
|
|
173
152
|
var quantidadeProtestos = ((_g = (_f = chartData === null || chartData === void 0 ? void 0 : chartData.protestos) === null || _f === void 0 ? void 0 : _f[(chartData === null || chartData === void 0 ? void 0 : chartData.protestos.length) - 1]) === null || _g === void 0 ? void 0 : _g.quantidade) || 0;
|
|
174
153
|
var valorTotalProtestos = ((_j = (_h = chartData === null || chartData === void 0 ? void 0 : chartData.protestos) === null || _h === void 0 ? void 0 : _h[(chartData === null || chartData === void 0 ? void 0 : chartData.protestos.length) - 1]) === null || _j === void 0 ? void 0 : _j.valorTotal) || 0;
|
|
175
|
-
var
|
|
176
|
-
var
|
|
154
|
+
var _r = useCalculation((chartData === null || chartData === void 0 ? void 0 : chartData.serasa) || []), quantidadeSerasa = _r.quantidade, valorTotalSerasa = _r.valorTotal, ultimaOcorrenciaSerasa = _r.dataMaisRecente;
|
|
155
|
+
var _s = useCalculation((chartData === null || chartData === void 0 ? void 0 : chartData.boaVista) || []), quantidadeBoaVista = _s.quantidade, valorTotalBoaVista = _s.valorTotal, ultimaOcorrenciaBoaVista = _s.dataMaisRecente;
|
|
177
156
|
var quantidadeCCFs = useCalculation((chartData === null || chartData === void 0 ? void 0 : chartData.ccfs) || []).quantidade;
|
|
178
157
|
var ultimaOcorrenciaProtestos = '';
|
|
179
158
|
if ((chartData === null || chartData === void 0 ? void 0 : chartData.protestosCategory) && chartData.protestosCategory.length > 0) {
|
|
@@ -195,6 +174,7 @@ var ChartSystem = function (_a) {
|
|
|
195
174
|
}
|
|
196
175
|
}
|
|
197
176
|
var loadingProgress = (chartDataProgress + dividasProgress) / 2;
|
|
177
|
+
var modulesReady = useMemo(function () { return areModulesLoaded(globalData); }, [globalData]);
|
|
198
178
|
useEffect(function () {
|
|
199
179
|
var _a, _b;
|
|
200
180
|
if (!dataUpdated && chartData && modulesReady) {
|
|
@@ -246,10 +226,9 @@ var ChartSystem = function (_a) {
|
|
|
246
226
|
setGlobalState,
|
|
247
227
|
ultimaOcorrenciaCCF
|
|
248
228
|
]);
|
|
249
|
-
var effectiveLoading = isLoadingChart || !modulesReady;
|
|
250
229
|
return (React.createElement(Section, { ctx: {
|
|
251
230
|
response: undefined,
|
|
252
|
-
type:
|
|
231
|
+
type: isLoadingChart
|
|
253
232
|
? RequestStatus.Loading
|
|
254
233
|
: errorChart
|
|
255
234
|
? RequestStatus.Error
|
|
@@ -262,8 +241,8 @@ var ChartSystem = function (_a) {
|
|
|
262
241
|
}, 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 () {
|
|
263
242
|
var _a, _b, _c;
|
|
264
243
|
return (React.createElement(Content, { isOpen: isOpen },
|
|
265
|
-
chartData &&
|
|
266
|
-
|
|
244
|
+
chartData && React.createElement(ChartContent, { dataInput: chartData }),
|
|
245
|
+
React.createElement(QuantidadeResultados, { data: chartData, consultarSerasa: React.createElement(ButtonsSummary, { style: {
|
|
267
246
|
display: loadingButtons['refinSerasa'] ||
|
|
268
247
|
((_a = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinSerasa) === null || _a === void 0 ? void 0 : _a.consultaRealizada)
|
|
269
248
|
? 'none'
|
|
@@ -286,7 +265,7 @@ var ChartSystem = function (_a) {
|
|
|
286
265
|
? (ultimaOcorrenciaBoaVista !== null && ultimaOcorrenciaBoaVista !== void 0 ? ultimaOcorrenciaBoaVista : undefined)
|
|
287
266
|
: undefined, ultimaOcorrenciaPefinSerasa: Array.isArray(chartData === null || chartData === void 0 ? void 0 : chartData.serasa) && chartData.serasa.length > 0
|
|
288
267
|
? (ultimaOcorrenciaSerasa !== null && ultimaOcorrenciaSerasa !== void 0 ? ultimaOcorrenciaSerasa : undefined)
|
|
289
|
-
: undefined })))
|
|
268
|
+
: undefined })));
|
|
290
269
|
}, isError: function (err) { return ({
|
|
291
270
|
children: React.createElement(React.Fragment, null),
|
|
292
271
|
description: (React.createElement(StatusMessage, { type: "error" },
|
|
@@ -113,11 +113,11 @@ var RefinSerasa = function (_a) {
|
|
|
113
113
|
var valorTotalPendencias = useMemo(function () {
|
|
114
114
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
115
115
|
var resumo = (_b = (_a = response === null || response === void 0 ? void 0 : response.document) === null || _a === void 0 ? void 0 : _a.dados) === null || _b === void 0 ? void 0 : _b.resumo;
|
|
116
|
-
return ((Number((_d = (_c = resumo === null || resumo === void 0 ? void 0 : resumo.pefin) === null || _c === void 0 ? void 0 : _c.valor_total) === null || _d === void 0 ? void 0 : _d.replace(
|
|
116
|
+
return ((Number((_d = (_c = resumo === null || resumo === void 0 ? void 0 : resumo.pefin) === null || _c === void 0 ? void 0 : _c.valor_total) === null || _d === void 0 ? void 0 : _d.replace(/\./g, '').replace(',', '.')) ||
|
|
117
117
|
0) +
|
|
118
|
-
(Number((_f = (_e = resumo === null || resumo === void 0 ? void 0 : resumo.refin) === null || _e === void 0 ? void 0 : _e.valor_total) === null || _f === void 0 ? void 0 : _f.replace(
|
|
118
|
+
(Number((_f = (_e = resumo === null || resumo === void 0 ? void 0 : resumo.refin) === null || _e === void 0 ? void 0 : _e.valor_total) === null || _f === void 0 ? void 0 : _f.replace(/\./g, '').replace(',', '.')) ||
|
|
119
119
|
0) +
|
|
120
|
-
(Number((_h = (_g = resumo === null || resumo === void 0 ? void 0 : resumo.pendencias_vencidas) === null || _g === void 0 ? void 0 : _g.valor_total) === null || _h === void 0 ? void 0 : _h.replace(
|
|
120
|
+
(Number((_h = (_g = resumo === null || resumo === void 0 ? void 0 : resumo.pendencias_vencidas) === null || _g === void 0 ? void 0 : _g.valor_total) === null || _h === void 0 ? void 0 : _h.replace(/\./g, '').replace(',', '.')) || 0));
|
|
121
121
|
}, [response === null || response === void 0 ? void 0 : response.document]);
|
|
122
122
|
var description = totalPendencias === 0
|
|
123
123
|
? 'Não há ocorrência de Pefin/Refin Serasa'
|
package/dist/consultaSimples.js
CHANGED
|
@@ -28,6 +28,13 @@ var FinderDependency = function (_a) {
|
|
|
28
28
|
return (React.createElement(Queries.CCF.Request, { data: { documento: documento }, depends: [ctxFinder] },
|
|
29
29
|
React.createElement(Queries.Protestos.Request, { data: { documento: documento }, depends: [ctxFinder] }, children)));
|
|
30
30
|
};
|
|
31
|
+
var GraficosAnaliticosDependency = function (_a) {
|
|
32
|
+
var children = _a.children, documento = _a.documento;
|
|
33
|
+
var ctxCCF = useContext(Queries.CCF);
|
|
34
|
+
var ctxProtestos = useContext(Queries.Protestos);
|
|
35
|
+
var ctxProcessosJuridicos = useContext(Queries.ProcessosJuridicos);
|
|
36
|
+
return (React.createElement(Queries.GraficosAnaliticos.Request, { data: { documento: documento }, depends: [ctxCCF, ctxProtestos, ctxProcessosJuridicos] }, children));
|
|
37
|
+
};
|
|
31
38
|
var ConsultaSimples = function (_a) {
|
|
32
39
|
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, _e = _a.printMode, printMode = _e === void 0 ? false : _e, _f = _a.isFinancial, isFinancial = _f === void 0 ? false : _f, _g = _a.tags, tags = _g === void 0 ? [] : _g;
|
|
33
40
|
var documento = _documento.replace(/\D+/g, '');
|
|
@@ -52,7 +59,7 @@ var ConsultaSimples = function (_a) {
|
|
|
52
59
|
React.createElement(Partners, { onClickQSA: onClickQSA })),
|
|
53
60
|
React.createElement(Dominios, null),
|
|
54
61
|
React.createElement(BankAccounts, null),
|
|
55
|
-
React.createElement(
|
|
62
|
+
React.createElement(GraficosAnaliticosDependency, { documento: documento },
|
|
56
63
|
React.createElement(ChartSystem, { documento: documento }),
|
|
57
64
|
React.createElement(ConsultaSCR, { documento: documento }),
|
|
58
65
|
React.createElement(RefinBoaVista, { documento: documento }),
|