@credithub/harlan-components 1.82.3 → 1.83.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.
|
@@ -84,26 +84,25 @@ var businessTypes = [
|
|
|
84
84
|
'cooperativa'
|
|
85
85
|
];
|
|
86
86
|
var Liminar = function (_a) {
|
|
87
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m
|
|
88
|
-
var
|
|
87
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
88
|
+
var _o = _a.isFinancial, isFinancial = _o === void 0 ? false : _o, hasCredits = _a.hasCredits, _p = _a.tags, tags = _p === void 0 ? [] : _p;
|
|
89
89
|
var ctx = useContext(Queries.LiminarCenprot);
|
|
90
|
-
var
|
|
90
|
+
var _q = useGlobalData(), globalData = _q.data, setData = _q.setData;
|
|
91
91
|
var fetchLiminarProtestosDoPassado = useLiminarProtestosDoPassado({
|
|
92
92
|
documento: ((_c = (_b = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _b === void 0 ? void 0 : _b.carousel) === null || _c === void 0 ? void 0 : _c.document) || ''
|
|
93
93
|
}).fetchLiminarProtestosDoPassado;
|
|
94
|
-
|
|
95
|
-
var _s = useState(false), isLoadingLiminarProtestosDoPassado = _s[0], setIsLoadingLiminarProtestosDoPassado = _s[1];
|
|
94
|
+
var _r = useState(false), isLoadingLiminarProtestosDoPassado = _r[0], setIsLoadingLiminarProtestosDoPassado = _r[1];
|
|
96
95
|
var processedRef = useRef(false);
|
|
97
96
|
var dataHashRef = useRef('');
|
|
98
97
|
var invertedIdsRef = useRef([]);
|
|
99
|
-
var
|
|
100
|
-
var
|
|
101
|
-
var
|
|
98
|
+
var _s = useState(false), isTooltipVisible = _s[0], setTooltipVisible = _s[1];
|
|
99
|
+
var _t = useState(false), isEmailModalOpen = _t[0], setIsEmailModalOpen = _t[1];
|
|
100
|
+
var _u = useState(''), emailModalMessage = _u[0], setEmailModalMessage = _u[1];
|
|
102
101
|
var liminarMailPrice = useMemo(function () {
|
|
103
102
|
var isDiamanteNew = hasOneOfTags(tags, ['diamante-new']);
|
|
104
103
|
return isDiamanteNew ? 0 : 50000;
|
|
105
104
|
}, [tags]);
|
|
106
|
-
var
|
|
105
|
+
var _v = useFetch("SELECT FROM 'LIMINAR'.'SENDMAIL'"), sendIndiciosEmail = _v.fetch, isEmailSending = _v.isLoading, emailError = _v.error;
|
|
107
106
|
var hideTt = useRef();
|
|
108
107
|
/*
|
|
109
108
|
* Extrai e normaliza os tipos de documento presentes em ctx.document, retornando sempre um array de strings em minúsculo.
|
|
@@ -141,13 +140,13 @@ var Liminar = function (_a) {
|
|
|
141
140
|
});
|
|
142
141
|
});
|
|
143
142
|
}, [
|
|
144
|
-
(
|
|
145
|
-
(
|
|
143
|
+
(_d = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _d === void 0 ? void 0 : _d.carousel,
|
|
144
|
+
(_e = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _e === void 0 ? void 0 : _e.empresa
|
|
146
145
|
]);
|
|
147
146
|
/*
|
|
148
147
|
* Identifica as origens de liminares detectadas e verifica se existe liminar de protesto invertida
|
|
149
148
|
*/
|
|
150
|
-
var
|
|
149
|
+
var _w = useMemo(function () {
|
|
151
150
|
var _a, _b;
|
|
152
151
|
var labels = new Set();
|
|
153
152
|
var indiciosApi = ((_a = ctx.document) === null || _a === void 0 ? void 0 : _a.indiciosDeLiminar) === true;
|
|
@@ -182,17 +181,17 @@ var Liminar = function (_a) {
|
|
|
182
181
|
ctx.document,
|
|
183
182
|
tiposDocumento,
|
|
184
183
|
processosComAssuntoValido,
|
|
185
|
-
(
|
|
186
|
-
]), origensDetectadas =
|
|
184
|
+
(_f = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _f === void 0 ? void 0 : _f.indiciosDeLiminarProtestosDoPassado
|
|
185
|
+
]), origensDetectadas = _w.origensDetectadas, foundBusinessEntity = _w.foundBusinessEntity;
|
|
187
186
|
var documentHistoryReady = useMemo(function () { return isDocumentHistoryReady(globalData); }, [globalData]);
|
|
188
187
|
useEffect(function () {
|
|
189
188
|
if (!documentHistoryReady)
|
|
190
189
|
return;
|
|
191
190
|
var fetch = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
192
191
|
var dossie, processosJuridicos, depsLoaded, newIds, hash, indiciosApi, indiciosDeLiminarProtestosDoPassado, protestosDoPassadoIds, _a, possuiIndiciosDeLiminarProtestosDoPassado, protestosIds, finalStatus, descricaoLiminar;
|
|
193
|
-
var _b, _c, _d
|
|
194
|
-
return __generator(this, function (
|
|
195
|
-
switch (
|
|
192
|
+
var _b, _c, _d;
|
|
193
|
+
return __generator(this, function (_e) {
|
|
194
|
+
switch (_e.label) {
|
|
196
195
|
case 0:
|
|
197
196
|
dossie = globalData === null || globalData === void 0 ? void 0 : globalData.dossie;
|
|
198
197
|
processosJuridicos = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData;
|
|
@@ -214,13 +213,11 @@ var Liminar = function (_a) {
|
|
|
214
213
|
indiciosApi = ((_c = ctx.document) === null || _c === void 0 ? void 0 : _c.indiciosDeLiminar) === true;
|
|
215
214
|
indiciosDeLiminarProtestosDoPassado = false;
|
|
216
215
|
protestosDoPassadoIds = '';
|
|
217
|
-
|
|
218
|
-
if (!((_e = globalData === null || globalData === void 0 ? void 0 : globalData.documentHistory) === null || _e === void 0 ? void 0 : _e.protestoLiminar)) return [3 /*break*/, 2];
|
|
219
|
-
console.log('entrou');
|
|
216
|
+
if (!((_d = globalData === null || globalData === void 0 ? void 0 : globalData.documentHistory) === null || _d === void 0 ? void 0 : _d.protestoLiminar)) return [3 /*break*/, 2];
|
|
220
217
|
setIsLoadingLiminarProtestosDoPassado(true);
|
|
221
218
|
return [4 /*yield*/, fetchLiminarProtestosDoPassado()];
|
|
222
219
|
case 1:
|
|
223
|
-
_a =
|
|
220
|
+
_a = _e.sent(), possuiIndiciosDeLiminarProtestosDoPassado = _a.possuiIndiciosDeLiminarProtestosDoPassado, protestosIds = _a.protestosDoPassadoIds;
|
|
224
221
|
if (possuiIndiciosDeLiminarProtestosDoPassado) {
|
|
225
222
|
origensDetectadas.push('Liminar no Cenprot');
|
|
226
223
|
indiciosDeLiminarProtestosDoPassado =
|
|
@@ -228,7 +225,7 @@ var Liminar = function (_a) {
|
|
|
228
225
|
protestosDoPassadoIds = protestosIds.join(',');
|
|
229
226
|
}
|
|
230
227
|
setIsLoadingLiminarProtestosDoPassado(false);
|
|
231
|
-
|
|
228
|
+
_e.label = 2;
|
|
232
229
|
case 2:
|
|
233
230
|
finalStatus = indiciosApi ||
|
|
234
231
|
processosComAssuntoValido.length ||
|
|
@@ -271,8 +268,8 @@ var Liminar = function (_a) {
|
|
|
271
268
|
foundBusinessEntity
|
|
272
269
|
]);
|
|
273
270
|
var ready = processedRef.current &&
|
|
274
|
-
!!((
|
|
275
|
-
!!((
|
|
271
|
+
!!((_g = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _g === void 0 ? void 0 : _g.isLoaded) &&
|
|
272
|
+
!!((_h = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _h === void 0 ? void 0 : _h.carousel) &&
|
|
276
273
|
!isLoadingLiminarProtestosDoPassado &&
|
|
277
274
|
ctx.type !== RequestStatus.Loading;
|
|
278
275
|
var ctxLoading = useMemo(function () { return (__assign(__assign({}, ctx), { type: RequestStatus.Loading })); }, [ctx]);
|
|
@@ -292,8 +289,8 @@ var Liminar = function (_a) {
|
|
|
292
289
|
: 'Processos com indícios encontrados:';
|
|
293
290
|
var shouldRender = isLoadingLiminarProtestosDoPassado ||
|
|
294
291
|
(ready &&
|
|
295
|
-
(((
|
|
296
|
-
((
|
|
292
|
+
(((_j = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _j === void 0 ? void 0 : _j.indiciosDeLiminar) ||
|
|
293
|
+
((_m = (_l = (_k = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _k === void 0 ? void 0 : _k.processosComLiminarIds) === null || _l === void 0 ? void 0 : _l.length) !== null && _m !== void 0 ? _m : 0) > 0));
|
|
297
294
|
// Função para disparar o envio do e-mail e configurar a mensagem do modal
|
|
298
295
|
var handleSendEmailIndicios = function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
|
299
296
|
var callback;
|
|
@@ -93,7 +93,6 @@ var useLiminarProtestosDoPassado = function (_a) {
|
|
|
93
93
|
})];
|
|
94
94
|
case 1:
|
|
95
95
|
data = _a.sent();
|
|
96
|
-
console.log('data', data);
|
|
97
96
|
return [4 /*yield*/, Client.WebService.parse(data)];
|
|
98
97
|
case 2:
|
|
99
98
|
parsed = (_a.sent());
|
|
@@ -107,7 +106,7 @@ var useLiminarProtestosDoPassado = function (_a) {
|
|
|
107
106
|
switch (_a.label) {
|
|
108
107
|
case 0: return [4 /*yield*/, possuiPdf(chave)];
|
|
109
108
|
case 1:
|
|
110
|
-
if (
|
|
109
|
+
if (_a.sent())
|
|
111
110
|
ocultos.push(chave);
|
|
112
111
|
return [2 /*return*/];
|
|
113
112
|
}
|
|
@@ -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);
|