@credithub/harlan-components 1.100.5 → 1.100.6

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.
@@ -45,6 +45,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
48
57
  /* eslint-disable react-hooks/exhaustive-deps */
49
58
  import ProtestosIcon from '../../assets/icones/protestos';
50
59
  import { useGlobalData } from '../../contexts/globalDataContext';
@@ -85,21 +94,21 @@ var businessTypes = [
85
94
  'cooperativa'
86
95
  ];
87
96
  var Liminar = function (_a) {
88
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
89
- var _s = _a.isFinancial, isFinancial = _s === void 0 ? false : _s, hasCredits = _a.hasCredits, _t = _a.tags, tags = _t === void 0 ? [] : _t;
97
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
98
+ var _t = _a.isFinancial, isFinancial = _t === void 0 ? false : _t, hasCredits = _a.hasCredits, _u = _a.tags, tags = _u === void 0 ? [] : _u;
90
99
  var ctx = useContext(Queries.LiminarCenprot);
91
- var _u = useGlobalData(), globalData = _u.data, setData = _u.setData;
100
+ var _v = useGlobalData(), globalData = _v.data, setData = _v.setData;
92
101
  var fetchLiminarProtestosDoPassado = useLiminarProtestosDoPassado({
93
102
  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) || ''
94
103
  }).fetchLiminarProtestosDoPassado;
95
- var _v = useState(false), isLoadingLiminarProtestosDoPassado = _v[0], setIsLoadingLiminarProtestosDoPassado = _v[1];
104
+ var _w = useState(false), isLoadingLiminarProtestosDoPassado = _w[0], setIsLoadingLiminarProtestosDoPassado = _w[1];
96
105
  var processedRef = useRef(false);
97
106
  var dataHashRef = useRef('');
98
107
  var invertedIdsRef = useRef([]);
99
- var _w = useState(false), isEmailModalOpen = _w[0], setIsEmailModalOpen = _w[1];
100
- var _x = useState(''), emailModalMessage = _x[0], setEmailModalMessage = _x[1];
108
+ var _x = useState(false), isEmailModalOpen = _x[0], setIsEmailModalOpen = _x[1];
109
+ var _y = useState(''), emailModalMessage = _y[0], setEmailModalMessage = _y[1];
101
110
  var liminarMailPrice = 50000;
102
- var _y = useFetch("SELECT FROM 'LIMINAR'.'SENDMAIL'"), sendIndiciosEmail = _y.fetch, isEmailSending = _y.isLoading, emailError = _y.error;
111
+ var _z = useFetch("SELECT FROM 'LIMINAR'.'SENDMAIL'"), sendIndiciosEmail = _z.fetch, isEmailSending = _z.isLoading, emailError = _z.error;
103
112
  /*
104
113
  * Extrai e normaliza os tipos de documento presentes em ctx.document, retornando sempre um array de strings em minúsculo.
105
114
  */
