@credithub/harlan-components 1.33.0 → 1.35.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/components/adresses/addresses.d.ts +2 -2
- package/dist/components/adresses/addresses.js +33 -11
- package/dist/components/adresses/map.js +1 -1
- package/dist/components/bank-accounts/bank-accounts.js +32 -28
- package/dist/components/ccf/ccf.js +1 -1
- 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/consultaRfb.js +0 -1
- package/dist/components/consultaSimplesSection/consultaSimplesSection.js +5 -2
- package/dist/components/contacts/contacts.js +7 -4
- package/dist/components/dividasPublicas/dividasPublicas.js +40 -40
- package/dist/components/dominios/dominios.js +6 -6
- package/dist/components/dossie/dossie.js +21 -11
- package/dist/components/dossie/summary/cardsAndProducts.d.ts +6 -8
- package/dist/components/dossie/summary/cardsAndProducts.js +93 -25
- package/dist/components/dossie/summary/styles.d.ts +1 -0
- package/dist/components/dossie/summary/styles.js +33 -8
- package/dist/components/dossie/summary/summary.js +3 -3
- package/dist/components/dossie/summary/utils.js +12 -2
- package/dist/components/imoveis/imoveisService.js +26 -13
- package/dist/components/interface/header.d.ts +7 -3
- package/dist/components/interface/header.js +10 -5
- package/dist/components/interface/loadingBar.d.ts +1 -0
- package/dist/components/interface/loadingBar.js +8 -8
- 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 +27 -7
- package/dist/components/pep/pep.js +13 -6
- package/dist/components/processos-juridicos/processosJuridicos.js +19 -13
- package/dist/components/protestos/protestos.js +53 -38
- 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 +93 -0
- package/dist/components/veiculos/veiculos.js +28 -12
- package/dist/components/webservice.d.ts +24 -29
- package/dist/components/webservice.js +152 -130
- package/dist/consultaSimples.js +2 -2
- package/lib/cjs/index.js +1309 -829
- package/lib/esm/index.js +1310 -830
- package/package.json +1 -1
|
@@ -11,32 +11,42 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import ProtestosIcon from '../../assets/icones/protestos';
|
|
13
13
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
14
|
-
import React, { useContext, useState } from 'react';
|
|
14
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
15
15
|
import StatusMessage from '../interface/statusMessage';
|
|
16
|
-
import {
|
|
16
|
+
import { Section } from '../section';
|
|
17
|
+
import { Queries, RequestStatus } from '../webservice';
|
|
17
18
|
var Liminar = function () {
|
|
18
19
|
var ctx = useContext(Queries.Liminar);
|
|
19
20
|
var setData = useGlobalData().setData;
|
|
20
21
|
var _a = useState(false), dataUpdated = _a[0], setDataUpdated = _a[1];
|
|
21
22
|
var _b = useState(false), hideSection = _b[0], setHideSection = _b[1];
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
var prevCtxTypeRef = useRef(null);
|
|
24
|
+
useEffect(function () {
|
|
25
|
+
if (ctx.type === RequestStatus.Success &&
|
|
26
|
+
prevCtxTypeRef.current !== RequestStatus.Success &&
|
|
27
|
+
!dataUpdated &&
|
|
28
|
+
ctx.document) {
|
|
29
|
+
var doc_1 = ctx.document;
|
|
30
|
+
var possuiLiminar = doc_1.totalProtestos === 'NADA CONSTA';
|
|
31
|
+
var message_1 = possuiLiminar ? 'Encontrado' : 'Não encontrado';
|
|
32
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { liminar: { totalProtestos: doc_1.totalProtestos }, message: message_1 })); });
|
|
33
|
+
setDataUpdated(true);
|
|
27
34
|
if (!possuiLiminar) {
|
|
28
35
|
setHideSection(true);
|
|
29
36
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
}
|
|
38
|
+
prevCtxTypeRef.current = ctx.type;
|
|
39
|
+
}, [ctx.type, ctx.document, dataUpdated, setData]);
|
|
40
|
+
if (hideSection)
|
|
41
|
+
return null;
|
|
42
|
+
return (React.createElement(Section, { title: "Liminares para Remo\u00E7\u00E3o de Protesto", subtitle: "Ind\u00EDcios de liminares para oculta\u00E7\u00E3o de registros.", icon: ProtestosIcon, onSuccess: function (doc) {
|
|
35
43
|
return {
|
|
36
44
|
children: null,
|
|
37
|
-
variant:
|
|
38
|
-
description: (React.createElement(StatusMessage, { type:
|
|
45
|
+
variant: doc.totalProtestos === 'NADA CONSTA' ? 'error' : 'default',
|
|
46
|
+
description: (React.createElement(StatusMessage, { type: doc.totalProtestos === 'NADA CONSTA' ? 'error' : 'default' }, doc.totalProtestos === 'NADA CONSTA'
|
|
47
|
+
? 'Encontrado'
|
|
48
|
+
: 'Não Encontrado'))
|
|
39
49
|
};
|
|
40
|
-
} }));
|
|
50
|
+
}, ctx: ctx }));
|
|
41
51
|
};
|
|
42
52
|
export default Liminar;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import ProtestosIcon from '../../assets/icones/protestos';
|
|
3
|
+
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
4
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
5
|
+
import StatusMessage from '../interface/statusMessage';
|
|
6
|
+
import { Section } from '../section';
|
|
7
|
+
import { RequestStatus, useQuery } from '../webservice';
|
|
8
|
+
function safeStringify(obj) {
|
|
9
|
+
var seen = new WeakSet();
|
|
10
|
+
return JSON.stringify(obj, function (_, value) {
|
|
11
|
+
if (typeof value === 'object' && value !== null) {
|
|
12
|
+
if (seen.has(value)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
seen.add(value);
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
var selectRelevantData = function (data, documento) {
|
|
21
|
+
var protestos = data.protestos, ultimoRegistroCCF = data.ultimoRegistroCCF, ccf = data.ccf, dividasPublicas = data.dividasPublicas, processosJuridicos = data.processosJuridicos, addresses = data.addresses, bankAccounts = data.bankAccounts, ccfData = data.ccfData, contact = data.contact, divida = data.divida, dossie = data.dossie, imoveis = data.imoveis, liminar = data.liminar, partners = data.partners, pepData = data.pepData, processosJuridicosData = data.processosJuridicosData, protestosData = data.protestosData, reclameAqui = data.reclameAqui, refinBoaVista = data.refinBoaVista, refinSerasa = data.refinSerasa, scoreData = data.scoreData, scr = data.scr, veiculos = data.veiculos;
|
|
22
|
+
return {
|
|
23
|
+
documento: documento,
|
|
24
|
+
protestos: protestos,
|
|
25
|
+
ultimoRegistroCCF: ultimoRegistroCCF,
|
|
26
|
+
ccf: ccf,
|
|
27
|
+
dividasPublicas: dividasPublicas,
|
|
28
|
+
processosJuridicos: processosJuridicos,
|
|
29
|
+
addresses: addresses,
|
|
30
|
+
bankAccounts: bankAccounts,
|
|
31
|
+
ccfData: ccfData,
|
|
32
|
+
contact: contact,
|
|
33
|
+
divida: divida,
|
|
34
|
+
dossie: dossie,
|
|
35
|
+
imoveis: imoveis,
|
|
36
|
+
liminar: liminar,
|
|
37
|
+
partners: partners,
|
|
38
|
+
pepData: pepData,
|
|
39
|
+
processosJuridicosData: processosJuridicosData,
|
|
40
|
+
protestosData: protestosData,
|
|
41
|
+
reclameAqui: reclameAqui,
|
|
42
|
+
refinBoaVista: refinBoaVista,
|
|
43
|
+
refinSerasa: refinSerasa,
|
|
44
|
+
scoreData: scoreData,
|
|
45
|
+
scr: scr,
|
|
46
|
+
veiculos: veiculos
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
var Llama = function (_a) {
|
|
50
|
+
var documento = _a.documento;
|
|
51
|
+
var globalData = useGlobalData().data;
|
|
52
|
+
var _b = useState('{}'), serializedData = _b[0], setSerializedData = _b[1];
|
|
53
|
+
var _c = useState(false), queryEnabled = _c[0], setQueryEnabled = _c[1];
|
|
54
|
+
useEffect(function () {
|
|
55
|
+
if (globalData && documento) {
|
|
56
|
+
try {
|
|
57
|
+
var relevantData = selectRelevantData(globalData, documento);
|
|
58
|
+
var serialized = safeStringify(relevantData);
|
|
59
|
+
setSerializedData(serialized);
|
|
60
|
+
setQueryEnabled(true);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.error('Erro ao preparar os dados para a API:', error);
|
|
64
|
+
setSerializedData('{}');
|
|
65
|
+
setQueryEnabled(false);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, [documento, globalData]);
|
|
69
|
+
var messages = useMemo(function () {
|
|
70
|
+
if (!serializedData || serializedData === '{}')
|
|
71
|
+
return [];
|
|
72
|
+
return [
|
|
73
|
+
{
|
|
74
|
+
role: 'system',
|
|
75
|
+
content: 'Você é um assistente financeiro especializado em análise de crédito.'
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
role: 'user',
|
|
79
|
+
content: "Os seguintes dados s\u00E3o de uma empresa:\n\n".concat(serializedData, "\n\nA empresa est\u00E1 em boa sa\u00FAde financeira? Justifique sua resposta.")
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
}, [serializedData]);
|
|
83
|
+
var queryData = useMemo(function () {
|
|
84
|
+
if (!queryEnabled || !serializedData || serializedData === '{}')
|
|
85
|
+
return undefined;
|
|
86
|
+
return {
|
|
87
|
+
model: 'llama3',
|
|
88
|
+
messages: JSON.stringify(messages)
|
|
89
|
+
};
|
|
90
|
+
}, [queryEnabled, serializedData, messages]);
|
|
91
|
+
var _d = useQuery("SELECT FROM 'LlamaApi'.'Consulta'", queryData, !!queryData), response = _d.response, error = _d.error, isLoading = _d.isLoading, loadingProgress = _d.loadingProgress;
|
|
92
|
+
var documentData = response === null || response === void 0 ? void 0 : response.document;
|
|
93
|
+
return (React.createElement(Section, { title: "An\u00E1lise da Intelig\u00EAncia Artificial", subtitle: "Consulta de cr\u00E9dito analisado pela intelig\u00EAncia artificial.", icon: ProtestosIcon, ctx: {
|
|
94
|
+
response: response === null || response === void 0 ? void 0 : response.response,
|
|
95
|
+
type: isLoading
|
|
96
|
+
? RequestStatus.Loading
|
|
97
|
+
: error
|
|
98
|
+
? RequestStatus.Error
|
|
99
|
+
: RequestStatus.Success,
|
|
100
|
+
error: error || null,
|
|
101
|
+
refetch: function () { },
|
|
102
|
+
document: documentData,
|
|
103
|
+
progress: loadingProgress,
|
|
104
|
+
Section: Section
|
|
105
|
+
}, onSuccess: function (data) {
|
|
106
|
+
var children = (React.createElement("div", null,
|
|
107
|
+
React.createElement("p", null, "An\u00E1lise de Cr\u00E9dito:"),
|
|
108
|
+
React.createElement("p", null, safeStringify(data))));
|
|
109
|
+
return {
|
|
110
|
+
children: children,
|
|
111
|
+
description: (React.createElement(StatusMessage, { type: "success" }, "An\u00E1lise de cr\u00E9dito conclu\u00EDda com sucesso.")),
|
|
112
|
+
variant: 'default'
|
|
113
|
+
};
|
|
114
|
+
}, isError: function (err) { return ({
|
|
115
|
+
children: React.createElement(React.Fragment, null),
|
|
116
|
+
description: (React.createElement(StatusMessage, { type: "error" },
|
|
117
|
+
"Erro ao realizar a an\u00E1lise: ",
|
|
118
|
+
err.message)),
|
|
119
|
+
variant: 'error'
|
|
120
|
+
}); } }));
|
|
121
|
+
};
|
|
122
|
+
export default Llama;
|
|
@@ -13,7 +13,7 @@ var PartnerList = memo(function (_a) {
|
|
|
13
13
|
return partners.map(function (partner, key) {
|
|
14
14
|
var _a, _b;
|
|
15
15
|
return (React.createElement(ResultContent, { key: key, desktop: "2fr 1fr 0.7fr 1fr 1fr 1fr", tablet: "2fr repeat(2, 1fr)", mobile: "repeat(2, 1fr)" },
|
|
16
|
-
React.createElement(PartnerField, { name: partner.cnpj ? 'Empresa' : (_a = partner.cargo) !== null && _a !== void 0 ? _a : '', value: partner.nome }),
|
|
16
|
+
React.createElement(PartnerField, { name: partner.cnpj ? 'Empresa' : ((_a = partner.cargo) !== null && _a !== void 0 ? _a : ''), value: partner.nome }),
|
|
17
17
|
React.createElement(PartnerField, { name: partner.cnpj ? 'CNPJ' : 'CPF', value: (_b = (partner.cnpj || partner.cpf)) !== null && _b !== void 0 ? _b : '', onClick: function () { var _a, _b; return (_a = partner.onClickCpfCnpj) === null || _a === void 0 ? void 0 : _a.call(partner, (_b = (partner.cnpj || partner.cpf)) !== null && _b !== void 0 ? _b : ''); } }),
|
|
18
18
|
React.createElement(PartnerField, { name: "Protestos", value: partner === null || partner === void 0 ? void 0 : partner.protestos }),
|
|
19
19
|
React.createElement(PartnerField, { name: "Receita Status", value: partner.receitaStatus }),
|
|
@@ -23,10 +23,11 @@ import { useGlobalData } from '../../contexts/globalDataContext';
|
|
|
23
23
|
import { useConsultaRfb } from '../../hooks/useConsultaRfb';
|
|
24
24
|
import { formatCnpj, formatCpf, isCnpj } from '../../utils/string';
|
|
25
25
|
import XPathUtils from '../../utils/xpath';
|
|
26
|
-
import React, { useContext, useState } from 'react';
|
|
26
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
27
27
|
import { Result } from '../interface/result';
|
|
28
28
|
import StatusMessage from '../interface/statusMessage';
|
|
29
|
-
import {
|
|
29
|
+
import { Section } from '../section';
|
|
30
|
+
import { Queries, RequestStatus } from '../webservice';
|
|
30
31
|
import PartnerDividasPublicas from './partner-dividas-publicas';
|
|
31
32
|
import PartnerProtestos from './partner-protestos';
|
|
32
33
|
import PartnerRFBStatus from './partner-rfb-status';
|
|
@@ -35,9 +36,32 @@ var Partners = function (_a) {
|
|
|
35
36
|
var onClickQSA = _a.onClickQSA;
|
|
36
37
|
var ctx = useContext(Queries.Finder);
|
|
37
38
|
var rfbResponse = useConsultaRfb().rfbResponse;
|
|
38
|
-
var Section = ctx.Section;
|
|
39
39
|
var setData = useGlobalData().setData;
|
|
40
40
|
var _b = useState(false), dataUpdated = _b[0], setDataUpdated = _b[1];
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
if (ctx.type === RequestStatus.Success && !dataUpdated && ctx.document) {
|
|
43
|
+
var data = ctx.document;
|
|
44
|
+
var partnersNode = __spreadArray(__spreadArray([], XPathUtils.selectArray('//quadroSocietario/quadroSocietario', data), true), XPathUtils.selectArray('//participacoesEmpresas/participacoesEmpresas', data), true);
|
|
45
|
+
var partners_1 = (partnersNode.length
|
|
46
|
+
? partnersNode
|
|
47
|
+
: XPathUtils.selectArray('//RFB/socios/socio', rfbResponse)).map(function (partner) {
|
|
48
|
+
var documento = XPathUtils.select('string(documento)', partner);
|
|
49
|
+
return {
|
|
50
|
+
nome: XPathUtils.select('string(nome)', partner) || partner.textContent,
|
|
51
|
+
cpf: (!isCnpj(documento) && formatCpf(documento)) || '',
|
|
52
|
+
cargo: XPathUtils.select('string(qualificacaoSocio)', partner),
|
|
53
|
+
cnpj: (isCnpj(documento) && formatCnpj(documento)) || '',
|
|
54
|
+
receitaStatus: documento ? (React.createElement(PartnerRFBStatus, { documento: documento })) : null,
|
|
55
|
+
dividasPublicas: documento ? (React.createElement(PartnerDividasPublicas, { documento: documento })) : null,
|
|
56
|
+
protestos: documento ? (React.createElement(PartnerProtestos, { documento: documento })) : null
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
if (partners_1.length > 0) {
|
|
60
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { partners: { partners: partners_1 } })); });
|
|
61
|
+
setDataUpdated(true);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, [ctx, rfbResponse, dataUpdated, setData]);
|
|
41
65
|
var response = function (data) {
|
|
42
66
|
var partnersNode = __spreadArray(__spreadArray([], XPathUtils.selectArray('//quadroSocietario/quadroSocietario', data), true), XPathUtils.selectArray('//participacoesEmpresas/participacoesEmpresas', data), true);
|
|
43
67
|
var partners = (partnersNode.length
|
|
@@ -54,10 +78,6 @@ var Partners = function (_a) {
|
|
|
54
78
|
protestos: documento ? React.createElement(PartnerProtestos, { documento: documento }) : null
|
|
55
79
|
};
|
|
56
80
|
});
|
|
57
|
-
if (!dataUpdated && partners.length > 0) {
|
|
58
|
-
setData(function (prevState) { return (__assign(__assign({}, prevState), { partners: { partners: partners } })); });
|
|
59
|
-
setDataUpdated(true);
|
|
60
|
-
}
|
|
61
81
|
var children = (partners === null || partners === void 0 ? void 0 : partners.length) ? (React.createElement(Result, null,
|
|
62
82
|
React.createElement(PartnerList, { onClickQSA: onClickQSA, partners: partners }))) : null;
|
|
63
83
|
return {
|
|
@@ -14,16 +14,23 @@ import XPathUtils from '../../utils/xpath';
|
|
|
14
14
|
import React, { useContext, useState } from 'react';
|
|
15
15
|
import AddItemField from '../common/addItem';
|
|
16
16
|
import { Result } from '../interface/result';
|
|
17
|
+
import { Section } from '../section';
|
|
17
18
|
import { Queries } from '../webservice';
|
|
18
19
|
var PessoaPoliticamenteExposta = function () {
|
|
19
20
|
var ctx = useContext(Queries.Finder);
|
|
20
|
-
var Section = ctx.Section;
|
|
21
21
|
var setData = useGlobalData().setData;
|
|
22
22
|
var _a = useState(false), dataUpdated = _a[0], setDataUpdated = _a[1];
|
|
23
|
-
return (React.createElement(Section, { title: "Pessoa Politicamente Exposta", subtitle: "Vejas As Informa\u00E7\u00F5es Dispon\u00EDveis", onSuccess: function (document) {
|
|
24
|
-
var _a, _b, _c;
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
return (React.createElement(Section, { ctx: ctx, title: "Pessoa Politicamente Exposta", subtitle: "Vejas As Informa\u00E7\u00F5es Dispon\u00EDveis", onSuccess: function (document) {
|
|
24
|
+
var _a, _b, _c, _d;
|
|
25
|
+
if (!(document instanceof Node)) {
|
|
26
|
+
console.error('O documento não é do tipo Node esperado.');
|
|
27
|
+
return {
|
|
28
|
+
children: null,
|
|
29
|
+
description: 'Erro ao processar o documento.'
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
var data = XPathUtils.selectArray('//pep', document);
|
|
33
|
+
var pepData = data && ((_b = (_a = data[0]) === null || _a === void 0 ? void 0 : _a.childNodes) === null || _b === void 0 ? void 0 : _b.length) ? parsePepData(data[0]) : null;
|
|
27
34
|
if (!dataUpdated && pepData) {
|
|
28
35
|
setData(function (prevState) { return (__assign(__assign({}, prevState), { pep: { pepData: pepData } })); });
|
|
29
36
|
setDataUpdated(true);
|
|
@@ -33,7 +40,7 @@ var PessoaPoliticamenteExposta = function () {
|
|
|
33
40
|
React.createElement("div", { className: "content" }, FIELDS.map(function (field) { return (React.createElement(AddItemField, { key: field.key, name: field.name, value: pepData[field.key] })); }))))) : null;
|
|
34
41
|
return {
|
|
35
42
|
children: children,
|
|
36
|
-
description: ((_c = data === null ||
|
|
43
|
+
description: data && ((_d = (_c = data[0]) === null || _c === void 0 ? void 0 : _c.childNodes) === null || _d === void 0 ? void 0 : _d.length)
|
|
37
44
|
? ''
|
|
38
45
|
: 'Não foram encontradas informações de pessoa politicamente exposta.'
|
|
39
46
|
};
|
|
@@ -11,36 +11,42 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import ProcessosJuridicosIcon from '../../assets/icones/processosJuridicos';
|
|
13
13
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
14
|
-
import React, { useContext, useState } from 'react';
|
|
14
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
15
15
|
import StatusMessage from '../interface/statusMessage';
|
|
16
|
-
import {
|
|
16
|
+
import { Section } from '../section';
|
|
17
|
+
import { Queries, RequestStatus } from '../webservice';
|
|
17
18
|
import ProcessosJuridicosList from './processosJuridicosList';
|
|
18
19
|
var ProcessosJuridicos = function (_a) {
|
|
19
20
|
var onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico;
|
|
20
21
|
var ctx = useContext(Queries.ProcessosJuridicos);
|
|
21
|
-
var Section = ctx.Section;
|
|
22
22
|
var setData = useGlobalData().setData;
|
|
23
23
|
var _b = useState(false), dataUpdated = _b[0], setDataUpdated = _b[1];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
useEffect(function () {
|
|
25
|
+
var _a;
|
|
26
|
+
if (ctx.type === RequestStatus.Success && !dataUpdated && ctx.document) {
|
|
27
|
+
var qtyProcessos_1 = (_a = ctx.document.empresa) === null || _a === void 0 ? void 0 : _a.length;
|
|
28
|
+
if (qtyProcessos_1) {
|
|
28
29
|
var processosJuridicosData_1 = {
|
|
29
|
-
empresa:
|
|
30
|
+
empresa: ctx.document.empresa
|
|
30
31
|
};
|
|
31
|
-
setData(function (prevState) { return (__assign(__assign({}, prevState), { processosJuridicos:
|
|
32
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { processosJuridicos: qtyProcessos_1 || 0, processosJuridicosData: processosJuridicosData_1 })); });
|
|
32
33
|
setDataUpdated(true);
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
}
|
|
36
|
+
}, [ctx.type, ctx.document, dataUpdated, setData]);
|
|
37
|
+
return (React.createElement(Section, { ctx: ctx, title: "Processos Jur\u00EDdicos", subtitle: "Veja os processos jur\u00EDdicos para este documento.", icon: ProcessosJuridicosIcon, minimized: false, onSuccess: function (data) {
|
|
38
|
+
var _a;
|
|
39
|
+
var qtyProcessos = (_a = data.empresa) === null || _a === void 0 ? void 0 : _a.length;
|
|
40
|
+
var children = qtyProcessos ? (React.createElement(ProcessosJuridicosList, { processos: data.empresa, onClickConsultarProcessoJuridico: onClickConsultarProcessoJuridico })) : null;
|
|
35
41
|
return {
|
|
36
42
|
children: children,
|
|
37
43
|
description: (React.createElement(StatusMessage, { type: qtyProcessos ? 'error' : 'default' }, qtyProcessos
|
|
38
44
|
? 'Pesquisa concluída, ' +
|
|
39
45
|
(qtyProcessos > 1
|
|
40
46
|
? "foram encontrados ".concat(qtyProcessos, " processos")
|
|
41
|
-
: 'foi
|
|
42
|
-
: 'Não foram
|
|
43
|
-
variant:
|
|
47
|
+
: 'foi encontrado 1 processo')
|
|
48
|
+
: 'Não foram encontrados processos jurídicos para o documento pesquisado')),
|
|
49
|
+
variant: qtyProcessos ? 'error' : 'default'
|
|
44
50
|
};
|
|
45
51
|
} }));
|
|
46
52
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
1
|
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
2
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
3
|
return cooked;
|
|
@@ -23,63 +22,79 @@ import { useGlobalData } from '../../contexts/globalDataContext';
|
|
|
23
22
|
import { formatDatePtBrToDate } from '../../utils/date';
|
|
24
23
|
import { extractIntegerFromText } from '../../utils/number';
|
|
25
24
|
import XPathUtils from '../../utils/xpath';
|
|
26
|
-
import React, { useContext, useState } from 'react';
|
|
25
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
27
26
|
import styled from 'styled-components';
|
|
28
27
|
import StatusMessage from '../interface/statusMessage';
|
|
29
|
-
import {
|
|
28
|
+
import { Section } from '../section';
|
|
29
|
+
import { Queries, RequestStatus } from '../webservice';
|
|
30
30
|
import ProtestosCategory from './protestosCategory';
|
|
31
31
|
import { ProtestoItem } from './protestosList';
|
|
32
|
-
var ResultProtestos = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n
|
|
32
|
+
var ResultProtestos = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n row-gap: 20px;\n margin-top: 20px;\n"], ["\n display: flex;\n flex-direction: column;\n row-gap: 20px;\n margin-top: 20px;\n"])));
|
|
33
33
|
var Protestos = function () {
|
|
34
34
|
var ctx = useContext(Queries.Protestos);
|
|
35
|
-
var Section = ctx.Section;
|
|
36
35
|
var setData = useGlobalData().setData;
|
|
37
36
|
var _a = useState(false), dataUpdated = _a[0], setDataUpdated = _a[1];
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
-
|
|
37
|
+
useEffect(function () {
|
|
38
|
+
if (ctx.type !== RequestStatus.Success || dataUpdated || !ctx.document) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
var data = ctx.document;
|
|
42
|
+
var byDate = function (protesto, protesto2) {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
return (((_a = formatDatePtBrToDate(XPathUtils.select('string(./dataProtesto)', protesto2))) === null || _a === void 0 ? void 0 : _a.getTime()) || 0) -
|
|
45
|
+
(((_b = formatDatePtBrToDate(XPathUtils.select('string(./dataProtesto)', protesto))) === null || _b === void 0 ? void 0 : _b.getTime()) || 0);
|
|
46
|
+
};
|
|
47
|
+
var registrosText = XPathUtils.select('string(//registros)', data);
|
|
48
|
+
var registros = extractIntegerFromText(registrosText);
|
|
49
|
+
var filterProtestos = function (regex, data) {
|
|
50
|
+
return XPathUtils.selectArray('//body//protesto', data).filter(function (protesto) {
|
|
51
|
+
return regex.test(XPathUtils.select('string(./nomeCedente)', protesto));
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
var protestosDeCredito = filterProtestos(REGEX_PROTESTOS_DE_CREDITO, data).sort(byDate);
|
|
55
|
+
var protestosDeImposto = filterProtestos(REGEX_PROTESTOS_DE_IMPOSTO, data).sort(byDate);
|
|
56
|
+
var protestosGerais = XPathUtils.selectArray('//body//protesto', data)
|
|
57
|
+
.filter(function (protesto) {
|
|
58
|
+
var nomeCedente = XPathUtils.select('string(./nomeCedente)', protesto);
|
|
59
|
+
return (!REGEX_PROTESTOS_DE_IMPOSTO.test(nomeCedente) &&
|
|
60
|
+
!REGEX_PROTESTOS_DE_CREDITO.test(nomeCedente));
|
|
61
|
+
})
|
|
62
|
+
.sort(byDate);
|
|
63
|
+
var protestosState = {
|
|
64
|
+
protestosDeCredito: protestosDeCredito,
|
|
65
|
+
protestosDeImposto: protestosDeImposto,
|
|
66
|
+
protestosGerais: protestosGerais,
|
|
67
|
+
totalProtestos: registros
|
|
68
|
+
};
|
|
69
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { protestos: registros, protestosData: protestosState })); });
|
|
70
|
+
setDataUpdated(true);
|
|
71
|
+
}, [ctx, setData, dataUpdated]);
|
|
43
72
|
return (React.createElement(Section, { ctx: ctx, title: "Apontamentos na Central de Protestos (CENPROT)", subtitle: "Consulta de protestos de cr\u00E9dito, imposto e gerais.", icon: ProtestosIcon, onSuccess: function (data) {
|
|
44
|
-
var byDate = function (protesto, protesto2) {
|
|
45
|
-
var _a, _b;
|
|
46
|
-
return ((_a = formatDatePtBrToDate(XPathUtils.select('string(./dataProtesto)', protesto2))) === null || _a === void 0 ? void 0 : _a.getTime()) -
|
|
47
|
-
((_b = formatDatePtBrToDate(XPathUtils.select('string(./dataProtesto)', protesto))) === null || _b === void 0 ? void 0 : _b.getTime());
|
|
48
|
-
};
|
|
49
73
|
var registrosText = XPathUtils.select('string(//registros)', data);
|
|
50
74
|
var registros = extractIntegerFromText(registrosText);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
var
|
|
55
|
-
.
|
|
75
|
+
var protestosDeCredito = XPathUtils.selectArray('//body//protesto', data).filter(function (protesto) {
|
|
76
|
+
return REGEX_PROTESTOS_DE_CREDITO.test(XPathUtils.select('string(./nomeCedente)', protesto));
|
|
77
|
+
});
|
|
78
|
+
var protestosDeImposto = XPathUtils.selectArray('//body//protesto', data).filter(function (protesto) {
|
|
79
|
+
return REGEX_PROTESTOS_DE_IMPOSTO.test(XPathUtils.select('string(./nomeCedente)', protesto));
|
|
80
|
+
});
|
|
81
|
+
var protestosGerais = XPathUtils.selectArray('//body//protesto', data).filter(function (protesto) {
|
|
56
82
|
var nomeCedente = XPathUtils.select('string(./nomeCedente)', protesto);
|
|
57
83
|
return (!REGEX_PROTESTOS_DE_IMPOSTO.test(nomeCedente) &&
|
|
58
84
|
!REGEX_PROTESTOS_DE_CREDITO.test(nomeCedente));
|
|
59
|
-
})
|
|
60
|
-
.sort(byDate);
|
|
61
|
-
if (!dataUpdated) {
|
|
62
|
-
var protestosState_1 = {
|
|
63
|
-
protestosDeCredito: protestosDeCredito,
|
|
64
|
-
protestosDeImposto: protestosDeImposto,
|
|
65
|
-
protestosGerais: protestosGerais,
|
|
66
|
-
totalProtestos: registros
|
|
67
|
-
};
|
|
68
|
-
setData(function (prevState) { return (__assign(__assign({}, prevState), { protestosData: protestosState_1 })); });
|
|
69
|
-
setDataUpdated(true);
|
|
70
|
-
}
|
|
85
|
+
});
|
|
71
86
|
var elements = [
|
|
72
87
|
{
|
|
73
|
-
total: protestosDeCredito
|
|
74
|
-
element: (React.createElement(ProtestosCategory, { title: "Protestos de Cr\u00E9dito", subtitle: "Protestos de cr\u00E9dito em geral.", registros: protestosDeCredito
|
|
88
|
+
total: protestosDeCredito.length,
|
|
89
|
+
element: (React.createElement(ProtestosCategory, { title: "Protestos de Cr\u00E9dito", subtitle: "Protestos de cr\u00E9dito em geral.", registros: protestosDeCredito.length, icon: ProtestosCreditoIcon }, protestosDeCredito.map(function (protesto, i) { return (React.createElement(ProtestoItem, { protesto: protesto, key: i })); })))
|
|
75
90
|
},
|
|
76
91
|
{
|
|
77
|
-
total: protestosDeImposto
|
|
78
|
-
element: (React.createElement(ProtestosCategory, { title: "Protestos de Imposto", subtitle: "Protestos de impostos federais, estaduais e municipais.", registros: protestosDeImposto
|
|
92
|
+
total: protestosDeImposto.length,
|
|
93
|
+
element: (React.createElement(ProtestosCategory, { title: "Protestos de Imposto", subtitle: "Protestos de impostos federais, estaduais e municipais.", registros: protestosDeImposto.length, icon: ProtestosImpostosIcon }, protestosDeImposto.map(function (protestoElement, index) { return (React.createElement(ProtestoItem, { protesto: protestoElement, key: index })); })))
|
|
79
94
|
},
|
|
80
95
|
{
|
|
81
|
-
total: protestosGerais
|
|
82
|
-
element: (React.createElement(ProtestosCategory, { title: "Protestos Gerais", subtitle: "Protestos de outros tipos.", registros: protestosGerais
|
|
96
|
+
total: protestosGerais.length,
|
|
97
|
+
element: (React.createElement(ProtestosCategory, { title: "Protestos Gerais", subtitle: "Protestos de outros tipos.", registros: protestosGerais.length, icon: ProtestosGeraisIcon }, protestosGerais.map(function (protestoElement, index) { return (React.createElement(ProtestoItem, { protesto: protestoElement, key: index })); })))
|
|
83
98
|
}
|
|
84
99
|
].sort(function (a, b) { return b.total - a.total; });
|
|
85
100
|
var children = registros ? (React.createElement(ResultProtestos, null, elements.map(function (_a) {
|
|
@@ -16,17 +16,17 @@ import { addNoValueContent } from '../../utils/string';
|
|
|
16
16
|
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
17
17
|
import AddItemField from '../common/addItem';
|
|
18
18
|
import { ConsultasComplementaresContext } from '../consultasComplementares';
|
|
19
|
-
import Header from '../interface/header';
|
|
20
19
|
import { Result, ResultContent } from '../interface/result';
|
|
21
20
|
import StatusMessage from '../interface/statusMessage';
|
|
22
|
-
import {
|
|
21
|
+
import { Section } from '../section';
|
|
22
|
+
import { RequestStatus, useQuery } from '../webservice';
|
|
23
23
|
function useRefinBoaVista(documento) {
|
|
24
24
|
var _a;
|
|
25
25
|
var consultasComplementaresContext = useContext(ConsultasComplementaresContext);
|
|
26
26
|
var setData = useGlobalData().setData;
|
|
27
27
|
var _b = useState(false), dataUpdated = _b[0], setDataUpdated = _b[1];
|
|
28
28
|
var _c = consultasComplementaresContext !== null && consultasComplementaresContext !== void 0 ? consultasComplementaresContext : {}, consultasComplementares = _c.consultasComplementares, setConsultasComplementares = _c.setConsultasComplementares;
|
|
29
|
-
var _d = useQuery("SELECT FROM 'PROTESTOS'.'REFIN'", { documento: documento }, !!((_a = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinBoaVista) === null || _a === void 0 ? void 0 : _a.consultaRealizada)), response = _d.response, isLoading = _d.isLoading, error = _d.error;
|
|
29
|
+
var _d = useQuery("SELECT FROM 'PROTESTOS'.'REFIN'", { documento: documento }, !!((_a = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinBoaVista) === null || _a === void 0 ? void 0 : _a.consultaRealizada)), response = _d.response, isLoading = _d.isLoading, error = _d.error, loadingProgress = _d.loadingProgress;
|
|
30
30
|
var pendencias = useMemo(function () {
|
|
31
31
|
var _a;
|
|
32
32
|
if ((_a = response === null || response === void 0 ? void 0 : response.document) === null || _a === void 0 ? void 0 : _a.spc) {
|
|
@@ -51,30 +51,40 @@ function useRefinBoaVista(documento) {
|
|
|
51
51
|
setDataUpdated(true);
|
|
52
52
|
}
|
|
53
53
|
}, [response, dataUpdated, setData, setConsultasComplementares]);
|
|
54
|
-
return {
|
|
54
|
+
return {
|
|
55
|
+
isLoading: isLoading,
|
|
56
|
+
error: error,
|
|
57
|
+
pendencias: pendencias,
|
|
58
|
+
consultaRealizada: !!response,
|
|
59
|
+
loadingProgress: loadingProgress
|
|
60
|
+
};
|
|
55
61
|
}
|
|
56
62
|
function RefinBoaVista(_a) {
|
|
57
63
|
var documento = _a.documento;
|
|
58
64
|
var refinBoaVistaRef = useRef(null);
|
|
59
|
-
var _b = useRefinBoaVista(documento), isLoading = _b.isLoading, error = _b.error, pendencias = _b.pendencias, consultaRealizada = _b.consultaRealizada;
|
|
65
|
+
var _b = useRefinBoaVista(documento), isLoading = _b.isLoading, error = _b.error, pendencias = _b.pendencias, consultaRealizada = _b.consultaRealizada, loadingProgress = _b.loadingProgress;
|
|
60
66
|
useEffect(function () {
|
|
61
67
|
var _a;
|
|
62
68
|
(_a = refinBoaVistaRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
|
|
63
69
|
}, [consultaRealizada]);
|
|
64
|
-
var statusType = pendencias.length > 0 ? 'success' : 'default';
|
|
65
|
-
var variant = isLoading
|
|
66
|
-
? 'loading'
|
|
67
|
-
: error
|
|
68
|
-
? 'error'
|
|
69
|
-
: 'default';
|
|
70
70
|
var description = pendencias.length
|
|
71
71
|
? "Foram encontrados ".concat(pendencias.length, " ocorr\u00EAncias")
|
|
72
72
|
: 'Nenhuma ocorrência encontrada';
|
|
73
73
|
if (!consultaRealizada)
|
|
74
74
|
return null;
|
|
75
|
-
return (React.createElement(
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
return (React.createElement(Section, { ctx: {
|
|
76
|
+
type: isLoading
|
|
77
|
+
? RequestStatus.Loading
|
|
78
|
+
: error
|
|
79
|
+
? RequestStatus.Error
|
|
80
|
+
: RequestStatus.Success,
|
|
81
|
+
error: error || null,
|
|
82
|
+
response: undefined,
|
|
83
|
+
document: pendencias,
|
|
84
|
+
refetch: function () { },
|
|
85
|
+
Section: Section,
|
|
86
|
+
progress: loadingProgress
|
|
87
|
+
}, title: "Restri\u00E7\u00F5es Pefin/Refin Boa Vista", subtitle: "Apontamentos e Restri\u00E7\u00F5es Financeiras e Comerciais", icon: PefinRefinBoaVistaIcon, description: !error && (React.createElement(StatusMessage, { type: pendencias.length ? 'success' : 'default' }, description)), onSuccess: function () { return (React.createElement(Result, null, pendencias.map(function (pendencia, i) { return (React.createElement(ResultContent, { key: i, desktop: "repeat(5, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" },
|
|
78
88
|
React.createElement(AddItemField, { name: "Associado", value: pendencia.NomeAssociado }),
|
|
79
89
|
React.createElement(AddItemField, { name: "Valor", value: pendencia.Valor && !isNaN(parseFloat(pendencia.Valor))
|
|
80
90
|
? "".concat(formatMoney(parseFloat(pendencia.Valor)))
|
|
@@ -86,6 +96,12 @@ function RefinBoaVista(_a) {
|
|
|
86
96
|
React.createElement(AddItemField, { name: "Comprador, Fiador ou Avalista", value: pendencia.CompradorFiadorAvalista }),
|
|
87
97
|
React.createElement(AddItemField, { name: "Telefone Associado", value: pendencia.TelefoneAssociado }),
|
|
88
98
|
React.createElement(AddItemField, { name: "Cidade Associado", value: pendencia.CidadeAssociado }),
|
|
89
|
-
React.createElement(AddItemField, { name: "UF Associado", value: pendencia.UfAssociado }))); }))))
|
|
99
|
+
React.createElement(AddItemField, { name: "UF Associado", value: pendencia.UfAssociado }))); }))); }, isError: function (err) { return ({
|
|
100
|
+
children: React.createElement(React.Fragment, null),
|
|
101
|
+
description: (React.createElement(StatusMessage, { type: "error" },
|
|
102
|
+
"Erro ao realizar a consulta: ",
|
|
103
|
+
err.message)),
|
|
104
|
+
variant: 'error'
|
|
105
|
+
}); } }));
|
|
90
106
|
}
|
|
91
107
|
export default RefinBoaVista;
|