@credithub/harlan-components 1.60.0 → 1.60.1
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.
|
@@ -11,7 +11,7 @@ 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 { normalizeName,
|
|
14
|
+
import { normalizeName, similarProcessos } from '../../utils/similarNames';
|
|
15
15
|
import React, { useContext, useEffect, useMemo, useRef } from 'react';
|
|
16
16
|
import StatusMessage from '../interface/statusMessage';
|
|
17
17
|
import Section from '../section';
|
|
@@ -56,7 +56,8 @@ var Liminar = function () {
|
|
|
56
56
|
useEffect(function () {
|
|
57
57
|
var _a, _b, _c;
|
|
58
58
|
// Skip processing if we don't have the necessary data
|
|
59
|
-
if (!((_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel) ||
|
|
59
|
+
if (!((_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel) ||
|
|
60
|
+
!((_b = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _b === void 0 ? void 0 : _b.isLoaded)) {
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
63
|
// Skip if we're still loading
|
|
@@ -88,14 +89,14 @@ var Liminar = function () {
|
|
|
88
89
|
var _a;
|
|
89
90
|
var hasAtivoEnvolvido = (_a = processo.envolvidos_ultima_movimentacao) === null || _a === void 0 ? void 0 : _a.some(function (envolvido) {
|
|
90
91
|
return envolvido.envolvido_tipo === 'Ativo' &&
|
|
91
|
-
|
|
92
|
+
similarProcessos(normalizeName(envolvido.nome_sem_filtro), empresaNomeNormalizado);
|
|
92
93
|
});
|
|
93
94
|
var assuntos = Array.isArray(processo.assuntos)
|
|
94
95
|
? processo.assuntos
|
|
95
96
|
: [processo.assuntos];
|
|
96
97
|
var hasValidAssunto = assuntos.some(function (assunto) {
|
|
97
98
|
return validAssuntos.some(function (valid) {
|
|
98
|
-
return
|
|
99
|
+
return similarProcessos(normalizeName(assunto), valid);
|
|
99
100
|
});
|
|
100
101
|
});
|
|
101
102
|
return hasAtivoEnvolvido && hasValidAssunto;
|
|
@@ -106,7 +107,9 @@ var Liminar = function () {
|
|
|
106
107
|
}
|
|
107
108
|
// Determine final status
|
|
108
109
|
var isSuccess = ctx.type === RequestStatus.Success || isProcessoNaoEncontrado;
|
|
109
|
-
var indiciosDeLiminar = isSuccess
|
|
110
|
+
var indiciosDeLiminar = isSuccess
|
|
111
|
+
? ((_c = ctx.document) === null || _c === void 0 ? void 0 : _c.indiciosDeLiminar) === true
|
|
112
|
+
: false;
|
|
110
113
|
var finalStatus = indiciosDeLiminar || (processosAtivo && processosAtivo.length > 0)
|
|
111
114
|
? 'Encontrado'
|
|
112
115
|
: 'Não encontrado';
|
|
@@ -136,7 +139,8 @@ var Liminar = function () {
|
|
|
136
139
|
return null;
|
|
137
140
|
return (React.createElement(Section, { title: "Liminares para Remo\u00E7\u00E3o de Protesto", subtitle: processingRef.current
|
|
138
141
|
? 'Carregando liminar...'
|
|
139
|
-
: 'Indícios de liminares para ocultação de registros.', icon: ProtestosIcon, ctx: processingRef.current
|
|
142
|
+
: 'Indícios de liminares para ocultação de registros.', icon: ProtestosIcon, ctx: processingRef.current
|
|
143
|
+
? __assign(__assign({}, ctx), { type: RequestStatus.Loading }) : derivedCtx, onSuccess: processingRef.current
|
|
140
144
|
? undefined
|
|
141
145
|
: function (data, context) {
|
|
142
146
|
var _a;
|
|
@@ -12,3 +12,7 @@ export var similarNames = function (name1, name2) {
|
|
|
12
12
|
var similarity = stringSimilarity.compareTwoStrings(name1, name2);
|
|
13
13
|
return similarity >= 0.5;
|
|
14
14
|
};
|
|
15
|
+
export var similarProcessos = function (name1, name2) {
|
|
16
|
+
var similarity = stringSimilarity.compareTwoStrings(name1, name2);
|
|
17
|
+
return similarity >= 0.8;
|
|
18
|
+
};
|