@credithub/harlan-components 1.59.4 → 1.59.6
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.
|
@@ -45,14 +45,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
import
|
|
48
|
+
import { useConsultaRfb } from '../../../hooks/useConsultaRfb';
|
|
49
49
|
import { useConsultasComplementares } from '../../../hooks/useConsultasComplementares';
|
|
50
50
|
import { formatMoney } from '../../../utils/number';
|
|
51
51
|
import XPathUtils from '../../../utils/xpath';
|
|
52
|
-
import { useState } from 'react';
|
|
53
|
-
import { getAtividadesEconomicasSecundarias, getField, getFieldRfb, getProductsPrices } from './utils';
|
|
54
|
-
import { useConsultaRfb } from '../../../hooks/useConsultaRfb';
|
|
52
|
+
import React, { useState } from 'react';
|
|
55
53
|
import { LoadingDots } from '../generativeAi/styles';
|
|
54
|
+
import { getAtividadesEconomicasSecundarias, getField, getFieldRfb, getProductsPrices } from './utils';
|
|
56
55
|
var useCardsAndProducts = function (_a) {
|
|
57
56
|
var _b, _c, _d, _e, _f;
|
|
58
57
|
var finderResponse = _a.finderResponse;
|
|
@@ -145,7 +144,8 @@ var useCardsAndProducts = function (_a) {
|
|
|
145
144
|
header: 'UF do RG'
|
|
146
145
|
},
|
|
147
146
|
{
|
|
148
|
-
title: rfbIsLoading ? React.createElement(LoadingDots, null) : getFieldRfb('situacao', rfbResponse) ||
|
|
147
|
+
title: rfbIsLoading ? (React.createElement(LoadingDots, null)) : (getFieldRfb('situacao', rfbResponse) ||
|
|
148
|
+
getField('status', finderResponse)),
|
|
149
149
|
header: 'Situação'
|
|
150
150
|
},
|
|
151
151
|
{
|
|
@@ -193,11 +193,6 @@ var useCardsAndProducts = function (_a) {
|
|
|
193
193
|
XPathUtils.select('string(//RFB/nome/@fantasia)', rfbResponse),
|
|
194
194
|
header: 'Nome Fantasia'
|
|
195
195
|
},
|
|
196
|
-
{
|
|
197
|
-
title: getField('receitaStatus', finderResponse) ||
|
|
198
|
-
getFieldRfb('situacao', rfbResponse),
|
|
199
|
-
header: 'Status da Receita'
|
|
200
|
-
},
|
|
201
196
|
{
|
|
202
197
|
title: getField('dataReceitaStatus', finderResponse) ||
|
|
203
198
|
getFieldRfb('dataSituacao', rfbResponse),
|
|
@@ -16,51 +16,23 @@ import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
16
16
|
import StatusMessage from '../interface/statusMessage';
|
|
17
17
|
import Section from '../section';
|
|
18
18
|
import { Queries, RequestStatus } from '../webservice';
|
|
19
|
-
function useStableValue(value) {
|
|
20
|
-
var _a = useState(value), stableValue = _a[0], setStableValue = _a[1];
|
|
21
|
-
var lastValueRef = useRef(value);
|
|
22
|
-
var consecutiveFramesRef = useRef(0);
|
|
23
|
-
useEffect(function () {
|
|
24
|
-
lastValueRef.current = value;
|
|
25
|
-
consecutiveFramesRef.current = 0;
|
|
26
|
-
var frame;
|
|
27
|
-
function check() {
|
|
28
|
-
if (lastValueRef.current === value) {
|
|
29
|
-
consecutiveFramesRef.current++;
|
|
30
|
-
if (consecutiveFramesRef.current >= 2) {
|
|
31
|
-
setStableValue(value);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
consecutiveFramesRef.current = 0;
|
|
37
|
-
lastValueRef.current = value;
|
|
38
|
-
}
|
|
39
|
-
frame = requestAnimationFrame(check);
|
|
40
|
-
}
|
|
41
|
-
frame = requestAnimationFrame(check);
|
|
42
|
-
return function () { return cancelAnimationFrame(frame); };
|
|
43
|
-
}, [value]);
|
|
44
|
-
return stableValue;
|
|
45
|
-
}
|
|
46
19
|
var Liminar = function () {
|
|
47
20
|
var _a, _b, _c;
|
|
48
21
|
var ctx = useContext(Queries.LiminarCenprot);
|
|
49
22
|
var _d = useGlobalData(), globalData = _d.data, setData = _d.setData;
|
|
50
23
|
var _e = useState(undefined), liminarResult = _e[0], setLiminarResult = _e[1];
|
|
51
|
-
var
|
|
24
|
+
var didRunRef = useRef(false);
|
|
52
25
|
var carousel = (_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel;
|
|
53
26
|
var isPJDataLoaded = (_b = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _b === void 0 ? void 0 : _b.isLoaded;
|
|
54
27
|
var empresas = (_c = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _c === void 0 ? void 0 : _c.empresa;
|
|
55
|
-
var dataHash = useMemo(function () { return JSON.stringify({ carousel: carousel, isPJDataLoaded: isPJDataLoaded, empresas: empresas }); }, [carousel, isPJDataLoaded, empresas]);
|
|
56
|
-
var stableDataHash = useStableValue(dataHash);
|
|
57
28
|
useEffect(function () {
|
|
58
29
|
var _a;
|
|
59
|
-
if (
|
|
30
|
+
if (didRunRef.current)
|
|
60
31
|
return;
|
|
61
32
|
if (!carousel || !isPJDataLoaded)
|
|
62
33
|
return;
|
|
63
|
-
var
|
|
34
|
+
var empresaNome = carousel.name || '';
|
|
35
|
+
var empresaNomeNormalizado = normalizeName(empresaNome);
|
|
64
36
|
var validAssuntos = [
|
|
65
37
|
'protesto indevido de títulos',
|
|
66
38
|
'inclusão indevida em cadastro de inadimplentes',
|
|
@@ -73,63 +45,54 @@ var Liminar = function () {
|
|
|
73
45
|
var processosAtivo = empresas === null || empresas === void 0 ? void 0 : empresas.filter(function (processo) {
|
|
74
46
|
var _a;
|
|
75
47
|
var hasAtivoEnvolvido = (_a = processo.envolvidos_ultima_movimentacao) === null || _a === void 0 ? void 0 : _a.some(function (envolvido) {
|
|
76
|
-
|
|
77
|
-
|
|
48
|
+
var nomeEnvolvidoNormalizado = normalizeName(envolvido.nome_sem_filtro);
|
|
49
|
+
return (envolvido.envolvido_tipo === 'Ativo' &&
|
|
50
|
+
similarNames(nomeEnvolvidoNormalizado, empresaNomeNormalizado));
|
|
78
51
|
});
|
|
79
52
|
var assuntos = Array.isArray(processo.assuntos)
|
|
80
53
|
? processo.assuntos
|
|
81
54
|
: [processo.assuntos];
|
|
82
55
|
var hasValidAssunto = assuntos.some(function (assunto) {
|
|
56
|
+
var assuntoNormalizado = normalizeName(assunto);
|
|
83
57
|
return validAssuntos.some(function (valid) {
|
|
84
|
-
return similarNames(
|
|
58
|
+
return similarNames(assuntoNormalizado, valid);
|
|
85
59
|
});
|
|
86
60
|
});
|
|
87
61
|
return hasAtivoEnvolvido && hasValidAssunto;
|
|
88
62
|
});
|
|
89
|
-
var
|
|
90
|
-
|
|
91
|
-
if (ctx.type === RequestStatus.Error && !isProcessoNaoEncontrado) {
|
|
63
|
+
var indiciosDeLiminar = false;
|
|
64
|
+
if (ctx.type === RequestStatus.Error) {
|
|
92
65
|
console.error('Erro na requisição de liminares:', ctx.error || 'Erro desconhecido');
|
|
93
66
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
: false;
|
|
67
|
+
else if (ctx.type === RequestStatus.Success) {
|
|
68
|
+
indiciosDeLiminar = ((_a = ctx.document) === null || _a === void 0 ? void 0 : _a.indiciosDeLiminar) === true;
|
|
69
|
+
}
|
|
98
70
|
var finalStatus = indiciosDeLiminar || (processosAtivo && processosAtivo.length > 0)
|
|
99
71
|
? 'Encontrado'
|
|
100
72
|
: 'Não encontrado';
|
|
101
73
|
setData(function (prev) { return (__assign(__assign({}, prev), { liminar: { indiciosDeLiminar: indiciosDeLiminar, message: finalStatus } })); });
|
|
102
74
|
setLiminarResult(finalStatus);
|
|
103
|
-
|
|
104
|
-
}, [
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
]);
|
|
113
|
-
|
|
114
|
-
String(ctx.error).includes('Processo(s) não encontrado(s).');
|
|
115
|
-
var derivedCtx = useMemo(function () { return (__assign(__assign({}, ctx), { type: isProcessoNaoEncontrado ? RequestStatus.Success : ctx.type, document: isProcessoNaoEncontrado
|
|
116
|
-
? { indiciosDeLiminar: false }
|
|
117
|
-
: ctx.document })); }, [ctx, isProcessoNaoEncontrado]);
|
|
118
|
-
if (!isProcessing && liminarResult === 'Não encontrado')
|
|
75
|
+
didRunRef.current = true;
|
|
76
|
+
}, [carousel, isPJDataLoaded, empresas, ctx.type, setData]);
|
|
77
|
+
var derivedCtx = useMemo(function () {
|
|
78
|
+
if (liminarResult === undefined) {
|
|
79
|
+
return __assign(__assign({}, ctx), { type: RequestStatus.Loading });
|
|
80
|
+
}
|
|
81
|
+
return __assign(__assign({}, ctx), { type: ctx.type === RequestStatus.Error ? RequestStatus.Success : ctx.type, document: ctx.type === RequestStatus.Error
|
|
82
|
+
? { indiciosDeLiminar: false }
|
|
83
|
+
: ctx.document });
|
|
84
|
+
}, [liminarResult, ctx]);
|
|
85
|
+
if (liminarResult === 'Não encontrado') {
|
|
119
86
|
return null;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
?
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
variant: variant,
|
|
131
|
-
description: (React.createElement(StatusMessage, { type: variant }, globalMessage))
|
|
132
|
-
};
|
|
133
|
-
} }));
|
|
87
|
+
}
|
|
88
|
+
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: derivedCtx, onSuccess: function (doc) {
|
|
89
|
+
var _a;
|
|
90
|
+
var globalMessage = ((_a = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _a === void 0 ? void 0 : _a.message) || 'Não encontrado';
|
|
91
|
+
return {
|
|
92
|
+
children: React.createElement(React.Fragment, null),
|
|
93
|
+
variant: globalMessage === 'Encontrado' ? 'error' : 'default',
|
|
94
|
+
description: (React.createElement(StatusMessage, { type: globalMessage === 'Encontrado' ? 'error' : 'default' }, globalMessage))
|
|
95
|
+
};
|
|
96
|
+
} }));
|
|
134
97
|
};
|
|
135
98
|
export default Liminar;
|