@credithub/harlan-components 1.73.1 → 1.75.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/consultaSimplesSection/consultaSimplesSection.js +1 -3
- package/dist/components/liminar/liminar.js +214 -78
- package/dist/components/liminar/useLiminarProtestosDoPassado.d.ts +10 -0
- package/dist/components/liminar/useLiminarProtestosDoPassado.js +111 -0
- package/lib/cjs/index.js +355 -117
- package/lib/esm/index.js +355 -117
- package/package.json +1 -1
|
@@ -81,9 +81,7 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
81
81
|
{
|
|
82
82
|
label: 'Processos Jurídicos',
|
|
83
83
|
text: data.processosJuridicos
|
|
84
|
-
? data.processosJuridicos === 1
|
|
85
|
-
? 'Processo Jurídico'
|
|
86
|
-
: "".concat(data.processosJuridicos, " Processos Jur\u00EDdicos")
|
|
84
|
+
? "".concat(data.processosJuridicos, " ").concat(data.processosJuridicos === 1 ? 'Processo Jurídico' : 'Processos Jurídicos')
|
|
87
85
|
: '',
|
|
88
86
|
loaded: (_l = (_k = data.processosJuridicosData) === null || _k === void 0 ? void 0 : _k.isLoaded) !== null && _l !== void 0 ? _l : false
|
|
89
87
|
},
|
|
@@ -9,6 +9,42 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
12
48
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
13
49
|
import ProtestosIcon from '../../assets/icones/protestos';
|
|
14
50
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
@@ -16,10 +52,13 @@ import theme from '../../styles/theme';
|
|
|
16
52
|
import { normalizeName, similarNames } from '../../utils/similarNames';
|
|
17
53
|
import { WarningCircle } from 'phosphor-react';
|
|
18
54
|
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
55
|
+
import Button from '../common/button';
|
|
56
|
+
import Modal from '../common/modal';
|
|
19
57
|
import StatusMessage from '../interface/statusMessage';
|
|
20
58
|
import Section from '../section';
|
|
21
|
-
import { Queries, RequestStatus } from '../webservice';
|
|
59
|
+
import { Queries, RequestStatus, useFetch } from '../webservice';
|
|
22
60
|
import { TitleWithTooltip, TooltipContainer, TooltipText } from './liminarStyles';
|
|
61
|
+
import useLiminarProtestosDoPassado from './useLiminarProtestosDoPassado';
|
|
23
62
|
/* ----------------------------------
|
|
24
63
|
* Constantes
|
|
25
64
|
* ---------------------------------*/
|
|
@@ -41,14 +80,24 @@ var businessTypes = [
|
|
|
41
80
|
'cooperativa'
|
|
42
81
|
];
|
|
43
82
|
var Liminar = function () {
|
|
44
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
83
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
45
84
|
var ctx = useContext(Queries.LiminarCenprot);
|
|
46
|
-
var
|
|
85
|
+
var _m = useGlobalData(), globalData = _m.data, setData = _m.setData;
|
|
86
|
+
var fetchLiminarProtestosDoPassado = useLiminarProtestosDoPassado({
|
|
87
|
+
documento: ((_b = (_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel) === null || _b === void 0 ? void 0 : _b.document) || ''
|
|
88
|
+
}).fetchLiminarProtestosDoPassado;
|
|
89
|
+
var _o = useState(false), isLoadingLiminarProtestosDoPassado = _o[0], setIsLoadingLiminarProtestosDoPassado = _o[1];
|
|
47
90
|
var processedRef = useRef(false);
|
|
48
91
|
var dataHashRef = useRef('');
|
|
49
92
|
var invertedIdsRef = useRef([]);
|
|
50
|
-
var
|
|
93
|
+
var _p = useState(false), isTooltipVisible = _p[0], setTooltipVisible = _p[1];
|
|
94
|
+
var _q = useState(false), isEmailModalOpen = _q[0], setIsEmailModalOpen = _q[1];
|
|
95
|
+
var _r = useState(''), emailModalMessage = _r[0], setEmailModalMessage = _r[1];
|
|
96
|
+
var _s = useFetch("SELECT FROM 'LIMINAR'.'SENDMAIL'"), sendIndiciosEmail = _s.fetch, isEmailSending = _s.isLoading, emailError = _s.error;
|
|
51
97
|
var hideTt = useRef();
|
|
98
|
+
/*
|
|
99
|
+
* Extrai e normaliza os tipos de documento presentes em ctx.document, retornando sempre um array de strings em minúsculo.
|
|
100
|
+
*/
|
|
52
101
|
var tiposDocumento = useMemo(function () {
|
|
53
102
|
var _a;
|
|
54
103
|
var raw = (_a = ctx.document) === null || _a === void 0 ? void 0 : _a.type;
|
|
@@ -56,6 +105,9 @@ var Liminar = function () {
|
|
|
56
105
|
return raw.map(function (t) { return t.toLowerCase(); });
|
|
57
106
|
return raw ? [String(raw).toLowerCase()] : [];
|
|
58
107
|
}, [ctx.document]);
|
|
108
|
+
/*
|
|
109
|
+
* Filtra processos jurídicos que possuem assuntos válidos e envolvidos que correspondem ao nome do carousel.
|
|
110
|
+
*/
|
|
59
111
|
var processosComAssuntoValido = useMemo(function () {
|
|
60
112
|
var _a, _b, _c, _d;
|
|
61
113
|
var carouselName = (_c = (_b = (_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '';
|
|
@@ -79,14 +131,17 @@ var Liminar = function () {
|
|
|
79
131
|
});
|
|
80
132
|
});
|
|
81
133
|
}, [
|
|
82
|
-
(
|
|
83
|
-
(
|
|
134
|
+
(_c = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _c === void 0 ? void 0 : _c.carousel,
|
|
135
|
+
(_d = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _d === void 0 ? void 0 : _d.empresa
|
|
84
136
|
]);
|
|
85
|
-
|
|
86
|
-
|
|
137
|
+
/*
|
|
138
|
+
* Identifica as origens de liminares detectadas e verifica se existe liminar de protesto invertida
|
|
139
|
+
*/
|
|
140
|
+
var _t = useMemo(function () {
|
|
141
|
+
var _a, _b;
|
|
87
142
|
var labels = new Set();
|
|
88
143
|
var indiciosApi = ((_a = ctx.document) === null || _a === void 0 ? void 0 : _a.indiciosDeLiminar) === true;
|
|
89
|
-
if (indiciosApi)
|
|
144
|
+
if (indiciosApi) {
|
|
90
145
|
tiposDocumento.forEach(function (t) {
|
|
91
146
|
var m = {
|
|
92
147
|
cenprot: 'Liminar no Cenprot',
|
|
@@ -96,8 +151,13 @@ var Liminar = function () {
|
|
|
96
151
|
if (m[t])
|
|
97
152
|
labels.add(m[t]);
|
|
98
153
|
});
|
|
99
|
-
|
|
154
|
+
}
|
|
155
|
+
if ((_b = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _b === void 0 ? void 0 : _b.indiciosDeLiminarProtestosDoPassado) {
|
|
156
|
+
labels.add('Liminar no Cenprot');
|
|
157
|
+
}
|
|
158
|
+
if (processosComAssuntoValido.length) {
|
|
100
159
|
labels.add('Liminar no Judiciário');
|
|
160
|
+
}
|
|
101
161
|
var pj = processosComAssuntoValido.some(function (p) {
|
|
102
162
|
var _a;
|
|
103
163
|
return (_a = p.envolvidos_ultima_movimentacao) === null || _a === void 0 ? void 0 : _a.some(function (e) {
|
|
@@ -108,39 +168,76 @@ var Liminar = function () {
|
|
|
108
168
|
});
|
|
109
169
|
});
|
|
110
170
|
return { origensDetectadas: Array.from(labels), foundBusinessEntity: pj };
|
|
111
|
-
}, [
|
|
171
|
+
}, [
|
|
172
|
+
ctx.document,
|
|
173
|
+
tiposDocumento,
|
|
174
|
+
processosComAssuntoValido,
|
|
175
|
+
(_e = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _e === void 0 ? void 0 : _e.indiciosDeLiminarProtestosDoPassado
|
|
176
|
+
]), origensDetectadas = _t.origensDetectadas, foundBusinessEntity = _t.foundBusinessEntity;
|
|
112
177
|
useEffect(function () {
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
178
|
+
var fetch = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
179
|
+
var dossie, processosJuridicos, depsLoaded, newIds, hash, indiciosApi, indiciosDeLiminarProtestosDoPassado, protestosDoPassadoIds, _a, possuiIndiciosDeLiminarProtestosDoPassado, protestosIds, finalStatus;
|
|
180
|
+
var _b, _c, _d;
|
|
181
|
+
return __generator(this, function (_e) {
|
|
182
|
+
switch (_e.label) {
|
|
183
|
+
case 0:
|
|
184
|
+
dossie = globalData === null || globalData === void 0 ? void 0 : globalData.dossie;
|
|
185
|
+
processosJuridicos = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData;
|
|
186
|
+
depsLoaded = !!(processosJuridicos === null || processosJuridicos === void 0 ? void 0 : processosJuridicos.isLoaded) && !!(dossie === null || dossie === void 0 ? void 0 : dossie.carousel);
|
|
187
|
+
if (!depsLoaded || ctx.type === RequestStatus.Loading)
|
|
188
|
+
return [2 /*return*/];
|
|
189
|
+
newIds = foundBusinessEntity
|
|
190
|
+
? processosComAssuntoValido.map(function (p) { return p.id; })
|
|
191
|
+
: [];
|
|
192
|
+
hash = JSON.stringify({
|
|
193
|
+
t: ctx.type,
|
|
194
|
+
indicios: (_b = ctx.document) === null || _b === void 0 ? void 0 : _b.indiciosDeLiminar,
|
|
195
|
+
carousel: dossie.carousel,
|
|
196
|
+
empresas: processosJuridicos.empresa
|
|
197
|
+
});
|
|
198
|
+
if (hash === dataHashRef.current)
|
|
199
|
+
return [2 /*return*/];
|
|
200
|
+
dataHashRef.current = hash;
|
|
201
|
+
indiciosApi = ((_c = ctx.document) === null || _c === void 0 ? void 0 : _c.indiciosDeLiminar) === true;
|
|
202
|
+
indiciosDeLiminarProtestosDoPassado = false;
|
|
203
|
+
protestosDoPassadoIds = '';
|
|
204
|
+
if (!(!indiciosApi &&
|
|
205
|
+
!processosComAssuntoValido.length &&
|
|
206
|
+
((_d = globalData === null || globalData === void 0 ? void 0 : globalData.documentHistory) === null || _d === void 0 ? void 0 : _d.protestoLiminar))) return [3 /*break*/, 2];
|
|
207
|
+
setIsLoadingLiminarProtestosDoPassado(true);
|
|
208
|
+
return [4 /*yield*/, fetchLiminarProtestosDoPassado()];
|
|
209
|
+
case 1:
|
|
210
|
+
_a = _e.sent(), possuiIndiciosDeLiminarProtestosDoPassado = _a.possuiIndiciosDeLiminarProtestosDoPassado, protestosIds = _a.protestosDoPassadoIds;
|
|
211
|
+
console.log("possuiIndiciosDeLiminarProtestosDoPassado", possuiIndiciosDeLiminarProtestosDoPassado);
|
|
212
|
+
if (possuiIndiciosDeLiminarProtestosDoPassado) {
|
|
213
|
+
origensDetectadas.push('Liminar no Cenprot');
|
|
214
|
+
indiciosDeLiminarProtestosDoPassado = possuiIndiciosDeLiminarProtestosDoPassado;
|
|
215
|
+
protestosDoPassadoIds = protestosIds.join(',');
|
|
216
|
+
}
|
|
217
|
+
setIsLoadingLiminarProtestosDoPassado(false);
|
|
218
|
+
_e.label = 2;
|
|
219
|
+
case 2:
|
|
220
|
+
finalStatus = indiciosApi ||
|
|
221
|
+
processosComAssuntoValido.length ||
|
|
222
|
+
indiciosDeLiminarProtestosDoPassado
|
|
223
|
+
? 'Encontrado'
|
|
224
|
+
: 'Não encontrado';
|
|
225
|
+
invertedIdsRef.current = newIds;
|
|
226
|
+
setData(function (prev) { return (__assign(__assign({}, prev), { liminar: {
|
|
227
|
+
indiciosDeLiminar: indiciosApi || indiciosDeLiminarProtestosDoPassado,
|
|
228
|
+
message: finalStatus,
|
|
229
|
+
isLoaded: true,
|
|
230
|
+
processosComLiminarIds: processosComAssuntoValido.map(function (p) { return p.id; }),
|
|
231
|
+
indiciosDeLiminarProtestosDoPassado: indiciosDeLiminarProtestosDoPassado,
|
|
232
|
+
protestosDoPassadoIds: protestosDoPassadoIds,
|
|
233
|
+
invertedProcessos: newIds
|
|
234
|
+
} })); });
|
|
235
|
+
processedRef.current = true;
|
|
236
|
+
return [2 /*return*/];
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}); };
|
|
240
|
+
fetch();
|
|
144
241
|
}, [
|
|
145
242
|
ctx.type,
|
|
146
243
|
ctx.document,
|
|
@@ -151,8 +248,9 @@ var Liminar = function () {
|
|
|
151
248
|
foundBusinessEntity
|
|
152
249
|
]);
|
|
153
250
|
var ready = processedRef.current &&
|
|
154
|
-
!!((
|
|
155
|
-
!!((
|
|
251
|
+
!!((_f = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _f === void 0 ? void 0 : _f.isLoaded) &&
|
|
252
|
+
!!((_g = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _g === void 0 ? void 0 : _g.carousel) &&
|
|
253
|
+
!isLoadingLiminarProtestosDoPassado &&
|
|
156
254
|
ctx.type !== RequestStatus.Loading;
|
|
157
255
|
var ctxLoading = useMemo(function () { return (__assign(__assign({}, ctx), { type: RequestStatus.Loading })); }, [ctx]);
|
|
158
256
|
var scrollToProcesso = function (id) {
|
|
@@ -169,41 +267,79 @@ var Liminar = function () {
|
|
|
169
267
|
var tooltipMessage = foundBusinessEntity
|
|
170
268
|
? 'Atenção: Em alguns casos, o sistema judicial pode registrar os papéis das partes de forma invertida, dificultando a interpretação direta. Por isso, utilizamos algoritmos internos para detectar esse padrão com base em contexto e palavras-chave.'
|
|
171
269
|
: 'Processos com indícios encontrados:';
|
|
172
|
-
var shouldRender =
|
|
173
|
-
(
|
|
174
|
-
((_h =
|
|
270
|
+
var shouldRender = isLoadingLiminarProtestosDoPassado ||
|
|
271
|
+
(ready &&
|
|
272
|
+
(((_h = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _h === void 0 ? void 0 : _h.indiciosDeLiminar) ||
|
|
273
|
+
((_l = (_k = (_j = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _j === void 0 ? void 0 : _j.processosComLiminarIds) === null || _k === void 0 ? void 0 : _k.length) !== null && _l !== void 0 ? _l : 0) > 0));
|
|
274
|
+
// Função para disparar o envio do e-mail e configurar a mensagem do modal
|
|
275
|
+
var handleSendEmailIndicios = function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
|
276
|
+
var documento, ids;
|
|
277
|
+
var _a, _b, _c;
|
|
278
|
+
return __generator(this, function (_d) {
|
|
279
|
+
switch (_d.label) {
|
|
280
|
+
case 0:
|
|
281
|
+
e.preventDefault();
|
|
282
|
+
e.stopPropagation();
|
|
283
|
+
documento = ((_b = (_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel) === null || _b === void 0 ? void 0 : _b.document) || '';
|
|
284
|
+
ids = ((_c = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _c === void 0 ? void 0 : _c.protestosDoPassadoIds) || '';
|
|
285
|
+
return [4 /*yield*/, sendIndiciosEmail({ documento: documento, nm_chave: ids })];
|
|
286
|
+
case 1:
|
|
287
|
+
_d.sent();
|
|
288
|
+
if (emailError) {
|
|
289
|
+
setEmailModalMessage("Falha ao enviar e-mail: ".concat(emailError.message));
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
setEmailModalMessage('O e-mail com os indícios da liminar foi enviado com sucesso.');
|
|
293
|
+
}
|
|
294
|
+
setIsEmailModalOpen(true);
|
|
295
|
+
return [2 /*return*/];
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}); };
|
|
175
299
|
if (!shouldRender)
|
|
176
300
|
return null;
|
|
177
|
-
return (React.createElement(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
React.createElement(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
React.createElement(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
301
|
+
return (React.createElement(React.Fragment, null,
|
|
302
|
+
React.createElement(Section, { title: React.createElement(TitleWithTooltip, null,
|
|
303
|
+
"Liminares para Remo\u00E7\u00E3o de Protesto",
|
|
304
|
+
!!processosComAssuntoValido.length && ready && (React.createElement(TooltipContainer, { onMouseEnter: function () {
|
|
305
|
+
clearTimeout(hideTt.current);
|
|
306
|
+
setTooltipVisible(true);
|
|
307
|
+
}, onMouseLeave: function () {
|
|
308
|
+
hideTt.current = setTimeout(function () { return setTooltipVisible(false); }, 300);
|
|
309
|
+
} },
|
|
310
|
+
renderTooltipIcon(),
|
|
311
|
+
React.createElement(TooltipText, { visible: isTooltipVisible },
|
|
312
|
+
React.createElement(React.Fragment, null,
|
|
313
|
+
tooltipMessage,
|
|
314
|
+
React.createElement("ul", { style: { marginTop: 6, paddingLeft: 18 } }, processosComAssuntoValido.map(function (p) { return (React.createElement("li", { key: p.id, onClick: function () { return scrollToProcesso(p.id); }, style: {
|
|
315
|
+
fontSize: 13,
|
|
316
|
+
cursor: 'pointer',
|
|
317
|
+
textDecoration: 'underline',
|
|
318
|
+
color: '#007aff'
|
|
319
|
+
} }, p.id)); }))))))), subtitle: "Ind\u00EDcios de liminares para oculta\u00E7\u00E3o de registros.", icon: ProtestosIcon, ctx: ready ? ctx : ctxLoading, onSuccess: ready
|
|
320
|
+
? function (_data, _context) {
|
|
321
|
+
var _a, _b, _c, _d;
|
|
322
|
+
var msg = (_b = (_a = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : 'Não encontrado';
|
|
323
|
+
var variant = msg === 'Encontrado' ? 'error' : 'default';
|
|
324
|
+
return {
|
|
325
|
+
children: React.createElement(React.Fragment, null),
|
|
326
|
+
variant: variant,
|
|
327
|
+
description: (React.createElement(React.Fragment, null,
|
|
328
|
+
React.createElement(StatusMessage, { type: variant }, msg),
|
|
329
|
+
origensDetectadas.map(function (o) { return (React.createElement(StatusMessage, { key: o, type: variant }, o)); }))),
|
|
330
|
+
actions: (React.createElement("div", { style: { textAlign: 'center' }, onClick: function (e) { return e.stopPropagation(); } }, ((_c = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _c === void 0 ? void 0 : _c.indiciosDeLiminarProtestosDoPassado) && ((_d = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _d === void 0 ? void 0 : _d.protestosDoPassadoIds) && (React.createElement(Button, { onClick: handleSendEmailIndicios }, "Enviar Ind\u00EDcios por Email"))))
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
: undefined }),
|
|
334
|
+
React.createElement(Modal, { isOpen: isEmailModalOpen, onClose: function () {
|
|
335
|
+
setIsEmailModalOpen(false);
|
|
336
|
+
setEmailModalMessage('');
|
|
337
|
+
}, title: "Resultado do Envio de E-mail" },
|
|
338
|
+
React.createElement("p", null, emailModalMessage),
|
|
339
|
+
React.createElement("div", { style: { textAlign: 'center', marginTop: '16px' } },
|
|
340
|
+
React.createElement(Button, { onClick: function () {
|
|
341
|
+
setIsEmailModalOpen(false);
|
|
342
|
+
setEmailModalMessage('');
|
|
343
|
+
} }, "Fechar")))));
|
|
208
344
|
};
|
|
209
345
|
export default Liminar;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface LiminarProtestosDoPassadoProps {
|
|
2
|
+
documento: string;
|
|
3
|
+
}
|
|
4
|
+
declare const useLiminarProtestosDoPassado: ({ documento }: LiminarProtestosDoPassadoProps) => {
|
|
5
|
+
fetchLiminarProtestosDoPassado: () => Promise<{
|
|
6
|
+
possuiIndiciosDeLiminarProtestosDoPassado: boolean;
|
|
7
|
+
protestosDoPassadoIds: string[];
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
export default useLiminarProtestosDoPassado;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { Client } from "@credithub/webservice";
|
|
38
|
+
import { useCallback, useContext } from "react";
|
|
39
|
+
import { WebService } from "../webservice";
|
|
40
|
+
import XPathUtils from "../../utils/xpath";
|
|
41
|
+
var useLiminarProtestosDoPassado = function (_a) {
|
|
42
|
+
var documento = _a.documento;
|
|
43
|
+
var client = useContext(WebService);
|
|
44
|
+
var getAlgumInstrumentoPossuiPDF = function (numerosChave) { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
+
var getNumeroChave, i, chunk, results;
|
|
46
|
+
return __generator(this, function (_a) {
|
|
47
|
+
switch (_a.label) {
|
|
48
|
+
case 0:
|
|
49
|
+
getNumeroChave = function (numeroChave) { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
+
var response, _a;
|
|
51
|
+
return __generator(this, function (_b) {
|
|
52
|
+
switch (_b.label) {
|
|
53
|
+
case 0:
|
|
54
|
+
_b.trys.push([0, 3, , 4]);
|
|
55
|
+
return [4 /*yield*/, client.request("SELECT FROM 'PDFPROTESTO'.'PDF'", { nm_chave: numeroChave })];
|
|
56
|
+
case 1:
|
|
57
|
+
response = _b.sent();
|
|
58
|
+
return [4 /*yield*/, response.json()];
|
|
59
|
+
case 2: return [2 /*return*/, !!(_b.sent())];
|
|
60
|
+
case 3:
|
|
61
|
+
_a = _b.sent();
|
|
62
|
+
return [2 /*return*/, false];
|
|
63
|
+
case 4: return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}); };
|
|
67
|
+
i = 0;
|
|
68
|
+
_a.label = 1;
|
|
69
|
+
case 1:
|
|
70
|
+
if (!(i < numerosChave.length)) return [3 /*break*/, 4];
|
|
71
|
+
chunk = numerosChave.slice(i, i + 5);
|
|
72
|
+
return [4 /*yield*/, Promise.all(chunk.map(getNumeroChave))];
|
|
73
|
+
case 2:
|
|
74
|
+
results = _a.sent();
|
|
75
|
+
if (results.includes(true))
|
|
76
|
+
return [2 /*return*/, true];
|
|
77
|
+
_a.label = 3;
|
|
78
|
+
case 3:
|
|
79
|
+
i += 5;
|
|
80
|
+
return [3 /*break*/, 1];
|
|
81
|
+
case 4: return [2 /*return*/, false];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}); };
|
|
85
|
+
var fetch = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
|
+
var data, parsed, nodes, numerosChave, possuiIndiciosDeLiminarProtestosDoPassado;
|
|
87
|
+
return __generator(this, function (_a) {
|
|
88
|
+
switch (_a.label) {
|
|
89
|
+
case 0: return [4 /*yield*/, client.request("SELECT FROM 'IEPTB'.'PASTQUERIES'", {
|
|
90
|
+
documento: documento
|
|
91
|
+
})];
|
|
92
|
+
case 1:
|
|
93
|
+
data = _a.sent();
|
|
94
|
+
return [4 /*yield*/, Client.WebService.parse(data)];
|
|
95
|
+
case 2:
|
|
96
|
+
parsed = _a.sent();
|
|
97
|
+
nodes = XPathUtils.selectArray('//protesto/nm_chave', parsed);
|
|
98
|
+
numerosChave = Array.from(new Set(nodes.map(function (node) { return node.textContent || ''; })));
|
|
99
|
+
return [4 /*yield*/, getAlgumInstrumentoPossuiPDF(numerosChave)];
|
|
100
|
+
case 3:
|
|
101
|
+
possuiIndiciosDeLiminarProtestosDoPassado = _a.sent();
|
|
102
|
+
return [2 /*return*/, {
|
|
103
|
+
possuiIndiciosDeLiminarProtestosDoPassado: possuiIndiciosDeLiminarProtestosDoPassado,
|
|
104
|
+
protestosDoPassadoIds: numerosChave
|
|
105
|
+
}];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}); }, [documento]);
|
|
109
|
+
return { fetchLiminarProtestosDoPassado: fetch };
|
|
110
|
+
};
|
|
111
|
+
export default useLiminarProtestosDoPassado;
|