@credithub/harlan-components 1.69.3 → 1.69.4

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.
@@ -40,24 +40,15 @@ var businessTypes = [
40
40
  'banco',
41
41
  'cooperativa'
42
42
  ];
43
- /* ----------------------------------
44
- * Componente
45
- * ---------------------------------*/
46
43
  var Liminar = function () {
47
- var _a, _b, _c, _d;
48
- /* -------- Contextos -------- */
44
+ var _a, _b, _c, _d, _e, _f, _g, _h;
49
45
  var ctx = useContext(Queries.LiminarCenprot);
50
- var _e = useGlobalData(), globalData = _e.data, setData = _e.setData;
51
- /* -------- Refs -------- */
46
+ var _j = useGlobalData(), globalData = _j.data, setData = _j.setData;
52
47
  var processedRef = useRef(false);
53
48
  var dataHashRef = useRef('');
54
49
  var invertedIdsRef = useRef([]);
55
- /* -------- Tooltip -------- */
56
- var _f = useState(false), isTooltipVisible = _f[0], setTooltipVisible = _f[1];
50
+ var _k = useState(false), isTooltipVisible = _k[0], setTooltipVisible = _k[1];
57
51
  var hideTt = useRef();
58
- /* ----------------------------------
59
- * Pré-processamentos
60
- * ---------------------------------*/
61
52
  var tiposDocumento = useMemo(function () {
62
53
  var _a;
63
54
  var raw = (_a = ctx.document) === null || _a === void 0 ? void 0 : _a.type;
@@ -65,7 +56,6 @@ var Liminar = function () {
65
56
  return raw.map(function (t) { return t.toLowerCase(); });
66
57
  return raw ? [String(raw).toLowerCase()] : [];
67
58
  }, [ctx.document]);
68
- /* -------- Processos relevantes -------- */
69
59
  var processosComAssuntoValido = useMemo(function () {
70
60
  var _a, _b, _c, _d;
71
61
  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 : '';
@@ -92,8 +82,7 @@ var Liminar = function () {
92
82
  (_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel,
93
83
  (_b = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _b === void 0 ? void 0 : _b.empresa
94
84
  ]);
95
- /* -------- Labels de origem + entidade PJ -------- */
96
- var _g = useMemo(function () {
85
+ var _l = useMemo(function () {
97
86
  var _a;
98
87
  var labels = new Set();
99
88
  var indiciosApi = ((_a = ctx.document) === null || _a === void 0 ? void 0 : _a.indiciosDeLiminar) === true;
@@ -119,24 +108,7 @@ var Liminar = function () {
119
108
  });
120
109
  });
121
110
  return { origensDetectadas: Array.from(labels), foundBusinessEntity: pj };
122
- }, [ctx.document, tiposDocumento, processosComAssuntoValido]), origensDetectadas = _g.origensDetectadas, foundBusinessEntity = _g.foundBusinessEntity;
123
- /* ----------------------------------
124
- * Efeito 1 – invertedProcessos
125
- * ---------------------------------*/
126
- useEffect(function () {
127
- if (!foundBusinessEntity)
128
- return;
129
- var newIds = processosComAssuntoValido.map(function (p) { return p.id; });
130
- var same = newIds.length === invertedIdsRef.current.length &&
131
- newIds.every(function (id, i) { return id === invertedIdsRef.current[i]; });
132
- if (same)
133
- return;
134
- invertedIdsRef.current = newIds;
135
- setData(function (prev) { return (__assign(__assign({}, prev), { liminar: __assign(__assign({}, prev.liminar), { invertedProcessos: newIds }) })); });
136
- }, [foundBusinessEntity, processosComAssuntoValido, setData]);
137
- /* ----------------------------------
138
- * Efeito 2 – cálculo final
139
- * ---------------------------------*/
111
+ }, [ctx.document, tiposDocumento, processosComAssuntoValido]), origensDetectadas = _l.origensDetectadas, foundBusinessEntity = _l.foundBusinessEntity;
140
112
  useEffect(function () {
141
113
  var _a, _b;
142
114
  var dossie = globalData === null || globalData === void 0 ? void 0 : globalData.dossie;
@@ -144,11 +116,14 @@ var Liminar = function () {
144
116
  var depsLoaded = !!(processosJuridicos === null || processosJuridicos === void 0 ? void 0 : processosJuridicos.isLoaded) && !!(dossie === null || dossie === void 0 ? void 0 : dossie.carousel);
145
117
  if (!depsLoaded || ctx.type === RequestStatus.Loading)
146
118
  return;
119
+ var newIds = foundBusinessEntity
120
+ ? processosComAssuntoValido.map(function (p) { return p.id; })
121
+ : [];
147
122
  var hash = JSON.stringify({
148
123
  t: ctx.type,
149
124
  indicios: (_a = ctx.document) === null || _a === void 0 ? void 0 : _a.indiciosDeLiminar,
150
- carousel: dossie.carousel, // non-null após depsLoaded
151
- empresas: processosJuridicos.empresa // idem
125
+ carousel: dossie.carousel,
126
+ empresas: processosJuridicos.empresa
152
127
  });
153
128
  if (hash === dataHashRef.current)
154
129
  return;
@@ -157,11 +132,13 @@ var Liminar = function () {
157
132
  var finalStatus = indiciosApi || processosComAssuntoValido.length
158
133
  ? 'Encontrado'
159
134
  : 'Não encontrado';
135
+ invertedIdsRef.current = newIds;
160
136
  setData(function (prev) { return (__assign(__assign({}, prev), { liminar: {
161
137
  indiciosDeLiminar: indiciosApi,
162
138
  message: finalStatus,
163
139
  isLoaded: true,
164
- processosComLiminarIds: processosComAssuntoValido.map(function (p) { return p.id; })
140
+ processosComLiminarIds: processosComAssuntoValido.map(function (p) { return p.id; }),
141
+ invertedProcessos: newIds
165
142
  } })); });
166
143
  processedRef.current = true;
167
144
  }, [
@@ -170,20 +147,14 @@ var Liminar = function () {
170
147
  globalData === null || globalData === void 0 ? void 0 : globalData.dossie,
171
148
  globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData,
172
149
  processosComAssuntoValido,
173
- setData
150
+ setData,
151
+ foundBusinessEntity
174
152
  ]);
175
- /* ----------------------------------
176
- * Flags de renderização
177
- * ---------------------------------*/
178
153
  var ready = processedRef.current &&
179
154
  !!((_c = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _c === void 0 ? void 0 : _c.isLoaded) &&
180
155
  !!((_d = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _d === void 0 ? void 0 : _d.carousel) &&
181
156
  ctx.type !== RequestStatus.Loading;
182
- /* ctx “loading” enqto não pronto */
183
157
  var ctxLoading = useMemo(function () { return (__assign(__assign({}, ctx), { type: RequestStatus.Loading })); }, [ctx]);
184
- /* ----------------------------------
185
- * UI helpers
186
- * ---------------------------------*/
187
158
  var scrollToProcesso = function (id) {
188
159
  var el = document.getElementById(id);
189
160
  if (!el)
@@ -195,9 +166,14 @@ var Liminar = function () {
195
166
  var renderTooltipIcon = function () { return (React.createElement(WarningCircle, { weight: "fill", size: 24, color: origensDetectadas.length
196
167
  ? theme.colors.erroClaro
197
168
  : theme.colors.cinzaClaro, style: { marginLeft: 4 } })); };
198
- /* ----------------------------------
199
- * Render
200
- * ---------------------------------*/
169
+ var tooltipMessage = foundBusinessEntity
170
+ ? '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
+ : 'Processos com indícios encontrados:';
172
+ var shouldRender = ready &&
173
+ (((_e = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _e === void 0 ? void 0 : _e.indiciosDeLiminar) ||
174
+ ((_h = (_g = (_f = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _f === void 0 ? void 0 : _f.processosComLiminarIds) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0) > 0);
175
+ if (!shouldRender)
176
+ return null;
201
177
  return (React.createElement(Section, { title: React.createElement(TitleWithTooltip, null,
202
178
  "Liminares para Remo\u00E7\u00E3o de Protesto",
203
179
  !!processosComAssuntoValido.length && ready && (React.createElement(TooltipContainer, { onMouseEnter: function () {
@@ -209,7 +185,7 @@ var Liminar = function () {
209
185
  renderTooltipIcon(),
210
186
  React.createElement(TooltipText, { visible: isTooltipVisible },
211
187
  React.createElement(React.Fragment, null,
212
- "Processos com ind\u00EDcios encontrados:",
188
+ tooltipMessage,
213
189
  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: {
214
190
  fontSize: 13,
215
191
  cursor: 'pointer',
@@ -50,9 +50,7 @@ var ProcessoJuridicoItem = memo(function (_a) {
50
50
  var isInverted = (_f = (_e = global === null || global === void 0 ? void 0 : global.liminar) === null || _e === void 0 ? void 0 : _e.invertedProcessos) === null || _f === void 0 ? void 0 : _f.includes(processo.id);
51
51
  var tooltipText = isInverted
52
52
  ? 'Atenção: Em alguns casos, o sistema judicial pode registrar os polos das partes de forma invertida, dificultando a interpretação direta.'
53
- : hasLiminar
54
- ? 'Indício de liminar identificada.'
55
- : '';
53
+ : 'Indício de liminar identificada.';
56
54
  return (React.createElement(ProcessoJuridicoWrapper, { id: processo.id, className: highlighted ? 'highlighted-process' : '' },
57
55
  React.createElement(ResultWrapper, null,
58
56
  React.createElement(ResultContent, { fullWidth: true, desktop: "1.5fr 1.5fr repeat(3, 1fr)", tablet: "repeat(3, 1fr)" },