@@ -141,7 +150,7 @@ var Liminar = function (_a) {
141
150
  /*
142
151
  * Identifica as origens de liminares detectadas e verifica se existe liminar de protesto invertida
143
152
  */
144
- var _z = useMemo(function () {
153
+ var _0 = useMemo(function () {
145
154
  var _a, _b;
146
155
  var labels = new Set();
147
156
  var indiciosApi = ((_a = ctx.document) === null || _a === void 0 ? void 0 : _a.indiciosDeLiminar) === true;
@@ -177,13 +186,13 @@ var Liminar = function (_a) {
177
186
  tiposDocumento,
178
187
  processosComAssuntoValido,
179
188
  (_f = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _f === void 0 ? void 0 : _f.indiciosDeLiminarProtestosDoPassado
180
- ]), origensDetectadas = _z.origensDetectadas, foundBusinessEntity = _z.foundBusinessEntity;
181
- var protestosIsReady = useMemo(function () { var _a; return (_a = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _a === void 0 ? void 0 : _a.isLoaded; }, [globalData]);
189
+ ]), origensDetectadas = _0.origensDetectadas, foundBusinessEntity = _0.foundBusinessEntity;
190
+ var protestosIsReady = useMemo(function () { var _a; return !!((_a = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _a === void 0 ? void 0 : _a.isLoaded); }, [(_g = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _g === void 0 ? void 0 : _g.isLoaded]);
182
191
  useEffect(function () {
183
192
  if (!protestosIsReady)
184
193
  return;
185
194
  var fetch = function () { return __awaiter(void 0, void 0, void 0, function () {
186
- var dossie, processosJuridicos, depsLoaded, newIds, hash, indiciosApi, indiciosDeLiminarProtestosDoPassado, protestosDoPassadoIds, _a, possuiIndiciosDeLiminarProtestosDoPassado, protestosIds, finalStatus, descricaoLiminar;
195
+ var dossie, processosJuridicos, depsLoaded, newIds, hash, indiciosApi, indiciosDeLiminarProtestosDoPassado, protestosDoPassadoIds, _a, possuiIndiciosDeLiminarProtestosDoPassado, protestosIds, origens, finalStatus, descricaoLiminar;
187
196
  var _b, _c;
188
197
  return __generator(this, function (_d) {
189
198
  switch (_d.label) {
@@ -212,8 +221,11 @@ var Liminar = function (_a) {
212
221
  return [4 /*yield*/, fetchLiminarProtestosDoPassado()];
213
222
  case 1:
214
223
  _a = _d.sent(), possuiIndiciosDeLiminarProtestosDoPassado = _a.possuiIndiciosDeLiminarProtestosDoPassado, protestosIds = _a.protestosDoPassadoIds;
224
+ origens = __spreadArray([], origensDetectadas, true);
215
225
  if (possuiIndiciosDeLiminarProtestosDoPassado) {
216
- origensDetectadas.push('Liminar no Cenprot');
226
+ if (!origens.includes('Liminar no Cenprot')) {
227
+ origens.push('Liminar no Cenprot');
228
+ }
217
229
  indiciosDeLiminarProtestosDoPassado =
218
230
  possuiIndiciosDeLiminarProtestosDoPassado;
219
231
  protestosDoPassadoIds = protestosIds.join(',');
@@ -225,11 +237,11 @@ var Liminar = function (_a) {
225
237
  ? 'Encontrado'
226
238
  : 'Não encontrado';
227
239
  invertedIdsRef.current = newIds;
228
- descricaoLiminar = origensDetectadas.length
229
- ? "Liminar encontrada ".concat(origensDetectadas
240
+ descricaoLiminar = (origens.length
241
+ ? "Liminar encontrada ".concat(origens
230
242
  .map(function (o) { return o.replace(/^Liminar (no|na) /, 'no '); })
231
243
  .join(', '))
232
- : 'Não encontrado';
244
+ : 'Não encontrado');
233
245
  setData(function (prev) { return (__assign(__assign({}, prev), { liminar: {
234
246
  /* -------------------------------------------------------------
235
247
  * Há 3 fontes possíveis de indício de liminar:
@@ -246,7 +258,7 @@ var Liminar = function (_a) {
246
258
  indiciosDeLiminarProtestosDoPassado: indiciosDeLiminarProtestosDoPassado,
247
259
  protestosDoPassadoIds: protestosDoPassadoIds,
248
260
  invertedProcessos: newIds,
249
- origensLiminar: origensDetectadas,
261
+ origensLiminar: origens,
250
262
  descricaoLiminar: descricaoLiminar
251
263
  } })); });
252
264
  processedRef.current = true;
@@ -267,8 +279,8 @@ var Liminar = function (_a) {
267
279
  foundBusinessEntity
268
280
  ]);
269
281
  var ready = processedRef.current &&
270
- !!((_g = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _g === void 0 ? void 0 : _g.isLoaded) &&
271
- !!((_h = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _h === void 0 ? void 0 : _h.carousel) &&
282
+ !!((_h = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _h === void 0 ? void 0 : _h.isLoaded) &&
283
+ !!((_j = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _j === void 0 ? void 0 : _j.carousel) &&
272
284
  !isLoadingLiminarProtestosDoPassado &&
273
285
  ctx.type !== RequestStatus.Loading;
274
286
  var ctxLoading = useMemo(function () { return (__assign(__assign({}, ctx), { type: RequestStatus.Loading })); }, [ctx]);
@@ -302,7 +314,7 @@ var Liminar = function (_a) {
302
314
  return Array.from(set);
303
315
  }, [
304
316
  ctx.document,
305
- (_j = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _j === void 0 ? void 0 : _j.indiciosDeLiminarProtestosDoPassado,
317
+ (_k = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _k === void 0 ? void 0 : _k.indiciosDeLiminarProtestosDoPassado,
306
318
  processosComAssuntoValido
307
319
  ]);
308
320
  // Se existem tipos que de fato contribuíram para o indício,
@@ -313,11 +325,11 @@ var Liminar = function (_a) {
313
325
  return (((_a = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _a === void 0 ? void 0 : _a.protestosDoPassadoIds) || '')
314
326
  .split(',')
315
327
  .filter(Boolean);
316
- }, [(_k = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _k === void 0 ? void 0 : _k.protestosDoPassadoIds]);
328
+ }, [(_l = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _l === void 0 ? void 0 : _l.protestosDoPassadoIds]);
317
329
  var processIdsForHistory = useMemo(function () { return processosComAssuntoValido.map(function (p) { return p.id; }); }, [processosComAssuntoValido]);
318
330
  // 🔔 grava o histórico assim que todos os dados necessários existirem
319
331
  useLiminarHistory({
320
- documento: ((_m = (_l = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _l === void 0 ? void 0 : _l.carousel) === null || _m === void 0 ? void 0 : _m.document) || '',
332
+ documento: ((_o = (_m = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _m === void 0 ? void 0 : _m.carousel) === null || _o === void 0 ? void 0 : _o.document) || '',
321
333
  // Garantimos que o histórico só registra "true" quando houve fonte real,
322
334
  // evitando falso-positivos vindos do estado agregado da UI.
323
335
  indicioDeLiminar: indicioDeLiminarForHistory,
@@ -340,10 +352,20 @@ var Liminar = function (_a) {
340
352
  var tooltipMessage = foundBusinessEntity
341
353
  ? '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.'
342
354
  : 'Processos com indícios encontrados:';
343
- var shouldRender = isLoadingLiminarProtestosDoPassado ||
344
- (ready &&
345
- (((_o = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _o === void 0 ? void 0 : _o.indiciosDeLiminar) ||
346
- ((_r = (_q = (_p = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _p === void 0 ? void 0 : _p.processosComLiminarIds) === null || _q === void 0 ? void 0 : _q.length) !== null && _r !== void 0 ? _r : 0) > 0));
355
+ var hasFoundIndicio = useMemo(function () {
356
+ var _a, _b, _c, _d;
357
+ return !!(((_a = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _a === void 0 ? void 0 : _a.indiciosDeLiminar) ||
358
+ ((_d = (_c = (_b = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _b === void 0 ? void 0 : _b.processosComLiminarIds) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0);
359
+ }, [
360
+ (_p = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _p === void 0 ? void 0 : _p.indiciosDeLiminar,
361
+ (_q = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _q === void 0 ? void 0 : _q.processosComLiminarIds
362
+ ]);
363
+ var isLoadingPhase = ctx.type === RequestStatus.Loading ||
364
+ !protestosIsReady ||
365
+ !((_r = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _r === void 0 ? void 0 : _r.isLoaded) ||
366
+ !((_s = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _s === void 0 ? void 0 : _s.carousel) ||
367
+ isLoadingLiminarProtestosDoPassado;
368
+ var shouldRender = isLoadingPhase || (processedRef.current && hasFoundIndicio);
347
369
  // Função para disparar o envio do e-mail e configurar a mensagem do modal
348
370
  var handleSendEmailIndicios = function (e) { return __awaiter(void 0, void 0, void 0, function () {
349
371
  var callback;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- declare const GlobalStyleWithHelmet: React.FC;
3
- export default GlobalStyleWithHelmet;
2
+ declare const GlobalStyleProvider: React.FC;
3
+ export default GlobalStyleProvider;
@@ -4,13 +4,11 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
4
4
  };
5
5
  // src/styles/globalStyle.tsx
6
6
  import { createGlobalStyle } from 'styled-components';
7
- import { Helmet } from 'react-helmet';
8
7
  import React from 'react';
9
- var GlobalStyle = createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n /* Google Fonts s\u00E3o carregados via Helmet */\n\n /* Reset + fonte padr\u00E3o para toda a aplica\u00E7\u00E3o (inclui modais e portais) */\n *, *::before, *::after {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n font-family: 'Open Sans Condensed', sans-serif;\n }\n\n body {\n -webkit-font-smoothing: antialiased;\n }\n\n /* Oculta bot\u00F5es na impress\u00E3o */\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 /* Anima\u00E7\u00F5es utilit\u00E1rias */\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 @keyframes blueHighlight {\n from {\n background-color: rgba(0, 122, 255, 0.35);\n }\n to {\n background-color: rgba(0, 122, 255, 0.15);\n }\n }\n\n .blue-highlighted-process {\n animation: blueHighlight 2.5s ease-in-out;\n background-color: rgba(0, 122, 255, 0.15);\n transition: background-color 0.3s ease-in-out;\n }\n\n virtual-tag {\n display: contents;\n }\n"], ["\n /* Google Fonts s\u00E3o carregados via Helmet */\n\n /* Reset + fonte padr\u00E3o para toda a aplica\u00E7\u00E3o (inclui modais e portais) */\n *, *::before, *::after {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n font-family: 'Open Sans Condensed', sans-serif;\n }\n\n body {\n -webkit-font-smoothing: antialiased;\n }\n\n /* Oculta bot\u00F5es na impress\u00E3o */\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 /* Anima\u00E7\u00F5es utilit\u00E1rias */\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 @keyframes blueHighlight {\n from {\n background-color: rgba(0, 122, 255, 0.35);\n }\n to {\n background-color: rgba(0, 122, 255, 0.15);\n }\n }\n\n .blue-highlighted-process {\n animation: blueHighlight 2.5s ease-in-out;\n background-color: rgba(0, 122, 255, 0.15);\n transition: background-color 0.3s ease-in-out;\n }\n\n virtual-tag {\n display: contents;\n }\n"])));
10
- // Componente que combina GlobalStyle com Helmet para fontes
11
- var GlobalStyleWithHelmet = function () { return (React.createElement("virtual-tag", null,
12
- React.createElement(Helmet, null,
13
- React.createElement("link", { href: "https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght@300;400;500;600;700&display=swap", rel: "stylesheet" })),
8
+ var GlobalStyle = createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n /* Reset + fonte padr\u00E3o para toda a aplica\u00E7\u00E3o (inclui modais e portais) */\n *, *::before, *::after {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n font-family: 'Open Sans Condensed', sans-serif;\n }\n\n body {\n -webkit-font-smoothing: antialiased;\n }\n\n /* Oculta bot\u00F5es na impress\u00E3o */\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 /* Anima\u00E7\u00F5es utilit\u00E1rias */\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 @keyframes blueHighlight {\n from {\n background-color: rgba(0, 122, 255, 0.35);\n }\n to {\n background-color: rgba(0, 122, 255, 0.15);\n }\n }\n\n .blue-highlighted-process {\n animation: blueHighlight 2.5s ease-in-out;\n background-color: rgba(0, 122, 255, 0.15);\n transition: background-color 0.3s ease-in-out;\n }\n\n virtual-tag {\n display: contents;\n }\n"], ["\n /* Reset + fonte padr\u00E3o para toda a aplica\u00E7\u00E3o (inclui modais e portais) */\n *, *::before, *::after {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n font-family: 'Open Sans Condensed', sans-serif;\n }\n\n body {\n -webkit-font-smoothing: antialiased;\n }\n\n /* Oculta bot\u00F5es na impress\u00E3o */\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 /* Anima\u00E7\u00F5es utilit\u00E1rias */\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 @keyframes blueHighlight {\n from {\n background-color: rgba(0, 122, 255, 0.35);\n }\n to {\n background-color: rgba(0, 122, 255, 0.15);\n }\n }\n\n .blue-highlighted-process {\n animation: blueHighlight 2.5s ease-in-out;\n background-color: rgba(0, 122, 255, 0.15);\n transition: background-color 0.3s ease-in-out;\n }\n\n virtual-tag {\n display: contents;\n }\n"])));
9
+ // Componente que aplica os estilos globais da aplicação.
10
+ // A fonte "Open Sans Condensed" é carregada via index.html.
11
+ var GlobalStyleProvider = function () { return (React.createElement("virtual-tag", null,
14
12
  React.createElement(GlobalStyle, null))); };
15
- export default GlobalStyleWithHelmet;
13
+ export default GlobalStyleProvider;
16
14
  var templateObject_1;