@credithub/harlan-components 1.48.1 → 1.49.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/consultaSimplesSection/consultaSimplesSection.js +4 -1
- package/dist/components/dossie/generativeAi/dataUtils.js +1 -14
- package/dist/components/liminar/liminar.js +65 -22
- package/dist/consultaSimples.js +0 -2
- package/dist/utils/similarNames.d.ts +2 -0
- package/dist/utils/similarNames.js +14 -0
- package/lib/cjs/index.js +79 -88
- package/lib/esm/index.js +79 -88
- package/package.json +1 -1
|
@@ -49,7 +49,10 @@ var getPossuiPendenciaText = function (_a) {
|
|
|
49
49
|
? 'Processo Jurídico'
|
|
50
50
|
: "".concat(processosJuridicos, " Processos Jur\u00EDdicos")
|
|
51
51
|
: '',
|
|
52
|
-
(liminar === null || liminar === void 0 ? void 0 : liminar.totalProtestos) === 'NADA CONSTA'
|
|
52
|
+
(liminar === null || liminar === void 0 ? void 0 : liminar.totalProtestos) === 'NADA CONSTA' ||
|
|
53
|
+
(liminar === null || liminar === void 0 ? void 0 : liminar.message) === 'Encontrado'
|
|
54
|
+
? 'Indício de Liminar'
|
|
55
|
+
: ''
|
|
53
56
|
].filter(function (x) { return !!x; });
|
|
54
57
|
};
|
|
55
58
|
var ConsultaSimplesSection = function (_a) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import {
|
|
3
|
-
import stringSimilarity from 'string-similarity';
|
|
2
|
+
import { normalizeName, similarNames } from '../../../utils/similarNames';
|
|
4
3
|
import { safeStringify } from './responseUtils';
|
|
5
4
|
export function flattenData(data) {
|
|
6
5
|
var flattened = {};
|
|
@@ -72,18 +71,6 @@ export var selectRelevantData = function (data) {
|
|
|
72
71
|
var tipoPessoa = ((_b = (_a = dossie === null || dossie === void 0 ? void 0 : dossie.carousel) === null || _a === void 0 ? void 0 : _a.document) === null || _b === void 0 ? void 0 : _b.length) === 11
|
|
73
72
|
? 'Pessoa Física'
|
|
74
73
|
: 'Pessoa Jurídica';
|
|
75
|
-
var normalizeName = function (name) {
|
|
76
|
-
if (!name)
|
|
77
|
-
return '';
|
|
78
|
-
return remove(name) // Remove acentos e caracteres especiais
|
|
79
|
-
.toLowerCase() // Converte para letras minúsculas
|
|
80
|
-
.replace(/\s+/g, ' ') // Remove espaços extras
|
|
81
|
-
.trim(); // Remove espaços nas extremidades
|
|
82
|
-
};
|
|
83
|
-
var similarNames = function (name1, name2) {
|
|
84
|
-
var similarity = stringSimilarity.compareTwoStrings(name1, name2);
|
|
85
|
-
return similarity >= 0.5;
|
|
86
|
-
};
|
|
87
74
|
var sociosAnonimizados = (_c = socios === null || socios === void 0 ? void 0 : socios.partners) === null || _c === void 0 ? void 0 : _c.map(function (socio, index) { return ({
|
|
88
75
|
nome: "S\u00F3cio ".concat(index + 1),
|
|
89
76
|
cargo: socio.cargo,
|
|
@@ -11,42 +11,85 @@ 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
|
|
14
|
+
import { normalizeName, similarNames } from '../../utils/similarNames';
|
|
15
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
15
16
|
import StatusMessage from '../interface/statusMessage';
|
|
16
17
|
import Section from '../section';
|
|
17
18
|
import { Queries, RequestStatus } from '../webservice';
|
|
18
19
|
var Liminar = function () {
|
|
19
20
|
var ctx = useContext(Queries.Liminar);
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var prevCtxTypeRef = useRef(null);
|
|
21
|
+
var _a = useGlobalData(), globalData = _a.data, setData = _a.setData;
|
|
22
|
+
var _b = useState(false), dataUpdated = _b[0], setDataUpdated = _b[1];
|
|
23
|
+
var _c = useState(false), hideSection = _c[0], setHideSection = _c[1];
|
|
24
24
|
useEffect(function () {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
|
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
26
|
+
if (!dataUpdated &&
|
|
27
|
+
((_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel) &&
|
|
28
|
+
((_b = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _b === void 0 ? void 0 : _b.empresa)) {
|
|
29
|
+
var empresaNome = globalData.dossie.carousel.name || '';
|
|
30
|
+
var empresaNomeNormalizado_1 = normalizeName(empresaNome);
|
|
31
|
+
var processosAtivo = (_e = (_d = (_c = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _c === void 0 ? void 0 : _c.empresa) === null || _d === void 0 ? void 0 : _d.filter(function (processo) {
|
|
32
|
+
var _a;
|
|
33
|
+
return (_a = processo.envolvidos_ultima_movimentacao) === null || _a === void 0 ? void 0 : _a.some(function (envolvido) {
|
|
34
|
+
var nomeNormalizado = normalizeName(envolvido.nome_sem_filtro);
|
|
35
|
+
return (similarNames(nomeNormalizado, empresaNomeNormalizado_1) &&
|
|
36
|
+
envolvido.envolvido_tipo === 'Ativo');
|
|
37
|
+
});
|
|
38
|
+
})) === null || _e === void 0 ? void 0 : _e.filter(function (processo) {
|
|
39
|
+
var assuntos = Array.isArray(processo.assuntos)
|
|
40
|
+
? processo.assuntos
|
|
41
|
+
: [processo.assuntos];
|
|
42
|
+
return assuntos.some(function (assunto) {
|
|
43
|
+
var assuntoNormalizado = normalizeName(assunto);
|
|
44
|
+
return (similarNames(assuntoNormalizado, normalizeName('protesto indevido de títulos')) ||
|
|
45
|
+
similarNames(assuntoNormalizado, normalizeName('inclusão indevida em cadastro de inadimplentes')));
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
var possuiLiminar = false;
|
|
49
|
+
var totalProtestos = 'NÃO CONSTAM PROTESTOS';
|
|
50
|
+
// Se o serviço falhou, logar erro
|
|
51
|
+
if (ctx.type === RequestStatus.Error) {
|
|
52
|
+
console.error('Erro na requisição de liminares:', ctx.error || 'Erro desconhecido');
|
|
53
|
+
}
|
|
54
|
+
else if (ctx.type === RequestStatus.Success) {
|
|
55
|
+
possuiLiminar = ((_f = ctx.document) === null || _f === void 0 ? void 0 : _f.totalProtestos) === 'NADA CONSTA';
|
|
56
|
+
totalProtestos =
|
|
57
|
+
((_g = ctx.document) === null || _g === void 0 ? void 0 : _g.totalProtestos) || 'NÃO CONSTAM PROTESTOS';
|
|
58
|
+
}
|
|
59
|
+
var hasLiminarFromProcessos = processosAtivo && processosAtivo.length > 0;
|
|
60
|
+
var finalStatus_1 = possuiLiminar || hasLiminarFromProcessos
|
|
61
|
+
? 'Encontrado'
|
|
62
|
+
: 'Não encontrado';
|
|
63
|
+
setData(function (prevState) {
|
|
64
|
+
var _a;
|
|
65
|
+
return (__assign(__assign({}, prevState), { liminar: {
|
|
66
|
+
totalProtestos: (ctx.type === RequestStatus.Success &&
|
|
67
|
+
((_a = ctx.document) === null || _a === void 0 ? void 0 : _a.totalProtestos)
|
|
68
|
+
? ctx.document.totalProtestos
|
|
69
|
+
: 'NÃO CONSTAM PROTESTOS'),
|
|
70
|
+
message: finalStatus_1
|
|
71
|
+
} }));
|
|
72
|
+
});
|
|
33
73
|
setDataUpdated(true);
|
|
34
|
-
if (!possuiLiminar) {
|
|
74
|
+
if (!possuiLiminar && !hasLiminarFromProcessos) {
|
|
35
75
|
setHideSection(true);
|
|
36
76
|
}
|
|
37
77
|
}
|
|
38
|
-
|
|
39
|
-
}, [ctx.type, ctx.document, dataUpdated, setData]);
|
|
78
|
+
}, [ctx, dataUpdated, globalData, setData]);
|
|
40
79
|
if (hideSection)
|
|
41
80
|
return null;
|
|
42
|
-
|
|
81
|
+
// Interceptar ctx e substituir por fallback silencioso em caso de erro
|
|
82
|
+
var fallbackCtx = __assign(__assign({}, ctx), { type: ctx.type === RequestStatus.Error ? RequestStatus.Success : ctx.type, document: ctx.type === RequestStatus.Error
|
|
83
|
+
? { totalProtestos: 'NÃO CONSTAM PROTESTOS' }
|
|
84
|
+
: ctx.document });
|
|
85
|
+
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, ctx: fallbackCtx, onSuccess: function (doc) {
|
|
86
|
+
var _a;
|
|
87
|
+
var globalMessage = ((_a = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _a === void 0 ? void 0 : _a.message) || 'Não encontrado';
|
|
43
88
|
return {
|
|
44
89
|
children: null,
|
|
45
|
-
variant:
|
|
46
|
-
description: (React.createElement(StatusMessage, { type:
|
|
47
|
-
? 'Encontrado'
|
|
48
|
-
: 'Não Encontrado'))
|
|
90
|
+
variant: globalMessage === 'Encontrado' ? 'error' : 'default',
|
|
91
|
+
description: (React.createElement(StatusMessage, { type: globalMessage === 'Encontrado' ? 'error' : 'default' }, globalMessage))
|
|
49
92
|
};
|
|
50
|
-
}
|
|
93
|
+
} }));
|
|
51
94
|
};
|
|
52
95
|
export default Liminar;
|
package/dist/consultaSimples.js
CHANGED
|
@@ -17,7 +17,6 @@ import ConsultaSCR from './components/scr/scr';
|
|
|
17
17
|
import { GlobalDataProvider } from './contexts/globalDataContext';
|
|
18
18
|
import GlobalStyle from './styles/globalStyle';
|
|
19
19
|
import theme from './styles/theme';
|
|
20
|
-
import ProtestosSP from './components/protestos/protestosSp';
|
|
21
20
|
Chart.register.apply(Chart, registerables);
|
|
22
21
|
var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: 'Open Sans Condensed';\n display: flex;\n flex-direction: column;\n gap: 20px;\n\n * {\n -webkit-print-color-adjust: exact !important;\n print-color-adjust: exact !important;\n }\n\n @media print {\n @page {\n size: auto;\n margin: 5mm;\n }\n }\n"], ["\n font-family: 'Open Sans Condensed';\n display: flex;\n flex-direction: column;\n gap: 20px;\n\n * {\n -webkit-print-color-adjust: exact !important;\n print-color-adjust: exact !important;\n }\n\n @media print {\n @page {\n size: auto;\n margin: 5mm;\n }\n }\n"])));
|
|
23
22
|
var FinderDependency = function (_a) {
|
|
@@ -56,7 +55,6 @@ var ConsultaSimples = function (_a) {
|
|
|
56
55
|
React.createElement(ConsultaScore, { documento: documento }),
|
|
57
56
|
React.createElement(ConsultaImoveis, { documento: documento }),
|
|
58
57
|
React.createElement(Veiculos, { documento: documento })),
|
|
59
|
-
React.createElement(ProtestosSP, null),
|
|
60
58
|
React.createElement(Protestos, null),
|
|
61
59
|
React.createElement(CCF, null),
|
|
62
60
|
React.createElement(DividasPublicas, null),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { remove } from 'diacritics';
|
|
2
|
+
import stringSimilarity from 'string-similarity';
|
|
3
|
+
export var normalizeName = function (name) {
|
|
4
|
+
if (!name)
|
|
5
|
+
return '';
|
|
6
|
+
return remove(name) // Remove acentos e caracteres especiais
|
|
7
|
+
.toLowerCase() // Converte para letras minúsculas
|
|
8
|
+
.replace(/\s+/g, ' ') // Remove espaços extras
|
|
9
|
+
.trim(); // Remove espaços nas extremidades
|
|
10
|
+
};
|
|
11
|
+
export var similarNames = function (name1, name2) {
|
|
12
|
+
var similarity = stringSimilarity.compareTwoStrings(name1, name2);
|
|
13
|
+
return similarity >= 0.5;
|
|
14
|
+
};
|