@credithub/harlan-components 1.69.2 → 1.69.4
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.
|
@@ -9,6 +9,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
12
13
|
import ProtestosIcon from '../../assets/icones/protestos';
|
|
13
14
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
14
15
|
import theme from '../../styles/theme';
|
|
@@ -20,7 +21,7 @@ import Section from '../section';
|
|
|
20
21
|
import { Queries, RequestStatus } from '../webservice';
|
|
21
22
|
import { TitleWithTooltip, TooltipContainer, TooltipText } from './liminarStyles';
|
|
22
23
|
/* ----------------------------------
|
|
23
|
-
* Constantes
|
|
24
|
+
* Constantes
|
|
24
25
|
* ---------------------------------*/
|
|
25
26
|
var validAssuntos = [
|
|
26
27
|
'protesto indevido de título',
|
|
@@ -39,44 +40,26 @@ var businessTypes = [
|
|
|
39
40
|
'banco',
|
|
40
41
|
'cooperativa'
|
|
41
42
|
];
|
|
42
|
-
/* ----------------------------------
|
|
43
|
-
* Componente
|
|
44
|
-
* ---------------------------------*/
|
|
45
43
|
var Liminar = function () {
|
|
46
|
-
var _a, _b, _c, _d, _e;
|
|
47
|
-
/* -------- Contextos -------- */
|
|
44
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
48
45
|
var ctx = useContext(Queries.LiminarCenprot);
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
var _g = useState(false), isTooltipVisible = _g[0], setTooltipVisible = _g[1];
|
|
56
|
-
var hideTooltipTimeout = useRef();
|
|
57
|
-
var showTooltip = function () {
|
|
58
|
-
if (hideTooltipTimeout.current)
|
|
59
|
-
clearTimeout(hideTooltipTimeout.current);
|
|
60
|
-
setTooltipVisible(true);
|
|
61
|
-
};
|
|
62
|
-
var hideTooltip = function () {
|
|
63
|
-
hideTooltipTimeout.current = setTimeout(function () { return setTooltipVisible(false); }, 300);
|
|
64
|
-
};
|
|
65
|
-
/* -------- Tipos de documento vindos da API -------- */
|
|
46
|
+
var _j = useGlobalData(), globalData = _j.data, setData = _j.setData;
|
|
47
|
+
var processedRef = useRef(false);
|
|
48
|
+
var dataHashRef = useRef('');
|
|
49
|
+
var invertedIdsRef = useRef([]);
|
|
50
|
+
var _k = useState(false), isTooltipVisible = _k[0], setTooltipVisible = _k[1];
|
|
51
|
+
var hideTt = useRef();
|
|
66
52
|
var tiposDocumento = useMemo(function () {
|
|
67
53
|
var _a;
|
|
68
54
|
var raw = (_a = ctx.document) === null || _a === void 0 ? void 0 : _a.type;
|
|
69
55
|
if (Array.isArray(raw))
|
|
70
56
|
return raw.map(function (t) { return t.toLowerCase(); });
|
|
71
|
-
|
|
72
|
-
return [raw.toLowerCase()];
|
|
73
|
-
return [];
|
|
57
|
+
return raw ? [String(raw).toLowerCase()] : [];
|
|
74
58
|
}, [ctx.document]);
|
|
75
|
-
/* -------- Processos com assunto relevante -------- */
|
|
76
59
|
var processosComAssuntoValido = useMemo(function () {
|
|
77
|
-
var _a, _b, _c;
|
|
78
|
-
var carouselName = ((_b = (_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel) === null || _b === void 0 ? void 0 : _b.name)
|
|
79
|
-
var empresas = (
|
|
60
|
+
var _a, _b, _c, _d;
|
|
61
|
+
var carouselName = (_c = (_b = (_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '';
|
|
62
|
+
var empresas = (_d = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _d === void 0 ? void 0 : _d.empresa;
|
|
80
63
|
var nomeNorm = normalizeName(carouselName);
|
|
81
64
|
if (!Array.isArray(empresas))
|
|
82
65
|
return [];
|
|
@@ -99,99 +82,79 @@ var Liminar = function () {
|
|
|
99
82
|
(_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel,
|
|
100
83
|
(_b = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _b === void 0 ? void 0 : _b.empresa
|
|
101
84
|
]);
|
|
102
|
-
|
|
103
|
-
var _h = useMemo(function () {
|
|
85
|
+
var _l = useMemo(function () {
|
|
104
86
|
var _a;
|
|
105
|
-
/* Labels */
|
|
106
87
|
var labels = new Set();
|
|
107
88
|
var indiciosApi = ((_a = ctx.document) === null || _a === void 0 ? void 0 : _a.indiciosDeLiminar) === true;
|
|
108
|
-
if (indiciosApi)
|
|
109
|
-
tiposDocumento.forEach(function (
|
|
89
|
+
if (indiciosApi)
|
|
90
|
+
tiposDocumento.forEach(function (t) {
|
|
110
91
|
var m = {
|
|
111
92
|
cenprot: 'Liminar no Cenprot',
|
|
112
93
|
serasa: 'Liminar na Serasa',
|
|
113
94
|
judicial: 'Liminar no Judiciário'
|
|
114
95
|
};
|
|
115
|
-
if (m[
|
|
116
|
-
labels.add(m[
|
|
96
|
+
if (m[t])
|
|
97
|
+
labels.add(m[t]);
|
|
117
98
|
});
|
|
118
|
-
}
|
|
119
99
|
if (processosComAssuntoValido.length)
|
|
120
100
|
labels.add('Liminar no Judiciário');
|
|
121
|
-
|
|
122
|
-
var pjDetectada = processosComAssuntoValido.some(function (proc) {
|
|
101
|
+
var pj = processosComAssuntoValido.some(function (p) {
|
|
123
102
|
var _a;
|
|
124
|
-
return (_a =
|
|
103
|
+
return (_a = p.envolvidos_ultima_movimentacao) === null || _a === void 0 ? void 0 : _a.some(function (e) {
|
|
125
104
|
if (e.envolvido_tipo !== 'Ativo')
|
|
126
105
|
return false;
|
|
127
|
-
var
|
|
128
|
-
return businessTypes.some(function (t) { return
|
|
106
|
+
var n = normalizeName(e.nome_sem_filtro);
|
|
107
|
+
return businessTypes.some(function (t) { return n.includes(t); });
|
|
129
108
|
});
|
|
130
109
|
});
|
|
131
|
-
return {
|
|
132
|
-
|
|
133
|
-
foundBusinessEntity: pjDetectada
|
|
134
|
-
};
|
|
135
|
-
}, [ctx.document, tiposDocumento, processosComAssuntoValido]), origensDetectadas = _h.origensDetectadas, foundBusinessEntity = _h.foundBusinessEntity;
|
|
136
|
-
/* =========================================================================
|
|
137
|
-
* Efeito 1 – gravar IDs invertidos (invertedProcessos) apenas se mudarem
|
|
138
|
-
* ========================================================================= */
|
|
110
|
+
return { origensDetectadas: Array.from(labels), foundBusinessEntity: pj };
|
|
111
|
+
}, [ctx.document, tiposDocumento, processosComAssuntoValido]), origensDetectadas = _l.origensDetectadas, foundBusinessEntity = _l.foundBusinessEntity;
|
|
139
112
|
useEffect(function () {
|
|
140
|
-
|
|
113
|
+
var _a, _b;
|
|
114
|
+
var dossie = globalData === null || globalData === void 0 ? void 0 : globalData.dossie;
|
|
115
|
+
var processosJuridicos = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData;
|
|
116
|
+
var depsLoaded = !!(processosJuridicos === null || processosJuridicos === void 0 ? void 0 : processosJuridicos.isLoaded) && !!(dossie === null || dossie === void 0 ? void 0 : dossie.carousel);
|
|
117
|
+
if (!depsLoaded || ctx.type === RequestStatus.Loading)
|
|
141
118
|
return;
|
|
142
|
-
var newIds =
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (same)
|
|
146
|
-
return; // nada mudou → não dispara setState
|
|
147
|
-
invertedIdsRef.current = newIds;
|
|
148
|
-
setData(function (prev) { return (__assign(__assign({}, prev), { liminar: __assign(__assign({}, prev.liminar), { invertedProcessos: newIds }) })); });
|
|
149
|
-
}, [foundBusinessEntity, processosComAssuntoValido, setData]);
|
|
150
|
-
/* =========================================================================
|
|
151
|
-
* Efeito 2 – pipeline principal: status “Encontrado / Não encontrado”
|
|
152
|
-
* ========================================================================= */
|
|
153
|
-
useEffect(function () {
|
|
154
|
-
var _a, _b, _c, _d;
|
|
155
|
-
if (!((_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel) ||
|
|
156
|
-
!((_b = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _b === void 0 ? void 0 : _b.isLoaded))
|
|
157
|
-
return;
|
|
158
|
-
if (ctx.type === RequestStatus.Loading)
|
|
159
|
-
return; // aguarda terminar
|
|
160
|
-
/* hash que depende apenas de campos realmente relevantes */
|
|
119
|
+
var newIds = foundBusinessEntity
|
|
120
|
+
? processosComAssuntoValido.map(function (p) { return p.id; })
|
|
121
|
+
: [];
|
|
161
122
|
var hash = JSON.stringify({
|
|
162
123
|
t: ctx.type,
|
|
163
|
-
indicios: (
|
|
164
|
-
carousel:
|
|
165
|
-
empresas:
|
|
124
|
+
indicios: (_a = ctx.document) === null || _a === void 0 ? void 0 : _a.indiciosDeLiminar,
|
|
125
|
+
carousel: dossie.carousel,
|
|
126
|
+
empresas: processosJuridicos.empresa
|
|
166
127
|
});
|
|
167
128
|
if (hash === dataHashRef.current)
|
|
168
|
-
return;
|
|
129
|
+
return;
|
|
169
130
|
dataHashRef.current = hash;
|
|
170
|
-
|
|
171
|
-
var indiciosApi = ((_d = ctx.document) === null || _d === void 0 ? void 0 : _d.indiciosDeLiminar) === true;
|
|
131
|
+
var indiciosApi = ((_b = ctx.document) === null || _b === void 0 ? void 0 : _b.indiciosDeLiminar) === true;
|
|
172
132
|
var finalStatus = indiciosApi || processosComAssuntoValido.length
|
|
173
133
|
? 'Encontrado'
|
|
174
134
|
: 'Não encontrado';
|
|
135
|
+
invertedIdsRef.current = newIds;
|
|
175
136
|
setData(function (prev) { return (__assign(__assign({}, prev), { liminar: {
|
|
176
137
|
indiciosDeLiminar: indiciosApi,
|
|
177
138
|
message: finalStatus,
|
|
178
139
|
isLoaded: true,
|
|
179
|
-
processosComLiminarIds: processosComAssuntoValido.map(function (p) { return p.id; })
|
|
140
|
+
processosComLiminarIds: processosComAssuntoValido.map(function (p) { return p.id; }),
|
|
141
|
+
invertedProcessos: newIds
|
|
180
142
|
} })); });
|
|
181
143
|
processedRef.current = true;
|
|
182
144
|
}, [
|
|
183
145
|
ctx.type,
|
|
184
146
|
ctx.document,
|
|
185
|
-
|
|
186
|
-
|
|
147
|
+
globalData === null || globalData === void 0 ? void 0 : globalData.dossie,
|
|
148
|
+
globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData,
|
|
187
149
|
processosComAssuntoValido,
|
|
188
|
-
setData
|
|
150
|
+
setData,
|
|
151
|
+
foundBusinessEntity
|
|
189
152
|
]);
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
153
|
+
var ready = processedRef.current &&
|
|
154
|
+
!!((_c = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _c === void 0 ? void 0 : _c.isLoaded) &&
|
|
155
|
+
!!((_d = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _d === void 0 ? void 0 : _d.carousel) &&
|
|
156
|
+
ctx.type !== RequestStatus.Loading;
|
|
157
|
+
var ctxLoading = useMemo(function () { return (__assign(__assign({}, ctx), { type: RequestStatus.Loading })); }, [ctx]);
|
|
195
158
|
var scrollToProcesso = function (id) {
|
|
196
159
|
var el = document.getElementById(id);
|
|
197
160
|
if (!el)
|
|
@@ -200,38 +163,47 @@ var Liminar = function () {
|
|
|
200
163
|
el.classList.add('highlighted-process');
|
|
201
164
|
setTimeout(function () { return el.classList.remove('highlighted-process'); }, 3000);
|
|
202
165
|
};
|
|
203
|
-
|
|
204
|
-
return null;
|
|
205
|
-
var renderTooltipIcon = function () {
|
|
206
|
-
var color = origensDetectadas.length
|
|
166
|
+
var renderTooltipIcon = function () { return (React.createElement(WarningCircle, { weight: "fill", size: 24, color: origensDetectadas.length
|
|
207
167
|
? theme.colors.erroClaro
|
|
208
|
-
: theme.colors.cinzaClaro;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
168
|
+
: theme.colors.cinzaClaro, style: { marginLeft: 4 } })); };
|
|
169
|
+
var tooltipMessage = foundBusinessEntity
|
|
170
|
+
? 'Atenção: Em alguns casos, o sistema judicial pode registrar os papéis das partes de forma invertida, dificultando a interpretação direta. Por isso, utilizamos algoritmos internos para detectar esse padrão com base em contexto e palavras-chave.'
|
|
171
|
+
: 'Processos com indícios encontrados:';
|
|
172
|
+
var shouldRender = ready &&
|
|
173
|
+
(((_e = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _e === void 0 ? void 0 : _e.indiciosDeLiminar) ||
|
|
174
|
+
((_h = (_g = (_f = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _f === void 0 ? void 0 : _f.processosComLiminarIds) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0) > 0);
|
|
175
|
+
if (!shouldRender)
|
|
176
|
+
return null;
|
|
212
177
|
return (React.createElement(Section, { title: React.createElement(TitleWithTooltip, null,
|
|
213
178
|
"Liminares para Remo\u00E7\u00E3o de Protesto",
|
|
214
|
-
!!processosComAssuntoValido.length && (React.createElement(TooltipContainer, { onMouseEnter:
|
|
179
|
+
!!processosComAssuntoValido.length && ready && (React.createElement(TooltipContainer, { onMouseEnter: function () {
|
|
180
|
+
clearTimeout(hideTt.current);
|
|
181
|
+
setTooltipVisible(true);
|
|
182
|
+
}, onMouseLeave: function () {
|
|
183
|
+
hideTt.current = setTimeout(function () { return setTooltipVisible(false); }, 300);
|
|
184
|
+
} },
|
|
215
185
|
renderTooltipIcon(),
|
|
216
186
|
React.createElement(TooltipText, { visible: isTooltipVisible },
|
|
217
187
|
React.createElement(React.Fragment, null,
|
|
218
|
-
|
|
219
|
-
React.createElement("ul", { style: { marginTop: 6, paddingLeft: 18 } }, processosComAssuntoValido.map(function (
|
|
188
|
+
tooltipMessage,
|
|
189
|
+
React.createElement("ul", { style: { marginTop: 6, paddingLeft: 18 } }, processosComAssuntoValido.map(function (p) { return (React.createElement("li", { key: p.id, onClick: function () { return scrollToProcesso(p.id); }, style: {
|
|
220
190
|
fontSize: 13,
|
|
221
191
|
cursor: 'pointer',
|
|
222
192
|
textDecoration: 'underline',
|
|
223
193
|
color: '#007aff'
|
|
224
|
-
} },
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
React.createElement(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
194
|
+
} }, p.id)); }))))))), subtitle: "Ind\u00EDcios de liminares para oculta\u00E7\u00E3o de registros.", icon: ProtestosIcon, ctx: ready ? ctx : ctxLoading, onSuccess: ready
|
|
195
|
+
? function () {
|
|
196
|
+
var _a, _b;
|
|
197
|
+
var msg = (_b = (_a = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : 'Não encontrado';
|
|
198
|
+
var variant = msg === 'Encontrado' ? 'error' : 'default';
|
|
199
|
+
return {
|
|
200
|
+
children: React.createElement(React.Fragment, null),
|
|
201
|
+
variant: variant,
|
|
202
|
+
description: (React.createElement(React.Fragment, null,
|
|
203
|
+
React.createElement(StatusMessage, { type: variant }, msg),
|
|
204
|
+
origensDetectadas.map(function (o) { return (React.createElement(StatusMessage, { key: o, type: variant }, o)); })))
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
: undefined }));
|
|
236
208
|
};
|
|
237
209
|
export default Liminar;
|
|
@@ -50,9 +50,7 @@ var ProcessoJuridicoItem = memo(function (_a) {
|
|
|
50
50
|
var isInverted = (_f = (_e = global === null || global === void 0 ? void 0 : global.liminar) === null || _e === void 0 ? void 0 : _e.invertedProcessos) === null || _f === void 0 ? void 0 : _f.includes(processo.id);
|
|
51
51
|
var tooltipText = isInverted
|
|
52
52
|
? 'Atenção: Em alguns casos, o sistema judicial pode registrar os polos das partes de forma invertida, dificultando a interpretação direta.'
|
|
53
|
-
:
|
|
54
|
-
? 'Indício de liminar identificada.'
|
|
55
|
-
: '';
|
|
53
|
+
: 'Indício de liminar identificada.';
|
|
56
54
|
return (React.createElement(ProcessoJuridicoWrapper, { id: processo.id, className: highlighted ? 'highlighted-process' : '' },
|
|
57
55
|
React.createElement(ResultWrapper, null,
|
|
58
56
|
React.createElement(ResultContent, { fullWidth: true, desktop: "1.5fr 1.5fr repeat(3, 1fr)", tablet: "repeat(3, 1fr)" },
|