@credithub/harlan-components 1.65.1 → 1.67.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.
@@ -54,6 +54,32 @@ var Liminar = function () {
54
54
  }
55
55
  return [];
56
56
  }, [ctx.document]);
57
+ var processosComAssuntoValido = useMemo(function () {
58
+ var _a, _b, _c;
59
+ var carouselName = ((_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) || '';
60
+ var empresas = (_c = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _c === void 0 ? void 0 : _c.empresa;
61
+ var nomeEmpresaNorm = normalizeName(carouselName);
62
+ if (!Array.isArray(empresas))
63
+ return [];
64
+ return empresas.filter(function (processo) {
65
+ var _a;
66
+ var ativoMatch = (_a = processo.envolvidos_ultima_movimentacao) === null || _a === void 0 ? void 0 : _a.some(function (e) {
67
+ return e.envolvido_tipo === 'Ativo' &&
68
+ similarNames(normalizeName(e.nome_sem_filtro), nomeEmpresaNorm, 0.9);
69
+ });
70
+ if (!ativoMatch)
71
+ return false;
72
+ var assuntos = Array.isArray(processo.assuntos)
73
+ ? processo.assuntos
74
+ : [processo.assuntos];
75
+ return assuntos.some(function (a) {
76
+ return validAssuntos.includes(normalizeName(a));
77
+ });
78
+ });
79
+ }, [
80
+ (_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel,
81
+ (_b = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _b === void 0 ? void 0 : _b.empresa
82
+ ]);
57
83
  var mapTipoToLabel = function (tipo) {
58
84
  switch (tipo) {
59
85
  case 'cenprot':
@@ -66,9 +92,8 @@ var Liminar = function () {
66
92
  return null;
67
93
  }
68
94
  };
69
- // Detecta origens de liminar: tipos + processos
70
95
  var origensDetectadas = useMemo(function () {
71
- var _a, _b, _c, _d;
96
+ var _a;
72
97
  var labels = new Set();
73
98
  var indiciosApi = ((_a = ctx.document) === null || _a === void 0 ? void 0 : _a.indiciosDeLiminar) === true;
74
99
  if (indiciosApi) {
@@ -78,53 +103,25 @@ var Liminar = function () {
78
103
  labels.add(label);
79
104
  });
80
105
  }
81
- // Processos Judiciais sempre checados
82
- var carouselName = ((_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.name) || '';
83
- var empresas = (_d = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _d === void 0 ? void 0 : _d.empresa;
84
- if (carouselName && Array.isArray(empresas)) {
85
- var nomeEmpresaNorm_1 = normalizeName(carouselName);
86
- var hasJudicial = empresas.some(function (processo) {
106
+ if (processosComAssuntoValido.length > 0) {
107
+ labels.add('Liminar no Judiciário');
108
+ var foundBusinessEntity = processosComAssuntoValido.some(function (processo) {
87
109
  var _a;
88
- var ativoMatch = (_a = processo.envolvidos_ultima_movimentacao) === null || _a === void 0 ? void 0 : _a.some(function (e) {
89
- return e.envolvido_tipo === 'Ativo' &&
90
- similarNames(normalizeName(e.nome_sem_filtro), nomeEmpresaNorm_1, 0.9);
91
- });
92
- if (!ativoMatch)
93
- return false;
94
- var assuntos = Array.isArray(processo.assuntos)
95
- ? processo.assuntos
96
- : [processo.assuntos];
97
- return assuntos.some(function (a) {
98
- return validAssuntos.includes(normalizeName(a));
110
+ return (_a = processo.envolvidos_ultima_movimentacao) === null || _a === void 0 ? void 0 : _a.some(function (e) {
111
+ if (e.envolvido_tipo !== 'Ativo')
112
+ return false;
113
+ var nomeNorm = normalizeName(e.nome_sem_filtro);
114
+ return businessTypes.some(function (type) { return nomeNorm.includes(type); });
99
115
  });
100
116
  });
101
- if (hasJudicial) {
102
- labels.add('Liminar no Judiciário');
103
- var foundBusinessEntity = empresas.some(function (processo) {
104
- var _a;
105
- return (_a = processo.envolvidos_ultima_movimentacao) === null || _a === void 0 ? void 0 : _a.some(function (e) {
106
- if (e.envolvido_tipo !== 'Ativo')
107
- return false;
108
- var nomeNorm = normalizeName(e.nome_sem_filtro);
109
- return businessTypes.some(function (type) { return nomeNorm.includes(type); });
110
- });
111
- });
112
- if (foundBusinessEntity) {
113
- setShowInversionInfo(true);
114
- }
117
+ if (foundBusinessEntity) {
118
+ setShowInversionInfo(true);
115
119
  }
116
120
  }
117
121
  return Array.from(labels);
118
- }, [
119
- ctx.document,
120
- tiposDocumento,
121
- (_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel,
122
- (_b = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _b === void 0 ? void 0 : _b.empresa
123
- ]);
124
- // Indica se houve erro 404 (processo não encontrado)
122
+ }, [ctx.document, tiposDocumento, processosComAssuntoValido]);
125
123
  var isErro404 = useMemo(function () { return ctx.type === RequestStatus.Error && !!ctx.error; }, [ctx.type, ctx.error]);
126
124
  var derivedCtx = useMemo(function () { return (__assign(__assign({}, ctx), { type: isErro404 ? RequestStatus.Success : ctx.type, document: isErro404 ? { indiciosDeLiminar: false } : ctx.document })); }, [ctx, isErro404]);
127
- // Efeito principal: atualiza estado global e resultados
128
125
  useEffect(function () {
129
126
  var _a, _b, _c, _d;
130
127
  if (!((_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel) ||
@@ -167,7 +164,14 @@ var Liminar = function () {
167
164
  processingRef.current = false;
168
165
  processedRef.current = true;
169
166
  }, [ctx, globalData, origensDetectadas, setData, isErro404]);
170
- // Se nada encontrado, não renderiza componente
167
+ var scrollToProcesso = function (id) {
168
+ var el = document.getElementById(id);
169
+ if (el) {
170
+ el.scrollIntoView({ behavior: 'smooth', block: 'start' });
171
+ el.classList.add('highlighted-process');
172
+ setTimeout(function () { return el.classList.remove('highlighted-process'); }, 3000);
173
+ }
174
+ };
171
175
  if (processedRef.current && resultRef.current === 'Não encontrado') {
172
176
  return null;
173
177
  }
@@ -176,7 +180,18 @@ var Liminar = function () {
176
180
  "Liminares para Remo\u00E7\u00E3o de Protesto",
177
181
  showInversionInfo && (React.createElement(TooltipContainer, null,
178
182
  React.createElement(TooltipIcon, null),
179
- React.createElement(TooltipText, null, "Aten\u00E7\u00E3o: Em alguns casos, o sistema judicial pode registrar os pap\u00E9is das partes de forma invertida, dificultando a interpreta\u00E7\u00E3o direta. Por isso, utilizamos algoritmos internos para detectar esse padr\u00E3o com base em contexto e palavras-chave."))))), subtitle: processingRef.current
183
+ React.createElement(TooltipText, null,
184
+ "Aten\u00E7\u00E3o: Em alguns casos, o sistema judicial pode registrar os pap\u00E9is das partes de forma invertida, dificultando a interpreta\u00E7\u00E3o direta. Por isso, utilizamos algoritmos internos para detectar esse padr\u00E3o com base em contexto e palavras-chave.",
185
+ processosComAssuntoValido.length > 0 && (React.createElement(React.Fragment, null,
186
+ React.createElement("br", null),
187
+ React.createElement("br", null),
188
+ "Processos com ind\u00EDcios encontrados:",
189
+ React.createElement("ul", { style: { marginTop: '6px', paddingLeft: '18px' } }, processosComAssuntoValido.map(function (proc, idx) { return (React.createElement("li", { key: idx, onClick: function () { return scrollToProcesso(proc.id); }, style: {
190
+ fontSize: '13px',
191
+ cursor: 'pointer',
192
+ textDecoration: 'underline',
193
+ color: '#007aff'
194
+ } }, proc.id)); }))))))))), subtitle: processingRef.current
180
195
  ? 'Carregando liminar...'
181
196
  : 'Indícios de liminares para ocultação de registros.', icon: ProtestosIcon, ctx: processingRef.current
182
197
  ? __assign(__assign({}, ctx), { type: RequestStatus.Loading }) : derivedCtx, onSuccess: processingRef.current
@@ -24,26 +24,35 @@ var __rest = (this && this.__rest) || function (s, e) {
24
24
  }
25
25
  return t;
26
26
  };
27
- import React, { memo } from 'react';
27
+ import { useGlobalData } from '../../contexts/globalDataContext';
28
+ import { sortProcessosByDate } from '../../utils/sortProcessosByDate';
29
+ import { WarningCircle } from 'phosphor-react';
30
+ import React, { memo, useEffect, useState } from 'react';
28
31
  import styled from 'styled-components';
29
32
  import AddItem from '../common/addItem';
30
33
  import Button from '../common/button';
31
34
  import { Result, ResultContent } from '../interface/result';
32
35
  import EnvolvidosList from './envolvidosList';
33
- import { sortProcessosByDate } from '../../utils/sortProcessosByDate';
34
36
  var AddProcessoJuridicoField = function (_a) {
35
37
  var value = _a.value, props = __rest(_a, ["value"]);
36
38
  return (React.createElement(AddItem, __assign({}, props, { value: value || 'Não Informado' })));
37
39
  };
38
- var ProcessoJuridicoWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n\n @media (min-width: 1000px) {\n flex-direction: row;\n }\n"], ["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n\n @media (min-width: 1000px) {\n flex-direction: row;\n }\n"])));
40
+ var ProcessoJuridicoWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n scroll-margin-top: 100px;\n\n @media (min-width: 1000px) {\n flex-direction: row;\n }\n"], ["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n scroll-margin-top: 100px;\n\n @media (min-width: 1000px) {\n flex-direction: row;\n }\n"])));
39
41
  var ConsultarProcessoBtn = styled(Button)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n @media (min-width: 1000px) {\n width: 100%;\n max-width: 150px;\n height: max-content;\n }\n"], ["\n @media (min-width: 1000px) {\n width: 100%;\n max-width: 150px;\n height: max-content;\n }\n"])));
40
42
  var ResultWrapper = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 100%;\n"], ["\n width: 100%;\n"])));
43
+ var CNJWithIcon = styled.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: 8px;\n"], ["\n display: flex;\n align-items: center;\n gap: 8px;\n"])));
41
44
  var ProcessoJuridicoItem = memo(function (_a) {
42
- var processo = _a.processo, children = _a.children;
43
- return (React.createElement(ProcessoJuridicoWrapper, null,
45
+ var _b, _c, _d;
46
+ var processo = _a.processo, children = _a.children, highlighted = _a.highlighted;
47
+ var global = useGlobalData().data;
48
+ var hasLiminar = ((_b = global === null || global === void 0 ? void 0 : global.liminar) === null || _b === void 0 ? void 0 : _b.message) === 'Encontrado' &&
49
+ ((_d = (_c = global === null || global === void 0 ? void 0 : global.processosJuridicosData) === null || _c === void 0 ? void 0 : _c.empresa) === null || _d === void 0 ? void 0 : _d.some(function (p) { return p.id === processo.id; }));
50
+ return (React.createElement(ProcessoJuridicoWrapper, { id: processo.id, className: highlighted ? 'highlighted-process' : '' },
44
51
  React.createElement(ResultWrapper, null,
45
52
  React.createElement(ResultContent, { fullWidth: true, desktop: "1.5fr 1.5fr repeat(3, 1fr)", tablet: "repeat(3, 1fr)" },
46
- React.createElement(AddProcessoJuridicoField, { name: "N\u00FAmero CNJ", value: processo.numero_novo }),
53
+ React.createElement(AddProcessoJuridicoField, { name: "N\u00FAmero CNJ", value: hasLiminar ? (React.createElement(CNJWithIcon, null,
54
+ React.createElement(WarningCircle, { size: 18, weight: "fill", style: { color: '#FFA500' } }),
55
+ React.createElement("span", null, processo.numero_novo))) : (processo.numero_novo) }),
47
56
  React.createElement(AddProcessoJuridicoField, { name: "Assunto(s)", value: processo.assuntos }),
48
57
  React.createElement(AddProcessoJuridicoField, { name: "Classe Processual", value: processo.classe_processual }),
49
58
  React.createElement(AddProcessoJuridicoField, { name: "Sigla do Di\u00E1rio", value: processo.diario_sigla }),
@@ -51,18 +60,31 @@ var ProcessoJuridicoItem = memo(function (_a) {
51
60
  React.createElement(EnvolvidosList, { envolvidos: processo === null || processo === void 0 ? void 0 : processo.envolvidos_ultima_movimentacao })),
52
61
  children));
53
62
  });
54
- var ResultList = styled(Result)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n > div {\n padding: 16px 0px;\n :not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n }\n"], ["\n > div {\n padding: 16px 0px;\n :not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n }\n"])), function (_a) {
63
+ var ResultList = styled(Result)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n > div {\n padding: 16px 0px;\n\n &:not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n }\n"], ["\n > div {\n padding: 16px 0px;\n\n &:not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n }\n"])), function (_a) {
55
64
  var theme = _a.theme;
56
65
  return theme.colors.cinzaClaro;
57
66
  });
58
67
  var ProcessosJuridicosList = function (_a) {
59
68
  var processos = _a.processos, onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico;
60
69
  var sortedProcessos = sortProcessosByDate(processos);
70
+ var _b = useState(null), highlightedId = _b[0], setHighlightedId = _b[1];
71
+ useEffect(function () {
72
+ var _a;
73
+ var hash = (_a = window.location.hash) === null || _a === void 0 ? void 0 : _a.replace('#', '');
74
+ if (hash) {
75
+ var el = document.getElementById(hash);
76
+ if (el) {
77
+ el.scrollIntoView({ behavior: 'smooth', block: 'start' });
78
+ setHighlightedId(hash);
79
+ setTimeout(function () { return setHighlightedId(null); }, 3000);
80
+ }
81
+ }
82
+ }, []);
61
83
  return (React.createElement(ResultList, { resultContentStriped: false }, sortedProcessos.map(function (processo, i) { return (React.createElement("div", { key: i },
62
- React.createElement(ProcessoJuridicoItem, { processo: processo },
84
+ React.createElement(ProcessoJuridicoItem, { processo: processo, highlighted: highlightedId === processo.id },
63
85
  React.createElement(ConsultarProcessoBtn, { onClick: onClickConsultarProcessoJuridico
64
86
  ? function () { return onClickConsultarProcessoJuridico(processo.id); }
65
87
  : undefined, smallContent: "R$ 1" }, "Consultar Processo")))); })));
66
88
  };
67
89
  export default ProcessosJuridicosList;
68
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
90
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
@@ -4,6 +4,6 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
4
4
  };
5
5
  import { createGlobalStyle, css } from 'styled-components';
6
6
  var OpenSansFont = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n @import url('https://fonts.googleapis.com/css?family=Open%20Sans%20Condensed:300,400,500,600,700');\n"], ["\n @import url('https://fonts.googleapis.com/css?family=Open%20Sans%20Condensed:300,400,500,600,700');\n"])));
7
- var GlobalStyle = createGlobalStyle(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n * {\n ", "\n font-family: 'Open Sans Condensed';\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n\n body {\n -webkit-font-smoothing: antialiased;\n }\n\n @media print {\n button,\n [class*=\"Button\"],\n [class^=\"Button\"],\n [class*=\"btn\"],\n [class^=\"btn\"],\n .button,\n .btn {\n display: none !important;\n }\n }\n"], ["\n * {\n ", "\n font-family: 'Open Sans Condensed';\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n\n body {\n -webkit-font-smoothing: antialiased;\n }\n\n @media print {\n button,\n [class*=\"Button\"],\n [class^=\"Button\"],\n [class*=\"btn\"],\n [class^=\"btn\"],\n .button,\n .btn {\n display: none !important;\n }\n }\n"])), OpenSansFont);
7
+ var GlobalStyle = createGlobalStyle(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n * {\n ", "\n font-family: 'Open Sans Condensed';\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n\n body {\n -webkit-font-smoothing: antialiased;\n }\n\n @media print {\n button,\n [class*=\"Button\"],\n [class^=\"Button\"],\n [class*=\"btn\"],\n [class^=\"btn\"],\n .button,\n .btn {\n display: none !important;\n }\n }\n\n @keyframes highlight {\n from {\n background-color: rgba(255, 215, 0, 0.35);\n }\n to {\n background-color: transparent;\n }\n }\n\n .highlighted-process {\n animation: highlight 3s ease-out forwards !important;\n }\n"], ["\n * {\n ", "\n font-family: 'Open Sans Condensed';\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n\n body {\n -webkit-font-smoothing: antialiased;\n }\n\n @media print {\n button,\n [class*=\"Button\"],\n [class^=\"Button\"],\n [class*=\"btn\"],\n [class^=\"btn\"],\n .button,\n .btn {\n display: none !important;\n }\n }\n\n @keyframes highlight {\n from {\n background-color: rgba(255, 215, 0, 0.35);\n }\n to {\n background-color: transparent;\n }\n }\n\n .highlighted-process {\n animation: highlight 3s ease-out forwards !important;\n }\n"])), OpenSansFont);
8
8
  export default GlobalStyle;
9
9
  var templateObject_1, templateObject_2;