@credithub/harlan-components 1.82.4 → 1.83.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.
|
@@ -184,8 +184,9 @@ var Liminar = function (_a) {
|
|
|
184
184
|
(_f = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _f === void 0 ? void 0 : _f.indiciosDeLiminarProtestosDoPassado
|
|
185
185
|
]), origensDetectadas = _w.origensDetectadas, foundBusinessEntity = _w.foundBusinessEntity;
|
|
186
186
|
var documentHistoryReady = useMemo(function () { return isDocumentHistoryReady(globalData); }, [globalData]);
|
|
187
|
+
var protestosIsReady = useMemo(function () { var _a; return (_a = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _a === void 0 ? void 0 : _a.isLoaded; }, [globalData]);
|
|
187
188
|
useEffect(function () {
|
|
188
|
-
if (!documentHistoryReady)
|
|
189
|
+
if (!documentHistoryReady || !protestosIsReady)
|
|
189
190
|
return;
|
|
190
191
|
var fetch = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
191
192
|
var dossie, processosJuridicos, depsLoaded, newIds, hash, indiciosApi, indiciosDeLiminarProtestosDoPassado, protestosDoPassadoIds, _a, possuiIndiciosDeLiminarProtestosDoPassado, protestosIds, finalStatus, descricaoLiminar;
|
|
@@ -38,6 +38,7 @@ import XPathUtils from '../../utils/xpath';
|
|
|
38
38
|
import { Client } from '@credithub/webservice';
|
|
39
39
|
import { useCallback, useContext } from 'react';
|
|
40
40
|
import { WebService } from '../webservice';
|
|
41
|
+
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
41
42
|
/**
|
|
42
43
|
* Hook que identifica indícios de liminar de sustação de protesto.
|
|
43
44
|
*
|
|
@@ -51,6 +52,7 @@ import { WebService } from '../webservice';
|
|
|
51
52
|
var useLiminarProtestosDoPassado = function (_a) {
|
|
52
53
|
var documento = _a.documento;
|
|
53
54
|
var client = useContext(WebService);
|
|
55
|
+
var globalData = useGlobalData().data;
|
|
54
56
|
/** Máximo de requisições simultâneas ao endpoint de PDF. */
|
|
55
57
|
var MAX_CONCURRENT = 10;
|
|
56
58
|
/** Timeout (ms) por requisição individual ao PDF. */
|
|
@@ -97,7 +99,7 @@ var useLiminarProtestosDoPassado = function (_a) {
|
|
|
97
99
|
case 2:
|
|
98
100
|
parsed = (_a.sent());
|
|
99
101
|
nodes = XPathUtils.selectArray('//protesto/nm_chave', parsed);
|
|
100
|
-
numerosChave = Array.from(new Set(nodes.map(function (n) { return n.textContent || ''; })));
|
|
102
|
+
numerosChave = Array.from(new Set(nodes.map(function (n) { return n.textContent || ''; }))).filter(function (e) { var _a; return !(((_a = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _a === void 0 ? void 0 : _a.nmChaves) || []).includes(e); });
|
|
101
103
|
ocultos = [];
|
|
102
104
|
idx = 0;
|
|
103
105
|
running = [];
|
|
@@ -13,6 +13,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
};
|
|
14
14
|
return __assign.apply(this, arguments);
|
|
15
15
|
};
|
|
16
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
17
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
18
|
+
if (ar || !(i in from)) {
|
|
19
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
20
|
+
ar[i] = from[i];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
24
|
+
};
|
|
16
25
|
import ProtestosIcon from '../../assets/icones/protestos';
|
|
17
26
|
import ProtestosCreditoIcon from '../../assets/icones/protestosCredito';
|
|
18
27
|
import ProtestosGeraisIcon from '../../assets/icones/protestosGerais';
|
|
@@ -70,9 +79,8 @@ var Protestos = function () {
|
|
|
70
79
|
}, [ctx.type]);
|
|
71
80
|
// Atualiza o contexto global com os protestos classificados
|
|
72
81
|
useEffect(function () {
|
|
73
|
-
if (dataUpdated || !ctx.document)
|
|
82
|
+
if (dataUpdated || !ctx.document)
|
|
74
83
|
return;
|
|
75
|
-
}
|
|
76
84
|
var registrosText = XPathUtils.select('string(//registros)', ctx.document);
|
|
77
85
|
var haveException = /Falha na integra/gi.test(XPathUtils.select('string(//raw)', ctx.document));
|
|
78
86
|
var registros = haveException
|
|
@@ -83,6 +91,7 @@ var Protestos = function () {
|
|
|
83
91
|
setDataUpdated(true);
|
|
84
92
|
return;
|
|
85
93
|
}
|
|
94
|
+
var nmChave = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], getChaves(protestosDeCredito), true), getChaves(protestosDeImposto), true), getChaves(protestosGerais), true)));
|
|
86
95
|
setData(function (prevState) {
|
|
87
96
|
var _a;
|
|
88
97
|
return (__assign(__assign({}, prevState), { protestos: registros, protestosData: {
|
|
@@ -91,7 +100,8 @@ var Protestos = function () {
|
|
|
91
100
|
protestosGerais: protestosGerais,
|
|
92
101
|
totalProtestos: registros,
|
|
93
102
|
isLoaded: true,
|
|
94
|
-
iaOverrides: (_a = prevState.protestosData) === null || _a === void 0 ? void 0 : _a.iaOverrides
|
|
103
|
+
iaOverrides: (_a = prevState.protestosData) === null || _a === void 0 ? void 0 : _a.iaOverrides,
|
|
104
|
+
nmChaves: nmChave
|
|
95
105
|
} }));
|
|
96
106
|
});
|
|
97
107
|
setDataUpdated(true);
|
|
@@ -159,7 +169,9 @@ var Protestos = function () {
|
|
|
159
169
|
? "".concat(cleanDoc.slice(0, 2), ".").concat(cleanDoc.slice(2, 5), ".").concat(cleanDoc.slice(5, 8), "/").concat(cleanDoc.slice(8, 12), "-").concat(cleanDoc.slice(12))
|
|
160
170
|
: "".concat(cleanDoc.slice(0, 3), ".").concat(cleanDoc.slice(3, 6), ".").concat(cleanDoc.slice(6, 9), "-").concat(cleanDoc.slice(9));
|
|
161
171
|
})();
|
|
162
|
-
harlan === null || harlan === void 0 ? void 0 : harlan.call('creditHub::addLiminar', {
|
|
172
|
+
harlan === null || harlan === void 0 ? void 0 : harlan.call('creditHub::addLiminar', {
|
|
173
|
+
document: formattedDoc
|
|
174
|
+
});
|
|
163
175
|
} }, "Apontar Protesto"))) : null }));
|
|
164
176
|
};
|
|
165
177
|
export default React.memo(Protestos);
|