@credithub/harlan-components 1.59.0 → 1.59.2
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/liminar/liminar.js +37 -43
- package/dist/utils/protestosp.js +1 -1
- package/lib/cjs/index.js +39 -45
- package/lib/esm/index.js +39 -45
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import ProtestosIcon from '../../assets/icones/protestos';
|
|
13
13
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
14
14
|
import { normalizeName, similarNames } from '../../utils/similarNames';
|
|
15
|
-
import React, { useContext, useEffect, useMemo,
|
|
15
|
+
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';
|
|
@@ -21,18 +21,16 @@ var Liminar = function () {
|
|
|
21
21
|
var ctx = useContext(Queries.LiminarCenprot);
|
|
22
22
|
var _d = useGlobalData(), globalData = _d.data, setData = _d.setData;
|
|
23
23
|
var _e = useState(undefined), liminarResult = _e[0], setLiminarResult = _e[1];
|
|
24
|
+
var _f = useState(true), isProcessing = _f[0], setIsProcessing = _f[1];
|
|
24
25
|
var didRunRef = useRef(false);
|
|
25
26
|
var carousel = (_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel;
|
|
26
27
|
var isPJDataLoaded = (_b = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _b === void 0 ? void 0 : _b.isLoaded;
|
|
27
28
|
var empresas = (_c = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _c === void 0 ? void 0 : _c.empresa;
|
|
28
29
|
useEffect(function () {
|
|
29
30
|
var _a;
|
|
30
|
-
if (didRunRef.current)
|
|
31
|
+
if (didRunRef.current || !carousel || !isPJDataLoaded)
|
|
31
32
|
return;
|
|
32
|
-
|
|
33
|
-
return;
|
|
34
|
-
var empresaNome = carousel.name || '';
|
|
35
|
-
var empresaNomeNormalizado = normalizeName(empresaNome);
|
|
33
|
+
var empresaNomeNormalizado = normalizeName((carousel === null || carousel === void 0 ? void 0 : carousel.name) || '');
|
|
36
34
|
var validAssuntos = [
|
|
37
35
|
'protesto indevido de títulos',
|
|
38
36
|
'inclusão indevida em cadastro de inadimplentes',
|
|
@@ -45,60 +43,56 @@ var Liminar = function () {
|
|
|
45
43
|
var processosAtivo = empresas === null || empresas === void 0 ? void 0 : empresas.filter(function (processo) {
|
|
46
44
|
var _a;
|
|
47
45
|
var hasAtivoEnvolvido = (_a = processo.envolvidos_ultima_movimentacao) === null || _a === void 0 ? void 0 : _a.some(function (envolvido) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
similarNames(nomeEnvolvidoNormalizado, empresaNomeNormalizado));
|
|
46
|
+
return envolvido.envolvido_tipo === 'Ativo' &&
|
|
47
|
+
similarNames(normalizeName(envolvido.nome_sem_filtro), empresaNomeNormalizado);
|
|
51
48
|
});
|
|
52
49
|
var assuntos = Array.isArray(processo.assuntos)
|
|
53
50
|
? processo.assuntos
|
|
54
51
|
: [processo.assuntos];
|
|
55
52
|
var hasValidAssunto = assuntos.some(function (assunto) {
|
|
56
|
-
var assuntoNormalizado = normalizeName(assunto);
|
|
57
53
|
return validAssuntos.some(function (valid) {
|
|
58
|
-
return similarNames(
|
|
54
|
+
return similarNames(normalizeName(assunto), valid);
|
|
59
55
|
});
|
|
60
56
|
});
|
|
61
57
|
return hasAtivoEnvolvido && hasValidAssunto;
|
|
62
58
|
});
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
indiciosDeLiminar = false;
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
console.error('Erro na requisição de liminares:', ctx.error || 'Erro desconhecido');
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
else if (ctx.type === RequestStatus.Success) {
|
|
74
|
-
indiciosDeLiminar = ((_a = ctx.document) === null || _a === void 0 ? void 0 : _a.indiciosDeLiminar) === true;
|
|
59
|
+
var isProcessoNaoEncontrado = ctx.type === RequestStatus.Error &&
|
|
60
|
+
String(ctx.error).includes('Processo(s) não encontrado(s).');
|
|
61
|
+
if (ctx.type === RequestStatus.Error && !isProcessoNaoEncontrado) {
|
|
62
|
+
console.error('Erro na requisição de liminares:', ctx.error || 'Erro desconhecido');
|
|
75
63
|
}
|
|
64
|
+
var isSuccess = ctx.type === RequestStatus.Success || isProcessoNaoEncontrado;
|
|
65
|
+
var indiciosDeLiminar = isSuccess
|
|
66
|
+
? ((_a = ctx.document) === null || _a === void 0 ? void 0 : _a.indiciosDeLiminar) === true
|
|
67
|
+
: false;
|
|
76
68
|
var finalStatus = indiciosDeLiminar || (processosAtivo && processosAtivo.length > 0)
|
|
77
69
|
? 'Encontrado'
|
|
78
70
|
: 'Não encontrado';
|
|
79
71
|
setData(function (prev) { return (__assign(__assign({}, prev), { liminar: { indiciosDeLiminar: indiciosDeLiminar, message: finalStatus } })); });
|
|
80
72
|
setLiminarResult(finalStatus);
|
|
73
|
+
setIsProcessing(false);
|
|
81
74
|
didRunRef.current = true;
|
|
82
|
-
}, [carousel, isPJDataLoaded, empresas, ctx
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
: ctx.document });
|
|
90
|
-
}, [liminarResult, ctx]);
|
|
91
|
-
if (liminarResult === 'Não encontrado') {
|
|
75
|
+
}, [carousel, isPJDataLoaded, empresas, ctx, setData]);
|
|
76
|
+
var isProcessoNaoEncontrado = ctx.type === RequestStatus.Error &&
|
|
77
|
+
String(ctx.error).includes('Processo(s) não encontrado(s).');
|
|
78
|
+
var derivedCtx = useMemo(function () { return (__assign(__assign({}, ctx), { type: isProcessoNaoEncontrado ? RequestStatus.Success : ctx.type, document: isProcessoNaoEncontrado
|
|
79
|
+
? { indiciosDeLiminar: false }
|
|
80
|
+
: ctx.document })); }, [ctx, isProcessoNaoEncontrado]);
|
|
81
|
+
if (!isProcessing && liminarResult === 'Não encontrado')
|
|
92
82
|
return null;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
83
|
+
return (React.createElement(Section, { title: "Liminares para Remo\u00E7\u00E3o de Protesto", subtitle: isProcessing
|
|
84
|
+
? 'Carregando liminar...'
|
|
85
|
+
: 'Indícios de liminares para ocultação de registros.', icon: ProtestosIcon, ctx: isProcessing ? __assign(__assign({}, ctx), { type: RequestStatus.Loading }) : derivedCtx, onSuccess: isProcessing
|
|
86
|
+
? undefined
|
|
87
|
+
: function (data, context) {
|
|
88
|
+
var _a;
|
|
89
|
+
var globalMessage = ((_a = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _a === void 0 ? void 0 : _a.message) || 'Não encontrado';
|
|
90
|
+
var variant = globalMessage === 'Encontrado' ? 'error' : 'default';
|
|
91
|
+
return {
|
|
92
|
+
children: React.createElement(React.Fragment, null),
|
|
93
|
+
variant: variant,
|
|
94
|
+
description: (React.createElement(StatusMessage, { type: variant }, globalMessage))
|
|
95
|
+
};
|
|
96
|
+
} }));
|
|
103
97
|
};
|
|
104
98
|
export default Liminar;
|
package/dist/utils/protestosp.js
CHANGED
|
@@ -57,7 +57,7 @@ export function openFormThenRedirect(chaveUnica, devedorPrincipal) {
|
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
// Build the HTML document for the new window with the form.
|
|
60
|
-
var html = "\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <title>Instrumento de S\u00E3o Paulo</title>\n </head>\n <body>\n <form id=\"submissionForm\" method=\"POST\" action=\"https://protestosp.com.br/Validacoes/Consultar\">\n <input type=\"hidden\" name=\"vTipoDocumento\" value=\"1\">\n <input type=\"hidden\" name=\"ChaveUnica\" value=\"".concat(formattedChaveUnica, "\">\n <input type=\"hidden\" name=\"DevedorPrincipalTipo\" value=\"").concat(devedorPrincipalTipo, "\">\n <input type=\"hidden\" name=\"DevedorPrincipal\" value=\"").concat(formattedDevedorPrincipal, "\">\n <input type=\"hidden\" name=\"ChaveValidacao\" value=\"P35-5030-8000-\">\n <input type=\"hidden\" name=\"PesquisadoDocumentoTipo\" value=\"0\">\n <input type=\"hidden\" name=\"PesquisadoDocumento\" value=\"\">\n <input type=\"hidden\" name=\"X-Requested-With\" value=\"XMLHttpRequest\">\n </form>\n <script>\n // Auto-submit the form.\n document.getElementById('submissionForm').submit();\n // After 2 seconds, close this window.\n </script>\n </body>\n </html>\n ");
|
|
60
|
+
var html = "\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <title>Instrumento de S\u00E3o Paulo</title>\n <meta name=\"referrer\" content=\"no-referrer\" />\n </head>\n <body>\n <form id=\"submissionForm\" method=\"POST\" action=\"https://protestosp.com.br/Validacoes/Consultar\">\n <input type=\"hidden\" name=\"vTipoDocumento\" value=\"1\">\n <input type=\"hidden\" name=\"ChaveUnica\" value=\"".concat(formattedChaveUnica, "\">\n <input type=\"hidden\" name=\"DevedorPrincipalTipo\" value=\"").concat(devedorPrincipalTipo, "\">\n <input type=\"hidden\" name=\"DevedorPrincipal\" value=\"").concat(formattedDevedorPrincipal, "\">\n <input type=\"hidden\" name=\"ChaveValidacao\" value=\"P35-5030-8000-\">\n <input type=\"hidden\" name=\"PesquisadoDocumentoTipo\" value=\"0\">\n <input type=\"hidden\" name=\"PesquisadoDocumento\" value=\"\">\n <input type=\"hidden\" name=\"X-Requested-With\" value=\"XMLHttpRequest\">\n </form>\n <script>\n // Auto-submit the form.\n document.getElementById('submissionForm').submit();\n // After 2 seconds, close this window.\n </script>\n </body>\n </html>\n ");
|
|
61
61
|
newWindow.document.open();
|
|
62
62
|
newWindow.document.write(html);
|
|
63
63
|
setTimeout(function () {
|