@credithub/harlan-components 1.61.4 → 1.62.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/ccf/ccf.js +4 -2
- package/dist/components/dividasPublicas/dividasPublicas.js +4 -1
- package/dist/components/liminar/liminar.js +1 -0
- package/dist/components/processos-juridicos/processosJuridicos.js +6 -0
- package/dist/components/protestos/protestos.js +4 -1
- package/lib/cjs/index.js +20 -5
- package/lib/esm/index.js +20 -5
- package/package.json +1 -1
|
@@ -42,11 +42,13 @@ var CCF = function () {
|
|
|
42
42
|
var ultimoRegistro = XPathUtils.select('string(//ultimo)', data) || '';
|
|
43
43
|
return { ccfData: ccfData, totalOcorrencias: totalOcorrencias, ultimoRegistro: ultimoRegistro };
|
|
44
44
|
}, [mapNodeToCCFData]);
|
|
45
|
-
// Update global state when data changes
|
|
46
45
|
useEffect(function () {
|
|
47
|
-
if (
|
|
46
|
+
if (dataUpdated || !ctx.document) {
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
49
|
+
if (ctx.type === RequestStatus.Error || ctx.type === RequestStatus.Empty) {
|
|
50
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { ccfData: { isLoaded: true } })); });
|
|
51
|
+
}
|
|
50
52
|
var data = ctx.document;
|
|
51
53
|
var _a = processData(data), ccfData = _a.ccfData, totalOcorrencias = _a.totalOcorrencias, ultimoRegistro = _a.ultimoRegistro;
|
|
52
54
|
if (totalOcorrencias === 0) {
|
|
@@ -49,10 +49,13 @@ var DividasPublicas = function () {
|
|
|
49
49
|
var setData = useGlobalData().setData;
|
|
50
50
|
var _a = useState(false), dataUpdated = _a[0], setDataUpdated = _a[1];
|
|
51
51
|
useEffect(function () {
|
|
52
|
-
if (
|
|
52
|
+
if (dataUpdated || !ctx.document) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
var dividas = parseDividas(ctx.document);
|
|
56
|
+
if (ctx.type === RequestStatus.Error || ctx.type === RequestStatus.Empty) {
|
|
57
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { divida: { isLoaded: true } })); });
|
|
58
|
+
}
|
|
56
59
|
if (!dataUpdated) {
|
|
57
60
|
var dividasPublicas_1 = XPathUtils.select('number(//dividas/resumo/valor_total_dividas)', ctx.document) || 0;
|
|
58
61
|
setData(function (prevState) { return (__assign(__assign({}, prevState), { divida: { dividas: dividas, isLoaded: true }, dividasPublicas: dividasPublicas_1 })); });
|
|
@@ -103,6 +103,7 @@ var Liminar = function () {
|
|
|
103
103
|
});
|
|
104
104
|
// Only log actual errors
|
|
105
105
|
if (ctx.type === RequestStatus.Error && !isProcessoNaoEncontrado) {
|
|
106
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { liminar: { isLoaded: true } })); });
|
|
106
107
|
console.error('Erro na requisição de liminares:', ctx.error || 'Erro desconhecido');
|
|
107
108
|
}
|
|
108
109
|
// Determine final status
|
|
@@ -23,6 +23,12 @@ var ProcessosJuridicos = function (_a) {
|
|
|
23
23
|
// Use a ref instead of state to track whether data has been processed
|
|
24
24
|
var processedRef = useRef(false);
|
|
25
25
|
var ctxHashRef = useRef('');
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
if (ctx.type === RequestStatus.Loading) {
|
|
28
|
+
processedRef.current = false;
|
|
29
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { processosJuridicosData: __assign(__assign({}, prevState.processosJuridicosData), { isLoaded: false }) })); });
|
|
30
|
+
}
|
|
31
|
+
}, [ctx.type, setData]);
|
|
26
32
|
useEffect(function () {
|
|
27
33
|
var _a;
|
|
28
34
|
// Create a hash of the current context state to detect changes
|
|
@@ -48,9 +48,12 @@ var Protestos = function () {
|
|
|
48
48
|
return 0;
|
|
49
49
|
}, [ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.type]);
|
|
50
50
|
useEffect(function () {
|
|
51
|
-
if (
|
|
51
|
+
if (dataUpdated || !ctx.document) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
+
if (ctx.type === RequestStatus.Error) {
|
|
55
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { protestosData: { isLoaded: true } })); });
|
|
56
|
+
}
|
|
54
57
|
var data = ctx.document;
|
|
55
58
|
var registrosText = XPathUtils.select('string(//registros)', data);
|
|
56
59
|
var haveException = /Falha na integra/gi.test(XPathUtils.select('string(//raw)', data));
|